@plannotator/pi-extension 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plannotator/pi-extension",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "type": "module",
5
5
  "description": "Plannotator extension for Pi coding agent - interactive plan review with visual annotation",
6
6
  "author": "backnotprop",
package/plannotator.html CHANGED
@@ -418,7 +418,7 @@ tags: [plan, ...]
418
418
  ${i?"":"ml-6"}
419
419
  ${s?"text-primary bg-primary/10":"text-foreground/80 hover:text-foreground hover:bg-muted/50"}
420
420
  `,"aria-current":s?"location":void 0,children:H.jsxs("span",{className:"flex items-center justify-between gap-2",children:[H.jsx("span",{className:"flex-1 line-clamp-2 leading-relaxed",children:t.content}),t.annotationCount>0&&H.jsx("span",{className:"flex-shrink-0 bg-accent text-accent-foreground rounded-full w-5 h-5 flex items-center justify-center text-[10px] font-medium",title:`${t.annotationCount} annotation${t.annotationCount===1?"":"s"}`,children:t.annotationCount})]})})]}),i&&n&&H.jsx("ul",{className:"mt-1 space-y-1",children:t.children.map(l=>H.jsx(gle,{item:l,activeId:e,onNavigate:r},l.id))})]})}function gle({item:t,activeId:e,onNavigate:r}){const[n,a]=Be.useState(!0),i=t.children.length>0;return H.jsx(T6e,{item:t,activeId:e,onNavigate:r,isExpanded:n,onToggle:()=>a(!n),hasChildren:i})}function x6e({blocks:t,annotations:e,activeId:r,onNavigate:n,className:a="",style:i}){const s=Be.useMemo(()=>E6e(t,e),[t,e]),o=Be.useMemo(()=>S6e(t,s),[t,s]),l=Be.useCallback(u=>{n(u);const d=document.querySelector(`[data-block-id="${u}"]`);if(d){const h=document.querySelector("main");if(!h)return;const f=80,p=h.getBoundingClientRect(),m=d.getBoundingClientRect(),y=h.scrollTop,b=m.top-p.top,E=y+b-f;h.scrollTo({top:E,behavior:"smooth"})}},[n]);return o.length===0?null:H.jsx("nav",{className:`bg-card/50 backdrop-blur-sm border-r border-border overflow-y-auto ${a}`,"aria-label":"Table of contents",style:i,children:H.jsxs("div",{className:"p-4",children:[H.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Contents"}),H.jsx("ul",{className:"space-y-1",children:o.map(u=>H.jsx(gle,{item:u,activeId:r,onNavigate:l},u.id))})]})})}function OW(t){if(t?.length)return t.map(e=>{if(typeof e=="string"){const r=e.split("/").pop()?.replace(/\.[^.]+$/,"")||"image";return{path:e,name:r}}return{path:e[0],name:e[1]}})}function mle(t){if(t?.length)return t.map(e=>[e.path,e.name])}async function C6e(t){const e=JSON.stringify(t),r=new TextEncoder().encode(e),n=new CompressionStream("deflate-raw"),a=n.writable.getWriter();a.write(r),a.close();const i=await new Response(n.readable).arrayBuffer(),s=new Uint8Array(i);return btoa(String.fromCharCode(...s)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function vle(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),r=atob(e),n=Uint8Array.from(r,l=>l.charCodeAt(0)),a=new DecompressionStream("deflate-raw"),i=a.writable.getWriter();i.write(n),i.close();const s=await new Response(a.readable).arrayBuffer(),o=new TextDecoder().decode(s);return JSON.parse(o)}function R6e(t){return t.map(e=>{const r=e.author||null,n=mle(e.images);if(e.type===bn.GLOBAL_COMMENT)return["G",e.text||"",r,n];const a=e.type[0];return a==="D"?["D",e.originalText,r,n]:[a,e.originalText,e.text||"",r,n]})}function IW(t){const e={D:bn.DELETION,R:bn.REPLACEMENT,C:bn.COMMENT,I:bn.INSERTION,G:bn.GLOBAL_COMMENT};return t.map((r,n)=>{const a=r[0];if(a==="G"){const u=r[1],d=r[2],h=r[3];return{id:`shared-${n}-${Date.now()}`,blockId:"",startOffset:0,endOffset:0,type:bn.GLOBAL_COMMENT,text:u||void 0,originalText:"",createdA:Date.now()+n,author:d||void 0,images:OW(h)}}const i=r[1],s=a==="D"?void 0:r[2],o=a==="D"?r[2]:r[3],l=a==="D"?r[3]:r[4];return{id:`shared-${n}-${Date.now()}`,blockId:"",startOffset:0,endOffset:0,type:e[a],text:s||void 0,originalText:i,createdA:Date.now()+n,author:o||void 0,images:OW(l)}})}async function w6e(t,e,r,n="https://share.plannotator.ai"){const a={p:t,a:R6e(e),g:r?.length?mle(r):void 0},i=await C6e(a);return`${n}/#${i}`}async function A6e(){const t=window.location.hash.slice(1);if(!t)return null;try{return await vle(t)}catch(e){return console.warn("Failed to parse share hash:",e),null}}function O6e(t){const e=new Blob([t]).size;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}function NW(t){return t?.length?t.map((e,r)=>{if(typeof e=="string"){const n=e.split("/").pop()?.replace(/\.[^.]+$/,"")||`image-${r+1}`;return{path:e,name:n}}return Array.isArray(e)&&e.length>=2?{path:e[0],name:e[1]}:{path:String(e),name:`image-${r+1}`}}):[]}function I6e(t,e,r,n,a,i,s,o){const[l,u]=Be.useState(!1),[d,h]=Be.useState(!0),[f,p]=Be.useState(""),[m,y]=Be.useState(""),[b,E]=Be.useState(null),[T,x]=Be.useState(null),R=Be.useCallback(()=>{E(null),x(null)},[]),A=Be.useCallback(async()=>{try{const w=await A6e();if(w){n(w.p);const N=IW(w.a);if(a(N),w.g?.length){const P=NW(w.g);i(P),x(P)}return E(N),u(!0),s?.(),window.history.replaceState({},"",window.location.pathname),!0}return!1}catch(w){return console.error("Failed to load from share hash:",w),!1}},[n,a,i,s]);Be.useEffect(()=>{A().finally(()=>h(!1))},[]),Be.useEffect(()=>{const w=()=>{window.location.hash.length>1&&A()};return window.addEventListener("hashchange",w),()=>window.removeEventListener("hashchange",w)},[A]);const M=Be.useCallback(async()=>{try{const w=await w6e(t,e,r,o);p(w),y(O6e(w))}catch(w){console.error("Failed to generate share URL:",w),p(""),y("")}},[t,e,r,o]);Be.useEffect(()=>{M()},[M]);const I=Be.useCallback(async w=>{try{const N=w.indexOf("#");if(N===-1)return{success:!1,count:0,planTitle:"",error:"Invalid share URL: no hash fragment found"};const P=w.slice(N+1);if(!P)return{success:!1,count:0,planTitle:"",error:"Invalid share URL: empty hash"};const D=await vle(P),z=(D.p||"").trim().split(`
