@plannotator/pi-extension 0.11.2 → 0.11.3
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 +1 -1
- package/plannotator.html +2 -2
- package/review-editor.html +697 -368
package/package.json
CHANGED
package/plannotator.html
CHANGED
|
@@ -478,7 +478,7 @@ created: ${new Date().toISOString().slice(0,19)}Z
|
|
|
478
478
|
source: plannotator
|
|
479
479
|
tags: [plan, ...]
|
|
480
480
|
---`})]}),D.jsx("div",{className:"border-t border-border/30"}),D.jsxs("div",{className:"flex items-center justify-between",children:[D.jsxs("div",{children:[D.jsx("div",{className:"text-xs font-medium",children:"Auto-save on Plan Arrival"}),D.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Automatically save to Obsidian when a plan loads, before you approve or deny"})]}),D.jsx("button",{role:"switch","aria-checked":f.autoSave,onClick:()=>Q({autoSave:!f.autoSave}),className:`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors ${f.autoSave?"bg-primary":"bg-muted"}`,children:D.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${f.autoSave?"translate-x-6":"translate-x-1"}`})})]}),D.jsxs("div",{className:"flex items-center justify-between",children:[D.jsxs("div",{children:[D.jsx("div",{className:"text-xs font-medium",children:"Vault Browser"}),D.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Browse and annotate vault files from the sidebar"})]}),D.jsx("button",{role:"switch","aria-checked":f.vaultBrowserEnabled,onClick:()=>Q({vaultBrowserEnabled:!f.vaultBrowserEnabled}),className:`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors ${f.vaultBrowserEnabled?"bg-primary":"bg-muted"}`,children:D.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${f.vaultBrowserEnabled?"translate-x-6":"translate-x-1"}`})})]})]})]})]}),l==="bear"&&D.jsxs("div",{className:"flex items-center justify-between",children:[D.jsxs("div",{children:[D.jsx("div",{className:"text-sm font-medium",children:"Bear Notes"}),D.jsx("div",{className:"text-xs text-muted-foreground",children:"Auto-save approved plans to Bear"})]}),D.jsx("button",{role:"switch","aria-checked":x.enabled,onClick:()=>re(!x.enabled),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${x.enabled?"bg-primary":"bg-muted"}`,children:D.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${x.enabled?"translate-x-6":"translate-x-1"}`})})]})]})]})]})}),document.body)]})};async function Loe(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);let o="";for(let u=0;u<s.length;u++)o+=String.fromCharCode(s[u]);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function A2(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)}async function KDe(t){const e=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt"]),r=crypto.getRandomValues(new Uint8Array(12)),n=new TextEncoder().encode(t),a=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},e,n),i=new Uint8Array(r.length+a.byteLength);i.set(r,0),i.set(new Uint8Array(a),r.length);const s=await crypto.subtle.exportKey("raw",e);return{ciphertext:lW(i),key:lW(new Uint8Array(s))}}async function QDe(t,e){const r=cW(t),n=cW(e),a=r.slice(0,12),i=r.slice(12),s=await crypto.subtle.importKey("raw",n,{name:"AES-GCM",length:256},!1,["decrypt"]),o=await crypto.subtle.decrypt({name:"AES-GCM",iv:a},s,i);return new TextDecoder().decode(o)}function lW(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function cW(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),r=atob(e);return Uint8Array.from(r,n=>n.charCodeAt(0))}function Zg(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 TR(t){if(t?.length)return t.map(e=>[e.path,e.name])}function k9(t){return t.map(e=>{const r=e.author||null,n=TR(e.images);if(e.type===yn.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 Yx(t){const e={D:yn.DELETION,R:yn.REPLACEMENT,C:yn.COMMENT,I:yn.INSERTION,G:yn.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:yn.GLOBAL_COMMENT,text:u||void 0,originalText:"",createdA:Date.now()+n,author:d||void 0,images:Zg(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:Zg(l)}})}async function XDe(t,e,r,n=Doe){const a={p:t,a:k9(e),g:r?.length?TR(r):void 0},i=await Loe(a);return`${n}/#${i}`}async function ZDe(){const t=window.location.hash.slice(1);if(!t)return null;try{return await A2(t)}catch(e){return console.warn("Failed to parse share hash:",e),null}}function JDe(t){const e=new Blob([t]).size;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}const Moe="https://plannotator-paste.plannotator.workers.dev",Doe="https://share.plannotator.ai";async function $De(t,e,r,n){const a=n?.pasteApiUrl??Moe,i=n?.shareBaseUrl??Doe;try{const s={p:t,a:k9(e),g:r?.length?TR(r):void 0},o=await Loe(s),{ciphertext:l,key:u}=await KDe(o),d=await fetch(`${a}/api/paste`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:l}),signal:AbortSignal.timeout(5e3)});if(!d.ok)return console.warn(`[sharing] Paste service returned ${d.status}`),null;const h=await d.json();return{shortUrl:`${i}/p/${h.id}#key=${u}`,id:h.id}}catch(s){return console.debug("[sharing] Short URL service unavailable, using hash-based sharing:",s),null}}async function uW(t,e=Moe,r){try{const n=await fetch(`${e}/api/paste/${t}`,{signal:AbortSignal.timeout(1e4)});if(!n.ok)return console.warn(`[sharing] Paste fetch returned ${n.status} for id ${t}`),null;const a=await n.json();if(r){const i=await QDe(a.data,r);return await A2(i)}return await A2(a.data)}catch(n){return console.warn("[sharing] Failed to load from paste ID:",n),null}}function e6e(t,e,r,n,a,i,s,o,l){const[u,d]=Se.useState(!1),[h,f]=Se.useState(!0),[p,m]=Se.useState(""),[y,b]=Se.useState(""),[E,x]=Se.useState(""),[T,R]=Se.useState(!1),[w,L]=Se.useState(""),[N,A]=Se.useState(null),[I,B]=Se.useState(null),[M,F]=Se.useState(""),Y=Se.useCallback(()=>{A(null),B(null)},[]),k=Se.useCallback(()=>F(""),[]),_=Se.useCallback(async()=>{try{const q=window.location.pathname.match(/^\/p\/([A-Za-z0-9]{6,16})$/);if(q){const W=q[1],Q=window.location.hash.slice(1),re=Q.startsWith("key=")?Q.slice(4):void 0,Z=await uW(W,l,re);if(Z){n(Z.p);const le=Yx(Z.a);if(a(le),Z.g?.length){const me=Zg(Z.g)??[];i(me),B(me)}A(le),d(!0),s?.();const ie=window.location.pathname.replace(/\/p\/[A-Za-z0-9]+$/,"")||"/";return window.history.replaceState({},"",ie),!0}return F("Failed to load shared plan — the link may be expired or incomplete."),!1}const j=window.location.hash.slice(1),G=await ZDe();if(G){n(G.p);const W=Yx(G.a);if(a(W),G.g?.length){const Q=Zg(G.g)??[];i(Q),B(Q)}return A(W),d(!0),s?.(),window.history.replaceState({},"",window.location.pathname),!0}return j&&F("Failed to load shared plan — the URL may have been truncated by your browser."),!1}catch(q){return console.error("Failed to load from share hash:",q),F("Failed to load shared plan — an unexpected error occurred."),!1}},[n,a,i,s,l]);Se.useEffect(()=>{_().finally(()=>f(!1))},[]),Se.useEffect(()=>{const q=()=>{window.location.hash.length>1&&_()};return window.addEventListener("hashchange",q),()=>window.removeEventListener("hashchange",q)},[_]);const P=Se.useCallback(async()=>{try{const q=await XDe(t,e,r,o);m(q),b(JDe(q))}catch(q){console.error("Failed to generate share URL:",q),m(""),b("")}},[t,e,r,o]);Se.useEffect(()=>{P()},[P]),Se.useEffect(()=>{x(""),L("")},[t,e]);const U=Se.useCallback(async()=>{if(t){R(!0),L("");try{const q=await $De(t,e,r,{pasteApiUrl:l,shareBaseUrl:o});q?x(q.shortUrl):(x(""),L("Short URL service unavailable"))}catch{x(""),L("Failed to generate short URL")}finally{R(!1)}}},[t,e,r,o,l]),z=Se.useCallback(async q=>{try{let j;const G=q.match(/\/p\/([A-Za-z0-9]{6,16})(?:#key=([A-Za-z0-9_-]+))?(?:\?|#|$)/);if(G){const ie=G[1],me=G[2],ne=await uW(ie,l,me);if(!ne)return{success:!1,count:0,planTitle:"",error:"Failed to load from short URL — paste may have expired"};j=ne}else{const ie=q.indexOf("#");if(ie===-1)return{success:!1,count:0,planTitle:"",error:"Invalid share URL: no hash fragment or short link found"};const me=q.slice(ie+1);if(!me)return{success:!1,count:0,planTitle:"",error:"Invalid share URL: empty hash"};j=await A2(me)}const Q=(j.p||"").trim().split(`
|
|
481
|
-
`).find(ie=>ie.startsWith("#")),re=Q?Q.replace(/^#+\s*/,"").trim():"Unknown Plan",Z=Yx(j.a);if(Z.length===0)return{success:!0,count:0,planTitle:re,error:"No annotations found in share link"};const le=Z.filter(ie=>!e.some(me=>me.originalText===ie.originalText&&me.type===ie.type&&me.text===ie.text));if(le.length>0&&(a(ie=>{const me=Z.filter(se=>!ie.some(J=>J.originalText===se.originalText&&J.type===se.type&&J.text===se.text));if(me.length===0)return ie;const ne=[...ie,...me];return A(ne),ne}),j.g?.length)){const ie=Zg(j.g)??[];i(me=>{const ne=new Set(me.map(J=>J.path)),se=ie.filter(J=>!ne.has(J.path));return se.length>0?[...me,...se]:me}),B(ie)}return{success:!0,count:le.length,planTitle:re}}catch(j){return{success:!1,count:0,planTitle:"",error:j instanceof Error?j.message:"Failed to decompress share URL"}}},[e,r,a,i,l]);return{isSharedSession:u,isLoadingShared:h,shareUrl:p,shareUrlSize:y,shortShareUrl:E,isGeneratingShortUrl:T,shortUrlError:w,pendingSharedAnnotations:N,sharedGlobalAttachments:I,clearPendingSharedAnnotations:Y,refreshShareUrl:P,generateShortUrl:U,importFromShareUrl:z,shareLoadError:M,clearShareLoadError:k}}function t6e(t,e){const[r,n]=Se.useState(null),a=Se.useRef(null);return Se.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 dW(t){window.close(),setTimeout(()=>{window.closed||t()},300)}function r6e(t){const[e,r]=Se.useState({phase:"idle"});Se.useEffect(()=>{if(!t)return;const a=$se();a==="0"?(dW(()=>r({phase:"closeFailed"})),r({phase:"closed"})):r(a!=="off"?{phase:"counting",remaining:Number(a)}:{phase:"prompt"})},[t]),Se.useEffect(()=>{if(e.phase!=="counting")return;if(e.remaining<=0){dW(()=>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=Se.useCallback(()=>{eoe("3"),r({phase:"counting",remaining:3})},[]);return{state:e,enableAndStart:n}}const n6e=()=>D.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),a6e=()=>D.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:D.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 i6e({submitted:t,title:e,subtitle:r,agentLabel:n}){const{state:a,enableAndStart:i}=r6e(!!t);if(!t)return null;const s=t==="approved";return D.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:D.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[D.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?D.jsx(n6e,{}):D.jsx(a6e,{})}),D.jsxs("div",{className:"space-y-2",children:[D.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),D.jsx("p",{className:"text-muted-foreground",children:r})]}),D.jsx("div",{className:"pt-4 border-t border-border space-y-2",children:a.phase==="counting"?D.jsxs(D.Fragment,{children:[D.jsxs("p",{className:"text-sm text-muted-foreground",children:["This tab will close in ",D.jsx("span",{className:"text-foreground font-medium",children:a.remaining})," second",a.remaining!==1?"s":"","..."]}),D.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change this in Settings."})]}):a.phase==="closeFailed"?D.jsxs(D.Fragment,{children:[D.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not close this tab automatically. Please close it manually."}),D.jsxs("p",{className:"text-xs text-muted-foreground/60",children:["Auto-close works when the tab is opened by ",n,"."]})]}):D.jsxs(D.Fragment,{children:[D.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can close this tab and return to ",D.jsx("span",{className:"text-foreground font-medium",children:n}),"."]}),a.phase==="prompt"?D.jsxs(D.Fragment,{children:[D.jsxs("label",{className:"flex items-center justify-center gap-2 cursor-pointer group",children:[D.jsx("input",{type:"checkbox",checked:!1,onChange:i,className:"accent-primary"}),D.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors",children:"Auto-close this tab after 3 seconds"})]}),D.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change the delay in Settings."})]}):D.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Your response has been sent."})]})})]})})}const s6e="https://api.github.com/repos/backnotprop/plannotator/releases/latest",hW={"0.5.0":{title:"Code Review is here!",description:"Review git diffs with inline annotations. Run /plannotator-review to try it."}};function o6e(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 l6e(){const[t,e]=Se.useState(null);return Se.useEffect(()=>{(async()=>{try{const n="0.11.2",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:hW[f]});return}const s=await fetch(s6e);if(!s.ok)return;const o=await s.json(),l=o.tag_name,u=o6e(n,l),d=l.replace(/^v/,""),h=hW[d];e({currentVersion:n,latestVersion:l,updateAvailable:u,releaseUrl:o.html_url,featureHighlight:h})}catch(n){console.debug("Update check failed:",n)}})()},[]),t}const c6e="curl -fsSL https://plannotator.ai/install.sh | bash",u6e=({origin:t})=>{const e=l6e(),[r,n]=Se.useState(!1),[a,i]=Se.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(c6e),n(!0),setTimeout(()=>n(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return e.featureHighlight?D.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:D.jsxs("div",{className:"bg-card border border-primary/30 rounded-xl shadow-2xl overflow-hidden",children:[D.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-primary/5 px-5 py-4 border-b border-border/50",children:D.jsxs("div",{className:"flex items-start justify-between gap-3",children:[D.jsxs("div",{className:"flex items-center gap-3",children:[D.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})})}),D.jsxs("div",{children:[D.jsx("h4",{className:"text-base font-semibold text-foreground",children:e.featureHighlight.title}),D.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["New in ",e.latestVersion]})]})]}),D.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors p-1",children:D.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),D.jsxs("div",{className:"px-5 py-4",children:[D.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:e.featureHighlight.description}),D.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:["You have ",e.currentVersion]}),u&&D.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"Run the install script, then restart OpenCode."}),D.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[D.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"}),D.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"})]})]})]})}):D.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:D.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:D.jsxs("div",{className:"flex items-start gap-3",children:[D.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})})}),D.jsxs("div",{className:"flex-1 min-w-0",children:[D.jsxs("div",{className:"flex items-center justify-between gap-2",children:[D.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),D.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:D.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),D.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.latestVersion," is available (you have ",e.currentVersion,")"]}),D.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[D.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"}),D.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"})]})]})]})})})},Poe="plannotator-editor-mode",d6e="selection";function h6e(){const t=fr.getItem(Poe);return t==="selection"||t==="comment"||t==="redline"?t:d6e}function f6e(t){fr.setItem(Poe,t)}const Boe="plannotator-input-method",p6e="drag";function g6e(){const t=fr.getItem(Boe);return t==="drag"||t==="pinpoint"?t:p6e}function m6e(t){fr.setItem(Boe,t)}const v6e=300,y6e=300;function b6e(t,e){const r=Se.useRef("idle"),n=Se.useRef(0),a=Se.useRef(),i=Se.useRef(t);Se.useEffect(()=>{r.current==="idle"&&(i.current=t)},[t]);const s=Se.useCallback(o=>o==="drag"?"pinpoint":"drag",[]);Se.useEffect(()=>{const o=u=>{if(u.key!=="Alt"||u.repeat)return;const d=u.target?.tagName;d==="INPUT"||d==="TEXTAREA"||u.target?.isContentEditable||(r.current==="idle"?(i.current=t,n.current=Date.now(),r.current="held",e(s(t))):r.current==="tapped"&&(clearTimeout(a.current),r.current="idle",i.current=s(i.current)))},l=u=>{u.key==="Alt"&&r.current==="held"&&(Date.now()-n.current>=y6e?(e(i.current),r.current="idle"):(r.current="tapped",a.current=setTimeout(()=>{r.current==="tapped"&&(e(i.current),r.current="idle")},v6e)))};return window.addEventListener("keydown",o),window.addEventListener("keyup",l),()=>{clearTimeout(a.current),window.removeEventListener("keydown",o),window.removeEventListener("keyup",l)}},[t,e,s])}function fW({storageKey:t,defaultWidth:e=288,minWidth:r=200,maxWidth:n=600,side:a="right"}){const[i,s]=Se.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]=Se.useState(!1),u=Se.useRef(0),d=Se.useRef(0),h=Se.useRef(i),f=Se.useCallback(y=>{h.current=y,s(y)},[]),p=Se.useCallback(y=>{y.preventDefault(),u.current=y.clientX,d.current=h.current,l(!0)},[]);Se.useEffect(()=>{if(!o)return;const y=E=>{const x=a==="right"?u.current-E.clientX:E.clientX-u.current;f(Math.min(n,Math.max(r,d.current+x)))},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=Se.useCallback(()=>{f(e),fr.setItem(t,String(e))},[e,t,f]);return{width:i,isDragging:o,handleProps:{isDragging:o,onMouseDown:p,onDoubleClick:m}}}const pW=({isDragging:t,onMouseDown:e,onDoubleClick:r,className:n})=>D.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}`:""}`}),E6e=({isOpen:t,onComplete:e})=>{const[r,n]=Se.useState("acceptEdits");if(!t)return null;const a=()=>{Noe(r),e(r)};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.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"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"New: Permission Mode Preservation"})]}),D.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."}),D.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Requires Claude Code 2.1.7 or later. Run ",D.jsx("code",{className:"bg-muted px-1 rounded",children:"claude update"})," to update."]})]}),D.jsx("div",{className:"p-4 space-y-2",children:fM.map(i=>D.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:[D.jsx("input",{type:"radio",name:"permissionMode",value:i.value,checked:r===i.value,onChange:()=>n(i.value),className:"mt-0.5 accent-primary"}),D.jsxs("div",{className:"flex-1",children:[D.jsx("div",{className:"text-sm font-medium",children:i.label}),D.jsx("div",{className:"text-xs text-muted-foreground",children:i.description})]})]},i.value))}),D.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[D.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),D.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)},S6e="https://plannotator.ai/assets/toc-sticky-preview.png",x6e=({isOpen:t,onComplete:e})=>{const[r,n]=Se.useState(!0),[a,i]=Se.useState(!0),[s,o]=Se.useState(!0);if(!t)return null;const l=()=>{const u={tocEnabled:r,stickyActionsEnabled:a};Roe(u),BDe(),e(u)};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.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"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"New: Display Options"})]}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"We've added two features that help navigate larger plans."})]}),D.jsxs("div",{className:"p-4 space-y-4",children:[s&&D.jsx("img",{src:S6e,alt:"Table of Contents and Sticky Actions preview",className:"w-full rounded-lg border border-border",onError:()=>o(!1)}),D.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:[D.jsx("input",{type:"checkbox",checked:r,onChange:()=>n(!r),className:"mt-0.5 accent-primary"}),D.jsxs("div",{className:"flex-1",children:[D.jsx("div",{className:"text-sm font-medium",children:"Auto-open Sidebar"}),D.jsx("div",{className:"text-xs text-muted-foreground",children:"Open sidebar with Table of Contents on load"})]})]}),D.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:[D.jsx("input",{type:"checkbox",checked:a,onChange:()=>i(!a),className:"mt-0.5 accent-primary"}),D.jsxs("div",{className:"flex-1",children:[D.jsx("div",{className:"text-sm font-medium",children:"Sticky Actions"}),D.jsx("div",{className:"text-xs text-muted-foreground",children:"Keep action buttons visible while scrolling"})]})]})]}),D.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[D.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),D.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)},Foe="plannotator-plan-diff-marketing-seen";function h4(){return fr.getItem(Foe)!=="true"}function T6e(){fr.setItem(Foe,"true")}const C6e="https://plannotator.ai/assets/plan-diff-preview.png",R6e="https://github.com/backnotprop/plannotator/issues",w6e={"claude-code":"https://youtu.be/uIWkFCg60Lk",opencode:"https://youtu.be/uIWkFCg60Lk",pi:"https://youtu.be/uIWkFCg60Lk"},A6e="https://youtu.be/uIWkFCg60Lk",N6e=({isOpen:t,origin:e,onComplete:r})=>{const[n,a]=Se.useState(!1),i=e&&w6e[e]||A6e;if(!t)return null;const s=()=>{T6e(),r()};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-2xl shadow-2xl max-h-full flex flex-col",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"New: Plan Diff Mode"})]}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"See exactly what changed when a coding agent revises your plan."})]}),D.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto min-h-0",children:[n?D.jsx("div",{className:"w-full aspect-[16/7] rounded-lg border border-border bg-muted/50 flex items-center justify-center",children:D.jsxs("div",{className:"text-center text-muted-foreground",children:[D.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.41a2.25 2.25 0 013.182 0l2.909 2.91m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),D.jsx("p",{className:"text-xs",children:"Plan Diff screenshot"})]})}):D.jsx("img",{src:C6e,alt:"Plan Diff Mode preview showing visual and raw diff views",className:"w-full rounded-lg border border-border",onError:()=>a(!0)}),D.jsxs("div",{className:"space-y-3 text-sm text-foreground/90",children:[D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-success mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Two view modes"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— a rendered visual diff with color-coded borders for quick scanning, and a raw markdown diff for precision."})]})]}),D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Version history"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— compare against any previous version from the sidebar. Plans are automatically versioned as your agent iterates."})]})]})]}),D.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50 hover:bg-muted border border-transparent hover:border-border transition-all group",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10 group-hover:bg-primary/20 transition-colors",children:D.jsx("svg",{className:"w-4 h-4 text-primary",fill:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{d:"M8 5v14l11-7z"})})}),D.jsx("span",{className:"text-sm font-medium text-foreground/90",children:"Watch Video Demo of Plan Diff"}),D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})})]}),D.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This is the first release of Plan Diff — rough edges are expected, especially around plan name matching across sessions. If something feels off or you have ideas, open an"," ",D.jsx("a",{href:R6e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"issue"}),". Let's make this better together."]})]}),D.jsx("div",{className:"p-4 border-t border-border flex justify-end",children:D.jsx("button",{onClick:s,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Got it"})})]})}),document.body)},_oe="plannotator-whats-new-v011-seen";function SS(){return fr.getItem(_oe)!=="true"}function O6e(){fr.setItem(_oe,"true")}const gW={v0100:"https://github.com/backnotprop/plannotator/releases/tag/v0.10.0",v0110:"https://github.com/backnotprop/plannotator/releases/tag/v0.11.0"},I6e=({isOpen:t,onComplete:e})=>{if(!t)return null;const r=()=>{O6e(),e()};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-2xl shadow-2xl max-h-full flex flex-col",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"What's New in Plannotator"})]}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"Here's what's been added since your last update."})]}),D.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto min-h-0",children:[D.jsxs("div",{className:"space-y-3 text-sm text-foreground/90",children:[D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-success mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Auto-save annotation drafts"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— Your annotations are now automatically saved in the background. If the browser refreshes or the server crashes, you'll be prompted to restore your work. Sorry it took so long to implement this."})]})]}),D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Short link sharing"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— Share plans with shorter, more portable links that work across Slack and other platforms, with end-to-end encryption. Currently enabled for large plans that don't fit in the URL; we'll be rolling this out as the default soon."})]})]}),D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-warning mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Obsidian vault browser"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— For Obsidian users, we're building deeper integrations starting with the vault browser. Browse and annotate vault files directly during plan review. Toggle it on under Settings > Saving > Obsidian."})]})]})]}),D.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["Plus many more improvements and bug fixes. See the full release notes:"," ",D.jsx("a",{href:gW.v0100,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"v0.10.0"}),", ",D.jsx("a",{href:gW.v0110,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"v0.11.0"})]})]}),D.jsx("div",{className:"p-4 border-t border-border flex justify-end",children:D.jsx("button",{onClick:r,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Got it"})})]})}),document.body)};function k6e(t){const[e,r]=Se.useState(t),[n,a]=Se.useState("toc"),i=Se.useCallback(l=>{r(!0),l&&a(l)},[]),s=Se.useCallback(()=>{r(!1)},[]),o=Se.useCallback(l=>{e?n===l?r(!1):a(l):(r(!0),a(l))},[e,n]);return{isOpen:e,activeTab:n,open:i,close:s,toggleTab:o}}class L6e{diff(e,r,n={}){let a;typeof n=="function"?(a=n,n={}):"callback"in n&&(a=n.callback);const i=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(i,n)),l=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,l,n,a)}diffWithOptionsObj(e,r,n,a){var i;const s=x=>{if(x=this.postProcess(x,n),a){setTimeout(function(){a(x)},0);return}else return x},o=r.length,l=e.length;let u=1,d=o+l;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));const h=(i=n.timeout)!==null&&i!==void 0?i:1/0,f=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(p[0],r,e,0,n);if(p[0].oldPos+1>=l&&m+1>=o)return s(this.buildValues(p[0].lastComponent,r,e));let y=-1/0,b=1/0;const E=()=>{for(let x=Math.max(y,-u);x<=Math.min(b,u);x+=2){let T;const R=p[x-1],w=p[x+1];R&&(p[x-1]=void 0);let L=!1;if(w){const A=w.oldPos-x;L=w&&0<=A&&A<o}const N=R&&R.oldPos+1<l;if(!L&&!N){p[x]=void 0;continue}if(!N||L&&R.oldPos<w.oldPos?T=this.addToPath(w,!0,!1,0,n):T=this.addToPath(R,!1,!0,1,n),m=this.extractCommon(T,r,e,x,n),T.oldPos+1>=l&&m+1>=o)return s(this.buildValues(T.lastComponent,r,e))||!0;p[x]=T,T.oldPos+1>=l&&(b=Math.min(b,x-1)),m+1>=o&&(y=Math.max(y,x+1))}u++};if(a)(function x(){setTimeout(function(){if(u>d||Date.now()>f)return a(void 0);E()||x()},0)})();else for(;u<=d&&Date.now()<=f;){const x=E();if(x)return x}}addToPath(e,r,n,a,i){const s=e.lastComponent;return s&&!i.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+a,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+a,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,a,i){const s=r.length,o=n.length;let l=e.oldPos,u=l-a,d=0;for(;u+1<s&&l+1<o&&this.equals(n[l+1],r[u+1],i);)u++,l++,d++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){const a=[];let i;for(;e;)a.push(e),i=e.previousComponent,delete e.previousComponent,e=i;a.reverse();const s=a.length;let o=0,l=0,u=0;for(;o<s;o++){const d=a[o];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=r.slice(l,l+d.count);h=h.map(function(f,p){const m=n[u+p];return m.length>f.length?m:f}),d.value=this.join(h)}else d.value=this.join(r.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}}return a}}class M6e extends L6e{constructor(){super(...arguments),this.tokenize=B6e}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
481
|
+
`).find(ie=>ie.startsWith("#")),re=Q?Q.replace(/^#+\s*/,"").trim():"Unknown Plan",Z=Yx(j.a);if(Z.length===0)return{success:!0,count:0,planTitle:re,error:"No annotations found in share link"};const le=Z.filter(ie=>!e.some(me=>me.originalText===ie.originalText&&me.type===ie.type&&me.text===ie.text));if(le.length>0&&(a(ie=>{const me=Z.filter(se=>!ie.some(J=>J.originalText===se.originalText&&J.type===se.type&&J.text===se.text));if(me.length===0)return ie;const ne=[...ie,...me];return A(ne),ne}),j.g?.length)){const ie=Zg(j.g)??[];i(me=>{const ne=new Set(me.map(J=>J.path)),se=ie.filter(J=>!ne.has(J.path));return se.length>0?[...me,...se]:me}),B(ie)}return{success:!0,count:le.length,planTitle:re}}catch(j){return{success:!1,count:0,planTitle:"",error:j instanceof Error?j.message:"Failed to decompress share URL"}}},[e,r,a,i,l]);return{isSharedSession:u,isLoadingShared:h,shareUrl:p,shareUrlSize:y,shortShareUrl:E,isGeneratingShortUrl:T,shortUrlError:w,pendingSharedAnnotations:N,sharedGlobalAttachments:I,clearPendingSharedAnnotations:Y,refreshShareUrl:P,generateShortUrl:U,importFromShareUrl:z,shareLoadError:M,clearShareLoadError:k}}function t6e(t,e){const[r,n]=Se.useState(null),a=Se.useRef(null);return Se.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 dW(t){window.close(),setTimeout(()=>{window.closed||t()},300)}function r6e(t){const[e,r]=Se.useState({phase:"idle"});Se.useEffect(()=>{if(!t)return;const a=$se();a==="0"?(dW(()=>r({phase:"closeFailed"})),r({phase:"closed"})):r(a!=="off"?{phase:"counting",remaining:Number(a)}:{phase:"prompt"})},[t]),Se.useEffect(()=>{if(e.phase!=="counting")return;if(e.remaining<=0){dW(()=>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=Se.useCallback(()=>{eoe("3"),r({phase:"counting",remaining:3})},[]);return{state:e,enableAndStart:n}}const n6e=()=>D.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),a6e=()=>D.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:D.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 i6e({submitted:t,title:e,subtitle:r,agentLabel:n}){const{state:a,enableAndStart:i}=r6e(!!t);if(!t)return null;const s=t==="approved";return D.jsx("div",{className:"fixed inset-0 z-[100] bg-background flex items-center justify-center",children:D.jsxs("div",{className:"text-center space-y-6 max-w-md px-8",children:[D.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?D.jsx(n6e,{}):D.jsx(a6e,{})}),D.jsxs("div",{className:"space-y-2",children:[D.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e}),D.jsx("p",{className:"text-muted-foreground",children:r})]}),D.jsx("div",{className:"pt-4 border-t border-border space-y-2",children:a.phase==="counting"?D.jsxs(D.Fragment,{children:[D.jsxs("p",{className:"text-sm text-muted-foreground",children:["This tab will close in ",D.jsx("span",{className:"text-foreground font-medium",children:a.remaining})," second",a.remaining!==1?"s":"","..."]}),D.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change this in Settings."})]}):a.phase==="closeFailed"?D.jsxs(D.Fragment,{children:[D.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not close this tab automatically. Please close it manually."}),D.jsxs("p",{className:"text-xs text-muted-foreground/60",children:["Auto-close works when the tab is opened by ",n,"."]})]}):D.jsxs(D.Fragment,{children:[D.jsxs("p",{className:"text-sm text-muted-foreground",children:["You can close this tab and return to ",D.jsx("span",{className:"text-foreground font-medium",children:n}),"."]}),a.phase==="prompt"?D.jsxs(D.Fragment,{children:[D.jsxs("label",{className:"flex items-center justify-center gap-2 cursor-pointer group",children:[D.jsx("input",{type:"checkbox",checked:!1,onChange:i,className:"accent-primary"}),D.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-foreground transition-colors",children:"Auto-close this tab after 3 seconds"})]}),D.jsx("p",{className:"text-xs text-muted-foreground/60",children:"You can change the delay in Settings."})]}):D.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Your response has been sent."})]})})]})})}const s6e="https://api.github.com/repos/backnotprop/plannotator/releases/latest",hW={"0.5.0":{title:"Code Review is here!",description:"Review git diffs with inline annotations. Run /plannotator-review to try it."}};function o6e(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 l6e(){const[t,e]=Se.useState(null);return Se.useEffect(()=>{(async()=>{try{const n="0.11.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:hW[f]});return}const s=await fetch(s6e);if(!s.ok)return;const o=await s.json(),l=o.tag_name,u=o6e(n,l),d=l.replace(/^v/,""),h=hW[d];e({currentVersion:n,latestVersion:l,updateAvailable:u,releaseUrl:o.html_url,featureHighlight:h})}catch(n){console.debug("Update check failed:",n)}})()},[]),t}const c6e="curl -fsSL https://plannotator.ai/install.sh | bash",u6e=({origin:t})=>{const e=l6e(),[r,n]=Se.useState(!1),[a,i]=Se.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(c6e),n(!0),setTimeout(()=>n(!1),2e3)}catch(f){console.error("Failed to copy:",f)}};return e.featureHighlight?D.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:D.jsxs("div",{className:"bg-card border border-primary/30 rounded-xl shadow-2xl overflow-hidden",children:[D.jsx("div",{className:"bg-gradient-to-r from-primary/20 to-primary/5 px-5 py-4 border-b border-border/50",children:D.jsxs("div",{className:"flex items-start justify-between gap-3",children:[D.jsxs("div",{className:"flex items-center gap-3",children:[D.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})})}),D.jsxs("div",{children:[D.jsx("h4",{className:"text-base font-semibold text-foreground",children:e.featureHighlight.title}),D.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["New in ",e.latestVersion]})]})]}),D.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors p-1",children:D.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),D.jsxs("div",{className:"px-5 py-4",children:[D.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:e.featureHighlight.description}),D.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:["You have ",e.currentVersion]}),u&&D.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"Run the install script, then restart OpenCode."}),D.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[D.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"}),D.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"})]})]})]})}):D.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:D.jsx("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4",children:D.jsxs("div",{className:"flex items-start gap-3",children:[D.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center",children:D.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})})}),D.jsxs("div",{className:"flex-1 min-w-0",children:[D.jsxs("div",{className:"flex items-center justify-between gap-2",children:[D.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Update available"}),D.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground transition-colors",children:D.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),D.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[e.latestVersion," is available (you have ",e.currentVersion,")"]}),D.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[D.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"}),D.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"})]})]})]})})})},Poe="plannotator-editor-mode",d6e="selection";function h6e(){const t=fr.getItem(Poe);return t==="selection"||t==="comment"||t==="redline"?t:d6e}function f6e(t){fr.setItem(Poe,t)}const Boe="plannotator-input-method",p6e="drag";function g6e(){const t=fr.getItem(Boe);return t==="drag"||t==="pinpoint"?t:p6e}function m6e(t){fr.setItem(Boe,t)}const v6e=300,y6e=300;function b6e(t,e){const r=Se.useRef("idle"),n=Se.useRef(0),a=Se.useRef(),i=Se.useRef(t);Se.useEffect(()=>{r.current==="idle"&&(i.current=t)},[t]);const s=Se.useCallback(o=>o==="drag"?"pinpoint":"drag",[]);Se.useEffect(()=>{const o=u=>{if(u.key!=="Alt"||u.repeat)return;const d=u.target?.tagName;d==="INPUT"||d==="TEXTAREA"||u.target?.isContentEditable||(r.current==="idle"?(i.current=t,n.current=Date.now(),r.current="held",e(s(t))):r.current==="tapped"&&(clearTimeout(a.current),r.current="idle",i.current=s(i.current)))},l=u=>{u.key==="Alt"&&r.current==="held"&&(Date.now()-n.current>=y6e?(e(i.current),r.current="idle"):(r.current="tapped",a.current=setTimeout(()=>{r.current==="tapped"&&(e(i.current),r.current="idle")},v6e)))};return window.addEventListener("keydown",o),window.addEventListener("keyup",l),()=>{clearTimeout(a.current),window.removeEventListener("keydown",o),window.removeEventListener("keyup",l)}},[t,e,s])}function fW({storageKey:t,defaultWidth:e=288,minWidth:r=200,maxWidth:n=600,side:a="right"}){const[i,s]=Se.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]=Se.useState(!1),u=Se.useRef(0),d=Se.useRef(0),h=Se.useRef(i),f=Se.useCallback(y=>{h.current=y,s(y)},[]),p=Se.useCallback(y=>{y.preventDefault(),u.current=y.clientX,d.current=h.current,l(!0)},[]);Se.useEffect(()=>{if(!o)return;const y=E=>{const x=a==="right"?u.current-E.clientX:E.clientX-u.current;f(Math.min(n,Math.max(r,d.current+x)))},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=Se.useCallback(()=>{f(e),fr.setItem(t,String(e))},[e,t,f]);return{width:i,isDragging:o,handleProps:{isDragging:o,onMouseDown:p,onDoubleClick:m}}}const pW=({isDragging:t,onMouseDown:e,onDoubleClick:r,className:n})=>D.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}`:""}`}),E6e=({isOpen:t,onComplete:e})=>{const[r,n]=Se.useState("acceptEdits");if(!t)return null;const a=()=>{Noe(r),e(r)};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.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"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"New: Permission Mode Preservation"})]}),D.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."}),D.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Requires Claude Code 2.1.7 or later. Run ",D.jsx("code",{className:"bg-muted px-1 rounded",children:"claude update"})," to update."]})]}),D.jsx("div",{className:"p-4 space-y-2",children:fM.map(i=>D.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:[D.jsx("input",{type:"radio",name:"permissionMode",value:i.value,checked:r===i.value,onChange:()=>n(i.value),className:"mt-0.5 accent-primary"}),D.jsxs("div",{className:"flex-1",children:[D.jsx("div",{className:"text-sm font-medium",children:i.label}),D.jsx("div",{className:"text-xs text-muted-foreground",children:i.description})]})]},i.value))}),D.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[D.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),D.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)},S6e="https://plannotator.ai/assets/toc-sticky-preview.png",x6e=({isOpen:t,onComplete:e})=>{const[r,n]=Se.useState(!0),[a,i]=Se.useState(!0),[s,o]=Se.useState(!0);if(!t)return null;const l=()=>{const u={tocEnabled:r,stickyActionsEnabled:a};Roe(u),BDe(),e(u)};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-lg shadow-2xl",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.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"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"New: Display Options"})]}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"We've added two features that help navigate larger plans."})]}),D.jsxs("div",{className:"p-4 space-y-4",children:[s&&D.jsx("img",{src:S6e,alt:"Table of Contents and Sticky Actions preview",className:"w-full rounded-lg border border-border",onError:()=>o(!1)}),D.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:[D.jsx("input",{type:"checkbox",checked:r,onChange:()=>n(!r),className:"mt-0.5 accent-primary"}),D.jsxs("div",{className:"flex-1",children:[D.jsx("div",{className:"text-sm font-medium",children:"Auto-open Sidebar"}),D.jsx("div",{className:"text-xs text-muted-foreground",children:"Open sidebar with Table of Contents on load"})]})]}),D.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:[D.jsx("input",{type:"checkbox",checked:a,onChange:()=>i(!a),className:"mt-0.5 accent-primary"}),D.jsxs("div",{className:"flex-1",children:[D.jsx("div",{className:"text-sm font-medium",children:"Sticky Actions"}),D.jsx("div",{className:"text-xs text-muted-foreground",children:"Keep action buttons visible while scrolling"})]})]})]}),D.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[D.jsx("p",{className:"text-xs text-muted-foreground",children:"You can change this later in Settings."}),D.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)},Foe="plannotator-plan-diff-marketing-seen";function h4(){return fr.getItem(Foe)!=="true"}function T6e(){fr.setItem(Foe,"true")}const C6e="https://plannotator.ai/assets/plan-diff-preview.png",R6e="https://github.com/backnotprop/plannotator/issues",w6e={"claude-code":"https://youtu.be/uIWkFCg60Lk",opencode:"https://youtu.be/uIWkFCg60Lk",pi:"https://youtu.be/uIWkFCg60Lk"},A6e="https://youtu.be/uIWkFCg60Lk",N6e=({isOpen:t,origin:e,onComplete:r})=>{const[n,a]=Se.useState(!1),i=e&&w6e[e]||A6e;if(!t)return null;const s=()=>{T6e(),r()};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-2xl shadow-2xl max-h-full flex flex-col",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"New: Plan Diff Mode"})]}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"See exactly what changed when a coding agent revises your plan."})]}),D.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto min-h-0",children:[n?D.jsx("div",{className:"w-full aspect-[16/7] rounded-lg border border-border bg-muted/50 flex items-center justify-center",children:D.jsxs("div",{className:"text-center text-muted-foreground",children:[D.jsx("svg",{className:"w-8 h-8 mx-auto mb-2 opacity-40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.41a2.25 2.25 0 013.182 0l2.909 2.91m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),D.jsx("p",{className:"text-xs",children:"Plan Diff screenshot"})]})}):D.jsx("img",{src:C6e,alt:"Plan Diff Mode preview showing visual and raw diff views",className:"w-full rounded-lg border border-border",onError:()=>a(!0)}),D.jsxs("div",{className:"space-y-3 text-sm text-foreground/90",children:[D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-success mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Two view modes"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— a rendered visual diff with color-coded borders for quick scanning, and a raw markdown diff for precision."})]})]}),D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Version history"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— compare against any previous version from the sidebar. Plans are automatically versioned as your agent iterates."})]})]})]}),D.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50 hover:bg-muted border border-transparent hover:border-border transition-all group",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/10 group-hover:bg-primary/20 transition-colors",children:D.jsx("svg",{className:"w-4 h-4 text-primary",fill:"currentColor",viewBox:"0 0 24 24",children:D.jsx("path",{d:"M8 5v14l11-7z"})})}),D.jsx("span",{className:"text-sm font-medium text-foreground/90",children:"Watch Video Demo of Plan Diff"}),D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})})]}),D.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This is the first release of Plan Diff — rough edges are expected, especially around plan name matching across sessions. If something feels off or you have ideas, open an"," ",D.jsx("a",{href:R6e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"issue"}),". Let's make this better together."]})]}),D.jsx("div",{className:"p-4 border-t border-border flex justify-end",children:D.jsx("button",{onClick:s,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Got it"})})]})}),document.body)},_oe="plannotator-whats-new-v011-seen";function SS(){return fr.getItem(_oe)!=="true"}function O6e(){fr.setItem(_oe,"true")}const gW={v0100:"https://github.com/backnotprop/plannotator/releases/tag/v0.10.0",v0110:"https://github.com/backnotprop/plannotator/releases/tag/v0.11.0"},I6e=({isOpen:t,onComplete:e})=>{if(!t)return null;const r=()=>{O6e(),e()};return gc.createPortal(D.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background/90 backdrop-blur-sm p-4",children:D.jsxs("div",{className:"bg-card border border-border rounded-xl w-full max-w-2xl shadow-2xl max-h-full flex flex-col",children:[D.jsxs("div",{className:"p-5 border-b border-border",children:[D.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[D.jsx("div",{className:"p-1.5 rounded-lg bg-primary/15",children:D.jsx("svg",{className:"w-5 h-5 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456z"})})}),D.jsx("h3",{className:"font-semibold text-base",children:"What's New in Plannotator"})]}),D.jsx("p",{className:"text-sm text-muted-foreground",children:"Here's what's been added since your last update."})]}),D.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto min-h-0",children:[D.jsxs("div",{className:"space-y-3 text-sm text-foreground/90",children:[D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-success mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Auto-save annotation drafts"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— Your annotations are now automatically saved in the background. If the browser refreshes or the server crashes, you'll be prompted to restore your work. Sorry it took so long to implement this."})]})]}),D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Short link sharing"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— Share plans with shorter, more portable links that work across Slack and other platforms, with end-to-end encryption. Currently enabled for large plans that don't fit in the URL; we'll be rolling this out as the default soon."})]})]}),D.jsxs("div",{className:"flex gap-2.5",children:[D.jsx("div",{className:"shrink-0 mt-0.5",children:D.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-warning mt-1.5"})}),D.jsxs("p",{children:[D.jsx("span",{className:"font-medium",children:"Obsidian vault browser"})," ",D.jsx("span",{className:"text-muted-foreground",children:"— For Obsidian users, we're building deeper integrations starting with the vault browser. Browse and annotate vault files directly during plan review. Toggle it on under Settings > Saving > Obsidian."})]})]})]}),D.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["Plus many more improvements and bug fixes. See the full release notes:"," ",D.jsx("a",{href:gW.v0100,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"v0.10.0"}),", ",D.jsx("a",{href:gW.v0110,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-2 hover:text-primary/80",children:"v0.11.0"})]})]}),D.jsx("div",{className:"p-4 border-t border-border flex justify-end",children:D.jsx("button",{onClick:r,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-opacity",children:"Got it"})})]})}),document.body)};function k6e(t){const[e,r]=Se.useState(t),[n,a]=Se.useState("toc"),i=Se.useCallback(l=>{r(!0),l&&a(l)},[]),s=Se.useCallback(()=>{r(!1)},[]),o=Se.useCallback(l=>{e?n===l?r(!1):a(l):(r(!0),a(l))},[e,n]);return{isOpen:e,activeTab:n,open:i,close:s,toggleTab:o}}class L6e{diff(e,r,n={}){let a;typeof n=="function"?(a=n,n={}):"callback"in n&&(a=n.callback);const i=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(i,n)),l=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,l,n,a)}diffWithOptionsObj(e,r,n,a){var i;const s=x=>{if(x=this.postProcess(x,n),a){setTimeout(function(){a(x)},0);return}else return x},o=r.length,l=e.length;let u=1,d=o+l;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));const h=(i=n.timeout)!==null&&i!==void 0?i:1/0,f=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(p[0],r,e,0,n);if(p[0].oldPos+1>=l&&m+1>=o)return s(this.buildValues(p[0].lastComponent,r,e));let y=-1/0,b=1/0;const E=()=>{for(let x=Math.max(y,-u);x<=Math.min(b,u);x+=2){let T;const R=p[x-1],w=p[x+1];R&&(p[x-1]=void 0);let L=!1;if(w){const A=w.oldPos-x;L=w&&0<=A&&A<o}const N=R&&R.oldPos+1<l;if(!L&&!N){p[x]=void 0;continue}if(!N||L&&R.oldPos<w.oldPos?T=this.addToPath(w,!0,!1,0,n):T=this.addToPath(R,!1,!0,1,n),m=this.extractCommon(T,r,e,x,n),T.oldPos+1>=l&&m+1>=o)return s(this.buildValues(T.lastComponent,r,e))||!0;p[x]=T,T.oldPos+1>=l&&(b=Math.min(b,x-1)),m+1>=o&&(y=Math.max(y,x+1))}u++};if(a)(function x(){setTimeout(function(){if(u>d||Date.now()>f)return a(void 0);E()||x()},0)})();else for(;u<=d&&Date.now()<=f;){const x=E();if(x)return x}}addToPath(e,r,n,a,i){const s=e.lastComponent;return s&&!i.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+a,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+a,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,a,i){const s=r.length,o=n.length;let l=e.oldPos,u=l-a,d=0;for(;u+1<s&&l+1<o&&this.equals(n[l+1],r[u+1],i);)u++,l++,d++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,n){const a=[];let i;for(;e;)a.push(e),i=e.previousComponent,delete e.previousComponent,e=i;a.reverse();const s=a.length;let o=0,l=0,u=0;for(;o<s;o++){const d=a[o];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=r.slice(l,l+d.count);h=h.map(function(f,p){const m=n[u+p];return m.length>f.length?m:f}),d.value=this.join(h)}else d.value=this.join(r.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}}return a}}class M6e extends L6e{constructor(){super(...arguments),this.tokenize=B6e}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
482
482
|
`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
|
|
483
483
|
`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
484
484
|
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
|
@@ -805,7 +805,7 @@ export const CursorOverlay: React.FC<CursorOverlayProps> = ({
|
|
|
805
805
|
---
|
|
806
806
|
|
|
807
807
|
**Target:** Ship MVP in next sprint
|
|
808
|
-
`,d9e=()=>{const[t,e]=Se.useState(u9e),[r,n]=Se.useState([]),[a,i]=Se.useState(null),[s,o]=Se.useState([]),[l,u]=Se.useState(null),[d,h]=Se.useState(!1),[f,p]=Se.useState(!1),[m,y]=Se.useState(!1),[b,E]=Se.useState(!1),[x,T]=Se.useState(!1),[R,w]=Se.useState(""),[L,N]=Se.useState(!0),[A,I]=Se.useState(h6e),[B,M]=Se.useState(g6e),[F,Y]=Se.useState(()=>fr.getItem("plannotator-tater-mode")==="true"),[k,_]=Se.useState(()=>hM()),[P,U]=Se.useState(!1),[z,q]=Se.useState(null),[j,G]=Se.useState([]),[W,Q]=Se.useState(!1),[re,Z]=Se.useState(!0),[le,ie]=Se.useState(!1),[me,ne]=Se.useState(null),[se,J]=Se.useState(null),[$,ue]=Se.useState(!1),[oe,we]=Se.useState(!1),[de,Ve]=Se.useState(!1),[te,tt]=Se.useState(!1),[xe,Be]=Se.useState("bypassPermissions"),[qe,He]=Se.useState(!0),[Oe,Ze]=Se.useState(void 0),[ke,Fe]=Se.useState(void 0),[$e,Ae]=Se.useState(null),[je,ce]=Se.useState(!1),[Ee,K]=Se.useState(),[ge,he]=Se.useState(null),[Te,Re]=Se.useState(!1),[De,Ye]=Se.useState("clean"),[Ie,Qe]=Se.useState(null),[vt,pt]=Se.useState(null),ye=Se.useRef(null),_e=Se.useRef(null),Me=fW({storageKey:"plannotator-panel-width"}),rt=fW({storageKey:"plannotator-toc-width",defaultWidth:240,minWidth:160,maxWidth:400,side:"left"}),Nt=Me.isDragging||rt.isDragging,mt=k6e(hM().tocEnabled);Se.useEffect(()=>{k.tocEnabled?mt.open("toc"):mt.close()},[k.tocEnabled]),Se.useEffect(()=>{mt.activeTab==="toc"&&Te&&Re(!1)},[mt.activeTab]),Se.useEffect(()=>{if(!Te)return;const ft=Kt=>{Kt.key==="Escape"&&Re(!1)};return document.addEventListener("keydown",ft),()=>document.removeEventListener("keydown",ft)},[Te]);const We=_6e(t,Ie,vt),it=U6e({markdown:t,annotations:r,selectedAnnotationId:a,globalAttachments:j,setMarkdown:e,setAnnotations:n,setSelectedAnnotationId:i,setGlobalAttachments:G,viewerRef:ye,sidebar:mt}),Je=z6e(),yt=Se.useMemo(()=>pDe(),[k]),bt=Se.useMemo(()=>{if(!yt)return"";const ft=Ld();return Af(ft)},[yt,k]);Se.useEffect(()=>{yt||Je.setActiveFile(null)},[yt]),Se.useEffect(()=>{mt.activeTab==="vault"&&yt&&bt&&Je.tree.length===0&&!Je.isLoading&&Je.fetchTree(bt)},[mt.activeTab,yt,bt]);const kt=Sd.useCallback(ft=>Kt=>`/api/reference/obsidian/doc?vaultPath=${encodeURIComponent(ft)}&path=${encodeURIComponent(Kt)}`,[]),It=Sd.useCallback(ft=>{it.open(ft,kt(bt)),Je.setActiveFile(ft)},[bt,it,Je,kt]),Gt=Sd.useCallback(ft=>{Je.activeFile&&bt?it.open(ft,kt(bt)):it.open(ft)},[Je.activeFile,bt,it,kt]),mr=Sd.useCallback(()=>{it.back(),Je.setActiveFile(null)},[it,Je]),Vt=Sd.useCallback(()=>{Je.fetchTree(bt)},[Je,bt]),hr=Se.useMemo(()=>s.filter(ft=>ft.type==="heading").length,[s]),Gr=t6e(_e,hr),{isSharedSession:Sr,isLoadingShared:lr,shareUrl:_r,shareUrlSize:Rn,shortShareUrl:Pt,isGeneratingShortUrl:Ue,shortUrlError:xt,pendingSharedAnnotations:Ut,clearPendingSharedAnnotations:kr,generateShortUrl:Qr,importFromShareUrl:ur,shareLoadError:dn,clearShareLoadError:Yn}=e6e(t,r,j,e,n,G,()=>{Z(!1)},Oe,ke),{draftBanner:Xr,restoreDraft:Rt,dismissDraft:dt}=V6e({annotations:r,globalAttachments:j,isApiMode:P,isSharedSession:Sr,submitted:!!me}),{editorAnnotations:Tt,deleteEditorAnnotation:Et}=H6e(),ht=Sd.useCallback(()=>{const{annotations:ft,globalAttachments:Kt}=Rt();ft.length>0&&(n(ft),Kt.length>0&&G(Kt),setTimeout(()=>{ye.current?.applySharedAnnotations(ft)},100))},[Rt]),{getAgentWarning:$t}=koe(z);Se.useEffect(()=>{if(Ut&&Ut.length>0){const ft=setTimeout(()=>{ye.current?.clearAllHighlights(),ye.current?.applySharedAnnotations(Ut),kr()},100);return()=>clearTimeout(ft)}},[Ut,kr]);const Ce=ft=>{Y(ft),fr.setItem("plannotator-tater-mode",String(ft))},Wn=ft=>{I(ft),f6e(ft)},Ne=ft=>{M(ft),m6e(ft)};b6e(B,Ne),Se.useEffect(()=>{lr||Sr||fetch("/api/plan").then(ft=>{if(!ft.ok)throw new Error("Not in API mode");return ft.json()}).then(ft=>{ft.plan&&e(ft.plan),U(!0),ft.mode==="annotate"&&Q(!0),ft.sharingEnabled!==void 0&&He(ft.sharingEnabled),ft.shareBaseUrl&&Ze(ft.shareBaseUrl),ft.pasteApiUrl&&Fe(ft.pasteApiUrl),ft.repoInfo&&Ae(ft.repoInfo),ft.previousPlan!==void 0&&Qe(ft.previousPlan),ft.versionInfo&&pt(ft.versionInfo),ft.origin&&(q(ft.origin),ft.origin==="claude-code"&&_De()?ue(!0):oW()?we(!0):h4()?Ve(!0):SS()&&tt(!0),Be(Aoe().mode))}).catch(()=>{U(!1)}).finally(()=>Z(!1))},[lr,Sr]),Se.useEffect(()=>{const{frontmatter:ft}=V$(t);u(ft),o(q$(t))},[t]);const Or=Se.useRef(!1);Se.useEffect(()=>{if(!P||!t||Sr||W||Or.current)return;const ft=Ld();if(!ft.autoSave||!ft.enabled)return;const Kt=Af(ft);if(!Kt)return;Or.current=!0;const Ir={obsidian:{vaultPath:Kt,folder:ft.folder||"plannotator",plan:t,...ft.filenameFormat&&{filenameFormat:ft.filenameFormat},...ft.filenameSeparator&&ft.filenameSeparator!=="space"&&{filenameSeparator:ft.filenameSeparator}}};fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ir)}).then(Rr=>Rr.json()).then(Rr=>{Rr.results?.obsidian?.success?he({type:"success",message:"Auto-saved to Obsidian"}):he({type:"error",message:"Auto-save to Obsidian failed"})}).catch(()=>{he({type:"error",message:"Auto-save to Obsidian failed"})}).finally(()=>setTimeout(()=>he(null),3e3))},[P,t,Sr,W]),Se.useEffect(()=>{const ft=Kt=>{const Ir=Kt.clipboardData?.items;if(Ir){for(const Rr of Ir)if(Rr.type.startsWith("image/")){Kt.preventDefault();const Ot=Rr.getAsFile();if(Ot){const zt=eL(Ot.name,j.map(zr=>zr.name)),br=URL.createObjectURL(Ot);J({file:Ot,blobUrl:br,initialName:zt})}break}}};return document.addEventListener("paste",ft),()=>document.removeEventListener("paste",ft)},[j]);const xo=async(ft,Kt,Ir)=>{if(se)try{const Rr=new FormData,Ot=Kt?new File([ft],"annotated.png",{type:"image/png"}):se.file;Rr.append("file",Ot);const zt=await fetch("/api/upload",{method:"POST",body:Rr});if(zt.ok){const br=await zt.json();G(zr=>[...zr,{path:br.path,name:Ir}])}}catch{}finally{URL.revokeObjectURL(se.blobUrl),J(null)}},To=()=>{se&&(URL.revokeObjectURL(se.blobUrl),J(null))},zi=async()=>{ie(!0);try{const ft=Ld(),Kt=_g(),Ir=N9(),Rr=dM(),Ot={};z==="claude-code"&&(Ot.permissionMode=xe);const zt=DDe(Ir);zt&&(Ot.agentSwitch=zt),Ot.planSave={enabled:Rr.enabled,...Rr.customPath&&{customPath:Rr.customPath}};const br=Af(ft);ft.enabled&&br&&(Ot.obsidian={vaultPath:br,folder:ft.folder||"plannotator",plan:t,...ft.filenameFormat&&{filenameFormat:ft.filenameFormat},...ft.filenameSeparator&&ft.filenameSeparator!=="space"&&{filenameSeparator:ft.filenameSeparator}}),Kt.enabled&&(Ot.bear={plan:t});const zr=Array.from(it.getDocAnnotations().values()).some(Ln=>Ln.annotations.length>0||Ln.globalAttachments.length>0);(r.length>0||j.length>0||zr||Tt.length>0)&&(Ot.feedback=tr),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ot)}),ne("approved")}catch{ie(!1)}},Co=async()=>{ie(!0);try{const ft=dM();await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:tr,planSave:{enabled:ft.enabled,...ft.customPath&&{customPath:ft.customPath}}})}),ne("denied")}catch{ie(!1)}},jn=async()=>{ie(!0);try{await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:tr,annotations:r})}),ne("denied")}catch{ie(!1)}};Se.useEffect(()=>{const ft=Kt=>{if(Kt.key!=="Enter"||!(Kt.metaKey||Kt.ctrlKey))return;const Ir=Kt.target?.tagName;if(!(Ir==="INPUT"||Ir==="TEXTAREA")&&!(d||f||m||b||x||$||oe||de||te||se)&&!(me||le)&&P&&!it.isActive){if(Kt.preventDefault(),W){r.length===0?y(!0):jn();return}if(r.length===0&&Tt.length===0){if(z==="opencode"){const Rr=$t();if(Rr){w(Rr),T(!0);return}}zi()}else Co()}};return window.addEventListener("keydown",ft),()=>window.removeEventListener("keydown",ft)},[d,f,m,b,x,$,oe,de,te,se,me,le,P,it.isActive,r.length,W,z,$t]);const ea=ft=>{n(Kt=>[...Kt,ft]),i(ft.id),N(!0)},Ro=ft=>{ye.current?.removeHighlight(ft),n(Kt=>Kt.filter(Ir=>Ir.id!==ft)),a===ft&&i(null)},ws=(ft,Kt)=>{n(Ir=>Ir.map(Rr=>Rr.id===ft?{...Rr,...Kt}:Rr))},wo=(ft,Kt)=>{n(Ir=>Ir.map(Rr=>Rr.author===ft?{...Rr,author:Kt}:Rr))},pa=ft=>{G(Kt=>[...Kt,ft])},ol=ft=>{G(Kt=>Kt.filter(Ir=>Ir.path!==ft))},ta=ft=>{},tr=Se.useMemo(()=>{const ft=it.getDocAnnotations(),Kt=Array.from(ft.values()).some(zt=>zt.annotations.length>0||zt.globalAttachments.length>0),Ir=r.length>0||j.length>0,Rr=Tt.length>0;if(!Ir&&!Kt&&!Rr)return"No changes detected.";let Ot=Ir?l1e(s,r,j):"";return Kt&&(Ot+=c1e(ft)),Rr&&(Ot+=u1e(Tt)),Ot},[s,r,j,it.getDocAnnotations,Tt]),Ea=()=>{ce(!1);const ft=new Blob([tr],{type:"text/plain"}),Kt=URL.createObjectURL(ft),Ir=document.createElement("a");Ir.href=Kt,Ir.download="annotations.md",Ir.click(),URL.revokeObjectURL(Kt),he({type:"success",message:"Downloaded annotations"}),setTimeout(()=>he(null),3e3)},Tn=async ft=>{ce(!1);const Kt={};if(ft==="obsidian"){const Ir=Ld(),Rr=Af(Ir);Rr&&(Kt.obsidian={vaultPath:Rr,folder:Ir.folder||"plannotator",plan:t,...Ir.filenameFormat&&{filenameFormat:Ir.filenameFormat},...Ir.filenameSeparator&&Ir.filenameSeparator!=="space"&&{filenameSeparator:Ir.filenameSeparator}})}ft==="bear"&&(Kt.bear={plan:t});try{const Ot=(await(await fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Kt)})).json()).results?.[ft];Ot?.success?he({type:"success",message:`Saved to ${ft==="obsidian"?"Obsidian":"Bear"}`}):he({type:"error",message:Ot?.error||"Save failed"})}catch{he({type:"error",message:"Save failed"})}setTimeout(()=>he(null),3e3)};Se.useEffect(()=>{const ft=Kt=>{if(Kt.key!=="s"||!(Kt.metaKey||Kt.ctrlKey))return;const Ir=Kt.target?.tagName;if(Ir==="INPUT"||Ir==="TEXTAREA"||d||m||b||x||$||oe||de||te||se||me||!P)return;Kt.preventDefault();const Rr=Ioe(),Ot=l4(),zt=_g().enabled;Rr==="download"?Ea():Rr==="obsidian"&&Ot?Tn("obsidian"):Rr==="bear"&&zt?Tn("bear"):(K("notes"),h(!0))};return window.addEventListener("keydown",ft),()=>window.removeEventListener("keydown",ft)},[d,m,b,x,$,oe,de,te,se,me,P,t,tr]),Se.useEffect(()=>{if(!je)return;const ft=Kt=>{Kt.target.closest("[data-export-dropdown]")||ce(!1)};return document.addEventListener("mousedown",ft),()=>document.removeEventListener("mousedown",ft)},[je]);const Dr=Se.useMemo(()=>z==="opencode"?"OpenCode":z==="claude-code"?"Claude Code":z==="pi"?"Pi":"Coding Agent",[z]);return D.jsx(yDe,{defaultTheme:"dark",children:D.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[F&&D.jsx(IDe,{}),D.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:[D.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[D.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:D.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),D.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.11.2"]}),z&&D.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline ${z==="claude-code"?"bg-orange-500/15 text-orange-400":z==="pi"?"bg-violet-500/15 text-violet-400":"bg-zinc-500/20 text-zinc-400"}`,children:Dr})]}),D.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[P&&!it.isActive&&D.jsxs(D.Fragment,{children:[D.jsxs("button",{onClick:()=>{r.length===0&&Tt.length===0?y(!0):W?jn():Co()},disabled:le,className:`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all ${le?"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:[D.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})}),D.jsx("span",{className:"hidden md:inline",children:le?"Sending...":W?"Send Annotations":"Send Feedback"})]}),!W&&D.jsxs("div",{className:"relative group/approve",children:[D.jsxs("button",{onClick:()=>{if(z==="claude-code"&&r.length>0){E(!0);return}if(z==="opencode"){const ft=$t();if(ft){w(ft),T(!0);return}}zi()},disabled:le,className:`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all ${le?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":z==="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:[D.jsx("span",{className:"md:hidden",children:le?"...":"OK"}),D.jsx("span",{className:"hidden md:inline",children:le?"Approving...":"Approve"})]}),z==="claude-code"&&r.length>0&&D.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:[D.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),D.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),Dr," doesn't support feedback on approval. Your annotations won't be seen."]})]}),D.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),D.jsx(EDe,{}),!it.isActive&&D.jsx(jDe,{taterMode:F,onTaterModeChange:Ce,onIdentityChange:wo,origin:z,onUIPreferencesChange:_}),D.jsx("button",{onClick:()=>N(!L),className:`p-1.5 rounded-md text-xs font-medium transition-all ${L?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:D.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})})}),D.jsxs("div",{className:"relative flex","data-export-dropdown":!0,children:[D.jsxs("button",{onClick:()=>{K(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:[D.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})}),D.jsx("span",{className:"hidden md:inline",children:"Export"})]}),D.jsx("button",{onClick:()=>ce(ft=>!ft),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:D.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),je&&D.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:[qe&&D.jsxs("button",{onClick:async()=>{ce(!1);try{await navigator.clipboard.writeText(_r),he({type:"success",message:"Share link copied"})}catch{he({type:"error",message:"Failed to copy"})}setTimeout(()=>he(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:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"]}),D.jsxs("button",{onClick:Ea,className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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 Annotations"]}),P&&l4()&&D.jsxs("button",{onClick:()=>Tn("obsidian"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Obsidian"]}),P&&_g().enabled&&D.jsxs("button",{onClick:()=>Tn("bear"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Bear"]}),P&&!l4()&&!_g().enabled&&D.jsx("div",{className:"px-3 py-2 text-[10px] text-muted-foreground",children:"No notes apps configured."}),qe&&D.jsxs(D.Fragment,{children:[D.jsx("div",{className:"my-1 border-t border-border"}),D.jsxs("button",{onClick:()=>{ce(!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:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"]})]})]})]})]})]}),it.error&&D.jsxs("div",{className:"bg-destructive/10 border-b border-destructive/20 px-4 py-2 flex items-center gap-2 flex-shrink-0",children:[D.jsx("span",{className:"text-xs text-destructive",children:it.error}),D.jsx("button",{onClick:it.dismissError,className:"ml-auto text-xs text-destructive/60 hover:text-destructive",children:"dismiss"})]}),D.jsxs("div",{className:`flex-1 flex overflow-hidden ${Nt?"select-none":""}`,children:[!mt.isOpen&&D.jsx(W6e,{activeTab:mt.activeTab,onToggleTab:mt.toggleTab,hasDiff:We.hasPreviousVersion,showVaultTab:yt,className:"hidden lg:flex"}),mt.isOpen&&D.jsxs(D.Fragment,{children:[D.jsx($6e,{activeTab:mt.activeTab,onTabChange:mt.toggleTab,onClose:mt.close,width:rt.width,blocks:s,annotations:r,activeSection:Gr,onTocNavigate:ta,linkedDocFilepath:it.filepath,onLinkedDocBack:it.isActive?mr:void 0,showVaultTab:yt,vaultPath:bt,vaultBrowser:Je,onVaultSelectFile:It,onVaultFetchTree:Vt,versionInfo:vt,versions:We.versions,projectPlans:We.projectPlans,selectedBaseVersion:We.diffBaseVersion,onSelectBaseVersion:We.selectBaseVersion,isPlanDiffActive:Te,hasPreviousVersion:We.hasPreviousVersion,onActivatePlanDiff:()=>Re(!0),isLoadingVersions:We.isLoadingVersions,isSelectingVersion:We.isSelectingVersion,fetchingVersion:We.fetchingVersion,onFetchVersions:We.fetchVersions,onFetchProjectPlans:We.fetchProjectPlans}),D.jsx(pW,{...rt.handleProps,className:"hidden lg:block"})]}),D.jsxs("main",{ref:_e,className:"flex-1 min-w-0 overflow-y-auto bg-grid",children:[D.jsx(Sv,{isOpen:!!Xr,onClose:dt,onConfirm:ht,title:"Draft Recovered",message:Xr?`Found ${Xr.count} annotation${Xr.count!==1?"s":""} from ${Xr.timeAgo}. Would you like to restore them?`:"",confirmText:"Restore",cancelText:"Dismiss",showCancel:!0}),D.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:[!Te&&D.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex items-center justify-start",children:D.jsx(CDe,{inputMethod:B,onInputMethodChange:Ne,mode:A,onModeChange:Wn,taterMode:F})}),Te&&We.diffBlocks&&We.diffStats?D.jsx(c9e,{diffBlocks:We.diffBlocks,diffStats:We.diffStats,diffMode:De,onDiffModeChange:Ye,onPlanDiffToggle:()=>Re(!1),repoInfo:$e,baseVersionLabel:We.diffBaseVersion!=null?`v${We.diffBaseVersion}`:void 0,baseVersion:We.diffBaseVersion??void 0}):D.jsx(iDe,{ref:ye,blocks:s,markdown:t,frontmatter:l,annotations:r,onAddAnnotation:ea,onSelectAnnotation:i,selectedAnnotationId:a,mode:A,inputMethod:B,taterMode:F,globalAttachments:j,onAddGlobalAttachment:pa,onRemoveGlobalAttachment:ol,repoInfo:$e,stickyActions:k.stickyActionsEnabled,planDiffStats:it.isActive?null:We.diffStats,isPlanDiffActive:Te,onPlanDiffToggle:()=>Re(!Te),hasPreviousVersion:!it.isActive&&We.hasPreviousVersion,showDemoBadge:!P&&!lr&&!Sr,onOpenLinkedDoc:Gt,linkedDocInfo:it.isActive?{filepath:it.filepath,onBack:mr,label:Je.activeFile?"Vault File":void 0}:null},it.isActive?`doc:${it.filepath}`:"plan")]})]}),L&&D.jsx(pW,{...Me.handleProps}),D.jsx(cDe,{isOpen:L,blocks:s,annotations:r,selectedId:a,onSelect:i,onDelete:Ro,onEdit:ws,shareUrl:_r,sharingEnabled:qe,width:Me.width,editorAnnotations:Tt,onDeleteEditorAnnotation:Et})]}),D.jsx(mDe,{isOpen:d,onClose:()=>{h(!1),K(void 0)},shareUrl:_r,shareUrlSize:Rn,shortShareUrl:Pt,isGeneratingShortUrl:Ue,shortUrlError:xt,onGenerateShortUrl:Qr,annotationsOutput:tr,annotationCount:r.length,taterSprite:F?D.jsx(A9,{}):void 0,sharingEnabled:qe,markdown:t,isApiMode:P,initialTab:Ee}),D.jsx(vDe,{isOpen:f,onClose:()=>p(!1),onImport:ur,shareBaseUrl:Oe}),D.jsx(Sv,{isOpen:m,onClose:()=>y(!1),title:"Add Annotations First",message:`To provide feedback, select text in the plan and add annotations. ${Dr} will use your annotations to revise the plan.`,variant:"info"}),D.jsx(Sv,{isOpen:b,onClose:()=>E(!1),onConfirm:()=>{E(!1),zi()},title:"Annotations Won't Be Sent",message:D.jsxs(D.Fragment,{children:[Dr," doesn't yet support feedback on approval. Your ",r.length," annotation",r.length!==1?"s":""," will be lost."]}),subMessage:D.jsxs(D.Fragment,{children:["To send feedback, use ",D.jsx("strong",{children:"Send Feedback"})," instead.",D.jsx("br",{}),D.jsx("br",{}),"Want this feature? Upvote these issues:",D.jsx("br",{}),D.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/16001",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#16001"})," · ",D.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}),D.jsx(Sv,{isOpen:x,onClose:()=>T(!1),onConfirm:()=>{T(!1),zi()},title:"Agent Not Found",message:R,subMessage:D.jsxs(D.Fragment,{children:["You can change the agent in ",D.jsx("strong",{children:"Settings"}),", or approve anyway and OpenCode will use the default agent."]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),D.jsx(Sv,{isOpen:!!dn&&!P,onClose:Yn,title:"Shared Plan Could Not Be Loaded",message:dn,subMessage:"You are viewing a demo plan. This is sample content — it is not your data or anyone else's.",variant:"warning"}),ge&&D.jsx("div",{className:`fixed top-16 right-4 z-50 px-3 py-2 rounded-lg text-xs font-medium shadow-lg transition-opacity ${ge.type==="success"?"bg-success/15 text-success border border-success/30":"bg-destructive/15 text-destructive border border-destructive/30"}`,children:ge.message}),D.jsx(i6e,{submitted:me,title:me==="approved"?"Plan Approved":W?"Annotations Sent":"Feedback Sent",subtitle:me==="approved"?`${Dr} will proceed with the implementation.`:W?`${Dr} will address your annotations on the file.`:`${Dr} will revise the plan based on your annotations.`,agentLabel:Dr}),D.jsx(u6e,{origin:z}),D.jsx(K$,{isOpen:!!se,imageSrc:se?.blobUrl??"",initialName:se?.initialName,onAccept:xo,onClose:To}),D.jsx(E6e,{isOpen:$,onComplete:ft=>{Be(ft),ue(!1),oW()?we(!0):h4()?Ve(!0):SS()&&tt(!0)}}),D.jsx(x6e,{isOpen:oe,onComplete:ft=>{_(ft),we(!1),h4()?Ve(!0):SS()&&tt(!0)}}),D.jsx(N6e,{isOpen:de,origin:z,onComplete:()=>{Ve(!1),SS()&&tt(!0)}}),D.jsx(I6e,{isOpen:te,onComplete:()=>{tt(!1)}})]})})},Goe=document.getElementById("root");if(!Goe)throw new Error("Could not find root element to mount to");const h9e=o1e.createRoot(Goe);h9e.render(D.jsx(Sd.StrictMode,{children:D.jsx(d9e,{})}));class Ps{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 Ps(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class co{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 co(r,Ps.range(this,e))}}class _t{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__=_t.prototype,h.position=a,a!=null&&i!=null&&(h.length=i-a),h.rawMessage=e,h}}_t.prototype.__proto__=Error.prototype;var f9e=function(e,r){return e===void 0?r:e},p9e=/([A-Z])/g,g9e=function(e){return e.replace(p9e,"-$1").toLowerCase()},m9e={"&":"&",">":">","<":"<",'"':""","'":"'"},v9e=/[&><"']/g;function y9e(t){return String(t).replace(v9e,e=>m9e[e])}var Yoe=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},b9e=function(e){var r=Yoe(e);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},E9e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},S9e=function(e){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},En={deflt:f9e,escape:y9e,hyphenate:g9e,getBaseElem:Yoe,isCharacterBox:b9e,protocolFromUrl:S9e},H1={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 x9e(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 L9{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 H1)if(H1.hasOwnProperty(r)){var n=H1[r];this[r]=e[r]!==void 0?n.processor?n.processor(e[r]):e[r]:x9e(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 _t("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=En.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 md{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 nc[T9e[this.id]]}sub(){return nc[C9e[this.id]]}fracNum(){return nc[R9e[this.id]]}fracDen(){return nc[w9e[this.id]]}cramp(){return nc[A9e[this.id]]}text(){return nc[N9e[this.id]]}isTight(){return this.size>=2}}var M9=0,N2=1,Jg=2,bu=3,Ty=4,jo=5,Rm=6,fs=7,nc=[new md(M9,0,!1),new md(N2,0,!0),new md(Jg,1,!1),new md(bu,1,!0),new md(Ty,2,!1),new md(jo,2,!0),new md(Rm,3,!1),new md(fs,3,!0)],T9e=[Ty,jo,Ty,jo,Rm,fs,Rm,fs],C9e=[jo,jo,jo,jo,fs,fs,fs,fs],R9e=[Jg,bu,Ty,jo,Rm,fs,Rm,fs],w9e=[bu,bu,jo,jo,fs,fs,fs,fs],A9e=[N2,N2,bu,bu,jo,jo,fs,fs],N9e=[M9,N2,Jg,bu,Jg,bu,Jg,bu],Tr={DISPLAY:nc[M9],TEXT:nc[Jg],SCRIPT:nc[Ty],SCRIPTSCRIPT:nc[Rm]},pM=[{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 O9e(t){for(var e=0;e<pM.length;e++)for(var r=pM[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 Vx=[];pM.forEach(t=>t.blocks.forEach(e=>Vx.push(...e)));function Voe(t){for(var e=0;e<Vx.length;e+=2)if(t>=Vx[e]&&t<=Vx[e+1])return!0;return!1}var pg=80,I9e=function(e,r){return"M95,"+(622+e+r)+`
|
|
808
|
+
`,d9e=()=>{const[t,e]=Se.useState(u9e),[r,n]=Se.useState([]),[a,i]=Se.useState(null),[s,o]=Se.useState([]),[l,u]=Se.useState(null),[d,h]=Se.useState(!1),[f,p]=Se.useState(!1),[m,y]=Se.useState(!1),[b,E]=Se.useState(!1),[x,T]=Se.useState(!1),[R,w]=Se.useState(""),[L,N]=Se.useState(!0),[A,I]=Se.useState(h6e),[B,M]=Se.useState(g6e),[F,Y]=Se.useState(()=>fr.getItem("plannotator-tater-mode")==="true"),[k,_]=Se.useState(()=>hM()),[P,U]=Se.useState(!1),[z,q]=Se.useState(null),[j,G]=Se.useState([]),[W,Q]=Se.useState(!1),[re,Z]=Se.useState(!0),[le,ie]=Se.useState(!1),[me,ne]=Se.useState(null),[se,J]=Se.useState(null),[$,ue]=Se.useState(!1),[oe,we]=Se.useState(!1),[de,Ve]=Se.useState(!1),[te,tt]=Se.useState(!1),[xe,Be]=Se.useState("bypassPermissions"),[qe,He]=Se.useState(!0),[Oe,Ze]=Se.useState(void 0),[ke,Fe]=Se.useState(void 0),[$e,Ae]=Se.useState(null),[je,ce]=Se.useState(!1),[Ee,K]=Se.useState(),[ge,he]=Se.useState(null),[Te,Re]=Se.useState(!1),[De,Ye]=Se.useState("clean"),[Ie,Qe]=Se.useState(null),[vt,pt]=Se.useState(null),ye=Se.useRef(null),_e=Se.useRef(null),Me=fW({storageKey:"plannotator-panel-width"}),rt=fW({storageKey:"plannotator-toc-width",defaultWidth:240,minWidth:160,maxWidth:400,side:"left"}),Nt=Me.isDragging||rt.isDragging,mt=k6e(hM().tocEnabled);Se.useEffect(()=>{k.tocEnabled?mt.open("toc"):mt.close()},[k.tocEnabled]),Se.useEffect(()=>{mt.activeTab==="toc"&&Te&&Re(!1)},[mt.activeTab]),Se.useEffect(()=>{if(!Te)return;const ft=Kt=>{Kt.key==="Escape"&&Re(!1)};return document.addEventListener("keydown",ft),()=>document.removeEventListener("keydown",ft)},[Te]);const We=_6e(t,Ie,vt),it=U6e({markdown:t,annotations:r,selectedAnnotationId:a,globalAttachments:j,setMarkdown:e,setAnnotations:n,setSelectedAnnotationId:i,setGlobalAttachments:G,viewerRef:ye,sidebar:mt}),Je=z6e(),yt=Se.useMemo(()=>pDe(),[k]),bt=Se.useMemo(()=>{if(!yt)return"";const ft=Ld();return Af(ft)},[yt,k]);Se.useEffect(()=>{yt||Je.setActiveFile(null)},[yt]),Se.useEffect(()=>{mt.activeTab==="vault"&&yt&&bt&&Je.tree.length===0&&!Je.isLoading&&Je.fetchTree(bt)},[mt.activeTab,yt,bt]);const kt=Sd.useCallback(ft=>Kt=>`/api/reference/obsidian/doc?vaultPath=${encodeURIComponent(ft)}&path=${encodeURIComponent(Kt)}`,[]),It=Sd.useCallback(ft=>{it.open(ft,kt(bt)),Je.setActiveFile(ft)},[bt,it,Je,kt]),Gt=Sd.useCallback(ft=>{Je.activeFile&&bt?it.open(ft,kt(bt)):it.open(ft)},[Je.activeFile,bt,it,kt]),mr=Sd.useCallback(()=>{it.back(),Je.setActiveFile(null)},[it,Je]),Vt=Sd.useCallback(()=>{Je.fetchTree(bt)},[Je,bt]),hr=Se.useMemo(()=>s.filter(ft=>ft.type==="heading").length,[s]),Gr=t6e(_e,hr),{isSharedSession:Sr,isLoadingShared:lr,shareUrl:_r,shareUrlSize:Rn,shortShareUrl:Pt,isGeneratingShortUrl:Ue,shortUrlError:xt,pendingSharedAnnotations:Ut,clearPendingSharedAnnotations:kr,generateShortUrl:Qr,importFromShareUrl:ur,shareLoadError:dn,clearShareLoadError:Yn}=e6e(t,r,j,e,n,G,()=>{Z(!1)},Oe,ke),{draftBanner:Xr,restoreDraft:Rt,dismissDraft:dt}=V6e({annotations:r,globalAttachments:j,isApiMode:P,isSharedSession:Sr,submitted:!!me}),{editorAnnotations:Tt,deleteEditorAnnotation:Et}=H6e(),ht=Sd.useCallback(()=>{const{annotations:ft,globalAttachments:Kt}=Rt();ft.length>0&&(n(ft),Kt.length>0&&G(Kt),setTimeout(()=>{ye.current?.applySharedAnnotations(ft)},100))},[Rt]),{getAgentWarning:$t}=koe(z);Se.useEffect(()=>{if(Ut&&Ut.length>0){const ft=setTimeout(()=>{ye.current?.clearAllHighlights(),ye.current?.applySharedAnnotations(Ut),kr()},100);return()=>clearTimeout(ft)}},[Ut,kr]);const Ce=ft=>{Y(ft),fr.setItem("plannotator-tater-mode",String(ft))},Wn=ft=>{I(ft),f6e(ft)},Ne=ft=>{M(ft),m6e(ft)};b6e(B,Ne),Se.useEffect(()=>{lr||Sr||fetch("/api/plan").then(ft=>{if(!ft.ok)throw new Error("Not in API mode");return ft.json()}).then(ft=>{ft.plan&&e(ft.plan),U(!0),ft.mode==="annotate"&&Q(!0),ft.sharingEnabled!==void 0&&He(ft.sharingEnabled),ft.shareBaseUrl&&Ze(ft.shareBaseUrl),ft.pasteApiUrl&&Fe(ft.pasteApiUrl),ft.repoInfo&&Ae(ft.repoInfo),ft.previousPlan!==void 0&&Qe(ft.previousPlan),ft.versionInfo&&pt(ft.versionInfo),ft.origin&&(q(ft.origin),ft.origin==="claude-code"&&_De()?ue(!0):oW()?we(!0):h4()?Ve(!0):SS()&&tt(!0),Be(Aoe().mode))}).catch(()=>{U(!1)}).finally(()=>Z(!1))},[lr,Sr]),Se.useEffect(()=>{const{frontmatter:ft}=V$(t);u(ft),o(q$(t))},[t]);const Or=Se.useRef(!1);Se.useEffect(()=>{if(!P||!t||Sr||W||Or.current)return;const ft=Ld();if(!ft.autoSave||!ft.enabled)return;const Kt=Af(ft);if(!Kt)return;Or.current=!0;const Ir={obsidian:{vaultPath:Kt,folder:ft.folder||"plannotator",plan:t,...ft.filenameFormat&&{filenameFormat:ft.filenameFormat},...ft.filenameSeparator&&ft.filenameSeparator!=="space"&&{filenameSeparator:ft.filenameSeparator}}};fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ir)}).then(Rr=>Rr.json()).then(Rr=>{Rr.results?.obsidian?.success?he({type:"success",message:"Auto-saved to Obsidian"}):he({type:"error",message:"Auto-save to Obsidian failed"})}).catch(()=>{he({type:"error",message:"Auto-save to Obsidian failed"})}).finally(()=>setTimeout(()=>he(null),3e3))},[P,t,Sr,W]),Se.useEffect(()=>{const ft=Kt=>{const Ir=Kt.clipboardData?.items;if(Ir){for(const Rr of Ir)if(Rr.type.startsWith("image/")){Kt.preventDefault();const Ot=Rr.getAsFile();if(Ot){const zt=eL(Ot.name,j.map(zr=>zr.name)),br=URL.createObjectURL(Ot);J({file:Ot,blobUrl:br,initialName:zt})}break}}};return document.addEventListener("paste",ft),()=>document.removeEventListener("paste",ft)},[j]);const xo=async(ft,Kt,Ir)=>{if(se)try{const Rr=new FormData,Ot=Kt?new File([ft],"annotated.png",{type:"image/png"}):se.file;Rr.append("file",Ot);const zt=await fetch("/api/upload",{method:"POST",body:Rr});if(zt.ok){const br=await zt.json();G(zr=>[...zr,{path:br.path,name:Ir}])}}catch{}finally{URL.revokeObjectURL(se.blobUrl),J(null)}},To=()=>{se&&(URL.revokeObjectURL(se.blobUrl),J(null))},zi=async()=>{ie(!0);try{const ft=Ld(),Kt=_g(),Ir=N9(),Rr=dM(),Ot={};z==="claude-code"&&(Ot.permissionMode=xe);const zt=DDe(Ir);zt&&(Ot.agentSwitch=zt),Ot.planSave={enabled:Rr.enabled,...Rr.customPath&&{customPath:Rr.customPath}};const br=Af(ft);ft.enabled&&br&&(Ot.obsidian={vaultPath:br,folder:ft.folder||"plannotator",plan:t,...ft.filenameFormat&&{filenameFormat:ft.filenameFormat},...ft.filenameSeparator&&ft.filenameSeparator!=="space"&&{filenameSeparator:ft.filenameSeparator}}),Kt.enabled&&(Ot.bear={plan:t});const zr=Array.from(it.getDocAnnotations().values()).some(Ln=>Ln.annotations.length>0||Ln.globalAttachments.length>0);(r.length>0||j.length>0||zr||Tt.length>0)&&(Ot.feedback=tr),await fetch("/api/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ot)}),ne("approved")}catch{ie(!1)}},Co=async()=>{ie(!0);try{const ft=dM();await fetch("/api/deny",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:tr,planSave:{enabled:ft.enabled,...ft.customPath&&{customPath:ft.customPath}}})}),ne("denied")}catch{ie(!1)}},jn=async()=>{ie(!0);try{await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:tr,annotations:r})}),ne("denied")}catch{ie(!1)}};Se.useEffect(()=>{const ft=Kt=>{if(Kt.key!=="Enter"||!(Kt.metaKey||Kt.ctrlKey))return;const Ir=Kt.target?.tagName;if(!(Ir==="INPUT"||Ir==="TEXTAREA")&&!(d||f||m||b||x||$||oe||de||te||se)&&!(me||le)&&P&&!it.isActive){if(Kt.preventDefault(),W){r.length===0?y(!0):jn();return}if(r.length===0&&Tt.length===0){if(z==="opencode"){const Rr=$t();if(Rr){w(Rr),T(!0);return}}zi()}else Co()}};return window.addEventListener("keydown",ft),()=>window.removeEventListener("keydown",ft)},[d,f,m,b,x,$,oe,de,te,se,me,le,P,it.isActive,r.length,W,z,$t]);const ea=ft=>{n(Kt=>[...Kt,ft]),i(ft.id),N(!0)},Ro=ft=>{ye.current?.removeHighlight(ft),n(Kt=>Kt.filter(Ir=>Ir.id!==ft)),a===ft&&i(null)},ws=(ft,Kt)=>{n(Ir=>Ir.map(Rr=>Rr.id===ft?{...Rr,...Kt}:Rr))},wo=(ft,Kt)=>{n(Ir=>Ir.map(Rr=>Rr.author===ft?{...Rr,author:Kt}:Rr))},pa=ft=>{G(Kt=>[...Kt,ft])},ol=ft=>{G(Kt=>Kt.filter(Ir=>Ir.path!==ft))},ta=ft=>{},tr=Se.useMemo(()=>{const ft=it.getDocAnnotations(),Kt=Array.from(ft.values()).some(zt=>zt.annotations.length>0||zt.globalAttachments.length>0),Ir=r.length>0||j.length>0,Rr=Tt.length>0;if(!Ir&&!Kt&&!Rr)return"No changes detected.";let Ot=Ir?l1e(s,r,j):"";return Kt&&(Ot+=c1e(ft)),Rr&&(Ot+=u1e(Tt)),Ot},[s,r,j,it.getDocAnnotations,Tt]),Ea=()=>{ce(!1);const ft=new Blob([tr],{type:"text/plain"}),Kt=URL.createObjectURL(ft),Ir=document.createElement("a");Ir.href=Kt,Ir.download="annotations.md",Ir.click(),URL.revokeObjectURL(Kt),he({type:"success",message:"Downloaded annotations"}),setTimeout(()=>he(null),3e3)},Tn=async ft=>{ce(!1);const Kt={};if(ft==="obsidian"){const Ir=Ld(),Rr=Af(Ir);Rr&&(Kt.obsidian={vaultPath:Rr,folder:Ir.folder||"plannotator",plan:t,...Ir.filenameFormat&&{filenameFormat:Ir.filenameFormat},...Ir.filenameSeparator&&Ir.filenameSeparator!=="space"&&{filenameSeparator:Ir.filenameSeparator}})}ft==="bear"&&(Kt.bear={plan:t});try{const Ot=(await(await fetch("/api/save-notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Kt)})).json()).results?.[ft];Ot?.success?he({type:"success",message:`Saved to ${ft==="obsidian"?"Obsidian":"Bear"}`}):he({type:"error",message:Ot?.error||"Save failed"})}catch{he({type:"error",message:"Save failed"})}setTimeout(()=>he(null),3e3)};Se.useEffect(()=>{const ft=Kt=>{if(Kt.key!=="s"||!(Kt.metaKey||Kt.ctrlKey))return;const Ir=Kt.target?.tagName;if(Ir==="INPUT"||Ir==="TEXTAREA"||d||m||b||x||$||oe||de||te||se||me||!P)return;Kt.preventDefault();const Rr=Ioe(),Ot=l4(),zt=_g().enabled;Rr==="download"?Ea():Rr==="obsidian"&&Ot?Tn("obsidian"):Rr==="bear"&&zt?Tn("bear"):(K("notes"),h(!0))};return window.addEventListener("keydown",ft),()=>window.removeEventListener("keydown",ft)},[d,m,b,x,$,oe,de,te,se,me,P,t,tr]),Se.useEffect(()=>{if(!je)return;const ft=Kt=>{Kt.target.closest("[data-export-dropdown]")||ce(!1)};return document.addEventListener("mousedown",ft),()=>document.removeEventListener("mousedown",ft)},[je]);const Dr=Se.useMemo(()=>z==="opencode"?"OpenCode":z==="claude-code"?"Claude Code":z==="pi"?"Pi":"Coding Agent",[z]);return D.jsx(yDe,{defaultTheme:"dark",children:D.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[F&&D.jsx(IDe,{}),D.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:[D.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[D.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:D.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Plannotator"})}),D.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.11.3"]}),z&&D.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium hidden md:inline ${z==="claude-code"?"bg-orange-500/15 text-orange-400":z==="pi"?"bg-violet-500/15 text-violet-400":"bg-zinc-500/20 text-zinc-400"}`,children:Dr})]}),D.jsxs("div",{className:"flex items-center gap-1 md:gap-2",children:[P&&!it.isActive&&D.jsxs(D.Fragment,{children:[D.jsxs("button",{onClick:()=>{r.length===0&&Tt.length===0?y(!0):W?jn():Co()},disabled:le,className:`p-1.5 md:px-2.5 md:py-1 rounded-md text-xs font-medium transition-all ${le?"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:[D.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})}),D.jsx("span",{className:"hidden md:inline",children:le?"Sending...":W?"Send Annotations":"Send Feedback"})]}),!W&&D.jsxs("div",{className:"relative group/approve",children:[D.jsxs("button",{onClick:()=>{if(z==="claude-code"&&r.length>0){E(!0);return}if(z==="opencode"){const ft=$t();if(ft){w(ft),T(!0);return}}zi()},disabled:le,className:`px-2 py-1 md:px-2.5 rounded-md text-xs font-medium transition-all ${le?"opacity-50 cursor-not-allowed bg-muted text-muted-foreground":z==="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:[D.jsx("span",{className:"md:hidden",children:le?"...":"OK"}),D.jsx("span",{className:"hidden md:inline",children:le?"Approving...":"Approve"})]}),z==="claude-code"&&r.length>0&&D.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:[D.jsx("div",{className:"absolute bottom-full right-4 border-4 border-transparent border-b-border"}),D.jsx("div",{className:"absolute bottom-full right-4 mt-px border-4 border-transparent border-b-popover"}),Dr," doesn't support feedback on approval. Your annotations won't be seen."]})]}),D.jsx("div",{className:"w-px h-5 bg-border/50 mx-1 hidden md:block"})]}),D.jsx(EDe,{}),!it.isActive&&D.jsx(jDe,{taterMode:F,onTaterModeChange:Ce,onIdentityChange:wo,origin:z,onUIPreferencesChange:_}),D.jsx("button",{onClick:()=>N(!L),className:`p-1.5 rounded-md text-xs font-medium transition-all ${L?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:D.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})})}),D.jsxs("div",{className:"relative flex","data-export-dropdown":!0,children:[D.jsxs("button",{onClick:()=>{K(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:[D.jsx("svg",{className:"w-4 h-4 md:hidden",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"})}),D.jsx("span",{className:"hidden md:inline",children:"Export"})]}),D.jsx("button",{onClick:()=>ce(ft=>!ft),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:D.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),je&&D.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:[qe&&D.jsxs("button",{onClick:async()=>{ce(!1);try{await navigator.clipboard.writeText(_r),he({type:"success",message:"Share link copied"})}catch{he({type:"error",message:"Failed to copy"})}setTimeout(()=>he(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:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"]}),D.jsxs("button",{onClick:Ea,className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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 Annotations"]}),P&&l4()&&D.jsxs("button",{onClick:()=>Tn("obsidian"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Obsidian"]}),P&&_g().enabled&&D.jsxs("button",{onClick:()=>Tn("bear"),className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2",children:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Save to Bear"]}),P&&!l4()&&!_g().enabled&&D.jsx("div",{className:"px-3 py-2 text-[10px] text-muted-foreground",children:"No notes apps configured."}),qe&&D.jsxs(D.Fragment,{children:[D.jsx("div",{className:"my-1 border-t border-border"}),D.jsxs("button",{onClick:()=>{ce(!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:[D.jsx("svg",{className:"w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:D.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"]})]})]})]})]})]}),it.error&&D.jsxs("div",{className:"bg-destructive/10 border-b border-destructive/20 px-4 py-2 flex items-center gap-2 flex-shrink-0",children:[D.jsx("span",{className:"text-xs text-destructive",children:it.error}),D.jsx("button",{onClick:it.dismissError,className:"ml-auto text-xs text-destructive/60 hover:text-destructive",children:"dismiss"})]}),D.jsxs("div",{className:`flex-1 flex overflow-hidden ${Nt?"select-none":""}`,children:[!mt.isOpen&&D.jsx(W6e,{activeTab:mt.activeTab,onToggleTab:mt.toggleTab,hasDiff:We.hasPreviousVersion,showVaultTab:yt,className:"hidden lg:flex"}),mt.isOpen&&D.jsxs(D.Fragment,{children:[D.jsx($6e,{activeTab:mt.activeTab,onTabChange:mt.toggleTab,onClose:mt.close,width:rt.width,blocks:s,annotations:r,activeSection:Gr,onTocNavigate:ta,linkedDocFilepath:it.filepath,onLinkedDocBack:it.isActive?mr:void 0,showVaultTab:yt,vaultPath:bt,vaultBrowser:Je,onVaultSelectFile:It,onVaultFetchTree:Vt,versionInfo:vt,versions:We.versions,projectPlans:We.projectPlans,selectedBaseVersion:We.diffBaseVersion,onSelectBaseVersion:We.selectBaseVersion,isPlanDiffActive:Te,hasPreviousVersion:We.hasPreviousVersion,onActivatePlanDiff:()=>Re(!0),isLoadingVersions:We.isLoadingVersions,isSelectingVersion:We.isSelectingVersion,fetchingVersion:We.fetchingVersion,onFetchVersions:We.fetchVersions,onFetchProjectPlans:We.fetchProjectPlans}),D.jsx(pW,{...rt.handleProps,className:"hidden lg:block"})]}),D.jsxs("main",{ref:_e,className:"flex-1 min-w-0 overflow-y-auto bg-grid",children:[D.jsx(Sv,{isOpen:!!Xr,onClose:dt,onConfirm:ht,title:"Draft Recovered",message:Xr?`Found ${Xr.count} annotation${Xr.count!==1?"s":""} from ${Xr.timeAgo}. Would you like to restore them?`:"",confirmText:"Restore",cancelText:"Dismiss",showCancel:!0}),D.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:[!Te&&D.jsx("div",{className:"w-full max-w-[832px] 2xl:max-w-5xl mb-3 md:mb-4 flex items-center justify-start",children:D.jsx(CDe,{inputMethod:B,onInputMethodChange:Ne,mode:A,onModeChange:Wn,taterMode:F})}),Te&&We.diffBlocks&&We.diffStats?D.jsx(c9e,{diffBlocks:We.diffBlocks,diffStats:We.diffStats,diffMode:De,onDiffModeChange:Ye,onPlanDiffToggle:()=>Re(!1),repoInfo:$e,baseVersionLabel:We.diffBaseVersion!=null?`v${We.diffBaseVersion}`:void 0,baseVersion:We.diffBaseVersion??void 0}):D.jsx(iDe,{ref:ye,blocks:s,markdown:t,frontmatter:l,annotations:r,onAddAnnotation:ea,onSelectAnnotation:i,selectedAnnotationId:a,mode:A,inputMethod:B,taterMode:F,globalAttachments:j,onAddGlobalAttachment:pa,onRemoveGlobalAttachment:ol,repoInfo:$e,stickyActions:k.stickyActionsEnabled,planDiffStats:it.isActive?null:We.diffStats,isPlanDiffActive:Te,onPlanDiffToggle:()=>Re(!Te),hasPreviousVersion:!it.isActive&&We.hasPreviousVersion,showDemoBadge:!P&&!lr&&!Sr,onOpenLinkedDoc:Gt,linkedDocInfo:it.isActive?{filepath:it.filepath,onBack:mr,label:Je.activeFile?"Vault File":void 0}:null},it.isActive?`doc:${it.filepath}`:"plan")]})]}),L&&D.jsx(pW,{...Me.handleProps}),D.jsx(cDe,{isOpen:L,blocks:s,annotations:r,selectedId:a,onSelect:i,onDelete:Ro,onEdit:ws,shareUrl:_r,sharingEnabled:qe,width:Me.width,editorAnnotations:Tt,onDeleteEditorAnnotation:Et})]}),D.jsx(mDe,{isOpen:d,onClose:()=>{h(!1),K(void 0)},shareUrl:_r,shareUrlSize:Rn,shortShareUrl:Pt,isGeneratingShortUrl:Ue,shortUrlError:xt,onGenerateShortUrl:Qr,annotationsOutput:tr,annotationCount:r.length,taterSprite:F?D.jsx(A9,{}):void 0,sharingEnabled:qe,markdown:t,isApiMode:P,initialTab:Ee}),D.jsx(vDe,{isOpen:f,onClose:()=>p(!1),onImport:ur,shareBaseUrl:Oe}),D.jsx(Sv,{isOpen:m,onClose:()=>y(!1),title:"Add Annotations First",message:`To provide feedback, select text in the plan and add annotations. ${Dr} will use your annotations to revise the plan.`,variant:"info"}),D.jsx(Sv,{isOpen:b,onClose:()=>E(!1),onConfirm:()=>{E(!1),zi()},title:"Annotations Won't Be Sent",message:D.jsxs(D.Fragment,{children:[Dr," doesn't yet support feedback on approval. Your ",r.length," annotation",r.length!==1?"s":""," will be lost."]}),subMessage:D.jsxs(D.Fragment,{children:["To send feedback, use ",D.jsx("strong",{children:"Send Feedback"})," instead.",D.jsx("br",{}),D.jsx("br",{}),"Want this feature? Upvote these issues:",D.jsx("br",{}),D.jsx("a",{href:"https://github.com/anthropics/claude-code/issues/16001",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"#16001"})," · ",D.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}),D.jsx(Sv,{isOpen:x,onClose:()=>T(!1),onConfirm:()=>{T(!1),zi()},title:"Agent Not Found",message:R,subMessage:D.jsxs(D.Fragment,{children:["You can change the agent in ",D.jsx("strong",{children:"Settings"}),", or approve anyway and OpenCode will use the default agent."]}),confirmText:"Approve Anyway",cancelText:"Cancel",variant:"warning",showCancel:!0}),D.jsx(Sv,{isOpen:!!dn&&!P,onClose:Yn,title:"Shared Plan Could Not Be Loaded",message:dn,subMessage:"You are viewing a demo plan. This is sample content — it is not your data or anyone else's.",variant:"warning"}),ge&&D.jsx("div",{className:`fixed top-16 right-4 z-50 px-3 py-2 rounded-lg text-xs font-medium shadow-lg transition-opacity ${ge.type==="success"?"bg-success/15 text-success border border-success/30":"bg-destructive/15 text-destructive border border-destructive/30"}`,children:ge.message}),D.jsx(i6e,{submitted:me,title:me==="approved"?"Plan Approved":W?"Annotations Sent":"Feedback Sent",subtitle:me==="approved"?`${Dr} will proceed with the implementation.`:W?`${Dr} will address your annotations on the file.`:`${Dr} will revise the plan based on your annotations.`,agentLabel:Dr}),D.jsx(u6e,{origin:z}),D.jsx(K$,{isOpen:!!se,imageSrc:se?.blobUrl??"",initialName:se?.initialName,onAccept:xo,onClose:To}),D.jsx(E6e,{isOpen:$,onComplete:ft=>{Be(ft),ue(!1),oW()?we(!0):h4()?Ve(!0):SS()&&tt(!0)}}),D.jsx(x6e,{isOpen:oe,onComplete:ft=>{_(ft),we(!1),h4()?Ve(!0):SS()&&tt(!0)}}),D.jsx(N6e,{isOpen:de,origin:z,onComplete:()=>{Ve(!1),SS()&&tt(!0)}}),D.jsx(I6e,{isOpen:te,onComplete:()=>{tt(!1)}})]})})},Goe=document.getElementById("root");if(!Goe)throw new Error("Could not find root element to mount to");const h9e=o1e.createRoot(Goe);h9e.render(D.jsx(Sd.StrictMode,{children:D.jsx(d9e,{})}));class Ps{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 Ps(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class co{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 co(r,Ps.range(this,e))}}class _t{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__=_t.prototype,h.position=a,a!=null&&i!=null&&(h.length=i-a),h.rawMessage=e,h}}_t.prototype.__proto__=Error.prototype;var f9e=function(e,r){return e===void 0?r:e},p9e=/([A-Z])/g,g9e=function(e){return e.replace(p9e,"-$1").toLowerCase()},m9e={"&":"&",">":">","<":"<",'"':""","'":"'"},v9e=/[&><"']/g;function y9e(t){return String(t).replace(v9e,e=>m9e[e])}var Yoe=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},b9e=function(e){var r=Yoe(e);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},E9e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},S9e=function(e){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},En={deflt:f9e,escape:y9e,hyphenate:g9e,getBaseElem:Yoe,isCharacterBox:b9e,protocolFromUrl:S9e},H1={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 x9e(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 L9{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 H1)if(H1.hasOwnProperty(r)){var n=H1[r];this[r]=e[r]!==void 0?n.processor?n.processor(e[r]):e[r]:x9e(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 _t("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=En.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 md{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 nc[T9e[this.id]]}sub(){return nc[C9e[this.id]]}fracNum(){return nc[R9e[this.id]]}fracDen(){return nc[w9e[this.id]]}cramp(){return nc[A9e[this.id]]}text(){return nc[N9e[this.id]]}isTight(){return this.size>=2}}var M9=0,N2=1,Jg=2,bu=3,Ty=4,jo=5,Rm=6,fs=7,nc=[new md(M9,0,!1),new md(N2,0,!0),new md(Jg,1,!1),new md(bu,1,!0),new md(Ty,2,!1),new md(jo,2,!0),new md(Rm,3,!1),new md(fs,3,!0)],T9e=[Ty,jo,Ty,jo,Rm,fs,Rm,fs],C9e=[jo,jo,jo,jo,fs,fs,fs,fs],R9e=[Jg,bu,Ty,jo,Rm,fs,Rm,fs],w9e=[bu,bu,jo,jo,fs,fs,fs,fs],A9e=[N2,N2,bu,bu,jo,jo,fs,fs],N9e=[M9,N2,Jg,bu,Jg,bu,Jg,bu],Tr={DISPLAY:nc[M9],TEXT:nc[Jg],SCRIPT:nc[Ty],SCRIPTSCRIPT:nc[Rm]},pM=[{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 O9e(t){for(var e=0;e<pM.length;e++)for(var r=pM[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 Vx=[];pM.forEach(t=>t.blocks.forEach(e=>Vx.push(...e)));function Voe(t){for(var e=0;e<Vx.length;e+=2)if(t>=Vx[e]&&t<=Vx[e+1])return!0;return!1}var pg=80,I9e=function(e,r){return"M95,"+(622+e+r)+`
|
|
809
809
|
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
810
810
|
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
811
811
|
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
|