pptx-react-viewer 1.1.19 → 1.1.21

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.
@@ -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=aie(a),c=E0(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=aie(i),a=H2(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?AI(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 aie(t){return t.notesSegments&&t.notesSegments.length>0?t.notesSegments:Dv(t.notes??"")}function uie({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 pie({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(uie,{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 fie({activeSlide:t,isExpanded:e,canEdit:n,onToggle:r,onUpdateNotes:o}){let i=useMemo(()=>t?.notesSegments&&t.notesSegments.length>0?Lv(t.notesSegments):Dv(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?Lv(t.notesSegments):Dv(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=sie(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]),_=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=Dv(te);a(te),c(se),_(te,se);},[_]),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=iie(v.current),te=H2(W);a(te),c(W),_(te,W);},[_]),k=useCallback(()=>{T(s,l);},[s,l,T]),N=useCallback(W=>{if(!v.current)return;let te=rie(v.current,l),se=E0(l);te>=0&&te<se.length&&(se[te]=W(se[te],te));let Ce=nie(se),ee=H2(Ce);a(ee),c(Ce),_(ee,Ce);},[l,_]),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(),Wg(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 K6=({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:_,applyRichCommand:M,toggleBulletList:A,toggleNumberedList:R,handleIndent:k,handleOutdent:N,handleLinkButtonClick:F,handleInsertLink:B,handleEditorClick:D}=fie({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(pie,{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:_,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?AI(c):jsx("span",{className:"italic text-muted-foreground",children:a("pptx.notes.noNotes")})})]}),h&&e&&jsx(lie,{slides:e,onClose:()=>m(false)})]})};var vGe="pptx-viewer-autosave",SGe=1,Bv="recoveryVersions";function hie(){return new Promise((t,e)=>{let n=indexedDB.open(vGe,SGe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(Bv)||r.createObjectStore(Bv,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function wGe(t){try{let e=await hie();return new Promise(n=>{let i=e.transaction(Bv,"readonly").objectStore(Bv).get(t);i.onsuccess=()=>{e.close();let s=i.result;n(s?[s]:[]);},i.onerror=()=>{e.close(),n([]);};})}catch{return []}}async function CGe(t){try{let e=await hie();return new Promise(n=>{let r=e.transaction(Bv,"readwrite");r.objectStore(Bv).delete(t),r.oncomplete=()=>{e.close(),n();},r.onerror=()=>{e.close(),n();};})}catch{}}function TGe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function MGe(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function EGe(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 J6({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 wGe(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 CGe(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:MGe(x.timestamp)}),jsx("div",{className:"text-[10px] text-muted-foreground",children:EGe(x.timestamp)})]}),jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:TGe(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 FGe({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 gie({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(FGe,{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 e8({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(gie,{diff:x,diffIndex:y,canvasSize:n,accepted:!!l[y],rejected:!!u[y],onAccept:p,onReject:f},`diff-${y}-${x.status}`))})]})}function XGe(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 WGe=["bg-red-500","bg-orange-500","bg-yellow-500","bg-lime-500","bg-green-500"];function n8({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(()=>XGe(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?WGe[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 JGe=[{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 r8({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:JGe.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 tVe=[{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 nVe(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 rVe(t,e,n){return t==="totalTime"?nVe(e,n):e==null?n("pptx.documentProperties.statistics.notAvailable"):String(e)}function o8({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:tVe.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:rVe(i,t[i],r)})]},i))})}var bie=[{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 i8({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(_=>({..._}))),h({company:r?.company,manager:r?.manager}),l("summary")),t!==m&&x(t);let y=useCallback((_,M)=>{u(A=>({...A,[_]:M}));},[]),v=useMemo(()=>{if(bie.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(_=>{h(M=>({...M,..._}));},[]),w=useCallback(()=>{let _=(f.company??"")!==(r?.company??"")||(f.manager??"")!==(r?.manager??"");i(c,d,_?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(_=>jsx("button",{type:"button",onClick:()=>l(_.id),className:`px-4 py-2 text-xs font-medium transition-colors ${a===_.id?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:s(_.labelKey)},_.id))}),jsxs("div",{className:"px-5 py-4 min-h-[280px]",children:[a==="summary"&&jsx("div",{className:"space-y-3",children:bie.map(({key:_,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[_]??"",onChange:R=>y(_,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[_]??"",onChange:R=>y(_,R.target.value)})]},_))}),a==="custom"&&jsx(r8,{customProperties:d,onUpdate:p}),a==="statistics"&&jsx(o8,{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 xVe(t){if(typeof document>"u")return false;try{return document.fonts.check(`12px "${t}"`)}catch{return false}}function a8({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)xVe(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 c8({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 u8({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 d8({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 p8({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 f8=10,h8=32,m8=2,Tie=14;function g8(t){return Math.max(f8,Math.min(h8,t))}function Mie(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function W2(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 Eie(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 UVe({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,_=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=oy(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),..._,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 $Ve(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 x8=Vn__default.memo(UVe,$Ve);function b8({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(Tie),v=useCallback(()=>{y(N=>g8(N+m8));},[]),S=useCallback(()=>{y(N=>g8(N-m8));},[]),w=t[e],C=e+1<t.length?t[e+1]:void 0,T=w?.notes??"",_=w?.notesSegments,M=_&&_.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(x8,{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:Mie(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:W2(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(x8,{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<=f8,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>=h8,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?Eie(_):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:`${W2(m)} (segment ${k+1})`,children:jsx("div",{className:"h-full bg-primary transition-[width] duration-1000 ease-linear",style:{width:`${R}%`}})})]})}function Rie(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 S8({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:Rie(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:Rie(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 kie(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 w8({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:kie(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:kie(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 s9e(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 T8({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]),_=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=s9e(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(),_(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 Fie="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=`${Fie} border-r border-border hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Js=`${Fie} 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 Bie=[{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})}],Oie=[{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"}],Uie=[{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`})}],$ie=[{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"}],Hie=[{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 $9e=[{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 OI(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:$9e.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 UI(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit;return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:Bie.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 $I(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 ije=[{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 HI(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:ije.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 zI(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 VI(t){return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:Oie.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 jI(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 Tje(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 Mje=["Arial","Calibri","Cambria","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana"],Eje=[8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,72,96];function XI(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}=Tje(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:Mje.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:Eje.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 WI(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:f1.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:[f1.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:Fm.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 YI(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 Jje(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 Qje=["#000000","#ffffff","#ff0000","#00aa00","#0000ff","#ff8800","#8800cc","#00cccc","#ff69b4","#808080"],eXe=["#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff","#ff0000","#000080","#008080","#008000","#800080"];function qI(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=Jje(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:$ie.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:Qje.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:eXe.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:Hie.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 KI(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 ZI({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 wXe=[{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 Jie(t){let{open:e,onClose:n}=t,[r,o]=useState("home");return jsx(ZI,{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:wXe.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(CXe,{active:r,...t})})]})})}function CXe({active:t,...e}){let n="flex flex-wrap items-center gap-2";switch(t){case "home":return jsx("div",{className:n,children:jsx(XI,{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(WI,{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(qI,{canEdit:e.canEdit,selectedElement:e.selectedElement,tableEditorState:e.tableEditorState,onUpdateTextStyle:e.onUpdateTextStyle})});case "draw":return jsx("div",{className:n,children:jsx(VI,{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(UI,{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($I,{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(HI,{isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector})});case "animations":return jsx("div",{className:n,children:jsx(OI,{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(YI,{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(zI,{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(KI,{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(jI,{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 ese(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(Jie,{open:l,onClose:()=>c(false),...t})]})}function tse({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 nse({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 rse({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(nse,{isActive:t==="present",onPresent:()=>e("present"),onPresenterView:r,onRehearse:o,onSetUpSlideShow:i,onBroadcast:s,onToggleSubtitles:a,showSubtitles:l})}function ose(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:Uie.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 ise(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(rse,{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(tse,{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(ose,{...t})]})}function F8(t){let{mode:e,isNarrowViewport:n,isCompactToolbarOpen:r,toolbarSection:o,onSetToolbarSection:i}=t;if(n&&e!=="present")return jsx(ese,{...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(ise,{...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:[VW.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(jI,{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(XI,{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(WI,{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(qI,{canEdit:t.canEdit,selectedElement:t.selectedElement,tableEditorState:t.tableEditorState,onUpdateTextStyle:t.onUpdateTextStyle}),d&&jsx(VI,{activeTool:t.activeTool,drawingColor:t.drawingColor,drawingWidth:t.drawingWidth,onSetActiveTool:t.onSetActiveTool,onSetDrawingColor:t.onSetDrawingColor,onSetDrawingWidth:t.onSetDrawingWidth}),u&&jsx(UI,{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($I,{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(HI,{isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector}),h&&jsx(OI,{canEdit:t.canEdit,selectedElement:t.selectedElement,isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector,onOpenAnimationPanel:t.onOpenAnimationPanel,onAddAnimation:t.onAddAnimation,onRemoveAnimation:t.onRemoveAnimation}),m&&jsx(YI,{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(zI,{canEdit:t.canEdit,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,onToggleComments:t.onToggleComments,isCommentsPanelOpen:t.isCommentsPanelOpen,slideCommentCount:t.slideCommentCount,onCompare:t.onCompare}),y&&jsx(KI,{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 eN="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]",sse=x_.filter(t=>t.value==="fadeIn"||t.value==="flyIn"||t.value==="zoomIn"),ase=x_.filter(t=>t.value==="fadeOut"||t.value==="flyOut"||t.value==="zoomOut"),lse=x_.filter(t=>t.value==="spin"||t.value==="pulse"||t.value==="colorWave"||t.value==="bounce"||t.value==="flash"||t.value==="growShrink"||t.value==="teeter"),cse=[{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"}],use=[{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"}],dse=[{value:"none",labelKey:"pptx.animation.repeatUntil.none"},{value:"untilNextClick",labelKey:"pptx.animation.repeatUntil.untilNextClick"},{value:"untilEndOfSlide",labelKey:"pptx.animation.repeatUntil.untilEndOfSlide"}],pse=[{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}],fse=[{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 uWe(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 dWe(t){return t.entrance??t.emphasis??t.exit??"custom"}function mse({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",uWe(S.anim),S.anim.elementId===t&&"ring-1 ring-primary"),style:{left:`${S.leftPercent}%`,width:`${Math.max(S.widthPercent,2)}%`},title:`${v(S.anim)} - ${dWe(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 B8=new Set(["flyIn","flyOut"]);function xse({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 yse({selectedElementId:t,selectedElementAnimation:e}){let n=useCallback(i=>{let s=i.entrance??i.emphasis??i.exit;!s||s==="none"||mU(i.elementId,s,{direction:i.direction,durationMs:i.durationMs??500,timingCurve:i.timingCurve});},[]),r=useCallback(()=>gU(),[]),o=useCallback(()=>{if(!e)return;let i=e.entrance??e.emphasis??e.exit;!i||i==="none"||mU(t,i,{direction:e.direction,durationMs:e.durationMs??500,timingCurve:e.timingCurve});},[t,e]);return {handleAnimationHover:n,handleAnimationHoverEnd:r,handlePreviewClick:o}}function bse({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=yse({selectedElementId:t.id,selectedElementAnimation:o}),T=xse({canEdit:n,updateAnimations:s}),_=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&&(B8.has(o?.entrance??"")||B8.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:_,...C,...T}}function vse({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=bse({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")}),sse.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")}),lse.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")}),ase.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:pse.map(T=>{let _=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(_,{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:fse.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:cse.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:eN})]}),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:eN})]}),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:use.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:eN})]}),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:dse.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]})]}),jsx(mse,{selectedElementId:t.id,canEdit:n,handlers:i})]})}var Sse=[{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",wse=[["X","x"],["Y","y"],["W","width"],["H","height"]];var SWe=[{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 Tse({selectedElement:t,slides:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.actionClick?U5(t.actionClick,"click"):void 0,s=t.actionHover?U5(t.actionHover,"hover"):void 0,a=i?.type??"none",l=s?.type??"none",c=(u,d,p,f)=>{let m=i_({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(Cse,{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(Cse,{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 Cse({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:SWe.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 $v="text-[11px] uppercase tracking-wide text-muted-foreground",Hv="rounded border border-border bg-card p-2 space-y-2",zv="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",H8="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",tN="bg-muted border border-border rounded px-1 py-0.5 text-[11px] w-full text-center",Mse=[{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"}],Ese=[{value:"clustered",labelKey:"pptx.chart.groupingClustered"},{value:"stacked",labelKey:"pptx.chart.groupingStacked"},{value:"percentStacked",labelKey:"pptx.chart.groupingPercentStacked"}],_se=[{value:"t",labelKey:"pptx.chart.legendTop"},{value:"b",labelKey:"pptx.chart.legendBottom"},{value:"l",labelKey:"pptx.chart.legendLeft"},{value:"r",labelKey:"pptx.chart.legendRight"}],Ase=new Set(["bar","line","area"]);function kse({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:Hv,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:$v,children:u("pptx.chart.data")}),n&&jsxs("div",{className:"flex gap-1",children:[jsxs("button",{type:"button",className:H8,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:H8,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:tN,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:tN,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:tN,value:f.values[p]??0,onChange:m=>i(h,p,m.target.value)})},h))]},p))})]})})]})}function Ise({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:Hv,children:[jsx("div",{className:$v,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:zv,value:t.legendPosition??"b",onChange:o=>n({legendPosition:o.target.value}),children:_se.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 Nse({title:t,chartType:e,grouping:n,seriesCount:r,categoryCount:o,canEdit:i,onUpdateChartData:s}){let{t:a}=useTranslation(),l=Ase.has(e);return jsxs("div",{className:Hv,children:[jsx("div",{className:$v,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:zv,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:zv,value:e,onChange:c=>s({chartType:c.target.value}),children:Mse.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:zv,value:n??"clustered",onChange:c=>s({grouping:c.target.value}),children:Ese.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]})]})}function Dse({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=DX(r,w.chartType),{chartType:T,..._}=w;u({...C,..._});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((_,M)=>M===w?{..._,...C}:_);d({series:T});},[a,d]),h=useCallback((w,C)=>{if(!s)return;let T=s.map((_,M)=>M===w?C:_);d({categories:T});},[s,d]),m=useCallback((w,C,T)=>{if(!r)return;let _=Number.parseFloat(T);Number.isFinite(_)&&u(NX(r,w,C,_));},[r,u]),x=useCallback(()=>{!r||!s||u(LX(r,`Cat ${s.length+1}`));},[r,s,u]),y=useCallback(w=>{!r||!s||s.length<=1||u(FX(r,w));},[r,s,u]),v=useCallback(()=>{!r||!s||!a||u(kX(r,{name:`Series ${a.length+1}`,values:s.map(()=>0)}));},[r,s,a,u]),S=useCallback(w=>{!r||!a||a.length<=1||u(IX(r,w));},[r,a,u]);return !r||!s||!a?null:jsxs(Fragment,{children:[jsx(Nse,{title:o,chartType:i,grouping:c,seriesCount:a.length,categoryCount:s.length,canEdit:e,onUpdateChartData:d}),jsx(Ise,{style:l,canEdit:e,onUpdateStyle:p}),jsx(kse,{categories:s,series:a,canEdit:e,onUpdateSeries:f,onUpdateCategoryLabel:h,onUpdateValue:m,onAddCategory:x,onRemoveCategory:y,onAddSeries:v,onRemoveSeries:S})]})}function Lse({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 Fse({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 Bse({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:jj(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 Ose({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 Use({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 Hse({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 jse({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 Xse({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 qse({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 Kse({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(qse,{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(qse,{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:Nee.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 Zse({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 iN({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 Qse({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(iN,{label:"Brightness",disabled:!e,value:o?.brightness??0,onChange:s=>i({brightness:s})}),jsx(iN,{label:"Contrast",disabled:!e,value:o?.contrast??0,onChange:s=>i({contrast:s})}),jsx(iN,{label:r("pptx.image.saturation"),disabled:!e,value:o?.saturation??0,onChange:s=>i({saturation:s})})]}),jsx(Zse,{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(Kse,{selectedElement:t,canEdit:e,onUpdateElement:n})]}),jsx(Xse,{fx:o,canEdit:e,updateEffects:i}),jsx(jse,{fx:o,canEdit:e,updateEffects:i}),jsx(Hse,{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 GWe="text-[11px] uppercase tracking-wide text-muted-foreground",VWe="rounded border border-border bg-card p-2 space-y-2",jWe="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",XWe="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",WWe="flex items-center justify-between gap-2",oae="text-muted-foreground";function sN(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 nae(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 YWe(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 rae({label:t,valueMs:e,maxMs:n,disabled:r,onChange:o}){let[i,s]=useState(null),[a,l]=useState(false),c=i??sN(e),u=useCallback(()=>{s(sN(e)),l(false);},[e]),d=useCallback(()=>{if(i!==null){let h=nae(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=nae(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] ${oae}`,children:t}),jsx("input",{type:"text",disabled:r,className:`${jWe} text-[11px] tabular-nums ${a?"border-red-400":""}`,value:c,placeholder:"00:00",onFocus:u,onBlur:d,onChange:p,onKeyDown:f})]})}function iae({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?sN(a):sN(m-h)},[i,s,a]),c=useMemo(()=>YWe(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:VWe,children:[jsxs("div",{className:GWe,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(rae,{label:o("pptx.media.trimStartTime"),valueMs:i,maxMs:a,disabled:!e,onChange:d}),jsx(rae,{label:o("pptx.media.trimEndTime"),valueMs:s,maxMs:a,disabled:!e,onChange:p})]}),jsxs("div",{className:WWe,children:[jsxs("span",{className:`text-[11px] ${oae}`,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:`${XWe} 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 sae(){return `bmk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var Wv="text-[11px] uppercase tracking-wide text-muted-foreground",Yv="rounded border border-border bg-card p-2 space-y-2",nM="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",aN="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 aae({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 _=Math.min(T,p-.1);s(Math.max(0,_)*1e3,n);}else {let _=Math.max(T,d+.1);s(e,Math.min(_,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 cae({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:sae(),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:Yv,children:[jsx("div",{className:Wv,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:`${nM} 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:`${nM} 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:`${nM} 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:Yv,children:[jsxs("div",{className:Wv,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:`${nM} 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:aN,onClick:u,title:s("pptx.media.addBookmark"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function dae({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);},_=()=>a(true),M=()=>a(false),A=()=>a(false);return w.addEventListener("timeupdate",C),w.addEventListener("durationchange",T),w.addEventListener("loadedmetadata",T),w.addEventListener("play",_),w.addEventListener("pause",M),w.addEventListener("ended",A),()=>{w.removeEventListener("timeupdate",C),w.removeEventListener("durationchange",T),w.removeEventListener("loadedmetadata",T),w.removeEventListener("play",_),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 _=w.querySelector("source");_?.type&&(T.codecInfo=_.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:Yv,children:[jsx("div",{className:Wv,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:aN,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(aae,{duration:u,trimStartMs:t.trimStartMs??0,trimEndMs:t.trimEndMs??0,currentTime:l,bookmarks:f,canEdit:n,onTrimChange:y,onSeek:x})]}),jsx(iae,{element:t,canEdit:n,durationSeconds:u,onUpdateElement:r}),(v||t.posterFrameData)&&jsxs("div",{className:Yv,children:[jsxs("div",{className:Wv,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(cae,{element:t,canEdit:n,currentTime:l,bookmarks:f,onUpdateElement:r,onSeekTo:x})]})}function pae({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:f1.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(j8,{label:"B",active:!!t.textStyle?.bold,disabled:!e,onClick:()=>o({bold:!t.textStyle?.bold})}),jsx(j8,{label:"I",active:!!t.textStyle?.italic,disabled:!e,italic:true,onClick:()=>o({italic:!t.textStyle?.italic})}),jsx(j8,{label:"U",active:!!t.textStyle?.underline,disabled:!e,underline:true,onClick:()=>o({underline:!t.textStyle?.underline})})]})]})]})]})}function j8({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 p7e(){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 f7e(){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 h7e(){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 m7e(){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 g7e(){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 x7e(){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 fae={process:p7e,hierarchy:f7e,cycle:h7e,matrix:m7e,pyramid:g7e,list:x7e};var b7e=rW.map(t=>({type:t,i18nKey:`pptx.smartart.category.${t}`}));function mae({smartArtData:t,canEdit:e,onUpdateSmartArt:n}){let{t:r}=useTranslation(),o=t.resolvedLayoutType??"list",i=s=>{if(!e||s===o)return;let a=oW(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:b7e.map(({type:s,i18nKey:a})=>{let l=o===s,c=fae[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 S7e=["colorful1","colorful2","colorful3","monochromatic1","monochromatic2"],w7e=["flat","moderate","intense"];function gae({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(_X(t,h,m));},l=()=>{s($5(t));},c=h=>{s($5(t,h,"Sub-item"));},u=h=>{s(EX(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(mae,{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:S7e.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:w7e.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 xae(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 yae(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 bae(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 cN="bg-muted border border-border rounded px-2 py-1 text-[11px] w-full",uN="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full text-[11px]",Vp="text-muted-foreground text-[11px]",vae="text-[11px] uppercase tracking-wide text-muted-foreground",Sae=[{value:"solid",i18nKey:"pptx.table.fillSolid"},{value:"gradient",i18nKey:"pptx.table.fillGradient"},{value:"pattern",i18nKey:"pptx.table.fillPattern"},{value:"none",i18nKey:"pptx.table.fillNone"}],wae=[{value:"linear",i18nKey:"pptx.table.gradientLinear"},{value:"radial",i18nKey:"pptx.table.gradientRadial"}],Cae=mF.slice(0,20);function Tae({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:cN,value:o,onChange:s=>i(s.target.value),children:Sae.map(s=>jsx("option",{value:s.value??"",children:r(s.i18nKey)},s.value))})]}),o==="gradient"&&jsx(C7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),o==="pattern"&&jsx(T7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),jsxs("div",{className:"space-y-1",children:[jsx("span",{className:vae,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:uN,min:0,max:200,value:t[s]??0,onChange:l=>n({[s]:Number(l.target.value)})})]},s))})]})]})}function C7e({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:cN,value:i,onChange:l=>n({gradientFillType:l.target.value}),children:wae.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:uN,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:uN,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 T7e({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:cN,value:t.patternFillPreset??"ltDnDiag",onChange:o=>n({patternFillPreset:o.target.value}),children:Cae.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 Mae({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(Tae,{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=xae(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=yae(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=bae(t,i,s);u&&r({rows:u});},children:o("pptx.table.split")})]})]})]})}function Eae({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:XW.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(Mae,{tableData:i,tableEditorState:r,canEdit:e,onUpdateTableData:l})]})}function _ae({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:wse.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(Eae,{tableElement:t,canEdit:e,onUpdateElement:i,tableEditorState:r}),t.type==="chart"&&jsx(Dse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="smartArt"&&t.smartArtData&&jsx(gae,{smartArtData:t.smartArtData,canEdit:e,onUpdateElement:i}),yi(t)&&jsx(Qse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="media"&&jsx(dae,{element:t,mediaDataUrls:o??new Map,canEdit:e,onUpdateElement:i}),jsx(Lse,{selectedElement:t,canEdit:e,onUpdateElementStyle:s}),jsx(Fse,{selectedElement:t}),jsx(Bse,{selectedElement:t}),jsx(pae,{selectedElement:t,canEdit:e,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a}),jsx(Tse,{selectedElement:t,slides:n,canEdit:e,onUpdateElement:i}),jsx(Ose,{selectedElement:t,canEdit:e,onUpdateElement:i}),jsx(Use,{canEdit:e,onMoveLayer:l})]})}function Y8({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]??"",[_,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:Y7(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:[_?jsx(LuChevronDown,{className:"h-3 w-3"}):jsx(LuChevronRight,{className:"h-3 w-3"}),S("pptx.comments.repliesCount",{count:A.length})]}),_&&jsx("div",{className:"mt-1.5 space-y-1.5",children:A.map((k,N)=>jsx(Y8,{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 Rae({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(Y8,{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 q8({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 dN({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 H7e({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 kae({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(q8,{label:"Notes Size",value:t?`${t.width} \xD7 ${t.height}px`:"Not available"}),jsx(q8,{label:"Notes Master",value:e?`${e.placeholders?.length??0} placeholders`:"Not available"}),jsx(q8,{label:"Handout Master",value:n?`${n.placeholders?.length??0} placeholders`:"Not available"})]})]})}function Iae({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(dN,{label:"Title",disabled:!r,value:t?.title??"",onChange:a=>o({title:a})}),jsx(dN,{label:"Author",disabled:!r,value:t?.creator??"",onChange:a=>o({creator:a})}),jsx(dN,{label:"Company",disabled:!r,value:e?.company??"",onChange:a=>i({company:a})}),jsx(dN,{label:"Application",disabled:!r,value:e?.application??"",onChange:a=>i({application:a})}),jsx(H7e,{customProperties:n,canEdit:r,onUpdate:s})]})]})}function pN({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 Nae({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(pN,{label:"Loop Continuously",disabled:!e,checked:!!t.loopContinuously,onChange:r=>n({loopContinuously:r})}),jsx(pN,{label:"Show Narration",disabled:!e,checked:t.showWithNarration!==false,onChange:r=>n({showWithNarration:r})}),jsx(pN,{label:"Show Animation",disabled:!e,checked:t.showWithAnimation!==false,onChange:r=>n({showWithAnimation:r})}),jsx(pN,{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 Dae({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 Lae({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 Fae={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 Bae({activeSlide:t,theme:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=t?.clrMapOverride,s=TX(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:Fae[d],children:Fae[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 Oae({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 Uae({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:_}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsx(Nae,{presentationProperties:t,canEdit:e,onUpdate:n}),jsx(Dae,{themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,canEdit:e,onApplyTheme:s}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:_("pptx.themeOverride.heading")}),jsx(Bae,{activeSlide:a,theme:l,canEdit:e,onUpdateSlide:c})]}),jsx(Lae,{canvasSize:u,canEdit:e,onUpdate:d}),jsx(kae,{notesCanvasSize:p,notesMaster:f,handoutMaster:h}),jsx(Iae,{coreProperties:m,appProperties:y,customProperties:S,canEdit:e,onUpdateCoreProperties:x,onUpdateAppProperties:v,onUpdateCustomProperties:w}),C&&T&&jsx(Oae,{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 $ae({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(J7e,{activeSlide:t,slideMasters:o,canEdit:e,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s})]})}function J7e({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 Q8(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:_,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=_[0]?.path??"";V(Ye=>Ye||Se);},[xe,_]),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:Sse.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(_ae,{selectedElement:s,canEdit:n,slides:o,tableEditorState:l,mediaDataUrls:Y,onUpdateElement:p,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onMoveLayer:h}):jsxs(Fragment,{children:[jsx(Uae,{canEdit:n,canvasSize:i,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:_,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($ae,{activeSlide:r,canEdit:n,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe})]})}),c==="comments"&&jsx(Rae,{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(vse,{selectedElement:s,activeSlide:r,canEdit:n,onUpdateSlide:Te})})]})]})]})}function oYe(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 iYe(t){switch(t){case "laser":return "none";case "pen":return "crosshair";case "highlighter":return "crosshair";case "eraser":return "crosshair";default:return "default"}}function tH({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 _=T.getBoundingClientRect(),M=(w-_.left)/e,A=(C-_.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:iYe(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:oYe(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 Gae(t,e){return `${t+1} / ${e}`}var bYe=["#ff0000","#0000ff","#00aa00","#ff8800","#ffffff","#000000","#ff00ff","#00cccc"],vYe=["#ffff00","#00ff00","#ff69b4","#00bfff","#ff8c00","#adff2f","#ff6347","#87ceeb"];function oH({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 _=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:Gae(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:W2(_)})]}),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:bYe.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:vYe.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 Xae=768,Wae=1024;function wYe(){return typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints!==null&&navigator.msMaxTouchPoints>0}function CYe(t){if(typeof window>"u")return ()=>{};let e=()=>t();return window.addEventListener("pointerdown",e,{once:true}),()=>window.removeEventListener("pointerdown",e)}function Yae(){return typeof window>"u"?"landscape":typeof screen<"u"&&screen.orientation?screen.orientation.type.startsWith("portrait")?"portrait":"landscape":window.innerHeight>window.innerWidth?"portrait":"landscape"}function gN(t){let e=t?.containerRef,n=useSyncExternalStore(CYe,wYe,()=>false),[r,o]=useState(()=>typeof window>"u"?1024:e?.current?.clientWidth??window.innerWidth),[i,s]=useState(Yae),[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(Yae());};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<Xae,d=r>=Xae&&r<Wae,p=r>=Wae;return {isMobile:u,isTablet:d,isDesktop:p,isTouchDevice:n,orientation:i,isVirtualKeyboardOpen:a,containerWidth:r}}function sH({currentSlideIndex:t,totalSlides:e,onMovePresentationSlide:n,onEndPresentation:r}){let{t:o}=useTranslation(),{isTouchDevice:i}=gN();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 lH({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 cH({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 DYe=.48,LYe=6,Jae=16/9;function FYe(t,e,n=jc){let r=n.width-n.marginLeft-n.marginRight,o=n.height-n.marginTop-n.marginBottom,i=o*DYe,s=r,a=s/Jae;a>i&&(a=i,s=a*Jae);let l=(r-s)/2,c=(i-a)/2,u=i+LYe,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 uH(t){return t.map((e,n)=>FYe(n,e))}function dH(){return {width:jc.width-jc.marginLeft-jc.marginRight,height:jc.height-jc.marginTop-jc.marginBottom}}var ic=.9,ele=5;function pH({slideIndices:t,slides:e,frameSlides:n,maxPages:r=3}){let{t:o}=useTranslation(),i=useMemo(()=>uH(t),[t]),s=useMemo(()=>dH(),[]),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:ele},(h,m)=>{let x=u.textArea.height*ic/(ele+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 Qv=.9;function xN({slideIndices:t,slidesPerPage:e,orientation:n,frameSlides:r,maxPages:o=3}){let{t:i}=useTranslation(),s=useMemo(()=>yU(t,e,n),[t,e,n]),a=useMemo(()=>bU(n),[n]),l=s.slice(0,o),c=e===3,u=vU(),d=a.width*Qv,p=a.height*Qv,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*Qv,S=m.y*Qv,w=m.width*Qv,C=m.height*Qv;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},(_,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 yN=[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 ole({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:yN.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 fH({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(yN.includes(i)?i:6),[v,S]=useState("all"),[w,C]=useState(1),[T,_]=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(ole,{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:_,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(xN,{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(pH,{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 sle({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 ale({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 hH({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(ale,{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(sle,{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 bH({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]),_=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(lqe,{collab:c,broadcastUrl:w,copied:y,onCopyUrl:C,onStopBroadcast:_}):jsx(aqe,{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 aqe({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 lqe({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 ule(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 CH({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]),_=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(gqe,{collab:c,activeCollaboration:n,copied:v,onCopyRoomId:C,onStopCollaboration:o}):jsx(mqe,{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:!_,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 mqe({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 gqe({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:ule(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"}):ule(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 wN={"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"},dle={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 ple(t,e){return e&&e.startsWith("ppaction://")?e.includes("hlinksldjump")?"slide":(wN[e.toLowerCase()],"action"):t?t.startsWith("mailto:")?"email":/^[a-zA-Z]:\\|^\.\.?[/\\]|^file:/i.test(t)?"file":"url":"url"}function fle(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 hle(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 mle(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:dle[t.actionVerb],tooltip:e};default:return {url:t.url,tooltip:e}}}function gle({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 TH({open:t,initialUrl:e,initialTooltip:n,initialAction:r,slideCount:o,onConfirm:i,onCancel:s}){let{t:a}=useTranslation(),l=useRef(null),c=ple(e,r),u=fle(e||""),d=hle(e,r),p=r&&wN[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),[_,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:_,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(gle,{targetType:f,url:m,setUrl:x,tooltip:y,setTooltip:v,emailAddress:S,setEmailAddress:w,emailSubject:C,setEmailSubject:T,slideNumber:_,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 xle({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 yle({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 ble({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 vle({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 wle({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=q7(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 Cle({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(Mqe,{activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r})]})}function Mqe({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 Mle({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 Ele({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,lM=10;function EH(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 Ale=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:lM+1,fontSize:lM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})}),Ple=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+lM+2,fontSize:lM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})});function kle({canvasSize:t,editorScale:e,unit:n,visible:r,selectedBounds:o,onCreateGuideFromRuler:i}){let s=useMemo(()=>EH(t.width,e,n),[t.width,e,n]),a=useMemo(()=>EH(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(),_=S.clientY-T.top;if(_>Qn){let M=(_-Qn)/w;M>=0&&M<=t.height&&i("h",M);}}else {let C=f.current;if(!C){d(null);return}let T=C.getBoundingClientRect(),_=S.clientX-T.left;if(_>Qn){let M=(_-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(Ale,{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(Ple,{ticks:a,heightPx:v,highlight:c})})]})}function eS(t){let e=t.target;for(;e;){if(e.dataset?.pptxElement==="true")return e.dataset.elementId||null;e=e.parentElement;}return null}var Dqe=300;function Dle({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 _=n[T];if(_.slideIndex!==o)continue;C.has(_.elementId)||C.set(_.elementId,new Map);let M=C.get(_.elementId);M.has(_.segmentIndex)||M.set(_.segmentIndex,[]),M.get(_.segmentIndex).push({startOffset:_.startOffset,length:_.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=eS(C);T&&t.current.onClick(T,C);},[t]),d=useCallback(C=>{let T=eS(C);T&&t.current.onDoubleClick(T,C);},[t]),p=useRef(false),f=useCallback(C=>{if(p.current){p.current=false;return}let T=eS(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=eS(C);if(T){let _=C.timeStamp||Date.now(),M=h.current;if(M&&M.id===T&&_-M.time<Dqe){h.current=null,t.current.onDoubleClick(T,C);return}h.current={id:T,time:_},t.current.onMouseDown(T,C);return}h.current=null,e?.(C);},[t,e]),x=useCallback(C=>{let T=eS(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 _=T.getBoundingClientRect(),M=s.editorScale||1,A=y.axis==="h"?(C.clientY-_.top)/M:(C.clientX-_.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 Lle({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),_=Math.sqrt(C*C+T*T),M=_<100?"straightConnector1":_<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 Fle({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 _=n.canvasStageRef.current;if(!_)return null;let M=_.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 _=[`M ${T[0].x} ${T[0].y}`];for(let M=1;M<T.length;M++)_.push(`L ${T[M].x} ${T[M].y}`);return _.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 _=x(T);_&&(T.preventDefault(),T.target.setPointerCapture(T.pointerId),d([_]),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 _=x(T);_&&(d(M=>[...M,_]),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 _=1/0,M=1/0,A=-1/0,R=-1/0;for(let D of u)D.x<_&&(_=D.x),D.y<M&&(M=D.y),D.x>A&&(A=D.x),D.y>R&&(R=D.y);let k=o;_-=k,M-=k,A+=k,R+=k;let N=Math.max(A-_,1),F=Math.max(R-M,1),B=u.map(D=>({x:D.x-_,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:_,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:_,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 Ble(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 PH({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:_,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}=Ble({onClick:_,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}=Dle({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}=Lle({activeSlide:t,zoom:r,onCreateConnector:Y}),{isDrawing:Ii,isStrokeActive:La,liveStrokeD:Qc,handleDrawPointerDown:eu,handleDrawPointerMove:ra,handleDrawPointerUp:oa}=Fle({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(kle,{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(Ele,{canvasSize:n,gridSpacingPx:y,visible:x}),jsx(xle,{guides:w,onDeleteGuide:xe,onStartGuideDrag:rt}),jsx(yle,{backgroundImage:t?.backgroundImage,backgroundGradient:t?.backgroundGradient}),e.map((Sr,pl)=>jsx(ok,{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?I_(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(ok,{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?I_(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(ble,{marqueeSelectionState:h}),ge&&Me&&Me.length>0&&jsx(wle,{comments:Me,canvasSize:n,onCommentMarkerClick:Te}),jsx(vle,{snapLines:m}),Xe&&t&&jsx(Cle,{activeSlide:t,canvasSize:n,zoom:r,connectorDragState:gt,onConnectionSiteDown:Nt,onConnectorDragMove:In,onConnectionSiteDrop:yn,onConnectorDragEnd:Zo}),Ii&&jsx(Mle,{canvasSize:n,activeTool:se,drawingColor:Ce,drawingWidth:ee,isStrokeActive:La,liveStrokeD:Qc,onPointerDown:eu,onPointerMove:ra,onPointerUp:oa}),V]})]})})}function kH({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(AU,{isOpen:t,onClose:c}),e&&jsx(PU,{isOpen:e,issues:r,onClose:u,reducedMotion:y,onToggleReducedMotion:v}),n&&jsx(X6,{slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onSelectSlide:d,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onClose:x})]}):null}function NH({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(K6,{activeSlide:t,allSlides:e,isExpanded:!n,canEdit:r,onToggle:l,onUpdateNotes:c,panelHeight:d}),!w&&jsx(IU,{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 DH({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:_,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(Q8,{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:_,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 $le(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 LH(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,_=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(()=>$le(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(F8,{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:_,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:JQ(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(u8,{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 pM={"\\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"},fM={"\\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"},hM={"\\sum":"\u2211","\\prod":"\u220F","\\int":"\u222B","\\iint":"\u222C","\\iiint":"\u222D","\\oint":"\u222E","\\coprod":"\u2210","\\bigcup":"\u22C3","\\bigcap":"\u22C2"},Hle=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 zle(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 Gle(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 Vle(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 jle(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 FH=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(pM[n]){let i=this.makeRun(pM[n]);return Zp(this,i)}if(fM[n])return this.makeRun(fM[n]);if(hM[n])return Gle(this,hM[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 Vle(this);if(n==="\\right")return null;let r=n.slice(1);if(Hle.has(r))return jle(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 PN(t){let e=t.trim();if(e.length===0)return {};let n=zle(e),o=new FH(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 BH={};for(let[t,e]of Object.entries(pM))BH[e]=t;var RN={};for(let[t,e]of Object.entries(fM))RN[e]||(RN[e]=t);var OH={};for(let[t,e]of Object.entries(hM))OH[e]||(OH[e]=t);function jqe(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 W0(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=jqe(t[n]);for(let o of r){let i=Xqe(n,o);i&&e.push(i);}}return e.join("")}function Xqe(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(BH[n])return `${BH[n]} `;if(RN[n])return `${RN[n]} `;let r=br(e,"m:rPr"),o=W0(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=W0(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=W0(br(n,"m:chr")),o=OH[r]??"\\int",i=W0(br(n,"m:subHide")),s=W0(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=W0(br(n,"m:begChr"))||"(",o=W0(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 UH(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 qle(t){let e=BPe;return typeof e.sanitize!="function"?t:e.sanitize(t,{USE_PROFILES:{mathMl:true,svg:true}})}var Kle=[{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"}],Jqe=Kle.map(t=>{try{let e=PN(t.latex),n=w1(e);return n?qle(n):""}catch{return ""}});function Qqe({mathml:t}){let e=useRef(null);return useEffect(()=>{e.current&&(t?e.current.innerHTML=qle(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 Zle({isOpen:t,onClose:e,onInsert:n,existingOmml:r}){let{t:o}=useTranslation(),i=useMemo(()=>r?UH(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=PN(l);return {mathml:w1(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(Qqe,{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:Kle.map((y,v)=>{let S=Jqe[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 HH=[{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"]}],Jle=[{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 tKe(){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 nKe(){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 rKe(){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 oKe(){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 iKe(){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 sKe(){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 aKe(){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 Qle(t){switch(t){case "basicBlockList":case "stackedList":case "tableList":case "horizontalBulletList":return jsx(tKe,{});case "basicChevronProcess":case "segmentedProcess":case "continuousBlockProcess":case "upwardArrow":return jsx(nKe,{});case "basicCycle":case "basicPie":return jsx(rKe,{});case "basicRadial":case "convergingRadial":return jsx(sKe,{});case "hierarchy":return jsx(oKe,{});case "basicVenn":case "linearVenn":return jsx(iKe,{});default:return jsx(aKe,{})}}function tce({isOpen:t,onClose:e,onInsert:n}){let{t:r}=useTranslation(),[o,i]=useState("list"),[s,a]=useState(null),l=HH.filter(u=>u.category===o),c=useCallback(()=>{if(!s)return;let u=HH.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:Jle.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:Qle(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 zH(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:_,onDiscardAnnotations:M}=t;return jsxs(Fragment,{children:[jsx(J6,{isOpen:i.isVersionHistoryOpen,filePath:u,onClose:()=>i.setIsVersionHistoryOpen(false),onRestore:i.handleRestoreVersion}),jsx(e8,{isOpen:i.isComparePanelOpen,compareResult:i.compareResult,canvasSize:c,onClose:()=>i.setIsComparePanelOpen(false),onAcceptSlide:i.handleAcceptSlide,onRejectSlide:i.handleRejectSlide,onAcceptAll:i.handleAcceptAllSlides}),jsx(n8,{isOpen:e.isPasswordDialogOpen,isCurrentlyProtected:e.isPasswordProtected,onClose:()=>e.setIsPasswordDialogOpen(false),onSetPassword:e.handleSetPassword,onRemovePassword:e.handleRemovePassword}),jsx(i8,{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(a8,{isOpen:e.isFontEmbeddingOpen,embedFontsEnabled:e.embedFontsEnabled,usedFontFamilies:i.usedFontFamilies,embeddedFonts:h.map(A=>A.name),onClose:()=>e.setIsFontEmbeddingOpen(false),onToggleEmbedFonts:e.setEmbedFontsEnabled}),jsx(c8,{isOpen:e.isDigitalSigDialogOpen,onClose:()=>e.setIsDigitalSigDialogOpen(false),hasSignatures:m,signatureCount:x}),jsx(d8,{isOpen:e.isSignatureStrippedDialogOpen,signatureCount:x,onConfirm:()=>e.setIsSignatureStrippedDialogOpen(false),onCancel:()=>e.setIsSignatureStrippedDialogOpen(false)}),jsx(p8,{isOpen:w,onClose:()=>C(false)}),jsx(tce,{isOpen:e.isSmartArtDialogOpen,onClose:()=>e.setIsSmartArtDialogOpen(false),onInsert:n.handleInsertSmartArt}),jsx(Zle,{isOpen:e.isEquationDialogOpen,onClose:()=>e.setIsEquationDialogOpen(false),onInsert:n.handleInsertEquation,existingOmml:e.editingEquationOmml}),jsx(TH,{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(kU,{isOpen:r.exportModalOpen,title:r.exportModalTitle,progress:r.exportProgress,statusMessage:r.exportStatusMessage,onCancel:r.handleCancelExport}),jsx(hH,{open:e.isSetUpSlideShowOpen,onClose:()=>e.setIsSetUpSlideShowOpen(false),properties:y,onSave:e.handleSaveSlideShowSettings,customShows:v,slideCount:a.length}),jsx(fH,{open:o.isPrintDialogOpen,onClose:()=>o.setIsPrintDialogOpen(false),onPrint:o.handlePrintWithSettings,slides:a,activeSlideIndex:l,defaultSlidesPerPage:y.printSlidesPerPage,defaultFrameSlides:y.printFrameSlides}),jsx(cH,{isOpen:T,annotationCount:Array.from(s.allSlideAnnotations.values()).reduce((A,R)=>A+R.length,0),slideCount:s.allSlideAnnotations.size,onKeep:_,onDiscard:M})]})}function VH(t){let{mode:e,slides:n,canvasSize:r,templateElements:o,presentation:i,onExitPresentation:s}=t;return jsxs(Fragment,{children:[e==="present"&&i.presenterMode&&jsx(b8,{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(S8,{presentationStartTime:i.presentationStartTime,slideStartTime:i.slideStartTime,paused:i.rehearsalPaused,onTogglePause:i.toggleRehearsalPause}),i.showRehearsalSummary&&jsx(w8,{slides:n,canvasSize:r,recordedTimings:i.recordedTimings,onSave:i.saveRehearsalTimings,onDiscard:i.dismissRehearsalSummary})]})}var xKe=50;function rce(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)<xKe||Math.abs(u)<=Math.abs(d)||(u<0?n():r());},[e,n,r]);return {onTouchStart:i,onTouchEnd:s}}function jH(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]),_=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&&Wg(H.url);},[e,y]),A=useCallback(U=>{if(CU(U)){if(e==="present"){let H=mee(U);if(H){let j={action:H.action,targetSlideIndex:H.targetSlideIndex};y.handlePresentationAction(j);}}return}Wg(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=rce({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(r$,{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(V6,{notesMaster:d.notesMaster,canvasSize:a,notesCanvasSize:d.notesCanvasSize}):e==="master"&&d.masterViewTab==="handout"?jsx(j6,{handoutMaster:d.handoutMaster,canvasSize:a,slidesPerPage:d.handoutSlidesPerPage}):jsx(PH,{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:_,collaborationOverlay:jsxs(Fragment,{children:[jsx(F6,{elements:w?.elements??[],activeSlideIndex:l}),jsx(D6,{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(tH,{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(lH,{visible:!!d.presentationProperties.showSubtitles}),e==="present"&&jsx(sH,{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(oH,{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",mM="w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:border-primary focus:outline-none",sce="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",ace="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 IN=[{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"}],q0=["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 lce({editColors:t,canEdit:e,activePickerKey:n,majorFont:r,minorFont:o,onSetActivePickerKey:i,onColorChange:s,onMajorFontChange:a,onMinorFontChange:l}){let{t:c}=useTranslation(),u=useMemo(()=>fY(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:`${N1[p]}: ${t[p]}`,onClick:()=>i(n===p?null:p)}),jsx("span",{className:"text-[9px] text-muted-foreground truncate w-full text-center",children:N1[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:N1[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:mM,disabled:!e,value:q0.includes(r)?r:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&a(p.target.value);},children:[q0.map(p=>jsx("option",{value:p,children:p},p)),!q0.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:mM,disabled:!e,value:q0.includes(o)?o:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&l(p.target.value);},children:[q0.map(p=>jsx("option",{value:p,children:p},p)),!q0.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 MKe=["accent1","accent2","accent3","accent4","accent5","accent6"];function uce({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:IN.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:MKe.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 dce({theme:t,canEdit:e,onUpdateColorScheme:n,onUpdateFontScheme:r,onUpdateThemeName:o,onApplyToPresentation:i,onClose:s}){let{t:a}=useTranslation(),[l,c]=useState(()=>t?.colorScheme??IN[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]),_=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:mM,disabled:!e,value:h,onChange:M=>_(M.target.value),placeholder:a("pptx.themeEditor.themeNamePlaceholder")})]}),jsx(uce,{canEdit:e,currentThemeName:h,onSelectPreset:S}),jsx(lce,{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:sce,onClick:i,children:a("pptx.themeEditor.applyToPresentation")}),jsx("button",{type:"button",disabled:!e,className:ace,onClick:w,children:a("pptx.themeEditor.reset")})]})]})}var XH=[{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 WH({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 fce({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:XH.map(f=>jsx(WH,{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 YH(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(DH,{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(T8,{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(dce,{theme:c.theme,canEdit:n,onUpdateColorScheme:h.handleUpdateThemeColorScheme,onUpdateFontScheme:h.handleUpdateThemeFontScheme,onUpdateThemeName:h.handleUpdateThemeName,onApplyToPresentation:h.handleApplyThemeToPresentation,onClose:()=>c.setIsThemeEditorOpen(false)})}),jsx(fce,{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 qH(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:_=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(D2,{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(G6,{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(jH,{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(DU,{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(YH,{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 mce({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 gce({open:t,onClose:e,...n}){return jsx(ZI,{open:t,onClose:e,heightFraction:.7,title:"Slides",children:jsx("div",{className:"h-full",children:jsx(D2,{...n})})})}function yce(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(gce,{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(mce,{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 iS({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 vce({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(iS,{label:x("pptx.settings.autoSave"),enabled:h,onToggle:()=>m(!h)}),jsx(iS,{label:x("pptx.settings.spellCheck"),enabled:n,onToggle:()=>r?.(!n)}),jsx(iS,{label:x("pptx.settings.showGrid"),enabled:o,onToggle:()=>i?.(!o)}),jsx(iS,{label:x("pptx.settings.showRulers"),enabled:s,onToggle:()=>a?.(!s)}),jsx(iS,{label:x("pptx.settings.snapToGrid"),enabled:l,onToggle:()=>c?.(!l)}),jsx(iS,{label:x("pptx.settings.reducedMotion"),enabled:u,onToggle:()=>d?.()})]}),p==="shortcuts"&&jsx("div",{className:"space-y-0.5",children:g_.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 wce({localClientId:t,handleUndo:e,handleRedo:n,canUndo:r,canRedo:o}){let i=useRef(0),s=useCallback(()=>{r&&(e(),i.current=Math.max(0,i.current-1));},[e,r]),a=useCallback(()=>{o&&(n(),i.current+=1);},[n,o]);return {handleUndo:s,handleRedo:a,canUndo:r,canRedo:o}}function JH({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 QH({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 eZe(t){if(t){let e=Math.round(t.cx/9525);if(e>0)return e}return 8}function tZe(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 nZe(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:GW,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 rZe(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 Tce(t){let{slides:e,sections:n,customShows:r,activeCustomShowId:o,mode:i,activeLayout:s,activeMaster:a,presentationGridSpacing:l}=t,c=useMemo(()=>eZe(l),[l]),u=useMemo(()=>tZe(e,o,r),[e,o,r]),d=useMemo(()=>nZe(e,n),[e,n]),p=useMemo(()=>rZe(i,s,a),[i,s,a]);return {gridSpacingPx:c,visibleSlideIndexes:u,slideSectionGroups:d,masterPseudoSlide:p}}var oZe=120;function Ece(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,_]=useState(false),[M,A]=useState(false),[R,k]=useState(void 0),[N,F]=useState(void 0),[B,D]=useState(false),O=useCallback(()=>{_(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(h_),templateElementsBySlideId:m_(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(h_)),p(m_(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>oZe&&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 FN(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=aie(a),c=E0(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=aie(i),a=H2(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?AI(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 aie(t){return t.notesSegments&&t.notesSegments.length>0?t.notesSegments:Dv(t.notes??"")}function uie({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 pie({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(uie,{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 fie({activeSlide:t,isExpanded:e,canEdit:n,onToggle:r,onUpdateNotes:o}){let i=useMemo(()=>t?.notesSegments&&t.notesSegments.length>0?Lv(t.notesSegments):Dv(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?Lv(t.notesSegments):Dv(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=sie(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]),_=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=Dv(te);a(te),c(se),_(te,se);},[_]),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=iie(v.current),te=H2(W);a(te),c(W),_(te,W);},[_]),k=useCallback(()=>{T(s,l);},[s,l,T]),N=useCallback(W=>{if(!v.current)return;let te=rie(v.current,l),se=E0(l);te>=0&&te<se.length&&(se[te]=W(se[te],te));let Ce=nie(se),ee=H2(Ce);a(ee),c(Ce),_(ee,Ce);},[l,_]),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(),Wg(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 K6=({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:_,applyRichCommand:M,toggleBulletList:A,toggleNumberedList:R,handleIndent:k,handleOutdent:N,handleLinkButtonClick:F,handleInsertLink:B,handleEditorClick:D}=fie({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(pie,{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:_,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?AI(c):jsx("span",{className:"italic text-muted-foreground",children:a("pptx.notes.noNotes")})})]}),h&&e&&jsx(lie,{slides:e,onClose:()=>m(false)})]})};var vGe="pptx-viewer-autosave",SGe=1,Bv="recoveryVersions";function hie(){return new Promise((t,e)=>{let n=indexedDB.open(vGe,SGe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(Bv)||r.createObjectStore(Bv,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function wGe(t){try{let e=await hie();return new Promise(n=>{let i=e.transaction(Bv,"readonly").objectStore(Bv).get(t);i.onsuccess=()=>{e.close();let s=i.result;n(s?[s]:[]);},i.onerror=()=>{e.close(),n([]);};})}catch{return []}}async function CGe(t){try{let e=await hie();return new Promise(n=>{let r=e.transaction(Bv,"readwrite");r.objectStore(Bv).delete(t),r.oncomplete=()=>{e.close(),n();},r.onerror=()=>{e.close(),n();};})}catch{}}function TGe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function MGe(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function EGe(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 J6({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 wGe(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 CGe(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:MGe(x.timestamp)}),jsx("div",{className:"text-[10px] text-muted-foreground",children:EGe(x.timestamp)})]}),jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:TGe(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 FGe({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 gie({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(FGe,{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 e8({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(gie,{diff:x,diffIndex:y,canvasSize:n,accepted:!!l[y],rejected:!!u[y],onAccept:p,onReject:f},`diff-${y}-${x.status}`))})]})}function XGe(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 WGe=["bg-red-500","bg-orange-500","bg-yellow-500","bg-lime-500","bg-green-500"];function n8({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(()=>XGe(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?WGe[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 JGe=[{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 r8({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:JGe.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 tVe=[{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 nVe(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 rVe(t,e,n){return t==="totalTime"?nVe(e,n):e==null?n("pptx.documentProperties.statistics.notAvailable"):String(e)}function o8({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:tVe.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:rVe(i,t[i],r)})]},i))})}var bie=[{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 i8({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(_=>({..._}))),h({company:r?.company,manager:r?.manager}),l("summary")),t!==m&&x(t);let y=useCallback((_,M)=>{u(A=>({...A,[_]:M}));},[]),v=useMemo(()=>{if(bie.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(_=>{h(M=>({...M,..._}));},[]),w=useCallback(()=>{let _=(f.company??"")!==(r?.company??"")||(f.manager??"")!==(r?.manager??"");i(c,d,_?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(_=>jsx("button",{type:"button",onClick:()=>l(_.id),className:`px-4 py-2 text-xs font-medium transition-colors ${a===_.id?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:s(_.labelKey)},_.id))}),jsxs("div",{className:"px-5 py-4 min-h-[280px]",children:[a==="summary"&&jsx("div",{className:"space-y-3",children:bie.map(({key:_,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[_]??"",onChange:R=>y(_,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[_]??"",onChange:R=>y(_,R.target.value)})]},_))}),a==="custom"&&jsx(r8,{customProperties:d,onUpdate:p}),a==="statistics"&&jsx(o8,{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 xVe(t){if(typeof document>"u")return false;try{return document.fonts.check(`12px "${t}"`)}catch{return false}}function a8({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)xVe(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 c8({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 u8({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 d8({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 p8({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 f8=10,h8=32,m8=2,Tie=14;function g8(t){return Math.max(f8,Math.min(h8,t))}function Mie(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function W2(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 Eie(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 UVe({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,_=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=oy(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),..._,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 $Ve(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 x8=Vn__default.memo(UVe,$Ve);function b8({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(Tie),v=useCallback(()=>{y(N=>g8(N+m8));},[]),S=useCallback(()=>{y(N=>g8(N-m8));},[]),w=t[e],C=e+1<t.length?t[e+1]:void 0,T=w?.notes??"",_=w?.notesSegments,M=_&&_.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(x8,{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:Mie(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:W2(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(x8,{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<=f8,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>=h8,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?Eie(_):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:`${W2(m)} (segment ${k+1})`,children:jsx("div",{className:"h-full bg-primary transition-[width] duration-1000 ease-linear",style:{width:`${R}%`}})})]})}function Rie(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 S8({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:Rie(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:Rie(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 kie(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 w8({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:kie(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:kie(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 s9e(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 T8({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]),_=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=s9e(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(),_(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 Fie="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=`${Fie} border-r border-border hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Js=`${Fie} 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 Bie=[{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})}],Oie=[{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"}],Uie=[{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`})}],$ie=[{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"}],Hie=[{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 $9e=[{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 OI(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:$9e.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 UI(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit;return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:Bie.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 $I(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 ije=[{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 HI(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:ije.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 zI(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 VI(t){return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:Oie.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 jI(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 Tje(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 Mje=["Arial","Calibri","Cambria","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana"],Eje=[8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,72,96];function XI(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}=Tje(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:Mje.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:Eje.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 WI(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:f1.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:[f1.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:Fm.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 YI(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 Jje(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 Qje=["#000000","#ffffff","#ff0000","#00aa00","#0000ff","#ff8800","#8800cc","#00cccc","#ff69b4","#808080"],eXe=["#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff","#ff0000","#000080","#008080","#008000","#800080"];function qI(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=Jje(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:$ie.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:Qje.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:eXe.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:Hie.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 KI(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 ZI({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 wXe=[{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 Jie(t){let{open:e,onClose:n}=t,[r,o]=useState("home");return jsx(ZI,{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:wXe.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(CXe,{active:r,...t})})]})})}function CXe({active:t,...e}){let n="flex flex-wrap items-center gap-2";switch(t){case "home":return jsx("div",{className:n,children:jsx(XI,{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(WI,{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(qI,{canEdit:e.canEdit,selectedElement:e.selectedElement,tableEditorState:e.tableEditorState,onUpdateTextStyle:e.onUpdateTextStyle})});case "draw":return jsx("div",{className:n,children:jsx(VI,{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(UI,{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($I,{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(HI,{isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector})});case "animations":return jsx("div",{className:n,children:jsx(OI,{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(YI,{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(zI,{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(KI,{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(jI,{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 ese(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(Jie,{open:l,onClose:()=>c(false),...t})]})}function tse({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 nse({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 rse({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(nse,{isActive:t==="present",onPresent:()=>e("present"),onPresenterView:r,onRehearse:o,onSetUpSlideShow:i,onBroadcast:s,onToggleSubtitles:a,showSubtitles:l})}function ose(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:Uie.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 ise(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(rse,{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(tse,{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(ose,{...t})]})}function F8(t){let{mode:e,isNarrowViewport:n,isCompactToolbarOpen:r,toolbarSection:o,onSetToolbarSection:i}=t;if(n&&e!=="present")return jsx(ese,{...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(ise,{...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:[VW.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(jI,{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(XI,{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(WI,{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(qI,{canEdit:t.canEdit,selectedElement:t.selectedElement,tableEditorState:t.tableEditorState,onUpdateTextStyle:t.onUpdateTextStyle}),d&&jsx(VI,{activeTool:t.activeTool,drawingColor:t.drawingColor,drawingWidth:t.drawingWidth,onSetActiveTool:t.onSetActiveTool,onSetDrawingColor:t.onSetDrawingColor,onSetDrawingWidth:t.onSetDrawingWidth}),u&&jsx(UI,{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($I,{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(HI,{isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector}),h&&jsx(OI,{canEdit:t.canEdit,selectedElement:t.selectedElement,isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector,onOpenAnimationPanel:t.onOpenAnimationPanel,onAddAnimation:t.onAddAnimation,onRemoveAnimation:t.onRemoveAnimation}),m&&jsx(YI,{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(zI,{canEdit:t.canEdit,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,onToggleComments:t.onToggleComments,isCommentsPanelOpen:t.isCommentsPanelOpen,slideCommentCount:t.slideCommentCount,onCompare:t.onCompare}),y&&jsx(KI,{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 eN="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]",sse=x_.filter(t=>t.value==="fadeIn"||t.value==="flyIn"||t.value==="zoomIn"),ase=x_.filter(t=>t.value==="fadeOut"||t.value==="flyOut"||t.value==="zoomOut"),lse=x_.filter(t=>t.value==="spin"||t.value==="pulse"||t.value==="colorWave"||t.value==="bounce"||t.value==="flash"||t.value==="growShrink"||t.value==="teeter"),cse=[{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"}],use=[{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"}],dse=[{value:"none",labelKey:"pptx.animation.repeatUntil.none"},{value:"untilNextClick",labelKey:"pptx.animation.repeatUntil.untilNextClick"},{value:"untilEndOfSlide",labelKey:"pptx.animation.repeatUntil.untilEndOfSlide"}],pse=[{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}],fse=[{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 uWe(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 dWe(t){return t.entrance??t.emphasis??t.exit??"custom"}function mse({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",uWe(S.anim),S.anim.elementId===t&&"ring-1 ring-primary"),style:{left:`${S.leftPercent}%`,width:`${Math.max(S.widthPercent,2)}%`},title:`${v(S.anim)} - ${dWe(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 B8=new Set(["flyIn","flyOut"]);function xse({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 yse({selectedElementId:t,selectedElementAnimation:e}){let n=useCallback(i=>{let s=i.entrance??i.emphasis??i.exit;!s||s==="none"||mU(i.elementId,s,{direction:i.direction,durationMs:i.durationMs??500,timingCurve:i.timingCurve});},[]),r=useCallback(()=>gU(),[]),o=useCallback(()=>{if(!e)return;let i=e.entrance??e.emphasis??e.exit;!i||i==="none"||mU(t,i,{direction:e.direction,durationMs:e.durationMs??500,timingCurve:e.timingCurve});},[t,e]);return {handleAnimationHover:n,handleAnimationHoverEnd:r,handlePreviewClick:o}}function bse({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=yse({selectedElementId:t.id,selectedElementAnimation:o}),T=xse({canEdit:n,updateAnimations:s}),_=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&&(B8.has(o?.entrance??"")||B8.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:_,...C,...T}}function vse({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=bse({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")}),sse.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")}),lse.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")}),ase.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:pse.map(T=>{let _=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(_,{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:fse.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:cse.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:eN})]}),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:eN})]}),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:use.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:eN})]}),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:dse.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]})]}),jsx(mse,{selectedElementId:t.id,canEdit:n,handlers:i})]})}var Sse=[{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",wse=[["X","x"],["Y","y"],["W","width"],["H","height"]];var SWe=[{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 Tse({selectedElement:t,slides:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.actionClick?U5(t.actionClick,"click"):void 0,s=t.actionHover?U5(t.actionHover,"hover"):void 0,a=i?.type??"none",l=s?.type??"none",c=(u,d,p,f)=>{let m=i_({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(Cse,{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(Cse,{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 Cse({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:SWe.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 $v="text-[11px] uppercase tracking-wide text-muted-foreground",Hv="rounded border border-border bg-card p-2 space-y-2",zv="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",H8="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",tN="bg-muted border border-border rounded px-1 py-0.5 text-[11px] w-full text-center",Mse=[{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"}],Ese=[{value:"clustered",labelKey:"pptx.chart.groupingClustered"},{value:"stacked",labelKey:"pptx.chart.groupingStacked"},{value:"percentStacked",labelKey:"pptx.chart.groupingPercentStacked"}],_se=[{value:"t",labelKey:"pptx.chart.legendTop"},{value:"b",labelKey:"pptx.chart.legendBottom"},{value:"l",labelKey:"pptx.chart.legendLeft"},{value:"r",labelKey:"pptx.chart.legendRight"}],Ase=new Set(["bar","line","area"]);function kse({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:Hv,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:$v,children:u("pptx.chart.data")}),n&&jsxs("div",{className:"flex gap-1",children:[jsxs("button",{type:"button",className:H8,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:H8,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:tN,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:tN,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:tN,value:f.values[p]??0,onChange:m=>i(h,p,m.target.value)})},h))]},p))})]})})]})}function Ise({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:Hv,children:[jsx("div",{className:$v,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:zv,value:t.legendPosition??"b",onChange:o=>n({legendPosition:o.target.value}),children:_se.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 Nse({title:t,chartType:e,grouping:n,seriesCount:r,categoryCount:o,canEdit:i,onUpdateChartData:s}){let{t:a}=useTranslation(),l=Ase.has(e);return jsxs("div",{className:Hv,children:[jsx("div",{className:$v,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:zv,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:zv,value:e,onChange:c=>s({chartType:c.target.value}),children:Mse.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:zv,value:n??"clustered",onChange:c=>s({grouping:c.target.value}),children:Ese.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]})]})}function Dse({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=DX(r,w.chartType),{chartType:T,..._}=w;u({...C,..._});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((_,M)=>M===w?{..._,...C}:_);d({series:T});},[a,d]),h=useCallback((w,C)=>{if(!s)return;let T=s.map((_,M)=>M===w?C:_);d({categories:T});},[s,d]),m=useCallback((w,C,T)=>{if(!r)return;let _=Number.parseFloat(T);Number.isFinite(_)&&u(NX(r,w,C,_));},[r,u]),x=useCallback(()=>{!r||!s||u(LX(r,`Cat ${s.length+1}`));},[r,s,u]),y=useCallback(w=>{!r||!s||s.length<=1||u(FX(r,w));},[r,s,u]),v=useCallback(()=>{!r||!s||!a||u(kX(r,{name:`Series ${a.length+1}`,values:s.map(()=>0)}));},[r,s,a,u]),S=useCallback(w=>{!r||!a||a.length<=1||u(IX(r,w));},[r,a,u]);return !r||!s||!a?null:jsxs(Fragment,{children:[jsx(Nse,{title:o,chartType:i,grouping:c,seriesCount:a.length,categoryCount:s.length,canEdit:e,onUpdateChartData:d}),jsx(Ise,{style:l,canEdit:e,onUpdateStyle:p}),jsx(kse,{categories:s,series:a,canEdit:e,onUpdateSeries:f,onUpdateCategoryLabel:h,onUpdateValue:m,onAddCategory:x,onRemoveCategory:y,onAddSeries:v,onRemoveSeries:S})]})}function Lse({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 Fse({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 Bse({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:jj(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 Ose({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 Use({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 Hse({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 jse({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 Xse({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 qse({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 Kse({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(qse,{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(qse,{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:Nee.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 Zse({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 iN({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 Qse({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(iN,{label:"Brightness",disabled:!e,value:o?.brightness??0,onChange:s=>i({brightness:s})}),jsx(iN,{label:"Contrast",disabled:!e,value:o?.contrast??0,onChange:s=>i({contrast:s})}),jsx(iN,{label:r("pptx.image.saturation"),disabled:!e,value:o?.saturation??0,onChange:s=>i({saturation:s})})]}),jsx(Zse,{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(Kse,{selectedElement:t,canEdit:e,onUpdateElement:n})]}),jsx(Xse,{fx:o,canEdit:e,updateEffects:i}),jsx(jse,{fx:o,canEdit:e,updateEffects:i}),jsx(Hse,{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 GWe="text-[11px] uppercase tracking-wide text-muted-foreground",VWe="rounded border border-border bg-card p-2 space-y-2",jWe="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",XWe="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",WWe="flex items-center justify-between gap-2",oae="text-muted-foreground";function sN(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 nae(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 YWe(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 rae({label:t,valueMs:e,maxMs:n,disabled:r,onChange:o}){let[i,s]=useState(null),[a,l]=useState(false),c=i??sN(e),u=useCallback(()=>{s(sN(e)),l(false);},[e]),d=useCallback(()=>{if(i!==null){let h=nae(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=nae(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] ${oae}`,children:t}),jsx("input",{type:"text",disabled:r,className:`${jWe} text-[11px] tabular-nums ${a?"border-red-400":""}`,value:c,placeholder:"00:00",onFocus:u,onBlur:d,onChange:p,onKeyDown:f})]})}function iae({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?sN(a):sN(m-h)},[i,s,a]),c=useMemo(()=>YWe(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:VWe,children:[jsxs("div",{className:GWe,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(rae,{label:o("pptx.media.trimStartTime"),valueMs:i,maxMs:a,disabled:!e,onChange:d}),jsx(rae,{label:o("pptx.media.trimEndTime"),valueMs:s,maxMs:a,disabled:!e,onChange:p})]}),jsxs("div",{className:WWe,children:[jsxs("span",{className:`text-[11px] ${oae}`,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:`${XWe} 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 sae(){return `bmk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var Wv="text-[11px] uppercase tracking-wide text-muted-foreground",Yv="rounded border border-border bg-card p-2 space-y-2",nM="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",aN="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 aae({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 _=Math.min(T,p-.1);s(Math.max(0,_)*1e3,n);}else {let _=Math.max(T,d+.1);s(e,Math.min(_,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 cae({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:sae(),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:Yv,children:[jsx("div",{className:Wv,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:`${nM} 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:`${nM} 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:`${nM} 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:Yv,children:[jsxs("div",{className:Wv,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:`${nM} 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:aN,onClick:u,title:s("pptx.media.addBookmark"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function dae({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);},_=()=>a(true),M=()=>a(false),A=()=>a(false);return w.addEventListener("timeupdate",C),w.addEventListener("durationchange",T),w.addEventListener("loadedmetadata",T),w.addEventListener("play",_),w.addEventListener("pause",M),w.addEventListener("ended",A),()=>{w.removeEventListener("timeupdate",C),w.removeEventListener("durationchange",T),w.removeEventListener("loadedmetadata",T),w.removeEventListener("play",_),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 _=w.querySelector("source");_?.type&&(T.codecInfo=_.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:Yv,children:[jsx("div",{className:Wv,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:aN,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(aae,{duration:u,trimStartMs:t.trimStartMs??0,trimEndMs:t.trimEndMs??0,currentTime:l,bookmarks:f,canEdit:n,onTrimChange:y,onSeek:x})]}),jsx(iae,{element:t,canEdit:n,durationSeconds:u,onUpdateElement:r}),(v||t.posterFrameData)&&jsxs("div",{className:Yv,children:[jsxs("div",{className:Wv,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(cae,{element:t,canEdit:n,currentTime:l,bookmarks:f,onUpdateElement:r,onSeekTo:x})]})}function pae({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:f1.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(j8,{label:"B",active:!!t.textStyle?.bold,disabled:!e,onClick:()=>o({bold:!t.textStyle?.bold})}),jsx(j8,{label:"I",active:!!t.textStyle?.italic,disabled:!e,italic:true,onClick:()=>o({italic:!t.textStyle?.italic})}),jsx(j8,{label:"U",active:!!t.textStyle?.underline,disabled:!e,underline:true,onClick:()=>o({underline:!t.textStyle?.underline})})]})]})]})]})}function j8({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 p7e(){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 f7e(){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 h7e(){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 m7e(){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 g7e(){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 x7e(){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 fae={process:p7e,hierarchy:f7e,cycle:h7e,matrix:m7e,pyramid:g7e,list:x7e};var b7e=rW.map(t=>({type:t,i18nKey:`pptx.smartart.category.${t}`}));function mae({smartArtData:t,canEdit:e,onUpdateSmartArt:n}){let{t:r}=useTranslation(),o=t.resolvedLayoutType??"list",i=s=>{if(!e||s===o)return;let a=oW(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:b7e.map(({type:s,i18nKey:a})=>{let l=o===s,c=fae[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 S7e=["colorful1","colorful2","colorful3","monochromatic1","monochromatic2"],w7e=["flat","moderate","intense"];function gae({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(_X(t,h,m));},l=()=>{s($5(t));},c=h=>{s($5(t,h,"Sub-item"));},u=h=>{s(EX(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(mae,{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:S7e.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:w7e.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 xae(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 yae(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 bae(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 cN="bg-muted border border-border rounded px-2 py-1 text-[11px] w-full",uN="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full text-[11px]",Vp="text-muted-foreground text-[11px]",vae="text-[11px] uppercase tracking-wide text-muted-foreground",Sae=[{value:"solid",i18nKey:"pptx.table.fillSolid"},{value:"gradient",i18nKey:"pptx.table.fillGradient"},{value:"pattern",i18nKey:"pptx.table.fillPattern"},{value:"none",i18nKey:"pptx.table.fillNone"}],wae=[{value:"linear",i18nKey:"pptx.table.gradientLinear"},{value:"radial",i18nKey:"pptx.table.gradientRadial"}],Cae=mF.slice(0,20);function Tae({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:cN,value:o,onChange:s=>i(s.target.value),children:Sae.map(s=>jsx("option",{value:s.value??"",children:r(s.i18nKey)},s.value))})]}),o==="gradient"&&jsx(C7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),o==="pattern"&&jsx(T7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),jsxs("div",{className:"space-y-1",children:[jsx("span",{className:vae,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:uN,min:0,max:200,value:t[s]??0,onChange:l=>n({[s]:Number(l.target.value)})})]},s))})]})]})}function C7e({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:cN,value:i,onChange:l=>n({gradientFillType:l.target.value}),children:wae.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:uN,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:uN,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 T7e({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:cN,value:t.patternFillPreset??"ltDnDiag",onChange:o=>n({patternFillPreset:o.target.value}),children:Cae.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 Mae({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(Tae,{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=xae(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=yae(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=bae(t,i,s);u&&r({rows:u});},children:o("pptx.table.split")})]})]})]})}function Eae({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:XW.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(Mae,{tableData:i,tableEditorState:r,canEdit:e,onUpdateTableData:l})]})}function _ae({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:wse.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(Eae,{tableElement:t,canEdit:e,onUpdateElement:i,tableEditorState:r}),t.type==="chart"&&jsx(Dse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="smartArt"&&t.smartArtData&&jsx(gae,{smartArtData:t.smartArtData,canEdit:e,onUpdateElement:i}),yi(t)&&jsx(Qse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="media"&&jsx(dae,{element:t,mediaDataUrls:o??new Map,canEdit:e,onUpdateElement:i}),jsx(Lse,{selectedElement:t,canEdit:e,onUpdateElementStyle:s}),jsx(Fse,{selectedElement:t}),jsx(Bse,{selectedElement:t}),jsx(pae,{selectedElement:t,canEdit:e,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a}),jsx(Tse,{selectedElement:t,slides:n,canEdit:e,onUpdateElement:i}),jsx(Ose,{selectedElement:t,canEdit:e,onUpdateElement:i}),jsx(Use,{canEdit:e,onMoveLayer:l})]})}function Y8({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]??"",[_,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:Y7(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:[_?jsx(LuChevronDown,{className:"h-3 w-3"}):jsx(LuChevronRight,{className:"h-3 w-3"}),S("pptx.comments.repliesCount",{count:A.length})]}),_&&jsx("div",{className:"mt-1.5 space-y-1.5",children:A.map((k,N)=>jsx(Y8,{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 Rae({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(Y8,{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 q8({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 dN({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 H7e({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 kae({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(q8,{label:"Notes Size",value:t?`${t.width} \xD7 ${t.height}px`:"Not available"}),jsx(q8,{label:"Notes Master",value:e?`${e.placeholders?.length??0} placeholders`:"Not available"}),jsx(q8,{label:"Handout Master",value:n?`${n.placeholders?.length??0} placeholders`:"Not available"})]})]})}function Iae({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(dN,{label:"Title",disabled:!r,value:t?.title??"",onChange:a=>o({title:a})}),jsx(dN,{label:"Author",disabled:!r,value:t?.creator??"",onChange:a=>o({creator:a})}),jsx(dN,{label:"Company",disabled:!r,value:e?.company??"",onChange:a=>i({company:a})}),jsx(dN,{label:"Application",disabled:!r,value:e?.application??"",onChange:a=>i({application:a})}),jsx(H7e,{customProperties:n,canEdit:r,onUpdate:s})]})]})}function pN({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 Nae({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(pN,{label:"Loop Continuously",disabled:!e,checked:!!t.loopContinuously,onChange:r=>n({loopContinuously:r})}),jsx(pN,{label:"Show Narration",disabled:!e,checked:t.showWithNarration!==false,onChange:r=>n({showWithNarration:r})}),jsx(pN,{label:"Show Animation",disabled:!e,checked:t.showWithAnimation!==false,onChange:r=>n({showWithAnimation:r})}),jsx(pN,{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 Dae({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 Lae({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 Fae={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 Bae({activeSlide:t,theme:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=t?.clrMapOverride,s=TX(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:Fae[d],children:Fae[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 Oae({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 Uae({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:_}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsx(Nae,{presentationProperties:t,canEdit:e,onUpdate:n}),jsx(Dae,{themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,canEdit:e,onApplyTheme:s}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:_("pptx.themeOverride.heading")}),jsx(Bae,{activeSlide:a,theme:l,canEdit:e,onUpdateSlide:c})]}),jsx(Lae,{canvasSize:u,canEdit:e,onUpdate:d}),jsx(kae,{notesCanvasSize:p,notesMaster:f,handoutMaster:h}),jsx(Iae,{coreProperties:m,appProperties:y,customProperties:S,canEdit:e,onUpdateCoreProperties:x,onUpdateAppProperties:v,onUpdateCustomProperties:w}),C&&T&&jsx(Oae,{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 $ae({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(J7e,{activeSlide:t,slideMasters:o,canEdit:e,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s})]})}function J7e({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 Q8(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:_,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=_[0]?.path??"";V(Ye=>Ye||Se);},[xe,_]),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:Sse.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(_ae,{selectedElement:s,canEdit:n,slides:o,tableEditorState:l,mediaDataUrls:Y,onUpdateElement:p,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onMoveLayer:h}):jsxs(Fragment,{children:[jsx(Uae,{canEdit:n,canvasSize:i,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:_,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($ae,{activeSlide:r,canEdit:n,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe})]})}),c==="comments"&&jsx(Rae,{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(vse,{selectedElement:s,activeSlide:r,canEdit:n,onUpdateSlide:Te})})]})]})]})}function oYe(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 iYe(t){switch(t){case "laser":return "none";case "pen":return "crosshair";case "highlighter":return "crosshair";case "eraser":return "crosshair";default:return "default"}}function tH({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 _=T.getBoundingClientRect(),M=(w-_.left)/e,A=(C-_.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:iYe(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:oYe(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 Gae(t,e){return `${t+1} / ${e}`}var bYe=["#ff0000","#0000ff","#00aa00","#ff8800","#ffffff","#000000","#ff00ff","#00cccc"],vYe=["#ffff00","#00ff00","#ff69b4","#00bfff","#ff8c00","#adff2f","#ff6347","#87ceeb"];function oH({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 _=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:Gae(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:W2(_)})]}),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:bYe.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:vYe.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 Xae=768,Wae=1024;function wYe(){return typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints!==null&&navigator.msMaxTouchPoints>0}function CYe(t){if(typeof window>"u")return ()=>{};let e=()=>t();return window.addEventListener("pointerdown",e,{once:true}),()=>window.removeEventListener("pointerdown",e)}function Yae(){return typeof window>"u"?"landscape":typeof screen<"u"&&screen.orientation?screen.orientation.type.startsWith("portrait")?"portrait":"landscape":window.innerHeight>window.innerWidth?"portrait":"landscape"}function gN(t){let e=t?.containerRef,n=useSyncExternalStore(CYe,wYe,()=>false),[r,o]=useState(()=>typeof window>"u"?1024:e?.current?.clientWidth??window.innerWidth),[i,s]=useState(Yae),[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(Yae());};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<Xae,d=r>=Xae&&r<Wae,p=r>=Wae;return {isMobile:u,isTablet:d,isDesktop:p,isTouchDevice:n,orientation:i,isVirtualKeyboardOpen:a,containerWidth:r}}function sH({currentSlideIndex:t,totalSlides:e,onMovePresentationSlide:n,onEndPresentation:r}){let{t:o}=useTranslation(),{isTouchDevice:i}=gN();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 lH({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 cH({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 DYe=.48,LYe=6,Jae=16/9;function FYe(t,e,n=jc){let r=n.width-n.marginLeft-n.marginRight,o=n.height-n.marginTop-n.marginBottom,i=o*DYe,s=r,a=s/Jae;a>i&&(a=i,s=a*Jae);let l=(r-s)/2,c=(i-a)/2,u=i+LYe,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 uH(t){return t.map((e,n)=>FYe(n,e))}function dH(){return {width:jc.width-jc.marginLeft-jc.marginRight,height:jc.height-jc.marginTop-jc.marginBottom}}var ic=.9,ele=5;function pH({slideIndices:t,slides:e,frameSlides:n,maxPages:r=3}){let{t:o}=useTranslation(),i=useMemo(()=>uH(t),[t]),s=useMemo(()=>dH(),[]),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:ele},(h,m)=>{let x=u.textArea.height*ic/(ele+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 Qv=.9;function xN({slideIndices:t,slidesPerPage:e,orientation:n,frameSlides:r,maxPages:o=3}){let{t:i}=useTranslation(),s=useMemo(()=>yU(t,e,n),[t,e,n]),a=useMemo(()=>bU(n),[n]),l=s.slice(0,o),c=e===3,u=vU(),d=a.width*Qv,p=a.height*Qv,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*Qv,S=m.y*Qv,w=m.width*Qv,C=m.height*Qv;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},(_,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 yN=[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 ole({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:yN.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 fH({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(yN.includes(i)?i:6),[v,S]=useState("all"),[w,C]=useState(1),[T,_]=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(ole,{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:_,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(xN,{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(pH,{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 sle({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 ale({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 hH({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(ale,{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(sle,{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 bH({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]),_=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(lqe,{collab:c,broadcastUrl:w,copied:y,onCopyUrl:C,onStopBroadcast:_}):jsx(aqe,{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 aqe({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 lqe({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 ule(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 CH({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]),_=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(gqe,{collab:c,activeCollaboration:n,copied:v,onCopyRoomId:C,onStopCollaboration:o}):jsx(mqe,{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:!_,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 mqe({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 gqe({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:ule(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"}):ule(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 wN={"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"},dle={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 ple(t,e){return e&&e.startsWith("ppaction://")?e.includes("hlinksldjump")?"slide":(wN[e.toLowerCase()],"action"):t?t.startsWith("mailto:")?"email":/^[a-zA-Z]:\\|^\.\.?[/\\]|^file:/i.test(t)?"file":"url":"url"}function fle(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 hle(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 mle(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:dle[t.actionVerb],tooltip:e};default:return {url:t.url,tooltip:e}}}function gle({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 TH({open:t,initialUrl:e,initialTooltip:n,initialAction:r,slideCount:o,onConfirm:i,onCancel:s}){let{t:a}=useTranslation(),l=useRef(null),c=ple(e,r),u=fle(e||""),d=hle(e,r),p=r&&wN[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),[_,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:_,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(gle,{targetType:f,url:m,setUrl:x,tooltip:y,setTooltip:v,emailAddress:S,setEmailAddress:w,emailSubject:C,setEmailSubject:T,slideNumber:_,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 xle({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 yle({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 ble({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 vle({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 wle({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=q7(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 Cle({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(Mqe,{activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r})]})}function Mqe({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 Mle({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 Ele({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,lM=10;function EH(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 Ale=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:lM+1,fontSize:lM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})}),Ple=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+lM+2,fontSize:lM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})});function kle({canvasSize:t,editorScale:e,unit:n,visible:r,selectedBounds:o,onCreateGuideFromRuler:i}){let s=useMemo(()=>EH(t.width,e,n),[t.width,e,n]),a=useMemo(()=>EH(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(),_=S.clientY-T.top;if(_>Qn){let M=(_-Qn)/w;M>=0&&M<=t.height&&i("h",M);}}else {let C=f.current;if(!C){d(null);return}let T=C.getBoundingClientRect(),_=S.clientX-T.left;if(_>Qn){let M=(_-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(Ale,{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(Ple,{ticks:a,heightPx:v,highlight:c})})]})}function eS(t){let e=t.target;for(;e;){if(e.dataset?.pptxElement==="true")return e.dataset.elementId||null;e=e.parentElement;}return null}var Dqe=300;function Dle({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 _=n[T];if(_.slideIndex!==o)continue;C.has(_.elementId)||C.set(_.elementId,new Map);let M=C.get(_.elementId);M.has(_.segmentIndex)||M.set(_.segmentIndex,[]),M.get(_.segmentIndex).push({startOffset:_.startOffset,length:_.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=eS(C);T&&t.current.onClick(T,C);},[t]),d=useCallback(C=>{let T=eS(C);T&&t.current.onDoubleClick(T,C);},[t]),p=useRef(false),f=useCallback(C=>{if(p.current){p.current=false;return}let T=eS(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=eS(C);if(T){let _=C.timeStamp||Date.now(),M=h.current;if(M&&M.id===T&&_-M.time<Dqe){h.current=null,t.current.onDoubleClick(T,C);return}h.current={id:T,time:_},t.current.onMouseDown(T,C);return}h.current=null,e?.(C);},[t,e]),x=useCallback(C=>{let T=eS(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 _=T.getBoundingClientRect(),M=s.editorScale||1,A=y.axis==="h"?(C.clientY-_.top)/M:(C.clientX-_.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 Lle({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),_=Math.sqrt(C*C+T*T),M=_<100?"straightConnector1":_<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 Fle({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 _=n.canvasStageRef.current;if(!_)return null;let M=_.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 _=[`M ${T[0].x} ${T[0].y}`];for(let M=1;M<T.length;M++)_.push(`L ${T[M].x} ${T[M].y}`);return _.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 _=x(T);_&&(T.preventDefault(),T.target.setPointerCapture(T.pointerId),d([_]),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 _=x(T);_&&(d(M=>[...M,_]),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 _=1/0,M=1/0,A=-1/0,R=-1/0;for(let D of u)D.x<_&&(_=D.x),D.y<M&&(M=D.y),D.x>A&&(A=D.x),D.y>R&&(R=D.y);let k=o;_-=k,M-=k,A+=k,R+=k;let N=Math.max(A-_,1),F=Math.max(R-M,1),B=u.map(D=>({x:D.x-_,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:_,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:_,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 Ble(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 PH({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:_,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}=Ble({onClick:_,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}=Dle({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}=Lle({activeSlide:t,zoom:r,onCreateConnector:Y}),{isDrawing:Ii,isStrokeActive:La,liveStrokeD:Qc,handleDrawPointerDown:eu,handleDrawPointerMove:ra,handleDrawPointerUp:oa}=Fle({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(kle,{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(Ele,{canvasSize:n,gridSpacingPx:y,visible:x}),jsx(xle,{guides:w,onDeleteGuide:xe,onStartGuideDrag:rt}),jsx(yle,{backgroundImage:t?.backgroundImage,backgroundGradient:t?.backgroundGradient}),e.map((Sr,pl)=>jsx(ok,{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?I_(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(ok,{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?I_(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(ble,{marqueeSelectionState:h}),ge&&Me&&Me.length>0&&jsx(wle,{comments:Me,canvasSize:n,onCommentMarkerClick:Te}),jsx(vle,{snapLines:m}),Xe&&t&&jsx(Cle,{activeSlide:t,canvasSize:n,zoom:r,connectorDragState:gt,onConnectionSiteDown:Nt,onConnectorDragMove:In,onConnectionSiteDrop:yn,onConnectorDragEnd:Zo}),Ii&&jsx(Mle,{canvasSize:n,activeTool:se,drawingColor:Ce,drawingWidth:ee,isStrokeActive:La,liveStrokeD:Qc,onPointerDown:eu,onPointerMove:ra,onPointerUp:oa}),V]})]})})}function kH({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(AU,{isOpen:t,onClose:c}),e&&jsx(PU,{isOpen:e,issues:r,onClose:u,reducedMotion:y,onToggleReducedMotion:v}),n&&jsx(X6,{slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onSelectSlide:d,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onClose:x})]}):null}function NH({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(K6,{activeSlide:t,allSlides:e,isExpanded:!n,canEdit:r,onToggle:l,onUpdateNotes:c,panelHeight:d}),!w&&jsx(IU,{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 DH({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:_,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(Q8,{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:_,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 $le(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 LH(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,_=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(()=>$le(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(F8,{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:_,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:JQ(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(u8,{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 pM={"\\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"},fM={"\\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"},hM={"\\sum":"\u2211","\\prod":"\u220F","\\int":"\u222B","\\iint":"\u222C","\\iiint":"\u222D","\\oint":"\u222E","\\coprod":"\u2210","\\bigcup":"\u22C3","\\bigcap":"\u22C2"},Hle=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 zle(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 Gle(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 Vle(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 jle(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 FH=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(pM[n]){let i=this.makeRun(pM[n]);return Zp(this,i)}if(fM[n])return this.makeRun(fM[n]);if(hM[n])return Gle(this,hM[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 Vle(this);if(n==="\\right")return null;let r=n.slice(1);if(Hle.has(r))return jle(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 PN(t){let e=t.trim();if(e.length===0)return {};let n=zle(e),o=new FH(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 BH={};for(let[t,e]of Object.entries(pM))BH[e]=t;var RN={};for(let[t,e]of Object.entries(fM))RN[e]||(RN[e]=t);var OH={};for(let[t,e]of Object.entries(hM))OH[e]||(OH[e]=t);function jqe(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 W0(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=jqe(t[n]);for(let o of r){let i=Xqe(n,o);i&&e.push(i);}}return e.join("")}function Xqe(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(BH[n])return `${BH[n]} `;if(RN[n])return `${RN[n]} `;let r=br(e,"m:rPr"),o=W0(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=W0(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=W0(br(n,"m:chr")),o=OH[r]??"\\int",i=W0(br(n,"m:subHide")),s=W0(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=W0(br(n,"m:begChr"))||"(",o=W0(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 UH(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 qle(t){let e=BPe;return typeof e.sanitize!="function"?t:e.sanitize(t,{USE_PROFILES:{mathMl:true,svg:true}})}var Kle=[{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"}],Jqe=Kle.map(t=>{try{let e=PN(t.latex),n=w1(e);return n?qle(n):""}catch{return ""}});function Qqe({mathml:t}){let e=useRef(null);return useEffect(()=>{e.current&&(t?e.current.innerHTML=qle(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 Zle({isOpen:t,onClose:e,onInsert:n,existingOmml:r}){let{t:o}=useTranslation(),i=useMemo(()=>r?UH(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=PN(l);return {mathml:w1(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(Qqe,{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:Kle.map((y,v)=>{let S=Jqe[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 HH=[{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"]}],Jle=[{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 tKe(){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 nKe(){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 rKe(){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 oKe(){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 iKe(){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 sKe(){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 aKe(){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 Qle(t){switch(t){case "basicBlockList":case "stackedList":case "tableList":case "horizontalBulletList":return jsx(tKe,{});case "basicChevronProcess":case "segmentedProcess":case "continuousBlockProcess":case "upwardArrow":return jsx(nKe,{});case "basicCycle":case "basicPie":return jsx(rKe,{});case "basicRadial":case "convergingRadial":return jsx(sKe,{});case "hierarchy":return jsx(oKe,{});case "basicVenn":case "linearVenn":return jsx(iKe,{});default:return jsx(aKe,{})}}function tce({isOpen:t,onClose:e,onInsert:n}){let{t:r}=useTranslation(),[o,i]=useState("list"),[s,a]=useState(null),l=HH.filter(u=>u.category===o),c=useCallback(()=>{if(!s)return;let u=HH.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:Jle.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:Qle(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 zH(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:_,onDiscardAnnotations:M}=t;return jsxs(Fragment,{children:[jsx(J6,{isOpen:i.isVersionHistoryOpen,filePath:u,onClose:()=>i.setIsVersionHistoryOpen(false),onRestore:i.handleRestoreVersion}),jsx(e8,{isOpen:i.isComparePanelOpen,compareResult:i.compareResult,canvasSize:c,onClose:()=>i.setIsComparePanelOpen(false),onAcceptSlide:i.handleAcceptSlide,onRejectSlide:i.handleRejectSlide,onAcceptAll:i.handleAcceptAllSlides}),jsx(n8,{isOpen:e.isPasswordDialogOpen,isCurrentlyProtected:e.isPasswordProtected,onClose:()=>e.setIsPasswordDialogOpen(false),onSetPassword:e.handleSetPassword,onRemovePassword:e.handleRemovePassword}),jsx(i8,{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(a8,{isOpen:e.isFontEmbeddingOpen,embedFontsEnabled:e.embedFontsEnabled,usedFontFamilies:i.usedFontFamilies,embeddedFonts:h.map(A=>A.name),onClose:()=>e.setIsFontEmbeddingOpen(false),onToggleEmbedFonts:e.setEmbedFontsEnabled}),jsx(c8,{isOpen:e.isDigitalSigDialogOpen,onClose:()=>e.setIsDigitalSigDialogOpen(false),hasSignatures:m,signatureCount:x}),jsx(d8,{isOpen:e.isSignatureStrippedDialogOpen,signatureCount:x,onConfirm:()=>e.setIsSignatureStrippedDialogOpen(false),onCancel:()=>e.setIsSignatureStrippedDialogOpen(false)}),jsx(p8,{isOpen:w,onClose:()=>C(false)}),jsx(tce,{isOpen:e.isSmartArtDialogOpen,onClose:()=>e.setIsSmartArtDialogOpen(false),onInsert:n.handleInsertSmartArt}),jsx(Zle,{isOpen:e.isEquationDialogOpen,onClose:()=>e.setIsEquationDialogOpen(false),onInsert:n.handleInsertEquation,existingOmml:e.editingEquationOmml}),jsx(TH,{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(kU,{isOpen:r.exportModalOpen,title:r.exportModalTitle,progress:r.exportProgress,statusMessage:r.exportStatusMessage,onCancel:r.handleCancelExport}),jsx(hH,{open:e.isSetUpSlideShowOpen,onClose:()=>e.setIsSetUpSlideShowOpen(false),properties:y,onSave:e.handleSaveSlideShowSettings,customShows:v,slideCount:a.length}),jsx(fH,{open:o.isPrintDialogOpen,onClose:()=>o.setIsPrintDialogOpen(false),onPrint:o.handlePrintWithSettings,slides:a,activeSlideIndex:l,defaultSlidesPerPage:y.printSlidesPerPage,defaultFrameSlides:y.printFrameSlides}),jsx(cH,{isOpen:T,annotationCount:Array.from(s.allSlideAnnotations.values()).reduce((A,R)=>A+R.length,0),slideCount:s.allSlideAnnotations.size,onKeep:_,onDiscard:M})]})}function VH(t){let{mode:e,slides:n,canvasSize:r,templateElements:o,presentation:i,onExitPresentation:s}=t;return jsxs(Fragment,{children:[e==="present"&&i.presenterMode&&jsx(b8,{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(S8,{presentationStartTime:i.presentationStartTime,slideStartTime:i.slideStartTime,paused:i.rehearsalPaused,onTogglePause:i.toggleRehearsalPause}),i.showRehearsalSummary&&jsx(w8,{slides:n,canvasSize:r,recordedTimings:i.recordedTimings,onSave:i.saveRehearsalTimings,onDiscard:i.dismissRehearsalSummary})]})}var xKe=50;function rce(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)<xKe||Math.abs(u)<=Math.abs(d)||(u<0?n():r());},[e,n,r]);return {onTouchStart:i,onTouchEnd:s}}function jH(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]),_=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&&Wg(H.url);},[e,y]),A=useCallback(U=>{if(CU(U)){if(e==="present"){let H=mee(U);if(H){let j={action:H.action,targetSlideIndex:H.targetSlideIndex};y.handlePresentationAction(j);}}return}Wg(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=rce({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(r$,{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(V6,{notesMaster:d.notesMaster,canvasSize:a,notesCanvasSize:d.notesCanvasSize}):e==="master"&&d.masterViewTab==="handout"?jsx(j6,{handoutMaster:d.handoutMaster,canvasSize:a,slidesPerPage:d.handoutSlidesPerPage}):jsx(PH,{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:_,collaborationOverlay:jsxs(Fragment,{children:[jsx(F6,{elements:w?.elements??[],activeSlideIndex:l}),jsx(D6,{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(tH,{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(lH,{visible:!!d.presentationProperties.showSubtitles}),e==="present"&&jsx(sH,{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(oH,{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",mM="w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:border-primary focus:outline-none",sce="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",ace="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 IN=[{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"}],q0=["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 lce({editColors:t,canEdit:e,activePickerKey:n,majorFont:r,minorFont:o,onSetActivePickerKey:i,onColorChange:s,onMajorFontChange:a,onMinorFontChange:l}){let{t:c}=useTranslation(),u=useMemo(()=>fY(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:`${N1[p]}: ${t[p]}`,onClick:()=>i(n===p?null:p)}),jsx("span",{className:"text-[9px] text-muted-foreground truncate w-full text-center",children:N1[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:N1[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:mM,disabled:!e,value:q0.includes(r)?r:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&a(p.target.value);},children:[q0.map(p=>jsx("option",{value:p,children:p},p)),!q0.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:mM,disabled:!e,value:q0.includes(o)?o:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&l(p.target.value);},children:[q0.map(p=>jsx("option",{value:p,children:p},p)),!q0.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 MKe=["accent1","accent2","accent3","accent4","accent5","accent6"];function uce({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:IN.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:MKe.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 dce({theme:t,canEdit:e,onUpdateColorScheme:n,onUpdateFontScheme:r,onUpdateThemeName:o,onApplyToPresentation:i,onClose:s}){let{t:a}=useTranslation(),[l,c]=useState(()=>t?.colorScheme??IN[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]),_=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:mM,disabled:!e,value:h,onChange:M=>_(M.target.value),placeholder:a("pptx.themeEditor.themeNamePlaceholder")})]}),jsx(uce,{canEdit:e,currentThemeName:h,onSelectPreset:S}),jsx(lce,{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:sce,onClick:i,children:a("pptx.themeEditor.applyToPresentation")}),jsx("button",{type:"button",disabled:!e,className:ace,onClick:w,children:a("pptx.themeEditor.reset")})]})]})}var XH=[{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 WH({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 fce({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:XH.map(f=>jsx(WH,{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 YH(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(DH,{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(T8,{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(dce,{theme:c.theme,canEdit:n,onUpdateColorScheme:h.handleUpdateThemeColorScheme,onUpdateFontScheme:h.handleUpdateThemeFontScheme,onUpdateThemeName:h.handleUpdateThemeName,onApplyToPresentation:h.handleApplyThemeToPresentation,onClose:()=>c.setIsThemeEditorOpen(false)})}),jsx(fce,{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 qH(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:_=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(D2,{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(G6,{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(jH,{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(DU,{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(YH,{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 mce({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 gce({open:t,onClose:e,...n}){return jsx(ZI,{open:t,onClose:e,heightFraction:.7,title:"Slides",children:jsx("div",{className:"h-full",children:jsx(D2,{...n})})})}function yce(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(gce,{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(mce,{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 iS({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 vce({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(iS,{label:x("pptx.settings.autoSave"),enabled:h,onToggle:()=>m(!h)}),jsx(iS,{label:x("pptx.settings.spellCheck"),enabled:n,onToggle:()=>r?.(!n)}),jsx(iS,{label:x("pptx.settings.showGrid"),enabled:o,onToggle:()=>i?.(!o)}),jsx(iS,{label:x("pptx.settings.showRulers"),enabled:s,onToggle:()=>a?.(!s)}),jsx(iS,{label:x("pptx.settings.snapToGrid"),enabled:l,onToggle:()=>c?.(!l)}),jsx(iS,{label:x("pptx.settings.reducedMotion"),enabled:u,onToggle:()=>d?.()})]}),p==="shortcuts"&&jsx("div",{className:"space-y-0.5",children:g_.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 wce({localClientId:t,handleUndo:e,handleRedo:n,canUndo:r,canRedo:o}){let i=useRef(0),s=useCallback(()=>{r&&(e(),i.current=Math.max(0,i.current-1));},[e,r]),a=useCallback(()=>{o&&(n(),i.current+=1);},[n,o]);return {handleUndo:s,handleRedo:a,canUndo:r,canRedo:o}}function JH({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 QH({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 eZe(t){if(t){let e=Math.round(t.cx/9525);if(e>0)return e}return 8}function tZe(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 nZe(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:GW,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 rZe(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 Tce(t){let{slides:e,sections:n,customShows:r,activeCustomShowId:o,mode:i,activeLayout:s,activeMaster:a,presentationGridSpacing:l}=t,c=useMemo(()=>eZe(l),[l]),u=useMemo(()=>tZe(e,o,r),[e,o,r]),d=useMemo(()=>nZe(e,n),[e,n]),p=useMemo(()=>rZe(i,s,a),[i,s,a]);return {gridSpacingPx:c,visibleSlideIndexes:u,slideSectionGroups:d,masterPseudoSlide:p}}var oZe=120;function Ece(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,_]=useState(false),[M,A]=useState(false),[R,k]=useState(void 0),[N,F]=useState(void 0),[B,D]=useState(false),O=useCallback(()=>{_(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(h_),templateElementsBySlideId:m_(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(h_)),p(m_(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>oZe&&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 FN(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 _ce(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:_,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=FN(T,W.textSegments,W.textStyle);_.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];_.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 _.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:(_.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)||_.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 ez(){return `comment-${crypto.randomUUID()}`}function Ace(t,e,n){return t.map((r,o)=>o===e?{...r,comments:[...r.comments||[],n]}:r)}function Pce(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 Rce(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 kce(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 Ice(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 Nce({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:ez(),text:B,author:n,createdAt:new Date().toISOString(),elementId:r??void 0};o(O=>Ace(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=Pce(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=Rce(U,N,F,D);return O=H.didUpdate,H.slides}),O&&(c(U=>({...U,[B.id]:null})),i());},[e,u,i,o,t]),_=useCallback((N,F)=>{if(!e||!t[N])return;let D=false;o(O=>{let U=kce(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:ez(),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=>Ice(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:_,handleStartReply:M,handleCancelReply:A,handleReplyDraftChange:R,handleSubmitReply:k}}function xo(){return `el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Dce(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 aZe(t){return t.type==="shape"||t.type==="image"||t.type==="picture"}function lZe(t){if("pathData"in t&&typeof t.pathData=="string"&&t.pathData)return t.pathData;if("shapeType"in t&&typeof t.shapeType=="string"){let e=W5(t.shapeType);if(e){let n=cZe(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 cZe(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 uZe(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 Xx(a)}function Lce(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 Xx(s)}function Fce(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 Bce(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,effectiveSelectedIds:o,setSelectedElementIds:i,ops:s,history:a}=t,l=r.filter(aZe),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=lZe(h);return uZe(m,h)});if(d==="fragment"){let h=[],m=f[0];for(let v=1;v<f.length;v++){let S=J5("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=Fce(v);if(S.width<=0||S.height<=0)continue;let w=Lce(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=J5(d,h,f[w]);typeof C=="string"&&(h=C);}if(!h)return;let m=Fce(h);if(m.width<=0||m.height<=0)return;let x=Lce(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(_=>!S.has(_.id)),v]}:C)),s.applySelection(v.id),a.markDirty();}},canMergeShapes:c}}function Oce(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,_=-1/0,M=-1/0;for(let k of w)C=Math.min(C,k.x),T=Math.min(T,k.y),_=Math.max(_,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:_-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(_=>_.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)),_=Math.max(...S.map(R=>R.bottom)),M=(w+T)/2,A=(C+_)/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=_-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((_,M)=>M===n?{..._,elements:C}:_)),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),_=v==="front"?[...T,C]:[C,...T];l.updateSlides(M=>M.map((A,R)=>R===n?{...A,elements:_}:A)),c.markDirty();},{handleMergeShapes:x,canMergeShapes:y}=Bce({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 Uce(t){let{setIsInspectorPaneOpen:e,setSidebarPanelMode:n,onOpenHyperlinkDialog:r}=t,{handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleDelete:l}=Dce(t),{handleGroupElements:c,handleUngroupElement:u,handleFlip:d,handleAlignElements:p,handleMoveLayer:f,handleMoveLayerToEdge:h,handleMergeShapes:m,canMergeShapes:x}=Oce(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)=>{X7(w)?a(_=>{let M=e?.id;if(!M)return _;let A=_[M]??[];return {..._,[M]:A.map(R=>R.id===w?{...R,...C}:R)}}):s(_=>_.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=Yee(r.textSegments);if(C&&r.textSegments){let{newSegments:M,newSelection:A}=qee(r.textSegments,C,w);Xee(A),m({textSegments:M});return}let T={...r.textStyle,...w},_=r.textSegments?.map(M=>({...M,style:{...M.style,...w}}));m({textStyle:T,textSegments:_});},[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 pZe(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 fZe(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 Hce({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 _=pZe(t,l,p);if(!l){m([]),y(-1);return}m(_),y(_.length>0?0:-1),_.length>0&&(n(_[0].slideIndex),r(_[0].elementId));},[t,l,p,n,r]),S=useCallback(_=>{if(h.length===0)return;let M=(x+_+h.length)%h.length;y(M);let A=h[M];A&&(n(A.slideIndex),r(A.elementId));},[h,x,n,r]),w=useCallback(_=>{_.length!==0&&(o(M=>fZe(M,_,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 _=M=>{if((M.metaKey||M.ctrlKey)&&M.key==="f"){if(e!=="edit")return;M.preventDefault(),a(A=>!A);}};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[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 zce(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 Gce(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=mle(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=Fm.find(m=>m.shapeType===p);if(!f)return;let h=i_({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 Vce(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=Gce({activeSlide:e,activeSlideIndex:n,selectedElements:i,ops:s,history:a,addElement:l}),f=zce({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 mZe(){let t=()=>Math.floor(Math.random()*65536).toString(16).padStart(4,"0");return `{${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}}`}function jce(t){let{sections:e,setSections:n,slides:r,setSlides:o,markDirty:i}=t,s=useCallback((p,f)=>{let h=mZe(),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},_=[...C];return _.splice(S,0,T),_}),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 gZe(t,e,n){let r=[...t],o=Math.max(0,Math.min(e+1,r.length));return r.splice(o,0,n),r}function Xce(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=gZe(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 Wce(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=F1([{row:u,col:d},{row:u,col:m}],p),v={tableData:y},S=ly(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=F1([{row:u,col:d},{row:m,col:d}],p),v={tableData:y},S=ly(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=F1(n.selectedCells,u),p={tableData:d},f=ly(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=c3(u,d,p),h={tableData:f},m=ly(e,f);m&&(h.rawXml=m),o.updateSelectedElement(h),i.markDirty();}}}function Yce(){return {text:"",style:{}}}function qce(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,_)=>_!==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=a3(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=l3(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((_,M)=>M!==v?_:{..._,style:{..._.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(Yce());}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 _={...v,rows:T},M={tableData:_},A=cy(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},_=cy(e,C);_&&(T.rawXml=_),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 _=S.reduce((B,D)=>B+D,0),M=_>0?S.map(B=>B/_):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}:Yce();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=cy(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},_=cy(e,C);_&&(T.rawXml=_),i.updateSelectedElement(T),s.markDirty();}}}function Kce(t){let e=qce(t),n=Wce(t);return {...e,...n}}function eue(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=jce({sections:e.sections,setSections:e.setSections,slides:s,setSlides:e.setSlides,markDirty:n.markDirty}),S=Hce({slides:s,mode:o,onSetActiveSlideIndex:e.setActiveSlideIndex,onSetSelectedElementId:e.setSelectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),w=Nce({slides:s,canEdit:i,userName:m,selectedElementId:e.selectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),C=_ce({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=Vce({activeSlide:a,activeSlideIndex:l,canvasSize:p,newShapeType:e.newShapeType,selectedElements:e.selectedElements,ops:y,history:n}),_=Uce({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=Xce({slides:s,activeSlideIndex:l,setActiveSlideIndex:e.setActiveSlideIndex,ops:y,history:n,handlerRef:x}),A=Kce({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=KQ(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:_,slideOps:M,tableOps:A}}function ON(){}var yZe=2.5,bZe=14,vZe=.4,nue=16,rue=0;function SZe(){return rue+=1,`stroke-${rue}`}function oue(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 _=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:SZe(),points:[{x:j,y:Z}],color:J?i:a,width:J?yZe:bZe,opacity:J?1:vZe});}},[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<nue*nue}));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:_,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 iue(t){return !!t.loopContinuously||t.showType==="kiosk"}function sue(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 aue(t,e){return Math.max(0,t||0)+e*60}function J0(t,e,n,r){for(let o of t.steps)o.stopSound?ON():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 nz(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&&(J0(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,MF(U.textSegments));}let F=N.size>0?EF(k,N):k,B=S1.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(El)&&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?(J0(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?(J0(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?(J0(k,n,l,m),true):false},[o,n]),_=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&&(J0(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=aue(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:_,runPresentationEntranceAnimations:M,presentationTimersRef:m}}var wZe="pptx-viewer-audience";var nm="content",rz="pptx-bytes";function oz(){return new Promise((t,e)=>{let n=indexedDB.open(wZe,1);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(nm)||r.createObjectStore(nm);},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function UN(t){let e=await oz();return new Promise((n,r)=>{let o=e.transaction(nm,"readwrite"),i=o.objectStore(nm),a={bytes:t instanceof Uint8Array?t:new Uint8Array(t),createdAt:Date.now()};i.put(a,rz),o.oncomplete=()=>{e.close(),n();},o.onerror=()=>{e.close(),r(o.error);};})}async function cue(){try{let t=await oz();return new Promise((e,n)=>{let i=t.transaction(nm,"readonly").objectStore(nm).get(rz);i.onsuccess=()=>{t.close();let s=i.result;if(s&&typeof s=="object"&&"bytes"in s&&"createdAt"in s){let a=s;if(Date.now()-a.createdAt>3e5){e(null);return}let c=a.bytes;c instanceof Uint8Array?e(c):c instanceof ArrayBuffer?e(new Uint8Array(c)):e(null);return}e(null);},i.onerror=()=>{t.close(),n(i.error);};})}catch{return null}}async function Q0(){try{let t=await oz();return new Promise(e=>{let n=t.transaction(nm,"readwrite");n.objectStore(nm).delete(rz),n.oncomplete=()=>{t.close(),e();},n.onerror=()=>{t.close(),e();};})}catch{}}var zN="pptx-viewer-presenter",MM="#pptx-audience",EM="pptx-viewer-presenter",uue="nonce";function CZe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function due(){let t=window.location.hash;if(!t.startsWith(MM))return null;let e=t.slice(MM.length);return e?new URLSearchParams(e.replace(/^[&;?]/,"")).get(uue):null}function _M(){return window.location.hash.startsWith(MM)}function iz(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(zN)),i.current),[]),c=useCallback(()=>o.current!==null&&!o.current.closed,[]),u=useCallback(f=>{if(!a.current)return;let h={origin:EM,type:"presenter-slide-change",slideIndex:f,sessionId:a.current};try{l().postMessage(h);}catch{}},[l]),d=useCallback(()=>{if(a.current)try{let h={origin:EM,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),Q0();},[l]),p=useCallback(()=>{c()&&d();let f=window.open("about:blank","_blank");if(!f)return false;o.current=f;let h=CZe();a.current=h;let m=new URL(window.location.href),x=new URLSearchParams;x.set(uue,h),m.hash=`${MM}&${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?UN(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=()=>{Q0();};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[]),{openAudienceWindow:p,closeAudienceWindow:d,isAudienceWindowOpen:c,syncSlideToAudience:u}}function sz(t){let{onSetMode:n,onSetActiveSlideIndex:r,containerRef:o}=t,i=useRef(false);useEffect(()=>{if(!_M()||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(!_M())return;let s=due(),a;try{a=new BroadcastChannel(zN);}catch{return}return a.onmessage=l=>{let c=l.data;if(!(!c||c.origin!==EM)&&!(s&&c.sessionId!==s)&&(c.type==="presenter-slide-change"&&r(c.slideIndex),c.type==="presenter-exit")){Q0(),n("edit");try{window.close();}catch{}}},()=>{try{a.close();}catch{}}},[n,r]);}function fue(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 az(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=fue(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 lz(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(_=>{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,[_]: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 _=Date.now();o(_),d(_);try{let M=e.current;M&&typeof M.requestFullscreen=="function"&&M.requestFullscreen().catch(()=>{});}catch{}n("present");},[e,n,o,i]),T=useCallback(()=>{m(_=>(_?y.current!==null&&(x.current+=Date.now()-y.current,y.current=null):y.current=Date.now(),!_));},[]);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 cz(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")&&Kb(t.url)&&window.open(t.url,"_blank","noopener,noreferrer");}function GN(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 uz(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(_=>{if(u===false)return;let A=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(_=>{if(_===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)+_;if(m&&_===1&&k>=M.length){x(r);try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}s("edit"),y(true);return}let N;c&&!m&&_===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&&_===1&&x(r),GN(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(_=>{_<0||_>=e.length||_!==r&&GN(_,{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(_=>{cz(_,{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 pz(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 mue(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,_]=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}=nz({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}=lz({containerRef:i,onSetMode:a,onSaveRehearsalTimings:h,setPresentationStartTime:A,setPresenterMode:_}),{movePresentationSlide:Te,navigateToSlide:be,handlePresentationAction:xe,scheduleAutoAdvanceForSlide:Pe}=uz({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}=pz({navigateToSlide:be}),{openAudienceWindow:We,closeAudienceWindow:ke,isAudienceWindowOpen:wt,syncSlideToAudience:V}=iz({currentSlideIndex:v,isPresenterMode:T,content:s});sz({onSetMode:a,onSetActiveSlideIndex:l,containerRef:i});let $=useCallback(()=>{_(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(()=>{_(true),se(false),A(Date.now()),a("present");},[a,se]),ve=useCallback(()=>{if(T){_(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{}_(true),M||A(Date.now());}},[T,M,i]);az({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 xue(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=oue({isActive:e==="present",activeSlideIndex:o});return {presentation:mue({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"&&(Xb(),ON()),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=>sue(S,v)),p.markDirty();},loopContinuously:iue(l),showWithAnimation:l.showWithAnimation,useTimings:l.advanceMode!=="manual"}),annotations:x,actionSoundHandlerRef:f}}function NZe(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function DZe(){return false}function LZe(t){if(typeof window>"u")return ()=>{};let e=window.matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function yue(){let t=useSyncExternalStore(LZe,NZe,DZe),[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 FZe=120,BZe=400,OZe=180,UZe=220,$Ze=480,HZe=288,zZe=60,GZe=400,VZe=120;function bue(){let[t,e]=useState(OZe),[n,r]=useState(HZe),[o,i]=useState(VZe),s=useCallback(c=>{e(u=>Math.min(BZe,Math.max(FZe,u+c)));},[]),a=useCallback(c=>{r(u=>Math.min($Ze,Math.max(UZe,u-c)));},[]),l=useCallback(c=>{i(u=>Math.min(GZe,Math.max(zZe,u-c)));},[]);return {leftWidth:t,rightWidth:n,bottomHeight:o,onResizeLeft:s,onResizeRight:a,onResizeBottom:l}}var WZe=50,YZe=100,qZe=500,vue=10;function Sue(t,e){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function KZe(t){return Math.min(Math.max(t,.2),5)}function wue(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=Sue(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);},qZe));},C=M=>{if(M.touches.length===2&&f){M.preventDefault();let A=Sue(M.touches[0],M.touches[1]);if(d>0){let R=A/d,k=KZe(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)>vue||Math.abs(R)>vue)&&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)>=WZe&&Math.abs(N)<YZe&&i.current.onSwipe?.(k>0?1:-1);}},_=()=>{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",_,{passive:true}),()=>{u.removeEventListener("touchstart",w),u.removeEventListener("touchmove",C),u.removeEventListener("touchend",T),u.removeEventListener("touchcancel",_),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 xz(t,e){try{return window.prompt(t,e)}catch{return null}}function Cue(t){try{return window.confirm(t)}catch{return false}}function ZZe(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 YN(t,e){let n=ZZe(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 Tue(t){let{activeSlide:e,customShows:n,activeCustomShowId:r,setCustomShows:o,setActiveCustomShowId:i,history:s}=t,a=()=>{let f=xz("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=xz("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&&Cue(`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 Eue(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:_}=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=Tue({activeSlide:r,customShows:s,activeCustomShowId:a,setCustomShows:l,setActiveCustomShowId:c,history:_}),We=useCallback(ie=>{d(ie),_.markDirty();},[d,_]),ke=useCallback(()=>{d(ie=>({...ie,showSubtitles:!ie.showSubtitles})),_.markDirty();},[d,_]),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 _ue(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?(Xb(),c.current=m,l(true)):(e==="present"&&Xb(),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,_=1/0,M=-1/0,A=-1/0;for(let B of C.points)B.x<T&&(T=B.x),B.y<_&&(_=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-_,1),N=[];for(let B=0;B<C.points.length;B++){let D=C.points[B],O=D.x-T,U=D.y-_;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:_,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 Aue(t){return Math.max(t,10)*1e3}var iJe="pptx-viewer-autosave",sJe=1,uS="recoveryVersions";function Rue(){return new Promise((t,e)=>{let n=indexedDB.open(iJe,sJe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(uS)||r.createObjectStore(uS,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function aJe(){let t=await Rue();return new Promise(e=>{try{let n=t.transaction(uS,"readwrite"),r=n.objectStore(uS),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 Pue(t,e){return Rue().then(n=>new Promise((r,o)=>{let i=n.transaction(uS,"readwrite");i.objectStore(uS).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 lJe(t,e){try{return await Pue(t,e)}catch(n){if((n instanceof Error||n instanceof DOMException?n.name:"")!=="QuotaExceededError"||!await aJe())throw n;return Pue(t,e)}}function kue(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 lJe(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=Aue(o),h=setInterval(()=>{p();},f);return ()=>clearInterval(h)},[i,n,o,p]),{autosaveStatus:s,triggerAutosave:p}}var Iue={"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"},Nue="pptx-embedded-fonts",Due="pptx-google-fonts",Lue="pptx-symbol-font-fallback",uJe=["Wingdings","Wingdings 2","Wingdings 3","Symbol","Webdings"];function dJe(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 Fue=/["\\\n\r;}<>]/,pJe=new Set(["truetype","opentype","woff","woff2","svg","embedded-opentype"]),fJe=/^data:font\/[a-z0-9+.-]+(?:;charset=[a-z0-9-]+)?;base64,[A-Za-z0-9+/=]+$/i;function hJe(t){return typeof t!="string"||t.length===0?false:t.startsWith("blob:")?true:fJe.test(t)}function Bue({embeddedFonts:t,slides:e}){useEffect(()=>{if(!t.length)return;let r=document.createElement("style");r.id=Nue;let o=t.flatMap(i=>{if(typeof i.name!="string"||i.name.length===0||Fue.test(i.name))return [];if(!hJe(i.dataUrl))return [];let s=i.format??"truetype";if(!pJe.has(s))return [];let a=i.bold?"700":"400",l=i.italic?"italic":"normal";return [`@font-face {