pptx-vanilla-viewer 2.19.0 → 2.19.1
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 +68 -0
- package/dist/{ai-panel-L5ABJ666.js → ai-panel-6BCBAGFQ.js} +1 -1
- package/dist/{ai-panel-Z4NVDEBL.cjs → ai-panel-GWUIOGMG.cjs} +1 -1
- package/dist/{chunk-JUKBJGYQ.cjs → chunk-55O5TWHI.cjs} +3 -3
- package/dist/{chunk-O2ZDCV67.cjs → chunk-6VNMKCMN.cjs} +54 -54
- package/dist/{chunk-57VHQAFK.js → chunk-ALKPZF5C.js} +1 -1
- package/dist/{chunk-TZV7ZBUY.js → chunk-ASUQLFOD.js} +1 -1
- package/dist/{chunk-XGPJF4IL.cjs → chunk-QE6XKQXU.cjs} +8 -8
- package/dist/{chunk-IBLM4JHG.js → chunk-QTACNZJO.js} +54 -54
- package/dist/index.cjs +11 -11
- package/dist/index.js +2 -2
- package/dist/internals.cjs +1 -1
- package/dist/internals.js +1 -1
- package/dist/transition-overlay-CFF7agjg.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,74 @@ A release listed with no entries carried no Conventional Commit in this package'
|
|
|
7
7
|
scope: scripts/release-plan.mjs re-releases a package whenever any of its files
|
|
8
8
|
change, not only on conventional ones.
|
|
9
9
|
|
|
10
|
+
## [2.19.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.19.0) - 2026-09-16
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **shared:** Preserve native list editing and pending snapshots (by @Sudhansh6) ([ef82b95](https://github.com/ChristopherVR/pptx-viewer/commit/ef82b95b52d12a40c1cd20a4df3b431e3c5db50c))
|
|
15
|
+
- **vanilla:** Retain live list editing across stage updates (by @Sudhansh6) ([8dc4d98](https://github.com/ChristopherVR/pptx-viewer/commit/8dc4d985cb2556b758af6d76b9caec1083994391))
|
|
16
|
+
- **i18n:** Export locale subpaths from viewer packages (by @yunfeizhu) ([65003c5](https://github.com/ChristopherVR/pptx-viewer/commit/65003c5af3ecf2e8e4e1daad1a3bcd3f5ee35481))
|
|
17
|
+
- **shared:** Construct image elements from local image files (by @Sudhansh6) ([562fb4a](https://github.com/ChristopherVR/pptx-viewer/commit/562fb4acf0fd2f7c3031542da05454bcfcd87ab3))
|
|
18
|
+
- **bindings:** Expose the shared image file construction helper (by @Sudhansh6) ([14f3f08](https://github.com/ChristopherVR/pptx-viewer/commit/14f3f084e39bd6b5c822a3af8d7f572e55533bef))
|
|
19
|
+
- **shared:** Handle native images on the focused canvas (by @Sudhansh6) ([20c9d66](https://github.com/ChristopherVR/pptx-viewer/commit/20c9d669bca8d97f32841a5e3a31a5c3f0512ffb))
|
|
20
|
+
- **vanilla:** Paste native images on the editable canvas (by @Sudhansh6) ([98e90cb](https://github.com/ChristopherVR/pptx-viewer/commit/98e90cb3ead86a5733bec8c1e9609241a1e2cabc))
|
|
21
|
+
- **shared:** Add optional selection artwork tokens (by @Sudhansh6) ([9fe6015](https://github.com/ChristopherVR/pptx-viewer/commit/9fe60154bc8e5eb314f187a42cbd4af510c714ca))
|
|
22
|
+
- **vanilla:** Support selection control artwork themes (by @Sudhansh6) ([f6f0e52](https://github.com/ChristopherVR/pptx-viewer/commit/f6f0e52a2d30281e37086215c41618aba7fe3c9c))
|
|
23
|
+
- Expose slide-transition helpers from every binding's internals entry (by @ChristopherVR) ([d232ffb](https://github.com/ChristopherVR/pptx-viewer/commit/d232ffba626b4088c2ee7f3acbb5cfa00452490d))
|
|
24
|
+
- Add atomic cross-slide element batches (by @yunfeizhu) ([1157b68](https://github.com/ChristopherVR/pptx-viewer/commit/1157b68784672c6273d40c7fcee6c0c11b3216a3))
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
- **shared:** Preserve theme colors in native list replacement (by @Sudhansh6) ([1b302b3](https://github.com/ChristopherVR/pptx-viewer/commit/1b302b3db65e8f87794b022e07808cd2b9383875))
|
|
29
|
+
- Preserve live list editing through upstream merge (by @Sudhansh6) ([3f8b4f4](https://github.com/ChristopherVR/pptx-viewer/commit/3f8b4f4dce22d2f822e1c706474f946b7c20c3c7))
|
|
30
|
+
- **shared:** Preserve caret scope and native list breaks (by @Sudhansh6) ([f19179b](https://github.com/ChristopherVR/pptx-viewer/commit/f19179b93b85c3486b6f7458c9debe79d3fe7d6c))
|
|
31
|
+
- **vanilla:** Scope live list commands to the caret (by @Sudhansh6) ([2a7343e](https://github.com/ChristopherVR/pptx-viewer/commit/2a7343ec8fda39fb817bbed493c42c67556778e6))
|
|
32
|
+
- **vanilla:** Open bootstrap source after loading (by @ChristopherVR) ([4c94ab3](https://github.com/ChristopherVR/pptx-viewer/commit/4c94ab31e78a0f3eeaed08b8f4db25bbefc5480c))
|
|
33
|
+
- **shared:** Retain loaded webfonts during slide edits (by @ChristopherVR) ([4f81eb0](https://github.com/ChristopherVR/pptx-viewer/commit/4f81eb062431a273cf714cafc751cc4b8446f30c))
|
|
34
|
+
- **tests:** Numerous test issues (by @ChristopherVR) ([c5b8260](https://github.com/ChristopherVR/pptx-viewer/commit/c5b826079078371191b48e04db0e7e4e6877435c))
|
|
35
|
+
- **shared:** Anchor rotation gestures to their initial press (by @Sudhansh6) ([798c83c](https://github.com/ChristopherVR/pptx-viewer/commit/798c83c91cb7cf0ebafd1f2c206ec02f701c5ecc))
|
|
36
|
+
- **vanilla:** Reuse text eligibility for font pickers (by @Sudhansh6) ([19fec71](https://github.com/ChristopherVR/pptx-viewer/commit/19fec7121dc7da5aa255bfb54b88616761d3d60d))
|
|
37
|
+
- **shared:** Preserve SVG namespaces in raster exports (by @Sudhansh6) ([1e3fdaf](https://github.com/ChristopherVR/pptx-viewer/commit/1e3fdaf5b08a4bdae98662067f9460958aaf8b0f))
|
|
38
|
+
- **shared:** Bound resize hit areas between neighboring anchors (by @Sudhansh6) ([61d735d](https://github.com/ChristopherVR/pptx-viewer/commit/61d735d66644cd5ed3b6e87e7c6ff4c8dfeb9c99))
|
|
39
|
+
- **vanilla:** Keep neighboring resize handles reachable (by @Sudhansh6) ([5b16164](https://github.com/ChristopherVR/pptx-viewer/commit/5b161649339f32ba0e88042134fd03a80e5cc327))
|
|
40
|
+
- **shared:** Keep rotate controls inside visible canvas (by @Sudhansh6) ([df584e9](https://github.com/ChristopherVR/pptx-viewer/commit/df584e90335c8b8da92cf8dd25c6e5a9695f7b1b))
|
|
41
|
+
- **vanilla:** Preserve reachable rotation controls during gestures (by @Sudhansh6) ([49fcaa4](https://github.com/ChristopherVR/pptx-viewer/commit/49fcaa416dce689c36c6915ae3cb30f01d5a0187))
|
|
42
|
+
- **shared:** Apply picture alphaModFix once, not filter times opacity (by @ChristopherVR) ([3fd154b](https://github.com/ChristopherVR/pptx-viewer/commit/3fd154bda6958725bda279f81c001a99f55bd485))
|
|
43
|
+
- **shared:** Stop padding the painted element box to MIN_ELEMENT_SIZE (by @ChristopherVR) ([4caef83](https://github.com/ChristopherVR/pptx-viewer/commit/4caef831004ff52da1fa816970226567e7e2bef9))
|
|
44
|
+
- **core:** Honour a:alpha on solid slide backgrounds and keep it on save (by @ChristopherVR) ([3b50c7a](https://github.com/ChristopherVR/pptx-viewer/commit/3b50c7a28f8a64fcbc14eea4c2f47564b9515942))
|
|
45
|
+
- Guard element batches during active pointer gestures (by @yunfeizhu) ([da3bf49](https://github.com/ChristopherVR/pptx-viewer/commit/da3bf490851c95ed3e165cb0139ee5fa5c9f4408))
|
|
46
|
+
- **core:** Blend a:alpha on pattern background colours onto white (by @ChristopherVR) ([893a261](https://github.com/ChristopherVR/pptx-viewer/commit/893a261811f96f5078a9e505630414b005ab3735))
|
|
47
|
+
- Render the degenerate-shape hit target for every element type (by @ChristopherVR) ([49a15a4](https://github.com/ChristopherVR/pptx-viewer/commit/49a15a40cf612ae8cbb51b9e4ceeb20e644b4936))
|
|
48
|
+
- **shared:** Model relaxedInset/slope/hardEdge as non-monotonic bevel profiles (by @ChristopherVR) ([e3ef9fb](https://github.com/ChristopherVR/pptx-viewer/commit/e3ef9fb33bd991d93153daee3876aebf575128a8))
|
|
49
|
+
|
|
50
|
+
### Refactor
|
|
51
|
+
|
|
52
|
+
- **core:** Expose paragraph geometry keys for editing (by @Sudhansh6) ([da5b8f5](https://github.com/ChristopherVR/pptx-viewer/commit/da5b8f595c2c68d0cf354f92c2ec4d14a89618ea))
|
|
53
|
+
|
|
54
|
+
### Documentation
|
|
55
|
+
|
|
56
|
+
- **shared:** Document the foreignObject SVG string's safe-sink boundary (by @ChristopherVR) ([c3446d8](https://github.com/ChristopherVR/pptx-viewer/commit/c3446d8316632644db8827ba3c7cd7e39c487014))
|
|
57
|
+
|
|
58
|
+
### Testing
|
|
59
|
+
|
|
60
|
+
- **vanilla:** Narrow captured elements before text assertions (by @Sudhansh6) ([58c5e2d](https://github.com/ChristopherVR/pptx-viewer/commit/58c5e2d10aaeb9c6bfafe46d440aea7b1b7a84c5))
|
|
61
|
+
- **core:** Register the nested list roundtrip fixture (by @Sudhansh6) ([857e0b2](https://github.com/ChristopherVR/pptx-viewer/commit/857e0b2dc589a237266a5c31944b34d0173b2d82))
|
|
62
|
+
- Cover off-center rotation across viewer bindings (by @Sudhansh6) ([c243cde](https://github.com/ChristopherVR/pptx-viewer/commit/c243cde22295803ec2f9faecd9ca58471a3b119f))
|
|
63
|
+
- **vanilla:** Use complete image-paste fixture types (by @Sudhansh6) ([7d3f132](https://github.com/ChristopherVR/pptx-viewer/commit/7d3f132b7f77c39bf54a4acbbd23170ee0b7ed66))
|
|
64
|
+
- Cover batch update history across viewer bindings (by @yunfeizhu) ([fff49e8](https://github.com/ChristopherVR/pptx-viewer/commit/fff49e83203008bd4c01ac531791ad550006a4ab))
|
|
65
|
+
- Cover gesture isolation and demo handle lifecycle (by @yunfeizhu) ([62331e2](https://github.com/ChristopherVR/pptx-viewer/commit/62331e27dd5d542db57d7ec3642757f27010df0b))
|
|
66
|
+
|
|
67
|
+
### Chores
|
|
68
|
+
|
|
69
|
+
- Merge main into live list editing (by @Sudhansh6) ([a9b760d](https://github.com/ChristopherVR/pptx-viewer/commit/a9b760d9c051b39066731665824af3230b8797db))
|
|
70
|
+
- Sync upstream validation and ribbon updates (by @Sudhansh6) ([c70516c](https://github.com/ChristopherVR/pptx-viewer/commit/c70516c0389efd29e2dde70aeb041053fe9bd17b))
|
|
71
|
+
- Merge main and resolve locale documentation conflicts (by @yunfeizhu) ([ac9123d](https://github.com/ChristopherVR/pptx-viewer/commit/ac9123d4fa531cd591898a721bd690cca25b2cf6))
|
|
72
|
+
- **shared:** Merge main into resize hit ownership (by @Sudhansh6) ([f6d6336](https://github.com/ChristopherVR/pptx-viewer/commit/f6d63362dce076f497a9c350fd93501515634ab5))
|
|
73
|
+
- Merge main into native canvas image paste (by @Sudhansh6) ([0ebf261](https://github.com/ChristopherVR/pptx-viewer/commit/0ebf261014cc30d3422b4c87ac6def51352951e8))
|
|
74
|
+
- Integrate rotation and selection-control prerequisites (by @Sudhansh6) ([e6f9cde](https://github.com/ChristopherVR/pptx-viewer/commit/e6f9cde524570b7aab4f8e95cff3756e27e45811))
|
|
75
|
+
- **shared:** Align boundary controls with current main (by @Sudhansh6) ([7fbfc4c](https://github.com/ChristopherVR/pptx-viewer/commit/7fbfc4c3ae6df408035d3f21e7a6321f8323c74f))
|
|
76
|
+
- **shared:** Align selection artwork with boundary controls (by @Sudhansh6) ([3b971d3](https://github.com/ChristopherVR/pptx-viewer/commit/3b971d3bb0a647d3d9158a8e23d2ec6e91e58791))
|
|
77
|
+
|
|
10
78
|
## [2.18.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.18.0) - 2026-09-14
|
|
11
79
|
|
|
12
80
|
### Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {w,K as K$1,o,m,n,f,t,j,k,l,s,r,q as q$1,c}from'./chunk-TZV7ZBUY.js';import'./chunk-IBLM4JHG.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(K$1(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l$1=i.isPinned(),s=i.isPicking(),g=w(t,"div","pptxv-ai-focus-row"),f=w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of j(p,o.getSlides())){let b=w(t,"span","pptxv-ai-focus-chip");(m||l$1)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l$1){let r=w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=w(t,"div","pptxv-ai-focus-actions"),d=k(p,o.getSlides());if(d){let r=w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(K$1(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(l(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$1?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=w(t,"div","pptxv-ai-focus-pick"),b=K$1(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=w(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$1}=o,i=w(t,"button","pptxv-ai-chats");i.type="button",i.append(K$1(t,"history"),t.createTextNode(n$1("pptx.ai.chats")));let a=w(t,"div","pptxv-ai-history");a.hidden=true;let h=w(t,"div","pptxv-ai-history-head"),x=w(t,"span","pptxv-ai-history-title");x.textContent=n$1("pptx.ai.historyTitle");let c=w(t,"button","pptxv-ai-history-new");c.type="button",c.append(K$1(t,"plus"),t.createTextNode(n$1("pptx.ai.newChat"))),h.append(x,c);let p=w(t,"div","pptxv-ai-history-body"),m=w(t,"p","pptxv-ai-history-hint");m.textContent=n$1("pptx.ai.historyHint"),a.append(h,p,m);let l=n({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n$1("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=w(t,"p","pptxv-ai-history-empty");d.textContent=n$1("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=w(t,"li","pptxv-ai-history-row"),r=w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=w(t,"span","pptxv-ai-history-text"),k=w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n$1("pptx.ai.untitledChat");let T=w(t,"span","pptxv-ai-history-meta");T.textContent=n$1("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(K$1(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=w(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n$1("pptx.ai.deleteChat"),P.setAttribute("aria-label",n$1("pptx.ai.deleteChat")),P.appendChild(K$1(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=s(t.toolName,t.input,h?"present":"past"),c=w(o,"div","pptxv-ai-tool"),p=w(o,"div","pptxv-ai-tool-head"),m=K$1(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s$1=w(o,"span","pptxv-ai-tool-state");if(i?(s$1.classList.add("is-error"),s$1.append(K$1(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s$1.classList.add("is-done"),s$1.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s$1.classList.add("is-running"),s$1.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s$1),c.appendChild(p),i&&t.errorText){let f=w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=r(t.input);if(g){let f=w(o,"details","pptxv-ai-tool-details"),C=w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=w(o,"div","pptxv-ai-tool-raw");d.textContent=`${q$1(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=f(a);if(x.length===0&&!h)continue;let c=w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(K$1(o,h?"comment":"sparkles"));let m=w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=w(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=w(o,"div","pptxv-ai-proposals-header"),x=w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=w(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=w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=w(o,"li");g.textContent=c(s),l.appendChild(g);}a.appendChild(l);}let c$1=w(o,"div","pptxv-ai-proposal-actions"),p=w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(K$1(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c$1.append(p,m),a.appendChild(c$1),a}async function wt(o$1){let{doc:t$1,host:n,t:i}=o$1;n.replaceChildren();let a=w(t$1,"div","pptxv-ai-header"),h=w(t$1,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=w(t$1,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(K$1(t$1,"close")),x.addEventListener("click",()=>o$1.onClose?.()),a.append(K$1(t$1,"sparkles"),h,x);let c,p=o$1.controller,m$1=p?K({doc:t$1,t:i,controller:p,getSlides:()=>o$1.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=w(t$1,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=w(t$1,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=w(t$1,"div","pptxv-ai-proposals");g.hidden=true;let f$1=w(t$1,"div","pptxv-ai-error");f$1.setAttribute("role","alert"),f$1.hidden=true;let C=w(t$1,"form","pptxv-ai-composer"),d=w(t$1,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=w(t$1,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(K$1(t$1,"send")),C.append(d,y),n.append(a,...m$1?[m$1.el]:[],l,g,f$1,C);try{c=await(o$1.createChat??o)({bridge:o$1.bridge,config:o$1.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m$1?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t$1,t:i,deckId:m(o$1.bridge),store:o$1.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=>f(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=t(A.toolName,A.input);L&&L.slideIndex!==void 0&&o$1.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t$1,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t$1,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$1.hidden=!u.error,f$1.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$1?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};
|
|
1
|
+
import {w,K as K$1,o,m,n,f,t,j,k,l,s,r,q as q$1,c}from'./chunk-ASUQLFOD.js';import'./chunk-QTACNZJO.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(K$1(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l$1=i.isPinned(),s=i.isPicking(),g=w(t,"div","pptxv-ai-focus-row"),f=w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of j(p,o.getSlides())){let b=w(t,"span","pptxv-ai-focus-chip");(m||l$1)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l$1){let r=w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=w(t,"div","pptxv-ai-focus-actions"),d=k(p,o.getSlides());if(d){let r=w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(K$1(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(l(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$1?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=w(t,"div","pptxv-ai-focus-pick"),b=K$1(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=w(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$1}=o,i=w(t,"button","pptxv-ai-chats");i.type="button",i.append(K$1(t,"history"),t.createTextNode(n$1("pptx.ai.chats")));let a=w(t,"div","pptxv-ai-history");a.hidden=true;let h=w(t,"div","pptxv-ai-history-head"),x=w(t,"span","pptxv-ai-history-title");x.textContent=n$1("pptx.ai.historyTitle");let c=w(t,"button","pptxv-ai-history-new");c.type="button",c.append(K$1(t,"plus"),t.createTextNode(n$1("pptx.ai.newChat"))),h.append(x,c);let p=w(t,"div","pptxv-ai-history-body"),m=w(t,"p","pptxv-ai-history-hint");m.textContent=n$1("pptx.ai.historyHint"),a.append(h,p,m);let l=n({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n$1("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=w(t,"p","pptxv-ai-history-empty");d.textContent=n$1("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=w(t,"li","pptxv-ai-history-row"),r=w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=w(t,"span","pptxv-ai-history-text"),k=w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n$1("pptx.ai.untitledChat");let T=w(t,"span","pptxv-ai-history-meta");T.textContent=n$1("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(K$1(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=w(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n$1("pptx.ai.deleteChat"),P.setAttribute("aria-label",n$1("pptx.ai.deleteChat")),P.appendChild(K$1(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=s(t.toolName,t.input,h?"present":"past"),c=w(o,"div","pptxv-ai-tool"),p=w(o,"div","pptxv-ai-tool-head"),m=K$1(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s$1=w(o,"span","pptxv-ai-tool-state");if(i?(s$1.classList.add("is-error"),s$1.append(K$1(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s$1.classList.add("is-done"),s$1.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s$1.classList.add("is-running"),s$1.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s$1),c.appendChild(p),i&&t.errorText){let f=w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=r(t.input);if(g){let f=w(o,"details","pptxv-ai-tool-details"),C=w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=w(o,"div","pptxv-ai-tool-raw");d.textContent=`${q$1(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=f(a);if(x.length===0&&!h)continue;let c=w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(K$1(o,h?"comment":"sparkles"));let m=w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=w(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=w(o,"div","pptxv-ai-proposals-header"),x=w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=w(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=w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=w(o,"li");g.textContent=c(s),l.appendChild(g);}a.appendChild(l);}let c$1=w(o,"div","pptxv-ai-proposal-actions"),p=w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(K$1(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c$1.append(p,m),a.appendChild(c$1),a}async function wt(o$1){let{doc:t$1,host:n,t:i}=o$1;n.replaceChildren();let a=w(t$1,"div","pptxv-ai-header"),h=w(t$1,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=w(t$1,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(K$1(t$1,"close")),x.addEventListener("click",()=>o$1.onClose?.()),a.append(K$1(t$1,"sparkles"),h,x);let c,p=o$1.controller,m$1=p?K({doc:t$1,t:i,controller:p,getSlides:()=>o$1.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=w(t$1,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=w(t$1,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=w(t$1,"div","pptxv-ai-proposals");g.hidden=true;let f$1=w(t$1,"div","pptxv-ai-error");f$1.setAttribute("role","alert"),f$1.hidden=true;let C=w(t$1,"form","pptxv-ai-composer"),d=w(t$1,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=w(t$1,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(K$1(t$1,"send")),C.append(d,y),n.append(a,...m$1?[m$1.el]:[],l,g,f$1,C);try{c=await(o$1.createChat??o)({bridge:o$1.bridge,config:o$1.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m$1?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t$1,t:i,deckId:m(o$1.bridge),store:o$1.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=>f(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=t(A.toolName,A.input);L&&L.slideIndex!==void 0&&o$1.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t$1,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t$1,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$1.hidden=!u.error,f$1.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$1?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkXGPJF4IL_cjs=require('./chunk-XGPJF4IL.cjs');require('./chunk-O2ZDCV67.cjs'),require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkXGPJF4IL_cjs.w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkXGPJF4IL_cjs.K(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-focus-row"),f=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkXGPJF4IL_cjs.j(p,o.getSlides())){let b=chunkXGPJF4IL_cjs.w(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=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-focus-actions"),d=chunkXGPJF4IL_cjs.k(p,o.getSlides());if(d){let r=chunkXGPJF4IL_cjs.w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkXGPJF4IL_cjs.K(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkXGPJF4IL_cjs.l(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=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-focus-pick"),b=chunkXGPJF4IL_cjs.K(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkXGPJF4IL_cjs.w(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=chunkXGPJF4IL_cjs.w(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkXGPJF4IL_cjs.K(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-history-head"),x=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkXGPJF4IL_cjs.w(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkXGPJF4IL_cjs.K(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-history-body"),m=chunkXGPJF4IL_cjs.w(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkXGPJF4IL_cjs.n({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=chunkXGPJF4IL_cjs.w(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkXGPJF4IL_cjs.w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkXGPJF4IL_cjs.w(t,"li","pptxv-ai-history-row"),r=chunkXGPJF4IL_cjs.w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-history-text"),k=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkXGPJF4IL_cjs.K(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkXGPJF4IL_cjs.w(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(chunkXGPJF4IL_cjs.K(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=chunkXGPJF4IL_cjs.s(t.toolName,t.input,h?"present":"past"),c=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-tool"),p=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-tool-head"),m=chunkXGPJF4IL_cjs.K(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkXGPJF4IL_cjs.w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkXGPJF4IL_cjs.w(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkXGPJF4IL_cjs.K(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkXGPJF4IL_cjs.K(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=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkXGPJF4IL_cjs.r(t.input);if(g){let f=chunkXGPJF4IL_cjs.w(o,"details","pptxv-ai-tool-details"),C=chunkXGPJF4IL_cjs.w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkXGPJF4IL_cjs.q(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=chunkXGPJF4IL_cjs.f(a);if(x.length===0&&!h)continue;let c=chunkXGPJF4IL_cjs.w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkXGPJF4IL_cjs.K(o,h?"comment":"sparkles"));let m=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkXGPJF4IL_cjs.w(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=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-proposals-header"),x=chunkXGPJF4IL_cjs.w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkXGPJF4IL_cjs.w(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=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkXGPJF4IL_cjs.w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkXGPJF4IL_cjs.w(o,"li");g.textContent=chunkXGPJF4IL_cjs.c(s),l.appendChild(g);}a.appendChild(l);}let c=chunkXGPJF4IL_cjs.w(o,"div","pptxv-ai-proposal-actions"),p=chunkXGPJF4IL_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkXGPJF4IL_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkXGPJF4IL_cjs.w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkXGPJF4IL_cjs.K(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=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-header"),h=chunkXGPJF4IL_cjs.w(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkXGPJF4IL_cjs.w(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkXGPJF4IL_cjs.K(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkXGPJF4IL_cjs.K(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=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkXGPJF4IL_cjs.w(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkXGPJF4IL_cjs.w(t,"form","pptxv-ai-composer"),d=chunkXGPJF4IL_cjs.w(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkXGPJF4IL_cjs.w(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkXGPJF4IL_cjs.K(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkXGPJF4IL_cjs.o)({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:chunkXGPJF4IL_cjs.m(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=>chunkXGPJF4IL_cjs.f(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=chunkXGPJF4IL_cjs.t(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 chunkQE6XKQXU_cjs=require('./chunk-QE6XKQXU.cjs');require('./chunk-6VNMKCMN.cjs'),require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkQE6XKQXU_cjs.w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkQE6XKQXU_cjs.K(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-focus-row"),f=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkQE6XKQXU_cjs.j(p,o.getSlides())){let b=chunkQE6XKQXU_cjs.w(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=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-focus-actions"),d=chunkQE6XKQXU_cjs.k(p,o.getSlides());if(d){let r=chunkQE6XKQXU_cjs.w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkQE6XKQXU_cjs.K(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkQE6XKQXU_cjs.l(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=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-focus-pick"),b=chunkQE6XKQXU_cjs.K(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkQE6XKQXU_cjs.w(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=chunkQE6XKQXU_cjs.w(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkQE6XKQXU_cjs.K(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-history-head"),x=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkQE6XKQXU_cjs.w(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkQE6XKQXU_cjs.K(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-history-body"),m=chunkQE6XKQXU_cjs.w(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkQE6XKQXU_cjs.n({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=chunkQE6XKQXU_cjs.w(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkQE6XKQXU_cjs.w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkQE6XKQXU_cjs.w(t,"li","pptxv-ai-history-row"),r=chunkQE6XKQXU_cjs.w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-history-text"),k=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkQE6XKQXU_cjs.K(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkQE6XKQXU_cjs.w(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(chunkQE6XKQXU_cjs.K(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=chunkQE6XKQXU_cjs.s(t.toolName,t.input,h?"present":"past"),c=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-tool"),p=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-tool-head"),m=chunkQE6XKQXU_cjs.K(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkQE6XKQXU_cjs.w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkQE6XKQXU_cjs.w(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkQE6XKQXU_cjs.K(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkQE6XKQXU_cjs.K(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=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkQE6XKQXU_cjs.r(t.input);if(g){let f=chunkQE6XKQXU_cjs.w(o,"details","pptxv-ai-tool-details"),C=chunkQE6XKQXU_cjs.w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkQE6XKQXU_cjs.q(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=chunkQE6XKQXU_cjs.f(a);if(x.length===0&&!h)continue;let c=chunkQE6XKQXU_cjs.w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkQE6XKQXU_cjs.K(o,h?"comment":"sparkles"));let m=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkQE6XKQXU_cjs.w(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=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-proposals-header"),x=chunkQE6XKQXU_cjs.w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkQE6XKQXU_cjs.w(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=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkQE6XKQXU_cjs.w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkQE6XKQXU_cjs.w(o,"li");g.textContent=chunkQE6XKQXU_cjs.c(s),l.appendChild(g);}a.appendChild(l);}let c=chunkQE6XKQXU_cjs.w(o,"div","pptxv-ai-proposal-actions"),p=chunkQE6XKQXU_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkQE6XKQXU_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkQE6XKQXU_cjs.w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkQE6XKQXU_cjs.K(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=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-header"),h=chunkQE6XKQXU_cjs.w(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkQE6XKQXU_cjs.w(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkQE6XKQXU_cjs.K(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkQE6XKQXU_cjs.K(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=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkQE6XKQXU_cjs.w(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkQE6XKQXU_cjs.w(t,"form","pptxv-ai-composer"),d=chunkQE6XKQXU_cjs.w(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkQE6XKQXU_cjs.w(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkQE6XKQXU_cjs.K(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkQE6XKQXU_cjs.o)({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:chunkQE6XKQXU_cjs.m(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=>chunkQE6XKQXU_cjs.f(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=chunkQE6XKQXU_cjs.t(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,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
${
|
|
3
|
-
${
|
|
1
|
+
'use strict';var chunk6VNMKCMN_cjs=require('./chunk-6VNMKCMN.cjs');var R="data-pptx-text-style-override";function z(n,o,r){chunk6VNMKCMN_cjs.Ar(n.ownerDocument,o,r?.textStyle);let a=chunk6VNMKCMN_cjs.ad(o,r?.textStyle),e=n.querySelector(`:scope > style[${R}]`);if(!a){e?.remove();return}e||(e=n.ownerDocument.createElement("style"),e.setAttribute(R,""),n.prepend(e)),e.textContent=a;}var w="pptx-vanilla-presentation-keyframes",k="pptx-vanilla-slide-keyframes";function K(n){if(n.getElementById(w))return;let o=n.createElement("style");o.id=w,o.textContent=`${chunk6VNMKCMN_cjs.tc}
|
|
2
|
+
${chunk6VNMKCMN_cjs.Eh}
|
|
3
|
+
${chunk6VNMKCMN_cjs.Zl}`,(n.head??n.documentElement).appendChild(o);}function X(n,o){let r=n.getElementById(k);if(!o){r?.remove();return}r||(r=n.createElement("style"),r.id=k,(n.head??n.documentElement).appendChild(r)),r.textContent=o;}function Z(n,o,r,a){n.querySelectorAll("[data-element-id]").forEach(e=>{let t=e.dataset.elementId;if(!t)return;let i=o.get(t);e.style.animation=i?.cssAnimation??"",e.style.visibility=i?.visible===false?"hidden":"",e.style.cursor=r.has(t)||a.has(t)?"pointer":"",z(e,t,i);}),n.querySelectorAll("[data-anim-id]").forEach(e=>{let t=e.dataset.animId;if(!t)return;let i=o.get(t);e.style.animation=i?.cssAnimation??"",e.style.visibility=i?.visible===false?"hidden":"";});}function M(n,o,r,a,e){let t=n.createElement("div");t.className="pptxv-transition-layer",t.dataset.pptxTransitionLayer=e,t.dataset.pptxTransitionFragments=r.keyframesName,t.style.position="absolute",t.style.inset="0",t.style.overflow="hidden",t.style.pointerEvents="none",t.style.zIndex=String(a);for(let i of r.fragments)t.appendChild(B(n,o,r,i));return t}function B(n,o,r,a){let e=n.createElement("div");e.dataset.pptxTransitionFragment=a.id,e.style.position="absolute",e.style.inset="0",e.style.clipPath=a.clipPath,e.style.transformOrigin=a.transformOrigin,e.style.animationName=r.keyframesName,e.style.animationDuration=`${r.durationMs}ms`,e.style.animationTimingFunction=r.easing,e.style.animationDelay=`${a.delayMs}ms`,e.style.animationFillMode="forwards",e.style.willChange="transform, opacity";for(let[t,i]of Object.entries(a.vars))e.style.setProperty(t,i);return e.appendChild(o.cloneNode(true)),e}function u(n,o,r,a,e){let t=n.createElement("div");return t.className="pptxv-transition-layer",t.dataset.pptxTransitionLayer=e,t.style.position="absolute",t.style.inset="0",t.style.overflow="hidden",t.style.zIndex=String(r),t.style.willChange="transform, opacity, clip-path, filter",a!=="none"&&(t.style.animation=a),t.appendChild(o),t}function T(n,o){n.style.background="none",n.style.backgroundColor="transparent";let r=new Set(o),a=new Set;for(let e of n.querySelectorAll("[data-element-id]")){let t=e.dataset.elementId;if(!(t===void 0||!r.has(t))){for(let i=e;i&&i!==n;)a.add(i),i=i.parentElement;for(let i of e.querySelectorAll("[data-element-id]"))a.add(i);}}for(let e of [...n.querySelectorAll("[data-element-id]")])a.has(e)||e.remove();return n}function q(n,o,r,a){return (a?.crossfadeGroups??[]).map((e,t)=>{let i=n.createElement("div");i.dataset.pptxMorphCrossfade=e.incoming.id,i.style.cssText=chunk6VNMKCMN_cjs.dg,i.style.zIndex=String(4+t);let m=(p,l,s,y,g)=>{let d=u(n,T(p,[l]),y,g??"none",s);return s==="outgoing"?d.dataset.pptxMorphOutgoing="true":d.dataset.pptxMorphLifted="true",d.style.mixBlendMode=chunk6VNMKCMN_cjs.eg,d};return i.append(m(o.cloneNode(true),e.outgoing.id,"outgoing",0,e.outgoingAnimation),m(r.cloneNode(true),e.incoming.id,"lifted",1,e.incomingAnimation)),i})}function se(n){let{doc:o,stageWrap:r,outgoing:a,incoming:e,transition:t}=n;K(o);let i=chunk6VNMKCMN_cjs.Hh(t),m=chunk6VNMKCMN_cjs.Ih(t),p=chunk6VNMKCMN_cjs.Ch(t.type,m,t.direction,t.spokes,t.pattern),l=o.createElement("div");l.className="pptxv-transition-overlay",l.dataset.pptxTransitionOverlay="",l.dataset.pptxTransitionOverlay="",l.style.position="absolute",l.style.inset="0",l.style.overflow="hidden",l.style.pointerEvents="none",l.style.zIndex="30";let s=t.type==="morph"?chunk6VNMKCMN_cjs.gg(n.outgoingSlide,n.incomingSlide,m,chunk6VNMKCMN_cjs.fg(t.morphOption)):void 0,y=s||i.outgoingOnTop?2:1,g=s||i.outgoingOnTop?1:2,d=!s&&p?.outgoing?M(o,a,p.outgoing,y,"outgoing"):u(o,a,y,s?"none":i.outgoing,"outgoing"),x=!s&&p?.incoming?M(o,e,p.incoming,g,"incoming"):u(o,e,g,s?"none":i.incoming,"incoming"),S=s&&s.overlayIncomingElements.length>0?T(e.cloneNode(true),s.overlayIncomingElements.map(c=>c.id)):void 0,f=S?u(o,S,3,"none","lifted"):void 0,$=q(o,a,e,s);if(s){x.dataset.pptxMorphIncoming="true",d.dataset.pptxMorphOutgoing="true",T(a,s.outgoingElements.map(Y=>Y.id)),f&&(f.dataset.pptxMorphLifted="true");let c=o.createElement("style");c.textContent=[chunk6VNMKCMN_cjs.hg(s,"data-pptx-morph-incoming","incoming"),chunk6VNMKCMN_cjs.hg(s,"data-pptx-morph-outgoing","outgoing"),chunk6VNMKCMN_cjs.hg(s,"data-pptx-morph-lifted","lifted")].join(`
|
|
4
4
|
`),l.appendChild(c);}l.append(d,x),f&&l.appendChild(f);for(let c of $)l.appendChild(c);r.appendChild(l);let h=false,v=()=>{h||(h=true,clearTimeout(G),l.remove(),n.onDone());},G=setTimeout(v,Math.max(0,m)+50);return v}exports.a=K;exports.b=X;exports.c=Z;exports.d=se;
|