tencil 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as withoutNpmEnv, D as createLocalPairingCode, E as DEFAULT_T3_URL, F as EnsembleCredentialStore, I as EnsembleClient, M as loadAgentSdk, O as exchangePairingCredential, S as defaultDataDir, T as CredentialStore, _ as detectAgents, a as readPlan, b as savedProvider, c as runtimeDir, d as uninstallService, f as startInBackground, g as PROVIDERS, h as updateNotice, i as finishUpdate, j as codexProblem, k as parsePairingInput, l as isServiceInstalled, m as isNewerThanThis, n as probeDaemon, o as enableAutostart, p as stopDaemon, r as startDaemon, s as ensureDaemon, t as DEFAULT_PORT, u as stopService, v as providerLabel, w as VERSION, y as saveProvider } from "./server-
|
|
2
|
+
import { A as withoutNpmEnv, D as createLocalPairingCode, E as DEFAULT_T3_URL, F as EnsembleCredentialStore, I as EnsembleClient, M as loadAgentSdk, O as exchangePairingCredential, S as defaultDataDir, T as CredentialStore, _ as detectAgents, a as readPlan, b as savedProvider, c as runtimeDir, d as uninstallService, f as startInBackground, g as PROVIDERS, h as updateNotice, i as finishUpdate, j as codexProblem, k as parsePairingInput, l as isServiceInstalled, m as isNewerThanThis, n as probeDaemon, o as enableAutostart, p as stopDaemon, r as startDaemon, s as ensureDaemon, t as DEFAULT_PORT, u as stopService, v as providerLabel, w as VERSION, y as saveProvider } from "./server-CjZNKv1m.mjs";
|
|
3
3
|
import { t as DEFAULT_CLOUD_URL } from "./cloud-CiwIrP1h.mjs";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
import { existsSync, rmSync } from "node:fs";
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as projectStorePath, L as Bridge, N as ProjectResolver, P as projectRoot, R as renderPrompt, S as defaultDataDir, n as probeDaemon, r as startDaemon, t as DEFAULT_PORT, x as FileThreadStore, z as stripContext } from "./server-
|
|
1
|
+
import { C as projectStorePath, L as Bridge, N as ProjectResolver, P as projectRoot, R as renderPrompt, S as defaultDataDir, n as probeDaemon, r as startDaemon, t as DEFAULT_PORT, x as FileThreadStore, z as stripContext } from "./server-CjZNKv1m.mjs";
|
|
2
2
|
export { Bridge, DEFAULT_PORT, ProjectResolver, FileThreadStore as ThreadStore, defaultDataDir, probeDaemon, projectRoot, projectStorePath, renderPrompt, startDaemon, stripContext };
|
package/dist/overlay.global.js
CHANGED
|
@@ -66,8 +66,8 @@ let Yi=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,Xi=[`rsc://`,`file:///`,`webpack-internal://`
|
|
|
66
66
|
`)} {
|
|
67
67
|
${n}
|
|
68
68
|
}
|
|
69
|
-
`}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&Z(h)&&(i.time(`embed web font`),await mu(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),pu(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Tu(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&tu(n),await m?.(y),y}function Tu(e,t){let{width:n,height:r}=t,i=hl(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Eu(e,t){let n=await Dl(e,t),r=await wu(n),i=gl(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=kl(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(ml,`defs`),n.svgStyles.clear()),await jl(yl(i,r.ownerDocument),n)}async function Du(e,t){let n=await Dl(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Eu(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&Lc&&Rc){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Nc(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Mc(u,o,r):Dc(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Ou(e,t){return Du(await Dl(e,{...t,type:`image/jpeg`}))}async function ku(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Ou(r,{scale:a,quality:.85,backgroundColor:Au(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function Au(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var ju=0;Array.isArray;function Q(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ju,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Mu={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`},ensemble:{viewBox:`2 2 16 16`,path:[{x:2.5,y:3.25,height:13.5,opacity:.6},{x:6.5,y:2,height:16,opacity:1},{x:10.5,y:2.75,height:14.5,opacity:.8},{x:14.5,y:4.25,height:11.5,opacity:.5}],className:`agent-mono`,label:`Ensemble`}};function Nu(e){if(Mu[e])return Mu[e];let t=e.toLowerCase();if(t.includes(`claude`))return Mu.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Mu.codex;if(t.includes(`cursor`))return Mu.cursor;if(t.includes(`ensemble`))return Mu.ensemble}function Pu({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Nu(e);return r?/* @__PURE__ */ Q(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:typeof r.path==`string`?/* @__PURE__ */ Q(`path`,{d:r.path}):r.path.map(e=>/* @__PURE__ */ Q(`rect`,{x:e.x,y:e.y,width:`3`,height:e.height,rx:`0.15`,"fill-opacity":e.opacity},e.x))}):null}function $({children:e,size:t=16}){return/* @__PURE__ */ Q(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Fu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ Q(`path`,{d:`M12 8v8M8 12h8`})]}),Iu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ Q(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),Lu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ Q(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ Q(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),Ru=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),zu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),Bu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),Vu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M20 6 9 17l-5-5`})}),Hu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ Q(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),Uu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),Wu=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),Gu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M18 6 6 18M6 6l12 12`})}),Ku=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),qu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),Ju=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),Yu=({size:e=16})=>/* @__PURE__ */ Q(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:[/* @__PURE__ */ Q(`path`,{d:`M3 21V9a6 6 0 0 1 6-6h6a6 6 0 0 1 6 6v6a6 6 0 0 1-6 6Z`,fill:`#3b8dff`}),/* @__PURE__ */ Q(`path`,{d:`M9.25 7.5 16.5 12.6l-3.55.75-1.75 3.4Z`,fill:`#fff`,stroke:`#fff`,"stroke-linejoin":`round`})]}),Xu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ Q(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),Zu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),Qu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),$u=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m6 9 6 6 6-6`})}),ed=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M11.5 2.8a.6.6 0 0 1 1 0l2.6 5.3 5.8.8a.6.6 0 0 1 .3 1l-4.2 4.1 1 5.8a.6.6 0 0 1-.8.6L12 17.7l-5.2 2.7a.6.6 0 0 1-.8-.6l1-5.8-4.2-4.1a.6.6 0 0 1 .3-1l5.8-.8Z`})}),td=()=>/* @__PURE__ */ Q(`svg`,{width:14,height:14,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ Q(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 0-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3.1-.2-.4-.6-1.6 0-3.2 0 0 1-.3 3.4 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8.1 3.2.8.8 1.3 1.9 1.3 3.2 0 4.6-2.8 5.6-5.5 5.9.5.4.9 1.1.9 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3`})}),nd=F(()=>{let e=/* @__PURE__ */ new Map,t=[...lr.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function rd(){let e=fr.value.flatMap(e=>{let t=nd.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&V({type:`drafts.send`,drafts:e})&&(K.value=e[0]?.threadId??null)}function id(){let e=ad();if(J.value)return null;let t=G.value;return/* @__PURE__ */ Q(S,{children:[ur.value.map(e=>/* @__PURE__ */ Q(sd,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Q(od,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Q(md,{})]})}function ad(){let e=ur.value,t=sr.value,n=j({page:t,pins:[]}),[r,i]=k([]);return Ne(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:nd.value.get(e.id),variant:hd(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:z.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function od({pin:e}){or.value;let t=e.thread.anchor?Sc(e.thread.anchor):null;return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ Q(Vu,{})}),/* @__PURE__ */ Q(`span`,{class:`pin-shine`})]})]})}):null}function sd({thread:e}){if(or.value,!e.anchor)return null;let t=ar.value,n=t?.threadId===e.id,r=n?t.point:Sc(e.anchor);if(!r)return null;let i=K.value===e.id;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`pin pin-${hd(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>ld(t,e,r),onClick:()=>{if(cd===e.id){cd=null;return}G.value=null,K.value=i?null:e.id},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:nd.value.get(e.id)??`•`})})}let cd=null;function ld(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}cd=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!ar.value&&Math.hypot(r,o)<4||(ar.value={threadId:t.id,point:ud({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,dd,!0);let n=ar.value;n&&(ar.value=null,cd=t.id,e.type===`pointerup`&&fd(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,dd,!0)}function ud(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function dd(e){e.preventDefault()}function fd(e,t){let n=pd(t);if(!n)return;let r={selector:Zs(n),...Cc(n,t)};V({type:`thread.move`,threadId:e.id,anchor:r})&&ln({...e,anchor:r})}function pd(e){let t=bc();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function md(){or.value;let e=G.value,t=Sc(e.anchor,e.element);return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:`+`})}):null}function hd(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let gd=`tencil:open`;function _d(){let[e,t]=k(`page`),n=L.value?.label??`Agent`,r=I.value===`open`&&L.value?.state===`ready`,i=L.value?.id;return A(()=>{r&&q.value&&e===`provider`&&pn()},[e,q.value,r,i]),q.value?/* @__PURE__ */ Q(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Q(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Q(`div`,{class:`segmented`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{q.value=!1},children:/* @__PURE__ */ Q(Gu,{})})]}),e===`provider`?/* @__PURE__ */ Q(yd,{label:n}):/* @__PURE__ */ Q(vd,{scope:e})]}):null}function vd({scope:e}){let t=lr.value.filter(e=>Hn.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&cr(t.pageUrl)===sr.value);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Q(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Q(`input`,{type:`checkbox`,class:`checkbox-input`,checked:Hn.value,onChange:e=>{Hn.value=e.target.checked}}),/* @__PURE__ */ Q(Vu,{})]}),`Show resolved`]}),/* @__PURE__ */ Q(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:Mn.value.comment?/* @__PURE__ */ Q(S,{children:[`No pins yet. Press `,/* @__PURE__ */ Q(`kbd`,{children:Mn.value.comment}),` and click anything on the page.`]}):`No pins yet. Click Comment, then anything on the page.`}):t.map(e=>/* @__PURE__ */ Q(Sd,{thread:e},e.id))})]})}function yd({label:e}){let t=Kt.value;return t?t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Q(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Q(bd,{summary:e},e.id))}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function bd({summary:e}){let t=qt.value,n=[...z.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=hn(e);t&&(K.value=t)},children:[/* @__PURE__ */ Q(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Q(xd,{project:t}),/* @__PURE__ */ Q(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-${e.status}`,children:Td(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Q(`span`,{class:`provider-item-time`,children:Ed(e.updatedAt)})]}),/* @__PURE__ */ Q(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Q(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Q(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Q(Pu,{agent:e.agent})]})]})}function xd({project:e}){return e.emoji?/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Q(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function Sd({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||cr(e.pageUrl)===sr.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item${K.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(gd,e.id),location.href=e.pageUrl;return}K.value=e.id,Cd(e)},children:[t?/* @__PURE__ */ Q(`span`,{class:`pin pin-static pin-${hd(e)}`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:nd.value.get(e.id)})}):/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Q(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Q(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Q(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),wd(e),` · `,Ed(e.updatedAt)]}),r&&/* @__PURE__ */ Q(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Cd(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function wd(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function Td(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Ed(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Dd({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=k(t),u=j(null);A(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),A(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Q(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Q(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Q(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Q(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Q(`span`,{class:`spinner`}):/* @__PURE__ */ Q(zu,{})})]})]})}let Od=P(null);function kd(){or.value;let e=G.value,t=j(null),[n,r]=k(140),[i,a]=k(!1),[o,s]=k(!1),[c,l]=k(null),u=L.value?.state===`ready`,d=L.value?.id;if(A(()=>{e&&u&&(pn(),mn())},[e,u,d]),A(()=>{Od.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Sc(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Tc(f,{width:340,height:n}),g=L.value,_=g?.state===`ready`,v=Gn.value,y=v?null:Od.value,b=y?void 0:Pd(g?.id);return/* @__PURE__ */ Q(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Q(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Q(`span`,{class:`chip`,children:[/* @__PURE__ */ Q(qu,{}),e.label]}),g&&v&&/* @__PURE__ */ Q(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,fr.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Q($u,{})]})]}),e.measuredTo&&er.value&&/* @__PURE__ */ Q(jd,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ Q(Id,{onPick:e=>{Od.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Q(Fd,{choices:b,onPick:e=>{V({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Q(Dd,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=Nd(await e.context,e),r=[];if(i){let t=await ku(e.element,bc());t&&r.push(t)}let a=Rt(),o={...e.anchor,selector:n.selector};if(!V({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();ln({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),G.value=null,v?mr():K.value=a}finally{s(!1)}},onCancel:()=>{G.value=null},children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Q(Ku,{})}),Un.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{Wn.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Q(Xu,{})}),b&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Q(Pu,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Q($u,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Q(`p`,{class:`hint`,children:g.detail})]})}let Ad={top:`above`,right:`right`,bottom:`below`,left:`left`};function jd({pending:e}){let t=e.measuredTo,n=Md(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${Ad[e]}`);return/* @__PURE__ */ Q(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ Q(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{G.value&&={...G.value,measuredTo:void 0}},children:/* @__PURE__ */ Q(Gu,{})})]})}function Md(e){let t=e.measuredTo;return!t||!er.value||!e.element.isConnected||!t.element.isConnected?void 0:Ls(Is(Ps(e.element.getBoundingClientRect()),Ps(t.element.getBoundingClientRect())),{to:t.label,selector:Zs(t.element),...t.parent?{parent:!0}:{}})}function Nd(e,t){let n=Md(t);return n?{...e,spacing:n}:e}function Pd(e){let t=Jt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(R.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Fd({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Q(Pu,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function Id({onPick:e}){let t=Kt.value,n=Od.value?.id??null;return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Q(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Q(Pu,{agent:t.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Ed(t.updatedAt)})]},t.id))]})}function Ld(){or.value;let e=Rn.value;if(!e)return null;let t=U.value===`picking`,n=!t&&!G.value&&er.value&&zn.value&&!W.value;if(!t&&!n)return null;let r=Ps(e.getBoundingClientRect());return/* @__PURE__ */ Q(S,{children:[er.value&&(n||!zn.value)&&/* @__PURE__ */ Q(zd,{element:e,box:r}),/* @__PURE__ */ Q(`div`,{class:`highlight`,style:Wd(r)}),/* @__PURE__ */ Q(Rd,{element:e,box:r})]})}function Rd({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ Q(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[Xs(e),/* @__PURE__ */ Q(`span`,{class:`highlight-size`,children:[Fs(t.right-t.left),`×`,Fs(t.bottom-t.top)]})]})}function zd({element:e,box:t}){let n=Vs(e),r=[...Bd(e,t,n),...Vd(e,t,n),...Ud(e,t,n)];return/* @__PURE__ */ Q(S,{children:[r.map((e,t)=>/* @__PURE__ */ Q(`div`,{class:`band band-${e.kind}`,style:Wd(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ Q(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:Gd(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ Q(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function Bd(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return Hd(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function Vd(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return Hd(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function Hd(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:Ks(e,t,n,r)}))}function Ud(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return Hs(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?Ks(e,`gap`,r,n[r]):void 0}})}function Wd(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function Gd(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function Kd(){if(or.value,!er.value)return null;let e=U.value===`idle`&&!G.value?W.value?.element:void 0,t=Jd(e),n=e?.isConnected?Ps(e.getBoundingClientRect()):null;return/* @__PURE__ */ Q(S,{children:[e&&n&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Wd(n)}),/* @__PURE__ */ Q(Rd,{element:e,box:n})]}),t&&/* @__PURE__ */ Q(qd,{pair:t})]})}function qd({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Ps(e.getBoundingClientRect()),r=Ps(t.getBoundingClientRect()),i=G.value;return/* @__PURE__ */ Q(S,{children:[i?.element===e&&/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Wd(n)}),/* @__PURE__ */ Q(`div`,{class:`measure-target`,style:Wd(r)}),Is(n,r).map(e=>/* @__PURE__ */ Q(Yd,{guide:e},e.side))]})}function Jd(e){let t=Rn.value,n=G.value;if(U.value===`picking`||!n&&!e){let e=t?.parentElement;return!zn.value||!t||!e||e===document.documentElement?null:[t,e]}return e?zn.value&&t&&t!==e?[e,t]:null:n?zn.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function Yd({guide:e}){return/* @__PURE__ */ Q(S,{children:[e.extension&&/* @__PURE__ */ Q(`div`,{class:`guide guide-extension`,style:Xd(e.extension)}),/* @__PURE__ */ Q(`div`,{class:`guide`,style:Xd(e)}),/* @__PURE__ */ Q(`span`,{class:`guide-value`,style:{transform:Gd(Zd(e))},children:e.value})]})}function Xd(e){let t=Zd(e);return Wd(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function Zd({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function Qd({tone:e,label:t}){let[n,r]=k(!1),i=j(void 0);A(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ Q(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ Q(`span`,{class:`status-dot status-${e}`,children:pr.value>0&&/* @__PURE__ */ Q(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ Q($d,{tone:e})]})}function $d({tone:e}){return/* @__PURE__ */ Q(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ Q(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ Q(Yu,{size:18}),/* @__PURE__ */ Q(`strong`,{children:`Tencil`}),Ht.value&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:[`v`,Ht.value]})]}),/* @__PURE__ */ Q(nf,{tone:e})]})}function ef(e=tf()){let t=L.value,n=I.value,r=fr.value.length,i=pr.value,a=wt.value,o=[{label:rn()?`Tencil Cloud`:`Daemon`,tone:n===`open`?`ok`:e,value:n===`open`?`Connected`:n===`connecting`?`Connecting…`:`Offline`},{label:`Address`,value:cn()},{label:`Project`,value:Yt.value?`Not picked yet`:zt.value?.name??`…`,title:zt.value?.root},t?{label:`Agent`,tone:t.state===`ready`?`ok`:e,value:t.label,note:Pf(t)}:{label:`Agent`,value:`…`}];return t?.target&&o.push({label:`Workspace`,value:t.target}),a&&o.push({label:`Signed in`,value:a.login?`@${a.login}`:a.name,note:a.access===`read`?`view only`:void 0}),(i>0||r>0)&&o.push({label:`Pins`,value:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)}),o}function tf(){return I.value===`open`?`warn`:`error`}function nf({tone:e}){let t=L.value;return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`dl`,{class:`status-card-rows`,children:ef(e).map(e=>/* @__PURE__ */ Q(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ Q(`dt`,{children:e.label}),/* @__PURE__ */ Q(`dd`,{title:e.title,children:[e.tone&&/* @__PURE__ */ Q(`span`,{class:`status-card-tone tone-${e.tone}`}),e.value,e.note&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:e.note})]})]},e.label))}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`status-card-detail`,children:t.detail})]})}let rf=`https://github.com/tencildev/tencil`,af=`${rf}/blob/master/packages/tencil/CHANGELOG.md`,of=`npx tencil@latest setup`,sf=F(()=>!rn()&&!!Ut.value?.latest&&Ut.value.state===`idle`),cf=P(!1),lf=P(!1);function uf(){let e=Ht.value;if(rn()||!e)return null;let t=Ut.value,n=t?.state===`installing`||t?.state===`waiting`||t?.state===`restarting`,r=Gt.value;return/* @__PURE__ */ Q(`section`,{class:`settings-section settings-about`,"aria-label":`About Tencil`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-about-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:`Tencil`}),/* @__PURE__ */ Q(`span`,{class:`settings-version`,children:[`v`,e]})]}),r&&r!==e&&!t?.latest&&/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Updated from v`,r,`.`]}),t?.latest&&/* @__PURE__ */ Q(`div`,{class:`settings-update`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[/* @__PURE__ */ Q(`strong`,{children:[`Tencil `,t.latest,` is available.`]}),` `,/* @__PURE__ */ Q(`a`,{href:af,target:`_blank`,rel:`noreferrer`,children:`What's new`})]}),n&&/* @__PURE__ */ Q(`p`,{class:`settings-help settings-progress`,children:ff(t)}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action settings-update-button`,disabled:n,onClick:()=>V({type:`update.start`}),children:n?`Updating…`:t.state===`failed`?`Try again`:`Update`})]}),/* @__PURE__ */ Q(`div`,{class:`settings-links`,children:[/* @__PURE__ */ Q(`a`,{class:`settings-link`,href:rf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(td,{}),`tencildev/tencil`]}),/* @__PURE__ */ Q(`a`,{class:`settings-link`,href:af,target:`_blank`,rel:`noreferrer`,children:`Changelog`}),/* @__PURE__ */ Q(`a`,{class:`settings-link settings-star`,href:rf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(ed,{}),`Give us a star`]})]}),t?.state===`failed`&&/* @__PURE__ */ Q(`div`,{class:`settings-update-error`,role:`alert`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Couldn't update`,t.error?`: ${t.error}`:`.`,` Tencil `,e,` `,`is still running. Update from a terminal instead:`]}),/* @__PURE__ */ Q(`div`,{class:`settings-command`,children:[/* @__PURE__ */ Q(`code`,{children:of}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(of).then(()=>{cf.value=!0,setTimeout(()=>{cf.value=!1},1500)})},children:cf.value?`Copied`:`Copy`})]})]}),/* @__PURE__ */ Q(`details`,{class:`settings-debug`,children:[/* @__PURE__ */ Q(`summary`,{children:[/* @__PURE__ */ Q($u,{}),`Debug`]}),/* @__PURE__ */ Q(`div`,{class:`settings-debug-body`,children:[/* @__PURE__ */ Q(nf,{}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(df()).then(()=>{lf.value=!0,setTimeout(()=>{lf.value=!1},1500)})},children:lf.value?`Copied`:`Copy for a bug report`})]})]})]})}function df(){let e=L.value;return[`Tencil v${Ht.value??`?`}`,...ef().map(e=>`${e.label}: ${e.value}${e.note?` (${e.note})`:``}${e.title?` [${e.title}]`:``}`),...e&&e.state!==`ready`&&e.detail?[`Detail: ${e.detail}`]:[],`Page: ${location.origin}${location.pathname}`,`Browser: ${navigator.userAgent}`].join(`
|
|
70
|
-
`)}function ff(e){switch(e.state){case`installing`:return`Installing Tencil ${e.latest}…`;case`waiting`:{let t=e.running??1;return`Waiting for ${t} running ${t===1?`thread`:`threads`} to finish…`}default:return`Restarting on Tencil ${e.latest}…`}}function pf(){let e=Vt.value;return/* @__PURE__ */ Q(`div`,{class:`settings-section overview`,children:e&&!rn()?/* @__PURE__ */ Q(mf,{source:e}):/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins on this page go to this project.`})})}function mf({source:e}){let[t,n]=k(!1),[r,i]=k(``),a=j(null);A(()=>{t&&a.current?.focus()},[t]);let o=e.via===`picked`,s=Bt.value,c=r.trim().toLowerCase(),l=zt.value?.root,u=(s??[]).filter(e=>e.root!==l&&(!c||e.title.toLowerCase().includes(c)||e.root.toLowerCase().includes(c))),d=e=>{V({type:`project.select`,root:e}),n(!1),i(``)};return/* @__PURE__ */ Q(`div`,{class:`overview-block`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-label`,children:`Project detection`}),/* @__PURE__ */ Q(`div`,{class:`detection`,children:[/* @__PURE__ */ Q(`span`,{class:`detection-badge${o?` detection-picked`:``}`,children:o?`Picked`:`Automatic`}),/* @__PURE__ */ Q(`span`,{class:`settings-help detection-reason`,children:hf(e)}),/* @__PURE__ */ Q(`span`,{class:`detection-actions`,children:[e.detected&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-button`,onClick:()=>e.detected&&d(e.detected.root),children:`Use automatic`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-button`,"aria-expanded":t,onClick:()=>{t||(Bt.value=null,V({type:`project.choices`})),n(!t)},children:t?`Cancel`:`Change`})]})]}),t&&/* @__PURE__ */ Q(`div`,{class:`detection-picker`,children:[/* @__PURE__ */ Q(`input`,{class:`detection-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,ref:a,value:r,onInput:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u[0]&&d(u[0].root)}}),/* @__PURE__ */ Q(`div`,{class:`detection-list`,children:s===null?/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Looking for projects…`}):u.length===0?/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:c?`No project matches “${r.trim()}”.`:`No other projects found.`}):u.map(e=>/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-option`,title:e.root,onClick:()=>d(e.root),children:[/* @__PURE__ */ Q(`span`,{class:`detection-option-name`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`detection-option-root`,children:``+e.root})]},e.root))}),/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Kept for this address while Tencil finds the same project here. When another app takes the port, detection decides again.`})]})]})}function hf(e){if(e.via===`picked`)return e.detected?`You picked it instead of ${e.detected.root.split(/[\\/]/).filter(Boolean).pop()??`the detected project`}.`:`You picked it for this address: Tencil couldn't tell from the page.`;switch(e.via){case`plugin`:return`The git repository the Vite or Next.js plugin passed along.`;case`port`:return`The dev server listening on port ${e.port}.`;case`docker`:return`The Docker Compose project publishing port ${e.port}.`;default:return`The Ensemble thread whose dev server runs on port ${e.port}.`}}let gf=[{action:`comment`,label:`Comment`},{action:`ruler`,label:`Ruler`},{action:`measure`,label:`Measure`,help:`Held while hovering, with the ruler on.`},{action:`hidePins`,label:`Hide pins`},{action:`hideDock`,label:`Hide the dock`,help:`Also brings a hidden dock back.`}],_f=[`comment`,`ruler`,`hidePins`,`hideDock`];function vf(){let[e,t]=k(null),[n,r]=k(null),[i,a]=k(null),o=H.value;A(()=>{Sn.value=e!==null},[e]),A(()=>()=>{Sn.value=!1},[]);let s=()=>t(null),c=e=>{Cn(e),r(null),s()},l=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(t.key===`Escape`&&n)return s();if((t.key===`Backspace`||t.key===`Delete`)&&n)return e===`hideDock`?(r({action:e,text:`Can't clear this one: it's how a hidden dock comes back.`}),s()):c({...o,[e]:null});if(e===`measure`){if(kn(t.key))return c({...o,measure:t.key});r({action:e,text:`Measure is held: press one key, ${xn?`⌥, ⇧, ⌃ or ⌘`:`Alt, Shift, Ctrl or Win`}.`});return}let i=Nn(t);if(!i)return;if(`error`in i){r({action:e,text:i.error});return}let l=_f.find(t=>t!==e&&Fn(o[t],i));if(l)return a({action:e,shortcut:i,other:l}),r(null),s();c({...o,[e]:i})},u=({action:e,shortcut:t,other:n})=>{let i=o[e];n===`hideDock`&&!i?r({action:e,text:`Give it a shortcut first: hide the dock needs one.`}):(Cn({...o,[e]:t,[n]:i}),r(null)),a(null)};return/* @__PURE__ */ Q(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Click a shortcut and press the new keys. `,/* @__PURE__ */ Q(`kbd`,{children:`Esc`}),` cancels,`,` `,/* @__PURE__ */ Q(`kbd`,{children:xn?`⌫`:`Backspace`}),` clears it.`]}),/* @__PURE__ */ Q(`ul`,{class:`shortcut-list`,children:gf.map(({action:c,label:d,help:f})=>{let p=o[c],m=e===c,h=p===null?null:typeof p==`string`?jn(p):An(p);return/* @__PURE__ */ Q(`li`,{class:`shortcut-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,id:`tencil-shortcut-${c}`,children:d}),f&&/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:f})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-key${m?` recording`:``}`,"aria-labelledby":`tencil-shortcut-${c}`,"aria-describedby":`tencil-shortcut-${c}-value`,onClick:()=>{a(null),r(null),t(m?null:c)},onKeyDown:e=>{m&&l(c,e)},onBlur:()=>{m&&s()},children:/* @__PURE__ */ Q(`span`,{id:`tencil-shortcut-${c}-value`,children:m?`Press keys…`:h?/* @__PURE__ */ Q(`kbd`,{children:h}):/* @__PURE__ */ Q(`span`,{class:`shortcut-none`,children:`None`})})}),n?.action===c&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:n.text}),i?.action===c&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:[An(i.shortcut),` is already used for`,` `,gf.find(e=>e.action===i.other)?.label,`.`,/* @__PURE__ */ Q(`span`,{class:`shortcut-message-actions`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>u(i),children:`Swap`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-cancel`,onClick:()=>a(null),children:`Cancel`})]})]})]},c)})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-reset`,disabled:yf(o),onClick:()=>{s(),a(null),r(null),wn()},children:`Reset to defaults`})]})}function yf(e){return In(e,bn)}let bf={id:`agent`,label:`Agent`};function xf(){let e=j(null);Mf(e);let t=[{id:`overview`,label:`Project`},bf,{id:`tools`,label:`Tools`}],n=[{id:`appearance`,label:`Appearance`},{id:`shortcuts`,label:`Shortcuts`},{id:`dock`,label:`Dock`},...wt.value?[{id:`account`,label:`Account`}]:[]],r=rn()?[]:[{id:`about`,label:`About`}],i=[...t,...n,...r],a=i.find(e=>e.id===Vn.value)??bf,o=()=>{Bn.value=!1},s=e=>{Vn.value=e};return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`settings-scrim`,onClick:o}),/* @__PURE__ */ Q(`section`,{ref:e,class:`settings-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,onKeyDown:t=>{t.key===`Escape`?(t.stopPropagation(),o()):t.key===`Tab`&&e.current&&Nf(t,e.current)},children:[/* @__PURE__ */ Q(`nav`,{class:`settings-nav`,"aria-label":`Settings pages`,onKeyDown:t=>{let n=t.key===`ArrowDown`?1:t.key===`ArrowUp`?-1:0;if(!n)return;t.preventDefault();let r=i.indexOf(a),o=i[(r+n+i.length)%i.length];o&&(s(o.id),(e.current?.querySelector(`[data-page="${o.id}"]`))?.focus())},children:[/* @__PURE__ */ Q(`strong`,{class:`settings-title`,children:[/* @__PURE__ */ Q(Yu,{size:18}),`Settings`]}),/* @__PURE__ */ Q(Sf,{pages:t,current:a.id,onSelect:s}),/* @__PURE__ */ Q(Sf,{title:`You`,pages:n,current:a.id,onSelect:s}),r.length>0&&/* @__PURE__ */ Q(Sf,{title:`Tencil`,pages:r,current:a.id,onSelect:s})]}),/* @__PURE__ */ Q(`div`,{class:`settings-page`,children:[/* @__PURE__ */ Q(`header`,{class:`settings-header`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ Q(`h2`,{children:a.id===`overview`?zt.value?.name??a.label:a.label}),/* @__PURE__ */ Q(`span`,{class:`settings-scope`,children:Cf(a.id)})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,"aria-label":`Close settings`,onClick:o,children:/* @__PURE__ */ Q(Gu,{})})]}),/* @__PURE__ */ Q(`div`,{class:`settings-body`,children:/* @__PURE__ */ Q(wf,{id:a.id})})]})]})]})}function Sf({title:e,pages:t,current:n,onSelect:r}){return/* @__PURE__ */ Q(`div`,{class:`settings-nav-group`,children:[e&&/* @__PURE__ */ Q(`p`,{class:`settings-nav-title`,children:e}),t.map(e=>{let t=e.id===`about`&&sf.value;return/* @__PURE__ */ Q(`button`,{type:`button`,"data-page":e.id,class:`settings-nav-item${e.id===n?` active`:``}${e.id===`overview`?` settings-nav-project`:``}`,"aria-current":e.id===n?`page`:void 0,"aria-label":t?`${e.label} (update available)`:void 0,tabIndex:e.id===n?0:-1,onClick:()=>r(e.id),children:[/* @__PURE__ */ Q(`span`,{class:`settings-nav-label`,children:e.label}),t&&/* @__PURE__ */ Q(`span`,{class:`settings-nav-dot`})]},e.id)})]})}function Cf(e){switch(e){case`overview`:return zt.value?.root??``;case`agent`:case`tools`:return zt.value?`Saved for ${zt.value.name}, for everyone using its pins`:`Saved for this project`;case`appearance`:case`shortcuts`:return rn()?`Saved in this browser`:`Saved on this computer, for all your projects`;case`dock`:return`Saved in this browser, for this site`;case`account`:return`Saved in this browser`;default:return`Runs on this machine, for all your projects`}}function wf({id:e}){switch(e){case`overview`:return/* @__PURE__ */ Q(pf,{});case`agent`:return/* @__PURE__ */ Q(Tf,{});case`tools`:return/* @__PURE__ */ Q(Ef,{});case`appearance`:return/* @__PURE__ */ Q(Of,{});case`shortcuts`:return/* @__PURE__ */ Q(vf,{});case`dock`:return/* @__PURE__ */ Q(kf,{});case`account`:return/* @__PURE__ */ Q(Af,{});default:return/* @__PURE__ */ Q(uf,{})}}function Tf(){let e=R.value,t=L.value;return e?/* @__PURE__ */ Q(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ Q(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ Q(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>V({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ Q(Pu,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Pf(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`})}function Ef(){let e=R.value;return e?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(jf,{label:`Batch mode`,checked:e.batch,onChange:Kn,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Xu,{}),` to the comment box to queue comments and send them together.`]})}),/* @__PURE__ */ Q(jf,{label:`Ruler`,checked:e.ruler,onChange:tr,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Zu,{}),` to the toolbar.`,Mn.value.measure&&` With it on, hold ${Mn.value.measure} to measure spacing on the page.`]})})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`})}let Df=[{id:`dark`,label:`Dark`},{id:`light`,label:`Light`},{id:`system`,label:`System`}];function Of(){return/* @__PURE__ */ Q(`div`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,id:`tencil-theme-label`,children:`Theme`}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:`Panels and the comment box. System follows your computer's setting.`})]}),/* @__PURE__ */ Q(`fieldset`,{class:`segmented settings-segmented`,"aria-labelledby":`tencil-theme-label`,children:Df.map(e=>/* @__PURE__ */ Q(`label`,{class:vr.value===e.id?`active`:void 0,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-theme`,checked:vr.value===e.id,onChange:()=>yr(e.id)}),e.label]},e.id))})]})}function kf(){return/* @__PURE__ */ Q(jf,{label:`Hide the dock`,checked:Yn.value,onChange:Zn,help:/* @__PURE__ */ Q(S,{children:[`Hides the toolbar, pins and panels on this site. Press`,` `,/* @__PURE__ */ Q(`kbd`,{children:Mn.value.hideDock}),` anywhere on the page to bring them back, or to hide them again.`]})})}function Af(){let e=wt.value;return e?/* @__PURE__ */ Q(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ Q(`strong`,{children:e.login?`@${e.login}`:e.name})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>{Mt(an()),on()},children:`Sign out`})]}):null}function jf({label:e,help:t,checked:n,onChange:r}){return/* @__PURE__ */ Q(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:e}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:t})]}),/* @__PURE__ */ Q(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:n,"aria-checked":n,onChange:e=>r(e.currentTarget.checked)})]})}function Mf(e){A(()=>{let t=bc().shadowRoot?.activeElement;return e.current?.querySelector(`.settings-nav-item.active`)?.focus(),()=>{t instanceof HTMLElement&&t.isConnected&&t.focus()}},[])}function Nf(e,t){let n=[...t.querySelectorAll(`button:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`)].filter(e=>e.tabIndex>=0),r=n[0],i=n[n.length-1],a=bc().shadowRoot?.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r?.focus())}function Pf(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function Ff({text:e,animate:t=!1}){let n=t?Bf(e):0;return/* @__PURE__ */ Q(`div`,{class:`md`,children:If(e,{index:0,animateFrom:t?n-48:1/0})})}function If(e,t){let n=[],r=e.replace(/\r\n/g,`
|
|
69
|
+
`}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&Z(h)&&(i.time(`embed web font`),await mu(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),pu(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Tu(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&tu(n),await m?.(y),y}function Tu(e,t){let{width:n,height:r}=t,i=hl(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Eu(e,t){let n=await Dl(e,t),r=await wu(n),i=gl(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=kl(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(ml,`defs`),n.svgStyles.clear()),await jl(yl(i,r.ownerDocument),n)}async function Du(e,t){let n=await Dl(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Eu(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&Lc&&Rc){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Nc(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Mc(u,o,r):Dc(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Ou(e,t){return Du(await Dl(e,{...t,type:`image/jpeg`}))}async function ku(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Ou(r,{scale:a,quality:.85,backgroundColor:Au(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function Au(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var ju=0;Array.isArray;function Q(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ju,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Mu={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`},ensemble:{viewBox:`2 2 16 16`,path:[{x:2.5,y:3.25,height:13.5,opacity:.6},{x:6.5,y:2,height:16,opacity:1},{x:10.5,y:2.75,height:14.5,opacity:.8},{x:14.5,y:4.25,height:11.5,opacity:.5}],className:`agent-mono`,label:`Ensemble`}};function Nu(e){if(Mu[e])return Mu[e];let t=e.toLowerCase();if(t.includes(`claude`))return Mu.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Mu.codex;if(t.includes(`cursor`))return Mu.cursor;if(t.includes(`ensemble`))return Mu.ensemble}function Pu({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Nu(e);return r?/* @__PURE__ */ Q(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:typeof r.path==`string`?/* @__PURE__ */ Q(`path`,{d:r.path}):r.path.map(e=>/* @__PURE__ */ Q(`rect`,{x:e.x,y:e.y,width:`3`,height:e.height,rx:`0.15`,"fill-opacity":e.opacity},e.x))}):null}function $({children:e,size:t=16}){return/* @__PURE__ */ Q(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Fu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ Q(`path`,{d:`M12 8v8M8 12h8`})]}),Iu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ Q(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),Lu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ Q(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ Q(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),Ru=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),zu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),Bu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),Vu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M20 6 9 17l-5-5`})}),Hu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ Q(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),Uu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),Wu=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),Gu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M18 6 6 18M6 6l12 12`})}),Ku=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),qu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),Ju=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),Yu=({size:e=16})=>/* @__PURE__ */ Q(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:[/* @__PURE__ */ Q(`path`,{d:`M3 21V9a6 6 0 0 1 6-6h6a6 6 0 0 1 6 6v6a6 6 0 0 1-6 6Z`,fill:`#3b8dff`}),/* @__PURE__ */ Q(`path`,{d:`M9.25 7.5 16.5 12.6l-3.55.75-1.75 3.4Z`,fill:`#fff`,stroke:`#fff`,"stroke-linejoin":`round`})]}),Xu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ Q(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),Zu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),Qu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),$u=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m6 9 6 6 6-6`})}),ed=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M11.5 2.8a.6.6 0 0 1 1 0l2.6 5.3 5.8.8a.6.6 0 0 1 .3 1l-4.2 4.1 1 5.8a.6.6 0 0 1-.8.6L12 17.7l-5.2 2.7a.6.6 0 0 1-.8-.6l1-5.8-4.2-4.1a.6.6 0 0 1 .3-1l5.8-.8Z`})}),td=()=>/* @__PURE__ */ Q(`svg`,{width:14,height:14,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ Q(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 0-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3.1-.2-.4-.6-1.6 0-3.2 0 0 1-.3 3.4 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8.1 3.2.8.8 1.3 1.9 1.3 3.2 0 4.6-2.8 5.6-5.5 5.9.5.4.9 1.1.9 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3`})}),nd=F(()=>{let e=/* @__PURE__ */ new Map,t=[...lr.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function rd(){let e=fr.value.flatMap(e=>{let t=nd.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&V({type:`drafts.send`,drafts:e})&&(K.value=e[0]?.threadId??null)}function id(){let e=ad();if(J.value)return null;let t=G.value;return/* @__PURE__ */ Q(S,{children:[ur.value.map(e=>/* @__PURE__ */ Q(sd,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Q(od,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Q(md,{})]})}function ad(){let e=ur.value,t=sr.value,n=j({page:t,pins:[]}),[r,i]=k([]);return Ne(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:nd.value.get(e.id),variant:hd(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:z.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function od({pin:e}){or.value;let t=e.thread.anchor?Sc(e.thread.anchor):null;return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ Q(Vu,{})}),/* @__PURE__ */ Q(`span`,{class:`pin-shine`})]})]})}):null}function sd({thread:e}){if(or.value,!e.anchor)return null;let t=ar.value,n=t?.threadId===e.id,r=n?t.point:Sc(e.anchor);if(!r)return null;let i=K.value===e.id;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`pin pin-${hd(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>ld(t,e,r),onClick:()=>{if(cd===e.id){cd=null;return}G.value=null,K.value=i?null:e.id},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:nd.value.get(e.id)??`•`})})}let cd=null;function ld(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}cd=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!ar.value&&Math.hypot(r,o)<4||(ar.value={threadId:t.id,point:ud({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,dd,!0);let n=ar.value;n&&(ar.value=null,cd=t.id,e.type===`pointerup`&&fd(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,dd,!0)}function ud(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function dd(e){e.preventDefault()}function fd(e,t){let n=pd(t);if(!n)return;let r={selector:Zs(n),...Cc(n,t)};V({type:`thread.move`,threadId:e.id,anchor:r})&&ln({...e,anchor:r})}function pd(e){let t=bc();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function md(){or.value;let e=G.value,t=Sc(e.anchor,e.element);return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:`+`})}):null}function hd(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let gd=`tencil:open`;function _d(){let[e,t]=k(`page`),n=L.value?.label??`Agent`,r=I.value===`open`&&L.value?.state===`ready`,i=L.value?.id;return A(()=>{r&&q.value&&e===`provider`&&pn()},[e,q.value,r,i]),q.value?/* @__PURE__ */ Q(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Q(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Q(`div`,{class:`segmented`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{q.value=!1},children:/* @__PURE__ */ Q(Gu,{})})]}),e===`provider`?/* @__PURE__ */ Q(yd,{label:n}):/* @__PURE__ */ Q(vd,{scope:e})]}):null}function vd({scope:e}){let t=lr.value.filter(e=>Hn.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&cr(t.pageUrl)===sr.value),n=t.filter(e=>hd(e)===`done`);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`inbox-toolbar`,children:[/* @__PURE__ */ Q(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Q(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Q(`input`,{type:`checkbox`,class:`checkbox-input`,checked:Hn.value,onChange:e=>{Hn.value=e.target.checked}}),/* @__PURE__ */ Q(Vu,{})]}),`Show resolved`]}),n.length>0&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-resolve`,onClick:()=>{for(let e of n)V({type:`thread.resolve`,threadId:e.id,resolved:!0});n.some(e=>e.id===K.value)&&(K.value=null)},children:[/* @__PURE__ */ Q(Vu,{}),`Resolve `,n.length,` done`]})]}),/* @__PURE__ */ Q(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:Mn.value.comment?/* @__PURE__ */ Q(S,{children:[`No pins yet. Press `,/* @__PURE__ */ Q(`kbd`,{children:Mn.value.comment}),` and click anything on the page.`]}):`No pins yet. Click Comment, then anything on the page.`}):t.map(e=>/* @__PURE__ */ Q(Sd,{thread:e},e.id))})]})}function yd({label:e}){let t=Kt.value;return t?t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Q(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Q(bd,{summary:e},e.id))}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function bd({summary:e}){let t=qt.value,n=[...z.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=hn(e);t&&(K.value=t)},children:[/* @__PURE__ */ Q(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Q(xd,{project:t}),/* @__PURE__ */ Q(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-${e.status}`,children:Td(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Q(`span`,{class:`provider-item-time`,children:Ed(e.updatedAt)})]}),/* @__PURE__ */ Q(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Q(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Q(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Q(Pu,{agent:e.agent})]})]})}function xd({project:e}){return e.emoji?/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Q(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function Sd({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||cr(e.pageUrl)===sr.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item${K.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(gd,e.id),location.href=e.pageUrl;return}K.value=e.id,Cd(e)},children:[t?/* @__PURE__ */ Q(`span`,{class:`pin pin-static pin-${hd(e)}`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:nd.value.get(e.id)})}):/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Q(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Q(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Q(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),wd(e),` · `,Ed(e.updatedAt)]}),r&&/* @__PURE__ */ Q(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Cd(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function wd(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function Td(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Ed(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Dd({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=k(t),u=j(null);A(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),A(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Q(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Q(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Q(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Q(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Q(`span`,{class:`spinner`}):/* @__PURE__ */ Q(zu,{})})]})]})}let Od=P(null);function kd(){or.value;let e=G.value,t=j(null),[n,r]=k(140),[i,a]=k(!1),[o,s]=k(!1),[c,l]=k(null),u=L.value?.state===`ready`,d=L.value?.id;if(A(()=>{e&&u&&(pn(),mn())},[e,u,d]),A(()=>{Od.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Sc(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Tc(f,{width:340,height:n}),g=L.value,_=g?.state===`ready`,v=Gn.value,y=v?null:Od.value,b=y?void 0:Pd(g?.id);return/* @__PURE__ */ Q(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Q(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Q(`span`,{class:`chip`,children:[/* @__PURE__ */ Q(qu,{}),e.label]}),g&&v&&/* @__PURE__ */ Q(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,fr.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Q($u,{})]})]}),e.measuredTo&&er.value&&/* @__PURE__ */ Q(jd,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ Q(Id,{onPick:e=>{Od.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Q(Fd,{choices:b,onPick:e=>{V({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Q(Dd,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=Nd(await e.context,e),r=[];if(i){let t=await ku(e.element,bc());t&&r.push(t)}let a=Rt(),o={...e.anchor,selector:n.selector};if(!V({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();ln({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),G.value=null,v?mr():K.value=a}finally{s(!1)}},onCancel:()=>{G.value=null},children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Q(Ku,{})}),Un.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{Wn.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Q(Xu,{})}),b&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Q(Pu,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Q($u,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Q(`p`,{class:`hint`,children:g.detail})]})}let Ad={top:`above`,right:`right`,bottom:`below`,left:`left`};function jd({pending:e}){let t=e.measuredTo,n=Md(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${Ad[e]}`);return/* @__PURE__ */ Q(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ Q(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{G.value&&={...G.value,measuredTo:void 0}},children:/* @__PURE__ */ Q(Gu,{})})]})}function Md(e){let t=e.measuredTo;return!t||!er.value||!e.element.isConnected||!t.element.isConnected?void 0:Ls(Is(Ps(e.element.getBoundingClientRect()),Ps(t.element.getBoundingClientRect())),{to:t.label,selector:Zs(t.element),...t.parent?{parent:!0}:{}})}function Nd(e,t){let n=Md(t);return n?{...e,spacing:n}:e}function Pd(e){let t=Jt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(R.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Fd({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Q(Pu,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function Id({onPick:e}){let t=Kt.value,n=Od.value?.id??null;return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Q(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Q(Pu,{agent:t.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Ed(t.updatedAt)})]},t.id))]})}function Ld(){or.value;let e=Rn.value;if(!e)return null;let t=U.value===`picking`,n=!t&&!G.value&&er.value&&zn.value&&!W.value;if(!t&&!n)return null;let r=Ps(e.getBoundingClientRect());return/* @__PURE__ */ Q(S,{children:[er.value&&(n||!zn.value)&&/* @__PURE__ */ Q(zd,{element:e,box:r}),/* @__PURE__ */ Q(`div`,{class:`highlight`,style:Wd(r)}),/* @__PURE__ */ Q(Rd,{element:e,box:r})]})}function Rd({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ Q(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[Xs(e),/* @__PURE__ */ Q(`span`,{class:`highlight-size`,children:[Fs(t.right-t.left),`×`,Fs(t.bottom-t.top)]})]})}function zd({element:e,box:t}){let n=Vs(e),r=[...Bd(e,t,n),...Vd(e,t,n),...Ud(e,t,n)];return/* @__PURE__ */ Q(S,{children:[r.map((e,t)=>/* @__PURE__ */ Q(`div`,{class:`band band-${e.kind}`,style:Wd(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ Q(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:Gd(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ Q(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function Bd(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return Hd(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function Vd(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return Hd(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function Hd(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:Ks(e,t,n,r)}))}function Ud(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return Hs(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?Ks(e,`gap`,r,n[r]):void 0}})}function Wd(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function Gd(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function Kd(){if(or.value,!er.value)return null;let e=U.value===`idle`&&!G.value?W.value?.element:void 0,t=Jd(e),n=e?.isConnected?Ps(e.getBoundingClientRect()):null;return/* @__PURE__ */ Q(S,{children:[e&&n&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Wd(n)}),/* @__PURE__ */ Q(Rd,{element:e,box:n})]}),t&&/* @__PURE__ */ Q(qd,{pair:t})]})}function qd({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Ps(e.getBoundingClientRect()),r=Ps(t.getBoundingClientRect()),i=G.value;return/* @__PURE__ */ Q(S,{children:[i?.element===e&&/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:Wd(n)}),/* @__PURE__ */ Q(`div`,{class:`measure-target`,style:Wd(r)}),Is(n,r).map(e=>/* @__PURE__ */ Q(Yd,{guide:e},e.side))]})}function Jd(e){let t=Rn.value,n=G.value;if(U.value===`picking`||!n&&!e){let e=t?.parentElement;return!zn.value||!t||!e||e===document.documentElement?null:[t,e]}return e?zn.value&&t&&t!==e?[e,t]:null:n?zn.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function Yd({guide:e}){return/* @__PURE__ */ Q(S,{children:[e.extension&&/* @__PURE__ */ Q(`div`,{class:`guide guide-extension`,style:Xd(e.extension)}),/* @__PURE__ */ Q(`div`,{class:`guide`,style:Xd(e)}),/* @__PURE__ */ Q(`span`,{class:`guide-value`,style:{transform:Gd(Zd(e))},children:e.value})]})}function Xd(e){let t=Zd(e);return Wd(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function Zd({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function Qd({tone:e,label:t}){let[n,r]=k(!1),i=j(void 0);A(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ Q(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ Q(`span`,{class:`status-dot status-${e}`,children:pr.value>0&&/* @__PURE__ */ Q(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ Q($d,{tone:e})]})}function $d({tone:e}){return/* @__PURE__ */ Q(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ Q(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ Q(Yu,{size:18}),/* @__PURE__ */ Q(`strong`,{children:`Tencil`}),Ht.value&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:[`v`,Ht.value]})]}),/* @__PURE__ */ Q(nf,{tone:e})]})}function ef(e=tf()){let t=L.value,n=I.value,r=fr.value.length,i=pr.value,a=wt.value,o=[{label:rn()?`Tencil Cloud`:`Daemon`,tone:n===`open`?`ok`:e,value:n===`open`?`Connected`:n===`connecting`?`Connecting…`:`Offline`},{label:`Address`,value:cn()},{label:`Project`,value:Yt.value?`Not picked yet`:zt.value?.name??`…`,title:zt.value?.root},t?{label:`Agent`,tone:t.state===`ready`?`ok`:e,value:t.label,note:Pf(t)}:{label:`Agent`,value:`…`}];return t?.target&&o.push({label:`Workspace`,value:t.target}),a&&o.push({label:`Signed in`,value:a.login?`@${a.login}`:a.name,note:a.access===`read`?`view only`:void 0}),(i>0||r>0)&&o.push({label:`Pins`,value:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)}),o}function tf(){return I.value===`open`?`warn`:`error`}function nf({tone:e}){let t=L.value;return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`dl`,{class:`status-card-rows`,children:ef(e).map(e=>/* @__PURE__ */ Q(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ Q(`dt`,{children:e.label}),/* @__PURE__ */ Q(`dd`,{title:e.title,children:[e.tone&&/* @__PURE__ */ Q(`span`,{class:`status-card-tone tone-${e.tone}`}),e.value,e.note&&/* @__PURE__ */ Q(`span`,{class:`status-card-muted`,children:e.note})]})]},e.label))}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`status-card-detail`,children:t.detail})]})}let rf=`https://github.com/tencildev/tencil`,af=`${rf}/blob/master/packages/tencil/CHANGELOG.md`,of=`npx tencil@latest setup`,sf=F(()=>!rn()&&!!Ut.value?.latest&&Ut.value.state===`idle`),cf=P(!1),lf=P(!1);function uf(){let e=Ht.value;if(rn()||!e)return null;let t=Ut.value,n=t?.state===`installing`||t?.state===`waiting`||t?.state===`restarting`,r=Gt.value;return/* @__PURE__ */ Q(`section`,{class:`settings-section settings-about`,"aria-label":`About Tencil`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-about-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:`Tencil`}),/* @__PURE__ */ Q(`span`,{class:`settings-version`,children:[`v`,e]})]}),r&&r!==e&&!t?.latest&&/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Updated from v`,r,`.`]}),t?.latest&&/* @__PURE__ */ Q(`div`,{class:`settings-update`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[/* @__PURE__ */ Q(`strong`,{children:[`Tencil `,t.latest,` is available.`]}),` `,/* @__PURE__ */ Q(`a`,{href:af,target:`_blank`,rel:`noreferrer`,children:`What's new`})]}),n&&/* @__PURE__ */ Q(`p`,{class:`settings-help settings-progress`,children:ff(t)}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action settings-update-button`,disabled:n,onClick:()=>V({type:`update.start`}),children:n?`Updating…`:t.state===`failed`?`Try again`:`Update`})]}),/* @__PURE__ */ Q(`div`,{class:`settings-links`,children:[/* @__PURE__ */ Q(`a`,{class:`settings-link`,href:rf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(td,{}),`tencildev/tencil`]}),/* @__PURE__ */ Q(`a`,{class:`settings-link`,href:af,target:`_blank`,rel:`noreferrer`,children:`Changelog`}),/* @__PURE__ */ Q(`a`,{class:`settings-link settings-star`,href:rf,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ Q(ed,{}),`Give us a star`]})]}),t?.state===`failed`&&/* @__PURE__ */ Q(`div`,{class:`settings-update-error`,role:`alert`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Couldn't update`,t.error?`: ${t.error}`:`.`,` Tencil `,e,` `,`is still running. Update from a terminal instead:`]}),/* @__PURE__ */ Q(`div`,{class:`settings-command`,children:[/* @__PURE__ */ Q(`code`,{children:of}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(of).then(()=>{cf.value=!0,setTimeout(()=>{cf.value=!1},1500)})},children:cf.value?`Copied`:`Copy`})]})]}),/* @__PURE__ */ Q(`details`,{class:`settings-debug`,children:[/* @__PURE__ */ Q(`summary`,{children:[/* @__PURE__ */ Q($u,{}),`Debug`]}),/* @__PURE__ */ Q(`div`,{class:`settings-debug-body`,children:[/* @__PURE__ */ Q(nf,{}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(df()).then(()=>{lf.value=!0,setTimeout(()=>{lf.value=!1},1500)})},children:lf.value?`Copied`:`Copy for a bug report`})]})]})]})}function df(){let e=L.value;return[`Tencil v${Ht.value??`?`}`,...ef().map(e=>`${e.label}: ${e.value}${e.note?` (${e.note})`:``}${e.title?` [${e.title}]`:``}`),...e&&e.state!==`ready`&&e.detail?[`Detail: ${e.detail}`]:[],`Page: ${location.origin}${location.pathname}`,`Browser: ${navigator.userAgent}`].join(`
|
|
70
|
+
`)}function ff(e){switch(e.state){case`installing`:return`Installing Tencil ${e.latest}…`;case`waiting`:{let t=e.running??1;return`Waiting for ${t} running ${t===1?`thread`:`threads`} to finish…`}default:return`Restarting on Tencil ${e.latest}…`}}function pf(){let e=Vt.value;return/* @__PURE__ */ Q(`div`,{class:`settings-section overview`,children:e&&!rn()?/* @__PURE__ */ Q(mf,{source:e}):/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins on this page go to this project.`})})}function mf({source:e}){let[t,n]=k(!1),[r,i]=k(``),a=j(null);A(()=>{t&&a.current?.focus()},[t]);let o=e.via===`picked`,s=Bt.value,c=r.trim().toLowerCase(),l=zt.value?.root,u=(s??[]).filter(e=>e.root!==l&&(!c||e.title.toLowerCase().includes(c)||e.root.toLowerCase().includes(c))),d=e=>{V({type:`project.select`,root:e}),n(!1),i(``)};return/* @__PURE__ */ Q(`div`,{class:`overview-block`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-label`,children:`Project detection`}),/* @__PURE__ */ Q(`div`,{class:`detection`,children:[/* @__PURE__ */ Q(`span`,{class:`detection-badge${o?` detection-picked`:``}`,children:o?`Picked`:`Automatic`}),/* @__PURE__ */ Q(`span`,{class:`settings-help detection-reason`,children:hf(e)}),/* @__PURE__ */ Q(`span`,{class:`detection-actions`,children:[e.detected&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-button`,onClick:()=>e.detected&&d(e.detected.root),children:`Use automatic`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-button`,"aria-expanded":t,onClick:()=>{t||(Bt.value=null,V({type:`project.choices`})),n(!t)},children:t?`Cancel`:`Change`})]})]}),t&&/* @__PURE__ */ Q(`div`,{class:`detection-picker`,children:[/* @__PURE__ */ Q(`input`,{class:`detection-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,ref:a,value:r,onInput:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u[0]&&d(u[0].root)}}),/* @__PURE__ */ Q(`div`,{class:`detection-list`,children:s===null?/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Looking for projects…`}):u.length===0?/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:c?`No project matches “${r.trim()}”.`:`No other projects found.`}):u.map(e=>/* @__PURE__ */ Q(`button`,{type:`button`,class:`detection-option`,title:e.root,onClick:()=>d(e.root),children:[/* @__PURE__ */ Q(`span`,{class:`detection-option-name`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`detection-option-root`,children:``+e.root})]},e.root))}),/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Kept for this address while Tencil finds the same project here. When another app takes the port, detection decides again.`})]})]})}function hf(e){if(e.via===`picked`)return e.detected?`You picked it instead of ${e.detected.root.split(/[\\/]/).filter(Boolean).pop()??`the detected project`}.`:`You picked it for this address: Tencil couldn't tell from the page.`;switch(e.via){case`plugin`:return`The git repository the Vite or Next.js plugin passed along.`;case`port`:return`The dev server listening on port ${e.port}.`;case`docker`:return`The Docker Compose project publishing port ${e.port}.`;default:return`The Ensemble thread whose dev server runs on port ${e.port}.`}}let gf=[{action:`comment`,label:`Comment`},{action:`ruler`,label:`Ruler`},{action:`measure`,label:`Measure`,help:`Held while hovering, with the ruler on.`},{action:`hidePins`,label:`Hide pins`},{action:`hideDock`,label:`Hide the dock`,help:`Also brings a hidden dock back.`}],_f=[`comment`,`ruler`,`hidePins`,`hideDock`];function vf(){let[e,t]=k(null),[n,r]=k(null),[i,a]=k(null),o=H.value,s=e=>{Sn.value=e!==null,t(e)};A(()=>()=>{Sn.value=!1},[]);let c=()=>s(null),l=e=>{Cn(e),r(null),c()},u=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(t.key===`Escape`&&n)return c();if((t.key===`Backspace`||t.key===`Delete`)&&n)return e===`hideDock`?(r({action:e,text:`Can't clear this one: it's how a hidden dock comes back.`}),c()):l({...o,[e]:null});if(e===`measure`){if(kn(t.key))return l({...o,measure:t.key});r({action:e,text:`Measure is held: press one key, ${xn?`⌥, ⇧, ⌃ or ⌘`:`Alt, Shift, Ctrl or Win`}.`});return}let i=Nn(t);if(!i)return;if(`error`in i){r({action:e,text:i.error});return}let s=_f.find(t=>t!==e&&Fn(o[t],i));if(s)return a({action:e,shortcut:i,other:s}),r(null),c();l({...o,[e]:i})},d=({action:e,shortcut:t,other:n})=>{let i=o[e];n===`hideDock`&&!i?r({action:e,text:`Give it a shortcut first: hide the dock needs one.`}):(Cn({...o,[e]:t,[n]:i}),r(null)),a(null)};return/* @__PURE__ */ Q(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:[`Click a shortcut and press the new keys. `,/* @__PURE__ */ Q(`kbd`,{children:`Esc`}),` cancels,`,` `,/* @__PURE__ */ Q(`kbd`,{children:xn?`⌫`:`Backspace`}),` clears it.`]}),/* @__PURE__ */ Q(`ul`,{class:`shortcut-list`,children:gf.map(({action:t,label:l,help:f})=>{let p=o[t],m=e===t,h=p===null?null:typeof p==`string`?jn(p):An(p);return/* @__PURE__ */ Q(`li`,{class:`shortcut-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,id:`tencil-shortcut-${t}`,children:l}),f&&/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:f})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-key${m?` recording`:``}`,"aria-labelledby":`tencil-shortcut-${t}`,"aria-describedby":`tencil-shortcut-${t}-value`,onClick:()=>{a(null),r(null),s(m?null:t)},onKeyDown:e=>{m&&u(t,e)},onBlur:()=>{m&&c()},children:/* @__PURE__ */ Q(`span`,{id:`tencil-shortcut-${t}-value`,children:m?`Press keys…`:h?/* @__PURE__ */ Q(`kbd`,{children:h}):/* @__PURE__ */ Q(`span`,{class:`shortcut-none`,children:`None`})})}),n?.action===t&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:n.text}),i?.action===t&&/* @__PURE__ */ Q(`p`,{class:`shortcut-message`,role:`alert`,children:[An(i.shortcut),` is already used for`,` `,gf.find(e=>e.action===i.other)?.label,`.`,/* @__PURE__ */ Q(`span`,{class:`shortcut-message-actions`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>d(i),children:`Swap`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-cancel`,onClick:()=>a(null),children:`Cancel`})]})]})]},t)})}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`shortcut-reset`,disabled:yf(o),onClick:()=>{c(),a(null),r(null),wn()},children:`Reset to defaults`})]})}function yf(e){return In(e,bn)}let bf={id:`agent`,label:`Agent`};function xf(){let e=j(null);Mf(e);let t=[{id:`overview`,label:`Project`},bf,{id:`tools`,label:`Tools`}],n=[{id:`appearance`,label:`Appearance`},{id:`shortcuts`,label:`Shortcuts`},{id:`dock`,label:`Dock`},...wt.value?[{id:`account`,label:`Account`}]:[]],r=rn()?[]:[{id:`about`,label:`About`}],i=[...t,...n,...r],a=i.find(e=>e.id===Vn.value)??bf,o=()=>{Bn.value=!1},s=e=>{Vn.value=e};return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`settings-scrim`,onClick:o}),/* @__PURE__ */ Q(`section`,{ref:e,class:`settings-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,onKeyDown:t=>{t.key===`Escape`?(t.stopPropagation(),o()):t.key===`Tab`&&e.current&&Nf(t,e.current)},children:[/* @__PURE__ */ Q(`nav`,{class:`settings-nav`,"aria-label":`Settings pages`,onKeyDown:t=>{let n=t.key===`ArrowDown`?1:t.key===`ArrowUp`?-1:0;if(!n)return;t.preventDefault();let r=i.indexOf(a),o=i[(r+n+i.length)%i.length];o&&(s(o.id),(e.current?.querySelector(`[data-page="${o.id}"]`))?.focus())},children:[/* @__PURE__ */ Q(`strong`,{class:`settings-title`,children:[/* @__PURE__ */ Q(Yu,{size:18}),`Settings`]}),/* @__PURE__ */ Q(Sf,{pages:t,current:a.id,onSelect:s}),/* @__PURE__ */ Q(Sf,{title:`You`,pages:n,current:a.id,onSelect:s}),r.length>0&&/* @__PURE__ */ Q(Sf,{title:`Tencil`,pages:r,current:a.id,onSelect:s})]}),/* @__PURE__ */ Q(`div`,{class:`settings-page`,children:[/* @__PURE__ */ Q(`header`,{class:`settings-header`,children:[/* @__PURE__ */ Q(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ Q(`h2`,{children:a.id===`overview`?zt.value?.name??a.label:a.label}),/* @__PURE__ */ Q(`span`,{class:`settings-scope`,children:Cf(a.id)})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,"aria-label":`Close settings`,onClick:o,children:/* @__PURE__ */ Q(Gu,{})})]}),/* @__PURE__ */ Q(`div`,{class:`settings-body`,children:/* @__PURE__ */ Q(wf,{id:a.id})})]})]})]})}function Sf({title:e,pages:t,current:n,onSelect:r}){return/* @__PURE__ */ Q(`div`,{class:`settings-nav-group`,children:[e&&/* @__PURE__ */ Q(`p`,{class:`settings-nav-title`,children:e}),t.map(e=>{let t=e.id===`about`&&sf.value;return/* @__PURE__ */ Q(`button`,{type:`button`,"data-page":e.id,class:`settings-nav-item${e.id===n?` active`:``}${e.id===`overview`?` settings-nav-project`:``}`,"aria-current":e.id===n?`page`:void 0,"aria-label":t?`${e.label} (update available)`:void 0,tabIndex:e.id===n?0:-1,onClick:()=>r(e.id),children:[/* @__PURE__ */ Q(`span`,{class:`settings-nav-label`,children:e.label}),t&&/* @__PURE__ */ Q(`span`,{class:`settings-nav-dot`})]},e.id)})]})}function Cf(e){switch(e){case`overview`:return zt.value?.root??``;case`agent`:case`tools`:return zt.value?`Saved for ${zt.value.name}, for everyone using its pins`:`Saved for this project`;case`appearance`:case`shortcuts`:return rn()?`Saved in this browser`:`Saved on this computer, for all your projects`;case`dock`:return`Saved in this browser, for this site`;case`account`:return`Saved in this browser`;default:return`Runs on this machine, for all your projects`}}function wf({id:e}){switch(e){case`overview`:return/* @__PURE__ */ Q(pf,{});case`agent`:return/* @__PURE__ */ Q(Tf,{});case`tools`:return/* @__PURE__ */ Q(Ef,{});case`appearance`:return/* @__PURE__ */ Q(Of,{});case`shortcuts`:return/* @__PURE__ */ Q(vf,{});case`dock`:return/* @__PURE__ */ Q(kf,{});case`account`:return/* @__PURE__ */ Q(Af,{});default:return/* @__PURE__ */ Q(uf,{})}}function Tf(){let e=R.value,t=L.value;return e?/* @__PURE__ */ Q(`div`,{class:`settings-section`,children:[/* @__PURE__ */ Q(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ Q(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ Q(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>V({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ Q(Pu,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Pf(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ Q(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ Q(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`})}function Ef(){let e=R.value;return e?/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(jf,{label:`Batch mode`,checked:e.batch,onChange:Kn,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Xu,{}),` to the comment box to queue comments and send them together.`]})}),/* @__PURE__ */ Q(jf,{label:`Ruler`,checked:e.ruler,onChange:tr,help:/* @__PURE__ */ Q(S,{children:[`Adds `,/* @__PURE__ */ Q(Zu,{}),` to the toolbar.`,Mn.value.measure&&` With it on, hold ${Mn.value.measure} to measure spacing on the page.`]})})]}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:`Connecting…`})}let Df=[{id:`dark`,label:`Dark`},{id:`light`,label:`Light`},{id:`system`,label:`System`}];function Of(){return/* @__PURE__ */ Q(`div`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,id:`tencil-theme-label`,children:`Theme`}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:`Panels and the comment box. System follows your computer's setting.`})]}),/* @__PURE__ */ Q(`fieldset`,{class:`segmented settings-segmented`,"aria-labelledby":`tencil-theme-label`,children:Df.map(e=>/* @__PURE__ */ Q(`label`,{class:vr.value===e.id?`active`:void 0,children:[/* @__PURE__ */ Q(`input`,{type:`radio`,name:`tencil-theme`,checked:vr.value===e.id,onChange:()=>yr(e.id)}),e.label]},e.id))})]})}function kf(){return/* @__PURE__ */ Q(jf,{label:`Hide the dock`,checked:Yn.value,onChange:Zn,help:/* @__PURE__ */ Q(S,{children:[`Hides the toolbar, pins and panels on this site. Press`,` `,/* @__PURE__ */ Q(`kbd`,{children:Mn.value.hideDock}),` anywhere on the page to bring them back, or to hide them again.`]})})}function Af(){let e=wt.value;return e?/* @__PURE__ */ Q(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ Q(`strong`,{children:e.login?`@${e.login}`:e.name})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`hint-action`,onClick:()=>{Mt(an()),on()},children:`Sign out`})]}):null}function jf({label:e,help:t,checked:n,onChange:r}){return/* @__PURE__ */ Q(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ Q(`span`,{class:`settings-label`,children:e}),/* @__PURE__ */ Q(`span`,{class:`settings-help`,children:t})]}),/* @__PURE__ */ Q(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:n,"aria-checked":n,onChange:e=>r(e.currentTarget.checked)})]})}function Mf(e){A(()=>{let t=bc().shadowRoot?.activeElement;return e.current?.querySelector(`.settings-nav-item.active`)?.focus(),()=>{t instanceof HTMLElement&&t.isConnected&&t.focus()}},[])}function Nf(e,t){let n=[...t.querySelectorAll(`button:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`)].filter(e=>e.tabIndex>=0),r=n[0],i=n[n.length-1],a=bc().shadowRoot?.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r?.focus())}function Pf(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function Ff({text:e,animate:t=!1}){let n=t?Bf(e):0;return/* @__PURE__ */ Q(`div`,{class:`md`,children:If(e,{index:0,animateFrom:t?n-48:1/0})})}function If(e,t){let n=[],r=e.replace(/\r\n/g,`
|
|
71
71
|
`).split(`
|
|
72
72
|
`),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=Bf(e.join(`
|
|
73
73
|
`)),n.push(/* @__PURE__ */ Q(`pre`,{children:/* @__PURE__ */ Q(`code`,{children:e.join(`
|
|
@@ -623,7 +623,16 @@ kbd {
|
|
|
623
623
|
.segmented { display: flex; margin-right: auto; background: var(--n-100); border-radius: 9px; padding: 2px; }
|
|
624
624
|
.segmented button { padding: 3px 10px; border-radius: 7px; color: var(--n-600); font-size: 12px; }
|
|
625
625
|
.segmented .active { background: var(--surface); color: var(--n-950); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
|
|
626
|
-
.inbox-
|
|
626
|
+
.inbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 6px 16px; }
|
|
627
|
+
.inbox-filter { display: flex; align-items: center; gap: 6px; color: var(--n-600); font-size: 12px; cursor: pointer; }
|
|
628
|
+
.inbox-resolve {
|
|
629
|
+
display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 7px;
|
|
630
|
+
color: var(--n-600); font-size: 12px;
|
|
631
|
+
transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
|
|
632
|
+
}
|
|
633
|
+
.inbox-resolve svg { width: 12px; height: 12px; }
|
|
634
|
+
.inbox-resolve:hover { background: var(--n-100); color: var(--n-950); }
|
|
635
|
+
.inbox-resolve:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
627
636
|
/* Custom checkbox: the input stays the hit target, the check is an icon on top. */
|
|
628
637
|
.checkbox { position: relative; display: inline-grid; place-items: center; flex: none; width: 14px; height: 14px; }
|
|
629
638
|
.checkbox-input {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tencil",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Point at any element of your running app and tell your coding agent what to fix.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Pixel Perfect Agency",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"@tencildev/bridge": "0.5.1",
|
|
98
98
|
"@tencildev/overlay": "0.0.0",
|
|
99
99
|
"@tencildev/protocol": "0.6.0",
|
|
100
|
-
"@tencildev/provider-claude-code": "0.0.0",
|
|
101
100
|
"@tencildev/provider-codex": "0.0.0",
|
|
101
|
+
"@tencildev/provider-claude-code": "0.0.0",
|
|
102
102
|
"@tencildev/provider-ensemble": "0.0.0",
|
|
103
103
|
"@tencildev/provider-t3code": "0.0.0",
|
|
104
104
|
"@tencildev/testing": "0.4.0",
|