pptx-vanilla-viewer 2.1.1 → 2.1.3

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/dist/styles.css CHANGED
@@ -170,9 +170,17 @@
170
170
  .pptxv-titlebar-dot { color: var(--pptx-muted-foreground); }
171
171
  .pptxv-titlebar-status.is-error { color: #dc2626; }
172
172
  .pptxv-titlebar-status.is-saving { color: #ca8a04; }
173
- .pptxv-titlebar-search { position: absolute; left: 50%; width: min(320px, 30vw); transform: translateX(-50%); }
174
- .pptxv-titlebar-spacer { flex: 1; min-width: 20px; }
175
- .pptxv-cmdsearch { position: relative; width: 100%; }
173
+ /*
174
+ * Flex-based centering (not position:absolute + left:50%): an absolutely
175
+ * positioned box centers on the FULL bar width regardless of how much room
176
+ * the file name / status text on the left actually uses, so a longer status
177
+ * message (e.g. "Saved to this PC") gets visually covered by the search box
178
+ * instead of the two ever sharing space. flex:1 here reserves the real
179
+ * remaining width between the file group and the bar's end, and centers the
180
+ * search box within that.
181
+ */
182
+ .pptxv-titlebar-search { flex: 1 1 auto; display: flex; justify-content: center; min-width: 20px; }
183
+ .pptxv-cmdsearch { position: relative; width: min(320px, 30vw); }
176
184
  .pptxv-cmdsearch-box { display: flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--pptx-border); border-radius: 4px; background: var(--pptx-muted); color: var(--pptx-muted-foreground); }
177
185
  .pptxv-cmdsearch-box svg { width: 13px; height: 13px; flex: none; }
178
186
  .pptxv-cmdsearch-input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--pptx-foreground); font: inherit; }
@@ -181,7 +189,47 @@
181
189
  .pptxv-cmdsearch-item { cursor: pointer; }
182
190
  .pptxv-cmdsearch-item:hover { background: var(--pptx-accent); color: var(--pptx-accent-foreground); }
183
191
  .pptxv-cmdsearch-empty { color: var(--pptx-muted-foreground); }
184
- @media (max-width: 767px), (max-width: 1023px) and (max-height: 520px) { .pptxv-titlebar { display: none; } }
192
+ @media (max-width: 767px), (max-width: 1023px) and (max-height: 520px) { .pptxv-titlebar, .pptxv-qat-row { display: none; } }
193
+
194
+ /* Quick Access Toolbar docked below the Ribbon (Options > Quick Access
195
+ Toolbar > position); hidden and empty until the strip is moved in. */
196
+ .pptxv-qat-row {
197
+ display: flex;
198
+ align-items: center;
199
+ gap: 4px;
200
+ min-height: 36px;
201
+ padding: 0 8px;
202
+ border-bottom: 1px solid var(--pptx-border);
203
+ background: var(--pptx-card);
204
+ }
205
+ .pptxv-qat-row .pptxv-qat { display: flex; align-items: center; gap: 4px; }
206
+
207
+ /* Trust Center > Protected View banner: PowerPoint's persistent "this file
208
+ is read-only until you Enable Editing" bar under the Ribbon. */
209
+ .pptxv-protected-view {
210
+ display: flex;
211
+ align-items: center;
212
+ gap: 8px;
213
+ padding: 6px 8px;
214
+ background: #fef3c7;
215
+ color: #78350f;
216
+ border-bottom: 1px solid #fcd34d;
217
+ font-size: 11px;
218
+ }
219
+ .pptxv-protected-view svg { width: 16px; height: 16px; flex: none; }
220
+ .pptxv-protected-view-text { flex: 1 1 auto; }
221
+ .pptxv-protected-view-enable {
222
+ flex: none;
223
+ padding: 3px 10px;
224
+ border: 1px solid #b45309;
225
+ border-radius: 4px;
226
+ background: #fff;
227
+ color: #78350f;
228
+ font: inherit;
229
+ font-weight: 600;
230
+ cursor: pointer;
231
+ }
232
+ .pptxv-protected-view-enable:hover { background: #fde68a; }
185
233
 
186
234
  /* ── Body: thumbnail rail + viewport ─────────────────────────────────── */
187
235
  .pptxv-body { display: flex; flex: 1; min-height: 0; }
@@ -321,12 +369,12 @@
321
369
  overflow: auto;
322
370
  display: grid;
323
371
  /*
324
- * Centred across, TOP-aligned down, which is what React's canvas does
325
- * (mx-auto my-4). Centring both ways only looks the same while the slide
326
- * nearly fills the area: on a phone the slide floated in the middle of a
327
- * screen-tall gap while React had it just under the toolbar.
372
+ * Centred both ways, matching every other binding's canvas viewport
373
+ * (React/Vue/Angular now flex + 'margin: auto', Svelte flex + 'margin:
374
+ * auto'): the slide sits in the middle of the scroll area rather than
375
+ * pinned under the toolbar.
328
376
  */
329
- place-items: start center;
377
+ place-items: center center;
330
378
  padding: 16px;
331
379
  background: var(--pptx-muted);
332
380
  }
