pptx-vanilla-viewer 1.22.0 → 1.22.2
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 +35 -0
- package/dist/{ai-panel-UWCHNZUF.js → ai-panel-3VF3W7SO.js} +1 -1
- package/dist/ai-panel-MNAUDDQC.cjs +1 -0
- package/dist/{chunk-LVEPALNR.js → chunk-4HGJAMOJ.js} +172 -172
- package/dist/{chunk-6PUK7WVZ.cjs → chunk-YZYIRA62.cjs} +172 -172
- package/dist/index.cjs +64 -64
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -62
- package/package.json +1 -1
- package/dist/ai-panel-SNP5TZMK.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,41 @@ 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.22.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.22.1) - 2026-08-20
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **shared:** Repoint options numeric-control clamp onto shared helper (by @ChristopherVR) ([138dfe5](https://github.com/ChristopherVR/pptx-viewer/commit/138dfe5d6cc780915ab8d9ca591f75c698b35f22))
|
|
15
|
+
|
|
16
|
+
### Refactor
|
|
17
|
+
|
|
18
|
+
- **shared,react,vue,vanilla:** Repoint comment mutations onto shared comments-list (by @ChristopherVR) ([0eb28dc](https://github.com/ChristopherVR/pptx-viewer/commit/0eb28dc5d714ebe695c8b23c6b09aefc6b99ac0d))
|
|
19
|
+
|
|
20
|
+
## [1.22.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.22.0) - 2026-08-20
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- **shared:** Add hover tooltips to every chart mark, not just the region map (by @ChristopherVR) ([4ca29f5](https://github.com/ChristopherVR/pptx-viewer/commit/4ca29f590b1d1154b1034b7c5aeaa469610353d5))
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
- **angular:** Wire Home ribbon Reset/Fill/Outline through shared commands (by @ChristopherVR) ([c06b894](https://github.com/ChristopherVR/pptx-viewer/commit/c06b8947fae4888b0db69f37c043bfe9e83dd66d))
|
|
29
|
+
- **vanilla:** Expand cell-merge rect over existing merges before validating (by @ChristopherVR) ([49d9ce7](https://github.com/ChristopherVR/pptx-viewer/commit/49d9ce7e8c6a2eb3ed4e58d4bef4d2679430b43d))
|
|
30
|
+
- **svelte,vanilla:** Wire double-click chart title rename (by @ChristopherVR) ([48b997c](https://github.com/ChristopherVR/pptx-viewer/commit/48b997ca7b24a3340100cf6f52b7251e5ca39e6e))
|
|
31
|
+
- **shared:** Stack line/area charts and lock their drag geometry (by @ChristopherVR) ([0da8ba5](https://github.com/ChristopherVR/pptx-viewer/commit/0da8ba55a5793d94af7822fcc7de63aa1d0243bb))
|
|
32
|
+
- **vanilla:** Surface on-canvas chart part selection to the inspector (by @ChristopherVR) ([e71646f](https://github.com/ChristopherVR/pptx-viewer/commit/e71646f30c8fe80db557c50fb5437f2238672b1d))
|
|
33
|
+
- **shared:** Extract table column-width redistribution to shared (by @ChristopherVR) ([cbd9fc7](https://github.com/ChristopherVR/pptx-viewer/commit/cbd9fc78dde57a72de3049a2ea01e1676957b463))
|
|
34
|
+
|
|
35
|
+
### Refactor
|
|
36
|
+
|
|
37
|
+
- **shared:** Extract SmartArt node-count bounds table (by @ChristopherVR) ([10cd945](https://github.com/ChristopherVR/pptx-viewer/commit/10cd945140ea3757086f0c4b1c6ea71adbb4d825))
|
|
38
|
+
- **shared:** Extract animation drag-to-reorder into shared (by @ChristopherVR) ([b136d02](https://github.com/ChristopherVR/pptx-viewer/commit/b136d023174959e9c51b3667e8ab78a8a983cb9f))
|
|
39
|
+
- **shared:** Extract SmartArt text-pane handlers to shared (by @ChristopherVR) ([911693c](https://github.com/ChristopherVR/pptx-viewer/commit/911693c9c02b63ee284890653b4dc977e35af170))
|
|
40
|
+
- **shared:** Extract chart legend layout to shared (by @ChristopherVR) ([acec62b](https://github.com/ChristopherVR/pptx-viewer/commit/acec62b1be7203e90206a0852e6544b73bb52266))
|
|
41
|
+
- **shared:** Extract animation timeline-bar layout math to shared (by @ChristopherVR) ([1a9f66d](https://github.com/ChristopherVR/pptx-viewer/commit/1a9f66d7629e18174997fdf9135edb7a70d8660e))
|
|
42
|
+
- **shared:** Extract table quick-style preset application (by @ChristopherVR) ([aa52c10](https://github.com/ChristopherVR/pptx-viewer/commit/aa52c106a158b2c2361b05e05968d9daadda2e52))
|
|
43
|
+
- **shared:** Extract export base-filename derivation to shared (by @ChristopherVR) ([58091bc](https://github.com/ChristopherVR/pptx-viewer/commit/58091bc18e766b3c870fe4af9f8c11bd0384899c))
|
|
44
|
+
|
|
10
45
|
## [1.21.7](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.21.7) - 2026-08-19
|
|
11
46
|
|
|
12
47
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {hk,rk,yk,wk,xk,zk,Dk,ck,dk,ek,Ck,Bk,Ak,tk}from'./chunk-LVEPALNR.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=hk(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=hk(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(rk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=hk(t,"div","pptxv-ai-focus-row"),f=hk(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of ck(p,o.getSlides())){let b=hk(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=hk(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=hk(t,"div","pptxv-ai-focus-actions"),d=dk(p,o.getSlides());if(d){let r=hk(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(rk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(ek(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=hk(t,"div","pptxv-ai-focus-pick"),b=rk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=hk(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=hk(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=hk(t,"button","pptxv-ai-chats");i.type="button",i.append(rk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=hk(t,"div","pptxv-ai-history");a.hidden=true;let h=hk(t,"div","pptxv-ai-history-head"),x=hk(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=hk(t,"button","pptxv-ai-history-new");c.type="button",c.append(rk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=hk(t,"div","pptxv-ai-history-body"),m=hk(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=xk({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=hk(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=hk(t,"ul","pptxv-ai-history-list");for(let d of f){let y=hk(t,"li","pptxv-ai-history-row"),r=hk(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=hk(t,"span","pptxv-ai-history-text"),k=hk(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=hk(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(rk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=hk(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(rk(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=Ck(t.toolName,t.input,h?"present":"past"),c=hk(o,"div","pptxv-ai-tool"),p=hk(o,"div","pptxv-ai-tool-head"),m=rk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=hk(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=hk(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(rk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(rk(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=hk(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Bk(t.input);if(g){let f=hk(o,"details","pptxv-ai-tool-details"),C=hk(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=hk(o,"div","pptxv-ai-tool-raw");d.textContent=`${Ak(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=zk(a);if(x.length===0&&!h)continue;let c=hk(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=hk(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(rk(o,h?"comment":"sparkles"));let m=hk(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=hk(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=hk(o,"div","pptxv-ai-proposals-header"),x=hk(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=hk(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=hk(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=hk(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=hk(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=hk(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=hk(o,"li");g.textContent=tk(s),l.appendChild(g);}a.appendChild(l);}let c=hk(o,"div","pptxv-ai-proposal-actions"),p=hk(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(rk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=hk(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(rk(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=hk(t,"div","pptxv-ai-header"),h=hk(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=hk(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(rk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(rk(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=hk(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=hk(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=hk(t,"div","pptxv-ai-proposals");g.hidden=true;let f=hk(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=hk(t,"form","pptxv-ai-composer"),d=hk(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=hk(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(rk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??yk)({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:wk(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=>zk(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=Dk(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 {nk,xk,Ek,Ck,Dk,Fk,Jk,ik,jk,kk,Ik,Hk,Gk,zk}from'./chunk-4HGJAMOJ.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=nk(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=nk(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(xk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=nk(t,"div","pptxv-ai-focus-row"),f=nk(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of ik(p,o.getSlides())){let b=nk(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=nk(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=nk(t,"div","pptxv-ai-focus-actions"),d=jk(p,o.getSlides());if(d){let r=nk(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(xk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(kk(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=nk(t,"div","pptxv-ai-focus-pick"),b=xk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=nk(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=nk(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=nk(t,"button","pptxv-ai-chats");i.type="button",i.append(xk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=nk(t,"div","pptxv-ai-history");a.hidden=true;let h=nk(t,"div","pptxv-ai-history-head"),x=nk(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=nk(t,"button","pptxv-ai-history-new");c.type="button",c.append(xk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=nk(t,"div","pptxv-ai-history-body"),m=nk(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=Dk({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=nk(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=nk(t,"ul","pptxv-ai-history-list");for(let d of f){let y=nk(t,"li","pptxv-ai-history-row"),r=nk(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=nk(t,"span","pptxv-ai-history-text"),k=nk(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=nk(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(xk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=nk(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(xk(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=Ik(t.toolName,t.input,h?"present":"past"),c=nk(o,"div","pptxv-ai-tool"),p=nk(o,"div","pptxv-ai-tool-head"),m=xk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=nk(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=nk(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(xk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(xk(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=nk(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Hk(t.input);if(g){let f=nk(o,"details","pptxv-ai-tool-details"),C=nk(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=nk(o,"div","pptxv-ai-tool-raw");d.textContent=`${Gk(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=Fk(a);if(x.length===0&&!h)continue;let c=nk(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=nk(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(xk(o,h?"comment":"sparkles"));let m=nk(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=nk(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=nk(o,"div","pptxv-ai-proposals-header"),x=nk(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=nk(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=nk(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=nk(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=nk(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=nk(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=nk(o,"li");g.textContent=zk(s),l.appendChild(g);}a.appendChild(l);}let c=nk(o,"div","pptxv-ai-proposal-actions"),p=nk(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(xk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=nk(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(xk(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=nk(t,"div","pptxv-ai-header"),h=nk(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=nk(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(xk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(xk(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=nk(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=nk(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=nk(t,"div","pptxv-ai-proposals");g.hidden=true;let f=nk(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=nk(t,"form","pptxv-ai-composer"),d=nk(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=nk(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(xk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??Ek)({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:Ck(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=>Fk(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=Jk(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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkYZYIRA62_cjs=require('./chunk-YZYIRA62.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkYZYIRA62_cjs.nk(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkYZYIRA62_cjs.xk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-focus-row"),f=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkYZYIRA62_cjs.ik(p,o.getSlides())){let b=chunkYZYIRA62_cjs.nk(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=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-focus-actions"),d=chunkYZYIRA62_cjs.jk(p,o.getSlides());if(d){let r=chunkYZYIRA62_cjs.nk(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkYZYIRA62_cjs.xk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkYZYIRA62_cjs.kk(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=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-focus-pick"),b=chunkYZYIRA62_cjs.xk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkYZYIRA62_cjs.nk(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=chunkYZYIRA62_cjs.nk(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkYZYIRA62_cjs.xk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-history-head"),x=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkYZYIRA62_cjs.nk(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkYZYIRA62_cjs.xk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-history-body"),m=chunkYZYIRA62_cjs.nk(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkYZYIRA62_cjs.Dk({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=chunkYZYIRA62_cjs.nk(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkYZYIRA62_cjs.nk(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkYZYIRA62_cjs.nk(t,"li","pptxv-ai-history-row"),r=chunkYZYIRA62_cjs.nk(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-history-text"),k=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkYZYIRA62_cjs.xk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkYZYIRA62_cjs.nk(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(chunkYZYIRA62_cjs.xk(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=chunkYZYIRA62_cjs.Ik(t.toolName,t.input,h?"present":"past"),c=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-tool"),p=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-tool-head"),m=chunkYZYIRA62_cjs.xk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkYZYIRA62_cjs.nk(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkYZYIRA62_cjs.nk(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkYZYIRA62_cjs.xk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkYZYIRA62_cjs.xk(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=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkYZYIRA62_cjs.Hk(t.input);if(g){let f=chunkYZYIRA62_cjs.nk(o,"details","pptxv-ai-tool-details"),C=chunkYZYIRA62_cjs.nk(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkYZYIRA62_cjs.Gk(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=chunkYZYIRA62_cjs.Fk(a);if(x.length===0&&!h)continue;let c=chunkYZYIRA62_cjs.nk(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkYZYIRA62_cjs.xk(o,h?"comment":"sparkles"));let m=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkYZYIRA62_cjs.nk(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=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-proposals-header"),x=chunkYZYIRA62_cjs.nk(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkYZYIRA62_cjs.nk(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=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkYZYIRA62_cjs.nk(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkYZYIRA62_cjs.nk(o,"li");g.textContent=chunkYZYIRA62_cjs.zk(s),l.appendChild(g);}a.appendChild(l);}let c=chunkYZYIRA62_cjs.nk(o,"div","pptxv-ai-proposal-actions"),p=chunkYZYIRA62_cjs.nk(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkYZYIRA62_cjs.xk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkYZYIRA62_cjs.nk(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkYZYIRA62_cjs.xk(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=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-header"),h=chunkYZYIRA62_cjs.nk(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkYZYIRA62_cjs.nk(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkYZYIRA62_cjs.xk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkYZYIRA62_cjs.xk(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=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkYZYIRA62_cjs.nk(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkYZYIRA62_cjs.nk(t,"form","pptxv-ai-composer"),d=chunkYZYIRA62_cjs.nk(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkYZYIRA62_cjs.nk(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkYZYIRA62_cjs.xk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkYZYIRA62_cjs.Ek)({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:chunkYZYIRA62_cjs.Ck(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=>chunkYZYIRA62_cjs.Fk(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=chunkYZYIRA62_cjs.Jk(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;
|