421
- `).find(F=>F.startsWith("#")),k=z?z.replace(/^#+\s*/,"").trim():"Unknown Plan",B=IW(D.a);if(B.length===0)return{success:!0,count:0,planTitle:k,error:"No annotations found in share link"};const L=B.filter(F=>!e.some(U=>U.originalText===F.originalText&&U.type===F.type&&U.text===F.text));if(L.length>0&&(a([...e,...L]),E(L),D.g?.length)){const F=NW(D.g),U=new Set(r.map(W=>W.path)),V=F.filter(W=>!U.has(W.path));V.length>0&&i([...r,...V]),x(F)}return{success:!0,count:L.length,planTitle:k}}catch(N){return{success:!1,count:0,planTitle:"",error:N instanceof Error?N.message:"Failed to decompress share URL"}}},[e,r,a,i]);return{isSharedSession:l,isLoadingShared:d,shareUrl:f,shareUrlSize:m,pendingSharedAnnotations:b,sharedGlobalAttachments:T,clearPendingSharedAnnotations:R,refreshShareUrl:M,importFromShareUrl:I}}function N6e(t,e){const[r,n]=Be.useState(null),a=Be.useRef(null);return Be.useEffect(()=>{const i=t.current;if(!i)return;const s=i.querySelectorAll('[data-block-type="heading"]');if(s.length===0)return;const o=new Map;return a.current=new IntersectionObserver(l=>{l.forEach(h=>{o.set(h.target,h.isIntersecting)});let u=null,d=1/0;for(const[h,f]of o)if(f){const p=h.getBoundingClientRect();p.top<d&&(d=p.top,u=h)}if(u){const h=u.getAttribute("data-block-id");h&&n(h)}},{root:i,rootMargin:"-80px 0px -80% 0px",threshold:[0,.1,.5,1]}),s.forEach(l=>{a.current?.observe(l)}),()=>{a.current?.disconnect()}},[t,e]),r}function kW(t){window.close(),setTimeout(()=>{window.closed||t()},300)}function k6e(t){const[e,r]=Be.useState({phase:"idle"});Be.useEffect(()=>{if(!t)return;const a=zoe();a==="0"?(kW(()=>r({phase:"closeFailed"})),r({phase:"closed"})):r(a!=="off"?{phase:"counting",remaining:Number(a)}:{phase:"prompt"})},[t]),Be.useEffect(()=>{if(e.phase!=="counting")return;if(e.remaining<=0){kW(()=>r({phase:"closeFailed"}));return}const a=setTimeout(()=>r(i=>i.phase==="counting"?{phase:"counting",remaining:i.remaining-1}:i),1e3);return()=>clearTimeout(a)},[e]);const n=Be.useCallback(()=>{Goe("3"),r({phase:"counting",remaining:3})},[]);return{state:e,enableAndStart:n}}const M6e=()=>H.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),D6e=()=>H.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})});function L6e({submitted:t,title:e,subtitle:r,agentLabel:n}){const{state:a,enableAndStart:i}=k6e(!!t);if(!t)return null;const s=t==="approved";return H.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:H.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[H.jsx("div",{className:`mx-auto w-16 h-16 rounded-full flex items-center justify-center ${s?"bg-success/20 text-success":"bg-accent/20 text-accent"}`,children:s?H.jsx(M6e,{}):H.jsx(D6e,{})}),H.jsxs("div",{className:"space-y-2",children:[H.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),H.jsx("p",{className:"text-muted-foreground",children:r})]}),H.jsx("div",{className:"pt-4 border-t border-border space-y-2",children:a.phase==="counting"?H.jsxs(H.Fragment,{children:[H.jsxs("p",{className:"text-sm text-muted-foreground",children:["This tab will close in ",H.jsx("span",{className:"text-foreground font-medium",children:a.remaining})," second",a.remaining!==1?"s":"","..."]}),H.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change this in Settings."})]}):a.phase==="closeFailed"?H.jsxs(H.Fragment,{children:[H.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not close this tab automatically. Please close it manually."}),H.jsxs("p",{className:"text-xs text-muted-foreground/60",children:["Auto-close works when the tab is opened by ",n,"."]})]}):H.jsxs(H.Fragment,{children:[H.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can close this tab and return to ",H.jsx("span",{className:"text-foreground font-medium",children:n}),"."]}),a.phase==="prompt"?H.jsxs(H.Fragment,{children:[H.jsxs("label",{className:"flex items-center justify-center gap-2 cursor-pointer group",children:[H.jsx("input",{type:"checkbox",checked:!1,onChange:i,className:"accent-primary"}),H.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors",children:"Auto-close this tab after 3 seconds"})]}),H.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change the delay in Settings."})]}):H.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Your response has been sent."})]})})]})})}const P6e="https://api.github.com/repos/backnotprop/plannotator/releases/latest",MW={"0.5.0":{title:"Code Review is here!",description:"Review git diffs with inline annotations. Run /plannotator-review to try it."}};function B6e(t,e){const r=i=>i.replace(/^v/,""),n=r(t).split(".").map(Number),a=r(e).split(".").map(Number);for(let i=0;i<Math.max(n.length,a.length);i++){const s=n[i]||0,o=a[i]||0;if(o>s)return!0;if(o<s)return!1}return!1}function F6e(){const[t,e]=Be.useState(null);return Be.useEffect(()=>{(async()=>{try{const n="0.8.3",i=new URLSearchParams(window.location.search).get("preview-update");if(i){const f=i.replace(/^v/,"");e({currentVersion:n,latestVersion:i,updateAvailable:!0,releaseUrl:`https://github.com/backnotprop/plannotator/releases/tag/v${f}`,featureHighlight:MW[f]});return}const s=await fetch(P6e);if(!s.ok)return;const o=await s.json(),l=o.tag_name,u=B6e(n,l),d=l.replace(/^v/,""),h=MW[d];e({currentVersion:n,latestVersion:l,updateAvailable:u,releaseUrl:o.html_url,featureHighlight:h})}catch(n){console.debug("Update check failed:",n)}})()},[]),t}const _6e="curl -fsSL https://plannotator.ai/install.sh | bash",U6e=({origin:t})=>{const e=F6e(),[r,n]=Be.useState(!1),[a,i]=Be.useState(!1),u=(new URLSearchParams(window.location.search).get("preview-origin")||t)==="opencode";if(!e?.updateAvailable||a)return null;const d=async()=>{try{await navigator.clipboard.writeText(_6e),n(!0),setTimeout(()=>n(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return e.featureHighlight?H.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-md animate-in slide-in-from-bottom-2 fade-in duration-300",children:H.jsxs("div",{className:"bg-card border border-primary/30 rounded-xl shadow-2xl overflow-hidden",children:[H.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-primary/5 px-5 py-4 border-b border-border/50",children:H.jsxs("div",{className:"flex items-start justify-between gap-3",children:[H.jsxs("div",{className:"flex items-center gap-3",children:[H.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/20 flex items-center justify-center",children:H.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),H.jsxs("div",{children:[H.jsx("h4",{className:"text-base font-semibold text-foreground",children:e.featureHighlight.title}),H.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["New in ",e.latestVersion]})]})]}),H.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors p-1",children:H.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),H.jsxs("div",{className:"px-5 py-4",children:[H.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:e.featureHighlight.description}),H.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:["You have ",e.currentVersion]}),u&&H.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"Run the install script, then restart OpenCode."}),H.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[H.jsx("button",{onClick:d,className:"flex-1 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),H.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground border border-border rounded-lg hover:bg-muted transition-colors",children:"Release notes"})]})]})]})}):H.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-sm animate-in slide-in-from-bottom-2 fade-in duration-300",children:H.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:H.jsxs("div",{className:"flex items-start gap-3",children:[H.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:H.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}),H.jsxs("div",{className:"flex-1 min-w-0",children:[H.jsxs("div",{className:"flex items-center justify-between gap-2",children:[H.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),H.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:H.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),H.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.latestVersion," is available (you have ",e.currentVersion,")"]}),H.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[H.jsx("button",{onClick:d,className:"flex-1 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-md hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),H.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted transition-colors",children:"Notes"})]})]})]})})})},yle="plannotator-editor-mode",z6e="selection";function G6e(){const t=Fr.getItem(yle);return t==="selection"||t==="comment"||t==="redline"?t:z6e}function Y6e(t){Fr.setItem(yle,t)}function DW({storageKey:t,defaultWidth:e=288,minWidth:r=200,maxWidth:n=600,side:a="right"}){const[i,s]=Be.useState(()=>{const y=Fr.getItem(t);if(y){const b=Number(y);if(!Number.isNaN(b)&&b>=r&&b<=n)return b}return e}),[o,l]=Be.useState(!1),u=Be.useRef(0),d=Be.useRef(0),h=Be.useRef(i),f=Be.useCallback(y=>{h.current=y,s(y)},[]),p=Be.useCallback(y=>{y.preventDefault(),u.current=y.clientX,d.current=h.current,l(!0)},[]);Be.useEffect(()=>{if(!o)return;const y=E=>{const T=a==="right"?u.current-E.clientX:E.clientX-u.current;f(Math.min(n,Math.max(r,d.current+T)))},b=()=>{l(!1),Fr.setItem(t,String(h.current))};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",b),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",b)}},[o,r,n,t,a,f]);const m=Be.useCallback(()=>{f(e),Fr.setItem(t,String(e))},[e,t,f]);return{width:i,isDragging:o,handleProps:{isDragging:o,onMouseDown:p,onDoubleClick:m}}}const LW=({isDragging:t,onMouseDown:e,onDoubleClick:r,className:n})=>H.jsx("div",{onMouseDown:e,onDoubleClick:r,className:`w-1 cursor-col-resize flex-shrink-0 transition-colors ${t?"bg-primary/50":"hover:bg-border"}${n?` ${n}`:""}`}),V6e=({isOpen:t,onComplete:e})=>{const[r,n]=Be.useState("acceptEdits");if(!t)return null;const a=()=>{dle(r),e(r)};return pm.createPortal(H.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:H.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[H.jsxs("div",{className:"p-5 border-b border-border",children:[H.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[H.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:H.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})})}),H.jsx("h3",{className:"font-semibold text-base",children:"New: Permission Mode Preservation"})]}),H.jsx("p",{className:"text-sm text-muted-foreground",children:"Claude Code 2.1.7+ supports preserving your permission mode after plan approval. Choose your preferred automation level."}),H.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Requires Claude Code 2.1.7 or later. Run ",H.jsx("code",{className:"bg-muted px-1 rounded",children:"claude update"})," to update."]})]}),H.jsx("div",{className:"p-4 space-y-2",children:MD.map(i=>H.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all border ${r===i.value?"border-primary bg-primary/10":"border-transparent bg-muted/50 hover:bg-muted"}`,children:[H.jsx("input",{type:"radio",name:"permissionMode",value:i.value,checked:r===i.value,onChange:()=>n(i.value),className:"mt-0.5 accent-primary"}),H.jsxs("div",{className:"flex-1",children:[H.jsx("div",{className:"text-sm font-medium",children:i.label}),H.jsx("div",{className:"text-xs text-muted-foreground",children:i.description})]})]},i.value))}),H.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[H.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),H.jsx("button",{onClick:a,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Continue"})]})]})}),document.body)},q6e="https://plannotator.ai/assets/toc-sticky-preview.png",H6e=({isOpen:t,onComplete:e})=>{const[r,n]=Be.useState(!0),[a,i]=Be.useState(!0),[s,o]=Be.useState(!0);if(!t)return null;const l=()=>{const u={tocEnabled:r,stickyActionsEnabled:a};lle(u),g6e(),e(u)};return pm.createPortal(H.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:H.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[H.jsxs("div",{className:"p-5 border-b border-border",children:[H.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[H.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:H.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),H.jsx("h3",{className:"font-semibold text-base",children:"New: Display Options"})]}),H.jsx("p",{className:"text-sm text-muted-foreground",children:"We've added two features that help navigate larger plans."})]}),H.jsxs("div",{className:"p-4 space-y-4",children:[s&&H.jsx("img",{src:q6e,alt:"Table of Contents and Sticky Actions preview",className:"w-full rounded-lg border border-border",onError:()=>o(!1)}),H.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[H.jsx("input",{type:"checkbox",checked:r,onChange:()=>n(!r),className:"mt-0.5 accent-primary"}),H.jsxs("div",{className:"flex-1",children:[H.jsx("div",{className:"text-sm font-medium",children:"Table of Contents"}),H.jsx("div",{className:"text-xs text-muted-foreground",children:"Show sidebar navigation on desktop"})]})]}),H.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[H.jsx("input",{type:"checkbox",checked:a,onChange:()=>i(!a),className:"mt-0.5 accent-primary"}),H.jsxs("div",{className:"flex-1",children:[H.jsx("div",{className:"text-sm font-medium",children:"Sticky Actions"}),H.jsx("div",{className:"text-xs text-muted-foreground",children:"Keep action buttons visible while scrolling"})]})]})]}),H.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[H.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),H.jsx("button",{onClick:l,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Save Settings"})]})]})}),document.body)},W6e=`# Implementation Plan: Real-time Collaboration
421
+ `).find(F=>F.startsWith("#")),k=z?z.replace(/^#+\s*/,"").trim():"Unknown Plan",B=IW(D.a);if(B.length===0)return{success:!0,count:0,planTitle:k,error:"No annotations found in share link"};const L=B.filter(F=>!e.some(U=>U.originalText===F.originalText&&U.type===F.type&&U.text===F.text));if(L.length>0&&(a([...e,...L]),E(L),D.g?.length)){const F=NW(D.g),U=new Set(r.map(W=>W.path)),V=F.filter(W=>!U.has(W.path));V.length>0&&i([...r,...V]),x(F)}return{success:!0,count:L.length,planTitle:k}}catch(N){return{success:!1,count:0,planTitle:"",error:N instanceof Error?N.message:"Failed to decompress share URL"}}},[e,r,a,i]);return{isSharedSession:l,isLoadingShared:d,shareUrl:f,shareUrlSize:m,pendingSharedAnnotations:b,sharedGlobalAttachments:T,clearPendingSharedAnnotations:R,refreshShareUrl:M,importFromShareUrl:I}}function N6e(t,e){const[r,n]=Be.useState(null),a=Be.useRef(null);return Be.useEffect(()=>{const i=t.current;if(!i)return;const s=i.querySelectorAll('[data-block-type="heading"]');if(s.length===0)return;const o=new Map;return a.current=new IntersectionObserver(l=>{l.forEach(h=>{o.set(h.target,h.isIntersecting)});let u=null,d=1/0;for(const[h,f]of o)if(f){const p=h.getBoundingClientRect();p.top<d&&(d=p.top,u=h)}if(u){const h=u.getAttribute("data-block-id");h&&n(h)}},{root:i,rootMargin:"-80px 0px -80% 0px",threshold:[0,.1,.5,1]}),s.forEach(l=>{a.current?.observe(l)}),()=>{a.current?.disconnect()}},[t,e]),r}function kW(t){window.close(),setTimeout(()=>{window.closed||t()},300)}function k6e(t){const[e,r]=Be.useState({phase:"idle"});Be.useEffect(()=>{if(!t)return;const a=zoe();a==="0"?(kW(()=>r({phase:"closeFailed"})),r({phase:"closed"})):r(a!=="off"?{phase:"counting",remaining:Number(a)}:{phase:"prompt"})},[t]),Be.useEffect(()=>{if(e.phase!=="counting")return;if(e.remaining<=0){kW(()=>r({phase:"closeFailed"}));return}const a=setTimeout(()=>r(i=>i.phase==="counting"?{phase:"counting",remaining:i.remaining-1}:i),1e3);return()=>clearTimeout(a)},[e]);const n=Be.useCallback(()=>{Goe("3"),r({phase:"counting",remaining:3})},[]);return{state:e,enableAndStart:n}}const M6e=()=>H.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),D6e=()=>H.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})});function L6e({submitted:t,title:e,subtitle:r,agentLabel:n}){const{state:a,enableAndStart:i}=k6e(!!t);if(!t)return null;const s=t==="approved";return H.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:H.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[H.jsx("div",{className:`mx-auto w-16 h-16 rounded-full flex items-center justify-center ${s?"bg-success/20 text-success":"bg-accent/20 text-accent"}`,children:s?H.jsx(M6e,{}):H.jsx(D6e,{})}),H.jsxs("div",{className:"space-y-2",children:[H.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),H.jsx("p",{className:"text-muted-foreground",children:r})]}),H.jsx("div",{className:"pt-4 border-t border-border space-y-2",children:a.phase==="counting"?H.jsxs(H.Fragment,{children:[H.jsxs("p",{className:"text-sm text-muted-foreground",children:["This tab will close in ",H.jsx("span",{className:"text-foreground font-medium",children:a.remaining})," second",a.remaining!==1?"s":"","..."]}),H.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change this in Settings."})]}):a.phase==="closeFailed"?H.jsxs(H.Fragment,{children:[H.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not close this tab automatically. Please close it manually."}),H.jsxs("p",{className:"text-xs text-muted-foreground/60",children:["Auto-close works when the tab is opened by ",n,"."]})]}):H.jsxs(H.Fragment,{children:[H.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can close this tab and return to ",H.jsx("span",{className:"text-foreground font-medium",children:n}),"."]}),a.phase==="prompt"?H.jsxs(H.Fragment,{children:[H.jsxs("label",{className:"flex items-center justify-center gap-2 cursor-pointer group",children:[H.jsx("input",{type:"checkbox",checked:!1,onChange:i,className:"accent-primary"}),H.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors",children:"Auto-close this tab after 3 seconds"})]}),H.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change the delay in Settings."})]}):H.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Your response has been sent."})]})})]})})}const P6e="https://api.github.com/repos/backnotprop/plannotator/releases/latest",MW={"0.5.0":{title:"Code Review is here!",description:"Review git diffs with inline annotations. Run /plannotator-review to try it."}};function B6e(t,e){const r=i=>i.replace(/^v/,""),n=r(t).split(".").map(Number),a=r(e).split(".").map(Number);for(let i=0;i<Math.max(n.length,a.length);i++){const s=n[i]||0,o=a[i]||0;if(o>s)return!0;if(o<s)return!1}return!1}function F6e(){const[t,e]=Be.useState(null);return Be.useEffect(()=>{(async()=>{try{const n="0.8.5",i=new URLSearchParams(window.location.search).get("preview-update");if(i){const f=i.replace(/^v/,"");e({currentVersion:n,latestVersion:i,updateAvailable:!0,releaseUrl:`https://github.com/backnotprop/plannotator/releases/tag/v${f}`,featureHighlight:MW[f]});return}const s=await fetch(P6e);if(!s.ok)return;const o=await s.json(),l=o.tag_name,u=B6e(n,l),d=l.replace(/^v/,""),h=MW[d];e({currentVersion:n,latestVersion:l,updateAvailable:u,releaseUrl:o.html_url,featureHighlight:h})}catch(n){console.debug("Update check failed:",n)}})()},[]),t}const _6e="curl -fsSL https://plannotator.ai/install.sh | bash",U6e=({origin:t})=>{const e=F6e(),[r,n]=Be.useState(!1),[a,i]=Be.useState(!1),u=(new URLSearchParams(window.location.search).get("preview-origin")||t)==="opencode";if(!e?.updateAvailable||a)return null;const d=async()=>{try{await navigator.clipboard.writeText(_6e),n(!0),setTimeout(()=>n(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return e.featureHighlight?H.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-md animate-in slide-in-from-bottom-2 fade-in duration-300",children:H.jsxs("div",{className:"bg-card border border-primary/30 rounded-xl shadow-2xl overflow-hidden",children:[H.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-primary/5 px-5 py-4 border-b border-border/50",children:H.jsxs("div",{className:"flex items-start justify-between gap-3",children:[H.jsxs("div",{className:"flex items-center gap-3",children:[H.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/20 flex items-center justify-center",children:H.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),H.jsxs("div",{children:[H.jsx("h4",{className:"text-base font-semibold text-foreground",children:e.featureHighlight.title}),H.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["New in ",e.latestVersion]})]})]}),H.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors p-1",children:H.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),H.jsxs("div",{className:"px-5 py-4",children:[H.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:e.featureHighlight.description}),H.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:["You have ",e.currentVersion]}),u&&H.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"Run the install script, then restart OpenCode."}),H.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[H.jsx("button",{onClick:d,className:"flex-1 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),H.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground border border-border rounded-lg hover:bg-muted transition-colors",children:"Release notes"})]})]})]})}):H.jsx("div",{className:"fixed bottom-4 right-4 z-50 max-w-sm animate-in slide-in-from-bottom-2 fade-in duration-300",children:H.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:H.jsxs("div",{className:"flex items-start gap-3",children:[H.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:H.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})})}),H.jsxs("div",{className:"flex-1 min-w-0",children:[H.jsxs("div",{className:"flex items-center justify-between gap-2",children:[H.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),H.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:H.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),H.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.latestVersion," is available (you have ",e.currentVersion,")"]}),H.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[H.jsx("button",{onClick:d,className:"flex-1 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-md hover:opacity-90 transition-opacity",children:r?"Copied!":"Copy install command"}),H.jsx("a",{href:e.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted transition-colors",children:"Notes"})]})]})]})})})},yle="plannotator-editor-mode",z6e="selection";function G6e(){const t=Fr.getItem(yle);return t==="selection"||t==="comment"||t==="redline"?t:z6e}function Y6e(t){Fr.setItem(yle,t)}function DW({storageKey:t,defaultWidth:e=288,minWidth:r=200,maxWidth:n=600,side:a="right"}){const[i,s]=Be.useState(()=>{const y=Fr.getItem(t);if(y){const b=Number(y);if(!Number.isNaN(b)&&b>=r&&b<=n)return b}return e}),[o,l]=Be.useState(!1),u=Be.useRef(0),d=Be.useRef(0),h=Be.useRef(i),f=Be.useCallback(y=>{h.current=y,s(y)},[]),p=Be.useCallback(y=>{y.preventDefault(),u.current=y.clientX,d.current=h.current,l(!0)},[]);Be.useEffect(()=>{if(!o)return;const y=E=>{const T=a==="right"?u.current-E.clientX:E.clientX-u.current;f(Math.min(n,Math.max(r,d.current+T)))},b=()=>{l(!1),Fr.setItem(t,String(h.current))};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",b),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",b)}},[o,r,n,t,a,f]);const m=Be.useCallback(()=>{f(e),Fr.setItem(t,String(e))},[e,t,f]);return{width:i,isDragging:o,handleProps:{isDragging:o,onMouseDown:p,onDoubleClick:m}}}const LW=({isDragging:t,onMouseDown:e,onDoubleClick:r,className:n})=>H.jsx("div",{onMouseDown:e,onDoubleClick:r,className:`w-1 cursor-col-resize flex-shrink-0 transition-colors ${t?"bg-primary/50":"hover:bg-border"}${n?` ${n}`:""}`}),V6e=({isOpen:t,onComplete:e})=>{const[r,n]=Be.useState("acceptEdits");if(!t)return null;const a=()=>{dle(r),e(r)};return pm.createPortal(H.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:H.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[H.jsxs("div",{className:"p-5 border-b border-border",children:[H.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[H.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:H.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})})}),H.jsx("h3",{className:"font-semibold text-base",children:"New: Permission Mode Preservation"})]}),H.jsx("p",{className:"text-sm text-muted-foreground",children:"Claude Code 2.1.7+ supports preserving your permission mode after plan approval. Choose your preferred automation level."}),H.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Requires Claude Code 2.1.7 or later. Run ",H.jsx("code",{className:"bg-muted px-1 rounded",children:"claude update"})," to update."]})]}),H.jsx("div",{className:"p-4 space-y-2",children:MD.map(i=>H.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all border ${r===i.value?"border-primary bg-primary/10":"border-transparent bg-muted/50 hover:bg-muted"}`,children:[H.jsx("input",{type:"radio",name:"permissionMode",value:i.value,checked:r===i.value,onChange:()=>n(i.value),className:"mt-0.5 accent-primary"}),H.jsxs("div",{className:"flex-1",children:[H.jsx("div",{className:"text-sm font-medium",children:i.label}),H.jsx("div",{className:"text-xs text-muted-foreground",children:i.description})]})]},i.value))}),H.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[H.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),H.jsx("button",{onClick:a,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Continue"})]})]})}),document.body)},q6e="https://plannotator.ai/assets/toc-sticky-preview.png",H6e=({isOpen:t,onComplete:e})=>{const[r,n]=Be.useState(!0),[a,i]=Be.useState(!0),[s,o]=Be.useState(!0);if(!t)return null;const l=()=>{const u={tocEnabled:r,stickyActionsEnabled:a};lle(u),g6e(),e(u)};return pm.createPortal(H.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:H.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[H.jsxs("div",{className:"p-5 border-b border-border",children:[H.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[H.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:H.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})}),H.jsx("h3",{className:"font-semibold text-base",children:"New: Display Options"})]}),H.jsx("p",{className:"text-sm text-muted-foreground",children:"We've added two features that help navigate larger plans."})]}),H.jsxs("div",{className:"p-4 space-y-4",children:[s&&H.jsx("img",{src:q6e,alt:"Table of Contents and Sticky Actions preview",className:"w-full rounded-lg border border-border",onError:()=>o(!1)}),H.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[H.jsx("input",{type:"checkbox",checked:r,onChange:()=>n(!r),className:"mt-0.5 accent-primary"}),H.jsxs("div",{className:"flex-1",children:[H.jsx("div",{className:"text-sm font-medium",children:"Table of Contents"}),H.jsx("div",{className:"text-xs text-muted-foreground",children:"Show sidebar navigation on desktop"})]})]}),H.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer border border-transparent bg-muted/50 hover:bg-muted transition-all",children:[H.jsx("input",{type:"checkbox",checked:a,onChange:()=>i(!a),className:"mt-0.5 accent-primary"}),H.jsxs("div",{className:"flex-1",children:[H.jsx("div",{className:"text-sm font-medium",children:"Sticky Actions"}),H.jsx("div",{className:"text-xs text-muted-foreground",children:"Keep action buttons visible while scrolling"})]})]})]}),H.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[H.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),H.jsx("button",{onClick:l,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Save Settings"})]})]})}),document.body)},W6e=`# Implementation Plan: Real-time Collaboration
422
422
 
