pptx-react-viewer 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4463,7 +4463,7 @@ ${o.join(`
4463
4463
  `),s=o.flat().find(u=>u.text.trim().length>0),a=s?.style?{...s.style}:r;function l(u,p){if(p.length===0)return u.length>0?[{text:u,style:{...a}}]:[{text:"",style:{...a}}];let h=p[0].bulletInfo;if(u.length===0){let y=[{text:"",style:{...p[0].style}}];return h&&(y[0].bulletInfo=h),y}if(p.reduce((g,y)=>g+y.text.length,0)===0){let g=[$B(p[0],{text:u,style:{...p[0].style}})];return h&&(g[0].bulletInfo=h),g}let m=[],x=0;for(let g=0;g<p.length;g++){let y=p[g],b=g===p.length-1,v=y.text.length;if(x>=u.length)break;let S;if(b?S=u.slice(x):S=u.slice(x,x+v),S.length>0){let w=$B(y,{text:S,style:{...y.style}});m.length===0&&h&&(w.bulletInfo=h),m.push(w);}x+=b?S.length:v;}if(m.length===0){let g=$B(p[0],{text:u,style:{...p[0].style}});return h&&(g.bulletInfo=h),[g]}return m}let c=[],d=o[o.length-1];for(let u=0;u<i.length;u++){if(u>0){let f=o[u-1]??[],m=f[0]?.style?{...f[0].style}:{...a};c.push({text:`
4464
4464
  `,style:m,isParagraphBreak:true});}let p=o[u]??d??[],h=l(i[u],p);c.push(...h);}return c.length>0?c:[{text:"",style:{...a}}]}function _U(t){return Math.max(JVe,Math.min(ane,Math.round(t)))}function KA(t){let e=t.shapeAdjustments?.adj;return typeof e=="number"&&Number.isFinite(e)?_U(e):QVe}function gT(t){let e=KA(t)/ane;return Math.min(Math.max(t.width,1),Math.max(t.height,1))*.5*e}function xT(t){if(!Jt(t)||String(t.shapeType||"").toLowerCase()!=="roundrect")return null;let n=KA(t),r=gT(t),o=Math.max(t.width,ZVe),i=5;return {key:"adj",left:Math.max(i,Math.min(o-i,Math.round(r))),top:-8,value:n,cursor:"ew-resize"}}function oGe(t){return tGe.test(t)}function qA(t){if(!oGe(t))throw new Error(`Invalid collaboration room ID: "${t}". Must be 1-128 alphanumeric characters, hyphens, or underscores.`);return t}function une(t){return typeof t!="string"?"Anonymous":t.replace(rGe,"").trim().slice(0,64)||"Anonymous"}function ZA(t,e=eGe){return typeof t!="string"?e:nGe.test(t)?t:e}function pne(t){if(typeof t=="string")try{let e=new URL(t);if(e.protocol==="https:"||e.protocol==="http:"||e.protocol==="data:")return t}catch{}}function hne(t){return typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.floor(t))}function r4(t,e,n){return typeof t!="number"||!Number.isFinite(t)?0:Math.max(e-ree,Math.min(n+ree,t))}function fne(t,e=typeof window<"u"?window.location.protocol:void 0){if(e!=="https:")return false;let n;try{n=new URL(t);}catch{return false}return n.protocol!=="ws:"?false:!["localhost","127.0.0.1","[::1]"].includes(n.hostname)}function sGe(t){return iGe.includes(t)?t:void 0}function mne(t,e,n){return typeof t.clientId!="number"?null:{clientId:t.clientId,userName:une(t.userName),userAvatar:pne(t.userAvatar),userColor:ZA(t.userColor),activeSlideIndex:hne(t.activeSlideIndex),cursorX:r4(t.cursorX,0,e),cursorY:r4(t.cursorY,0,n),lastUpdated:typeof t.lastUpdated=="string"?t.lastUpdated:new Date().toISOString(),selectedElementId:typeof t.selectedElementId=="string"?t.selectedElementId.slice(0,128):void 0,role:sGe(t.role)}}function aGe(t,e=Date.now(),n=dne){let r=new Date(t).getTime();return !Number.isNaN(r)&&e-r<=n}function gne(t,e,n,r,o=Date.now(),i=dne){let s=[];for(let[a,l]of t){if(a===e)continue;let c=l?.presence;if(!c||typeof c!="object")continue;let d=mne({...c,clientId:a},n,r);!d||!aGe(d.lastUpdated,o,i)||s.push(d);}return s}function EU(t){return typeof t=="object"&&t!==null&&typeof t.toDelta=="function"}function xne(t){let e={},n=t.style;return n&&typeof n=="object"&&Object.keys(n).length>0&&(e.s=JSON.stringify(n)),t.isParagraphBreak&&(e.pb="1"),t.isLineBreak&&(e.lb="1"),t.bulletInfo&&(e.bi=JSON.stringify(t.bulletInfo)),t.paragraphLevel!==void 0&&(e.pl=String(t.paragraphLevel)),t.endParaRunProperties&&(e.pr=JSON.stringify(t.endParaRunProperties)),typeof t.fieldType=="string"&&(e.ft=t.fieldType),typeof t.fieldGuid=="string"&&(e.fg=t.fieldGuid),(t.fieldGuidAttr==="uuid"||t.fieldGuidAttr==="id")&&(e.fga=t.fieldGuidAttr),t.fieldParagraphPropertiesXml&&(e.fp=JSON.stringify(t.fieldParagraphPropertiesXml)),t.equationXml&&(e.eq=JSON.stringify(t.equationXml)),typeof t.equationNumber=="string"&&(e.en=t.equationNumber),t.breakRunProperties&&(e.br=JSON.stringify(t.breakRunProperties)),typeof t.rubyText=="string"&&(e.rt=t.rubyText),typeof t.rubyAlignment=="string"&&(e.ra=t.rubyAlignment),t.rubyFontSize!==void 0&&(e.rfs=String(t.rubyFontSize)),t.rubyStyle&&(e.rs=JSON.stringify(t.rubyStyle)),e}function yne(t){return t.isParagraphBreak===true||t.isLineBreak===true?`
4465
4465
  `:typeof t.text=="string"&&t.text.length>0?t.text:"\u200B"}function bne(t,e){let n=0;for(let r of t){let o=r,i=xne(o),s=yne(o);e.insert(n,s,i),n+=s.length;}}function lGe(t){let e=[];for(let n of t){let r=n,o=xne(r),i=Object.keys(o).length>0?o:void 0,s=yne(r),a=e[e.length-1];a&&typeof a.insert=="string"&&JSON.stringify(a.attributes??null)===JSON.stringify(i??null)?a.insert+=s:e.push(i?{insert:s,attributes:i}:{insert:s});}return e}function o4(t){let e=[];for(let n of t){if(typeof n.insert!="string"||n.insert==="")continue;let r=n.attributes??{},o={text:"",style:{}};if(r.s)try{o.style=JSON.parse(r.s);}catch{o.style={};}if(r.pb==="1"&&(o.isParagraphBreak=true),r.lb==="1"&&(o.isLineBreak=true),r.bi)try{o.bulletInfo=JSON.parse(r.bi);}catch{}if(r.pl!==void 0&&(o.paragraphLevel=Number(r.pl)),r.pr)try{o.endParaRunProperties=JSON.parse(r.pr);}catch{}if(r.ft&&(o.fieldType=r.ft),r.fg&&(o.fieldGuid=r.fg),(r.fga==="uuid"||r.fga==="id")&&(o.fieldGuidAttr=r.fga),r.fp)try{o.fieldParagraphPropertiesXml=JSON.parse(r.fp);}catch{}if(r.eq)try{o.equationXml=JSON.parse(r.eq);}catch{}if(r.en&&(o.equationNumber=r.en),r.br)try{o.breakRunProperties=JSON.parse(r.br);}catch{}if(r.rt&&(o.rubyText=r.rt),r.ra&&(o.rubyAlignment=r.ra),r.rfs!==void 0&&(o.rubyFontSize=Number(r.rfs)),r.rs)try{o.rubyStyle=JSON.parse(r.rs);}catch{}n.insert!==`
4466
- `&&n.insert!=="\u200B"&&(o.text=n.insert),e.push(o);}return e}function cGe(t){return o4(t.toDelta())}function Sne(t,e,n){let r=t;for(let[o,i]of Object.entries(r))if(i!==void 0)if(vne.has(o))e.set(o,i);else if(o==="textSegments"){if(Array.isArray(i)){let s=n.createText();bne(i,s),e.set("textBody",s);}}else fA[o]&&e.set(fA[o],JSON.stringify(i));}function uGe(t){let e={};return t.forEach((n,r)=>{if(r==="textBody")EU(n)&&(e.textSegments=cGe(n));else if(oee[r])try{e[oee[r]]=JSON.parse(n);}catch{}else e[r]=n;}),e}function pGe(t,e,n){let r=t;for(let i of RU)r[i]!==void 0&&e.set(i,r[i]);for(let[i,s]of Object.entries(kU))r[i]!==void 0&&e.set(s,JSON.stringify(r[i]));let o=n.createArray();for(let i of t.elements){let s=n.createMap();Sne(i,s,n),o.push([s]);}e.set("elements",o);}function hGe(t){let e={};for(let o of RU){let i=t.get(o);i!==void 0&&(e[o]=i);}for(let[o,i]of Object.entries(dGe)){let s=t.get(o);if(s!==void 0)try{e[i]=JSON.parse(s);}catch{}}let n=t.get("elements"),r=[];if(n)for(let o=0;o<n.length;o++)r.push(uGe(n.get(o)));return e.elements=r,e}function IU(t){let e=t.getArray(AU),n=[];for(let r=0;r<e.length;r++)n.push(hGe(e.get(r)));return n}function wne(t,e){let n=t.getArray(AU);return n.observeDeep(e),()=>n.unobserveDeep(e)}function fGe(t){return EU(t)&&typeof t.delete=="function"&&typeof t.format=="function"}function HB(t){let e="";for(let n of t)typeof n.insert=="string"&&(e+=n.insert);return e}function xGe(t,e){let n=Math.min(t.length,e.length),r=0;for(;r<n&&t.charCodeAt(r)===e.charCodeAt(r);)r++;return r>0&&mGe(t.charCodeAt(r-1))&&r--,r}function yGe(t,e,n){let r=Math.min(t.length,e.length)-n,o=0;for(;o<r&&t.charCodeAt(t.length-o-1)===e.charCodeAt(e.length-o-1);)o++;return o>0&&gGe(t.charCodeAt(t.length-o))&&o--,o}function bGe(t,e,n,r){let o=0,i=n;for(let s of e){if(typeof s.insert!="string")continue;let a=o+s.insert.length,l=Math.max(o,n),c=Math.min(a,r);if(l<c){let d=s.insert.slice(l-o,c-o);t.insert(i,d,s.attributes??{}),i+=d.length;}o=a;}}function vGe(t,e){let n=Object.keys(t);return n.length!==Object.keys(e).length?false:n.every(r=>t[r]===e[r])}function SGe(t,e){let n=t.toDelta().filter(s=>typeof s.insert=="string"),r=0,o=0,i=0;for(let s of e){if(typeof s.insert!="string")continue;let a=s.attributes??{},l=s.insert.length;for(;l>0&&r<n.length;){let c=n[r].insert,d=Math.min(c.length-o,l),u=n[r].attributes??{};if(!vGe(u,a)){let p={};for(let h of Object.keys(a))u[h]!==a[h]&&(p[h]=a[h]);for(let h of Object.keys(u))h in a||(p[h]=null);t.format(i,d,p);}i+=d,l-=d,o+=d,o>=c.length&&(r++,o=0);}}}function wGe(t,e){let n=HB(t.toDelta()),r=HB(e);if(n!==r){let o=xGe(n,r),i=yGe(n,r,o),s=n.length-o-i;if(s>0&&t.delete(o,s),bGe(t,e,o,r.length-i),HB(t.toDelta())!==r)return false}return SGe(t,e),true}function Tne(t,e){return t===e||JSON.stringify(t)===JSON.stringify(e)}function Cne(t,e,n){for(let r of n){let o=e[r],i=t.get(r);o===void 0?i!==void 0&&t.delete(r):Tne(i,o)||t.set(r,o);}}function Mne(t,e,n){for(let[r,o]of Object.entries(n)){let i=e[r]===void 0?void 0:JSON.stringify(e[r]),s=t.get(o);i===void 0?s!==void 0&&t.delete(o):s!==i&&t.set(o,i);}}function TGe(t,e,n){let r=e.textSegments,o=t.get("textBody");if(!Array.isArray(r)){o!==void 0&&t.delete("textBody");return}let i=lGe(r),s=o4(i),a=EU(o)?o4(o.toDelta()):void 0;if(a!==void 0&&Tne(a,s)||fGe(o)&&wGe(o,i))return;let l=n.createText();bne(r,l),t.set("textBody",l);}function CGe(t,e,n){let r=e;Cne(t,r,vne),Mne(t,r,fA),TGe(t,r,n);}function zB(t,e){let n=t.get(e);if(!n||typeof n.get!="function")return;let r=n.get("id");return typeof r=="string"?r:void 0}function _ne(t,e,n){let r=new Set;for(let i of e){let s=n.idOf(i);typeof s=="string"&&r.add(s);}let o=new Set;for(let i=t.length-1;i>=0;i--){let s=zB(t,i);s!==void 0&&(!r.has(s)||o.has(s)?t.delete(i,1):o.add(s));}for(let i=0;i<e.length;i++){let s=e[i],a=n.idOf(s),l=i<t.length?zB(t,i):void 0;if(a===void 0){i<t.length&&l===void 0?n.update(t.get(i),s):t.insert(i,[n.create(s)]);continue}if(l===a){n.update(t.get(i),s);continue}let c=-1;for(let d=i+1;d<t.length;d++)if(zB(t,d)===a){c=d;break}c>=0&&t.delete(c,1),t.insert(i,[n.create(s)]);}t.length>e.length&&t.delete(e.length,t.length-e.length);}function _Ge(t,e,n){let r=e;Cne(t,r,RU),Mne(t,r,kU);let o=t.get("elements");MGe(o)||(o=n.createArray(),t.set("elements",o)),_ne(o,e.elements,{idOf:i=>typeof i.id=="string"?i.id:void 0,create:i=>{let s=n.createMap();return Sne(i,s,n),s},update:(i,s)=>CGe(i,s,n)});}function Pne(t,e,n,r=JA){e.transact(()=>{let o=e.getArray(AU);_ne(o,t,{idOf:i=>typeof i.id=="string"?i.id:void 0,create:i=>{let s=n.createMap();return pGe(i,s,n),s},update:(i,s)=>_Ge(i,s,n)});},r);}function i4(t){return ze(t)?t.textSegments&&t.textSegments.length>0?t.textSegments.map(e=>e.text).join(""):t.text??"":""}function _m(t){let e=t.type.charAt(0).toUpperCase()+t.type.slice(1),n=i4(t);if(n.length>0){let r=n.length>30?`${n.slice(0,30)}...`:n;return `${e}: "${r}"`}return `${e} (${t.id})`}function s4(t){let e=[];for(let n of t)e.push(n),n.type==="group"&&n.children&&e.push(...s4(n.children));return e}function aee(t){let e=new Map;for(let n of t)e.set(n.id,n);return e}function PGe(t,e){let n=[],r=aee(s4(t)),o=aee(s4(e));for(let[i,s]of r)o.has(i)||n.push({elementId:i,label:_m(s),kind:"removed",description:`Element removed: ${_m(s)}`});for(let[i,s]of o)r.has(i)||n.push({elementId:i,label:_m(s),kind:"added",description:`Element added: ${_m(s)}`});for(let[i,s]of r){let a=o.get(i);if(!a)continue;(Math.abs(s.x-a.x)>iee||Math.abs(s.y-a.y)>iee)&&n.push({elementId:i,label:_m(s),kind:"moved",description:`Moved from (${Math.round(s.x)}, ${Math.round(s.y)}) to (${Math.round(a.x)}, ${Math.round(a.y)})`}),(Math.abs(s.width-a.width)>see||Math.abs(s.height-a.height)>see)&&n.push({elementId:i,label:_m(s),kind:"resized",description:`Resized from ${Math.round(s.width)}x${Math.round(s.height)} to ${Math.round(a.width)}x${Math.round(a.height)}`});let l=i4(s),c=i4(a);l!==c&&n.push({elementId:i,label:_m(s),kind:"textChanged",description:"Text content changed"});}return n}function EGe(t,e){let n=PGe(t.elements,e.elements);return t.backgroundColor!==e.backgroundColor&&n.push({elementId:"__background__",label:"Background",kind:"textChanged",description:`Background changed from ${t.backgroundColor??"default"} to ${e.backgroundColor??"default"}`}),(t.notes??"")!==(e.notes??"")&&n.push({elementId:"__notes__",label:"Speaker Notes",kind:"textChanged",description:"Speaker notes changed"}),n}function AGe(t,e){let n=[],r=Math.max(t.length,e.length),o=0,i=0,s=0,a=0;for(let l=0;l<r;l++){let c=t[l],d=e[l];if(c&&!d)n.push({status:"removed",baseIndex:l,compareIndex:-1,baseSlide:c,changes:[]}),i++;else if(!c&&d)n.push({status:"added",baseIndex:-1,compareIndex:l,compareSlide:d,changes:[]}),o++;else if(c&&d){let u=EGe(c,d);u.length>0?(n.push({status:"changed",baseIndex:l,compareIndex:l,baseSlide:c,compareSlide:d,changes:u}),s++):(n.push({status:"unchanged",baseIndex:l,compareIndex:l,baseSlide:c,compareSlide:d,changes:[]}),a++);}}return {diffs:n,baseSlideCount:t.length,compareSlideCount:e.length,addedCount:o,removedCount:i,changedCount:s,unchangedCount:a}}function NU(t,e){return AGe(t.slides,e.slides)}function IGe(t,e){return e[t%e.length]}function $a(t,e,n){let r=t.style?.fillColor;return r&&r.length>0?r:IGe(e,n)}function eu(t,e){let n=t.style?.lineColor;return n&&n.length>0?n:e}function Fc(t,e,n){let r=n==="intense"?1:n==="moderate"?.92:.85;return e<=1?r:r-t/(e-1)*.15}function Hc(t){if(t==="intense")return "drop-shadow(0 2px 6px rgba(0,0,0,0.35))";if(t==="moderate")return "drop-shadow(0 1px 3px rgba(0,0,0,0.2))"}function oh(t){return t==="intense"?2:t==="moderate"?1.5:0}function Ha(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function Bl(t,e,n,r){let i=e/Math.max(1,t.length*.6),s=n*.5;return Math.max(6,Math.min(r,i,s))}function ih(t){return t>0?"rgba(255,255,255,0.3)":"none"}function NGe(t){if(t.some(o=>o.children!==void 0&&o.children.length>0)){let o=a=>({node:a,children:(a.children??[]).map(o)}),i=new Set(t.map(a=>a.id));return t.filter(a=>!a.parentId||!i.has(a.parentId)).map(o)}let n=new Map;for(let o of t)n.set(o.id,{node:o,children:[]});let r=[];for(let o of t){let i=n.get(o.id);o.parentId&&n.has(o.parentId)?n.get(o.parentId).children.push(i):r.push(i);}return r}function gy(t){return t.children.length===0?1:t.children.reduce((e,n)=>e+gy(n),0)}function Ene(t){return t.children.length===0?1:1+Math.max(...t.children.map(Ene))}function Ane(t){let e=[],n=r=>{e.push(r);for(let o of r.children??[])n(o);};for(let r of t)n(r);return e}function LGe(t,e,n){if(n&&n in lee)return lee[n];if(e&&e in cee){let o=cee[e];if(o)return o}return t.some(o=>o.children&&o.children.length>0)?"hierarchy":"list"}function Rne(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=4,c=s-a*2,d=t.length>0?(c-l*(t.length-1))/t.length:c,u=i-a*2,p=Math.min(6,d*.15),h=oh(r),f=ih(h);return {nodes:t.map((x,g)=>{let y=a+g*(d+l),b=Bl(x.text,u*.9,d,12);return {kind:"rect",key:`${o}-list-${x.id}-${g}`,x:a,y,width:u,height:d,rx:p,fill:$a(x,g,n),stroke:eu(x,f),strokeWidth:h,opacity:Fc(g,t.length,r),text:Ha(x.text,40),fontSize:b,textX:a+u/2,textY:y+d/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"list"}}function DGe(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=4,c=Math.min(16,i*.04),d=i-a*2,u=t.length>0?(d-l*(t.length-1))/t.length:d,p=Math.min(s-a*2,s*.6),h=s/2,f=oh(r),m=ih(f);return {nodes:t.map((g,y)=>{let b=a+y*(u+l),v=p/2,S=y===0,w=y===t.length-1,C;S?C=[`${b},${h-v}`,`${b+u-c},${h-v}`,`${b+u},${h}`,`${b+u-c},${h+v}`,`${b},${h+v}`].join(" "):w?C=[`${b},${h-v}`,`${b+u},${h-v}`,`${b+u},${h+v}`,`${b},${h+v}`,`${b+c},${h}`].join(" "):C=[`${b},${h-v}`,`${b+u-c},${h-v}`,`${b+u},${h}`,`${b+u-c},${h+v}`,`${b},${h+v}`,`${b+c},${h}`].join(" ");let T=Bl(g.text,u*.7,p,12);return {kind:"polygon",key:`${o}-process-${g.id}-${y}`,points:C,fill:$a(g,y,n),stroke:eu(g,m),strokeWidth:f,opacity:Fc(y,t.length,r),text:Ha(g.text,25),fontSize:T,textX:b+u/2,textY:h}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"process"}}function FGe(t,e,n,r,o){let{width:i,height:s}=e,a=Math.min(i,s),l=i/2,c=s/2,d=a*.35,u=Math.max(a*.06,Math.min(a*.12,200/Math.max(1,t.length))),p=oh(r),h=ih(p),f=t.map((x,g)=>{let y=g/t.length*Math.PI*2-Math.PI/2,b=l+d*Math.cos(y),v=c+d*Math.sin(y),w=(g+1)%t.length/t.length*Math.PI*2-Math.PI/2,C=l+d*Math.cos(w),T=c+d*Math.sin(w),M=(y+w)/2,_=g===t.length-1?(y+w+Math.PI*2)/2:M,E=d*.15,R=l+(d+E)*Math.cos(_),I=c+(d+E)*Math.sin(_);return {key:`${o}-cycle-conn-${g}`,d:`M${b},${v} Q${R},${I} ${C},${T}`}});return {nodes:t.map((x,g)=>{let y=g/t.length*Math.PI*2-Math.PI/2,b=l+d*Math.cos(y),v=c+d*Math.sin(y),S=Bl(x.text,u*1.4,u*2,11);return {kind:"circle",key:`${o}-cycle-${x.id}-${g}`,cx:b,cy:v,r:u,fill:$a(x,g,n),stroke:eu(x,h),strokeWidth:p,opacity:Fc(g,t.length,r),text:Ha(x.text,20),fontSize:S}}),connectors:f,shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"cycle"}}function OGe(t,e,n,r,o){let i=NGe(t);if(i.length===0)return Rne(t,e,n,r,o);let{width:s,height:a}=e,l=i.reduce((w,C)=>w+gy(C),0),c=Math.max(...i.map(Ene)),d=s/Math.max(1,l),u=a/Math.max(1,c),p=Math.min(d*.8,140),h=Math.min(u*.4,36),f=Math.min(6,h*.15),m=oh(r),x=ih(m),g=[],y=[],b=0;function v(w,C,T){let M=gy(w),_=(C+M/2)*d,E=T*u+u/2,R=b++,I=Bl(w.node.text,p*.9,h,11),L=C;for(let N of w.children){let D=gy(N),U=(L+D/2)*d,G=(T+1)*u+u/2,j=E+h/2+(G-h/2-(E+h/2))/2;y.push({key:`${o}-hier-conn-${w.node.id}-${N.node.id}`,d:`M${_},${E+h/2} L${_},${j} L${U},${j} L${U},${G-h/2}`}),L+=D;}let k={kind:"rect",key:`${o}-hier-${w.node.id}-${R}`,x:_-p/2,y:E-h/2,width:p,height:h,rx:f,fill:$a(w.node,R,n),stroke:eu(w.node,x),strokeWidth:m,opacity:Fc(R,t.length,r),text:Ha(w.node.text,40),fontSize:I,textX:_,textY:E};g.push(k);let F=C;for(let N of w.children)v(N,F,T+1),F+=gy(N);}let S=0;for(let w of i)v(w,S,0),S+=gy(w);return {nodes:g,connectors:y,shadowFilter:Hc(r),viewBox:`0 0 ${s} ${a}`,family:"hierarchy"}}function BGe(t,e,n,r,o){let{width:i,height:s}=e,a=Math.max(1,Math.ceil(Math.sqrt(t.length))),l=Math.max(1,Math.ceil(t.length/a)),c=8,d=6,u=i-c*2,p=s-c*2,h=(u-d*(a-1))/a,f=(p-d*(l-1))/l,m=Math.min(6,Math.min(h,f)*.1),x=oh(r),g=ih(x);return {nodes:t.map((b,v)=>{let S=v%a,w=Math.floor(v/a),C=c+S*(h+d),T=c+w*(f+d),M=Bl(b.text,h*.85,f,12);return {kind:"rect",key:`${o}-matrix-${b.id}-${v}`,x:C,y:T,width:h,height:f,rx:m,fill:$a(b,v,n),stroke:eu(b,g),strokeWidth:x,opacity:Fc(v,t.length,r),text:Ha(b.text,30),fontSize:M,textX:C+h/2,textY:T+f/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"matrix"}}function UGe(t,e,n,r,o){let{width:i,height:s}=e,a=i/2,l=s/2,c=Math.min(i,s),d=oh(r),u=ih(d);if(t.length===0)return {nodes:[],connectors:[],shadowFilter:void 0,viewBox:`0 0 ${i} ${s}`,family:"radial"};let[p,...h]=t,f=c*.14,m=c*.35,x=Math.max(c*.06,Math.min(c*.1,180/Math.max(1,h.length))),g=[],y=[],b=Bl(p.text,f*1.6,f*2,12);return g.push({kind:"circle",key:`${o}-radial-centre-0`,cx:a,cy:l,r:f,fill:$a(p,0,n),stroke:eu(p,u),strokeWidth:d,opacity:Fc(0,t.length,r),text:Ha(p.text,20),fontSize:b}),h.forEach((v,S)=>{let w=S+1,C=S/Math.max(1,h.length)*Math.PI*2-Math.PI/2,T=a+m*Math.cos(C),M=l+m*Math.sin(C),_=Bl(v.text,x*1.4,x*2,10),E=a+f*Math.cos(C),R=l+f*Math.sin(C);y.push({key:`${o}-radial-conn-${w}`,d:`M${E},${R} L${T},${M}`}),g.push({kind:"circle",key:`${o}-radial-${v.id}-${w}`,cx:T,cy:M,r:x,fill:$a(v,w,n),stroke:eu(v,u),strokeWidth:d,opacity:Fc(w,t.length,r),text:Ha(v.text,20),fontSize:_});}),{nodes:g,connectors:y,shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"radial"}}function $Ge(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=3,c=s-a*2,d=t.length>0?(c-l*(t.length-1))/t.length:c,u=i-a*2,p=oh(r),h=ih(p);return {nodes:t.map((m,x)=>{let g=.3+x/Math.max(t.length-1,1)*.7,y=x<t.length-1?.3+(x+1)/Math.max(t.length-1,1)*.7:1,b=u*g,v=u*y,S=a+x*(d+l),w=(i-b)/2,C=w+b,T=(i-v)/2,M=T+v,_=[`${w},${S}`,`${C},${S}`,`${M},${S+d}`,`${T},${S+d}`].join(" "),E=Bl(m.text,b*.85,d,12);return {kind:"polygon",key:`${o}-pyramid-${m.id}-${x}`,points:_,fill:$a(m,x,n),stroke:eu(m,h),strokeWidth:p,opacity:Fc(x,t.length,r),text:Ha(m.text,30),fontSize:E,textX:i/2,textY:S+d/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"pyramid"}}function HGe(t,e,n,r,o){let{width:i,height:s}=e,a=Hc(r);if(t.length<=4){let f=i/2,m=s/2,x=Math.min(i,s)*.28,g=x*.55;return {nodes:t.map((b,v)=>{let S=v/Math.max(1,t.length)*Math.PI*2-Math.PI/2,w=f+g*Math.cos(S),C=m+g*Math.sin(S),T=Bl(b.text,x*1.2,x*2,11);return {kind:"circle",key:`${o}-venn-${b.id}-${v}`,cx:w,cy:C,r:x,fill:$a(b,v,n),stroke:"none",strokeWidth:0,opacity:.35,text:Ha(b.text,20),fontSize:T}}),connectors:[],shadowFilter:a,viewBox:`0 0 ${i} ${s}`,family:"venn"}}let l=Math.min(s*.38,i/(t.length*.9)),c=l*.5,d=t.length*(l*2-c)+c,u=(i-d)/2+l,p=s/2;return {nodes:t.map((f,m)=>{let x=u+m*(l*2-c),g=Bl(f.text,l*1.2,l*2,10);return {kind:"circle",key:`${o}-venn-${f.id}-${m}`,cx:x,cy:p,r:l,fill:$a(f,m,n),stroke:"none",strokeWidth:0,opacity:.35,text:Ha(f.text,20),fontSize:g}}),connectors:[],shadowFilter:a,viewBox:`0 0 ${i} ${s}`,family:"venn"}}function zGe(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=i-a*2,c=t.length>0?(s-a*2)/t.length:s-a*2,d=oh(r),u=ih(d);return {nodes:t.map((h,f)=>{let m=l*(1-f/Math.max(1,t.length)),x=l*(1-(f+1)/Math.max(1,t.length)),g=a+f*c,y=(i-m)/2,b=y+m,v=(i-x)/2,S=v+x,w=[`${y},${g}`,`${b},${g}`,`${S},${g+c}`,`${v},${g+c}`].join(" "),C=Bl(h.text,m*.85,c,11);return {kind:"polygon",key:`${o}-funnel-${h.id}-${f}`,points:w,fill:$a(h,f,n),stroke:eu(h,u),strokeWidth:d,opacity:Fc(f,t.length,r),text:Ha(h.text,30),fontSize:C,textX:i/2,textY:g+c/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"funnel"}}function VGe(t,e,n,r,o){let{width:i,height:s}=e,a=i*.4,l=s/2,c=Math.min(a-8,l-8),d=Hc(r);return {nodes:t.map((p,h)=>{let f=c*((t.length-h)/Math.max(1,t.length));return {kind:"circle",key:`${o}-target-${p.id}-${h}`,cx:a,cy:l,r:Math.max(f,4),fill:$a(p,h,n),stroke:"none",strokeWidth:0,opacity:Fc(h,t.length,r),text:Ha(p.text,30),fontSize:Math.max(7,Math.min(10,c/Math.max(1,t.length+1)))}}),connectors:[],shadowFilter:d,viewBox:`0 0 ${i} ${s}`,family:"target"}}function LU(t,e,n,r,o,i,s){let a=Ane(t);switch(LGe(t,i,s)){case "list":return Rne(a,e,n,r,o);case "process":return DGe(a,e,n,r,o);case "cycle":return FGe(a,e,n,r,o);case "hierarchy":return OGe(t,e,n,r,o);case "matrix":return BGe(a,e,n,r,o);case "radial":return UGe(a,e,n,r,o);case "pyramid":return $Ge(a,e,n,r,o);case "venn":return HGe(a,e,n,r,o);case "funnel":return zGe(a,e,n,r,o);case "target":return VGe(a,e,n,r,o)}}function GGe(t){let e=t.trim().split(/\s+/u).map(Number),n=e[2],r=e[3];return {width:Number.isFinite(n)&&n>0?n:1,height:Number.isFinite(r)&&r>0?r:1}}function WGe(t,e,n,r=4){let o=t/2,i=e/2,s=Math.max(0,Math.min(n,o,i));if(s<=0)return [{x:-o,y:-i},{x:o,y:-i},{x:o,y:i},{x:-o,y:i}];let a=[],l=[{cx:o-s,cy:-i+s,start:-Math.PI/2},{cx:o-s,cy:i-s,start:0},{cx:-o+s,cy:i-s,start:Math.PI/2},{cx:-o+s,cy:-i+s,start:Math.PI}];for(let{cx:c,cy:d,start:u}of l)for(let p=0;p<=r;p++){let h=u+p/r*(Math.PI/2);a.push({x:c+Math.cos(h)*s,y:d+Math.sin(h)*s});}return a}function XGe(t,e=48){let n=[];for(let r=0;r<e;r++){let o=r/e*Math.PI*2;n.push({x:Math.cos(o)*t,y:Math.sin(o)*t});}return n}function jGe(t){let e=[];for(let n of t.trim().split(/\s+/u)){let[r,o]=n.split(","),i=Number(r),s=Number(o);Number.isFinite(i)&&Number.isFinite(s)&&e.push({x:i,y:s});}return e}function YGe(t){let e=[],n=t.match(/[a-zA-Z]|-?\d*\.?\d+(?:e-?\d+)?/gu);if(!n)return e;let r=0,o="",i={x:0,y:0},s=()=>Number(n[r++]);for(;r<n.length;){let a=n[r];/[a-zA-Z]/u.test(a)&&(o=a,r++);let l=o===o.toLowerCase();switch(o.toUpperCase()){case "M":case "L":{let c=s(),d=s();i=l?{x:i.x+c,y:i.y+d}:{x:c,y:d},e.push(i);break}case "H":{let c=s();i={x:l?i.x+c:c,y:i.y},e.push(i);break}case "V":{let c=s();i={x:i.x,y:l?i.y+c:c},e.push(i);break}case "C":{s(),s(),s(),s();let c=s(),d=s();i=l?{x:i.x+c,y:i.y+d}:{x:c,y:d},e.push(i);break}case "Q":{s(),s();let c=s(),d=s();i=l?{x:i.x+c,y:i.y+d}:{x:c,y:d},e.push(i);break}default:r++;}}return e}function KGe(t){if(t.length===0)return {cx:0,cy:0,width:0,height:0};let e=1/0,n=1/0,r=-1/0,o=-1/0;for(let i of t)i.x<e&&(e=i.x),i.y<n&&(n=i.y),i.x>r&&(r=i.x),i.y>o&&(o=i.y);return {cx:(e+r)/2,cy:(n+o)/2,width:r-e,height:o-n}}function qGe(t){let e=t.trim().replace(/^#/u,"");return e.length===3&&(e=e.split("").map(n=>n+n).join("")),e.length!==6||/[^0-9a-fA-F]/u.test(e)?[128,128,128]:[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}function ZGe(t){let[e,n,r]=qGe(t);return (.299*e+.587*n+.114*r)/255>.6?"#1a1a1a":"#ffffff"}function dee(t,e){let n=Math.hypot(t,e),r=Math.atan2(t,e);return {pos:{x:n*Math.sin(r),y:0,z:n*Math.cos(r)},angle:r}}function JGe(t){let e=t.meshes.map(r=>{let{pos:o,angle:i}=dee(r.position.x,r.position.y);return {...r,position:o,rotation:{x:0,y:i,z:0}}}),n=t.connectors.map(r=>({...r,points:r.points.map(o=>dee(o.x,o.y).pos)}));return {...t,meshes:e,connectors:n}}function QGe(t){if(t.meshes.length===0)return t;let e=-1/0,n=1/0;for(let l of t.meshes)l.position.y>e&&(e=l.position.y),l.position.y<n&&(n=l.position.y);let r=e-n||1,o=Math.max(t.bounds.width,t.bounds.height)*.6,i=l=>-((e-l)/r)*o,s=t.meshes.map(l=>({...l,position:{x:l.position.x,y:l.position.y,z:i(l.position.y)}})),a=t.connectors.map(l=>({...l,points:l.points.map(c=>({x:c.x,y:c.y,z:i(c.y)}))}));return {...t,meshes:s,connectors:a}}function eWe(t){switch(t.family){case "cycle":case "radial":return JGe(t);case "hierarchy":return QGe(t);default:return t}}function rWe(t,e){if(typeof e.depth=="number"&&e.depth>0)return e.depth;let n=e.depthRatio??tWe;return Math.max(2,t*n)}function oWe(t,e,n,r){let o=m=>m-e/2,i=m=>n/2-m,s,a=false,l,c,d,u;if(t.kind==="rect")l=t.x+t.width/2,c=t.y+t.height/2,d=t.width/2,u=t.height/2,s=WGe(t.width,t.height,t.rx),a=t.rx>0;else if(t.kind==="circle")l=t.cx,c=t.cy,d=t.r,u=t.r,s=XGe(t.r),a=true;else {let m=jGe(t.points);if(m.length<3)return null;let x=KGe(m);l=x.cx,c=x.cy,d=x.width/2,u=x.height/2,s=m.map(g=>({x:g.x-x.cx,y:x.cy-g.y}));}let p=Math.max(2,Math.min(d,u)*2),h=rWe(p,r),f=h*(r.bevelRatio??nWe);return {id:t.key,outline:s,rounded:a,depth:h,bevel:f,fill:t.fill,stroke:t.stroke,strokeWidth:t.strokeWidth,opacity:t.opacity,position:{x:o(l),y:i(c),z:0},rotation:{x:0,y:0,z:0},text:t.text,textColor:ZGe(t.fill),fontSize:t.fontSize,halfWidth:d,halfHeight:u}}function kne(t,e={}){let{width:n,height:r}=GGe(t.viewBox),o=[];for(let a of t.nodes){let l=oWe(a,n,r,e);l&&o.push(l);}let i=[];for(let a of t.connectors){let l=YGe(a.d);l.length<2||i.push({id:a.key,points:l.map(c=>({x:c.x-n/2,y:r/2-c.y,z:0})),color:"#888888",width:1.5});}let s={meshes:o,connectors:i,bounds:{width:n,height:r},family:t.family,background:e.background};return e.spatial?eWe(s):s}function sWe(t){return uee[t??"unknown"]??uee.unknown}function Ine(t){let e=[],n=r=>{e.push(r);for(let o of r.children??[])n(o);};for(let r of t)n(r);return e}function aWe(t){return Ine(t).map(e=>(e.text??"").trim()).filter(e=>e.length>0)}function lWe(t){let e=sWe(t.resolvedLayoutType),n=aWe(t.nodes??[]),r=n.length,o=`${e} SmartArt diagram`;if(r===0)return `${o} with no nodes`;let i=r===1?"node":"nodes",s=n.slice(0,iWe),a=r-s.length,l=a>0?`${s.join("; ")}; and ${a} more`:s.join("; ");return `${o} with ${r} ${i}: ${l}`}function cWe(t,e,n){let r=`Node ${e+1} of ${n}`,o=(t??"").trim();return o.length>0?`${r}: ${o}`:r}function Nne(t){let e=Ine(t.nodes??[]),n=e.length,r=e.map((o,i)=>({id:o.id,label:cWe(o.text,i,n)}));return {role:"img",label:lWe(t),nodes:r}}async function uWe(){try{return await Promise.resolve().then(()=>(Ic(),hy))}catch{return null}}async function pWe(){try{return (await Promise.resolve().then(()=>(kQ(),RQ))).GLTFLoader}catch{return null}}async function hWe(){try{return (await Promise.resolve().then(()=>(nA(),DB))).OrbitControls}catch{return null}}function fWe(t,e){return new Promise((n,r)=>{t.load(e,n,void 0,r);})}function mWe(t,e){let n=new t.Box3().setFromObject(e),r=new t.Vector3;n.getSize(r);let o=Math.max(r.x,r.y,r.z);o>0&&e.scale.setScalar(2/o);let i=new t.Vector3;n.getCenter(i),e.position.sub(i.multiplyScalar(e.scale.x));}async function Lne(t,e,n){let r=await uWe(),o=r?await pWe():null;if(!r||!o)return pee;let i=Math.max(1,n.width),s=Math.max(1,n.height),a=new r.WebGLRenderer({antialias:true,alpha:!n.background});a.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,n.maxPixelRatio??2)),a.setSize(i,s,false);let l=a.domElement;l.style.width=`${i}px`,l.style.height=`${s}px`,l.style.display="block",l.style.willChange="transform",t.appendChild(l);let c=new r.Scene;n.background&&(c.background=new r.Color(n.background));let d=new r.PerspectiveCamera(dWe,i/s,.1,1e3);d.position.set(0,0,5),d.lookAt(0,0,0),c.add(new r.AmbientLight(16777215,.5));let u=new r.DirectionalLight(16777215,1);u.position.set(5,5,5),c.add(u);let p=new r.DirectionalLight(16777215,.3);p.position.set(-3,-3,2),c.add(p);let h;try{h=await fWe(new o,e);}catch{return a.dispose(),l.remove(),pee}let f=h.scene;mWe(r,f),c.add(f);let m=null,x=await hWe(),g=w=>{w&&!m&&x?(m=new x(d,l),m.enablePan=false,m.enableZoom=true,m.enableRotate=true,m.minDistance=2,m.maxDistance=20,m.update()):!w&&m&&(m.dispose(),m=null);};g(n.interactive??true);let y=0,b=false,v=()=>{b||(y=requestAnimationFrame(v),m?.update(),a.render(c,d));};y=requestAnimationFrame(v);let S=()=>{f.traverse(w=>{let C=w;C.geometry?.dispose();let T=C.material;if(Array.isArray(T))for(let M of T)M.dispose();else T?.dispose();});};return {ok:true,resize(w,C){let T=Math.max(1,w),M=Math.max(1,C);d.aspect=T/M,d.updateProjectionMatrix(),a.setSize(T,M,false),l.style.width=`${T}px`,l.style.height=`${M}px`;},setInteractive(w){g(w);},dispose(){b||(b=true,cancelAnimationFrame(y),m?.dispose(),S(),c.clear(),a.dispose(),l.remove());}}}function QA(t,e){return {gridWidth:Math.max(t-1,1)*hee,gridDepth:Math.max(e-1,1)*hee}}function gWe(t,e,n,r,o){let i=Math.max(e-1,0),s=Math.max(n-1,0),{gridWidth:a,gridDepth:l}=QA(e,n),c=new t.PlaneGeometry(a,l,i,s);c.rotateX(-Math.PI/2);let d=c.attributes.position,u=d.count,p=new Float32Array(u*3);for(let f=0;f<u;f++){let m=Math.floor(f/e),x=f%e,g=m*e+x,y=g<r.length?r[g]:0;d.setY(f,y*Dne);let b=g*3;p[f*3]=b<o.length?o[b]:.5,p[f*3+1]=b+1<o.length?o[b+1]:.5,p[f*3+2]=b+2<o.length?o[b+2]:.5;}c.setAttribute("color",new t.BufferAttribute(p,3)),c.computeVertexNormals(),d.needsUpdate=true;let h=new t.WireframeGeometry(c);return {geometry:c,wireGeometry:h}}function xWe(t,e,n,r,o=8,i=6){let{gridWidth:s,gridDepth:a}=QA(t,e),l=[],c=Math.max(1,Math.ceil(n.length/o));for(let u=0;u<n.length;u+=c){let p=-s/2+u/Math.max(t-1,1)*s;l.push({key:`cat-${u}`,text:n[u],anchor:[p,-0.15,a/2+.25],axis:"category"});}let d=Math.max(1,Math.ceil(r.length/i));for(let u=0;u<r.length;u+=d){let p=-a/2+u/Math.max(e-1,1)*a;l.push({key:`ser-${u}`,text:r[u],anchor:[s/2+.3,-0.15,p],axis:"series"});}return l.push({key:"value-axis",text:"Value",anchor:[-s/2-.35,.75,-a/2],axis:"value"}),l}function yWe(t,e){let{gridWidth:n,gridDepth:r}=QA(t,e),i=Math.max(n,r,Dne)*1.8;return {position:[i*.8,i*.7,i*.8],target:[0,.3,0]}}async function SWe(){try{return await Promise.resolve().then(()=>(Ic(),hy))}catch{return null}}async function wWe(){try{return (await Promise.resolve().then(()=>(nA(),DB))).OrbitControls}catch{return null}}function TWe(t,e){let n=t.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",pointerEvents:"none",overflow:"hidden"});let r=e.map(o=>{let i=t.createElement("div");i.textContent=o.text;let s=o.axis==="value"?"#999":"#666";return Object.assign(i.style,{position:"absolute",fontSize:"9px",color:s,whiteSpace:"nowrap",userSelect:"none",transform:"translate(-50%, -50%)",willChange:"left, top"}),o.axis==="value"&&(i.style.writingMode="vertical-rl"),n.appendChild(i),i});return {layer:n,nodes:r}}async function Fne(t,e){let n=await SWe(),r=n?await wWe():null;if(!n||!r)return bWe;let{cols:o,rows:i}=e,s=Math.max(1,e.width),a=Math.max(1,e.height),l=new n.WebGLRenderer({antialias:true,alpha:true});l.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,e.maxPixelRatio??2)),l.setSize(s,a,false);let c=l.domElement;c.style.width=`${s}px`,c.style.height=`${a}px`,c.style.display="block",c.style.willChange="transform",t.appendChild(c);let d=new n.Scene;d.add(new n.AmbientLight(16777215,.6));let u=new n.DirectionalLight(16777215,.8);u.position.set(5,8,5),d.add(u);let p=new n.DirectionalLight(16777215,.3);p.position.set(-3,4,-2),d.add(p);let h=new n.PerspectiveCamera(vWe,s/a,.1,1e3),f=yWe(o,i);h.position.set(...f.position);let m=new n.Vector3(...f.target);h.lookAt(m);let{gridWidth:x,gridDepth:g}=QA(o,i),y=Math.max(x,g)*1.2,b=new n.GridHelper(y,Math.max(o,i),13421772,15263976);b.position.y=-0.02,d.add(b);let{geometry:v,wireGeometry:S}=gWe(n,o,i,e.heightMap,e.colorMap),w=new n.MeshPhongMaterial({vertexColors:true,side:n.DoubleSide,shininess:30,transparent:true,opacity:.92}),C=new n.Mesh(v,w);d.add(C);let T=null;e.wireframe&&(T=new n.LineBasicMaterial({color:3355443,transparent:true,opacity:.25}),d.add(new n.LineSegments(S,T)));let M=new r(h,c);M.enablePan=true,M.enableZoom=true,M.enableRotate=true,M.minDistance=1,M.maxDistance=20,M.maxPolarAngle=Math.PI/2+.3,M.target.copy(m),M.update();let _=t.ownerDocument??document,E=xWe(o,i,e.categoryLabels,e.seriesNames),{layer:R,nodes:I}=TWe(_,E);t.appendChild(R);let L=E.map(G=>new n.Vector3(...G.anchor)),k=new n.Vector3,F=()=>{for(let G=0;G<I.length;G++){k.copy(L[G]).project(h);let j=I[G];if(k.z>1){j.style.display="none";continue}j.style.display="",j.style.left=`${(k.x+1)/2*s}px`,j.style.top=`${(-k.y+1)/2*a}px`;}},N=0,D=false,U=()=>{D||(N=requestAnimationFrame(U),M.update(),l.render(d,h),F());};return N=requestAnimationFrame(U),{ok:true,resize(G,j){s=Math.max(1,G),a=Math.max(1,j),h.aspect=s/a,h.updateProjectionMatrix(),l.setSize(s,a,false),c.style.width=`${s}px`,c.style.height=`${a}px`;},dispose(){D||(D=true,cancelAnimationFrame(N),M.dispose(),v.dispose(),S.dispose(),w.dispose(),T?.dispose(),b.dispose(),d.clear(),l.dispose(),c.remove(),R.remove());}}}function eR(t){return Number.isNaN(t)?0:Math.min(100,Math.max(0,Math.round(t)))}function vT(t,e,n=90){return e<=0?0:eR(t/e*n)}function One(t,e){return e<=0?45:eR(45+t/e*45)}function Wy(t,e,n){return `${t} slide ${e+1} of ${n}...`}function ST(t){return t instanceof DOMException&&t.name==="AbortError"}function _We(t={}){return new Promise(e=>{if(typeof document>"u"){e(null);return}let n=document.createElement("input");n.type="file",n.accept=t.accept??MWe,n.style.position="fixed",n.style.left="-9999px",n.style.opacity="0";let r=false,o=s=>{r||(r=true,n.remove(),e(s));};n.addEventListener("change",()=>o(n.files?.[0]??null)),n.addEventListener("cancel",()=>o(null));let i=()=>{window.removeEventListener("focus",i),setTimeout(()=>o(null),300);};window.addEventListener("focus",i),document.body.appendChild(n),n.click();})}async function Bne(t={}){let e=await _We(t);return e?{file:e,buffer:await e.arrayBuffer()}:null}function Une(t,e){return e<=0?"0 / 0":`${t+1} / ${e}`}function $ne(t){return t<=0}function Hne(t,e){return t>=e-1}function Gw(t){return String(t).padStart(2,"0")}function zne(t,e){if(t==null)return 0;let n=e-t;return n>0?n:0}function Vne(t){let e=t>0?t:0,n=Math.floor(e/1e3),r=Math.floor(n/3600),o=Math.floor(n%3600/60),i=n%60;return r>0?`${Gw(r)}:${Gw(o)}:${Gw(i)}`:`${Gw(o)}:${Gw(i)}`}function DU(t){let{layoutHeight:e,visualHeight:n,offsetTop:r}=t;if(!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(r)||e<=0||n<=0)return 0;let o=e-(n+r);return o<=0?0:Math.round(o)}function Gne(t,e=PWe){return t>=e}function FU(t=typeof window<"u"?window:void 0){if(!t)return null;let e=t.visualViewport;return e?{layoutHeight:t.innerHeight,visualHeight:e.height,offsetTop:e.offsetTop}:null}function Wne(t,e,n,r=16){let o=e-n;return t.bottom>o-r?t.bottom-(o-r):t.top<r?t.top-r:0}function Xne(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function jne(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 tR(t){return t.trim().length===0?"webrtc":"websocket"}function Kne(){return `broadcast-${Math.random().toString(36).slice(2,10)}`}function qne(t,e,n){if(!n)return t;let r=encodeURIComponent(t),o=e.trim();if(o.length===0)return `${n.origin}${n.pathname}?broadcast=${r}&transport=webrtc`;let i=encodeURIComponent(o);return `${n.origin}${n.pathname}?broadcast=${r}&server=${i}`}function iR(t){return Math.max(nR,Math.min(rR,t))}function BU(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Xy(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 UU(t){return t.map((e,n)=>{if(e.isParagraphBreak)return {kind:"break",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),{kind:"text",key:`seg-${n}`,text:e.text,style:r}})}function $U(t,e){return `${t+1} / ${e}`}function Kw(t){let e=t.replace(/^#/u,"");if(e.length!==6)return null;let n=parseInt(e,16);return Number.isFinite(n)?{r:n>>16&255,g:n>>8&255,b:n&255}:null}function Zne(t,e){let n=t.r-e.r,r=t.g-e.g,o=t.b-e.b;return Math.sqrt(n*n+r*r+o*o)}function Qne(t){return Math.max(0,Math.min(100,t))/100*Jne}function ere(t,e,n,r,o){let i=t.length;for(let s=0;s<i;s+=4){let a={r:t[s],g:t[s+1],b:t[s+2]};Zne(a,e)<=r&&(o?(t[s]=0,t[s+1]=0,t[s+2]=0,t[s+3]=0):(t[s]=n.r,t[s+1]=n.g,t[s+2]=n.b));}}function zU(t,e,n,r=aR,o=false){return new Promise((i,s)=>{let a=Kw(e),l=Kw(n);if(!a||!l){s(new Error(`Invalid hex colour: from="${e}" to="${n}"`));return}let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{let{naturalWidth:d,naturalHeight:u}=c;if(d===0||u===0){s(new Error("Image has zero dimensions"));return}let p=document.createElement("canvas");p.width=d,p.height=u;let h=p.getContext("2d");if(!h){s(new Error("Cannot create 2D canvas context"));return}h.drawImage(c,0,0);let f=h.getImageData(0,0,d,u),m=Qne(r);ere(f.data,a,l,m,o),h.putImageData(f,0,0),i({dataUrl:p.toDataURL("image/png"),width:d,height:u});},c.onerror=()=>{s(new Error("Failed to load image for colour change processing"));},c.src=t;})}function VU(t,e,n,r,o){return `${t.length>64?t.slice(0,64):t}|${e}|${n}|${r}|${o}`}function wT(t){return Ww.get(t)}function GU(t,e){if(Ww.size>=AWe){let n=Ww.keys().next().value;n!==void 0&&Ww.delete(n);}Ww.set(t,e);}function tre(t,e,n){let r=t.length;for(let o=0;o<r;o+=4){let s=(.2126*t[o]+.7152*t[o+1]+.0722*t[o+2])/255,a=1-s;t[o]=Math.round(e.r*a+n.r*s),t[o+1]=Math.round(e.g*a+n.g*s),t[o+2]=Math.round(e.b*a+n.b*s);}}function WU(t,e,n){return new Promise((r,o)=>{let i=Kw(e),s=Kw(n);if(!i||!s){o(new Error(`Invalid hex colour: shadow="${e}" highlight="${n}"`));return}let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{let{naturalWidth:l,naturalHeight:c}=a;if(l===0||c===0){o(new Error("Image has zero dimensions"));return}let d=document.createElement("canvas");d.width=l,d.height=c;let u=d.getContext("2d");if(!u){o(new Error("Cannot create 2D canvas context"));return}u.drawImage(a,0,0);let p=u.getImageData(0,0,l,c);tre(p.data,i,s),u.putImageData(p,0,0),r({dataUrl:d.toDataURL("image/png"),width:l,height:c});},a.onerror=()=>{o(new Error("Failed to load image for duotone processing"));},a.src=t;})}function XU(t,e,n){return `dt|${t.length>64?t.slice(0,64):t}|${e}|${n}`}function lR(t){return Xw.get(t)}function jU(t,e){if(Xw.size>=RWe){let n=Xw.keys().next().value;n!==void 0&&Xw.delete(n);}Xw.set(t,e);}function KU(t){switch(t.type){case "image":case "picture":return "img";case "table":return "table";case "group":return "group";case "chart":return "img";case "smartArt":return "img";case "connector":return "img";case "media":return "application";case "ink":return "img";case "model3d":return "img";case "text":return;case "shape":return ze(t)&&t.text?void 0:"img";default:return}}function qU(t){if((t.type==="image"||t.type==="picture")&&"altText"in t&&typeof t.altText=="string"&&t.altText.trim())return t.altText.trim();if(ze(t)&&t.text){let e=t.text.trim();if(e)return e.length>120?`${e.slice(0,117)}...`:e}if(t.type==="chart"&&"chartData"in t&&t.chartData){let e=t.chartData;return e.title?`Chart: ${e.title}`:"Chart"}return t.type==="smartArt"?"SmartArt diagram":t.type==="table"?"Table":t.type==="media"?"Media element":t.type==="group"?"Group of elements":t.type==="connector"?"Connector line":t.type==="ink"?"Ink drawing":t.type==="model3d"?"3D Model":t.type==="shape"?"shapeType"in t&&t.shapeType?`Shape: ${t.shapeType}`:"Shape":kWe(t.type)}function kWe(t){switch(t){case "text":return "Text box";case "shape":return "Shape";case "image":case "picture":return "Image";case "table":return "Table";case "chart":return "Chart";case "connector":return "Connector";case "group":return "Group";case "smartArt":return "SmartArt";case "media":return "Media";case "ink":return "Drawing";case "ole":return "Embedded object";case "contentPart":return "Content part";case "model3d":return "3D Model";default:return "Element"}}function ZU(t){switch(t.type){case "shape":{let e="shapeType"in t&&typeof t.shapeType=="string"?t.shapeType:void 0;return e?`shape: ${e}`:"shape"}case "chart":return "chart";case "connector":return "connector line";case "smartArt":return "diagram";case "image":case "picture":return "image";case "table":return "data table";case "group":return "grouped elements";case "media":return "media player";case "ink":return "ink drawing";case "model3d":return "3D model";default:return}}function TT(t){let e=[],n=/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/giu,r=[],o;for(;(o=n.exec(t))!==null;)r.push(parseFloat(o[0]));for(let i=0;i<r.length-1;i+=2)e.push({x:r[i],y:r[i+1]});return e}function nre(t,e){if(t.length===0)return 1;if(t.length===1)return t[0];let r=Math.max(0,Math.min(1,e))*(t.length-1),o=Math.floor(r),i=Math.min(o+1,t.length-1),s=r-o;return t[o]*(1-s)+t[i]*s}function JU(t,e,n){if(t.length===0)return [];let r=n.minRadius,o=n.maxRadius??n.baseWidth;return t.map((i,s)=>{let a=t.length===1?.5:s/(t.length-1),l=nre(e,a),c=n.baseWidth>0?l/n.baseWidth:1,d=Math.max(r,Math.min(o,n.baseWidth/2*c));return {cx:i.x,cy:i.y,r:d}})}function jy(t){if(t.length<=1)return false;let e=t[0];return t.some(n=>Math.abs(n-e)>.01)}function cR(t,e,n=.3,r=1.8){return t.map(o=>{let i=Math.max(0,Math.min(1,o));return e*(n+i*(r-n))})}function QU(t){if(t.length<2)return 0;let e=0;for(let n=1;n<t.length;n++){let r=t[n].x-t[n-1].x,o=t[n].y-t[n-1].y;e+=Math.sqrt(r*r+o*o);}return e}function t$(t,e,n={}){let r=n.strokeDurationMs??600,o=n.strokeDelayMs??200,i=n.easing??"ease-in-out",s=t*(r+o),a=Math.max(e,1);return {pathLength:a,animationDelay:`${s}ms`,animationDuration:`${r}ms`,animation:`${e$} ${r}ms ${i} ${s}ms forwards`,strokeDasharray:`${a}`,strokeDashoffset:`${a}`}}function n$(t,e={}){return t.inkPaths.map((n,r)=>{let o=TT(n),i=QU(o);return t$(r,i,e)})}function r$(t,e={}){return t.map((n,r)=>{let o=TT(n.path),i=QU(o);return t$(r,i,e)})}function o$(t,e){return !t||e>=t.length?1:Math.max(0,Math.min(1,t[e]))}function i$(t,e,n="#000"){return !t||e>=t.length?n:t[e]||n}function s$(t,e,n=3){return !t||e>=t.length?n:t[e]>0?t[e]:n}function l4(t,e){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function sre(t,e,n){return Math.min(Math.max(t,e),n)}function are(t){let{getScale:e,minScale:n,maxScale:r,callbacks:o}=t,i=0,s=1,a=false,l=0,c=0,d=0,u=0,p=null,h=0,f=0,m=()=>{p!==null&&(clearTimeout(p),p=null);},x=v=>{v.touches.length===2?(a=true,i=l4(v.touches[0],v.touches[1]),s=e(),m(),v.preventDefault()):v.touches.length===1&&(l=v.touches[0].clientX,c=v.touches[0].clientY,d=l,u=c,h=v.touches[0].clientX,f=v.touches[0].clientY,m(),p=setTimeout(()=>{p=null,o.onLongPress?.(h,f);},ire));},g=v=>{if(v.touches.length===2&&a){v.preventDefault();let S=l4(v.touches[0],v.touches[1]);if(i>0){let w=S/i,C=sre(s*w,n,r);o.onPinchZoom?.(C);}}else if(v.touches.length===1){d=v.touches[0].clientX,u=v.touches[0].clientY;let S=v.touches[0].clientX-h,w=v.touches[0].clientY-f;(Math.abs(S)>a4||Math.abs(w)>a4)&&m();}},y=v=>{if(a){a=false,i=0;return}if(m(),v.touches.length===0){let S=v.changedTouches.length>=1?v.changedTouches[0].clientX:d,w=v.changedTouches.length>=1?v.changedTouches[0].clientY:u,C=S-l,T=w-c;Math.abs(C)>=rre&&Math.abs(T)<ore&&o.onSwipe?.(C>0?1:-1);}},b=()=>{a=false,i=0,m();};return {onTouchStart:x,onTouchMove:g,onTouchEnd:y,onTouchCancel:b,cancel:b}}function cre(t=a$,e){return rS(t,{categories:[...IWe],series:[{name:"Series 1",values:[...NWe]}],title:"Chart Title",hasLegend:true},{x:aA.x,y:aA.y,width:aA.width,height:aA.height})}function LWe(t){let e=t.trim().split(/\s+/u),n=1/0,r=1/0,o=-1/0,i=-1/0;for(let s of e){let a=s.indexOf(",");if(a<0)continue;let l=parseFloat(s.slice(0,a)),c=parseFloat(s.slice(a+1));!isFinite(l)||!isFinite(c)||(l<n&&(n=l),l>o&&(o=l),c<r&&(r=c),c>i&&(i=c));}return isFinite(n)?{x:n,y:r,width:o-n,height:i-r}:{x:0,y:0,width:0,height:0}}function DWe(t,e,n){let r=`reflow-${n}-${e}`,o=t.text||void 0;if(t.kind==="rect")return {id:r,shapeType:t.rx>0?"roundRect":"rect",x:t.x,y:t.y,width:t.width,height:t.height,rotation:0,fillColor:t.fill,strokeColor:t.stroke,strokeWidth:t.strokeWidth,text:o,fontSize:t.fontSize};if(t.kind==="circle")return {id:r,shapeType:"ellipse",x:t.cx-t.r,y:t.cy-t.r,width:t.r*2,height:t.r*2,rotation:0,fillColor:t.fill,strokeColor:t.stroke,strokeWidth:t.strokeWidth,text:o,fontSize:t.fontSize};let i=LWe(t.points);return {id:r,shapeType:"chevron",x:i.x,y:i.y,width:i.width,height:i.height,rotation:0,fillColor:t.fill,strokeColor:t.stroke,strokeWidth:t.strokeWidth,text:o,fontSize:t.fontSize}}function FWe(t,e){let n=Ane([...e]),r=t.family,o=[];for(let i=0;i<t.nodes.length;i++){let s=t.nodes[i],l=n[i]?.id??s.key;o.push(DWe(s,l,r));}return o}function CT(t,e,n,r,o,i){let s=t.drawingShapes;if(s!==void 0&&s.length>0||t.nodes.length===0)return t;let a=LU(t.nodes,i,n,r,o,t.resolvedLayoutType,e);return {...t,drawingShapes:FWe(a,t.nodes)}}function ure(t){let{autosaveState:e,isDirty:n,autosaveEnabled:r}=t;return r&&e==="saving"?"pptx.autosave.saving":r&&e==="error"?"pptx.autosave.error":n?"pptx.statusBar.unsavedChanges":"pptx.titleBar.savedToThisPc"}function hre(){return new Promise((t,e)=>{let n=indexedDB.open(OWe,BWe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(wy)||r.createObjectStore(wy,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function UWe(){let t=await hre();return new Promise(e=>{try{let n=t.transaction(wy,"readwrite"),r=n.objectStore(wy),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 fee(t,e){return hre().then(n=>new Promise((r,o)=>{let i=n.transaction(wy,"readwrite");i.objectStore(wy).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 fre(t,e){try{return await fee(t,e)}catch(n){if((n instanceof Error||n instanceof DOMException?n.name:"")!=="QuotaExceededError"||!await UWe())throw n;return fee(t,e)}}function gre(t){if(typeof t!="string"||t.trim().length===0)return mee;let e=t.replace(/[\x00-\x1f\x7f"\\/:*?<>|]/gu,"_").replace(/\.\./gu,"__").replace(/^\.+/u,"").trim();if(e.length===0)return mee;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 ru(t,e){let n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),setTimeout(()=>{r.remove(),URL.revokeObjectURL(n);},mre);}function uR(t,e){let n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),setTimeout(()=>{n.remove();},mre);}function pR(t,e=.92){let r=t.toDataURL("image/jpeg",e).split(",")[1]??"",o=atob(r),i=new Uint8Array(o.length);for(let s=0;s<o.length;s++)i[s]=o.charCodeAt(s);return {bytes:i,w:t.width,h:t.height}}function c$(t,e={}){if(t.length===0)throw new Error("[gif-encoder] encodeGif: frames array must not be empty");let n=typeof e=="number"?{delayCs:e}:e,{delayCs:r=200,loopCount:o=0}=n,i=t[0].width,s=t[0].height,a=[];gee(a,"GIF89a"),Jp(a,i),Jp(a,s),a.push(112),a.push(0),a.push(0),a.push(33,255,11),gee(a,"NETSCAPE2.0"),a.push(3,1),Jp(a,o),a.push(0);for(let l of t){let{palette:c,indexed:d}=$We(l.imageData);a.push(33,249,4),a.push(0),Jp(a,r),a.push(0),a.push(0),a.push(44),Jp(a,0),Jp(a,0),Jp(a,i),Jp(a,s),a.push(135);for(let f=0;f<256;f++)a.push(c[f*3]??0),a.push(c[f*3+1]??0),a.push(c[f*3+2]??0);let u=8;a.push(u);let p=zWe(d,u),h=0;for(;h<p.length;){let f=Math.min(255,p.length-h);a.push(f);for(let m=0;m<f;m++)a.push(p[h+m]);h+=f;}a.push(0);}return a.push(59),new Uint8Array(a)}function Jp(t,e){t.push(e&255),t.push(e>>8&255);}function gee(t,e){for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));}function $We(t){let e=t.data,n=t.width*t.height,r=Math.max(1,Math.floor(n/1e4)),o=[];for(let c=0;c<n;c+=r){let d=c*4;o.push([e[d],e[d+1],e[d+2]]);}let i=c4(o,8),s=new Uint8Array(768),a=[];for(let c=0;c<256;c++)if(c<i.length&&i[c].length>0){let d=0,u=0,p=0;for(let[g,y,b]of i[c])d+=g,u+=y,p+=b;let h=i[c].length,f=Math.round(d/h),m=Math.round(u/h),x=Math.round(p/h);s[c*3]=f,s[c*3+1]=m,s[c*3+2]=x,a.push([f,m,x]);}else a.push([0,0,0]);let l=new Uint8Array(n);for(let c=0;c<n;c++){let d=c*4;l[c]=HWe(a,e[d],e[d+1],e[d+2]);}return {palette:s,indexed:l}}function c4(t,e){if(e===0||t.length<=1)return [t];let n=255,r=0,o=255,i=0,s=255,a=0;for(let[h,f,m]of t)h<n&&(n=h),h>r&&(r=h),f<o&&(o=f),f>i&&(i=f),m<s&&(s=m),m>a&&(a=m);let l=r-n,c=i-o,d=a-s,u=0;c>=l&&c>=d?u=1:d>=l&&d>=c&&(u=2),t.sort((h,f)=>h[u]-f[u]);let p=Math.floor(t.length/2);return [...c4(t.slice(0,p),e-1),...c4(t.slice(p),e-1)]}function HWe(t,e,n,r){let o=0,i=1/0;for(let s=0;s<t.length;s++){let[a,l,c]=t[s],d=(e-a)**2+(n-l)**2+(r-c)**2;d<i&&(i=d,o=s);}return o}function zWe(t,e){let n=1<<e,r=n+1,o=[],i=e+1,s=r+1,a=4096,l=new Map,c=()=>{l.clear();for(let m=0;m<n;m++)l.set(String(m),m);i=e+1,s=r+1;},d=0,u=0,p=(m,x)=>{for(d|=m<<u,u+=x;u>=8;)o.push(d&255),d>>=8,u-=8;};c(),p(n,i);let h=String(t[0]);for(let m=1;m<t.length;m++){let x=`${h},${String(t[m])}`;if(l.has(x))h=x;else {let g=l.get(h);g!==void 0&&p(g,i),s<a?(l.set(x,s++),s>1<<i&&i<12&&i++):(p(n,i),c()),h=String(t[m]);}}let f=l.get(h);return f!==void 0&&p(f,i),p(r,i),u>0&&o.push(d&255),new Uint8Array(o)}function xre(t){return GWe[t]??{rows:3,columns:2}}function yre(t,e){return t<=0?0:Math.ceil(t/e)}function bre(t,e,n,r,o=Fl){let i=xre(e),s=o.width-o.marginLeft-o.marginRight,a=o.height-o.marginTop-o.marginBottom,l=e===3,c=[];if(l){let d=s*VWe,u=(a-my*(i.rows-1))/i.rows;for(let p=0;p<i.rows;p++){let h=r+p;c.push({slideIndex:h<n?h:-1,row:p,col:0,x:0,y:p*(u+my),width:d,height:u});}}else {let d=(s-my*(i.columns-1))/i.columns,u=(a-my*(i.rows-1))/i.rows,p=0;for(let h=0;h<i.rows;h++)for(let f=0;f<i.columns;f++){let m=r+p;c.push({slideIndex:m<n?m:-1,row:h,col:f,x:f*(d+my),y:h*(u+my),width:d,height:u}),p++;}}return {pageIndex:t,cells:c,hasNoteLines:l}}function hR(t,e,n="portrait"){let r=t.length;if(r===0)return [];let o=n==="landscape"?d$:Fl,i=yre(r,e),s=[];for(let a=0;a<i;a++){let l=a*e,c=bre(a,e,r,l,o),d=c.cells.map(u=>({...u,slideIndex:u.slideIndex>=0&&u.slideIndex<r?t[u.slideIndex]:-1}));s.push({...c,cells:d});}return s}function fR(t="portrait"){let e=t==="landscape"?d$:Fl;return {width:e.width-e.marginLeft-e.marginRight,height:e.height-e.marginTop-e.marginBottom}}function mR(){return 8}function vre(t,e,n=Fl){let r=n.width-n.marginLeft-n.marginRight,o=n.height-n.marginTop-n.marginBottom,i=o*WWe,s=r,a=s/xee;a>i&&(a=i,s=a*xee);let l=(r-s)/2,c=(i-a)/2,d=i+XWe,u=o-d;return {pageIndex:t,slideIndex:e,slideArea:{x:l,y:c,width:s,height:a},textArea:{x:0,y:d,width:r,height:Math.max(0,u)}}}function gR(t){return t.map((e,n)=>vre(n,e))}function xR(){return {width:Fl.width-Fl.marginLeft-Fl.marginRight,height:Fl.height-Fl.marginTop-Fl.marginBottom}}function bR(t,e){let n=Am-2*Ni,r=Lc-2*Ni,o=r*u$,i=r-o-Nm,s=Math.min(n/t,o/e),a=t*s,l=e*s,c=Ni+(n-a)/2,u=Lc-Ni-l,p=u-Nm,h=Yy*yR,f=Math.floor(i/h);return {contentWidth:n,contentHeight:r,slideAreaHeight:o,notesAreaHeight:i,imageWidth:a,imageHeight:l,imageX:c,imageY:u,notesTextY:p,maxNotesLines:f}}function vR(t,e,n){if(!t||t.trim().length===0)return [];let r=n*.5,o=Math.floor(e/r);if(o<=0)return [];let i=[],s=t.split(/\r?\n/u);for(let a of s){if(a.trim().length===0){i.push("");continue}let l=a.split(/\s+/u),c="";for(let d of l)c.length===0?c=d:c.length+1+d.length<=o?c+=` ${d}`:(i.push(c),c=d);c.length>0&&i.push(c);}return i}function SR(){let t=Lc-2*Ni,e=qw+Nm,n=t-e,r=Yy*yR;return Math.floor(n/r)}function Ty(t){return t.replace(/\\/gu,"\\\\").replace(/\(/gu,"\\(").replace(/\)/gu,"\\)")}function mA(t,e){if(t.length===0)return "";let n=`BT /F1 ${Yy} Tf 0 0 0 rg `;n+=`${Ni} ${e.toFixed(2)} Td `;for(let r=0;r<t.length;r++){let o=t[r];r===0?n+=`(${Ty(o)}) Tj `:n+=`0 ${(-15.399999999999999).toFixed(2)} Td (${Ty(o)}) Tj `;}return n+=`ET
4466
+ `&&n.insert!=="\u200B"&&(o.text=n.insert),e.push(o);}return e}function cGe(t){return o4(t.toDelta())}function Sne(t,e,n){let r=t;for(let[o,i]of Object.entries(r))if(i!==void 0)if(vne.has(o))e.set(o,i);else if(o==="textSegments"){if(Array.isArray(i)){let s=n.createText();bne(i,s),e.set("textBody",s);}}else fA[o]&&e.set(fA[o],JSON.stringify(i));}function uGe(t){let e={};return t.forEach((n,r)=>{if(r==="textBody")EU(n)&&(e.textSegments=cGe(n));else if(oee[r])try{e[oee[r]]=JSON.parse(n);}catch{}else e[r]=n;}),e}function pGe(t,e,n){let r=t;for(let i of RU)r[i]!==void 0&&e.set(i,r[i]);for(let[i,s]of Object.entries(kU))r[i]!==void 0&&e.set(s,JSON.stringify(r[i]));let o=n.createArray();for(let i of t.elements){let s=n.createMap();Sne(i,s,n),o.push([s]);}e.set("elements",o);}function hGe(t){let e={};for(let o of RU){let i=t.get(o);i!==void 0&&(e[o]=i);}for(let[o,i]of Object.entries(dGe)){let s=t.get(o);if(s!==void 0)try{e[i]=JSON.parse(s);}catch{}}let n=t.get("elements"),r=[];if(n)for(let o=0;o<n.length;o++)r.push(uGe(n.get(o)));return e.elements=r,e}function IU(t){let e=t.getArray(AU),n=[];for(let r=0;r<e.length;r++)n.push(hGe(e.get(r)));return n}function wne(t,e){let n=t.getArray(AU);return n.observeDeep(e),()=>n.unobserveDeep(e)}function fGe(t){return EU(t)&&typeof t.delete=="function"&&typeof t.format=="function"}function HB(t){let e="";for(let n of t)typeof n.insert=="string"&&(e+=n.insert);return e}function xGe(t,e){let n=Math.min(t.length,e.length),r=0;for(;r<n&&t.charCodeAt(r)===e.charCodeAt(r);)r++;return r>0&&mGe(t.charCodeAt(r-1))&&r--,r}function yGe(t,e,n){let r=Math.min(t.length,e.length)-n,o=0;for(;o<r&&t.charCodeAt(t.length-o-1)===e.charCodeAt(e.length-o-1);)o++;return o>0&&gGe(t.charCodeAt(t.length-o))&&o--,o}function bGe(t,e,n,r){let o=0,i=n;for(let s of e){if(typeof s.insert!="string")continue;let a=o+s.insert.length,l=Math.max(o,n),c=Math.min(a,r);if(l<c){let d=s.insert.slice(l-o,c-o);t.insert(i,d,s.attributes??{}),i+=d.length;}o=a;}}function vGe(t,e){let n=Object.keys(t);return n.length!==Object.keys(e).length?false:n.every(r=>t[r]===e[r])}function SGe(t,e){let n=t.toDelta().filter(s=>typeof s.insert=="string"),r=0,o=0,i=0;for(let s of e){if(typeof s.insert!="string")continue;let a=s.attributes??{},l=s.insert.length;for(;l>0&&r<n.length;){let c=n[r].insert,d=Math.min(c.length-o,l),u=n[r].attributes??{};if(!vGe(u,a)){let p={};for(let h of Object.keys(a))u[h]!==a[h]&&(p[h]=a[h]);for(let h of Object.keys(u))h in a||(p[h]=null);t.format(i,d,p);}i+=d,l-=d,o+=d,o>=c.length&&(r++,o=0);}}}function wGe(t,e){let n=HB(t.toDelta()),r=HB(e);if(n!==r){let o=xGe(n,r),i=yGe(n,r,o),s=n.length-o-i;if(s>0&&t.delete(o,s),bGe(t,e,o,r.length-i),HB(t.toDelta())!==r)return false}return SGe(t,e),true}function Tne(t,e){return t===e||JSON.stringify(t)===JSON.stringify(e)}function Cne(t,e,n){for(let r of n){let o=e[r],i=t.get(r);o===void 0?i!==void 0&&t.delete(r):Tne(i,o)||t.set(r,o);}}function Mne(t,e,n){for(let[r,o]of Object.entries(n)){let i=e[r]===void 0?void 0:JSON.stringify(e[r]),s=t.get(o);i===void 0?s!==void 0&&t.delete(o):s!==i&&t.set(o,i);}}function TGe(t,e,n){let r=e.textSegments,o=t.get("textBody");if(!Array.isArray(r)){o!==void 0&&t.delete("textBody");return}let i=lGe(r),s=o4(i),a=EU(o)?o4(o.toDelta()):void 0;if(a!==void 0&&Tne(a,s)||fGe(o)&&wGe(o,i))return;let l=n.createText();bne(r,l),t.set("textBody",l);}function CGe(t,e,n){let r=e;Cne(t,r,vne),Mne(t,r,fA),TGe(t,r,n);}function zB(t,e){let n=t.get(e);if(!n||typeof n.get!="function")return;let r=n.get("id");return typeof r=="string"?r:void 0}function _ne(t,e,n){let r=new Set;for(let i of e){let s=n.idOf(i);typeof s=="string"&&r.add(s);}let o=new Set;for(let i=t.length-1;i>=0;i--){let s=zB(t,i);s!==void 0&&(!r.has(s)||o.has(s)?t.delete(i,1):o.add(s));}for(let i=0;i<e.length;i++){let s=e[i],a=n.idOf(s),l=i<t.length?zB(t,i):void 0;if(a===void 0){i<t.length&&l===void 0?n.update(t.get(i),s):t.insert(i,[n.create(s)]);continue}if(l===a){n.update(t.get(i),s);continue}let c=-1;for(let d=i+1;d<t.length;d++)if(zB(t,d)===a){c=d;break}c>=0&&t.delete(c,1),t.insert(i,[n.create(s)]);}t.length>e.length&&t.delete(e.length,t.length-e.length);}function _Ge(t,e,n){let r=e;Cne(t,r,RU),Mne(t,r,kU);let o=t.get("elements");MGe(o)||(o=n.createArray(),t.set("elements",o)),_ne(o,e.elements,{idOf:i=>typeof i.id=="string"?i.id:void 0,create:i=>{let s=n.createMap();return Sne(i,s,n),s},update:(i,s)=>CGe(i,s,n)});}function Pne(t,e,n,r=JA){e.transact(()=>{let o=e.getArray(AU);_ne(o,t,{idOf:i=>typeof i.id=="string"?i.id:void 0,create:i=>{let s=n.createMap();return pGe(i,s,n),s},update:(i,s)=>_Ge(i,s,n)});},r);}function i4(t){return ze(t)?t.textSegments&&t.textSegments.length>0?t.textSegments.map(e=>e.text).join(""):t.text??"":""}function _m(t){let e=t.type.charAt(0).toUpperCase()+t.type.slice(1),n=i4(t);if(n.length>0){let r=n.length>30?`${n.slice(0,30)}...`:n;return `${e}: "${r}"`}return `${e} (${t.id})`}function s4(t){let e=[];for(let n of t)e.push(n),n.type==="group"&&n.children&&e.push(...s4(n.children));return e}function aee(t){let e=new Map;for(let n of t)e.set(n.id,n);return e}function PGe(t,e){let n=[],r=aee(s4(t)),o=aee(s4(e));for(let[i,s]of r)o.has(i)||n.push({elementId:i,label:_m(s),kind:"removed",description:`Element removed: ${_m(s)}`});for(let[i,s]of o)r.has(i)||n.push({elementId:i,label:_m(s),kind:"added",description:`Element added: ${_m(s)}`});for(let[i,s]of r){let a=o.get(i);if(!a)continue;(Math.abs(s.x-a.x)>iee||Math.abs(s.y-a.y)>iee)&&n.push({elementId:i,label:_m(s),kind:"moved",description:`Moved from (${Math.round(s.x)}, ${Math.round(s.y)}) to (${Math.round(a.x)}, ${Math.round(a.y)})`}),(Math.abs(s.width-a.width)>see||Math.abs(s.height-a.height)>see)&&n.push({elementId:i,label:_m(s),kind:"resized",description:`Resized from ${Math.round(s.width)}x${Math.round(s.height)} to ${Math.round(a.width)}x${Math.round(a.height)}`});let l=i4(s),c=i4(a);l!==c&&n.push({elementId:i,label:_m(s),kind:"textChanged",description:"Text content changed"});}return n}function EGe(t,e){let n=PGe(t.elements,e.elements);return t.backgroundColor!==e.backgroundColor&&n.push({elementId:"__background__",label:"Background",kind:"textChanged",description:`Background changed from ${t.backgroundColor??"default"} to ${e.backgroundColor??"default"}`}),(t.notes??"")!==(e.notes??"")&&n.push({elementId:"__notes__",label:"Speaker Notes",kind:"textChanged",description:"Speaker notes changed"}),n}function AGe(t,e){let n=[],r=Math.max(t.length,e.length),o=0,i=0,s=0,a=0;for(let l=0;l<r;l++){let c=t[l],d=e[l];if(c&&!d)n.push({status:"removed",baseIndex:l,compareIndex:-1,baseSlide:c,changes:[]}),i++;else if(!c&&d)n.push({status:"added",baseIndex:-1,compareIndex:l,compareSlide:d,changes:[]}),o++;else if(c&&d){let u=EGe(c,d);u.length>0?(n.push({status:"changed",baseIndex:l,compareIndex:l,baseSlide:c,compareSlide:d,changes:u}),s++):(n.push({status:"unchanged",baseIndex:l,compareIndex:l,baseSlide:c,compareSlide:d,changes:[]}),a++);}}return {diffs:n,baseSlideCount:t.length,compareSlideCount:e.length,addedCount:o,removedCount:i,changedCount:s,unchangedCount:a}}function NU(t,e){return AGe(t.slides,e.slides)}function IGe(t,e){return e[t%e.length]}function $a(t,e,n){let r=t.style?.fillColor;return r&&r.length>0?r:IGe(e,n)}function eu(t,e){let n=t.style?.lineColor;return n&&n.length>0?n:e}function Fc(t,e,n){let r=n==="intense"?1:n==="moderate"?.92:.85;return e<=1?r:r-t/(e-1)*.15}function Hc(t){if(t==="intense")return "drop-shadow(0 2px 6px rgba(0,0,0,0.35))";if(t==="moderate")return "drop-shadow(0 1px 3px rgba(0,0,0,0.2))"}function oh(t){return t==="intense"?2:t==="moderate"?1.5:0}function Ha(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function Bl(t,e,n,r){let i=e/Math.max(1,t.length*.6),s=n*.5;return Math.max(6,Math.min(r,i,s))}function ih(t){return t>0?"rgba(255,255,255,0.3)":"none"}function NGe(t){if(t.some(o=>o.children!==void 0&&o.children.length>0)){let o=a=>({node:a,children:(a.children??[]).map(o)}),i=new Set(t.map(a=>a.id));return t.filter(a=>!a.parentId||!i.has(a.parentId)).map(o)}let n=new Map;for(let o of t)n.set(o.id,{node:o,children:[]});let r=[];for(let o of t){let i=n.get(o.id);o.parentId&&n.has(o.parentId)?n.get(o.parentId).children.push(i):r.push(i);}return r}function gy(t){return t.children.length===0?1:t.children.reduce((e,n)=>e+gy(n),0)}function Ene(t){return t.children.length===0?1:1+Math.max(...t.children.map(Ene))}function Ane(t){let e=[],n=r=>{e.push(r);for(let o of r.children??[])n(o);};for(let r of t)n(r);return e}function LGe(t,e,n){if(n&&n in lee)return lee[n];if(e&&e in cee){let o=cee[e];if(o)return o}return t.some(o=>o.children&&o.children.length>0)?"hierarchy":"list"}function Rne(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=4,c=s-a*2,d=t.length>0?(c-l*(t.length-1))/t.length:c,u=i-a*2,p=Math.min(6,d*.15),h=oh(r),f=ih(h);return {nodes:t.map((x,g)=>{let y=a+g*(d+l),b=Bl(x.text,u*.9,d,12);return {kind:"rect",key:`${o}-list-${x.id}-${g}`,x:a,y,width:u,height:d,rx:p,fill:$a(x,g,n),stroke:eu(x,f),strokeWidth:h,opacity:Fc(g,t.length,r),text:Ha(x.text,40),fontSize:b,textX:a+u/2,textY:y+d/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"list"}}function DGe(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=4,c=Math.min(16,i*.04),d=i-a*2,u=t.length>0?(d-l*(t.length-1))/t.length:d,p=Math.min(s-a*2,s*.6),h=s/2,f=oh(r),m=ih(f);return {nodes:t.map((g,y)=>{let b=a+y*(u+l),v=p/2,S=y===0,w=y===t.length-1,C;S?C=[`${b},${h-v}`,`${b+u-c},${h-v}`,`${b+u},${h}`,`${b+u-c},${h+v}`,`${b},${h+v}`].join(" "):w?C=[`${b},${h-v}`,`${b+u},${h-v}`,`${b+u},${h+v}`,`${b},${h+v}`,`${b+c},${h}`].join(" "):C=[`${b},${h-v}`,`${b+u-c},${h-v}`,`${b+u},${h}`,`${b+u-c},${h+v}`,`${b},${h+v}`,`${b+c},${h}`].join(" ");let T=Bl(g.text,u*.7,p,12);return {kind:"polygon",key:`${o}-process-${g.id}-${y}`,points:C,fill:$a(g,y,n),stroke:eu(g,m),strokeWidth:f,opacity:Fc(y,t.length,r),text:Ha(g.text,25),fontSize:T,textX:b+u/2,textY:h}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"process"}}function FGe(t,e,n,r,o){let{width:i,height:s}=e,a=Math.min(i,s),l=i/2,c=s/2,d=a*.35,u=Math.max(a*.06,Math.min(a*.12,200/Math.max(1,t.length))),p=oh(r),h=ih(p),f=t.map((x,g)=>{let y=g/t.length*Math.PI*2-Math.PI/2,b=l+d*Math.cos(y),v=c+d*Math.sin(y),w=(g+1)%t.length/t.length*Math.PI*2-Math.PI/2,C=l+d*Math.cos(w),T=c+d*Math.sin(w),M=(y+w)/2,_=g===t.length-1?(y+w+Math.PI*2)/2:M,E=d*.15,R=l+(d+E)*Math.cos(_),I=c+(d+E)*Math.sin(_);return {key:`${o}-cycle-conn-${g}`,d:`M${b},${v} Q${R},${I} ${C},${T}`}});return {nodes:t.map((x,g)=>{let y=g/t.length*Math.PI*2-Math.PI/2,b=l+d*Math.cos(y),v=c+d*Math.sin(y),S=Bl(x.text,u*1.4,u*2,11);return {kind:"circle",key:`${o}-cycle-${x.id}-${g}`,cx:b,cy:v,r:u,fill:$a(x,g,n),stroke:eu(x,h),strokeWidth:p,opacity:Fc(g,t.length,r),text:Ha(x.text,20),fontSize:S}}),connectors:f,shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"cycle"}}function OGe(t,e,n,r,o){let i=NGe(t);if(i.length===0)return Rne(t,e,n,r,o);let{width:s,height:a}=e,l=i.reduce((w,C)=>w+gy(C),0),c=Math.max(...i.map(Ene)),d=s/Math.max(1,l),u=a/Math.max(1,c),p=Math.min(d*.8,140),h=Math.min(u*.4,36),f=Math.min(6,h*.15),m=oh(r),x=ih(m),g=[],y=[],b=0;function v(w,C,T){let M=gy(w),_=(C+M/2)*d,E=T*u+u/2,R=b++,I=Bl(w.node.text,p*.9,h,11),L=C;for(let N of w.children){let D=gy(N),U=(L+D/2)*d,G=(T+1)*u+u/2,j=E+h/2+(G-h/2-(E+h/2))/2;y.push({key:`${o}-hier-conn-${w.node.id}-${N.node.id}`,d:`M${_},${E+h/2} L${_},${j} L${U},${j} L${U},${G-h/2}`}),L+=D;}let k={kind:"rect",key:`${o}-hier-${w.node.id}-${R}`,x:_-p/2,y:E-h/2,width:p,height:h,rx:f,fill:$a(w.node,R,n),stroke:eu(w.node,x),strokeWidth:m,opacity:Fc(R,t.length,r),text:Ha(w.node.text,40),fontSize:I,textX:_,textY:E};g.push(k);let F=C;for(let N of w.children)v(N,F,T+1),F+=gy(N);}let S=0;for(let w of i)v(w,S,0),S+=gy(w);return {nodes:g,connectors:y,shadowFilter:Hc(r),viewBox:`0 0 ${s} ${a}`,family:"hierarchy"}}function BGe(t,e,n,r,o){let{width:i,height:s}=e,a=Math.max(1,Math.ceil(Math.sqrt(t.length))),l=Math.max(1,Math.ceil(t.length/a)),c=8,d=6,u=i-c*2,p=s-c*2,h=(u-d*(a-1))/a,f=(p-d*(l-1))/l,m=Math.min(6,Math.min(h,f)*.1),x=oh(r),g=ih(x);return {nodes:t.map((b,v)=>{let S=v%a,w=Math.floor(v/a),C=c+S*(h+d),T=c+w*(f+d),M=Bl(b.text,h*.85,f,12);return {kind:"rect",key:`${o}-matrix-${b.id}-${v}`,x:C,y:T,width:h,height:f,rx:m,fill:$a(b,v,n),stroke:eu(b,g),strokeWidth:x,opacity:Fc(v,t.length,r),text:Ha(b.text,30),fontSize:M,textX:C+h/2,textY:T+f/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"matrix"}}function UGe(t,e,n,r,o){let{width:i,height:s}=e,a=i/2,l=s/2,c=Math.min(i,s),d=oh(r),u=ih(d);if(t.length===0)return {nodes:[],connectors:[],shadowFilter:void 0,viewBox:`0 0 ${i} ${s}`,family:"radial"};let[p,...h]=t,f=c*.14,m=c*.35,x=Math.max(c*.06,Math.min(c*.1,180/Math.max(1,h.length))),g=[],y=[],b=Bl(p.text,f*1.6,f*2,12);return g.push({kind:"circle",key:`${o}-radial-centre-0`,cx:a,cy:l,r:f,fill:$a(p,0,n),stroke:eu(p,u),strokeWidth:d,opacity:Fc(0,t.length,r),text:Ha(p.text,20),fontSize:b}),h.forEach((v,S)=>{let w=S+1,C=S/Math.max(1,h.length)*Math.PI*2-Math.PI/2,T=a+m*Math.cos(C),M=l+m*Math.sin(C),_=Bl(v.text,x*1.4,x*2,10),E=a+f*Math.cos(C),R=l+f*Math.sin(C);y.push({key:`${o}-radial-conn-${w}`,d:`M${E},${R} L${T},${M}`}),g.push({kind:"circle",key:`${o}-radial-${v.id}-${w}`,cx:T,cy:M,r:x,fill:$a(v,w,n),stroke:eu(v,u),strokeWidth:d,opacity:Fc(w,t.length,r),text:Ha(v.text,20),fontSize:_});}),{nodes:g,connectors:y,shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"radial"}}function $Ge(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=3,c=s-a*2,d=t.length>0?(c-l*(t.length-1))/t.length:c,u=i-a*2,p=oh(r),h=ih(p);return {nodes:t.map((m,x)=>{let g=.3+x/Math.max(t.length-1,1)*.7,y=x<t.length-1?.3+(x+1)/Math.max(t.length-1,1)*.7:1,b=u*g,v=u*y,S=a+x*(d+l),w=(i-b)/2,C=w+b,T=(i-v)/2,M=T+v,_=[`${w},${S}`,`${C},${S}`,`${M},${S+d}`,`${T},${S+d}`].join(" "),E=Bl(m.text,b*.85,d,12);return {kind:"polygon",key:`${o}-pyramid-${m.id}-${x}`,points:_,fill:$a(m,x,n),stroke:eu(m,h),strokeWidth:p,opacity:Fc(x,t.length,r),text:Ha(m.text,30),fontSize:E,textX:i/2,textY:S+d/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"pyramid"}}function HGe(t,e,n,r,o){let{width:i,height:s}=e,a=Hc(r);if(t.length<=4){let f=i/2,m=s/2,x=Math.min(i,s)*.28,g=x*.55;return {nodes:t.map((b,v)=>{let S=v/Math.max(1,t.length)*Math.PI*2-Math.PI/2,w=f+g*Math.cos(S),C=m+g*Math.sin(S),T=Bl(b.text,x*1.2,x*2,11);return {kind:"circle",key:`${o}-venn-${b.id}-${v}`,cx:w,cy:C,r:x,fill:$a(b,v,n),stroke:"none",strokeWidth:0,opacity:.35,text:Ha(b.text,20),fontSize:T}}),connectors:[],shadowFilter:a,viewBox:`0 0 ${i} ${s}`,family:"venn"}}let l=Math.min(s*.38,i/(t.length*.9)),c=l*.5,d=t.length*(l*2-c)+c,u=(i-d)/2+l,p=s/2;return {nodes:t.map((f,m)=>{let x=u+m*(l*2-c),g=Bl(f.text,l*1.2,l*2,10);return {kind:"circle",key:`${o}-venn-${f.id}-${m}`,cx:x,cy:p,r:l,fill:$a(f,m,n),stroke:"none",strokeWidth:0,opacity:.35,text:Ha(f.text,20),fontSize:g}}),connectors:[],shadowFilter:a,viewBox:`0 0 ${i} ${s}`,family:"venn"}}function zGe(t,e,n,r,o){let{width:i,height:s}=e,a=8,l=i-a*2,c=t.length>0?(s-a*2)/t.length:s-a*2,d=oh(r),u=ih(d);return {nodes:t.map((h,f)=>{let m=l*(1-f/Math.max(1,t.length)),x=l*(1-(f+1)/Math.max(1,t.length)),g=a+f*c,y=(i-m)/2,b=y+m,v=(i-x)/2,S=v+x,w=[`${y},${g}`,`${b},${g}`,`${S},${g+c}`,`${v},${g+c}`].join(" "),C=Bl(h.text,m*.85,c,11);return {kind:"polygon",key:`${o}-funnel-${h.id}-${f}`,points:w,fill:$a(h,f,n),stroke:eu(h,u),strokeWidth:d,opacity:Fc(f,t.length,r),text:Ha(h.text,30),fontSize:C,textX:i/2,textY:g+c/2}}),connectors:[],shadowFilter:Hc(r),viewBox:`0 0 ${i} ${s}`,family:"funnel"}}function VGe(t,e,n,r,o){let{width:i,height:s}=e,a=i*.4,l=s/2,c=Math.min(a-8,l-8),d=Hc(r);return {nodes:t.map((p,h)=>{let f=c*((t.length-h)/Math.max(1,t.length));return {kind:"circle",key:`${o}-target-${p.id}-${h}`,cx:a,cy:l,r:Math.max(f,4),fill:$a(p,h,n),stroke:"none",strokeWidth:0,opacity:Fc(h,t.length,r),text:Ha(p.text,30),fontSize:Math.max(7,Math.min(10,c/Math.max(1,t.length+1)))}}),connectors:[],shadowFilter:d,viewBox:`0 0 ${i} ${s}`,family:"target"}}function LU(t,e,n,r,o,i,s){let a=Ane(t);switch(LGe(t,i,s)){case "list":return Rne(a,e,n,r,o);case "process":return DGe(a,e,n,r,o);case "cycle":return FGe(a,e,n,r,o);case "hierarchy":return OGe(t,e,n,r,o);case "matrix":return BGe(a,e,n,r,o);case "radial":return UGe(a,e,n,r,o);case "pyramid":return $Ge(a,e,n,r,o);case "venn":return HGe(a,e,n,r,o);case "funnel":return zGe(a,e,n,r,o);case "target":return VGe(a,e,n,r,o)}}function GGe(t){let e=t.trim().split(/\s+/u).map(Number),n=e[2],r=e[3];return {width:Number.isFinite(n)&&n>0?n:1,height:Number.isFinite(r)&&r>0?r:1}}function WGe(t,e,n,r=4){let o=t/2,i=e/2,s=Math.max(0,Math.min(n,o,i));if(s<=0)return [{x:-o,y:-i},{x:o,y:-i},{x:o,y:i},{x:-o,y:i}];let a=[],l=[{cx:o-s,cy:-i+s,start:-Math.PI/2},{cx:o-s,cy:i-s,start:0},{cx:-o+s,cy:i-s,start:Math.PI/2},{cx:-o+s,cy:-i+s,start:Math.PI}];for(let{cx:c,cy:d,start:u}of l)for(let p=0;p<=r;p++){let h=u+p/r*(Math.PI/2);a.push({x:c+Math.cos(h)*s,y:d+Math.sin(h)*s});}return a}function XGe(t,e=48){let n=[];for(let r=0;r<e;r++){let o=r/e*Math.PI*2;n.push({x:Math.cos(o)*t,y:Math.sin(o)*t});}return n}function jGe(t){let e=[];for(let n of t.trim().split(/\s+/u)){let[r,o]=n.split(","),i=Number(r),s=Number(o);Number.isFinite(i)&&Number.isFinite(s)&&e.push({x:i,y:s});}return e}function YGe(t){let e=[],n=t.match(/[a-zA-Z]|-?\d*\.?\d+(?:e-?\d+)?/gu);if(!n)return e;let r=0,o="",i={x:0,y:0},s=()=>Number(n[r++]);for(;r<n.length;){let a=n[r];/[a-zA-Z]/u.test(a)&&(o=a,r++);let l=o===o.toLowerCase();switch(o.toUpperCase()){case "M":case "L":{let c=s(),d=s();i=l?{x:i.x+c,y:i.y+d}:{x:c,y:d},e.push(i);break}case "H":{let c=s();i={x:l?i.x+c:c,y:i.y},e.push(i);break}case "V":{let c=s();i={x:i.x,y:l?i.y+c:c},e.push(i);break}case "C":{s(),s(),s(),s();let c=s(),d=s();i=l?{x:i.x+c,y:i.y+d}:{x:c,y:d},e.push(i);break}case "Q":{s(),s();let c=s(),d=s();i=l?{x:i.x+c,y:i.y+d}:{x:c,y:d},e.push(i);break}default:r++;}}return e}function KGe(t){if(t.length===0)return {cx:0,cy:0,width:0,height:0};let e=1/0,n=1/0,r=-1/0,o=-1/0;for(let i of t)i.x<e&&(e=i.x),i.y<n&&(n=i.y),i.x>r&&(r=i.x),i.y>o&&(o=i.y);return {cx:(e+r)/2,cy:(n+o)/2,width:r-e,height:o-n}}function qGe(t){let e=t.trim().replace(/^#/u,"");return e.length===3&&(e=e.split("").map(n=>n+n).join("")),e.length!==6||/[^0-9a-fA-F]/u.test(e)?[128,128,128]:[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}function ZGe(t){let[e,n,r]=qGe(t);return (.299*e+.587*n+.114*r)/255>.6?"#1a1a1a":"#ffffff"}function dee(t,e){let n=Math.hypot(t,e),r=Math.atan2(t,e);return {pos:{x:n*Math.sin(r),y:0,z:n*Math.cos(r)},angle:r}}function JGe(t){let e=t.meshes.map(r=>{let{pos:o,angle:i}=dee(r.position.x,r.position.y);return {...r,position:o,rotation:{x:0,y:i,z:0}}}),n=t.connectors.map(r=>({...r,points:r.points.map(o=>dee(o.x,o.y).pos)}));return {...t,meshes:e,connectors:n}}function QGe(t){if(t.meshes.length===0)return t;let e=-1/0,n=1/0;for(let l of t.meshes)l.position.y>e&&(e=l.position.y),l.position.y<n&&(n=l.position.y);let r=e-n||1,o=Math.max(t.bounds.width,t.bounds.height)*.6,i=l=>-((e-l)/r)*o,s=t.meshes.map(l=>({...l,position:{x:l.position.x,y:l.position.y,z:i(l.position.y)}})),a=t.connectors.map(l=>({...l,points:l.points.map(c=>({x:c.x,y:c.y,z:i(c.y)}))}));return {...t,meshes:s,connectors:a}}function eWe(t){switch(t.family){case "cycle":case "radial":return JGe(t);case "hierarchy":return QGe(t);default:return t}}function rWe(t,e){if(typeof e.depth=="number"&&e.depth>0)return e.depth;let n=e.depthRatio??tWe;return Math.max(2,t*n)}function oWe(t,e,n,r){let o=m=>m-e/2,i=m=>n/2-m,s,a=false,l,c,d,u;if(t.kind==="rect")l=t.x+t.width/2,c=t.y+t.height/2,d=t.width/2,u=t.height/2,s=WGe(t.width,t.height,t.rx),a=t.rx>0;else if(t.kind==="circle")l=t.cx,c=t.cy,d=t.r,u=t.r,s=XGe(t.r),a=true;else {let m=jGe(t.points);if(m.length<3)return null;let x=KGe(m);l=x.cx,c=x.cy,d=x.width/2,u=x.height/2,s=m.map(g=>({x:g.x-x.cx,y:x.cy-g.y}));}let p=Math.max(2,Math.min(d,u)*2),h=rWe(p,r),f=h*(r.bevelRatio??nWe);return {id:t.key,outline:s,rounded:a,depth:h,bevel:f,fill:t.fill,stroke:t.stroke,strokeWidth:t.strokeWidth,opacity:t.opacity,position:{x:o(l),y:i(c),z:0},rotation:{x:0,y:0,z:0},text:t.text,textColor:ZGe(t.fill),fontSize:t.fontSize,halfWidth:d,halfHeight:u}}function kne(t,e={}){let{width:n,height:r}=GGe(t.viewBox),o=[];for(let a of t.nodes){let l=oWe(a,n,r,e);l&&o.push(l);}let i=[];for(let a of t.connectors){let l=YGe(a.d);l.length<2||i.push({id:a.key,points:l.map(c=>({x:c.x-n/2,y:r/2-c.y,z:0})),color:"#888888",width:1.5});}let s={meshes:o,connectors:i,bounds:{width:n,height:r},family:t.family,background:e.background};return e.spatial?eWe(s):s}function sWe(t){return uee[t??"unknown"]??uee.unknown}function Ine(t){let e=[],n=r=>{e.push(r);for(let o of r.children??[])n(o);};for(let r of t)n(r);return e}function aWe(t){return Ine(t).map(e=>(e.text??"").trim()).filter(e=>e.length>0)}function lWe(t){let e=sWe(t.resolvedLayoutType),n=aWe(t.nodes??[]),r=n.length,o=`${e} SmartArt diagram`;if(r===0)return `${o} with no nodes`;let i=r===1?"node":"nodes",s=n.slice(0,iWe),a=r-s.length,l=a>0?`${s.join("; ")}; and ${a} more`:s.join("; ");return `${o} with ${r} ${i}: ${l}`}function cWe(t,e,n){let r=`Node ${e+1} of ${n}`,o=(t??"").trim();return o.length>0?`${r}: ${o}`:r}function Nne(t){let e=Ine(t.nodes??[]),n=e.length,r=e.map((o,i)=>({id:o.id,label:cWe(o.text,i,n)}));return {role:"img",label:lWe(t),nodes:r}}async function uWe(){try{return await Promise.resolve().then(()=>(Ic(),hy))}catch{return null}}async function pWe(){try{return (await Promise.resolve().then(()=>(kQ(),RQ))).GLTFLoader}catch{return null}}async function hWe(){try{return (await Promise.resolve().then(()=>(nA(),DB))).OrbitControls}catch{return null}}function fWe(t,e){return new Promise((n,r)=>{t.load(e,n,void 0,r);})}function mWe(t,e){let n=new t.Box3().setFromObject(e),r=new t.Vector3;n.getSize(r);let o=Math.max(r.x,r.y,r.z);o>0&&e.scale.setScalar(2/o);let i=new t.Vector3;n.getCenter(i),e.position.sub(i.multiplyScalar(e.scale.x));}async function Lne(t,e,n){let r=await uWe(),o=r?await pWe():null;if(!r||!o)return pee;let i=Math.max(1,n.width),s=Math.max(1,n.height),a=new r.WebGLRenderer({antialias:true,alpha:!n.background});a.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,n.maxPixelRatio??2)),a.setSize(i,s,false);let l=a.domElement;l.style.width=`${i}px`,l.style.height=`${s}px`,l.style.display="block",l.style.willChange="transform",t.appendChild(l);let c=new r.Scene;n.background&&(c.background=new r.Color(n.background));let d=new r.PerspectiveCamera(dWe,i/s,.1,1e3);d.position.set(0,0,5),d.lookAt(0,0,0),c.add(new r.AmbientLight(16777215,.5));let u=new r.DirectionalLight(16777215,1);u.position.set(5,5,5),c.add(u);let p=new r.DirectionalLight(16777215,.3);p.position.set(-3,-3,2),c.add(p);let h;try{h=await fWe(new o,e);}catch{return a.dispose(),l.remove(),pee}let f=h.scene;mWe(r,f),c.add(f);let m=null,x=await hWe(),g=w=>{w&&!m&&x?(m=new x(d,l),m.enablePan=false,m.enableZoom=true,m.enableRotate=true,m.minDistance=2,m.maxDistance=20,m.update()):!w&&m&&(m.dispose(),m=null);};g(n.interactive??true);let y=0,b=false,v=()=>{b||(y=requestAnimationFrame(v),m?.update(),a.render(c,d));};y=requestAnimationFrame(v);let S=()=>{f.traverse(w=>{let C=w;C.geometry?.dispose();let T=C.material;if(Array.isArray(T))for(let M of T)M.dispose();else T?.dispose();});};return {ok:true,resize(w,C){let T=Math.max(1,w),M=Math.max(1,C);d.aspect=T/M,d.updateProjectionMatrix(),a.setSize(T,M,false),l.style.width=`${T}px`,l.style.height=`${M}px`;},setInteractive(w){g(w);},dispose(){b||(b=true,cancelAnimationFrame(y),m?.dispose(),S(),c.clear(),a.dispose(),l.remove());}}}function QA(t,e){return {gridWidth:Math.max(t-1,1)*hee,gridDepth:Math.max(e-1,1)*hee}}function gWe(t,e,n,r,o){let i=Math.max(e-1,0),s=Math.max(n-1,0),{gridWidth:a,gridDepth:l}=QA(e,n),c=new t.PlaneGeometry(a,l,i,s);c.rotateX(-Math.PI/2);let d=c.attributes.position,u=d.count,p=new Float32Array(u*3);for(let f=0;f<u;f++){let m=Math.floor(f/e),x=f%e,g=m*e+x,y=g<r.length?r[g]:0;d.setY(f,y*Dne);let b=g*3;p[f*3]=b<o.length?o[b]:.5,p[f*3+1]=b+1<o.length?o[b+1]:.5,p[f*3+2]=b+2<o.length?o[b+2]:.5;}c.setAttribute("color",new t.BufferAttribute(p,3)),c.computeVertexNormals(),d.needsUpdate=true;let h=new t.WireframeGeometry(c);return {geometry:c,wireGeometry:h}}function xWe(t,e,n,r,o=8,i=6){let{gridWidth:s,gridDepth:a}=QA(t,e),l=[],c=Math.max(1,Math.ceil(n.length/o));for(let u=0;u<n.length;u+=c){let p=-s/2+u/Math.max(t-1,1)*s;l.push({key:`cat-${u}`,text:n[u],anchor:[p,-0.15,a/2+.25],axis:"category"});}let d=Math.max(1,Math.ceil(r.length/i));for(let u=0;u<r.length;u+=d){let p=-a/2+u/Math.max(e-1,1)*a;l.push({key:`ser-${u}`,text:r[u],anchor:[s/2+.3,-0.15,p],axis:"series"});}return l.push({key:"value-axis",text:"Value",anchor:[-s/2-.35,.75,-a/2],axis:"value"}),l}function yWe(t,e){let{gridWidth:n,gridDepth:r}=QA(t,e),i=Math.max(n,r,Dne)*1.8;return {position:[i*.8,i*.7,i*.8],target:[0,.3,0]}}async function SWe(){try{return await Promise.resolve().then(()=>(Ic(),hy))}catch{return null}}async function wWe(){try{return (await Promise.resolve().then(()=>(nA(),DB))).OrbitControls}catch{return null}}function TWe(t,e){let n=t.createElement("div");Object.assign(n.style,{position:"absolute",inset:"0",pointerEvents:"none",overflow:"hidden"});let r=e.map(o=>{let i=t.createElement("div");i.textContent=o.text;let s=o.axis==="value"?"#999":"#666";return Object.assign(i.style,{position:"absolute",fontSize:"9px",color:s,whiteSpace:"nowrap",userSelect:"none",transform:"translate(-50%, -50%)",willChange:"left, top"}),o.axis==="value"&&(i.style.writingMode="vertical-rl"),n.appendChild(i),i});return {layer:n,nodes:r}}async function Fne(t,e){let n=await SWe(),r=n?await wWe():null;if(!n||!r)return bWe;let{cols:o,rows:i}=e,s=Math.max(1,e.width),a=Math.max(1,e.height),l=new n.WebGLRenderer({antialias:true,alpha:true});l.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,e.maxPixelRatio??2)),l.setSize(s,a,false);let c=l.domElement;c.style.width=`${s}px`,c.style.height=`${a}px`,c.style.display="block",c.style.willChange="transform",t.appendChild(c);let d=new n.Scene;d.add(new n.AmbientLight(16777215,.6));let u=new n.DirectionalLight(16777215,.8);u.position.set(5,8,5),d.add(u);let p=new n.DirectionalLight(16777215,.3);p.position.set(-3,4,-2),d.add(p);let h=new n.PerspectiveCamera(vWe,s/a,.1,1e3),f=yWe(o,i);h.position.set(...f.position);let m=new n.Vector3(...f.target);h.lookAt(m);let{gridWidth:x,gridDepth:g}=QA(o,i),y=Math.max(x,g)*1.2,b=new n.GridHelper(y,Math.max(o,i),13421772,15263976);b.position.y=-0.02,d.add(b);let{geometry:v,wireGeometry:S}=gWe(n,o,i,e.heightMap,e.colorMap),w=new n.MeshPhongMaterial({vertexColors:true,side:n.DoubleSide,shininess:30,transparent:true,opacity:.92}),C=new n.Mesh(v,w);d.add(C);let T=null;e.wireframe&&(T=new n.LineBasicMaterial({color:3355443,transparent:true,opacity:.25}),d.add(new n.LineSegments(S,T)));let M=new r(h,c);M.enablePan=true,M.enableZoom=true,M.enableRotate=true,M.minDistance=1,M.maxDistance=20,M.maxPolarAngle=Math.PI/2+.3,M.target.copy(m),M.update();let _=t.ownerDocument??document,E=xWe(o,i,e.categoryLabels,e.seriesNames),{layer:R,nodes:I}=TWe(_,E);t.appendChild(R);let L=E.map(G=>new n.Vector3(...G.anchor)),k=new n.Vector3,F=()=>{for(let G=0;G<I.length;G++){k.copy(L[G]).project(h);let j=I[G];if(k.z>1){j.style.display="none";continue}j.style.display="",j.style.left=`${(k.x+1)/2*s}px`,j.style.top=`${(-k.y+1)/2*a}px`;}},N=0,D=false,U=()=>{D||(N=requestAnimationFrame(U),M.update(),l.render(d,h),F());};return N=requestAnimationFrame(U),{ok:true,resize(G,j){s=Math.max(1,G),a=Math.max(1,j),h.aspect=s/a,h.updateProjectionMatrix(),l.setSize(s,a,false),c.style.width=`${s}px`,c.style.height=`${a}px`;},dispose(){D||(D=true,cancelAnimationFrame(N),M.dispose(),v.dispose(),S.dispose(),w.dispose(),T?.dispose(),b.dispose(),d.clear(),l.dispose(),c.remove(),R.remove());}}}function eR(t){return Number.isNaN(t)?0:Math.min(100,Math.max(0,Math.round(t)))}function vT(t,e,n=90){return e<=0?0:eR(t/e*n)}function One(t,e){return e<=0?45:eR(45+t/e*45)}function Wy(t,e,n){return `${t} slide ${e+1} of ${n}...`}function ST(t){return t instanceof DOMException&&t.name==="AbortError"}function _We(t={}){return new Promise(e=>{if(typeof document>"u"){e(null);return}let n=document.createElement("input");n.type="file",n.accept=t.accept??MWe,n.style.position="fixed",n.style.left="-9999px",n.style.opacity="0";let r=false,o=s=>{r||(r=true,n.remove(),e(s));};n.addEventListener("change",()=>o(n.files?.[0]??null)),n.addEventListener("cancel",()=>o(null));let i=()=>{window.removeEventListener("focus",i),setTimeout(()=>o(null),300);};window.addEventListener("focus",i),document.body.appendChild(n),n.click();})}async function Bne(t={}){let e=await _We(t);return e?{file:e,buffer:await e.arrayBuffer()}:null}function Une(t,e){return e<=0?"0 / 0":`${t+1} / ${e}`}function $ne(t){return t<=0}function Hne(t,e){return t>=e-1}function Gw(t){return String(t).padStart(2,"0")}function zne(t,e){if(t==null)return 0;let n=e-t;return n>0?n:0}function Vne(t){let e=t>0?t:0,n=Math.floor(e/1e3),r=Math.floor(n/3600),o=Math.floor(n%3600/60),i=n%60;return r>0?`${Gw(r)}:${Gw(o)}:${Gw(i)}`:`${Gw(o)}:${Gw(i)}`}function DU(t){let{layoutHeight:e,visualHeight:n,offsetTop:r}=t;if(!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(r)||e<=0||n<=0)return 0;let o=e-(n+r);return o<=0?0:Math.round(o)}function Gne(t,e=PWe){return t>=e}function FU(t=typeof window<"u"?window:void 0){if(!t)return null;let e=t.visualViewport;return e?{layoutHeight:t.innerHeight,visualHeight:e.height,offsetTop:e.offsetTop}:null}function Wne(t,e,n,r=16){let o=e-n;return t.bottom>o-r?t.bottom-(o-r):t.top<r?t.top-r:0}function Xne(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function jne(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 tR(t){return t.trim().length===0?"webrtc":"websocket"}function Kne(){return `broadcast-${Math.random().toString(36).slice(2,10)}`}function qne(t,e,n){if(!n)return t;let r=encodeURIComponent(t),o=e.trim();if(o.length===0)return `${n.origin}${n.pathname}?broadcast=${r}&transport=webrtc`;let i=encodeURIComponent(o);return `${n.origin}${n.pathname}?broadcast=${r}&server=${i}`}function iR(t){return Math.max(nR,Math.min(rR,t))}function BU(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Xy(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 UU(t){return t.map((e,n)=>{if(e.isParagraphBreak)return {kind:"break",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),{kind:"text",key:`seg-${n}`,text:e.text,style:r}})}function $U(t,e){return `${t+1} / ${e}`}function Kw(t){let e=t.replace(/^#/u,"");if(e.length!==6)return null;let n=parseInt(e,16);return Number.isFinite(n)?{r:n>>16&255,g:n>>8&255,b:n&255}:null}function Zne(t,e){let n=t.r-e.r,r=t.g-e.g,o=t.b-e.b;return Math.sqrt(n*n+r*r+o*o)}function Qne(t){return Math.max(0,Math.min(100,t))/100*Jne}function ere(t,e,n,r,o){let i=t.length;for(let s=0;s<i;s+=4){let a={r:t[s],g:t[s+1],b:t[s+2]};Zne(a,e)<=r&&(o?(t[s]=0,t[s+1]=0,t[s+2]=0,t[s+3]=0):(t[s]=n.r,t[s+1]=n.g,t[s+2]=n.b));}}function zU(t,e,n,r=aR,o=false){return new Promise((i,s)=>{let a=Kw(e),l=Kw(n);if(!a||!l){s(new Error(`Invalid hex colour: from="${e}" to="${n}"`));return}let c=new Image;c.crossOrigin="anonymous",c.onload=()=>{let{naturalWidth:d,naturalHeight:u}=c;if(d===0||u===0){s(new Error("Image has zero dimensions"));return}let p=document.createElement("canvas");p.width=d,p.height=u;let h=p.getContext("2d");if(!h){s(new Error("Cannot create 2D canvas context"));return}h.drawImage(c,0,0);let f=h.getImageData(0,0,d,u),m=Qne(r);ere(f.data,a,l,m,o),h.putImageData(f,0,0),i({dataUrl:p.toDataURL("image/png"),width:d,height:u});},c.onerror=()=>{s(new Error("Failed to load image for colour change processing"));},c.src=t;})}function VU(t,e,n,r,o){return `${t.length>64?t.slice(0,64):t}|${e}|${n}|${r}|${o}`}function wT(t){return Ww.get(t)}function GU(t,e){if(Ww.size>=AWe){let n=Ww.keys().next().value;n!==void 0&&Ww.delete(n);}Ww.set(t,e);}function tre(t,e,n){let r=t.length;for(let o=0;o<r;o+=4){let s=(.2126*t[o]+.7152*t[o+1]+.0722*t[o+2])/255,a=1-s;t[o]=Math.round(e.r*a+n.r*s),t[o+1]=Math.round(e.g*a+n.g*s),t[o+2]=Math.round(e.b*a+n.b*s);}}function WU(t,e,n){return new Promise((r,o)=>{let i=Kw(e),s=Kw(n);if(!i||!s){o(new Error(`Invalid hex colour: shadow="${e}" highlight="${n}"`));return}let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{let{naturalWidth:l,naturalHeight:c}=a;if(l===0||c===0){o(new Error("Image has zero dimensions"));return}let d=document.createElement("canvas");d.width=l,d.height=c;let u=d.getContext("2d");if(!u){o(new Error("Cannot create 2D canvas context"));return}u.drawImage(a,0,0);let p=u.getImageData(0,0,l,c);tre(p.data,i,s),u.putImageData(p,0,0),r({dataUrl:d.toDataURL("image/png"),width:l,height:c});},a.onerror=()=>{o(new Error("Failed to load image for duotone processing"));},a.src=t;})}function XU(t,e,n){return `dt|${t.length>64?t.slice(0,64):t}|${e}|${n}`}function lR(t){return Xw.get(t)}function jU(t,e){if(Xw.size>=RWe){let n=Xw.keys().next().value;n!==void 0&&Xw.delete(n);}Xw.set(t,e);}function KU(t){switch(t.type){case "image":case "picture":return "img";case "table":return "table";case "group":return "group";case "chart":return "img";case "smartArt":return "img";case "connector":return "img";case "media":return "application";case "ink":return "img";case "model3d":return "img";case "text":return;case "shape":return ze(t)&&t.text?void 0:"img";default:return}}function qU(t){if((t.type==="image"||t.type==="picture")&&"altText"in t&&typeof t.altText=="string"&&t.altText.trim())return t.altText.trim();if(ze(t)&&t.text){let e=t.text.trim();if(e)return e.length>120?`${e.slice(0,117)}...`:e}if(t.type==="chart"&&"chartData"in t&&t.chartData){let e=t.chartData;return e.title?`Chart: ${e.title}`:"Chart"}return t.type==="smartArt"?"SmartArt diagram":t.type==="table"?"Table":t.type==="media"?"Media element":t.type==="group"?"Group of elements":t.type==="connector"?"Connector line":t.type==="ink"?"Ink drawing":t.type==="model3d"?"3D Model":t.type==="shape"?"shapeType"in t&&t.shapeType?`Shape: ${t.shapeType}`:"Shape":kWe(t.type)}function kWe(t){switch(t){case "text":return "Text box";case "shape":return "Shape";case "image":case "picture":return "Image";case "table":return "Table";case "chart":return "Chart";case "connector":return "Connector";case "group":return "Group";case "smartArt":return "SmartArt";case "media":return "Media";case "ink":return "Drawing";case "ole":return "Embedded object";case "contentPart":return "Content part";case "model3d":return "3D Model";default:return "Element"}}function ZU(t){switch(t.type){case "shape":{let e="shapeType"in t&&typeof t.shapeType=="string"?t.shapeType:void 0;return e?`shape: ${e}`:"shape"}case "chart":return "chart";case "connector":return "connector line";case "smartArt":return "diagram";case "image":case "picture":return "image";case "table":return "data table";case "group":return "grouped elements";case "media":return "media player";case "ink":return "ink drawing";case "model3d":return "3D model";default:return}}function TT(t){let e=[],n=/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/giu,r=[],o;for(;(o=n.exec(t))!==null;)r.push(parseFloat(o[0]));for(let i=0;i<r.length-1;i+=2)e.push({x:r[i],y:r[i+1]});return e}function nre(t,e){if(t.length===0)return 1;if(t.length===1)return t[0];let r=Math.max(0,Math.min(1,e))*(t.length-1),o=Math.floor(r),i=Math.min(o+1,t.length-1),s=r-o;return t[o]*(1-s)+t[i]*s}function JU(t,e,n){if(t.length===0)return [];let r=n.minRadius,o=n.maxRadius??n.baseWidth;return t.map((i,s)=>{let a=t.length===1?.5:s/(t.length-1),l=nre(e,a),c=n.baseWidth>0?l/n.baseWidth:1,d=Math.max(r,Math.min(o,n.baseWidth/2*c));return {cx:i.x,cy:i.y,r:d}})}function jy(t){if(t.length<=1)return false;let e=t[0];return t.some(n=>Math.abs(n-e)>.01)}function cR(t,e,n=.3,r=1.8){return t.map(o=>{let i=Math.max(0,Math.min(1,o));return e*(n+i*(r-n))})}function QU(t){if(t.length<2)return 0;let e=0;for(let n=1;n<t.length;n++){let r=t[n].x-t[n-1].x,o=t[n].y-t[n-1].y;e+=Math.sqrt(r*r+o*o);}return e}function t$(t,e,n={}){let r=n.strokeDurationMs??600,o=n.strokeDelayMs??200,i=n.easing??"ease-in-out",s=t*(r+o),a=Math.max(e,1);return {pathLength:a,animationDelay:`${s}ms`,animationDuration:`${r}ms`,animation:`${e$} ${r}ms ${i} ${s}ms forwards`,strokeDasharray:`${a}`,strokeDashoffset:`${a}`}}function n$(t,e={}){return t.inkPaths.map((n,r)=>{let o=TT(n),i=QU(o);return t$(r,i,e)})}function r$(t,e={}){return t.map((n,r)=>{let o=TT(n.path),i=QU(o);return t$(r,i,e)})}function o$(t,e){return !t||e>=t.length?1:Math.max(0,Math.min(1,t[e]))}function i$(t,e,n="#000"){return !t||e>=t.length?n:t[e]||n}function s$(t,e,n=3){return !t||e>=t.length?n:t[e]>0?t[e]:n}function l4(t,e){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function sre(t,e,n){return Math.min(Math.max(t,e),n)}function are(t){let{getScale:e,minScale:n,maxScale:r,callbacks:o}=t,i=0,s=1,a=false,l=0,c=0,d=0,u=0,p=null,h=0,f=0,m=()=>{p!==null&&(clearTimeout(p),p=null);},x=v=>{v.touches.length===2?(a=true,i=l4(v.touches[0],v.touches[1]),s=e(),m(),v.preventDefault()):v.touches.length===1&&(l=v.touches[0].clientX,c=v.touches[0].clientY,d=l,u=c,h=v.touches[0].clientX,f=v.touches[0].clientY,m(),p=setTimeout(()=>{p=null,o.onLongPress?.(h,f);},ire));},g=v=>{if(v.touches.length===2&&a){v.preventDefault();let S=l4(v.touches[0],v.touches[1]);if(i>0){let w=S/i,C=sre(s*w,n,r);o.onPinchZoom?.(C);}}else if(v.touches.length===1){d=v.touches[0].clientX,u=v.touches[0].clientY;let S=v.touches[0].clientX-h,w=v.touches[0].clientY-f;(Math.abs(S)>a4||Math.abs(w)>a4)&&m();}},y=v=>{if(a){a=false,i=0;return}if(m(),v.touches.length===0){let S=v.changedTouches.length>=1?v.changedTouches[0].clientX:d,w=v.changedTouches.length>=1?v.changedTouches[0].clientY:u,C=S-l,T=w-c;Math.abs(C)>=rre&&Math.abs(T)<ore&&o.onSwipe?.(C>0?1:-1);}},b=()=>{a=false,i=0,m();};return {onTouchStart:x,onTouchMove:g,onTouchEnd:y,onTouchCancel:b,cancel:b}}function cre(t=a$,e){return rS(t,{categories:[...IWe],series:[{name:"Series 1",values:[...NWe]}],title:"Chart Title",hasLegend:true},{x:aA.x,y:aA.y,width:aA.width,height:aA.height})}function LWe(t){let e=t.trim().split(/\s+/u),n=1/0,r=1/0,o=-1/0,i=-1/0;for(let s of e){let a=s.indexOf(",");if(a<0)continue;let l=parseFloat(s.slice(0,a)),c=parseFloat(s.slice(a+1));!isFinite(l)||!isFinite(c)||(l<n&&(n=l),l>o&&(o=l),c<r&&(r=c),c>i&&(i=c));}return isFinite(n)?{x:n,y:r,width:o-n,height:i-r}:{x:0,y:0,width:0,height:0}}function DWe(t,e,n){let r=`reflow-${n}-${e}`,o=t.text||void 0;if(t.kind==="rect")return {id:r,shapeType:t.rx>0?"roundRect":"rect",x:t.x,y:t.y,width:t.width,height:t.height,rotation:0,fillColor:t.fill,strokeColor:t.stroke,strokeWidth:t.strokeWidth,text:o,fontSize:t.fontSize};if(t.kind==="circle")return {id:r,shapeType:"ellipse",x:t.cx-t.r,y:t.cy-t.r,width:t.r*2,height:t.r*2,rotation:0,fillColor:t.fill,strokeColor:t.stroke,strokeWidth:t.strokeWidth,text:o,fontSize:t.fontSize};let i=LWe(t.points);return {id:r,shapeType:"chevron",x:i.x,y:i.y,width:i.width,height:i.height,rotation:0,fillColor:t.fill,strokeColor:t.stroke,strokeWidth:t.strokeWidth,text:o,fontSize:t.fontSize}}function FWe(t,e){let n=Ane([...e]),r=t.family,o=[];for(let i=0;i<t.nodes.length;i++){let s=t.nodes[i],l=n[i]?.id??s.key;o.push(DWe(s,l,r));}return o}function CT(t,e,n,r,o,i){let s=t.drawingShapes;if(s!==void 0&&s.length>0||t.nodes.length===0)return t;let a=LU(t.nodes,i,n,r,o,t.resolvedLayoutType,e);return {...t,drawingShapes:FWe(a,t.nodes)}}function ure(t){let{autosaveState:e,isDirty:n,autosaveEnabled:r,disabledReason:o}=t;return e==="disabled"?o==="no_file_path"?"pptx.autosave.disabledNoFilePath":o==="autosave_toggle_off"?"pptx.autosave.disabledToggleOff":"pptx.autosave.disabled":r&&e==="saving"?"pptx.autosave.saving":r&&e==="error"?"pptx.autosave.error":n?"pptx.statusBar.unsavedChanges":"pptx.titleBar.savedToThisPc"}function hre(){return new Promise((t,e)=>{let n=indexedDB.open(OWe,BWe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(wy)||r.createObjectStore(wy,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function UWe(){let t=await hre();return new Promise(e=>{try{let n=t.transaction(wy,"readwrite"),r=n.objectStore(wy),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 fee(t,e){return hre().then(n=>new Promise((r,o)=>{let i=n.transaction(wy,"readwrite");i.objectStore(wy).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 fre(t,e){try{return await fee(t,e)}catch(n){if((n instanceof Error||n instanceof DOMException?n.name:"")!=="QuotaExceededError"||!await UWe())throw n;return fee(t,e)}}function gre(t){if(typeof t!="string"||t.trim().length===0)return mee;let e=t.replace(/[\x00-\x1f\x7f"\\/:*?<>|]/gu,"_").replace(/\.\./gu,"__").replace(/^\.+/u,"").trim();if(e.length===0)return mee;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 ru(t,e){let n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),setTimeout(()=>{r.remove(),URL.revokeObjectURL(n);},mre);}function uR(t,e){let n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),setTimeout(()=>{n.remove();},mre);}function pR(t,e=.92){let r=t.toDataURL("image/jpeg",e).split(",")[1]??"",o=atob(r),i=new Uint8Array(o.length);for(let s=0;s<o.length;s++)i[s]=o.charCodeAt(s);return {bytes:i,w:t.width,h:t.height}}function c$(t,e={}){if(t.length===0)throw new Error("[gif-encoder] encodeGif: frames array must not be empty");let n=typeof e=="number"?{delayCs:e}:e,{delayCs:r=200,loopCount:o=0}=n,i=t[0].width,s=t[0].height,a=[];gee(a,"GIF89a"),Jp(a,i),Jp(a,s),a.push(112),a.push(0),a.push(0),a.push(33,255,11),gee(a,"NETSCAPE2.0"),a.push(3,1),Jp(a,o),a.push(0);for(let l of t){let{palette:c,indexed:d}=$We(l.imageData);a.push(33,249,4),a.push(0),Jp(a,r),a.push(0),a.push(0),a.push(44),Jp(a,0),Jp(a,0),Jp(a,i),Jp(a,s),a.push(135);for(let f=0;f<256;f++)a.push(c[f*3]??0),a.push(c[f*3+1]??0),a.push(c[f*3+2]??0);let u=8;a.push(u);let p=zWe(d,u),h=0;for(;h<p.length;){let f=Math.min(255,p.length-h);a.push(f);for(let m=0;m<f;m++)a.push(p[h+m]);h+=f;}a.push(0);}return a.push(59),new Uint8Array(a)}function Jp(t,e){t.push(e&255),t.push(e>>8&255);}function gee(t,e){for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));}function $We(t){let e=t.data,n=t.width*t.height,r=Math.max(1,Math.floor(n/1e4)),o=[];for(let c=0;c<n;c+=r){let d=c*4;o.push([e[d],e[d+1],e[d+2]]);}let i=c4(o,8),s=new Uint8Array(768),a=[];for(let c=0;c<256;c++)if(c<i.length&&i[c].length>0){let d=0,u=0,p=0;for(let[g,y,b]of i[c])d+=g,u+=y,p+=b;let h=i[c].length,f=Math.round(d/h),m=Math.round(u/h),x=Math.round(p/h);s[c*3]=f,s[c*3+1]=m,s[c*3+2]=x,a.push([f,m,x]);}else a.push([0,0,0]);let l=new Uint8Array(n);for(let c=0;c<n;c++){let d=c*4;l[c]=HWe(a,e[d],e[d+1],e[d+2]);}return {palette:s,indexed:l}}function c4(t,e){if(e===0||t.length<=1)return [t];let n=255,r=0,o=255,i=0,s=255,a=0;for(let[h,f,m]of t)h<n&&(n=h),h>r&&(r=h),f<o&&(o=f),f>i&&(i=f),m<s&&(s=m),m>a&&(a=m);let l=r-n,c=i-o,d=a-s,u=0;c>=l&&c>=d?u=1:d>=l&&d>=c&&(u=2),t.sort((h,f)=>h[u]-f[u]);let p=Math.floor(t.length/2);return [...c4(t.slice(0,p),e-1),...c4(t.slice(p),e-1)]}function HWe(t,e,n,r){let o=0,i=1/0;for(let s=0;s<t.length;s++){let[a,l,c]=t[s],d=(e-a)**2+(n-l)**2+(r-c)**2;d<i&&(i=d,o=s);}return o}function zWe(t,e){let n=1<<e,r=n+1,o=[],i=e+1,s=r+1,a=4096,l=new Map,c=()=>{l.clear();for(let m=0;m<n;m++)l.set(String(m),m);i=e+1,s=r+1;},d=0,u=0,p=(m,x)=>{for(d|=m<<u,u+=x;u>=8;)o.push(d&255),d>>=8,u-=8;};c(),p(n,i);let h=String(t[0]);for(let m=1;m<t.length;m++){let x=`${h},${String(t[m])}`;if(l.has(x))h=x;else {let g=l.get(h);g!==void 0&&p(g,i),s<a?(l.set(x,s++),s>1<<i&&i<12&&i++):(p(n,i),c()),h=String(t[m]);}}let f=l.get(h);return f!==void 0&&p(f,i),p(r,i),u>0&&o.push(d&255),new Uint8Array(o)}function xre(t){return GWe[t]??{rows:3,columns:2}}function yre(t,e){return t<=0?0:Math.ceil(t/e)}function bre(t,e,n,r,o=Fl){let i=xre(e),s=o.width-o.marginLeft-o.marginRight,a=o.height-o.marginTop-o.marginBottom,l=e===3,c=[];if(l){let d=s*VWe,u=(a-my*(i.rows-1))/i.rows;for(let p=0;p<i.rows;p++){let h=r+p;c.push({slideIndex:h<n?h:-1,row:p,col:0,x:0,y:p*(u+my),width:d,height:u});}}else {let d=(s-my*(i.columns-1))/i.columns,u=(a-my*(i.rows-1))/i.rows,p=0;for(let h=0;h<i.rows;h++)for(let f=0;f<i.columns;f++){let m=r+p;c.push({slideIndex:m<n?m:-1,row:h,col:f,x:f*(d+my),y:h*(u+my),width:d,height:u}),p++;}}return {pageIndex:t,cells:c,hasNoteLines:l}}function hR(t,e,n="portrait"){let r=t.length;if(r===0)return [];let o=n==="landscape"?d$:Fl,i=yre(r,e),s=[];for(let a=0;a<i;a++){let l=a*e,c=bre(a,e,r,l,o),d=c.cells.map(u=>({...u,slideIndex:u.slideIndex>=0&&u.slideIndex<r?t[u.slideIndex]:-1}));s.push({...c,cells:d});}return s}function fR(t="portrait"){let e=t==="landscape"?d$:Fl;return {width:e.width-e.marginLeft-e.marginRight,height:e.height-e.marginTop-e.marginBottom}}function mR(){return 8}function vre(t,e,n=Fl){let r=n.width-n.marginLeft-n.marginRight,o=n.height-n.marginTop-n.marginBottom,i=o*WWe,s=r,a=s/xee;a>i&&(a=i,s=a*xee);let l=(r-s)/2,c=(i-a)/2,d=i+XWe,u=o-d;return {pageIndex:t,slideIndex:e,slideArea:{x:l,y:c,width:s,height:a},textArea:{x:0,y:d,width:r,height:Math.max(0,u)}}}function gR(t){return t.map((e,n)=>vre(n,e))}function xR(){return {width:Fl.width-Fl.marginLeft-Fl.marginRight,height:Fl.height-Fl.marginTop-Fl.marginBottom}}function bR(t,e){let n=Am-2*Ni,r=Lc-2*Ni,o=r*u$,i=r-o-Nm,s=Math.min(n/t,o/e),a=t*s,l=e*s,c=Ni+(n-a)/2,u=Lc-Ni-l,p=u-Nm,h=Yy*yR,f=Math.floor(i/h);return {contentWidth:n,contentHeight:r,slideAreaHeight:o,notesAreaHeight:i,imageWidth:a,imageHeight:l,imageX:c,imageY:u,notesTextY:p,maxNotesLines:f}}function vR(t,e,n){if(!t||t.trim().length===0)return [];let r=n*.5,o=Math.floor(e/r);if(o<=0)return [];let i=[],s=t.split(/\r?\n/u);for(let a of s){if(a.trim().length===0){i.push("");continue}let l=a.split(/\s+/u),c="";for(let d of l)c.length===0?c=d:c.length+1+d.length<=o?c+=` ${d}`:(i.push(c),c=d);c.length>0&&i.push(c);}return i}function SR(){let t=Lc-2*Ni,e=qw+Nm,n=t-e,r=Yy*yR;return Math.floor(n/r)}function Ty(t){return t.replace(/\\/gu,"\\\\").replace(/\(/gu,"\\(").replace(/\)/gu,"\\)")}function mA(t,e){if(t.length===0)return "";let n=`BT /F1 ${Yy} Tf 0 0 0 rg `;n+=`${Ni} ${e.toFixed(2)} Td `;for(let r=0;r<t.length;r++){let o=t[r];r===0?n+=`(${Ty(o)}) Tj `:n+=`0 ${(-15.399999999999999).toFixed(2)} Td (${Ty(o)}) Tj `;}return n+=`ET
4467
4467
  `,n}function h$(t){return t.replace(/[&<>"']/gu,e=>jWe[e]||e)}function wR(t,e,n,r={}){let{title:o="Print",orientation:i="landscape",colorFilter:s=""}=r,a=t.map((l,c)=>`<section class="print-slide-page" aria-label="Slide ${c+1}">
4468
4468
  ${l}
4469
4469
  </section>`).join(`
@@ -4804,7 +4804,7 @@ ${e}`),sce=(t,e,n)=>{let r=Jn(e),o=sn(),i=vt(r),s=t.messageHandlers[i];return s?
4804
4804
  .notes-text .bullet { margin-right: 6px; }
4805
4805
  .notes-text .para { margin: 2px 0; }
4806
4806
  @media print { body { padding: 0; } }
4807
- </style></head><body>`);for(let a of t){let l=Jce(a),c=Ug(l);s.write('<div class="slide-page">'),s.write(`<div class="slide-header">${kh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write(`<div class="slide-thumb">${kh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write('<div class="notes-text">');let d=0;for(let u of c){u.bulletType==="numbered"?d++:d=0;let p=u.indentLevel*24,h="";u.bulletType==="bullet"?h="\u2022 ":u.bulletType==="numbered"&&(h=`${d}. `);let f=u.segments.filter(m=>!m.isParagraphBreak).map(m=>kh(m.text)).join("");s.write(`<div class="para" style="padding-left:${p}px">${kh(h)}${f}</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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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=Jce(i),a=QC(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?VI(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 Jce(t){return t.notesSegments&&t.notesSegments.length>0?t.notesSegments:jb(t.notes??"")}function tde({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(d=>{if(d.preventDefault(),o.trim().length===0)return;let u=o.startsWith("http")?o:`https://${o}`;e(u,s||u);},[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:d=>i(d.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:d=>a(d.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 rde({isRichEditEnabled:t,showLinkPopover:e,savedSelectionText:n,hasAllSlides:r,onApplyRichCommand:o,onToggleBulletList:i,onToggleNumberedList:s,onIndent:a,onOutdent:l,onLinkButtonClick:c,onInsertLink:d,onCloseLinkPopover:u,onPrintClick:p,onToggleRichEdit:h}){let{t:f}=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:f("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:f("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:f("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:f("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:f("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:f("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:f("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:f("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:f("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:f("pptx.notes.printNotes"),onClick:p,children:jsx(LuPrinter,{className:"w-3.5 h-3.5"})}),e&&jsx(tde,{initialText:n,onInsert:d,onClose:u})]}),jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded bg-muted hover:bg-accent border border-border/60",onClick:h,title:f("pptx.notes.toggleRichPlainEditor"),children:f(t?"pptx.notes.plainEditor":"pptx.notes.richEditor")})]})}function ode({activeSlide:t,isExpanded:e,canEdit:n,onToggle:r,onUpdateNotes:o}){let i=useMemo(()=>t?.notesSegments&&t.notesSegments.length>0?Yb(t.notesSegments):jb(t?.notes??""),[t?.notes,t?.notesSegments]),[s,a]=useState(t?.notes??""),[l,c]=useState(i),[d,u]=useState(i.length>0),[p,h]=useState(false),[f,m]=useState(false),x=useRef(null),g=useRef(null),y=useRef(null),b=useRef(null),v=useRef(false),S=useRef(null);useEffect(()=>{let Y=t?.notes??"";if(Y===S.current)return;let ge=t?.notesSegments&&t.notesSegments.length>0?Yb(t.notesSegments):jb(Y);a(Y),c(ge),u(ge.length>0);},[t?.id,t?.notes,t?.notesSegments]),useEffect(()=>{if(!(!d||!e||!n||!y.current)){if(v.current){v.current=false;return}y.current.innerHTML=Zce(l);}},[n,l,e,d]);let w=useCallback((Y,ge)=>{x.current&&(clearTimeout(x.current),x.current=null),S.current=Y,o(Y,ge);},[o]),C=useCallback((Y,ge)=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{S.current=Y,o(Y,ge),x.current=null;},600);},[o]);useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let T=useCallback(Y=>{let ge=Y.target.value,fe=jb(ge);a(ge),c(fe),C(ge,fe);},[C]),M=useCallback(Y=>{Y.stopPropagation(),Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&(w(s,l),r());},[s,l,w,r]),_=useCallback(()=>{if(!y.current)return;v.current=true;let Y=qce(y.current),ge=QC(Y);a(ge),c(Y),C(ge,Y);},[C]),E=useCallback(()=>{w(s,l);},[s,l,w]),R=useCallback(Y=>{if(!y.current)return;let ge=Yce(y.current,l),fe=Ug(l);ge>=0&&ge<fe.length&&(fe[ge]=Y(fe[ge],ge));let de=jce(fe),J=QC(de);a(J),c(de),C(J,de);},[l,C]),I=useCallback(Y=>{document.execCommand(Y),_(),y.current?.focus();},[_]),L=useCallback(()=>{R(Y=>({...Y,bulletType:Y.bulletType==="bullet"?"none":"bullet"})),y.current?.focus();},[R]),k=useCallback(()=>{R(Y=>({...Y,bulletType:Y.bulletType==="numbered"?"none":"numbered"})),y.current?.focus();},[R]),F=useCallback(()=>{R(Y=>({...Y,indentLevel:Math.min(4,Y.indentLevel+1)})),y.current?.focus();},[R]),N=useCallback(()=>{R(Y=>({...Y,indentLevel:Math.max(0,Y.indentLevel-1)})),y.current?.focus();},[R]),D=useCallback(Y=>{if(Y.stopPropagation(),Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)){w(s,l),r();return}Y.key==="Tab"&&(Y.preventDefault(),Y.shiftKey?N():F());},[s,l,w,r,F,N]),U=useCallback(()=>{let Y=window.getSelection();b.current={text:Y?.toString()??""},h(true);},[]),G=useCallback((Y,ge)=>{if(h(false),!y.current)return;y.current.focus();let fe=window.getSelection();if(fe&&fe.rangeCount>0){let de=fe.getRangeAt(0);de.deleteContents();let J=document.createElement("a");J.href=Y,J.textContent=ge,J.style.color="#4a9eff",J.style.textDecoration="underline",J.style.cursor="pointer",J.setAttribute("data-hyperlink",Y),de.insertNode(J),de.setStartAfter(J),de.collapse(true),fe.removeAllRanges(),fe.addRange(de);}_();},[_]),j=useCallback(Y=>{let ge=Y.target;if(!(ge instanceof HTMLAnchorElement))return;let fe=ge.getAttribute("data-hyperlink")||ge.getAttribute("href");fe&&(Y.ctrlKey||Y.metaKey)&&(Y.preventDefault(),rh(fe));},[]);return {draft:s,draftSegments:l,isRichEditEnabled:d,setIsRichEditEnabled:u,showLinkPopover:p,setShowLinkPopover:h,showPrintDialog:f,setShowPrintDialog:m,textareaRef:g,richEditorRef:y,savedSelectionRef:b,handlePlainChange:T,handleRichInput:_,handleBlur:E,handleKeyDownPlain:M,handleKeyDownRich:D,applyRichCommand:I,toggleBulletList:L,toggleNumberedList:k,handleIndent:F,handleOutdent:N,handleLinkButtonClick:U,handleInsertLink:G,handleEditorClick:j}}var ez=({activeSlide:t,allSlides:e,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i,panelHeight:s})=>{let{t:a}=useTranslation(),{draft:l,draftSegments:c,isRichEditEnabled:d,setIsRichEditEnabled:u,showLinkPopover:p,setShowLinkPopover:h,showPrintDialog:f,setShowPrintDialog:m,textareaRef:x,richEditorRef:g,savedSelectionRef:y,handlePlainChange:b,handleRichInput:v,handleBlur:S,handleKeyDownPlain:w,handleKeyDownRich:C,applyRichCommand:T,toggleBulletList:M,toggleNumberedList:_,handleIndent:E,handleOutdent:R,handleLinkButtonClick:I,handleInsertLink:L,handleEditorClick:k}=ode({activeSlide:t,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i}),F=l.trim().length>0,N=t?a("pptx.notes.slideN",{n:t.slideNumber}):a("pptx.notes.noSlide"),{dragY:D,handlers:U}=Lu(o);return jsxs(Fragment,{children:[n&&jsx("button",{type:"button","aria-label":a("common.close"),onClick:o,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:ie("flex flex-col border-t border-border/60 bg-background select-none",!n&&"max-md:hidden","max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:z-30 max-md:max-h-[75dvh] max-md:rounded-t-2xl max-md:border max-md:border-border max-md:shadow-2xl max-md:pb-[max(env(safe-area-inset-bottom),0px)]"),style:D>0?{transform:`translateY(${D}px)`,transition:"none"}:void 0,children:[n&&jsx("div",{className:"md:hidden flex items-center justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing touch-none",onPointerDown:U.onPointerDown,onPointerMove:U.onPointerMove,onPointerUp:U.onPointerUp,onPointerCancel:U.onPointerCancel,children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),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&&F&&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:N}),r?jsxs(Fragment,{children:[jsx(rde,{isRichEditEnabled:d,showLinkPopover:p,savedSelectionText:y.current?.text??"",hasAllSlides:e!==void 0&&e.length>0,onApplyRichCommand:T,onToggleBulletList:M,onToggleNumberedList:_,onIndent:E,onOutdent:R,onLinkButtonClick:I,onInsertLink:L,onCloseLinkPopover:()=>h(false),onPrintClick:()=>m(true),onToggleRichEdit:()=>u(G=>!G)}),d?jsx("div",{ref:g,contentEditable:true,suppressContentEditableWarning:true,onInput:v,onBlur:S,onKeyDown:C,onClick:k,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:b,onBlur:S,onKeyDown:w,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:F?VI(c):jsx("span",{className:"italic text-muted-foreground",children:a("pptx.notes.noNotes")})})]}),f&&e&&jsx(Qce,{slides:e,onClose:()=>m(false)})]})]})};Pe();var iQe="pptx-viewer-autosave",sQe=1,qb="recoveryVersions";function sde(){return new Promise((t,e)=>{let n=indexedDB.open(iQe,sQe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(qb)||r.createObjectStore(qb,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function aQe(t){try{let e=await sde();return new Promise(n=>{let i=e.transaction(qb,"readonly").objectStore(qb).get(t);i.onsuccess=()=>{e.close();let s=i.result;n(s?[s]:[]);},i.onerror=()=>{e.close(),n([]);};})}catch{return []}}async function lQe(t){try{let e=await sde();return new Promise(n=>{let r=e.transaction(qb,"readwrite");r.objectStore(qb).delete(t),r.oncomplete=()=>{e.close(),n();},r.onerror=()=>{e.close(),n();};})}catch{}}function cQe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function nz({isOpen:t,filePath:e,onClose:n,onRestore:r}){let{t:o}=useTranslation(),[i,s]=useState([]),[a,l]=useState(false),[c,d]=useState(null),[u,p]=useState(null),h=useCallback(async()=>{if(e){l(true);try{let x=await aQe(e);s(x);}catch{s([]);}finally{l(false);}}},[e]);useEffect(()=>{t&&h();},[t,h]);let f=useCallback(async x=>{d(x.key);try{x.data&&(r(x.data),n());}finally{d(null);}},[r,n]),m=useCallback(async x=>{p(x.key);try{await lQe(x.key),await h();}finally{p(null);}},[h]);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:Xne(x.timestamp)}),jsx("div",{className:"text-[10px] text-muted-foreground",children:jne(x.timestamp)})]}),jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:cQe(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:()=>{f(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:u===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 bQe({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 lde({diff:t,diffIndex:e,canvasSize:n,accepted:r,rejected:o,onAccept:i,onReject:s}){let{t:a}=useTranslation(),[l,c]=useState(t.status==="changed"),d=(()=>{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")}})(),u=(()=>{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,h=t.baseIndex>=0?t.baseIndex+1:t.compareIndex+1;return jsxs("div",{className:ie("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(f=>!f),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:h})}),jsx("span",{className:ie("rounded-full px-2 py-0.5 text-[10px] font-medium",u),children:d}),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:ie("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(oa,{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:ie("rounded border overflow-hidden",t.status==="added"?"border-green-700/60":t.status==="changed"?"border-amber-700/60":"border-border"),children:jsx(oa,{slide:t.compareSlide,templateElements:[],canvasSize:n})})]})]}),t.changes.length>0&&jsx("div",{className:"space-y-1",children:t.changes.map((f,m)=>jsxs("div",{className:"flex items-start gap-2 rounded bg-muted/60 px-2 py-1.5 text-[11px]",children:[jsx(bQe,{kind:f.kind}),jsx("span",{className:"text-foreground",children:f.description})]},`${f.elementId}-${f.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 oz({isOpen:t,compareResult:e,canvasSize:n,onClose:r,onAcceptSlide:o,onRejectSlide:i,onAcceptAll:s}){let{t:a}=useTranslation(),[l,c]=useState({}),[d,u]=useState({}),p=useCallback(x=>{c(g=>({...g,[x]:true})),u(g=>{let y={...g};return delete y[x],y}),o(x);},[o]),h=useCallback(x=>{u(g=>({...g,[x]:true})),c(g=>{let y={...g};return delete y[x],y}),i(x);},[i]),f=useCallback(()=>{if(!e)return;let x={};e.diffs.forEach((g,y)=>{g.status!=="unchanged"&&(x[y]=true);}),c(x),u({}),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] max-w-full 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:f,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,g)=>jsx(lde,{diff:x,diffIndex:g,canvasSize:n,accepted:!!l[g],rejected:!!d[g],onAccept:p,onReject:h},`diff-${g}-${x.status}`))})]})}function AQe(t){if(!t)return 0;let e=0;return t.length>=8&&e++,t.length>=12&&e++,/[A-Z]/u.test(t)&&/[a-z]/u.test(t)&&e++,/\d/u.test(t)&&e++,/[^A-Za-z0-9]/u.test(t)&&e++,Math.min(e,4)}var RQe=["bg-red-500","bg-orange-500","bg-yellow-500","bg-lime-500","bg-green-500"];function sz({isOpen:t,isCurrentlyProtected:e,onClose:n,onSetPassword:r,onRemovePassword:o}){let{t:i}=useTranslation(),[s,a]=useState(""),[l,c]=useState(""),[d,u]=useState(false),[p,h]=useState(""),f=useMemo(()=>AQe(s),[s]),m=useMemo(()=>{let b=[i("pptx.security.strengthVeryWeak"),i("pptx.security.strengthWeak"),i("pptx.security.strengthFair"),i("pptx.security.strengthStrong"),i("pptx.security.strengthVeryStrong")];return s?b[f]:""},[f,s,i]),x=useCallback(()=>{if(h(""),!s){h(i("pptx.security.errorPasswordRequired"));return}if(s!==l){h(i("pptx.security.errorPasswordMismatch"));return}if(s.length<4){h(i("pptx.security.errorPasswordTooShort"));return}r(s),a(""),c(""),n();},[s,l,r,n,i]),g=useCallback(()=>{o(),a(""),c(""),n();},[o,n]),y=useCallback(()=>{a(""),c(""),h(""),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:y}),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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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:y,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:d?"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:b=>{a(b.target.value),h("");}}),jsx("button",{type:"button",onClick:()=>u(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":d?"Hide password":"Show password",children:d?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((b,v)=>jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${v<=f?RQe[f]:"bg-accent"}`},`str-${v}`))}),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:d?"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:b=>{c(b.target.value),h("");}})]}),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:g,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:y,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 IQe=120;function az(t){let{slides:e,canvasSize:n,activeSlideIndex:r,templateElementsBySlideId:o,loading:i,error:s,hasActivePointerInteraction:a,pointerCommitNonce:l,setSlides:c,setCanvasSize:d,setActiveSlideIndex:u,setTemplateElementsBySlideId:p,setSelectedElementId:h,setSelectedElementIds:f}=t,m=useRef([]),x=useRef([]),g=useRef(null),y=useRef(""),b=useRef(""),v=useRef(false),S=useRef(null),[w,C]=useState(false),[T,M]=useState(false),[_,E]=useState(void 0),[R,I]=useState(void 0),[L,k]=useState(false),F=useCallback(()=>{C(m.current.length>0),M(x.current.length>0);let fe=m.current[m.current.length-1];E(fe?.actionLabel);let de=x.current[x.current.length-1];I(de?.actionLabel);},[]),N=useCallback(fe=>({width:n.width,height:n.height,activeSlideIndex:r,slides:e.map(sT),templateElementsBySlideId:aT(o),...fe?{actionLabel:fe}:{}}),[r,n,e,o]),D=useCallback(fe=>{let de=Math.max(fe.slides.length-1,0);d({width:fe.width,height:fe.height}),c(fe.slides.map(sT)),p(aT(fe.templateElementsBySlideId)),u(Math.min(fe.activeSlideIndex,de)),f([]),h(null);},[u,d,h,f,c,p]),U=useCallback(()=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{v.current=false;},0);},[]),G=useCallback(()=>{k(fe=>fe||true);},[]),j=useCallback(()=>{let fe=m.current.pop();if(!fe)return;let de=N();x.current.push(de),v.current=true;let J=ou(fe);g.current=ou(J),y.current=JSON.stringify(J),D(J),F(),U(),G();},[D,N,G,U,F]),Y=useCallback(()=>{let fe=x.current.pop();if(!fe)return;let de=N();m.current.push(de),v.current=true;let J=ou(fe);g.current=ou(J),y.current=JSON.stringify(J),D(J),F(),U(),G();},[D,N,G,U,F]),ge=useCallback(fe=>{if(m.current=[],x.current=[],fe){let de=ou(fe);g.current=de,y.current=JSON.stringify(de);}else g.current=null,y.current="";F();},[F]);return useEffect(()=>()=>{S.current&&(clearTimeout(S.current),S.current=null);},[]),useEffect(()=>{if(i||s||v.current||a())return;let fe=`${e.length}|${r}|${n.width}x${n.height}|${e.map(ce=>`${ce.id}:${ce.elements.length}`).join("/")}`;if(fe===b.current)return;let de=N(),J=JSON.stringify(de);if(J===y.current){b.current=fe;return}let re=g.current;if(!re){g.current=ou(de),y.current=J,b.current=fe,F();return}m.current.push(ou(re)),m.current.length>IQe&&m.current.shift(),x.current=[],g.current=ou(de),y.current=J,b.current=fe,F();},[r,N,n.height,n.width,s,a,i,l,e,F]),{canUndo:w,canRedo:T,undoLabel:_,redoLabel:R,handleUndo:j,handleRedo:Y,resetHistory:ge,markDirty:G,buildHistorySnapshot:N}}function cz({canvasSize:t,selectedElements:e}){let n=useRef(null),r=useRef(null),o=useRef(null),i=useRef(1),[s,a]=useState(1),[l,c]=useState(null),d=l||{width:t.width,height:t.height},u=useMemo(()=>{if(!d.width||!d.height)return 1;let S=d.width/t.width,w=d.height/t.height;return Math.min(S,w,1)},[t,d.height,d.width]),p=u*s;useEffect(()=>{i.current=p;},[p]),useEffect(()=>{let S=null,w=0,C=32,T=_=>{let E=Math.max(0,_.clientWidth-8),R=Math.max(0,_.clientHeight-C);E>0&&R>0&&c({width:E,height:R});},M=()=>{let _=o.current;if(!_){w=requestAnimationFrame(M);return}S=new ResizeObserver(()=>T(_)),S.observe(_),T(_);};return M(),()=>{cancelAnimationFrame(w),S?.disconnect();}},[]);let h=useCallback((S,w)=>{let C=n.current,T=o.current;if(!C||!T)return;let M=Math.min(Math.max(w,.2),5),_=u*M,E=(S.minX+S.maxX)/2,R=(S.minY+S.maxY)/2,I=T.offsetLeft+E*_-C.clientWidth/2,L=T.offsetTop+R*_-C.clientHeight/2;C.scrollTo({left:Math.max(I,0),top:Math.max(L,0),behavior:"smooth"});},[u]),f=useCallback(()=>{a(S=>Math.min(S+.1,5));},[]),m=useCallback(()=>{a(S=>Math.max(S-.1,.2));},[]),x=useCallback(()=>{a(1);},[]),g=useCallback(()=>{a(1);},[]),y=useCallback(()=>{if(e.length===0)return;let S=Number.POSITIVE_INFINITY,w=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(e.forEach(N=>{S=Math.min(S,N.x),w=Math.min(w,N.y),C=Math.max(C,N.x+Math.max(N.width,12)),T=Math.max(T,N.y+Math.max(N.height,12));}),!Number.isFinite(S)||!Number.isFinite(w)||!Number.isFinite(C)||!Number.isFinite(T))return;let M={minX:S,minY:w,maxX:C,maxY:T},_=Math.max(M.maxX-M.minX,12),E=Math.max(M.maxY-M.minY,12),R=Math.max(d.width-96,12),I=Math.max(d.height-96,12),L=Math.min(R/_,I/E),k=u>Number.EPSILON?u:Number.EPSILON,F=Math.min(Math.max(L/k,.2),5);a(F),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{h(M,F);});});},[h,d.height,d.width,u,e]),b=useCallback(S=>{if(!S.ctrlKey)return;S.preventDefault();let w=S.deltaY*-1e-3;a(C=>Math.min(Math.max(C+w,.2),5));},[]);useEffect(()=>{let S=o.current;if(S)return S.addEventListener("wheel",b,{passive:false}),()=>{S.removeEventListener("wheel",b);}},[b]);let v=useCallback((S,w)=>{let C=r.current;if(!C)return null;let T=C.getBoundingClientRect();if(T.width<=0||T.height<=0)return null;let M=(S-T.left)/p,_=(w-T.top)/p;return {x:Math.max(0,Math.min(t.width,M)),y:Math.max(0,Math.min(t.height,_))}},[t.height,t.width,p]);return {editWrapperRef:n,canvasStageRef:r,canvasViewportRef:o,renderScaleRef:i,scale:s,setScale:a,editorDimensions:l,setEditorDimensions:c,fitScale:u,editorScale:p,handleZoomIn:f,handleZoomOut:m,handleResetZoom:x,handleZoomToFit:g,handleZoomToSelection:y,handleWheel:b,centerBoundsInViewport:h,getCanvasPointFromClient:v}}bt();function fde(t){return !!t.loopContinuously||t.showType==="kiosk"}function mde(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 gde(t,e){return Math.max(0,t||0)+e*60}function ZI(){}function zg(t,e,n,r){for(let o of t.steps)o.stopSound?ZI():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 dz(t){let{slides:e,onPlayActionSound:n,showWithAnimation:r}=t,o=r!==false,[i,s]=useState([]),[a,l]=useState(new Map),[c,d]=useState(""),[u,p]=useState(new Set),[h,f]=useState(new Set),m=useRef([]),x=useRef(null),g=useCallback(()=>{m.current.forEach(M=>{window.clearTimeout(M);}),m.current=[];},[]),y=useCallback(M=>{if(!M.shouldAutoAdvance())return;let _=M.getAutoAdvanceDelay(),E=M.peekNext();if(!E)return;let R=_+(E.autoAdvanceDelayMs??0),I=window.setTimeout(()=>{let L=M.advance();L&&(zg(L,n,l,m),y(M));},Math.max(0,R));m.current.push(I);},[n]),b=useCallback(M=>{let _=e[M];if(!_){x.current=null,l(new Map),d(""),p(new Set),f(new Set);return}let E=_.nativeAnimations??[],R=new Map;for(let F of E)if(F.buildType&&F.buildType!=="allAtOnce"&&F.targetId){let N=_.elements.find(D=>D.id===F.targetId);N&&ze(N)&&N.textSegments&&N.textSegments.length>0&&R.set(F.targetId,NA(N.textSegments));}let I=R.size>0?LA(E,R):E,L=DA.fromAnimations(I);x.current=L,d(L.getTimeline().keyframesCss),p(L.getInteractiveTriggerShapeIds()),f(L.getHoverTriggerShapeIds());let k=_.elements.map(F=>F.id);for(let F of I)F.targetId&&F.targetId.includes(ra)&&k.push(F.targetId);l(L.getElementStates(k));},[e]),v=useCallback(()=>{if(!o)return false;let M=x.current;if(!M||!M.hasMoreSteps())return false;let _=M.advance();return _?(zg(_,n,l,m),y(M),true):false},[o,n,y]),S=useCallback(M=>{let _=x.current;if(!_||!_.hasInteractiveSequence(M))return false;let E=_.advanceInteractive(M);return E?(zg(E,n,l,m),true):false},[n]),w=useCallback(M=>{if(!o)return false;let _=x.current;if(!_||!_.hasHoverSequence(M))return false;_.resetHover(M);let E=_.advanceHover(M);return E?(zg(E,n,l,m),true):false},[o,n]),C=useCallback(M=>{let _=x.current;!_||!_.hasHoverSequence(M)||_.resetHover(M);},[]),T=useCallback(M=>{if(g(),!o){x.current=null,s([]),l(new Map),d(""),p(new Set),f(new Set);return}b(M);let _=e[M];if(!_){s([]);return}let E=x.current;if(E&&E.hasMoreSteps()){let I=E.peekNext();if(I&&I.autoAdvance){let L=window.setTimeout(()=>{let k=E.advance();k&&(zg(k,n,l,m),y(E));},I.autoAdvanceDelayMs??0);m.current.push(L);}}let R=[..._.animations||[]].filter(I=>!!I.entrance).sort((I,L)=>(I.order||Number.MAX_SAFE_INTEGER)-(L.order||Number.MAX_SAFE_INTEGER));if(R.length===0){s([]);return}s(R.map(I=>({elementId:I.elementId,state:"hidden",animation:I}))),R.forEach((I,L)=>{let k=gde(I.delayMs,L),F=window.setTimeout(()=>{s(N=>N.map(D=>D.elementId===I.elementId?{...D,state:"visible"}:D));},k);m.current.push(F);});},[o,g,b,e,n,y]);return {presentationAnimations:i,presentationElementStates:a,presentationKeyframesCss:c,interactiveTriggerShapeIds:u,hoverTriggerShapeIds:h,clearPresentationTimers:g,playNextAnimationGroup:v,handleInteractiveShapeClick:S,handleHoverStart:w,handleHoverEnd:C,runPresentationEntranceAnimations:T,presentationTimersRef:m}}var LQe="pptx-viewer-audience";var Oh="content",uz="pptx-bytes";function pz(){return new Promise((t,e)=>{let n=indexedDB.open(LQe,1);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(Oh)||r.createObjectStore(Oh);},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function JI(t){let e=await pz();return new Promise((n,r)=>{let o=e.transaction(Oh,"readwrite"),i=o.objectStore(Oh),a={bytes:t instanceof Uint8Array?t:new Uint8Array(t),createdAt:Date.now()};i.put(a,uz),o.oncomplete=()=>{e.close(),n();},o.onerror=()=>{e.close(),r(o.error);};})}async function yde(){try{let t=await pz();return new Promise((e,n)=>{let i=t.transaction(Oh,"readonly").objectStore(Oh).get(uz);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 Vg(){try{let t=await pz();return new Promise(e=>{let n=t.transaction(Oh,"readwrite");n.objectStore(Oh).delete(uz),n.oncomplete=()=>{t.close(),e();},n.onerror=()=>{t.close(),e();};})}catch{}}var tN="pptx-viewer-presenter",s2="#pptx-audience",a2="pptx-viewer-presenter",bde="nonce";function DQe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function vde(){let t=window.location.hash;if(!t.startsWith(s2))return null;let e=t.slice(s2.length);return e?new URLSearchParams(e.replace(/^[&;?]/u,"")).get(bde):null}function l2(){return window.location.hash.startsWith(s2)}function hz(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(tN)),i.current),[]),c=useCallback(()=>o.current!==null&&!o.current.closed,[]),d=useCallback(h=>{if(!a.current)return;let f={origin:a2,type:"presenter-slide-change",slideIndex:h,sessionId:a.current};try{l().postMessage(f);}catch{}},[l]),u=useCallback(()=>{if(a.current)try{let f={origin:a2,type:"presenter-exit",sessionId:a.current};l().postMessage(f);}catch{}let h=o.current;if(h&&!h.closed)try{h.close();}catch{}o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null),Vg();},[l]),p=useCallback(()=>{c()&&u();let h=window.open("about:blank","_blank");if(!h)return false;o.current=h;let f=DQe();a.current=f;let m=new URL(window.location.href),x=new URLSearchParams;x.set(bde,f),m.hash=`${s2}&${x.toString()}`;let g=y=>{let b=o.current;if(!(!b||b.closed)){if(!y){try{b.close();}catch{}o.current=null,a.current="";return}try{b.location.replace(m.toString());}catch{try{b.close();}catch{}o.current=null,a.current="";}}};return r?JI(r).then(()=>g(true)).catch(()=>g(false)):g(true),window.setTimeout(()=>d(e),1500),s.current=setInterval(()=>{let y=o.current;(!y||y.closed)&&(o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null));},1e3),true},[c,u,d,e,r]);return useEffect(()=>{n&&c()&&d(e);},[e,n,c,d]),useEffect(()=>()=>{u();try{i.current?.close();}catch{}},[u]),useEffect(()=>{n||u();},[n,u]),useEffect(()=>{let h=()=>{Vg();};return window.addEventListener("beforeunload",h),()=>window.removeEventListener("beforeunload",h)},[]),{openAudienceWindow:p,closeAudienceWindow:u,isAudienceWindowOpen:c,syncSlideToAudience:d}}function fz(t){let{onSetMode:n,onSetActiveSlideIndex:r,containerRef:o}=t,i=useRef(false);useEffect(()=>{if(!l2()||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(!l2())return;let s=vde(),a;try{a=new BroadcastChannel(tN);}catch{return}return a.onmessage=l=>{let c=l.data;if(!(!c||c.origin!==a2)&&!(s&&c.sessionId!==s)&&(c.type==="presenter-slide-change"&&r(c.slideIndex),c.type==="presenter-exit")){Vg(),n("edit");try{window.close();}catch{}}},()=>{try{a.close();}catch{}}},[n,r]);}function wde(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 mz(t){let{mode:e,movePresentationSlide:n,onSetMode:r,onToggleLaser:o,onTogglePen:i,onToggleEraser:s,onToggleToolbar:a,onTogglePresenterView:l,rehearsing:c,recordCurrentSlideTime:d,presentationSlideIndex:u,setShowRehearsalSummary:p}=t;useEffect(()=>{if(e!=="present")return;let h=f=>{let m=wde(f.key,f.ctrlKey);if(m.action!=="none")switch(f.preventDefault(),m.action){case "exit":c&&(d(u),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",h),()=>{window.removeEventListener("keydown",h);}},[e,n,r,o,i,s,a,l,c,d,u,p]);}function gz(t){let{containerRef:e,onSetMode:n,onSaveRehearsalTimings:r,setPresentationStartTime:o,setPresenterMode:i}=t,[s,a]=useState(false),[l,c]=useState({}),[d,u]=useState(null),[p,h]=useState(false),[f,m]=useState(false),x=useRef(0),g=useRef(null),y=useCallback(C=>{if(d===null)return;let T=x.current;g.current!==null&&(T+=Date.now()-g.current);let M=Date.now()-d-T;c(_=>({..._,[C]:Math.max(0,M)})),x.current=0,g.current=f?Date.now():null,u(Date.now());},[d,f]),b=useCallback(()=>{h(false),a(false),c({});},[]),v=useCallback(()=>{r?.(l),h(false),a(false);},[r,l]),S=useCallback(()=>{i(false),a(true),c({}),m(false),h(false),x.current=0,g.current=null;let C=Date.now();o(C),u(C);try{let T=e.current;T&&typeof T.requestFullscreen=="function"&&T.requestFullscreen().catch(()=>{});}catch{}n("present");},[e,n,o,i]),w=useCallback(()=>{m(C=>(C?g.current!==null&&(x.current+=Date.now()-g.current,g.current=null):g.current=Date.now(),!C));},[]);return {rehearsing:s,setRehearsing:a,recordedTimings:l,slideStartTime:d,showRehearsalSummary:p,setShowRehearsalSummary:h,rehearsalPaused:f,recordCurrentSlideTime:y,dismissRehearsalSummary:b,saveRehearsalTimings:v,enterRehearsalMode:S,toggleRehearsalPause:w}}function xz(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")&&Dm(t.url)&&window.open(t.url,"_blank","noopener,noreferrer");}function nN(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 yz(t){let{slides:e,visibleSlideIndexes:n,presentationSlideIndex:r,setPresentationSlideIndex:o,setPresentationSlideVisible:i,onSetMode:s,onSetActiveSlideIndex:a,onPlayActionSound:l,loopContinuously:c,useTimings:d,playNextAnimationGroup:u,clearPresentationTimers:p,runPresentationEntranceAnimations:h,presentationTimersRef:f,rehearsing:m,recordCurrentSlideTime:x,setShowRehearsalSummary:g}=t,y=useRef(()=>{}),b=useCallback(C=>{if(d===false)return;let M=e[C]?.transition?.advanceAfterMs;if(typeof M!="number"||!Number.isFinite(M)||M<0)return;let _=window.setTimeout(()=>{y.current(1);},Math.max(0,M));f.current.push(_);},[e,f,d]),v=useCallback(C=>{if(C===1&&u())return;let T=n.length>0?n:e.map((L,k)=>k);if(T.length===0)return;let M=T.indexOf(r),E=(M>=0?M:0)+C;if(m&&C===1&&E>=T.length){x(r);try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}s("edit"),g(true);return}let R;c&&!m&&C===1&&E>=T.length?R=0:R=Math.min(T.length-1,Math.max(0,E));let I=T[R];I===void 0||I===r||(m&&C===1&&x(r),nN(I,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:h,scheduleAutoAdvanceForSlide:m?void 0:b,presentationTimersRef:f}));},[p,c,l,a,s,u,r,f,x,m,h,b,g,e,n,i,o]);y.current=v;let S=useCallback(C=>{C<0||C>=e.length||C!==r&&nN(C,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:h,scheduleAutoAdvanceForSlide:b,presentationTimersRef:f});},[p,l,a,r,f,h,b,e,o,i]),w=useCallback(C=>{xz(C,{movePresentationSlide:v,navigateToSlide:S,onPlayActionSound:l,onSetMode:s,slidesLength:e.length});},[v,S,l,s,e.length]);return {movePresentationSlide:v,navigateToSlide:S,handlePresentationAction:w,scheduleAutoAdvanceForSlide:b}}function vz(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 wz(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:h,onSaveRehearsalTimings:f,loopContinuously:m,showWithAnimation:x,useTimings:g}=t,[y,b]=useState(0),[v,S]=useState(true),[w,C]=useState(false),[T,M]=useState(null),_=useRef(false),{presentationAnimations:E,presentationElementStates:R,presentationKeyframesCss:I,interactiveTriggerShapeIds:L,hoverTriggerShapeIds:k,clearPresentationTimers:F,playNextAnimationGroup:N,handleInteractiveShapeClick:D,handleHoverStart:U,handleHoverEnd:G,runPresentationEntranceAnimations:j,presentationTimersRef:Y}=dz({slides:n,onPlayActionSound:c,showWithAnimation:x}),{rehearsing:ge,setRehearsing:fe,recordedTimings:de,slideStartTime:J,showRehearsalSummary:re,setShowRehearsalSummary:ce,rehearsalPaused:ae,recordCurrentSlideTime:_e,dismissRehearsalSummary:xe,saveRehearsalTimings:Ee,enterRehearsalMode:W,toggleRehearsalPause:q}=gz({containerRef:i,onSetMode:a,onSaveRehearsalTimings:f,setPresentationStartTime:M,setPresenterMode:C}),{movePresentationSlide:Q,navigateToSlide:se,handlePresentationAction:me,scheduleAutoAdvanceForSlide:P}=yz({slides:n,visibleSlideIndexes:r,presentationSlideIndex:y,setPresentationSlideIndex:b,setPresentationSlideVisible:S,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,loopContinuously:m,useTimings:g,playNextAnimationGroup:N,clearPresentationTimers:F,runPresentationEntranceAnimations:j,presentationTimersRef:Y,rehearsing:ge,recordCurrentSlideTime:_e,setShowRehearsalSummary:ce}),{handleZoomClick:A,zoomReturnSlideIndex:O,returnToZoomSlide:z,clearZoomReturn:te}=vz({navigateToSlide:se}),{openAudienceWindow:$,closeAudienceWindow:Me,isAudienceWindowOpen:De,syncSlideToAudience:V}=hz({currentSlideIndex:y,isPresenterMode:w,content:s});fz({onSetMode:a,onSetActiveSlideIndex:l,containerRef:i});let B=useCallback(()=>{C(false),fe(false),M(Date.now());try{let ue=i.current;ue&&typeof ue.requestFullscreen=="function"&&ue.requestFullscreen().catch(()=>{});}catch{}a("present");},[i,a,fe]),ee=useCallback(()=>{C(true),fe(false),M(Date.now()),a("present");},[a,fe]),oe=useCallback(()=>{if(w){C(false);try{let ue=i.current;ue&&typeof ue.requestFullscreen=="function"&&ue.requestFullscreen().catch(()=>{});}catch{}}else {_.current=true;try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}C(true),T||M(Date.now());}},[w,T,i]);mz({mode:e,movePresentationSlide:Q,onSetMode:a,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:h,onTogglePresenterView:oe,rehearsing:ge,recordCurrentSlideTime:_e,presentationSlideIndex:y,setShowRehearsalSummary:ce});let pe=useRef(j);pe.current=j;let Ae=useRef(P);Ae.current=P;let Le=useRef(o);return Le.current=o,useEffect(()=>{if(e==="present"){let ue=Le.current;b(ue),pe.current(ue),Ae.current(ue);}},[e]),useEffect(()=>{if(e==="present")return ()=>{try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}}},[e]),useEffect(()=>{if(e!=="present"||w)return;let ue=!!document.fullscreenElement,we=()=>{if(_.current){_.current=false,ue=!!document.fullscreenElement;return}let Ie=!!document.fullscreenElement;ue&&!Ie&&(ge&&(_e(y),ce(true)),a("edit")),ue=Ie;};return document.addEventListener("fullscreenchange",we),()=>{document.removeEventListener("fullscreenchange",we);}},[e,a,w,ge,_e,y,ce]),useEffect(()=>{let ue=Y;return ()=>{ue.current.forEach(we=>{window.clearTimeout(we);});}},[Y]),{presentationSlideIndex:y,setPresentationSlideIndex:b,presentationSlideVisible:v,presentationAnimations:E,presentationElementStates:R,presentationKeyframesCss:I,clearPresentationTimers:F,runPresentationEntranceAnimations:j,movePresentationSlide:Q,navigateToSlide:se,handlePresentationAction:me,handleInteractiveShapeClick:D,interactiveTriggerShapeIds:L,hoverTriggerShapeIds:k,handleHoverStart:U,handleHoverEnd:G,enterPresentMode:B,presenterMode:w,enterPresenterView:ee,togglePresenterView:oe,presentationStartTime:T,rehearsing:ge,enterRehearsalMode:W,recordedTimings:de,slideStartTime:J,showRehearsalSummary:re,dismissRehearsalSummary:xe,saveRehearsalTimings:Ee,rehearsalPaused:ae,toggleRehearsalPause:q,handleZoomClick:A,zoomReturnSlideIndex:O,returnToZoomSlide:z,clearZoomReturn:te,openAudienceWindow:$,closeAudienceWindow:Me,isAudienceWindowOpen:De,syncSlideToAudience:V}}var $Qe=2.5,HQe=14,zQe=.4,Mde=16,_de=0;function VQe(){return _de+=1,`stroke-${_de}`}function Tz(t){let{isActive:e,activeSlideIndex:n}=t,[r,o]=useState("none"),[i,s]=useState("#ff0000"),[a,l]=useState("#ffff00"),[c,d]=useState(null),[u,p]=useState(null),[h,f]=useState(false),m=useRef(new Map),[x,g]=useState([]),[y,b]=useState(0),v=useRef(false),S=useRef(n);S.current=n;let w=useRef(n);useEffect(()=>{e&&w.current!==n&&(g(U=>(U.length>0?m.current.set(w.current,U):m.current.delete(w.current),b(G=>G+1),m.current.get(n)??[])),w.current=n);},[e,n]);let C=useCallback(U=>{e&&o(G=>G===U?"none":U);},[e]),T=useCallback((U,G)=>{if(e&&(r==="pen"||r==="highlighter")){v.current=true;let j=r==="pen";d({id:VQe(),points:[{x:U,y:G}],color:j?i:a,width:j?$Qe:HQe,opacity:j?1:zQe});}},[e,r,i,a]),M=useCallback((U,G)=>{!e||!v.current||d(j=>j?{...j,points:[...j.points,{x:U,y:G}]}:null);},[e]),_=useCallback(()=>{v.current&&(v.current=false,d(U=>(U&&U.points.length>1&&g(G=>{if(G.some(Y=>Y.id===U.id))return G;let j=[...G,U];return m.current.set(S.current,j),b(Y=>Y+1),j}),null)));},[]),E=useCallback((U,G)=>{!e||r!=="laser"||p({x:U,y:G});},[e,r]),R=useCallback(()=>{p(null);},[]),I=useCallback((U,G)=>{!e||r!=="eraser"||g(j=>{let Y=j.filter(ge=>!ge.points.some(fe=>{let de=fe.x-U,J=fe.y-G;return de*de+J*J<Mde*Mde}));return Y.length>0?m.current.set(S.current,Y):m.current.delete(S.current),b(ge=>ge+1),Y});},[e,r]),L=useCallback(()=>{g([]),d(null),v.current=false,m.current.delete(S.current),b(U=>U+1);},[]),k=useCallback(()=>{g([]),d(null),v.current=false,m.current.clear(),b(U=>U+1);},[]),F=useRef(0);useEffect(()=>{if(!e){f(false),o("none"),d(null),p(null);return}let U=()=>{f(true),window.clearTimeout(F.current),F.current=window.setTimeout(()=>{f(false);},3e3);};return window.addEventListener("mousemove",U),()=>{window.removeEventListener("mousemove",U),window.clearTimeout(F.current);}},[e]);let N=useCallback(()=>{let U=new Map(m.current);return x.length>0&&U.set(n,x),U},[x,n]),D=y>=0&&(x.length>0||m.current.size>0);return {presentationTool:r,setPresentationTool:C,penColor:i,setPenColor:s,highlighterColor:a,setHighlighterColor:l,annotationStrokes:x,currentStroke:c,laserPosition:u,toolbarVisible:h,setToolbarVisible:f,handlePointerDown:T,handlePointerMove:M,handlePointerUp:_,handleLaserMove:E,handleLaserLeave:R,clearAnnotations:L,eraseAtPoint:I,allSlideAnnotations:N(),hasAnyAnnotations:D,clearAllAnnotations:k}}bt();function WQe(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(!ze(a))continue;(a.textSegments??[]).forEach((c,d)=>{let u=n?c.text:(c.text||"").toLowerCase(),p=0;for(;p<u.length;){let h=u.indexOf(o,p);if(h===-1)break;r.push({slideIndex:s,elementId:a.id,segmentIndex:d,startOffset:h,length:e.length}),p=h+1;}});}}),r}function XQe(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 d=l.elements[c];if(!ze(d))continue;let u=[...d.textSegments??[]],p=u[a.segmentIndex];if(!p)continue;let h=p.text.slice(0,a.startOffset),f=p.text.slice(a.startOffset+a.length);u[a.segmentIndex]={...p,text:h+n+f};let m=[...l.elements];m[c]={...d,text:u.map(x=>x.text).join(""),textSegments:u},r[a.slideIndex]={...l,elements:m};}}return r}function Cz({slides:t,mode:e,onSetActiveSlideIndex:n,onSetSelectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState(false),[l,c]=useState(""),[d,u]=useState(""),[p,h]=useState(false),[f,m]=useState([]),[x,g]=useState(-1),y=useCallback(()=>{let C=WQe(t,l,p);if(!l){m([]),g(-1);return}m(C),g(C.length>0?0:-1),C.length>0&&(n(C[0].slideIndex),r(C[0].elementId));},[t,l,p,n,r]),b=useCallback(C=>{if(f.length===0)return;let T=(x+C+f.length)%f.length;g(T);let M=f[T];M&&(n(M.slideIndex),r(M.elementId));},[f,x,n,r]),v=useCallback(C=>{C.length!==0&&(o(T=>XQe(T,C,d)),i());},[d,o,i]),S=useCallback(()=>{f.length===0||x<0||(v([f[x]]),setTimeout(y,0));},[f,x,v,y]),w=useCallback(()=>{f.length!==0&&(v(f),setTimeout(y,0));},[f,v,y]);return useEffect(()=>{let C=T=>{if((T.metaKey||T.ctrlKey)&&T.key==="f"){if(e!=="edit")return;T.preventDefault(),a(M=>!M);}};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e]),{findReplaceOpen:s,setFindReplaceOpen:a,findQuery:l,setFindQuery:c,replaceQuery:d,setReplaceQuery:u,findMatchCase:p,setFindMatchCase:h,findResults:f,findResultIndex:x,performFind:y,navigateFindResult:b,handleReplace:S,handleReplaceAll:w}}function pi(t,e=120){let[n,r]=useState(0),o=useRef(null),i=useCallback(l=>{l.pointerType!=="mouse"&&(l.target.closest('button, a, input, select, textarea, [role="button"]')||(o.current=l.clientY,l.target.setPointerCapture?.(l.pointerId)));},[]),s=useCallback(l=>{o.current!==null&&r(Math.max(0,l.clientY-o.current));},[]),a=useCallback(l=>{if(o.current===null)return;let c=l.clientY-o.current;o.current=null,l.target.releasePointerCapture?.(l.pointerId),c>e&&t(),r(0);},[t,e]);return {panelStyle:n>0?{transform:`translateY(${n}px)`,transition:"none"}:{transition:"transform 150ms ease-out"},handlers:{onPointerDown:i,onPointerMove:s,onPointerUp:a,onPointerCancel:a}}}function _z(){return `comment-${crypto.randomUUID()}`}function Pde(t,e,n){return t.map((r,o)=>o===e?{...r,comments:[...r.comments||[],n]}:r)}function Ede(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 d=c.id!==n;return d||(r=true),d});return l.length===a.length?i:{...i,comments:l}}),didDelete:r}}function Ade(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 Rde(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 kde(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 Pz({slides:t,canEdit:e,userName:n="You",selectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState({}),[l,c]=useState({}),[d,u]=useState({}),[p,h]=useState({}),[f,m]=useState(null),x=useCallback((R,I)=>{a(L=>({...L,[R]:I}));},[]),g=useCallback((R,I)=>{u(L=>({...L,[R]:I}));},[]),y=useCallback(R=>{if(!e)return;let I=t[R];if(!I)return;let L=String(s[I.id]||"").trim();if(L.length===0)return;let k={id:_z(),text:L,author:n,createdAt:new Date().toISOString(),elementId:r??void 0};o(F=>Pde(F,R,k)),a(F=>({...F,[I.id]:""})),i();},[e,s,i,o,r,t,n]),b=useCallback((R,I)=>{if(!e)return;let L=t[R];if(!L)return;let k=false;o(F=>{let N=Ede(F,R,I);return k=N.didDelete,N.slides}),k&&(c(F=>({...F,[L.id]:null})),i());},[e,i,o,t]),v=useCallback((R,I)=>{let L=t.find(F=>F.id===R);if(!L)return;let k=(L.comments||[]).find(F=>F.id===I);k&&(c(F=>({...F,[R]:I})),u(F=>({...F,[I]:k.text||""})));},[t]),S=useCallback(R=>{c(I=>({...I,[R]:null}));},[]),w=useCallback((R,I)=>{if(!e)return;let L=t[R];if(!L)return;let k=String(d[I]||"").trim();if(k.length===0)return;let F=false;o(N=>{let D=Ade(N,R,I,k);return F=D.didUpdate,D.slides}),F&&(c(N=>({...N,[L.id]:null})),i());},[e,d,i,o,t]),C=useCallback((R,I)=>{if(!e||!t[R])return;let k=false;o(F=>{let N=Rde(F,R,I);return k=N.didUpdate,N.slides}),k&&i();},[e,i,o,t]),T=useCallback((R,I)=>{m(I),h(L=>({...L,[I]:""}));},[]),M=useCallback(()=>{m(null);},[]),_=useCallback((R,I)=>{h(L=>({...L,[R]:I}));},[]),E=useCallback((R,I)=>{if(!e)return;let L=t[R];if(!L)return;let k=(L.comments||[]).find(D=>D.id===I);if(!k)return;let F=String(p[I]||"").trim();if(F.length===0)return;let N={id:_z(),text:F,author:n,createdAt:new Date().toISOString(),threadId:I,elementId:k.elementId};o(D=>D.map((U,G)=>{if(G!==R)return U;let j=(U.comments||[]).map(Y=>Y.id!==I?Y:{...Y,replies:[...Y.replies||[],N]});return {...U,comments:j}})),m(null),h(D=>{let U={...D};return delete U[I],U}),i();},[e,i,o,p,t,n]);return useEffect(()=>{let R=new Set(t.map(I=>I.id));a(I=>kde(I,R)??I);},[t]),{commentDraftBySlideId:s,editingCommentIdBySlideId:l,commentEditDraftByCommentId:d,replyingToCommentId:f,replyDraftByCommentId:p,handleCommentDraftChange:x,handleAddSlideComment:y,handleDeleteSlideComment:b,handleStartCommentEdit:v,handleCancelCommentEdit:S,handleSaveCommentEdit:w,handleSetCommentEditDraft:g,handleToggleCommentResolved:C,handleStartReply:T,handleCancelReply:M,handleReplyDraftChange:_,handleSubmitReply:E}}function qQe(t,e){let n=new Map;for(let r of t)n.set(r.id,r);for(let r of e)n.set(r.id,r);return n}function ZQe(t,e){return e.length>0?e:t?[t]:[]}function JQe(t,e){if(!(e===null||!t?.layouts))return t.layouts[e]}function QQe(t,e){return e?e.elements??[]:t?t.elements??[]:[]}function Ide(t){let{slides:e,activeSlideIndex:n,templateElementsBySlideId:r,selectedElementId:o,selectedElementIds:i,slideMasters:s,activeMasterIndex:a,activeLayoutIndex:l,notesMaster:c,handoutMaster:d}=t,u=e[n],p=useMemo(()=>u?r[u.id]??[]:[],[u,r]),h=useMemo(()=>qQe(p,u?.elements??[]),[u,p]),f=useMemo(()=>o?h.get(o)??null:null,[h,o]),m=useMemo(()=>ZQe(o,i),[o,i]),x=useMemo(()=>new Set(m),[m]),g=useMemo(()=>m.map(C=>h.get(C)).filter(Boolean),[m,h]),y=s[a],b=useMemo(()=>JQe(y,l),[y,l]),v=useMemo(()=>QQe(y,b),[y,b]),S=useMemo(()=>c?.elements??[],[c]),w=useMemo(()=>d?.elements??[],[d]);return {activeSlide:u,templateElements:p,elementLookup:h,selectedElement:f,effectiveSelectedIds:m,selectedElementIdSet:x,selectedElements:g,activeMaster:y,activeLayout:b,masterViewElements:v,notesMasterElements:S,handoutMasterElements:w}}function Rz(t){let e=useRef(null),n=useRef(null),r=useRef(null),o=useRef(0),i=useRef(null),s=useRef(null),a=useRef(null),l=useRef(null),c=useRef(false),[d,u]=useState("edit"),[p,h]=useState(true),[f,m]=useState(null),[x,g]=useState([]),[y,b]=useState({}),[v,S]=useState({width:1280,height:720}),[w,C]=useState(0),[T,M]=useState(null),[_,E]=useState([]),[R,I]=useState(false),L=useRef(null),k=useRef(""),[F,N]=useState(null),[D,U]=useState(""),G=useCallback(vs=>{let rp=typeof vs=="function"?vs(L.current):vs;L.current=rp,N(vs);},[]),j=useCallback(vs=>{let rp=typeof vs=="function"?vs(k.current):vs;k.current=rp,U(vs);},[]),[Y,ge]=useState(false),[fe,de]=useState("rect"),[J,re]=useState(null),[ce,ae]=useState(0),[_e,xe]=useState({}),[Ee,W]=useState([]),[q,Q]=useState([]),[se,me]=useState(),[P,A]=useState(),[O,z]=useState([]),[te,$]=useState([]),[Me,De]=useState(null),[V,B]=useState([]),[ee,oe]=useState({}),[pe,Ae]=useState(),[Le,ue]=useState(),[we,Ie]=useState(),[He,Oe]=useState([]),[$e,ot]=useState([]),[at,gt]=useState(),[le,Ue]=useState(),[Te,Ve]=useState([]),[Fe,ke]=useState(false),[nt,st]=useState(false),[Xn,Cn]=useState(0),[Zi,bs]=useState(0),[m0,Pv]=useState(null),[g0,sf]=useState("edit"),[Ev,x0]=useState("slides"),[y0,pl]=useState(4),af=Ide({slides:x,activeSlideIndex:w,templateElementsBySlideId:y,selectedElementId:T,selectedElementIds:_,slideMasters:q,activeMasterIndex:Zi,activeLayoutIndex:m0,notesMaster:pe,handoutMaster:Le});return {containerRef:e,imageInputRef:n,mediaInputRef:r,activeSlideIndexRef:o,inlineEditingElementIdRef:L,inlineEditingTextRef:k,dragStateRef:i,resizeStateRef:s,shapeAdjustmentDragStateRef:a,marqueeStateRef:l,isDrawingRef:c,mode:d,setMode:u,loading:p,setLoading:h,error:f,setError:m,slides:x,setSlides:g,templateElementsBySlideId:y,setTemplateElementsBySlideId:b,canvasSize:v,setCanvasSize:S,activeSlideIndex:w,setActiveSlideIndex:C,selectedElementId:T,setSelectedElementId:M,selectedElementIds:_,setSelectedElementIds:E,isDirty:R,setIsDirty:I,inlineEditingElementId:F,setInlineEditingElementId:G,inlineEditingText:D,setInlineEditingText:j,editTemplateMode:Y,setEditTemplateMode:ge,newShapeType:fe,setNewShapeType:de,clipboardPayload:J,setClipboardPayload:re,pointerCommitNonce:ce,setPointerCommitNonce:ae,headerFooter:_e,setHeaderFooter:xe,layoutOptions:Ee,setLayoutOptions:W,slideMasters:q,setSlideMasters:Q,theme:se,setTheme:me,tableStyleMap:P,setTableStyleMap:A,themeOptions:O,setThemeOptions:z,customShows:te,setCustomShows:$,activeCustomShowId:Me,setActiveCustomShowId:De,sections:V,setSections:B,presentationProperties:ee,setPresentationProperties:oe,notesMaster:pe,setNotesMaster:Ae,handoutMaster:Le,setHandoutMaster:ue,notesCanvasSize:we,setNotesCanvasSize:Ie,customProperties:He,setCustomProperties:Oe,tagCollections:$e,setTagCollections:ot,coreProperties:at,setCoreProperties:gt,appProperties:le,setAppProperties:Ue,embeddedFonts:Te,setEmbeddedFonts:Ve,hasMacros:Fe,setHasMacros:ke,hasDigitalSignatures:nt,setHasDigitalSignatures:st,digitalSignatureCount:Xn,setDigitalSignatureCount:Cn,activeMasterIndex:Zi,setActiveMasterIndex:bs,activeLayoutIndex:m0,setActiveLayoutIndex:Pv,preMasterMode:g0,setPreMasterMode:sf,masterViewTab:Ev,setMasterViewTab:x0,handoutSlidesPerPage:y0,setHandoutSlidesPerPage:pl,...af}}function kz(){let[t,e]=useState(false),[n,r]=useState("home"),[o,i]=useState(()=>typeof window>"u"?true:window.innerWidth>=768),[s,a]=useState(false),[l,c]=useState(true),[d,u]=useState(false),[p,h]=useState(false),[f,m]=useState("properties"),[x,g]=useState(false),[y,b]=useState(false),[v,S]=useState(false),[w,C]=useState([]),[T,M]=useState(null),[_,E]=useState(null),[R,I]=useState(true),[L,k]=useState(false),[F,N]=useState(false),[D,U]=useState(true),[G,j]=useState(true),[Y,ge]=useState([]),[fe,de]=useState(null),[J,re]=useState([]),[ce,ae]=useState(new Map),[_e,xe]=useState("select"),[Ee,W]=useState("#000000"),[q,Q]=useState(3),[se,me]=useState(false),[P,A]=useState(false),[O,z]=useState(false),[te,$]=useState(false),[Me,De]=useState(false);return {isCompactToolbarOpen:t,setIsCompactToolbarOpen:e,toolbarSection:n,setToolbarSection:r,isSlidesPaneOpen:o,setIsSlidesPaneOpen:i,isInspectorPaneOpen:s,setIsInspectorPaneOpen:a,isSlideNotesCollapsed:l,setIsSlideNotesCollapsed:c,isOverflowMenuOpen:d,setIsOverflowMenuOpen:u,isSidebarCollapsed:p,setIsSidebarCollapsed:h,sidebarPanelMode:f,setSidebarPanelMode:m,showSlideSorter:x,setShowSlideSorter:g,isShortcutHelpOpen:y,setIsShortcutHelpOpen:b,isAccessibilityPanelOpen:v,setIsAccessibilityPanelOpen:S,accessibilityIssues:w,setAccessibilityIssues:C,contextMenuState:T,setContextMenuState:M,tableEditorState:_,setTableEditorState:E,spellCheckEnabled:R,setSpellCheckEnabled:I,showGrid:L,setShowGrid:k,showRulers:F,setShowRulers:N,snapToGrid:D,setSnapToGrid:U,snapToShape:G,setSnapToShape:j,guides:Y,setGuides:ge,marqueeSelectionState:fe,setMarqueeSelectionState:de,snapLines:J,setSnapLines:re,mediaDataUrls:ce,setMediaDataUrls:ae,activeTool:_e,setActiveTool:xe,drawingColor:Ee,setDrawingColor:W,drawingWidth:q,setDrawingWidth:Q,isThemeEditorOpen:se,setIsThemeEditorOpen:me,isThemeGalleryOpen:P,setIsThemeGalleryOpen:A,formatPainterActive:O,setFormatPainterActive:z,isSelectionPaneOpen:te,setIsSelectionPaneOpen:$,eyedropperActive:Me,setEyedropperActive:De}}function Iz(t){let e=Rz(),n=kz();return {...e,...n}}bt();Pe();function Lz({content:t,clearSelection:e,history:n,setSlides:r,setTemplateElementsBySlideId:o,mediaDataUrls:i,setCanvasSize:s,setHeaderFooter:a,setLayoutOptions:l,setSlideMasters:c,setTheme:d,setTableStyleMap:u,setThemeOptions:p,setCustomShows:h,setSections:f,setPresentationProperties:m,setNotesMaster:x,setHandoutMaster:g,setNotesCanvasSize:y,setCustomProperties:b,setTagCollections:v,setCoreProperties:S,setAppProperties:w,setEmbeddedFonts:C,setActiveSlideIndex:T,setHasMacros:M,setHasDigitalSignatures:_,setDigitalSignatureCount:E,setGuides:R,setLoading:I,setError:L,setIsDirty:k,setIsEncrypted:F}){let N=useRef(null),D=useRef(null),U=useRef(0);return useEffect(()=>{if(!t)return;let G=false,j=++U.current,Y=[];return (async()=>{try{I(!0),L(null);let ge=t instanceof Uint8Array?t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength):t;D.current=ge instanceof ArrayBuffer?ge:null;let fe=ge instanceof ArrayBuffer?ge.byteLength/(1024*1024):0;fe>50&&console.warn(`[pptx] Large file detected (${fe.toFixed(1)} MB). Loading may use significant memory.`);let de=N.current,J=new Nd,re=await J.load(ge);if(G||j!==U.current){J.dispose();return}de&&de.dispose(),N.current=null;let ce=[];for(let W of re.slides)xA(W.elements,ce);for(let W of i.values())W.startsWith("blob:")&&URL.revokeObjectURL(W);i.clear(),await Promise.all(ce.map(async W=>{let q=W.mediaPath;if(!q){W.mediaMissing=!0;return}try{if(W.mediaType==="audio"||W.mediaType==="video"){let se=await J.getMediaArrayBuffer(q);if(se){let me=W.mediaMimeType||"application/octet-stream",P=new Blob([se],{type:me}),A=URL.createObjectURL(P);Y.push(A),i.set(q,A);}else W.mediaMissing=!0;}else {let se=await J.getImageData(q);se?i.set(q,se):W.mediaMissing=!0;}}catch{W.mediaMissing=!0;}}));let{paths:ae,refs:_e}=h4(re.slides),xe=re.slides;if(ae.size>0){let W=new Map;await Promise.all(Array.from(ae).map(async Q=>{try{let se=await J.getImageData(Q);se&&W.set(Q,se);}catch{}}));let q=new Map;for(let Q of _e){let se=W.get(Q.path);if(!se)continue;let me=Q.element.id,P=q.get(me)??{};P[Q.field]=se,q.set(me,P);}if(q.size>0){let Q=se=>{let me=!1,P=se.map(A=>{let O=A,z=q.get(A.id);if(z&&(O={...A,...z}),O.type==="group"&&O.children?.length){let te=Q(O.children);te!==O.children&&(O={...O,children:te});}return O!==A&&(me=!0),O});return me?P:se};xe=re.slides.map(se=>{let me=Q(se.elements);return me===se.elements?se:{...se,elements:me}});}}N.current=J;let Ee=zre(xe);r(Ee.slides),o(Ee.templateElementsBySlideId),s({width:re.width??1280,height:re.height??720}),a(re.headerFooter??{}),l(re.layoutOptions??[]),c(re.slideMasters??[]),d(re.theme),u(re.tableStyleMap),p(re.themeOptions??[]),h(re.customShows??[]),f(re.sections??[]),m(re.presentationProperties??{}),x(re.notesMaster),g(re.handoutMaster),typeof re.notesWidthEmu=="number"&&typeof re.notesHeightEmu=="number"&&re.notesWidthEmu>0&&re.notesHeightEmu>0?y({width:Math.round(re.notesWidthEmu/9525),height:Math.round(re.notesHeightEmu/9525)}):y(void 0),b(re.customProperties??[]),v(re.tags??[]),S(re.coreProperties),w(re.appProperties),C(re.embeddedFonts??[]),M(re.hasMacros===!0),_(re.hasDigitalSignatures===!0),E(re.digitalSignatureCount??0),R(f4(re.presentationGuides,re.slides[0]?.guides)),T(0),e(),k(!1),n.resetHistory();}catch(ge){!G&&j===U.current&&(ge instanceof u_?F(true):L(ge instanceof Error?ge.message:String(ge)));}finally{!G&&j===U.current&&I(false);}})(),()=>{G=true;for(let ge of Y)URL.revokeObjectURL(ge);N.current&&(N.current.dispose(),N.current=null);}},[t]),{handlerRef:N}}Pe();function Lde(t){return Math.max(t,10)*1e3}function Dz(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),d=useRef(r),u=useRef(false);useEffect(()=>{l.current=e;},[e]),useEffect(()=>{c.current=n;},[n]),useEffect(()=>{d.current=r;},[r]);let p=useCallback(async()=>{if(c.current&&l.current&&!u.current){u.current=true,a({state:"saving"});try{let h=await d.current();if(!h){a({state:"idle"}),u.current=!1;return}await fre(c.current,h),a({state:"saved",timestamp:Date.now()});}catch(h){a({state:"error",message:h instanceof Error?h.message:"Autosave failed"});}finally{u.current=false;}}},[]);return useEffect(()=>{if(!i||!n)return;let h=Lde(o),f=setInterval(()=>{p();},h);return ()=>clearInterval(f)},[i,n,o,p]),{autosaveStatus:s,triggerAutosave:p}}bt();function Fz(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,selectedElementId:o,editTemplateMode:i,templateElements:s,history:a,setSlides:l,setTemplateElementsBySlideId:c,setSelectedElementId:d,setSelectedElementIds:u,setInlineEditingElementId:p,setContextMenuState:h}=t,f=useCallback((T,M=[])=>{d(T),u(M);},[d,u]),m=useCallback(()=>{f(null,[]),p(null),h(null);},[f,p,h]),x=useCallback((T,M)=>{if(lT(T)){let _=e?.id;_&&c(E=>({...E,[_]:(E[_]??[]).map(R=>R.id===T?{...R,...M}:R)}));}else l(_=>_.map((E,R)=>R!==n?E:{...E,elements:E.elements.map(I=>I.id===T?{...I,...M}:I)}));a.markDirty();},[e?.id,n,a,l,c]),g=useCallback(T=>{o&&x(o,T);},[o,x]),y=useCallback(T=>{!r||!Jt(r)||g({shapeStyle:{...r.shapeStyle,...T}});},[r,g]),b=useCallback(T=>{if(!r||!ze(r))return;let M=vU(r.textSegments);if(M&&r.textSegments){let{newSegments:R,newSelection:I}=SU(r.textSegments,M,T);yU(I),g({textSegments:R});return}let _={...r.textStyle,...T},E=r.textSegments?.map(R=>({...R,style:{...R.style,...T}}));g({textStyle:_,textSegments:E});},[r,g]),v=useCallback(T=>{l(M=>T(M));},[l]),S=i?s:e?.elements??[],w=useCallback(T=>{if(i){let M=e?.id;if(!M)return;c(_=>({..._,[M]:T(_[M]??[])}));}else l(M=>M.map((_,E)=>E===n?{..._,elements:T(_.elements)}:_));},[i,e?.id,n,l,c]),C=useCallback(async()=>null,[]);return {applySelection:f,clearSelection:m,updateElementById:x,updateSelectedElement:g,updateSelectedShapeStyle:y,updateSelectedTextStyle:b,updateSlides:v,activeElements:S,updateActiveElements:w,serializeSlides:C}}Pe();function Oz(t){let{sections:e,setSections:n,slides:r,setSlides:o,markDirty:i}=t,s=useCallback((p,h)=>{let f=Ate(e,r,p,h);o(f.slides),n(f.sections),i();},[e,r,o,n,i]),a=useCallback((p,h)=>{let f=Rte(e,r,p,h);n(f.sections),o(f.slides),i();},[e,r,n,o,i]),l=useCallback(p=>{let h=kte(e,r,p);n(h.sections),o(h.slides),i();},[e,r,n,o,i]),c=useCallback(p=>{n(Ite(e,p)),i();},[e,n,i]),d=useCallback(p=>{n(Nte(e,p)),i();},[e,n,i]),u=useCallback((p,h)=>{let f=Lte(e,r,p,h);o(f.slides),n(f.sections),i();},[e,r,o,n,i]);return {addSection:s,renameSection:a,deleteSection:l,moveSectionUp:c,moveSectionDown:d,moveSlidesToSection:u}}Pe();function oet(t,e,n,r,o,i,s,a,l){let c=bte({x:e,y:n,width:r,height:o},t,i,s,1,{minSize:12}),d={x:c.x,y:c.y,width:c.width,height:c.height};return a?vte(d,t,l,12):d}function iet(t,e,n){let o=e/(n||200);return Math.max(0,Math.min(1,t+o))}function Dde(t,e,n){let{editorScale:r,canvasStageRef:o,canvasSize:i,snapToGrid:s,snapToShape:a,gridSpacingPx:l,editTemplateMode:c,templateElements:d,activeSlide:u,guides:p,elementLookup:h,marqueeStateRef:f,dragStateRef:m,resizeStateRef:x,shapeAdjustmentDragStateRef:g,setMarqueeSelectionState:y,setSnapLines:b,updateElementById:v}=e,S=f.current;if(S){set(t,S,o,i,r,y);return}let w=m.current;if(w){aet(t,w,r,s,a,l,c,d,u,p,h,n,b);return}let C=x.current;if(C){cet(t,C,r,s,l);return}let T=g.current;T&&det(t,T,r,v);}function set(t,e,n,r,o,i){let s=n.current;if(!s)return;let a=s.getBoundingClientRect();e.currentX=Math.max(0,Math.min(r.width,(t.clientX-a.left)/o)),e.currentY=Math.max(0,Math.min(r.height,(t.clientY-a.top)/o)),i({...e});}function aet(t,e,n,r,o,i,s,a,l,c,d,u,p){let h=(t.clientX-e.startClientX)/n,f=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(h)>2||Math.abs(f)>2)&&(e.moved=true),!e.moved)return;let m=h,x=f,g=Object.keys(e.startPositionsById),y=g[0],b=y?e.startPositionsById[y]:void 0,v=y?d.get(y):void 0;if(b&&v){let S=b.x+m,w=b.y+x;if(r&&(S=Math.round(S/i)*i,w=Math.round(w/i)*i),o){let T=(s?a:l?.elements??[]).map(R=>({id:R.id,x:R.x,y:R.y,width:R.width,height:R.height})),M=lU(S,w,v.width,v.height,T,new Set(g),c.map(R=>({axis:R.axis,position:R.position})));S=M.x,w=M.y;let _=M.lines.map(R=>({axis:R.axis==="v"?"x":"y",position:R.position})),E=JSON.stringify(_);E!==u.lastSnapLinesKey&&(u.lastSnapLinesKey=E,p(_));}else u.lastSnapLinesKey!=="[]"&&(u.lastSnapLinesKey="[]",p([]));m=S-b.x,x=w-b.y;}e.lastDx=m,e.lastDy=x;for(let[S,w]of e.domEls){let C=e.startPositionsById[S];C&&(w.style.left=`${C.x+m}px`,w.style.top=`${C.y+x}px`);}}function cet(t,e,n,r,o){let i=(t.clientX-e.startClientX)/n,s=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(i)>2||Math.abs(s)>2)&&(e.moved=true),!e.moved)return;let a=oet(e.handle,e.startX,e.startY,e.startWidth,e.startHeight,i,s,r,o);e.lastX=a.x,e.lastY=a.y,e.lastWidth=a.width,e.lastHeight=a.height,e.domEl&&(e.domEl.style.left=`${a.x}px`,e.domEl.style.top=`${a.y}px`,e.domEl.style.width=`${Math.max(a.width,12)}px`,e.domEl.style.height=`${Math.max(a.height,12)}px`);}function det(t,e,n,r){let o=(t.clientX-e.startClientX)/n,i=iet(e.startAdjustment,o,e.startWidth);!e.moved&&Math.abs(o)>2&&(e.moved=true),e.moved&&r(e.elementId,{shapeAdjustments:{[e.key]:i}});}Pe();function Fde(t){let{editTemplateMode:e,templateElements:n,activeSlide:r,activeSlideIndex:o,marqueeStateRef:i,dragStateRef:s,resizeStateRef:a,shapeAdjustmentDragStateRef:l,setMarqueeSelectionState:c,setSnapLines:d,setTemplateElementsBySlideId:u,setPointerCommitNonce:p,applySelection:h,clearSelection:f,updateSlides:m,updateElementById:x,markDirty:g}=t,y=i.current,b=s.current,v=a.current,S=l.current;if(y&&(uet(y,e,n,r,h,f),i.current=null,c(null)),b?.moved&&pet(b,e,r,o,u,m),v?.moved){let C=v.elementId,T={x:v.lastX,y:v.lastY,width:v.lastWidth,height:v.lastHeight};x(C,T);let M=new Set([C]);m(_=>_.map((E,R)=>{if(R!==o)return E;let I=jA(E.elements,M);return I.length===0?E:{...E,elements:YA(E.elements,I)}}));}let w=b?.moved||v?.moved||S?.moved;i.current=null,s.current=null,a.current=null,l.current=null,c(null),d([]),w&&(g(),p(C=>C+1));}function uet(t,e,n,r,o,i){let s=e?n:r?.elements??[],a=Ste(t,s);if(t.additive){let l=wte(t.baseSelectionIds,a);l.length>0?o(l[0],l):i();}else a.length>0?o(a[0],a):i();}function pet(t,e,n,r,o,i){let s=t.lastDx,a=t.lastDy,l=new Set(Object.keys(t.startPositionsById)),c=d=>{let u=d.map(h=>{let f=t.startPositionsById[h.id];return f?{...h,x:f.x+s,y:f.y+a}:h}),p=jA(u,l);return YA(u,p)};if(e){let d=n?.id;if(!d)return;o(u=>({...u,[d]:c(u[d]??[])}));return}i(d=>d.map((u,p)=>p!==r?u:{...u,elements:c(u.elements)}));}function Bz(t){let{editorScale:e,canvasStageRef:n,canvasSize:r,activeSlide:o,activeSlideIndex:i,gridSpacingPx:s,dragStateRef:a,resizeStateRef:l,shapeAdjustmentDragStateRef:c,marqueeStateRef:d,editTemplateMode:u,snapToGrid:p,snapToShape:h,guides:f,templateElements:m,elementLookup:x,setMarqueeSelectionState:g,setSnapLines:y,setTemplateElementsBySlideId:b,setPointerCommitNonce:v,applySelection:S,clearSelection:w,updateSlides:C,updateElementById:T,markDirty:M}=t;useEffect(()=>{let _={rafId:0,pendingMoveEvent:null,lastSnapLinesKey:""},E=I=>{_.pendingMoveEvent=I,_.rafId===0&&(_.rafId=requestAnimationFrame(()=>{_.rafId=0,_.pendingMoveEvent&&(Dde(_.pendingMoveEvent,t,_),_.pendingMoveEvent=null);}));},R=()=>{_.rafId!==0&&(cancelAnimationFrame(_.rafId),_.rafId=0,_.pendingMoveEvent=null),Fde(t);};return document.addEventListener("pointermove",E),document.addEventListener("pointerup",R),()=>{document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",R),_.rafId!==0&&cancelAnimationFrame(_.rafId);}},[e,n,a,l,c,d,u,p,h,f,m,g,y,x,b,v,o,i,r.width,r.height,s,S,w,C,T,M,t]);}bt();Pe();function Uz(t){let{mode:e,canEdit:n,canvasSize:r,selectedElementId:o,selectedElementIds:i,selectedElementIdSet:s,inlineEditingElementId:a,effectiveSelectedIds:l,elementLookup:c,activeTool:d,editorScale:u,canvasStageRef:p,dragStateRef:h,resizeStateRef:f,shapeAdjustmentDragStateRef:m,marqueeStateRef:x,setInlineEditingElementId:g,setInlineEditingText:y,setContextMenuState:b,setMarqueeSelectionState:v,setSnapLines:S,inlineEditingText:w,ops:C,history:T,presentationHandleAction:M,setEditingEquationOmml:_,setIsEquationDialogOpen:E}=t,R=useRef(false),I=()=>{let de=a;if(!de)return;let J=c.get(de);if(J&&ze(J)){let re=mT(w,J.textSegments,J.textStyle);C.updateElementById(de,{text:w,textSegments:re}),T.markDirty();}g(null),y("");},L=de=>{if(!ze(de))return false;let J=de.textSegments?.find(re=>re.equationXml);return J?.equationXml?(_(J.equationXml),E(true),true):false};return {handleElementClick:(de,J)=>{if(J.stopPropagation(),e==="present"){let re=c.get(de);re?.actionClick&&M(re.actionClick);return}if(J.shiftKey||J.metaKey){let re=i.length?i:o?[o]:[],ce=re.includes(de)?re.filter(ae=>ae!==de):[...re,de];C.applySelection(ce[0]??null,ce);}else if(s.has(de)&&!a)if(R.current)R.current=false;else {let re=c.get(de);re&&ze(re)&&!re.locks?.noTextEdit&&(L(re)||(g(de),y(re.text??"")));}else C.applySelection(de);},handleElementDoubleClick:(de,J)=>{let re=c.get(de);re&&(L(re)||ze(re)&&(g(de),y(re.text??"")));},handleElementMouseDown:(de,J)=>{if(J.button!==0)return;a&&a!==de&&I();let re=s.has(de);re?R.current=false:(C.applySelection(de),R.current=true);let ce=re?l.length?l:[de]:[de],ae={},_e=new Map;for(let xe of ce){let Ee=c.get(xe);Ee&&(ae[xe]={x:Ee.x,y:Ee.y});let W=document.querySelector(`[data-element-id="${xe}"]`);W&&_e.set(xe,W);}h.current={elementId:de,startClientX:J.clientX,startClientY:J.clientY,startPositionsById:ae,domEls:_e,moved:false,lastDx:0,lastDy:0},S([]);},handleElementContextMenu:(de,J)=>{J.preventDefault(),J.stopPropagation(),s.has(de)||C.applySelection(de),b({x:J.clientX,y:J.clientY,elementId:de});},handleCanvasMouseDown:de=>{if(e!=="edit"||!n||de.button!==0||d!=="select")return;a&&I();let J=p.current;if(!J)return;let re=J.getBoundingClientRect(),ce=u||1,ae=Math.max(0,Math.min(r.width,(de.clientX-re.left)/ce)),_e=Math.max(0,Math.min(r.height,(de.clientY-re.top)/ce)),xe=de.shiftKey||de.metaKey,Ee={startX:ae,startY:_e,currentX:ae,currentY:_e,additive:xe,baseSelectionIds:xe?l:[]};x.current=Ee,v(Ee),b(null);},handleResizePointerDown:(de,J,re)=>{J.stopPropagation();let ce=c.get(de);ce&&(f.current={elementId:de,startClientX:J.clientX,startClientY:J.clientY,startX:ce.x,startY:ce.y,startWidth:ce.width,startHeight:ce.height,handle:re,moved:false,domEl:document.querySelector(`[data-element-id="${de}"]`),lastX:ce.x,lastY:ce.y,lastWidth:ce.width,lastHeight:ce.height});},handleAdjustmentPointerDown:(de,J)=>{J.stopPropagation();let re=c.get(de);if(!re||!("shapeType"in re)||!("shapeAdjustments"in re))return;let ce=Object.entries(re.shapeAdjustments??{});if(!ce.length)return;let[ae,_e]=ce[0];m.current={elementId:de,key:ae,shapeType:re.shapeType??"rect",startClientX:J.clientX,startClientY:J.clientY,startAdjustment:_e,startWidth:re.width,startHeight:re.height,moved:false};},handleRotate:(de,J)=>{let re=c.get(de);!re||re.locks?.noRotation||(C.updateElementById(de,{rotation:J}),T.markDirty());},handleUpdateSmartArtElement:(de,J)=>{c.has(de)&&C.updateElementById(de,J);},handleFormatText:de=>{C.updateSelectedTextStyle(de);},handleInlineEditCommit:I}}Pe();function Ode(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 d=new Image;d.onload=()=>{let h=d.naturalWidth||400,f=d.naturalHeight||300;if(h>500||f>400){let m=Math.min(500/h,400/f);h=Math.round(h*m),f=Math.round(f*m);}r({id:Pr(),type:"image",x:Math.round((n.width-h)/2),y:Math.round((n.height-f)/2),width:h,height:f,imageData:c});},d.onerror=()=>{r({id:Pr(),type:"image",x:100,y:100,width:400,height:300,imageData:c});},d.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,d=(p,h,f)=>{r({id:Pr(),type:"media",mediaType:l,mediaMimeType:a.type||void 0,mediaData:p,x:Math.round((n.width-h)/2),y:Math.round((n.height-f)/2),width:h,height:f});};if(c){let p=c.replace(/\\/gu,"/");p.startsWith("/")||(p=`/${p}`);let h=`pptx-resource://media${encodeURI(p)}`;if(l==="audio"){d(h,420,64);return}let f=URL.createObjectURL(a),m=document.createElement("video");m.preload="metadata",m.onloadedmetadata=()=>{URL.revokeObjectURL(f);let x=640,g=360,y=m.videoWidth||x,b=m.videoHeight||g;if(y>x||b>g){let v=Math.min(x/y,g/b);y=Math.round(y*v),b=Math.round(b*v);}d(h,y,b);},m.onerror=()=>{URL.revokeObjectURL(f),d(h,640,360);},m.src=f;return}let u=new FileReader;u.onload=()=>{let p=u.result;if(!p)return;if(l==="audio"){d(p,420,64);return}let h=document.createElement("video");h.preload="metadata",h.onloadedmetadata=()=>{let x=h.videoWidth||640,g=h.videoHeight||360;if(x>640||g>360){let y=Math.min(640/x,360/g);x=Math.round(x*y),g=Math.round(g*y);}d(p,x,g);},h.onerror=()=>{d(p,640,360);},h.src=p;},u.readAsDataURL(a);}}}bt();var cN={"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"},Bde={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 Ude(t,e){return e&&e.startsWith("ppaction://")?e.includes("hlinksldjump")?"slide":(cN[e.toLowerCase()],"action"):t?t.startsWith("mailto:")?"email":/^[a-zA-Z]:\\|^\.\.?[/\\]|^file:/i.test(t)?"file":"url":"url"}function $de(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 Hde(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 zde(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:Bde[t.actionVerb],tooltip:e};default:return {url:t.url,tooltip:e}}}function Vde(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,ops:o,history:i,addElement:s}=t;return {handleInsertSmartArt:(h,f)=>{if(!e)return;let m=f.map((g,y)=>`node-${Date.now()}-${y}-${Math.random().toString(36).slice(2,8)}`),x=f.map((g,y)=>{let b={id:m[y],text:g};return h==="hierarchy"&&y>0&&(b.parentId=m[0]),b});s({id:Pr(),type:"smartArt",x:100,y:120,width:600,height:340,smartArtData:{layout:h,colorScheme:"colorful1",style:"flat",nodes:x}});},handleInsertEquation:h=>{e&&s({id:Pr(),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:h}]});},handleUpdateEquation:h=>{let f=r[0];if(!f)return;let m=[{text:"[Equation]",style:{fontSize:18,fontFamily:"Cambria Math"},equationXml:h}];o.updateElementById(f.id,{textSegments:m}),i.markDirty();},handleHyperlinkConfirm:h=>{let f=r[0];if(!f)return;let m=zde(h),x={url:m.url||void 0,action:m.action,tooltip:m.tooltip};o.updateElementById(f.id,{actionClick:x}),i.markDirty();},handleInsertField:(h,f)=>{if(!e)return;let m={slidenum:String(n+1),datetime:new Date().toLocaleDateString(),header:"Header",footer:"Footer"},x=f||m[h]||h,g=`{${crypto.randomUUID().toUpperCase()}}`;s({id:Pr(),type:"shape",x:120,y:200,width:200,height:40,text:x,textStyle:{fontSize:14},textSegments:[{text:x,style:{fontSize:14},fieldType:h,fieldGuid:g}]});},handleAddActionButton:h=>{if(!e)return;let f=sh.find(x=>x.shapeType===h);if(!f)return;let m=lS({type:f.defaultAction});m&&(m.tooltip=f.label,m.highlightClick=true),s({id:Pr(),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:m});}}}function Hz(t){let{activeSlide:e,activeSlideIndex:n,canvasSize:r,newShapeType:o,selectedElements:i,ops:s,history:a}=t,l=y=>{s.updateSlides(b=>b.map((v,S)=>S===n?{...v,elements:[...v.elements,y]}:v)),s.applySelection(y.id),a.markDirty();},c=()=>{e&&l({id:Pr(),type:"text",x:100,y:100,width:300,height:60,text:"",textStyle:{fontSize:24}});},d=()=>{e&&l({id:Pr(),type:"shape",x:150,y:150,width:200,height:150,shapeType:o,shapeStyle:{fillColor:"#3b82f6",strokeColor:"#1f2937",strokeWidth:2}});},u=()=>{if(!e)return;let y=Array.from({length:3},()=>({cells:Array.from({length:3},()=>({text:"",style:{}}))})),b=Array.from({length:3},()=>1/3);l({id:Pr(),type:"table",x:100,y:200,width:600,height:250,tableData:{rows:y,columnWidths:b}});},p=y=>{e&&l(cre(y));},h=Vde({activeSlide:e,activeSlideIndex:n,selectedElements:i,ops:s,history:a,addElement:l}),f=Ode({activeSlide:e,canvasSize:r,addElement:l});return {handleAddTextBox:c,handleAddShape:d,handleAddTable:u,handleAddChart:p,...h,handleAddInkElement:y=>{e&&(s.updateSlides(b=>b.map((v,S)=>S===n?{...v,elements:[...v.elements,y]}:v)),a.markDirty());},handleAddFreeformShape:y=>{e&&l(y);},handleEraseInkElement:y=>{e&&(s.updateSlides(b=>b.map((v,S)=>S===n?{...v,elements:v.elements.filter(w=>w.id!==y)}:v)),a.markDirty());},...f}}function Gde(t){let{activeSlide:e,selectedElement:n,effectiveSelectedIds:r,editTemplateMode:o,clipboardPayload:i,setClipboardPayload:s,ops:a,history:l}=t,c=()=>{n&&s({element:structuredClone(n),isTemplate:o});},d=()=>{let f=r;if(!f.length||!e)return;let m=new Set(f);a.updateActiveElements(x=>x.filter(g=>!m.has(g.id))),a.clearSelection(),l.markDirty();};return {handleCopy:c,handleCut:()=>{c(),d();},handlePaste:()=>{if(!i||!e)return;let f=structuredClone(i.element);f.id=ET(o,i.element.id),f.x+=20,f.y+=20,a.updateActiveElements(m=>[...m,f]),a.applySelection(f.id),l.markDirty();},handleDuplicate:()=>{if(!n||!e)return;let f=structuredClone(n);f.id=ET(o,n.id),f.x+=20,f.y+=20,a.updateActiveElements(m=>[...m,f]),a.applySelection(f.id),l.markDirty();},handleDelete:d}}Pe();bt();function get(t){return t.type==="shape"||t.type==="image"||t.type==="picture"}function xet(t){if("pathData"in t&&typeof t.pathData=="string"&&t.pathData)return t.pathData;if("shapeType"in t&&typeof t.shapeType=="string"){let e=xS(t.shapeType);if(e){let n=yet(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 yet(t,e,n){let r=t.match(/polygon\((?<points>[^)]+)\)/iu);if(!r?.groups)return null;let o=r.groups.points.split(",").map(a=>a.trim()),i=[];for(let a of o){let l=a.split(/\s+/u);if(l.length<2)continue;let c=l[0],d=l[1],u,p;c.endsWith("%")?u=parseFloat(c)/100*e:u=parseFloat(c),d.endsWith("%")?p=parseFloat(d)/100*n:p=parseFloat(d),!isNaN(u)&&!isNaN(p)&&i.push({x:u,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 bet(t,e){let n=ni(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 qs(a)}function Wde(t,e,n,r,o){let i=ni(t);if(i.length===0)return t;let s=i.map(a=>a.map(l=>({x:l.x-e,y:l.y-n})));return qs(s)}function Xde(t){let e=ni(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 jde(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,effectiveSelectedIds:o,setSelectedElementIds:i,ops:s,history:a}=t,l=r.filter(get),c=l.length>=2;return {handleMergeShapes:u=>{if(!c||!e)return;let p=l;if(p.length<2)return;let h=p.map(f=>{let m=xet(f);return bet(m,f)});if(u==="fragment"){let f=[],m=h[0];for(let y=1;y<h.length;y++){let b=R_("fragment",m,h[y]);Array.isArray(b)&&(f=b),y<h.length-1&&f.length>0&&(m=f[0]);}if(f.length===0)return;let x=new Set(o),g=[];for(let y of f){if(!y)continue;let b=Xde(y);if(b.width<=0||b.height<=0)continue;let v=Wde(y,b.x,b.y),S={id:Pr(),type:"shape",x:b.x,y:b.y,width:b.width,height:b.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:p[0].opacity??1,rawXml:{},shapeStyle:{...p[0].shapeStyle},shapeType:"custGeom",pathData:v,pathWidth:b.width,pathHeight:b.height};g.push(S);}if(g.length===0)return;s.updateSlides(y=>y.map((b,v)=>v===n?{...b,elements:[...b.elements.filter(S=>!x.has(S.id)),...g]}:b)),i(g.map(y=>y.id)),a.markDirty();}else {let f=h[0];for(let v=1;v<h.length;v++){let S=R_(u,f,h[v]);typeof S=="string"&&(f=S);}if(!f)return;let m=Xde(f);if(m.width<=0||m.height<=0)return;let x=Wde(f,m.x,m.y),g=p[0],y={id:Pr(),type:"shape",x:m.x,y:m.y,width:m.width,height:m.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:g.opacity??1,rawXml:{},shapeStyle:{...g.shapeStyle},shapeType:"custGeom",pathData:x,pathWidth:m.width,pathHeight:m.height},b=new Set(o);s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements.filter(C=>!b.has(C.id)),y]}:S)),s.applySelection(y.id),a.markDirty();}},canMergeShapes:c}}var vet={left:"left",center:"centerH",right:"right",top:"top",middle:"middle",bottom:"bottom"};function Yde(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,selectedElements:i,elementLookup:s,setSelectedElementIds:a,ops:l,history:c}=t,d=()=>{let v=o;if(v.length<2||!e)return;let{elements:S,groupId:w}=Tte(l.activeElements,v,Pr());w!==null&&(l.updateActiveElements(()=>S),l.applySelection(w),c.markDirty());},u=()=>{if(!r||r.type!=="group"||!e)return;let v=r,S=lT(v.id),w=v.children.map(C=>({...structuredClone(C),id:S?ET(true,C.id||v.id):C.id||Pr(),x:C.x+v.x,y:C.y+v.y}));l.updateActiveElements(C=>[...C.filter(T=>T.id!==v.id),...w]),a(w.map(C=>C.id)),c.markDirty();},p=v=>{if(!r)return;let S=v==="horizontal"?{flipHorizontal:!r.flipHorizontal}:{flipVertical:!r.flipVertical};l.updateSelectedElement(S),c.markDirty();},h=v=>{if(i.length<2)return;let S=vet[v];if(!S)return;let w=xte(i,S);for(let[C,T]of w){let M=s.get(C);M&&l.updateElementById(C,{x:T.x??M.x,y:T.y??M.y});}c.markDirty();},f=v=>{if(i.length<3)return;let S=v==="horizontal"||v==="vertical"?v:null;if(!S)return;let w=yte(i,S);for(let[C,T]of w){let M=s.get(C);M&&l.updateElementById(C,{x:T.x??M.x,y:T.y??M.y});}c.markDirty();},m=i.length>=3,x=v=>{if(!r||!e)return;let S=r.id;l.updateActiveElements(w=>v==="forward"?_te(w,S):v==="backward"?Pte(w,S):w),c.markDirty();},g=v=>{if(!r||!e)return;let S=r.id;l.updateActiveElements(w=>v==="front"?Cte(w,S):Mte(w,S)),c.markDirty();},{handleMergeShapes:y,canMergeShapes:b}=jde({activeSlide:e,activeSlideIndex:n,selectedElements:i,effectiveSelectedIds:o,setSelectedElementIds:a,ops:l,history:c});return {handleGroupElements:d,handleUngroupElement:u,handleFlip:p,handleAlignElements:h,handleDistributeElements:f,canDistribute:m,handleMoveLayer:x,handleMoveLayerToEdge:g,handleMergeShapes:y,canMergeShapes:b}}function zz(t){let{setIsInspectorPaneOpen:e,setSidebarPanelMode:n,onOpenHyperlinkDialog:r}=t,{handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleDelete:l}=Gde(t),{handleGroupElements:c,handleUngroupElement:d,handleFlip:u,handleAlignElements:p,handleDistributeElements:h,canDistribute:f,handleMoveLayer:m,handleMoveLayerToEdge:x,handleMergeShapes:g,canMergeShapes:y}=Yde(t);return {handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleGroupElements:c,handleUngroupElement:d,handleDelete:l,handleFlip:u,handleAlignElements:p,handleDistributeElements:h,canDistribute:f,handleMoveLayer:m,handleMoveLayerToEdge:x,handleMergeShapes:g,canMergeShapes:y,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":m("forward");break;case "send-backward":case "sendBackward":m("backward");break;case "bring-front":case "bringToFront":x("front");break;case "send-back":case "sendToBack":x("back");break;case "comment":case "addComment":e(true),n("comments");break;case "group":c();break;case "ungroup":d();break;case "editHyperlink":r();break}}}}Pe();function wet(t,e,n){let r=[...t],o=Math.max(0,Math.min(e+1,r.length));return r.splice(o,0,n),r}function Vz(t){let{slides:e,activeSlideIndex:n,setActiveSlideIndex:r,ops:o,history:i,handlerRef:s}=t;return {handleAddSlide:()=>{let f=aU(e.length+1);o.updateSlides(m=>{let x=[...m];return x.splice(n+1,0,f),x}),r(n+1),i.markDirty();},handleMoveSlide:(f,m)=>{f!==m&&(o.updateSlides(x=>{let g=[...x],[y]=g.splice(f,1);return g.splice(m,0,y),g}),r(m),i.markDirty());},handleSlideContextMenu:(f,m)=>{},handleDeleteSlides:f=>{if(f.length===0||e.length<=1)return;let m=[...f].sort((g,y)=>y-g);o.updateSlides(g=>{let y=[...g];for(let b of m)y.length>1&&y.splice(b,1);return y});let x=Math.min(...f);r(Math.min(x,e.length-f.length-1,Math.max(e.length-f.length-1,0))),i.markDirty();},handleDuplicateSlides:f=>{if(f.length===0)return;let m=[...f].sort((x,g)=>x-g);o.updateSlides(x=>{let g=[...x],y=0;for(let b of m){let v=g[b+y];if(!v)continue;let S={...v,id:sU(),elements:v.elements.map(w=>({...w,id:`${w.id}-dup-${Math.random().toString(36).slice(2,6)}`}))};g.splice(b+y+1,0,S),y++;}return g}),i.markDirty();},handleToggleHideSlides:f=>{f.length!==0&&(o.updateSlides(m=>{let x=[...m];for(let g of f){let y=x[g];y&&(x[g]={...y,hidden:!y.hidden});}return x}),i.markDirty());},handleInsertSlideFromLayout:(f,m)=>{let x=n+1,g={...aU(e.length+1),layoutPath:f,...m?{layoutName:m}:{}},y=[];o.updateSlides(v=>(y=wet(v,n,g),y)),r(x),i.markDirty();let b=s?.current;b&&b.applyLayoutToSlide(x,f,y).then(v=>{o.updateSlides(S=>{if(S[x]?.id!==g.id)return S;let w=[...S];return w[x]=v,w});},()=>{});}}}function Kde(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:d,columnIndex:u}=n,p=e.tableData,h=p.rows[d]?.cells[u];if(!h)return;let f=Math.max(1,h.gridSpan??1),m=u+f,x=p.rows[d]?.cells[m];if(!x||x.hMerge||x.vMerge)return;let g=Oy([{row:d,col:u},{row:d,col:m}],p),y={tableData:g},b=Sp(e,g);b&&(y.rawXml=b),o.updateSelectedElement(y),i.markDirty();},handleMergeCellDown:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,h=p.rows[d]?.cells[u];if(!h)return;let f=Math.max(1,h.rowSpan??1),m=d+f;if(m>=p.rows.length)return;let x=p.rows[m]?.cells[u];if(!x||x.hMerge||x.vMerge)return;let g=Oy([{row:d,col:u},{row:m,col:u}],p),y={tableData:g},b=Sp(e,g);b&&(y.rawXml=b),o.updateSelectedElement(y),i.markDirty();},handleMergeSelectedCells:()=>{if(!e||e.type!=="table"||!e.tableData||!n||!n.selectedCells||n.selectedCells.length<2)return;let d=e.tableData,u=Oy(n.selectedCells,d),p={tableData:u},h=Sp(e,u);h&&(p.rawXml=h),o.updateSelectedElement(p),r({rowIndex:n.rowIndex,columnIndex:n.columnIndex}),i.markDirty();},handleSplitCell:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,h=OA(d,u,p),f={tableData:h},m=Sp(e,h);m&&(f.rawXml=m),o.updateSelectedElement(f),i.markDirty();}}}Pe();function qde(t){let{selectedElement:e,tableEditorState:n,elementLookup:r,setTableEditorState:o,ops:i,history:s}=t;return {handleCommitCellEdit:(m,x,g,y)=>{let b=r.get(m);if(!b||b.type!=="table")return;let v={};if(b.tableData){let S=b.tableData.rows.map((w,C)=>C!==x?w:{...w,cells:w.cells.map((T,M)=>M!==g?T:{...T,text:y})});v.tableData={...b.tableData,rows:S};}if(b.rawXml){let S=hS(b,x,g,y);S&&(v.rawXml=S);}Object.keys(v).length!==0&&(i.updateElementById(m,v),s.markDirty(),o({rowIndex:x,columnIndex:g,elementId:m}));},handleUpdateCellTextStyle:m=>{if(!e||e.type!=="table"||!n)return;let x=e.id,{rowIndex:g,columnIndex:y}=n,b={};if(e.rawXml){let v=fS(e,g,y,m);v&&(b.rawXml=v);}if(e.tableData){let v=e.tableData.rows.map((S,w)=>w!==g?S:{...S,cells:S.cells.map((C,T)=>T!==y?C:{...C,style:{...C.style,...m}})});b.tableData={...e.tableData,rows:v};}Object.keys(b).length!==0&&(i.updateElementById(x,b),s.markDirty());},handleResizeTableColumns:(m,x)=>{let g=r.get(m);!g||g.type!=="table"||!g.tableData||(i.updateElementById(m,{tableData:{...g.tableData,columnWidths:x}}),s.markDirty());},handleResizeTableRow:(m,x,g)=>{let y=r.get(m);if(!y||y.type!=="table"||!y.tableData)return;let b=y.tableData.rows.map((v,S)=>S===x?{...v,height:g}:v);i.updateElementById(m,{tableData:{...y.tableData,rows:b}}),s.markDirty();},handleInsertTableRow:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=n?.rowIndex??0,g=rte(e.tableData,x,m),y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();},handleDeleteTableRow:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData,x=n?.rowIndex??0,g=ote(m,x);if(g===m)return;let y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();},handleInsertTableColumn:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=n?.columnIndex??0,g=ste(e.tableData,x,m),y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();},handleDeleteTableColumn:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData,x=n?.columnIndex??0,g=ate(m,x);if(g===m)return;let y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();}}}function Gz(t){let e=qde(t),n=Kde(t);return {...e,...n}}Pe();Pe();function f2(t){return t.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function Wz(t,e){try{return window.prompt(t,e)}catch{return null}}function Zde(t){try{return window.confirm(t)}catch{return false}}function dN(t,e){ru(t,gre(e));}Pe();Pe();async function Jde(t,e={}){let n=e.onclone;return Tet(t,{...e,onclone:async(r,o)=>{await Pre(r,o),TR(o),typeof n=="function"&&n(r,o);}})}async function Bu(t,e=2,n){return await Jde(t,{scale:e,useCORS:true,allowTaint:true,backgroundColor:n??null,logging:false,ignoreElements:o=>{let i=o;return !!(i.dataset?.exportIgnore==="true"||i.classList?.contains("pointer-events-none")&&(i.classList.contains("z-50")||i.classList.contains("z-[60]")))}})}function Uh(t=100){return new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(e,t);});});})}async function Xz(t,e={}){let{scale:n=2,backgroundColor:r}=e,o=await Bu(t,n,r);return new Promise((i,s)=>{o.toBlob(a=>{a?i(a):s(new Error("Canvas toBlob returned null"));},"image/png");})}async function jz(t,e,n={}){let r=await Xz(t,n);ru(r,`slide-${e+1}.png`);}async function Yz(t,e={}){let n=await Xz(t,e);await navigator.clipboard.write([new ClipboardItem({"image/png":n})]);}async function Kz(t,e,n,r,o="presentation.pdf",i={}){let{scale:s=2,onProgress:a,signal:l}=i,c=[];for(let u=0;u<e;u++){if(l?.aborted)throw new DOMException("Export cancelled","AbortError");a?.(u,e),n(u),await Uh(150);let p=t.current;if(!p){console.warn(`[export] Could not find slide stage element for slide ${u}`);continue}let h=await Bu(p,s);c.push(pR(h));}if(a?.(e,e),n(r),c.length===0)throw new Error("No slides were captured for PDF export");let d=f6(c);uR(d,o);}async function qz(t,e,n,r,o={}){let{scale:i=2,onProgress:s}=o,a=[];for(let l=0;l<e;l++){s?.(l,e),n(l),await Uh(150);let c=t.current;if(!c){console.warn(`[export] Could not find slide stage element for slide ${l}`);continue}let d=await Bu(c,i);a.push(d.toDataURL("image/png"));}return s?.(e,e),n(r),a}async function Zz(t,e,n,r,o,i="presentation-notes.pdf",s={}){let{scale:a=2,onProgress:l,signal:c}=s,d=[];for(let p=0;p<e;p++){if(c?.aborted)throw new DOMException("Export cancelled","AbortError");l?.(p,e),n(p),await Uh(150);let h=t.current;if(!h){console.warn(`[export] Could not find slide stage element for slide ${p}`);continue}let f=await Bu(h,a);d.push({canvas:f,notes:o[p],slideNumber:p+1});}if(l?.(e,e),n(r),d.length===0)throw new Error("No slides were captured for notes PDF export");let u=qR(d);uR(u,i);}Pe();async function Jz(t,e,n,r,o={}){let{scale:i=1,slideDurationMs:s=3e3,slideTimingsMs:a,onProgress:l,onRecordProgress:c,signal:d}=o,u=[];for(let v=0;v<e;v++){if(d?.aborted)throw new DOMException("Export cancelled","AbortError");l?.(v,e),n(v),await Uh(150);let S=t.current;if(!S){console.warn(`[export] Could not find slide stage element for slide ${v}`);continue}let w=await Bu(S,i);u.push(w);}if(n(r),u.length===0)throw new Error("No slides were captured for video export");let p=u[0],h=document.createElement("canvas");h.width=p.width,h.height=p.height;let f=h.getContext("2d");if(!f)throw new Error("Failed to create 2D context for video recording");let m=30,x=h.captureStream(m),g=new MediaRecorder(x,{mimeType:Ire([...kre]),videoBitsPerSecond:5e6}),y=[];g.ondataavailable=v=>{v.data.size>0&&y.push(v.data);};let b=new Promise((v,S)=>{g.onstop=()=>v(),g.onerror=w=>S(w);});g.start();for(let v=0;v<u.length;v++){if(d?.aborted)throw g.stop(),new DOMException("Export cancelled","AbortError");c?.(v,u.length);let S=a?.[v]??s;f.clearRect(0,0,h.width,h.height),f.drawImage(u[v],0,0);let w=Nre(m),C=Lre(S,m);for(let T=0;T<C;T++){if(d?.aborted)throw g.stop(),new DOMException("Export cancelled","AbortError");f.drawImage(u[v],0,0),await new Promise(M=>{setTimeout(M,w);});}}return g.stop(),await b,l?.(e,e),new Blob(y,{type:"video/webm"})}Pe();async function Qz(t,e,n,r,o={}){let{scale:i=.5,slideDurationMs:s=2e3,onProgress:a,signal:l}=o,c=[];for(let p=0;p<e;p++){if(l?.aborted)throw new DOMException("Export cancelled","AbortError");a?.(p,e),n(p),await Uh(150);let h=t.current;if(!h)continue;let f=await Bu(h,i),m=f.getContext("2d");if(!m)continue;let x=m.getImageData(0,0,f.width,f.height);c.push({imageData:x,width:f.width,height:f.height});}if(n(r),c.length===0)throw new Error("No slides were captured for GIF export");let d=c$(c,Math.round(s/10));a?.(e,e);let u=new ArrayBuffer(d.length);return new Uint8Array(u).set(d),new Blob([u],{type:"image/gif"})}function eV(t){return ["Presentation Package","====================","",`This folder contains the presentation "${t}" along with`,"all linked media files (images, audio, video) in the /media subfolder.","","To view this presentation:","1. Open the .pptx file with any compatible presentation software","2. Ensure the /media folder remains alongside the .pptx file","",`Packaged on ${new Date().toLocaleDateString()}`,""].join(`
4807
+ </style></head><body>`);for(let a of t){let l=Jce(a),c=Ug(l);s.write('<div class="slide-page">'),s.write(`<div class="slide-header">${kh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write(`<div class="slide-thumb">${kh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write('<div class="notes-text">');let d=0;for(let u of c){u.bulletType==="numbered"?d++:d=0;let p=u.indentLevel*24,h="";u.bulletType==="bullet"?h="\u2022 ":u.bulletType==="numbered"&&(h=`${d}. `);let f=u.segments.filter(m=>!m.isParagraphBreak).map(m=>kh(m.text)).join("");s.write(`<div class="para" style="padding-left:${p}px">${kh(h)}${f}</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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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=Jce(i),a=QC(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?VI(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 Jce(t){return t.notesSegments&&t.notesSegments.length>0?t.notesSegments:jb(t.notes??"")}function tde({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(d=>{if(d.preventDefault(),o.trim().length===0)return;let u=o.startsWith("http")?o:`https://${o}`;e(u,s||u);},[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:d=>i(d.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:d=>a(d.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 rde({isRichEditEnabled:t,showLinkPopover:e,savedSelectionText:n,hasAllSlides:r,onApplyRichCommand:o,onToggleBulletList:i,onToggleNumberedList:s,onIndent:a,onOutdent:l,onLinkButtonClick:c,onInsertLink:d,onCloseLinkPopover:u,onPrintClick:p,onToggleRichEdit:h}){let{t:f}=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:f("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:f("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:f("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:f("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:f("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:f("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:f("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:f("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:f("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:f("pptx.notes.printNotes"),onClick:p,children:jsx(LuPrinter,{className:"w-3.5 h-3.5"})}),e&&jsx(tde,{initialText:n,onInsert:d,onClose:u})]}),jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded bg-muted hover:bg-accent border border-border/60",onClick:h,title:f("pptx.notes.toggleRichPlainEditor"),children:f(t?"pptx.notes.plainEditor":"pptx.notes.richEditor")})]})}function ode({activeSlide:t,isExpanded:e,canEdit:n,onToggle:r,onUpdateNotes:o}){let i=useMemo(()=>t?.notesSegments&&t.notesSegments.length>0?Yb(t.notesSegments):jb(t?.notes??""),[t?.notes,t?.notesSegments]),[s,a]=useState(t?.notes??""),[l,c]=useState(i),[d,u]=useState(i.length>0),[p,h]=useState(false),[f,m]=useState(false),x=useRef(null),g=useRef(null),y=useRef(null),b=useRef(null),v=useRef(false),S=useRef(null);useEffect(()=>{let Y=t?.notes??"";if(Y===S.current)return;let ge=t?.notesSegments&&t.notesSegments.length>0?Yb(t.notesSegments):jb(Y);a(Y),c(ge),u(ge.length>0);},[t?.id,t?.notes,t?.notesSegments]),useEffect(()=>{if(!(!d||!e||!n||!y.current)){if(v.current){v.current=false;return}y.current.innerHTML=Zce(l);}},[n,l,e,d]);let w=useCallback((Y,ge)=>{x.current&&(clearTimeout(x.current),x.current=null),S.current=Y,o(Y,ge);},[o]),C=useCallback((Y,ge)=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{S.current=Y,o(Y,ge),x.current=null;},600);},[o]);useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let T=useCallback(Y=>{let ge=Y.target.value,fe=jb(ge);a(ge),c(fe),C(ge,fe);},[C]),M=useCallback(Y=>{Y.stopPropagation(),Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&(w(s,l),r());},[s,l,w,r]),_=useCallback(()=>{if(!y.current)return;v.current=true;let Y=qce(y.current),ge=QC(Y);a(ge),c(Y),C(ge,Y);},[C]),E=useCallback(()=>{w(s,l);},[s,l,w]),R=useCallback(Y=>{if(!y.current)return;let ge=Yce(y.current,l),fe=Ug(l);ge>=0&&ge<fe.length&&(fe[ge]=Y(fe[ge],ge));let de=jce(fe),J=QC(de);a(J),c(de),C(J,de);},[l,C]),I=useCallback(Y=>{document.execCommand(Y),_(),y.current?.focus();},[_]),L=useCallback(()=>{R(Y=>({...Y,bulletType:Y.bulletType==="bullet"?"none":"bullet"})),y.current?.focus();},[R]),k=useCallback(()=>{R(Y=>({...Y,bulletType:Y.bulletType==="numbered"?"none":"numbered"})),y.current?.focus();},[R]),F=useCallback(()=>{R(Y=>({...Y,indentLevel:Math.min(4,Y.indentLevel+1)})),y.current?.focus();},[R]),N=useCallback(()=>{R(Y=>({...Y,indentLevel:Math.max(0,Y.indentLevel-1)})),y.current?.focus();},[R]),D=useCallback(Y=>{if(Y.stopPropagation(),Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)){w(s,l),r();return}Y.key==="Tab"&&(Y.preventDefault(),Y.shiftKey?N():F());},[s,l,w,r,F,N]),U=useCallback(()=>{let Y=window.getSelection();b.current={text:Y?.toString()??""},h(true);},[]),G=useCallback((Y,ge)=>{if(h(false),!y.current)return;y.current.focus();let fe=window.getSelection();if(fe&&fe.rangeCount>0){let de=fe.getRangeAt(0);de.deleteContents();let J=document.createElement("a");J.href=Y,J.textContent=ge,J.style.color="#4a9eff",J.style.textDecoration="underline",J.style.cursor="pointer",J.setAttribute("data-hyperlink",Y),de.insertNode(J),de.setStartAfter(J),de.collapse(true),fe.removeAllRanges(),fe.addRange(de);}_();},[_]),j=useCallback(Y=>{let ge=Y.target;if(!(ge instanceof HTMLAnchorElement))return;let fe=ge.getAttribute("data-hyperlink")||ge.getAttribute("href");fe&&(Y.ctrlKey||Y.metaKey)&&(Y.preventDefault(),rh(fe));},[]);return {draft:s,draftSegments:l,isRichEditEnabled:d,setIsRichEditEnabled:u,showLinkPopover:p,setShowLinkPopover:h,showPrintDialog:f,setShowPrintDialog:m,textareaRef:g,richEditorRef:y,savedSelectionRef:b,handlePlainChange:T,handleRichInput:_,handleBlur:E,handleKeyDownPlain:M,handleKeyDownRich:D,applyRichCommand:I,toggleBulletList:L,toggleNumberedList:k,handleIndent:F,handleOutdent:N,handleLinkButtonClick:U,handleInsertLink:G,handleEditorClick:j}}var ez=({activeSlide:t,allSlides:e,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i,panelHeight:s})=>{let{t:a}=useTranslation(),{draft:l,draftSegments:c,isRichEditEnabled:d,setIsRichEditEnabled:u,showLinkPopover:p,setShowLinkPopover:h,showPrintDialog:f,setShowPrintDialog:m,textareaRef:x,richEditorRef:g,savedSelectionRef:y,handlePlainChange:b,handleRichInput:v,handleBlur:S,handleKeyDownPlain:w,handleKeyDownRich:C,applyRichCommand:T,toggleBulletList:M,toggleNumberedList:_,handleIndent:E,handleOutdent:R,handleLinkButtonClick:I,handleInsertLink:L,handleEditorClick:k}=ode({activeSlide:t,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i}),F=l.trim().length>0,N=t?a("pptx.notes.slideN",{n:t.slideNumber}):a("pptx.notes.noSlide"),{dragY:D,handlers:U}=Lu(o);return jsxs(Fragment,{children:[n&&jsx("button",{type:"button","aria-label":a("common.close"),onClick:o,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:ie("flex flex-col border-t border-border/60 bg-background select-none",!n&&"max-md:hidden","max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:z-30 max-md:max-h-[75dvh] max-md:rounded-t-2xl max-md:border max-md:border-border max-md:shadow-2xl max-md:pb-[max(env(safe-area-inset-bottom),0px)]"),style:D>0?{transform:`translateY(${D}px)`,transition:"none"}:void 0,children:[n&&jsx("div",{className:"md:hidden flex items-center justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing touch-none",onPointerDown:U.onPointerDown,onPointerMove:U.onPointerMove,onPointerUp:U.onPointerUp,onPointerCancel:U.onPointerCancel,children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),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&&F&&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:N}),r?jsxs(Fragment,{children:[jsx(rde,{isRichEditEnabled:d,showLinkPopover:p,savedSelectionText:y.current?.text??"",hasAllSlides:e!==void 0&&e.length>0,onApplyRichCommand:T,onToggleBulletList:M,onToggleNumberedList:_,onIndent:E,onOutdent:R,onLinkButtonClick:I,onInsertLink:L,onCloseLinkPopover:()=>h(false),onPrintClick:()=>m(true),onToggleRichEdit:()=>u(G=>!G)}),d?jsx("div",{ref:g,contentEditable:true,suppressContentEditableWarning:true,onInput:v,onBlur:S,onKeyDown:C,onClick:k,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:b,onBlur:S,onKeyDown:w,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:F?VI(c):jsx("span",{className:"italic text-muted-foreground",children:a("pptx.notes.noNotes")})})]}),f&&e&&jsx(Qce,{slides:e,onClose:()=>m(false)})]})]})};Pe();var iQe="pptx-viewer-autosave",sQe=1,qb="recoveryVersions";function sde(){return new Promise((t,e)=>{let n=indexedDB.open(iQe,sQe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(qb)||r.createObjectStore(qb,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function aQe(t){try{let e=await sde();return new Promise(n=>{let i=e.transaction(qb,"readonly").objectStore(qb).get(t);i.onsuccess=()=>{e.close();let s=i.result;n(s?[s]:[]);},i.onerror=()=>{e.close(),n([]);};})}catch{return []}}async function lQe(t){try{let e=await sde();return new Promise(n=>{let r=e.transaction(qb,"readwrite");r.objectStore(qb).delete(t),r.oncomplete=()=>{e.close(),n();},r.onerror=()=>{e.close(),n();};})}catch{}}function cQe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function nz({isOpen:t,filePath:e,onClose:n,onRestore:r}){let{t:o}=useTranslation(),[i,s]=useState([]),[a,l]=useState(false),[c,d]=useState(null),[u,p]=useState(null),h=useCallback(async()=>{if(e){l(true);try{let x=await aQe(e);s(x);}catch{s([]);}finally{l(false);}}},[e]);useEffect(()=>{t&&h();},[t,h]);let f=useCallback(async x=>{d(x.key);try{x.data&&(r(x.data),n());}finally{d(null);}},[r,n]),m=useCallback(async x=>{p(x.key);try{await lQe(x.key),await h();}finally{p(null);}},[h]);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:Xne(x.timestamp)}),jsx("div",{className:"text-[10px] text-muted-foreground",children:jne(x.timestamp)})]}),jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:cQe(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:()=>{f(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:u===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 bQe({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 lde({diff:t,diffIndex:e,canvasSize:n,accepted:r,rejected:o,onAccept:i,onReject:s}){let{t:a}=useTranslation(),[l,c]=useState(t.status==="changed"),d=(()=>{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")}})(),u=(()=>{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,h=t.baseIndex>=0?t.baseIndex+1:t.compareIndex+1;return jsxs("div",{className:ie("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(f=>!f),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:h})}),jsx("span",{className:ie("rounded-full px-2 py-0.5 text-[10px] font-medium",u),children:d}),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:ie("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(oa,{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:ie("rounded border overflow-hidden",t.status==="added"?"border-green-700/60":t.status==="changed"?"border-amber-700/60":"border-border"),children:jsx(oa,{slide:t.compareSlide,templateElements:[],canvasSize:n})})]})]}),t.changes.length>0&&jsx("div",{className:"space-y-1",children:t.changes.map((f,m)=>jsxs("div",{className:"flex items-start gap-2 rounded bg-muted/60 px-2 py-1.5 text-[11px]",children:[jsx(bQe,{kind:f.kind}),jsx("span",{className:"text-foreground",children:f.description})]},`${f.elementId}-${f.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 oz({isOpen:t,compareResult:e,canvasSize:n,onClose:r,onAcceptSlide:o,onRejectSlide:i,onAcceptAll:s}){let{t:a}=useTranslation(),[l,c]=useState({}),[d,u]=useState({}),p=useCallback(x=>{c(g=>({...g,[x]:true})),u(g=>{let y={...g};return delete y[x],y}),o(x);},[o]),h=useCallback(x=>{u(g=>({...g,[x]:true})),c(g=>{let y={...g};return delete y[x],y}),i(x);},[i]),f=useCallback(()=>{if(!e)return;let x={};e.diffs.forEach((g,y)=>{g.status!=="unchanged"&&(x[y]=true);}),c(x),u({}),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] max-w-full 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:f,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,g)=>jsx(lde,{diff:x,diffIndex:g,canvasSize:n,accepted:!!l[g],rejected:!!d[g],onAccept:p,onReject:h},`diff-${g}-${x.status}`))})]})}function AQe(t){if(!t)return 0;let e=0;return t.length>=8&&e++,t.length>=12&&e++,/[A-Z]/u.test(t)&&/[a-z]/u.test(t)&&e++,/\d/u.test(t)&&e++,/[^A-Za-z0-9]/u.test(t)&&e++,Math.min(e,4)}var RQe=["bg-red-500","bg-orange-500","bg-yellow-500","bg-lime-500","bg-green-500"];function sz({isOpen:t,isCurrentlyProtected:e,onClose:n,onSetPassword:r,onRemovePassword:o}){let{t:i}=useTranslation(),[s,a]=useState(""),[l,c]=useState(""),[d,u]=useState(false),[p,h]=useState(""),f=useMemo(()=>AQe(s),[s]),m=useMemo(()=>{let b=[i("pptx.security.strengthVeryWeak"),i("pptx.security.strengthWeak"),i("pptx.security.strengthFair"),i("pptx.security.strengthStrong"),i("pptx.security.strengthVeryStrong")];return s?b[f]:""},[f,s,i]),x=useCallback(()=>{if(h(""),!s){h(i("pptx.security.errorPasswordRequired"));return}if(s!==l){h(i("pptx.security.errorPasswordMismatch"));return}if(s.length<4){h(i("pptx.security.errorPasswordTooShort"));return}r(s),a(""),c(""),n();},[s,l,r,n,i]),g=useCallback(()=>{o(),a(""),c(""),n();},[o,n]),y=useCallback(()=>{a(""),c(""),h(""),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:y}),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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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:y,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:d?"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:b=>{a(b.target.value),h("");}}),jsx("button",{type:"button",onClick:()=>u(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":d?"Hide password":"Show password",children:d?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((b,v)=>jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${v<=f?RQe[f]:"bg-accent"}`},`str-${v}`))}),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:d?"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:b=>{c(b.target.value),h("");}})]}),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:g,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:y,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 IQe=120;function az(t){let{slides:e,canvasSize:n,activeSlideIndex:r,templateElementsBySlideId:o,loading:i,error:s,hasActivePointerInteraction:a,pointerCommitNonce:l,setSlides:c,setCanvasSize:d,setActiveSlideIndex:u,setTemplateElementsBySlideId:p,setSelectedElementId:h,setSelectedElementIds:f}=t,m=useRef([]),x=useRef([]),g=useRef(null),y=useRef(""),b=useRef(""),v=useRef(false),S=useRef(null),[w,C]=useState(false),[T,M]=useState(false),[_,E]=useState(void 0),[R,I]=useState(void 0),[L,k]=useState(false),F=useCallback(()=>{C(m.current.length>0),M(x.current.length>0);let fe=m.current[m.current.length-1];E(fe?.actionLabel);let de=x.current[x.current.length-1];I(de?.actionLabel);},[]),N=useCallback(fe=>({width:n.width,height:n.height,activeSlideIndex:r,slides:e.map(sT),templateElementsBySlideId:aT(o),...fe?{actionLabel:fe}:{}}),[r,n,e,o]),D=useCallback(fe=>{let de=Math.max(fe.slides.length-1,0);d({width:fe.width,height:fe.height}),c(fe.slides.map(sT)),p(aT(fe.templateElementsBySlideId)),u(Math.min(fe.activeSlideIndex,de)),f([]),h(null);},[u,d,h,f,c,p]),U=useCallback(()=>{S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{v.current=false;},0);},[]),G=useCallback(()=>{k(fe=>fe||true);},[]),j=useCallback(()=>{let fe=m.current.pop();if(!fe)return;let de=N();x.current.push(de),v.current=true;let J=ou(fe);g.current=ou(J),y.current=JSON.stringify(J),D(J),F(),U(),G();},[D,N,G,U,F]),Y=useCallback(()=>{let fe=x.current.pop();if(!fe)return;let de=N();m.current.push(de),v.current=true;let J=ou(fe);g.current=ou(J),y.current=JSON.stringify(J),D(J),F(),U(),G();},[D,N,G,U,F]),ge=useCallback(fe=>{if(m.current=[],x.current=[],fe){let de=ou(fe);g.current=de,y.current=JSON.stringify(de);}else g.current=null,y.current="";F();},[F]);return useEffect(()=>()=>{S.current&&(clearTimeout(S.current),S.current=null);},[]),useEffect(()=>{if(i||s||v.current||a())return;let fe=`${e.length}|${r}|${n.width}x${n.height}|${e.map(ce=>`${ce.id}:${ce.elements.length}`).join("/")}`;if(fe===b.current)return;let de=N(),J=JSON.stringify(de);if(J===y.current){b.current=fe;return}let re=g.current;if(!re){g.current=ou(de),y.current=J,b.current=fe,F();return}m.current.push(ou(re)),m.current.length>IQe&&m.current.shift(),x.current=[],g.current=ou(de),y.current=J,b.current=fe,F();},[r,N,n.height,n.width,s,a,i,l,e,F]),{canUndo:w,canRedo:T,undoLabel:_,redoLabel:R,handleUndo:j,handleRedo:Y,resetHistory:ge,markDirty:G,buildHistorySnapshot:N}}function cz({canvasSize:t,selectedElements:e}){let n=useRef(null),r=useRef(null),o=useRef(null),i=useRef(1),[s,a]=useState(1),[l,c]=useState(null),d=l||{width:t.width,height:t.height},u=useMemo(()=>{if(!d.width||!d.height)return 1;let S=d.width/t.width,w=d.height/t.height;return Math.min(S,w,1)},[t,d.height,d.width]),p=u*s;useEffect(()=>{i.current=p;},[p]),useEffect(()=>{let S=null,w=0,C=32,T=_=>{let E=Math.max(0,_.clientWidth-8),R=Math.max(0,_.clientHeight-C);E>0&&R>0&&c({width:E,height:R});},M=()=>{let _=o.current;if(!_){w=requestAnimationFrame(M);return}S=new ResizeObserver(()=>T(_)),S.observe(_),T(_);};return M(),()=>{cancelAnimationFrame(w),S?.disconnect();}},[]);let h=useCallback((S,w)=>{let C=n.current,T=o.current;if(!C||!T)return;let M=Math.min(Math.max(w,.2),5),_=u*M,E=(S.minX+S.maxX)/2,R=(S.minY+S.maxY)/2,I=T.offsetLeft+E*_-C.clientWidth/2,L=T.offsetTop+R*_-C.clientHeight/2;C.scrollTo({left:Math.max(I,0),top:Math.max(L,0),behavior:"smooth"});},[u]),f=useCallback(()=>{a(S=>Math.min(S+.1,5));},[]),m=useCallback(()=>{a(S=>Math.max(S-.1,.2));},[]),x=useCallback(()=>{a(1);},[]),g=useCallback(()=>{a(1);},[]),y=useCallback(()=>{if(e.length===0)return;let S=Number.POSITIVE_INFINITY,w=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,T=Number.NEGATIVE_INFINITY;if(e.forEach(N=>{S=Math.min(S,N.x),w=Math.min(w,N.y),C=Math.max(C,N.x+Math.max(N.width,12)),T=Math.max(T,N.y+Math.max(N.height,12));}),!Number.isFinite(S)||!Number.isFinite(w)||!Number.isFinite(C)||!Number.isFinite(T))return;let M={minX:S,minY:w,maxX:C,maxY:T},_=Math.max(M.maxX-M.minX,12),E=Math.max(M.maxY-M.minY,12),R=Math.max(d.width-96,12),I=Math.max(d.height-96,12),L=Math.min(R/_,I/E),k=u>Number.EPSILON?u:Number.EPSILON,F=Math.min(Math.max(L/k,.2),5);a(F),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{h(M,F);});});},[h,d.height,d.width,u,e]),b=useCallback(S=>{if(!S.ctrlKey)return;S.preventDefault();let w=S.deltaY*-1e-3;a(C=>Math.min(Math.max(C+w,.2),5));},[]);useEffect(()=>{let S=o.current;if(S)return S.addEventListener("wheel",b,{passive:false}),()=>{S.removeEventListener("wheel",b);}},[b]);let v=useCallback((S,w)=>{let C=r.current;if(!C)return null;let T=C.getBoundingClientRect();if(T.width<=0||T.height<=0)return null;let M=(S-T.left)/p,_=(w-T.top)/p;return {x:Math.max(0,Math.min(t.width,M)),y:Math.max(0,Math.min(t.height,_))}},[t.height,t.width,p]);return {editWrapperRef:n,canvasStageRef:r,canvasViewportRef:o,renderScaleRef:i,scale:s,setScale:a,editorDimensions:l,setEditorDimensions:c,fitScale:u,editorScale:p,handleZoomIn:f,handleZoomOut:m,handleResetZoom:x,handleZoomToFit:g,handleZoomToSelection:y,handleWheel:b,centerBoundsInViewport:h,getCanvasPointFromClient:v}}bt();function fde(t){return !!t.loopContinuously||t.showType==="kiosk"}function mde(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 gde(t,e){return Math.max(0,t||0)+e*60}function ZI(){}function zg(t,e,n,r){for(let o of t.steps)o.stopSound?ZI():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 dz(t){let{slides:e,onPlayActionSound:n,showWithAnimation:r}=t,o=r!==false,[i,s]=useState([]),[a,l]=useState(new Map),[c,d]=useState(""),[u,p]=useState(new Set),[h,f]=useState(new Set),m=useRef([]),x=useRef(null),g=useCallback(()=>{m.current.forEach(M=>{window.clearTimeout(M);}),m.current=[];},[]),y=useCallback(M=>{if(!M.shouldAutoAdvance())return;let _=M.getAutoAdvanceDelay(),E=M.peekNext();if(!E)return;let R=_+(E.autoAdvanceDelayMs??0),I=window.setTimeout(()=>{let L=M.advance();L&&(zg(L,n,l,m),y(M));},Math.max(0,R));m.current.push(I);},[n]),b=useCallback(M=>{let _=e[M];if(!_){x.current=null,l(new Map),d(""),p(new Set),f(new Set);return}let E=_.nativeAnimations??[],R=new Map;for(let F of E)if(F.buildType&&F.buildType!=="allAtOnce"&&F.targetId){let N=_.elements.find(D=>D.id===F.targetId);N&&ze(N)&&N.textSegments&&N.textSegments.length>0&&R.set(F.targetId,NA(N.textSegments));}let I=R.size>0?LA(E,R):E,L=DA.fromAnimations(I);x.current=L,d(L.getTimeline().keyframesCss),p(L.getInteractiveTriggerShapeIds()),f(L.getHoverTriggerShapeIds());let k=_.elements.map(F=>F.id);for(let F of I)F.targetId&&F.targetId.includes(ra)&&k.push(F.targetId);l(L.getElementStates(k));},[e]),v=useCallback(()=>{if(!o)return false;let M=x.current;if(!M||!M.hasMoreSteps())return false;let _=M.advance();return _?(zg(_,n,l,m),y(M),true):false},[o,n,y]),S=useCallback(M=>{let _=x.current;if(!_||!_.hasInteractiveSequence(M))return false;let E=_.advanceInteractive(M);return E?(zg(E,n,l,m),true):false},[n]),w=useCallback(M=>{if(!o)return false;let _=x.current;if(!_||!_.hasHoverSequence(M))return false;_.resetHover(M);let E=_.advanceHover(M);return E?(zg(E,n,l,m),true):false},[o,n]),C=useCallback(M=>{let _=x.current;!_||!_.hasHoverSequence(M)||_.resetHover(M);},[]),T=useCallback(M=>{if(g(),!o){x.current=null,s([]),l(new Map),d(""),p(new Set),f(new Set);return}b(M);let _=e[M];if(!_){s([]);return}let E=x.current;if(E&&E.hasMoreSteps()){let I=E.peekNext();if(I&&I.autoAdvance){let L=window.setTimeout(()=>{let k=E.advance();k&&(zg(k,n,l,m),y(E));},I.autoAdvanceDelayMs??0);m.current.push(L);}}let R=[..._.animations||[]].filter(I=>!!I.entrance).sort((I,L)=>(I.order||Number.MAX_SAFE_INTEGER)-(L.order||Number.MAX_SAFE_INTEGER));if(R.length===0){s([]);return}s(R.map(I=>({elementId:I.elementId,state:"hidden",animation:I}))),R.forEach((I,L)=>{let k=gde(I.delayMs,L),F=window.setTimeout(()=>{s(N=>N.map(D=>D.elementId===I.elementId?{...D,state:"visible"}:D));},k);m.current.push(F);});},[o,g,b,e,n,y]);return {presentationAnimations:i,presentationElementStates:a,presentationKeyframesCss:c,interactiveTriggerShapeIds:u,hoverTriggerShapeIds:h,clearPresentationTimers:g,playNextAnimationGroup:v,handleInteractiveShapeClick:S,handleHoverStart:w,handleHoverEnd:C,runPresentationEntranceAnimations:T,presentationTimersRef:m}}var LQe="pptx-viewer-audience";var Oh="content",uz="pptx-bytes";function pz(){return new Promise((t,e)=>{let n=indexedDB.open(LQe,1);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(Oh)||r.createObjectStore(Oh);},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function JI(t){let e=await pz();return new Promise((n,r)=>{let o=e.transaction(Oh,"readwrite"),i=o.objectStore(Oh),a={bytes:t instanceof Uint8Array?t:new Uint8Array(t),createdAt:Date.now()};i.put(a,uz),o.oncomplete=()=>{e.close(),n();},o.onerror=()=>{e.close(),r(o.error);};})}async function yde(){try{let t=await pz();return new Promise((e,n)=>{let i=t.transaction(Oh,"readonly").objectStore(Oh).get(uz);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 Vg(){try{let t=await pz();return new Promise(e=>{let n=t.transaction(Oh,"readwrite");n.objectStore(Oh).delete(uz),n.oncomplete=()=>{t.close(),e();},n.onerror=()=>{t.close(),e();};})}catch{}}var tN="pptx-viewer-presenter",s2="#pptx-audience",a2="pptx-viewer-presenter",bde="nonce";function DQe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function vde(){let t=window.location.hash;if(!t.startsWith(s2))return null;let e=t.slice(s2.length);return e?new URLSearchParams(e.replace(/^[&;?]/u,"")).get(bde):null}function l2(){return window.location.hash.startsWith(s2)}function hz(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(tN)),i.current),[]),c=useCallback(()=>o.current!==null&&!o.current.closed,[]),d=useCallback(h=>{if(!a.current)return;let f={origin:a2,type:"presenter-slide-change",slideIndex:h,sessionId:a.current};try{l().postMessage(f);}catch{}},[l]),u=useCallback(()=>{if(a.current)try{let f={origin:a2,type:"presenter-exit",sessionId:a.current};l().postMessage(f);}catch{}let h=o.current;if(h&&!h.closed)try{h.close();}catch{}o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null),Vg();},[l]),p=useCallback(()=>{c()&&u();let h=window.open("about:blank","_blank");if(!h)return false;o.current=h;let f=DQe();a.current=f;let m=new URL(window.location.href),x=new URLSearchParams;x.set(bde,f),m.hash=`${s2}&${x.toString()}`;let g=y=>{let b=o.current;if(!(!b||b.closed)){if(!y){try{b.close();}catch{}o.current=null,a.current="";return}try{b.location.replace(m.toString());}catch{try{b.close();}catch{}o.current=null,a.current="";}}};return r?JI(r).then(()=>g(true)).catch(()=>g(false)):g(true),window.setTimeout(()=>d(e),1500),s.current=setInterval(()=>{let y=o.current;(!y||y.closed)&&(o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null));},1e3),true},[c,u,d,e,r]);return useEffect(()=>{n&&c()&&d(e);},[e,n,c,d]),useEffect(()=>()=>{u();try{i.current?.close();}catch{}},[u]),useEffect(()=>{n||u();},[n,u]),useEffect(()=>{let h=()=>{Vg();};return window.addEventListener("beforeunload",h),()=>window.removeEventListener("beforeunload",h)},[]),{openAudienceWindow:p,closeAudienceWindow:u,isAudienceWindowOpen:c,syncSlideToAudience:d}}function fz(t){let{onSetMode:n,onSetActiveSlideIndex:r,containerRef:o}=t,i=useRef(false);useEffect(()=>{if(!l2()||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(!l2())return;let s=vde(),a;try{a=new BroadcastChannel(tN);}catch{return}return a.onmessage=l=>{let c=l.data;if(!(!c||c.origin!==a2)&&!(s&&c.sessionId!==s)&&(c.type==="presenter-slide-change"&&r(c.slideIndex),c.type==="presenter-exit")){Vg(),n("edit");try{window.close();}catch{}}},()=>{try{a.close();}catch{}}},[n,r]);}function wde(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 mz(t){let{mode:e,movePresentationSlide:n,onSetMode:r,onToggleLaser:o,onTogglePen:i,onToggleEraser:s,onToggleToolbar:a,onTogglePresenterView:l,rehearsing:c,recordCurrentSlideTime:d,presentationSlideIndex:u,setShowRehearsalSummary:p}=t;useEffect(()=>{if(e!=="present")return;let h=f=>{let m=wde(f.key,f.ctrlKey);if(m.action!=="none")switch(f.preventDefault(),m.action){case "exit":c&&(d(u),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",h),()=>{window.removeEventListener("keydown",h);}},[e,n,r,o,i,s,a,l,c,d,u,p]);}function gz(t){let{containerRef:e,onSetMode:n,onSaveRehearsalTimings:r,setPresentationStartTime:o,setPresenterMode:i}=t,[s,a]=useState(false),[l,c]=useState({}),[d,u]=useState(null),[p,h]=useState(false),[f,m]=useState(false),x=useRef(0),g=useRef(null),y=useCallback(C=>{if(d===null)return;let T=x.current;g.current!==null&&(T+=Date.now()-g.current);let M=Date.now()-d-T;c(_=>({..._,[C]:Math.max(0,M)})),x.current=0,g.current=f?Date.now():null,u(Date.now());},[d,f]),b=useCallback(()=>{h(false),a(false),c({});},[]),v=useCallback(()=>{r?.(l),h(false),a(false);},[r,l]),S=useCallback(()=>{i(false),a(true),c({}),m(false),h(false),x.current=0,g.current=null;let C=Date.now();o(C),u(C);try{let T=e.current;T&&typeof T.requestFullscreen=="function"&&T.requestFullscreen().catch(()=>{});}catch{}n("present");},[e,n,o,i]),w=useCallback(()=>{m(C=>(C?g.current!==null&&(x.current+=Date.now()-g.current,g.current=null):g.current=Date.now(),!C));},[]);return {rehearsing:s,setRehearsing:a,recordedTimings:l,slideStartTime:d,showRehearsalSummary:p,setShowRehearsalSummary:h,rehearsalPaused:f,recordCurrentSlideTime:y,dismissRehearsalSummary:b,saveRehearsalTimings:v,enterRehearsalMode:S,toggleRehearsalPause:w}}function xz(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")&&Dm(t.url)&&window.open(t.url,"_blank","noopener,noreferrer");}function nN(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 yz(t){let{slides:e,visibleSlideIndexes:n,presentationSlideIndex:r,setPresentationSlideIndex:o,setPresentationSlideVisible:i,onSetMode:s,onSetActiveSlideIndex:a,onPlayActionSound:l,loopContinuously:c,useTimings:d,playNextAnimationGroup:u,clearPresentationTimers:p,runPresentationEntranceAnimations:h,presentationTimersRef:f,rehearsing:m,recordCurrentSlideTime:x,setShowRehearsalSummary:g}=t,y=useRef(()=>{}),b=useCallback(C=>{if(d===false)return;let M=e[C]?.transition?.advanceAfterMs;if(typeof M!="number"||!Number.isFinite(M)||M<0)return;let _=window.setTimeout(()=>{y.current(1);},Math.max(0,M));f.current.push(_);},[e,f,d]),v=useCallback(C=>{if(C===1&&u())return;let T=n.length>0?n:e.map((L,k)=>k);if(T.length===0)return;let M=T.indexOf(r),E=(M>=0?M:0)+C;if(m&&C===1&&E>=T.length){x(r);try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}s("edit"),g(true);return}let R;c&&!m&&C===1&&E>=T.length?R=0:R=Math.min(T.length-1,Math.max(0,E));let I=T[R];I===void 0||I===r||(m&&C===1&&x(r),nN(I,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:h,scheduleAutoAdvanceForSlide:m?void 0:b,presentationTimersRef:f}));},[p,c,l,a,s,u,r,f,x,m,h,b,g,e,n,i,o]);y.current=v;let S=useCallback(C=>{C<0||C>=e.length||C!==r&&nN(C,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:h,scheduleAutoAdvanceForSlide:b,presentationTimersRef:f});},[p,l,a,r,f,h,b,e,o,i]),w=useCallback(C=>{xz(C,{movePresentationSlide:v,navigateToSlide:S,onPlayActionSound:l,onSetMode:s,slidesLength:e.length});},[v,S,l,s,e.length]);return {movePresentationSlide:v,navigateToSlide:S,handlePresentationAction:w,scheduleAutoAdvanceForSlide:b}}function vz(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 wz(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:h,onSaveRehearsalTimings:f,loopContinuously:m,showWithAnimation:x,useTimings:g}=t,[y,b]=useState(0),[v,S]=useState(true),[w,C]=useState(false),[T,M]=useState(null),_=useRef(false),{presentationAnimations:E,presentationElementStates:R,presentationKeyframesCss:I,interactiveTriggerShapeIds:L,hoverTriggerShapeIds:k,clearPresentationTimers:F,playNextAnimationGroup:N,handleInteractiveShapeClick:D,handleHoverStart:U,handleHoverEnd:G,runPresentationEntranceAnimations:j,presentationTimersRef:Y}=dz({slides:n,onPlayActionSound:c,showWithAnimation:x}),{rehearsing:ge,setRehearsing:fe,recordedTimings:de,slideStartTime:J,showRehearsalSummary:re,setShowRehearsalSummary:ce,rehearsalPaused:ae,recordCurrentSlideTime:_e,dismissRehearsalSummary:xe,saveRehearsalTimings:Ee,enterRehearsalMode:W,toggleRehearsalPause:q}=gz({containerRef:i,onSetMode:a,onSaveRehearsalTimings:f,setPresentationStartTime:M,setPresenterMode:C}),{movePresentationSlide:Q,navigateToSlide:se,handlePresentationAction:me,scheduleAutoAdvanceForSlide:P}=yz({slides:n,visibleSlideIndexes:r,presentationSlideIndex:y,setPresentationSlideIndex:b,setPresentationSlideVisible:S,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,loopContinuously:m,useTimings:g,playNextAnimationGroup:N,clearPresentationTimers:F,runPresentationEntranceAnimations:j,presentationTimersRef:Y,rehearsing:ge,recordCurrentSlideTime:_e,setShowRehearsalSummary:ce}),{handleZoomClick:A,zoomReturnSlideIndex:O,returnToZoomSlide:z,clearZoomReturn:te}=vz({navigateToSlide:se}),{openAudienceWindow:$,closeAudienceWindow:Me,isAudienceWindowOpen:De,syncSlideToAudience:V}=hz({currentSlideIndex:y,isPresenterMode:w,content:s});fz({onSetMode:a,onSetActiveSlideIndex:l,containerRef:i});let B=useCallback(()=>{C(false),fe(false),M(Date.now());try{let ue=i.current;ue&&typeof ue.requestFullscreen=="function"&&ue.requestFullscreen().catch(()=>{});}catch{}a("present");},[i,a,fe]),ee=useCallback(()=>{C(true),fe(false),M(Date.now()),a("present");},[a,fe]),oe=useCallback(()=>{if(w){C(false);try{let ue=i.current;ue&&typeof ue.requestFullscreen=="function"&&ue.requestFullscreen().catch(()=>{});}catch{}}else {_.current=true;try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}C(true),T||M(Date.now());}},[w,T,i]);mz({mode:e,movePresentationSlide:Q,onSetMode:a,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:h,onTogglePresenterView:oe,rehearsing:ge,recordCurrentSlideTime:_e,presentationSlideIndex:y,setShowRehearsalSummary:ce});let pe=useRef(j);pe.current=j;let Ae=useRef(P);Ae.current=P;let Le=useRef(o);return Le.current=o,useEffect(()=>{if(e==="present"){let ue=Le.current;b(ue),pe.current(ue),Ae.current(ue);}},[e]),useEffect(()=>{if(e==="present")return ()=>{try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}}},[e]),useEffect(()=>{if(e!=="present"||w)return;let ue=!!document.fullscreenElement,we=()=>{if(_.current){_.current=false,ue=!!document.fullscreenElement;return}let Ie=!!document.fullscreenElement;ue&&!Ie&&(ge&&(_e(y),ce(true)),a("edit")),ue=Ie;};return document.addEventListener("fullscreenchange",we),()=>{document.removeEventListener("fullscreenchange",we);}},[e,a,w,ge,_e,y,ce]),useEffect(()=>{let ue=Y;return ()=>{ue.current.forEach(we=>{window.clearTimeout(we);});}},[Y]),{presentationSlideIndex:y,setPresentationSlideIndex:b,presentationSlideVisible:v,presentationAnimations:E,presentationElementStates:R,presentationKeyframesCss:I,clearPresentationTimers:F,runPresentationEntranceAnimations:j,movePresentationSlide:Q,navigateToSlide:se,handlePresentationAction:me,handleInteractiveShapeClick:D,interactiveTriggerShapeIds:L,hoverTriggerShapeIds:k,handleHoverStart:U,handleHoverEnd:G,enterPresentMode:B,presenterMode:w,enterPresenterView:ee,togglePresenterView:oe,presentationStartTime:T,rehearsing:ge,enterRehearsalMode:W,recordedTimings:de,slideStartTime:J,showRehearsalSummary:re,dismissRehearsalSummary:xe,saveRehearsalTimings:Ee,rehearsalPaused:ae,toggleRehearsalPause:q,handleZoomClick:A,zoomReturnSlideIndex:O,returnToZoomSlide:z,clearZoomReturn:te,openAudienceWindow:$,closeAudienceWindow:Me,isAudienceWindowOpen:De,syncSlideToAudience:V}}var $Qe=2.5,HQe=14,zQe=.4,Mde=16,_de=0;function VQe(){return _de+=1,`stroke-${_de}`}function Tz(t){let{isActive:e,activeSlideIndex:n}=t,[r,o]=useState("none"),[i,s]=useState("#ff0000"),[a,l]=useState("#ffff00"),[c,d]=useState(null),[u,p]=useState(null),[h,f]=useState(false),m=useRef(new Map),[x,g]=useState([]),[y,b]=useState(0),v=useRef(false),S=useRef(n);S.current=n;let w=useRef(n);useEffect(()=>{e&&w.current!==n&&(g(U=>(U.length>0?m.current.set(w.current,U):m.current.delete(w.current),b(G=>G+1),m.current.get(n)??[])),w.current=n);},[e,n]);let C=useCallback(U=>{e&&o(G=>G===U?"none":U);},[e]),T=useCallback((U,G)=>{if(e&&(r==="pen"||r==="highlighter")){v.current=true;let j=r==="pen";d({id:VQe(),points:[{x:U,y:G}],color:j?i:a,width:j?$Qe:HQe,opacity:j?1:zQe});}},[e,r,i,a]),M=useCallback((U,G)=>{!e||!v.current||d(j=>j?{...j,points:[...j.points,{x:U,y:G}]}:null);},[e]),_=useCallback(()=>{v.current&&(v.current=false,d(U=>(U&&U.points.length>1&&g(G=>{if(G.some(Y=>Y.id===U.id))return G;let j=[...G,U];return m.current.set(S.current,j),b(Y=>Y+1),j}),null)));},[]),E=useCallback((U,G)=>{!e||r!=="laser"||p({x:U,y:G});},[e,r]),R=useCallback(()=>{p(null);},[]),I=useCallback((U,G)=>{!e||r!=="eraser"||g(j=>{let Y=j.filter(ge=>!ge.points.some(fe=>{let de=fe.x-U,J=fe.y-G;return de*de+J*J<Mde*Mde}));return Y.length>0?m.current.set(S.current,Y):m.current.delete(S.current),b(ge=>ge+1),Y});},[e,r]),L=useCallback(()=>{g([]),d(null),v.current=false,m.current.delete(S.current),b(U=>U+1);},[]),k=useCallback(()=>{g([]),d(null),v.current=false,m.current.clear(),b(U=>U+1);},[]),F=useRef(0);useEffect(()=>{if(!e){f(false),o("none"),d(null),p(null);return}let U=()=>{f(true),window.clearTimeout(F.current),F.current=window.setTimeout(()=>{f(false);},3e3);};return window.addEventListener("mousemove",U),()=>{window.removeEventListener("mousemove",U),window.clearTimeout(F.current);}},[e]);let N=useCallback(()=>{let U=new Map(m.current);return x.length>0&&U.set(n,x),U},[x,n]),D=y>=0&&(x.length>0||m.current.size>0);return {presentationTool:r,setPresentationTool:C,penColor:i,setPenColor:s,highlighterColor:a,setHighlighterColor:l,annotationStrokes:x,currentStroke:c,laserPosition:u,toolbarVisible:h,setToolbarVisible:f,handlePointerDown:T,handlePointerMove:M,handlePointerUp:_,handleLaserMove:E,handleLaserLeave:R,clearAnnotations:L,eraseAtPoint:I,allSlideAnnotations:N(),hasAnyAnnotations:D,clearAllAnnotations:k}}bt();function WQe(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(!ze(a))continue;(a.textSegments??[]).forEach((c,d)=>{let u=n?c.text:(c.text||"").toLowerCase(),p=0;for(;p<u.length;){let h=u.indexOf(o,p);if(h===-1)break;r.push({slideIndex:s,elementId:a.id,segmentIndex:d,startOffset:h,length:e.length}),p=h+1;}});}}),r}function XQe(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 d=l.elements[c];if(!ze(d))continue;let u=[...d.textSegments??[]],p=u[a.segmentIndex];if(!p)continue;let h=p.text.slice(0,a.startOffset),f=p.text.slice(a.startOffset+a.length);u[a.segmentIndex]={...p,text:h+n+f};let m=[...l.elements];m[c]={...d,text:u.map(x=>x.text).join(""),textSegments:u},r[a.slideIndex]={...l,elements:m};}}return r}function Cz({slides:t,mode:e,onSetActiveSlideIndex:n,onSetSelectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState(false),[l,c]=useState(""),[d,u]=useState(""),[p,h]=useState(false),[f,m]=useState([]),[x,g]=useState(-1),y=useCallback(()=>{let C=WQe(t,l,p);if(!l){m([]),g(-1);return}m(C),g(C.length>0?0:-1),C.length>0&&(n(C[0].slideIndex),r(C[0].elementId));},[t,l,p,n,r]),b=useCallback(C=>{if(f.length===0)return;let T=(x+C+f.length)%f.length;g(T);let M=f[T];M&&(n(M.slideIndex),r(M.elementId));},[f,x,n,r]),v=useCallback(C=>{C.length!==0&&(o(T=>XQe(T,C,d)),i());},[d,o,i]),S=useCallback(()=>{f.length===0||x<0||(v([f[x]]),setTimeout(y,0));},[f,x,v,y]),w=useCallback(()=>{f.length!==0&&(v(f),setTimeout(y,0));},[f,v,y]);return useEffect(()=>{let C=T=>{if((T.metaKey||T.ctrlKey)&&T.key==="f"){if(e!=="edit")return;T.preventDefault(),a(M=>!M);}};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e]),{findReplaceOpen:s,setFindReplaceOpen:a,findQuery:l,setFindQuery:c,replaceQuery:d,setReplaceQuery:u,findMatchCase:p,setFindMatchCase:h,findResults:f,findResultIndex:x,performFind:y,navigateFindResult:b,handleReplace:S,handleReplaceAll:w}}function pi(t,e=120){let[n,r]=useState(0),o=useRef(null),i=useCallback(l=>{l.pointerType!=="mouse"&&(l.target.closest('button, a, input, select, textarea, [role="button"]')||(o.current=l.clientY,l.target.setPointerCapture?.(l.pointerId)));},[]),s=useCallback(l=>{o.current!==null&&r(Math.max(0,l.clientY-o.current));},[]),a=useCallback(l=>{if(o.current===null)return;let c=l.clientY-o.current;o.current=null,l.target.releasePointerCapture?.(l.pointerId),c>e&&t(),r(0);},[t,e]);return {panelStyle:n>0?{transform:`translateY(${n}px)`,transition:"none"}:{transition:"transform 150ms ease-out"},handlers:{onPointerDown:i,onPointerMove:s,onPointerUp:a,onPointerCancel:a}}}function _z(){return `comment-${crypto.randomUUID()}`}function Pde(t,e,n){return t.map((r,o)=>o===e?{...r,comments:[...r.comments||[],n]}:r)}function Ede(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 d=c.id!==n;return d||(r=true),d});return l.length===a.length?i:{...i,comments:l}}),didDelete:r}}function Ade(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 Rde(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 kde(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 Pz({slides:t,canEdit:e,userName:n="You",selectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState({}),[l,c]=useState({}),[d,u]=useState({}),[p,h]=useState({}),[f,m]=useState(null),x=useCallback((R,I)=>{a(L=>({...L,[R]:I}));},[]),g=useCallback((R,I)=>{u(L=>({...L,[R]:I}));},[]),y=useCallback(R=>{if(!e)return;let I=t[R];if(!I)return;let L=String(s[I.id]||"").trim();if(L.length===0)return;let k={id:_z(),text:L,author:n,createdAt:new Date().toISOString(),elementId:r??void 0};o(F=>Pde(F,R,k)),a(F=>({...F,[I.id]:""})),i();},[e,s,i,o,r,t,n]),b=useCallback((R,I)=>{if(!e)return;let L=t[R];if(!L)return;let k=false;o(F=>{let N=Ede(F,R,I);return k=N.didDelete,N.slides}),k&&(c(F=>({...F,[L.id]:null})),i());},[e,i,o,t]),v=useCallback((R,I)=>{let L=t.find(F=>F.id===R);if(!L)return;let k=(L.comments||[]).find(F=>F.id===I);k&&(c(F=>({...F,[R]:I})),u(F=>({...F,[I]:k.text||""})));},[t]),S=useCallback(R=>{c(I=>({...I,[R]:null}));},[]),w=useCallback((R,I)=>{if(!e)return;let L=t[R];if(!L)return;let k=String(d[I]||"").trim();if(k.length===0)return;let F=false;o(N=>{let D=Ade(N,R,I,k);return F=D.didUpdate,D.slides}),F&&(c(N=>({...N,[L.id]:null})),i());},[e,d,i,o,t]),C=useCallback((R,I)=>{if(!e||!t[R])return;let k=false;o(F=>{let N=Rde(F,R,I);return k=N.didUpdate,N.slides}),k&&i();},[e,i,o,t]),T=useCallback((R,I)=>{m(I),h(L=>({...L,[I]:""}));},[]),M=useCallback(()=>{m(null);},[]),_=useCallback((R,I)=>{h(L=>({...L,[R]:I}));},[]),E=useCallback((R,I)=>{if(!e)return;let L=t[R];if(!L)return;let k=(L.comments||[]).find(D=>D.id===I);if(!k)return;let F=String(p[I]||"").trim();if(F.length===0)return;let N={id:_z(),text:F,author:n,createdAt:new Date().toISOString(),threadId:I,elementId:k.elementId};o(D=>D.map((U,G)=>{if(G!==R)return U;let j=(U.comments||[]).map(Y=>Y.id!==I?Y:{...Y,replies:[...Y.replies||[],N]});return {...U,comments:j}})),m(null),h(D=>{let U={...D};return delete U[I],U}),i();},[e,i,o,p,t,n]);return useEffect(()=>{let R=new Set(t.map(I=>I.id));a(I=>kde(I,R)??I);},[t]),{commentDraftBySlideId:s,editingCommentIdBySlideId:l,commentEditDraftByCommentId:d,replyingToCommentId:f,replyDraftByCommentId:p,handleCommentDraftChange:x,handleAddSlideComment:y,handleDeleteSlideComment:b,handleStartCommentEdit:v,handleCancelCommentEdit:S,handleSaveCommentEdit:w,handleSetCommentEditDraft:g,handleToggleCommentResolved:C,handleStartReply:T,handleCancelReply:M,handleReplyDraftChange:_,handleSubmitReply:E}}function qQe(t,e){let n=new Map;for(let r of t)n.set(r.id,r);for(let r of e)n.set(r.id,r);return n}function ZQe(t,e){return e.length>0?e:t?[t]:[]}function JQe(t,e){if(!(e===null||!t?.layouts))return t.layouts[e]}function QQe(t,e){return e?e.elements??[]:t?t.elements??[]:[]}function Ide(t){let{slides:e,activeSlideIndex:n,templateElementsBySlideId:r,selectedElementId:o,selectedElementIds:i,slideMasters:s,activeMasterIndex:a,activeLayoutIndex:l,notesMaster:c,handoutMaster:d}=t,u=e[n],p=useMemo(()=>u?r[u.id]??[]:[],[u,r]),h=useMemo(()=>qQe(p,u?.elements??[]),[u,p]),f=useMemo(()=>o?h.get(o)??null:null,[h,o]),m=useMemo(()=>ZQe(o,i),[o,i]),x=useMemo(()=>new Set(m),[m]),g=useMemo(()=>m.map(C=>h.get(C)).filter(Boolean),[m,h]),y=s[a],b=useMemo(()=>JQe(y,l),[y,l]),v=useMemo(()=>QQe(y,b),[y,b]),S=useMemo(()=>c?.elements??[],[c]),w=useMemo(()=>d?.elements??[],[d]);return {activeSlide:u,templateElements:p,elementLookup:h,selectedElement:f,effectiveSelectedIds:m,selectedElementIdSet:x,selectedElements:g,activeMaster:y,activeLayout:b,masterViewElements:v,notesMasterElements:S,handoutMasterElements:w}}function Rz(t){let e=useRef(null),n=useRef(null),r=useRef(null),o=useRef(0),i=useRef(null),s=useRef(null),a=useRef(null),l=useRef(null),c=useRef(false),[d,u]=useState("edit"),[p,h]=useState(true),[f,m]=useState(null),[x,g]=useState([]),[y,b]=useState({}),[v,S]=useState({width:1280,height:720}),[w,C]=useState(0),[T,M]=useState(null),[_,E]=useState([]),[R,I]=useState(false),L=useRef(null),k=useRef(""),[F,N]=useState(null),[D,U]=useState(""),G=useCallback(vs=>{let rp=typeof vs=="function"?vs(L.current):vs;L.current=rp,N(vs);},[]),j=useCallback(vs=>{let rp=typeof vs=="function"?vs(k.current):vs;k.current=rp,U(vs);},[]),[Y,ge]=useState(false),[fe,de]=useState("rect"),[J,re]=useState(null),[ce,ae]=useState(0),[_e,xe]=useState({}),[Ee,W]=useState([]),[q,Q]=useState([]),[se,me]=useState(),[P,A]=useState(),[O,z]=useState([]),[te,$]=useState([]),[Me,De]=useState(null),[V,B]=useState([]),[ee,oe]=useState({}),[pe,Ae]=useState(),[Le,ue]=useState(),[we,Ie]=useState(),[He,Oe]=useState([]),[$e,ot]=useState([]),[at,gt]=useState(),[le,Ue]=useState(),[Te,Ve]=useState([]),[Fe,ke]=useState(false),[nt,st]=useState(false),[Xn,Cn]=useState(0),[Zi,bs]=useState(0),[m0,Pv]=useState(null),[g0,sf]=useState("edit"),[Ev,x0]=useState("slides"),[y0,pl]=useState(4),af=Ide({slides:x,activeSlideIndex:w,templateElementsBySlideId:y,selectedElementId:T,selectedElementIds:_,slideMasters:q,activeMasterIndex:Zi,activeLayoutIndex:m0,notesMaster:pe,handoutMaster:Le});return {containerRef:e,imageInputRef:n,mediaInputRef:r,activeSlideIndexRef:o,inlineEditingElementIdRef:L,inlineEditingTextRef:k,dragStateRef:i,resizeStateRef:s,shapeAdjustmentDragStateRef:a,marqueeStateRef:l,isDrawingRef:c,mode:d,setMode:u,loading:p,setLoading:h,error:f,setError:m,slides:x,setSlides:g,templateElementsBySlideId:y,setTemplateElementsBySlideId:b,canvasSize:v,setCanvasSize:S,activeSlideIndex:w,setActiveSlideIndex:C,selectedElementId:T,setSelectedElementId:M,selectedElementIds:_,setSelectedElementIds:E,isDirty:R,setIsDirty:I,inlineEditingElementId:F,setInlineEditingElementId:G,inlineEditingText:D,setInlineEditingText:j,editTemplateMode:Y,setEditTemplateMode:ge,newShapeType:fe,setNewShapeType:de,clipboardPayload:J,setClipboardPayload:re,pointerCommitNonce:ce,setPointerCommitNonce:ae,headerFooter:_e,setHeaderFooter:xe,layoutOptions:Ee,setLayoutOptions:W,slideMasters:q,setSlideMasters:Q,theme:se,setTheme:me,tableStyleMap:P,setTableStyleMap:A,themeOptions:O,setThemeOptions:z,customShows:te,setCustomShows:$,activeCustomShowId:Me,setActiveCustomShowId:De,sections:V,setSections:B,presentationProperties:ee,setPresentationProperties:oe,notesMaster:pe,setNotesMaster:Ae,handoutMaster:Le,setHandoutMaster:ue,notesCanvasSize:we,setNotesCanvasSize:Ie,customProperties:He,setCustomProperties:Oe,tagCollections:$e,setTagCollections:ot,coreProperties:at,setCoreProperties:gt,appProperties:le,setAppProperties:Ue,embeddedFonts:Te,setEmbeddedFonts:Ve,hasMacros:Fe,setHasMacros:ke,hasDigitalSignatures:nt,setHasDigitalSignatures:st,digitalSignatureCount:Xn,setDigitalSignatureCount:Cn,activeMasterIndex:Zi,setActiveMasterIndex:bs,activeLayoutIndex:m0,setActiveLayoutIndex:Pv,preMasterMode:g0,setPreMasterMode:sf,masterViewTab:Ev,setMasterViewTab:x0,handoutSlidesPerPage:y0,setHandoutSlidesPerPage:pl,...af}}function kz(){let[t,e]=useState(false),[n,r]=useState("home"),[o,i]=useState(()=>typeof window>"u"?true:window.innerWidth>=768),[s,a]=useState(false),[l,c]=useState(true),[d,u]=useState(false),[p,h]=useState(false),[f,m]=useState("properties"),[x,g]=useState(false),[y,b]=useState(false),[v,S]=useState(false),[w,C]=useState([]),[T,M]=useState(null),[_,E]=useState(null),[R,I]=useState(true),[L,k]=useState(false),[F,N]=useState(false),[D,U]=useState(true),[G,j]=useState(true),[Y,ge]=useState([]),[fe,de]=useState(null),[J,re]=useState([]),[ce,ae]=useState(new Map),[_e,xe]=useState("select"),[Ee,W]=useState("#000000"),[q,Q]=useState(3),[se,me]=useState(false),[P,A]=useState(false),[O,z]=useState(false),[te,$]=useState(false),[Me,De]=useState(false);return {isCompactToolbarOpen:t,setIsCompactToolbarOpen:e,toolbarSection:n,setToolbarSection:r,isSlidesPaneOpen:o,setIsSlidesPaneOpen:i,isInspectorPaneOpen:s,setIsInspectorPaneOpen:a,isSlideNotesCollapsed:l,setIsSlideNotesCollapsed:c,isOverflowMenuOpen:d,setIsOverflowMenuOpen:u,isSidebarCollapsed:p,setIsSidebarCollapsed:h,sidebarPanelMode:f,setSidebarPanelMode:m,showSlideSorter:x,setShowSlideSorter:g,isShortcutHelpOpen:y,setIsShortcutHelpOpen:b,isAccessibilityPanelOpen:v,setIsAccessibilityPanelOpen:S,accessibilityIssues:w,setAccessibilityIssues:C,contextMenuState:T,setContextMenuState:M,tableEditorState:_,setTableEditorState:E,spellCheckEnabled:R,setSpellCheckEnabled:I,showGrid:L,setShowGrid:k,showRulers:F,setShowRulers:N,snapToGrid:D,setSnapToGrid:U,snapToShape:G,setSnapToShape:j,guides:Y,setGuides:ge,marqueeSelectionState:fe,setMarqueeSelectionState:de,snapLines:J,setSnapLines:re,mediaDataUrls:ce,setMediaDataUrls:ae,activeTool:_e,setActiveTool:xe,drawingColor:Ee,setDrawingColor:W,drawingWidth:q,setDrawingWidth:Q,isThemeEditorOpen:se,setIsThemeEditorOpen:me,isThemeGalleryOpen:P,setIsThemeGalleryOpen:A,formatPainterActive:O,setFormatPainterActive:z,isSelectionPaneOpen:te,setIsSelectionPaneOpen:$,eyedropperActive:Me,setEyedropperActive:De}}function Iz(t){let e=Rz(),n=kz();return {...e,...n}}bt();Pe();function Lz({content:t,clearSelection:e,history:n,setSlides:r,setTemplateElementsBySlideId:o,mediaDataUrls:i,setCanvasSize:s,setHeaderFooter:a,setLayoutOptions:l,setSlideMasters:c,setTheme:d,setTableStyleMap:u,setThemeOptions:p,setCustomShows:h,setSections:f,setPresentationProperties:m,setNotesMaster:x,setHandoutMaster:g,setNotesCanvasSize:y,setCustomProperties:b,setTagCollections:v,setCoreProperties:S,setAppProperties:w,setEmbeddedFonts:C,setActiveSlideIndex:T,setHasMacros:M,setHasDigitalSignatures:_,setDigitalSignatureCount:E,setGuides:R,setLoading:I,setError:L,setIsDirty:k,setIsEncrypted:F}){let N=useRef(null),D=useRef(null),U=useRef(0);return useEffect(()=>{if(!t)return;let G=false,j=++U.current,Y=[];return (async()=>{try{I(!0),L(null);let ge=t instanceof Uint8Array?t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength):t;D.current=ge instanceof ArrayBuffer?ge:null;let fe=ge instanceof ArrayBuffer?ge.byteLength/(1024*1024):0;fe>50&&console.warn(`[pptx] Large file detected (${fe.toFixed(1)} MB). Loading may use significant memory.`);let de=N.current,J=new Nd,re=await J.load(ge);if(G||j!==U.current){J.dispose();return}de&&de.dispose(),N.current=null;let ce=[];for(let W of re.slides)xA(W.elements,ce);for(let W of i.values())W.startsWith("blob:")&&URL.revokeObjectURL(W);i.clear(),await Promise.all(ce.map(async W=>{let q=W.mediaPath;if(!q){W.mediaMissing=!0;return}try{if(W.mediaType==="audio"||W.mediaType==="video"){let se=await J.getMediaArrayBuffer(q);if(se){let me=W.mediaMimeType||"application/octet-stream",P=new Blob([se],{type:me}),A=URL.createObjectURL(P);Y.push(A),i.set(q,A);}else W.mediaMissing=!0;}else {let se=await J.getImageData(q);se?i.set(q,se):W.mediaMissing=!0;}}catch{W.mediaMissing=!0;}}));let{paths:ae,refs:_e}=h4(re.slides),xe=re.slides;if(ae.size>0){let W=new Map;await Promise.all(Array.from(ae).map(async Q=>{try{let se=await J.getImageData(Q);se&&W.set(Q,se);}catch{}}));let q=new Map;for(let Q of _e){let se=W.get(Q.path);if(!se)continue;let me=Q.element.id,P=q.get(me)??{};P[Q.field]=se,q.set(me,P);}if(q.size>0){let Q=se=>{let me=!1,P=se.map(A=>{let O=A,z=q.get(A.id);if(z&&(O={...A,...z}),O.type==="group"&&O.children?.length){let te=Q(O.children);te!==O.children&&(O={...O,children:te});}return O!==A&&(me=!0),O});return me?P:se};xe=re.slides.map(se=>{let me=Q(se.elements);return me===se.elements?se:{...se,elements:me}});}}N.current=J;let Ee=zre(xe);r(Ee.slides),o(Ee.templateElementsBySlideId),s({width:re.width??1280,height:re.height??720}),a(re.headerFooter??{}),l(re.layoutOptions??[]),c(re.slideMasters??[]),d(re.theme),u(re.tableStyleMap),p(re.themeOptions??[]),h(re.customShows??[]),f(re.sections??[]),m(re.presentationProperties??{}),x(re.notesMaster),g(re.handoutMaster),typeof re.notesWidthEmu=="number"&&typeof re.notesHeightEmu=="number"&&re.notesWidthEmu>0&&re.notesHeightEmu>0?y({width:Math.round(re.notesWidthEmu/9525),height:Math.round(re.notesHeightEmu/9525)}):y(void 0),b(re.customProperties??[]),v(re.tags??[]),S(re.coreProperties),w(re.appProperties),C(re.embeddedFonts??[]),M(re.hasMacros===!0),_(re.hasDigitalSignatures===!0),E(re.digitalSignatureCount??0),R(f4(re.presentationGuides,re.slides[0]?.guides)),T(0),e(),k(!1),n.resetHistory();}catch(ge){!G&&j===U.current&&(ge instanceof u_?F(true):L(ge instanceof Error?ge.message:String(ge)));}finally{!G&&j===U.current&&I(false);}})(),()=>{G=true;for(let ge of Y)URL.revokeObjectURL(ge);N.current&&(N.current.dispose(),N.current=null);}},[t]),{handlerRef:N}}Pe();function Lde(t){return Math.max(t,10)*1e3}function Dz(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),d=useRef(r),u=useRef(false);useEffect(()=>{l.current=e;},[e]),useEffect(()=>{c.current=n;},[n]),useEffect(()=>{d.current=r;},[r]);let p=useCallback(async()=>{if(c.current&&l.current&&!u.current){u.current=true,a({state:"saving"});try{let h=await d.current();if(!h){a({state:"idle"}),u.current=!1;return}await fre(c.current,h),a({state:"saved",timestamp:Date.now()});}catch(h){a({state:"error",message:h instanceof Error?h.message:"Autosave failed"});}finally{u.current=false;}}},[]);return useEffect(()=>{if(!i){a({state:"disabled",reason:"autosave_toggle_off"});return}if(!n){a({state:"disabled",reason:"no_file_path"});return}a(m=>m.state==="disabled"?{state:"idle"}:m);let h=Lde(o),f=setInterval(()=>{p();},h);return ()=>clearInterval(f)},[i,n,o,p]),{autosaveStatus:s,triggerAutosave:p}}bt();function Fz(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,selectedElementId:o,editTemplateMode:i,templateElements:s,history:a,setSlides:l,setTemplateElementsBySlideId:c,setSelectedElementId:d,setSelectedElementIds:u,setInlineEditingElementId:p,setContextMenuState:h}=t,f=useCallback((T,M=[])=>{d(T),u(M);},[d,u]),m=useCallback(()=>{f(null,[]),p(null),h(null);},[f,p,h]),x=useCallback((T,M)=>{if(lT(T)){let _=e?.id;_&&c(E=>({...E,[_]:(E[_]??[]).map(R=>R.id===T?{...R,...M}:R)}));}else l(_=>_.map((E,R)=>R!==n?E:{...E,elements:E.elements.map(I=>I.id===T?{...I,...M}:I)}));a.markDirty();},[e?.id,n,a,l,c]),g=useCallback(T=>{o&&x(o,T);},[o,x]),y=useCallback(T=>{!r||!Jt(r)||g({shapeStyle:{...r.shapeStyle,...T}});},[r,g]),b=useCallback(T=>{if(!r||!ze(r))return;let M=vU(r.textSegments);if(M&&r.textSegments){let{newSegments:R,newSelection:I}=SU(r.textSegments,M,T);yU(I),g({textSegments:R});return}let _={...r.textStyle,...T},E=r.textSegments?.map(R=>({...R,style:{...R.style,...T}}));g({textStyle:_,textSegments:E});},[r,g]),v=useCallback(T=>{l(M=>T(M));},[l]),S=i?s:e?.elements??[],w=useCallback(T=>{if(i){let M=e?.id;if(!M)return;c(_=>({..._,[M]:T(_[M]??[])}));}else l(M=>M.map((_,E)=>E===n?{..._,elements:T(_.elements)}:_));},[i,e?.id,n,l,c]),C=useCallback(async()=>null,[]);return {applySelection:f,clearSelection:m,updateElementById:x,updateSelectedElement:g,updateSelectedShapeStyle:y,updateSelectedTextStyle:b,updateSlides:v,activeElements:S,updateActiveElements:w,serializeSlides:C}}Pe();function Oz(t){let{sections:e,setSections:n,slides:r,setSlides:o,markDirty:i}=t,s=useCallback((p,h)=>{let f=Ate(e,r,p,h);o(f.slides),n(f.sections),i();},[e,r,o,n,i]),a=useCallback((p,h)=>{let f=Rte(e,r,p,h);n(f.sections),o(f.slides),i();},[e,r,n,o,i]),l=useCallback(p=>{let h=kte(e,r,p);n(h.sections),o(h.slides),i();},[e,r,n,o,i]),c=useCallback(p=>{n(Ite(e,p)),i();},[e,n,i]),d=useCallback(p=>{n(Nte(e,p)),i();},[e,n,i]),u=useCallback((p,h)=>{let f=Lte(e,r,p,h);o(f.slides),n(f.sections),i();},[e,r,o,n,i]);return {addSection:s,renameSection:a,deleteSection:l,moveSectionUp:c,moveSectionDown:d,moveSlidesToSection:u}}Pe();function oet(t,e,n,r,o,i,s,a,l){let c=bte({x:e,y:n,width:r,height:o},t,i,s,1,{minSize:12}),d={x:c.x,y:c.y,width:c.width,height:c.height};return a?vte(d,t,l,12):d}function iet(t,e,n){let o=e/(n||200);return Math.max(0,Math.min(1,t+o))}function Dde(t,e,n){let{editorScale:r,canvasStageRef:o,canvasSize:i,snapToGrid:s,snapToShape:a,gridSpacingPx:l,editTemplateMode:c,templateElements:d,activeSlide:u,guides:p,elementLookup:h,marqueeStateRef:f,dragStateRef:m,resizeStateRef:x,shapeAdjustmentDragStateRef:g,setMarqueeSelectionState:y,setSnapLines:b,updateElementById:v}=e,S=f.current;if(S){set(t,S,o,i,r,y);return}let w=m.current;if(w){aet(t,w,r,s,a,l,c,d,u,p,h,n,b);return}let C=x.current;if(C){cet(t,C,r,s,l);return}let T=g.current;T&&det(t,T,r,v);}function set(t,e,n,r,o,i){let s=n.current;if(!s)return;let a=s.getBoundingClientRect();e.currentX=Math.max(0,Math.min(r.width,(t.clientX-a.left)/o)),e.currentY=Math.max(0,Math.min(r.height,(t.clientY-a.top)/o)),i({...e});}function aet(t,e,n,r,o,i,s,a,l,c,d,u,p){let h=(t.clientX-e.startClientX)/n,f=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(h)>2||Math.abs(f)>2)&&(e.moved=true),!e.moved)return;let m=h,x=f,g=Object.keys(e.startPositionsById),y=g[0],b=y?e.startPositionsById[y]:void 0,v=y?d.get(y):void 0;if(b&&v){let S=b.x+m,w=b.y+x;if(r&&(S=Math.round(S/i)*i,w=Math.round(w/i)*i),o){let T=(s?a:l?.elements??[]).map(R=>({id:R.id,x:R.x,y:R.y,width:R.width,height:R.height})),M=lU(S,w,v.width,v.height,T,new Set(g),c.map(R=>({axis:R.axis,position:R.position})));S=M.x,w=M.y;let _=M.lines.map(R=>({axis:R.axis==="v"?"x":"y",position:R.position})),E=JSON.stringify(_);E!==u.lastSnapLinesKey&&(u.lastSnapLinesKey=E,p(_));}else u.lastSnapLinesKey!=="[]"&&(u.lastSnapLinesKey="[]",p([]));m=S-b.x,x=w-b.y;}e.lastDx=m,e.lastDy=x;for(let[S,w]of e.domEls){let C=e.startPositionsById[S];C&&(w.style.left=`${C.x+m}px`,w.style.top=`${C.y+x}px`);}}function cet(t,e,n,r,o){let i=(t.clientX-e.startClientX)/n,s=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(i)>2||Math.abs(s)>2)&&(e.moved=true),!e.moved)return;let a=oet(e.handle,e.startX,e.startY,e.startWidth,e.startHeight,i,s,r,o);e.lastX=a.x,e.lastY=a.y,e.lastWidth=a.width,e.lastHeight=a.height,e.domEl&&(e.domEl.style.left=`${a.x}px`,e.domEl.style.top=`${a.y}px`,e.domEl.style.width=`${Math.max(a.width,12)}px`,e.domEl.style.height=`${Math.max(a.height,12)}px`);}function det(t,e,n,r){let o=(t.clientX-e.startClientX)/n,i=iet(e.startAdjustment,o,e.startWidth);!e.moved&&Math.abs(o)>2&&(e.moved=true),e.moved&&r(e.elementId,{shapeAdjustments:{[e.key]:i}});}Pe();function Fde(t){let{editTemplateMode:e,templateElements:n,activeSlide:r,activeSlideIndex:o,marqueeStateRef:i,dragStateRef:s,resizeStateRef:a,shapeAdjustmentDragStateRef:l,setMarqueeSelectionState:c,setSnapLines:d,setTemplateElementsBySlideId:u,setPointerCommitNonce:p,applySelection:h,clearSelection:f,updateSlides:m,updateElementById:x,markDirty:g}=t,y=i.current,b=s.current,v=a.current,S=l.current;if(y&&(uet(y,e,n,r,h,f),i.current=null,c(null)),b?.moved&&pet(b,e,r,o,u,m),v?.moved){let C=v.elementId,T={x:v.lastX,y:v.lastY,width:v.lastWidth,height:v.lastHeight};x(C,T);let M=new Set([C]);m(_=>_.map((E,R)=>{if(R!==o)return E;let I=jA(E.elements,M);return I.length===0?E:{...E,elements:YA(E.elements,I)}}));}let w=b?.moved||v?.moved||S?.moved;i.current=null,s.current=null,a.current=null,l.current=null,c(null),d([]),w&&(g(),p(C=>C+1));}function uet(t,e,n,r,o,i){let s=e?n:r?.elements??[],a=Ste(t,s);if(t.additive){let l=wte(t.baseSelectionIds,a);l.length>0?o(l[0],l):i();}else a.length>0?o(a[0],a):i();}function pet(t,e,n,r,o,i){let s=t.lastDx,a=t.lastDy,l=new Set(Object.keys(t.startPositionsById)),c=d=>{let u=d.map(h=>{let f=t.startPositionsById[h.id];return f?{...h,x:f.x+s,y:f.y+a}:h}),p=jA(u,l);return YA(u,p)};if(e){let d=n?.id;if(!d)return;o(u=>({...u,[d]:c(u[d]??[])}));return}i(d=>d.map((u,p)=>p!==r?u:{...u,elements:c(u.elements)}));}function Bz(t){let{editorScale:e,canvasStageRef:n,canvasSize:r,activeSlide:o,activeSlideIndex:i,gridSpacingPx:s,dragStateRef:a,resizeStateRef:l,shapeAdjustmentDragStateRef:c,marqueeStateRef:d,editTemplateMode:u,snapToGrid:p,snapToShape:h,guides:f,templateElements:m,elementLookup:x,setMarqueeSelectionState:g,setSnapLines:y,setTemplateElementsBySlideId:b,setPointerCommitNonce:v,applySelection:S,clearSelection:w,updateSlides:C,updateElementById:T,markDirty:M}=t;useEffect(()=>{let _={rafId:0,pendingMoveEvent:null,lastSnapLinesKey:""},E=I=>{_.pendingMoveEvent=I,_.rafId===0&&(_.rafId=requestAnimationFrame(()=>{_.rafId=0,_.pendingMoveEvent&&(Dde(_.pendingMoveEvent,t,_),_.pendingMoveEvent=null);}));},R=()=>{_.rafId!==0&&(cancelAnimationFrame(_.rafId),_.rafId=0,_.pendingMoveEvent=null),Fde(t);};return document.addEventListener("pointermove",E),document.addEventListener("pointerup",R),()=>{document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",R),_.rafId!==0&&cancelAnimationFrame(_.rafId);}},[e,n,a,l,c,d,u,p,h,f,m,g,y,x,b,v,o,i,r.width,r.height,s,S,w,C,T,M,t]);}bt();Pe();function Uz(t){let{mode:e,canEdit:n,canvasSize:r,selectedElementId:o,selectedElementIds:i,selectedElementIdSet:s,inlineEditingElementId:a,effectiveSelectedIds:l,elementLookup:c,activeTool:d,editorScale:u,canvasStageRef:p,dragStateRef:h,resizeStateRef:f,shapeAdjustmentDragStateRef:m,marqueeStateRef:x,setInlineEditingElementId:g,setInlineEditingText:y,setContextMenuState:b,setMarqueeSelectionState:v,setSnapLines:S,inlineEditingText:w,ops:C,history:T,presentationHandleAction:M,setEditingEquationOmml:_,setIsEquationDialogOpen:E}=t,R=useRef(false),I=()=>{let de=a;if(!de)return;let J=c.get(de);if(J&&ze(J)){let re=mT(w,J.textSegments,J.textStyle);C.updateElementById(de,{text:w,textSegments:re}),T.markDirty();}g(null),y("");},L=de=>{if(!ze(de))return false;let J=de.textSegments?.find(re=>re.equationXml);return J?.equationXml?(_(J.equationXml),E(true),true):false};return {handleElementClick:(de,J)=>{if(J.stopPropagation(),e==="present"){let re=c.get(de);re?.actionClick&&M(re.actionClick);return}if(J.shiftKey||J.metaKey){let re=i.length?i:o?[o]:[],ce=re.includes(de)?re.filter(ae=>ae!==de):[...re,de];C.applySelection(ce[0]??null,ce);}else if(s.has(de)&&!a)if(R.current)R.current=false;else {let re=c.get(de);re&&ze(re)&&!re.locks?.noTextEdit&&(L(re)||(g(de),y(re.text??"")));}else C.applySelection(de);},handleElementDoubleClick:(de,J)=>{let re=c.get(de);re&&(L(re)||ze(re)&&(g(de),y(re.text??"")));},handleElementMouseDown:(de,J)=>{if(J.button!==0)return;a&&a!==de&&I();let re=s.has(de);re?R.current=false:(C.applySelection(de),R.current=true);let ce=re?l.length?l:[de]:[de],ae={},_e=new Map;for(let xe of ce){let Ee=c.get(xe);Ee&&(ae[xe]={x:Ee.x,y:Ee.y});let W=document.querySelector(`[data-element-id="${xe}"]`);W&&_e.set(xe,W);}h.current={elementId:de,startClientX:J.clientX,startClientY:J.clientY,startPositionsById:ae,domEls:_e,moved:false,lastDx:0,lastDy:0},S([]);},handleElementContextMenu:(de,J)=>{J.preventDefault(),J.stopPropagation(),s.has(de)||C.applySelection(de),b({x:J.clientX,y:J.clientY,elementId:de});},handleCanvasMouseDown:de=>{if(e!=="edit"||!n||de.button!==0||d!=="select")return;a&&I();let J=p.current;if(!J)return;let re=J.getBoundingClientRect(),ce=u||1,ae=Math.max(0,Math.min(r.width,(de.clientX-re.left)/ce)),_e=Math.max(0,Math.min(r.height,(de.clientY-re.top)/ce)),xe=de.shiftKey||de.metaKey,Ee={startX:ae,startY:_e,currentX:ae,currentY:_e,additive:xe,baseSelectionIds:xe?l:[]};x.current=Ee,v(Ee),b(null);},handleResizePointerDown:(de,J,re)=>{J.stopPropagation();let ce=c.get(de);ce&&(f.current={elementId:de,startClientX:J.clientX,startClientY:J.clientY,startX:ce.x,startY:ce.y,startWidth:ce.width,startHeight:ce.height,handle:re,moved:false,domEl:document.querySelector(`[data-element-id="${de}"]`),lastX:ce.x,lastY:ce.y,lastWidth:ce.width,lastHeight:ce.height});},handleAdjustmentPointerDown:(de,J)=>{J.stopPropagation();let re=c.get(de);if(!re||!("shapeType"in re)||!("shapeAdjustments"in re))return;let ce=Object.entries(re.shapeAdjustments??{});if(!ce.length)return;let[ae,_e]=ce[0];m.current={elementId:de,key:ae,shapeType:re.shapeType??"rect",startClientX:J.clientX,startClientY:J.clientY,startAdjustment:_e,startWidth:re.width,startHeight:re.height,moved:false};},handleRotate:(de,J)=>{let re=c.get(de);!re||re.locks?.noRotation||(C.updateElementById(de,{rotation:J}),T.markDirty());},handleUpdateSmartArtElement:(de,J)=>{c.has(de)&&C.updateElementById(de,J);},handleFormatText:de=>{C.updateSelectedTextStyle(de);},handleInlineEditCommit:I}}Pe();function Ode(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 d=new Image;d.onload=()=>{let h=d.naturalWidth||400,f=d.naturalHeight||300;if(h>500||f>400){let m=Math.min(500/h,400/f);h=Math.round(h*m),f=Math.round(f*m);}r({id:Pr(),type:"image",x:Math.round((n.width-h)/2),y:Math.round((n.height-f)/2),width:h,height:f,imageData:c});},d.onerror=()=>{r({id:Pr(),type:"image",x:100,y:100,width:400,height:300,imageData:c});},d.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,d=(p,h,f)=>{r({id:Pr(),type:"media",mediaType:l,mediaMimeType:a.type||void 0,mediaData:p,x:Math.round((n.width-h)/2),y:Math.round((n.height-f)/2),width:h,height:f});};if(c){let p=c.replace(/\\/gu,"/");p.startsWith("/")||(p=`/${p}`);let h=`pptx-resource://media${encodeURI(p)}`;if(l==="audio"){d(h,420,64);return}let f=URL.createObjectURL(a),m=document.createElement("video");m.preload="metadata",m.onloadedmetadata=()=>{URL.revokeObjectURL(f);let x=640,g=360,y=m.videoWidth||x,b=m.videoHeight||g;if(y>x||b>g){let v=Math.min(x/y,g/b);y=Math.round(y*v),b=Math.round(b*v);}d(h,y,b);},m.onerror=()=>{URL.revokeObjectURL(f),d(h,640,360);},m.src=f;return}let u=new FileReader;u.onload=()=>{let p=u.result;if(!p)return;if(l==="audio"){d(p,420,64);return}let h=document.createElement("video");h.preload="metadata",h.onloadedmetadata=()=>{let x=h.videoWidth||640,g=h.videoHeight||360;if(x>640||g>360){let y=Math.min(640/x,360/g);x=Math.round(x*y),g=Math.round(g*y);}d(p,x,g);},h.onerror=()=>{d(p,640,360);},h.src=p;},u.readAsDataURL(a);}}}bt();var cN={"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"},Bde={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 Ude(t,e){return e&&e.startsWith("ppaction://")?e.includes("hlinksldjump")?"slide":(cN[e.toLowerCase()],"action"):t?t.startsWith("mailto:")?"email":/^[a-zA-Z]:\\|^\.\.?[/\\]|^file:/i.test(t)?"file":"url":"url"}function $de(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 Hde(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 zde(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:Bde[t.actionVerb],tooltip:e};default:return {url:t.url,tooltip:e}}}function Vde(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,ops:o,history:i,addElement:s}=t;return {handleInsertSmartArt:(h,f)=>{if(!e)return;let m=f.map((g,y)=>`node-${Date.now()}-${y}-${Math.random().toString(36).slice(2,8)}`),x=f.map((g,y)=>{let b={id:m[y],text:g};return h==="hierarchy"&&y>0&&(b.parentId=m[0]),b});s({id:Pr(),type:"smartArt",x:100,y:120,width:600,height:340,smartArtData:{layout:h,colorScheme:"colorful1",style:"flat",nodes:x}});},handleInsertEquation:h=>{e&&s({id:Pr(),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:h}]});},handleUpdateEquation:h=>{let f=r[0];if(!f)return;let m=[{text:"[Equation]",style:{fontSize:18,fontFamily:"Cambria Math"},equationXml:h}];o.updateElementById(f.id,{textSegments:m}),i.markDirty();},handleHyperlinkConfirm:h=>{let f=r[0];if(!f)return;let m=zde(h),x={url:m.url||void 0,action:m.action,tooltip:m.tooltip};o.updateElementById(f.id,{actionClick:x}),i.markDirty();},handleInsertField:(h,f)=>{if(!e)return;let m={slidenum:String(n+1),datetime:new Date().toLocaleDateString(),header:"Header",footer:"Footer"},x=f||m[h]||h,g=`{${crypto.randomUUID().toUpperCase()}}`;s({id:Pr(),type:"shape",x:120,y:200,width:200,height:40,text:x,textStyle:{fontSize:14},textSegments:[{text:x,style:{fontSize:14},fieldType:h,fieldGuid:g}]});},handleAddActionButton:h=>{if(!e)return;let f=sh.find(x=>x.shapeType===h);if(!f)return;let m=lS({type:f.defaultAction});m&&(m.tooltip=f.label,m.highlightClick=true),s({id:Pr(),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:m});}}}function Hz(t){let{activeSlide:e,activeSlideIndex:n,canvasSize:r,newShapeType:o,selectedElements:i,ops:s,history:a}=t,l=y=>{s.updateSlides(b=>b.map((v,S)=>S===n?{...v,elements:[...v.elements,y]}:v)),s.applySelection(y.id),a.markDirty();},c=()=>{e&&l({id:Pr(),type:"text",x:100,y:100,width:300,height:60,text:"",textStyle:{fontSize:24}});},d=()=>{e&&l({id:Pr(),type:"shape",x:150,y:150,width:200,height:150,shapeType:o,shapeStyle:{fillColor:"#3b82f6",strokeColor:"#1f2937",strokeWidth:2}});},u=()=>{if(!e)return;let y=Array.from({length:3},()=>({cells:Array.from({length:3},()=>({text:"",style:{}}))})),b=Array.from({length:3},()=>1/3);l({id:Pr(),type:"table",x:100,y:200,width:600,height:250,tableData:{rows:y,columnWidths:b}});},p=y=>{e&&l(cre(y));},h=Vde({activeSlide:e,activeSlideIndex:n,selectedElements:i,ops:s,history:a,addElement:l}),f=Ode({activeSlide:e,canvasSize:r,addElement:l});return {handleAddTextBox:c,handleAddShape:d,handleAddTable:u,handleAddChart:p,...h,handleAddInkElement:y=>{e&&(s.updateSlides(b=>b.map((v,S)=>S===n?{...v,elements:[...v.elements,y]}:v)),a.markDirty());},handleAddFreeformShape:y=>{e&&l(y);},handleEraseInkElement:y=>{e&&(s.updateSlides(b=>b.map((v,S)=>S===n?{...v,elements:v.elements.filter(w=>w.id!==y)}:v)),a.markDirty());},...f}}function Gde(t){let{activeSlide:e,selectedElement:n,effectiveSelectedIds:r,editTemplateMode:o,clipboardPayload:i,setClipboardPayload:s,ops:a,history:l}=t,c=()=>{n&&s({element:structuredClone(n),isTemplate:o});},d=()=>{let f=r;if(!f.length||!e)return;let m=new Set(f);a.updateActiveElements(x=>x.filter(g=>!m.has(g.id))),a.clearSelection(),l.markDirty();};return {handleCopy:c,handleCut:()=>{c(),d();},handlePaste:()=>{if(!i||!e)return;let f=structuredClone(i.element);f.id=ET(o,i.element.id),f.x+=20,f.y+=20,a.updateActiveElements(m=>[...m,f]),a.applySelection(f.id),l.markDirty();},handleDuplicate:()=>{if(!n||!e)return;let f=structuredClone(n);f.id=ET(o,n.id),f.x+=20,f.y+=20,a.updateActiveElements(m=>[...m,f]),a.applySelection(f.id),l.markDirty();},handleDelete:d}}Pe();bt();function get(t){return t.type==="shape"||t.type==="image"||t.type==="picture"}function xet(t){if("pathData"in t&&typeof t.pathData=="string"&&t.pathData)return t.pathData;if("shapeType"in t&&typeof t.shapeType=="string"){let e=xS(t.shapeType);if(e){let n=yet(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 yet(t,e,n){let r=t.match(/polygon\((?<points>[^)]+)\)/iu);if(!r?.groups)return null;let o=r.groups.points.split(",").map(a=>a.trim()),i=[];for(let a of o){let l=a.split(/\s+/u);if(l.length<2)continue;let c=l[0],d=l[1],u,p;c.endsWith("%")?u=parseFloat(c)/100*e:u=parseFloat(c),d.endsWith("%")?p=parseFloat(d)/100*n:p=parseFloat(d),!isNaN(u)&&!isNaN(p)&&i.push({x:u,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 bet(t,e){let n=ni(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 qs(a)}function Wde(t,e,n,r,o){let i=ni(t);if(i.length===0)return t;let s=i.map(a=>a.map(l=>({x:l.x-e,y:l.y-n})));return qs(s)}function Xde(t){let e=ni(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 jde(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,effectiveSelectedIds:o,setSelectedElementIds:i,ops:s,history:a}=t,l=r.filter(get),c=l.length>=2;return {handleMergeShapes:u=>{if(!c||!e)return;let p=l;if(p.length<2)return;let h=p.map(f=>{let m=xet(f);return bet(m,f)});if(u==="fragment"){let f=[],m=h[0];for(let y=1;y<h.length;y++){let b=R_("fragment",m,h[y]);Array.isArray(b)&&(f=b),y<h.length-1&&f.length>0&&(m=f[0]);}if(f.length===0)return;let x=new Set(o),g=[];for(let y of f){if(!y)continue;let b=Xde(y);if(b.width<=0||b.height<=0)continue;let v=Wde(y,b.x,b.y),S={id:Pr(),type:"shape",x:b.x,y:b.y,width:b.width,height:b.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:p[0].opacity??1,rawXml:{},shapeStyle:{...p[0].shapeStyle},shapeType:"custGeom",pathData:v,pathWidth:b.width,pathHeight:b.height};g.push(S);}if(g.length===0)return;s.updateSlides(y=>y.map((b,v)=>v===n?{...b,elements:[...b.elements.filter(S=>!x.has(S.id)),...g]}:b)),i(g.map(y=>y.id)),a.markDirty();}else {let f=h[0];for(let v=1;v<h.length;v++){let S=R_(u,f,h[v]);typeof S=="string"&&(f=S);}if(!f)return;let m=Xde(f);if(m.width<=0||m.height<=0)return;let x=Wde(f,m.x,m.y),g=p[0],y={id:Pr(),type:"shape",x:m.x,y:m.y,width:m.width,height:m.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:g.opacity??1,rawXml:{},shapeStyle:{...g.shapeStyle},shapeType:"custGeom",pathData:x,pathWidth:m.width,pathHeight:m.height},b=new Set(o);s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements.filter(C=>!b.has(C.id)),y]}:S)),s.applySelection(y.id),a.markDirty();}},canMergeShapes:c}}var vet={left:"left",center:"centerH",right:"right",top:"top",middle:"middle",bottom:"bottom"};function Yde(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,selectedElements:i,elementLookup:s,setSelectedElementIds:a,ops:l,history:c}=t,d=()=>{let v=o;if(v.length<2||!e)return;let{elements:S,groupId:w}=Tte(l.activeElements,v,Pr());w!==null&&(l.updateActiveElements(()=>S),l.applySelection(w),c.markDirty());},u=()=>{if(!r||r.type!=="group"||!e)return;let v=r,S=lT(v.id),w=v.children.map(C=>({...structuredClone(C),id:S?ET(true,C.id||v.id):C.id||Pr(),x:C.x+v.x,y:C.y+v.y}));l.updateActiveElements(C=>[...C.filter(T=>T.id!==v.id),...w]),a(w.map(C=>C.id)),c.markDirty();},p=v=>{if(!r)return;let S=v==="horizontal"?{flipHorizontal:!r.flipHorizontal}:{flipVertical:!r.flipVertical};l.updateSelectedElement(S),c.markDirty();},h=v=>{if(i.length<2)return;let S=vet[v];if(!S)return;let w=xte(i,S);for(let[C,T]of w){let M=s.get(C);M&&l.updateElementById(C,{x:T.x??M.x,y:T.y??M.y});}c.markDirty();},f=v=>{if(i.length<3)return;let S=v==="horizontal"||v==="vertical"?v:null;if(!S)return;let w=yte(i,S);for(let[C,T]of w){let M=s.get(C);M&&l.updateElementById(C,{x:T.x??M.x,y:T.y??M.y});}c.markDirty();},m=i.length>=3,x=v=>{if(!r||!e)return;let S=r.id;l.updateActiveElements(w=>v==="forward"?_te(w,S):v==="backward"?Pte(w,S):w),c.markDirty();},g=v=>{if(!r||!e)return;let S=r.id;l.updateActiveElements(w=>v==="front"?Cte(w,S):Mte(w,S)),c.markDirty();},{handleMergeShapes:y,canMergeShapes:b}=jde({activeSlide:e,activeSlideIndex:n,selectedElements:i,effectiveSelectedIds:o,setSelectedElementIds:a,ops:l,history:c});return {handleGroupElements:d,handleUngroupElement:u,handleFlip:p,handleAlignElements:h,handleDistributeElements:f,canDistribute:m,handleMoveLayer:x,handleMoveLayerToEdge:g,handleMergeShapes:y,canMergeShapes:b}}function zz(t){let{setIsInspectorPaneOpen:e,setSidebarPanelMode:n,onOpenHyperlinkDialog:r}=t,{handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleDelete:l}=Gde(t),{handleGroupElements:c,handleUngroupElement:d,handleFlip:u,handleAlignElements:p,handleDistributeElements:h,canDistribute:f,handleMoveLayer:m,handleMoveLayerToEdge:x,handleMergeShapes:g,canMergeShapes:y}=Yde(t);return {handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleGroupElements:c,handleUngroupElement:d,handleDelete:l,handleFlip:u,handleAlignElements:p,handleDistributeElements:h,canDistribute:f,handleMoveLayer:m,handleMoveLayerToEdge:x,handleMergeShapes:g,canMergeShapes:y,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":m("forward");break;case "send-backward":case "sendBackward":m("backward");break;case "bring-front":case "bringToFront":x("front");break;case "send-back":case "sendToBack":x("back");break;case "comment":case "addComment":e(true),n("comments");break;case "group":c();break;case "ungroup":d();break;case "editHyperlink":r();break}}}}Pe();function wet(t,e,n){let r=[...t],o=Math.max(0,Math.min(e+1,r.length));return r.splice(o,0,n),r}function Vz(t){let{slides:e,activeSlideIndex:n,setActiveSlideIndex:r,ops:o,history:i,handlerRef:s}=t;return {handleAddSlide:()=>{let f=aU(e.length+1);o.updateSlides(m=>{let x=[...m];return x.splice(n+1,0,f),x}),r(n+1),i.markDirty();},handleMoveSlide:(f,m)=>{f!==m&&(o.updateSlides(x=>{let g=[...x],[y]=g.splice(f,1);return g.splice(m,0,y),g}),r(m),i.markDirty());},handleSlideContextMenu:(f,m)=>{},handleDeleteSlides:f=>{if(f.length===0||e.length<=1)return;let m=[...f].sort((g,y)=>y-g);o.updateSlides(g=>{let y=[...g];for(let b of m)y.length>1&&y.splice(b,1);return y});let x=Math.min(...f);r(Math.min(x,e.length-f.length-1,Math.max(e.length-f.length-1,0))),i.markDirty();},handleDuplicateSlides:f=>{if(f.length===0)return;let m=[...f].sort((x,g)=>x-g);o.updateSlides(x=>{let g=[...x],y=0;for(let b of m){let v=g[b+y];if(!v)continue;let S={...v,id:sU(),elements:v.elements.map(w=>({...w,id:`${w.id}-dup-${Math.random().toString(36).slice(2,6)}`}))};g.splice(b+y+1,0,S),y++;}return g}),i.markDirty();},handleToggleHideSlides:f=>{f.length!==0&&(o.updateSlides(m=>{let x=[...m];for(let g of f){let y=x[g];y&&(x[g]={...y,hidden:!y.hidden});}return x}),i.markDirty());},handleInsertSlideFromLayout:(f,m)=>{let x=n+1,g={...aU(e.length+1),layoutPath:f,...m?{layoutName:m}:{}},y=[];o.updateSlides(v=>(y=wet(v,n,g),y)),r(x),i.markDirty();let b=s?.current;b&&b.applyLayoutToSlide(x,f,y).then(v=>{o.updateSlides(S=>{if(S[x]?.id!==g.id)return S;let w=[...S];return w[x]=v,w});},()=>{});}}}function Kde(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:d,columnIndex:u}=n,p=e.tableData,h=p.rows[d]?.cells[u];if(!h)return;let f=Math.max(1,h.gridSpan??1),m=u+f,x=p.rows[d]?.cells[m];if(!x||x.hMerge||x.vMerge)return;let g=Oy([{row:d,col:u},{row:d,col:m}],p),y={tableData:g},b=Sp(e,g);b&&(y.rawXml=b),o.updateSelectedElement(y),i.markDirty();},handleMergeCellDown:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,h=p.rows[d]?.cells[u];if(!h)return;let f=Math.max(1,h.rowSpan??1),m=d+f;if(m>=p.rows.length)return;let x=p.rows[m]?.cells[u];if(!x||x.hMerge||x.vMerge)return;let g=Oy([{row:d,col:u},{row:m,col:u}],p),y={tableData:g},b=Sp(e,g);b&&(y.rawXml=b),o.updateSelectedElement(y),i.markDirty();},handleMergeSelectedCells:()=>{if(!e||e.type!=="table"||!e.tableData||!n||!n.selectedCells||n.selectedCells.length<2)return;let d=e.tableData,u=Oy(n.selectedCells,d),p={tableData:u},h=Sp(e,u);h&&(p.rawXml=h),o.updateSelectedElement(p),r({rowIndex:n.rowIndex,columnIndex:n.columnIndex}),i.markDirty();},handleSplitCell:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,h=OA(d,u,p),f={tableData:h},m=Sp(e,h);m&&(f.rawXml=m),o.updateSelectedElement(f),i.markDirty();}}}Pe();function qde(t){let{selectedElement:e,tableEditorState:n,elementLookup:r,setTableEditorState:o,ops:i,history:s}=t;return {handleCommitCellEdit:(m,x,g,y)=>{let b=r.get(m);if(!b||b.type!=="table")return;let v={};if(b.tableData){let S=b.tableData.rows.map((w,C)=>C!==x?w:{...w,cells:w.cells.map((T,M)=>M!==g?T:{...T,text:y})});v.tableData={...b.tableData,rows:S};}if(b.rawXml){let S=hS(b,x,g,y);S&&(v.rawXml=S);}Object.keys(v).length!==0&&(i.updateElementById(m,v),s.markDirty(),o({rowIndex:x,columnIndex:g,elementId:m}));},handleUpdateCellTextStyle:m=>{if(!e||e.type!=="table"||!n)return;let x=e.id,{rowIndex:g,columnIndex:y}=n,b={};if(e.rawXml){let v=fS(e,g,y,m);v&&(b.rawXml=v);}if(e.tableData){let v=e.tableData.rows.map((S,w)=>w!==g?S:{...S,cells:S.cells.map((C,T)=>T!==y?C:{...C,style:{...C.style,...m}})});b.tableData={...e.tableData,rows:v};}Object.keys(b).length!==0&&(i.updateElementById(x,b),s.markDirty());},handleResizeTableColumns:(m,x)=>{let g=r.get(m);!g||g.type!=="table"||!g.tableData||(i.updateElementById(m,{tableData:{...g.tableData,columnWidths:x}}),s.markDirty());},handleResizeTableRow:(m,x,g)=>{let y=r.get(m);if(!y||y.type!=="table"||!y.tableData)return;let b=y.tableData.rows.map((v,S)=>S===x?{...v,height:g}:v);i.updateElementById(m,{tableData:{...y.tableData,rows:b}}),s.markDirty();},handleInsertTableRow:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=n?.rowIndex??0,g=rte(e.tableData,x,m),y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();},handleDeleteTableRow:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData,x=n?.rowIndex??0,g=ote(m,x);if(g===m)return;let y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();},handleInsertTableColumn:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=n?.columnIndex??0,g=ste(e.tableData,x,m),y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();},handleDeleteTableColumn:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData,x=n?.columnIndex??0,g=ate(m,x);if(g===m)return;let y={tableData:g},b=wp(e,g);b&&(y.rawXml=b),i.updateSelectedElement(y),s.markDirty();}}}function Gz(t){let e=qde(t),n=Kde(t);return {...e,...n}}Pe();Pe();function f2(t){return t.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function Wz(t,e){try{return window.prompt(t,e)}catch{return null}}function Zde(t){try{return window.confirm(t)}catch{return false}}function dN(t,e){ru(t,gre(e));}Pe();Pe();async function Jde(t,e={}){let n=e.onclone;return Tet(t,{...e,onclone:async(r,o)=>{await Pre(r,o),TR(o),typeof n=="function"&&n(r,o);}})}async function Bu(t,e=2,n){return await Jde(t,{scale:e,useCORS:true,allowTaint:true,backgroundColor:n??null,logging:false,ignoreElements:o=>{let i=o;return !!(i.dataset?.exportIgnore==="true"||i.classList?.contains("pointer-events-none")&&(i.classList.contains("z-50")||i.classList.contains("z-[60]")))}})}function Uh(t=100){return new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(e,t);});});})}async function Xz(t,e={}){let{scale:n=2,backgroundColor:r}=e,o=await Bu(t,n,r);return new Promise((i,s)=>{o.toBlob(a=>{a?i(a):s(new Error("Canvas toBlob returned null"));},"image/png");})}async function jz(t,e,n={}){let r=await Xz(t,n);ru(r,`slide-${e+1}.png`);}async function Yz(t,e={}){let n=await Xz(t,e);await navigator.clipboard.write([new ClipboardItem({"image/png":n})]);}async function Kz(t,e,n,r,o="presentation.pdf",i={}){let{scale:s=2,onProgress:a,signal:l}=i,c=[];for(let u=0;u<e;u++){if(l?.aborted)throw new DOMException("Export cancelled","AbortError");a?.(u,e),n(u),await Uh(150);let p=t.current;if(!p){console.warn(`[export] Could not find slide stage element for slide ${u}`);continue}let h=await Bu(p,s);c.push(pR(h));}if(a?.(e,e),n(r),c.length===0)throw new Error("No slides were captured for PDF export");let d=f6(c);uR(d,o);}async function qz(t,e,n,r,o={}){let{scale:i=2,onProgress:s}=o,a=[];for(let l=0;l<e;l++){s?.(l,e),n(l),await Uh(150);let c=t.current;if(!c){console.warn(`[export] Could not find slide stage element for slide ${l}`);continue}let d=await Bu(c,i);a.push(d.toDataURL("image/png"));}return s?.(e,e),n(r),a}async function Zz(t,e,n,r,o,i="presentation-notes.pdf",s={}){let{scale:a=2,onProgress:l,signal:c}=s,d=[];for(let p=0;p<e;p++){if(c?.aborted)throw new DOMException("Export cancelled","AbortError");l?.(p,e),n(p),await Uh(150);let h=t.current;if(!h){console.warn(`[export] Could not find slide stage element for slide ${p}`);continue}let f=await Bu(h,a);d.push({canvas:f,notes:o[p],slideNumber:p+1});}if(l?.(e,e),n(r),d.length===0)throw new Error("No slides were captured for notes PDF export");let u=qR(d);uR(u,i);}Pe();async function Jz(t,e,n,r,o={}){let{scale:i=1,slideDurationMs:s=3e3,slideTimingsMs:a,onProgress:l,onRecordProgress:c,signal:d}=o,u=[];for(let v=0;v<e;v++){if(d?.aborted)throw new DOMException("Export cancelled","AbortError");l?.(v,e),n(v),await Uh(150);let S=t.current;if(!S){console.warn(`[export] Could not find slide stage element for slide ${v}`);continue}let w=await Bu(S,i);u.push(w);}if(n(r),u.length===0)throw new Error("No slides were captured for video export");let p=u[0],h=document.createElement("canvas");h.width=p.width,h.height=p.height;let f=h.getContext("2d");if(!f)throw new Error("Failed to create 2D context for video recording");let m=30,x=h.captureStream(m),g=new MediaRecorder(x,{mimeType:Ire([...kre]),videoBitsPerSecond:5e6}),y=[];g.ondataavailable=v=>{v.data.size>0&&y.push(v.data);};let b=new Promise((v,S)=>{g.onstop=()=>v(),g.onerror=w=>S(w);});g.start();for(let v=0;v<u.length;v++){if(d?.aborted)throw g.stop(),new DOMException("Export cancelled","AbortError");c?.(v,u.length);let S=a?.[v]??s;f.clearRect(0,0,h.width,h.height),f.drawImage(u[v],0,0);let w=Nre(m),C=Lre(S,m);for(let T=0;T<C;T++){if(d?.aborted)throw g.stop(),new DOMException("Export cancelled","AbortError");f.drawImage(u[v],0,0),await new Promise(M=>{setTimeout(M,w);});}}return g.stop(),await b,l?.(e,e),new Blob(y,{type:"video/webm"})}Pe();async function Qz(t,e,n,r,o={}){let{scale:i=.5,slideDurationMs:s=2e3,onProgress:a,signal:l}=o,c=[];for(let p=0;p<e;p++){if(l?.aborted)throw new DOMException("Export cancelled","AbortError");a?.(p,e),n(p),await Uh(150);let h=t.current;if(!h)continue;let f=await Bu(h,i),m=f.getContext("2d");if(!m)continue;let x=m.getImageData(0,0,f.width,f.height);c.push({imageData:x,width:f.width,height:f.height});}if(n(r),c.length===0)throw new Error("No slides were captured for GIF export");let d=c$(c,Math.round(s/10));a?.(e,e);let u=new ArrayBuffer(d.length);return new Uint8Array(u).set(d),new Blob([u],{type:"image/gif"})}function eV(t){return ["Presentation Package","====================","",`This folder contains the presentation "${t}" along with`,"all linked media files (images, audio, video) in the /media subfolder.","","To view this presentation:","1. Open the .pptx file with any compatible presentation software","2. Ensure the /media folder remains alongside the .pptx file","",`Packaged on ${new Date().toLocaleDateString()}`,""].join(`
4808
4808
  `)}bt();function Cet(t,e){if(!e.length)return t;let n=e.filter(i=>i.css.toLowerCase().includes("</style")?(console.warn(`[export-svg] Dropping @font-face entry for "${i.family}" containing "</style" - would break out of the <style> block.`),false):true);if(!n.length)return t;let r=`<style type="text/css">${n.map(i=>i.css).join(`
4809
4809
  `)}</style>`;if(t.includes("<defs>"))return t.replace("<defs>",`<defs>${r}`);let o=t.indexOf(">");return o===-1?t:`${t.slice(0,o+1)}<defs>${r}</defs>${t.slice(o+1)}`}function tV(t,e={}){let{onProgress:n,embedFonts:r,fontFaces:o}=e,i={includeHidden:e.includeHidden,slideIndices:e.slideIndices,defaultFontFamily:e.defaultFontFamily,defaultFontSize:e.defaultFontSize},s=[],a=i.includeHidden??false,l=0;for(let c=0;c<t.slides.length;c++){if(i.slideIndices&&!i.slideIndices.includes(c))continue;let d=t.slides[c];if(d.hidden&&!a)continue;n?.(l,t.slides.length);let u=eF.exportSlide(d,t.width,t.height,i);r&&o?.length&&(u=Cet(u,o)),s.push(u),l++;}return n?.(l,t.slides.length),s}Pe();Pe();bt();Pe();function Qde(t){let{slides:e,templateElementsBySlideId:n,filePath:r,handlerRef:o,serializeSlides:i,headerFooter:s,presentationProperties:a,customShows:l,sections:c,coreProperties:d,appProperties:u,customProperties:p,notesMaster:h,handoutMaster:f,guides:m,activeSlideIndexForGuides:x,modalControls:g,password:y}=t,{setExportModalOpen:b,setExportModalTitle:v,setExportProgress:S,setExportStatusMessage:w,exportAbortRef:C}=g,T=async()=>{let L=new AbortController;C.current=L,v("Package for Sharing"),w("Preparing package..."),S(0),b(true);try{let k=new Nf,F=k.folder("presentation-package");S(10),w("Adding presentation...");let N=await i(),D=r?r.replace(/\\/gu,"/").split("/").pop()??"presentation.pptx":"presentation.pptx";N&&F.file(D,N),S(70),w("Writing README...");let U=eV(D);if(F.file("README.txt",U),L.signal.aborted)throw new DOMException("Export cancelled","AbortError");S(85),w("Generating ZIP...");let G=await k.generateAsync({type:"blob"});S(95),w("Downloading...");let j=D.replace(/\.[^.]+$/u,"");ru(G,`${j}-package.zip`),S(100);}catch(k){k.name!=="AbortError"&&console.error("[PowerPointViewer] Package export failed:",k);}finally{C.current=null,b(false);}},M=async L=>{let k=o.current;if(!k)return;let F=L==="ppsx"?"ppsx":L==="pptm"?"pptm":"pptx",N=r?r.replace(/\\/gu,"/").split("/").pop()?.replace(/\.[^.]+$/u,"")??"presentation":"presentation";try{let D=await _(k,L),U=new Blob([D],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"});ru(U,`${N}.${F}`);}catch(D){console.error(`[PowerPointViewer] Save as .${F} failed:`,D);}},_=async(L,k)=>{let F=e.map((U,G)=>{if(G!==x)return U;let j=m.map(Y=>({id:Y.id,orientation:Y.axis==="h"?"horz":"vert",positionEmu:sS(Y.position)}));return {...U,guides:j.length>0?j:void 0}}),N=tb(F,n),D={headerFooter:s,presentationProperties:a,customShows:l.length>0?l:void 0,sections:c.length>0?c:void 0,coreProperties:d??void 0,appProperties:u??void 0,customProperties:p.length>0?p:void 0,notesMaster:h,handoutMaster:f,outputFormat:k};return y?L.saveEncrypted(N,y,D):L.save(N,D)};return {handlePackageForSharing:T,handleSaveAsFormat:M,handleSaveAsPptx:()=>{M("pptx");},handleSaveAsPpsx:()=>{M("ppsx");},handleSaveAsPptm:()=>{M("pptm");}}}function nV(t){let{slides:e,templateElementsBySlideId:n,activeSlide:r,activeSlideIndex:o,filePath:i,canvasStageRef:s,setActiveSlideIndex:a,handlerRef:l,serializeSlides:c,headerFooter:d,presentationProperties:u,customShows:p,sections:h,coreProperties:f,appProperties:m,customProperties:x,notesMaster:g,handoutMaster:y,guides:b,activeSlideIndexForGuides:v,password:S}=t,[w,C]=useState(false),[T,M]=useState(""),[_,E]=useState(0),[R,I]=useState(""),L=useRef(null),k={setExportModalOpen:C,setExportModalTitle:M,setExportProgress:E,setExportStatusMessage:I,exportAbortRef:L},{handlePackageForSharing:F,handleSaveAsFormat:N,handleSaveAsPptx:D,handleSaveAsPpsx:U,handleSaveAsPptm:G}=Qde({slides:e,templateElementsBySlideId:n,filePath:i,handlerRef:l,serializeSlides:c,headerFooter:d,presentationProperties:u,customShows:p,sections:h,coreProperties:f,appProperties:m,customProperties:x,notesMaster:g,handoutMaster:y,guides:b,activeSlideIndexForGuides:v,modalControls:k,password:S}),j=useCallback(async()=>{let ce=s.current;if(ce)try{await jz(ce,o,{backgroundColor:r?.backgroundColor});}catch(ae){console.error("[PowerPointViewer] PNG export failed:",ae);}},[s,o,r?.backgroundColor]),Y=useCallback(async()=>{if(!s.current)return;let ce=new AbortController;L.current=ce,M("Export as PDF"),I("Capturing slides..."),E(0),C(true);try{await Kz(s,e.length,a,o,"presentation.pdf",{scale:2,onProgress:(ae,_e)=>{E(vT(ae,_e)),I(Wy("Rendering",ae,_e));},signal:ce.signal}),E(yT),I("Building PDF..."),await new Promise(ae=>{setTimeout(ae,100);}),E(bT),I("Done!");}catch(ae){ST(ae)||console.error("[PowerPointViewer] PDF export failed:",ae);}finally{L.current=null,C(false);}},[s,e.length,a,o]),ge=useCallback(async()=>{if(!s.current)return;let ce=new AbortController;L.current=ce,M("Export as PDF (Notes)"),I("Capturing slides..."),E(0),C(true);try{let ae=e.map(_e=>_e.notes);await Zz(s,e.length,a,o,ae,"presentation-notes.pdf",{scale:2,onProgress:(_e,xe)=>{E(vT(_e,xe)),I(Wy("Rendering",_e,xe));},signal:ce.signal}),E(yT),I("Building PDF..."),await new Promise(_e=>{setTimeout(_e,100);}),E(bT),I("Done!");}catch(ae){ST(ae)||console.error("[PowerPointViewer] Notes PDF export failed:",ae);}finally{L.current=null,C(false);}},[s,e,a,o]),fe=useCallback(async()=>{let ce=s.current;if(ce)try{await Yz(ce,{backgroundColor:r?.backgroundColor});}catch(ae){console.error("[PowerPointViewer] Copy slide as image failed:",ae);}},[s,r?.backgroundColor]),de=useCallback(async()=>{if(!s.current)return;let ce=new AbortController;L.current=ce,M("Export as Video"),I("Capturing slides..."),E(0),C(true);try{let ae=await Jz(s,e.length,a,o,{scale:1,slideDurationMs:3e3,onProgress:(_e,xe)=>{E(vT(_e,xe,45)),I(Wy("Capturing",_e,xe));},onRecordProgress:(_e,xe)=>{E(One(_e,xe)),I(Wy("Recording",_e,xe));},signal:ce.signal});E(yT),I("Saving file..."),dN(ae,"presentation.webm"),E(bT);}catch(ae){ST(ae)||console.error("[PowerPointViewer] Video export failed:",ae);}finally{L.current=null,C(false);}},[s,e.length,a,o]),J=useCallback(async()=>{if(!s.current)return;let ce=new AbortController;L.current=ce,M("Export as GIF"),I("Capturing slides..."),E(0),C(true);try{let ae=await Qz(s,e.length,a,o,{scale:.5,slideDurationMs:2e3,onProgress:(_e,xe)=>{E(vT(_e,xe)),I(Wy("Encoding",_e,xe));},signal:ce.signal});E(yT),I("Saving file..."),dN(ae,"presentation.gif"),E(bT);}catch(ae){ST(ae)||console.error("[PowerPointViewer] GIF export failed:",ae);}finally{L.current=null,C(false);}},[s,e.length,a,o]),re=useCallback(()=>{L.current?.abort(),L.current=null,C(false),E(0);},[]);return {handleExportPng:j,handleExportPdf:Y,handleExportNotesPdf:ge,handleCopySlideAsImage:fe,handleExportVideo:de,handleExportGif:J,handlePackageForSharing:F,handleSaveAsFormat:N,handleSaveAsPptx:D,handleSaveAsPpsx:U,handleSaveAsPptm:G,handleCancelExport:re,exportModalOpen:w,exportModalTitle:T,exportProgress:_,exportStatusMessage:R}}function ket(t){return t.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function pN(t){return typeof t!="string"||!t.startsWith("data:image/")?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNgAAIAAAUAAen63NgAAAAASUVORK5CYII=":ket(t)}function hN(t,e,n,r,o){let i=window.open("","_blank","noopener,noreferrer");if(!i)return false;let s=o?"img.slide-img, .notes-slide, .handout-cell img { border: 2px solid #000 !important; }":"";return i.document.open(),i.document.write(`<!doctype html>
4810
4810
  <html>
@@ -4866,7 +4866,7 @@ ${e}`),sce=(t,e,n)=>{let r=Jn(e),o=sn(),i=vt(r),s=t.messageHandlers[i];return s?
4866
4866
  src: local("${s}"), local("${s} Regular");
4867
4867
  font-display: swap;
4868
4868
  }`]).join(`
4869
- `);return o.textContent=i,document.head.appendChild(o),()=>{let s=document.getElementById(xue);s&&document.head.removeChild(s);}},[n]);}function xV(t){let{content:e,filePath:n,autosaveEnabled:r=true,slides:o,state:i,history:s,ops:a,actionSoundHandlerRef:l,setIsEncryptedDialogOpen:c,password:d}=t,{handlerRef:u}=Lz({content:e,clearSelection:a.clearSelection,history:s,setSlides:i.setSlides,setTemplateElementsBySlideId:i.setTemplateElementsBySlideId,mediaDataUrls:i.mediaDataUrls,setCanvasSize:i.setCanvasSize,setHeaderFooter:i.setHeaderFooter,setLayoutOptions:i.setLayoutOptions,setSlideMasters:i.setSlideMasters,setTheme:i.setTheme,setTableStyleMap:i.setTableStyleMap,setThemeOptions:i.setThemeOptions,setCustomShows:i.setCustomShows,setSections:i.setSections,setPresentationProperties:i.setPresentationProperties,setNotesMaster:i.setNotesMaster,setHandoutMaster:i.setHandoutMaster,setNotesCanvasSize:i.setNotesCanvasSize,setCustomProperties:i.setCustomProperties,setTagCollections:i.setTagCollections,setCoreProperties:i.setCoreProperties,setAppProperties:i.setAppProperties,setEmbeddedFonts:i.setEmbeddedFonts,setActiveSlideIndex:i.setActiveSlideIndex,setHasMacros:i.setHasMacros,setHasDigitalSignatures:i.setHasDigitalSignatures,setDigitalSignatureCount:i.setDigitalSignatureCount,setGuides:i.setGuides,setLoading:i.setLoading,setError:i.setError,setIsDirty:i.setIsDirty,setIsEncrypted:c});useEffect(()=>{l.current=u.current;},[u,l,i.loading]),bue({embeddedFonts:i.embeddedFonts,slides:o});let p=uV({slides:o,templateElementsBySlideId:i.templateElementsBySlideId,activeSlideIndex:i.activeSlideIndex,guides:i.guides,headerFooter:i.headerFooter,presentationProperties:i.presentationProperties,customShows:i.customShows,sections:i.sections,coreProperties:i.coreProperties,appProperties:i.appProperties,customProperties:i.customProperties,notesMaster:i.notesMaster,handoutMaster:i.handoutMaster,handlerRef:u,inlineEditingElementIdRef:i.inlineEditingElementIdRef,inlineEditingTextRef:i.inlineEditingTextRef,password:d}),{autosaveStatus:h}=Dz({isDirty:i.isDirty,filePath:n,serializeSlides:p,enabled:r});return {handlerRef:u,serializeSlides:p,autosaveStatus:h}}var htt=2,ftt=20;function vue(t){let e=useRef(t);e.current=t;let n=useCallback(r=>{let{mode:o,canEdit:i,inlineEditingElementId:s,tableEditorState:a,activeTool:l,hasSelection:c,onDelete:d,onCopy:u,onCut:p,onPaste:h,onDuplicate:f,onUndo:m,onRedo:x,onSelectAll:g,onEscape:y,onNudge:b,onPrevSlide:v,onNextSlide:S}=e.current;if(o!=="edit"||!i)return;let w=r.target,C=w?.tagName==="INPUT"||w?.tagName==="TEXTAREA"||w?.isContentEditable;if(r.key==="Escape"){r.preventDefault(),y();return}if(s||a?.isEditing||l!=="select"||C)return;let T=r.metaKey||r.ctrlKey;if((r.key==="Delete"||r.key==="Backspace")&&c){r.preventDefault(),d();return}if(T)switch(r.key.toLowerCase()){case "z":r.preventDefault(),r.shiftKey?x():m();return;case "y":r.preventDefault(),x();return;case "c":c&&(r.preventDefault(),u());return;case "x":c&&(r.preventDefault(),p());return;case "v":r.preventDefault(),h();return;case "d":c&&(r.preventDefault(),f());return;case "a":r.preventDefault(),g();return}if(c&&(r.key==="ArrowUp"||r.key==="ArrowDown"||r.key==="ArrowLeft"||r.key==="ArrowRight")){r.preventDefault();let M=r.shiftKey?ftt:htt,_=0,E=0;switch(r.key){case "ArrowUp":E=-M;break;case "ArrowDown":E=M;break;case "ArrowLeft":_=-M;break;case "ArrowRight":_=M;break}b(_,E);return}!c&&(r.key==="ArrowLeft"||r.key==="ArrowRight")&&(r.preventDefault(),r.key==="ArrowLeft"?v?.():S?.());},[]);useEffect(()=>{let r=t.containerRef.current;return r&&r.addEventListener("keydown",n),window.addEventListener("keydown",n),()=>{r&&r.removeEventListener("keydown",n),window.removeEventListener("keydown",n);}},[t.containerRef,n]);}function yV(t){let{state:e,mode:n,canEdit:r,slides:o,activeSlide:i,ops:s,manipulation:a,history:l}=t;vue({containerRef:e.containerRef,mode:n,canEdit:r,inlineEditingElementId:e.inlineEditingElementId,tableEditorState:e.tableEditorState,activeTool:e.activeTool,hasSelection:e.effectiveSelectedIds.length>0,effectiveSelectedIds:e.effectiveSelectedIds,onDelete:a.handleDelete,onCopy:a.handleCopy,onCut:a.handleCut,onPaste:a.handlePaste,onDuplicate:a.handleDuplicate,onUndo:l.handleUndo,onRedo:l.handleRedo,onSelectAll:()=>{if(!i)return;let c=i.elements.map(d=>d.id);c.length>0&&s.applySelection(c[0],c);},onEscape:()=>{e.inlineEditingElementId?(e.setInlineEditingElementId(null),e.setInlineEditingText("")):e.contextMenuState?e.setContextMenuState(null):e.tableEditorState?e.setTableEditorState(null):s.clearSelection();},onNudge:(c,d)=>{let u=e.effectiveSelectedIds;if(u.length){for(let p of u){let h=e.elementLookup.get(p);h&&s.updateElementById(p,{x:h.x+c,y:h.y+d});}l.markDirty();}},onPrevSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.max(0,c-1));},onNextSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.min(o.length-1,c+1));}});}function bV(t){let{state:e,zoom:n,history:r,presentation:o,annotations:i,actionSoundHandlerRef:s,editorOps:a,dialogs:l,gridSpacingPx:c,content:d,filePath:u,autosaveEnabled:p,canEdit:h,mode:f,slides:m,activeSlide:x,activeSlideIndex:g,canvasSize:y,loading:b,error:v,ref:S,setContent:w,onContentChange:C,onDirtyChange:T,onActiveSlideChange:M,onModeChange:_,onZoomChange:E,onSelectionChange:R,onSlideCountChange:I}=t;Bz({editorScale:n.editorScale,canvasStageRef:n.canvasStageRef,canvasSize:y,activeSlide:x,activeSlideIndex:g,gridSpacingPx:c,dragStateRef:e.dragStateRef,resizeStateRef:e.resizeStateRef,shapeAdjustmentDragStateRef:e.shapeAdjustmentDragStateRef,marqueeStateRef:e.marqueeStateRef,editTemplateMode:e.editTemplateMode,snapToGrid:e.snapToGrid,snapToShape:e.snapToShape,guides:e.guides,templateElements:e.templateElements,elementLookup:e.elementLookup,setMarqueeSelectionState:e.setMarqueeSelectionState,setSnapLines:e.setSnapLines,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setPointerCommitNonce:e.setPointerCommitNonce,effectiveSelectedIds:e.effectiveSelectedIds,applySelection:a.ops.applySelection,clearSelection:a.ops.clearSelection,updateSlides:a.ops.updateSlides,updateElementById:a.ops.updateElementById,markDirty:r.markDirty});let[L,k]=useState(false),{handlerRef:F,serializeSlides:N,autosaveStatus:D}=xV({content:d,filePath:u,autosaveEnabled:p,slides:m,state:e,history:r,ops:a.ops,actionSoundHandlerRef:s,setIsEncryptedDialogOpen:k,password:l.presentationPassword??void 0}),{exportHandlers:U,printHandlers:G,themeHandlers:j,propertyHandlers:Y}=mV({state:e,slides:m,activeSlideIndex:g,canvasSize:y,filePath:u,history:r,ops:a.ops,zoom:n,handlerRef:F,serializeSlides:N,setContent:w,onContentChange:C,password:l.presentationPassword??void 0}),{showKeepAnnotationsDialog:ge,handleSetMode:fe,handleKeepAnnotations:de,handleDiscardAnnotations:J,handleEnterPresenterView:re,handleEnterRehearsalMode:ce}=dV({mode:f,presentation:o,annotations:i,history:r,setMode:e.setMode,setSlides:e.setSlides});return pV({filePath:u,loading:b,error:v,slideCount:m.length,openVersionHistory:()=>Y.setIsVersionHistoryOpen(true)}),useImperativeHandle(S,()=>({async getContent(){let ae=await N();return ae&&C&&C(ae),ae??new Uint8Array(0)},goTo(ae){ae>=0&&ae<m.length&&e.setActiveSlideIndex(ae);},goPrev(){let ae=g-1;ae>=0&&e.setActiveSlideIndex(ae);},goNext(){let ae=g+1;ae<m.length&&e.setActiveSlideIndex(ae);},undo(){r.handleUndo();},redo(){r.handleRedo();},canUndo(){return r.canUndo},canRedo(){return r.canRedo},getZoom(){return n.scale},setZoom(ae){n.setScale(Math.min(Math.max(ae,.2),5));},zoomIn(){n.handleZoomIn();},zoomOut(){n.handleZoomOut();},zoomReset(){n.handleResetZoom();},getMode(){return f},setMode(ae){e.setMode(ae);},getActiveSlideIndex(){return g},getSlideCount(){return m.length},isDirty(){return e.isDirty},getSelectedElementIds(){return e.selectedElementIds},selectElements(ae){e.setSelectedElementIds(ae),e.setSelectedElementId(ae[0]??null);},clearSelection(){e.setSelectedElementIds([]),e.setSelectedElementId(null);},setActiveSlideIndex(ae){ae>=0&&ae<m.length&&e.setActiveSlideIndex(ae);},getSlides(){return m},getSlide(ae){return m[ae]},getActiveSlide(){return m[g]},addSlide(ae){a.slideOps.handleAddSlide();},deleteSlides(ae){a.slideOps.handleDeleteSlides(ae);},duplicateSlides(ae){a.slideOps.handleDuplicateSlides(ae);},moveSlide(ae,_e){a.slideOps.handleMoveSlide(ae,_e);},toggleHideSlides(ae){a.slideOps.handleToggleHideSlides(ae);},getElements(ae){return m[ae??g]?.elements??[]},getElementById(ae,_e){return m[_e??g]?.elements.find(W=>W.id===ae)},updateElement(ae,_e){a.ops.updateElementById(ae,_e);},deleteElements(ae){e.setSelectedElementIds(ae),e.setSelectedElementId(ae[0]??null),a.manipulation.handleDelete();},duplicateElement(ae){return e.setSelectedElementIds([ae]),e.setSelectedElementId(ae),a.manipulation.handleDuplicate(),e.selectedElementIds[0]}}),[N,C,m,g,e,r,n,f,a]),useEffect(()=>{T&&T(e.isDirty);},[e.isDirty,T]),useEffect(()=>{M&&M(g);},[g,M]),useEffect(()=>{e.activeSlideIndexRef.current=g;},[g,e.activeSlideIndexRef]),useEffect(()=>{_&&_(f);},[f,_]),useEffect(()=>{E&&E(n.scale);},[n.scale,E]),useEffect(()=>{R&&R(e.selectedElementIds);},[e.selectedElementIds,R]),useEffect(()=>{I&&I(m.length);},[m.length,I]),yV({state:e,mode:f,canEdit:h,slides:m,activeSlide:x,ops:a.ops,manipulation:a.manipulation,history:r}),{exportHandlers:U,printHandlers:G,themeHandlers:j,propertyHandlers:Y,showKeepAnnotationsDialog:ge,handleSetMode:fe,handleKeepAnnotations:de,handleDiscardAnnotations:J,handleEnterPresenterView:re,handleEnterRehearsalMode:ce,autosaveStatus:D,isEncryptedDialogOpen:L,setIsEncryptedDialogOpen:k}}function Stt(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function wtt(){return false}function Ttt(t){if(typeof window>"u")return ()=>{};let e=window.matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function vV(){let t=useSyncExternalStore(Ttt,Stt,wtt),[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}}function SV({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}}Pe();var Mtt=5e3;function wV({doc:t,slides:e,templateElementsBySlideId:n,setSlides:r,isConnected:o,isSynced:i=true,config:s,getSourceBytes:a}){let l=useRef(false),c=useRef(""),d=useRef(false),u=useRef(null),p=useRef(null),h=useCallback(async()=>{if(p.current)return p.current;let m=await Promise.resolve().then(()=>(BC(),OC)),x={createMap:()=>new m.Map,createArray:()=>new m.Array,createText:()=>new m.Text};return p.current=x,x},[]),f=useCallback(()=>{if(!s?.onWriteBack||s.role!=="owner"||!t)return;u.current!==null&&clearTimeout(u.current);let m=s.writeBackDebounceMs??Mtt;u.current=setTimeout(async()=>{if(u.current=null,!t||!s.onWriteBack)return;let x=a?.();if(x)try{let{PptxHandler:g}=await Promise.resolve().then(()=>(bt(),Iq)),y=new g;await y.load(x.buffer);let b=IU(t),v=tb(b,n),S=await y.save(v);s.onWriteBack(S);}catch{}},m);},[t,s,a,n]);useEffect(()=>{if(!o||!i||!t||l.current||e.length===0)return;let m=JSON.stringify(e);m!==c.current&&(c.current=m,(async()=>{let x=await h();Pne(e,t,x,JA),f();})());},[t,e,o,i,h,f]),useEffect(()=>{if(!o||!t)return;let m=(g,y)=>{if(y?.origin===JA)return;let b=IU(t);if(b.length===0)return;let v=JSON.stringify(b);v!==c.current&&(c.current=v,l.current=true,r(b),requestAnimationFrame(()=>{l.current=false;}),f());},x=wne(t,m);return d.current||(d.current=true,t.getArray("pptx:slides").length>0&&m()),()=>{x(),u.current!==null&&(clearTimeout(u.current),u.current=null);}},[t,o,r,f]);}function TV({collab:t,activeSlideIndex:e,setActiveSlideIndex:n,slideCount:r,paused:o=false}){let i=useRef(-1);useEffect(()=>{if(!t||o||t.config.role!=="viewer")return;let s=t.remoteUsers.find(l=>l.role==="owner");if(!s)return;let a=s.activeSlideIndex;a<0||a>=r||a!==i.current&&(i.current=a,a!==e&&n(a));},[t,e,n,r,o]);}function MV({collab:t,activeSlideIndex:e,setActiveSlideIndex:n,slideCount:r}){let[o,i]=useState(null),s=useRef(-1),a=useCallback(d=>{s.current=-1,i(d);},[]),l=o===null?null:t?.remoteUsers.find(d=>d.clientId===o)??null;useEffect(()=>{o!==null&&t&&l===null&&i(null);},[t,o,l]);let c=l?.activeSlideIndex??null;return useEffect(()=>{if(!(c===null||c<0||c>=r)){if(c===e){s.current=c;return}s.current=c,n(c);}},[c,r,n]),useEffect(()=>{o!==null&&s.current!==-1&&e!==s.current&&i(null);},[e,o]),{followedClientId:o,followUser:a}}Pe();Pe();function PV(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(d=>d+1))),useEffect(()=>{let d=e.current;if(!d||!o)return;let u=are({getScale:()=>s.current,minScale:.2,maxScale:5,callbacks:{onPinchZoom:x=>i.current.onPinchZoom?.(x),onSwipe:x=>i.current.onSwipe?.(x),onLongPress:(x,g)=>i.current.onLongPress?.(x,g)}}),p=x=>u.onTouchStart(x),h=x=>u.onTouchMove(x),f=x=>u.onTouchEnd(x),m=()=>u.onTouchCancel();return d.addEventListener("touchstart",p,{passive:false}),d.addEventListener("touchmove",h,{passive:false}),d.addEventListener("touchend",f,{passive:true}),d.addEventListener("touchcancel",m,{passive:true}),()=>{d.removeEventListener("touchstart",p),d.removeEventListener("touchmove",h),d.removeEventListener("touchend",f),d.removeEventListener("touchcancel",m),u.cancel();}},[e,o,a]);}Pe();function Dtt(t){if(!(t instanceof HTMLElement))return false;let e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||t.isContentEditable}function Cue(t){if(t<=0||typeof document>"u")return;let e=document.activeElement;if(!Dtt(e))return;let n=e.getBoundingClientRect(),r=Wne({top:n.top,bottom:n.bottom},window.innerHeight,t);r!==0&&window.scrollBy({top:r,behavior:"smooth"});}function EV(t=true){let[e,n]=useState(0);return useEffect(()=>{if(!t||typeof window>"u")return;let r=window.visualViewport;if(!r)return;let o=()=>{let s=FU(window),a=s?DU(s):0;n(a),a>0&&window.requestAnimationFrame(()=>Cue(a));};o(),r.addEventListener("resize",o),r.addEventListener("scroll",o);let i=()=>{window.requestAnimationFrame(()=>{let s=FU(window),a=s?DU(s):0;a>0&&Cue(a);});};return document.addEventListener("focusin",i),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o),document.removeEventListener("focusin",i);}},[t]),{keyboardInset:e,isKeyboardOpen:Gne(e)}}var Utt=[{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 AV({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,d)=>d!==l));},[t,e]),i=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,name:c}:d));},[t,e]),s=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,value:c}:d));},[t,e]),a=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,type:c}:d));},[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:d=>i(c,d.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:d=>s(c,d.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:d=>s(c,d.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:d=>a(c,d.target.value),children:Utt.map(d=>jsx("option",{value:d.value,children:n(d.labelKey)},d.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 ztt=[{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.summary.company",editable:true},{key:"manager",labelKey:"pptx.documentProperties.summary.manager",editable:true}];function Vtt(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 Gtt(t,e,n){return t==="totalTime"?Vtt(e,n):e==null?n("pptx.documentProperties.statistics.notAvailable"):String(e)}function RV({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:ztt.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:Gtt(i,t[i],r)})]},i))})}var Mue=[{key:"title",labelKey:"pptx.properties.titleLabel"},{key:"subject",labelKey:"pptx.properties.subject"},{key:"creator",labelKey:"pptx.properties.author"},{key:"keywords",labelKey:"pptx.properties.keywords"},{key:"description",labelKey:"pptx.documentProperties.summary.description",multiline:true},{key:"category",labelKey:"pptx.documentProperties.summary.category"}];function kV({isOpen:t,coreProperties:e,customProperties:n,appProperties:r,onClose:o,onSave:i}){let{t:s}=useTranslation(),[a,l]=useState("summary"),[c,d]=useState({}),[u,p]=useState([]),[h,f]=useState({}),[m,x]=useState(false);t&&!m&&(d({...e}),p(n.map(M=>({...M}))),f({company:r?.company,manager:r?.manager}),l("summary")),t!==m&&x(t);let g=useCallback((M,_)=>{d(E=>({...E,[M]:_}));},[]),y=useMemo(()=>{if(Mue.some(({key:R})=>(c[R]??"")!==(e[R]??"")))return true;let _=(h.company??"")!==(r?.company??""),E=(h.manager??"")!==(r?.manager??"");return _||E||u.length!==n.length?true:u.some((R,I)=>R.name!==n[I]?.name||R.value!==n[I]?.value||R.type!==n[I]?.type)},[c,u,h,e,n,r]),b=useCallback(M=>{f(_=>({..._,...M}));},[]),v=useCallback(()=>{let M=(h.company??"")!==(r?.company??"")||(h.manager??"")!==(r?.manager??"");i(c,u,M?h:void 0),o();},[c,u,h,r,i,o]),S=useCallback(()=>{o();},[o]),{panelStyle:w,handlers:C}=pi(S);if(!t)return null;let T=[{id:"summary",labelKey:"pptx.documentProperties.tabs.general"},{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:S}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{style:w,className:"pointer-events-auto w-[520px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...C,className:"flex items-center justify-between px-5 py-4 border-b border-border/60 touch-none",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:S,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(M=>jsx("button",{type:"button",onClick:()=>l(M.id),className:`px-4 py-2 text-xs font-medium transition-colors ${a===M.id?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:s(M.labelKey)},M.id))}),jsxs("div",{className:"px-5 py-4 min-h-[280px]",children:[a==="summary"&&jsx("div",{className:"space-y-3",children:Mue.map(({key:M,labelKey:_,multiline:E})=>jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:s(_)}),E?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[M]??"",onChange:R=>g(M,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[M]??"",onChange:R=>g(M,R.target.value)})]},M))}),a==="custom"&&jsx(AV,{customProperties:u,onUpdate:p}),a==="statistics"&&jsx(RV,{appProperties:{...r,company:h.company,manager:h.manager},onUpdateAppProperties:b,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:S,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:v,disabled:!y,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 ont(t){if(typeof document>"u")return false;try{return document.fonts.check(`12px "${t}"`)}catch{return false}}function NV({isOpen:t,embedFontsEnabled:e,usedFontFamilies:n,embeddedFonts:r,onClose:o,onToggleEmbedFonts:i}){let{t:s}=useTranslation(),[a,l]=useState(new Set),[c,d]=useState(false),[u,p]=useState(false),h=useCallback(async()=>{d(true);try{await document.fonts.ready;let x=new Set;for(let g of n)ont(g)&&x.add(g);l(x),p(!0);}catch{}finally{d(false);}},[n]);if(useEffect(()=>{t&&!u&&h();},[t,u,h]),!t)return null;let f=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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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 g=a.has(x),y=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:[y&&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")}),g?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)})})]}),f.length>0&&!c&&jsx("p",{className:"text-[11px] text-yellow-400/80",children:s("pptx.fonts.missingWarning",{count:f.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 DV({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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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 FV({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 OV({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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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 BV({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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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}Pe();Pe();function bN(t){return UU(t).map(e=>e.kind==="break"?Qm.createElement("br",{key:e.key}):Qm.createElement("span",{key:e.key,style:e.style},e.text))}bt();function _nt({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 h=new ResizeObserver(f=>{let m=f[0];m&&s(m.contentRect.width);});return h.observe(p),()=>h.disconnect()},[]);let a=Math.max(n.width,1),l=Math.max(n.height,1),c=i>0?i/a:.2,d=Math.max(40,Math.round(l*c)),u=[...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:d},children:[t.backgroundColor&&t.backgroundColor!=="transparent"&&jsx("div",{className:"absolute inset-0",style:{backgroundColor:et(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:u.map(p=>{let h=Math.max(p.width,1),f=Math.max(p.height,1),m=Jt(p)?p.shapeStyle:void 0,x=m?.fillColor!==void 0&&m?.fillColor!=="transparent"||!!(Oc(m)||m?.fillGradient)||m?.fillMode==="pattern"&&!!m.fillPatternPreset,g=et(m?.fillColor,Ky),y=Math.max(0,m?.strokeWidth||0),b=et(m?.strokeColor,iu),v=au(p,x,g,y,b),S=du(p,x,g,y,b),w=p.type==="shape"&&x?"#ffffff":Di,C=lh(p,w),T=uu(p),M=nu(p),_=ze(p)?p.text:void 0,E=ze(p)?p.textSegments:void 0,R=typeof _=="string"&&_.trim().length>0||(E?.length??0)>0,I=ib(p,M)?ii(p):"";return jsx("div",{className:"absolute overflow-hidden",style:{left:p.x,top:p.y,width:h,height:f,transform:$l(p),transformOrigin:"center"},children:(p.type==="picture"||p.type==="image")&&(p.svgData||p.imageData)?zc(p)?jsx("div",{className:"pointer-events-none w-full h-full",style:pu(p)}):jsx("img",{src:p.svgData||p.imageData,alt:"",className:"pointer-events-none",style:T,draggable:false}):jsxs("div",{className:"relative w-full h-full overflow-hidden",style:v,children:[S,M&&R&&jsx("div",{className:"w-full h-full whitespace-pre-wrap break-words px-1 py-0.5 leading-[1.3]",style:{...zl(p),...C,transform:tu(p),transformOrigin:"center"},children:Wa(p,w)}),!R&&I.length>0&&jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground",children:I})]})},p.id)})})]})}function Pnt(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 ev=Qm.memo(_nt,Pnt);function $V({slides:t,currentSlideIndex:e,canvasSize:n,templateElements:r,presentationStartTime:o,onMovePresentationSlide:i,onExit:s,onOpenAudienceWindow:a,onCloseAudienceWindow:l,isAudienceWindowOpen:c}){let{t:d}=useTranslation(),[u,p]=useState(false);useEffect(()=>{let R=window.setTimeout(()=>p(true),300);return ()=>window.clearTimeout(R)},[]);let[h,f]=useState(Date.now());useEffect(()=>{let R=window.setInterval(()=>f(Date.now()),1e3);return ()=>window.clearInterval(R)},[]);let m=o?h-o:0,[x,g]=useState(OU),y=useCallback(()=>{g(R=>iR(R+oR));},[]),b=useCallback(()=>{g(R=>iR(R-oR));},[]),v=t[e],S=e+1<t.length?t[e+1]:void 0,w=v?.notes??"",C=v?.notesSegments,T=C&&C.length>0;if(!v)return jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-card text-muted-foreground",children:d("pptx.presenter.noSlides")});let M=300*1e3,_=Math.min(100,m%M/M*100),E=Math.floor(m/M);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(ev,{slide:v,templateElements:r,canvasSize:n}),jsx("div",{className:"mt-3 text-xs font-mono tabular-nums text-white/50 select-none",children:d("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:d("pptx.presenter.currentTime")}),jsx("span",{className:"text-lg font-mono tabular-nums text-foreground",children:BU(new Date(h))})]}),jsxs("div",{className:"flex flex-col items-end",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:d("pptx.presenter.elapsed")}),jsx("span",{className:"text-lg font-mono tabular-nums text-primary",children:Xy(m)})]}),jsxs("div",{className:"flex items-center gap-1",children:[a&&u&&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:d(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),"aria-label":d(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:d("pptx.presenter.endPresentation"),"aria-label":d("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:d("pptx.presenter.previousSlide"),children:[jsx(LuChevronLeft,{className:"w-4 h-4"}),d("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:d("pptx.presenter.nextSlide"),children:[d("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:d("pptx.presenter.nextSlidePreview")}),S?jsx(ev,{slide:S,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:d("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:d("pptx.presenter.speakerNotes")}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",onClick:b,disabled:x<=nR,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:d("pptx.presenter.decreaseFontSize"),"aria-label":d("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:y,disabled:x>=rR,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:d("pptx.presenter.increaseFontSize"),"aria-label":d("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:T?bN(C):w.trim().length>0?w:jsx("span",{className:"italic text-muted-foreground",children:d("pptx.presenter.noNotes")})})]})]})]}),jsx("div",{className:"h-1.5 w-full bg-muted/60 flex-shrink-0",role:"progressbar","aria-valuenow":Math.round(_),"aria-valuemin":0,"aria-valuemax":100,"aria-label":d("pptx.presenter.timerProgress"),title:`${Xy(m)} (segment ${E+1})`,children:jsx("div",{className:"h-full bg-primary transition-[width] duration-1000 ease-linear",style:{width:`${_}%`}})})]})}Pe();function HV({slides:t,currentSlideIndex:e,canvasSize:n,templateElements:r,presentationStartTime:o,onMovePresentationSlide:i,onExit:s}){let{t:a}=useTranslation(),[l,c]=useState(Date.now());useEffect(()=>{let b=window.setInterval(()=>c(Date.now()),1e3);return ()=>window.clearInterval(b)},[]);let d=zne(o,l),u=t[e],p=e+1<t.length?t[e+1]:void 0;if(!u)return jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-card text-muted-foreground",children:a("pptx.presenter.noSlides")});let h=u.notes??"",f=u.notesSegments,m=f&&f.length>0,x=$ne(e),g=Hne(e,t.length);return jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-card text-foreground",style:{paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"},children:[jsxs("div",{className:"flex items-center justify-between gap-2 px-4 py-2 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:a("pptx.presenter.elapsed")}),jsx("span",{className:"text-lg font-mono tabular-nums text-primary",children:Vne(d)})]}),jsx("span",{className:"text-sm font-mono tabular-nums text-foreground",children:Une(e,t.length)}),jsx("button",{type:"button",onClick:s,className:"flex items-center justify-center w-11 h-11 min-w-11 min-h-11 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:a("pptx.presenter.endPresentation"),"aria-label":a("pptx.presenter.endPresentation"),children:jsx(LuX,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex items-center justify-center bg-black px-3 py-3",children:jsx("div",{className:"w-full max-w-[640px]",children:jsx(ev,{slide:u,templateElements:r,canvasSize:n})})}),jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-border/60",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:a("pptx.presenter.nextSlidePreview")}),jsx("div",{className:"w-[132px] flex-shrink-0",children:p?jsx(ev,{slide:p,templateElements:r,canvasSize:n}):jsx("div",{className:"flex items-center justify-center h-12 rounded border border-border/30 bg-muted/40 text-[10px] text-muted-foreground italic",children:a("pptx.presenter.endOfPresentation")})})]}),jsxs("div",{className:"flex-1 flex flex-col min-h-0 px-4 py-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-1",children:a("pptx.presenter.speakerNotes")}),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 text-[15px]",children:m?bN(f):h.trim().length>0?h:jsx("span",{className:"italic text-muted-foreground",children:a("pptx.presenter.noNotes")})})]}),jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2 border-t border-border/60",children:[jsxs("button",{type:"button",onClick:()=>i(-1),disabled:x,className:"inline-flex items-center justify-center gap-1.5 flex-1 h-11 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-sm transition-colors",title:a("pptx.presenter.previousSlide"),"aria-label":a("pptx.presenter.previousSlide"),children:[jsx(LuChevronLeft,{className:"w-5 h-5"}),a("pptx.presenter.prev")]}),jsxs("button",{type:"button",onClick:()=>i(1),disabled:g,className:"inline-flex items-center justify-center gap-1.5 flex-1 h-11 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-sm transition-colors",title:a("pptx.presenter.nextSlide"),"aria-label":a("pptx.presenter.nextSlide"),children:[a("pptx.presenter.next"),jsx(LuChevronRight,{className:"w-5 h-5"})]})]})]})}function Nue(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 VV({presentationStartTime:t,slideStartTime:e,paused:n,onTogglePause:r}){let{t:o}=useTranslation(),[i,s]=useState(0);useEffect(()=>{if(n)return;let d=window.setInterval(()=>s(u=>u+1),250);return ()=>window.clearInterval(d)},[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:Nue(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:Nue(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 Lue(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 GV({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:Lue(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 d=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:d&&jsx("div",{className:"w-20 rounded overflow-hidden bg-white",children:jsx(oa,{slide:d,templateElements:[],canvasSize:e})})}),jsx("td",{className:"py-2 text-right font-mono text-foreground tabular-nums",children:Lue(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")})]})]})})}bt();function Qnt(t,e){return ze(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 XV({slides:t,activeSlideIndex:e,selectedElementId:n,selectedElementIds:r,canEdit:o,setSelectedElementId:i,setSelectedElementIds:s,setSlides:a,markDirty:l,onClose:c}){let{t:d}=useTranslation(),p=t[e]?.elements??[],[h,f]=useState(null),[m,x]=useState(""),g=useRef(null),[y,b]=useState(null),[v,S]=useState(null),w=useCallback(L=>{i(L),s([L]);},[i,s]),C=useCallback(L=>{a(k=>{let F=[...k],N=F[e];if(!N)return k;let D=[...N.elements??[]],U=D.findIndex(G=>G.id===L);return U===-1?k:(D[U]={...D[U],hidden:!D[U].hidden},F[e]={...N,elements:D},F)}),l();},[e,a,l]),T=useCallback((L,k)=>{o&&(f(L.id),x(k),setTimeout(()=>g.current?.select(),0));},[o]),M=useCallback(()=>{f(null);},[]),_=useCallback(L=>{b(L);},[]),E=useCallback((L,k)=>{L.preventDefault(),y!==null&&y!==k&&S(k);},[y]),R=useCallback(L=>{if(y===null||y===L){b(null),S(null);return}a(k=>{let F=[...k],N=F[e];if(!N)return k;let D=[...N.elements??[]],[U]=D.splice(y,1);return D.splice(L,0,U),F[e]={...N,elements:D},F}),l(),b(null),S(null);},[y,e,a,l]),I=[...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:d("pptx.selectionPane.title")}),jsx("button",{type:"button",onClick:c,className:"text-muted-foreground hover:text-foreground text-xs",title:d("pptx.selectionPane.close"),children:"\xD7"})]}),jsx("div",{className:"flex-1 overflow-y-auto py-1",children:I.length===0?jsx("div",{className:"px-3 py-4 text-xs text-muted-foreground italic",children:d("pptx.selectionPane.empty")}):I.map((L,k)=>{let F=p.length-1-k,N=n===L.id||r.includes(L.id),D=Qnt(L,F),U=h===L.id;return jsxs("div",{draggable:o,onDragStart:()=>_(F),onDragOver:G=>E(G,F),onDrop:()=>R(F),onDragEnd:()=>{b(null),S(null);},className:ie("flex items-center gap-1.5 px-2 py-1 text-xs cursor-pointer transition-colors",N?"bg-primary/30 text-primary":"hover:bg-muted text-foreground",v===F?"border-t-2 border-primary":""),onClick:()=>w(L.id),onDoubleClick:()=>T(L,D),children:[o&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground flex-shrink-0 cursor-grab"}),jsx("span",{className:"flex-1 truncate",children:U?jsx("input",{ref:g,type:"text",value:m,onChange:G=>x(G.target.value),onBlur:M,onKeyDown:G=>{G.key==="Enter"&&M(),G.key==="Escape"&&f(null);},className:"w-full bg-muted text-xs px-1 py-0.5 rounded border border-border outline-none",onClick:G=>G.stopPropagation()}):D}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex-shrink-0",title:L.hidden?d("pptx.selectionPane.show"):d("pptx.selectionPane.hide"),onClick:G=>{G.stopPropagation(),C(L.id);},children:L.hidden?jsx(LuEyeOff,{className:"w-3.5 h-3.5"}):jsx(LuEye,{className:"w-3.5 h-3.5 opacity-50"})})]},L.id)})})]})}var Uue="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",fr=`${Uue} border-r border-border hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Jo=`${Uue} hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,to="inline-flex items-center rounded bg-muted text-xs overflow-hidden",Be="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",qt=jsx("div",{className:"w-px self-stretch bg-border/40 mx-1 max-md:hidden"}),Ne="w-4 h-4",Gn="w-3.5 h-3.5";var $ue=[{k:"left",el:jsx(LuAlignLeft,{className:Ne})},{k:"center",el:jsx(LuAlignCenter,{className:Ne})},{k:"right",el:jsx(LuAlignRight,{className:Ne})},{k:"top",el:jsx(LuChevronUp,{className:Ne})},{k:"middle",el:jsx(LuAlignCenter,{className:`${Ne} rotate-90`})},{k:"bottom",el:jsx(LuChevronDown,{className:Ne})}],Hue=[{k:"horizontal",el:jsx(LuAlignHorizontalSpaceAround,{className:Ne})},{k:"vertical",el:jsx(LuAlignVerticalSpaceAround,{className:Ne})}],zue=[{id:"select",icon:jsx(LuMoveRight,{className:Ne}),labelKey:"pptx.ribbon.tool.select",ac:"bg-primary text-white"},{id:"pen",icon:jsx(LuPencil,{className:Ne}),labelKey:"pptx.ribbon.tool.pen",ac:"bg-primary text-white"},{id:"highlighter",icon:jsx(LuType,{className:Ne}),labelKey:"pptx.ribbon.tool.highlighter",ac:"bg-yellow-600 text-white"},{id:"eraser",icon:jsx(LuMinus,{className:Ne}),labelKey:"pptx.ribbon.tool.eraser",ac:"bg-red-600 text-white"},{id:"freeform",icon:jsx(LuSpline,{className:Ne}),labelKey:"pptx.ribbon.tool.freeform",ac:"bg-primary text-white"}],Vue=[{k:"png",labelKey:"pptx.ribbon.exportPng",i:jsx(LuDownload,{className:`${Gn} text-muted-foreground`})},{k:"pdf",labelKey:"pptx.ribbon.exportPdf",i:jsx(LuFileText,{className:`${Gn} text-muted-foreground`})},{k:"video",labelKey:"pptx.ribbon.exportVideo",i:jsx(LuVideo,{className:`${Gn} text-muted-foreground`})},{k:"gif",labelKey:"pptx.ribbon.exportGif",i:jsx(LuImage,{className:`${Gn} text-muted-foreground`})},{k:"package",labelKey:"pptx.file.packageTooltip",i:jsx(LuFolderOpen,{className:`${Gn} text-muted-foreground`})},{k:"pptx",labelKey:"pptx.file.saveAsPptxTooltip",i:jsx(LuDownload,{className:`${Gn} text-muted-foreground`})},{k:"ppsx",labelKey:"pptx.file.saveAsPpsxTooltip",i:jsx(LuPlay,{className:`${Gn} text-muted-foreground`})},{k:"pptm",labelKey:"pptx.file.saveAsPptmTooltip",i:jsx(LuDatabase,{className:`${Gn} text-muted-foreground`})},{k:"---0",labelKey:"",i:null},{k:"print",labelKey:"pptx.print.printButton",i:jsx(LuPrinter,{className:`${Gn} text-muted-foreground`})},{k:"copyImg",labelKey:"pptx.file.copyImageTooltip",i:jsx(LuCopy,{className:`${Gn} text-muted-foreground`})},{k:"---",labelKey:"",i:null},{k:"a11y",labelKey:"pptx.ribbon.accessibilityCheck",i:jsx(LuCheck,{className:`${Gn} text-muted-foreground`})},{k:"shortcuts",labelKey:"pptx.settings.keyboardShortcuts",i:jsx(LuSearch,{className:`${Gn} text-muted-foreground`})},{k:"---2",labelKey:"",i:null},{k:"versionHistory",labelKey:"pptx.ribbon.versionHistory",i:jsx(LuClock,{className:`${Gn} text-muted-foreground`})},{k:"---3",labelKey:"",i:null},{k:"documentProperties",labelKey:"pptx.ribbon.documentProperties",i:jsx(LuInfo,{className:`${Gn} text-muted-foreground`})},{k:"passwordProtection",labelKey:"pptx.security.protectPresentation",i:jsx(LuLock,{className:`${Gn} text-muted-foreground`})},{k:"fontEmbedding",labelKey:"pptx.ribbon.embedFonts",i:jsx(LuType,{className:`${Gn} text-muted-foreground`})},{k:"digitalSignatures",labelKey:"pptx.viewer.digitalSignatures",i:jsx(LuShieldAlert,{className:`${Gn} text-muted-foreground`})}],Gue=[{id:"bold",i:jsx(LuBold,{className:Ne}),labelKey:"pptx.textPanel.bold"},{id:"italic",i:jsx(LuItalic,{className:Ne}),labelKey:"pptx.textPanel.italic"},{id:"underline",i:jsx(LuUnderline,{className:Ne}),labelKey:"pptx.textPanel.underline"},{id:"strikethrough",i:jsx(LuStrikethrough,{className:Ne}),labelKey:"pptx.textPanel.strikethrough"}],Wue=[{id:"left",i:jsx(LuAlignLeft,{className:Ne}),labelKey:"pptx.ribbon.alignLeft"},{id:"center",i:jsx(LuAlignCenter,{className:Ne}),labelKey:"pptx.ribbon.alignCenter"},{id:"right",i:jsx(LuAlignRight,{className:Ne}),labelKey:"pptx.ribbon.alignRight"},{id:"justify",i:jsx(LuAlignJustify,{className:Ne}),labelKey:"pptx.ribbon.justify"}];var Drt=[{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 SN(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:ie(Be,n?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.previewTooltip"),children:[jsx(LuPlay,{className:Ne}),e("pptx.animations.preview")]}),qt,jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:i,className:Be,title:e("pptx.animations.addTooltip"),children:[jsx(LuSparkles,{className:Ne}),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:Drt.map(a=>jsxs(Qm.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))})})]}),qt,jsxs("button",{type:"button",disabled:i,onClick:t.onRemoveAnimation,className:Be,title:e("pptx.animations.removeTooltip"),children:[jsx(LuTrash2,{className:Ne}),e("pptx.animations.remove")]}),qt,jsxs("button",{type:"button",onClick:t.onOpenAnimationPanel??t.onToggleInspector,className:ie(Be,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.openPanelTooltip"),children:[jsx(LuPanelRight,{className:Ne}),e("pptx.animations.animationPanel")]})]})}function wN(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit;return jsxs(Fragment,{children:[jsx("div",{className:to,children:$ue.map((o,i,s)=>jsx("button",{type:"button",onClick:()=>t.onAlignElements(o.k),disabled:!r,className:i<s.length-1?fr:Jo,title:e("pptx.arrange.align",{direction:o.k}),children:o.el},o.k))}),jsx("div",{className:to,children:Hue.map((o,i,s)=>jsx("button",{type:"button",onClick:()=>t.onDistributeElements(o.k),disabled:!t.canEdit||!t.canDistribute,className:i<s.length-1?fr:Jo,title:e(`pptx.arrange.distribute${o.k.charAt(0).toUpperCase()}${o.k.slice(1)}`),children:o.el},o.k))}),jsxs("div",{className:to,children:[jsx("button",{onClick:t.onCopy,disabled:!n,className:fr,title:e("pptx.arrange.copy"),children:jsx(LuCopy,{className:Ne})}),jsx("button",{onClick:t.onCut,disabled:!r,className:fr,title:e("pptx.arrange.cut"),children:e("pptx.arrange.cut")}),jsx("button",{onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Jo,title:e("pptx.arrange.paste"),children:jsx(LuClipboardPaste,{className:Ne})})]}),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:ie(Be,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:e("pptx.arrange.formatPainter"),children:[jsx(LuPaintbrush,{className:Ne}),e("pptx.arrange.format")]}),jsxs("div",{className:to,children:[jsx("button",{type:"button",onClick:()=>t.onFlip("horizontal"),disabled:!r,className:fr,title:e("pptx.arrange.flipHorizontally"),children:e("pptx.arrange.flipH")}),jsx("button",{type:"button",onClick:()=>t.onFlip("vertical"),disabled:!r,className:Jo,title:e("pptx.arrange.flipVertically"),children:e("pptx.arrange.flipV")})]}),jsxs("div",{className:to,children:[jsx("button",{onClick:()=>t.onMoveLayer("backward"),disabled:!r,className:fr,title:e("pptx.arrange.sendBackward"),children:jsx(LuChevronDown,{className:Ne})}),jsx("button",{onClick:()=>t.onMoveLayer("forward"),disabled:!r,className:fr,title:e("pptx.arrange.bringForward"),children:jsx(LuChevronUp,{className:Ne})}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("back"),disabled:!r,className:fr,title:e("pptx.arrange.sendToBack"),children:e("pptx.arrange.back")}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("front"),disabled:!r,className:Jo,title:e("pptx.arrange.bringToFront"),children:e("pptx.arrange.front")})]}),jsxs("button",{onClick:t.onDuplicate,disabled:!r,className:Be,title:e("pptx.arrange.duplicate"),children:[jsx(LuCopy,{className:Ne}),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:Ne}),e("pptx.arrange.delete")]})]})}function TN(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onToggleThemeGallery,disabled:!t.canEdit,className:ie(Be,t.isThemeGalleryOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Browse and apply built-in themes",children:[jsx(LuPalette,{className:Gn}),"Browse Themes"]}),jsxs("button",{onClick:t.onToggleThemeEditor,disabled:!t.canEdit,className:ie(Be,t.isThemeEditorOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Edit presentation theme colors and fonts",children:[jsx(LuPencil,{className:Gn}),"Edit Theme"]}),qt,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:Be,title:"Change slide dimensions (16:9, 4:3, custom)",children:[jsx(LuMonitor,{className:Gn}),"Slide Size"]}),t.onToggleInspector&&jsxs("button",{onClick:t.onToggleInspector,className:ie(Be,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open inspector to edit slide background",children:[jsx(LuPaintBucket,{className:Gn}),"Format Background"]})]})}var eot=[{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 CN(t){let[e,n]=Qm.useState("none"),[r,o]=Qm.useState("00.50");return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:Be,title:"Preview transition",children:[jsx(LuPlay,{className:Gn}),"Preview"]}),qt,jsx("div",{className:"inline-flex items-center gap-0.5 overflow-x-auto max-w-[420px]",children:eot.map(i=>jsx("button",{type:"button",onClick:()=>n(i.value),className:ie("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))}),qt,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"})]}),qt,jsxs("button",{type:"button",className:Be,title:"Apply transition to all slides",children:[jsx(LuCopy,{className:Gn}),"Apply to All"]}),qt,jsxs("button",{type:"button",onClick:t.onToggleInspector,className:ie(Be,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open Inspector for full transition options",children:[jsx(LuPanelRight,{className:Ne}),"Inspector"]})]})}function MN(t){return jsxs(Fragment,{children:[t.onToggleComments&&jsxs("button",{onClick:t.onToggleComments,className:ie(Be,t.isCommentsPanelOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle comments panel",children:[jsx(LuMessageSquare,{className:Ne}),"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:ie(Be,t.spellCheckEnabled?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle spell check",children:[jsx(LuSpellCheck,{className:Ne}),"Spelling"]}),t.onCompare&&jsxs("button",{onClick:t.onCompare,disabled:!t.canEdit,className:Be,title:"Compare with another presentation",children:[jsx(LuGitCompare,{className:Ne}),"Compare"]})]})}function PN(t){let{t:e}=useTranslation();return jsxs(Fragment,{children:[jsx("div",{className:to,children:zue.map((n,r,o)=>jsx("button",{type:"button",onClick:()=>t.onSetActiveTool(n.id),className:ie(r<o.length-1?fr:Jo,t.activeTool===n.id?n.ac??"bg-accent text-foreground":""),title:e(n.labelKey),children:n.icon},n.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:e("pptx.ribbon.penColour"),children:[e("pptx.ribbon.colour"),jsx("input",{type:"color",value:t.drawingColor,onChange:n=>t.onSetDrawingColor(n.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:e("pptx.ribbon.strokeWidth"),children:[e("pptx.ribbon.width"),jsx("input",{type:"range",min:1,max:12,value:t.drawingWidth,onChange:n=>t.onSetDrawingWidth(Number(n.target.value)),className:"w-16 h-1 accent-primary"}),jsx("span",{className:"text-foreground w-4 text-right",children:t.drawingWidth})]})]})]})}function EN(t){return jsxs(Fragment,{children:[t.onOpenFile&&jsxs(Fragment,{children:[jsxs("button",{onClick:t.onOpenFile,className:Be,title:"Open another presentation",children:[jsx(LuFolderOpen,{className:Ne}),"Open"]}),qt]}),jsxs("button",{onClick:t.onSaveAsPptx,className:Be,title:"Save as Presentation (.pptx)",children:[jsx(LuDownload,{className:Ne}),"Save .pptx"]}),jsxs("button",{onClick:t.onSaveAsPpsx,className:Be,title:"Save as Slide Show (.ppsx)",children:[jsx(LuPlay,{className:Ne}),"Save .ppsx"]}),t.hasMacros&&jsxs("button",{onClick:t.onSaveAsPptm,className:Be,title:"Save as Macro-Enabled (.pptm)",children:[jsx(LuFileText,{className:Ne}),"Save .pptm"]}),jsxs("button",{onClick:t.onPackageForSharing,className:Be,title:"Package for Sharing",children:[jsx(LuPackage,{className:Ne}),"Package"]}),qt,jsxs("button",{onClick:t.onExportPng,className:Be,title:"Export as PNG",children:[jsx(LuDownload,{className:Ne}),"PNG"]}),jsxs("button",{onClick:t.onExportPdf,className:Be,title:"Export as PDF",children:[jsx(LuFileText,{className:Ne}),"PDF"]}),jsxs("button",{onClick:t.onExportVideo,className:Be,title:"Export as Video",children:[jsx(LuVideo,{className:Ne}),"Video"]}),jsxs("button",{onClick:t.onExportGif,className:Be,title:"Export as GIF",children:[jsx(LuImage,{className:Ne}),"GIF"]}),jsxs("button",{onClick:t.onCopySlideAsImage,className:Be,title:"Copy Slide as Image",children:[jsx(LuCopy,{className:Ne}),"Copy Image"]}),qt,jsxs("button",{onClick:t.onPrint,className:Be,title:"Print",children:[jsx(LuPrinter,{className:Ne}),"Print"]}),qt,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:Be,title:"Document Properties",children:[jsx(LuInfo,{className:Ne}),"Properties"]}),t.onOpenPasswordProtection&&jsxs("button",{onClick:t.onOpenPasswordProtection,className:Be,title:"Protect Presentation",children:[jsx(LuLock,{className:Ne}),"Protect"]}),t.onOpenFontEmbedding&&jsxs("button",{onClick:t.onOpenFontEmbedding,className:Be,title:"Embed Fonts",children:[jsx(LuType,{className:Ne}),"Fonts"]}),t.onOpenDigitalSignatures&&jsxs("button",{onClick:t.onOpenDigitalSignatures,className:Be,title:"Digital Signatures",children:[jsx(LuShieldAlert,{className:Ne}),"Signatures"]})]})}bt();function epe(t){let[e,n]=useState(false),[r,o]=useState(false),i=useRef(null),s=useRef(null),a=useCallback(()=>{if(t.layoutOptions.length>0){let l=t.layoutOptions[0];t.onInsertSlideFromLayout(l.path,l.name);}},[t]);return useEffect(()=>{if(!e)return;let l=c=>{i.current&&!i.current.contains(c.target)&&n(false);};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e]),useEffect(()=>{if(!r)return;let l=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]),jsxs(Fragment,{children:[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 inline-flex items-center",ref:i,children:[jsxs("button",{type:"button",onClick:a,disabled:!t.canEdit||t.layoutOptions.length===0,className:ie(Be,"whitespace-nowrap",t.layoutOptions.length>0?"rounded-r-none":""),title:"New Slide",children:[jsx(LuPlus,{className:Ne}),"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(l=>!l),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(l=>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(l.path,l.name),n(false);},children:l.name},l.path))})})]}),jsxs("div",{className:"relative inline-flex items-center",ref:s,children:[jsxs("button",{type:"button",disabled:!t.canEdit||t.layoutOptions.length===0,className:Be,title:"Layout",onClick:()=>o(l=>!l),children:[jsx(LuLayoutGrid,{className:Ne}),"Layout"]}),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:t.layoutOptions.map(l=>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.onApplyLayout?.(l.path),o(false);},children:l.name},l.path))})})]}),jsxs("button",{type:"button",disabled:!t.canEdit,className:Be,title:"Reset Slide",onClick:t.onResetSlide,children:[jsx(LuRotateCcw,{className:Ne}),"Reset"]}),jsxs("button",{type:"button",disabled:!t.canEdit,className:Be,title:"Add Section",onClick:t.onAddSection,children:[jsx(LuFolderPlus,{className:Ne}),"Section"]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Slides"})]}),qt]})}function Mot(t){let e={fontFamily:"Segoe UI",fontSize:"24"};if(!t||!ze(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 _ot=["Arial","Calibri","Cambria","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana"],Pot=[8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,72,96];function RN(t){let[e,n]=useState(false),[r,o]=useState(false),[i,s]=useState(false),[a,l]=useState(false),c=useRef(null),d=useRef(null),{fontFamily:u,fontSize:p}=Mot(t.selectedElement);return useEffect(()=>{if(!e)return;let h=f=>{c.current&&!c.current.contains(f.target)&&n(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[e]),useEffect(()=>{if(!r)return;let h=f=>{d.current&&!d.current.contains(f.target)&&o(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:to,children:[jsx("button",{type:"button",onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:fr,title:"Paste",children:jsx(LuClipboardPaste,{className:Ne})}),jsx("button",{type:"button",onClick:()=>{t.onCut(),l(true),setTimeout(()=>l(false),600);},disabled:!t.canEdit,className:ie(fr,a&&"bg-green-600/20 text-green-400"),title:"Cut",children:jsx(LuScissors,{className:Ne})}),jsx("button",{type:"button",onClick:()=>{t.onCopy(),s(true),setTimeout(()=>s(false),600);},className:ie(fr,i&&"bg-green-600/20 text-green-400"),title:"Copy",children:jsx(LuCopy,{className:Ne})}),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:ie(Jo,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Format Painter",children:jsx(LuPaintbrush,{className:Ne})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Clipboard"})]}),qt,jsx(epe,{canEdit:t.canEdit,layoutOptions:t.layoutOptions,onInsertSlideFromLayout:t.onInsertSlideFromLayout,onApplyLayout:t.onApplyLayout,onResetSlide:t.onResetSlide,onAddSection:t.onAddSection}),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:c,children:[jsxs("button",{type:"button",onClick:()=>n(h=>!h),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:u}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),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:_ot.map(h=>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:h},onClick:()=>{t.onUpdateTextStyle?.({fontFamily:h}),n(false);},children:h},h))})})]}),jsxs("div",{className:"relative",ref:d,children:[jsxs("button",{type:"button",onClick:()=>o(h=>!h),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:p}),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:Pot.map(h=>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:h}),o(false);},children:h},h))})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),qt]})}Pe();function IN(t){let{t:e}=useTranslation(),{canEdit:n}=t,[r,o]=useState(false),[i,s]=useState(""),[a,l]=useState("locale"),[c,d]=useState(a$),u=useRef(null),p=useCallback(()=>{let f=new Date,m=x=>String(x).padStart(2,"0");s(`${f.getFullYear()}-${m(f.getMonth()+1)}-${m(f.getDate())}T${m(f.getHours())}:${m(f.getMinutes())}`),l("locale"),o(true);},[]),h=useCallback(()=>{if(!t.onInsertField)return;let f=new Date(i);if(isNaN(f.getTime()))return;let m;switch(a){case "iso":m=f.toISOString().slice(0,10);break;case "long":m=f.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"});break;case "short":m=f.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});break;case "time":m=f.toLocaleString();break;default:m=f.toLocaleDateString();break}t.onInsertField("datetime",m),o(false);},[i,a,t]);return useEffect(()=>{if(!r)return;let f=m=>{u.current&&!u.current.contains(m.target)&&o(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),jsxs(Fragment,{children:[jsxs("button",{onClick:t.onAddTextBox,disabled:!n,className:Be,title:"Add text box",children:[jsx(LuType,{className:Ne}),"Text"]}),jsxs("div",{className:to,children:[jsx("select",{value:t.newShapeType,onChange:f=>t.onSetNewShapeType(f.target.value),className:"bg-transparent py-1.5 pl-2 pr-1 outline-none text-xs",title:"Shape type",children:Um.map(f=>jsx("option",{value:f.type,className:"bg-background",children:f.label},f.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:[Um.find(f=>f.type===t.newShapeType)?.icon||jsx(LuSquare,{className:Ne}),"Shape"]})]}),jsxs("button",{onClick:t.onOpenImagePicker,disabled:!n,className:Be,title:"Insert image",children:[jsx(LuImage,{className:Ne}),"Image"]}),jsxs("button",{onClick:t.onOpenMediaPicker,disabled:!n,className:Be,title:"Insert audio or video",children:[jsx(LuVideo,{className:Ne}),"Media"]}),jsxs("button",{onClick:t.onAddTable,disabled:!n,className:Be,title:"Insert table",children:[jsx(LuDatabase,{className:Ne}),"Table"]}),t.onAddChart&&jsxs("div",{className:to,children:[jsx("select",{value:c,onChange:f=>d(f.target.value),className:"bg-transparent py-1.5 pl-2 pr-1 outline-none text-xs",title:"Chart type",children:lre.map(f=>jsx("option",{value:f.type,className:"bg-background",children:f.label},f.type))}),jsxs("button",{onClick:()=>t.onAddChart(c),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:"Insert chart",children:[jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M3 3v18h18"}),jsx("rect",{x:"7",y:"11",width:"3",height:"6"}),jsx("rect",{x:"12",y:"7",width:"3",height:"10"}),jsx("rect",{x:"17",y:"13",width:"3",height:"4"})]}),"Chart"]})]}),jsxs("button",{onClick:t.onAddSmartArt,disabled:!n,className:Be,title:"Insert SmartArt",children:[jsx(LuLayers,{className:Ne}),"SmartArt"]}),jsxs("button",{onClick:t.onAddEquation,disabled:!n,className:Be,title:"Insert Equation",children:[jsx("svg",{className:Ne,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:Be,title:"Insert action button",children:[jsxs("svg",{className:Ne,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:sh.map(f=>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(f.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:f.iconPath})}),f.label]},f.shapeType))})})]}),t.onInsertField&&jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:Be,title:e("pptx.field.insertField"),children:[jsxs("svg",{className:Ne,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:p,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:u,className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/30",onMouseDown:f=>{f.target===f.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:f=>s(f.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:f=>l(f.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:h,children:e("pptx.common.insert","Insert")})]})]})})]})}function NN(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:()=>t.onSetMode("present"),className:Be,title:"Start slide show from beginning",children:[jsx(LuPlay,{className:Ne}),"From Beginning"]}),jsxs("button",{onClick:t.onPresent,className:Be,title:"Start slide show from current slide",children:[jsx(LuPlay,{className:Ne}),"From Current Slide"]}),qt,jsxs("button",{onClick:t.onEnterPresenterView,className:Be,title:"Presenter view",children:[jsx(LuMonitor,{className:Ne}),"Presenter View"]}),jsxs("button",{onClick:t.onEnterRehearsalMode,className:Be,title:"Rehearse timings",children:[jsx(LuClock,{className:Ne}),"Rehearse Timings"]}),qt,jsxs("button",{onClick:t.onOpenSetUpSlideShow,className:Be,title:"Set up slide show",children:[jsx(LuSettings,{className:Ne}),"Set Up Slide Show"]}),jsxs("button",{onClick:t.onOpenBroadcastDialog,className:Be,title:"Broadcast slide show",children:[jsx(LuCast,{className:Ne}),"Broadcast"]}),qt,jsxs("button",{onClick:t.onToggleSubtitles,className:ie(Be,t.showSubtitles?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle subtitles",children:[jsx(LuCaptions,{className:Ne}),"Subtitles"]})]})}bt();var jot=[{label:"1.0",value:1},{label:"1.15",value:1.15},{label:"1.5",value:1.5},{label:"2.0",value:2},{label:"2.5",value:2.5},{label:"3.0",value:3}],Yot=[{label:"Horizontal",value:"horizontal"},{label:"Rotate 90\xB0",value:"vertical"},{label:"Rotate 270\xB0",value:"vertical270"},{label:"Stacked",value:"wordArtVert"}],Kot=[{label:"1 Column",value:1},{label:"2 Columns",value:2},{label:"3 Columns",value:3}];function ZV(t,e,n){useEffect(()=>{if(!e)return;let r=o=>{t.current&&!t.current.contains(o.target)&&n(false);};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t,n]);}function ape(t){let[e,n]=useState(false),r=useRef(null);return ZV(r,e,n),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",disabled:!t.canMut,onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Line Spacing","aria-label":"Line Spacing",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"5",y1:"5",x2:"19",y2:"5"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),jsx("line",{x1:"5",y1:"19",x2:"19",y2:"19"}),jsx("path",{d:"M2 8 L2 3 M2 3 L3.5 4.5 M2 3 L0.5 4.5"}),jsx("path",{d:"M2 16 L2 21 M2 21 L3.5 19.5 M2 21 L0.5 19.5"})]})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-28",children:jot.map(o=>jsxs("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:i=>i.preventDefault(),onClick:()=>{t.canFormat&&(t.onUpdateTextStyle({lineSpacing:o.value}),n(false));},children:[o.label,t.effectiveTs?.lineSpacing===o.value&&jsx("span",{className:"ml-auto text-primary",children:"\u2022"})]},o.value))})})]})}function lpe(t){let[e,n]=useState(false),r=useRef(null);return ZV(r,e,n),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",disabled:!t.canMut,onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Text Direction","aria-label":"Text Direction",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("text",{x:"3",y:"16",fontSize:"12",fill:"currentColor",stroke:"none",children:"A"}),jsx("path",{d:"M18 6 C21 6 21 10 18 10"}),jsx("path",{d:"M18 10 L19.5 8.5 M18 10 L16.5 8.5"})]})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-36",children:Yot.map(o=>jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:i=>i.preventDefault(),onClick:()=>{t.canFormat&&(t.onUpdateTextStyle({textDirection:o.value}),n(false));},children:o.label},o.value))})})]})}function cpe(t){let[e,n]=useState(false),r=useRef(null);return ZV(r,e,n),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",disabled:!t.canMut,onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Columns",children:jsx(LuColumns3,{className:Ne})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-28",children:Kot.map(o=>jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:i=>i.preventDefault(),onClick:()=>{t.canFormat&&(t.onUpdateTextStyle({columnCount:o.value}),n(false));},children:o.label},o.value))})})]})}function iit(t,e){if(t){if(ze(t))return t.textStyle;if(t.type==="table"&&e&&t.tableData)return t.tableData.rows[e.rowIndex]?.cells[e.columnIndex]?.style}}var sit=["#000000","#ffffff","#ff0000","#00aa00","#0000ff","#ff8800","#8800cc","#00cccc","#ff69b4","#808080"],ait=["#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff","#ff0000","#000080","#008080","#008000","#800080"];function LN(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit,o=n&&t.selectedElement!==null&&ze(t.selectedElement),i=n&&t.selectedElement?.type==="table",s=o||i,a=iit(t.selectedElement,t.tableEditorState),l=o&&t.selectedElement&&ze(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.color??t.selectedElement.textStyle?.color??"#000000":a?.color??"#000000",c=o&&t.selectedElement&&ze(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.highlightColor??t.selectedElement.textStyle?.highlightColor??"#ffff00":"#ffff00",d=useRef(null),u=useRef(null),p=useCallback(f=>{s&&t.onUpdateTextStyle({color:f});},[s,t]),h=useCallback(f=>{s&&t.onUpdateTextStyle({highlightColor:f});},[s,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:to,children:Gue.map((f,m,x)=>jsx("button",{type:"button",disabled:!r,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let y=a;switch(f.id){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:m<x.length-1?fr:Jo,title:e(f.labelKey),children:f.i},f.id))}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s)return;let f=!!a?.textShadowColor;t.onUpdateTextStyle(f?{textShadowColor:void 0,textShadowBlur:void 0,textShadowOffsetX:void 0,textShadowOffsetY:void 0}:{textShadowColor:"#000000",textShadowBlur:2,textShadowOffsetX:1,textShadowOffsetY:1,textShadowOpacity:.5});},className:Be,title:"Text Shadow","aria-label":"Text Shadow",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("text",{x:"6",y:"17",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"S"}),jsx("text",{x:"7.5",y:"18.5",fontSize:"16",fontWeight:"bold",fill:"none",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.4",children:"S"})]})}),jsxs("div",{className:to,children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.fontSize??18;t.onUpdateTextStyle({fontSize:f+2});},className:fr,title:"Increase Font Size",children:jsx(LuAArrowUp,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.fontSize??18;t.onUpdateTextStyle({fontSize:Math.max(1,f-2)});},className:fr,title:"Decrease Font Size",children:jsx(LuAArrowDown,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{s&&t.onUpdateTextStyle({bold:false,italic:false,underline:false,strikethrough:false,highlightColor:void 0});},className:Jo,title:"Clear Formatting",children:jsx(LuRemoveFormatting,{className:Ne})})]}),jsxs("div",{className:"relative group",children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),className:Be,title:"Character Spacing","aria-label":"Character Spacing",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("text",{x:"4",y:"16",fontSize:"11",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"AV"}),jsx("path",{d:"M3 20 L1 20 M3 20 L5 20",strokeWidth:"1.5"}),jsx("path",{d:"M21 20 L19 20 M21 20 L23 20",strokeWidth:"1.5"})]})}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-32",children:[{label:"Very Tight",value:-150},{label:"Tight",value:-75},{label:"Normal",value:0},{label:"Loose",value:75},{label:"Very Loose",value:150}].map(f=>jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:m=>m.preventDefault(),onClick:()=>{s&&t.onUpdateTextStyle({characterSpacing:f.value});},children:f.label},f.label))})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),className:Be,title:"Font Color","aria-label":"Font Color",children:[jsx("svg",{className:Ne,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: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:sit.map(f=>jsx("button",{type:"button","aria-label":f,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:m=>m.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:()=>d.current?.click(),children:"Custom colour..."}),jsx("input",{ref:d,type:"color",className:"sr-only",value:l,onChange:f=>p(f.target.value)})]})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),className:Be,title:"Text Highlight Color","aria-label":"Text Highlight Color",children:[jsx(LuHighlighter,{className:Ne}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:c}})]}),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:ait.map(f=>jsx("button",{type:"button","aria-label":f,className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${c?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:m=>m.preventDefault(),onClick:()=>h(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:c,onChange:f=>h(f.target.value)})]})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),qt,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:to,children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{!s||!t.selectedElement||t.onUpdateTextStyle({listType:a?.listType==="bullet"?"none":"bullet"});},className:fr,title:"Bullet List",children:jsx(LuList,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{!s||!t.selectedElement||t.onUpdateTextStyle({listType:a?.listType==="numbered"?"none":"numbered"});},className:Jo,title:"Numbered List",children:jsx(LuListOrdered,{className:Ne})})]}),jsxs("div",{className:to,children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:Math.max(0,f-24)});},className:fr,title:"Decrease Indent",children:jsx(LuIndentDecrease,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:f+24});},className:Jo,title:"Increase Indent",children:jsx(LuIndentIncrease,{className:Ne})})]}),jsx("div",{className:to,children:Wue.map((f,m,x)=>jsx("button",{type:"button",disabled:!r,onMouseDown:y=>y.preventDefault(),onClick:()=>{s&&t.onUpdateTextStyle({align:f.id});},className:m<x.length-1?fr:Jo,title:e(f.labelKey),children:f.i},f.id))}),jsx(ape,{canMut:r,canFormat:s,effectiveTs:a,onUpdateTextStyle:t.onUpdateTextStyle}),jsx(lpe,{canMut:r,canFormat:s,onUpdateTextStyle:t.onUpdateTextStyle}),jsx(cpe,{canMut:r,canFormat:s,onUpdateTextStyle:t.onUpdateTextStyle})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Paragraph"})]})]})}function DN(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:Be,title:"Normal view",children:"Normal"}),t.onToggleSlideSorter?jsx("button",{className:Be,onClick:t.onToggleSlideSorter,title:"Slide Sorter view",children:"Slide Sorter"}):jsx("button",{className:Be,title:"Slide Sorter view",children:"Slide Sorter"}),jsx("button",{className:Be,title:"Reading View",children:"Reading View"})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Presentation Views"})]}),qt,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:Be,title:"Edit slide masters and layouts",children:"Slide Master"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Master Views"})]}),qt,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:Be,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"})]}),qt,jsx("button",{onClick:()=>t.onSetEditTemplateMode(!t.editTemplateMode),disabled:!t.canEdit,className:ie(Be,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:ie(Be,t.isSelectionPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Selection Pane",children:[jsx(LuList,{className:Ne}),"Selection"]}),t.onToggleEyedropper&&jsxs("button",{type:"button",onClick:t.onToggleEyedropper,disabled:!t.canEdit,className:ie(Be,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:Ne}),"Eyedropper"]}),jsx("button",{onClick:()=>t.onSetShowGrid(!t.showGrid),className:ie(Be,t.showGrid?"bg-primary text-white":""),title:e("pptx.grid.toggleGrid"),children:e("pptx.grid.grid")}),jsx("button",{onClick:()=>t.onSetShowRulers(!t.showRulers),className:ie(Be,t.showRulers?"bg-primary text-white":""),title:e("pptx.ruler.toggleRulers"),children:e("pptx.ruler.rulers")}),jsx("button",{onClick:()=>t.onSetSnapToGrid(!t.snapToGrid),className:ie(Be,t.snapToGrid?"bg-primary text-white":""),title:e("pptx.grid.snapToGrid"),children:e("pptx.grid.snapToGrid")}),jsx("button",{onClick:()=>t.onSetSnapToShape(!t.snapToShape),className:ie(Be,t.snapToShape?"bg-primary text-white":""),title:e("pptx.grid.snapToShape"),children:e("pptx.grid.snapToShape")}),jsx("button",{onClick:()=>t.onAddGuide("h"),className:Be,title:"Add horizontal guide",children:"H Guide"}),jsx("button",{onClick:()=>t.onAddGuide("v"),className:Be,title:"Add vertical guide",children:"V Guide"}),jsx("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:ie(Be,t.spellCheckEnabled?"bg-primary text-white":""),title:"Toggle spell check",children:"Spell"})]})}function ON({open:t,onClose:e,title:n,children:r,heightFraction:o=.6,fullScreen:i=false,autoHeight:s=false,className:a,headerRight:l}){let c=useRef(null),{dragY:d,dragging:u,handlers:p}=Lu(e);if(useEffect(()=>{if(!t)return;let f=m=>{m.key==="Escape"&&e();};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[t,e]),!t)return null;let h=s?{maxHeight:"calc(85dvh - env(safe-area-inset-top))"}: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",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:c,className:ie("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",a),style:{...h,transform:d>0?`translateY(${d}px)`:void 0,transition:u?"none":"transform 150ms ease-out"},children:[jsxs("div",{className:"cursor-grab active:cursor-grabbing touch-none",onPointerDown:p.onPointerDown,onPointerMove:p.onPointerMove,onPointerUp:p.onPointerUp,onPointerCancel:p.onPointerCancel,children:[jsx("div",{className:"flex items-center justify-center pt-2 pb-1",children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),(n||l)&&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}),l]})]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain",children:r})]})]})}var Ait=[{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 ppe(t){let{open:e,onClose:n}=t,[r,o]=useState("home");return jsx(ON,{open:e,onClose:n,autoHeight: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 flex-wrap gap-1.5 px-3 py-2",children:Ait.map(({key:i,label:s,icon:a})=>jsxs("button",{type:"button",onClick:()=>o(r===i?null:i),className:ie("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(Rit,{active:r,...t})})]})})}function Rit({active:t,...e}){let n="flex flex-wrap items-center gap-2";switch(t){case "home":return jsx("div",{className:n,children:jsx(RN,{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(IN,{canEdit:e.canEdit,newShapeType:e.newShapeType,onSetNewShapeType:e.onSetNewShapeType,onAddTextBox:e.onAddTextBox,onAddShape:e.onAddShape,onAddTable:e.onAddTable,onAddChart:e.onAddChart,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(LN,{canEdit:e.canEdit,selectedElement:e.selectedElement,tableEditorState:e.tableEditorState,onUpdateTextStyle:e.onUpdateTextStyle})});case "draw":return jsx("div",{className:n,children:jsx(PN,{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(wN,{canEdit:e.canEdit,selectedElement:e.selectedElement,clipboardPayload:e.clipboardPayload,onAlignElements:e.onAlignElements,onDistributeElements:e.onDistributeElements,canDistribute:e.canDistribute,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(TN,{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(CN,{isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector})});case "animations":return jsx("div",{className:n,children:jsx(SN,{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(NN,{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(MN,{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(DN,{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(EN,{onOpenFile:e.onOpenFile,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 fpe(t){let{t:e}=useTranslation(),{mode:n,canUndo:r,canRedo:o,onUndo:i,onRedo:s,onSetMode:a,onSaveAsPptx:l}=t,[c,d]=useState(false),u=n==="edit"||n==="master",p="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:()=>d(true),className:p,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:p,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:p,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:l,className:p,title:e("pptx.toolbar.save","Save"),"aria-label":e("pptx.toolbar.save","Save"),children:jsx(LuDownload,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:()=>a("present"),className:ie(p,"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:ie(p,"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(ppe,{open:c,onClose:()=>d(false),...t})]})}var mpe=["#ffffff","#000000","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff","#008888","#888888"],Wit=Um.slice(0,12);function gpe(t){let[e,n]=useState(false),[r,o]=useState(false),[i,s]=useState(false),[a,l]=useState(false),c=useRef(null),d=useRef(null),u=useRef(null),p=useRef(null);return useEffect(()=>{if(!e)return;let h=f=>{c.current&&!c.current.contains(f.target)&&n(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[e]),useEffect(()=>{if(!r)return;let h=f=>{d.current&&!d.current.contains(f.target)&&o(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),useEffect(()=>{if(!i)return;let h=f=>{u.current&&!u.current.contains(f.target)&&s(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]),useEffect(()=>{if(!a)return;let h=f=>{p.current&&!p.current.contains(f.target)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[a]),jsxs(Fragment,{children:[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:c,children:[jsxs("button",{type:"button",disabled:!t.canEdit,className:Be,title:"Shapes",onClick:()=>n(h=>!h),children:[jsx(LuShapes,{className:Ne}),"Shapes"]}),e&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-52 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:Wit.map(h=>jsxs("button",{type:"button",className:ie("flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",t.newShapeType===h.type&&"bg-accent"),onClick:()=>{t.onSetNewShapeType(h.type),t.onAddShape(),n(false);},children:[h.icon,h.label]},h.type))})})]}),jsxs("div",{className:"relative",ref:d,children:[jsxs("button",{type:"button",disabled:!t.canEdit||!t.selectedElement,className:Be,title:"Arrange",onClick:()=>o(h=>!h),children:[jsx(LuLayers,{className:Ne}),"Arrange"]}),r&&jsx("div",{className:"absolute left-0 top-full z-50 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",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayer("forward"),o(false);},children:"Bring Forward"}),jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayer("backward"),o(false);},children:"Send Backward"}),jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayerToEdge("front"),o(false);},children:"Bring to Front"}),jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayerToEdge("back"),o(false);},children:"Send to Back"})]})})]}),jsxs("div",{className:"relative",ref:u,children:[jsx("button",{type:"button",disabled:!t.canEdit||!t.selectedElement,className:Be,title:"Shape Fill",onClick:()=>s(h=>!h),children:jsx(LuPaintBucket,{className:Ne})}),i&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 grid grid-cols-6 gap-1",children:mpe.map(h=>jsx("button",{type:"button","aria-label":`Fill colour ${h}`,className:"w-5 h-5 rounded border border-border/60 hover:scale-110 transition-transform",style:{backgroundColor:h},title:h,onClick:()=>{t.onUpdateElementStyle?.({fill:h}),s(false);}},h))})})]}),jsxs("div",{className:"relative",ref:p,children:[jsx("button",{type:"button",disabled:!t.canEdit||!t.selectedElement,className:Be,title:"Shape Outline",onClick:()=>l(h=>!h),children:jsx(LuPenLine,{className:Ne})}),a&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 grid grid-cols-6 gap-1",children:mpe.map(h=>jsx("button",{type:"button","aria-label":`Outline colour ${h}`,className:"w-5 h-5 rounded border border-border/60 hover:scale-110 transition-transform",style:{backgroundColor:h},title:h,onClick:()=>{t.onUpdateElementStyle?.({outlineColor:h}),l(false);}},h))})})]}),jsx("button",{type:"button",disabled:true,className:ie(Be,"opacity-50 cursor-not-allowed"),title:"Shape Effects (not available)",children:jsx(LuSparkles,{className:Ne})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Drawing"})]}),qt]})}function xpe(t){let[e,n]=useState(false),r=useRef(null);return useEffect(()=>{if(!e)return;let o=i=>{r.current&&!r.current.contains(i.target)&&n(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e]),jsxs(Fragment,{children:[qt,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:to,children:[jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:t.onToggleFindReplace,className:fr,title:"Find",children:jsx(LuSearch,{className:Ne})}),jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:t.onToggleFindReplace,className:Jo,title:"Replace",children:jsx(LuReplace,{className:Ne})})]}),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Select",children:jsx(LuMousePointer2,{className:Ne})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-32",children:jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:o=>o.preventDefault(),onClick:()=>{t.onSelectAll?.(),n(false);},children:"Select All"})})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Editing"})]})]})}Pe();function ype(t){let{t:e}=useTranslation(),n=No(),r=n&&n.status==="connected";return jsxs("div",{className:"flex items-center gap-1 pr-1",children:[t.onEnterRehearsalMode&&jsxs("button",{type:"button",onClick:t.onEnterRehearsalMode,className:l$.record,title:e("pptx.titleBar.record"),"aria-label":e("pptx.titleBar.record"),children:[jsx("span",{className:l$.recordDot,"aria-hidden":"true"}),jsx("span",{children:e("pptx.titleBar.record")})]}),jsxs("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:ie("relative inline-flex items-center gap-1 px-2.5 py-1 rounded-sm text-[11px] font-medium transition-colors whitespace-nowrap",r?"bg-green-600 hover:bg-green-500 text-white":"bg-primary hover:bg-primary/90 text-white"),title:r?e("pptx.toolbar.sharingUsers",{count:n.connectedCount}):e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:[jsx(LuShare2,{className:"w-3 h-3"}),jsx("span",{children:r?e("pptx.toolbar.sharingCount",{count:n.connectedCount}):e("pptx.toolbar.share")})]})]})}function bpe({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:[qt,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:ie("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:[qt,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 vpe({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:ie("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(d=>!d),className:ie("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 Spe({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(vpe,{isActive:t==="present",onPresent:()=>e("present"),onPresenterView:r,onRehearse:o,onSetUpSlideShow:i,onBroadcast:s,onToggleSubtitles:a,showSubtitles:l})}function wpe(t){let{t:e}=useTranslation(),n=r=>{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}[r]?.();};return jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>t.onSetOverflowMenuOpen(!t.isOverflowMenuOpen),className:ie("p-1.5 rounded transition-colors",t.isOverflowMenuOpen?"bg-primary/80 text-white":"bg-muted hover:bg-accent"),title:e("pptx.ribbon.moreActions"),"aria-label":e("pptx.ribbon.moreActions"),children:jsx(LuEllipsis,{className:Ne})}),t.isOverflowMenuOpen&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":e("pptx.overflow.closeMenu"),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:Vue.filter(r=>r.k!=="pptm"||t.hasMacros).map(r=>r.k.startsWith("---")?jsx("div",{className:"my-1 border-t border-border/60"},r.k):jsxs("button",{type:"button",onClick:()=>n(r.k),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[r.i,e(r.labelKey)]},r.k))})]})]})}function Cpe(t){let{t:e}=useTranslation(),{mode:n,canEdit:r,isSidebarCollapsed:o,isInspectorPaneOpen:i,onToggleSidebar:s,onToggleInspector:a}=t,l=No(),c="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:s,className:ie(c,o?"text-muted-foreground":"text-foreground"),title:e("pptx.toolbar.toggleSlidesPanel"),"aria-label":e("pptx.toolbar.toggleSlidesPanel"),children:jsx(LuPanelLeft,{className:Ne})}),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:ie(c,"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:Gn}),(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})]}),l&&(l.status==="connected"||l.status==="connecting")&&l.remoteUsers.length>0&&jsx("button",{type:"button",onClick:t.onOpenShareDialog,className:"mx-1 rounded-sm px-1 py-0.5 hover:bg-accent/60 transition-colors cursor-pointer",title:e("pptx.toolbar.sharingUsers",{count:l.connectedCount}),children:jsx(OI,{remoteUsers:l.remoteUsers,localUserName:l.config.userName,localUserColor:l.config.userColor??"#6366f1",localUserAvatar:l.config.userAvatar,status:l.status})}),jsx(Spe,{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(bpe,{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}),qt,(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:a,className:ie(c,i?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.toggleInspector"),"aria-label":e("pptx.toolbar.toggleInspector"),children:jsx(LuPanelRight,{className:Ne})}),jsx("button",{type:"button",onClick:t.onOpenSettings??t.onToggleShortcuts,className:ie(c,"text-muted-foreground"),title:e("pptx.toolbar.settingsShortcuts"),"aria-label":e("pptx.toolbar.settings"),children:jsx(LuSettings,{className:Gn})}),!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(wpe,{...t})]})}function nG(t){let{mode:e,isNarrowViewport:n,isCompactToolbarOpen:r,toolbarSection:o,onSetToolbarSection:i}=t,{t:s}=useTranslation();if(n&&e!=="present")return jsx(fpe,{...t});let a=o==="file",l=o==="home",c=o==="insert",d=l||o==="text",u=l||o==="arrange",p=o==="draw",h=o==="design",f=o==="transitions",m=o==="animations",x=o==="slideShow",g=o==="record",y=o==="review",b=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(Cpe,{...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:[Fre.map(w=>jsx("button",{type:"button",onClick:()=>i(w.id),className:ie("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:s(w.labelKey)},w.id)),jsx("div",{className:"flex-1"}),jsx(ype,{onEnterRehearsalMode:t.canEdit?t.onEnterRehearsalMode:void 0,onOpenShareDialog:t.onOpenShareDialog,onPackageForSharing:t.onPackageForSharing}),n&&jsx("button",{type:"button",onClick:t.onToggleCompactToolbar,className:ie("px-2 py-1 rounded text-[11px] transition-colors mr-1",r?"bg-primary/80 text-white":"text-muted-foreground hover:text-foreground"),title:s(r?"pptx.ribbon.collapseRibbon":"pptx.ribbon.expandRibbon"),children:s(r?"pptx.ribbon.collapseRibbon":"pptx.ribbon.expandRibbon")})]}),S&&jsxs("div",{className:ie("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:[a&&jsx(EN,{onOpenFile:t.onOpenFile,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}),l&&jsx(RN,{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}),c&&jsx(IN,{canEdit:t.canEdit,newShapeType:t.newShapeType,onSetNewShapeType:t.onSetNewShapeType,onAddTextBox:t.onAddTextBox,onAddShape:t.onAddShape,onAddTable:t.onAddTable,onAddChart:t.onAddChart,onAddSmartArt:t.onAddSmartArt,onAddEquation:t.onAddEquation,onAddActionButton:t.onAddActionButton,onInsertField:t.onInsertField,onOpenImagePicker:t.onOpenImagePicker,onOpenMediaPicker:t.onOpenMediaPicker}),d&&jsx(LN,{canEdit:t.canEdit,selectedElement:t.selectedElement,tableEditorState:t.tableEditorState,onUpdateTextStyle:t.onUpdateTextStyle}),l&&jsx(xpe,{onToggleFindReplace:t.onToggleFindReplace}),l&&jsx(gpe,{canEdit:t.canEdit,selectedElement:t.selectedElement,newShapeType:t.newShapeType,onSetNewShapeType:t.onSetNewShapeType,onAddShape:t.onAddShape,onMoveLayer:t.onMoveLayer,onMoveLayerToEdge:t.onMoveLayerToEdge}),p&&jsx(PN,{activeTool:t.activeTool,drawingColor:t.drawingColor,drawingWidth:t.drawingWidth,onSetActiveTool:t.onSetActiveTool,onSetDrawingColor:t.onSetDrawingColor,onSetDrawingWidth:t.onSetDrawingWidth}),u&&jsx(wN,{canEdit:t.canEdit,selectedElement:t.selectedElement,clipboardPayload:t.clipboardPayload,onAlignElements:t.onAlignElements,onDistributeElements:t.onDistributeElements,canDistribute:t.canDistribute,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}),h&&jsx(TN,{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(CN,{isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector}),m&&jsx(SN,{canEdit:t.canEdit,selectedElement:t.selectedElement,isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector,onOpenAnimationPanel:t.onOpenAnimationPanel,onAddAnimation:t.onAddAnimation,onRemoveAnimation:t.onRemoveAnimation}),x&&jsx(NN,{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}),g&&jsxs("div",{className:"flex items-center gap-2 px-2",children:[jsx("span",{className:"inline-block w-3 h-3 rounded-full bg-red-500"}),jsx("span",{className:"text-xs text-foreground",children:"Record"})]}),y&&jsx(MN,{canEdit:t.canEdit,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,onToggleComments:t.onToggleComments,isCommentsPanelOpen:t.isCommentsPanelOpen,slideCommentCount:t.slideCommentCount,onCompare:t.onCompare}),b&&jsx(DN,{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:Be,title:s("pptx.settings.keyboardShortcuts"),children:s("pptx.settings.keyboardShortcuts")}),jsx("button",{type:"button",onClick:t.onRunAccessibilityCheck,className:Be,title:s("pptx.ribbon.accessibilityCheck"),children:s("pptx.ribbon.accessibilityCheck")})]})]})]})}bt();Pe();var VN="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",Gu="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",Mpe=MR.filter(t=>t.value==="fadeIn"||t.value==="flyIn"||t.value==="zoomIn"),_pe=MR.filter(t=>t.value==="fadeOut"||t.value==="flyOut"||t.value==="zoomOut"),Ppe=MR.filter(t=>t.value==="spin"||t.value==="pulse"||t.value==="colorWave"||t.value==="bounce"||t.value==="flash"||t.value==="growShrink"||t.value==="teeter"),Epe=[{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"}],Ape=[{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"}],Rpe=[{value:"none",labelKey:"pptx.animation.repeatUntil.none"},{value:"untilNextClick",labelKey:"pptx.animation.repeatUntil.untilNextClick"},{value:"untilEndOfSlide",labelKey:"pptx.animation.repeatUntil.untilEndOfSlide"}],kpe=[{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}],Ipe=[{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 Ist(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 Nst(t){return t.entrance??t.emphasis??t.exit??"custom"}function Lpe({selectedElementId:t,canEdit:e,handlers:n}){let{t:r}=useTranslation(),{sortedAnimations:o,dragIndex:i,dragOverIndex:s,timelineBarData:a,handleAnimationHover:l,handleAnimationHoverEnd:c,handleDragStart:d,handleDragOver:u,handleDragEnter:p,handleDragLeave:h,handleDrop:f,handleDragEnd:m,handleMoveUp:x,handleMoveDown:g,getTimelineLabel:y}=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(b=>jsx("div",{className:ie("absolute top-0.5 bottom-0.5 rounded-sm transition-colors",Ist(b.anim),b.anim.elementId===t&&"ring-1 ring-primary"),style:{left:`${b.leftPercent}%`,width:`${Math.max(b.widthPercent,2)}%`},title:`${y(b.anim)} - ${Nst(b.anim)} (${b.anim.durationMs??500}ms)`,onMouseEnter:()=>l(b.anim),onMouseLeave:c},b.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((b,v)=>{let S=t===b.elementId;return jsxs("div",{draggable:e,onDragStart:T=>d(v,T),onDragOver:T=>u(v,T),onDragEnter:()=>p(v),onDragLeave:h,onDrop:T=>f(v,T),onDragEnd:m,onMouseEnter:()=>l(b),onMouseLeave:c,className:ie("flex items-center gap-1 px-1 py-0.5 rounded text-[10px] cursor-grab transition-colors",S?"bg-primary/30 text-primary":"bg-muted/50 text-muted-foreground",i===v&&"opacity-40",s===v&&"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:[v+1,"."]}),jsx("span",{className:"truncate flex-1",children:y(b)}),b.entrance&&jsx(LuMoveRight,{className:"w-3 h-3 text-green-400/70 shrink-0"}),b.emphasis&&jsx(LuRotateCw,{className:"w-3 h-3 text-yellow-400/70 shrink-0"}),b.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:v===0,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:T=>{T.stopPropagation(),x(v);},title:r("pptx.animation.moveUp"),children:jsx(LuChevronUp,{className:"w-3 h-3"})}),jsx("button",{type:"button",disabled:v===o.length-1,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:T=>{T.stopPropagation(),g(v);},title:r("pptx.animation.moveDown"),children:jsx(LuChevronDown,{className:"w-3 h-3"})})]})]},b.elementId)})})]})]})}bt();Pe();function Fpe({canEdit:t,updateAnimations:e}){let[n,r]=useState(null),[o,i]=useState(null),s=useRef(0),a=useCallback((x,g)=>{t&&(r(x),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("text/plain",String(x)));},[t]),l=useCallback((x,g)=>{g.preventDefault(),g.dataTransfer.dropEffect="move",i(x);},[]),c=useCallback(x=>{s.current++,i(x);},[]),d=useCallback(()=>{s.current--,s.current<=0&&(i(null),s.current=0);},[]),u=useCallback((x,g)=>{e(y=>{let b=[...y].sort((S,w)=>(S.order??0)-(w.order??0)),[v]=b.splice(x,1);return b.splice(g,0,v),b.map((S,w)=>({...S,order:w}))});},[e]),p=useCallback((x,g)=>{g.preventDefault(),s.current=0;let y=n;r(null),i(null),!(y===null||y===x)&&u(y,x);},[n,u]),h=useCallback(()=>{r(null),i(null),s.current=0;},[]),f=useCallback(x=>{x<=0||u(x,x-1);},[u]),m=useCallback(x=>{e(g=>{let y=[...g].sort((v,S)=>(v.order??0)-(S.order??0));if(x>=y.length-1)return g;let b=y[x+1];return y[x+1]=y[x],y[x]=b,y.map((v,S)=>({...v,order:S}))});},[e]);return {dragIndex:n,dragOverIndex:o,handleDragStart:a,handleDragOver:l,handleDragEnter:c,handleDragLeave:d,handleDrop:p,handleDragEnd:h,handleMoveUp:f,handleMoveDown:m}}function Ope({selectedElementId:t,selectedElementAnimation:e}){let n=useCallback(i=>{let s=i.entrance??i.emphasis??i.exit;!s||s==="none"||m6(i.elementId,s,{direction:i.direction,durationMs:i.durationMs??500,timingCurve:i.timingCurve});},[]),r=useCallback(()=>g6(),[]),o=useCallback(()=>{if(!e)return;let i=e.entrance??e.emphasis??e.exit;!i||i==="none"||m6(t,i,{direction:e.direction,durationMs:e.durationMs??500,timingCurve:e.timingCurve});},[t,e]);return {handleAnimationHover:n,handleAnimationHoverEnd:r,handlePreviewClick:o}}function Bpe({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let o=useMemo(()=>(e.animations??[]).find(E=>E.elementId===t.id),[e,t]),i=useMemo(()=>[...e.animations??[]].sort((E,R)=>(E.order??0)-(R.order??0)),[e.animations]),s=useCallback(E=>{if(!n)return;let R=e.animations??[];r({animations:E([...R])});},[n,e.animations,r]),a=useCallback((E,R)=>{s(I=>I.map(L=>L.elementId===t.id?{...L,[E]:R}:L));},[s,t.id]),l=useCallback((E,R,I)=>{n&&s(L=>{let k=L.findIndex(N=>N.elementId===t.id),F=E||R||I;if(k>=0){if(!F)return L.filter(N=>N.elementId!==t.id);L[k]={...L[k],entrance:E,exit:R,emphasis:I};}else F&&L.push({elementId:t.id,entrance:E,exit:R,emphasis:I,durationMs:500,order:L.length,trigger:"onClick"});return L});},[n,s,t.id]),c=useCallback(E=>{let R=E.target.value;l(R==="none"?void 0:R,o?.exit,o?.emphasis);},[l,o]),d=useCallback(E=>{let R=E.target.value;l(o?.entrance,R==="none"?void 0:R,o?.emphasis);},[l,o]),u=useCallback(E=>{let R=E.target.value;l(o?.entrance,o?.exit,R==="none"?void 0:R);},[l,o]),p=useCallback(E=>{let R=E.target.value;a("trigger",R),R!=="onShapeClick"&&a("triggerShapeId",void 0);},[a]),h=useCallback(E=>a("triggerShapeId",E.target.value||void 0),[a]),f=useCallback(E=>a("timingCurve",E.target.value),[a]),m=useCallback(E=>a("durationMs",Math.max(100,Math.min(1e4,Number(E.target.value)||450))),[a]),x=useCallback(E=>a("delayMs",Math.max(0,Math.min(1e4,Number(E.target.value)||0))),[a]),g=useCallback(E=>a("repeatCount",Math.max(1,Math.min(100,Number(E.target.value)||1))),[a]),y=useCallback(E=>{let R=E.target.value;a("repeatMode",R==="none"?void 0:R);},[a]),b=useCallback(E=>a("direction",E),[a]),v=useCallback(E=>a("sequence",E.target.value),[a]),S=Ope({selectedElementId:t.id,selectedElementAnimation:o}),w=Fpe({canEdit:n,updateAnimations:s}),C=useCallback(E=>{let R=e.elements?.find(L=>L.id===E.elementId);return R?(ze(R)?R.text:void 0)||ii(R):E.elementId.slice(0,8)},[e.elements]),T=!!(o?.entrance||o?.exit||o?.emphasis),M=T&&(rT.has(o?.entrance??"")||rT.has(o?.exit??"")),_=useMemo(()=>{if(i.length===0)return [];let E=0,R=i.map(L=>{let k=L.delayMs??0,F=L.durationMs??500,N=k+F;return N>E&&(E=N),{anim:L,startMs:k,durationMs:F,endMs:N}}),I=Math.max(E,1);return R.map(L=>({anim:L.anim,leftPercent:L.startMs/I*100,widthPercent:L.durationMs/I*100}))},[i]);return {selectedElementAnimation:o,sortedAnimations:i,hasAnimation:T,showDirectionPicker:M,timelineBarData:_,handleEntranceChange:c,handleExitChange:d,handleEmphasisChange:u,handleTriggerChange:p,handleTriggerShapeChange:h,handleTimingCurveChange:f,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:g,handleRepeatModeChange:y,handleDirectionChange:b,handleSequenceChange:v,getTimelineLabel:C,...S,...w}}function Upe({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=Bpe({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}),{selectedElementAnimation:s,hasAnimation:a,showDirectionPicker:l,handleEntranceChange:c,handleExitChange:d,handleEmphasisChange:u,handleTriggerChange:p,handleTriggerShapeChange:h,handleTimingCurveChange:f,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:g,handleRepeatModeChange:y,handleDirectionChange:b,handleSequenceChange:v,handlePreviewClick:S}=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:S,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:Gu,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Mpe.map(w=>jsx("option",{value:w.value,children:o(`pptx.animation.preset.${w.value}`)},w.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:u,disabled:!n,className:Gu,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Ppe.map(w=>jsx("option",{value:w.value,children:o(`pptx.animation.preset.${w.value}`)},w.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:d,disabled:!n,className:Gu,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),_pe.map(w=>jsx("option",{value:w.value,children:o(`pptx.animation.preset.${w.value}`)},w.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:kpe.map(w=>{let C=w.icon,T=s?.direction===w.value;return jsx("button",{type:"button",disabled:!n,className:ie("flex items-center justify-center w-7 h-7 rounded border transition-colors",T?"border-primary bg-primary/20 text-primary":"border-border bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>b(w.value),title:o(w.labelKey),children:jsx(C,{className:"w-3.5 h-3.5"})},w.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:v,disabled:!n,className:Gu,children:Ipe.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.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:Gu,children:Epe.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.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:h,disabled:!n,className:Gu,children:[jsx("option",{value:"",children:o("pptx.animation.trigger.selectShape")}),e.elements.filter(w=>w.id!==t.id).map(w=>jsx("option",{value:w.id,children:ii(w)},w.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:VN})]}),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:VN})]}),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:f,disabled:!n,className:Gu,children:Ape.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.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:g,className:VN})]}),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:y,disabled:!n,className:Gu,children:Rpe.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.value))})]})]}),jsx(Lpe,{selectedElementId:t.id,canEdit:n,handlers:i})]})}bt();bt();var $pe=[{key:"elements",label:"Elements",icon:LuLayers},{key:"properties",label:"Properties",icon:LuSettings2},{key:"comments",label:"Comments",icon:LuMessageSquare}],Gt="text-[11px] uppercase tracking-wide text-muted-foreground",Zt="rounded border border-border bg-card p-2 space-y-2",an="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",Hpe=[["X","x"],["Y","y"],["W","width"],["H","height"]];var Vst=[{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 Vpe({selectedElement:t,slides:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.actionClick?l_(t.actionClick,"click"):void 0,s=t.actionHover?l_(t.actionHover,"hover"):void 0,a=i?.type??"none",l=s?.type??"none",c=(d,u,p,h)=>{let m=lS({type:u,url:p,slideIndex:h});r(d==="click"?{actionClick:m}:{actionHover:m});};return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:o("pptx.action.title","Action")}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx(zpe,{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:d=>c("click",d,i?.url,i?.slideIndex),onChangeUrl:d=>c("click","url",d),onChangeSlide:d=>c("click","slide",void 0,d)}),jsx(zpe,{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:d=>c("hover",d,s?.url,s?.slideIndex),onChangeUrl:d=>c("hover","url",d),onChangeSlide:d=>c("hover","slide",void 0,d)})]})]})}function zpe({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:ie(an,"w-full"),value:e,onChange:d=>a(d.target.value),children:Vst.map(d=>jsx("option",{value:d.value,children:d.label},d.value))}),e==="url"&&jsx("input",{type:"text",disabled:!i,className:ie(an,"w-full"),placeholder:"https://...",value:n?.url??r??"",onChange:d=>l(d.target.value)}),e==="slide"&&jsx("input",{type:"number",disabled:!i,className:ie(an,"w-full"),placeholder:"Slide number (1-based)",min:1,max:s,value:(n?.slideIndex??o??0)+1,onChange:d=>{let u=Number(d.target.value);Number.isFinite(u)&&c(Math.max(0,u-1));}})]})}bt();var er="text-[11px] uppercase tracking-wide text-muted-foreground",tr="rounded border border-border bg-card p-2 space-y-2",Rn="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",sG="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",GN="bg-muted border border-border rounded px-1 py-0.5 text-[11px] w-full text-center",Gpe=[{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"}],Wpe=[{value:"clustered",labelKey:"pptx.chart.groupingClustered"},{value:"stacked",labelKey:"pptx.chart.groupingStacked"},{value:"percentStacked",labelKey:"pptx.chart.groupingPercentStacked"}],Xpe=[{value:"t",labelKey:"pptx.chart.legendTop"},{value:"b",labelKey:"pptx.chart.legendBottom"},{value:"l",labelKey:"pptx.chart.legendLeft"},{value:"r",labelKey:"pptx.chart.legendRight"}],jpe=[{value:"nextTo",labelKey:"pptx.chart.tickNextTo"},{value:"high",labelKey:"pptx.chart.tickHigh"},{value:"low",labelKey:"pptx.chart.tickLow"},{value:"none",labelKey:"pptx.chart.tickNone"}],Ype=[{value:"",labelKey:"pptx.chart.unitsNone"},{value:"hundreds",labelKey:"pptx.chart.unitsHundreds"},{value:"thousands",labelKey:"pptx.chart.unitsThousands"},{value:"tenThousands",labelKey:"pptx.chart.unitsTenThousands"},{value:"hundredThousands",labelKey:"pptx.chart.unitsHundredThousands"},{value:"millions",labelKey:"pptx.chart.unitsMillions"},{value:"tenMillions",labelKey:"pptx.chart.unitsTenMillions"},{value:"hundredMillions",labelKey:"pptx.chart.unitsHundredMillions"},{value:"billions",labelKey:"pptx.chart.unitsBillions"},{value:"trillions",labelKey:"pptx.chart.unitsTrillions"}];var Kpe=[{key:"showValue",labelKey:"pptx.chart.labelValue"},{key:"showCategory",labelKey:"pptx.chart.labelCategory"},{key:"showSeriesName",labelKey:"pptx.chart.labelSeriesName"},{key:"showPercent",labelKey:"pptx.chart.labelPercent"},{key:"showLegendKey",labelKey:"pptx.chart.labelLegendKey"}],qpe=[{value:"",labelKey:"pptx.chart.labelPosDefault"},{value:"ctr",labelKey:"pptx.chart.labelPosCenter"},{value:"inEnd",labelKey:"pptx.chart.labelPosInsideEnd"},{value:"inBase",labelKey:"pptx.chart.labelPosInsideBase"},{value:"outEnd",labelKey:"pptx.chart.labelPosOutsideEnd"},{value:"bestFit",labelKey:"pptx.chart.labelPosBestFit"}],Zpe=[{value:"",labelKey:"pptx.chart.trendlineNone"},{value:"linear",labelKey:"pptx.chart.trendlineLinear"},{value:"exponential",labelKey:"pptx.chart.trendlineExponential"},{value:"logarithmic",labelKey:"pptx.chart.trendlineLogarithmic"},{value:"polynomial",labelKey:"pptx.chart.trendlinePolynomial"},{value:"power",labelKey:"pptx.chart.trendlinePower"},{value:"movingAvg",labelKey:"pptx.chart.trendlineMovingAvg"}],Jpe=new Set(["bar","line","area","scatter","bubble"]),Qpe=[{value:"",labelKey:"pptx.chart.errorBarNone"},{value:"fixedVal",labelKey:"pptx.chart.errorBarFixed"},{value:"percentage",labelKey:"pptx.chart.errorBarPercentage"},{value:"stdDev",labelKey:"pptx.chart.errorBarStdDev"},{value:"stdErr",labelKey:"pptx.chart.errorBarStdErr"}],ehe=[{value:"both",labelKey:"pptx.chart.errorBarBoth"},{value:"plus",labelKey:"pptx.chart.errorBarPlus"},{value:"minus",labelKey:"pptx.chart.errorBarMinus"}],the=new Set(["fixedVal","percentage","stdDev"]),nhe=new Set(["bar","line","area","scatter","bubble"]),rhe=new Set(["bar","line","area"]),WN=[{value:"",labelKey:"pptx.chart.markerAuto"},{value:"none",labelKey:"pptx.chart.markerNone"},{value:"circle",labelKey:"pptx.chart.markerCircle"},{value:"square",labelKey:"pptx.chart.markerSquare"},{value:"diamond",labelKey:"pptx.chart.markerDiamond"},{value:"triangle",labelKey:"pptx.chart.markerTriangle"},{value:"x",labelKey:"pptx.chart.markerX"},{value:"star",labelKey:"pptx.chart.markerStar"},{value:"plus",labelKey:"pptx.chart.markerPlus"},{value:"dot",labelKey:"pptx.chart.markerDot"},{value:"dash",labelKey:"pptx.chart.markerDash"}],XN=new Set(["line","scatter","bubble","radar"]),ohe=[{value:"",labelKey:"pptx.chart.dashDefault"},{value:"solid",labelKey:"pptx.chart.dashSolid"},{value:"dash",labelKey:"pptx.chart.dashDash"},{value:"dot",labelKey:"pptx.chart.dashDot"},{value:"dashDot",labelKey:"pptx.chart.dashDashDot"},{value:"lgDash",labelKey:"pptx.chart.dashLong"}],ihe=[{value:"",labelKey:"pptx.chart.comboDefault"},{value:"bar",labelKey:"pptx.chart.typeBar"},{value:"line",labelKey:"pptx.chart.typeLine"},{value:"area",labelKey:"pptx.chart.typeArea"},{value:"scatter",labelKey:"pptx.chart.typeScatter"}],she=new Set(["bar","line","area","combo"]),ahe=new Set(["pie","pie3D","doughnut","ofPie"]);var Wst=[{type:"valAx",labelKey:"pptx.chart.valueAxis",hasScale:true},{type:"dateAx",labelKey:"pptx.chart.dateAxis",hasScale:true},{type:"catAx",labelKey:"pptx.chart.categoryAxis",hasScale:false}];function lhe({axes:t,canEdit:e,onUpdateAxis:n}){let{t:r}=useTranslation(),o=Wst.map(s=>({...s,axis:t?.find(a=>a.axisType===s.type)})).filter(s=>!!s.axis);if(o.length===0)return null;let i=(s,a,l,c)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r(a)}),jsx("input",{type:"number",disabled:!e,className:Rn,value:l??"",placeholder:r("pptx.chart.auto"),onChange:d=>{let u=d.target.value;if(u===""){n(s,{[c]:void 0});return}let p=Number.parseFloat(u);Number.isFinite(p)&&n(s,{[c]:p});}})]});return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:r("pptx.chart.axes")}),o.map(({type:s,labelKey:a,hasScale:l,axis:c})=>jsxs("div",{className:"space-y-1.5",children:[jsx("div",{className:"text-[11px] font-medium",children:r(a)}),l&&jsxs("div",{className:"space-y-1.5 ml-2",children:[i(s,"pptx.chart.min",c.min,"min"),i(s,"pptx.chart.max",c.max,"max"),i(s,"pptx.chart.majorUnit",c.majorUnit,"majorUnit"),i(s,"pptx.chart.minorUnit",c.minorUnit,"minorUnit"),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.displayUnits")}),jsx("select",{disabled:!e,className:Rn,value:c.displayUnits??"",onChange:d=>n(s,{displayUnits:d.target.value||void 0}),children:Ype.map(d=>jsx("option",{value:d.value,children:r(d.labelKey)},d.value))})]})]}),jsxs("div",{className:"space-y-1.5 ml-2",children:[jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.axisTitle")}),jsx("input",{type:"text",disabled:!e,className:Rn,value:c.titleText??"",placeholder:r("pptx.chart.axisTitlePlaceholder"),onChange:d=>n(s,{titleText:d.target.value})})]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.numberFormat")}),jsx("input",{type:"text",disabled:!e,className:Rn,value:c.numFmt?.formatCode??"",placeholder:"General",onChange:d=>n(s,{numFmt:d.target.value?{formatCode:d.target.value,sourceLinked:false}:void 0})})]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.tickLabels")}),jsx("select",{disabled:!e,className:Rn,value:c.tickLblPos??"nextTo",onChange:d=>n(s,{tickLblPos:d.target.value}),children:jpe.map(d=>jsx("option",{value:d.value,children:r(d.labelKey)},d.value))})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.majorGridlines??false,onChange:d=>n(s,{majorGridlines:d.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.majorGridlines")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.minorGridlines??false,onChange:d=>n(s,{minorGridlines:d.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.minorGridlines")})]})]})]},s))]})}var jst=[{type:"valAx",labelKey:"pptx.chart.valueAxis"},{type:"dateAx",labelKey:"pptx.chart.dateAxis"},{type:"catAx",labelKey:"pptx.chart.categoryAxis"}];function che({axes:t,canEdit:e,onSetLogScale:n,onSetTitleStyle:r,onSetGridlineStyle:o}){let{t:i}=useTranslation(),s=jst.map(a=>({...a,axis:t?.find(l=>l.axisType===a.type)})).filter(a=>!!a.axis);return s.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:i("pptx.chart.axisStyling")}),s.map(({type:a,labelKey:l,axis:c})=>{let d=a==="valAx"||a==="dateAx";return jsxs("div",{className:"space-y-1.5",children:[jsx("div",{className:"text-[11px] font-medium",children:i(l)}),jsxs("div",{className:"space-y-1.5 ml-2",children:[d&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.logScale??false,onChange:u=>n(a,{enabled:u.target.checked,base:c.logBase}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:i("pptx.chart.logScale")})]}),c.logScale&&jsx("input",{type:"number",min:2,disabled:!e,title:i("pptx.chart.logBase"),className:"w-16 bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:c.logBase??10,onChange:u=>{let p=Number.parseFloat(u.target.value);Number.isFinite(p)&&p>1&&n(a,{enabled:true,base:p});}})]}),jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:i("pptx.chart.titleFont")}),jsx("input",{type:"text",disabled:!e,className:Rn,placeholder:i("pptx.chart.auto"),value:c.fontFamily??"",onChange:u=>r(a,{fontFamily:u.target.value||null})}),jsx("input",{type:"number",min:4,max:96,disabled:!e,title:i("pptx.chart.fontSize"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:c.fontSize??"",placeholder:i("pptx.chart.auto"),onChange:u=>{let p=u.target.value,h=Number.parseFloat(p);r(a,{fontSize:Number.isFinite(h)?h:null});}})]}),jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.fontBold??false,onChange:u=>r(a,{fontBold:u.target.checked}),className:"accent-primary"}),jsx("span",{children:i("pptx.chart.bold")})]}),jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.chart.titleColor")}),jsx("input",{type:"color",disabled:!e,className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:c.fontColor??"#000000",onChange:u=>r(a,{fontColor:u.target.value})})]})]}),["major","minor"].map(u=>{let p=u==="major"?c.majorGridlinesSpPr:c.minorGridlinesSpPr;return (u==="major"?c.majorGridlines:c.minorGridlines)?jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:i(u==="major"?"pptx.chart.majorGridlines":"pptx.chart.minorGridlines")}),jsx("input",{type:"color",disabled:!e,title:i("pptx.chart.gridlineColor"),className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:p?.strokeColor??"#d9d9d9",onChange:f=>o(a,u,{color:f.target.value})}),jsx("input",{type:"number",min:.25,step:.25,disabled:!e,title:i("pptx.chart.gridlineWidth"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:p?.strokeWidth??"",placeholder:i("pptx.chart.auto"),onChange:f=>{let m=Number.parseFloat(f.target.value);o(a,u,{width:Number.isFinite(m)?m:null});}}),jsx("select",{disabled:!e,title:i("pptx.chart.gridlineDash"),className:Rn,value:p?.strokeDashStyle??"",onChange:f=>o(a,u,{dashStyle:f.target.value||null}),children:ohe.map(f=>jsx("option",{value:f.value,children:i(f.labelKey)},f.value))})]},u):null})]})]},a)})]})}function uhe({chartType:t,series:e,canEdit:n,onSetSeriesType:r}){let{t:o}=useTranslation();return !she.has(t)||e.length<2?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.comboTypes")}),jsx("div",{className:"space-y-1.5",children:e.map((i,s)=>jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:i.seriesChartType??"",onChange:a=>{let l=a.target.value;r(s,l===""?null:l);},children:ihe.map(a=>jsx("option",{value:a.value,children:o(a.labelKey)},a.value))})]},`${i.name}-${s}`))})]})}function fhe({series:t,categories:e,canEdit:n,onUpdateSeries:r,onUpdateCategoryLabel:o,onUpdateValue:i,onAddCategory:s,onRemoveCategory:a,onAddSeries:l,onRemoveSeries:c}){let{t:d}=useTranslation();return jsxs("div",{className:tr,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:er,children:d("pptx.chart.data")}),n&&jsxs("div",{className:"flex gap-1",children:[jsxs("button",{type:"button",className:sG,title:d("pptx.chart.addCategory"),onClick:s,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),d("pptx.chart.cat")]}),jsxs("button",{type:"button",className:sG,title:d("pptx.chart.addSeries"),onClick:l,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),d("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",{"aria-label":"Categories",className:"text-muted-foreground p-0.5 text-left min-w-[60px]"}),t.map((u,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:GN,value:u.name,onChange:h=>r(p,{name:h.target.value})}),n&&t.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:d("pptx.chart.removeSeries"),onClick:()=>c(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})},p))]})}),jsx("tbody",{children:e.map((u,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:GN,value:u,onChange:h=>o(p,h.target.value)}),n&&e.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:d("pptx.chart.removeCategory"),onClick:()=>a(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})}),t.map((h,f)=>jsx("td",{className:"p-0.5",children:jsx("input",{type:"number","aria-label":`${h.name} value ${p+1}`,disabled:!n,className:GN,value:h.values[p]??0,onChange:m=>i(f,p,m.target.value)})},f))]},p))})]})})]})}function mhe({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();if(!t?.hasDataLabels)return null;let o=t.dataLabels??{},i=s=>n({dataLabels:{...o,...s}});return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:r("pptx.chart.dataLabels")}),jsxs("div",{className:"space-y-1.5",children:[Kpe.map(s=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:o[s.key]??false,onChange:a=>i({[s.key]:a.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r(s.labelKey)})]},s.key)),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.labelPosition")}),jsx("select",{disabled:!e,className:Rn,value:o.position??"",onChange:s=>i({position:s.target.value||void 0}),children:qpe.map(s=>jsx("option",{value:s.value,children:r(s.labelKey)},s.value))})]})]})]})}var Qst=WN.filter(t=>t.value!=="");function ghe({chartType:t,categories:e,series:n,canEdit:r,onSetPointMarker:o}){let{t:i}=useTranslation(),[s,a]=useState(0);if(!XN.has(t)||n.length===0||e.length===0)return null;let l=n[Math.min(s,n.length-1)],c=d=>l.dataPoints?.find(u=>u.idx===d);return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:i("pptx.chart.pointMarkers")}),n.length>1&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:i("pptx.chart.series")}),jsx("select",{disabled:!r,className:"flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",value:Math.min(s,n.length-1),onChange:d=>a(Number.parseInt(d.target.value,10)),children:n.map((d,u)=>jsx("option",{value:u,children:d.name},`${d.name}-${u}`))})]}),jsx("div",{className:"space-y-2",children:e.map((d,u)=>{let p=c(u),h=p?.marker!==void 0;return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:d,children:d}),jsxs("label",{className:"flex items-center gap-1 shrink-0",children:[jsx("input",{type:"checkbox",disabled:!r,checked:h,onChange:f=>{o(s,u,f.target.checked?{symbol:"circle"}:null);}}),jsx("span",{className:"text-muted-foreground",children:i("pptx.chart.markerOverride")})]})]}),h&&p?.marker&&jsxs("div",{className:"flex items-center gap-2 ml-2 flex-wrap",children:[jsx("select",{disabled:!r,className:"bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:p.marker.symbol,onChange:f=>o(s,u,{symbol:f.target.value}),children:Qst.map(f=>jsx("option",{value:f.value,children:i(f.labelKey)},f.value))}),jsx("input",{type:"number",min:1,max:20,disabled:!r,title:i("pptx.chart.markerSize"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:p.marker.size??"",placeholder:i("pptx.chart.auto"),onChange:f=>{let m=Number.parseInt(f.target.value,10);o(s,u,{size:Number.isFinite(m)?m:void 0});}}),jsx("input",{type:"color",disabled:!r,title:i("pptx.chart.markerFill"),className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:p.marker.spPr?.fillColor??"#4472c4",onChange:f=>o(s,u,{fillColor:f.target.value})})]})]},`${d}-${u}`)})})]})}function xhe({chartType:t,categories:e,series:n,canEdit:r,onSetPointFill:o,onSetPointExplosion:i,onSetPointLabel:s}){let{t:a}=useTranslation(),[l,c]=useState(0);if(n.length===0||e.length===0)return null;let d=n[Math.min(l,n.length-1)],u=ahe.has(t),p=h=>d.dataPoints?.find(f=>f.idx===h);return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:a("pptx.chart.dataPoints")}),n.length>1&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:a("pptx.chart.series")}),jsx("select",{disabled:!r,className:Rn,value:Math.min(l,n.length-1),onChange:h=>c(Number.parseInt(h.target.value,10)),children:n.map((h,f)=>jsx("option",{value:f,children:h.name},`${h.name}-${f}`))})]}),jsx("div",{className:"space-y-1.5",children:e.map((h,f)=>{let m=p(f);return jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:h,children:h}),jsx("input",{type:"text",disabled:!r,title:a("pptx.chart.pointLabelOverride"),className:"w-20 bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:d.dataLabels?.find(x=>x.idx===f)?.text??"",placeholder:a("pptx.chart.auto"),onChange:x=>{let g=x.target.value;s(l,f,g===""?null:g);}}),jsx("input",{type:"color",disabled:!r,title:a("pptx.chart.pointFill"),className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:m?.spPr?.fillColor??d.color??"#4472c4",onChange:x=>o(l,f,x.target.value)}),m?.spPr?.fillColor&&jsx("button",{type:"button",disabled:!r,title:a("pptx.chart.pointFillClear"),className:"text-muted-foreground hover:text-foreground",onClick:()=>o(l,f,null),children:"\xD7"}),u&&jsx("input",{type:"number",min:0,max:100,disabled:!r,title:a("pptx.chart.pointExplosion"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:m?.explosion??"",placeholder:"0",onChange:x=>{let g=x.target.value;if(g===""){i(l,f,null);return}let y=Number.parseInt(g,10);Number.isFinite(y)&&i(l,f,y);}})]},`${h}-${f}`)})})]})}function yhe({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:tr,children:[jsx("div",{className:er,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:Rn,value:t.legendPosition??"b",onChange:o=>n({legendPosition:o.target.value}),children:Xpe.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 bhe({chartType:t,series:e,canEdit:n,onSetErrorBars:r}){let{t:o}=useTranslation();return !nhe.has(t)||e.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.errorBars")}),jsx("div",{className:"space-y-2",children:e.map((i,s)=>{let a=i.errBars?.[0],l=a?.valType??"",c=the.has(l);return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:l,onChange:d=>{let u=d.target.value;if(!u){r(s,null);return}r(s,{direction:a?.direction??"y",barType:a?.barType??"both",valType:u,val:a?.val});},children:Qpe.map(d=>jsx("option",{value:d.value,children:o(d.labelKey)},d.value))})]}),a&&jsxs("div",{className:"flex items-center gap-2 ml-2",children:[jsx("select",{disabled:!n,className:Rn,value:a.barType,onChange:d=>r(s,{...a,barType:d.target.value}),children:ehe.map(d=>jsx("option",{value:d.value,children:o(d.labelKey)},d.value))}),c&&jsx("input",{type:"number",disabled:!n,className:Rn,value:a.val??"",placeholder:o("pptx.chart.errorBarAmount"),onChange:d=>{let u=d.target.value,p=u===""?void 0:Number.parseFloat(u);u!==""&&!Number.isFinite(p)||r(s,{...a,val:p});}})]})]},`${i.name}-${s}`)})})]})}function vhe({chartType:t,series:e,canEdit:n,onSetMarker:r}){let{t:o}=useTranslation();return !XN.has(t)||e.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.markers")}),jsx("div",{className:"space-y-2",children:e.map((i,s)=>{let a=i.marker;return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:a?.symbol??"",onChange:l=>{let c=l.target.value;if(c===""){r(s,null);return}r(s,{symbol:c});},children:WN.map(l=>jsx("option",{value:l.value,children:o(l.labelKey)},l.value))})]}),a&&a.symbol!=="none"&&jsxs("div",{className:"flex items-center gap-3 ml-2",children:[jsxs("label",{className:"flex items-center gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.chart.markerSize")}),jsx("input",{type:"number",min:2,max:72,disabled:!n,className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:a.size??"",placeholder:o("pptx.chart.auto"),onChange:l=>{let c=l.target.value,d=Number.parseInt(c,10);r(s,{size:Number.isFinite(d)?d:void 0});}})]}),jsxs("label",{className:"flex items-center gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.chart.markerFill")}),jsx("input",{type:"color",disabled:!n,className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:a.spPr?.fillColor??"#4472c4",onChange:l=>r(s,{fillColor:l.target.value})})]})]})]},`${i.name}-${s}`)})})]})}function Lo({value:t,disabled:e,className:n,ariaLabel:r,onCommit:o}){let[i,s]=useState(t),a=useRef(o);a.current=o,useEffect(()=>{s(t);},[t]);let l=useCallback(c=>{let d=c.target.value;s(d),a.current(d);},[]);return jsx("input",{type:"color","aria-label":r??"Color",disabled:e,value:i,className:n,onChange:l})}var pat="#4472c4";function whe({series:t,canEdit:e,onSetColor:n}){let{t:r}=useTranslation();return t.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:r("pptx.chart.seriesColors")}),jsx("div",{className:"space-y-1",children:t.map((o,i)=>jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:o.name,children:o.name}),jsx(Lo,{value:o.color??pat,disabled:!e,ariaLabel:r("pptx.chart.seriesColor",{name:o.name}),className:"h-6 w-8 cursor-pointer rounded border border-border bg-muted p-0",onCommit:s=>n(i,s)}),e&&o.color&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:r("pptx.chart.clearSeriesColor"),onClick:()=>n(i,null),children:jsx(LuX,{className:"w-3 h-3"})})]},`${o.name}-${i}`))})]})}function The({chartType:t,series:e,canEdit:n,onSetTrendline:r}){let{t:o}=useTranslation();return !Jpe.has(t)||e.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.trendlines")}),jsx("div",{className:"space-y-2",children:e.map((i,s)=>{let a=i.trendlines?.[0];return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:a?.trendlineType??"",onChange:l=>{let c=l.target.value;if(!c){r(s,null);return}r(s,{...a,trendlineType:c});},children:Zpe.map(l=>jsx("option",{value:l.value,children:o(l.labelKey)},l.value))})]}),a&&jsxs("div",{className:"flex items-center gap-3 ml-2",children:[jsxs("label",{className:"flex items-center gap-1 text-[11px] cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!n,checked:a.displayEq??false,onChange:l=>r(s,{...a,displayEq:l.target.checked}),className:"accent-primary"}),jsx("span",{children:o("pptx.chart.trendlineEquation")})]}),jsxs("label",{className:"flex items-center gap-1 text-[11px] cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!n,checked:a.displayRSq??false,onChange:l=>r(s,{...a,displayRSq:l.target.checked}),className:"accent-primary"}),jsx("span",{children:o("pptx.chart.trendlineRSquared")})]})]})]},`${i.name}-${s}`)})})]})}function Che({title:t,chartType:e,grouping:n,seriesCount:r,categoryCount:o,canEdit:i,onUpdateChartData:s}){let{t:a}=useTranslation(),l=rhe.has(e);return jsxs("div",{className:tr,children:[jsx("div",{className:er,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:Rn,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:Rn,value:e,onChange:c=>s({chartType:c.target.value}),children:Gpe.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:Rn,value:n??"clustered",onChange:c=>s({grouping:c.target.value}),children:Wpe.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]})]})}function Mhe({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,d=useCallback(D=>{n({chartData:D});},[n]),u=useCallback(D=>{if(r){if(D.chartType&&D.chartType!==r.chartType){let U=e3(r,D.chartType),{chartType:G,...j}=D;d({...U,...j});return}n({chartData:{...r,...D}});}},[r,n,d]),p=useCallback(D=>{r&&n({chartData:{...r,style:{...l,...D}}});},[r,l,n]),h=useCallback((D,U)=>{if(!r)return;let G=r.axes?[...r.axes]:[],j=G.findIndex(Y=>Y.axisType===D);j===-1?G.push({axisType:D,...U}):G[j]={...G[j],...U},u({axes:G});},[r,u]),f=useCallback((D,U)=>{if(!a)return;let G=a.map((j,Y)=>Y===D?{...j,...U}:j);u({series:G});},[a,u]),m=useCallback((D,U)=>{if(!a)return;let G=a.map((j,Y)=>Y===D?{...j,trendlines:U?[U]:[]}:j);u({series:G});},[a,u]),x=useCallback((D,U)=>{if(!a)return;let G=a.map((j,Y)=>Y===D?{...j,errBars:U?[U]:[]}:j);u({series:G});},[a,u]),g=useCallback((D,U)=>{f(D,{color:U??void 0});},[f]),y=useCallback((D,U)=>{if(!s)return;let G=s.map((j,Y)=>Y===D?U:j);u({categories:G});},[s,u]),b=useCallback((D,U,G)=>{if(!r)return;let j=Number.parseFloat(G);Number.isFinite(j)&&d(QD(r,D,U,j));},[r,d]),v=useCallback(()=>{!r||!s||d(t3(r,`Cat ${s.length+1}`));},[r,s,d]),S=useCallback(D=>{!r||!s||s.length<=1||d(n3(r,D));},[r,s,d]),w=useCallback(()=>{!r||!s||!a||d(ZD(r,{name:`Series ${a.length+1}`,values:s.map(()=>0)}));},[r,s,a,d]),C=useCallback(D=>{!r||!a||a.length<=1||d(JD(r,D));},[r,a,d]),T=useCallback(D=>{if(!r)return;let U={...t,chartData:structuredClone(r)};D(U),d(U.chartData);},[r,t,d]),M=useCallback((D,U)=>T(G=>U3(G,D,U)),[T]),_=useCallback((D,U)=>T(G=>$3(G,D,U)),[T]),E=useCallback((D,U,G)=>T(j=>H3(j,D,U,G)),[T]),R=useCallback((D,U)=>T(G=>z3(G,D,U)),[T]),I=useCallback((D,U)=>T(G=>V3(G,D,U)),[T]),L=useCallback((D,U,G)=>T(j=>W3(j,D,U,G)),[T]),k=useCallback((D,U,G)=>T(j=>X3(j,D,U,G)),[T]),F=useCallback((D,U,G)=>T(j=>j3(j,D,U,G)),[T]),N=useCallback((D,U,G)=>T(j=>Y3(j,D,U,G!==null?{text:G}:null)),[T]);return !r||!s||!a?null:jsxs(Fragment,{children:[jsx(Che,{title:o,chartType:i,grouping:c,seriesCount:a.length,categoryCount:s.length,canEdit:e,onUpdateChartData:u}),jsx(yhe,{style:l,canEdit:e,onUpdateStyle:p}),jsx(mhe,{style:l,canEdit:e,onUpdateStyle:p}),jsx(lhe,{axes:r.axes,canEdit:e,onUpdateAxis:h}),jsx(che,{axes:r.axes,canEdit:e,onSetLogScale:M,onSetTitleStyle:_,onSetGridlineStyle:E}),jsx(vhe,{chartType:i,series:a,canEdit:e,onSetMarker:R}),jsx(uhe,{chartType:i,series:a,canEdit:e,onSetSeriesType:I}),jsx(xhe,{chartType:i,categories:s,series:a,canEdit:e,onSetPointFill:L,onSetPointExplosion:k,onSetPointLabel:N}),jsx(ghe,{chartType:i,categories:s,series:a,canEdit:e,onSetPointMarker:F}),jsx(The,{chartType:i,series:a,canEdit:e,onSetTrendline:m}),jsx(bhe,{chartType:i,series:a,canEdit:e,onSetErrorBars:x}),jsx(whe,{series:a,canEdit:e,onSetColor:g}),jsx(fhe,{categories:s,series:a,canEdit:e,onUpdateSeries:f,onUpdateCategoryLabel:y,onUpdateValue:b,onAddCategory:v,onRemoveCategory:S,onAddSeries:w,onRemoveSeries:C})]})}bt();function _he({selectedElement:t,canEdit:e,onUpdateElementStyle:n}){return t.type!=="connector"?null:jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:ie(an,"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 Phe({selectedElement:t}){if(t.type!=="group")return null;let e=t;return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:"Group"}),jsx("div",{className:"text-[11px] text-muted-foreground",children:Array.isArray(e.children)?`${e.children.length} children`:"Grouped element"})]})}function Ehe({selectedElement:t}){let{t:e}=useTranslation();if(t.type!=="ole")return null;let n=t;return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:PD(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:ie("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 Ahe({selectedElement:t,canEdit:e,onUpdateElement:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,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 Rhe({canEdit:t,onMoveLayer:e}){return jsxs("div",{className:"flex gap-1",children:[jsx("button",{type:"button",className:ie("flex-1",xr),disabled:!t,onClick:()=>e("forward"),children:"\u2191 Forward"}),jsx("button",{type:"button",className:ie("flex-1",xr),disabled:!t,onClick:()=>e("backward"),children:"\u2193 Backward"})]})}Pe();function Ihe({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:dre.map(([i,s,a])=>{let l=i==="none"?!e?.artisticEffect:e?.artisticEffect===i;return jsxs("button",{type:"button",disabled:!n,className:ie("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 Nhe({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(Lo,{disabled:!e,value:et(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(Lo,{disabled:!e||!!o.clrToTransparent,value:et(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 Lhe({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(Lo,{disabled:!e,value:et(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 Ohe({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(d=>{i(d.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let d=c.current;if(!d)return;let u=()=>{s.current(d.value);};return d.addEventListener("change",u),()=>d.removeEventListener("change",u)},[]),jsx("input",{ref:c,type:"color",disabled:e,className:n,value:o,onChange:a,onBlur:l})}function Bhe({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o="imageEffects"in t?t.imageEffects:void 0,i=useCallback((c,d)=>{n({imageEffects:{...o,duotone:{color1:c,color2:d}}});},[o,n]),s=useCallback(()=>{n({imageEffects:{...o,duotone:void 0}});},[o,n]),a=et(o?.duotone?.color1,"#000000"),l=et(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(Ohe,{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(Ohe,{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:YU.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 Uhe({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(h=>{n({imageEffects:{...o,...h}});},[o,n]),d=useCallback(h=>{let f=Number(h.target.value);c({alphaModFix:100-f});},[c]),u=useCallback(h=>{c({biLevel:Number(h.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:d}),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:u}),jsx("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:a})]})]})]})}function JN({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 Hhe({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.imageEffects,i=s=>{n({imageEffects:{...o,...s}});};return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:ie(an,"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(JN,{label:"Brightness",disabled:!e,value:o?.brightness??0,onChange:s=>i({brightness:s})}),jsx(JN,{label:"Contrast",disabled:!e,value:o?.contrast??0,onChange:s=>i({contrast:s})}),jsx(JN,{label:r("pptx.image.saturation"),disabled:!e,value:o?.saturation??0,onChange:s=>i({saturation:s})})]}),jsx(Uhe,{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(Bhe,{selectedElement:t,canEdit:e,onUpdateElement:n})]}),jsx(Lhe,{fx:o,canEdit:e,updateEffects:i}),jsx(Nhe,{fx:o,canEdit:e,updateEffects:i}),jsx(Ihe,{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 Rat="text-[11px] uppercase tracking-wide text-muted-foreground",kat="rounded border border-border bg-card p-2 space-y-2",Iat="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",Nat="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",Lat="flex items-center justify-between gap-2",Xhe="text-muted-foreground";function QN(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 Ghe(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 Dat(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 Whe({label:t,valueMs:e,maxMs:n,disabled:r,onChange:o}){let[i,s]=useState(null),[a,l]=useState(false),c=i??QN(e),d=useCallback(()=>{s(QN(e)),l(false);},[e]),u=useCallback(()=>{if(i!==null){let f=Ghe(i);f!==void 0&&f>=0&&(n<=0||f<=n)&&o(f),l(false);}s(null);},[i,n,o]),p=useCallback(f=>{let m=f.target.value;s(m);let x=Ghe(m);l(x===void 0);},[]),h=useCallback(f=>{f.key==="Enter"?f.currentTarget.blur():f.key==="Escape"&&(s(null),l(false));},[]);return jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Xhe}`,children:t}),jsx("input",{type:"text",disabled:r,className:`${Iat} text-[11px] tabular-nums ${a?"border-red-400":""}`,value:c,placeholder:"00:00",onFocus:d,onBlur:u,onChange:p,onKeyDown:h})]})}function jhe({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 f=i,m=s>0?s:a;return m<=f||a<=0?QN(a):QN(m-f)},[i,s,a]),c=useMemo(()=>Dat(i,s,a),[i,s,a]),d=i>0||s>0,u=useCallback(f=>{r({trimStartMs:f});},[r]),p=useCallback(f=>{r({trimEndMs:f});},[r]),h=useCallback(()=>{r({trimStartMs:0,trimEndMs:0});},[r]);return jsxs("div",{className:kat,children:[jsxs("div",{className:Rat,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(Whe,{label:o("pptx.media.trimStartTime"),valueMs:i,maxMs:a,disabled:!e,onChange:u}),jsx(Whe,{label:o("pptx.media.trimEndTime"),valueMs:s,maxMs:a,disabled:!e,onChange:p})]}),jsxs("div",{className:Lat,children:[jsxs("span",{className:`text-[11px] ${Xhe}`,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&&d&&jsx("button",{type:"button",className:`${Nat} w-full text-center`,onClick:h,children:o("pptx.media.resetTrim")})]})}function Yh(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 Yhe(){return `bmk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var pv="text-[11px] uppercase tracking-wide text-muted-foreground",hv="rounded border border-border bg-card p-2 space-y-2",I2="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",e5="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",il="flex items-center justify-between gap-2",Ki="text-muted-foreground";function Khe({duration:t,trimStartMs:e,trimEndMs:n,currentTime:r,bookmarks:o,canEdit:i,onTrimChange:s,onSeek:a}){let l=useRef(null),[c,d]=useState(null),u=e/1e3,p=n>0?n/1e3:t,h=t>0?t:1,f=u/h*100,m=p/h*100,x=r/h*100,g=useCallback(b=>{let v=l.current;if(!v)return 0;let S=v.getBoundingClientRect();return Math.max(0,Math.min(1,(b-S.left)/S.width))*h},[h]);useEffect(()=>{if(!c)return;let b=S=>{let w=g(S.clientX);if(c==="start"){let C=Math.min(w,p-.1);s(Math.max(0,C)*1e3,n);}else {let C=Math.max(w,u+.1);s(e,Math.min(C,t)*1e3);}},v=()=>{d(null);};return window.addEventListener("pointermove",b),window.addEventListener("pointerup",v),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",v);}},[c,t,g,s,n,p,e,u]);let y=b=>{let v=g(b.clientX);a(v);};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:Yh(u)}),jsx("span",{children:Yh(p)})]}),jsxs("div",{ref:l,className:"relative h-5 rounded bg-muted cursor-pointer select-none",onClick:y,children:[jsx("div",{className:"absolute top-0 bottom-0 bg-primary/30 rounded",style:{left:`${f}%`,width:`${m-f}%`}}),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(${f}% - 4px)`},onPointerDown:b=>{b.stopPropagation(),d("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:b=>{b.stopPropagation(),d("end");}}),o.map(b=>{let v=b.time/h*100;return jsx("div",{className:"absolute top-0 bottom-0 w-1 bg-yellow-400/70 z-10 cursor-pointer",style:{left:`${v}%`},title:b.label,onClick:S=>{S.stopPropagation(),a(b.time);}},b.id)})]})]})}function Zhe({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),d=useCallback(()=>{let p=a.trim()||`${s("pptx.media.bookmark")} ${r.length+1}`,h={id:Yhe(),time:n,label:p};o({bookmarks:[...r,h]}),l("");},[r,n,a,o,s]),u=useCallback(p=>{o({bookmarks:r.filter(h=>h.id!==p)});},[r,o]);return jsxs(Fragment,{children:[jsxs("div",{className:hv,children:[jsx("div",{className:pv,children:s("pptx.media.playback")}),jsxs("label",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:s("pptx.media.speed")}),jsxs("select",{disabled:!e,className:`${I2} 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] ${Ki}`,children:s("pptx.media.fadeIn")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${I2} 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] ${Ki}`,children:s("pptx.media.fadeOut")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${I2} text-[11px]`,value:t.fadeOutDuration??0,onChange:p=>o({fadeOutDuration:Number(p.target.value)||void 0})})]})]}),jsxs("label",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:hv,children:[jsxs("div",{className:pv,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,h)=>p.time-h.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:Yh(p.time)}),e&&jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-300 transition-opacity",onClick:()=>u(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:`${I2} text-[11px]`,placeholder:s("pptx.media.bookmarkLabel"),value:a,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),d());}}),jsx("button",{type:"button",className:e5,onClick:d,title:s("pptx.media.addBookmark"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function Qhe({element:t,mediaDataUrls:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=useRef(null),[s,a]=useState(false),[l,c]=useState(0),[d,u]=useState(0),p=t.mediaData??(t.mediaPath?e.get(t.mediaPath):void 0),h=t.bookmarks??[],f=t.mediaType==="video";useEffect(()=>{let v=i.current;if(!v)return;let S=()=>c(v.currentTime),w=()=>{Number.isFinite(v.duration)&&u(v.duration);},C=()=>a(true),T=()=>a(false),M=()=>a(false);return v.addEventListener("timeupdate",S),v.addEventListener("durationchange",w),v.addEventListener("loadedmetadata",w),v.addEventListener("play",C),v.addEventListener("pause",T),v.addEventListener("ended",M),()=>{v.removeEventListener("timeupdate",S),v.removeEventListener("durationchange",w),v.removeEventListener("loadedmetadata",w),v.removeEventListener("play",C),v.removeEventListener("pause",T),v.removeEventListener("ended",M);}},[p]);let m=useCallback(()=>{let v=i.current;v&&(v.paused?v.play():v.pause());},[]),x=useCallback(v=>{let S=i.current;S&&(S.currentTime=v,c(v));},[]),g=useCallback((v,S)=>{r({trimStartMs:v,trimEndMs:S});},[r]),[y,b]=useState(t.metadata);return useEffect(()=>{let v=i.current;if(!v)return;if(t.metadata?.duration!==void 0){b(t.metadata);return}let S=()=>{if(!Number.isFinite(v.duration)||v.duration===0)return;let w={duration:v.duration};v instanceof HTMLVideoElement&&(v.videoWidth>0&&(w.videoWidth=v.videoWidth),v.videoHeight>0&&(w.videoHeight=v.videoHeight));let C=v.querySelector("source");C?.type&&(w.codecInfo=C.type),t.metadata=w,b(w);};return v.addEventListener("loadedmetadata",S),v.readyState>=1&&S(),()=>{v.removeEventListener("loadedmetadata",S);}},[p,t]),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:hv,children:[jsx("div",{className:pv,children:o("pptx.media.title")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:o(f?"pptx.media.videoClip":"pptx.media.audioClip")}),p&&jsxs("div",{className:"space-y-1",children:[f?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:e5,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:[Yh(l)," / ",Yh(d)]})]})]}),d>0&&jsx(Khe,{duration:d,trimStartMs:t.trimStartMs??0,trimEndMs:t.trimEndMs??0,currentTime:l,bookmarks:h,canEdit:n,onTrimChange:g,onSeek:x})]}),jsx(jhe,{element:t,canEdit:n,durationSeconds:d,onUpdateElement:r}),(y||t.posterFrameData)&&jsxs("div",{className:hv,children:[jsxs("div",{className:pv,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] ${Ki}`,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"})]}),y?.duration!==void 0&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:o("pptx.media.duration")}),jsx("span",{className:"text-[11px] tabular-nums",children:Yh(y.duration)})]}),y?.videoWidth!==void 0&&y?.videoHeight!==void 0&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:o("pptx.media.resolution")}),jsxs("span",{className:"text-[11px] tabular-nums",children:[y.videoWidth," x ",y.videoHeight]})]}),y?.codecInfo&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:o("pptx.media.format")}),jsx("span",{className:"text-[11px] truncate max-w-[140px]",title:y.codecInfo,children:y.codecInfo})]}),t.mediaPath&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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(Zhe,{element:t,canEdit:n,currentTime:l,bookmarks:h,onUpdateElement:r,onSeekTo:x})]})}bt();function efe({selectedElement:t,canEdit:e,onUpdateElement:n,onUpdateElementStyle:r,onUpdateTextStyle:o}){let{t:i}=useTranslation();return jsxs(Fragment,{children:[Jt(t)&&jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:i("pptx.shape.type","Shape Type")}),jsx("select",{value:t.shapeType||"rect",disabled:!e,className:ie(an,"w-full"),onChange:s=>n({shapeType:s.target.value}),children:Um.filter(s=>s.type!=="connector").map(s=>jsx("option",{value:s.type,children:s.label},s.type))})]}),Jt(t)&&jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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(Lo,{disabled:!e,value:et(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(Lo,{disabled:!e,value:et(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:an,min:0,max:20,value:t.shapeStyle?.strokeWidth??1,onChange:s=>r({strokeWidth:Number(s.target.value)})})]})]})]}),ze(t)&&jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,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(Lo,{disabled:!e,value:et(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(dG,{label:"B",active:!!t.textStyle?.bold,disabled:!e,onClick:()=>o({bold:!t.textStyle?.bold})}),jsx(dG,{label:"I",active:!!t.textStyle?.italic,disabled:!e,italic:true,onClick:()=>o({italic:!t.textStyle?.italic})}),jsx(dG,{label:"U",active:!!t.textStyle?.underline,disabled:!e,underline:true,onClick:()=>o({underline:!t.textStyle?.underline})})]})]})]})]})}function dG({label:t,active:e,disabled:n,italic:r,underline:o,onClick:i}){return jsx("button",{type:"button",disabled:n,className:ie("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})}bt();Pe();var Qat={venn:{min:2,max:3},matrix:{min:4,max:4},pyramid:{min:2,max:5},funnel:{min:2,max:5},target:{min:2,max:5},gear:{min:2,max:3},cycle:{min:3}},tfe={min:1};function uG(t){return t?Qat[t]??tfe:tfe}function pG(t,e){let{max:n}=uG(t);return n===void 0||e<n}function n5(t,e){let{min:n}=uG(t);return e>n}function nfe(t){let{min:e,max:n}=uG(t);if(!(e<=1&&n===void 0))return n===void 0?`Works best with at least ${e} items.`:e===n?`This layout uses exactly ${n} items.`:`Works best with ${e} to ${n} items.`}bt();function rfe(t,e){let n=jD(t,"",e);if(n===t)return;let r=n.nodes.findIndex(i=>i.id===e),o=r>=0?n.nodes[r+1]:void 0;return {data:n,focusNodeId:o?.id}}function ofe(t,e){if(t.nodes.length<=1)return;let n=t.nodes.findIndex(i=>i.id===e),r=cS(t,e);if(r===t)return;let o=r.nodes[Math.max(0,n-1)];return {data:r,focusNodeId:o?.id}}function ife(t,e){let n=qD(t,e);return n===t?void 0:n}function sfe(t,e){let n=KD(t,e);return n===t?void 0:n}function afe(t,e,n){let r=YD(t,e,n);return r===t?void 0:r}function lfe(t,e){let n=t.nodes.find(o=>o.id===e);return n?t.nodes.filter(o=>o.parentId===n.parentId).findIndex(o=>o.id===e):-1}function cfe(t,e){let n=t.nodes.find(r=>r.id===e);return n?t.nodes.filter(r=>r.parentId===n.parentId).length:0}bt();function elt(){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 tlt(){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 nlt(){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 rlt(){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 olt(){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 ilt(){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})]})}function slt(){return jsx("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:jsx("path",{d:"M4 3 L44 3 L28 16 L28 29 L20 29 L20 16 Z",fill:"currentColor",opacity:.7})})}function alt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"24",cy:"16",r:"14",fill:"currentColor",opacity:.3}),jsx("circle",{cx:"24",cy:"16",r:"9",fill:"currentColor",opacity:.5}),jsx("circle",{cx:"24",cy:"16",r:"4",fill:"currentColor",opacity:.8})]})}function llt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"16",cy:"16",r:"9",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"16",cy:"16",r:"3",fill:"white",opacity:.9}),jsx("circle",{cx:"33",cy:"16",r:"6",fill:"currentColor",opacity:.5}),jsx("circle",{cx:"33",cy:"16",r:"2",fill:"white",opacity:.9})]})}function clt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"19",cy:"16",r:"11",fill:"currentColor",opacity:.45}),jsx("circle",{cx:"29",cy:"16",r:"11",fill:"currentColor",opacity:.45})]})}function dlt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("path",{d:"M4 16 L44 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("circle",{cx:"10",cy:"16",r:"3",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"24",cy:"16",r:"3",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"38",cy:"16",r:"3",fill:"currentColor",opacity:.7}),jsx("rect",{x:"6",y:"4",width:"8",height:"6",rx:"1",fill:"currentColor",opacity:.5}),jsx("rect",{x:"34",y:"4",width:"8",height:"6",rx:"1",fill:"currentColor",opacity:.5})]})}function ult(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"14",cy:"16",r:"10",fill:"currentColor",opacity:.5}),jsx("circle",{cx:"34",cy:"16",r:"10",fill:"currentColor",opacity:.5}),jsx("path",{d:"M14 6 L34 26 M34 6 L14 26",stroke:"currentColor",strokeWidth:"1",opacity:.3})]})}function plt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("path",{d:"M2 8 L14 8 L20 16 L14 24 L2 24 L8 16 Z",fill:"currentColor",opacity:.7}),jsx("path",{d:"M17 8 L29 8 L35 16 L29 24 L17 24 L23 16 Z",fill:"currentColor",opacity:.7}),jsx("path",{d:"M32 8 L44 8 L44 24 L32 24 L38 16 Z",fill:"currentColor",opacity:.7})]})}function hlt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"2",y:"3",width:"11",height:"9",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M13 7 L20 7 L20 16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:.5}),jsx("rect",{x:"19",y:"12",width:"11",height:"9",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M30 16 L37 16 L37 25",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:.5}),jsx("rect",{x:"35",y:"21",width:"11",height:"9",rx:"2",fill:"currentColor",opacity:.7})]})}var dfe={process:elt,hierarchy:tlt,cycle:nlt,matrix:rlt,pyramid:olt,list:ilt,funnel:slt,target:alt,gear:llt,venn:clt,timeline:dlt,relationship:ult,chevron:plt,bending:hlt};var mlt=f_.map(t=>({type:t,i18nKey:`pptx.smartart.category.${t}`}));function pfe({smartArtData:t,canEdit:e,onUpdateSmartArt:n}){let{t:r}=useTranslation(),o=t.resolvedLayoutType??"list",i=s=>{if(!e||s===o)return;let a=r3(t,s);n({layoutType:a.layoutType,resolvedLayoutType:a.resolvedLayoutType,layout:a.layout,drawingShapes:a.drawingShapes});};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:mlt.map(({type:s,i18nKey:a})=>{let l=o===s,c=dfe[s];return jsxs("button",{type:"button",disabled:!e,className:ie("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 glt="#3b82f6",xlt="#ffffff",hfe="px-1.5 py-0.5 text-[10px] rounded border transition-colors disabled:opacity-40 disabled:cursor-not-allowed";function ffe({nodeId:t,style:e,label:n,canEdit:r,onChangeStyle:o}){let i=!!e?.bold,s=!!e?.italic;return jsxs("div",{className:"flex items-center gap-1.5 mt-1 pl-4",role:"group","aria-label":`Style for ${n}`,children:[jsxs("label",{className:"flex items-center gap-0.5 text-[9px] text-muted-foreground",children:[jsx("span",{children:"Fill"}),jsx("input",{type:"color",disabled:!r,"aria-label":`Fill colour for ${n}`,className:"h-4 w-5 cursor-pointer rounded border border-border bg-transparent p-0 disabled:cursor-not-allowed",value:e?.fillColor??glt,onChange:a=>o(t,{fillColor:a.target.value})})]}),jsxs("label",{className:"flex items-center gap-0.5 text-[9px] text-muted-foreground",children:[jsx("span",{children:"Text"}),jsx("input",{type:"color",disabled:!r,"aria-label":`Font colour for ${n}`,className:"h-4 w-5 cursor-pointer rounded border border-border bg-transparent p-0 disabled:cursor-not-allowed",value:e?.fontColor??xlt,onChange:a=>o(t,{fontColor:a.target.value})})]}),jsx("button",{type:"button",disabled:!r,"aria-label":`Bold ${n}`,"aria-pressed":i,className:ie(hfe,"font-bold",i?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground"),onClick:()=>o(t,{bold:!i}),children:"B"}),jsx("button",{type:"button",disabled:!r,"aria-label":`Italic ${n}`,"aria-pressed":s,className:ie(hfe,"italic",s?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground"),onClick:()=>o(t,{italic:!s}),children:"I"})]})}var r5="text-[9px] text-muted-foreground hover:text-primary px-1 disabled:opacity-40 disabled:cursor-not-allowed";function mfe({nodeId:t,text:e,displayIndex:n,isChild:r,canEdit:o,removeDisabled:i,moveUpDisabled:s,moveDownDisabled:a,inputRef:l,style:c,onChangeText:d,onKeyDown:u,onAddSubItem:p,onMoveUp:h,onMoveDown:f,onRemove:m,onChangeStyle:x}){let g=r?`Sub-item: ${e||"empty"}`:`Item ${n}: ${e||"empty"}`;return jsxs("div",{role:"listitem",className:ie("rounded border bg-background/60 p-1.5",r?"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","aria-hidden":"true",children:r?"\u2022":`${n}`}),jsx("input",{ref:l,type:"text",disabled:!o,"aria-label":g,className:ie(an,"flex-1 text-[11px] py-0.5"),value:e,onChange:y=>d(t,y.target.value),onKeyDown:y=>u(y,t),placeholder:"Type here"}),jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[jsx("button",{type:"button",disabled:!o||s,className:r5,onClick:()=>h(t),"aria-label":`Move ${g} up`,title:"Move up",children:"\u2191"}),jsx("button",{type:"button",disabled:!o||a,className:r5,onClick:()=>f(t),"aria-label":`Move ${g} down`,title:"Move down",children:"\u2193"}),!r&&jsx("button",{type:"button",disabled:!o,className:r5,onClick:()=>p(t),"aria-label":`Add sub-item under ${g}`,title:"Add sub-item",children:"+Sub"}),jsx("button",{type:"button",disabled:!o||i,className:ie(r5,"hover:text-red-400"),onClick:()=>m(t),"aria-label":`Remove ${g}`,title:i?"Layout minimum reached":"Remove",children:"x"})]})]}),jsx(ffe,{nodeId:t,style:c,label:g,canEdit:o,onChangeStyle:x})]})}var blt=["colorful1","colorful2","colorful3","monochromatic1","monochromatic2"],vlt=["flat","moderate","intense"],Slt=new Set(["parOf","presParOf",void 0]);function gfe({smartArtData:t,canEdit:e,onUpdateElement:n,box:r}){let{t:o}=useTranslation(),i=t.nodes??[],s=t.resolvedLayoutType,a=i.filter(M=>!M.parentId).length,l=Qm.useRef(new Map),c=Qm.useRef(null);Qm.useEffect(()=>{let M=c.current;M&&(l.current.get(M)?.focus(),c.current=null);});let d=(M,_)=>{_&&(c.current=_);let E=r?CT(M,M.layout,UT(M),M.style??"flat","inspector",r):M;n({smartArtData:E});},u=M=>{d({...t,...M});},p=(M,_)=>{d(Lf(t,M,_));},h=(M,_)=>{let E=dS(t,M,_);E!==t&&d(E);},f=()=>{pG(s,a)&&d(d_(t));},m=M=>{d(d_(t,M,"Sub-item"));},x=M=>{!i.find(E=>E.id===M)?.parentId&&!n5(s,a)||d(cS(t,M));},g=(M,_)=>{let E=afe(t,M,_);E&&d(E,M);},y=(M,_)=>{let E=i.find(I=>I.id===_),R=!E?.text;if(M.key==="Enter"){M.preventDefault();let I=rfe(t,_);I&&d(I.data,I.focusNodeId);}else if((M.key==="Backspace"||M.key==="Delete")&&R){if(!E?.parentId&&!n5(s,a))return;M.preventDefault();let L=ofe(t,_);L&&d(L.data,L.focusNodeId);}else if(M.key==="Tab"&&!M.shiftKey){M.preventDefault();let I=ife(t,_);I&&d(I,_);}else if(M.key==="Tab"&&M.shiftKey){M.preventDefault();let I=sfe(t,_);I&&d(I,_);}},b=M=>_=>{_?l.current.set(M,_):l.current.delete(M);},v=nfe(s),S=!e||!pG(s,a),w=(t.connections??[]).filter(M=>!Slt.has(M.type)),C=Array.from(new Set(w.map(M=>M.type??"unknown"))).join(", "),T=0;return jsxs("div",{className:Zt,role:"group","aria-label":o("pptx.smartart.title"),children:[jsx("div",{className:Gt,children:o("pptx.smartart.title")}),jsxs("div",{className:"space-y-2",children:[jsx(pfe,{smartArtData:t,canEdit:e,onUpdateSmartArt:u}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.smartart.colorScheme")}),jsx("select",{disabled:!e,"aria-label":o("pptx.smartart.colorScheme"),className:ie(an,"w-full"),value:t.colorScheme??"colorful1",onChange:M=>u({colorScheme:M.target.value}),children:blt.map(M=>jsx("option",{value:M,children:M},M))})]}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.smartart.style")}),jsx("div",{className:"flex gap-1",role:"group","aria-label":o("pptx.smartart.style"),children:vlt.map(M=>jsx("button",{type:"button",disabled:!e,"aria-pressed":(t.style??"flat")===M,className:ie("flex-1 px-2 py-1 text-[10px] rounded border transition-colors",(t.style??"flat")===M?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground hover:bg-muted"),onClick:()=>u({style:M}),children:M},M))})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsxs("span",{className:"text-[11px] text-muted-foreground",children:[o("pptx.smartart.textPane")," (",i.length,")"]}),jsx("button",{type:"button",disabled:S,className:xr,onClick:f,title:S?v:void 0,children:o("pptx.smartart.addItem")})]}),v&&jsx("div",{className:"text-[9px] text-muted-foreground",role:"note",children:v}),jsx("div",{className:"max-h-52 overflow-y-auto space-y-1 pr-1",role:"list",children:i.map(M=>{let _=!!M.parentId;_||(T+=1);let E=lfe(t,M.id),R=cfe(t,M.id),I=i.length<=1||!_&&!n5(s,a);return jsx(mfe,{nodeId:M.id,text:M.text,displayIndex:T,isChild:_,canEdit:e,removeDisabled:I,moveUpDisabled:E<=0,moveDownDisabled:E<0||E>=R-1,inputRef:b(M.id),style:M.style,onChangeText:p,onKeyDown:y,onAddSubItem:m,onMoveUp:L=>g(L,-1),onMoveDown:L=>g(L,1),onRemove:x,onChangeStyle:h},M.id)})}),w.length>0&&jsxs("div",{className:"text-[9px] text-muted-foreground",role:"note","aria-label":`${w.length} non-tree relationship connection(s): ${C}`,children:[o("pptx.smartart.extraConnections",{count:w.length}),jsx("span",{className:"block opacity-80",children:C})]}),jsx("div",{className:"text-[9px] text-muted-foreground mt-1",children:o("pptx.smartart.tabHint")})]})]})}Pe();Pe();function xfe({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:$c,children:r("pptx.table.fillMode")}),jsx("select",{disabled:!e,className:oT,value:o,onChange:s=>i(s.target.value),children:J4.map(s=>jsx("option",{value:s.value??"",children:r(s.i18nKey)},s.value))})]}),o==="gradient"&&jsx(wlt,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),o==="pattern"&&jsx(Tlt,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),jsxs("div",{className:"space-y-1",children:[jsx("span",{className:Z4,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:$c,children:r(a)}),jsx("input",{type:"number",disabled:!e,className:iT,min:0,max:200,value:t[s]??0,onChange:l=>n({[s]:Number(l.target.value)})})]},s))})]})]})}function wlt({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.gradientFillStops??[],i=t.gradientFillType??"linear",s=(l,c)=>{let d=o.map((u,p)=>p===l?{...u,...c}:u);n({gradientFillStops:d});},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:$c,children:r("pptx.table.gradientType")}),jsx("select",{disabled:!e,className:oT,value:i,onChange:l=>n({gradientFillType:l.target.value}),children:Q4.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:$c,children:r("pptx.table.gradientAngle")}),jsx("input",{type:"number",disabled:!e,className:iT,min:0,max:360,value:t.gradientFillAngle??90,onChange:l=>n({gradientFillAngle:Number(l.target.value)})})]})]}),jsx("span",{className:$c,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:d=>s(c,{color:d.target.value})}),jsx("input",{type:"number",disabled:!e,className:iT,min:0,max:100,value:Math.round(l.position),onChange:d=>s(c,{position:Number(d.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 Tlt({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:$c,children:r("pptx.table.patternPreset")}),jsx("select",{disabled:!e,className:oT,value:t.patternFillPreset??"ltDnDiag",onChange:o=>n({patternFillPreset:o.target.value}),children:eU.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:$c,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:$c,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 yfe({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=d=>{let u=t.rows.map((p,h)=>h!==i?p:{...p,cells:p.cells.map((f,m)=>m!==s?f:{...f,style:{...l,...d}})});r({rows:u});};return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,min:6,max:200,value:l.fontSize??14,onChange:d=>c({fontSize:Number(d.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(Lo,{disabled:!n,value:et(l.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:d=>c({color:d})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.background")}),jsx(Lo,{disabled:!n,value:et(l.backgroundColor,"#ffffff"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:d=>c({backgroundColor:d})})]})]}),jsx(xfe,{cellStyle:l,canEdit:n,onUpdateCellStyle:c}),jsx("div",{className:"flex gap-1",children:[["bold","B","font-bold"],["italic","I","italic"],["underline","U","underline"]].map(([d,u,p])=>jsx("button",{type:"button",disabled:!n,className:ie("px-2 py-1 rounded text-[11px] transition-colors",p,l[d]?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({[d]:!l[d]}),children:u},d))}),jsx("div",{className:"flex gap-1",children:[["left","L"],["center","C"],["right","R"]].map(([d,u])=>jsx("button",{type:"button",disabled:!n,className:ie("px-2 py-1 rounded text-[11px] transition-colors",l.align===d?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({align:d}),children:u},d))}),jsx("div",{className:"flex gap-1",children:[["top","T"],["middle","M"],["bottom","B"]].map(([d,u])=>jsx("button",{type:"button",disabled:!n,className:ie("px-2 py-1 rounded text-[11px] transition-colors",l.vAlign===d?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({vAlign:d}),children:u},d))}),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(([d,u,p])=>jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:o(`pptx.table.border${d}`)}),jsxs("div",{className:"flex gap-1 items-center",children:[jsx(Lo,{disabled:!n,value:et(l[u],"#374151"),className:"w-7 h-6 rounded border border-border bg-transparent cursor-pointer shrink-0",onCommit:h=>c({[u]:h})}),jsx("input",{type:"number",disabled:!n,className:ie(an,"w-14"),min:0,max:10,value:l[p]??1,onChange:h=>c({[p]:Number(h.target.value)})})]})]},d))})]}),jsxs("div",{className:"grid grid-cols-3 gap-1",children:[jsx("button",{type:"button",disabled:!n,className:ie(xr,"text-center"),onClick:()=>{let d=j4(t,i,s);d&&r({rows:d});},children:o("pptx.table.mergeRight")}),jsx("button",{type:"button",disabled:!n,className:ie(xr,"text-center"),onClick:()=>{let d=Y4(t,i,s);d&&r({rows:d});},children:o("pptx.table.mergeDown")}),jsx("button",{type:"button",disabled:!n,className:ie(xr,"text-center"),onClick:()=>{let d=K4(t,i,s);d&&r({rows:d});},children:o("pptx.table.split")})]})]})]})}function bfe({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:Zt,children:[jsx("div",{className:Gt,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,d])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:!!i[c],onChange:u=>l({[c]:u.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:o(d)})]},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:Zt,children:[jsx("div",{className:Gt,children:o("pptx.table.stylePresets")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:q4.map(c=>jsx("button",{type:"button",disabled:!e,title:c.label,"aria-label":c.label,className:"rounded border border-border hover:border-primary overflow-hidden h-10 transition-colors",onClick:()=>{let d=i.rows.map((u,p)=>({...u,cells:u.cells.map(h=>({...h,style:{...h.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:h.style?.color,bold:p===0&&i.firstRowHeader?true:h.style?.bold,borderColor:c.borderColor}}))}));l({rows:d});},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:Zt,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:Gt,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,d)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:d+1}),jsx("input",{type:"range",disabled:!e,min:5,max:80,value:Math.round(c*100),className:"flex-1 accent-primary",onChange:u=>{let p=Number(u.target.value)/100,h=i.columnWidths[d],f=p-h,m=[...i.columnWidths];m[d]=p;let x=1-h;if(x>0)for(let b=0;b<m.length;b++)b!==d&&(m[b]=Math.max(.05,i.columnWidths[b]-f*(i.columnWidths[b]/x)));let g=m.reduce((b,v)=>b+v,0),y=m.map(b=>b/g);l({columnWidths:y});}}),jsxs("span",{className:"w-10 text-right text-muted-foreground",children:[Math.round(c*100),"%"]})]},d))})]}),jsxs("div",{className:Zt,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:Gt,children:o("pptx.table.rowHeights")}),jsx("button",{type:"button",className:xr,disabled:!e,onClick:()=>{let c=Math.round(i.rows.reduce((d,u)=>d+(u.height??32),0)/s);l({rows:i.rows.map(d=>({...d,height:c}))});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.rows.map((c,d)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:d+1}),jsx("input",{type:"number",disabled:!e,className:an,min:16,max:500,value:c.height??32,onChange:u=>{let p=i.rows.map((h,f)=>f===d?{...h,height:Number(u.target.value)}:h);l({rows:p});}}),jsx("span",{className:"w-6 text-muted-foreground",children:"px"})]},d))})]}),r&&jsx(yfe,{tableData:i,tableEditorState:r,canEdit:e,onUpdateTableData:l})]})}function vfe({selectedElement:t,canEdit:e,slides:n,tableEditorState:r,mediaDataUrls:o,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a,onMoveLayer:l}){let{t:c}=useTranslation(),d=!!(t.locks?.noMove||t.locks?.noSelect),u=()=>{e&&i(d?{locks:void 0}:{locks:{noMove:true,noResize:true,noSelect:true}});};return jsxs(Fragment,{children:[jsxs("div",{className:Zt,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:Gt,children:c("pptx.inspector.element")}),jsx("button",{type:"button",onClick:u,disabled:!e,title:c(d?"pptx.inspector.unlock":"pptx.inspector.lock"),className:"p-1 rounded hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":d,children:d?jsx(LuLock,{className:"w-3.5 h-3.5 text-amber-400"}):jsx(LuLockOpen,{className:"w-3.5 h-3.5 text-muted-foreground"})})]}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:Hpe.map(([p,h])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-4 text-muted-foreground",children:p}),jsx("input",{type:"number",className:an,disabled:!e,value:Math.round(t[h]??0),onChange:f=>i({[h]:Number(f.target.value)})})]},h))})]}),t.type==="table"&&jsx(bfe,{tableElement:t,canEdit:e,onUpdateElement:i,tableEditorState:r}),t.type==="chart"&&jsx(Mhe,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="smartArt"&&t.smartArtData&&jsx(gfe,{smartArtData:t.smartArtData,canEdit:e,onUpdateElement:i,box:{width:t.width,height:t.height}}),Vo(t)&&jsx(Hhe,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="media"&&jsx(Qhe,{element:t,mediaDataUrls:o??new Map,canEdit:e,onUpdateElement:i}),jsx(_he,{selectedElement:t,canEdit:e,onUpdateElementStyle:s}),jsx(Phe,{selectedElement:t}),jsx(Ehe,{selectedElement:t}),jsx(efe,{selectedElement:t,canEdit:e,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a}),jsx(Vpe,{selectedElement:t,slides:n,canEdit:e,onUpdateElement:i}),jsx(Ahe,{selectedElement:t,canEdit:e,onUpdateElement:i}),jsx(Rhe,{canEdit:e,onMoveLayer:l})]})}function xG({comment:t,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:d,onDeleteComment:u,onToggleCommentResolved:p,onStartReply:h,onCancelReply:f,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:g,depth:y=0}){let{t:b}=useTranslation(),v=r===t.id,S=i===t.id,w=s[t.id]??"",[C,T]=useState(true),M=t.replies??[],_=t.elementId?n?.elements?.find(E=>E.id===t.elementId)??null:null;return jsxs("div",{className:ie("rounded border border-border bg-card p-2",y>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"}),b("pptx.comments.resolved")]})]}),jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:oU(t.createdAt)})]}),t.elementId&&(_?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:b("pptx.comments.commentingOn",{element:ii(_)}),onClick:()=>g(_.id),children:[jsx(LuType,{className:"h-2.5 w-2.5"}),ii(_)]}):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:b("pptx.comments.deletedElement")})),v?jsxs("div",{className:"mt-1.5 space-y-1.5",children:[jsx("textarea",{value:o,onChange:E=>d(E.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:b("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:b("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:b("pptx.comments.edit"),children:jsx(LuPencil,{className:"h-3 w-3"})}),h&&y===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:()=>h(t.id),title:b("pptx.comments.reply"),children:jsx(LuReply,{className:"h-3 w-3"})}),p&&jsx("button",{type:"button",className:ie("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?b("pptx.comments.unresolve"):b("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:()=>u(t.id),title:b("pptx.comments.delete"),children:jsx(LuTrash2,{className:"h-3 w-3"})})]})]}),M.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:()=>T(E=>!E),children:[C?jsx(LuChevronDown,{className:"h-3 w-3"}):jsx(LuChevronRight,{className:"h-3 w-3"}),b("pptx.comments.repliesCount",{count:M.length})]}),C&&jsx("div",{className:"mt-1.5 space-y-1.5",children:M.map((E,R)=>jsx(xG,{comment:E,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:d,onDeleteComment:u,onToggleCommentResolved:p,onStartReply:h,onCancelReply:f,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:g,depth:y+1},`${E.id}-${R}`))})]}),S&&f&&m&&x&&jsxs("div",{className:"mt-2 space-y-1.5 pl-3 border-l-2 border-l-primary/40",children:[jsx("textarea",{value:w,onChange:E=>m(t.id,E.target.value),rows:2,placeholder:b("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:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.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:w.trim().length===0,children:[jsx(LuReply,{className:"h-3 w-3"}),b("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:f,children:b("pptx.comments.cancel")})]})]})]})}function Tfe({comments:t,canEdit:e,activeSlide:n,selectedElement:r,editingCommentId:o,commentEditDraft:i,commentDraft:s,replyingToCommentId:a,replyDraftByCommentId:l,onSetCommentDraft:c,onAddComment:d,onDeleteComment:u,onStartEditComment:p,onSaveEditComment:h,onCancelEditComment:f,onSetCommentEditDraft:m,onToggleCommentResolved:x,onStartReply:g,onCancelReply:y,onReplyDraftChange:b,onSubmitReply:v,onSelectElement:S}){let{t:w}=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:w("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:w("pptx.comments.noComments")}):jsx("div",{className:"space-y-2 max-h-[42vh] overflow-y-auto pr-1",children:t.map((T,M)=>jsx(xG,{comment:T,canEdit:e,activeSlide:n,editingCommentId:o,commentEditDraft:i,replyingToCommentId:a,replyDraftByCommentId:l,onStartEditComment:p,onSaveEditComment:h,onCancelEditComment:f,onSetCommentEditDraft:m,onDeleteComment:u,onToggleCommentResolved:x,onStartReply:g,onCancelReply:y,onReplyDraftChange:b,onSubmitReply:v,onSelectElement:S},`${T.id}-${M}`))}),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"}),w("pptx.comments.commentingOn",{element:ii(r)})]}),jsx("textarea",{rows:2,placeholder:r?w("pptx.comments.addOnElement",{element:ii(r)}):w("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:T=>c(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),d());}}),jsxs("button",{type:"button",onClick:d,disabled:!s.trim(),className:ie("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"}),w("pptx.comments.addComment")]})]})]})}function yG({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 i5({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:an,disabled:e,value:n,onChange:o=>r(o.target.value)})]})}function zlt({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:an,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:an,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:ie(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 Cfe({notesCanvasSize:t,notesMaster:e,handoutMaster:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:"Notes & Handout"}),jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[jsx(yG,{label:"Notes Size",value:t?`${t.width} \xD7 ${t.height}px`:"Not available"}),jsx(yG,{label:"Notes Master",value:e?`${e.placeholders?.length??0} placeholders`:"Not available"}),jsx(yG,{label:"Handout Master",value:n?`${n.placeholders?.length??0} placeholders`:"Not available"})]})]})}function Mfe({coreProperties:t,appProperties:e,customProperties:n,canEdit:r,onUpdateCoreProperties:o,onUpdateAppProperties:i,onUpdateCustomProperties:s}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:"Document"}),jsxs("div",{className:"space-y-2 text-[11px] text-muted-foreground",children:[jsx(i5,{label:"Title",disabled:!r,value:t?.title??"",onChange:a=>o({title:a})}),jsx(i5,{label:"Author",disabled:!r,value:t?.creator??"",onChange:a=>o({creator:a})}),jsx(i5,{label:"Company",disabled:!r,value:e?.company??"",onChange:a=>i({company:a})}),jsx(i5,{label:"Application",disabled:!r,value:e?.application??"",onChange:a=>i({application:a})}),jsx(zlt,{customProperties:n,canEdit:r,onUpdate:s})]})]})}function s5({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 _fe({presentationProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:ie(an,"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(s5,{label:"Loop Continuously",disabled:!e,checked:!!t.loopContinuously,onChange:r=>n({loopContinuously:r})}),jsx(s5,{label:"Show Narration",disabled:!e,checked:t.showWithNarration!==false,onChange:r=>n({showWithNarration:r})}),jsx(s5,{label:"Show Animation",disabled:!e,checked:t.showWithAnimation!==false,onChange:r=>n({showWithAnimation:r})}),jsx(s5,{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:ie(an,"w-20"),value:t.printSlidesPerPage??1,onChange:r=>n({printSlidesPerPage:Number(r.target.value)})})]})]})]})}function Pfe({themeOptions:t,selectedThemePath:e,setSelectedThemePath:n,canEdit:r,onApplyTheme:o}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,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 Efe({canvasSize:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,disabled:!e,value:t[o],onChange:i=>n({...t,[o]:Number(i.target.value)})})]},o))})]})}bt();var Afe={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 Rfe({activeSlide:t,theme:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=t?.clrMapOverride,s=UD(i),a=useMemo(()=>[...hc],[]),l=useCallback(u=>{if(u){let p={};for(let h of fc)p[h]=mc[h];r({clrMapOverride:p});}else r({clrMapOverride:void 0});},[r]),c=useCallback((u,p)=>{let f={...i??{},[u]:p};for(let m of fc)f[m]||(f[m]=mc[m]);r({clrMapOverride:f});},[i,r]),d=useCallback(u=>e?.colorScheme?e.colorScheme[u]: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:u=>l(u.target.checked)}),o("pptx.themeOverride.enableOverride")]}),s&&i&&jsx("div",{className:"space-y-1.5",children:fc.map(u=>{let p=i[u]??mc[u],h=d(p);return jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-24 truncate text-muted-foreground",title:Afe[u],children:Afe[u]}),jsx("div",{className:"h-4 w-4 rounded-sm border border-border shrink-0",style:{backgroundColor:h?`#${h.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:f=>c(u,f.target.value),children:a.map(f=>jsx("option",{value:f,children:f},f))})]},u)})})]}):null}function kfe({tagCollections:t,onUpdateTagCollections:e,canEdit:n}){let{t:r}=useTranslation(),[o,i]=useState(true),s=t.flatMap((d,u)=>d.tags.map((p,h)=>({...p,colIdx:u,tagIdx:h}))),a=(d,u,p,h)=>{let f=t.map((m,x)=>x!==d?m:{...m,tags:m.tags.map((g,y)=>y===u?{...g,[p]:h}:g)});e(f);},l=(d,u)=>{let p=t.map((h,f)=>f!==d?h:{...h,tags:h.tags.filter((m,x)=>x!==u)});e(p);},c=()=>{if(t.length===0)e([{path:"ppt/tags/tag1.xml",tags:[{name:"",value:""}]}]);else {let d=t.map((u,p)=>p!==0?u:{...u,tags:[...u.tags,{name:"",value:""}]});e(d);}};return jsxs("div",{className:Zt,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:Gt,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((d,u)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1 text-[11px]",children:[jsx("input",{type:"text",className:an,disabled:!n,placeholder:r("pptx.tags.name"),value:d.name,onChange:p=>a(d.colIdx,d.tagIdx,"name",p.target.value)}),jsx("input",{type:"text",className:an,disabled:!n,placeholder:r("pptx.tags.value"),value:d.value,onChange:p=>a(d.colIdx,d.tagIdx,"value",p.target.value)}),n&&jsx("button",{type:"button",className:ie(xr,"px-1.5 text-red-400 hover:text-red-300"),title:r("pptx.tags.deleteTag"),onClick:()=>l(d.colIdx,d.tagIdx),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},`${d.colIdx}-${d.tagIdx}-${u}`)),n&&jsx("button",{type:"button",className:xr,onClick:c,children:r("pptx.tags.addTag")})]})]})}function Ife({presentationProperties:t,canEdit:e,onUpdatePresentationProperties:n,themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,onApplyTheme:s,activeSlide:a,theme:l,onUpdateSlide:c,canvasSize:d,onUpdateCanvasSize:u,notesCanvasSize:p,notesMaster:h,handoutMaster:f,coreProperties:m,onUpdateCoreProperties:x,appProperties:g,onUpdateAppProperties:y,customProperties:b,onUpdateCustomProperties:v,tagCollections:S,onUpdateTagCollections:w}){let{t:C}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsx(_fe,{presentationProperties:t,canEdit:e,onUpdate:n}),jsx(Pfe,{themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,canEdit:e,onApplyTheme:s}),jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:C("pptx.themeOverride.heading")}),jsx(Rfe,{activeSlide:a,theme:l,canEdit:e,onUpdateSlide:c})]}),jsx(Efe,{canvasSize:d,canEdit:e,onUpdate:u}),jsx(Cfe,{notesCanvasSize:p,notesMaster:h,handoutMaster:f}),jsx(Mfe,{coreProperties:m,appProperties:g,customProperties:b,canEdit:e,onUpdateCoreProperties:x,onUpdateAppProperties:y,onUpdateCustomProperties:v}),S&&w&&jsx(kfe,{tagCollections:S,onUpdateTagCollections:w,canEdit:e}),a&&jsxs("div",{className:ie(Zt,"space-y-1"),children:[jsx("div",{className:Gt,children:"Slide"}),jsxs("div",{className:"text-[11px] text-muted-foreground",children:[a.elements?.length??0," elements"]})]})]})}function Nfe({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:ie(Zt,"space-y-2"),children:[jsx("div",{className:Gt,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(Lo,{value:et(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 d=new FileReader;d.onload=()=>{typeof d.result=="string"&&n({backgroundImage:d.result});},d.readAsDataURL(c),l.target.value="";}}),jsx("button",{type:"button",className:ie(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:ie(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(Qlt,{activeSlide:t,slideMasters:o,canEdit:e,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s})]})}function Qlt({activeSlide:t,slideMasters:e,canEdit:n,onSetTemplateBackground:r,onGetTemplateBackgroundColor:o}){return jsxs("div",{className:ie(Zt,"space-y-2"),children:[jsx("div",{className:Gt,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(Lo,{value:et(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(Lo,{value:et(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 wG(t){let{isOpen:e,canEdit:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:d,onClose:u,onUpdateElement:p,onSelectElement:h,onMoveLayer:f,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:g,handoutMaster:y,notesCanvasSize:b,coreProperties:v,appProperties:S,customProperties:w,themeOptions:C,onUpdateCoreProperties:T,onUpdateAppProperties:M,onUpdateCustomProperties:_,tagCollections:E,onUpdateTagCollections:R,onApplyTheme:I,comments:L,commentDraft:k,editingCommentId:F,commentEditDraft:N,onSetCommentDraft:D,onAddComment:U,onDeleteComment:G,onStartEditComment:j,onSaveEditComment:Y,onCancelEditComment:ge,onSetCommentEditDraft:fe,onToggleCommentResolved:de,onStartReply:J,onCancelReply:re,onReplyDraftChange:ce,onSubmitReply:ae,replyingToCommentId:_e,replyDraftByCommentId:xe,onUpdateCanvasSize:Ee,onUpdateElementStyle:W,onUpdateTextStyle:q,onUpdateSlide:Q,editTemplateMode:se,slideMasters:me,onSetTemplateBackground:P,onGetTemplateBackgroundColor:A,mediaDataUrls:O,theme:z,panelWidth:te}=t,$=s!==null,{t:Me}=useTranslation(),{dragY:De,handlers:V}=Lu(u),[B,ee]=useState(""),oe=80,pe=500,Ae=220,[Le,ue]=useState(Ae),we=useCallback(Ie=>{ue(He=>Math.min(pe,Math.max(oe,He-Ie)));},[]);return useEffect(()=>{let Ie=me?.[0]?.themePath;if(Ie&&Ie.length>0){ee(Ie);return}let He=C[0]?.path??"";ee(Oe=>Oe||He);},[me,C]),jsxs(Fragment,{children:[e&&jsx("button",{type:"button","aria-label":Me("common.close"),onClick:u,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:ie("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",!te&&"md:w-72"),style:{...te?{width:te}:{},...De>0?{transform:`translateY(${De}px)`,transition:"none"}:{}},children:[jsx("div",{className:"md:hidden flex items-center justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing touch-none",onPointerDown:V.onPointerDown,onPointerMove:V.onPointerMove,onPointerUp:V.onPointerUp,onPointerCancel:V.onPointerCancel,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:$pe.map(({key:Ie,label:He,icon:Oe})=>jsxs("button",{type:"button",title:He,className:ie("flex items-center gap-1 px-2 py-1 rounded text-[11px] transition-colors",c===Ie?"bg-primary text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"),onClick:()=>d(Ie),children:[jsx(Oe,{className:"w-3.5 h-3.5"}),jsx("span",{className:"hidden sm:inline",children:He})]},Ie))}),jsx("button",{type:"button",onClick:u,title:Me("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:ie(Gt,"mb-2"),children:Me("pptx.inspector.layerOrder")}),r?[...r.elements||[]].reverse().map((Ie,He)=>{let Oe=(r.elements||[]).length-1-He,$e=s?.id===Ie.id||a.includes(Ie.id),ot=(ze(Ie)?(Ie.text||"").slice(0,24):void 0)||Ie.type;return jsxs("div",{title:`${Ie.type} \u2014 ${Ie.id}`,className:ie("flex items-center gap-2 px-2 py-1 rounded cursor-pointer transition-colors",$e?"bg-primary/30 text-primary":"hover:bg-muted text-foreground"),onClick:()=>h(Ie.id),children:[jsx("span",{className:"text-muted-foreground w-4 text-right",children:Oe+1}),jsx("span",{className:"flex-1 truncate",children:ot})]},Ie.id)}):jsx("div",{className:"text-muted-foreground italic",children:Me("pptx.inspector.noSlideSelected")})]}),c==="properties"&&jsx("div",{className:"space-y-3",children:$&&s?jsx(vfe,{selectedElement:s,canEdit:n,slides:o,tableEditorState:l,mediaDataUrls:O,onUpdateElement:p,onUpdateElementStyle:W,onUpdateTextStyle:q,onMoveLayer:f}):jsxs(Fragment,{children:[jsx(Ife,{canEdit:n,canvasSize:i,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:g,handoutMaster:y,notesCanvasSize:b,coreProperties:v,appProperties:S,customProperties:w,themeOptions:C,selectedThemePath:B,setSelectedThemePath:ee,onApplyTheme:I,onUpdateCoreProperties:T,onUpdateAppProperties:M,onUpdateCustomProperties:_,tagCollections:E,onUpdateTagCollections:R,onUpdateCanvasSize:Ee,activeSlide:r,theme:z,onUpdateSlide:Q}),r&&jsx(Nfe,{activeSlide:r,canEdit:n,onUpdateSlide:Q,editTemplateMode:se,slideMasters:me,onSetTemplateBackground:P,onGetTemplateBackgroundColor:A})]})}),c==="comments"&&jsx(Tfe,{comments:L,canEdit:n,activeSlide:r,selectedElement:s,editingCommentId:F,commentEditDraft:N,commentDraft:k,replyingToCommentId:_e??null,replyDraftByCommentId:xe??{},onSetCommentDraft:D,onAddComment:U,onDeleteComment:G,onStartEditComment:j,onSaveEditComment:Y,onCancelEditComment:ge,onSetCommentEditDraft:fe,onToggleCommentResolved:de,onStartReply:J,onCancelReply:re,onReplyDraftChange:ce,onSubmitReply:ae,onSelectElement:h})]}),$&&s&&r&&jsxs(Fragment,{children:[jsx(yu,{direction:"vertical",onResize:we}),jsx("div",{className:"border-t border-border p-3 overflow-y-auto flex-shrink-0",style:{height:Le},children:jsx(Upe,{selectedElement:s,activeSlide:r,canEdit:n,onUpdateSlide:Q})})]})]})]})}function ict(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 sct(t){switch(t){case "laser":return "none";case "pen":return "crosshair";case "highlighter":return "crosshair";case "eraser":return "crosshair";default:return "default"}}function CG({canvasSize:t,editorScale:e,presentationTool:n,annotationStrokes:r,currentStroke:o,laserPosition:i,onPointerDown:s,onPointerMove:a,onPointerUp:l,onLaserMove:c,onLaserLeave:d,onEraseAtPoint:u}){let p=useRef(null),h=useRef(false),f=useCallback((v,S)=>{let w=p.current;if(!w)return null;let C=w.getBoundingClientRect(),T=(v-C.left)/e,M=(S-C.top)/e;return {x:T,y:M}},[e]),m=useCallback(v=>{if(n==="none")return;v.preventDefault(),v.stopPropagation();let S=f(v.clientX,v.clientY);if(S){if(n==="eraser"){h.current=true,u(S.x,S.y);return}(n==="pen"||n==="highlighter")&&s(S.x,S.y);}},[n,f,s,u]),x=useCallback(v=>{if(n==="none")return;let S=f(v.clientX,v.clientY);if(S){if(n==="laser"){c(S.x,S.y);return}if(n==="eraser"&&h.current){u(S.x,S.y);return}(n==="pen"||n==="highlighter")&&a(S.x,S.y);}},[n,f,a,c,u]),g=useCallback(v=>{if(n!=="none"){if(v.preventDefault(),n==="eraser"){h.current=false;return}l();}},[n,l]),y=useCallback(()=>{n==="laser"&&d(),n==="eraser"&&(h.current=false),l();},[n,d,l]);if(n==="none")return null;let b=o?[...r,o]:r;return jsxs("div",{className:"absolute inset-0",style:{zIndex:60,cursor:sct(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:g,onPointerLeave:y,children:b.map(v=>jsx("path",{d:ict(v.points),fill:"none",stroke:v.color,strokeWidth:v.width,strokeLinecap:"round",strokeLinejoin:"round",opacity:v.opacity},v.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}})]})}Pe();var wct=["#ff0000","#0000ff","#00aa00","#ff8800","#ffffff","#000000","#ff00ff","#00cccc"],Tct=["#ffff00","#00ff00","#ff69b4","#00bfff","#ff8c00","#adff2f","#ff6347","#87ceeb"];function PG({presentationTool:t,penColor:e,highlighterColor:n,hasAnnotations:r,onSetTool:o,onSetPenColor:i,onSetHighlighterColor:s,onClearAnnotations:a,currentSlideIndex:l,totalSlides:c,onMovePresentationSlide:d,presentationStartTime:u,onEndPresentation:p,onTogglePresenterView:h,presenterMode:f}){let{t:m}=useTranslation(),[x,g]=useState(false),[y,b]=useState(false),v=useRef(null),[S,w]=useState(Date.now());useEffect(()=>{if(!u)return;let I=window.setInterval(()=>w(Date.now()),1e3);return ()=>window.clearInterval(I)},[u]);let C=u?S-u:0;useEffect(()=>{let I=L=>{v.current&&!v.current.contains(L.target)&&(g(false),b(false));};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let T=useCallback(I=>{o(I),g(false),b(false);},[o]),M=useCallback(I=>{I.preventDefault(),g(L=>!L),b(false);},[]),_=useCallback(I=>{I.preventDefault(),b(L=>!L),g(false);},[]),E=I=>`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${t===I?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,R="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:v,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:I=>I.stopPropagation(),children:[jsx("button",{type:"button",className:R,onClick:()=>d(-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:$U(l,c)}),jsx("button",{type:"button",className:R,onClick:()=>d(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:Xy(C)})]}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsx("button",{type:"button",className:E("laser"),onClick:()=>T("laser"),title:m("pptx.presentation.laserPointer"),children:jsx(LuMousePointer2,{size:18})}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:E("pen"),onClick:()=>T("pen"),onContextMenu:M,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:()=>{g(I=>!I),b(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:wct.map(I=>jsx("button",{type:"button","aria-label":`${m("pptx.presentation.pen")} ${I}`,className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${e===I?"border-white":"border-white/20"}`,style:{backgroundColor:I},onClick:()=>{i(I),g(false),t!=="pen"&&o("pen");}},I))})]}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:E("highlighter"),onClick:()=>T("highlighter"),onContextMenu:_,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:()=>{b(I=>!I),g(false);},title:`${m("pptx.presentation.highlighter")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),y&&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:Tct.map(I=>jsx("button",{type:"button","aria-label":`${m("pptx.presentation.highlighter")} ${I}`,className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${n===I?"border-white":"border-white/20"}`,style:{backgroundColor:I},onClick:()=>{s(I),b(false),t!=="highlighter"&&o("highlighter");}},I))})]}),jsx("button",{type:"button",className:E("eraser"),onClick:()=>T("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"}),h&&jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${f?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,onClick:h,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})})]})}function EG({currentSlideIndex:t,totalSlides:e,onMovePresentationSlide:n,onEndPresentation:r}){let{t:o}=useTranslation(),{isTouchDevice:i}=x2();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 RG({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,d=c.SpeechRecognition??c.webkitSpeechRecognition;if(!d){i("unsupported");return}i("supported");let u=new d;u.continuous=true,u.interimResults=true,u.lang=navigator.language||"en-US",u.onresult=p=>{let h="",f="";for(let x=p.resultIndex;x<p.results.length;x+=1){let g=p.results[x],y=g?.[0]?.transcript??"";g?.isFinal?h+=y:f+=y;}let m=`${h} ${f}`.trim();m.length>0&&r(m);},u.onerror=()=>{},u.onend=()=>{if(a.current)try{u.start();}catch{}},s.current=u;try{u.start();}catch{i("unsupported");}return ()=>{a.current=false,u.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 kG({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}Pe();var ll=.9,zfe=5;function IG({slideIndices:t,slides:e,frameSlides:n,maxPages:r=3}){let{t:o}=useTranslation(),i=useMemo(()=>gR(t),[t]),s=useMemo(()=>xR(),[]),a=i.slice(0,r),l=s.width*ll,c=s.height*ll;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(d=>{let p=!!e[d.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:d.slideArea.x*ll,top:d.slideArea.y*ll,width:d.slideArea.width*ll,height:d.slideArea.height*ll},children:jsx("span",{className:"text-[9px] font-medium text-gray-400",children:d.slideIndex+1})}),jsx("div",{className:"absolute left-1 right-1 border-b border-gray-200",style:{top:d.textArea.y*ll-1}}),jsx("div",{className:"absolute",style:{left:d.textArea.x*ll+4,top:d.textArea.y*ll,width:d.textArea.width*ll-8,height:d.textArea.height*ll},children:Array.from({length:zfe},(f,m)=>{let x=d.textArea.height*ll/(zfe+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)})})]},d.pageIndex)}),i.length>r&&jsx("span",{className:"text-[10px] text-muted-foreground",children:o("pptx.print.preview.morePages",{count:i.length-r})})]})}var yv=.9;function c5({slideIndices:t,slidesPerPage:e,orientation:n,frameSlides:r,maxPages:o=3}){let{t:i}=useTranslation(),s=useMemo(()=>hR(t,e,n),[t,e,n]),a=useMemo(()=>fR(n),[n]),l=s.slice(0,o),c=e===3,d=mR(),u=a.width*yv,p=a.height*yv,h=.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(f=>jsx("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:u,height:p,overflow:"hidden"},children:f.cells.map((m,x)=>{let g=m.slideIndex<0,y=m.x*yv,b=m.y*yv,v=m.width*yv,S=m.height*yv;return jsxs("div",{className:"absolute flex items-start",style:{left:y,top:b,gap:c?2:0},children:[jsx("div",{className:`flex items-center justify-center rounded-sm bg-gray-50 ${g?"opacity-30":""} ${r?"border-2 border-gray-800":"border border-gray-300"}`,style:{width:v,height:S},children:!g&&jsx("span",{className:"text-[9px] font-medium text-gray-400",children:m.slideIndex+1})}),c&&!g&&jsx("div",{className:"relative border-l border-gray-200 pl-1",style:{width:u*h,height:S},children:Array.from({length:d},(C,T)=>{let M=S/(d+1)*(T+1);return jsx("div",{className:"absolute left-1 right-0 border-b border-gray-200",style:{top:M}},T)})})]},x)})},f.pageIndex)),s.length>o&&jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptx.print.preview.morePages",{count:s.length-o})})]})}Pe();var ma=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 Xfe({printWhat:t,onPrintWhatChange:e,orientation:n,onOrientationChange:r,colorMode:o,onColorModeChange:i,frameSlides:s,onFrameSlidesChange:a,slidesPerPage:l,onSlidesPerPageChange:c,slideRange:d,onSlideRangeChange:u,customFrom:p,onCustomFromChange:h,customTo:f,onCustomToChange:m,totalSlides:x,activeSlideIndex:g}){let{t:y}=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:y("pptx.print.printWhat")}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("label",{className:ma(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"}),y("pptx.print.fullPageSlides")]}),jsxs("label",{className:ma(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"}),y("pptx.print.handouts")]}),jsxs("label",{className:ma(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"}),y("pptx.print.notesPages")]}),jsxs("label",{className:ma(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"}),y("pptx.print.outline")]})]})]}),t==="handouts"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:y("pptx.print.slidesPerPage")}),jsx("div",{className:"flex gap-1.5 flex-wrap",children:MT.map(b=>jsx("button",{type:"button",onClick:()=>c(b),className:`px-3 py-1.5 rounded-md text-sm font-medium border transition-colors ${l===b?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`,children:b},b))})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:y("pptx.print.slideRange")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:ma(d==="all"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="all",onChange:()=>u("all")}),y("pptx.print.allSlides")," (",x,")"]}),jsxs("label",{className:ma(d==="current"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="current",onChange:()=>u("current")}),y("pptx.print.currentSlide")," (",g+1,")"]}),jsxs("label",{className:ma(d==="custom"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="custom",onChange:()=>u("custom")}),y("pptx.print.customRange")]}),d==="custom"&&jsxs("div",{className:"flex items-center gap-2 pl-6",children:[jsx("span",{className:"text-xs text-muted-foreground",children:y("pptx.print.from")}),jsx("input",{type:"number",min:1,max:x,value:p,onChange:b=>h(Math.max(1,parseInt(b.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:y("pptx.print.to")}),jsx("input",{type:"number",min:1,max:x,value:f,onChange:b=>m(Math.max(1,parseInt(b.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:y("pptx.print.orientation")}),jsxs("div",{className:"flex gap-2",children:[jsxs("label",{className:ma(n==="landscape"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="landscape",onChange:()=>r("landscape")}),y("pptx.print.landscape")]}),jsxs("label",{className:ma(n==="portrait"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="portrait",onChange:()=>r("portrait")}),y("pptx.print.portrait")]})]})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:y("pptx.print.colorMode")}),jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxs("label",{className:ma(o==="color"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="color",onChange:()=>i("color")}),y("pptx.print.color")]}),jsxs("label",{className:ma(o==="grayscale"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="grayscale",onChange:()=>i("grayscale")}),y("pptx.print.grayscale")]}),jsxs("label",{className:ma(o==="blackAndWhite"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="blackAndWhite",onChange:()=>i("blackAndWhite")}),y("pptx.print.blackAndWhite")]})]})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:s,onChange:b=>a(b.target.checked),className:"rounded border-border"}),jsx("span",{className:"text-sm text-foreground",children:y("pptx.print.frameSlides")})]})]})}function NG({open:t,onClose:e,onPrint:n,slides:r,activeSlideIndex:o,defaultSlidesPerPage:i,defaultFrameSlides:s}){let{t:a}=useTranslation(),{panelStyle:l,handlers:c}=pi(e),[d,u]=useState("slides"),[p,h]=useState("landscape"),[f,m]=useState("color"),[x,g]=useState(s??false),[y,b]=useState(MT.includes(i)?i:6),[v,S]=useState("all"),[w,C]=useState(1),[T,M]=useState(r.length),_=useMemo(()=>d==="notes"||d==="outline"||d==="handouts"?"portrait":p,[d,p]),E=useMemo(()=>{if(v==="all")return r.length;if(v==="current")return 1;let k=Math.max(1,Math.min(w,r.length));return Math.max(k,Math.min(T,r.length))-k+1},[v,r.length,w,T]),R=useMemo(()=>d==="slides"||d==="notes"?E:d==="outline"?1:Math.ceil(E/y),[d,E,y]),I=useMemo(()=>{if(v==="current")return [o];if(v==="custom"){let k=Math.max(0,w-1),F=Math.min(r.length-1,T-1);return Array.from({length:Math.max(0,F-k+1)},(N,D)=>k+D)}return Array.from({length:r.length},(k,F)=>F)},[v,o,w,T,r.length]),L=useCallback(()=>{n({printWhat:d,orientation:_,colorMode:f,frameSlides:x,slidesPerPage:y,slideRange:v,customRangeFrom:Math.max(1,Math.min(w,r.length)),customRangeTo:Math.max(1,Math.min(T,r.length))});},[d,_,f,x,y,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",{style:l,className:"w-[780px] max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl flex flex-col max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...c,className:"flex items-center justify-between px-5 py-4 border-b border-border touch-none",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(Xfe,{printWhat:d,onPrintWhatChange:u,orientation:p,onOrientationChange:h,colorMode:f,onColorModeChange:m,frameSlides:x,onFrameSlidesChange:g,slidesPerPage:y,onSlidesPerPageChange:b,slideRange:v,onSlideRangeChange:S,customFrom:w,onCustomFromChange:C,customTo:T,onCustomToChange:M,totalSlides:r.length,activeSlideIndex:o}),d==="handouts"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(c5,{slideIndices:I,slidesPerPage:y,orientation:_,frameSlides:x})}),d==="notes"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(IG,{slideIndices:I,slides:r,frameSlides:x})})]}),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:E})}),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:L,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 Yfe({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 Kfe({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 LG({open:t,onClose:e,properties:n,onSave:r,customShows:o,slideCount:i}){let{t:s}=useTranslation(),[a,l]=useState({...n}),c=useCallback(h=>{l(f=>({...f,...h}));},[]),d=useCallback(()=>{r(a),e();},[a,r,e]);if(!t)return null;let u=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 flex flex-col w-[440px] max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",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:"flex-1 px-5 py-4 space-y-5 text-[12px] text-foreground 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(([h,f])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showType",value:h,checked:u===h,onChange:()=>c({showType:h,...h==="kiosk"?{loopContinuously:true}:{}}),className:"accent-primary"}),jsx("span",{children:f})]},h))]}),jsx(Kfe,{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(Yfe,{draft:a,update:c})]}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border shrink-0",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:d,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-[12px] text-white transition-colors",children:s("common.ok")})]})]})})]})}Pe();function UG({open:t,onClose:e,onStartBroadcast:n,onStopBroadcast:r,onStartPresenting:o,defaultRoomId:i,defaultUserName:s,defaultServerUrl:a}){let{t:l}=useTranslation(),c=No(),d=c!==null&&c.status!=="disconnected"&&c.status!=="error"&&c.config.role==="owner",[u,p]=useState(""),[h,f]=useState(""),[m,x]=useState(""),[g,y]=useState(false),b=useRef(null),{panelStyle:v,handlers:S}=pi(e);useEffect(()=>{if(t&&!d){let I=i?`broadcast-${i}`:Kne();p(I),f(s??""),x(a??Yne);}},[t,d,i,s,a]),useEffect(()=>{if(!t)return;function I(L){L.key==="Escape"&&e();}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[t,e]),useEffect(()=>{t&&b.current&&b.current.focus();},[t]);let w=d?c.config.roomId:u,C=d?c.config.serverUrl:m,T=typeof window<"u"?qne(w,C,window.location):w,M=useCallback(()=>{navigator.clipboard.writeText(T).then(()=>{y(true),setTimeout(()=>y(false),2e3);});},[T]),_=useCallback(()=>{if(!u.trim()||!h.trim())return;let I=m.trim();n?.({roomId:u.trim(),serverUrl:I,userName:h.trim(),role:"owner",transport:tR(I)}),setTimeout(()=>{o?.();},100),e();},[u,h,m,n,o,e]),E=useCallback(()=>{r?.(),e();},[r,e]),R=u.trim().length>0&&h.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:b,role:"dialog","aria-modal":"true","aria-label":l("pptx.broadcast.title"),tabIndex:-1,style:v,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...S,className:"flex items-center justify-between px-5 py-3 border-b border-border touch-none",children:[jsxs("h2",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[jsx(LuCast,{className:"w-4 h-4"}),l(d?"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:d?jsx(idt,{collab:c,broadcastUrl:T,copied:g,onCopyUrl:M,onStopBroadcast:E}):jsx(odt,{roomId:u,userName:h,serverUrl:m,onRoomIdChange:p,onUserNameChange:f,onServerUrlChange:x})}),!d&&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:!R,onClick:_,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 odt({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:n.trim().length===0?s("pptx.broadcast.p2pHint"):s("pptx.broadcast.hint")})]})}function idt({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")})]})}Pe();function Jfe(t){let e=t.trim().split(/\s+/u);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function eme(t){return t.transport==="webrtc"||!t.serverUrl?.trim()}function tme(t){if(typeof window>"u")return t.roomId;let e=`${window.location.origin}${window.location.pathname}`,n=encodeURIComponent(t.roomId);return eme(t)?`${e}?room=${n}&transport=webrtc`:`${e}?room=${n}&server=${encodeURIComponent(t.serverUrl??"")}`}function VG({open:t,onClose:e,activeCollaboration:n,onStartCollaboration:r,onStopCollaboration:o,preconfigured:i,defaultRoomId:s,defaultUserName:a,defaultServerUrl:l}){let c=No(),d=c!==null&&c.status!=="disconnected"&&c.status!=="error",{t:u}=useTranslation(),[p,h]=useState(s??""),[f,m]=useState(a??""),[x,g]=useState(l??""),[y,b]=useState(false),v=useRef(null),{panelStyle:S,handlers:w}=pi(e);useEffect(()=>{n&&(h(n.roomId),m(n.userName),g(n.serverUrl));},[n]),useEffect(()=>{if(!t)return;function _(E){E.key==="Escape"&&e();}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[t,e]),useEffect(()=>{t&&v.current&&v.current.focus();},[t]);let C=useCallback(()=>{let _=n??{roomId:p,serverUrl:x};navigator.clipboard.writeText(tme(_)).then(()=>{b(true),setTimeout(()=>b(false),2e3);});},[n,p,x]),T=useCallback(()=>{if(!p.trim()||!f.trim())return;let _=x.trim();r?.({roomId:p.trim(),serverUrl:_,userName:f.trim(),transport:tR(_)});},[p,f,x,r]),M=p.trim().length>0&&f.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":u("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:v,role:"dialog","aria-modal":"true","aria-label":u("pptx.share.title"),tabIndex:-1,style:S,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...w,className:"flex items-center justify-between px-5 py-3 border-b border-border touch-none",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:u(d?"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":u("pptx.share.close"),children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:d?jsx(pdt,{collab:c,activeCollaboration:n,copied:y,onCopyRoomId:C,onStopCollaboration:o}):jsx(udt,{roomId:p,userName:f,serverUrl:x,onRoomIdChange:h,onUserNameChange:m,onServerUrlChange:g,preconfigured:i,connectionFailed:c?.status==="error",onRetry:c?.retry})}),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:u(d?"pptx.share.close":"pptx.share.cancel")}),!d&&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:u("pptx.share.startSharing")})]})]})})]}):null}function udt({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i,preconfigured:s,connectionFailed:a,onRetry:l}){let{t:c}=useTranslation(),d=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:c(s?"pptx.share.preconfiguredDescription":"pptx.share.description")}),a&&jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-400",children:[jsx(LuWifiOff,{className:"w-4 h-4 mt-0.5 shrink-0"}),jsxs("div",{className:"flex-1 space-y-1",children:[jsx("p",{className:"font-medium",children:c("pptx.share.connectionError")}),l&&jsx("button",{type:"button",onClick:l,className:"underline underline-offset-2 hover:no-underline",children:c("pptx.collaboration.retry")})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-room-id",className:"block text-[12px] font-medium text-foreground",children:c("pptx.share.sessionName")}),jsx("input",{id:"share-room-id",type:"text","aria-label":c("pptx.share.sessionName"),value:t,onChange:u=>r(u.target.value),readOnly:s,placeholder:c("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${d}`}),jsx("p",{className:"text-[11px] text-muted-foreground",children:c("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:c("pptx.share.displayName")}),jsx("input",{id:"share-user-name",type:"text","aria-label":c("pptx.share.displayName"),value:e,onChange:u=>o(u.target.value),readOnly:s,placeholder:c("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${d}`})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-server-url",className:"block text-[12px] font-medium text-foreground",children:c("pptx.share.serverLabel")}),jsx("input",{id:"share-server-url",type:"text","aria-label":c("pptx.share.serverLabel"),value:n,onChange:u=>i(u.target.value),readOnly:s,placeholder:c("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${d}`})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:n.trim().length===0?c("pptx.share.p2pHint"):c("pptx.share.serverHint")})]})}function pdt({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:tme(t.config)}),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:eme(t.config)?i("pptx.share.p2pServerValue"):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:Jfe(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"}):Jfe(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")})]})}function nme({targetType:t,url:e,setUrl:n,tooltip:r,setTooltip:o,emailAddress:i,setEmailAddress:s,emailSubject:a,setEmailSubject:l,slideNumber:c,setSlideNumber:d,slideCount:u,filePath:p,setFilePath:h,actionVerb:f,setActionVerb:m,inputRef:x,inputCls:g,onEnterConfirm:y}){let{t:b}=useTranslation(),v=S=>{S.key==="Enter"&&y();};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:b("pptx.hyperlink.urlLabel")}),jsx("input",{ref:x,type:"url",className:g,placeholder:"https://example.com",value:e,onChange:S=>n(S.target.value),onKeyDown:v})]}),t==="email"&&jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.emailLabel")}),jsx("input",{ref:x,type:"email",className:g,placeholder:"user@example.com",value:i,onChange:S=>s(S.target.value),onKeyDown:v})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.subjectLabel")}),jsx("input",{type:"text",className:g,value:a,onChange:S=>l(S.target.value)})]})]}),t==="slide"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.slideLabel")}),jsx("input",{ref:x,type:"number",min:1,max:u,className:g,value:c,onChange:S=>d(parseInt(S.target.value,10)||1),onKeyDown:v}),jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:b("pptx.hyperlink.slideRange",{max:u})})]}),t==="file"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.fileLabel")}),jsx("input",{ref:x,type:"text",className:g,placeholder:"../documents/file.docx",value:p,onChange:S=>h(S.target.value),onKeyDown:v})]}),t==="action"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.actionLabel")}),jsxs("select",{className:g,value:f,onChange:S=>m(S.target.value),children:[jsx("option",{value:"nextSlide",children:b("pptx.hyperlink.actionNextSlide")}),jsx("option",{value:"prevSlide",children:b("pptx.hyperlink.actionPrevSlide")}),jsx("option",{value:"firstSlide",children:b("pptx.hyperlink.actionFirstSlide")}),jsx("option",{value:"lastSlide",children:b("pptx.hyperlink.actionLastSlide")}),jsx("option",{value:"endShow",children:b("pptx.hyperlink.actionEndShow")})]})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.tooltipLabel")}),jsx("input",{type:"text",className:g,value:r,onChange:S=>o(S.target.value)})]})]})}function GG({open:t,initialUrl:e,initialTooltip:n,initialAction:r,slideCount:o,onConfirm:i,onCancel:s}){let{t:a}=useTranslation(),{panelStyle:l,handlers:c}=pi(s),d=useRef(null),u=Ude(e,r),p=$de(e||""),h=Hde(e,r),f=r&&cN[r.toLowerCase()]||"nextSlide",[m,x]=useState(u),[g,y]=useState(u==="email"||u==="slide"||u==="action"?"":e||""),[b,v]=useState(n||""),[S,w]=useState(p.address),[C,T]=useState(p.subject),[M,_]=useState(h),[E,R]=useState(u==="file"&&e||""),[I,L]=useState(f);if(useEffect(()=>{t&&setTimeout(()=>d.current?.focus(),50);},[t]),!t)return null;let k=()=>{i({targetType:m,url:g,tooltip:b,emailAddress:S,emailSubject:C,slideNumber:M,filePath:E,actionVerb:I});},F=D=>ie("px-3 py-1.5 text-xs rounded-t border-b-2 transition-colors",D?"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",{style:l,className:"pointer-events-auto w-[440px] rounded-lg border border-border bg-popover shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",onClick:D=>D.stopPropagation(),children:[jsxs("div",{...c,className:"flex items-center justify-between px-4 py-3 border-b border-border touch-none",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:F(m==="url"),onClick:()=>x("url"),children:a("pptx.hyperlink.tabUrl")}),jsx("button",{type:"button",className:F(m==="email"),onClick:()=>x("email"),children:a("pptx.hyperlink.tabEmail")}),jsx("button",{type:"button",className:F(m==="slide"),onClick:()=>x("slide"),children:a("pptx.hyperlink.tabSlide")}),jsx("button",{type:"button",className:F(m==="file"),onClick:()=>x("file"),children:a("pptx.hyperlink.tabFile")}),jsx("button",{type:"button",className:F(m==="action"),onClick:()=>x("action"),children:a("pptx.hyperlink.tabAction")})]}),jsx(nme,{targetType:m,url:g,setUrl:y,tooltip:b,setTooltip:v,emailAddress:S,setEmailAddress:w,emailSubject:C,setEmailSubject:T,slideNumber:M,setSlideNumber:_,slideCount:o,filePath:E,setFilePath:R,actionVerb:I,setActionVerb:L,inputRef:d,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:k}),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:k,children:a("common.apply")})]})]})})]})}function rme({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 ome({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 ime({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 sme({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 lme({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=iU(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 cme({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=>Dc(l.width,l.height).map(d=>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+d.x-5,top:l.y+d.y-5,width:10,height:10,pointerEvents:"auto",zIndex:56},onMouseDown:u=>o(l.id,d.index,u),onMouseUp:()=>r?s(l.id,d.index):void 0},`${l.id}-site-${d.index}`))),r&&jsx(Sdt,{activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r})]})}function Sdt({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r}){let o=t.elements.find(f=>f.id===r.startElementId);if(!o)return null;let i=Dc(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 d=c.getBoundingClientRect(),u=n.editorScale||1,p=(r.currentX-d.left)/u,h=(r.currentY-d.top)/u;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:h,stroke:"#3b82f6",strokeWidth:2,strokeDasharray:"6 4",strokeLinecap:"round"})})}function ume({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 pme({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}Pe();var XG=Qm.memo(({ticks:t,widthPx:e,highlight:n})=>jsxs("svg",{width:e,height:gn,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:e,height:gn,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:0,y1:gn-.5,x2:e,y2:gn-.5,className:"stroke-border",strokeWidth:1}),n&&jsx("rect",{x:n.start,y:0,width:Math.max(n.end-n.start,1),height:gn,className:"fill-primary/20"}),t.map((r,o)=>{let i=r.isMajor?gn*.6:gn*.3;return jsxs("g",{children:[jsx("line",{x1:r.position,y1:gn,x2:r.position,y2:gn-i,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:r.isMajor?1:.5}),r.label&&jsx("text",{x:r.position+2,y:$y+1,fontSize:$y,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:r.label})]},o)})]}));XG.displayName="HorizontalRuler";var jG=Qm.memo(({ticks:t,heightPx:e,highlight:n})=>jsxs("svg",{width:gn,height:e,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:gn,height:e,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:gn-.5,y1:0,x2:gn-.5,y2:e,className:"stroke-border",strokeWidth:1}),n&&jsx("rect",{x:0,y:n.start,width:gn,height:Math.max(n.end-n.start,1),className:"fill-primary/20"}),t.map((r,o)=>{let i=r.isMajor?gn*.6:gn*.3;return jsxs("g",{children:[jsx("line",{x1:gn,y1:r.position,x2:gn-i,y2:r.position,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:r.isMajor?1:.5}),r.label&&jsx("text",{x:2,y:r.position+$y+2,fontSize:$y,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:r.label})]},o)})]}));jG.displayName="VerticalRuler";function mme({canvasSize:t,editorScale:e,unit:n,visible:r,selectedBounds:o,onCreateGuideFromRuler:i}){let s=useMemo(()=>zA(t.width,e,n),[t.width,e,n]),a=useMemo(()=>zA(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]),[d,u]=useState(null),p=useRef(null),h=useRef(null),f=useCallback(b=>{i&&(b.preventDefault(),b.currentTarget.setPointerCapture(b.pointerId),u({axis:"h",pointerId:b.pointerId}));},[i]),m=useCallback(b=>{i&&(b.preventDefault(),b.currentTarget.setPointerCapture(b.pointerId),u({axis:"v",pointerId:b.pointerId}));},[i]),x=useCallback(b=>{if(!d||!i)return;try{b.currentTarget.releasePointerCapture(d.pointerId);}catch{}let v=e||1;if(d.axis==="h"){let S=p.current;if(!S){u(null);return}let w=S.getBoundingClientRect(),C=b.clientY-w.top;if(C>gn){let T=(C-gn)/v;T>=0&&T<=t.height&&i("h",T);}}else {let S=h.current;if(!S){u(null);return}let w=S.getBoundingClientRect(),C=b.clientX-w.left;if(C>gn){let T=(C-gn)/v;T>=0&&T<=t.width&&i("v",T);}}u(null);},[d,i,e,t]);if(!r)return null;let g=t.width*e,y=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:gn,height:gn}}),jsx("div",{ref:p,className:"absolute z-[50] overflow-visible",style:{top:0,left:gn,width:g,height:gn,cursor:i?"row-resize":void 0},onPointerDown:f,onPointerUp:x,children:jsx(XG,{ticks:s,widthPx:g,highlight:l})}),jsx("div",{ref:h,className:"absolute z-[50] overflow-visible",style:{top:gn,left:0,width:gn,height:y,cursor:i?"col-resize":void 0},onPointerDown:m,onPointerUp:x,children:jsx(jG,{ticks:a,heightPx:y,highlight:c})})]})}function bv(t){let e=t.target;for(;e;){if(e.dataset?.pptxElement==="true")return e.dataset.elementId||null;e=e.parentElement;}return null}var Adt=300;function Rdt(t,e){return t===e}function yme({cbRef:t,onCanvasMouseDown:e,findResults:n,findResultIndex:r,activeSlideIndex:o,selectedElement:i,zoom:s,onMoveGuide:a}){let l=useMemo(()=>{let w=new Map;if(!n||n.length===0||o===null)return w;for(let C=0;C<n.length;C++){let T=n[C];if(T.slideIndex!==o)continue;w.has(T.elementId)||w.set(T.elementId,new Map);let M=w.get(T.elementId);M.has(T.segmentIndex)||M.set(T.segmentIndex,[]),M.get(T.segmentIndex).push({startOffset:T.startOffset,length:T.length,isCurrent:C===(r??-1)});}return w},[n,r,o]),c=useMemo(()=>i?{x:i.x,y:i.y,width:i.width,height:i.height}:null,[i]),d=useCallback(w=>{let C=bv(w);C&&t.current.onClick(C,w);},[t]),u=useCallback(w=>{let C=bv(w);C&&t.current.onDoubleClick(C,w);},[t]),p=useRef(false),h=useCallback(w=>{if(p.current){p.current=false;return}let C=bv(w);if(C){t.current.onMouseDown(C,w);return}e?.(w);},[t,e]),f=useCallback(w=>{Rdt(w.target,w.currentTarget)&&e?.(w);},[e]),m=useRef(null),x=useCallback(w=>{if(w.pointerType==="mouse")return;p.current=true,w.currentTarget.setPointerCapture?.(w.pointerId);let C=bv(w);if(C){let T=w.timeStamp||Date.now(),M=m.current;if(M&&M.id===C&&T-M.time<Adt){m.current=null,t.current.onDoubleClick(C,w);return}m.current={id:C,time:T},t.current.onMouseDown(C,w);return}m.current=null,e?.(w);},[t,e]),g=useCallback(w=>{let C=bv(w);C&&t.current.onContextMenu(C,w);},[t]),[y,b]=useState(null),v=useCallback(w=>{if(!y||!a)return;let C=s.canvasStageRef.current;if(!C)return;let T=C.getBoundingClientRect(),M=s.editorScale||1,_=y.axis==="h"?(w.clientY-T.top)/M:(w.clientX-T.left)/M;a(y.id,_);},[y,a,s.canvasStageRef,s.editorScale]),S=useCallback(w=>{if(y){try{w.currentTarget.releasePointerCapture(y.pointerId);}catch{}b(null);}},[y]);return {elementFindHighlightsMap:l,selectedBounds:c,handleStageClick:d,handleStageDblClick:u,handleStageMouseDown:h,handleViewportMouseDown:f,handleStagePointerDown:x,handleStageContextMenu:g,draggingGuide:y,setDraggingGuide:b,handleStagePointerMove:v,handleStagePointerUp:S}}function bme({activeSlide:t,zoom:e,onCreateConnector:n}){let[r,o]=useState(null),i=useCallback((c,d,u)=>{u.stopPropagation(),u.preventDefault(),o({startElementId:c,startSiteIndex:d,currentX:u.clientX,currentY:u.clientY});},[]),s=useCallback(c=>{r&&o(d=>d?{...d,currentX:c.clientX,currentY:c.clientY}:null);},[r]),a=useCallback((c,d)=>{if(!r||!n)return;if(r.startElementId===c){o(null);return}let u=t?.elements.find(_=>_.id===r.startElementId),p=t?.elements.find(_=>_.id===c);if(!u||!p){o(null);return}let h=Dc(u.width,u.height),f=Dc(p.width,p.height),m=h[r.startSiteIndex]??h[0],x=f[d]??f[0],g=u.x+m.x,y=u.y+m.y,b=p.x+x.x,v=p.y+x.y,S=Math.abs(b-g),w=Math.abs(v-y),C=Math.sqrt(S*S+w*w),T=C<100?"straightConnector1":C<300?"bentConnector3":"curvedConnector3",M={id:`conn-new-${Date.now()}`,type:"connector",x:Math.min(g,b),y:Math.min(y,v),width:Math.abs(b-g)||1,height:Math.abs(v-y)||1,shapeType:T,shapeStyle:{strokeColor:"#4472C4",strokeWidth:2,connectorStartConnection:{shapeId:r.startElementId,connectionSiteIndex:r.startSiteIndex},connectorEndConnection:{shapeId:c,connectionSiteIndex:d}}};n(M),o(null);},[r,n,t?.elements]),l=useCallback(()=>{o(null);},[]);return {connectorDragState:r,handleConnectionSiteDown:i,handleConnectorDragMove:s,handleConnectionSiteDrop:a,handleConnectorDragEnd:l}}function vme({activeTool:t,activeSlide:e,zoom:n,drawingColor:r,drawingWidth:o,isDrawingRef:i,onAddInkElement:s,onAddFreeformShape:a,onEraseInkElement:l}){let c=t!=="select",[d,u]=useState([]),[p,h]=useState([]),[f,m]=useState(false),x=useCallback(w=>{let C=n.canvasStageRef.current;if(!C)return null;let T=C.getBoundingClientRect(),M=n.editorScale||1;return {x:(w.clientX-T.left)/M,y:(w.clientY-T.top)/M}},[n.canvasStageRef,n.editorScale]),g=useCallback(w=>{if(w.length===0)return "";let C=[`M ${w[0].x} ${w[0].y}`];for(let T=1;T<w.length;T++)C.push(`L ${w[T].x} ${w[T].y}`);return C.join(" ")},[]),y=useCallback(w=>{if(t==="select")return;if(t==="eraser"&&e){let T=x(w);if(!T)return;let M=15;for(let _ of [...e.elements].reverse())if(_.type==="ink"&&T.x>=_.x-M&&T.x<=_.x+_.width+M&&T.y>=_.y-M&&T.y<=_.y+_.height+M){l?.(_.id);break}return}let C=x(w);C&&(w.preventDefault(),w.target.setPointerCapture(w.pointerId),u([C]),h([w.pressure]),m(true),i&&(i.current=true));},[t,e,x,i,l]),b=useCallback(w=>{if(!f||t==="select"||t==="eraser")return;let C=x(w);C&&(u(T=>[...T,C]),h(T=>[...T,w.pressure]));},[f,t,x]),v=useCallback(w=>{if(!f||t==="select"||t==="eraser")return;if(w.target.releasePointerCapture(w.pointerId),m(false),i&&(i.current=false),d.length<2){u([]);return}let C=1/0,T=1/0,M=-1/0,_=-1/0;for(let k of d)k.x<C&&(C=k.x),k.y<T&&(T=k.y),k.x>M&&(M=k.x),k.y>_&&(_=k.y);let E=o;C-=E,T-=E,M+=E,_+=E;let R=Math.max(M-C,1),I=Math.max(_-T,1),L=d.map(k=>({x:k.x-C,y:k.y-T}));if(t==="freeform"){let F=Math.round(R*100),N=Math.round(I*100),D=[];for(let G=0;G<L.length;G++){let j={x:Math.round(L[G].x*100),y:Math.round(L[G].y*100)};D.push(G===0?{type:"moveTo",pt:j}:{type:"lineTo",pt:j});}D.length>2&&D.push({type:"close"});let U={id:`shape-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"shape",x:C,y:T,width:R,height:I,shapeType:"custom",shapeStyle:{fillColor:"transparent",strokeColor:r,strokeWidth:o},customGeometryPaths:[{width:F,height:N,segments:D}]};a?.(U);}else {let k=g(L),F=t==="highlighter",N=p.length>=2&&p.some(U=>Math.abs(U-p[0])>.01),D={id:`ink-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"ink",x:C,y:T,width:R,height:I,inkPaths:[k],inkColors:[r],inkWidths:[o],inkOpacities:[F?.4:1],inkTool:F?"highlighter":"pen",...N?{inkPointPressures:[p]}:{}};s?.(D);}u([]),h([]);},[f,t,d,r,o,i,s,a,g,p]),S=useMemo(()=>f?g(d):"",[f,d,g]);return {isDrawing:c,isStrokeActive:f,liveStrokeD:S,currentStrokePoints:d,handleDrawPointerDown:y,handleDrawPointerMove:b,handleDrawPointerUp:v}}function Sme(t){let e=useRef(t);e.current=t;let n=useCallback((f,m,x)=>e.current.onResizePointerDown(f,m,x),[]),r=useCallback((f,m)=>e.current.onAdjustmentPointerDown(f,m),[]),o=useCallback((f,m)=>e.current.onRotate?.(f,m),[]),i=useCallback(f=>e.current.onInlineEditChange(f),[]),s=useCallback(()=>e.current.onInlineEditCommit(),[]),a=useCallback(()=>e.current.onInlineEditCancel(),[]),l=useCallback((f,m)=>e.current.onTableCellSelect(f,m),[]),c=useCallback((f,m,x,g)=>e.current.onCommitCellEdit?.(f,m,x,g),[]),d=useCallback((f,m)=>e.current.onUpdateSmartArtElement?.(f,m),[]),u=useCallback(f=>e.current.onFormatText?.(f),[]),p=useCallback((f,m)=>e.current.onResizeTableColumns?.(f,m),[]),h=useCallback((f,m,x)=>e.current.onResizeTableRow?.(f,m,x),[]);return {cbRef:e,stableResizePointerDown:n,stableAdjustmentPointerDown:r,stableRotate:o,stableInlineEditChange:i,stableInlineEditCommit:s,stableInlineEditCancel:a,stableTableCellSelect:l,stableCommitCellEdit:c,stableUpdateSmartArtElement:d,stableFormatText:u,stableResizeTableColumns:p,stableResizeTableRow:h}}function qG({activeSlide:t,templateElements:e,canvasSize:n,zoom:r,mode:o,canEdit:i,editTemplateMode:s,selectedElementIdSet:a,selectedElement:l,inlineEditingElementId:c,inlineEditingText:d,spellCheckEnabled:u,mediaDataUrls:p,tableEditorState:h,marqueeSelectionState:f,snapLines:m,showGrid:x,gridSpacingPx:g,showRulers:y,rulerUnit:b="inches",guides:v,presentationElementStates:S,presentationKeyframesCss:w,onClick:C,onDoubleClick:T,onMouseDown:M,onContextMenu:_,onCanvasMouseDown:E,onResizePointerDown:R,onAdjustmentPointerDown:I,onRotate:L,onInlineEditChange:k,onInlineEditCommit:F,onInlineEditCancel:N,onTableCellSelect:D,onCommitCellEdit:U,onUpdateSmartArtElement:G,onFormatText:j,onResizeTableColumns:Y,onResizeTableRow:ge,findResults:fe,findResultIndex:de,activeSlideIndex:J,activeTool:re="select",drawingColor:ce="#000000",drawingWidth:ae=3,isDrawingRef:_e,onAddInkElement:xe,onAddFreeformShape:Ee,onEraseInkElement:W,onActionClick:q,onHyperlinkClick:Q,comments:se,showCommentMarkers:me=false,onCommentMarkerClick:P,onMoveGuide:A,onDeleteGuide:O,onCreateGuideFromRuler:z,connectorCreationMode:te=false,onCreateConnector:$,allSlides:Me,onZoomClick:De,sourceSlideIndex:V,fieldContext:B,tableStyleContext:ee,collaborationOverlay:oe}){let pe=(o==="edit"||o==="master")&&i,{cbRef:Ae,stableResizePointerDown:Le,stableAdjustmentPointerDown:ue,stableRotate:we,stableInlineEditChange:Ie,stableInlineEditCommit:He,stableInlineEditCancel:Oe,stableTableCellSelect:$e,stableCommitCellEdit:ot,stableUpdateSmartArtElement:at,stableFormatText:gt,stableResizeTableColumns:le,stableResizeTableRow:Ue}=Sme({onClick:C,onDoubleClick:T,onMouseDown:M,onContextMenu:_,onResizePointerDown:R,onAdjustmentPointerDown:I,onRotate:L,onInlineEditChange:k,onInlineEditCommit:F,onInlineEditCancel:N,onTableCellSelect:D,onCommitCellEdit:U,onUpdateSmartArtElement:G,onFormatText:j,onResizeTableColumns:Y,onResizeTableRow:ge}),{elementFindHighlightsMap:Te,selectedBounds:Ve,handleStageClick:Fe,handleStageDblClick:ke,handleStageMouseDown:nt,handleViewportMouseDown:st,handleStagePointerDown:Xn,handleStageContextMenu:Cn,setDraggingGuide:Zi,handleStagePointerMove:bs,handleStagePointerUp:m0}=yme({cbRef:Ae,onCanvasMouseDown:E,findResults:fe,findResultIndex:de,activeSlideIndex:J,selectedElement:l,zoom:r,onMoveGuide:A}),{connectorDragState:Pv,handleConnectionSiteDown:g0,handleConnectorDragMove:sf,handleConnectionSiteDrop:Ev,handleConnectorDragEnd:x0}=bme({activeSlide:t,zoom:r,onCreateConnector:$}),{isDrawing:y0,isStrokeActive:pl,liveStrokeD:af,handleDrawPointerDown:vs,handleDrawPointerMove:rp,handleDrawPointerUp:b0}=vme({activeTool:re,activeSlide:t,zoom:r,drawingColor:ce,drawingWidth:ae,isDrawingRef:_e,onAddInkElement:xe,onAddFreeformShape:Ee,onEraseInkElement:W}),lf=y?gn:0;return jsx("div",{ref:r.canvasViewportRef,"data-pptx-viewport":true,className:"flex-1 overflow-auto relative",style:{touchAction:"pan-x pan-y"},onMouseDown:st,children:jsxs("div",{ref:r.editWrapperRef,className:"relative mx-auto my-4",style:{width:n.width*r.editorScale+lf,height:n.height*r.editorScale+lf},children:[jsx(mme,{canvasSize:n,editorScale:r.editorScale,unit:b,visible:y,selectedBounds:Ve,onCreateGuideFromRuler:z}),jsxs("div",{ref:r.canvasStageRef,role:"region","aria-label":`Slide ${(J??0)+1}`,"aria-roledescription":"slide",className:"relative shadow-2xl",style:{width:n.width,height:n.height,transform:`scale(${r.editorScale})`,transformOrigin:"top left",marginTop:lf,marginLeft:lf,touchAction:pe?"none":void 0,backgroundColor:t?.backgroundColor&&t.backgroundColor!=="transparent"?t.backgroundColor:"#ffffff"},onClick:Fe,onDoubleClick:ke,onMouseDown:nt,onPointerDown:pe?Xn:void 0,onContextMenu:Cn,onPointerMove:bs,onPointerUp:m0,children:[w&&jsx("style",{children:w}),jsx(pme,{canvasSize:n,gridSpacingPx:g,visible:x}),jsx(rme,{guides:v,onDeleteGuide:O,onStartGuideDrag:Zi}),jsx(ome,{backgroundImage:t?.backgroundImage,backgroundGradient:t?.backgroundGradient}),e.map((Tr,v0)=>jsx(fk,{element:Tr,activeSlide:t,isSelected:a.has(Tr.id),isInlineEditing:c===Tr.id,inlineEditingText:d,canInteract:(o==="edit"||o==="master")&&i&&s,spellCheckEnabled:u,mediaDataUrls:p,selectionColorClass:"blue-400",showHoverBorder:false,opacity:.95,templateEditing:s,zIndex:v0,imageAltText:"Template element",showResizeHandles:pe&&a.has(Tr.id)&&a.size<=1&&!c,renderInk:false,renderGroups:false,adjustmentHandleDescriptor:pe&&l?.id===Tr.id?xT(Tr):null,onResizePointerDown:Le,onAdjustmentPointerDown:ue,onRotate:we,onInlineEditChange:Ie,onInlineEditCommit:He,onInlineEditCancel:Oe,onUpdateSmartArtElement:at,onFormatText:gt,onActionClick:q,onHyperlinkClick:Q,animationState:S?.get(Tr.id),presentationElementStates:S,allSlides:Me,onZoomClick:De,sourceSlideIndex:V,fieldContext:B,tableStyleContext:ee},`tpl-${Tr.id}`)),t?.elements.map((Tr,v0)=>jsx(fk,{element:Tr,activeSlide:t,isSelected:a.has(Tr.id),isInlineEditing:c===Tr.id,inlineEditingText:d,canInteract:pe,spellCheckEnabled:u,mediaDataUrls:p,tableEditorState:h,selectionColorClass:"blue-500",showHoverBorder:true,zIndex:e.length+v0,imageAltText:"Slide element",showResizeHandles:pe&&a.has(Tr.id)&&a.size<=1&&!c,renderInk:true,renderGroups:true,adjustmentHandleDescriptor:pe&&l?.id===Tr.id?xT(Tr):null,onResizePointerDown:Le,onAdjustmentPointerDown:ue,onRotate:we,onInlineEditChange:Ie,onInlineEditCommit:He,onInlineEditCancel:Oe,onUpdateSmartArtElement:at,onFormatText:gt,onTableCellSelect:$e,onCommitCellEdit:ot,onResizeTableColumns:le,onResizeTableRow:Ue,findHighlights:Te.get(Tr.id),onActionClick:q,onHyperlinkClick:Q,animationState:S?.get(Tr.id),presentationElementStates:S,allSlides:Me,onZoomClick:De,sourceSlideIndex:V,fieldContext:B,tableStyleContext:ee},Tr.id)),jsx(ime,{marqueeSelectionState:f}),me&&se&&se.length>0&&jsx(lme,{comments:se,canvasSize:n,onCommentMarkerClick:P}),jsx(sme,{snapLines:m}),te&&t&&jsx(cme,{activeSlide:t,canvasSize:n,zoom:r,connectorDragState:Pv,onConnectionSiteDown:g0,onConnectorDragMove:sf,onConnectionSiteDrop:Ev,onConnectorDragEnd:x0}),y0&&jsx(ume,{canvasSize:n,activeTool:re,drawingColor:ce,drawingWidth:ae,isStrokeActive:pl,liveStrokeD:af,onPointerDown:vs,onPointerMove:rp,onPointerUp:b0}),oe]})]})})}function JG({isShortcutHelpOpen:t,isAccessibilityPanelOpen:e,showSlideSorter:n,accessibilityIssues:r,slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onCloseShortcuts:c,onCloseAccessibility:d,onSelectSlide:u,onMoveSlide:p,onDeleteSlides:h,onDuplicateSlides:f,onToggleHideSlides:m,onCloseSorter:x,reducedMotion:g,onToggleReducedMotion:y}){return t||e||n?jsxs(Fragment,{children:[t&&jsx(w6,{isOpen:t,onClose:c}),e&&jsx(T6,{isOpen:e,issues:r,onClose:d,reducedMotion:g,onToggleReducedMotion:y}),n&&jsx(KH,{slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onSelectSlide:u,onMoveSlide:p,onDeleteSlides:h,onDuplicateSlides:f,onToggleHideSlides:m,onClose:x})]}):null}function eW({activeSlide:t,allSlides:e,isSlideNotesCollapsed:n,canEdit:r,slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,onToggleNotes:l,onUpdateNotes:c,collaborationSlot:d,notesPanelHeight:u,onResizeBottom:p,scale:h,onZoomIn:f,onZoomOut:m,onZoomToFit:x,mode:g,onSetMode:y,onToggleSlideSorter:b,hideStatusBar:v=false}){return jsxs(Fragment,{children:[p&&!n&&jsx(yu,{direction:"vertical",onResize:p}),jsx(ez,{activeSlide:t,allSlides:e,isExpanded:!n,canEdit:r,onToggle:l,onUpdateNotes:c,panelHeight:u}),!v&&jsx(_6,{slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,scale:h,onZoomIn:f,onZoomOut:m,onZoomToFit:x,isNotesExpanded:!n,onToggleNotes:l,mode:g,onSetMode:y,onToggleSlideSorter:b,collaborationSlot:d})]})}function tW({isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,effectiveSelectedIds:a,tableEditorState:l,sidebarPanelMode:c,activeSlideIndex:d,comments:u,onSetSidebarPanelMode:p,onClose:h,onUpdateElementStyle:f,onUpdateTextStyle:m,onUpdateElement:x,onApplySelection:g,onSetCanvasSize:y,onMoveLayer:b,onMoveLayerToEdge:v,onDeleteElement:S,onUpdateSlide:w,presentationProperties:C,onUpdatePresentationProperties:T,notesMaster:M,handoutMaster:_,notesCanvasSize:E,coreProperties:R,appProperties:I,customProperties:L,themeOptions:k,onUpdateCoreProperties:F,onUpdateAppProperties:N,onUpdateCustomProperties:D,tagCollections:U,onUpdateTagCollections:G,onApplyTheme:j,editTemplateMode:Y,slideMasters:ge,onSetTemplateBackground:fe,onGetTemplateBackgroundColor:de,mediaDataUrls:J,theme:re,panelWidth:ce}){if(!t)return null;let ae=c;if(!s&&ae!=="comments"&&ae!=="properties")return null;let _e=r?.id??"",xe=u.commentDraftBySlideId[_e]??"",Ee=u.editingCommentIdBySlideId[_e]??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:ce?{width:ce}:void 0,children:jsx(wG,{isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:W=>p(W),onClose:h,onUpdateElementStyle:f,onUpdateTextStyle:m,onUpdateElement:x,onUpdateSlide:w,onSelectElement:W=>g(W),onMoveLayer:b,onMoveLayerToEdge:v,onDeleteElement:S,comments:r?.comments??[],presentationProperties:C,onUpdatePresentationProperties:T,notesMaster:M,handoutMaster:_,notesCanvasSize:E,coreProperties:R,appProperties:I,customProperties:L,themeOptions:k,onUpdateCoreProperties:F,onUpdateAppProperties:N,onUpdateCustomProperties:D,tagCollections:U,onUpdateTagCollections:G,onApplyTheme:j,commentDraft:xe,editingCommentId:Ee,commentEditDraft:Ee?u.commentEditDraftByCommentId[Ee]??"":"",onSetCommentDraft:W=>u.handleCommentDraftChange(_e,W),onAddComment:()=>u.handleAddSlideComment(d),onDeleteComment:W=>u.handleDeleteSlideComment(d,W),onStartEditComment:W=>u.handleStartCommentEdit(_e,W),onSaveEditComment:W=>u.handleSaveCommentEdit(d,W),onCancelEditComment:()=>u.handleCancelCommentEdit(_e),onSetCommentEditDraft:W=>u.handleSetCommentEditDraft(u.editingCommentIdBySlideId[_e]??"",W),onToggleCommentResolved:W=>u.handleToggleCommentResolved(d,W),onStartReply:W=>u.handleStartReply(d,W),onCancelReply:u.handleCancelReply,onReplyDraftChange:(W,q)=>u.handleReplyDraftChange(W,q),onSubmitReply:W=>u.handleSubmitReply(d,W),replyingToCommentId:u.replyingToCommentId,replyDraftByCommentId:u.replyDraftByCommentId,onUpdateCanvasSize:y,editTemplateMode:Y,slideMasters:ge,onSetTemplateBackground:fe,onGetTemplateBackgroundColor:de,mediaDataUrls:J,theme:re,panelWidth:ce})})}function Cme(t,e){if(!e?.layoutPath||!t.some(d=>d.masterPath))return t;let o=t.find(d=>d.path===e.layoutPath)?.masterPath;if(!o)return t;let i=t.filter(d=>d.masterPath===o),s=new Map;for(let d of i){let u=d.path===e.layoutPath;(!s.get(d.name)||u)&&s.set(d.name,d);}let a=new Set(Array.from(s.values()).map(d=>d.path)),l=[],c=new Set;for(let d of i)a.has(d.path)&&(c.has(d.name)||(c.add(d.name),l.push(d)));return l}Pe();function _me(t){let{t:e}=useTranslation(),n=(t.mode==="edit"||t.mode==="master")&&t.canEdit,r=ure({autosaveState:t.autosaveStatus?.state??"idle",isDirty:t.isDirty,autosaveEnabled:t.autosaveEnabled});return jsxs("div",{className:Fn.container,"data-pptx-title-bar":"",children:[jsx("span",{className:Fn.logo,"aria-hidden":"true",children:"P"}),n&&jsxs(Fragment,{children:[jsxs("span",{className:Fn.autosaveGroup,children:[jsx("span",{className:Fn.autosaveLabel,children:e("pptx.titleBar.autoSave")}),jsx("button",{type:"button",role:"switch","aria-checked":t.autosaveEnabled,onClick:t.onToggleAutosave,className:ie(Fn.toggleTrack,t.autosaveEnabled?Fn.toggleTrackOn:Fn.toggleTrackOff),title:e("pptx.titleBar.toggleAutoSave"),"aria-label":e("pptx.titleBar.toggleAutoSave"),children:jsx("span",{className:ie(Fn.toggleKnob,t.autosaveEnabled?Fn.toggleKnobOn:Fn.toggleKnobOff)})}),jsx("span",{className:Fn.autosaveLabel,children:e(t.autosaveEnabled?"pptx.titleBar.autoSaveOn":"pptx.titleBar.autoSaveOff")})]}),jsx("div",{className:Fn.separator}),t.onSave&&jsx("button",{type:"button",onClick:t.onSave,className:Fn.quickButton,title:e("pptx.titleBar.save"),"aria-label":e("pptx.titleBar.save"),children:jsx(LuSave,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:t.onUndo,disabled:!t.canUndo,className:Fn.quickButton,title:t.undoLabel?e("pptx.toolbar.undoAction",{action:t.undoLabel}):e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:t.onRedo,disabled:!t.canRedo,className:Fn.quickButton,title:t.redoLabel?e("pptx.toolbar.redoAction",{action:t.redoLabel}):e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:"w-3.5 h-3.5"})}),jsx("div",{className:Fn.separator})]}),jsxs("span",{className:Fn.fileGroup,children:[jsx("span",{className:Fn.fileName,children:t.fileName||e(pre)}),n&&jsxs(Fragment,{children:[jsx("span",{className:Fn.statusDot,"aria-hidden":"true",children:"\u2022"}),jsx("span",{className:ie(Fn.statusText,t.autosaveStatus?.state==="error"&&t.autosaveEnabled&&Fn.statusError,t.autosaveStatus?.state==="saving"&&t.autosaveEnabled&&Fn.statusSaving),children:e(r)})]})]}),jsx("span",{className:Fn.searchWrap,children:(t.mode==="edit"||t.mode==="master")&&jsxs("button",{type:"button",onClick:t.onToggleFindReplace,className:ie(Fn.searchBox,t.findReplaceOpen&&"text-foreground bg-background"),title:e("pptx.findReplace.title"),"aria-label":e("pptx.titleBar.search"),children:[jsx(LuSearch,{className:Fn.searchIcon}),jsx("span",{className:Fn.searchLabel,children:e("pptx.titleBar.search")})]})}),jsx("span",{className:Fn.rightSpacer})]})}function nW(t){let{mode:e,canEdit:n,state:r,selectedElement:o,activeSlide:i,zoom:s,history:a,findReplace:l,manipulation:c,insertHandlers:d,exportHandlers:u,printHandlers:p,propertyHandlers:h,dialogs:f,slideOps:m,ops:x,onSetMode:g,onEnterPresenterView:y,onEnterRehearsalMode:b,onOpenSettings:v,onOpenShareDialog:S,onOpenFile:w,onToggleFormatPainter:C,fileName:T,autosaveStatus:M,autosaveEnabled:_=true,onToggleAutosave:E}=t,R=useCallback((N,D)=>{if(!o||!i)return;let U=i.animations??[],G=U.find(Y=>Y.elementId===o.id),j=N;if(G){let Y=U.map(ge=>ge.elementId===o.id?{...ge,[D]:j}:ge);h.handleUpdateSlide({animations:Y});}else {let Y={elementId:o.id,[D]:j,durationMs:500,order:U.length,trigger:"onClick"};h.handleUpdateSlide({animations:[...U,Y]});}},[o,i,h]),I=useCallback(()=>{if(!o||!i)return;let D=(i.animations??[]).filter(U=>U.elementId!==o.id);h.handleUpdateSlide({animations:D});},[o,i,h]),L=useCallback(N=>{if(!i)return;let D=i.transition??{type:"none"};h.handleUpdateSlide({transition:{...D,...N}});},[i,h]),k=Qm.useMemo(()=>Cme(r.layoutOptions,i),[r.layoutOptions,i]),F=useCallback(()=>{let N=i?.transition;N&&(x.updateSlides(D=>D.map(U=>({...U,transition:N}))),a.markDirty());},[i,x,a]);return jsxs(Fragment,{children:[!f.isNarrowViewport&&jsx(_me,{mode:e,canEdit:n,fileName:T,isDirty:r.isDirty,autosaveStatus:M,autosaveEnabled:_,onToggleAutosave:E??(()=>{}),canUndo:a.canUndo,canRedo:a.canRedo,undoLabel:a.undoLabel,redoLabel:a.redoLabel,onUndo:a.handleUndo,onRedo:a.handleRedo,onSave:u.handleSaveAsPptx,findReplaceOpen:l.findReplaceOpen,onToggleFindReplace:()=>l.setFindReplaceOpen(!l.findReplaceOpen)}),jsx(nG,{mode:e,canEdit:n,isNarrowViewport:f.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:g,onToggleSidebar:()=>r.setIsSlidesPaneOpen(N=>!N),onToggleInspector:()=>r.setIsInspectorPaneOpen(N=>!N),onOpenAnimationPanel:()=>{r.setIsInspectorPaneOpen(true),r.setSidebarPanelMode("properties");},onAddAnimation:R,onRemoveAnimation:I,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:d.handleAddTextBox,onAddShape:d.handleAddShape,onAddTable:d.handleAddTable,onAddChart:d.handleAddChart,onAddSmartArt:()=>f.setIsSmartArtDialogOpen(true),onAddEquation:()=>{f.setEditingEquationOmml(null),f.setIsEquationDialogOpen(true);},onAddActionButton:d.handleAddActionButton,onInsertField:d.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:f.handleAddGuide,onAlignElements:c.handleAlignElements,onDistributeElements:c.handleDistributeElements,canDistribute:c.canDistribute,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:u.handleExportPng,onExportPdf:u.handleExportPdf,onExportVideo:u.handleExportVideo,onExportGif:u.handleExportGif,onPackageForSharing:u.handlePackageForSharing,onOpenFile:w,onOpenShareDialog:S,onSaveAsPptx:u.handleSaveAsPptx,onSaveAsPpsx:u.handleSaveAsPpsx,onSaveAsPptm:u.handleSaveAsPptm,hasMacros:r.hasMacros,onCopySlideAsImage:u.handleCopySlideAsImage,onPrint:p.handlePrint,onToggleShortcuts:()=>r.setIsShortcutHelpOpen(N=>!N),onOpenSettings:v,onRunAccessibilityCheck:f.handleRunAccessibilityCheck,onToggleSlideSorter:()=>r.setShowSlideSorter(N=>!N),onUpdateTextStyle:x.updateSelectedTextStyle,isOverflowMenuOpen:r.isOverflowMenuOpen,onSetOverflowMenuOpen:r.setIsOverflowMenuOpen,layoutOptions:k,onInsertSlideFromLayout:m.handleInsertSlideFromLayout,customShows:r.customShows,activeCustomShowId:r.activeCustomShowId,onSetActiveCustomShowId:r.setActiveCustomShowId,onCreateCustomShow:f.handleCreateCustomShow,onRenameActiveCustomShow:f.handleRenameActiveCustomShow,onDeleteActiveCustomShow:f.handleDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:f.handleToggleCurrentSlideInActiveShow,isCurrentSlideInActiveShow:f.isCurrentSlideInActiveShow,onEnterMasterView:f.handleEnterMasterView,onCloseMasterView:f.handleCloseMasterView,onToggleVersionHistory:()=>h.setIsVersionHistoryOpen(N=>!N),onOpenPasswordProtection:()=>f.setIsPasswordDialogOpen(true),onOpenDocumentProperties:()=>f.setIsDocPropsDialogOpen(true),onOpenFontEmbedding:()=>f.setIsFontEmbeddingOpen(true),onOpenDigitalSignatures:()=>f.setIsDigitalSigDialogOpen(true),onEnterPresenterView:y,onEnterRehearsalMode:b,onToggleThemeEditor:()=>r.setIsThemeEditorOpen(N=>!N),isThemeEditorOpen:r.isThemeEditorOpen,onToggleThemeGallery:()=>r.setIsThemeGalleryOpen(N=>!N),isThemeGalleryOpen:r.isThemeGalleryOpen,onCompare:h.handleCompare,onToggleComments:()=>{r.setSidebarPanelMode("comments"),r.isInspectorPaneOpen||r.setIsInspectorPaneOpen(true);},isCommentsPanelOpen:r.isInspectorPaneOpen,slideCommentCount:i?.comments?.length??0,formatPainterActive:r.formatPainterActive,canActivateFormatPainter:MU(o),onToggleFormatPainter:C??(()=>r.setFormatPainterActive(N=>!N)),isSelectionPaneOpen:r.isSelectionPaneOpen,onToggleSelectionPane:()=>r.setIsSelectionPaneOpen(N=>!N),eyedropperActive:r.eyedropperActive,onToggleEyedropper:()=>r.setEyedropperActive(N=>!N),onOpenSetUpSlideShow:()=>f.setIsSetUpSlideShowOpen(true),onOpenBroadcastDialog:()=>f.setIsBroadcastDialogOpen(true),onToggleSubtitles:f.handleToggleSubtitles,showSubtitles:!!r.presentationProperties.showSubtitles,activeSlide:i,onTransitionChange:L,onApplyTransitionToAll:F}),r.hasDigitalSignatures&&jsx("div",{className:"flex items-center px-3 py-1 z-10",children:jsx(FV,{hasSignatures:r.hasDigitalSignatures,signatureCount:r.digitalSignatureCount,onClick:()=>f.setIsDigitalSigDialogOpen(true)})}),jsx("input",{ref:r.imageInputRef,type:"file",name:"image-upload",accept:"image/*",className:"hidden",onChange:d.handleImageFileChange}),jsx("input",{ref:r.mediaInputRef,type:"file",name:"media-upload",accept:"video/*,audio/*",className:"hidden",onChange:d.handleMediaFileChange})]})}Pe();function Rme(t){let e=M6e;return typeof e.sanitize!="function"?t:e.sanitize(t,{USE_PROFILES:{mathMl:true,svg:true}})}var kme=[{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"}],Zdt=kme.map(t=>{try{let e=Qw(t.latex),n=Ay(e);return n?Rme(n):""}catch{return ""}});function Jdt({mathml:t}){let e=useRef(null);return useEffect(()=>{e.current&&(t?e.current.innerHTML=Rme(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 Ime({isOpen:t,onClose:e,onInsert:n,existingOmml:r}){let{t:o}=useTranslation(),{panelStyle:i,handlers:s}=pi(e),a=useMemo(()=>r?R4(r):"",[r]),[l,c]=useState(a),d=useDeferredValue(l),u=useRef(null);useEffect(()=>{t&&(c(a),setTimeout(()=>u.current?.focus(),50));},[t,a]);let{mathml:p,omml:h}=useMemo(()=>{if(!d.trim())return {mathml:"",omml:{}};try{let b=Qw(d);return {mathml:Ay(b),omml:b}}catch{return {mathml:"",omml:{}}}},[d]),f=useCallback(()=>{if(!l.trim())return;let b=h;try{let v=Qw(l);v&&Object.keys(v).length>0&&(b=v);}catch{}n(b),e();},[l,h,n,e]),m=useCallback(b=>{c(b);},[]),x=useCallback(b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),f()),b.key==="Escape"&&(b.preventDefault(),e());},[f,e]);if(!t)return null;let g=!!r,y=l.trim().length>0&&Object.keys(h).length>0;return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:b=>{b.target===b.currentTarget&&e();},onKeyDown:x,children:jsxs("div",{style:i,className:"bg-background border border-border rounded-xl shadow-2xl w-[640px] max-h-[85vh] flex flex-col overflow-hidden max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",onClick:b=>b.stopPropagation(),children:[jsxs("div",{...s,className:"flex items-center justify-between px-5 py-3 border-b border-border touch-none",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:g?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:y?jsx(Jdt,{mathml:p}):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:u,value:l,onChange:b=>c(b.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:kme.map((b,v)=>{let S=Zdt[v];return jsxs("button",{type:"button",onClick:()=>m(b.latex),className:ie("flex flex-col items-center gap-1 p-2 rounded-lg border transition-colors",l===b.latex?"border-primary bg-primary/10":"border-border bg-muted/40 hover:bg-accent/60 hover:border-border"),title:o(b.i18nKey,b.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(b.i18nKey,b.label)})]},b.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:f,disabled:!y,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:g?o("pptx.equation.update","Update"):o("pptx.equation.insert","Insert")})]})]})})}Pe();var dl=["#3b82f6","#22c55e","#f97316","#eab308"];function eut(){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:dl[t],opacity:.85},t))})}function tut(){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:dl[t],opacity:.85},t)})})}function nut(){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:dl[t],opacity:.85},t)})})}function rut(){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:dl[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:dl[1],opacity:.85}),jsx("rect",{x:38,y:20,width:18,height:10,rx:2,fill:dl[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 out(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:22,cy:20,r:14,fill:dl[0],opacity:.3}),jsx("circle",{cx:38,cy:20,r:14,fill:dl[1],opacity:.3}),jsx("circle",{cx:30,cy:10,r:14,fill:dl[2],opacity:.3})]})}function iut(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:30,cy:20,r:7,fill:dl[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(Qm.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:dl[t+1],opacity:.85})]},t)})]})}function sut(){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:dl[t],opacity:.85},t))})}function Nme(t){switch(t){case "basicBlockList":case "stackedList":case "tableList":case "horizontalBulletList":return jsx(eut,{});case "basicChevronProcess":case "segmentedProcess":case "continuousBlockProcess":case "upwardArrow":return jsx(tut,{});case "basicCycle":case "basicPie":return jsx(nut,{});case "basicRadial":case "convergingRadial":return jsx(iut,{});case "hierarchy":return jsx(rut,{});case "basicVenn":case "linearVenn":return jsx(out,{});default:return jsx(sut,{})}}function Dme({isOpen:t,onClose:e,onInsert:n}){let{t:r}=useTranslation(),{panelStyle:o,handlers:i}=pi(e),[s,a]=useState("list"),[l,c]=useState(null),d=sR.filter(p=>p.category===s),u=useCallback(()=>{if(!l)return;let p=sR.find(h=>h.layout===l);p&&(n(p.layout,p.defaultItems),e());},[l,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",{style:o,className:"pointer-events-auto w-[600px] max-w-[90vw] max-h-[80vh] rounded-lg border border-border bg-background shadow-2xl flex flex-col max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",role:"dialog","aria-modal":"true","aria-label":r("pptx.smartart.insertTitle"),children:[jsxs("div",{...i,className:"flex items-center justify-between px-4 py-3 border-b border-border touch-none",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:HU.map(p=>jsx("button",{type:"button",onClick:()=>{a(p.id),c(null);},className:ie("w-full text-left px-3 py-1.5 text-xs transition-colors",s===p.id?"bg-primary text-white":"text-foreground hover:bg-muted"),children:r(p.label)},p.id))}),jsx("div",{className:"flex-1 p-3 overflow-y-auto",children:jsx("div",{className:"grid grid-cols-3 gap-2",children:d.map(p=>jsxs("button",{type:"button",onClick:()=>c(p.layout),onDoubleClick:()=>{c(p.layout),n(p.layout,p.defaultItems),e();},className:ie("flex flex-col items-center gap-1 p-2 rounded border transition-colors",l===p.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:Nme(p.layout)}),jsx("span",{className:"text-[10px] text-foreground text-center leading-tight",children:r(p.labelKey)})]},p.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:u,disabled:!l,className:ie("px-3 py-1.5 text-xs rounded transition-colors",l?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:r("pptx.smartart.insert")})]})]})})]}):null}function oW(t){let{dialogs:e,insertHandlers:n,exportHandlers:r,printHandlers:o,propertyHandlers:i,annotations:s,slides:a,activeSlideIndex:l,canvasSize:c,filePath:d,coreProperties:u,customProperties:p,appProperties:h,embeddedFonts:f,hasDigitalSignatures:m,digitalSignatureCount:x,presentationProperties:g,customShows:y,selectedElements:b,isEncryptedDialogOpen:v,setIsEncryptedDialogOpen:S,showKeepAnnotationsDialog:w,onKeepAnnotations:C,onDiscardAnnotations:T}=t;return jsxs(Fragment,{children:[jsx(nz,{isOpen:i.isVersionHistoryOpen,filePath:d,onClose:()=>i.setIsVersionHistoryOpen(false),onRestore:i.handleRestoreVersion}),jsx(oz,{isOpen:i.isComparePanelOpen,compareResult:i.compareResult,canvasSize:c,onClose:()=>i.setIsComparePanelOpen(false),onAcceptSlide:i.handleAcceptSlide,onRejectSlide:i.handleRejectSlide,onAcceptAll:i.handleAcceptAllSlides}),jsx(sz,{isOpen:e.isPasswordDialogOpen,isCurrentlyProtected:e.isPasswordProtected,onClose:()=>e.setIsPasswordDialogOpen(false),onSetPassword:e.handleSetPassword,onRemovePassword:e.handleRemovePassword}),jsx(kV,{isOpen:e.isDocPropsDialogOpen,coreProperties:u??{},customProperties:p,appProperties:h,onClose:()=>e.setIsDocPropsDialogOpen(false),onSave:(M,_,E)=>{i.handleUpdateCoreProperties(M),i.handleUpdateCustomProperties(_),E&&i.handleUpdateAppProperties(E);}}),jsx(NV,{isOpen:e.isFontEmbeddingOpen,embedFontsEnabled:e.embedFontsEnabled,usedFontFamilies:i.usedFontFamilies,embeddedFonts:f.map(M=>M.name),onClose:()=>e.setIsFontEmbeddingOpen(false),onToggleEmbedFonts:e.setEmbedFontsEnabled}),jsx(DV,{isOpen:e.isDigitalSigDialogOpen,onClose:()=>e.setIsDigitalSigDialogOpen(false),hasSignatures:m,signatureCount:x}),jsx(OV,{isOpen:e.isSignatureStrippedDialogOpen,signatureCount:x,onConfirm:()=>e.setIsSignatureStrippedDialogOpen(false),onCancel:()=>e.setIsSignatureStrippedDialogOpen(false)}),jsx(BV,{isOpen:v,onClose:()=>S(false)}),jsx(Dme,{isOpen:e.isSmartArtDialogOpen,onClose:()=>e.setIsSmartArtDialogOpen(false),onInsert:n.handleInsertSmartArt}),jsx(Ime,{isOpen:e.isEquationDialogOpen,onClose:()=>e.setIsEquationDialogOpen(false),onInsert:e.editingEquationOmml?n.handleUpdateEquation:n.handleInsertEquation,existingOmml:e.editingEquationOmml}),jsx(GG,{open:e.isHyperlinkDialogOpen,initialUrl:b[0]?.actionClick?.url,initialTooltip:b[0]?.actionClick?.tooltip,initialAction:b[0]?.actionClick?.action,slideCount:a.length,onConfirm:n.handleHyperlinkConfirm,onCancel:()=>e.setIsHyperlinkDialogOpen(false)}),jsx(M6,{isOpen:r.exportModalOpen,title:r.exportModalTitle,progress:r.exportProgress,statusMessage:r.exportStatusMessage,onCancel:r.handleCancelExport}),jsx(LG,{open:e.isSetUpSlideShowOpen,onClose:()=>e.setIsSetUpSlideShowOpen(false),properties:g,onSave:e.handleSaveSlideShowSettings,customShows:y,slideCount:a.length}),jsx(NG,{open:o.isPrintDialogOpen,onClose:()=>o.setIsPrintDialogOpen(false),onPrint:o.handlePrintWithSettings,slides:a,activeSlideIndex:l,defaultSlidesPerPage:g.printSlidesPerPage,defaultFrameSlides:g.printFrameSlides}),jsx(kG,{isOpen:w,annotationCount:Array.from(s.allSlideAnnotations.values()).reduce((M,_)=>M+_.length,0),slideCount:s.allSlideAnnotations.size,onKeep:C,onDiscard:T})]})}function iW(t){let{mode:e,slides:n,canvasSize:r,templateElements:o,presentation:i,onExitPresentation:s,isMobile:a}=t,l=e==="present"&&i.presenterMode;return jsxs(Fragment,{children:[l&&(a?jsx(HV,{slides:n,currentSlideIndex:i.presentationSlideIndex,canvasSize:r,templateElements:o,presentationStartTime:i.presentationStartTime,onMovePresentationSlide:i.movePresentationSlide,onExit:s}):jsx($V,{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(VV,{presentationStartTime:i.presentationStartTime,slideStartTime:i.slideStartTime,paused:i.rehearsalPaused,onTogglePause:i.toggleRehearsalPause}),i.showRehearsalSummary&&jsx(GV,{slides:n,canvasSize:r,recordedTimings:i.recordedTimings,onSave:i.saveRehearsalTimings,onDiscard:i.dismissRehearsalSummary})]})}var gut=50;function Ome(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],d=c.clientX-l.x,u=c.clientY-l.y;Math.abs(d)<gut||Math.abs(d)<=Math.abs(u)||(d<0?n():r());},[e,n,r]);return {onTouchStart:i,onTouchEnd:s}}function sW(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:s,canvasSize:a,activeSlideIndex:l,gridSpacingPx:c,zoom:d,state:u,selectedElement:p,canvasHandlers:h,insertHandlers:f,tableOps:m,annotations:x,presentation:g,onEndPresentation:y,findReplace:b}=t,v=e==="master"?i:o,S=e==="master"?u.activeLayout?u.activeMaster?.elements??[]:[]:s,w=useMemo(()=>{let N=u.headerFooter,D;if(o)for(let U of o.elements){let G=U.placeholderType;if(G==="title"||G==="ctrTitle"){let j=U.text;if(j){D=j;break}}}return {slideNumber:o?.slideNumber,dateTimeText:N.dateTimeText,dateFormat:N.dateFormat,footerText:N.footerText,headerText:N.headerText,slideTitle:D,customProperties:u.customProperties.map(U=>({name:U.name,value:U.value}))}},[u.headerFooter,u.customProperties,o]),C=useMemo(()=>{if(!(!u.theme&&!u.tableStyleMap))return {theme:u.theme,tableStyleMap:u.tableStyleMap}},[u.theme,u.tableStyleMap]),T=useCallback((N,D)=>{e==="present"?g.handlePresentationAction(D):D.url&&rh(D.url);},[e,g]),M=useCallback(N=>{if(VA(N)){if(e==="present"){let D=cU(N);if(D){let U={action:D.action,targetSlideIndex:D.targetSlideIndex};g.handlePresentationAction(U);}}return}rh(N);},[e,g]),_=useRef(false),E=useCallback(()=>{_.current=true,x.setToolbarVisible(true);},[x]),R=useCallback(()=>{_.current=false;},[]),I=e==="preview"||e==="present",L=useCallback(()=>{e==="present"?g.movePresentationSlide(1):u.setActiveSlideIndex(N=>Math.min(r.length-1,N+1));},[e,g,u,r.length]),k=useCallback(()=>{e==="present"?g.movePresentationSlide(-1):u.setActiveSlideIndex(N=>Math.max(0,N-1));},[e,g,u]),F=Ome({enabled:I,onNext:L,onPrev:k});return jsxs("main",{"aria-label":"Slide editor",className:"flex-1 min-w-0 relative flex flex-col bg-background",onTouchStart:F.onTouchStart,onTouchEnd:F.onTouchEnd,children:[b.findReplaceOpen&&jsx(J6,{findQuery:b.findQuery,replaceQuery:b.replaceQuery,findMatchCase:b.findMatchCase,findResults:b.findResults,findResultIndex:b.findResultIndex,onSetFindQuery:b.setFindQuery,onSetReplaceQuery:b.setReplaceQuery,onSetFindMatchCase:b.setFindMatchCase,onPerformFind:b.performFind,onNavigateResult:b.navigateFindResult,onReplace:b.handleReplace,onReplaceAll:b.handleReplaceAll,onClose:()=>b.setFindReplaceOpen(false)}),e==="master"&&u.masterViewTab==="notes"?jsx(jH,{notesMaster:u.notesMaster,canvasSize:a,notesCanvasSize:u.notesCanvasSize}):e==="master"&&u.masterViewTab==="handout"?jsx(YH,{handoutMaster:u.handoutMaster,canvasSize:a,slidesPerPage:u.handoutSlidesPerPage}):jsx(qG,{activeSlide:v,templateElements:S,canvasSize:a,zoom:d,mode:e,canEdit:n,editTemplateMode:e==="master"||u.editTemplateMode,selectedElementIdSet:u.selectedElementIdSet,selectedElement:p,inlineEditingElementId:u.inlineEditingElementId,inlineEditingText:u.inlineEditingText,spellCheckEnabled:u.spellCheckEnabled,mediaDataUrls:u.mediaDataUrls,tableEditorState:u.tableEditorState,marqueeSelectionState:u.marqueeSelectionState,snapLines:u.snapLines,showGrid:u.showGrid,gridSpacingPx:c,showRulers:u.showRulers,guides:u.guides,presentationElementStates:e==="present"?g.presentationElementStates:void 0,presentationKeyframesCss:e==="present"?g.presentationKeyframesCss:void 0,onClick:h.handleElementClick,onDoubleClick:h.handleElementDoubleClick,onMouseDown:h.handleElementMouseDown,onContextMenu:h.handleElementContextMenu,onCanvasMouseDown:h.handleCanvasMouseDown,onResizePointerDown:h.handleResizePointerDown,onAdjustmentPointerDown:h.handleAdjustmentPointerDown,onRotate:h.handleRotate,onInlineEditChange:u.setInlineEditingText,onInlineEditCommit:h.handleInlineEditCommit,onInlineEditCancel:()=>u.setInlineEditingElementId(null),onTableCellSelect:(N,D)=>u.setTableEditorState(N?{...N,elementId:D}:null),onCommitCellEdit:m.handleCommitCellEdit,onUpdateSmartArtElement:h.handleUpdateSmartArtElement,onFormatText:h.handleFormatText,onResizeTableColumns:m.handleResizeTableColumns,onResizeTableRow:m.handleResizeTableRow,findResults:b.findResults,findResultIndex:b.findResultIndex,activeSlideIndex:l,activeTool:u.activeTool,drawingColor:u.drawingColor,drawingWidth:u.drawingWidth,isDrawingRef:u.isDrawingRef,onAddInkElement:f.handleAddInkElement,onAddFreeformShape:f.handleAddFreeformShape,onEraseInkElement:f.handleEraseInkElement,onActionClick:T,onHyperlinkClick:M,allSlides:e==="present"?r:void 0,onZoomClick:e==="present"?g.handleZoomClick:void 0,sourceSlideIndex:e==="present"?l:void 0,fieldContext:w,tableStyleContext:C,collaborationOverlay:jsxs(Fragment,{children:[jsx(UH,{elements:v?.elements??[],activeSlideIndex:l}),jsx(OH,{activeSlideIndex:l,canvasWidth:a.width,canvasHeight:a.height,selectedElementId:u.selectedElementId})]}),comments:o?.comments,showCommentMarkers:u.sidebarPanelMode==="comments",onCommentMarkerClick:()=>u.setSidebarPanelMode("comments"),onMoveGuide:(N,D)=>{u.setGuides(U=>U.map(G=>G.id===N?{...G,position:G.axis==="h"?Math.max(0,Math.min(a.height,D)):Math.max(0,Math.min(a.width,D))}:G));},onDeleteGuide:N=>{u.setGuides(D=>D.filter(U=>U.id!==N));},onCreateGuideFromRuler:(N,D)=>{u.setGuides(U=>[...U,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:N,position:D}]);}}),e==="present"&&x.presentationTool!=="none"&&jsx(CG,{canvasSize:a,editorScale:d.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(RG,{visible:!!u.presentationProperties.showSubtitles}),e==="present"&&jsx(EG,{currentSlideIndex:g.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:g.movePresentationSlide,onEndPresentation:y??(()=>{})}),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:E,onMouseLeave:R,children:jsx(PG,{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:g.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:g.movePresentationSlide,presentationStartTime:g.presentationStartTime,onEndPresentation:y??(()=>{}),onTogglePresenterView:g.togglePresenterView,presenterMode:g.presenterMode})})]})}var nf="rounded bg-muted/50 p-2.5 space-y-2",rf="text-[11px] font-medium uppercase tracking-wide text-muted-foreground mb-1.5",$2="w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:border-primary focus:outline-none",$me="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",Hme="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 S5=[{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"}],h0=["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"];bt();function zme({editColors:t,canEdit:e,activePickerKey:n,majorFont:r,minorFont:o,onSetActivePickerKey:i,onColorChange:s,onMajorFontChange:a,onMinorFontChange:l}){let{t:c}=useTranslation(),d=useMemo(()=>xU(t),[t]),u=useCallback(p=>{n&&/^#[0-9a-fA-F]{6}$/.test(p)&&s(n,p);},[n,s]);return jsxs(Fragment,{children:[jsxs("div",{className:nf,children:[jsx("div",{className:rf,children:c("pptx.themeEditor.colorScheme")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:hc.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:`${Om[p]}: ${t[p]}`,"aria-label":`${Om[p]}: ${t[p]}`,onClick:()=>i(n===p?null:p)}),jsx("span",{className:"text-[9px] text-muted-foreground truncate w-full text-center",children:Om[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:Om[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=>u(p.target.value)})]})]}),d&&jsxs("div",{className:nf,children:[jsx("div",{className:rf,children:c("pptx.themeEditor.preview")}),jsx("div",{className:"flex flex-col gap-px",children:d.map((p,h)=>jsx("div",{className:"grid grid-cols-12 gap-px",children:p.map(f=>jsx("div",{className:"h-3.5 rounded-sm",style:{backgroundColor:f.hex},title:`${f.colLabel} -- ${f.rowLabel} (${f.hex})`},`${f.schemeKey}-${h}`))},h))})]}),jsxs("div",{className:nf,children:[jsx("div",{className:rf,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:$2,disabled:!e,value:h0.includes(r)?r:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&a(p.target.value);},children:[h0.map(p=>jsx("option",{value:p,children:p},p)),!h0.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:$2,disabled:!e,value:h0.includes(o)?o:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&l(p.target.value);},children:[h0.map(p=>jsx("option",{value:p,children:p},p)),!h0.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 Cut=["accent1","accent2","accent3","accent4","accent5","accent6"];function Gme({canEdit:t,currentThemeName:e,onSelectPreset:n}){let{t:r}=useTranslation();return jsxs("div",{className:nf,children:[jsx("div",{className:rf,children:r("pptx.themeEditor.presetThemes")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:S5.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:Cut.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 Wme({theme:t,canEdit:e,onUpdateColorScheme:n,onUpdateFontScheme:r,onUpdateThemeName:o,onApplyToPresentation:i,onClose:s}){let{t:a}=useTranslation(),[l,c]=useState(()=>t?.colorScheme??S5[0].colorScheme),[d,u]=useState(()=>t?.fontScheme?.majorFont?.latin??"Calibri Light"),[p,h]=useState(()=>t?.fontScheme?.minorFont?.latin??"Calibri"),[f,m]=useState(()=>t?.name??"Custom Theme"),[x,g]=useState(null),y=useCallback((T,M)=>{let _={...l,[T]:M};c(_),n(_);},[l,n]),b=useCallback(T=>{c(T.colorScheme),u(T.majorFont),h(T.minorFont),m(T.name),n(T.colorScheme),r({majorFont:{latin:T.majorFont},minorFont:{latin:T.minorFont}}),o(T.name);},[n,r,o]),v=useCallback(()=>{t?.colorScheme&&(c(t.colorScheme),u(t.fontScheme?.majorFont?.latin??"Calibri Light"),h(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]),S=useCallback(T=>{u(T),r({majorFont:{latin:T},minorFont:{latin:p}});},[p,r]),w=useCallback(T=>{h(T),r({majorFont:{latin:d},minorFont:{latin:T}});},[d,r]),C=useCallback(T=>{m(T),o(T);},[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"),"aria-label":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:nf,children:[jsx("div",{className:rf,children:a("pptx.themeEditor.themeName")}),jsx("input",{type:"text",className:$2,disabled:!e,value:f,onChange:T=>C(T.target.value),placeholder:a("pptx.themeEditor.themeNamePlaceholder")})]}),jsx(Gme,{canEdit:e,currentThemeName:f,onSelectPreset:b}),jsx(zme,{editColors:l,canEdit:e,activePickerKey:x,majorFont:d,minorFont:p,onSetActivePickerKey:g,onColorChange:y,onMajorFontChange:S,onMinorFontChange:w}),jsxs("div",{className:"flex gap-1.5 pt-1",children:[jsx("button",{type:"button",disabled:!e,className:$me,onClick:i,children:a("pptx.themeEditor.applyToPresentation")}),jsx("button",{type:"button",disabled:!e,className:Hme,onClick:v,children:a("pptx.themeEditor.reset")})]})]})}function lW({onClose:t,className:e,children:n}){let{dragY:r,handlers:o}=Lu(t);return jsxs(Fragment,{children:[jsx("button",{type:"button","aria-label":"Close",onClick:t,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:e,style:r>0?{transform:`translateY(${r}px)`,transition:"none"}:void 0,children:[jsx("div",{className:"md:hidden flex items-center justify-center pt-2 pb-1 cursor-grab active:cursor-grabbing touch-none",onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onPointerCancel:o.onPointerCancel,children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),n]})]})}var cW=[{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 dW({theme:t,selected:e,onClick:n}){let{colorScheme:r}=t;return jsxs("button",{type:"button",onClick:n,className:ie("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 Yme({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 d=()=>{a&&(o(a),r());},u=()=>{c.current?.click();},p=h=>{let f=h.target.files?.[0];f&&i&&i(f),h.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:cW.map(h=>jsx(dW,{theme:h,selected:a?.id===h.id,onClick:()=>l(h)},h.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:u,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:d,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 uW(t){let{mode:e,canEdit:n,activeSlide:r,masterPseudoSlide:o,slides:i,canvasSize:s,activeSlideIndex:a,selectedElement:l,state:c,comments:d,ops:u,manipulation:p,propertyHandlers:h,themeHandlers:f,history:m,panelWidth:x,onResizeRight:g}=t,y=e==="master"?o:r;return jsxs(Fragment,{children:[(e==="edit"||e==="master")&&c.isInspectorPaneOpen&&g&&jsx(yu,{direction:"horizontal",onResize:g}),jsx(tW,{isOpen:(e==="edit"||e==="master")&&c.isInspectorPaneOpen,canEdit:n,mode:e,activeSlide:y,slides:i,canvasSize:s,selectedElement:l,effectiveSelectedIds:c.effectiveSelectedIds,tableEditorState:c.tableEditorState,sidebarPanelMode:c.sidebarPanelMode,activeSlideIndex:a,comments:d,onSetSidebarPanelMode:c.setSidebarPanelMode,onClose:()=>c.setIsInspectorPaneOpen(false),onUpdateElementStyle:u.updateSelectedShapeStyle,onUpdateTextStyle:u.updateSelectedTextStyle,onUpdateElement:u.updateSelectedElement,onApplySelection:u.applySelection,onSetCanvasSize:c.setCanvasSize,onMoveLayer:p.handleMoveLayer,onMoveLayerToEdge:p.handleMoveLayerToEdge,onDeleteElement:p.handleDelete,onUpdateSlide:h.handleUpdateSlide,presentationProperties:c.presentationProperties,onUpdatePresentationProperties:h.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:h.handleUpdateCoreProperties,onUpdateAppProperties:h.handleUpdateAppProperties,onUpdateCustomProperties:h.handleUpdateCustomProperties,onApplyTheme:f.handleApplyTheme,onSetTemplateBackground:f.handleSetTemplateBackground,onGetTemplateBackgroundColor:f.handleGetTemplateBackgroundColor,mediaDataUrls:c.mediaDataUrls,theme:c.theme,panelWidth:x}),c.isSelectionPaneOpen&&(e==="edit"||e==="master")&&jsx(lW,{onClose:()=>c.setIsSelectionPaneOpen(false),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] max-md:rounded-t-xl max-md:border-t max-md:border-border max-md:shadow-2xl max-md:bg-background",children:jsx(XV,{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(lW,{onClose:()=>c.setIsThemeEditorOpen(false),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(Wme,{theme:c.theme,canEdit:n,onUpdateColorScheme:f.handleUpdateThemeColorScheme,onUpdateFontScheme:f.handleUpdateThemeFontScheme,onUpdateThemeName:f.handleUpdateThemeName,onApplyToPresentation:f.handleApplyThemeToPresentation,onClose:()=>c.setIsThemeEditorOpen(false)})}),jsx(Yme,{open:c.isThemeGalleryOpen,currentTheme:null,canEdit:n,onClose:()=>c.setIsThemeGalleryOpen(false),onApplyTheme:b=>{f.handleApplyThemeData(b.colorScheme,{majorFont:{latin:b.fontScheme.majorFont,eastAsia:b.fontScheme.majorFont,complexScript:b.fontScheme.majorFont},minorFont:{latin:b.fontScheme.minorFont,eastAsia:b.fontScheme.minorFont,complexScript:b.fontScheme.minorFont}},b.name);}})]})}function pW(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,activeSlideIndex:s,canvasSize:a,gridSpacingPx:l,slideSectionGroups:c,showSlidesPane:d,showMasterPane:u,selectedElement:p,state:h,editorOps:f,dialogs:m,presentation:x,annotations:g,propertyHandlers:y,themeHandlers:b,history:v,comments:S,zoom:w,isMobile:C=false,isTouchDevice:T=false,onEndPresentation:M,leftPanelWidth:_,onResizeLeft:E,rightPanelWidth:R,onResizeRight:I}=t,{ops:L,sectionOps:k,canvasHandlers:F,insertHandlers:N,manipulation:D,slideOps:U,tableOps:G,findReplace:j}=f;return jsxs("div",{className:"relative z-10 flex flex-1 min-h-0",children:[d&&jsxs(Fragment,{children:[jsx(XC,{slides:r,activeSlideIndex:s,canvasSize:a,sectionGroups:c,isOpen:h.isSlidesPaneOpen,canEdit:n,onSelectSlide:h.setActiveSlideIndex,onSlideContextMenu:U.handleSlideContextMenu,onMoveSlide:U.handleMoveSlide,onAddSlide:U.handleAddSlide,onCollapse:()=>h.setIsSlidesPaneOpen(false),onAddSection:k.addSection,onRenameSection:k.renameSection,onDeleteSection:k.deleteSection,onMoveSectionUp:k.moveSectionUp,onMoveSectionDown:k.moveSectionDown,rehearsalTimings:Object.keys(x.recordedTimings).length>0?x.recordedTimings:void 0,panelWidth:_}),E&&jsx(yu,{direction:"horizontal",onResize:E})]}),u&&jsx(XH,{slideMasters:h.slideMasters,activeMasterIndex:h.activeMasterIndex,activeLayoutIndex:h.activeLayoutIndex,canvasSize:a,masterViewTab:h.masterViewTab,notesMaster:h.notesMaster,handoutMaster:h.handoutMaster,handoutSlidesPerPage:h.handoutSlidesPerPage,onSelectMaster:m.handleSelectMaster,onSelectLayout:m.handleSelectLayout,onCollapse:()=>h.setIsSlidesPaneOpen(false),onTabChange:h.setMasterViewTab,onHandoutSlidesPerPageChange:h.setHandoutSlidesPerPage}),jsx(sW,{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:h.templateElements,canvasSize:a,activeSlideIndex:s,gridSpacingPx:l,zoom:w,state:h,selectedElement:p,canvasHandlers:F,insertHandlers:N,tableOps:G,annotations:g,presentation:x,onEndPresentation:M,findReplace:j}),h.contextMenuState&&jsx(E6,{contextMenuState:h.contextMenuState,mode:e,selectedElement:p,tableEditorState:h.tableEditorState,hasMultiSelection:h.effectiveSelectedIds.length>1,onAction:D.handleContextMenuAction,onInsertTableRow:G.handleInsertTableRow,onDeleteTableRow:G.handleDeleteTableRow,onInsertTableColumn:G.handleInsertTableColumn,onDeleteTableColumn:G.handleDeleteTableColumn,onMergeCellRight:G.handleMergeCellRight,onMergeCellDown:G.handleMergeCellDown,onMergeSelectedCells:G.handleMergeSelectedCells,onSplitCell:G.handleSplitCell,onClose:()=>h.setContextMenuState(null)}),jsx(uW,{mode:e,canEdit:n,activeSlide:o,masterPseudoSlide:i,slides:r,canvasSize:a,activeSlideIndex:s,selectedElement:p,state:h,comments:S,ops:L,manipulation:D,propertyHandlers:y,themeHandlers:b,history:v,panelWidth:R,onResizeRight:I})]})}function qme({onOpenSlides:t,onOpenInsert:e,onOpenInspector:n,onOpenComments:r,onToggleNotes:o,activeSheet:i,commentCount:s}){return jsx("nav",{"aria-label":"Editor actions",className:"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:d,onClick:u,badge:p})=>{let h=i===l;return jsxs("button",{type:"button",onClick:u,className:ie("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",h?"text-primary":"text-muted-foreground hover:text-foreground"),"aria-pressed":h,children:[jsx(d,{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}),h&&jsx("span",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-8 h-0.5 rounded-full bg-primary"})]},l)})})}function Zme({open:t,onClose:e,...n}){return jsx(ON,{open:t,onClose:e,heightFraction:.7,title:"Slides",children:jsx("div",{className:"h-full",children:jsx(XC,{...n})})})}function Jme(t){let{state:e,editorOps:n,presentation:r,slides:o,activeSlideIndex:i,canvasSize:s,slideSectionGroups:a,canEdit:l,commentCount:c}=t,{keyboardInset:d,isKeyboardOpen:u}=EV(),p=e.isSlidesPaneOpen?"slides":e.isInspectorPaneOpen?e.sidebarPanelMode==="comments"?"comments":"inspector":e.isSlideNotesCollapsed?null:"notes",h=()=>{e.setIsSlidesPaneOpen(false),e.setIsInspectorPaneOpen(false),e.setIsSlideNotesCollapsed(true);},f=m=>{switch(h(),m){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(Zme,{open:e.isSlidesPaneOpen,onClose:()=>e.setIsSlidesPaneOpen(false),slides:o,activeSlideIndex:i,canvasSize:s,sectionGroups:a,isOpen:true,canEdit:l,onSelectSlide:m=>{e.setActiveSlideIndex(m),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("div",{className:"contents",style:d>0?{display:"block",transform:`translateY(-${d}px)`,transition:"transform 150ms ease-out",willChange:"transform"}:void 0,"data-keyboard-open":u?"true":void 0,children:jsx(qme,{activeSheet:p,commentCount:c,onOpenSlides:()=>e.isSlidesPaneOpen?e.setIsSlidesPaneOpen(false):f("slides"),onOpenInsert:()=>{n.insertHandlers.handleAddTextBox();},onOpenInspector:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode!=="comments"?e.setIsInspectorPaneOpen(false):f("inspector"),onOpenComments:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode==="comments"?e.setIsInspectorPaneOpen(false):f("comments"),onToggleNotes:()=>e.isSlideNotesCollapsed?f("notes"):e.setIsSlideNotesCollapsed(true)})})]})}function _v({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:ie("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:ie("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})]})}function ege({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:d=false,onToggleReducedMotion:u}){let[p,h]=useState("general"),[f,m]=useState(true),{t:x}=useTranslation(),{panelStyle:g,handlers:y}=pi(e),b=useCallback(S=>{S.key==="Escape"&&e();},[e]);if(useEffect(()=>{if(t)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t,b]),!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",{style:g,className:"pointer-events-auto w-[min(32rem,calc(100%-2rem))] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...y,className:"flex items-center justify-between px-5 py-4 border-b border-border/60 touch-none",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:()=>h(S.id),className:ie("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(_v,{label:x("pptx.settings.autoSave"),enabled:f,onToggle:()=>m(!f)}),jsx(_v,{label:x("pptx.settings.spellCheck"),enabled:n,onToggle:()=>r?.(!n)}),jsx(_v,{label:x("pptx.settings.showGrid"),enabled:o,onToggle:()=>i?.(!o)}),jsx(_v,{label:x("pptx.settings.showRulers"),enabled:s,onToggle:()=>a?.(!s)}),jsx(_v,{label:x("pptx.settings.snapToGrid"),enabled:l,onToggle:()=>c?.(!l)}),jsx(_v,{label:x("pptx.settings.reducedMotion"),enabled:d,onToggle:()=>u?.()})]}),p==="shortcuts"&&jsx("div",{className:"space-y-0.5",children:CR.map((S,w)=>jsxs("div",{className:ie("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:x(S.actionKey)}),jsx("span",{className:"font-mono text-[11px] text-muted-foreground whitespace-nowrap",children:S.shortcut})]},S.actionKey))})]})]})})]})}var qut=120,Zut=400,Jut=180,Qut=220,ept=480,tpt=288,npt=60,rpt=400,opt=120;function tge(){let[t,e]=useState(Jut),[n,r]=useState(tpt),[o,i]=useState(opt),s=useCallback(c=>{e(d=>Math.min(Zut,Math.max(qut,d+c)));},[]),a=useCallback(c=>{r(d=>Math.min(ept,Math.max(Qut,d-c)));},[]),l=useCallback(c=>{i(d=>Math.min(rpt,Math.max(npt,d-c)));},[]);return {leftWidth:t,rightWidth:n,bottomHeight:o,onResizeLeft:s,onResizeRight:a,onResizeBottom:l}}var nge=forwardRef(function(e,n){let{content:r,filePath:o,fileName:i,canEdit:s=false,onContentChange:a,onDirtyChange:l,onActiveSlideChange:c,onModeChange:d,onZoomChange:u,onSelectionChange:p,onSlideCountChange:h,onOpenFile:f,theme:m,authorName:x,collaboration:g,onStartCollaboration:y,onStopCollaboration:b,shareDefaults:v,smartArt3D:S=false}=e,w=y$(m),[C,T]=useState(r);useEffect(()=>{T(r);},[r]);let M=useCallback(()=>{if(f){f();return}(async()=>{let Te=await Bne();Te&&T(Te.buffer);})();},[f]),[_,E]=useState(false),[R,I]=useState(true),[L,k]=useState(false),{reducedMotion:F,toggleReducedMotion:N}=vV(),D=Iz(),{containerRef:U,mode:G,slides:j,canvasSize:Y,loading:ge,error:fe,activeSlideIndex:de,selectedElementId:J,selectedElementIds:re,templateElementsBySlideId:ce,activeSlide:ae,selectedElement:_e}=D,xe=x2({containerRef:U}),{isMobile:Ee,isTouchDevice:W,isVirtualKeyboardOpen:q}=xe,Q=tge(),{gridSpacingPx:se,visibleSlideIndexes:me,slideSectionGroups:P,masterPseudoSlide:A}=cV({slides:j,sections:D.sections,customShows:D.customShows,activeCustomShowId:D.activeCustomShowId,mode:G,activeLayout:D.activeLayout,activeMaster:D.activeMaster,presentationGridSpacing:D.presentationProperties.gridSpacing}),O=useCallback(()=>!!(D.dragStateRef.current||D.resizeStateRef.current||D.marqueeStateRef.current||D.shapeAdjustmentDragStateRef.current||D.isDrawingRef.current),[D.dragStateRef,D.resizeStateRef,D.marqueeStateRef,D.shapeAdjustmentDragStateRef,D.isDrawingRef]),z=cz({canvasSize:Y,selectedElements:D.selectedElements}),te=az({slides:j,canvasSize:Y,activeSlideIndex:de,templateElementsBySlideId:ce,editTemplateMode:D.editTemplateMode,headerFooter:D.headerFooter,loading:ge,error:fe,hasActivePointerInteraction:O,pointerCommitNonce:D.pointerCommitNonce,setSlides:D.setSlides,setCanvasSize:D.setCanvasSize,setActiveSlideIndex:D.setActiveSlideIndex,setTemplateElementsBySlideId:D.setTemplateElementsBySlideId,setSelectedElementId:D.setSelectedElementId,setSelectedElementIds:D.setSelectedElementIds,setEditTemplateMode:D.setEditTemplateMode,setHeaderFooter:D.setHeaderFooter}),{presentation:$,annotations:Me,actionSoundHandlerRef:De}=hV({mode:G,slides:j,visibleSlideIndexes:me,activeSlideIndex:de,containerRef:U,content:C,mediaDataUrls:D.mediaDataUrls,presentationProperties:D.presentationProperties,setMode:D.setMode,setActiveSlideIndex:D.setActiveSlideIndex,setSlides:D.setSlides,history:te});PV({targetRef:z.canvasViewportRef,currentScale:z.scale,callbacks:{onPinchZoom:Te=>z.setScale(Te),onSwipe:G==="present"?Te=>$.movePresentationSlide(Te===1?-1:1):void 0,onLongPress:(Te,Ve)=>{G!=="edit"||!s||D.selectedElementId&&D.setContextMenuState({x:Te,y:Ve,elementId:D.selectedElementId});}},enabled:W});let V=lV({mode:G,slides:j,activeSlide:ae,canvasSize:Y,containerRef:U,customShows:D.customShows,activeCustomShowId:D.activeCustomShowId,setCustomShows:D.setCustomShows,setActiveCustomShowId:D.setActiveCustomShowId,setGuides:D.setGuides,setPresentationProperties:D.setPresentationProperties,setAccessibilityIssues:D.setAccessibilityIssues,setIsAccessibilityPanelOpen:D.setIsAccessibilityPanelOpen,setMode:D.setMode,setPreMasterMode:D.setPreMasterMode,setActiveMasterIndex:D.setActiveMasterIndex,setActiveLayoutIndex:D.setActiveLayoutIndex,setSelectedElementId:D.setSelectedElementId,setSelectedElementIds:D.setSelectedElementIds,preMasterMode:D.preMasterMode,hasDigitalSignatures:D.hasDigitalSignatures,isDirty:D.isDirty,history:te});useEffect(()=>{D.setSelectedElementId(null),D.setSelectedElementIds([]),D.setInlineEditingElementId(null);},[de]),useEffect(()=>{G==="present"&&(D.setSelectedElementId(null),D.setSelectedElementIds([]),D.setInlineEditingElementId(null),z.handleZoomToFit(),z.canvasViewportRef.current?.scrollTo({left:0,top:0}));},[G]);let B=fV({state:D,history:te,zoom:z,mode:G,canEdit:s,slides:j,activeSlide:ae,activeSlideIndex:de,selectedElement:_e,selectedElementId:J,selectedElementIds:re,canvasSize:Y,dialogs:V,presentation:$,userName:x??g?.userName,handlerRef:De}),{exportHandlers:ee,printHandlers:oe,themeHandlers:pe,propertyHandlers:Ae,showKeepAnnotationsDialog:Le,handleSetMode:ue,handleKeepAnnotations:we,handleDiscardAnnotations:Ie,handleEnterPresenterView:He,handleEnterRehearsalMode:Oe,autosaveStatus:$e,isEncryptedDialogOpen:ot,setIsEncryptedDialogOpen:at}=bV({state:D,zoom:z,history:te,presentation:$,annotations:Me,actionSoundHandlerRef:De,editorOps:B,dialogs:V,gridSpacingPx:se,content:C,filePath:o,autosaveEnabled:R,canEdit:s,mode:G,slides:j,activeSlide:ae,activeSlideIndex:de,canvasSize:Y,loading:ge,error:fe,ref:n,setContent:T,onContentChange:a,onDirtyChange:l,onActiveSlideChange:c,onModeChange:d,onZoomChange:u,onSelectionChange:p,onSlideCountChange:h});if(ge)return jsx(b6,{});if(fe)return jsx(v6,{error:fe});let gt=G==="edit"&&!Ee&&!V.isNarrowViewport&&D.isSlidesPaneOpen,le=G==="master"&&!Ee&&D.isSlidesPaneOpen,Ue=jsxs("div",{style:w,"data-pptx-viewer":"",className:"h-full w-full bg-background text-foreground relative",children:[jsxs("div",{ref:U,tabIndex:0,className:"h-full w-full flex flex-col overflow-hidden outline-none",children:[G!=="present"&&jsx(nW,{mode:G,canEdit:s,state:D,selectedElement:_e,activeSlide:ae,zoom:z,history:te,findReplace:B.findReplace,manipulation:B.manipulation,insertHandlers:B.insertHandlers,exportHandlers:ee,printHandlers:oe,propertyHandlers:Ae,dialogs:V,slideOps:B.slideOps,ops:B.ops,onSetMode:ue,onEnterPresenterView:He,onEnterRehearsalMode:Oe,onOpenSettings:()=>E(true),onOpenShareDialog:()=>k(true),onOpenFile:M,fileName:i,autosaveStatus:$e,autosaveEnabled:R,onToggleAutosave:()=>I(Te=>!Te)}),jsx(pW,{mode:G,canEdit:s,slides:j,activeSlide:ae,masterPseudoSlide:A,activeSlideIndex:de,canvasSize:Y,gridSpacingPx:se,slideSectionGroups:P,showSlidesPane:gt,showMasterPane:le,selectedElement:_e,state:D,editorOps:B,dialogs:V,presentation:$,annotations:Me,propertyHandlers:Ae,themeHandlers:pe,history:te,comments:B.comments,zoom:z,isMobile:Ee,isTouchDevice:W,onEndPresentation:()=>ue("edit"),leftPanelWidth:Ee?void 0:Q.leftWidth,onResizeLeft:Ee?void 0:Q.onResizeLeft,rightPanelWidth:Ee?void 0:Q.rightWidth,onResizeRight:Ee?void 0:Q.onResizeRight}),G!=="present"&&(!q||!D.isSlideNotesCollapsed)&&jsx(eW,{activeSlide:ae,allSlides:j,isSlideNotesCollapsed:D.isSlideNotesCollapsed,canEdit:s,slideCount:j.length,activeSlideIndex:de,isDirty:D.isDirty,autosaveStatus:$e,onToggleNotes:()=>D.setIsSlideNotesCollapsed(Te=>!Te),onUpdateNotes:Ae.handleUpdateNotes,collaborationSlot:g?jsx(apt,{}):void 0,notesPanelHeight:Ee?void 0:Q.bottomHeight,onResizeBottom:Ee?void 0:Q.onResizeBottom,scale:z.scale,onZoomIn:z.handleZoomIn,onZoomOut:z.handleZoomOut,onZoomToFit:z.handleZoomToFit,mode:G,onSetMode:ue,onToggleSlideSorter:()=>D.setShowSlideSorter(Te=>!Te),hideStatusBar:Ee}),G!=="present"&&Ee&&jsx(Jme,{state:D,editorOps:B,presentation:$,slides:j,activeSlideIndex:de,canvasSize:Y,slideSectionGroups:P,canEdit:s,commentCount:ae?.comments?.length??0})]}),jsx(oW,{dialogs:V,insertHandlers:B.insertHandlers,exportHandlers:ee,printHandlers:oe,propertyHandlers:Ae,annotations:Me,slides:j,activeSlideIndex:de,canvasSize:Y,filePath:o,coreProperties:D.coreProperties,customProperties:D.customProperties,appProperties:D.appProperties,embeddedFonts:D.embeddedFonts,hasDigitalSignatures:D.hasDigitalSignatures,digitalSignatureCount:D.digitalSignatureCount,presentationProperties:D.presentationProperties,customShows:D.customShows,selectedElements:D.selectedElements,isEncryptedDialogOpen:ot,setIsEncryptedDialogOpen:at,showKeepAnnotationsDialog:Le,onKeepAnnotations:we,onDiscardAnnotations:Ie}),jsx(ege,{isOpen:_,onClose:()=>E(false),spellCheckEnabled:D.spellCheckEnabled,onSetSpellCheckEnabled:D.setSpellCheckEnabled,showGrid:D.showGrid,onSetShowGrid:D.setShowGrid,showRulers:D.showRulers,onSetShowRulers:D.setShowRulers,snapToGrid:D.snapToGrid,onSetSnapToGrid:D.setSnapToGrid,reducedMotion:F,onToggleReducedMotion:N}),jsx(VG,{open:L,onClose:()=>k(false),activeCollaboration:g,onStartCollaboration:y,onStopCollaboration:b,preconfigured:!!g,defaultRoomId:v?.roomId,defaultUserName:v?.userName,defaultServerUrl:v?.serverUrl}),jsx(UG,{open:V.isBroadcastDialogOpen,onClose:()=>V.setIsBroadcastDialogOpen(false),onStartBroadcast:y,onStopBroadcast:b,onStartPresenting:()=>ue("present"),defaultRoomId:v?.roomId,defaultUserName:v?.userName,defaultServerUrl:v?.serverUrl}),jsx(JG,{isShortcutHelpOpen:D.isShortcutHelpOpen,isAccessibilityPanelOpen:D.isAccessibilityPanelOpen,showSlideSorter:D.showSlideSorter,accessibilityIssues:D.accessibilityIssues,slides:j,activeSlideIndex:de,canvasSize:Y,canEdit:s,sectionGroups:P,onCloseShortcuts:()=>D.setIsShortcutHelpOpen(false),onCloseAccessibility:()=>D.setIsAccessibilityPanelOpen(false),onSelectSlide:Te=>{D.setActiveSlideIndex(Te),D.setShowSlideSorter(false);},onMoveSlide:B.slideOps.handleMoveSlide,onDeleteSlides:B.slideOps.handleDeleteSlides,onDuplicateSlides:B.slideOps.handleDuplicateSlides,onToggleHideSlides:B.slideOps.handleToggleHideSlides,onCloseSorter:()=>D.setShowSlideSorter(false),reducedMotion:F,onToggleReducedMotion:N}),jsx(iW,{mode:G,slides:j,canvasSize:Y,templateElements:D.templateElements,presentation:$,onExitPresentation:()=>ue("edit"),isMobile:Ee})]});return jsx(rk.Provider,{value:S,children:jsx(x$,{theme:m,children:g?jsxs(LI,{config:g,canvasWidth:Y.width,canvasHeight:Y.height,children:[jsx(lpt,{slides:j,templateElementsBySlideId:ce,setSlides:D.setSlides,config:g,content:C}),jsx(cpt,{activeSlideIndex:de,setActiveSlideIndex:D.setActiveSlideIndex,slideCount:j.length}),Ue]}):Ue})})});nge.displayName="PowerPointViewer";function apt(){let t=No();return t?jsx(BI,{status:t.status,connectedCount:t.connectedCount,onRetry:t.retry}):null}function lpt({slides:t,templateElementsBySlideId:e,setSlides:n,config:r,content:o}){let i=No(),s=useRef(o);s.current=o;let a=useCallback(()=>{let l=s.current;return l?l instanceof Uint8Array?l:new Uint8Array(l):null},[]);return wV({doc:i?.doc??null,slides:t,templateElementsBySlideId:e,setSlides:n,isConnected:i?.status==="connected",isSynced:i?.synced??true,config:r,getSourceBytes:a}),null}function cpt({activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n}){let r=No(),{followedClientId:o,followUser:i}=MV({collab:r,activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n});return TV({collab:r,activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n,paused:o!==null}),r?jsx("div",{className:"pointer-events-none fixed inset-x-0 top-2 z-[1100] flex justify-center px-2",children:jsx("div",{className:"pointer-events-auto",children:jsx(DH,{presences:r.remoteUsers,followedClientId:o,onFollow:i})})}):null}/**
4869
+ `);return o.textContent=i,document.head.appendChild(o),()=>{let s=document.getElementById(xue);s&&document.head.removeChild(s);}},[n]);}function xV(t){let{content:e,filePath:n,autosaveEnabled:r=true,slides:o,state:i,history:s,ops:a,actionSoundHandlerRef:l,setIsEncryptedDialogOpen:c,password:d}=t,{handlerRef:u}=Lz({content:e,clearSelection:a.clearSelection,history:s,setSlides:i.setSlides,setTemplateElementsBySlideId:i.setTemplateElementsBySlideId,mediaDataUrls:i.mediaDataUrls,setCanvasSize:i.setCanvasSize,setHeaderFooter:i.setHeaderFooter,setLayoutOptions:i.setLayoutOptions,setSlideMasters:i.setSlideMasters,setTheme:i.setTheme,setTableStyleMap:i.setTableStyleMap,setThemeOptions:i.setThemeOptions,setCustomShows:i.setCustomShows,setSections:i.setSections,setPresentationProperties:i.setPresentationProperties,setNotesMaster:i.setNotesMaster,setHandoutMaster:i.setHandoutMaster,setNotesCanvasSize:i.setNotesCanvasSize,setCustomProperties:i.setCustomProperties,setTagCollections:i.setTagCollections,setCoreProperties:i.setCoreProperties,setAppProperties:i.setAppProperties,setEmbeddedFonts:i.setEmbeddedFonts,setActiveSlideIndex:i.setActiveSlideIndex,setHasMacros:i.setHasMacros,setHasDigitalSignatures:i.setHasDigitalSignatures,setDigitalSignatureCount:i.setDigitalSignatureCount,setGuides:i.setGuides,setLoading:i.setLoading,setError:i.setError,setIsDirty:i.setIsDirty,setIsEncrypted:c});useEffect(()=>{l.current=u.current;},[u,l,i.loading]),bue({embeddedFonts:i.embeddedFonts,slides:o});let p=uV({slides:o,templateElementsBySlideId:i.templateElementsBySlideId,activeSlideIndex:i.activeSlideIndex,guides:i.guides,headerFooter:i.headerFooter,presentationProperties:i.presentationProperties,customShows:i.customShows,sections:i.sections,coreProperties:i.coreProperties,appProperties:i.appProperties,customProperties:i.customProperties,notesMaster:i.notesMaster,handoutMaster:i.handoutMaster,handlerRef:u,inlineEditingElementIdRef:i.inlineEditingElementIdRef,inlineEditingTextRef:i.inlineEditingTextRef,password:d}),{autosaveStatus:h}=Dz({isDirty:i.isDirty,filePath:n,serializeSlides:p,enabled:r});return {handlerRef:u,serializeSlides:p,autosaveStatus:h}}var htt=2,ftt=20;function vue(t){let e=useRef(t);e.current=t;let n=useCallback(r=>{let{mode:o,canEdit:i,inlineEditingElementId:s,tableEditorState:a,activeTool:l,hasSelection:c,onDelete:d,onCopy:u,onCut:p,onPaste:h,onDuplicate:f,onUndo:m,onRedo:x,onSelectAll:g,onEscape:y,onNudge:b,onPrevSlide:v,onNextSlide:S}=e.current;if(o!=="edit"||!i)return;let w=r.target,C=w?.tagName==="INPUT"||w?.tagName==="TEXTAREA"||w?.isContentEditable;if(r.key==="Escape"){r.preventDefault(),y();return}if(s||a?.isEditing||l!=="select"||C)return;let T=r.metaKey||r.ctrlKey;if((r.key==="Delete"||r.key==="Backspace")&&c){r.preventDefault(),d();return}if(T)switch(r.key.toLowerCase()){case "z":r.preventDefault(),r.shiftKey?x():m();return;case "y":r.preventDefault(),x();return;case "c":c&&(r.preventDefault(),u());return;case "x":c&&(r.preventDefault(),p());return;case "v":r.preventDefault(),h();return;case "d":c&&(r.preventDefault(),f());return;case "a":r.preventDefault(),g();return}if(c&&(r.key==="ArrowUp"||r.key==="ArrowDown"||r.key==="ArrowLeft"||r.key==="ArrowRight")){r.preventDefault();let M=r.shiftKey?ftt:htt,_=0,E=0;switch(r.key){case "ArrowUp":E=-M;break;case "ArrowDown":E=M;break;case "ArrowLeft":_=-M;break;case "ArrowRight":_=M;break}b(_,E);return}!c&&(r.key==="ArrowLeft"||r.key==="ArrowRight")&&(r.preventDefault(),r.key==="ArrowLeft"?v?.():S?.());},[]);useEffect(()=>{let r=t.containerRef.current;return r&&r.addEventListener("keydown",n),window.addEventListener("keydown",n),()=>{r&&r.removeEventListener("keydown",n),window.removeEventListener("keydown",n);}},[t.containerRef,n]);}function yV(t){let{state:e,mode:n,canEdit:r,slides:o,activeSlide:i,ops:s,manipulation:a,history:l}=t;vue({containerRef:e.containerRef,mode:n,canEdit:r,inlineEditingElementId:e.inlineEditingElementId,tableEditorState:e.tableEditorState,activeTool:e.activeTool,hasSelection:e.effectiveSelectedIds.length>0,effectiveSelectedIds:e.effectiveSelectedIds,onDelete:a.handleDelete,onCopy:a.handleCopy,onCut:a.handleCut,onPaste:a.handlePaste,onDuplicate:a.handleDuplicate,onUndo:l.handleUndo,onRedo:l.handleRedo,onSelectAll:()=>{if(!i)return;let c=i.elements.map(d=>d.id);c.length>0&&s.applySelection(c[0],c);},onEscape:()=>{e.inlineEditingElementId?(e.setInlineEditingElementId(null),e.setInlineEditingText("")):e.contextMenuState?e.setContextMenuState(null):e.tableEditorState?e.setTableEditorState(null):s.clearSelection();},onNudge:(c,d)=>{let u=e.effectiveSelectedIds;if(u.length){for(let p of u){let h=e.elementLookup.get(p);h&&s.updateElementById(p,{x:h.x+c,y:h.y+d});}l.markDirty();}},onPrevSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.max(0,c-1));},onNextSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.min(o.length-1,c+1));}});}function bV(t){let{state:e,zoom:n,history:r,presentation:o,annotations:i,actionSoundHandlerRef:s,editorOps:a,dialogs:l,gridSpacingPx:c,content:d,filePath:u,autosaveEnabled:p,canEdit:h,mode:f,slides:m,activeSlide:x,activeSlideIndex:g,canvasSize:y,loading:b,error:v,ref:S,setContent:w,onContentChange:C,onDirtyChange:T,onActiveSlideChange:M,onModeChange:_,onZoomChange:E,onSelectionChange:R,onSlideCountChange:I}=t;Bz({editorScale:n.editorScale,canvasStageRef:n.canvasStageRef,canvasSize:y,activeSlide:x,activeSlideIndex:g,gridSpacingPx:c,dragStateRef:e.dragStateRef,resizeStateRef:e.resizeStateRef,shapeAdjustmentDragStateRef:e.shapeAdjustmentDragStateRef,marqueeStateRef:e.marqueeStateRef,editTemplateMode:e.editTemplateMode,snapToGrid:e.snapToGrid,snapToShape:e.snapToShape,guides:e.guides,templateElements:e.templateElements,elementLookup:e.elementLookup,setMarqueeSelectionState:e.setMarqueeSelectionState,setSnapLines:e.setSnapLines,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setPointerCommitNonce:e.setPointerCommitNonce,effectiveSelectedIds:e.effectiveSelectedIds,applySelection:a.ops.applySelection,clearSelection:a.ops.clearSelection,updateSlides:a.ops.updateSlides,updateElementById:a.ops.updateElementById,markDirty:r.markDirty});let[L,k]=useState(false),{handlerRef:F,serializeSlides:N,autosaveStatus:D}=xV({content:d,filePath:u,autosaveEnabled:p,slides:m,state:e,history:r,ops:a.ops,actionSoundHandlerRef:s,setIsEncryptedDialogOpen:k,password:l.presentationPassword??void 0}),{exportHandlers:U,printHandlers:G,themeHandlers:j,propertyHandlers:Y}=mV({state:e,slides:m,activeSlideIndex:g,canvasSize:y,filePath:u,history:r,ops:a.ops,zoom:n,handlerRef:F,serializeSlides:N,setContent:w,onContentChange:C,password:l.presentationPassword??void 0}),{showKeepAnnotationsDialog:ge,handleSetMode:fe,handleKeepAnnotations:de,handleDiscardAnnotations:J,handleEnterPresenterView:re,handleEnterRehearsalMode:ce}=dV({mode:f,presentation:o,annotations:i,history:r,setMode:e.setMode,setSlides:e.setSlides});return pV({filePath:u,loading:b,error:v,slideCount:m.length,openVersionHistory:()=>Y.setIsVersionHistoryOpen(true)}),useImperativeHandle(S,()=>({async getContent(){let ae=await N();return ae&&C&&C(ae),ae??new Uint8Array(0)},goTo(ae){ae>=0&&ae<m.length&&e.setActiveSlideIndex(ae);},goPrev(){let ae=g-1;ae>=0&&e.setActiveSlideIndex(ae);},goNext(){let ae=g+1;ae<m.length&&e.setActiveSlideIndex(ae);},undo(){r.handleUndo();},redo(){r.handleRedo();},canUndo(){return r.canUndo},canRedo(){return r.canRedo},getZoom(){return n.scale},setZoom(ae){n.setScale(Math.min(Math.max(ae,.2),5));},zoomIn(){n.handleZoomIn();},zoomOut(){n.handleZoomOut();},zoomReset(){n.handleResetZoom();},getMode(){return f},setMode(ae){e.setMode(ae);},getActiveSlideIndex(){return g},getSlideCount(){return m.length},isDirty(){return e.isDirty},getSelectedElementIds(){return e.selectedElementIds},selectElements(ae){e.setSelectedElementIds(ae),e.setSelectedElementId(ae[0]??null);},clearSelection(){e.setSelectedElementIds([]),e.setSelectedElementId(null);},setActiveSlideIndex(ae){ae>=0&&ae<m.length&&e.setActiveSlideIndex(ae);},getSlides(){return m},getSlide(ae){return m[ae]},getActiveSlide(){return m[g]},addSlide(ae){a.slideOps.handleAddSlide();},deleteSlides(ae){a.slideOps.handleDeleteSlides(ae);},duplicateSlides(ae){a.slideOps.handleDuplicateSlides(ae);},moveSlide(ae,_e){a.slideOps.handleMoveSlide(ae,_e);},toggleHideSlides(ae){a.slideOps.handleToggleHideSlides(ae);},getElements(ae){return m[ae??g]?.elements??[]},getElementById(ae,_e){return m[_e??g]?.elements.find(W=>W.id===ae)},updateElement(ae,_e){a.ops.updateElementById(ae,_e);},deleteElements(ae){e.setSelectedElementIds(ae),e.setSelectedElementId(ae[0]??null),a.manipulation.handleDelete();},duplicateElement(ae){return e.setSelectedElementIds([ae]),e.setSelectedElementId(ae),a.manipulation.handleDuplicate(),e.selectedElementIds[0]}}),[N,C,m,g,e,r,n,f,a]),useEffect(()=>{T&&T(e.isDirty);},[e.isDirty,T]),useEffect(()=>{M&&M(g);},[g,M]),useEffect(()=>{e.activeSlideIndexRef.current=g;},[g,e.activeSlideIndexRef]),useEffect(()=>{_&&_(f);},[f,_]),useEffect(()=>{E&&E(n.scale);},[n.scale,E]),useEffect(()=>{R&&R(e.selectedElementIds);},[e.selectedElementIds,R]),useEffect(()=>{I&&I(m.length);},[m.length,I]),yV({state:e,mode:f,canEdit:h,slides:m,activeSlide:x,ops:a.ops,manipulation:a.manipulation,history:r}),{exportHandlers:U,printHandlers:G,themeHandlers:j,propertyHandlers:Y,showKeepAnnotationsDialog:ge,handleSetMode:fe,handleKeepAnnotations:de,handleDiscardAnnotations:J,handleEnterPresenterView:re,handleEnterRehearsalMode:ce,autosaveStatus:D,isEncryptedDialogOpen:L,setIsEncryptedDialogOpen:k}}function Stt(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function wtt(){return false}function Ttt(t){if(typeof window>"u")return ()=>{};let e=window.matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function vV(){let t=useSyncExternalStore(Ttt,Stt,wtt),[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}}function SV({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}}Pe();var Mtt=5e3;function wV({doc:t,slides:e,templateElementsBySlideId:n,setSlides:r,isConnected:o,isSynced:i=true,config:s,getSourceBytes:a}){let l=useRef(false),c=useRef(""),d=useRef(false),u=useRef(null),p=useRef(null),h=useCallback(async()=>{if(p.current)return p.current;let m=await Promise.resolve().then(()=>(BC(),OC)),x={createMap:()=>new m.Map,createArray:()=>new m.Array,createText:()=>new m.Text};return p.current=x,x},[]),f=useCallback(()=>{if(!s?.onWriteBack||s.role!=="owner"||!t)return;u.current!==null&&clearTimeout(u.current);let m=s.writeBackDebounceMs??Mtt;u.current=setTimeout(async()=>{if(u.current=null,!t||!s.onWriteBack)return;let x=a?.();if(x)try{let{PptxHandler:g}=await Promise.resolve().then(()=>(bt(),Iq)),y=new g;await y.load(x.buffer);let b=IU(t),v=tb(b,n),S=await y.save(v);s.onWriteBack(S);}catch{}},m);},[t,s,a,n]);useEffect(()=>{if(!o||!i||!t||l.current||e.length===0)return;let m=JSON.stringify(e);m!==c.current&&(c.current=m,(async()=>{let x=await h();Pne(e,t,x,JA),f();})());},[t,e,o,i,h,f]),useEffect(()=>{if(!o||!t)return;let m=(g,y)=>{if(y?.origin===JA)return;let b=IU(t);if(b.length===0)return;let v=JSON.stringify(b);v!==c.current&&(c.current=v,l.current=true,r(b),requestAnimationFrame(()=>{l.current=false;}),f());},x=wne(t,m);return d.current||(d.current=true,t.getArray("pptx:slides").length>0&&m()),()=>{x(),u.current!==null&&(clearTimeout(u.current),u.current=null);}},[t,o,r,f]);}function TV({collab:t,activeSlideIndex:e,setActiveSlideIndex:n,slideCount:r,paused:o=false}){let i=useRef(-1);useEffect(()=>{if(!t||o||t.config.role!=="viewer")return;let s=t.remoteUsers.find(l=>l.role==="owner");if(!s)return;let a=s.activeSlideIndex;a<0||a>=r||a!==i.current&&(i.current=a,a!==e&&n(a));},[t,e,n,r,o]);}function MV({collab:t,activeSlideIndex:e,setActiveSlideIndex:n,slideCount:r}){let[o,i]=useState(null),s=useRef(-1),a=useCallback(d=>{s.current=-1,i(d);},[]),l=o===null?null:t?.remoteUsers.find(d=>d.clientId===o)??null;useEffect(()=>{o!==null&&t&&l===null&&i(null);},[t,o,l]);let c=l?.activeSlideIndex??null;return useEffect(()=>{if(!(c===null||c<0||c>=r)){if(c===e){s.current=c;return}s.current=c,n(c);}},[c,r,n]),useEffect(()=>{o!==null&&s.current!==-1&&e!==s.current&&i(null);},[e,o]),{followedClientId:o,followUser:a}}Pe();Pe();function PV(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(d=>d+1))),useEffect(()=>{let d=e.current;if(!d||!o)return;let u=are({getScale:()=>s.current,minScale:.2,maxScale:5,callbacks:{onPinchZoom:x=>i.current.onPinchZoom?.(x),onSwipe:x=>i.current.onSwipe?.(x),onLongPress:(x,g)=>i.current.onLongPress?.(x,g)}}),p=x=>u.onTouchStart(x),h=x=>u.onTouchMove(x),f=x=>u.onTouchEnd(x),m=()=>u.onTouchCancel();return d.addEventListener("touchstart",p,{passive:false}),d.addEventListener("touchmove",h,{passive:false}),d.addEventListener("touchend",f,{passive:true}),d.addEventListener("touchcancel",m,{passive:true}),()=>{d.removeEventListener("touchstart",p),d.removeEventListener("touchmove",h),d.removeEventListener("touchend",f),d.removeEventListener("touchcancel",m),u.cancel();}},[e,o,a]);}Pe();function Dtt(t){if(!(t instanceof HTMLElement))return false;let e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||t.isContentEditable}function Cue(t){if(t<=0||typeof document>"u")return;let e=document.activeElement;if(!Dtt(e))return;let n=e.getBoundingClientRect(),r=Wne({top:n.top,bottom:n.bottom},window.innerHeight,t);r!==0&&window.scrollBy({top:r,behavior:"smooth"});}function EV(t=true){let[e,n]=useState(0);return useEffect(()=>{if(!t||typeof window>"u")return;let r=window.visualViewport;if(!r)return;let o=()=>{let s=FU(window),a=s?DU(s):0;n(a),a>0&&window.requestAnimationFrame(()=>Cue(a));};o(),r.addEventListener("resize",o),r.addEventListener("scroll",o);let i=()=>{window.requestAnimationFrame(()=>{let s=FU(window),a=s?DU(s):0;a>0&&Cue(a);});};return document.addEventListener("focusin",i),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o),document.removeEventListener("focusin",i);}},[t]),{keyboardInset:e,isKeyboardOpen:Gne(e)}}var Utt=[{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 AV({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,d)=>d!==l));},[t,e]),i=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,name:c}:d));},[t,e]),s=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,value:c}:d));},[t,e]),a=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,type:c}:d));},[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:d=>i(c,d.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:d=>s(c,d.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:d=>s(c,d.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:d=>a(c,d.target.value),children:Utt.map(d=>jsx("option",{value:d.value,children:n(d.labelKey)},d.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 ztt=[{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.summary.company",editable:true},{key:"manager",labelKey:"pptx.documentProperties.summary.manager",editable:true}];function Vtt(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 Gtt(t,e,n){return t==="totalTime"?Vtt(e,n):e==null?n("pptx.documentProperties.statistics.notAvailable"):String(e)}function RV({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:ztt.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:Gtt(i,t[i],r)})]},i))})}var Mue=[{key:"title",labelKey:"pptx.properties.titleLabel"},{key:"subject",labelKey:"pptx.properties.subject"},{key:"creator",labelKey:"pptx.properties.author"},{key:"keywords",labelKey:"pptx.properties.keywords"},{key:"description",labelKey:"pptx.documentProperties.summary.description",multiline:true},{key:"category",labelKey:"pptx.documentProperties.summary.category"}];function kV({isOpen:t,coreProperties:e,customProperties:n,appProperties:r,onClose:o,onSave:i}){let{t:s}=useTranslation(),[a,l]=useState("summary"),[c,d]=useState({}),[u,p]=useState([]),[h,f]=useState({}),[m,x]=useState(false);t&&!m&&(d({...e}),p(n.map(M=>({...M}))),f({company:r?.company,manager:r?.manager}),l("summary")),t!==m&&x(t);let g=useCallback((M,_)=>{d(E=>({...E,[M]:_}));},[]),y=useMemo(()=>{if(Mue.some(({key:R})=>(c[R]??"")!==(e[R]??"")))return true;let _=(h.company??"")!==(r?.company??""),E=(h.manager??"")!==(r?.manager??"");return _||E||u.length!==n.length?true:u.some((R,I)=>R.name!==n[I]?.name||R.value!==n[I]?.value||R.type!==n[I]?.type)},[c,u,h,e,n,r]),b=useCallback(M=>{f(_=>({..._,...M}));},[]),v=useCallback(()=>{let M=(h.company??"")!==(r?.company??"")||(h.manager??"")!==(r?.manager??"");i(c,u,M?h:void 0),o();},[c,u,h,r,i,o]),S=useCallback(()=>{o();},[o]),{panelStyle:w,handlers:C}=pi(S);if(!t)return null;let T=[{id:"summary",labelKey:"pptx.documentProperties.tabs.general"},{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:S}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{style:w,className:"pointer-events-auto w-[520px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...C,className:"flex items-center justify-between px-5 py-4 border-b border-border/60 touch-none",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:S,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(M=>jsx("button",{type:"button",onClick:()=>l(M.id),className:`px-4 py-2 text-xs font-medium transition-colors ${a===M.id?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:s(M.labelKey)},M.id))}),jsxs("div",{className:"px-5 py-4 min-h-[280px]",children:[a==="summary"&&jsx("div",{className:"space-y-3",children:Mue.map(({key:M,labelKey:_,multiline:E})=>jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:s(_)}),E?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[M]??"",onChange:R=>g(M,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[M]??"",onChange:R=>g(M,R.target.value)})]},M))}),a==="custom"&&jsx(AV,{customProperties:u,onUpdate:p}),a==="statistics"&&jsx(RV,{appProperties:{...r,company:h.company,manager:h.manager},onUpdateAppProperties:b,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:S,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:v,disabled:!y,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 ont(t){if(typeof document>"u")return false;try{return document.fonts.check(`12px "${t}"`)}catch{return false}}function NV({isOpen:t,embedFontsEnabled:e,usedFontFamilies:n,embeddedFonts:r,onClose:o,onToggleEmbedFonts:i}){let{t:s}=useTranslation(),[a,l]=useState(new Set),[c,d]=useState(false),[u,p]=useState(false),h=useCallback(async()=>{d(true);try{await document.fonts.ready;let x=new Set;for(let g of n)ont(g)&&x.add(g);l(x),p(!0);}catch{}finally{d(false);}},[n]);if(useEffect(()=>{t&&!u&&h();},[t,u,h]),!t)return null;let f=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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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 g=a.has(x),y=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:[y&&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")}),g?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)})})]}),f.length>0&&!c&&jsx("p",{className:"text-[11px] text-yellow-400/80",children:s("pptx.fonts.missingWarning",{count:f.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 DV({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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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 FV({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 OV({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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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 BV({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 max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",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}Pe();Pe();function bN(t){return UU(t).map(e=>e.kind==="break"?Qm.createElement("br",{key:e.key}):Qm.createElement("span",{key:e.key,style:e.style},e.text))}bt();function _nt({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 h=new ResizeObserver(f=>{let m=f[0];m&&s(m.contentRect.width);});return h.observe(p),()=>h.disconnect()},[]);let a=Math.max(n.width,1),l=Math.max(n.height,1),c=i>0?i/a:.2,d=Math.max(40,Math.round(l*c)),u=[...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:d},children:[t.backgroundColor&&t.backgroundColor!=="transparent"&&jsx("div",{className:"absolute inset-0",style:{backgroundColor:et(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:u.map(p=>{let h=Math.max(p.width,1),f=Math.max(p.height,1),m=Jt(p)?p.shapeStyle:void 0,x=m?.fillColor!==void 0&&m?.fillColor!=="transparent"||!!(Oc(m)||m?.fillGradient)||m?.fillMode==="pattern"&&!!m.fillPatternPreset,g=et(m?.fillColor,Ky),y=Math.max(0,m?.strokeWidth||0),b=et(m?.strokeColor,iu),v=au(p,x,g,y,b),S=du(p,x,g,y,b),w=p.type==="shape"&&x?"#ffffff":Di,C=lh(p,w),T=uu(p),M=nu(p),_=ze(p)?p.text:void 0,E=ze(p)?p.textSegments:void 0,R=typeof _=="string"&&_.trim().length>0||(E?.length??0)>0,I=ib(p,M)?ii(p):"";return jsx("div",{className:"absolute overflow-hidden",style:{left:p.x,top:p.y,width:h,height:f,transform:$l(p),transformOrigin:"center"},children:(p.type==="picture"||p.type==="image")&&(p.svgData||p.imageData)?zc(p)?jsx("div",{className:"pointer-events-none w-full h-full",style:pu(p)}):jsx("img",{src:p.svgData||p.imageData,alt:"",className:"pointer-events-none",style:T,draggable:false}):jsxs("div",{className:"relative w-full h-full overflow-hidden",style:v,children:[S,M&&R&&jsx("div",{className:"w-full h-full whitespace-pre-wrap break-words px-1 py-0.5 leading-[1.3]",style:{...zl(p),...C,transform:tu(p),transformOrigin:"center"},children:Wa(p,w)}),!R&&I.length>0&&jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground",children:I})]})},p.id)})})]})}function Pnt(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 ev=Qm.memo(_nt,Pnt);function $V({slides:t,currentSlideIndex:e,canvasSize:n,templateElements:r,presentationStartTime:o,onMovePresentationSlide:i,onExit:s,onOpenAudienceWindow:a,onCloseAudienceWindow:l,isAudienceWindowOpen:c}){let{t:d}=useTranslation(),[u,p]=useState(false);useEffect(()=>{let R=window.setTimeout(()=>p(true),300);return ()=>window.clearTimeout(R)},[]);let[h,f]=useState(Date.now());useEffect(()=>{let R=window.setInterval(()=>f(Date.now()),1e3);return ()=>window.clearInterval(R)},[]);let m=o?h-o:0,[x,g]=useState(OU),y=useCallback(()=>{g(R=>iR(R+oR));},[]),b=useCallback(()=>{g(R=>iR(R-oR));},[]),v=t[e],S=e+1<t.length?t[e+1]:void 0,w=v?.notes??"",C=v?.notesSegments,T=C&&C.length>0;if(!v)return jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-card text-muted-foreground",children:d("pptx.presenter.noSlides")});let M=300*1e3,_=Math.min(100,m%M/M*100),E=Math.floor(m/M);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(ev,{slide:v,templateElements:r,canvasSize:n}),jsx("div",{className:"mt-3 text-xs font-mono tabular-nums text-white/50 select-none",children:d("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:d("pptx.presenter.currentTime")}),jsx("span",{className:"text-lg font-mono tabular-nums text-foreground",children:BU(new Date(h))})]}),jsxs("div",{className:"flex flex-col items-end",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:d("pptx.presenter.elapsed")}),jsx("span",{className:"text-lg font-mono tabular-nums text-primary",children:Xy(m)})]}),jsxs("div",{className:"flex items-center gap-1",children:[a&&u&&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:d(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),"aria-label":d(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:d("pptx.presenter.endPresentation"),"aria-label":d("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:d("pptx.presenter.previousSlide"),children:[jsx(LuChevronLeft,{className:"w-4 h-4"}),d("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:d("pptx.presenter.nextSlide"),children:[d("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:d("pptx.presenter.nextSlidePreview")}),S?jsx(ev,{slide:S,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:d("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:d("pptx.presenter.speakerNotes")}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",onClick:b,disabled:x<=nR,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:d("pptx.presenter.decreaseFontSize"),"aria-label":d("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:y,disabled:x>=rR,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:d("pptx.presenter.increaseFontSize"),"aria-label":d("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:T?bN(C):w.trim().length>0?w:jsx("span",{className:"italic text-muted-foreground",children:d("pptx.presenter.noNotes")})})]})]})]}),jsx("div",{className:"h-1.5 w-full bg-muted/60 flex-shrink-0",role:"progressbar","aria-valuenow":Math.round(_),"aria-valuemin":0,"aria-valuemax":100,"aria-label":d("pptx.presenter.timerProgress"),title:`${Xy(m)} (segment ${E+1})`,children:jsx("div",{className:"h-full bg-primary transition-[width] duration-1000 ease-linear",style:{width:`${_}%`}})})]})}Pe();function HV({slides:t,currentSlideIndex:e,canvasSize:n,templateElements:r,presentationStartTime:o,onMovePresentationSlide:i,onExit:s}){let{t:a}=useTranslation(),[l,c]=useState(Date.now());useEffect(()=>{let b=window.setInterval(()=>c(Date.now()),1e3);return ()=>window.clearInterval(b)},[]);let d=zne(o,l),u=t[e],p=e+1<t.length?t[e+1]:void 0;if(!u)return jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-card text-muted-foreground",children:a("pptx.presenter.noSlides")});let h=u.notes??"",f=u.notesSegments,m=f&&f.length>0,x=$ne(e),g=Hne(e,t.length);return jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-card text-foreground",style:{paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"},children:[jsxs("div",{className:"flex items-center justify-between gap-2 px-4 py-2 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:a("pptx.presenter.elapsed")}),jsx("span",{className:"text-lg font-mono tabular-nums text-primary",children:Vne(d)})]}),jsx("span",{className:"text-sm font-mono tabular-nums text-foreground",children:Une(e,t.length)}),jsx("button",{type:"button",onClick:s,className:"flex items-center justify-center w-11 h-11 min-w-11 min-h-11 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:a("pptx.presenter.endPresentation"),"aria-label":a("pptx.presenter.endPresentation"),children:jsx(LuX,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex items-center justify-center bg-black px-3 py-3",children:jsx("div",{className:"w-full max-w-[640px]",children:jsx(ev,{slide:u,templateElements:r,canvasSize:n})})}),jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-border/60",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:a("pptx.presenter.nextSlidePreview")}),jsx("div",{className:"w-[132px] flex-shrink-0",children:p?jsx(ev,{slide:p,templateElements:r,canvasSize:n}):jsx("div",{className:"flex items-center justify-center h-12 rounded border border-border/30 bg-muted/40 text-[10px] text-muted-foreground italic",children:a("pptx.presenter.endOfPresentation")})})]}),jsxs("div",{className:"flex-1 flex flex-col min-h-0 px-4 py-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-1",children:a("pptx.presenter.speakerNotes")}),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 text-[15px]",children:m?bN(f):h.trim().length>0?h:jsx("span",{className:"italic text-muted-foreground",children:a("pptx.presenter.noNotes")})})]}),jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2 border-t border-border/60",children:[jsxs("button",{type:"button",onClick:()=>i(-1),disabled:x,className:"inline-flex items-center justify-center gap-1.5 flex-1 h-11 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-sm transition-colors",title:a("pptx.presenter.previousSlide"),"aria-label":a("pptx.presenter.previousSlide"),children:[jsx(LuChevronLeft,{className:"w-5 h-5"}),a("pptx.presenter.prev")]}),jsxs("button",{type:"button",onClick:()=>i(1),disabled:g,className:"inline-flex items-center justify-center gap-1.5 flex-1 h-11 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-sm transition-colors",title:a("pptx.presenter.nextSlide"),"aria-label":a("pptx.presenter.nextSlide"),children:[a("pptx.presenter.next"),jsx(LuChevronRight,{className:"w-5 h-5"})]})]})]})}function Nue(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 VV({presentationStartTime:t,slideStartTime:e,paused:n,onTogglePause:r}){let{t:o}=useTranslation(),[i,s]=useState(0);useEffect(()=>{if(n)return;let d=window.setInterval(()=>s(u=>u+1),250);return ()=>window.clearInterval(d)},[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:Nue(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:Nue(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 Lue(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 GV({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:Lue(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 d=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:d&&jsx("div",{className:"w-20 rounded overflow-hidden bg-white",children:jsx(oa,{slide:d,templateElements:[],canvasSize:e})})}),jsx("td",{className:"py-2 text-right font-mono text-foreground tabular-nums",children:Lue(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")})]})]})})}bt();function Qnt(t,e){return ze(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 XV({slides:t,activeSlideIndex:e,selectedElementId:n,selectedElementIds:r,canEdit:o,setSelectedElementId:i,setSelectedElementIds:s,setSlides:a,markDirty:l,onClose:c}){let{t:d}=useTranslation(),p=t[e]?.elements??[],[h,f]=useState(null),[m,x]=useState(""),g=useRef(null),[y,b]=useState(null),[v,S]=useState(null),w=useCallback(L=>{i(L),s([L]);},[i,s]),C=useCallback(L=>{a(k=>{let F=[...k],N=F[e];if(!N)return k;let D=[...N.elements??[]],U=D.findIndex(G=>G.id===L);return U===-1?k:(D[U]={...D[U],hidden:!D[U].hidden},F[e]={...N,elements:D},F)}),l();},[e,a,l]),T=useCallback((L,k)=>{o&&(f(L.id),x(k),setTimeout(()=>g.current?.select(),0));},[o]),M=useCallback(()=>{f(null);},[]),_=useCallback(L=>{b(L);},[]),E=useCallback((L,k)=>{L.preventDefault(),y!==null&&y!==k&&S(k);},[y]),R=useCallback(L=>{if(y===null||y===L){b(null),S(null);return}a(k=>{let F=[...k],N=F[e];if(!N)return k;let D=[...N.elements??[]],[U]=D.splice(y,1);return D.splice(L,0,U),F[e]={...N,elements:D},F}),l(),b(null),S(null);},[y,e,a,l]),I=[...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:d("pptx.selectionPane.title")}),jsx("button",{type:"button",onClick:c,className:"text-muted-foreground hover:text-foreground text-xs",title:d("pptx.selectionPane.close"),children:"\xD7"})]}),jsx("div",{className:"flex-1 overflow-y-auto py-1",children:I.length===0?jsx("div",{className:"px-3 py-4 text-xs text-muted-foreground italic",children:d("pptx.selectionPane.empty")}):I.map((L,k)=>{let F=p.length-1-k,N=n===L.id||r.includes(L.id),D=Qnt(L,F),U=h===L.id;return jsxs("div",{draggable:o,onDragStart:()=>_(F),onDragOver:G=>E(G,F),onDrop:()=>R(F),onDragEnd:()=>{b(null),S(null);},className:ie("flex items-center gap-1.5 px-2 py-1 text-xs cursor-pointer transition-colors",N?"bg-primary/30 text-primary":"hover:bg-muted text-foreground",v===F?"border-t-2 border-primary":""),onClick:()=>w(L.id),onDoubleClick:()=>T(L,D),children:[o&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground flex-shrink-0 cursor-grab"}),jsx("span",{className:"flex-1 truncate",children:U?jsx("input",{ref:g,type:"text",value:m,onChange:G=>x(G.target.value),onBlur:M,onKeyDown:G=>{G.key==="Enter"&&M(),G.key==="Escape"&&f(null);},className:"w-full bg-muted text-xs px-1 py-0.5 rounded border border-border outline-none",onClick:G=>G.stopPropagation()}):D}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex-shrink-0",title:L.hidden?d("pptx.selectionPane.show"):d("pptx.selectionPane.hide"),onClick:G=>{G.stopPropagation(),C(L.id);},children:L.hidden?jsx(LuEyeOff,{className:"w-3.5 h-3.5"}):jsx(LuEye,{className:"w-3.5 h-3.5 opacity-50"})})]},L.id)})})]})}var Uue="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",fr=`${Uue} border-r border-border hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Jo=`${Uue} hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,to="inline-flex items-center rounded bg-muted text-xs overflow-hidden",Be="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",qt=jsx("div",{className:"w-px self-stretch bg-border/40 mx-1 max-md:hidden"}),Ne="w-4 h-4",Gn="w-3.5 h-3.5";var $ue=[{k:"left",el:jsx(LuAlignLeft,{className:Ne})},{k:"center",el:jsx(LuAlignCenter,{className:Ne})},{k:"right",el:jsx(LuAlignRight,{className:Ne})},{k:"top",el:jsx(LuChevronUp,{className:Ne})},{k:"middle",el:jsx(LuAlignCenter,{className:`${Ne} rotate-90`})},{k:"bottom",el:jsx(LuChevronDown,{className:Ne})}],Hue=[{k:"horizontal",el:jsx(LuAlignHorizontalSpaceAround,{className:Ne})},{k:"vertical",el:jsx(LuAlignVerticalSpaceAround,{className:Ne})}],zue=[{id:"select",icon:jsx(LuMoveRight,{className:Ne}),labelKey:"pptx.ribbon.tool.select",ac:"bg-primary text-white"},{id:"pen",icon:jsx(LuPencil,{className:Ne}),labelKey:"pptx.ribbon.tool.pen",ac:"bg-primary text-white"},{id:"highlighter",icon:jsx(LuType,{className:Ne}),labelKey:"pptx.ribbon.tool.highlighter",ac:"bg-yellow-600 text-white"},{id:"eraser",icon:jsx(LuMinus,{className:Ne}),labelKey:"pptx.ribbon.tool.eraser",ac:"bg-red-600 text-white"},{id:"freeform",icon:jsx(LuSpline,{className:Ne}),labelKey:"pptx.ribbon.tool.freeform",ac:"bg-primary text-white"}],Vue=[{k:"png",labelKey:"pptx.ribbon.exportPng",i:jsx(LuDownload,{className:`${Gn} text-muted-foreground`})},{k:"pdf",labelKey:"pptx.ribbon.exportPdf",i:jsx(LuFileText,{className:`${Gn} text-muted-foreground`})},{k:"video",labelKey:"pptx.ribbon.exportVideo",i:jsx(LuVideo,{className:`${Gn} text-muted-foreground`})},{k:"gif",labelKey:"pptx.ribbon.exportGif",i:jsx(LuImage,{className:`${Gn} text-muted-foreground`})},{k:"package",labelKey:"pptx.file.packageTooltip",i:jsx(LuFolderOpen,{className:`${Gn} text-muted-foreground`})},{k:"pptx",labelKey:"pptx.file.saveAsPptxTooltip",i:jsx(LuDownload,{className:`${Gn} text-muted-foreground`})},{k:"ppsx",labelKey:"pptx.file.saveAsPpsxTooltip",i:jsx(LuPlay,{className:`${Gn} text-muted-foreground`})},{k:"pptm",labelKey:"pptx.file.saveAsPptmTooltip",i:jsx(LuDatabase,{className:`${Gn} text-muted-foreground`})},{k:"---0",labelKey:"",i:null},{k:"print",labelKey:"pptx.print.printButton",i:jsx(LuPrinter,{className:`${Gn} text-muted-foreground`})},{k:"copyImg",labelKey:"pptx.file.copyImageTooltip",i:jsx(LuCopy,{className:`${Gn} text-muted-foreground`})},{k:"---",labelKey:"",i:null},{k:"a11y",labelKey:"pptx.ribbon.accessibilityCheck",i:jsx(LuCheck,{className:`${Gn} text-muted-foreground`})},{k:"shortcuts",labelKey:"pptx.settings.keyboardShortcuts",i:jsx(LuSearch,{className:`${Gn} text-muted-foreground`})},{k:"---2",labelKey:"",i:null},{k:"versionHistory",labelKey:"pptx.ribbon.versionHistory",i:jsx(LuClock,{className:`${Gn} text-muted-foreground`})},{k:"---3",labelKey:"",i:null},{k:"documentProperties",labelKey:"pptx.ribbon.documentProperties",i:jsx(LuInfo,{className:`${Gn} text-muted-foreground`})},{k:"passwordProtection",labelKey:"pptx.security.protectPresentation",i:jsx(LuLock,{className:`${Gn} text-muted-foreground`})},{k:"fontEmbedding",labelKey:"pptx.ribbon.embedFonts",i:jsx(LuType,{className:`${Gn} text-muted-foreground`})},{k:"digitalSignatures",labelKey:"pptx.viewer.digitalSignatures",i:jsx(LuShieldAlert,{className:`${Gn} text-muted-foreground`})}],Gue=[{id:"bold",i:jsx(LuBold,{className:Ne}),labelKey:"pptx.textPanel.bold"},{id:"italic",i:jsx(LuItalic,{className:Ne}),labelKey:"pptx.textPanel.italic"},{id:"underline",i:jsx(LuUnderline,{className:Ne}),labelKey:"pptx.textPanel.underline"},{id:"strikethrough",i:jsx(LuStrikethrough,{className:Ne}),labelKey:"pptx.textPanel.strikethrough"}],Wue=[{id:"left",i:jsx(LuAlignLeft,{className:Ne}),labelKey:"pptx.ribbon.alignLeft"},{id:"center",i:jsx(LuAlignCenter,{className:Ne}),labelKey:"pptx.ribbon.alignCenter"},{id:"right",i:jsx(LuAlignRight,{className:Ne}),labelKey:"pptx.ribbon.alignRight"},{id:"justify",i:jsx(LuAlignJustify,{className:Ne}),labelKey:"pptx.ribbon.justify"}];var Drt=[{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 SN(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:ie(Be,n?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.previewTooltip"),children:[jsx(LuPlay,{className:Ne}),e("pptx.animations.preview")]}),qt,jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:i,className:Be,title:e("pptx.animations.addTooltip"),children:[jsx(LuSparkles,{className:Ne}),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:Drt.map(a=>jsxs(Qm.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))})})]}),qt,jsxs("button",{type:"button",disabled:i,onClick:t.onRemoveAnimation,className:Be,title:e("pptx.animations.removeTooltip"),children:[jsx(LuTrash2,{className:Ne}),e("pptx.animations.remove")]}),qt,jsxs("button",{type:"button",onClick:t.onOpenAnimationPanel??t.onToggleInspector,className:ie(Be,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.openPanelTooltip"),children:[jsx(LuPanelRight,{className:Ne}),e("pptx.animations.animationPanel")]})]})}function wN(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit;return jsxs(Fragment,{children:[jsx("div",{className:to,children:$ue.map((o,i,s)=>jsx("button",{type:"button",onClick:()=>t.onAlignElements(o.k),disabled:!r,className:i<s.length-1?fr:Jo,title:e("pptx.arrange.align",{direction:o.k}),children:o.el},o.k))}),jsx("div",{className:to,children:Hue.map((o,i,s)=>jsx("button",{type:"button",onClick:()=>t.onDistributeElements(o.k),disabled:!t.canEdit||!t.canDistribute,className:i<s.length-1?fr:Jo,title:e(`pptx.arrange.distribute${o.k.charAt(0).toUpperCase()}${o.k.slice(1)}`),children:o.el},o.k))}),jsxs("div",{className:to,children:[jsx("button",{onClick:t.onCopy,disabled:!n,className:fr,title:e("pptx.arrange.copy"),children:jsx(LuCopy,{className:Ne})}),jsx("button",{onClick:t.onCut,disabled:!r,className:fr,title:e("pptx.arrange.cut"),children:e("pptx.arrange.cut")}),jsx("button",{onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Jo,title:e("pptx.arrange.paste"),children:jsx(LuClipboardPaste,{className:Ne})})]}),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:ie(Be,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:e("pptx.arrange.formatPainter"),children:[jsx(LuPaintbrush,{className:Ne}),e("pptx.arrange.format")]}),jsxs("div",{className:to,children:[jsx("button",{type:"button",onClick:()=>t.onFlip("horizontal"),disabled:!r,className:fr,title:e("pptx.arrange.flipHorizontally"),children:e("pptx.arrange.flipH")}),jsx("button",{type:"button",onClick:()=>t.onFlip("vertical"),disabled:!r,className:Jo,title:e("pptx.arrange.flipVertically"),children:e("pptx.arrange.flipV")})]}),jsxs("div",{className:to,children:[jsx("button",{onClick:()=>t.onMoveLayer("backward"),disabled:!r,className:fr,title:e("pptx.arrange.sendBackward"),children:jsx(LuChevronDown,{className:Ne})}),jsx("button",{onClick:()=>t.onMoveLayer("forward"),disabled:!r,className:fr,title:e("pptx.arrange.bringForward"),children:jsx(LuChevronUp,{className:Ne})}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("back"),disabled:!r,className:fr,title:e("pptx.arrange.sendToBack"),children:e("pptx.arrange.back")}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("front"),disabled:!r,className:Jo,title:e("pptx.arrange.bringToFront"),children:e("pptx.arrange.front")})]}),jsxs("button",{onClick:t.onDuplicate,disabled:!r,className:Be,title:e("pptx.arrange.duplicate"),children:[jsx(LuCopy,{className:Ne}),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:Ne}),e("pptx.arrange.delete")]})]})}function TN(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onToggleThemeGallery,disabled:!t.canEdit,className:ie(Be,t.isThemeGalleryOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Browse and apply built-in themes",children:[jsx(LuPalette,{className:Gn}),"Browse Themes"]}),jsxs("button",{onClick:t.onToggleThemeEditor,disabled:!t.canEdit,className:ie(Be,t.isThemeEditorOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Edit presentation theme colors and fonts",children:[jsx(LuPencil,{className:Gn}),"Edit Theme"]}),qt,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:Be,title:"Change slide dimensions (16:9, 4:3, custom)",children:[jsx(LuMonitor,{className:Gn}),"Slide Size"]}),t.onToggleInspector&&jsxs("button",{onClick:t.onToggleInspector,className:ie(Be,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open inspector to edit slide background",children:[jsx(LuPaintBucket,{className:Gn}),"Format Background"]})]})}var eot=[{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 CN(t){let[e,n]=Qm.useState("none"),[r,o]=Qm.useState("00.50");return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:Be,title:"Preview transition",children:[jsx(LuPlay,{className:Gn}),"Preview"]}),qt,jsx("div",{className:"inline-flex items-center gap-0.5 overflow-x-auto max-w-[420px]",children:eot.map(i=>jsx("button",{type:"button",onClick:()=>n(i.value),className:ie("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))}),qt,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"})]}),qt,jsxs("button",{type:"button",className:Be,title:"Apply transition to all slides",children:[jsx(LuCopy,{className:Gn}),"Apply to All"]}),qt,jsxs("button",{type:"button",onClick:t.onToggleInspector,className:ie(Be,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open Inspector for full transition options",children:[jsx(LuPanelRight,{className:Ne}),"Inspector"]})]})}function MN(t){return jsxs(Fragment,{children:[t.onToggleComments&&jsxs("button",{onClick:t.onToggleComments,className:ie(Be,t.isCommentsPanelOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle comments panel",children:[jsx(LuMessageSquare,{className:Ne}),"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:ie(Be,t.spellCheckEnabled?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle spell check",children:[jsx(LuSpellCheck,{className:Ne}),"Spelling"]}),t.onCompare&&jsxs("button",{onClick:t.onCompare,disabled:!t.canEdit,className:Be,title:"Compare with another presentation",children:[jsx(LuGitCompare,{className:Ne}),"Compare"]})]})}function PN(t){let{t:e}=useTranslation();return jsxs(Fragment,{children:[jsx("div",{className:to,children:zue.map((n,r,o)=>jsx("button",{type:"button",onClick:()=>t.onSetActiveTool(n.id),className:ie(r<o.length-1?fr:Jo,t.activeTool===n.id?n.ac??"bg-accent text-foreground":""),title:e(n.labelKey),children:n.icon},n.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:e("pptx.ribbon.penColour"),children:[e("pptx.ribbon.colour"),jsx("input",{type:"color",value:t.drawingColor,onChange:n=>t.onSetDrawingColor(n.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:e("pptx.ribbon.strokeWidth"),children:[e("pptx.ribbon.width"),jsx("input",{type:"range",min:1,max:12,value:t.drawingWidth,onChange:n=>t.onSetDrawingWidth(Number(n.target.value)),className:"w-16 h-1 accent-primary"}),jsx("span",{className:"text-foreground w-4 text-right",children:t.drawingWidth})]})]})]})}function EN(t){return jsxs(Fragment,{children:[t.onOpenFile&&jsxs(Fragment,{children:[jsxs("button",{onClick:t.onOpenFile,className:Be,title:"Open another presentation",children:[jsx(LuFolderOpen,{className:Ne}),"Open"]}),qt]}),jsxs("button",{onClick:t.onSaveAsPptx,className:Be,title:"Save as Presentation (.pptx)",children:[jsx(LuDownload,{className:Ne}),"Save .pptx"]}),jsxs("button",{onClick:t.onSaveAsPpsx,className:Be,title:"Save as Slide Show (.ppsx)",children:[jsx(LuPlay,{className:Ne}),"Save .ppsx"]}),t.hasMacros&&jsxs("button",{onClick:t.onSaveAsPptm,className:Be,title:"Save as Macro-Enabled (.pptm)",children:[jsx(LuFileText,{className:Ne}),"Save .pptm"]}),jsxs("button",{onClick:t.onPackageForSharing,className:Be,title:"Package for Sharing",children:[jsx(LuPackage,{className:Ne}),"Package"]}),qt,jsxs("button",{onClick:t.onExportPng,className:Be,title:"Export as PNG",children:[jsx(LuDownload,{className:Ne}),"PNG"]}),jsxs("button",{onClick:t.onExportPdf,className:Be,title:"Export as PDF",children:[jsx(LuFileText,{className:Ne}),"PDF"]}),jsxs("button",{onClick:t.onExportVideo,className:Be,title:"Export as Video",children:[jsx(LuVideo,{className:Ne}),"Video"]}),jsxs("button",{onClick:t.onExportGif,className:Be,title:"Export as GIF",children:[jsx(LuImage,{className:Ne}),"GIF"]}),jsxs("button",{onClick:t.onCopySlideAsImage,className:Be,title:"Copy Slide as Image",children:[jsx(LuCopy,{className:Ne}),"Copy Image"]}),qt,jsxs("button",{onClick:t.onPrint,className:Be,title:"Print",children:[jsx(LuPrinter,{className:Ne}),"Print"]}),qt,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:Be,title:"Document Properties",children:[jsx(LuInfo,{className:Ne}),"Properties"]}),t.onOpenPasswordProtection&&jsxs("button",{onClick:t.onOpenPasswordProtection,className:Be,title:"Protect Presentation",children:[jsx(LuLock,{className:Ne}),"Protect"]}),t.onOpenFontEmbedding&&jsxs("button",{onClick:t.onOpenFontEmbedding,className:Be,title:"Embed Fonts",children:[jsx(LuType,{className:Ne}),"Fonts"]}),t.onOpenDigitalSignatures&&jsxs("button",{onClick:t.onOpenDigitalSignatures,className:Be,title:"Digital Signatures",children:[jsx(LuShieldAlert,{className:Ne}),"Signatures"]})]})}bt();function epe(t){let[e,n]=useState(false),[r,o]=useState(false),i=useRef(null),s=useRef(null),a=useCallback(()=>{if(t.layoutOptions.length>0){let l=t.layoutOptions[0];t.onInsertSlideFromLayout(l.path,l.name);}},[t]);return useEffect(()=>{if(!e)return;let l=c=>{i.current&&!i.current.contains(c.target)&&n(false);};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e]),useEffect(()=>{if(!r)return;let l=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]),jsxs(Fragment,{children:[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 inline-flex items-center",ref:i,children:[jsxs("button",{type:"button",onClick:a,disabled:!t.canEdit||t.layoutOptions.length===0,className:ie(Be,"whitespace-nowrap",t.layoutOptions.length>0?"rounded-r-none":""),title:"New Slide",children:[jsx(LuPlus,{className:Ne}),"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(l=>!l),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(l=>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(l.path,l.name),n(false);},children:l.name},l.path))})})]}),jsxs("div",{className:"relative inline-flex items-center",ref:s,children:[jsxs("button",{type:"button",disabled:!t.canEdit||t.layoutOptions.length===0,className:Be,title:"Layout",onClick:()=>o(l=>!l),children:[jsx(LuLayoutGrid,{className:Ne}),"Layout"]}),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:t.layoutOptions.map(l=>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.onApplyLayout?.(l.path),o(false);},children:l.name},l.path))})})]}),jsxs("button",{type:"button",disabled:!t.canEdit,className:Be,title:"Reset Slide",onClick:t.onResetSlide,children:[jsx(LuRotateCcw,{className:Ne}),"Reset"]}),jsxs("button",{type:"button",disabled:!t.canEdit,className:Be,title:"Add Section",onClick:t.onAddSection,children:[jsx(LuFolderPlus,{className:Ne}),"Section"]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Slides"})]}),qt]})}function Mot(t){let e={fontFamily:"Segoe UI",fontSize:"24"};if(!t||!ze(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 _ot=["Arial","Calibri","Cambria","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana"],Pot=[8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,72,96];function RN(t){let[e,n]=useState(false),[r,o]=useState(false),[i,s]=useState(false),[a,l]=useState(false),c=useRef(null),d=useRef(null),{fontFamily:u,fontSize:p}=Mot(t.selectedElement);return useEffect(()=>{if(!e)return;let h=f=>{c.current&&!c.current.contains(f.target)&&n(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[e]),useEffect(()=>{if(!r)return;let h=f=>{d.current&&!d.current.contains(f.target)&&o(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:to,children:[jsx("button",{type:"button",onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:fr,title:"Paste",children:jsx(LuClipboardPaste,{className:Ne})}),jsx("button",{type:"button",onClick:()=>{t.onCut(),l(true),setTimeout(()=>l(false),600);},disabled:!t.canEdit,className:ie(fr,a&&"bg-green-600/20 text-green-400"),title:"Cut",children:jsx(LuScissors,{className:Ne})}),jsx("button",{type:"button",onClick:()=>{t.onCopy(),s(true),setTimeout(()=>s(false),600);},className:ie(fr,i&&"bg-green-600/20 text-green-400"),title:"Copy",children:jsx(LuCopy,{className:Ne})}),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:ie(Jo,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Format Painter",children:jsx(LuPaintbrush,{className:Ne})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Clipboard"})]}),qt,jsx(epe,{canEdit:t.canEdit,layoutOptions:t.layoutOptions,onInsertSlideFromLayout:t.onInsertSlideFromLayout,onApplyLayout:t.onApplyLayout,onResetSlide:t.onResetSlide,onAddSection:t.onAddSection}),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:c,children:[jsxs("button",{type:"button",onClick:()=>n(h=>!h),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:u}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),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:_ot.map(h=>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:h},onClick:()=>{t.onUpdateTextStyle?.({fontFamily:h}),n(false);},children:h},h))})})]}),jsxs("div",{className:"relative",ref:d,children:[jsxs("button",{type:"button",onClick:()=>o(h=>!h),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:p}),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:Pot.map(h=>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:h}),o(false);},children:h},h))})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),qt]})}Pe();function IN(t){let{t:e}=useTranslation(),{canEdit:n}=t,[r,o]=useState(false),[i,s]=useState(""),[a,l]=useState("locale"),[c,d]=useState(a$),u=useRef(null),p=useCallback(()=>{let f=new Date,m=x=>String(x).padStart(2,"0");s(`${f.getFullYear()}-${m(f.getMonth()+1)}-${m(f.getDate())}T${m(f.getHours())}:${m(f.getMinutes())}`),l("locale"),o(true);},[]),h=useCallback(()=>{if(!t.onInsertField)return;let f=new Date(i);if(isNaN(f.getTime()))return;let m;switch(a){case "iso":m=f.toISOString().slice(0,10);break;case "long":m=f.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"});break;case "short":m=f.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});break;case "time":m=f.toLocaleString();break;default:m=f.toLocaleDateString();break}t.onInsertField("datetime",m),o(false);},[i,a,t]);return useEffect(()=>{if(!r)return;let f=m=>{u.current&&!u.current.contains(m.target)&&o(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),jsxs(Fragment,{children:[jsxs("button",{onClick:t.onAddTextBox,disabled:!n,className:Be,title:"Add text box",children:[jsx(LuType,{className:Ne}),"Text"]}),jsxs("div",{className:to,children:[jsx("select",{value:t.newShapeType,onChange:f=>t.onSetNewShapeType(f.target.value),className:"bg-transparent py-1.5 pl-2 pr-1 outline-none text-xs",title:"Shape type",children:Um.map(f=>jsx("option",{value:f.type,className:"bg-background",children:f.label},f.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:[Um.find(f=>f.type===t.newShapeType)?.icon||jsx(LuSquare,{className:Ne}),"Shape"]})]}),jsxs("button",{onClick:t.onOpenImagePicker,disabled:!n,className:Be,title:"Insert image",children:[jsx(LuImage,{className:Ne}),"Image"]}),jsxs("button",{onClick:t.onOpenMediaPicker,disabled:!n,className:Be,title:"Insert audio or video",children:[jsx(LuVideo,{className:Ne}),"Media"]}),jsxs("button",{onClick:t.onAddTable,disabled:!n,className:Be,title:"Insert table",children:[jsx(LuDatabase,{className:Ne}),"Table"]}),t.onAddChart&&jsxs("div",{className:to,children:[jsx("select",{value:c,onChange:f=>d(f.target.value),className:"bg-transparent py-1.5 pl-2 pr-1 outline-none text-xs",title:"Chart type",children:lre.map(f=>jsx("option",{value:f.type,className:"bg-background",children:f.label},f.type))}),jsxs("button",{onClick:()=>t.onAddChart(c),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:"Insert chart",children:[jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M3 3v18h18"}),jsx("rect",{x:"7",y:"11",width:"3",height:"6"}),jsx("rect",{x:"12",y:"7",width:"3",height:"10"}),jsx("rect",{x:"17",y:"13",width:"3",height:"4"})]}),"Chart"]})]}),jsxs("button",{onClick:t.onAddSmartArt,disabled:!n,className:Be,title:"Insert SmartArt",children:[jsx(LuLayers,{className:Ne}),"SmartArt"]}),jsxs("button",{onClick:t.onAddEquation,disabled:!n,className:Be,title:"Insert Equation",children:[jsx("svg",{className:Ne,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:Be,title:"Insert action button",children:[jsxs("svg",{className:Ne,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:sh.map(f=>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(f.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:f.iconPath})}),f.label]},f.shapeType))})})]}),t.onInsertField&&jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:Be,title:e("pptx.field.insertField"),children:[jsxs("svg",{className:Ne,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:p,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:u,className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/30",onMouseDown:f=>{f.target===f.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:f=>s(f.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:f=>l(f.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:h,children:e("pptx.common.insert","Insert")})]})]})})]})}function NN(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:()=>t.onSetMode("present"),className:Be,title:"Start slide show from beginning",children:[jsx(LuPlay,{className:Ne}),"From Beginning"]}),jsxs("button",{onClick:t.onPresent,className:Be,title:"Start slide show from current slide",children:[jsx(LuPlay,{className:Ne}),"From Current Slide"]}),qt,jsxs("button",{onClick:t.onEnterPresenterView,className:Be,title:"Presenter view",children:[jsx(LuMonitor,{className:Ne}),"Presenter View"]}),jsxs("button",{onClick:t.onEnterRehearsalMode,className:Be,title:"Rehearse timings",children:[jsx(LuClock,{className:Ne}),"Rehearse Timings"]}),qt,jsxs("button",{onClick:t.onOpenSetUpSlideShow,className:Be,title:"Set up slide show",children:[jsx(LuSettings,{className:Ne}),"Set Up Slide Show"]}),jsxs("button",{onClick:t.onOpenBroadcastDialog,className:Be,title:"Broadcast slide show",children:[jsx(LuCast,{className:Ne}),"Broadcast"]}),qt,jsxs("button",{onClick:t.onToggleSubtitles,className:ie(Be,t.showSubtitles?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle subtitles",children:[jsx(LuCaptions,{className:Ne}),"Subtitles"]})]})}bt();var jot=[{label:"1.0",value:1},{label:"1.15",value:1.15},{label:"1.5",value:1.5},{label:"2.0",value:2},{label:"2.5",value:2.5},{label:"3.0",value:3}],Yot=[{label:"Horizontal",value:"horizontal"},{label:"Rotate 90\xB0",value:"vertical"},{label:"Rotate 270\xB0",value:"vertical270"},{label:"Stacked",value:"wordArtVert"}],Kot=[{label:"1 Column",value:1},{label:"2 Columns",value:2},{label:"3 Columns",value:3}];function ZV(t,e,n){useEffect(()=>{if(!e)return;let r=o=>{t.current&&!t.current.contains(o.target)&&n(false);};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t,n]);}function ape(t){let[e,n]=useState(false),r=useRef(null);return ZV(r,e,n),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",disabled:!t.canMut,onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Line Spacing","aria-label":"Line Spacing",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"5",y1:"5",x2:"19",y2:"5"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),jsx("line",{x1:"5",y1:"19",x2:"19",y2:"19"}),jsx("path",{d:"M2 8 L2 3 M2 3 L3.5 4.5 M2 3 L0.5 4.5"}),jsx("path",{d:"M2 16 L2 21 M2 21 L3.5 19.5 M2 21 L0.5 19.5"})]})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-28",children:jot.map(o=>jsxs("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:i=>i.preventDefault(),onClick:()=>{t.canFormat&&(t.onUpdateTextStyle({lineSpacing:o.value}),n(false));},children:[o.label,t.effectiveTs?.lineSpacing===o.value&&jsx("span",{className:"ml-auto text-primary",children:"\u2022"})]},o.value))})})]})}function lpe(t){let[e,n]=useState(false),r=useRef(null);return ZV(r,e,n),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",disabled:!t.canMut,onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Text Direction","aria-label":"Text Direction",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("text",{x:"3",y:"16",fontSize:"12",fill:"currentColor",stroke:"none",children:"A"}),jsx("path",{d:"M18 6 C21 6 21 10 18 10"}),jsx("path",{d:"M18 10 L19.5 8.5 M18 10 L16.5 8.5"})]})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-36",children:Yot.map(o=>jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:i=>i.preventDefault(),onClick:()=>{t.canFormat&&(t.onUpdateTextStyle({textDirection:o.value}),n(false));},children:o.label},o.value))})})]})}function cpe(t){let[e,n]=useState(false),r=useRef(null);return ZV(r,e,n),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",disabled:!t.canMut,onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Columns",children:jsx(LuColumns3,{className:Ne})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-28",children:Kot.map(o=>jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:i=>i.preventDefault(),onClick:()=>{t.canFormat&&(t.onUpdateTextStyle({columnCount:o.value}),n(false));},children:o.label},o.value))})})]})}function iit(t,e){if(t){if(ze(t))return t.textStyle;if(t.type==="table"&&e&&t.tableData)return t.tableData.rows[e.rowIndex]?.cells[e.columnIndex]?.style}}var sit=["#000000","#ffffff","#ff0000","#00aa00","#0000ff","#ff8800","#8800cc","#00cccc","#ff69b4","#808080"],ait=["#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff","#ff0000","#000080","#008080","#008000","#800080"];function LN(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit,o=n&&t.selectedElement!==null&&ze(t.selectedElement),i=n&&t.selectedElement?.type==="table",s=o||i,a=iit(t.selectedElement,t.tableEditorState),l=o&&t.selectedElement&&ze(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.color??t.selectedElement.textStyle?.color??"#000000":a?.color??"#000000",c=o&&t.selectedElement&&ze(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.highlightColor??t.selectedElement.textStyle?.highlightColor??"#ffff00":"#ffff00",d=useRef(null),u=useRef(null),p=useCallback(f=>{s&&t.onUpdateTextStyle({color:f});},[s,t]),h=useCallback(f=>{s&&t.onUpdateTextStyle({highlightColor:f});},[s,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:to,children:Gue.map((f,m,x)=>jsx("button",{type:"button",disabled:!r,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let y=a;switch(f.id){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:m<x.length-1?fr:Jo,title:e(f.labelKey),children:f.i},f.id))}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s)return;let f=!!a?.textShadowColor;t.onUpdateTextStyle(f?{textShadowColor:void 0,textShadowBlur:void 0,textShadowOffsetX:void 0,textShadowOffsetY:void 0}:{textShadowColor:"#000000",textShadowBlur:2,textShadowOffsetX:1,textShadowOffsetY:1,textShadowOpacity:.5});},className:Be,title:"Text Shadow","aria-label":"Text Shadow",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("text",{x:"6",y:"17",fontSize:"16",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"S"}),jsx("text",{x:"7.5",y:"18.5",fontSize:"16",fontWeight:"bold",fill:"none",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.4",children:"S"})]})}),jsxs("div",{className:to,children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.fontSize??18;t.onUpdateTextStyle({fontSize:f+2});},className:fr,title:"Increase Font Size",children:jsx(LuAArrowUp,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.fontSize??18;t.onUpdateTextStyle({fontSize:Math.max(1,f-2)});},className:fr,title:"Decrease Font Size",children:jsx(LuAArrowDown,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{s&&t.onUpdateTextStyle({bold:false,italic:false,underline:false,strikethrough:false,highlightColor:void 0});},className:Jo,title:"Clear Formatting",children:jsx(LuRemoveFormatting,{className:Ne})})]}),jsxs("div",{className:"relative group",children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),className:Be,title:"Character Spacing","aria-label":"Character Spacing",children:jsxs("svg",{className:Ne,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("text",{x:"4",y:"16",fontSize:"11",fontWeight:"bold",fill:"currentColor",stroke:"none",children:"AV"}),jsx("path",{d:"M3 20 L1 20 M3 20 L5 20",strokeWidth:"1.5"}),jsx("path",{d:"M21 20 L19 20 M21 20 L23 20",strokeWidth:"1.5"})]})}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-32",children:[{label:"Very Tight",value:-150},{label:"Tight",value:-75},{label:"Normal",value:0},{label:"Loose",value:75},{label:"Very Loose",value:150}].map(f=>jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:m=>m.preventDefault(),onClick:()=>{s&&t.onUpdateTextStyle({characterSpacing:f.value});},children:f.label},f.label))})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),className:Be,title:"Font Color","aria-label":"Font Color",children:[jsx("svg",{className:Ne,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: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:sit.map(f=>jsx("button",{type:"button","aria-label":f,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:m=>m.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:()=>d.current?.click(),children:"Custom colour..."}),jsx("input",{ref:d,type:"color",className:"sr-only",value:l,onChange:f=>p(f.target.value)})]})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),className:Be,title:"Text Highlight Color","aria-label":"Text Highlight Color",children:[jsx(LuHighlighter,{className:Ne}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:c}})]}),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:ait.map(f=>jsx("button",{type:"button","aria-label":f,className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${c?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:m=>m.preventDefault(),onClick:()=>h(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:c,onChange:f=>h(f.target.value)})]})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),qt,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:to,children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{!s||!t.selectedElement||t.onUpdateTextStyle({listType:a?.listType==="bullet"?"none":"bullet"});},className:fr,title:"Bullet List",children:jsx(LuList,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{!s||!t.selectedElement||t.onUpdateTextStyle({listType:a?.listType==="numbered"?"none":"numbered"});},className:Jo,title:"Numbered List",children:jsx(LuListOrdered,{className:Ne})})]}),jsxs("div",{className:to,children:[jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:Math.max(0,f-24)});},className:fr,title:"Decrease Indent",children:jsx(LuIndentDecrease,{className:Ne})}),jsx("button",{type:"button",disabled:!r,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!s||!t.selectedElement)return;let f=a?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:f+24});},className:Jo,title:"Increase Indent",children:jsx(LuIndentIncrease,{className:Ne})})]}),jsx("div",{className:to,children:Wue.map((f,m,x)=>jsx("button",{type:"button",disabled:!r,onMouseDown:y=>y.preventDefault(),onClick:()=>{s&&t.onUpdateTextStyle({align:f.id});},className:m<x.length-1?fr:Jo,title:e(f.labelKey),children:f.i},f.id))}),jsx(ape,{canMut:r,canFormat:s,effectiveTs:a,onUpdateTextStyle:t.onUpdateTextStyle}),jsx(lpe,{canMut:r,canFormat:s,onUpdateTextStyle:t.onUpdateTextStyle}),jsx(cpe,{canMut:r,canFormat:s,onUpdateTextStyle:t.onUpdateTextStyle})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Paragraph"})]})]})}function DN(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:Be,title:"Normal view",children:"Normal"}),t.onToggleSlideSorter?jsx("button",{className:Be,onClick:t.onToggleSlideSorter,title:"Slide Sorter view",children:"Slide Sorter"}):jsx("button",{className:Be,title:"Slide Sorter view",children:"Slide Sorter"}),jsx("button",{className:Be,title:"Reading View",children:"Reading View"})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Presentation Views"})]}),qt,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:Be,title:"Edit slide masters and layouts",children:"Slide Master"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Master Views"})]}),qt,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:Be,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"})]}),qt,jsx("button",{onClick:()=>t.onSetEditTemplateMode(!t.editTemplateMode),disabled:!t.canEdit,className:ie(Be,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:ie(Be,t.isSelectionPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Selection Pane",children:[jsx(LuList,{className:Ne}),"Selection"]}),t.onToggleEyedropper&&jsxs("button",{type:"button",onClick:t.onToggleEyedropper,disabled:!t.canEdit,className:ie(Be,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:Ne}),"Eyedropper"]}),jsx("button",{onClick:()=>t.onSetShowGrid(!t.showGrid),className:ie(Be,t.showGrid?"bg-primary text-white":""),title:e("pptx.grid.toggleGrid"),children:e("pptx.grid.grid")}),jsx("button",{onClick:()=>t.onSetShowRulers(!t.showRulers),className:ie(Be,t.showRulers?"bg-primary text-white":""),title:e("pptx.ruler.toggleRulers"),children:e("pptx.ruler.rulers")}),jsx("button",{onClick:()=>t.onSetSnapToGrid(!t.snapToGrid),className:ie(Be,t.snapToGrid?"bg-primary text-white":""),title:e("pptx.grid.snapToGrid"),children:e("pptx.grid.snapToGrid")}),jsx("button",{onClick:()=>t.onSetSnapToShape(!t.snapToShape),className:ie(Be,t.snapToShape?"bg-primary text-white":""),title:e("pptx.grid.snapToShape"),children:e("pptx.grid.snapToShape")}),jsx("button",{onClick:()=>t.onAddGuide("h"),className:Be,title:"Add horizontal guide",children:"H Guide"}),jsx("button",{onClick:()=>t.onAddGuide("v"),className:Be,title:"Add vertical guide",children:"V Guide"}),jsx("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:ie(Be,t.spellCheckEnabled?"bg-primary text-white":""),title:"Toggle spell check",children:"Spell"})]})}function ON({open:t,onClose:e,title:n,children:r,heightFraction:o=.6,fullScreen:i=false,autoHeight:s=false,className:a,headerRight:l}){let c=useRef(null),{dragY:d,dragging:u,handlers:p}=Lu(e);if(useEffect(()=>{if(!t)return;let f=m=>{m.key==="Escape"&&e();};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[t,e]),!t)return null;let h=s?{maxHeight:"calc(85dvh - env(safe-area-inset-top))"}: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",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:c,className:ie("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",a),style:{...h,transform:d>0?`translateY(${d}px)`:void 0,transition:u?"none":"transform 150ms ease-out"},children:[jsxs("div",{className:"cursor-grab active:cursor-grabbing touch-none",onPointerDown:p.onPointerDown,onPointerMove:p.onPointerMove,onPointerUp:p.onPointerUp,onPointerCancel:p.onPointerCancel,children:[jsx("div",{className:"flex items-center justify-center pt-2 pb-1",children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),(n||l)&&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}),l]})]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain",children:r})]})]})}var Ait=[{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 ppe(t){let{open:e,onClose:n}=t,[r,o]=useState("home");return jsx(ON,{open:e,onClose:n,autoHeight: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 flex-wrap gap-1.5 px-3 py-2",children:Ait.map(({key:i,label:s,icon:a})=>jsxs("button",{type:"button",onClick:()=>o(r===i?null:i),className:ie("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(Rit,{active:r,...t})})]})})}function Rit({active:t,...e}){let n="flex flex-wrap items-center gap-2";switch(t){case "home":return jsx("div",{className:n,children:jsx(RN,{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(IN,{canEdit:e.canEdit,newShapeType:e.newShapeType,onSetNewShapeType:e.onSetNewShapeType,onAddTextBox:e.onAddTextBox,onAddShape:e.onAddShape,onAddTable:e.onAddTable,onAddChart:e.onAddChart,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(LN,{canEdit:e.canEdit,selectedElement:e.selectedElement,tableEditorState:e.tableEditorState,onUpdateTextStyle:e.onUpdateTextStyle})});case "draw":return jsx("div",{className:n,children:jsx(PN,{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(wN,{canEdit:e.canEdit,selectedElement:e.selectedElement,clipboardPayload:e.clipboardPayload,onAlignElements:e.onAlignElements,onDistributeElements:e.onDistributeElements,canDistribute:e.canDistribute,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(TN,{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(CN,{isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector})});case "animations":return jsx("div",{className:n,children:jsx(SN,{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(NN,{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(MN,{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(DN,{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(EN,{onOpenFile:e.onOpenFile,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 fpe(t){let{t:e}=useTranslation(),{mode:n,canUndo:r,canRedo:o,onUndo:i,onRedo:s,onSetMode:a,onSaveAsPptx:l}=t,[c,d]=useState(false),u=n==="edit"||n==="master",p="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:()=>d(true),className:p,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:p,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:p,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:l,className:p,title:e("pptx.toolbar.save","Save"),"aria-label":e("pptx.toolbar.save","Save"),children:jsx(LuDownload,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:()=>a("present"),className:ie(p,"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:ie(p,"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(ppe,{open:c,onClose:()=>d(false),...t})]})}var mpe=["#ffffff","#000000","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ff8800","#8800ff","#008888","#888888"],Wit=Um.slice(0,12);function gpe(t){let[e,n]=useState(false),[r,o]=useState(false),[i,s]=useState(false),[a,l]=useState(false),c=useRef(null),d=useRef(null),u=useRef(null),p=useRef(null);return useEffect(()=>{if(!e)return;let h=f=>{c.current&&!c.current.contains(f.target)&&n(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[e]),useEffect(()=>{if(!r)return;let h=f=>{d.current&&!d.current.contains(f.target)&&o(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),useEffect(()=>{if(!i)return;let h=f=>{u.current&&!u.current.contains(f.target)&&s(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]),useEffect(()=>{if(!a)return;let h=f=>{p.current&&!p.current.contains(f.target)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[a]),jsxs(Fragment,{children:[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:c,children:[jsxs("button",{type:"button",disabled:!t.canEdit,className:Be,title:"Shapes",onClick:()=>n(h=>!h),children:[jsx(LuShapes,{className:Ne}),"Shapes"]}),e&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-52 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:Wit.map(h=>jsxs("button",{type:"button",className:ie("flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",t.newShapeType===h.type&&"bg-accent"),onClick:()=>{t.onSetNewShapeType(h.type),t.onAddShape(),n(false);},children:[h.icon,h.label]},h.type))})})]}),jsxs("div",{className:"relative",ref:d,children:[jsxs("button",{type:"button",disabled:!t.canEdit||!t.selectedElement,className:Be,title:"Arrange",onClick:()=>o(h=>!h),children:[jsx(LuLayers,{className:Ne}),"Arrange"]}),r&&jsx("div",{className:"absolute left-0 top-full z-50 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",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayer("forward"),o(false);},children:"Bring Forward"}),jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayer("backward"),o(false);},children:"Send Backward"}),jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayerToEdge("front"),o(false);},children:"Bring to Front"}),jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onMoveLayerToEdge("back"),o(false);},children:"Send to Back"})]})})]}),jsxs("div",{className:"relative",ref:u,children:[jsx("button",{type:"button",disabled:!t.canEdit||!t.selectedElement,className:Be,title:"Shape Fill",onClick:()=>s(h=>!h),children:jsx(LuPaintBucket,{className:Ne})}),i&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 grid grid-cols-6 gap-1",children:mpe.map(h=>jsx("button",{type:"button","aria-label":`Fill colour ${h}`,className:"w-5 h-5 rounded border border-border/60 hover:scale-110 transition-transform",style:{backgroundColor:h},title:h,onClick:()=>{t.onUpdateElementStyle?.({fill:h}),s(false);}},h))})})]}),jsxs("div",{className:"relative",ref:p,children:[jsx("button",{type:"button",disabled:!t.canEdit||!t.selectedElement,className:Be,title:"Shape Outline",onClick:()=>l(h=>!h),children:jsx(LuPenLine,{className:Ne})}),a&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 grid grid-cols-6 gap-1",children:mpe.map(h=>jsx("button",{type:"button","aria-label":`Outline colour ${h}`,className:"w-5 h-5 rounded border border-border/60 hover:scale-110 transition-transform",style:{backgroundColor:h},title:h,onClick:()=>{t.onUpdateElementStyle?.({outlineColor:h}),l(false);}},h))})})]}),jsx("button",{type:"button",disabled:true,className:ie(Be,"opacity-50 cursor-not-allowed"),title:"Shape Effects (not available)",children:jsx(LuSparkles,{className:Ne})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Drawing"})]}),qt]})}function xpe(t){let[e,n]=useState(false),r=useRef(null);return useEffect(()=>{if(!e)return;let o=i=>{r.current&&!r.current.contains(i.target)&&n(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e]),jsxs(Fragment,{children:[qt,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:to,children:[jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:t.onToggleFindReplace,className:fr,title:"Find",children:jsx(LuSearch,{className:Ne})}),jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:t.onToggleFindReplace,className:Jo,title:"Replace",children:jsx(LuReplace,{className:Ne})})]}),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>n(o=>!o),className:Be,title:"Select",children:jsx(LuMousePointer2,{className:Ne})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 w-32",children:jsx("button",{type:"button",className:"flex items-center w-full px-3 py-1.5 text-xs hover:bg-muted transition-colors",onMouseDown:o=>o.preventDefault(),onClick:()=>{t.onSelectAll?.(),n(false);},children:"Select All"})})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Editing"})]})]})}Pe();function ype(t){let{t:e}=useTranslation(),n=No(),r=n&&n.status==="connected";return jsxs("div",{className:"flex items-center gap-1 pr-1",children:[t.onEnterRehearsalMode&&jsxs("button",{type:"button",onClick:t.onEnterRehearsalMode,className:l$.record,title:e("pptx.titleBar.record"),"aria-label":e("pptx.titleBar.record"),children:[jsx("span",{className:l$.recordDot,"aria-hidden":"true"}),jsx("span",{children:e("pptx.titleBar.record")})]}),jsxs("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:ie("relative inline-flex items-center gap-1 px-2.5 py-1 rounded-sm text-[11px] font-medium transition-colors whitespace-nowrap",r?"bg-green-600 hover:bg-green-500 text-white":"bg-primary hover:bg-primary/90 text-white"),title:r?e("pptx.toolbar.sharingUsers",{count:n.connectedCount}):e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:[jsx(LuShare2,{className:"w-3 h-3"}),jsx("span",{children:r?e("pptx.toolbar.sharingCount",{count:n.connectedCount}):e("pptx.toolbar.share")})]})]})}function bpe({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:[qt,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:ie("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:[qt,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 vpe({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:ie("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(d=>!d),className:ie("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 Spe({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(vpe,{isActive:t==="present",onPresent:()=>e("present"),onPresenterView:r,onRehearse:o,onSetUpSlideShow:i,onBroadcast:s,onToggleSubtitles:a,showSubtitles:l})}function wpe(t){let{t:e}=useTranslation(),n=r=>{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}[r]?.();};return jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>t.onSetOverflowMenuOpen(!t.isOverflowMenuOpen),className:ie("p-1.5 rounded transition-colors",t.isOverflowMenuOpen?"bg-primary/80 text-white":"bg-muted hover:bg-accent"),title:e("pptx.ribbon.moreActions"),"aria-label":e("pptx.ribbon.moreActions"),children:jsx(LuEllipsis,{className:Ne})}),t.isOverflowMenuOpen&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":e("pptx.overflow.closeMenu"),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:Vue.filter(r=>r.k!=="pptm"||t.hasMacros).map(r=>r.k.startsWith("---")?jsx("div",{className:"my-1 border-t border-border/60"},r.k):jsxs("button",{type:"button",onClick:()=>n(r.k),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[r.i,e(r.labelKey)]},r.k))})]})]})}function Cpe(t){let{t:e}=useTranslation(),{mode:n,canEdit:r,isSidebarCollapsed:o,isInspectorPaneOpen:i,onToggleSidebar:s,onToggleInspector:a}=t,l=No(),c="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:s,className:ie(c,o?"text-muted-foreground":"text-foreground"),title:e("pptx.toolbar.toggleSlidesPanel"),"aria-label":e("pptx.toolbar.toggleSlidesPanel"),children:jsx(LuPanelLeft,{className:Ne})}),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:ie(c,"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:Gn}),(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})]}),l&&(l.status==="connected"||l.status==="connecting")&&l.remoteUsers.length>0&&jsx("button",{type:"button",onClick:t.onOpenShareDialog,className:"mx-1 rounded-sm px-1 py-0.5 hover:bg-accent/60 transition-colors cursor-pointer",title:e("pptx.toolbar.sharingUsers",{count:l.connectedCount}),children:jsx(OI,{remoteUsers:l.remoteUsers,localUserName:l.config.userName,localUserColor:l.config.userColor??"#6366f1",localUserAvatar:l.config.userAvatar,status:l.status})}),jsx(Spe,{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(bpe,{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}),qt,(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:a,className:ie(c,i?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.toggleInspector"),"aria-label":e("pptx.toolbar.toggleInspector"),children:jsx(LuPanelRight,{className:Ne})}),jsx("button",{type:"button",onClick:t.onOpenSettings??t.onToggleShortcuts,className:ie(c,"text-muted-foreground"),title:e("pptx.toolbar.settingsShortcuts"),"aria-label":e("pptx.toolbar.settings"),children:jsx(LuSettings,{className:Gn})}),!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(wpe,{...t})]})}function nG(t){let{mode:e,isNarrowViewport:n,isCompactToolbarOpen:r,toolbarSection:o,onSetToolbarSection:i}=t,{t:s}=useTranslation();if(n&&e!=="present")return jsx(fpe,{...t});let a=o==="file",l=o==="home",c=o==="insert",d=l||o==="text",u=l||o==="arrange",p=o==="draw",h=o==="design",f=o==="transitions",m=o==="animations",x=o==="slideShow",g=o==="record",y=o==="review",b=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(Cpe,{...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:[Fre.map(w=>jsx("button",{type:"button",onClick:()=>i(w.id),className:ie("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:s(w.labelKey)},w.id)),jsx("div",{className:"flex-1"}),jsx(ype,{onEnterRehearsalMode:t.canEdit?t.onEnterRehearsalMode:void 0,onOpenShareDialog:t.onOpenShareDialog,onPackageForSharing:t.onPackageForSharing}),n&&jsx("button",{type:"button",onClick:t.onToggleCompactToolbar,className:ie("px-2 py-1 rounded text-[11px] transition-colors mr-1",r?"bg-primary/80 text-white":"text-muted-foreground hover:text-foreground"),title:s(r?"pptx.ribbon.collapseRibbon":"pptx.ribbon.expandRibbon"),children:s(r?"pptx.ribbon.collapseRibbon":"pptx.ribbon.expandRibbon")})]}),S&&jsxs("div",{className:ie("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:[a&&jsx(EN,{onOpenFile:t.onOpenFile,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}),l&&jsx(RN,{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}),c&&jsx(IN,{canEdit:t.canEdit,newShapeType:t.newShapeType,onSetNewShapeType:t.onSetNewShapeType,onAddTextBox:t.onAddTextBox,onAddShape:t.onAddShape,onAddTable:t.onAddTable,onAddChart:t.onAddChart,onAddSmartArt:t.onAddSmartArt,onAddEquation:t.onAddEquation,onAddActionButton:t.onAddActionButton,onInsertField:t.onInsertField,onOpenImagePicker:t.onOpenImagePicker,onOpenMediaPicker:t.onOpenMediaPicker}),d&&jsx(LN,{canEdit:t.canEdit,selectedElement:t.selectedElement,tableEditorState:t.tableEditorState,onUpdateTextStyle:t.onUpdateTextStyle}),l&&jsx(xpe,{onToggleFindReplace:t.onToggleFindReplace}),l&&jsx(gpe,{canEdit:t.canEdit,selectedElement:t.selectedElement,newShapeType:t.newShapeType,onSetNewShapeType:t.onSetNewShapeType,onAddShape:t.onAddShape,onMoveLayer:t.onMoveLayer,onMoveLayerToEdge:t.onMoveLayerToEdge}),p&&jsx(PN,{activeTool:t.activeTool,drawingColor:t.drawingColor,drawingWidth:t.drawingWidth,onSetActiveTool:t.onSetActiveTool,onSetDrawingColor:t.onSetDrawingColor,onSetDrawingWidth:t.onSetDrawingWidth}),u&&jsx(wN,{canEdit:t.canEdit,selectedElement:t.selectedElement,clipboardPayload:t.clipboardPayload,onAlignElements:t.onAlignElements,onDistributeElements:t.onDistributeElements,canDistribute:t.canDistribute,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}),h&&jsx(TN,{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(CN,{isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector}),m&&jsx(SN,{canEdit:t.canEdit,selectedElement:t.selectedElement,isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector,onOpenAnimationPanel:t.onOpenAnimationPanel,onAddAnimation:t.onAddAnimation,onRemoveAnimation:t.onRemoveAnimation}),x&&jsx(NN,{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}),g&&jsxs("div",{className:"flex items-center gap-2 px-2",children:[jsx("span",{className:"inline-block w-3 h-3 rounded-full bg-red-500"}),jsx("span",{className:"text-xs text-foreground",children:"Record"})]}),y&&jsx(MN,{canEdit:t.canEdit,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,onToggleComments:t.onToggleComments,isCommentsPanelOpen:t.isCommentsPanelOpen,slideCommentCount:t.slideCommentCount,onCompare:t.onCompare}),b&&jsx(DN,{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:Be,title:s("pptx.settings.keyboardShortcuts"),children:s("pptx.settings.keyboardShortcuts")}),jsx("button",{type:"button",onClick:t.onRunAccessibilityCheck,className:Be,title:s("pptx.ribbon.accessibilityCheck"),children:s("pptx.ribbon.accessibilityCheck")})]})]})]})}bt();Pe();var VN="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",Gu="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",Mpe=MR.filter(t=>t.value==="fadeIn"||t.value==="flyIn"||t.value==="zoomIn"),_pe=MR.filter(t=>t.value==="fadeOut"||t.value==="flyOut"||t.value==="zoomOut"),Ppe=MR.filter(t=>t.value==="spin"||t.value==="pulse"||t.value==="colorWave"||t.value==="bounce"||t.value==="flash"||t.value==="growShrink"||t.value==="teeter"),Epe=[{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"}],Ape=[{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"}],Rpe=[{value:"none",labelKey:"pptx.animation.repeatUntil.none"},{value:"untilNextClick",labelKey:"pptx.animation.repeatUntil.untilNextClick"},{value:"untilEndOfSlide",labelKey:"pptx.animation.repeatUntil.untilEndOfSlide"}],kpe=[{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}],Ipe=[{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 Ist(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 Nst(t){return t.entrance??t.emphasis??t.exit??"custom"}function Lpe({selectedElementId:t,canEdit:e,handlers:n}){let{t:r}=useTranslation(),{sortedAnimations:o,dragIndex:i,dragOverIndex:s,timelineBarData:a,handleAnimationHover:l,handleAnimationHoverEnd:c,handleDragStart:d,handleDragOver:u,handleDragEnter:p,handleDragLeave:h,handleDrop:f,handleDragEnd:m,handleMoveUp:x,handleMoveDown:g,getTimelineLabel:y}=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(b=>jsx("div",{className:ie("absolute top-0.5 bottom-0.5 rounded-sm transition-colors",Ist(b.anim),b.anim.elementId===t&&"ring-1 ring-primary"),style:{left:`${b.leftPercent}%`,width:`${Math.max(b.widthPercent,2)}%`},title:`${y(b.anim)} - ${Nst(b.anim)} (${b.anim.durationMs??500}ms)`,onMouseEnter:()=>l(b.anim),onMouseLeave:c},b.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((b,v)=>{let S=t===b.elementId;return jsxs("div",{draggable:e,onDragStart:T=>d(v,T),onDragOver:T=>u(v,T),onDragEnter:()=>p(v),onDragLeave:h,onDrop:T=>f(v,T),onDragEnd:m,onMouseEnter:()=>l(b),onMouseLeave:c,className:ie("flex items-center gap-1 px-1 py-0.5 rounded text-[10px] cursor-grab transition-colors",S?"bg-primary/30 text-primary":"bg-muted/50 text-muted-foreground",i===v&&"opacity-40",s===v&&"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:[v+1,"."]}),jsx("span",{className:"truncate flex-1",children:y(b)}),b.entrance&&jsx(LuMoveRight,{className:"w-3 h-3 text-green-400/70 shrink-0"}),b.emphasis&&jsx(LuRotateCw,{className:"w-3 h-3 text-yellow-400/70 shrink-0"}),b.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:v===0,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:T=>{T.stopPropagation(),x(v);},title:r("pptx.animation.moveUp"),children:jsx(LuChevronUp,{className:"w-3 h-3"})}),jsx("button",{type:"button",disabled:v===o.length-1,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:T=>{T.stopPropagation(),g(v);},title:r("pptx.animation.moveDown"),children:jsx(LuChevronDown,{className:"w-3 h-3"})})]})]},b.elementId)})})]})]})}bt();Pe();function Fpe({canEdit:t,updateAnimations:e}){let[n,r]=useState(null),[o,i]=useState(null),s=useRef(0),a=useCallback((x,g)=>{t&&(r(x),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("text/plain",String(x)));},[t]),l=useCallback((x,g)=>{g.preventDefault(),g.dataTransfer.dropEffect="move",i(x);},[]),c=useCallback(x=>{s.current++,i(x);},[]),d=useCallback(()=>{s.current--,s.current<=0&&(i(null),s.current=0);},[]),u=useCallback((x,g)=>{e(y=>{let b=[...y].sort((S,w)=>(S.order??0)-(w.order??0)),[v]=b.splice(x,1);return b.splice(g,0,v),b.map((S,w)=>({...S,order:w}))});},[e]),p=useCallback((x,g)=>{g.preventDefault(),s.current=0;let y=n;r(null),i(null),!(y===null||y===x)&&u(y,x);},[n,u]),h=useCallback(()=>{r(null),i(null),s.current=0;},[]),f=useCallback(x=>{x<=0||u(x,x-1);},[u]),m=useCallback(x=>{e(g=>{let y=[...g].sort((v,S)=>(v.order??0)-(S.order??0));if(x>=y.length-1)return g;let b=y[x+1];return y[x+1]=y[x],y[x]=b,y.map((v,S)=>({...v,order:S}))});},[e]);return {dragIndex:n,dragOverIndex:o,handleDragStart:a,handleDragOver:l,handleDragEnter:c,handleDragLeave:d,handleDrop:p,handleDragEnd:h,handleMoveUp:f,handleMoveDown:m}}function Ope({selectedElementId:t,selectedElementAnimation:e}){let n=useCallback(i=>{let s=i.entrance??i.emphasis??i.exit;!s||s==="none"||m6(i.elementId,s,{direction:i.direction,durationMs:i.durationMs??500,timingCurve:i.timingCurve});},[]),r=useCallback(()=>g6(),[]),o=useCallback(()=>{if(!e)return;let i=e.entrance??e.emphasis??e.exit;!i||i==="none"||m6(t,i,{direction:e.direction,durationMs:e.durationMs??500,timingCurve:e.timingCurve});},[t,e]);return {handleAnimationHover:n,handleAnimationHoverEnd:r,handlePreviewClick:o}}function Bpe({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let o=useMemo(()=>(e.animations??[]).find(E=>E.elementId===t.id),[e,t]),i=useMemo(()=>[...e.animations??[]].sort((E,R)=>(E.order??0)-(R.order??0)),[e.animations]),s=useCallback(E=>{if(!n)return;let R=e.animations??[];r({animations:E([...R])});},[n,e.animations,r]),a=useCallback((E,R)=>{s(I=>I.map(L=>L.elementId===t.id?{...L,[E]:R}:L));},[s,t.id]),l=useCallback((E,R,I)=>{n&&s(L=>{let k=L.findIndex(N=>N.elementId===t.id),F=E||R||I;if(k>=0){if(!F)return L.filter(N=>N.elementId!==t.id);L[k]={...L[k],entrance:E,exit:R,emphasis:I};}else F&&L.push({elementId:t.id,entrance:E,exit:R,emphasis:I,durationMs:500,order:L.length,trigger:"onClick"});return L});},[n,s,t.id]),c=useCallback(E=>{let R=E.target.value;l(R==="none"?void 0:R,o?.exit,o?.emphasis);},[l,o]),d=useCallback(E=>{let R=E.target.value;l(o?.entrance,R==="none"?void 0:R,o?.emphasis);},[l,o]),u=useCallback(E=>{let R=E.target.value;l(o?.entrance,o?.exit,R==="none"?void 0:R);},[l,o]),p=useCallback(E=>{let R=E.target.value;a("trigger",R),R!=="onShapeClick"&&a("triggerShapeId",void 0);},[a]),h=useCallback(E=>a("triggerShapeId",E.target.value||void 0),[a]),f=useCallback(E=>a("timingCurve",E.target.value),[a]),m=useCallback(E=>a("durationMs",Math.max(100,Math.min(1e4,Number(E.target.value)||450))),[a]),x=useCallback(E=>a("delayMs",Math.max(0,Math.min(1e4,Number(E.target.value)||0))),[a]),g=useCallback(E=>a("repeatCount",Math.max(1,Math.min(100,Number(E.target.value)||1))),[a]),y=useCallback(E=>{let R=E.target.value;a("repeatMode",R==="none"?void 0:R);},[a]),b=useCallback(E=>a("direction",E),[a]),v=useCallback(E=>a("sequence",E.target.value),[a]),S=Ope({selectedElementId:t.id,selectedElementAnimation:o}),w=Fpe({canEdit:n,updateAnimations:s}),C=useCallback(E=>{let R=e.elements?.find(L=>L.id===E.elementId);return R?(ze(R)?R.text:void 0)||ii(R):E.elementId.slice(0,8)},[e.elements]),T=!!(o?.entrance||o?.exit||o?.emphasis),M=T&&(rT.has(o?.entrance??"")||rT.has(o?.exit??"")),_=useMemo(()=>{if(i.length===0)return [];let E=0,R=i.map(L=>{let k=L.delayMs??0,F=L.durationMs??500,N=k+F;return N>E&&(E=N),{anim:L,startMs:k,durationMs:F,endMs:N}}),I=Math.max(E,1);return R.map(L=>({anim:L.anim,leftPercent:L.startMs/I*100,widthPercent:L.durationMs/I*100}))},[i]);return {selectedElementAnimation:o,sortedAnimations:i,hasAnimation:T,showDirectionPicker:M,timelineBarData:_,handleEntranceChange:c,handleExitChange:d,handleEmphasisChange:u,handleTriggerChange:p,handleTriggerShapeChange:h,handleTimingCurveChange:f,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:g,handleRepeatModeChange:y,handleDirectionChange:b,handleSequenceChange:v,getTimelineLabel:C,...S,...w}}function Upe({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=Bpe({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}),{selectedElementAnimation:s,hasAnimation:a,showDirectionPicker:l,handleEntranceChange:c,handleExitChange:d,handleEmphasisChange:u,handleTriggerChange:p,handleTriggerShapeChange:h,handleTimingCurveChange:f,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:g,handleRepeatModeChange:y,handleDirectionChange:b,handleSequenceChange:v,handlePreviewClick:S}=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:S,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:Gu,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Mpe.map(w=>jsx("option",{value:w.value,children:o(`pptx.animation.preset.${w.value}`)},w.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:u,disabled:!n,className:Gu,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Ppe.map(w=>jsx("option",{value:w.value,children:o(`pptx.animation.preset.${w.value}`)},w.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:d,disabled:!n,className:Gu,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),_pe.map(w=>jsx("option",{value:w.value,children:o(`pptx.animation.preset.${w.value}`)},w.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:kpe.map(w=>{let C=w.icon,T=s?.direction===w.value;return jsx("button",{type:"button",disabled:!n,className:ie("flex items-center justify-center w-7 h-7 rounded border transition-colors",T?"border-primary bg-primary/20 text-primary":"border-border bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>b(w.value),title:o(w.labelKey),children:jsx(C,{className:"w-3.5 h-3.5"})},w.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:v,disabled:!n,className:Gu,children:Ipe.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.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:Gu,children:Epe.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.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:h,disabled:!n,className:Gu,children:[jsx("option",{value:"",children:o("pptx.animation.trigger.selectShape")}),e.elements.filter(w=>w.id!==t.id).map(w=>jsx("option",{value:w.id,children:ii(w)},w.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:VN})]}),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:VN})]}),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:f,disabled:!n,className:Gu,children:Ape.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.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:g,className:VN})]}),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:y,disabled:!n,className:Gu,children:Rpe.map(w=>jsx("option",{value:w.value,children:o(w.labelKey)},w.value))})]})]}),jsx(Lpe,{selectedElementId:t.id,canEdit:n,handlers:i})]})}bt();bt();var $pe=[{key:"elements",label:"Elements",icon:LuLayers},{key:"properties",label:"Properties",icon:LuSettings2},{key:"comments",label:"Comments",icon:LuMessageSquare}],Gt="text-[11px] uppercase tracking-wide text-muted-foreground",Zt="rounded border border-border bg-card p-2 space-y-2",an="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",Hpe=[["X","x"],["Y","y"],["W","width"],["H","height"]];var Vst=[{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 Vpe({selectedElement:t,slides:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.actionClick?l_(t.actionClick,"click"):void 0,s=t.actionHover?l_(t.actionHover,"hover"):void 0,a=i?.type??"none",l=s?.type??"none",c=(d,u,p,h)=>{let m=lS({type:u,url:p,slideIndex:h});r(d==="click"?{actionClick:m}:{actionHover:m});};return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:o("pptx.action.title","Action")}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx(zpe,{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:d=>c("click",d,i?.url,i?.slideIndex),onChangeUrl:d=>c("click","url",d),onChangeSlide:d=>c("click","slide",void 0,d)}),jsx(zpe,{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:d=>c("hover",d,s?.url,s?.slideIndex),onChangeUrl:d=>c("hover","url",d),onChangeSlide:d=>c("hover","slide",void 0,d)})]})]})}function zpe({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:ie(an,"w-full"),value:e,onChange:d=>a(d.target.value),children:Vst.map(d=>jsx("option",{value:d.value,children:d.label},d.value))}),e==="url"&&jsx("input",{type:"text",disabled:!i,className:ie(an,"w-full"),placeholder:"https://...",value:n?.url??r??"",onChange:d=>l(d.target.value)}),e==="slide"&&jsx("input",{type:"number",disabled:!i,className:ie(an,"w-full"),placeholder:"Slide number (1-based)",min:1,max:s,value:(n?.slideIndex??o??0)+1,onChange:d=>{let u=Number(d.target.value);Number.isFinite(u)&&c(Math.max(0,u-1));}})]})}bt();var er="text-[11px] uppercase tracking-wide text-muted-foreground",tr="rounded border border-border bg-card p-2 space-y-2",Rn="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",sG="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",GN="bg-muted border border-border rounded px-1 py-0.5 text-[11px] w-full text-center",Gpe=[{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"}],Wpe=[{value:"clustered",labelKey:"pptx.chart.groupingClustered"},{value:"stacked",labelKey:"pptx.chart.groupingStacked"},{value:"percentStacked",labelKey:"pptx.chart.groupingPercentStacked"}],Xpe=[{value:"t",labelKey:"pptx.chart.legendTop"},{value:"b",labelKey:"pptx.chart.legendBottom"},{value:"l",labelKey:"pptx.chart.legendLeft"},{value:"r",labelKey:"pptx.chart.legendRight"}],jpe=[{value:"nextTo",labelKey:"pptx.chart.tickNextTo"},{value:"high",labelKey:"pptx.chart.tickHigh"},{value:"low",labelKey:"pptx.chart.tickLow"},{value:"none",labelKey:"pptx.chart.tickNone"}],Ype=[{value:"",labelKey:"pptx.chart.unitsNone"},{value:"hundreds",labelKey:"pptx.chart.unitsHundreds"},{value:"thousands",labelKey:"pptx.chart.unitsThousands"},{value:"tenThousands",labelKey:"pptx.chart.unitsTenThousands"},{value:"hundredThousands",labelKey:"pptx.chart.unitsHundredThousands"},{value:"millions",labelKey:"pptx.chart.unitsMillions"},{value:"tenMillions",labelKey:"pptx.chart.unitsTenMillions"},{value:"hundredMillions",labelKey:"pptx.chart.unitsHundredMillions"},{value:"billions",labelKey:"pptx.chart.unitsBillions"},{value:"trillions",labelKey:"pptx.chart.unitsTrillions"}];var Kpe=[{key:"showValue",labelKey:"pptx.chart.labelValue"},{key:"showCategory",labelKey:"pptx.chart.labelCategory"},{key:"showSeriesName",labelKey:"pptx.chart.labelSeriesName"},{key:"showPercent",labelKey:"pptx.chart.labelPercent"},{key:"showLegendKey",labelKey:"pptx.chart.labelLegendKey"}],qpe=[{value:"",labelKey:"pptx.chart.labelPosDefault"},{value:"ctr",labelKey:"pptx.chart.labelPosCenter"},{value:"inEnd",labelKey:"pptx.chart.labelPosInsideEnd"},{value:"inBase",labelKey:"pptx.chart.labelPosInsideBase"},{value:"outEnd",labelKey:"pptx.chart.labelPosOutsideEnd"},{value:"bestFit",labelKey:"pptx.chart.labelPosBestFit"}],Zpe=[{value:"",labelKey:"pptx.chart.trendlineNone"},{value:"linear",labelKey:"pptx.chart.trendlineLinear"},{value:"exponential",labelKey:"pptx.chart.trendlineExponential"},{value:"logarithmic",labelKey:"pptx.chart.trendlineLogarithmic"},{value:"polynomial",labelKey:"pptx.chart.trendlinePolynomial"},{value:"power",labelKey:"pptx.chart.trendlinePower"},{value:"movingAvg",labelKey:"pptx.chart.trendlineMovingAvg"}],Jpe=new Set(["bar","line","area","scatter","bubble"]),Qpe=[{value:"",labelKey:"pptx.chart.errorBarNone"},{value:"fixedVal",labelKey:"pptx.chart.errorBarFixed"},{value:"percentage",labelKey:"pptx.chart.errorBarPercentage"},{value:"stdDev",labelKey:"pptx.chart.errorBarStdDev"},{value:"stdErr",labelKey:"pptx.chart.errorBarStdErr"}],ehe=[{value:"both",labelKey:"pptx.chart.errorBarBoth"},{value:"plus",labelKey:"pptx.chart.errorBarPlus"},{value:"minus",labelKey:"pptx.chart.errorBarMinus"}],the=new Set(["fixedVal","percentage","stdDev"]),nhe=new Set(["bar","line","area","scatter","bubble"]),rhe=new Set(["bar","line","area"]),WN=[{value:"",labelKey:"pptx.chart.markerAuto"},{value:"none",labelKey:"pptx.chart.markerNone"},{value:"circle",labelKey:"pptx.chart.markerCircle"},{value:"square",labelKey:"pptx.chart.markerSquare"},{value:"diamond",labelKey:"pptx.chart.markerDiamond"},{value:"triangle",labelKey:"pptx.chart.markerTriangle"},{value:"x",labelKey:"pptx.chart.markerX"},{value:"star",labelKey:"pptx.chart.markerStar"},{value:"plus",labelKey:"pptx.chart.markerPlus"},{value:"dot",labelKey:"pptx.chart.markerDot"},{value:"dash",labelKey:"pptx.chart.markerDash"}],XN=new Set(["line","scatter","bubble","radar"]),ohe=[{value:"",labelKey:"pptx.chart.dashDefault"},{value:"solid",labelKey:"pptx.chart.dashSolid"},{value:"dash",labelKey:"pptx.chart.dashDash"},{value:"dot",labelKey:"pptx.chart.dashDot"},{value:"dashDot",labelKey:"pptx.chart.dashDashDot"},{value:"lgDash",labelKey:"pptx.chart.dashLong"}],ihe=[{value:"",labelKey:"pptx.chart.comboDefault"},{value:"bar",labelKey:"pptx.chart.typeBar"},{value:"line",labelKey:"pptx.chart.typeLine"},{value:"area",labelKey:"pptx.chart.typeArea"},{value:"scatter",labelKey:"pptx.chart.typeScatter"}],she=new Set(["bar","line","area","combo"]),ahe=new Set(["pie","pie3D","doughnut","ofPie"]);var Wst=[{type:"valAx",labelKey:"pptx.chart.valueAxis",hasScale:true},{type:"dateAx",labelKey:"pptx.chart.dateAxis",hasScale:true},{type:"catAx",labelKey:"pptx.chart.categoryAxis",hasScale:false}];function lhe({axes:t,canEdit:e,onUpdateAxis:n}){let{t:r}=useTranslation(),o=Wst.map(s=>({...s,axis:t?.find(a=>a.axisType===s.type)})).filter(s=>!!s.axis);if(o.length===0)return null;let i=(s,a,l,c)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r(a)}),jsx("input",{type:"number",disabled:!e,className:Rn,value:l??"",placeholder:r("pptx.chart.auto"),onChange:d=>{let u=d.target.value;if(u===""){n(s,{[c]:void 0});return}let p=Number.parseFloat(u);Number.isFinite(p)&&n(s,{[c]:p});}})]});return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:r("pptx.chart.axes")}),o.map(({type:s,labelKey:a,hasScale:l,axis:c})=>jsxs("div",{className:"space-y-1.5",children:[jsx("div",{className:"text-[11px] font-medium",children:r(a)}),l&&jsxs("div",{className:"space-y-1.5 ml-2",children:[i(s,"pptx.chart.min",c.min,"min"),i(s,"pptx.chart.max",c.max,"max"),i(s,"pptx.chart.majorUnit",c.majorUnit,"majorUnit"),i(s,"pptx.chart.minorUnit",c.minorUnit,"minorUnit"),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.displayUnits")}),jsx("select",{disabled:!e,className:Rn,value:c.displayUnits??"",onChange:d=>n(s,{displayUnits:d.target.value||void 0}),children:Ype.map(d=>jsx("option",{value:d.value,children:r(d.labelKey)},d.value))})]})]}),jsxs("div",{className:"space-y-1.5 ml-2",children:[jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.axisTitle")}),jsx("input",{type:"text",disabled:!e,className:Rn,value:c.titleText??"",placeholder:r("pptx.chart.axisTitlePlaceholder"),onChange:d=>n(s,{titleText:d.target.value})})]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.numberFormat")}),jsx("input",{type:"text",disabled:!e,className:Rn,value:c.numFmt?.formatCode??"",placeholder:"General",onChange:d=>n(s,{numFmt:d.target.value?{formatCode:d.target.value,sourceLinked:false}:void 0})})]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.tickLabels")}),jsx("select",{disabled:!e,className:Rn,value:c.tickLblPos??"nextTo",onChange:d=>n(s,{tickLblPos:d.target.value}),children:jpe.map(d=>jsx("option",{value:d.value,children:r(d.labelKey)},d.value))})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.majorGridlines??false,onChange:d=>n(s,{majorGridlines:d.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.majorGridlines")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.minorGridlines??false,onChange:d=>n(s,{minorGridlines:d.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.minorGridlines")})]})]})]},s))]})}var jst=[{type:"valAx",labelKey:"pptx.chart.valueAxis"},{type:"dateAx",labelKey:"pptx.chart.dateAxis"},{type:"catAx",labelKey:"pptx.chart.categoryAxis"}];function che({axes:t,canEdit:e,onSetLogScale:n,onSetTitleStyle:r,onSetGridlineStyle:o}){let{t:i}=useTranslation(),s=jst.map(a=>({...a,axis:t?.find(l=>l.axisType===a.type)})).filter(a=>!!a.axis);return s.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:i("pptx.chart.axisStyling")}),s.map(({type:a,labelKey:l,axis:c})=>{let d=a==="valAx"||a==="dateAx";return jsxs("div",{className:"space-y-1.5",children:[jsx("div",{className:"text-[11px] font-medium",children:i(l)}),jsxs("div",{className:"space-y-1.5 ml-2",children:[d&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.logScale??false,onChange:u=>n(a,{enabled:u.target.checked,base:c.logBase}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:i("pptx.chart.logScale")})]}),c.logScale&&jsx("input",{type:"number",min:2,disabled:!e,title:i("pptx.chart.logBase"),className:"w-16 bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:c.logBase??10,onChange:u=>{let p=Number.parseFloat(u.target.value);Number.isFinite(p)&&p>1&&n(a,{enabled:true,base:p});}})]}),jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:i("pptx.chart.titleFont")}),jsx("input",{type:"text",disabled:!e,className:Rn,placeholder:i("pptx.chart.auto"),value:c.fontFamily??"",onChange:u=>r(a,{fontFamily:u.target.value||null})}),jsx("input",{type:"number",min:4,max:96,disabled:!e,title:i("pptx.chart.fontSize"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:c.fontSize??"",placeholder:i("pptx.chart.auto"),onChange:u=>{let p=u.target.value,h=Number.parseFloat(p);r(a,{fontSize:Number.isFinite(h)?h:null});}})]}),jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:c.fontBold??false,onChange:u=>r(a,{fontBold:u.target.checked}),className:"accent-primary"}),jsx("span",{children:i("pptx.chart.bold")})]}),jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.chart.titleColor")}),jsx("input",{type:"color",disabled:!e,className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:c.fontColor??"#000000",onChange:u=>r(a,{fontColor:u.target.value})})]})]}),["major","minor"].map(u=>{let p=u==="major"?c.majorGridlinesSpPr:c.minorGridlinesSpPr;return (u==="major"?c.majorGridlines:c.minorGridlines)?jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:i(u==="major"?"pptx.chart.majorGridlines":"pptx.chart.minorGridlines")}),jsx("input",{type:"color",disabled:!e,title:i("pptx.chart.gridlineColor"),className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:p?.strokeColor??"#d9d9d9",onChange:f=>o(a,u,{color:f.target.value})}),jsx("input",{type:"number",min:.25,step:.25,disabled:!e,title:i("pptx.chart.gridlineWidth"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:p?.strokeWidth??"",placeholder:i("pptx.chart.auto"),onChange:f=>{let m=Number.parseFloat(f.target.value);o(a,u,{width:Number.isFinite(m)?m:null});}}),jsx("select",{disabled:!e,title:i("pptx.chart.gridlineDash"),className:Rn,value:p?.strokeDashStyle??"",onChange:f=>o(a,u,{dashStyle:f.target.value||null}),children:ohe.map(f=>jsx("option",{value:f.value,children:i(f.labelKey)},f.value))})]},u):null})]})]},a)})]})}function uhe({chartType:t,series:e,canEdit:n,onSetSeriesType:r}){let{t:o}=useTranslation();return !she.has(t)||e.length<2?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.comboTypes")}),jsx("div",{className:"space-y-1.5",children:e.map((i,s)=>jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:i.seriesChartType??"",onChange:a=>{let l=a.target.value;r(s,l===""?null:l);},children:ihe.map(a=>jsx("option",{value:a.value,children:o(a.labelKey)},a.value))})]},`${i.name}-${s}`))})]})}function fhe({series:t,categories:e,canEdit:n,onUpdateSeries:r,onUpdateCategoryLabel:o,onUpdateValue:i,onAddCategory:s,onRemoveCategory:a,onAddSeries:l,onRemoveSeries:c}){let{t:d}=useTranslation();return jsxs("div",{className:tr,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:er,children:d("pptx.chart.data")}),n&&jsxs("div",{className:"flex gap-1",children:[jsxs("button",{type:"button",className:sG,title:d("pptx.chart.addCategory"),onClick:s,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),d("pptx.chart.cat")]}),jsxs("button",{type:"button",className:sG,title:d("pptx.chart.addSeries"),onClick:l,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),d("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",{"aria-label":"Categories",className:"text-muted-foreground p-0.5 text-left min-w-[60px]"}),t.map((u,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:GN,value:u.name,onChange:h=>r(p,{name:h.target.value})}),n&&t.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:d("pptx.chart.removeSeries"),onClick:()=>c(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})},p))]})}),jsx("tbody",{children:e.map((u,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:GN,value:u,onChange:h=>o(p,h.target.value)}),n&&e.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:d("pptx.chart.removeCategory"),onClick:()=>a(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})}),t.map((h,f)=>jsx("td",{className:"p-0.5",children:jsx("input",{type:"number","aria-label":`${h.name} value ${p+1}`,disabled:!n,className:GN,value:h.values[p]??0,onChange:m=>i(f,p,m.target.value)})},f))]},p))})]})})]})}function mhe({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();if(!t?.hasDataLabels)return null;let o=t.dataLabels??{},i=s=>n({dataLabels:{...o,...s}});return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:r("pptx.chart.dataLabels")}),jsxs("div",{className:"space-y-1.5",children:[Kpe.map(s=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:o[s.key]??false,onChange:a=>i({[s.key]:a.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r(s.labelKey)})]},s.key)),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-16 text-muted-foreground shrink-0",children:r("pptx.chart.labelPosition")}),jsx("select",{disabled:!e,className:Rn,value:o.position??"",onChange:s=>i({position:s.target.value||void 0}),children:qpe.map(s=>jsx("option",{value:s.value,children:r(s.labelKey)},s.value))})]})]})]})}var Qst=WN.filter(t=>t.value!=="");function ghe({chartType:t,categories:e,series:n,canEdit:r,onSetPointMarker:o}){let{t:i}=useTranslation(),[s,a]=useState(0);if(!XN.has(t)||n.length===0||e.length===0)return null;let l=n[Math.min(s,n.length-1)],c=d=>l.dataPoints?.find(u=>u.idx===d);return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:i("pptx.chart.pointMarkers")}),n.length>1&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:i("pptx.chart.series")}),jsx("select",{disabled:!r,className:"flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",value:Math.min(s,n.length-1),onChange:d=>a(Number.parseInt(d.target.value,10)),children:n.map((d,u)=>jsx("option",{value:u,children:d.name},`${d.name}-${u}`))})]}),jsx("div",{className:"space-y-2",children:e.map((d,u)=>{let p=c(u),h=p?.marker!==void 0;return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:d,children:d}),jsxs("label",{className:"flex items-center gap-1 shrink-0",children:[jsx("input",{type:"checkbox",disabled:!r,checked:h,onChange:f=>{o(s,u,f.target.checked?{symbol:"circle"}:null);}}),jsx("span",{className:"text-muted-foreground",children:i("pptx.chart.markerOverride")})]})]}),h&&p?.marker&&jsxs("div",{className:"flex items-center gap-2 ml-2 flex-wrap",children:[jsx("select",{disabled:!r,className:"bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:p.marker.symbol,onChange:f=>o(s,u,{symbol:f.target.value}),children:Qst.map(f=>jsx("option",{value:f.value,children:i(f.labelKey)},f.value))}),jsx("input",{type:"number",min:1,max:20,disabled:!r,title:i("pptx.chart.markerSize"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:p.marker.size??"",placeholder:i("pptx.chart.auto"),onChange:f=>{let m=Number.parseInt(f.target.value,10);o(s,u,{size:Number.isFinite(m)?m:void 0});}}),jsx("input",{type:"color",disabled:!r,title:i("pptx.chart.markerFill"),className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:p.marker.spPr?.fillColor??"#4472c4",onChange:f=>o(s,u,{fillColor:f.target.value})})]})]},`${d}-${u}`)})})]})}function xhe({chartType:t,categories:e,series:n,canEdit:r,onSetPointFill:o,onSetPointExplosion:i,onSetPointLabel:s}){let{t:a}=useTranslation(),[l,c]=useState(0);if(n.length===0||e.length===0)return null;let d=n[Math.min(l,n.length-1)],u=ahe.has(t),p=h=>d.dataPoints?.find(f=>f.idx===h);return jsxs("div",{className:tr,children:[jsx("div",{className:er,children:a("pptx.chart.dataPoints")}),n.length>1&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:a("pptx.chart.series")}),jsx("select",{disabled:!r,className:Rn,value:Math.min(l,n.length-1),onChange:h=>c(Number.parseInt(h.target.value,10)),children:n.map((h,f)=>jsx("option",{value:f,children:h.name},`${h.name}-${f}`))})]}),jsx("div",{className:"space-y-1.5",children:e.map((h,f)=>{let m=p(f);return jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:h,children:h}),jsx("input",{type:"text",disabled:!r,title:a("pptx.chart.pointLabelOverride"),className:"w-20 bg-muted border border-border rounded px-1.5 py-0.5 text-[11px]",value:d.dataLabels?.find(x=>x.idx===f)?.text??"",placeholder:a("pptx.chart.auto"),onChange:x=>{let g=x.target.value;s(l,f,g===""?null:g);}}),jsx("input",{type:"color",disabled:!r,title:a("pptx.chart.pointFill"),className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:m?.spPr?.fillColor??d.color??"#4472c4",onChange:x=>o(l,f,x.target.value)}),m?.spPr?.fillColor&&jsx("button",{type:"button",disabled:!r,title:a("pptx.chart.pointFillClear"),className:"text-muted-foreground hover:text-foreground",onClick:()=>o(l,f,null),children:"\xD7"}),u&&jsx("input",{type:"number",min:0,max:100,disabled:!r,title:a("pptx.chart.pointExplosion"),className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:m?.explosion??"",placeholder:"0",onChange:x=>{let g=x.target.value;if(g===""){i(l,f,null);return}let y=Number.parseInt(g,10);Number.isFinite(y)&&i(l,f,y);}})]},`${h}-${f}`)})})]})}function yhe({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:tr,children:[jsx("div",{className:er,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:Rn,value:t.legendPosition??"b",onChange:o=>n({legendPosition:o.target.value}),children:Xpe.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 bhe({chartType:t,series:e,canEdit:n,onSetErrorBars:r}){let{t:o}=useTranslation();return !nhe.has(t)||e.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.errorBars")}),jsx("div",{className:"space-y-2",children:e.map((i,s)=>{let a=i.errBars?.[0],l=a?.valType??"",c=the.has(l);return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:l,onChange:d=>{let u=d.target.value;if(!u){r(s,null);return}r(s,{direction:a?.direction??"y",barType:a?.barType??"both",valType:u,val:a?.val});},children:Qpe.map(d=>jsx("option",{value:d.value,children:o(d.labelKey)},d.value))})]}),a&&jsxs("div",{className:"flex items-center gap-2 ml-2",children:[jsx("select",{disabled:!n,className:Rn,value:a.barType,onChange:d=>r(s,{...a,barType:d.target.value}),children:ehe.map(d=>jsx("option",{value:d.value,children:o(d.labelKey)},d.value))}),c&&jsx("input",{type:"number",disabled:!n,className:Rn,value:a.val??"",placeholder:o("pptx.chart.errorBarAmount"),onChange:d=>{let u=d.target.value,p=u===""?void 0:Number.parseFloat(u);u!==""&&!Number.isFinite(p)||r(s,{...a,val:p});}})]})]},`${i.name}-${s}`)})})]})}function vhe({chartType:t,series:e,canEdit:n,onSetMarker:r}){let{t:o}=useTranslation();return !XN.has(t)||e.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.markers")}),jsx("div",{className:"space-y-2",children:e.map((i,s)=>{let a=i.marker;return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:a?.symbol??"",onChange:l=>{let c=l.target.value;if(c===""){r(s,null);return}r(s,{symbol:c});},children:WN.map(l=>jsx("option",{value:l.value,children:o(l.labelKey)},l.value))})]}),a&&a.symbol!=="none"&&jsxs("div",{className:"flex items-center gap-3 ml-2",children:[jsxs("label",{className:"flex items-center gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.chart.markerSize")}),jsx("input",{type:"number",min:2,max:72,disabled:!n,className:"w-14 bg-muted border border-border rounded px-1.5 py-0.5",value:a.size??"",placeholder:o("pptx.chart.auto"),onChange:l=>{let c=l.target.value,d=Number.parseInt(c,10);r(s,{size:Number.isFinite(d)?d:void 0});}})]}),jsxs("label",{className:"flex items-center gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.chart.markerFill")}),jsx("input",{type:"color",disabled:!n,className:"h-6 w-8 cursor-pointer rounded border border-border bg-transparent",value:a.spPr?.fillColor??"#4472c4",onChange:l=>r(s,{fillColor:l.target.value})})]})]})]},`${i.name}-${s}`)})})]})}function Lo({value:t,disabled:e,className:n,ariaLabel:r,onCommit:o}){let[i,s]=useState(t),a=useRef(o);a.current=o,useEffect(()=>{s(t);},[t]);let l=useCallback(c=>{let d=c.target.value;s(d),a.current(d);},[]);return jsx("input",{type:"color","aria-label":r??"Color",disabled:e,value:i,className:n,onChange:l})}var pat="#4472c4";function whe({series:t,canEdit:e,onSetColor:n}){let{t:r}=useTranslation();return t.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:r("pptx.chart.seriesColors")}),jsx("div",{className:"space-y-1",children:t.map((o,i)=>jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:o.name,children:o.name}),jsx(Lo,{value:o.color??pat,disabled:!e,ariaLabel:r("pptx.chart.seriesColor",{name:o.name}),className:"h-6 w-8 cursor-pointer rounded border border-border bg-muted p-0",onCommit:s=>n(i,s)}),e&&o.color&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:r("pptx.chart.clearSeriesColor"),onClick:()=>n(i,null),children:jsx(LuX,{className:"w-3 h-3"})})]},`${o.name}-${i}`))})]})}function The({chartType:t,series:e,canEdit:n,onSetTrendline:r}){let{t:o}=useTranslation();return !Jpe.has(t)||e.length===0?null:jsxs("div",{className:tr,children:[jsx("div",{className:er,children:o("pptx.chart.trendlines")}),jsx("div",{className:"space-y-2",children:e.map((i,s)=>{let a=i.trendlines?.[0];return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"flex-1 truncate",title:i.name,children:i.name}),jsx("select",{disabled:!n,className:Rn,value:a?.trendlineType??"",onChange:l=>{let c=l.target.value;if(!c){r(s,null);return}r(s,{...a,trendlineType:c});},children:Zpe.map(l=>jsx("option",{value:l.value,children:o(l.labelKey)},l.value))})]}),a&&jsxs("div",{className:"flex items-center gap-3 ml-2",children:[jsxs("label",{className:"flex items-center gap-1 text-[11px] cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!n,checked:a.displayEq??false,onChange:l=>r(s,{...a,displayEq:l.target.checked}),className:"accent-primary"}),jsx("span",{children:o("pptx.chart.trendlineEquation")})]}),jsxs("label",{className:"flex items-center gap-1 text-[11px] cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!n,checked:a.displayRSq??false,onChange:l=>r(s,{...a,displayRSq:l.target.checked}),className:"accent-primary"}),jsx("span",{children:o("pptx.chart.trendlineRSquared")})]})]})]},`${i.name}-${s}`)})})]})}function Che({title:t,chartType:e,grouping:n,seriesCount:r,categoryCount:o,canEdit:i,onUpdateChartData:s}){let{t:a}=useTranslation(),l=rhe.has(e);return jsxs("div",{className:tr,children:[jsx("div",{className:er,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:Rn,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:Rn,value:e,onChange:c=>s({chartType:c.target.value}),children:Gpe.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:Rn,value:n??"clustered",onChange:c=>s({grouping:c.target.value}),children:Wpe.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]})]})}function Mhe({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,d=useCallback(D=>{n({chartData:D});},[n]),u=useCallback(D=>{if(r){if(D.chartType&&D.chartType!==r.chartType){let U=e3(r,D.chartType),{chartType:G,...j}=D;d({...U,...j});return}n({chartData:{...r,...D}});}},[r,n,d]),p=useCallback(D=>{r&&n({chartData:{...r,style:{...l,...D}}});},[r,l,n]),h=useCallback((D,U)=>{if(!r)return;let G=r.axes?[...r.axes]:[],j=G.findIndex(Y=>Y.axisType===D);j===-1?G.push({axisType:D,...U}):G[j]={...G[j],...U},u({axes:G});},[r,u]),f=useCallback((D,U)=>{if(!a)return;let G=a.map((j,Y)=>Y===D?{...j,...U}:j);u({series:G});},[a,u]),m=useCallback((D,U)=>{if(!a)return;let G=a.map((j,Y)=>Y===D?{...j,trendlines:U?[U]:[]}:j);u({series:G});},[a,u]),x=useCallback((D,U)=>{if(!a)return;let G=a.map((j,Y)=>Y===D?{...j,errBars:U?[U]:[]}:j);u({series:G});},[a,u]),g=useCallback((D,U)=>{f(D,{color:U??void 0});},[f]),y=useCallback((D,U)=>{if(!s)return;let G=s.map((j,Y)=>Y===D?U:j);u({categories:G});},[s,u]),b=useCallback((D,U,G)=>{if(!r)return;let j=Number.parseFloat(G);Number.isFinite(j)&&d(QD(r,D,U,j));},[r,d]),v=useCallback(()=>{!r||!s||d(t3(r,`Cat ${s.length+1}`));},[r,s,d]),S=useCallback(D=>{!r||!s||s.length<=1||d(n3(r,D));},[r,s,d]),w=useCallback(()=>{!r||!s||!a||d(ZD(r,{name:`Series ${a.length+1}`,values:s.map(()=>0)}));},[r,s,a,d]),C=useCallback(D=>{!r||!a||a.length<=1||d(JD(r,D));},[r,a,d]),T=useCallback(D=>{if(!r)return;let U={...t,chartData:structuredClone(r)};D(U),d(U.chartData);},[r,t,d]),M=useCallback((D,U)=>T(G=>U3(G,D,U)),[T]),_=useCallback((D,U)=>T(G=>$3(G,D,U)),[T]),E=useCallback((D,U,G)=>T(j=>H3(j,D,U,G)),[T]),R=useCallback((D,U)=>T(G=>z3(G,D,U)),[T]),I=useCallback((D,U)=>T(G=>V3(G,D,U)),[T]),L=useCallback((D,U,G)=>T(j=>W3(j,D,U,G)),[T]),k=useCallback((D,U,G)=>T(j=>X3(j,D,U,G)),[T]),F=useCallback((D,U,G)=>T(j=>j3(j,D,U,G)),[T]),N=useCallback((D,U,G)=>T(j=>Y3(j,D,U,G!==null?{text:G}:null)),[T]);return !r||!s||!a?null:jsxs(Fragment,{children:[jsx(Che,{title:o,chartType:i,grouping:c,seriesCount:a.length,categoryCount:s.length,canEdit:e,onUpdateChartData:u}),jsx(yhe,{style:l,canEdit:e,onUpdateStyle:p}),jsx(mhe,{style:l,canEdit:e,onUpdateStyle:p}),jsx(lhe,{axes:r.axes,canEdit:e,onUpdateAxis:h}),jsx(che,{axes:r.axes,canEdit:e,onSetLogScale:M,onSetTitleStyle:_,onSetGridlineStyle:E}),jsx(vhe,{chartType:i,series:a,canEdit:e,onSetMarker:R}),jsx(uhe,{chartType:i,series:a,canEdit:e,onSetSeriesType:I}),jsx(xhe,{chartType:i,categories:s,series:a,canEdit:e,onSetPointFill:L,onSetPointExplosion:k,onSetPointLabel:N}),jsx(ghe,{chartType:i,categories:s,series:a,canEdit:e,onSetPointMarker:F}),jsx(The,{chartType:i,series:a,canEdit:e,onSetTrendline:m}),jsx(bhe,{chartType:i,series:a,canEdit:e,onSetErrorBars:x}),jsx(whe,{series:a,canEdit:e,onSetColor:g}),jsx(fhe,{categories:s,series:a,canEdit:e,onUpdateSeries:f,onUpdateCategoryLabel:y,onUpdateValue:b,onAddCategory:v,onRemoveCategory:S,onAddSeries:w,onRemoveSeries:C})]})}bt();function _he({selectedElement:t,canEdit:e,onUpdateElementStyle:n}){return t.type!=="connector"?null:jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:ie(an,"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 Phe({selectedElement:t}){if(t.type!=="group")return null;let e=t;return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:"Group"}),jsx("div",{className:"text-[11px] text-muted-foreground",children:Array.isArray(e.children)?`${e.children.length} children`:"Grouped element"})]})}function Ehe({selectedElement:t}){let{t:e}=useTranslation();if(t.type!=="ole")return null;let n=t;return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:PD(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:ie("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 Ahe({selectedElement:t,canEdit:e,onUpdateElement:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,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 Rhe({canEdit:t,onMoveLayer:e}){return jsxs("div",{className:"flex gap-1",children:[jsx("button",{type:"button",className:ie("flex-1",xr),disabled:!t,onClick:()=>e("forward"),children:"\u2191 Forward"}),jsx("button",{type:"button",className:ie("flex-1",xr),disabled:!t,onClick:()=>e("backward"),children:"\u2193 Backward"})]})}Pe();function Ihe({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:dre.map(([i,s,a])=>{let l=i==="none"?!e?.artisticEffect:e?.artisticEffect===i;return jsxs("button",{type:"button",disabled:!n,className:ie("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 Nhe({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(Lo,{disabled:!e,value:et(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(Lo,{disabled:!e||!!o.clrToTransparent,value:et(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 Lhe({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(Lo,{disabled:!e,value:et(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 Ohe({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(d=>{i(d.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let d=c.current;if(!d)return;let u=()=>{s.current(d.value);};return d.addEventListener("change",u),()=>d.removeEventListener("change",u)},[]),jsx("input",{ref:c,type:"color",disabled:e,className:n,value:o,onChange:a,onBlur:l})}function Bhe({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o="imageEffects"in t?t.imageEffects:void 0,i=useCallback((c,d)=>{n({imageEffects:{...o,duotone:{color1:c,color2:d}}});},[o,n]),s=useCallback(()=>{n({imageEffects:{...o,duotone:void 0}});},[o,n]),a=et(o?.duotone?.color1,"#000000"),l=et(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(Ohe,{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(Ohe,{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:YU.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 Uhe({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(h=>{n({imageEffects:{...o,...h}});},[o,n]),d=useCallback(h=>{let f=Number(h.target.value);c({alphaModFix:100-f});},[c]),u=useCallback(h=>{c({biLevel:Number(h.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:d}),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:u}),jsx("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:a})]})]})]})}function JN({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 Hhe({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.imageEffects,i=s=>{n({imageEffects:{...o,...s}});};return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:ie(an,"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(JN,{label:"Brightness",disabled:!e,value:o?.brightness??0,onChange:s=>i({brightness:s})}),jsx(JN,{label:"Contrast",disabled:!e,value:o?.contrast??0,onChange:s=>i({contrast:s})}),jsx(JN,{label:r("pptx.image.saturation"),disabled:!e,value:o?.saturation??0,onChange:s=>i({saturation:s})})]}),jsx(Uhe,{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(Bhe,{selectedElement:t,canEdit:e,onUpdateElement:n})]}),jsx(Lhe,{fx:o,canEdit:e,updateEffects:i}),jsx(Nhe,{fx:o,canEdit:e,updateEffects:i}),jsx(Ihe,{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 Rat="text-[11px] uppercase tracking-wide text-muted-foreground",kat="rounded border border-border bg-card p-2 space-y-2",Iat="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",Nat="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",Lat="flex items-center justify-between gap-2",Xhe="text-muted-foreground";function QN(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 Ghe(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 Dat(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 Whe({label:t,valueMs:e,maxMs:n,disabled:r,onChange:o}){let[i,s]=useState(null),[a,l]=useState(false),c=i??QN(e),d=useCallback(()=>{s(QN(e)),l(false);},[e]),u=useCallback(()=>{if(i!==null){let f=Ghe(i);f!==void 0&&f>=0&&(n<=0||f<=n)&&o(f),l(false);}s(null);},[i,n,o]),p=useCallback(f=>{let m=f.target.value;s(m);let x=Ghe(m);l(x===void 0);},[]),h=useCallback(f=>{f.key==="Enter"?f.currentTarget.blur():f.key==="Escape"&&(s(null),l(false));},[]);return jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Xhe}`,children:t}),jsx("input",{type:"text",disabled:r,className:`${Iat} text-[11px] tabular-nums ${a?"border-red-400":""}`,value:c,placeholder:"00:00",onFocus:d,onBlur:u,onChange:p,onKeyDown:h})]})}function jhe({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 f=i,m=s>0?s:a;return m<=f||a<=0?QN(a):QN(m-f)},[i,s,a]),c=useMemo(()=>Dat(i,s,a),[i,s,a]),d=i>0||s>0,u=useCallback(f=>{r({trimStartMs:f});},[r]),p=useCallback(f=>{r({trimEndMs:f});},[r]),h=useCallback(()=>{r({trimStartMs:0,trimEndMs:0});},[r]);return jsxs("div",{className:kat,children:[jsxs("div",{className:Rat,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(Whe,{label:o("pptx.media.trimStartTime"),valueMs:i,maxMs:a,disabled:!e,onChange:u}),jsx(Whe,{label:o("pptx.media.trimEndTime"),valueMs:s,maxMs:a,disabled:!e,onChange:p})]}),jsxs("div",{className:Lat,children:[jsxs("span",{className:`text-[11px] ${Xhe}`,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&&d&&jsx("button",{type:"button",className:`${Nat} w-full text-center`,onClick:h,children:o("pptx.media.resetTrim")})]})}function Yh(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 Yhe(){return `bmk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var pv="text-[11px] uppercase tracking-wide text-muted-foreground",hv="rounded border border-border bg-card p-2 space-y-2",I2="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",e5="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",il="flex items-center justify-between gap-2",Ki="text-muted-foreground";function Khe({duration:t,trimStartMs:e,trimEndMs:n,currentTime:r,bookmarks:o,canEdit:i,onTrimChange:s,onSeek:a}){let l=useRef(null),[c,d]=useState(null),u=e/1e3,p=n>0?n/1e3:t,h=t>0?t:1,f=u/h*100,m=p/h*100,x=r/h*100,g=useCallback(b=>{let v=l.current;if(!v)return 0;let S=v.getBoundingClientRect();return Math.max(0,Math.min(1,(b-S.left)/S.width))*h},[h]);useEffect(()=>{if(!c)return;let b=S=>{let w=g(S.clientX);if(c==="start"){let C=Math.min(w,p-.1);s(Math.max(0,C)*1e3,n);}else {let C=Math.max(w,u+.1);s(e,Math.min(C,t)*1e3);}},v=()=>{d(null);};return window.addEventListener("pointermove",b),window.addEventListener("pointerup",v),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",v);}},[c,t,g,s,n,p,e,u]);let y=b=>{let v=g(b.clientX);a(v);};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:Yh(u)}),jsx("span",{children:Yh(p)})]}),jsxs("div",{ref:l,className:"relative h-5 rounded bg-muted cursor-pointer select-none",onClick:y,children:[jsx("div",{className:"absolute top-0 bottom-0 bg-primary/30 rounded",style:{left:`${f}%`,width:`${m-f}%`}}),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(${f}% - 4px)`},onPointerDown:b=>{b.stopPropagation(),d("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:b=>{b.stopPropagation(),d("end");}}),o.map(b=>{let v=b.time/h*100;return jsx("div",{className:"absolute top-0 bottom-0 w-1 bg-yellow-400/70 z-10 cursor-pointer",style:{left:`${v}%`},title:b.label,onClick:S=>{S.stopPropagation(),a(b.time);}},b.id)})]})]})}function Zhe({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),d=useCallback(()=>{let p=a.trim()||`${s("pptx.media.bookmark")} ${r.length+1}`,h={id:Yhe(),time:n,label:p};o({bookmarks:[...r,h]}),l("");},[r,n,a,o,s]),u=useCallback(p=>{o({bookmarks:r.filter(h=>h.id!==p)});},[r,o]);return jsxs(Fragment,{children:[jsxs("div",{className:hv,children:[jsx("div",{className:pv,children:s("pptx.media.playback")}),jsxs("label",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:s("pptx.media.speed")}),jsxs("select",{disabled:!e,className:`${I2} 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] ${Ki}`,children:s("pptx.media.fadeIn")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${I2} 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] ${Ki}`,children:s("pptx.media.fadeOut")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${I2} text-[11px]`,value:t.fadeOutDuration??0,onChange:p=>o({fadeOutDuration:Number(p.target.value)||void 0})})]})]}),jsxs("label",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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:hv,children:[jsxs("div",{className:pv,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,h)=>p.time-h.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:Yh(p.time)}),e&&jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-300 transition-opacity",onClick:()=>u(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:`${I2} text-[11px]`,placeholder:s("pptx.media.bookmarkLabel"),value:a,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),d());}}),jsx("button",{type:"button",className:e5,onClick:d,title:s("pptx.media.addBookmark"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function Qhe({element:t,mediaDataUrls:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=useRef(null),[s,a]=useState(false),[l,c]=useState(0),[d,u]=useState(0),p=t.mediaData??(t.mediaPath?e.get(t.mediaPath):void 0),h=t.bookmarks??[],f=t.mediaType==="video";useEffect(()=>{let v=i.current;if(!v)return;let S=()=>c(v.currentTime),w=()=>{Number.isFinite(v.duration)&&u(v.duration);},C=()=>a(true),T=()=>a(false),M=()=>a(false);return v.addEventListener("timeupdate",S),v.addEventListener("durationchange",w),v.addEventListener("loadedmetadata",w),v.addEventListener("play",C),v.addEventListener("pause",T),v.addEventListener("ended",M),()=>{v.removeEventListener("timeupdate",S),v.removeEventListener("durationchange",w),v.removeEventListener("loadedmetadata",w),v.removeEventListener("play",C),v.removeEventListener("pause",T),v.removeEventListener("ended",M);}},[p]);let m=useCallback(()=>{let v=i.current;v&&(v.paused?v.play():v.pause());},[]),x=useCallback(v=>{let S=i.current;S&&(S.currentTime=v,c(v));},[]),g=useCallback((v,S)=>{r({trimStartMs:v,trimEndMs:S});},[r]),[y,b]=useState(t.metadata);return useEffect(()=>{let v=i.current;if(!v)return;if(t.metadata?.duration!==void 0){b(t.metadata);return}let S=()=>{if(!Number.isFinite(v.duration)||v.duration===0)return;let w={duration:v.duration};v instanceof HTMLVideoElement&&(v.videoWidth>0&&(w.videoWidth=v.videoWidth),v.videoHeight>0&&(w.videoHeight=v.videoHeight));let C=v.querySelector("source");C?.type&&(w.codecInfo=C.type),t.metadata=w,b(w);};return v.addEventListener("loadedmetadata",S),v.readyState>=1&&S(),()=>{v.removeEventListener("loadedmetadata",S);}},[p,t]),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:hv,children:[jsx("div",{className:pv,children:o("pptx.media.title")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:o(f?"pptx.media.videoClip":"pptx.media.audioClip")}),p&&jsxs("div",{className:"space-y-1",children:[f?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:e5,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:[Yh(l)," / ",Yh(d)]})]})]}),d>0&&jsx(Khe,{duration:d,trimStartMs:t.trimStartMs??0,trimEndMs:t.trimEndMs??0,currentTime:l,bookmarks:h,canEdit:n,onTrimChange:g,onSeek:x})]}),jsx(jhe,{element:t,canEdit:n,durationSeconds:d,onUpdateElement:r}),(y||t.posterFrameData)&&jsxs("div",{className:hv,children:[jsxs("div",{className:pv,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] ${Ki}`,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"})]}),y?.duration!==void 0&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:o("pptx.media.duration")}),jsx("span",{className:"text-[11px] tabular-nums",children:Yh(y.duration)})]}),y?.videoWidth!==void 0&&y?.videoHeight!==void 0&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:o("pptx.media.resolution")}),jsxs("span",{className:"text-[11px] tabular-nums",children:[y.videoWidth," x ",y.videoHeight]})]}),y?.codecInfo&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,children:o("pptx.media.format")}),jsx("span",{className:"text-[11px] truncate max-w-[140px]",title:y.codecInfo,children:y.codecInfo})]}),t.mediaPath&&jsxs("div",{className:il,children:[jsx("span",{className:`text-[11px] ${Ki}`,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(Zhe,{element:t,canEdit:n,currentTime:l,bookmarks:h,onUpdateElement:r,onSeekTo:x})]})}bt();function efe({selectedElement:t,canEdit:e,onUpdateElement:n,onUpdateElementStyle:r,onUpdateTextStyle:o}){let{t:i}=useTranslation();return jsxs(Fragment,{children:[Jt(t)&&jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:i("pptx.shape.type","Shape Type")}),jsx("select",{value:t.shapeType||"rect",disabled:!e,className:ie(an,"w-full"),onChange:s=>n({shapeType:s.target.value}),children:Um.filter(s=>s.type!=="connector").map(s=>jsx("option",{value:s.type,children:s.label},s.type))})]}),Jt(t)&&jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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(Lo,{disabled:!e,value:et(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(Lo,{disabled:!e,value:et(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:an,min:0,max:20,value:t.shapeStyle?.strokeWidth??1,onChange:s=>r({strokeWidth:Number(s.target.value)})})]})]})]}),ze(t)&&jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,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(Lo,{disabled:!e,value:et(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(dG,{label:"B",active:!!t.textStyle?.bold,disabled:!e,onClick:()=>o({bold:!t.textStyle?.bold})}),jsx(dG,{label:"I",active:!!t.textStyle?.italic,disabled:!e,italic:true,onClick:()=>o({italic:!t.textStyle?.italic})}),jsx(dG,{label:"U",active:!!t.textStyle?.underline,disabled:!e,underline:true,onClick:()=>o({underline:!t.textStyle?.underline})})]})]})]})]})}function dG({label:t,active:e,disabled:n,italic:r,underline:o,onClick:i}){return jsx("button",{type:"button",disabled:n,className:ie("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})}bt();Pe();var Qat={venn:{min:2,max:3},matrix:{min:4,max:4},pyramid:{min:2,max:5},funnel:{min:2,max:5},target:{min:2,max:5},gear:{min:2,max:3},cycle:{min:3}},tfe={min:1};function uG(t){return t?Qat[t]??tfe:tfe}function pG(t,e){let{max:n}=uG(t);return n===void 0||e<n}function n5(t,e){let{min:n}=uG(t);return e>n}function nfe(t){let{min:e,max:n}=uG(t);if(!(e<=1&&n===void 0))return n===void 0?`Works best with at least ${e} items.`:e===n?`This layout uses exactly ${n} items.`:`Works best with ${e} to ${n} items.`}bt();function rfe(t,e){let n=jD(t,"",e);if(n===t)return;let r=n.nodes.findIndex(i=>i.id===e),o=r>=0?n.nodes[r+1]:void 0;return {data:n,focusNodeId:o?.id}}function ofe(t,e){if(t.nodes.length<=1)return;let n=t.nodes.findIndex(i=>i.id===e),r=cS(t,e);if(r===t)return;let o=r.nodes[Math.max(0,n-1)];return {data:r,focusNodeId:o?.id}}function ife(t,e){let n=qD(t,e);return n===t?void 0:n}function sfe(t,e){let n=KD(t,e);return n===t?void 0:n}function afe(t,e,n){let r=YD(t,e,n);return r===t?void 0:r}function lfe(t,e){let n=t.nodes.find(o=>o.id===e);return n?t.nodes.filter(o=>o.parentId===n.parentId).findIndex(o=>o.id===e):-1}function cfe(t,e){let n=t.nodes.find(r=>r.id===e);return n?t.nodes.filter(r=>r.parentId===n.parentId).length:0}bt();function elt(){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 tlt(){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 nlt(){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 rlt(){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 olt(){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 ilt(){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})]})}function slt(){return jsx("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:jsx("path",{d:"M4 3 L44 3 L28 16 L28 29 L20 29 L20 16 Z",fill:"currentColor",opacity:.7})})}function alt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"24",cy:"16",r:"14",fill:"currentColor",opacity:.3}),jsx("circle",{cx:"24",cy:"16",r:"9",fill:"currentColor",opacity:.5}),jsx("circle",{cx:"24",cy:"16",r:"4",fill:"currentColor",opacity:.8})]})}function llt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"16",cy:"16",r:"9",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"16",cy:"16",r:"3",fill:"white",opacity:.9}),jsx("circle",{cx:"33",cy:"16",r:"6",fill:"currentColor",opacity:.5}),jsx("circle",{cx:"33",cy:"16",r:"2",fill:"white",opacity:.9})]})}function clt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"19",cy:"16",r:"11",fill:"currentColor",opacity:.45}),jsx("circle",{cx:"29",cy:"16",r:"11",fill:"currentColor",opacity:.45})]})}function dlt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("path",{d:"M4 16 L44 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("circle",{cx:"10",cy:"16",r:"3",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"24",cy:"16",r:"3",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"38",cy:"16",r:"3",fill:"currentColor",opacity:.7}),jsx("rect",{x:"6",y:"4",width:"8",height:"6",rx:"1",fill:"currentColor",opacity:.5}),jsx("rect",{x:"34",y:"4",width:"8",height:"6",rx:"1",fill:"currentColor",opacity:.5})]})}function ult(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"14",cy:"16",r:"10",fill:"currentColor",opacity:.5}),jsx("circle",{cx:"34",cy:"16",r:"10",fill:"currentColor",opacity:.5}),jsx("path",{d:"M14 6 L34 26 M34 6 L14 26",stroke:"currentColor",strokeWidth:"1",opacity:.3})]})}function plt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("path",{d:"M2 8 L14 8 L20 16 L14 24 L2 24 L8 16 Z",fill:"currentColor",opacity:.7}),jsx("path",{d:"M17 8 L29 8 L35 16 L29 24 L17 24 L23 16 Z",fill:"currentColor",opacity:.7}),jsx("path",{d:"M32 8 L44 8 L44 24 L32 24 L38 16 Z",fill:"currentColor",opacity:.7})]})}function hlt(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"2",y:"3",width:"11",height:"9",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M13 7 L20 7 L20 16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:.5}),jsx("rect",{x:"19",y:"12",width:"11",height:"9",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M30 16 L37 16 L37 25",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:.5}),jsx("rect",{x:"35",y:"21",width:"11",height:"9",rx:"2",fill:"currentColor",opacity:.7})]})}var dfe={process:elt,hierarchy:tlt,cycle:nlt,matrix:rlt,pyramid:olt,list:ilt,funnel:slt,target:alt,gear:llt,venn:clt,timeline:dlt,relationship:ult,chevron:plt,bending:hlt};var mlt=f_.map(t=>({type:t,i18nKey:`pptx.smartart.category.${t}`}));function pfe({smartArtData:t,canEdit:e,onUpdateSmartArt:n}){let{t:r}=useTranslation(),o=t.resolvedLayoutType??"list",i=s=>{if(!e||s===o)return;let a=r3(t,s);n({layoutType:a.layoutType,resolvedLayoutType:a.resolvedLayoutType,layout:a.layout,drawingShapes:a.drawingShapes});};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:mlt.map(({type:s,i18nKey:a})=>{let l=o===s,c=dfe[s];return jsxs("button",{type:"button",disabled:!e,className:ie("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 glt="#3b82f6",xlt="#ffffff",hfe="px-1.5 py-0.5 text-[10px] rounded border transition-colors disabled:opacity-40 disabled:cursor-not-allowed";function ffe({nodeId:t,style:e,label:n,canEdit:r,onChangeStyle:o}){let i=!!e?.bold,s=!!e?.italic;return jsxs("div",{className:"flex items-center gap-1.5 mt-1 pl-4",role:"group","aria-label":`Style for ${n}`,children:[jsxs("label",{className:"flex items-center gap-0.5 text-[9px] text-muted-foreground",children:[jsx("span",{children:"Fill"}),jsx("input",{type:"color",disabled:!r,"aria-label":`Fill colour for ${n}`,className:"h-4 w-5 cursor-pointer rounded border border-border bg-transparent p-0 disabled:cursor-not-allowed",value:e?.fillColor??glt,onChange:a=>o(t,{fillColor:a.target.value})})]}),jsxs("label",{className:"flex items-center gap-0.5 text-[9px] text-muted-foreground",children:[jsx("span",{children:"Text"}),jsx("input",{type:"color",disabled:!r,"aria-label":`Font colour for ${n}`,className:"h-4 w-5 cursor-pointer rounded border border-border bg-transparent p-0 disabled:cursor-not-allowed",value:e?.fontColor??xlt,onChange:a=>o(t,{fontColor:a.target.value})})]}),jsx("button",{type:"button",disabled:!r,"aria-label":`Bold ${n}`,"aria-pressed":i,className:ie(hfe,"font-bold",i?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground"),onClick:()=>o(t,{bold:!i}),children:"B"}),jsx("button",{type:"button",disabled:!r,"aria-label":`Italic ${n}`,"aria-pressed":s,className:ie(hfe,"italic",s?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground"),onClick:()=>o(t,{italic:!s}),children:"I"})]})}var r5="text-[9px] text-muted-foreground hover:text-primary px-1 disabled:opacity-40 disabled:cursor-not-allowed";function mfe({nodeId:t,text:e,displayIndex:n,isChild:r,canEdit:o,removeDisabled:i,moveUpDisabled:s,moveDownDisabled:a,inputRef:l,style:c,onChangeText:d,onKeyDown:u,onAddSubItem:p,onMoveUp:h,onMoveDown:f,onRemove:m,onChangeStyle:x}){let g=r?`Sub-item: ${e||"empty"}`:`Item ${n}: ${e||"empty"}`;return jsxs("div",{role:"listitem",className:ie("rounded border bg-background/60 p-1.5",r?"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","aria-hidden":"true",children:r?"\u2022":`${n}`}),jsx("input",{ref:l,type:"text",disabled:!o,"aria-label":g,className:ie(an,"flex-1 text-[11px] py-0.5"),value:e,onChange:y=>d(t,y.target.value),onKeyDown:y=>u(y,t),placeholder:"Type here"}),jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[jsx("button",{type:"button",disabled:!o||s,className:r5,onClick:()=>h(t),"aria-label":`Move ${g} up`,title:"Move up",children:"\u2191"}),jsx("button",{type:"button",disabled:!o||a,className:r5,onClick:()=>f(t),"aria-label":`Move ${g} down`,title:"Move down",children:"\u2193"}),!r&&jsx("button",{type:"button",disabled:!o,className:r5,onClick:()=>p(t),"aria-label":`Add sub-item under ${g}`,title:"Add sub-item",children:"+Sub"}),jsx("button",{type:"button",disabled:!o||i,className:ie(r5,"hover:text-red-400"),onClick:()=>m(t),"aria-label":`Remove ${g}`,title:i?"Layout minimum reached":"Remove",children:"x"})]})]}),jsx(ffe,{nodeId:t,style:c,label:g,canEdit:o,onChangeStyle:x})]})}var blt=["colorful1","colorful2","colorful3","monochromatic1","monochromatic2"],vlt=["flat","moderate","intense"],Slt=new Set(["parOf","presParOf",void 0]);function gfe({smartArtData:t,canEdit:e,onUpdateElement:n,box:r}){let{t:o}=useTranslation(),i=t.nodes??[],s=t.resolvedLayoutType,a=i.filter(M=>!M.parentId).length,l=Qm.useRef(new Map),c=Qm.useRef(null);Qm.useEffect(()=>{let M=c.current;M&&(l.current.get(M)?.focus(),c.current=null);});let d=(M,_)=>{_&&(c.current=_);let E=r?CT(M,M.layout,UT(M),M.style??"flat","inspector",r):M;n({smartArtData:E});},u=M=>{d({...t,...M});},p=(M,_)=>{d(Lf(t,M,_));},h=(M,_)=>{let E=dS(t,M,_);E!==t&&d(E);},f=()=>{pG(s,a)&&d(d_(t));},m=M=>{d(d_(t,M,"Sub-item"));},x=M=>{!i.find(E=>E.id===M)?.parentId&&!n5(s,a)||d(cS(t,M));},g=(M,_)=>{let E=afe(t,M,_);E&&d(E,M);},y=(M,_)=>{let E=i.find(I=>I.id===_),R=!E?.text;if(M.key==="Enter"){M.preventDefault();let I=rfe(t,_);I&&d(I.data,I.focusNodeId);}else if((M.key==="Backspace"||M.key==="Delete")&&R){if(!E?.parentId&&!n5(s,a))return;M.preventDefault();let L=ofe(t,_);L&&d(L.data,L.focusNodeId);}else if(M.key==="Tab"&&!M.shiftKey){M.preventDefault();let I=ife(t,_);I&&d(I,_);}else if(M.key==="Tab"&&M.shiftKey){M.preventDefault();let I=sfe(t,_);I&&d(I,_);}},b=M=>_=>{_?l.current.set(M,_):l.current.delete(M);},v=nfe(s),S=!e||!pG(s,a),w=(t.connections??[]).filter(M=>!Slt.has(M.type)),C=Array.from(new Set(w.map(M=>M.type??"unknown"))).join(", "),T=0;return jsxs("div",{className:Zt,role:"group","aria-label":o("pptx.smartart.title"),children:[jsx("div",{className:Gt,children:o("pptx.smartart.title")}),jsxs("div",{className:"space-y-2",children:[jsx(pfe,{smartArtData:t,canEdit:e,onUpdateSmartArt:u}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.smartart.colorScheme")}),jsx("select",{disabled:!e,"aria-label":o("pptx.smartart.colorScheme"),className:ie(an,"w-full"),value:t.colorScheme??"colorful1",onChange:M=>u({colorScheme:M.target.value}),children:blt.map(M=>jsx("option",{value:M,children:M},M))})]}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.smartart.style")}),jsx("div",{className:"flex gap-1",role:"group","aria-label":o("pptx.smartart.style"),children:vlt.map(M=>jsx("button",{type:"button",disabled:!e,"aria-pressed":(t.style??"flat")===M,className:ie("flex-1 px-2 py-1 text-[10px] rounded border transition-colors",(t.style??"flat")===M?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground hover:bg-muted"),onClick:()=>u({style:M}),children:M},M))})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsxs("span",{className:"text-[11px] text-muted-foreground",children:[o("pptx.smartart.textPane")," (",i.length,")"]}),jsx("button",{type:"button",disabled:S,className:xr,onClick:f,title:S?v:void 0,children:o("pptx.smartart.addItem")})]}),v&&jsx("div",{className:"text-[9px] text-muted-foreground",role:"note",children:v}),jsx("div",{className:"max-h-52 overflow-y-auto space-y-1 pr-1",role:"list",children:i.map(M=>{let _=!!M.parentId;_||(T+=1);let E=lfe(t,M.id),R=cfe(t,M.id),I=i.length<=1||!_&&!n5(s,a);return jsx(mfe,{nodeId:M.id,text:M.text,displayIndex:T,isChild:_,canEdit:e,removeDisabled:I,moveUpDisabled:E<=0,moveDownDisabled:E<0||E>=R-1,inputRef:b(M.id),style:M.style,onChangeText:p,onKeyDown:y,onAddSubItem:m,onMoveUp:L=>g(L,-1),onMoveDown:L=>g(L,1),onRemove:x,onChangeStyle:h},M.id)})}),w.length>0&&jsxs("div",{className:"text-[9px] text-muted-foreground",role:"note","aria-label":`${w.length} non-tree relationship connection(s): ${C}`,children:[o("pptx.smartart.extraConnections",{count:w.length}),jsx("span",{className:"block opacity-80",children:C})]}),jsx("div",{className:"text-[9px] text-muted-foreground mt-1",children:o("pptx.smartart.tabHint")})]})]})}Pe();Pe();function xfe({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:$c,children:r("pptx.table.fillMode")}),jsx("select",{disabled:!e,className:oT,value:o,onChange:s=>i(s.target.value),children:J4.map(s=>jsx("option",{value:s.value??"",children:r(s.i18nKey)},s.value))})]}),o==="gradient"&&jsx(wlt,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),o==="pattern"&&jsx(Tlt,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),jsxs("div",{className:"space-y-1",children:[jsx("span",{className:Z4,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:$c,children:r(a)}),jsx("input",{type:"number",disabled:!e,className:iT,min:0,max:200,value:t[s]??0,onChange:l=>n({[s]:Number(l.target.value)})})]},s))})]})]})}function wlt({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.gradientFillStops??[],i=t.gradientFillType??"linear",s=(l,c)=>{let d=o.map((u,p)=>p===l?{...u,...c}:u);n({gradientFillStops:d});},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:$c,children:r("pptx.table.gradientType")}),jsx("select",{disabled:!e,className:oT,value:i,onChange:l=>n({gradientFillType:l.target.value}),children:Q4.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:$c,children:r("pptx.table.gradientAngle")}),jsx("input",{type:"number",disabled:!e,className:iT,min:0,max:360,value:t.gradientFillAngle??90,onChange:l=>n({gradientFillAngle:Number(l.target.value)})})]})]}),jsx("span",{className:$c,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:d=>s(c,{color:d.target.value})}),jsx("input",{type:"number",disabled:!e,className:iT,min:0,max:100,value:Math.round(l.position),onChange:d=>s(c,{position:Number(d.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 Tlt({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:$c,children:r("pptx.table.patternPreset")}),jsx("select",{disabled:!e,className:oT,value:t.patternFillPreset??"ltDnDiag",onChange:o=>n({patternFillPreset:o.target.value}),children:eU.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:$c,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:$c,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 yfe({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=d=>{let u=t.rows.map((p,h)=>h!==i?p:{...p,cells:p.cells.map((f,m)=>m!==s?f:{...f,style:{...l,...d}})});r({rows:u});};return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,min:6,max:200,value:l.fontSize??14,onChange:d=>c({fontSize:Number(d.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(Lo,{disabled:!n,value:et(l.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:d=>c({color:d})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.background")}),jsx(Lo,{disabled:!n,value:et(l.backgroundColor,"#ffffff"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:d=>c({backgroundColor:d})})]})]}),jsx(xfe,{cellStyle:l,canEdit:n,onUpdateCellStyle:c}),jsx("div",{className:"flex gap-1",children:[["bold","B","font-bold"],["italic","I","italic"],["underline","U","underline"]].map(([d,u,p])=>jsx("button",{type:"button",disabled:!n,className:ie("px-2 py-1 rounded text-[11px] transition-colors",p,l[d]?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({[d]:!l[d]}),children:u},d))}),jsx("div",{className:"flex gap-1",children:[["left","L"],["center","C"],["right","R"]].map(([d,u])=>jsx("button",{type:"button",disabled:!n,className:ie("px-2 py-1 rounded text-[11px] transition-colors",l.align===d?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({align:d}),children:u},d))}),jsx("div",{className:"flex gap-1",children:[["top","T"],["middle","M"],["bottom","B"]].map(([d,u])=>jsx("button",{type:"button",disabled:!n,className:ie("px-2 py-1 rounded text-[11px] transition-colors",l.vAlign===d?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({vAlign:d}),children:u},d))}),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(([d,u,p])=>jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:o(`pptx.table.border${d}`)}),jsxs("div",{className:"flex gap-1 items-center",children:[jsx(Lo,{disabled:!n,value:et(l[u],"#374151"),className:"w-7 h-6 rounded border border-border bg-transparent cursor-pointer shrink-0",onCommit:h=>c({[u]:h})}),jsx("input",{type:"number",disabled:!n,className:ie(an,"w-14"),min:0,max:10,value:l[p]??1,onChange:h=>c({[p]:Number(h.target.value)})})]})]},d))})]}),jsxs("div",{className:"grid grid-cols-3 gap-1",children:[jsx("button",{type:"button",disabled:!n,className:ie(xr,"text-center"),onClick:()=>{let d=j4(t,i,s);d&&r({rows:d});},children:o("pptx.table.mergeRight")}),jsx("button",{type:"button",disabled:!n,className:ie(xr,"text-center"),onClick:()=>{let d=Y4(t,i,s);d&&r({rows:d});},children:o("pptx.table.mergeDown")}),jsx("button",{type:"button",disabled:!n,className:ie(xr,"text-center"),onClick:()=>{let d=K4(t,i,s);d&&r({rows:d});},children:o("pptx.table.split")})]})]})]})}function bfe({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:Zt,children:[jsx("div",{className:Gt,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,d])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:!!i[c],onChange:u=>l({[c]:u.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:o(d)})]},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:Zt,children:[jsx("div",{className:Gt,children:o("pptx.table.stylePresets")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:q4.map(c=>jsx("button",{type:"button",disabled:!e,title:c.label,"aria-label":c.label,className:"rounded border border-border hover:border-primary overflow-hidden h-10 transition-colors",onClick:()=>{let d=i.rows.map((u,p)=>({...u,cells:u.cells.map(h=>({...h,style:{...h.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:h.style?.color,bold:p===0&&i.firstRowHeader?true:h.style?.bold,borderColor:c.borderColor}}))}));l({rows:d});},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:Zt,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:Gt,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,d)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:d+1}),jsx("input",{type:"range",disabled:!e,min:5,max:80,value:Math.round(c*100),className:"flex-1 accent-primary",onChange:u=>{let p=Number(u.target.value)/100,h=i.columnWidths[d],f=p-h,m=[...i.columnWidths];m[d]=p;let x=1-h;if(x>0)for(let b=0;b<m.length;b++)b!==d&&(m[b]=Math.max(.05,i.columnWidths[b]-f*(i.columnWidths[b]/x)));let g=m.reduce((b,v)=>b+v,0),y=m.map(b=>b/g);l({columnWidths:y});}}),jsxs("span",{className:"w-10 text-right text-muted-foreground",children:[Math.round(c*100),"%"]})]},d))})]}),jsxs("div",{className:Zt,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:Gt,children:o("pptx.table.rowHeights")}),jsx("button",{type:"button",className:xr,disabled:!e,onClick:()=>{let c=Math.round(i.rows.reduce((d,u)=>d+(u.height??32),0)/s);l({rows:i.rows.map(d=>({...d,height:c}))});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.rows.map((c,d)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:d+1}),jsx("input",{type:"number",disabled:!e,className:an,min:16,max:500,value:c.height??32,onChange:u=>{let p=i.rows.map((h,f)=>f===d?{...h,height:Number(u.target.value)}:h);l({rows:p});}}),jsx("span",{className:"w-6 text-muted-foreground",children:"px"})]},d))})]}),r&&jsx(yfe,{tableData:i,tableEditorState:r,canEdit:e,onUpdateTableData:l})]})}function vfe({selectedElement:t,canEdit:e,slides:n,tableEditorState:r,mediaDataUrls:o,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a,onMoveLayer:l}){let{t:c}=useTranslation(),d=!!(t.locks?.noMove||t.locks?.noSelect),u=()=>{e&&i(d?{locks:void 0}:{locks:{noMove:true,noResize:true,noSelect:true}});};return jsxs(Fragment,{children:[jsxs("div",{className:Zt,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:Gt,children:c("pptx.inspector.element")}),jsx("button",{type:"button",onClick:u,disabled:!e,title:c(d?"pptx.inspector.unlock":"pptx.inspector.lock"),className:"p-1 rounded hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":d,children:d?jsx(LuLock,{className:"w-3.5 h-3.5 text-amber-400"}):jsx(LuLockOpen,{className:"w-3.5 h-3.5 text-muted-foreground"})})]}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:Hpe.map(([p,h])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-4 text-muted-foreground",children:p}),jsx("input",{type:"number",className:an,disabled:!e,value:Math.round(t[h]??0),onChange:f=>i({[h]:Number(f.target.value)})})]},h))})]}),t.type==="table"&&jsx(bfe,{tableElement:t,canEdit:e,onUpdateElement:i,tableEditorState:r}),t.type==="chart"&&jsx(Mhe,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="smartArt"&&t.smartArtData&&jsx(gfe,{smartArtData:t.smartArtData,canEdit:e,onUpdateElement:i,box:{width:t.width,height:t.height}}),Vo(t)&&jsx(Hhe,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="media"&&jsx(Qhe,{element:t,mediaDataUrls:o??new Map,canEdit:e,onUpdateElement:i}),jsx(_he,{selectedElement:t,canEdit:e,onUpdateElementStyle:s}),jsx(Phe,{selectedElement:t}),jsx(Ehe,{selectedElement:t}),jsx(efe,{selectedElement:t,canEdit:e,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a}),jsx(Vpe,{selectedElement:t,slides:n,canEdit:e,onUpdateElement:i}),jsx(Ahe,{selectedElement:t,canEdit:e,onUpdateElement:i}),jsx(Rhe,{canEdit:e,onMoveLayer:l})]})}function xG({comment:t,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:d,onDeleteComment:u,onToggleCommentResolved:p,onStartReply:h,onCancelReply:f,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:g,depth:y=0}){let{t:b}=useTranslation(),v=r===t.id,S=i===t.id,w=s[t.id]??"",[C,T]=useState(true),M=t.replies??[],_=t.elementId?n?.elements?.find(E=>E.id===t.elementId)??null:null;return jsxs("div",{className:ie("rounded border border-border bg-card p-2",y>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"}),b("pptx.comments.resolved")]})]}),jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:oU(t.createdAt)})]}),t.elementId&&(_?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:b("pptx.comments.commentingOn",{element:ii(_)}),onClick:()=>g(_.id),children:[jsx(LuType,{className:"h-2.5 w-2.5"}),ii(_)]}):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:b("pptx.comments.deletedElement")})),v?jsxs("div",{className:"mt-1.5 space-y-1.5",children:[jsx("textarea",{value:o,onChange:E=>d(E.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:b("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:b("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:b("pptx.comments.edit"),children:jsx(LuPencil,{className:"h-3 w-3"})}),h&&y===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:()=>h(t.id),title:b("pptx.comments.reply"),children:jsx(LuReply,{className:"h-3 w-3"})}),p&&jsx("button",{type:"button",className:ie("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?b("pptx.comments.unresolve"):b("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:()=>u(t.id),title:b("pptx.comments.delete"),children:jsx(LuTrash2,{className:"h-3 w-3"})})]})]}),M.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:()=>T(E=>!E),children:[C?jsx(LuChevronDown,{className:"h-3 w-3"}):jsx(LuChevronRight,{className:"h-3 w-3"}),b("pptx.comments.repliesCount",{count:M.length})]}),C&&jsx("div",{className:"mt-1.5 space-y-1.5",children:M.map((E,R)=>jsx(xG,{comment:E,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:d,onDeleteComment:u,onToggleCommentResolved:p,onStartReply:h,onCancelReply:f,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:g,depth:y+1},`${E.id}-${R}`))})]}),S&&f&&m&&x&&jsxs("div",{className:"mt-2 space-y-1.5 pl-3 border-l-2 border-l-primary/40",children:[jsx("textarea",{value:w,onChange:E=>m(t.id,E.target.value),rows:2,placeholder:b("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:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.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:w.trim().length===0,children:[jsx(LuReply,{className:"h-3 w-3"}),b("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:f,children:b("pptx.comments.cancel")})]})]})]})}function Tfe({comments:t,canEdit:e,activeSlide:n,selectedElement:r,editingCommentId:o,commentEditDraft:i,commentDraft:s,replyingToCommentId:a,replyDraftByCommentId:l,onSetCommentDraft:c,onAddComment:d,onDeleteComment:u,onStartEditComment:p,onSaveEditComment:h,onCancelEditComment:f,onSetCommentEditDraft:m,onToggleCommentResolved:x,onStartReply:g,onCancelReply:y,onReplyDraftChange:b,onSubmitReply:v,onSelectElement:S}){let{t:w}=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:w("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:w("pptx.comments.noComments")}):jsx("div",{className:"space-y-2 max-h-[42vh] overflow-y-auto pr-1",children:t.map((T,M)=>jsx(xG,{comment:T,canEdit:e,activeSlide:n,editingCommentId:o,commentEditDraft:i,replyingToCommentId:a,replyDraftByCommentId:l,onStartEditComment:p,onSaveEditComment:h,onCancelEditComment:f,onSetCommentEditDraft:m,onDeleteComment:u,onToggleCommentResolved:x,onStartReply:g,onCancelReply:y,onReplyDraftChange:b,onSubmitReply:v,onSelectElement:S},`${T.id}-${M}`))}),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"}),w("pptx.comments.commentingOn",{element:ii(r)})]}),jsx("textarea",{rows:2,placeholder:r?w("pptx.comments.addOnElement",{element:ii(r)}):w("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:T=>c(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),d());}}),jsxs("button",{type:"button",onClick:d,disabled:!s.trim(),className:ie("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"}),w("pptx.comments.addComment")]})]})]})}function yG({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 i5({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:an,disabled:e,value:n,onChange:o=>r(o.target.value)})]})}function zlt({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:an,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:an,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:ie(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 Cfe({notesCanvasSize:t,notesMaster:e,handoutMaster:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:"Notes & Handout"}),jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[jsx(yG,{label:"Notes Size",value:t?`${t.width} \xD7 ${t.height}px`:"Not available"}),jsx(yG,{label:"Notes Master",value:e?`${e.placeholders?.length??0} placeholders`:"Not available"}),jsx(yG,{label:"Handout Master",value:n?`${n.placeholders?.length??0} placeholders`:"Not available"})]})]})}function Mfe({coreProperties:t,appProperties:e,customProperties:n,canEdit:r,onUpdateCoreProperties:o,onUpdateAppProperties:i,onUpdateCustomProperties:s}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:"Document"}),jsxs("div",{className:"space-y-2 text-[11px] text-muted-foreground",children:[jsx(i5,{label:"Title",disabled:!r,value:t?.title??"",onChange:a=>o({title:a})}),jsx(i5,{label:"Author",disabled:!r,value:t?.creator??"",onChange:a=>o({creator:a})}),jsx(i5,{label:"Company",disabled:!r,value:e?.company??"",onChange:a=>i({company:a})}),jsx(i5,{label:"Application",disabled:!r,value:e?.application??"",onChange:a=>i({application:a})}),jsx(zlt,{customProperties:n,canEdit:r,onUpdate:s})]})]})}function s5({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 _fe({presentationProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:ie(an,"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(s5,{label:"Loop Continuously",disabled:!e,checked:!!t.loopContinuously,onChange:r=>n({loopContinuously:r})}),jsx(s5,{label:"Show Narration",disabled:!e,checked:t.showWithNarration!==false,onChange:r=>n({showWithNarration:r})}),jsx(s5,{label:"Show Animation",disabled:!e,checked:t.showWithAnimation!==false,onChange:r=>n({showWithAnimation:r})}),jsx(s5,{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:ie(an,"w-20"),value:t.printSlidesPerPage??1,onChange:r=>n({printSlidesPerPage:Number(r.target.value)})})]})]})]})}function Pfe({themeOptions:t,selectedThemePath:e,setSelectedThemePath:n,canEdit:r,onApplyTheme:o}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,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 Efe({canvasSize:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,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:an,disabled:!e,value:t[o],onChange:i=>n({...t,[o]:Number(i.target.value)})})]},o))})]})}bt();var Afe={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 Rfe({activeSlide:t,theme:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=t?.clrMapOverride,s=UD(i),a=useMemo(()=>[...hc],[]),l=useCallback(u=>{if(u){let p={};for(let h of fc)p[h]=mc[h];r({clrMapOverride:p});}else r({clrMapOverride:void 0});},[r]),c=useCallback((u,p)=>{let f={...i??{},[u]:p};for(let m of fc)f[m]||(f[m]=mc[m]);r({clrMapOverride:f});},[i,r]),d=useCallback(u=>e?.colorScheme?e.colorScheme[u]: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:u=>l(u.target.checked)}),o("pptx.themeOverride.enableOverride")]}),s&&i&&jsx("div",{className:"space-y-1.5",children:fc.map(u=>{let p=i[u]??mc[u],h=d(p);return jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-24 truncate text-muted-foreground",title:Afe[u],children:Afe[u]}),jsx("div",{className:"h-4 w-4 rounded-sm border border-border shrink-0",style:{backgroundColor:h?`#${h.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:f=>c(u,f.target.value),children:a.map(f=>jsx("option",{value:f,children:f},f))})]},u)})})]}):null}function kfe({tagCollections:t,onUpdateTagCollections:e,canEdit:n}){let{t:r}=useTranslation(),[o,i]=useState(true),s=t.flatMap((d,u)=>d.tags.map((p,h)=>({...p,colIdx:u,tagIdx:h}))),a=(d,u,p,h)=>{let f=t.map((m,x)=>x!==d?m:{...m,tags:m.tags.map((g,y)=>y===u?{...g,[p]:h}:g)});e(f);},l=(d,u)=>{let p=t.map((h,f)=>f!==d?h:{...h,tags:h.tags.filter((m,x)=>x!==u)});e(p);},c=()=>{if(t.length===0)e([{path:"ppt/tags/tag1.xml",tags:[{name:"",value:""}]}]);else {let d=t.map((u,p)=>p!==0?u:{...u,tags:[...u.tags,{name:"",value:""}]});e(d);}};return jsxs("div",{className:Zt,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:Gt,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((d,u)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1 text-[11px]",children:[jsx("input",{type:"text",className:an,disabled:!n,placeholder:r("pptx.tags.name"),value:d.name,onChange:p=>a(d.colIdx,d.tagIdx,"name",p.target.value)}),jsx("input",{type:"text",className:an,disabled:!n,placeholder:r("pptx.tags.value"),value:d.value,onChange:p=>a(d.colIdx,d.tagIdx,"value",p.target.value)}),n&&jsx("button",{type:"button",className:ie(xr,"px-1.5 text-red-400 hover:text-red-300"),title:r("pptx.tags.deleteTag"),onClick:()=>l(d.colIdx,d.tagIdx),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},`${d.colIdx}-${d.tagIdx}-${u}`)),n&&jsx("button",{type:"button",className:xr,onClick:c,children:r("pptx.tags.addTag")})]})]})}function Ife({presentationProperties:t,canEdit:e,onUpdatePresentationProperties:n,themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,onApplyTheme:s,activeSlide:a,theme:l,onUpdateSlide:c,canvasSize:d,onUpdateCanvasSize:u,notesCanvasSize:p,notesMaster:h,handoutMaster:f,coreProperties:m,onUpdateCoreProperties:x,appProperties:g,onUpdateAppProperties:y,customProperties:b,onUpdateCustomProperties:v,tagCollections:S,onUpdateTagCollections:w}){let{t:C}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsx(_fe,{presentationProperties:t,canEdit:e,onUpdate:n}),jsx(Pfe,{themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,canEdit:e,onApplyTheme:s}),jsxs("div",{className:Zt,children:[jsx("div",{className:Gt,children:C("pptx.themeOverride.heading")}),jsx(Rfe,{activeSlide:a,theme:l,canEdit:e,onUpdateSlide:c})]}),jsx(Efe,{canvasSize:d,canEdit:e,onUpdate:u}),jsx(Cfe,{notesCanvasSize:p,notesMaster:h,handoutMaster:f}),jsx(Mfe,{coreProperties:m,appProperties:g,customProperties:b,canEdit:e,onUpdateCoreProperties:x,onUpdateAppProperties:y,onUpdateCustomProperties:v}),S&&w&&jsx(kfe,{tagCollections:S,onUpdateTagCollections:w,canEdit:e}),a&&jsxs("div",{className:ie(Zt,"space-y-1"),children:[jsx("div",{className:Gt,children:"Slide"}),jsxs("div",{className:"text-[11px] text-muted-foreground",children:[a.elements?.length??0," elements"]})]})]})}function Nfe({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:ie(Zt,"space-y-2"),children:[jsx("div",{className:Gt,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(Lo,{value:et(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 d=new FileReader;d.onload=()=>{typeof d.result=="string"&&n({backgroundImage:d.result});},d.readAsDataURL(c),l.target.value="";}}),jsx("button",{type:"button",className:ie(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:ie(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(Qlt,{activeSlide:t,slideMasters:o,canEdit:e,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s})]})}function Qlt({activeSlide:t,slideMasters:e,canEdit:n,onSetTemplateBackground:r,onGetTemplateBackgroundColor:o}){return jsxs("div",{className:ie(Zt,"space-y-2"),children:[jsx("div",{className:Gt,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(Lo,{value:et(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(Lo,{value:et(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 wG(t){let{isOpen:e,canEdit:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:d,onClose:u,onUpdateElement:p,onSelectElement:h,onMoveLayer:f,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:g,handoutMaster:y,notesCanvasSize:b,coreProperties:v,appProperties:S,customProperties:w,themeOptions:C,onUpdateCoreProperties:T,onUpdateAppProperties:M,onUpdateCustomProperties:_,tagCollections:E,onUpdateTagCollections:R,onApplyTheme:I,comments:L,commentDraft:k,editingCommentId:F,commentEditDraft:N,onSetCommentDraft:D,onAddComment:U,onDeleteComment:G,onStartEditComment:j,onSaveEditComment:Y,onCancelEditComment:ge,onSetCommentEditDraft:fe,onToggleCommentResolved:de,onStartReply:J,onCancelReply:re,onReplyDraftChange:ce,onSubmitReply:ae,replyingToCommentId:_e,replyDraftByCommentId:xe,onUpdateCanvasSize:Ee,onUpdateElementStyle:W,onUpdateTextStyle:q,onUpdateSlide:Q,editTemplateMode:se,slideMasters:me,onSetTemplateBackground:P,onGetTemplateBackgroundColor:A,mediaDataUrls:O,theme:z,panelWidth:te}=t,$=s!==null,{t:Me}=useTranslation(),{dragY:De,handlers:V}=Lu(u),[B,ee]=useState(""),oe=80,pe=500,Ae=220,[Le,ue]=useState(Ae),we=useCallback(Ie=>{ue(He=>Math.min(pe,Math.max(oe,He-Ie)));},[]);return useEffect(()=>{let Ie=me?.[0]?.themePath;if(Ie&&Ie.length>0){ee(Ie);return}let He=C[0]?.path??"";ee(Oe=>Oe||He);},[me,C]),jsxs(Fragment,{children:[e&&jsx("button",{type:"button","aria-label":Me("common.close"),onClick:u,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:ie("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",!te&&"md:w-72"),style:{...te?{width:te}:{},...De>0?{transform:`translateY(${De}px)`,transition:"none"}:{}},children:[jsx("div",{className:"md:hidden flex items-center justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing touch-none",onPointerDown:V.onPointerDown,onPointerMove:V.onPointerMove,onPointerUp:V.onPointerUp,onPointerCancel:V.onPointerCancel,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:$pe.map(({key:Ie,label:He,icon:Oe})=>jsxs("button",{type:"button",title:He,className:ie("flex items-center gap-1 px-2 py-1 rounded text-[11px] transition-colors",c===Ie?"bg-primary text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"),onClick:()=>d(Ie),children:[jsx(Oe,{className:"w-3.5 h-3.5"}),jsx("span",{className:"hidden sm:inline",children:He})]},Ie))}),jsx("button",{type:"button",onClick:u,title:Me("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:ie(Gt,"mb-2"),children:Me("pptx.inspector.layerOrder")}),r?[...r.elements||[]].reverse().map((Ie,He)=>{let Oe=(r.elements||[]).length-1-He,$e=s?.id===Ie.id||a.includes(Ie.id),ot=(ze(Ie)?(Ie.text||"").slice(0,24):void 0)||Ie.type;return jsxs("div",{title:`${Ie.type} \u2014 ${Ie.id}`,className:ie("flex items-center gap-2 px-2 py-1 rounded cursor-pointer transition-colors",$e?"bg-primary/30 text-primary":"hover:bg-muted text-foreground"),onClick:()=>h(Ie.id),children:[jsx("span",{className:"text-muted-foreground w-4 text-right",children:Oe+1}),jsx("span",{className:"flex-1 truncate",children:ot})]},Ie.id)}):jsx("div",{className:"text-muted-foreground italic",children:Me("pptx.inspector.noSlideSelected")})]}),c==="properties"&&jsx("div",{className:"space-y-3",children:$&&s?jsx(vfe,{selectedElement:s,canEdit:n,slides:o,tableEditorState:l,mediaDataUrls:O,onUpdateElement:p,onUpdateElementStyle:W,onUpdateTextStyle:q,onMoveLayer:f}):jsxs(Fragment,{children:[jsx(Ife,{canEdit:n,canvasSize:i,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:g,handoutMaster:y,notesCanvasSize:b,coreProperties:v,appProperties:S,customProperties:w,themeOptions:C,selectedThemePath:B,setSelectedThemePath:ee,onApplyTheme:I,onUpdateCoreProperties:T,onUpdateAppProperties:M,onUpdateCustomProperties:_,tagCollections:E,onUpdateTagCollections:R,onUpdateCanvasSize:Ee,activeSlide:r,theme:z,onUpdateSlide:Q}),r&&jsx(Nfe,{activeSlide:r,canEdit:n,onUpdateSlide:Q,editTemplateMode:se,slideMasters:me,onSetTemplateBackground:P,onGetTemplateBackgroundColor:A})]})}),c==="comments"&&jsx(Tfe,{comments:L,canEdit:n,activeSlide:r,selectedElement:s,editingCommentId:F,commentEditDraft:N,commentDraft:k,replyingToCommentId:_e??null,replyDraftByCommentId:xe??{},onSetCommentDraft:D,onAddComment:U,onDeleteComment:G,onStartEditComment:j,onSaveEditComment:Y,onCancelEditComment:ge,onSetCommentEditDraft:fe,onToggleCommentResolved:de,onStartReply:J,onCancelReply:re,onReplyDraftChange:ce,onSubmitReply:ae,onSelectElement:h})]}),$&&s&&r&&jsxs(Fragment,{children:[jsx(yu,{direction:"vertical",onResize:we}),jsx("div",{className:"border-t border-border p-3 overflow-y-auto flex-shrink-0",style:{height:Le},children:jsx(Upe,{selectedElement:s,activeSlide:r,canEdit:n,onUpdateSlide:Q})})]})]})]})}function ict(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 sct(t){switch(t){case "laser":return "none";case "pen":return "crosshair";case "highlighter":return "crosshair";case "eraser":return "crosshair";default:return "default"}}function CG({canvasSize:t,editorScale:e,presentationTool:n,annotationStrokes:r,currentStroke:o,laserPosition:i,onPointerDown:s,onPointerMove:a,onPointerUp:l,onLaserMove:c,onLaserLeave:d,onEraseAtPoint:u}){let p=useRef(null),h=useRef(false),f=useCallback((v,S)=>{let w=p.current;if(!w)return null;let C=w.getBoundingClientRect(),T=(v-C.left)/e,M=(S-C.top)/e;return {x:T,y:M}},[e]),m=useCallback(v=>{if(n==="none")return;v.preventDefault(),v.stopPropagation();let S=f(v.clientX,v.clientY);if(S){if(n==="eraser"){h.current=true,u(S.x,S.y);return}(n==="pen"||n==="highlighter")&&s(S.x,S.y);}},[n,f,s,u]),x=useCallback(v=>{if(n==="none")return;let S=f(v.clientX,v.clientY);if(S){if(n==="laser"){c(S.x,S.y);return}if(n==="eraser"&&h.current){u(S.x,S.y);return}(n==="pen"||n==="highlighter")&&a(S.x,S.y);}},[n,f,a,c,u]),g=useCallback(v=>{if(n!=="none"){if(v.preventDefault(),n==="eraser"){h.current=false;return}l();}},[n,l]),y=useCallback(()=>{n==="laser"&&d(),n==="eraser"&&(h.current=false),l();},[n,d,l]);if(n==="none")return null;let b=o?[...r,o]:r;return jsxs("div",{className:"absolute inset-0",style:{zIndex:60,cursor:sct(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:g,onPointerLeave:y,children:b.map(v=>jsx("path",{d:ict(v.points),fill:"none",stroke:v.color,strokeWidth:v.width,strokeLinecap:"round",strokeLinejoin:"round",opacity:v.opacity},v.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}})]})}Pe();var wct=["#ff0000","#0000ff","#00aa00","#ff8800","#ffffff","#000000","#ff00ff","#00cccc"],Tct=["#ffff00","#00ff00","#ff69b4","#00bfff","#ff8c00","#adff2f","#ff6347","#87ceeb"];function PG({presentationTool:t,penColor:e,highlighterColor:n,hasAnnotations:r,onSetTool:o,onSetPenColor:i,onSetHighlighterColor:s,onClearAnnotations:a,currentSlideIndex:l,totalSlides:c,onMovePresentationSlide:d,presentationStartTime:u,onEndPresentation:p,onTogglePresenterView:h,presenterMode:f}){let{t:m}=useTranslation(),[x,g]=useState(false),[y,b]=useState(false),v=useRef(null),[S,w]=useState(Date.now());useEffect(()=>{if(!u)return;let I=window.setInterval(()=>w(Date.now()),1e3);return ()=>window.clearInterval(I)},[u]);let C=u?S-u:0;useEffect(()=>{let I=L=>{v.current&&!v.current.contains(L.target)&&(g(false),b(false));};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let T=useCallback(I=>{o(I),g(false),b(false);},[o]),M=useCallback(I=>{I.preventDefault(),g(L=>!L),b(false);},[]),_=useCallback(I=>{I.preventDefault(),b(L=>!L),g(false);},[]),E=I=>`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${t===I?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,R="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:v,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:I=>I.stopPropagation(),children:[jsx("button",{type:"button",className:R,onClick:()=>d(-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:$U(l,c)}),jsx("button",{type:"button",className:R,onClick:()=>d(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:Xy(C)})]}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsx("button",{type:"button",className:E("laser"),onClick:()=>T("laser"),title:m("pptx.presentation.laserPointer"),children:jsx(LuMousePointer2,{size:18})}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:E("pen"),onClick:()=>T("pen"),onContextMenu:M,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:()=>{g(I=>!I),b(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:wct.map(I=>jsx("button",{type:"button","aria-label":`${m("pptx.presentation.pen")} ${I}`,className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${e===I?"border-white":"border-white/20"}`,style:{backgroundColor:I},onClick:()=>{i(I),g(false),t!=="pen"&&o("pen");}},I))})]}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:E("highlighter"),onClick:()=>T("highlighter"),onContextMenu:_,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:()=>{b(I=>!I),g(false);},title:`${m("pptx.presentation.highlighter")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),y&&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:Tct.map(I=>jsx("button",{type:"button","aria-label":`${m("pptx.presentation.highlighter")} ${I}`,className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${n===I?"border-white":"border-white/20"}`,style:{backgroundColor:I},onClick:()=>{s(I),b(false),t!=="highlighter"&&o("highlighter");}},I))})]}),jsx("button",{type:"button",className:E("eraser"),onClick:()=>T("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"}),h&&jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${f?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,onClick:h,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})})]})}function EG({currentSlideIndex:t,totalSlides:e,onMovePresentationSlide:n,onEndPresentation:r}){let{t:o}=useTranslation(),{isTouchDevice:i}=x2();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 RG({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,d=c.SpeechRecognition??c.webkitSpeechRecognition;if(!d){i("unsupported");return}i("supported");let u=new d;u.continuous=true,u.interimResults=true,u.lang=navigator.language||"en-US",u.onresult=p=>{let h="",f="";for(let x=p.resultIndex;x<p.results.length;x+=1){let g=p.results[x],y=g?.[0]?.transcript??"";g?.isFinal?h+=y:f+=y;}let m=`${h} ${f}`.trim();m.length>0&&r(m);},u.onerror=()=>{},u.onend=()=>{if(a.current)try{u.start();}catch{}},s.current=u;try{u.start();}catch{i("unsupported");}return ()=>{a.current=false,u.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 kG({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}Pe();var ll=.9,zfe=5;function IG({slideIndices:t,slides:e,frameSlides:n,maxPages:r=3}){let{t:o}=useTranslation(),i=useMemo(()=>gR(t),[t]),s=useMemo(()=>xR(),[]),a=i.slice(0,r),l=s.width*ll,c=s.height*ll;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(d=>{let p=!!e[d.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:d.slideArea.x*ll,top:d.slideArea.y*ll,width:d.slideArea.width*ll,height:d.slideArea.height*ll},children:jsx("span",{className:"text-[9px] font-medium text-gray-400",children:d.slideIndex+1})}),jsx("div",{className:"absolute left-1 right-1 border-b border-gray-200",style:{top:d.textArea.y*ll-1}}),jsx("div",{className:"absolute",style:{left:d.textArea.x*ll+4,top:d.textArea.y*ll,width:d.textArea.width*ll-8,height:d.textArea.height*ll},children:Array.from({length:zfe},(f,m)=>{let x=d.textArea.height*ll/(zfe+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)})})]},d.pageIndex)}),i.length>r&&jsx("span",{className:"text-[10px] text-muted-foreground",children:o("pptx.print.preview.morePages",{count:i.length-r})})]})}var yv=.9;function c5({slideIndices:t,slidesPerPage:e,orientation:n,frameSlides:r,maxPages:o=3}){let{t:i}=useTranslation(),s=useMemo(()=>hR(t,e,n),[t,e,n]),a=useMemo(()=>fR(n),[n]),l=s.slice(0,o),c=e===3,d=mR(),u=a.width*yv,p=a.height*yv,h=.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(f=>jsx("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:u,height:p,overflow:"hidden"},children:f.cells.map((m,x)=>{let g=m.slideIndex<0,y=m.x*yv,b=m.y*yv,v=m.width*yv,S=m.height*yv;return jsxs("div",{className:"absolute flex items-start",style:{left:y,top:b,gap:c?2:0},children:[jsx("div",{className:`flex items-center justify-center rounded-sm bg-gray-50 ${g?"opacity-30":""} ${r?"border-2 border-gray-800":"border border-gray-300"}`,style:{width:v,height:S},children:!g&&jsx("span",{className:"text-[9px] font-medium text-gray-400",children:m.slideIndex+1})}),c&&!g&&jsx("div",{className:"relative border-l border-gray-200 pl-1",style:{width:u*h,height:S},children:Array.from({length:d},(C,T)=>{let M=S/(d+1)*(T+1);return jsx("div",{className:"absolute left-1 right-0 border-b border-gray-200",style:{top:M}},T)})})]},x)})},f.pageIndex)),s.length>o&&jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptx.print.preview.morePages",{count:s.length-o})})]})}Pe();var ma=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 Xfe({printWhat:t,onPrintWhatChange:e,orientation:n,onOrientationChange:r,colorMode:o,onColorModeChange:i,frameSlides:s,onFrameSlidesChange:a,slidesPerPage:l,onSlidesPerPageChange:c,slideRange:d,onSlideRangeChange:u,customFrom:p,onCustomFromChange:h,customTo:f,onCustomToChange:m,totalSlides:x,activeSlideIndex:g}){let{t:y}=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:y("pptx.print.printWhat")}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("label",{className:ma(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"}),y("pptx.print.fullPageSlides")]}),jsxs("label",{className:ma(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"}),y("pptx.print.handouts")]}),jsxs("label",{className:ma(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"}),y("pptx.print.notesPages")]}),jsxs("label",{className:ma(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"}),y("pptx.print.outline")]})]})]}),t==="handouts"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:y("pptx.print.slidesPerPage")}),jsx("div",{className:"flex gap-1.5 flex-wrap",children:MT.map(b=>jsx("button",{type:"button",onClick:()=>c(b),className:`px-3 py-1.5 rounded-md text-sm font-medium border transition-colors ${l===b?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`,children:b},b))})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:y("pptx.print.slideRange")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:ma(d==="all"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="all",onChange:()=>u("all")}),y("pptx.print.allSlides")," (",x,")"]}),jsxs("label",{className:ma(d==="current"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="current",onChange:()=>u("current")}),y("pptx.print.currentSlide")," (",g+1,")"]}),jsxs("label",{className:ma(d==="custom"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="custom",onChange:()=>u("custom")}),y("pptx.print.customRange")]}),d==="custom"&&jsxs("div",{className:"flex items-center gap-2 pl-6",children:[jsx("span",{className:"text-xs text-muted-foreground",children:y("pptx.print.from")}),jsx("input",{type:"number",min:1,max:x,value:p,onChange:b=>h(Math.max(1,parseInt(b.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:y("pptx.print.to")}),jsx("input",{type:"number",min:1,max:x,value:f,onChange:b=>m(Math.max(1,parseInt(b.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:y("pptx.print.orientation")}),jsxs("div",{className:"flex gap-2",children:[jsxs("label",{className:ma(n==="landscape"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="landscape",onChange:()=>r("landscape")}),y("pptx.print.landscape")]}),jsxs("label",{className:ma(n==="portrait"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="portrait",onChange:()=>r("portrait")}),y("pptx.print.portrait")]})]})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:y("pptx.print.colorMode")}),jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxs("label",{className:ma(o==="color"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="color",onChange:()=>i("color")}),y("pptx.print.color")]}),jsxs("label",{className:ma(o==="grayscale"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="grayscale",onChange:()=>i("grayscale")}),y("pptx.print.grayscale")]}),jsxs("label",{className:ma(o==="blackAndWhite"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="blackAndWhite",onChange:()=>i("blackAndWhite")}),y("pptx.print.blackAndWhite")]})]})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:s,onChange:b=>a(b.target.checked),className:"rounded border-border"}),jsx("span",{className:"text-sm text-foreground",children:y("pptx.print.frameSlides")})]})]})}function NG({open:t,onClose:e,onPrint:n,slides:r,activeSlideIndex:o,defaultSlidesPerPage:i,defaultFrameSlides:s}){let{t:a}=useTranslation(),{panelStyle:l,handlers:c}=pi(e),[d,u]=useState("slides"),[p,h]=useState("landscape"),[f,m]=useState("color"),[x,g]=useState(s??false),[y,b]=useState(MT.includes(i)?i:6),[v,S]=useState("all"),[w,C]=useState(1),[T,M]=useState(r.length),_=useMemo(()=>d==="notes"||d==="outline"||d==="handouts"?"portrait":p,[d,p]),E=useMemo(()=>{if(v==="all")return r.length;if(v==="current")return 1;let k=Math.max(1,Math.min(w,r.length));return Math.max(k,Math.min(T,r.length))-k+1},[v,r.length,w,T]),R=useMemo(()=>d==="slides"||d==="notes"?E:d==="outline"?1:Math.ceil(E/y),[d,E,y]),I=useMemo(()=>{if(v==="current")return [o];if(v==="custom"){let k=Math.max(0,w-1),F=Math.min(r.length-1,T-1);return Array.from({length:Math.max(0,F-k+1)},(N,D)=>k+D)}return Array.from({length:r.length},(k,F)=>F)},[v,o,w,T,r.length]),L=useCallback(()=>{n({printWhat:d,orientation:_,colorMode:f,frameSlides:x,slidesPerPage:y,slideRange:v,customRangeFrom:Math.max(1,Math.min(w,r.length)),customRangeTo:Math.max(1,Math.min(T,r.length))});},[d,_,f,x,y,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",{style:l,className:"w-[780px] max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl flex flex-col max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...c,className:"flex items-center justify-between px-5 py-4 border-b border-border touch-none",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(Xfe,{printWhat:d,onPrintWhatChange:u,orientation:p,onOrientationChange:h,colorMode:f,onColorModeChange:m,frameSlides:x,onFrameSlidesChange:g,slidesPerPage:y,onSlidesPerPageChange:b,slideRange:v,onSlideRangeChange:S,customFrom:w,onCustomFromChange:C,customTo:T,onCustomToChange:M,totalSlides:r.length,activeSlideIndex:o}),d==="handouts"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(c5,{slideIndices:I,slidesPerPage:y,orientation:_,frameSlides:x})}),d==="notes"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(IG,{slideIndices:I,slides:r,frameSlides:x})})]}),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:E})}),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:L,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 Yfe({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 Kfe({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 LG({open:t,onClose:e,properties:n,onSave:r,customShows:o,slideCount:i}){let{t:s}=useTranslation(),[a,l]=useState({...n}),c=useCallback(h=>{l(f=>({...f,...h}));},[]),d=useCallback(()=>{r(a),e();},[a,r,e]);if(!t)return null;let u=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 flex flex-col w-[440px] max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",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:"flex-1 px-5 py-4 space-y-5 text-[12px] text-foreground 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(([h,f])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showType",value:h,checked:u===h,onChange:()=>c({showType:h,...h==="kiosk"?{loopContinuously:true}:{}}),className:"accent-primary"}),jsx("span",{children:f})]},h))]}),jsx(Kfe,{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(Yfe,{draft:a,update:c})]}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border shrink-0",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:d,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-[12px] text-white transition-colors",children:s("common.ok")})]})]})})]})}Pe();function UG({open:t,onClose:e,onStartBroadcast:n,onStopBroadcast:r,onStartPresenting:o,defaultRoomId:i,defaultUserName:s,defaultServerUrl:a}){let{t:l}=useTranslation(),c=No(),d=c!==null&&c.status!=="disconnected"&&c.status!=="error"&&c.config.role==="owner",[u,p]=useState(""),[h,f]=useState(""),[m,x]=useState(""),[g,y]=useState(false),b=useRef(null),{panelStyle:v,handlers:S}=pi(e);useEffect(()=>{if(t&&!d){let I=i?`broadcast-${i}`:Kne();p(I),f(s??""),x(a??Yne);}},[t,d,i,s,a]),useEffect(()=>{if(!t)return;function I(L){L.key==="Escape"&&e();}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[t,e]),useEffect(()=>{t&&b.current&&b.current.focus();},[t]);let w=d?c.config.roomId:u,C=d?c.config.serverUrl:m,T=typeof window<"u"?qne(w,C,window.location):w,M=useCallback(()=>{navigator.clipboard.writeText(T).then(()=>{y(true),setTimeout(()=>y(false),2e3);});},[T]),_=useCallback(()=>{if(!u.trim()||!h.trim())return;let I=m.trim();n?.({roomId:u.trim(),serverUrl:I,userName:h.trim(),role:"owner",transport:tR(I)}),setTimeout(()=>{o?.();},100),e();},[u,h,m,n,o,e]),E=useCallback(()=>{r?.(),e();},[r,e]),R=u.trim().length>0&&h.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:b,role:"dialog","aria-modal":"true","aria-label":l("pptx.broadcast.title"),tabIndex:-1,style:v,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...S,className:"flex items-center justify-between px-5 py-3 border-b border-border touch-none",children:[jsxs("h2",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[jsx(LuCast,{className:"w-4 h-4"}),l(d?"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:d?jsx(idt,{collab:c,broadcastUrl:T,copied:g,onCopyUrl:M,onStopBroadcast:E}):jsx(odt,{roomId:u,userName:h,serverUrl:m,onRoomIdChange:p,onUserNameChange:f,onServerUrlChange:x})}),!d&&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:!R,onClick:_,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 odt({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:n.trim().length===0?s("pptx.broadcast.p2pHint"):s("pptx.broadcast.hint")})]})}function idt({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")})]})}Pe();function Jfe(t){let e=t.trim().split(/\s+/u);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function eme(t){return t.transport==="webrtc"||!t.serverUrl?.trim()}function tme(t){if(typeof window>"u")return t.roomId;let e=`${window.location.origin}${window.location.pathname}`,n=encodeURIComponent(t.roomId);return eme(t)?`${e}?room=${n}&transport=webrtc`:`${e}?room=${n}&server=${encodeURIComponent(t.serverUrl??"")}`}function VG({open:t,onClose:e,activeCollaboration:n,onStartCollaboration:r,onStopCollaboration:o,preconfigured:i,defaultRoomId:s,defaultUserName:a,defaultServerUrl:l}){let c=No(),d=c!==null&&c.status!=="disconnected"&&c.status!=="error",{t:u}=useTranslation(),[p,h]=useState(s??""),[f,m]=useState(a??""),[x,g]=useState(l??""),[y,b]=useState(false),v=useRef(null),{panelStyle:S,handlers:w}=pi(e);useEffect(()=>{n&&(h(n.roomId),m(n.userName),g(n.serverUrl));},[n]),useEffect(()=>{if(!t)return;function _(E){E.key==="Escape"&&e();}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[t,e]),useEffect(()=>{t&&v.current&&v.current.focus();},[t]);let C=useCallback(()=>{let _=n??{roomId:p,serverUrl:x};navigator.clipboard.writeText(tme(_)).then(()=>{b(true),setTimeout(()=>b(false),2e3);});},[n,p,x]),T=useCallback(()=>{if(!p.trim()||!f.trim())return;let _=x.trim();r?.({roomId:p.trim(),serverUrl:_,userName:f.trim(),transport:tR(_)});},[p,f,x,r]),M=p.trim().length>0&&f.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":u("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:v,role:"dialog","aria-modal":"true","aria-label":u("pptx.share.title"),tabIndex:-1,style:S,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...w,className:"flex items-center justify-between px-5 py-3 border-b border-border touch-none",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:u(d?"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":u("pptx.share.close"),children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:d?jsx(pdt,{collab:c,activeCollaboration:n,copied:y,onCopyRoomId:C,onStopCollaboration:o}):jsx(udt,{roomId:p,userName:f,serverUrl:x,onRoomIdChange:h,onUserNameChange:m,onServerUrlChange:g,preconfigured:i,connectionFailed:c?.status==="error",onRetry:c?.retry})}),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:u(d?"pptx.share.close":"pptx.share.cancel")}),!d&&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:u("pptx.share.startSharing")})]})]})})]}):null}function udt({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i,preconfigured:s,connectionFailed:a,onRetry:l}){let{t:c}=useTranslation(),d=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:c(s?"pptx.share.preconfiguredDescription":"pptx.share.description")}),a&&jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-400",children:[jsx(LuWifiOff,{className:"w-4 h-4 mt-0.5 shrink-0"}),jsxs("div",{className:"flex-1 space-y-1",children:[jsx("p",{className:"font-medium",children:c("pptx.share.connectionError")}),l&&jsx("button",{type:"button",onClick:l,className:"underline underline-offset-2 hover:no-underline",children:c("pptx.collaboration.retry")})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-room-id",className:"block text-[12px] font-medium text-foreground",children:c("pptx.share.sessionName")}),jsx("input",{id:"share-room-id",type:"text","aria-label":c("pptx.share.sessionName"),value:t,onChange:u=>r(u.target.value),readOnly:s,placeholder:c("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${d}`}),jsx("p",{className:"text-[11px] text-muted-foreground",children:c("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:c("pptx.share.displayName")}),jsx("input",{id:"share-user-name",type:"text","aria-label":c("pptx.share.displayName"),value:e,onChange:u=>o(u.target.value),readOnly:s,placeholder:c("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${d}`})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-server-url",className:"block text-[12px] font-medium text-foreground",children:c("pptx.share.serverLabel")}),jsx("input",{id:"share-server-url",type:"text","aria-label":c("pptx.share.serverLabel"),value:n,onChange:u=>i(u.target.value),readOnly:s,placeholder:c("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${d}`})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:n.trim().length===0?c("pptx.share.p2pHint"):c("pptx.share.serverHint")})]})}function pdt({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:tme(t.config)}),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:eme(t.config)?i("pptx.share.p2pServerValue"):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:Jfe(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"}):Jfe(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")})]})}function nme({targetType:t,url:e,setUrl:n,tooltip:r,setTooltip:o,emailAddress:i,setEmailAddress:s,emailSubject:a,setEmailSubject:l,slideNumber:c,setSlideNumber:d,slideCount:u,filePath:p,setFilePath:h,actionVerb:f,setActionVerb:m,inputRef:x,inputCls:g,onEnterConfirm:y}){let{t:b}=useTranslation(),v=S=>{S.key==="Enter"&&y();};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:b("pptx.hyperlink.urlLabel")}),jsx("input",{ref:x,type:"url",className:g,placeholder:"https://example.com",value:e,onChange:S=>n(S.target.value),onKeyDown:v})]}),t==="email"&&jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.emailLabel")}),jsx("input",{ref:x,type:"email",className:g,placeholder:"user@example.com",value:i,onChange:S=>s(S.target.value),onKeyDown:v})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.subjectLabel")}),jsx("input",{type:"text",className:g,value:a,onChange:S=>l(S.target.value)})]})]}),t==="slide"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.slideLabel")}),jsx("input",{ref:x,type:"number",min:1,max:u,className:g,value:c,onChange:S=>d(parseInt(S.target.value,10)||1),onKeyDown:v}),jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:b("pptx.hyperlink.slideRange",{max:u})})]}),t==="file"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.fileLabel")}),jsx("input",{ref:x,type:"text",className:g,placeholder:"../documents/file.docx",value:p,onChange:S=>h(S.target.value),onKeyDown:v})]}),t==="action"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.actionLabel")}),jsxs("select",{className:g,value:f,onChange:S=>m(S.target.value),children:[jsx("option",{value:"nextSlide",children:b("pptx.hyperlink.actionNextSlide")}),jsx("option",{value:"prevSlide",children:b("pptx.hyperlink.actionPrevSlide")}),jsx("option",{value:"firstSlide",children:b("pptx.hyperlink.actionFirstSlide")}),jsx("option",{value:"lastSlide",children:b("pptx.hyperlink.actionLastSlide")}),jsx("option",{value:"endShow",children:b("pptx.hyperlink.actionEndShow")})]})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:b("pptx.hyperlink.tooltipLabel")}),jsx("input",{type:"text",className:g,value:r,onChange:S=>o(S.target.value)})]})]})}function GG({open:t,initialUrl:e,initialTooltip:n,initialAction:r,slideCount:o,onConfirm:i,onCancel:s}){let{t:a}=useTranslation(),{panelStyle:l,handlers:c}=pi(s),d=useRef(null),u=Ude(e,r),p=$de(e||""),h=Hde(e,r),f=r&&cN[r.toLowerCase()]||"nextSlide",[m,x]=useState(u),[g,y]=useState(u==="email"||u==="slide"||u==="action"?"":e||""),[b,v]=useState(n||""),[S,w]=useState(p.address),[C,T]=useState(p.subject),[M,_]=useState(h),[E,R]=useState(u==="file"&&e||""),[I,L]=useState(f);if(useEffect(()=>{t&&setTimeout(()=>d.current?.focus(),50);},[t]),!t)return null;let k=()=>{i({targetType:m,url:g,tooltip:b,emailAddress:S,emailSubject:C,slideNumber:M,filePath:E,actionVerb:I});},F=D=>ie("px-3 py-1.5 text-xs rounded-t border-b-2 transition-colors",D?"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",{style:l,className:"pointer-events-auto w-[440px] rounded-lg border border-border bg-popover shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",onClick:D=>D.stopPropagation(),children:[jsxs("div",{...c,className:"flex items-center justify-between px-4 py-3 border-b border-border touch-none",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:F(m==="url"),onClick:()=>x("url"),children:a("pptx.hyperlink.tabUrl")}),jsx("button",{type:"button",className:F(m==="email"),onClick:()=>x("email"),children:a("pptx.hyperlink.tabEmail")}),jsx("button",{type:"button",className:F(m==="slide"),onClick:()=>x("slide"),children:a("pptx.hyperlink.tabSlide")}),jsx("button",{type:"button",className:F(m==="file"),onClick:()=>x("file"),children:a("pptx.hyperlink.tabFile")}),jsx("button",{type:"button",className:F(m==="action"),onClick:()=>x("action"),children:a("pptx.hyperlink.tabAction")})]}),jsx(nme,{targetType:m,url:g,setUrl:y,tooltip:b,setTooltip:v,emailAddress:S,setEmailAddress:w,emailSubject:C,setEmailSubject:T,slideNumber:M,setSlideNumber:_,slideCount:o,filePath:E,setFilePath:R,actionVerb:I,setActionVerb:L,inputRef:d,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:k}),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:k,children:a("common.apply")})]})]})})]})}function rme({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 ome({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 ime({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 sme({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 lme({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=iU(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 cme({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=>Dc(l.width,l.height).map(d=>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+d.x-5,top:l.y+d.y-5,width:10,height:10,pointerEvents:"auto",zIndex:56},onMouseDown:u=>o(l.id,d.index,u),onMouseUp:()=>r?s(l.id,d.index):void 0},`${l.id}-site-${d.index}`))),r&&jsx(Sdt,{activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r})]})}function Sdt({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r}){let o=t.elements.find(f=>f.id===r.startElementId);if(!o)return null;let i=Dc(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 d=c.getBoundingClientRect(),u=n.editorScale||1,p=(r.currentX-d.left)/u,h=(r.currentY-d.top)/u;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:h,stroke:"#3b82f6",strokeWidth:2,strokeDasharray:"6 4",strokeLinecap:"round"})})}function ume({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 pme({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}Pe();var XG=Qm.memo(({ticks:t,widthPx:e,highlight:n})=>jsxs("svg",{width:e,height:gn,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:e,height:gn,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:0,y1:gn-.5,x2:e,y2:gn-.5,className:"stroke-border",strokeWidth:1}),n&&jsx("rect",{x:n.start,y:0,width:Math.max(n.end-n.start,1),height:gn,className:"fill-primary/20"}),t.map((r,o)=>{let i=r.isMajor?gn*.6:gn*.3;return jsxs("g",{children:[jsx("line",{x1:r.position,y1:gn,x2:r.position,y2:gn-i,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:r.isMajor?1:.5}),r.label&&jsx("text",{x:r.position+2,y:$y+1,fontSize:$y,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:r.label})]},o)})]}));XG.displayName="HorizontalRuler";var jG=Qm.memo(({ticks:t,heightPx:e,highlight:n})=>jsxs("svg",{width:gn,height:e,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:gn,height:e,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:gn-.5,y1:0,x2:gn-.5,y2:e,className:"stroke-border",strokeWidth:1}),n&&jsx("rect",{x:0,y:n.start,width:gn,height:Math.max(n.end-n.start,1),className:"fill-primary/20"}),t.map((r,o)=>{let i=r.isMajor?gn*.6:gn*.3;return jsxs("g",{children:[jsx("line",{x1:gn,y1:r.position,x2:gn-i,y2:r.position,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:r.isMajor?1:.5}),r.label&&jsx("text",{x:2,y:r.position+$y+2,fontSize:$y,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:r.label})]},o)})]}));jG.displayName="VerticalRuler";function mme({canvasSize:t,editorScale:e,unit:n,visible:r,selectedBounds:o,onCreateGuideFromRuler:i}){let s=useMemo(()=>zA(t.width,e,n),[t.width,e,n]),a=useMemo(()=>zA(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]),[d,u]=useState(null),p=useRef(null),h=useRef(null),f=useCallback(b=>{i&&(b.preventDefault(),b.currentTarget.setPointerCapture(b.pointerId),u({axis:"h",pointerId:b.pointerId}));},[i]),m=useCallback(b=>{i&&(b.preventDefault(),b.currentTarget.setPointerCapture(b.pointerId),u({axis:"v",pointerId:b.pointerId}));},[i]),x=useCallback(b=>{if(!d||!i)return;try{b.currentTarget.releasePointerCapture(d.pointerId);}catch{}let v=e||1;if(d.axis==="h"){let S=p.current;if(!S){u(null);return}let w=S.getBoundingClientRect(),C=b.clientY-w.top;if(C>gn){let T=(C-gn)/v;T>=0&&T<=t.height&&i("h",T);}}else {let S=h.current;if(!S){u(null);return}let w=S.getBoundingClientRect(),C=b.clientX-w.left;if(C>gn){let T=(C-gn)/v;T>=0&&T<=t.width&&i("v",T);}}u(null);},[d,i,e,t]);if(!r)return null;let g=t.width*e,y=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:gn,height:gn}}),jsx("div",{ref:p,className:"absolute z-[50] overflow-visible",style:{top:0,left:gn,width:g,height:gn,cursor:i?"row-resize":void 0},onPointerDown:f,onPointerUp:x,children:jsx(XG,{ticks:s,widthPx:g,highlight:l})}),jsx("div",{ref:h,className:"absolute z-[50] overflow-visible",style:{top:gn,left:0,width:gn,height:y,cursor:i?"col-resize":void 0},onPointerDown:m,onPointerUp:x,children:jsx(jG,{ticks:a,heightPx:y,highlight:c})})]})}function bv(t){let e=t.target;for(;e;){if(e.dataset?.pptxElement==="true")return e.dataset.elementId||null;e=e.parentElement;}return null}var Adt=300;function Rdt(t,e){return t===e}function yme({cbRef:t,onCanvasMouseDown:e,findResults:n,findResultIndex:r,activeSlideIndex:o,selectedElement:i,zoom:s,onMoveGuide:a}){let l=useMemo(()=>{let w=new Map;if(!n||n.length===0||o===null)return w;for(let C=0;C<n.length;C++){let T=n[C];if(T.slideIndex!==o)continue;w.has(T.elementId)||w.set(T.elementId,new Map);let M=w.get(T.elementId);M.has(T.segmentIndex)||M.set(T.segmentIndex,[]),M.get(T.segmentIndex).push({startOffset:T.startOffset,length:T.length,isCurrent:C===(r??-1)});}return w},[n,r,o]),c=useMemo(()=>i?{x:i.x,y:i.y,width:i.width,height:i.height}:null,[i]),d=useCallback(w=>{let C=bv(w);C&&t.current.onClick(C,w);},[t]),u=useCallback(w=>{let C=bv(w);C&&t.current.onDoubleClick(C,w);},[t]),p=useRef(false),h=useCallback(w=>{if(p.current){p.current=false;return}let C=bv(w);if(C){t.current.onMouseDown(C,w);return}e?.(w);},[t,e]),f=useCallback(w=>{Rdt(w.target,w.currentTarget)&&e?.(w);},[e]),m=useRef(null),x=useCallback(w=>{if(w.pointerType==="mouse")return;p.current=true,w.currentTarget.setPointerCapture?.(w.pointerId);let C=bv(w);if(C){let T=w.timeStamp||Date.now(),M=m.current;if(M&&M.id===C&&T-M.time<Adt){m.current=null,t.current.onDoubleClick(C,w);return}m.current={id:C,time:T},t.current.onMouseDown(C,w);return}m.current=null,e?.(w);},[t,e]),g=useCallback(w=>{let C=bv(w);C&&t.current.onContextMenu(C,w);},[t]),[y,b]=useState(null),v=useCallback(w=>{if(!y||!a)return;let C=s.canvasStageRef.current;if(!C)return;let T=C.getBoundingClientRect(),M=s.editorScale||1,_=y.axis==="h"?(w.clientY-T.top)/M:(w.clientX-T.left)/M;a(y.id,_);},[y,a,s.canvasStageRef,s.editorScale]),S=useCallback(w=>{if(y){try{w.currentTarget.releasePointerCapture(y.pointerId);}catch{}b(null);}},[y]);return {elementFindHighlightsMap:l,selectedBounds:c,handleStageClick:d,handleStageDblClick:u,handleStageMouseDown:h,handleViewportMouseDown:f,handleStagePointerDown:x,handleStageContextMenu:g,draggingGuide:y,setDraggingGuide:b,handleStagePointerMove:v,handleStagePointerUp:S}}function bme({activeSlide:t,zoom:e,onCreateConnector:n}){let[r,o]=useState(null),i=useCallback((c,d,u)=>{u.stopPropagation(),u.preventDefault(),o({startElementId:c,startSiteIndex:d,currentX:u.clientX,currentY:u.clientY});},[]),s=useCallback(c=>{r&&o(d=>d?{...d,currentX:c.clientX,currentY:c.clientY}:null);},[r]),a=useCallback((c,d)=>{if(!r||!n)return;if(r.startElementId===c){o(null);return}let u=t?.elements.find(_=>_.id===r.startElementId),p=t?.elements.find(_=>_.id===c);if(!u||!p){o(null);return}let h=Dc(u.width,u.height),f=Dc(p.width,p.height),m=h[r.startSiteIndex]??h[0],x=f[d]??f[0],g=u.x+m.x,y=u.y+m.y,b=p.x+x.x,v=p.y+x.y,S=Math.abs(b-g),w=Math.abs(v-y),C=Math.sqrt(S*S+w*w),T=C<100?"straightConnector1":C<300?"bentConnector3":"curvedConnector3",M={id:`conn-new-${Date.now()}`,type:"connector",x:Math.min(g,b),y:Math.min(y,v),width:Math.abs(b-g)||1,height:Math.abs(v-y)||1,shapeType:T,shapeStyle:{strokeColor:"#4472C4",strokeWidth:2,connectorStartConnection:{shapeId:r.startElementId,connectionSiteIndex:r.startSiteIndex},connectorEndConnection:{shapeId:c,connectionSiteIndex:d}}};n(M),o(null);},[r,n,t?.elements]),l=useCallback(()=>{o(null);},[]);return {connectorDragState:r,handleConnectionSiteDown:i,handleConnectorDragMove:s,handleConnectionSiteDrop:a,handleConnectorDragEnd:l}}function vme({activeTool:t,activeSlide:e,zoom:n,drawingColor:r,drawingWidth:o,isDrawingRef:i,onAddInkElement:s,onAddFreeformShape:a,onEraseInkElement:l}){let c=t!=="select",[d,u]=useState([]),[p,h]=useState([]),[f,m]=useState(false),x=useCallback(w=>{let C=n.canvasStageRef.current;if(!C)return null;let T=C.getBoundingClientRect(),M=n.editorScale||1;return {x:(w.clientX-T.left)/M,y:(w.clientY-T.top)/M}},[n.canvasStageRef,n.editorScale]),g=useCallback(w=>{if(w.length===0)return "";let C=[`M ${w[0].x} ${w[0].y}`];for(let T=1;T<w.length;T++)C.push(`L ${w[T].x} ${w[T].y}`);return C.join(" ")},[]),y=useCallback(w=>{if(t==="select")return;if(t==="eraser"&&e){let T=x(w);if(!T)return;let M=15;for(let _ of [...e.elements].reverse())if(_.type==="ink"&&T.x>=_.x-M&&T.x<=_.x+_.width+M&&T.y>=_.y-M&&T.y<=_.y+_.height+M){l?.(_.id);break}return}let C=x(w);C&&(w.preventDefault(),w.target.setPointerCapture(w.pointerId),u([C]),h([w.pressure]),m(true),i&&(i.current=true));},[t,e,x,i,l]),b=useCallback(w=>{if(!f||t==="select"||t==="eraser")return;let C=x(w);C&&(u(T=>[...T,C]),h(T=>[...T,w.pressure]));},[f,t,x]),v=useCallback(w=>{if(!f||t==="select"||t==="eraser")return;if(w.target.releasePointerCapture(w.pointerId),m(false),i&&(i.current=false),d.length<2){u([]);return}let C=1/0,T=1/0,M=-1/0,_=-1/0;for(let k of d)k.x<C&&(C=k.x),k.y<T&&(T=k.y),k.x>M&&(M=k.x),k.y>_&&(_=k.y);let E=o;C-=E,T-=E,M+=E,_+=E;let R=Math.max(M-C,1),I=Math.max(_-T,1),L=d.map(k=>({x:k.x-C,y:k.y-T}));if(t==="freeform"){let F=Math.round(R*100),N=Math.round(I*100),D=[];for(let G=0;G<L.length;G++){let j={x:Math.round(L[G].x*100),y:Math.round(L[G].y*100)};D.push(G===0?{type:"moveTo",pt:j}:{type:"lineTo",pt:j});}D.length>2&&D.push({type:"close"});let U={id:`shape-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"shape",x:C,y:T,width:R,height:I,shapeType:"custom",shapeStyle:{fillColor:"transparent",strokeColor:r,strokeWidth:o},customGeometryPaths:[{width:F,height:N,segments:D}]};a?.(U);}else {let k=g(L),F=t==="highlighter",N=p.length>=2&&p.some(U=>Math.abs(U-p[0])>.01),D={id:`ink-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"ink",x:C,y:T,width:R,height:I,inkPaths:[k],inkColors:[r],inkWidths:[o],inkOpacities:[F?.4:1],inkTool:F?"highlighter":"pen",...N?{inkPointPressures:[p]}:{}};s?.(D);}u([]),h([]);},[f,t,d,r,o,i,s,a,g,p]),S=useMemo(()=>f?g(d):"",[f,d,g]);return {isDrawing:c,isStrokeActive:f,liveStrokeD:S,currentStrokePoints:d,handleDrawPointerDown:y,handleDrawPointerMove:b,handleDrawPointerUp:v}}function Sme(t){let e=useRef(t);e.current=t;let n=useCallback((f,m,x)=>e.current.onResizePointerDown(f,m,x),[]),r=useCallback((f,m)=>e.current.onAdjustmentPointerDown(f,m),[]),o=useCallback((f,m)=>e.current.onRotate?.(f,m),[]),i=useCallback(f=>e.current.onInlineEditChange(f),[]),s=useCallback(()=>e.current.onInlineEditCommit(),[]),a=useCallback(()=>e.current.onInlineEditCancel(),[]),l=useCallback((f,m)=>e.current.onTableCellSelect(f,m),[]),c=useCallback((f,m,x,g)=>e.current.onCommitCellEdit?.(f,m,x,g),[]),d=useCallback((f,m)=>e.current.onUpdateSmartArtElement?.(f,m),[]),u=useCallback(f=>e.current.onFormatText?.(f),[]),p=useCallback((f,m)=>e.current.onResizeTableColumns?.(f,m),[]),h=useCallback((f,m,x)=>e.current.onResizeTableRow?.(f,m,x),[]);return {cbRef:e,stableResizePointerDown:n,stableAdjustmentPointerDown:r,stableRotate:o,stableInlineEditChange:i,stableInlineEditCommit:s,stableInlineEditCancel:a,stableTableCellSelect:l,stableCommitCellEdit:c,stableUpdateSmartArtElement:d,stableFormatText:u,stableResizeTableColumns:p,stableResizeTableRow:h}}function qG({activeSlide:t,templateElements:e,canvasSize:n,zoom:r,mode:o,canEdit:i,editTemplateMode:s,selectedElementIdSet:a,selectedElement:l,inlineEditingElementId:c,inlineEditingText:d,spellCheckEnabled:u,mediaDataUrls:p,tableEditorState:h,marqueeSelectionState:f,snapLines:m,showGrid:x,gridSpacingPx:g,showRulers:y,rulerUnit:b="inches",guides:v,presentationElementStates:S,presentationKeyframesCss:w,onClick:C,onDoubleClick:T,onMouseDown:M,onContextMenu:_,onCanvasMouseDown:E,onResizePointerDown:R,onAdjustmentPointerDown:I,onRotate:L,onInlineEditChange:k,onInlineEditCommit:F,onInlineEditCancel:N,onTableCellSelect:D,onCommitCellEdit:U,onUpdateSmartArtElement:G,onFormatText:j,onResizeTableColumns:Y,onResizeTableRow:ge,findResults:fe,findResultIndex:de,activeSlideIndex:J,activeTool:re="select",drawingColor:ce="#000000",drawingWidth:ae=3,isDrawingRef:_e,onAddInkElement:xe,onAddFreeformShape:Ee,onEraseInkElement:W,onActionClick:q,onHyperlinkClick:Q,comments:se,showCommentMarkers:me=false,onCommentMarkerClick:P,onMoveGuide:A,onDeleteGuide:O,onCreateGuideFromRuler:z,connectorCreationMode:te=false,onCreateConnector:$,allSlides:Me,onZoomClick:De,sourceSlideIndex:V,fieldContext:B,tableStyleContext:ee,collaborationOverlay:oe}){let pe=(o==="edit"||o==="master")&&i,{cbRef:Ae,stableResizePointerDown:Le,stableAdjustmentPointerDown:ue,stableRotate:we,stableInlineEditChange:Ie,stableInlineEditCommit:He,stableInlineEditCancel:Oe,stableTableCellSelect:$e,stableCommitCellEdit:ot,stableUpdateSmartArtElement:at,stableFormatText:gt,stableResizeTableColumns:le,stableResizeTableRow:Ue}=Sme({onClick:C,onDoubleClick:T,onMouseDown:M,onContextMenu:_,onResizePointerDown:R,onAdjustmentPointerDown:I,onRotate:L,onInlineEditChange:k,onInlineEditCommit:F,onInlineEditCancel:N,onTableCellSelect:D,onCommitCellEdit:U,onUpdateSmartArtElement:G,onFormatText:j,onResizeTableColumns:Y,onResizeTableRow:ge}),{elementFindHighlightsMap:Te,selectedBounds:Ve,handleStageClick:Fe,handleStageDblClick:ke,handleStageMouseDown:nt,handleViewportMouseDown:st,handleStagePointerDown:Xn,handleStageContextMenu:Cn,setDraggingGuide:Zi,handleStagePointerMove:bs,handleStagePointerUp:m0}=yme({cbRef:Ae,onCanvasMouseDown:E,findResults:fe,findResultIndex:de,activeSlideIndex:J,selectedElement:l,zoom:r,onMoveGuide:A}),{connectorDragState:Pv,handleConnectionSiteDown:g0,handleConnectorDragMove:sf,handleConnectionSiteDrop:Ev,handleConnectorDragEnd:x0}=bme({activeSlide:t,zoom:r,onCreateConnector:$}),{isDrawing:y0,isStrokeActive:pl,liveStrokeD:af,handleDrawPointerDown:vs,handleDrawPointerMove:rp,handleDrawPointerUp:b0}=vme({activeTool:re,activeSlide:t,zoom:r,drawingColor:ce,drawingWidth:ae,isDrawingRef:_e,onAddInkElement:xe,onAddFreeformShape:Ee,onEraseInkElement:W}),lf=y?gn:0;return jsx("div",{ref:r.canvasViewportRef,"data-pptx-viewport":true,className:"flex-1 overflow-auto relative",style:{touchAction:"pan-x pan-y"},onMouseDown:st,children:jsxs("div",{ref:r.editWrapperRef,className:"relative mx-auto my-4",style:{width:n.width*r.editorScale+lf,height:n.height*r.editorScale+lf},children:[jsx(mme,{canvasSize:n,editorScale:r.editorScale,unit:b,visible:y,selectedBounds:Ve,onCreateGuideFromRuler:z}),jsxs("div",{ref:r.canvasStageRef,role:"region","aria-label":`Slide ${(J??0)+1}`,"aria-roledescription":"slide",className:"relative shadow-2xl",style:{width:n.width,height:n.height,transform:`scale(${r.editorScale})`,transformOrigin:"top left",marginTop:lf,marginLeft:lf,touchAction:pe?"none":void 0,backgroundColor:t?.backgroundColor&&t.backgroundColor!=="transparent"?t.backgroundColor:"#ffffff"},onClick:Fe,onDoubleClick:ke,onMouseDown:nt,onPointerDown:pe?Xn:void 0,onContextMenu:Cn,onPointerMove:bs,onPointerUp:m0,children:[w&&jsx("style",{children:w}),jsx(pme,{canvasSize:n,gridSpacingPx:g,visible:x}),jsx(rme,{guides:v,onDeleteGuide:O,onStartGuideDrag:Zi}),jsx(ome,{backgroundImage:t?.backgroundImage,backgroundGradient:t?.backgroundGradient}),e.map((Tr,v0)=>jsx(fk,{element:Tr,activeSlide:t,isSelected:a.has(Tr.id),isInlineEditing:c===Tr.id,inlineEditingText:d,canInteract:(o==="edit"||o==="master")&&i&&s,spellCheckEnabled:u,mediaDataUrls:p,selectionColorClass:"blue-400",showHoverBorder:false,opacity:.95,templateEditing:s,zIndex:v0,imageAltText:"Template element",showResizeHandles:pe&&a.has(Tr.id)&&a.size<=1&&!c,renderInk:false,renderGroups:false,adjustmentHandleDescriptor:pe&&l?.id===Tr.id?xT(Tr):null,onResizePointerDown:Le,onAdjustmentPointerDown:ue,onRotate:we,onInlineEditChange:Ie,onInlineEditCommit:He,onInlineEditCancel:Oe,onUpdateSmartArtElement:at,onFormatText:gt,onActionClick:q,onHyperlinkClick:Q,animationState:S?.get(Tr.id),presentationElementStates:S,allSlides:Me,onZoomClick:De,sourceSlideIndex:V,fieldContext:B,tableStyleContext:ee},`tpl-${Tr.id}`)),t?.elements.map((Tr,v0)=>jsx(fk,{element:Tr,activeSlide:t,isSelected:a.has(Tr.id),isInlineEditing:c===Tr.id,inlineEditingText:d,canInteract:pe,spellCheckEnabled:u,mediaDataUrls:p,tableEditorState:h,selectionColorClass:"blue-500",showHoverBorder:true,zIndex:e.length+v0,imageAltText:"Slide element",showResizeHandles:pe&&a.has(Tr.id)&&a.size<=1&&!c,renderInk:true,renderGroups:true,adjustmentHandleDescriptor:pe&&l?.id===Tr.id?xT(Tr):null,onResizePointerDown:Le,onAdjustmentPointerDown:ue,onRotate:we,onInlineEditChange:Ie,onInlineEditCommit:He,onInlineEditCancel:Oe,onUpdateSmartArtElement:at,onFormatText:gt,onTableCellSelect:$e,onCommitCellEdit:ot,onResizeTableColumns:le,onResizeTableRow:Ue,findHighlights:Te.get(Tr.id),onActionClick:q,onHyperlinkClick:Q,animationState:S?.get(Tr.id),presentationElementStates:S,allSlides:Me,onZoomClick:De,sourceSlideIndex:V,fieldContext:B,tableStyleContext:ee},Tr.id)),jsx(ime,{marqueeSelectionState:f}),me&&se&&se.length>0&&jsx(lme,{comments:se,canvasSize:n,onCommentMarkerClick:P}),jsx(sme,{snapLines:m}),te&&t&&jsx(cme,{activeSlide:t,canvasSize:n,zoom:r,connectorDragState:Pv,onConnectionSiteDown:g0,onConnectorDragMove:sf,onConnectionSiteDrop:Ev,onConnectorDragEnd:x0}),y0&&jsx(ume,{canvasSize:n,activeTool:re,drawingColor:ce,drawingWidth:ae,isStrokeActive:pl,liveStrokeD:af,onPointerDown:vs,onPointerMove:rp,onPointerUp:b0}),oe]})]})})}function JG({isShortcutHelpOpen:t,isAccessibilityPanelOpen:e,showSlideSorter:n,accessibilityIssues:r,slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onCloseShortcuts:c,onCloseAccessibility:d,onSelectSlide:u,onMoveSlide:p,onDeleteSlides:h,onDuplicateSlides:f,onToggleHideSlides:m,onCloseSorter:x,reducedMotion:g,onToggleReducedMotion:y}){return t||e||n?jsxs(Fragment,{children:[t&&jsx(w6,{isOpen:t,onClose:c}),e&&jsx(T6,{isOpen:e,issues:r,onClose:d,reducedMotion:g,onToggleReducedMotion:y}),n&&jsx(KH,{slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onSelectSlide:u,onMoveSlide:p,onDeleteSlides:h,onDuplicateSlides:f,onToggleHideSlides:m,onClose:x})]}):null}function eW({activeSlide:t,allSlides:e,isSlideNotesCollapsed:n,canEdit:r,slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,onToggleNotes:l,onUpdateNotes:c,collaborationSlot:d,notesPanelHeight:u,onResizeBottom:p,scale:h,onZoomIn:f,onZoomOut:m,onZoomToFit:x,mode:g,onSetMode:y,onToggleSlideSorter:b,hideStatusBar:v=false}){return jsxs(Fragment,{children:[p&&!n&&jsx(yu,{direction:"vertical",onResize:p}),jsx(ez,{activeSlide:t,allSlides:e,isExpanded:!n,canEdit:r,onToggle:l,onUpdateNotes:c,panelHeight:u}),!v&&jsx(_6,{slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,scale:h,onZoomIn:f,onZoomOut:m,onZoomToFit:x,isNotesExpanded:!n,onToggleNotes:l,mode:g,onSetMode:y,onToggleSlideSorter:b,collaborationSlot:d})]})}function tW({isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,effectiveSelectedIds:a,tableEditorState:l,sidebarPanelMode:c,activeSlideIndex:d,comments:u,onSetSidebarPanelMode:p,onClose:h,onUpdateElementStyle:f,onUpdateTextStyle:m,onUpdateElement:x,onApplySelection:g,onSetCanvasSize:y,onMoveLayer:b,onMoveLayerToEdge:v,onDeleteElement:S,onUpdateSlide:w,presentationProperties:C,onUpdatePresentationProperties:T,notesMaster:M,handoutMaster:_,notesCanvasSize:E,coreProperties:R,appProperties:I,customProperties:L,themeOptions:k,onUpdateCoreProperties:F,onUpdateAppProperties:N,onUpdateCustomProperties:D,tagCollections:U,onUpdateTagCollections:G,onApplyTheme:j,editTemplateMode:Y,slideMasters:ge,onSetTemplateBackground:fe,onGetTemplateBackgroundColor:de,mediaDataUrls:J,theme:re,panelWidth:ce}){if(!t)return null;let ae=c;if(!s&&ae!=="comments"&&ae!=="properties")return null;let _e=r?.id??"",xe=u.commentDraftBySlideId[_e]??"",Ee=u.editingCommentIdBySlideId[_e]??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:ce?{width:ce}:void 0,children:jsx(wG,{isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:W=>p(W),onClose:h,onUpdateElementStyle:f,onUpdateTextStyle:m,onUpdateElement:x,onUpdateSlide:w,onSelectElement:W=>g(W),onMoveLayer:b,onMoveLayerToEdge:v,onDeleteElement:S,comments:r?.comments??[],presentationProperties:C,onUpdatePresentationProperties:T,notesMaster:M,handoutMaster:_,notesCanvasSize:E,coreProperties:R,appProperties:I,customProperties:L,themeOptions:k,onUpdateCoreProperties:F,onUpdateAppProperties:N,onUpdateCustomProperties:D,tagCollections:U,onUpdateTagCollections:G,onApplyTheme:j,commentDraft:xe,editingCommentId:Ee,commentEditDraft:Ee?u.commentEditDraftByCommentId[Ee]??"":"",onSetCommentDraft:W=>u.handleCommentDraftChange(_e,W),onAddComment:()=>u.handleAddSlideComment(d),onDeleteComment:W=>u.handleDeleteSlideComment(d,W),onStartEditComment:W=>u.handleStartCommentEdit(_e,W),onSaveEditComment:W=>u.handleSaveCommentEdit(d,W),onCancelEditComment:()=>u.handleCancelCommentEdit(_e),onSetCommentEditDraft:W=>u.handleSetCommentEditDraft(u.editingCommentIdBySlideId[_e]??"",W),onToggleCommentResolved:W=>u.handleToggleCommentResolved(d,W),onStartReply:W=>u.handleStartReply(d,W),onCancelReply:u.handleCancelReply,onReplyDraftChange:(W,q)=>u.handleReplyDraftChange(W,q),onSubmitReply:W=>u.handleSubmitReply(d,W),replyingToCommentId:u.replyingToCommentId,replyDraftByCommentId:u.replyDraftByCommentId,onUpdateCanvasSize:y,editTemplateMode:Y,slideMasters:ge,onSetTemplateBackground:fe,onGetTemplateBackgroundColor:de,mediaDataUrls:J,theme:re,panelWidth:ce})})}function Cme(t,e){if(!e?.layoutPath||!t.some(d=>d.masterPath))return t;let o=t.find(d=>d.path===e.layoutPath)?.masterPath;if(!o)return t;let i=t.filter(d=>d.masterPath===o),s=new Map;for(let d of i){let u=d.path===e.layoutPath;(!s.get(d.name)||u)&&s.set(d.name,d);}let a=new Set(Array.from(s.values()).map(d=>d.path)),l=[],c=new Set;for(let d of i)a.has(d.path)&&(c.has(d.name)||(c.add(d.name),l.push(d)));return l}Pe();function _me(t){let{t:e}=useTranslation(),n=(t.mode==="edit"||t.mode==="master")&&t.canEdit,r=ure({autosaveState:t.autosaveStatus?.state??"idle",isDirty:t.isDirty,autosaveEnabled:t.autosaveEnabled,disabledReason:t.autosaveStatus?.state==="disabled"?t.autosaveStatus.reason:void 0});return jsxs("div",{className:Fn.container,"data-pptx-title-bar":"",children:[jsx("span",{className:Fn.logo,"aria-hidden":"true",children:"P"}),n&&jsxs(Fragment,{children:[jsxs("span",{className:Fn.autosaveGroup,children:[jsx("span",{className:Fn.autosaveLabel,children:e("pptx.titleBar.autoSave")}),jsx("button",{type:"button",role:"switch","aria-checked":t.autosaveEnabled,onClick:t.onToggleAutosave,className:ie(Fn.toggleTrack,t.autosaveEnabled?Fn.toggleTrackOn:Fn.toggleTrackOff),title:e("pptx.titleBar.toggleAutoSave"),"aria-label":e("pptx.titleBar.toggleAutoSave"),children:jsx("span",{className:ie(Fn.toggleKnob,t.autosaveEnabled?Fn.toggleKnobOn:Fn.toggleKnobOff)})}),jsx("span",{className:Fn.autosaveLabel,children:e(t.autosaveEnabled?"pptx.titleBar.autoSaveOn":"pptx.titleBar.autoSaveOff")})]}),jsx("div",{className:Fn.separator}),t.onSave&&jsx("button",{type:"button",onClick:t.onSave,className:Fn.quickButton,title:e("pptx.titleBar.save"),"aria-label":e("pptx.titleBar.save"),children:jsx(LuSave,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:t.onUndo,disabled:!t.canUndo,className:Fn.quickButton,title:t.undoLabel?e("pptx.toolbar.undoAction",{action:t.undoLabel}):e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:t.onRedo,disabled:!t.canRedo,className:Fn.quickButton,title:t.redoLabel?e("pptx.toolbar.redoAction",{action:t.redoLabel}):e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:"w-3.5 h-3.5"})}),jsx("div",{className:Fn.separator})]}),jsxs("span",{className:Fn.fileGroup,children:[jsx("span",{className:Fn.fileName,children:t.fileName||e(pre)}),n&&jsxs(Fragment,{children:[jsx("span",{className:Fn.statusDot,"aria-hidden":"true",children:"\u2022"}),jsx("span",{className:ie(Fn.statusText,t.autosaveStatus?.state==="error"&&t.autosaveEnabled&&Fn.statusError,t.autosaveStatus?.state==="saving"&&t.autosaveEnabled&&Fn.statusSaving),children:e(r)})]})]}),jsx("span",{className:Fn.searchWrap,children:(t.mode==="edit"||t.mode==="master")&&jsxs("button",{type:"button",onClick:t.onToggleFindReplace,className:ie(Fn.searchBox,t.findReplaceOpen&&"text-foreground bg-background"),title:e("pptx.findReplace.title"),"aria-label":e("pptx.titleBar.search"),children:[jsx(LuSearch,{className:Fn.searchIcon}),jsx("span",{className:Fn.searchLabel,children:e("pptx.titleBar.search")})]})}),jsx("span",{className:Fn.rightSpacer})]})}function nW(t){let{mode:e,canEdit:n,state:r,selectedElement:o,activeSlide:i,zoom:s,history:a,findReplace:l,manipulation:c,insertHandlers:d,exportHandlers:u,printHandlers:p,propertyHandlers:h,dialogs:f,slideOps:m,ops:x,onSetMode:g,onEnterPresenterView:y,onEnterRehearsalMode:b,onOpenSettings:v,onOpenShareDialog:S,onOpenFile:w,onToggleFormatPainter:C,fileName:T,autosaveStatus:M,autosaveEnabled:_=true,onToggleAutosave:E}=t,R=useCallback((N,D)=>{if(!o||!i)return;let U=i.animations??[],G=U.find(Y=>Y.elementId===o.id),j=N;if(G){let Y=U.map(ge=>ge.elementId===o.id?{...ge,[D]:j}:ge);h.handleUpdateSlide({animations:Y});}else {let Y={elementId:o.id,[D]:j,durationMs:500,order:U.length,trigger:"onClick"};h.handleUpdateSlide({animations:[...U,Y]});}},[o,i,h]),I=useCallback(()=>{if(!o||!i)return;let D=(i.animations??[]).filter(U=>U.elementId!==o.id);h.handleUpdateSlide({animations:D});},[o,i,h]),L=useCallback(N=>{if(!i)return;let D=i.transition??{type:"none"};h.handleUpdateSlide({transition:{...D,...N}});},[i,h]),k=Qm.useMemo(()=>Cme(r.layoutOptions,i),[r.layoutOptions,i]),F=useCallback(()=>{let N=i?.transition;N&&(x.updateSlides(D=>D.map(U=>({...U,transition:N}))),a.markDirty());},[i,x,a]);return jsxs(Fragment,{children:[!f.isNarrowViewport&&jsx(_me,{mode:e,canEdit:n,fileName:T,isDirty:r.isDirty,autosaveStatus:M,autosaveEnabled:_,onToggleAutosave:E??(()=>{}),canUndo:a.canUndo,canRedo:a.canRedo,undoLabel:a.undoLabel,redoLabel:a.redoLabel,onUndo:a.handleUndo,onRedo:a.handleRedo,onSave:u.handleSaveAsPptx,findReplaceOpen:l.findReplaceOpen,onToggleFindReplace:()=>l.setFindReplaceOpen(!l.findReplaceOpen)}),jsx(nG,{mode:e,canEdit:n,isNarrowViewport:f.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:g,onToggleSidebar:()=>r.setIsSlidesPaneOpen(N=>!N),onToggleInspector:()=>r.setIsInspectorPaneOpen(N=>!N),onOpenAnimationPanel:()=>{r.setIsInspectorPaneOpen(true),r.setSidebarPanelMode("properties");},onAddAnimation:R,onRemoveAnimation:I,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:d.handleAddTextBox,onAddShape:d.handleAddShape,onAddTable:d.handleAddTable,onAddChart:d.handleAddChart,onAddSmartArt:()=>f.setIsSmartArtDialogOpen(true),onAddEquation:()=>{f.setEditingEquationOmml(null),f.setIsEquationDialogOpen(true);},onAddActionButton:d.handleAddActionButton,onInsertField:d.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:f.handleAddGuide,onAlignElements:c.handleAlignElements,onDistributeElements:c.handleDistributeElements,canDistribute:c.canDistribute,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:u.handleExportPng,onExportPdf:u.handleExportPdf,onExportVideo:u.handleExportVideo,onExportGif:u.handleExportGif,onPackageForSharing:u.handlePackageForSharing,onOpenFile:w,onOpenShareDialog:S,onSaveAsPptx:u.handleSaveAsPptx,onSaveAsPpsx:u.handleSaveAsPpsx,onSaveAsPptm:u.handleSaveAsPptm,hasMacros:r.hasMacros,onCopySlideAsImage:u.handleCopySlideAsImage,onPrint:p.handlePrint,onToggleShortcuts:()=>r.setIsShortcutHelpOpen(N=>!N),onOpenSettings:v,onRunAccessibilityCheck:f.handleRunAccessibilityCheck,onToggleSlideSorter:()=>r.setShowSlideSorter(N=>!N),onUpdateTextStyle:x.updateSelectedTextStyle,isOverflowMenuOpen:r.isOverflowMenuOpen,onSetOverflowMenuOpen:r.setIsOverflowMenuOpen,layoutOptions:k,onInsertSlideFromLayout:m.handleInsertSlideFromLayout,customShows:r.customShows,activeCustomShowId:r.activeCustomShowId,onSetActiveCustomShowId:r.setActiveCustomShowId,onCreateCustomShow:f.handleCreateCustomShow,onRenameActiveCustomShow:f.handleRenameActiveCustomShow,onDeleteActiveCustomShow:f.handleDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:f.handleToggleCurrentSlideInActiveShow,isCurrentSlideInActiveShow:f.isCurrentSlideInActiveShow,onEnterMasterView:f.handleEnterMasterView,onCloseMasterView:f.handleCloseMasterView,onToggleVersionHistory:()=>h.setIsVersionHistoryOpen(N=>!N),onOpenPasswordProtection:()=>f.setIsPasswordDialogOpen(true),onOpenDocumentProperties:()=>f.setIsDocPropsDialogOpen(true),onOpenFontEmbedding:()=>f.setIsFontEmbeddingOpen(true),onOpenDigitalSignatures:()=>f.setIsDigitalSigDialogOpen(true),onEnterPresenterView:y,onEnterRehearsalMode:b,onToggleThemeEditor:()=>r.setIsThemeEditorOpen(N=>!N),isThemeEditorOpen:r.isThemeEditorOpen,onToggleThemeGallery:()=>r.setIsThemeGalleryOpen(N=>!N),isThemeGalleryOpen:r.isThemeGalleryOpen,onCompare:h.handleCompare,onToggleComments:()=>{r.setSidebarPanelMode("comments"),r.isInspectorPaneOpen||r.setIsInspectorPaneOpen(true);},isCommentsPanelOpen:r.isInspectorPaneOpen,slideCommentCount:i?.comments?.length??0,formatPainterActive:r.formatPainterActive,canActivateFormatPainter:MU(o),onToggleFormatPainter:C??(()=>r.setFormatPainterActive(N=>!N)),isSelectionPaneOpen:r.isSelectionPaneOpen,onToggleSelectionPane:()=>r.setIsSelectionPaneOpen(N=>!N),eyedropperActive:r.eyedropperActive,onToggleEyedropper:()=>r.setEyedropperActive(N=>!N),onOpenSetUpSlideShow:()=>f.setIsSetUpSlideShowOpen(true),onOpenBroadcastDialog:()=>f.setIsBroadcastDialogOpen(true),onToggleSubtitles:f.handleToggleSubtitles,showSubtitles:!!r.presentationProperties.showSubtitles,activeSlide:i,onTransitionChange:L,onApplyTransitionToAll:F}),r.hasDigitalSignatures&&jsx("div",{className:"flex items-center px-3 py-1 z-10",children:jsx(FV,{hasSignatures:r.hasDigitalSignatures,signatureCount:r.digitalSignatureCount,onClick:()=>f.setIsDigitalSigDialogOpen(true)})}),jsx("input",{ref:r.imageInputRef,type:"file",name:"image-upload",accept:"image/*",className:"hidden",onChange:d.handleImageFileChange}),jsx("input",{ref:r.mediaInputRef,type:"file",name:"media-upload",accept:"video/*,audio/*",className:"hidden",onChange:d.handleMediaFileChange})]})}Pe();function Rme(t){let e=M6e;return typeof e.sanitize!="function"?t:e.sanitize(t,{USE_PROFILES:{mathMl:true,svg:true}})}var kme=[{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"}],Zdt=kme.map(t=>{try{let e=Qw(t.latex),n=Ay(e);return n?Rme(n):""}catch{return ""}});function Jdt({mathml:t}){let e=useRef(null);return useEffect(()=>{e.current&&(t?e.current.innerHTML=Rme(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 Ime({isOpen:t,onClose:e,onInsert:n,existingOmml:r}){let{t:o}=useTranslation(),{panelStyle:i,handlers:s}=pi(e),a=useMemo(()=>r?R4(r):"",[r]),[l,c]=useState(a),d=useDeferredValue(l),u=useRef(null);useEffect(()=>{t&&(c(a),setTimeout(()=>u.current?.focus(),50));},[t,a]);let{mathml:p,omml:h}=useMemo(()=>{if(!d.trim())return {mathml:"",omml:{}};try{let b=Qw(d);return {mathml:Ay(b),omml:b}}catch{return {mathml:"",omml:{}}}},[d]),f=useCallback(()=>{if(!l.trim())return;let b=h;try{let v=Qw(l);v&&Object.keys(v).length>0&&(b=v);}catch{}n(b),e();},[l,h,n,e]),m=useCallback(b=>{c(b);},[]),x=useCallback(b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),f()),b.key==="Escape"&&(b.preventDefault(),e());},[f,e]);if(!t)return null;let g=!!r,y=l.trim().length>0&&Object.keys(h).length>0;return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:b=>{b.target===b.currentTarget&&e();},onKeyDown:x,children:jsxs("div",{style:i,className:"bg-background border border-border rounded-xl shadow-2xl w-[640px] max-h-[85vh] flex flex-col overflow-hidden max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",onClick:b=>b.stopPropagation(),children:[jsxs("div",{...s,className:"flex items-center justify-between px-5 py-3 border-b border-border touch-none",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:g?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:y?jsx(Jdt,{mathml:p}):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:u,value:l,onChange:b=>c(b.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:kme.map((b,v)=>{let S=Zdt[v];return jsxs("button",{type:"button",onClick:()=>m(b.latex),className:ie("flex flex-col items-center gap-1 p-2 rounded-lg border transition-colors",l===b.latex?"border-primary bg-primary/10":"border-border bg-muted/40 hover:bg-accent/60 hover:border-border"),title:o(b.i18nKey,b.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(b.i18nKey,b.label)})]},b.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:f,disabled:!y,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:g?o("pptx.equation.update","Update"):o("pptx.equation.insert","Insert")})]})]})})}Pe();var dl=["#3b82f6","#22c55e","#f97316","#eab308"];function eut(){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:dl[t],opacity:.85},t))})}function tut(){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:dl[t],opacity:.85},t)})})}function nut(){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:dl[t],opacity:.85},t)})})}function rut(){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:dl[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:dl[1],opacity:.85}),jsx("rect",{x:38,y:20,width:18,height:10,rx:2,fill:dl[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 out(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:22,cy:20,r:14,fill:dl[0],opacity:.3}),jsx("circle",{cx:38,cy:20,r:14,fill:dl[1],opacity:.3}),jsx("circle",{cx:30,cy:10,r:14,fill:dl[2],opacity:.3})]})}function iut(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:30,cy:20,r:7,fill:dl[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(Qm.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:dl[t+1],opacity:.85})]},t)})]})}function sut(){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:dl[t],opacity:.85},t))})}function Nme(t){switch(t){case "basicBlockList":case "stackedList":case "tableList":case "horizontalBulletList":return jsx(eut,{});case "basicChevronProcess":case "segmentedProcess":case "continuousBlockProcess":case "upwardArrow":return jsx(tut,{});case "basicCycle":case "basicPie":return jsx(nut,{});case "basicRadial":case "convergingRadial":return jsx(iut,{});case "hierarchy":return jsx(rut,{});case "basicVenn":case "linearVenn":return jsx(out,{});default:return jsx(sut,{})}}function Dme({isOpen:t,onClose:e,onInsert:n}){let{t:r}=useTranslation(),{panelStyle:o,handlers:i}=pi(e),[s,a]=useState("list"),[l,c]=useState(null),d=sR.filter(p=>p.category===s),u=useCallback(()=>{if(!l)return;let p=sR.find(h=>h.layout===l);p&&(n(p.layout,p.defaultItems),e());},[l,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",{style:o,className:"pointer-events-auto w-[600px] max-w-[90vw] max-h-[80vh] rounded-lg border border-border bg-background shadow-2xl flex flex-col max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-w-none max-md:max-h-[88dvh] max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",role:"dialog","aria-modal":"true","aria-label":r("pptx.smartart.insertTitle"),children:[jsxs("div",{...i,className:"flex items-center justify-between px-4 py-3 border-b border-border touch-none",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:HU.map(p=>jsx("button",{type:"button",onClick:()=>{a(p.id),c(null);},className:ie("w-full text-left px-3 py-1.5 text-xs transition-colors",s===p.id?"bg-primary text-white":"text-foreground hover:bg-muted"),children:r(p.label)},p.id))}),jsx("div",{className:"flex-1 p-3 overflow-y-auto",children:jsx("div",{className:"grid grid-cols-3 gap-2",children:d.map(p=>jsxs("button",{type:"button",onClick:()=>c(p.layout),onDoubleClick:()=>{c(p.layout),n(p.layout,p.defaultItems),e();},className:ie("flex flex-col items-center gap-1 p-2 rounded border transition-colors",l===p.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:Nme(p.layout)}),jsx("span",{className:"text-[10px] text-foreground text-center leading-tight",children:r(p.labelKey)})]},p.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:u,disabled:!l,className:ie("px-3 py-1.5 text-xs rounded transition-colors",l?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:r("pptx.smartart.insert")})]})]})})]}):null}function oW(t){let{dialogs:e,insertHandlers:n,exportHandlers:r,printHandlers:o,propertyHandlers:i,annotations:s,slides:a,activeSlideIndex:l,canvasSize:c,filePath:d,coreProperties:u,customProperties:p,appProperties:h,embeddedFonts:f,hasDigitalSignatures:m,digitalSignatureCount:x,presentationProperties:g,customShows:y,selectedElements:b,isEncryptedDialogOpen:v,setIsEncryptedDialogOpen:S,showKeepAnnotationsDialog:w,onKeepAnnotations:C,onDiscardAnnotations:T}=t;return jsxs(Fragment,{children:[jsx(nz,{isOpen:i.isVersionHistoryOpen,filePath:d,onClose:()=>i.setIsVersionHistoryOpen(false),onRestore:i.handleRestoreVersion}),jsx(oz,{isOpen:i.isComparePanelOpen,compareResult:i.compareResult,canvasSize:c,onClose:()=>i.setIsComparePanelOpen(false),onAcceptSlide:i.handleAcceptSlide,onRejectSlide:i.handleRejectSlide,onAcceptAll:i.handleAcceptAllSlides}),jsx(sz,{isOpen:e.isPasswordDialogOpen,isCurrentlyProtected:e.isPasswordProtected,onClose:()=>e.setIsPasswordDialogOpen(false),onSetPassword:e.handleSetPassword,onRemovePassword:e.handleRemovePassword}),jsx(kV,{isOpen:e.isDocPropsDialogOpen,coreProperties:u??{},customProperties:p,appProperties:h,onClose:()=>e.setIsDocPropsDialogOpen(false),onSave:(M,_,E)=>{i.handleUpdateCoreProperties(M),i.handleUpdateCustomProperties(_),E&&i.handleUpdateAppProperties(E);}}),jsx(NV,{isOpen:e.isFontEmbeddingOpen,embedFontsEnabled:e.embedFontsEnabled,usedFontFamilies:i.usedFontFamilies,embeddedFonts:f.map(M=>M.name),onClose:()=>e.setIsFontEmbeddingOpen(false),onToggleEmbedFonts:e.setEmbedFontsEnabled}),jsx(DV,{isOpen:e.isDigitalSigDialogOpen,onClose:()=>e.setIsDigitalSigDialogOpen(false),hasSignatures:m,signatureCount:x}),jsx(OV,{isOpen:e.isSignatureStrippedDialogOpen,signatureCount:x,onConfirm:()=>e.setIsSignatureStrippedDialogOpen(false),onCancel:()=>e.setIsSignatureStrippedDialogOpen(false)}),jsx(BV,{isOpen:v,onClose:()=>S(false)}),jsx(Dme,{isOpen:e.isSmartArtDialogOpen,onClose:()=>e.setIsSmartArtDialogOpen(false),onInsert:n.handleInsertSmartArt}),jsx(Ime,{isOpen:e.isEquationDialogOpen,onClose:()=>e.setIsEquationDialogOpen(false),onInsert:e.editingEquationOmml?n.handleUpdateEquation:n.handleInsertEquation,existingOmml:e.editingEquationOmml}),jsx(GG,{open:e.isHyperlinkDialogOpen,initialUrl:b[0]?.actionClick?.url,initialTooltip:b[0]?.actionClick?.tooltip,initialAction:b[0]?.actionClick?.action,slideCount:a.length,onConfirm:n.handleHyperlinkConfirm,onCancel:()=>e.setIsHyperlinkDialogOpen(false)}),jsx(M6,{isOpen:r.exportModalOpen,title:r.exportModalTitle,progress:r.exportProgress,statusMessage:r.exportStatusMessage,onCancel:r.handleCancelExport}),jsx(LG,{open:e.isSetUpSlideShowOpen,onClose:()=>e.setIsSetUpSlideShowOpen(false),properties:g,onSave:e.handleSaveSlideShowSettings,customShows:y,slideCount:a.length}),jsx(NG,{open:o.isPrintDialogOpen,onClose:()=>o.setIsPrintDialogOpen(false),onPrint:o.handlePrintWithSettings,slides:a,activeSlideIndex:l,defaultSlidesPerPage:g.printSlidesPerPage,defaultFrameSlides:g.printFrameSlides}),jsx(kG,{isOpen:w,annotationCount:Array.from(s.allSlideAnnotations.values()).reduce((M,_)=>M+_.length,0),slideCount:s.allSlideAnnotations.size,onKeep:C,onDiscard:T})]})}function iW(t){let{mode:e,slides:n,canvasSize:r,templateElements:o,presentation:i,onExitPresentation:s,isMobile:a}=t,l=e==="present"&&i.presenterMode;return jsxs(Fragment,{children:[l&&(a?jsx(HV,{slides:n,currentSlideIndex:i.presentationSlideIndex,canvasSize:r,templateElements:o,presentationStartTime:i.presentationStartTime,onMovePresentationSlide:i.movePresentationSlide,onExit:s}):jsx($V,{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(VV,{presentationStartTime:i.presentationStartTime,slideStartTime:i.slideStartTime,paused:i.rehearsalPaused,onTogglePause:i.toggleRehearsalPause}),i.showRehearsalSummary&&jsx(GV,{slides:n,canvasSize:r,recordedTimings:i.recordedTimings,onSave:i.saveRehearsalTimings,onDiscard:i.dismissRehearsalSummary})]})}var gut=50;function Ome(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],d=c.clientX-l.x,u=c.clientY-l.y;Math.abs(d)<gut||Math.abs(d)<=Math.abs(u)||(d<0?n():r());},[e,n,r]);return {onTouchStart:i,onTouchEnd:s}}function sW(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:s,canvasSize:a,activeSlideIndex:l,gridSpacingPx:c,zoom:d,state:u,selectedElement:p,canvasHandlers:h,insertHandlers:f,tableOps:m,annotations:x,presentation:g,onEndPresentation:y,findReplace:b}=t,v=e==="master"?i:o,S=e==="master"?u.activeLayout?u.activeMaster?.elements??[]:[]:s,w=useMemo(()=>{let N=u.headerFooter,D;if(o)for(let U of o.elements){let G=U.placeholderType;if(G==="title"||G==="ctrTitle"){let j=U.text;if(j){D=j;break}}}return {slideNumber:o?.slideNumber,dateTimeText:N.dateTimeText,dateFormat:N.dateFormat,footerText:N.footerText,headerText:N.headerText,slideTitle:D,customProperties:u.customProperties.map(U=>({name:U.name,value:U.value}))}},[u.headerFooter,u.customProperties,o]),C=useMemo(()=>{if(!(!u.theme&&!u.tableStyleMap))return {theme:u.theme,tableStyleMap:u.tableStyleMap}},[u.theme,u.tableStyleMap]),T=useCallback((N,D)=>{e==="present"?g.handlePresentationAction(D):D.url&&rh(D.url);},[e,g]),M=useCallback(N=>{if(VA(N)){if(e==="present"){let D=cU(N);if(D){let U={action:D.action,targetSlideIndex:D.targetSlideIndex};g.handlePresentationAction(U);}}return}rh(N);},[e,g]),_=useRef(false),E=useCallback(()=>{_.current=true,x.setToolbarVisible(true);},[x]),R=useCallback(()=>{_.current=false;},[]),I=e==="preview"||e==="present",L=useCallback(()=>{e==="present"?g.movePresentationSlide(1):u.setActiveSlideIndex(N=>Math.min(r.length-1,N+1));},[e,g,u,r.length]),k=useCallback(()=>{e==="present"?g.movePresentationSlide(-1):u.setActiveSlideIndex(N=>Math.max(0,N-1));},[e,g,u]),F=Ome({enabled:I,onNext:L,onPrev:k});return jsxs("main",{"aria-label":"Slide editor",className:"flex-1 min-w-0 relative flex flex-col bg-background",onTouchStart:F.onTouchStart,onTouchEnd:F.onTouchEnd,children:[b.findReplaceOpen&&jsx(J6,{findQuery:b.findQuery,replaceQuery:b.replaceQuery,findMatchCase:b.findMatchCase,findResults:b.findResults,findResultIndex:b.findResultIndex,onSetFindQuery:b.setFindQuery,onSetReplaceQuery:b.setReplaceQuery,onSetFindMatchCase:b.setFindMatchCase,onPerformFind:b.performFind,onNavigateResult:b.navigateFindResult,onReplace:b.handleReplace,onReplaceAll:b.handleReplaceAll,onClose:()=>b.setFindReplaceOpen(false)}),e==="master"&&u.masterViewTab==="notes"?jsx(jH,{notesMaster:u.notesMaster,canvasSize:a,notesCanvasSize:u.notesCanvasSize}):e==="master"&&u.masterViewTab==="handout"?jsx(YH,{handoutMaster:u.handoutMaster,canvasSize:a,slidesPerPage:u.handoutSlidesPerPage}):jsx(qG,{activeSlide:v,templateElements:S,canvasSize:a,zoom:d,mode:e,canEdit:n,editTemplateMode:e==="master"||u.editTemplateMode,selectedElementIdSet:u.selectedElementIdSet,selectedElement:p,inlineEditingElementId:u.inlineEditingElementId,inlineEditingText:u.inlineEditingText,spellCheckEnabled:u.spellCheckEnabled,mediaDataUrls:u.mediaDataUrls,tableEditorState:u.tableEditorState,marqueeSelectionState:u.marqueeSelectionState,snapLines:u.snapLines,showGrid:u.showGrid,gridSpacingPx:c,showRulers:u.showRulers,guides:u.guides,presentationElementStates:e==="present"?g.presentationElementStates:void 0,presentationKeyframesCss:e==="present"?g.presentationKeyframesCss:void 0,onClick:h.handleElementClick,onDoubleClick:h.handleElementDoubleClick,onMouseDown:h.handleElementMouseDown,onContextMenu:h.handleElementContextMenu,onCanvasMouseDown:h.handleCanvasMouseDown,onResizePointerDown:h.handleResizePointerDown,onAdjustmentPointerDown:h.handleAdjustmentPointerDown,onRotate:h.handleRotate,onInlineEditChange:u.setInlineEditingText,onInlineEditCommit:h.handleInlineEditCommit,onInlineEditCancel:()=>u.setInlineEditingElementId(null),onTableCellSelect:(N,D)=>u.setTableEditorState(N?{...N,elementId:D}:null),onCommitCellEdit:m.handleCommitCellEdit,onUpdateSmartArtElement:h.handleUpdateSmartArtElement,onFormatText:h.handleFormatText,onResizeTableColumns:m.handleResizeTableColumns,onResizeTableRow:m.handleResizeTableRow,findResults:b.findResults,findResultIndex:b.findResultIndex,activeSlideIndex:l,activeTool:u.activeTool,drawingColor:u.drawingColor,drawingWidth:u.drawingWidth,isDrawingRef:u.isDrawingRef,onAddInkElement:f.handleAddInkElement,onAddFreeformShape:f.handleAddFreeformShape,onEraseInkElement:f.handleEraseInkElement,onActionClick:T,onHyperlinkClick:M,allSlides:e==="present"?r:void 0,onZoomClick:e==="present"?g.handleZoomClick:void 0,sourceSlideIndex:e==="present"?l:void 0,fieldContext:w,tableStyleContext:C,collaborationOverlay:jsxs(Fragment,{children:[jsx(UH,{elements:v?.elements??[],activeSlideIndex:l}),jsx(OH,{activeSlideIndex:l,canvasWidth:a.width,canvasHeight:a.height,selectedElementId:u.selectedElementId})]}),comments:o?.comments,showCommentMarkers:u.sidebarPanelMode==="comments",onCommentMarkerClick:()=>u.setSidebarPanelMode("comments"),onMoveGuide:(N,D)=>{u.setGuides(U=>U.map(G=>G.id===N?{...G,position:G.axis==="h"?Math.max(0,Math.min(a.height,D)):Math.max(0,Math.min(a.width,D))}:G));},onDeleteGuide:N=>{u.setGuides(D=>D.filter(U=>U.id!==N));},onCreateGuideFromRuler:(N,D)=>{u.setGuides(U=>[...U,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:N,position:D}]);}}),e==="present"&&x.presentationTool!=="none"&&jsx(CG,{canvasSize:a,editorScale:d.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(RG,{visible:!!u.presentationProperties.showSubtitles}),e==="present"&&jsx(EG,{currentSlideIndex:g.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:g.movePresentationSlide,onEndPresentation:y??(()=>{})}),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:E,onMouseLeave:R,children:jsx(PG,{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:g.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:g.movePresentationSlide,presentationStartTime:g.presentationStartTime,onEndPresentation:y??(()=>{}),onTogglePresenterView:g.togglePresenterView,presenterMode:g.presenterMode})})]})}var nf="rounded bg-muted/50 p-2.5 space-y-2",rf="text-[11px] font-medium uppercase tracking-wide text-muted-foreground mb-1.5",$2="w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:border-primary focus:outline-none",$me="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",Hme="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 S5=[{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"}],h0=["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"];bt();function zme({editColors:t,canEdit:e,activePickerKey:n,majorFont:r,minorFont:o,onSetActivePickerKey:i,onColorChange:s,onMajorFontChange:a,onMinorFontChange:l}){let{t:c}=useTranslation(),d=useMemo(()=>xU(t),[t]),u=useCallback(p=>{n&&/^#[0-9a-fA-F]{6}$/.test(p)&&s(n,p);},[n,s]);return jsxs(Fragment,{children:[jsxs("div",{className:nf,children:[jsx("div",{className:rf,children:c("pptx.themeEditor.colorScheme")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:hc.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:`${Om[p]}: ${t[p]}`,"aria-label":`${Om[p]}: ${t[p]}`,onClick:()=>i(n===p?null:p)}),jsx("span",{className:"text-[9px] text-muted-foreground truncate w-full text-center",children:Om[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:Om[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=>u(p.target.value)})]})]}),d&&jsxs("div",{className:nf,children:[jsx("div",{className:rf,children:c("pptx.themeEditor.preview")}),jsx("div",{className:"flex flex-col gap-px",children:d.map((p,h)=>jsx("div",{className:"grid grid-cols-12 gap-px",children:p.map(f=>jsx("div",{className:"h-3.5 rounded-sm",style:{backgroundColor:f.hex},title:`${f.colLabel} -- ${f.rowLabel} (${f.hex})`},`${f.schemeKey}-${h}`))},h))})]}),jsxs("div",{className:nf,children:[jsx("div",{className:rf,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:$2,disabled:!e,value:h0.includes(r)?r:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&a(p.target.value);},children:[h0.map(p=>jsx("option",{value:p,children:p},p)),!h0.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:$2,disabled:!e,value:h0.includes(o)?o:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&l(p.target.value);},children:[h0.map(p=>jsx("option",{value:p,children:p},p)),!h0.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 Cut=["accent1","accent2","accent3","accent4","accent5","accent6"];function Gme({canEdit:t,currentThemeName:e,onSelectPreset:n}){let{t:r}=useTranslation();return jsxs("div",{className:nf,children:[jsx("div",{className:rf,children:r("pptx.themeEditor.presetThemes")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:S5.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:Cut.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 Wme({theme:t,canEdit:e,onUpdateColorScheme:n,onUpdateFontScheme:r,onUpdateThemeName:o,onApplyToPresentation:i,onClose:s}){let{t:a}=useTranslation(),[l,c]=useState(()=>t?.colorScheme??S5[0].colorScheme),[d,u]=useState(()=>t?.fontScheme?.majorFont?.latin??"Calibri Light"),[p,h]=useState(()=>t?.fontScheme?.minorFont?.latin??"Calibri"),[f,m]=useState(()=>t?.name??"Custom Theme"),[x,g]=useState(null),y=useCallback((T,M)=>{let _={...l,[T]:M};c(_),n(_);},[l,n]),b=useCallback(T=>{c(T.colorScheme),u(T.majorFont),h(T.minorFont),m(T.name),n(T.colorScheme),r({majorFont:{latin:T.majorFont},minorFont:{latin:T.minorFont}}),o(T.name);},[n,r,o]),v=useCallback(()=>{t?.colorScheme&&(c(t.colorScheme),u(t.fontScheme?.majorFont?.latin??"Calibri Light"),h(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]),S=useCallback(T=>{u(T),r({majorFont:{latin:T},minorFont:{latin:p}});},[p,r]),w=useCallback(T=>{h(T),r({majorFont:{latin:d},minorFont:{latin:T}});},[d,r]),C=useCallback(T=>{m(T),o(T);},[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"),"aria-label":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:nf,children:[jsx("div",{className:rf,children:a("pptx.themeEditor.themeName")}),jsx("input",{type:"text",className:$2,disabled:!e,value:f,onChange:T=>C(T.target.value),placeholder:a("pptx.themeEditor.themeNamePlaceholder")})]}),jsx(Gme,{canEdit:e,currentThemeName:f,onSelectPreset:b}),jsx(zme,{editColors:l,canEdit:e,activePickerKey:x,majorFont:d,minorFont:p,onSetActivePickerKey:g,onColorChange:y,onMajorFontChange:S,onMinorFontChange:w}),jsxs("div",{className:"flex gap-1.5 pt-1",children:[jsx("button",{type:"button",disabled:!e,className:$me,onClick:i,children:a("pptx.themeEditor.applyToPresentation")}),jsx("button",{type:"button",disabled:!e,className:Hme,onClick:v,children:a("pptx.themeEditor.reset")})]})]})}function lW({onClose:t,className:e,children:n}){let{dragY:r,handlers:o}=Lu(t);return jsxs(Fragment,{children:[jsx("button",{type:"button","aria-label":"Close",onClick:t,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:e,style:r>0?{transform:`translateY(${r}px)`,transition:"none"}:void 0,children:[jsx("div",{className:"md:hidden flex items-center justify-center pt-2 pb-1 cursor-grab active:cursor-grabbing touch-none",onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onPointerCancel:o.onPointerCancel,children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),n]})]})}var cW=[{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 dW({theme:t,selected:e,onClick:n}){let{colorScheme:r}=t;return jsxs("button",{type:"button",onClick:n,className:ie("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 Yme({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 d=()=>{a&&(o(a),r());},u=()=>{c.current?.click();},p=h=>{let f=h.target.files?.[0];f&&i&&i(f),h.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:cW.map(h=>jsx(dW,{theme:h,selected:a?.id===h.id,onClick:()=>l(h)},h.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:u,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:d,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 uW(t){let{mode:e,canEdit:n,activeSlide:r,masterPseudoSlide:o,slides:i,canvasSize:s,activeSlideIndex:a,selectedElement:l,state:c,comments:d,ops:u,manipulation:p,propertyHandlers:h,themeHandlers:f,history:m,panelWidth:x,onResizeRight:g}=t,y=e==="master"?o:r;return jsxs(Fragment,{children:[(e==="edit"||e==="master")&&c.isInspectorPaneOpen&&g&&jsx(yu,{direction:"horizontal",onResize:g}),jsx(tW,{isOpen:(e==="edit"||e==="master")&&c.isInspectorPaneOpen,canEdit:n,mode:e,activeSlide:y,slides:i,canvasSize:s,selectedElement:l,effectiveSelectedIds:c.effectiveSelectedIds,tableEditorState:c.tableEditorState,sidebarPanelMode:c.sidebarPanelMode,activeSlideIndex:a,comments:d,onSetSidebarPanelMode:c.setSidebarPanelMode,onClose:()=>c.setIsInspectorPaneOpen(false),onUpdateElementStyle:u.updateSelectedShapeStyle,onUpdateTextStyle:u.updateSelectedTextStyle,onUpdateElement:u.updateSelectedElement,onApplySelection:u.applySelection,onSetCanvasSize:c.setCanvasSize,onMoveLayer:p.handleMoveLayer,onMoveLayerToEdge:p.handleMoveLayerToEdge,onDeleteElement:p.handleDelete,onUpdateSlide:h.handleUpdateSlide,presentationProperties:c.presentationProperties,onUpdatePresentationProperties:h.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:h.handleUpdateCoreProperties,onUpdateAppProperties:h.handleUpdateAppProperties,onUpdateCustomProperties:h.handleUpdateCustomProperties,onApplyTheme:f.handleApplyTheme,onSetTemplateBackground:f.handleSetTemplateBackground,onGetTemplateBackgroundColor:f.handleGetTemplateBackgroundColor,mediaDataUrls:c.mediaDataUrls,theme:c.theme,panelWidth:x}),c.isSelectionPaneOpen&&(e==="edit"||e==="master")&&jsx(lW,{onClose:()=>c.setIsSelectionPaneOpen(false),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] max-md:rounded-t-xl max-md:border-t max-md:border-border max-md:shadow-2xl max-md:bg-background",children:jsx(XV,{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(lW,{onClose:()=>c.setIsThemeEditorOpen(false),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(Wme,{theme:c.theme,canEdit:n,onUpdateColorScheme:f.handleUpdateThemeColorScheme,onUpdateFontScheme:f.handleUpdateThemeFontScheme,onUpdateThemeName:f.handleUpdateThemeName,onApplyToPresentation:f.handleApplyThemeToPresentation,onClose:()=>c.setIsThemeEditorOpen(false)})}),jsx(Yme,{open:c.isThemeGalleryOpen,currentTheme:null,canEdit:n,onClose:()=>c.setIsThemeGalleryOpen(false),onApplyTheme:b=>{f.handleApplyThemeData(b.colorScheme,{majorFont:{latin:b.fontScheme.majorFont,eastAsia:b.fontScheme.majorFont,complexScript:b.fontScheme.majorFont},minorFont:{latin:b.fontScheme.minorFont,eastAsia:b.fontScheme.minorFont,complexScript:b.fontScheme.minorFont}},b.name);}})]})}function pW(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,activeSlideIndex:s,canvasSize:a,gridSpacingPx:l,slideSectionGroups:c,showSlidesPane:d,showMasterPane:u,selectedElement:p,state:h,editorOps:f,dialogs:m,presentation:x,annotations:g,propertyHandlers:y,themeHandlers:b,history:v,comments:S,zoom:w,isMobile:C=false,isTouchDevice:T=false,onEndPresentation:M,leftPanelWidth:_,onResizeLeft:E,rightPanelWidth:R,onResizeRight:I}=t,{ops:L,sectionOps:k,canvasHandlers:F,insertHandlers:N,manipulation:D,slideOps:U,tableOps:G,findReplace:j}=f;return jsxs("div",{className:"relative z-10 flex flex-1 min-h-0",children:[d&&jsxs(Fragment,{children:[jsx(XC,{slides:r,activeSlideIndex:s,canvasSize:a,sectionGroups:c,isOpen:h.isSlidesPaneOpen,canEdit:n,onSelectSlide:h.setActiveSlideIndex,onSlideContextMenu:U.handleSlideContextMenu,onMoveSlide:U.handleMoveSlide,onAddSlide:U.handleAddSlide,onCollapse:()=>h.setIsSlidesPaneOpen(false),onAddSection:k.addSection,onRenameSection:k.renameSection,onDeleteSection:k.deleteSection,onMoveSectionUp:k.moveSectionUp,onMoveSectionDown:k.moveSectionDown,rehearsalTimings:Object.keys(x.recordedTimings).length>0?x.recordedTimings:void 0,panelWidth:_}),E&&jsx(yu,{direction:"horizontal",onResize:E})]}),u&&jsx(XH,{slideMasters:h.slideMasters,activeMasterIndex:h.activeMasterIndex,activeLayoutIndex:h.activeLayoutIndex,canvasSize:a,masterViewTab:h.masterViewTab,notesMaster:h.notesMaster,handoutMaster:h.handoutMaster,handoutSlidesPerPage:h.handoutSlidesPerPage,onSelectMaster:m.handleSelectMaster,onSelectLayout:m.handleSelectLayout,onCollapse:()=>h.setIsSlidesPaneOpen(false),onTabChange:h.setMasterViewTab,onHandoutSlidesPerPageChange:h.setHandoutSlidesPerPage}),jsx(sW,{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:h.templateElements,canvasSize:a,activeSlideIndex:s,gridSpacingPx:l,zoom:w,state:h,selectedElement:p,canvasHandlers:F,insertHandlers:N,tableOps:G,annotations:g,presentation:x,onEndPresentation:M,findReplace:j}),h.contextMenuState&&jsx(E6,{contextMenuState:h.contextMenuState,mode:e,selectedElement:p,tableEditorState:h.tableEditorState,hasMultiSelection:h.effectiveSelectedIds.length>1,onAction:D.handleContextMenuAction,onInsertTableRow:G.handleInsertTableRow,onDeleteTableRow:G.handleDeleteTableRow,onInsertTableColumn:G.handleInsertTableColumn,onDeleteTableColumn:G.handleDeleteTableColumn,onMergeCellRight:G.handleMergeCellRight,onMergeCellDown:G.handleMergeCellDown,onMergeSelectedCells:G.handleMergeSelectedCells,onSplitCell:G.handleSplitCell,onClose:()=>h.setContextMenuState(null)}),jsx(uW,{mode:e,canEdit:n,activeSlide:o,masterPseudoSlide:i,slides:r,canvasSize:a,activeSlideIndex:s,selectedElement:p,state:h,comments:S,ops:L,manipulation:D,propertyHandlers:y,themeHandlers:b,history:v,panelWidth:R,onResizeRight:I})]})}function qme({onOpenSlides:t,onOpenInsert:e,onOpenInspector:n,onOpenComments:r,onToggleNotes:o,activeSheet:i,commentCount:s}){return jsx("nav",{"aria-label":"Editor actions",className:"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:d,onClick:u,badge:p})=>{let h=i===l;return jsxs("button",{type:"button",onClick:u,className:ie("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",h?"text-primary":"text-muted-foreground hover:text-foreground"),"aria-pressed":h,children:[jsx(d,{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}),h&&jsx("span",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-8 h-0.5 rounded-full bg-primary"})]},l)})})}function Zme({open:t,onClose:e,...n}){return jsx(ON,{open:t,onClose:e,heightFraction:.7,title:"Slides",children:jsx("div",{className:"h-full",children:jsx(XC,{...n})})})}function Jme(t){let{state:e,editorOps:n,presentation:r,slides:o,activeSlideIndex:i,canvasSize:s,slideSectionGroups:a,canEdit:l,commentCount:c}=t,{keyboardInset:d,isKeyboardOpen:u}=EV(),p=e.isSlidesPaneOpen?"slides":e.isInspectorPaneOpen?e.sidebarPanelMode==="comments"?"comments":"inspector":e.isSlideNotesCollapsed?null:"notes",h=()=>{e.setIsSlidesPaneOpen(false),e.setIsInspectorPaneOpen(false),e.setIsSlideNotesCollapsed(true);},f=m=>{switch(h(),m){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(Zme,{open:e.isSlidesPaneOpen,onClose:()=>e.setIsSlidesPaneOpen(false),slides:o,activeSlideIndex:i,canvasSize:s,sectionGroups:a,isOpen:true,canEdit:l,onSelectSlide:m=>{e.setActiveSlideIndex(m),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("div",{className:"contents",style:d>0?{display:"block",transform:`translateY(-${d}px)`,transition:"transform 150ms ease-out",willChange:"transform"}:void 0,"data-keyboard-open":u?"true":void 0,children:jsx(qme,{activeSheet:p,commentCount:c,onOpenSlides:()=>e.isSlidesPaneOpen?e.setIsSlidesPaneOpen(false):f("slides"),onOpenInsert:()=>{n.insertHandlers.handleAddTextBox();},onOpenInspector:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode!=="comments"?e.setIsInspectorPaneOpen(false):f("inspector"),onOpenComments:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode==="comments"?e.setIsInspectorPaneOpen(false):f("comments"),onToggleNotes:()=>e.isSlideNotesCollapsed?f("notes"):e.setIsSlideNotesCollapsed(true)})})]})}function _v({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:ie("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:ie("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})]})}function ege({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:d=false,onToggleReducedMotion:u}){let[p,h]=useState("general"),[f,m]=useState(true),{t:x}=useTranslation(),{panelStyle:g,handlers:y}=pi(e),b=useCallback(S=>{S.key==="Escape"&&e();},[e]);if(useEffect(()=>{if(t)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t,b]),!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",{style:g,className:"pointer-events-auto w-[min(32rem,calc(100%-2rem))] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[88dvh] max-md:overflow-y-auto max-md:rounded-t-2xl max-md:rounded-b-none max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(env(safe-area-inset-bottom),0px)]",children:[jsxs("div",{...y,className:"flex items-center justify-between px-5 py-4 border-b border-border/60 touch-none",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:()=>h(S.id),className:ie("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(_v,{label:x("pptx.settings.autoSave"),enabled:f,onToggle:()=>m(!f)}),jsx(_v,{label:x("pptx.settings.spellCheck"),enabled:n,onToggle:()=>r?.(!n)}),jsx(_v,{label:x("pptx.settings.showGrid"),enabled:o,onToggle:()=>i?.(!o)}),jsx(_v,{label:x("pptx.settings.showRulers"),enabled:s,onToggle:()=>a?.(!s)}),jsx(_v,{label:x("pptx.settings.snapToGrid"),enabled:l,onToggle:()=>c?.(!l)}),jsx(_v,{label:x("pptx.settings.reducedMotion"),enabled:d,onToggle:()=>u?.()})]}),p==="shortcuts"&&jsx("div",{className:"space-y-0.5",children:CR.map((S,w)=>jsxs("div",{className:ie("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:x(S.actionKey)}),jsx("span",{className:"font-mono text-[11px] text-muted-foreground whitespace-nowrap",children:S.shortcut})]},S.actionKey))})]})]})})]})}var qut=120,Zut=400,Jut=180,Qut=220,ept=480,tpt=288,npt=60,rpt=400,opt=120;function tge(){let[t,e]=useState(Jut),[n,r]=useState(tpt),[o,i]=useState(opt),s=useCallback(c=>{e(d=>Math.min(Zut,Math.max(qut,d+c)));},[]),a=useCallback(c=>{r(d=>Math.min(ept,Math.max(Qut,d-c)));},[]),l=useCallback(c=>{i(d=>Math.min(rpt,Math.max(npt,d-c)));},[]);return {leftWidth:t,rightWidth:n,bottomHeight:o,onResizeLeft:s,onResizeRight:a,onResizeBottom:l}}var nge=forwardRef(function(e,n){let{content:r,filePath:o,fileName:i,canEdit:s=false,onContentChange:a,onDirtyChange:l,onActiveSlideChange:c,onModeChange:d,onZoomChange:u,onSelectionChange:p,onSlideCountChange:h,onOpenFile:f,theme:m,authorName:x,collaboration:g,onStartCollaboration:y,onStopCollaboration:b,shareDefaults:v,smartArt3D:S=false}=e,w=y$(m),[C,T]=useState(r);useEffect(()=>{T(r);},[r]);let M=useCallback(()=>{if(f){f();return}(async()=>{let Te=await Bne();Te&&T(Te.buffer);})();},[f]),[_,E]=useState(false),[R,I]=useState(true),[L,k]=useState(false),{reducedMotion:F,toggleReducedMotion:N}=vV(),D=Iz(),{containerRef:U,mode:G,slides:j,canvasSize:Y,loading:ge,error:fe,activeSlideIndex:de,selectedElementId:J,selectedElementIds:re,templateElementsBySlideId:ce,activeSlide:ae,selectedElement:_e}=D,xe=x2({containerRef:U}),{isMobile:Ee,isTouchDevice:W,isVirtualKeyboardOpen:q}=xe,Q=tge(),{gridSpacingPx:se,visibleSlideIndexes:me,slideSectionGroups:P,masterPseudoSlide:A}=cV({slides:j,sections:D.sections,customShows:D.customShows,activeCustomShowId:D.activeCustomShowId,mode:G,activeLayout:D.activeLayout,activeMaster:D.activeMaster,presentationGridSpacing:D.presentationProperties.gridSpacing}),O=useCallback(()=>!!(D.dragStateRef.current||D.resizeStateRef.current||D.marqueeStateRef.current||D.shapeAdjustmentDragStateRef.current||D.isDrawingRef.current),[D.dragStateRef,D.resizeStateRef,D.marqueeStateRef,D.shapeAdjustmentDragStateRef,D.isDrawingRef]),z=cz({canvasSize:Y,selectedElements:D.selectedElements}),te=az({slides:j,canvasSize:Y,activeSlideIndex:de,templateElementsBySlideId:ce,editTemplateMode:D.editTemplateMode,headerFooter:D.headerFooter,loading:ge,error:fe,hasActivePointerInteraction:O,pointerCommitNonce:D.pointerCommitNonce,setSlides:D.setSlides,setCanvasSize:D.setCanvasSize,setActiveSlideIndex:D.setActiveSlideIndex,setTemplateElementsBySlideId:D.setTemplateElementsBySlideId,setSelectedElementId:D.setSelectedElementId,setSelectedElementIds:D.setSelectedElementIds,setEditTemplateMode:D.setEditTemplateMode,setHeaderFooter:D.setHeaderFooter}),{presentation:$,annotations:Me,actionSoundHandlerRef:De}=hV({mode:G,slides:j,visibleSlideIndexes:me,activeSlideIndex:de,containerRef:U,content:C,mediaDataUrls:D.mediaDataUrls,presentationProperties:D.presentationProperties,setMode:D.setMode,setActiveSlideIndex:D.setActiveSlideIndex,setSlides:D.setSlides,history:te});PV({targetRef:z.canvasViewportRef,currentScale:z.scale,callbacks:{onPinchZoom:Te=>z.setScale(Te),onSwipe:G==="present"?Te=>$.movePresentationSlide(Te===1?-1:1):void 0,onLongPress:(Te,Ve)=>{G!=="edit"||!s||D.selectedElementId&&D.setContextMenuState({x:Te,y:Ve,elementId:D.selectedElementId});}},enabled:W});let V=lV({mode:G,slides:j,activeSlide:ae,canvasSize:Y,containerRef:U,customShows:D.customShows,activeCustomShowId:D.activeCustomShowId,setCustomShows:D.setCustomShows,setActiveCustomShowId:D.setActiveCustomShowId,setGuides:D.setGuides,setPresentationProperties:D.setPresentationProperties,setAccessibilityIssues:D.setAccessibilityIssues,setIsAccessibilityPanelOpen:D.setIsAccessibilityPanelOpen,setMode:D.setMode,setPreMasterMode:D.setPreMasterMode,setActiveMasterIndex:D.setActiveMasterIndex,setActiveLayoutIndex:D.setActiveLayoutIndex,setSelectedElementId:D.setSelectedElementId,setSelectedElementIds:D.setSelectedElementIds,preMasterMode:D.preMasterMode,hasDigitalSignatures:D.hasDigitalSignatures,isDirty:D.isDirty,history:te});useEffect(()=>{D.setSelectedElementId(null),D.setSelectedElementIds([]),D.setInlineEditingElementId(null);},[de]),useEffect(()=>{G==="present"&&(D.setSelectedElementId(null),D.setSelectedElementIds([]),D.setInlineEditingElementId(null),z.handleZoomToFit(),z.canvasViewportRef.current?.scrollTo({left:0,top:0}));},[G]);let B=fV({state:D,history:te,zoom:z,mode:G,canEdit:s,slides:j,activeSlide:ae,activeSlideIndex:de,selectedElement:_e,selectedElementId:J,selectedElementIds:re,canvasSize:Y,dialogs:V,presentation:$,userName:x??g?.userName,handlerRef:De}),{exportHandlers:ee,printHandlers:oe,themeHandlers:pe,propertyHandlers:Ae,showKeepAnnotationsDialog:Le,handleSetMode:ue,handleKeepAnnotations:we,handleDiscardAnnotations:Ie,handleEnterPresenterView:He,handleEnterRehearsalMode:Oe,autosaveStatus:$e,isEncryptedDialogOpen:ot,setIsEncryptedDialogOpen:at}=bV({state:D,zoom:z,history:te,presentation:$,annotations:Me,actionSoundHandlerRef:De,editorOps:B,dialogs:V,gridSpacingPx:se,content:C,filePath:o,autosaveEnabled:R,canEdit:s,mode:G,slides:j,activeSlide:ae,activeSlideIndex:de,canvasSize:Y,loading:ge,error:fe,ref:n,setContent:T,onContentChange:a,onDirtyChange:l,onActiveSlideChange:c,onModeChange:d,onZoomChange:u,onSelectionChange:p,onSlideCountChange:h});if(ge)return jsx(b6,{});if(fe)return jsx(v6,{error:fe});let gt=G==="edit"&&!Ee&&!V.isNarrowViewport&&D.isSlidesPaneOpen,le=G==="master"&&!Ee&&D.isSlidesPaneOpen,Ue=jsxs("div",{style:w,"data-pptx-viewer":"",className:"h-full w-full bg-background text-foreground relative",children:[jsxs("div",{ref:U,tabIndex:0,className:"h-full w-full flex flex-col overflow-hidden outline-none",children:[G!=="present"&&jsx(nW,{mode:G,canEdit:s,state:D,selectedElement:_e,activeSlide:ae,zoom:z,history:te,findReplace:B.findReplace,manipulation:B.manipulation,insertHandlers:B.insertHandlers,exportHandlers:ee,printHandlers:oe,propertyHandlers:Ae,dialogs:V,slideOps:B.slideOps,ops:B.ops,onSetMode:ue,onEnterPresenterView:He,onEnterRehearsalMode:Oe,onOpenSettings:()=>E(true),onOpenShareDialog:()=>k(true),onOpenFile:M,fileName:i,autosaveStatus:$e,autosaveEnabled:R,onToggleAutosave:()=>I(Te=>!Te)}),jsx(pW,{mode:G,canEdit:s,slides:j,activeSlide:ae,masterPseudoSlide:A,activeSlideIndex:de,canvasSize:Y,gridSpacingPx:se,slideSectionGroups:P,showSlidesPane:gt,showMasterPane:le,selectedElement:_e,state:D,editorOps:B,dialogs:V,presentation:$,annotations:Me,propertyHandlers:Ae,themeHandlers:pe,history:te,comments:B.comments,zoom:z,isMobile:Ee,isTouchDevice:W,onEndPresentation:()=>ue("edit"),leftPanelWidth:Ee?void 0:Q.leftWidth,onResizeLeft:Ee?void 0:Q.onResizeLeft,rightPanelWidth:Ee?void 0:Q.rightWidth,onResizeRight:Ee?void 0:Q.onResizeRight}),G!=="present"&&(!q||!D.isSlideNotesCollapsed)&&jsx(eW,{activeSlide:ae,allSlides:j,isSlideNotesCollapsed:D.isSlideNotesCollapsed,canEdit:s,slideCount:j.length,activeSlideIndex:de,isDirty:D.isDirty,autosaveStatus:$e,onToggleNotes:()=>D.setIsSlideNotesCollapsed(Te=>!Te),onUpdateNotes:Ae.handleUpdateNotes,collaborationSlot:g?jsx(apt,{}):void 0,notesPanelHeight:Ee?void 0:Q.bottomHeight,onResizeBottom:Ee?void 0:Q.onResizeBottom,scale:z.scale,onZoomIn:z.handleZoomIn,onZoomOut:z.handleZoomOut,onZoomToFit:z.handleZoomToFit,mode:G,onSetMode:ue,onToggleSlideSorter:()=>D.setShowSlideSorter(Te=>!Te),hideStatusBar:Ee}),G!=="present"&&Ee&&jsx(Jme,{state:D,editorOps:B,presentation:$,slides:j,activeSlideIndex:de,canvasSize:Y,slideSectionGroups:P,canEdit:s,commentCount:ae?.comments?.length??0})]}),jsx(oW,{dialogs:V,insertHandlers:B.insertHandlers,exportHandlers:ee,printHandlers:oe,propertyHandlers:Ae,annotations:Me,slides:j,activeSlideIndex:de,canvasSize:Y,filePath:o,coreProperties:D.coreProperties,customProperties:D.customProperties,appProperties:D.appProperties,embeddedFonts:D.embeddedFonts,hasDigitalSignatures:D.hasDigitalSignatures,digitalSignatureCount:D.digitalSignatureCount,presentationProperties:D.presentationProperties,customShows:D.customShows,selectedElements:D.selectedElements,isEncryptedDialogOpen:ot,setIsEncryptedDialogOpen:at,showKeepAnnotationsDialog:Le,onKeepAnnotations:we,onDiscardAnnotations:Ie}),jsx(ege,{isOpen:_,onClose:()=>E(false),spellCheckEnabled:D.spellCheckEnabled,onSetSpellCheckEnabled:D.setSpellCheckEnabled,showGrid:D.showGrid,onSetShowGrid:D.setShowGrid,showRulers:D.showRulers,onSetShowRulers:D.setShowRulers,snapToGrid:D.snapToGrid,onSetSnapToGrid:D.setSnapToGrid,reducedMotion:F,onToggleReducedMotion:N}),jsx(VG,{open:L,onClose:()=>k(false),activeCollaboration:g,onStartCollaboration:y,onStopCollaboration:b,preconfigured:!!g,defaultRoomId:v?.roomId,defaultUserName:v?.userName,defaultServerUrl:v?.serverUrl}),jsx(UG,{open:V.isBroadcastDialogOpen,onClose:()=>V.setIsBroadcastDialogOpen(false),onStartBroadcast:y,onStopBroadcast:b,onStartPresenting:()=>ue("present"),defaultRoomId:v?.roomId,defaultUserName:v?.userName,defaultServerUrl:v?.serverUrl}),jsx(JG,{isShortcutHelpOpen:D.isShortcutHelpOpen,isAccessibilityPanelOpen:D.isAccessibilityPanelOpen,showSlideSorter:D.showSlideSorter,accessibilityIssues:D.accessibilityIssues,slides:j,activeSlideIndex:de,canvasSize:Y,canEdit:s,sectionGroups:P,onCloseShortcuts:()=>D.setIsShortcutHelpOpen(false),onCloseAccessibility:()=>D.setIsAccessibilityPanelOpen(false),onSelectSlide:Te=>{D.setActiveSlideIndex(Te),D.setShowSlideSorter(false);},onMoveSlide:B.slideOps.handleMoveSlide,onDeleteSlides:B.slideOps.handleDeleteSlides,onDuplicateSlides:B.slideOps.handleDuplicateSlides,onToggleHideSlides:B.slideOps.handleToggleHideSlides,onCloseSorter:()=>D.setShowSlideSorter(false),reducedMotion:F,onToggleReducedMotion:N}),jsx(iW,{mode:G,slides:j,canvasSize:Y,templateElements:D.templateElements,presentation:$,onExitPresentation:()=>ue("edit"),isMobile:Ee})]});return jsx(rk.Provider,{value:S,children:jsx(x$,{theme:m,children:g?jsxs(LI,{config:g,canvasWidth:Y.width,canvasHeight:Y.height,children:[jsx(lpt,{slides:j,templateElementsBySlideId:ce,setSlides:D.setSlides,config:g,content:C}),jsx(cpt,{activeSlideIndex:de,setActiveSlideIndex:D.setActiveSlideIndex,slideCount:j.length}),Ue]}):Ue})})});nge.displayName="PowerPointViewer";function apt(){let t=No();return t?jsx(BI,{status:t.status,connectedCount:t.connectedCount,onRetry:t.retry}):null}function lpt({slides:t,templateElementsBySlideId:e,setSlides:n,config:r,content:o}){let i=No(),s=useRef(o);s.current=o;let a=useCallback(()=>{let l=s.current;return l?l instanceof Uint8Array?l:new Uint8Array(l):null},[]);return wV({doc:i?.doc??null,slides:t,templateElementsBySlideId:e,setSlides:n,isConnected:i?.status==="connected",isSynced:i?.synced??true,config:r,getSourceBytes:a}),null}function cpt({activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n}){let r=No(),{followedClientId:o,followUser:i}=MV({collab:r,activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n});return TV({collab:r,activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n,paused:o!==null}),r?jsx("div",{className:"pointer-events-none fixed inset-x-0 top-2 z-[1100] flex justify-center px-2",children:jsx("div",{className:"pointer-events-auto",children:jsx(DH,{presences:r.remoteUsers,followedClientId:o,onFollow:i})})}):null}/**
4870
4870
  * @fileoverview Save-side writer for slide-layout parts (`p:sldLayout`).
4871
4871
  *
4872
4872
  * Strategy mirrors {@link PptxHandlerRuntimeSaveSlideMaster}: layouts are