@@ -354,11 +402,18 @@
354
402
  .pptxv-para { margin: 0; }
355
403
 
356
404
  /* ── Selection overlay (editing) ─────────────────────────────────────── */
405
+ /* Every slide element carries an explicit numeric z-index (index-based, see
406
+ element-styles.ts), so on a slide with more than 5 elements this host used
407
+ to paint BEHIND later ones, hiding the selected element's own resize/rotate
408
+ handles behind its own fill (worst on a rotated shape, where the rotate
409
+ knob deliberately overlaps the box) and stealing their clicks. Pinned above
410
+ any realistic per-slide element count, matching the React binding's
411
+ 'SelectionHandleOverlay' (z-index 58). */
357
412
  .pptxv-editor-overlay {
358
413
  position: absolute;
359
414
  inset: 0;
360
415
  pointer-events: none;
361
- z-index: 5;
416
+ z-index: 58;
362
417
  }
363
418
  .pptxv-sel-box {
364
419
  position: absolute;
@@ -740,6 +795,8 @@
740
795
  /* ── Presentation (fullscreen) mode ──────────────────────────────────── */
741
796
  .pptxv.pptxv-presenting .pptxv-ribbon,
742
797
  .pptxv.pptxv-presenting .pptxv-thumbs,
798
+ .pptxv.pptxv-presenting .pptxv-qat-row,
799
+ .pptxv.pptxv-presenting .pptxv-protected-view,
743
800
  .pptxv.pptxv-presenting .pptxv-titlebar { display: none; }
744
801
  /* A show letterboxes the slide in the middle of the black, so the editing
745
802
  canvas's top alignment is overridden back to centred here. */
@@ -1315,7 +1372,7 @@
1315
1372
  .pptxv-ribbon-tab-content {
1316
1373
  display: flex;
1317
1374
  flex-wrap: nowrap;
1318
- align-items: stretch;
1375
+ align-items: center;
1319
1376
  gap: 0;
1320
1377
  min-height: 82px;
1321
1378
  padding: 2px 4px;
@@ -2818,11 +2875,11 @@
2818
2875
  .pptxv-mobile-toolbar-ai .pptxv-ai-toggle.is-active { color: var(--pptx-primary); background: transparent; }
2819
2876
  .pptxv-mobile-share { min-width: 44px; background: var(--pptx-primary); color: var(--pptx-primary-foreground); }
2820
2877
  .pptxv-mobile-actions { display: contents; }
2821
- .pptxv-mobile-actions > nav { position: relative; z-index: 50; display: flex; flex: none; min-height: 64px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--pptx-border); background: var(--pptx-card); }
2878
+ .pptxv-mobile-actions > nav { position: relative; z-index: 50; display: flex; flex: none; min-height: 56px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--pptx-border); background: var(--pptx-card); }
2822
2879
  .pptxv-mobile-actions > nav button { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 44px; border: 0; background: transparent; color: var(--pptx-muted-foreground); font-size: 10px; touch-action: manipulation; }
