pptx-react-viewer 1.1.20 → 1.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4672,7 +4672,7 @@ ${h}
4672
4672
  .notes-text .bullet { margin-right: 6px; }
4673
4673
  .notes-text .para { margin: 2px 0; }
4674
4674
  @media print { body { padding: 0; } }
4675
- </style></head><body>`);for(let a of t){let l=qoe(a),c=M0(l);s.write('<div class="slide-page">'),s.write(`<div class="slide-header">${Dh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write(`<div class="slide-thumb">${Dh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write('<div class="notes-text">');let u=0;for(let d of c){d.bulletType==="numbered"?u++:u=0;let p=d.indentLevel*24,f="";d.bulletType==="bullet"?f="\u2022 ":d.bulletType==="numbered"&&(f=`${u}. `);let h=d.segments.filter(m=>!m.isParagraphBreak).map(m=>Dh(m.text)).join("");s.write(`<div class="para" style="padding-left:${p}px">${Dh(f)}${h}</div>`);}s.write("</div></div>");}s.write("</body></html>"),s.close(),setTimeout(()=>{i.contentWindow?.print();},200);},[t,n]);return jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:jsxs("div",{className:"bg-background border border-border rounded-lg shadow-xl w-[640px] max-h-[80vh] flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:n("pptx.notes.printNotes")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-sm",children:n("common.close")})]}),jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.map(i=>{let s=qoe(i),a=G2(s).trim().length>0;return jsxs("div",{className:"border border-border/50 rounded p-3",children:[jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:n("pptx.notes.slideN",{n:i.slideNumber})}),jsx("div",{className:"w-full aspect-video bg-muted rounded mb-2 flex items-center justify-center text-muted-foreground text-sm",children:n("pptx.notes.slideN",{n:i.slideNumber})}),jsx("div",{className:"text-xs text-foreground whitespace-pre-wrap",children:a?SI(s):jsx("span",{className:"italic text-muted-foreground",children:n("pptx.notes.noNotes")})})]},i.id)})}),jsx("div",{className:"flex justify-end px-4 py-3 border-t border-border",children:jsx("button",{type:"button",onClick:o,className:"px-3 py-1.5 text-xs bg-primary hover:bg-primary/80 text-white rounded",children:n("pptx.notes.print")})}),jsx("iframe",{ref:r,title:"print-notes",className:"hidden",sandbox:"allow-same-origin"})]})})}function qoe(t){return t.notesSegments&&t.notesSegments.length>0?t.notesSegments:kv(t.notes??"")}function Joe({initialText:t,onInsert:e,onClose:n}){let{t:r}=useTranslation(),[o,i]=useState(""),[s,a]=useState(t),l=useRef(null);useEffect(()=>{l.current?.focus();},[]);let c=useCallback(u=>{if(u.preventDefault(),o.trim().length===0)return;let d=o.startsWith("http")?o:`https://${o}`;e(d,s||d);},[o,s,e]);return jsx("div",{className:"absolute bottom-full left-0 mb-1 z-10 bg-muted border border-border rounded-lg shadow-lg p-3 w-72",children:jsxs("form",{onSubmit:c,className:"space-y-2",children:[jsxs("div",{children:[jsx("label",{className:"block text-[10px] text-muted-foreground mb-0.5",children:r("pptx.notes.linkUrl")}),jsx("input",{ref:l,type:"text",value:o,onChange:u=>i(u.target.value),placeholder:"https://...",className:"w-full px-2 py-1 text-xs bg-background border border-border rounded text-foreground focus:outline-none focus:border-primary"})]}),jsxs("div",{children:[jsx("label",{className:"block text-[10px] text-muted-foreground mb-0.5",children:r("pptx.notes.linkDisplayText")}),jsx("input",{type:"text",value:s,onChange:u=>a(u.target.value),placeholder:r("pptx.notes.linkDisplayText"),className:"w-full px-2 py-1 text-xs bg-background border border-border rounded text-foreground focus:outline-none focus:border-primary"})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx("button",{type:"button",onClick:n,className:"px-2 py-1 text-[10px] text-muted-foreground hover:text-foreground",children:r("common.cancel")}),jsx("button",{type:"submit",className:"px-2 py-1 text-[10px] bg-primary hover:bg-primary/80 text-white rounded",children:r("pptx.notes.insertLink")})]})]})})}function eie({isRichEditEnabled:t,showLinkPopover:e,savedSelectionText:n,hasAllSlides:r,onApplyRichCommand:o,onToggleBulletList:i,onToggleNumberedList:s,onIndent:a,onOutdent:l,onLinkButtonClick:c,onInsertLink:u,onCloseLinkPopover:d,onPrintClick:p,onToggleRichEdit:f}){let{t:h}=useTranslation();return jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[jsxs("div",{className:"inline-flex items-center rounded bg-muted text-xs overflow-hidden border border-border/60 relative",children:[jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.bold"),onClick:()=>o("bold"),children:jsx(LuBold,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.italic"),onClick:()=>o("italic"),children:jsx(LuItalic,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.underline"),onClick:()=>o("underline"),children:jsx(LuUnderline,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.strikethrough"),onClick:()=>o("strikeThrough"),children:jsx(LuStrikethrough,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.bulletList"),onClick:i,children:jsx(LuList,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.numberedList"),onClick:s,children:jsx(LuListOrdered,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.indent"),onClick:a,children:jsx(LuIndentIncrease,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.outdent"),onClick:l,children:jsx(LuIndentDecrease,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.insertLink"),onClick:c,children:jsx(LuLink,{className:"w-3.5 h-3.5"})}),r&&jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.printNotes"),onClick:p,children:jsx(LuPrinter,{className:"w-3.5 h-3.5"})}),e&&jsx(Joe,{initialText:n,onInsert:u,onClose:d})]}),jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded bg-muted hover:bg-accent border border-border/60",onClick:f,title:h("pptx.notes.toggleRichPlainEditor"),children:h(t?"pptx.notes.plainEditor":"pptx.notes.richEditor")})]})}function tie({activeSlide:t,isExpanded:e,canEdit:n,onToggle:r,onUpdateNotes:o}){let i=useMemo(()=>t?.notesSegments&&t.notesSegments.length>0?Iv(t.notesSegments):kv(t?.notes??""),[t?.notes,t?.notesSegments]),[s,a]=useState(t?.notes??""),[l,c]=useState(i),[u,d]=useState(i.length>0),[p,f]=useState(false),[h,m]=useState(false),x=useRef(null),y=useRef(null),v=useRef(null),S=useRef(null),w=useRef(false),C=useRef(null);useEffect(()=>{let W=t?.notes??"";if(W===C.current)return;let te=t?.notesSegments&&t.notesSegments.length>0?Iv(t.notesSegments):kv(W);a(W),c(te),d(te.length>0);},[t?.id,t?.notes,t?.notesSegments]),useEffect(()=>{if(!(!u||!e||!n||!v.current)){if(w.current){w.current=false;return}v.current.innerHTML=Yoe(l);}},[n,l,e,u]);let T=useCallback((W,te)=>{x.current&&(clearTimeout(x.current),x.current=null),C.current=W,o(W,te);},[o]),E=useCallback((W,te)=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{C.current=W,o(W,te),x.current=null;},600);},[o]);useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let M=useCallback(W=>{let te=W.target.value,se=kv(te);a(te),c(se),E(te,se);},[E]),A=useCallback(W=>{W.stopPropagation(),W.key==="Enter"&&(W.metaKey||W.ctrlKey)&&(T(s,l),r());},[s,l,T,r]),R=useCallback(()=>{if(!v.current)return;w.current=true;let W=Woe(v.current),te=G2(W);a(te),c(W),E(te,W);},[E]),k=useCallback(()=>{T(s,l);},[s,l,T]),N=useCallback(W=>{if(!v.current)return;let te=joe(v.current,l),se=M0(l);te>=0&&te<se.length&&(se[te]=W(se[te],te));let Ce=Voe(se),ee=G2(Ce);a(ee),c(Ce),E(ee,Ce);},[l,E]),F=useCallback(W=>{document.execCommand(W),R(),v.current?.focus();},[R]),B=useCallback(()=>{N(W=>({...W,bulletType:W.bulletType==="bullet"?"none":"bullet"})),v.current?.focus();},[N]),D=useCallback(()=>{N(W=>({...W,bulletType:W.bulletType==="numbered"?"none":"numbered"})),v.current?.focus();},[N]),O=useCallback(()=>{N(W=>({...W,indentLevel:Math.min(4,W.indentLevel+1)})),v.current?.focus();},[N]),U=useCallback(()=>{N(W=>({...W,indentLevel:Math.max(0,W.indentLevel-1)})),v.current?.focus();},[N]),H=useCallback(W=>{if(W.stopPropagation(),W.key==="Enter"&&(W.metaKey||W.ctrlKey)){T(s,l),r();return}W.key==="Tab"&&(W.preventDefault(),W.shiftKey?U():O());},[s,l,T,r,O,U]),j=useCallback(()=>{let W=window.getSelection();S.current={text:W?.toString()??""},f(true);},[]),Z=useCallback((W,te)=>{if(f(false),!v.current)return;v.current.focus();let se=window.getSelection();if(se&&se.rangeCount>0){let Ce=se.getRangeAt(0);Ce.deleteContents();let ee=document.createElement("a");ee.href=W,ee.textContent=te,ee.style.color="#4a9eff",ee.style.textDecoration="underline",ee.style.cursor="pointer",ee.setAttribute("data-hyperlink",W),Ce.insertNode(ee),Ce.setStartAfter(ee),Ce.collapse(true),se.removeAllRanges(),se.addRange(Ce);}R();},[R]),J=useCallback(W=>{let te=W.target;if(!(te instanceof HTMLAnchorElement))return;let se=te.getAttribute("data-hyperlink")||te.getAttribute("href");se&&(W.ctrlKey||W.metaKey)&&(W.preventDefault(),Xg(se));},[]);return {draft:s,draftSegments:l,isRichEditEnabled:u,setIsRichEditEnabled:d,showLinkPopover:p,setShowLinkPopover:f,showPrintDialog:h,setShowPrintDialog:m,textareaRef:y,richEditorRef:v,savedSelectionRef:S,handlePlainChange:M,handleRichInput:R,handleBlur:k,handleKeyDownPlain:A,handleKeyDownRich:H,applyRichCommand:F,toggleBulletList:B,toggleNumberedList:D,handleIndent:O,handleOutdent:U,handleLinkButtonClick:j,handleInsertLink:Z,handleEditorClick:J}}var V6=({activeSlide:t,allSlides:e,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i,panelHeight:s})=>{let{t:a}=useTranslation(),{draft:l,draftSegments:c,isRichEditEnabled:u,setIsRichEditEnabled:d,showLinkPopover:p,setShowLinkPopover:f,showPrintDialog:h,setShowPrintDialog:m,textareaRef:x,richEditorRef:y,savedSelectionRef:v,handlePlainChange:S,handleRichInput:w,handleBlur:C,handleKeyDownPlain:T,handleKeyDownRich:E,applyRichCommand:M,toggleBulletList:A,toggleNumberedList:R,handleIndent:k,handleOutdent:N,handleLinkButtonClick:F,handleInsertLink:B,handleEditorClick:D}=tie({activeSlide:t,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i}),O=l.trim().length>0,U=t?a("pptx.notes.slideN",{n:t.slideNumber}):a("pptx.notes.noSlide");return jsxs("div",{className:le("flex flex-col border-t border-border/60 bg-background select-none",!n&&"max-md:hidden"),children:[jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1.5 px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30 transition-colors w-full text-left shrink-0 max-md:hidden","aria-expanded":n,"aria-controls":"slide-notes-content",children:["Notes",!n&&O&&jsx("span",{className:"text-muted-foreground/50 text-[10px]",children:"(has notes)"})]}),n&&jsxs("div",{id:"slide-notes-content",className:"px-3 pb-2 overflow-y-auto",style:{maxHeight:s??240},children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:U}),r?jsxs(Fragment,{children:[jsx(eie,{isRichEditEnabled:u,showLinkPopover:p,savedSelectionText:v.current?.text??"",hasAllSlides:e!==void 0&&e.length>0,onApplyRichCommand:M,onToggleBulletList:A,onToggleNumberedList:R,onIndent:k,onOutdent:N,onLinkButtonClick:F,onInsertLink:B,onCloseLinkPopover:()=>f(false),onPrintClick:()=>m(true),onToggleRichEdit:()=>d(H=>!H)}),u?jsx("div",{ref:y,contentEditable:true,suppressContentEditableWarning:true,onInput:w,onBlur:C,onKeyDown:E,onClick:D,className:"w-full overflow-y-auto rounded-md border border-border/50 bg-muted/60 px-2.5 py-1.5 text-xs text-foreground focus:border-primary/50 focus:outline-none focus:ring-1 focus:ring-primary/30 transition-colors whitespace-pre-wrap",style:{maxHeight:192,minHeight:72}}):jsx("textarea",{ref:x,name:"slide-notes",value:l,onChange:S,onBlur:C,onKeyDown:T,placeholder:a("pptx.notes.clickToAddNotes"),rows:4,className:"w-full resize-none rounded-md border border-border/50 bg-muted/60 px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-1 focus:ring-primary/30 transition-colors",style:{maxHeight:192}})]}):jsx("div",{className:"w-full rounded-md border border-border/30 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground overflow-y-auto whitespace-pre-wrap",style:{maxHeight:168,minHeight:60},children:O?SI(c):jsx("span",{className:"italic text-muted-foreground",children:a("pptx.notes.noNotes")})})]}),h&&e&&jsx(Koe,{slides:e,onClose:()=>m(false)})]})};var rGe="pptx-viewer-autosave",oGe=1,Dv="recoveryVersions";function nie(){return new Promise((t,e)=>{let n=indexedDB.open(rGe,oGe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(Dv)||r.createObjectStore(Dv,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function iGe(t){try{let e=await nie();return new Promise(n=>{let i=e.transaction(Dv,"readonly").objectStore(Dv).get(t);i.onsuccess=()=>{e.close();let s=i.result;n(s?[s]:[]);},i.onerror=()=>{e.close(),n([]);};})}catch{return []}}async function sGe(t){try{let e=await nie();return new Promise(n=>{let r=e.transaction(Dv,"readwrite");r.objectStore(Dv).delete(t),r.oncomplete=()=>{e.close(),n();},r.onerror=()=>{e.close(),n();};})}catch{}}function aGe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function lGe(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function cGe(t){let e=Date.now()-t,n=Math.floor(e/6e4);if(n<1)return "Just now";if(n<60)return `${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function X6({isOpen:t,filePath:e,onClose:n,onRestore:r}){let{t:o}=useTranslation(),[i,s]=useState([]),[a,l]=useState(false),[c,u]=useState(null),[d,p]=useState(null),f=useCallback(async()=>{if(e){l(true);try{let x=await iGe(e);s(x);}catch{s([]);}finally{l(false);}}},[e]);useEffect(()=>{t&&f();},[t,f]);let h=useCallback(async x=>{u(x.key);try{x.data&&(r(x.data),n());}finally{u(null);}},[r,n]),m=useCallback(async x=>{p(x.key);try{await sGe(x.key),await f();}finally{p(null);}},[f]);return t?jsxs("div",{className:"absolute inset-y-0 right-0 w-80 bg-background border-l border-border z-50 flex flex-col shadow-xl",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[jsx(LuClock,{className:"w-4 h-4"}),o("pptx.versionHistory.title")]}),jsx("button",{onClick:n,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&jsx("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:o("common.loading")}),!a&&i.length===0&&jsx("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:o("pptx.versionHistory.noVersions")}),!a&&i.map(x=>jsxs("div",{className:"px-3 py-2.5 border-b border-border hover:bg-muted/50 group",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-xs text-foreground",children:lGe(x.timestamp)}),jsx("div",{className:"text-[10px] text-muted-foreground",children:cGe(x.timestamp)})]}),jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:aGe(x.size)}),jsxs("div",{className:"flex items-center gap-1 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[jsxs("button",{onClick:()=>{h(x);},disabled:c===x.key,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] bg-primary/20 text-primary hover:bg-primary/30 disabled:opacity-40",children:[jsx(LuDownload,{className:"w-3 h-3"}),c===x.key?o("common.loading"):o("pptx.versionHistory.restore")]}),jsxs("button",{onClick:()=>{m(x);},disabled:d===x.key,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] bg-red-600/20 text-red-400 hover:bg-red-600/30 disabled:opacity-40",children:[jsx(LuTrash2,{className:"w-3 h-3"}),o("common.delete")]})]})]},x.key))]})]}):null}function bGe({kind:t}){switch(t){case "added":return jsx(LuPlus,{className:"w-3 h-3 text-green-400"});case "removed":return jsx(LuMinus,{className:"w-3 h-3 text-red-400"});case "moved":return jsx(LuMove,{className:"w-3 h-3 text-primary"});case "resized":return jsx(LuMove,{className:"w-3 h-3 text-amber-400"});case "textChanged":return jsx(LuType,{className:"w-3 h-3 text-purple-400"})}}function oie({diff:t,diffIndex:e,canvasSize:n,accepted:r,rejected:o,onAccept:i,onReject:s}){let{t:a}=useTranslation(),[l,c]=useState(t.status==="changed"),u=(()=>{switch(t.status){case "added":return a("pptx.compare.statusAdded");case "removed":return a("pptx.compare.statusRemoved");case "changed":return a("pptx.compare.statusChanged");case "unchanged":return a("pptx.compare.statusUnchanged")}})(),d=(()=>{switch(t.status){case "added":return "text-green-400 bg-green-900/30";case "removed":return "text-red-400 bg-red-900/30";case "changed":return "text-amber-400 bg-amber-900/30";case "unchanged":return "text-muted-foreground bg-muted/30"}})();if(t.status==="unchanged")return null;let p=r||o,f=t.baseIndex>=0?t.baseIndex+1:t.compareIndex+1;return jsxs("div",{className:le("rounded-lg border transition-colors",p?"border-border/60 bg-card/40 opacity-60":"border-border bg-background/70"),children:[jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-2 text-left",onClick:()=>c(h=>!h),children:[l?jsx(LuChevronDown,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}):jsx(LuChevronRight,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),jsx("span",{className:"text-xs text-foreground",children:a("pptx.compare.slideNumber",{number:f})}),jsx("span",{className:le("rounded-full px-2 py-0.5 text-[10px] font-medium",d),children:u}),t.changes.length>0&&jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.changes.length," ",t.changes.length===1?"change":"changes"]}),jsx("span",{className:"flex-1"}),p&&jsx("span",{className:le("text-[10px] font-medium",r?"text-green-400":"text-muted-foreground"),children:a(r?"pptx.compare.accepted":"pptx.compare.rejected")})]}),l&&jsxs("div",{className:"px-3 pb-3 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[t.baseSlide&&jsxs("div",{className:"flex-1",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:a("pptx.compare.current")}),jsx("div",{className:"rounded border border-border overflow-hidden",children:jsx(Qa,{slide:t.baseSlide,templateElements:[],canvasSize:n})})]}),t.compareSlide&&jsxs("div",{className:"flex-1",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:a("pptx.compare.incoming")}),jsx("div",{className:le("rounded border overflow-hidden",t.status==="added"?"border-green-700/60":t.status==="changed"?"border-amber-700/60":"border-border"),children:jsx(Qa,{slide:t.compareSlide,templateElements:[],canvasSize:n})})]})]}),t.changes.length>0&&jsx("div",{className:"space-y-1",children:t.changes.map((h,m)=>jsxs("div",{className:"flex items-start gap-2 rounded bg-muted/60 px-2 py-1.5 text-[11px]",children:[jsx(bGe,{kind:h.kind}),jsx("span",{className:"text-foreground",children:h.description})]},`${h.elementId}-${h.kind}-${m}`))}),!p&&jsxs("div",{className:"flex items-center gap-2 pt-1",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-green-700/80 px-2.5 py-1 text-[11px] text-green-50 hover:bg-green-600 transition-colors",onClick:()=>i(e),children:[jsx(LuCheck,{className:"w-3 h-3"}),a("pptx.compare.accept")]}),jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-accent px-2.5 py-1 text-[11px] text-foreground hover:bg-accent/80 transition-colors",onClick:()=>s(e),children:[jsx(LuX,{className:"w-3 h-3"}),a("pptx.compare.reject")]})]})]})]})}function Y6({isOpen:t,compareResult:e,canvasSize:n,onClose:r,onAcceptSlide:o,onRejectSlide:i,onAcceptAll:s}){let{t:a}=useTranslation(),[l,c]=useState({}),[u,d]=useState({}),p=useCallback(x=>{c(y=>({...y,[x]:true})),d(y=>{let v={...y};return delete v[x],v}),o(x);},[o]),f=useCallback(x=>{d(y=>({...y,[x]:true})),c(y=>{let v={...y};return delete v[x],v}),i(x);},[i]),h=useCallback(()=>{if(!e)return;let x={};e.diffs.forEach((y,v)=>{y.status!=="unchanged"&&(x[v]=true);}),c(x),d({}),s();},[e,s]);if(!t||!e)return null;let m=e.diffs.filter(x=>x.status!=="unchanged");return jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex flex-col w-[440px] border-l border-border bg-popover backdrop-blur-lg shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-medium text-foreground",children:a("pptx.compare.title")}),jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:a("pptx.compare.summary",{added:e.addedCount,removed:e.removedCount,changed:e.changedCount})})]}),jsx("button",{type:"button",className:"rounded p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",onClick:r,title:a("pptx.compare.close"),children:jsx(LuX,{className:"w-4 h-4"})})]}),m.length>0&&jsx("div",{className:"px-4 py-2 border-b border-border/60",children:jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded bg-green-700/80 px-3 py-1.5 text-xs text-green-50 hover:bg-green-600 transition-colors",onClick:h,children:[jsx(LuCheck,{className:"w-3.5 h-3.5"}),a("pptx.compare.acceptAll")]})}),jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-2",children:m.length===0?jsx("div",{className:"text-center py-8 text-xs text-muted-foreground",children:a("pptx.compare.noDifferences")}):e.diffs.map((x,y)=>jsx(oie,{diff:x,diffIndex:y,canvasSize:n,accepted:!!l[y],rejected:!!u[y],onAccept:p,onReject:f},`diff-${y}-${x.status}`))})]})}function PGe(t){if(!t)return 0;let e=0;return t.length>=8&&e++,t.length>=12&&e++,/[A-Z]/.test(t)&&/[a-z]/.test(t)&&e++,/\d/.test(t)&&e++,/[^A-Za-z0-9]/.test(t)&&e++,Math.min(e,4)}var RGe=["bg-red-500","bg-orange-500","bg-yellow-500","bg-lime-500","bg-green-500"];function K6({isOpen:t,isCurrentlyProtected:e,onClose:n,onSetPassword:r,onRemovePassword:o}){let{t:i}=useTranslation(),[s,a]=useState(""),[l,c]=useState(""),[u,d]=useState(false),[p,f]=useState(""),h=useMemo(()=>PGe(s),[s]),m=useMemo(()=>{let S=[i("pptx.security.strengthVeryWeak"),i("pptx.security.strengthWeak"),i("pptx.security.strengthFair"),i("pptx.security.strengthStrong"),i("pptx.security.strengthVeryStrong")];return s?S[h]:""},[h,s,i]),x=useCallback(()=>{if(f(""),!s){f(i("pptx.security.errorPasswordRequired"));return}if(s!==l){f(i("pptx.security.errorPasswordMismatch"));return}if(s.length<4){f(i("pptx.security.errorPasswordTooShort"));return}r(s),a(""),c(""),n();},[s,l,r,n,i]),y=useCallback(()=>{o(),a(""),c(""),n();},[o,n]),v=useCallback(()=>{a(""),c(""),f(""),n();},[n]);return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":i("common.close"),onClick:v}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuLock,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:i("pptx.security.protectPresentation")})]}),jsx("button",{type:"button",onClick:v,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":i("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsxs("div",{className:"px-5 py-4 space-y-4",children:[e&&jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-green-900/30 border border-green-700/40 px-3 py-2",children:[jsx(LuShieldCheck,{className:"w-4 h-4 text-green-400 shrink-0"}),jsx("span",{className:"text-xs text-green-300",children:i("pptx.security.currentlyProtected")})]}),jsx("p",{className:"text-xs text-muted-foreground",children:i("pptx.security.description")}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:i("pptx.security.password")}),jsxs("div",{className:"relative",children:[jsx("input",{type:u?"text":"password",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:i("pptx.security.passwordPlaceholder"),value:s,onChange:S=>{a(S.target.value),f("");}}),jsx("button",{type:"button",onClick:()=>d(!u),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":u?"Hide password":"Show password",children:u?jsx(LuEyeOff,{className:"w-4 h-4"}):jsx(LuEye,{className:"w-4 h-4"})})]})]}),s&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"flex gap-1",children:Array.from({length:5}).map((S,w)=>jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${w<=h?RGe[h]:"bg-accent"}`},`str-${w}`))}),jsx("p",{className:"text-[11px] text-muted-foreground",children:m})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:i("pptx.security.confirmPassword")}),jsx("input",{type:u?"text":"password",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:i("pptx.security.confirmPasswordPlaceholder"),value:l,onChange:S=>{c(S.target.value),f("");}})]}),p&&jsx("p",{className:"text-xs text-red-400",children:p})]}),jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border/60",children:[jsx("div",{children:e&&jsx("button",{type:"button",onClick:y,className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:i("pptx.security.removePassword")})}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{type:"button",onClick:v,className:"px-3 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:i("common.cancel")}),jsx("button",{type:"button",onClick:x,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors",children:i(e?"pptx.security.updatePassword":"pptx.security.setPassword")})]})]})]})})]}):null}var LGe=[{value:"lpwstr",labelKey:"pptx.documentProperties.custom.typeText"},{value:"i4",labelKey:"pptx.documentProperties.custom.typeNumber"},{value:"filetime",labelKey:"pptx.documentProperties.custom.typeDate"},{value:"bool",labelKey:"pptx.documentProperties.custom.typeYesNo"}];function Z6({customProperties:t,onUpdate:e}){let{t:n}=useTranslation(),r=useCallback(()=>{e([...t,{name:"",value:"",type:"lpwstr"}]);},[t,e]),o=useCallback(l=>{e(t.filter((c,u)=>u!==l));},[t,e]),i=useCallback((l,c)=>{e(t.map((u,d)=>d===l?{...u,name:c}:u));},[t,e]),s=useCallback((l,c)=>{e(t.map((u,d)=>d===l?{...u,value:c}:u));},[t,e]),a=useCallback((l,c)=>{e(t.map((u,d)=>d===l?{...u,type:c}:u));},[t,e]);return jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-muted-foreground",children:n("pptx.documentProperties.custom.description")}),jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_32px] gap-1 text-[11px] font-medium text-muted-foreground px-1",children:[jsx("span",{children:n("pptx.documentProperties.custom.name")}),jsx("span",{children:n("pptx.documentProperties.custom.value")}),jsx("span",{children:n("pptx.documentProperties.custom.type")}),jsx("span",{})]}),jsx("div",{className:"max-h-[240px] overflow-y-auto space-y-1",children:t.map((l,c)=>jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_32px] gap-1 items-center",children:[jsx("input",{type:"text",className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:n("pptx.documentProperties.custom.namePlaceholder"),value:l.name,onChange:u=>i(c,u.target.value)}),l.type==="bool"?jsxs("select",{className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:l.value,onChange:u=>s(c,u.target.value),children:[jsx("option",{value:"true",children:n("pptx.documentProperties.custom.yes")}),jsx("option",{value:"false",children:n("pptx.documentProperties.custom.no")})]}):jsx("input",{type:l.type==="i4"?"number":"text",className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:n("pptx.documentProperties.custom.valuePlaceholder"),value:l.value,onChange:u=>s(c,u.target.value)}),jsx("select",{className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:l.type,onChange:u=>a(c,u.target.value),children:LGe.map(u=>jsx("option",{value:u.value,children:n(u.labelKey)},u.value))}),jsx("button",{type:"button",onClick:()=>o(c),className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-400 transition-colors","aria-label":n("pptx.documentProperties.custom.deleteProperty"),children:jsx(LuTrash2,{className:"w-3.5 h-3.5"})})]},`custom-prop-${c}`))}),t.length===0&&jsx("p",{className:"text-xs text-muted-foreground/60 text-center py-4",children:n("pptx.documentProperties.custom.empty")}),jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:[jsx(LuPlus,{className:"w-3.5 h-3.5"}),n("pptx.documentProperties.custom.addProperty")]})]})}var OGe=[{key:"application",labelKey:"pptx.documentProperties.statistics.application",editable:false},{key:"appVersion",labelKey:"pptx.documentProperties.statistics.appVersion",editable:false},{key:"presentationFormat",labelKey:"pptx.documentProperties.statistics.presentationFormat",editable:false},{key:"slides",labelKey:"pptx.documentProperties.statistics.slides",editable:false},{key:"hiddenSlides",labelKey:"pptx.documentProperties.statistics.hiddenSlides",editable:false},{key:"notes",labelKey:"pptx.documentProperties.statistics.notes",editable:false},{key:"totalTime",labelKey:"pptx.documentProperties.statistics.totalTime",editable:false},{key:"words",labelKey:"pptx.documentProperties.statistics.words",editable:false},{key:"paragraphs",labelKey:"pptx.documentProperties.statistics.paragraphs",editable:false},{key:"template",labelKey:"pptx.documentProperties.statistics.template",editable:false},{key:"company",labelKey:"pptx.documentProperties.statistics.company",editable:true},{key:"manager",labelKey:"pptx.documentProperties.statistics.manager",editable:true}];function UGe(t,e){if(t==null)return e("pptx.documentProperties.statistics.notAvailable");let n=Math.floor(t/60),r=t%60;return e("pptx.documentProperties.statistics.hoursMinutes",{hours:n,minutes:r})}function $Ge(t,e,n){return t==="totalTime"?UGe(e,n):e==null?n("pptx.documentProperties.statistics.notAvailable"):String(e)}function J6({appProperties:t,onUpdateAppProperties:e,canEdit:n}){let{t:r}=useTranslation(),o=useCallback((i,s)=>{e({[i]:s});},[e]);return jsx("div",{className:"space-y-3",children:OGe.map(({key:i,labelKey:s,editable:a})=>jsxs("div",{className:"flex items-center gap-3",children:[jsx("label",{className:"block text-xs text-foreground w-[140px] shrink-0",children:r(s)}),a&&n?jsx("input",{type:"text",className:"flex-1 rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:String(t[i]??""),onChange:l=>o(i,l.target.value)}):jsx("span",{className:"flex-1 px-3 py-2 text-sm text-muted-foreground",children:$Ge(i,t[i],r)})]},i))})}var aie=[{key:"title",labelKey:"pptx.documentProperties.summary.title"},{key:"subject",labelKey:"pptx.documentProperties.summary.subject"},{key:"creator",labelKey:"pptx.documentProperties.summary.author"},{key:"keywords",labelKey:"pptx.documentProperties.summary.keywords"},{key:"description",labelKey:"pptx.documentProperties.summary.description",multiline:true},{key:"category",labelKey:"pptx.documentProperties.summary.category"}];function Q6({isOpen:t,coreProperties:e,customProperties:n,appProperties:r,onClose:o,onSave:i}){let{t:s}=useTranslation(),[a,l]=useState("summary"),[c,u]=useState({}),[d,p]=useState([]),[f,h]=useState({}),[m,x]=useState(false);t&&!m&&(u({...e}),p(n.map(E=>({...E}))),h({company:r?.company,manager:r?.manager}),l("summary")),t!==m&&x(t);let y=useCallback((E,M)=>{u(A=>({...A,[E]:M}));},[]),v=useMemo(()=>{if(aie.some(({key:R})=>(c[R]??"")!==(e[R]??"")))return true;let M=(f.company??"")!==(r?.company??""),A=(f.manager??"")!==(r?.manager??"");return M||A||d.length!==n.length?true:d.some((R,k)=>R.name!==n[k]?.name||R.value!==n[k]?.value||R.type!==n[k]?.type)},[c,d,f,e,n,r]),S=useCallback(E=>{h(M=>({...M,...E}));},[]),w=useCallback(()=>{let E=(f.company??"")!==(r?.company??"")||(f.manager??"")!==(r?.manager??"");i(c,d,E?f:void 0),o();},[c,d,f,r,i,o]),C=useCallback(()=>{o();},[o]);if(!t)return null;let T=[{id:"summary",labelKey:"pptx.documentProperties.tabs.summary"},{id:"custom",labelKey:"pptx.documentProperties.tabs.custom"},{id:"statistics",labelKey:"pptx.documentProperties.tabs.statistics"}];return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":s("common.close"),onClick:C}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[520px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuFileText,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.documentProperties.dialogTitle")})]}),jsx("button",{type:"button",onClick:C,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"flex border-b border-border/60",children:T.map(E=>jsx("button",{type:"button",onClick:()=>l(E.id),className:`px-4 py-2 text-xs font-medium transition-colors ${a===E.id?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:s(E.labelKey)},E.id))}),jsxs("div",{className:"px-5 py-4 min-h-[280px]",children:[a==="summary"&&jsx("div",{className:"space-y-3",children:aie.map(({key:E,labelKey:M,multiline:A})=>jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:s(M)}),A?jsx("textarea",{className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none resize-none",rows:3,value:c[E]??"",onChange:R=>y(E,R.target.value)}):jsx("input",{type:"text",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:c[E]??"",onChange:R=>y(E,R.target.value)})]},E))}),a==="custom"&&jsx(Z6,{customProperties:d,onUpdate:p}),a==="statistics"&&jsx(J6,{appProperties:{...r,company:f.company,manager:f.manager},onUpdateAppProperties:S,canEdit:true})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border/60",children:[jsx("button",{type:"button",onClick:C,className:"px-3 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:w,disabled:!v,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("common.save")})]})]})})]})}function eVe(t){if(typeof document>"u")return false;try{return document.fonts.check(`12px "${t}"`)}catch{return false}}function t8({isOpen:t,embedFontsEnabled:e,usedFontFamilies:n,embeddedFonts:r,onClose:o,onToggleEmbedFonts:i}){let{t:s}=useTranslation(),[a,l]=useState(new Set),[c,u]=useState(false),[d,p]=useState(false),f=useCallback(async()=>{u(true);try{await document.fonts.ready;let x=new Set;for(let y of n)eVe(y)&&x.add(y);l(x),p(!0);}catch{}finally{u(false);}},[n]);if(useEffect(()=>{t&&!d&&f();},[t,d,f]),!t)return null;let h=n.filter(x=>!a.has(x)),m=new Set(r);return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":s("common.close"),onClick:o}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[460px] max-h-[80vh] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60 shrink-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuType,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.fonts.embedFonts")})]}),jsx("button",{type:"button",onClick:o,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1",children:[jsx("p",{className:"text-xs text-muted-foreground",children:s("pptx.fonts.embedDescription")}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[jsxs("div",{className:"relative",children:[jsx("input",{type:"checkbox",className:"sr-only",checked:e,onChange:x=>i(x.target.checked)}),jsx("div",{className:`w-9 h-5 rounded-full transition-colors ${e?"bg-primary":"bg-muted-foreground"}`}),jsx("div",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${e?"translate-x-4":""}`})]}),jsx("span",{className:"text-xs text-foreground",children:s("pptx.fonts.enableEmbedding")})]}),jsxs("div",{className:"space-y-1",children:[jsxs("h3",{className:"text-xs font-medium text-foreground",children:[s("pptx.fonts.usedFonts")," (",n.length,")"]}),c?jsxs("div",{className:"flex items-center gap-2 py-4 justify-center",children:[jsx(LuLoader,{className:"w-4 h-4 text-muted-foreground animate-spin"}),jsx("span",{className:"text-xs text-muted-foreground",children:s("pptx.fonts.scanning")})]}):jsx("div",{className:"space-y-1 max-h-[280px] overflow-y-auto",children:n.map(x=>{let y=a.has(x),v=m.has(x);return jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-muted/60",children:[jsx("span",{className:"text-xs text-foreground",children:x}),jsxs("div",{className:"flex items-center gap-2",children:[v&&jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-900/40 text-green-400 border border-green-700/40",children:s("pptx.fonts.embedded")}),y?jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}):jsx("span",{className:"text-[10px] text-yellow-400",children:s("pptx.fonts.notFound")})]})]},x)})})]}),h.length>0&&!c&&jsx("p",{className:"text-[11px] text-yellow-400/80",children:s("pptx.fonts.missingWarning",{count:h.length})})]}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60 shrink-0",children:jsx("button",{type:"button",onClick:o,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors",children:s("common.done")})})]})})]})}function r8({isOpen:t,onClose:e,hasSignatures:n,signatureCount:r}){let{t:o}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":o("common.close"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[n?jsx(LuShieldCheck,{className:"w-5 h-5 text-green-400"}):jsx(LuShieldAlert,{className:"w-5 h-5 text-amber-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:o("pptx.digitalSignatures.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":o("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6 space-y-4",children:n?jsxs(Fragment,{children:[jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-green-900/20 border border-green-700/30 px-4 py-3",children:[jsx(LuSignature,{className:"w-5 h-5 text-green-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-1",children:[jsx("p",{className:"text-xs text-green-200",children:o("pptx.digitalSignatures.signed")}),jsx("p",{className:"text-[11px] text-green-300/70",children:o("pptx.digitalSignatures.signatureCount",{count:r})})]})]}),jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-amber-900/20 border border-amber-700/30 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-amber-400 shrink-0 mt-0.5"}),jsx("p",{className:"text-xs text-amber-200",children:o("pptx.digitalSignatures.editWarning")})]})]}):jsx(Fragment,{children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-muted/30 border border-border/40 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-muted-foreground shrink-0 mt-0.5"}),jsx("p",{className:"text-xs text-muted-foreground",children:o("pptx.digitalSignatures.noSignatures")})]})})}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60",children:jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:o("common.close")})})]})})]}):null}function o8({hasSignatures:t,signatureCount:e,onClick:n}){let{t:r}=useTranslation();return !t||e===0?null:jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-medium rounded-md bg-green-900/30 border border-green-700/40 text-green-300 hover:bg-green-900/50 transition-colors",title:r("pptx.digitalSignatures.signatureCount",{count:e}),children:[jsx(LuShieldCheck,{className:"w-3.5 h-3.5"}),jsx("span",{children:r("pptx.digitalSignatures.badge")})]})}function i8({isOpen:t,signatureCount:e,onConfirm:n,onCancel:r}){let{t:o}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":o("common.close"),onClick:r}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuTriangleAlert,{className:"w-5 h-5 text-amber-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:o("pptx.digitalSignatures.strippedTitle")})]}),jsx("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":o("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6",children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-amber-900/20 border border-amber-700/30 px-4 py-3",children:[jsx(LuTriangleAlert,{className:"w-5 h-5 text-amber-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"text-xs text-amber-200",children:o("pptx.digitalSignatures.strippedMessage",{count:e})}),jsx("p",{className:"text-[11px] text-amber-300/70",children:o("pptx.digitalSignatures.editWarning")})]})]})}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border/60",children:[jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:o("common.cancel")}),jsx("button",{type:"button",onClick:n,className:"px-3 py-1.5 text-xs rounded-lg bg-amber-600 text-white hover:bg-amber-500 transition-colors",children:o("pptx.digitalSignatures.strippedConfirm")})]})]})})]}):null}function s8({isOpen:t,onClose:e}){let{t:n}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":n("common.close"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuLock,{className:"w-5 h-5 text-red-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:n("pptx.encryptedFile.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":n("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6 space-y-4",children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-red-900/20 border border-red-700/30 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-red-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"text-xs text-red-200",children:n("pptx.encryptedFile.message")}),jsx("p",{className:"text-[11px] text-red-300/70",children:n("pptx.encryptedFile.instructions")})]})]})}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60",children:jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:n("common.close")})})]})})]}):null}var a8=10,l8=32,c8=2,pie=14;function u8(t){return Math.max(a8,Math.min(l8,t))}function fie(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function q2(t){let e=Math.floor(t/1e3),n=Math.floor(e/3600),r=Math.floor(e%3600/60),o=e%60;return n>0?`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`}function hie(t){return t.map((e,n)=>{if(e.isParagraphBreak)return Vn__default.createElement("br",{key:`br-${n}`});let r={};return e.style.bold&&(r.fontWeight="bold"),e.style.italic&&(r.fontStyle="italic"),e.style.underline&&(r.textDecoration="underline"),e.style.strikethrough&&(r.textDecoration=`${r.textDecoration?`${r.textDecoration} `:""}line-through`),e.style.color&&(r.color=e.style.color),e.style.fontSize&&(r.fontSize=`${e.style.fontSize}pt`),e.style.fontFamily&&(r.fontFamily=e.style.fontFamily),Vn__default.createElement("span",{key:`seg-${n}`,style:r},e.text)})}function wVe({slide:t,templateElements:e,canvasSize:n,className:r}){let o=useRef(null),[i,s]=useState(0);useEffect(()=>{let p=o.current;if(!p)return;let f=new ResizeObserver(h=>{let m=h[0];m&&s(m.contentRect.width);});return f.observe(p),()=>f.disconnect()},[]);let a=Math.max(n.width,1),l=Math.max(n.height,1),c=i>0?i/a:.2,u=Math.max(40,Math.round(l*c)),d=[...e,...t.elements].slice(0,80);return jsxs("div",{ref:o,className:`relative w-full overflow-hidden rounded border border-border bg-white ${r??""}`,style:{height:u},children:[t.backgroundColor&&t.backgroundColor!=="transparent"&&jsx("div",{className:"absolute inset-0",style:{backgroundColor:dt(t.backgroundColor,"#ffffff")}}),t.backgroundImage&&jsx("img",{src:t.backgroundImage,alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",draggable:false}),t.backgroundGradient&&jsx("div",{className:"absolute inset-0",style:{backgroundImage:t.backgroundGradient}}),jsx("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:a,height:l,transform:`scale(${c})`,transformOrigin:"top left"},children:d.map(p=>{let f=Math.max(p.width,1),h=Math.max(p.height,1),m=mn(p)?p.shapeStyle:void 0,x=m?.fillColor!==void 0&&m?.fillColor!=="transparent"||!!(Bd(m)||m?.fillGradient)||m?.fillMode==="pattern"&&!!m.fillPatternPreset,y=dt(m?.fillColor,Pf),v=Math.max(0,m?.strokeWidth||0),S=dt(m?.strokeColor,Fd),w=Hd(p,x,y,v,S),C=Vd(p,x,y,v,S),T=p.type==="shape"&&x?"#ffffff":bi,E=If(p,T),M=jd(p),A=Nf(p),R=ot(p)?p.text:void 0,k=ot(p)?p.textSegments:void 0,N=typeof R=="string"&&R.trim().length>0||(k?.length??0)>0,F=ty(p,A)?cs(p):"";return jsx("div",{className:"absolute overflow-hidden",style:{left:p.x,top:p.y,width:f,height:h,transform:hu(p),transformOrigin:"center"},children:(p.type==="picture"||p.type==="image")&&(p.svgData||p.imageData)?xu(p)?jsx("div",{className:"pointer-events-none w-full h-full",style:Xd(p)}):jsx("img",{src:p.svgData||p.imageData,alt:"",className:"pointer-events-none",style:M,draggable:false}):jsxs("div",{className:"relative w-full h-full overflow-hidden",style:w,children:[C,A&&N&&jsx("div",{className:"w-full h-full whitespace-pre-wrap break-words px-1 py-0.5 leading-[1.3]",style:{...Sc(p),...E,transform:kf(p),transformOrigin:"center"},children:Al(p,T)}),!N&&F.length>0&&jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground",children:F})]})},p.id)})})]})}function CVe(t,e){return !(t.slide.id!==e.slide.id||t.slide.isDirty!==e.slide.isDirty||t.slide.hidden!==e.slide.hidden||t.slide.elements!==e.slide.elements||t.slide.backgroundColor!==e.slide.backgroundColor||t.slide.backgroundImage!==e.slide.backgroundImage||t.slide.backgroundGradient!==e.slide.backgroundGradient||t.templateElements!==e.templateElements||t.canvasSize.width!==e.canvasSize.width||t.canvasSize.height!==e.canvasSize.height||t.className!==e.className)}var d8=Vn__default.memo(wVe,CVe);function f8({slides:t,currentSlideIndex:e,canvasSize:n,templateElements:r,presentationStartTime:o,onMovePresentationSlide:i,onExit:s,onOpenAudienceWindow:a,onCloseAudienceWindow:l,isAudienceWindowOpen:c}){let{t:u}=useTranslation(),[d,p]=useState(false);useEffect(()=>{let N=window.setTimeout(()=>p(true),300);return ()=>window.clearTimeout(N)},[]);let[f,h]=useState(Date.now());useEffect(()=>{let N=window.setInterval(()=>h(Date.now()),1e3);return ()=>window.clearInterval(N)},[]);let m=o?f-o:0,[x,y]=useState(pie),v=useCallback(()=>{y(N=>u8(N+c8));},[]),S=useCallback(()=>{y(N=>u8(N-c8));},[]),w=t[e],C=e+1<t.length?t[e+1]:void 0,T=w?.notes??"",E=w?.notesSegments,M=E&&E.length>0;if(!w)return jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-card text-muted-foreground",children:u("pptx.presenter.noSlides")});let A=300*1e3,R=Math.min(100,m%A/A*100),k=Math.floor(m/A);return jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-card text-foreground",children:[jsxs("div",{className:"flex flex-1 min-h-0",children:[jsxs("div",{className:"flex-[7] flex flex-col items-center justify-center bg-black p-6 min-w-0",children:[jsx(d8,{slide:w,templateElements:r,canvasSize:n}),jsx("div",{className:"mt-3 text-xs font-mono tabular-nums text-white/50 select-none",children:u("pptx.presenter.slideLabel",{current:e+1,total:t.length,defaultValue:`Slide ${e+1} of ${t.length}`})})]}),jsxs("div",{className:"flex-[3] flex flex-col bg-background border-l border-border min-w-[260px] max-w-[440px]",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/60",children:[jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:u("pptx.presenter.currentTime")}),jsx("span",{className:"text-lg font-mono tabular-nums text-foreground",children:fie(new Date(f))})]}),jsxs("div",{className:"flex flex-col items-end",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:u("pptx.presenter.elapsed")}),jsx("span",{className:"text-lg font-mono tabular-nums text-primary",children:q2(m)})]}),jsxs("div",{className:"flex items-center gap-1",children:[a&&d&&jsx("button",{type:"button",onClick:()=>{c?l?.():a();},className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:u(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),"aria-label":u(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),children:c?jsx(LuMonitorOff,{className:"w-5 h-5"}):jsx(LuMonitor,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:s,className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:u("pptx.presenter.endPresentation"),"aria-label":u("pptx.presenter.endPresentation"),children:jsx(LuX,{className:"w-5 h-5"})})]})]}),jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/60",children:[jsxs("button",{type:"button",onClick:()=>i(-1),disabled:e===0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:u("pptx.presenter.previousSlide"),children:[jsx(LuChevronLeft,{className:"w-4 h-4"}),u("pptx.presenter.prev")]}),jsxs("span",{className:"text-sm font-mono tabular-nums text-foreground",children:[e+1," / ",t.length]}),jsxs("button",{type:"button",onClick:()=>i(1),disabled:e>=t.length-1,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:u("pptx.presenter.nextSlide"),children:[u("pptx.presenter.next"),jsx(LuChevronRight,{className:"w-4 h-4"})]})]}),jsxs("div",{className:"px-4 py-3 border-b border-border/60",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:u("pptx.presenter.nextSlidePreview")}),C?jsx(d8,{slide:C,templateElements:r,canvasSize:n}):jsx("div",{className:"flex items-center justify-center h-16 rounded border border-border/30 bg-muted/40 text-xs text-muted-foreground italic",children:u("pptx.presenter.endOfPresentation")})]}),jsxs("div",{className:"flex-1 flex flex-col min-h-0 px-4 py-3",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:u("pptx.presenter.speakerNotes")}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",onClick:S,disabled:x<=a8,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:u("pptx.presenter.decreaseFontSize"),"aria-label":u("pptx.presenter.decreaseFontSize"),children:jsx(LuMinus,{className:"w-3.5 h-3.5"})}),jsxs("span",{className:"text-[10px] font-mono tabular-nums text-muted-foreground min-w-[28px] text-center select-none",children:[x,"px"]}),jsx("button",{type:"button",onClick:v,disabled:x>=l8,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:u("pptx.presenter.increaseFontSize"),"aria-label":u("pptx.presenter.increaseFontSize"),children:jsx(LuPlus,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto rounded border border-border/30 bg-muted/40 px-3 py-2 text-foreground whitespace-pre-wrap leading-relaxed",style:{fontSize:`${x}px`},children:M?hie(E):T.trim().length>0?T:jsx("span",{className:"italic text-muted-foreground",children:u("pptx.presenter.noNotes")})})]})]})]}),jsx("div",{className:"h-1.5 w-full bg-muted/60 flex-shrink-0",role:"progressbar","aria-valuenow":Math.round(R),"aria-valuemin":0,"aria-valuemax":100,"aria-label":u("pptx.presenter.timerProgress"),title:`${q2(m)} (segment ${k+1})`,children:jsx("div",{className:"h-full bg-primary transition-[width] duration-1000 ease-linear",style:{width:`${R}%`}})})]})}function yie(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function m8({presentationStartTime:t,slideStartTime:e,paused:n,onTogglePause:r}){let{t:o}=useTranslation(),[i,s]=useState(0);useEffect(()=>{if(n)return;let u=window.setInterval(()=>s(d=>d+1),250);return ()=>window.clearInterval(u)},[n]);let a=Date.now(),l=e!==null?a-e:0,c=t!==null?a-t:0;return jsxs("div",{className:"fixed bottom-4 left-4 z-[9999] flex items-center gap-3 rounded-lg bg-black/80 px-4 py-2 text-white shadow-xl backdrop-blur-sm select-none",children:[jsxs("div",{className:"flex flex-col text-xs leading-tight",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.rehearse.slideTime")}),jsx("span",{className:"text-lg font-mono tabular-nums",children:yie(l)})]}),jsx("div",{className:"w-px h-8 bg-border"}),jsxs("div",{className:"flex flex-col text-xs leading-tight",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.rehearse.totalTime")}),jsx("span",{className:"text-lg font-mono tabular-nums",children:yie(c)})]}),jsx("button",{type:"button",onClick:r,className:"ml-1 rounded p-1.5 hover:bg-white/20 transition-colors",title:o(n?"pptx.rehearse.resume":"pptx.rehearse.pause"),"aria-label":o(n?"pptx.rehearse.resume":"pptx.rehearse.pause"),children:n?jsx(LuPlay,{className:"w-4 h-4"}):jsx(LuPause,{className:"w-4 h-4"})})]})}function bie(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function g8({slides:t,canvasSize:e,recordedTimings:n,onSave:r,onDiscard:o}){let{t:i}=useTranslation(),s=Object.values(n).reduce((l,c)=>l+c,0),a=Object.entries(n).map(([l,c])=>({slideIndex:Number(l),ms:c})).sort((l,c)=>l.slideIndex-c.slideIndex);return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",children:jsxs("div",{className:"w-full max-w-lg rounded-xl border border-border bg-background shadow-2xl",children:[jsxs("div",{className:"border-b border-border px-5 py-4",children:[jsx("h2",{className:"text-base font-semibold text-foreground",children:i("pptx.rehearse.summaryTitle")}),jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[i("pptx.rehearse.totalPresentationTime"),":"," ",jsx("span",{className:"font-mono text-foreground",children:bie(s)})]})]}),jsx("div",{className:"max-h-72 overflow-y-auto px-5 py-3",children:jsxs("table",{className:"w-full text-xs",children:[jsx("thead",{children:jsxs("tr",{className:"text-muted-foreground uppercase tracking-wide",children:[jsx("th",{className:"pb-2 text-left",children:"#"}),jsx("th",{className:"pb-2 text-left",children:i("pptx.rehearse.slide")}),jsx("th",{className:"pb-2 text-right",children:i("pptx.rehearse.time")})]})}),jsx("tbody",{children:a.map(({slideIndex:l,ms:c})=>{let u=t[l];return jsxs("tr",{className:"border-t border-border",children:[jsx("td",{className:"py-2 text-muted-foreground tabular-nums",children:l+1}),jsx("td",{className:"py-2",children:u&&jsx("div",{className:"w-20 rounded overflow-hidden bg-white",children:jsx(Qa,{slide:u,templateElements:[],canvasSize:e})})}),jsx("td",{className:"py-2 text-right font-mono text-foreground tabular-nums",children:bie(c)})]},l)})})]})}),jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-5 py-3",children:[jsx("button",{type:"button",onClick:o,className:"rounded-lg px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",children:i("pptx.rehearse.discard")}),jsx("button",{type:"button",onClick:r,className:"rounded-lg bg-primary px-4 py-2 text-sm text-white hover:bg-primary/80 transition-colors",children:i("pptx.rehearse.saveTimings")})]})]})})}function GVe(t,e){return ot(t)&&t.text&&t.text.trim().length>0?t.text.trim().slice(0,32):`${{text:"Text Box",shape:"Shape",connector:"Connector",image:"Image",picture:"Picture",chart:"Chart",table:"Table",smartArt:"SmartArt",media:"Media",group:"Group",ink:"Ink",ole:"Object",unknown:"Object"}[t.type]??"Object"} ${e+1}`}function y8({slides:t,activeSlideIndex:e,selectedElementId:n,selectedElementIds:r,canEdit:o,setSelectedElementId:i,setSelectedElementIds:s,setSlides:a,markDirty:l,onClose:c}){let{t:u}=useTranslation(),p=t[e]?.elements??[],[f,h]=useState(null),[m,x]=useState(""),y=useRef(null),[v,S]=useState(null),[w,C]=useState(null),T=useCallback(B=>{i(B),s([B]);},[i,s]),E=useCallback(B=>{a(D=>{let O=[...D],U=O[e];if(!U)return D;let H=[...U.elements??[]],j=H.findIndex(Z=>Z.id===B);return j===-1?D:(H[j]={...H[j],hidden:!H[j].hidden},O[e]={...U,elements:H},O)}),l();},[e,a,l]),M=useCallback((B,D)=>{o&&(h(B.id),x(D),setTimeout(()=>y.current?.select(),0));},[o]),A=useCallback(()=>{h(null);},[]),R=useCallback(B=>{S(B);},[]),k=useCallback((B,D)=>{B.preventDefault(),v!==null&&v!==D&&C(D);},[v]),N=useCallback(B=>{if(v===null||v===B){S(null),C(null);return}a(D=>{let O=[...D],U=O[e];if(!U)return D;let H=[...U.elements??[]],[j]=H.splice(v,1);return H.splice(B,0,j),O[e]={...U,elements:H},O}),l(),S(null),C(null);},[v,e,a,l]),F=[...p].reverse();return jsxs("div",{className:"flex flex-col h-full bg-popover border-l border-border w-56",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[jsx("span",{className:"text-xs font-medium text-foreground",children:u("pptx.selectionPane.title")}),jsx("button",{type:"button",onClick:c,className:"text-muted-foreground hover:text-foreground text-xs",title:u("pptx.selectionPane.close"),children:"\xD7"})]}),jsx("div",{className:"flex-1 overflow-y-auto py-1",children:F.length===0?jsx("div",{className:"px-3 py-4 text-xs text-muted-foreground italic",children:u("pptx.selectionPane.empty")}):F.map((B,D)=>{let O=p.length-1-D,U=n===B.id||r.includes(B.id),H=GVe(B,O),j=f===B.id;return jsxs("div",{draggable:o,onDragStart:()=>R(O),onDragOver:Z=>k(Z,O),onDrop:()=>N(O),onDragEnd:()=>{S(null),C(null);},className:le("flex items-center gap-1.5 px-2 py-1 text-xs cursor-pointer transition-colors",U?"bg-primary/30 text-primary":"hover:bg-muted text-foreground",w===O?"border-t-2 border-primary":""),onClick:()=>T(B.id),onDoubleClick:()=>M(B,H),children:[o&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground flex-shrink-0 cursor-grab"}),jsx("span",{className:"flex-1 truncate",children:j?jsx("input",{ref:y,type:"text",value:m,onChange:Z=>x(Z.target.value),onBlur:A,onKeyDown:Z=>{Z.key==="Enter"&&A(),Z.key==="Escape"&&h(null);},className:"w-full bg-muted text-xs px-1 py-0.5 rounded border border-border outline-none",onClick:Z=>Z.stopPropagation()}):H}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex-shrink-0",title:B.hidden?u("pptx.selectionPane.show"):u("pptx.selectionPane.hide"),onClick:Z=>{Z.stopPropagation(),E(B.id);},children:B.hidden?jsx(LuEyeOff,{className:"w-3.5 h-3.5"}):jsx(LuEye,{className:"w-3.5 h-3.5 opacity-50"})})]},B.id)})})]})}var Tie="inline-flex items-center justify-center px-2.5 py-1.5 max-md:min-h-[44px] max-md:min-w-[44px] active:scale-95 active:opacity-80",Po=`${Tie} border-r border-border hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Js=`${Tie} hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Ji="inline-flex items-center rounded bg-muted text-xs overflow-hidden",ft="inline-flex items-center gap-1.5 px-2.5 py-1.5 max-md:min-h-[44px] rounded bg-muted hover:bg-accent text-xs transition-colors active:scale-95 active:opacity-80",Un=jsx("div",{className:"w-px self-stretch bg-border/40 mx-1 max-md:hidden"}),Qe="w-4 h-4",lr="w-3.5 h-3.5";var Mie=[{k:"left",el:jsx(LuAlignLeft,{className:Qe})},{k:"center",el:jsx(LuAlignCenter,{className:Qe})},{k:"right",el:jsx(LuAlignRight,{className:Qe})},{k:"top",el:jsx(LuChevronUp,{className:Qe})},{k:"middle",el:jsx(LuAlignCenter,{className:`${Qe} rotate-90`})},{k:"bottom",el:jsx(LuChevronDown,{className:Qe})}],_ie=[{id:"select",icon:jsx(LuMoveRight,{className:Qe}),t:"Select",ac:"bg-primary text-white"},{id:"pen",icon:jsx(LuPencil,{className:Qe}),t:"Pen",ac:"bg-primary text-white"},{id:"highlighter",icon:jsx(LuType,{className:Qe}),t:"Highlighter",ac:"bg-yellow-600 text-white"},{id:"eraser",icon:jsx(LuMinus,{className:Qe}),t:"Eraser",ac:"bg-red-600 text-white"},{id:"freeform",icon:jsx(LuSpline,{className:Qe}),t:"Freeform",ac:"bg-primary text-white"}],Eie=[{k:"png",l:"Export as PNG",i:jsx(LuDownload,{className:`${lr} text-muted-foreground`})},{k:"pdf",l:"Export as PDF",i:jsx(LuFileText,{className:`${lr} text-muted-foreground`})},{k:"video",l:"Export as Video",i:jsx(LuVideo,{className:`${lr} text-muted-foreground`})},{k:"gif",l:"Export as GIF",i:jsx(LuImage,{className:`${lr} text-muted-foreground`})},{k:"package",l:"Package for Sharing",i:jsx(LuFolderOpen,{className:`${lr} text-muted-foreground`})},{k:"pptx",l:"Save as Presentation (.pptx)",i:jsx(LuDownload,{className:`${lr} text-muted-foreground`})},{k:"ppsx",l:"Save as Slide Show (.ppsx)",i:jsx(LuPlay,{className:`${lr} text-muted-foreground`})},{k:"pptm",l:"Save as Macro-Enabled (.pptm)",i:jsx(LuDatabase,{className:`${lr} text-muted-foreground`})},{k:"---0",l:"",i:null},{k:"print",l:"Print",i:jsx(LuPrinter,{className:`${lr} text-muted-foreground`})},{k:"copyImg",l:"Copy Slide as Image",i:jsx(LuCopy,{className:`${lr} text-muted-foreground`})},{k:"---",l:"",i:null},{k:"a11y",l:"Accessibility Check",i:jsx(LuCheck,{className:`${lr} text-muted-foreground`})},{k:"shortcuts",l:"Keyboard Shortcuts",i:jsx(LuSearch,{className:`${lr} text-muted-foreground`})},{k:"---2",l:"",i:null},{k:"versionHistory",l:"Version History",i:jsx(LuClock,{className:`${lr} text-muted-foreground`})},{k:"---3",l:"",i:null},{k:"documentProperties",l:"Document Properties\u2026",i:jsx(LuInfo,{className:`${lr} text-muted-foreground`})},{k:"passwordProtection",l:"Protect Presentation",i:jsx(LuLock,{className:`${lr} text-muted-foreground`})},{k:"fontEmbedding",l:"Embed Fonts",i:jsx(LuType,{className:`${lr} text-muted-foreground`})},{k:"digitalSignatures",l:"Digital Signatures\u2026",i:jsx(LuShieldAlert,{className:`${lr} text-muted-foreground`})}],Aie=[{i:jsx(LuBold,{className:Qe}),t:"Bold"},{i:jsx(LuItalic,{className:Qe}),t:"Italic"},{i:jsx(LuUnderline,{className:Qe}),t:"Underline"},{i:jsx(LuStrikethrough,{className:Qe}),t:"Strikethrough"}],Pie=[{i:jsx(LuAlignLeft,{className:Qe}),t:"Align left"},{i:jsx(LuAlignCenter,{className:Qe}),t:"Align center"},{i:jsx(LuAlignRight,{className:Qe}),t:"Align right"},{i:jsx(LuAlignJustify,{className:Qe}),t:"Justify"}];var C9e=[{group:"Entrance",items:[{value:"appear",label:"Appear"},{value:"fadeIn",label:"Fade In"},{value:"flyIn",label:"Fly In"}]},{group:"Emphasis",items:[{value:"pulse",label:"Pulse"},{value:"spin",label:"Spin"}]},{group:"Exit",items:[{value:"disappear",label:"Disappear"},{value:"fadeOut",label:"Fade Out"}]}];function kI(t){let{t:e}=useTranslation(),[n,r]=useState(false),o=t.selectedElement!==null,i=!t.canEdit||!o;return jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:()=>{i||(r(true),setTimeout(()=>r(false),1200));},disabled:i,className:le(ft,n?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.previewTooltip"),children:[jsx(LuPlay,{className:Qe}),e("pptx.animations.preview")]}),Un,jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:i,className:ft,title:e("pptx.animations.addTooltip"),children:[jsx(LuSparkles,{className:Qe}),e("pptx.animations.addAnimation"),jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-44 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:C9e.map(a=>jsxs(Vn__default.Fragment,{children:[jsx("div",{className:"px-3 pt-1.5 pb-0.5 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:e(`pptx.animations.group.${a.group.toLowerCase()}`)}),a.items.map(l=>jsx("button",{type:"button",disabled:i,onClick:()=>t.onAddAnimation?.(l.value,a.group.toLowerCase()),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:e("pptx.animations.applyAnimation",{name:e(`pptx.animations.preset.${l.value}`)}),children:e(`pptx.animations.preset.${l.value}`)},l.value))]},a.group))})})]}),Un,jsxs("button",{type:"button",disabled:i,onClick:t.onRemoveAnimation,className:ft,title:e("pptx.animations.removeTooltip"),children:[jsx(LuTrash2,{className:Qe}),e("pptx.animations.remove")]}),Un,jsxs("button",{type:"button",onClick:t.onOpenAnimationPanel??t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.openPanelTooltip"),children:[jsx(LuPanelRight,{className:Qe}),e("pptx.animations.animationPanel")]})]})}function II(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit;return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:Mie.map((o,i,s)=>jsx("button",{type:"button",onClick:()=>t.onAlignElements(o.k),disabled:!r,className:i<s.length-1?Po:Js,title:e("pptx.arrange.align",{direction:o.k}),children:o.el},o.k))}),jsxs("div",{className:Ji,children:[jsx("button",{onClick:t.onCopy,disabled:!n,className:Po,title:e("pptx.arrange.copy"),children:jsx(LuCopy,{className:Qe})}),jsx("button",{onClick:t.onCut,disabled:!r,className:Po,title:e("pptx.arrange.cut"),children:e("pptx.arrange.cut")}),jsx("button",{onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Js,title:e("pptx.arrange.paste"),children:jsx(LuClipboardPaste,{className:Qe})})]}),t.onToggleFormatPainter&&jsxs("button",{type:"button",onClick:t.onToggleFormatPainter,disabled:!t.canEdit||t.canActivateFormatPainter===false&&!t.formatPainterActive,"data-testid":"format-painter-toggle",className:le(ft,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:e("pptx.arrange.formatPainter"),children:[jsx(LuPaintbrush,{className:Qe}),e("pptx.arrange.format")]}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",onClick:()=>t.onFlip("horizontal"),disabled:!r,className:Po,title:e("pptx.arrange.flipHorizontally"),children:e("pptx.arrange.flipH")}),jsx("button",{type:"button",onClick:()=>t.onFlip("vertical"),disabled:!r,className:Js,title:e("pptx.arrange.flipVertically"),children:e("pptx.arrange.flipV")})]}),jsxs("div",{className:Ji,children:[jsx("button",{onClick:()=>t.onMoveLayer("backward"),disabled:!r,className:Po,title:e("pptx.arrange.sendBackward"),children:jsx(LuChevronDown,{className:Qe})}),jsx("button",{onClick:()=>t.onMoveLayer("forward"),disabled:!r,className:Po,title:e("pptx.arrange.bringForward"),children:jsx(LuChevronUp,{className:Qe})}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("back"),disabled:!r,className:Po,title:e("pptx.arrange.sendToBack"),children:e("pptx.arrange.back")}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("front"),disabled:!r,className:Js,title:e("pptx.arrange.bringToFront"),children:e("pptx.arrange.front")})]}),jsxs("button",{onClick:t.onDuplicate,disabled:!r,className:ft,title:e("pptx.arrange.duplicate"),children:[jsx(LuCopy,{className:Qe}),e("pptx.arrange.duplicate")]}),jsxs("button",{onClick:t.onDelete,disabled:!r,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded bg-red-700/80 hover:bg-red-600 disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:e("pptx.arrange.delete"),children:[jsx(LuTrash2,{className:Qe}),e("pptx.arrange.delete")]})]})}function NI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onToggleThemeGallery,disabled:!t.canEdit,className:le(ft,t.isThemeGalleryOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Browse and apply built-in themes",children:[jsx(LuPalette,{className:lr}),"Browse Themes"]}),jsxs("button",{onClick:t.onToggleThemeEditor,disabled:!t.canEdit,className:le(ft,t.isThemeEditorOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Edit presentation theme colors and fonts",children:[jsx(LuPencil,{className:lr}),"Edit Theme"]}),Un,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:ft,title:"Change slide dimensions (16:9, 4:3, custom)",children:[jsx(LuMonitor,{className:lr}),"Slide Size"]}),t.onToggleInspector&&jsxs("button",{onClick:t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open inspector to edit slide background",children:[jsx(LuPaintBucket,{className:lr}),"Format Background"]})]})}var z9e=[{value:"none",label:"None"},{value:"fade",label:"Fade"},{value:"push",label:"Push"},{value:"wipe",label:"Wipe"},{value:"split",label:"Split"},{value:"reveal",label:"Reveal"},{value:"cut",label:"Cut"},{value:"cover",label:"Cover"},{value:"uncover",label:"Uncover"}];function DI(t){let[e,n]=Vn__default.useState("none"),[r,o]=Vn__default.useState("00.50");return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:ft,title:"Preview transition",children:[jsx(LuPlay,{className:lr}),"Preview"]}),Un,jsx("div",{className:"inline-flex items-center gap-0.5 overflow-x-auto max-w-[420px]",children:z9e.map(i=>jsx("button",{type:"button",onClick:()=>n(i.value),className:le("flex-shrink-0 px-2 py-1 max-md:min-h-[44px] rounded border text-[11px] leading-tight transition-colors",e===i.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted hover:bg-accent text-foreground"),title:`${i.label} transition`,children:i.label},i.value))}),Un,jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[jsx("span",{className:"whitespace-nowrap",children:"Duration:"}),jsx("input",{type:"text",value:r,onChange:i=>o(i.target.value),className:"w-14 px-1.5 py-1 rounded border border-border bg-muted text-xs text-foreground text-center",title:"Transition duration in seconds"})]}),Un,jsxs("button",{type:"button",className:ft,title:"Apply transition to all slides",children:[jsx(LuCopy,{className:lr}),"Apply to All"]}),Un,jsxs("button",{type:"button",onClick:t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open Inspector for full transition options",children:[jsx(LuPanelRight,{className:Qe}),"Inspector"]})]})}function LI(t){return jsxs(Fragment,{children:[t.onToggleComments&&jsxs("button",{onClick:t.onToggleComments,className:le(ft,t.isCommentsPanelOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle comments panel",children:[jsx(LuMessageSquare,{className:Qe}),"Comments",(t.slideCommentCount??0)>0&&jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-amber-500 text-[10px] font-medium text-white px-1",children:t.slideCommentCount})]}),jsxs("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:le(ft,t.spellCheckEnabled?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle spell check",children:[jsx(LuSpellCheck,{className:Qe}),"Spelling"]}),t.onCompare&&jsxs("button",{onClick:t.onCompare,disabled:!t.canEdit,className:ft,title:"Compare with another presentation",children:[jsx(LuGitCompare,{className:Qe}),"Compare"]})]})}function BI(t){return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:_ie.map((e,n,r)=>jsx("button",{type:"button",onClick:()=>t.onSetActiveTool(e.id),className:le(n<r.length-1?Po:Js,t.activeTool===e.id?e.ac??"bg-accent text-foreground":""),title:e.t,children:e.icon},e.id))}),jsxs("div",{className:"inline-flex items-center gap-2 text-xs",children:[jsxs("label",{className:"inline-flex items-center gap-1 text-muted-foreground",title:"Pen colour",children:["Colour",jsx("input",{type:"color",value:t.drawingColor,onChange:e=>t.onSetDrawingColor(e.target.value),className:"w-6 h-6 rounded border border-border bg-transparent cursor-pointer"})]}),jsxs("label",{className:"inline-flex items-center gap-1 text-muted-foreground",title:"Stroke width",children:["Width",jsx("input",{type:"range",min:1,max:12,value:t.drawingWidth,onChange:e=>t.onSetDrawingWidth(Number(e.target.value)),className:"w-16 h-1 accent-primary"}),jsx("span",{className:"text-foreground w-4 text-right",children:t.drawingWidth})]})]})]})}function OI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onSaveAsPptx,className:ft,title:"Save as Presentation (.pptx)",children:[jsx(LuDownload,{className:Qe}),"Save .pptx"]}),jsxs("button",{onClick:t.onSaveAsPpsx,className:ft,title:"Save as Slide Show (.ppsx)",children:[jsx(LuPlay,{className:Qe}),"Save .ppsx"]}),t.hasMacros&&jsxs("button",{onClick:t.onSaveAsPptm,className:ft,title:"Save as Macro-Enabled (.pptm)",children:[jsx(LuFileText,{className:Qe}),"Save .pptm"]}),jsxs("button",{onClick:t.onPackageForSharing,className:ft,title:"Package for Sharing",children:[jsx(LuFolderOpen,{className:Qe}),"Package"]}),Un,jsxs("button",{onClick:t.onExportPng,className:ft,title:"Export as PNG",children:[jsx(LuDownload,{className:Qe}),"PNG"]}),jsxs("button",{onClick:t.onExportPdf,className:ft,title:"Export as PDF",children:[jsx(LuFileText,{className:Qe}),"PDF"]}),jsxs("button",{onClick:t.onExportVideo,className:ft,title:"Export as Video",children:[jsx(LuVideo,{className:Qe}),"Video"]}),jsxs("button",{onClick:t.onExportGif,className:ft,title:"Export as GIF",children:[jsx(LuImage,{className:Qe}),"GIF"]}),jsxs("button",{onClick:t.onCopySlideAsImage,className:ft,title:"Copy Slide as Image",children:[jsx(LuCopy,{className:Qe}),"Copy Image"]}),Un,jsxs("button",{onClick:t.onPrint,className:ft,title:"Print",children:[jsx(LuPrinter,{className:Qe}),"Print"]}),Un,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:ft,title:"Document Properties",children:[jsx(LuInfo,{className:Qe}),"Properties"]}),t.onOpenPasswordProtection&&jsxs("button",{onClick:t.onOpenPasswordProtection,className:ft,title:"Protect Presentation",children:[jsx(LuLock,{className:Qe}),"Protect"]}),t.onOpenFontEmbedding&&jsxs("button",{onClick:t.onOpenFontEmbedding,className:ft,title:"Embed Fonts",children:[jsx(LuType,{className:Qe}),"Fonts"]}),t.onOpenDigitalSignatures&&jsxs("button",{onClick:t.onOpenDigitalSignatures,className:ft,title:"Digital Signatures",children:[jsx(LuShieldAlert,{className:Qe}),"Signatures"]})]})}function aje(t){let e={fontFamily:"Segoe UI",fontSize:"24"};if(!t||!ot(t))return e;let n=t.textSegments?.[0]?.style,r=t.textStyle,o=n?.fontFamily??r?.fontFamily??e.fontFamily,i=n?.fontSize??r?.fontSize;return {fontFamily:o,fontSize:i!=null?String(i):e.fontSize}}var lje=["Arial","Calibri","Cambria","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana"],cje=[8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,72,96];function UI(t){let[e,n]=useState(false),[r,o]=useState(false),[i,s]=useState(false),[a,l]=useState(false),[c,u]=useState(false),d=useRef(null),p=useRef(null),f=useRef(null),{fontFamily:h,fontSize:m}=aje(t.selectedElement),x=useCallback(()=>{if(t.layoutOptions.length>0){let y=t.layoutOptions[0];t.onInsertSlideFromLayout(y.path,y.name);}},[t]);return useEffect(()=>{if(!e)return;let y=v=>{d.current&&!d.current.contains(v.target)&&n(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[e]),useEffect(()=>{if(!r)return;let y=v=>{p.current&&!p.current.contains(v.target)&&o(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]),useEffect(()=>{if(!i)return;let y=v=>{f.current&&!f.current.contains(v.target)&&s(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:Ji,children:[jsx("button",{type:"button",onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Po,title:"Paste",children:jsx(LuClipboardPaste,{className:Qe})}),jsx("button",{type:"button",onClick:()=>{t.onCut(),u(true),setTimeout(()=>u(false),600);},disabled:!t.canEdit,className:le(Po,c&&"bg-green-600/20 text-green-400"),title:"Cut",children:jsx(LuScissors,{className:Qe})}),jsx("button",{type:"button",onClick:()=>{t.onCopy(),l(true),setTimeout(()=>l(false),600);},className:le(Po,a&&"bg-green-600/20 text-green-400"),title:"Copy",children:jsx(LuCopy,{className:Qe})}),t.onToggleFormatPainter&&jsx("button",{type:"button",onClick:t.onToggleFormatPainter,disabled:!t.canEdit||t.canActivateFormatPainter===false&&!t.formatPainterActive,"data-testid":"format-painter-toggle",className:le(Js,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Format Painter",children:jsx(LuPaintbrush,{className:Qe})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Clipboard"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"relative inline-flex items-center",ref:d,children:[jsxs("button",{type:"button",onClick:x,disabled:!t.canEdit||t.layoutOptions.length===0,className:le(ft,"whitespace-nowrap",t.layoutOptions.length>0?"rounded-r-none":""),title:"New Slide",children:[jsx(LuPlus,{className:Qe}),"New Slide"]}),t.layoutOptions.length>0&&jsx("button",{type:"button",disabled:!t.canEdit,className:"inline-flex items-center justify-center self-stretch px-1 rounded-r bg-muted hover:bg-accent text-xs transition-colors border-l border-border/40 active:scale-95 active:opacity-80",title:"Choose layout",onClick:()=>n(y=>!y),children:jsx(LuChevronDown,{className:"w-3 h-3"})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:t.layoutOptions.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onInsertSlideFromLayout(y.path,y.name),n(false);},children:y.name},y.path))})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Slides"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",ref:p,children:[jsxs("button",{type:"button",onClick:()=>o(y=>!y),className:"inline-flex items-center justify-between px-2 py-1 rounded-sm border border-border/60 bg-background/60 text-[11px] text-foreground min-w-[120px] truncate hover:bg-accent/40 transition-colors cursor-pointer",children:[jsx("span",{className:"truncate",children:h}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),r&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:lje.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",style:{fontFamily:y},onClick:()=>{t.onUpdateTextStyle?.({fontFamily:y}),o(false);},children:y},y))})})]}),jsxs("div",{className:"relative",ref:f,children:[jsxs("button",{type:"button",onClick:()=>s(y=>!y),className:"inline-flex items-center justify-between px-2 py-1 rounded-sm border border-border/60 bg-background/60 text-[11px] text-foreground min-w-[50px] text-center hover:bg-accent/40 transition-colors cursor-pointer",children:[jsx("span",{className:"truncate",children:m}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),i&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:cje.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onUpdateTextStyle?.({fontSize:y}),s(false);},children:y},y))})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),Un]})}function $I(t){let{t:e}=useTranslation(),{canEdit:n}=t,[r,o]=useState(false),[i,s]=useState(""),[a,l]=useState("locale"),c=useRef(null),u=useCallback(()=>{let p=new Date,f=h=>String(h).padStart(2,"0");s(`${p.getFullYear()}-${f(p.getMonth()+1)}-${f(p.getDate())}T${f(p.getHours())}:${f(p.getMinutes())}`),l("locale"),o(true);},[]),d=useCallback(()=>{if(!t.onInsertField)return;let p=new Date(i);if(isNaN(p.getTime()))return;let f;switch(a){case "iso":f=p.toISOString().slice(0,10);break;case "long":f=p.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"});break;case "short":f=p.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});break;case "time":f=p.toLocaleString();break;default:f=p.toLocaleDateString();break}t.onInsertField("datetime",f),o(false);},[i,a,t]);return useEffect(()=>{if(!r)return;let p=f=>{c.current&&!c.current.contains(f.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]),jsxs(Fragment,{children:[jsxs("button",{onClick:t.onAddTextBox,disabled:!n,className:ft,title:"Add text box",children:[jsx(LuType,{className:Qe}),"Text"]}),jsxs("div",{className:Ji,children:[jsx("select",{value:t.newShapeType,onChange:p=>t.onSetNewShapeType(p.target.value),className:"bg-transparent py-1.5 pl-2 pr-1 outline-none text-xs",title:"Shape type",children:m1.map(p=>jsx("option",{value:p.type,className:"bg-background",children:p.label},p.type))}),jsxs("button",{onClick:t.onAddShape,disabled:!n,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 border-l border-border hover:bg-accent transition-colors text-xs",title:"Add shape",children:[m1.find(p=>p.type===t.newShapeType)?.icon||jsx(LuSquare,{className:Qe}),"Shape"]})]}),jsxs("button",{onClick:t.onOpenImagePicker,disabled:!n,className:ft,title:"Insert image",children:[jsx(LuImage,{className:Qe}),"Image"]}),jsxs("button",{onClick:t.onOpenMediaPicker,disabled:!n,className:ft,title:"Insert audio or video",children:[jsx(LuVideo,{className:Qe}),"Media"]}),jsxs("button",{onClick:t.onAddTable,disabled:!n,className:ft,title:"Insert table",children:[jsx(LuDatabase,{className:Qe}),"Table"]}),jsxs("button",{onClick:t.onAddSmartArt,disabled:!n,className:ft,title:"Insert SmartArt",children:[jsx(LuLayers,{className:Qe}),"SmartArt"]}),jsxs("button",{onClick:t.onAddEquation,disabled:!n,className:ft,title:"Insert Equation",children:[jsx("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M4 17h6M7 14v6M14 7l4.5 10M15.5 14h5"})}),"Equation"]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:ft,title:"Insert action button",children:[jsxs("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M13 7l4 5-4 5"})]}),"Action",jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-40 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:Lm.map(p=>jsxs("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onAddActionButton(p.shapeType),children:[jsx("svg",{className:"w-4 h-4 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:p.iconPath})}),p.label]},p.shapeType))})})]}),t.onInsertField&&jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:ft,title:e("pptx.field.insertField"),children:[jsxs("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M4 7h16M4 12h10M4 17h12"}),jsx("circle",{cx:"19",cy:"15",r:"3"})]}),e("pptx.field.field"),jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-44 pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:[jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("slidenum"),children:e("pptx.field.slideNumber")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:u,children:e("pptx.field.dateTime")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("header"),children:e("pptx.field.header")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("footer"),children:e("pptx.field.footer")})]})})]}),r&&jsx("div",{ref:c,className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/30",onMouseDown:p=>{p.target===p.currentTarget&&o(false);},children:jsxs("div",{className:"rounded-lg border border-border bg-popover shadow-2xl p-4 w-72 space-y-3",children:[jsx("div",{className:"text-sm font-medium text-foreground",children:e("pptx.field.dateTime")}),jsx("input",{type:"datetime-local",className:"w-full rounded border border-border bg-muted px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:i,onChange:p=>s(p.target.value)}),jsxs("div",{children:[jsx("label",{className:"block text-[11px] text-muted-foreground mb-1",children:e("pptx.field.format","Format")}),jsxs("select",{className:"w-full rounded border border-border bg-muted px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:a,onChange:p=>l(p.target.value),children:[jsx("option",{value:"locale",children:new Date(i||Date.now()).toLocaleDateString()}),jsx("option",{value:"long",children:new Date(i||Date.now()).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsx("option",{value:"short",children:new Date(i||Date.now()).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}),jsx("option",{value:"iso",children:new Date(i||Date.now()).toISOString().slice(0,10)}),jsx("option",{value:"time",children:new Date(i||Date.now()).toLocaleString()})]})]}),jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded border border-border text-foreground hover:bg-muted transition-colors",onClick:()=>o(false),children:e("pptx.common.cancel","Cancel")}),jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded bg-primary text-white hover:bg-primary/90 transition-colors",onClick:d,children:e("pptx.common.insert","Insert")})]})]})})]})}function HI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:()=>t.onSetMode("present"),className:ft,title:"Start slide show from beginning",children:[jsx(LuPlay,{className:Qe}),"From Beginning"]}),jsxs("button",{onClick:t.onPresent,className:ft,title:"Start slide show from current slide",children:[jsx(LuPlay,{className:Qe}),"From Current Slide"]}),Un,jsxs("button",{onClick:t.onEnterPresenterView,className:ft,title:"Presenter view",children:[jsx(LuMonitor,{className:Qe}),"Presenter View"]}),jsxs("button",{onClick:t.onEnterRehearsalMode,className:ft,title:"Rehearse timings",children:[jsx(LuClock,{className:Qe}),"Rehearse Timings"]}),Un,jsxs("button",{onClick:t.onOpenSetUpSlideShow,className:ft,title:"Set up slide show",children:[jsx(LuSettings,{className:Qe}),"Set Up Slide Show"]}),jsxs("button",{onClick:t.onOpenBroadcastDialog,className:ft,title:"Broadcast slide show",children:[jsx(LuCast,{className:Qe}),"Broadcast"]}),Un,jsxs("button",{onClick:t.onToggleSubtitles,className:le(ft,t.showSubtitles?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle subtitles",children:[jsx(LuCaptions,{className:Qe}),"Subtitles"]})]})}function Lje(t,e){if(t){if(ot(t))return t.textStyle;if(t.type==="table"&&e&&t.tableData)return t.tableData.rows[e.rowIndex]?.cells[e.columnIndex]?.style}}var Fje=["#000000","#ffffff","#ff0000","#00aa00","#0000ff","#ff8800","#8800cc","#00cccc","#ff69b4","#808080"],Bje=["#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff","#ff0000","#000080","#008080","#008000","#800080"];function zI(t){let e=!!t.selectedElement,n=e&&t.canEdit,r=e&&t.selectedElement!==null&&ot(t.selectedElement),o=e&&t.selectedElement?.type==="table",i=r||o,s=Lje(t.selectedElement,t.tableEditorState),a=r&&t.selectedElement&&ot(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.color??t.selectedElement.textStyle?.color??"#000000":s?.color??"#000000",l=r&&t.selectedElement&&ot(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.highlightColor??t.selectedElement.textStyle?.highlightColor??"#ffff00":"#ffff00",c=useRef(null),u=useRef(null),d=useCallback(f=>{i&&t.onUpdateTextStyle({color:f});},[i,t]),p=useCallback(f=>{i&&t.onUpdateTextStyle({highlightColor:f});},[i,t]);return jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("div",{className:Ji,children:Aie.map((f,h,m)=>jsx("button",{type:"button",disabled:!n,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let y=s;switch(f.t){case "Bold":t.onUpdateTextStyle({bold:!y?.bold});break;case "Italic":t.onUpdateTextStyle({italic:!y?.italic});break;case "Underline":t.onUpdateTextStyle({underline:!y?.underline});break;case "Strikethrough":t.onUpdateTextStyle({strikethrough:!y?.strikethrough});break}},className:h<m.length-1?Po:Js,title:f.t,children:f.i},f.t))}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.fontSize??18;t.onUpdateTextStyle({fontSize:f+2});},className:Po,title:"Increase Font Size",children:jsx(LuAArrowUp,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.fontSize??18;t.onUpdateTextStyle({fontSize:Math.max(1,f-2)});},className:Po,title:"Decrease Font Size",children:jsx(LuAArrowDown,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{i&&t.onUpdateTextStyle({bold:false,italic:false,underline:false,strikethrough:false,highlightColor:void 0});},className:Js,title:"Clear Formatting",children:jsx(LuRemoveFormatting,{className:Qe})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),className:ft,title:"Font Color",children:[jsx("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M6 20h12M9.5 4h5L18 16H6L9.5 4z"})}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:a}})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 w-36",children:[jsx("div",{className:"grid grid-cols-5 gap-1.5 mb-2",children:Fje.map(f=>jsx("button",{type:"button",className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${a?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:h=>h.preventDefault(),onClick:()=>d(f)},f))}),jsx("button",{type:"button",className:"w-full text-[10px] text-muted-foreground hover:text-foreground py-1 transition-colors",onMouseDown:f=>f.preventDefault(),onClick:()=>c.current?.click(),children:"Custom colour..."}),jsx("input",{ref:c,type:"color",className:"sr-only",value:a,onChange:f=>d(f.target.value)})]})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),className:ft,title:"Text Highlight Color",children:[jsx(LuHighlighter,{className:Qe}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:l}})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 w-36",children:[jsx("div",{className:"grid grid-cols-5 gap-1.5 mb-2",children:Bje.map(f=>jsx("button",{type:"button",className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${l?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:h=>h.preventDefault(),onClick:()=>p(f)},f))}),jsx("button",{type:"button",className:"w-full text-[10px] text-muted-foreground hover:text-foreground py-1 transition-colors",onMouseDown:f=>f.preventDefault(),onClick:()=>u.current?.click(),children:"Custom colour..."}),jsx("input",{ref:u,type:"color",className:"sr-only",value:l,onChange:f=>p(f.target.value)})]})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{!i||!t.selectedElement||t.onUpdateTextStyle({listType:s?.listType==="bullet"?"none":"bullet"});},className:Po,title:"Bullet List",children:jsx(LuList,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{!i||!t.selectedElement||t.onUpdateTextStyle({listType:s?.listType==="numbered"?"none":"numbered"});},className:Js,title:"Numbered List",children:jsx(LuListOrdered,{className:Qe})})]}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:Math.max(0,f-24)});},className:Po,title:"Decrease Indent",children:jsx(LuIndentDecrease,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:f+24});},className:Js,title:"Increase Indent",children:jsx(LuIndentIncrease,{className:Qe})})]}),jsx("div",{className:Ji,children:Pie.map((f,h,m)=>jsx("button",{type:"button",disabled:!n,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!i)return;let v={"Align left":"left","Align center":"center","Align right":"right",Justify:"justify"}[f.t];v&&t.onUpdateTextStyle({align:v});},className:h<m.length-1?Po:Js,title:f.t,children:f.i},f.t))})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Paragraph"})]})]})}function GI(t){let{t:e}=useTranslation();return jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:ft,title:"Normal view",children:"Normal"}),t.onToggleSlideSorter?jsx("button",{className:ft,onClick:t.onToggleSlideSorter,title:"Slide Sorter view",children:"Slide Sorter"}):jsx("button",{className:ft,title:"Slide Sorter view",children:"Slide Sorter"}),jsx("button",{className:ft,title:"Reading View",children:"Reading View"})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Presentation Views"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("div",{className:"flex items-center gap-0.5",children:jsx("button",{onClick:t.onEnterMasterView,disabled:!t.canEdit,className:ft,title:"Edit slide masters and layouts",children:"Slide Master"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Master Views"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("div",{className:"flex items-center gap-0.5",children:t.onZoomToFit&&jsx("button",{className:ft,onClick:t.onZoomToFit,title:"Zoom to fit slide in window",children:"Zoom to Fit"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Zoom"})]}),Un,jsx("button",{onClick:()=>t.onSetEditTemplateMode(!t.editTemplateMode),disabled:!t.canEdit,className:le(ft,t.editTemplateMode?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Toggle template/master element editing",children:t.editTemplateMode?"Templates On":"Templates Off"}),t.onToggleSelectionPane&&jsxs("button",{type:"button",onClick:t.onToggleSelectionPane,className:le(ft,t.isSelectionPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Selection Pane",children:[jsx(LuList,{className:Qe}),"Selection"]}),t.onToggleEyedropper&&jsxs("button",{type:"button",onClick:t.onToggleEyedropper,disabled:!t.canEdit,className:le(ft,t.eyedropperActive?"bg-purple-600 hover:bg-purple-500 text-purple-50":""),title:"Eyedropper \u2014 sample a colour from the slide",children:[jsx(LuPipette,{className:Qe}),"Eyedropper"]}),jsx("button",{onClick:()=>t.onSetShowGrid(!t.showGrid),className:le(ft,t.showGrid?"bg-primary text-white":""),title:e("pptx.grid.toggleGrid"),children:e("pptx.grid.grid")}),jsx("button",{onClick:()=>t.onSetShowRulers(!t.showRulers),className:le(ft,t.showRulers?"bg-primary text-white":""),title:e("pptx.ruler.toggleRulers"),children:e("pptx.ruler.rulers")}),jsx("button",{onClick:()=>t.onSetSnapToGrid(!t.snapToGrid),className:le(ft,t.snapToGrid?"bg-primary text-white":""),title:e("pptx.grid.snapToGrid"),children:e("pptx.grid.snapToGrid")}),jsx("button",{onClick:()=>t.onSetSnapToShape(!t.snapToShape),className:le(ft,t.snapToShape?"bg-primary text-white":""),title:e("pptx.grid.snapToShape"),children:e("pptx.grid.snapToShape")}),jsx("button",{onClick:()=>t.onAddGuide("h"),className:ft,title:"Add horizontal guide",children:"H Guide"}),jsx("button",{onClick:()=>t.onAddGuide("v"),className:ft,title:"Add vertical guide",children:"V Guide"}),jsx("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:le(ft,t.spellCheckEnabled?"bg-primary text-white":""),title:"Toggle spell check",children:"Spell"})]})}function VI({open:t,onClose:e,title:n,children:r,heightFraction:o=.6,fullScreen:i=false,className:s,headerRight:a}){let l=useRef(null),[c,u]=useState(0),d=useRef(null),p=useCallback(x=>{d.current=x.clientY,x.target.setPointerCapture?.(x.pointerId);},[]),f=useCallback(x=>{if(d.current===null)return;let y=x.clientY-d.current;u(Math.max(0,y));},[]),h=useCallback(x=>{if(d.current===null)return;let y=x.clientY-d.current;d.current=null,x.target.releasePointerCapture?.(x.pointerId),y>120&&e(),u(0);},[e]);if(useEffect(()=>{if(!t)return;let x=y=>{y.key==="Escape"&&e();};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[t,e]),!t)return null;let m=i?{height:"calc(100dvh - env(safe-area-inset-top))"}:{height:`${Math.round(o*100)}dvh`};return jsxs("div",{className:"fixed inset-0 z-50 flex flex-col justify-end md:hidden",role:"dialog","aria-modal":"true",children:[jsx("button",{type:"button","aria-label":"Close",className:"absolute inset-0 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150",onClick:e}),jsxs("div",{ref:l,className:le("relative bg-background border-t border-border rounded-t-2xl shadow-2xl flex flex-col overflow-hidden","animate-in slide-in-from-bottom duration-200",s),style:{...m,transform:c>0?`translateY(${c}px)`:void 0,transition:d.current===null?"transform 150ms ease-out":"none"},children:[jsx("div",{className:"flex items-center justify-center pt-2 pb-1 cursor-grab active:cursor-grabbing touch-none",onPointerDown:p,onPointerMove:f,onPointerUp:h,onPointerCancel:h,children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),(n||a)&&jsxs("div",{className:"flex items-center justify-between gap-2 px-4 pb-2 border-b border-border/60",children:[jsx("div",{className:"text-sm font-semibold text-foreground truncate",children:n}),a]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain",children:r})]})]})}var iXe=[{key:"home",label:"Home",icon:LuClipboardCopy},{key:"insert",label:"Insert",icon:LuPlus},{key:"text",label:"Text",icon:LuType},{key:"draw",label:"Draw",icon:LuPaintbrush},{key:"arrange",label:"Arrange",icon:LuShapes},{key:"design",label:"Design",icon:LuLayoutGrid},{key:"transitions",label:"Transitions",icon:LuSparkles},{key:"animations",label:"Animations",icon:LuWand},{key:"slideShow",label:"Slide Show",icon:LuPresentation},{key:"review",label:"Review",icon:LuTextCursorInput},{key:"view",label:"View",icon:LuSettings},{key:"file",label:"File",icon:LuFile}];function $ie(t){let{open:e,onClose:n}=t,[r,o]=useState("home");return jsx(VI,{open:e,onClose:n,fullScreen:true,title:"Menu",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"sticky top-0 z-10 bg-background border-b border-border",children:jsx("div",{className:"flex gap-1.5 overflow-x-auto px-3 py-2 scrollbar-none",children:iXe.map(({key:i,label:s,icon:a})=>jsxs("button",{type:"button",onClick:()=>o(r===i?null:i),className:le("inline-flex items-center gap-1.5 shrink-0 px-3 py-2 rounded-full text-[12px] font-medium border transition-colors min-h-[36px]",r===i?"bg-primary text-white border-primary":"border-border text-muted-foreground hover:text-foreground hover:bg-accent/40"),children:[jsx(a,{className:"w-4 h-4"}),s]},i))})}),jsx("div",{className:"p-3",children:jsx(sXe,{active:r,...t})})]})})}function sXe({active:t,...e}){let n="flex flex-wrap items-center gap-2";switch(t){case "home":return jsx("div",{className:n,children:jsx(UI,{canEdit:e.canEdit,clipboardPayload:e.clipboardPayload,formatPainterActive:e.formatPainterActive,canActivateFormatPainter:e.canActivateFormatPainter,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onToggleFormatPainter:e.onToggleFormatPainter,layoutOptions:e.layoutOptions,onInsertSlideFromLayout:e.onInsertSlideFromLayout,selectedElement:e.selectedElement,onUpdateTextStyle:e.onUpdateTextStyle})});case "insert":return jsx("div",{className:n,children:jsx($I,{canEdit:e.canEdit,newShapeType:e.newShapeType,onSetNewShapeType:e.onSetNewShapeType,onAddTextBox:e.onAddTextBox,onAddShape:e.onAddShape,onAddTable:e.onAddTable,onAddSmartArt:e.onAddSmartArt,onAddEquation:e.onAddEquation,onAddActionButton:e.onAddActionButton,onInsertField:e.onInsertField,onOpenImagePicker:e.onOpenImagePicker,onOpenMediaPicker:e.onOpenMediaPicker})});case "text":return jsx("div",{className:n,children:jsx(zI,{canEdit:e.canEdit,selectedElement:e.selectedElement,tableEditorState:e.tableEditorState,onUpdateTextStyle:e.onUpdateTextStyle})});case "draw":return jsx("div",{className:n,children:jsx(BI,{activeTool:e.activeTool,drawingColor:e.drawingColor,drawingWidth:e.drawingWidth,onSetActiveTool:e.onSetActiveTool,onSetDrawingColor:e.onSetDrawingColor,onSetDrawingWidth:e.onSetDrawingWidth})});case "arrange":return jsx("div",{className:n,children:jsx(II,{canEdit:e.canEdit,selectedElement:e.selectedElement,clipboardPayload:e.clipboardPayload,onAlignElements:e.onAlignElements,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onFlip:e.onFlip,onMoveLayer:e.onMoveLayer,onMoveLayerToEdge:e.onMoveLayerToEdge,onDuplicate:e.onDuplicate,onDelete:e.onDelete,formatPainterActive:e.formatPainterActive,onToggleFormatPainter:e.onToggleFormatPainter,canActivateFormatPainter:e.canActivateFormatPainter})});case "design":return jsx("div",{className:n,children:jsx(NI,{canEdit:e.canEdit,onToggleThemeGallery:e.onToggleThemeGallery,isThemeGalleryOpen:e.isThemeGalleryOpen,onToggleThemeEditor:e.onToggleThemeEditor,isThemeEditorOpen:e.isThemeEditorOpen,onOpenDocumentProperties:e.onOpenDocumentProperties,onToggleInspector:e.onToggleInspector,isInspectorPaneOpen:e.isInspectorPaneOpen})});case "transitions":return jsx("div",{className:n,children:jsx(DI,{isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector})});case "animations":return jsx("div",{className:n,children:jsx(kI,{canEdit:e.canEdit,selectedElement:e.selectedElement,isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector,onOpenAnimationPanel:e.onOpenAnimationPanel,onAddAnimation:e.onAddAnimation,onRemoveAnimation:e.onRemoveAnimation})});case "slideShow":return jsx("div",{className:n,children:jsx(HI,{onPresent:()=>e.onSetMode("present"),onEnterPresenterView:e.onEnterPresenterView??(()=>{}),onEnterRehearsalMode:e.onEnterRehearsalMode??(()=>{}),onOpenSetUpSlideShow:e.onOpenSetUpSlideShow??(()=>{}),onOpenBroadcastDialog:e.onOpenBroadcastDialog??(()=>{}),onToggleSubtitles:e.onToggleSubtitles??(()=>{}),showSubtitles:e.showSubtitles??false,onSetMode:e.onSetMode})});case "review":return jsx("div",{className:n,children:jsx(LI,{canEdit:e.canEdit,spellCheckEnabled:e.spellCheckEnabled,onSetSpellCheckEnabled:e.onSetSpellCheckEnabled,onToggleComments:e.onToggleComments,isCommentsPanelOpen:e.isCommentsPanelOpen,slideCommentCount:e.slideCommentCount,onCompare:e.onCompare})});case "view":return jsx("div",{className:n,children:jsx(GI,{canEdit:e.canEdit,editTemplateMode:e.editTemplateMode,onSetEditTemplateMode:e.onSetEditTemplateMode,spellCheckEnabled:e.spellCheckEnabled,onSetSpellCheckEnabled:e.onSetSpellCheckEnabled,showGrid:e.showGrid,showRulers:e.showRulers,snapToGrid:e.snapToGrid,snapToShape:e.snapToShape,onSetShowGrid:e.onSetShowGrid,onSetShowRulers:e.onSetShowRulers,onSetSnapToGrid:e.onSetSnapToGrid,onSetSnapToShape:e.onSetSnapToShape,onAddGuide:e.onAddGuide,onEnterMasterView:e.onEnterMasterView,isSelectionPaneOpen:e.isSelectionPaneOpen,onToggleSelectionPane:e.onToggleSelectionPane,eyedropperActive:e.eyedropperActive,onToggleEyedropper:e.onToggleEyedropper})});case "file":return jsx("div",{className:n,children:jsx(OI,{onExportPng:e.onExportPng,onExportPdf:e.onExportPdf,onExportVideo:e.onExportVideo,onExportGif:e.onExportGif,onPackageForSharing:e.onPackageForSharing,onSaveAsPptx:e.onSaveAsPptx,onSaveAsPpsx:e.onSaveAsPpsx,onSaveAsPptm:e.onSaveAsPptm,hasMacros:e.hasMacros,onCopySlideAsImage:e.onCopySlideAsImage,onPrint:e.onPrint,onOpenDocumentProperties:e.onOpenDocumentProperties,onOpenPasswordProtection:e.onOpenPasswordProtection,onOpenFontEmbedding:e.onOpenFontEmbedding,onOpenDigitalSignatures:e.onOpenDigitalSignatures})});default:return jsxs("div",{className:"text-center text-sm text-muted-foreground py-8",children:[jsx(LuChevronRight,{className:"w-5 h-5 inline-block opacity-50"})," Select a section above"]})}}function zie(t){let{t:e}=useTranslation(),{mode:n,canUndo:r,canRedo:o,onUndo:i,onRedo:s,onSetMode:a}=t,[l,c]=useState(false),u=n==="edit"||n==="master",d="inline-flex items-center justify-center min-w-[44px] min-h-[44px] rounded-md text-foreground/80 hover:bg-accent/60 disabled:opacity-40 disabled:cursor-not-allowed active:scale-95 transition-transform";return jsxs("div",{role:"toolbar","aria-label":"Toolbar",className:"relative z-20 flex items-center gap-1 px-2 py-1 border-b border-border bg-secondary/50 min-h-[52px] pt-[max(env(safe-area-inset-top),0px)]",children:[u&&jsx("button",{type:"button",onClick:()=>c(true),className:d,title:"Menu","aria-label":"Menu",children:jsx(LuMenu,{className:"w-5 h-5"})}),u&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:i,disabled:!r,className:d,title:e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:s,disabled:!o,className:d,title:e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex-1"}),jsx("button",{type:"button",onClick:()=>a("present"),className:le(d,"text-primary"),title:e("pptx.toolbar.present"),"aria-label":e("pptx.toolbar.present"),children:jsx(LuPresentation,{className:"w-5 h-5"})}),u&&jsx("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:le(d,"bg-primary text-white hover:bg-primary/90 px-3"),title:e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:jsx(LuShare2,{className:"w-4 h-4"})}),jsx($ie,{open:l,onClose:()=>c(false),...t})]})}function Gie({customShows:t,activeCustomShowId:e,canEdit:n,isCurrentSlideInActiveShow:r,onSetActiveCustomShowId:o,onCreateCustomShow:i,onRenameActiveCustomShow:s,onDeleteActiveCustomShow:a,onToggleCurrentSlideInActiveShow:l}){return t.length>0?jsxs(Fragment,{children:[Un,jsxs("select",{value:e??"",onChange:c=>o(c.target.value||null),className:"h-6 px-1.5 text-[11px] rounded bg-muted text-foreground border border-border hover:bg-accent transition-colors cursor-pointer",title:"Custom show","aria-label":"Select custom show",children:[jsx("option",{value:"",children:"All Slides"}),t.map(c=>jsx("option",{value:c.id,children:c.name},c.id))]}),n&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:i,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Create custom show",children:"+ Show"}),e&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:s,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Rename active custom show",children:"Rename"}),jsx("button",{type:"button",onClick:a,className:"px-2 py-1 rounded bg-red-700/80 hover:bg-red-600 text-[11px] transition-colors",title:"Delete active custom show",children:"Delete"}),jsx("button",{type:"button",onClick:l,className:le("px-2 py-1 rounded text-[11px] transition-colors",r?"bg-primary text-white":"bg-muted hover:bg-accent"),title:"Include/exclude current slide in active custom show",children:r?"In Show":"Add Slide"})]})]})]}):n?jsxs(Fragment,{children:[Un,jsx("button",{type:"button",onClick:i,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Create custom show",children:"+ Show"})]}):null}function Vie({isActive:t,onPresent:e,onPresenterView:n,onRehearse:r,onSetUpSlideShow:o,onBroadcast:i,onToggleSubtitles:s,showSubtitles:a}){let[l,c]=useState(false);return jsxs("div",{className:"relative",children:[jsxs("div",{className:"inline-flex border-l border-border",children:[jsx("button",{type:"button",onClick:e,className:le("px-2 py-1 transition-colors",t?"bg-primary text-white":"hover:bg-accent text-foreground"),title:"Present (fullscreen)",children:"Present"}),jsx("button",{type:"button",onClick:()=>c(u=>!u),className:le("px-1 py-1 transition-colors border-l border-border",l?"bg-primary text-white":"hover:bg-accent text-foreground"),title:"Presentation options","aria-label":"Presentation options",children:jsx(LuChevronDown,{className:"w-3 h-3"})})]}),l&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":"Close menu",onClick:()=>c(false)}),jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-52 rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:[jsxs("button",{type:"button",onClick:()=>{c(false),e();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuPlay,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Present"]}),n&&jsxs("button",{type:"button",onClick:()=>{c(false),n();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuMonitor,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Presenter View"]}),r&&jsxs("button",{type:"button",onClick:()=>{c(false),r();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuClock,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Rehearse Timings"]}),jsx("div",{className:"my-1 border-t border-border/60"}),o&&jsxs("button",{type:"button",onClick:()=>{c(false),o();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuSettings,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Set Up Slide Show"]}),i&&jsxs("button",{type:"button",onClick:()=>{c(false),i();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuRadio,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Present Online"]}),s&&jsxs("button",{type:"button",onClick:()=>{c(false),s();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuCaptions,{className:"w-3.5 h-3.5 text-muted-foreground"}),jsx("span",{className:"flex-1 text-left",children:"Subtitles"}),a&&jsx(LuCheck,{className:"w-3 h-3 text-primary"})]})]})]})]})}function jie({mode:t,onSetMode:e,onCloseMasterView:n,onEnterPresenterView:r,onEnterRehearsalMode:o,onOpenSetUpSlideShow:i,onOpenBroadcastDialog:s,onToggleSubtitles:a,showSubtitles:l}){return t==="master"?jsxs("div",{className:"inline-flex items-center gap-1.5",children:[jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm bg-amber-600/90 text-[10px] text-amber-50",children:"Master View"}),jsx("button",{type:"button",onClick:n,className:"px-2 py-0.5 rounded-sm hover:bg-accent text-[10px] text-foreground transition-colors",title:"Close master view",children:"Close"})]}):jsx(Vie,{isActive:t==="present",onPresent:()=>e("present"),onPresenterView:r,onRehearse:o,onSetUpSlideShow:i,onBroadcast:s,onToggleSubtitles:a,showSubtitles:l})}function Xie(t){let e=n=>{t.onSetOverflowMenuOpen(false),{png:t.onExportPng,pdf:t.onExportPdf,video:t.onExportVideo,gif:t.onExportGif,package:t.onPackageForSharing,pptx:t.onSaveAsPptx,ppsx:t.onSaveAsPpsx,pptm:t.onSaveAsPptm,print:t.onPrint,copyImg:t.onCopySlideAsImage,a11y:t.onRunAccessibilityCheck,shortcuts:t.onToggleShortcuts,versionHistory:t.onToggleVersionHistory,documentProperties:t.onOpenDocumentProperties,passwordProtection:t.onOpenPasswordProtection,fontEmbedding:t.onOpenFontEmbedding,digitalSignatures:t.onOpenDigitalSignatures}[n]?.();};return jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>t.onSetOverflowMenuOpen(!t.isOverflowMenuOpen),className:le("p-1.5 rounded transition-colors",t.isOverflowMenuOpen?"bg-primary/80 text-white":"bg-muted hover:bg-accent"),title:"More actions","aria-label":"More actions",children:jsx(LuEllipsis,{className:Qe})}),t.isOverflowMenuOpen&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":"Close menu",onClick:()=>t.onSetOverflowMenuOpen(false)}),jsx("div",{className:"absolute right-0 top-full mt-1 z-50 w-44 rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:Eie.filter(n=>n.k!=="pptm"||t.hasMacros).map(n=>n.k.startsWith("---")?jsx("div",{className:"my-1 border-t border-border/60"},n.k):jsxs("button",{type:"button",onClick:()=>e(n.k),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[n.i,n.l]},n.k))})]})]})}function Wie(t){let{t:e}=useTranslation(),{mode:n,canEdit:r,isSidebarCollapsed:o,isInspectorPaneOpen:i,canUndo:s,canRedo:a,undoLabel:l,redoLabel:c,findReplaceOpen:u,onToggleSidebar:d,onToggleInspector:p,onUndo:f,onRedo:h,onToggleFindReplace:m}=t,x=qi(),y="p-1 max-md:p-2 max-md:min-h-[40px] max-md:min-w-[40px] rounded-sm transition-colors hover:bg-accent/60 disabled:opacity-40 disabled:cursor-not-allowed active:scale-90 active:opacity-70";return jsxs("div",{className:"flex items-center gap-0.5 max-md:gap-0 px-1.5 py-0.5 max-md:px-1",children:[n!=="present"&&jsx("button",{type:"button",onClick:d,className:le(y,o?"text-muted-foreground":"text-foreground"),title:e("pptx.toolbar.toggleSlidesPanel"),"aria-label":e("pptx.toolbar.toggleSlidesPanel"),children:jsx(LuPanelLeft,{className:Qe})}),Un,jsx("button",{type:"button",onClick:f,disabled:!r||!s,className:le(y,"text-muted-foreground"),title:l?e("pptx.toolbar.undoAction",{action:l}):e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:lr})}),jsx("button",{type:"button",onClick:h,disabled:!r||!a,className:le(y,"text-muted-foreground"),title:c?e("pptx.toolbar.redoAction",{action:c}):e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:lr})}),(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:m,className:le(y,"max-md:hidden",u?"text-foreground":"text-muted-foreground"),title:e("pptx.findReplace.title"),"aria-label":e("pptx.findReplace.title"),children:jsx(LuSearch,{className:lr})}),jsx("div",{className:"flex-1 min-w-2 max-md:min-w-1"}),(n==="edit"||n==="master")&&jsxs("button",{type:"button",onClick:t.onToggleComments,className:le(y,"relative max-md:hidden",t.isCommentsPanelOpen?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.comments"),"aria-label":e("pptx.toolbar.comments"),children:[jsx(LuMessageSquare,{className:lr}),(t.slideCommentCount??0)>0&&jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center w-3.5 h-3.5 rounded-full bg-primary text-[8px] text-white leading-none",children:t.slideCommentCount})]}),x&&(x.status==="connected"||x.status==="connecting")&&x.remoteUsers.length>0&&jsxs("button",{type:"button",onClick:t.onOpenShareDialog,className:"flex items-center -space-x-1.5 mx-1 rounded-sm px-1 py-0.5 hover:bg-accent/60 transition-colors cursor-pointer",title:e("pptx.toolbar.sharingUsers",{count:x.connectedCount}),children:[x.remoteUsers.slice(0,4).map(v=>jsx("div",{className:"w-6 h-6 rounded-full border-2 border-background flex items-center justify-center text-[8px] font-semibold text-white shrink-0",style:{backgroundColor:v.userColor},title:v.userName,children:v.userAvatar?jsx("img",{src:v.userAvatar,alt:v.userName,className:"w-full h-full rounded-full object-cover"}):v.userName.slice(0,2).toUpperCase()},v.clientId)),x.remoteUsers.length>4&&jsxs("div",{className:"w-6 h-6 rounded-full border-2 border-background bg-muted flex items-center justify-center text-[8px] text-muted-foreground shrink-0",children:["+",x.remoteUsers.length-4]})]}),jsx(jie,{mode:t.mode,onSetMode:t.onSetMode,onCloseMasterView:t.onCloseMasterView,onToggleSlideSorter:t.onToggleSlideSorter,onEnterPresenterView:t.onEnterPresenterView,onEnterRehearsalMode:t.onEnterRehearsalMode,onOpenSetUpSlideShow:t.onOpenSetUpSlideShow,onOpenBroadcastDialog:t.onOpenBroadcastDialog,onToggleSubtitles:t.onToggleSubtitles,showSubtitles:t.showSubtitles}),jsx(Gie,{customShows:t.customShows,activeCustomShowId:t.activeCustomShowId,canEdit:t.canEdit,isCurrentSlideInActiveShow:t.isCurrentSlideInActiveShow,onSetActiveCustomShowId:t.onSetActiveCustomShowId,onCreateCustomShow:t.onCreateCustomShow,onRenameActiveCustomShow:t.onRenameActiveCustomShow,onDeleteActiveCustomShow:t.onDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:t.onToggleCurrentSlideInActiveShow}),Un,(n==="edit"||n==="master")&&jsxs("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:le("relative inline-flex items-center gap-1 px-2.5 py-1 rounded-sm text-[11px] font-medium transition-colors",x&&x.status==="connected"?"bg-green-600 hover:bg-green-500 text-white":"bg-primary hover:bg-primary/90 text-white"),title:x&&x.status==="connected"?e("pptx.toolbar.sharingUsers",{count:x.connectedCount}):e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:[jsx(LuShare2,{className:"w-3 h-3"}),jsx("span",{className:"max-md:hidden",children:x&&x.status==="connected"?e("pptx.toolbar.sharingCount",{count:x.connectedCount}):e("pptx.toolbar.share")})]}),(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:p,className:le(y,i?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.toggleInspector"),"aria-label":e("pptx.toolbar.toggleInspector"),children:jsx(LuPanelRight,{className:Qe})}),jsx("button",{type:"button",onClick:t.onOpenSettings??t.onToggleShortcuts,className:le(y,"text-muted-foreground"),title:e("pptx.toolbar.settingsShortcuts"),"aria-label":e("pptx.toolbar.settings"),children:jsx(LuSettings,{className:lr})}),!r&&jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm bg-amber-600/90 text-[10px] text-amber-50",children:e("pptx.toolbar.readOnly")}),jsx(Xie,{...t})]})}function R8(t){let{mode:e,isNarrowViewport:n,isCompactToolbarOpen:r,toolbarSection:o,onSetToolbarSection:i}=t;if(n&&e!=="present")return jsx(zie,{...t});let s=o==="file",a=o==="home",l=o==="insert",c=a||o==="text",u=o==="arrange",d=o==="draw",p=o==="design",f=o==="transitions",h=o==="animations",m=o==="slideShow",x=o==="review",y=o==="view",v=o==="help",S=e==="edit"||e==="master";return jsxs("div",{role:"toolbar","aria-label":"Presentation toolbar",className:"relative z-20 border-b border-border bg-secondary/50 overflow-visible",children:[jsx(Wie,{...t}),S&&jsxs("div",{className:"flex items-center border-b border-border/60 px-1 max-md:overflow-x-auto max-md:scrollbar-none",children:[LW.map(w=>jsx("button",{type:"button",onClick:()=>i(w.id),className:le("relative px-3.5 py-2 text-[12px] font-medium whitespace-nowrap transition-colors max-md:min-h-[36px] max-md:px-3",o===w.id?w.id==="file"?"text-white bg-primary/80 rounded-sm":"text-foreground after:absolute after:-bottom-px after:left-0 after:right-0 after:h-[2.5px] after:bg-primary":w.id==="file"?"text-primary hover:bg-primary/15 rounded-sm":"text-muted-foreground hover:text-foreground hover:bg-accent/30"),children:w.label},w.id)),jsx("div",{className:"flex-1"}),n&&jsx("button",{type:"button",onClick:t.onToggleCompactToolbar,className:le("px-2 py-1 rounded text-[11px] transition-colors mr-1",r?"bg-primary/80 text-white":"text-muted-foreground hover:text-foreground"),title:"Toggle ribbon",children:r?"Collapse":"Expand"})]}),S&&jsxs("div",{className:le("flex items-center gap-1.5 px-2 py-1 max-md:px-1 max-md:py-0.5 overflow-visible flex-nowrap",n&&!r&&"hidden"),children:[s&&jsx(OI,{onExportPng:t.onExportPng,onExportPdf:t.onExportPdf,onExportVideo:t.onExportVideo,onExportGif:t.onExportGif,onPackageForSharing:t.onPackageForSharing,onSaveAsPptx:t.onSaveAsPptx,onSaveAsPpsx:t.onSaveAsPpsx,onSaveAsPptm:t.onSaveAsPptm,hasMacros:t.hasMacros,onCopySlideAsImage:t.onCopySlideAsImage,onPrint:t.onPrint,onOpenDocumentProperties:t.onOpenDocumentProperties,onOpenPasswordProtection:t.onOpenPasswordProtection,onOpenFontEmbedding:t.onOpenFontEmbedding,onOpenDigitalSignatures:t.onOpenDigitalSignatures}),a&&jsx(UI,{canEdit:t.canEdit,clipboardPayload:t.clipboardPayload,formatPainterActive:t.formatPainterActive,canActivateFormatPainter:t.canActivateFormatPainter,onCopy:t.onCopy,onCut:t.onCut,onPaste:t.onPaste,onToggleFormatPainter:t.onToggleFormatPainter,layoutOptions:t.layoutOptions,onInsertSlideFromLayout:t.onInsertSlideFromLayout,selectedElement:t.selectedElement,onUpdateTextStyle:t.onUpdateTextStyle}),l&&jsx($I,{canEdit:t.canEdit,newShapeType:t.newShapeType,onSetNewShapeType:t.onSetNewShapeType,onAddTextBox:t.onAddTextBox,onAddShape:t.onAddShape,onAddTable:t.onAddTable,onAddSmartArt:t.onAddSmartArt,onAddEquation:t.onAddEquation,onAddActionButton:t.onAddActionButton,onInsertField:t.onInsertField,onOpenImagePicker:t.onOpenImagePicker,onOpenMediaPicker:t.onOpenMediaPicker}),c&&jsx(zI,{canEdit:t.canEdit,selectedElement:t.selectedElement,tableEditorState:t.tableEditorState,onUpdateTextStyle:t.onUpdateTextStyle}),d&&jsx(BI,{activeTool:t.activeTool,drawingColor:t.drawingColor,drawingWidth:t.drawingWidth,onSetActiveTool:t.onSetActiveTool,onSetDrawingColor:t.onSetDrawingColor,onSetDrawingWidth:t.onSetDrawingWidth}),u&&jsx(II,{canEdit:t.canEdit,selectedElement:t.selectedElement,clipboardPayload:t.clipboardPayload,onAlignElements:t.onAlignElements,onCopy:t.onCopy,onCut:t.onCut,onPaste:t.onPaste,onFlip:t.onFlip,onMoveLayer:t.onMoveLayer,onMoveLayerToEdge:t.onMoveLayerToEdge,onDuplicate:t.onDuplicate,onDelete:t.onDelete,formatPainterActive:t.formatPainterActive,onToggleFormatPainter:t.onToggleFormatPainter,canActivateFormatPainter:t.canActivateFormatPainter}),p&&jsx(NI,{canEdit:t.canEdit,onToggleThemeGallery:t.onToggleThemeGallery,isThemeGalleryOpen:t.isThemeGalleryOpen,onToggleThemeEditor:t.onToggleThemeEditor,isThemeEditorOpen:t.isThemeEditorOpen,onOpenDocumentProperties:t.onOpenDocumentProperties,onToggleInspector:t.onToggleInspector,isInspectorPaneOpen:t.isInspectorPaneOpen}),f&&jsx(DI,{isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector}),h&&jsx(kI,{canEdit:t.canEdit,selectedElement:t.selectedElement,isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector,onOpenAnimationPanel:t.onOpenAnimationPanel,onAddAnimation:t.onAddAnimation,onRemoveAnimation:t.onRemoveAnimation}),m&&jsx(HI,{onPresent:()=>t.onSetMode("present"),onEnterPresenterView:t.onEnterPresenterView??(()=>{}),onEnterRehearsalMode:t.onEnterRehearsalMode??(()=>{}),onOpenSetUpSlideShow:t.onOpenSetUpSlideShow??(()=>{}),onOpenBroadcastDialog:t.onOpenBroadcastDialog??(()=>{}),onToggleSubtitles:t.onToggleSubtitles??(()=>{}),showSubtitles:t.showSubtitles??false,onSetMode:t.onSetMode}),x&&jsx(LI,{canEdit:t.canEdit,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,onToggleComments:t.onToggleComments,isCommentsPanelOpen:t.isCommentsPanelOpen,slideCommentCount:t.slideCommentCount,onCompare:t.onCompare}),y&&jsx(GI,{canEdit:t.canEdit,editTemplateMode:t.editTemplateMode,onSetEditTemplateMode:t.onSetEditTemplateMode,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,showGrid:t.showGrid,showRulers:t.showRulers,snapToGrid:t.snapToGrid,snapToShape:t.snapToShape,onSetShowGrid:t.onSetShowGrid,onSetShowRulers:t.onSetShowRulers,onSetSnapToGrid:t.onSetSnapToGrid,onSetSnapToShape:t.onSetSnapToShape,onAddGuide:t.onAddGuide,onEnterMasterView:t.onEnterMasterView,isSelectionPaneOpen:t.isSelectionPaneOpen,onToggleSelectionPane:t.onToggleSelectionPane,eyedropperActive:t.eyedropperActive,onToggleEyedropper:t.onToggleEyedropper}),v&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:t.onToggleShortcuts,className:ft,title:"Keyboard shortcuts",children:"Keyboard Shortcuts"}),jsx("button",{type:"button",onClick:t.onRunAccessibilityCheck,className:ft,title:"Accessibility check",children:"Accessibility"})]})]})]})}var WI="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",$p="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",Yie=gE.filter(t=>t.value==="fadeIn"||t.value==="flyIn"||t.value==="zoomIn"),qie=gE.filter(t=>t.value==="fadeOut"||t.value==="flyOut"||t.value==="zoomOut"),Kie=gE.filter(t=>t.value==="spin"||t.value==="pulse"||t.value==="colorWave"||t.value==="bounce"||t.value==="flash"||t.value==="growShrink"||t.value==="teeter"),Zie=[{value:"onClick",labelKey:"pptx.animation.trigger.onClick"},{value:"onShapeClick",labelKey:"pptx.animation.trigger.onShapeClick"},{value:"onHover",labelKey:"pptx.animation.trigger.onHover"},{value:"afterPrevious",labelKey:"pptx.animation.trigger.afterPrevious"},{value:"withPrevious",labelKey:"pptx.animation.trigger.withPrevious"}],Jie=[{value:"ease",labelKey:"pptx.animation.timingCurve.ease"},{value:"ease-in",labelKey:"pptx.animation.timingCurve.easeIn"},{value:"ease-out",labelKey:"pptx.animation.timingCurve.easeOut"},{value:"linear",labelKey:"pptx.animation.timingCurve.linear"}],Qie=[{value:"none",labelKey:"pptx.animation.repeatUntil.none"},{value:"untilNextClick",labelKey:"pptx.animation.repeatUntil.untilNextClick"},{value:"untilEndOfSlide",labelKey:"pptx.animation.repeatUntil.untilEndOfSlide"}],ese=[{value:"fromTop",labelKey:"pptx.animation.direction.fromTop",icon:LuArrowDown},{value:"fromBottom",labelKey:"pptx.animation.direction.fromBottom",icon:LuArrowUp},{value:"fromLeft",labelKey:"pptx.animation.direction.fromLeft",icon:LuArrowRight},{value:"fromRight",labelKey:"pptx.animation.direction.fromRight",icon:LuArrowLeft}],tse=[{value:"asOne",labelKey:"pptx.animation.sequence.asOne"},{value:"byParagraph",labelKey:"pptx.animation.sequence.byParagraph"},{value:"byWord",labelKey:"pptx.animation.sequence.byWord"},{value:"byLetter",labelKey:"pptx.animation.sequence.byLetter"}];function WXe(t){return t.entrance?"bg-green-500/60":t.emphasis?"bg-yellow-500/60":t.exit?"bg-red-500/60":"bg-muted-foreground/40"}function YXe(t){return t.entrance??t.emphasis??t.exit??"custom"}function rse({selectedElementId:t,canEdit:e,handlers:n}){let{t:r}=useTranslation(),{sortedAnimations:o,dragIndex:i,dragOverIndex:s,timelineBarData:a,handleAnimationHover:l,handleAnimationHoverEnd:c,handleDragStart:u,handleDragOver:d,handleDragEnter:p,handleDragLeave:f,handleDrop:h,handleDragEnd:m,handleMoveUp:x,handleMoveDown:y,getTimelineLabel:v}=n;return o.length===0&&a.length===0?null:jsxs(Fragment,{children:[a.length>0&&jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-1",children:r("pptx.animation.timelineBar")}),jsx("div",{className:"relative h-6 rounded bg-muted/50 border border-border overflow-hidden",children:a.map(S=>jsx("div",{className:le("absolute top-0.5 bottom-0.5 rounded-sm transition-colors",WXe(S.anim),S.anim.elementId===t&&"ring-1 ring-primary"),style:{left:`${S.leftPercent}%`,width:`${Math.max(S.widthPercent,2)}%`},title:`${v(S.anim)} - ${YXe(S.anim)} (${S.anim.durationMs??500}ms)`,onMouseEnter:()=>l(S.anim),onMouseLeave:c},S.anim.elementId))})]}),o.length>0&&jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-1",children:r("pptx.animation.timeline")}),jsx("div",{className:"space-y-0.5 max-h-40 overflow-y-auto",children:o.map((S,w)=>{let C=t===S.elementId;return jsxs("div",{draggable:e,onDragStart:M=>u(w,M),onDragOver:M=>d(w,M),onDragEnter:()=>p(w),onDragLeave:f,onDrop:M=>h(w,M),onDragEnd:m,onMouseEnter:()=>l(S),onMouseLeave:c,className:le("flex items-center gap-1 px-1 py-0.5 rounded text-[10px] cursor-grab transition-colors",C?"bg-primary/30 text-primary":"bg-muted/50 text-muted-foreground",i===w&&"opacity-40",s===w&&"border-t-2 border-primary"),children:[e&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground/50 shrink-0"}),jsxs("span",{className:"text-muted-foreground w-4 shrink-0",children:[w+1,"."]}),jsx("span",{className:"truncate flex-1",children:v(S)}),S.entrance&&jsx(LuMoveRight,{className:"w-3 h-3 text-green-400/70 shrink-0"}),S.emphasis&&jsx(LuRotateCw,{className:"w-3 h-3 text-yellow-400/70 shrink-0"}),S.exit&&jsx(LuMoveRight,{className:"w-3 h-3 text-red-400/70 rotate-180 shrink-0"}),e&&jsxs("div",{className:"flex gap-0.5 shrink-0",children:[jsx("button",{type:"button",disabled:w===0,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:M=>{M.stopPropagation(),x(w);},title:r("pptx.animation.moveUp"),children:jsx(LuChevronUp,{className:"w-3 h-3"})}),jsx("button",{type:"button",disabled:w===o.length-1,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:M=>{M.stopPropagation(),y(w);},title:r("pptx.animation.moveDown"),children:jsx(LuChevronDown,{className:"w-3 h-3"})})]})]},S.elementId)})})]})]})}var k8=new Set(["flyIn","flyOut"]);function ise({canEdit:t,updateAnimations:e}){let[n,r]=useState(null),[o,i]=useState(null),s=useRef(0),a=useCallback((x,y)=>{t&&(r(x),y.dataTransfer.effectAllowed="move",y.dataTransfer.setData("text/plain",String(x)));},[t]),l=useCallback((x,y)=>{y.preventDefault(),y.dataTransfer.dropEffect="move",i(x);},[]),c=useCallback(x=>{s.current++,i(x);},[]),u=useCallback(()=>{s.current--,s.current<=0&&(i(null),s.current=0);},[]),d=useCallback((x,y)=>{e(v=>{let S=[...v].sort((C,T)=>(C.order??0)-(T.order??0)),[w]=S.splice(x,1);return S.splice(y,0,w),S.map((C,T)=>({...C,order:T}))});},[e]),p=useCallback((x,y)=>{y.preventDefault(),s.current=0;let v=n;r(null),i(null),!(v===null||v===x)&&d(v,x);},[n,d]),f=useCallback(()=>{r(null),i(null),s.current=0;},[]),h=useCallback(x=>{x<=0||d(x,x-1);},[d]),m=useCallback(x=>{e(y=>{let v=[...y].sort((w,C)=>(w.order??0)-(C.order??0));if(x>=v.length-1)return y;let S=v[x+1];return v[x+1]=v[x],v[x]=S,v.map((w,C)=>({...w,order:C}))});},[e]);return {dragIndex:n,dragOverIndex:o,handleDragStart:a,handleDragOver:l,handleDragEnter:c,handleDragLeave:u,handleDrop:p,handleDragEnd:f,handleMoveUp:h,handleMoveDown:m}}function sse({selectedElementId:t,selectedElementAnimation:e}){let n=useCallback(i=>{let s=i.entrance??i.emphasis??i.exit;!s||s==="none"||oU(i.elementId,s,{direction:i.direction,durationMs:i.durationMs??500,timingCurve:i.timingCurve});},[]),r=useCallback(()=>iU(),[]),o=useCallback(()=>{if(!e)return;let i=e.entrance??e.emphasis??e.exit;!i||i==="none"||oU(t,i,{direction:e.direction,durationMs:e.durationMs??500,timingCurve:e.timingCurve});},[t,e]);return {handleAnimationHover:n,handleAnimationHoverEnd:r,handlePreviewClick:o}}function ase({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let o=useMemo(()=>(e.animations??[]).find(k=>k.elementId===t.id),[e,t]),i=useMemo(()=>[...e.animations??[]].sort((k,N)=>(k.order??0)-(N.order??0)),[e.animations]),s=useCallback(k=>{if(!n)return;let N=e.animations??[];r({animations:k([...N])});},[n,e.animations,r]),a=useCallback((k,N)=>{s(F=>F.map(B=>B.elementId===t.id?{...B,[k]:N}:B));},[s,t.id]),l=useCallback((k,N,F)=>{n&&s(B=>{let D=B.findIndex(U=>U.elementId===t.id),O=k||N||F;if(D>=0){if(!O)return B.filter(U=>U.elementId!==t.id);B[D]={...B[D],entrance:k,exit:N,emphasis:F};}else O&&B.push({elementId:t.id,entrance:k,exit:N,emphasis:F,durationMs:500,order:B.length,trigger:"onClick"});return B});},[n,s,t.id]),c=useCallback(k=>{let N=k.target.value;l(N==="none"?void 0:N,o?.exit,o?.emphasis);},[l,o]),u=useCallback(k=>{let N=k.target.value;l(o?.entrance,N==="none"?void 0:N,o?.emphasis);},[l,o]),d=useCallback(k=>{let N=k.target.value;l(o?.entrance,o?.exit,N==="none"?void 0:N);},[l,o]),p=useCallback(k=>{let N=k.target.value;a("trigger",N),N!=="onShapeClick"&&a("triggerShapeId",void 0);},[a]),f=useCallback(k=>a("triggerShapeId",k.target.value||void 0),[a]),h=useCallback(k=>a("timingCurve",k.target.value),[a]),m=useCallback(k=>a("durationMs",Math.max(100,Math.min(1e4,Number(k.target.value)||450))),[a]),x=useCallback(k=>a("delayMs",Math.max(0,Math.min(1e4,Number(k.target.value)||0))),[a]),y=useCallback(k=>a("repeatCount",Math.max(1,Math.min(100,Number(k.target.value)||1))),[a]),v=useCallback(k=>{let N=k.target.value;a("repeatMode",N==="none"?void 0:N);},[a]),S=useCallback(k=>a("direction",k),[a]),w=useCallback(k=>a("sequence",k.target.value),[a]),C=sse({selectedElementId:t.id,selectedElementAnimation:o}),T=ise({canEdit:n,updateAnimations:s}),E=useCallback(k=>{let N=e.elements?.find(B=>B.id===k.elementId);return N?(ot(N)?N.text:void 0)||cs(N):k.elementId.slice(0,8)},[e.elements]),M=!!(o?.entrance||o?.exit||o?.emphasis),A=M&&(k8.has(o?.entrance??"")||k8.has(o?.exit??"")),R=useMemo(()=>{if(i.length===0)return [];let k=0,N=i.map(B=>{let D=B.delayMs??0,O=B.durationMs??500,U=D+O;return U>k&&(k=U),{anim:B,startMs:D,durationMs:O,endMs:U}}),F=Math.max(k,1);return N.map(B=>({anim:B.anim,leftPercent:B.startMs/F*100,widthPercent:B.durationMs/F*100}))},[i]);return {selectedElementAnimation:o,sortedAnimations:i,hasAnimation:M,showDirectionPicker:A,timelineBarData:R,handleEntranceChange:c,handleExitChange:u,handleEmphasisChange:d,handleTriggerChange:p,handleTriggerShapeChange:f,handleTimingCurveChange:h,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:y,handleRepeatModeChange:v,handleDirectionChange:S,handleSequenceChange:w,getTimelineLabel:E,...C,...T}}function lse({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=ase({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}),{selectedElementAnimation:s,hasAnimation:a,showDirectionPicker:l,handleEntranceChange:c,handleExitChange:u,handleEmphasisChange:d,handleTriggerChange:p,handleTriggerShapeChange:f,handleTimingCurveChange:h,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:y,handleRepeatModeChange:v,handleDirectionChange:S,handleSequenceChange:w,handlePreviewClick:C}=i;return jsxs("div",{className:"rounded border border-border bg-card p-2 space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:o("pptx.animation.title")}),a&&jsxs("button",{type:"button",className:"flex items-center gap-1 text-[10px] text-primary hover:text-primary/80 transition-colors",onClick:C,title:o("pptx.animation.preview"),children:[jsx(LuPlay,{className:"w-3 h-3"}),o("pptx.animation.preview")]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.entrance")}),jsxs("select",{value:s?.entrance??"none",onChange:c,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Yie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.emphasis")}),jsxs("select",{value:s?.emphasis??"none",onChange:d,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Kie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.exit")}),jsxs("select",{value:s?.exit??"none",onChange:u,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),qie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),a&&jsxs(Fragment,{children:[l&&jsxs("div",{className:"pt-1 border-t border-border",children:[jsx("span",{className:"text-muted-foreground text-[11px] block mb-1",children:o("pptx.animation.direction")}),jsx("div",{className:"flex gap-1",children:ese.map(T=>{let E=T.icon,M=s?.direction===T.value;return jsx("button",{type:"button",disabled:!n,className:le("flex items-center justify-center w-7 h-7 rounded border transition-colors",M?"border-primary bg-primary/20 text-primary":"border-border bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>S(T.value),title:o(T.labelKey),children:jsx(E,{className:"w-3.5 h-3.5"})},T.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.sequence")}),jsx("select",{value:s?.sequence??"asOne",onChange:w,disabled:!n,className:$p,children:tse.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground pt-1 border-t border-border",children:o("pptx.animation.timing")}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.trigger")}),jsx("select",{value:s?.trigger??"onClick",onChange:p,disabled:!n,className:$p,children:Zie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),s?.trigger==="onShapeClick"&&jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.trigger.shapeLabel")}),jsxs("select",{value:s?.triggerShapeId??"",onChange:f,disabled:!n,className:$p,children:[jsx("option",{value:"",children:o("pptx.animation.trigger.selectShape")}),e.elements.filter(T=>T.id!==t.id).map(T=>jsx("option",{value:T.id,children:cs(T)},T.id))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.duration")}),jsx("input",{type:"number",min:100,max:1e4,step:50,disabled:!n,value:s?.durationMs??450,onChange:m,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.delay")}),jsx("input",{type:"number",min:0,max:1e4,step:50,disabled:!n,value:s?.delayMs??0,onChange:x,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.timingCurve")}),jsx("select",{value:s?.timingCurve??"ease",onChange:h,disabled:!n,className:$p,children:Jie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.repeatCount")}),jsx("input",{type:"number",min:1,max:100,step:1,disabled:!n,value:s?.repeatCount??1,onChange:y,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.repeatUntil")}),jsx("select",{value:s?.repeatMode??"none",onChange:v,disabled:!n,className:$p,children:Qie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]})]}),jsx(rse,{selectedElementId:t.id,canEdit:n,handlers:i})]})}var cse=[{key:"elements",label:"Elements",icon:LuLayers},{key:"properties",label:"Properties",icon:LuSettings2},{key:"comments",label:"Comments",icon:LuMessageSquare}],hn="text-[11px] uppercase tracking-wide text-muted-foreground",xn="rounded border border-border bg-card p-2 space-y-2",Fn="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",Xr="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",use=[["X","x"],["Y","y"],["W","width"],["H","height"]];var oWe=[{value:"none",label:"None"},{value:"url",label:"Go to URL"},{value:"slide",label:"Go to Slide"},{value:"firstSlide",label:"First Slide"},{value:"lastSlide",label:"Last Slide"},{value:"prevSlide",label:"Previous Slide"},{value:"nextSlide",label:"Next Slide"},{value:"endShow",label:"End Show"}];function pse({selectedElement:t,slides:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.actionClick?R5(t.actionClick,"click"):void 0,s=t.actionHover?R5(t.actionHover,"hover"):void 0,a=i?.type??"none",l=s?.type??"none",c=(u,d,p,f)=>{let m=iE({type:d,url:p,slideIndex:f});r(u==="click"?{actionClick:m}:{actionHover:m});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.action.title","Action")}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx(dse,{label:o("pptx.action.onClick","On Click"),trigger:"click",activeType:a,action:i,fallbackUrl:t.actionClick?.url,fallbackSlideIndex:t.actionClick?.targetSlideIndex,canEdit:n,slideCount:e.length,onChangeType:u=>c("click",u,i?.url,i?.slideIndex),onChangeUrl:u=>c("click","url",u),onChangeSlide:u=>c("click","slide",void 0,u)}),jsx(dse,{label:o("pptx.action.onHover","On Hover"),trigger:"hover",activeType:l,action:s,fallbackUrl:t.actionHover?.url,fallbackSlideIndex:t.actionHover?.targetSlideIndex,canEdit:n,slideCount:e.length,onChangeType:u=>c("hover",u,s?.url,s?.slideIndex),onChangeUrl:u=>c("hover","url",u),onChangeSlide:u=>c("hover","slide",void 0,u)})]})]})}function dse({label:t,activeType:e,action:n,fallbackUrl:r,fallbackSlideIndex:o,canEdit:i,slideCount:s,onChangeType:a,onChangeUrl:l,onChangeSlide:c}){return jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-muted-foreground font-medium",children:t}),jsx("select",{disabled:!i,className:le(Fn,"w-full"),value:e,onChange:u=>a(u.target.value),children:oWe.map(u=>jsx("option",{value:u.value,children:u.label},u.value))}),e==="url"&&jsx("input",{type:"text",disabled:!i,className:le(Fn,"w-full"),placeholder:"https://...",value:n?.url??r??"",onChange:u=>l(u.target.value)}),e==="slide"&&jsx("input",{type:"number",disabled:!i,className:le(Fn,"w-full"),placeholder:"Slide number (1-based)",min:1,max:s,value:(n?.slideIndex??o??0)+1,onChange:u=>{let d=Number(u.target.value);Number.isFinite(d)&&c(Math.max(0,d-1));}})]})}var Bv="text-[11px] uppercase tracking-wide text-muted-foreground",Ov="rounded border border-border bg-card p-2 space-y-2",Uv="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",L8="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",YI="bg-muted border border-border rounded px-1 py-0.5 text-[11px] w-full text-center",fse=[{value:"bar",labelKey:"pptx.chart.typeBar"},{value:"line",labelKey:"pptx.chart.typeLine"},{value:"pie",labelKey:"pptx.chart.typePie"},{value:"doughnut",labelKey:"pptx.chart.typeDoughnut"},{value:"area",labelKey:"pptx.chart.typeArea"},{value:"scatter",labelKey:"pptx.chart.typeScatter"},{value:"bubble",labelKey:"pptx.chart.typeBubble"},{value:"radar",labelKey:"pptx.chart.typeRadar"},{value:"stock",labelKey:"pptx.chart.typeStock"},{value:"waterfall",labelKey:"pptx.chart.typeWaterfall"},{value:"combo",labelKey:"pptx.chart.typeCombo"}],hse=[{value:"clustered",labelKey:"pptx.chart.groupingClustered"},{value:"stacked",labelKey:"pptx.chart.groupingStacked"},{value:"percentStacked",labelKey:"pptx.chart.groupingPercentStacked"}],mse=[{value:"t",labelKey:"pptx.chart.legendTop"},{value:"b",labelKey:"pptx.chart.legendBottom"},{value:"l",labelKey:"pptx.chart.legendLeft"},{value:"r",labelKey:"pptx.chart.legendRight"}],gse=new Set(["bar","line","area"]);function bse({series:t,categories:e,canEdit:n,onUpdateSeries:r,onUpdateCategoryLabel:o,onUpdateValue:i,onAddCategory:s,onRemoveCategory:a,onAddSeries:l,onRemoveSeries:c}){let{t:u}=useTranslation();return jsxs("div",{className:Ov,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:Bv,children:u("pptx.chart.data")}),n&&jsxs("div",{className:"flex gap-1",children:[jsxs("button",{type:"button",className:L8,title:u("pptx.chart.addCategory"),onClick:s,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),u("pptx.chart.cat")]}),jsxs("button",{type:"button",className:L8,title:u("pptx.chart.addSeries"),onClick:l,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),u("pptx.chart.seriesShort")]})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full text-[11px] border-collapse",children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{className:"text-muted-foreground p-0.5 text-left min-w-[60px]"}),t.map((d,p)=>jsx("th",{className:"p-0.5 font-normal min-w-[72px]",children:jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("input",{type:"text",disabled:!n,className:YI,value:d.name,onChange:f=>r(p,{name:f.target.value})}),n&&t.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:u("pptx.chart.removeSeries"),onClick:()=>c(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})},p))]})}),jsx("tbody",{children:e.map((d,p)=>jsxs("tr",{children:[jsx("td",{className:"p-0.5",children:jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("input",{type:"text",disabled:!n,className:YI,value:d,onChange:f=>o(p,f.target.value)}),n&&e.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:u("pptx.chart.removeCategory"),onClick:()=>a(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})}),t.map((f,h)=>jsx("td",{className:"p-0.5",children:jsx("input",{type:"number",disabled:!n,className:YI,value:f.values[p]??0,onChange:m=>i(h,p,m.target.value)})},h))]},p))})]})})]})}function vse({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:Ov,children:[jsx("div",{className:Bv,children:r("pptx.chart.display")}),jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasTitle??false,onChange:o=>n({hasTitle:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showTitle")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasLegend??false,onChange:o=>n({hasLegend:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showLegend")})]}),t?.hasLegend&&jsxs("label",{className:"flex items-center gap-2 text-[11px] ml-4",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:r("pptx.chart.legendPosition")}),jsx("select",{disabled:!e,className:Uv,value:t.legendPosition??"b",onChange:o=>n({legendPosition:o.target.value}),children:mse.map(o=>jsx("option",{value:o.value,children:r(o.labelKey)},o.value))})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasGridlines??false,onChange:o=>n({hasGridlines:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showGridlines")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasDataLabels??false,onChange:o=>n({hasDataLabels:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showDataLabels")})]})]})]})}function Sse({title:t,chartType:e,grouping:n,seriesCount:r,categoryCount:o,canEdit:i,onUpdateChartData:s}){let{t:a}=useTranslation(),l=gse.has(e);return jsxs("div",{className:Ov,children:[jsx("div",{className:Bv,children:a("pptx.chart.heading")}),jsxs("div",{className:"text-[11px] text-muted-foreground mb-1",children:[r," ",a("pptx.chart.series")," \xB7 ",o," ",a("pptx.chart.categories")]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.title")}),jsx("input",{type:"text",disabled:!i,className:Uv,value:t??"",onChange:c=>s({title:c.target.value})})]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.type")}),jsx("select",{disabled:!i,className:Uv,value:e,onChange:c=>s({chartType:c.target.value}),children:fse.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]}),l&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.grouping")}),jsx("select",{disabled:!i,className:Uv,value:n??"clustered",onChange:c=>s({grouping:c.target.value}),children:hse.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]})]})}function wse({selectedElement:t,canEdit:e,onUpdateElement:n}){let r=t.chartData,o=r?.title,i=r?.chartType,s=r?.categories,a=r?.series,l=r?.style,c=r?.grouping,u=useCallback(w=>{n({chartData:w});},[n]),d=useCallback(w=>{if(r){if(w.chartType&&w.chartType!==r.chartType){let C=wX(r,w.chartType),{chartType:T,...E}=w;u({...C,...E});return}n({chartData:{...r,...w}});}},[r,n,u]),p=useCallback(w=>{r&&n({chartData:{...r,style:{...l,...w}}});},[r,l,n]),f=useCallback((w,C)=>{if(!a)return;let T=a.map((E,M)=>M===w?{...E,...C}:E);d({series:T});},[a,d]),h=useCallback((w,C)=>{if(!s)return;let T=s.map((E,M)=>M===w?C:E);d({categories:T});},[s,d]),m=useCallback((w,C,T)=>{if(!r)return;let E=Number.parseFloat(T);Number.isFinite(E)&&u(SX(r,w,C,E));},[r,u]),x=useCallback(()=>{!r||!s||u(CX(r,`Cat ${s.length+1}`));},[r,s,u]),y=useCallback(w=>{!r||!s||s.length<=1||u(TX(r,w));},[r,s,u]),v=useCallback(()=>{!r||!s||!a||u(bX(r,{name:`Series ${a.length+1}`,values:s.map(()=>0)}));},[r,s,a,u]),S=useCallback(w=>{!r||!a||a.length<=1||u(vX(r,w));},[r,a,u]);return !r||!s||!a?null:jsxs(Fragment,{children:[jsx(Sse,{title:o,chartType:i,grouping:c,seriesCount:a.length,categoryCount:s.length,canEdit:e,onUpdateChartData:d}),jsx(vse,{style:l,canEdit:e,onUpdateStyle:p}),jsx(bse,{categories:s,series:a,canEdit:e,onUpdateSeries:f,onUpdateCategoryLabel:h,onUpdateValue:m,onAddCategory:x,onRemoveCategory:y,onAddSeries:v,onRemoveSeries:S})]})}function Cse({selectedElement:t,canEdit:e,onUpdateElementStyle:n}){return t.type!=="connector"?null:jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Connector"}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[["Start","connectorStartArrow"],["End","connectorEndArrow"]].map(([r,o])=>jsxs("label",{className:"flex flex-col gap-1",children:[jsxs("span",{className:"text-muted-foreground",children:[r," Arrow"]}),jsxs("select",{disabled:!e,className:le(Fn,"w-full"),value:t.shapeStyle?.[o]??"none",onChange:i=>n({[o]:i.target.value}),children:[jsx("option",{value:"none",children:"None"}),jsx("option",{value:"triangle",children:"Triangle"}),jsx("option",{value:"arrow",children:"Arrow"}),jsx("option",{value:"stealth",children:"Stealth"}),jsx("option",{value:"diamond",children:"Diamond"}),jsx("option",{value:"oval",children:"Oval"})]})]},o))})]})}function Tse({selectedElement:t}){if(t.type!=="group")return null;let e=t;return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Group"}),jsx("div",{className:"text-[11px] text-muted-foreground",children:Array.isArray(e.children)?`${e.children.length} children`:"Grouped element"})]})}function Mse({selectedElement:t}){let{t:e}=useTranslation();if(t.type!=="ole")return null;let n=t;return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:e("pptx.ole.title")}),jsxs("div",{className:"space-y-1.5 text-[11px]",children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.type")}),jsx("span",{className:"text-foreground truncate",children:Nj(n.oleObjectType)})]}),n.fileName&&jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.fileName")}),jsx("span",{className:"text-foreground truncate",title:n.fileName,children:n.fileName})]}),jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.linkStatus")}),jsx("span",{className:le("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium",n.isLinked?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"),children:n.isLinked?e("pptx.ole.linked"):e("pptx.ole.embedded")})]})]})]})}function _se({selectedElement:t,canEdit:e,onUpdateElement:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Transform"}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Rotation (\xB0)"}),jsx("input",{type:"number",disabled:!e,className:Fn,value:Math.round(t.rotation||0),onChange:r=>n({rotation:Number(r.target.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Opacity"}),jsx("input",{type:"range",disabled:!e,min:0,max:100,value:Math.round((t.opacity??1)*100),className:"accent-primary",onChange:r=>n({opacity:Number(r.target.value)/100})})]})]})]})}function Ese({canEdit:t,onMoveLayer:e}){return jsxs("div",{className:"flex gap-1",children:[jsx("button",{type:"button",className:le("flex-1",Xr),disabled:!t,onClick:()=>e("forward"),children:"\u2191 Forward"}),jsx("button",{type:"button",className:le("flex-1",Xr),disabled:!t,onClick:()=>e("backward"),children:"\u2193 Backward"})]})}var pWe=[["none","pptx.image.effectNone",""],["blur","pptx.image.effectBlur","blur(4px)"],["grayscale","pptx.image.effectGrayscale","grayscale(100%)"],["sepia","pptx.image.effectSepia","sepia(100%)"],["pencilSketch","pptx.image.effectPencilSketch","grayscale(100%) contrast(150%) brightness(80%)"],["lineDrawing","pptx.image.effectLineDrawing","grayscale(100%) contrast(150%)"],["watercolorSponge","pptx.image.effectWatercolor","saturate(150%) blur(1px)"],["paintStrokes","pptx.image.effectPaintStrokes","blur(3px) saturate(140%)"],["glow_edges","pptx.image.effectGlowEdges","contrast(180%) invert(5%) brightness(110%)"],["glowDiffused","pptx.image.effectGlowDiffused","blur(3px) brightness(120%)"],["cement","pptx.image.effectCement","contrast(200%) brightness(60%)"],["photocopy","pptx.image.effectPhotocopy","grayscale(100%) contrast(200%) brightness(120%)"],["filmGrain","pptx.image.effectFilmGrain","contrast(110%) brightness(105%)"],["mosaic","pptx.image.effectMosaic","blur(8px) contrast(105%)"],["chalkSketch","pptx.image.effectChalk","grayscale(80%) contrast(140%) brightness(110%)"],["marker","pptx.image.effectMarker","contrast(130%) saturate(130%)"],["cutout","pptx.image.effectCutout","contrast(300%) brightness(120%)"],["pastelsSmooth","pptx.image.effectPastels","blur(4px) saturate(120%)"],["paint","pptx.image.effectPaint","blur(3px) saturate(160%) contrast(110%)"],["plasticWrap","pptx.image.effectPlasticWrap","contrast(150%) brightness(115%) saturate(80%)"],["lightScreen","pptx.image.effectLightScreen","brightness(130%) contrast(80%)"],["sharpen","pptx.image.effectSharpen","contrast(160%) brightness(105%)"],["texturizer","pptx.image.effectTexturizer","contrast(110%) brightness(105%)"],["crisscrossEtching","pptx.image.effectCrisscross","grayscale(60%) contrast(120%)"]];function Pse({imgSrc:t,fx:e,canEdit:n,updateEffects:r}){let{t:o}=useTranslation();return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.image.artisticEffects")}),jsx("div",{className:"grid grid-cols-4 gap-1",children:pWe.map(([i,s,a])=>{let l=i==="none"?!e?.artisticEffect:e?.artisticEffect===i;return jsxs("button",{type:"button",disabled:!n,className:le("flex flex-col items-center gap-0.5 rounded border p-0.5 hover:bg-accent/50",l?"border-primary bg-primary/10":"border-border"),title:o(s),onClick:()=>r({artisticEffect:i==="none"?void 0:i,...i==="grayscale"?{grayscale:void 0}:{}}),children:[jsx("div",{className:"w-10 h-7 rounded overflow-hidden bg-muted",style:{backgroundImage:t?`url(${t})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:a||void 0}}),jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full text-center",children:o(s)})]},i)})})]})}function es({value:t,disabled:e,className:n,onCommit:r}){let[o,i]=useState(t),s=useRef(r);s.current=r,useEffect(()=>{i(t);},[t]);let a=useCallback(u=>{i(u.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let u=c.current;if(!u)return;let d=()=>{s.current(u.value);};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),jsx("input",{ref:c,type:"color",disabled:e,value:o,className:n,onChange:a,onBlur:l})}function Nse({fx:t,canEdit:e,updateEffects:n}){let{t:r}=useTranslation(),o=t?.clrChange;return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChange")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o,onChange:i=>n({clrChange:i.target.checked?{clrFrom:"#ffffff",clrTo:"#000000",clrToTransparent:false}:void 0})})]}),o&&jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeFrom")}),jsx(es,{disabled:!e,value:dt(o.clrFrom,"#ffffff"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({clrChange:{...o,clrFrom:i,clrTo:o.clrTo??"#000000"}})})]}),jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeTo")}),jsx(es,{disabled:!e||!!o.clrToTransparent,value:dt(o.clrTo,"#000000"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({clrChange:{...o,clrFrom:o.clrFrom??"#ffffff",clrTo:i}})})]}),jsxs("label",{className:"flex items-center justify-between gap-2 col-span-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeTransparent")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o.clrToTransparent,onChange:i=>n({clrChange:{clrFrom:o.clrFrom??"#ffffff",clrTo:o.clrTo??"#000000",clrToTransparent:i.target.checked}})})]})]})]})}function Dse({fx:t,canEdit:e,updateEffects:n}){let{t:r}=useTranslation(),o=t?.colorWash;return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorWash")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o,onChange:i=>n({colorWash:i.target.checked?{color:"#0066cc",opacity:40}:void 0})})]}),o&&jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.washColor")}),jsx(es,{disabled:!e,value:dt(o.color,"#0066cc"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({colorWash:{color:i,opacity:o.opacity??40}})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.washOpacity")}),jsx("input",{type:"range",min:0,max:100,disabled:!e,className:"accent-primary",value:o.opacity,onChange:i=>n({colorWash:{color:o.color??"#0066cc",opacity:Number(i.target.value)}})})]})]})]})}function Bse({value:t,disabled:e,className:n,onCommit:r}){let[o,i]=useState(t),s=useRef(r);s.current=r,useEffect(()=>{i(t);},[t]);let a=useCallback(u=>{i(u.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let u=c.current;if(!u)return;let d=()=>{s.current(u.value);};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),jsx("input",{ref:c,type:"color",disabled:e,className:n,value:o,onChange:a,onBlur:l})}function Ose({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o="imageEffects"in t?t.imageEffects:void 0,i=useCallback((c,u)=>{n({imageEffects:{...o,duotone:{color1:c,color2:u}}});},[o,n]),s=useCallback(()=>{n({imageEffects:{...o,duotone:void 0}});},[o,n]),a=dt(o?.duotone?.color1,"#000000"),l=dt(o?.duotone?.color2,"#ffffff");return jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx("div",{className:"text-muted-foreground font-medium",children:r("pptx.image.duotone")}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("label",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.duotoneShadows")}),jsx(Bse,{disabled:!e,value:a,className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:c=>i(c,l)})]}),jsxs("label",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.duotoneHighlights")}),jsx(Bse,{disabled:!e,value:l,className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:c=>i(a,c)})]})]}),jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"text-muted-foreground text-[10px]",children:r("pptx.image.duotonePresets")}),jsx("div",{className:"grid grid-cols-4 gap-1",children:Tee.map(c=>jsxs("button",{type:"button",disabled:!e,className:"flex flex-col items-center gap-0.5 rounded border border-border hover:bg-accent p-1 transition-colors",title:r(c.labelKey),onClick:()=>i(c.shadow,c.highlight),children:[jsxs("div",{className:"flex h-4 w-full rounded overflow-hidden",children:[jsx("div",{className:"flex-1",style:{backgroundColor:c.shadow}}),jsx("div",{className:"flex-1",style:{backgroundColor:c.highlight}})]}),jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full text-center",children:r(c.labelKey)})]},c.labelKey))})]}),o?.duotone&&jsx("button",{type:"button",disabled:!e,className:"w-full rounded bg-muted hover:bg-accent border border-border px-2 py-1 text-foreground transition-colors",onClick:s,children:r("pptx.image.duotoneClear")})]})}function Use({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=useMemo(()=>"imageEffects"in t?t.imageEffects:void 0,[t]),s=100-(o?.alphaModFix??100),a=o?.biLevel??0,l=o?.alphaModFix!==void 0||o?.biLevel!==void 0,c=useCallback(f=>{n({imageEffects:{...o,...f}});},[o,n]),u=useCallback(f=>{let h=Number(f.target.value);c({alphaModFix:100-h});},[c]),d=useCallback(f=>{c({biLevel:Number(f.target.value)});},[c]),p=useCallback(()=>{c({alphaModFix:void 0,biLevel:void 0});},[c]);return jsxs("div",{className:"space-y-3 text-[11px]",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-muted-foreground font-medium",children:r("pptx.imageAdjustments.title")}),l&&jsx("button",{type:"button",disabled:!e,className:"rounded bg-muted hover:bg-accent border border-border px-1.5 py-0.5 text-[10px] text-foreground disabled:opacity-50",onClick:p,children:r("common.reset")})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.imageAdjustments.transparency")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"accent-primary flex-1",value:s,onChange:u}),jsxs("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:[s,"%"]})]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.imageAdjustments.biLevelThreshold")}),jsx("p",{className:"text-[10px] text-muted-foreground/70",children:r("pptx.imageAdjustments.biLevelDescription")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"accent-primary flex-1",value:a,onChange:d}),jsx("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:a})]})]})]})}function JI({label:t,disabled:e,value:n,onChange:r}){return jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"range",min:-100,max:100,disabled:e,className:"accent-primary",value:n,onChange:o=>r(Number(o.target.value))})]})}function Hse({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.imageEffects,i=s=>{n({imageEffects:{...o,...s}});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:r("pptx.image.properties")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:"Alt Text"}),jsx("textarea",{rows:2,disabled:!e,className:le(Fn,"resize-none text-[11px]"),value:t.altText??"",onChange:s=>n({altText:s.target.value})})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsx(JI,{label:"Brightness",disabled:!e,value:o?.brightness??0,onChange:s=>i({brightness:s})}),jsx(JI,{label:"Contrast",disabled:!e,value:o?.contrast??0,onChange:s=>i({contrast:s})}),jsx(JI,{label:r("pptx.image.saturation"),disabled:!e,value:o?.saturation??0,onChange:s=>i({saturation:s})})]}),jsx(Use,{selectedElement:t,canEdit:e,onUpdateElement:n}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Grayscale"}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o?.grayscale,onChange:s=>i({grayscale:s.target.checked})})]}),jsx(Ose,{selectedElement:t,canEdit:e,onUpdateElement:n})]}),jsx(Dse,{fx:o,canEdit:e,updateEffects:i}),jsx(Nse,{fx:o,canEdit:e,updateEffects:i}),jsx(Pse,{imgSrc:t.imageData,fx:o,canEdit:e,updateEffects:i}),jsx("button",{type:"button",disabled:!e,className:"w-full text-[11px] rounded bg-muted hover:bg-accent border border-border px-2 py-1 text-foreground",onClick:()=>n({imageEffects:{brightness:0,contrast:0,saturation:0,grayscale:false,artisticEffect:void 0,colorWash:void 0,alphaModFix:void 0,biLevel:void 0,duotone:void 0},cropShape:"none"}),children:r("pptx.image.resetImage")})]})]})}var _We="text-[11px] uppercase tracking-wide text-muted-foreground",EWe="rounded border border-border bg-card p-2 space-y-2",AWe="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",PWe="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",RWe="flex items-center justify-between gap-2",Xse="text-muted-foreground";function QI(t){if(!Number.isFinite(t)||t<0)return "00:00";let e=Math.round(t/1e3),n=Math.floor(e/60),r=e%60;return `${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}function Vse(t){let e=t.trim();if(e.length===0)return;let n=e.indexOf(":");if(n>=0){let o=e.slice(0,n),i=e.slice(n+1),s=parseInt(o,10),a=parseInt(i,10);return !Number.isFinite(s)||!Number.isFinite(a)||s<0||a<0||a>=60?void 0:(s*60+a)*1e3}let r=parseInt(e,10);if(!(!Number.isFinite(r)||r<0))return r*1e3}function kWe(t,e,n){return t<0||e<0?"pptx.media.trimErrorNegative":e>0&&t>=e?"pptx.media.trimErrorStartAfterEnd":n>0&&t>n||n>0&&e>n?"pptx.media.trimErrorBeyondDuration":null}function jse({label:t,valueMs:e,maxMs:n,disabled:r,onChange:o}){let[i,s]=useState(null),[a,l]=useState(false),c=i??QI(e),u=useCallback(()=>{s(QI(e)),l(false);},[e]),d=useCallback(()=>{if(i!==null){let h=Vse(i);h!==void 0&&h>=0&&(n<=0||h<=n)&&o(h),l(false);}s(null);},[i,n,o]),p=useCallback(h=>{let m=h.target.value;s(m);let x=Vse(m);l(x===void 0);},[]),f=useCallback(h=>{h.key==="Enter"?h.currentTarget.blur():h.key==="Escape"&&(s(null),l(false));},[]);return jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Xse}`,children:t}),jsx("input",{type:"text",disabled:r,className:`${AWe} text-[11px] tabular-nums ${a?"border-red-400":""}`,value:c,placeholder:"00:00",onFocus:u,onBlur:d,onChange:p,onKeyDown:f})]})}function Wse({element:t,canEdit:e,durationSeconds:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.trimStartMs??0,s=t.trimEndMs??0,a=n*1e3,l=useMemo(()=>{let h=i,m=s>0?s:a;return m<=h||a<=0?QI(a):QI(m-h)},[i,s,a]),c=useMemo(()=>kWe(i,s,a),[i,s,a]),u=i>0||s>0,d=useCallback(h=>{r({trimStartMs:h});},[r]),p=useCallback(h=>{r({trimEndMs:h});},[r]),f=useCallback(()=>{r({trimStartMs:0,trimEndMs:0});},[r]);return jsxs("div",{className:EWe,children:[jsxs("div",{className:_We,children:[jsx(LuScissors,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.trim")]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsx(jse,{label:o("pptx.media.trimStartTime"),valueMs:i,maxMs:a,disabled:!e,onChange:d}),jsx(jse,{label:o("pptx.media.trimEndTime"),valueMs:s,maxMs:a,disabled:!e,onChange:p})]}),jsxs("div",{className:RWe,children:[jsxs("span",{className:`text-[11px] ${Xse}`,children:[jsx(LuClock,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.trimmedDuration")]}),jsx("span",{className:"text-[11px] tabular-nums font-medium",children:l})]}),c&&jsx("div",{className:"text-[10px] text-red-400",children:o(c)}),e&&u&&jsx("button",{type:"button",className:`${PWe} w-full text-center`,onClick:f,children:o("pptx.media.resetTrim")})]})}function Hh(t){let e=Math.floor(t/60),n=Math.floor(t%60),r=Math.round(t%1*10);return `${e}:${String(n).padStart(2,"0")}.${r}`}function Yse(){return `bmk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var Vv="text-[11px] uppercase tracking-wide text-muted-foreground",jv="rounded border border-border bg-card p-2 space-y-2",oM="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",eN="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",nc="flex items-center justify-between gap-2",Is="text-muted-foreground";function qse({duration:t,trimStartMs:e,trimEndMs:n,currentTime:r,bookmarks:o,canEdit:i,onTrimChange:s,onSeek:a}){let l=useRef(null),[c,u]=useState(null),d=e/1e3,p=n>0?n/1e3:t,f=t>0?t:1,h=d/f*100,m=p/f*100,x=r/f*100,y=useCallback(S=>{let w=l.current;if(!w)return 0;let C=w.getBoundingClientRect();return Math.max(0,Math.min(1,(S-C.left)/C.width))*f},[f]);useEffect(()=>{if(!c)return;let S=C=>{let T=y(C.clientX);if(c==="start"){let E=Math.min(T,p-.1);s(Math.max(0,E)*1e3,n);}else {let E=Math.max(T,d+.1);s(e,Math.min(E,t)*1e3);}},w=()=>{u(null);};return window.addEventListener("pointermove",S),window.addEventListener("pointerup",w),()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",w);}},[c,t,y,s,n,p,e,d]);let v=S=>{let w=y(S.clientX);a(w);};return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[jsx("span",{children:Hh(d)}),jsx("span",{children:Hh(p)})]}),jsxs("div",{ref:l,className:"relative h-5 rounded bg-muted cursor-pointer select-none",onClick:v,children:[jsx("div",{className:"absolute top-0 bottom-0 bg-primary/30 rounded",style:{left:`${h}%`,width:`${m-h}%`}}),jsx("div",{className:"absolute top-0 bottom-0 w-0.5 bg-white z-10",style:{left:`${Math.min(x,100)}%`}}),i&&jsx("div",{className:"absolute top-0 bottom-0 w-2 bg-primary rounded-l cursor-ew-resize z-20 hover:bg-primary/80",style:{left:`calc(${h}% - 4px)`},onPointerDown:S=>{S.stopPropagation(),u("start");}}),i&&jsx("div",{className:"absolute top-0 bottom-0 w-2 bg-primary rounded-r cursor-ew-resize z-20 hover:bg-primary/80",style:{left:`calc(${m}% - 4px)`},onPointerDown:S=>{S.stopPropagation(),u("end");}}),o.map(S=>{let w=S.time/f*100;return jsx("div",{className:"absolute top-0 bottom-0 w-1 bg-yellow-400/70 z-10 cursor-pointer",style:{left:`${w}%`},title:S.label,onClick:C=>{C.stopPropagation(),a(S.time);}},S.id)})]})]})}function Zse({element:t,canEdit:e,currentTime:n,bookmarks:r,onUpdateElement:o,onSeekTo:i}){let{t:s}=useTranslation(),[a,l]=useState(""),c=Math.round((t.volume??1)*100),u=useCallback(()=>{let p=a.trim()||`${s("pptx.media.bookmark")} ${r.length+1}`,f={id:Yse(),time:n,label:p};o({bookmarks:[...r,f]}),l("");},[r,n,a,o,s]),d=useCallback(p=>{o({bookmarks:r.filter(f=>f.id!==p)});},[r,o]);return jsxs(Fragment,{children:[jsxs("div",{className:jv,children:[jsx("div",{className:Vv,children:s("pptx.media.playback")}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.volume")}),jsxs("div",{className:"flex items-center gap-1 flex-1 max-w-[140px]",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"flex-1",value:c,onChange:p=>o({volume:Number(p.target.value)/100})}),jsxs("span",{className:"text-[10px] text-muted-foreground w-7 text-right tabular-nums",children:[c,"%"]})]})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.speed")}),jsxs("select",{disabled:!e,className:`${oM} text-[11px] max-w-[100px]`,value:t.playbackSpeed??1,onChange:p=>o({playbackSpeed:Number(p.target.value)}),children:[jsx("option",{value:.25,children:"0.25x"}),jsx("option",{value:.5,children:"0.5x"}),jsx("option",{value:.75,children:"0.75x"}),jsx("option",{value:1,children:"1x"}),jsx("option",{value:1.25,children:"1.25x"}),jsx("option",{value:1.5,children:"1.5x"}),jsx("option",{value:2,children:"2x"}),jsx("option",{value:3,children:"3x"}),jsx("option",{value:4,children:"4x"})]})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fadeIn")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${oM} text-[11px]`,value:t.fadeInDuration??0,onChange:p=>o({fadeInDuration:Number(p.target.value)||void 0})})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fadeOut")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${oM} text-[11px]`,value:t.fadeOutDuration??0,onChange:p=>o({fadeOutDuration:Number(p.target.value)||void 0})})]})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.loop")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.loop,onChange:p=>o({loop:p.target.checked||void 0})})]}),jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.startTrigger")}),jsxs("select",{disabled:!e,className:"text-[11px] bg-transparent border border-border rounded px-1 py-0.5",value:t.autoPlay?"auto":"onClick",onChange:p=>o({autoPlay:p.target.value==="auto"||void 0}),children:[jsx("option",{value:"onClick",children:s("pptx.media.startOnClick")}),jsx("option",{value:"auto",children:s("pptx.media.startAutomatically")})]})]}),t.mediaType==="audio"&&jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.playAcrossSlides")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.playAcrossSlides,onChange:p=>o({playAcrossSlides:p.target.checked||void 0,...p.target.checked?{autoPlay:true}:{}})})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fullScreen")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.fullScreen,onChange:p=>o({fullScreen:p.target.checked||void 0})})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.hideWhenNotPlaying")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.hideWhenNotPlaying,onChange:p=>o({hideWhenNotPlaying:p.target.checked||void 0})})]})]}),jsxs("div",{className:jv,children:[jsxs("div",{className:Vv,children:[jsx(LuBookmark,{className:"inline w-3 h-3 mr-1"}),s("pptx.media.bookmarks")]}),r.length>0&&jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:r.slice().sort((p,f)=>p.time-f.time).map(p=>jsxs("div",{className:"flex items-center gap-1 text-[11px] group",children:[jsx("button",{type:"button",className:"text-primary hover:text-primary/80 truncate flex-1 text-left",onClick:()=>i(p.time),title:s("pptx.media.seekToBookmark"),children:p.label}),jsx("span",{className:"text-muted-foreground tabular-nums text-[10px]",children:Hh(p.time)}),e&&jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-300 transition-opacity",onClick:()=>d(p.id),title:s("common.remove"),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},p.id))}),e&&jsxs("div",{className:"flex items-center gap-1",children:[jsx("input",{type:"text",className:`${oM} text-[11px]`,placeholder:s("pptx.media.bookmarkLabel"),value:a,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),u());}}),jsx("button",{type:"button",className:eN,onClick:u,title:s("pptx.media.addBookmark"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function Qse({element:t,mediaDataUrls:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=useRef(null),[s,a]=useState(false),[l,c]=useState(0),[u,d]=useState(0),p=t.mediaData??(t.mediaPath?e.get(t.mediaPath):void 0),f=t.bookmarks??[],h=t.mediaType==="video";useEffect(()=>{let w=i.current;if(!w)return;let C=()=>c(w.currentTime),T=()=>{Number.isFinite(w.duration)&&d(w.duration);},E=()=>a(true),M=()=>a(false),A=()=>a(false);return w.addEventListener("timeupdate",C),w.addEventListener("durationchange",T),w.addEventListener("loadedmetadata",T),w.addEventListener("play",E),w.addEventListener("pause",M),w.addEventListener("ended",A),()=>{w.removeEventListener("timeupdate",C),w.removeEventListener("durationchange",T),w.removeEventListener("loadedmetadata",T),w.removeEventListener("play",E),w.removeEventListener("pause",M),w.removeEventListener("ended",A);}},[p]);let m=useCallback(()=>{let w=i.current;w&&(w.paused?w.play():w.pause());},[]),x=useCallback(w=>{let C=i.current;C&&(C.currentTime=w,c(w));},[]),y=useCallback((w,C)=>{r({trimStartMs:w,trimEndMs:C});},[r]),[v,S]=useState(t.metadata);return useEffect(()=>{let w=i.current;if(!w)return;if(t.metadata?.duration!==void 0){S(t.metadata);return}let C=()=>{if(!Number.isFinite(w.duration)||w.duration===0)return;let T={duration:w.duration};w instanceof HTMLVideoElement&&(w.videoWidth>0&&(T.videoWidth=w.videoWidth),w.videoHeight>0&&(T.videoHeight=w.videoHeight));let E=w.querySelector("source");E?.type&&(T.codecInfo=E.type),t.metadata=T,S(T);};return w.addEventListener("loadedmetadata",C),w.readyState>=1&&C(),()=>{w.removeEventListener("loadedmetadata",C);}},[p,t]),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:jv,children:[jsx("div",{className:Vv,children:o("pptx.media.title")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:o(h?"pptx.media.videoClip":"pptx.media.audioClip")}),p&&jsxs("div",{className:"space-y-1",children:[h?jsx("video",{ref:i,className:"w-full rounded bg-black max-h-32 object-contain",src:p,preload:"metadata"}):jsx("audio",{ref:i,className:"w-full",src:p,preload:"metadata"}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",className:eN,onClick:m,title:o(s?"pptx.media.pause":"pptx.media.play"),children:s?jsx(LuPause,{className:"w-3 h-3"}):jsx(LuPlay,{className:"w-3 h-3"})}),jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[Hh(l)," / ",Hh(u)]})]})]}),u>0&&jsx(qse,{duration:u,trimStartMs:t.trimStartMs??0,trimEndMs:t.trimEndMs??0,currentTime:l,bookmarks:f,canEdit:n,onTrimChange:y,onSeek:x})]}),jsx(Wse,{element:t,canEdit:n,durationSeconds:u,onUpdateElement:r}),(v||t.posterFrameData)&&jsxs("div",{className:jv,children:[jsxs("div",{className:Vv,children:[jsx(LuInfo,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.info")]}),t.posterFrameData&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:`text-[11px] ${Is}`,children:o("pptx.media.posterFrame")}),jsx("img",{src:t.posterFrameData,alt:o("pptx.media.posterFrame"),className:"w-full max-h-20 object-contain rounded bg-black/20"})]}),v?.duration!==void 0&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.duration")}),jsx("span",{className:"text-[11px] tabular-nums",children:Hh(v.duration)})]}),v?.videoWidth!==void 0&&v?.videoHeight!==void 0&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.resolution")}),jsxs("span",{className:"text-[11px] tabular-nums",children:[v.videoWidth," x ",v.videoHeight]})]}),v?.codecInfo&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.format")}),jsx("span",{className:"text-[11px] truncate max-w-[140px]",title:v.codecInfo,children:v.codecInfo})]}),t.mediaPath&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.filePath")}),jsx("span",{className:"text-[10px] truncate max-w-[140px] text-muted-foreground",title:t.mediaPath,children:t.mediaPath.split("/").pop()})]})]}),jsx(Zse,{element:t,canEdit:n,currentTime:l,bookmarks:f,onUpdateElement:r,onSeekTo:x})]})}function eae({selectedElement:t,canEdit:e,onUpdateElement:n,onUpdateElementStyle:r,onUpdateTextStyle:o}){let{t:i}=useTranslation();return jsxs(Fragment,{children:[mn(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.shape.type","Shape Type")}),jsx("select",{value:t.shapeType||"rect",disabled:!e,className:le(Fn,"w-full"),onChange:s=>n({shapeType:s.target.value}),children:m1.filter(s=>s.type!=="connector").map(s=>jsx("option",{value:s.type,children:s.label},s.type))})]}),mn(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.shape.fillStroke","Fill & Stroke")}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Fill"}),jsx(es,{disabled:!e,value:dt(t.shapeStyle?.fillColor,"#3b82f6"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>r({fillColor:s,fillMode:"solid"})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Stroke"}),jsx(es,{disabled:!e,value:dt(t.shapeStyle?.strokeColor,"#1f2937"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>r({strokeColor:s})})]}),jsxs("label",{className:"flex items-center gap-1 col-span-2",children:[jsx("span",{className:"w-16 text-muted-foreground",children:"Stroke W"}),jsx("input",{type:"number",disabled:!e,className:Fn,min:0,max:20,value:t.shapeStyle?.strokeWidth??1,onChange:s=>r({strokeWidth:Number(s.target.value)})})]})]})]}),ot(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.text.title","Text")}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Size"}),jsx("input",{type:"number",disabled:!e,className:Fn,min:6,max:200,value:t.textStyle?.fontSize??18,onChange:s=>o({fontSize:Number(s.target.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Color"}),jsx(es,{disabled:!e,value:dt(t.textStyle?.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>o({color:s})})]}),jsxs("div",{className:"flex gap-1 col-span-2",children:[jsx(U8,{label:"B",active:!!t.textStyle?.bold,disabled:!e,onClick:()=>o({bold:!t.textStyle?.bold})}),jsx(U8,{label:"I",active:!!t.textStyle?.italic,disabled:!e,italic:true,onClick:()=>o({italic:!t.textStyle?.italic})}),jsx(U8,{label:"U",active:!!t.textStyle?.underline,disabled:!e,underline:true,onClick:()=>o({underline:!t.textStyle?.underline})})]})]})]})]})}function U8({label:t,active:e,disabled:n,italic:r,underline:o,onClick:i}){return jsx("button",{type:"button",disabled:n,className:le("px-2 py-1 rounded text-[11px] transition-colors",r&&"italic",o&&"underline",e?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:i,children:t})}function qWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"2",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M14 16 L17 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("rect",{x:"19",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M31 16 L34 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("rect",{x:"36",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7})]})}function KWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"17",y:"2",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M24 10 L12 18 M24 10 L36 18",stroke:"currentColor",strokeWidth:"1",opacity:.5}),jsx("rect",{x:"4",y:"18",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"30",y:"18",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7})]})}function ZWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"24",cy:"5",r:"4",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"37",cy:"20",r:"4",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"11",cy:"20",r:"4",fill:"currentColor",opacity:.7}),jsx("path",{d:"M28 6 L34 17 M33 23 L14 23 M14 18 L20 7",stroke:"currentColor",strokeWidth:"1",opacity:.4,fill:"none"})]})}function JWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"4",y:"3",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"26",y:"3",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"18",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"26",y:"18",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7})]})}function QWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"16",y:"2",width:"16",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"10",y:"12",width:"28",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"22",width:"40",height:"8",rx:"2",fill:"currentColor",opacity:.7})]})}function e7e(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"4",y:"3",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"13",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"23",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7})]})}var tae={process:qWe,hierarchy:KWe,cycle:ZWe,matrix:JWe,pyramid:QWe,list:e7e};var n7e=jX.map(t=>({type:t,i18nKey:`pptx.smartart.category.${t}`}));function rae({smartArtData:t,canEdit:e,onUpdateSmartArt:n}){let{t:r}=useTranslation(),o=t.resolvedLayoutType??"list",i=s=>{if(!e||s===o)return;let a=XX(t,s);n({layoutType:a.layoutType,resolvedLayoutType:a.resolvedLayoutType,layout:a.layout});};return jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:r("pptx.smartart.switchLayout")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:n7e.map(({type:s,i18nKey:a})=>{let l=o===s,c=tae[s];return jsxs("button",{type:"button",disabled:!e,className:le("flex flex-col items-center gap-0.5 rounded border p-1.5 transition-colors","text-[9px] leading-tight",l?"border-primary bg-primary/15 text-primary":"border-border text-muted-foreground hover:bg-muted hover:text-foreground",!e&&"opacity-50 cursor-not-allowed"),onClick:()=>i(s),title:r(a),children:[jsx("div",{className:"w-10 h-7",children:c?jsx(c,{}):null}),jsx("span",{className:"truncate w-full text-center",children:r(a)})]},s)})})]})}var o7e=["colorful1","colorful2","colorful3","monochromatic1","monochromatic2"],i7e=["flat","moderate","intense"];function oae({smartArtData:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.nodes??[],i=h=>{n({smartArtData:{...t,...h}});},s=h=>{n({smartArtData:h});},a=(h,m)=>{s(mX(t,h,m));},l=()=>{s(k5(t));},c=h=>{s(k5(t,h,"Sub-item"));},u=h=>{s(hX(t,h));},d=h=>{i({nodes:o.map(m=>m.id===h?{...m,parentId:void 0}:m),drawingShapes:void 0});},p=h=>{let m=o.filter(y=>!y.parentId),x=m.findIndex(y=>y.id===h);if(x>0){let y=m[x-1].id;i({nodes:o.map(v=>v.id===h?{...v,parentId:y}:v),drawingShapes:void 0});}},f=(h,m)=>{h.key==="Tab"&&!h.shiftKey?(h.preventDefault(),p(m)):h.key==="Tab"&&h.shiftKey&&(h.preventDefault(),d(m));};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:r("pptx.smartart.title")}),jsxs("div",{className:"space-y-2",children:[jsx(rae,{smartArtData:t,canEdit:e,onUpdateSmartArt:i}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.smartart.colorScheme")}),jsx("select",{disabled:!e,className:le(Fn,"w-full"),value:t.colorScheme??"colorful1",onChange:h=>i({colorScheme:h.target.value}),children:o7e.map(h=>jsx("option",{value:h,children:h},h))})]}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.smartart.style")}),jsx("div",{className:"flex gap-1",children:i7e.map(h=>jsx("button",{type:"button",disabled:!e,className:le("flex-1 px-2 py-1 text-[10px] rounded border transition-colors",(t.style??"flat")===h?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground hover:bg-muted"),onClick:()=>i({style:h}),children:h},h))})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r("pptx.smartart.textPane")," (",o.length,")"]}),jsx("button",{type:"button",disabled:!e,className:Xr,onClick:l,children:r("pptx.smartart.addItem")})]}),jsx("div",{className:"max-h-52 overflow-y-auto space-y-1 pr-1",children:o.map((h,m)=>{let x=!!h.parentId;return jsx("div",{className:le("rounded border bg-background/60 p-1.5",x?"border-border/60 ml-4":"border-border"),children:jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-[9px] text-muted-foreground w-3 shrink-0",children:x?"\u2022":`${m+1}`}),jsx("input",{type:"text",disabled:!e,className:le(Fn,"flex-1 text-[11px] py-0.5"),value:h.text,onChange:y=>a(h.id,y.target.value),onKeyDown:y=>f(y,h.id),placeholder:r("pptx.smartart.typePlaceholder")}),jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[!x&&jsx("button",{type:"button",disabled:!e,className:"text-[9px] text-muted-foreground hover:text-primary px-1",onClick:()=>c(h.id),title:r("pptx.smartart.addSubItem"),children:"+Sub"}),jsx("button",{type:"button",disabled:!e||o.length<=1,className:"text-[9px] text-muted-foreground hover:text-red-400 px-1",onClick:()=>u(h.id),title:r("pptx.smartart.remove"),children:"x"})]})]})},h.id)})}),jsx("div",{className:"text-[9px] text-muted-foreground mt-1",children:r("pptx.smartart.tabHint")})]})]})}function iae(t,e,n){let r=t.rows[e];if(!r)return null;let o=r.cells[n],i=Math.max(1,o?.gridSpan??1),s=n+i,a=r.cells[s];if(!a||a.hMerge||a.vMerge)return null;let l=Math.max(1,a.gridSpan??1);return t.rows.map((c,u)=>{if(u!==e)return c;let d=c.cells.map((p,f)=>f===n?{...p,gridSpan:i+l}:f>=s&&f<s+l?{...p,hMerge:true,text:""}:p);return {...c,cells:d}})}function sae(t,e,n){let r=t.rows[e];if(!r)return null;let o=r.cells[n];if(!o)return null;let i=Math.max(1,o.rowSpan??1),s=e+i;if(s>=t.rows.length)return null;let l=t.rows[s]?.cells[n];if(!l||l.hMerge||l.vMerge)return null;let c=Math.max(1,l.rowSpan??1);return t.rows.map((u,d)=>d===e?{...u,cells:u.cells.map((p,f)=>f===n?{...p,rowSpan:i+c}:p)}:d===s?{...u,cells:u.cells.map((p,f)=>f===n?{...p,vMerge:true,text:""}:p)}:u)}function aae(t,e,n){let r=t.rows[e],o=r?.cells[n];if(!r||!o)return null;let i=Math.max(1,o.gridSpan??1),s=Math.max(1,o.rowSpan??1);return i===1&&s===1?null:t.rows.map((a,l)=>{let c=a.cells.map((u,d)=>l===e&&d===n?{...u,gridSpan:void 0,rowSpan:void 0}:l===e&&d>n&&d<n+i?{...u,hMerge:void 0}:l>e&&l<e+s&&d===n?{...u,vMerge:void 0}:u);return {...a,cells:c}})}var nN="bg-muted border border-border rounded px-2 py-1 text-[11px] w-full",rN="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full text-[11px]",Vp="text-muted-foreground text-[11px]",lae="text-[11px] uppercase tracking-wide text-muted-foreground",cae=[{value:"solid",i18nKey:"pptx.table.fillSolid"},{value:"gradient",i18nKey:"pptx.table.fillGradient"},{value:"pattern",i18nKey:"pptx.table.fillPattern"},{value:"none",i18nKey:"pptx.table.fillNone"}],uae=[{value:"linear",i18nKey:"pptx.table.gradientLinear"},{value:"radial",i18nKey:"pptx.table.gradientRadial"}],dae=oF.slice(0,20);function pae({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.fillMode??"solid",i=s=>{let a=s;n(a==="gradient"?{fillMode:"gradient",gradientFillType:t.gradientFillType??"linear",gradientFillAngle:t.gradientFillAngle??90,gradientFillStops:t.gradientFillStops??[{color:"#FF0000",position:0},{color:"#0000FF",position:100}]}:a==="pattern"?{fillMode:"pattern",patternFillPreset:t.patternFillPreset??"ltDnDiag",patternFillForeground:t.patternFillForeground??"#000000",patternFillBackground:t.patternFillBackground??"#FFFFFF"}:{fillMode:a});};return jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:Vp,children:r("pptx.table.fillMode")}),jsx("select",{disabled:!e,className:nN,value:o,onChange:s=>i(s.target.value),children:cae.map(s=>jsx("option",{value:s.value??"",children:r(s.i18nKey)},s.value))})]}),o==="gradient"&&jsx(s7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),o==="pattern"&&jsx(a7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),jsxs("div",{className:"space-y-1",children:[jsx("span",{className:lae,children:r("pptx.table.margins")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:[["marginTop","pptx.table.marginTop"],["marginBottom","pptx.table.marginBottom"],["marginLeft","pptx.table.marginLeft"],["marginRight","pptx.table.marginRight"]].map(([s,a])=>jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r(a)}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:200,value:t[s]??0,onChange:l=>n({[s]:Number(l.target.value)})})]},s))})]})]})}function s7e({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.gradientFillStops??[],i=t.gradientFillType??"linear",s=(l,c)=>{let u=o.map((d,p)=>p===l?{...d,...c}:d);n({gradientFillStops:u});},a=()=>{n({gradientFillStops:[...o,{color:"#888888",position:50}]});};return jsxs("div",{className:"space-y-1.5",children:[jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.gradientType")}),jsx("select",{disabled:!e,className:nN,value:i,onChange:l=>n({gradientFillType:l.target.value}),children:uae.map(l=>jsx("option",{value:l.value,children:r(l.i18nKey)},l.value))})]}),i==="linear"&&jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.gradientAngle")}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:360,value:t.gradientFillAngle??90,onChange:l=>n({gradientFillAngle:Number(l.target.value)})})]})]}),jsx("span",{className:Vp,children:r("pptx.table.gradientStops")}),o.map((l,c)=>jsxs("div",{className:"flex items-center gap-1",children:[jsx("input",{type:"color",disabled:!e,className:"h-6 w-6 rounded border border-border cursor-pointer",value:l.color,onChange:u=>s(c,{color:u.target.value})}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:100,value:Math.round(l.position),onChange:u=>s(c,{position:Number(u.target.value)})}),jsx("span",{className:"text-[10px] text-muted-foreground",children:"%"})]},c)),jsx("button",{type:"button",disabled:!e,className:"text-[10px] text-primary hover:underline",onClick:a,children:r("pptx.table.gradientAddStop")})]})}function a7e({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternPreset")}),jsx("select",{disabled:!e,className:nN,value:t.patternFillPreset??"ltDnDiag",onChange:o=>n({patternFillPreset:o.target.value}),children:dae.map(o=>jsx("option",{value:o,children:o},o))})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternForeground")}),jsx("input",{type:"color",disabled:!e,className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",value:t.patternFillForeground??"#000000",onChange:o=>n({patternFillForeground:o.target.value})})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternBackground")}),jsx("input",{type:"color",disabled:!e,className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",value:t.patternFillBackground??"#FFFFFF",onChange:o=>n({patternFillBackground:o.target.value})})]})]})]})}function fae({tableData:t,tableEditorState:e,canEdit:n,onUpdateTableData:r}){let{t:o}=useTranslation(),{rowIndex:i,columnIndex:s}=e,a=t.rows[i]?.cells[s];if(!a)return null;let l=a.style??{},c=u=>{let d=t.rows.map((p,f)=>f!==i?p:{...p,cells:p.cells.map((h,m)=>m!==s?h:{...h,style:{...l,...u}})});r({rows:d});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.cell",{row:i+1,col:s+1})}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground",children:o("pptx.table.fontSize")}),jsx("input",{type:"number",disabled:!n,className:Fn,min:6,max:200,value:l.fontSize??14,onChange:u=>c({fontSize:Number(u.target.value)})})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.color")}),jsx(es,{disabled:!n,value:dt(l.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:u=>c({color:u})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.background")}),jsx(es,{disabled:!n,value:dt(l.backgroundColor,"#ffffff"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:u=>c({backgroundColor:u})})]})]}),jsx(pae,{cellStyle:l,canEdit:n,onUpdateCellStyle:c}),jsx("div",{className:"flex gap-1",children:[["bold","B","font-bold"],["italic","I","italic"],["underline","U","underline"]].map(([u,d,p])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",p,l[u]?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({[u]:!l[u]}),children:d},u))}),jsx("div",{className:"flex gap-1",children:[["left","L"],["center","C"],["right","R"]].map(([u,d])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",l.align===u?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({align:u}),children:d},u))}),jsx("div",{className:"flex gap-1",children:[["top","T"],["middle","M"],["bottom","B"]].map(([u,d])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",l.vAlign===u?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({vAlign:u}),children:d},u))}),jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.table.cellBorders")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:[["Top","borderTopColor","borderTopWidth"],["Bottom","borderBottomColor","borderBottomWidth"],["Left","borderLeftColor","borderLeftWidth"],["Right","borderRightColor","borderRightWidth"]].map(([u,d,p])=>jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:o(`pptx.table.border${u}`)}),jsxs("div",{className:"flex gap-1 items-center",children:[jsx(es,{disabled:!n,value:dt(l[d],"#374151"),className:"w-7 h-6 rounded border border-border bg-transparent cursor-pointer shrink-0",onCommit:f=>c({[d]:f})}),jsx("input",{type:"number",disabled:!n,className:le(Fn,"w-14"),min:0,max:10,value:l[p]??1,onChange:f=>c({[p]:Number(f.target.value)})})]})]},u))})]}),jsxs("div",{className:"grid grid-cols-3 gap-1",children:[jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let u=iae(t,i,s);u&&r({rows:u});},children:o("pptx.table.mergeRight")}),jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let u=sae(t,i,s);u&&r({rows:u});},children:o("pptx.table.mergeDown")}),jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let u=aae(t,i,s);u&&r({rows:u});},children:o("pptx.table.split")})]})]})]})}function hae({tableElement:t,canEdit:e,onUpdateElement:n,tableEditorState:r}){let{t:o}=useTranslation(),i=t.tableData;if(!i)return null;let s=i.rows.length,a=i.columnWidths.length,l=c=>{n({tableData:{...i,...c}});};return jsxs(Fragment,{children:[jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.title")}),jsx("div",{className:"text-[11px] text-muted-foreground mb-2",children:o("pptx.table.rowsColumns",{rows:s,cols:a})}),jsx("div",{className:"space-y-1",children:[["bandedRows","pptx.table.bandedRows"],["firstRowHeader","pptx.table.headerRow"],["bandedColumns","pptx.table.bandedColumns"],["firstCol","pptx.table.firstColumn"],["lastCol","pptx.table.lastColumn"],["lastRow","pptx.table.lastRow"]].map(([c,u])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:!!i[c],onChange:d=>l({[c]:d.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:o(u)})]},c))}),i.bandedRows&&jsxs("label",{className:"flex items-center gap-2 mt-1",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:o("pptx.table.bandRowCycle")}),jsx("input",{type:"number",min:1,max:99,disabled:!e,value:i.bandRowCycle??1,onChange:c=>l({bandRowCycle:Math.max(1,parseInt(c.target.value,10)||1)}),className:"w-14 rounded border border-border bg-background px-1 py-0.5 text-[11px]"})]}),i.bandedColumns&&jsxs("label",{className:"flex items-center gap-2 mt-1",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:o("pptx.table.bandColCycle")}),jsx("input",{type:"number",min:1,max:99,disabled:!e,value:i.bandColCycle??1,onChange:c=>l({bandColCycle:Math.max(1,parseInt(c.target.value,10)||1)}),className:"w-14 rounded border border-border bg-background px-1 py-0.5 text-[11px]"})]})]}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.stylePresets")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:BW.map(c=>jsx("button",{type:"button",disabled:!e,title:c.label,className:"rounded border border-border hover:border-primary overflow-hidden h-10 transition-colors",onClick:()=>{let u=i.rows.map((d,p)=>({...d,cells:d.cells.map(f=>({...f,style:{...f.style,backgroundColor:p===0&&i.firstRowHeader?c.headerBg:i.bandedRows&&(p-(i.firstRowHeader?1:0))%2===0?c.bandBg:void 0,color:p===0&&i.firstRowHeader?c.headerFg:f.style?.color,bold:p===0&&i.firstRowHeader?true:f.style?.bold,borderColor:c.borderColor}}))}));l({rows:u});},children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"flex-1",style:{backgroundColor:c.headerBg}}),jsx("div",{className:"flex-1",style:{backgroundColor:c.bandBg}}),jsx("div",{className:"flex-1 border-t",style:{borderColor:c.borderColor}})]})},c.id))})]}),jsxs("div",{className:xn,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:hn,children:o("pptx.table.columnWidths")}),jsx("button",{type:"button",className:Xr,disabled:!e,onClick:()=>{let c=1/a;l({columnWidths:Array(a).fill(c)});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.columnWidths.map((c,u)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:u+1}),jsx("input",{type:"range",disabled:!e,min:5,max:80,value:Math.round(c*100),className:"flex-1 accent-primary",onChange:d=>{let p=Number(d.target.value)/100,f=i.columnWidths[u],h=p-f,m=[...i.columnWidths];m[u]=p;let x=1-f;if(x>0)for(let S=0;S<m.length;S++)S!==u&&(m[S]=Math.max(.05,i.columnWidths[S]-h*(i.columnWidths[S]/x)));let y=m.reduce((S,w)=>S+w,0),v=m.map(S=>S/y);l({columnWidths:v});}}),jsxs("span",{className:"w-10 text-right text-muted-foreground",children:[Math.round(c*100),"%"]})]},u))})]}),jsxs("div",{className:xn,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:hn,children:o("pptx.table.rowHeights")}),jsx("button",{type:"button",className:Xr,disabled:!e,onClick:()=>{let c=Math.round(i.rows.reduce((u,d)=>u+(d.height??32),0)/s);l({rows:i.rows.map(u=>({...u,height:c}))});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.rows.map((c,u)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:u+1}),jsx("input",{type:"number",disabled:!e,className:Fn,min:16,max:500,value:c.height??32,onChange:d=>{let p=i.rows.map((f,h)=>h===u?{...f,height:Number(d.target.value)}:f);l({rows:p});}}),jsx("span",{className:"w-6 text-muted-foreground",children:"px"})]},u))})]}),r&&jsx(fae,{tableData:i,tableEditorState:r,canEdit:e,onUpdateTableData:l})]})}function mae({selectedElement:t,canEdit:e,slides:n,tableEditorState:r,mediaDataUrls:o,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a,onMoveLayer:l}){let{t:c}=useTranslation();return jsxs(Fragment,{children:[jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:c("pptx.inspector.element")}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:use.map(([u,d])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-4 text-muted-foreground",children:u}),jsx("input",{type:"number",className:Fn,disabled:!e,value:Math.round(t[d]??0),onChange:p=>i({[d]:Number(p.target.value)})})]},d))})]}),t.type==="table"&&jsx(hae,{tableElement:t,canEdit:e,onUpdateElement:i,tableEditorState:r}),t.type==="chart"&&jsx(wse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="smartArt"&&t.smartArtData&&jsx(oae,{smartArtData:t.smartArtData,canEdit:e,onUpdateElement:i}),yi(t)&&jsx(Hse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="media"&&jsx(Qse,{element:t,mediaDataUrls:o??new Map,canEdit:e,onUpdateElement:i}),jsx(Cse,{selectedElement:t,canEdit:e,onUpdateElementStyle:s}),jsx(Tse,{selectedElement:t}),jsx(Mse,{selectedElement:t}),jsx(eae,{selectedElement:t,canEdit:e,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a}),jsx(pse,{selectedElement:t,slides:n,canEdit:e,onUpdateElement:i}),jsx(_se,{selectedElement:t,canEdit:e,onUpdateElement:i}),jsx(Ese,{canEdit:e,onMoveLayer:l})]})}function z8({comment:t,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:u,onDeleteComment:d,onToggleCommentResolved:p,onStartReply:f,onCancelReply:h,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:y,depth:v=0}){let{t:S}=useTranslation(),w=r===t.id,C=i===t.id,T=s[t.id]??"",[E,M]=useState(true),A=t.replies??[],R=t.elementId?n?.elements?.find(k=>k.id===t.elementId)??null:null;return jsxs("div",{className:le("rounded border border-border bg-card p-2",v>0&&"ml-3 border-l-2 border-l-primary/40"),children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:t.author||"Author"}),t.resolved&&jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-green-900/40 px-1.5 py-0.5 text-[9px] font-medium text-green-300 flex-shrink-0",children:[jsx(LuCheck,{className:"h-2.5 w-2.5"}),S("pptx.comments.resolved")]})]}),jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:U7(t.createdAt)})]}),t.elementId&&(R?jsxs("button",{type:"button",className:"mt-1 inline-flex items-center gap-1 rounded bg-primary/20 px-1.5 py-0.5 text-[10px] text-primary hover:bg-primary/30 transition-colors",title:S("pptx.comments.commentingOn",{element:cs(R)}),onClick:()=>y(R.id),children:[jsx(LuType,{className:"h-2.5 w-2.5"}),cs(R)]}):jsx("span",{className:"mt-1 inline-flex items-center gap-1 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:S("pptx.comments.deletedElement")})),w?jsxs("div",{className:"mt-1.5 space-y-1.5",children:[jsx("textarea",{value:o,onChange:k=>u(k.target.value),rows:3,className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground outline-none focus:border-primary resize-y"}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>l(t.id),disabled:String(o).trim().length===0,children:S("pptx.comments.save")}),jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent",onClick:c,children:S("pptx.comments.cancel")})]})]}):jsxs(Fragment,{children:[jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-[11px] text-foreground",children:t.text}),e&&jsxs("div",{className:"mt-1.5 inline-flex items-center rounded bg-muted overflow-hidden",children:[jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 hover:bg-accent text-foreground hover:text-foreground transition-colors",onClick:()=>a(t.id),title:S("pptx.comments.edit"),children:jsx(LuPencil,{className:"h-3 w-3"})}),f&&v===0&&jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 border-l border-border hover:bg-accent text-foreground hover:text-foreground transition-colors",onClick:()=>f(t.id),title:S("pptx.comments.reply"),children:jsx(LuReply,{className:"h-3 w-3"})}),p&&jsx("button",{type:"button",className:le("inline-flex items-center justify-center p-1.5 border-l border-border transition-colors",t.resolved?"bg-green-900/40 text-green-300 hover:bg-green-900/60":"hover:bg-accent text-foreground hover:text-foreground"),onClick:()=>p(t.id),title:t.resolved?S("pptx.comments.unresolve"):S("pptx.comments.resolve"),children:jsx(LuCheck,{className:"h-3 w-3"})}),jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 border-l border-border hover:bg-red-900/40 text-muted-foreground hover:text-red-300 transition-colors",onClick:()=>d(t.id),title:S("pptx.comments.delete"),children:jsx(LuTrash2,{className:"h-3 w-3"})})]})]}),A.length>0&&jsxs("div",{className:"mt-2",children:[jsxs("button",{type:"button",className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>M(k=>!k),children:[E?jsx(LuChevronDown,{className:"h-3 w-3"}):jsx(LuChevronRight,{className:"h-3 w-3"}),S("pptx.comments.repliesCount",{count:A.length})]}),E&&jsx("div",{className:"mt-1.5 space-y-1.5",children:A.map((k,N)=>jsx(z8,{comment:k,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:u,onDeleteComment:d,onToggleCommentResolved:p,onStartReply:f,onCancelReply:h,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:y,depth:v+1},`${k.id}-${N}`))})]}),C&&h&&m&&x&&jsxs("div",{className:"mt-2 space-y-1.5 pl-3 border-l-2 border-l-primary/40",children:[jsx("textarea",{value:T,onChange:k=>m(t.id,k.target.value),rows:2,placeholder:S("pptx.comments.replyPlaceholder",{author:t.author||"Author"}),className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground outline-none focus:border-primary resize-y",onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),x(t.id));}}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>x(t.id),disabled:T.trim().length===0,children:[jsx(LuReply,{className:"h-3 w-3"}),S("pptx.comments.addReply")]}),jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent",onClick:h,children:S("pptx.comments.cancel")})]})]})]})}function yae({comments:t,canEdit:e,activeSlide:n,selectedElement:r,editingCommentId:o,commentEditDraft:i,commentDraft:s,replyingToCommentId:a,replyDraftByCommentId:l,onSetCommentDraft:c,onAddComment:u,onDeleteComment:d,onStartEditComment:p,onSaveEditComment:f,onCancelEditComment:h,onSetCommentEditDraft:m,onToggleCommentResolved:x,onStartReply:y,onCancelReply:v,onReplyDraftChange:S,onSubmitReply:w,onSelectElement:C}){let{t:T}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:T("pptx.comments.slideComments")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:t.length})]}),t.length===0?jsx("div",{className:"text-xs text-muted-foreground",children:T("pptx.comments.noComments")}):jsx("div",{className:"space-y-2 max-h-[42vh] overflow-y-auto pr-1",children:t.map((M,A)=>jsx(z8,{comment:M,canEdit:e,activeSlide:n,editingCommentId:o,commentEditDraft:i,replyingToCommentId:a,replyDraftByCommentId:l,onStartEditComment:p,onSaveEditComment:f,onCancelEditComment:h,onSetCommentEditDraft:m,onDeleteComment:d,onToggleCommentResolved:x,onStartReply:y,onCancelReply:v,onReplyDraftChange:S,onSubmitReply:w,onSelectElement:C},`${M.id}-${A}`))}),e&&jsxs("div",{className:"space-y-1.5 pt-1 border-t border-border",children:[r&&jsxs("div",{className:"inline-flex items-center gap-1 rounded bg-primary/20 px-1.5 py-0.5 text-[10px] text-primary",children:[jsx(LuType,{className:"h-2.5 w-2.5"}),T("pptx.comments.commentingOn",{element:cs(r)})]}),jsx("textarea",{rows:2,placeholder:r?T("pptx.comments.addOnElement",{element:cs(r)}):T("pptx.comments.addPlaceholder"),value:s,className:"w-full bg-muted border border-border rounded px-2 py-1 text-xs resize-y outline-none focus:border-primary",onChange:M=>c(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.metaKey||M.ctrlKey)&&(M.preventDefault(),u());}}),jsxs("button",{type:"button",onClick:u,disabled:!s.trim(),className:le("w-full inline-flex items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",s.trim()?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:[jsx(LuMessageSquare,{className:"w-3.5 h-3.5"}),T("pptx.comments.addComment")]})]})]})}function G8({label:t,value:e}){return jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{children:t}),jsx("span",{className:"text-muted-foreground",children:e})]})}function oN({label:t,disabled:e,value:n,onChange:r}){return jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"text",className:Fn,disabled:e,value:n,onChange:o=>r(o.target.value)})]})}function T7e({customProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-muted-foreground",children:"Custom Properties"}),e&&jsx("button",{type:"button",className:Xr,onClick:()=>n([...t,{name:`Property ${t.length+1}`,value:"",type:"lpwstr"}]),children:"Add"})]}),t.length===0?jsx("div",{className:"text-[10px] text-muted-foreground",children:"No custom properties"}):t.map((r,o)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1",children:[jsx("input",{type:"text",className:Fn,disabled:!e,value:r.name,onChange:i=>n(t.map((s,a)=>a===o?{...s,name:i.target.value}:s))}),jsx("input",{type:"text",className:Fn,disabled:!e,value:r.value,onChange:i=>n(t.map((s,a)=>a===o?{...s,value:i.target.value}:s))}),e&&jsx("button",{type:"button",className:le(Xr,"px-1.5 text-red-400 hover:text-red-300"),onClick:()=>n(t.filter((i,s)=>s!==o)),children:"\xD7"})]},`${r.name}-${o}`))]})}function bae({notesCanvasSize:t,notesMaster:e,handoutMaster:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Notes & Handout"}),jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[jsx(G8,{label:"Notes Size",value:t?`${t.width} \xD7 ${t.height}px`:"Not available"}),jsx(G8,{label:"Notes Master",value:e?`${e.placeholders?.length??0} placeholders`:"Not available"}),jsx(G8,{label:"Handout Master",value:n?`${n.placeholders?.length??0} placeholders`:"Not available"})]})]})}function vae({coreProperties:t,appProperties:e,customProperties:n,canEdit:r,onUpdateCoreProperties:o,onUpdateAppProperties:i,onUpdateCustomProperties:s}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Document"}),jsxs("div",{className:"space-y-2 text-[11px] text-muted-foreground",children:[jsx(oN,{label:"Title",disabled:!r,value:t?.title??"",onChange:a=>o({title:a})}),jsx(oN,{label:"Author",disabled:!r,value:t?.creator??"",onChange:a=>o({creator:a})}),jsx(oN,{label:"Company",disabled:!r,value:e?.company??"",onChange:a=>i({company:a})}),jsx(oN,{label:"Application",disabled:!r,value:e?.application??"",onChange:a=>i({application:a})}),jsx(T7e,{customProperties:n,canEdit:r,onUpdate:s})]})]})}function iN({label:t,disabled:e,checked:n,onChange:r}){return jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"checkbox",disabled:e,checked:n,onChange:o=>r(o.target.checked)})]})}function Sae({presentationProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Presentation"}),jsxs("div",{className:"space-y-1.5 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Show Type"}),jsxs("select",{disabled:!e,className:le(Fn,"w-28"),value:t.showType??"presented",onChange:r=>n({showType:r.target.value}),children:[jsx("option",{value:"presented",children:"Presented"}),jsx("option",{value:"browsed",children:"Browsed"}),jsx("option",{value:"kiosk",children:"Kiosk"})]})]}),jsx(iN,{label:"Loop Continuously",disabled:!e,checked:!!t.loopContinuously,onChange:r=>n({loopContinuously:r})}),jsx(iN,{label:"Show Narration",disabled:!e,checked:t.showWithNarration!==false,onChange:r=>n({showWithNarration:r})}),jsx(iN,{label:"Show Animation",disabled:!e,checked:t.showWithAnimation!==false,onChange:r=>n({showWithAnimation:r})}),jsx(iN,{label:"Frame Slides",disabled:!e,checked:!!t.printFrameSlides,onChange:r=>n({printFrameSlides:r})}),jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Slides/Page"}),jsx("input",{type:"number",min:1,max:16,disabled:!e,className:le(Fn,"w-20"),value:t.printSlidesPerPage??1,onChange:r=>n({printSlidesPerPage:Number(r.target.value)})})]})]})]})}function wae({themeOptions:t,selectedThemePath:e,setSelectedThemePath:n,canEdit:r,onApplyTheme:o}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Theme"}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Theme"}),jsx("select",{disabled:t.length===0,className:Fn,value:e,onChange:i=>n(i.target.value),children:t.length===0?jsx("option",{value:"",children:"No themes"}):t.map(i=>jsx("option",{value:i.path,children:i.name||i.path.split("/").pop()},i.path))})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsx("button",{type:"button",className:Xr,disabled:!r||!e,onClick:()=>o(e,false),children:"Apply First Master"}),jsx("button",{type:"button",className:Xr,disabled:!r||!e,onClick:()=>o(e,true),children:"Apply All Masters"})]})]})]})}function Cae({canvasSize:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Slide Size"}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[["W","width"],["H","height"]].map(([r,o])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r}),jsx("input",{type:"number",className:Fn,disabled:!e,value:t[o],onChange:i=>n({...t,[o]:Number(i.target.value)})})]},o))})]})}var Tae={bg1:"Background 1",tx1:"Text 1",bg2:"Background 2",tx2:"Text 2",accent1:"Accent 1",accent2:"Accent 2",accent3:"Accent 3",accent4:"Accent 4",accent5:"Accent 5",accent6:"Accent 6",hlink:"Hyperlink",folHlink:"Followed Hyperlink"};function Mae({activeSlide:t,theme:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=t?.clrMapOverride,s=pX(i),a=useMemo(()=>[...Mf],[]),l=useCallback(d=>{if(d){let p={};for(let f of Id)p[f]=Nd[f];r({clrMapOverride:p});}else r({clrMapOverride:void 0});},[r]),c=useCallback((d,p)=>{let h={...i??{},[d]:p};for(let m of Id)h[m]||(h[m]=Nd[m]);r({clrMapOverride:h});},[i,r]),u=useCallback(d=>e?.colorScheme?e.colorScheme[d]:void 0,[e]);return t?jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"inline-flex items-center gap-2 text-xs",children:[jsx("input",{type:"checkbox",disabled:!n,checked:s,onChange:d=>l(d.target.checked)}),o("pptx.themeOverride.enableOverride")]}),s&&i&&jsx("div",{className:"space-y-1.5",children:Id.map(d=>{let p=i[d]??Nd[d],f=u(p);return jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-24 truncate text-muted-foreground",title:Tae[d],children:Tae[d]}),jsx("div",{className:"h-4 w-4 rounded-sm border border-border shrink-0",style:{backgroundColor:f?`#${f.replace(/^#/,"")}`:void 0}}),jsx("select",{disabled:!n,className:"flex-1 bg-muted border border-border rounded px-1 py-0.5 text-[11px]",value:p,onChange:h=>c(d,h.target.value),children:a.map(h=>jsx("option",{value:h,children:h},h))})]},d)})})]}):null}function _ae({tagCollections:t,onUpdateTagCollections:e,canEdit:n}){let{t:r}=useTranslation(),[o,i]=useState(true),s=t.flatMap((u,d)=>u.tags.map((p,f)=>({...p,colIdx:d,tagIdx:f}))),a=(u,d,p,f)=>{let h=t.map((m,x)=>x!==u?m:{...m,tags:m.tags.map((y,v)=>v===d?{...y,[p]:f}:y)});e(h);},l=(u,d)=>{let p=t.map((f,h)=>h!==u?f:{...f,tags:f.tags.filter((m,x)=>x!==d)});e(p);},c=()=>{if(t.length===0)e([{path:"ppt/tags/tag1.xml",tags:[{name:"",value:""}]}]);else {let u=t.map((d,p)=>p!==0?d:{...d,tags:[...d.tags,{name:"",value:""}]});e(u);}};return jsxs("div",{className:xn,children:[jsxs("button",{type:"button",className:"flex items-center gap-1 w-full",onClick:()=>i(!o),children:[o?jsx(LuChevronRight,{className:"w-3 h-3 text-muted-foreground"}):jsx(LuChevronDown,{className:"w-3 h-3 text-muted-foreground"}),jsx("span",{className:hn,children:r("pptx.tags.title")}),jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:s.length})]}),!o&&jsxs("div",{className:"space-y-1.5",children:[s.length===0?jsx("div",{className:"text-[10px] text-muted-foreground",children:r("pptx.tags.noTags")}):s.map((u,d)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1 text-[11px]",children:[jsx("input",{type:"text",className:Fn,disabled:!n,placeholder:r("pptx.tags.name"),value:u.name,onChange:p=>a(u.colIdx,u.tagIdx,"name",p.target.value)}),jsx("input",{type:"text",className:Fn,disabled:!n,placeholder:r("pptx.tags.value"),value:u.value,onChange:p=>a(u.colIdx,u.tagIdx,"value",p.target.value)}),n&&jsx("button",{type:"button",className:le(Xr,"px-1.5 text-red-400 hover:text-red-300"),title:r("pptx.tags.deleteTag"),onClick:()=>l(u.colIdx,u.tagIdx),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},`${u.colIdx}-${u.tagIdx}-${d}`)),n&&jsx("button",{type:"button",className:Xr,onClick:c,children:r("pptx.tags.addTag")})]})]})}function Eae({presentationProperties:t,canEdit:e,onUpdatePresentationProperties:n,themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,onApplyTheme:s,activeSlide:a,theme:l,onUpdateSlide:c,canvasSize:u,onUpdateCanvasSize:d,notesCanvasSize:p,notesMaster:f,handoutMaster:h,coreProperties:m,onUpdateCoreProperties:x,appProperties:y,onUpdateAppProperties:v,customProperties:S,onUpdateCustomProperties:w,tagCollections:C,onUpdateTagCollections:T}){let{t:E}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsx(Sae,{presentationProperties:t,canEdit:e,onUpdate:n}),jsx(wae,{themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,canEdit:e,onApplyTheme:s}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:E("pptx.themeOverride.heading")}),jsx(Mae,{activeSlide:a,theme:l,canEdit:e,onUpdateSlide:c})]}),jsx(Cae,{canvasSize:u,canEdit:e,onUpdate:d}),jsx(bae,{notesCanvasSize:p,notesMaster:f,handoutMaster:h}),jsx(vae,{coreProperties:m,appProperties:y,customProperties:S,canEdit:e,onUpdateCoreProperties:x,onUpdateAppProperties:v,onUpdateCustomProperties:w}),C&&T&&jsx(_ae,{tagCollections:C,onUpdateTagCollections:T,canEdit:e}),a&&jsxs("div",{className:le(xn,"space-y-1"),children:[jsx("div",{className:hn,children:"Slide"}),jsxs("div",{className:"text-[11px] text-muted-foreground",children:[a.elements?.length??0," elements"]})]})]})}function Aae({activeSlide:t,canEdit:e,onUpdateSlide:n,editTemplateMode:r,slideMasters:o,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s}){let a=useRef(null);return jsxs(Fragment,{children:[jsxs("div",{className:le(xn,"space-y-2"),children:[jsx("div",{className:hn,children:"Background"}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-10 shrink-0",children:"Colour"}),jsx(es,{value:dt(t.backgroundColor,"#ffffff"),disabled:!e,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:l=>n({backgroundColor:l})}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:t.backgroundColor||"none"})]}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-10 shrink-0",children:"Image"}),jsx("input",{ref:a,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp,image/svg+xml",className:"hidden",disabled:!e,onChange:l=>{let c=l.target.files?.[0];if(!c)return;let u=new FileReader;u.onload=()=>{typeof u.result=="string"&&n({backgroundImage:u.result});},u.readAsDataURL(c),l.target.value="";}}),jsx("button",{type:"button",className:le(Xr,"flex-1 text-center"),disabled:!e,onClick:()=>a.current?.click(),children:t.backgroundImage?"Replace Image":"Choose Image"})]}),t.backgroundImage&&jsxs("div",{className:"relative mt-1",children:[jsx("img",{src:t.backgroundImage,alt:"Background preview",className:"w-full h-16 object-cover rounded border border-border"}),jsx("button",{type:"button",className:"absolute top-0.5 right-0.5 rounded bg-background/80 hover:bg-red-700 p-0.5 text-[10px] transition-colors",disabled:!e,title:"Remove background image",onClick:()=>n({backgroundImage:void 0}),children:jsx(LuX,{className:"w-3 h-3"})})]})]}),(t.backgroundColor||t.backgroundImage||t.backgroundGradient)&&jsx("button",{type:"button",className:le(Xr,"w-full text-center text-red-400 hover:text-red-300"),disabled:!e,onClick:()=>n({backgroundColor:void 0,backgroundImage:void 0,backgroundGradient:void 0}),children:"Clear Background"})]}),r&&i&&s&&jsx(L7e,{activeSlide:t,slideMasters:o,canEdit:e,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s})]})}function L7e({activeSlide:t,slideMasters:e,canEdit:n,onSetTemplateBackground:r,onGetTemplateBackgroundColor:o}){return jsxs("div",{className:le(xn,"space-y-2"),children:[jsx("div",{className:hn,children:"Template Backgrounds"}),t.layoutPath&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-14 shrink-0 truncate",title:t.layoutName??t.layoutPath,children:"Layout"}),jsx(es,{value:dt(o(t.layoutPath),"#ffffff"),disabled:!n,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:i=>r(t.layoutPath,i)}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:t.layoutName??"Layout"})]}),(()=>{let i=e?.find(s=>s.layoutPaths?.includes(t.layoutPath??""));return i?jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-14 shrink-0 truncate",title:i.name??i.path,children:"Master"}),jsx(es,{value:dt(o(i.path),"#ffffff"),disabled:!n,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:s=>r(i.path,s)}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:i.name??"Master"})]}):null})()]})}function W8(t){let{isOpen:e,canEdit:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:u,onClose:d,onUpdateElement:p,onSelectElement:f,onMoveLayer:h,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:E,onUpdateCoreProperties:M,onUpdateAppProperties:A,onUpdateCustomProperties:R,tagCollections:k,onUpdateTagCollections:N,onApplyTheme:F,comments:B,commentDraft:D,editingCommentId:O,commentEditDraft:U,onSetCommentDraft:H,onAddComment:j,onDeleteComment:Z,onStartEditComment:J,onSaveEditComment:W,onCancelEditComment:te,onSetCommentEditDraft:se,onToggleCommentResolved:Ce,onStartReply:ee,onCancelReply:ce,onReplyDraftChange:ue,onSubmitReply:Ne,replyingToCommentId:Ue,replyDraftByCommentId:he,onUpdateCanvasSize:Be,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe,mediaDataUrls:Y,theme:Ge,panelWidth:Ve}=t,We=s!==null,{t:ke}=useTranslation(),[wt,V]=useState(""),$=80,ie=500,ve=220,[De,$e]=useState(ve),ze=useCallback(ae=>{$e(Se=>Math.min(ie,Math.max($,Se-ae)));},[]);return useEffect(()=>{let ae=xe?.[0]?.themePath;if(ae&&ae.length>0){V(ae);return}let Se=E[0]?.path??"";V(Ye=>Ye||Se);},[xe,E]),jsxs(Fragment,{children:[e&&jsx("button",{type:"button","aria-label":ke("common.close"),onClick:d,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:le("bg-background flex flex-col text-xs text-foreground shadow-xl","max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[75dvh] max-md:rounded-t-2xl max-md:border-t max-md:border-border max-md:z-30 max-md:pb-[max(env(safe-area-inset-bottom),0px)]","max-md:transition-transform max-md:duration-200 max-md:ease-in-out",e?"max-md:translate-y-0":"max-md:translate-y-full","md:h-full md:border-l md:border-border",!Ve&&"md:w-72"),style:Ve?{width:Ve}:void 0,children:[jsx("div",{className:"md:hidden flex items-center justify-center pt-2 pb-1",children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border",children:[jsx("div",{className:"flex items-center gap-1 rounded bg-muted p-0.5",children:cse.map(({key:ae,label:Se,icon:Ye})=>jsxs("button",{type:"button",title:Se,className:le("flex items-center gap-1 px-2 py-1 rounded text-[11px] transition-colors",c===ae?"bg-primary text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"),onClick:()=>u(ae),children:[jsx(Ye,{className:"w-3.5 h-3.5"}),jsx("span",{className:"hidden sm:inline",children:Se})]},ae))}),jsx("button",{type:"button",onClick:d,title:ke("common.close"),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:[c==="elements"&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:le(hn,"mb-2"),children:ke("pptx.inspector.layerOrder")}),r?[...r.elements||[]].reverse().map((ae,Se)=>{let Ye=(r.elements||[]).length-1-Se,Q=s?.id===ae.id||a.includes(ae.id),pe=(ot(ae)?(ae.text||"").slice(0,24):void 0)||ae.type;return jsxs("div",{title:`${ae.type} \u2014 ${ae.id}`,className:le("flex items-center gap-2 px-2 py-1 rounded cursor-pointer transition-colors",Q?"bg-primary/30 text-primary":"hover:bg-muted text-foreground"),onClick:()=>f(ae.id),children:[jsx("span",{className:"text-muted-foreground w-4 text-right",children:Ye+1}),jsx("span",{className:"flex-1 truncate",children:pe})]},ae.id)}):jsx("div",{className:"text-muted-foreground italic",children:ke("pptx.inspector.noSlideSelected")})]}),c==="properties"&&jsx("div",{className:"space-y-3",children:We&&s?jsx(mae,{selectedElement:s,canEdit:n,slides:o,tableEditorState:l,mediaDataUrls:Y,onUpdateElement:p,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onMoveLayer:h}):jsxs(Fragment,{children:[jsx(Eae,{canEdit:n,canvasSize:i,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:E,selectedThemePath:wt,setSelectedThemePath:V,onApplyTheme:F,onUpdateCoreProperties:M,onUpdateAppProperties:A,onUpdateCustomProperties:R,tagCollections:k,onUpdateTagCollections:N,onUpdateCanvasSize:Be,activeSlide:r,theme:Ge,onUpdateSlide:Te}),r&&jsx(Aae,{activeSlide:r,canEdit:n,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe})]})}),c==="comments"&&jsx(yae,{comments:B,canEdit:n,activeSlide:r,selectedElement:s,editingCommentId:O,commentEditDraft:U,commentDraft:D,replyingToCommentId:Ue??null,replyDraftByCommentId:he??{},onSetCommentDraft:H,onAddComment:j,onDeleteComment:Z,onStartEditComment:J,onSaveEditComment:W,onCancelEditComment:te,onSetCommentEditDraft:se,onToggleCommentResolved:Ce,onStartReply:ee,onCancelReply:ce,onReplyDraftChange:ue,onSubmitReply:Ne,onSelectElement:f})]}),We&&s&&r&&jsxs(Fragment,{children:[jsx(Cp,{direction:"vertical",onResize:ze}),jsx("div",{className:"border-t border-border p-3 overflow-y-auto flex-shrink-0",style:{height:De},children:jsx(lse,{selectedElement:s,activeSlide:r,canEdit:n,onUpdateSlide:Te})})]})]})]})}function H7e(t){if(t.length===0)return "";let e=t[0],n=`M ${e.x} ${e.y}`;for(let r=1;r<t.length;r++){let o=t[r];n+=` L ${o.x} ${o.y}`;}return n}function z7e(t){switch(t){case "laser":return "none";case "pen":return "crosshair";case "highlighter":return "crosshair";case "eraser":return "crosshair";default:return "default"}}function q8({canvasSize:t,editorScale:e,presentationTool:n,annotationStrokes:r,currentStroke:o,laserPosition:i,onPointerDown:s,onPointerMove:a,onPointerUp:l,onLaserMove:c,onLaserLeave:u,onEraseAtPoint:d}){let p=useRef(null),f=useRef(false),h=useCallback((w,C)=>{let T=p.current;if(!T)return null;let E=T.getBoundingClientRect(),M=(w-E.left)/e,A=(C-E.top)/e;return {x:M,y:A}},[e]),m=useCallback(w=>{if(n==="none")return;w.preventDefault(),w.stopPropagation();let C=h(w.clientX,w.clientY);if(C){if(n==="eraser"){f.current=true,d(C.x,C.y);return}(n==="pen"||n==="highlighter")&&s(C.x,C.y);}},[n,h,s,d]),x=useCallback(w=>{if(n==="none")return;let C=h(w.clientX,w.clientY);if(C){if(n==="laser"){c(C.x,C.y);return}if(n==="eraser"&&f.current){d(C.x,C.y);return}(n==="pen"||n==="highlighter")&&a(C.x,C.y);}},[n,h,a,c,d]),y=useCallback(w=>{if(n!=="none"){if(w.preventDefault(),n==="eraser"){f.current=false;return}l();}},[n,l]),v=useCallback(()=>{n==="laser"&&u(),n==="eraser"&&(f.current=false),l();},[n,u,l]);if(n==="none")return null;let S=o?[...r,o]:r;return jsxs("div",{className:"absolute inset-0",style:{zIndex:60,cursor:z7e(n),pointerEvents:"auto"},children:[jsx("svg",{ref:p,className:"absolute",style:{width:t.width,height:t.height,transformOrigin:"top left",transform:`scale(${e})`},viewBox:`0 0 ${t.width} ${t.height}`,onPointerDown:m,onPointerMove:x,onPointerUp:y,onPointerLeave:v,children:S.map(w=>jsx("path",{d:H7e(w.points),fill:"none",stroke:w.color,strokeWidth:w.width,strokeLinecap:"round",strokeLinejoin:"round",opacity:w.opacity},w.id))}),n==="laser"&&i&&jsx("div",{className:"absolute rounded-full pointer-events-none",style:{width:24,height:24,left:i.x*e-12,top:i.y*e-12,backgroundColor:"rgba(255, 0, 0, 0.85)",boxShadow:"0 0 12px 6px rgba(255, 0, 0, 0.5), 0 0 24px 12px rgba(255, 0, 0, 0.25)",filter:"drop-shadow(0 0 8px rgba(255, 0, 0, 0.7))",zIndex:70}})]})}function kae(t,e){return `${t+1} / ${e}`}var nYe=["#ff0000","#0000ff","#00aa00","#ff8800","#ffffff","#000000","#ff00ff","#00cccc"],rYe=["#ffff00","#00ff00","#ff69b4","#00bfff","#ff8c00","#adff2f","#ff6347","#87ceeb"];function J8({presentationTool:t,penColor:e,highlighterColor:n,hasAnnotations:r,onSetTool:o,onSetPenColor:i,onSetHighlighterColor:s,onClearAnnotations:a,currentSlideIndex:l,totalSlides:c,onMovePresentationSlide:u,presentationStartTime:d,onEndPresentation:p,onTogglePresenterView:f,presenterMode:h}){let{t:m}=useTranslation(),[x,y]=useState(false),[v,S]=useState(false),w=useRef(null),[C,T]=useState(Date.now());useEffect(()=>{if(!d)return;let F=window.setInterval(()=>T(Date.now()),1e3);return ()=>window.clearInterval(F)},[d]);let E=d?C-d:0;useEffect(()=>{let F=B=>{w.current&&!w.current.contains(B.target)&&(y(false),S(false));};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let M=useCallback(F=>{o(F),y(false),S(false);},[o]),A=useCallback(F=>{F.preventDefault(),y(B=>!B),S(false);},[]),R=useCallback(F=>{F.preventDefault(),S(B=>!B),y(false);},[]),k=F=>`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${t===F?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,N="flex items-center justify-center w-9 h-9 rounded-md transition-colors text-white/70 hover:text-white hover:bg-white/10 disabled:text-white/20 disabled:cursor-not-allowed";return jsxs("div",{ref:w,className:"flex items-center gap-1 px-3 py-2 rounded-xl bg-neutral-900/90 backdrop-blur-md border border-white/15 shadow-2xl",onClick:F=>F.stopPropagation(),children:[jsx("button",{type:"button",className:N,onClick:()=>u(-1),disabled:l===0,title:m("pptx.presenter.previousSlide"),"aria-label":m("pptx.presenter.previousSlide"),children:jsx(LuChevronLeft,{size:18})}),jsx("span",{className:"text-xs font-mono tabular-nums text-white/80 px-1.5 select-none min-w-[48px] text-center",children:kae(l,c)}),jsx("button",{type:"button",className:N,onClick:()=>u(1),disabled:l>=c-1,title:m("pptx.presenter.nextSlide"),"aria-label":m("pptx.presenter.nextSlide"),children:jsx(LuChevronRight,{size:18})}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono tabular-nums text-white/60 px-1 select-none",title:m("pptx.presenter.elapsed"),children:[jsx(LuTimer,{size:14}),jsx("span",{children:q2(E)})]}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsx("button",{type:"button",className:k("laser"),onClick:()=>M("laser"),title:m("pptx.presentation.laserPointer"),children:jsx(LuMousePointer2,{size:18})}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:k("pen"),onClick:()=>M("pen"),onContextMenu:A,title:m("pptx.presentation.pen"),children:[jsx(LuPenTool,{size:18}),jsx("div",{className:"absolute bottom-0.5 left-1/2 -translate-x-1/2 w-3 h-0.5 rounded-full",style:{backgroundColor:e}})]}),jsx("button",{type:"button",className:"flex items-center justify-center w-7 h-9 -ml-1 rounded-r-md transition-colors text-white/50 hover:text-white hover:bg-white/10",onClick:()=>{y(F=>!F),S(false);},title:`${m("pptx.presentation.pen")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),x&&jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 p-3 bg-neutral-800 rounded-lg border border-white/20 shadow-xl grid grid-cols-4 gap-2",children:nYe.map(F=>jsx("button",{type:"button",className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${e===F?"border-white":"border-white/20"}`,style:{backgroundColor:F},onClick:()=>{i(F),y(false),t!=="pen"&&o("pen");}},F))})]}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:k("highlighter"),onClick:()=>M("highlighter"),onContextMenu:R,title:m("pptx.presentation.highlighter"),children:[jsx(LuHighlighter,{size:18}),jsx("div",{className:"absolute bottom-0.5 left-1/2 -translate-x-1/2 w-3 h-0.5 rounded-full",style:{backgroundColor:n}})]}),jsx("button",{type:"button",className:"flex items-center justify-center w-7 h-9 -ml-1 rounded-r-md transition-colors text-white/50 hover:text-white hover:bg-white/10",onClick:()=>{S(F=>!F),y(false);},title:`${m("pptx.presentation.highlighter")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),v&&jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 p-3 bg-neutral-800 rounded-lg border border-white/20 shadow-xl grid grid-cols-4 gap-2",children:rYe.map(F=>jsx("button",{type:"button",className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${n===F?"border-white":"border-white/20"}`,style:{backgroundColor:F},onClick:()=>{s(F),S(false),t!=="highlighter"&&o("highlighter");}},F))})]}),jsx("button",{type:"button",className:k("eraser"),onClick:()=>M("eraser"),title:m("pptx.presentation.eraser"),children:jsx(LuEraser,{size:18})}),jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${r?"text-white/70 hover:text-red-400 hover:bg-white/10":"text-white/30 cursor-not-allowed"}`,onClick:r?a:void 0,title:m("pptx.presentation.clearAnnotations"),disabled:!r,children:jsx(LuTrash2,{size:18})}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),f&&jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${h?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,onClick:f,title:m("pptx.presenter.presenterView",{defaultValue:"Presenter view (N)"}),"aria-label":m("pptx.presenter.presenterView",{defaultValue:"Presenter view"}),children:jsx(LuPanelRight,{size:18})}),jsx("button",{type:"button",className:"flex items-center justify-center w-9 h-9 rounded-md transition-colors text-white/70 hover:text-red-400 hover:bg-white/10",onClick:p,title:m("pptx.presenter.endPresentation"),"aria-label":m("pptx.presenter.endPresentation"),children:jsx(LuX,{size:18})})]})}var Dae=768,Lae=1024;function iYe(){return typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints!==null&&navigator.msMaxTouchPoints>0}function sYe(t){if(typeof window>"u")return ()=>{};let e=()=>t();return window.addEventListener("pointerdown",e,{once:true}),()=>window.removeEventListener("pointerdown",e)}function Fae(){return typeof window>"u"?"landscape":typeof screen<"u"&&screen.orientation?screen.orientation.type.startsWith("portrait")?"portrait":"landscape":window.innerHeight>window.innerWidth?"portrait":"landscape"}function cN(t){let e=t?.containerRef,n=useSyncExternalStore(sYe,iYe,()=>false),[r,o]=useState(()=>typeof window>"u"?1024:e?.current?.clientWidth??window.innerWidth),[i,s]=useState(Fae),[a,l]=useState(false),[c]=useState(()=>typeof window<"u"?window.innerHeight:800);useEffect(()=>{let f=e?.current;if(f){let m=new ResizeObserver(x=>{let y=x[0];y&&o(y.contentRect.width);});return m.observe(f),o(f.clientWidth),()=>m.disconnect()}let h=()=>{o(window.innerWidth);};return window.addEventListener("resize",h),h(),()=>window.removeEventListener("resize",h)},[e]),useEffect(()=>{if(typeof window>"u")return;let f=()=>{s(Fae());};return screen.orientation&&screen.orientation.addEventListener("change",f),window.addEventListener("resize",f),()=>{screen.orientation&&screen.orientation.removeEventListener("change",f),window.removeEventListener("resize",f);}},[]),useEffect(()=>{if(!n||typeof window>"u")return;let f=()=>{let x=(window.visualViewport?.height??window.innerHeight)/c;l(x<.7);},h=window.visualViewport;return h?(h.addEventListener("resize",f),()=>h.removeEventListener("resize",f)):(window.addEventListener("resize",f),()=>window.removeEventListener("resize",f))},[n,c]);let u=r<Dae,d=r>=Dae&&r<Lae,p=r>=Lae;return {isMobile:u,isTablet:d,isDesktop:p,isTouchDevice:n,orientation:i,isVirtualKeyboardOpen:a,containerWidth:r}}function eH({currentSlideIndex:t,totalSlides:e,onMovePresentationSlide:n,onEndPresentation:r}){let{t:o}=useTranslation(),{isTouchDevice:i}=cN();if(!i)return null;let s="pointer-events-auto flex items-center justify-center w-11 h-11 min-w-11 min-h-11 rounded-full bg-black/55 text-white shadow-lg active:bg-black/75",a=l=>{l.stopPropagation();};return jsxs(Fragment,{children:[jsx("button",{type:"button",className:`fixed z-[90] ${s}`,style:{top:"calc(env(safe-area-inset-top, 0px) + 0.5rem)",right:"calc(env(safe-area-inset-right, 0px) + 0.5rem)",touchAction:"manipulation"},onClick:l=>{a(l),r();},"aria-label":o("pptx.presenter.endPresentation"),children:jsx(LuX,{size:22})}),jsx("button",{type:"button",className:`fixed z-[90] top-1/2 -translate-y-1/2 ${s} disabled:opacity-30`,style:{left:"calc(env(safe-area-inset-left, 0px) + 0.5rem)",touchAction:"manipulation"},disabled:t<=0,onClick:l=>{a(l),n(-1);},"aria-label":o("pptx.presenter.previousSlide"),children:jsx(LuChevronLeft,{size:26})}),jsx("button",{type:"button",className:`fixed z-[90] top-1/2 -translate-y-1/2 ${s} disabled:opacity-30`,style:{right:"calc(env(safe-area-inset-right, 0px) + 0.5rem)",touchAction:"manipulation"},disabled:t>=e-1,onClick:l=>{a(l),n(1);},"aria-label":o("pptx.presenter.nextSlide"),children:jsx(LuChevronRight,{size:26})}),jsx("span",{className:"fixed z-[90] left-1/2 -translate-x-1/2 px-3 py-1 rounded-full bg-black/55 text-white text-xs font-mono tabular-nums pointer-events-none",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 0.5rem)"},children:e===0?"0 / 0":`${t+1} / ${e}`})]})}function nH({visible:t}){let{t:e}=useTranslation(),[n,r]=useState(""),[o,i]=useState("unknown"),s=useRef(null),a=useRef(false);if(useEffect(()=>{if(!t){a.current=false,s.current?.stop(),s.current=null,r("");return}a.current=true;let c=window,u=c.SpeechRecognition??c.webkitSpeechRecognition;if(!u){i("unsupported");return}i("supported");let d=new u;d.continuous=true,d.interimResults=true,d.lang=navigator.language||"en-US",d.onresult=p=>{let f="",h="";for(let x=p.resultIndex;x<p.results.length;x+=1){let y=p.results[x],v=y?.[0]?.transcript??"";y?.isFinal?f+=v:h+=v;}let m=`${f} ${h}`.trim();m.length>0&&r(m);},d.onerror=()=>{},d.onend=()=>{if(a.current)try{d.start();}catch{}},s.current=d;try{d.start();}catch{i("unsupported");}return ()=>{a.current=false,d.stop(),s.current=null;}},[t]),!t)return null;let l=o==="unsupported"?e("pptx.subtitles.notSupported"):n.length>0?n:e("pptx.subtitles.listening");return jsx("div",{className:"absolute bottom-14 left-1/2 -translate-x-1/2 z-[70] max-w-[80%] min-w-[300px]",children:jsx("div",{className:"px-6 py-3 rounded-lg bg-black/75 backdrop-blur-sm border border-white/10",children:jsx("p",{className:"text-center text-[15px] text-white/70 italic",children:l})})})}function rH({isOpen:t,annotationCount:e,slideCount:n,onKeep:r,onDiscard:o}){let{t:i}=useTranslation();return t?jsx("div",{style:{zIndex:1200},className:"fixed inset-0 flex items-center justify-center bg-black/50",children:jsxs("div",{className:"bg-background border border-border rounded-lg shadow-xl w-[420px] max-w-[90vw] p-6 animate-in fade-in zoom-in-95 duration-200",children:[jsxs("div",{className:"flex items-center gap-3 mb-4",children:[jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-primary/10",children:jsx(LuPenTool,{className:"w-5 h-5 text-primary"})}),jsxs("div",{children:[jsx("h2",{className:"text-base font-semibold text-foreground",children:i("pptx.presentation.keepAnnotationsTitle")}),jsx("p",{className:"text-sm text-muted-foreground",children:i("pptx.presentation.keepAnnotationsDescription",{count:e,slides:n})})]})]}),jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md border border-border bg-background text-foreground hover:bg-accent transition-colors",onClick:o,children:[jsx(LuTrash2,{className:"w-4 h-4"}),i("pptx.presentation.discardAnnotations")]}),jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md bg-primary text-white hover:bg-primary/90 transition-colors",onClick:r,children:[jsx(LuPenTool,{className:"w-4 h-4"}),i("pptx.presentation.keepAnnotations")]})]})]})}):null}var xYe=.48,yYe=6,$ae=16/9;function bYe(t,e,n=jc){let r=n.width-n.marginLeft-n.marginRight,o=n.height-n.marginTop-n.marginBottom,i=o*xYe,s=r,a=s/$ae;a>i&&(a=i,s=a*$ae);let l=(r-s)/2,c=(i-a)/2,u=i+yYe,d=o-u;return {pageIndex:t,slideIndex:e,slideArea:{x:l,y:c,width:s,height:a},textArea:{x:0,y:u,width:r,height:Math.max(0,d)}}}function oH(t){return t.map((e,n)=>bYe(n,e))}function iH(){return {width:jc.width-jc.marginLeft-jc.marginRight,height:jc.height-jc.marginTop-jc.marginBottom}}var ic=.9,zae=5;function sH({slideIndices:t,slides:e,frameSlides:n,maxPages:r=3}){let{t:o}=useTranslation(),i=useMemo(()=>oH(t),[t]),s=useMemo(()=>iH(),[]),a=i.slice(0,r),l=s.width*ic,c=s.height*ic;return t.length===0?jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:o("pptx.print.preview.noSlides")}):jsxs("div",{className:"flex flex-col items-center gap-3 py-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:o("pptx.print.preview.title")}),a.map(u=>{let p=!!e[u.slideIndex]?.notes;return jsxs("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:l,height:c,overflow:"hidden"},children:[jsx("div",{className:`absolute flex items-center justify-center rounded-sm bg-gray-50 ${n?"border-2 border-gray-800":"border border-gray-300"}`,style:{left:u.slideArea.x*ic,top:u.slideArea.y*ic,width:u.slideArea.width*ic,height:u.slideArea.height*ic},children:jsx("span",{className:"text-[9px] font-medium text-gray-400",children:u.slideIndex+1})}),jsx("div",{className:"absolute left-1 right-1 border-b border-gray-200",style:{top:u.textArea.y*ic-1}}),jsx("div",{className:"absolute",style:{left:u.textArea.x*ic+4,top:u.textArea.y*ic,width:u.textArea.width*ic-8,height:u.textArea.height*ic},children:Array.from({length:zae},(h,m)=>{let x=u.textArea.height*ic/(zae+1);return jsx("div",{className:`absolute left-0 right-0 border-b ${p?"border-gray-300":"border-gray-200"}`,style:{top:x*(m+1)}},m)})})]},u.pageIndex)}),i.length>r&&jsx("span",{className:"text-[10px] text-muted-foreground",children:o("pptx.print.preview.morePages",{count:i.length-r})})]})}var Kv=.9;function uN({slideIndices:t,slidesPerPage:e,orientation:n,frameSlides:r,maxPages:o=3}){let{t:i}=useTranslation(),s=useMemo(()=>aU(t,e,n),[t,e,n]),a=useMemo(()=>lU(n),[n]),l=s.slice(0,o),c=e===3,u=cU(),d=a.width*Kv,p=a.height*Kv,f=.5;return t.length===0?jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:i("pptx.print.preview.noSlides")}):jsxs("div",{className:"flex flex-col items-center gap-3 py-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:i("pptx.print.preview.title")}),l.map(h=>jsx("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:d,height:p,overflow:"hidden"},children:h.cells.map((m,x)=>{let y=m.slideIndex<0,v=m.x*Kv,S=m.y*Kv,w=m.width*Kv,C=m.height*Kv;return jsxs("div",{className:"absolute flex items-start",style:{left:v,top:S,gap:c?2:0},children:[jsx("div",{className:`flex items-center justify-center rounded-sm bg-gray-50 ${y?"opacity-30":""} ${r?"border-2 border-gray-800":"border border-gray-300"}`,style:{width:w,height:C},children:!y&&jsx("span",{className:"text-[9px] font-medium text-gray-400",children:m.slideIndex+1})}),c&&!y&&jsx("div",{className:"relative border-l border-gray-200 pl-1",style:{width:d*f,height:C},children:Array.from({length:u},(E,M)=>{let A=C/(u+1)*(M+1);return jsx("div",{className:"absolute left-1 right-0 border-b border-gray-200",style:{top:A}},M)})})]},x)})},h.pageIndex)),s.length>o&&jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptx.print.preview.morePages",{count:s.length-o})})]})}var dN=[1,2,3,4,6,9],al=t=>`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm cursor-pointer transition-colors ${t?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`;function Xae({printWhat:t,onPrintWhatChange:e,orientation:n,onOrientationChange:r,colorMode:o,onColorModeChange:i,frameSlides:s,onFrameSlidesChange:a,slidesPerPage:l,onSlidesPerPageChange:c,slideRange:u,onSlideRangeChange:d,customFrom:p,onCustomFromChange:f,customTo:h,onCustomToChange:m,totalSlides:x,activeSlideIndex:y}){let{t:v}=useTranslation();return jsxs("div",{className:"flex-1 space-y-5 min-w-0",children:[jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.printWhat")}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("label",{className:al(t==="slides"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="slides",onChange:()=>e("slides")}),jsx(LuFileText,{className:"w-4 h-4 shrink-0"}),v("pptx.print.fullPageSlides")]}),jsxs("label",{className:al(t==="handouts"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="handouts",onChange:()=>e("handouts")}),jsx(LuGrid2X2,{className:"w-4 h-4 shrink-0"}),v("pptx.print.handouts")]}),jsxs("label",{className:al(t==="notes"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="notes",onChange:()=>e("notes")}),jsx(LuStickyNote,{className:"w-4 h-4 shrink-0"}),v("pptx.print.notesPages")]}),jsxs("label",{className:al(t==="outline"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="outline",onChange:()=>e("outline")}),jsx(LuList,{className:"w-4 h-4 shrink-0"}),v("pptx.print.outline")]})]})]}),t==="handouts"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.slidesPerPage")}),jsx("div",{className:"flex gap-1.5 flex-wrap",children:dN.map(S=>jsx("button",{type:"button",onClick:()=>c(S),className:`px-3 py-1.5 rounded-md text-sm font-medium border transition-colors ${l===S?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`,children:S},S))})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.slideRange")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:al(u==="all"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:u==="all",onChange:()=>d("all")}),v("pptx.print.allSlides")," (",x,")"]}),jsxs("label",{className:al(u==="current"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:u==="current",onChange:()=>d("current")}),v("pptx.print.currentSlide")," (",y+1,")"]}),jsxs("label",{className:al(u==="custom"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:u==="custom",onChange:()=>d("custom")}),v("pptx.print.customRange")]}),u==="custom"&&jsxs("div",{className:"flex items-center gap-2 pl-6",children:[jsx("span",{className:"text-xs text-muted-foreground",children:v("pptx.print.from")}),jsx("input",{type:"number",min:1,max:x,value:p,onChange:S=>f(Math.max(1,parseInt(S.target.value,10)||1)),className:"w-16 px-2 py-1 text-sm border border-border rounded bg-background text-foreground"}),jsx("span",{className:"text-xs text-muted-foreground",children:v("pptx.print.to")}),jsx("input",{type:"number",min:1,max:x,value:h,onChange:S=>m(Math.max(1,parseInt(S.target.value,10)||1)),className:"w-16 px-2 py-1 text-sm border border-border rounded bg-background text-foreground"})]})]})]}),t==="slides"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.orientation")}),jsxs("div",{className:"flex gap-2",children:[jsxs("label",{className:al(n==="landscape"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="landscape",onChange:()=>r("landscape")}),v("pptx.print.landscape")]}),jsxs("label",{className:al(n==="portrait"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="portrait",onChange:()=>r("portrait")}),v("pptx.print.portrait")]})]})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.colorMode")}),jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxs("label",{className:al(o==="color"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="color",onChange:()=>i("color")}),v("pptx.print.color")]}),jsxs("label",{className:al(o==="grayscale"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="grayscale",onChange:()=>i("grayscale")}),v("pptx.print.grayscale")]}),jsxs("label",{className:al(o==="blackAndWhite"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="blackAndWhite",onChange:()=>i("blackAndWhite")}),v("pptx.print.blackAndWhite")]})]})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:s,onChange:S=>a(S.target.checked),className:"rounded border-border"}),jsx("span",{className:"text-sm text-foreground",children:v("pptx.print.frameSlides")})]})]})}function aH({open:t,onClose:e,onPrint:n,slides:r,activeSlideIndex:o,defaultSlidesPerPage:i,defaultFrameSlides:s}){let{t:a}=useTranslation(),[l,c]=useState("slides"),[u,d]=useState("landscape"),[p,f]=useState("color"),[h,m]=useState(s??false),[x,y]=useState(dN.includes(i)?i:6),[v,S]=useState("all"),[w,C]=useState(1),[T,E]=useState(r.length),M=useMemo(()=>l==="notes"||l==="outline"||l==="handouts"?"portrait":u,[l,u]),A=useMemo(()=>{if(v==="all")return r.length;if(v==="current")return 1;let F=Math.max(1,Math.min(w,r.length));return Math.max(F,Math.min(T,r.length))-F+1},[v,r.length,w,T]),R=useMemo(()=>l==="slides"||l==="notes"?A:l==="outline"?1:Math.ceil(A/x),[l,A,x]),k=useMemo(()=>{if(v==="current")return [o];if(v==="custom"){let F=Math.max(0,w-1),B=Math.min(r.length-1,T-1);return Array.from({length:Math.max(0,B-F+1)},(D,O)=>F+O)}return Array.from({length:r.length},(F,B)=>B)},[v,o,w,T,r.length]),N=useCallback(()=>{n({printWhat:l,orientation:M,colorMode:p,frameSlides:h,slidesPerPage:x,slideRange:v,customRangeFrom:Math.max(1,Math.min(w,r.length)),customRangeTo:Math.max(1,Math.min(T,r.length))});},[l,M,p,h,x,v,w,T,r.length,n]);return t?jsx("div",{style:{zIndex:1200},className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:jsxs("div",{className:"w-[780px] max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuPrinter,{className:"w-4 h-4 text-muted-foreground"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:a("pptx.print.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex gap-5",children:[jsx(Xae,{printWhat:l,onPrintWhatChange:c,orientation:u,onOrientationChange:d,colorMode:p,onColorModeChange:f,frameSlides:h,onFrameSlidesChange:m,slidesPerPage:x,onSlidesPerPageChange:y,slideRange:v,onSlideRangeChange:S,customFrom:w,onCustomFromChange:C,customTo:T,onCustomToChange:E,totalSlides:r.length,activeSlideIndex:o}),l==="handouts"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(uN,{slideIndices:k,slidesPerPage:x,orientation:M,frameSlides:h})}),l==="notes"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(sH,{slideIndices:k,slides:r,frameSlides:h})})]}),jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[jsx("span",{className:"text-xs text-muted-foreground",children:a("pptx.print.pageEstimate",{pages:R,slides:A})}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a("common.cancel")}),jsxs("button",{type:"button",onClick:N,className:"px-4 py-2 text-sm rounded-lg bg-primary text-white hover:bg-primary/90 transition-colors flex items-center gap-1.5",children:[jsx(LuPrinter,{className:"w-3.5 h-3.5"}),a("pptx.print.printButton")]})]})]})]})}):null}function Yae({draft:t,update:e}){let{t:n}=useTranslation();return jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:n("pptx.slideShow.showOptions")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:!!t.loopContinuously,onChange:r=>e({loopContinuously:r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.loopContinuously")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:t.showWithNarration===false,onChange:r=>e({showWithNarration:!r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showWithoutNarration")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:t.showWithAnimation===false,onChange:r=>e({showWithAnimation:!r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showWithoutAnimation")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:!!t.showSubtitles,onChange:r=>e({showSubtitles:r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showSubtitles")})]})]})}function qae({draft:t,update:e,showSlidesMode:n,slideCount:r,customShows:o}){let{t:i}=useTranslation();return jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:i("pptx.slideShow.showSlides")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"all",checked:n==="all",onChange:()=>e({showSlidesMode:"all"}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.allSlides")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"range",checked:n==="range",onChange:()=>e({showSlidesMode:"range",showSlidesFrom:t.showSlidesFrom??1,showSlidesTo:t.showSlidesTo??r}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.fromTo")})]}),n==="range"&&jsxs("div",{className:"flex items-center gap-2 ml-6",children:[jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.slideShow.from")}),jsx("input",{type:"number",min:1,max:r,value:t.showSlidesFrom??1,onChange:s=>e({showSlidesFrom:Math.max(1,Number.parseInt(s.target.value,10)||1)}),className:"w-14 px-1.5 py-0.5 rounded bg-muted border border-border text-foreground text-[11px]"})]}),jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.slideShow.to")}),jsx("input",{type:"number",min:1,max:r,value:t.showSlidesTo??r,onChange:s=>e({showSlidesTo:Math.min(r,Number.parseInt(s.target.value,10)||r)}),className:"w-14 px-1.5 py-0.5 rounded bg-muted border border-border text-foreground text-[11px]"})]})]}),o.length>0&&jsxs(Fragment,{children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"customShow",checked:n==="customShow",onChange:()=>e({showSlidesMode:"customShow",showSlidesCustomShowId:t.showSlidesCustomShowId??o[0]?.id}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.customShow")})]}),n==="customShow"&&jsx("div",{className:"ml-6",children:jsx("select",{value:t.showSlidesCustomShowId??o[0]?.id??"",onChange:s=>e({showSlidesCustomShowId:s.target.value}),className:"w-full px-2 py-1 rounded bg-muted border border-border text-foreground text-[11px]",children:o.map(s=>jsx("option",{value:s.id,children:s.name},s.id))})})]})]})}function lH({open:t,onClose:e,properties:n,onSave:r,customShows:o,slideCount:i}){let{t:s}=useTranslation(),[a,l]=useState({...n}),c=useCallback(f=>{l(h=>({...h,...f}));},[]),u=useCallback(()=>{r(a),e();},[a,r,e]);if(!t)return null;let d=a.showType??"presented",p=a.showSlidesMode??"all";return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":"Close dialog",onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-xl border border-border bg-background shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.slideShow.setUpTitle")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"px-5 py-4 space-y-5 text-[12px] text-foreground max-h-[70vh] overflow-y-auto",children:[jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:s("pptx.slideShow.showType")}),[["presented",s("pptx.slideShow.presentedBySpeaker")],["browsed",s("pptx.slideShow.browsedByIndividual")],["kiosk",s("pptx.slideShow.browsedAtKiosk")]].map(([f,h])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showType",value:f,checked:d===f,onChange:()=>c({showType:f,...f==="kiosk"?{loopContinuously:true}:{}}),className:"accent-primary"}),jsx("span",{children:h})]},f))]}),jsx(qae,{draft:a,update:c,showSlidesMode:p,slideCount:i,customShows:o}),jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:s("pptx.slideShow.advanceSlides")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"advanceMode",value:"manual",checked:(a.advanceMode??"manual")==="manual",onChange:()=>c({advanceMode:"manual"}),className:"accent-primary"}),jsx("span",{children:s("pptx.slideShow.manually")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"advanceMode",value:"useTimings",checked:a.advanceMode==="useTimings",onChange:()=>c({advanceMode:"useTimings"}),className:"accent-primary"}),jsx("span",{children:s("pptx.slideShow.useTimings")})]})]}),jsx(Yae,{draft:a,update:c})]}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:u,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-[12px] text-white transition-colors",children:s("common.ok")})]})]})})]})}function fH({open:t,onClose:e,onStartBroadcast:n,onStopBroadcast:r,onStartPresenting:o,defaultRoomId:i,defaultUserName:s,defaultServerUrl:a}){let{t:l}=useTranslation(),c=qi(),u=c!==null&&c.status!=="disconnected"&&c.status!=="error"&&c.config.role==="broadcaster",[d,p]=useState(""),[f,h]=useState(""),[m,x]=useState(""),[y,v]=useState(false),S=useRef(null);useEffect(()=>{if(t&&!u){let A=i?`broadcast-${i}`:`broadcast-${Math.random().toString(36).slice(2,10)}`;p(A),h(s??""),x(a??"ws://localhost:1234");}},[t,u,i,s,a]),useEffect(()=>{if(!t)return;function A(R){R.key==="Escape"&&e();}return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[t,e]),useEffect(()=>{t&&S.current&&S.current.focus();},[t]);let w=typeof window<"u"?`${window.location.origin}${window.location.pathname}?broadcast=${encodeURIComponent(u?c.config.roomId:d)}&server=${encodeURIComponent(u?c.config.serverUrl:m)}`:d,C=useCallback(()=>{navigator.clipboard.writeText(w).then(()=>{v(true),setTimeout(()=>v(false),2e3);});},[w]),T=useCallback(()=>{!d.trim()||!f.trim()||(n?.({roomId:d.trim(),serverUrl:m.trim(),userName:f.trim(),role:"broadcaster"}),setTimeout(()=>{o?.();},100),e());},[d,f,m,n,o,e]),E=useCallback(()=>{r?.(),e();},[r,e]),M=d.trim().length>0&&f.trim().length>0&&m.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":"Close dialog",onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":l("pptx.broadcast.title"),tabIndex:-1,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsxs("h2",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[jsx(LuCast,{className:"w-4 h-4"}),l(u?"pptx.broadcast.broadcasting":"pptx.broadcast.title")]}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:u?jsx(jYe,{collab:c,broadcastUrl:w,copied:y,onCopyUrl:C,onStopBroadcast:E}):jsx(VYe,{roomId:d,userName:f,serverUrl:m,onRoomIdChange:p,onUserNameChange:h,onServerUrlChange:x})}),!u&&jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:l("common.close")}),jsx("button",{type:"button",disabled:!M,onClick:T,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/90 text-[12px] text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:l("pptx.broadcast.startBroadcast")})]})]})})]}):null}function VYe({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i}){let{t:s}=useTranslation();return jsxs("div",{className:"space-y-4",children:[jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed",children:s("pptx.broadcast.description")}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-room-id",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.sessionName")}),jsx("input",{id:"broadcast-room-id",type:"text",value:t,onChange:a=>r(a.target.value),placeholder:"broadcast-abc123",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-user-name",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.displayName")}),jsx("input",{id:"broadcast-user-name",type:"text",value:e,onChange:a=>o(a.target.value),placeholder:"Presenter",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-server-url",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.serverLabel")}),jsx("input",{id:"broadcast-server-url",type:"text",value:n,onChange:a=>i(a.target.value),placeholder:"ws://localhost:1234",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsx("p",{className:"text-[11px] text-muted-foreground/70 leading-relaxed",children:s("pptx.broadcast.hint")})]})}function jYe({collab:t,broadcastUrl:e,copied:n,onCopyUrl:r,onStopBroadcast:o}){let{t:i}=useTranslation(),s=t.status==="connected"?"text-green-400":t.status==="connecting"?"text-yellow-400":"text-red-400",a=t.status==="connected"||t.status==="connecting"?jsx(LuWifi,{className:"w-4 h-4"}):jsx(LuWifiOff,{className:"w-4 h-4"}),l=t.remoteUsers.filter(c=>c.role==="viewer").length;return jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:s,children:a}),jsx("span",{className:"text-[13px] font-medium text-foreground capitalize",children:t.status}),jsxs("span",{className:"text-[12px] text-muted-foreground ml-auto flex items-center gap-1",children:[jsx(LuUsers,{className:"w-3.5 h-3.5"}),i("pptx.broadcast.viewerCount",{count:l})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.broadcast.viewerLink")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex-1 px-3 py-1.5 rounded border border-border bg-background text-[11px] text-foreground select-all font-mono truncate",children:e}),jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2.5 py-1.5 rounded border border-border bg-muted hover:bg-accent text-[12px] text-foreground transition-colors shrink-0",title:i("pptx.broadcast.copyLink"),children:n?jsxs(Fragment,{children:[jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}),jsx("span",{children:i("pptx.share.copied")})]}):jsxs(Fragment,{children:[jsx(LuCopy,{className:"w-3.5 h-3.5"}),jsx("span",{children:i("pptx.share.copyUrl")})]})})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:i("pptx.broadcast.shareHint")})]}),t.remoteUsers.length>0&&jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.broadcast.viewers")}),jsx("div",{className:"rounded border border-border bg-background divide-y divide-border max-h-[120px] overflow-y-auto",children:t.remoteUsers.map(c=>jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-semibold text-white shrink-0",style:{backgroundColor:c.userColor},children:c.userName.slice(0,2).toUpperCase()}),jsx("span",{className:"text-[12px] text-foreground truncate",children:c.userName}),jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["Slide ",c.activeSlideIndex+1]})]},c.clientId))})]}),jsx("button",{type:"button",onClick:o,className:"w-full px-3 py-2 rounded border border-red-500/30 bg-red-500/10 hover:bg-red-500/20 text-[12px] text-red-400 font-medium transition-colors",children:i("pptx.broadcast.stopBroadcast")})]})}function Jae(t){let e=t.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function xH({open:t,onClose:e,activeCollaboration:n,onStartCollaboration:r,onStopCollaboration:o,preconfigured:i,defaultRoomId:s,defaultUserName:a,defaultServerUrl:l}){let c=qi(),u=c!==null&&c.status!=="disconnected"&&c.status!=="error",{t:d}=useTranslation(),[p,f]=useState(s??""),[h,m]=useState(a??""),[x,y]=useState(l??""),[v,S]=useState(false),w=useRef(null);useEffect(()=>{n&&(f(n.roomId),m(n.userName),y(n.serverUrl));},[n]),useEffect(()=>{if(!t)return;function M(A){A.key==="Escape"&&e();}return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[t,e]),useEffect(()=>{t&&w.current&&w.current.focus();},[t]);let C=useCallback(()=>{let M=n??{roomId:p,serverUrl:x},A=typeof window<"u"?`${window.location.origin}${window.location.pathname}?room=${encodeURIComponent(M.roomId)}&server=${encodeURIComponent(M.serverUrl)}`:M.roomId;navigator.clipboard.writeText(A).then(()=>{S(true),setTimeout(()=>S(false),2e3);});},[n,p,x]),T=useCallback(()=>{!p.trim()||!h.trim()||r?.({roomId:p.trim(),serverUrl:x.trim(),userName:h.trim()});},[p,h,x,r]),E=p.trim().length>0&&h.trim().length>0&&x.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":d("pptx.share.closeDialog"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-label":d("pptx.share.title"),tabIndex:-1,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:d(u?"pptx.share.collaborationActive":"pptx.share.title")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":d("pptx.share.close"),children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:u?jsx(QYe,{collab:c,activeCollaboration:n,copied:v,onCopyRoomId:C,onStopCollaboration:o}):jsx(JYe,{roomId:p,userName:h,serverUrl:x,onRoomIdChange:f,onUserNameChange:m,onServerUrlChange:y,preconfigured:i})}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:d(u?"pptx.share.close":"pptx.share.cancel")}),!u&&jsx("button",{type:"button",disabled:!E,onClick:T,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/90 text-[12px] text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:d("pptx.share.startSharing")})]})]})})]}):null}function JYe({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i,preconfigured:s}){let{t:a}=useTranslation(),l=s?" opacity-70 cursor-not-allowed":"";return jsxs("div",{className:"space-y-4",children:[jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed",children:a(s?"pptx.share.preconfiguredDescription":"pptx.share.description")}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-room-id",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.sessionName")}),jsx("input",{id:"share-room-id",type:"text",value:t,onChange:c=>r(c.target.value),readOnly:s,placeholder:a("pptx.share.sessionPlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`}),jsx("p",{className:"text-[11px] text-muted-foreground",children:a("pptx.share.sessionHint")})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-user-name",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.displayName")}),jsx("input",{id:"share-user-name",type:"text",value:e,onChange:c=>o(c.target.value),readOnly:s,placeholder:a("pptx.share.namePlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-server-url",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.serverLabel")}),jsx("input",{id:"share-server-url",type:"text",value:n,onChange:c=>i(c.target.value),readOnly:s,placeholder:a("pptx.share.serverPlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`})]}),jsxs("p",{className:"text-[11px] text-muted-foreground/70 leading-relaxed",children:["Run"," ",jsx("code",{className:"px-1 py-0.5 rounded bg-muted text-[10px] font-mono",children:"bun run collab"})," ","to start the server. Others can join at"," ",jsx("code",{className:"px-1 py-0.5 rounded bg-muted text-[10px] font-mono",children:"?room=SESSION_NAME"})]})]})}function QYe({collab:t,activeCollaboration:e,copied:n,onCopyRoomId:r,onStopCollaboration:o}){let{t:i}=useTranslation(),s=t.status==="connected"?"text-green-400":t.status==="connecting"?"text-yellow-400":"text-red-400",a=t.status==="connected"||t.status==="connecting"?jsx(LuWifi,{className:"w-4 h-4"}):jsx(LuWifiOff,{className:"w-4 h-4"});return jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:s,children:a}),jsx("span",{className:"text-[13px] font-medium text-foreground capitalize",children:t.status}),jsxs("span",{className:"text-[12px] text-muted-foreground ml-auto flex items-center gap-1",children:[jsx(LuUsers,{className:"w-3.5 h-3.5"}),i("pptx.collaboration.userCount",{count:t.connectedCount})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.share.shareLink")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex-1 px-3 py-1.5 rounded border border-border bg-background text-[11px] text-foreground select-all font-mono truncate",children:typeof window<"u"?`${window.location.origin}${window.location.pathname}?room=${encodeURIComponent(t.config.roomId)}&server=${encodeURIComponent(t.config.serverUrl)}`:t.config.roomId}),jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2.5 py-1.5 rounded border border-border bg-muted hover:bg-accent text-[12px] text-foreground transition-colors shrink-0",title:i("pptx.share.copyLink"),children:n?jsxs(Fragment,{children:[jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}),jsx("span",{children:i("pptx.share.copied")})]}):jsxs(Fragment,{children:[jsx(LuCopy,{className:"w-3.5 h-3.5"}),jsx("span",{children:i("pptx.share.copyUrl")})]})})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:i("pptx.share.shareHint")})]}),jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[jsxs("span",{children:[i("pptx.share.room")," ",jsx("code",{className:"font-mono text-foreground",children:t.config.roomId})]}),jsxs("span",{children:[i("pptx.share.server")," ",jsx("code",{className:"font-mono text-foreground",children:t.config.serverUrl})]})]}),t.remoteUsers.length>0&&jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.share.connectedUsers")}),jsxs("div",{className:"rounded border border-border bg-background divide-y divide-border max-h-[140px] overflow-y-auto",children:[jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-semibold text-white shrink-0",style:{backgroundColor:t.config.userColor??"#6366f1"},children:Jae(e?.userName??t.config.userName)}),jsx("span",{className:"text-[12px] text-foreground truncate",children:e?.userName??t.config.userName}),jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:i("pptx.share.you")})]}),t.remoteUsers.map(l=>jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-semibold text-white shrink-0",style:{backgroundColor:l.userColor},children:l.userAvatar?jsx("img",{src:l.userAvatar,alt:"",className:"w-full h-full rounded-full object-cover"}):Jae(l.userName)}),jsx("span",{className:"text-[12px] text-foreground truncate",children:l.userName}),jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["Slide ",l.activeSlideIndex+1]})]},l.clientId))]})]}),o&&jsx("button",{type:"button",onClick:o,className:"w-full px-3 py-2 rounded border border-red-500/30 bg-red-500/10 hover:bg-red-500/20 text-[12px] text-red-400 font-medium transition-colors",children:i("pptx.share.stopSharing")})]})}var mN={"ppaction://hlinkshowjump?jump=nextslide":"nextSlide","ppaction://hlinkshowjump?jump=previousslide":"prevSlide","ppaction://hlinkshowjump?jump=firstslide":"firstSlide","ppaction://hlinkshowjump?jump=lastslide":"lastSlide","ppaction://hlinkshowjump?jump=endshow":"endShow"},Qae={nextSlide:"ppaction://hlinkshowjump?jump=nextslide",prevSlide:"ppaction://hlinkshowjump?jump=previousslide",firstSlide:"ppaction://hlinkshowjump?jump=firstslide",lastSlide:"ppaction://hlinkshowjump?jump=lastslide",endShow:"ppaction://hlinkshowjump?jump=endshow"};function ele(t,e){return e&&e.startsWith("ppaction://")?e.includes("hlinksldjump")?"slide":(mN[e.toLowerCase()],"action"):t?t.startsWith("mailto:")?"email":/^[a-zA-Z]:\\|^\.\.?[/\\]|^file:/i.test(t)?"file":"url":"url"}function tle(t){if(!t.startsWith("mailto:"))return {address:t,subject:""};let e=t.slice(7),n=e.indexOf("?");if(n<0)return {address:e,subject:""};let r=e.slice(0,n),o=new URLSearchParams(e.slice(n+1));return {address:r,subject:o.get("subject")||""}}function nle(t,e){if(e==="ppaction://hlinksldjump"&&t){let n=t.match(/slide(\d+)\.xml$/i);if(n)return parseInt(n[1],10)}if(t){let n=t.match(/#\s*Slide\s+(\d+)/i);if(n)return parseInt(n[1],10)}return 1}function rle(t){let e=t.tooltip.trim()||void 0;switch(t.targetType){case "email":return {url:t.emailSubject?`mailto:${t.emailAddress}?subject=${encodeURIComponent(t.emailSubject)}`:`mailto:${t.emailAddress}`,tooltip:e};case "slide":return {url:`slide${t.slideNumber}.xml`,action:"ppaction://hlinksldjump",tooltip:e};case "file":return {url:t.filePath,tooltip:e};case "action":return {url:"",action:Qae[t.actionVerb],tooltip:e};default:return {url:t.url,tooltip:e}}}function ole({targetType:t,url:e,setUrl:n,tooltip:r,setTooltip:o,emailAddress:i,setEmailAddress:s,emailSubject:a,setEmailSubject:l,slideNumber:c,setSlideNumber:u,slideCount:d,filePath:p,setFilePath:f,actionVerb:h,setActionVerb:m,inputRef:x,inputCls:y,onEnterConfirm:v}){let{t:S}=useTranslation(),w=C=>{C.key==="Enter"&&v();};return jsxs("div",{className:"px-4 py-3 space-y-3",children:[t==="url"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.urlLabel")}),jsx("input",{ref:x,type:"url",className:y,placeholder:"https://example.com",value:e,onChange:C=>n(C.target.value),onKeyDown:w})]}),t==="email"&&jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.emailLabel")}),jsx("input",{ref:x,type:"email",className:y,placeholder:"user@example.com",value:i,onChange:C=>s(C.target.value),onKeyDown:w})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.subjectLabel")}),jsx("input",{type:"text",className:y,value:a,onChange:C=>l(C.target.value)})]})]}),t==="slide"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.slideLabel")}),jsx("input",{ref:x,type:"number",min:1,max:d,className:y,value:c,onChange:C=>u(parseInt(C.target.value,10)||1),onKeyDown:w}),jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:S("pptx.hyperlink.slideRange",{max:d})})]}),t==="file"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.fileLabel")}),jsx("input",{ref:x,type:"text",className:y,placeholder:"../documents/file.docx",value:p,onChange:C=>f(C.target.value),onKeyDown:w})]}),t==="action"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.actionLabel")}),jsxs("select",{className:y,value:h,onChange:C=>m(C.target.value),children:[jsx("option",{value:"nextSlide",children:S("pptx.hyperlink.actionNextSlide")}),jsx("option",{value:"prevSlide",children:S("pptx.hyperlink.actionPrevSlide")}),jsx("option",{value:"firstSlide",children:S("pptx.hyperlink.actionFirstSlide")}),jsx("option",{value:"lastSlide",children:S("pptx.hyperlink.actionLastSlide")}),jsx("option",{value:"endShow",children:S("pptx.hyperlink.actionEndShow")})]})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.tooltipLabel")}),jsx("input",{type:"text",className:y,value:r,onChange:C=>o(C.target.value)})]})]})}function yH({open:t,initialUrl:e,initialTooltip:n,initialAction:r,slideCount:o,onConfirm:i,onCancel:s}){let{t:a}=useTranslation(),l=useRef(null),c=ele(e,r),u=tle(e||""),d=nle(e,r),p=r&&mN[r.toLowerCase()]||"nextSlide",[f,h]=useState(c),[m,x]=useState(c==="email"||c==="slide"||c==="action"?"":e||""),[y,v]=useState(n||""),[S,w]=useState(u.address),[C,T]=useState(u.subject),[E,M]=useState(d),[A,R]=useState(c==="file"&&e||""),[k,N]=useState(p);if(useEffect(()=>{t&&setTimeout(()=>l.current?.focus(),50);},[t]),!t)return null;let F=()=>{i({targetType:f,url:m,tooltip:y,emailAddress:S,emailSubject:C,slideNumber:E,filePath:A,actionVerb:k});},B=O=>le("px-3 py-1.5 text-xs rounded-t border-b-2 transition-colors",O?"border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:border-border");return jsxs(Fragment,{children:[jsx("div",{style:{zIndex:1200},className:"fixed inset-0 bg-black/40",onClick:s}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-lg border border-border bg-popover shadow-2xl",onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:a("pptx.hyperlink.editTitle")}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:s,children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex gap-1 px-4 pt-2 border-b border-border",children:[jsx("button",{type:"button",className:B(f==="url"),onClick:()=>h("url"),children:a("pptx.hyperlink.tabUrl")}),jsx("button",{type:"button",className:B(f==="email"),onClick:()=>h("email"),children:a("pptx.hyperlink.tabEmail")}),jsx("button",{type:"button",className:B(f==="slide"),onClick:()=>h("slide"),children:a("pptx.hyperlink.tabSlide")}),jsx("button",{type:"button",className:B(f==="file"),onClick:()=>h("file"),children:a("pptx.hyperlink.tabFile")}),jsx("button",{type:"button",className:B(f==="action"),onClick:()=>h("action"),children:a("pptx.hyperlink.tabAction")})]}),jsx(ole,{targetType:f,url:m,setUrl:x,tooltip:y,setTooltip:v,emailAddress:S,setEmailAddress:w,emailSubject:C,setEmailSubject:T,slideNumber:E,setSlideNumber:M,slideCount:o,filePath:A,setFilePath:R,actionVerb:k,setActionVerb:N,inputRef:l,inputCls:"w-full rounded border border-border bg-background px-2.5 py-1.5 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary",onEnterConfirm:F}),jsxs("div",{className:"flex justify-end gap-2 px-4 py-3 border-t border-border",children:[jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded border border-border text-foreground hover:bg-muted",onClick:s,children:a("common.cancel")}),jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded bg-primary text-white hover:bg-primary/90",onClick:F,children:a("common.apply")})]})]})})]})}function ile({guides:t,onDeleteGuide:e,onStartGuideDrag:n}){return jsx(Fragment,{children:t.map(r=>jsx("div",{className:"absolute z-[49] pointer-events-auto",style:r.axis==="h"?{left:0,right:0,top:r.position,height:1,backgroundColor:"rgba(250, 204, 21, 0.9)",cursor:"row-resize"}:{top:0,bottom:0,left:r.position,width:1,backgroundColor:"rgba(250, 204, 21, 0.9)",cursor:"col-resize"},onDoubleClick:o=>{o.stopPropagation(),e?.(r.id);},onPointerDown:o=>{o.stopPropagation(),o.currentTarget.setPointerCapture(o.pointerId),n({id:r.id,axis:r.axis,pointerId:o.pointerId});},title:"Drag guide. Double-click to remove."},r.id))})}function sle({backgroundImage:t,backgroundGradient:e}){return jsxs(Fragment,{children:[t&&jsx("img",{src:t,alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",draggable:false}),e&&jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:e}})]})}function ale({marqueeSelectionState:t}){return t?jsx("div",{className:"absolute border border-primary bg-primary/10 pointer-events-none z-50",style:{left:Math.min(t.startX,t.currentX),top:Math.min(t.startY,t.currentY),width:Math.abs(t.currentX-t.startX),height:Math.abs(t.currentY-t.startY)}}):null}function lle({snapLines:t}){return jsx(Fragment,{children:t.map((e,n)=>jsx("div",{className:"absolute bg-red-500 pointer-events-none z-50",style:e.axis==="x"?{left:e.position,top:0,width:1,height:"100%"}:{left:0,top:e.position,width:"100%",height:1}},n))})}function ule({comments:t,canvasSize:e,onCommentMarkerClick:n}){return jsx("div",{className:"absolute inset-0 pointer-events-none z-[45]",children:t.map((r,o)=>{let i=$7(r,o,e.width,e.height);return jsx("div",{className:"absolute pointer-events-auto cursor-pointer",style:{left:i.x-10,top:i.y-10,width:20,height:20,borderRadius:"50%",backgroundColor:"rgba(255, 165, 0, 0.9)",border:"2px solid #fff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,color:"#fff",lineHeight:1},title:`${r.author??"Comment"}: ${r.text}`,onClick:s=>{s.stopPropagation(),n?.(r.id);},children:o+1},r.id)})})}function dle({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r,onConnectionSiteDown:o,onConnectorDragMove:i,onConnectionSiteDrop:s,onConnectorDragEnd:a}){return jsxs("div",{className:"absolute inset-0 z-[55] pointer-events-none",onMouseMove:i,onMouseUp:a,style:{pointerEvents:r?"auto":"none"},children:[t.elements.filter(l=>l.type!=="connector").map(l=>gu(l.width,l.height).map(u=>jsx("div",{className:"absolute rounded-full border-2 border-blue-500 bg-blue-400/60 hover:bg-blue-500 hover:scale-125 transition-transform cursor-crosshair",style:{left:l.x+u.x-5,top:l.y+u.y-5,width:10,height:10,pointerEvents:"auto",zIndex:56},onMouseDown:d=>o(l.id,u.index,d),onMouseUp:()=>r?s(l.id,u.index):void 0},`${l.id}-site-${u.index}`))),r&&jsx(lqe,{activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r})]})}function lqe({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r}){let o=t.elements.find(h=>h.id===r.startElementId);if(!o)return null;let i=gu(o.width,o.height),s=i[r.startSiteIndex]??i[0],a=o.x+s.x,l=o.y+s.y,c=n.canvasStageRef.current;if(!c)return null;let u=c.getBoundingClientRect(),d=n.editorScale||1,p=(r.currentX-u.left)/d,f=(r.currentY-u.top)/d;return jsx("svg",{className:"absolute inset-0",style:{width:e.width,height:e.height,pointerEvents:"none"},viewBox:`0 0 ${e.width} ${e.height}`,children:jsx("line",{x1:a,y1:l,x2:p,y2:f,stroke:"#3b82f6",strokeWidth:2,strokeDasharray:"6 4",strokeLinecap:"round"})})}function fle({canvasSize:t,activeTool:e,drawingColor:n,drawingWidth:r,isStrokeActive:o,liveStrokeD:i,onPointerDown:s,onPointerMove:a,onPointerUp:l}){return jsx("svg",{className:"absolute inset-0 z-[60]",style:{width:t.width,height:t.height,cursor:"crosshair",touchAction:"none"},viewBox:`0 0 ${t.width} ${t.height}`,onPointerDown:s,onPointerMove:a,onPointerUp:l,children:o&&i&&jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:r,strokeOpacity:e==="highlighter"?.4:1,strokeLinecap:"round",strokeLinejoin:"round"})})}function hle({canvasSize:t,gridSpacingPx:e=8,visible:n}){let r=Math.max(e,2),o=useMemo(()=>`grid-dot-pattern-${Math.random().toString(36).slice(2,8)}`,[]);return n?jsxs("svg",{className:"absolute inset-0 pointer-events-none z-[2]",width:t.width,height:t.height,xmlns:"http://www.w3.org/2000/svg",children:[jsx("defs",{children:jsx("pattern",{id:o,width:r,height:r,patternUnits:"userSpaceOnUse",children:jsx("circle",{cx:r/2,cy:r/2,r:.6,fill:"rgba(156, 163, 175, 0.55)"})})}),jsx("rect",{width:t.width,height:t.height,fill:`url(#${o})`})]}):null}var pqe=37.79527559055118,Qn=20,uM=10;function vH(t,e,n){let r=n==="inches"?96:pqe,o=r*e,s=n==="inches"?8:10,a=4;for(;s>1&&o/s<a&&(s=Math.max(1,Math.floor(s/2)),!(s<=1)););let l=1,c=30;for(;o*l<c;)l*=2;let u=t/r,d=Math.ceil(u*s),p=[];for(let f=0;f<=d;f++){let h=f/s,m=h*r;if(m>t+.5)break;let x=m*e,y=f%s===0,v=Math.round(h),S=y&&v%l===0;p.push({position:x,label:S?String(v):"",isMajor:y});}return p}var gle=Vn__default.memo(function({ticks:e,widthPx:n,highlight:r}){return jsxs("svg",{width:n,height:Qn,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:n,height:Qn,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:0,y1:Qn-.5,x2:n,y2:Qn-.5,className:"stroke-border",strokeWidth:1}),r&&jsx("rect",{x:r.start,y:0,width:Math.max(r.end-r.start,1),height:Qn,className:"fill-primary/20"}),e.map((o,i)=>{let s=o.isMajor?Qn*.6:Qn*.3;return jsxs("g",{children:[jsx("line",{x1:o.position,y1:Qn,x2:o.position,y2:Qn-s,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:o.isMajor?1:.5}),o.label&&jsx("text",{x:o.position+2,y:uM+1,fontSize:uM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})}),xle=Vn__default.memo(function({ticks:e,heightPx:n,highlight:r}){return jsxs("svg",{width:Qn,height:n,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:Qn,height:n,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:Qn-.5,y1:0,x2:Qn-.5,y2:n,className:"stroke-border",strokeWidth:1}),r&&jsx("rect",{x:0,y:r.start,width:Qn,height:Math.max(r.end-r.start,1),className:"fill-primary/20"}),e.map((o,i)=>{let s=o.isMajor?Qn*.6:Qn*.3;return jsxs("g",{children:[jsx("line",{x1:Qn,y1:o.position,x2:Qn-s,y2:o.position,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:o.isMajor?1:.5}),o.label&&jsx("text",{x:2,y:o.position+uM+2,fontSize:uM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})});function ble({canvasSize:t,editorScale:e,unit:n,visible:r,selectedBounds:o,onCreateGuideFromRuler:i}){let s=useMemo(()=>vH(t.width,e,n),[t.width,e,n]),a=useMemo(()=>vH(t.height,e,n),[t.height,e,n]),l=useMemo(()=>o?{start:o.x*e,end:(o.x+o.width)*e}:null,[o,e]),c=useMemo(()=>o?{start:o.y*e,end:(o.y+o.height)*e}:null,[o,e]),[u,d]=useState(null),p=useRef(null),f=useRef(null),h=useCallback(S=>{i&&(S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),d({axis:"h",pointerId:S.pointerId}));},[i]),m=useCallback(S=>{i&&(S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),d({axis:"v",pointerId:S.pointerId}));},[i]),x=useCallback(S=>{if(!u||!i)return;try{S.currentTarget.releasePointerCapture(u.pointerId);}catch{}let w=e||1;if(u.axis==="h"){let C=p.current;if(!C){d(null);return}let T=C.getBoundingClientRect(),E=S.clientY-T.top;if(E>Qn){let M=(E-Qn)/w;M>=0&&M<=t.height&&i("h",M);}}else {let C=f.current;if(!C){d(null);return}let T=C.getBoundingClientRect(),E=S.clientX-T.left;if(E>Qn){let M=(E-Qn)/w;M>=0&&M<=t.width&&i("v",M);}}d(null);},[u,i,e,t]);if(!r)return null;let y=t.width*e,v=t.height*e;return jsxs(Fragment,{children:[jsx("div",{className:"absolute z-[51] bg-gray-100 dark:bg-gray-800 border-r border-b border-border",style:{top:0,left:0,width:Qn,height:Qn}}),jsx("div",{ref:p,className:"absolute z-[50] overflow-visible",style:{top:0,left:Qn,width:y,height:Qn,cursor:i?"row-resize":void 0},onPointerDown:h,onPointerUp:x,children:jsx(gle,{ticks:s,widthPx:y,highlight:l})}),jsx("div",{ref:f,className:"absolute z-[50] overflow-visible",style:{top:Qn,left:0,width:Qn,height:v,cursor:i?"col-resize":void 0},onPointerDown:m,onPointerUp:x,children:jsx(xle,{ticks:a,heightPx:v,highlight:c})})]})}function Zv(t){let e=t.target;for(;e;){if(e.dataset?.pptxElement==="true")return e.dataset.elementId||null;e=e.parentElement;}return null}var xqe=300;function wle({cbRef:t,onCanvasMouseDown:e,findResults:n,findResultIndex:r,activeSlideIndex:o,selectedElement:i,zoom:s,onMoveGuide:a}){let l=useMemo(()=>{let C=new Map;if(!n||n.length===0||o===null)return C;for(let T=0;T<n.length;T++){let E=n[T];if(E.slideIndex!==o)continue;C.has(E.elementId)||C.set(E.elementId,new Map);let M=C.get(E.elementId);M.has(E.segmentIndex)||M.set(E.segmentIndex,[]),M.get(E.segmentIndex).push({startOffset:E.startOffset,length:E.length,isCurrent:T===(r??-1)});}return C},[n,r,o]),c=useMemo(()=>i?{x:i.x,y:i.y,width:i.width,height:i.height}:null,[i]),u=useCallback(C=>{let T=Zv(C);T&&t.current.onClick(T,C);},[t]),d=useCallback(C=>{let T=Zv(C);T&&t.current.onDoubleClick(T,C);},[t]),p=useRef(false),f=useCallback(C=>{if(p.current){p.current=false;return}let T=Zv(C);if(T){t.current.onMouseDown(T,C);return}e?.(C);},[t,e]),h=useRef(null),m=useCallback(C=>{if(C.pointerType==="mouse")return;p.current=true,C.currentTarget.setPointerCapture?.(C.pointerId);let T=Zv(C);if(T){let E=C.timeStamp||Date.now(),M=h.current;if(M&&M.id===T&&E-M.time<xqe){h.current=null,t.current.onDoubleClick(T,C);return}h.current={id:T,time:E},t.current.onMouseDown(T,C);return}h.current=null,e?.(C);},[t,e]),x=useCallback(C=>{let T=Zv(C);T&&t.current.onContextMenu(T,C);},[t]),[y,v]=useState(null),S=useCallback(C=>{if(!y||!a)return;let T=s.canvasStageRef.current;if(!T)return;let E=T.getBoundingClientRect(),M=s.editorScale||1,A=y.axis==="h"?(C.clientY-E.top)/M:(C.clientX-E.left)/M;a(y.id,A);},[y,a,s.canvasStageRef,s.editorScale]),w=useCallback(C=>{if(y){try{C.currentTarget.releasePointerCapture(y.pointerId);}catch{}v(null);}},[y]);return {elementFindHighlightsMap:l,selectedBounds:c,handleStageClick:u,handleStageDblClick:d,handleStageMouseDown:f,handleStagePointerDown:m,handleStageContextMenu:x,draggingGuide:y,setDraggingGuide:v,handleStagePointerMove:S,handleStagePointerUp:w}}function Cle({activeSlide:t,zoom:e,onCreateConnector:n}){let[r,o]=useState(null),i=useCallback((c,u,d)=>{d.stopPropagation(),d.preventDefault(),o({startElementId:c,startSiteIndex:u,currentX:d.clientX,currentY:d.clientY});},[]),s=useCallback(c=>{r&&o(u=>u?{...u,currentX:c.clientX,currentY:c.clientY}:null);},[r]),a=useCallback((c,u)=>{if(!r||!n)return;if(r.startElementId===c){o(null);return}let d=t?.elements.find(R=>R.id===r.startElementId),p=t?.elements.find(R=>R.id===c);if(!d||!p){o(null);return}let f=gu(d.width,d.height),h=gu(p.width,p.height),m=f[r.startSiteIndex]??f[0],x=h[u]??h[0],y=d.x+m.x,v=d.y+m.y,S=p.x+x.x,w=p.y+x.y,C=Math.abs(S-y),T=Math.abs(w-v),E=Math.sqrt(C*C+T*T),M=E<100?"straightConnector1":E<300?"bentConnector3":"curvedConnector3",A={id:`conn-new-${Date.now()}`,type:"connector",x:Math.min(y,S),y:Math.min(v,w),width:Math.abs(S-y)||1,height:Math.abs(w-v)||1,shapeType:M,shapeStyle:{strokeColor:"#4472C4",strokeWidth:2,connectorStartConnection:{shapeId:r.startElementId,connectionSiteIndex:r.startSiteIndex},connectorEndConnection:{shapeId:c,connectionSiteIndex:u}}};n(A),o(null);},[r,n,t?.elements]),l=useCallback(()=>{o(null);},[]);return {connectorDragState:r,handleConnectionSiteDown:i,handleConnectorDragMove:s,handleConnectionSiteDrop:a,handleConnectorDragEnd:l}}function Tle({activeTool:t,activeSlide:e,zoom:n,drawingColor:r,drawingWidth:o,isDrawingRef:i,onAddInkElement:s,onAddFreeformShape:a,onEraseInkElement:l}){let c=t!=="select",[u,d]=useState([]),[p,f]=useState([]),[h,m]=useState(false),x=useCallback(T=>{let E=n.canvasStageRef.current;if(!E)return null;let M=E.getBoundingClientRect(),A=n.editorScale||1;return {x:(T.clientX-M.left)/A,y:(T.clientY-M.top)/A}},[n.canvasStageRef,n.editorScale]),y=useCallback(T=>{if(T.length===0)return "";let E=[`M ${T[0].x} ${T[0].y}`];for(let M=1;M<T.length;M++)E.push(`L ${T[M].x} ${T[M].y}`);return E.join(" ")},[]),v=useCallback(T=>{if(t==="select")return;if(t==="eraser"&&e){let M=x(T);if(!M)return;let A=15;for(let R of [...e.elements].reverse())if(R.type==="ink"&&M.x>=R.x-A&&M.x<=R.x+R.width+A&&M.y>=R.y-A&&M.y<=R.y+R.height+A){l?.(R.id);break}return}let E=x(T);E&&(T.preventDefault(),T.target.setPointerCapture(T.pointerId),d([E]),f([T.pressure]),m(true),i&&(i.current=true));},[t,e,x,i,l]),S=useCallback(T=>{if(!h||t==="select"||t==="eraser")return;let E=x(T);E&&(d(M=>[...M,E]),f(M=>[...M,T.pressure]));},[h,t,x]),w=useCallback(T=>{if(!h||t==="select"||t==="eraser")return;if(T.target.releasePointerCapture(T.pointerId),m(false),i&&(i.current=false),u.length<2){d([]);return}let E=1/0,M=1/0,A=-1/0,R=-1/0;for(let D of u)D.x<E&&(E=D.x),D.y<M&&(M=D.y),D.x>A&&(A=D.x),D.y>R&&(R=D.y);let k=o;E-=k,M-=k,A+=k,R+=k;let N=Math.max(A-E,1),F=Math.max(R-M,1),B=u.map(D=>({x:D.x-E,y:D.y-M}));if(t==="freeform"){let O=Math.round(N*100),U=Math.round(F*100),H=[];for(let Z=0;Z<B.length;Z++){let J={x:Math.round(B[Z].x*100),y:Math.round(B[Z].y*100)};H.push(Z===0?{type:"moveTo",pt:J}:{type:"lineTo",pt:J});}H.length>2&&H.push({type:"close"});let j={id:`shape-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"shape",x:E,y:M,width:N,height:F,shapeType:"custom",shapeStyle:{fillColor:"transparent",strokeColor:r,strokeWidth:o},customGeometryPaths:[{width:O,height:U,segments:H}]};a?.(j);}else {let D=y(B),O=t==="highlighter",U=p.length>=2&&p.some(j=>Math.abs(j-p[0])>.01),H={id:`ink-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"ink",x:E,y:M,width:N,height:F,inkPaths:[D],inkColors:[r],inkWidths:[o],inkOpacities:[O?.4:1],inkTool:O?"highlighter":"pen",...U?{inkPointPressures:[p]}:{}};s?.(H);}d([]),f([]);},[h,t,u,r,o,i,s,a,y,p]),C=useMemo(()=>h?y(u):"",[h,u,y]);return {isDrawing:c,isStrokeActive:h,liveStrokeD:C,currentStrokePoints:u,handleDrawPointerDown:v,handleDrawPointerMove:S,handleDrawPointerUp:w}}function Mle(t){let e=useRef(t);e.current=t;let n=useCallback((d,p,f)=>e.current.onResizePointerDown(d,p,f),[]),r=useCallback((d,p)=>e.current.onAdjustmentPointerDown(d,p),[]),o=useCallback(d=>e.current.onInlineEditChange(d),[]),i=useCallback(()=>e.current.onInlineEditCommit(),[]),s=useCallback(()=>e.current.onInlineEditCancel(),[]),a=useCallback((d,p)=>e.current.onTableCellSelect(d,p),[]),l=useCallback((d,p,f,h)=>e.current.onCommitCellEdit?.(d,p,f,h),[]),c=useCallback((d,p)=>e.current.onResizeTableColumns?.(d,p),[]),u=useCallback((d,p,f)=>e.current.onResizeTableRow?.(d,p,f),[]);return {cbRef:e,stableResizePointerDown:n,stableAdjustmentPointerDown:r,stableInlineEditChange:o,stableInlineEditCommit:i,stableInlineEditCancel:s,stableTableCellSelect:a,stableCommitCellEdit:l,stableResizeTableColumns:c,stableResizeTableRow:u}}function CH({activeSlide:t,templateElements:e,canvasSize:n,zoom:r,mode:o,canEdit:i,editTemplateMode:s,selectedElementIdSet:a,selectedElement:l,inlineEditingElementId:c,inlineEditingText:u,spellCheckEnabled:d,mediaDataUrls:p,tableEditorState:f,marqueeSelectionState:h,snapLines:m,showGrid:x,gridSpacingPx:y,showRulers:v,rulerUnit:S="inches",guides:w,presentationElementStates:C,presentationKeyframesCss:T,onClick:E,onDoubleClick:M,onMouseDown:A,onContextMenu:R,onCanvasMouseDown:k,onResizePointerDown:N,onAdjustmentPointerDown:F,onInlineEditChange:B,onInlineEditCommit:D,onInlineEditCancel:O,onTableCellSelect:U,onCommitCellEdit:H,onResizeTableColumns:j,onResizeTableRow:Z,findResults:J,findResultIndex:W,activeSlideIndex:te,activeTool:se="select",drawingColor:Ce="#000000",drawingWidth:ee=3,isDrawingRef:ce,onAddInkElement:ue,onAddFreeformShape:Ne,onEraseInkElement:Ue,onActionClick:he,onHyperlinkClick:Be,comments:Me,showCommentMarkers:ge=false,onCommentMarkerClick:Te,onMoveGuide:be,onDeleteGuide:xe,onCreateGuideFromRuler:Pe,connectorCreationMode:Xe=false,onCreateConnector:Y,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt,collaborationOverlay:V}){let $=(o==="edit"||o==="master")&&i,{cbRef:ie,stableResizePointerDown:ve,stableAdjustmentPointerDown:De,stableInlineEditChange:$e,stableInlineEditCommit:ze,stableInlineEditCancel:ae,stableTableCellSelect:Se,stableCommitCellEdit:Ye,stableResizeTableColumns:Q,stableResizeTableRow:pe}=Mle({onClick:E,onDoubleClick:M,onMouseDown:A,onContextMenu:R,onResizePointerDown:N,onAdjustmentPointerDown:F,onInlineEditChange:B,onInlineEditCommit:D,onInlineEditCancel:O,onTableCellSelect:U,onCommitCellEdit:H,onResizeTableColumns:j,onResizeTableRow:Z}),{elementFindHighlightsMap:Re,selectedBounds:nt,handleStageClick:Ke,handleStageDblClick:Ct,handleStageMouseDown:ne,handleStagePointerDown:Ze,handleStageContextMenu:Le,setDraggingGuide:rt,handleStagePointerMove:qe,handleStagePointerUp:He}=wle({cbRef:ie,onCanvasMouseDown:k,findResults:J,findResultIndex:W,activeSlideIndex:te,selectedElement:l,zoom:r,onMoveGuide:be}),{connectorDragState:gt,handleConnectionSiteDown:Nt,handleConnectorDragMove:In,handleConnectionSiteDrop:yn,handleConnectorDragEnd:Zo}=Cle({activeSlide:t,zoom:r,onCreateConnector:Y}),{isDrawing:Ii,isStrokeActive:La,liveStrokeD:Qc,handleDrawPointerDown:eu,handleDrawPointerMove:ra,handleDrawPointerUp:oa}=Tle({activeTool:se,activeSlide:t,zoom:r,drawingColor:Ce,drawingWidth:ee,isDrawingRef:ce,onAddInkElement:ue,onAddFreeformShape:Ne,onEraseInkElement:Ue}),Fs=v?Qn:0;return jsx("div",{ref:r.canvasViewportRef,className:"flex-1 overflow-auto relative",style:{touchAction:"pan-x pan-y"},children:jsxs("div",{ref:r.editWrapperRef,className:"relative mx-auto my-4",style:{width:n.width*r.editorScale+Fs,height:n.height*r.editorScale+Fs},children:[jsx(ble,{canvasSize:n,editorScale:r.editorScale,unit:S,visible:v,selectedBounds:nt,onCreateGuideFromRuler:Pe}),jsxs("div",{ref:r.canvasStageRef,role:"region","aria-label":`Slide ${(te??0)+1}`,"aria-roledescription":"slide",className:"relative shadow-2xl",style:{width:n.width,height:n.height,transform:`scale(${r.editorScale})`,transformOrigin:"top left",marginTop:Fs,marginLeft:Fs,touchAction:$?"none":void 0,backgroundColor:t?.backgroundColor&&t.backgroundColor!=="transparent"?t.backgroundColor:"#ffffff"},onClick:Ke,onDoubleClick:Ct,onMouseDown:ne,onPointerDown:$?Ze:void 0,onContextMenu:Le,onPointerMove:qe,onPointerUp:He,children:[T&&jsx("style",{children:T}),jsx(hle,{canvasSize:n,gridSpacingPx:y,visible:x}),jsx(ile,{guides:w,onDeleteGuide:xe,onStartGuideDrag:rt}),jsx(sle,{backgroundImage:t?.backgroundImage,backgroundGradient:t?.backgroundGradient}),e.map((Sr,pl)=>jsx(rk,{element:Sr,activeSlide:t,isSelected:a.has(Sr.id),isInlineEditing:c===Sr.id,inlineEditingText:u,canInteract:(o==="edit"||o==="master")&&i&&s,spellCheckEnabled:d,mediaDataUrls:p,selectionColorClass:"blue-400",showHoverBorder:false,opacity:.95,zIndex:pl,imageAltText:"Template element",showResizeHandles:$&&a.has(Sr.id)&&a.size<=1&&!c,renderInk:false,renderGroups:false,adjustmentHandleDescriptor:$&&l?.id===Sr.id?kE(Sr):null,onResizePointerDown:ve,onAdjustmentPointerDown:De,onInlineEditChange:$e,onInlineEditCommit:ze,onInlineEditCancel:ae,onActionClick:he,onHyperlinkClick:Be,animationState:C?.get(Sr.id),presentationElementStates:C,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt},`tpl-${Sr.id}`)),t?.elements.map((Sr,pl)=>jsx(rk,{element:Sr,activeSlide:t,isSelected:a.has(Sr.id),isInlineEditing:c===Sr.id,inlineEditingText:u,canInteract:(o==="edit"||o==="master")&&i,spellCheckEnabled:d,mediaDataUrls:p,tableEditorState:f,selectionColorClass:"blue-500",showHoverBorder:true,zIndex:e.length+pl,imageAltText:"Slide element",showResizeHandles:$&&a.has(Sr.id)&&a.size<=1&&!c,renderInk:true,renderGroups:true,adjustmentHandleDescriptor:$&&l?.id===Sr.id?kE(Sr):null,onResizePointerDown:ve,onAdjustmentPointerDown:De,onInlineEditChange:$e,onInlineEditCommit:ze,onInlineEditCancel:ae,onTableCellSelect:Se,onCommitCellEdit:Ye,onResizeTableColumns:Q,onResizeTableRow:pe,findHighlights:Re.get(Sr.id),onActionClick:he,onHyperlinkClick:Be,animationState:C?.get(Sr.id),presentationElementStates:C,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt},Sr.id)),jsx(ale,{marqueeSelectionState:h}),ge&&Me&&Me.length>0&&jsx(ule,{comments:Me,canvasSize:n,onCommentMarkerClick:Te}),jsx(lle,{snapLines:m}),Xe&&t&&jsx(dle,{activeSlide:t,canvasSize:n,zoom:r,connectorDragState:gt,onConnectionSiteDown:Nt,onConnectorDragMove:In,onConnectionSiteDrop:yn,onConnectorDragEnd:Zo}),Ii&&jsx(fle,{canvasSize:n,activeTool:se,drawingColor:Ce,drawingWidth:ee,isStrokeActive:La,liveStrokeD:Qc,onPointerDown:eu,onPointerMove:ra,onPointerUp:oa}),V]})]})})}function MH({isShortcutHelpOpen:t,isAccessibilityPanelOpen:e,showSlideSorter:n,accessibilityIssues:r,slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onCloseShortcuts:c,onCloseAccessibility:u,onSelectSlide:d,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onCloseSorter:x,reducedMotion:y,onToggleReducedMotion:v}){return t||e||n?jsxs(Fragment,{children:[t&&jsx(xU,{isOpen:t,onClose:c}),e&&jsx(yU,{isOpen:e,issues:r,onClose:u,reducedMotion:y,onToggleReducedMotion:v}),n&&jsx($6,{slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onSelectSlide:d,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onClose:x})]}):null}function EH({activeSlide:t,allSlides:e,isSlideNotesCollapsed:n,canEdit:r,slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,onToggleNotes:l,onUpdateNotes:c,collaborationSlot:u,notesPanelHeight:d,onResizeBottom:p,scale:f,onZoomIn:h,onZoomOut:m,onZoomToFit:x,mode:y,onSetMode:v,onToggleSlideSorter:S,hideStatusBar:w=false}){return jsxs(Fragment,{children:[p&&!n&&jsx(Cp,{direction:"vertical",onResize:p}),jsx(V6,{activeSlide:t,allSlides:e,isExpanded:!n,canEdit:r,onToggle:l,onUpdateNotes:c,panelHeight:d}),!w&&jsx(SU,{slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,scale:f,onZoomIn:h,onZoomOut:m,onZoomToFit:x,isNotesExpanded:!n,onToggleNotes:l,mode:y,onSetMode:v,onToggleSlideSorter:S,collaborationSlot:u})]})}function AH({isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,effectiveSelectedIds:a,tableEditorState:l,sidebarPanelMode:c,activeSlideIndex:u,comments:d,onSetSidebarPanelMode:p,onClose:f,onUpdateElementStyle:h,onUpdateTextStyle:m,onUpdateElement:x,onApplySelection:y,onSetCanvasSize:v,onMoveLayer:S,onMoveLayerToEdge:w,onDeleteElement:C,onUpdateSlide:T,presentationProperties:E,onUpdatePresentationProperties:M,notesMaster:A,handoutMaster:R,notesCanvasSize:k,coreProperties:N,appProperties:F,customProperties:B,themeOptions:D,onUpdateCoreProperties:O,onUpdateAppProperties:U,onUpdateCustomProperties:H,tagCollections:j,onUpdateTagCollections:Z,onApplyTheme:J,editTemplateMode:W,slideMasters:te,onSetTemplateBackground:se,onGetTemplateBackgroundColor:Ce,mediaDataUrls:ee,theme:ce,panelWidth:ue}){if(!t)return null;let Ne=c;if(!s&&Ne!=="comments"&&Ne!=="properties")return null;let Ue=r?.id??"",he=d.commentDraftBySlideId[Ue]??"",Be=d.editingCommentIdBySlideId[Ue]??null;return jsx("div",{role:"complementary","aria-label":"Properties",className:"h-full flex-shrink-0 max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:z-30",style:ue?{width:ue}:void 0,children:jsx(W8,{isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:Me=>p(Me),onClose:f,onUpdateElementStyle:h,onUpdateTextStyle:m,onUpdateElement:x,onUpdateSlide:T,onSelectElement:Me=>y(Me),onMoveLayer:S,onMoveLayerToEdge:w,onDeleteElement:C,comments:r?.comments??[],presentationProperties:E,onUpdatePresentationProperties:M,notesMaster:A,handoutMaster:R,notesCanvasSize:k,coreProperties:N,appProperties:F,customProperties:B,themeOptions:D,onUpdateCoreProperties:O,onUpdateAppProperties:U,onUpdateCustomProperties:H,tagCollections:j,onUpdateTagCollections:Z,onApplyTheme:J,commentDraft:he,editingCommentId:Be,commentEditDraft:Be?d.commentEditDraftByCommentId[Be]??"":"",onSetCommentDraft:Me=>d.handleCommentDraftChange(Ue,Me),onAddComment:()=>d.handleAddSlideComment(u),onDeleteComment:Me=>d.handleDeleteSlideComment(u,Me),onStartEditComment:Me=>d.handleStartCommentEdit(Ue,Me),onSaveEditComment:Me=>d.handleSaveCommentEdit(u,Me),onCancelEditComment:()=>d.handleCancelCommentEdit(Ue),onSetCommentEditDraft:Me=>d.handleSetCommentEditDraft(d.editingCommentIdBySlideId[Ue]??"",Me),onToggleCommentResolved:Me=>d.handleToggleCommentResolved(u,Me),onStartReply:Me=>d.handleStartReply(u,Me),onCancelReply:d.handleCancelReply,onReplyDraftChange:(Me,ge)=>d.handleReplyDraftChange(Me,ge),onSubmitReply:Me=>d.handleSubmitReply(u,Me),replyingToCommentId:d.replyingToCommentId,replyDraftByCommentId:d.replyDraftByCommentId,onUpdateCanvasSize:v,editTemplateMode:W,slideMasters:te,onSetTemplateBackground:se,onGetTemplateBackgroundColor:Ce,mediaDataUrls:ee,theme:ce,panelWidth:ue})})}function Ale(t,e){if(!e?.layoutPath||!t.some(u=>u.masterPath))return t;let o=t.find(u=>u.path===e.layoutPath)?.masterPath;if(!o)return t;let i=t.filter(u=>u.masterPath===o),s=new Map;for(let u of i){let d=u.path===e.layoutPath;(!s.get(u.name)||d)&&s.set(u.name,u);}let a=new Set(Array.from(s.values()).map(u=>u.path)),l=[],c=new Set;for(let u of i)a.has(u.path)&&(c.has(u.name)||(c.add(u.name),l.push(u)));return l}function PH(t){let{mode:e,canEdit:n,state:r,selectedElement:o,activeSlide:i,zoom:s,history:a,findReplace:l,manipulation:c,insertHandlers:u,exportHandlers:d,printHandlers:p,propertyHandlers:f,dialogs:h,slideOps:m,ops:x,onSetMode:y,onEnterPresenterView:v,onEnterRehearsalMode:S,onOpenSettings:w,onOpenShareDialog:C,onToggleFormatPainter:T}=t,E=useCallback((N,F)=>{if(!o||!i)return;let B=i.animations??[],D=B.find(U=>U.elementId===o.id),O=N;if(D){let U=B.map(H=>H.elementId===o.id?{...H,[F]:O}:H);f.handleUpdateSlide({animations:U});}else {let U={elementId:o.id,[F]:O,durationMs:500,order:B.length,trigger:"onClick"};f.handleUpdateSlide({animations:[...B,U]});}},[o,i,f]),M=useCallback(()=>{if(!o||!i)return;let F=(i.animations??[]).filter(B=>B.elementId!==o.id);f.handleUpdateSlide({animations:F});},[o,i,f]),A=useCallback(N=>{if(!i)return;let F=i.transition??{type:"none"};f.handleUpdateSlide({transition:{...F,...N}});},[i,f]),R=Vn__default.useMemo(()=>Ale(r.layoutOptions,i),[r.layoutOptions,i]),k=useCallback(()=>{let N=i?.transition;N&&(x.updateSlides(F=>F.map(B=>({...B,transition:N}))),a.markDirty());},[i,x,a]);return jsxs(Fragment,{children:[jsx(R8,{mode:e,canEdit:n,isNarrowViewport:h.isNarrowViewport,isSidebarCollapsed:!r.isSlidesPaneOpen,isInspectorPaneOpen:r.isInspectorPaneOpen,isCompactToolbarOpen:r.isCompactToolbarOpen,toolbarSection:r.toolbarSection,scale:s.scale,canUndo:a.canUndo,canRedo:a.canRedo,undoLabel:a.undoLabel,redoLabel:a.redoLabel,findReplaceOpen:l.findReplaceOpen,selectedElement:o,tableEditorState:r.tableEditorState,editTemplateMode:r.editTemplateMode,newShapeType:r.newShapeType,activeTool:r.activeTool,drawingColor:r.drawingColor,drawingWidth:r.drawingWidth,clipboardPayload:r.clipboardPayload,onSetMode:y,onToggleSidebar:()=>r.setIsSlidesPaneOpen(N=>!N),onToggleInspector:()=>r.setIsInspectorPaneOpen(N=>!N),onOpenAnimationPanel:()=>{r.setIsInspectorPaneOpen(true),r.setSidebarPanelMode("properties");},onAddAnimation:E,onRemoveAnimation:M,onToggleCompactToolbar:()=>r.setIsCompactToolbarOpen(N=>!N),onSetToolbarSection:r.setToolbarSection,onZoomIn:s.handleZoomIn,onZoomOut:s.handleZoomOut,onZoomToFit:s.handleZoomToFit,onUndo:a.handleUndo,onRedo:a.handleRedo,onToggleFindReplace:()=>l.setFindReplaceOpen(!l.findReplaceOpen),onSetNewShapeType:r.setNewShapeType,onAddTextBox:u.handleAddTextBox,onAddShape:u.handleAddShape,onAddTable:u.handleAddTable,onAddSmartArt:()=>h.setIsSmartArtDialogOpen(true),onAddEquation:()=>{h.setEditingEquationOmml(null),h.setIsEquationDialogOpen(true);},onAddActionButton:u.handleAddActionButton,onInsertField:u.handleInsertField,onOpenImagePicker:()=>r.imageInputRef.current?.click(),onOpenMediaPicker:()=>r.mediaInputRef.current?.click(),onSetActiveTool:r.setActiveTool,onSetDrawingColor:r.setDrawingColor,onSetDrawingWidth:r.setDrawingWidth,onSetEditTemplateMode:r.setEditTemplateMode,spellCheckEnabled:r.spellCheckEnabled,showGrid:r.showGrid,showRulers:r.showRulers,snapToGrid:r.snapToGrid,snapToShape:r.snapToShape,onSetSpellCheckEnabled:r.setSpellCheckEnabled,onSetShowGrid:r.setShowGrid,onSetShowRulers:r.setShowRulers,onSetSnapToGrid:r.setSnapToGrid,onSetSnapToShape:r.setSnapToShape,onAddGuide:h.handleAddGuide,onAlignElements:c.handleAlignElements,onCopy:c.handleCopy,onCut:c.handleCut,onPaste:c.handlePaste,onFlip:c.handleFlip,onMoveLayer:c.handleMoveLayer,onMoveLayerToEdge:c.handleMoveLayerToEdge,onDuplicate:c.handleDuplicate,onDelete:c.handleDelete,onExportPng:d.handleExportPng,onExportPdf:d.handleExportPdf,onExportVideo:d.handleExportVideo,onExportGif:d.handleExportGif,onPackageForSharing:d.handlePackageForSharing,onOpenShareDialog:C,onSaveAsPptx:d.handleSaveAsPptx,onSaveAsPpsx:d.handleSaveAsPpsx,onSaveAsPptm:d.handleSaveAsPptm,hasMacros:r.hasMacros,onCopySlideAsImage:d.handleCopySlideAsImage,onPrint:p.handlePrint,onToggleShortcuts:()=>r.setIsShortcutHelpOpen(N=>!N),onOpenSettings:w,onRunAccessibilityCheck:h.handleRunAccessibilityCheck,onToggleSlideSorter:()=>r.setShowSlideSorter(N=>!N),onUpdateTextStyle:x.updateSelectedTextStyle,isOverflowMenuOpen:r.isOverflowMenuOpen,onSetOverflowMenuOpen:r.setIsOverflowMenuOpen,layoutOptions:R,onInsertSlideFromLayout:m.handleInsertSlideFromLayout,customShows:r.customShows,activeCustomShowId:r.activeCustomShowId,onSetActiveCustomShowId:r.setActiveCustomShowId,onCreateCustomShow:h.handleCreateCustomShow,onRenameActiveCustomShow:h.handleRenameActiveCustomShow,onDeleteActiveCustomShow:h.handleDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:h.handleToggleCurrentSlideInActiveShow,isCurrentSlideInActiveShow:h.isCurrentSlideInActiveShow,onEnterMasterView:h.handleEnterMasterView,onCloseMasterView:h.handleCloseMasterView,onToggleVersionHistory:()=>f.setIsVersionHistoryOpen(N=>!N),onOpenPasswordProtection:()=>h.setIsPasswordDialogOpen(true),onOpenDocumentProperties:()=>h.setIsDocPropsDialogOpen(true),onOpenFontEmbedding:()=>h.setIsFontEmbeddingOpen(true),onOpenDigitalSignatures:()=>h.setIsDigitalSigDialogOpen(true),onEnterPresenterView:v,onEnterRehearsalMode:S,onToggleThemeEditor:()=>r.setIsThemeEditorOpen(N=>!N),isThemeEditorOpen:r.isThemeEditorOpen,onToggleThemeGallery:()=>r.setIsThemeGalleryOpen(N=>!N),isThemeGalleryOpen:r.isThemeGalleryOpen,onCompare:f.handleCompare,onToggleComments:()=>{r.setSidebarPanelMode("comments"),r.isInspectorPaneOpen||r.setIsInspectorPaneOpen(true);},isCommentsPanelOpen:r.isInspectorPaneOpen,slideCommentCount:i?.comments?.length??0,formatPainterActive:r.formatPainterActive,canActivateFormatPainter:GQ(o),onToggleFormatPainter:T??(()=>r.setFormatPainterActive(N=>!N)),isSelectionPaneOpen:r.isSelectionPaneOpen,onToggleSelectionPane:()=>r.setIsSelectionPaneOpen(N=>!N),eyedropperActive:r.eyedropperActive,onToggleEyedropper:()=>r.setEyedropperActive(N=>!N),onOpenSetUpSlideShow:()=>h.setIsSetUpSlideShowOpen(true),onOpenBroadcastDialog:()=>h.setIsBroadcastDialogOpen(true),onToggleSubtitles:h.handleToggleSubtitles,showSubtitles:!!r.presentationProperties.showSubtitles,activeSlide:i,onTransitionChange:A,onApplyTransitionToAll:k}),r.hasDigitalSignatures&&jsx("div",{className:"flex items-center px-3 py-1 z-10",children:jsx(o8,{hasSignatures:r.hasDigitalSignatures,signatureCount:r.digitalSignatureCount,onClick:()=>h.setIsDigitalSigDialogOpen(true)})}),jsx("input",{ref:r.imageInputRef,type:"file",name:"image-upload",accept:"image/*",className:"hidden",onChange:u.handleImageFileChange}),jsx("input",{ref:r.mediaInputRef,type:"file",name:"media-upload",accept:"video/*,audio/*",className:"hidden",onChange:u.handleMediaFileChange})]})}var hM={"\\alpha":"\u03B1","\\beta":"\u03B2","\\gamma":"\u03B3","\\delta":"\u03B4","\\epsilon":"\u03B5","\\varepsilon":"\u03B5","\\zeta":"\u03B6","\\eta":"\u03B7","\\theta":"\u03B8","\\vartheta":"\u03D1","\\iota":"\u03B9","\\kappa":"\u03BA","\\lambda":"\u03BB","\\mu":"\u03BC","\\nu":"\u03BD","\\xi":"\u03BE","\\pi":"\u03C0","\\rho":"\u03C1","\\sigma":"\u03C3","\\tau":"\u03C4","\\upsilon":"\u03C5","\\phi":"\u03C6","\\varphi":"\u03D5","\\chi":"\u03C7","\\psi":"\u03C8","\\omega":"\u03C9","\\Gamma":"\u0393","\\Delta":"\u0394","\\Theta":"\u0398","\\Lambda":"\u039B","\\Xi":"\u039E","\\Pi":"\u03A0","\\Sigma":"\u03A3","\\Phi":"\u03A6","\\Psi":"\u03A8","\\Omega":"\u03A9"},mM={"\\times":"\xD7","\\div":"\xF7","\\pm":"\xB1","\\mp":"\u2213","\\cdot":"\xB7","\\leq":"\u2264","\\geq":"\u2265","\\neq":"\u2260","\\approx":"\u2248","\\equiv":"\u2261","\\ll":"\u226A","\\gg":"\u226B","\\subset":"\u2282","\\supset":"\u2283","\\subseteq":"\u2286","\\supseteq":"\u2287","\\in":"\u2208","\\notin":"\u2209","\\cup":"\u222A","\\cap":"\u2229","\\to":"\u2192","\\rightarrow":"\u2192","\\leftarrow":"\u2190","\\Rightarrow":"\u21D2","\\Leftarrow":"\u21D0","\\infty":"\u221E","\\partial":"\u2202","\\nabla":"\u2207","\\forall":"\u2200","\\exists":"\u2203","\\ldots":"\u2026","\\cdots":"\u22EF","\\le":"\u2264","\\ge":"\u2265","\\ne":"\u2260"},gM={"\\sum":"\u2211","\\prod":"\u220F","\\int":"\u222B","\\iint":"\u222C","\\iiint":"\u222D","\\oint":"\u222E","\\coprod":"\u2210","\\bigcup":"\u22C3","\\bigcap":"\u22C2"},Ple=new Set(["sin","cos","tan","cot","sec","csc","arcsin","arccos","arctan","sinh","cosh","tanh","coth","log","ln","exp","lim","min","max","sup","inf","det","dim","mod","gcd","deg","hom","ker"]);function Rle(t){let e=[],n=0;for(;n<t.length;){let r=t[n];if(r==="{")e.push({type:"group_start",value:"{"}),n++;else if(r==="}")e.push({type:"group_end",value:"}"}),n++;else if(r==="^")e.push({type:"superscript",value:"^"}),n++;else if(r==="_")e.push({type:"subscript",value:"_"}),n++;else if(r==="\\"){let o="\\";if(n++,n<t.length&&/[a-zA-Z]/.test(t[n]))for(;n<t.length&&/[a-zA-Z]/.test(t[n]);)o+=t[n],n++;else n<t.length&&(o+=t[n],n++);e.push({type:"command",value:o});}else /\s/.test(r)?(n++,e.push({type:"whitespace",value:" "})):(e.push({type:"text",value:r}),n++);}return e}function Zp(t,e){let n=false,r=false,o=[],i=[];for(let s=0;s<2;s++){let a=t.peek();a?.type==="superscript"&&!n?(t.next(),o=t.parseSingleOrGroup(),n=true):a?.type==="subscript"&&!r&&(t.next(),i=t.parseSingleOrGroup(),r=true);}return n&&r?{"m:sSubSup":{"m:e":t.wrapE([e]),"m:sub":t.wrapE(i),"m:sup":t.wrapE(o)}}:n?{"m:sSup":{"m:e":t.wrapE([e]),"m:sup":t.wrapE(o)}}:r?{"m:sSub":{"m:e":t.wrapE([e]),"m:sub":t.wrapE(i)}}:e}function kle(t,e){let n=[],r=[],o=false,i=false;for(let l=0;l<2;l++){let c=t.peek();c?.type==="subscript"&&!o?(t.next(),n=t.parseSingleOrGroup(),o=true):c?.type==="superscript"&&!i&&(t.next(),r=t.parseSingleOrGroup(),i=true);}let s=t.parseSingleOrGroup(),a={"m:chr":{"@_val":e}};return o||(a["m:subHide"]={"@_val":"1"}),i||(a["m:supHide"]={"@_val":"1"}),{"m:nary":{"m:naryPr":a,"m:sub":o?t.wrapE(n):{},"m:sup":i?t.wrapE(r):{},"m:e":t.wrapE(s)}}}function Ile(t){let e=t.next(),n=e?.value==="."?"":e?.value??"(",r=[];for(;t.peek();){if(t.peek().type==="command"&&t.peek().value==="\\right"){t.next();break}let a=t.parseAtom();a&&r.push(a);}let o=t.next(),i=o?.value==="."?"":o?.value??")",s={};return n!=="("&&(s["m:begChr"]={"@_val":n}),i!==")"&&(s["m:endChr"]={"@_val":i}),{"m:d":{"m:dPr":Object.keys(s).length>0?s:void 0,"m:e":t.wrapE(r)}}}function Nle(t,e){let n=t.makeRun(e,true),r=Zp(t,n),o=[];if(t.peek()?.type==="group_start")o=t.parseGroup();else if(t.peek()&&t.peek().type!=="group_end"){let i=t.parseAtom();i&&(o=[i]);}return o.length===0?r:{"m:func":{"m:fName":t.wrapE([r]),"m:e":t.wrapE(o)}}}var RH=class{tokens;pos=0;constructor(e){this.tokens=e;}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(e){let n=this.next();if(!n||n.type!==e)throw new Error(`Expected ${e}, got ${n?.type??"EOF"}`);return n}parseGroup(){this.expect("group_start");let e=[];for(;this.peek()&&this.peek().type!=="group_end";){let n=this.parseAtom();n&&e.push(n);}return this.expect("group_end"),e}parseSingleOrGroup(){if(this.peek()?.type==="group_start")return this.parseGroup();let e=this.parseAtom();return e?[e]:[]}wrapE(e){if(e.length===1)return {"m:r":e[0]["m:r"],"m:f":e[0]["m:f"],"m:rad":e[0]["m:rad"],"m:sSup":e[0]["m:sSup"],"m:sSub":e[0]["m:sSub"],"m:sSubSup":e[0]["m:sSubSup"],"m:nary":e[0]["m:nary"],"m:d":e[0]["m:d"],"m:func":e[0]["m:func"]};let n={};for(let r of e)for(let o of Object.keys(r))if(n[o]){let i=n[o];Array.isArray(i)?i.push(r[o]):n[o]=[i,r[o]];}else n[o]=r[o];return n}makeRun(e,n=false){let r={"m:t":e};return n&&(r["m:rPr"]={"m:nor":{"@_val":"1"}}),{"m:r":r}}parseAtom(){let e=this.peek();if(!e)return null;if(e.type==="whitespace")return this.next(),this.parseAtom();if(e.type==="text"){this.next();let n=this.makeRun(e.value);return Zp(this,n)}if(e.type==="group_start"){let n=this.parseGroup();if(n.length===0)return null;let r=n.length===1?n[0]:this.wrapE(n);return Zp(this,r)}if(e.type==="command"){this.next();let n=e.value;if(hM[n]){let i=this.makeRun(hM[n]);return Zp(this,i)}if(mM[n])return this.makeRun(mM[n]);if(gM[n])return kle(this,gM[n]);if(n==="\\frac"){let i=this.parseGroup(),s=this.parseGroup(),a={"m:f":{"m:num":this.wrapE(i),"m:den":this.wrapE(s)}};return Zp(this,a)}if(n==="\\sqrt"){if(this.peek()?.type==="text"&&this.peek()?.value==="["){this.next();let a="";for(;this.peek()&&!(this.peek().type==="text"&&this.peek().value==="]");)a+=this.next().value;this.peek()?.value==="]"&&this.next();let l=this.parseGroup(),c={"m:rad":{"m:deg":this.wrapE([this.makeRun(a)]),"m:e":this.wrapE(l)}};return Zp(this,c)}let i=this.parseGroup(),s={"m:rad":{"m:radPr":{"m:degHide":{"@_val":"1"}},"m:e":this.wrapE(i)}};return Zp(this,s)}if(n==="\\text"){let s=this.parseGroup().map(a=>{let l=a["m:r"];return l?String(l["m:t"]??""):""}).join("");return this.makeRun(s,true)}if(n==="\\left")return Ile(this);if(n==="\\right")return null;let r=n.slice(1);if(Ple.has(r))return Nle(this,r);let o=this.makeRun(n.slice(1),true);return Zp(this,o)}if(e.type==="superscript"||e.type==="subscript"){this.next();let n=this.parseSingleOrGroup(),r=this.makeRun("");return e.type==="superscript"?{"m:sSup":{"m:e":this.wrapE([r]),"m:sup":this.wrapE(n)}}:{"m:sSub":{"m:e":this.wrapE([r]),"m:sub":this.wrapE(n)}}}return null}parseAll(){let e=[];for(;this.peek();){let n=this.parseAtom();n&&e.push(n);}return e}};function wN(t){let e=t.trim();if(e.length===0)return {};let n=Rle(e),o=new RH(n).parseAll();if(o.length===0)return {};let i={};for(let s of o)for(let a of Object.keys(s))if(i[a]){let l=i[a];Array.isArray(l)?l.push(s[a]):i[a]=[l,s[a]];}else i[a]=s[a];return {"m:oMathPara":{"m:oMath":i}}}var kH={};for(let[t,e]of Object.entries(hM))kH[e]=t;var CN={};for(let[t,e]of Object.entries(mM))CN[e]||(CN[e]=t);var IH={};for(let[t,e]of Object.entries(gM))IH[e]||(IH[e]=t);function Aqe(t){return t==null?[]:Array.isArray(t)?t:typeof t=="object"?[t]:[]}function br(t,e){if(!t)return {};let n=t[e];return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}function X0(t){if(!t)return "";let e=t["@_val"];return typeof e=="string"?e:e!==void 0?String(e):""}function pi(t){if(!t||typeof t!="object")return "";let e=[];for(let n of Object.keys(t)){if(n.startsWith("@_"))continue;let r=Aqe(t[n]);for(let o of r){let i=Pqe(n,o);i&&e.push(i);}}return e.join("")}function Pqe(t,e){switch(t){case "m:r":{let n=typeof e["m:t"]=="string"?e["m:t"]:e["m:t"]!==void 0?String(e["m:t"]):"";if(n.length===0)return "";if(kH[n])return `${kH[n]} `;if(CN[n])return `${CN[n]} `;let r=br(e,"m:rPr"),o=X0(br(r,"m:nor"));return o==="1"||o==="on"||o==="true"?`\\text{${n}}`:n}case "m:f":{let n=pi(br(e,"m:num")),r=pi(br(e,"m:den"));return `\\frac{${n}}{${r}}`}case "m:rad":{let n=br(e,"m:radPr"),r=X0(br(n,"m:degHide")),o=pi(br(e,"m:e"));if(r==="1"||r==="on"||r==="true")return `\\sqrt{${o}}`;let i=pi(br(e,"m:deg"));return i?`\\sqrt[${i}]{${o}}`:`\\sqrt{${o}}`}case "m:sSup":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sup"));return `${n}^{${r}}`}case "m:sSub":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sub"));return `${n}_{${r}}`}case "m:sSubSup":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sub")),o=pi(br(e,"m:sup"));return `${n}_{${r}}^{${o}}`}case "m:nary":{let n=br(e,"m:naryPr"),r=X0(br(n,"m:chr")),o=IH[r]??"\\int",i=X0(br(n,"m:subHide")),s=X0(br(n,"m:supHide")),a=pi(br(e,"m:sub")),l=pi(br(e,"m:sup")),c=pi(br(e,"m:e")),u=o;return a&&i!=="1"&&(u+=`_{${a}}`),l&&s!=="1"&&(u+=`^{${l}}`),u+=`{${c}}`,u}case "m:d":{let n=br(e,"m:dPr"),r=X0(br(n,"m:begChr"))||"(",o=X0(br(n,"m:endChr"))||")",i=pi(br(e,"m:e"));return `\\left${r}${i}\\right${o}`}case "m:func":{let n=pi(br(e,"m:fName")),r=pi(br(e,"m:e"));return `${n}{${r}}`}case "m:oMath":return pi(e);default:return ""}}function NH(t){if(!t||typeof t!="object")return "";let e,n=t["m:oMathPara"];return n?.["m:oMath"]?e=n["m:oMath"]:t["m:oMath"]?e=t["m:oMath"]:e=t,pi(e)}function Ble(t){let e=wPe;return typeof e.sanitize!="function"?t:e.sanitize(t,{USE_PROFILES:{mathMl:true,svg:true}})}var Ole=[{label:"Fraction",latex:"\\frac{a}{b}",i18nKey:"pptx.equation.template.fraction"},{label:"Quadratic",latex:"x=\\frac{-b\\pm\\sqrt{b^{2}-4ac}}{2a}",i18nKey:"pptx.equation.template.quadratic"},{label:"Pythagorean",latex:"a^{2}+b^{2}=c^{2}",i18nKey:"pptx.equation.template.pythagorean"},{label:"Sum",latex:"\\sum_{i=1}^{n}{a_{i}}",i18nKey:"pptx.equation.template.sum"},{label:"Integral",latex:"\\int_{a}^{b}{f(x)}dx",i18nKey:"pptx.equation.template.integral"},{label:"Square Root",latex:"\\sqrt{x^{2}+y^{2}}",i18nKey:"pptx.equation.template.squareRoot"},{label:"Limit",latex:"\\lim_{x\\to\\infty}{f(x)}",i18nKey:"pptx.equation.template.limit"},{label:"Euler's",latex:"e^{i\\pi}+1=0",i18nKey:"pptx.equation.template.euler"},{label:"Matrix 2x2",latex:"\\left[a,b;c,d\\right]",i18nKey:"pptx.equation.template.matrix"},{label:"Binomial",latex:"\\left(a+b\\right)^{n}",i18nKey:"pptx.equation.template.binomial"},{label:"Derivative",latex:"\\frac{dy}{dx}",i18nKey:"pptx.equation.template.derivative"},{label:"Trig Identity",latex:"\\sin^{2}\\theta+\\cos^{2}\\theta=1",i18nKey:"pptx.equation.template.trigIdentity"}],Lqe=Ole.map(t=>{try{let e=wN(t.latex),n=T1(e);return n?Ble(n):""}catch{return ""}});function Fqe({mathml:t}){let e=useRef(null);return useEffect(()=>{e.current&&(t?e.current.innerHTML=Ble(t):e.current.innerHTML="");},[t]),jsx("div",{ref:e,className:"flex items-center justify-center min-h-[80px] text-2xl text-foreground",style:{fontFamily:'"Cambria Math", "STIX Two Math", serif'}})}function Ule({isOpen:t,onClose:e,onInsert:n,existingOmml:r}){let{t:o}=useTranslation(),i=useMemo(()=>r?NH(r):"",[r]),[s,a]=useState(i),l=useDeferredValue(s),c=useRef(null);useEffect(()=>{t&&(a(i),setTimeout(()=>c.current?.focus(),50));},[t,i]);let{mathml:u,omml:d}=useMemo(()=>{if(!l.trim())return {mathml:"",omml:{}};try{let y=wN(l);return {mathml:T1(y),omml:y}}catch{return {mathml:"",omml:{}}}},[l]),p=useCallback(()=>{s.trim()&&(n(d),e());},[s,d,n,e]),f=useCallback(y=>{a(y);},[]),h=useCallback(y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),p()),y.key==="Escape"&&(y.preventDefault(),e());},[p,e]);if(!t)return null;let m=!!r,x=s.trim().length>0&&Object.keys(d).length>0;return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:y=>{y.target===y.currentTarget&&e();},onKeyDown:h,children:jsxs("div",{className:"bg-background border border-border rounded-xl shadow-2xl w-[640px] max-h-[85vh] flex flex-col overflow-hidden",onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:m?o("pptx.equation.editTitle","Edit Equation"):o("pptx.equation.insertTitle","Insert Equation")}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[jsx("div",{className:"rounded-lg border border-border bg-muted/60 p-4 min-h-[80px] flex items-center justify-center",children:x?jsx(Fqe,{mathml:u}):jsx("span",{className:"text-sm text-muted-foreground italic",children:o("pptx.equation.previewPlaceholder","Equation preview will appear here")})}),jsxs("div",{children:[jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:o("pptx.equation.latexInput","LaTeX Input")}),jsx("textarea",{ref:c,value:s,onChange:y=>a(y.target.value),placeholder:"\\\\frac{a}{b} + \\\\sqrt{c}",className:"w-full h-24 px-3 py-2 rounded-lg border border-border bg-muted text-foreground text-sm font-mono resize-none focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary placeholder:text-muted-foreground",spellCheck:false}),jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:o("pptx.equation.latexHint","Use LaTeX syntax. Ctrl+Enter to insert.")})]}),jsxs("div",{children:[jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:o("pptx.equation.templates","Common Templates")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Ole.map((y,v)=>{let S=Lqe[v];return jsxs("button",{type:"button",onClick:()=>f(y.latex),className:le("flex flex-col items-center gap-1 p-2 rounded-lg border transition-colors",s===y.latex?"border-primary bg-primary/10":"border-border bg-muted/40 hover:bg-accent/60 hover:border-border"),title:o(y.i18nKey,y.label),children:[jsx("div",{className:"text-sm text-foreground h-8 flex items-center justify-center overflow-hidden",style:{fontFamily:'"Cambria Math", "STIX Two Math", serif'},dangerouslySetInnerHTML:{__html:S}}),jsx("span",{className:"text-[10px] text-muted-foreground truncate w-full text-center",children:o(y.i18nKey,y.label)})]},y.latex)})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-4 py-1.5 rounded-lg text-xs text-foreground hover:bg-accent transition-colors",children:o("pptx.equation.cancel","Cancel")}),jsx("button",{type:"button",onClick:p,disabled:!x,className:"px-4 py-1.5 rounded-lg text-xs font-medium bg-primary hover:bg-primary/80 text-white disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:m?o("pptx.equation.update","Update"):o("pptx.equation.insert","Insert")})]})]})})}var LH=[{layout:"basicBlockList",label:"Basic Block List",category:"list",defaultItems:["Item 1","Item 2","Item 3"]},{layout:"stackedList",label:"Stacked List",category:"list",defaultItems:["Item 1","Item 2","Item 3"]},{layout:"horizontalBulletList",label:"Horizontal Bullet List",category:"list",defaultItems:["Topic 1","Topic 2","Topic 3"]},{layout:"tableList",label:"Table List",category:"list",defaultItems:["Row 1","Row 2","Row 3"]},{layout:"basicChevronProcess",label:"Chevron Process",category:"process",defaultItems:["Step 1","Step 2","Step 3"]},{layout:"segmentedProcess",label:"Segmented Process",category:"process",defaultItems:["Phase 1","Phase 2","Phase 3"]},{layout:"continuousBlockProcess",label:"Continuous Block Process",category:"process",defaultItems:["Start","Middle","End"]},{layout:"upwardArrow",label:"Upward Arrow",category:"process",defaultItems:["Stage 1","Stage 2","Stage 3"]},{layout:"basicCycle",label:"Basic Cycle",category:"cycle",defaultItems:["Phase 1","Phase 2","Phase 3","Phase 4"]},{layout:"basicRadial",label:"Basic Radial",category:"cycle",defaultItems:["Center","Spoke 1","Spoke 2","Spoke 3"]},{layout:"basicPie",label:"Basic Pie",category:"cycle",defaultItems:["Segment 1","Segment 2","Segment 3"]},{layout:"convergingRadial",label:"Converging Radial",category:"cycle",defaultItems:["Goal","Input 1","Input 2","Input 3"]},{layout:"hierarchy",label:"Hierarchy",category:"hierarchy",defaultItems:["Manager","Lead A","Lead B"]},{layout:"basicVenn",label:"Basic Venn",category:"relationship",defaultItems:["Set A","Set B","Set C"]},{layout:"linearVenn",label:"Linear Venn",category:"relationship",defaultItems:["Group 1","Group 2","Group 3"]},{layout:"alternatingHexagons",label:"Alternating Hexagons",category:"relationship",defaultItems:["Hex 1","Hex 2","Hex 3"]},{layout:"trapezoidList",label:"Trapezoid List",category:"relationship",defaultItems:["Level 1","Level 2","Level 3"]},{layout:"pictureAccentList",label:"Picture Accent List",category:"list",defaultItems:["Feature 1","Feature 2","Feature 3"]},{layout:"verticalBlockList",label:"Vertical Block List",category:"list",defaultItems:["Block 1","Block 2","Block 3"]},{layout:"groupedList",label:"Grouped List",category:"list",defaultItems:["Item A","Item B","Item C","Item D"]},{layout:"horizontalPictureList",label:"Horizontal Picture List",category:"list",defaultItems:["Photo 1","Photo 2","Photo 3"]},{layout:"verticalChevronList",label:"Vertical Chevron List",category:"list",defaultItems:["Priority 1","Priority 2","Priority 3"]},{layout:"pyramidList",label:"Pyramid List",category:"list",defaultItems:["Level 1","Level 2","Level 3"]},{layout:"stepDownProcess",label:"Step Down Process",category:"process",defaultItems:["Step 1","Step 2","Step 3"]},{layout:"alternatingFlow",label:"Alternating Flow",category:"process",defaultItems:["Stage 1","Stage 2","Stage 3","Stage 4"]},{layout:"descendingProcess",label:"Descending Process",category:"process",defaultItems:["Top","Middle","Bottom"]},{layout:"accentProcess",label:"Accent Process",category:"process",defaultItems:["Phase 1","Phase 2","Phase 3"]}],$le=[{id:"list",label:"pptx.smartart.category.list"},{id:"process",label:"pptx.smartart.category.process"},{id:"cycle",label:"pptx.smartart.category.cycle"},{id:"hierarchy",label:"pptx.smartart.category.hierarchy"},{id:"relationship",label:"pptx.smartart.category.relationship"}];var sc=["#3b82f6","#22c55e","#f97316","#eab308"];function Oqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>jsx("rect",{x:4,y:3+t*12,width:52,height:10,rx:2,fill:sc[t],opacity:.85},t))})}function Uqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>{let e=2+t*19,n=`${e},10 ${e+14},10 ${e+18},20 ${e+14},30 ${e},30 ${t>0?e+4:e},20`;return jsx("polygon",{points:n,fill:sc[t],opacity:.85},t)})})}function $qe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2,3].map(t=>{let e=t/4*Math.PI*2-Math.PI/2,n=30+13*Math.cos(e),r=20+10*Math.sin(e);return jsx("circle",{cx:n,cy:r,r:6,fill:sc[t],opacity:.85},t)})})}function Hqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("rect",{x:20,y:3,width:20,height:10,rx:2,fill:sc[0],opacity:.85}),jsx("line",{x1:30,y1:13,x2:30,y2:18,stroke:"#94a3b8",strokeWidth:1}),jsx("line",{x1:15,y1:18,x2:45,y2:18,stroke:"#94a3b8",strokeWidth:1}),jsx("rect",{x:4,y:20,width:18,height:10,rx:2,fill:sc[1],opacity:.85}),jsx("rect",{x:38,y:20,width:18,height:10,rx:2,fill:sc[2],opacity:.85}),jsx("line",{x1:15,y1:18,x2:15,y2:20,stroke:"#94a3b8",strokeWidth:1}),jsx("line",{x1:45,y1:18,x2:45,y2:20,stroke:"#94a3b8",strokeWidth:1})]})}function zqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:22,cy:20,r:14,fill:sc[0],opacity:.3}),jsx("circle",{cx:38,cy:20,r:14,fill:sc[1],opacity:.3}),jsx("circle",{cx:30,cy:10,r:14,fill:sc[2],opacity:.3})]})}function Gqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:30,cy:20,r:7,fill:sc[0],opacity:.85}),[0,1,2].map(t=>{let e=t/3*Math.PI*2-Math.PI/2,n=30+15*Math.cos(e),r=20+12*Math.sin(e);return jsxs(Vn__default.Fragment,{children:[jsx("line",{x1:30,y1:20,x2:n,y2:r,stroke:"#94a3b8",strokeWidth:1,opacity:.5}),jsx("circle",{cx:n,cy:r,r:5,fill:sc[t+1],opacity:.85})]},t)})]})}function Vqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>jsx("rect",{x:4+t*18,y:8,width:16,height:24,rx:3,fill:sc[t],opacity:.85},t))})}function Hle(t){switch(t){case "basicBlockList":case "stackedList":case "tableList":case "horizontalBulletList":return jsx(Oqe,{});case "basicChevronProcess":case "segmentedProcess":case "continuousBlockProcess":case "upwardArrow":return jsx(Uqe,{});case "basicCycle":case "basicPie":return jsx($qe,{});case "basicRadial":case "convergingRadial":return jsx(Gqe,{});case "hierarchy":return jsx(Hqe,{});case "basicVenn":case "linearVenn":return jsx(zqe,{});default:return jsx(Vqe,{})}}function Gle({isOpen:t,onClose:e,onInsert:n}){let{t:r}=useTranslation(),[o,i]=useState("list"),[s,a]=useState(null),l=LH.filter(u=>u.category===o),c=useCallback(()=>{if(!s)return;let u=LH.find(d=>d.layout===s);u&&(n(u.layout,u.defaultItems),e());},[s,n,e]);return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50",onClick:e,"aria-label":"Close"}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[600px] max-w-[90vw] max-h-[80vh] rounded-lg border border-border bg-background shadow-2xl flex flex-col",role:"dialog","aria-modal":"true","aria-label":r("pptx.smartart.insertTitle"),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-medium text-foreground",children:r("pptx.smartart.insertTitle")}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-muted transition-colors","aria-label":r("pptx.smartart.close"),children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex flex-1 overflow-hidden",children:[jsx("div",{className:"w-40 border-r border-border py-2",children:$le.map(u=>jsx("button",{type:"button",onClick:()=>{i(u.id),a(null);},className:le("w-full text-left px-3 py-1.5 text-xs transition-colors",o===u.id?"bg-primary text-white":"text-foreground hover:bg-muted"),children:r(u.label)},u.id))}),jsx("div",{className:"flex-1 p-3 overflow-y-auto",children:jsx("div",{className:"grid grid-cols-3 gap-2",children:l.map(u=>jsxs("button",{type:"button",onClick:()=>a(u.layout),onDoubleClick:()=>{a(u.layout),n(u.layout,u.defaultItems),e();},className:le("flex flex-col items-center gap-1 p-2 rounded border transition-colors",s===u.layout?"border-primary bg-primary/20":"border-border hover:border-border hover:bg-muted/50"),children:[jsx("div",{className:"w-16 h-12 flex items-center justify-center bg-muted rounded",children:Hle(u.layout)}),jsx("span",{className:"text-[10px] text-foreground text-center leading-tight",children:u.label})]},u.layout))})})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded bg-muted hover:bg-accent text-foreground transition-colors",children:r("pptx.smartart.cancel")}),jsx("button",{type:"button",onClick:c,disabled:!s,className:le("px-3 py-1.5 text-xs rounded transition-colors",s?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:r("pptx.smartart.insert")})]})]})})]}):null}function FH(t){let{dialogs:e,insertHandlers:n,exportHandlers:r,printHandlers:o,propertyHandlers:i,annotations:s,slides:a,activeSlideIndex:l,canvasSize:c,filePath:u,coreProperties:d,customProperties:p,appProperties:f,embeddedFonts:h,hasDigitalSignatures:m,digitalSignatureCount:x,presentationProperties:y,customShows:v,selectedElements:S,isEncryptedDialogOpen:w,setIsEncryptedDialogOpen:C,showKeepAnnotationsDialog:T,onKeepAnnotations:E,onDiscardAnnotations:M}=t;return jsxs(Fragment,{children:[jsx(X6,{isOpen:i.isVersionHistoryOpen,filePath:u,onClose:()=>i.setIsVersionHistoryOpen(false),onRestore:i.handleRestoreVersion}),jsx(Y6,{isOpen:i.isComparePanelOpen,compareResult:i.compareResult,canvasSize:c,onClose:()=>i.setIsComparePanelOpen(false),onAcceptSlide:i.handleAcceptSlide,onRejectSlide:i.handleRejectSlide,onAcceptAll:i.handleAcceptAllSlides}),jsx(K6,{isOpen:e.isPasswordDialogOpen,isCurrentlyProtected:e.isPasswordProtected,onClose:()=>e.setIsPasswordDialogOpen(false),onSetPassword:e.handleSetPassword,onRemovePassword:e.handleRemovePassword}),jsx(Q6,{isOpen:e.isDocPropsDialogOpen,coreProperties:d??{},customProperties:p,appProperties:f,onClose:()=>e.setIsDocPropsDialogOpen(false),onSave:(A,R,k)=>{i.handleUpdateCoreProperties(A),i.handleUpdateCustomProperties(R),k&&i.handleUpdateAppProperties(k);}}),jsx(t8,{isOpen:e.isFontEmbeddingOpen,embedFontsEnabled:e.embedFontsEnabled,usedFontFamilies:i.usedFontFamilies,embeddedFonts:h.map(A=>A.name),onClose:()=>e.setIsFontEmbeddingOpen(false),onToggleEmbedFonts:e.setEmbedFontsEnabled}),jsx(r8,{isOpen:e.isDigitalSigDialogOpen,onClose:()=>e.setIsDigitalSigDialogOpen(false),hasSignatures:m,signatureCount:x}),jsx(i8,{isOpen:e.isSignatureStrippedDialogOpen,signatureCount:x,onConfirm:()=>e.setIsSignatureStrippedDialogOpen(false),onCancel:()=>e.setIsSignatureStrippedDialogOpen(false)}),jsx(s8,{isOpen:w,onClose:()=>C(false)}),jsx(Gle,{isOpen:e.isSmartArtDialogOpen,onClose:()=>e.setIsSmartArtDialogOpen(false),onInsert:n.handleInsertSmartArt}),jsx(Ule,{isOpen:e.isEquationDialogOpen,onClose:()=>e.setIsEquationDialogOpen(false),onInsert:n.handleInsertEquation,existingOmml:e.editingEquationOmml}),jsx(yH,{open:e.isHyperlinkDialogOpen,initialUrl:S[0]?.actionClick?.url,initialTooltip:S[0]?.actionClick?.tooltip,initialAction:S[0]?.actionClick?.action,slideCount:a.length,onConfirm:n.handleHyperlinkConfirm,onCancel:()=>e.setIsHyperlinkDialogOpen(false)}),jsx(vU,{isOpen:r.exportModalOpen,title:r.exportModalTitle,progress:r.exportProgress,statusMessage:r.exportStatusMessage,onCancel:r.handleCancelExport}),jsx(lH,{open:e.isSetUpSlideShowOpen,onClose:()=>e.setIsSetUpSlideShowOpen(false),properties:y,onSave:e.handleSaveSlideShowSettings,customShows:v,slideCount:a.length}),jsx(aH,{open:o.isPrintDialogOpen,onClose:()=>o.setIsPrintDialogOpen(false),onPrint:o.handlePrintWithSettings,slides:a,activeSlideIndex:l,defaultSlidesPerPage:y.printSlidesPerPage,defaultFrameSlides:y.printFrameSlides}),jsx(rH,{isOpen:T,annotationCount:Array.from(s.allSlideAnnotations.values()).reduce((A,R)=>A+R.length,0),slideCount:s.allSlideAnnotations.size,onKeep:E,onDiscard:M})]})}function OH(t){let{mode:e,slides:n,canvasSize:r,templateElements:o,presentation:i,onExitPresentation:s}=t;return jsxs(Fragment,{children:[e==="present"&&i.presenterMode&&jsx(f8,{slides:n,currentSlideIndex:i.presentationSlideIndex,canvasSize:r,templateElements:o,presentationStartTime:i.presentationStartTime,onMovePresentationSlide:i.movePresentationSlide,onExit:s,onOpenAudienceWindow:i.openAudienceWindow,onCloseAudienceWindow:i.closeAudienceWindow,isAudienceWindowOpen:i.isAudienceWindowOpen()}),e==="present"&&i.rehearsing&&jsx(m8,{presentationStartTime:i.presentationStartTime,slideStartTime:i.slideStartTime,paused:i.rehearsalPaused,onTogglePause:i.toggleRehearsalPause}),i.showRehearsalSummary&&jsx(g8,{slides:n,canvasSize:r,recordedTimings:i.recordedTimings,onSave:i.saveRehearsalTimings,onDiscard:i.dismissRehearsalSummary})]})}var eKe=50;function jle(t){let{enabled:e,onNext:n,onPrev:r}=t,o=useRef(null),i=useCallback(a=>{if(!e||a.changedTouches.length!==1){o.current=null;return}let l=a.changedTouches[0];o.current={x:l.clientX,y:l.clientY};},[e]),s=useCallback(a=>{let l=o.current;if(o.current=null,!e||l===null||a.changedTouches.length!==1)return;let c=a.changedTouches[0],u=c.clientX-l.x,d=c.clientY-l.y;Math.abs(u)<eKe||Math.abs(u)<=Math.abs(d)||(u<0?n():r());},[e,n,r]);return {onTouchStart:i,onTouchEnd:s}}function UH(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:s,canvasSize:a,activeSlideIndex:l,gridSpacingPx:c,zoom:u,state:d,selectedElement:p,canvasHandlers:f,insertHandlers:h,tableOps:m,annotations:x,presentation:y,onEndPresentation:v,findReplace:S}=t,w=e==="master"?i:o,C=e==="master"?d.activeLayout?d.activeMaster?.elements??[]:[]:s,T=useMemo(()=>{let U=d.headerFooter,H;if(o)for(let j of o.elements){let Z=j.placeholderType;if(Z==="title"||Z==="ctrTitle"){let J=j.text;if(J){H=J;break}}}return {slideNumber:o?.slideNumber,dateTimeText:U.dateTimeText,dateFormat:U.dateFormat,footerText:U.footerText,headerText:U.headerText,slideTitle:H,customProperties:d.customProperties.map(j=>({name:j.name,value:j.value}))}},[d.headerFooter,d.customProperties,o]),E=useMemo(()=>{if(!(!d.theme&&!d.tableStyleMap))return {theme:d.theme,tableStyleMap:d.tableStyleMap}},[d.theme,d.tableStyleMap]),M=useCallback((U,H)=>{e==="present"?y.handlePresentationAction(H):H.url&&Xg(H.url);},[e,y]),A=useCallback(U=>{if(pU(U)){if(e==="present"){let H=see(U);if(H){let j={action:H.action,targetSlideIndex:H.targetSlideIndex};y.handlePresentationAction(j);}}return}Xg(U);},[e,y]),R=useRef(false),k=useCallback(()=>{R.current=true,x.setToolbarVisible(true);},[x]),N=useCallback(()=>{R.current=false;},[]),F=e==="preview"||e==="present",B=useCallback(()=>{e==="present"?y.movePresentationSlide(1):d.setActiveSlideIndex(U=>Math.min(r.length-1,U+1));},[e,y,d,r.length]),D=useCallback(()=>{e==="present"?y.movePresentationSlide(-1):d.setActiveSlideIndex(U=>Math.max(0,U-1));},[e,y,d]),O=jle({enabled:F,onNext:B,onPrev:D});return jsxs("main",{"aria-label":"Slide editor",className:"flex-1 min-w-0 relative flex flex-col bg-background",onTouchStart:O.onTouchStart,onTouchEnd:O.onTouchEnd,children:[S.findReplaceOpen&&jsx(XU,{findQuery:S.findQuery,replaceQuery:S.replaceQuery,findMatchCase:S.findMatchCase,findResults:S.findResults,findResultIndex:S.findResultIndex,onSetFindQuery:S.setFindQuery,onSetReplaceQuery:S.setReplaceQuery,onSetFindMatchCase:S.setFindMatchCase,onPerformFind:S.performFind,onNavigateResult:S.navigateFindResult,onReplace:S.handleReplace,onReplaceAll:S.handleReplaceAll,onClose:()=>S.setFindReplaceOpen(false)}),e==="master"&&d.masterViewTab==="notes"?jsx(O6,{notesMaster:d.notesMaster,canvasSize:a,notesCanvasSize:d.notesCanvasSize}):e==="master"&&d.masterViewTab==="handout"?jsx(U6,{handoutMaster:d.handoutMaster,canvasSize:a,slidesPerPage:d.handoutSlidesPerPage}):jsx(CH,{activeSlide:w,templateElements:C,canvasSize:a,zoom:u,mode:e,canEdit:n,editTemplateMode:e==="master"||d.editTemplateMode,selectedElementIdSet:d.selectedElementIdSet,selectedElement:p,inlineEditingElementId:d.inlineEditingElementId,inlineEditingText:d.inlineEditingText,spellCheckEnabled:d.spellCheckEnabled,mediaDataUrls:d.mediaDataUrls,tableEditorState:d.tableEditorState,marqueeSelectionState:d.marqueeSelectionState,snapLines:d.snapLines,showGrid:d.showGrid,gridSpacingPx:c,showRulers:d.showRulers,guides:d.guides,presentationElementStates:e==="present"?y.presentationElementStates:void 0,presentationKeyframesCss:e==="present"?y.presentationKeyframesCss:void 0,onClick:f.handleElementClick,onDoubleClick:f.handleElementDoubleClick,onMouseDown:f.handleElementMouseDown,onContextMenu:f.handleElementContextMenu,onCanvasMouseDown:f.handleCanvasMouseDown,onResizePointerDown:f.handleResizePointerDown,onAdjustmentPointerDown:f.handleAdjustmentPointerDown,onInlineEditChange:d.setInlineEditingText,onInlineEditCommit:f.handleInlineEditCommit,onInlineEditCancel:()=>d.setInlineEditingElementId(null),onTableCellSelect:(U,H)=>d.setTableEditorState(U?{...U,elementId:H}:null),onCommitCellEdit:m.handleCommitCellEdit,onResizeTableColumns:m.handleResizeTableColumns,onResizeTableRow:m.handleResizeTableRow,findResults:S.findResults,findResultIndex:S.findResultIndex,activeSlideIndex:l,activeTool:d.activeTool,drawingColor:d.drawingColor,drawingWidth:d.drawingWidth,isDrawingRef:d.isDrawingRef,onAddInkElement:h.handleAddInkElement,onAddFreeformShape:h.handleAddFreeformShape,onEraseInkElement:h.handleEraseInkElement,onActionClick:M,onHyperlinkClick:A,allSlides:e==="present"?r:void 0,onZoomClick:e==="present"?y.handleZoomClick:void 0,sourceSlideIndex:e==="present"?l:void 0,fieldContext:T,tableStyleContext:E,collaborationOverlay:jsxs(Fragment,{children:[jsx(R6,{elements:w?.elements??[],activeSlideIndex:l}),jsx(A6,{activeSlideIndex:l,canvasWidth:a.width,canvasHeight:a.height,selectedElementId:d.selectedElementId})]}),comments:o?.comments,showCommentMarkers:d.sidebarPanelMode==="comments",onCommentMarkerClick:()=>d.setSidebarPanelMode("comments"),onMoveGuide:(U,H)=>{d.setGuides(j=>j.map(Z=>Z.id===U?{...Z,position:Z.axis==="h"?Math.max(0,Math.min(a.height,H)):Math.max(0,Math.min(a.width,H))}:Z));},onDeleteGuide:U=>{d.setGuides(H=>H.filter(j=>j.id!==U));},onCreateGuideFromRuler:(U,H)=>{d.setGuides(j=>[...j,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:U,position:H}]);}}),e==="present"&&x.presentationTool!=="none"&&jsx(q8,{canvasSize:a,editorScale:u.editorScale,presentationTool:x.presentationTool,annotationStrokes:x.annotationStrokes,currentStroke:x.currentStroke,laserPosition:x.laserPosition,onPointerDown:x.handlePointerDown,onPointerMove:x.handlePointerMove,onPointerUp:x.handlePointerUp,onLaserMove:x.handleLaserMove,onLaserLeave:x.handleLaserLeave,onEraseAtPoint:x.eraseAtPoint}),e==="present"&&jsx(nH,{visible:!!d.presentationProperties.showSubtitles}),e==="present"&&jsx(eH,{currentSlideIndex:y.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:y.movePresentationSlide,onEndPresentation:v??(()=>{})}),e==="present"&&jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 z-[80] transition-opacity duration-300",style:{opacity:x.toolbarVisible?1:0,pointerEvents:x.toolbarVisible?"auto":"none"},onMouseEnter:k,onMouseLeave:N,children:jsx(J8,{presentationTool:x.presentationTool,penColor:x.penColor,highlighterColor:x.highlighterColor,hasAnnotations:x.annotationStrokes.length>0,onSetTool:x.setPresentationTool,onSetPenColor:x.setPenColor,onSetHighlighterColor:x.setHighlighterColor,onClearAnnotations:x.clearAnnotations,currentSlideIndex:y.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:y.movePresentationSlide,presentationStartTime:y.presentationStartTime,onEndPresentation:v??(()=>{}),onTogglePresenterView:y.togglePresenterView,presenterMode:y.presenterMode})})]})}var qh="rounded bg-muted/50 p-2.5 space-y-2",Kh="text-[11px] font-medium uppercase tracking-wide text-muted-foreground mb-1.5",xM="w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:border-primary focus:outline-none",Yle="rounded bg-primary px-3 py-1.5 text-xs font-medium text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",qle="rounded bg-accent px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent/80 disabled:opacity-40 disabled:cursor-not-allowed transition-colors";var MN=[{name:"Office",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"},majorFont:"Calibri Light",minorFont:"Calibri"},{name:"Facet",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2C3C43",lt2:"#CFD7D9",accent1:"#90C226",accent2:"#54A021",accent3:"#E6B91E",accent4:"#E76618",accent5:"#C42F1A",accent6:"#918655",hlink:"#99CA3C",folHlink:"#B9D181"},majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"},{name:"Integral",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#335B74",lt2:"#DFE3E5",accent1:"#1CADE4",accent2:"#2683C6",accent3:"#27CED7",accent4:"#42BA97",accent5:"#3E8853",accent6:"#62A39F",hlink:"#6BA5D1",folHlink:"#9DCCE0"},majorFont:"Tw Cen MT Condensed",minorFont:"Tw Cen MT"},{name:"Ion",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#262626",lt2:"#E1E1E1",accent1:"#B01513",accent2:"#EA6312",accent3:"#E6B729",accent4:"#6AAC90",accent5:"#5F9C9D",accent6:"#9B6BF2",hlink:"#F09415",folHlink:"#D14D0F"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Retrospect",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#637052",lt2:"#CCDDEA",accent1:"#E48312",accent2:"#BD582C",accent3:"#865640",accent4:"#9B8357",accent5:"#C2BC80",accent6:"#94A088",hlink:"#3A7CCB",folHlink:"#8C8C8C"},majorFont:"Calibri Light",minorFont:"Calibri"},{name:"Organic",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#283138",lt2:"#E3DED1",accent1:"#83992A",accent2:"#3C9770",accent3:"#44709D",accent4:"#A23C33",accent5:"#D97828",accent6:"#DEB340",hlink:"#A8B97F",folHlink:"#89C2A3"},majorFont:"Garamond",minorFont:"Garamond"},{name:"Wisp",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#46393B",lt2:"#E8DCD8",accent1:"#A53010",accent2:"#DE7E18",accent3:"#9F8351",accent4:"#728653",accent5:"#92AA4C",accent6:"#6AAC91",hlink:"#FB4F14",folHlink:"#E25839"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Berlin",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3E5C61",lt2:"#D5E0D0",accent1:"#F09415",accent2:"#C1B56B",accent3:"#89C2A3",accent4:"#729BBE",accent5:"#9A90C2",accent6:"#BE8DBE",hlink:"#25A0DA",folHlink:"#FF7F00"},majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"},{name:"Slice",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2E3B4C",lt2:"#C7CDD3",accent1:"#E2751D",accent2:"#C53B23",accent3:"#A13D69",accent4:"#58599E",accent5:"#36749D",accent6:"#4EA39A",hlink:"#FD6B32",folHlink:"#D14D0F"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Dividend",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3D3D3D",lt2:"#E1E1E1",accent1:"#4D1434",accent2:"#903163",accent3:"#B2324B",accent4:"#D34817",accent5:"#E8971C",accent6:"#FDCB00",hlink:"#A03068",folHlink:"#C34882"},majorFont:"Gill Sans MT",minorFont:"Gill Sans MT"}],Y0=["Arial","Calibri","Calibri Light","Cambria","Century Gothic","Comic Sans MS","Consolas","Garamond","Georgia","Gill Sans MT","Impact","Lucida Console","Palatino Linotype","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Tw Cen MT","Verdana"];function Kle({editColors:t,canEdit:e,activePickerKey:n,majorFont:r,minorFont:o,onSetActivePickerKey:i,onColorChange:s,onMajorFontChange:a,onMinorFontChange:l}){let{t:c}=useTranslation(),u=useMemo(()=>oY(t),[t]),d=useCallback(p=>{n&&/^#[0-9a-fA-F]{6}$/.test(p)&&s(n,p);},[n,s]);return jsxs(Fragment,{children:[jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.colorScheme")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Mf.map(p=>jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("button",{type:"button",disabled:!e,className:`h-6 w-full rounded-sm border transition-colors ${n===p?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground"} disabled:opacity-40 disabled:cursor-not-allowed`,style:{backgroundColor:t[p]},title:`${L1[p]}: ${t[p]}`,onClick:()=>i(n===p?null:p)}),jsx("span",{className:"text-[9px] text-muted-foreground truncate w-full text-center",children:L1[p]})]},p))}),n&&jsxs("div",{className:"mt-2 flex items-center gap-2 rounded bg-background p-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground min-w-[60px]",children:L1[n]}),jsx("input",{type:"color",disabled:!e,className:"h-6 w-8 cursor-pointer rounded border-0 bg-transparent p-0",value:t[n],onChange:p=>s(n,p.target.value)}),jsx("input",{type:"text",disabled:!e,className:"flex-1 rounded border border-border bg-muted px-1.5 py-0.5 text-[10px] text-foreground font-mono",value:t[n],onChange:p=>d(p.target.value)})]})]}),u&&jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.preview")}),jsx("div",{className:"flex flex-col gap-px",children:u.map((p,f)=>jsx("div",{className:"grid grid-cols-12 gap-px",children:p.map(h=>jsx("div",{className:"h-3.5 rounded-sm",style:{backgroundColor:h.hex},title:`${h.colLabel} -- ${h.rowLabel} (${h.hex})`},`${h.schemeKey}-${f}`))},f))})]}),jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.fonts")}),jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:c("pptx.themeEditor.headingFont")}),jsxs("select",{className:xM,disabled:!e,value:Y0.includes(r)?r:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&a(p.target.value);},children:[Y0.map(p=>jsx("option",{value:p,children:p},p)),!Y0.includes(r)&&jsx("option",{value:"__custom__",children:r})]})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:c("pptx.themeEditor.bodyFont")}),jsxs("select",{className:xM,disabled:!e,value:Y0.includes(o)?o:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&l(p.target.value);},children:[Y0.map(p=>jsx("option",{value:p,children:p},p)),!Y0.includes(o)&&jsx("option",{value:"__custom__",children:o})]})]}),jsxs("div",{className:"flex items-center gap-2 pt-1 text-[10px] text-muted-foreground",children:[jsx("span",{style:{fontFamily:r},className:"text-foreground",children:c("pptx.themeEditor.headingSample")}),jsx("span",{className:"text-muted-foreground",children:"|"}),jsx("span",{style:{fontFamily:o},className:"text-foreground",children:c("pptx.themeEditor.bodySample")})]})]})]})]})}var lKe=["accent1","accent2","accent3","accent4","accent5","accent6"];function Jle({canEdit:t,currentThemeName:e,onSelectPreset:n}){let{t:r}=useTranslation();return jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:r("pptx.themeEditor.presetThemes")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:MN.map(o=>jsxs("button",{type:"button",disabled:!t,className:`flex flex-col items-start gap-1 rounded border p-1.5 text-left transition-colors ${e===o.name?"border-primary bg-primary/10":"border-border hover:border-muted-foreground hover:bg-muted"} disabled:opacity-40 disabled:cursor-not-allowed`,onClick:()=>n(o),title:o.name,children:[jsx("div",{className:"flex gap-px w-full",children:lKe.map(i=>jsx("div",{className:"h-3 flex-1 first:rounded-l-sm last:rounded-r-sm",style:{backgroundColor:o.colorScheme[i]}},i))}),jsx("span",{className:"text-[10px] text-muted-foreground truncate w-full",children:o.name})]},o.name))})]})}function Qle({theme:t,canEdit:e,onUpdateColorScheme:n,onUpdateFontScheme:r,onUpdateThemeName:o,onApplyToPresentation:i,onClose:s}){let{t:a}=useTranslation(),[l,c]=useState(()=>t?.colorScheme??MN[0].colorScheme),[u,d]=useState(()=>t?.fontScheme?.majorFont?.latin??"Calibri Light"),[p,f]=useState(()=>t?.fontScheme?.minorFont?.latin??"Calibri"),[h,m]=useState(()=>t?.name??"Custom Theme"),[x,y]=useState(null),v=useCallback((M,A)=>{let R={...l,[M]:A};c(R),n(R);},[l,n]),S=useCallback(M=>{c(M.colorScheme),d(M.majorFont),f(M.minorFont),m(M.name),n(M.colorScheme),r({majorFont:{latin:M.majorFont},minorFont:{latin:M.minorFont}}),o(M.name);},[n,r,o]),w=useCallback(()=>{t?.colorScheme&&(c(t.colorScheme),d(t.fontScheme?.majorFont?.latin??"Calibri Light"),f(t.fontScheme?.minorFont?.latin??"Calibri"),m(t.name??"Custom Theme"),n(t.colorScheme),r({majorFont:{latin:t.fontScheme?.majorFont?.latin??"Calibri Light"},minorFont:{latin:t.fontScheme?.minorFont?.latin??"Calibri"}}),o(t.name??"Custom Theme"));},[t,n,r,o]),C=useCallback(M=>{d(M),r({majorFont:{latin:M},minorFont:{latin:p}});},[p,r]),T=useCallback(M=>{f(M),r({majorFont:{latin:u},minorFont:{latin:M}});},[u,r]),E=useCallback(M=>{m(M),o(M);},[o]);return jsxs("div",{className:"flex flex-col gap-2 overflow-y-auto max-h-[calc(100vh-120px)]",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{className:"text-sm font-semibold text-foreground",children:a("pptx.themeEditor.title")}),jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",title:a("pptx.themeEditor.close"),children:jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:a("pptx.themeEditor.themeName")}),jsx("input",{type:"text",className:xM,disabled:!e,value:h,onChange:M=>E(M.target.value),placeholder:a("pptx.themeEditor.themeNamePlaceholder")})]}),jsx(Jle,{canEdit:e,currentThemeName:h,onSelectPreset:S}),jsx(Kle,{editColors:l,canEdit:e,activePickerKey:x,majorFont:u,minorFont:p,onSetActivePickerKey:y,onColorChange:v,onMajorFontChange:C,onMinorFontChange:T}),jsxs("div",{className:"flex gap-1.5 pt-1",children:[jsx("button",{type:"button",disabled:!e,className:Yle,onClick:i,children:a("pptx.themeEditor.applyToPresentation")}),jsx("button",{type:"button",disabled:!e,className:qle,onClick:w,children:a("pptx.themeEditor.reset")})]})]})}var $H=[{id:"office",name:"Office",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"},fontScheme:{majorFont:"Calibri Light",minorFont:"Calibri"}},{id:"facet",name:"Facet",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2C3C43",lt2:"#CFD7D9",accent1:"#90C226",accent2:"#54A021",accent3:"#E6B91E",accent4:"#E76618",accent5:"#C42F1A",accent6:"#918655",hlink:"#99CA3C",folHlink:"#B9D181"},fontScheme:{majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"}},{id:"integral",name:"Integral",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#335B74",lt2:"#DFE3E5",accent1:"#1CADE4",accent2:"#2683C6",accent3:"#27CED7",accent4:"#42BA97",accent5:"#3E8853",accent6:"#62A39F",hlink:"#6BA5D1",folHlink:"#9DCCE0"},fontScheme:{majorFont:"Tw Cen MT Condensed",minorFont:"Tw Cen MT"}},{id:"ion",name:"Ion",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#262626",lt2:"#E1E1E1",accent1:"#B01513",accent2:"#EA6312",accent3:"#E6B729",accent4:"#6AAC90",accent5:"#5F9C9D",accent6:"#9B6BF2",hlink:"#F09415",folHlink:"#D14D0F"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"retrospect",name:"Retrospect",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#637052",lt2:"#CCDDEA",accent1:"#E48312",accent2:"#BD582C",accent3:"#865640",accent4:"#9B8357",accent5:"#C2BC80",accent6:"#94A088",hlink:"#3A7CCB",folHlink:"#8C8C8C"},fontScheme:{majorFont:"Calibri Light",minorFont:"Calibri"}},{id:"organic",name:"Organic",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#283138",lt2:"#E3DED1",accent1:"#83992A",accent2:"#3C9770",accent3:"#44709D",accent4:"#A23C33",accent5:"#D97828",accent6:"#DEB340",hlink:"#A8B97F",folHlink:"#89C2A3"},fontScheme:{majorFont:"Garamond",minorFont:"Garamond"}},{id:"wisp",name:"Wisp",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#46393B",lt2:"#E8DCD8",accent1:"#A53010",accent2:"#DE7E18",accent3:"#9F8351",accent4:"#728653",accent5:"#92AA4C",accent6:"#6AAC91",hlink:"#FB4F14",folHlink:"#E25839"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"berlin",name:"Berlin",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3E5C61",lt2:"#D5E0D0",accent1:"#F09415",accent2:"#C1B56B",accent3:"#89C2A3",accent4:"#729BBE",accent5:"#9A90C2",accent6:"#BE8DBE",hlink:"#25A0DA",folHlink:"#FF7F00"},fontScheme:{majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"}},{id:"slice",name:"Slice",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2E3B4C",lt2:"#C7CDD3",accent1:"#E2751D",accent2:"#C53B23",accent3:"#A13D69",accent4:"#58599E",accent5:"#36749D",accent6:"#4EA39A",hlink:"#FD6B32",folHlink:"#D14D0F"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"dividend",name:"Dividend",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3D3D3D",lt2:"#E1E1E1",accent1:"#4D1434",accent2:"#903163",accent3:"#B2324B",accent4:"#D34817",accent5:"#E8971C",accent6:"#FDCB00",hlink:"#A03068",folHlink:"#C34882"},fontScheme:{majorFont:"Gill Sans MT",minorFont:"Gill Sans MT"}}];function HH({theme:t,selected:e,onClick:n}){let{colorScheme:r}=t;return jsxs("button",{type:"button",onClick:n,className:le("group relative flex flex-col rounded-lg border-2 transition-all overflow-hidden",e?"border-primary shadow-lg scale-[1.02]":"border-border hover:border-primary/50 hover:shadow-md"),title:t.name,children:[jsxs("div",{className:"h-24 flex flex-col",children:[jsxs("div",{className:"h-10 flex",children:[jsx("div",{className:"flex-1",style:{backgroundColor:r.accent1}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.accent2}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.accent3}})]}),jsxs("div",{className:"flex-1 flex",children:[jsx("div",{className:"w-1/3",style:{backgroundColor:r.dk2}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.lt2}})]})]}),jsx("div",{className:"bg-background border-t border-border px-2 py-1.5",children:jsx("p",{className:"text-xs font-medium text-foreground text-center",children:t.name})}),e&&jsx("div",{className:"absolute top-1 right-1 bg-primary text-white rounded-full p-1",children:jsx(LuCheck,{className:"w-3 h-3"})})]})}function tce({open:t,currentTheme:e,canEdit:n,onClose:r,onApplyTheme:o,onImportTheme:i}){let{t:s}=useTranslation(),[a,l]=useState(e??null),c=useRef(null);if(!t)return null;let u=()=>{a&&(o(a),r());},d=()=>{c.current?.click();},p=f=>{let h=f.target.files?.[0];h&&i&&i(h),f.target.value="";};return jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-[100] bg-black/60 backdrop-blur-sm",onClick:r,"aria-label":s("common.close")}),jsx("div",{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:jsxs("div",{className:"bg-background border border-border rounded-xl shadow-2xl max-w-5xl w-full max-h-[90vh] flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[jsxs("div",{children:[jsx("h2",{className:"text-lg font-semibold text-foreground",children:s("powerpoint.toolbar.themes.gallery.title")}),jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s("powerpoint.toolbar.themes.gallery.description")})]}),jsx("button",{type:"button",onClick:r,className:"p-2 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex-1 overflow-auto p-6",children:jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:$H.map(f=>jsx(HH,{theme:f,selected:a?.id===f.id,onClick:()=>l(f)},f.id))})}),jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-border",children:[jsx("div",{className:"flex items-center gap-2",children:i&&jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:d,disabled:!n,className:"inline-flex items-center gap-2 px-3 py-1.5 rounded bg-accent hover:bg-accent/80 text-xs font-medium text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[jsx(LuUpload,{className:"w-3.5 h-3.5"}),s("powerpoint.toolbar.themes.gallery.importTheme")]}),jsx("input",{ref:c,type:"file",accept:".thmx,.pptx",className:"hidden",onChange:p})]})}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded bg-accent hover:bg-accent/80 text-xs font-medium text-foreground transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:u,disabled:!n||!a,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-xs font-medium text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("common.apply")})]})]})]})})]})}function zH(t){let{mode:e,canEdit:n,activeSlide:r,masterPseudoSlide:o,slides:i,canvasSize:s,activeSlideIndex:a,selectedElement:l,state:c,comments:u,ops:d,manipulation:p,propertyHandlers:f,themeHandlers:h,history:m,panelWidth:x,onResizeRight:y}=t,v=e==="master"?o:r;return jsxs(Fragment,{children:[(e==="edit"||e==="master")&&c.isInspectorPaneOpen&&y&&jsx(Cp,{direction:"horizontal",onResize:y}),jsx(AH,{isOpen:(e==="edit"||e==="master")&&c.isInspectorPaneOpen,canEdit:n,mode:e,activeSlide:v,slides:i,canvasSize:s,selectedElement:l,effectiveSelectedIds:c.effectiveSelectedIds,tableEditorState:c.tableEditorState,sidebarPanelMode:c.sidebarPanelMode,activeSlideIndex:a,comments:u,onSetSidebarPanelMode:c.setSidebarPanelMode,onClose:()=>c.setIsInspectorPaneOpen(false),onUpdateElementStyle:d.updateSelectedShapeStyle,onUpdateTextStyle:d.updateSelectedTextStyle,onUpdateElement:d.updateSelectedElement,onApplySelection:d.applySelection,onSetCanvasSize:c.setCanvasSize,onMoveLayer:p.handleMoveLayer,onMoveLayerToEdge:p.handleMoveLayerToEdge,onDeleteElement:p.handleDelete,onUpdateSlide:f.handleUpdateSlide,presentationProperties:c.presentationProperties,onUpdatePresentationProperties:f.handleUpdatePresentationProperties,editTemplateMode:c.editTemplateMode,slideMasters:c.slideMasters,themeOptions:c.themeOptions,notesMaster:c.notesMaster,handoutMaster:c.handoutMaster,notesCanvasSize:c.notesCanvasSize,coreProperties:c.coreProperties,appProperties:c.appProperties,customProperties:c.customProperties,tagCollections:c.tagCollections,onUpdateTagCollections:c.setTagCollections,onUpdateCoreProperties:f.handleUpdateCoreProperties,onUpdateAppProperties:f.handleUpdateAppProperties,onUpdateCustomProperties:f.handleUpdateCustomProperties,onApplyTheme:h.handleApplyTheme,onSetTemplateBackground:h.handleSetTemplateBackground,onGetTemplateBackgroundColor:h.handleGetTemplateBackgroundColor,mediaDataUrls:c.mediaDataUrls,theme:c.theme,panelWidth:x}),c.isSelectionPaneOpen&&(e==="edit"||e==="master")&&jsx("div",{className:"absolute right-0 top-0 z-30 h-full max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:h-auto max-md:max-h-[50vh]",children:jsx(y8,{slides:i,activeSlideIndex:a,selectedElementId:c.selectedElementId,selectedElementIds:c.selectedElementIds,canEdit:n,setSelectedElementId:c.setSelectedElementId,setSelectedElementIds:c.setSelectedElementIds,setSlides:c.setSlides,markDirty:m.markDirty,onClose:()=>c.setIsSelectionPaneOpen(false)})}),c.isThemeEditorOpen&&e==="edit"&&jsx("div",{className:"absolute right-0 top-0 z-30 h-full w-72 overflow-y-auto border-l border-border bg-card p-2.5 shadow-xl max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:h-auto max-md:max-h-[60vh] max-md:rounded-t-xl max-md:border-t max-md:border-l-0",children:jsx(Qle,{theme:c.theme,canEdit:n,onUpdateColorScheme:h.handleUpdateThemeColorScheme,onUpdateFontScheme:h.handleUpdateThemeFontScheme,onUpdateThemeName:h.handleUpdateThemeName,onApplyToPresentation:h.handleApplyThemeToPresentation,onClose:()=>c.setIsThemeEditorOpen(false)})}),jsx(tce,{open:c.isThemeGalleryOpen,currentTheme:null,canEdit:n,onClose:()=>c.setIsThemeGalleryOpen(false),onApplyTheme:S=>{h.handleApplyThemeData(S.colorScheme,{majorFont:{latin:S.fontScheme.majorFont,eastAsia:S.fontScheme.majorFont,complexScript:S.fontScheme.majorFont},minorFont:{latin:S.fontScheme.minorFont,eastAsia:S.fontScheme.minorFont,complexScript:S.fontScheme.minorFont}},S.name);}})]})}function GH(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,activeSlideIndex:s,canvasSize:a,gridSpacingPx:l,slideSectionGroups:c,showSlidesPane:u,showMasterPane:d,selectedElement:p,state:f,editorOps:h,dialogs:m,presentation:x,annotations:y,propertyHandlers:v,themeHandlers:S,history:w,comments:C,zoom:T,isMobile:E=false,isTouchDevice:M=false,onEndPresentation:A,leftPanelWidth:R,onResizeLeft:k,rightPanelWidth:N,onResizeRight:F}=t,{ops:B,sectionOps:D,canvasHandlers:O,insertHandlers:U,manipulation:H,slideOps:j,tableOps:Z,findReplace:J}=h;return jsxs("div",{className:"relative z-10 flex flex-1 min-h-0",children:[u&&jsxs(Fragment,{children:[jsx(F2,{slides:r,activeSlideIndex:s,canvasSize:a,sectionGroups:c,isOpen:f.isSlidesPaneOpen,canEdit:n,onSelectSlide:f.setActiveSlideIndex,onSlideContextMenu:j.handleSlideContextMenu,onMoveSlide:j.handleMoveSlide,onAddSlide:j.handleAddSlide,onCollapse:()=>f.setIsSlidesPaneOpen(false),onAddSection:D.addSection,onRenameSection:D.renameSection,onDeleteSection:D.deleteSection,onMoveSectionUp:D.moveSectionUp,onMoveSectionDown:D.moveSectionDown,rehearsalTimings:Object.keys(x.recordedTimings).length>0?x.recordedTimings:void 0,panelWidth:R}),k&&jsx(Cp,{direction:"horizontal",onResize:k})]}),d&&jsx(B6,{slideMasters:f.slideMasters,activeMasterIndex:f.activeMasterIndex,activeLayoutIndex:f.activeLayoutIndex,canvasSize:a,masterViewTab:f.masterViewTab,notesMaster:f.notesMaster,handoutMaster:f.handoutMaster,handoutSlidesPerPage:f.handoutSlidesPerPage,onSelectMaster:m.handleSelectMaster,onSelectLayout:m.handleSelectLayout,onCollapse:()=>f.setIsSlidesPaneOpen(false),onTabChange:f.setMasterViewTab,onHandoutSlidesPerPageChange:f.setHandoutSlidesPerPage}),jsx(UH,{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:f.templateElements,canvasSize:a,activeSlideIndex:s,gridSpacingPx:l,zoom:T,state:f,selectedElement:p,canvasHandlers:O,insertHandlers:U,tableOps:Z,annotations:y,presentation:x,onEndPresentation:A,findReplace:J}),f.contextMenuState&&jsx(CU,{contextMenuState:f.contextMenuState,mode:e,selectedElement:p,tableEditorState:f.tableEditorState,hasMultiSelection:f.effectiveSelectedIds.length>1,onAction:H.handleContextMenuAction,onInsertTableRow:Z.handleInsertTableRow,onDeleteTableRow:Z.handleDeleteTableRow,onInsertTableColumn:Z.handleInsertTableColumn,onDeleteTableColumn:Z.handleDeleteTableColumn,onMergeCellRight:Z.handleMergeCellRight,onMergeCellDown:Z.handleMergeCellDown,onMergeSelectedCells:Z.handleMergeSelectedCells,onSplitCell:Z.handleSplitCell,onClose:()=>f.setContextMenuState(null)}),jsx(zH,{mode:e,canEdit:n,activeSlide:o,masterPseudoSlide:i,slides:r,canvasSize:a,activeSlideIndex:s,selectedElement:p,state:f,comments:C,ops:B,manipulation:H,propertyHandlers:v,themeHandlers:S,history:w,panelWidth:N,onResizeRight:F})]})}function rce({onOpenSlides:t,onOpenInsert:e,onOpenInspector:n,onOpenComments:r,onToggleNotes:o,activeSheet:i,commentCount:s}){return jsx("nav",{"aria-label":"Editor actions",className:"md:hidden flex items-stretch justify-around border-t border-border bg-secondary/80 backdrop-blur supports-[backdrop-filter]:bg-secondary/60 pb-[max(env(safe-area-inset-bottom),0px)]",children:[{key:"slides",label:"Slides",icon:LuLayers,onClick:t},{key:"insert",label:"Insert",icon:LuPlus,onClick:e},{key:"inspector",label:"Format",icon:LuSettings2,onClick:n},{key:"comments",label:"Comments",icon:LuMessageSquare,onClick:r,badge:s},{key:"notes",label:"Notes",icon:LuStickyNote,onClick:o}].map(({key:l,label:c,icon:u,onClick:d,badge:p})=>{let f=i===l;return jsxs("button",{type:"button",onClick:d,className:le("relative flex flex-col items-center justify-center gap-0.5 flex-1 min-h-[56px] py-1.5 text-[10px] font-medium transition-colors active:scale-95",f?"text-primary":"text-muted-foreground hover:text-foreground"),"aria-pressed":f,children:[jsx(u,{className:"w-5 h-5"}),jsx("span",{children:c}),p!==void 0&&p>0&&jsx("span",{className:"absolute top-1 right-1/4 flex items-center justify-center min-w-[16px] h-4 px-1 rounded-full bg-primary text-[9px] font-semibold text-white",children:p>99?"99+":p}),f&&jsx("span",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-8 h-0.5 rounded-full bg-primary"})]},l)})})}function oce({open:t,onClose:e,...n}){return jsx(VI,{open:t,onClose:e,heightFraction:.7,title:"Slides",children:jsx("div",{className:"h-full",children:jsx(F2,{...n})})})}function sce(t){let{state:e,editorOps:n,presentation:r,slides:o,activeSlideIndex:i,canvasSize:s,slideSectionGroups:a,canEdit:l,commentCount:c}=t,u=e.isSlidesPaneOpen?"slides":e.isInspectorPaneOpen?e.sidebarPanelMode==="comments"?"comments":"inspector":e.isSlideNotesCollapsed?null:"notes",d=()=>{e.setIsSlidesPaneOpen(false),e.setIsInspectorPaneOpen(false),e.setIsSlideNotesCollapsed(true);},p=f=>{switch(d(),f){case "slides":e.setIsSlidesPaneOpen(true);break;case "inspector":e.setSidebarPanelMode("properties"),e.setIsInspectorPaneOpen(true);break;case "comments":e.setSidebarPanelMode("comments"),e.setIsInspectorPaneOpen(true);break;case "notes":e.setIsSlideNotesCollapsed(false);break}};return jsxs(Fragment,{children:[jsx(oce,{open:e.isSlidesPaneOpen,onClose:()=>e.setIsSlidesPaneOpen(false),slides:o,activeSlideIndex:i,canvasSize:s,sectionGroups:a,isOpen:true,canEdit:l,onSelectSlide:f=>{e.setActiveSlideIndex(f),e.setIsSlidesPaneOpen(false);},onSlideContextMenu:n.slideOps.handleSlideContextMenu,onMoveSlide:n.slideOps.handleMoveSlide,onAddSlide:n.slideOps.handleAddSlide,onCollapse:()=>e.setIsSlidesPaneOpen(false),onAddSection:n.sectionOps.addSection,onRenameSection:n.sectionOps.renameSection,onDeleteSection:n.sectionOps.deleteSection,onMoveSectionUp:n.sectionOps.moveSectionUp,onMoveSectionDown:n.sectionOps.moveSectionDown,rehearsalTimings:Object.keys(r.recordedTimings).length>0?r.recordedTimings:void 0}),jsx(rce,{activeSheet:u,commentCount:c,onOpenSlides:()=>e.isSlidesPaneOpen?e.setIsSlidesPaneOpen(false):p("slides"),onOpenInsert:()=>{n.insertHandlers.handleAddTextBox();},onOpenInspector:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode!=="comments"?e.setIsInspectorPaneOpen(false):p("inspector"),onOpenComments:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode==="comments"?e.setIsInspectorPaneOpen(false):p("comments"),onToggleNotes:()=>e.isSlideNotesCollapsed?p("notes"):e.setIsSlideNotesCollapsed(true)})]})}function nS({label:t,enabled:e,onToggle:n}){return jsxs("div",{className:"flex items-center justify-between py-2.5 px-3",children:[jsx("span",{className:"text-sm text-foreground",children:t}),jsx("button",{type:"button",onClick:n,className:le("relative inline-flex h-5 w-9 items-center rounded-full transition-colors",e?"bg-primary":"bg-muted-foreground/30"),role:"switch","aria-checked":e,"aria-label":t,children:jsx("span",{className:le("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})]})}function lce({isOpen:t,onClose:e,spellCheckEnabled:n=false,onSetSpellCheckEnabled:r,showGrid:o=false,onSetShowGrid:i,showRulers:s=false,onSetShowRulers:a,snapToGrid:l=false,onSetSnapToGrid:c,reducedMotion:u=false,onToggleReducedMotion:d}){let[p,f]=useState("general"),[h,m]=useState(true),{t:x}=useTranslation(),y=useCallback(S=>{S.key==="Escape"&&e();},[e]);if(useEffect(()=>{if(t)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t,y]),!t)return null;let v=[{id:"general",label:x("pptx.settings.general")},{id:"shortcuts",label:x("pptx.settings.keyboardShortcuts")}];return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":x("pptx.settings.closeSettings"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[min(32rem,calc(100%-2rem))] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuSettings,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:x("pptx.settings.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":x("pptx.settings.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"flex border-b border-border/60 px-5",children:v.map(S=>jsxs("button",{type:"button",onClick:()=>f(S.id),className:le("px-3 py-2 text-xs font-medium transition-colors relative",p===S.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[S.label,p===S.id&&jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full"})]},S.id))}),jsxs("div",{className:"px-5 py-4 max-h-[60vh] overflow-y-auto",children:[p==="general"&&jsxs("div",{className:"space-y-0.5",children:[jsx(nS,{label:x("pptx.settings.autoSave"),enabled:h,onToggle:()=>m(!h)}),jsx(nS,{label:x("pptx.settings.spellCheck"),enabled:n,onToggle:()=>r?.(!n)}),jsx(nS,{label:x("pptx.settings.showGrid"),enabled:o,onToggle:()=>i?.(!o)}),jsx(nS,{label:x("pptx.settings.showRulers"),enabled:s,onToggle:()=>a?.(!s)}),jsx(nS,{label:x("pptx.settings.snapToGrid"),enabled:l,onToggle:()=>c?.(!l)}),jsx(nS,{label:x("pptx.settings.reducedMotion"),enabled:u,onToggle:()=>d?.()})]}),p==="shortcuts"&&jsx("div",{className:"space-y-0.5",children:mE.map((S,w)=>jsxs("div",{className:le("flex items-center justify-between gap-3 rounded px-3 py-2",w%2===0?"bg-muted/60":""),children:[jsx("span",{className:"text-xs text-foreground",children:S.action}),jsx("span",{className:"font-mono text-[11px] text-muted-foreground whitespace-nowrap",children:S.shortcut})]},S.action))})]})]})})]})}function XH({doc:t,slides:e,setSlides:n,isConnected:r}){let o=useRef(false),i=useRef(""),s=useRef(false),a=useCallback(()=>t?t.getMap("slides-data"):null,[t]);useEffect(()=>{if(!r||!t||o.current||e.length===0)return;let l=a();if(!l)return;let c=JSON.stringify(e);c!==i.current&&(i.current=c,t.transact(()=>{let u=l.get("count");if(typeof u=="number"&&u>e.length)for(let d=e.length;d<u;d++)l.delete(`slide-${d}`);l.set("count",e.length);for(let d=0;d<e.length;d++){let p=JSON.stringify(e[d]);l.get(`slide-${d}`)!==p&&l.set(`slide-${d}`,p);}}));},[t,e,r,a]),useEffect(()=>{if(!r||!t)return;let l=a();if(!l)return;let c=()=>{let u=l.get("count");if(typeof u!="number"||u===0)return;let d=[];for(let f=0;f<u;f++){let h=l.get(`slide-${f}`);if(typeof h=="string")try{d.push(JSON.parse(h));}catch{}}if(d.length===0)return;let p=JSON.stringify(d);p!==i.current&&(i.current=p,o.current=true,n(d),requestAnimationFrame(()=>{o.current=false;}));};if(l.observe(c),!s.current){s.current=true;let u=l.get("count");typeof u=="number"&&u>0&&c();}return ()=>{l.unobserve(c);}},[t,r,a,n]);}function WH({collab:t,activeSlideIndex:e,setActiveSlideIndex:n,slideCount:r}){let o=useRef(-1);useEffect(()=>{if(!t||t.config.role!=="viewer")return;let i=t.remoteUsers.find(a=>a.role==="broadcaster");if(!i)return;let s=i.activeSlideIndex;s<0||s>=r||s!==o.current&&(o.current=s,s!==e&&n(s));},[t,e,n,r]);}function FKe(t){if(t){let e=Math.round(t.cx/9525);if(e>0)return e}return 8}function BKe(t,e,n){if(e){let r=n.find(o=>o.id===e);if(r){let o=new Map;return t.forEach((i,s)=>o.set(i.rId,s)),r.slideRIds.map(i=>o.get(i)).filter(i=>i!==void 0)}}return t.map((r,o)=>o).filter(r=>!t[r]?.hidden)}function OKe(t,e){if(t.length===0)return [];if(e.length>0){let n=new Map,r=[];for(let i=0;i<t.length;i++){let s=t[i].sectionId;if(s){let a=n.get(s);a?a.push(i):n.set(s,[i]);}else r.push(i);}let o=e.map(i=>({id:i.id,label:i.name,slideIndexes:n.get(i.id)??[],color:i.color,defaultCollapsed:i.collapsed})).filter(i=>i.slideIndexes.length>0);return r.length>0&&o.push({id:DW,label:"Ungrouped Slides",slideIndexes:r}),o.length>0?o:[{id:"default",label:"Slides",slideIndexes:t.map((i,s)=>s)}]}return [{id:"default",label:"Slides",slideIndexes:t.map((n,r)=>r)}]}function UKe(t,e,n){if(t==="master"){if(e)return {id:e.path,rId:"",slideNumber:0,elements:e.elements??[],backgroundColor:e.backgroundColor??n?.backgroundColor,backgroundImage:e.backgroundImage??n?.backgroundImage};if(n)return {id:n.path,rId:"",slideNumber:0,elements:n.elements??[],backgroundColor:n.backgroundColor,backgroundImage:n.backgroundImage}}}function uce(t){let{slides:e,sections:n,customShows:r,activeCustomShowId:o,mode:i,activeLayout:s,activeMaster:a,presentationGridSpacing:l}=t,c=useMemo(()=>FKe(l),[l]),u=useMemo(()=>BKe(e,o,r),[e,o,r]),d=useMemo(()=>OKe(e,n),[e,n]),p=useMemo(()=>UKe(i,s,a),[i,s,a]);return {gridSpacingPx:c,visibleSlideIndexes:u,slideSectionGroups:d,masterPseudoSlide:p}}var $Ke=120;function pce(t){let{slides:e,canvasSize:n,activeSlideIndex:r,templateElementsBySlideId:o,loading:i,error:s,hasActivePointerInteraction:a,pointerCommitNonce:l,setSlides:c,setCanvasSize:u,setActiveSlideIndex:d,setTemplateElementsBySlideId:p,setSelectedElementId:f,setSelectedElementIds:h}=t,m=useRef([]),x=useRef([]),y=useRef(null),v=useRef(""),S=useRef(""),w=useRef(false),C=useRef(null),[T,E]=useState(false),[M,A]=useState(false),[R,k]=useState(void 0),[N,F]=useState(void 0),[B,D]=useState(false),O=useCallback(()=>{E(m.current.length>0),A(x.current.length>0);let se=m.current[m.current.length-1];k(se?.actionLabel);let Ce=x.current[x.current.length-1];F(Ce?.actionLabel);},[]),U=useCallback(se=>({width:n.width,height:n.height,activeSlideIndex:r,slides:e.map(fE),templateElementsBySlideId:hE(o),...se?{actionLabel:se}:{}}),[r,n,e,o]),H=useCallback(se=>{let Ce=Math.max(se.slides.length-1,0);u({width:se.width,height:se.height}),c(se.slides.map(fE)),p(hE(se.templateElementsBySlideId)),d(Math.min(se.activeSlideIndex,Ce)),h([]),f(null);},[d,u,f,h,c,p]),j=useCallback(()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{w.current=false;},0);},[]),Z=useCallback(()=>{D(se=>se||true);},[]),J=useCallback(()=>{let se=m.current.pop();if(!se)return;let Ce=U();x.current.push(Ce),w.current=true;let ee=Ld(se);y.current=Ld(ee),v.current=JSON.stringify(ee),H(ee),O(),j(),Z();},[H,U,Z,j,O]),W=useCallback(()=>{let se=x.current.pop();if(!se)return;let Ce=U();m.current.push(Ce),w.current=true;let ee=Ld(se);y.current=Ld(ee),v.current=JSON.stringify(ee),H(ee),O(),j(),Z();},[H,U,Z,j,O]),te=useCallback(se=>{if(m.current=[],x.current=[],se){let Ce=Ld(se);y.current=Ce,v.current=JSON.stringify(Ce);}else y.current=null,v.current="";O();},[O]);return useEffect(()=>()=>{C.current&&(clearTimeout(C.current),C.current=null);},[]),useEffect(()=>{if(i||s||w.current||a())return;let se=`${e.length}|${r}|${n.width}x${n.height}|${e.map(ue=>`${ue.id}:${ue.elements.length}`).join("/")}`;if(se===S.current)return;let Ce=U(),ee=JSON.stringify(Ce);if(ee===v.current){S.current=se;return}let ce=y.current;if(!ce){y.current=Ld(Ce),v.current=ee,S.current=se,O();return}m.current.push(Ld(ce)),m.current.length>$Ke&&m.current.shift(),x.current=[],y.current=Ld(Ce),v.current=ee,S.current=se,O();},[r,U,n.height,n.width,s,a,i,l,e,O]),{canUndo:T,canRedo:M,undoLabel:R,redoLabel:N,handleUndo:J,handleRedo:W,resetHistory:te,markDirty:Z,buildHistorySnapshot:U}}function PN(t,e,n){let r={...n};if(!e||e.length===0)return [{text:t,style:r}];let o=[[]];for(let d of e)d.text===`
4675
+ </style></head><body>`);for(let a of t){let l=qoe(a),c=M0(l);s.write('<div class="slide-page">'),s.write(`<div class="slide-header">${Dh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write(`<div class="slide-thumb">${Dh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write('<div class="notes-text">');let u=0;for(let d of c){d.bulletType==="numbered"?u++:u=0;let p=d.indentLevel*24,f="";d.bulletType==="bullet"?f="\u2022 ":d.bulletType==="numbered"&&(f=`${u}. `);let h=d.segments.filter(m=>!m.isParagraphBreak).map(m=>Dh(m.text)).join("");s.write(`<div class="para" style="padding-left:${p}px">${Dh(f)}${h}</div>`);}s.write("</div></div>");}s.write("</body></html>"),s.close(),setTimeout(()=>{i.contentWindow?.print();},200);},[t,n]);return jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:jsxs("div",{className:"bg-background border border-border rounded-lg shadow-xl w-[640px] max-h-[80vh] flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:n("pptx.notes.printNotes")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-sm",children:n("common.close")})]}),jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.map(i=>{let s=qoe(i),a=G2(s).trim().length>0;return jsxs("div",{className:"border border-border/50 rounded p-3",children:[jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:n("pptx.notes.slideN",{n:i.slideNumber})}),jsx("div",{className:"w-full aspect-video bg-muted rounded mb-2 flex items-center justify-center text-muted-foreground text-sm",children:n("pptx.notes.slideN",{n:i.slideNumber})}),jsx("div",{className:"text-xs text-foreground whitespace-pre-wrap",children:a?SI(s):jsx("span",{className:"italic text-muted-foreground",children:n("pptx.notes.noNotes")})})]},i.id)})}),jsx("div",{className:"flex justify-end px-4 py-3 border-t border-border",children:jsx("button",{type:"button",onClick:o,className:"px-3 py-1.5 text-xs bg-primary hover:bg-primary/80 text-white rounded",children:n("pptx.notes.print")})}),jsx("iframe",{ref:r,title:"print-notes",className:"hidden",sandbox:"allow-same-origin"})]})})}function qoe(t){return t.notesSegments&&t.notesSegments.length>0?t.notesSegments:kv(t.notes??"")}function Joe({initialText:t,onInsert:e,onClose:n}){let{t:r}=useTranslation(),[o,i]=useState(""),[s,a]=useState(t),l=useRef(null);useEffect(()=>{l.current?.focus();},[]);let c=useCallback(u=>{if(u.preventDefault(),o.trim().length===0)return;let d=o.startsWith("http")?o:`https://${o}`;e(d,s||d);},[o,s,e]);return jsx("div",{className:"absolute bottom-full left-0 mb-1 z-10 bg-muted border border-border rounded-lg shadow-lg p-3 w-72",children:jsxs("form",{onSubmit:c,className:"space-y-2",children:[jsxs("div",{children:[jsx("label",{className:"block text-[10px] text-muted-foreground mb-0.5",children:r("pptx.notes.linkUrl")}),jsx("input",{ref:l,type:"text",value:o,onChange:u=>i(u.target.value),placeholder:"https://...",className:"w-full px-2 py-1 text-xs bg-background border border-border rounded text-foreground focus:outline-none focus:border-primary"})]}),jsxs("div",{children:[jsx("label",{className:"block text-[10px] text-muted-foreground mb-0.5",children:r("pptx.notes.linkDisplayText")}),jsx("input",{type:"text",value:s,onChange:u=>a(u.target.value),placeholder:r("pptx.notes.linkDisplayText"),className:"w-full px-2 py-1 text-xs bg-background border border-border rounded text-foreground focus:outline-none focus:border-primary"})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx("button",{type:"button",onClick:n,className:"px-2 py-1 text-[10px] text-muted-foreground hover:text-foreground",children:r("common.cancel")}),jsx("button",{type:"submit",className:"px-2 py-1 text-[10px] bg-primary hover:bg-primary/80 text-white rounded",children:r("pptx.notes.insertLink")})]})]})})}function eie({isRichEditEnabled:t,showLinkPopover:e,savedSelectionText:n,hasAllSlides:r,onApplyRichCommand:o,onToggleBulletList:i,onToggleNumberedList:s,onIndent:a,onOutdent:l,onLinkButtonClick:c,onInsertLink:u,onCloseLinkPopover:d,onPrintClick:p,onToggleRichEdit:f}){let{t:h}=useTranslation();return jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[jsxs("div",{className:"inline-flex items-center rounded bg-muted text-xs overflow-hidden border border-border/60 relative",children:[jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.bold"),onClick:()=>o("bold"),children:jsx(LuBold,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.italic"),onClick:()=>o("italic"),children:jsx(LuItalic,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.underline"),onClick:()=>o("underline"),children:jsx(LuUnderline,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.strikethrough"),onClick:()=>o("strikeThrough"),children:jsx(LuStrikethrough,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.bulletList"),onClick:i,children:jsx(LuList,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.numberedList"),onClick:s,children:jsx(LuListOrdered,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.indent"),onClick:a,children:jsx(LuIndentIncrease,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.outdent"),onClick:l,children:jsx(LuIndentDecrease,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.insertLink"),onClick:c,children:jsx(LuLink,{className:"w-3.5 h-3.5"})}),r&&jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.printNotes"),onClick:p,children:jsx(LuPrinter,{className:"w-3.5 h-3.5"})}),e&&jsx(Joe,{initialText:n,onInsert:u,onClose:d})]}),jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded bg-muted hover:bg-accent border border-border/60",onClick:f,title:h("pptx.notes.toggleRichPlainEditor"),children:h(t?"pptx.notes.plainEditor":"pptx.notes.richEditor")})]})}function tie({activeSlide:t,isExpanded:e,canEdit:n,onToggle:r,onUpdateNotes:o}){let i=useMemo(()=>t?.notesSegments&&t.notesSegments.length>0?Iv(t.notesSegments):kv(t?.notes??""),[t?.notes,t?.notesSegments]),[s,a]=useState(t?.notes??""),[l,c]=useState(i),[u,d]=useState(i.length>0),[p,f]=useState(false),[h,m]=useState(false),x=useRef(null),y=useRef(null),v=useRef(null),S=useRef(null),w=useRef(false),C=useRef(null);useEffect(()=>{let W=t?.notes??"";if(W===C.current)return;let te=t?.notesSegments&&t.notesSegments.length>0?Iv(t.notesSegments):kv(W);a(W),c(te),d(te.length>0);},[t?.id,t?.notes,t?.notesSegments]),useEffect(()=>{if(!(!u||!e||!n||!v.current)){if(w.current){w.current=false;return}v.current.innerHTML=Yoe(l);}},[n,l,e,u]);let T=useCallback((W,te)=>{x.current&&(clearTimeout(x.current),x.current=null),C.current=W,o(W,te);},[o]),E=useCallback((W,te)=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{C.current=W,o(W,te),x.current=null;},600);},[o]);useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let M=useCallback(W=>{let te=W.target.value,se=kv(te);a(te),c(se),E(te,se);},[E]),A=useCallback(W=>{W.stopPropagation(),W.key==="Enter"&&(W.metaKey||W.ctrlKey)&&(T(s,l),r());},[s,l,T,r]),R=useCallback(()=>{if(!v.current)return;w.current=true;let W=Woe(v.current),te=G2(W);a(te),c(W),E(te,W);},[E]),k=useCallback(()=>{T(s,l);},[s,l,T]),N=useCallback(W=>{if(!v.current)return;let te=joe(v.current,l),se=M0(l);te>=0&&te<se.length&&(se[te]=W(se[te],te));let Ce=Voe(se),ee=G2(Ce);a(ee),c(Ce),E(ee,Ce);},[l,E]),F=useCallback(W=>{document.execCommand(W),R(),v.current?.focus();},[R]),B=useCallback(()=>{N(W=>({...W,bulletType:W.bulletType==="bullet"?"none":"bullet"})),v.current?.focus();},[N]),D=useCallback(()=>{N(W=>({...W,bulletType:W.bulletType==="numbered"?"none":"numbered"})),v.current?.focus();},[N]),O=useCallback(()=>{N(W=>({...W,indentLevel:Math.min(4,W.indentLevel+1)})),v.current?.focus();},[N]),U=useCallback(()=>{N(W=>({...W,indentLevel:Math.max(0,W.indentLevel-1)})),v.current?.focus();},[N]),H=useCallback(W=>{if(W.stopPropagation(),W.key==="Enter"&&(W.metaKey||W.ctrlKey)){T(s,l),r();return}W.key==="Tab"&&(W.preventDefault(),W.shiftKey?U():O());},[s,l,T,r,O,U]),j=useCallback(()=>{let W=window.getSelection();S.current={text:W?.toString()??""},f(true);},[]),Z=useCallback((W,te)=>{if(f(false),!v.current)return;v.current.focus();let se=window.getSelection();if(se&&se.rangeCount>0){let Ce=se.getRangeAt(0);Ce.deleteContents();let ee=document.createElement("a");ee.href=W,ee.textContent=te,ee.style.color="#4a9eff",ee.style.textDecoration="underline",ee.style.cursor="pointer",ee.setAttribute("data-hyperlink",W),Ce.insertNode(ee),Ce.setStartAfter(ee),Ce.collapse(true),se.removeAllRanges(),se.addRange(Ce);}R();},[R]),J=useCallback(W=>{let te=W.target;if(!(te instanceof HTMLAnchorElement))return;let se=te.getAttribute("data-hyperlink")||te.getAttribute("href");se&&(W.ctrlKey||W.metaKey)&&(W.preventDefault(),Xg(se));},[]);return {draft:s,draftSegments:l,isRichEditEnabled:u,setIsRichEditEnabled:d,showLinkPopover:p,setShowLinkPopover:f,showPrintDialog:h,setShowPrintDialog:m,textareaRef:y,richEditorRef:v,savedSelectionRef:S,handlePlainChange:M,handleRichInput:R,handleBlur:k,handleKeyDownPlain:A,handleKeyDownRich:H,applyRichCommand:F,toggleBulletList:B,toggleNumberedList:D,handleIndent:O,handleOutdent:U,handleLinkButtonClick:j,handleInsertLink:Z,handleEditorClick:J}}var V6=({activeSlide:t,allSlides:e,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i,panelHeight:s})=>{let{t:a}=useTranslation(),{draft:l,draftSegments:c,isRichEditEnabled:u,setIsRichEditEnabled:d,showLinkPopover:p,setShowLinkPopover:f,showPrintDialog:h,setShowPrintDialog:m,textareaRef:x,richEditorRef:y,savedSelectionRef:v,handlePlainChange:S,handleRichInput:w,handleBlur:C,handleKeyDownPlain:T,handleKeyDownRich:E,applyRichCommand:M,toggleBulletList:A,toggleNumberedList:R,handleIndent:k,handleOutdent:N,handleLinkButtonClick:F,handleInsertLink:B,handleEditorClick:D}=tie({activeSlide:t,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i}),O=l.trim().length>0,U=t?a("pptx.notes.slideN",{n:t.slideNumber}):a("pptx.notes.noSlide");return jsxs("div",{className:le("flex flex-col border-t border-border/60 bg-background select-none",!n&&"max-md:hidden"),children:[jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1.5 px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30 transition-colors w-full text-left shrink-0 max-md:hidden","aria-expanded":n,"aria-controls":"slide-notes-content",children:["Notes",!n&&O&&jsx("span",{className:"text-muted-foreground/50 text-[10px]",children:"(has notes)"})]}),n&&jsxs("div",{id:"slide-notes-content",className:"px-3 pb-2 overflow-y-auto",style:{maxHeight:s??240},children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:U}),r?jsxs(Fragment,{children:[jsx(eie,{isRichEditEnabled:u,showLinkPopover:p,savedSelectionText:v.current?.text??"",hasAllSlides:e!==void 0&&e.length>0,onApplyRichCommand:M,onToggleBulletList:A,onToggleNumberedList:R,onIndent:k,onOutdent:N,onLinkButtonClick:F,onInsertLink:B,onCloseLinkPopover:()=>f(false),onPrintClick:()=>m(true),onToggleRichEdit:()=>d(H=>!H)}),u?jsx("div",{ref:y,contentEditable:true,suppressContentEditableWarning:true,onInput:w,onBlur:C,onKeyDown:E,onClick:D,className:"w-full overflow-y-auto rounded-md border border-border/50 bg-muted/60 px-2.5 py-1.5 text-xs text-foreground focus:border-primary/50 focus:outline-none focus:ring-1 focus:ring-primary/30 transition-colors whitespace-pre-wrap",style:{maxHeight:192,minHeight:72}}):jsx("textarea",{ref:x,name:"slide-notes",value:l,onChange:S,onBlur:C,onKeyDown:T,placeholder:a("pptx.notes.clickToAddNotes"),rows:4,className:"w-full resize-none rounded-md border border-border/50 bg-muted/60 px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-1 focus:ring-primary/30 transition-colors",style:{maxHeight:192}})]}):jsx("div",{className:"w-full rounded-md border border-border/30 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground overflow-y-auto whitespace-pre-wrap",style:{maxHeight:168,minHeight:60},children:O?SI(c):jsx("span",{className:"italic text-muted-foreground",children:a("pptx.notes.noNotes")})})]}),h&&e&&jsx(Koe,{slides:e,onClose:()=>m(false)})]})};var rGe="pptx-viewer-autosave",oGe=1,Dv="recoveryVersions";function nie(){return new Promise((t,e)=>{let n=indexedDB.open(rGe,oGe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(Dv)||r.createObjectStore(Dv,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function iGe(t){try{let e=await nie();return new Promise(n=>{let i=e.transaction(Dv,"readonly").objectStore(Dv).get(t);i.onsuccess=()=>{e.close();let s=i.result;n(s?[s]:[]);},i.onerror=()=>{e.close(),n([]);};})}catch{return []}}async function sGe(t){try{let e=await nie();return new Promise(n=>{let r=e.transaction(Dv,"readwrite");r.objectStore(Dv).delete(t),r.oncomplete=()=>{e.close(),n();},r.onerror=()=>{e.close(),n();};})}catch{}}function aGe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function lGe(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function cGe(t){let e=Date.now()-t,n=Math.floor(e/6e4);if(n<1)return "Just now";if(n<60)return `${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function X6({isOpen:t,filePath:e,onClose:n,onRestore:r}){let{t:o}=useTranslation(),[i,s]=useState([]),[a,l]=useState(false),[c,u]=useState(null),[d,p]=useState(null),f=useCallback(async()=>{if(e){l(true);try{let x=await iGe(e);s(x);}catch{s([]);}finally{l(false);}}},[e]);useEffect(()=>{t&&f();},[t,f]);let h=useCallback(async x=>{u(x.key);try{x.data&&(r(x.data),n());}finally{u(null);}},[r,n]),m=useCallback(async x=>{p(x.key);try{await sGe(x.key),await f();}finally{p(null);}},[f]);return t?jsxs("div",{className:"absolute inset-y-0 right-0 w-80 bg-background border-l border-border z-50 flex flex-col shadow-xl",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[jsx(LuClock,{className:"w-4 h-4"}),o("pptx.versionHistory.title")]}),jsx("button",{onClick:n,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&jsx("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:o("common.loading")}),!a&&i.length===0&&jsx("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:o("pptx.versionHistory.noVersions")}),!a&&i.map(x=>jsxs("div",{className:"px-3 py-2.5 border-b border-border hover:bg-muted/50 group",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-xs text-foreground",children:lGe(x.timestamp)}),jsx("div",{className:"text-[10px] text-muted-foreground",children:cGe(x.timestamp)})]}),jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:aGe(x.size)}),jsxs("div",{className:"flex items-center gap-1 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[jsxs("button",{onClick:()=>{h(x);},disabled:c===x.key,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] bg-primary/20 text-primary hover:bg-primary/30 disabled:opacity-40",children:[jsx(LuDownload,{className:"w-3 h-3"}),c===x.key?o("common.loading"):o("pptx.versionHistory.restore")]}),jsxs("button",{onClick:()=>{m(x);},disabled:d===x.key,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] bg-red-600/20 text-red-400 hover:bg-red-600/30 disabled:opacity-40",children:[jsx(LuTrash2,{className:"w-3 h-3"}),o("common.delete")]})]})]},x.key))]})]}):null}function bGe({kind:t}){switch(t){case "added":return jsx(LuPlus,{className:"w-3 h-3 text-green-400"});case "removed":return jsx(LuMinus,{className:"w-3 h-3 text-red-400"});case "moved":return jsx(LuMove,{className:"w-3 h-3 text-primary"});case "resized":return jsx(LuMove,{className:"w-3 h-3 text-amber-400"});case "textChanged":return jsx(LuType,{className:"w-3 h-3 text-purple-400"})}}function oie({diff:t,diffIndex:e,canvasSize:n,accepted:r,rejected:o,onAccept:i,onReject:s}){let{t:a}=useTranslation(),[l,c]=useState(t.status==="changed"),u=(()=>{switch(t.status){case "added":return a("pptx.compare.statusAdded");case "removed":return a("pptx.compare.statusRemoved");case "changed":return a("pptx.compare.statusChanged");case "unchanged":return a("pptx.compare.statusUnchanged")}})(),d=(()=>{switch(t.status){case "added":return "text-green-400 bg-green-900/30";case "removed":return "text-red-400 bg-red-900/30";case "changed":return "text-amber-400 bg-amber-900/30";case "unchanged":return "text-muted-foreground bg-muted/30"}})();if(t.status==="unchanged")return null;let p=r||o,f=t.baseIndex>=0?t.baseIndex+1:t.compareIndex+1;return jsxs("div",{className:le("rounded-lg border transition-colors",p?"border-border/60 bg-card/40 opacity-60":"border-border bg-background/70"),children:[jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-2 text-left",onClick:()=>c(h=>!h),children:[l?jsx(LuChevronDown,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}):jsx(LuChevronRight,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),jsx("span",{className:"text-xs text-foreground",children:a("pptx.compare.slideNumber",{number:f})}),jsx("span",{className:le("rounded-full px-2 py-0.5 text-[10px] font-medium",d),children:u}),t.changes.length>0&&jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.changes.length," ",t.changes.length===1?"change":"changes"]}),jsx("span",{className:"flex-1"}),p&&jsx("span",{className:le("text-[10px] font-medium",r?"text-green-400":"text-muted-foreground"),children:a(r?"pptx.compare.accepted":"pptx.compare.rejected")})]}),l&&jsxs("div",{className:"px-3 pb-3 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[t.baseSlide&&jsxs("div",{className:"flex-1",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:a("pptx.compare.current")}),jsx("div",{className:"rounded border border-border overflow-hidden",children:jsx(Qa,{slide:t.baseSlide,templateElements:[],canvasSize:n})})]}),t.compareSlide&&jsxs("div",{className:"flex-1",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:a("pptx.compare.incoming")}),jsx("div",{className:le("rounded border overflow-hidden",t.status==="added"?"border-green-700/60":t.status==="changed"?"border-amber-700/60":"border-border"),children:jsx(Qa,{slide:t.compareSlide,templateElements:[],canvasSize:n})})]})]}),t.changes.length>0&&jsx("div",{className:"space-y-1",children:t.changes.map((h,m)=>jsxs("div",{className:"flex items-start gap-2 rounded bg-muted/60 px-2 py-1.5 text-[11px]",children:[jsx(bGe,{kind:h.kind}),jsx("span",{className:"text-foreground",children:h.description})]},`${h.elementId}-${h.kind}-${m}`))}),!p&&jsxs("div",{className:"flex items-center gap-2 pt-1",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-green-700/80 px-2.5 py-1 text-[11px] text-green-50 hover:bg-green-600 transition-colors",onClick:()=>i(e),children:[jsx(LuCheck,{className:"w-3 h-3"}),a("pptx.compare.accept")]}),jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-accent px-2.5 py-1 text-[11px] text-foreground hover:bg-accent/80 transition-colors",onClick:()=>s(e),children:[jsx(LuX,{className:"w-3 h-3"}),a("pptx.compare.reject")]})]})]})]})}function Y6({isOpen:t,compareResult:e,canvasSize:n,onClose:r,onAcceptSlide:o,onRejectSlide:i,onAcceptAll:s}){let{t:a}=useTranslation(),[l,c]=useState({}),[u,d]=useState({}),p=useCallback(x=>{c(y=>({...y,[x]:true})),d(y=>{let v={...y};return delete v[x],v}),o(x);},[o]),f=useCallback(x=>{d(y=>({...y,[x]:true})),c(y=>{let v={...y};return delete v[x],v}),i(x);},[i]),h=useCallback(()=>{if(!e)return;let x={};e.diffs.forEach((y,v)=>{y.status!=="unchanged"&&(x[v]=true);}),c(x),d({}),s();},[e,s]);if(!t||!e)return null;let m=e.diffs.filter(x=>x.status!=="unchanged");return jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex flex-col w-[440px] border-l border-border bg-popover backdrop-blur-lg shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-medium text-foreground",children:a("pptx.compare.title")}),jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:a("pptx.compare.summary",{added:e.addedCount,removed:e.removedCount,changed:e.changedCount})})]}),jsx("button",{type:"button",className:"rounded p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",onClick:r,title:a("pptx.compare.close"),children:jsx(LuX,{className:"w-4 h-4"})})]}),m.length>0&&jsx("div",{className:"px-4 py-2 border-b border-border/60",children:jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded bg-green-700/80 px-3 py-1.5 text-xs text-green-50 hover:bg-green-600 transition-colors",onClick:h,children:[jsx(LuCheck,{className:"w-3.5 h-3.5"}),a("pptx.compare.acceptAll")]})}),jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-2",children:m.length===0?jsx("div",{className:"text-center py-8 text-xs text-muted-foreground",children:a("pptx.compare.noDifferences")}):e.diffs.map((x,y)=>jsx(oie,{diff:x,diffIndex:y,canvasSize:n,accepted:!!l[y],rejected:!!u[y],onAccept:p,onReject:f},`diff-${y}-${x.status}`))})]})}function PGe(t){if(!t)return 0;let e=0;return t.length>=8&&e++,t.length>=12&&e++,/[A-Z]/.test(t)&&/[a-z]/.test(t)&&e++,/\d/.test(t)&&e++,/[^A-Za-z0-9]/.test(t)&&e++,Math.min(e,4)}var RGe=["bg-red-500","bg-orange-500","bg-yellow-500","bg-lime-500","bg-green-500"];function K6({isOpen:t,isCurrentlyProtected:e,onClose:n,onSetPassword:r,onRemovePassword:o}){let{t:i}=useTranslation(),[s,a]=useState(""),[l,c]=useState(""),[u,d]=useState(false),[p,f]=useState(""),h=useMemo(()=>PGe(s),[s]),m=useMemo(()=>{let S=[i("pptx.security.strengthVeryWeak"),i("pptx.security.strengthWeak"),i("pptx.security.strengthFair"),i("pptx.security.strengthStrong"),i("pptx.security.strengthVeryStrong")];return s?S[h]:""},[h,s,i]),x=useCallback(()=>{if(f(""),!s){f(i("pptx.security.errorPasswordRequired"));return}if(s!==l){f(i("pptx.security.errorPasswordMismatch"));return}if(s.length<4){f(i("pptx.security.errorPasswordTooShort"));return}r(s),a(""),c(""),n();},[s,l,r,n,i]),y=useCallback(()=>{o(),a(""),c(""),n();},[o,n]),v=useCallback(()=>{a(""),c(""),f(""),n();},[n]);return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":i("common.close"),onClick:v}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuLock,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:i("pptx.security.protectPresentation")})]}),jsx("button",{type:"button",onClick:v,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":i("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsxs("div",{className:"px-5 py-4 space-y-4",children:[e&&jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-green-900/30 border border-green-700/40 px-3 py-2",children:[jsx(LuShieldCheck,{className:"w-4 h-4 text-green-400 shrink-0"}),jsx("span",{className:"text-xs text-green-300",children:i("pptx.security.currentlyProtected")})]}),jsx("p",{className:"text-xs text-muted-foreground",children:i("pptx.security.description")}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:i("pptx.security.password")}),jsxs("div",{className:"relative",children:[jsx("input",{type:u?"text":"password",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:i("pptx.security.passwordPlaceholder"),value:s,onChange:S=>{a(S.target.value),f("");}}),jsx("button",{type:"button",onClick:()=>d(!u),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":u?"Hide password":"Show password",children:u?jsx(LuEyeOff,{className:"w-4 h-4"}):jsx(LuEye,{className:"w-4 h-4"})})]})]}),s&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"flex gap-1",children:Array.from({length:5}).map((S,w)=>jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${w<=h?RGe[h]:"bg-accent"}`},`str-${w}`))}),jsx("p",{className:"text-[11px] text-muted-foreground",children:m})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:i("pptx.security.confirmPassword")}),jsx("input",{type:u?"text":"password",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:i("pptx.security.confirmPasswordPlaceholder"),value:l,onChange:S=>{c(S.target.value),f("");}})]}),p&&jsx("p",{className:"text-xs text-red-400",children:p})]}),jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border/60",children:[jsx("div",{children:e&&jsx("button",{type:"button",onClick:y,className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:i("pptx.security.removePassword")})}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{type:"button",onClick:v,className:"px-3 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:i("common.cancel")}),jsx("button",{type:"button",onClick:x,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors",children:i(e?"pptx.security.updatePassword":"pptx.security.setPassword")})]})]})]})})]}):null}var LGe=[{value:"lpwstr",labelKey:"pptx.documentProperties.custom.typeText"},{value:"i4",labelKey:"pptx.documentProperties.custom.typeNumber"},{value:"filetime",labelKey:"pptx.documentProperties.custom.typeDate"},{value:"bool",labelKey:"pptx.documentProperties.custom.typeYesNo"}];function Z6({customProperties:t,onUpdate:e}){let{t:n}=useTranslation(),r=useCallback(()=>{e([...t,{name:"",value:"",type:"lpwstr"}]);},[t,e]),o=useCallback(l=>{e(t.filter((c,u)=>u!==l));},[t,e]),i=useCallback((l,c)=>{e(t.map((u,d)=>d===l?{...u,name:c}:u));},[t,e]),s=useCallback((l,c)=>{e(t.map((u,d)=>d===l?{...u,value:c}:u));},[t,e]),a=useCallback((l,c)=>{e(t.map((u,d)=>d===l?{...u,type:c}:u));},[t,e]);return jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-muted-foreground",children:n("pptx.documentProperties.custom.description")}),jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_32px] gap-1 text-[11px] font-medium text-muted-foreground px-1",children:[jsx("span",{children:n("pptx.documentProperties.custom.name")}),jsx("span",{children:n("pptx.documentProperties.custom.value")}),jsx("span",{children:n("pptx.documentProperties.custom.type")}),jsx("span",{})]}),jsx("div",{className:"max-h-[240px] overflow-y-auto space-y-1",children:t.map((l,c)=>jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_32px] gap-1 items-center",children:[jsx("input",{type:"text",className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:n("pptx.documentProperties.custom.namePlaceholder"),value:l.name,onChange:u=>i(c,u.target.value)}),l.type==="bool"?jsxs("select",{className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:l.value,onChange:u=>s(c,u.target.value),children:[jsx("option",{value:"true",children:n("pptx.documentProperties.custom.yes")}),jsx("option",{value:"false",children:n("pptx.documentProperties.custom.no")})]}):jsx("input",{type:l.type==="i4"?"number":"text",className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:n("pptx.documentProperties.custom.valuePlaceholder"),value:l.value,onChange:u=>s(c,u.target.value)}),jsx("select",{className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:l.type,onChange:u=>a(c,u.target.value),children:LGe.map(u=>jsx("option",{value:u.value,children:n(u.labelKey)},u.value))}),jsx("button",{type:"button",onClick:()=>o(c),className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-400 transition-colors","aria-label":n("pptx.documentProperties.custom.deleteProperty"),children:jsx(LuTrash2,{className:"w-3.5 h-3.5"})})]},`custom-prop-${c}`))}),t.length===0&&jsx("p",{className:"text-xs text-muted-foreground/60 text-center py-4",children:n("pptx.documentProperties.custom.empty")}),jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:[jsx(LuPlus,{className:"w-3.5 h-3.5"}),n("pptx.documentProperties.custom.addProperty")]})]})}var OGe=[{key:"application",labelKey:"pptx.documentProperties.statistics.application",editable:false},{key:"appVersion",labelKey:"pptx.documentProperties.statistics.appVersion",editable:false},{key:"presentationFormat",labelKey:"pptx.documentProperties.statistics.presentationFormat",editable:false},{key:"slides",labelKey:"pptx.documentProperties.statistics.slides",editable:false},{key:"hiddenSlides",labelKey:"pptx.documentProperties.statistics.hiddenSlides",editable:false},{key:"notes",labelKey:"pptx.documentProperties.statistics.notes",editable:false},{key:"totalTime",labelKey:"pptx.documentProperties.statistics.totalTime",editable:false},{key:"words",labelKey:"pptx.documentProperties.statistics.words",editable:false},{key:"paragraphs",labelKey:"pptx.documentProperties.statistics.paragraphs",editable:false},{key:"template",labelKey:"pptx.documentProperties.statistics.template",editable:false},{key:"company",labelKey:"pptx.documentProperties.statistics.company",editable:true},{key:"manager",labelKey:"pptx.documentProperties.statistics.manager",editable:true}];function UGe(t,e){if(t==null)return e("pptx.documentProperties.statistics.notAvailable");let n=Math.floor(t/60),r=t%60;return e("pptx.documentProperties.statistics.hoursMinutes",{hours:n,minutes:r})}function $Ge(t,e,n){return t==="totalTime"?UGe(e,n):e==null?n("pptx.documentProperties.statistics.notAvailable"):String(e)}function J6({appProperties:t,onUpdateAppProperties:e,canEdit:n}){let{t:r}=useTranslation(),o=useCallback((i,s)=>{e({[i]:s});},[e]);return jsx("div",{className:"space-y-3",children:OGe.map(({key:i,labelKey:s,editable:a})=>jsxs("div",{className:"flex items-center gap-3",children:[jsx("label",{className:"block text-xs text-foreground w-[140px] shrink-0",children:r(s)}),a&&n?jsx("input",{type:"text",className:"flex-1 rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:String(t[i]??""),onChange:l=>o(i,l.target.value)}):jsx("span",{className:"flex-1 px-3 py-2 text-sm text-muted-foreground",children:$Ge(i,t[i],r)})]},i))})}var aie=[{key:"title",labelKey:"pptx.documentProperties.summary.title"},{key:"subject",labelKey:"pptx.documentProperties.summary.subject"},{key:"creator",labelKey:"pptx.documentProperties.summary.author"},{key:"keywords",labelKey:"pptx.documentProperties.summary.keywords"},{key:"description",labelKey:"pptx.documentProperties.summary.description",multiline:true},{key:"category",labelKey:"pptx.documentProperties.summary.category"}];function Q6({isOpen:t,coreProperties:e,customProperties:n,appProperties:r,onClose:o,onSave:i}){let{t:s}=useTranslation(),[a,l]=useState("summary"),[c,u]=useState({}),[d,p]=useState([]),[f,h]=useState({}),[m,x]=useState(false);t&&!m&&(u({...e}),p(n.map(E=>({...E}))),h({company:r?.company,manager:r?.manager}),l("summary")),t!==m&&x(t);let y=useCallback((E,M)=>{u(A=>({...A,[E]:M}));},[]),v=useMemo(()=>{if(aie.some(({key:R})=>(c[R]??"")!==(e[R]??"")))return true;let M=(f.company??"")!==(r?.company??""),A=(f.manager??"")!==(r?.manager??"");return M||A||d.length!==n.length?true:d.some((R,k)=>R.name!==n[k]?.name||R.value!==n[k]?.value||R.type!==n[k]?.type)},[c,d,f,e,n,r]),S=useCallback(E=>{h(M=>({...M,...E}));},[]),w=useCallback(()=>{let E=(f.company??"")!==(r?.company??"")||(f.manager??"")!==(r?.manager??"");i(c,d,E?f:void 0),o();},[c,d,f,r,i,o]),C=useCallback(()=>{o();},[o]);if(!t)return null;let T=[{id:"summary",labelKey:"pptx.documentProperties.tabs.summary"},{id:"custom",labelKey:"pptx.documentProperties.tabs.custom"},{id:"statistics",labelKey:"pptx.documentProperties.tabs.statistics"}];return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":s("common.close"),onClick:C}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[520px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuFileText,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.documentProperties.dialogTitle")})]}),jsx("button",{type:"button",onClick:C,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"flex border-b border-border/60",children:T.map(E=>jsx("button",{type:"button",onClick:()=>l(E.id),className:`px-4 py-2 text-xs font-medium transition-colors ${a===E.id?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:s(E.labelKey)},E.id))}),jsxs("div",{className:"px-5 py-4 min-h-[280px]",children:[a==="summary"&&jsx("div",{className:"space-y-3",children:aie.map(({key:E,labelKey:M,multiline:A})=>jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:s(M)}),A?jsx("textarea",{className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none resize-none",rows:3,value:c[E]??"",onChange:R=>y(E,R.target.value)}):jsx("input",{type:"text",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:c[E]??"",onChange:R=>y(E,R.target.value)})]},E))}),a==="custom"&&jsx(Z6,{customProperties:d,onUpdate:p}),a==="statistics"&&jsx(J6,{appProperties:{...r,company:f.company,manager:f.manager},onUpdateAppProperties:S,canEdit:true})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border/60",children:[jsx("button",{type:"button",onClick:C,className:"px-3 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:w,disabled:!v,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("common.save")})]})]})})]})}function eVe(t){if(typeof document>"u")return false;try{return document.fonts.check(`12px "${t}"`)}catch{return false}}function t8({isOpen:t,embedFontsEnabled:e,usedFontFamilies:n,embeddedFonts:r,onClose:o,onToggleEmbedFonts:i}){let{t:s}=useTranslation(),[a,l]=useState(new Set),[c,u]=useState(false),[d,p]=useState(false),f=useCallback(async()=>{u(true);try{await document.fonts.ready;let x=new Set;for(let y of n)eVe(y)&&x.add(y);l(x),p(!0);}catch{}finally{u(false);}},[n]);if(useEffect(()=>{t&&!d&&f();},[t,d,f]),!t)return null;let h=n.filter(x=>!a.has(x)),m=new Set(r);return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":s("common.close"),onClick:o}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[460px] max-h-[80vh] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60 shrink-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuType,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.fonts.embedFonts")})]}),jsx("button",{type:"button",onClick:o,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1",children:[jsx("p",{className:"text-xs text-muted-foreground",children:s("pptx.fonts.embedDescription")}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[jsxs("div",{className:"relative",children:[jsx("input",{type:"checkbox",className:"sr-only",checked:e,onChange:x=>i(x.target.checked)}),jsx("div",{className:`w-9 h-5 rounded-full transition-colors ${e?"bg-primary":"bg-muted-foreground"}`}),jsx("div",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${e?"translate-x-4":""}`})]}),jsx("span",{className:"text-xs text-foreground",children:s("pptx.fonts.enableEmbedding")})]}),jsxs("div",{className:"space-y-1",children:[jsxs("h3",{className:"text-xs font-medium text-foreground",children:[s("pptx.fonts.usedFonts")," (",n.length,")"]}),c?jsxs("div",{className:"flex items-center gap-2 py-4 justify-center",children:[jsx(LuLoader,{className:"w-4 h-4 text-muted-foreground animate-spin"}),jsx("span",{className:"text-xs text-muted-foreground",children:s("pptx.fonts.scanning")})]}):jsx("div",{className:"space-y-1 max-h-[280px] overflow-y-auto",children:n.map(x=>{let y=a.has(x),v=m.has(x);return jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-muted/60",children:[jsx("span",{className:"text-xs text-foreground",children:x}),jsxs("div",{className:"flex items-center gap-2",children:[v&&jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-900/40 text-green-400 border border-green-700/40",children:s("pptx.fonts.embedded")}),y?jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}):jsx("span",{className:"text-[10px] text-yellow-400",children:s("pptx.fonts.notFound")})]})]},x)})})]}),h.length>0&&!c&&jsx("p",{className:"text-[11px] text-yellow-400/80",children:s("pptx.fonts.missingWarning",{count:h.length})})]}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60 shrink-0",children:jsx("button",{type:"button",onClick:o,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors",children:s("common.done")})})]})})]})}function r8({isOpen:t,onClose:e,hasSignatures:n,signatureCount:r}){let{t:o}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":o("common.close"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[n?jsx(LuShieldCheck,{className:"w-5 h-5 text-green-400"}):jsx(LuShieldAlert,{className:"w-5 h-5 text-amber-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:o("pptx.digitalSignatures.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":o("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6 space-y-4",children:n?jsxs(Fragment,{children:[jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-green-900/20 border border-green-700/30 px-4 py-3",children:[jsx(LuSignature,{className:"w-5 h-5 text-green-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-1",children:[jsx("p",{className:"text-xs text-green-200",children:o("pptx.digitalSignatures.signed")}),jsx("p",{className:"text-[11px] text-green-300/70",children:o("pptx.digitalSignatures.signatureCount",{count:r})})]})]}),jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-amber-900/20 border border-amber-700/30 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-amber-400 shrink-0 mt-0.5"}),jsx("p",{className:"text-xs text-amber-200",children:o("pptx.digitalSignatures.editWarning")})]})]}):jsx(Fragment,{children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-muted/30 border border-border/40 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-muted-foreground shrink-0 mt-0.5"}),jsx("p",{className:"text-xs text-muted-foreground",children:o("pptx.digitalSignatures.noSignatures")})]})})}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60",children:jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:o("common.close")})})]})})]}):null}function o8({hasSignatures:t,signatureCount:e,onClick:n}){let{t:r}=useTranslation();return !t||e===0?null:jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-medium rounded-md bg-green-900/30 border border-green-700/40 text-green-300 hover:bg-green-900/50 transition-colors",title:r("pptx.digitalSignatures.signatureCount",{count:e}),children:[jsx(LuShieldCheck,{className:"w-3.5 h-3.5"}),jsx("span",{children:r("pptx.digitalSignatures.badge")})]})}function i8({isOpen:t,signatureCount:e,onConfirm:n,onCancel:r}){let{t:o}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":o("common.close"),onClick:r}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuTriangleAlert,{className:"w-5 h-5 text-amber-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:o("pptx.digitalSignatures.strippedTitle")})]}),jsx("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":o("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6",children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-amber-900/20 border border-amber-700/30 px-4 py-3",children:[jsx(LuTriangleAlert,{className:"w-5 h-5 text-amber-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"text-xs text-amber-200",children:o("pptx.digitalSignatures.strippedMessage",{count:e})}),jsx("p",{className:"text-[11px] text-amber-300/70",children:o("pptx.digitalSignatures.editWarning")})]})]})}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border/60",children:[jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:o("common.cancel")}),jsx("button",{type:"button",onClick:n,className:"px-3 py-1.5 text-xs rounded-lg bg-amber-600 text-white hover:bg-amber-500 transition-colors",children:o("pptx.digitalSignatures.strippedConfirm")})]})]})})]}):null}function s8({isOpen:t,onClose:e}){let{t:n}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":n("common.close"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuLock,{className:"w-5 h-5 text-red-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:n("pptx.encryptedFile.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":n("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6 space-y-4",children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-red-900/20 border border-red-700/30 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-red-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"text-xs text-red-200",children:n("pptx.encryptedFile.message")}),jsx("p",{className:"text-[11px] text-red-300/70",children:n("pptx.encryptedFile.instructions")})]})]})}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60",children:jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:n("common.close")})})]})})]}):null}var a8=10,l8=32,c8=2,pie=14;function u8(t){return Math.max(a8,Math.min(l8,t))}function fie(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function q2(t){let e=Math.floor(t/1e3),n=Math.floor(e/3600),r=Math.floor(e%3600/60),o=e%60;return n>0?`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`}function hie(t){return t.map((e,n)=>{if(e.isParagraphBreak)return Vn__default.createElement("br",{key:`br-${n}`});let r={};return e.style.bold&&(r.fontWeight="bold"),e.style.italic&&(r.fontStyle="italic"),e.style.underline&&(r.textDecoration="underline"),e.style.strikethrough&&(r.textDecoration=`${r.textDecoration?`${r.textDecoration} `:""}line-through`),e.style.color&&(r.color=e.style.color),e.style.fontSize&&(r.fontSize=`${e.style.fontSize}pt`),e.style.fontFamily&&(r.fontFamily=e.style.fontFamily),Vn__default.createElement("span",{key:`seg-${n}`,style:r},e.text)})}function wVe({slide:t,templateElements:e,canvasSize:n,className:r}){let o=useRef(null),[i,s]=useState(0);useEffect(()=>{let p=o.current;if(!p)return;let f=new ResizeObserver(h=>{let m=h[0];m&&s(m.contentRect.width);});return f.observe(p),()=>f.disconnect()},[]);let a=Math.max(n.width,1),l=Math.max(n.height,1),c=i>0?i/a:.2,u=Math.max(40,Math.round(l*c)),d=[...e,...t.elements].slice(0,80);return jsxs("div",{ref:o,className:`relative w-full overflow-hidden rounded border border-border bg-white ${r??""}`,style:{height:u},children:[t.backgroundColor&&t.backgroundColor!=="transparent"&&jsx("div",{className:"absolute inset-0",style:{backgroundColor:dt(t.backgroundColor,"#ffffff")}}),t.backgroundImage&&jsx("img",{src:t.backgroundImage,alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",draggable:false}),t.backgroundGradient&&jsx("div",{className:"absolute inset-0",style:{backgroundImage:t.backgroundGradient}}),jsx("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:a,height:l,transform:`scale(${c})`,transformOrigin:"top left"},children:d.map(p=>{let f=Math.max(p.width,1),h=Math.max(p.height,1),m=mn(p)?p.shapeStyle:void 0,x=m?.fillColor!==void 0&&m?.fillColor!=="transparent"||!!(Bd(m)||m?.fillGradient)||m?.fillMode==="pattern"&&!!m.fillPatternPreset,y=dt(m?.fillColor,Pf),v=Math.max(0,m?.strokeWidth||0),S=dt(m?.strokeColor,Fd),w=Hd(p,x,y,v,S),C=Vd(p,x,y,v,S),T=p.type==="shape"&&x?"#ffffff":bi,E=If(p,T),M=jd(p),A=Nf(p),R=ot(p)?p.text:void 0,k=ot(p)?p.textSegments:void 0,N=typeof R=="string"&&R.trim().length>0||(k?.length??0)>0,F=ty(p,A)?cs(p):"";return jsx("div",{className:"absolute overflow-hidden",style:{left:p.x,top:p.y,width:f,height:h,transform:hu(p),transformOrigin:"center"},children:(p.type==="picture"||p.type==="image")&&(p.svgData||p.imageData)?xu(p)?jsx("div",{className:"pointer-events-none w-full h-full",style:Xd(p)}):jsx("img",{src:p.svgData||p.imageData,alt:"",className:"pointer-events-none",style:M,draggable:false}):jsxs("div",{className:"relative w-full h-full overflow-hidden",style:w,children:[C,A&&N&&jsx("div",{className:"w-full h-full whitespace-pre-wrap break-words px-1 py-0.5 leading-[1.3]",style:{...Sc(p),...E,transform:kf(p),transformOrigin:"center"},children:Al(p,T)}),!N&&F.length>0&&jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground",children:F})]})},p.id)})})]})}function CVe(t,e){return !(t.slide.id!==e.slide.id||t.slide.isDirty!==e.slide.isDirty||t.slide.hidden!==e.slide.hidden||t.slide.elements!==e.slide.elements||t.slide.backgroundColor!==e.slide.backgroundColor||t.slide.backgroundImage!==e.slide.backgroundImage||t.slide.backgroundGradient!==e.slide.backgroundGradient||t.templateElements!==e.templateElements||t.canvasSize.width!==e.canvasSize.width||t.canvasSize.height!==e.canvasSize.height||t.className!==e.className)}var d8=Vn__default.memo(wVe,CVe);function f8({slides:t,currentSlideIndex:e,canvasSize:n,templateElements:r,presentationStartTime:o,onMovePresentationSlide:i,onExit:s,onOpenAudienceWindow:a,onCloseAudienceWindow:l,isAudienceWindowOpen:c}){let{t:u}=useTranslation(),[d,p]=useState(false);useEffect(()=>{let N=window.setTimeout(()=>p(true),300);return ()=>window.clearTimeout(N)},[]);let[f,h]=useState(Date.now());useEffect(()=>{let N=window.setInterval(()=>h(Date.now()),1e3);return ()=>window.clearInterval(N)},[]);let m=o?f-o:0,[x,y]=useState(pie),v=useCallback(()=>{y(N=>u8(N+c8));},[]),S=useCallback(()=>{y(N=>u8(N-c8));},[]),w=t[e],C=e+1<t.length?t[e+1]:void 0,T=w?.notes??"",E=w?.notesSegments,M=E&&E.length>0;if(!w)return jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-card text-muted-foreground",children:u("pptx.presenter.noSlides")});let A=300*1e3,R=Math.min(100,m%A/A*100),k=Math.floor(m/A);return jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-card text-foreground",children:[jsxs("div",{className:"flex flex-1 min-h-0",children:[jsxs("div",{className:"flex-[7] flex flex-col items-center justify-center bg-black p-6 min-w-0",children:[jsx(d8,{slide:w,templateElements:r,canvasSize:n}),jsx("div",{className:"mt-3 text-xs font-mono tabular-nums text-white/50 select-none",children:u("pptx.presenter.slideLabel",{current:e+1,total:t.length,defaultValue:`Slide ${e+1} of ${t.length}`})})]}),jsxs("div",{className:"flex-[3] flex flex-col bg-background border-l border-border min-w-[260px] max-w-[440px]",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/60",children:[jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:u("pptx.presenter.currentTime")}),jsx("span",{className:"text-lg font-mono tabular-nums text-foreground",children:fie(new Date(f))})]}),jsxs("div",{className:"flex flex-col items-end",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:u("pptx.presenter.elapsed")}),jsx("span",{className:"text-lg font-mono tabular-nums text-primary",children:q2(m)})]}),jsxs("div",{className:"flex items-center gap-1",children:[a&&d&&jsx("button",{type:"button",onClick:()=>{c?l?.():a();},className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:u(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),"aria-label":u(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),children:c?jsx(LuMonitorOff,{className:"w-5 h-5"}):jsx(LuMonitor,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:s,className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:u("pptx.presenter.endPresentation"),"aria-label":u("pptx.presenter.endPresentation"),children:jsx(LuX,{className:"w-5 h-5"})})]})]}),jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/60",children:[jsxs("button",{type:"button",onClick:()=>i(-1),disabled:e===0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:u("pptx.presenter.previousSlide"),children:[jsx(LuChevronLeft,{className:"w-4 h-4"}),u("pptx.presenter.prev")]}),jsxs("span",{className:"text-sm font-mono tabular-nums text-foreground",children:[e+1," / ",t.length]}),jsxs("button",{type:"button",onClick:()=>i(1),disabled:e>=t.length-1,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:u("pptx.presenter.nextSlide"),children:[u("pptx.presenter.next"),jsx(LuChevronRight,{className:"w-4 h-4"})]})]}),jsxs("div",{className:"px-4 py-3 border-b border-border/60",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:u("pptx.presenter.nextSlidePreview")}),C?jsx(d8,{slide:C,templateElements:r,canvasSize:n}):jsx("div",{className:"flex items-center justify-center h-16 rounded border border-border/30 bg-muted/40 text-xs text-muted-foreground italic",children:u("pptx.presenter.endOfPresentation")})]}),jsxs("div",{className:"flex-1 flex flex-col min-h-0 px-4 py-3",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:u("pptx.presenter.speakerNotes")}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",onClick:S,disabled:x<=a8,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:u("pptx.presenter.decreaseFontSize"),"aria-label":u("pptx.presenter.decreaseFontSize"),children:jsx(LuMinus,{className:"w-3.5 h-3.5"})}),jsxs("span",{className:"text-[10px] font-mono tabular-nums text-muted-foreground min-w-[28px] text-center select-none",children:[x,"px"]}),jsx("button",{type:"button",onClick:v,disabled:x>=l8,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:u("pptx.presenter.increaseFontSize"),"aria-label":u("pptx.presenter.increaseFontSize"),children:jsx(LuPlus,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto rounded border border-border/30 bg-muted/40 px-3 py-2 text-foreground whitespace-pre-wrap leading-relaxed",style:{fontSize:`${x}px`},children:M?hie(E):T.trim().length>0?T:jsx("span",{className:"italic text-muted-foreground",children:u("pptx.presenter.noNotes")})})]})]})]}),jsx("div",{className:"h-1.5 w-full bg-muted/60 flex-shrink-0",role:"progressbar","aria-valuenow":Math.round(R),"aria-valuemin":0,"aria-valuemax":100,"aria-label":u("pptx.presenter.timerProgress"),title:`${q2(m)} (segment ${k+1})`,children:jsx("div",{className:"h-full bg-primary transition-[width] duration-1000 ease-linear",style:{width:`${R}%`}})})]})}function yie(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function m8({presentationStartTime:t,slideStartTime:e,paused:n,onTogglePause:r}){let{t:o}=useTranslation(),[i,s]=useState(0);useEffect(()=>{if(n)return;let u=window.setInterval(()=>s(d=>d+1),250);return ()=>window.clearInterval(u)},[n]);let a=Date.now(),l=e!==null?a-e:0,c=t!==null?a-t:0;return jsxs("div",{className:"fixed bottom-4 left-4 z-[9999] flex items-center gap-3 rounded-lg bg-black/80 px-4 py-2 text-white shadow-xl backdrop-blur-sm select-none",children:[jsxs("div",{className:"flex flex-col text-xs leading-tight",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.rehearse.slideTime")}),jsx("span",{className:"text-lg font-mono tabular-nums",children:yie(l)})]}),jsx("div",{className:"w-px h-8 bg-border"}),jsxs("div",{className:"flex flex-col text-xs leading-tight",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.rehearse.totalTime")}),jsx("span",{className:"text-lg font-mono tabular-nums",children:yie(c)})]}),jsx("button",{type:"button",onClick:r,className:"ml-1 rounded p-1.5 hover:bg-white/20 transition-colors",title:o(n?"pptx.rehearse.resume":"pptx.rehearse.pause"),"aria-label":o(n?"pptx.rehearse.resume":"pptx.rehearse.pause"),children:n?jsx(LuPlay,{className:"w-4 h-4"}):jsx(LuPause,{className:"w-4 h-4"})})]})}function bie(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function g8({slides:t,canvasSize:e,recordedTimings:n,onSave:r,onDiscard:o}){let{t:i}=useTranslation(),s=Object.values(n).reduce((l,c)=>l+c,0),a=Object.entries(n).map(([l,c])=>({slideIndex:Number(l),ms:c})).sort((l,c)=>l.slideIndex-c.slideIndex);return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",children:jsxs("div",{className:"w-full max-w-lg rounded-xl border border-border bg-background shadow-2xl",children:[jsxs("div",{className:"border-b border-border px-5 py-4",children:[jsx("h2",{className:"text-base font-semibold text-foreground",children:i("pptx.rehearse.summaryTitle")}),jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[i("pptx.rehearse.totalPresentationTime"),":"," ",jsx("span",{className:"font-mono text-foreground",children:bie(s)})]})]}),jsx("div",{className:"max-h-72 overflow-y-auto px-5 py-3",children:jsxs("table",{className:"w-full text-xs",children:[jsx("thead",{children:jsxs("tr",{className:"text-muted-foreground uppercase tracking-wide",children:[jsx("th",{className:"pb-2 text-left",children:"#"}),jsx("th",{className:"pb-2 text-left",children:i("pptx.rehearse.slide")}),jsx("th",{className:"pb-2 text-right",children:i("pptx.rehearse.time")})]})}),jsx("tbody",{children:a.map(({slideIndex:l,ms:c})=>{let u=t[l];return jsxs("tr",{className:"border-t border-border",children:[jsx("td",{className:"py-2 text-muted-foreground tabular-nums",children:l+1}),jsx("td",{className:"py-2",children:u&&jsx("div",{className:"w-20 rounded overflow-hidden bg-white",children:jsx(Qa,{slide:u,templateElements:[],canvasSize:e})})}),jsx("td",{className:"py-2 text-right font-mono text-foreground tabular-nums",children:bie(c)})]},l)})})]})}),jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-5 py-3",children:[jsx("button",{type:"button",onClick:o,className:"rounded-lg px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",children:i("pptx.rehearse.discard")}),jsx("button",{type:"button",onClick:r,className:"rounded-lg bg-primary px-4 py-2 text-sm text-white hover:bg-primary/80 transition-colors",children:i("pptx.rehearse.saveTimings")})]})]})})}function GVe(t,e){return ot(t)&&t.text&&t.text.trim().length>0?t.text.trim().slice(0,32):`${{text:"Text Box",shape:"Shape",connector:"Connector",image:"Image",picture:"Picture",chart:"Chart",table:"Table",smartArt:"SmartArt",media:"Media",group:"Group",ink:"Ink",ole:"Object",unknown:"Object"}[t.type]??"Object"} ${e+1}`}function y8({slides:t,activeSlideIndex:e,selectedElementId:n,selectedElementIds:r,canEdit:o,setSelectedElementId:i,setSelectedElementIds:s,setSlides:a,markDirty:l,onClose:c}){let{t:u}=useTranslation(),p=t[e]?.elements??[],[f,h]=useState(null),[m,x]=useState(""),y=useRef(null),[v,S]=useState(null),[w,C]=useState(null),T=useCallback(B=>{i(B),s([B]);},[i,s]),E=useCallback(B=>{a(D=>{let O=[...D],U=O[e];if(!U)return D;let H=[...U.elements??[]],j=H.findIndex(Z=>Z.id===B);return j===-1?D:(H[j]={...H[j],hidden:!H[j].hidden},O[e]={...U,elements:H},O)}),l();},[e,a,l]),M=useCallback((B,D)=>{o&&(h(B.id),x(D),setTimeout(()=>y.current?.select(),0));},[o]),A=useCallback(()=>{h(null);},[]),R=useCallback(B=>{S(B);},[]),k=useCallback((B,D)=>{B.preventDefault(),v!==null&&v!==D&&C(D);},[v]),N=useCallback(B=>{if(v===null||v===B){S(null),C(null);return}a(D=>{let O=[...D],U=O[e];if(!U)return D;let H=[...U.elements??[]],[j]=H.splice(v,1);return H.splice(B,0,j),O[e]={...U,elements:H},O}),l(),S(null),C(null);},[v,e,a,l]),F=[...p].reverse();return jsxs("div",{className:"flex flex-col h-full bg-popover border-l border-border w-56",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[jsx("span",{className:"text-xs font-medium text-foreground",children:u("pptx.selectionPane.title")}),jsx("button",{type:"button",onClick:c,className:"text-muted-foreground hover:text-foreground text-xs",title:u("pptx.selectionPane.close"),children:"\xD7"})]}),jsx("div",{className:"flex-1 overflow-y-auto py-1",children:F.length===0?jsx("div",{className:"px-3 py-4 text-xs text-muted-foreground italic",children:u("pptx.selectionPane.empty")}):F.map((B,D)=>{let O=p.length-1-D,U=n===B.id||r.includes(B.id),H=GVe(B,O),j=f===B.id;return jsxs("div",{draggable:o,onDragStart:()=>R(O),onDragOver:Z=>k(Z,O),onDrop:()=>N(O),onDragEnd:()=>{S(null),C(null);},className:le("flex items-center gap-1.5 px-2 py-1 text-xs cursor-pointer transition-colors",U?"bg-primary/30 text-primary":"hover:bg-muted text-foreground",w===O?"border-t-2 border-primary":""),onClick:()=>T(B.id),onDoubleClick:()=>M(B,H),children:[o&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground flex-shrink-0 cursor-grab"}),jsx("span",{className:"flex-1 truncate",children:j?jsx("input",{ref:y,type:"text",value:m,onChange:Z=>x(Z.target.value),onBlur:A,onKeyDown:Z=>{Z.key==="Enter"&&A(),Z.key==="Escape"&&h(null);},className:"w-full bg-muted text-xs px-1 py-0.5 rounded border border-border outline-none",onClick:Z=>Z.stopPropagation()}):H}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex-shrink-0",title:B.hidden?u("pptx.selectionPane.show"):u("pptx.selectionPane.hide"),onClick:Z=>{Z.stopPropagation(),E(B.id);},children:B.hidden?jsx(LuEyeOff,{className:"w-3.5 h-3.5"}):jsx(LuEye,{className:"w-3.5 h-3.5 opacity-50"})})]},B.id)})})]})}var Tie="inline-flex items-center justify-center px-2.5 py-1.5 max-md:min-h-[44px] max-md:min-w-[44px] active:scale-95 active:opacity-80",Po=`${Tie} border-r border-border hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Js=`${Tie} hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Ji="inline-flex items-center rounded bg-muted text-xs overflow-hidden",ft="inline-flex items-center gap-1.5 px-2.5 py-1.5 max-md:min-h-[44px] rounded bg-muted hover:bg-accent text-xs transition-colors active:scale-95 active:opacity-80",Un=jsx("div",{className:"w-px self-stretch bg-border/40 mx-1 max-md:hidden"}),Qe="w-4 h-4",lr="w-3.5 h-3.5";var Mie=[{k:"left",el:jsx(LuAlignLeft,{className:Qe})},{k:"center",el:jsx(LuAlignCenter,{className:Qe})},{k:"right",el:jsx(LuAlignRight,{className:Qe})},{k:"top",el:jsx(LuChevronUp,{className:Qe})},{k:"middle",el:jsx(LuAlignCenter,{className:`${Qe} rotate-90`})},{k:"bottom",el:jsx(LuChevronDown,{className:Qe})}],_ie=[{id:"select",icon:jsx(LuMoveRight,{className:Qe}),t:"Select",ac:"bg-primary text-white"},{id:"pen",icon:jsx(LuPencil,{className:Qe}),t:"Pen",ac:"bg-primary text-white"},{id:"highlighter",icon:jsx(LuType,{className:Qe}),t:"Highlighter",ac:"bg-yellow-600 text-white"},{id:"eraser",icon:jsx(LuMinus,{className:Qe}),t:"Eraser",ac:"bg-red-600 text-white"},{id:"freeform",icon:jsx(LuSpline,{className:Qe}),t:"Freeform",ac:"bg-primary text-white"}],Eie=[{k:"png",l:"Export as PNG",i:jsx(LuDownload,{className:`${lr} text-muted-foreground`})},{k:"pdf",l:"Export as PDF",i:jsx(LuFileText,{className:`${lr} text-muted-foreground`})},{k:"video",l:"Export as Video",i:jsx(LuVideo,{className:`${lr} text-muted-foreground`})},{k:"gif",l:"Export as GIF",i:jsx(LuImage,{className:`${lr} text-muted-foreground`})},{k:"package",l:"Package for Sharing",i:jsx(LuFolderOpen,{className:`${lr} text-muted-foreground`})},{k:"pptx",l:"Save as Presentation (.pptx)",i:jsx(LuDownload,{className:`${lr} text-muted-foreground`})},{k:"ppsx",l:"Save as Slide Show (.ppsx)",i:jsx(LuPlay,{className:`${lr} text-muted-foreground`})},{k:"pptm",l:"Save as Macro-Enabled (.pptm)",i:jsx(LuDatabase,{className:`${lr} text-muted-foreground`})},{k:"---0",l:"",i:null},{k:"print",l:"Print",i:jsx(LuPrinter,{className:`${lr} text-muted-foreground`})},{k:"copyImg",l:"Copy Slide as Image",i:jsx(LuCopy,{className:`${lr} text-muted-foreground`})},{k:"---",l:"",i:null},{k:"a11y",l:"Accessibility Check",i:jsx(LuCheck,{className:`${lr} text-muted-foreground`})},{k:"shortcuts",l:"Keyboard Shortcuts",i:jsx(LuSearch,{className:`${lr} text-muted-foreground`})},{k:"---2",l:"",i:null},{k:"versionHistory",l:"Version History",i:jsx(LuClock,{className:`${lr} text-muted-foreground`})},{k:"---3",l:"",i:null},{k:"documentProperties",l:"Document Properties\u2026",i:jsx(LuInfo,{className:`${lr} text-muted-foreground`})},{k:"passwordProtection",l:"Protect Presentation",i:jsx(LuLock,{className:`${lr} text-muted-foreground`})},{k:"fontEmbedding",l:"Embed Fonts",i:jsx(LuType,{className:`${lr} text-muted-foreground`})},{k:"digitalSignatures",l:"Digital Signatures\u2026",i:jsx(LuShieldAlert,{className:`${lr} text-muted-foreground`})}],Aie=[{i:jsx(LuBold,{className:Qe}),t:"Bold"},{i:jsx(LuItalic,{className:Qe}),t:"Italic"},{i:jsx(LuUnderline,{className:Qe}),t:"Underline"},{i:jsx(LuStrikethrough,{className:Qe}),t:"Strikethrough"}],Pie=[{i:jsx(LuAlignLeft,{className:Qe}),t:"Align left"},{i:jsx(LuAlignCenter,{className:Qe}),t:"Align center"},{i:jsx(LuAlignRight,{className:Qe}),t:"Align right"},{i:jsx(LuAlignJustify,{className:Qe}),t:"Justify"}];var C9e=[{group:"Entrance",items:[{value:"appear",label:"Appear"},{value:"fadeIn",label:"Fade In"},{value:"flyIn",label:"Fly In"}]},{group:"Emphasis",items:[{value:"pulse",label:"Pulse"},{value:"spin",label:"Spin"}]},{group:"Exit",items:[{value:"disappear",label:"Disappear"},{value:"fadeOut",label:"Fade Out"}]}];function kI(t){let{t:e}=useTranslation(),[n,r]=useState(false),o=t.selectedElement!==null,i=!t.canEdit||!o;return jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:()=>{i||(r(true),setTimeout(()=>r(false),1200));},disabled:i,className:le(ft,n?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.previewTooltip"),children:[jsx(LuPlay,{className:Qe}),e("pptx.animations.preview")]}),Un,jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:i,className:ft,title:e("pptx.animations.addTooltip"),children:[jsx(LuSparkles,{className:Qe}),e("pptx.animations.addAnimation"),jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-44 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:C9e.map(a=>jsxs(Vn__default.Fragment,{children:[jsx("div",{className:"px-3 pt-1.5 pb-0.5 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:e(`pptx.animations.group.${a.group.toLowerCase()}`)}),a.items.map(l=>jsx("button",{type:"button",disabled:i,onClick:()=>t.onAddAnimation?.(l.value,a.group.toLowerCase()),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:e("pptx.animations.applyAnimation",{name:e(`pptx.animations.preset.${l.value}`)}),children:e(`pptx.animations.preset.${l.value}`)},l.value))]},a.group))})})]}),Un,jsxs("button",{type:"button",disabled:i,onClick:t.onRemoveAnimation,className:ft,title:e("pptx.animations.removeTooltip"),children:[jsx(LuTrash2,{className:Qe}),e("pptx.animations.remove")]}),Un,jsxs("button",{type:"button",onClick:t.onOpenAnimationPanel??t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.openPanelTooltip"),children:[jsx(LuPanelRight,{className:Qe}),e("pptx.animations.animationPanel")]})]})}function II(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit;return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:Mie.map((o,i,s)=>jsx("button",{type:"button",onClick:()=>t.onAlignElements(o.k),disabled:!r,className:i<s.length-1?Po:Js,title:e("pptx.arrange.align",{direction:o.k}),children:o.el},o.k))}),jsxs("div",{className:Ji,children:[jsx("button",{onClick:t.onCopy,disabled:!n,className:Po,title:e("pptx.arrange.copy"),children:jsx(LuCopy,{className:Qe})}),jsx("button",{onClick:t.onCut,disabled:!r,className:Po,title:e("pptx.arrange.cut"),children:e("pptx.arrange.cut")}),jsx("button",{onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Js,title:e("pptx.arrange.paste"),children:jsx(LuClipboardPaste,{className:Qe})})]}),t.onToggleFormatPainter&&jsxs("button",{type:"button",onClick:t.onToggleFormatPainter,disabled:!t.canEdit||t.canActivateFormatPainter===false&&!t.formatPainterActive,"data-testid":"format-painter-toggle","data-active":t.formatPainterActive?"true":"false",className:le(ft,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:e("pptx.arrange.formatPainter"),children:[jsx(LuPaintbrush,{className:Qe}),e("pptx.arrange.format")]}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",onClick:()=>t.onFlip("horizontal"),disabled:!r,className:Po,title:e("pptx.arrange.flipHorizontally"),children:e("pptx.arrange.flipH")}),jsx("button",{type:"button",onClick:()=>t.onFlip("vertical"),disabled:!r,className:Js,title:e("pptx.arrange.flipVertically"),children:e("pptx.arrange.flipV")})]}),jsxs("div",{className:Ji,children:[jsx("button",{onClick:()=>t.onMoveLayer("backward"),disabled:!r,className:Po,title:e("pptx.arrange.sendBackward"),children:jsx(LuChevronDown,{className:Qe})}),jsx("button",{onClick:()=>t.onMoveLayer("forward"),disabled:!r,className:Po,title:e("pptx.arrange.bringForward"),children:jsx(LuChevronUp,{className:Qe})}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("back"),disabled:!r,className:Po,title:e("pptx.arrange.sendToBack"),children:e("pptx.arrange.back")}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("front"),disabled:!r,className:Js,title:e("pptx.arrange.bringToFront"),children:e("pptx.arrange.front")})]}),jsxs("button",{onClick:t.onDuplicate,disabled:!r,className:ft,title:e("pptx.arrange.duplicate"),children:[jsx(LuCopy,{className:Qe}),e("pptx.arrange.duplicate")]}),jsxs("button",{onClick:t.onDelete,disabled:!r,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded bg-red-700/80 hover:bg-red-600 disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:e("pptx.arrange.delete"),children:[jsx(LuTrash2,{className:Qe}),e("pptx.arrange.delete")]})]})}function NI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onToggleThemeGallery,disabled:!t.canEdit,className:le(ft,t.isThemeGalleryOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Browse and apply built-in themes",children:[jsx(LuPalette,{className:lr}),"Browse Themes"]}),jsxs("button",{onClick:t.onToggleThemeEditor,disabled:!t.canEdit,className:le(ft,t.isThemeEditorOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Edit presentation theme colors and fonts",children:[jsx(LuPencil,{className:lr}),"Edit Theme"]}),Un,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:ft,title:"Change slide dimensions (16:9, 4:3, custom)",children:[jsx(LuMonitor,{className:lr}),"Slide Size"]}),t.onToggleInspector&&jsxs("button",{onClick:t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open inspector to edit slide background",children:[jsx(LuPaintBucket,{className:lr}),"Format Background"]})]})}var z9e=[{value:"none",label:"None"},{value:"fade",label:"Fade"},{value:"push",label:"Push"},{value:"wipe",label:"Wipe"},{value:"split",label:"Split"},{value:"reveal",label:"Reveal"},{value:"cut",label:"Cut"},{value:"cover",label:"Cover"},{value:"uncover",label:"Uncover"}];function DI(t){let[e,n]=Vn__default.useState("none"),[r,o]=Vn__default.useState("00.50");return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:ft,title:"Preview transition",children:[jsx(LuPlay,{className:lr}),"Preview"]}),Un,jsx("div",{className:"inline-flex items-center gap-0.5 overflow-x-auto max-w-[420px]",children:z9e.map(i=>jsx("button",{type:"button",onClick:()=>n(i.value),className:le("flex-shrink-0 px-2 py-1 max-md:min-h-[44px] rounded border text-[11px] leading-tight transition-colors",e===i.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted hover:bg-accent text-foreground"),title:`${i.label} transition`,children:i.label},i.value))}),Un,jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[jsx("span",{className:"whitespace-nowrap",children:"Duration:"}),jsx("input",{type:"text",value:r,onChange:i=>o(i.target.value),className:"w-14 px-1.5 py-1 rounded border border-border bg-muted text-xs text-foreground text-center",title:"Transition duration in seconds"})]}),Un,jsxs("button",{type:"button",className:ft,title:"Apply transition to all slides",children:[jsx(LuCopy,{className:lr}),"Apply to All"]}),Un,jsxs("button",{type:"button",onClick:t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open Inspector for full transition options",children:[jsx(LuPanelRight,{className:Qe}),"Inspector"]})]})}function LI(t){return jsxs(Fragment,{children:[t.onToggleComments&&jsxs("button",{onClick:t.onToggleComments,className:le(ft,t.isCommentsPanelOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle comments panel",children:[jsx(LuMessageSquare,{className:Qe}),"Comments",(t.slideCommentCount??0)>0&&jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-amber-500 text-[10px] font-medium text-white px-1",children:t.slideCommentCount})]}),jsxs("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:le(ft,t.spellCheckEnabled?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle spell check",children:[jsx(LuSpellCheck,{className:Qe}),"Spelling"]}),t.onCompare&&jsxs("button",{onClick:t.onCompare,disabled:!t.canEdit,className:ft,title:"Compare with another presentation",children:[jsx(LuGitCompare,{className:Qe}),"Compare"]})]})}function BI(t){return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:_ie.map((e,n,r)=>jsx("button",{type:"button",onClick:()=>t.onSetActiveTool(e.id),className:le(n<r.length-1?Po:Js,t.activeTool===e.id?e.ac??"bg-accent text-foreground":""),title:e.t,children:e.icon},e.id))}),jsxs("div",{className:"inline-flex items-center gap-2 text-xs",children:[jsxs("label",{className:"inline-flex items-center gap-1 text-muted-foreground",title:"Pen colour",children:["Colour",jsx("input",{type:"color",value:t.drawingColor,onChange:e=>t.onSetDrawingColor(e.target.value),className:"w-6 h-6 rounded border border-border bg-transparent cursor-pointer"})]}),jsxs("label",{className:"inline-flex items-center gap-1 text-muted-foreground",title:"Stroke width",children:["Width",jsx("input",{type:"range",min:1,max:12,value:t.drawingWidth,onChange:e=>t.onSetDrawingWidth(Number(e.target.value)),className:"w-16 h-1 accent-primary"}),jsx("span",{className:"text-foreground w-4 text-right",children:t.drawingWidth})]})]})]})}function OI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onSaveAsPptx,className:ft,title:"Save as Presentation (.pptx)",children:[jsx(LuDownload,{className:Qe}),"Save .pptx"]}),jsxs("button",{onClick:t.onSaveAsPpsx,className:ft,title:"Save as Slide Show (.ppsx)",children:[jsx(LuPlay,{className:Qe}),"Save .ppsx"]}),t.hasMacros&&jsxs("button",{onClick:t.onSaveAsPptm,className:ft,title:"Save as Macro-Enabled (.pptm)",children:[jsx(LuFileText,{className:Qe}),"Save .pptm"]}),jsxs("button",{onClick:t.onPackageForSharing,className:ft,title:"Package for Sharing",children:[jsx(LuFolderOpen,{className:Qe}),"Package"]}),Un,jsxs("button",{onClick:t.onExportPng,className:ft,title:"Export as PNG",children:[jsx(LuDownload,{className:Qe}),"PNG"]}),jsxs("button",{onClick:t.onExportPdf,className:ft,title:"Export as PDF",children:[jsx(LuFileText,{className:Qe}),"PDF"]}),jsxs("button",{onClick:t.onExportVideo,className:ft,title:"Export as Video",children:[jsx(LuVideo,{className:Qe}),"Video"]}),jsxs("button",{onClick:t.onExportGif,className:ft,title:"Export as GIF",children:[jsx(LuImage,{className:Qe}),"GIF"]}),jsxs("button",{onClick:t.onCopySlideAsImage,className:ft,title:"Copy Slide as Image",children:[jsx(LuCopy,{className:Qe}),"Copy Image"]}),Un,jsxs("button",{onClick:t.onPrint,className:ft,title:"Print",children:[jsx(LuPrinter,{className:Qe}),"Print"]}),Un,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:ft,title:"Document Properties",children:[jsx(LuInfo,{className:Qe}),"Properties"]}),t.onOpenPasswordProtection&&jsxs("button",{onClick:t.onOpenPasswordProtection,className:ft,title:"Protect Presentation",children:[jsx(LuLock,{className:Qe}),"Protect"]}),t.onOpenFontEmbedding&&jsxs("button",{onClick:t.onOpenFontEmbedding,className:ft,title:"Embed Fonts",children:[jsx(LuType,{className:Qe}),"Fonts"]}),t.onOpenDigitalSignatures&&jsxs("button",{onClick:t.onOpenDigitalSignatures,className:ft,title:"Digital Signatures",children:[jsx(LuShieldAlert,{className:Qe}),"Signatures"]})]})}function aje(t){let e={fontFamily:"Segoe UI",fontSize:"24"};if(!t||!ot(t))return e;let n=t.textSegments?.[0]?.style,r=t.textStyle,o=n?.fontFamily??r?.fontFamily??e.fontFamily,i=n?.fontSize??r?.fontSize;return {fontFamily:o,fontSize:i!=null?String(i):e.fontSize}}var lje=["Arial","Calibri","Cambria","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana"],cje=[8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,72,96];function UI(t){let[e,n]=useState(false),[r,o]=useState(false),[i,s]=useState(false),[a,l]=useState(false),[c,u]=useState(false),d=useRef(null),p=useRef(null),f=useRef(null),{fontFamily:h,fontSize:m}=aje(t.selectedElement),x=useCallback(()=>{if(t.layoutOptions.length>0){let y=t.layoutOptions[0];t.onInsertSlideFromLayout(y.path,y.name);}},[t]);return useEffect(()=>{if(!e)return;let y=v=>{d.current&&!d.current.contains(v.target)&&n(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[e]),useEffect(()=>{if(!r)return;let y=v=>{p.current&&!p.current.contains(v.target)&&o(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]),useEffect(()=>{if(!i)return;let y=v=>{f.current&&!f.current.contains(v.target)&&s(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:Ji,children:[jsx("button",{type:"button",onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Po,title:"Paste",children:jsx(LuClipboardPaste,{className:Qe})}),jsx("button",{type:"button",onClick:()=>{t.onCut(),u(true),setTimeout(()=>u(false),600);},disabled:!t.canEdit,className:le(Po,c&&"bg-green-600/20 text-green-400"),title:"Cut",children:jsx(LuScissors,{className:Qe})}),jsx("button",{type:"button",onClick:()=>{t.onCopy(),l(true),setTimeout(()=>l(false),600);},className:le(Po,a&&"bg-green-600/20 text-green-400"),title:"Copy",children:jsx(LuCopy,{className:Qe})}),t.onToggleFormatPainter&&jsx("button",{type:"button",onClick:t.onToggleFormatPainter,disabled:!t.canEdit||t.canActivateFormatPainter===false&&!t.formatPainterActive,"data-testid":"format-painter-toggle","data-active":t.formatPainterActive?"true":"false",className:le(Js,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Format Painter",children:jsx(LuPaintbrush,{className:Qe})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Clipboard"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"relative inline-flex items-center",ref:d,children:[jsxs("button",{type:"button",onClick:x,disabled:!t.canEdit||t.layoutOptions.length===0,className:le(ft,"whitespace-nowrap",t.layoutOptions.length>0?"rounded-r-none":""),title:"New Slide",children:[jsx(LuPlus,{className:Qe}),"New Slide"]}),t.layoutOptions.length>0&&jsx("button",{type:"button",disabled:!t.canEdit,className:"inline-flex items-center justify-center self-stretch px-1 rounded-r bg-muted hover:bg-accent text-xs transition-colors border-l border-border/40 active:scale-95 active:opacity-80",title:"Choose layout",onClick:()=>n(y=>!y),children:jsx(LuChevronDown,{className:"w-3 h-3"})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:t.layoutOptions.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onInsertSlideFromLayout(y.path,y.name),n(false);},children:y.name},y.path))})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Slides"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",ref:p,children:[jsxs("button",{type:"button",onClick:()=>o(y=>!y),className:"inline-flex items-center justify-between px-2 py-1 rounded-sm border border-border/60 bg-background/60 text-[11px] text-foreground min-w-[120px] truncate hover:bg-accent/40 transition-colors cursor-pointer",children:[jsx("span",{className:"truncate",children:h}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),r&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:lje.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",style:{fontFamily:y},onClick:()=>{t.onUpdateTextStyle?.({fontFamily:y}),o(false);},children:y},y))})})]}),jsxs("div",{className:"relative",ref:f,children:[jsxs("button",{type:"button",onClick:()=>s(y=>!y),className:"inline-flex items-center justify-between px-2 py-1 rounded-sm border border-border/60 bg-background/60 text-[11px] text-foreground min-w-[50px] text-center hover:bg-accent/40 transition-colors cursor-pointer",children:[jsx("span",{className:"truncate",children:m}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),i&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:cje.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onUpdateTextStyle?.({fontSize:y}),s(false);},children:y},y))})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),Un]})}function $I(t){let{t:e}=useTranslation(),{canEdit:n}=t,[r,o]=useState(false),[i,s]=useState(""),[a,l]=useState("locale"),c=useRef(null),u=useCallback(()=>{let p=new Date,f=h=>String(h).padStart(2,"0");s(`${p.getFullYear()}-${f(p.getMonth()+1)}-${f(p.getDate())}T${f(p.getHours())}:${f(p.getMinutes())}`),l("locale"),o(true);},[]),d=useCallback(()=>{if(!t.onInsertField)return;let p=new Date(i);if(isNaN(p.getTime()))return;let f;switch(a){case "iso":f=p.toISOString().slice(0,10);break;case "long":f=p.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"});break;case "short":f=p.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});break;case "time":f=p.toLocaleString();break;default:f=p.toLocaleDateString();break}t.onInsertField("datetime",f),o(false);},[i,a,t]);return useEffect(()=>{if(!r)return;let p=f=>{c.current&&!c.current.contains(f.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]),jsxs(Fragment,{children:[jsxs("button",{onClick:t.onAddTextBox,disabled:!n,className:ft,title:"Add text box",children:[jsx(LuType,{className:Qe}),"Text"]}),jsxs("div",{className:Ji,children:[jsx("select",{value:t.newShapeType,onChange:p=>t.onSetNewShapeType(p.target.value),className:"bg-transparent py-1.5 pl-2 pr-1 outline-none text-xs",title:"Shape type",children:m1.map(p=>jsx("option",{value:p.type,className:"bg-background",children:p.label},p.type))}),jsxs("button",{onClick:t.onAddShape,disabled:!n,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 border-l border-border hover:bg-accent transition-colors text-xs",title:"Add shape",children:[m1.find(p=>p.type===t.newShapeType)?.icon||jsx(LuSquare,{className:Qe}),"Shape"]})]}),jsxs("button",{onClick:t.onOpenImagePicker,disabled:!n,className:ft,title:"Insert image",children:[jsx(LuImage,{className:Qe}),"Image"]}),jsxs("button",{onClick:t.onOpenMediaPicker,disabled:!n,className:ft,title:"Insert audio or video",children:[jsx(LuVideo,{className:Qe}),"Media"]}),jsxs("button",{onClick:t.onAddTable,disabled:!n,className:ft,title:"Insert table",children:[jsx(LuDatabase,{className:Qe}),"Table"]}),jsxs("button",{onClick:t.onAddSmartArt,disabled:!n,className:ft,title:"Insert SmartArt",children:[jsx(LuLayers,{className:Qe}),"SmartArt"]}),jsxs("button",{onClick:t.onAddEquation,disabled:!n,className:ft,title:"Insert Equation",children:[jsx("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M4 17h6M7 14v6M14 7l4.5 10M15.5 14h5"})}),"Equation"]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:ft,title:"Insert action button",children:[jsxs("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M13 7l4 5-4 5"})]}),"Action",jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-40 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:Lm.map(p=>jsxs("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onAddActionButton(p.shapeType),children:[jsx("svg",{className:"w-4 h-4 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:p.iconPath})}),p.label]},p.shapeType))})})]}),t.onInsertField&&jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:ft,title:e("pptx.field.insertField"),children:[jsxs("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M4 7h16M4 12h10M4 17h12"}),jsx("circle",{cx:"19",cy:"15",r:"3"})]}),e("pptx.field.field"),jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-44 pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:[jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("slidenum"),children:e("pptx.field.slideNumber")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:u,children:e("pptx.field.dateTime")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("header"),children:e("pptx.field.header")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("footer"),children:e("pptx.field.footer")})]})})]}),r&&jsx("div",{ref:c,className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/30",onMouseDown:p=>{p.target===p.currentTarget&&o(false);},children:jsxs("div",{className:"rounded-lg border border-border bg-popover shadow-2xl p-4 w-72 space-y-3",children:[jsx("div",{className:"text-sm font-medium text-foreground",children:e("pptx.field.dateTime")}),jsx("input",{type:"datetime-local",className:"w-full rounded border border-border bg-muted px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:i,onChange:p=>s(p.target.value)}),jsxs("div",{children:[jsx("label",{className:"block text-[11px] text-muted-foreground mb-1",children:e("pptx.field.format","Format")}),jsxs("select",{className:"w-full rounded border border-border bg-muted px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:a,onChange:p=>l(p.target.value),children:[jsx("option",{value:"locale",children:new Date(i||Date.now()).toLocaleDateString()}),jsx("option",{value:"long",children:new Date(i||Date.now()).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsx("option",{value:"short",children:new Date(i||Date.now()).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}),jsx("option",{value:"iso",children:new Date(i||Date.now()).toISOString().slice(0,10)}),jsx("option",{value:"time",children:new Date(i||Date.now()).toLocaleString()})]})]}),jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded border border-border text-foreground hover:bg-muted transition-colors",onClick:()=>o(false),children:e("pptx.common.cancel","Cancel")}),jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded bg-primary text-white hover:bg-primary/90 transition-colors",onClick:d,children:e("pptx.common.insert","Insert")})]})]})})]})}function HI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:()=>t.onSetMode("present"),className:ft,title:"Start slide show from beginning",children:[jsx(LuPlay,{className:Qe}),"From Beginning"]}),jsxs("button",{onClick:t.onPresent,className:ft,title:"Start slide show from current slide",children:[jsx(LuPlay,{className:Qe}),"From Current Slide"]}),Un,jsxs("button",{onClick:t.onEnterPresenterView,className:ft,title:"Presenter view",children:[jsx(LuMonitor,{className:Qe}),"Presenter View"]}),jsxs("button",{onClick:t.onEnterRehearsalMode,className:ft,title:"Rehearse timings",children:[jsx(LuClock,{className:Qe}),"Rehearse Timings"]}),Un,jsxs("button",{onClick:t.onOpenSetUpSlideShow,className:ft,title:"Set up slide show",children:[jsx(LuSettings,{className:Qe}),"Set Up Slide Show"]}),jsxs("button",{onClick:t.onOpenBroadcastDialog,className:ft,title:"Broadcast slide show",children:[jsx(LuCast,{className:Qe}),"Broadcast"]}),Un,jsxs("button",{onClick:t.onToggleSubtitles,className:le(ft,t.showSubtitles?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle subtitles",children:[jsx(LuCaptions,{className:Qe}),"Subtitles"]})]})}function Lje(t,e){if(t){if(ot(t))return t.textStyle;if(t.type==="table"&&e&&t.tableData)return t.tableData.rows[e.rowIndex]?.cells[e.columnIndex]?.style}}var Fje=["#000000","#ffffff","#ff0000","#00aa00","#0000ff","#ff8800","#8800cc","#00cccc","#ff69b4","#808080"],Bje=["#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff","#ff0000","#000080","#008080","#008000","#800080"];function zI(t){let e=!!t.selectedElement,n=e&&t.canEdit,r=e&&t.selectedElement!==null&&ot(t.selectedElement),o=e&&t.selectedElement?.type==="table",i=r||o,s=Lje(t.selectedElement,t.tableEditorState),a=r&&t.selectedElement&&ot(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.color??t.selectedElement.textStyle?.color??"#000000":s?.color??"#000000",l=r&&t.selectedElement&&ot(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.highlightColor??t.selectedElement.textStyle?.highlightColor??"#ffff00":"#ffff00",c=useRef(null),u=useRef(null),d=useCallback(f=>{i&&t.onUpdateTextStyle({color:f});},[i,t]),p=useCallback(f=>{i&&t.onUpdateTextStyle({highlightColor:f});},[i,t]);return jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("div",{className:Ji,children:Aie.map((f,h,m)=>jsx("button",{type:"button",disabled:!n,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let y=s;switch(f.t){case "Bold":t.onUpdateTextStyle({bold:!y?.bold});break;case "Italic":t.onUpdateTextStyle({italic:!y?.italic});break;case "Underline":t.onUpdateTextStyle({underline:!y?.underline});break;case "Strikethrough":t.onUpdateTextStyle({strikethrough:!y?.strikethrough});break}},className:h<m.length-1?Po:Js,title:f.t,children:f.i},f.t))}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.fontSize??18;t.onUpdateTextStyle({fontSize:f+2});},className:Po,title:"Increase Font Size",children:jsx(LuAArrowUp,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.fontSize??18;t.onUpdateTextStyle({fontSize:Math.max(1,f-2)});},className:Po,title:"Decrease Font Size",children:jsx(LuAArrowDown,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{i&&t.onUpdateTextStyle({bold:false,italic:false,underline:false,strikethrough:false,highlightColor:void 0});},className:Js,title:"Clear Formatting",children:jsx(LuRemoveFormatting,{className:Qe})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),className:ft,title:"Font Color",children:[jsx("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M6 20h12M9.5 4h5L18 16H6L9.5 4z"})}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:a}})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 w-36",children:[jsx("div",{className:"grid grid-cols-5 gap-1.5 mb-2",children:Fje.map(f=>jsx("button",{type:"button",className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${a?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:h=>h.preventDefault(),onClick:()=>d(f)},f))}),jsx("button",{type:"button",className:"w-full text-[10px] text-muted-foreground hover:text-foreground py-1 transition-colors",onMouseDown:f=>f.preventDefault(),onClick:()=>c.current?.click(),children:"Custom colour..."}),jsx("input",{ref:c,type:"color",className:"sr-only",value:a,onChange:f=>d(f.target.value)})]})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),className:ft,title:"Text Highlight Color",children:[jsx(LuHighlighter,{className:Qe}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:l}})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 w-36",children:[jsx("div",{className:"grid grid-cols-5 gap-1.5 mb-2",children:Bje.map(f=>jsx("button",{type:"button",className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${l?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:h=>h.preventDefault(),onClick:()=>p(f)},f))}),jsx("button",{type:"button",className:"w-full text-[10px] text-muted-foreground hover:text-foreground py-1 transition-colors",onMouseDown:f=>f.preventDefault(),onClick:()=>u.current?.click(),children:"Custom colour..."}),jsx("input",{ref:u,type:"color",className:"sr-only",value:l,onChange:f=>p(f.target.value)})]})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{!i||!t.selectedElement||t.onUpdateTextStyle({listType:s?.listType==="bullet"?"none":"bullet"});},className:Po,title:"Bullet List",children:jsx(LuList,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{!i||!t.selectedElement||t.onUpdateTextStyle({listType:s?.listType==="numbered"?"none":"numbered"});},className:Js,title:"Numbered List",children:jsx(LuListOrdered,{className:Qe})})]}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:Math.max(0,f-24)});},className:Po,title:"Decrease Indent",children:jsx(LuIndentDecrease,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:f+24});},className:Js,title:"Increase Indent",children:jsx(LuIndentIncrease,{className:Qe})})]}),jsx("div",{className:Ji,children:Pie.map((f,h,m)=>jsx("button",{type:"button",disabled:!n,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!i)return;let v={"Align left":"left","Align center":"center","Align right":"right",Justify:"justify"}[f.t];v&&t.onUpdateTextStyle({align:v});},className:h<m.length-1?Po:Js,title:f.t,children:f.i},f.t))})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Paragraph"})]})]})}function GI(t){let{t:e}=useTranslation();return jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:ft,title:"Normal view",children:"Normal"}),t.onToggleSlideSorter?jsx("button",{className:ft,onClick:t.onToggleSlideSorter,title:"Slide Sorter view",children:"Slide Sorter"}):jsx("button",{className:ft,title:"Slide Sorter view",children:"Slide Sorter"}),jsx("button",{className:ft,title:"Reading View",children:"Reading View"})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Presentation Views"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("div",{className:"flex items-center gap-0.5",children:jsx("button",{onClick:t.onEnterMasterView,disabled:!t.canEdit,className:ft,title:"Edit slide masters and layouts",children:"Slide Master"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Master Views"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("div",{className:"flex items-center gap-0.5",children:t.onZoomToFit&&jsx("button",{className:ft,onClick:t.onZoomToFit,title:"Zoom to fit slide in window",children:"Zoom to Fit"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Zoom"})]}),Un,jsx("button",{onClick:()=>t.onSetEditTemplateMode(!t.editTemplateMode),disabled:!t.canEdit,className:le(ft,t.editTemplateMode?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Toggle template/master element editing",children:t.editTemplateMode?"Templates On":"Templates Off"}),t.onToggleSelectionPane&&jsxs("button",{type:"button",onClick:t.onToggleSelectionPane,className:le(ft,t.isSelectionPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Selection Pane",children:[jsx(LuList,{className:Qe}),"Selection"]}),t.onToggleEyedropper&&jsxs("button",{type:"button",onClick:t.onToggleEyedropper,disabled:!t.canEdit,className:le(ft,t.eyedropperActive?"bg-purple-600 hover:bg-purple-500 text-purple-50":""),title:"Eyedropper \u2014 sample a colour from the slide",children:[jsx(LuPipette,{className:Qe}),"Eyedropper"]}),jsx("button",{onClick:()=>t.onSetShowGrid(!t.showGrid),className:le(ft,t.showGrid?"bg-primary text-white":""),title:e("pptx.grid.toggleGrid"),children:e("pptx.grid.grid")}),jsx("button",{onClick:()=>t.onSetShowRulers(!t.showRulers),className:le(ft,t.showRulers?"bg-primary text-white":""),title:e("pptx.ruler.toggleRulers"),children:e("pptx.ruler.rulers")}),jsx("button",{onClick:()=>t.onSetSnapToGrid(!t.snapToGrid),className:le(ft,t.snapToGrid?"bg-primary text-white":""),title:e("pptx.grid.snapToGrid"),children:e("pptx.grid.snapToGrid")}),jsx("button",{onClick:()=>t.onSetSnapToShape(!t.snapToShape),className:le(ft,t.snapToShape?"bg-primary text-white":""),title:e("pptx.grid.snapToShape"),children:e("pptx.grid.snapToShape")}),jsx("button",{onClick:()=>t.onAddGuide("h"),className:ft,title:"Add horizontal guide",children:"H Guide"}),jsx("button",{onClick:()=>t.onAddGuide("v"),className:ft,title:"Add vertical guide",children:"V Guide"}),jsx("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:le(ft,t.spellCheckEnabled?"bg-primary text-white":""),title:"Toggle spell check",children:"Spell"})]})}function VI({open:t,onClose:e,title:n,children:r,heightFraction:o=.6,fullScreen:i=false,className:s,headerRight:a}){let l=useRef(null),[c,u]=useState(0),d=useRef(null),p=useCallback(x=>{d.current=x.clientY,x.target.setPointerCapture?.(x.pointerId);},[]),f=useCallback(x=>{if(d.current===null)return;let y=x.clientY-d.current;u(Math.max(0,y));},[]),h=useCallback(x=>{if(d.current===null)return;let y=x.clientY-d.current;d.current=null,x.target.releasePointerCapture?.(x.pointerId),y>120&&e(),u(0);},[e]);if(useEffect(()=>{if(!t)return;let x=y=>{y.key==="Escape"&&e();};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[t,e]),!t)return null;let m=i?{height:"calc(100dvh - env(safe-area-inset-top))"}:{height:`${Math.round(o*100)}dvh`};return jsxs("div",{className:"fixed inset-0 z-50 flex flex-col justify-end md:hidden",role:"dialog","aria-modal":"true",children:[jsx("button",{type:"button","aria-label":"Close",className:"absolute inset-0 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150",onClick:e}),jsxs("div",{ref:l,className:le("relative bg-background border-t border-border rounded-t-2xl shadow-2xl flex flex-col overflow-hidden","animate-in slide-in-from-bottom duration-200",s),style:{...m,transform:c>0?`translateY(${c}px)`:void 0,transition:d.current===null?"transform 150ms ease-out":"none"},children:[jsx("div",{className:"flex items-center justify-center pt-2 pb-1 cursor-grab active:cursor-grabbing touch-none",onPointerDown:p,onPointerMove:f,onPointerUp:h,onPointerCancel:h,children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),(n||a)&&jsxs("div",{className:"flex items-center justify-between gap-2 px-4 pb-2 border-b border-border/60",children:[jsx("div",{className:"text-sm font-semibold text-foreground truncate",children:n}),a]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain",children:r})]})]})}var iXe=[{key:"home",label:"Home",icon:LuClipboardCopy},{key:"insert",label:"Insert",icon:LuPlus},{key:"text",label:"Text",icon:LuType},{key:"draw",label:"Draw",icon:LuPaintbrush},{key:"arrange",label:"Arrange",icon:LuShapes},{key:"design",label:"Design",icon:LuLayoutGrid},{key:"transitions",label:"Transitions",icon:LuSparkles},{key:"animations",label:"Animations",icon:LuWand},{key:"slideShow",label:"Slide Show",icon:LuPresentation},{key:"review",label:"Review",icon:LuTextCursorInput},{key:"view",label:"View",icon:LuSettings},{key:"file",label:"File",icon:LuFile}];function $ie(t){let{open:e,onClose:n}=t,[r,o]=useState("home");return jsx(VI,{open:e,onClose:n,fullScreen:true,title:"Menu",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"sticky top-0 z-10 bg-background border-b border-border",children:jsx("div",{className:"flex gap-1.5 overflow-x-auto px-3 py-2 scrollbar-none",children:iXe.map(({key:i,label:s,icon:a})=>jsxs("button",{type:"button",onClick:()=>o(r===i?null:i),className:le("inline-flex items-center gap-1.5 shrink-0 px-3 py-2 rounded-full text-[12px] font-medium border transition-colors min-h-[36px]",r===i?"bg-primary text-white border-primary":"border-border text-muted-foreground hover:text-foreground hover:bg-accent/40"),children:[jsx(a,{className:"w-4 h-4"}),s]},i))})}),jsx("div",{className:"p-3",children:jsx(sXe,{active:r,...t})})]})})}function sXe({active:t,...e}){let n="flex flex-wrap items-center gap-2";switch(t){case "home":return jsx("div",{className:n,children:jsx(UI,{canEdit:e.canEdit,clipboardPayload:e.clipboardPayload,formatPainterActive:e.formatPainterActive,canActivateFormatPainter:e.canActivateFormatPainter,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onToggleFormatPainter:e.onToggleFormatPainter,layoutOptions:e.layoutOptions,onInsertSlideFromLayout:e.onInsertSlideFromLayout,selectedElement:e.selectedElement,onUpdateTextStyle:e.onUpdateTextStyle})});case "insert":return jsx("div",{className:n,children:jsx($I,{canEdit:e.canEdit,newShapeType:e.newShapeType,onSetNewShapeType:e.onSetNewShapeType,onAddTextBox:e.onAddTextBox,onAddShape:e.onAddShape,onAddTable:e.onAddTable,onAddSmartArt:e.onAddSmartArt,onAddEquation:e.onAddEquation,onAddActionButton:e.onAddActionButton,onInsertField:e.onInsertField,onOpenImagePicker:e.onOpenImagePicker,onOpenMediaPicker:e.onOpenMediaPicker})});case "text":return jsx("div",{className:n,children:jsx(zI,{canEdit:e.canEdit,selectedElement:e.selectedElement,tableEditorState:e.tableEditorState,onUpdateTextStyle:e.onUpdateTextStyle})});case "draw":return jsx("div",{className:n,children:jsx(BI,{activeTool:e.activeTool,drawingColor:e.drawingColor,drawingWidth:e.drawingWidth,onSetActiveTool:e.onSetActiveTool,onSetDrawingColor:e.onSetDrawingColor,onSetDrawingWidth:e.onSetDrawingWidth})});case "arrange":return jsx("div",{className:n,children:jsx(II,{canEdit:e.canEdit,selectedElement:e.selectedElement,clipboardPayload:e.clipboardPayload,onAlignElements:e.onAlignElements,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onFlip:e.onFlip,onMoveLayer:e.onMoveLayer,onMoveLayerToEdge:e.onMoveLayerToEdge,onDuplicate:e.onDuplicate,onDelete:e.onDelete,formatPainterActive:e.formatPainterActive,onToggleFormatPainter:e.onToggleFormatPainter,canActivateFormatPainter:e.canActivateFormatPainter})});case "design":return jsx("div",{className:n,children:jsx(NI,{canEdit:e.canEdit,onToggleThemeGallery:e.onToggleThemeGallery,isThemeGalleryOpen:e.isThemeGalleryOpen,onToggleThemeEditor:e.onToggleThemeEditor,isThemeEditorOpen:e.isThemeEditorOpen,onOpenDocumentProperties:e.onOpenDocumentProperties,onToggleInspector:e.onToggleInspector,isInspectorPaneOpen:e.isInspectorPaneOpen})});case "transitions":return jsx("div",{className:n,children:jsx(DI,{isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector})});case "animations":return jsx("div",{className:n,children:jsx(kI,{canEdit:e.canEdit,selectedElement:e.selectedElement,isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector,onOpenAnimationPanel:e.onOpenAnimationPanel,onAddAnimation:e.onAddAnimation,onRemoveAnimation:e.onRemoveAnimation})});case "slideShow":return jsx("div",{className:n,children:jsx(HI,{onPresent:()=>e.onSetMode("present"),onEnterPresenterView:e.onEnterPresenterView??(()=>{}),onEnterRehearsalMode:e.onEnterRehearsalMode??(()=>{}),onOpenSetUpSlideShow:e.onOpenSetUpSlideShow??(()=>{}),onOpenBroadcastDialog:e.onOpenBroadcastDialog??(()=>{}),onToggleSubtitles:e.onToggleSubtitles??(()=>{}),showSubtitles:e.showSubtitles??false,onSetMode:e.onSetMode})});case "review":return jsx("div",{className:n,children:jsx(LI,{canEdit:e.canEdit,spellCheckEnabled:e.spellCheckEnabled,onSetSpellCheckEnabled:e.onSetSpellCheckEnabled,onToggleComments:e.onToggleComments,isCommentsPanelOpen:e.isCommentsPanelOpen,slideCommentCount:e.slideCommentCount,onCompare:e.onCompare})});case "view":return jsx("div",{className:n,children:jsx(GI,{canEdit:e.canEdit,editTemplateMode:e.editTemplateMode,onSetEditTemplateMode:e.onSetEditTemplateMode,spellCheckEnabled:e.spellCheckEnabled,onSetSpellCheckEnabled:e.onSetSpellCheckEnabled,showGrid:e.showGrid,showRulers:e.showRulers,snapToGrid:e.snapToGrid,snapToShape:e.snapToShape,onSetShowGrid:e.onSetShowGrid,onSetShowRulers:e.onSetShowRulers,onSetSnapToGrid:e.onSetSnapToGrid,onSetSnapToShape:e.onSetSnapToShape,onAddGuide:e.onAddGuide,onEnterMasterView:e.onEnterMasterView,isSelectionPaneOpen:e.isSelectionPaneOpen,onToggleSelectionPane:e.onToggleSelectionPane,eyedropperActive:e.eyedropperActive,onToggleEyedropper:e.onToggleEyedropper})});case "file":return jsx("div",{className:n,children:jsx(OI,{onExportPng:e.onExportPng,onExportPdf:e.onExportPdf,onExportVideo:e.onExportVideo,onExportGif:e.onExportGif,onPackageForSharing:e.onPackageForSharing,onSaveAsPptx:e.onSaveAsPptx,onSaveAsPpsx:e.onSaveAsPpsx,onSaveAsPptm:e.onSaveAsPptm,hasMacros:e.hasMacros,onCopySlideAsImage:e.onCopySlideAsImage,onPrint:e.onPrint,onOpenDocumentProperties:e.onOpenDocumentProperties,onOpenPasswordProtection:e.onOpenPasswordProtection,onOpenFontEmbedding:e.onOpenFontEmbedding,onOpenDigitalSignatures:e.onOpenDigitalSignatures})});default:return jsxs("div",{className:"text-center text-sm text-muted-foreground py-8",children:[jsx(LuChevronRight,{className:"w-5 h-5 inline-block opacity-50"})," Select a section above"]})}}function zie(t){let{t:e}=useTranslation(),{mode:n,canUndo:r,canRedo:o,onUndo:i,onRedo:s,onSetMode:a}=t,[l,c]=useState(false),u=n==="edit"||n==="master",d="inline-flex items-center justify-center min-w-[44px] min-h-[44px] rounded-md text-foreground/80 hover:bg-accent/60 disabled:opacity-40 disabled:cursor-not-allowed active:scale-95 transition-transform";return jsxs("div",{role:"toolbar","aria-label":"Toolbar",className:"relative z-20 flex items-center gap-1 px-2 py-1 border-b border-border bg-secondary/50 min-h-[52px] pt-[max(env(safe-area-inset-top),0px)]",children:[u&&jsx("button",{type:"button",onClick:()=>c(true),className:d,title:"Menu","aria-label":"Menu",children:jsx(LuMenu,{className:"w-5 h-5"})}),u&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:i,disabled:!r,className:d,title:e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:s,disabled:!o,className:d,title:e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex-1"}),jsx("button",{type:"button",onClick:()=>a("present"),className:le(d,"text-primary"),title:e("pptx.toolbar.present"),"aria-label":e("pptx.toolbar.present"),children:jsx(LuPresentation,{className:"w-5 h-5"})}),u&&jsx("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:le(d,"bg-primary text-white hover:bg-primary/90 px-3"),title:e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:jsx(LuShare2,{className:"w-4 h-4"})}),jsx($ie,{open:l,onClose:()=>c(false),...t})]})}function Gie({customShows:t,activeCustomShowId:e,canEdit:n,isCurrentSlideInActiveShow:r,onSetActiveCustomShowId:o,onCreateCustomShow:i,onRenameActiveCustomShow:s,onDeleteActiveCustomShow:a,onToggleCurrentSlideInActiveShow:l}){return t.length>0?jsxs(Fragment,{children:[Un,jsxs("select",{value:e??"",onChange:c=>o(c.target.value||null),className:"h-6 px-1.5 text-[11px] rounded bg-muted text-foreground border border-border hover:bg-accent transition-colors cursor-pointer",title:"Custom show","aria-label":"Select custom show",children:[jsx("option",{value:"",children:"All Slides"}),t.map(c=>jsx("option",{value:c.id,children:c.name},c.id))]}),n&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:i,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Create custom show",children:"+ Show"}),e&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:s,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Rename active custom show",children:"Rename"}),jsx("button",{type:"button",onClick:a,className:"px-2 py-1 rounded bg-red-700/80 hover:bg-red-600 text-[11px] transition-colors",title:"Delete active custom show",children:"Delete"}),jsx("button",{type:"button",onClick:l,className:le("px-2 py-1 rounded text-[11px] transition-colors",r?"bg-primary text-white":"bg-muted hover:bg-accent"),title:"Include/exclude current slide in active custom show",children:r?"In Show":"Add Slide"})]})]})]}):n?jsxs(Fragment,{children:[Un,jsx("button",{type:"button",onClick:i,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Create custom show",children:"+ Show"})]}):null}function Vie({isActive:t,onPresent:e,onPresenterView:n,onRehearse:r,onSetUpSlideShow:o,onBroadcast:i,onToggleSubtitles:s,showSubtitles:a}){let[l,c]=useState(false);return jsxs("div",{className:"relative",children:[jsxs("div",{className:"inline-flex border-l border-border",children:[jsx("button",{type:"button",onClick:e,className:le("px-2 py-1 transition-colors",t?"bg-primary text-white":"hover:bg-accent text-foreground"),title:"Present (fullscreen)",children:"Present"}),jsx("button",{type:"button",onClick:()=>c(u=>!u),className:le("px-1 py-1 transition-colors border-l border-border",l?"bg-primary text-white":"hover:bg-accent text-foreground"),title:"Presentation options","aria-label":"Presentation options",children:jsx(LuChevronDown,{className:"w-3 h-3"})})]}),l&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":"Close menu",onClick:()=>c(false)}),jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-52 rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:[jsxs("button",{type:"button",onClick:()=>{c(false),e();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuPlay,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Present"]}),n&&jsxs("button",{type:"button",onClick:()=>{c(false),n();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuMonitor,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Presenter View"]}),r&&jsxs("button",{type:"button",onClick:()=>{c(false),r();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuClock,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Rehearse Timings"]}),jsx("div",{className:"my-1 border-t border-border/60"}),o&&jsxs("button",{type:"button",onClick:()=>{c(false),o();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuSettings,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Set Up Slide Show"]}),i&&jsxs("button",{type:"button",onClick:()=>{c(false),i();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuRadio,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Present Online"]}),s&&jsxs("button",{type:"button",onClick:()=>{c(false),s();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuCaptions,{className:"w-3.5 h-3.5 text-muted-foreground"}),jsx("span",{className:"flex-1 text-left",children:"Subtitles"}),a&&jsx(LuCheck,{className:"w-3 h-3 text-primary"})]})]})]})]})}function jie({mode:t,onSetMode:e,onCloseMasterView:n,onEnterPresenterView:r,onEnterRehearsalMode:o,onOpenSetUpSlideShow:i,onOpenBroadcastDialog:s,onToggleSubtitles:a,showSubtitles:l}){return t==="master"?jsxs("div",{className:"inline-flex items-center gap-1.5",children:[jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm bg-amber-600/90 text-[10px] text-amber-50",children:"Master View"}),jsx("button",{type:"button",onClick:n,className:"px-2 py-0.5 rounded-sm hover:bg-accent text-[10px] text-foreground transition-colors",title:"Close master view",children:"Close"})]}):jsx(Vie,{isActive:t==="present",onPresent:()=>e("present"),onPresenterView:r,onRehearse:o,onSetUpSlideShow:i,onBroadcast:s,onToggleSubtitles:a,showSubtitles:l})}function Xie(t){let e=n=>{t.onSetOverflowMenuOpen(false),{png:t.onExportPng,pdf:t.onExportPdf,video:t.onExportVideo,gif:t.onExportGif,package:t.onPackageForSharing,pptx:t.onSaveAsPptx,ppsx:t.onSaveAsPpsx,pptm:t.onSaveAsPptm,print:t.onPrint,copyImg:t.onCopySlideAsImage,a11y:t.onRunAccessibilityCheck,shortcuts:t.onToggleShortcuts,versionHistory:t.onToggleVersionHistory,documentProperties:t.onOpenDocumentProperties,passwordProtection:t.onOpenPasswordProtection,fontEmbedding:t.onOpenFontEmbedding,digitalSignatures:t.onOpenDigitalSignatures}[n]?.();};return jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>t.onSetOverflowMenuOpen(!t.isOverflowMenuOpen),className:le("p-1.5 rounded transition-colors",t.isOverflowMenuOpen?"bg-primary/80 text-white":"bg-muted hover:bg-accent"),title:"More actions","aria-label":"More actions",children:jsx(LuEllipsis,{className:Qe})}),t.isOverflowMenuOpen&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":"Close menu",onClick:()=>t.onSetOverflowMenuOpen(false)}),jsx("div",{className:"absolute right-0 top-full mt-1 z-50 w-44 rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:Eie.filter(n=>n.k!=="pptm"||t.hasMacros).map(n=>n.k.startsWith("---")?jsx("div",{className:"my-1 border-t border-border/60"},n.k):jsxs("button",{type:"button",onClick:()=>e(n.k),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[n.i,n.l]},n.k))})]})]})}function Wie(t){let{t:e}=useTranslation(),{mode:n,canEdit:r,isSidebarCollapsed:o,isInspectorPaneOpen:i,canUndo:s,canRedo:a,undoLabel:l,redoLabel:c,findReplaceOpen:u,onToggleSidebar:d,onToggleInspector:p,onUndo:f,onRedo:h,onToggleFindReplace:m}=t,x=qi(),y="p-1 max-md:p-2 max-md:min-h-[40px] max-md:min-w-[40px] rounded-sm transition-colors hover:bg-accent/60 disabled:opacity-40 disabled:cursor-not-allowed active:scale-90 active:opacity-70";return jsxs("div",{className:"flex items-center gap-0.5 max-md:gap-0 px-1.5 py-0.5 max-md:px-1",children:[n!=="present"&&jsx("button",{type:"button",onClick:d,className:le(y,o?"text-muted-foreground":"text-foreground"),title:e("pptx.toolbar.toggleSlidesPanel"),"aria-label":e("pptx.toolbar.toggleSlidesPanel"),children:jsx(LuPanelLeft,{className:Qe})}),Un,jsx("button",{type:"button",onClick:f,disabled:!r||!s,className:le(y,"text-muted-foreground"),title:l?e("pptx.toolbar.undoAction",{action:l}):e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:lr})}),jsx("button",{type:"button",onClick:h,disabled:!r||!a,className:le(y,"text-muted-foreground"),title:c?e("pptx.toolbar.redoAction",{action:c}):e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:lr})}),(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:m,className:le(y,"max-md:hidden",u?"text-foreground":"text-muted-foreground"),title:e("pptx.findReplace.title"),"aria-label":e("pptx.findReplace.title"),children:jsx(LuSearch,{className:lr})}),jsx("div",{className:"flex-1 min-w-2 max-md:min-w-1"}),(n==="edit"||n==="master")&&jsxs("button",{type:"button",onClick:t.onToggleComments,className:le(y,"relative max-md:hidden",t.isCommentsPanelOpen?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.comments"),"aria-label":e("pptx.toolbar.comments"),children:[jsx(LuMessageSquare,{className:lr}),(t.slideCommentCount??0)>0&&jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center w-3.5 h-3.5 rounded-full bg-primary text-[8px] text-white leading-none",children:t.slideCommentCount})]}),x&&(x.status==="connected"||x.status==="connecting")&&x.remoteUsers.length>0&&jsxs("button",{type:"button",onClick:t.onOpenShareDialog,className:"flex items-center -space-x-1.5 mx-1 rounded-sm px-1 py-0.5 hover:bg-accent/60 transition-colors cursor-pointer",title:e("pptx.toolbar.sharingUsers",{count:x.connectedCount}),children:[x.remoteUsers.slice(0,4).map(v=>jsx("div",{className:"w-6 h-6 rounded-full border-2 border-background flex items-center justify-center text-[8px] font-semibold text-white shrink-0",style:{backgroundColor:v.userColor},title:v.userName,children:v.userAvatar?jsx("img",{src:v.userAvatar,alt:v.userName,className:"w-full h-full rounded-full object-cover"}):v.userName.slice(0,2).toUpperCase()},v.clientId)),x.remoteUsers.length>4&&jsxs("div",{className:"w-6 h-6 rounded-full border-2 border-background bg-muted flex items-center justify-center text-[8px] text-muted-foreground shrink-0",children:["+",x.remoteUsers.length-4]})]}),jsx(jie,{mode:t.mode,onSetMode:t.onSetMode,onCloseMasterView:t.onCloseMasterView,onToggleSlideSorter:t.onToggleSlideSorter,onEnterPresenterView:t.onEnterPresenterView,onEnterRehearsalMode:t.onEnterRehearsalMode,onOpenSetUpSlideShow:t.onOpenSetUpSlideShow,onOpenBroadcastDialog:t.onOpenBroadcastDialog,onToggleSubtitles:t.onToggleSubtitles,showSubtitles:t.showSubtitles}),jsx(Gie,{customShows:t.customShows,activeCustomShowId:t.activeCustomShowId,canEdit:t.canEdit,isCurrentSlideInActiveShow:t.isCurrentSlideInActiveShow,onSetActiveCustomShowId:t.onSetActiveCustomShowId,onCreateCustomShow:t.onCreateCustomShow,onRenameActiveCustomShow:t.onRenameActiveCustomShow,onDeleteActiveCustomShow:t.onDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:t.onToggleCurrentSlideInActiveShow}),Un,(n==="edit"||n==="master")&&jsxs("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:le("relative inline-flex items-center gap-1 px-2.5 py-1 rounded-sm text-[11px] font-medium transition-colors",x&&x.status==="connected"?"bg-green-600 hover:bg-green-500 text-white":"bg-primary hover:bg-primary/90 text-white"),title:x&&x.status==="connected"?e("pptx.toolbar.sharingUsers",{count:x.connectedCount}):e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:[jsx(LuShare2,{className:"w-3 h-3"}),jsx("span",{className:"max-md:hidden",children:x&&x.status==="connected"?e("pptx.toolbar.sharingCount",{count:x.connectedCount}):e("pptx.toolbar.share")})]}),(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:p,className:le(y,i?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.toggleInspector"),"aria-label":e("pptx.toolbar.toggleInspector"),children:jsx(LuPanelRight,{className:Qe})}),jsx("button",{type:"button",onClick:t.onOpenSettings??t.onToggleShortcuts,className:le(y,"text-muted-foreground"),title:e("pptx.toolbar.settingsShortcuts"),"aria-label":e("pptx.toolbar.settings"),children:jsx(LuSettings,{className:lr})}),!r&&jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm bg-amber-600/90 text-[10px] text-amber-50",children:e("pptx.toolbar.readOnly")}),jsx(Xie,{...t})]})}function R8(t){let{mode:e,isNarrowViewport:n,isCompactToolbarOpen:r,toolbarSection:o,onSetToolbarSection:i}=t;if(n&&e!=="present")return jsx(zie,{...t});let s=o==="file",a=o==="home",l=o==="insert",c=a||o==="text",u=o==="arrange",d=o==="draw",p=o==="design",f=o==="transitions",h=o==="animations",m=o==="slideShow",x=o==="review",y=o==="view",v=o==="help",S=e==="edit"||e==="master";return jsxs("div",{role:"toolbar","aria-label":"Presentation toolbar",className:"relative z-20 border-b border-border bg-secondary/50 overflow-visible",children:[jsx(Wie,{...t}),S&&jsxs("div",{className:"flex items-center border-b border-border/60 px-1 max-md:overflow-x-auto max-md:scrollbar-none",children:[LW.map(w=>jsx("button",{type:"button",onClick:()=>i(w.id),className:le("relative px-3.5 py-2 text-[12px] font-medium whitespace-nowrap transition-colors max-md:min-h-[36px] max-md:px-3",o===w.id?w.id==="file"?"text-white bg-primary/80 rounded-sm":"text-foreground after:absolute after:-bottom-px after:left-0 after:right-0 after:h-[2.5px] after:bg-primary":w.id==="file"?"text-primary hover:bg-primary/15 rounded-sm":"text-muted-foreground hover:text-foreground hover:bg-accent/30"),children:w.label},w.id)),jsx("div",{className:"flex-1"}),n&&jsx("button",{type:"button",onClick:t.onToggleCompactToolbar,className:le("px-2 py-1 rounded text-[11px] transition-colors mr-1",r?"bg-primary/80 text-white":"text-muted-foreground hover:text-foreground"),title:"Toggle ribbon",children:r?"Collapse":"Expand"})]}),S&&jsxs("div",{className:le("flex items-center gap-1.5 px-2 py-1 max-md:px-1 max-md:py-0.5 overflow-visible flex-nowrap",n&&!r&&"hidden"),children:[s&&jsx(OI,{onExportPng:t.onExportPng,onExportPdf:t.onExportPdf,onExportVideo:t.onExportVideo,onExportGif:t.onExportGif,onPackageForSharing:t.onPackageForSharing,onSaveAsPptx:t.onSaveAsPptx,onSaveAsPpsx:t.onSaveAsPpsx,onSaveAsPptm:t.onSaveAsPptm,hasMacros:t.hasMacros,onCopySlideAsImage:t.onCopySlideAsImage,onPrint:t.onPrint,onOpenDocumentProperties:t.onOpenDocumentProperties,onOpenPasswordProtection:t.onOpenPasswordProtection,onOpenFontEmbedding:t.onOpenFontEmbedding,onOpenDigitalSignatures:t.onOpenDigitalSignatures}),a&&jsx(UI,{canEdit:t.canEdit,clipboardPayload:t.clipboardPayload,formatPainterActive:t.formatPainterActive,canActivateFormatPainter:t.canActivateFormatPainter,onCopy:t.onCopy,onCut:t.onCut,onPaste:t.onPaste,onToggleFormatPainter:t.onToggleFormatPainter,layoutOptions:t.layoutOptions,onInsertSlideFromLayout:t.onInsertSlideFromLayout,selectedElement:t.selectedElement,onUpdateTextStyle:t.onUpdateTextStyle}),l&&jsx($I,{canEdit:t.canEdit,newShapeType:t.newShapeType,onSetNewShapeType:t.onSetNewShapeType,onAddTextBox:t.onAddTextBox,onAddShape:t.onAddShape,onAddTable:t.onAddTable,onAddSmartArt:t.onAddSmartArt,onAddEquation:t.onAddEquation,onAddActionButton:t.onAddActionButton,onInsertField:t.onInsertField,onOpenImagePicker:t.onOpenImagePicker,onOpenMediaPicker:t.onOpenMediaPicker}),c&&jsx(zI,{canEdit:t.canEdit,selectedElement:t.selectedElement,tableEditorState:t.tableEditorState,onUpdateTextStyle:t.onUpdateTextStyle}),d&&jsx(BI,{activeTool:t.activeTool,drawingColor:t.drawingColor,drawingWidth:t.drawingWidth,onSetActiveTool:t.onSetActiveTool,onSetDrawingColor:t.onSetDrawingColor,onSetDrawingWidth:t.onSetDrawingWidth}),u&&jsx(II,{canEdit:t.canEdit,selectedElement:t.selectedElement,clipboardPayload:t.clipboardPayload,onAlignElements:t.onAlignElements,onCopy:t.onCopy,onCut:t.onCut,onPaste:t.onPaste,onFlip:t.onFlip,onMoveLayer:t.onMoveLayer,onMoveLayerToEdge:t.onMoveLayerToEdge,onDuplicate:t.onDuplicate,onDelete:t.onDelete,formatPainterActive:t.formatPainterActive,onToggleFormatPainter:t.onToggleFormatPainter,canActivateFormatPainter:t.canActivateFormatPainter}),p&&jsx(NI,{canEdit:t.canEdit,onToggleThemeGallery:t.onToggleThemeGallery,isThemeGalleryOpen:t.isThemeGalleryOpen,onToggleThemeEditor:t.onToggleThemeEditor,isThemeEditorOpen:t.isThemeEditorOpen,onOpenDocumentProperties:t.onOpenDocumentProperties,onToggleInspector:t.onToggleInspector,isInspectorPaneOpen:t.isInspectorPaneOpen}),f&&jsx(DI,{isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector}),h&&jsx(kI,{canEdit:t.canEdit,selectedElement:t.selectedElement,isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector,onOpenAnimationPanel:t.onOpenAnimationPanel,onAddAnimation:t.onAddAnimation,onRemoveAnimation:t.onRemoveAnimation}),m&&jsx(HI,{onPresent:()=>t.onSetMode("present"),onEnterPresenterView:t.onEnterPresenterView??(()=>{}),onEnterRehearsalMode:t.onEnterRehearsalMode??(()=>{}),onOpenSetUpSlideShow:t.onOpenSetUpSlideShow??(()=>{}),onOpenBroadcastDialog:t.onOpenBroadcastDialog??(()=>{}),onToggleSubtitles:t.onToggleSubtitles??(()=>{}),showSubtitles:t.showSubtitles??false,onSetMode:t.onSetMode}),x&&jsx(LI,{canEdit:t.canEdit,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,onToggleComments:t.onToggleComments,isCommentsPanelOpen:t.isCommentsPanelOpen,slideCommentCount:t.slideCommentCount,onCompare:t.onCompare}),y&&jsx(GI,{canEdit:t.canEdit,editTemplateMode:t.editTemplateMode,onSetEditTemplateMode:t.onSetEditTemplateMode,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,showGrid:t.showGrid,showRulers:t.showRulers,snapToGrid:t.snapToGrid,snapToShape:t.snapToShape,onSetShowGrid:t.onSetShowGrid,onSetShowRulers:t.onSetShowRulers,onSetSnapToGrid:t.onSetSnapToGrid,onSetSnapToShape:t.onSetSnapToShape,onAddGuide:t.onAddGuide,onEnterMasterView:t.onEnterMasterView,isSelectionPaneOpen:t.isSelectionPaneOpen,onToggleSelectionPane:t.onToggleSelectionPane,eyedropperActive:t.eyedropperActive,onToggleEyedropper:t.onToggleEyedropper}),v&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:t.onToggleShortcuts,className:ft,title:"Keyboard shortcuts",children:"Keyboard Shortcuts"}),jsx("button",{type:"button",onClick:t.onRunAccessibilityCheck,className:ft,title:"Accessibility check",children:"Accessibility"})]})]})]})}var WI="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",$p="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",Yie=gE.filter(t=>t.value==="fadeIn"||t.value==="flyIn"||t.value==="zoomIn"),qie=gE.filter(t=>t.value==="fadeOut"||t.value==="flyOut"||t.value==="zoomOut"),Kie=gE.filter(t=>t.value==="spin"||t.value==="pulse"||t.value==="colorWave"||t.value==="bounce"||t.value==="flash"||t.value==="growShrink"||t.value==="teeter"),Zie=[{value:"onClick",labelKey:"pptx.animation.trigger.onClick"},{value:"onShapeClick",labelKey:"pptx.animation.trigger.onShapeClick"},{value:"onHover",labelKey:"pptx.animation.trigger.onHover"},{value:"afterPrevious",labelKey:"pptx.animation.trigger.afterPrevious"},{value:"withPrevious",labelKey:"pptx.animation.trigger.withPrevious"}],Jie=[{value:"ease",labelKey:"pptx.animation.timingCurve.ease"},{value:"ease-in",labelKey:"pptx.animation.timingCurve.easeIn"},{value:"ease-out",labelKey:"pptx.animation.timingCurve.easeOut"},{value:"linear",labelKey:"pptx.animation.timingCurve.linear"}],Qie=[{value:"none",labelKey:"pptx.animation.repeatUntil.none"},{value:"untilNextClick",labelKey:"pptx.animation.repeatUntil.untilNextClick"},{value:"untilEndOfSlide",labelKey:"pptx.animation.repeatUntil.untilEndOfSlide"}],ese=[{value:"fromTop",labelKey:"pptx.animation.direction.fromTop",icon:LuArrowDown},{value:"fromBottom",labelKey:"pptx.animation.direction.fromBottom",icon:LuArrowUp},{value:"fromLeft",labelKey:"pptx.animation.direction.fromLeft",icon:LuArrowRight},{value:"fromRight",labelKey:"pptx.animation.direction.fromRight",icon:LuArrowLeft}],tse=[{value:"asOne",labelKey:"pptx.animation.sequence.asOne"},{value:"byParagraph",labelKey:"pptx.animation.sequence.byParagraph"},{value:"byWord",labelKey:"pptx.animation.sequence.byWord"},{value:"byLetter",labelKey:"pptx.animation.sequence.byLetter"}];function WXe(t){return t.entrance?"bg-green-500/60":t.emphasis?"bg-yellow-500/60":t.exit?"bg-red-500/60":"bg-muted-foreground/40"}function YXe(t){return t.entrance??t.emphasis??t.exit??"custom"}function rse({selectedElementId:t,canEdit:e,handlers:n}){let{t:r}=useTranslation(),{sortedAnimations:o,dragIndex:i,dragOverIndex:s,timelineBarData:a,handleAnimationHover:l,handleAnimationHoverEnd:c,handleDragStart:u,handleDragOver:d,handleDragEnter:p,handleDragLeave:f,handleDrop:h,handleDragEnd:m,handleMoveUp:x,handleMoveDown:y,getTimelineLabel:v}=n;return o.length===0&&a.length===0?null:jsxs(Fragment,{children:[a.length>0&&jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-1",children:r("pptx.animation.timelineBar")}),jsx("div",{className:"relative h-6 rounded bg-muted/50 border border-border overflow-hidden",children:a.map(S=>jsx("div",{className:le("absolute top-0.5 bottom-0.5 rounded-sm transition-colors",WXe(S.anim),S.anim.elementId===t&&"ring-1 ring-primary"),style:{left:`${S.leftPercent}%`,width:`${Math.max(S.widthPercent,2)}%`},title:`${v(S.anim)} - ${YXe(S.anim)} (${S.anim.durationMs??500}ms)`,onMouseEnter:()=>l(S.anim),onMouseLeave:c},S.anim.elementId))})]}),o.length>0&&jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-1",children:r("pptx.animation.timeline")}),jsx("div",{className:"space-y-0.5 max-h-40 overflow-y-auto",children:o.map((S,w)=>{let C=t===S.elementId;return jsxs("div",{draggable:e,onDragStart:M=>u(w,M),onDragOver:M=>d(w,M),onDragEnter:()=>p(w),onDragLeave:f,onDrop:M=>h(w,M),onDragEnd:m,onMouseEnter:()=>l(S),onMouseLeave:c,className:le("flex items-center gap-1 px-1 py-0.5 rounded text-[10px] cursor-grab transition-colors",C?"bg-primary/30 text-primary":"bg-muted/50 text-muted-foreground",i===w&&"opacity-40",s===w&&"border-t-2 border-primary"),children:[e&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground/50 shrink-0"}),jsxs("span",{className:"text-muted-foreground w-4 shrink-0",children:[w+1,"."]}),jsx("span",{className:"truncate flex-1",children:v(S)}),S.entrance&&jsx(LuMoveRight,{className:"w-3 h-3 text-green-400/70 shrink-0"}),S.emphasis&&jsx(LuRotateCw,{className:"w-3 h-3 text-yellow-400/70 shrink-0"}),S.exit&&jsx(LuMoveRight,{className:"w-3 h-3 text-red-400/70 rotate-180 shrink-0"}),e&&jsxs("div",{className:"flex gap-0.5 shrink-0",children:[jsx("button",{type:"button",disabled:w===0,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:M=>{M.stopPropagation(),x(w);},title:r("pptx.animation.moveUp"),children:jsx(LuChevronUp,{className:"w-3 h-3"})}),jsx("button",{type:"button",disabled:w===o.length-1,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:M=>{M.stopPropagation(),y(w);},title:r("pptx.animation.moveDown"),children:jsx(LuChevronDown,{className:"w-3 h-3"})})]})]},S.elementId)})})]})]})}var k8=new Set(["flyIn","flyOut"]);function ise({canEdit:t,updateAnimations:e}){let[n,r]=useState(null),[o,i]=useState(null),s=useRef(0),a=useCallback((x,y)=>{t&&(r(x),y.dataTransfer.effectAllowed="move",y.dataTransfer.setData("text/plain",String(x)));},[t]),l=useCallback((x,y)=>{y.preventDefault(),y.dataTransfer.dropEffect="move",i(x);},[]),c=useCallback(x=>{s.current++,i(x);},[]),u=useCallback(()=>{s.current--,s.current<=0&&(i(null),s.current=0);},[]),d=useCallback((x,y)=>{e(v=>{let S=[...v].sort((C,T)=>(C.order??0)-(T.order??0)),[w]=S.splice(x,1);return S.splice(y,0,w),S.map((C,T)=>({...C,order:T}))});},[e]),p=useCallback((x,y)=>{y.preventDefault(),s.current=0;let v=n;r(null),i(null),!(v===null||v===x)&&d(v,x);},[n,d]),f=useCallback(()=>{r(null),i(null),s.current=0;},[]),h=useCallback(x=>{x<=0||d(x,x-1);},[d]),m=useCallback(x=>{e(y=>{let v=[...y].sort((w,C)=>(w.order??0)-(C.order??0));if(x>=v.length-1)return y;let S=v[x+1];return v[x+1]=v[x],v[x]=S,v.map((w,C)=>({...w,order:C}))});},[e]);return {dragIndex:n,dragOverIndex:o,handleDragStart:a,handleDragOver:l,handleDragEnter:c,handleDragLeave:u,handleDrop:p,handleDragEnd:f,handleMoveUp:h,handleMoveDown:m}}function sse({selectedElementId:t,selectedElementAnimation:e}){let n=useCallback(i=>{let s=i.entrance??i.emphasis??i.exit;!s||s==="none"||oU(i.elementId,s,{direction:i.direction,durationMs:i.durationMs??500,timingCurve:i.timingCurve});},[]),r=useCallback(()=>iU(),[]),o=useCallback(()=>{if(!e)return;let i=e.entrance??e.emphasis??e.exit;!i||i==="none"||oU(t,i,{direction:e.direction,durationMs:e.durationMs??500,timingCurve:e.timingCurve});},[t,e]);return {handleAnimationHover:n,handleAnimationHoverEnd:r,handlePreviewClick:o}}function ase({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let o=useMemo(()=>(e.animations??[]).find(k=>k.elementId===t.id),[e,t]),i=useMemo(()=>[...e.animations??[]].sort((k,N)=>(k.order??0)-(N.order??0)),[e.animations]),s=useCallback(k=>{if(!n)return;let N=e.animations??[];r({animations:k([...N])});},[n,e.animations,r]),a=useCallback((k,N)=>{s(F=>F.map(B=>B.elementId===t.id?{...B,[k]:N}:B));},[s,t.id]),l=useCallback((k,N,F)=>{n&&s(B=>{let D=B.findIndex(U=>U.elementId===t.id),O=k||N||F;if(D>=0){if(!O)return B.filter(U=>U.elementId!==t.id);B[D]={...B[D],entrance:k,exit:N,emphasis:F};}else O&&B.push({elementId:t.id,entrance:k,exit:N,emphasis:F,durationMs:500,order:B.length,trigger:"onClick"});return B});},[n,s,t.id]),c=useCallback(k=>{let N=k.target.value;l(N==="none"?void 0:N,o?.exit,o?.emphasis);},[l,o]),u=useCallback(k=>{let N=k.target.value;l(o?.entrance,N==="none"?void 0:N,o?.emphasis);},[l,o]),d=useCallback(k=>{let N=k.target.value;l(o?.entrance,o?.exit,N==="none"?void 0:N);},[l,o]),p=useCallback(k=>{let N=k.target.value;a("trigger",N),N!=="onShapeClick"&&a("triggerShapeId",void 0);},[a]),f=useCallback(k=>a("triggerShapeId",k.target.value||void 0),[a]),h=useCallback(k=>a("timingCurve",k.target.value),[a]),m=useCallback(k=>a("durationMs",Math.max(100,Math.min(1e4,Number(k.target.value)||450))),[a]),x=useCallback(k=>a("delayMs",Math.max(0,Math.min(1e4,Number(k.target.value)||0))),[a]),y=useCallback(k=>a("repeatCount",Math.max(1,Math.min(100,Number(k.target.value)||1))),[a]),v=useCallback(k=>{let N=k.target.value;a("repeatMode",N==="none"?void 0:N);},[a]),S=useCallback(k=>a("direction",k),[a]),w=useCallback(k=>a("sequence",k.target.value),[a]),C=sse({selectedElementId:t.id,selectedElementAnimation:o}),T=ise({canEdit:n,updateAnimations:s}),E=useCallback(k=>{let N=e.elements?.find(B=>B.id===k.elementId);return N?(ot(N)?N.text:void 0)||cs(N):k.elementId.slice(0,8)},[e.elements]),M=!!(o?.entrance||o?.exit||o?.emphasis),A=M&&(k8.has(o?.entrance??"")||k8.has(o?.exit??"")),R=useMemo(()=>{if(i.length===0)return [];let k=0,N=i.map(B=>{let D=B.delayMs??0,O=B.durationMs??500,U=D+O;return U>k&&(k=U),{anim:B,startMs:D,durationMs:O,endMs:U}}),F=Math.max(k,1);return N.map(B=>({anim:B.anim,leftPercent:B.startMs/F*100,widthPercent:B.durationMs/F*100}))},[i]);return {selectedElementAnimation:o,sortedAnimations:i,hasAnimation:M,showDirectionPicker:A,timelineBarData:R,handleEntranceChange:c,handleExitChange:u,handleEmphasisChange:d,handleTriggerChange:p,handleTriggerShapeChange:f,handleTimingCurveChange:h,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:y,handleRepeatModeChange:v,handleDirectionChange:S,handleSequenceChange:w,getTimelineLabel:E,...C,...T}}function lse({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=ase({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}),{selectedElementAnimation:s,hasAnimation:a,showDirectionPicker:l,handleEntranceChange:c,handleExitChange:u,handleEmphasisChange:d,handleTriggerChange:p,handleTriggerShapeChange:f,handleTimingCurveChange:h,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:y,handleRepeatModeChange:v,handleDirectionChange:S,handleSequenceChange:w,handlePreviewClick:C}=i;return jsxs("div",{className:"rounded border border-border bg-card p-2 space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:o("pptx.animation.title")}),a&&jsxs("button",{type:"button",className:"flex items-center gap-1 text-[10px] text-primary hover:text-primary/80 transition-colors",onClick:C,title:o("pptx.animation.preview"),children:[jsx(LuPlay,{className:"w-3 h-3"}),o("pptx.animation.preview")]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.entrance")}),jsxs("select",{value:s?.entrance??"none",onChange:c,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Yie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.emphasis")}),jsxs("select",{value:s?.emphasis??"none",onChange:d,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Kie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.exit")}),jsxs("select",{value:s?.exit??"none",onChange:u,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),qie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),a&&jsxs(Fragment,{children:[l&&jsxs("div",{className:"pt-1 border-t border-border",children:[jsx("span",{className:"text-muted-foreground text-[11px] block mb-1",children:o("pptx.animation.direction")}),jsx("div",{className:"flex gap-1",children:ese.map(T=>{let E=T.icon,M=s?.direction===T.value;return jsx("button",{type:"button",disabled:!n,className:le("flex items-center justify-center w-7 h-7 rounded border transition-colors",M?"border-primary bg-primary/20 text-primary":"border-border bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>S(T.value),title:o(T.labelKey),children:jsx(E,{className:"w-3.5 h-3.5"})},T.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.sequence")}),jsx("select",{value:s?.sequence??"asOne",onChange:w,disabled:!n,className:$p,children:tse.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground pt-1 border-t border-border",children:o("pptx.animation.timing")}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.trigger")}),jsx("select",{value:s?.trigger??"onClick",onChange:p,disabled:!n,className:$p,children:Zie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),s?.trigger==="onShapeClick"&&jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.trigger.shapeLabel")}),jsxs("select",{value:s?.triggerShapeId??"",onChange:f,disabled:!n,className:$p,children:[jsx("option",{value:"",children:o("pptx.animation.trigger.selectShape")}),e.elements.filter(T=>T.id!==t.id).map(T=>jsx("option",{value:T.id,children:cs(T)},T.id))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.duration")}),jsx("input",{type:"number",min:100,max:1e4,step:50,disabled:!n,value:s?.durationMs??450,onChange:m,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.delay")}),jsx("input",{type:"number",min:0,max:1e4,step:50,disabled:!n,value:s?.delayMs??0,onChange:x,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.timingCurve")}),jsx("select",{value:s?.timingCurve??"ease",onChange:h,disabled:!n,className:$p,children:Jie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.repeatCount")}),jsx("input",{type:"number",min:1,max:100,step:1,disabled:!n,value:s?.repeatCount??1,onChange:y,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.repeatUntil")}),jsx("select",{value:s?.repeatMode??"none",onChange:v,disabled:!n,className:$p,children:Qie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]})]}),jsx(rse,{selectedElementId:t.id,canEdit:n,handlers:i})]})}var cse=[{key:"elements",label:"Elements",icon:LuLayers},{key:"properties",label:"Properties",icon:LuSettings2},{key:"comments",label:"Comments",icon:LuMessageSquare}],hn="text-[11px] uppercase tracking-wide text-muted-foreground",xn="rounded border border-border bg-card p-2 space-y-2",Fn="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",Xr="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",use=[["X","x"],["Y","y"],["W","width"],["H","height"]];var oWe=[{value:"none",label:"None"},{value:"url",label:"Go to URL"},{value:"slide",label:"Go to Slide"},{value:"firstSlide",label:"First Slide"},{value:"lastSlide",label:"Last Slide"},{value:"prevSlide",label:"Previous Slide"},{value:"nextSlide",label:"Next Slide"},{value:"endShow",label:"End Show"}];function pse({selectedElement:t,slides:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.actionClick?R5(t.actionClick,"click"):void 0,s=t.actionHover?R5(t.actionHover,"hover"):void 0,a=i?.type??"none",l=s?.type??"none",c=(u,d,p,f)=>{let m=iE({type:d,url:p,slideIndex:f});r(u==="click"?{actionClick:m}:{actionHover:m});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.action.title","Action")}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx(dse,{label:o("pptx.action.onClick","On Click"),trigger:"click",activeType:a,action:i,fallbackUrl:t.actionClick?.url,fallbackSlideIndex:t.actionClick?.targetSlideIndex,canEdit:n,slideCount:e.length,onChangeType:u=>c("click",u,i?.url,i?.slideIndex),onChangeUrl:u=>c("click","url",u),onChangeSlide:u=>c("click","slide",void 0,u)}),jsx(dse,{label:o("pptx.action.onHover","On Hover"),trigger:"hover",activeType:l,action:s,fallbackUrl:t.actionHover?.url,fallbackSlideIndex:t.actionHover?.targetSlideIndex,canEdit:n,slideCount:e.length,onChangeType:u=>c("hover",u,s?.url,s?.slideIndex),onChangeUrl:u=>c("hover","url",u),onChangeSlide:u=>c("hover","slide",void 0,u)})]})]})}function dse({label:t,activeType:e,action:n,fallbackUrl:r,fallbackSlideIndex:o,canEdit:i,slideCount:s,onChangeType:a,onChangeUrl:l,onChangeSlide:c}){return jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-muted-foreground font-medium",children:t}),jsx("select",{disabled:!i,className:le(Fn,"w-full"),value:e,onChange:u=>a(u.target.value),children:oWe.map(u=>jsx("option",{value:u.value,children:u.label},u.value))}),e==="url"&&jsx("input",{type:"text",disabled:!i,className:le(Fn,"w-full"),placeholder:"https://...",value:n?.url??r??"",onChange:u=>l(u.target.value)}),e==="slide"&&jsx("input",{type:"number",disabled:!i,className:le(Fn,"w-full"),placeholder:"Slide number (1-based)",min:1,max:s,value:(n?.slideIndex??o??0)+1,onChange:u=>{let d=Number(u.target.value);Number.isFinite(d)&&c(Math.max(0,d-1));}})]})}var Bv="text-[11px] uppercase tracking-wide text-muted-foreground",Ov="rounded border border-border bg-card p-2 space-y-2",Uv="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",L8="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",YI="bg-muted border border-border rounded px-1 py-0.5 text-[11px] w-full text-center",fse=[{value:"bar",labelKey:"pptx.chart.typeBar"},{value:"line",labelKey:"pptx.chart.typeLine"},{value:"pie",labelKey:"pptx.chart.typePie"},{value:"doughnut",labelKey:"pptx.chart.typeDoughnut"},{value:"area",labelKey:"pptx.chart.typeArea"},{value:"scatter",labelKey:"pptx.chart.typeScatter"},{value:"bubble",labelKey:"pptx.chart.typeBubble"},{value:"radar",labelKey:"pptx.chart.typeRadar"},{value:"stock",labelKey:"pptx.chart.typeStock"},{value:"waterfall",labelKey:"pptx.chart.typeWaterfall"},{value:"combo",labelKey:"pptx.chart.typeCombo"}],hse=[{value:"clustered",labelKey:"pptx.chart.groupingClustered"},{value:"stacked",labelKey:"pptx.chart.groupingStacked"},{value:"percentStacked",labelKey:"pptx.chart.groupingPercentStacked"}],mse=[{value:"t",labelKey:"pptx.chart.legendTop"},{value:"b",labelKey:"pptx.chart.legendBottom"},{value:"l",labelKey:"pptx.chart.legendLeft"},{value:"r",labelKey:"pptx.chart.legendRight"}],gse=new Set(["bar","line","area"]);function bse({series:t,categories:e,canEdit:n,onUpdateSeries:r,onUpdateCategoryLabel:o,onUpdateValue:i,onAddCategory:s,onRemoveCategory:a,onAddSeries:l,onRemoveSeries:c}){let{t:u}=useTranslation();return jsxs("div",{className:Ov,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:Bv,children:u("pptx.chart.data")}),n&&jsxs("div",{className:"flex gap-1",children:[jsxs("button",{type:"button",className:L8,title:u("pptx.chart.addCategory"),onClick:s,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),u("pptx.chart.cat")]}),jsxs("button",{type:"button",className:L8,title:u("pptx.chart.addSeries"),onClick:l,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),u("pptx.chart.seriesShort")]})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full text-[11px] border-collapse",children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{className:"text-muted-foreground p-0.5 text-left min-w-[60px]"}),t.map((d,p)=>jsx("th",{className:"p-0.5 font-normal min-w-[72px]",children:jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("input",{type:"text",disabled:!n,className:YI,value:d.name,onChange:f=>r(p,{name:f.target.value})}),n&&t.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:u("pptx.chart.removeSeries"),onClick:()=>c(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})},p))]})}),jsx("tbody",{children:e.map((d,p)=>jsxs("tr",{children:[jsx("td",{className:"p-0.5",children:jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("input",{type:"text",disabled:!n,className:YI,value:d,onChange:f=>o(p,f.target.value)}),n&&e.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:u("pptx.chart.removeCategory"),onClick:()=>a(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})}),t.map((f,h)=>jsx("td",{className:"p-0.5",children:jsx("input",{type:"number",disabled:!n,className:YI,value:f.values[p]??0,onChange:m=>i(h,p,m.target.value)})},h))]},p))})]})})]})}function vse({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:Ov,children:[jsx("div",{className:Bv,children:r("pptx.chart.display")}),jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasTitle??false,onChange:o=>n({hasTitle:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showTitle")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasLegend??false,onChange:o=>n({hasLegend:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showLegend")})]}),t?.hasLegend&&jsxs("label",{className:"flex items-center gap-2 text-[11px] ml-4",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:r("pptx.chart.legendPosition")}),jsx("select",{disabled:!e,className:Uv,value:t.legendPosition??"b",onChange:o=>n({legendPosition:o.target.value}),children:mse.map(o=>jsx("option",{value:o.value,children:r(o.labelKey)},o.value))})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasGridlines??false,onChange:o=>n({hasGridlines:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showGridlines")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasDataLabels??false,onChange:o=>n({hasDataLabels:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showDataLabels")})]})]})]})}function Sse({title:t,chartType:e,grouping:n,seriesCount:r,categoryCount:o,canEdit:i,onUpdateChartData:s}){let{t:a}=useTranslation(),l=gse.has(e);return jsxs("div",{className:Ov,children:[jsx("div",{className:Bv,children:a("pptx.chart.heading")}),jsxs("div",{className:"text-[11px] text-muted-foreground mb-1",children:[r," ",a("pptx.chart.series")," \xB7 ",o," ",a("pptx.chart.categories")]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.title")}),jsx("input",{type:"text",disabled:!i,className:Uv,value:t??"",onChange:c=>s({title:c.target.value})})]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.type")}),jsx("select",{disabled:!i,className:Uv,value:e,onChange:c=>s({chartType:c.target.value}),children:fse.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]}),l&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.grouping")}),jsx("select",{disabled:!i,className:Uv,value:n??"clustered",onChange:c=>s({grouping:c.target.value}),children:hse.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]})]})}function wse({selectedElement:t,canEdit:e,onUpdateElement:n}){let r=t.chartData,o=r?.title,i=r?.chartType,s=r?.categories,a=r?.series,l=r?.style,c=r?.grouping,u=useCallback(w=>{n({chartData:w});},[n]),d=useCallback(w=>{if(r){if(w.chartType&&w.chartType!==r.chartType){let C=wX(r,w.chartType),{chartType:T,...E}=w;u({...C,...E});return}n({chartData:{...r,...w}});}},[r,n,u]),p=useCallback(w=>{r&&n({chartData:{...r,style:{...l,...w}}});},[r,l,n]),f=useCallback((w,C)=>{if(!a)return;let T=a.map((E,M)=>M===w?{...E,...C}:E);d({series:T});},[a,d]),h=useCallback((w,C)=>{if(!s)return;let T=s.map((E,M)=>M===w?C:E);d({categories:T});},[s,d]),m=useCallback((w,C,T)=>{if(!r)return;let E=Number.parseFloat(T);Number.isFinite(E)&&u(SX(r,w,C,E));},[r,u]),x=useCallback(()=>{!r||!s||u(CX(r,`Cat ${s.length+1}`));},[r,s,u]),y=useCallback(w=>{!r||!s||s.length<=1||u(TX(r,w));},[r,s,u]),v=useCallback(()=>{!r||!s||!a||u(bX(r,{name:`Series ${a.length+1}`,values:s.map(()=>0)}));},[r,s,a,u]),S=useCallback(w=>{!r||!a||a.length<=1||u(vX(r,w));},[r,a,u]);return !r||!s||!a?null:jsxs(Fragment,{children:[jsx(Sse,{title:o,chartType:i,grouping:c,seriesCount:a.length,categoryCount:s.length,canEdit:e,onUpdateChartData:d}),jsx(vse,{style:l,canEdit:e,onUpdateStyle:p}),jsx(bse,{categories:s,series:a,canEdit:e,onUpdateSeries:f,onUpdateCategoryLabel:h,onUpdateValue:m,onAddCategory:x,onRemoveCategory:y,onAddSeries:v,onRemoveSeries:S})]})}function Cse({selectedElement:t,canEdit:e,onUpdateElementStyle:n}){return t.type!=="connector"?null:jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Connector"}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[["Start","connectorStartArrow"],["End","connectorEndArrow"]].map(([r,o])=>jsxs("label",{className:"flex flex-col gap-1",children:[jsxs("span",{className:"text-muted-foreground",children:[r," Arrow"]}),jsxs("select",{disabled:!e,className:le(Fn,"w-full"),value:t.shapeStyle?.[o]??"none",onChange:i=>n({[o]:i.target.value}),children:[jsx("option",{value:"none",children:"None"}),jsx("option",{value:"triangle",children:"Triangle"}),jsx("option",{value:"arrow",children:"Arrow"}),jsx("option",{value:"stealth",children:"Stealth"}),jsx("option",{value:"diamond",children:"Diamond"}),jsx("option",{value:"oval",children:"Oval"})]})]},o))})]})}function Tse({selectedElement:t}){if(t.type!=="group")return null;let e=t;return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Group"}),jsx("div",{className:"text-[11px] text-muted-foreground",children:Array.isArray(e.children)?`${e.children.length} children`:"Grouped element"})]})}function Mse({selectedElement:t}){let{t:e}=useTranslation();if(t.type!=="ole")return null;let n=t;return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:e("pptx.ole.title")}),jsxs("div",{className:"space-y-1.5 text-[11px]",children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.type")}),jsx("span",{className:"text-foreground truncate",children:Nj(n.oleObjectType)})]}),n.fileName&&jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.fileName")}),jsx("span",{className:"text-foreground truncate",title:n.fileName,children:n.fileName})]}),jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.linkStatus")}),jsx("span",{className:le("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium",n.isLinked?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"),children:n.isLinked?e("pptx.ole.linked"):e("pptx.ole.embedded")})]})]})]})}function _se({selectedElement:t,canEdit:e,onUpdateElement:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Transform"}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Rotation (\xB0)"}),jsx("input",{type:"number",disabled:!e,className:Fn,value:Math.round(t.rotation||0),onChange:r=>n({rotation:Number(r.target.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Opacity"}),jsx("input",{type:"range",disabled:!e,min:0,max:100,value:Math.round((t.opacity??1)*100),className:"accent-primary",onChange:r=>n({opacity:Number(r.target.value)/100})})]})]})]})}function Ese({canEdit:t,onMoveLayer:e}){return jsxs("div",{className:"flex gap-1",children:[jsx("button",{type:"button",className:le("flex-1",Xr),disabled:!t,onClick:()=>e("forward"),children:"\u2191 Forward"}),jsx("button",{type:"button",className:le("flex-1",Xr),disabled:!t,onClick:()=>e("backward"),children:"\u2193 Backward"})]})}var pWe=[["none","pptx.image.effectNone",""],["blur","pptx.image.effectBlur","blur(4px)"],["grayscale","pptx.image.effectGrayscale","grayscale(100%)"],["sepia","pptx.image.effectSepia","sepia(100%)"],["pencilSketch","pptx.image.effectPencilSketch","grayscale(100%) contrast(150%) brightness(80%)"],["lineDrawing","pptx.image.effectLineDrawing","grayscale(100%) contrast(150%)"],["watercolorSponge","pptx.image.effectWatercolor","saturate(150%) blur(1px)"],["paintStrokes","pptx.image.effectPaintStrokes","blur(3px) saturate(140%)"],["glow_edges","pptx.image.effectGlowEdges","contrast(180%) invert(5%) brightness(110%)"],["glowDiffused","pptx.image.effectGlowDiffused","blur(3px) brightness(120%)"],["cement","pptx.image.effectCement","contrast(200%) brightness(60%)"],["photocopy","pptx.image.effectPhotocopy","grayscale(100%) contrast(200%) brightness(120%)"],["filmGrain","pptx.image.effectFilmGrain","contrast(110%) brightness(105%)"],["mosaic","pptx.image.effectMosaic","blur(8px) contrast(105%)"],["chalkSketch","pptx.image.effectChalk","grayscale(80%) contrast(140%) brightness(110%)"],["marker","pptx.image.effectMarker","contrast(130%) saturate(130%)"],["cutout","pptx.image.effectCutout","contrast(300%) brightness(120%)"],["pastelsSmooth","pptx.image.effectPastels","blur(4px) saturate(120%)"],["paint","pptx.image.effectPaint","blur(3px) saturate(160%) contrast(110%)"],["plasticWrap","pptx.image.effectPlasticWrap","contrast(150%) brightness(115%) saturate(80%)"],["lightScreen","pptx.image.effectLightScreen","brightness(130%) contrast(80%)"],["sharpen","pptx.image.effectSharpen","contrast(160%) brightness(105%)"],["texturizer","pptx.image.effectTexturizer","contrast(110%) brightness(105%)"],["crisscrossEtching","pptx.image.effectCrisscross","grayscale(60%) contrast(120%)"]];function Pse({imgSrc:t,fx:e,canEdit:n,updateEffects:r}){let{t:o}=useTranslation();return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.image.artisticEffects")}),jsx("div",{className:"grid grid-cols-4 gap-1",children:pWe.map(([i,s,a])=>{let l=i==="none"?!e?.artisticEffect:e?.artisticEffect===i;return jsxs("button",{type:"button",disabled:!n,className:le("flex flex-col items-center gap-0.5 rounded border p-0.5 hover:bg-accent/50",l?"border-primary bg-primary/10":"border-border"),title:o(s),onClick:()=>r({artisticEffect:i==="none"?void 0:i,...i==="grayscale"?{grayscale:void 0}:{}}),children:[jsx("div",{className:"w-10 h-7 rounded overflow-hidden bg-muted",style:{backgroundImage:t?`url(${t})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:a||void 0}}),jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full text-center",children:o(s)})]},i)})})]})}function es({value:t,disabled:e,className:n,onCommit:r}){let[o,i]=useState(t),s=useRef(r);s.current=r,useEffect(()=>{i(t);},[t]);let a=useCallback(u=>{i(u.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let u=c.current;if(!u)return;let d=()=>{s.current(u.value);};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),jsx("input",{ref:c,type:"color",disabled:e,value:o,className:n,onChange:a,onBlur:l})}function Nse({fx:t,canEdit:e,updateEffects:n}){let{t:r}=useTranslation(),o=t?.clrChange;return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChange")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o,onChange:i=>n({clrChange:i.target.checked?{clrFrom:"#ffffff",clrTo:"#000000",clrToTransparent:false}:void 0})})]}),o&&jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeFrom")}),jsx(es,{disabled:!e,value:dt(o.clrFrom,"#ffffff"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({clrChange:{...o,clrFrom:i,clrTo:o.clrTo??"#000000"}})})]}),jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeTo")}),jsx(es,{disabled:!e||!!o.clrToTransparent,value:dt(o.clrTo,"#000000"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({clrChange:{...o,clrFrom:o.clrFrom??"#ffffff",clrTo:i}})})]}),jsxs("label",{className:"flex items-center justify-between gap-2 col-span-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeTransparent")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o.clrToTransparent,onChange:i=>n({clrChange:{clrFrom:o.clrFrom??"#ffffff",clrTo:o.clrTo??"#000000",clrToTransparent:i.target.checked}})})]})]})]})}function Dse({fx:t,canEdit:e,updateEffects:n}){let{t:r}=useTranslation(),o=t?.colorWash;return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorWash")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o,onChange:i=>n({colorWash:i.target.checked?{color:"#0066cc",opacity:40}:void 0})})]}),o&&jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.washColor")}),jsx(es,{disabled:!e,value:dt(o.color,"#0066cc"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({colorWash:{color:i,opacity:o.opacity??40}})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.washOpacity")}),jsx("input",{type:"range",min:0,max:100,disabled:!e,className:"accent-primary",value:o.opacity,onChange:i=>n({colorWash:{color:o.color??"#0066cc",opacity:Number(i.target.value)}})})]})]})]})}function Bse({value:t,disabled:e,className:n,onCommit:r}){let[o,i]=useState(t),s=useRef(r);s.current=r,useEffect(()=>{i(t);},[t]);let a=useCallback(u=>{i(u.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let u=c.current;if(!u)return;let d=()=>{s.current(u.value);};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[]),jsx("input",{ref:c,type:"color",disabled:e,className:n,value:o,onChange:a,onBlur:l})}function Ose({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o="imageEffects"in t?t.imageEffects:void 0,i=useCallback((c,u)=>{n({imageEffects:{...o,duotone:{color1:c,color2:u}}});},[o,n]),s=useCallback(()=>{n({imageEffects:{...o,duotone:void 0}});},[o,n]),a=dt(o?.duotone?.color1,"#000000"),l=dt(o?.duotone?.color2,"#ffffff");return jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx("div",{className:"text-muted-foreground font-medium",children:r("pptx.image.duotone")}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("label",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.duotoneShadows")}),jsx(Bse,{disabled:!e,value:a,className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:c=>i(c,l)})]}),jsxs("label",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.duotoneHighlights")}),jsx(Bse,{disabled:!e,value:l,className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:c=>i(a,c)})]})]}),jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"text-muted-foreground text-[10px]",children:r("pptx.image.duotonePresets")}),jsx("div",{className:"grid grid-cols-4 gap-1",children:Tee.map(c=>jsxs("button",{type:"button",disabled:!e,className:"flex flex-col items-center gap-0.5 rounded border border-border hover:bg-accent p-1 transition-colors",title:r(c.labelKey),onClick:()=>i(c.shadow,c.highlight),children:[jsxs("div",{className:"flex h-4 w-full rounded overflow-hidden",children:[jsx("div",{className:"flex-1",style:{backgroundColor:c.shadow}}),jsx("div",{className:"flex-1",style:{backgroundColor:c.highlight}})]}),jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full text-center",children:r(c.labelKey)})]},c.labelKey))})]}),o?.duotone&&jsx("button",{type:"button",disabled:!e,className:"w-full rounded bg-muted hover:bg-accent border border-border px-2 py-1 text-foreground transition-colors",onClick:s,children:r("pptx.image.duotoneClear")})]})}function Use({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=useMemo(()=>"imageEffects"in t?t.imageEffects:void 0,[t]),s=100-(o?.alphaModFix??100),a=o?.biLevel??0,l=o?.alphaModFix!==void 0||o?.biLevel!==void 0,c=useCallback(f=>{n({imageEffects:{...o,...f}});},[o,n]),u=useCallback(f=>{let h=Number(f.target.value);c({alphaModFix:100-h});},[c]),d=useCallback(f=>{c({biLevel:Number(f.target.value)});},[c]),p=useCallback(()=>{c({alphaModFix:void 0,biLevel:void 0});},[c]);return jsxs("div",{className:"space-y-3 text-[11px]",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-muted-foreground font-medium",children:r("pptx.imageAdjustments.title")}),l&&jsx("button",{type:"button",disabled:!e,className:"rounded bg-muted hover:bg-accent border border-border px-1.5 py-0.5 text-[10px] text-foreground disabled:opacity-50",onClick:p,children:r("common.reset")})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.imageAdjustments.transparency")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"accent-primary flex-1",value:s,onChange:u}),jsxs("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:[s,"%"]})]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.imageAdjustments.biLevelThreshold")}),jsx("p",{className:"text-[10px] text-muted-foreground/70",children:r("pptx.imageAdjustments.biLevelDescription")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"accent-primary flex-1",value:a,onChange:d}),jsx("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:a})]})]})]})}function JI({label:t,disabled:e,value:n,onChange:r}){return jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"range",min:-100,max:100,disabled:e,className:"accent-primary",value:n,onChange:o=>r(Number(o.target.value))})]})}function Hse({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.imageEffects,i=s=>{n({imageEffects:{...o,...s}});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:r("pptx.image.properties")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:"Alt Text"}),jsx("textarea",{rows:2,disabled:!e,className:le(Fn,"resize-none text-[11px]"),value:t.altText??"",onChange:s=>n({altText:s.target.value})})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsx(JI,{label:"Brightness",disabled:!e,value:o?.brightness??0,onChange:s=>i({brightness:s})}),jsx(JI,{label:"Contrast",disabled:!e,value:o?.contrast??0,onChange:s=>i({contrast:s})}),jsx(JI,{label:r("pptx.image.saturation"),disabled:!e,value:o?.saturation??0,onChange:s=>i({saturation:s})})]}),jsx(Use,{selectedElement:t,canEdit:e,onUpdateElement:n}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Grayscale"}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o?.grayscale,onChange:s=>i({grayscale:s.target.checked})})]}),jsx(Ose,{selectedElement:t,canEdit:e,onUpdateElement:n})]}),jsx(Dse,{fx:o,canEdit:e,updateEffects:i}),jsx(Nse,{fx:o,canEdit:e,updateEffects:i}),jsx(Pse,{imgSrc:t.imageData,fx:o,canEdit:e,updateEffects:i}),jsx("button",{type:"button",disabled:!e,className:"w-full text-[11px] rounded bg-muted hover:bg-accent border border-border px-2 py-1 text-foreground",onClick:()=>n({imageEffects:{brightness:0,contrast:0,saturation:0,grayscale:false,artisticEffect:void 0,colorWash:void 0,alphaModFix:void 0,biLevel:void 0,duotone:void 0},cropShape:"none"}),children:r("pptx.image.resetImage")})]})]})}var _We="text-[11px] uppercase tracking-wide text-muted-foreground",EWe="rounded border border-border bg-card p-2 space-y-2",AWe="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",PWe="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",RWe="flex items-center justify-between gap-2",Xse="text-muted-foreground";function QI(t){if(!Number.isFinite(t)||t<0)return "00:00";let e=Math.round(t/1e3),n=Math.floor(e/60),r=e%60;return `${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}function Vse(t){let e=t.trim();if(e.length===0)return;let n=e.indexOf(":");if(n>=0){let o=e.slice(0,n),i=e.slice(n+1),s=parseInt(o,10),a=parseInt(i,10);return !Number.isFinite(s)||!Number.isFinite(a)||s<0||a<0||a>=60?void 0:(s*60+a)*1e3}let r=parseInt(e,10);if(!(!Number.isFinite(r)||r<0))return r*1e3}function kWe(t,e,n){return t<0||e<0?"pptx.media.trimErrorNegative":e>0&&t>=e?"pptx.media.trimErrorStartAfterEnd":n>0&&t>n||n>0&&e>n?"pptx.media.trimErrorBeyondDuration":null}function jse({label:t,valueMs:e,maxMs:n,disabled:r,onChange:o}){let[i,s]=useState(null),[a,l]=useState(false),c=i??QI(e),u=useCallback(()=>{s(QI(e)),l(false);},[e]),d=useCallback(()=>{if(i!==null){let h=Vse(i);h!==void 0&&h>=0&&(n<=0||h<=n)&&o(h),l(false);}s(null);},[i,n,o]),p=useCallback(h=>{let m=h.target.value;s(m);let x=Vse(m);l(x===void 0);},[]),f=useCallback(h=>{h.key==="Enter"?h.currentTarget.blur():h.key==="Escape"&&(s(null),l(false));},[]);return jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Xse}`,children:t}),jsx("input",{type:"text",disabled:r,className:`${AWe} text-[11px] tabular-nums ${a?"border-red-400":""}`,value:c,placeholder:"00:00",onFocus:u,onBlur:d,onChange:p,onKeyDown:f})]})}function Wse({element:t,canEdit:e,durationSeconds:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.trimStartMs??0,s=t.trimEndMs??0,a=n*1e3,l=useMemo(()=>{let h=i,m=s>0?s:a;return m<=h||a<=0?QI(a):QI(m-h)},[i,s,a]),c=useMemo(()=>kWe(i,s,a),[i,s,a]),u=i>0||s>0,d=useCallback(h=>{r({trimStartMs:h});},[r]),p=useCallback(h=>{r({trimEndMs:h});},[r]),f=useCallback(()=>{r({trimStartMs:0,trimEndMs:0});},[r]);return jsxs("div",{className:EWe,children:[jsxs("div",{className:_We,children:[jsx(LuScissors,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.trim")]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsx(jse,{label:o("pptx.media.trimStartTime"),valueMs:i,maxMs:a,disabled:!e,onChange:d}),jsx(jse,{label:o("pptx.media.trimEndTime"),valueMs:s,maxMs:a,disabled:!e,onChange:p})]}),jsxs("div",{className:RWe,children:[jsxs("span",{className:`text-[11px] ${Xse}`,children:[jsx(LuClock,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.trimmedDuration")]}),jsx("span",{className:"text-[11px] tabular-nums font-medium",children:l})]}),c&&jsx("div",{className:"text-[10px] text-red-400",children:o(c)}),e&&u&&jsx("button",{type:"button",className:`${PWe} w-full text-center`,onClick:f,children:o("pptx.media.resetTrim")})]})}function Hh(t){let e=Math.floor(t/60),n=Math.floor(t%60),r=Math.round(t%1*10);return `${e}:${String(n).padStart(2,"0")}.${r}`}function Yse(){return `bmk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var Vv="text-[11px] uppercase tracking-wide text-muted-foreground",jv="rounded border border-border bg-card p-2 space-y-2",oM="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",eN="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",nc="flex items-center justify-between gap-2",Is="text-muted-foreground";function qse({duration:t,trimStartMs:e,trimEndMs:n,currentTime:r,bookmarks:o,canEdit:i,onTrimChange:s,onSeek:a}){let l=useRef(null),[c,u]=useState(null),d=e/1e3,p=n>0?n/1e3:t,f=t>0?t:1,h=d/f*100,m=p/f*100,x=r/f*100,y=useCallback(S=>{let w=l.current;if(!w)return 0;let C=w.getBoundingClientRect();return Math.max(0,Math.min(1,(S-C.left)/C.width))*f},[f]);useEffect(()=>{if(!c)return;let S=C=>{let T=y(C.clientX);if(c==="start"){let E=Math.min(T,p-.1);s(Math.max(0,E)*1e3,n);}else {let E=Math.max(T,d+.1);s(e,Math.min(E,t)*1e3);}},w=()=>{u(null);};return window.addEventListener("pointermove",S),window.addEventListener("pointerup",w),()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",w);}},[c,t,y,s,n,p,e,d]);let v=S=>{let w=y(S.clientX);a(w);};return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[jsx("span",{children:Hh(d)}),jsx("span",{children:Hh(p)})]}),jsxs("div",{ref:l,className:"relative h-5 rounded bg-muted cursor-pointer select-none",onClick:v,children:[jsx("div",{className:"absolute top-0 bottom-0 bg-primary/30 rounded",style:{left:`${h}%`,width:`${m-h}%`}}),jsx("div",{className:"absolute top-0 bottom-0 w-0.5 bg-white z-10",style:{left:`${Math.min(x,100)}%`}}),i&&jsx("div",{className:"absolute top-0 bottom-0 w-2 bg-primary rounded-l cursor-ew-resize z-20 hover:bg-primary/80",style:{left:`calc(${h}% - 4px)`},onPointerDown:S=>{S.stopPropagation(),u("start");}}),i&&jsx("div",{className:"absolute top-0 bottom-0 w-2 bg-primary rounded-r cursor-ew-resize z-20 hover:bg-primary/80",style:{left:`calc(${m}% - 4px)`},onPointerDown:S=>{S.stopPropagation(),u("end");}}),o.map(S=>{let w=S.time/f*100;return jsx("div",{className:"absolute top-0 bottom-0 w-1 bg-yellow-400/70 z-10 cursor-pointer",style:{left:`${w}%`},title:S.label,onClick:C=>{C.stopPropagation(),a(S.time);}},S.id)})]})]})}function Zse({element:t,canEdit:e,currentTime:n,bookmarks:r,onUpdateElement:o,onSeekTo:i}){let{t:s}=useTranslation(),[a,l]=useState(""),c=Math.round((t.volume??1)*100),u=useCallback(()=>{let p=a.trim()||`${s("pptx.media.bookmark")} ${r.length+1}`,f={id:Yse(),time:n,label:p};o({bookmarks:[...r,f]}),l("");},[r,n,a,o,s]),d=useCallback(p=>{o({bookmarks:r.filter(f=>f.id!==p)});},[r,o]);return jsxs(Fragment,{children:[jsxs("div",{className:jv,children:[jsx("div",{className:Vv,children:s("pptx.media.playback")}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.volume")}),jsxs("div",{className:"flex items-center gap-1 flex-1 max-w-[140px]",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"flex-1",value:c,onChange:p=>o({volume:Number(p.target.value)/100})}),jsxs("span",{className:"text-[10px] text-muted-foreground w-7 text-right tabular-nums",children:[c,"%"]})]})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.speed")}),jsxs("select",{disabled:!e,className:`${oM} text-[11px] max-w-[100px]`,value:t.playbackSpeed??1,onChange:p=>o({playbackSpeed:Number(p.target.value)}),children:[jsx("option",{value:.25,children:"0.25x"}),jsx("option",{value:.5,children:"0.5x"}),jsx("option",{value:.75,children:"0.75x"}),jsx("option",{value:1,children:"1x"}),jsx("option",{value:1.25,children:"1.25x"}),jsx("option",{value:1.5,children:"1.5x"}),jsx("option",{value:2,children:"2x"}),jsx("option",{value:3,children:"3x"}),jsx("option",{value:4,children:"4x"})]})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fadeIn")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${oM} text-[11px]`,value:t.fadeInDuration??0,onChange:p=>o({fadeInDuration:Number(p.target.value)||void 0})})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fadeOut")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${oM} text-[11px]`,value:t.fadeOutDuration??0,onChange:p=>o({fadeOutDuration:Number(p.target.value)||void 0})})]})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.loop")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.loop,onChange:p=>o({loop:p.target.checked||void 0})})]}),jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.startTrigger")}),jsxs("select",{disabled:!e,className:"text-[11px] bg-transparent border border-border rounded px-1 py-0.5",value:t.autoPlay?"auto":"onClick",onChange:p=>o({autoPlay:p.target.value==="auto"||void 0}),children:[jsx("option",{value:"onClick",children:s("pptx.media.startOnClick")}),jsx("option",{value:"auto",children:s("pptx.media.startAutomatically")})]})]}),t.mediaType==="audio"&&jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.playAcrossSlides")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.playAcrossSlides,onChange:p=>o({playAcrossSlides:p.target.checked||void 0,...p.target.checked?{autoPlay:true}:{}})})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fullScreen")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.fullScreen,onChange:p=>o({fullScreen:p.target.checked||void 0})})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.hideWhenNotPlaying")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.hideWhenNotPlaying,onChange:p=>o({hideWhenNotPlaying:p.target.checked||void 0})})]})]}),jsxs("div",{className:jv,children:[jsxs("div",{className:Vv,children:[jsx(LuBookmark,{className:"inline w-3 h-3 mr-1"}),s("pptx.media.bookmarks")]}),r.length>0&&jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:r.slice().sort((p,f)=>p.time-f.time).map(p=>jsxs("div",{className:"flex items-center gap-1 text-[11px] group",children:[jsx("button",{type:"button",className:"text-primary hover:text-primary/80 truncate flex-1 text-left",onClick:()=>i(p.time),title:s("pptx.media.seekToBookmark"),children:p.label}),jsx("span",{className:"text-muted-foreground tabular-nums text-[10px]",children:Hh(p.time)}),e&&jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-300 transition-opacity",onClick:()=>d(p.id),title:s("common.remove"),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},p.id))}),e&&jsxs("div",{className:"flex items-center gap-1",children:[jsx("input",{type:"text",className:`${oM} text-[11px]`,placeholder:s("pptx.media.bookmarkLabel"),value:a,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),u());}}),jsx("button",{type:"button",className:eN,onClick:u,title:s("pptx.media.addBookmark"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function Qse({element:t,mediaDataUrls:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=useRef(null),[s,a]=useState(false),[l,c]=useState(0),[u,d]=useState(0),p=t.mediaData??(t.mediaPath?e.get(t.mediaPath):void 0),f=t.bookmarks??[],h=t.mediaType==="video";useEffect(()=>{let w=i.current;if(!w)return;let C=()=>c(w.currentTime),T=()=>{Number.isFinite(w.duration)&&d(w.duration);},E=()=>a(true),M=()=>a(false),A=()=>a(false);return w.addEventListener("timeupdate",C),w.addEventListener("durationchange",T),w.addEventListener("loadedmetadata",T),w.addEventListener("play",E),w.addEventListener("pause",M),w.addEventListener("ended",A),()=>{w.removeEventListener("timeupdate",C),w.removeEventListener("durationchange",T),w.removeEventListener("loadedmetadata",T),w.removeEventListener("play",E),w.removeEventListener("pause",M),w.removeEventListener("ended",A);}},[p]);let m=useCallback(()=>{let w=i.current;w&&(w.paused?w.play():w.pause());},[]),x=useCallback(w=>{let C=i.current;C&&(C.currentTime=w,c(w));},[]),y=useCallback((w,C)=>{r({trimStartMs:w,trimEndMs:C});},[r]),[v,S]=useState(t.metadata);return useEffect(()=>{let w=i.current;if(!w)return;if(t.metadata?.duration!==void 0){S(t.metadata);return}let C=()=>{if(!Number.isFinite(w.duration)||w.duration===0)return;let T={duration:w.duration};w instanceof HTMLVideoElement&&(w.videoWidth>0&&(T.videoWidth=w.videoWidth),w.videoHeight>0&&(T.videoHeight=w.videoHeight));let E=w.querySelector("source");E?.type&&(T.codecInfo=E.type),t.metadata=T,S(T);};return w.addEventListener("loadedmetadata",C),w.readyState>=1&&C(),()=>{w.removeEventListener("loadedmetadata",C);}},[p,t]),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:jv,children:[jsx("div",{className:Vv,children:o("pptx.media.title")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:o(h?"pptx.media.videoClip":"pptx.media.audioClip")}),p&&jsxs("div",{className:"space-y-1",children:[h?jsx("video",{ref:i,className:"w-full rounded bg-black max-h-32 object-contain",src:p,preload:"metadata"}):jsx("audio",{ref:i,className:"w-full",src:p,preload:"metadata"}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",className:eN,onClick:m,title:o(s?"pptx.media.pause":"pptx.media.play"),children:s?jsx(LuPause,{className:"w-3 h-3"}):jsx(LuPlay,{className:"w-3 h-3"})}),jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[Hh(l)," / ",Hh(u)]})]})]}),u>0&&jsx(qse,{duration:u,trimStartMs:t.trimStartMs??0,trimEndMs:t.trimEndMs??0,currentTime:l,bookmarks:f,canEdit:n,onTrimChange:y,onSeek:x})]}),jsx(Wse,{element:t,canEdit:n,durationSeconds:u,onUpdateElement:r}),(v||t.posterFrameData)&&jsxs("div",{className:jv,children:[jsxs("div",{className:Vv,children:[jsx(LuInfo,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.info")]}),t.posterFrameData&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:`text-[11px] ${Is}`,children:o("pptx.media.posterFrame")}),jsx("img",{src:t.posterFrameData,alt:o("pptx.media.posterFrame"),className:"w-full max-h-20 object-contain rounded bg-black/20"})]}),v?.duration!==void 0&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.duration")}),jsx("span",{className:"text-[11px] tabular-nums",children:Hh(v.duration)})]}),v?.videoWidth!==void 0&&v?.videoHeight!==void 0&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.resolution")}),jsxs("span",{className:"text-[11px] tabular-nums",children:[v.videoWidth," x ",v.videoHeight]})]}),v?.codecInfo&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.format")}),jsx("span",{className:"text-[11px] truncate max-w-[140px]",title:v.codecInfo,children:v.codecInfo})]}),t.mediaPath&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.filePath")}),jsx("span",{className:"text-[10px] truncate max-w-[140px] text-muted-foreground",title:t.mediaPath,children:t.mediaPath.split("/").pop()})]})]}),jsx(Zse,{element:t,canEdit:n,currentTime:l,bookmarks:f,onUpdateElement:r,onSeekTo:x})]})}function eae({selectedElement:t,canEdit:e,onUpdateElement:n,onUpdateElementStyle:r,onUpdateTextStyle:o}){let{t:i}=useTranslation();return jsxs(Fragment,{children:[mn(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.shape.type","Shape Type")}),jsx("select",{value:t.shapeType||"rect",disabled:!e,className:le(Fn,"w-full"),onChange:s=>n({shapeType:s.target.value}),children:m1.filter(s=>s.type!=="connector").map(s=>jsx("option",{value:s.type,children:s.label},s.type))})]}),mn(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.shape.fillStroke","Fill & Stroke")}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Fill"}),jsx(es,{disabled:!e,value:dt(t.shapeStyle?.fillColor,"#3b82f6"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>r({fillColor:s,fillMode:"solid"})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Stroke"}),jsx(es,{disabled:!e,value:dt(t.shapeStyle?.strokeColor,"#1f2937"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>r({strokeColor:s})})]}),jsxs("label",{className:"flex items-center gap-1 col-span-2",children:[jsx("span",{className:"w-16 text-muted-foreground",children:"Stroke W"}),jsx("input",{type:"number",disabled:!e,className:Fn,min:0,max:20,value:t.shapeStyle?.strokeWidth??1,onChange:s=>r({strokeWidth:Number(s.target.value)})})]})]})]}),ot(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.text.title","Text")}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Size"}),jsx("input",{type:"number",disabled:!e,className:Fn,min:6,max:200,value:t.textStyle?.fontSize??18,onChange:s=>o({fontSize:Number(s.target.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Color"}),jsx(es,{disabled:!e,value:dt(t.textStyle?.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>o({color:s})})]}),jsxs("div",{className:"flex gap-1 col-span-2",children:[jsx(U8,{label:"B",active:!!t.textStyle?.bold,disabled:!e,onClick:()=>o({bold:!t.textStyle?.bold})}),jsx(U8,{label:"I",active:!!t.textStyle?.italic,disabled:!e,italic:true,onClick:()=>o({italic:!t.textStyle?.italic})}),jsx(U8,{label:"U",active:!!t.textStyle?.underline,disabled:!e,underline:true,onClick:()=>o({underline:!t.textStyle?.underline})})]})]})]})]})}function U8({label:t,active:e,disabled:n,italic:r,underline:o,onClick:i}){return jsx("button",{type:"button",disabled:n,className:le("px-2 py-1 rounded text-[11px] transition-colors",r&&"italic",o&&"underline",e?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:i,children:t})}function qWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"2",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M14 16 L17 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("rect",{x:"19",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M31 16 L34 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("rect",{x:"36",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7})]})}function KWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"17",y:"2",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M24 10 L12 18 M24 10 L36 18",stroke:"currentColor",strokeWidth:"1",opacity:.5}),jsx("rect",{x:"4",y:"18",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"30",y:"18",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7})]})}function ZWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"24",cy:"5",r:"4",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"37",cy:"20",r:"4",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"11",cy:"20",r:"4",fill:"currentColor",opacity:.7}),jsx("path",{d:"M28 6 L34 17 M33 23 L14 23 M14 18 L20 7",stroke:"currentColor",strokeWidth:"1",opacity:.4,fill:"none"})]})}function JWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"4",y:"3",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"26",y:"3",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"18",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"26",y:"18",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7})]})}function QWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"16",y:"2",width:"16",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"10",y:"12",width:"28",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"22",width:"40",height:"8",rx:"2",fill:"currentColor",opacity:.7})]})}function e7e(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"4",y:"3",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"13",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"23",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7})]})}var tae={process:qWe,hierarchy:KWe,cycle:ZWe,matrix:JWe,pyramid:QWe,list:e7e};var n7e=jX.map(t=>({type:t,i18nKey:`pptx.smartart.category.${t}`}));function rae({smartArtData:t,canEdit:e,onUpdateSmartArt:n}){let{t:r}=useTranslation(),o=t.resolvedLayoutType??"list",i=s=>{if(!e||s===o)return;let a=XX(t,s);n({layoutType:a.layoutType,resolvedLayoutType:a.resolvedLayoutType,layout:a.layout});};return jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:r("pptx.smartart.switchLayout")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:n7e.map(({type:s,i18nKey:a})=>{let l=o===s,c=tae[s];return jsxs("button",{type:"button",disabled:!e,className:le("flex flex-col items-center gap-0.5 rounded border p-1.5 transition-colors","text-[9px] leading-tight",l?"border-primary bg-primary/15 text-primary":"border-border text-muted-foreground hover:bg-muted hover:text-foreground",!e&&"opacity-50 cursor-not-allowed"),onClick:()=>i(s),title:r(a),children:[jsx("div",{className:"w-10 h-7",children:c?jsx(c,{}):null}),jsx("span",{className:"truncate w-full text-center",children:r(a)})]},s)})})]})}var o7e=["colorful1","colorful2","colorful3","monochromatic1","monochromatic2"],i7e=["flat","moderate","intense"];function oae({smartArtData:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.nodes??[],i=h=>{n({smartArtData:{...t,...h}});},s=h=>{n({smartArtData:h});},a=(h,m)=>{s(mX(t,h,m));},l=()=>{s(k5(t));},c=h=>{s(k5(t,h,"Sub-item"));},u=h=>{s(hX(t,h));},d=h=>{i({nodes:o.map(m=>m.id===h?{...m,parentId:void 0}:m),drawingShapes:void 0});},p=h=>{let m=o.filter(y=>!y.parentId),x=m.findIndex(y=>y.id===h);if(x>0){let y=m[x-1].id;i({nodes:o.map(v=>v.id===h?{...v,parentId:y}:v),drawingShapes:void 0});}},f=(h,m)=>{h.key==="Tab"&&!h.shiftKey?(h.preventDefault(),p(m)):h.key==="Tab"&&h.shiftKey&&(h.preventDefault(),d(m));};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:r("pptx.smartart.title")}),jsxs("div",{className:"space-y-2",children:[jsx(rae,{smartArtData:t,canEdit:e,onUpdateSmartArt:i}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.smartart.colorScheme")}),jsx("select",{disabled:!e,className:le(Fn,"w-full"),value:t.colorScheme??"colorful1",onChange:h=>i({colorScheme:h.target.value}),children:o7e.map(h=>jsx("option",{value:h,children:h},h))})]}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.smartart.style")}),jsx("div",{className:"flex gap-1",children:i7e.map(h=>jsx("button",{type:"button",disabled:!e,className:le("flex-1 px-2 py-1 text-[10px] rounded border transition-colors",(t.style??"flat")===h?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground hover:bg-muted"),onClick:()=>i({style:h}),children:h},h))})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r("pptx.smartart.textPane")," (",o.length,")"]}),jsx("button",{type:"button",disabled:!e,className:Xr,onClick:l,children:r("pptx.smartart.addItem")})]}),jsx("div",{className:"max-h-52 overflow-y-auto space-y-1 pr-1",children:o.map((h,m)=>{let x=!!h.parentId;return jsx("div",{className:le("rounded border bg-background/60 p-1.5",x?"border-border/60 ml-4":"border-border"),children:jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-[9px] text-muted-foreground w-3 shrink-0",children:x?"\u2022":`${m+1}`}),jsx("input",{type:"text",disabled:!e,className:le(Fn,"flex-1 text-[11px] py-0.5"),value:h.text,onChange:y=>a(h.id,y.target.value),onKeyDown:y=>f(y,h.id),placeholder:r("pptx.smartart.typePlaceholder")}),jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[!x&&jsx("button",{type:"button",disabled:!e,className:"text-[9px] text-muted-foreground hover:text-primary px-1",onClick:()=>c(h.id),title:r("pptx.smartart.addSubItem"),children:"+Sub"}),jsx("button",{type:"button",disabled:!e||o.length<=1,className:"text-[9px] text-muted-foreground hover:text-red-400 px-1",onClick:()=>u(h.id),title:r("pptx.smartart.remove"),children:"x"})]})]})},h.id)})}),jsx("div",{className:"text-[9px] text-muted-foreground mt-1",children:r("pptx.smartart.tabHint")})]})]})}function iae(t,e,n){let r=t.rows[e];if(!r)return null;let o=r.cells[n],i=Math.max(1,o?.gridSpan??1),s=n+i,a=r.cells[s];if(!a||a.hMerge||a.vMerge)return null;let l=Math.max(1,a.gridSpan??1);return t.rows.map((c,u)=>{if(u!==e)return c;let d=c.cells.map((p,f)=>f===n?{...p,gridSpan:i+l}:f>=s&&f<s+l?{...p,hMerge:true,text:""}:p);return {...c,cells:d}})}function sae(t,e,n){let r=t.rows[e];if(!r)return null;let o=r.cells[n];if(!o)return null;let i=Math.max(1,o.rowSpan??1),s=e+i;if(s>=t.rows.length)return null;let l=t.rows[s]?.cells[n];if(!l||l.hMerge||l.vMerge)return null;let c=Math.max(1,l.rowSpan??1);return t.rows.map((u,d)=>d===e?{...u,cells:u.cells.map((p,f)=>f===n?{...p,rowSpan:i+c}:p)}:d===s?{...u,cells:u.cells.map((p,f)=>f===n?{...p,vMerge:true,text:""}:p)}:u)}function aae(t,e,n){let r=t.rows[e],o=r?.cells[n];if(!r||!o)return null;let i=Math.max(1,o.gridSpan??1),s=Math.max(1,o.rowSpan??1);return i===1&&s===1?null:t.rows.map((a,l)=>{let c=a.cells.map((u,d)=>l===e&&d===n?{...u,gridSpan:void 0,rowSpan:void 0}:l===e&&d>n&&d<n+i?{...u,hMerge:void 0}:l>e&&l<e+s&&d===n?{...u,vMerge:void 0}:u);return {...a,cells:c}})}var nN="bg-muted border border-border rounded px-2 py-1 text-[11px] w-full",rN="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full text-[11px]",Vp="text-muted-foreground text-[11px]",lae="text-[11px] uppercase tracking-wide text-muted-foreground",cae=[{value:"solid",i18nKey:"pptx.table.fillSolid"},{value:"gradient",i18nKey:"pptx.table.fillGradient"},{value:"pattern",i18nKey:"pptx.table.fillPattern"},{value:"none",i18nKey:"pptx.table.fillNone"}],uae=[{value:"linear",i18nKey:"pptx.table.gradientLinear"},{value:"radial",i18nKey:"pptx.table.gradientRadial"}],dae=oF.slice(0,20);function pae({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.fillMode??"solid",i=s=>{let a=s;n(a==="gradient"?{fillMode:"gradient",gradientFillType:t.gradientFillType??"linear",gradientFillAngle:t.gradientFillAngle??90,gradientFillStops:t.gradientFillStops??[{color:"#FF0000",position:0},{color:"#0000FF",position:100}]}:a==="pattern"?{fillMode:"pattern",patternFillPreset:t.patternFillPreset??"ltDnDiag",patternFillForeground:t.patternFillForeground??"#000000",patternFillBackground:t.patternFillBackground??"#FFFFFF"}:{fillMode:a});};return jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:Vp,children:r("pptx.table.fillMode")}),jsx("select",{disabled:!e,className:nN,value:o,onChange:s=>i(s.target.value),children:cae.map(s=>jsx("option",{value:s.value??"",children:r(s.i18nKey)},s.value))})]}),o==="gradient"&&jsx(s7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),o==="pattern"&&jsx(a7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),jsxs("div",{className:"space-y-1",children:[jsx("span",{className:lae,children:r("pptx.table.margins")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:[["marginTop","pptx.table.marginTop"],["marginBottom","pptx.table.marginBottom"],["marginLeft","pptx.table.marginLeft"],["marginRight","pptx.table.marginRight"]].map(([s,a])=>jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r(a)}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:200,value:t[s]??0,onChange:l=>n({[s]:Number(l.target.value)})})]},s))})]})]})}function s7e({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.gradientFillStops??[],i=t.gradientFillType??"linear",s=(l,c)=>{let u=o.map((d,p)=>p===l?{...d,...c}:d);n({gradientFillStops:u});},a=()=>{n({gradientFillStops:[...o,{color:"#888888",position:50}]});};return jsxs("div",{className:"space-y-1.5",children:[jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.gradientType")}),jsx("select",{disabled:!e,className:nN,value:i,onChange:l=>n({gradientFillType:l.target.value}),children:uae.map(l=>jsx("option",{value:l.value,children:r(l.i18nKey)},l.value))})]}),i==="linear"&&jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.gradientAngle")}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:360,value:t.gradientFillAngle??90,onChange:l=>n({gradientFillAngle:Number(l.target.value)})})]})]}),jsx("span",{className:Vp,children:r("pptx.table.gradientStops")}),o.map((l,c)=>jsxs("div",{className:"flex items-center gap-1",children:[jsx("input",{type:"color",disabled:!e,className:"h-6 w-6 rounded border border-border cursor-pointer",value:l.color,onChange:u=>s(c,{color:u.target.value})}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:100,value:Math.round(l.position),onChange:u=>s(c,{position:Number(u.target.value)})}),jsx("span",{className:"text-[10px] text-muted-foreground",children:"%"})]},c)),jsx("button",{type:"button",disabled:!e,className:"text-[10px] text-primary hover:underline",onClick:a,children:r("pptx.table.gradientAddStop")})]})}function a7e({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternPreset")}),jsx("select",{disabled:!e,className:nN,value:t.patternFillPreset??"ltDnDiag",onChange:o=>n({patternFillPreset:o.target.value}),children:dae.map(o=>jsx("option",{value:o,children:o},o))})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternForeground")}),jsx("input",{type:"color",disabled:!e,className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",value:t.patternFillForeground??"#000000",onChange:o=>n({patternFillForeground:o.target.value})})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternBackground")}),jsx("input",{type:"color",disabled:!e,className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",value:t.patternFillBackground??"#FFFFFF",onChange:o=>n({patternFillBackground:o.target.value})})]})]})]})}function fae({tableData:t,tableEditorState:e,canEdit:n,onUpdateTableData:r}){let{t:o}=useTranslation(),{rowIndex:i,columnIndex:s}=e,a=t.rows[i]?.cells[s];if(!a)return null;let l=a.style??{},c=u=>{let d=t.rows.map((p,f)=>f!==i?p:{...p,cells:p.cells.map((h,m)=>m!==s?h:{...h,style:{...l,...u}})});r({rows:d});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.cell",{row:i+1,col:s+1})}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground",children:o("pptx.table.fontSize")}),jsx("input",{type:"number",disabled:!n,className:Fn,min:6,max:200,value:l.fontSize??14,onChange:u=>c({fontSize:Number(u.target.value)})})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.color")}),jsx(es,{disabled:!n,value:dt(l.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:u=>c({color:u})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.background")}),jsx(es,{disabled:!n,value:dt(l.backgroundColor,"#ffffff"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:u=>c({backgroundColor:u})})]})]}),jsx(pae,{cellStyle:l,canEdit:n,onUpdateCellStyle:c}),jsx("div",{className:"flex gap-1",children:[["bold","B","font-bold"],["italic","I","italic"],["underline","U","underline"]].map(([u,d,p])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",p,l[u]?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({[u]:!l[u]}),children:d},u))}),jsx("div",{className:"flex gap-1",children:[["left","L"],["center","C"],["right","R"]].map(([u,d])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",l.align===u?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({align:u}),children:d},u))}),jsx("div",{className:"flex gap-1",children:[["top","T"],["middle","M"],["bottom","B"]].map(([u,d])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",l.vAlign===u?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({vAlign:u}),children:d},u))}),jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.table.cellBorders")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:[["Top","borderTopColor","borderTopWidth"],["Bottom","borderBottomColor","borderBottomWidth"],["Left","borderLeftColor","borderLeftWidth"],["Right","borderRightColor","borderRightWidth"]].map(([u,d,p])=>jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:o(`pptx.table.border${u}`)}),jsxs("div",{className:"flex gap-1 items-center",children:[jsx(es,{disabled:!n,value:dt(l[d],"#374151"),className:"w-7 h-6 rounded border border-border bg-transparent cursor-pointer shrink-0",onCommit:f=>c({[d]:f})}),jsx("input",{type:"number",disabled:!n,className:le(Fn,"w-14"),min:0,max:10,value:l[p]??1,onChange:f=>c({[p]:Number(f.target.value)})})]})]},u))})]}),jsxs("div",{className:"grid grid-cols-3 gap-1",children:[jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let u=iae(t,i,s);u&&r({rows:u});},children:o("pptx.table.mergeRight")}),jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let u=sae(t,i,s);u&&r({rows:u});},children:o("pptx.table.mergeDown")}),jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let u=aae(t,i,s);u&&r({rows:u});},children:o("pptx.table.split")})]})]})]})}function hae({tableElement:t,canEdit:e,onUpdateElement:n,tableEditorState:r}){let{t:o}=useTranslation(),i=t.tableData;if(!i)return null;let s=i.rows.length,a=i.columnWidths.length,l=c=>{n({tableData:{...i,...c}});};return jsxs(Fragment,{children:[jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.title")}),jsx("div",{className:"text-[11px] text-muted-foreground mb-2",children:o("pptx.table.rowsColumns",{rows:s,cols:a})}),jsx("div",{className:"space-y-1",children:[["bandedRows","pptx.table.bandedRows"],["firstRowHeader","pptx.table.headerRow"],["bandedColumns","pptx.table.bandedColumns"],["firstCol","pptx.table.firstColumn"],["lastCol","pptx.table.lastColumn"],["lastRow","pptx.table.lastRow"]].map(([c,u])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:!!i[c],onChange:d=>l({[c]:d.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:o(u)})]},c))}),i.bandedRows&&jsxs("label",{className:"flex items-center gap-2 mt-1",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:o("pptx.table.bandRowCycle")}),jsx("input",{type:"number",min:1,max:99,disabled:!e,value:i.bandRowCycle??1,onChange:c=>l({bandRowCycle:Math.max(1,parseInt(c.target.value,10)||1)}),className:"w-14 rounded border border-border bg-background px-1 py-0.5 text-[11px]"})]}),i.bandedColumns&&jsxs("label",{className:"flex items-center gap-2 mt-1",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:o("pptx.table.bandColCycle")}),jsx("input",{type:"number",min:1,max:99,disabled:!e,value:i.bandColCycle??1,onChange:c=>l({bandColCycle:Math.max(1,parseInt(c.target.value,10)||1)}),className:"w-14 rounded border border-border bg-background px-1 py-0.5 text-[11px]"})]})]}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.stylePresets")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:BW.map(c=>jsx("button",{type:"button",disabled:!e,title:c.label,className:"rounded border border-border hover:border-primary overflow-hidden h-10 transition-colors",onClick:()=>{let u=i.rows.map((d,p)=>({...d,cells:d.cells.map(f=>({...f,style:{...f.style,backgroundColor:p===0&&i.firstRowHeader?c.headerBg:i.bandedRows&&(p-(i.firstRowHeader?1:0))%2===0?c.bandBg:void 0,color:p===0&&i.firstRowHeader?c.headerFg:f.style?.color,bold:p===0&&i.firstRowHeader?true:f.style?.bold,borderColor:c.borderColor}}))}));l({rows:u});},children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"flex-1",style:{backgroundColor:c.headerBg}}),jsx("div",{className:"flex-1",style:{backgroundColor:c.bandBg}}),jsx("div",{className:"flex-1 border-t",style:{borderColor:c.borderColor}})]})},c.id))})]}),jsxs("div",{className:xn,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:hn,children:o("pptx.table.columnWidths")}),jsx("button",{type:"button",className:Xr,disabled:!e,onClick:()=>{let c=1/a;l({columnWidths:Array(a).fill(c)});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.columnWidths.map((c,u)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:u+1}),jsx("input",{type:"range",disabled:!e,min:5,max:80,value:Math.round(c*100),className:"flex-1 accent-primary",onChange:d=>{let p=Number(d.target.value)/100,f=i.columnWidths[u],h=p-f,m=[...i.columnWidths];m[u]=p;let x=1-f;if(x>0)for(let S=0;S<m.length;S++)S!==u&&(m[S]=Math.max(.05,i.columnWidths[S]-h*(i.columnWidths[S]/x)));let y=m.reduce((S,w)=>S+w,0),v=m.map(S=>S/y);l({columnWidths:v});}}),jsxs("span",{className:"w-10 text-right text-muted-foreground",children:[Math.round(c*100),"%"]})]},u))})]}),jsxs("div",{className:xn,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:hn,children:o("pptx.table.rowHeights")}),jsx("button",{type:"button",className:Xr,disabled:!e,onClick:()=>{let c=Math.round(i.rows.reduce((u,d)=>u+(d.height??32),0)/s);l({rows:i.rows.map(u=>({...u,height:c}))});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.rows.map((c,u)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:u+1}),jsx("input",{type:"number",disabled:!e,className:Fn,min:16,max:500,value:c.height??32,onChange:d=>{let p=i.rows.map((f,h)=>h===u?{...f,height:Number(d.target.value)}:f);l({rows:p});}}),jsx("span",{className:"w-6 text-muted-foreground",children:"px"})]},u))})]}),r&&jsx(fae,{tableData:i,tableEditorState:r,canEdit:e,onUpdateTableData:l})]})}function mae({selectedElement:t,canEdit:e,slides:n,tableEditorState:r,mediaDataUrls:o,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a,onMoveLayer:l}){let{t:c}=useTranslation();return jsxs(Fragment,{children:[jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:c("pptx.inspector.element")}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:use.map(([u,d])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-4 text-muted-foreground",children:u}),jsx("input",{type:"number",className:Fn,disabled:!e,value:Math.round(t[d]??0),onChange:p=>i({[d]:Number(p.target.value)})})]},d))})]}),t.type==="table"&&jsx(hae,{tableElement:t,canEdit:e,onUpdateElement:i,tableEditorState:r}),t.type==="chart"&&jsx(wse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="smartArt"&&t.smartArtData&&jsx(oae,{smartArtData:t.smartArtData,canEdit:e,onUpdateElement:i}),yi(t)&&jsx(Hse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="media"&&jsx(Qse,{element:t,mediaDataUrls:o??new Map,canEdit:e,onUpdateElement:i}),jsx(Cse,{selectedElement:t,canEdit:e,onUpdateElementStyle:s}),jsx(Tse,{selectedElement:t}),jsx(Mse,{selectedElement:t}),jsx(eae,{selectedElement:t,canEdit:e,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a}),jsx(pse,{selectedElement:t,slides:n,canEdit:e,onUpdateElement:i}),jsx(_se,{selectedElement:t,canEdit:e,onUpdateElement:i}),jsx(Ese,{canEdit:e,onMoveLayer:l})]})}function z8({comment:t,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:u,onDeleteComment:d,onToggleCommentResolved:p,onStartReply:f,onCancelReply:h,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:y,depth:v=0}){let{t:S}=useTranslation(),w=r===t.id,C=i===t.id,T=s[t.id]??"",[E,M]=useState(true),A=t.replies??[],R=t.elementId?n?.elements?.find(k=>k.id===t.elementId)??null:null;return jsxs("div",{className:le("rounded border border-border bg-card p-2",v>0&&"ml-3 border-l-2 border-l-primary/40"),children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:t.author||"Author"}),t.resolved&&jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-green-900/40 px-1.5 py-0.5 text-[9px] font-medium text-green-300 flex-shrink-0",children:[jsx(LuCheck,{className:"h-2.5 w-2.5"}),S("pptx.comments.resolved")]})]}),jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:U7(t.createdAt)})]}),t.elementId&&(R?jsxs("button",{type:"button",className:"mt-1 inline-flex items-center gap-1 rounded bg-primary/20 px-1.5 py-0.5 text-[10px] text-primary hover:bg-primary/30 transition-colors",title:S("pptx.comments.commentingOn",{element:cs(R)}),onClick:()=>y(R.id),children:[jsx(LuType,{className:"h-2.5 w-2.5"}),cs(R)]}):jsx("span",{className:"mt-1 inline-flex items-center gap-1 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:S("pptx.comments.deletedElement")})),w?jsxs("div",{className:"mt-1.5 space-y-1.5",children:[jsx("textarea",{value:o,onChange:k=>u(k.target.value),rows:3,className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground outline-none focus:border-primary resize-y"}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>l(t.id),disabled:String(o).trim().length===0,children:S("pptx.comments.save")}),jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent",onClick:c,children:S("pptx.comments.cancel")})]})]}):jsxs(Fragment,{children:[jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-[11px] text-foreground",children:t.text}),e&&jsxs("div",{className:"mt-1.5 inline-flex items-center rounded bg-muted overflow-hidden",children:[jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 hover:bg-accent text-foreground hover:text-foreground transition-colors",onClick:()=>a(t.id),title:S("pptx.comments.edit"),children:jsx(LuPencil,{className:"h-3 w-3"})}),f&&v===0&&jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 border-l border-border hover:bg-accent text-foreground hover:text-foreground transition-colors",onClick:()=>f(t.id),title:S("pptx.comments.reply"),children:jsx(LuReply,{className:"h-3 w-3"})}),p&&jsx("button",{type:"button",className:le("inline-flex items-center justify-center p-1.5 border-l border-border transition-colors",t.resolved?"bg-green-900/40 text-green-300 hover:bg-green-900/60":"hover:bg-accent text-foreground hover:text-foreground"),onClick:()=>p(t.id),title:t.resolved?S("pptx.comments.unresolve"):S("pptx.comments.resolve"),children:jsx(LuCheck,{className:"h-3 w-3"})}),jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 border-l border-border hover:bg-red-900/40 text-muted-foreground hover:text-red-300 transition-colors",onClick:()=>d(t.id),title:S("pptx.comments.delete"),children:jsx(LuTrash2,{className:"h-3 w-3"})})]})]}),A.length>0&&jsxs("div",{className:"mt-2",children:[jsxs("button",{type:"button",className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>M(k=>!k),children:[E?jsx(LuChevronDown,{className:"h-3 w-3"}):jsx(LuChevronRight,{className:"h-3 w-3"}),S("pptx.comments.repliesCount",{count:A.length})]}),E&&jsx("div",{className:"mt-1.5 space-y-1.5",children:A.map((k,N)=>jsx(z8,{comment:k,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:u,onDeleteComment:d,onToggleCommentResolved:p,onStartReply:f,onCancelReply:h,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:y,depth:v+1},`${k.id}-${N}`))})]}),C&&h&&m&&x&&jsxs("div",{className:"mt-2 space-y-1.5 pl-3 border-l-2 border-l-primary/40",children:[jsx("textarea",{value:T,onChange:k=>m(t.id,k.target.value),rows:2,placeholder:S("pptx.comments.replyPlaceholder",{author:t.author||"Author"}),className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground outline-none focus:border-primary resize-y",onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),x(t.id));}}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>x(t.id),disabled:T.trim().length===0,children:[jsx(LuReply,{className:"h-3 w-3"}),S("pptx.comments.addReply")]}),jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent",onClick:h,children:S("pptx.comments.cancel")})]})]})]})}function yae({comments:t,canEdit:e,activeSlide:n,selectedElement:r,editingCommentId:o,commentEditDraft:i,commentDraft:s,replyingToCommentId:a,replyDraftByCommentId:l,onSetCommentDraft:c,onAddComment:u,onDeleteComment:d,onStartEditComment:p,onSaveEditComment:f,onCancelEditComment:h,onSetCommentEditDraft:m,onToggleCommentResolved:x,onStartReply:y,onCancelReply:v,onReplyDraftChange:S,onSubmitReply:w,onSelectElement:C}){let{t:T}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:T("pptx.comments.slideComments")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:t.length})]}),t.length===0?jsx("div",{className:"text-xs text-muted-foreground",children:T("pptx.comments.noComments")}):jsx("div",{className:"space-y-2 max-h-[42vh] overflow-y-auto pr-1",children:t.map((M,A)=>jsx(z8,{comment:M,canEdit:e,activeSlide:n,editingCommentId:o,commentEditDraft:i,replyingToCommentId:a,replyDraftByCommentId:l,onStartEditComment:p,onSaveEditComment:f,onCancelEditComment:h,onSetCommentEditDraft:m,onDeleteComment:d,onToggleCommentResolved:x,onStartReply:y,onCancelReply:v,onReplyDraftChange:S,onSubmitReply:w,onSelectElement:C},`${M.id}-${A}`))}),e&&jsxs("div",{className:"space-y-1.5 pt-1 border-t border-border",children:[r&&jsxs("div",{className:"inline-flex items-center gap-1 rounded bg-primary/20 px-1.5 py-0.5 text-[10px] text-primary",children:[jsx(LuType,{className:"h-2.5 w-2.5"}),T("pptx.comments.commentingOn",{element:cs(r)})]}),jsx("textarea",{rows:2,placeholder:r?T("pptx.comments.addOnElement",{element:cs(r)}):T("pptx.comments.addPlaceholder"),value:s,className:"w-full bg-muted border border-border rounded px-2 py-1 text-xs resize-y outline-none focus:border-primary",onChange:M=>c(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.metaKey||M.ctrlKey)&&(M.preventDefault(),u());}}),jsxs("button",{type:"button",onClick:u,disabled:!s.trim(),className:le("w-full inline-flex items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",s.trim()?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:[jsx(LuMessageSquare,{className:"w-3.5 h-3.5"}),T("pptx.comments.addComment")]})]})]})}function G8({label:t,value:e}){return jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{children:t}),jsx("span",{className:"text-muted-foreground",children:e})]})}function oN({label:t,disabled:e,value:n,onChange:r}){return jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"text",className:Fn,disabled:e,value:n,onChange:o=>r(o.target.value)})]})}function T7e({customProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-muted-foreground",children:"Custom Properties"}),e&&jsx("button",{type:"button",className:Xr,onClick:()=>n([...t,{name:`Property ${t.length+1}`,value:"",type:"lpwstr"}]),children:"Add"})]}),t.length===0?jsx("div",{className:"text-[10px] text-muted-foreground",children:"No custom properties"}):t.map((r,o)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1",children:[jsx("input",{type:"text",className:Fn,disabled:!e,value:r.name,onChange:i=>n(t.map((s,a)=>a===o?{...s,name:i.target.value}:s))}),jsx("input",{type:"text",className:Fn,disabled:!e,value:r.value,onChange:i=>n(t.map((s,a)=>a===o?{...s,value:i.target.value}:s))}),e&&jsx("button",{type:"button",className:le(Xr,"px-1.5 text-red-400 hover:text-red-300"),onClick:()=>n(t.filter((i,s)=>s!==o)),children:"\xD7"})]},`${r.name}-${o}`))]})}function bae({notesCanvasSize:t,notesMaster:e,handoutMaster:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Notes & Handout"}),jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[jsx(G8,{label:"Notes Size",value:t?`${t.width} \xD7 ${t.height}px`:"Not available"}),jsx(G8,{label:"Notes Master",value:e?`${e.placeholders?.length??0} placeholders`:"Not available"}),jsx(G8,{label:"Handout Master",value:n?`${n.placeholders?.length??0} placeholders`:"Not available"})]})]})}function vae({coreProperties:t,appProperties:e,customProperties:n,canEdit:r,onUpdateCoreProperties:o,onUpdateAppProperties:i,onUpdateCustomProperties:s}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Document"}),jsxs("div",{className:"space-y-2 text-[11px] text-muted-foreground",children:[jsx(oN,{label:"Title",disabled:!r,value:t?.title??"",onChange:a=>o({title:a})}),jsx(oN,{label:"Author",disabled:!r,value:t?.creator??"",onChange:a=>o({creator:a})}),jsx(oN,{label:"Company",disabled:!r,value:e?.company??"",onChange:a=>i({company:a})}),jsx(oN,{label:"Application",disabled:!r,value:e?.application??"",onChange:a=>i({application:a})}),jsx(T7e,{customProperties:n,canEdit:r,onUpdate:s})]})]})}function iN({label:t,disabled:e,checked:n,onChange:r}){return jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"checkbox",disabled:e,checked:n,onChange:o=>r(o.target.checked)})]})}function Sae({presentationProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Presentation"}),jsxs("div",{className:"space-y-1.5 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Show Type"}),jsxs("select",{disabled:!e,className:le(Fn,"w-28"),value:t.showType??"presented",onChange:r=>n({showType:r.target.value}),children:[jsx("option",{value:"presented",children:"Presented"}),jsx("option",{value:"browsed",children:"Browsed"}),jsx("option",{value:"kiosk",children:"Kiosk"})]})]}),jsx(iN,{label:"Loop Continuously",disabled:!e,checked:!!t.loopContinuously,onChange:r=>n({loopContinuously:r})}),jsx(iN,{label:"Show Narration",disabled:!e,checked:t.showWithNarration!==false,onChange:r=>n({showWithNarration:r})}),jsx(iN,{label:"Show Animation",disabled:!e,checked:t.showWithAnimation!==false,onChange:r=>n({showWithAnimation:r})}),jsx(iN,{label:"Frame Slides",disabled:!e,checked:!!t.printFrameSlides,onChange:r=>n({printFrameSlides:r})}),jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Slides/Page"}),jsx("input",{type:"number",min:1,max:16,disabled:!e,className:le(Fn,"w-20"),value:t.printSlidesPerPage??1,onChange:r=>n({printSlidesPerPage:Number(r.target.value)})})]})]})]})}function wae({themeOptions:t,selectedThemePath:e,setSelectedThemePath:n,canEdit:r,onApplyTheme:o}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Theme"}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Theme"}),jsx("select",{disabled:t.length===0,className:Fn,value:e,onChange:i=>n(i.target.value),children:t.length===0?jsx("option",{value:"",children:"No themes"}):t.map(i=>jsx("option",{value:i.path,children:i.name||i.path.split("/").pop()},i.path))})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsx("button",{type:"button",className:Xr,disabled:!r||!e,onClick:()=>o(e,false),children:"Apply First Master"}),jsx("button",{type:"button",className:Xr,disabled:!r||!e,onClick:()=>o(e,true),children:"Apply All Masters"})]})]})]})}function Cae({canvasSize:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Slide Size"}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[["W","width"],["H","height"]].map(([r,o])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r}),jsx("input",{type:"number",className:Fn,disabled:!e,value:t[o],onChange:i=>n({...t,[o]:Number(i.target.value)})})]},o))})]})}var Tae={bg1:"Background 1",tx1:"Text 1",bg2:"Background 2",tx2:"Text 2",accent1:"Accent 1",accent2:"Accent 2",accent3:"Accent 3",accent4:"Accent 4",accent5:"Accent 5",accent6:"Accent 6",hlink:"Hyperlink",folHlink:"Followed Hyperlink"};function Mae({activeSlide:t,theme:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=t?.clrMapOverride,s=pX(i),a=useMemo(()=>[...Mf],[]),l=useCallback(d=>{if(d){let p={};for(let f of Id)p[f]=Nd[f];r({clrMapOverride:p});}else r({clrMapOverride:void 0});},[r]),c=useCallback((d,p)=>{let h={...i??{},[d]:p};for(let m of Id)h[m]||(h[m]=Nd[m]);r({clrMapOverride:h});},[i,r]),u=useCallback(d=>e?.colorScheme?e.colorScheme[d]:void 0,[e]);return t?jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"inline-flex items-center gap-2 text-xs",children:[jsx("input",{type:"checkbox",disabled:!n,checked:s,onChange:d=>l(d.target.checked)}),o("pptx.themeOverride.enableOverride")]}),s&&i&&jsx("div",{className:"space-y-1.5",children:Id.map(d=>{let p=i[d]??Nd[d],f=u(p);return jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-24 truncate text-muted-foreground",title:Tae[d],children:Tae[d]}),jsx("div",{className:"h-4 w-4 rounded-sm border border-border shrink-0",style:{backgroundColor:f?`#${f.replace(/^#/,"")}`:void 0}}),jsx("select",{disabled:!n,className:"flex-1 bg-muted border border-border rounded px-1 py-0.5 text-[11px]",value:p,onChange:h=>c(d,h.target.value),children:a.map(h=>jsx("option",{value:h,children:h},h))})]},d)})})]}):null}function _ae({tagCollections:t,onUpdateTagCollections:e,canEdit:n}){let{t:r}=useTranslation(),[o,i]=useState(true),s=t.flatMap((u,d)=>u.tags.map((p,f)=>({...p,colIdx:d,tagIdx:f}))),a=(u,d,p,f)=>{let h=t.map((m,x)=>x!==u?m:{...m,tags:m.tags.map((y,v)=>v===d?{...y,[p]:f}:y)});e(h);},l=(u,d)=>{let p=t.map((f,h)=>h!==u?f:{...f,tags:f.tags.filter((m,x)=>x!==d)});e(p);},c=()=>{if(t.length===0)e([{path:"ppt/tags/tag1.xml",tags:[{name:"",value:""}]}]);else {let u=t.map((d,p)=>p!==0?d:{...d,tags:[...d.tags,{name:"",value:""}]});e(u);}};return jsxs("div",{className:xn,children:[jsxs("button",{type:"button",className:"flex items-center gap-1 w-full",onClick:()=>i(!o),children:[o?jsx(LuChevronRight,{className:"w-3 h-3 text-muted-foreground"}):jsx(LuChevronDown,{className:"w-3 h-3 text-muted-foreground"}),jsx("span",{className:hn,children:r("pptx.tags.title")}),jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:s.length})]}),!o&&jsxs("div",{className:"space-y-1.5",children:[s.length===0?jsx("div",{className:"text-[10px] text-muted-foreground",children:r("pptx.tags.noTags")}):s.map((u,d)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1 text-[11px]",children:[jsx("input",{type:"text",className:Fn,disabled:!n,placeholder:r("pptx.tags.name"),value:u.name,onChange:p=>a(u.colIdx,u.tagIdx,"name",p.target.value)}),jsx("input",{type:"text",className:Fn,disabled:!n,placeholder:r("pptx.tags.value"),value:u.value,onChange:p=>a(u.colIdx,u.tagIdx,"value",p.target.value)}),n&&jsx("button",{type:"button",className:le(Xr,"px-1.5 text-red-400 hover:text-red-300"),title:r("pptx.tags.deleteTag"),onClick:()=>l(u.colIdx,u.tagIdx),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},`${u.colIdx}-${u.tagIdx}-${d}`)),n&&jsx("button",{type:"button",className:Xr,onClick:c,children:r("pptx.tags.addTag")})]})]})}function Eae({presentationProperties:t,canEdit:e,onUpdatePresentationProperties:n,themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,onApplyTheme:s,activeSlide:a,theme:l,onUpdateSlide:c,canvasSize:u,onUpdateCanvasSize:d,notesCanvasSize:p,notesMaster:f,handoutMaster:h,coreProperties:m,onUpdateCoreProperties:x,appProperties:y,onUpdateAppProperties:v,customProperties:S,onUpdateCustomProperties:w,tagCollections:C,onUpdateTagCollections:T}){let{t:E}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsx(Sae,{presentationProperties:t,canEdit:e,onUpdate:n}),jsx(wae,{themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,canEdit:e,onApplyTheme:s}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:E("pptx.themeOverride.heading")}),jsx(Mae,{activeSlide:a,theme:l,canEdit:e,onUpdateSlide:c})]}),jsx(Cae,{canvasSize:u,canEdit:e,onUpdate:d}),jsx(bae,{notesCanvasSize:p,notesMaster:f,handoutMaster:h}),jsx(vae,{coreProperties:m,appProperties:y,customProperties:S,canEdit:e,onUpdateCoreProperties:x,onUpdateAppProperties:v,onUpdateCustomProperties:w}),C&&T&&jsx(_ae,{tagCollections:C,onUpdateTagCollections:T,canEdit:e}),a&&jsxs("div",{className:le(xn,"space-y-1"),children:[jsx("div",{className:hn,children:"Slide"}),jsxs("div",{className:"text-[11px] text-muted-foreground",children:[a.elements?.length??0," elements"]})]})]})}function Aae({activeSlide:t,canEdit:e,onUpdateSlide:n,editTemplateMode:r,slideMasters:o,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s}){let a=useRef(null);return jsxs(Fragment,{children:[jsxs("div",{className:le(xn,"space-y-2"),children:[jsx("div",{className:hn,children:"Background"}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-10 shrink-0",children:"Colour"}),jsx(es,{value:dt(t.backgroundColor,"#ffffff"),disabled:!e,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:l=>n({backgroundColor:l})}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:t.backgroundColor||"none"})]}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-10 shrink-0",children:"Image"}),jsx("input",{ref:a,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp,image/svg+xml",className:"hidden",disabled:!e,onChange:l=>{let c=l.target.files?.[0];if(!c)return;let u=new FileReader;u.onload=()=>{typeof u.result=="string"&&n({backgroundImage:u.result});},u.readAsDataURL(c),l.target.value="";}}),jsx("button",{type:"button",className:le(Xr,"flex-1 text-center"),disabled:!e,onClick:()=>a.current?.click(),children:t.backgroundImage?"Replace Image":"Choose Image"})]}),t.backgroundImage&&jsxs("div",{className:"relative mt-1",children:[jsx("img",{src:t.backgroundImage,alt:"Background preview",className:"w-full h-16 object-cover rounded border border-border"}),jsx("button",{type:"button",className:"absolute top-0.5 right-0.5 rounded bg-background/80 hover:bg-red-700 p-0.5 text-[10px] transition-colors",disabled:!e,title:"Remove background image",onClick:()=>n({backgroundImage:void 0}),children:jsx(LuX,{className:"w-3 h-3"})})]})]}),(t.backgroundColor||t.backgroundImage||t.backgroundGradient)&&jsx("button",{type:"button",className:le(Xr,"w-full text-center text-red-400 hover:text-red-300"),disabled:!e,onClick:()=>n({backgroundColor:void 0,backgroundImage:void 0,backgroundGradient:void 0}),children:"Clear Background"})]}),r&&i&&s&&jsx(L7e,{activeSlide:t,slideMasters:o,canEdit:e,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s})]})}function L7e({activeSlide:t,slideMasters:e,canEdit:n,onSetTemplateBackground:r,onGetTemplateBackgroundColor:o}){return jsxs("div",{className:le(xn,"space-y-2"),children:[jsx("div",{className:hn,children:"Template Backgrounds"}),t.layoutPath&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-14 shrink-0 truncate",title:t.layoutName??t.layoutPath,children:"Layout"}),jsx(es,{value:dt(o(t.layoutPath),"#ffffff"),disabled:!n,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:i=>r(t.layoutPath,i)}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:t.layoutName??"Layout"})]}),(()=>{let i=e?.find(s=>s.layoutPaths?.includes(t.layoutPath??""));return i?jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-14 shrink-0 truncate",title:i.name??i.path,children:"Master"}),jsx(es,{value:dt(o(i.path),"#ffffff"),disabled:!n,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:s=>r(i.path,s)}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:i.name??"Master"})]}):null})()]})}function W8(t){let{isOpen:e,canEdit:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:u,onClose:d,onUpdateElement:p,onSelectElement:f,onMoveLayer:h,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:E,onUpdateCoreProperties:M,onUpdateAppProperties:A,onUpdateCustomProperties:R,tagCollections:k,onUpdateTagCollections:N,onApplyTheme:F,comments:B,commentDraft:D,editingCommentId:O,commentEditDraft:U,onSetCommentDraft:H,onAddComment:j,onDeleteComment:Z,onStartEditComment:J,onSaveEditComment:W,onCancelEditComment:te,onSetCommentEditDraft:se,onToggleCommentResolved:Ce,onStartReply:ee,onCancelReply:ce,onReplyDraftChange:ue,onSubmitReply:Ne,replyingToCommentId:Ue,replyDraftByCommentId:he,onUpdateCanvasSize:Be,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe,mediaDataUrls:Y,theme:Ge,panelWidth:Ve}=t,We=s!==null,{t:ke}=useTranslation(),[wt,V]=useState(""),$=80,ie=500,ve=220,[De,$e]=useState(ve),ze=useCallback(ae=>{$e(Se=>Math.min(ie,Math.max($,Se-ae)));},[]);return useEffect(()=>{let ae=xe?.[0]?.themePath;if(ae&&ae.length>0){V(ae);return}let Se=E[0]?.path??"";V(Ye=>Ye||Se);},[xe,E]),jsxs(Fragment,{children:[e&&jsx("button",{type:"button","aria-label":ke("common.close"),onClick:d,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:le("bg-background flex flex-col text-xs text-foreground shadow-xl","max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[75dvh] max-md:rounded-t-2xl max-md:border-t max-md:border-border max-md:z-30 max-md:pb-[max(env(safe-area-inset-bottom),0px)]","max-md:transition-transform max-md:duration-200 max-md:ease-in-out",e?"max-md:translate-y-0":"max-md:translate-y-full","md:h-full md:border-l md:border-border",!Ve&&"md:w-72"),style:Ve?{width:Ve}:void 0,children:[jsx("div",{className:"md:hidden flex items-center justify-center pt-2 pb-1",children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border",children:[jsx("div",{className:"flex items-center gap-1 rounded bg-muted p-0.5",children:cse.map(({key:ae,label:Se,icon:Ye})=>jsxs("button",{type:"button",title:Se,className:le("flex items-center gap-1 px-2 py-1 rounded text-[11px] transition-colors",c===ae?"bg-primary text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"),onClick:()=>u(ae),children:[jsx(Ye,{className:"w-3.5 h-3.5"}),jsx("span",{className:"hidden sm:inline",children:Se})]},ae))}),jsx("button",{type:"button",onClick:d,title:ke("common.close"),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:[c==="elements"&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:le(hn,"mb-2"),children:ke("pptx.inspector.layerOrder")}),r?[...r.elements||[]].reverse().map((ae,Se)=>{let Ye=(r.elements||[]).length-1-Se,Q=s?.id===ae.id||a.includes(ae.id),pe=(ot(ae)?(ae.text||"").slice(0,24):void 0)||ae.type;return jsxs("div",{title:`${ae.type} \u2014 ${ae.id}`,className:le("flex items-center gap-2 px-2 py-1 rounded cursor-pointer transition-colors",Q?"bg-primary/30 text-primary":"hover:bg-muted text-foreground"),onClick:()=>f(ae.id),children:[jsx("span",{className:"text-muted-foreground w-4 text-right",children:Ye+1}),jsx("span",{className:"flex-1 truncate",children:pe})]},ae.id)}):jsx("div",{className:"text-muted-foreground italic",children:ke("pptx.inspector.noSlideSelected")})]}),c==="properties"&&jsx("div",{className:"space-y-3",children:We&&s?jsx(mae,{selectedElement:s,canEdit:n,slides:o,tableEditorState:l,mediaDataUrls:Y,onUpdateElement:p,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onMoveLayer:h}):jsxs(Fragment,{children:[jsx(Eae,{canEdit:n,canvasSize:i,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:E,selectedThemePath:wt,setSelectedThemePath:V,onApplyTheme:F,onUpdateCoreProperties:M,onUpdateAppProperties:A,onUpdateCustomProperties:R,tagCollections:k,onUpdateTagCollections:N,onUpdateCanvasSize:Be,activeSlide:r,theme:Ge,onUpdateSlide:Te}),r&&jsx(Aae,{activeSlide:r,canEdit:n,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe})]})}),c==="comments"&&jsx(yae,{comments:B,canEdit:n,activeSlide:r,selectedElement:s,editingCommentId:O,commentEditDraft:U,commentDraft:D,replyingToCommentId:Ue??null,replyDraftByCommentId:he??{},onSetCommentDraft:H,onAddComment:j,onDeleteComment:Z,onStartEditComment:J,onSaveEditComment:W,onCancelEditComment:te,onSetCommentEditDraft:se,onToggleCommentResolved:Ce,onStartReply:ee,onCancelReply:ce,onReplyDraftChange:ue,onSubmitReply:Ne,onSelectElement:f})]}),We&&s&&r&&jsxs(Fragment,{children:[jsx(Cp,{direction:"vertical",onResize:ze}),jsx("div",{className:"border-t border-border p-3 overflow-y-auto flex-shrink-0",style:{height:De},children:jsx(lse,{selectedElement:s,activeSlide:r,canEdit:n,onUpdateSlide:Te})})]})]})]})}function H7e(t){if(t.length===0)return "";let e=t[0],n=`M ${e.x} ${e.y}`;for(let r=1;r<t.length;r++){let o=t[r];n+=` L ${o.x} ${o.y}`;}return n}function z7e(t){switch(t){case "laser":return "none";case "pen":return "crosshair";case "highlighter":return "crosshair";case "eraser":return "crosshair";default:return "default"}}function q8({canvasSize:t,editorScale:e,presentationTool:n,annotationStrokes:r,currentStroke:o,laserPosition:i,onPointerDown:s,onPointerMove:a,onPointerUp:l,onLaserMove:c,onLaserLeave:u,onEraseAtPoint:d}){let p=useRef(null),f=useRef(false),h=useCallback((w,C)=>{let T=p.current;if(!T)return null;let E=T.getBoundingClientRect(),M=(w-E.left)/e,A=(C-E.top)/e;return {x:M,y:A}},[e]),m=useCallback(w=>{if(n==="none")return;w.preventDefault(),w.stopPropagation();let C=h(w.clientX,w.clientY);if(C){if(n==="eraser"){f.current=true,d(C.x,C.y);return}(n==="pen"||n==="highlighter")&&s(C.x,C.y);}},[n,h,s,d]),x=useCallback(w=>{if(n==="none")return;let C=h(w.clientX,w.clientY);if(C){if(n==="laser"){c(C.x,C.y);return}if(n==="eraser"&&f.current){d(C.x,C.y);return}(n==="pen"||n==="highlighter")&&a(C.x,C.y);}},[n,h,a,c,d]),y=useCallback(w=>{if(n!=="none"){if(w.preventDefault(),n==="eraser"){f.current=false;return}l();}},[n,l]),v=useCallback(()=>{n==="laser"&&u(),n==="eraser"&&(f.current=false),l();},[n,u,l]);if(n==="none")return null;let S=o?[...r,o]:r;return jsxs("div",{className:"absolute inset-0",style:{zIndex:60,cursor:z7e(n),pointerEvents:"auto"},children:[jsx("svg",{ref:p,className:"absolute",style:{width:t.width,height:t.height,transformOrigin:"top left",transform:`scale(${e})`},viewBox:`0 0 ${t.width} ${t.height}`,onPointerDown:m,onPointerMove:x,onPointerUp:y,onPointerLeave:v,children:S.map(w=>jsx("path",{d:H7e(w.points),fill:"none",stroke:w.color,strokeWidth:w.width,strokeLinecap:"round",strokeLinejoin:"round",opacity:w.opacity},w.id))}),n==="laser"&&i&&jsx("div",{className:"absolute rounded-full pointer-events-none",style:{width:24,height:24,left:i.x*e-12,top:i.y*e-12,backgroundColor:"rgba(255, 0, 0, 0.85)",boxShadow:"0 0 12px 6px rgba(255, 0, 0, 0.5), 0 0 24px 12px rgba(255, 0, 0, 0.25)",filter:"drop-shadow(0 0 8px rgba(255, 0, 0, 0.7))",zIndex:70}})]})}function kae(t,e){return `${t+1} / ${e}`}var nYe=["#ff0000","#0000ff","#00aa00","#ff8800","#ffffff","#000000","#ff00ff","#00cccc"],rYe=["#ffff00","#00ff00","#ff69b4","#00bfff","#ff8c00","#adff2f","#ff6347","#87ceeb"];function J8({presentationTool:t,penColor:e,highlighterColor:n,hasAnnotations:r,onSetTool:o,onSetPenColor:i,onSetHighlighterColor:s,onClearAnnotations:a,currentSlideIndex:l,totalSlides:c,onMovePresentationSlide:u,presentationStartTime:d,onEndPresentation:p,onTogglePresenterView:f,presenterMode:h}){let{t:m}=useTranslation(),[x,y]=useState(false),[v,S]=useState(false),w=useRef(null),[C,T]=useState(Date.now());useEffect(()=>{if(!d)return;let F=window.setInterval(()=>T(Date.now()),1e3);return ()=>window.clearInterval(F)},[d]);let E=d?C-d:0;useEffect(()=>{let F=B=>{w.current&&!w.current.contains(B.target)&&(y(false),S(false));};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let M=useCallback(F=>{o(F),y(false),S(false);},[o]),A=useCallback(F=>{F.preventDefault(),y(B=>!B),S(false);},[]),R=useCallback(F=>{F.preventDefault(),S(B=>!B),y(false);},[]),k=F=>`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${t===F?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,N="flex items-center justify-center w-9 h-9 rounded-md transition-colors text-white/70 hover:text-white hover:bg-white/10 disabled:text-white/20 disabled:cursor-not-allowed";return jsxs("div",{ref:w,className:"flex items-center gap-1 px-3 py-2 rounded-xl bg-neutral-900/90 backdrop-blur-md border border-white/15 shadow-2xl",onClick:F=>F.stopPropagation(),children:[jsx("button",{type:"button",className:N,onClick:()=>u(-1),disabled:l===0,title:m("pptx.presenter.previousSlide"),"aria-label":m("pptx.presenter.previousSlide"),children:jsx(LuChevronLeft,{size:18})}),jsx("span",{className:"text-xs font-mono tabular-nums text-white/80 px-1.5 select-none min-w-[48px] text-center",children:kae(l,c)}),jsx("button",{type:"button",className:N,onClick:()=>u(1),disabled:l>=c-1,title:m("pptx.presenter.nextSlide"),"aria-label":m("pptx.presenter.nextSlide"),children:jsx(LuChevronRight,{size:18})}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono tabular-nums text-white/60 px-1 select-none",title:m("pptx.presenter.elapsed"),children:[jsx(LuTimer,{size:14}),jsx("span",{children:q2(E)})]}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsx("button",{type:"button",className:k("laser"),onClick:()=>M("laser"),title:m("pptx.presentation.laserPointer"),children:jsx(LuMousePointer2,{size:18})}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:k("pen"),onClick:()=>M("pen"),onContextMenu:A,title:m("pptx.presentation.pen"),children:[jsx(LuPenTool,{size:18}),jsx("div",{className:"absolute bottom-0.5 left-1/2 -translate-x-1/2 w-3 h-0.5 rounded-full",style:{backgroundColor:e}})]}),jsx("button",{type:"button",className:"flex items-center justify-center w-7 h-9 -ml-1 rounded-r-md transition-colors text-white/50 hover:text-white hover:bg-white/10",onClick:()=>{y(F=>!F),S(false);},title:`${m("pptx.presentation.pen")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),x&&jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 p-3 bg-neutral-800 rounded-lg border border-white/20 shadow-xl grid grid-cols-4 gap-2",children:nYe.map(F=>jsx("button",{type:"button",className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${e===F?"border-white":"border-white/20"}`,style:{backgroundColor:F},onClick:()=>{i(F),y(false),t!=="pen"&&o("pen");}},F))})]}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:k("highlighter"),onClick:()=>M("highlighter"),onContextMenu:R,title:m("pptx.presentation.highlighter"),children:[jsx(LuHighlighter,{size:18}),jsx("div",{className:"absolute bottom-0.5 left-1/2 -translate-x-1/2 w-3 h-0.5 rounded-full",style:{backgroundColor:n}})]}),jsx("button",{type:"button",className:"flex items-center justify-center w-7 h-9 -ml-1 rounded-r-md transition-colors text-white/50 hover:text-white hover:bg-white/10",onClick:()=>{S(F=>!F),y(false);},title:`${m("pptx.presentation.highlighter")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),v&&jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 p-3 bg-neutral-800 rounded-lg border border-white/20 shadow-xl grid grid-cols-4 gap-2",children:rYe.map(F=>jsx("button",{type:"button",className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${n===F?"border-white":"border-white/20"}`,style:{backgroundColor:F},onClick:()=>{s(F),S(false),t!=="highlighter"&&o("highlighter");}},F))})]}),jsx("button",{type:"button",className:k("eraser"),onClick:()=>M("eraser"),title:m("pptx.presentation.eraser"),children:jsx(LuEraser,{size:18})}),jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${r?"text-white/70 hover:text-red-400 hover:bg-white/10":"text-white/30 cursor-not-allowed"}`,onClick:r?a:void 0,title:m("pptx.presentation.clearAnnotations"),disabled:!r,children:jsx(LuTrash2,{size:18})}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),f&&jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${h?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,onClick:f,title:m("pptx.presenter.presenterView",{defaultValue:"Presenter view (N)"}),"aria-label":m("pptx.presenter.presenterView",{defaultValue:"Presenter view"}),children:jsx(LuPanelRight,{size:18})}),jsx("button",{type:"button",className:"flex items-center justify-center w-9 h-9 rounded-md transition-colors text-white/70 hover:text-red-400 hover:bg-white/10",onClick:p,title:m("pptx.presenter.endPresentation"),"aria-label":m("pptx.presenter.endPresentation"),children:jsx(LuX,{size:18})})]})}var Dae=768,Lae=1024;function iYe(){return typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints!==null&&navigator.msMaxTouchPoints>0}function sYe(t){if(typeof window>"u")return ()=>{};let e=()=>t();return window.addEventListener("pointerdown",e,{once:true}),()=>window.removeEventListener("pointerdown",e)}function Fae(){return typeof window>"u"?"landscape":typeof screen<"u"&&screen.orientation?screen.orientation.type.startsWith("portrait")?"portrait":"landscape":window.innerHeight>window.innerWidth?"portrait":"landscape"}function cN(t){let e=t?.containerRef,n=useSyncExternalStore(sYe,iYe,()=>false),[r,o]=useState(()=>typeof window>"u"?1024:e?.current?.clientWidth??window.innerWidth),[i,s]=useState(Fae),[a,l]=useState(false),[c]=useState(()=>typeof window<"u"?window.innerHeight:800);useEffect(()=>{let f=e?.current;if(f){let m=new ResizeObserver(x=>{let y=x[0];y&&o(y.contentRect.width);});return m.observe(f),o(f.clientWidth),()=>m.disconnect()}let h=()=>{o(window.innerWidth);};return window.addEventListener("resize",h),h(),()=>window.removeEventListener("resize",h)},[e]),useEffect(()=>{if(typeof window>"u")return;let f=()=>{s(Fae());};return screen.orientation&&screen.orientation.addEventListener("change",f),window.addEventListener("resize",f),()=>{screen.orientation&&screen.orientation.removeEventListener("change",f),window.removeEventListener("resize",f);}},[]),useEffect(()=>{if(!n||typeof window>"u")return;let f=()=>{let x=(window.visualViewport?.height??window.innerHeight)/c;l(x<.7);},h=window.visualViewport;return h?(h.addEventListener("resize",f),()=>h.removeEventListener("resize",f)):(window.addEventListener("resize",f),()=>window.removeEventListener("resize",f))},[n,c]);let u=r<Dae,d=r>=Dae&&r<Lae,p=r>=Lae;return {isMobile:u,isTablet:d,isDesktop:p,isTouchDevice:n,orientation:i,isVirtualKeyboardOpen:a,containerWidth:r}}function eH({currentSlideIndex:t,totalSlides:e,onMovePresentationSlide:n,onEndPresentation:r}){let{t:o}=useTranslation(),{isTouchDevice:i}=cN();if(!i)return null;let s="pointer-events-auto flex items-center justify-center w-11 h-11 min-w-11 min-h-11 rounded-full bg-black/55 text-white shadow-lg active:bg-black/75",a=l=>{l.stopPropagation();};return jsxs(Fragment,{children:[jsx("button",{type:"button",className:`fixed z-[90] ${s}`,style:{top:"calc(env(safe-area-inset-top, 0px) + 0.5rem)",right:"calc(env(safe-area-inset-right, 0px) + 0.5rem)",touchAction:"manipulation"},onClick:l=>{a(l),r();},"aria-label":o("pptx.presenter.endPresentation"),children:jsx(LuX,{size:22})}),jsx("button",{type:"button",className:`fixed z-[90] top-1/2 -translate-y-1/2 ${s} disabled:opacity-30`,style:{left:"calc(env(safe-area-inset-left, 0px) + 0.5rem)",touchAction:"manipulation"},disabled:t<=0,onClick:l=>{a(l),n(-1);},"aria-label":o("pptx.presenter.previousSlide"),children:jsx(LuChevronLeft,{size:26})}),jsx("button",{type:"button",className:`fixed z-[90] top-1/2 -translate-y-1/2 ${s} disabled:opacity-30`,style:{right:"calc(env(safe-area-inset-right, 0px) + 0.5rem)",touchAction:"manipulation"},disabled:t>=e-1,onClick:l=>{a(l),n(1);},"aria-label":o("pptx.presenter.nextSlide"),children:jsx(LuChevronRight,{size:26})}),jsx("span",{className:"fixed z-[90] left-1/2 -translate-x-1/2 px-3 py-1 rounded-full bg-black/55 text-white text-xs font-mono tabular-nums pointer-events-none",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 0.5rem)"},children:e===0?"0 / 0":`${t+1} / ${e}`})]})}function nH({visible:t}){let{t:e}=useTranslation(),[n,r]=useState(""),[o,i]=useState("unknown"),s=useRef(null),a=useRef(false);if(useEffect(()=>{if(!t){a.current=false,s.current?.stop(),s.current=null,r("");return}a.current=true;let c=window,u=c.SpeechRecognition??c.webkitSpeechRecognition;if(!u){i("unsupported");return}i("supported");let d=new u;d.continuous=true,d.interimResults=true,d.lang=navigator.language||"en-US",d.onresult=p=>{let f="",h="";for(let x=p.resultIndex;x<p.results.length;x+=1){let y=p.results[x],v=y?.[0]?.transcript??"";y?.isFinal?f+=v:h+=v;}let m=`${f} ${h}`.trim();m.length>0&&r(m);},d.onerror=()=>{},d.onend=()=>{if(a.current)try{d.start();}catch{}},s.current=d;try{d.start();}catch{i("unsupported");}return ()=>{a.current=false,d.stop(),s.current=null;}},[t]),!t)return null;let l=o==="unsupported"?e("pptx.subtitles.notSupported"):n.length>0?n:e("pptx.subtitles.listening");return jsx("div",{className:"absolute bottom-14 left-1/2 -translate-x-1/2 z-[70] max-w-[80%] min-w-[300px]",children:jsx("div",{className:"px-6 py-3 rounded-lg bg-black/75 backdrop-blur-sm border border-white/10",children:jsx("p",{className:"text-center text-[15px] text-white/70 italic",children:l})})})}function rH({isOpen:t,annotationCount:e,slideCount:n,onKeep:r,onDiscard:o}){let{t:i}=useTranslation();return t?jsx("div",{style:{zIndex:1200},className:"fixed inset-0 flex items-center justify-center bg-black/50",children:jsxs("div",{className:"bg-background border border-border rounded-lg shadow-xl w-[420px] max-w-[90vw] p-6 animate-in fade-in zoom-in-95 duration-200",children:[jsxs("div",{className:"flex items-center gap-3 mb-4",children:[jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-primary/10",children:jsx(LuPenTool,{className:"w-5 h-5 text-primary"})}),jsxs("div",{children:[jsx("h2",{className:"text-base font-semibold text-foreground",children:i("pptx.presentation.keepAnnotationsTitle")}),jsx("p",{className:"text-sm text-muted-foreground",children:i("pptx.presentation.keepAnnotationsDescription",{count:e,slides:n})})]})]}),jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md border border-border bg-background text-foreground hover:bg-accent transition-colors",onClick:o,children:[jsx(LuTrash2,{className:"w-4 h-4"}),i("pptx.presentation.discardAnnotations")]}),jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md bg-primary text-white hover:bg-primary/90 transition-colors",onClick:r,children:[jsx(LuPenTool,{className:"w-4 h-4"}),i("pptx.presentation.keepAnnotations")]})]})]})}):null}var xYe=.48,yYe=6,$ae=16/9;function bYe(t,e,n=jc){let r=n.width-n.marginLeft-n.marginRight,o=n.height-n.marginTop-n.marginBottom,i=o*xYe,s=r,a=s/$ae;a>i&&(a=i,s=a*$ae);let l=(r-s)/2,c=(i-a)/2,u=i+yYe,d=o-u;return {pageIndex:t,slideIndex:e,slideArea:{x:l,y:c,width:s,height:a},textArea:{x:0,y:u,width:r,height:Math.max(0,d)}}}function oH(t){return t.map((e,n)=>bYe(n,e))}function iH(){return {width:jc.width-jc.marginLeft-jc.marginRight,height:jc.height-jc.marginTop-jc.marginBottom}}var ic=.9,zae=5;function sH({slideIndices:t,slides:e,frameSlides:n,maxPages:r=3}){let{t:o}=useTranslation(),i=useMemo(()=>oH(t),[t]),s=useMemo(()=>iH(),[]),a=i.slice(0,r),l=s.width*ic,c=s.height*ic;return t.length===0?jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:o("pptx.print.preview.noSlides")}):jsxs("div",{className:"flex flex-col items-center gap-3 py-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:o("pptx.print.preview.title")}),a.map(u=>{let p=!!e[u.slideIndex]?.notes;return jsxs("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:l,height:c,overflow:"hidden"},children:[jsx("div",{className:`absolute flex items-center justify-center rounded-sm bg-gray-50 ${n?"border-2 border-gray-800":"border border-gray-300"}`,style:{left:u.slideArea.x*ic,top:u.slideArea.y*ic,width:u.slideArea.width*ic,height:u.slideArea.height*ic},children:jsx("span",{className:"text-[9px] font-medium text-gray-400",children:u.slideIndex+1})}),jsx("div",{className:"absolute left-1 right-1 border-b border-gray-200",style:{top:u.textArea.y*ic-1}}),jsx("div",{className:"absolute",style:{left:u.textArea.x*ic+4,top:u.textArea.y*ic,width:u.textArea.width*ic-8,height:u.textArea.height*ic},children:Array.from({length:zae},(h,m)=>{let x=u.textArea.height*ic/(zae+1);return jsx("div",{className:`absolute left-0 right-0 border-b ${p?"border-gray-300":"border-gray-200"}`,style:{top:x*(m+1)}},m)})})]},u.pageIndex)}),i.length>r&&jsx("span",{className:"text-[10px] text-muted-foreground",children:o("pptx.print.preview.morePages",{count:i.length-r})})]})}var Kv=.9;function uN({slideIndices:t,slidesPerPage:e,orientation:n,frameSlides:r,maxPages:o=3}){let{t:i}=useTranslation(),s=useMemo(()=>aU(t,e,n),[t,e,n]),a=useMemo(()=>lU(n),[n]),l=s.slice(0,o),c=e===3,u=cU(),d=a.width*Kv,p=a.height*Kv,f=.5;return t.length===0?jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:i("pptx.print.preview.noSlides")}):jsxs("div",{className:"flex flex-col items-center gap-3 py-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:i("pptx.print.preview.title")}),l.map(h=>jsx("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:d,height:p,overflow:"hidden"},children:h.cells.map((m,x)=>{let y=m.slideIndex<0,v=m.x*Kv,S=m.y*Kv,w=m.width*Kv,C=m.height*Kv;return jsxs("div",{className:"absolute flex items-start",style:{left:v,top:S,gap:c?2:0},children:[jsx("div",{className:`flex items-center justify-center rounded-sm bg-gray-50 ${y?"opacity-30":""} ${r?"border-2 border-gray-800":"border border-gray-300"}`,style:{width:w,height:C},children:!y&&jsx("span",{className:"text-[9px] font-medium text-gray-400",children:m.slideIndex+1})}),c&&!y&&jsx("div",{className:"relative border-l border-gray-200 pl-1",style:{width:d*f,height:C},children:Array.from({length:u},(E,M)=>{let A=C/(u+1)*(M+1);return jsx("div",{className:"absolute left-1 right-0 border-b border-gray-200",style:{top:A}},M)})})]},x)})},h.pageIndex)),s.length>o&&jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptx.print.preview.morePages",{count:s.length-o})})]})}var dN=[1,2,3,4,6,9],al=t=>`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm cursor-pointer transition-colors ${t?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`;function Xae({printWhat:t,onPrintWhatChange:e,orientation:n,onOrientationChange:r,colorMode:o,onColorModeChange:i,frameSlides:s,onFrameSlidesChange:a,slidesPerPage:l,onSlidesPerPageChange:c,slideRange:u,onSlideRangeChange:d,customFrom:p,onCustomFromChange:f,customTo:h,onCustomToChange:m,totalSlides:x,activeSlideIndex:y}){let{t:v}=useTranslation();return jsxs("div",{className:"flex-1 space-y-5 min-w-0",children:[jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.printWhat")}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("label",{className:al(t==="slides"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="slides",onChange:()=>e("slides")}),jsx(LuFileText,{className:"w-4 h-4 shrink-0"}),v("pptx.print.fullPageSlides")]}),jsxs("label",{className:al(t==="handouts"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="handouts",onChange:()=>e("handouts")}),jsx(LuGrid2X2,{className:"w-4 h-4 shrink-0"}),v("pptx.print.handouts")]}),jsxs("label",{className:al(t==="notes"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="notes",onChange:()=>e("notes")}),jsx(LuStickyNote,{className:"w-4 h-4 shrink-0"}),v("pptx.print.notesPages")]}),jsxs("label",{className:al(t==="outline"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="outline",onChange:()=>e("outline")}),jsx(LuList,{className:"w-4 h-4 shrink-0"}),v("pptx.print.outline")]})]})]}),t==="handouts"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.slidesPerPage")}),jsx("div",{className:"flex gap-1.5 flex-wrap",children:dN.map(S=>jsx("button",{type:"button",onClick:()=>c(S),className:`px-3 py-1.5 rounded-md text-sm font-medium border transition-colors ${l===S?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`,children:S},S))})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.slideRange")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:al(u==="all"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:u==="all",onChange:()=>d("all")}),v("pptx.print.allSlides")," (",x,")"]}),jsxs("label",{className:al(u==="current"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:u==="current",onChange:()=>d("current")}),v("pptx.print.currentSlide")," (",y+1,")"]}),jsxs("label",{className:al(u==="custom"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:u==="custom",onChange:()=>d("custom")}),v("pptx.print.customRange")]}),u==="custom"&&jsxs("div",{className:"flex items-center gap-2 pl-6",children:[jsx("span",{className:"text-xs text-muted-foreground",children:v("pptx.print.from")}),jsx("input",{type:"number",min:1,max:x,value:p,onChange:S=>f(Math.max(1,parseInt(S.target.value,10)||1)),className:"w-16 px-2 py-1 text-sm border border-border rounded bg-background text-foreground"}),jsx("span",{className:"text-xs text-muted-foreground",children:v("pptx.print.to")}),jsx("input",{type:"number",min:1,max:x,value:h,onChange:S=>m(Math.max(1,parseInt(S.target.value,10)||1)),className:"w-16 px-2 py-1 text-sm border border-border rounded bg-background text-foreground"})]})]})]}),t==="slides"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.orientation")}),jsxs("div",{className:"flex gap-2",children:[jsxs("label",{className:al(n==="landscape"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="landscape",onChange:()=>r("landscape")}),v("pptx.print.landscape")]}),jsxs("label",{className:al(n==="portrait"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="portrait",onChange:()=>r("portrait")}),v("pptx.print.portrait")]})]})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.colorMode")}),jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxs("label",{className:al(o==="color"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="color",onChange:()=>i("color")}),v("pptx.print.color")]}),jsxs("label",{className:al(o==="grayscale"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="grayscale",onChange:()=>i("grayscale")}),v("pptx.print.grayscale")]}),jsxs("label",{className:al(o==="blackAndWhite"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="blackAndWhite",onChange:()=>i("blackAndWhite")}),v("pptx.print.blackAndWhite")]})]})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:s,onChange:S=>a(S.target.checked),className:"rounded border-border"}),jsx("span",{className:"text-sm text-foreground",children:v("pptx.print.frameSlides")})]})]})}function aH({open:t,onClose:e,onPrint:n,slides:r,activeSlideIndex:o,defaultSlidesPerPage:i,defaultFrameSlides:s}){let{t:a}=useTranslation(),[l,c]=useState("slides"),[u,d]=useState("landscape"),[p,f]=useState("color"),[h,m]=useState(s??false),[x,y]=useState(dN.includes(i)?i:6),[v,S]=useState("all"),[w,C]=useState(1),[T,E]=useState(r.length),M=useMemo(()=>l==="notes"||l==="outline"||l==="handouts"?"portrait":u,[l,u]),A=useMemo(()=>{if(v==="all")return r.length;if(v==="current")return 1;let F=Math.max(1,Math.min(w,r.length));return Math.max(F,Math.min(T,r.length))-F+1},[v,r.length,w,T]),R=useMemo(()=>l==="slides"||l==="notes"?A:l==="outline"?1:Math.ceil(A/x),[l,A,x]),k=useMemo(()=>{if(v==="current")return [o];if(v==="custom"){let F=Math.max(0,w-1),B=Math.min(r.length-1,T-1);return Array.from({length:Math.max(0,B-F+1)},(D,O)=>F+O)}return Array.from({length:r.length},(F,B)=>B)},[v,o,w,T,r.length]),N=useCallback(()=>{n({printWhat:l,orientation:M,colorMode:p,frameSlides:h,slidesPerPage:x,slideRange:v,customRangeFrom:Math.max(1,Math.min(w,r.length)),customRangeTo:Math.max(1,Math.min(T,r.length))});},[l,M,p,h,x,v,w,T,r.length,n]);return t?jsx("div",{style:{zIndex:1200},className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:jsxs("div",{className:"w-[780px] max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuPrinter,{className:"w-4 h-4 text-muted-foreground"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:a("pptx.print.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex gap-5",children:[jsx(Xae,{printWhat:l,onPrintWhatChange:c,orientation:u,onOrientationChange:d,colorMode:p,onColorModeChange:f,frameSlides:h,onFrameSlidesChange:m,slidesPerPage:x,onSlidesPerPageChange:y,slideRange:v,onSlideRangeChange:S,customFrom:w,onCustomFromChange:C,customTo:T,onCustomToChange:E,totalSlides:r.length,activeSlideIndex:o}),l==="handouts"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(uN,{slideIndices:k,slidesPerPage:x,orientation:M,frameSlides:h})}),l==="notes"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(sH,{slideIndices:k,slides:r,frameSlides:h})})]}),jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[jsx("span",{className:"text-xs text-muted-foreground",children:a("pptx.print.pageEstimate",{pages:R,slides:A})}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a("common.cancel")}),jsxs("button",{type:"button",onClick:N,className:"px-4 py-2 text-sm rounded-lg bg-primary text-white hover:bg-primary/90 transition-colors flex items-center gap-1.5",children:[jsx(LuPrinter,{className:"w-3.5 h-3.5"}),a("pptx.print.printButton")]})]})]})]})}):null}function Yae({draft:t,update:e}){let{t:n}=useTranslation();return jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:n("pptx.slideShow.showOptions")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:!!t.loopContinuously,onChange:r=>e({loopContinuously:r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.loopContinuously")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:t.showWithNarration===false,onChange:r=>e({showWithNarration:!r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showWithoutNarration")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:t.showWithAnimation===false,onChange:r=>e({showWithAnimation:!r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showWithoutAnimation")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:!!t.showSubtitles,onChange:r=>e({showSubtitles:r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showSubtitles")})]})]})}function qae({draft:t,update:e,showSlidesMode:n,slideCount:r,customShows:o}){let{t:i}=useTranslation();return jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:i("pptx.slideShow.showSlides")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"all",checked:n==="all",onChange:()=>e({showSlidesMode:"all"}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.allSlides")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"range",checked:n==="range",onChange:()=>e({showSlidesMode:"range",showSlidesFrom:t.showSlidesFrom??1,showSlidesTo:t.showSlidesTo??r}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.fromTo")})]}),n==="range"&&jsxs("div",{className:"flex items-center gap-2 ml-6",children:[jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.slideShow.from")}),jsx("input",{type:"number",min:1,max:r,value:t.showSlidesFrom??1,onChange:s=>e({showSlidesFrom:Math.max(1,Number.parseInt(s.target.value,10)||1)}),className:"w-14 px-1.5 py-0.5 rounded bg-muted border border-border text-foreground text-[11px]"})]}),jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.slideShow.to")}),jsx("input",{type:"number",min:1,max:r,value:t.showSlidesTo??r,onChange:s=>e({showSlidesTo:Math.min(r,Number.parseInt(s.target.value,10)||r)}),className:"w-14 px-1.5 py-0.5 rounded bg-muted border border-border text-foreground text-[11px]"})]})]}),o.length>0&&jsxs(Fragment,{children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"customShow",checked:n==="customShow",onChange:()=>e({showSlidesMode:"customShow",showSlidesCustomShowId:t.showSlidesCustomShowId??o[0]?.id}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.customShow")})]}),n==="customShow"&&jsx("div",{className:"ml-6",children:jsx("select",{value:t.showSlidesCustomShowId??o[0]?.id??"",onChange:s=>e({showSlidesCustomShowId:s.target.value}),className:"w-full px-2 py-1 rounded bg-muted border border-border text-foreground text-[11px]",children:o.map(s=>jsx("option",{value:s.id,children:s.name},s.id))})})]})]})}function lH({open:t,onClose:e,properties:n,onSave:r,customShows:o,slideCount:i}){let{t:s}=useTranslation(),[a,l]=useState({...n}),c=useCallback(f=>{l(h=>({...h,...f}));},[]),u=useCallback(()=>{r(a),e();},[a,r,e]);if(!t)return null;let d=a.showType??"presented",p=a.showSlidesMode??"all";return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":"Close dialog",onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-xl border border-border bg-background shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.slideShow.setUpTitle")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"px-5 py-4 space-y-5 text-[12px] text-foreground max-h-[70vh] overflow-y-auto",children:[jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:s("pptx.slideShow.showType")}),[["presented",s("pptx.slideShow.presentedBySpeaker")],["browsed",s("pptx.slideShow.browsedByIndividual")],["kiosk",s("pptx.slideShow.browsedAtKiosk")]].map(([f,h])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showType",value:f,checked:d===f,onChange:()=>c({showType:f,...f==="kiosk"?{loopContinuously:true}:{}}),className:"accent-primary"}),jsx("span",{children:h})]},f))]}),jsx(qae,{draft:a,update:c,showSlidesMode:p,slideCount:i,customShows:o}),jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:s("pptx.slideShow.advanceSlides")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"advanceMode",value:"manual",checked:(a.advanceMode??"manual")==="manual",onChange:()=>c({advanceMode:"manual"}),className:"accent-primary"}),jsx("span",{children:s("pptx.slideShow.manually")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"advanceMode",value:"useTimings",checked:a.advanceMode==="useTimings",onChange:()=>c({advanceMode:"useTimings"}),className:"accent-primary"}),jsx("span",{children:s("pptx.slideShow.useTimings")})]})]}),jsx(Yae,{draft:a,update:c})]}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:u,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-[12px] text-white transition-colors",children:s("common.ok")})]})]})})]})}function fH({open:t,onClose:e,onStartBroadcast:n,onStopBroadcast:r,onStartPresenting:o,defaultRoomId:i,defaultUserName:s,defaultServerUrl:a}){let{t:l}=useTranslation(),c=qi(),u=c!==null&&c.status!=="disconnected"&&c.status!=="error"&&c.config.role==="broadcaster",[d,p]=useState(""),[f,h]=useState(""),[m,x]=useState(""),[y,v]=useState(false),S=useRef(null);useEffect(()=>{if(t&&!u){let A=i?`broadcast-${i}`:`broadcast-${Math.random().toString(36).slice(2,10)}`;p(A),h(s??""),x(a??"ws://localhost:1234");}},[t,u,i,s,a]),useEffect(()=>{if(!t)return;function A(R){R.key==="Escape"&&e();}return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[t,e]),useEffect(()=>{t&&S.current&&S.current.focus();},[t]);let w=typeof window<"u"?`${window.location.origin}${window.location.pathname}?broadcast=${encodeURIComponent(u?c.config.roomId:d)}&server=${encodeURIComponent(u?c.config.serverUrl:m)}`:d,C=useCallback(()=>{navigator.clipboard.writeText(w).then(()=>{v(true),setTimeout(()=>v(false),2e3);});},[w]),T=useCallback(()=>{!d.trim()||!f.trim()||(n?.({roomId:d.trim(),serverUrl:m.trim(),userName:f.trim(),role:"broadcaster"}),setTimeout(()=>{o?.();},100),e());},[d,f,m,n,o,e]),E=useCallback(()=>{r?.(),e();},[r,e]),M=d.trim().length>0&&f.trim().length>0&&m.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":"Close dialog",onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":l("pptx.broadcast.title"),tabIndex:-1,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsxs("h2",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[jsx(LuCast,{className:"w-4 h-4"}),l(u?"pptx.broadcast.broadcasting":"pptx.broadcast.title")]}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:u?jsx(jYe,{collab:c,broadcastUrl:w,copied:y,onCopyUrl:C,onStopBroadcast:E}):jsx(VYe,{roomId:d,userName:f,serverUrl:m,onRoomIdChange:p,onUserNameChange:h,onServerUrlChange:x})}),!u&&jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:l("common.close")}),jsx("button",{type:"button",disabled:!M,onClick:T,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/90 text-[12px] text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:l("pptx.broadcast.startBroadcast")})]})]})})]}):null}function VYe({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i}){let{t:s}=useTranslation();return jsxs("div",{className:"space-y-4",children:[jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed",children:s("pptx.broadcast.description")}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-room-id",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.sessionName")}),jsx("input",{id:"broadcast-room-id",type:"text",value:t,onChange:a=>r(a.target.value),placeholder:"broadcast-abc123",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-user-name",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.displayName")}),jsx("input",{id:"broadcast-user-name",type:"text",value:e,onChange:a=>o(a.target.value),placeholder:"Presenter",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-server-url",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.serverLabel")}),jsx("input",{id:"broadcast-server-url",type:"text",value:n,onChange:a=>i(a.target.value),placeholder:"ws://localhost:1234",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsx("p",{className:"text-[11px] text-muted-foreground/70 leading-relaxed",children:s("pptx.broadcast.hint")})]})}function jYe({collab:t,broadcastUrl:e,copied:n,onCopyUrl:r,onStopBroadcast:o}){let{t:i}=useTranslation(),s=t.status==="connected"?"text-green-400":t.status==="connecting"?"text-yellow-400":"text-red-400",a=t.status==="connected"||t.status==="connecting"?jsx(LuWifi,{className:"w-4 h-4"}):jsx(LuWifiOff,{className:"w-4 h-4"}),l=t.remoteUsers.filter(c=>c.role==="viewer").length;return jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:s,children:a}),jsx("span",{className:"text-[13px] font-medium text-foreground capitalize",children:t.status}),jsxs("span",{className:"text-[12px] text-muted-foreground ml-auto flex items-center gap-1",children:[jsx(LuUsers,{className:"w-3.5 h-3.5"}),i("pptx.broadcast.viewerCount",{count:l})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.broadcast.viewerLink")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex-1 px-3 py-1.5 rounded border border-border bg-background text-[11px] text-foreground select-all font-mono truncate",children:e}),jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2.5 py-1.5 rounded border border-border bg-muted hover:bg-accent text-[12px] text-foreground transition-colors shrink-0",title:i("pptx.broadcast.copyLink"),children:n?jsxs(Fragment,{children:[jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}),jsx("span",{children:i("pptx.share.copied")})]}):jsxs(Fragment,{children:[jsx(LuCopy,{className:"w-3.5 h-3.5"}),jsx("span",{children:i("pptx.share.copyUrl")})]})})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:i("pptx.broadcast.shareHint")})]}),t.remoteUsers.length>0&&jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.broadcast.viewers")}),jsx("div",{className:"rounded border border-border bg-background divide-y divide-border max-h-[120px] overflow-y-auto",children:t.remoteUsers.map(c=>jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-semibold text-white shrink-0",style:{backgroundColor:c.userColor},children:c.userName.slice(0,2).toUpperCase()}),jsx("span",{className:"text-[12px] text-foreground truncate",children:c.userName}),jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["Slide ",c.activeSlideIndex+1]})]},c.clientId))})]}),jsx("button",{type:"button",onClick:o,className:"w-full px-3 py-2 rounded border border-red-500/30 bg-red-500/10 hover:bg-red-500/20 text-[12px] text-red-400 font-medium transition-colors",children:i("pptx.broadcast.stopBroadcast")})]})}function Jae(t){let e=t.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function xH({open:t,onClose:e,activeCollaboration:n,onStartCollaboration:r,onStopCollaboration:o,preconfigured:i,defaultRoomId:s,defaultUserName:a,defaultServerUrl:l}){let c=qi(),u=c!==null&&c.status!=="disconnected"&&c.status!=="error",{t:d}=useTranslation(),[p,f]=useState(s??""),[h,m]=useState(a??""),[x,y]=useState(l??""),[v,S]=useState(false),w=useRef(null);useEffect(()=>{n&&(f(n.roomId),m(n.userName),y(n.serverUrl));},[n]),useEffect(()=>{if(!t)return;function M(A){A.key==="Escape"&&e();}return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[t,e]),useEffect(()=>{t&&w.current&&w.current.focus();},[t]);let C=useCallback(()=>{let M=n??{roomId:p,serverUrl:x},A=typeof window<"u"?`${window.location.origin}${window.location.pathname}?room=${encodeURIComponent(M.roomId)}&server=${encodeURIComponent(M.serverUrl)}`:M.roomId;navigator.clipboard.writeText(A).then(()=>{S(true),setTimeout(()=>S(false),2e3);});},[n,p,x]),T=useCallback(()=>{!p.trim()||!h.trim()||r?.({roomId:p.trim(),serverUrl:x.trim(),userName:h.trim()});},[p,h,x,r]),E=p.trim().length>0&&h.trim().length>0&&x.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":d("pptx.share.closeDialog"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-label":d("pptx.share.title"),tabIndex:-1,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:d(u?"pptx.share.collaborationActive":"pptx.share.title")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":d("pptx.share.close"),children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:u?jsx(QYe,{collab:c,activeCollaboration:n,copied:v,onCopyRoomId:C,onStopCollaboration:o}):jsx(JYe,{roomId:p,userName:h,serverUrl:x,onRoomIdChange:f,onUserNameChange:m,onServerUrlChange:y,preconfigured:i})}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:d(u?"pptx.share.close":"pptx.share.cancel")}),!u&&jsx("button",{type:"button",disabled:!E,onClick:T,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/90 text-[12px] text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:d("pptx.share.startSharing")})]})]})})]}):null}function JYe({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i,preconfigured:s}){let{t:a}=useTranslation(),l=s?" opacity-70 cursor-not-allowed":"";return jsxs("div",{className:"space-y-4",children:[jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed",children:a(s?"pptx.share.preconfiguredDescription":"pptx.share.description")}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-room-id",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.sessionName")}),jsx("input",{id:"share-room-id",type:"text",value:t,onChange:c=>r(c.target.value),readOnly:s,placeholder:a("pptx.share.sessionPlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`}),jsx("p",{className:"text-[11px] text-muted-foreground",children:a("pptx.share.sessionHint")})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-user-name",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.displayName")}),jsx("input",{id:"share-user-name",type:"text",value:e,onChange:c=>o(c.target.value),readOnly:s,placeholder:a("pptx.share.namePlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-server-url",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.serverLabel")}),jsx("input",{id:"share-server-url",type:"text",value:n,onChange:c=>i(c.target.value),readOnly:s,placeholder:a("pptx.share.serverPlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`})]}),jsxs("p",{className:"text-[11px] text-muted-foreground/70 leading-relaxed",children:["Run"," ",jsx("code",{className:"px-1 py-0.5 rounded bg-muted text-[10px] font-mono",children:"bun run collab"})," ","to start the server. Others can join at"," ",jsx("code",{className:"px-1 py-0.5 rounded bg-muted text-[10px] font-mono",children:"?room=SESSION_NAME"})]})]})}function QYe({collab:t,activeCollaboration:e,copied:n,onCopyRoomId:r,onStopCollaboration:o}){let{t:i}=useTranslation(),s=t.status==="connected"?"text-green-400":t.status==="connecting"?"text-yellow-400":"text-red-400",a=t.status==="connected"||t.status==="connecting"?jsx(LuWifi,{className:"w-4 h-4"}):jsx(LuWifiOff,{className:"w-4 h-4"});return jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:s,children:a}),jsx("span",{className:"text-[13px] font-medium text-foreground capitalize",children:t.status}),jsxs("span",{className:"text-[12px] text-muted-foreground ml-auto flex items-center gap-1",children:[jsx(LuUsers,{className:"w-3.5 h-3.5"}),i("pptx.collaboration.userCount",{count:t.connectedCount})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.share.shareLink")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex-1 px-3 py-1.5 rounded border border-border bg-background text-[11px] text-foreground select-all font-mono truncate",children:typeof window<"u"?`${window.location.origin}${window.location.pathname}?room=${encodeURIComponent(t.config.roomId)}&server=${encodeURIComponent(t.config.serverUrl)}`:t.config.roomId}),jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2.5 py-1.5 rounded border border-border bg-muted hover:bg-accent text-[12px] text-foreground transition-colors shrink-0",title:i("pptx.share.copyLink"),children:n?jsxs(Fragment,{children:[jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}),jsx("span",{children:i("pptx.share.copied")})]}):jsxs(Fragment,{children:[jsx(LuCopy,{className:"w-3.5 h-3.5"}),jsx("span",{children:i("pptx.share.copyUrl")})]})})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:i("pptx.share.shareHint")})]}),jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[jsxs("span",{children:[i("pptx.share.room")," ",jsx("code",{className:"font-mono text-foreground",children:t.config.roomId})]}),jsxs("span",{children:[i("pptx.share.server")," ",jsx("code",{className:"font-mono text-foreground",children:t.config.serverUrl})]})]}),t.remoteUsers.length>0&&jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.share.connectedUsers")}),jsxs("div",{className:"rounded border border-border bg-background divide-y divide-border max-h-[140px] overflow-y-auto",children:[jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-semibold text-white shrink-0",style:{backgroundColor:t.config.userColor??"#6366f1"},children:Jae(e?.userName??t.config.userName)}),jsx("span",{className:"text-[12px] text-foreground truncate",children:e?.userName??t.config.userName}),jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:i("pptx.share.you")})]}),t.remoteUsers.map(l=>jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-semibold text-white shrink-0",style:{backgroundColor:l.userColor},children:l.userAvatar?jsx("img",{src:l.userAvatar,alt:"",className:"w-full h-full rounded-full object-cover"}):Jae(l.userName)}),jsx("span",{className:"text-[12px] text-foreground truncate",children:l.userName}),jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["Slide ",l.activeSlideIndex+1]})]},l.clientId))]})]}),o&&jsx("button",{type:"button",onClick:o,className:"w-full px-3 py-2 rounded border border-red-500/30 bg-red-500/10 hover:bg-red-500/20 text-[12px] text-red-400 font-medium transition-colors",children:i("pptx.share.stopSharing")})]})}var mN={"ppaction://hlinkshowjump?jump=nextslide":"nextSlide","ppaction://hlinkshowjump?jump=previousslide":"prevSlide","ppaction://hlinkshowjump?jump=firstslide":"firstSlide","ppaction://hlinkshowjump?jump=lastslide":"lastSlide","ppaction://hlinkshowjump?jump=endshow":"endShow"},Qae={nextSlide:"ppaction://hlinkshowjump?jump=nextslide",prevSlide:"ppaction://hlinkshowjump?jump=previousslide",firstSlide:"ppaction://hlinkshowjump?jump=firstslide",lastSlide:"ppaction://hlinkshowjump?jump=lastslide",endShow:"ppaction://hlinkshowjump?jump=endshow"};function ele(t,e){return e&&e.startsWith("ppaction://")?e.includes("hlinksldjump")?"slide":(mN[e.toLowerCase()],"action"):t?t.startsWith("mailto:")?"email":/^[a-zA-Z]:\\|^\.\.?[/\\]|^file:/i.test(t)?"file":"url":"url"}function tle(t){if(!t.startsWith("mailto:"))return {address:t,subject:""};let e=t.slice(7),n=e.indexOf("?");if(n<0)return {address:e,subject:""};let r=e.slice(0,n),o=new URLSearchParams(e.slice(n+1));return {address:r,subject:o.get("subject")||""}}function nle(t,e){if(e==="ppaction://hlinksldjump"&&t){let n=t.match(/slide(\d+)\.xml$/i);if(n)return parseInt(n[1],10)}if(t){let n=t.match(/#\s*Slide\s+(\d+)/i);if(n)return parseInt(n[1],10)}return 1}function rle(t){let e=t.tooltip.trim()||void 0;switch(t.targetType){case "email":return {url:t.emailSubject?`mailto:${t.emailAddress}?subject=${encodeURIComponent(t.emailSubject)}`:`mailto:${t.emailAddress}`,tooltip:e};case "slide":return {url:`slide${t.slideNumber}.xml`,action:"ppaction://hlinksldjump",tooltip:e};case "file":return {url:t.filePath,tooltip:e};case "action":return {url:"",action:Qae[t.actionVerb],tooltip:e};default:return {url:t.url,tooltip:e}}}function ole({targetType:t,url:e,setUrl:n,tooltip:r,setTooltip:o,emailAddress:i,setEmailAddress:s,emailSubject:a,setEmailSubject:l,slideNumber:c,setSlideNumber:u,slideCount:d,filePath:p,setFilePath:f,actionVerb:h,setActionVerb:m,inputRef:x,inputCls:y,onEnterConfirm:v}){let{t:S}=useTranslation(),w=C=>{C.key==="Enter"&&v();};return jsxs("div",{className:"px-4 py-3 space-y-3",children:[t==="url"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.urlLabel")}),jsx("input",{ref:x,type:"url",className:y,placeholder:"https://example.com",value:e,onChange:C=>n(C.target.value),onKeyDown:w})]}),t==="email"&&jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.emailLabel")}),jsx("input",{ref:x,type:"email",className:y,placeholder:"user@example.com",value:i,onChange:C=>s(C.target.value),onKeyDown:w})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.subjectLabel")}),jsx("input",{type:"text",className:y,value:a,onChange:C=>l(C.target.value)})]})]}),t==="slide"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.slideLabel")}),jsx("input",{ref:x,type:"number",min:1,max:d,className:y,value:c,onChange:C=>u(parseInt(C.target.value,10)||1),onKeyDown:w}),jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:S("pptx.hyperlink.slideRange",{max:d})})]}),t==="file"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.fileLabel")}),jsx("input",{ref:x,type:"text",className:y,placeholder:"../documents/file.docx",value:p,onChange:C=>f(C.target.value),onKeyDown:w})]}),t==="action"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.actionLabel")}),jsxs("select",{className:y,value:h,onChange:C=>m(C.target.value),children:[jsx("option",{value:"nextSlide",children:S("pptx.hyperlink.actionNextSlide")}),jsx("option",{value:"prevSlide",children:S("pptx.hyperlink.actionPrevSlide")}),jsx("option",{value:"firstSlide",children:S("pptx.hyperlink.actionFirstSlide")}),jsx("option",{value:"lastSlide",children:S("pptx.hyperlink.actionLastSlide")}),jsx("option",{value:"endShow",children:S("pptx.hyperlink.actionEndShow")})]})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.tooltipLabel")}),jsx("input",{type:"text",className:y,value:r,onChange:C=>o(C.target.value)})]})]})}function yH({open:t,initialUrl:e,initialTooltip:n,initialAction:r,slideCount:o,onConfirm:i,onCancel:s}){let{t:a}=useTranslation(),l=useRef(null),c=ele(e,r),u=tle(e||""),d=nle(e,r),p=r&&mN[r.toLowerCase()]||"nextSlide",[f,h]=useState(c),[m,x]=useState(c==="email"||c==="slide"||c==="action"?"":e||""),[y,v]=useState(n||""),[S,w]=useState(u.address),[C,T]=useState(u.subject),[E,M]=useState(d),[A,R]=useState(c==="file"&&e||""),[k,N]=useState(p);if(useEffect(()=>{t&&setTimeout(()=>l.current?.focus(),50);},[t]),!t)return null;let F=()=>{i({targetType:f,url:m,tooltip:y,emailAddress:S,emailSubject:C,slideNumber:E,filePath:A,actionVerb:k});},B=O=>le("px-3 py-1.5 text-xs rounded-t border-b-2 transition-colors",O?"border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:border-border");return jsxs(Fragment,{children:[jsx("div",{style:{zIndex:1200},className:"fixed inset-0 bg-black/40",onClick:s}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-lg border border-border bg-popover shadow-2xl",onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:a("pptx.hyperlink.editTitle")}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:s,children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex gap-1 px-4 pt-2 border-b border-border",children:[jsx("button",{type:"button",className:B(f==="url"),onClick:()=>h("url"),children:a("pptx.hyperlink.tabUrl")}),jsx("button",{type:"button",className:B(f==="email"),onClick:()=>h("email"),children:a("pptx.hyperlink.tabEmail")}),jsx("button",{type:"button",className:B(f==="slide"),onClick:()=>h("slide"),children:a("pptx.hyperlink.tabSlide")}),jsx("button",{type:"button",className:B(f==="file"),onClick:()=>h("file"),children:a("pptx.hyperlink.tabFile")}),jsx("button",{type:"button",className:B(f==="action"),onClick:()=>h("action"),children:a("pptx.hyperlink.tabAction")})]}),jsx(ole,{targetType:f,url:m,setUrl:x,tooltip:y,setTooltip:v,emailAddress:S,setEmailAddress:w,emailSubject:C,setEmailSubject:T,slideNumber:E,setSlideNumber:M,slideCount:o,filePath:A,setFilePath:R,actionVerb:k,setActionVerb:N,inputRef:l,inputCls:"w-full rounded border border-border bg-background px-2.5 py-1.5 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary",onEnterConfirm:F}),jsxs("div",{className:"flex justify-end gap-2 px-4 py-3 border-t border-border",children:[jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded border border-border text-foreground hover:bg-muted",onClick:s,children:a("common.cancel")}),jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded bg-primary text-white hover:bg-primary/90",onClick:F,children:a("common.apply")})]})]})})]})}function ile({guides:t,onDeleteGuide:e,onStartGuideDrag:n}){return jsx(Fragment,{children:t.map(r=>jsx("div",{className:"absolute z-[49] pointer-events-auto",style:r.axis==="h"?{left:0,right:0,top:r.position,height:1,backgroundColor:"rgba(250, 204, 21, 0.9)",cursor:"row-resize"}:{top:0,bottom:0,left:r.position,width:1,backgroundColor:"rgba(250, 204, 21, 0.9)",cursor:"col-resize"},onDoubleClick:o=>{o.stopPropagation(),e?.(r.id);},onPointerDown:o=>{o.stopPropagation(),o.currentTarget.setPointerCapture(o.pointerId),n({id:r.id,axis:r.axis,pointerId:o.pointerId});},title:"Drag guide. Double-click to remove."},r.id))})}function sle({backgroundImage:t,backgroundGradient:e}){return jsxs(Fragment,{children:[t&&jsx("img",{src:t,alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",draggable:false}),e&&jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:e}})]})}function ale({marqueeSelectionState:t}){return t?jsx("div",{className:"absolute border border-primary bg-primary/10 pointer-events-none z-50",style:{left:Math.min(t.startX,t.currentX),top:Math.min(t.startY,t.currentY),width:Math.abs(t.currentX-t.startX),height:Math.abs(t.currentY-t.startY)}}):null}function lle({snapLines:t}){return jsx(Fragment,{children:t.map((e,n)=>jsx("div",{className:"absolute bg-red-500 pointer-events-none z-50",style:e.axis==="x"?{left:e.position,top:0,width:1,height:"100%"}:{left:0,top:e.position,width:"100%",height:1}},n))})}function ule({comments:t,canvasSize:e,onCommentMarkerClick:n}){return jsx("div",{className:"absolute inset-0 pointer-events-none z-[45]",children:t.map((r,o)=>{let i=$7(r,o,e.width,e.height);return jsx("div",{className:"absolute pointer-events-auto cursor-pointer",style:{left:i.x-10,top:i.y-10,width:20,height:20,borderRadius:"50%",backgroundColor:"rgba(255, 165, 0, 0.9)",border:"2px solid #fff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,color:"#fff",lineHeight:1},title:`${r.author??"Comment"}: ${r.text}`,onClick:s=>{s.stopPropagation(),n?.(r.id);},children:o+1},r.id)})})}function dle({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r,onConnectionSiteDown:o,onConnectorDragMove:i,onConnectionSiteDrop:s,onConnectorDragEnd:a}){return jsxs("div",{className:"absolute inset-0 z-[55] pointer-events-none",onMouseMove:i,onMouseUp:a,style:{pointerEvents:r?"auto":"none"},children:[t.elements.filter(l=>l.type!=="connector").map(l=>gu(l.width,l.height).map(u=>jsx("div",{className:"absolute rounded-full border-2 border-blue-500 bg-blue-400/60 hover:bg-blue-500 hover:scale-125 transition-transform cursor-crosshair",style:{left:l.x+u.x-5,top:l.y+u.y-5,width:10,height:10,pointerEvents:"auto",zIndex:56},onMouseDown:d=>o(l.id,u.index,d),onMouseUp:()=>r?s(l.id,u.index):void 0},`${l.id}-site-${u.index}`))),r&&jsx(lqe,{activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r})]})}function lqe({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r}){let o=t.elements.find(h=>h.id===r.startElementId);if(!o)return null;let i=gu(o.width,o.height),s=i[r.startSiteIndex]??i[0],a=o.x+s.x,l=o.y+s.y,c=n.canvasStageRef.current;if(!c)return null;let u=c.getBoundingClientRect(),d=n.editorScale||1,p=(r.currentX-u.left)/d,f=(r.currentY-u.top)/d;return jsx("svg",{className:"absolute inset-0",style:{width:e.width,height:e.height,pointerEvents:"none"},viewBox:`0 0 ${e.width} ${e.height}`,children:jsx("line",{x1:a,y1:l,x2:p,y2:f,stroke:"#3b82f6",strokeWidth:2,strokeDasharray:"6 4",strokeLinecap:"round"})})}function fle({canvasSize:t,activeTool:e,drawingColor:n,drawingWidth:r,isStrokeActive:o,liveStrokeD:i,onPointerDown:s,onPointerMove:a,onPointerUp:l}){return jsx("svg",{className:"absolute inset-0 z-[60]",style:{width:t.width,height:t.height,cursor:"crosshair",touchAction:"none"},viewBox:`0 0 ${t.width} ${t.height}`,onPointerDown:s,onPointerMove:a,onPointerUp:l,children:o&&i&&jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:r,strokeOpacity:e==="highlighter"?.4:1,strokeLinecap:"round",strokeLinejoin:"round"})})}function hle({canvasSize:t,gridSpacingPx:e=8,visible:n}){let r=Math.max(e,2),o=useMemo(()=>`grid-dot-pattern-${Math.random().toString(36).slice(2,8)}`,[]);return n?jsxs("svg",{className:"absolute inset-0 pointer-events-none z-[2]",width:t.width,height:t.height,xmlns:"http://www.w3.org/2000/svg",children:[jsx("defs",{children:jsx("pattern",{id:o,width:r,height:r,patternUnits:"userSpaceOnUse",children:jsx("circle",{cx:r/2,cy:r/2,r:.6,fill:"rgba(156, 163, 175, 0.55)"})})}),jsx("rect",{width:t.width,height:t.height,fill:`url(#${o})`})]}):null}var pqe=37.79527559055118,Qn=20,uM=10;function vH(t,e,n){let r=n==="inches"?96:pqe,o=r*e,s=n==="inches"?8:10,a=4;for(;s>1&&o/s<a&&(s=Math.max(1,Math.floor(s/2)),!(s<=1)););let l=1,c=30;for(;o*l<c;)l*=2;let u=t/r,d=Math.ceil(u*s),p=[];for(let f=0;f<=d;f++){let h=f/s,m=h*r;if(m>t+.5)break;let x=m*e,y=f%s===0,v=Math.round(h),S=y&&v%l===0;p.push({position:x,label:S?String(v):"",isMajor:y});}return p}var gle=Vn__default.memo(function({ticks:e,widthPx:n,highlight:r}){return jsxs("svg",{width:n,height:Qn,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:n,height:Qn,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:0,y1:Qn-.5,x2:n,y2:Qn-.5,className:"stroke-border",strokeWidth:1}),r&&jsx("rect",{x:r.start,y:0,width:Math.max(r.end-r.start,1),height:Qn,className:"fill-primary/20"}),e.map((o,i)=>{let s=o.isMajor?Qn*.6:Qn*.3;return jsxs("g",{children:[jsx("line",{x1:o.position,y1:Qn,x2:o.position,y2:Qn-s,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:o.isMajor?1:.5}),o.label&&jsx("text",{x:o.position+2,y:uM+1,fontSize:uM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})}),xle=Vn__default.memo(function({ticks:e,heightPx:n,highlight:r}){return jsxs("svg",{width:Qn,height:n,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:Qn,height:n,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:Qn-.5,y1:0,x2:Qn-.5,y2:n,className:"stroke-border",strokeWidth:1}),r&&jsx("rect",{x:0,y:r.start,width:Qn,height:Math.max(r.end-r.start,1),className:"fill-primary/20"}),e.map((o,i)=>{let s=o.isMajor?Qn*.6:Qn*.3;return jsxs("g",{children:[jsx("line",{x1:Qn,y1:o.position,x2:Qn-s,y2:o.position,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:o.isMajor?1:.5}),o.label&&jsx("text",{x:2,y:o.position+uM+2,fontSize:uM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})});function ble({canvasSize:t,editorScale:e,unit:n,visible:r,selectedBounds:o,onCreateGuideFromRuler:i}){let s=useMemo(()=>vH(t.width,e,n),[t.width,e,n]),a=useMemo(()=>vH(t.height,e,n),[t.height,e,n]),l=useMemo(()=>o?{start:o.x*e,end:(o.x+o.width)*e}:null,[o,e]),c=useMemo(()=>o?{start:o.y*e,end:(o.y+o.height)*e}:null,[o,e]),[u,d]=useState(null),p=useRef(null),f=useRef(null),h=useCallback(S=>{i&&(S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),d({axis:"h",pointerId:S.pointerId}));},[i]),m=useCallback(S=>{i&&(S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),d({axis:"v",pointerId:S.pointerId}));},[i]),x=useCallback(S=>{if(!u||!i)return;try{S.currentTarget.releasePointerCapture(u.pointerId);}catch{}let w=e||1;if(u.axis==="h"){let C=p.current;if(!C){d(null);return}let T=C.getBoundingClientRect(),E=S.clientY-T.top;if(E>Qn){let M=(E-Qn)/w;M>=0&&M<=t.height&&i("h",M);}}else {let C=f.current;if(!C){d(null);return}let T=C.getBoundingClientRect(),E=S.clientX-T.left;if(E>Qn){let M=(E-Qn)/w;M>=0&&M<=t.width&&i("v",M);}}d(null);},[u,i,e,t]);if(!r)return null;let y=t.width*e,v=t.height*e;return jsxs(Fragment,{children:[jsx("div",{className:"absolute z-[51] bg-gray-100 dark:bg-gray-800 border-r border-b border-border",style:{top:0,left:0,width:Qn,height:Qn}}),jsx("div",{ref:p,className:"absolute z-[50] overflow-visible",style:{top:0,left:Qn,width:y,height:Qn,cursor:i?"row-resize":void 0},onPointerDown:h,onPointerUp:x,children:jsx(gle,{ticks:s,widthPx:y,highlight:l})}),jsx("div",{ref:f,className:"absolute z-[50] overflow-visible",style:{top:Qn,left:0,width:Qn,height:v,cursor:i?"col-resize":void 0},onPointerDown:m,onPointerUp:x,children:jsx(xle,{ticks:a,heightPx:v,highlight:c})})]})}function Zv(t){let e=t.target;for(;e;){if(e.dataset?.pptxElement==="true")return e.dataset.elementId||null;e=e.parentElement;}return null}var xqe=300;function wle({cbRef:t,onCanvasMouseDown:e,findResults:n,findResultIndex:r,activeSlideIndex:o,selectedElement:i,zoom:s,onMoveGuide:a}){let l=useMemo(()=>{let C=new Map;if(!n||n.length===0||o===null)return C;for(let T=0;T<n.length;T++){let E=n[T];if(E.slideIndex!==o)continue;C.has(E.elementId)||C.set(E.elementId,new Map);let M=C.get(E.elementId);M.has(E.segmentIndex)||M.set(E.segmentIndex,[]),M.get(E.segmentIndex).push({startOffset:E.startOffset,length:E.length,isCurrent:T===(r??-1)});}return C},[n,r,o]),c=useMemo(()=>i?{x:i.x,y:i.y,width:i.width,height:i.height}:null,[i]),u=useCallback(C=>{let T=Zv(C);T&&t.current.onClick(T,C);},[t]),d=useCallback(C=>{let T=Zv(C);T&&t.current.onDoubleClick(T,C);},[t]),p=useRef(false),f=useCallback(C=>{if(p.current){p.current=false;return}let T=Zv(C);if(T){t.current.onMouseDown(T,C);return}e?.(C);},[t,e]),h=useRef(null),m=useCallback(C=>{if(C.pointerType==="mouse")return;p.current=true,C.currentTarget.setPointerCapture?.(C.pointerId);let T=Zv(C);if(T){let E=C.timeStamp||Date.now(),M=h.current;if(M&&M.id===T&&E-M.time<xqe){h.current=null,t.current.onDoubleClick(T,C);return}h.current={id:T,time:E},t.current.onMouseDown(T,C);return}h.current=null,e?.(C);},[t,e]),x=useCallback(C=>{let T=Zv(C);T&&t.current.onContextMenu(T,C);},[t]),[y,v]=useState(null),S=useCallback(C=>{if(!y||!a)return;let T=s.canvasStageRef.current;if(!T)return;let E=T.getBoundingClientRect(),M=s.editorScale||1,A=y.axis==="h"?(C.clientY-E.top)/M:(C.clientX-E.left)/M;a(y.id,A);},[y,a,s.canvasStageRef,s.editorScale]),w=useCallback(C=>{if(y){try{C.currentTarget.releasePointerCapture(y.pointerId);}catch{}v(null);}},[y]);return {elementFindHighlightsMap:l,selectedBounds:c,handleStageClick:u,handleStageDblClick:d,handleStageMouseDown:f,handleStagePointerDown:m,handleStageContextMenu:x,draggingGuide:y,setDraggingGuide:v,handleStagePointerMove:S,handleStagePointerUp:w}}function Cle({activeSlide:t,zoom:e,onCreateConnector:n}){let[r,o]=useState(null),i=useCallback((c,u,d)=>{d.stopPropagation(),d.preventDefault(),o({startElementId:c,startSiteIndex:u,currentX:d.clientX,currentY:d.clientY});},[]),s=useCallback(c=>{r&&o(u=>u?{...u,currentX:c.clientX,currentY:c.clientY}:null);},[r]),a=useCallback((c,u)=>{if(!r||!n)return;if(r.startElementId===c){o(null);return}let d=t?.elements.find(R=>R.id===r.startElementId),p=t?.elements.find(R=>R.id===c);if(!d||!p){o(null);return}let f=gu(d.width,d.height),h=gu(p.width,p.height),m=f[r.startSiteIndex]??f[0],x=h[u]??h[0],y=d.x+m.x,v=d.y+m.y,S=p.x+x.x,w=p.y+x.y,C=Math.abs(S-y),T=Math.abs(w-v),E=Math.sqrt(C*C+T*T),M=E<100?"straightConnector1":E<300?"bentConnector3":"curvedConnector3",A={id:`conn-new-${Date.now()}`,type:"connector",x:Math.min(y,S),y:Math.min(v,w),width:Math.abs(S-y)||1,height:Math.abs(w-v)||1,shapeType:M,shapeStyle:{strokeColor:"#4472C4",strokeWidth:2,connectorStartConnection:{shapeId:r.startElementId,connectionSiteIndex:r.startSiteIndex},connectorEndConnection:{shapeId:c,connectionSiteIndex:u}}};n(A),o(null);},[r,n,t?.elements]),l=useCallback(()=>{o(null);},[]);return {connectorDragState:r,handleConnectionSiteDown:i,handleConnectorDragMove:s,handleConnectionSiteDrop:a,handleConnectorDragEnd:l}}function Tle({activeTool:t,activeSlide:e,zoom:n,drawingColor:r,drawingWidth:o,isDrawingRef:i,onAddInkElement:s,onAddFreeformShape:a,onEraseInkElement:l}){let c=t!=="select",[u,d]=useState([]),[p,f]=useState([]),[h,m]=useState(false),x=useCallback(T=>{let E=n.canvasStageRef.current;if(!E)return null;let M=E.getBoundingClientRect(),A=n.editorScale||1;return {x:(T.clientX-M.left)/A,y:(T.clientY-M.top)/A}},[n.canvasStageRef,n.editorScale]),y=useCallback(T=>{if(T.length===0)return "";let E=[`M ${T[0].x} ${T[0].y}`];for(let M=1;M<T.length;M++)E.push(`L ${T[M].x} ${T[M].y}`);return E.join(" ")},[]),v=useCallback(T=>{if(t==="select")return;if(t==="eraser"&&e){let M=x(T);if(!M)return;let A=15;for(let R of [...e.elements].reverse())if(R.type==="ink"&&M.x>=R.x-A&&M.x<=R.x+R.width+A&&M.y>=R.y-A&&M.y<=R.y+R.height+A){l?.(R.id);break}return}let E=x(T);E&&(T.preventDefault(),T.target.setPointerCapture(T.pointerId),d([E]),f([T.pressure]),m(true),i&&(i.current=true));},[t,e,x,i,l]),S=useCallback(T=>{if(!h||t==="select"||t==="eraser")return;let E=x(T);E&&(d(M=>[...M,E]),f(M=>[...M,T.pressure]));},[h,t,x]),w=useCallback(T=>{if(!h||t==="select"||t==="eraser")return;if(T.target.releasePointerCapture(T.pointerId),m(false),i&&(i.current=false),u.length<2){d([]);return}let E=1/0,M=1/0,A=-1/0,R=-1/0;for(let D of u)D.x<E&&(E=D.x),D.y<M&&(M=D.y),D.x>A&&(A=D.x),D.y>R&&(R=D.y);let k=o;E-=k,M-=k,A+=k,R+=k;let N=Math.max(A-E,1),F=Math.max(R-M,1),B=u.map(D=>({x:D.x-E,y:D.y-M}));if(t==="freeform"){let O=Math.round(N*100),U=Math.round(F*100),H=[];for(let Z=0;Z<B.length;Z++){let J={x:Math.round(B[Z].x*100),y:Math.round(B[Z].y*100)};H.push(Z===0?{type:"moveTo",pt:J}:{type:"lineTo",pt:J});}H.length>2&&H.push({type:"close"});let j={id:`shape-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"shape",x:E,y:M,width:N,height:F,shapeType:"custom",shapeStyle:{fillColor:"transparent",strokeColor:r,strokeWidth:o},customGeometryPaths:[{width:O,height:U,segments:H}]};a?.(j);}else {let D=y(B),O=t==="highlighter",U=p.length>=2&&p.some(j=>Math.abs(j-p[0])>.01),H={id:`ink-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"ink",x:E,y:M,width:N,height:F,inkPaths:[D],inkColors:[r],inkWidths:[o],inkOpacities:[O?.4:1],inkTool:O?"highlighter":"pen",...U?{inkPointPressures:[p]}:{}};s?.(H);}d([]),f([]);},[h,t,u,r,o,i,s,a,y,p]),C=useMemo(()=>h?y(u):"",[h,u,y]);return {isDrawing:c,isStrokeActive:h,liveStrokeD:C,currentStrokePoints:u,handleDrawPointerDown:v,handleDrawPointerMove:S,handleDrawPointerUp:w}}function Mle(t){let e=useRef(t);e.current=t;let n=useCallback((d,p,f)=>e.current.onResizePointerDown(d,p,f),[]),r=useCallback((d,p)=>e.current.onAdjustmentPointerDown(d,p),[]),o=useCallback(d=>e.current.onInlineEditChange(d),[]),i=useCallback(()=>e.current.onInlineEditCommit(),[]),s=useCallback(()=>e.current.onInlineEditCancel(),[]),a=useCallback((d,p)=>e.current.onTableCellSelect(d,p),[]),l=useCallback((d,p,f,h)=>e.current.onCommitCellEdit?.(d,p,f,h),[]),c=useCallback((d,p)=>e.current.onResizeTableColumns?.(d,p),[]),u=useCallback((d,p,f)=>e.current.onResizeTableRow?.(d,p,f),[]);return {cbRef:e,stableResizePointerDown:n,stableAdjustmentPointerDown:r,stableInlineEditChange:o,stableInlineEditCommit:i,stableInlineEditCancel:s,stableTableCellSelect:a,stableCommitCellEdit:l,stableResizeTableColumns:c,stableResizeTableRow:u}}function CH({activeSlide:t,templateElements:e,canvasSize:n,zoom:r,mode:o,canEdit:i,editTemplateMode:s,selectedElementIdSet:a,selectedElement:l,inlineEditingElementId:c,inlineEditingText:u,spellCheckEnabled:d,mediaDataUrls:p,tableEditorState:f,marqueeSelectionState:h,snapLines:m,showGrid:x,gridSpacingPx:y,showRulers:v,rulerUnit:S="inches",guides:w,presentationElementStates:C,presentationKeyframesCss:T,onClick:E,onDoubleClick:M,onMouseDown:A,onContextMenu:R,onCanvasMouseDown:k,onResizePointerDown:N,onAdjustmentPointerDown:F,onInlineEditChange:B,onInlineEditCommit:D,onInlineEditCancel:O,onTableCellSelect:U,onCommitCellEdit:H,onResizeTableColumns:j,onResizeTableRow:Z,findResults:J,findResultIndex:W,activeSlideIndex:te,activeTool:se="select",drawingColor:Ce="#000000",drawingWidth:ee=3,isDrawingRef:ce,onAddInkElement:ue,onAddFreeformShape:Ne,onEraseInkElement:Ue,onActionClick:he,onHyperlinkClick:Be,comments:Me,showCommentMarkers:ge=false,onCommentMarkerClick:Te,onMoveGuide:be,onDeleteGuide:xe,onCreateGuideFromRuler:Pe,connectorCreationMode:Xe=false,onCreateConnector:Y,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt,collaborationOverlay:V}){let $=(o==="edit"||o==="master")&&i,{cbRef:ie,stableResizePointerDown:ve,stableAdjustmentPointerDown:De,stableInlineEditChange:$e,stableInlineEditCommit:ze,stableInlineEditCancel:ae,stableTableCellSelect:Se,stableCommitCellEdit:Ye,stableResizeTableColumns:Q,stableResizeTableRow:pe}=Mle({onClick:E,onDoubleClick:M,onMouseDown:A,onContextMenu:R,onResizePointerDown:N,onAdjustmentPointerDown:F,onInlineEditChange:B,onInlineEditCommit:D,onInlineEditCancel:O,onTableCellSelect:U,onCommitCellEdit:H,onResizeTableColumns:j,onResizeTableRow:Z}),{elementFindHighlightsMap:Re,selectedBounds:nt,handleStageClick:Ke,handleStageDblClick:Ct,handleStageMouseDown:ne,handleStagePointerDown:Ze,handleStageContextMenu:Le,setDraggingGuide:rt,handleStagePointerMove:qe,handleStagePointerUp:He}=wle({cbRef:ie,onCanvasMouseDown:k,findResults:J,findResultIndex:W,activeSlideIndex:te,selectedElement:l,zoom:r,onMoveGuide:be}),{connectorDragState:gt,handleConnectionSiteDown:Nt,handleConnectorDragMove:In,handleConnectionSiteDrop:yn,handleConnectorDragEnd:Zo}=Cle({activeSlide:t,zoom:r,onCreateConnector:Y}),{isDrawing:Ii,isStrokeActive:La,liveStrokeD:Qc,handleDrawPointerDown:eu,handleDrawPointerMove:ra,handleDrawPointerUp:oa}=Tle({activeTool:se,activeSlide:t,zoom:r,drawingColor:Ce,drawingWidth:ee,isDrawingRef:ce,onAddInkElement:ue,onAddFreeformShape:Ne,onEraseInkElement:Ue}),Fs=v?Qn:0;return jsx("div",{ref:r.canvasViewportRef,"data-pptx-viewport":true,className:"flex-1 overflow-auto relative",style:{touchAction:"pan-x pan-y"},children:jsxs("div",{ref:r.editWrapperRef,className:"relative mx-auto my-4",style:{width:n.width*r.editorScale+Fs,height:n.height*r.editorScale+Fs},children:[jsx(ble,{canvasSize:n,editorScale:r.editorScale,unit:S,visible:v,selectedBounds:nt,onCreateGuideFromRuler:Pe}),jsxs("div",{ref:r.canvasStageRef,role:"region","aria-label":`Slide ${(te??0)+1}`,"aria-roledescription":"slide",className:"relative shadow-2xl",style:{width:n.width,height:n.height,transform:`scale(${r.editorScale})`,transformOrigin:"top left",marginTop:Fs,marginLeft:Fs,touchAction:$?"none":void 0,backgroundColor:t?.backgroundColor&&t.backgroundColor!=="transparent"?t.backgroundColor:"#ffffff"},onClick:Ke,onDoubleClick:Ct,onMouseDown:ne,onPointerDown:$?Ze:void 0,onContextMenu:Le,onPointerMove:qe,onPointerUp:He,children:[T&&jsx("style",{children:T}),jsx(hle,{canvasSize:n,gridSpacingPx:y,visible:x}),jsx(ile,{guides:w,onDeleteGuide:xe,onStartGuideDrag:rt}),jsx(sle,{backgroundImage:t?.backgroundImage,backgroundGradient:t?.backgroundGradient}),e.map((Sr,pl)=>jsx(rk,{element:Sr,activeSlide:t,isSelected:a.has(Sr.id),isInlineEditing:c===Sr.id,inlineEditingText:u,canInteract:(o==="edit"||o==="master")&&i&&s,spellCheckEnabled:d,mediaDataUrls:p,selectionColorClass:"blue-400",showHoverBorder:false,opacity:.95,zIndex:pl,imageAltText:"Template element",showResizeHandles:$&&a.has(Sr.id)&&a.size<=1&&!c,renderInk:false,renderGroups:false,adjustmentHandleDescriptor:$&&l?.id===Sr.id?kE(Sr):null,onResizePointerDown:ve,onAdjustmentPointerDown:De,onInlineEditChange:$e,onInlineEditCommit:ze,onInlineEditCancel:ae,onActionClick:he,onHyperlinkClick:Be,animationState:C?.get(Sr.id),presentationElementStates:C,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt},`tpl-${Sr.id}`)),t?.elements.map((Sr,pl)=>jsx(rk,{element:Sr,activeSlide:t,isSelected:a.has(Sr.id),isInlineEditing:c===Sr.id,inlineEditingText:u,canInteract:(o==="edit"||o==="master")&&i,spellCheckEnabled:d,mediaDataUrls:p,tableEditorState:f,selectionColorClass:"blue-500",showHoverBorder:true,zIndex:e.length+pl,imageAltText:"Slide element",showResizeHandles:$&&a.has(Sr.id)&&a.size<=1&&!c,renderInk:true,renderGroups:true,adjustmentHandleDescriptor:$&&l?.id===Sr.id?kE(Sr):null,onResizePointerDown:ve,onAdjustmentPointerDown:De,onInlineEditChange:$e,onInlineEditCommit:ze,onInlineEditCancel:ae,onTableCellSelect:Se,onCommitCellEdit:Ye,onResizeTableColumns:Q,onResizeTableRow:pe,findHighlights:Re.get(Sr.id),onActionClick:he,onHyperlinkClick:Be,animationState:C?.get(Sr.id),presentationElementStates:C,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt},Sr.id)),jsx(ale,{marqueeSelectionState:h}),ge&&Me&&Me.length>0&&jsx(ule,{comments:Me,canvasSize:n,onCommentMarkerClick:Te}),jsx(lle,{snapLines:m}),Xe&&t&&jsx(dle,{activeSlide:t,canvasSize:n,zoom:r,connectorDragState:gt,onConnectionSiteDown:Nt,onConnectorDragMove:In,onConnectionSiteDrop:yn,onConnectorDragEnd:Zo}),Ii&&jsx(fle,{canvasSize:n,activeTool:se,drawingColor:Ce,drawingWidth:ee,isStrokeActive:La,liveStrokeD:Qc,onPointerDown:eu,onPointerMove:ra,onPointerUp:oa}),V]})]})})}function MH({isShortcutHelpOpen:t,isAccessibilityPanelOpen:e,showSlideSorter:n,accessibilityIssues:r,slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onCloseShortcuts:c,onCloseAccessibility:u,onSelectSlide:d,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onCloseSorter:x,reducedMotion:y,onToggleReducedMotion:v}){return t||e||n?jsxs(Fragment,{children:[t&&jsx(xU,{isOpen:t,onClose:c}),e&&jsx(yU,{isOpen:e,issues:r,onClose:u,reducedMotion:y,onToggleReducedMotion:v}),n&&jsx($6,{slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onSelectSlide:d,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onClose:x})]}):null}function EH({activeSlide:t,allSlides:e,isSlideNotesCollapsed:n,canEdit:r,slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,onToggleNotes:l,onUpdateNotes:c,collaborationSlot:u,notesPanelHeight:d,onResizeBottom:p,scale:f,onZoomIn:h,onZoomOut:m,onZoomToFit:x,mode:y,onSetMode:v,onToggleSlideSorter:S,hideStatusBar:w=false}){return jsxs(Fragment,{children:[p&&!n&&jsx(Cp,{direction:"vertical",onResize:p}),jsx(V6,{activeSlide:t,allSlides:e,isExpanded:!n,canEdit:r,onToggle:l,onUpdateNotes:c,panelHeight:d}),!w&&jsx(SU,{slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,scale:f,onZoomIn:h,onZoomOut:m,onZoomToFit:x,isNotesExpanded:!n,onToggleNotes:l,mode:y,onSetMode:v,onToggleSlideSorter:S,collaborationSlot:u})]})}function AH({isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,effectiveSelectedIds:a,tableEditorState:l,sidebarPanelMode:c,activeSlideIndex:u,comments:d,onSetSidebarPanelMode:p,onClose:f,onUpdateElementStyle:h,onUpdateTextStyle:m,onUpdateElement:x,onApplySelection:y,onSetCanvasSize:v,onMoveLayer:S,onMoveLayerToEdge:w,onDeleteElement:C,onUpdateSlide:T,presentationProperties:E,onUpdatePresentationProperties:M,notesMaster:A,handoutMaster:R,notesCanvasSize:k,coreProperties:N,appProperties:F,customProperties:B,themeOptions:D,onUpdateCoreProperties:O,onUpdateAppProperties:U,onUpdateCustomProperties:H,tagCollections:j,onUpdateTagCollections:Z,onApplyTheme:J,editTemplateMode:W,slideMasters:te,onSetTemplateBackground:se,onGetTemplateBackgroundColor:Ce,mediaDataUrls:ee,theme:ce,panelWidth:ue}){if(!t)return null;let Ne=c;if(!s&&Ne!=="comments"&&Ne!=="properties")return null;let Ue=r?.id??"",he=d.commentDraftBySlideId[Ue]??"",Be=d.editingCommentIdBySlideId[Ue]??null;return jsx("div",{role:"complementary","aria-label":"Properties",className:"h-full flex-shrink-0 max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:z-30",style:ue?{width:ue}:void 0,children:jsx(W8,{isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:Me=>p(Me),onClose:f,onUpdateElementStyle:h,onUpdateTextStyle:m,onUpdateElement:x,onUpdateSlide:T,onSelectElement:Me=>y(Me),onMoveLayer:S,onMoveLayerToEdge:w,onDeleteElement:C,comments:r?.comments??[],presentationProperties:E,onUpdatePresentationProperties:M,notesMaster:A,handoutMaster:R,notesCanvasSize:k,coreProperties:N,appProperties:F,customProperties:B,themeOptions:D,onUpdateCoreProperties:O,onUpdateAppProperties:U,onUpdateCustomProperties:H,tagCollections:j,onUpdateTagCollections:Z,onApplyTheme:J,commentDraft:he,editingCommentId:Be,commentEditDraft:Be?d.commentEditDraftByCommentId[Be]??"":"",onSetCommentDraft:Me=>d.handleCommentDraftChange(Ue,Me),onAddComment:()=>d.handleAddSlideComment(u),onDeleteComment:Me=>d.handleDeleteSlideComment(u,Me),onStartEditComment:Me=>d.handleStartCommentEdit(Ue,Me),onSaveEditComment:Me=>d.handleSaveCommentEdit(u,Me),onCancelEditComment:()=>d.handleCancelCommentEdit(Ue),onSetCommentEditDraft:Me=>d.handleSetCommentEditDraft(d.editingCommentIdBySlideId[Ue]??"",Me),onToggleCommentResolved:Me=>d.handleToggleCommentResolved(u,Me),onStartReply:Me=>d.handleStartReply(u,Me),onCancelReply:d.handleCancelReply,onReplyDraftChange:(Me,ge)=>d.handleReplyDraftChange(Me,ge),onSubmitReply:Me=>d.handleSubmitReply(u,Me),replyingToCommentId:d.replyingToCommentId,replyDraftByCommentId:d.replyDraftByCommentId,onUpdateCanvasSize:v,editTemplateMode:W,slideMasters:te,onSetTemplateBackground:se,onGetTemplateBackgroundColor:Ce,mediaDataUrls:ee,theme:ce,panelWidth:ue})})}function Ale(t,e){if(!e?.layoutPath||!t.some(u=>u.masterPath))return t;let o=t.find(u=>u.path===e.layoutPath)?.masterPath;if(!o)return t;let i=t.filter(u=>u.masterPath===o),s=new Map;for(let u of i){let d=u.path===e.layoutPath;(!s.get(u.name)||d)&&s.set(u.name,u);}let a=new Set(Array.from(s.values()).map(u=>u.path)),l=[],c=new Set;for(let u of i)a.has(u.path)&&(c.has(u.name)||(c.add(u.name),l.push(u)));return l}function PH(t){let{mode:e,canEdit:n,state:r,selectedElement:o,activeSlide:i,zoom:s,history:a,findReplace:l,manipulation:c,insertHandlers:u,exportHandlers:d,printHandlers:p,propertyHandlers:f,dialogs:h,slideOps:m,ops:x,onSetMode:y,onEnterPresenterView:v,onEnterRehearsalMode:S,onOpenSettings:w,onOpenShareDialog:C,onToggleFormatPainter:T}=t,E=useCallback((N,F)=>{if(!o||!i)return;let B=i.animations??[],D=B.find(U=>U.elementId===o.id),O=N;if(D){let U=B.map(H=>H.elementId===o.id?{...H,[F]:O}:H);f.handleUpdateSlide({animations:U});}else {let U={elementId:o.id,[F]:O,durationMs:500,order:B.length,trigger:"onClick"};f.handleUpdateSlide({animations:[...B,U]});}},[o,i,f]),M=useCallback(()=>{if(!o||!i)return;let F=(i.animations??[]).filter(B=>B.elementId!==o.id);f.handleUpdateSlide({animations:F});},[o,i,f]),A=useCallback(N=>{if(!i)return;let F=i.transition??{type:"none"};f.handleUpdateSlide({transition:{...F,...N}});},[i,f]),R=Vn__default.useMemo(()=>Ale(r.layoutOptions,i),[r.layoutOptions,i]),k=useCallback(()=>{let N=i?.transition;N&&(x.updateSlides(F=>F.map(B=>({...B,transition:N}))),a.markDirty());},[i,x,a]);return jsxs(Fragment,{children:[jsx(R8,{mode:e,canEdit:n,isNarrowViewport:h.isNarrowViewport,isSidebarCollapsed:!r.isSlidesPaneOpen,isInspectorPaneOpen:r.isInspectorPaneOpen,isCompactToolbarOpen:r.isCompactToolbarOpen,toolbarSection:r.toolbarSection,scale:s.scale,canUndo:a.canUndo,canRedo:a.canRedo,undoLabel:a.undoLabel,redoLabel:a.redoLabel,findReplaceOpen:l.findReplaceOpen,selectedElement:o,tableEditorState:r.tableEditorState,editTemplateMode:r.editTemplateMode,newShapeType:r.newShapeType,activeTool:r.activeTool,drawingColor:r.drawingColor,drawingWidth:r.drawingWidth,clipboardPayload:r.clipboardPayload,onSetMode:y,onToggleSidebar:()=>r.setIsSlidesPaneOpen(N=>!N),onToggleInspector:()=>r.setIsInspectorPaneOpen(N=>!N),onOpenAnimationPanel:()=>{r.setIsInspectorPaneOpen(true),r.setSidebarPanelMode("properties");},onAddAnimation:E,onRemoveAnimation:M,onToggleCompactToolbar:()=>r.setIsCompactToolbarOpen(N=>!N),onSetToolbarSection:r.setToolbarSection,onZoomIn:s.handleZoomIn,onZoomOut:s.handleZoomOut,onZoomToFit:s.handleZoomToFit,onUndo:a.handleUndo,onRedo:a.handleRedo,onToggleFindReplace:()=>l.setFindReplaceOpen(!l.findReplaceOpen),onSetNewShapeType:r.setNewShapeType,onAddTextBox:u.handleAddTextBox,onAddShape:u.handleAddShape,onAddTable:u.handleAddTable,onAddSmartArt:()=>h.setIsSmartArtDialogOpen(true),onAddEquation:()=>{h.setEditingEquationOmml(null),h.setIsEquationDialogOpen(true);},onAddActionButton:u.handleAddActionButton,onInsertField:u.handleInsertField,onOpenImagePicker:()=>r.imageInputRef.current?.click(),onOpenMediaPicker:()=>r.mediaInputRef.current?.click(),onSetActiveTool:r.setActiveTool,onSetDrawingColor:r.setDrawingColor,onSetDrawingWidth:r.setDrawingWidth,onSetEditTemplateMode:r.setEditTemplateMode,spellCheckEnabled:r.spellCheckEnabled,showGrid:r.showGrid,showRulers:r.showRulers,snapToGrid:r.snapToGrid,snapToShape:r.snapToShape,onSetSpellCheckEnabled:r.setSpellCheckEnabled,onSetShowGrid:r.setShowGrid,onSetShowRulers:r.setShowRulers,onSetSnapToGrid:r.setSnapToGrid,onSetSnapToShape:r.setSnapToShape,onAddGuide:h.handleAddGuide,onAlignElements:c.handleAlignElements,onCopy:c.handleCopy,onCut:c.handleCut,onPaste:c.handlePaste,onFlip:c.handleFlip,onMoveLayer:c.handleMoveLayer,onMoveLayerToEdge:c.handleMoveLayerToEdge,onDuplicate:c.handleDuplicate,onDelete:c.handleDelete,onExportPng:d.handleExportPng,onExportPdf:d.handleExportPdf,onExportVideo:d.handleExportVideo,onExportGif:d.handleExportGif,onPackageForSharing:d.handlePackageForSharing,onOpenShareDialog:C,onSaveAsPptx:d.handleSaveAsPptx,onSaveAsPpsx:d.handleSaveAsPpsx,onSaveAsPptm:d.handleSaveAsPptm,hasMacros:r.hasMacros,onCopySlideAsImage:d.handleCopySlideAsImage,onPrint:p.handlePrint,onToggleShortcuts:()=>r.setIsShortcutHelpOpen(N=>!N),onOpenSettings:w,onRunAccessibilityCheck:h.handleRunAccessibilityCheck,onToggleSlideSorter:()=>r.setShowSlideSorter(N=>!N),onUpdateTextStyle:x.updateSelectedTextStyle,isOverflowMenuOpen:r.isOverflowMenuOpen,onSetOverflowMenuOpen:r.setIsOverflowMenuOpen,layoutOptions:R,onInsertSlideFromLayout:m.handleInsertSlideFromLayout,customShows:r.customShows,activeCustomShowId:r.activeCustomShowId,onSetActiveCustomShowId:r.setActiveCustomShowId,onCreateCustomShow:h.handleCreateCustomShow,onRenameActiveCustomShow:h.handleRenameActiveCustomShow,onDeleteActiveCustomShow:h.handleDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:h.handleToggleCurrentSlideInActiveShow,isCurrentSlideInActiveShow:h.isCurrentSlideInActiveShow,onEnterMasterView:h.handleEnterMasterView,onCloseMasterView:h.handleCloseMasterView,onToggleVersionHistory:()=>f.setIsVersionHistoryOpen(N=>!N),onOpenPasswordProtection:()=>h.setIsPasswordDialogOpen(true),onOpenDocumentProperties:()=>h.setIsDocPropsDialogOpen(true),onOpenFontEmbedding:()=>h.setIsFontEmbeddingOpen(true),onOpenDigitalSignatures:()=>h.setIsDigitalSigDialogOpen(true),onEnterPresenterView:v,onEnterRehearsalMode:S,onToggleThemeEditor:()=>r.setIsThemeEditorOpen(N=>!N),isThemeEditorOpen:r.isThemeEditorOpen,onToggleThemeGallery:()=>r.setIsThemeGalleryOpen(N=>!N),isThemeGalleryOpen:r.isThemeGalleryOpen,onCompare:f.handleCompare,onToggleComments:()=>{r.setSidebarPanelMode("comments"),r.isInspectorPaneOpen||r.setIsInspectorPaneOpen(true);},isCommentsPanelOpen:r.isInspectorPaneOpen,slideCommentCount:i?.comments?.length??0,formatPainterActive:r.formatPainterActive,canActivateFormatPainter:GQ(o),onToggleFormatPainter:T??(()=>r.setFormatPainterActive(N=>!N)),isSelectionPaneOpen:r.isSelectionPaneOpen,onToggleSelectionPane:()=>r.setIsSelectionPaneOpen(N=>!N),eyedropperActive:r.eyedropperActive,onToggleEyedropper:()=>r.setEyedropperActive(N=>!N),onOpenSetUpSlideShow:()=>h.setIsSetUpSlideShowOpen(true),onOpenBroadcastDialog:()=>h.setIsBroadcastDialogOpen(true),onToggleSubtitles:h.handleToggleSubtitles,showSubtitles:!!r.presentationProperties.showSubtitles,activeSlide:i,onTransitionChange:A,onApplyTransitionToAll:k}),r.hasDigitalSignatures&&jsx("div",{className:"flex items-center px-3 py-1 z-10",children:jsx(o8,{hasSignatures:r.hasDigitalSignatures,signatureCount:r.digitalSignatureCount,onClick:()=>h.setIsDigitalSigDialogOpen(true)})}),jsx("input",{ref:r.imageInputRef,type:"file",name:"image-upload",accept:"image/*",className:"hidden",onChange:u.handleImageFileChange}),jsx("input",{ref:r.mediaInputRef,type:"file",name:"media-upload",accept:"video/*,audio/*",className:"hidden",onChange:u.handleMediaFileChange})]})}var hM={"\\alpha":"\u03B1","\\beta":"\u03B2","\\gamma":"\u03B3","\\delta":"\u03B4","\\epsilon":"\u03B5","\\varepsilon":"\u03B5","\\zeta":"\u03B6","\\eta":"\u03B7","\\theta":"\u03B8","\\vartheta":"\u03D1","\\iota":"\u03B9","\\kappa":"\u03BA","\\lambda":"\u03BB","\\mu":"\u03BC","\\nu":"\u03BD","\\xi":"\u03BE","\\pi":"\u03C0","\\rho":"\u03C1","\\sigma":"\u03C3","\\tau":"\u03C4","\\upsilon":"\u03C5","\\phi":"\u03C6","\\varphi":"\u03D5","\\chi":"\u03C7","\\psi":"\u03C8","\\omega":"\u03C9","\\Gamma":"\u0393","\\Delta":"\u0394","\\Theta":"\u0398","\\Lambda":"\u039B","\\Xi":"\u039E","\\Pi":"\u03A0","\\Sigma":"\u03A3","\\Phi":"\u03A6","\\Psi":"\u03A8","\\Omega":"\u03A9"},mM={"\\times":"\xD7","\\div":"\xF7","\\pm":"\xB1","\\mp":"\u2213","\\cdot":"\xB7","\\leq":"\u2264","\\geq":"\u2265","\\neq":"\u2260","\\approx":"\u2248","\\equiv":"\u2261","\\ll":"\u226A","\\gg":"\u226B","\\subset":"\u2282","\\supset":"\u2283","\\subseteq":"\u2286","\\supseteq":"\u2287","\\in":"\u2208","\\notin":"\u2209","\\cup":"\u222A","\\cap":"\u2229","\\to":"\u2192","\\rightarrow":"\u2192","\\leftarrow":"\u2190","\\Rightarrow":"\u21D2","\\Leftarrow":"\u21D0","\\infty":"\u221E","\\partial":"\u2202","\\nabla":"\u2207","\\forall":"\u2200","\\exists":"\u2203","\\ldots":"\u2026","\\cdots":"\u22EF","\\le":"\u2264","\\ge":"\u2265","\\ne":"\u2260"},gM={"\\sum":"\u2211","\\prod":"\u220F","\\int":"\u222B","\\iint":"\u222C","\\iiint":"\u222D","\\oint":"\u222E","\\coprod":"\u2210","\\bigcup":"\u22C3","\\bigcap":"\u22C2"},Ple=new Set(["sin","cos","tan","cot","sec","csc","arcsin","arccos","arctan","sinh","cosh","tanh","coth","log","ln","exp","lim","min","max","sup","inf","det","dim","mod","gcd","deg","hom","ker"]);function Rle(t){let e=[],n=0;for(;n<t.length;){let r=t[n];if(r==="{")e.push({type:"group_start",value:"{"}),n++;else if(r==="}")e.push({type:"group_end",value:"}"}),n++;else if(r==="^")e.push({type:"superscript",value:"^"}),n++;else if(r==="_")e.push({type:"subscript",value:"_"}),n++;else if(r==="\\"){let o="\\";if(n++,n<t.length&&/[a-zA-Z]/.test(t[n]))for(;n<t.length&&/[a-zA-Z]/.test(t[n]);)o+=t[n],n++;else n<t.length&&(o+=t[n],n++);e.push({type:"command",value:o});}else /\s/.test(r)?(n++,e.push({type:"whitespace",value:" "})):(e.push({type:"text",value:r}),n++);}return e}function Zp(t,e){let n=false,r=false,o=[],i=[];for(let s=0;s<2;s++){let a=t.peek();a?.type==="superscript"&&!n?(t.next(),o=t.parseSingleOrGroup(),n=true):a?.type==="subscript"&&!r&&(t.next(),i=t.parseSingleOrGroup(),r=true);}return n&&r?{"m:sSubSup":{"m:e":t.wrapE([e]),"m:sub":t.wrapE(i),"m:sup":t.wrapE(o)}}:n?{"m:sSup":{"m:e":t.wrapE([e]),"m:sup":t.wrapE(o)}}:r?{"m:sSub":{"m:e":t.wrapE([e]),"m:sub":t.wrapE(i)}}:e}function kle(t,e){let n=[],r=[],o=false,i=false;for(let l=0;l<2;l++){let c=t.peek();c?.type==="subscript"&&!o?(t.next(),n=t.parseSingleOrGroup(),o=true):c?.type==="superscript"&&!i&&(t.next(),r=t.parseSingleOrGroup(),i=true);}let s=t.parseSingleOrGroup(),a={"m:chr":{"@_val":e}};return o||(a["m:subHide"]={"@_val":"1"}),i||(a["m:supHide"]={"@_val":"1"}),{"m:nary":{"m:naryPr":a,"m:sub":o?t.wrapE(n):{},"m:sup":i?t.wrapE(r):{},"m:e":t.wrapE(s)}}}function Ile(t){let e=t.next(),n=e?.value==="."?"":e?.value??"(",r=[];for(;t.peek();){if(t.peek().type==="command"&&t.peek().value==="\\right"){t.next();break}let a=t.parseAtom();a&&r.push(a);}let o=t.next(),i=o?.value==="."?"":o?.value??")",s={};return n!=="("&&(s["m:begChr"]={"@_val":n}),i!==")"&&(s["m:endChr"]={"@_val":i}),{"m:d":{"m:dPr":Object.keys(s).length>0?s:void 0,"m:e":t.wrapE(r)}}}function Nle(t,e){let n=t.makeRun(e,true),r=Zp(t,n),o=[];if(t.peek()?.type==="group_start")o=t.parseGroup();else if(t.peek()&&t.peek().type!=="group_end"){let i=t.parseAtom();i&&(o=[i]);}return o.length===0?r:{"m:func":{"m:fName":t.wrapE([r]),"m:e":t.wrapE(o)}}}var RH=class{tokens;pos=0;constructor(e){this.tokens=e;}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(e){let n=this.next();if(!n||n.type!==e)throw new Error(`Expected ${e}, got ${n?.type??"EOF"}`);return n}parseGroup(){this.expect("group_start");let e=[];for(;this.peek()&&this.peek().type!=="group_end";){let n=this.parseAtom();n&&e.push(n);}return this.expect("group_end"),e}parseSingleOrGroup(){if(this.peek()?.type==="group_start")return this.parseGroup();let e=this.parseAtom();return e?[e]:[]}wrapE(e){if(e.length===1)return {"m:r":e[0]["m:r"],"m:f":e[0]["m:f"],"m:rad":e[0]["m:rad"],"m:sSup":e[0]["m:sSup"],"m:sSub":e[0]["m:sSub"],"m:sSubSup":e[0]["m:sSubSup"],"m:nary":e[0]["m:nary"],"m:d":e[0]["m:d"],"m:func":e[0]["m:func"]};let n={};for(let r of e)for(let o of Object.keys(r))if(n[o]){let i=n[o];Array.isArray(i)?i.push(r[o]):n[o]=[i,r[o]];}else n[o]=r[o];return n}makeRun(e,n=false){let r={"m:t":e};return n&&(r["m:rPr"]={"m:nor":{"@_val":"1"}}),{"m:r":r}}parseAtom(){let e=this.peek();if(!e)return null;if(e.type==="whitespace")return this.next(),this.parseAtom();if(e.type==="text"){this.next();let n=this.makeRun(e.value);return Zp(this,n)}if(e.type==="group_start"){let n=this.parseGroup();if(n.length===0)return null;let r=n.length===1?n[0]:this.wrapE(n);return Zp(this,r)}if(e.type==="command"){this.next();let n=e.value;if(hM[n]){let i=this.makeRun(hM[n]);return Zp(this,i)}if(mM[n])return this.makeRun(mM[n]);if(gM[n])return kle(this,gM[n]);if(n==="\\frac"){let i=this.parseGroup(),s=this.parseGroup(),a={"m:f":{"m:num":this.wrapE(i),"m:den":this.wrapE(s)}};return Zp(this,a)}if(n==="\\sqrt"){if(this.peek()?.type==="text"&&this.peek()?.value==="["){this.next();let a="";for(;this.peek()&&!(this.peek().type==="text"&&this.peek().value==="]");)a+=this.next().value;this.peek()?.value==="]"&&this.next();let l=this.parseGroup(),c={"m:rad":{"m:deg":this.wrapE([this.makeRun(a)]),"m:e":this.wrapE(l)}};return Zp(this,c)}let i=this.parseGroup(),s={"m:rad":{"m:radPr":{"m:degHide":{"@_val":"1"}},"m:e":this.wrapE(i)}};return Zp(this,s)}if(n==="\\text"){let s=this.parseGroup().map(a=>{let l=a["m:r"];return l?String(l["m:t"]??""):""}).join("");return this.makeRun(s,true)}if(n==="\\left")return Ile(this);if(n==="\\right")return null;let r=n.slice(1);if(Ple.has(r))return Nle(this,r);let o=this.makeRun(n.slice(1),true);return Zp(this,o)}if(e.type==="superscript"||e.type==="subscript"){this.next();let n=this.parseSingleOrGroup(),r=this.makeRun("");return e.type==="superscript"?{"m:sSup":{"m:e":this.wrapE([r]),"m:sup":this.wrapE(n)}}:{"m:sSub":{"m:e":this.wrapE([r]),"m:sub":this.wrapE(n)}}}return null}parseAll(){let e=[];for(;this.peek();){let n=this.parseAtom();n&&e.push(n);}return e}};function wN(t){let e=t.trim();if(e.length===0)return {};let n=Rle(e),o=new RH(n).parseAll();if(o.length===0)return {};let i={};for(let s of o)for(let a of Object.keys(s))if(i[a]){let l=i[a];Array.isArray(l)?l.push(s[a]):i[a]=[l,s[a]];}else i[a]=s[a];return {"m:oMathPara":{"m:oMath":i}}}var kH={};for(let[t,e]of Object.entries(hM))kH[e]=t;var CN={};for(let[t,e]of Object.entries(mM))CN[e]||(CN[e]=t);var IH={};for(let[t,e]of Object.entries(gM))IH[e]||(IH[e]=t);function Aqe(t){return t==null?[]:Array.isArray(t)?t:typeof t=="object"?[t]:[]}function br(t,e){if(!t)return {};let n=t[e];return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}function X0(t){if(!t)return "";let e=t["@_val"];return typeof e=="string"?e:e!==void 0?String(e):""}function pi(t){if(!t||typeof t!="object")return "";let e=[];for(let n of Object.keys(t)){if(n.startsWith("@_"))continue;let r=Aqe(t[n]);for(let o of r){let i=Pqe(n,o);i&&e.push(i);}}return e.join("")}function Pqe(t,e){switch(t){case "m:r":{let n=typeof e["m:t"]=="string"?e["m:t"]:e["m:t"]!==void 0?String(e["m:t"]):"";if(n.length===0)return "";if(kH[n])return `${kH[n]} `;if(CN[n])return `${CN[n]} `;let r=br(e,"m:rPr"),o=X0(br(r,"m:nor"));return o==="1"||o==="on"||o==="true"?`\\text{${n}}`:n}case "m:f":{let n=pi(br(e,"m:num")),r=pi(br(e,"m:den"));return `\\frac{${n}}{${r}}`}case "m:rad":{let n=br(e,"m:radPr"),r=X0(br(n,"m:degHide")),o=pi(br(e,"m:e"));if(r==="1"||r==="on"||r==="true")return `\\sqrt{${o}}`;let i=pi(br(e,"m:deg"));return i?`\\sqrt[${i}]{${o}}`:`\\sqrt{${o}}`}case "m:sSup":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sup"));return `${n}^{${r}}`}case "m:sSub":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sub"));return `${n}_{${r}}`}case "m:sSubSup":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sub")),o=pi(br(e,"m:sup"));return `${n}_{${r}}^{${o}}`}case "m:nary":{let n=br(e,"m:naryPr"),r=X0(br(n,"m:chr")),o=IH[r]??"\\int",i=X0(br(n,"m:subHide")),s=X0(br(n,"m:supHide")),a=pi(br(e,"m:sub")),l=pi(br(e,"m:sup")),c=pi(br(e,"m:e")),u=o;return a&&i!=="1"&&(u+=`_{${a}}`),l&&s!=="1"&&(u+=`^{${l}}`),u+=`{${c}}`,u}case "m:d":{let n=br(e,"m:dPr"),r=X0(br(n,"m:begChr"))||"(",o=X0(br(n,"m:endChr"))||")",i=pi(br(e,"m:e"));return `\\left${r}${i}\\right${o}`}case "m:func":{let n=pi(br(e,"m:fName")),r=pi(br(e,"m:e"));return `${n}{${r}}`}case "m:oMath":return pi(e);default:return ""}}function NH(t){if(!t||typeof t!="object")return "";let e,n=t["m:oMathPara"];return n?.["m:oMath"]?e=n["m:oMath"]:t["m:oMath"]?e=t["m:oMath"]:e=t,pi(e)}function Ble(t){let e=wPe;return typeof e.sanitize!="function"?t:e.sanitize(t,{USE_PROFILES:{mathMl:true,svg:true}})}var Ole=[{label:"Fraction",latex:"\\frac{a}{b}",i18nKey:"pptx.equation.template.fraction"},{label:"Quadratic",latex:"x=\\frac{-b\\pm\\sqrt{b^{2}-4ac}}{2a}",i18nKey:"pptx.equation.template.quadratic"},{label:"Pythagorean",latex:"a^{2}+b^{2}=c^{2}",i18nKey:"pptx.equation.template.pythagorean"},{label:"Sum",latex:"\\sum_{i=1}^{n}{a_{i}}",i18nKey:"pptx.equation.template.sum"},{label:"Integral",latex:"\\int_{a}^{b}{f(x)}dx",i18nKey:"pptx.equation.template.integral"},{label:"Square Root",latex:"\\sqrt{x^{2}+y^{2}}",i18nKey:"pptx.equation.template.squareRoot"},{label:"Limit",latex:"\\lim_{x\\to\\infty}{f(x)}",i18nKey:"pptx.equation.template.limit"},{label:"Euler's",latex:"e^{i\\pi}+1=0",i18nKey:"pptx.equation.template.euler"},{label:"Matrix 2x2",latex:"\\left[a,b;c,d\\right]",i18nKey:"pptx.equation.template.matrix"},{label:"Binomial",latex:"\\left(a+b\\right)^{n}",i18nKey:"pptx.equation.template.binomial"},{label:"Derivative",latex:"\\frac{dy}{dx}",i18nKey:"pptx.equation.template.derivative"},{label:"Trig Identity",latex:"\\sin^{2}\\theta+\\cos^{2}\\theta=1",i18nKey:"pptx.equation.template.trigIdentity"}],Lqe=Ole.map(t=>{try{let e=wN(t.latex),n=T1(e);return n?Ble(n):""}catch{return ""}});function Fqe({mathml:t}){let e=useRef(null);return useEffect(()=>{e.current&&(t?e.current.innerHTML=Ble(t):e.current.innerHTML="");},[t]),jsx("div",{ref:e,className:"flex items-center justify-center min-h-[80px] text-2xl text-foreground",style:{fontFamily:'"Cambria Math", "STIX Two Math", serif'}})}function Ule({isOpen:t,onClose:e,onInsert:n,existingOmml:r}){let{t:o}=useTranslation(),i=useMemo(()=>r?NH(r):"",[r]),[s,a]=useState(i),l=useDeferredValue(s),c=useRef(null);useEffect(()=>{t&&(a(i),setTimeout(()=>c.current?.focus(),50));},[t,i]);let{mathml:u,omml:d}=useMemo(()=>{if(!l.trim())return {mathml:"",omml:{}};try{let y=wN(l);return {mathml:T1(y),omml:y}}catch{return {mathml:"",omml:{}}}},[l]),p=useCallback(()=>{s.trim()&&(n(d),e());},[s,d,n,e]),f=useCallback(y=>{a(y);},[]),h=useCallback(y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),p()),y.key==="Escape"&&(y.preventDefault(),e());},[p,e]);if(!t)return null;let m=!!r,x=s.trim().length>0&&Object.keys(d).length>0;return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:y=>{y.target===y.currentTarget&&e();},onKeyDown:h,children:jsxs("div",{className:"bg-background border border-border rounded-xl shadow-2xl w-[640px] max-h-[85vh] flex flex-col overflow-hidden",onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:m?o("pptx.equation.editTitle","Edit Equation"):o("pptx.equation.insertTitle","Insert Equation")}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[jsx("div",{className:"rounded-lg border border-border bg-muted/60 p-4 min-h-[80px] flex items-center justify-center",children:x?jsx(Fqe,{mathml:u}):jsx("span",{className:"text-sm text-muted-foreground italic",children:o("pptx.equation.previewPlaceholder","Equation preview will appear here")})}),jsxs("div",{children:[jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:o("pptx.equation.latexInput","LaTeX Input")}),jsx("textarea",{ref:c,value:s,onChange:y=>a(y.target.value),placeholder:"\\\\frac{a}{b} + \\\\sqrt{c}",className:"w-full h-24 px-3 py-2 rounded-lg border border-border bg-muted text-foreground text-sm font-mono resize-none focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary placeholder:text-muted-foreground",spellCheck:false}),jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:o("pptx.equation.latexHint","Use LaTeX syntax. Ctrl+Enter to insert.")})]}),jsxs("div",{children:[jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:o("pptx.equation.templates","Common Templates")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Ole.map((y,v)=>{let S=Lqe[v];return jsxs("button",{type:"button",onClick:()=>f(y.latex),className:le("flex flex-col items-center gap-1 p-2 rounded-lg border transition-colors",s===y.latex?"border-primary bg-primary/10":"border-border bg-muted/40 hover:bg-accent/60 hover:border-border"),title:o(y.i18nKey,y.label),children:[jsx("div",{className:"text-sm text-foreground h-8 flex items-center justify-center overflow-hidden",style:{fontFamily:'"Cambria Math", "STIX Two Math", serif'},dangerouslySetInnerHTML:{__html:S}}),jsx("span",{className:"text-[10px] text-muted-foreground truncate w-full text-center",children:o(y.i18nKey,y.label)})]},y.latex)})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-4 py-1.5 rounded-lg text-xs text-foreground hover:bg-accent transition-colors",children:o("pptx.equation.cancel","Cancel")}),jsx("button",{type:"button",onClick:p,disabled:!x,className:"px-4 py-1.5 rounded-lg text-xs font-medium bg-primary hover:bg-primary/80 text-white disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:m?o("pptx.equation.update","Update"):o("pptx.equation.insert","Insert")})]})]})})}var LH=[{layout:"basicBlockList",label:"Basic Block List",category:"list",defaultItems:["Item 1","Item 2","Item 3"]},{layout:"stackedList",label:"Stacked List",category:"list",defaultItems:["Item 1","Item 2","Item 3"]},{layout:"horizontalBulletList",label:"Horizontal Bullet List",category:"list",defaultItems:["Topic 1","Topic 2","Topic 3"]},{layout:"tableList",label:"Table List",category:"list",defaultItems:["Row 1","Row 2","Row 3"]},{layout:"basicChevronProcess",label:"Chevron Process",category:"process",defaultItems:["Step 1","Step 2","Step 3"]},{layout:"segmentedProcess",label:"Segmented Process",category:"process",defaultItems:["Phase 1","Phase 2","Phase 3"]},{layout:"continuousBlockProcess",label:"Continuous Block Process",category:"process",defaultItems:["Start","Middle","End"]},{layout:"upwardArrow",label:"Upward Arrow",category:"process",defaultItems:["Stage 1","Stage 2","Stage 3"]},{layout:"basicCycle",label:"Basic Cycle",category:"cycle",defaultItems:["Phase 1","Phase 2","Phase 3","Phase 4"]},{layout:"basicRadial",label:"Basic Radial",category:"cycle",defaultItems:["Center","Spoke 1","Spoke 2","Spoke 3"]},{layout:"basicPie",label:"Basic Pie",category:"cycle",defaultItems:["Segment 1","Segment 2","Segment 3"]},{layout:"convergingRadial",label:"Converging Radial",category:"cycle",defaultItems:["Goal","Input 1","Input 2","Input 3"]},{layout:"hierarchy",label:"Hierarchy",category:"hierarchy",defaultItems:["Manager","Lead A","Lead B"]},{layout:"basicVenn",label:"Basic Venn",category:"relationship",defaultItems:["Set A","Set B","Set C"]},{layout:"linearVenn",label:"Linear Venn",category:"relationship",defaultItems:["Group 1","Group 2","Group 3"]},{layout:"alternatingHexagons",label:"Alternating Hexagons",category:"relationship",defaultItems:["Hex 1","Hex 2","Hex 3"]},{layout:"trapezoidList",label:"Trapezoid List",category:"relationship",defaultItems:["Level 1","Level 2","Level 3"]},{layout:"pictureAccentList",label:"Picture Accent List",category:"list",defaultItems:["Feature 1","Feature 2","Feature 3"]},{layout:"verticalBlockList",label:"Vertical Block List",category:"list",defaultItems:["Block 1","Block 2","Block 3"]},{layout:"groupedList",label:"Grouped List",category:"list",defaultItems:["Item A","Item B","Item C","Item D"]},{layout:"horizontalPictureList",label:"Horizontal Picture List",category:"list",defaultItems:["Photo 1","Photo 2","Photo 3"]},{layout:"verticalChevronList",label:"Vertical Chevron List",category:"list",defaultItems:["Priority 1","Priority 2","Priority 3"]},{layout:"pyramidList",label:"Pyramid List",category:"list",defaultItems:["Level 1","Level 2","Level 3"]},{layout:"stepDownProcess",label:"Step Down Process",category:"process",defaultItems:["Step 1","Step 2","Step 3"]},{layout:"alternatingFlow",label:"Alternating Flow",category:"process",defaultItems:["Stage 1","Stage 2","Stage 3","Stage 4"]},{layout:"descendingProcess",label:"Descending Process",category:"process",defaultItems:["Top","Middle","Bottom"]},{layout:"accentProcess",label:"Accent Process",category:"process",defaultItems:["Phase 1","Phase 2","Phase 3"]}],$le=[{id:"list",label:"pptx.smartart.category.list"},{id:"process",label:"pptx.smartart.category.process"},{id:"cycle",label:"pptx.smartart.category.cycle"},{id:"hierarchy",label:"pptx.smartart.category.hierarchy"},{id:"relationship",label:"pptx.smartart.category.relationship"}];var sc=["#3b82f6","#22c55e","#f97316","#eab308"];function Oqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>jsx("rect",{x:4,y:3+t*12,width:52,height:10,rx:2,fill:sc[t],opacity:.85},t))})}function Uqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>{let e=2+t*19,n=`${e},10 ${e+14},10 ${e+18},20 ${e+14},30 ${e},30 ${t>0?e+4:e},20`;return jsx("polygon",{points:n,fill:sc[t],opacity:.85},t)})})}function $qe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2,3].map(t=>{let e=t/4*Math.PI*2-Math.PI/2,n=30+13*Math.cos(e),r=20+10*Math.sin(e);return jsx("circle",{cx:n,cy:r,r:6,fill:sc[t],opacity:.85},t)})})}function Hqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("rect",{x:20,y:3,width:20,height:10,rx:2,fill:sc[0],opacity:.85}),jsx("line",{x1:30,y1:13,x2:30,y2:18,stroke:"#94a3b8",strokeWidth:1}),jsx("line",{x1:15,y1:18,x2:45,y2:18,stroke:"#94a3b8",strokeWidth:1}),jsx("rect",{x:4,y:20,width:18,height:10,rx:2,fill:sc[1],opacity:.85}),jsx("rect",{x:38,y:20,width:18,height:10,rx:2,fill:sc[2],opacity:.85}),jsx("line",{x1:15,y1:18,x2:15,y2:20,stroke:"#94a3b8",strokeWidth:1}),jsx("line",{x1:45,y1:18,x2:45,y2:20,stroke:"#94a3b8",strokeWidth:1})]})}function zqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:22,cy:20,r:14,fill:sc[0],opacity:.3}),jsx("circle",{cx:38,cy:20,r:14,fill:sc[1],opacity:.3}),jsx("circle",{cx:30,cy:10,r:14,fill:sc[2],opacity:.3})]})}function Gqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:30,cy:20,r:7,fill:sc[0],opacity:.85}),[0,1,2].map(t=>{let e=t/3*Math.PI*2-Math.PI/2,n=30+15*Math.cos(e),r=20+12*Math.sin(e);return jsxs(Vn__default.Fragment,{children:[jsx("line",{x1:30,y1:20,x2:n,y2:r,stroke:"#94a3b8",strokeWidth:1,opacity:.5}),jsx("circle",{cx:n,cy:r,r:5,fill:sc[t+1],opacity:.85})]},t)})]})}function Vqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>jsx("rect",{x:4+t*18,y:8,width:16,height:24,rx:3,fill:sc[t],opacity:.85},t))})}function Hle(t){switch(t){case "basicBlockList":case "stackedList":case "tableList":case "horizontalBulletList":return jsx(Oqe,{});case "basicChevronProcess":case "segmentedProcess":case "continuousBlockProcess":case "upwardArrow":return jsx(Uqe,{});case "basicCycle":case "basicPie":return jsx($qe,{});case "basicRadial":case "convergingRadial":return jsx(Gqe,{});case "hierarchy":return jsx(Hqe,{});case "basicVenn":case "linearVenn":return jsx(zqe,{});default:return jsx(Vqe,{})}}function Gle({isOpen:t,onClose:e,onInsert:n}){let{t:r}=useTranslation(),[o,i]=useState("list"),[s,a]=useState(null),l=LH.filter(u=>u.category===o),c=useCallback(()=>{if(!s)return;let u=LH.find(d=>d.layout===s);u&&(n(u.layout,u.defaultItems),e());},[s,n,e]);return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50",onClick:e,"aria-label":"Close"}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[600px] max-w-[90vw] max-h-[80vh] rounded-lg border border-border bg-background shadow-2xl flex flex-col",role:"dialog","aria-modal":"true","aria-label":r("pptx.smartart.insertTitle"),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-medium text-foreground",children:r("pptx.smartart.insertTitle")}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-muted transition-colors","aria-label":r("pptx.smartart.close"),children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex flex-1 overflow-hidden",children:[jsx("div",{className:"w-40 border-r border-border py-2",children:$le.map(u=>jsx("button",{type:"button",onClick:()=>{i(u.id),a(null);},className:le("w-full text-left px-3 py-1.5 text-xs transition-colors",o===u.id?"bg-primary text-white":"text-foreground hover:bg-muted"),children:r(u.label)},u.id))}),jsx("div",{className:"flex-1 p-3 overflow-y-auto",children:jsx("div",{className:"grid grid-cols-3 gap-2",children:l.map(u=>jsxs("button",{type:"button",onClick:()=>a(u.layout),onDoubleClick:()=>{a(u.layout),n(u.layout,u.defaultItems),e();},className:le("flex flex-col items-center gap-1 p-2 rounded border transition-colors",s===u.layout?"border-primary bg-primary/20":"border-border hover:border-border hover:bg-muted/50"),children:[jsx("div",{className:"w-16 h-12 flex items-center justify-center bg-muted rounded",children:Hle(u.layout)}),jsx("span",{className:"text-[10px] text-foreground text-center leading-tight",children:u.label})]},u.layout))})})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded bg-muted hover:bg-accent text-foreground transition-colors",children:r("pptx.smartart.cancel")}),jsx("button",{type:"button",onClick:c,disabled:!s,className:le("px-3 py-1.5 text-xs rounded transition-colors",s?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:r("pptx.smartart.insert")})]})]})})]}):null}function FH(t){let{dialogs:e,insertHandlers:n,exportHandlers:r,printHandlers:o,propertyHandlers:i,annotations:s,slides:a,activeSlideIndex:l,canvasSize:c,filePath:u,coreProperties:d,customProperties:p,appProperties:f,embeddedFonts:h,hasDigitalSignatures:m,digitalSignatureCount:x,presentationProperties:y,customShows:v,selectedElements:S,isEncryptedDialogOpen:w,setIsEncryptedDialogOpen:C,showKeepAnnotationsDialog:T,onKeepAnnotations:E,onDiscardAnnotations:M}=t;return jsxs(Fragment,{children:[jsx(X6,{isOpen:i.isVersionHistoryOpen,filePath:u,onClose:()=>i.setIsVersionHistoryOpen(false),onRestore:i.handleRestoreVersion}),jsx(Y6,{isOpen:i.isComparePanelOpen,compareResult:i.compareResult,canvasSize:c,onClose:()=>i.setIsComparePanelOpen(false),onAcceptSlide:i.handleAcceptSlide,onRejectSlide:i.handleRejectSlide,onAcceptAll:i.handleAcceptAllSlides}),jsx(K6,{isOpen:e.isPasswordDialogOpen,isCurrentlyProtected:e.isPasswordProtected,onClose:()=>e.setIsPasswordDialogOpen(false),onSetPassword:e.handleSetPassword,onRemovePassword:e.handleRemovePassword}),jsx(Q6,{isOpen:e.isDocPropsDialogOpen,coreProperties:d??{},customProperties:p,appProperties:f,onClose:()=>e.setIsDocPropsDialogOpen(false),onSave:(A,R,k)=>{i.handleUpdateCoreProperties(A),i.handleUpdateCustomProperties(R),k&&i.handleUpdateAppProperties(k);}}),jsx(t8,{isOpen:e.isFontEmbeddingOpen,embedFontsEnabled:e.embedFontsEnabled,usedFontFamilies:i.usedFontFamilies,embeddedFonts:h.map(A=>A.name),onClose:()=>e.setIsFontEmbeddingOpen(false),onToggleEmbedFonts:e.setEmbedFontsEnabled}),jsx(r8,{isOpen:e.isDigitalSigDialogOpen,onClose:()=>e.setIsDigitalSigDialogOpen(false),hasSignatures:m,signatureCount:x}),jsx(i8,{isOpen:e.isSignatureStrippedDialogOpen,signatureCount:x,onConfirm:()=>e.setIsSignatureStrippedDialogOpen(false),onCancel:()=>e.setIsSignatureStrippedDialogOpen(false)}),jsx(s8,{isOpen:w,onClose:()=>C(false)}),jsx(Gle,{isOpen:e.isSmartArtDialogOpen,onClose:()=>e.setIsSmartArtDialogOpen(false),onInsert:n.handleInsertSmartArt}),jsx(Ule,{isOpen:e.isEquationDialogOpen,onClose:()=>e.setIsEquationDialogOpen(false),onInsert:n.handleInsertEquation,existingOmml:e.editingEquationOmml}),jsx(yH,{open:e.isHyperlinkDialogOpen,initialUrl:S[0]?.actionClick?.url,initialTooltip:S[0]?.actionClick?.tooltip,initialAction:S[0]?.actionClick?.action,slideCount:a.length,onConfirm:n.handleHyperlinkConfirm,onCancel:()=>e.setIsHyperlinkDialogOpen(false)}),jsx(vU,{isOpen:r.exportModalOpen,title:r.exportModalTitle,progress:r.exportProgress,statusMessage:r.exportStatusMessage,onCancel:r.handleCancelExport}),jsx(lH,{open:e.isSetUpSlideShowOpen,onClose:()=>e.setIsSetUpSlideShowOpen(false),properties:y,onSave:e.handleSaveSlideShowSettings,customShows:v,slideCount:a.length}),jsx(aH,{open:o.isPrintDialogOpen,onClose:()=>o.setIsPrintDialogOpen(false),onPrint:o.handlePrintWithSettings,slides:a,activeSlideIndex:l,defaultSlidesPerPage:y.printSlidesPerPage,defaultFrameSlides:y.printFrameSlides}),jsx(rH,{isOpen:T,annotationCount:Array.from(s.allSlideAnnotations.values()).reduce((A,R)=>A+R.length,0),slideCount:s.allSlideAnnotations.size,onKeep:E,onDiscard:M})]})}function OH(t){let{mode:e,slides:n,canvasSize:r,templateElements:o,presentation:i,onExitPresentation:s}=t;return jsxs(Fragment,{children:[e==="present"&&i.presenterMode&&jsx(f8,{slides:n,currentSlideIndex:i.presentationSlideIndex,canvasSize:r,templateElements:o,presentationStartTime:i.presentationStartTime,onMovePresentationSlide:i.movePresentationSlide,onExit:s,onOpenAudienceWindow:i.openAudienceWindow,onCloseAudienceWindow:i.closeAudienceWindow,isAudienceWindowOpen:i.isAudienceWindowOpen()}),e==="present"&&i.rehearsing&&jsx(m8,{presentationStartTime:i.presentationStartTime,slideStartTime:i.slideStartTime,paused:i.rehearsalPaused,onTogglePause:i.toggleRehearsalPause}),i.showRehearsalSummary&&jsx(g8,{slides:n,canvasSize:r,recordedTimings:i.recordedTimings,onSave:i.saveRehearsalTimings,onDiscard:i.dismissRehearsalSummary})]})}var eKe=50;function jle(t){let{enabled:e,onNext:n,onPrev:r}=t,o=useRef(null),i=useCallback(a=>{if(!e||a.changedTouches.length!==1){o.current=null;return}let l=a.changedTouches[0];o.current={x:l.clientX,y:l.clientY};},[e]),s=useCallback(a=>{let l=o.current;if(o.current=null,!e||l===null||a.changedTouches.length!==1)return;let c=a.changedTouches[0],u=c.clientX-l.x,d=c.clientY-l.y;Math.abs(u)<eKe||Math.abs(u)<=Math.abs(d)||(u<0?n():r());},[e,n,r]);return {onTouchStart:i,onTouchEnd:s}}function UH(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:s,canvasSize:a,activeSlideIndex:l,gridSpacingPx:c,zoom:u,state:d,selectedElement:p,canvasHandlers:f,insertHandlers:h,tableOps:m,annotations:x,presentation:y,onEndPresentation:v,findReplace:S}=t,w=e==="master"?i:o,C=e==="master"?d.activeLayout?d.activeMaster?.elements??[]:[]:s,T=useMemo(()=>{let U=d.headerFooter,H;if(o)for(let j of o.elements){let Z=j.placeholderType;if(Z==="title"||Z==="ctrTitle"){let J=j.text;if(J){H=J;break}}}return {slideNumber:o?.slideNumber,dateTimeText:U.dateTimeText,dateFormat:U.dateFormat,footerText:U.footerText,headerText:U.headerText,slideTitle:H,customProperties:d.customProperties.map(j=>({name:j.name,value:j.value}))}},[d.headerFooter,d.customProperties,o]),E=useMemo(()=>{if(!(!d.theme&&!d.tableStyleMap))return {theme:d.theme,tableStyleMap:d.tableStyleMap}},[d.theme,d.tableStyleMap]),M=useCallback((U,H)=>{e==="present"?y.handlePresentationAction(H):H.url&&Xg(H.url);},[e,y]),A=useCallback(U=>{if(pU(U)){if(e==="present"){let H=see(U);if(H){let j={action:H.action,targetSlideIndex:H.targetSlideIndex};y.handlePresentationAction(j);}}return}Xg(U);},[e,y]),R=useRef(false),k=useCallback(()=>{R.current=true,x.setToolbarVisible(true);},[x]),N=useCallback(()=>{R.current=false;},[]),F=e==="preview"||e==="present",B=useCallback(()=>{e==="present"?y.movePresentationSlide(1):d.setActiveSlideIndex(U=>Math.min(r.length-1,U+1));},[e,y,d,r.length]),D=useCallback(()=>{e==="present"?y.movePresentationSlide(-1):d.setActiveSlideIndex(U=>Math.max(0,U-1));},[e,y,d]),O=jle({enabled:F,onNext:B,onPrev:D});return jsxs("main",{"aria-label":"Slide editor",className:"flex-1 min-w-0 relative flex flex-col bg-background",onTouchStart:O.onTouchStart,onTouchEnd:O.onTouchEnd,children:[S.findReplaceOpen&&jsx(XU,{findQuery:S.findQuery,replaceQuery:S.replaceQuery,findMatchCase:S.findMatchCase,findResults:S.findResults,findResultIndex:S.findResultIndex,onSetFindQuery:S.setFindQuery,onSetReplaceQuery:S.setReplaceQuery,onSetFindMatchCase:S.setFindMatchCase,onPerformFind:S.performFind,onNavigateResult:S.navigateFindResult,onReplace:S.handleReplace,onReplaceAll:S.handleReplaceAll,onClose:()=>S.setFindReplaceOpen(false)}),e==="master"&&d.masterViewTab==="notes"?jsx(O6,{notesMaster:d.notesMaster,canvasSize:a,notesCanvasSize:d.notesCanvasSize}):e==="master"&&d.masterViewTab==="handout"?jsx(U6,{handoutMaster:d.handoutMaster,canvasSize:a,slidesPerPage:d.handoutSlidesPerPage}):jsx(CH,{activeSlide:w,templateElements:C,canvasSize:a,zoom:u,mode:e,canEdit:n,editTemplateMode:e==="master"||d.editTemplateMode,selectedElementIdSet:d.selectedElementIdSet,selectedElement:p,inlineEditingElementId:d.inlineEditingElementId,inlineEditingText:d.inlineEditingText,spellCheckEnabled:d.spellCheckEnabled,mediaDataUrls:d.mediaDataUrls,tableEditorState:d.tableEditorState,marqueeSelectionState:d.marqueeSelectionState,snapLines:d.snapLines,showGrid:d.showGrid,gridSpacingPx:c,showRulers:d.showRulers,guides:d.guides,presentationElementStates:e==="present"?y.presentationElementStates:void 0,presentationKeyframesCss:e==="present"?y.presentationKeyframesCss:void 0,onClick:f.handleElementClick,onDoubleClick:f.handleElementDoubleClick,onMouseDown:f.handleElementMouseDown,onContextMenu:f.handleElementContextMenu,onCanvasMouseDown:f.handleCanvasMouseDown,onResizePointerDown:f.handleResizePointerDown,onAdjustmentPointerDown:f.handleAdjustmentPointerDown,onInlineEditChange:d.setInlineEditingText,onInlineEditCommit:f.handleInlineEditCommit,onInlineEditCancel:()=>d.setInlineEditingElementId(null),onTableCellSelect:(U,H)=>d.setTableEditorState(U?{...U,elementId:H}:null),onCommitCellEdit:m.handleCommitCellEdit,onResizeTableColumns:m.handleResizeTableColumns,onResizeTableRow:m.handleResizeTableRow,findResults:S.findResults,findResultIndex:S.findResultIndex,activeSlideIndex:l,activeTool:d.activeTool,drawingColor:d.drawingColor,drawingWidth:d.drawingWidth,isDrawingRef:d.isDrawingRef,onAddInkElement:h.handleAddInkElement,onAddFreeformShape:h.handleAddFreeformShape,onEraseInkElement:h.handleEraseInkElement,onActionClick:M,onHyperlinkClick:A,allSlides:e==="present"?r:void 0,onZoomClick:e==="present"?y.handleZoomClick:void 0,sourceSlideIndex:e==="present"?l:void 0,fieldContext:T,tableStyleContext:E,collaborationOverlay:jsxs(Fragment,{children:[jsx(R6,{elements:w?.elements??[],activeSlideIndex:l}),jsx(A6,{activeSlideIndex:l,canvasWidth:a.width,canvasHeight:a.height,selectedElementId:d.selectedElementId})]}),comments:o?.comments,showCommentMarkers:d.sidebarPanelMode==="comments",onCommentMarkerClick:()=>d.setSidebarPanelMode("comments"),onMoveGuide:(U,H)=>{d.setGuides(j=>j.map(Z=>Z.id===U?{...Z,position:Z.axis==="h"?Math.max(0,Math.min(a.height,H)):Math.max(0,Math.min(a.width,H))}:Z));},onDeleteGuide:U=>{d.setGuides(H=>H.filter(j=>j.id!==U));},onCreateGuideFromRuler:(U,H)=>{d.setGuides(j=>[...j,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:U,position:H}]);}}),e==="present"&&x.presentationTool!=="none"&&jsx(q8,{canvasSize:a,editorScale:u.editorScale,presentationTool:x.presentationTool,annotationStrokes:x.annotationStrokes,currentStroke:x.currentStroke,laserPosition:x.laserPosition,onPointerDown:x.handlePointerDown,onPointerMove:x.handlePointerMove,onPointerUp:x.handlePointerUp,onLaserMove:x.handleLaserMove,onLaserLeave:x.handleLaserLeave,onEraseAtPoint:x.eraseAtPoint}),e==="present"&&jsx(nH,{visible:!!d.presentationProperties.showSubtitles}),e==="present"&&jsx(eH,{currentSlideIndex:y.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:y.movePresentationSlide,onEndPresentation:v??(()=>{})}),e==="present"&&jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 z-[80] transition-opacity duration-300",style:{opacity:x.toolbarVisible?1:0,pointerEvents:x.toolbarVisible?"auto":"none"},onMouseEnter:k,onMouseLeave:N,children:jsx(J8,{presentationTool:x.presentationTool,penColor:x.penColor,highlighterColor:x.highlighterColor,hasAnnotations:x.annotationStrokes.length>0,onSetTool:x.setPresentationTool,onSetPenColor:x.setPenColor,onSetHighlighterColor:x.setHighlighterColor,onClearAnnotations:x.clearAnnotations,currentSlideIndex:y.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:y.movePresentationSlide,presentationStartTime:y.presentationStartTime,onEndPresentation:v??(()=>{}),onTogglePresenterView:y.togglePresenterView,presenterMode:y.presenterMode})})]})}var qh="rounded bg-muted/50 p-2.5 space-y-2",Kh="text-[11px] font-medium uppercase tracking-wide text-muted-foreground mb-1.5",xM="w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:border-primary focus:outline-none",Yle="rounded bg-primary px-3 py-1.5 text-xs font-medium text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",qle="rounded bg-accent px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent/80 disabled:opacity-40 disabled:cursor-not-allowed transition-colors";var MN=[{name:"Office",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"},majorFont:"Calibri Light",minorFont:"Calibri"},{name:"Facet",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2C3C43",lt2:"#CFD7D9",accent1:"#90C226",accent2:"#54A021",accent3:"#E6B91E",accent4:"#E76618",accent5:"#C42F1A",accent6:"#918655",hlink:"#99CA3C",folHlink:"#B9D181"},majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"},{name:"Integral",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#335B74",lt2:"#DFE3E5",accent1:"#1CADE4",accent2:"#2683C6",accent3:"#27CED7",accent4:"#42BA97",accent5:"#3E8853",accent6:"#62A39F",hlink:"#6BA5D1",folHlink:"#9DCCE0"},majorFont:"Tw Cen MT Condensed",minorFont:"Tw Cen MT"},{name:"Ion",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#262626",lt2:"#E1E1E1",accent1:"#B01513",accent2:"#EA6312",accent3:"#E6B729",accent4:"#6AAC90",accent5:"#5F9C9D",accent6:"#9B6BF2",hlink:"#F09415",folHlink:"#D14D0F"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Retrospect",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#637052",lt2:"#CCDDEA",accent1:"#E48312",accent2:"#BD582C",accent3:"#865640",accent4:"#9B8357",accent5:"#C2BC80",accent6:"#94A088",hlink:"#3A7CCB",folHlink:"#8C8C8C"},majorFont:"Calibri Light",minorFont:"Calibri"},{name:"Organic",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#283138",lt2:"#E3DED1",accent1:"#83992A",accent2:"#3C9770",accent3:"#44709D",accent4:"#A23C33",accent5:"#D97828",accent6:"#DEB340",hlink:"#A8B97F",folHlink:"#89C2A3"},majorFont:"Garamond",minorFont:"Garamond"},{name:"Wisp",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#46393B",lt2:"#E8DCD8",accent1:"#A53010",accent2:"#DE7E18",accent3:"#9F8351",accent4:"#728653",accent5:"#92AA4C",accent6:"#6AAC91",hlink:"#FB4F14",folHlink:"#E25839"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Berlin",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3E5C61",lt2:"#D5E0D0",accent1:"#F09415",accent2:"#C1B56B",accent3:"#89C2A3",accent4:"#729BBE",accent5:"#9A90C2",accent6:"#BE8DBE",hlink:"#25A0DA",folHlink:"#FF7F00"},majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"},{name:"Slice",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2E3B4C",lt2:"#C7CDD3",accent1:"#E2751D",accent2:"#C53B23",accent3:"#A13D69",accent4:"#58599E",accent5:"#36749D",accent6:"#4EA39A",hlink:"#FD6B32",folHlink:"#D14D0F"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Dividend",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3D3D3D",lt2:"#E1E1E1",accent1:"#4D1434",accent2:"#903163",accent3:"#B2324B",accent4:"#D34817",accent5:"#E8971C",accent6:"#FDCB00",hlink:"#A03068",folHlink:"#C34882"},majorFont:"Gill Sans MT",minorFont:"Gill Sans MT"}],Y0=["Arial","Calibri","Calibri Light","Cambria","Century Gothic","Comic Sans MS","Consolas","Garamond","Georgia","Gill Sans MT","Impact","Lucida Console","Palatino Linotype","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Tw Cen MT","Verdana"];function Kle({editColors:t,canEdit:e,activePickerKey:n,majorFont:r,minorFont:o,onSetActivePickerKey:i,onColorChange:s,onMajorFontChange:a,onMinorFontChange:l}){let{t:c}=useTranslation(),u=useMemo(()=>oY(t),[t]),d=useCallback(p=>{n&&/^#[0-9a-fA-F]{6}$/.test(p)&&s(n,p);},[n,s]);return jsxs(Fragment,{children:[jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.colorScheme")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Mf.map(p=>jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("button",{type:"button",disabled:!e,className:`h-6 w-full rounded-sm border transition-colors ${n===p?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground"} disabled:opacity-40 disabled:cursor-not-allowed`,style:{backgroundColor:t[p]},title:`${L1[p]}: ${t[p]}`,onClick:()=>i(n===p?null:p)}),jsx("span",{className:"text-[9px] text-muted-foreground truncate w-full text-center",children:L1[p]})]},p))}),n&&jsxs("div",{className:"mt-2 flex items-center gap-2 rounded bg-background p-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground min-w-[60px]",children:L1[n]}),jsx("input",{type:"color",disabled:!e,className:"h-6 w-8 cursor-pointer rounded border-0 bg-transparent p-0",value:t[n],onChange:p=>s(n,p.target.value)}),jsx("input",{type:"text",disabled:!e,className:"flex-1 rounded border border-border bg-muted px-1.5 py-0.5 text-[10px] text-foreground font-mono",value:t[n],onChange:p=>d(p.target.value)})]})]}),u&&jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.preview")}),jsx("div",{className:"flex flex-col gap-px",children:u.map((p,f)=>jsx("div",{className:"grid grid-cols-12 gap-px",children:p.map(h=>jsx("div",{className:"h-3.5 rounded-sm",style:{backgroundColor:h.hex},title:`${h.colLabel} -- ${h.rowLabel} (${h.hex})`},`${h.schemeKey}-${f}`))},f))})]}),jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.fonts")}),jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:c("pptx.themeEditor.headingFont")}),jsxs("select",{className:xM,disabled:!e,value:Y0.includes(r)?r:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&a(p.target.value);},children:[Y0.map(p=>jsx("option",{value:p,children:p},p)),!Y0.includes(r)&&jsx("option",{value:"__custom__",children:r})]})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:c("pptx.themeEditor.bodyFont")}),jsxs("select",{className:xM,disabled:!e,value:Y0.includes(o)?o:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&l(p.target.value);},children:[Y0.map(p=>jsx("option",{value:p,children:p},p)),!Y0.includes(o)&&jsx("option",{value:"__custom__",children:o})]})]}),jsxs("div",{className:"flex items-center gap-2 pt-1 text-[10px] text-muted-foreground",children:[jsx("span",{style:{fontFamily:r},className:"text-foreground",children:c("pptx.themeEditor.headingSample")}),jsx("span",{className:"text-muted-foreground",children:"|"}),jsx("span",{style:{fontFamily:o},className:"text-foreground",children:c("pptx.themeEditor.bodySample")})]})]})]})]})}var lKe=["accent1","accent2","accent3","accent4","accent5","accent6"];function Jle({canEdit:t,currentThemeName:e,onSelectPreset:n}){let{t:r}=useTranslation();return jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:r("pptx.themeEditor.presetThemes")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:MN.map(o=>jsxs("button",{type:"button",disabled:!t,className:`flex flex-col items-start gap-1 rounded border p-1.5 text-left transition-colors ${e===o.name?"border-primary bg-primary/10":"border-border hover:border-muted-foreground hover:bg-muted"} disabled:opacity-40 disabled:cursor-not-allowed`,onClick:()=>n(o),title:o.name,children:[jsx("div",{className:"flex gap-px w-full",children:lKe.map(i=>jsx("div",{className:"h-3 flex-1 first:rounded-l-sm last:rounded-r-sm",style:{backgroundColor:o.colorScheme[i]}},i))}),jsx("span",{className:"text-[10px] text-muted-foreground truncate w-full",children:o.name})]},o.name))})]})}function Qle({theme:t,canEdit:e,onUpdateColorScheme:n,onUpdateFontScheme:r,onUpdateThemeName:o,onApplyToPresentation:i,onClose:s}){let{t:a}=useTranslation(),[l,c]=useState(()=>t?.colorScheme??MN[0].colorScheme),[u,d]=useState(()=>t?.fontScheme?.majorFont?.latin??"Calibri Light"),[p,f]=useState(()=>t?.fontScheme?.minorFont?.latin??"Calibri"),[h,m]=useState(()=>t?.name??"Custom Theme"),[x,y]=useState(null),v=useCallback((M,A)=>{let R={...l,[M]:A};c(R),n(R);},[l,n]),S=useCallback(M=>{c(M.colorScheme),d(M.majorFont),f(M.minorFont),m(M.name),n(M.colorScheme),r({majorFont:{latin:M.majorFont},minorFont:{latin:M.minorFont}}),o(M.name);},[n,r,o]),w=useCallback(()=>{t?.colorScheme&&(c(t.colorScheme),d(t.fontScheme?.majorFont?.latin??"Calibri Light"),f(t.fontScheme?.minorFont?.latin??"Calibri"),m(t.name??"Custom Theme"),n(t.colorScheme),r({majorFont:{latin:t.fontScheme?.majorFont?.latin??"Calibri Light"},minorFont:{latin:t.fontScheme?.minorFont?.latin??"Calibri"}}),o(t.name??"Custom Theme"));},[t,n,r,o]),C=useCallback(M=>{d(M),r({majorFont:{latin:M},minorFont:{latin:p}});},[p,r]),T=useCallback(M=>{f(M),r({majorFont:{latin:u},minorFont:{latin:M}});},[u,r]),E=useCallback(M=>{m(M),o(M);},[o]);return jsxs("div",{className:"flex flex-col gap-2 overflow-y-auto max-h-[calc(100vh-120px)]",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{className:"text-sm font-semibold text-foreground",children:a("pptx.themeEditor.title")}),jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",title:a("pptx.themeEditor.close"),children:jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:a("pptx.themeEditor.themeName")}),jsx("input",{type:"text",className:xM,disabled:!e,value:h,onChange:M=>E(M.target.value),placeholder:a("pptx.themeEditor.themeNamePlaceholder")})]}),jsx(Jle,{canEdit:e,currentThemeName:h,onSelectPreset:S}),jsx(Kle,{editColors:l,canEdit:e,activePickerKey:x,majorFont:u,minorFont:p,onSetActivePickerKey:y,onColorChange:v,onMajorFontChange:C,onMinorFontChange:T}),jsxs("div",{className:"flex gap-1.5 pt-1",children:[jsx("button",{type:"button",disabled:!e,className:Yle,onClick:i,children:a("pptx.themeEditor.applyToPresentation")}),jsx("button",{type:"button",disabled:!e,className:qle,onClick:w,children:a("pptx.themeEditor.reset")})]})]})}var $H=[{id:"office",name:"Office",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"},fontScheme:{majorFont:"Calibri Light",minorFont:"Calibri"}},{id:"facet",name:"Facet",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2C3C43",lt2:"#CFD7D9",accent1:"#90C226",accent2:"#54A021",accent3:"#E6B91E",accent4:"#E76618",accent5:"#C42F1A",accent6:"#918655",hlink:"#99CA3C",folHlink:"#B9D181"},fontScheme:{majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"}},{id:"integral",name:"Integral",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#335B74",lt2:"#DFE3E5",accent1:"#1CADE4",accent2:"#2683C6",accent3:"#27CED7",accent4:"#42BA97",accent5:"#3E8853",accent6:"#62A39F",hlink:"#6BA5D1",folHlink:"#9DCCE0"},fontScheme:{majorFont:"Tw Cen MT Condensed",minorFont:"Tw Cen MT"}},{id:"ion",name:"Ion",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#262626",lt2:"#E1E1E1",accent1:"#B01513",accent2:"#EA6312",accent3:"#E6B729",accent4:"#6AAC90",accent5:"#5F9C9D",accent6:"#9B6BF2",hlink:"#F09415",folHlink:"#D14D0F"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"retrospect",name:"Retrospect",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#637052",lt2:"#CCDDEA",accent1:"#E48312",accent2:"#BD582C",accent3:"#865640",accent4:"#9B8357",accent5:"#C2BC80",accent6:"#94A088",hlink:"#3A7CCB",folHlink:"#8C8C8C"},fontScheme:{majorFont:"Calibri Light",minorFont:"Calibri"}},{id:"organic",name:"Organic",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#283138",lt2:"#E3DED1",accent1:"#83992A",accent2:"#3C9770",accent3:"#44709D",accent4:"#A23C33",accent5:"#D97828",accent6:"#DEB340",hlink:"#A8B97F",folHlink:"#89C2A3"},fontScheme:{majorFont:"Garamond",minorFont:"Garamond"}},{id:"wisp",name:"Wisp",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#46393B",lt2:"#E8DCD8",accent1:"#A53010",accent2:"#DE7E18",accent3:"#9F8351",accent4:"#728653",accent5:"#92AA4C",accent6:"#6AAC91",hlink:"#FB4F14",folHlink:"#E25839"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"berlin",name:"Berlin",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3E5C61",lt2:"#D5E0D0",accent1:"#F09415",accent2:"#C1B56B",accent3:"#89C2A3",accent4:"#729BBE",accent5:"#9A90C2",accent6:"#BE8DBE",hlink:"#25A0DA",folHlink:"#FF7F00"},fontScheme:{majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"}},{id:"slice",name:"Slice",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2E3B4C",lt2:"#C7CDD3",accent1:"#E2751D",accent2:"#C53B23",accent3:"#A13D69",accent4:"#58599E",accent5:"#36749D",accent6:"#4EA39A",hlink:"#FD6B32",folHlink:"#D14D0F"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"dividend",name:"Dividend",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3D3D3D",lt2:"#E1E1E1",accent1:"#4D1434",accent2:"#903163",accent3:"#B2324B",accent4:"#D34817",accent5:"#E8971C",accent6:"#FDCB00",hlink:"#A03068",folHlink:"#C34882"},fontScheme:{majorFont:"Gill Sans MT",minorFont:"Gill Sans MT"}}];function HH({theme:t,selected:e,onClick:n}){let{colorScheme:r}=t;return jsxs("button",{type:"button",onClick:n,className:le("group relative flex flex-col rounded-lg border-2 transition-all overflow-hidden",e?"border-primary shadow-lg scale-[1.02]":"border-border hover:border-primary/50 hover:shadow-md"),title:t.name,children:[jsxs("div",{className:"h-24 flex flex-col",children:[jsxs("div",{className:"h-10 flex",children:[jsx("div",{className:"flex-1",style:{backgroundColor:r.accent1}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.accent2}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.accent3}})]}),jsxs("div",{className:"flex-1 flex",children:[jsx("div",{className:"w-1/3",style:{backgroundColor:r.dk2}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.lt2}})]})]}),jsx("div",{className:"bg-background border-t border-border px-2 py-1.5",children:jsx("p",{className:"text-xs font-medium text-foreground text-center",children:t.name})}),e&&jsx("div",{className:"absolute top-1 right-1 bg-primary text-white rounded-full p-1",children:jsx(LuCheck,{className:"w-3 h-3"})})]})}function tce({open:t,currentTheme:e,canEdit:n,onClose:r,onApplyTheme:o,onImportTheme:i}){let{t:s}=useTranslation(),[a,l]=useState(e??null),c=useRef(null);if(!t)return null;let u=()=>{a&&(o(a),r());},d=()=>{c.current?.click();},p=f=>{let h=f.target.files?.[0];h&&i&&i(h),f.target.value="";};return jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-[100] bg-black/60 backdrop-blur-sm",onClick:r,"aria-label":s("common.close")}),jsx("div",{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:jsxs("div",{className:"bg-background border border-border rounded-xl shadow-2xl max-w-5xl w-full max-h-[90vh] flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[jsxs("div",{children:[jsx("h2",{className:"text-lg font-semibold text-foreground",children:s("powerpoint.toolbar.themes.gallery.title")}),jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s("powerpoint.toolbar.themes.gallery.description")})]}),jsx("button",{type:"button",onClick:r,className:"p-2 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex-1 overflow-auto p-6",children:jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:$H.map(f=>jsx(HH,{theme:f,selected:a?.id===f.id,onClick:()=>l(f)},f.id))})}),jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-border",children:[jsx("div",{className:"flex items-center gap-2",children:i&&jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:d,disabled:!n,className:"inline-flex items-center gap-2 px-3 py-1.5 rounded bg-accent hover:bg-accent/80 text-xs font-medium text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[jsx(LuUpload,{className:"w-3.5 h-3.5"}),s("powerpoint.toolbar.themes.gallery.importTheme")]}),jsx("input",{ref:c,type:"file",accept:".thmx,.pptx",className:"hidden",onChange:p})]})}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded bg-accent hover:bg-accent/80 text-xs font-medium text-foreground transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:u,disabled:!n||!a,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-xs font-medium text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("common.apply")})]})]})]})})]})}function zH(t){let{mode:e,canEdit:n,activeSlide:r,masterPseudoSlide:o,slides:i,canvasSize:s,activeSlideIndex:a,selectedElement:l,state:c,comments:u,ops:d,manipulation:p,propertyHandlers:f,themeHandlers:h,history:m,panelWidth:x,onResizeRight:y}=t,v=e==="master"?o:r;return jsxs(Fragment,{children:[(e==="edit"||e==="master")&&c.isInspectorPaneOpen&&y&&jsx(Cp,{direction:"horizontal",onResize:y}),jsx(AH,{isOpen:(e==="edit"||e==="master")&&c.isInspectorPaneOpen,canEdit:n,mode:e,activeSlide:v,slides:i,canvasSize:s,selectedElement:l,effectiveSelectedIds:c.effectiveSelectedIds,tableEditorState:c.tableEditorState,sidebarPanelMode:c.sidebarPanelMode,activeSlideIndex:a,comments:u,onSetSidebarPanelMode:c.setSidebarPanelMode,onClose:()=>c.setIsInspectorPaneOpen(false),onUpdateElementStyle:d.updateSelectedShapeStyle,onUpdateTextStyle:d.updateSelectedTextStyle,onUpdateElement:d.updateSelectedElement,onApplySelection:d.applySelection,onSetCanvasSize:c.setCanvasSize,onMoveLayer:p.handleMoveLayer,onMoveLayerToEdge:p.handleMoveLayerToEdge,onDeleteElement:p.handleDelete,onUpdateSlide:f.handleUpdateSlide,presentationProperties:c.presentationProperties,onUpdatePresentationProperties:f.handleUpdatePresentationProperties,editTemplateMode:c.editTemplateMode,slideMasters:c.slideMasters,themeOptions:c.themeOptions,notesMaster:c.notesMaster,handoutMaster:c.handoutMaster,notesCanvasSize:c.notesCanvasSize,coreProperties:c.coreProperties,appProperties:c.appProperties,customProperties:c.customProperties,tagCollections:c.tagCollections,onUpdateTagCollections:c.setTagCollections,onUpdateCoreProperties:f.handleUpdateCoreProperties,onUpdateAppProperties:f.handleUpdateAppProperties,onUpdateCustomProperties:f.handleUpdateCustomProperties,onApplyTheme:h.handleApplyTheme,onSetTemplateBackground:h.handleSetTemplateBackground,onGetTemplateBackgroundColor:h.handleGetTemplateBackgroundColor,mediaDataUrls:c.mediaDataUrls,theme:c.theme,panelWidth:x}),c.isSelectionPaneOpen&&(e==="edit"||e==="master")&&jsx("div",{className:"absolute right-0 top-0 z-30 h-full max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:h-auto max-md:max-h-[50vh]",children:jsx(y8,{slides:i,activeSlideIndex:a,selectedElementId:c.selectedElementId,selectedElementIds:c.selectedElementIds,canEdit:n,setSelectedElementId:c.setSelectedElementId,setSelectedElementIds:c.setSelectedElementIds,setSlides:c.setSlides,markDirty:m.markDirty,onClose:()=>c.setIsSelectionPaneOpen(false)})}),c.isThemeEditorOpen&&e==="edit"&&jsx("div",{className:"absolute right-0 top-0 z-30 h-full w-72 overflow-y-auto border-l border-border bg-card p-2.5 shadow-xl max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:h-auto max-md:max-h-[60vh] max-md:rounded-t-xl max-md:border-t max-md:border-l-0",children:jsx(Qle,{theme:c.theme,canEdit:n,onUpdateColorScheme:h.handleUpdateThemeColorScheme,onUpdateFontScheme:h.handleUpdateThemeFontScheme,onUpdateThemeName:h.handleUpdateThemeName,onApplyToPresentation:h.handleApplyThemeToPresentation,onClose:()=>c.setIsThemeEditorOpen(false)})}),jsx(tce,{open:c.isThemeGalleryOpen,currentTheme:null,canEdit:n,onClose:()=>c.setIsThemeGalleryOpen(false),onApplyTheme:S=>{h.handleApplyThemeData(S.colorScheme,{majorFont:{latin:S.fontScheme.majorFont,eastAsia:S.fontScheme.majorFont,complexScript:S.fontScheme.majorFont},minorFont:{latin:S.fontScheme.minorFont,eastAsia:S.fontScheme.minorFont,complexScript:S.fontScheme.minorFont}},S.name);}})]})}function GH(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,activeSlideIndex:s,canvasSize:a,gridSpacingPx:l,slideSectionGroups:c,showSlidesPane:u,showMasterPane:d,selectedElement:p,state:f,editorOps:h,dialogs:m,presentation:x,annotations:y,propertyHandlers:v,themeHandlers:S,history:w,comments:C,zoom:T,isMobile:E=false,isTouchDevice:M=false,onEndPresentation:A,leftPanelWidth:R,onResizeLeft:k,rightPanelWidth:N,onResizeRight:F}=t,{ops:B,sectionOps:D,canvasHandlers:O,insertHandlers:U,manipulation:H,slideOps:j,tableOps:Z,findReplace:J}=h;return jsxs("div",{className:"relative z-10 flex flex-1 min-h-0",children:[u&&jsxs(Fragment,{children:[jsx(F2,{slides:r,activeSlideIndex:s,canvasSize:a,sectionGroups:c,isOpen:f.isSlidesPaneOpen,canEdit:n,onSelectSlide:f.setActiveSlideIndex,onSlideContextMenu:j.handleSlideContextMenu,onMoveSlide:j.handleMoveSlide,onAddSlide:j.handleAddSlide,onCollapse:()=>f.setIsSlidesPaneOpen(false),onAddSection:D.addSection,onRenameSection:D.renameSection,onDeleteSection:D.deleteSection,onMoveSectionUp:D.moveSectionUp,onMoveSectionDown:D.moveSectionDown,rehearsalTimings:Object.keys(x.recordedTimings).length>0?x.recordedTimings:void 0,panelWidth:R}),k&&jsx(Cp,{direction:"horizontal",onResize:k})]}),d&&jsx(B6,{slideMasters:f.slideMasters,activeMasterIndex:f.activeMasterIndex,activeLayoutIndex:f.activeLayoutIndex,canvasSize:a,masterViewTab:f.masterViewTab,notesMaster:f.notesMaster,handoutMaster:f.handoutMaster,handoutSlidesPerPage:f.handoutSlidesPerPage,onSelectMaster:m.handleSelectMaster,onSelectLayout:m.handleSelectLayout,onCollapse:()=>f.setIsSlidesPaneOpen(false),onTabChange:f.setMasterViewTab,onHandoutSlidesPerPageChange:f.setHandoutSlidesPerPage}),jsx(UH,{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:f.templateElements,canvasSize:a,activeSlideIndex:s,gridSpacingPx:l,zoom:T,state:f,selectedElement:p,canvasHandlers:O,insertHandlers:U,tableOps:Z,annotations:y,presentation:x,onEndPresentation:A,findReplace:J}),f.contextMenuState&&jsx(CU,{contextMenuState:f.contextMenuState,mode:e,selectedElement:p,tableEditorState:f.tableEditorState,hasMultiSelection:f.effectiveSelectedIds.length>1,onAction:H.handleContextMenuAction,onInsertTableRow:Z.handleInsertTableRow,onDeleteTableRow:Z.handleDeleteTableRow,onInsertTableColumn:Z.handleInsertTableColumn,onDeleteTableColumn:Z.handleDeleteTableColumn,onMergeCellRight:Z.handleMergeCellRight,onMergeCellDown:Z.handleMergeCellDown,onMergeSelectedCells:Z.handleMergeSelectedCells,onSplitCell:Z.handleSplitCell,onClose:()=>f.setContextMenuState(null)}),jsx(zH,{mode:e,canEdit:n,activeSlide:o,masterPseudoSlide:i,slides:r,canvasSize:a,activeSlideIndex:s,selectedElement:p,state:f,comments:C,ops:B,manipulation:H,propertyHandlers:v,themeHandlers:S,history:w,panelWidth:N,onResizeRight:F})]})}function rce({onOpenSlides:t,onOpenInsert:e,onOpenInspector:n,onOpenComments:r,onToggleNotes:o,activeSheet:i,commentCount:s}){return jsx("nav",{"aria-label":"Editor actions",className:"md:hidden flex items-stretch justify-around border-t border-border bg-secondary/80 backdrop-blur supports-[backdrop-filter]:bg-secondary/60 pb-[max(env(safe-area-inset-bottom),0px)]",children:[{key:"slides",label:"Slides",icon:LuLayers,onClick:t},{key:"insert",label:"Insert",icon:LuPlus,onClick:e},{key:"inspector",label:"Format",icon:LuSettings2,onClick:n},{key:"comments",label:"Comments",icon:LuMessageSquare,onClick:r,badge:s},{key:"notes",label:"Notes",icon:LuStickyNote,onClick:o}].map(({key:l,label:c,icon:u,onClick:d,badge:p})=>{let f=i===l;return jsxs("button",{type:"button",onClick:d,className:le("relative flex flex-col items-center justify-center gap-0.5 flex-1 min-h-[56px] py-1.5 text-[10px] font-medium transition-colors active:scale-95",f?"text-primary":"text-muted-foreground hover:text-foreground"),"aria-pressed":f,children:[jsx(u,{className:"w-5 h-5"}),jsx("span",{children:c}),p!==void 0&&p>0&&jsx("span",{className:"absolute top-1 right-1/4 flex items-center justify-center min-w-[16px] h-4 px-1 rounded-full bg-primary text-[9px] font-semibold text-white",children:p>99?"99+":p}),f&&jsx("span",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-8 h-0.5 rounded-full bg-primary"})]},l)})})}function oce({open:t,onClose:e,...n}){return jsx(VI,{open:t,onClose:e,heightFraction:.7,title:"Slides",children:jsx("div",{className:"h-full",children:jsx(F2,{...n})})})}function sce(t){let{state:e,editorOps:n,presentation:r,slides:o,activeSlideIndex:i,canvasSize:s,slideSectionGroups:a,canEdit:l,commentCount:c}=t,u=e.isSlidesPaneOpen?"slides":e.isInspectorPaneOpen?e.sidebarPanelMode==="comments"?"comments":"inspector":e.isSlideNotesCollapsed?null:"notes",d=()=>{e.setIsSlidesPaneOpen(false),e.setIsInspectorPaneOpen(false),e.setIsSlideNotesCollapsed(true);},p=f=>{switch(d(),f){case "slides":e.setIsSlidesPaneOpen(true);break;case "inspector":e.setSidebarPanelMode("properties"),e.setIsInspectorPaneOpen(true);break;case "comments":e.setSidebarPanelMode("comments"),e.setIsInspectorPaneOpen(true);break;case "notes":e.setIsSlideNotesCollapsed(false);break}};return jsxs(Fragment,{children:[jsx(oce,{open:e.isSlidesPaneOpen,onClose:()=>e.setIsSlidesPaneOpen(false),slides:o,activeSlideIndex:i,canvasSize:s,sectionGroups:a,isOpen:true,canEdit:l,onSelectSlide:f=>{e.setActiveSlideIndex(f),e.setIsSlidesPaneOpen(false);},onSlideContextMenu:n.slideOps.handleSlideContextMenu,onMoveSlide:n.slideOps.handleMoveSlide,onAddSlide:n.slideOps.handleAddSlide,onCollapse:()=>e.setIsSlidesPaneOpen(false),onAddSection:n.sectionOps.addSection,onRenameSection:n.sectionOps.renameSection,onDeleteSection:n.sectionOps.deleteSection,onMoveSectionUp:n.sectionOps.moveSectionUp,onMoveSectionDown:n.sectionOps.moveSectionDown,rehearsalTimings:Object.keys(r.recordedTimings).length>0?r.recordedTimings:void 0}),jsx(rce,{activeSheet:u,commentCount:c,onOpenSlides:()=>e.isSlidesPaneOpen?e.setIsSlidesPaneOpen(false):p("slides"),onOpenInsert:()=>{n.insertHandlers.handleAddTextBox();},onOpenInspector:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode!=="comments"?e.setIsInspectorPaneOpen(false):p("inspector"),onOpenComments:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode==="comments"?e.setIsInspectorPaneOpen(false):p("comments"),onToggleNotes:()=>e.isSlideNotesCollapsed?p("notes"):e.setIsSlideNotesCollapsed(true)})]})}function nS({label:t,enabled:e,onToggle:n}){return jsxs("div",{className:"flex items-center justify-between py-2.5 px-3",children:[jsx("span",{className:"text-sm text-foreground",children:t}),jsx("button",{type:"button",onClick:n,className:le("relative inline-flex h-5 w-9 items-center rounded-full transition-colors",e?"bg-primary":"bg-muted-foreground/30"),role:"switch","aria-checked":e,"aria-label":t,children:jsx("span",{className:le("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})]})}function lce({isOpen:t,onClose:e,spellCheckEnabled:n=false,onSetSpellCheckEnabled:r,showGrid:o=false,onSetShowGrid:i,showRulers:s=false,onSetShowRulers:a,snapToGrid:l=false,onSetSnapToGrid:c,reducedMotion:u=false,onToggleReducedMotion:d}){let[p,f]=useState("general"),[h,m]=useState(true),{t:x}=useTranslation(),y=useCallback(S=>{S.key==="Escape"&&e();},[e]);if(useEffect(()=>{if(t)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t,y]),!t)return null;let v=[{id:"general",label:x("pptx.settings.general")},{id:"shortcuts",label:x("pptx.settings.keyboardShortcuts")}];return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":x("pptx.settings.closeSettings"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[min(32rem,calc(100%-2rem))] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuSettings,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:x("pptx.settings.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":x("pptx.settings.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"flex border-b border-border/60 px-5",children:v.map(S=>jsxs("button",{type:"button",onClick:()=>f(S.id),className:le("px-3 py-2 text-xs font-medium transition-colors relative",p===S.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[S.label,p===S.id&&jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full"})]},S.id))}),jsxs("div",{className:"px-5 py-4 max-h-[60vh] overflow-y-auto",children:[p==="general"&&jsxs("div",{className:"space-y-0.5",children:[jsx(nS,{label:x("pptx.settings.autoSave"),enabled:h,onToggle:()=>m(!h)}),jsx(nS,{label:x("pptx.settings.spellCheck"),enabled:n,onToggle:()=>r?.(!n)}),jsx(nS,{label:x("pptx.settings.showGrid"),enabled:o,onToggle:()=>i?.(!o)}),jsx(nS,{label:x("pptx.settings.showRulers"),enabled:s,onToggle:()=>a?.(!s)}),jsx(nS,{label:x("pptx.settings.snapToGrid"),enabled:l,onToggle:()=>c?.(!l)}),jsx(nS,{label:x("pptx.settings.reducedMotion"),enabled:u,onToggle:()=>d?.()})]}),p==="shortcuts"&&jsx("div",{className:"space-y-0.5",children:mE.map((S,w)=>jsxs("div",{className:le("flex items-center justify-between gap-3 rounded px-3 py-2",w%2===0?"bg-muted/60":""),children:[jsx("span",{className:"text-xs text-foreground",children:S.action}),jsx("span",{className:"font-mono text-[11px] text-muted-foreground whitespace-nowrap",children:S.shortcut})]},S.action))})]})]})})]})}function XH({doc:t,slides:e,setSlides:n,isConnected:r}){let o=useRef(false),i=useRef(""),s=useRef(false),a=useCallback(()=>t?t.getMap("slides-data"):null,[t]);useEffect(()=>{if(!r||!t||o.current||e.length===0)return;let l=a();if(!l)return;let c=JSON.stringify(e);c!==i.current&&(i.current=c,t.transact(()=>{let u=l.get("count");if(typeof u=="number"&&u>e.length)for(let d=e.length;d<u;d++)l.delete(`slide-${d}`);l.set("count",e.length);for(let d=0;d<e.length;d++){let p=JSON.stringify(e[d]);l.get(`slide-${d}`)!==p&&l.set(`slide-${d}`,p);}}));},[t,e,r,a]),useEffect(()=>{if(!r||!t)return;let l=a();if(!l)return;let c=()=>{let u=l.get("count");if(typeof u!="number"||u===0)return;let d=[];for(let f=0;f<u;f++){let h=l.get(`slide-${f}`);if(typeof h=="string")try{d.push(JSON.parse(h));}catch{}}if(d.length===0)return;let p=JSON.stringify(d);p!==i.current&&(i.current=p,o.current=true,n(d),requestAnimationFrame(()=>{o.current=false;}));};if(l.observe(c),!s.current){s.current=true;let u=l.get("count");typeof u=="number"&&u>0&&c();}return ()=>{l.unobserve(c);}},[t,r,a,n]);}function WH({collab:t,activeSlideIndex:e,setActiveSlideIndex:n,slideCount:r}){let o=useRef(-1);useEffect(()=>{if(!t||t.config.role!=="viewer")return;let i=t.remoteUsers.find(a=>a.role==="broadcaster");if(!i)return;let s=i.activeSlideIndex;s<0||s>=r||s!==o.current&&(o.current=s,s!==e&&n(s));},[t,e,n,r]);}function FKe(t){if(t){let e=Math.round(t.cx/9525);if(e>0)return e}return 8}function BKe(t,e,n){if(e){let r=n.find(o=>o.id===e);if(r){let o=new Map;return t.forEach((i,s)=>o.set(i.rId,s)),r.slideRIds.map(i=>o.get(i)).filter(i=>i!==void 0)}}return t.map((r,o)=>o).filter(r=>!t[r]?.hidden)}function OKe(t,e){if(t.length===0)return [];if(e.length>0){let n=new Map,r=[];for(let i=0;i<t.length;i++){let s=t[i].sectionId;if(s){let a=n.get(s);a?a.push(i):n.set(s,[i]);}else r.push(i);}let o=e.map(i=>({id:i.id,label:i.name,slideIndexes:n.get(i.id)??[],color:i.color,defaultCollapsed:i.collapsed})).filter(i=>i.slideIndexes.length>0);return r.length>0&&o.push({id:DW,label:"Ungrouped Slides",slideIndexes:r}),o.length>0?o:[{id:"default",label:"Slides",slideIndexes:t.map((i,s)=>s)}]}return [{id:"default",label:"Slides",slideIndexes:t.map((n,r)=>r)}]}function UKe(t,e,n){if(t==="master"){if(e)return {id:e.path,rId:"",slideNumber:0,elements:e.elements??[],backgroundColor:e.backgroundColor??n?.backgroundColor,backgroundImage:e.backgroundImage??n?.backgroundImage};if(n)return {id:n.path,rId:"",slideNumber:0,elements:n.elements??[],backgroundColor:n.backgroundColor,backgroundImage:n.backgroundImage}}}function uce(t){let{slides:e,sections:n,customShows:r,activeCustomShowId:o,mode:i,activeLayout:s,activeMaster:a,presentationGridSpacing:l}=t,c=useMemo(()=>FKe(l),[l]),u=useMemo(()=>BKe(e,o,r),[e,o,r]),d=useMemo(()=>OKe(e,n),[e,n]),p=useMemo(()=>UKe(i,s,a),[i,s,a]);return {gridSpacingPx:c,visibleSlideIndexes:u,slideSectionGroups:d,masterPseudoSlide:p}}var $Ke=120;function pce(t){let{slides:e,canvasSize:n,activeSlideIndex:r,templateElementsBySlideId:o,loading:i,error:s,hasActivePointerInteraction:a,pointerCommitNonce:l,setSlides:c,setCanvasSize:u,setActiveSlideIndex:d,setTemplateElementsBySlideId:p,setSelectedElementId:f,setSelectedElementIds:h}=t,m=useRef([]),x=useRef([]),y=useRef(null),v=useRef(""),S=useRef(""),w=useRef(false),C=useRef(null),[T,E]=useState(false),[M,A]=useState(false),[R,k]=useState(void 0),[N,F]=useState(void 0),[B,D]=useState(false),O=useCallback(()=>{E(m.current.length>0),A(x.current.length>0);let se=m.current[m.current.length-1];k(se?.actionLabel);let Ce=x.current[x.current.length-1];F(Ce?.actionLabel);},[]),U=useCallback(se=>({width:n.width,height:n.height,activeSlideIndex:r,slides:e.map(fE),templateElementsBySlideId:hE(o),...se?{actionLabel:se}:{}}),[r,n,e,o]),H=useCallback(se=>{let Ce=Math.max(se.slides.length-1,0);u({width:se.width,height:se.height}),c(se.slides.map(fE)),p(hE(se.templateElementsBySlideId)),d(Math.min(se.activeSlideIndex,Ce)),h([]),f(null);},[d,u,f,h,c,p]),j=useCallback(()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{w.current=false;},0);},[]),Z=useCallback(()=>{D(se=>se||true);},[]),J=useCallback(()=>{let se=m.current.pop();if(!se)return;let Ce=U();x.current.push(Ce),w.current=true;let ee=Ld(se);y.current=Ld(ee),v.current=JSON.stringify(ee),H(ee),O(),j(),Z();},[H,U,Z,j,O]),W=useCallback(()=>{let se=x.current.pop();if(!se)return;let Ce=U();m.current.push(Ce),w.current=true;let ee=Ld(se);y.current=Ld(ee),v.current=JSON.stringify(ee),H(ee),O(),j(),Z();},[H,U,Z,j,O]),te=useCallback(se=>{if(m.current=[],x.current=[],se){let Ce=Ld(se);y.current=Ce,v.current=JSON.stringify(Ce);}else y.current=null,v.current="";O();},[O]);return useEffect(()=>()=>{C.current&&(clearTimeout(C.current),C.current=null);},[]),useEffect(()=>{if(i||s||w.current||a())return;let se=`${e.length}|${r}|${n.width}x${n.height}|${e.map(ue=>`${ue.id}:${ue.elements.length}`).join("/")}`;if(se===S.current)return;let Ce=U(),ee=JSON.stringify(Ce);if(ee===v.current){S.current=se;return}let ce=y.current;if(!ce){y.current=Ld(Ce),v.current=ee,S.current=se,O();return}m.current.push(Ld(ce)),m.current.length>$Ke&&m.current.shift(),x.current=[],y.current=Ld(Ce),v.current=ee,S.current=se,O();},[r,U,n.height,n.width,s,a,i,l,e,O]),{canUndo:T,canRedo:M,undoLabel:R,redoLabel:N,handleUndo:J,handleRedo:W,resetHistory:te,markDirty:Z,buildHistorySnapshot:U}}function PN(t,e,n){let r={...n};if(!e||e.length===0)return [{text:t,style:r}];let o=[[]];for(let d of e)d.text===`
4676
4676
  `||d.isParagraphBreak?o.push([]):o[o.length-1].push(d);let i=t.split(`
4677
4677
  `),s=o.flat().find(d=>d.text.trim().length>0),a=s?.style?{...s.style}:r;function l(d,p){if(p.length===0)return d.length>0?[{text:d,style:{...a}}]:[{text:"",style:{...a}}];let f=p[0].bulletInfo;if(d.length===0){let v=[{text:"",style:{...p[0].style}}];return f&&(v[0].bulletInfo=f),v}if(p.reduce((y,v)=>y+v.text.length,0)===0){let y=[{text:d,style:{...p[0].style}}];return f&&(y[0].bulletInfo=f),y}let m=[],x=0;for(let y=0;y<p.length;y++){let v=p[y],S=y===p.length-1,w=v.text.length;if(x>=d.length)break;let C;if(S?C=d.slice(x):C=d.slice(x,x+w),C.length>0){let T={text:C,style:{...v.style}};m.length===0&&f&&(T.bulletInfo=f),m.push(T);}x+=S?C.length:w;}if(m.length===0){let y={text:d,style:{...p[0].style}};return f&&(y.bulletInfo=f),[y]}return m}let c=[],u=o[o.length-1];for(let d=0;d<i.length;d++){if(d>0){let h=o[d-1]??[],m=h[0]?.style?{...h[0].style}:{...a};c.push({text:`
4678
4678
  `,style:m,isParagraphBreak:true});}let p=o[d]??u??[],f=l(i[d],p);c.push(...f);}return c.length>0?c:[{text:"",style:{...a}}]}function fce(t){let{mode:e,canEdit:n,canvasSize:r,selectedElementId:o,selectedElementIds:i,selectedElementIdSet:s,inlineEditingElementId:a,effectiveSelectedIds:l,elementLookup:c,activeTool:u,editorScale:d,canvasStageRef:p,dragStateRef:f,resizeStateRef:h,shapeAdjustmentDragStateRef:m,marqueeStateRef:x,setInlineEditingElementId:y,setInlineEditingText:v,setContextMenuState:S,setMarqueeSelectionState:w,setSnapLines:C,inlineEditingText:T,ops:E,history:M,presentationHandleAction:A,setEditingEquationOmml:R,setIsEquationDialogOpen:k}=t,N=useRef(false),F=()=>{let J=a;if(!J)return;let W=c.get(J);if(W&&ot(W)){let te=PN(T,W.textSegments,W.textStyle);E.updateElementById(J,{text:T,textSegments:te}),M.markDirty();}y(null),v("");};return {handleElementClick:(J,W)=>{if(W.stopPropagation(),e==="present"){let te=c.get(J);te?.actionClick&&A(te.actionClick);return}if(W.shiftKey||W.metaKey){let te=i.length?i:o?[o]:[],se=te.includes(J)?te.filter(Ce=>Ce!==J):[...te,J];E.applySelection(se[0]??null,se);}else if(s.has(J)&&!a)if(N.current)N.current=false;else {let te=c.get(J);te&&ot(te)&&!te.locks?.noTextEdit&&(y(J),v(te.text??""));}else E.applySelection(J);},handleElementDoubleClick:(J,W)=>{let te=c.get(J);if(te){if(ot(te)&&te.textSegments?.some(se=>se.equationXml)){let se=te.textSegments?.find(Ce=>Ce.equationXml);if(se?.equationXml){R(se.equationXml),k(true);return}}ot(te)&&(y(J),v(te.text??""));}},handleElementMouseDown:(J,W)=>{if(W.button!==0)return;a&&a!==J&&F();let te=s.has(J);te?N.current=false:(E.applySelection(J),N.current=true);let se=te?l.length?l:[J]:[J],Ce={},ee=new Map;for(let ce of se){let ue=c.get(ce);ue&&(Ce[ce]={x:ue.x,y:ue.y});let Ne=document.querySelector(`[data-element-id="${ce}"]`);Ne&&ee.set(ce,Ne);}f.current={elementId:J,startClientX:W.clientX,startClientY:W.clientY,startPositionsById:Ce,domEls:ee,moved:false,lastDx:0,lastDy:0},C([]);},handleElementContextMenu:(J,W)=>{W.preventDefault(),W.stopPropagation(),s.has(J)||E.applySelection(J),S({x:W.clientX,y:W.clientY,elementId:J});},handleCanvasMouseDown:J=>{if(e!=="edit"||!n||J.button!==0||u!=="select")return;a&&F();let W=p.current;if(!W)return;let te=W.getBoundingClientRect(),se=d||1,Ce=Math.max(0,Math.min(r.width,(J.clientX-te.left)/se)),ee=Math.max(0,Math.min(r.height,(J.clientY-te.top)/se)),ce=J.shiftKey||J.metaKey,ue={startX:Ce,startY:ee,currentX:Ce,currentY:ee,additive:ce,baseSelectionIds:ce?l:[]};x.current=ue,w(ue),S(null);},handleResizePointerDown:(J,W,te)=>{W.stopPropagation();let se=c.get(J);se&&(h.current={elementId:J,startClientX:W.clientX,startClientY:W.clientY,startX:se.x,startY:se.y,startWidth:se.width,startHeight:se.height,handle:te,moved:false,domEl:document.querySelector(`[data-element-id="${J}"]`),lastX:se.x,lastY:se.y,lastWidth:se.width,lastHeight:se.height});},handleAdjustmentPointerDown:(J,W)=>{W.stopPropagation();let te=c.get(J);if(!te||!("shapeType"in te)||!("shapeAdjustments"in te))return;let se=Object.entries(te.shapeAdjustments??{});if(!se.length)return;let[Ce,ee]=se[0];m.current={elementId:J,key:Ce,shapeType:te.shapeType??"rect",startClientX:W.clientX,startClientY:W.clientY,startAdjustment:ee,startWidth:te.width,startHeight:te.height,moved:false};},handleInlineEditCommit:F}}function YH(){return `comment-${crypto.randomUUID()}`}function hce(t,e,n){return t.map((r,o)=>o===e?{...r,comments:[...r.comments||[],n]}:r)}function mce(t,e,n){let r=false;return {slides:t.map((i,s)=>{if(s!==e)return i;let a=i.comments||[],l=a.filter(c=>{let u=c.id!==n;return u||(r=true),u});return l.length===a.length?i:{...i,comments:l}}),didDelete:r}}function gce(t,e,n,r){let o=false;return {slides:t.map((s,a)=>{if(a!==e)return s;let l=(s.comments||[]).map(c=>c.id!==n?c:(o=true,{...c,text:r}));return o?{...s,comments:l}:s}),didUpdate:o}}function xce(t,e,n){let r=false;return {slides:t.map((i,s)=>{if(s!==e)return i;let a=(i.comments||[]).map(l=>l.id!==n?l:(r=true,{...l,resolved:!l.resolved}));return r?{...i,comments:a}:i}),didUpdate:r}}function yce(t,e){let n={},r=false;for(let[o,i]of Object.entries(t)){if(!e.has(o)){r=true;continue}n[o]=i;}return r?n:null}function bce({slides:t,canEdit:e,userName:n="You",selectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState({}),[l,c]=useState({}),[u,d]=useState({}),[p,f]=useState({}),[h,m]=useState(null),x=useCallback((N,F)=>{a(B=>({...B,[N]:F}));},[]),y=useCallback((N,F)=>{d(B=>({...B,[N]:F}));},[]),v=useCallback(N=>{if(!e)return;let F=t[N];if(!F)return;let B=String(s[F.id]||"").trim();if(B.length===0)return;let D={id:YH(),text:B,author:n,createdAt:new Date().toISOString(),elementId:r??void 0};o(O=>hce(O,N,D)),a(O=>({...O,[F.id]:""})),i();},[e,s,i,o,r,t,n]),S=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=false;o(O=>{let U=mce(O,N,F);return D=U.didDelete,U.slides}),D&&(c(O=>({...O,[B.id]:null})),i());},[e,i,o,t]),w=useCallback((N,F)=>{let B=t.find(O=>O.id===N);if(!B)return;let D=(B.comments||[]).find(O=>O.id===F);D&&(c(O=>({...O,[N]:F})),d(O=>({...O,[F]:D.text||""})));},[t]),C=useCallback(N=>{c(F=>({...F,[N]:null}));},[]),T=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=String(u[F]||"").trim();if(D.length===0)return;let O=false;o(U=>{let H=gce(U,N,F,D);return O=H.didUpdate,H.slides}),O&&(c(U=>({...U,[B.id]:null})),i());},[e,u,i,o,t]),E=useCallback((N,F)=>{if(!e||!t[N])return;let D=false;o(O=>{let U=xce(O,N,F);return D=U.didUpdate,U.slides}),D&&i();},[e,i,o,t]),M=useCallback((N,F)=>{m(F),f(B=>({...B,[F]:""}));},[]),A=useCallback(()=>{m(null);},[]),R=useCallback((N,F)=>{f(B=>({...B,[N]:F}));},[]),k=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=(B.comments||[]).find(H=>H.id===F);if(!D)return;let O=String(p[F]||"").trim();if(O.length===0)return;let U={id:YH(),text:O,author:n,createdAt:new Date().toISOString(),threadId:F,elementId:D.elementId};o(H=>H.map((j,Z)=>{if(Z!==N)return j;let J=(j.comments||[]).map(W=>W.id!==F?W:{...W,replies:[...W.replies||[],U]});return {...j,comments:J}})),m(null),f(H=>{let j={...H};return delete j[F],j}),i();},[e,i,o,p,t,n]);return useEffect(()=>{let N=new Set(t.map(F=>F.id));a(F=>yce(F,N)??F);},[t]),{commentDraftBySlideId:s,editingCommentIdBySlideId:l,commentEditDraftByCommentId:u,replyingToCommentId:h,replyDraftByCommentId:p,handleCommentDraftChange:x,handleAddSlideComment:v,handleDeleteSlideComment:S,handleStartCommentEdit:w,handleCancelCommentEdit:C,handleSaveCommentEdit:T,handleSetCommentEditDraft:y,handleToggleCommentResolved:E,handleStartReply:M,handleCancelReply:A,handleReplyDraftChange:R,handleSubmitReply:k}}function xo(){return `el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function vce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,editTemplateMode:i,clipboardPayload:s,setClipboardPayload:a,setTemplateElementsBySlideId:l,ops:c,history:u}=t,d=()=>{r&&a({element:structuredClone(r),isTemplate:i});},p=()=>{let x=o;if(!x.length||!e)return;let y=new Set(x);i?l(v=>{let S=e.id,w=v[S]??[];return {...v,[S]:w.filter(C=>!y.has(C.id))}}):c.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:S.elements.filter(C=>!y.has(C.id))}:S)),c.clearSelection(),u.markDirty();};return {handleCopy:d,handleCut:()=>{d(),p();},handlePaste:()=>{if(!s||!e)return;let x=structuredClone(s.element);x.id=xo(),x.x+=20,x.y+=20,c.updateSlides(y=>y.map((v,S)=>S===n?{...v,elements:[...v.elements,x]}:v)),c.applySelection(x.id),u.markDirty();},handleDuplicate:()=>{if(!r||!e)return;let x=structuredClone(r);x.id=xo(),x.x+=20,x.y+=20,c.updateSlides(y=>y.map((v,S)=>S===n?{...v,elements:[...v.elements,x]}:v)),c.applySelection(x.id),u.markDirty();},handleDelete:p}}function GKe(t){return t.type==="shape"||t.type==="image"||t.type==="picture"}function VKe(t){if("pathData"in t&&typeof t.pathData=="string"&&t.pathData)return t.pathData;if("shapeType"in t&&typeof t.shapeType=="string"){let e=O5(t.shapeType);if(e){let n=jKe(e,t.width,t.height);if(n)return n}}return `M 0 0 L ${t.width} 0 L ${t.width} ${t.height} L 0 ${t.height} Z`}function jKe(t,e,n){let r=t.match(/polygon\(([^)]+)\)/i);if(!r)return null;let o=r[1].split(",").map(a=>a.trim()),i=[];for(let a of o){let l=a.split(/\s+/);if(l.length<2)continue;let c=l[0],u=l[1],d,p;c.endsWith("%")?d=parseFloat(c)/100*e:d=parseFloat(c),u.endsWith("%")?p=parseFloat(u)/100*n:p=parseFloat(u),!isNaN(d)&&!isNaN(p)&&i.push({x:d,y:p});}if(i.length<3)return null;let s=[`M ${i[0].x} ${i[0].y}`];for(let a=1;a<i.length;a++)s.push(`L ${i[a].x} ${i[a].y}`);return s.push("Z"),s.join(" ")}function XKe(t,e){let n=Ml(t);if(n.length===0)return t;let r=e.width,o=e.height;"pathWidth"in e&&typeof e.pathWidth=="number"&&(r=e.pathWidth),"pathHeight"in e&&typeof e.pathHeight=="number"&&(o=e.pathHeight);let i=r>0?e.width/r:1,s=o>0?e.height/o:1,a=n.map(l=>l.map(c=>({x:c.x*i+e.x,y:c.y*s+e.y})));return Gx(a)}function Sce(t,e,n,r,o){let i=Ml(t);if(i.length===0)return t;let s=i.map(a=>a.map(l=>({x:l.x-e,y:l.y-n})));return Gx(s)}function wce(t){let e=Ml(t),n=1/0,r=1/0,o=-1/0,i=-1/0;for(let s of e)for(let a of s)a.x<n&&(n=a.x),a.y<r&&(r=a.y),a.x>o&&(o=a.x),a.y>i&&(i=a.y);return isFinite(n)?{x:n,y:r,width:o-n,height:i-r}:{x:0,y:0,width:0,height:0}}function Cce(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,effectiveSelectedIds:o,setSelectedElementIds:i,ops:s,history:a}=t,l=r.filter(GKe),c=l.length>=2;return {handleMergeShapes:d=>{if(!c||!e)return;let p=l;if(p.length<2)return;let f=p.map(h=>{let m=VKe(h);return XKe(m,h)});if(d==="fragment"){let h=[],m=f[0];for(let v=1;v<f.length;v++){let S=G5("fragment",m,f[v]);Array.isArray(S)&&(h=S),v<f.length-1&&h.length>0&&(m=h[0]);}if(h.length===0)return;let x=new Set(o),y=[];for(let v of h){if(!v)continue;let S=wce(v);if(S.width<=0||S.height<=0)continue;let w=Sce(v,S.x,S.y),C={id:xo(),type:"shape",x:S.x,y:S.y,width:S.width,height:S.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:p[0].opacity??1,rawXml:{},shapeStyle:{...p[0].shapeStyle},shapeType:"custGeom",pathData:w,pathWidth:S.width,pathHeight:S.height};y.push(C);}if(y.length===0)return;s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements.filter(C=>!x.has(C.id)),...y]}:S)),i(y.map(v=>v.id)),a.markDirty();}else {let h=f[0];for(let w=1;w<f.length;w++){let C=G5(d,h,f[w]);typeof C=="string"&&(h=C);}if(!h)return;let m=wce(h);if(m.width<=0||m.height<=0)return;let x=Sce(h,m.x,m.y),y=p[0],v={id:xo(),type:"shape",x:m.x,y:m.y,width:m.width,height:m.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:y.opacity??1,rawXml:{},shapeStyle:{...y.shapeStyle},shapeType:"custGeom",pathData:x,pathWidth:m.width,pathHeight:m.height},S=new Set(o);s.updateSlides(w=>w.map((C,T)=>T===n?{...C,elements:[...C.elements.filter(E=>!S.has(E.id)),v]}:C)),s.applySelection(v.id),a.markDirty();}},canMergeShapes:c}}function Tce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,selectedElements:i,elementLookup:s,setSelectedElementIds:a,ops:l,history:c}=t,u=()=>{let v=o;if(v.length<2||!e)return;let S=new Set(v),w=e.elements.filter(k=>S.has(k.id));if(w.length<2)return;let C=1/0,T=1/0,E=-1/0,M=-1/0;for(let k of w)C=Math.min(C,k.x),T=Math.min(T,k.y),E=Math.max(E,k.x+k.width),M=Math.max(M,k.y+k.height);let A=w.map(k=>({...structuredClone(k),x:k.x-C,y:k.y-T})),R={id:xo(),type:"group",x:C,y:T,width:E-C,height:M-T,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:1,rawXml:{},children:A};l.updateSlides(k=>k.map((N,F)=>F===n?{...N,elements:[...N.elements.filter(B=>!S.has(B.id)),R]}:N)),l.applySelection(R.id),c.markDirty();},d=()=>{if(!r||r.type!=="group"||!e)return;let v=r,S=v.children.map(w=>({...structuredClone(w),id:w.id||xo(),x:w.x+v.x,y:w.y+v.y}));l.updateSlides(w=>w.map((C,T)=>T===n?{...C,elements:[...C.elements.filter(E=>E.id!==v.id),...S]}:C)),a(S.map(w=>w.id)),c.markDirty();},p=v=>{if(!r)return;let S=v==="horizontal"?{flipHorizontal:!r.flipHorizontal}:{flipVertical:!r.flipVertical};l.updateSelectedElement(S),c.markDirty();},f=v=>{if(i.length<2)return;let S=i.map(R=>({id:R.id,left:R.x,top:R.y,right:R.x+R.width,bottom:R.y+R.height})),w=Math.min(...S.map(R=>R.left)),C=Math.min(...S.map(R=>R.top)),T=Math.max(...S.map(R=>R.right)),E=Math.max(...S.map(R=>R.bottom)),M=(w+T)/2,A=(C+E)/2;for(let R of S){let k=s.get(R.id);if(!k)continue;let N=k.x,F=k.y;switch(v){case "left":N=w;break;case "center":N=M-k.width/2;break;case "right":N=T-k.width;break;case "top":F=C;break;case "middle":F=A-k.height/2;break;case "bottom":F=E-k.height;break}l.updateElementById(R.id,{x:N,y:F});}c.markDirty();},h=v=>{if(!r||!e)return;let S=e.elements,w=S.findIndex(T=>T.id===r.id);if(w===-1)return;let C=[...S];v==="forward"&&w<S.length-1?[C[w],C[w+1]]=[C[w+1],C[w]]:v==="backward"&&w>0&&([C[w],C[w-1]]=[C[w-1],C[w]]),l.updateSlides(T=>T.map((E,M)=>M===n?{...E,elements:C}:E)),c.markDirty();},m=v=>{if(!r||!e)return;let S=e.elements,w=S.findIndex(M=>M.id===r.id);if(w===-1)return;let C=S[w],T=S.filter((M,A)=>A!==w),E=v==="front"?[...T,C]:[C,...T];l.updateSlides(M=>M.map((A,R)=>R===n?{...A,elements:E}:A)),c.markDirty();},{handleMergeShapes:x,canMergeShapes:y}=Cce({activeSlide:e,activeSlideIndex:n,selectedElements:i,effectiveSelectedIds:o,setSelectedElementIds:a,ops:l,history:c});return {handleGroupElements:u,handleUngroupElement:d,handleFlip:p,handleAlignElements:f,handleMoveLayer:h,handleMoveLayerToEdge:m,handleMergeShapes:x,canMergeShapes:y}}function Mce(t){let{setIsInspectorPaneOpen:e,setSidebarPanelMode:n,onOpenHyperlinkDialog:r}=t,{handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleDelete:l}=vce(t),{handleGroupElements:c,handleUngroupElement:u,handleFlip:d,handleAlignElements:p,handleMoveLayer:f,handleMoveLayerToEdge:h,handleMergeShapes:m,canMergeShapes:x}=Tce(t);return {handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleGroupElements:c,handleUngroupElement:u,handleDelete:l,handleFlip:d,handleAlignElements:p,handleMoveLayer:f,handleMoveLayerToEdge:h,handleMergeShapes:m,canMergeShapes:x,handleContextMenuAction:v=>{switch(v){case "copy":o();break;case "cut":i();break;case "paste":s();break;case "duplicate":a();break;case "delete":l();break;case "bring-forward":case "bringForward":f("forward");break;case "send-backward":case "sendBackward":f("backward");break;case "bring-front":case "bringToFront":h("front");break;case "send-back":case "sendToBack":h("back");break;case "comment":case "addComment":e(true),n("comments");break;case "group":c();break;case "ungroup":u();break;case "editHyperlink":r();break}}}}function _ce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,selectedElementId:o,history:i,setSlides:s,setTemplateElementsBySlideId:a,setSelectedElementId:l,setSelectedElementIds:c,setInlineEditingElementId:u,setContextMenuState:d}=t,p=useCallback((w,C=[])=>{l(w),c(C);},[l,c]),f=useCallback(()=>{p(null,[]),u(null),d(null);},[p,u,d]),h=useCallback((w,C)=>{B7(w)?a(E=>{let M=e?.id;if(!M)return E;let A=E[M]??[];return {...E,[M]:A.map(R=>R.id===w?{...R,...C}:R)}}):s(E=>E.map((M,A)=>A!==n?M:{...M,elements:M.elements.map(R=>R.id===w?{...R,...C}:R)})),i.markDirty();},[e?.id,n,i,s,a]),m=useCallback(w=>{o&&h(o,w);},[o,h]),x=useCallback(w=>{!r||!mn(r)||m({shapeStyle:{...r.shapeStyle,...w}});},[r,m]),y=useCallback(w=>{if(!r||!ot(r))return;let C=Uee(r.textSegments);if(C&&r.textSegments){let{newSegments:M,newSelection:A}=$ee(r.textSegments,C,w);Bee(A),m({textSegments:M});return}let T={...r.textStyle,...w},E=r.textSegments?.map(M=>({...M,style:{...M.style,...w}}));m({textStyle:T,textSegments:E});},[r,m]),v=useCallback(w=>{s(C=>w(C));},[s]),S=useCallback(async()=>null,[]);return {applySelection:p,clearSelection:f,updateElementById:h,updateSelectedElement:m,updateSelectedShapeStyle:x,updateSelectedTextStyle:y,updateSlides:v,serializeSlides:S}}function YKe(t,e,n){if(!e)return [];let r=[],o=n?e:e.toLowerCase();return t.forEach((i,s)=>{for(let a of i.elements||[]){if(!ot(a))continue;(a.textSegments??[]).forEach((c,u)=>{let d=n?c.text:(c.text||"").toLowerCase(),p=0;for(;p<d.length;){let f=d.indexOf(o,p);if(f===-1)break;r.push({slideIndex:s,elementId:a.id,segmentIndex:u,startOffset:f,length:e.length}),p=f+1;}});}}),r}function qKe(t,e,n){if(e.length===0)return t;let r=[...t],o=new Map;for(let i of e){let s=`${i.slideIndex}::${i.elementId}::${i.segmentIndex}`;o.has(s)||o.set(s,[]),o.get(s).push(i);}for(let[,i]of o){let s=[...i].sort((a,l)=>l.startOffset-a.startOffset);for(let a of s){let l=r[a.slideIndex];if(!l)continue;let c=(l.elements||[]).findIndex(x=>x.id===a.elementId);if(c===-1)continue;let u=l.elements[c];if(!ot(u))continue;let d=[...u.textSegments??[]],p=d[a.segmentIndex];if(!p)continue;let f=p.text.slice(0,a.startOffset),h=p.text.slice(a.startOffset+a.length);d[a.segmentIndex]={...p,text:f+n+h};let m=[...l.elements];m[c]={...u,text:d.map(x=>x.text).join(""),textSegments:d},r[a.slideIndex]={...l,elements:m};}}return r}function Ece({slides:t,mode:e,onSetActiveSlideIndex:n,onSetSelectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState(false),[l,c]=useState(""),[u,d]=useState(""),[p,f]=useState(false),[h,m]=useState([]),[x,y]=useState(-1),v=useCallback(()=>{let E=YKe(t,l,p);if(!l){m([]),y(-1);return}m(E),y(E.length>0?0:-1),E.length>0&&(n(E[0].slideIndex),r(E[0].elementId));},[t,l,p,n,r]),S=useCallback(E=>{if(h.length===0)return;let M=(x+E+h.length)%h.length;y(M);let A=h[M];A&&(n(A.slideIndex),r(A.elementId));},[h,x,n,r]),w=useCallback(E=>{E.length!==0&&(o(M=>qKe(M,E,u)),i());},[u,o,i]),C=useCallback(()=>{h.length===0||x<0||(w([h[x]]),setTimeout(v,0));},[h,x,w,v]),T=useCallback(()=>{h.length!==0&&(w(h),setTimeout(v,0));},[h,w,v]);return useEffect(()=>{let E=M=>{if((M.metaKey||M.ctrlKey)&&M.key==="f"){if(e!=="edit")return;M.preventDefault(),a(A=>!A);}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e]),{findReplaceOpen:s,setFindReplaceOpen:a,findQuery:l,setFindQuery:c,replaceQuery:u,setReplaceQuery:d,findMatchCase:p,setFindMatchCase:f,findResults:h,findResultIndex:x,performFind:v,navigateFindResult:S,handleReplace:C,handleReplaceAll:T}}function Ace(t){let{activeSlide:e,canvasSize:n,addElement:r}=t;return {handleImageFileChange:s=>{let a=s.target.files?.[0];if(!a||!e)return;s.target.value="";let l=new FileReader;l.onload=()=>{let c=l.result;if(!c)return;let u=new Image;u.onload=()=>{let f=u.naturalWidth||400,h=u.naturalHeight||300;if(f>500||h>400){let m=Math.min(500/f,400/h);f=Math.round(f*m),h=Math.round(h*m);}r({id:xo(),type:"image",x:Math.round((n.width-f)/2),y:Math.round((n.height-h)/2),width:f,height:h,imageData:c});},u.onerror=()=>{r({id:xo(),type:"image",x:100,y:100,width:400,height:300,imageData:c});},u.src=c;},l.readAsDataURL(a);},handleMediaFileChange:s=>{let a=s.target.files?.[0];if(!a||!e)return;s.target.value="";let l=a.type.startsWith("audio/")?"audio":a.type.startsWith("video/")?"video":null;if(!l)return;let c=a.path,u=(p,f,h)=>{r({id:xo(),type:"media",mediaType:l,mediaMimeType:a.type||void 0,mediaData:p,x:Math.round((n.width-f)/2),y:Math.round((n.height-h)/2),width:f,height:h});};if(c){let p=c.replace(/\\/g,"/");p.startsWith("/")||(p=`/${p}`);let f=`pptx-resource://media${encodeURI(p)}`;if(l==="audio"){u(f,420,64);return}let h=URL.createObjectURL(a),m=document.createElement("video");m.preload="metadata",m.onloadedmetadata=()=>{URL.revokeObjectURL(h);let x=640,y=360,v=m.videoWidth||x,S=m.videoHeight||y;if(v>x||S>y){let w=Math.min(x/v,y/S);v=Math.round(v*w),S=Math.round(S*w);}u(f,v,S);},m.onerror=()=>{URL.revokeObjectURL(h),u(f,640,360);},m.src=h;return}let d=new FileReader;d.onload=()=>{let p=d.result;if(!p)return;if(l==="audio"){u(p,420,64);return}let f=document.createElement("video");f.preload="metadata",f.onloadedmetadata=()=>{let x=f.videoWidth||640,y=f.videoHeight||360;if(x>640||y>360){let v=Math.min(640/x,360/y);x=Math.round(x*v),y=Math.round(y*v);}u(p,x,y);},f.onerror=()=>{u(p,640,360);},f.src=p;},d.readAsDataURL(a);}}}function Pce(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,ops:o,history:i,addElement:s}=t;return {handleInsertSmartArt:(p,f)=>{if(!e)return;let h=f.map((x,y)=>`node-${Date.now()}-${y}-${Math.random().toString(36).slice(2,8)}`),m=f.map((x,y)=>{let v={id:h[y],text:x};return p==="hierarchy"&&y>0&&(v.parentId=h[0]),v});s({id:xo(),type:"smartArt",x:100,y:120,width:600,height:340,smartArtData:{layout:p,colorScheme:"colorful1",style:"flat",nodes:m}});},handleInsertEquation:p=>{e&&s({id:xo(),type:"shape",x:120,y:200,width:400,height:80,text:"[Equation]",textStyle:{fontSize:18,fontFamily:"Cambria Math"},textSegments:[{text:"[Equation]",style:{fontSize:18,fontFamily:"Cambria Math"},equationXml:p}]});},handleHyperlinkConfirm:p=>{let f=r[0];if(!f)return;let h=rle(p),m={url:h.url||void 0,action:h.action,tooltip:h.tooltip};o.updateElementById(f.id,{actionClick:m}),i.markDirty();},handleInsertField:(p,f)=>{if(!e)return;let h={slidenum:String(n+1),datetime:new Date().toLocaleDateString(),header:"Header",footer:"Footer"},m=f||h[p]||p,x=`{${crypto.randomUUID().toUpperCase()}}`;s({id:xo(),type:"shape",x:120,y:200,width:200,height:40,text:m,textStyle:{fontSize:14},textSegments:[{text:m,style:{fontSize:14},fieldType:p,fieldGuid:x}]});},handleAddActionButton:p=>{if(!e)return;let f=Lm.find(m=>m.shapeType===p);if(!f)return;let h=iE({type:f.defaultAction});h&&(h.tooltip=f.label,h.highlightClick=true),s({id:xo(),type:"shape",x:150,y:150,width:120,height:50,shapeType:f.shapeType,text:f.label,textStyle:{fontSize:11,fontColor:"#FFFFFF",align:"center",verticalAlign:"middle"},textSegments:[{text:f.label,style:{fontSize:11,fontColor:"#FFFFFF",bold:true}}],shapeStyle:{fillColor:"#4472C4",strokeColor:"#2F5597",strokeWidth:1},actionClick:h});}}}function Rce(t){let{activeSlide:e,activeSlideIndex:n,canvasSize:r,newShapeType:o,selectedElements:i,ops:s,history:a}=t,l=y=>{s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements,y]}:S)),s.applySelection(y.id),a.markDirty();},c=()=>{e&&l({id:xo(),type:"text",x:100,y:100,width:300,height:60,text:"",textStyle:{fontSize:24}});},u=()=>{e&&l({id:xo(),type:"shape",x:150,y:150,width:200,height:150,shapeType:o,shapeStyle:{fillColor:"#3b82f6",strokeColor:"#1f2937",strokeWidth:2}});},d=()=>{if(!e)return;let y=Array.from({length:3},()=>({cells:Array.from({length:3},()=>({text:"",style:{}}))})),v=Array.from({length:3},()=>1/3);l({id:xo(),type:"table",x:100,y:200,width:600,height:250,tableData:{rows:y,columnWidths:v}});},p=Pce({activeSlide:e,activeSlideIndex:n,selectedElements:i,ops:s,history:a,addElement:l}),f=Ace({activeSlide:e,canvasSize:r,addElement:l});return {handleAddTextBox:c,handleAddShape:u,handleAddTable:d,...p,handleAddInkElement:y=>{e&&(s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements,y]}:S)),a.markDirty());},handleAddFreeformShape:y=>{e&&l(y);},handleEraseInkElement:y=>{e&&(s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:S.elements.filter(C=>C.id!==y)}:S)),a.markDirty());},...f}}function ZKe(){let t=()=>Math.floor(Math.random()*65536).toString(16).padStart(4,"0");return `{${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}}`}function kce(t){let{sections:e,setSections:n,slides:r,setSlides:o,markDirty:i}=t,s=useCallback((p,f)=>{let h=ZKe(),x=r[f]?.sectionId,y=[];for(let v=f;v<r.length&&(v===f||r[v].sectionId===x);v++)y.push(v);o(v=>v.map((S,w)=>y.includes(w)?{...S,sectionId:h,sectionName:p}:S)),n(v=>{let S=x?v.findIndex(M=>M.id===x)+1:v.length,w=y.map(M=>{let A=r[M],k=A?.rawXml?.["p:sld"];return String(k?.["@_id"]||A?.slideNumber||M+1)}),C=v.map(M=>M.id===x?{...M,slideIds:M.slideIds.filter(A=>!w.includes(A))}:M),T={id:h,name:p,slideIds:w},E=[...C];return E.splice(S,0,T),E}),i();},[r,o,n,i]),a=useCallback((p,f)=>{n(h=>h.map(m=>m.id===p?{...m,name:f}:m)),o(h=>h.map(m=>m.sectionId===p?{...m,sectionName:f}:m)),i();},[n,o,i]),l=useCallback(p=>{n(m=>{let x=m.findIndex(w=>w.id===p);if(x===-1)return m;let y=m[x],v=x>0?m[x-1]:void 0,S=m.filter(w=>w.id!==p);return v&&y?S.map(w=>w.id===v.id?{...w,slideIds:[...w.slideIds,...y.slideIds]}:w):S});let f=e.findIndex(m=>m.id===p),h=f>0?e[f-1]:void 0;o(m=>m.map(x=>x.sectionId!==p?x:h?{...x,sectionId:h.id,sectionName:h.name}:{...x,sectionId:void 0,sectionName:void 0})),i();},[e,n,o,i]),c=useCallback(p=>{n(f=>{let h=f.findIndex(x=>x.id===p);if(h<=0)return f;let m=[...f];return [m[h-1],m[h]]=[m[h],m[h-1]],m}),i();},[n,i]),u=useCallback(p=>{n(f=>{let h=f.findIndex(x=>x.id===p);if(h===-1||h>=f.length-1)return f;let m=[...f];return [m[h],m[h+1]]=[m[h+1],m[h]],m}),i();},[n,i]),d=useCallback((p,f)=>{let h=e.find(m=>m.id===f);h&&(o(m=>m.map((x,y)=>p.includes(y)?{...x,sectionId:f,sectionName:h.name}:x)),n(m=>{let x=p.map(y=>{let v=r[y],w=v?.rawXml?.["p:sld"];return String(w?.["@_id"]||v?.slideNumber||y+1)});return m.map(y=>y.id===f?{...y,slideIds:[...y.slideIds,...x.filter(v=>!y.slideIds.includes(v))]}:{...y,slideIds:y.slideIds.filter(v=>!x.includes(v))})}),i());},[e,r,o,n,i]);return {addSection:s,renameSection:a,deleteSection:l,moveSectionUp:c,moveSectionDown:u,moveSlidesToSection:d}}function JKe(t,e,n){let r=[...t],o=Math.max(0,Math.min(e+1,r.length));return r.splice(o,0,n),r}function Ice(t){let{slides:e,activeSlideIndex:n,setActiveSlideIndex:r,ops:o,history:i,handlerRef:s}=t;return {handleAddSlide:()=>{let h={id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,rId:"",slideNumber:e.length+1,elements:[]};o.updateSlides(m=>{let x=[...m];return x.splice(n+1,0,h),x}),r(n+1),i.markDirty();},handleMoveSlide:(h,m)=>{h!==m&&(o.updateSlides(x=>{let y=[...x],[v]=y.splice(h,1);return y.splice(m,0,v),y}),r(m),i.markDirty());},handleSlideContextMenu:(h,m)=>{},handleDeleteSlides:h=>{if(h.length===0||e.length<=1)return;let m=[...h].sort((y,v)=>v-y);o.updateSlides(y=>{let v=[...y];for(let S of m)v.length>1&&v.splice(S,1);return v});let x=Math.min(...h);r(Math.min(x,e.length-h.length-1,Math.max(e.length-h.length-1,0))),i.markDirty();},handleDuplicateSlides:h=>{if(h.length===0)return;let m=[...h].sort((x,y)=>x-y);o.updateSlides(x=>{let y=[...x],v=0;for(let S of m){let w=y[S+v];if(!w)continue;let C={...w,id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,elements:w.elements.map(T=>({...T,id:`${T.id}-dup-${Math.random().toString(36).slice(2,6)}`}))};y.splice(S+v+1,0,C),v++;}return y}),i.markDirty();},handleToggleHideSlides:h=>{h.length!==0&&(o.updateSlides(m=>{let x=[...m];for(let y of h){let v=x[y];v&&(x[y]={...v,hidden:!v.hidden});}return x}),i.markDirty());},handleInsertSlideFromLayout:(h,m)=>{let x=n+1,y={id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,rId:"",slideNumber:e.length+1,elements:[],layoutPath:h,...m?{layoutName:m}:{}},v=[];o.updateSlides(w=>(v=JKe(w,n,y),v)),r(x),i.markDirty();let S=s?.current;S&&S.applyLayoutToSlide(x,h,v).then(w=>{o.updateSlides(C=>{if(C[x]?.id!==y.id)return C;let T=[...C];return T[x]=w,T});},()=>{});}}}function Nce(t){let{selectedElement:e,tableEditorState:n,setTableEditorState:r,ops:o,history:i}=t;return {handleMergeCellRight:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:u,columnIndex:d}=n,p=e.tableData,f=p.rows[u]?.cells[d];if(!f)return;let h=Math.max(1,f.gridSpan??1),m=d+h,x=p.rows[u]?.cells[m];if(!x||x.hMerge||x.vMerge)return;let y=O1([{row:u,col:d},{row:u,col:m}],p),v={tableData:y},S=iy(e,y);S&&(v.rawXml=S),o.updateSelectedElement(v),i.markDirty();},handleMergeCellDown:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:u,columnIndex:d}=n,p=e.tableData,f=p.rows[u]?.cells[d];if(!f)return;let h=Math.max(1,f.rowSpan??1),m=u+h;if(m>=p.rows.length)return;let x=p.rows[m]?.cells[d];if(!x||x.hMerge||x.vMerge)return;let y=O1([{row:u,col:d},{row:m,col:d}],p),v={tableData:y},S=iy(e,y);S&&(v.rawXml=S),o.updateSelectedElement(v),i.markDirty();},handleMergeSelectedCells:()=>{if(!e||e.type!=="table"||!e.tableData||!n||!n.selectedCells||n.selectedCells.length<2)return;let u=e.tableData,d=O1(n.selectedCells,u),p={tableData:d},f=iy(e,d);f&&(p.rawXml=f),o.updateSelectedElement(p),r({rowIndex:n.rowIndex,columnIndex:n.columnIndex}),i.markDirty();},handleSplitCell:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:u,columnIndex:d}=n,p=e.tableData,f=JF(u,d,p),h={tableData:f},m=iy(e,f);m&&(h.rawXml=m),o.updateSelectedElement(h),i.markDirty();}}}function Dce(){return {text:"",style:{}}}function Lce(t){let{selectedElement:e,tableEditorState:n,elementLookup:r,setTableEditorState:o,ops:i,history:s}=t;return {handleCommitCellEdit:(m,x,y,v)=>{let S=r.get(m);if(!S||S.type!=="table")return;let w={};if(S.tableData){let C=S.tableData.rows.map((T,E)=>E!==x?T:{...T,cells:T.cells.map((M,A)=>A!==y?M:{...M,text:v})});w.tableData={...S.tableData,rows:C};}if(S.rawXml){let C=KF(S,x,y,v);C&&(w.rawXml=C);}Object.keys(w).length!==0&&(i.updateElementById(m,w),s.markDirty(),o({rowIndex:x,columnIndex:y,elementId:m}));},handleUpdateCellTextStyle:m=>{if(!e||e.type!=="table"||!n)return;let x=e.id,{rowIndex:y,columnIndex:v}=n,S={};if(e.rawXml){let w=ZF(e,y,v,m);w&&(S.rawXml=w);}if(e.tableData){let w=e.tableData.rows.map((C,T)=>T!==y?C:{...C,cells:C.cells.map((E,M)=>M!==v?E:{...E,style:{...E.style,...m}})});S.tableData={...e.tableData,rows:w};}Object.keys(S).length!==0&&(i.updateElementById(x,S),s.markDirty());},handleResizeTableColumns:(m,x)=>{let y=r.get(m);!y||y.type!=="table"||!y.tableData||(i.updateElementById(m,{tableData:{...y.tableData,columnWidths:x}}),s.markDirty());},handleResizeTableRow:(m,x,y)=>{let v=r.get(m);if(!v||v.type!=="table"||!v.tableData)return;let S=v.tableData.rows.map((w,C)=>C===x?{...w,height:y}:w);i.updateElementById(m,{tableData:{...v.tableData,rows:S}}),s.markDirty();},handleInsertTableRow:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=n?.rowIndex??0,y=m==="above"?x:x+1,v=e.tableData,S=v.columnWidths.length,w=[];for(let R=0;R<S;R++){let k=false;for(let N=0;N<y;N++){let F=v.rows[N]?.cells[R];if(!F)continue;let B=Math.max(1,F.rowSpan??1);if(B>1&&N+B>y&&!F.vMerge&&!F.hMerge){k=true;break}}k?w.push({text:"",vMerge:true}):w.push(Dce());}let T=[...v.rows.map((R,k)=>{if(k>=y)return R;let N=false,F=R.cells.map(B=>{let D=Math.max(1,B.rowSpan??1);return D>1&&k+D>y&&!B.vMerge&&!B.hMerge?(N=true,{...B,rowSpan:D+1}):B});return N?{...R,cells:F}:R})];T.splice(y,0,{cells:w,height:40});let E={...v,rows:T},M={tableData:E},A=sy(e,E);A&&(M.rawXml=A),i.updateSelectedElement(M),s.markDirty();},handleDeleteTableRow:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData;if(m.rows.length<=1)return;let x=n?.rowIndex??0;if(x<0||x>=m.rows.length)return;let y=m.rows[x],v=[...m.rows],S=(M,A,R)=>M.map((k,N)=>N===A?{...k,rowSpan:R}:k);for(let M=0;M<y.cells.length;M++){let A=y.cells[M];if(A.vMerge)for(let R=x-1;R>=0;R--){let k=v[R]?.cells[M];if(!k)break;if(!k.vMerge){let N=Math.max(1,k.rowSpan??1);N>1&&(v[R]={...v[R],cells:S(v[R].cells,M,N-1>1?N-1:void 0)});break}}else {let R=Math.max(1,A.rowSpan??1);if(R>1){let k=x+1;k<v.length&&(v[k]={...v[k],cells:v[k].cells.map((N,F)=>{if(F!==M)return N;let B=R-1;return {...N,text:A.text||N.text,style:N.style||A.style,rowSpan:B>1?B:void 0,vMerge:void 0,gridSpan:A.gridSpan}})});}}}let w=v.filter((M,A)=>A!==x),C={...m,rows:w},T={tableData:C},E=sy(e,C);E&&(T.rawXml=E),i.updateSelectedElement(T),s.markDirty();},handleInsertTableColumn:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=e.tableData,y=n?.columnIndex??0,v=m==="left"?y:y+1,S=[...x.columnWidths],w=v<S.length?v:S.length-1,T=(S[w]??1/S.length)/2;S[w]=T,S.splice(v,0,T);let E=S.reduce((B,D)=>B+D,0),M=E>0?S.map(B=>B/E):S,R=x.rows.map(B=>{let D=false;for(let H=0;H<v&&H<B.cells.length;H++){let j=B.cells[H];if(!j)continue;let Z=Math.max(1,j.gridSpan??1);if(Z>1&&H+Z>v&&!j.hMerge){D=true;break}}let O=[...B.cells],U=D?{text:"",hMerge:true}:Dce();return O.splice(v,0,U),{...B,cells:O}}).map(B=>{let D=false,O=B.cells.map((U,H)=>{if(H>=v)return U;let j=Math.max(1,U.gridSpan??1);return j>1&&H+j>v&&!U.hMerge&&!U.vMerge?(D=true,{...U,gridSpan:j+1}):U});return D?{...B,cells:O}:B}),k={...x,rows:R,columnWidths:M},N={tableData:k},F=sy(e,k);F&&(N.rawXml=F),i.updateSelectedElement(N),s.markDirty();},handleDeleteTableColumn:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData;if(m.columnWidths.length<=1)return;let x=n?.columnIndex??0;if(x<0||x>=m.columnWidths.length)return;let y=m.rows.map(M=>{let A=[...M.cells],R=A[x];if(R)if(R.hMerge)for(let k=x-1;k>=0;k--){let N=A[k];if(!N)break;if(!N.hMerge){let F=Math.max(1,N.gridSpan??1);F>1&&(A[k]={...N,gridSpan:F-1>1?F-1:void 0});break}}else {let k=Math.max(1,R.gridSpan??1);if(k>1){let N=x+1;if(N<A.length){let F=A[N];A[N]={...F,text:R.text||F.text,style:F.style||R.style,gridSpan:k-1>1?k-1:void 0,hMerge:void 0,rowSpan:R.rowSpan};}}}return {...M,cells:A.filter((k,N)=>N!==x)}}),v=m.columnWidths.filter((M,A)=>A!==x),S=v.reduce((M,A)=>M+A,0),w=S>0?v.map(M=>M/S):v,C={...m,rows:y,columnWidths:w},T={tableData:C},E=sy(e,C);E&&(T.rawXml=E),i.updateSelectedElement(T),s.markDirty();}}}function Fce(t){let e=Lce(t),n=Nce(t);return {...e,...n}}function $ce(t){let{state:e,history:n,zoom:r,mode:o,canEdit:i,slides:s,activeSlide:a,activeSlideIndex:l,selectedElement:c,selectedElementId:u,selectedElementIds:d,canvasSize:p,dialogs:f,presentation:h,userName:m,handlerRef:x}=t,y=_ce({activeSlide:a,activeSlideIndex:l,selectedElement:c,selectedElementId:u,templateElementsBySlideId:e.templateElementsBySlideId,history:n,setSlides:e.setSlides,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setSelectedElementId:e.setSelectedElementId,setSelectedElementIds:e.setSelectedElementIds,setInlineEditingElementId:e.setInlineEditingElementId,setContextMenuState:e.setContextMenuState}),v=kce({sections:e.sections,setSections:e.setSections,slides:s,setSlides:e.setSlides,markDirty:n.markDirty}),S=Ece({slides:s,mode:o,onSetActiveSlideIndex:e.setActiveSlideIndex,onSetSelectedElementId:e.setSelectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),w=bce({slides:s,canEdit:i,userName:m,selectedElementId:e.selectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),C=fce({mode:o,canEdit:i,canvasSize:p,selectedElementId:u,selectedElementIds:d,selectedElementIdSet:e.selectedElementIdSet,inlineEditingElementId:e.inlineEditingElementId,effectiveSelectedIds:e.effectiveSelectedIds,elementLookup:e.elementLookup,activeTool:e.activeTool,editTemplateMode:e.editTemplateMode,editorScale:r.editorScale,canvasStageRef:r.canvasStageRef,dragStateRef:e.dragStateRef,resizeStateRef:e.resizeStateRef,shapeAdjustmentDragStateRef:e.shapeAdjustmentDragStateRef,marqueeStateRef:e.marqueeStateRef,setInlineEditingElementId:e.setInlineEditingElementId,setInlineEditingText:e.setInlineEditingText,setContextMenuState:e.setContextMenuState,setMarqueeSelectionState:e.setMarqueeSelectionState,setSnapLines:e.setSnapLines,inlineEditingText:e.inlineEditingText,ops:y,history:n,presentationHandleAction:h.handlePresentationAction,setEditingEquationOmml:f.setEditingEquationOmml,setIsEquationDialogOpen:f.setIsEquationDialogOpen}),T=Rce({activeSlide:a,activeSlideIndex:l,canvasSize:p,newShapeType:e.newShapeType,selectedElements:e.selectedElements,ops:y,history:n}),E=Mce({activeSlide:a,activeSlideIndex:l,selectedElement:c,effectiveSelectedIds:e.effectiveSelectedIds,selectedElements:e.selectedElements,selectedElementIdSet:e.selectedElementIdSet,elementLookup:e.elementLookup,editTemplateMode:e.editTemplateMode,clipboardPayload:e.clipboardPayload,setClipboardPayload:e.setClipboardPayload,setSelectedElementIds:e.setSelectedElementIds,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setIsInspectorPaneOpen:e.setIsInspectorPaneOpen,setSidebarPanelMode:e.setSidebarPanelMode,ops:y,history:n,onOpenHyperlinkDialog:()=>f.setIsHyperlinkDialogOpen(true)}),M=Ice({slides:s,activeSlideIndex:l,setActiveSlideIndex:e.setActiveSlideIndex,ops:y,history:n,handlerRef:x}),A=Fce({selectedElement:c,elementLookup:e.elementLookup,tableEditorState:e.tableEditorState,setTableEditorState:e.setTableEditorState,ops:y,history:n}),R=useCallback(H=>{if(c?.type==="table"&&e.tableEditorState){A.handleUpdateCellTextStyle(H);return}y.updateSelectedTextStyle(H);},[c,e.tableEditorState,A,y]),k=useMemo(()=>({...y,updateSelectedTextStyle:R}),[y,R]),N=useRef(null),F=useRef(false),{formatPainterActive:B,setFormatPainterActive:D,elementLookup:O}=e;useEffect(()=>{B&&!F.current&&c?N.current=HQ(c):B||(N.current=null),F.current=B;},[B,c]),useEffect(()=>{if(!B)return;let H=j=>{j.key==="Escape"&&D(false);};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[B,D]);let U=useMemo(()=>({...C,handleElementClick:(H,j)=>{if(B&&N.current){j.stopPropagation();let Z=O.get(H);if(Z){let J=zQ(Z,N.current),W={};mn(J)&&(W.shapeStyle=J.shapeStyle),ot(J)&&(W.textStyle=J.textStyle),y.updateElementById(H,W);}N.current=null,D(false),y.applySelection(H);return}C.handleElementClick(H,j);},handleCanvasMouseDown:H=>{if(B){D(false);return}C.handleCanvasMouseDown(H);}}),[C,y,B,D,O]);return {ops:k,sectionOps:v,findReplace:S,comments:w,canvasHandlers:U,insertHandlers:T,manipulation:E,slideOps:M,tableOps:A}}function kN(){}var eZe=2.5,tZe=14,nZe=.4,zce=16,Gce=0;function rZe(){return Gce+=1,`stroke-${Gce}`}function Vce(t){let{isActive:e,activeSlideIndex:n}=t,[r,o]=useState("none"),[i,s]=useState("#ff0000"),[a,l]=useState("#ffff00"),[c,u]=useState(null),[d,p]=useState(null),[f,h]=useState(false),m=useRef(new Map),[x,y]=useState([]),[v,S]=useState(0),w=useRef(false),C=useRef(n);C.current=n;let T=useRef(n);useEffect(()=>{e&&T.current!==n&&(y(j=>(j.length>0?m.current.set(T.current,j):m.current.delete(T.current),S(Z=>Z+1),m.current.get(n)??[])),T.current=n);},[e,n]);let E=useCallback(j=>{e&&o(Z=>Z===j?"none":j);},[e]),M=useCallback((j,Z)=>{if(e&&(r==="pen"||r==="highlighter")){w.current=true;let J=r==="pen";u({id:rZe(),points:[{x:j,y:Z}],color:J?i:a,width:J?eZe:tZe,opacity:J?1:nZe});}},[e,r,i,a]),A=useCallback((j,Z)=>{!e||!w.current||u(J=>J?{...J,points:[...J.points,{x:j,y:Z}]}:null);},[e]),R=useCallback(()=>{w.current&&(w.current=false,u(j=>(j&&j.points.length>1&&y(Z=>{if(Z.some(W=>W.id===j.id))return Z;let J=[...Z,j];return m.current.set(C.current,J),S(W=>W+1),J}),null)));},[]),k=useCallback((j,Z)=>{!e||r!=="laser"||p({x:j,y:Z});},[e,r]),N=useCallback(()=>{p(null);},[]),F=useCallback((j,Z)=>{!e||r!=="eraser"||y(J=>{let W=J.filter(te=>!te.points.some(se=>{let Ce=se.x-j,ee=se.y-Z;return Ce*Ce+ee*ee<zce*zce}));return W.length>0?m.current.set(C.current,W):m.current.delete(C.current),S(te=>te+1),W});},[e,r]),B=useCallback(()=>{y([]),u(null),w.current=false,m.current.delete(C.current),S(j=>j+1);},[]),D=useCallback(()=>{y([]),u(null),w.current=false,m.current.clear(),S(j=>j+1);},[]),O=useRef(0);useEffect(()=>{if(!e){h(false),o("none"),u(null),p(null);return}let j=()=>{h(true),window.clearTimeout(O.current),O.current=window.setTimeout(()=>{h(false);},3e3);};return window.addEventListener("mousemove",j),()=>{window.removeEventListener("mousemove",j),window.clearTimeout(O.current);}},[e]);let U=useCallback(()=>{let j=new Map(m.current);return x.length>0&&j.set(n,x),j},[x,n]),H=v>=0&&(x.length>0||m.current.size>0);return {presentationTool:r,setPresentationTool:E,penColor:i,setPenColor:s,highlighterColor:a,setHighlighterColor:l,annotationStrokes:x,currentStroke:c,laserPosition:d,toolbarVisible:f,setToolbarVisible:h,handlePointerDown:M,handlePointerMove:A,handlePointerUp:R,handleLaserMove:k,handleLaserLeave:N,clearAnnotations:B,eraseAtPoint:F,allSlideAnnotations:U(),hasAnyAnnotations:H,clearAllAnnotations:D}}function jce(t){return !!t.loopContinuously||t.showType==="kiosk"}function Xce(t,e){return t.map((n,r)=>{let o=e[r];return typeof o!="number"?n:{...n,transition:{...n.transition,type:n.transition?.type??"none",advanceAfterMs:o}}})}function Wce(t,e){return Math.max(0,t||0)+e*60}function iS(t,e,n,r){for(let o of t.steps)o.stopSound?kN():o.soundPath&&e&&e(o.soundPath);n(o=>{let i=new Map(o);for(let s of t.steps){let a=i.get(s.elementId)??{visible:true},l=s.presetClass==="exit"?a.visible:true;i.set(s.elementId,{visible:l,cssAnimation:s.cssAnimation});}return i});for(let o of t.steps){let i=window.setTimeout(()=>{n(s=>{let a=new Map(s),l=a.get(o.elementId)??{visible:true},c=o.presetClass==="exit"?false:l.visible;return a.set(o.elementId,{visible:c,cssAnimation:void 0}),a});},Math.max(0,o.delayMs+o.durationMs+8));r.current.push(i);}}function qce(t){let{slides:e,onPlayActionSound:n,showWithAnimation:r}=t,o=r!==false,[i,s]=useState([]),[a,l]=useState(new Map),[c,u]=useState(""),[d,p]=useState(new Set),[f,h]=useState(new Set),m=useRef([]),x=useRef(null),y=useCallback(()=>{m.current.forEach(A=>{window.clearTimeout(A);}),m.current=[];},[]),v=useCallback(A=>{if(!A.shouldAutoAdvance())return;let R=A.getAutoAdvanceDelay(),k=A.peekNext();if(!k)return;let N=R+(k.autoAdvanceDelayMs??0),F=window.setTimeout(()=>{let B=A.advance();B&&(iS(B,n,l,m),v(A));},Math.max(0,N));m.current.push(F);},[n]),S=useCallback(A=>{let R=e[A];if(!R){x.current=null,l(new Map),u(""),p(new Set),h(new Set);return}let k=R.nativeAnimations??[],N=new Map;for(let O of k)if(O.buildType&&O.buildType!=="allAtOnce"&&O.targetId){let U=R.elements.find(H=>H.id===O.targetId);U&&ot(U)&&U.textSegments&&U.textSegments.length>0&&N.set(O.targetId,hF(U.textSegments));}let F=N.size>0?mF(k,N):k,B=C1.fromAnimations(F);x.current=B,u(B.getTimeline().keyframesCss),p(B.getInteractiveTriggerShapeIds()),h(B.getHoverTriggerShapeIds());let D=R.elements.map(O=>O.id);for(let O of F)O.targetId&&O.targetId.includes(_l)&&D.push(O.targetId);l(B.getElementStates(D));},[e]),w=useCallback(()=>{if(!o)return false;let A=x.current;if(!A||!A.hasMoreSteps())return false;let R=A.advance();return R?(iS(R,n,l,m),v(A),true):false},[o,n,v]),C=useCallback(A=>{let R=x.current;if(!R||!R.hasInteractiveSequence(A))return false;let k=R.advanceInteractive(A);return k?(iS(k,n,l,m),true):false},[n]),T=useCallback(A=>{if(!o)return false;let R=x.current;if(!R||!R.hasHoverSequence(A))return false;R.resetHover(A);let k=R.advanceHover(A);return k?(iS(k,n,l,m),true):false},[o,n]),E=useCallback(A=>{let R=x.current;!R||!R.hasHoverSequence(A)||R.resetHover(A);},[]),M=useCallback(A=>{if(y(),!o){x.current=null,s([]),l(new Map),u(""),p(new Set),h(new Set);return}S(A);let R=e[A];if(!R){s([]);return}let k=x.current;if(k&&k.hasMoreSteps()){let F=k.peekNext();if(F&&F.autoAdvance){let B=window.setTimeout(()=>{let D=k.advance();D&&(iS(D,n,l,m),v(k));},F.autoAdvanceDelayMs??0);m.current.push(B);}}let N=[...R.animations||[]].filter(F=>!!F.entrance).sort((F,B)=>(F.order||Number.MAX_SAFE_INTEGER)-(B.order||Number.MAX_SAFE_INTEGER));if(N.length===0){s([]);return}s(N.map(F=>({elementId:F.elementId,state:"hidden",animation:F}))),N.forEach((F,B)=>{let D=Wce(F.delayMs,B),O=window.setTimeout(()=>{s(U=>U.map(H=>H.elementId===F.elementId?{...H,state:"visible"}:H));},D);m.current.push(O);});},[o,y,S,e,n,v]);return {presentationAnimations:i,presentationElementStates:a,presentationKeyframesCss:c,interactiveTriggerShapeIds:d,hoverTriggerShapeIds:f,clearPresentationTimers:y,playNextAnimationGroup:w,handleInteractiveShapeClick:C,handleHoverStart:T,handleHoverEnd:E,runPresentationEntranceAnimations:M,presentationTimersRef:m}}var oZe="pptx-viewer-audience";var sS="content",Kce="pptx-bytes";function Zce(){return new Promise((t,e)=>{let n=indexedDB.open(oZe,1);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(sS)||r.createObjectStore(sS);},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function Jce(t){let e=await Zce();return new Promise((n,r)=>{let o=e.transaction(sS,"readwrite"),i=o.objectStore(sS),a={bytes:t instanceof Uint8Array?t:new Uint8Array(t),createdAt:Date.now()};i.put(a,Kce),o.oncomplete=()=>{e.close(),n();},o.onerror=()=>{e.close(),r(o.error);};})}async function _M(){try{let t=await Zce();return new Promise(e=>{let n=t.transaction(sS,"readwrite");n.objectStore(sS).delete(Kce),n.oncomplete=()=>{t.close(),e();},n.onerror=()=>{t.close(),e();};})}catch{}}var KH="pptx-viewer-presenter",DN="#pptx-audience",LN="pptx-viewer-presenter",Qce="nonce";function iZe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function eue(){let t=window.location.hash;if(!t.startsWith(DN))return null;let e=t.slice(DN.length);return e?new URLSearchParams(e.replace(/^[&;?]/,"")).get(Qce):null}function ZH(){return window.location.hash.startsWith(DN)}function tue(t){let{currentSlideIndex:e,isPresenterMode:n,content:r}=t,o=useRef(null),i=useRef(null),s=useRef(null),a=useRef(""),l=useCallback(()=>(i.current||(i.current=new BroadcastChannel(KH)),i.current),[]),c=useCallback(()=>o.current!==null&&!o.current.closed,[]),u=useCallback(f=>{if(!a.current)return;let h={origin:LN,type:"presenter-slide-change",slideIndex:f,sessionId:a.current};try{l().postMessage(h);}catch{}},[l]),d=useCallback(()=>{if(a.current)try{let h={origin:LN,type:"presenter-exit",sessionId:a.current};l().postMessage(h);}catch{}let f=o.current;if(f&&!f.closed)try{f.close();}catch{}o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null),_M();},[l]),p=useCallback(()=>{c()&&d();let f=window.open("about:blank","_blank");if(!f)return false;o.current=f;let h=iZe();a.current=h;let m=new URL(window.location.href),x=new URLSearchParams;x.set(Qce,h),m.hash=`${DN}&${x.toString()}`;let y=v=>{let S=o.current;if(!(!S||S.closed)){if(!v){try{S.close();}catch{}o.current=null,a.current="";return}try{S.location.replace(m.toString());}catch{try{S.close();}catch{}o.current=null,a.current="";}}};return r?Jce(r).then(()=>y(true)).catch(()=>y(false)):y(true),window.setTimeout(()=>u(e),1500),s.current=setInterval(()=>{let v=o.current;(!v||v.closed)&&(o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null));},1e3),true},[c,d,u,e,r]);return useEffect(()=>{n&&c()&&u(e);},[e,n,c,u]),useEffect(()=>()=>{d();try{i.current?.close();}catch{}},[d]),useEffect(()=>{n||d();},[n,d]),useEffect(()=>{let f=()=>{_M();};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[]),{openAudienceWindow:p,closeAudienceWindow:d,isAudienceWindowOpen:c,syncSlideToAudience:u}}function rue(t){let{onSetMode:n,onSetActiveSlideIndex:r,containerRef:o}=t,i=useRef(false);useEffect(()=>{if(!ZH()||i.current)return;i.current=true;let s=window.setTimeout(()=>{try{let a=o.current;a&&typeof a.requestFullscreen=="function"&&a.requestFullscreen().catch(()=>{});}catch{}n("present");},800);return ()=>window.clearTimeout(s)},[o,n]),useEffect(()=>{if(!ZH())return;let s=eue(),a;try{a=new BroadcastChannel(KH);}catch{return}return a.onmessage=l=>{let c=l.data;if(!(!c||c.origin!==LN)&&!(s&&c.sessionId!==s)&&(c.type==="presenter-slide-change"&&r(c.slideIndex),c.type==="presenter-exit")){_M(),n("edit");try{window.close();}catch{}}},()=>{try{a.close();}catch{}}},[n,r]);}function oue(t,e){return t==="Escape"?{action:"exit"}:t==="ArrowRight"||t==="PageDown"||t===" "?{action:"next"}:t==="ArrowLeft"||t==="PageUp"?{action:"prev"}:t==="l"||t==="L"?{action:"toggleLaser"}:t==="p"||t==="P"?{action:"togglePen"}:t==="e"||t==="E"?{action:"toggleEraser"}:t==="m"&&e?{action:"toggleToolbar"}:t==="n"||t==="N"?{action:"togglePresenterView"}:{action:"none"}}function iue(t){let{mode:e,movePresentationSlide:n,onSetMode:r,onToggleLaser:o,onTogglePen:i,onToggleEraser:s,onToggleToolbar:a,onTogglePresenterView:l,rehearsing:c,recordCurrentSlideTime:u,presentationSlideIndex:d,setShowRehearsalSummary:p}=t;useEffect(()=>{if(e!=="present")return;let f=h=>{let m=oue(h.key,h.ctrlKey);if(m.action!=="none")switch(h.preventDefault(),m.action){case "exit":c&&(u(d),p(true)),r("edit");return;case "next":n(1);return;case "prev":n(-1);return;case "toggleLaser":o?.();return;case "togglePen":i?.();return;case "toggleEraser":s?.();return;case "toggleToolbar":a?.();return;case "togglePresenterView":l?.();break}};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[e,n,r,o,i,s,a,l,c,u,d,p]);}function aue(t){let{containerRef:e,onSetMode:n,onSaveRehearsalTimings:r,setPresentationStartTime:o,setPresenterMode:i}=t,[s,a]=useState(false),[l,c]=useState({}),[u,d]=useState(null),[p,f]=useState(false),[h,m]=useState(false),x=useRef(0),y=useRef(null),v=useCallback(E=>{if(u===null)return;let M=x.current;y.current!==null&&(M+=Date.now()-y.current);let A=Date.now()-u-M;c(R=>({...R,[E]:Math.max(0,A)})),x.current=0,y.current=h?Date.now():null,d(Date.now());},[u,h]),S=useCallback(()=>{f(false),a(false),c({});},[]),w=useCallback(()=>{r?.(l),f(false),a(false);},[r,l]),C=useCallback(()=>{i(false),a(true),c({}),m(false),f(false),x.current=0,y.current=null;let E=Date.now();o(E),d(E);try{let M=e.current;M&&typeof M.requestFullscreen=="function"&&M.requestFullscreen().catch(()=>{});}catch{}n("present");},[e,n,o,i]),T=useCallback(()=>{m(E=>(E?y.current!==null&&(x.current+=Date.now()-y.current,y.current=null):y.current=Date.now(),!E));},[]);return {rehearsing:s,setRehearsing:a,recordedTimings:l,slideStartTime:u,showRehearsalSummary:p,setShowRehearsalSummary:f,rehearsalPaused:h,recordCurrentSlideTime:v,dismissRehearsalSummary:S,saveRehearsalTimings:w,enterRehearsalMode:C,toggleRehearsalPause:T}}function lue(t,e){let n=t.action||"";if(t.soundPath&&e.onPlayActionSound&&e.onPlayActionSound(t.soundPath),typeof t.targetSlideIndex=="number"){let r=Math.max(0,Math.min(e.slidesLength-1,Math.floor(t.targetSlideIndex)));e.slidesLength>0&&e.navigateToSlide(r);return}if(n.includes("hlinkshowjump")){let r=n.toLowerCase();r.includes("nextslide")?e.movePresentationSlide(1):r.includes("previousslide")?e.movePresentationSlide(-1):r.includes("firstslide")?e.navigateToSlide(0):r.includes("lastslide")?e.navigateToSlide(e.slidesLength-1):r.includes("endshow")&&e.onSetMode("edit");return}n.includes("hlinksldjump")||t.url&&!n.includes("hlinksldjump")&&Wb(t.url)&&window.open(t.url,"_blank","noopener,noreferrer");}function JH(t,e){let n=e.slides[e.currentSlideIndex];n?.transition?.soundPath&&e.onPlayActionSound&&e.onPlayActionSound(n.transition.soundPath);let r=Math.max(120,n?.transition?.durationMs||320);e.setPresentationSlideVisible(false),e.clearPresentationTimers();let o=window.setTimeout(()=>{e.setPresentationSlideIndex(t),e.onSetActiveSlideIndex(t),e.setPresentationSlideVisible(true),e.runPresentationEntranceAnimations(t),e.scheduleAutoAdvanceForSlide?.(t);},Math.min(r,480));e.presentationTimersRef.current.push(o);}function cue(t){let{slides:e,visibleSlideIndexes:n,presentationSlideIndex:r,setPresentationSlideIndex:o,setPresentationSlideVisible:i,onSetMode:s,onSetActiveSlideIndex:a,onPlayActionSound:l,loopContinuously:c,useTimings:u,playNextAnimationGroup:d,clearPresentationTimers:p,runPresentationEntranceAnimations:f,presentationTimersRef:h,rehearsing:m,recordCurrentSlideTime:x,setShowRehearsalSummary:y}=t,v=useRef(()=>{}),S=useCallback(E=>{if(u===false)return;let A=e[E]?.transition?.advanceAfterMs;if(typeof A!="number"||!Number.isFinite(A)||A<0)return;let R=window.setTimeout(()=>{v.current(1);},Math.max(0,A));h.current.push(R);},[e,h,u]),w=useCallback(E=>{if(E===1&&d())return;let M=n.length>0?n:e.map((B,D)=>D);if(M.length===0)return;let A=M.indexOf(r),k=(A>=0?A:0)+E;if(m&&E===1&&k>=M.length){x(r);try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}s("edit"),y(true);return}let N;c&&!m&&E===1&&k>=M.length?N=0:N=Math.min(M.length-1,Math.max(0,k));let F=M[N];F===void 0||F===r||(m&&E===1&&x(r),JH(F,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:f,scheduleAutoAdvanceForSlide:m?void 0:S,presentationTimersRef:h}));},[p,c,l,a,s,d,r,h,x,m,f,S,y,e,n,i,o]);v.current=w;let C=useCallback(E=>{E<0||E>=e.length||E!==r&&JH(E,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:f,scheduleAutoAdvanceForSlide:S,presentationTimersRef:h});},[p,l,a,r,h,f,S,e,o,i]),T=useCallback(E=>{lue(E,{movePresentationSlide:w,navigateToSlide:C,onPlayActionSound:l,onSetMode:s,slidesLength:e.length});},[w,C,l,s,e.length]);return {movePresentationSlide:w,navigateToSlide:C,handlePresentationAction:T,scheduleAutoAdvanceForSlide:S}}function uue(t){let{navigateToSlide:e}=t,n=useRef(null),r=useCallback((s,a)=>{n.current=a,e(s);},[e]),o=useCallback(()=>{let s=n.current;return s===null?false:(n.current=null,e(s),true)},[e]),i=useCallback(()=>{n.current=null;},[]);return {handleZoomClick:r,zoomReturnSlideIndex:n,returnToZoomSlide:o,clearZoomReturn:i}}function due(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,onToggleLaser:u,onTogglePen:d,onToggleEraser:p,onToggleToolbar:f,onSaveRehearsalTimings:h,loopContinuously:m,showWithAnimation:x,useTimings:y}=t,[v,S]=useState(0),[w,C]=useState(true),[T,E]=useState(false),[M,A]=useState(null),R=useRef(false),{presentationAnimations:k,presentationElementStates:N,presentationKeyframesCss:F,interactiveTriggerShapeIds:B,hoverTriggerShapeIds:D,clearPresentationTimers:O,playNextAnimationGroup:U,handleInteractiveShapeClick:H,handleHoverStart:j,handleHoverEnd:Z,runPresentationEntranceAnimations:J,presentationTimersRef:W}=qce({slides:n,onPlayActionSound:c,showWithAnimation:x}),{rehearsing:te,setRehearsing:se,recordedTimings:Ce,slideStartTime:ee,showRehearsalSummary:ce,setShowRehearsalSummary:ue,rehearsalPaused:Ne,recordCurrentSlideTime:Ue,dismissRehearsalSummary:he,saveRehearsalTimings:Be,enterRehearsalMode:Me,toggleRehearsalPause:ge}=aue({containerRef:i,onSetMode:a,onSaveRehearsalTimings:h,setPresentationStartTime:A,setPresenterMode:E}),{movePresentationSlide:Te,navigateToSlide:be,handlePresentationAction:xe,scheduleAutoAdvanceForSlide:Pe}=cue({slides:n,visibleSlideIndexes:r,presentationSlideIndex:v,setPresentationSlideIndex:S,setPresentationSlideVisible:C,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,loopContinuously:m,useTimings:y,playNextAnimationGroup:U,clearPresentationTimers:O,runPresentationEntranceAnimations:J,presentationTimersRef:W,rehearsing:te,recordCurrentSlideTime:Ue,setShowRehearsalSummary:ue}),{handleZoomClick:Xe,zoomReturnSlideIndex:Y,returnToZoomSlide:Ge,clearZoomReturn:Ve}=uue({navigateToSlide:be}),{openAudienceWindow:We,closeAudienceWindow:ke,isAudienceWindowOpen:wt,syncSlideToAudience:V}=tue({currentSlideIndex:v,isPresenterMode:T,content:s});rue({onSetMode:a,onSetActiveSlideIndex:l,containerRef:i});let $=useCallback(()=>{E(false),se(false),A(Date.now());try{let ae=i.current;ae&&typeof ae.requestFullscreen=="function"&&ae.requestFullscreen().catch(()=>{});}catch{}a("present");},[i,a,se]),ie=useCallback(()=>{E(true),se(false),A(Date.now()),a("present");},[a,se]),ve=useCallback(()=>{if(T){E(false);try{let ae=i.current;ae&&typeof ae.requestFullscreen=="function"&&ae.requestFullscreen().catch(()=>{});}catch{}}else {R.current=true;try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}E(true),M||A(Date.now());}},[T,M,i]);iue({mode:e,movePresentationSlide:Te,onSetMode:a,onToggleLaser:u,onTogglePen:d,onToggleEraser:p,onToggleToolbar:f,onTogglePresenterView:ve,rehearsing:te,recordCurrentSlideTime:Ue,presentationSlideIndex:v,setShowRehearsalSummary:ue});let De=useRef(J);De.current=J;let $e=useRef(Pe);$e.current=Pe;let ze=useRef(o);return ze.current=o,useEffect(()=>{if(e==="present"){let ae=ze.current;S(ae),De.current(ae),$e.current(ae);}},[e]),useEffect(()=>{if(e==="present")return ()=>{try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}}},[e]),useEffect(()=>{if(e!=="present"||T)return;let ae=!!document.fullscreenElement,Se=()=>{if(R.current){R.current=false,ae=!!document.fullscreenElement;return}let Ye=!!document.fullscreenElement;ae&&!Ye&&(te&&(Ue(v),ue(true)),a("edit")),ae=Ye;};return document.addEventListener("fullscreenchange",Se),()=>{document.removeEventListener("fullscreenchange",Se);}},[e,a,T,te,Ue,v,ue]),useEffect(()=>{let ae=W;return ()=>{ae.current.forEach(Se=>{window.clearTimeout(Se);});}},[W]),{presentationSlideIndex:v,setPresentationSlideIndex:S,presentationSlideVisible:w,presentationAnimations:k,presentationElementStates:N,presentationKeyframesCss:F,clearPresentationTimers:O,runPresentationEntranceAnimations:J,movePresentationSlide:Te,navigateToSlide:be,handlePresentationAction:xe,handleInteractiveShapeClick:H,interactiveTriggerShapeIds:B,hoverTriggerShapeIds:D,handleHoverStart:j,handleHoverEnd:Z,enterPresentMode:$,presenterMode:T,enterPresenterView:ie,togglePresenterView:ve,presentationStartTime:M,rehearsing:te,enterRehearsalMode:Me,recordedTimings:Ce,slideStartTime:ee,showRehearsalSummary:ce,dismissRehearsalSummary:he,saveRehearsalTimings:Be,rehearsalPaused:Ne,toggleRehearsalPause:ge,handleZoomClick:Xe,zoomReturnSlideIndex:Y,returnToZoomSlide:Ge,clearZoomReturn:Ve,openAudienceWindow:We,closeAudienceWindow:ke,isAudienceWindowOpen:wt,syncSlideToAudience:V}}function fue(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,mediaDataUrls:a,presentationProperties:l,setMode:c,setActiveSlideIndex:u,setSlides:d,history:p}=t,f=useRef(null),[,h]=useState(false),m=useRef("edit"),x=Vce({isActive:e==="present",activeSlideIndex:o});return {presentation:due({mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:v=>{e==="present"&&v!=="present"&&x.hasAnyAnnotations?(m.current=v,h(true)):(e==="present"&&v!=="present"&&(Gb(),kN()),c(v));},onSetActiveSlideIndex:u,onPlayActionSound:v=>{(async()=>{if(!v)return;let S=a.get(v);if(S){try{new Audio(S).play().catch(()=>{});}catch{}return}let w=f.current;if(w)try{let C=await w.getImageData(v);if(!C)return;a.set(v,C),new Audio(C).play().catch(()=>{});}catch{}})();},onToggleLaser:()=>x.setPresentationTool("laser"),onTogglePen:()=>x.setPresentationTool("pen"),onToggleEraser:()=>x.setPresentationTool("eraser"),onToggleToolbar:()=>x.setToolbarVisible(!x.toolbarVisible),onSaveRehearsalTimings:v=>{d(S=>Xce(S,v)),p.markDirty();},loopContinuously:jce(l),showWithAnimation:l.showWithAnimation,useTimings:l.advanceMode!=="manual"}),annotations:x,actionSoundHandlerRef:f}}function mZe(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function gZe(){return false}function xZe(t){if(typeof window>"u")return ()=>{};let e=window.matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function hue(){let t=useSyncExternalStore(xZe,mZe,gZe),[e,n]=useState(false),r=t||e,o=useCallback(()=>{n(i=>!i);},[]);return useEffect(()=>{let i=document.documentElement;return r?i.classList.add("pptx-reduced-motion"):i.classList.remove("pptx-reduced-motion"),()=>{i.classList.remove("pptx-reduced-motion");}},[r]),{osReducedMotion:t,manualReducedMotion:e,reducedMotion:r,toggleReducedMotion:o,setManualReducedMotion:n}}var yZe=120,bZe=400,vZe=180,SZe=220,wZe=480,CZe=288,TZe=60,MZe=400,_Ze=120;function mue(){let[t,e]=useState(vZe),[n,r]=useState(CZe),[o,i]=useState(_Ze),s=useCallback(c=>{e(u=>Math.min(bZe,Math.max(yZe,u+c)));},[]),a=useCallback(c=>{r(u=>Math.min(wZe,Math.max(SZe,u-c)));},[]),l=useCallback(c=>{i(u=>Math.min(MZe,Math.max(TZe,u-c)));},[]);return {leftWidth:t,rightWidth:n,bottomHeight:o,onResizeLeft:s,onResizeRight:a,onResizeBottom:l}}var PZe=50,RZe=100,kZe=500,gue=10;function xue(t,e){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function IZe(t){return Math.min(Math.max(t,.2),5)}function yue(t){let{targetRef:e,currentScale:n,callbacks:r,enabled:o=true}=t,i=useRef(r);i.current=r;let s=useRef(n);s.current=n;let[a,l]=useState(0),c=useRef(null);e.current!==c.current&&(c.current=e.current,queueMicrotask(()=>l(u=>u+1))),useEffect(()=>{let u=e.current;if(!u||!o)return;let d=0,p=1,f=false,h=0,m=0,x=null,y=0,v=0,S=()=>{x!==null&&(clearTimeout(x),x=null);},w=M=>{M.touches.length===2?(f=true,d=xue(M.touches[0],M.touches[1]),p=s.current,S(),M.preventDefault()):M.touches.length===1&&(h=M.touches[0].clientX,m=M.touches[0].clientY,y=M.touches[0].clientX,v=M.touches[0].clientY,S(),x=setTimeout(()=>{x=null,i.current.onLongPress?.(y,v);},kZe));},C=M=>{if(M.touches.length===2&&f){M.preventDefault();let A=xue(M.touches[0],M.touches[1]);if(d>0){let R=A/d,k=IZe(p*R);i.current.onPinchZoom?.(k);}}else if(M.touches.length===1){let A=M.touches[0].clientX-y,R=M.touches[0].clientY-v;(Math.abs(A)>gue||Math.abs(R)>gue)&&S();}},T=M=>{if(f){f=false,d=0;return}if(S(),M.changedTouches.length===1&&M.touches.length===0){let A=M.changedTouches[0].clientX,R=M.changedTouches[0].clientY,k=A-h,N=R-m;Math.abs(k)>=PZe&&Math.abs(N)<RZe&&i.current.onSwipe?.(k>0?1:-1);}},E=()=>{f=false,d=0,S();};return u.addEventListener("touchstart",w,{passive:false}),u.addEventListener("touchmove",C,{passive:false}),u.addEventListener("touchend",T,{passive:true}),u.addEventListener("touchcancel",E,{passive:true}),()=>{u.removeEventListener("touchstart",w),u.removeEventListener("touchmove",C),u.removeEventListener("touchend",T),u.removeEventListener("touchcancel",E),S();}},[e,o,a]);}function RM(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function oz(t,e){try{return window.prompt(t,e)}catch{return null}}function bue(t){try{return window.confirm(t)}catch{return false}}function NZe(t){if(typeof t!="string"||t.trim().length===0)return "presentation.pptx";let e=t.replace(/[\x00-\x1f\x7f"\\/:*?<>|]/g,"_").replace(/\.\./g,"__").replace(/^\.+/,"").trim();if(e.length===0)return "presentation.pptx";if(e.length>200){let n=e.lastIndexOf(".");if(n>0&&e.length-n<=16){let r=e.slice(n);e=e.slice(0,200-r.length)+r;}else e=e.slice(0,200);}return e}function $N(t,e){let n=NZe(e),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n,document.body.appendChild(o),o.click(),setTimeout(()=>{document.body.removeChild(o),URL.revokeObjectURL(r);},200);}function vue(t){let{activeSlide:e,customShows:n,activeCustomShowId:r,setCustomShows:o,setActiveCustomShowId:i,history:s}=t,a=()=>{let f=oz("Custom show name","Custom Show")?.trim()||`Custom Show ${n.length+1}`,h=`custShow-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,m=e?.rId&&e.rId.length>0?[e.rId]:[];o(x=>[...x,{id:h,name:f,slideRIds:m}]),i(h),s.markDirty();},l=()=>{if(!r)return;let p=n.find(h=>h.id===r);if(!p)return;let f=oz("Rename custom show",p.name)?.trim();f&&(o(h=>h.map(m=>m.id===p.id?{...m,name:f}:m)),s.markDirty());},c=()=>{let p=r;if(!p)return;let f=n.find(h=>h.id===p);f&&bue(`Delete custom show "${f.name}"?`)&&(o(h=>h.filter(m=>m.id!==p)),i(null),s.markDirty());},u=()=>{let p=r,f=e?.rId;!p||!f||(o(h=>h.map(m=>{if(m.id!==p)return m;let x=m.slideRIds.includes(f);return {...m,slideRIds:x?m.slideRIds.filter(y=>y!==f):[...m.slideRIds,f]}})),s.markDirty());},d=useMemo(()=>{if(!r||!e?.rId)return false;let p=n.find(f=>f.id===r);return p?p.slideRIds.includes(e.rId):false},[r,e?.rId,n]);return {handleCreateCustomShow:a,handleRenameActiveCustomShow:l,handleDeleteActiveCustomShow:c,handleToggleCurrentSlideInActiveShow:u,isCurrentSlideInActiveShow:d}}function wue(t){let{mode:e,slides:n,activeSlide:r,canvasSize:o,containerRef:i,customShows:s,activeCustomShowId:a,setCustomShows:l,setActiveCustomShowId:c,setGuides:u,setPresentationProperties:d,setAccessibilityIssues:p,setIsAccessibilityPanelOpen:f,setMode:h,setPreMasterMode:m,setActiveMasterIndex:x,setActiveLayoutIndex:y,setSelectedElementId:v,setSelectedElementIds:S,preMasterMode:w,hasDigitalSignatures:C,isDirty:T,history:E}=t,[M,A]=useState(false),[R,k]=useState(false),[N,F]=useState(false),[B,D]=useState(false),[O,U]=useState(false),[H,j]=useState(false),[Z,J]=useState(false),[W,te]=useState(false),se=useRef(false),[Ce,ee]=useState(false),[ce,ue]=useState(false),[Ne,Ue]=useState(false),[he,Be]=useState(null),[Me,ge]=useState(false),[Te,be]=useState(()=>typeof window<"u"?window.innerWidth<768:false);useEffect(()=>{let ie=()=>be(window.innerWidth<768),ve=null,De=0,$e=()=>{let ze=i.current;if(!ze){De=requestAnimationFrame($e);return}ve=new ResizeObserver(ae=>{let Se=ae[0];Se&&be(Se.contentRect.width<768);}),ve.observe(ze),be(ze.clientWidth<768);};return $e(),window.addEventListener("resize",ie),()=>{cancelAnimationFrame(De),ve?.disconnect(),window.removeEventListener("resize",ie);}},[]),useEffect(()=>{T&&C&&!se.current&&te(true);},[T,C]);let xe=useCallback(()=>{m(e==="master"?"edit":e),h("master"),x(0),y(null),v(null),S([]);},[e,m,h,x,y,v,S]),Pe=useCallback(()=>{h(w),v(null),S([]);},[w,h,v,S]),Xe=useCallback(ie=>{x(ie),y(null),v(null),S([]);},[x,y,v,S]),Y=useCallback((ie,ve)=>{x(ie),y(ve),v(null),S([]);},[x,y,v,S]),Ge=ie=>{let ve=ie==="h"?o.height/2:o.width/2;u(De=>[...De,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:ie,position:ve}]);},Ve=vue({activeSlide:r,customShows:s,activeCustomShowId:a,setCustomShows:l,setActiveCustomShowId:c,history:E}),We=useCallback(ie=>{d(ie),E.markDirty();},[d,E]),ke=useCallback(()=>{d(ie=>({...ie,showSubtitles:!ie.showSubtitles})),E.markDirty();},[d,E]),wt=useCallback(ie=>{Ue(true);},[]),V=useCallback(()=>{Ue(false);},[]);return {isSmartArtDialogOpen:M,setIsSmartArtDialogOpen:A,isEquationDialogOpen:R,setIsEquationDialogOpen:k,isHyperlinkDialogOpen:N,setIsHyperlinkDialogOpen:F,isPasswordDialogOpen:B,setIsPasswordDialogOpen:D,isDocPropsDialogOpen:O,setIsDocPropsDialogOpen:U,isFontEmbeddingOpen:H,setIsFontEmbeddingOpen:j,isDigitalSigDialogOpen:Z,setIsDigitalSigDialogOpen:J,isSignatureStrippedDialogOpen:W,setIsSignatureStrippedDialogOpen:te,isSetUpSlideShowOpen:Ce,setIsSetUpSlideShowOpen:ee,isBroadcastDialogOpen:ce,setIsBroadcastDialogOpen:ue,isPasswordProtected:Ne,editingEquationOmml:he,setEditingEquationOmml:Be,embedFontsEnabled:Me,setEmbedFontsEnabled:ge,isNarrowViewport:Te,handleEnterMasterView:xe,handleCloseMasterView:Pe,handleSelectMaster:Xe,handleSelectLayout:Y,handleAddGuide:Ge,...Ve,handleSaveSlideShowSettings:We,handleToggleSubtitles:ke,handleSetPassword:wt,handleRemovePassword:V,handleRunAccessibilityCheck:()=>{let ie=[];n.forEach((ve,De)=>{for(let $e of ve.elements)($e.type==="image"||$e.type==="picture")&&!("altText"in $e&&$e.altText)&&ie.push({slideIndex:De,elementId:$e.id,severity:"warning",message:"Image missing alt text"});}),ie.length>0&&console.info(`[Accessibility] Found ${ie.length} issue(s):`,ie),p(ie),f(true);}}}function Cue(t){let{mode:e,presentation:n,annotations:r,history:o,setMode:i,setSlides:s}=t,[a,l]=useState(false),c=useRef("edit"),u=useCallback(m=>{m==="present"?n.enterPresentMode():e==="present"&&r.hasAnyAnnotations?(Gb(),c.current=m,l(true)):(e==="present"&&Gb(),i(m));},[n,e,r.hasAnyAnnotations,i]),d=useCallback(()=>{let m=r.allSlideAnnotations;if(m.size===0){l(false),i(c.current),r.clearAllAnnotations();return}s(x=>x.map((y,v)=>{let S=m.get(v);if(!S||S.length===0)return y;let w=S.map(C=>{let T=1/0,E=1/0,M=-1/0,A=-1/0;for(let B of C.points)B.x<T&&(T=B.x),B.y<E&&(E=B.y),B.x>M&&(M=B.x),B.y>A&&(A=B.y);let R=Math.max(M-T,1),k=Math.max(A-E,1),N=[];for(let B=0;B<C.points.length;B++){let D=C.points[B],O=D.x-T,U=D.y-E;N.push(B===0?`M ${O} ${U}`:`L ${O} ${U}`);}let F=C.opacity<1?"highlighter":"pen";return {id:`ink-annotation-${C.id}`,type:"ink",x:T,y:E,width:R,height:k,inkPaths:[N.join(" ")],inkColors:[C.color],inkWidths:[C.width],inkOpacities:[C.opacity],inkTool:F}});return {...y,elements:[...y.elements,...w]}})),o.markDirty(),r.clearAllAnnotations(),l(false),i(c.current);},[r,i,s,o]),p=useCallback(()=>{r.clearAllAnnotations(),l(false),i(c.current);},[r,i]),f=useCallback(()=>{n.enterPresenterView();},[n]),h=useCallback(()=>{n.enterRehearsalMode();},[n]);return {showKeepAnnotationsDialog:a,handleSetMode:u,handleKeepAnnotations:d,handleDiscardAnnotations:p,handleEnterPresenterView:f,handleEnterRehearsalMode:h}}function Tue(t){return Math.max(t,10)*1e3}var HZe="pptx-viewer-autosave",zZe=1,cS="recoveryVersions";function _ue(){return new Promise((t,e)=>{let n=indexedDB.open(HZe,zZe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(cS)||r.createObjectStore(cS,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function GZe(){let t=await _ue();return new Promise(e=>{try{let n=t.transaction(cS,"readwrite"),r=n.objectStore(cS),o=null,i=1/0,s=r.openCursor();s.onsuccess=()=>{let a=s.result;if(a){let l=a.value;typeof l.timestamp=="number"&&l.timestamp<i&&(i=l.timestamp,o=a.primaryKey),a.continue();}else o!==null&&r.delete(o);},n.oncomplete=()=>{t.close(),e(o!==null);},n.onerror=()=>{t.close(),e(!1);};}catch{try{t.close();}catch{}e(false);}})}function Mue(t,e){return _ue().then(n=>new Promise((r,o)=>{let i=n.transaction(cS,"readwrite");i.objectStore(cS).put({key:t,data:e,timestamp:Date.now(),size:e.byteLength}),i.oncomplete=()=>{n.close(),r(true);},i.onerror=()=>{n.close(),o(i.error);};}))}async function VZe(t,e){try{return await Mue(t,e)}catch(n){if((n instanceof Error||n instanceof DOMException?n.name:"")!=="QuotaExceededError"||!await GZe())throw n;return Mue(t,e)}}function Eue(t){let{isDirty:e,filePath:n,serializeSlides:r,intervalSeconds:o=120,enabled:i=true}=t,[s,a]=useState({state:"idle"}),l=useRef(e),c=useRef(n),u=useRef(r),d=useRef(false);useEffect(()=>{l.current=e;},[e]),useEffect(()=>{c.current=n;},[n]),useEffect(()=>{u.current=r;},[r]);let p=useCallback(async()=>{if(c.current&&l.current&&!d.current){d.current=true,a({state:"saving"});try{let f=await u.current();if(!f){a({state:"idle"}),d.current=!1;return}await VZe(c.current,f),a({state:"saved",timestamp:Date.now()});}catch(f){a({state:"error",message:f instanceof Error?f.message:"Autosave failed"});}finally{d.current=false;}}},[]);return useEffect(()=>{if(!i||!n)return;let f=Tue(o),h=setInterval(()=>{p();},f);return ()=>clearInterval(h)},[i,n,o,p]),{autosaveStatus:s,triggerAutosave:p}}var Aue={"Atkinson Hyperlegible":"Atkinson+Hyperlegible:wght@400;700",Roboto:"Roboto:wght@400;700","Open Sans":"Open+Sans:wght@400;700",Lato:"Lato:wght@400;700",Montserrat:"Montserrat:wght@400;700",Poppins:"Poppins:wght@400;700",Raleway:"Raleway:wght@400;700",Nunito:"Nunito:wght@400;700","Playfair Display":"Playfair+Display:wght@400;700","Source Sans Pro":"Source+Sans+Pro:wght@400;700","PT Sans":"PT+Sans:wght@400;700",Merriweather:"Merriweather:wght@400;700",Ubuntu:"Ubuntu:wght@400;700",Oswald:"Oswald:wght@400;700","Noto Sans":"Noto+Sans:wght@400;700","Fira Sans":"Fira+Sans:wght@400;700",Inter:"Inter:wght@400;700","Work Sans":"Work+Sans:wght@400;700",Quicksand:"Quicksand:wght@400;700",Cabin:"Cabin:wght@400;700"},Pue="pptx-embedded-fonts",Rue="pptx-google-fonts",kue="pptx-symbol-font-fallback",XZe=["Wingdings","Wingdings 2","Wingdings 3","Symbol","Webdings"];function WZe(t){let e=new Set;for(let n of t)for(let r of n.elements)if(ot(r)&&r.textSegments)for(let o of r.textSegments)o.style.fontFamily&&e.add(o.style.fontFamily);return e}var Iue=/["\\\n\r;}<>]/,YZe=new Set(["truetype","opentype","woff","woff2","svg","embedded-opentype"]),qZe=/^data:font\/[a-z0-9+.-]+(?:;charset=[a-z0-9-]+)?;base64,[A-Za-z0-9+/=]+$/i;function KZe(t){return typeof t!="string"||t.length===0?false:t.startsWith("blob:")?true:qZe.test(t)}function Nue({embeddedFonts:t,slides:e}){useEffect(()=>{if(!t.length)return;let r=document.createElement("style");r.id=Pue;let o=t.flatMap(i=>{if(typeof i.name!="string"||i.name.length===0||Iue.test(i.name))return [];if(!KZe(i.dataUrl))return [];let s=i.format??"truetype";if(!YZe.has(s))return [];let a=i.bold?"700":"400",l=i.italic?"italic":"normal";return [`@font-face {