pptx-vanilla-viewer 2.6.0 → 2.7.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ A release listed with no entries carried no Conventional Commit in this package'
7
7
  scope: scripts/release-plan.mjs re-releases a package whenever any of its files
8
8
  change, not only on conventional ones.
9
9
 
10
+ ## [2.6.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.6.0) - 2026-09-05
11
+
12
+ ### Features
13
+
14
+ - **core:** Close ECMA-376 parse/serialize gaps from the 2026-09 parity audit (by @ChristopherVR) ([91ddcb7](https://github.com/ChristopherVR/pptx-viewer/commit/91ddcb7a53f67c7f52a9b9c16f00365d5f2f73ef))
15
+ - **shared:** Render-side parity for the 2026-09 OpenXML audit gaps (by @ChristopherVR) ([266f255](https://github.com/ChristopherVR/pptx-viewer/commit/266f2558e8a431e50fb7c866d1de97aae3b06ec2))
16
+ - **vanilla:** Map the 2026-09 OpenXML parity wave onto the vanilla viewer (by @ChristopherVR) ([d582fef](https://github.com/ChristopherVR/pptx-viewer/commit/d582fef80f5440218282dc14b52a0fd897453f9f))
17
+ - **core:** Close the remaining OpenXML parity gaps (wave 2) (by @ChristopherVR) ([59fecbf](https://github.com/ChristopherVR/pptx-viewer/commit/59fecbff7c44809640a3ea75d92491f3c93d67d1))
18
+ - **shared:** Framework-neutral logic for the wave-2 OpenXML gaps (by @ChristopherVR) ([9ab1d92](https://github.com/ChristopherVR/pptx-viewer/commit/9ab1d926fb56d3efaa3031f9f7beca09e85aa9a3))
19
+ - **vanilla:** Wire the wave-2 OpenXML parity features (by @ChristopherVR) ([2f247b2](https://github.com/ChristopherVR/pptx-viewer/commit/2f247b299ecaf1eb732a7d86c4fff9133b5a6f59))
20
+
21
+ ### Testing
22
+
23
+ - **core:** Declare the wave-2 e2e fixtures in the corpus manifest (by @ChristopherVR) ([593d3ba](https://github.com/ChristopherVR/pptx-viewer/commit/593d3ba1a807e3e712b41c372bd5f7c65ea396bc))
24
+
10
25
  ## [2.5.5](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.5.5) - 2026-09-04
11
26
 
12
27
  ### Bug Fixes
@@ -0,0 +1 @@
1
+ 'use strict';var chunkHTQCNJMD_cjs=require('./chunk-HTQCNJMD.cjs');require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkHTQCNJMD_cjs.mn(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-focus-row"),f=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkHTQCNJMD_cjs.Qm(p,o.getSlides())){let b=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-focus-actions"),d=chunkHTQCNJMD_cjs.Rm(p,o.getSlides());if(d){let r=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkHTQCNJMD_cjs.mn(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkHTQCNJMD_cjs.Sm(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-focus-pick"),b=chunkHTQCNJMD_cjs.mn(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkHTQCNJMD_cjs.mn(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-history-head"),x=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkHTQCNJMD_cjs.mn(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-history-body"),m=chunkHTQCNJMD_cjs.bn(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkHTQCNJMD_cjs.Um({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=chunkHTQCNJMD_cjs.bn(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkHTQCNJMD_cjs.bn(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkHTQCNJMD_cjs.bn(t,"li","pptxv-ai-history-row"),r=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-history-text"),k=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkHTQCNJMD_cjs.mn(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(chunkHTQCNJMD_cjs.mn(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=chunkHTQCNJMD_cjs.Zm(t.toolName,t.input,h?"present":"past"),c=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-tool"),p=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-tool-head"),m=chunkHTQCNJMD_cjs.mn(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkHTQCNJMD_cjs.bn(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkHTQCNJMD_cjs.bn(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkHTQCNJMD_cjs.mn(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkHTQCNJMD_cjs.mn(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkHTQCNJMD_cjs.Ym(t.input);if(g){let f=chunkHTQCNJMD_cjs.bn(o,"details","pptxv-ai-tool-details"),C=chunkHTQCNJMD_cjs.bn(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkHTQCNJMD_cjs.Xm(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=chunkHTQCNJMD_cjs.Mm(a);if(x.length===0&&!h)continue;let c=chunkHTQCNJMD_cjs.bn(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkHTQCNJMD_cjs.mn(o,h?"comment":"sparkles"));let m=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-proposals-header"),x=chunkHTQCNJMD_cjs.bn(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkHTQCNJMD_cjs.bn(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkHTQCNJMD_cjs.bn(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkHTQCNJMD_cjs.bn(o,"li");g.textContent=chunkHTQCNJMD_cjs.Jm(s),l.appendChild(g);}a.appendChild(l);}let c=chunkHTQCNJMD_cjs.bn(o,"div","pptxv-ai-proposal-actions"),p=chunkHTQCNJMD_cjs.bn(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkHTQCNJMD_cjs.mn(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkHTQCNJMD_cjs.bn(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkHTQCNJMD_cjs.mn(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-header"),h=chunkHTQCNJMD_cjs.bn(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkHTQCNJMD_cjs.mn(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkHTQCNJMD_cjs.mn(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkHTQCNJMD_cjs.bn(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkHTQCNJMD_cjs.bn(t,"form","pptxv-ai-composer"),d=chunkHTQCNJMD_cjs.bn(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkHTQCNJMD_cjs.bn(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkHTQCNJMD_cjs.mn(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkHTQCNJMD_cjs.Vm)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:chunkHTQCNJMD_cjs.Tm(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>chunkHTQCNJMD_cjs.Mm(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=chunkHTQCNJMD_cjs._m(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}exports.createAiPanel=wt;
@@ -1 +1 @@
1
- import {Rm,an,Jm,Hm,Im,Am,Om,Em,Fm,Gm,Nm,Mm,Lm,xm}from'./chunk-XL46R5WV.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Rm(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Rm(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(an(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Rm(t,"div","pptxv-ai-focus-row"),f=Rm(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Em(p,o.getSlides())){let b=Rm(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=Rm(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Rm(t,"div","pptxv-ai-focus-actions"),d=Fm(p,o.getSlides());if(d){let r=Rm(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(an(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Gm(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=Rm(t,"div","pptxv-ai-focus-pick"),b=an(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Rm(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Rm(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=Rm(t,"button","pptxv-ai-chats");i.type="button",i.append(an(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Rm(t,"div","pptxv-ai-history");a.hidden=true;let h=Rm(t,"div","pptxv-ai-history-head"),x=Rm(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Rm(t,"button","pptxv-ai-history-new");c.type="button",c.append(an(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Rm(t,"div","pptxv-ai-history-body"),m=Rm(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=Im({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=Rm(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Rm(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Rm(t,"li","pptxv-ai-history-row"),r=Rm(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Rm(t,"span","pptxv-ai-history-text"),k=Rm(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Rm(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(an(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Rm(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(an(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=Nm(t.toolName,t.input,h?"present":"past"),c=Rm(o,"div","pptxv-ai-tool"),p=Rm(o,"div","pptxv-ai-tool-head"),m=an(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Rm(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Rm(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(an(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(an(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=Rm(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Mm(t.input);if(g){let f=Rm(o,"details","pptxv-ai-tool-details"),C=Rm(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Rm(o,"div","pptxv-ai-tool-raw");d.textContent=`${Lm(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=Am(a);if(x.length===0&&!h)continue;let c=Rm(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Rm(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(an(o,h?"comment":"sparkles"));let m=Rm(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Rm(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=Rm(o,"div","pptxv-ai-proposals-header"),x=Rm(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Rm(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=Rm(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Rm(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Rm(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Rm(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Rm(o,"li");g.textContent=xm(s),l.appendChild(g);}a.appendChild(l);}let c=Rm(o,"div","pptxv-ai-proposal-actions"),p=Rm(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(an(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Rm(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(an(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=Rm(t,"div","pptxv-ai-header"),h=Rm(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Rm(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(an(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(an(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=Rm(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Rm(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Rm(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Rm(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Rm(t,"form","pptxv-ai-composer"),d=Rm(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Rm(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(an(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??Jm)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:Hm(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>Am(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=Om(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};
1
+ import {bn,mn,Vm,Tm,Um,Mm,_m,Qm,Rm,Sm,Zm,Ym,Xm,Jm}from'./chunk-GH6VDNPP.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=bn(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=bn(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(mn(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=bn(t,"div","pptxv-ai-focus-row"),f=bn(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Qm(p,o.getSlides())){let b=bn(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=bn(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=bn(t,"div","pptxv-ai-focus-actions"),d=Rm(p,o.getSlides());if(d){let r=bn(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(mn(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Sm(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=bn(t,"div","pptxv-ai-focus-pick"),b=mn(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=bn(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=bn(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=bn(t,"button","pptxv-ai-chats");i.type="button",i.append(mn(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=bn(t,"div","pptxv-ai-history");a.hidden=true;let h=bn(t,"div","pptxv-ai-history-head"),x=bn(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=bn(t,"button","pptxv-ai-history-new");c.type="button",c.append(mn(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=bn(t,"div","pptxv-ai-history-body"),m=bn(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=Um({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=bn(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=bn(t,"ul","pptxv-ai-history-list");for(let d of f){let y=bn(t,"li","pptxv-ai-history-row"),r=bn(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=bn(t,"span","pptxv-ai-history-text"),k=bn(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=bn(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(mn(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=bn(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(mn(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=Zm(t.toolName,t.input,h?"present":"past"),c=bn(o,"div","pptxv-ai-tool"),p=bn(o,"div","pptxv-ai-tool-head"),m=mn(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=bn(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=bn(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(mn(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(mn(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=bn(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Ym(t.input);if(g){let f=bn(o,"details","pptxv-ai-tool-details"),C=bn(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=bn(o,"div","pptxv-ai-tool-raw");d.textContent=`${Xm(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=Mm(a);if(x.length===0&&!h)continue;let c=bn(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=bn(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(mn(o,h?"comment":"sparkles"));let m=bn(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=bn(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=bn(o,"div","pptxv-ai-proposals-header"),x=bn(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=bn(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=bn(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=bn(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=bn(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=bn(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=bn(o,"li");g.textContent=Jm(s),l.appendChild(g);}a.appendChild(l);}let c=bn(o,"div","pptxv-ai-proposal-actions"),p=bn(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(mn(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=bn(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(mn(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=bn(t,"div","pptxv-ai-header"),h=bn(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=bn(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(mn(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(mn(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=bn(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=bn(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=bn(t,"div","pptxv-ai-proposals");g.hidden=true;let f=bn(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=bn(t,"form","pptxv-ai-composer"),d=bn(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=bn(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(mn(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??Vm)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:Tm(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>Mm(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=_m(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};