pptx-vanilla-viewer 1.3.1 → 1.5.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 +4 -0
- package/dist/ai-panel-5DE3C5HS.js +1 -0
- package/dist/ai-panel-QZA7R5YL.cjs +1 -0
- package/dist/chunk-7OOT5DXH.cjs +1629 -0
- package/dist/chunk-PUFXGPWP.js +1629 -0
- package/dist/index.cjs +10 -10
- package/dist/index.d.ts +117 -101
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/package.json +4 -4
- package/dist/ai-panel-3WRK5FDF.js +0 -1
- package/dist/ai-panel-XL4JNYCO.cjs +0 -1
- package/dist/chunk-H6FIDO5T.js +0 -1312
- package/dist/chunk-RLV2GEN7.js +0 -370
- package/dist/chunk-RPCQE4MF.cjs +0 -370
- package/dist/chunk-ZAC3M5KZ.cjs +0 -1312
- package/dist/dist-D3ICOC2G.cjs +0 -1
- package/dist/dist-GJO6PHQ2.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-vanilla-viewer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Zero-framework PowerPoint viewer and editor: render, edit, present, and export PPTX slides with plain DOM, no React/Vue/Angular required.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"html2canvas-pro": "^2.2.4",
|
|
61
61
|
"jspdf": "^4.2.1",
|
|
62
62
|
"jszip": "^3.10.1",
|
|
63
|
-
"lucide": "^1.
|
|
63
|
+
"lucide": "^1.26.0",
|
|
64
64
|
"pptx-viewer-mcp": "workspace:*"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/dompurify": "^3.2.0",
|
|
68
|
-
"happy-dom": "^20.11.
|
|
69
|
-
"tsdown": "^0.22.
|
|
68
|
+
"happy-dom": "^20.11.1",
|
|
69
|
+
"tsdown": "^0.22.14",
|
|
70
70
|
"tsup": "^8.5.1",
|
|
71
71
|
"typescript": "^7.0.2",
|
|
72
72
|
"vitest": "^4.1.10",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {Me,Ve,_e,$e,df,He,Ie,Je,cf,bf,af,Xe}from'./chunk-H6FIDO5T.js';import'./chunk-RLV2GEN7.js';import'./chunk-WOT6VMZA.js';function j(e){let{doc:t,t:n,controller:i}=e,p=Me(t,"div","pptxv-ai-focus"),m=(c,s,d)=>{let r=Me(t,"button","pptxv-ai-focus-btn");return r.type="button",r.title=s,r.setAttribute("aria-label",s),r.appendChild(Ve(t,c)),r.addEventListener("click",d),r},x=()=>{p.replaceChildren();let c=i.getEffectiveTargets(),s=i.hasPicks(),d=i.isPinned(),r=i.isPicking(),f=Me(t,"div","pptxv-ai-focus-row"),b=Me(t,"span","pptxv-ai-focus-label");b.textContent=n("pptx.ai.focusScope"),f.appendChild(b);for(let h of He(c,e.getSlides())){let T=Me(t,"span","pptxv-ai-focus-chip");(s||d)&&T.classList.add("is-strong"),T.title=h.title,T.textContent=h.label,f.appendChild(T);}if(d){let h=Me(t,"span","pptxv-ai-focus-pinned");h.textContent=n("pptx.ai.pinnedFocus"),f.appendChild(h);}let u=Me(t,"div","pptxv-ai-focus-actions"),C=Ie(c,e.getSlides());if(C){let h=Me(t,"button","pptxv-ai-focus-merge");h.type="button",h.append(Ve(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),h.addEventListener("click",()=>e.onSendDirective(Je(C.slideIndex,C.elementIdA,C.elementIdB))),u.appendChild(h);}let v=m("crosshair",n("pptx.ai.pickElement"),()=>r?i.stopPicking():i.startPicking());if(v.setAttribute("aria-pressed",String(r)),v.classList.toggle("is-active",r),u.appendChild(v),s?u.appendChild(m("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):d?u.appendChild(m("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):u.appendChild(m("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),f.appendChild(u),p.appendChild(f),r){let h=Me(t,"div","pptxv-ai-focus-pick"),T=Ve(t,"crosshair");T.classList.add("pptxv-ai-focus-pick-icon");let A=Me(t,"span","pptxv-ai-focus-pick-hint");A.textContent=n("pptx.ai.pickElementHint");let P=Me(t,"button","pptxv-ai-focus-pick-done");P.type="button",P.textContent=n("pptx.ai.pickDone"),P.addEventListener("click",()=>i.stopPicking()),h.append(T,A,P),p.appendChild(h);}},a=i.subscribe(x);return x(),{el:p,destroy(){a(),p.remove();}}}var J={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 R(e,t,n){let i=t.state==="output-error",p=t.state==="output-available",m=!i&&!p,x=cf(t.toolName,t.input,m?"present":"past"),a=Me(e,"div","pptxv-ai-tool"),c=Me(e,"div","pptxv-ai-tool-head"),s=Ve(e,J[x.icon]??"wrench");s.classList.add("pptxv-ai-tool-icon");let d=Me(e,"span","pptxv-ai-tool-name");d.textContent=x.label;let r=Me(e,"span","pptxv-ai-tool-state");if(i?(r.classList.add("is-error"),r.append(Ve(e,"alert"),e.createTextNode(n("pptx.ai.toolFailed")))):p?(r.classList.add("is-done"),r.append(Ve(e,"check"),e.createTextNode(n("pptx.ai.toolDone")))):(r.classList.add("is-running"),r.textContent=n("pptx.ai.toolRunning")),c.append(s,d,r),a.appendChild(c),i&&t.errorText){let b=Me(e,"div","pptxv-ai-tool-error");b.textContent=t.errorText,a.appendChild(b);}let f=bf(t.input);if(f){let b=Me(e,"details","pptxv-ai-tool-details"),u=Me(e,"summary");u.textContent=n("pptx.ai.toolDetails");let C=Me(e,"div","pptxv-ai-tool-raw");C.textContent=`${af(t.toolName)}: ${f}`,b.append(u,C),a.appendChild(b);}return a}function U(e,t,n,i){t.replaceChildren();for(let p of n){if(p.role==="system")continue;let m=p.role==="user",x=$e(p);if(x.length===0&&!m)continue;let a=Me(e,"div",`pptxv-ai-msg pptxv-ai-msg-${p.role}`),c=Me(e,"div","pptxv-ai-msg-avatar");c.setAttribute("aria-label",i(m?"pptx.ai.you":"pptx.ai.assistant")),c.appendChild(Ve(e,m?"comment":"sparkles"));let s=Me(e,"div","pptxv-ai-msg-body");for(let d of x)if(d.kind==="text"){let r=Me(e,"div","pptxv-ai-msg-text");r.textContent=d.text,s.appendChild(r);}else s.appendChild(R(e,d,i));a.append(c,s),t.appendChild(a);}}function $(e,t,n,i,p){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let m=Me(e,"div","pptxv-ai-proposals-header"),x=Me(e,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),m.appendChild(x),n.length>1){let a=Me(e,"button","pptxv-ai-proposal-btn is-accept-all");a.type="button",a.textContent=i("pptx.ai.acceptAll"),a.addEventListener("click",()=>p.acceptAll()),m.appendChild(a);}t.appendChild(m);for(let a of n)t.appendChild(Q(e,a,i,p));}function Q(e,t,n,i){let p=Me(e,"div","pptxv-ai-proposal");p.dataset.proposalId=t.id;let m=Me(e,"div","pptxv-ai-proposal-eyebrow");m.textContent=n("pptx.ai.proposedChange"),p.appendChild(m);let x=Me(e,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,p.appendChild(x),t.summary.length>0){let d=Me(e,"ul","pptxv-ai-proposal-summary");for(let r of t.summary){let f=Me(e,"li");f.textContent=Xe(r),d.appendChild(f);}p.appendChild(d);}let a=Me(e,"div","pptxv-ai-proposal-actions"),c=Me(e,"button","pptxv-ai-proposal-btn is-accept");c.type="button",c.append(Ve(e,"check"),e.createTextNode(n("pptx.ai.accept"))),c.addEventListener("click",()=>i.accept(t.id));let s=Me(e,"button","pptxv-ai-proposal-btn is-reject");return s.type="button",s.append(Ve(e,"close"),e.createTextNode(n("pptx.ai.reject"))),s.addEventListener("click",()=>i.reject(t.id)),a.append(c,s),p.appendChild(a),p}async function gt(e){let{doc:t,host:n,t:i}=e;n.replaceChildren();let p=Me(t,"div","pptxv-ai-header"),m=Me(t,"span","pptxv-ai-title");m.textContent=i("pptx.ai.title"),p.append(Ve(t,"sparkles"),m);let x,a=e.controller,c=a?j({doc:t,t:i,controller:a,getSlides:()=>e.bridge.getSlides(),onSendDirective:l=>{x?.sendMessage(l);}}):null,s=Me(t,"div","pptxv-ai-messages");s.setAttribute("role","log"),s.setAttribute("aria-live","polite");let d=Me(t,"div","pptxv-ai-empty");d.textContent=i("pptx.ai.emptyHint"),s.appendChild(d);let r=Me(t,"div","pptxv-ai-proposals");r.hidden=true;let f=Me(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let b=Me(t,"form","pptxv-ai-composer"),u=Me(t,"textarea","pptxv-ai-input");u.rows=2,u.placeholder=i("pptx.ai.placeholder");let C=Me(t,"button","pptxv-ai-send");C.type="submit",C.setAttribute("aria-label",i("pptx.ai.send")),C.appendChild(Ve(t,"send")),b.append(u,C),n.append(p,...c?[c.el]:[],s,r,f,b);try{x=await(e.createChat??_e)({bridge:e.bridge,config:e.config});}catch{return d.textContent=i("pptx.ai.unavailableTitle"),u.disabled=true,C.disabled=true,c?.destroy(),{destroy:()=>n.replaceChildren()}}let v=x,h=new Set,T=l=>{if(!a)return;let y=l.messages.flatMap(q=>$e(q).filter(G=>G.kind==="tool")).at(-1);if(!y||y.kind!=="tool"||y.state==="input-streaming"||h.has(y.toolCallId))return;h.add(y.toolCallId);let k=df(y.toolName,y.input);k&&k.slideIndex!==void 0&&e.goToSlide?.(k.slideIndex),a.flashToolTarget(k);},A=l=>{U(t,s,l.messages,i),d.hidden=l.messages.length>0,l.messages.length===0&&s.appendChild(d),$(t,r,v.proposals.list(),i,{accept:y=>{a?.flashToolTarget(null),v.proposals.apply(y),A(v.getSnapshot());},reject:y=>{v.proposals.revert(y),A(v.getSnapshot());},acceptAll:()=>{a?.flashToolTarget(null),v.proposals.acceptAll(),A(v.getSnapshot());}});let S=l.status==="submitted"||l.status==="streaming";n.classList.toggle("is-busy",S),C.setAttribute("aria-label",i(S?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!l.error,f.textContent=l.error?i("pptx.ai.errorPrefix"):"",s.scrollTop=s.scrollHeight,T(l);},P=()=>{if(n.classList.contains("is-busy")){v.stop();return}let l=u.value.trim();l&&(u.value="",v.sendMessage(l));};b.addEventListener("submit",l=>{l.preventDefault(),P();}),u.addEventListener("keydown",l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),P());});let w=a?.getPrefill().nonce??0,z=()=>{if(!a)return;let l=a.getPrefill();l.nonce!==w&&(w=l.nonce,u.value=l.text,u.focus());},K=a?.subscribe(z),O=v.subscribe(A);return A(v.getSnapshot()),{changeAnimator:v.changeAnimator,destroy(){O(),K?.(),c?.destroy(),n.replaceChildren();}}}export{gt as createAiPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkZAC3M5KZ_cjs=require('./chunk-ZAC3M5KZ.cjs');require('./chunk-RPCQE4MF.cjs'),require('./chunk-4VDLQK6F.cjs');function j(e){let{doc:t,t:n,controller:i}=e,p=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-focus"),m=(c,s,d)=>{let r=chunkZAC3M5KZ_cjs.Me(t,"button","pptxv-ai-focus-btn");return r.type="button",r.title=s,r.setAttribute("aria-label",s),r.appendChild(chunkZAC3M5KZ_cjs.Ve(t,c)),r.addEventListener("click",d),r},x=()=>{p.replaceChildren();let c=i.getEffectiveTargets(),s=i.hasPicks(),d=i.isPinned(),r=i.isPicking(),f=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-focus-row"),b=chunkZAC3M5KZ_cjs.Me(t,"span","pptxv-ai-focus-label");b.textContent=n("pptx.ai.focusScope"),f.appendChild(b);for(let h of chunkZAC3M5KZ_cjs.He(c,e.getSlides())){let T=chunkZAC3M5KZ_cjs.Me(t,"span","pptxv-ai-focus-chip");(s||d)&&T.classList.add("is-strong"),T.title=h.title,T.textContent=h.label,f.appendChild(T);}if(d){let h=chunkZAC3M5KZ_cjs.Me(t,"span","pptxv-ai-focus-pinned");h.textContent=n("pptx.ai.pinnedFocus"),f.appendChild(h);}let u=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-focus-actions"),C=chunkZAC3M5KZ_cjs.Ie(c,e.getSlides());if(C){let h=chunkZAC3M5KZ_cjs.Me(t,"button","pptxv-ai-focus-merge");h.type="button",h.append(chunkZAC3M5KZ_cjs.Ve(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),h.addEventListener("click",()=>e.onSendDirective(chunkZAC3M5KZ_cjs.Je(C.slideIndex,C.elementIdA,C.elementIdB))),u.appendChild(h);}let v=m("crosshair",n("pptx.ai.pickElement"),()=>r?i.stopPicking():i.startPicking());if(v.setAttribute("aria-pressed",String(r)),v.classList.toggle("is-active",r),u.appendChild(v),s?u.appendChild(m("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):d?u.appendChild(m("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):u.appendChild(m("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),f.appendChild(u),p.appendChild(f),r){let h=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-focus-pick"),T=chunkZAC3M5KZ_cjs.Ve(t,"crosshair");T.classList.add("pptxv-ai-focus-pick-icon");let A=chunkZAC3M5KZ_cjs.Me(t,"span","pptxv-ai-focus-pick-hint");A.textContent=n("pptx.ai.pickElementHint");let P=chunkZAC3M5KZ_cjs.Me(t,"button","pptxv-ai-focus-pick-done");P.type="button",P.textContent=n("pptx.ai.pickDone"),P.addEventListener("click",()=>i.stopPicking()),h.append(T,A,P),p.appendChild(h);}},a=i.subscribe(x);return x(),{el:p,destroy(){a(),p.remove();}}}var J={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 R(e,t,n){let i=t.state==="output-error",p=t.state==="output-available",m=!i&&!p,x=chunkZAC3M5KZ_cjs.cf(t.toolName,t.input,m?"present":"past"),a=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-tool"),c=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-tool-head"),s=chunkZAC3M5KZ_cjs.Ve(e,J[x.icon]??"wrench");s.classList.add("pptxv-ai-tool-icon");let d=chunkZAC3M5KZ_cjs.Me(e,"span","pptxv-ai-tool-name");d.textContent=x.label;let r=chunkZAC3M5KZ_cjs.Me(e,"span","pptxv-ai-tool-state");if(i?(r.classList.add("is-error"),r.append(chunkZAC3M5KZ_cjs.Ve(e,"alert"),e.createTextNode(n("pptx.ai.toolFailed")))):p?(r.classList.add("is-done"),r.append(chunkZAC3M5KZ_cjs.Ve(e,"check"),e.createTextNode(n("pptx.ai.toolDone")))):(r.classList.add("is-running"),r.textContent=n("pptx.ai.toolRunning")),c.append(s,d,r),a.appendChild(c),i&&t.errorText){let b=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-tool-error");b.textContent=t.errorText,a.appendChild(b);}let f=chunkZAC3M5KZ_cjs.bf(t.input);if(f){let b=chunkZAC3M5KZ_cjs.Me(e,"details","pptxv-ai-tool-details"),u=chunkZAC3M5KZ_cjs.Me(e,"summary");u.textContent=n("pptx.ai.toolDetails");let C=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-tool-raw");C.textContent=`${chunkZAC3M5KZ_cjs.af(t.toolName)}: ${f}`,b.append(u,C),a.appendChild(b);}return a}function U(e,t,n,i){t.replaceChildren();for(let p of n){if(p.role==="system")continue;let m=p.role==="user",x=chunkZAC3M5KZ_cjs.$e(p);if(x.length===0&&!m)continue;let a=chunkZAC3M5KZ_cjs.Me(e,"div",`pptxv-ai-msg pptxv-ai-msg-${p.role}`),c=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-msg-avatar");c.setAttribute("aria-label",i(m?"pptx.ai.you":"pptx.ai.assistant")),c.appendChild(chunkZAC3M5KZ_cjs.Ve(e,m?"comment":"sparkles"));let s=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-msg-body");for(let d of x)if(d.kind==="text"){let r=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-msg-text");r.textContent=d.text,s.appendChild(r);}else s.appendChild(R(e,d,i));a.append(c,s),t.appendChild(a);}}function $(e,t,n,i,p){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let m=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-proposals-header"),x=chunkZAC3M5KZ_cjs.Me(e,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),m.appendChild(x),n.length>1){let a=chunkZAC3M5KZ_cjs.Me(e,"button","pptxv-ai-proposal-btn is-accept-all");a.type="button",a.textContent=i("pptx.ai.acceptAll"),a.addEventListener("click",()=>p.acceptAll()),m.appendChild(a);}t.appendChild(m);for(let a of n)t.appendChild(Q(e,a,i,p));}function Q(e,t,n,i){let p=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-proposal");p.dataset.proposalId=t.id;let m=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-proposal-eyebrow");m.textContent=n("pptx.ai.proposedChange"),p.appendChild(m);let x=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,p.appendChild(x),t.summary.length>0){let d=chunkZAC3M5KZ_cjs.Me(e,"ul","pptxv-ai-proposal-summary");for(let r of t.summary){let f=chunkZAC3M5KZ_cjs.Me(e,"li");f.textContent=chunkZAC3M5KZ_cjs.Xe(r),d.appendChild(f);}p.appendChild(d);}let a=chunkZAC3M5KZ_cjs.Me(e,"div","pptxv-ai-proposal-actions"),c=chunkZAC3M5KZ_cjs.Me(e,"button","pptxv-ai-proposal-btn is-accept");c.type="button",c.append(chunkZAC3M5KZ_cjs.Ve(e,"check"),e.createTextNode(n("pptx.ai.accept"))),c.addEventListener("click",()=>i.accept(t.id));let s=chunkZAC3M5KZ_cjs.Me(e,"button","pptxv-ai-proposal-btn is-reject");return s.type="button",s.append(chunkZAC3M5KZ_cjs.Ve(e,"close"),e.createTextNode(n("pptx.ai.reject"))),s.addEventListener("click",()=>i.reject(t.id)),a.append(c,s),p.appendChild(a),p}async function gt(e){let{doc:t,host:n,t:i}=e;n.replaceChildren();let p=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-header"),m=chunkZAC3M5KZ_cjs.Me(t,"span","pptxv-ai-title");m.textContent=i("pptx.ai.title"),p.append(chunkZAC3M5KZ_cjs.Ve(t,"sparkles"),m);let x,a=e.controller,c=a?j({doc:t,t:i,controller:a,getSlides:()=>e.bridge.getSlides(),onSendDirective:l=>{x?.sendMessage(l);}}):null,s=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-messages");s.setAttribute("role","log"),s.setAttribute("aria-live","polite");let d=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-empty");d.textContent=i("pptx.ai.emptyHint"),s.appendChild(d);let r=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-proposals");r.hidden=true;let f=chunkZAC3M5KZ_cjs.Me(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let b=chunkZAC3M5KZ_cjs.Me(t,"form","pptxv-ai-composer"),u=chunkZAC3M5KZ_cjs.Me(t,"textarea","pptxv-ai-input");u.rows=2,u.placeholder=i("pptx.ai.placeholder");let C=chunkZAC3M5KZ_cjs.Me(t,"button","pptxv-ai-send");C.type="submit",C.setAttribute("aria-label",i("pptx.ai.send")),C.appendChild(chunkZAC3M5KZ_cjs.Ve(t,"send")),b.append(u,C),n.append(p,...c?[c.el]:[],s,r,f,b);try{x=await(e.createChat??chunkZAC3M5KZ_cjs._e)({bridge:e.bridge,config:e.config});}catch{return d.textContent=i("pptx.ai.unavailableTitle"),u.disabled=true,C.disabled=true,c?.destroy(),{destroy:()=>n.replaceChildren()}}let v=x,h=new Set,T=l=>{if(!a)return;let y=l.messages.flatMap(q=>chunkZAC3M5KZ_cjs.$e(q).filter(G=>G.kind==="tool")).at(-1);if(!y||y.kind!=="tool"||y.state==="input-streaming"||h.has(y.toolCallId))return;h.add(y.toolCallId);let k=chunkZAC3M5KZ_cjs.df(y.toolName,y.input);k&&k.slideIndex!==void 0&&e.goToSlide?.(k.slideIndex),a.flashToolTarget(k);},A=l=>{U(t,s,l.messages,i),d.hidden=l.messages.length>0,l.messages.length===0&&s.appendChild(d),$(t,r,v.proposals.list(),i,{accept:y=>{a?.flashToolTarget(null),v.proposals.apply(y),A(v.getSnapshot());},reject:y=>{v.proposals.revert(y),A(v.getSnapshot());},acceptAll:()=>{a?.flashToolTarget(null),v.proposals.acceptAll(),A(v.getSnapshot());}});let S=l.status==="submitted"||l.status==="streaming";n.classList.toggle("is-busy",S),C.setAttribute("aria-label",i(S?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!l.error,f.textContent=l.error?i("pptx.ai.errorPrefix"):"",s.scrollTop=s.scrollHeight,T(l);},P=()=>{if(n.classList.contains("is-busy")){v.stop();return}let l=u.value.trim();l&&(u.value="",v.sendMessage(l));};b.addEventListener("submit",l=>{l.preventDefault(),P();}),u.addEventListener("keydown",l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),P());});let w=a?.getPrefill().nonce??0,z=()=>{if(!a)return;let l=a.getPrefill();l.nonce!==w&&(w=l.nonce,u.value=l.text,u.focus());},K=a?.subscribe(z),O=v.subscribe(A);return A(v.getSnapshot()),{changeAnimator:v.changeAnimator,destroy(){O(),K?.(),c?.destroy(),n.replaceChildren();}}}exports.createAiPanel=gt;
|