pptx-vanilla-viewer 1.23.0 → 1.24.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,45 @@ 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
+ ## [1.23.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.23.1) - 2026-08-21
11
+
12
+ ### Bug Fixes
13
+
14
+ - **core:** Restore mc:AlternateContent envelope on passthrough template save (by @ChristopherVR) ([1659244](https://github.com/ChristopherVR/pptx-viewer/commit/165924427f0a2e1f834e1b24d7237a1c0125d8f6))
15
+ - **core:** Stop baking theme effectRef into a literal effectLst on save (by @ChristopherVR) ([59a5566](https://github.com/ChristopherVR/pptx-viewer/commit/59a5566aef9304d4f2a31c6b4e2f95f86841dd8f))
16
+ - **core:** Read line-family chart series colors on any chart, not just combo (by @ChristopherVR) ([e62dfcf](https://github.com/ChristopherVR/pptx-viewer/commit/e62dfcf2a6850a86944730f752b321c08b44e477))
17
+ - **core:** Write line-family chart series colors into a:ln, not a corrupting spPr (by @ChristopherVR) ([5b54357](https://github.com/ChristopherVR/pptx-viewer/commit/5b54357646ca63723944bbf44f8ac7c23912e035))
18
+
19
+ ## [1.23.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.23.0) - 2026-08-21
20
+
21
+ ### Features
22
+
23
+ - **shared:** Add header-footer dialog draft helpers (by @ChristopherVR) ([0f640c8](https://github.com/ChristopherVR/pptx-viewer/commit/0f640c887c4d6447d2a6cbba2754049cec69e121))
24
+ - **shared:** Add classifyMediaType, the audio/video MIME classifier (by @ChristopherVR) ([56520a1](https://github.com/ChristopherVR/pptx-viewer/commit/56520a1138f342b2e4e33ff5bbedb64f5a8ca9e4))
25
+ - **shared:** Add resolveTemplateBackgroundRows for the template background card (by @ChristopherVR) ([67d327d](https://github.com/ChristopherVR/pptx-viewer/commit/67d327d737a06b7ca737feffb01d9afe637c108f))
26
+ - **shared:** Add patchChartData, the type-aware chart data patcher (by @ChristopherVR) ([5309296](https://github.com/ChristopherVR/pptx-viewer/commit/5309296df312affd6c9f9994cc7e4612310d8119))
27
+ - **vanilla:** Add the missing element lock/unlock toggle (by @ChristopherVR) ([d56042b](https://github.com/ChristopherVR/pptx-viewer/commit/d56042be0301a6b31894b2c934a8114540396cf7))
28
+ - **shared:** Add pptx.group.childCount/groupedElement i18n keys (by @ChristopherVR) ([f5557e1](https://github.com/ChristopherVR/pptx-viewer/commit/f5557e1ac1ef74af4306cf81cd2c08c8b61dd960))
29
+ - **vanilla:** Add the missing group/OLE element info cards (by @ChristopherVR) ([1d027bd](https://github.com/ChristopherVR/pptx-viewer/commit/1d027bdc240c90e00dec510fc45bd45181b8ea56))
30
+ - **vanilla:** Add the table quick-style preset swatch gallery (by @ChristopherVR) ([db93b06](https://github.com/ChristopherVR/pptx-viewer/commit/db93b06c9fe83930ef01284f9c3fa5946707e9d6))
31
+ - **vanilla:** Add the missing transition click-to-play preview thumbnail (by @ChristopherVR) ([b95178b](https://github.com/ChristopherVR/pptx-viewer/commit/b95178b0c04e7eb98da0de25232c3cec807974cf))
32
+ - **vanilla:** Live-render SmartArt gallery previews, not a static icon (by @ChristopherVR) ([15117e4](https://github.com/ChristopherVR/pptx-viewer/commit/15117e4b5a5398da9248c83b4e1ce8d829997dd4))
33
+ - **vanilla:** Add SmartArt text-pane keyboard editing (Tab/Enter/Backspace) (by @ChristopherVR) ([6a32895](https://github.com/ChristopherVR/pptx-viewer/commit/6a3289532f4a12c72e0765f295cea75fe77c6fec))
34
+ - **vanilla:** Add table column/row drag-resize handles (by @ChristopherVR) ([4d1f969](https://github.com/ChristopherVR/pptx-viewer/commit/4d1f969b47cb387362a9a86ea21540b2493f2927))
35
+ - **vanilla:** Edit layout/master background from the slide inspector (by @ChristopherVR) ([054def4](https://github.com/ChristopherVR/pptx-viewer/commit/054def401963925b6376f943753e8d4f355cfbf4))
36
+
37
+ ### Bug Fixes
38
+
39
+ - **shared:** Sanitize every download filename, not just callers that remember to (by @ChristopherVR) ([7bdf73b](https://github.com/ChristopherVR/pptx-viewer/commit/7bdf73be98ae30b4664067a52b1611878d7d97b3))
40
+ - **shared:** Floor animation timeline bar width to a visible minimum (by @ChristopherVR) ([918ac2f](https://github.com/ChristopherVR/pptx-viewer/commit/918ac2f5a50d11fb1ad7e015956794f9cd44dfee))
41
+ - **svelte,vanilla:** Commit in-progress SmartArt node text before Tab/Enter (by @ChristopherVR) ([2c79a1f](https://github.com/ChristopherVR/pptx-viewer/commit/2c79a1fa5276ecbde39c27b8fb71b2723781c336))
42
+
43
+ ### Refactor
44
+
45
+ - **vanilla:** Repoint header-footer draft clone onto shared (by @ChristopherVR) ([c947ce2](https://github.com/ChristopherVR/pptx-viewer/commit/c947ce22d2c8a321bab10f4a07d3c8ba47955c5e))
46
+ - **react,vue,svelte,vanilla:** Repoint media-type check onto shared (by @ChristopherVR) ([bb8e95c](https://github.com/ChristopherVR/pptx-viewer/commit/bb8e95c810e2fd709e12f21d5b073b179e1dbf52))
47
+ - **vanilla:** Repoint animation timeline bar layout onto shared (by @ChristopherVR) ([c9ad169](https://github.com/ChristopherVR/pptx-viewer/commit/c9ad1697e68c54cda4e1f6597cb243a7933804ee))
48
+
10
49
  ## [1.22.4](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.22.4) - 2026-08-21
11
50
 
12
51
  ### Bug Fixes
@@ -1 +1 @@
1
- 'use strict';var chunk4XOUCYHV_cjs=require('./chunk-4XOUCYHV.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunk4XOUCYHV_cjs.Ek(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunk4XOUCYHV_cjs.Pk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-focus-row"),f=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunk4XOUCYHV_cjs.zk(p,o.getSlides())){let b=chunk4XOUCYHV_cjs.Ek(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=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-focus-actions"),d=chunk4XOUCYHV_cjs.Ak(p,o.getSlides());if(d){let r=chunk4XOUCYHV_cjs.Ek(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunk4XOUCYHV_cjs.Pk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunk4XOUCYHV_cjs.Bk(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=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-focus-pick"),b=chunk4XOUCYHV_cjs.Pk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunk4XOUCYHV_cjs.Ek(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=chunk4XOUCYHV_cjs.Ek(t,"button","pptxv-ai-chats");i.type="button",i.append(chunk4XOUCYHV_cjs.Pk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-history");a.hidden=true;let h=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-history-head"),x=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunk4XOUCYHV_cjs.Ek(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunk4XOUCYHV_cjs.Pk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-history-body"),m=chunk4XOUCYHV_cjs.Ek(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunk4XOUCYHV_cjs.Vk({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=chunk4XOUCYHV_cjs.Ek(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunk4XOUCYHV_cjs.Ek(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunk4XOUCYHV_cjs.Ek(t,"li","pptxv-ai-history-row"),r=chunk4XOUCYHV_cjs.Ek(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-history-text"),k=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunk4XOUCYHV_cjs.Pk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunk4XOUCYHV_cjs.Ek(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(chunk4XOUCYHV_cjs.Pk(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=chunk4XOUCYHV_cjs._k(t.toolName,t.input,h?"present":"past"),c=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-tool"),p=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-tool-head"),m=chunk4XOUCYHV_cjs.Pk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunk4XOUCYHV_cjs.Ek(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunk4XOUCYHV_cjs.Ek(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunk4XOUCYHV_cjs.Pk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunk4XOUCYHV_cjs.Pk(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=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunk4XOUCYHV_cjs.Zk(t.input);if(g){let f=chunk4XOUCYHV_cjs.Ek(o,"details","pptxv-ai-tool-details"),C=chunk4XOUCYHV_cjs.Ek(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunk4XOUCYHV_cjs.Yk(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=chunk4XOUCYHV_cjs.Xk(a);if(x.length===0&&!h)continue;let c=chunk4XOUCYHV_cjs.Ek(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunk4XOUCYHV_cjs.Pk(o,h?"comment":"sparkles"));let m=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunk4XOUCYHV_cjs.Ek(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=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-proposals-header"),x=chunk4XOUCYHV_cjs.Ek(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunk4XOUCYHV_cjs.Ek(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=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunk4XOUCYHV_cjs.Ek(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunk4XOUCYHV_cjs.Ek(o,"li");g.textContent=chunk4XOUCYHV_cjs.Rk(s),l.appendChild(g);}a.appendChild(l);}let c=chunk4XOUCYHV_cjs.Ek(o,"div","pptxv-ai-proposal-actions"),p=chunk4XOUCYHV_cjs.Ek(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunk4XOUCYHV_cjs.Pk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunk4XOUCYHV_cjs.Ek(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunk4XOUCYHV_cjs.Pk(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=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-header"),h=chunk4XOUCYHV_cjs.Ek(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunk4XOUCYHV_cjs.Ek(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunk4XOUCYHV_cjs.Pk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunk4XOUCYHV_cjs.Pk(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=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunk4XOUCYHV_cjs.Ek(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunk4XOUCYHV_cjs.Ek(t,"form","pptxv-ai-composer"),d=chunk4XOUCYHV_cjs.Ek(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunk4XOUCYHV_cjs.Ek(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunk4XOUCYHV_cjs.Pk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunk4XOUCYHV_cjs.Wk)({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:chunk4XOUCYHV_cjs.Uk(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=>chunk4XOUCYHV_cjs.Xk(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=chunk4XOUCYHV_cjs.$k(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
+ 'use strict';var chunkIH62Z3HH_cjs=require('./chunk-IH62Z3HH.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkIH62Z3HH_cjs.Ek(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkIH62Z3HH_cjs.Pk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-focus-row"),f=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkIH62Z3HH_cjs.zk(p,o.getSlides())){let b=chunkIH62Z3HH_cjs.Ek(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=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-focus-actions"),d=chunkIH62Z3HH_cjs.Ak(p,o.getSlides());if(d){let r=chunkIH62Z3HH_cjs.Ek(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkIH62Z3HH_cjs.Pk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkIH62Z3HH_cjs.Bk(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=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-focus-pick"),b=chunkIH62Z3HH_cjs.Pk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkIH62Z3HH_cjs.Ek(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=chunkIH62Z3HH_cjs.Ek(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkIH62Z3HH_cjs.Pk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-history-head"),x=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkIH62Z3HH_cjs.Ek(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkIH62Z3HH_cjs.Pk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-history-body"),m=chunkIH62Z3HH_cjs.Ek(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkIH62Z3HH_cjs.Vk({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=chunkIH62Z3HH_cjs.Ek(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkIH62Z3HH_cjs.Ek(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkIH62Z3HH_cjs.Ek(t,"li","pptxv-ai-history-row"),r=chunkIH62Z3HH_cjs.Ek(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-history-text"),k=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkIH62Z3HH_cjs.Pk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkIH62Z3HH_cjs.Ek(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(chunkIH62Z3HH_cjs.Pk(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=chunkIH62Z3HH_cjs._k(t.toolName,t.input,h?"present":"past"),c=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-tool"),p=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-tool-head"),m=chunkIH62Z3HH_cjs.Pk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkIH62Z3HH_cjs.Ek(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkIH62Z3HH_cjs.Ek(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkIH62Z3HH_cjs.Pk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkIH62Z3HH_cjs.Pk(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=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkIH62Z3HH_cjs.Zk(t.input);if(g){let f=chunkIH62Z3HH_cjs.Ek(o,"details","pptxv-ai-tool-details"),C=chunkIH62Z3HH_cjs.Ek(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkIH62Z3HH_cjs.Yk(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=chunkIH62Z3HH_cjs.Xk(a);if(x.length===0&&!h)continue;let c=chunkIH62Z3HH_cjs.Ek(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkIH62Z3HH_cjs.Pk(o,h?"comment":"sparkles"));let m=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkIH62Z3HH_cjs.Ek(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=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-proposals-header"),x=chunkIH62Z3HH_cjs.Ek(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkIH62Z3HH_cjs.Ek(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=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkIH62Z3HH_cjs.Ek(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkIH62Z3HH_cjs.Ek(o,"li");g.textContent=chunkIH62Z3HH_cjs.Rk(s),l.appendChild(g);}a.appendChild(l);}let c=chunkIH62Z3HH_cjs.Ek(o,"div","pptxv-ai-proposal-actions"),p=chunkIH62Z3HH_cjs.Ek(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkIH62Z3HH_cjs.Pk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkIH62Z3HH_cjs.Ek(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkIH62Z3HH_cjs.Pk(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=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-header"),h=chunkIH62Z3HH_cjs.Ek(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkIH62Z3HH_cjs.Ek(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkIH62Z3HH_cjs.Pk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkIH62Z3HH_cjs.Pk(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=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkIH62Z3HH_cjs.Ek(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkIH62Z3HH_cjs.Ek(t,"form","pptxv-ai-composer"),d=chunkIH62Z3HH_cjs.Ek(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkIH62Z3HH_cjs.Ek(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkIH62Z3HH_cjs.Pk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkIH62Z3HH_cjs.Wk)({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:chunkIH62Z3HH_cjs.Uk(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=>chunkIH62Z3HH_cjs.Xk(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=chunkIH62Z3HH_cjs.$k(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 {Ek,Pk,Wk,Uk,Vk,Xk,$k,zk,Ak,Bk,_k,Zk,Yk,Rk}from'./chunk-WN2LZM2C.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Ek(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Ek(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(Pk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Ek(t,"div","pptxv-ai-focus-row"),f=Ek(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of zk(p,o.getSlides())){let b=Ek(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=Ek(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Ek(t,"div","pptxv-ai-focus-actions"),d=Ak(p,o.getSlides());if(d){let r=Ek(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(Pk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Bk(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=Ek(t,"div","pptxv-ai-focus-pick"),b=Pk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Ek(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Ek(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=Ek(t,"button","pptxv-ai-chats");i.type="button",i.append(Pk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Ek(t,"div","pptxv-ai-history");a.hidden=true;let h=Ek(t,"div","pptxv-ai-history-head"),x=Ek(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Ek(t,"button","pptxv-ai-history-new");c.type="button",c.append(Pk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Ek(t,"div","pptxv-ai-history-body"),m=Ek(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=Vk({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=Ek(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Ek(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Ek(t,"li","pptxv-ai-history-row"),r=Ek(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Ek(t,"span","pptxv-ai-history-text"),k=Ek(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Ek(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(Pk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Ek(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(Pk(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=_k(t.toolName,t.input,h?"present":"past"),c=Ek(o,"div","pptxv-ai-tool"),p=Ek(o,"div","pptxv-ai-tool-head"),m=Pk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Ek(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Ek(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(Pk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(Pk(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=Ek(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Zk(t.input);if(g){let f=Ek(o,"details","pptxv-ai-tool-details"),C=Ek(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Ek(o,"div","pptxv-ai-tool-raw");d.textContent=`${Yk(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=Xk(a);if(x.length===0&&!h)continue;let c=Ek(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Ek(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(Pk(o,h?"comment":"sparkles"));let m=Ek(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Ek(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=Ek(o,"div","pptxv-ai-proposals-header"),x=Ek(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Ek(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=Ek(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Ek(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Ek(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Ek(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Ek(o,"li");g.textContent=Rk(s),l.appendChild(g);}a.appendChild(l);}let c=Ek(o,"div","pptxv-ai-proposal-actions"),p=Ek(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(Pk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Ek(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(Pk(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=Ek(t,"div","pptxv-ai-header"),h=Ek(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Ek(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(Pk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(Pk(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=Ek(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Ek(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Ek(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Ek(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Ek(t,"form","pptxv-ai-composer"),d=Ek(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Ek(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(Pk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??Wk)({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:Uk(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=>Xk(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=$k(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 {Ek,Pk,Wk,Uk,Vk,Xk,$k,zk,Ak,Bk,_k,Zk,Yk,Rk}from'./chunk-5YMH3WLI.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Ek(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Ek(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(Pk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Ek(t,"div","pptxv-ai-focus-row"),f=Ek(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of zk(p,o.getSlides())){let b=Ek(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=Ek(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Ek(t,"div","pptxv-ai-focus-actions"),d=Ak(p,o.getSlides());if(d){let r=Ek(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(Pk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Bk(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=Ek(t,"div","pptxv-ai-focus-pick"),b=Pk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Ek(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Ek(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=Ek(t,"button","pptxv-ai-chats");i.type="button",i.append(Pk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Ek(t,"div","pptxv-ai-history");a.hidden=true;let h=Ek(t,"div","pptxv-ai-history-head"),x=Ek(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Ek(t,"button","pptxv-ai-history-new");c.type="button",c.append(Pk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Ek(t,"div","pptxv-ai-history-body"),m=Ek(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=Vk({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=Ek(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Ek(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Ek(t,"li","pptxv-ai-history-row"),r=Ek(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Ek(t,"span","pptxv-ai-history-text"),k=Ek(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Ek(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(Pk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Ek(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(Pk(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=_k(t.toolName,t.input,h?"present":"past"),c=Ek(o,"div","pptxv-ai-tool"),p=Ek(o,"div","pptxv-ai-tool-head"),m=Pk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Ek(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Ek(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(Pk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(Pk(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=Ek(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Zk(t.input);if(g){let f=Ek(o,"details","pptxv-ai-tool-details"),C=Ek(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Ek(o,"div","pptxv-ai-tool-raw");d.textContent=`${Yk(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=Xk(a);if(x.length===0&&!h)continue;let c=Ek(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Ek(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(Pk(o,h?"comment":"sparkles"));let m=Ek(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Ek(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=Ek(o,"div","pptxv-ai-proposals-header"),x=Ek(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Ek(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=Ek(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Ek(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Ek(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Ek(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Ek(o,"li");g.textContent=Rk(s),l.appendChild(g);}a.appendChild(l);}let c=Ek(o,"div","pptxv-ai-proposal-actions"),p=Ek(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(Pk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Ek(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(Pk(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=Ek(t,"div","pptxv-ai-header"),h=Ek(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Ek(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(Pk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(Pk(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=Ek(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Ek(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Ek(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Ek(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Ek(t,"form","pptxv-ai-composer"),d=Ek(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Ek(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(Pk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??Wk)({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:Uk(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=>Xk(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=$k(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};