423
423
  ## Overview
424
424
  Add real-time collaboration features to the editor using WebSocket connections and operational transforms.
@@ -709,7 +709,7 @@ export const CursorOverlay: React.FC<CursorOverlayProps> = ({
709
709
  ---
710
710
 
711
711
  **Target:** Ship MVP in next sprint
712
- `,K6e=()=>{const[t,e]=Be.useState(W6e),[r,n]=Be.useState([]),[a,i]=Be.useState(null),[s,o]=Be.useState([]),[l,u]=Be.useState(null),[d,h]=Be.useState(!1),[f,p]=Be.useState(!1),[m,y]=Be.useState(!1),[b,E]=Be.useState(!1),[T,x]=Be.useState(!1),[R,A]=Be.useState(""),[M,I]=Be.useState(!0),[w,N]=Be.useState(G6e),[P,D]=Be.useState(()=>Fr.getItem("plannotator-tater-mode")==="true"),[_,z]=Be.useState(()=>ole()),[k,B]=Be.useState(!1),[L,F]=Be.useState(null),[U,V]=Be.useState([]),[W,G]=Be.useState(!1),[K,X]=Be.useState(!0),[ne,Z]=Be.useState(!1),[ce,le]=Be.useState(null),[me,ie]=Be.useState(null),[ee,J]=Be.useState(!1),[$,se]=Be.useState(!1),[oe,Ee]=Be.useState("bypassPermissions"),[ue,Fe]=Be.useState(!0),[te,He]=Be.useState(void 0),[Te,Ze]=Be.useState(null),[nt,at]=Be.useState(!1),[Ie,Qe]=Be.useState(),[De,Ye]=Be.useState(null),tt=Be.useRef(null),we=Be.useRef(null),Ke=DW({storageKey:"plannotator-panel-width"}),de=DW({storageKey:"plannotator-toc-width",defaultWidth:240,minWidth:160,maxWidth:400,side:"left"}),Se=Ke.isDragging||de.isDragging,j=Be.useMemo(()=>s.filter(Et=>Et.type==="heading").length,[s]),ge=N6e(we,j),{isSharedSession:pe,isLoadingShared:Re,shareUrl:Ce,shareUrlSize:ke,pendingSharedAnnotations:Ue,clearPendingSharedAnnotations:Oe,importFromShareUrl:qe}=I6e(t,r,U,e,n,V,()=>{X(!1)},te),{getAgentWarning:gt}=ple(L);Be.useEffect(()=>{if(Ue&&Ue.length>0){const Et=setTimeout(()=>{tt.current?.clearAllHighlights(),tt.current?.applySharedAnnotations(Ue),Oe()},100);return()=>clearTimeout(Et)}},[Ue,Oe]);const dt=Et=>{D(Et),Fr.setItem("plannotator-tater-mode",String(Et))},be=Et=>{N(Et),Y6e(Et)};Be.useEffect(()=>{Re||pe||fetch("/api/plan").then(Et=>{if(!Et.ok)throw new Error("Not in API mode");return Et.json()}).then(Et=>{e(Et.plan),B(!0),Et.mode==="annotate"&&G(!0),Et.sharingEnabled!==void 0&&Fe(Et.sharingEnabled),Et.shareBaseUrl&&He(Et.shareBaseUrl),Et.repoInfo&&Ze(Et.repoInfo),Et.origin&&(F(Et.origin),Et.origin==="claude-code"&&v6e()?J(!0):AW()&&se(!0),Ee(ule().mode))}).catch(()=>{B(!1)}).finally(()=>X(!1))},[Re,pe]),Be.useEffect(()=>{const{frontmatter:Et}=Iee(t);u(Et),o(lye(t))},[t]),Be.useEffect(()=>{const Et=Vt=>{const Gt=Vt.clipboardData?.items;if(Gt){for(const Zt of Gt)if(Zt.type.startsWith("image/")){Vt.preventDefault();const Ar=Zt.getAsFile();if(Ar){const kt=SM(Ar.name,U.map(vt=>vt.name)),Pe=URL.createObjectURL(Ar);ie({file:Ar,blobUrl:Pe,initialName:kt})}break}}};return document.addEventListener("paste",Et),()=>document.removeEventListener("paste",Et)},[U]);const _e=async(Et,Vt,Gt)=>{if(me)try{const Zt=new FormData,Ar=Vt?new File([Et],"annotated.png",{type:"image/png"}):me.file;Zt.append("file",Ar);const kt=await fetch("/api/upload",{method:"POST",body:Zt});if(kt.ok){const Pe=await kt.json();V(vt=>[...vt,{path:Pe.path,name:Gt}])}}catch{}finally{URL.revokeObjectURL(me.blobUrl),ie(null)}},Me=()=>{me&&(URL.revokeObjectURL(me.blobUrl),ie(null))},Je=async()=>{Z(!0);try{const Et=Ay(),Vt=qg(),Gt=J9(),Zt=kD(),Ar={};L==="claude-code"&&(Ar.permissionMode=oe);const kt=f6e(Gt);kt&&(Ar.agentSwitch=kt),Ar.planSave={enabled:Zt.enabled,...Zt.customPath&&{customPath:Zt.customPath}};const Pe=L2(Et);Et.enabled&&Pe&&(Ar.obsidian={vaultPath:Pe,folder:Et.folder||"plannotator",plan:t}),Vt.enabled&&(Ar.bear={plan:t}),(r.length>0||U.length>0)&&(Ar.feedback=_t),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ar)}),le("approved")}catch{Z(!1)}},wt=async()=>{Z(!0);try{const Et=kD();await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:_t,planSave:{enabled:Et.enabled,...Et.customPath&&{customPath:Et.customPath}}})}),le("denied")}catch{Z(!1)}},mt=async()=>{Z(!0);try{await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:_t,annotations:r})}),le("denied")}catch{Z(!1)}};Be.useEffect(()=>{const Et=Vt=>{if(Vt.key!=="Enter"||!(Vt.metaKey||Vt.ctrlKey))return;const Gt=Vt.target?.tagName;if(!(Gt==="INPUT"||Gt==="TEXTAREA")&&!(d||f||m||b||T||ee||$||me)&&!(ce||ne)&&k){if(Vt.preventDefault(),W){r.length===0?y(!0):mt();return}if(r.length===0){if(L==="opencode"){const Zt=gt();if(Zt){A(Zt),x(!0);return}}Je()}else wt()}};return window.addEventListener("keydown",Et),()=>window.removeEventListener("keydown",Et)},[d,f,m,b,T,ee,$,me,ce,ne,k,r.length,W,L,gt]);const je=Et=>{n(Vt=>[...Vt,Et]),i(Et.id),I(!0)},ut=Et=>{tt.current?.removeHighlight(Et),n(Vt=>Vt.filter(Gt=>Gt.id!==Et)),a===Et&&i(null)},et=(Et,Vt)=>{n(Gt=>Gt.map(Zt=>Zt.id===Et?{...Zt,...Vt}:Zt))},bt=(Et,Vt)=>{n(Gt=>Gt.map(Zt=>Zt.author===Et?{...Zt,author:Vt}:Zt))},Tt=Et=>{V(Vt=>[...Vt,Et])},Dt=Et=>{V(Vt=>Vt.filter(Gt=>Gt.path!==Et))},It=Et=>{},_t=Be.useMemo(()=>cye(s,r,U),[s,r,U]),gr=()=>{at(!1);const Et=new Blob([_t],{type:"text/plain"}),Vt=URL.createObjectURL(Et),Gt=document.createElement("a");Gt.href=Vt,Gt.download="annotations.diff",Gt.click(),URL.revokeObjectURL(Vt),Ye({type:"success",message:"Downloaded diff"}),setTimeout(()=>Ye(null),3e3)},Yt=async Et=>{at(!1);const Vt={};if(Et==="obsidian"){const Gt=Ay(),Zt=L2(Gt);Zt&&(Vt.obsidian={vaultPath:Zt,folder:Gt.folder||"plannotator",plan:t})}Et==="bear"&&(Vt.bear={plan:t});try{const Ar=(await(await fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Vt)})).json()).results?.[Et];Ar?.success?Ye({type:"success",message:`Saved to ${Et==="obsidian"?"Obsidian":"Bear"}`}):Ye({type:"error",message:Ar?.error||"Save failed"})}catch{Ye({type:"error",message:"Save failed"})}setTimeout(()=>Ye(null),3e3)};Be.useEffect(()=>{const Et=Vt=>{if(Vt.key!=="s"||!(Vt.metaKey||Vt.ctrlKey))return;const Gt=Vt.target?.tagName;if(Gt==="INPUT"||Gt==="TEXTAREA"||d||m||b||T||ee||$||me||ce||!k)return;Vt.preventDefault();const Zt=fle(),Ar=O4(),kt=qg().enabled;Zt==="download"?gr():Zt==="obsidian"&&Ar?Yt("obsidian"):Zt==="bear"&&kt?Yt("bear"):(Qe("notes"),h(!0))};return window.addEventListener("keydown",Et),()=>window.removeEventListener("keydown",Et)},[d,m,b,T,ee,$,me,ce,k,t,_t]),Be.useEffect(()=>{if(!nt)return;const Et=Vt=>{Vt.target.closest("[data-export-dropdown]")||at(!1)};return document.addEventListener("mousedown",Et),()=>document.removeEventListener("mousedown",Et)},[nt]);const nr=Be.useMemo(()=>L==="opencode"?"OpenCode":L==="claude-code"?"Claude Code":"Coding Agent",[L]);return H.jsx(JLe,{defaultTheme:"dark",children:H.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[P&&H.jsx(c6e,{}),H.jsxs("header",{className:"h-12 flex items-center justify-between px-2 md:px-4 border-b border-border/50 bg-card/50 backdrop-blur-xl sticky top-0 z-20",children:[H.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[H.jsx("a",{href:"https://plannotator.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 md:gap-2 hover:opacity-80 transition-opacity",children:H.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),H.jsxs("a",{href:"https://github.com/backnotprop/plannotator/releases",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground font-mono opacity-60 hidden md:inline hover:opacity-100 transition-opacity",children:["v","0.8.3"]}),L&&H.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline ${L==="claude-code"?"bg-orange-500/15 text-orange-400":"bg-zinc-500/20 text-zinc-400"}`,children:nr})]}),H.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[k&&H.jsxs(H.Fragment,{children:[H.jsxs("button",{onClick:()=>{r.length===0?y(!0):W?mt():wt()},disabled:ne,className:`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all ${ne?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-accent/15 text-accent hover:bg-accent/25 border border-accent/30"}`,title:"Send Feedback",children:[H.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),H.jsx("span",{className:"hidden md:inline",children:ne?"Sending...":W?"Send Annotations":"Send Feedback"})]}),!W&&H.jsxs("div",{className:"relative group/approve",children:[H.jsxs("button",{onClick:()=>{if(L==="claude-code"&&r.length>0){E(!0);return}if(L==="opencode"){const Et=gt();if(Et){A(Et),x(!0);return}}Je()},disabled:ne,className:`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all ${ne?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":L==="claude-code"&&r.length>0?"bg-success/50 text-success-foreground/70 hover:bg-success hover:text-success-foreground":"bg-success text-success-foreground hover:opacity-90"}`,children:[H.jsx("span",{className:"md:hidden",children:ne?"...":"OK"}),H.jsx("span",{className:"hidden md:inline",children:ne?"Approving...":"Approve"})]}),L==="claude-code"&&r.length>0&&H.jsxs("div",{className:"absolute top-full right-0 mt-2 px-3 py-2 bg-popover border border-border rounded-lg shadow-xl text-xs text-foreground w-56 text-center opacity-0 invisible group-hover/approve:opacity-100 group-hover/approve:visible transition-all pointer-events-none z-50",children:[H.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),H.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),nr," doesn't support feedback on approval. Your annotations won't be seen."]})]}),H.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),H.jsx(e6e,{}),H.jsx(b6e,{taterMode:P,onTaterModeChange:dt,onIdentityChange:bt,origin:L,onUIPreferencesChange:z}),H.jsx("button",{onClick:()=>I(!M),className:`p-1.5 rounded-md text-xs font-medium transition-all ${M?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:H.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),H.jsxs("div",{className:"relative flex","data-export-dropdown":!0,children:[H.jsxs("button",{onClick:()=>{Qe(void 0),h(!0)},className:"p-1.5 md:px-2.5 md:py-1 rounded-l-md text-xs font-medium bg-muted hover:bg-muted/80 transition-colors",title:"Export",children:[H.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),H.jsx("span",{className:"hidden md:inline",children:"Export"})]}),H.jsx("button",{onClick:()=>at(Et=>!Et),className:"px-1 md:px-1.5 rounded-r-md text-xs bg-muted hover:bg-muted/80 border-l border-border/50 transition-colors flex items-center",title:"Quick save options",children:H.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),nt&&H.jsxs("div",{className:"absolute top-full right-0 mt-1 w-48 bg-popover border border-border rounded-lg shadow-xl z-50 py-1",children:[ue&&H.jsxs("button",{onClick:async()=>{at(!1);try{await navigator.clipboard.writeText(Ce),Ye({type:"success",message:"Share link copied"})}catch{Ye({type:"error",message:"Failed to copy"})}setTimeout(()=>Ye(null),3e3)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),"Copy Share Link"]}),H.jsxs("button",{onClick:gr,className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download Diff"]}),k&&O4()&&H.jsxs("button",{onClick:()=>Yt("obsidian"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Obsidian"]}),k&&qg().enabled&&H.jsxs("button",{onClick:()=>Yt("bear"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Bear"]}),k&&!O4()&&!qg().enabled&&H.jsx("div",{className:"px-3 py-2 text-[10px] text-muted-foreground",children:"No notes apps configured."}),ue&&H.jsxs(H.Fragment,{children:[H.jsx("div",{className:"my-1 border-t border-border"}),H.jsxs("button",{onClick:()=>{at(!1),p(!0)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m4-4l-4 4m0 0l-4-4m4 4V4"})}),"Import Review"]})]})]})]})]})]}),H.jsxs("div",{className:`flex-1 flex overflow-hidden ${Se?"select-none":""}`,children:[_.tocEnabled&&H.jsxs(H.Fragment,{children:[H.jsx(x6e,{blocks:s,annotations:r,activeId:ge,onNavigate:It,className:"hidden lg:block sticky top-12 h-[calc(100vh-3rem)] flex-shrink-0",style:{width:de.width}}),H.jsx(LW,{...de.handleProps,className:"hidden lg:block"})]}),H.jsx("main",{ref:we,className:"flex-1 min-w-0 overflow-y-auto bg-grid",children:H.jsxs("div",{className:"min-h-full flex flex-col items-center px-4 py-3 md:px-10 md:py-8 xl:px-16",children:[H.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex justify-start",children:H.jsx(a6e,{mode:w,onChange:be,taterMode:P})}),H.jsx(GLe,{ref:tt,blocks:s,markdown:t,frontmatter:l,annotations:r,onAddAnnotation:je,onSelectAnnotation:i,selectedAnnotationId:a,mode:w,taterMode:P,globalAttachments:U,onAddGlobalAttachment:Tt,onRemoveGlobalAttachment:Dt,repoInfo:Te,stickyActions:_.stickyActionsEnabled})]})}),M&&H.jsx(LW,{...Ke.handleProps}),H.jsx(qLe,{isOpen:M,blocks:s,annotations:r,selectedId:a,onSelect:i,onDelete:ut,onEdit:et,shareUrl:Ce,sharingEnabled:ue,width:Ke.width})]}),H.jsx(XLe,{isOpen:d,onClose:()=>{h(!1),Qe(void 0)},shareUrl:Ce,shareUrlSize:ke,diffOutput:_t,annotationCount:r.length,taterSprite:P?H.jsx(Z9,{}):void 0,sharingEnabled:ue,markdown:t,isApiMode:k,initialTab:Ie}),H.jsx(ZLe,{isOpen:f,onClose:()=>p(!1),onImport:qe,shareBaseUrl:te}),H.jsx(I4,{isOpen:m,onClose:()=>y(!1),title:"Add Annotations First",message:`To provide feedback, select text in the plan and add annotations. ${nr} will use your annotations to revise the plan.`,variant:"info"}),H.jsx(I4,{isOpen:b,onClose:()=>E(!1),onConfirm:()=>{E(!1),Je()},title:"Annotations Won't Be Sent",message:H.jsxs(H.Fragment,{children:[nr," doesn't yet support feedback on approval. Your ",r.length," annotation",r.length!==1?"s":""," will be lost."]}),subMessage:H.jsxs(H.Fragment,{children:["To send feedback, use ",H.jsx("strong",{children:"Send Feedback"})," instead.",H.jsx("br",{}),H.jsx("br",{}),"Want this feature? Upvote these issues:",H.jsx("br",{}),H.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/16001",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#16001"})," · ",H.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/15755",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#15755"})]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),H.jsx(I4,{isOpen:T,onClose:()=>x(!1),onConfirm:()=>{x(!1),Je()},title:"Agent Not Found",message:R,subMessage:H.jsxs(H.Fragment,{children:["You can change the agent in ",H.jsx("strong",{children:"Settings"}),", or approve anyway and OpenCode will use the default agent."]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),De&&H.jsx("div",{className:`fixed top-16 right-4 z-50 px-3 py-2 rounded-lg text-xs font-medium shadow-lg transition-opacity ${De.type==="success"?"bg-success/15 text-success border border-success/30":"bg-destructive/15 text-destructive border border-destructive/30"}`,children:De.message}),H.jsx(L6e,{submitted:ce,title:ce==="approved"?"Plan Approved":W?"Annotations Sent":"Feedback Sent",subtitle:ce==="approved"?`${nr} will proceed with the implementation.`:W?`${nr} will address your annotations on the file.`:`${nr} will revise the plan based on your annotations.`,agentLabel:nr}),H.jsx(U6e,{origin:L}),H.jsx(Lee,{isOpen:!!me,imageSrc:me?.blobUrl??"",initialName:me?.initialName,onAccept:_e,onClose:Me}),H.jsx(V6e,{isOpen:ee,onComplete:Et=>{Ee(Et),J(!1),AW()&&se(!0)}}),H.jsx(H6e,{isOpen:$,onComplete:Et=>{z(Et),se(!1)}})]})})},ble=document.getElementById("root");if(!ble)throw new Error("Could not find root element to mount to");const j6e=oye.createRoot(ble);j6e.render(H.jsx(eye.StrictMode,{children:H.jsx(K6e,{})}));class Ms{constructor(e,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new Ms(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class oo{constructor(e,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=r}range(e,r){return new oo(r,Ms.range(this,e))}}class Ft{constructor(e,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,a,i,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;a=s.start,i=s.end,a===o.length?n+=" at end of input: ":n+=" at position "+(a+1)+": ";var l=o.slice(a,i).replace(/[^]/g,"$&̲"),u;a>15?u="…"+o.slice(a-15,a):u=o.slice(0,a);var d;i+15<o.length?d=o.slice(i,i+15)+"…":d=o.slice(i),n+=u+l+d}var h=new Error(n);return h.name="ParseError",h.__proto__=Ft.prototype,h.position=a,a!=null&&i!=null&&(h.length=i-a),h.rawMessage=e,h}}Ft.prototype.__proto__=Error.prototype;var Q6e=function(e,r){return e===void 0?r:e},X6e=/([A-Z])/g,Z6e=function(e){return e.replace(X6e,"-$1").toLowerCase()},J6e={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},$6e=/[&><"']/g;function e9e(t){return String(t).replace($6e,e=>J6e[e])}var Ele=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},t9e=function(e){var r=Ele(e);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},r9e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},n9e=function(e){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},pn={deflt:Q6e,escape:e9e,hyphenate:Z6e,getBaseElem:Ele,isCharacterBox:t9e,protocolFromUrl:n9e},Q1={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function a9e(t){if(t.default)return t.default;var e=t.type,r=Array.isArray(e)?e[0]:e;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class eP{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var r in Q1)if(Q1.hasOwnProperty(r)){var n=Q1[r];this[r]=e[r]!==void 0?n.processor?n.processor(e[r]):e[r]:a9e(n)}}reportNonstrict(e,r,n){var a=this.strict;if(typeof a=="function"&&(a=a(e,r,n)),!(!a||a==="ignore")){if(a===!0||a==="error")throw new Ft("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+e+"]"),n);a==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]"))}}useStrictBehavior(e,r,n){var a=this.strict;if(typeof a=="function")try{a=a(e,r,n)}catch{a="error"}return!a||a==="ignore"?!1:a===!0||a==="error"?!0:a==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var r=pn.protocolFromUrl(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class bd{constructor(e,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=r,this.cramped=n}sup(){return $l[i9e[this.id]]}sub(){return $l[s9e[this.id]]}fracNum(){return $l[o9e[this.id]]}fracDen(){return $l[l9e[this.id]]}cramp(){return $l[c9e[this.id]]}text(){return $l[u9e[this.id]]}isTight(){return this.size>=2}}var tP=0,P2=1,nm=2,bu=3,Oy=4,zo=5,km=6,hs=7,$l=[new bd(tP,0,!1),new bd(P2,0,!0),new bd(nm,1,!1),new bd(bu,1,!0),new bd(Oy,2,!1),new bd(zo,2,!0),new bd(km,3,!1),new bd(hs,3,!0)],i9e=[Oy,zo,Oy,zo,km,hs,km,hs],s9e=[zo,zo,zo,zo,hs,hs,hs,hs],o9e=[nm,bu,Oy,zo,km,hs,km,hs],l9e=[bu,bu,zo,zo,hs,hs,hs,hs],c9e=[P2,P2,bu,bu,zo,zo,hs,hs],u9e=[tP,P2,nm,bu,nm,bu,nm,bu],Sr={DISPLAY:$l[tP],TEXT:$l[nm],SCRIPT:$l[Oy],SCRIPTSCRIPT:$l[km]},DD=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function d9e(t){for(var e=0;e<DD.length;e++)for(var r=DD[e],n=0;n<r.blocks.length;n++){var a=r.blocks[n];if(t>=a[0]&&t<=a[1])return r.name}return null}var XT=[];DD.forEach(t=>t.blocks.forEach(e=>XT.push(...e)));function Sle(t){for(var e=0;e<XT.length;e+=2)if(t>=XT[e]&&t<=XT[e+1])return!0;return!1}var Eg=80,h9e=function(e,r){return"M95,"+(622+e+r)+`
712
+ `,K6e=()=>{const[t,e]=Be.useState(W6e),[r,n]=Be.useState([]),[a,i]=Be.useState(null),[s,o]=Be.useState([]),[l,u]=Be.useState(null),[d,h]=Be.useState(!1),[f,p]=Be.useState(!1),[m,y]=Be.useState(!1),[b,E]=Be.useState(!1),[T,x]=Be.useState(!1),[R,A]=Be.useState(""),[M,I]=Be.useState(!0),[w,N]=Be.useState(G6e),[P,D]=Be.useState(()=>Fr.getItem("plannotator-tater-mode")==="true"),[_,z]=Be.useState(()=>ole()),[k,B]=Be.useState(!1),[L,F]=Be.useState(null),[U,V]=Be.useState([]),[W,G]=Be.useState(!1),[K,X]=Be.useState(!0),[ne,Z]=Be.useState(!1),[ce,le]=Be.useState(null),[me,ie]=Be.useState(null),[ee,J]=Be.useState(!1),[$,se]=Be.useState(!1),[oe,Ee]=Be.useState("bypassPermissions"),[ue,Fe]=Be.useState(!0),[te,He]=Be.useState(void 0),[Te,Ze]=Be.useState(null),[nt,at]=Be.useState(!1),[Ie,Qe]=Be.useState(),[De,Ye]=Be.useState(null),tt=Be.useRef(null),we=Be.useRef(null),Ke=DW({storageKey:"plannotator-panel-width"}),de=DW({storageKey:"plannotator-toc-width",defaultWidth:240,minWidth:160,maxWidth:400,side:"left"}),Se=Ke.isDragging||de.isDragging,j=Be.useMemo(()=>s.filter(Et=>Et.type==="heading").length,[s]),ge=N6e(we,j),{isSharedSession:pe,isLoadingShared:Re,shareUrl:Ce,shareUrlSize:ke,pendingSharedAnnotations:Ue,clearPendingSharedAnnotations:Oe,importFromShareUrl:qe}=I6e(t,r,U,e,n,V,()=>{X(!1)},te),{getAgentWarning:gt}=ple(L);Be.useEffect(()=>{if(Ue&&Ue.length>0){const Et=setTimeout(()=>{tt.current?.clearAllHighlights(),tt.current?.applySharedAnnotations(Ue),Oe()},100);return()=>clearTimeout(Et)}},[Ue,Oe]);const dt=Et=>{D(Et),Fr.setItem("plannotator-tater-mode",String(Et))},be=Et=>{N(Et),Y6e(Et)};Be.useEffect(()=>{Re||pe||fetch("/api/plan").then(Et=>{if(!Et.ok)throw new Error("Not in API mode");return Et.json()}).then(Et=>{e(Et.plan),B(!0),Et.mode==="annotate"&&G(!0),Et.sharingEnabled!==void 0&&Fe(Et.sharingEnabled),Et.shareBaseUrl&&He(Et.shareBaseUrl),Et.repoInfo&&Ze(Et.repoInfo),Et.origin&&(F(Et.origin),Et.origin==="claude-code"&&v6e()?J(!0):AW()&&se(!0),Ee(ule().mode))}).catch(()=>{B(!1)}).finally(()=>X(!1))},[Re,pe]),Be.useEffect(()=>{const{frontmatter:Et}=Iee(t);u(Et),o(lye(t))},[t]),Be.useEffect(()=>{const Et=Vt=>{const Gt=Vt.clipboardData?.items;if(Gt){for(const Zt of Gt)if(Zt.type.startsWith("image/")){Vt.preventDefault();const Ar=Zt.getAsFile();if(Ar){const kt=SM(Ar.name,U.map(vt=>vt.name)),Pe=URL.createObjectURL(Ar);ie({file:Ar,blobUrl:Pe,initialName:kt})}break}}};return document.addEventListener("paste",Et),()=>document.removeEventListener("paste",Et)},[U]);const _e=async(Et,Vt,Gt)=>{if(me)try{const Zt=new FormData,Ar=Vt?new File([Et],"annotated.png",{type:"image/png"}):me.file;Zt.append("file",Ar);const kt=await fetch("/api/upload",{method:"POST",body:Zt});if(kt.ok){const Pe=await kt.json();V(vt=>[...vt,{path:Pe.path,name:Gt}])}}catch{}finally{URL.revokeObjectURL(me.blobUrl),ie(null)}},Me=()=>{me&&(URL.revokeObjectURL(me.blobUrl),ie(null))},Je=async()=>{Z(!0);try{const Et=Ay(),Vt=qg(),Gt=J9(),Zt=kD(),Ar={};L==="claude-code"&&(Ar.permissionMode=oe);const kt=f6e(Gt);kt&&(Ar.agentSwitch=kt),Ar.planSave={enabled:Zt.enabled,...Zt.customPath&&{customPath:Zt.customPath}};const Pe=L2(Et);Et.enabled&&Pe&&(Ar.obsidian={vaultPath:Pe,folder:Et.folder||"plannotator",plan:t}),Vt.enabled&&(Ar.bear={plan:t}),(r.length>0||U.length>0)&&(Ar.feedback=_t),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ar)}),le("approved")}catch{Z(!1)}},wt=async()=>{Z(!0);try{const Et=kD();await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:_t,planSave:{enabled:Et.enabled,...Et.customPath&&{customPath:Et.customPath}}})}),le("denied")}catch{Z(!1)}},mt=async()=>{Z(!0);try{await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:_t,annotations:r})}),le("denied")}catch{Z(!1)}};Be.useEffect(()=>{const Et=Vt=>{if(Vt.key!=="Enter"||!(Vt.metaKey||Vt.ctrlKey))return;const Gt=Vt.target?.tagName;if(!(Gt==="INPUT"||Gt==="TEXTAREA")&&!(d||f||m||b||T||ee||$||me)&&!(ce||ne)&&k){if(Vt.preventDefault(),W){r.length===0?y(!0):mt();return}if(r.length===0){if(L==="opencode"){const Zt=gt();if(Zt){A(Zt),x(!0);return}}Je()}else wt()}};return window.addEventListener("keydown",Et),()=>window.removeEventListener("keydown",Et)},[d,f,m,b,T,ee,$,me,ce,ne,k,r.length,W,L,gt]);const je=Et=>{n(Vt=>[...Vt,Et]),i(Et.id),I(!0)},ut=Et=>{tt.current?.removeHighlight(Et),n(Vt=>Vt.filter(Gt=>Gt.id!==Et)),a===Et&&i(null)},et=(Et,Vt)=>{n(Gt=>Gt.map(Zt=>Zt.id===Et?{...Zt,...Vt}:Zt))},bt=(Et,Vt)=>{n(Gt=>Gt.map(Zt=>Zt.author===Et?{...Zt,author:Vt}:Zt))},Tt=Et=>{V(Vt=>[...Vt,Et])},Dt=Et=>{V(Vt=>Vt.filter(Gt=>Gt.path!==Et))},It=Et=>{},_t=Be.useMemo(()=>cye(s,r,U),[s,r,U]),gr=()=>{at(!1);const Et=new Blob([_t],{type:"text/plain"}),Vt=URL.createObjectURL(Et),Gt=document.createElement("a");Gt.href=Vt,Gt.download="annotations.diff",Gt.click(),URL.revokeObjectURL(Vt),Ye({type:"success",message:"Downloaded diff"}),setTimeout(()=>Ye(null),3e3)},Yt=async Et=>{at(!1);const Vt={};if(Et==="obsidian"){const Gt=Ay(),Zt=L2(Gt);Zt&&(Vt.obsidian={vaultPath:Zt,folder:Gt.folder||"plannotator",plan:t})}Et==="bear"&&(Vt.bear={plan:t});try{const Ar=(await(await fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Vt)})).json()).results?.[Et];Ar?.success?Ye({type:"success",message:`Saved to ${Et==="obsidian"?"Obsidian":"Bear"}`}):Ye({type:"error",message:Ar?.error||"Save failed"})}catch{Ye({type:"error",message:"Save failed"})}setTimeout(()=>Ye(null),3e3)};Be.useEffect(()=>{const Et=Vt=>{if(Vt.key!=="s"||!(Vt.metaKey||Vt.ctrlKey))return;const Gt=Vt.target?.tagName;if(Gt==="INPUT"||Gt==="TEXTAREA"||d||m||b||T||ee||$||me||ce||!k)return;Vt.preventDefault();const Zt=fle(),Ar=O4(),kt=qg().enabled;Zt==="download"?gr():Zt==="obsidian"&&Ar?Yt("obsidian"):Zt==="bear"&&kt?Yt("bear"):(Qe("notes"),h(!0))};return window.addEventListener("keydown",Et),()=>window.removeEventListener("keydown",Et)},[d,m,b,T,ee,$,me,ce,k,t,_t]),Be.useEffect(()=>{if(!nt)return;const Et=Vt=>{Vt.target.closest("[data-export-dropdown]")||at(!1)};return document.addEventListener("mousedown",Et),()=>document.removeEventListener("mousedown",Et)},[nt]);const nr=Be.useMemo(()=>L==="opencode"?"OpenCode":L==="claude-code"?"Claude Code":"Coding Agent",[L]);return H.jsx(JLe,{defaultTheme:"dark",children:H.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[P&&H.jsx(c6e,{}),H.jsxs("header",{className:"h-12 flex items-center justify-between px-2 md:px-4 border-b border-border/50 bg-card/50 backdrop-blur-xl sticky top-0 z-20",children:[H.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[H.jsx("a",{href:"https://plannotator.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 md:gap-2 hover:opacity-80 transition-opacity",children:H.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),H.jsxs("a",{href:"https://github.com/backnotprop/plannotator/releases",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground font-mono opacity-60 hidden md:inline hover:opacity-100 transition-opacity",children:["v","0.8.5"]}),L&&H.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline ${L==="claude-code"?"bg-orange-500/15 text-orange-400":"bg-zinc-500/20 text-zinc-400"}`,children:nr})]}),H.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[k&&H.jsxs(H.Fragment,{children:[H.jsxs("button",{onClick:()=>{r.length===0?y(!0):W?mt():wt()},disabled:ne,className:`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all ${ne?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":"bg-accent/15 text-accent hover:bg-accent/25 border border-accent/30"}`,title:"Send Feedback",children:[H.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),H.jsx("span",{className:"hidden md:inline",children:ne?"Sending...":W?"Send Annotations":"Send Feedback"})]}),!W&&H.jsxs("div",{className:"relative group/approve",children:[H.jsxs("button",{onClick:()=>{if(L==="claude-code"&&r.length>0){E(!0);return}if(L==="opencode"){const Et=gt();if(Et){A(Et),x(!0);return}}Je()},disabled:ne,className:`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all ${ne?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":L==="claude-code"&&r.length>0?"bg-success/50 text-success-foreground/70 hover:bg-success hover:text-success-foreground":"bg-success text-success-foreground hover:opacity-90"}`,children:[H.jsx("span",{className:"md:hidden",children:ne?"...":"OK"}),H.jsx("span",{className:"hidden md:inline",children:ne?"Approving...":"Approve"})]}),L==="claude-code"&&r.length>0&&H.jsxs("div",{className:"absolute top-full right-0 mt-2 px-3 py-2 bg-popover border border-border rounded-lg shadow-xl text-xs text-foreground w-56 text-center opacity-0 invisible group-hover/approve:opacity-100 group-hover/approve:visible transition-all pointer-events-none z-50",children:[H.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),H.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),nr," doesn't support feedback on approval. Your annotations won't be seen."]})]}),H.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),H.jsx(e6e,{}),H.jsx(b6e,{taterMode:P,onTaterModeChange:dt,onIdentityChange:bt,origin:L,onUIPreferencesChange:z}),H.jsx("button",{onClick:()=>I(!M),className:`p-1.5 rounded-md text-xs font-medium transition-all ${M?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:H.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),H.jsxs("div",{className:"relative flex","data-export-dropdown":!0,children:[H.jsxs("button",{onClick:()=>{Qe(void 0),h(!0)},className:"p-1.5 md:px-2.5 md:py-1 rounded-l-md text-xs font-medium bg-muted hover:bg-muted/80 transition-colors",title:"Export",children:[H.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})}),H.jsx("span",{className:"hidden md:inline",children:"Export"})]}),H.jsx("button",{onClick:()=>at(Et=>!Et),className:"px-1 md:px-1.5 rounded-r-md text-xs bg-muted hover:bg-muted/80 border-l border-border/50 transition-colors flex items-center",title:"Quick save options",children:H.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),nt&&H.jsxs("div",{className:"absolute top-full right-0 mt-1 w-48 bg-popover border border-border rounded-lg shadow-xl z-50 py-1",children:[ue&&H.jsxs("button",{onClick:async()=>{at(!1);try{await navigator.clipboard.writeText(Ce),Ye({type:"success",message:"Share link copied"})}catch{Ye({type:"error",message:"Failed to copy"})}setTimeout(()=>Ye(null),3e3)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),"Copy Share Link"]}),H.jsxs("button",{onClick:gr,className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Download Diff"]}),k&&O4()&&H.jsxs("button",{onClick:()=>Yt("obsidian"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Obsidian"]}),k&&qg().enabled&&H.jsxs("button",{onClick:()=>Yt("bear"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Bear"]}),k&&!O4()&&!qg().enabled&&H.jsx("div",{className:"px-3 py-2 text-[10px] text-muted-foreground",children:"No notes apps configured."}),ue&&H.jsxs(H.Fragment,{children:[H.jsx("div",{className:"my-1 border-t border-border"}),H.jsxs("button",{onClick:()=>{at(!1),p(!0)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[H.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:H.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m4-4l-4 4m0 0l-4-4m4 4V4"})}),"Import Review"]})]})]})]})]})]}),H.jsxs("div",{className:`flex-1 flex overflow-hidden ${Se?"select-none":""}`,children:[_.tocEnabled&&H.jsxs(H.Fragment,{children:[H.jsx(x6e,{blocks:s,annotations:r,activeId:ge,onNavigate:It,className:"hidden lg:block sticky top-12 h-[calc(100vh-3rem)] flex-shrink-0",style:{width:de.width}}),H.jsx(LW,{...de.handleProps,className:"hidden lg:block"})]}),H.jsx("main",{ref:we,className:"flex-1 min-w-0 overflow-y-auto bg-grid",children:H.jsxs("div",{className:"min-h-full flex flex-col items-center px-4 py-3 md:px-10 md:py-8 xl:px-16",children:[H.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex justify-start",children:H.jsx(a6e,{mode:w,onChange:be,taterMode:P})}),H.jsx(GLe,{ref:tt,blocks:s,markdown:t,frontmatter:l,annotations:r,onAddAnnotation:je,onSelectAnnotation:i,selectedAnnotationId:a,mode:w,taterMode:P,globalAttachments:U,onAddGlobalAttachment:Tt,onRemoveGlobalAttachment:Dt,repoInfo:Te,stickyActions:_.stickyActionsEnabled})]})}),M&&H.jsx(LW,{...Ke.handleProps}),H.jsx(qLe,{isOpen:M,blocks:s,annotations:r,selectedId:a,onSelect:i,onDelete:ut,onEdit:et,shareUrl:Ce,sharingEnabled:ue,width:Ke.width})]}),H.jsx(XLe,{isOpen:d,onClose:()=>{h(!1),Qe(void 0)},shareUrl:Ce,shareUrlSize:ke,diffOutput:_t,annotationCount:r.length,taterSprite:P?H.jsx(Z9,{}):void 0,sharingEnabled:ue,markdown:t,isApiMode:k,initialTab:Ie}),H.jsx(ZLe,{isOpen:f,onClose:()=>p(!1),onImport:qe,shareBaseUrl:te}),H.jsx(I4,{isOpen:m,onClose:()=>y(!1),title:"Add Annotations First",message:`To provide feedback, select text in the plan and add annotations. ${nr} will use your annotations to revise the plan.`,variant:"info"}),H.jsx(I4,{isOpen:b,onClose:()=>E(!1),onConfirm:()=>{E(!1),Je()},title:"Annotations Won't Be Sent",message:H.jsxs(H.Fragment,{children:[nr," doesn't yet support feedback on approval. Your ",r.length," annotation",r.length!==1?"s":""," will be lost."]}),subMessage:H.jsxs(H.Fragment,{children:["To send feedback, use ",H.jsx("strong",{children:"Send Feedback"})," instead.",H.jsx("br",{}),H.jsx("br",{}),"Want this feature? Upvote these issues:",H.jsx("br",{}),H.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/16001",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#16001"})," · ",H.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/15755",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#15755"})]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),H.jsx(I4,{isOpen:T,onClose:()=>x(!1),onConfirm:()=>{x(!1),Je()},title:"Agent Not Found",message:R,subMessage:H.jsxs(H.Fragment,{children:["You can change the agent in ",H.jsx("strong",{children:"Settings"}),", or approve anyway and OpenCode will use the default agent."]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),De&&H.jsx("div",{className:`fixed top-16 right-4 z-50 px-3 py-2 rounded-lg text-xs font-medium shadow-lg transition-opacity ${De.type==="success"?"bg-success/15 text-success border border-success/30":"bg-destructive/15 text-destructive border border-destructive/30"}`,children:De.message}),H.jsx(L6e,{submitted:ce,title:ce==="approved"?"Plan Approved":W?"Annotations Sent":"Feedback Sent",subtitle:ce==="approved"?`${nr} will proceed with the implementation.`:W?`${nr} will address your annotations on the file.`:`${nr} will revise the plan based on your annotations.`,agentLabel:nr}),H.jsx(U6e,{origin:L}),H.jsx(Lee,{isOpen:!!me,imageSrc:me?.blobUrl??"",initialName:me?.initialName,onAccept:_e,onClose:Me}),H.jsx(V6e,{isOpen:ee,onComplete:Et=>{Ee(Et),J(!1),AW()&&se(!0)}}),H.jsx(H6e,{isOpen:$,onComplete:Et=>{z(Et),se(!1)}})]})})},ble=document.getElementById("root");if(!ble)throw new Error("Could not find root element to mount to");const j6e=oye.createRoot(ble);j6e.render(H.jsx(eye.StrictMode,{children:H.jsx(K6e,{})}));class Ms{constructor(e,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new Ms(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class oo{constructor(e,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=r}range(e,r){return new oo(r,Ms.range(this,e))}}class Ft{constructor(e,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,a,i,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;a=s.start,i=s.end,a===o.length?n+=" at end of input: ":n+=" at position "+(a+1)+": ";var l=o.slice(a,i).replace(/[^]/g,"$&̲"),u;a>15?u="…"+o.slice(a-15,a):u=o.slice(0,a);var d;i+15<o.length?d=o.slice(i,i+15)+"…":d=o.slice(i),n+=u+l+d}var h=new Error(n);return h.name="ParseError",h.__proto__=Ft.prototype,h.position=a,a!=null&&i!=null&&(h.length=i-a),h.rawMessage=e,h}}Ft.prototype.__proto__=Error.prototype;var Q6e=function(e,r){return e===void 0?r:e},X6e=/([A-Z])/g,Z6e=function(e){return e.replace(X6e,"-$1").toLowerCase()},J6e={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},$6e=/[&><"']/g;function e9e(t){return String(t).replace($6e,e=>J6e[e])}var Ele=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},t9e=function(e){var r=Ele(e);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},r9e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},n9e=function(e){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},pn={deflt:Q6e,escape:e9e,hyphenate:Z6e,getBaseElem:Ele,isCharacterBox:t9e,protocolFromUrl:n9e},Q1={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function a9e(t){if(t.default)return t.default;var e=t.type,r=Array.isArray(e)?e[0]:e;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class eP{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var r in Q1)if(Q1.hasOwnProperty(r)){var n=Q1[r];this[r]=e[r]!==void 0?n.processor?n.processor(e[r]):e[r]:a9e(n)}}reportNonstrict(e,r,n){var a=this.strict;if(typeof a=="function"&&(a=a(e,r,n)),!(!a||a==="ignore")){if(a===!0||a==="error")throw new Ft("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+e+"]"),n);a==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]"))}}useStrictBehavior(e,r,n){var a=this.strict;if(typeof a=="function")try{a=a(e,r,n)}catch{a="error"}return!a||a==="ignore"?!1:a===!0||a==="error"?!0:a==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+a+"': "+r+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var r=pn.protocolFromUrl(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class bd{constructor(e,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=r,this.cramped=n}sup(){return $l[i9e[this.id]]}sub(){return $l[s9e[this.id]]}fracNum(){return $l[o9e[this.id]]}fracDen(){return $l[l9e[this.id]]}cramp(){return $l[c9e[this.id]]}text(){return $l[u9e[this.id]]}isTight(){return this.size>=2}}var tP=0,P2=1,nm=2,bu=3,Oy=4,zo=5,km=6,hs=7,$l=[new bd(tP,0,!1),new bd(P2,0,!0),new bd(nm,1,!1),new bd(bu,1,!0),new bd(Oy,2,!1),new bd(zo,2,!0),new bd(km,3,!1),new bd(hs,3,!0)],i9e=[Oy,zo,Oy,zo,km,hs,km,hs],s9e=[zo,zo,zo,zo,hs,hs,hs,hs],o9e=[nm,bu,Oy,zo,km,hs,km,hs],l9e=[bu,bu,zo,zo,hs,hs,hs,hs],c9e=[P2,P2,bu,bu,zo,zo,hs,hs],u9e=[tP,P2,nm,bu,nm,bu,nm,bu],Sr={DISPLAY:$l[tP],TEXT:$l[nm],SCRIPT:$l[Oy],SCRIPTSCRIPT:$l[km]},DD=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function d9e(t){for(var e=0;e<DD.length;e++)for(var r=DD[e],n=0;n<r.blocks.length;n++){var a=r.blocks[n];if(t>=a[0]&&t<=a[1])return r.name}return null}var XT=[];DD.forEach(t=>t.blocks.forEach(e=>XT.push(...e)));function Sle(t){for(var e=0;e<XT.length;e+=2)if(t>=XT[e]&&t<=XT[e+1])return!0;return!1}var Eg=80,h9e=function(e,r){return"M95,"+(622+e+r)+`
713
713
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
714
714
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
715
715
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10