2823
2880
  .pptxv-mobile-actions > nav button svg { width: 20px; height: 20px; }
2824
2881
  .pptxv-mobile-actions > nav button[aria-pressed='true'] { color: var(--pptx-primary); }
2825
- .pptxv-mobile-sheet-host { position: absolute; z-index: 48; inset: 0 0 64px; display: flex; align-items: end; }
2882
+ .pptxv-mobile-sheet-host { position: absolute; z-index: 48; inset: 0 0 56px; display: flex; align-items: end; }
2826
2883
  .pptxv-mobile-sheet-host[hidden] { display: none; }
2827
2884
  .pptxv-mobile-sheet-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgb(0 0 0 / 40%); }
2828
2885
  .pptxv-mobile-sheet { position: relative; display: flex; flex-direction: column; width: 100%; max-height: min(70dvh, 620px); border: 1px solid var(--pptx-border); border-bottom: 0; border-radius: 16px 16px 0 0; background: var(--pptx-background); box-shadow: 0 -12px 36px rgb(0 0 0 / 35%); transition: transform 150ms ease-out; }
@@ -3051,6 +3108,10 @@ label.pptxv-options-row { cursor: pointer; }
3051
3108
  .pptxv.pptxv-no-show-popup .pptxv-presentation-touch-prev,
3052
3109
  .pptxv.pptxv-no-show-popup .pptxv-presentation-touch-next,
3053
3110
  .pptxv.pptxv-no-show-popup .pptxv-presentation-touch-counter { display: none !important; }
3111
+ /* The desktop hover toolbar (createPresentationToolbar) sets its own inline
3112
+ opacity/pointer-events on mousemove; !important here is required to win
3113
+ over that inline style regardless of the JS auto-show timer. */
3114
+ .pptxv.pptxv-no-show-popup .pptxv-present-toolbar-wrap { opacity: 0 !important; pointer-events: none !important; }
3054
3115
  @media (max-width: 767px) { .pptxv-options-body { flex-direction: column; } .pptxv-options-nav { flex-direction: row; width: 100%; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--pptx-border); } }
3055
3116
 
3056
3117
 
@@ -3086,13 +3147,27 @@ label.pptxv-options-row { cursor: pointer; }
3086
3147
  }
3087
3148
  /* Animations > Motion Paths: the five PowerPoint families in captioned
3088
3149
  columns, sharing the preset gallery's capped/scrollable box so the ribbon
3089
- keeps its single-row height. */
3150
+ keeps its single-row height.
3151
+
3152
+ max-width: 420px + overflow-x: auto matches the cap React applies to the
3153
+ RibbonGroup that wraps its MotionPathGallery (max-w-[420px]
3154
+ overflow-hidden). Without a width cap here, this binding's five family
3155
+ columns (each already capped individually at 150px via
3156
+ .pptxv-motion-path-gallery-items) still combine to ~800px, wide enough
3157
+ to push the Advanced Animation and Timing groups after it off the
3158
+ ribbon's visible row: reachable only via a second, easy-to-miss nested
3159
+ horizontal scrollbar (the reported Animations-tab clipping).
3160
+ overflow-x: auto (rather than React's overflow-hidden on its wrapper)
3161
+ keeps every family reachable via a small scrollbar instead of silently
3162
+ hiding whatever a hard clip would cut off. */
3090
3163
  .pptxv-motion-path-gallery {
3091
3164
  display: flex;
3092
3165
  align-items: flex-start;
3093
3166
  gap: 8px;
3167
+ max-width: 420px;
3094
3168
  max-height: 62px;
3095
3169
  padding: 2px 4px;
3170
+ overflow-x: auto;
3096
3171
  overflow-y: auto;
3097
3172
  border: 1px solid color-mix(in srgb, var(--pptx-border) 60%, transparent);
3098
3173
  border-radius: var(--pptx-radius);
@@ -3900,12 +3975,12 @@ svg[data-pptx-motion-path-overlay] [data-pptx-motion-path-handle] { pointer-even
3900
3975
  }
3901
3976
 
3902
3977
  /* ── Mobile: bottom sheet instead of a full-width drawer that hides the
3903
- canvas. Anchored above the mobile bottom-action nav (64px + safe area) so
3978
+ canvas. Anchored above the mobile bottom-action nav (56px + safe area) so
3904
3979
  the slide stage stays visible and tappable above the sheet. Uses the same
3905
3980
  breakpoint as the rest of the mobile chrome (mobile-sheet-css.ts). ────── */
3906
3981
  @media (max-width: 767px), (max-width: 1023px) and (max-height: 520px) {
3907
3982
  .pptxv-ai-panel {
3908
- inset: auto 0 calc(64px + env(safe-area-inset-bottom)) 0;
3983
+ inset: auto 0 calc(56px + env(safe-area-inset-bottom)) 0;
3909
3984
  width: auto;
3910
3985
  height: min(75dvh, 640px);
3911
3986
  z-index: 46;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-vanilla-viewer",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
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",
@@ -1 +0,0 @@
1
- 'use strict';var chunkUWGSLLDO_cjs=require('./chunk-UWGSLLDO.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkUWGSLLDO_cjs.ql(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-row"),f=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkUWGSLLDO_cjs.al(p,o.getSlides())){let b=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-actions"),d=chunkUWGSLLDO_cjs.bl(p,o.getSlides());if(d){let r=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkUWGSLLDO_cjs.ql(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkUWGSLLDO_cjs.cl(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-pick"),b=chunkUWGSLLDO_cjs.ql(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkUWGSLLDO_cjs.ql(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history-head"),x=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkUWGSLLDO_cjs.ql(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history-body"),m=chunkUWGSLLDO_cjs.fl(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkUWGSLLDO_cjs.wl({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=chunkUWGSLLDO_cjs.fl(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkUWGSLLDO_cjs.fl(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkUWGSLLDO_cjs.fl(t,"li","pptxv-ai-history-row"),r=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-text"),k=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkUWGSLLDO_cjs.ql(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkUWGSLLDO_cjs.fl(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(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.Bl(t.toolName,t.input,h?"present":"past"),c=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool"),p=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-head"),m=chunkUWGSLLDO_cjs.ql(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkUWGSLLDO_cjs.ql(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkUWGSLLDO_cjs.Al(t.input);if(g){let f=chunkUWGSLLDO_cjs.fl(o,"details","pptxv-ai-tool-details"),C=chunkUWGSLLDO_cjs.fl(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkUWGSLLDO_cjs.zl(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=chunkUWGSLLDO_cjs.yl(a);if(x.length===0&&!h)continue;let c=chunkUWGSLLDO_cjs.fl(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkUWGSLLDO_cjs.ql(o,h?"comment":"sparkles"));let m=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposals-header"),x=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkUWGSLLDO_cjs.fl(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkUWGSLLDO_cjs.fl(o,"li");g.textContent=chunkUWGSLLDO_cjs.sl(s),l.appendChild(g);}a.appendChild(l);}let c=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-actions"),p=chunkUWGSLLDO_cjs.fl(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkUWGSLLDO_cjs.ql(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkUWGSLLDO_cjs.fl(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-header"),h=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkUWGSLLDO_cjs.ql(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkUWGSLLDO_cjs.fl(t,"form","pptxv-ai-composer"),d=chunkUWGSLLDO_cjs.fl(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkUWGSLLDO_cjs.ql(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkUWGSLLDO_cjs.xl)({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:chunkUWGSLLDO_cjs.vl(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=>chunkUWGSLLDO_cjs.yl(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=chunkUWGSLLDO_cjs.Cl(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;