@quirekit/pptx-editor 0.0.0-stage → 0.2.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/LICENSE.md +296 -0
- package/README.md +36 -2
- package/README.zh-CN.md +35 -0
- package/THIRD_PARTY_NOTICES.md +141 -0
- package/dist/ai.d.mts +296 -0
- package/dist/ai.mjs +786 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.mjs +90 -0
- package/dist/styles.css +2362 -0
- package/dist/svg-raster-DL19F7ez.mjs +11 -0
- package/dist/types-Bed8XDUh.d.mts +1589 -0
- package/package.json +95 -4
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import{$ as Na,A as Fg,At as zg,B as ju,Bt as Ra,C as Dg,Ct as Ku,D as Lg,Dt as Vg,Et as ja,F as Wu,Ft as Ig,G as Bg,H as Ws,I as Og,It as qu,J as qs,Jt as le,K as Ug,Kt as st,L as _u,Lt as Ng,M as Rg,Mt as jg,N as Gu,Nt as Kg,O as Wg,Ot as qg,P as Hu,Pt as _g,Q as Gg,Qt as ge,R as Qu,S as Hg,T as Qg,Tt as Xg,U as Xu,Ut as Zg,V as Zu,Vt as Yu,W as zt,X as Yg,Xt as Jg,Y as eb,Yt as ae,Z as Ka,Zt as Ju,_ as tb,_t as ec,a as nb,at as Wa,b as lb,c as tc,ct as nc,d as sb,dt as _s,et as sn,f as ob,ft as qa,g as ab,gt as ib,h as rb,ht as ub,i as _a,it as cb,j as db,jt as pb,k as fb,kt as Wl,l as lc,lt as Ga,m as mb,mt as hb,n as vb,nt as Xe,o as sc,ot as gb,p as bb,pt as yb,q as oc,qt as Ha,rt as xb,s as Qa,st as Gs,t as wb,tt as kb,u as ac,ut as ql,v as Hs,vt as $b,w as Sb,wt as Cb,x as Mb,xt as Pb,y as Xa,yt as Tb,z as ic,zt as Ab}from"./svg-raster-DL19F7ez.mjs";import{Fragment as U,Teleport as Eb,computed as F,createApp as rc,createBlock as B,createCommentVNode as L,createElementBlock as M,createElementVNode as k,createSlots as Fb,createTextVNode as R,createVNode as y,defineAsyncComponent as zb,defineComponent as O,inject as uc,isRef as Db,mergeModels as ol,mergeProps as ie,nextTick as pt,normalizeClass as Ne,normalizeStyle as fe,onBeforeUnmount as Re,onMounted as ft,onScopeDispose as Za,openBlock as x,provide as Lb,reactive as Vb,ref as V,renderList as H,renderSlot as cc,resolveDynamicComponent as An,shallowRef as Q,toDisplayString as N,unref as m,useModel as on,useTemplateRef as je,vShow as mt,watch as X,watchEffect as dc,withCtx as A,withDirectives as ht,withKeys as ue,withModifiers as J}from"vue";import{setQuireKitLicense as Ib}from"@quirekit/license";import{createTheme as pc,quireIconRegistry as Qs}from"@quirekit/ui";import{QuireButton as q,QuireCheckbox as Ce,QuireColorPicker as an,QuireCommentDraft as Bb,QuireCommentThread as Ob,QuireDialogContent as Te,QuireDialogRoot as Ae,QuireEditable as Ub,QuireEmptyState as Nb,QuireField as re,QuireIcon as me,QuireIconButton as ye,QuireIconProvider as Ya,QuireInput as Oe,QuireInputNumber as de,QuireKbd as Rb,QuireMenu as Xs,QuireOverlayProvider as fc,QuirePopoverContent as jb,QuirePopoverRoot as Kb,QuirePopoverTrigger as Wb,QuirePresetGallery as Ja,QuireProgress as mc,QuireQRCode as qb,QuireRadioGroup as Ke,QuireSegmented as al,QuireSelect as ce,QuireSlider as il,QuireSplitter as _b,QuireSwitch as En,QuireTableSizePicker as Gb,QuireTabs as hc,QuireTag as ei,QuireTextarea as Ct,QuireThemeProvider as ti,QuireToaster as Hb,QuireToolbar as Nt,QuireToolbarField as Fn,QuireTooltipContent as Qb,QuireTooltipRoot as Xb,QuireTooltipTrigger as Zb,createQuireKitToaster as Yb}from"@quirekit/ui/vue";import{BUILTIN_PICTURE_STYLES as vc,BUILTIN_TABLE_STYLES as ni,addBlankSlide as gc,addContentSlide as Jb,addSlide as bc,addSlideAt as e0,addSlideChart as yc,addSlideComment as li,addSlideImage as Zs,addSlideLayout as t0,addSlideLayoutPlaceholder as n0,addSlideLine as xc,addSlidePlaceholder as si,addSlideShape as zn,addSlideTable as oi,addSlideTextBox as Ys,applySlideBackgroundToAll as l0,asColor as wc,bringShapeForward as s0,bringShapeToFront as o0,clearShapeEffects as kc,clearShapeFill as a0,clearShapeStroke as i0,clearSlideAnimations as r0,clearSlideBackground as u0,clearSlideComments as c0,clearSlideLayoutBackground as d0,clearSlideTransition as p0,clearTableCellFill as $c,cm as be,compactPackage as f0,copyShape as ai,createPresentation as Sc,duplicateSlide as m0,emu as j,findShapeById as _l,findSlideByPartName as rl,findSlideLayout as h0,findSlideLayoutByPartName as ul,findSlideLayoutByType as ii,findSlidePlaceholder as rn,getCommentAuthor as v0,getCommentDate as g0,getCommentFormat as Js,getCommentParent as ri,getCommentPosition as b0,getCommentStatus as y0,getCommentText as Cc,getCoreProperties as Mc,getCustomShows as Gl,getDrawingGuides as ui,getDrawingGuidesVisible as Hl,getGridSpacing as Pc,getGroupChildren as eo,getMaxShapeId as Dn,getParagraphAlignment as ci,getParagraphElementLanguages as x0,getParagraphIndent as w0,getParagraphLineSpacing as k0,getParagraphPropertiesEffective as di,getParagraphSpacing as $0,getPresentationCommenters as S0,getPresentationFirstSlideNumber as Ql,getPresentationFonts as Xl,getPresentationText as C0,getPresentationTheme as Mt,getPresetGeometry as M0,getShape3D as Tc,getShapeAdjustValues as pi,getShapeAltTitle as to,getShapeBodyPrEffective as P0,getShapeBounds as tt,getShapeBoundsResolved as fi,getShapeChartCategories as T0,getShapeChartKind as A0,getShapeChartSeriesNames as E0,getShapeChartSeriesValues as F0,getShapeClickAction as mi,getShapeCustomGeometry as Ac,getShapeDescription as Ec,getShapeEffectsEffective as Fc,getShapeFillColorResolved as Zl,getShapeFillEffective as zc,getShapeFillOpacity as z0,getShapeFlip as Ln,getShapeGradientFillEffective as Dc,getShapeId as Fe,getShapeImageBiLevelThreshold as D0,getShapeImageBrightness as Lc,getShapeImageBytes as un,getShapeImageContrast as Vc,getShapeImageCrop as Ic,getShapeImageDuotone as L0,getShapeImageFillBytes as V0,getShapeImageFormat as no,getShapeImageIntrinsicSize as cl,getShapeImageOpacity as Bc,getShapeImagePartName as I0,getShapeKind as Yl,getShapeMedia as Oc,getShapeMediaPlayback as Uc,getShapeName as dl,getShapeParagraphCount as pl,getShapeParagraphElements as lo,getShapePatternFill as B0,getShapePictureStyle as O0,getShapePlaceholderType as U0,getShapePreset as so,getShapeRotation as hi,getShapeRunCount as Nc,getShapeRunFormat as N0,getShapeRunFormatEffective as Jl,getShapeStrokeArrow as es,getShapeStrokeCap as R0,getShapeStrokeColorResolved as oo,getShapeStrokeCompound as j0,getShapeStrokeDash as K0,getShapeStrokeEffective as W0,getShapeStrokeJoin as q0,getShapeStrokeWidth as vi,getShapeText as ze,getShapeTextAnchor as Rc,getShapeTextAutoFit as _0,getShapeTextDirection as G0,getShapeZIndex as ts,getSlideAnimations as Dt,getSlideBackground as H0,getSlideBackgroundGradientFill as Q0,getSlideCharts as gi,getSlideComments as ao,getSlideIndex as Vn,getSlideLayout as Pt,getSlideLayoutName as Lt,getSlideLayoutPartName as Vt,getSlideLayoutPlaceholders as ns,getSlideLayoutType as bi,getSlideLayouts as io,getSlideMasterBackground as X0,getSlideMasterLayouts as ls,getSlideMasterName as Z0,getSlideMasterPartName as jc,getSlideMasterPartNames as ss,getSlideMasterPlaceholders as yi,getSlideMediaPartNames as Y0,getSlideNotes as In,getSlidePartName as We,getSlideSections as J0,getSlideShapes as ot,getSlideShowProperties as os,getSlideSize as Rt,getSlideTitle as xi,getSlideTransition as ro,getSlideTransitionSound as wi,getSlideXmlString as ey,getSlides as pe,getSlidesByLayout as ki,getSnapToGrid as $i,getTableCell as as,getTableCellAlignment as Kc,getTableCellAnchor as Wc,getTableCellBorders as qc,getTableCellFill as _c,getTableCellMargins as Si,getTableCellParagraphs as Gc,getTableCellRunFormatEffective as Ci,getTableCellSpan as fl,getTableCellText as cn,getTableCellTextDirection as Hc,getTableCells as ml,getTableColumnWidths as Bn,getTableDimensions as Ze,getTableRowHeights as On,getTableStyleFlags as Mi,getTableStyleId as ty,groupShapes as Qc,hasShapeImage as ny,importSlide as ly,insertTableColumn as Pi,insertTableRow as Ti,isChartSpec as hl,isShapeAspectRatioLocked as Ai,isShapeHidden as Xc,isShapeImageGrayscale as sy,isShapeLocked as uo,isShapePlaceholder as Zc,isShapeTextBox as Yc,isSlideBackgroundGraphicsHidden as oy,isSlideHidden as co,isSlideLayoutBackgroundGraphicsHidden as Jc,isTableShape as po,listPackageParts as ed,loadPresentation as dn,mergeTableCells as fo,moveSlide as Un,moveSlideAnimation as ay,readPackagePart as jt,removeShape as pn,removeSlide as Ei,removeSlideAnimation as mo,removeSlideComment as td,removeSlideLayout as iy,removeTableColumn as ry,removeTableRow as uy,renameShape as fn,replaceTextInSlideNotes as cy,resetShapeImageColorEffects as dy,resetSlideLayout as py,savePresentation as vl,sendShapeBackward as fy,sendShapeToBack as my,setChartData as hy,setChartSpec as vy,setCommentStatus as gy,setCommentText as by,setCoreProperties as yy,setCustomShows as xy,setDrawingGuides as wy,setDrawingGuidesVisible as ky,setGridSpacing as $y,setMediaPartBytes as nd,setParagraphAlignment as Fi,setParagraphBullet as Sy,setParagraphIndent as Cy,setParagraphLevel as My,setParagraphLineSpacing as ld,setParagraphSpacing as Py,setParagraphTypography as Ty,setPresentationFonts as zi,setPresentationTheme as gl,setShape3D as ho,setShapeAdjustValues as sd,setShapeAlignment as Nn,setShapeAltTitle as od,setShapeAnimation as vo,setShapeAspectRatioLocked as Ay,setShapeBounds as bl,setShapeClickAction as Di,setShapeCustomGeometry as go,setShapeDescription as Ey,setShapeFill as Rn,setShapeFlip as Fy,setShapeGlow as zy,setShapeGradientFill as ad,setShapeHidden as Dy,setShapeImage as Li,setShapeImageBrightness as Ly,setShapeImageCompressionState as Vy,setShapeImageContrast as Iy,setShapeImageCrop as id,setShapeImageFill as By,setShapeImageFillLayout as Oy,setShapeImageOpacity as Vi,setShapeImageRecolor as bo,setShapeInnerShadow as rd,setShapeMediaPlayback as Uy,setShapeNoFill as yl,setShapeNoStroke as Ii,setShapeParagraphs as ud,setShapePatternFill as Ny,setShapePictureStyle as cd,setShapePreset as dd,setShapeReflection as Ry,setShapeRotation as Bi,setShapeRunFormat as pd,setShapeShadow as fd,setShapeSoftEdge as jy,setShapeStroke as xl,setShapeStrokeArrow as Ky,setShapeStrokeCap as Oi,setShapeStrokeCompound as Wy,setShapeStrokeDash as qy,setShapeStrokeJoin as Ui,setShapeStyle as yo,setShapeText as at,setShapeTextAnchor as wl,setShapeTextAutoFit as _y,setShapeTextColumns as Gy,setShapeTextDirection as md,setShapeTextField as Ni,setShapeTextFormat as nt,setShapeTextMargins as Hy,setShapeTextWrap as Qy,setShapeZIndex as xo,setSlideBackground as Xy,setSlideBackgroundGradientFill as Zy,setSlideBackgroundGraphicsHidden as Yy,setSlideBackgroundImage as hd,setSlideHidden as Jy,setSlideLayout as e1,setSlideLayoutBackground as t1,setSlideLayoutBackgroundGraphicsHidden as n1,setSlideLayoutFootersIncluded as vd,setSlideLayoutName as l1,setSlideLayoutPlaceholderBounds as s1,setSlideLayoutTitleIncluded as o1,setSlideMasterBackgroundStyle as gd,setSlideMasterPlaceholderIncluded as bd,setSlideNotes as Ri,setSlideSections as yd,setSlideShowProperties as ji,setSlideSize as wo,setSlideTitle as a1,setSlideTransition as Ki,setSlideTransitionSound as i1,setSnapToGrid as r1,setTableCellAlignment as ko,setTableCellAnchor as xd,setTableCellBorders as mn,setTableCellFill as $o,setTableCellMargins as wd,setTableCellText as Kt,setTableCellTextDirection as u1,setTableCellTextFormat as So,setTableColumnWidth as Co,setTableRowHeight as hn,setTableStyleFlags as is,setTableStyleId as Mo,splitTableCell as c1,ungroupShapes as d1,updateSlideAnimation as p1}from"@quirekit/office-kit-pptx";import{drawingShapeCatalog as f1,isDrawingPreset as kd,resolveDrawingAdjustmentHandles as $d,resolveDrawingPreset as m1,solveDrawingAdjustment as h1}from"@quirekit/drawing-geometry";import{decodeQuireImageDataUrl as v1,embedQuireMediaEditableSource as Sd,encodeQuireImageDataUrl as g1,extractQuireMediaEditableSource as b1}from"@quirekit/media";import{latexToOmml as y1,ommlToLatex as x1}from"@quirekit/math-omml";import{v4 as Wi}from"uuid";import{renderSlideLayoutToSvg as qi,renderSlideToSvg as Wt}from"@quirekit/office-kit-pptx-preview";import{createAnimationPlayer as w1}from"@quirekit/office-kit-pptx-editor/internal/animation-player";import{AllSelection as k1,EditorState as $1,Fragment as Cd,Plugin as Md,Schema as S1,Slice as C1,TextSelection as _i,baseKeymap as M1,history as P1,keymap as Pd,redo as Td,undo as T1}from"@quirekit/pm";import{Decoration as A1,DecorationSet as E1,EditorView as F1}from"@quirekit/pm-view";import{EditorUIColorButton as Po,EditorUIFontField as Ad,createEditorFontSizeOptions as z1,resolveEditorFontSizeControlValue as D1,resolveEditorFontSizeSelection as L1}from"@quirekit/editor-ui/vue/formatting";import{EditorUIShapeGallery as Ed}from"@quirekit/editor-ui/vue/shapes";import{EditorUIObjectSelection as V1}from"@quirekit/editor-ui/vue/object";import{encode as I1}from"uqr";import"@quirekit/editor-ui/styles.css";const B1=400;function O1(e,t,n,l){r0(e);const s=t.role!=="content";Ki(e,Yu(s?n.sectionTransition:n.transition)),t.blocks.forEach((o,a)=>{const i=o.focus?n.hero:n.entrance,r=s||l==="auto";o.shapes.forEach((u,c)=>{const d=c===0;vo(u,{effect:i.effect,...i.direction?{direction:i.direction}:{},durationMs:i.durationMs,start:d?r?"afterPrevious":"click":"withPrevious",...d&&r?{delayMs:a===0?200:s?150:B1}:{}})})})}const U1=/^qk:(cover|section|content|closing):(?:e(\d+)-([A-Za-z]+)|frame):/u,N1=new Set(["eyebrow","title","subtitle"]),R1=new Set(["bigNumber","takeaway"]);function j1(e){let t=null;const n=new Map;for(const a of ot(e)){const i=U1.exec(dl(a)??"");if(!i||(t=i[1],i[2]===void 0))continue;const r=Number(i[2]),u=n.get(r)??{kind:i[3],shapes:[]};u.shapes.push(a),n.set(r,u)}if(t===null)return null;const l=[...n.entries()].sort((a,i)=>a[0]-i[0]).map(([,a])=>a),s=t==="content"?l.filter(a=>!N1.has(a.kind)):l,o=[...s.filter(a=>a.kind!=="takeaway"),...s.filter(a=>a.kind==="takeaway")];return{role:t,blocks:o.map(a=>({shapes:a.shapes,focus:R1.has(a.kind)}))}}function K1(e,t){const n=new Map(ot(e).map(r=>[Fe(r),r])),l=[];let s=[];const o=r=>{const u=[...s,...r].flatMap(c=>n.get(c)??[]);s=[],u.length>0&&l.push({shapes:u,focus:!1})},a=r=>{const u=n.get(r);if(u===void 0)return!1;const c=st(u);if(c!=="text"&&c!=="other"&&c!=="connector")return!0;try{return ze(u).trim()!==""}catch{return!1}},i=r=>{for(const u of r)if(u.kind==="shape")a(u.shape)&&o([u.shape]);else if(u.kind==="items")for(const c of u.items)c.some(a)&&o(c);else if(u.holds.every(c=>c.kind==="shape")){const c=[u.shape,...u.holds.flatMap(d=>d.kind==="shape"?[d.shape]:[])];c.some(a)&&o(c)}else s=[...s,u.shape],i(u.holds)};return i(t.content),{role:"content",blocks:l}}const W1=new Set(["picture","media"]);function q1(e){const t=[],n=l=>{typeof l=="string"?t.push(l):l!==null&&typeof l=="object"&&t.push(l.from,l.to)};return"color"in e&&n(e.color),"color2"in e&&n(e.color2),"fill"in e&&n(e.fill),"line"in e&&n(e.line),"glow"in e&&e.glow&&n(e.glow.color),t}const _1={name:"draw",addCommands:()=>({drawSlide:ge({description:"Draws a whole slide from objects you place yourself: text boxes, shapes, lines, icons, element-library motifs, charts and tables, each at its position and size in centimetres or on the page grid (area: columns of twelve within the margins, rows of the title or content band, edges to bleed on to), in the colour roles and type sizes of the design language. Nothing is laid out for you, so derive the composition from what this slide has to show. New slides go after the target slide; replace clears the target slide and draws it again, keeping its pictures and media, which you then move, resize or delete with their own commands. Objects are drawn in order, later ones on top. motif objects draw a parametric element of the element library (dot grids, rings and HUD dials, blobs, slanted blocks, waves, glows, rays, ribbons, particles, ink mountains, lattice windows, seals, frames and more) as one editable group in the frame you give it, so a hero visual never has to be built shape by shape. component objects lay out a component of the component library (cover title groups, content page headers, quotes, card grids, key figures, bento grids, two-by-two matrices, pyramids and funnels, architecture tiers, steps, timelines, agendas, comparisons, mocked-up emails, phone chats and browser pages) from its content in the deck's component skin, so cards, badges and headers match across the deck and you place one frame instead of every box. Give the title the title role, shapes and lines that carry no content the decoration role, and add a pageNumber object where the slide shows its number. page names the kind of page, which brings the background and text colour the design language gives it; background overrides it for this slide.",params:{type:"object",properties:{replace:{type:"boolean",description:"Clear and redraw the target slide instead of adding a new one after it."},page:{enum:[..._g],description:"Kind of page: cover, section, content, data, quote or closing."},background:pb,elements:{type:"array",minItems:1,maxItems:60,items:jg}},required:["elements"],additionalProperties:!1},target:"slide",category:"design",adapt:(e,t)=>{const{replace:n,page:l,background:s,elements:o}=e;if(t.slide===null)return null;const a=Wl(t.presentation),i=$b(o,t,"Object",Tb(t.presentation,a?.margin,a?.type.title)),r=zg(s);return{slide:t.slide,replace:n===!0,...l?{page:l}:{},...r===void 0?{}:{background:r},...i}},run:e=>({presentation:t,dispatch:n})=>{if(e.problem)throw new Ju(e.problem);const l=ae(t,e.slide);if(!l||e.elements.length===0)return!1;const s=Wl(t),o=s?s.pages[e.page??"content"]:void 0,a=e.background??o?.background,i=e.background!==void 0&&s?Ng(s.palette,Kg(s.palette,e.background)):o?.text??"text",r=[...e.elements.flatMap(q1),...typeof a=="string"?[a]:a?[a.from,a.to]:[]].find(f=>Ku(s,f)===null);if(r!==void 0)throw new Ju(s?`"${r}" is neither a colour role nor #RRGGBB.`:`The deck has no design language, so the colour role "${r}" means nothing yet: record one with setDeckDesign, or give #RRGGBB.`);if(!n)return!0;let u=l;const c=new Set;if(e.replace)for(const f of ot(u))W1.has(st(f))?c.add(Fe(f)):pn(f);else{const f=ii(t,"blank")??io(t)[0];if(!f)return!1;u=bc(t,{layout:f}),Un(t,u,Vn(t,l)+1)}Pb(u,s,a,e.elements,Vn(t,u)+1,i);const d=ot(u),p=d.filter(f=>c.has(Fe(f)));return p.length>0&&xo(p,d.length-p.length),!0}})})},G1={name:"deckMotion",addCommands:()=>({applyMotion:ge({description:"Animates slides the way the deck's design language moves, replacing their own transitions and animations: each slide comes in with the deck's transition, its header stays, and its content comes in one idea per block in reading order: each item of repeated items, each card with its text, each other piece; lines joining items stay. pace click waits for a click per block, for a live talk; auto plays the blocks one after another, for a recording.",params:{type:"object",properties:{pace:{enum:["click","auto"]},allSlides:{type:"boolean",description:"Every slide of the deck instead of the target slide; still name any slide as the target, such as s1."}},required:["pace"],additionalProperties:!1},target:"slide",category:"slides",adapt:(e,t)=>{const{pace:n,allSlides:l}=e,s=l?pe(t.presentation).map(We):t.slide===null?[]:[t.slide];return s.length===0?null:{slides:s,pace:n}},run:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(a=>ae(t,a));if(l.length===0||l.some(a=>a===null))return!1;if(!n)return!0;const s=Ab(Wl(t)?.motion),o=gb();for(const a of l)O1(a,j1(a)??K1(a,o.read(t,a)),s,e.pace);return!0}})})},H1={type:"string",pattern:"^#[0-9A-Fa-f]{6}$"},Fd=["dark1","light1","dark2","light2","accent1","accent2","accent3","accent4","accent5","accent6"],Q1={name:"deckTheme",addCommands:()=>({setDeckColors:ge({description:"Sets the deck's theme colours. Tables, charts, new shapes and placeholders draw in them, so set them first when designing a deck: dark1/light1 are text and background, accent1–accent6 the palette in order of use. Slots left out keep their colours.",params:{type:"object",properties:Object.fromEntries(Fd.map(e=>[e,{...H1,description:`${e} as #RRGGBB.`}])),minProperties:1,additionalProperties:!1},category:"design",adapt:e=>({colors:e}),run:e=>({presentation:t,dispatch:n})=>{const l=Mt(t),s=Object.entries(e.colors);return l===null||s.length===0||s.some(([o,a])=>!Fd.includes(o)||!/^#[0-9a-f]{6}$/iu.test(String(a)))?!1:(n&&gl(t,Object.fromEntries(s.map(([o,a])=>[o,String(a).toUpperCase()]))),!0)}}),setDeckFonts:ge({description:"Sets the deck's theme fonts: heading and body, each for Latin and for Chinese text. Placeholders and text without a font of their own use them.",params:{type:"object",properties:{headingLatin:{type:"string",minLength:1},headingChinese:{type:"string",minLength:1},bodyLatin:{type:"string",minLength:1},bodyChinese:{type:"string",minLength:1}},minProperties:1,additionalProperties:!1},category:"design",adapt:e=>{const{headingLatin:t,headingChinese:n,bodyLatin:l,bodyChinese:s}=e;return{fonts:{majorLatin:t,majorEastAsian:n,minorLatin:l,minorEastAsian:s}}},run:e=>({presentation:t,dispatch:n})=>{const l=Xl(t),s=Object.fromEntries(Object.entries(e.fonts).filter(([,o])=>typeof o=="string"&&o.trim()!==""));return l===null||Object.keys(s).length===0?!1:(n&&zi(t,s),!0)}})})};function zd(e,t,n){const l=[];for(const s of n){const o=Xe(e,t,s);if(o===null)return null;const a=ql(o.frame);l.push({placed:o,bounds:{x:a.x,y:a.y,w:a.width,h:a.height}})}return l.length===0?null:l}function Dd(e,t,n){if(t.length===1){const o=Ga(e);return{start:0,end:n?o.height:o.width}}const l=t.map(({bounds:o})=>n?o.y:o.x),s=t.map(({bounds:o})=>n?o.y+o.h:o.x+o.w);return{start:Math.min(...l),end:Math.max(...s)}}function Ld(e,t,n){const l=n-(t?e.bounds.y:e.bounds.x);if(Math.round(l)===0)return!1;const{frame:s}=e.placed;return sn(e.placed,{...s,x:s.x+(t?0:l),y:s.y+(t?l:0)}),!0}const X1={name:"align",addCommands:()=>({alignShapes:ge({description:"Aligns the target shape on its slide: to the left, horizontal centre or right edge, or to the top, vertical middle or bottom edge.",params:{type:"object",properties:{edge:{enum:["left","center","right","top","middle","bottom"]}},required:["edge"],additionalProperties:!1},target:"shape",category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],edge:e.edge},run:e=>({presentation:t,dispatch:n})=>{const l=zd(t,e.slide,e.shapes);if(l===null)return!1;const s=["top","middle","bottom"].includes(e.edge),o=Dd(t,l,s),a=r=>e.edge==="left"||e.edge==="top"?o.start:e.edge==="right"||e.edge==="bottom"?o.end-r:(o.start+o.end-r)/2,i=l.filter(({bounds:r})=>Math.round(a(s?r.h:r.w))!==Math.round(s?r.y:r.x));if(i.length===0)return!1;if(n)for(const r of i)Ld(r,s,a(s?r.bounds.h:r.bounds.w));return!0}}),distributeShapes:e=>({presentation:t,dispatch:n})=>{const l=zd(t,e.slide,e.shapes);if(l===null)return!1;const s=e.axis==="vertical",o=Dd(t,l,s),a=f=>s?f.bounds.h:f.bounds.w,i=f=>s?f.bounds.y:f.bounds.x,r=[...l].sort((f,h)=>i(f)+a(f)/2-(i(h)+a(h)/2)),u=o.end-o.start-r.reduce((f,h)=>f+a(h),0),c=r.length===1?u/2:u/(r.length-1);let d=r.length===1?o.start+c:o.start;const p=r.map(f=>{const h=d;return d+=a(f)+c,{item:f,at:h}});if(p.every(({item:f,at:h})=>Math.round(h)===Math.round(i(f))))return!1;if(n)for(const{item:f,at:h}of p)Ld(f,s,h);return!0}})},Z1={name:"group",addCommands:()=>({groupShapes:e=>({presentation:t,dispatch:n})=>{const l=e.shapes;if(l.length<2||new Set(l).size!==l.length)return!1;const s=l.map(i=>le(t,e.slide,i));if(s.some(i=>i===null||Zc(i)||tt(i)===null))return!1;const o=l.map(i=>Ha(t,e.slide,i)?.at(-1)),a=o[0]===void 0?null:Fe(o[0]);return o.some(i=>(i===void 0?null:Fe(i))!==a)?!1:(n&&Qc(s),!0)},ungroupShapes:ge({description:"Splits the target group back into its member shapes, which stay where they are drawn.",params:{type:"object",properties:{},additionalProperties:!1},target:"shape",kinds:["group"],category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape]},run:e=>({presentation:t,dispatch:n})=>{const l=e.shapes.map(s=>le(t,e.slide,s)).filter(s=>s!==null&&st(s)==="group");if(l.length===0)return!1;if(n)for(const s of l)d1(s);return!0}})})},Y1={name:"order",addCommands:()=>({arrangeShapes:ge({description:"Changes the stacking order of the target shape: to the front, to the back, or one step forward or backward.",params:{type:"object",properties:{order:{enum:["front","back","forward","backward"]}},required:["order"],additionalProperties:!1},target:"shape",category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],order:e.order},run:e=>({presentation:t,dispatch:n})=>{const l=e.shapes.map(s=>le(t,e.slide,s));if(l.length===0||l.some(s=>s===null))return!1;if(n){const s={front:o0,back:my,forward:s0,backward:fy}[e.order];s(l)}return!0}})})};function J1(e,t){const n=Math.abs(_s(e)-_s(t));return Math.min(n,360-n)<.01}function Vd(e,t,n){const l=n.map(o=>Xe(e,t,o));if(l.length===0||l.some(o=>o===null))return null;const s=l.filter(({shape:o})=>!["table","chart"].includes(st(o)));return s.length===0?null:s}const ex={name:"rotate",addCommands:()=>({rotateShapes:ge({description:"Turns the target shape about its centre: to sets its clockwise angle in degrees, 0 removing a rotation; by turns it further, negative values counter-clockwise. Give one of the two.",params:{type:"object",properties:{to:{type:"number",description:"Clockwise angle in degrees."},by:{type:"number",description:"Degrees to turn further clockwise; negative turns counter-clockwise."}},additionalProperties:!1},target:"shape",category:"shapes",adapt:(e,t)=>{const{to:n,by:l}=e;return t.slide===null||t.shape===null||n===void 0==(l===void 0)?null:{slide:t.slide,shapes:[t.shape],...n===void 0?{by:l}:{to:n}}},run:e=>({presentation:t,dispatch:n})=>{const l=Vd(t,e.slide,e.shapes);if(l===null||e.to===void 0&&e.by===void 0)return!1;const s=l.map(o=>({item:o,own:kb(o,_s(e.to??o.frame.rotation+e.by))})).filter(({item:o,own:a})=>!J1(a,hi(o.shape)));if(s.length===0)return!1;if(n)for(const{item:o,own:a}of s)Bi(o.shape,Math.round(a*1e3)/1e3),xb(o.groups);return!0}}),flipShapes:ge({description:"Mirrors the target shape left to right (horizontal) or top to bottom (vertical) about its centre.",params:{type:"object",properties:{axis:{enum:["horizontal","vertical"]}},required:["axis"],additionalProperties:!1},target:"shape",category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],axis:e.axis},run:e=>({presentation:t,dispatch:n})=>{const l=Vd(t,e.slide,e.shapes);if(l===null)return!1;if(n)for(const{shape:s}of l){const o=Ln(s);Fy(s,e.axis==="horizontal"?{horizontal:!(o?.horizontal??!1)}:{vertical:!(o?.vertical??!1)});const a=hi(s);a!==0&&Bi(s,_s(-a))}return!0}})})};function Id(e,t,n){const l=le(e,t,n),s=l===null?null:so(l),o=l===null?null:fi(e,l);return l===null||o===null||!kd(s)||$d(s,o.w,o.h).length===0?null:{preset:s,values:pi(l),width:o.w,height:o.h}}const tx={name:"adjust",addCommands:()=>({setShapeAdjustments:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);return l===null||Id(t,e.slide,e.shape)===null?!1:(n&&sd(l,{...pi(l),...e.values}),!0)}})},nx=`^(#[0-9A-Fa-f]{6}|${qu.join("|")})$`;function jn(e,t=!0){return{type:t?["string","null"]:"string",pattern:nx,description:`${e} As #RRGGBB, or a colour role of the deck's design language: ${qu.join(", ")}.`}}function rs(e,t){if(typeof t!="string"||t.startsWith("#"))return t;const n=t;return Ku(Wl(e),n,!0)??Cb[n]??"tx1"}function Bd(e,t,n){const l=n.map(o=>le(e,t,o));if(l.length===0||l.some(o=>o===null))return null;const s=l.filter(o=>st(o)==="text");return s.length===0?null:s}function Kn(e){return{...e.size===void 0?{}:{size:e.size},...e.bold===void 0?{}:{bold:e.bold},...e.italic===void 0?{}:{italic:e.italic},...e.underline===void 0?{}:{underline:e.underline},...e.color===void 0?{}:{color:e.color===null?null:e.color},...e.font===void 0?{}:{font:e.font,fontEastAsian:e.font},...e.strike===void 0?{}:{strike:e.strike},...e.highlight===void 0?{}:{highlight:e.highlight===null?null:e.highlight},...e.baseline===void 0?{}:{baseline:e.baseline}}}function lx(e,t){return{...e,...e.color===void 0?{}:{color:rs(t,e.color)},...e.highlight===void 0?{}:{highlight:rs(t,e.highlight)}}}const sx={type:"object",properties:{size:{type:"number",minimum:1,maximum:400,description:"Font size in points."},bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},color:jn("Text colour; null returns to the theme colour."),font:{type:"string",minLength:1,description:"Font family for Latin and Chinese text."},strike:{type:"boolean"},highlight:jn("Highlight colour behind the text; null removes it.")},additionalProperties:!1},ox={name:"format",addCommands:()=>({setTextFormat:ge({description:"Sets the font size, weight, slant, underline, strikethrough, color, highlight or font of all the text in the target shape; values left out stay as they are.",params:sx,target:"shape",kinds:["text"],category:"format",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],format:lx(e,t.presentation)},run:e=>({presentation:t,dispatch:n})=>{const l=Bd(t,e.slide,e.shapes);if(l===null||Object.keys(e.format).length===0)return!1;if(n)for(const s of l)nt(s,Kn(e.format));return!0}}),setTextAlignment:ge({description:"Aligns every paragraph of the target shape to the left, center or right, or justifies it.",params:{type:"object",properties:{align:{enum:["left","center","right","justify"]}},required:["align"],additionalProperties:!1},target:"shape",kinds:["text"],category:"format",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],align:e.align},run:e=>({presentation:t,dispatch:n})=>{const l=Bd(t,e.slide,e.shapes);if(l===null)return!1;if(n)for(const s of l)for(let o=0;o<pl(s);o+=1)Fi(s,o,e.align);return!0}}),setSlideLayout:ge({description:"Applies another layout of the deck to the target slide, by the layout name the deck view shows.",params:{type:"object",properties:{layout:{type:"string",minLength:1,description:'Layout name, such as "Title and Content".'}},required:["layout"],additionalProperties:!1},target:"slide",category:"slides",adapt:(e,t)=>t.slide===null?null:{slide:t.slide,layout:e.layout},satisfied:(e,t)=>{const n=t.slide===null?null:ae(t.presentation,t.slide),l=n===null?null:Pt(n);return l!==null&&Lt(l)===e.layout},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=h0(t,e.layout),o=l===null?null:Pt(l);return l===null||s===null||o!==null&&Lt(o)===e.layout?!1:(n&&e1(l,s),!0)}})})},Gi={fill:jn("Fill; null for none."),line:jn("Outline; null for none."),lineWidth:{type:"number",exclusiveMinimum:0,maximum:50,description:"Outline width in points."},fontSize:{type:"number",minimum:1,maximum:400,description:"Font size in points."},bold:{type:"boolean"},font:{type:"string",minLength:1,description:"Font family for Latin and Chinese text."},color:jn("Text colour.",!1),align:{enum:["left","center","right"]},anchor:{enum:["top","middle","center","bottom"],description:"Vertical placement of the text; center is the same as middle."}};function Od(e,t){const n={};for(const l of Object.keys(Gi))e[l]!==void 0&&(n[l]=e[l]);for(const l of["fill","line","color"])n[l]!==void 0&&(n[l]=rs(t,n[l]));return n.anchor==="center"&&(n.anchor="middle"),n}function Ud(e,t){t.fill!==void 0&&(t.fill===null?yl(e):Rn(e,t.fill)),t.line===null?Ii(e):(t.line!==void 0||t.lineWidth!==void 0)&&xl(e,{...t.line===void 0?{}:{color:t.line},...t.lineWidth===void 0?{}:{widthEmu:Math.round(t.lineWidth*12700)}});const n=Kn({...t.fontSize===void 0?{}:{size:t.fontSize},...t.bold===void 0?{}:{bold:t.bold},...t.font===void 0?{}:{font:t.font},...t.color===void 0?{}:{color:t.color}});Object.keys(n).length>0&&nt(e,n),t.align!==void 0&&Nn(e,t.align),t.anchor!==void 0&&wl(e,t.anchor==="middle"?"center":t.anchor)}const To={line:{idx:2,color:"accent1",colorTransforms:[{kind:"shade",value:.5}]},fill:{idx:1,color:"accent1"},effect:{idx:0,color:"accent1"},font:{idx:"minor",color:"lt1"}};function Hi(e,t,n){const l=n.map(s=>le(e,t,s));return l.length===0||l.some(s=>s===null)?null:l}function Nd(e,t){const n=tt(e);n&&t!==0&&bl(e,{x:j(n.x+t),y:j(n.y+t),w:n.w,h:n.h})}const ax={name:"objects",addCommands:()=>({addShape:ge({description:"Adds a preset shape, such as rect, roundRect, ellipse, triangle, rightArrow or star5, at a position and size in centimetres, optionally with text and its finished look: fill, outline, font size, bold, text colour and alignment.",params:{type:"object",properties:{preset:{type:"string",minLength:1,description:"OOXML preset shape name, such as rect, roundRect, ellipse, triangle, diamond, rightArrow, star5."},x:{type:"number"},y:{type:"number"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},text:{type:"string"},...Gi},required:["preset","x","y","width","height"],additionalProperties:!1},target:"slide",category:"shapes",adapt:(e,t)=>{if(t.slide===null)return null;const{preset:n,x:l,y:s,width:o,height:a,text:i}=e;return{slide:t.slide,preset:n,x:be(l),y:be(s),width:be(o),height:be(a),...i===void 0?{}:{text:i},look:Od(e,t.presentation)}},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(l===null||e.width<=0||e.height<=0||e.preset.length===0)return!1;if(n){const s=zn(l,{preset:e.preset,x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height)});yo(s,To),at(s,e.text??""),wl(s,"center"),Nn(s,"center"),e.look&&Ud(s,e.look)}return!0}}),setShapeFill:ge({description:"Fills the target shape with a colour, or removes its fill so it is transparent.",params:{type:"object",properties:{color:jn("Fill colour; null removes the fill.")},required:["color"],additionalProperties:!1},target:"shape",category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],color:rs(t.presentation,e.color)},run:e=>({presentation:t,dispatch:n})=>{const l=Hi(t,e.slide,e.shapes);if(l===null)return!1;if(n)for(const s of l)e.color===null?yl(s):Rn(s,e.color);return!0}}),setShapeOutline:ge({description:"Sets the outline of the target shape: a colour and a width in points, or no outline.",params:{type:"object",properties:{color:jn("Outline colour; null removes the outline."),width:{type:"number",exclusiveMinimum:0,maximum:50,description:"Outline width in points."}},required:["color"],additionalProperties:!1},target:"shape",category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],...e,color:rs(t.presentation,e.color)},run:e=>({presentation:t,dispatch:n})=>{const l=Hi(t,e.slide,e.shapes);if(l===null)return!1;if(n)for(const s of l)e.color===null?Ii(s):xl(s,{color:e.color,...e.width===void 0?{}:{widthEmu:Math.round(e.width*12700)}});return!0}}),duplicateShapes:ge({description:"Makes a copy of the target shape on the same slide, just below and to the right of it.",target:"shape",category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],offset:18e4},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=Hi(t,e.slide,e.shapes);if(l===null||s===null)return!1;if(n)for(const o of s)Nd(ai(l,o),e.offset);return!0}}),pasteShapes:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=ae(e.source,e.sourceSlide),o=s===null?null:e.shapes.map(a=>_l(s,a));if(l===null||o===null||o.length===0||o.some(a=>a===null))return!1;if(n)for(const a of o)Nd(ai(l,a),e.offset);return!0}})};function ix(e,t){const{wR:n,hR:l}=t,s=b=>b/6e4*Math.PI/180,o=b=>Math.atan2(n*Math.sin(b),l*Math.cos(b)),a=s(t.stAng),i=s(t.stAng+t.swAng),r=o(a);let u=o(i)-r;const c=t.swAng/6e4/360;t.swAng>0&&u<=0&&(u+=2*Math.PI),t.swAng<0&&u>=0&&(u-=2*Math.PI),u+=Math.trunc(c)*2*Math.PI;const d=e.x-n*Math.cos(r),p=e.y-l*Math.sin(r),f=b=>({x:d+n*Math.cos(b),y:p+l*Math.sin(b)}),h=Math.max(1,Math.ceil(Math.abs(u)/(Math.PI/2))),v=u/h,g=4/3*Math.tan(v/4),$=[];for(let b=0;b<h;b+=1){const w=r+v*b,S=w+v,C=f(w),E=f(S);$.push([{x:C.x-g*n*Math.sin(w),y:C.y+g*l*Math.cos(w)},{x:E.x+g*n*Math.sin(S),y:E.y-g*l*Math.cos(S)},E])}return{end:f(r+u),segments:$}}function Rd(e,t,n){return e.paths.map(l=>{const s=l.w||t||1,o=l.h||n||1,a=p=>({x:p.x/s,y:p.y/o}),i=[];let r=[],u={x:0,y:0};const c=(p,f)=>{r.push({...a(p),in:f&&a(f),out:null})},d=p=>{if(r.length===0)return;const f=r[0],h=r.at(-1);p&&r.length>1&&Math.abs(f.x-h.x)<1e-9&&Math.abs(f.y-h.y)<1e-9&&(r=[{...f,in:h.in},...r.slice(1,-1)]),i.push({nodes:r,closed:p}),r=[]};for(const p of l.commands)if(p.kind==="moveTo")d(!1),c(p.pt,null),u=p.pt;else if(p.kind==="lnTo")c(p.pt,null),u=p.pt;else if(p.kind==="cubicBezTo"){const[f,h,v]=p.pts;r.at(-1)&&(r.at(-1).out=a(f)),c(v,h),u=v}else if(p.kind==="quadBezTo"){const[f,h]=p.pts;r.at(-1)&&(r.at(-1).out=a({x:u.x+2/3*(f.x-u.x),y:u.y+2/3*(f.y-u.y)})),c(h,{x:h.x+2/3*(f.x-h.x),y:h.y+2/3*(f.y-h.y)}),u=h}else if(p.kind==="arcTo"){r.length===0&&c(u,null);const f=ix(u,p);for(const[h,v,g]of f.segments)r.at(-1).out=a(h),c(g,v);u=f.end}else d(!0);return d(!1),{fill:l.fill,stroke:l.stroke,subpaths:i}})}function Qi(e,t,n){const l=t.right-t.left||1,s=t.bottom-t.top||1,o=a=>({x:Math.round((a.x-t.left)/l*n.width),y:Math.round((a.y-t.top)/s*n.height)});return e.map(a=>{const i=[];for(const{nodes:r,closed:u}of a.subpaths){if(r.length===0)continue;i.push({kind:"moveTo",pt:o(r[0])});const c=u?r.length:r.length-1;for(let d=0;d<c;d+=1){const p=r[d],f=r[(d+1)%r.length];!p.out&&!f.in?u&&d===r.length-1||i.push({kind:"lnTo",pt:o(f)}):i.push({kind:"cubicBezTo",pts:[o(p.out??p),o(f.in??f),o(f)]})}u&&i.push({kind:"close"})}return{w:n.width,h:n.height,fill:a.fill,stroke:a.stroke,commands:i}})}function jd(e,t,n,l){const s=-e+3*t-3*n+l,o=2*(e-2*t+n),a=t-e,i=Math.abs(s)<1e-12?Math.abs(o)<1e-12?[]:[-a/o]:(()=>{const u=o*o-4*s*a;return u<0?[]:[(-o+Math.sqrt(u))/(2*s),(-o-Math.sqrt(u))/(2*s)]})(),r=u=>(1-u)**3*e+3*(1-u)**2*u*t+3*(1-u)*u*u*n+u**3*l;return[e,l,...i.filter(u=>u>0&&u<1).map(r)]}function Xi(e){const t=[],n=[];for(const{nodes:l,closed:s}of e.flatMap(o=>o.subpaths))l.forEach((o,a)=>{t.push(o.x),n.push(o.y);const i=l[a+1]??(s?l[0]:void 0);if(!i||!o.out&&!i.in)return;const r=o.out??o,u=i.in??i;t.push(...jd(o.x,r.x,u.x,i.x)),n.push(...jd(o.y,r.y,u.y,i.y))});return t.length===0?{left:0,top:0,right:1,bottom:1}:{left:Math.min(...t),top:Math.min(...n),right:Math.max(...t),bottom:Math.max(...n)}}function Kd(e,t){return e.map((n,l)=>{const s=e[l-1]??(t?e.at(-1):void 0),o=e[l+1]??(t?e[0]:void 0);if(!s||!o)return{...n,in:null,out:null};const a=(o.x-s.x)/6,i=(o.y-s.y)/6;return{...n,in:{x:n.x-a,y:n.y-i},out:{x:n.x+a,y:n.y+i}}})}function Ao(e){const t=tt(e);if(t===null||t.w<=0||t.h<=0)return null;const n=Ac(e);if(n)return Rd(n,t.w,t.h);const l=so(e),s=l===null?null:M0(l,{w:t.w,h:t.h},pi(e));return s?Rd(s,t.w,t.h):null}const Eo=1,rx={name:"freeform",addCommands:()=>({addFreeform:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(l===null||e.points.length<2)return!1;const s=e.smooth?Kd(e.points,e.closed):e.points.map(u=>({...u,in:null,out:null})),o=[{fill:e.closed?"norm":"none",stroke:!0,subpaths:[{nodes:s,closed:e.closed}]}],a=Xi(o),i=Math.max(Eo,Math.round(a.right-a.left)),r=Math.max(Eo,Math.round(a.bottom-a.top));if(n){const u=zn(l,{preset:"rect",x:j(Math.round(a.left)),y:j(Math.round(a.top)),w:j(i),h:j(r)});fn(u,`Freeform ${Fe(u)}`),yo(u,To),go(u,{paths:Qi(o,a,{width:i,height:r})}),e.closed||yl(u),at(u,""),wl(u,"center"),Nn(u,"center")}return!0},setShapePaths:e=>({presentation:t,dispatch:n})=>{const l=Xe(t,e.slide,e.shape);if(l===null||st(l.shape)!=="text"||Ao(l.shape)===null)return!1;if(!n)return!0;const s=Xi(e.paths),o=Ln(l.shape),a={left:o?.horizontal?1-s.right:s.left,right:o?.horizontal?1-s.left:s.right,top:o?.vertical?1-s.bottom:s.top,bottom:o?.vertical?1-s.top:s.bottom},{frame:i}=l,r=Math.max(Eo,(a.right-a.left)*i.width),u=Math.max(Eo,(a.bottom-a.top)*i.height),c={x:i.x+(a.left+a.right)/2*i.width,y:i.y+(a.top+a.bottom)/2*i.height},d=qa(c.x,c.y,i.x+i.width/2,i.y+i.height/2,i.rotation);return sn(l,{x:d.x-r/2,y:d.y-u/2,width:r,height:u}),go(l.shape,{paths:Qi(e.paths,s,{width:Math.round(r),height:Math.round(u)})}),!0}})};function De(e,t,n){const l=le(e,t,n);return l&&po(l)?l:null}function Ue(e){try{return e(),!0}catch{return!1}}function Pe(e,t,n){return ml(e)[t]?.[n]??null}const ux="http://schemas.openxmlformats.org/drawingml/2006/main",Wd=new Set(["noFill","solidFill","gradFill","blipFill","pattFill","grpFill"]);function Zi(e,t={},n=[]){return{kind:"element",name:{prefix:"a",localName:e,namespaceURI:ux},prefixDecls:new Map,children:n,attrs:Object.entries(t).map(([l,s])=>({name:{prefix:"",localName:l,namespaceURI:""},value:s}))}}const qt=(e,t)=>e?.children.find(n=>n.kind==="element"&&n.name.localName===t);function cx(e){is(e,Mi(e));for(const t of Object.getOwnPropertySymbols(e)){const n=e[t];if(n&&typeof n=="object"&&n.kind==="element"&&n.name?.localName==="graphicFrame")return qt(qt(qt(qt(n,"graphic"),"graphicData"),"tbl"),"tblPr")}}function dx(e){for(const t of Object.getOwnPropertySymbols(e)){const n=e[t];if(!n||typeof n!="object"||n.kind!=="element"||n.name?.localName!=="graphicFrame")continue;const l=qt(qt(qt(qt(n,"graphic"),"graphicData"),"tbl"),"tblPr")?.children.find(o=>o.kind==="element"&&Wd.has(o.name.localName));if(!l)return null;if(l.name.localName==="noFill")return"none";const s=l.name.localName==="solidFill"?qt(l,"srgbClr")?.attrs.find(o=>o.name.localName==="val")?.value:void 0;return s?`#${s.toUpperCase()}`:"other"}return null}function px(){return{setTableBackground:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);return!l||e.color!==null&&e.color!=="none"&&!/^#[\da-f]{6}$/iu.test(e.color)?!1:n?Ue(()=>{const s=cx(l);if(!s)throw new Error("The table keeps no tblPr element.");s.children=s.children.filter(o=>!(o.kind==="element"&&Wd.has(o.name.localName))),e.color==="none"?s.children.unshift(Zi("noFill")):e.color!==null&&s.children.unshift(Zi("solidFill",{},[Zi("srgbClr",{val:e.color.slice(1).toUpperCase()})])),is(l,Mi(l))}):!0}}}function vn(e){const{rows:t,cols:n}=Ze(e),l=[];for(let s=0;s<t;s++)for(let o=0;o<n;o++){const a=Pe(e,s,o),i=a?fl(a):null;!i||i.hMerge||i.vMerge||i.gridSpan<=1&&i.rowSpan<=1||l.push({row:s,column:o,rows:Math.min(i.rowSpan,t-s),columns:Math.min(i.gridSpan,n-o)})}return l}function Fo(e,t){return e.row<t.row+t.rows&&t.row<e.row+e.rows&&e.column<t.column+t.columns&&t.column<e.column+e.columns}function gn(e,t){const{rows:n,cols:l}=Ze(e);let s=Math.max(0,t.row),o=Math.max(0,t.column),a=Math.min(n,t.row+t.rows),i=Math.min(l,t.column+t.columns);if(s>=a||o>=i)return null;const r=vn(e);for(let u=!0;u;){u=!1;for(const c of r){if(!Fo(c,{row:s,column:o,rows:a-s,columns:i-o}))continue;const d=[Math.min(s,c.row),Math.min(o,c.column),Math.max(a,c.row+c.rows),Math.max(i,c.column+c.columns)];(d[0]!==s||d[1]!==o||d[2]!==a||d[3]!==i)&&([s,o,a,i]=d,u=!0)}}return{row:s,column:o,rows:a-s,columns:i-o}}function qd(e,t,n,l){const[s,o]=t==="row"?[e.row,e.rows]:[e.column,e.columns],a=s>=n?[s+l,o]:n<s+o?[s,o+l]:[s,o];return t==="row"?{...e,row:a[0],rows:a[1]}:{...e,column:a[0],columns:a[1]}}function _d(e,t,n,l){const[s,o]=t==="row"?[e.row,e.rows]:[e.column,e.columns],a=Math.max(0,Math.min(s+o,n+l)-Math.max(s,n));if(a===o)return null;const i=s<n?s:Math.max(n,s-l);return t==="row"?{...e,row:i,rows:o-a}:{...e,column:i,columns:o-a}}function _t(e,t,n){const l=vn(e);for(const s of l)c1(as(e,s.row,s.column));t();for(const s of n(l))s&&s.rows*s.columns>1&&fo(e,{row:s.row,col:s.column,rowSpan:s.rows,colSpan:s.columns},{coveredText:"keep"})}function Gt(e){const t=tt(e);t&&(Gd(Bn(e),t.w,(n,l)=>Co(e,n,j(l))),Gd(On(e),t.h,(n,l)=>hn(e,n,j(l))))}function Gd(e,t,n){const l=e.reduce((o,a)=>o+a,0);if(l<=0||l===t)return;let s=0;e.forEach((o,a)=>{const i=a===e.length-1?t-s:Math.round(o*t/l);s+=i,n(a,Math.max(1,i))})}function bn(e){const t=tt(e);if(!t)return;const n=Bn(e).reduce((s,o)=>s+o,0),l=On(e).reduce((s,o)=>s+o,0);bl(e,{x:t.x,y:t.y,w:j(n),h:j(l)})}function Yi(e,t){const n=[];for(let l=t.row;l<t.row+t.rows;l++)for(let s=t.column;s<t.column+t.columns;s++){const o=Pe(e,l,s),a=o?fl(o):null;a&&!a.hMerge&&!a.vMerge&&n.push({row:l,column:s,rows:Math.max(1,a.rowSpan),columns:Math.max(1,a.gridSpan)})}return n}function Ji(e){const t=tt(e),n=On(e),l=Bn(e),s=(o,a)=>{const i=o.reduce((r,u)=>r+u,0);return a===void 0||i<=0?[...o]:o.map(r=>r*a/i)};return{rows:s(n,t?.h),columns:s(l,t?.w)}}function fx(e){const t=e.trim().replaceAll(/[,\s,]/gu,"");if(t==="")return null;const n=t.endsWith("%"),l=Number(n?t.slice(0,-1):t);return Number.isFinite(l)?n?l/100:l:null}function mx(e,t){return t==="sum"?e.reduce((n,l)=>n+l,0):t==="average"?e.reduce((n,l)=>n+l,0)/e.length:t==="max"?Math.max(...e):Math.min(...e)}function hx(e){return String(Math.round(e*100)/100)}function Hd(e,t,n){const l=Pe(e,t,n),s=l?fl(l):null;return!l||!s||s.hMerge||s.vMerge?null:fx(cn(l))}function vx(){return{calculateTableCells:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);if(!l||!["sum","average","max","min"].includes(e.op))return!1;const{rows:s,cols:o}=Ze(l),{row:a,column:i}=e.range,r=Math.min(e.range.rows,s-a),u=Math.min(e.range.columns,o-i);if(r<1||u<1)return!1;const c=r===1&&u>1,d=Array.from({length:c?r:u},(p,f)=>({index:f,values:Array.from({length:c?u:r},(h,v)=>c?Hd(l,a+f,i+v):Hd(l,a+v,i+f)).filter(h=>h!==null)})).filter(p=>p.values.length>0);return d.length===0?!1:n?Ue(()=>{Gt(l);const p=c?i+u:a+r;c&&p>=o&&Pi(l,p,Bn(l)[o-1]),!c&&p>=s&&(Ti(l,p),hn(l,p,j(On(l)[s-1])));for(const f of d){const h=c?Pe(l,a+f.index,p):Pe(l,p,i+f.index);h&&Kt(h,hx(mx(f.values,e.op)),{preserveFormatting:!0})}bn(l)}):!0}}}const gx={left:"lnL",right:"lnR",top:"lnT",bottom:"lnB"};function er(e){for(const t of Object.getOwnPropertySymbols(e)){const n=e[t];if(n&&typeof n=="object"&&n.kind==="element"&&n.name?.localName==="tc")return n}}function us(e,t){return e?.children.find(n=>n.kind==="element"&&n.name.localName===t)}function Qd(e){const t=e?.children.findIndex(l=>l.kind==="element"&&l.name.localName==="solidFill")??-1;if(!e||t<0)return!1;const n=e.children[t];return e.children[t]={...n,name:{...n.name,localName:"noFill"},children:[]},!0}function Xd(e){mn(e,{})}function Zd(e){$o(e,"#000000"),Qd(us(er(e),"tcPr"))&&Xd(e)}function tr(e,t){if(t.length===0)return;mn(e,Object.fromEntries(t.map(s=>[s,{color:"#000000",widthEmu:12700}])));const n=us(er(e),"tcPr");let l=!1;for(const s of t)l=Qd(us(n,gx[s]))||l;l&&Xd(e)}function Yd(e){return us(us(er(e),"tcPr"),"noFill")!==void 0}const bx=12700,nr=e=>({color:e.color,widthEmu:Math.round(e.width*bx),dash:e.dash&&e.dash!=="solid"?e.dash:null}),yx={top:"bottom",bottom:"top",left:"right",right:"left"};function xx(e,t,n){switch(e){case"all":case"none":return!0;case"diagonalDown":case"diagonalUp":return!1;case"outside":return n;case"inside":return!n;case"insideHorizontal":return!n&&(t==="top"||t==="bottom");case"insideVertical":return!n&&(t==="left"||t==="right");default:return n&&t===e}}function wx(e,t,n,l){const s=nr(l);for(const o of Yi(e,t)){const a=Pe(e,o.row,o.column);a&&mn(a,{tlToBr:n.down?s:null,blToTr:n.up?s:null})}}function kx(e,t,n,l){const s=new Map,o=(d,p,f)=>{const h=`${d},${p}`,v=s.get(h)??{row:d,column:p,sides:new Set};v.sides.add(f),s.set(h,v)},{rows:a,cols:i}=Ze(e),r=vn(e),u=(d,p)=>r.find(f=>d>=f.row&&d<f.row+f.rows&&p>=f.column&&p<f.column+f.columns)??{row:d,column:p,rows:1,columns:1};for(const d of Yi(e,t)){const p={top:d.row===t.row,bottom:d.row+d.rows===t.row+t.rows,left:d.column===t.column,right:d.column+d.columns===t.column+t.columns};for(const f of["top","bottom","left","right"]){if(!xx(n,f,p[f])||(o(d.row,d.column,f),!p[f]))continue;const[h,v]=f==="top"?[d.row-1,d.column]:f==="bottom"?[d.row+d.rows,d.column]:f==="left"?[d.row,d.column-1]:[d.row,d.column+d.columns];if(h<0||v<0||h>=a||v>=i)continue;const g=u(h,v);(f==="top"||f==="bottom"?g.column>=t.column&&g.column+g.columns<=t.column+t.columns:g.row>=t.row&&g.row+g.rows<=t.row+t.rows)&&o(g.row,g.column,yx[f])}}const c=nr(l);if(n==="diagonalDown"||n==="diagonalUp"){for(const d of Yi(e,t))mn(Pe(e,d.row,d.column),{[n==="diagonalDown"?"tlToBr":"blToTr"]:c});return}for(const{row:d,column:p,sides:f}of s.values()){const h=Pe(e,d,p);h&&(n==="none"?(tr(h,[...f]),mn(h,{tlToBr:null,blToTr:null})):mn(h,Object.fromEntries([...f].map(v=>[v,c]))))}}function cs(e,t,n){return e.find(l=>t>=l.row&&t<l.row+l.rows&&n>=l.column&&n<l.column+l.columns)??{row:t,column:n,rows:1,columns:1}}function lr(e,t){const{rows:n,cols:l}=Ze(e),s=vn(e),o=t.axis==="row",[a,i]=o?[n,l]:[l,n];if(t.line<0||t.line>a||t.index<0||t.index>=i)return[];const r=t.line>0?o?cs(s,t.line-1,t.index):cs(s,t.index,t.line-1):null,u=t.line<a?o?cs(s,t.line,t.index):cs(s,t.index,t.line):null;return r&&u&&r.row===u.row&&r.column===u.column?[]:[...r?[{row:r.row,column:r.column,side:o?"bottom":"right"}]:[],...u?[{row:u.row,column:u.column,side:o?"top":"left"}]:[]]}function $x(e,t){const n=lr(e,t);if(n.length===2){const l=vn(e),[s,o]=n.map(a=>cs(l,a.row,a.column));if(t.axis==="row"?s.column===o.column&&s.columns===o.columns:s.row===o.row&&s.rows===o.rows){const a={row:s.row,column:s.column,rows:t.axis==="row"?s.rows+o.rows:s.rows,columns:t.axis==="column"?s.columns+o.columns:s.columns},i=r=>r.row>=a.row&&r.column>=a.column&&r.row+r.rows<=a.row+a.rows&&r.column+r.columns<=a.column+a.columns;_t(e,()=>{},r=>r.filter(u=>!i(u))),fo(e,{row:a.row,col:a.column,rowSpan:a.rows,colSpan:a.columns},{coveredText:"append"});return}}for(const{row:l,column:s,side:o}of n){const a=Pe(e,l,s);a&&tr(a,[o])}}function Sx(){return{eraseTableEdges:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);return!l||!e.edges.some(s=>lr(l,s).length>0)?!1:!n||Ue(()=>{for(const s of e.edges)$x(l,s)})},setTableEdges:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);if(!l||e.pen&&!/^#[\da-f]{6}$/iu.test(e.pen.color))return!1;const s=e.edges.flatMap(a=>lr(l,a));if(s.length===0)return!1;if(!n)return!0;const o=e.pen;return Ue(()=>{for(const{row:a,column:i,side:r}of s){const u=Pe(l,a,i);u&&(o?mn(u,{[r]:nr(o)}):tr(u,[r]))}})}}}const Cx=["solid","dot","dash","lgDash","dashDot","sysDash","sysDot"];function kl(e,t){const n=[];for(let l=t.row;l<t.row+t.rows;l++)for(let s=t.column;s<t.column+t.columns;s++){const o=Pe(e,l,s);o&&n.push(o)}return n}function Wn(e,t,n){return({presentation:l,dispatch:s})=>{const o=De(l,e.slide,e.shape),a=o?gn(o,e.range):null;return!o||!a||!t?!1:!s||Ue(()=>n(o,a))}}const Jd=e=>/^#[\da-f]{6}$/iu.test(e),ep=e=>Jd(e.color)&&Number.isFinite(e.width)&&e.width>0&&e.width<=20&&(e.dash===void 0||Cx.includes(e.dash)),Mx=e=>e===void 0||Number.isFinite(e)&&e>=0&&e<=5e6;function Px(){return{setTableCellsFill:e=>Wn(e,e.color===null||e.color==="none"||Jd(e.color),(t,n)=>{for(const l of kl(t,n))e.color===null?$c(l):e.color==="none"?Zd(l):$o(l,e.color)}),setTableCellsBorders:e=>{const t=e.pen??{color:"#000000",width:1};return Wn(e,ep(t),(n,l)=>kx(n,l,e.preset,t))},setTableCellsDiagonals:e=>{const t=e.pen??{color:"#000000",width:1};return Wn(e,ep(t),(n,l)=>wx(n,l,e,t))},setTableCellsAlignment:e=>Wn(e,["left","center","right","justify"].includes(e.align),(t,n)=>{for(const l of kl(t,n))ko(l,e.align)}),setTableCellsAnchor:e=>Wn(e,["top","center","bottom"].includes(e.anchor),(t,n)=>{for(const l of kl(t,n))xd(l,e.anchor)}),setTableCellsMargins:e=>{const{left:t,right:n,top:l,bottom:s}=e.margins;return Wn(e,[t,n,l,s].some(o=>o!==void 0)&&[t,n,l,s].every(Mx),(o,a)=>{for(const i of kl(o,a))wd(i,e.margins)})},clearTableCellsFormat:e=>Wn(e,!0,(t,n)=>{for(const l of kl(t,n))$c(l),mn(l,null)}),clearTableCells:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape),s=l?gn(l,e.range):null,o=l&&s?kl(l,s).filter(a=>cn(a)!==""):[];return o.length===0?!1:!n||Ue(()=>{for(const a of o)Kt(a,"",{preserveFormatting:!0})})}}}const tp=12700,Tx=1.2,sr=18,Ax=e=>/[⺀-鿿가-豈--]/u.test(e)?1:.55;function Ex(e,t,n){if(Hc(t)!==null)return 0;const l=Si(t),s=Math.max(1,n-(l.left??91440)-(l.right??91440));let o=(l.top??45720)+(l.bottom??45720);return Gc(t).forEach((a,i)=>{let r=sr;try{r=Ci(e,t,i,a.elements.length>0?0:null).size??sr}catch{r=sr}for(const d of a.elements)"format"in d&&typeof d.format?.size=="number"&&(r=Math.max(r,d.format.size));const u=[""];for(const d of a.elements)d.kind==="br"?u.push(""):"text"in d&&(u[u.length-1]+=d.text);const c=u.reduce((d,p)=>d+Math.max(1,Math.ceil([...p].reduce((f,h)=>f+Ax(h),0)*r*tp/s)),0);o+=c*r*Tx*tp}),o}function qn(e,t,n){Gt(t);const{rows:l,cols:s}=Ze(t),o=Ji(t);let a=!1;for(const i of n??Array.from({length:l},(r,u)=>u)){if(i<0||i>=l)continue;let r=0;for(let u=0;u<s;u++){const c=Pe(t,i,u),d=c?fl(c):null;if(!c||!d||d.hMerge||d.vMerge||d.rowSpan>1)continue;const p=o.columns.slice(u,u+Math.max(1,d.gridSpan)).reduce((f,h)=>f+h,0);r=Math.max(r,Ex(e,c,p))}r>o.rows[i]+1&&(hn(t,i,j(Math.ceil(r))),a=!0)}a&&bn(t)}const Fx="{5940675A-B579-460E-94D1-54222C63F5DA}";function np(e){return Number.isInteger(e.rows)&&Number.isInteger(e.columns)&&e.rows>=1&&e.columns>=1&&e.rows*e.columns<=1e4&&e.cells.every(t=>t.row>=0&&t.column>=0&&t.rows>=1&&t.columns>=1&&t.row+t.rows<=e.rows&&t.column+t.columns<=e.columns&&(t.fill===void 0||/^#[\da-f]{6}$/iu.test(t.fill)))}function lp(e,t,n,l){const{rows:s,cols:o}=Ze(e);for(const a of t.cells){const i=n+a.row,r=l+a.column;if(i>=s||r>=o)continue;const u=Math.min(a.rows,s-i),c=Math.min(a.columns,o-r);if(u*c>1){for(let p=i;p<i+u;p+=1)for(let f=r;f<r+c;f+=1){const h=p===i&&f===r?null:Pe(e,p,f);h&&Kt(h,"")}fo(e,{row:i,col:r,rowSpan:u,colSpan:c},{coveredText:"keep"})}const d=Pe(e,i,r);if(d){if(Kt(d,a.text),a.fill&&$o(d,a.fill),a.format){const p=Kn(a.format);Object.keys(p).length>0&&So(d,p)}a.align&&ko(d,a.align)}}}function sp(e,t,n){const l=e&&e.length===n&&e.every(o=>o>0)?e:Array.from({length:n},()=>1),s=l.reduce((o,a)=>o+a,0);return l.map(o=>Math.max(1,Math.round(o/s*t)))}function zx(){return{addPastedTable:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(!l||!np(e.table)||!(e.width>0)||!(e.height>0))return!1;if(!n)return!0;const s=Array.from({length:e.table.rows},()=>Array.from({length:e.table.columns},()=>""));return Ue(()=>{const o=oi(l,{x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height),rows:s});Mo(o,Fx),is(o,{firstRow:!1,firstCol:!1,lastRow:!1,lastCol:!1,bandRow:!1,bandCol:!1}),sp(e.table.columnWidths,e.width,e.table.columns).forEach((a,i)=>Co(o,i,j(a))),sp(e.table.rowHeights,e.height,e.table.rows).forEach((a,i)=>hn(o,i,j(a))),lp(o,e.table,0,0),qn(t,o)})},pasteTableCells:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);if(!l||!np(e.table))return!1;const{rows:s,cols:o}=Ze(l);return e.row<0||e.column<0||e.row>=s||e.column>=o?!1:n?Ue(()=>{lp(l,e.table,e.row,e.column),qn(t,l)}):!0}}}const Dx=36e3,op={axis:"rows",read:On,write:(e,t,n)=>hn(e,t,j(n))},ap={axis:"columns",read:Bn,write:(e,t,n)=>Co(e,t,j(n))};function zo(e,t,n){return({presentation:l,dispatch:s})=>{const o=De(l,e.slide,e.shape),a=o?t.read(o).length:0;if(!o||!Number.isInteger(e.count)||e.count<1||e.start<0||e.start+e.count>a)return!1;const i=Ji(o)[t.axis].slice(e.start,e.start+e.count),r=n(i);return r===null||r.every((u,c)=>Math.abs(u-i[c])<1)?!1:s?Ue(()=>{Gt(o),r.forEach((u,c)=>t.write(o,e.start+c,u)),bn(o)}):!0}}function ip(e,t){const n=Math.floor(t/e);return Array.from({length:e},(l,s)=>s===e-1?t-n*(e-1):n)}const Do=e=>Number.isFinite(e)&&e>=Dx&&e<=51206400;function Lx(){return{setTableRowHeight:e=>zo({...e,start:e.row},op,t=>Do(e.height)?t.map(()=>Math.round(e.height)):null),setTableColumnWidth:e=>zo({...e,start:e.column},ap,t=>Do(e.width)?t.map(()=>Math.round(e.width)):null),distributeTableRows:e=>zo({...e,start:e.row},op,t=>t.length<2?null:ip(t.length,Math.round(t.reduce((n,l)=>n+l,0)))),distributeTableColumns:e=>zo({...e,start:e.column},ap,t=>t.length<2?null:ip(t.length,Math.round(t.reduce((n,l)=>n+l,0)))),setTableFrame:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);return!l||![e.x,e.y].every(Number.isFinite)||!Do(e.width)||!Do(e.height)?!1:n?Ue(()=>{bl(l,{x:j(Math.round(e.x)),y:j(Math.round(e.y)),w:j(Math.round(e.width)),h:j(Math.round(e.height))}),Gt(l)}):!0}}}const Vx=20;function Ix(e,t,n,l){const s=gn(t,n.range);if(!s)return!1;const o=vn(t).filter(u=>Fo(u,s));if(o.length===1&&(n.rows!==void 0||n.columns!==void 0)){const u=o[0],c={rows:n.rows??u.rows,columns:n.columns??u.columns},d=(h,v)=>Number.isInteger(h)&&h>=1&&v%h===0;if(!d(c.rows,u.rows)||!d(c.columns,u.columns)||c.rows*c.columns<2)return!1;const p={rows:u.rows/c.rows,columns:u.columns/c.columns},f=Array.from({length:c.rows*c.columns},(h,v)=>({row:u.row+Math.floor(v/c.columns)*p.rows,column:u.column+v%c.columns*p.columns,...p}));return!l||Ue(()=>_t(t,()=>{},h=>[...h.filter(v=>!Fo(v,u)),...f]))}if(o.length>0)return!l||Ue(()=>_t(t,()=>{},u=>u.filter(c=>!Fo(c,s))));const a=n.rows??1,i=n.columns??2,r=u=>Number.isInteger(u)&&u>=1&&u<=Vx;return s.rows!==1||s.columns!==1||!r(a)||!r(i)||a*i<2?!1:l?Ue(()=>{Bx(t,s.row,s.column,a,i),qn(e,t,Array.from({length:a},(u,c)=>s.row+c))}):!0}function Bx(e,t,n,l,s){Gt(e);const o=Bn(e)[n],a=On(e)[t];_t(e,()=>{for(let i=1;i<s;i++)Pi(e,n+i,Math.floor(o/s));Co(e,n,j(o-Math.floor(o/s)*(s-1)));for(let i=1;i<l;i++)Ti(e,t+i),hn(e,t+i,j(Math.floor(a/l)));hn(e,t,j(a-Math.floor(a/l)*(l-1)))},i=>{const{rows:r,cols:u}=Ze(e);let c=i.map(d=>rp(d,"column",n,s-1));for(let d=0;d<r-(l-1);d++)d!==t&&!c.some(p=>up(p,d,n))&&c.push({row:d,column:n,rows:1,columns:s});c=c.map(d=>rp(d,"row",t,l-1));for(let d=0;d<u;d++)(d<n||d>=n+s)&&!c.some(p=>up(p,t,d))&&c.push({row:t,column:d,rows:l,columns:1});return c}),bn(e)}function rp(e,t,n,l){const[s,o]=t==="row"?[e.row,e.rows]:[e.column,e.columns],a=s>n?[s+l,o]:s+o>n?[s,o+l]:[s,o];return t==="row"?{...e,row:a[0],rows:a[1]}:{...e,column:a[0],columns:a[1]}}function up(e,t,n){return t>=e.row&&t<e.row+e.rows&&n>=e.column&&n<e.column+e.columns}function cp(e,t){const n=[];for(let l=t.row;l<t.row+t.rows;l++)for(let s=t.column;s<t.column+t.columns;s++){const o=Pe(e,l,s),a=o?fl(o):null;a&&!a.hMerge&&!a.vMerge&&n.push({row:l,column:s})}return n}function dp(e){const t=[];let n=[],l="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];s?a==='"'&&e[o+1]==='"'?(l+='"',o++):a==='"'?s=!1:l+=a:a==='"'&&l===""?s=!0:a===" "?(n.push(l),l=""):a===`
|
|
2
|
+
`||a==="\r"?(a==="\r"&&e[o+1]===`
|
|
3
|
+
`&&o++,n.push(l),t.push(n),n=[],l=""):l+=a}return(l!==""||n.length>0)&&(n.push(l),t.push(n)),t}function Ox(e,t,n,l){const s=as(e,t,n);l.replace&&Kt(s,l.replace.tokens.map(i=>i.kind==="text"?i.text:`
|
|
4
|
+
`).join(""),{range:{start:l.replace.start,end:l.replace.end}});const o=cn(s).length;for(const{start:i,end:r,format:u}of l.formats)i<r&&r<=o&&So(s,Kn(u),{range:{start:i,end:r}});const a=[...new Set(l.aligns.filter(i=>i!==null))];a.length===1&&ko(s,a[0])}function Ux(){return{editTableCellText:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape),{rows:s,cols:o}=l?Ze(l):{rows:0,cols:0},{edit:a}=e,i=a.replace!==null||a.formats.length>0||a.aligns.some(r=>r!==null);return!l||!i||e.row<0||e.column<0||e.row>=s||e.column>=o?!1:!n||Ue(()=>{Ox(l,e.row,e.column,a),qn(t,l,[e.row])})},setTableCellsText:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);if(!l||e.texts.length===0)return!1;const{rows:s,cols:o}=Ze(l);if(e.row<0||e.column<0||e.row>=s||e.column>=o)return!1;const a=e.texts.flatMap((i,r)=>i.map((u,c)=>({row:e.row+r,column:e.column+c,text:u}))).filter(i=>i.row<s&&i.column<o).filter(i=>{const r=Pe(l,i.row,i.column),u=r?fl(r):null;return!!u&&!u.hMerge&&!u.vMerge}).filter(i=>cn(Pe(l,i.row,i.column))!==i.text);return a.length===0?!1:!n||Ue(()=>{for(const i of a)Kt(Pe(l,i.row,i.column),i.text,{preserveFormatting:!0});qn(t,l,[...new Set(a.map(i=>i.row))])})},setTableCellsTextFormat:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape),s=l?gn(l,e.range):null,o=Kn(e.format);return!l||!s||Object.keys(o).length===0||e.format.size!==void 0&&!(e.format.size>=1&&e.format.size<=400)?!1:!n||Ue(()=>{for(const{row:a,column:i}of cp(l,s))So(Pe(l,a,i),o);qn(t,l,Array.from({length:s.rows},(a,i)=>s.row+i))})},setTableCellsTextDirection:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape),s=l?gn(l,e.range):null;return!l||!s||!["horz","eaVert","vert","vert270"].includes(e.direction)?!1:!n||Ue(()=>{for(const{row:o,column:a}of cp(l,s))u1(Pe(l,o,a),e.direction==="horz"?null:e.direction)})}}}function pp(e,t){if(!e||!t)return;const n=_c(e);n?$o(t,n):Yd(e)&&Zd(t);const l=Kc(e);l&&ko(t,l);const s=Wc(e);s&&xd(t,s);const o=Si(e);Object.values(o).some(a=>a!==null)&&wd(t,o)}const Lo=e=>Number.isInteger(e)&&e>=1,Nx={name:"tableStructure",addCommands:()=>({insertTableRows:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);if(!l||!Lo(e.count)||e.row<0||e.row>=Ze(l).rows)return!1;if(!n)return!0;const s=e.side==="above"?e.row:e.row+1;return Ue(()=>{Gt(l);const o=On(l)[e.row],a=e.side==="above"?e.row+e.count:e.row;_t(l,()=>{for(let r=0;r<e.count;r++)Ti(l,s+r),hn(l,s+r,j(o))},r=>r.map(u=>qd(u,"row",s,e.count)));const{cols:i}=Ze(l);for(let r=0;r<e.count;r++)for(let u=0;u<i;u++)pp(Pe(l,a,u),Pe(l,s+r,u));bn(l)})},insertTableColumns:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);if(!l||!Lo(e.count)||e.column<0||e.column>=Ze(l).cols)return!1;if(!n)return!0;const s=e.side==="left"?e.column:e.column+1;return Ue(()=>{Gt(l);const o=Bn(l)[e.column],a=e.side==="left"?e.column+e.count:e.column;_t(l,()=>{for(let r=0;r<e.count;r++)Pi(l,s+r,o)},r=>r.map(u=>qd(u,"column",s,e.count)));const{rows:i}=Ze(l);for(let r=0;r<e.count;r++)for(let u=0;u<i;u++)pp(Pe(l,u,a),Pe(l,u,s+r));bn(l)})},deleteTableRows:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape),s=l?Ze(l).rows:0;return!l||!Lo(e.count)||e.row<0||e.row+e.count>s||e.count>=s?!1:n?Ue(()=>{Gt(l),_t(l,()=>{for(let o=0;o<e.count;o++)uy(l,e.row)},o=>o.map(a=>_d(a,"row",e.row,e.count))),bn(l)}):!0},deleteTableColumns:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape),s=l?Ze(l).cols:0;return!l||!Lo(e.count)||e.column<0||e.column+e.count>s||e.count>=s?!1:n?Ue(()=>{Gt(l),_t(l,()=>{for(let o=0;o<e.count;o++)ry(l,e.column)},o=>o.map(a=>_d(a,"column",e.column,e.count))),bn(l)}):!0},mergeTableCells:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape),s=l?gn(l,e.range):null;return!l||!s||s.rows*s.columns<2||vn(l).some(o=>o.row===s.row&&o.column===s.column&&o.rows===s.rows&&o.columns===s.columns)?!1:n?Ue(()=>{_t(l,()=>{},o=>o.filter(a=>!Rx(a,s))),fo(l,{row:s.row,col:s.column,rowSpan:s.rows,colSpan:s.columns},{coveredText:"append"}),s.rows===1&&qn(t,l,[s.row])}):!0},splitTableCells:e=>({presentation:t,dispatch:n})=>{const l=De(t,e.slide,e.shape);return l!==null&&Ix(t,l,e,n)},...Px(),...Lx(),...Ux(),...vx(),...Sx(),...px(),...zx()})};function Rx(e,t){return e.row>=t.row&&e.column>=t.column&&e.row+e.rows<=t.row+t.rows&&e.column+e.columns<=t.column+t.columns}const jx="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";function or(e,t,n){const l=le(e,t,n);return!l||!po(l)?null:{style:ty(l),options:Mi(l)}}const Kx={name:"tableStyle",addCommands:()=>({setTableStyle:ge({description:"Applies a built-in table style by name; its colours follow the theme. Tables drawn with drawSlide already follow the deck's design language, so restyle them only when the user asks for a built-in style. Medium Style 2 - Accent N gives a coloured header row and banded rows in accent N; Light Style 1 - Accent N is lighter; Themed Style 1 - Accent N fills every cell.",params:{type:"object",properties:{style:{type:"string",minLength:1,description:'Style name, such as "Medium Style 2 - Accent 1".'}},required:["style"],additionalProperties:!1},target:"shape",kinds:["table"],category:"tables",adapt:(e,t)=>{const n=e.style.trim().toLowerCase(),l=ni.find(s=>s.name.toLowerCase()===n);return t.slide===null||t.shape===null||!l?null:{slide:t.slide,shape:t.shape,style:l.id}},run:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);return!l||!po(l)||!ni.some(s=>s.id===e.style)?!1:(n&&Mo(l,e.style),!0)}}),setTableStyleOptions:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);return!l||!po(l)||Object.keys(e.options).length===0?!1:(n&&is(l,e.options),!0)}})},Vo={left:91440,right:91440,top:45720,bottom:45720},Wx={l:"left",ctr:"center",r:"right",just:"justify",dist:"justify"};function fp(e){const t=[0];for(const n of e)t.push(t.at(-1)+n);return t}function ar(e,t,n,l){const s=De(e,t,n);if(!s)return null;try{const{rows:o,cols:a}=Ze(s),i=gn(s,l??{row:0,column:0,rows:o,columns:a})??{row:0,column:0,rows:o,columns:a},r=Pe(s,i.row,i.column)??Pe(s,0,0);if(!r)return null;const u=Si(r),c=Ji(s);return{rows:o,columns:a,merges:vn(s),rowEdges:fp(c.rows),columnEdges:fp(c.columns),fill:_c(r)??(Yd(r)?"none":null),align:Wx[Kc(r)??"l"]??"left",anchor:Wc(r)??"top",background:dx(s),regular:ml(s).every(d=>d.length===a),direction:qx(r),text:_x(e,r),diagonals:{down:qc(e,r).tlToBr!==null,up:qc(e,r).blToTr!==null},margins:{left:u.left??Vo.left,right:u.right??Vo.right,top:u.top??Vo.top,bottom:u.bottom??Vo.bottom}}}catch{return null}}function qx(e){const t=Hc(e);return t==="eaVert"||t==="vert"||t==="vert270"?t:"horz"}function _x(e,t){let n;try{n=Ci(e,t,0,0)}catch{try{n=Ci(e,t,0,null)}catch{n=void 0}}const l=typeof n?.color=="string"&&/^#?[\da-f]{6}$/iu.test(n.color)?`#${n.color.replace("#","").toUpperCase()}`:null,s=[n?.fontEastAsian,n?.font].find(i=>typeof i=="string"&&!i.startsWith("+"))??null,o=n?.underline!==void 0&&n.underline!==!1&&n.underline!=="none",a=n?.strike!==void 0&&n.strike!==!1&&n.strike!=="noStrike";return{size:n?.size??null,font:s??null,bold:n?.bold===!0,italic:n?.italic===!0,underline:o,strike:a,color:l}}const Gx={name:"data",addCommands:()=>({addTable:ge({description:"Adds a table to the target slide with the given cell texts, the first row as its header, at a position and size in centimetres.",params:{type:"object",properties:{rows:{type:"array",minItems:1,items:{type:"array",minItems:1,items:{type:"string"}},description:"Cell texts row by row; every row has the same number of cells."},x:{type:"number",description:"Left edge in cm."},y:{type:"number",description:"Top edge in cm."},width:{type:"number",exclusiveMinimum:0,description:"Width in cm."},height:{type:"number",exclusiveMinimum:0,description:"Height in cm."}},required:["rows","x","y","width","height"],additionalProperties:!1},target:"slide",category:"tables",adapt:(e,t)=>{if(t.slide===null)return null;const{rows:n,x:l,y:s,width:o,height:a}=e;return{slide:t.slide,rows:n,x:be(l),y:be(s),width:be(o),height:be(a)}},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=e.rows[0]?.length??0;return l===null||s===0||e.rows.some(o=>o.length!==s)||e.width<=0||e.height<=0?!1:(n&&Mo(oi(l,{x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height),rows:e.rows,firstRow:!0,bandRow:!0}),jx),!0)}}),addPicture:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l===null||e.bytes.length===0||e.width<=0||e.height<=0?!1:(n&&Zs(l,e.bytes,{x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height),...e.name===void 0?{}:{name:e.name}}),!0)},setTableCellText:ge({description:"Replaces the text of one cell of the target table, keeping the cell's formatting. Rows and columns count from 1 as the view shows them.",params:{type:"object",properties:{row:{type:"integer",minimum:1,description:"Row, from 1."},column:{type:"integer",minimum:1,description:"Column, from 1."},text:{type:"string",description:"New cell text; each line is one paragraph."}},required:["row","column","text"],additionalProperties:!1},target:"shape",kinds:["table"],ordinals:["row","column"],category:"tables",adapt:(e,t)=>{if(t.slide===null||t.shape===null)return null;const{row:n,column:l,text:s}=e;return{slide:t.slide,shape:t.shape,row:n,column:l,text:s}},run:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);if(l===null)return!1;let s;try{s=ml(l)}catch{return!1}if(e.row<0||e.column<0||e.row>=s.length||e.column>=(s[e.row]?.length??0))return!1;const o=as(l,e.row,e.column);return cn(o)===e.text?!1:(n&&Kt(o,e.text,{preserveFormatting:!0}),!0)}}),setChartData:ge({description:"Replaces the categories and series values of the target chart. Keeping the same series names changes only the values and keeps the chart's formatting; the embedded workbook is updated too.",params:{type:"object",properties:{categories:{type:"array",items:{type:"string"},description:"Category labels in order."},series:{type:"array",minItems:1,items:{type:"object",properties:{name:{type:"string",description:"Series name."},values:{type:"array",items:{type:["number","null"]},description:"One value per category; null leaves a point empty."}},required:["name","values"],additionalProperties:!1}}},required:["categories","series"],additionalProperties:!1},target:"shape",kinds:["chart"],category:"charts",adapt:(e,t)=>{if(t.slide===null||t.shape===null)return null;const{categories:n,series:l}=e;return l.some(s=>s.values.length!==n.length)?null:{slide:t.slide,shape:t.shape,categories:n,series:l}},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(l===null||_l(l,e.shape)===null)return!1;const s=gi(l).find(o=>Fe(o.shape)===e.shape);return s===void 0||e.series.some(o=>o.values.length!==e.categories.length)?!1:(n&&hy(s,{categories:e.categories,series:e.series}),!0)}})})},Hx={left:"l",center:"ctr",right:"r",justify:"just"},Qx={name:"edit-text",addCommands:()=>({editShapeText:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);if(l===null)return!1;const{replace:s,formats:o,aligns:a}=e.edit,i=ze(l).length;if(s!==null&&(s.start<0||s.end>i||s.start>s.end)||s===null&&o.length===0&&a.every(u=>u===null))return!1;if(!n)return!0;s!==null&&Xx(l,s.start,s.end,s.tokens);for(const{start:u,end:c,format:d}of o)c>u&&nt(l,Kn(d),{range:{start:u,end:c}});const r=pl(l);return a.forEach((u,c)=>{u!==null&&c<r&&ci(l,c)!==Hx[u]&&Fi(l,c,u)}),!0}})};function Xx(e,t,n,l){n>t&&at(e,"",{range:{start:t,end:n},preserveFormatting:!0});let s=t;for(const o of l)if(o.kind==="text"){if(o.text.length===0)continue;at(e,o.text,{range:{start:s,end:s},preserveFormatting:!0}),s+=o.text.length}else at(e,`
|
|
5
|
+
`,{range:{start:s,end:s},preserveFormatting:!0,newlines:o.kind==="break"?"break":"paragraph"}),s+=1}const mp={min:.01,max:9999},Zx={name:"animationTiming",addCommands:()=>({setAnimationTiming:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=l&&oc(l,e.id),{repeat:o,trigger:a}=e;if(!l||!s||!Dt(l).some(r=>r.id===e.id)||typeof o=="number"&&!(o>=mp.min&&o<=mp.max))return!1;const i=Dt(l).find(r=>r.id===e.id);return typeof a=="number"&&(!_l(l,a)||i.targetShapeIds.includes(a))?!1:(n&&((o!==void 0||e.rewind!==void 0)&&eb(l,e.id,{...o===void 0?{}:{repeat:o},...e.rewind===void 0?{}:{rewind:e.rewind}}),a!==void 0&&Yg(l,e.id,a)),!0)}})},hp={basic:"基本型",subtle:"细微型",moderate:"温和型",exciting:"华丽型"},Yx={basic:[["appear","出现"],["blindsIn","百叶窗"],["shapeIn","盒状","box"],["checkerboardIn","棋盘"],["shapeIn","圆形扩展","circle"],["shapeIn","菱形","diamond"],["dissolveIn","向内溶解"],["flyIn","飞入"],["peekIn","切入"],["shapeIn","十字形扩展","plus"],["randomBarsIn","随机线条"],["splitIn","劈裂"],["stripsIn","阶梯状"],["wedgeIn","扇形展开"],["wheelIn","轮子"],["wipeIn","擦除"]],subtle:[["expandIn","展开"],["fadeIn","淡入"],["swivelIn","渐变式回旋"],["zoomIn","渐变式缩放"]],moderate:[["basicZoomIn","基本缩放"],["centerRevolveIn","中心旋转"],["floatIn","浮入"],["growTurnIn","翻转式由远及近"],["riseUpIn","升起"],["spinnerIn","回旋"],["stretchIn","伸展"]],exciting:[["basicSwivelIn","基本旋转"],["boomerangIn","飞旋"],["bounceIn","弹跳"],["creditsIn","字幕式"],["curveUpIn","曲线向上"],["dropIn","掉落"],["flipIn","翻转"],["floatingIn","浮动"],["pinwheelIn","玩具风车"],["spiralIn","螺旋飞入"],["whipIn","挥鞭式"]]},Jx={basic:[["disappear","消失"],["blindsOut","百叶窗"],["shapeOut","盒状","box"],["checkerboardOut","棋盘"],["shapeOut","圆形扩展","circle"],["shapeOut","菱形","diamond"],["dissolveOut","向外溶解"],["flyOut","飞出"],["peekOut","切出"],["shapeOut","十字形扩展","plus"],["randomBarsOut","随机线条"],["splitOut","劈裂"],["stripsOut","阶梯状"],["wedgeOut","扇形展开"],["wheelOut","轮子"],["wipeOut","擦除"]],subtle:[["contractOut","收缩"],["fadeOut","淡出"],["swivelOut","渐变式回旋"],["zoomOut","渐变式缩放"]],moderate:[["basicZoomOut","基本缩放"],["centerRevolveOut","中心旋转"],["collapseOut","层叠"],["floatOut","浮出"],["shrinkTurnOut","收缩并旋转"],["sinkDownOut","下沉"],["spinnerOut","回旋"],["stretchyOut","伸缩"]],exciting:[["basicSwivelOut","基本旋转"],["boomerangOut","飞旋"],["bounceOut","弹跳"],["creditsOut","字幕式"],["curveDownOut","曲线向下"],["dropOut","掉落"],["flipOut","翻转"],["floatingOut","浮动"],["pinwheelOut","玩具风车"],["spiralOut","螺旋飞出"],["whipOut","挥鞭式"]]},ew={basic:[["fillColor","填充颜色"],["fontColor","字体颜色"],["growShrink","放大/缩小"],["lineColor","线条颜色"],["spin","陀螺旋"],["transparency","透明"]],subtle:[["boldFlash","加粗闪烁"],["brushColor","画笔颜色"],["complementaryColor","补色"],["complementaryColor2","补色 2"],["contrastingColor","对比色"],["darken","加深"],["desaturate","不饱和"],["lighten","变淡"],["objectColor","对象颜色"],["pulse","脉冲"],["underline","下划线"]],moderate:[["colorPulse","彩色脉冲"],["growWithColor","彩色延伸"],["shimmer","忽明忽暗"],["teeter","跷跷板"]],exciting:[["blink","闪烁"],["boldReveal","加粗展示"],["wave","波浪形"]]};function ir(e,t){return Object.keys(t).flatMap(n=>t[n].map(([l,s,o])=>({id:o?`${l}:${o}`:l,kind:e,group:n,effect:l,label:s,...o?{shape:o}:{}})))}const yn=[...ir("entrance",Yx),...ir("emphasis",ew),...ir("exit",Jx)],rr={entrance:[...new Set(yn.filter(e=>e.kind==="entrance").map(e=>e.effect))],emphasis:[...new Set(yn.filter(e=>e.kind==="emphasis").map(e=>e.effect))],exit:[...new Set(yn.filter(e=>e.kind==="exit").map(e=>e.effect))]};function tw(e,t){if(e===null)return;const n=yn.filter(l=>l.effect===e);return n.find(l=>l.shape===(t??void 0))??n.find(l=>l.shape==="circle")??n[0]}const nw=[...rr.entrance,...rr.emphasis,...rr.exit];function Io(e){try{return e(),!0}catch{return!1}}function vp(e){return e.direction===void 0||e.effect!==void 0&&e.effect!==null&&Ra(e.effect).includes(e.direction)}function gp(e,t){return Dt(e).some(n=>n.id===t)}const lw={name:"animation",addCommands:()=>({addShapeAnimation:ge({description:"Adds an entrance, emphasis or exit animation to the target shape, played in the slide show after the slide's existing animations. Target a unit or an item to animate all its shapes as one, on one click.",params:{type:"object",properties:{effect:{enum:[...nw],description:"Entrance effects end in In (or appear), exit effects in Out (or disappear); pulse, spin, growShrink, teeter, transparency and wave are emphasis."},from:{enum:["left","right","top","bottom"],description:"Edge a flyIn, flyOut, wipeIn or wipeOut comes from or leaves by."},shape:{enum:["circle","box","diamond","plus"],description:"Shape a shapeIn or shapeOut opens or closes through."},start:{enum:["click","withPrevious","afterPrevious"],description:"On the next click (default), with the previous effect, or after it."},durationSeconds:{type:"number",exclusiveMinimum:0,maximum:60},delaySeconds:{type:"number",minimum:0,maximum:60}},required:["effect"],additionalProperties:!1},target:"shape",group:!0,category:"shapes",adapt:(e,t)=>{if(t.slide===null||t.shape===null)return null;const n=e;return n.shape!==void 0&&n.effect!=="shapeIn"&&n.effect!=="shapeOut"?null:{slide:t.slide,shapes:t.shapes??[t.shape],animation:{effect:n.effect,...n.from?{direction:n.from}:{},...n.shape?{shape:n.shape}:{},...n.start?{start:n.start}:{},...n.durationSeconds===void 0?{}:{durationMs:n.durationSeconds*1e3},...n.delaySeconds===void 0?{}:{delayMs:n.delaySeconds*1e3}}}},run:e=>({presentation:t,dispatch:n})=>{const l=e.shapes.map(s=>le(t,e.slide,s));return l.length===0||l.some(s=>s===null)||!vp(e.animation)?!1:n?l.every((s,o)=>Io(()=>vo(s,{...e.animation,...o>0?{start:"withPrevious",delayMs:e.animation.delayMs??0}:{}}))):!0}}),clearShapeAnimations:ge({description:"Removes every animation of the target shape, or of every shape of a unit or item.",params:{type:"object",properties:{},additionalProperties:!1},target:"shape",group:!0,category:"shapes",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shape:t.shape,...t.shapes?{shapes:t.shapes}:{}},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=e.shapes??[e.shape],o=l===null?[]:Dt(l).filter(a=>a.id!==null&&a.targetShapeIds.some(i=>s.includes(i))).map(a=>a.id);if(l===null||o.length===0)return!1;if(n)for(const a of o)qs(l,a,()=>mo(l,a));return!0}}),updateAnimation:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(l===null||!gp(l,e.id))return!1;const s=Dt(l).find(o=>o.id===e.id);return vp({effect:e.patch.effect??s.effect,direction:e.patch.direction})?!n||Io(()=>qs(l,e.id,()=>p1(l,e.id,e.patch))):!1},removeAnimation:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l===null||!gp(l,e.id)?!1:!n||Io(()=>qs(l,e.id,()=>mo(l,e.id)))},moveAnimation:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=l===null?[]:Dt(l).filter(a=>a.sequence==="mainSeq"),o=s.findIndex(a=>a.id===e.id);return l===null||o<0||e.index<0||e.index>=s.length||e.index===o?!1:!n||Io(()=>qs(l,e.id,()=>ay(l,e.id,e.index)))}})},sw=["direction","orientation","inOut","shape","spokes","spinDirection","spinDegrees","scaleDirection","scalePercent","transparencyPercent","color","durationMs","delayMs"],ow=new Set(["click","withPrevious","afterPrevious"]);function aw(e){if(e.effect===null||e.target.kind!=="shape")return null;const t={effect:e.effect};for(const n of sw)e[n]!==null&&(t[n]=e[n]);return ow.has(e.start)&&(t.start=e.start),t}const iw={name:"animationCopy",addCommands:()=>({copyShapeAnimations:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=e.to.filter(a=>a!==e.from).map(a=>le(t,e.slide,a));if(!l||s.length===0||s.some(a=>a===null))return!1;const o=Dt(l).filter(a=>a.targetShapeIds.length===1&&a.targetShapeIds[0]===e.from).map(aw);if(o.length===0||o.some(a=>a===null))return!1;if(!n)return!0;for(const a of e.to.filter(i=>i!==e.from)){for(const r of Dt(l).filter(u=>u.id!==null&&u.targetShapeIds.includes(a)))mo(l,r.id);const i=le(t,e.slide,a);for(const r of o)vo(i,r)}return!0}})},ds=["none","fade","cut","push","pan","wipe","cover","pull","reveal","flip","split","zoom","warp","flythrough","doors","window","blinds","checker","comb","randomBar","strips","newsflash","flash","dissolve","circle","diamond","plus","wedge","wheel","random"],rw=["none","fade","push","wipe","cover","pull","split","zoom"],uw={name:"transition",addCommands:()=>({setSlideTransition:ge({description:"Sets how the target slide comes on screen in the slide show, or removes its transition; optionally for every slide, and optionally advancing by itself after some seconds.",params:{type:"object",properties:{effect:{enum:[...rw],description:"fade, push, wipe, cover, pull (uncover), split, zoom, or none."},from:{enum:["left","right","top","bottom"],description:"Side push, wipe, cover and pull enter from."},durationSeconds:{type:"number",exclusiveMinimum:0,maximum:60},advanceAfterSeconds:{type:["number","null"],minimum:0,description:"Seconds after which the show moves on by itself; null for clicks only."},allSlides:{type:"boolean",description:"Apply to every slide of the deck."}},required:["effect"],additionalProperties:!1},target:"slide",category:"slides",adapt:(e,t)=>{const n=e,l=n.allSlides?pe(t.presentation).map(We):t.slide===null?[]:[t.slide];return l.length===0?null:{slides:l,transition:{effect:n.effect,...n.from?{from:n.from}:{},...n.durationSeconds===void 0?{}:{durationMs:n.durationSeconds*1e3},...typeof n.advanceAfterSeconds=="number"?{advanceAfterMs:n.advanceAfterSeconds*1e3}:{}}}},run:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(o=>ae(t,o));if(l.length===0||l.some(o=>o===null)||!ds.includes(e.transition.effect))return!1;if(!n)return!0;const s=e.transition.effect==="none"&&e.transition.advanceAfterMs===void 0&&e.transition.advanceOnClick!==!1;for(const o of l)s&&!wi(o)?p0(o):Ki(o,Yu(e.transition));return!0}}),setTransitionSound:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(s=>ae(t,s));if(l.length===0||l.some(s=>s===null)||e.sound?.kind==="play"&&!cw(e.sound.data))return!1;if(n)for(const s of l)i1(s,e.sound);return!0},setTransitionSoundLoop:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(s=>ae(t,s));if(l.length===0||l.some(s=>wi(s)?.kind!=="play"))return!1;if(n)for(const s of l)dw(s,e.loop);return!0}})};function cw(e){const t=n=>String.fromCharCode(...e.subarray(n,n+4));return e.length>44&&t(0)==="RIFF"&&t(8)==="WAVE"}function dw(e,t){const n=Na(e),l=s=>{s.name?.localName==="stSnd"&&Gg(s,"loop",t?"1":null),s.children.forEach(o=>o.kind==="element"&&l(o))};n&&l(n),Ka(e)}const bp=["arabicPeriod","arabicParenR","arabicParenBoth","arabicPlain","romanUcPeriod","romanLcPeriod","romanUcParenR","romanLcParenR","romanUcParenBoth","romanLcParenBoth","alphaUcPeriod","alphaLcPeriod","alphaUcParenR","alphaLcParenR","alphaUcParenBoth","alphaLcParenBoth"];function xn(e,t,n){const l=n.map(o=>le(e,t,o));if(l.length===0||l.some(o=>o===null))return null;const s=l.filter(o=>st(o)==="text");return s.length===0?null:s}function ur(e,t){const n=ze(e).split(`
|
|
6
|
+
`),l=[];let s=0;return n.forEach((o,a)=>{const i=s+o.length;(!t||t.start<=i&&t.end>=s)&&l.push(a),s=i+1}),l}const pw={type:"number",minimum:.5,maximum:5,description:"Multiple of single spacing: 1, 1.15, 1.5, 2 and so on."},fw=e=>e==="middle"?"center":e,mw={name:"paragraph",addCommands:()=>({setTextAnchor:ge({description:"Places the text of the target shape at the top, middle or bottom of its box.",params:{type:"object",properties:{anchor:{enum:["top","center","middle","bottom"],description:"middle is the same as center."}},required:["anchor"],additionalProperties:!1},target:"shape",kinds:["text"],category:"format",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],anchor:fw(e.anchor)},run:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes);if(l===null)return!1;if(n)for(const s of l)wl(s,e.anchor);return!0}}),setTextDirection:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes);if(l===null)return!1;if(n)for(const s of l)md(s,e.direction);return!0},setParagraphBullets:ge({description:"Turns the paragraphs of the target shape into a bulleted list with a chosen character, a numbered list in a chosen scheme, or removes their markers.",params:{type:"object",properties:{style:{enum:["bullet","number","none"]},char:{type:"string",minLength:1,maxLength:2,description:"Bullet character for style bullet; default •."},scheme:{enum:[...bp],description:"Numbering for style number: arabicPeriod is 1. 2. 3., arabicParenR 1) 2), romanUcPeriod I. II., alphaLcParenR a) b) and so on; default arabicPeriod."}},required:["style"],additionalProperties:!1},target:"shape",kinds:["text"],category:"format",adapt:(e,t)=>{if(t.slide===null||t.shape===null)return null;const{style:n,char:l,scheme:s}=e,o=n==="bullet"?{kind:"bullet",char:l??"•"}:n==="number"?{kind:"number",scheme:s??"arabicPeriod"}:{kind:"none"};return{slide:t.slide,shapes:[t.shape],style:o}},run:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes),s=e.style;if(l===null||s.kind==="bullet"&&[...s.char].length!==1||s.kind==="number"&&!bp.includes(s.scheme))return!1;const o=s.kind==="bullet"?{char:s.char}:s.kind==="number"?{autoNum:s.scheme}:"none";if(n)for(const a of l)for(const i of ur(a,e.range))Sy(a,i,o);return!0}}),changeListLevel:ge({description:"Indents the paragraphs of the target shape one list level deeper, or brings them one level back.",params:{type:"object",properties:{direction:{enum:["increase","decrease"]}},required:["direction"],additionalProperties:!1},target:"shape",kinds:["text"],category:"format",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],offset:e.direction==="increase"?1:-1},run:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes);if(l===null)return!1;if(n)for(const s of l)My(s,e.range??{start:0,end:ze(s).length},{offset:e.offset});return!0}}),setLineSpacing:ge({description:"Sets the line spacing of the paragraphs of the target shape as a multiple of single spacing.",params:{type:"object",properties:{multiple:pw},required:["multiple"],additionalProperties:!1},target:"shape",kinds:["text"],category:"format",adapt:(e,t)=>t.slide===null||t.shape===null?null:{slide:t.slide,shapes:[t.shape],multiple:e.multiple},run:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes);if(l===null||!(e.multiple>0))return!1;if(n)for(const s of l)for(const o of ur(s,e.range))ld(s,o,{kind:"pct",value:e.multiple});return!0}})})};function yp(e,t,n){try{return Jl(e,t,n,0)?.size??18}catch{return 18}}function hw(e){return[e.spaceBefore,e.spaceAfter].filter(t=>t!==void 0).every(t=>t>=0&&t<=1584)&&(e.indentLeft===void 0||e.indentLeft>=0&&e.indentLeft<=51206400)&&(e.firstLine===void 0||Math.abs(e.firstLine)<=51206400)&&(e.firstLineChars===void 0||Math.abs(e.firstLineChars)<=100)&&(e.lineSpacing===void 0||e.lineSpacing.value>0&&e.lineSpacing.value<=(e.lineSpacing.kind==="multiple"?10:1584))}const vw={name:"paragraphFormat",addCommands:()=>({setParagraphFormat:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes),{format:s}=e;if(l===null||!hw(s)||Object.keys(s).length===0)return!1;if(!n)return!0;for(const o of l)for(const a of ur(o,e.range)){s.align&&Fi(o,a,s.align);const i=s.firstLineChars===void 0?s.firstLine:Math.round(s.firstLineChars*yp(t,o,a)*12700);(s.indentLeft!==void 0||i!==void 0)&&Cy(o,a,{...s.indentLeft===void 0?{}:{leftEmu:s.indentLeft},...i===void 0?{}:{firstLineEmu:i}});const r={asianLineBreak:s.asianLineBreak,latinLineBreak:s.latinLineBreak,hangingPunctuation:s.hangingPunctuation,fontAlignment:s.fontAlignment},u=Object.fromEntries(Object.entries(r).filter(([,c])=>c!==void 0));Object.keys(u).length>0&&Ty(o,a,u),(s.spaceBefore!==void 0||s.spaceAfter!==void 0)&&Py(o,a,{...s.spaceBefore===void 0?{}:{beforePts:s.spaceBefore},...s.spaceAfter===void 0?{}:{afterPts:s.spaceAfter}}),s.lineSpacing&&ld(o,a,{kind:s.lineSpacing.kind==="multiple"?"pct":"pts",value:s.lineSpacing.value})}return!0}})},gw={name:"clearFormat",addCommands:()=>({clearTextFormat:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes);if(l===null||e.range&&e.range.end<=e.range.start)return!1;if(n)for(const s of l)nt(s,{},{reset:!0,...e.range?{range:e.range}:{}});return!0},changeTextCase:e=>({presentation:t,dispatch:n})=>{const l=xn(t,e.slide,e.shapes);if(l===null||e.range&&e.range.end<=e.range.start)return!1;if(n)for(const s of l)at(s,{case:e.case},e.range?{range:e.range}:{});return!0}})},bw={name:"shapes",addCommands:()=>({setShapeBounds:ge({description:"Moves or resizes the target shape, or every shape of a unit or item together as one box, keeping their places relative to each other. Lengths are centimetres from the slide's top-left corner; omitted values stay as they are.",params:{type:"object",properties:{x:{type:"number",description:"Left edge in cm."},y:{type:"number",description:"Top edge in cm."},width:{type:"number",exclusiveMinimum:0,description:"Width in cm."},height:{type:"number",exclusiveMinimum:0,description:"Height in cm."},w:{type:"number",exclusiveMinimum:0,description:"Width in cm, as drawSlide names it."},h:{type:"number",exclusiveMinimum:0,description:"Height in cm, as drawSlide names it."}},additionalProperties:!1},target:"shape",group:!0,category:"shapes",adapt:(e,t)=>{if(t.slide===null||t.shape===null)return null;const n=e,l={...n,width:n.width??n.w,height:n.height??n.h};return{slide:t.slide,shape:t.shape,...t.shapes!==void 0&&t.shapes.length>1?{shapes:t.shapes}:{},...l.x===void 0?{}:{x:be(l.x)},...l.y===void 0?{}:{y:be(l.y)},...l.width===void 0?{}:{width:be(l.width)},...l.height===void 0?{}:{height:be(l.height)}}},run:e=>({presentation:t,dispatch:n})=>{if(e.shapes!==void 0&&e.shapes.length>1)return yw(t,e.slide,e.shapes,e,n);const l=Xe(t,e.slide,e.shape);if(l===null)return!1;const s=l.frame,o={x:e.x??s.x,y:e.y??s.y,width:e.width??s.width,height:e.height??s.height};if(o.width<0||o.height<0||o.width+o.height<=0)return!1;const a=(i,r)=>Math.round(i)===Math.round(r);return a(o.x,s.x)&&a(o.y,s.y)&&a(o.width,s.width)&&a(o.height,s.height)?!1:(n&&sn(l,o),!0)}}),moveShapes:ge({description:"Moves the target shape, or every shape of a unit or item together, by an offset in centimetres, keeping their sizes and their places relative to each other.",params:{type:"object",properties:{right:{type:"number",description:"Distance to the right in cm; negative moves left."},down:{type:"number",description:"Distance down in cm; negative moves up."}},additionalProperties:!1},target:"shape",group:!0,category:"shapes",adapt:(e,t)=>{if(t.slide===null||t.shape===null)return null;const n=e;return!n.right&&!n.down?null:{slide:t.slide,shapes:t.shapes??[t.shape],dx:be(n.right??0),dy:be(n.down??0)}},run:e=>({presentation:t,dispatch:n})=>{const l=e.shapes.map(s=>Xe(t,e.slide,s));if(l.length===0||l.some(s=>s===null)||e.dx===0&&e.dy===0)return!1;if(n)for(const s of l)sn(s,{x:s.frame.x+e.dx,y:s.frame.y+e.dy,width:s.frame.width,height:s.frame.height});return!0}}),deleteShape:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);return l===null?!1:(n&&pn(l),!0)}})};function yw(e,t,n,l,s){const o=n.map(h=>Xe(e,t,h));if(o.some(h=>h===null))return!1;const a=o.map(h=>h.frame),i=Math.min(...a.map(h=>h.x)),r=Math.min(...a.map(h=>h.y)),u=Math.max(...a.map(h=>h.x+h.width))-i,c=Math.max(...a.map(h=>h.y+h.height))-r,d={x:l.x??i,y:l.y??r,width:l.width??u,height:l.height??c};if(d.width<=0||d.height<=0)return!1;const p=u>0?d.width/u:1,f=c>0?d.height/c:1;if(d.x===i&&d.y===r&&p===1&&f===1)return!1;if(s)for(const h of o){const{x:v,y:g,width:$,height:b}=h.frame;sn(h,{x:d.x+(v-i)*p,y:d.y+(g-r)*f,width:$*p,height:b*f})}return!0}const xw={name:"slides",addCommands:()=>({addSlide:ge({description:"Adds a slide with a title and optional body text, after the target slide or at the end. Body lines become bullet paragraphs.",params:{type:"object",properties:{title:{type:"string",description:"Slide title."},body:{type:"string",description:"Body text; each line is one paragraph."}},additionalProperties:!1},target:"document",category:"slides",adapt:(e,t)=>{const{title:n,body:l}=e;return{after:(t.slide===null?void 0:ww(t.presentation,t.slide))??void 0,title:n,body:l}},run:e=>({presentation:t,dispatch:n})=>{const l=pe(t).length;if(e.after!==void 0&&(e.after<0||e.after>=l))return!1;if(!n)return!0;const s=Jb(t,{...e.title===void 0?{}:{title:e.title},...e.body===void 0?{}:{body:e.body}});return e.after!==void 0&&Un(t,s,e.after+1),!0}}),duplicateSlide:ge({description:"Copies the target slide with all its content and places the copy right after it.",target:"slide",category:"slides",adapt:(e,t)=>t.slide===null?null:{slide:t.slide},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l===null?!1:(n&&Un(t,m0(t,l),Vn(t,l)+1),!0)}}),moveSlide:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=pe(t).length;return l===null||e.to<0||e.to>=s?!1:(n&&Un(t,l,e.to),!0)},deleteSlide:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l===null?!1:(n&&Ei(t,l),!0)},setSlideHidden:ge({description:"Hides the target slide from the slide show, or shows it again. Hidden slides stay in the deck.",params:{type:"object",properties:{hidden:{type:"boolean",description:"true hides the slide; false shows it."}},required:["hidden"],additionalProperties:!1},target:"slide",category:"slides",adapt:(e,t)=>t.slide===null?null:{slide:t.slide,hidden:e.hidden},satisfied:(e,t)=>{const n=t.slide===null?null:ae(t.presentation,t.slide);return n!==null&&co(n)===e.hidden},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l===null||co(l)===e.hidden?!1:(n&&Jy(l,e.hidden),!0)}}),setSlideBackground:ge({description:"Fills the background of the target slide with a colour.",params:{type:"object",properties:{color:{type:"string",pattern:"^#[0-9A-Fa-f]{6}$",description:"Background colour as #RRGGBB."}},required:["color"],additionalProperties:!1},target:"slide",category:"slides",adapt:(e,t)=>t.slide===null?null:{slide:t.slide,color:e.color},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l===null||!/^#[\da-f]{6}$/iu.test(e.color)?!1:(n&&Xy(l,e.color),!0)}}),setSlideNotes:ge({description:"Replaces the speaker notes of the target slide; an empty string clears them.",params:{type:"object",properties:{notes:{type:"string",description:"New notes; each line is one paragraph."}},required:["notes"],additionalProperties:!1},target:"slide",category:"slides",adapt:(e,t)=>t.slide===null?null:{slide:t.slide,notes:e.notes},satisfied:(e,t)=>{const n=t.slide===null?null:ae(t.presentation,t.slide);return n!==null&&(In(n)??"")===e.notes},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l===null?!1:(n&&Ri(l,e.notes,{preserveFormatting:!0}),!0)}})})};function ww(e,t){const n=ae(e,t);return n===null?null:Vn(e,n)}const kw={name:"text",addCommands:()=>({setShapeText:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);return l===null||ze(l)===e.text?!1:(n&&at(l,e.text,{preserveFormatting:!0}),!0)},replaceShapeText:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);if(l===null||e.find.length===0)return!1;const s=$w(ze(l),e.find,e.occurrence??0);return s<0?!1:(n&&at(l,e.replace,{preserveFormatting:!0,range:{start:s,end:s+e.find.length}}),!0)},addTextBox:ge({description:"Adds a text box to the target slide at a position and size in centimetres from the slide's top-left corner, optionally with its finished look: font size, bold, text colour, alignment, fill and outline.",params:{type:"object",properties:{text:{type:"string",description:"Text; each line is one paragraph."},x:{type:"number",description:"Left edge in cm."},y:{type:"number",description:"Top edge in cm."},width:{type:"number",exclusiveMinimum:0,description:"Width in cm."},height:{type:"number",exclusiveMinimum:0,description:"Height in cm."},...Gi},required:["text","x","y","width","height"],additionalProperties:!1},target:"slide",category:"shapes",adapt:(e,t)=>{if(t.slide===null)return null;const{text:n,x:l,y:s,width:o,height:a}=e;return{slide:t.slide,text:n,x:be(l),y:be(s),width:be(o),height:be(a),look:Od(e,t.presentation)}},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(l===null||e.width<=0||e.height<=0)return!1;if(n){const s=Ys(l,{x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height),text:e.text});e.vertical&&md(s,"eaVert"),e.look&&Ud(s,e.look)}return!0}})})};function $w(e,t,n){let l=-1;for(let s=0;s<=n;s+=1)if(l=e.indexOf(t,l+1),l<0)return-1;return l}function Bo(e,t,n){const l=le(e,t,n),s=l&&ny(l)?un(l):null;if(!s)return null;const{bytes:o,editableSource:a}=b1(s);return a?{source:a,png:o}:null}const Sw={name:"editable",addCommands:()=>({addEditablePicture:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=Sd(e.png,e.source);return l===null||s===e.png||e.width<=0||e.height<=0?!1:(n&&Zs(l,s,{x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height),name:e.name}),!0)},setEditablePicture:e=>({presentation:t,dispatch:n})=>{const l=Xe(t,e.slide,e.shape),s=Sd(e.png,e.source);if(l===null||Bo(t,e.slide,e.shape)===null||s===e.png||!(e.aspect>0))return!1;if(!n)return!0;Li(l.shape,s,{format:"png"});const{frame:o}=l;return sn(l,{x:o.x,y:o.y,width:o.width,height:Math.round(o.width/e.aspect)}),!0}})},Cw=28;function cr(e){if(Yl(e)!=="shape")return!1;const t=lo(e).flat().filter(n=>n.kind!=="r"||n.text.trim()!=="");return t.length===1&&t[0].kind==="math"}function Mw(e,t,n){const l=le(e,t,n);if(l===null||!cr(l))return null;const s=lo(l).flat().find(o=>o.kind==="math");return!s||s.kind!=="math"?null:x1(Bg(s.math,s.display))}function Pw(e){const t=y1(e,{display:!0});return t.ok?{ok:!0,paragraphs:[{align:"center",runs:[{equation:Ug(t.element),display:!0,format:{size:Cw}}]}]}:{ok:!1,code:t.diagnostic.code,offset:t.diagnostic.offset}}function xp(e){const t=e.trim()?Pw(e):null;return t?.ok?t.paragraphs:null}const Tw={name:"equation",addCommands:()=>({addEquation:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=xp(e.latex);return l===null||s===null||e.width<=0||e.height<=0?!1:(n&&ud(Ys(l,{x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height),text:"",name:"公式"}),s),!0)},setEquation:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape),s=xp(e.latex);return l===null||s===null||!cr(l)?!1:(n&&ud(l,s),!0)}})},wp=new Set(["line","area","combo"]),dr={column:["ctr","inEnd","inBase","outEnd"],bar:["ctr","inEnd","inBase","outEnd"],line:["ctr","l","r","t","b"],scatter:["ctr","l","r","t","b"],radar:[],pie:["ctr","inEnd","outEnd","bestFit"],doughnut:[],area:[]},kp=new Set(["column","bar","line","scatter"]);function Aw(e){if(e.categories.length===0||e.kind==="scatter"||e.kind==="pie"||e.kind==="doughnut")return null;const t={...e};return delete t.categoryAxisDate,delete t.categoryAxisScaling,delete t.categoryGroupLevels,t.categories=e.series.map(n=>n.name),t.series=e.categories.map((n,l)=>({name:n||`系列 ${l+1}`,values:e.series.map(s=>s.values[l]??null)})),t}function Ew(e,t,n){const l=e.series[t];if(!l)return null;const s=e.kind==="column"||e.kind==="line"||e.kind==="area";if((n.chartKind!==void 0||n.secondaryAxis!==void 0)&&!s)return null;const o=(n.chartKind===void 0?l.chartKind??e.kind:n.chartKind??e.kind)==="line"||e.kind==="scatter"||e.kind==="radar";if((n.smooth!==void 0||n.markers!==void 0)&&!o||(n.trendline!==void 0||n.trendPeriod!==void 0)&&!kp.has(e.kind)||n.trendPeriod!==void 0&&!(Number.isInteger(n.trendPeriod)&&n.trendPeriod>=2&&n.trendPeriod<=10))return null;const a=l.trendline;if(n.trendPeriod!==void 0&&n.trendline===void 0&&a?.type!=="movingAvg")return null;const i={...l};n.color!==void 0&&(i.color=n.color,l.lineColor&&(i.lineColor=n.color),l.markerColor&&(i.markerColor=n.color)),n.smooth!==void 0&&(i.smooth=n.smooth),n.markers!==void 0&&(i.markerSymbol=n.markers?"circle":"none"),n.trendline!==void 0?n.trendline===null?delete i.trendline:i.trendline=n.trendline==="movingAvg"?{type:"movingAvg",period:n.trendPeriod??a?.period??2}:{type:n.trendline}:n.trendPeriod!==void 0&&(i.trendline={...a,type:"movingAvg",period:n.trendPeriod}),n.chartKind!==void 0&&(n.chartKind===null||n.chartKind===e.kind?delete i.chartKind:i.chartKind=n.chartKind),n.secondaryAxis!==void 0&&(n.secondaryAxis?i.secondaryAxis=!0:delete i.secondaryAxis);const r={...e};return r.series=e.series.map((u,c)=>c===t?i:{...u}),r.series.every(u=>u.secondaryAxis===!0)?null:(r.series.some(u=>u.secondaryAxis===!0)||delete r.secondaryValueAxis,r)}function Fw(e,t){const n={...e},l=e.kind==="column"||e.kind==="bar";if((t.gapWidth!==void 0||t.overlap!==void 0)&&!l)return null;if(t.gapWidth!==void 0&&(n.gapWidthPct=t.gapWidth),t.overlap!==void 0&&(n.overlapPct=t.overlap),t.valueAxis!==void 0){if(e.kind==="pie"||e.kind==="doughnut")return null;const s={...e.valueAxis};for(const[o,a]of Object.entries(t.valueAxis))a===null?delete s[o]:a!==void 0&&(s[o]=a);Object.keys(s).length===0?delete n.valueAxis:n.valueAxis=s}if([t.valueTickMark,t.categoryTickMark,t.categoryLabelInterval,t.categoryLabelRotation].some(s=>s!==void 0)){if(e.kind==="pie"||e.kind==="doughnut")return null;const s=["none","in","out","cross"];if([t.valueTickMark,t.categoryTickMark].some(o=>o!==void 0&&!s.includes(o)))return null;if(t.valueTickMark!==void 0&&(n.valueAxisMajorTickMark=t.valueTickMark),t.categoryTickMark!==void 0&&(n.categoryAxisMajorTickMark=t.categoryTickMark),t.categoryLabelInterval!==void 0){if(e.kind==="scatter")return null;if(t.categoryLabelInterval===null)delete n.categoryAxisTickLabelSkip;else if(Number.isInteger(t.categoryLabelInterval)&&t.categoryLabelInterval>=1)n.categoryAxisTickLabelSkip=t.categoryLabelInterval;else return null}if(t.categoryLabelRotation!==void 0)if(t.categoryLabelRotation===null)delete n.categoryAxisLabelRotationDeg;else if(t.categoryLabelRotation>=-90&&t.categoryLabelRotation<=90)n.categoryAxisLabelRotationDeg=t.categoryLabelRotation;else return null}if(t.areas!==void 0)for(const[s,o]of Object.entries({chartFill:"chartAreaFill",chartBorder:"chartAreaStrokeColor",plotFill:"plotAreaFill",plotBorder:"plotAreaStrokeColor"})){const a=t.areas[s];if(a!==void 0)if(a===null)delete n[o];else if(/^#[\da-f]{6}$/iu.test(a))n[o]=a.toUpperCase();else return null}if(t.blanks!==void 0){if(!wp.has(e.kind)||!["gap","zero","span"].includes(t.blanks))return null;n.dispBlanksAs=t.blanks}if(t.labelPosition!==void 0){if(!dr[e.kind]?.includes(t.labelPosition))return null;n.dataLabels={showValue:!0,showCategory:!1,showSeriesName:!1,showPercent:!1,...e.dataLabels,position:t.labelPosition}}return n}const $p=["showValue","showCategory","showSeriesName","showPercent"];function zw(e,t){const n=e.kind==="pie"||e.kind==="doughnut";if(t.showPercent&&!n||t.position!==void 0&&!dr[e.kind]?.includes(t.position))return null;const l={showValue:!1,showCategory:!1,showSeriesName:!1,showPercent:!1,...e.dataLabels};for(const o of $p)t[o]!==void 0&&(l[o]=t[o]);t.position!==void 0&&(l.position=t.position),t.separator!==void 0&&(l.separator=t.separator),t.numberFormat===null?delete l.numberFormat:t.numberFormat!==void 0&&(l.numberFormat=t.numberFormat);const s={...e,series:e.series.map(o=>{const{dataLabels:a,pointDataLabels:i,...r}=o;return r})};return $p.some(o=>l[o]===!0)?s.dataLabels=l:delete s.dataLabels,s}function Dw(e,t){const n=e.series.length;return t.length!==n||new Set(t).size!==n||t.some(l=>!Number.isInteger(l)||l<0||l>=n)||t.every((l,s)=>l===s)?null:{...e,series:t.map(l=>e.series[l])}}function Lw(e,t){return e.series.length<2||!e.series[t]?null:{...e,series:e.series.filter((n,l)=>l!==t)}}const Vw=["values","pointColors","pointExplosions","pointDataLabels","xValues","bubbleSizes"];function Iw(e,t){return e.categories.length<2||t<0||t>=e.categories.length||e.categoryGroupLevels!==void 0?null:{...e,categories:e.categories.filter((n,l)=>l!==t),series:e.series.map(n=>{const l={...n};for(const s of Vw){const o=n[s];Array.isArray(o)&&(l[s]=o.filter((a,i)=>i!==t))}return l})}}const Bw=[["column","柱形图"],["bar","条形图"],["line","折线图"],["pie","饼图"],["area","面积图"],["scatter","散点图"],["radar","雷达图"],["combo","组合图"]],pr=[{id:"column-clustered",group:"column",label:"簇状柱形图",kind:"column"},{id:"column-stacked",group:"column",label:"堆积柱形图",kind:"column",grouping:"stacked"},{id:"column-percent",group:"column",label:"百分比堆积柱形图",kind:"column",grouping:"percentStacked"},{id:"bar-clustered",group:"bar",label:"簇状条形图",kind:"bar"},{id:"bar-stacked",group:"bar",label:"堆积条形图",kind:"bar",grouping:"stacked"},{id:"bar-percent",group:"bar",label:"百分比堆积条形图",kind:"bar",grouping:"percentStacked"},{id:"line",group:"line",label:"折线图",kind:"line",markers:!1},{id:"line-markers",group:"line",label:"带数据标记的折线图",kind:"line",markers:!0},{id:"line-stacked",group:"line",label:"堆积折线图",kind:"line",grouping:"stacked",markers:!1},{id:"pie",group:"pie",label:"饼图",kind:"pie"},{id:"doughnut",group:"pie",label:"圆环图",kind:"doughnut"},{id:"area",group:"area",label:"面积图",kind:"area"},{id:"area-stacked",group:"area",label:"堆积面积图",kind:"area",grouping:"stacked"},{id:"area-percent",group:"area",label:"百分比堆积面积图",kind:"area",grouping:"percentStacked"},{id:"scatter",group:"scatter",label:"散点图",kind:"scatter",scatterStyle:"marker"},{id:"scatter-smooth",group:"scatter",label:"带平滑线和数据标记的散点图",kind:"scatter",scatterStyle:"smoothMarker"},{id:"radar",group:"radar",label:"雷达图",kind:"radar",radarStyle:"standard"},{id:"radar-markers",group:"radar",label:"带数据标记的雷达图",kind:"radar",radarStyle:"marker"},{id:"radar-filled",group:"radar",label:"填充雷达图",kind:"radar",radarStyle:"filled"},{id:"combo-line",group:"combo",label:"簇状柱形图-折线图",kind:"column",combo:"line"},{id:"combo-secondary",group:"combo",label:"簇状柱形图-次坐标轴上的折线图",kind:"column",combo:"secondary"}];function Sp(e,t){const n=pr.find(o=>o.id===e);if(!n)return null;const l=Vg(n.kind,t),s={...l,series:l.series.map(o=>({...o}))};if(n.grouping&&(s.grouping=n.grouping),n.markers!==void 0&&(s.series=s.series.map(o=>({...o,markerSymbol:n.markers?"circle":"none"}))),n.scatterStyle&&(s.scatterStyle=n.scatterStyle),n.radarStyle&&(s.radarStyle=n.radarStyle),n.combo){const o=s.series.length-1;s.series=s.series.map((a,i)=>i===o?{...a,chartKind:"line",...n.combo==="secondary"?{secondaryAxis:!0}:{}}:a)}return hl(s)?s:null}function Ow(){return{addChartPreset:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=Mt(t),o=Sp(e.preset,s?[s.accent1,s.accent2,s.accent3,s.accent4]:[]);if(!l||!o||e.width<=0||e.height<=0)return!1;if(!n)return!0;try{return yc(l,{spec:o,x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height)}),!0}catch{return!1}}}}const fr=new Set(["pie","doughnut"]),Uw=["title","titleStyle","titleOverlay","legend","dataLabels","plotAreaFill","plotAreaStrokeColor","chartAreaFill","chartAreaStrokeColor","dispBlanksAs","language","roundedCorners","chartStyle"],Nw=["valueAxis","categoryAxis"],Rw=new Set(["categoryAxisDate","categoryAxisScaling","categoryGroupLevels","categoryAxisTickLabelSkip","categoryAxisTickMarkSkip","categoryAxisLabelOffset","categoryAxisLabelAlign","categoryAxisNoMultiLevelLabel"]),Oo=e=>!fr.has(e);function jw(e){return e.categories.length>0?[...e.categories]:(e.series[0]?.xValues??[]).map((t,n)=>String(t===null?n+1:t))}const Cp={all:["dataLabels","fillOpacity"],bars:["invertIfNegative","trendline","pointDataLabels"],lines:["lineColor","lineWidthEmu","lineDash","markerSymbol","markerSizePt","markerColor","markerLineColor","smooth","trendline","pointDataLabels"],areas:["lineColor","lineWidthEmu","pointDataLabels"],radar:["lineColor","lineWidthEmu","lineDash","markerSymbol","markerSizePt","markerColor","markerLineColor"]};function Mp(e){const t=e==="column"||e==="bar"?"bars":e==="line"||e==="scatter"?"lines":e==="radar"?"radar":e==="area"?"areas":"";return[...Cp.all,...t?Cp[t]:[]]}function Pp(e,t,n,l=!0){const s=jw(e),o={kind:t,series:[]};for(const u of Uw)e[u]!==void 0&&(o[u]=e[u]);if(Oo(e.kind)&&Oo(t))for(const[u,c]of Object.entries(e))Nw.some(d=>u.startsWith(d))&&!Rw.has(u)&&c!==void 0&&(o[u]=c);const a=["column","bar","line","area"];a.includes(e.kind)&&a.includes(t)&&e.categoryAxisDate!==void 0&&(o.categoryAxisDate=e.categoryAxisDate,e.categoryAxisScaling!==void 0&&(o.categoryAxisScaling=e.categoryAxisScaling)),e.view3D!==void 0&&["column","bar","line","area","pie"].includes(t)&&(o.view3D=e.view3D,(t==="column"||t==="bar")&&e.bar3DShape!==void 0&&(o.bar3DShape=e.bar3DShape));const i=l?Mp(e.kind).filter(u=>Mp(t).includes(u)):[],r=e.series.map(u=>{const c=u,d=Object.fromEntries(i.filter(p=>c[p]!==void 0).map(p=>[p,c[p]]));return{name:u.name,values:[...u.values],...u.color?{color:u.color}:{},...d}});if(fr.has(t)){const u=r[0];return o.varyColors=!0,o.categories=s,u&&(o.series=[{name:u.name,values:u.values,...n.length>0?{pointColors:s.map((c,d)=>n[d%n.length])}:{}}]),o}if(t==="scatter"){const u=s.map(Number),c=u.every(Number.isFinite)?u:s.map((d,p)=>p+1);return o.series=r.map(d=>({...d,xValues:c})),o}return o.categories=s,o.series=r,(t==="column"||t==="bar"||t==="line"||t==="area")&&(e.grouping==="stacked"||e.grouping==="percentStacked")&&(o.grouping=e.grouping),o}const Kw={title:["title","titleStyle","titleOverlay","titleLayout"],categoryAxisTitle:["categoryAxisTitle","categoryAxisTitleStyle","categoryAxisTitleRotationDeg"],valueAxisTitle:["valueAxisTitle","valueAxisTitleStyle","valueAxisTitleRotationDeg"]};function Tp(e,t){const n={...e,series:e.series.map(s=>({...s}))},l=(s,o)=>{if(o!==void 0)if(o===null)for(const a of Kw[s])delete n[a];else n[s]=o};if(l("title",t.title),t.legend!==void 0&&(t.legend===null?delete n.legend:n.legend={...e.legend?.textStyle?{textStyle:e.legend.textStyle}:{},position:t.legend}),t.dataLabels!==void 0){t.dataLabels?n.dataLabels={showValue:!0,showCategory:!1,showSeriesName:!1,showPercent:!1}:delete n.dataLabels;for(const s of n.series)delete s.dataLabels,delete s.pointDataLabels}if(!Oo(e.kind))return n;l("categoryAxisTitle",t.categoryAxisTitle),l("valueAxisTitle",t.valueAxisTitle),t.valueGridlines!==void 0&&(n.valueAxisMajorGridlines=t.valueGridlines),t.categoryGridlines!==void 0&&(n.categoryAxisMajorGridlines=t.categoryGridlines),t.valueMinorGridlines!==void 0&&(n.valueAxisMinorGridlines=t.valueMinorGridlines),t.categoryAxis!==void 0&&(n.categoryAxisHidden=!t.categoryAxis),t.valueAxis!==void 0&&(n.valueAxisHidden=!t.valueAxis);for(const s of["dropLines","hiLowLines"])t[s]===void 0||e.kind!=="line"||(t[s]?n[s]=!0:delete n[s]);return n}function Ap(e,t){const n={...e};return fr.has(e.kind)?(n.series=e.series.map(l=>({...l,pointColors:l.values.map((s,o)=>t[o%t.length])})),n):(n.series=e.series.map((l,s)=>{const o=t[s%t.length],{pointColors:a,...i}=l;return{...i,color:o,...l.lineColor?{lineColor:o}:{},...l.markerColor?{markerColor:o}:{},...l.markerLineColor?{markerLineColor:o}:{}}}),n)}function Ep(e){return e.kind!=="scatter"&&e.kind!=="bubble"||e.series.every(t=>t.xValues!==void 0)?e:{...e,series:e.series.map(t=>t.xValues!==void 0?t:{...t,xValues:t.values.map((n,l)=>l+1)})}}function ps(e,t,n){const l=ae(e,t),s=l?gi(l).find(o=>Fe(o.shape)===n):void 0;return s?.spec?s:null}function mr(e){const t=Mt(e);return t?[t.accent1,t.accent2,t.accent3,t.accent4,t.accent5,t.accent6]:[]}function It(e,t){return({presentation:n,dispatch:l})=>{const s=ps(n,e.slide,e.shape),o=s?Ep(s.spec):null;if(!s||!o||!hl(o))return!1;const a=t(o,n);if(!a||!hl(a))return!1;if(!l)return!0;try{return vy(s,a),!0}catch{return!1}}}const Ww={name:"chart",addCommands:()=>({...Ow(),setChartKind:e=>It(e,(t,n)=>{if(!ja.includes(e.kind)||t.kind===e.kind||(e.kind==="pie"||e.kind==="doughnut")&&t.series.length!==1)return null;const l=Pp(t,e.kind,mr(n));return hl(l)?l:Pp(t,e.kind,mr(n),!1)}),setChartElements:e=>It(e,t=>Object.keys(e.elements).length===0?null:Tp(t,e.elements)),switchChartRowColumn:e=>It(e,t=>Aw(t)),setChartSeriesFormat:e=>It(e,t=>{const{color:n}=e.format;return Object.keys(e.format).length===0||n!==void 0&&!/^#[\da-f]{6}$/iu.test(n)?null:Ew(t,e.series,n===void 0?e.format:{...e.format,color:n.toUpperCase()})}),setChartOptions:e=>It(e,t=>{const{gapWidth:n,overlap:l,valueAxis:s}=e.options,o=(i,r,u)=>i===void 0||Number.isFinite(i)&&i>=r&&i<=u,a=i=>i==null||Number.isFinite(i);return Object.keys(e.options).length===0||!o(n,0,500)||!o(l,-100,100)||s?.displayUnits!==void 0&&s.displayUnits!==null&&!["hundreds","thousands","tenThousands","hundredThousands","millions","tenMillions","hundredMillions","billions"].includes(s.displayUnits)||s&&(!a(s.min)||!a(s.max)||!a(s.majorUnit)||typeof s.majorUnit=="number"&&s.majorUnit<=0)?null:Fw(t,e.options)}),setChartDataLabels:e=>It(e,t=>Object.keys(e.labels).length===0?null:zw(t,e.labels)),setChartSeriesOrder:e=>It(e,t=>Dw(t,e.order)),removeChartSeries:e=>It(e,t=>Lw(t,e.series)),removeChartCategory:e=>It(e,t=>Iw(t,e.category)),setChartColors:e=>It(e,t=>e.colors.length===0||!e.colors.every(n=>/^#[\da-f]{6}$/iu.test(n))?null:Ap(t,e.colors.map(n=>n.toUpperCase())))})};function hr(e,t,n){const l=ps(e,t,n);if(!l)return null;const{spec:s}=l,o=Oo(s.kind);return{kind:s.kind,insertKind:ja.includes(s.kind)?s.kind:null,editable:hl(Ep(s)),axes:o,series:s.series.length,elements:{title:s.title!==void 0&&s.title!=="",legend:s.legend!==void 0&&s.legend.position!==null,legendPosition:s.legend?.position==="tr"?"r":s.legend?.position??null,dataLabels:[s.dataLabels,...s.series.map(a=>a.dataLabels)].some(a=>a!==void 0&&(a.showValue||a.showCategory||a.showPercent||a.showSeriesName)),categoryAxisTitle:o&&s.categoryAxisTitle!==void 0,valueAxisTitle:o&&s.valueAxisTitle!==void 0,valueGridlines:o&&s.valueAxisMajorGridlines===!0,categoryGridlines:o&&s.categoryAxisMajorGridlines===!0,valueMinorGridlines:o&&s.valueAxisMinorGridlines===!0,categoryAxis:o&&s.categoryAxisHidden!==!0,valueAxis:o&&s.valueAxisHidden!==!0,dropLines:s.kind==="line"&&s.dropLines===!0,hiLowLines:s.kind==="line"&&s.hiLowLines===!0},texts:{title:s.title??"",categoryAxisTitle:s.categoryAxisTitle??"",valueAxisTitle:s.valueAxisTitle??""},seriesFormats:s.series.map(a=>({name:a.name,color:a.color&&/^#?[\da-f]{6}$/iu.test(a.color)?`#${a.color.replace("#","").toUpperCase()}`:null,smooth:a.smooth===!0,markers:a.markerSymbol!==void 0?a.markerSymbol!=="none":s.lineMarkers!==!1,trendline:a.trendline?.type??null,trendPeriod:a.trendline?.type==="movingAvg"?a.trendline.period??2:null,chartKind:a.chartKind??s.kind,secondaryAxis:a.secondaryAxis===!0})),gapWidth:s.gapWidthPct??null,overlap:s.overlapPct??null,valueAxisScaling:{...s.valueAxis?.min===void 0?{}:{min:s.valueAxis.min},...s.valueAxis?.max===void 0?{}:{max:s.valueAxis.max},...s.valueAxis?.majorUnit===void 0?{}:{majorUnit:s.valueAxis.majorUnit},...s.valueAxis?.numberFormat===void 0?{}:{numberFormat:s.valueAxis.numberFormat},...s.valueAxis?.displayUnits===void 0?{}:{displayUnits:s.valueAxis.displayUnits}},axisFormat:{valueTickMark:s.valueAxisMajorTickMark??null,categoryTickMark:s.categoryAxisMajorTickMark??null,labelInterval:s.categoryAxisTickLabelSkip??null,labelRotation:s.categoryAxisLabelRotationDeg!==void 0&&Math.abs(s.categoryAxisLabelRotationDeg)<=90?s.categoryAxisLabelRotationDeg:null},labelPosition:s.dataLabels?.position??null,blanks:wp.has(s.kind)?s.dispBlanksAs??"gap":null,areas:{chartFill:s.chartAreaFill??null,chartBorder:s.chartAreaStrokeColor??null,plotFill:s.plotAreaFill??null,plotBorder:s.plotAreaStrokeColor??null},labels:{showValue:s.dataLabels?.showValue===!0,showCategory:s.dataLabels?.showCategory===!0,showSeriesName:s.dataLabels?.showSeriesName===!0,showPercent:s.dataLabels?.showPercent===!0,numberFormat:s.dataLabels?.numberFormat??null,separator:s.dataLabels?.separator??null}}}const Fp=[["none","无箭头","none","none"],["end","终点箭头","none","triangle"],["start","起点箭头","triangle","none"],["both","双向箭头","triangle","triangle"],["end-stealth","终点燕尾箭头","none","stealth"],["both-stealth","双向燕尾箭头","stealth","stealth"],["end-oval","终点圆点","none","oval"],["oval-arrow","起点圆点,终点箭头","oval","triangle"],["both-oval","双向圆点","oval","oval"],["end-diamond","终点菱形","none","diamond"],["diamond-arrow","起点菱形,终点箭头","diamond","triangle"],["both-diamond","双向菱形","diamond","diamond"]].map(([e,t,n,l])=>({id:e,label:t,head:n,tail:l})),qw=new Set(["line","lineInv","straightConnector1","bentConnector2","bentConnector3","bentConnector4","bentConnector5","curvedConnector2","curvedConnector3","curvedConnector4","curvedConnector5","arc"]);function zp(e){if(st(e)==="connector")return!0;const t=so(e);if(t!==null)return qw.has(t);const n=Ac(e);return n!==null&&n.paths.length>0&&n.paths.every(l=>!l.commands.some(s=>s.kind==="close"))}const Dp={camera:"orthographicFront",lightRig:{type:"threePt",direction:"t"}};function Lp(e,t){const n=Tc(e),l=t.rotation?t.rotation.value:n?.scene?.cameraRotation??null,s=t.bevel?t.bevel.value:n?.bevelTop?{width:n.bevelTop.widthEmu??76200,height:n.bevelTop.heightEmu??76200}:null;if(l===null&&s===null){ho(e,null);return}ho(e,{...l===null?s===null?{}:{scene:Dp}:{scene:{...Dp,cameraRotation:l}},...s===null?{}:{bevelTop:{preset:"circle",widthEmu:s.width,heightEmu:s.height}}})}function wn(e,t){switch(t.kind){case"shadow":rd(e,null),fd(e,t.value);return;case"innerShadow":fd(e,null),rd(e,t.value);return;case"glow":zy(e,t.value);return;case"reflection":Ry(e,t.value);return;case"softEdge":jy(e,t.value);return;case"rotation":Lp(e,{rotation:t});return;case"bevel":Lp(e,{bevel:t});return;case"none":kc(e),ho(e,null)}}function Ht(e){const t=/^#?([\da-f]{6})(?:[\da-f]{2})?$/iu.exec(e??"");return t?`#${t[1].toUpperCase()}`:null}const _w={outerShdw:"shadow",innerShdw:"innerShadow",glow:"glow",reflection:"reflection",softEdge:"softEdge"};function Vp(e){if(!e)return null;const t=e.stops.map(s=>({offset:s.offset,color:Ht(s.resolvedColor??s.color),opacity:s.opacity}));if(t.some(s=>s.color===null))return null;const n=e.path??"linear",l=e.focus;return{path:n,angle:e.angleDeg??90,...n!=="linear"&&l?{focus:{x:l.left,y:l.top}}:{},stops:t.map(s=>({offset:s.offset,color:s.color,...s.opacity===void 0?{}:{opacity:s.opacity}}))}}function Gw(e,t,n,l){return n==="solid"?z0(t,e)??1:n==="gradient"?l?.stops[0]?.opacity??1:n==="image"?Bc(t)??1:1}function fs(e,t){const n=Ht(Zl(e,t)),l=zc(e,t).kind,s=n!==null?"solid":l==="solid"||l==="inherit"||l==="background"?"other":l,o=W0(e,t),a=o.kind==="solid"||o.kind==="gradient"?o.widthEmu??vi(t):vi(t),i=[...new Set(Fc(e,t).flatMap(c=>_w[c.kind]??[]))],r=s==="gradient"?Vp(Dc(e,t)):null,u=Tc(t);return u?.scene?.cameraRotation&&i.push("rotation"),u?.bevelTop&&i.push("bevel"),{fill:s,fillColor:n,fillOpacity:Gw(e,t,s,r),gradient:r,lineColor:o.kind==="none"?null:Ht(oo(e,t)),lineWidth:a===null?null:Math.round(a/12700*100)/100,dash:K0(t,e)??"solid",head:es(t,"head",e)?.type??"none",tail:es(t,"tail",e)?.type??"none",headSize:es(t,"head",e)?.length??"med",tailSize:es(t,"tail",e)?.length??"med",cap:R0(t,e)??"flat",join:q0(t,e)??"round",compound:j0(t,e)??"sng",effects:i,preset:so(t)}}const Ip=12700;function Qt(e){return typeof e=="string"&&(/^#[\da-f]{6}$/iu.test(e)||/^(?:bg|tx|lt|dk)[12]$|^accent[1-6]$/u.test(e))}const Uo=e=>e===void 0||Number.isFinite(e)&&e>=0&&e<=1;function Hw(e){return e.stops.length>=2&&e.stops.every(t=>Qt(t.color)&&Uo(t.offset)&&Uo(t.opacity))&&Number.isFinite(e.angle)}function Qw(e){switch(e.kind){case"solid":return Qt(e.color)&&Uo(e.opacity);case"gradient":return Hw(e);case"image":return e.bytes.length>0;case"pattern":return Qt(e.foreground)&&Qt(e.background);default:return!0}}function Xw(e){return Object.keys(e).length===0||e.color!==void 0&&e.color!==null&&!Qt(e.color)||e.width!==void 0&&!(Number.isFinite(e.width)&&e.width>0&&e.width<=1584)?!1:Uo(e.opacity)}function ms(e){const t=e.focus??{x:.5,y:.5};return{stops:e.stops.map(n=>({offset:n.offset,color:n.color,...n.opacity===void 0?{}:{opacity:n.opacity}})),...e.path==="linear"?{angleDeg:(e.angle%360+360)%360}:{path:e.path,focus:{left:t.x,top:t.y,right:1-t.x,bottom:1-t.y}}}}function hs(e,t){switch(t.kind){case"solid":Rn(e,t.color),t.opacity!==void 0&&t.opacity<1&&Rn(e,{color:t.color,opacity:t.opacity});return;case"gradient":ad(e,ms(t));return;case"image":By(e,t.bytes),t.tile&&Oy(e,{mode:"tile",scaleX:1,scaleY:1});return;case"pattern":Ny(e,{preset:t.preset,foreground:t.foreground,background:t.background});return;case"none":yl(e)}}function vs(e,t){if(t.color===null){Ii(e);return}const n={...t.color===void 0?{}:{color:t.color},...t.width===void 0?{}:{widthEmu:j(Math.round(t.width*Ip))},...t.opacity===void 0?{}:{opacity:t.opacity}};Object.keys(n).length>0&&xl(e,n),t.dash!==void 0&&qy(e,t.dash);for(const[l,s,o]of[["head",t.head,t.headSize],["tail",t.tail,t.tailSize]]){if(s===void 0&&o===void 0)continue;const a=es(e,l),i=s??a?.type??"none",r=o??a?.length;Ky(e,l,{type:i,...r===void 0||i==="none"?{}:{width:o??a?.width??r,length:r}})}t.cap!==void 0&&Oi(e,t.cap),t.join!==void 0&&Ui(e,t.join),t.compound!==void 0&&Wy(e,t.compound==="sng"?null:t.compound)}function Bp(e,t,n,l){const s=[];for(const o of n){const a=Xe(e,t,o);if(!a)return null;const i=ql(a.frame);s.push({placed:a,start:l?i.y:i.x,length:l?i.height:i.width})}return s.length===0?null:s}function Op(e,t,n,l){if(l==="slide"){const s=Ga(e);return{start:0,end:n?s.height:s.width}}return{start:Math.min(...t.map(s=>s.start)),end:Math.max(...t.map(s=>s.start+s.length))}}function Up(e,t,n){const l=e.filter(({item:s,at:o})=>Math.round(o)!==Math.round(s.start));if(l.length===0)return!1;if(n)for(const{item:s,at:o}of l){const{frame:a}=s.placed,i=o-s.start;sn(s.placed,{...a,x:a.x+(t?0:i),y:a.y+(t?i:0)})}return!0}const Zw={alignShapesTo:e=>({presentation:t,dispatch:n})=>{const l=["top","middle","bottom"].includes(e.edge),s=Bp(t,e.slide,e.shapes,l);if(!s)return!1;const{start:o,end:a}=Op(t,s,l,e.to),i=r=>e.edge==="left"||e.edge==="top"?o:e.edge==="right"||e.edge==="bottom"?a-r:(o+a-r)/2;return Up(s.map(r=>({item:r,at:i(r.length)})),l,n)},distributeShapesTo:e=>({presentation:t,dispatch:n})=>{const l=e.axis==="vertical",s=Bp(t,e.slide,e.shapes,l);if(!s||e.to==="selection"&&s.length<3)return!1;const{start:o,end:a}=Op(t,s,l,e.to),i=[...s].sort((d,p)=>d.start+d.length/2-(p.start+p.length/2)),r=a-o-i.reduce((d,p)=>d+p.length,0),u=i.length===1?r/2:r/(i.length-1);let c=i.length===1?o+u:o;return Up(i.map(d=>{const p=c;return c+=d.length+u,{item:d,at:p}}),l,n)}};function Yw(e,t){return Fc(e,t).flatMap(n=>{const l=Ht(n.kind==="softEdge"||n.kind==="blur"||n.kind==="reflection"?null:n.color)??"#000000",s="opacity"in n&&n.opacity!==void 0?{opacity:n.opacity}:{};switch(n.kind){case"outerShdw":return[{kind:"shadow",value:{color:l,blurEmu:n.blurEmu,offsetEmu:n.distEmu,angleDeg:n.angleDeg,...s}}];case"innerShdw":return[{kind:"innerShadow",value:{color:l,blurEmu:n.blurEmu,offsetEmu:n.distEmu,angleDeg:n.angleDeg,...s}}];case"glow":return[{kind:"glow",value:{color:l,radiusEmu:n.radiusEmu,...s}}];case"softEdge":return[{kind:"softEdge",value:n.radiusEmu}];case"reflection":return[{kind:"reflection",value:{blurEmu:n.blurEmu,offsetEmu:n.distEmu,angleDeg:n.angleDeg,...s,...n.startOpacity===void 0?{}:{startOpacity:n.startOpacity},...n.endPosition===void 0?{}:{endPosition:n.endPosition},...n.scaleY===void 0?{}:{scaleY:n.scaleY},...n.alignment===void 0?{}:{alignment:n.alignment}}}];default:return[]}})}function Jw(e,t){const n=fs(e,t),l=n.fill==="pattern"?B0(e,t):null,s=n.fill==="solid"&&n.fillColor?{kind:"solid",color:n.fillColor,...n.fillOpacity<1?{opacity:n.fillOpacity}:{}}:n.fill==="gradient"&&n.gradient?{kind:"gradient",...n.gradient}:l?{kind:"pattern",preset:l.preset,foreground:Ht(l.foreground)??"#000000",background:Ht(l.background)??"#FFFFFF"}:n.fill==="none"?{kind:"none"}:null,o=Jl(e,t,0,0)??{},a=Ht(o.color);return{fill:s,line:n.lineColor===null?{color:null}:{color:n.lineColor,...n.lineWidth===null?{}:{width:n.lineWidth},dash:n.dash,head:n.head,tail:n.tail},effects:Yw(e,t),text:{...a?{color:a}:{},...o.size===void 0?{}:{size:o.size},bold:o.bold===!0,italic:o.italic===!0}}}function ek(e,t){t.fill&&hs(e,t.fill),vs(e,t.line),wn(e,{kind:"none"});for(const n of t.effects)wn(e,n);nt(e,Kn(t.text))}function tk(e){return({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=(e.newest&&l?[Dn(l)]:e.shapes??[]).map(o=>le(t,e.slide,o));if(s.length===0||s.some(o=>o===null||st(o)!=="text"))return!1;if(n)for(const o of s)ek(o,e.look);return!0}}const No=["text","picture","table","chart","group","connector","media","other"];function nk(e){const t=st(e)==="picture"?cl(e):null;return{aspectLocked:Ai(e),title:to(e)??"",description:Ec(e)??"",natural:t?{width:t.width,height:t.height}:null}}function Np(e,t,n){const l=tt(e);l&&bl(e,{...l,w:j(Math.max(1,Math.round(t))),h:j(Math.max(1,Math.round(n)))})}const Rp=e=>e===null||e.trim()===""?null:e,lk={setShapeAspectLock:e=>({presentation:t,dispatch:n})=>{const l=zt(t,e.slide,e.shapes,No);return l?(n&&Ay(l,e.locked),!0):!1},scaleShapes:e=>({presentation:t,dispatch:n})=>{const l=[e.x,e.y].every(s=>Number.isFinite(s)&&s>0&&s<=100)?zt(t,e.slide,e.shapes,No):null;if(!l||l.some(s=>tt(s)===null||uo(s)))return!1;if(n)for(const s of l)Np(s,tt(s).w*e.x,tt(s).h*e.y);return!0},resetPictureSize:e=>({presentation:t,dispatch:n})=>{const l=zt(t,e.slide,e.shapes,["picture"]),s=l?.map(cl);if(!l||!s||s.some(a=>a===null)||l.some(uo))return!1;const o=a=>{const i=Ic(a);return{x:1-(i?.left??0)-(i?.right??0),y:1-(i?.top??0)-(i?.bottom??0)}};return n&&l.forEach((a,i)=>Np(a,s[i].width*o(a).x,s[i].height*o(a).y)),!0},setShapeAltText:e=>({presentation:t,dispatch:n})=>{const l=e.title===void 0&&e.description===void 0?null:zt(t,e.slide,e.shapes,No);if(!l)return!1;if(n)for(const s of l)e.title!==void 0&&od(s,Rp(e.title)),e.description!==void 0&&Ey(s,Rp(e.description));return!0}},jp=["text","connector","picture"];function gs(e,t,n,l){return({presentation:s,dispatch:o})=>{const a=n?zt(s,e.slide,e.shapes,t):null;if(a===null)return!1;if(o)for(const i of a)l(i,s);return!0}}function sk(e,t,n){const l=fs(e,t);if(l.fill==="solid")Rn(t,{color:Zl(e,t).slice(0,7),opacity:n});else if(l.fill==="gradient"){const s=Vp(Dc(e,t));s&&ad(t,ms({...s,stops:s.stops.map(o=>({...o,opacity:n}))}))}else l.fill==="image"&&V0(t)&&Vi(t,n>=1?null:n)}const ok={name:"drawing",addCommands:()=>({setShapeFillStyle:e=>gs(e,["text"],Qw(e.fill),t=>hs(t,e.fill)),setShapeFillOpacity:e=>gs(e,["text"],Number.isFinite(e.opacity)&&e.opacity>=0&&e.opacity<=1,(t,n)=>sk(n,t,e.opacity)),setShapeLineStyle:e=>gs(e,jp,Xw(e.line),t=>vs(t,e.line)),setShapeEffect:e=>gs(e,jp,!0,t=>wn(t,e.effect)),applyShapeStyle:e=>({presentation:t,dispatch:n})=>{const l=Wu(t).find(o=>o.id===e.style),s=l?zt(t,e.slide,e.shapes,["text"]):null;if(!l||s===null)return!1;if(n)for(const o of s)hs(o,l.fill),vs(o,l.line),wn(o,{kind:"shadow",value:null}),wn(o,{kind:"glow",value:null}),l.effect&&wn(o,l.effect),Qt(l.text)&&nt(o,{color:l.text});return!0},changeShapePreset:e=>gs(e,["text","picture"],/^[a-zA-Z0-9]+$/u.test(e.preset),t=>dd(t,e.preset)),applyShapeLook:tk,...lk,...Zw})},ak=[["down","线性向下",{path:"linear",angle:90}],["diagonal","线性对角",{path:"linear",angle:45}],["centre","从中心射线",{path:"circle",angle:0,focus:{x:.5,y:.5}}],["corner","从左上角射线",{path:"circle",angle:0,focus:{x:0,y:0}}]];function bs(e){const t=Og(e);return[1,2,3,4,5,6].flatMap(n=>{const l=t[`accent${n}`];return ak.map(([s,o,a])=>({id:`accent${n}-${s}`,label:`强调 ${n}:${o}`,gradient:{...a,stops:[{offset:0,color:Hu(l,"#FFFFFF",.6)},{offset:1,color:l}]}}))})}const vr=[["pct10","10%"],["pct25","25%"],["pct50","50%"],["pct75","75%"],["ltHorz","浅色横线"],["ltVert","浅色竖线"],["ltUpDiag","浅色上对角线"],["ltDnDiag","浅色下对角线"],["smGrid","小网格"],["lgCheck","大棋盘"],["diagBrick","对角砖形"],["wave","波浪线"]];function ik(e){return({presentation:t,dispatch:n})=>{const l=zt(t,e.slide,[e.shape],["picture"])?.[0],s=l?un(l):null,o=ae(t,e.slide);if(!s||!o)return!1;if(n)for(const a of e.all?pe(t):[o])hd(a,s.slice());return!0}}function kn(e,t,n,l=!1){return({presentation:s,dispatch:o})=>{const a=t?zt(s,e.slide,e.shapes,["picture"]):null;if(l&&a?.some(uo))return!1;const i=a?e.shapes.map(r=>Xe(s,e.slide,r)):null;return!a||!i||i.some(r=>r===null)?!1:(o&&a.forEach((r,u)=>n(r,i[u].frame,i[u])),!0)}}function $l(e,t,n){sn(e,t);const l=Object.values(n).some(s=>Math.abs(s)>1e-6);id(e.shape,l?n:null)}const Sl=.02,_n={left:0,top:0,right:0,bottom:0};function ys(e,t){const n=e.width/Math.max(Sl,1-t.left-t.right),l=e.height/Math.max(Sl,1-t.top-t.bottom);return{x:e.x-t.left*n,y:e.y-t.top*l,width:n,height:l}}function Kp(e,t){return{left:(t.x-e.x)/e.width,top:(t.y-e.y)/e.height,right:(e.x+e.width-t.x-t.width)/e.width,bottom:(e.y+e.height-t.y-t.height)/e.height}}function rk(e,t,n,l,s){const o=t.width*Sl,a=t.height*Sl;let i=e.x,r=e.y,u=e.x+e.width,c=e.y+e.height;return n.left&&(i=Math.min(i+l,u-o)),n.right&&(u=Math.max(u+l,i+o)),n.top&&(r=Math.min(r+s,c-a)),n.bottom&&(c=Math.max(c+s,r+a)),{x:Math.round(i),y:Math.round(r),width:Math.round(u-i),height:Math.round(c-r)}}function uk(e,t,n){const l=ys(e,t),s=Math.min(l.width,l.height*n),o=s/n,a=Math.min(Math.max(e.x+e.width/2,l.x+s/2),l.x+l.width-s/2),i=Math.min(Math.max(e.y+e.height/2,l.y+o/2),l.y+l.height-o/2),r={x:Math.round(a-s/2),y:Math.round(i-o/2),width:Math.round(s),height:Math.round(o)};return{frame:r,crop:Kp(l,r)}}function gr(e,t){const n=e.width/e.height,l=t.width/t.height;if(Math.abs(n-l)<.001)return _n;if(l>n){const o=(1-n/l)/2;return{left:o,top:0,right:o,bottom:0}}const s=(1-l/n)/2;return{left:0,top:s,right:0,bottom:s}}function ck(e,t){const n=e.width/e.height,l=t.width/t.height;if(Math.abs(n-l)<.001)return _n;if(l>n){const o=(1-l/n)/2;return{left:0,top:o,right:0,bottom:o}}const s=(1-n/l)/2;return{left:s,top:0,right:s,bottom:0}}function Wp(e){const t=e.rotation*Math.PI/180,[n,l]=[Math.cos(t),Math.sin(t)],[s,o]=[e.flipH?-1:1,e.flipV?-1:1];return[n*s,-l*o,l*s,n*o]}function dk(e,t,n){const[l,s,o,a]=Wp(n),i=l*a-s*o;return{dx:(a*e-s*t)/i,dy:(-o*e+l*t)/i}}function pk(e,t,n,l){const[s,o,a,i]=Wp(l),r=t.x+t.width/2-(e.x+e.width/2),u=t.y+t.height/2-(e.y+e.height/2),c=Math.round((s-1)*r+o*u),d=Math.round(a*r+(i-1)*u);return{frame:{...t,x:t.x+c,y:t.y+d},image:{...n,x:n.x+c,y:n.y+d}}}const qp=51206400;function fk(e,t,n,l){const s=Math.max(1,Math.min(n,t)),o=Math.ceil(t/s),a=(e.width-l*(s-1))/s,i=(e.height-l*(o-1))/o;return Array.from({length:t},(r,u)=>{const c=Math.floor(u/s),d=(s-Math.min(s,t-c*s))*(a+l)/2,p=u%s;return{x:Math.round(e.x+d+p*(a+l)),y:Math.round(e.y+c*(i+l)),width:Math.round(a),height:Math.round(i)}})}function mk(e){return({presentation:t,dispatch:n})=>{const l=e.shapes.length>=2&&Number.isInteger(e.columns)&&e.columns>=1&&e.gap>=0,s=l?e.shapes.map(c=>Xe(t,e.slide,c)?.frame??null):[];if(!l||s.some(c=>c===null||c.rotation!==0))return!1;const o=e.shapes.map((c,d)=>({id:c,frame:s[d]})).sort((c,d)=>Math.abs(c.frame.y-d.frame.y)>c.frame.height/2?c.frame.y-d.frame.y:c.frame.x-d.frame.x),a=Math.min(...s.map(c=>c.x)),i=Math.min(...s.map(c=>c.y)),r=fk({x:a,y:i,width:Math.max(...s.map(c=>c.x+c.width))-a,height:Math.max(...s.map(c=>c.y+c.height))-i},o.length,e.columns,e.gap);if(r.some(c=>!(c.width>0&&c.height>0)||c.width>qp||c.height>qp))return!1;const u=new Map(r.map((c,d)=>[o[d].id,c]));return kn({slide:e.slide,shapes:o.map(c=>c.id)},!0,(c,d,p)=>{const f=u.get(Fe(c)),h=cl(c);f&&$l(p,f,h?gr(f,h):_n)},!0)({presentation:t,dispatch:n})}}function hk(e){return kn(e,e.mode==="fill"||e.mode==="fit",(t,n,l)=>{const s=cl(t);s&&$l(l,n,e.mode==="fill"?gr(n,s):ck(n,s))})}const _p={brightness:.7,contrast:-.7};function vk(e,t){const n=L0(e,t);return n&&(n.firstColor||n.secondColor)?null:D0(t)!==null?"blackWhite":sy(t)?"grayscale":Lc(t)===_p.brightness&&Vc(t)===_p.contrast?"washout":"none"}function $n(e,t){const n=vk(e,t),l=Ic(t);return{crop:l?{left:l.left??0,top:l.top??0,right:l.right??0,bottom:l.bottom??0}:_n,brightness:n==="washout"?0:Lc(t)??0,contrast:n==="washout"?0:Vc(t)??0,recolor:n,opacity:Bc(t)??1,style:O0(t),rotation:hi(t),locked:uo(t),format:no(t),transparentColor:fb(t)}}const gk={"Simple Frame, White":"简单框架,白色","Beveled Matte, White":"棱台亚光,白色","Metal Frame":"金属框架","Drop Shadow Rectangle":"矩形投影","Reflected Rounded Rectangle":"圆角矩形倒影","Soft Edge Rectangle":"柔化边缘矩形","Double Frame, Black":"双框架,黑色","Thick Matte, Black":"厚重亚光,黑色","Simple Frame, Black":"简单框架,黑色","Beveled Oval, Black":"棱台椭圆,黑色","Compound Frame, Black":"复杂框架,黑色","Moderate Frame, Black":"中等复杂框架,黑色","Center Shadow Rectangle":"居中矩形阴影","Rounded Diagonal Corner, White":"圆形对角,白色","Snip Diagonal Corner, White":"剪去对角,白色","Moderate Frame, White":"中等复杂框架,白色","Rotated, White":"旋转,白色","Perspective Shadow, White":"透视阴影,白色","Relaxed Perspective, White":"松散透视,白色","Soft Edge Oval":"柔化边缘椭圆","Bevel Rectangle":"棱台矩形","Bevel Perspective":"棱台透视","Reflected Perspective Right":"映像右透视","Bevel Perspective Left, White":"棱台左透视,白色","Reflected Bevel, Black":"映像棱台,黑色","Reflected Bevel, White":"映像棱台,白色","Metal Rounded Rectangle":"金属圆角矩形","Metal Oval":"金属椭圆"};function bk(e,t,n){return n.every(l=>{const s=le(e,t,l);return s!==null&&un(s)!==null})}const Gp=(e,t)=>e===void 0||Number.isFinite(e)&&Math.abs(e)<=t;function yk(e,t){t.recolor!==void 0&&(t.recolor==="washout"?bo(e,{kind:"washout"}):(bo(e,{kind:"none"}),t.recolor==="grayscale"&&bo(e,{kind:"grayscale"}),t.recolor==="blackWhite"&&bo(e,{kind:"threshold",threshold:50}))),t.brightness!==void 0&&Ly(e,t.brightness===0?null:t.brightness),t.contrast!==void 0&&Iy(e,t.contrast===0?null:t.contrast),t.opacity!==void 0&&Vi(e,t.opacity>=1?null:t.opacity)}const xk={name:"picture",addCommands:()=>({cropPicture:e=>kn({slide:e.slide,shapes:[e.shape]},e.frame.width>0&&e.frame.height>0&&Object.values(e.crop).every(t=>Number.isFinite(t)),(t,n,l)=>$l(l,e.frame,e.crop),!0),cropPictureToRatio:e=>({presentation:t,dispatch:n})=>kn(e,Number.isFinite(e.ratio)&&e.ratio>0,(l,s,o)=>{const a=uk(s,$n(t,l).crop,e.ratio);$l(o,a.frame,a.crop)},!0)({presentation:t,dispatch:n}),replacePicture:e=>t=>bk(t.presentation,e.slide,e.shapes)&&kn(e,e.bytes.length>0,(n,l,s)=>{id(n,null),Li(n,e.bytes);const o=cl(n);$l(s,l,o?gr(l,o):_n)})(t),resetPicture:e=>kn(e,!0,(t,n,l)=>{dy(t),Vi(t,null),kc(t),ho(t,null),i0(t),a0(t),dd(t,"rect");const s=cl(t);$l(l,s?{...n,height:Math.round(n.width*s.height/s.width)}:n,_n)},!0),setPictureColor:e=>kn(e,Object.keys(e.color).length>0&&Gp(e.color.brightness,1)&&Gp(e.color.contrast,1)&&(e.color.opacity===void 0||e.color.opacity>=0&&e.color.opacity<=1),t=>yk(t,e.color)),setPictureStyle:e=>kn(e,vc.includes(e.style),t=>cd(t,e.style)),setPictureImage:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);return!l||st(l)!=="picture"||e.bytes.length===0||!un(l)?!1:(n&&(Li(l,e.bytes),Vy(l,e.compression)),!0)},setPictureAsBackground:ik,setSvgPictureColor:Rg,setPictureTransparentColor:Fg,fitPicture:hk,arrangePictures:mk})};function wk(e,t,n,l,s){const o=n.right?1:-1,a=n.bottom?1:-1,i=(o*l*e.width+a*s*e.height)/(e.width**2+e.height**2),r=Math.min(t.width/Sl/e.width,t.height/Sl/e.height),u=Math.max(t.width*.1/e.width,t.height*.1/e.height,1/Math.min(e.width,e.height)),c=Math.min(r,Math.max(u,1+i)),d=e.width*c,p=e.height*c,f=n.right?e.x:e.x+e.width-d,h=n.bottom?e.y:e.y+e.height-p;return{x:Math.round(f),y:Math.round(h),width:Math.round(d),height:Math.round(p)}}function Hp(e){switch(e.kind){case"shadow":return{shadow:e.value,innerShadow:null};case"innerShadow":return{innerShadow:e.value,shadow:null};case"glow":return{glow:e.value};case"reflection":return{reflection:e.value};case"none":return{shadow:null,innerShadow:null,glow:null,reflection:null};default:return null}}const br={color:"#000000",opacity:.35,blurEmu:50800,offsetEmu:38100,angleDeg:45},yr=[{id:"fill-accent",label:"填充:主题色",format:{color:"accent1"}},{id:"fill-dark-shadow",label:"填充:深色,阴影",format:{color:"tx1",shadow:br}},{id:"fill-white-outline",label:"填充:白色,轮廓:主题色",format:{color:"bg1",outline:{color:"accent1",widthEmu:19050},shadow:br}},{id:"outline-accent",label:"空心:主题色",format:{textFill:{kind:"none"},outline:{color:"accent1",widthEmu:19050}}},{id:"gradient-accent",label:"渐变:主题色",format:{textFill:{kind:"gradient",angleDeg:90,stops:[{offset:0,color:"accent1"},{offset:1,color:"accent2"}]}}},{id:"gradient-warm",label:"渐变:暖色",format:{textFill:{kind:"gradient",angleDeg:90,stops:[{offset:0,color:"accent4"},{offset:1,color:"accent2"}]},shadow:br}},{id:"glow-accent",label:"填充:主题色,发光",format:{color:"accent1",glow:{color:"accent1",radiusEmu:101600,opacity:.4}}},{id:"reflection-dark",label:"填充:深色,倒影",format:{color:"tx1",reflection:{blurEmu:6350,offsetEmu:0,startOpacity:.5,opacity:0,endPosition:.55}}}],kk={name:"wordart",addCommands:()=>({addWordArt:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=yr.find(o=>o.id===e.preset);if(l===null||!s||e.width<=0||e.height<=0)return!1;if(n){const o=Ys(l,{x:j(e.x),y:j(e.y),w:j(e.width),h:j(e.height),text:e.text});fn(o,"艺术字"),nt(o,{size:54,bold:!0,...s.format}),Nn(o,"center"),wl(o,"center")}return!0}})},$k=[{id:"fill-white-shadow",label:"填充:白色,阴影",format:{color:"bg1",shadow:{color:"#000000",opacity:.35,blurEmu:50800,offsetEmu:38100,angleDeg:45}}},{id:"fill-accent2-outline",label:"填充:强调 2,轮廓:白色",format:{color:"accent2",outline:{color:"bg1",widthEmu:12700}}},{id:"outline-dark",label:"空心:深色",format:{textFill:{kind:"none"},outline:{color:"tx1",widthEmu:12700}}},{id:"gradient-cool",label:"渐变:冷色",format:{textFill:{kind:"gradient",angleDeg:90,stops:[{offset:0,color:"accent5"},{offset:1,color:"accent1"}]}}},{id:"gradient-accent-outline",label:"渐变:主题色,轮廓:深色",format:{textFill:{kind:"gradient",angleDeg:0,stops:[{offset:0,color:"accent1"},{offset:1,color:"accent6"}]},outline:{color:"tx1",widthEmu:6350}}},{id:"fill-accent-inner",label:"填充:主题色,内部阴影",format:{color:"accent1",innerShadow:{color:"#000000",opacity:.5,blurEmu:38100,offsetEmu:25400,angleDeg:45}}},{id:"glow-warm",label:"填充:白色,发光:暖色",format:{color:"bg1",glow:{color:"accent2",radiusEmu:76200,opacity:.6}}},{id:"fill-accent-reflection",label:"填充:主题色,倒影",format:{color:"accent1",reflection:{startOpacity:.5,opacity:0,endPosition:.5,offsetEmu:0,scaleY:-1,alignment:"bl"}}}],Qp=[...yr,...$k],Xp={outline:null,shadow:null,innerShadow:null,glow:null,reflection:null},Ro={left:91440,top:45720,right:91440,bottom:45720};function xs(e,t){const n=P0(e,t);return{autoFit:n.autoFit??"none",margins:{left:n.margins.left??Ro.left,top:n.margins.top??Ro.top,right:n.margins.right??Ro.right,bottom:n.margins.bottom??Ro.bottom},wrap:n.wrap!=="none",columns:n.columns?.count??1,columnGap:n.columns?.gapEmu??0}}function Sk(e,t){const n=e.margins?Object.values(e.margins):[];return(Object.keys(e).length>0||t!==void 0)&&n.every(l=>Number.isFinite(l)&&l>=0&&l<=51206400)&&(e.columns===void 0||Number.isInteger(e.columns)&&e.columns>=1&&e.columns<=16)&&(e.columnGap===void 0||Number.isFinite(e.columnGap)&&e.columnGap>=0)&&(t===void 0||Number.isFinite(t)&&t>0)}function Ck(e,t,n,l){if(n.autoFit!==void 0&&_y(t,n.autoFit),n.margins&&Hy(t,n.margins),n.wrap!==void 0&&Qy(t,n.wrap?"square":"none"),n.columns!==void 0||n.columnGap!==void 0){const o=xs(e,t),a=n.columns??o.columns,i=n.columnGap??o.columnGap;Gy(t,a===1?null:{count:a,...i>0?{gapEmu:i}:{}})}const s=tt(t);l!==void 0&&s&&bl(t,{...s,h:j(Math.round(l))})}function ws(e,t){return({presentation:n,dispatch:l})=>{const s=t===null?null:zt(n,e.slide,e.shapes,["text"]);if(!s||!t)return!1;const o=e.range&&e.range.end>e.range.start?{range:{start:e.range.start,end:e.range.end}}:void 0;if(l)for(const a of s)nt(a,t,o);return!0}}function Mk(e){return e.kind==="solid"?Qt(e.color)?{color:e.color}:null:e.kind==="none"?{textFill:{kind:"none"}}:e.stops.length>=2&&e.stops.every(t=>Qt(t.color))?{textFill:{kind:"gradient",...ms(e)}}:null}function Pk(e){if(e===null)return{outline:null};if(!(e.width>0&&e.width<=100))return null;const t=j(Math.round(e.width*Ip));return!("gradient"in e)&&!("color"in e)?{outline:{widthEmu:t}}:"gradient"in e?e.gradient.stops.length>=2?{outline:{fill:{kind:"gradient",...ms(e.gradient)},widthEmu:t}}:null:Qt(e.color)?{outline:{color:e.color,widthEmu:t}}:null}const Tk={name:"text-tools",addCommands:()=>({applyWordArtStyle:e=>{const t=Qp.find(n=>n.id===e.style);return ws(e,t?{...Xp,...t.format}:null)},setTextFill:e=>ws(e,Mk(e.fill)),setTextOutline:e=>ws(e,Pk(e.outline)),setTextEffect:e=>ws(e,Hp(e.effect)),setCharacterSpacing:e=>ws(e,Number.isFinite(e.points)&&Math.abs(e.points)<=1584?{spc:e.points===0?null:Math.round(e.points*100)}:null),setTextBoxOptions:e=>({presentation:t,dispatch:n})=>{const l=Sk(e.options,e.height)?zt(t,e.slide,e.shapes,["text"]):null;if(!l)return!1;if(n)for(const s of l)Ck(t,s,e.options,e.height);return!0},setTextWarp:Lg})};function xr(e,t){const n=Jl(e,t,0,0)??{},l=n.textFill?.kind,s=n.outline;return{fill:l===void 0?"solid":l==="gradient"||l==="none"?l:"other",color:l===void 0?Ht(n.color):null,outlineColor:s&&(s.widthEmu??1)>0?Ht(s.color):null,outlineWidth:s?.widthEmu===void 0?null:Math.round(s.widthEmu/12700*100)/100,outlineFill:!s||s.widthEmu===0?null:s.fill?.kind==="gradient"?"gradient":s.color?"solid":null,spacing:(n.spc??0)/100,effects:[...n.shadow?["shadow"]:[],...n.innerShadow?["innerShadow"]:[],...n.glow?["glow"]:[],...n.reflection?["reflection"]:[]]}}const Zp=/^#[0-9a-f]{6}$/iu,Yp={min:914400,max:51206400},Ak={name:"design",addCommands:()=>({setThemeColors:e=>({presentation:t,dispatch:n})=>Object.values(e.colors).every(l=>Zp.test(l))?(n&&gl(t,{...e.colors,...e.name?{name:e.name}:{}}),!0):!1,setThemeFonts:e=>({presentation:t,dispatch:n})=>Object.values(e.fonts).every(l=>l.trim()!=="")?(n&&zi(t,e.fonts),!0):!1,setMasterBackgroundStyle:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return!l||!Number.isInteger(e.style)||e.style<1||e.style>12?!1:(n&&gd(l,e.style),!0)},setDeckSlideSize:e=>({presentation:t,dispatch:n})=>{const l=Math.round(e.width),s=Math.round(e.height);return[l,s].every(o=>o>=Yp.min&&o<=Yp.max)?(n&&wo(t,{width:j(l),height:j(s)},{content:e.content}),!0):!1},setSlideBackgroundFill:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),{fill:s}=e;return l?s.kind==="gradient"?s.stops.length<2||!s.stops.every(o=>Zp.test(o.color)&&o.offset>=0&&o.offset<=1)?!1:(n&&Zy(l,{stops:s.stops.map(o=>({offset:o.offset,color:wc(o.color)})),angleDeg:s.angle,...s.path&&s.path!=="linear"?{path:s.path}:{}}),!0):s.bytes.length===0?!1:(n&&hd(l,s.bytes),!0):!1},setBackgroundGraphicsHidden:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l?(n&&Yy(l,e.hidden),!0):!1},applyBackgroundToAll:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l?(n&&l0(t,l),!0):!1},addSlideOnLayout:e=>({presentation:t,dispatch:n})=>{const l=ul(t,e.layout);if(!l)return!1;if(!n)return!0;const s=bc(t,{layout:l});return e.after!==void 0&&Un(t,s,Math.min(e.after+1,pe(t).length-1)),!0},resetSlideBackground:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);return l?(n&&u0(l),!0):!1}})};function Jp(e){const{x:t,y:n,width:l,height:s}=e;return![t,n,l,s].every(Number.isFinite)||l<=0||s<=0?null:{x:j(Math.round(t)),y:j(Math.round(n)),w:j(Math.round(l)),h:j(Math.round(s))}}const Cl=(e,t)=>ul(e,t),ef=(e,t)=>ss(e).includes(t),Ek={name:"master",addCommands:()=>({addLayout:e=>({presentation:t,dispatch:n})=>ef(t,e.master)?(n&&t0(t,e.master),!0):!1,removeLayout:e=>({presentation:t,dispatch:n})=>{const l=Cl(t,e.layout);if(!l||ki(t,l).length>0)return!1;if(!n)return!0;try{return iy(l),!0}catch{return!1}},renameLayout:e=>({presentation:t,dispatch:n})=>{const l=Cl(t,e.layout),s=e.name.trim();return!l||!s?!1:(n&&l1(l,s),!0)},setLayoutBackground:e=>({presentation:t,dispatch:n})=>{const l=Cl(t,e.layout);return!l||e.color!==null&&!/^#[0-9a-f]{6}$/iu.test(e.color)?!1:(n&&(e.color===null?d0(l):t1(l,e.color)),!0)},setLayoutParts:e=>({presentation:t,dispatch:n})=>{const l=Cl(t,e.layout);return!l||e.title===void 0&&e.footers===void 0&&e.graphicsHidden===void 0?!1:(n&&(e.title!==void 0&&o1(l,e.title),e.footers!==void 0&&vd(l,e.footers),e.graphicsHidden!==void 0&&n1(l,e.graphicsHidden)),!0)},addLayoutPlaceholder:e=>({presentation:t,dispatch:n})=>{const l=Cl(t,e.layout),s=Jp(e.bounds);return!l||!s?!1:(n&&n0(l,e.kind,s),!0)},setLayoutPlaceholderBounds:e=>({presentation:t,dispatch:n})=>{const l=Cl(t,e.layout),s=Jp(e.bounds);return!l||!s||!ns(l)[e.index]?!1:(n&&s1(l,e.index,s),!0)},setMasterPlaceholder:e=>({presentation:t,dispatch:n})=>ef(t,e.master)?(n&&bd(t,e.master,e.type,e.included),!0):!1})},jo=914400/576;function Fk(e){const t=b0(e);return t===null||Js(e)!=="legacy"?t:{x:Math.round(t.x*jo),y:Math.round(t.y*jo)}}function tf(e,t){return{index:t,author:v0(e).name,date:g0(e),text:Cc(e)}}function Ko(e){const t=ao(e);return t.flatMap((n,l)=>{if(ri(n)!==null)return[];const s=Js(n)==="modern"?y0(n):null;return[{...tf(n,l),position:Fk(n),resolved:s===null?null:s!=="active",replies:t.flatMap((o,a)=>ri(o)===n?[tf(o,a)]:[])}]})}function Wo(e,t,n){const l=ae(e,t),s=l===null?void 0:ao(l)[n];return l===null||s===void 0?null:{slide:l,comment:s}}const zk={name:"comments",addCommands:()=>({addComment:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(l===null||e.text.trim().length===0||e.author.name.trim().length===0)return!1;if(!n)return!0;const s=e.text.trim(),o=li(l,{author:e.author,text:s,position:e.position});return e.position&&Js(o)==="legacy"&&(td(o),li(l,{author:e.author,text:s,position:{x:Math.round(e.position.x/jo),y:Math.round(e.position.y/jo)}})),!0},replyComment:e=>({presentation:t,dispatch:n})=>{const l=Wo(t,e.slide,e.index);if(l===null||e.text.trim().length===0)return!1;const s=ri(l.comment)??l.comment;return n&&li(l.slide,{author:e.author,text:e.text.trim(),replyTo:s}),!0},editComment:e=>({presentation:t,dispatch:n})=>{const l=Wo(t,e.slide,e.index);return l===null||e.text.trim().length===0||Cc(l.comment)===e.text.trim()?!1:(n&&by(l.comment,e.text.trim()),!0)},setCommentResolved:e=>({presentation:t,dispatch:n})=>{const l=Wo(t,e.slide,e.index);return l===null||Js(l.comment)!=="modern"?!1:(n&&gy(l.comment,e.resolved?"resolved":"active"),!0)},deleteComment:e=>({presentation:t,dispatch:n})=>{const l=Wo(t,e.slide,e.index);return l===null?!1:(n&&td(l.comment),!0)},deleteSlideComments:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(s=>ae(t,s)).filter(s=>s!==null&&ao(s).length>0);if(l.length===0)return!1;if(n)for(const s of l)c0(s);return!0}})},nf="【批注】";function lf(e){return Ko(e).flatMap(t=>[`${t.author}:${t.text}${t.resolved===!0?"(已解决)":""}`,...t.replies.map(n=>` ↳ ${n.author}:${n.text}`)])}function Dk(e){return pe(e).flatMap((t,n)=>{const l=lf(t);return l.length?[`第 ${n+1} 张${xi(t)?`:${xi(t)}`:""}`,...l,""]:[]}).join(`
|
|
7
|
+
`).trimEnd()}function Lk(e){const t=e.indexOf(nf);return t<0?-1:e.slice(0,t).endsWith(`
|
|
8
|
+
|
|
9
|
+
`)?t-2:e.slice(0,t).endsWith(`
|
|
10
|
+
`)?t-1:t}const Vk={name:"comment-notes",addCommands:()=>({copyCommentsToNotes:e=>({presentation:t,dispatch:n})=>{let l=!1;for(const s of pe(t)){const o=In(s)??"",a=Lk(o),i=e.remove?[]:lf(s);if(i.length===0&&a<0)continue;const r=a<0?o.length:a,u=i.length===0?"":`${r>0?`
|
|
11
|
+
|
|
12
|
+
`:""}${nf}
|
|
13
|
+
${i.join(`
|
|
14
|
+
`)}`;o.slice(r)!==u&&(l=!0,n&&Ri(s,u,{preserveFormatting:!0,range:{start:r,end:o.length}}))}return l}})};function sf(e){if(e.query.length===0)return null;const t=e.matchWidth===!1?[...e.query].map(Ik).join(""):e.query.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),n=e.wholeWord?`(?<![A-Za-z0-9_])${t}(?![A-Za-z0-9_])`:t;return new RegExp(n,e.matchCase?"gu":"giu")}function Ik(e){const t=e.codePointAt(0),n=t===12288?32:t>=65281&&t<=65374?t-65248:t,l=n===32?12288:n>=33&&n<=126?n+65248:n;if(n===l)return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");const s=o=>String.fromCodePoint(o).replace(/[\\\]^-]/gu,"\\$&");return`[${s(n)}${s(l)}]`}function wr(e){const t=[];for(const n of ot(e)){const l=st(n),s=Fe(n);try{l==="text"?t.push({location:{kind:"shape",shape:s},text:ze(n)}):l==="table"&&ml(n).forEach((o,a)=>o.forEach((i,r)=>{t.push({location:{kind:"cell",shape:s,row:a,column:r},text:cn(i)})}))}catch{}}return t.push({location:{kind:"notes"},text:In(e)??""}),t}function of(e,t){const n=sf(t);if(n===null)return[];const l=[];return pe(e).forEach((s,o)=>{const a=We(s);for(const i of wr(s))for(const r of i.text.matchAll(n))l.push({slide:a,slideIndex:o,location:i.location,start:r.index,end:r.index+r[0].length,text:r[0]})}),l}function kr(e,t,n){const l=ae(e,t);if(l===null)return null;if(n.kind==="notes")return{text:In(l)??"",write:(o,a,i)=>Ri(l,i,{preserveFormatting:!0,range:{start:o,end:a}})};const s=le(e,t,n.shape);if(s===null)return null;try{if(n.kind==="shape")return{text:ze(s),write:(a,i,r)=>at(s,r,{preserveFormatting:!0,range:{start:a,end:i}})};const o=ml(s)[n.row]?.[n.column];return o?{text:cn(o),write:(a,i,r)=>Kt(o,r,{range:{start:a,end:i}})}:null}catch{return null}}function Bk(e){return e.kind==="notes"?"notes":e.kind==="shape"?`shape:${e.shape}`:`cell:${e.shape}:${e.row}:${e.column}`}const Ok={name:"find",addCommands:()=>({replaceTextMatch:e=>({presentation:t,dispatch:n})=>{const{match:l}=e,s=kr(t,l.slide,l.location);return s===null||s.text.slice(l.start,l.end)!==l.text?!1:(n&&s.write(l.start,l.end,e.replace),!0)},replaceAllText:e=>({presentation:t,dispatch:n})=>{const l=of(t,e);if(l.length===0)return!1;if(!n)return!0;const s=new Map;for(const a of l){if(a.location.kind==="notes")continue;const i=`${a.slide}|${Bk(a.location)}`;s.set(i,[...s.get(i)??[],a])}for(const a of s.values()){const i=kr(t,a[0].slide,a[0].location);for(const r of[...a].reverse())i?.write(r.start,r.end,e.replace)}const o=sf(e);for(const a of new Set(l.filter(i=>i.location.kind==="notes").map(i=>i.slide))){const i=ae(t,a);i&&cy(i,o,e.replace.replace(/\$/gu,"$$$$"))}return!0}})},af={latin:"font",eastAsian:"fontEastAsian"},rf={latin:["majorLatin","minorLatin"],eastAsian:["majorEastAsian","minorEastAsian"]},ks=e=>typeof e=="string"&&e.length>0&&!e.startsWith("+")?e:null;function uf(e,t){for(const n of pe(e))for(const l of ot(n)){const s=st(l);try{if(s==="text")for(let o=0;o<pl(l);o+=1)for(let a=0;a<Nc(l,o);a+=1){const i=N0(l,o,a);t({latin:ks(i?.font),eastAsian:ks(i?.fontEastAsian)},(r,u)=>pd(l,o,a,{[af[r]]:u}))}else if(s==="table")for(const o of ml(l))for(const a of o)Uk(a,t)}catch{}}}function Uk(e,t){let n=0;for(const l of Gc(e)){for(const s of l.elements){const o=s.kind==="br"?1:"text"in s?s.text.length:0;if(s.kind==="r"&&o>0){const a={start:n,end:n+o};t({latin:ks(s.format?.font),eastAsian:ks(s.format?.fontEastAsian)},(i,r)=>So(e,{[af[i]]:r},{range:a}))}n+=o}n+=1}}function cf(e){const t={latin:new Set,eastAsian:new Set},n=Xl(e);for(const l of["latin","eastAsian"])for(const s of rf[l]){const o=ks(n?.[s]);o&&t[l].add(o)}return uf(e,l=>{l.latin&&t.latin.add(l.latin),l.eastAsian&&t.eastAsian.add(l.eastAsian)}),{latin:[...t.latin].sort(),eastAsian:[...t.eastAsian].sort()}}const Nk={name:"fonts",addCommands:()=>({replaceFont:e=>({presentation:t,dispatch:n})=>{const l=e.to.trim();if(l.length===0||l===e.from||!cf(t)[e.script].includes(e.from))return!1;if(!n)return!0;const s=Xl(t),o=rf[e.script].filter(a=>s?.[a]===e.from);return o.length>0&&zi(t,Object.fromEntries(o.map(a=>[a,l]))),uf(t,(a,i)=>{a[e.script]===e.from&&i(e.script,l)}),!0}})};function df(e,t,n){if(Yl(t)==="group"){const o=eo(t);eo(n).forEach((a,i)=>{o[i]&&df(e,o[i],a)});return}if(st(t)!=="text")return;const l=o=>typeof o=="string"&&/^#?[0-9a-f]{6}$/iu.test(o)?`#${o.replace("#","")}`:null;if(zc(e,t).kind==="solid"){const o=l(Zl(e,t));o&&Rn(n,o)}const s=l(oo(e,t));s&&xl(n,{color:s});try{for(let o=0;o<pl(t);o+=1)for(let a=0;a<Nc(t,o);a+=1){const i=l(Jl(e,t,o,a).color);i&&pd(n,o,a,{color:i})}}catch{}}const Rk={name:"object-extras",addCommands:()=>({renameShape:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape),s=e.name.trim();return l===null||s.length===0||dl(l)===s?!1:(n&&fn(l,s),!0)},setShapesHidden:e=>({presentation:t,dispatch:n})=>{const l=e.shapes.map(o=>le(t,e.slide,o));if(l.length===0||l.some(o=>o===null))return!1;const s=l.filter(o=>Xc(o)!==e.hidden);return s.length===0?!1:(n&&Dy(s,e.hidden),!0)},moveShapeTo:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape),s=le(t,e.slide,e.before),o=[e.shape,e.before].map(a=>{const i=Ha(t,e.slide,a);return i===null?void 0:i.length===0?null:Fe(i.at(-1))});return!l||!s||l===s||o[0]===void 0||o[0]!==o[1]||ts(l)===ts(s)?!1:(n&&xo(l,ts(s)),!0)},resetSlide:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=l===null?null:Pt(l);return l===null||s===null||ns(s).length===0?!1:(n&&py(l),!0)},pasteShapesKeepingFormat:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=ae(e.source,e.sourceSlide),o=s===null?null:e.shapes.map(a=>_l(s,a));if(l===null||o===null||o.length===0||o.some(a=>a===null))return!1;if(!n)return!0;for(const a of o){const i=ai(l,a);df(e.source,a,i);const r=tt(i);r&&e.offset!==0&&bl(i,{x:j(r.x+e.offset),y:j(r.y+e.offset),w:r.w,h:r.h})}return!0}})},$r="/ppt/presentation.xml",pf=/<([\w]+:)?section\b[^>]*>/gu;function jk(e){const t=jt(e,$r);return t?[...new TextDecoder().decode(t).matchAll(pf)].map(([n])=>/\sid="([^"]*)"/u.exec(n)?.[1]):[]}function Kk(e,t){const n=jt(e,$r);if(!n||t.every(a=>a===void 0))return;let l=0;const s=new Set,o=new TextDecoder().decode(n).replace(pf,a=>{const i=t[l];return l+=1,!i||s.has(i)?a:(s.add(i),a.replace(/(\sid=")[^"]*(")/u,`$1${i}$2`))});nd(e,$r,new TextEncoder().encode(o))}function it(e){const t=pe(e).length,n=J0(e).map(o=>({name:o.name,first:o.slides.length===0?null:Math.min(...o.slides.map(a=>Vn(e,a)).filter(a=>a>=0))}));if(n.length===0)return[];const l=jk(e),s=[];for(let o=0;o<n.length;o+=1){const a=n[o].first??n.slice(o+1).find(i=>i.first!==null)?.first??t;s.push(o===0?0:Math.max(s.at(-1)??0,Number.isFinite(a)?a:t))}return n.map((o,a)=>({name:o.name,start:s[a],count:(s[a+1]??t)-s[a],...l[a]?{id:l[a]}:{}}))}function Ml(e,t){const n=pe(e);yd(e,t.map(l=>({name:l.name,slides:n.slice(l.start,l.start+l.count)}))),Kk(e,t.map(l=>l.id))}function $s(e){let t=0;return e.map(n=>{const l={name:n.name,start:t,count:n.count,...n.id?{id:n.id}:{}};return t+=n.count,l})}const Wk={name:"sections",addCommands:()=>({addSection:e=>({presentation:t,dispatch:n})=>{const l=pe(t).length,s=e.name.trim();if(s.length===0||e.at<0||e.at>l)return!1;const o=it(t);let a;if(o.length===0)a=e.at===0?[{name:s,count:l}]:[{name:"默认节",count:e.at},{name:s,count:l-e.at}];else{const i=Math.max(0,o.map(u=>u.start<=e.at).lastIndexOf(!0)),r=o[i];a=[...o.slice(0,i),{name:r.name,count:e.at-r.start,...r.id?{id:r.id}:{}},{name:s,count:r.start+r.count-e.at},...o.slice(i+1)]}return n&&Ml(t,$s(a)),!0},renameSection:e=>({presentation:t,dispatch:n})=>{const l=it(t),s=e.name.trim();return!l[e.index]||s.length===0||l[e.index].name===s?!1:(n&&Ml(t,l.map((o,a)=>a===e.index?{...o,name:s}:o)),!0)},removeSection:e=>({presentation:t,dispatch:n})=>{const l=it(t),s=l[e.index];if(!s)return!1;const o=pe(t);if(e.slides&&s.count>=o.length)return!1;if(!n)return!0;if(e.slides){for(const r of o.slice(s.start,s.start+s.count))Ei(t,r);return Ml(t,$s(l.filter((r,u)=>u!==e.index))),!0}const a=l.map(r=>({name:r.name,count:r.count,...r.id?{id:r.id}:{}})),i=e.index>0?e.index-1:1;return a[i]&&(a[i].count+=s.count),Ml(t,a.length===1?[]:$s(a.filter((r,u)=>u!==e.index))),!0},removeAllSections:()=>({presentation:e,dispatch:t})=>it(e).length===0?!1:(t&&yd(e,[]),!0),moveSection:e=>({presentation:t,dispatch:n})=>{const l=it(t);if(!l[e.index]||e.to<0||e.to>=l.length||e.to===e.index)return!1;if(!n)return!0;const s=l.map((a,i)=>i).filter(a=>a!==e.index);s.splice(e.to,0,e.index);const o=pe(t);return s.flatMap(a=>o.slice(l[a].start,l[a].start+l[a].count)).forEach((a,i)=>Un(t,a,i)),Ml(t,$s(s.map(a=>l[a]))),!0}})};function qk(e,t){const n=Pt(t),l=io(e);if(!n)return l[0];const s=Lt(n),o=bi(n);return l.find(a=>Vt(a)===Vt(n)&&Lt(a)===s)??(o&&o!=="cust"?l.find(a=>bi(a)===o):void 0)??l.find(a=>Lt(a)===s)??l[0]}const _k={name:"slide-paste",addCommands:()=>({pasteSlides:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(o=>rl(e.source,o));if(l.length===0||l.some(o=>o===null))return!1;if(!n)return!0;const s=Math.max(0,Math.min(e.at,pe(t).length));return l.forEach((o,a)=>{Un(t,ly(t,o,e.mode==="theme"?qk(t,o):void 0),s+a)}),!0}})},Gk={name:"home-extras",addCommands:()=>({...Ok.addCommands(),...Wk.addCommands(),...Rk.addCommands(),...Nk.addCommands(),..._k.addCommands()})},Hk=`
|
|
15
|
+
爱愛碍礙袄襖罢罷摆擺败敗颁頒办辦帮幫绑綁宝寶报報鲍鮑辈輩贝貝备備笔筆币幣毕畢闭閉边邊编編贬貶变變辩辯辫辮标標宾賓滨濱饼餅并並拨撥补補
|
|
16
|
+
财財参參蚕蠶残殘惭慚惨慘灿燦仓倉苍蒼舱艙测測层層搀攙产產铲鏟阐闡尝嘗长長偿償肠腸厂廠场場畅暢钞鈔车車彻徹尘塵陈陳衬襯称稱惩懲诚誠骋騁
|
|
17
|
+
迟遲驰馳齿齒冲衝虫蟲宠寵筹籌丑醜处處础礎触觸传傳疮瘡闯闖创創锤錘纯純辞辭词詞赐賜聪聰从從丛叢窜竄错錯
|
|
18
|
+
达達带帶贷貸单單担擔胆膽弹彈当當挡擋党黨档檔导導岛島祷禱灯燈邓鄧敌敵递遞点點电電垫墊钓釣调調叠疊顶頂订訂东東动動栋棟冻凍犊犢独獨读讀赌賭
|
|
19
|
+
镀鍍锻鍛断斷队隊对對吨噸夺奪堕墮恶惡饿餓儿兒尔爾饵餌贰貳发發罚罰阀閥珐琺矾礬钒釩烦煩范範贩販饭飯访訪纺紡飞飛废廢费費纷紛坟墳奋奮愤憤
|
|
20
|
+
粪糞丰豐枫楓锋鋒风風疯瘋冯馮缝縫讽諷凤鳳肤膚辐輻抚撫辅輔赋賦复復负負讣訃妇婦缚縛该該钙鈣盖蓋赶趕秆稈赣贛冈岡刚剛钢鋼纲綱岗崗镐鎬
|
|
21
|
+
搁擱鸽鴿阁閣个個给給龚龔宫宮巩鞏贡貢钩鉤沟溝构構购購够夠蛊蠱顾顧关關观觀馆館惯慣贯貫广廣规規归歸龟龜闺閨轨軌诡詭柜櫃贵貴刽劊滚滾
|
|
22
|
+
锅鍋国國过過骇駭韩韓汉漢号號鹤鶴贺賀横橫轰轟鸿鴻红紅后後壶壺护護沪滬户戶哗嘩华華画畫划劃话話怀懷坏壞欢歡环環还還缓緩换換唤喚痪瘓
|
|
23
|
+
涣渙焕煥谎謊挥揮辉輝毁毀贿賄秽穢会會烩燴汇匯讳諱诲誨绘繪荤葷浑渾获獲货貨祸禍击擊机機积積饥飢迹跡讥譏鸡雞绩績缉緝极極辑輯级級挤擠
|
|
24
|
+
几幾蓟薊剂劑济濟计計记記际際继繼纪紀夹夾荚莢颊頰贾賈钾鉀价價驾駕歼殲监監坚堅笺箋间間艰艱缄緘茧繭检檢碱鹼拣揀捡撿简簡俭儉减減荐薦
|
|
25
|
+
槛檻鉴鑒践踐贱賤见見键鍵舰艦剑劍饯餞渐漸溅濺涧澗将將浆漿蒋蔣桨槳奖獎讲講酱醬胶膠浇澆骄驕娇嬌搅攪铰鉸矫矯侥僥脚腳饺餃缴繳绞絞轿轎
|
|
26
|
+
较較阶階节節洁潔结結诫誡届屆紧緊锦錦仅僅谨謹进進烬燼尽盡劲勁茎莖鲸鯨惊驚经經颈頸静靜镜鏡径徑痉痙竞競净淨纠糾旧舊驹駒举舉据據锯鋸
|
|
27
|
+
惧懼剧劇鹃鵑绢絹杰傑觉覺决決诀訣绝絕钧鈞军軍骏駿开開凯凱颗顆壳殼课課垦墾恳懇抠摳库庫裤褲夸誇块塊侩儈宽寬矿礦旷曠况況亏虧岿巋窥窺
|
|
28
|
+
馈饋溃潰扩擴阔闊蜡蠟腊臘莱萊来來赖賴蓝藍栏欄拦攔篮籃阑闌兰蘭澜瀾谰讕揽攬览覽懒懶缆纜烂爛滥濫捞撈劳勞涝澇乐樂镭鐳垒壘类類泪淚篱籬
|
|
29
|
+
离離鲤鯉礼禮丽麗厉厲励勵砾礫历歷沥瀝隶隸俩倆联聯莲蓮连連镰鐮怜憐涟漣帘簾敛斂脸臉链鏈恋戀炼煉练練粮糧凉涼两兩辆輛谅諒疗療辽遼镣鐐
|
|
30
|
+
猎獵临臨邻鄰鳞鱗凛凜赁賃龄齡铃鈴灵靈岭嶺领領馏餾刘劉龙龍聋聾咙嚨笼籠垄壟拢攏陇隴楼樓娄婁搂摟篓簍芦蘆卢盧颅顱庐廬炉爐掳擄卤鹵虏虜
|
|
31
|
+
鲁魯赂賂禄祿录錄陆陸驴驢吕呂铝鋁侣侶屡屢缕縷虑慮滤濾绿綠峦巒挛攣孪孿滦灤乱亂抡掄轮輪伦倫仑侖沦淪纶綸论論萝蘿罗羅逻邏锣鑼箩籮骡騾
|
|
32
|
+
骆駱络絡妈媽玛瑪码碼蚂螞马馬骂罵吗嗎买買麦麥卖賣迈邁脉脈瞒瞞馒饅蛮蠻满滿谩謾猫貓锚錨铆鉚贸貿么麼没沒镁鎂门門闷悶们們锰錳梦夢谜謎
|
|
33
|
+
弥彌觅覓绵綿缅緬庙廟灭滅悯憫闽閩鸣鳴铭銘谬謬谋謀亩畝钠鈉纳納难難挠撓脑腦恼惱闹鬧馁餒腻膩撵攆酿釀鸟鳥聂聶啮齧镊鑷镍鎳柠檸狞獰宁寧
|
|
34
|
+
拧擰泞濘钮鈕纽紐脓膿浓濃农農疟瘧诺諾欧歐鸥鷗殴毆呕嘔沤漚盘盤庞龐赔賠喷噴鹏鵬骗騙飘飄频頻贫貧苹蘋凭憑评評泼潑颇頗扑撲铺鋪朴樸谱譜
|
|
35
|
+
栖棲凄淒脐臍齐齊骑騎岂豈启啟气氣弃棄讫訖牵牽钎釬铅鉛迁遷签簽谦謙钱錢钳鉗潜潛浅淺谴譴堑塹枪槍呛嗆墙牆蔷薔强強抢搶锹鍬桥橋乔喬侨僑
|
|
36
|
+
翘翹窍竅窃竊钦欽亲親寝寢轻輕氢氫倾傾顷頃请請庆慶琼瓊穷窮趋趨区區躯軀驱驅龋齲颧顴权權劝勸却卻鹊鵲确確让讓饶饒扰擾绕繞热熱韧韌认認
|
|
37
|
+
纫紉荣榮绒絨软軟锐銳闰閏润潤洒灑萨薩鳃鰓赛賽伞傘丧喪骚騷扫掃涩澀杀殺纱紗筛篩晒曬闪閃陕陝赡贍缮繕伤傷赏賞烧燒绍紹赊賒摄攝慑懾设設
|
|
38
|
+
绅紳审審婶嬸肾腎渗滲声聲绳繩胜勝圣聖师師狮獅湿濕诗詩尸屍时時蚀蝕实實识識驶駛势勢适適释釋饰飾视視试試寿壽兽獸枢樞输輸书書赎贖属屬
|
|
39
|
+
术術树樹竖豎数數帅帥双雙谁誰税稅顺順说說硕碩烁爍丝絲饲飼耸聳怂慫颂頌讼訟诵誦擞擻苏蘇诉訴肃肅虽雖随隨绥綏岁歲孙孫损損笋筍缩縮琐瑣
|
|
40
|
+
锁鎖獭獺挞撻态態摊攤贪貪瘫癱滩灘坛壇谭譚谈談叹嘆汤湯烫燙涛濤绦絛讨討腾騰誊謄锑銻题題体體屉屜条條贴貼铁鐵厅廳听聽烃烴铜銅统統头頭
|
|
41
|
+
秃禿图圖涂塗团團颓頹脱脫鸵鴕驮馱驼駝椭橢洼窪袜襪弯彎湾灣顽頑万萬网網韦韋违違围圍为為潍濰维維苇葦伟偉伪偽纬緯谓謂卫衛温溫闻聞纹紋
|
|
42
|
+
稳穩问問瓮甕挝撾蜗蝸涡渦窝窩卧臥呜嗚钨鎢乌烏诬誣无無芜蕪吴吳坞塢雾霧务務误誤锡錫牺犧袭襲习習铣銑戏戲细細虾蝦辖轄峡峽侠俠狭狹厦廈
|
|
43
|
+
吓嚇鲜鮮纤纖贤賢衔銜闲閒显顯险險现現献獻县縣馅餡羡羨宪憲线線厢廂镶鑲乡鄉详詳响響项項萧蕭嚣囂销銷晓曉啸嘯协協挟挾携攜胁脅谐諧写寫
|
|
44
|
+
泻瀉谢謝锌鋅衅釁兴興汹洶绣繡须須许許叙敘绪緒续續轩軒悬懸选選癣癬绚絢学學勋勳询詢寻尋驯馴训訓讯訊逊遜压壓鸦鴉鸭鴨哑啞亚亞讶訝阉閹
|
|
45
|
+
烟煙盐鹽严嚴颜顏阎閻艳艷厌厭砚硯谚諺验驗鸯鴦杨楊扬揚疡瘍阳陽痒癢养養样樣摇搖尧堯遥遙窑窯谣謠药藥爷爺页頁业業叶葉医醫铱銥颐頤遗遺
|
|
46
|
+
仪儀蚁蟻艺藝亿億忆憶义義诣詣议議谊誼译譯异異绎繹荫蔭阴陰银銀饮飲隐隱樱櫻婴嬰鹰鷹应應缨纓莹瑩萤螢营營荧熒蝇蠅赢贏颖穎哟喲拥擁佣傭
|
|
47
|
+
痈癰踊踴咏詠涌湧优優忧憂邮郵铀鈾犹猶诱誘舆輿鱼魚渔漁娱娛与與屿嶼语語狱獄誉譽预預驭馭鸳鴛渊淵辕轅园園员員圆圓缘緣远遠愿願约約跃躍
|
|
48
|
+
钥鑰粤粵悦悅阅閱云雲郧鄖匀勻陨隕运運蕴蘊酝醞晕暈韵韻杂雜灾災载載攒攢暂暫赞贊赃贓脏髒凿鑿枣棗灶竈责責择擇则則泽澤贼賊赠贈轧軋铡鍘
|
|
49
|
+
闸閘诈詐斋齋债債毡氈盏盞斩斬辗輾崭嶄栈棧战戰绽綻张張涨漲帐帳账賬胀脹赵趙蛰蟄辙轍锗鍺这這贞貞针針侦偵诊診镇鎮阵陣挣掙睁睜狰猙争爭
|
|
50
|
+
帧幀郑鄭证證织織职職执執纸紙挚摯掷擲帜幟质質滞滯钟鐘终終种種肿腫众眾诌謅轴軸皱皺昼晝骤驟猪豬诸諸诛誅烛燭瞩矚嘱囑贮貯铸鑄筑築驻駐
|
|
51
|
+
专專砖磚转轉赚賺桩樁庄莊装裝妆妝壮壯状狀锥錐赘贅坠墜缀綴谆諄准準浊濁兹茲资資渍漬踪蹤综綜总總纵縱邹鄒诅詛组組钻鑽删刪额額着著于於
|
|
52
|
+
`.replace(/\s/gu,""),Sr=[["皇后","皇后"],["太后","太后"],["王后","王后"],["后妃","后妃"],["头发","頭髮"],["理发","理髮"],["发型","髮型"],["白发","白髮"],["毛发","毛髮"],["假发","假髮"],["日历","日曆"],["历法","曆法"],["农历","農曆"],["阳历","陽曆"],["阴历","陰曆"],["公历","公曆"],["挂历","掛曆"],["茶几","茶几"],["几乎","幾乎"],["钟情","鍾情"],["钟爱","鍾愛"],["心脏","心臟"],["内脏","內臟"],["脏器","臟器"],["肝脏","肝臟"],["复制","複製"],["复杂","複雜"],["重复","重複"],["复数","複數"],["复印","複印"],["答复","答覆"],["回复","回覆"],["反复","反覆"],["制造","製造"],["制作","製作"],["绘制","繪製"],["制品","製品"],["印制","印製"],["研制","研製"],["监制","監製"],["这里","這裡"],["那里","那裡"],["哪里","哪裡"],["里面","裡面"],["心里","心裡"],["家里","家裡"],["夜里","夜裡"],["干净","乾淨"],["干燥","乾燥"],["饼干","餅乾"],["干部","幹部"],["干活","幹活"],["能干","能幹"],["骨干","骨幹"],["树干","樹幹"],["面条","麵條"],["面包","麵包"],["面粉","麵粉"],["关系","關係"],["联系","聯繫"],["台风","颱風"],["台湾","臺灣"],["舞台","舞臺"],["平台","平臺"],["讲台","講臺"],["一只","一隻"],["两只","兩隻"],["放松","放鬆"],["轻松","輕鬆"],["宽松","寬鬆"],["冲洗","沖洗"],["冲泡","沖泡"],["手表","手錶"],["钟表","鐘錶"],["旅游","旅遊"],["游戏","遊戲"],["特征","特徵"],["象征","象徵"],["征求","徵求"],["其余","其餘"],["剩余","剩餘"],["多余","多餘"],["余额","餘額"],["业余","業餘"],["收获","收穫"],["词汇","詞彙"],["尽管","儘管"],["战斗","戰鬥"],["斗争","鬥爭"],["奋斗","奮鬥"],["格斗","格鬥"],["显著","顯著"],["著名","著名"],["著作","著作"]],Qk="裏里裡里髮发曆历鍾钟臟脏複复製制乾干幹干麵面係系繫系臺台檯台颱台隻只鬆松鹹咸沖冲錶表遊游徵征餘余穫获彙汇儘尽鬥斗爲为衆众綫线峯峰";function ff(e){const t=[...e];return Array.from({length:Math.floor(t.length/2)},(n,l)=>[t[2*l],t[2*l+1]])}let qo;function Xk(){if(qo)return qo;const e=ff(Hk),t=new Map(e),n=new Map([...e.map(([s,o])=>[o,s]),...ff(Qk)]),l=Math.max(...Sr.map(([s])=>s.length));return qo={toTraditional:{words:new Map(Sr),longest:l,chars:t},toSimplified:{words:new Map(Sr.map(([s,o])=>[o,s])),longest:l,chars:n}},qo}function mf(e,t){const{words:n,longest:l,chars:s}=Xk()[t];let o="";for(let a=0;a<e.length;){let i=!1;for(let u=Math.min(l,e.length-a);u>=2&&!i;u-=1){const c=n.get(e.slice(a,a+u));c!==void 0&&(o+=c,a+=u,i=!0)}if(i)continue;const r=e[a];o+=s.get(r)??r,a+=1}return o}function hf(e,t){const n=[];for(let l=0;l<e.length;l+=1){if(e[l]===t[l])continue;const s=n.at(-1);s&&s.end===l?(s.end+=1,s.text+=t[l]):n.push({start:l,end:l+1,text:t[l]})}return n}const Zk={name:"convert",addCommands:()=>({convertChineseText:e=>({presentation:t,dispatch:n})=>{const{target:l}=e,s=l.kind==="deck"?pe(t):[ae(t,l.slide)].filter(a=>a!==null);let o=!1;for(const a of s){const i=We(a);for(const r of wr(a)){if(l.kind==="shapes"&&(r.location.kind==="notes"||!l.shapes.includes(r.location.shape)))continue;const u=hf(r.text,mf(r.text,e.direction));if(u.length===0)continue;if(o=!0,!n)return!0;const c=kr(t,i,r.location);for(const d of u)c?.write(d.start,d.end,d.text)}}return o}})},Yk={name:"review",addCommands:()=>({...zk.addCommands(),...Zk.addCommands(),...Vk.addCommands()})},vf=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu;function gf(e){return(e.match(vf)?.length??0)+(e.replace(vf," ").match(/[\p{L}\p{N}]+(?:['’-][\p{L}\p{N}]+)*/gu)?.length??0)}function bf(e){let t=0,n=0,l=0,s=0,o=0;for(const a of e)for(const i of wr(a)){if(i.location.kind==="notes"){o+=gf(i.text);continue}const r=i.text.split(/\n/u).map(u=>u.replace(/[\v\r]/gu,""));s+=r.filter(u=>u.trim().length>0).length;for(const u of r)t+=gf(u),n+=[...u.replace(/\s/gu,"")].length,l+=[...u].length}return{slides:e.length,hiddenSlides:e.filter(co).length,words:t,characters:n,charactersWithSpaces:l,paragraphs:s,notesWords:o}}const Cr=(e,t)=>t?jt(e,t):null;function Jk(){const e=new Map;let t;return{check(n,{budgetMs:l=Number.POSITIVE_INFINITY,revision:s}={}){const o=s!==void 0&&t?.presentation===n&&t.revision===s;t=s===void 0?void 0:{presentation:n,revision:s};const a=o?"":JSON.stringify(Mt(n)),i=new Set,r=performance.now()+l;let u=0,c=0;const d=h=>{const v=We(h);i.add(v);const g=o?e.get(v):void 0;if(g)return p(h,g);const $=Pt(h),b=[Cr(n,v),$?Cr(n,Vt($)):null,$?Cr(n,jc($)):null];let w=e.get(v);return(!w||w.theme!==a||w.parts.some((S,C)=>S!==b[C]))&&(w={parts:b,theme:a,result:Qg(n,h,!1)},e.set(v,w)),p(h,w)},p=(h,v)=>(!v.contrast&&(c===0||performance.now()<r)&&(v.contrast=Sb(n,h),c+=1),v.contrast||(u+=1),v.contrast?{title:v.result.title,issues:[...v.result.issues,...v.contrast]}:v.result),f=Dg(n,d);if(!o)for(const h of e.keys())i.has(h)||e.delete(h);return{issues:f,pending:u}}}}const yf="一二三四五六七八九十月火水木金土日株有社名特財祝労秘男女適優印注項休写正上中下左右医宗学監企資協夜";function Mr(e){return e===0?"⓪":e>=1&&e<=20?String.fromCodePoint(9312+e-1):e>=21&&e<=35?String.fromCodePoint(12881+e-21):e>=36&&e<=50?String.fromCodePoint(12977+e-36):null}function Pr(e){if(/^[A-Z]$/u.test(e))return String.fromCodePoint(9398+e.charCodeAt(0)-65);if(/^[a-z]$/u.test(e))return String.fromCodePoint(9424+e.charCodeAt(0)-97);const t=yf.indexOf(e);return t>=0?String.fromCodePoint(12928+t):null}const xf=new Map([...Array.from({length:51},(e,t)=>[Mr(t),String(t)]),...[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"].map(e=>[Pr(e),e]),...[...yf].map(e=>[Pr(e),e])]);function e2(e){const t=new Set,n=e.replace(/\d+|[^\s\d]/gu,l=>{if(/^\d+$/u.test(l)){const o=Mr(Number(l));return o||[...l].map(a=>Mr(Number(a))).join("")}const s=Pr(l);return s||t.add(l),s??l});return n===e&&[...e].some(l=>xf.has(l))?{text:[...e].map(l=>xf.get(l)??l).join(""),missing:[]}:{text:n,missing:[...t]}}const Tr=e=>rn(e,"title")??rn(e,"ctrTitle"),Ar=e=>rn(e,"body")??rn(e,"subTitle"),t2={name:"outline",addCommands:()=>({setOutlineText:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(!l||e.title===void 0&&e.body===void 0)return!1;const s=[[e.title,Tr(l)],[e.body,Ar(l)]].filter(([a])=>a!==void 0);if(s.some(([,a])=>a===null))return!1;const o=s.filter(([a,i])=>ze(i)!==a);if(o.length===0)return!1;if(n)for(const[a,i]of o)at(i,a,{preserveFormatting:!0,newlines:"paragraph"});return!0}})},n2="#F26B43",wf={min:18e3,max:18e5},l2={name:"view",addCommands:()=>({setGuides:e=>({presentation:t,dispatch:n})=>{const l=Rt(t);return!l||!e.guides.every(s=>Number.isFinite(s.position)&&s.position>=0&&s.position<=(s.axis==="x"?l.width:l.height))?!1:(n&&wy(t,e.guides.map(s=>({id:s.id,axis:s.axis,position:Math.round(s.position),color:n2}))),!0)},setGuidesVisible:e=>({presentation:t,dispatch:n})=>(n&&ky(t,e.visible),!0),setGridSettings:e=>({presentation:t,dispatch:n})=>e.spacing!==void 0&&!(e.spacing>=wf.min&&e.spacing<=wf.max)||e.snap===void 0&&e.spacing===void 0?!1:(n&&(e.snap!==void 0&&r1(t,e.snap),e.spacing!==void 0&&$y(t,{x:Math.round(e.spacing),y:Math.round(e.spacing)})),!0)})},s2=/^#[0-9a-f]{6}$/iu;function o2(e,t){const n=Math.max(1,t/2),l=[];for(const o of e){const a=l.at(-1);(!a||Math.hypot(o.x-a.x,o.y-a.y)>=n)&&l.push(o)}const s=e.at(-1);return s&&l.at(-1)!==s&&l.length>1&&(l[l.length-1]=s),l.length===1&&l.push({x:l[0].x+1,y:l[0].y}),l}function a2(e){return e.points.length>0&&s2.test(e.color)&&e.width>0&&e.opacity>0&&e.opacity<=1&&e.points.every(t=>Number.isFinite(t.x)&&Number.isFinite(t.y))}function i2(e,t){const n=[{fill:"none",stroke:!0,subpaths:[{nodes:Kd(o2(t.points,t.width),!1),closed:!1}]}],l=Xi(n),s=Math.max(1,Math.round(l.right-l.left)),o=Math.max(1,Math.round(l.bottom-l.top)),a=zn(e,{preset:"rect",x:j(Math.round(l.left)),y:j(Math.round(l.top)),w:j(s),h:j(o)});fn(a,`墨迹 ${Fe(a)}`),go(a,{paths:Qi(n,l,{width:s,height:o})}),yl(a),xl(a,{color:wc(t.color),widthEmu:Math.round(t.width),...t.opacity<1?{opacity:t.opacity}:{}}),Oi(a,"rnd"),Ui(a,"round")}function r2(e,t,n,l,s){const o=le(e,t,n),a=o?Oc(o):null,i=o?Uc(o):null;if(!o||!a||!i)return!1;const r=u=>u===void 0||Number.isInteger(u)&&u>=0&&u<=864e5;return l.volume!==void 0&&!(l.volume>=0&&l.volume<=1)||l.fullScreen&&a.kind==="audio"||l.slideCount!==void 0&&!(Number.isInteger(l.slideCount)&&l.slideCount>=1&&l.slideCount<=999)||!r(l.delayMs)||!r(l.trim?.startMs)||!r(l.trim?.endMs)||!r(l.fade?.inMs)||!r(l.fade?.outMs)||l.delayMs!==void 0&&!(l.autoplay??i.autoplay)?!1:(s&&Uy(o,{...l}),!0)}function u2(e,t){return t&&f0(e),!0}const kf=["title","subject","creator","keywords","description"];function c2(e){const t=Mc(e);return Object.fromEntries(kf.map(n=>[n,t?.[n]??""]))}function d2(e,t){yy(e,Object.fromEntries(kf.filter(n=>t[n]!==void 0).map(n=>[n,t[n].trim()===""?null:t[n].trim()])))}function p2(e){const t=C0(e,`
|
|
53
|
+
`);return(t.match(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu)?.length??0)+(t.replace(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu," ").match(/[\p{L}\p{N}]+/gu)?.length??0)}const f2=3e5;function m2(e){const t=os(e),n=t.mode.kind==="kiosk";return{mode:n?"kiosk":"present",loop:n||t.loop,slides:t.slides,useTimings:t.useTimings}}function $f(e){return Gl(e).map(t=>({id:t.id,name:t.name,slides:t.slides.map(We)}))}function h2(e,t,n){const{slides:l}=t,s=pe(e).length;if(l.kind==="range"&&!(Number.isInteger(l.start)&&Number.isInteger(l.end)&&l.start>=1&&l.start<=l.end&&l.end<=s)||l.kind==="customShow"&&!Gl(e).some(i=>i.id===l.id))return!1;if(!n)return!0;const o=os(e),a=t.mode==="kiosk"?{kind:"kiosk",restart:o.mode.kind==="kiosk"?o.mode.restart:f2}:{kind:"present"};return ji(e,{...o,mode:a,loop:t.mode==="kiosk"||t.loop,slides:l,useTimings:t.useTimings}),!0}function v2(e,t,n){const l=t.map(i=>({...i,name:i.name.trim(),slides:i.slides.map(r=>ae(e,r))}));if(l.some(i=>i.name===""||i.slides.some(r=>r===null)))return!1;if(!n)return!0;let s=Math.max(-1,...Gl(e).map(i=>i.id),...t.map(i=>i.id??-1))+1;xy(e,l.map(i=>({id:i.id??s++,name:i.name,slides:i.slides.map(r=>r)})));const o=os(e),{slides:a}=o;return a.kind==="customShow"&&!Gl(e).some(i=>i.id===a.id)&&ji(e,{...o,slides:{kind:"all"}}),!0}function g2(e,t){Ki(e,{...ro(e)??{effect:"none"},advanceAfterMs:Math.round(t)})}function b2(e){const t=os(e);t.useTimings||ji(e,{...t,useTimings:!0})}const y2={name:"slide-show",addCommands:()=>({setShowSettings:e=>({presentation:t,dispatch:n})=>h2(t,e.settings,n),setCustomShows:e=>({presentation:t,dispatch:n})=>v2(t,e.shows,n),addInkShapes:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(s=>({slide:ae(t,s.slide),strokes:s.strokes}));if(l.length===0||l.some(s=>s.slide===null||s.strokes.length===0||!s.strokes.every(a2)))return!1;if(n)for(const s of l)for(const o of s.strokes)i2(s.slide,o);return!0},setMediaPlayback:e=>({presentation:t,dispatch:n})=>r2(t,e.slide,e.shape,e.playback,n),compactMedia:()=>({presentation:e,dispatch:t})=>u2(e,t),setDocumentProperties:e=>({presentation:t,dispatch:n})=>Object.values(e.properties).some(l=>typeof l!="string"||l.length>1e3)?!1:(n&&d2(t,e.properties),!0),setSlideTimings:e=>({presentation:t,dispatch:n})=>{const l=e.timings.map(s=>({slide:ae(t,s.slide),ms:s.ms}));if(l.length===0||l.some(s=>s.slide===null||!Number.isFinite(s.ms)||s.ms<0))return!1;if(!n)return!0;for(const s of l)g2(s.slide,s.ms);return b2(t),!0}})};function x2(e){const t=mi(e);return t===null||t.kind==="customShow"?null:t.kind==="slide"?{kind:"slide",slide:We(t.slide)}:t}const w2={name:"action",addCommands:()=>({setShapeAction:e=>({presentation:t,dispatch:n})=>{const l=e.shapes.map(a=>le(t,e.slide,a));if(l.length===0||l.some(a=>a===null||Yl(a)==="group"))return!1;const{action:s}=e;let o;if(s===null)o=null;else if(s.kind==="slide"){const a=ae(t,s.slide);if(a===null)return!1;o={kind:"slide",slide:a}}else if(s.kind==="url"){const a=s.url.trim();if(!/^(https?:|mailto:)/iu.test(a))return!1;o={kind:"url",url:a}}else o=s;if(n)for(const a of l)Di(a,o);return!0}})};function Me(e,t,n,l,s,o){return{preset:e,x:t,y:n,width:l,height:s,text:o,item:!0}}function Bt(e,t,n){const l=Math.max(1,e),s=(t-(l-1)*n)/l;return{size:s,starts:Array.from({length:l},(o,a)=>a*(s+n))}}function _o(e,t,n,l=0){const s=Math.max(1,e);return Array.from({length:s},(o,a)=>{const i=-Math.PI/2+(a+l)*2*Math.PI/s;return{x:t.x+n*Math.cos(i),y:t.y+n*Math.sin(i),angle:i}})}function Sf(e,t,n){const l=Math.min(...e.map(u=>u.x)),s=Math.max(...e.map(u=>u.x+u.width)),o=Math.min(...e.map(u=>u.y)),a=Math.max(...e.map(u=>u.y+u.height)),i=(t-(s-l))/2-l,r=(n-(a-o))/2-o;return e.map(u=>({...u,x:u.x+i,y:u.y+r}))}function Cf(e,t,n,l){const s=l*.4;return _o(e,t,n,.5).map(o=>({preset:"rightArrow",width:s,height:s*.5,rotation:(o.angle*180/Math.PI+90+360)%360,x:o.x-s/2,y:o.y-s/4}))}const k2=[{id:"cycle",kind:"cycle",label:"基本循环",sample:["计划","执行","检查","改进"],layout:(e,t,n)=>{const l=Math.min(t,n),s=l*(e.length>4?.26:.32),o=(l-s)/2,a={x:t/2,y:n/2};return{parts:[..._o(e.length,a,o).map((i,r)=>Me("ellipse",i.x-s/2,i.y-s/2,s,s,e[r])),...Cf(e.length,a,o,s)],lines:[]}}},{id:"cycle-text",kind:"cycle",label:"文本循环",sample:["需求","设计","实现","反馈"],layout:(e,t,n)=>{const l=Math.min(t,n),s=l*.26,o=(l-s*.6)/2,a={x:t/2,y:n/2};return{parts:[..._o(e.length,a,o).map((i,r)=>Me("roundRect",i.x-s*.75,i.y-s*.3,s*1.5,s*.6,e[r])),...Cf(e.length,a,o,s)],lines:[]}}},{id:"cycle-radial",kind:"cycle",label:"射线循环",sample:["核心","方向一","方向二","方向三","方向四"],layout:(e,t,n)=>{const l=Math.min(t,n),s=l*.3,o=l*.22,a=(l-o)/2,i={x:t/2,y:n/2},r=e.length>1?_o(e.length-1,i,a):[],u=r.map(c=>({from:i,to:{x:c.x,y:c.y}}));return{parts:[Me("ellipse",i.x-s/2,i.y-s/2,s,s,e[0]??""),...r.map((c,d)=>Me("ellipse",c.x-o/2,c.y-o/2,o,o,e[d+1]))],lines:u}}}],$2=[{id:"hierarchy",kind:"hierarchy",label:"组织结构图",sample:["负责人","成员甲","成员乙","成员丙"],layout:(e,t,n)=>{const l=e.slice(1),s={width:Math.min(t*.28,(t-Math.max(0,l.length-1)*t*.04)/Math.max(1,l.length)),height:n*.3},o=l.length>1?(t-l.length*s.width)/(l.length-1):0,a=l.map((c,d)=>Me("roundRect",l.length===1?(t-s.width)/2:d*(s.width+o),n-s.height,s.width,s.height,c)),i=n/2,r=a.map(c=>c.x+s.width/2),u=l.length===0?[]:[{from:{x:t/2,y:s.height},to:{x:t/2,y:i}}];r.length>1&&u.push({from:{x:r[0],y:i},to:{x:r.at(-1),y:i}});for(const c of r)u.push({from:{x:c,y:i},to:{x:c,y:n-s.height}});return{parts:[Me("roundRect",(t-s.width)/2,0,s.width,s.height,e[0]??""),...a],lines:u}}},{id:"hierarchy-horizontal",kind:"hierarchy",label:"水平层次",sample:["总目标","分目标一","分目标二","分目标三"],layout:(e,t,n)=>{const l=e.slice(1),{size:s,starts:o}=Bt(Math.max(1,l.length),n,n*.06),a=t*.3,i=t/2,r=l.map((c,d)=>o[d]+s/2),u=l.length===0?[]:[{from:{x:a,y:n/2},to:{x:i,y:n/2}}];r.length>1&&u.push({from:{x:i,y:r[0]},to:{x:i,y:r.at(-1)}});for(const c of r)u.push({from:{x:i,y:c},to:{x:t-a,y:c}});return{parts:[Me("roundRect",0,n/2-s/2,a,s,e[0]??""),...l.map((c,d)=>Me("roundRect",t-a,o[d],a,s,c))],lines:u}}},{id:"hierarchy-label",kind:"hierarchy",label:"层次列表",sample:["项目","前端","后端","测试"],layout:(e,t,n)=>{const l=e.slice(1),{size:s,starts:o}=Bt(Math.max(1,l.length),t,t*.02);return{parts:[Me("rect",0,0,t,n*.3,e[0]??""),...l.map((a,i)=>Me("rect",o[i],n*.34,s,n*.66,a))],lines:[]}}}],S2=[{id:"list",kind:"list",label:"基本列表",sample:["第一项","第二项","第三项"],layout:(e,t,n)=>{const{size:l,starts:s}=Bt(e.length,t,t*.03);return{parts:e.map((o,a)=>Me("roundRect",s[a],n*.2,l,n*.6,o)),lines:[]}}},{id:"list-vertical",kind:"list",label:"垂直列表",sample:["第一项","第二项","第三项"],layout:(e,t,n)=>{const{size:l,starts:s}=Bt(e.length,n,n*.05);return{parts:e.map((o,a)=>Me("roundRect",t*.1,s[a],t*.8,l,o)),lines:[]}}},{id:"list-numbered",kind:"list",label:"编号列表",sample:["第一项","第二项","第三项"],layout:(e,t,n)=>{const{size:l,starts:s}=Bt(e.length,n,n*.06),o=Math.min(l,t*.15);return{parts:e.flatMap((a,i)=>[Me("roundRect",o*.6,s[i],t-o*.6,l,a),{preset:"ellipse",x:0,y:s[i]+(l-o)/2,width:o,height:o,text:String(i+1)}]),lines:[]}}}];function Er(e,t,n){const l=Math.min(e,t),s=l*n,o=(l-s)/2,a=(e-l)/2,i=(t-l)/2;return[0,1,2,3].map(r=>({x:a+r%2*(o+s),y:i+Math.floor(r/2)*(o+s),size:o}))}const C2=[{id:"matrix",kind:"matrix",label:"基本矩阵",sample:["优势","劣势","机会","威胁"],layout:(e,t,n)=>({parts:Er(t,n,.02).slice(0,e.length).map((l,s)=>Me("rect",l.x,l.y,l.size,l.size,e[s])),lines:[]})},{id:"matrix-grid",kind:"matrix",label:"网格矩阵",sample:["重要且紧急","重要不紧急","紧急不重要","不重要不紧急"],layout:(e,t,n)=>({parts:Er(t,n,.08).slice(0,e.length).map((l,s)=>({...Me("roundRect",l.x,l.y,l.size,l.size,e[s]),tint:["accent1","accent2","accent3","accent4"][s]})),lines:[]})},{id:"matrix-titled",kind:"matrix",label:"带标题的矩阵",sample:["战略","产品","市场","团队","资金"],layout:(e,t,n)=>{const l=Er(t,n,.02),s=l[0].size*.8;return{parts:[...l.slice(0,Math.max(0,e.length-1)).map((o,a)=>Me("rect",o.x,o.y,o.size,o.size,e[a+1])),Me("ellipse",t/2-s/2,n/2-s/2,s,s,e[0]??"")],lines:[]}}}],M2=[{id:"process",kind:"process",label:"基本流程",sample:["步骤一","步骤二","步骤三"],layout:(e,t,n)=>{const l=t*.06,s=t*.025,{size:o,starts:a}=Bt(e.length,t,l+2*s),i=e.map((r,u)=>Me("roundRect",a[u],n*.2,o,n*.6,r));for(let r=0;r<e.length-1;r+=1)i.push({preset:"rightArrow",x:a[r]+o+s,y:n*.42,width:l,height:n*.16});return{parts:i,lines:[]}}},{id:"process-chevron",kind:"process",label:"箭头流程",sample:["调研","设计","开发","上线"],layout:(e,t,n)=>{const l=n*.18,{size:s,starts:o}=Bt(e.length,t,-l*.6);return{parts:e.map((a,i)=>Me(i===0?"homePlate":"chevron",o[i],n*.32,s,n*.36,a)),lines:[]}}},{id:"process-vertical",kind:"process",label:"垂直流程",sample:["步骤一","步骤二","步骤三"],layout:(e,t,n)=>{const l=n*.08,s=n*.02,{size:o,starts:a}=Bt(e.length,n,l+2*s),i=t*.5,r=(t-i)/2,u=e.map((c,d)=>Me("roundRect",r,a[d],i,o,c));for(let c=0;c<e.length-1;c+=1)u.push({preset:"downArrow",x:t/2-l*.6,y:a[c]+o+s,width:l*1.2,height:l});return{parts:u,lines:[]}}}];function P2(e,t,n,l){const s=Math.max(1,e.length),o=n/s;return e.map((a,i)=>{const r=t*i/s,u=t*(i+1)/s,c=l+(t-u)/2;if(i===0)return Me("triangle",c,0,u,o,a);const d=(u-r)/2;return{...Me("trapezoid",c,i*o,u,o,a),adjust:{adj:Math.round(d/Math.min(u,o)*1e5)}}})}const T2=[{id:"pyramid",kind:"pyramid",label:"基本棱锥图",sample:["愿景","战略","执行"],layout:(e,t,n)=>({parts:P2(e,Math.min(t,n*1.4),n,(t-Math.min(t,n*1.4))/2),lines:[]})},{id:"pyramid-inverted",kind:"pyramid",label:"倒棱锥图",sample:["线索","意向","成交"],layout:(e,t,n)=>{const l=Math.max(1,e.length),s=n/l,o=Math.min(t,n*1.4);return{parts:e.map((a,i)=>{const r=o*(1-i*.6/l);return Me("flowChartManualOperation",(t-r)/2,i*s,r,s*.92,a)}),lines:[]}}},{id:"pyramid-list",kind:"pyramid",label:"棱锥列表",sample:["基础","提升","精通"],layout:(e,t,n)=>{const l=Math.min(t*.5,n*1.2),{size:s,starts:o}=Bt(e.length,n*.8,n*.04);return{parts:[{preset:"triangle",x:0,y:0,width:l,height:n,tint:"accent1"},...e.map((a,i)=>Me("roundRect",l*.5,n*.15+o[i],t-l*.5,s,a))],lines:[]}}}],Go=["accent1","accent2","accent3","accent4"],A2=[{id:"relationship",kind:"relationship",label:"基本维恩图",sample:["目标","资源","方法"],layout:(e,t,n)=>{const l=Math.min(t,n)*(e.length>2?.58:.7),s=e.length===1?0:l*.32;return{parts:Sf(e.map((o,a)=>{const i=e.length===2?Math.PI*a:-Math.PI/2+a*2*Math.PI/e.length;return{...Me("ellipse",t/2+s*Math.cos(i)-l/2,n/2+s*Math.sin(i)-l/2,l,l,o),tint:Go[a%Go.length]}}),t,n),lines:[]}}},{id:"relationship-linear",kind:"relationship",label:"线性维恩图",sample:["发现","理解","行动","复盘"],layout:(e,t,n)=>{const l=Math.max(1,e.length),s=Math.min(n*.8,t/(1+(l-1)*.75));return{parts:Sf(e.map((o,a)=>({...Me("ellipse",a*s*.75,0,s,s,o),tint:Go[a%Go.length]})),t,n),lines:[]}}},{id:"relationship-converge",kind:"relationship",label:"聚合",sample:["数据","经验","方法","结论"],layout:(e,t,n)=>{const l=e.slice(0,-1),{size:s,starts:o}=Bt(Math.max(1,l.length),n,n*.06),a=t*.3,i=Math.min(t*.3,n*.6),r=l.map((u,c)=>Me("roundRect",0,o[c],a,s,u));return r.push({preset:"rightArrow",x:a+t*.06,y:n*.4,width:t*.2,height:n*.2}),r.push(Me("ellipse",t-i,(n-i)/2,i,i,e.at(-1)??"")),{parts:r,lines:[]}}}],Pl=[...S2,...M2,...k2,...$2,...A2,...C2,...T2],Fr=[["list","列表"],["process","流程"],["cycle","循环"],["hierarchy","层次结构"],["relationship","关系"],["matrix","矩阵"],["pyramid","棱锥图"]];function zr(e){return Pl.find(t=>t.id===e)}const Mf="智能图形:",E2=/^项目 (\d+)$/u;function Pf(e){if(Yl(e)!=="group")return null;const t=to(e)?.startsWith(Mf)?to(e).slice(5):null,n=Pl.find(l=>l.label===t);return n?{layout:n,items:eo(e).map(l=>({child:l,number:Number(E2.exec(dl(l))?.[1]??NaN)})).filter(l=>Number.isFinite(l.number)).sort((l,s)=>l.number-s.number).map(l=>ze(l.child))}:null}function F2(e,t,n){const l=zn(e,{preset:t.preset,x:j(Math.round(t.x)),y:j(Math.round(t.y)),w:j(Math.round(t.width)),h:j(Math.round(t.height))});return yo(l,To),fn(l,n===null?t.text===void 0?"连接箭头":"标记":`项目 ${n}`),t.tint&&Rn(l,{color:t.tint,opacity:.55}),t.rotation&&Bi(l,t.rotation),t.adjust&&sd(l,t.adjust),t.text!==void 0&&(at(l,t.text),wl(l,"center"),Nn(l,"center")),l}function Dr(e,t,n,l){const{parts:s,lines:o}=t.layout(n,l.width,l.height);let a=0;const i=Qc([...o.map(r=>xc(e,{from:{x:j(Math.round(l.x+r.from.x)),y:j(Math.round(l.y+r.from.y))},to:{x:j(Math.round(l.x+r.to.x)),y:j(Math.round(l.y+r.to.y))},color:"accent1",widthEmu:19050})),...s.map(r=>F2(e,{...r,x:l.x+r.x,y:l.y+r.y},r.item?a+=1:null))],{name:"智能图形"});return fn(i,"智能图形"),od(i,`${Mf}${t.label}`),i}const z2={name:"diagrams",addCommands:()=>({addDiagram:ge({description:"Adds a diagram drawn in the theme colours, one item per entry, at a position and size in centimetres: list for parallel points, process for steps in order, cycle for a loop, hierarchy for an organisation, relationship for overlapping sets, matrix for four quadrants, pyramid for levels.",params:{type:"object",properties:{layout:{enum:Pl.map(e=>e.id),description:"Diagram layout."},items:{type:"array",minItems:1,maxItems:12,items:{type:"string",minLength:1},description:"Item texts in order."},x:{type:"number"},y:{type:"number"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0}},required:["layout","items","x","y","width","height"],additionalProperties:!1},target:"slide",category:"shapes",adapt:(e,t)=>{const{layout:n,items:l,x:s,y:o,width:a,height:i}=e;return t.slide===null?null:{slide:t.slide,layout:n,items:l,x:be(s),y:be(o),width:be(a),height:be(i)}},run:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=zr(e.layout);return l===null||!s||e.items.length===0||e.width<=0||e.height<=0?!1:(n&&Dr(l,s,e.items,e),!0)}}),setDiagramItems:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=le(t,e.slide,e.shape),o=s?Pf(s):null,a=s?fi(t,s):null;if(l===null||s===null||o===null||a===null||e.items.length===0)return!1;if(!n)return!0;const i=ts(s);return pn(s),xo(Dr(l,o.layout,e.items,{x:a.x,y:a.y,width:a.w,height:a.h}),i),!0},convertTextToDiagram:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=le(t,e.slide,e.shape),o=zr(e.layout),a=s?fi(t,s):null;let i="";try{i=s?ze(s):""}catch{}const r=i.split(`
|
|
54
|
+
`).map(c=>c.trim()).filter(c=>c.length>0);if(l===null||s===null||!o||a===null||a.w<=0||a.h<=0||r.length===0)return!1;if(!n)return!0;const u=ts(s);return pn(s),xo(Dr(l,o,r,{x:a.x,y:a.y,width:a.w,height:a.h}),u),!0}})};function Ho(e,t,n="zh-CN"){const[l,s,o]=[e.getFullYear(),e.getMonth()+1,e.getDate()];if(/^en/iu.test(n)){if(t==="datetime2")return e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"});if(t==="datetime4")return e.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});if(t==="datetime1")return`${s}/${o}/${l}`}return t==="datetime2"?`${l}年${s}月${o}日`:t==="datetime4"?`${l}年${s}月${o}日星期${"日一二三四五六"[e.getDay()]}`:t==="datetime10"?`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`:`${l}/${s}/${o}`}function D2(e){const t=Pt(e);return t!==null&&bi(t)==="title"}function L2(e){const t=rn(e,"ftr"),n=rn(e,"dt");let l=null;try{const s=n?lo(n,0).find(o=>o.kind==="fld"):void 0;l=s?.kind==="fld"?s.type:null}catch{}return{footer:t?ze(t):null,slideNumber:rn(e,"sldNum")!==null,date:n===null?null:l?.startsWith("datetime")?{kind:"auto",format:["datetime1","datetime2","datetime4","datetime10"].includes(l)?l:"datetime1"}:{kind:"fixed",text:ze(n)}}}function V2(e,t,n){const l=Pt(t),s=jc(t);if(l===null||s===null)return null;for(const o of["dt","ftr","sldNum"])bd(e,s,o,!0);return vd(l,!0),si(t,n)}function Lr(e,t,n,l){const s=rn(t,n);if(l===null)return s&&pn(s),!0;const o=s??si(t,n)??si(t,n,{source:"master"})??V2(e,t,n);return o===null?!1:(l(o),!0)}function I2(e,t,n,l){const s=n.skipTitle&&D2(t),{footer:o,date:a}=n,i=String(Ql(e)+Vn(e,t));return[Lr(e,t,"ftr",s||o===null?null:r=>at(r,o,{preserveFormatting:!0})),Lr(e,t,"sldNum",s||!n.slideNumber?null:r=>Ni(r,"slidenum",{text:i})),Lr(e,t,"dt",s||a===null?null:r=>a.kind==="auto"?Ni(r,a.format,{text:Ho(l,a.format)}):at(r,a.text,{preserveFormatting:!0}))].every(Boolean)}const B2=new Set(["datetime1","datetime2","datetime4","datetime10"]);function Tf(e,t,n=!0){let l=0;for(const s of pe(e))for(const o of ot(s)){let a=[];try{a=pl(o)===1?lo(o,0):[]}catch{continue}const i=a.length===1&&a[0].kind==="fld"?a[0]:void 0,r=i?.kind==="fld"?i.type??"":"";if(!i||!B2.has(r))continue;const u=Ho(t,r,x0(o,0)[0]??"zh-CN");i.text!==u&&(n&&Ni(o,r,{text:u}),l+=1)}return l}const O2={name:"header-footer",addCommands:()=>({setHeaderFooter:e=>({presentation:t,dispatch:n})=>{const l=e.slides.map(o=>ae(t,o));if(l.length===0||l.some(o=>o===null))return!1;if(!n)return!0;const s=new Date;return l.map(o=>I2(t,o,e.settings,s)).some(Boolean)}})},U2={name:"icons",addCommands:()=>({addIcon:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide);if(l===null||e.size<=0||e.paths.length===0)return!1;if(n){const s=zn(l,{preset:"rect",x:j(e.x),y:j(e.y),w:j(e.size),h:j(e.size)});fn(s,e.name),go(s,{paths:e.paths}),yl(s);const o=e.paths[0].w;xl(s,{color:"accent1",widthEmu:Math.max(9525,Math.round(e.size*200/o))}),Oi(s,"rnd"),Ui(s,"round")}return!0}})},Af="/ppt/presentation.xml",N2=9999;function R2(e,t){const n=/<(?:[A-Za-z_][\w.-]*:)?presentation\b[^>]*>/.exec(e);if(!n)return null;const l=n[0].replace(/\s+firstSlideNum\s*=\s*(["'])[^"']*\1/,""),s=t===1?l:l.replace(/(\s*\/?>)$/,` firstSlideNum="${t}"$1`);return e.slice(0,n.index)+s+e.slice(n.index+n[0].length)}const j2={name:"slide-number",addCommands:()=>({setFirstSlideNumber:e=>({presentation:t,dispatch:n})=>{const{value:l}=e;if(!Number.isInteger(l)||l<0||l>9999||l===Ql(t))return!1;const s=jt(t,Af),o=s?R2(new TextDecoder().decode(s),l):null;return o===null?!1:(n&&nd(t,Af,new TextEncoder().encode(o)),!0)}})},K2={"#pptx-next-slide":{kind:"nextSlide"},"#pptx-prev-slide":{kind:"prevSlide"},"#pptx-first-slide":{kind:"firstSlide"},"#pptx-last-slide":{kind:"lastSlide"},"#pptx-last-slide-viewed":{kind:"lastSlideViewed"},"#pptx-end-show":{kind:"endShow"}};function Ef(e,t){const n=t.trim();if(/^(https?:|mailto:)/iu.test(n))return{kind:"url",url:n};const l=K2[n];if(l)return l;const s=/^#slide-(\d+)$/u.exec(n);if(s){const a=pe(e)[Number(s[1])-1];return a?{kind:"slide",slide:a}:null}const o=/^#pptx-custom-show\?id=(\d+)&return=(true|false)$/u.exec(n);return o?{kind:"customShow",id:Number(o[1]),returnToShow:o[2]==="true"}:null}const W2={name:"text-links",addCommands:()=>({setTextLinks:e=>({presentation:t,dispatch:n})=>{const l=le(t,e.slide,e.shape);if(l===null||e.links.length===0)return!1;const s=ze(l).length;if(e.links.some(o=>o.start<0||o.end>s||o.start>=o.end)||e.links.some(o=>o.url!==null&&Ef(t,o.url)===null))return!1;if(n)for(const o of e.links)Di(l,o.url===null?null:Ef(t,o.url),{range:{start:o.start,end:o.end}});return!0}})},Ff={mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",p:"http://schemas.openxmlformats.org/presentationml/2006/main",a:"http://schemas.openxmlformats.org/drawingml/2006/main",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",pslz:"http://schemas.microsoft.com/office/powerpoint/2016/slidezoom",psez:"http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom",p166:"http://schemas.microsoft.com/office/powerpoint/2016/6/main"},q2={"http://schemas.microsoft.com/office/powerpoint/2016/slidezoom":"slide","http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom":"section","http://schemas.microsoft.com/office/powerpoint/2016/summaryzoom":"summary"};function xe(e,t,n={},l=[]){return{kind:"element",name:{prefix:e,localName:t,namespaceURI:Ff[e]},prefixDecls:new Map,children:l,attrs:Object.entries(n).map(([s,o])=>{const[a,i]=s.includes(":")?s.split(":"):["",s];return{name:{prefix:a,localName:i,namespaceURI:a?Ff[a]:""},value:o}})}}const $e=(e,t)=>e?.children.find(n=>n.kind==="element"&&n.name?.localName===t),gt=(e,t)=>e?.attrs.find(n=>n.name.localName===t)?.value;function _2(e){const t=$e($e(e,"Choice"),"graphicFrame"),n=gt($e($e(t,"graphic"),"graphicData"),"uri"),l=n?q2[n]:void 0,s=$e(e,"Fallback")?.children.find(o=>o.kind==="element");return t&&l&&s?{wrapper:e,kind:l,frame:t,fallback:s}:null}function zf(e){const t=$e($e(Na(e),"cSld"),"spTree"),n=[],l=s=>{for(const o of s.children)if(o.kind==="element")if(o.name?.localName==="AlternateContent"){const a=_2(o);a&&n.push(a)}else o.name?.localName==="grpSp"&&l(o)};return t&&l(t),n}function Vr(e){return e.name?.localName==="graphicFrame"?$e(e,"xfrm"):$e($e(e,e.name?.localName==="grpSp"?"grpSpPr":"spPr"),"xfrm")}function G2(e){return gt($e(e.children.find(t=>t.kind==="element"&&t.name?.localName.startsWith("nv")),"cNvPr"),"id")}function H2(e){const t=Vr(e.fallback),n=Vr(e.frame);if(!t||!n)return!1;const l=$e(t,"off"),s=$e(t,"ext");if(!l||!s)return!1;const o=JSON.stringify([n.attrs,n.children]);n.attrs=t.attrs.map(r=>({...r,name:{...r.name}})),n.children=[xe("a","off",{x:gt(l,"x")??"0",y:gt(l,"y")??"0"}),xe("a","ext",{cx:gt(s,"cx")??"0",cy:gt(s,"cy")??"0"})];const a=e.kind==="slide"?$e($e($e($e($e(e.frame,"graphic"),"graphicData"),"sldZm"),"sldZmObj"),"zmPr"):void 0,i=a?$e(Vr(a),"ext"):void 0;return i&&(i.attrs=[...s.attrs]),JSON.stringify([n.attrs,n.children])!==o}function Q2(e){let t=0;for(const n of pe(e))zf(n).map(H2).some(Boolean)&&(Ka(n),t+=1);return t}function X2(e,t,n){const l=pe(e).find(s=>We(s)===t);return l?zf(l).find(s=>G2(s.fallback)===String(n))?.kind??null:null}function Z2(e,t){const n=r=>{const u=jt(e,r);return u?new TextDecoder().decode(u):""},l=(r,u)=>new RegExp(`\\s${u}="([^"]*)"`).exec(r)?.[1],s=We(t).replace(/^\/ppt\//,""),o=[...n("/ppt/_rels/presentation.xml.rels").matchAll(/<Relationship\b[^>]*>/g)].map(([r])=>r).find(r=>l(r,"Target")?.replace(/^\/ppt\//,"")===s),a=o?l(o,"Id"):void 0,i=a?[...n("/ppt/presentation.xml").matchAll(/<p:sldId\b[^>]*>/g)].map(([r])=>r).find(r=>l(r,"r:id")===a):void 0;return i?l(i,"id")??null:null}const Y2={slide:{prefix:"pslz",container:"sldZm",object:"sldZmObj",uri:"http://schemas.microsoft.com/office/powerpoint/2016/slidezoom"},section:{prefix:"psez",container:"sectionZm",object:"sectionZmObj",uri:"http://schemas.microsoft.com/office/powerpoint/2016/sectionzoom"}};function J2(e,t){const n=$e($e(e,"nvPicPr"),"cNvPr"),l=gt($e($e(e,"blipFill"),"blip"),"embed"),s=$e($e(e,"spPr"),"xfrm"),o=$e(s,"ext");if(!n||!l||!s||!o)return null;const a=Y2[t.kind],i={cx:gt(o,"cx")??"0",cy:gt(o,"cy")??"0"},r=xe("a","ln",{w:"3175"},[xe("a","solidFill",{},[xe("a","prstClr",{val:"ltGray"})])]),u=xe(a.prefix,a.container,{},[xe(a.prefix,a.object,t.attrs,[xe(a.prefix,"zmPr",{id:`{${Wi().toUpperCase()}}`,returnToParent:t.returnToParent?"1":"0",transitionDur:"1000"},[xe("p166","blipFill",{},[xe("a","blip",{"r:embed":l}),xe("a","stretch",{},[xe("a","fillRect")])]),xe("p166","spPr",{},[xe("a","xfrm",{},[xe("a","off",{x:"0",y:"0"}),xe("a","ext",i)]),xe("a","prstGeom",{prst:"rect"},[xe("a","avLst")]),r])])])]),c=xe("p","graphicFrame",{},[xe("p","nvGraphicFramePr",{},[xe("p","cNvPr",{id:gt(n,"id")??"0",name:gt(n,"name")??""}),xe("p","cNvGraphicFramePr",{},[xe("a","graphicFrameLocks",{noGrp:"1"})]),xe("p","nvPr")]),xe("p","xfrm",{},s.children.map(d=>({...d}))),xe("a","graphic",{},[xe("a","graphicData",{uri:a.uri},[u])])]);return $e(e,"spPr").children.push(xe("a","ln",{w:"3175"},[xe("a","solidFill",{},[xe("a","prstClr",{val:"ltGray"})])])),xe("mc","AlternateContent",{},[xe("mc","Choice",{Requires:a.prefix},[c]),xe("mc","Fallback",{},[e])])}function Ir(e,t,n,l,s){const o=Zs(e,n,{x:j(l.x),y:j(l.y),w:j(l.width),h:j(l.height),format:"png"});fn(o,`${s.kind==="slide"?"幻灯片缩放":"节缩放"} ${Fe(o)}`),Di(o,{kind:"slide",slide:t});const a=$e($e(Na(e),"cSld"),"spTree"),i=a?.children.findIndex(u=>u.name?.localName==="pic"&>($e($e(u,"nvPicPr"),"cNvPr"),"id")===String(Fe(o)))??-1,r=a&&i>=0?J2(a.children[i],s):null;return!a||!r?!1:(a.children[i]=r,Ka(e),!0)}const e$={name:"zooms",addCommands:()=>({addSlideZoom:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=ae(t,e.target),o=s?Z2(t,s):null;return l===null||s===null||o===null||e.picture.length===0||e.width<=0||e.height<=0?!1:n?Ir(l,s,e.picture,e,{kind:"slide",attrs:{sldId:o,cId:"0"},returnToParent:!1}):!0}})},t$="摘要部分";function n$(e,t){const n=Math.ceil(Math.sqrt(e)),l=Math.ceil(e/n),s={x:t.width*.08,y:t.height*.28,width:t.width*.84,height:t.height*.64},o={width:s.width/n,height:s.height/l},a=Math.min(o.width/t.width,o.height/t.height)*.9,i={width:Math.round(t.width*a),height:Math.round(t.height*a)};return Array.from({length:e},(r,u)=>{const c=u%n,d=Math.floor(u/n),p=(n-(d===l-1?e-d*n:n))*o.width/2;return{x:Math.round(s.x+p+c*o.width+(o.width-i.width)/2),y:Math.round(s.y+d*o.height+(o.height-i.height)/2),...i}})}const l$=new Set(["title","ctrTitle","dt","ftr","sldNum"]);function s$(e){for(const t of ot(e)){if(!Zc(t)||l$.has(U0(t)??""))continue;let n="";try{n=ze(t)}catch{}n.trim()||pn(t)}}const o$={name:"section-zooms",addCommands:()=>({addSectionZoom:e=>({presentation:t,dispatch:n})=>{const l=ae(t,e.slide),s=it(t)[e.section],o=s&&s.count>0?pe(t)[s.start]:void 0;return!l||!s?.id||!o||e.picture.length===0||e.width<=0||e.height<=0?!1:n?Ir(l,o,e.picture,e,{kind:"section",attrs:{sectionId:s.id},returnToParent:!1}):!0},addSummaryZoom:e=>({presentation:t,dispatch:n})=>{const l=it(t),s=pe(t),o=e.sections.map((f,h)=>({index:f,section:l[f],picture:e.pictures[h]})).filter(f=>f.section?.id&&f.section.count>0&&f.picture&&f.picture.length>0);if(o.length===0)return!1;if(!n)return!0;const a=Math.min(...o.map(f=>f.index)),i=l[a].start,r=o.map(f=>s[f.section.start]),u=ii(t,"titleOnly")??ii(t,"obj")??Pt(s[i]);if(!u)return!1;const c=e0(t,i,{layout:u});try{a1(c,e.title??"摘要")}catch{}s$(c),Ml(t,$s([...l.slice(0,a),{name:t$,count:1},...l.slice(a)]));const d=Rt(t),p=n$(o.length,d?{width:Number(d.width),height:Number(d.height)}:{width:12192e3,height:6858e3});return o.every((f,h)=>Ir(c,r[h],f.picture,p[h],{kind:"section",attrs:{sectionId:f.section.id},returnToParent:!0}))}})},a$={name:"insert-extras",addCommands:()=>({...kk.addCommands(),...O2.addCommands(),...w2.addCommands(),...U2.addCommands(),...z2.addCommands(),...W2.addCommands(),...Hg.addCommands(),...j2.addCommands(),...e$.addCommands(),...o$.addCommands()})},Qo=100,bt=e=>({x:e.x*Qo,y:e.y*Qo});function i$(e){let t=0;const n=()=>{for(;t<e.length&&/[\s,]/u.test(e[t]);)t+=1};return{command(){n();const l=e[t];if(l!==void 0&&/[A-Za-z]/u.test(l))return t+=1,l},more(){return n(),t<e.length&&/[-+.\d]/u.test(e[t])},number(){n();const l=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/u.exec(e.slice(t));if(!l)throw new Error(`Bad path data at ${t}`);return t+=l[0].length,Number(l[0])},flag(){n();const l=e[t];return t+=1,l==="1"}}}function r$(e,t,n,l,s,o,a){if(t===0||n===0||e.x===a.x&&e.y===a.y)return[[e,a,a]];const i=l*Math.PI/180,r=Math.cos(i),u=Math.sin(i),c=(e.x-a.x)/2,d=(e.y-a.y)/2,p=r*c+u*d,f=-u*c+r*d;let h=Math.abs(t),v=Math.abs(n);const g=p*p/(h*h)+f*f/(v*v);g>1&&(h*=Math.sqrt(g),v*=Math.sqrt(g));const $=(s===o?-1:1)*Math.sqrt(Math.max(0,(h*h*v*v-h*h*f*f-v*v*p*p)/(h*h*f*f+v*v*p*p))),b=$*h*f/v,w=-$*v*p/h,S=r*b-u*w+(e.x+a.x)/2,C=u*b+r*w+(e.y+a.y)/2,E=(W,te,he,Ye)=>Math.atan2(W*Ye-te*he,W*he+te*Ye),T=E(1,0,(p-b)/h,(f-w)/v);let z=E((p-b)/h,(f-w)/v,(-p-b)/h,(-f-w)/v);!o&&z>0&&(z-=2*Math.PI),o&&z<0&&(z+=2*Math.PI);const D=Math.ceil(Math.abs(z)/(Math.PI/2)-1e-9),P=z/D,I=4/3*Math.tan(P/4),K=W=>({x:S+h*Math.cos(W)*r-v*Math.sin(W)*u,y:C+h*Math.cos(W)*u+v*Math.sin(W)*r}),G=W=>({x:-h*Math.sin(W)*r-v*Math.cos(W)*u,y:-h*Math.sin(W)*u+v*Math.cos(W)*r}),ee=[];for(let W=0;W<D;W+=1){const te=T+W*P,he=te+P,Ye=K(te),et=W===D-1?a:K(he),ct=G(te),Be=G(he);ee.push([{x:Ye.x+I*ct.x,y:Ye.y+I*ct.y},{x:et.x-I*Be.x,y:et.y-I*Be.y},et])}return ee}function u$(e){const t=i$(e),n=[];let l={x:0,y:0},s=l,o=null,a;for(;a=t.command()??(t.more()&&a?a==="M"?"L":a==="m"?"l":a:void 0);){const i=a===a.toLowerCase(),r=i?l:{x:0,y:0},u=()=>{const p=t.number(),f=t.number();return{x:r.x+p,y:r.y+f}},c=a.toUpperCase();let d=null;if(c==="M")l=s=u(),n.push({kind:"moveTo",pt:bt(l)});else if(c==="L")l=u(),n.push({kind:"lnTo",pt:bt(l)});else if(c==="H")l={x:(i?l.x:0)+t.number(),y:l.y},n.push({kind:"lnTo",pt:bt(l)});else if(c==="V")l={x:l.x,y:(i?l.y:0)+t.number()},n.push({kind:"lnTo",pt:bt(l)});else if(c==="C"||c==="S"){const p=c==="C"?u():o?{x:2*l.x-o.x,y:2*l.y-o.y}:l,f=u(),h=u();n.push({kind:"cubicBezTo",pts:[bt(p),bt(f),bt(h)]}),d=f,l=h}else if(c==="Q"||c==="T"){const p=c==="Q"?u():o?{x:2*l.x-o.x,y:2*l.y-o.y}:l,f=u();n.push({kind:"quadBezTo",pts:[bt(p),bt(f)]}),d=p,l=f}else if(c==="A"){const p=t.number(),f=t.number(),h=t.number(),v=t.flag(),g=t.flag(),$=u();for(const[b,w,S]of r$(l,p,f,h,v,g,$))n.push({kind:"cubicBezTo",pts:[bt(b),bt(w),bt(S)]});l=$}else if(c==="Z")n.push({kind:"close"}),l=s;else throw new Error(`Unsupported path command ${a}`);o=c==="C"||c==="S"||c==="Q"||c==="T"?d:null,c==="Z"&&(a=void 0)}return n}function c$(e){return Object.fromEntries([...e.matchAll(/([\w-]+)="([^"]*)"/gu)].map(t=>[t[1],t[2]]))}function d$(e,t){const n=(l,s=0)=>Number(t[l]??s);if(e==="path")return t.d??"";if(e==="line")return`M${n("x1")} ${n("y1")}L${n("x2")} ${n("y2")}`;if(e==="polyline"||e==="polygon"){const l=(t.points??"").trim().split(/[\s,]+/u).map(Number),s=l.flatMap((o,a)=>a%2===0?[`${o} ${l[a+1]}`]:[]);return s.length===0?"":`M${s.join("L")}${e==="polygon"?"Z":""}`}if(e==="circle"||e==="ellipse"){const l=n("cx"),s=n("cy"),o=n(e==="circle"?"r":"rx"),a=n(e==="circle"?"r":"ry");return`M${l-o} ${s}A${o} ${a} 0 1 0 ${l+o} ${s}A${o} ${a} 0 1 0 ${l-o} ${s}Z`}if(e==="rect"){const l=n("x"),s=n("y"),o=n("width"),a=n("height"),i=Math.min(o/2,n("rx",Number(t.ry??0))),r=Math.min(a/2,n("ry",i));return i===0||r===0?`M${l} ${s}H${l+o}V${s+a}H${l}Z`:`M${l+i} ${s}H${l+o-i}A${i} ${r} 0 0 1 ${l+o} ${s+r}V${s+a-r}A${i} ${r} 0 0 1 ${l+o-i} ${s+a}H${l+i}A${i} ${r} 0 0 1 ${l} ${s+a-r}V${s+r}A${i} ${r} 0 0 1 ${l+i} ${s}Z`}return""}function p$(e){const[,,t=24,n=24]=/viewBox="([^"]+)"/u.exec(e)?.[1]?.trim().split(/[\s,]+/u).map(Number)??[0,0,24,24],l=[...e.matchAll(/<(path|line|polyline|polygon|circle|ellipse|rect)\b([^>]*)>/gu)].flatMap(s=>u$(d$(s[1],c$(s[2]))));return l.length===0?null:{w:t*Qo,h:n*Qo,fill:"none",stroke:!0,commands:l}}const f$=Object.freeze([xw,kw,bw,ax,X1,Y1,Z1,ex,rx,tx,Gx,Kx,Nx,Xg,Tw,Sw,ox,mw,vw,gw,Qx,uw,lw,iw,Zx,Ww,xk,ok,Tk,Ak,Q1,G1,yb,cb,qg,ub,_1,Ek,Yk,t2,l2,y2,Gk,a$]),m$=12700,h$=new Set(",。、;:?!)]}」』】〉》〕〗〙…—~·%‰℃’”,.;:?!)]}%ーぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ々"),v$=new Set("([{「『【〈《〔〖〘‘“([{");function g$(e){return e.match(/[A-Za-z0-9À-ɏ'’.,%-]+|\s+|./gsu)??[]}function b$(e,t){let n=1,l=0,s=0,o="";for(const a of e)if(!(/^\s+$/u.test(a.text)&&(l===0||l+a.width>t))){for(l+a.width<=t||l===0?l+=a.width:(h$.has(a.text[0])||v$.has(o.at(-1)??""))&&s+a.width<=t&&l>s?(n+=1,l=s+a.width):(n+=1,l=a.width);l>t&&a.width>t;)n+=1,l-=t;s=a.width,o=a.text}return n}function y$(e){const t=e.getContext("2d");if(!t)return;const n=new Map,l=(s,o)=>{const a=`${o}|${s}`;let i=n.get(a);return i===void 0&&(t.font=o,i=t.measureText(s).width,n.set(a,i)),i};return{lines(s,o,a){const i=`${o.bold?"700 ":""}${o.size}px ${o.family}`;return b$(g$(s).map(r=>({text:r,width:l(r,i)})),a/m$)}}}const rt=36e4,Df=new WeakMap;function Tl(e){let t=Df.get(e);return t||(t=Q(),Df.set(e,t)),t}function Ot(e){const t=e.current.value?.part;if(!t||e.selected.value.length!==1)return;const n=e.boxes.value.find(l=>l.id===e.selected.value[0]);return n?.kind==="table"?{slide:t,box:n}:void 0}function x$(e,t){return{row:Math.min(e.row,t.row),column:Math.min(e.column,t.column),rows:Math.abs(e.row-t.row)+1,columns:Math.abs(e.column-t.column)+1}}function w$(e){e.tick.value;const t=Ot(e),n=Tl(e).value;if(!t||!n||n.slide!==t.slide||n.shape!==t.box.id)return;const l=De(e.session.document.presentation(),t.slide,t.box.id);return l?gn(l,x$(n.anchor,n.head))??void 0:void 0}let Al;function yt(e){e.tick.value;const t=Ot(e);if(!t)return;const{document:n}=e.session,l=n.presentation(),s=n.version(),o=Tl(e).value,a=`${t.slide}|${t.box.id}|${o&&o.shape===t.box.id?`${o.anchor.row},${o.anchor.column},${o.head.row},${o.head.column}`:""}`;if(Al&&Al.presentation===l&&Al.version===s&&Al.key===a)return Al.target;const i=w$(e),r=ar(l,t.slide,t.box.id,i),u=r?{slide:t.slide,shape:t.box.id,info:r,range:i??{row:0,column:0,rows:r.rows,columns:r.columns},picked:i!==void 0}:void 0;return Al={presentation:l,version:s,key:a,target:u},u}function k$(e,t,n){const l=(d,p)=>{const f=d.findIndex((h,v)=>v>0&&p<h)-1;return f<0?p<0?0:d.length-2:f},s=-t.rotation*Math.PI/180,o=t.x+t.width/2,a=t.y+t.height/2,i=n.x-o,r=n.y-a,u=o+i*Math.cos(s)-r*Math.sin(s)-t.x,c=a+i*Math.sin(s)+r*Math.cos(s)-t.y;return{row:l(e.rowEdges,c),column:l(e.columnEdges,u)}}const $$={key:0,class:"pptx-property-section","aria-label":"单元格边距"},S$={class:"pptx-section-label"},C$={class:"pptx-property-grid"},M$=O({__name:"cell-margins",props:{state:{},shape:{}},setup(e){const t=e,n=[["left","左"],["right","右"],["top","上"],["bottom","下"]],l=F(()=>yt(t.state)),s=r=>String(Math.round(r/rt*100)/100),o=F(()=>{const r=l.value?.info.margins;return r?Object.fromEntries(n.map(([u])=>[u,s(r[u])])):void 0}),a=V(o.value?{...o.value}:void 0);X(o,r=>{a.value=r?{...r}:void 0});function i(r){const u=l.value,c=Number(a.value?.[r]);if(!u||!a.value||a.value[r]===o.value?.[r])return;if(!Number.isFinite(c)||c<0){a.value=o.value?{...o.value}:void 0;return}const d={[r]:Math.round(c*rt)};t.state.session.commands.setTableCellsMargins({slide:u.slide,shape:u.shape,range:u.range,margins:d})}return(r,u)=>l.value&&a.value?(x(),M("section",$$,[k("div",S$,[k("span",null,N(l.value.picked?"所选单元格边距":"单元格边距"),1),u[0]||(u[0]=k("span",{class:"text-qk-text-tertiary"},"厘米",-1))]),k("div",C$,[(x(),M(U,null,H(n,([c,d])=>y(m(re),{key:c,label:d},{default:A(({controlProps:p})=>[y(m(de),ie({ref_for:!0},p,{modelValue:a.value[c],"onUpdate:modelValue":f=>a.value[c]=f,label:`${d}边距`,min:0,step:.05,onBlur:f=>i(c),onKeydown:ue(f=>i(c),["enter"])}),null,16,["modelValue","onUpdate:modelValue","label","onBlur","onKeydown"])]),_:2},1032,["label"])),64))])])):L("v-if",!0)}}),Ee=new S1({nodes:{doc:{content:"paragraph+"},paragraph:{content:"inline*",attrs:{style:{default:""},align:{default:null},initialAlign:{default:null},bullet:{default:null},bulletStyle:{default:""},list:{default:null}},parseDOM:[{tag:"p",getAttrs:e=>{const t=e.getAttribute("data-list");if(!t)return{};const n=JSON.parse(t);return{list:n,bullet:e.getAttribute("data-list-marker"),bulletStyle:"margin-right:0.4em",style:`padding-left:${n.level*1.5}em`}}}],toDOM:e=>["p",{style:String(e.attrs.style)},0]},text:{group:"inline"},hard_break:{inline:!0,group:"inline",selectable:!1,attrs:{style:{default:""}},parseDOM:[{tag:"br"}],toDOM:e=>["span",{style:String(e.attrs.style)},["br"]]}},marks:{link:{attrs:{href:{default:""}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>({href:e.getAttribute("href")??""})}],toDOM:e=>["a",{href:String(e.attrs.href),"data-pptx-link":"",style:"color:inherit;text-decoration:inherit"},0]},run:{attrs:{style:{default:""},format:{default:null}},inclusive:!0,parseDOM:[{tag:"span",getAttrs:e=>({style:e.getAttribute("style")??""})}],toDOM:e=>["span",{style:String(e.attrs.style)},0]}}}),P$=(e,t)=>{const{$from:n}=e.selection,l=n.parent;if(l.type!==Ee.nodes.paragraph)return!1;if(t){const s=e.storedMarks??n.marks(),o=e.tr;e.selection.empty||o.deleteSelection(),o.split(o.selection.from,1,[{type:l.type,attrs:l.attrs}]),o.ensureMarks(s.length>0?s:n.nodeAfter?.marks??[]),t(o.scrollIntoView())}return!0};function Ss(e){const{selection:t}=e;let n;if(!t.empty&&(e.doc.nodesBetween(t.from,t.to,s=>n||!s.isText?!n:(n=s.marks.find(o=>o.type===Ee.marks.run),!1)),n))return n;const l=t.$from.nodeAfter?.marks.find(s=>s.type===Ee.marks.run);return(e.storedMarks??t.$from.marks()).find(s=>s.type===Ee.marks.run)??l}function Lf(e,t){return e.textBetween(0,t,`
|
|
55
|
+
`,`
|
|
56
|
+
`).length}function Vf(e,t){let n=t,l=e.content.size-1;return e.forEach((s,o,a)=>{l!==e.content.size-1||n<0||(a>0&&(n-=1),n<=s.content.size?l=o+1+Math.max(0,n):n-=s.content.size)}),Math.max(1,Math.min(l,e.content.size-1))}function T$(e,t,n){return{start:Lf(e,t),end:Lf(e,n)}}function Xt(e){const t=new Map;for(const n of e.match(/(?:[^;"']|"[^"]*"|'[^']*')+/gu)??[]){const l=n.indexOf(":");l>0&&t.set(n.slice(0,l).trim().toLowerCase(),n.slice(l+1).trim())}return t}function Br(e){return[...e].map(([t,n])=>`${t}:${n}`).join(";")}function A$(e,t,n){const l=Xt(e),s=l.has("vertical-align"),o=(Number.parseFloat(l.get("font-size")??"")||0)/(s?Ur:1),a=t.size!==void 0?t.size*n:o,i=t.baseline??(s?If(l,o):0);if((t.size!==void 0||t.baseline!==void 0)&&(i===0?l.delete("vertical-align"):l.set("vertical-align",`${(i*a).toFixed(2)}px`),a>0&&l.set("font-size",`${(a*(i===0?1:Ur)).toFixed(2)}px`)),t.bold!==void 0&&l.set("font-weight",t.bold?"700":"400"),t.italic!==void 0&&l.set("font-style",t.italic?"italic":"normal"),t.underline!==void 0||t.strike!==void 0){const r=Bf(l),u=t.underline??r.underline,c=t.strike??r.strike;l.delete("text-decoration"),l.set("text-decoration-line",[u?"underline":"",c?"line-through":""].filter(Boolean).join(" ")||"none")}return t.highlight!==void 0&&(t.highlight===null?l.delete("background-color"):l.set("background-color",t.highlight)),t.color!==void 0&&t.color!==null&&l.set("color",t.color),t.font!==void 0&&l.set("font-family",`"${t.font}", ${l.get("font-family")??"sans-serif"}`),Br(l)}function Or(e,t){const n=Xt(e),l=n.has("vertical-align"),s=Number.parseFloat(n.get("font-size")??"")/(l?Ur:1),o=n.get("font-weight")??"",a=n.get("color")??"",i=n.get("background-color")??"",r=/^\s*"?([^",]+)"?/u.exec(n.get("font-family")??"")?.[1]?.trim()??null;return{size:Number.isFinite(s)?Math.round(s/t*2)/2:null,bold:o==="bold"||Number.parseInt(o,10)>=600,italic:n.get("font-style")==="italic",...Bf(n),color:/^#[\da-f]{6}$/iu.test(a)?a.toUpperCase():null,highlight:/^#[\da-f]{6}$/iu.test(i)?i.toUpperCase():null,font:r,baseline:l?If(n,s):0}}const Ur=.65;function If(e,t){const n=Number.parseFloat(e.get("vertical-align")??"");return!Number.isFinite(n)||t<=0?e.get("vertical-align")==="super"?.3:e.get("vertical-align")==="sub"?-.25:0:Math.round(n/t*100)/100}function Bf(e){const t=`${e.get("text-decoration")??""} ${e.get("text-decoration-line")??""}`;return{underline:t.includes("underline"),strike:t.includes("line-through")}}function E$(e){const t=Xt(e).get("text-align");return t==="left"||t==="center"||t==="right"||t==="justify"?t:null}function F$(e,t){const n=Xt(e);return n.set("text-align",t),Br(n)}const z$=/[]/gu;function Nr(e,t){const n=[...e.querySelector(`[data-pptx-shape-id="${t}"]`)?.querySelectorAll("foreignObject")??[]].find(a=>a.querySelector("p[data-pptx-paragraph]")),l=n?.firstElementChild;if(!n||!l)return null;const s=[...l.querySelectorAll(":scope > p[data-pptx-paragraph]")].map(D$);if(s.length===0)return null;let o="";for(const a of s)a.descendants(i=>(o||=String(i.marks[0]?.attrs.style??""),!o));return{runStyle:o,doc:Ee.node("doc",null,s),box:{x:Number(n.getAttribute("x")),y:Number(n.getAttribute("y")),width:Number(n.getAttribute("width")),height:Number(n.getAttribute("height"))},containerStyle:l.getAttribute("style")??"",rendered:n}}function D$(e){const t=e.getAttribute("style")??"",n=[...e.children];let l=null,s="";const o=n[0],a=Xt(o?.getAttribute("style")??"");o&&a.has("margin-right")&&!a.has("line-height")&&!o.querySelector("br")&&(l=o.textContent??"",s=o.getAttribute("style")??"",n.shift());const i=[];let r="";for(const d of n)Of(d,i,p=>{r||=p});const u=r?Rr(t,r):t,c=E$(t);return Ee.node("paragraph",{style:u,align:c,initialAlign:c,bullet:l,bulletStyle:s},i)}function Of(e,t,n,l){const s=e.tagName.toLowerCase()==="a"?e.getAttribute("href")??l:l,o=e.getAttribute("style")??"";if(o&&n(o),e.querySelector("br")&&!e.querySelector("span")){t.push(Ee.node("hard_break",{style:o}));return}const a=[...e.children];if(a.length>0&&a.every(u=>u.tagName.toLowerCase()!=="br")){for(const u of a)Of(u,t,n,s??void 0);return}const i=(e.textContent??"").replace(z$,"");if(i.length===0)return;const r=[Ee.marks.run.create({style:o,format:null})];s&&r.unshift(Ee.marks.link.create({href:s})),t.push(Ee.text(i,r))}function Rr(e,t){const n=Xt(e),l=Xt(t);return n.set("--pptx-empty-size",l.get("font-size")??"0"),n.set("--pptx-empty-line",l.get("line-height")??"normal"),[...n].map(([s,o])=>`${s}:${o}`).join(";")}function Xo(e){const t=[];return e.forEach(n=>{let l="";n.forEach(s=>{l+=s.isText?s.text??"":s.type.name==="hard_break"?"\u2028":""}),t.push(l)}),t.join("\u2029")}function L$(e,t){const n=Xo(t);let l=0;for(;l<e.length&&l<n.length&&e[l]===n[l];)l+=1;let s=0;for(;s<e.length-l&&s<n.length-l&&e[e.length-1-s]===n[n.length-1-s];)s+=1;const o=e===n?null:{start:l,end:e.length-s,tokens:V$(n.slice(l,n.length-s))},a=[],i=[];let r=0;return t.forEach((u,c,d)=>{d>0&&(r+=1),i.push(u.attrs.align!==u.attrs.initialAlign?u.attrs.align:null),u.forEach(p=>{const f=p.isText?p.text?.length??0:1,h=p.marks.find(v=>v.type===Ee.marks.run)?.attrs.format;if(h){const v=a.at(-1);v&&v.end===r&&JSON.stringify(v.format)===JSON.stringify(h)?v.end+=f:a.push({start:r,end:r+f,format:h})}r+=f})}),{replace:o,formats:a,aligns:i}}function V$(e){const t=[];for(const n of e.split(/([\u2028\u2029])/u))n==="\u2029"?t.push({kind:"paragraph"}):n==="\u2028"?t.push({kind:"break"}):n.length>0&&t.push({kind:"text",text:n});return t}function Uf(e){const t=[];let n=0;return e.forEach((l,s,o)=>{o>0&&(n+=1),l.forEach(a=>{const i=a.isText?a.text?.length??0:1,r=a.marks.find(u=>u.type===Ee.marks.link)?.attrs.href;if(r){const u=t.at(-1);u&&u.end===n&&u.url===r?t[t.length-1]={...u,end:n+i}:t.push({start:n,end:n+i,url:r})}n+=i})}),t}function I$(e,t){const n=Uf(t);if(JSON.stringify(e)===JSON.stringify(n))return[];let l=0;return t.forEach((s,o,a)=>{l+=(a>0?1:0)+s.content.size}),[{start:0,end:l,url:null},...n]}function jr(e){const t=Ee.marks.link,{$from:n}=e.selection,l=[...n.nodeAfter?.marks??[],...n.nodeBefore?.marks??[]].find(i=>i.type===t);if(!l)return;const s=[];let o=n.start();n.parent.forEach(i=>{if(i.marks.some(r=>r.eq(l))){const r=s.at(-1);r&&r.to===o?r.to=o+i.nodeSize:s.push({from:o,to:o+i.nodeSize})}o+=i.nodeSize});const a=s.find(i=>i.from<=n.pos&&n.pos<=i.to);return a?{href:String(l.attrs.href),...a}:void 0}function Kr(e,t){const{state:n}=e,l=Ee.marks.link,s=n.selection.empty?jr(n):void 0,o=s?.from??n.selection.from,a=s?.to??n.selection.to,i=n.tr;if(o===a){if(t===null)return;i.insertText(t,o).addMark(o,o+t.length,l.create({href:t})),i.setSelection(_i.create(i.doc,o+t.length))}else i.removeMark(o,a,l),t!==null&&i.addMark(o,a,l.create({href:t}));e.dispatch(i),e.focus()}const B$={"·":"•","":"•","":"■","":"➢","":"✓",o:"○"};function O$(e){const t=e.trim(),n=/^(\()?([0-9]+|[a-z]+|[A-Z]+)([.)、])?$/u.exec(t);if(!n||!n[1]&&!n[3])return;const[,l,s,o]=n;return`${/^[0-9]+$/u.test(s)?"arabic":/^[ivxlcdm]+$/u.test(s)?"romanLc":/^[IVXLCDM]+$/u.test(s)?"romanUc":/^[a-z]+$/u.test(s)?"alphaLc":"alphaUc"}${l?"ParenBoth":o===")"?"ParenR":"Period"}`}function U$(e,t){const n=O$(e);if(n)return{style:{kind:"number",scheme:n},level:t,marker:e.trim()};const l=B$[e.trim().charAt(0)]??(e.trim().charAt(0)||"•");return{style:{kind:"bullet",char:l},level:t,marker:l}}function N$(e,t){const n=/mso-list:\s*l\d+\s+level(\d+)/u.exec(e.getAttribute("style")??"");if(n&&t!==void 0)return U$(t,Number(n[1])-1);if(e.tagName!=="LI")return;let l=-1;for(let r=e.parentElement;r;r=r.parentElement)(r.tagName==="UL"||r.tagName==="OL")&&(l+=1);const s=e.closest("ul, ol");if(s?.tagName!=="OL")return{style:{kind:"bullet",char:"•"},level:Math.max(0,l),marker:"•"};const o=s.getAttribute("type")??"1",a=o==="a"?"alphaLcPeriod":o==="A"?"alphaUcPeriod":o==="i"?"romanLcPeriod":o==="I"?"romanUcPeriod":"arabicPeriod",i=[...s.children].filter(r=>r.tagName==="LI").indexOf(e)+1;return{style:{kind:"number",scheme:a},level:Math.max(0,l),marker:`${i}.`}}function R$(e){const t=n=>n.replace(/&/gu,"&").replace(/"/gu,""");return` data-list="${t(JSON.stringify({style:e.style,level:e.level}))}" data-list-marker="${t(e.marker)}"`}function j$(e){const t=[];let n=0;return e.forEach((l,s,o)=>{o>0&&(n+=1);const a=l.content.size,i=l.attrs.list;i&&t.push({start:n,end:n+a,style:i.style,level:i.level}),n+=a}),t}const K$=["font-weight","font-style","text-decoration-line","vertical-align","color","background-color","font-size","font-family"],W$={B:{"font-weight":"700"},STRONG:{"font-weight":"700"},I:{"font-style":"italic"},EM:{"font-style":"italic"},U:{"text-decoration-line":"underline"},INS:{"text-decoration-line":"underline"},S:{"text-decoration-line":"line-through"},STRIKE:{"text-decoration-line":"line-through"},DEL:{"text-decoration-line":"line-through"},SUP:{"vertical-align":"super"},SUB:{"vertical-align":"sub"}};function Nf(e){const t=new Map(Object.entries(W$[e.tagName]??{}));if(e.tagName==="FONT"){const l=e.getAttribute("color"),s=e.getAttribute("face");l&&t.set("color",l),s&&t.set("font-family",s)}const n=Xt(e.getAttribute("style")??"");for(const l of K$){const s=n.get(l)??(l==="text-decoration-line"?n.get("text-decoration"):void 0);s&&t.set(l,s)}n.get("font-weight")==="bold"&&t.set("font-weight","700");for(const l of["color","background-color"]){const s=t.get(l);s&&t.set(l,q$(s)??s)}return t}function q$(e){const t=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/iu.exec(e);if(t)return`#${t.slice(1,4).map(l=>Number(l).toString(16).padStart(2,"0")).join("").toUpperCase()}`;const n=/^#([\da-f]{6})$/iu.exec(e)??/^#([\da-f])([\da-f])([\da-f])$/iu.exec(e);return n?`#${n.length===2?n[1]:n.slice(1).map(l=>l+l).join("")}`.toUpperCase():void 0}function _$(e){const t=e.get("vertical-align"),n=Number.parseFloat(e.get("font-size")??"");return t!=="super"&&t!=="sub"||!Number.isFinite(n)?e:new Map(e).set("font-size",`${Math.round(n*.65*100)/100}px`)}const G$=["size","bold","italic","underline","strike","color","highlight","font","baseline"];function H$(e,t,n){const l=Or(t,n),s=Ee.marks.run,o=r=>{if(!r.isText)return r.copy(Cd.fromArray(a(r.content)));const u=r.marks.find(p=>p.type===s);if(!u)return r;const c=Or(String(u.attrs.style),n),d={};for(const p of G$)c[p]!==l[p]&&c[p]!==null&&(d[p]=c[p]);return Object.keys(d).length===0?r:r.mark(r.marks.map(p=>p===u?s.create({style:u.attrs.style,format:d}):p))},a=r=>{const u=[];return r.forEach(c=>u.push(o(c))),u},i=e.content.firstChild?.attrs.list!=null;return new C1(Cd.fromArray(a(e.content)),i?0:e.openStart,e.openEnd)}function Q$(e,t=""){const n=new DOMParser().parseFromString(e,"text/html"),l=new Map;for(const u of n.querySelectorAll("[style*='mso-list:Ignore'], [style*='mso-list: Ignore']")){const c=u.closest("p, li");c&&!l.has(c)&&l.set(c,u.textContent??""),u.remove()}const s=[];let o=[],a="";const i=()=>{o.length&&s.push(`<p${a}>${o.join("")}</p>`),o=[],a=""},r=(u,c)=>{if(u.nodeType===Node.TEXT_NODE){const h=u.textContent??"";if(h.trim()===""&&/\n/u.test(h))return;const v=n.createElement("span");v.setAttribute("style",Br(_$(c))),v.textContent=h,o.push(v.outerHTML);return}if(!(u instanceof Element)||["STYLE","SCRIPT","HEAD","TITLE","META"].includes(u.tagName))return;if(u.tagName==="BR"){o.push("<br>");return}const d=u.tagName==="A"?u.getAttribute("href")??"":"";if(/^(https?:|mailto:)/iu.test(d)){const h=o.length;for(const g of u.childNodes)r(g,new Map([...c,...Nf(u)]));const v=n.createElement("a");v.setAttribute("href",d),v.innerHTML=o.splice(h).join(""),o.push(v.outerHTML);return}const p=/^(P|DIV|LI|H[1-6]|TR|BLOCKQUOTE|PRE)$/u.test(u.tagName);if(p){i();const h=N$(u,l.get(u));h&&(a=R$(h))}const f=new Map(c);for(const[h,v]of Nf(u))h==="text-decoration-line"&&f.has(h)&&!f.get(h).includes(v)?f.set(h,`${f.get(h)} ${v}`):f.set(h,v);for(const h of u.childNodes)r(h,f);p&&i()};return r(n.body,Xt(t)),i(),s.join("")}const X$={"Mod-l":"align-left","Mod-e":"align-center","Mod-r":"align-right","Mod-j":"align-justify","Mod-k":"text-link","Mod-]":"size-increase","Mod-[":"size-decrease","Mod-Shift->":"size-increase","Mod-Shift-<":"size-decrease"};function Rf(e){const t=Xo(e.source.doc),n=Uf(e.source.doc),{pixelsPerPoint:l}=e,s=new Md({props:{decorations:p=>{const f=[];return p.doc.forEach((h,v)=>{h.attrs.bullet!==null&&f.push(A1.widget(v+1,()=>{const g=document.createElement("span");return g.setAttribute("style",String(h.attrs.bulletStyle)),g.contentEditable="false",g.textContent=String(h.attrs.bullet),g},{side:-1,ignoreSelection:!0,key:`bullet-${String(h.attrs.bullet)}-${String(h.attrs.bulletStyle)}`}))}),E1.create(p.doc,f)}}}),o=new Md({appendTransaction:(p,f,h)=>{if(!p.some($=>$.docChanged)||!e.source.runStyle)return null;const v=Ee.marks.run.create({style:e.source.runStyle,format:null}),g=h.tr;return h.doc.descendants(($,b)=>{$.isText&&!$.marks.some(w=>w.type===Ee.marks.run)&&g.addMark(b,b+$.nodeSize,v)}),g.docChanged?g:null}}),a=p=>()=>(c.apply({[p]:!c.format()[p]}),!0),i=p=>()=>{const f=c.format().baseline??0;return c.apply({baseline:p?f>0?0:.3:f<0?0:-.25}),!0},r=$1.create({doc:e.source.doc,plugins:[P1(),s,o,Pd({"Mod-z":T1,"Shift-Mod-z":Td,"Mod-y":Td,Enter:P$,"Shift-Enter":(p,f)=>{const h=Ss(p);return f?.(p.tr.replaceSelectionWith(Ee.node("hard_break",{style:`${String(h?.attrs.style??"")};line-height:0;vertical-align:top`})).scrollIntoView()),!0},"Mod-b":a("bold"),"Mod-i":a("italic"),"Mod-u":a("underline"),"Mod-Shift-x":a("strike"),"Mod-Shift-=":i(!0),"Mod-Shift-+":i(!0),"Mod-=":i(!1),...Object.fromEntries(Object.entries(X$).map(([p,f])=>[p,()=>(e.onShortcut?.(f),e.onShortcut!==void 0)])),Escape:()=>(e.onExit(),!0)}),Pd(M1)]}),u=new F1(e.mount,{state:r,transformPastedHTML:(p,f)=>Q$(p,String(Ss(f.state)?.attrs.style??e.source.runStyle)),transformPasted:(p,f)=>H$(p,String(Ss(f.state)?.attrs.style??e.source.runStyle),l),dispatchTransaction(p){u.updateState(u.state.apply(p)),e.onChange()}}),c={shape:e.shape,view:u,format(){const p=u.state,f=Ss(p),h=Or(String(f?.attrs.style??""),l),v=p.selection.$from.parent.attrs.align??null;return{...h,align:v}},apply(p){const f=u.state,{from:h,to:v,empty:g}=f.selection,$=f.tr;if(g){const b=Ss(f);$.setStoredMarks([d(b,p)])}else f.doc.nodesBetween(h,v,(b,w)=>{if(!b.isText)return!0;const S=Math.max(h,w),C=Math.min(v,w+b.nodeSize),E=b.marks.find(T=>T.type===Ee.marks.run);return $.addMark(S,C,d(E,p)),!1});u.dispatch($),u.focus()},align(p){const f=u.state,h=f.tr;f.doc.nodesBetween(f.selection.from,f.selection.to,(v,g)=>v.type!==Ee.nodes.paragraph?!0:(h.setNodeMarkup(g,void 0,{...v.attrs,align:p,style:F$(String(v.attrs.style),p)}),!1)),u.dispatch(h),u.focus()},focus:()=>u.focus(),selection:()=>T$(u.state.doc,u.state.selection.from,u.state.selection.to),caretAt(p,f){const h=u.posAtCoords({left:p,top:f});h&&u.dispatch(u.state.tr.setSelection(_i.create(u.state.doc,h.pos)))},select(p){const f=u.state.doc;u.dispatch(u.state.tr.setSelection(_i.create(f,Vf(f,p.start),Vf(f,p.end))))},result:()=>L$(t,u.state.doc),links:()=>I$(n,u.state.doc),lists:()=>j$(u.state.doc),destroy:()=>u.destroy()};function d(p,f){const h=p?.attrs.format??{};return Ee.marks.run.create({style:A$(String(p?.attrs.style??""),f,l),format:{...h,...f}})}return c}const jf=-7,Kf=new WeakMap;function Zo(e){let t=Kf.get(e);return t||(t=Q(),Kf.set(e,t)),t}function Wf(e,t,n){const l=e.querySelector(`[data-pptx-shape-id="${t}"] [data-pptx-cell="${n.row},${n.column}"]`)??e.querySelector(`[data-pptx-cell="${n.row},${n.column}"]`);if(!l)return null;l.setAttribute("data-pptx-shape-id",String(jf));try{return Nr(e,jf)}finally{l.removeAttribute("data-pptx-shape-id")}}async function Z$(e,t,n,l){const s=await dn(await vl(e.session.document.presentation())),o=De(s,t,n),a=rl(s,t);if(!o||!a)return null;Kt(as(o,l.row,l.column),"X",{preserveFormatting:!0});const i=document.createElement("div");i.innerHTML=Wt(s,a);const r=Wf(i,n,l),u=r?.doc.firstChild;if(!r||!u)return null;const c=Ee.node("paragraph",{...u.attrs,style:Rr(String(u.attrs.style),r.runStyle)});return{...r,doc:Ee.node("doc",null,[c]),rendered:null}}function Y$(e,t,n,l){const s=document.createElement("div");s.className="pptx-text-editor",s.setAttribute("style",l.containerStyle);const o=l.rendered?.firstElementChild;if(l.rendered&&o){const r=o.getAttribute("style");return o.style.display="none",l.rendered.append(s),{mount:s,restore:()=>{s.remove(),r===null?o.removeAttribute("style"):o.setAttribute("style",r)}}}const a=e.querySelector(`[data-pptx-shape-id="${t}"] [data-pptx-cell="${n.row},${n.column}"]`)??e.querySelector(`[data-pptx-cell="${n.row},${n.column}"]`);if(!a)return null;const i=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");for(const[r,u]of Object.entries(l.box))i.setAttribute(r,String(u));return i.setAttribute("overflow","visible"),i.append(s),a.append(i),{mount:s,restore:()=>i.remove()}}async function J$(e,t,n,l,s){Zt(e,!0);const{art:o,cell:a}=l,i=De(e.session.document.presentation(),t,n);if(!i)return!1;const r=cn(as(i,a.row,a.column)),u=(r===""?null:Wf(o,n,a))??await Z$(e,t,n,a);if(!u||e.current.value?.part!==t||r!==""&&Xo(u.doc).replaceAll(/[\u2028\u2029]/gu,`
|
|
57
|
+
`)!==r)return!1;const c=o.querySelector("svg")?.viewBox.baseVal,d=c&&c.width>0?Y$(o,n,a,r===""?{...u,rendered:null}:u):null;if(!d||!c)return!1;const p=Rf({shape:n,source:u,mount:d.mount,pixelsPerPoint:c.width/(e.size.value.width/12700),onChange:()=>{e.editorTick.value+=1},onExit:()=>Zt(e,!0)});if(d.mount.addEventListener("keydown",f=>{!f.isComposing&&s(f)&&f.preventDefault(),f.stopPropagation()}),Zo(e).value={slide:t,shape:n,cell:a,editor:p,...d},Tl(e).value={slide:t,shape:n,anchor:a,head:a},e.textEditor.value=p,p.focus(),l.replaceWith!==void 0){const{view:f}=p;f.dispatch(f.state.tr.insertText(l.replaceWith,1,f.state.doc.content.size-1))}else l.at&&p.caretAt(l.at.x,l.at.y);return!0}function Zt(e,t){const n=Zo(e),l=n.value;if(!l)return!1;n.value=void 0,e.textEditor.value===l.editor&&(e.textEditor.value=void 0);const s=l.editor.result();l.editor.destroy(),l.restore();const o=s.replace!==null||s.formats.length>0||s.aligns.some(a=>a!==null);return t&&o&&e.session.commands.editTableCellText({slide:l.slide,shape:l.shape,row:l.cell.row,column:l.cell.column,edit:s})}const eS=9525,qf=12700,tS=1e4,_f={black:"#000000",white:"#FFFFFF",red:"#FF0000",green:"#008000",blue:"#0000FF",yellow:"#FFFF00",gray:"#808080",grey:"#808080",silver:"#C0C0C0",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",teal:"#008080",aqua:"#00FFFF",fuchsia:"#FF00FF",lime:"#00FF00",orange:"#FFA500"};function Wr(e,t){const n=e.trim().toLowerCase();if(!n||n==="transparent"||n==="none"||n==="auto"||n.startsWith("window"))return;const l=/^#([\da-f]{3}|[\da-f]{6})$/u.exec(n);if(l)return`#${l[1].length===3?[...l[1]].map(i=>i+i).join(""):l[1]}`.toUpperCase();const s=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+%?))?\s*\)$/u.exec(n);if(s)return s[4]!==void 0&&Number.parseFloat(s[4])===0?void 0:`#${s.slice(1,4).map(i=>Math.min(255,Number(i)).toString(16).padStart(2,"0")).join("")}`.toUpperCase();if(_f[n])return _f[n];const o=t?.createElement("canvas").getContext?.("2d");if(!o)return;o.fillStyle="#010203",o.fillStyle=n;const a=String(o.fillStyle);return a==="#010203"?void 0:Wr(a)}function nS(e){const t=new Map;for(const n of e.querySelectorAll("style")){const l=(n.textContent??"").replace(/<!--|-->/gu,"");for(const[,s,o]of l.matchAll(/([^{}]+)\{([^}]*)\}/gu))for(const a of s.split(",")){const i=/^(?:table\s+)?t[dh]$/iu.test(a.trim())?"td":/\.([\w-]+)\s*$/u.exec(a.trim())?.[1];i&&t.set(i,`${t.get(i)??""};${o}`)}}return t}function qr(e){const t=new Map;for(const n of e.split(";")){const l=n.indexOf(":");l>0&&t.set(n.slice(0,l).trim().toLowerCase(),n.slice(l+1).trim().replace(/\s*!important$/u,""))}return t}function Cs(e){const t=/^([\d.]+)\s*(px|pt)?$/u.exec((e??"").trim());if(!t)return;const n=Number(t[1]);return n>0?Math.round(n*(t[2]==="pt"?qf:eS)):void 0}function _r(e){let t="";const n=l=>{l.nodeType===3?t+=(l.textContent??"").replace(/[\s ]+/gu," "):l.nodeName==="BR"?t+=`
|
|
58
|
+
`:l.nodeType===1&&!["STYLE","SCRIPT"].includes(l.nodeName)&&l.childNodes.forEach(n)};return e.childNodes.forEach(n),t.split(`
|
|
59
|
+
`).map(l=>l.trim()).join(`
|
|
60
|
+
`).trim()}function lS(e,t,n){const l={},s=e.get("font-weight"),o=r=>t.querySelector(r)!==null&&_r(t)===_r(t.querySelector(r));(s==="bold"||Number(s)>=600||o("b")||o("strong"))&&(l.bold=!0),(e.get("font-style")==="italic"||o("i")||o("em"))&&(l.italic=!0),(/underline/u.test(e.get("text-decoration")??"")||(e.get("text-underline-style")??"none")!=="none"||o("u"))&&(l.underline=!0),(/line-through/u.test(e.get("text-decoration")??"")||o("s"))&&(l.strike=!0);const a=Wr(e.get("color")??t.querySelector("font[color]")?.getAttribute("color")??"",n);a&&(l.color=a);const i=Cs(e.get("font-size"));return i&&(l.size=Math.round(i/qf*2)/2),Object.keys(l).length>0?l:void 0}function Gf(e,t,n){if(!/<table[\s>]/iu.test(e))return null;const l=t.parseFromString(e,"text/html"),s=l.querySelector("table");if(!s||(l.body.textContent??"").replace(/\s+/gu,"").length-(s.textContent??"").replace(/\s+/gu,"").length>0)return null;const o=nS(l),a=[...s.querySelectorAll("tr")].filter(p=>p.closest("table")===s),i=[],r=[],u=[];let c=0;if(a.forEach((p,f)=>{u[f]=Cs(p.getAttribute("height"))??Cs(qr(p.getAttribute("style")??"").get("height"));let h=0;for(const v of[...p.children].filter(g=>g.nodeName==="TD"||g.nodeName==="TH")){for(;i[f]?.[h];)h+=1;const g=Math.max(1,Math.min(a.length-f,Number(v.getAttribute("rowspan"))||1)),$=Math.max(1,Number(v.getAttribute("colspan"))||1);for(let E=f;E<f+g;E+=1)for(let T=h;T<h+$;T+=1)(i[E]??=[])[T]=!0;const b=qr([o.get("td")??"",...(v.getAttribute("class")??"").split(/\s+/u).map(E=>o.get(E)??""),v.getAttribute("style")??""].join(";")),w=Wr(b.get("background-color")??b.get("background")?.split(/\s+/u)[0]??v.getAttribute("bgcolor")??"",n),S=(b.get("text-align")??v.getAttribute("align")??"").toLowerCase(),C=lS(b,v,n);r.push({row:f,column:h,rows:g,columns:$,text:_r(v),...w?{fill:w}:{},...C?{format:C}:{},...["left","center","right","justify"].includes(S)?{align:S}:{}}),h+=$,c=Math.max(c,h)}}),a.length===0||c===0||a.length*c>tS)return null;const d=[...l.querySelectorAll("col")].filter(p=>p.closest("table")===s||p.closest("table")===null).flatMap(p=>Array.from({length:Number(p.getAttribute("span"))||1},()=>Cs(p.getAttribute("width"))??Cs(qr(p.getAttribute("style")??"").get("width"))));return{rows:a.length,columns:c,cells:r.filter(p=>p.text!==""||p.fill||p.rows*p.columns>1),...d.length===c&&d.every(p=>p!==void 0)?{columnWidths:d}:{},...u.length===a.length&&u.every(p=>p!==void 0)?{rowHeights:u}:{}}}const Hf=.9,sS=288e3;function oS(e,t){const n=e.size.value,l=u=>u?.reduce((c,d)=>c+d,0),s=l(t.columnWidths)??n.width*.6,o=l(t.rowHeights)??t.rows*sS,a=Math.min(1,n.width*Hf/s,n.height*Hf/o),i=Math.round(s*a),r=Math.round(o*a);return{x:Math.round((n.width-i)/2),y:Math.round((n.height-r)/2),width:i,height:r}}function Qf(e,t,n){const{slide:l,shape:s,range:o}=t;if(!e.session.commands.pasteTableCells({slide:l,shape:s,row:o.row,column:o.column,table:n}))return!1;const a=Math.min(n.rows,t.info.rows-o.row),i=Math.min(n.columns,t.info.columns-o.column);return Tl(e).value={slide:l,shape:s,anchor:{row:o.row,column:o.column},head:{row:o.row+a-1,column:o.column+i-1}},!0}function aS(e,t,n,l){const s=l.defaultView,o=s?Gf(n,new s.DOMParser,l):null;return o!==null&&Qf(e,t,o)}function Xf(e,t,n){const l=n.defaultView,s=l?Gf(t,new l.DOMParser,n):null;if(!s)return!1;const o=yt(e);if(o?.picked)return Qf(e,o,s);const a=e.current.value?.part,i=a?e.slide(a):null;if(!a||!i)return!1;const r=Dn(i);if(!e.session.commands.addPastedTable({slide:a,table:s,...oS(e,s)}))return!1;const u=e.slide(a);return u&&e.session.document.select({slide:a,shapes:ot(u).map(Fe).filter(c=>c>r)}),!0}async function iS(){try{for(const e of await navigator.clipboard.read()){const t=e.types.includes("text/html")?await(await e.getType("text/html")).text():"",n=e.types.includes("text/plain")?await(await e.getType("text/plain")).text():"";if(t||n)return{html:t,text:n}}}catch{}return{html:"",text:await navigator.clipboard.readText().catch(()=>"")}}const Zf=typeof navigator<"u"&&/Mac|iPhone|iPad/u.test(navigator.platform);function qe(e,t){return Zf?`${e?"⇧":""}⌘${t}`:`Ctrl+${e?"Shift+":""}${t}`}const rS=Zf?"⌫":"Del",xt=typeof navigator<"u"&&/Mac|iPhone|iPad/u.test(navigator.platform)?"⌘":"Ctrl",uS=xt==="⌘"?"⌥":"Alt",ut=e=>({value:e,label:"",kind:"separator"});function wt(e){return[{value:"undo",label:"撤销",icon:"undo",shortcut:[xt,"Z"],disabled:!e.history.value.undo},{value:"redo",label:"重做",icon:"redo",shortcut:[xt,"Shift","Z"],disabled:!e.history.value.redo},ut("history")]}function cS(e){return{value:"object-align",kind:"menu",trigger:"disclosure",label:"对齐",icon:"alignStartVertical",disabled:e===0,disabledReason:"先选择幻灯片上的对象。",items:[...[["left","左对齐","alignStartVertical"],["center","水平居中","alignCenterVertical"],["right","右对齐","alignEndVertical"],["top","顶端对齐","alignStartHorizontal"],["middle","垂直居中","alignCenterHorizontal"],["bottom","底端对齐","alignEndHorizontal"]].map(([t,n,l])=>({value:`object-align:${t}`,label:n,icon:l})),{value:"object-align-separator",label:"",kind:"separator"},{value:"object-distribute:horizontal",label:"横向分布",disabled:e===2},{value:"object-distribute:vertical",label:"纵向分布",disabled:e===2}]}}function Yo(e){const t=e.boxes.value.filter(s=>e.selected.value.includes(s.id)),n=t.length>=2&&t.every(s=>s.placeholder===null&&s.parent===t[0].parent),l=t.every(s=>s.kind==="table"||s.kind==="chart");return{value:"arrange",kind:"menu",trigger:"disclosure",label:"排列",icon:"layers",disabled:t.length===0,disabledReason:"先选择幻灯片上的对象。",items:[{value:"arrange-front",label:"置于顶层",icon:"bringToFront"},{value:"arrange-forward",label:"上移一层",icon:"arrowUp"},{value:"arrange-backward",label:"下移一层",icon:"arrowDown"},{value:"arrange-back",label:"置于底层",icon:"sendToBack"},{value:"arrange-group-separator",label:"",kind:"separator"},{value:"group",label:"组合",icon:"group",shortcut:qe(!1,"G"),disabled:!n},{value:"ungroup",label:"取消组合",icon:"ungroup",shortcut:qe(!0,"G"),disabled:!t.some(s=>s.kind==="group")},{value:"arrange-turn-separator",label:"",kind:"separator"},{value:"rotate-right",label:"向右旋转 90°",icon:"rotateCw",disabled:l},{value:"rotate-left",label:"向左旋转 90°",icon:"rotateCcw",disabled:l},{value:"flip-vertical",label:"垂直翻转",icon:"flipVertical",disabled:l},{value:"flip-horizontal",label:"水平翻转",icon:"flipHorizontal",disabled:l},{value:"arrange-delete-separator",label:"",kind:"separator"},{value:"delete-shapes",label:"删除对象",icon:"trash"}]}}function Yf(e,t,n){const l=n.x-t.x,s=n.y-t.y,o=l*l+s*s,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*l+(e.y-t.y)*s)/o));return Math.hypot(e.x-(t.x+a*l),e.y-(t.y+a*s))}function dS(e,t,n){const l=n&&e.length>3&&Yf(e.at(-1),e[0],e[0])<=t*4?e.slice(0,-1):[...e];if(l.length<=2)return l;const s=new Array(l.length).fill(!1);s[0]=!0,s[l.length-1]=!0;const o=[[0,l.length-1]];for(;o.length>0;){const[a,i]=o.pop();let r=-1,u=t;for(let c=a+1;c<i;c+=1){const d=Yf(l[c],l[a],l[i]);d>u&&(u=d,r=c)}r>=0&&(s[r]=!0,o.push([a,r],[r,i]))}return l.filter((a,i)=>s[i])}const El=new Set(["freeform","scribble"]),Jf=8;function pS(e,t){const n=Q([]),l=Q();let s,o=1;function a(r,u){const c=e.current.value?.part,d=dS(n.value,1.5/o,r);if(n.value=[],l.value=void 0,s=void 0,e.armedShape.value=void 0,!(!c||d.length<2)&&e.session.commands.addFreeform({slide:c,points:d,closed:r&&d.length>=3,smooth:u})){const p=e.slide(c);p&&t([Dn(p)])}}const i=(r,u)=>Math.hypot(r.x-u.x,r.y-u.y)*o;return{points:n,cursor:l,armed:()=>El.has(e.armedShape.value??""),press(r,u,c){o=c,s=r.pointerId,r.currentTarget.setPointerCapture(r.pointerId),r.preventDefault();const d=n.value[0];if(e.armedShape.value==="freeform"&&d&&n.value.length>=3&&i(d,u)<=Jf){a(!0,!1);return}n.value=e.armedShape.value==="scribble"?[u]:[...n.value,u]},move(r,u,c){return!El.has(e.armedShape.value??"")||n.value.length===0?!1:(o=c,l.value=u,s===r.pointerId&&i(n.value.at(-1),u)>=3&&(n.value=[...n.value,u]),!0)},release(r,u){if(s!==r.pointerId)return!1;if(o=u,s=void 0,e.armedShape.value==="scribble"){const c=n.value[0],d=n.value.at(-1);a(c!==void 0&&d!==void 0&&n.value.length>3&&i(c,d)<=Jf,!0)}return!0},finishOpen(){e.armedShape.value==="freeform"&&(n.value=n.value.filter((r,u,c)=>u===0||i(r,c[u-1])>2),a(!1,!1))},key(r){if(!El.has(e.armedShape.value??"")||n.value.length===0)return!1;if(r.key==="Enter"||r.key==="Escape")a(!1,!1);else if(r.key==="Backspace"||r.key==="Delete")n.value=n.value.slice(0,-1);else return!1;return r.preventDefault(),!0}}}const em=new WeakMap;function Ms(e){let t=em.get(e);return t||(t=Q(),em.set(e,t)),t}function fS(e,t){const n=e.current.value?.part,l=e.session.document.presentation(),s=n?le(l,n,t):null;return s?(Ms(e).value=Jw(l,s),!0):!1}function tm(e,t){const n=Ms(e).value;return n?e.session.chain().addShape(t).applyShapeLook({slide:t.slide,newest:!0,look:n}).run():e.session.commands.addShape(t)}const Fl=new Map([["textbox",!1],["textbox:vertical",!0]]),Jo={long:216e4,short:36e4},nm=36e4,ea=914400;function mS(e,t,n){let l=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return n&&(l=s=Math.max(l,s)),{x:t.x<e.x?e.x-l:e.x,y:t.y<e.y?e.y-s:e.y,width:l,height:s}}function hS(e,t){const n=ql(t);return n.x>=e.x&&n.y>=e.y&&n.x+n.width<=e.x+e.width&&n.y+n.height<=e.y+e.height}function vS(e,t,n){const l=Q();let s=null;return{rect:l,begin(o,a,i){s={pointer:o,origin:{x:a.x,y:a.y},preset:e.armedShape.value,additive:i,moved:!1},l.value=void 0},move(o,a,i,r){if(!s||s.pointer!==o)return!1;const u=mS(s.origin,a,i&&s.preset!==void 0);return!s.moved&&Math.max(u.width,u.height)*r<3||(s.moved=!0,l.value=u),!0},end(o){const a=s;if(!a||a.pointer!==o)return!1;s=null;const i=l.value;l.value=void 0;const r=e.current.value?.part;if(!r)return!0;const u=a.preset===void 0?void 0:Fl.get(a.preset);if(u!==void 0){e.armedShape.value=void 0;const p=gS(a.origin,a.moved?i:void 0,u),f=e.session.commands.addTextBox({slide:r,text:"",vertical:u,...p}),h=e.slide(r);return f&&h&&n(Dn(h)),!0}if(a.preset!==void 0){e.armedShape.value=void 0;const p=a.moved&&i?i:{x:a.origin.x-ea/2,y:a.origin.y-ea/2,width:ea,height:ea},f=tm(e,{slide:r,preset:a.preset,...lm(p)}),h=e.slide(r);return f&&h&&t([Dn(h)]),!0}const c=a.additive?e.selected.value:[],d=a.moved&&i?e.boxes.value.filter(p=>p.parent===null&&hS(i,p)).map(p=>p.id):[];return t([...new Set([...c,...d])]),!0}}}function gS(e,t,n){if(!t){const s=n?Jo.short:Jo.long,o=n?Jo.long:Jo.short;return{x:Math.round(e.x),y:Math.round(e.y),width:s,height:o}}const l=lm(t);return n?{...l,width:Math.max(nm,l.width)}:{...l,height:Math.max(nm,l.height)}}function lm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.max(36e3,Math.round(e.width)),height:Math.max(36e3,Math.round(e.height))}}const sm=new WeakMap;function Sn(e){let t=sm.get(e);return t||(t={headerFooterOpen:Q(!1),actionOpen:Q(!1),actionPreset:Q(),textLinkOpen:Q(!1),barcodeOpen:Q(!1),recording:Q(!1)},sm.set(e,t)),t}var om=class extends Error{constructor(e){super("The browser does not let a slide drawn with HTML text be read back from a canvas.",{cause:e}),this.name="PptxTaintedCanvasError"}};async function ta(e,t,n,l,s=.92){const o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement,a=(o.getAttribute("viewBox")??"").split(/[\s,]+/u).map(Number),i=a.length===4&&a[2]>0&&a[3]>0?a[3]/a[2]:9/16,r=Math.round(n),u=Math.round(n*i);o.setAttribute("width",String(r)),o.setAttribute("height",String(u));const c=new Image;c.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(o))}`,await c.decode();const d=e.createElement("canvas");d.width=r,d.height=u;const p=d.getContext("2d");if(!p)throw new Error("Canvas 2D is unavailable.");p.fillStyle="#fff",p.fillRect(0,0,r,u),p.drawImage(c,0,0,r,u);let f;try{f=await new Promise((h,v)=>{try{d.toBlob(h,l,s)}catch(g){v(g)}})}catch(h){throw new om(h)}if(!f)throw new Error("The slide picture could not be encoded.");return{bytes:new Uint8Array(await f.arrayBuffer()),width:r,height:u}}function am(e){const t=e.createElement("canvas").getContext("2d");return(n,l)=>{if(!t)return{widthPx:n.length*l.sizePx*.6,approximate:!0};t.font=`${l.italic?"italic ":""}${l.bold?"bold ":""}${l.sizePx}px "${l.family}", ${lb}`;const s=t.measureText(n);return{widthPx:s.width+l.letterSpacingPx*n.length,ascentPx:s.fontBoundingBoxAscent,descentPx:s.fontBoundingBoxDescent}}}function Le(e,t){const n=e.slide(t);n&&e.session.document.select({slide:t,shapes:[Dn(n)]})}function Ie(e,t,n){const l=Rt(e.session.document.presentation()),s=be(t),o=be(n);return{x:Math.round(((l?.width??12192e3)-s)/2),y:Math.round(((l?.height??6858e3)-o)/2),width:s,height:o}}const na=8;async function bS(e,t,n){const l=e.current.value?.part;if(!l)return;let s;try{s=(await ta(t,e.render(n),960,"image/png")).bytes}catch{e.toaster.create({type:"error",title:"无法插入幻灯片缩放",description:"浏览器无法绘制这张幻灯片的缩略图。"});return}const{width:o,height:a}=e.size.value;e.session.commands.addSlideZoom({slide:l,target:n,picture:s,...Ie(e,na,na*a/o)})&&Le(e,l)}const im=new WeakMap;function Gr(e){const{document:t}=e.session,n=t.presentation(),l=t.version(),s=im.get(e);if(s?.presentation===n&&s.version===l)return s.sections;const o=it(n);return im.set(e,{presentation:n,version:l,sections:o}),o}async function rm(e,t,n){const l=n.count>0?e.slides.value[n.start]?.part:void 0;if(!l)return null;try{return(await ta(t,e.render(l),960,"image/png")).bytes}catch{return null}}async function yS(e,t,n){const l=e.current.value?.part,s=Gr(e)[n];if(!l||!s)return;const o=await rm(e,t,s);if(!o){e.toaster.create({type:"error",title:"无法插入节缩放",description:"这一节没有幻灯片,或浏览器无法绘制它的首张幻灯片。"});return}const{width:a,height:i}=e.size.value;e.session.commands.addSectionZoom({slide:l,section:n,picture:o,...Ie(e,na,na*i/a)})&&Le(e,l)}async function xS(e,t){const n=Gr(e).map((a,i)=>({section:a,index:i})).filter(a=>a.section.count>0),l=await Promise.all(n.map(a=>rm(e,t,a.section)));if(n.length===0||l.some(a=>a===null)){e.toaster.create({type:"error",title:"无法插入摘要缩放",description:n.length===0?"先在幻灯片列表中添加节。":"浏览器无法绘制某一节的首张幻灯片。"});return}const s=n[0].section.start;if(!e.session.commands.addSummaryZoom({sections:n.map(a=>a.index),pictures:l}))return;const o=e.slides.value[s]?.part;o&&e.session.document.select({slide:o,shapes:[]})}function wS(e,t){return[{value:"draw:freeform",label:"任意多边形",tooltip:"任意多边形:单击放置顶点,按住拖动画手绘段,单击起点闭合,双击或回车结束",icon:"waypoints",kind:"toggle",pressed:e.armedShape.value==="freeform",disabled:t},{value:"draw:scribble",label:"自由曲线",tooltip:"自由曲线:按住拖动绘制,回到起点即闭合",icon:"freehand",kind:"toggle",pressed:e.armedShape.value==="scribble",disabled:t}]}function um(e,t){return{value:"insert-text-box",kind:"split",label:"横向文本框",icon:"textBox",disclosureLabel:"选择文本框方向",disabled:t,tooltip:"横向文本框:在幻灯片上拖动绘制,单击放置后直接输入",pressed:Fl.has(e.armedShape.value??""),items:[{value:"insert-text-box",label:"横向文本框",icon:"textBox"},{value:"insert-text-box:vertical",label:"竖向文本框",icon:"textBoxVertical"}]}}function cm(e,t){const n=e.armedShape.value;return{value:"shape",label:"插入形状",icon:"shapes",kind:"disclosure",indicator:!0,contentRenderer:"shapeGallery",pressed:n!==void 0&&!El.has(n)&&!Fl.has(n),disabled:t,overlayProps:{width:"auto"}}}function kS(e){const t=e.current.value===void 0,n=t||e.selected.value.length===0,l=Gr(e),s=Sn(e).recording.value;return[...wt(e),{value:"design:new-slide",kind:"split",label:"新建幻灯片",icon:"rectangleHorizontal",disclosureLabel:"选择版式新建",contentRenderer:"layoutGallery",overlayProps:{width:"auto"}},ut("text"),um(e,t),{value:"insert-wordart",label:"艺术字",icon:"fontScript",kind:"disclosure",indicator:!0,contentRenderer:"wordArtGallery",disabled:t,overlayProps:{width:"auto"}},cm(e,t),...wS(e,t),{value:"insert-icon",label:"图标",icon:"smile",kind:"disclosure",indicator:!0,contentRenderer:"iconGallery",disabled:t,overlayProps:{width:"auto"}},{value:"insert-diagram",kind:"menu",trigger:"disclosure",label:"智能图形",icon:"network",disabled:t,items:Fr.map(([o,a])=>({value:`insert-diagram-kind:${o}`,label:a,kind:"submenu",children:Pl.filter(i=>i.kind===o).map(i=>({value:`insert-diagram:${i.id}`,label:i.label}))}))},{value:"insert-picture",label:"图片",icon:"image",disabled:t},{value:"insert-screenshot",kind:"split",label:"截屏",tooltip:"截屏:选择要共享的屏幕、窗口或标签页,截取一帧插入",icon:"appWindow",disclosureLabel:"截屏与录制",disabled:t&&!s,pressed:s,items:[{value:"insert-screenshot",label:"截屏",disabled:t},{value:"insert-screen-recording",label:s?"停止屏幕录制":"屏幕录制",disabled:t&&!s}]},{value:"insert-table",label:"表格",icon:"table",kind:"disclosure",indicator:!0,contentRenderer:"tablePicker",disabled:t,overlayProps:{width:"auto"}},{value:"insert-chart",kind:"menu",trigger:"disclosure",label:"图表",icon:"chartColumn",disabled:t,items:[...dm.map(([o,a,i])=>({value:`insert-chart:${o}`,label:a,icon:i})),{value:"insert-chart-separator",label:"",kind:"separator"},{value:"chart:insert-dialog",label:"更多图表…"}]},ut("media"),{value:"insert-audio",label:"音频",icon:"volume2",disabled:t},{value:"insert-video",label:"视频",icon:"video",disabled:t},ut("marks"),{value:"insert-link",label:"链接",icon:"link",kind:"disclosure",indicator:!0,contentRenderer:"linkForm",disabled:n,...n&&!t?{disabledReason:"先选中要添加链接的对象"}:{},overlayProps:{width:"auto"}},{value:"action-settings",kind:"split",label:"动作",tooltip:"动作设置:放映时单击对象跳转或打开网址",icon:"mousePointer2",disclosureLabel:"动作与缩放定位",disabled:t,items:[{value:"action-settings",label:"动作设置…",disabled:n},{value:"insert-zoom",label:"幻灯片缩放",kind:"submenu",disabled:t||e.slides.value.length<2,children:e.slides.value.filter(o=>o.part!==e.current.value?.part).map(o=>({value:`insert-zoom:${o.part}`,label:`${o.index+1} ${o.title||"无标题"}`}))},{value:"insert-section-zoom",label:"节缩放",kind:"submenu",disabled:t||!l.some(o=>o.count>0),children:l.map((o,a)=>({value:`insert-section-zoom:${a}`,label:o.name||"无标题节",disabled:o.count===0}))},{value:"insert-summary-zoom",label:"摘要缩放",disabled:t||!l.some(o=>o.count>0)}]},{value:"comment:new",label:"批注",icon:"messageSquare",disabled:t},{value:"insert-symbol",label:"符号",icon:"omega",kind:"disclosure",indicator:!0,contentRenderer:"symbolGrid",disabled:t,overlayProps:{width:"auto"}},{value:"header-footer",kind:"split",label:"页眉和页脚",icon:"panelBottom",disclosureLabel:"页眉页脚选项",disabled:t,items:[{value:"header-footer",label:"页眉和页脚"},{value:"insert-slide-number",label:"幻灯片编号"},{value:"insert-date",label:"日期和时间"}]},ut("drawings"),{value:"insert-object:flowchart",label:"流程图",icon:"workflow",disabled:t},{value:"insert-object:mind-map",label:"思维导图",icon:"mindMap",disabled:t},{value:"insert-object:whiteboard",label:"白板",icon:"whiteboard",disabled:t},{value:"insert-object:text-diagram",label:"文本绘图",icon:"textDiagram",disabled:t},ut("science"),{value:"insert-equation",label:"公式",icon:"sigma",disabled:t},{value:"insert-qr",kind:"split",label:"二维码",icon:"qrCode",disclosureLabel:"更多编码",disabled:t,items:[{value:"insert-qr",label:"二维码"},{value:"insert-barcode",label:"条形码"}]}]}const dm=[["column","柱形图","chartColumn"],["bar","条形图","chartBar"],["line","折线图","chartLine"],["pie","饼图","chartPie"],["doughnut","环形图","chartDoughnut"],["area","面积图","chartArea"],["scatter","散点图","chartScatter"],["radar","雷达图","chartRadar"]],$S=[[-3,"很紧"],[-1.5,"紧密"],[0,"常规"],[3,"稀疏"],[6,"很松"]];function SS(e){const t=e.current.value?.part,[n]=e.textSelection.value,l=e.session.document.presentation(),s=t&&n!==void 0?le(l,t,n):null;let o;try{o=s?xr(l,s).spacing:void 0}catch{o=void 0}return{value:"character-spacing",kind:"menu",trigger:"disclosure",label:"字符间距",icon:"characterSpacing",disabled:s===null,items:$S.map(([a,i])=>({value:`text-tools:spacing:${a}`,label:a===0?i:`${i}(${a>0?"+":""}${a} 磅)`,...o!==void 0&&Math.abs(a-o)<.01?{icon:"check"}:{}}))}}function CS(e){const t=e.current.value?.part,[n]=e.textSelection.value,l=e.session.document.presentation(),s=t&&n!==void 0?le(l,t,n):null;let o=0;try{o=s?xs(l,s).columns:0}catch{o=0}return{value:"text-columns",kind:"menu",trigger:"disclosure",label:"分栏",icon:"columns",disabled:s===null,items:[[1,"一栏"],[2,"两栏"],[3,"三栏"]].map(([a,i])=>({value:`text-columns:${a}`,label:i,...a===o?{icon:"check"}:{}}))}}function MS(e){return{value:"convert-diagram",kind:"menu",trigger:"disclosure",label:"转换为智能图形",tooltip:"转换为智能图形:每个段落成为一项",icon:"network",disabled:e,items:Fr.map(([t,n])=>({value:`convert-diagram-kind:${t}`,label:n,kind:"submenu",children:Pl.filter(l=>l.kind===t).map(l=>({value:`convert-diagram:${l.id}`,label:l.label}))}))}}function pm(e){const t=e.current.value?.part,[n]=e.textSelection.value,l=e.session.document.presentation(),s=t&&n!==void 0?le(l,t,n):null;try{return s?xr(l,s).effects.includes("shadow"):!1}catch{return!1}}function PS(e,t){return{value:"home-text-effects",kind:"menu",trigger:"disclosure",label:"文本效果",icon:"textEffects",disabled:t,items:[{value:"text-shadow",label:"文字阴影",...pm(e)?{icon:"check"}:{}}]}}const fm=[["•","圆点"],["◆","菱形"],["■","方块"],["✓","对勾"],["➢","箭头"],["○","空心圆"]],mm=[["arabicPeriod","1. 2. 3."],["arabicParenR","1) 2) 3)"],["arabicParenBoth","(1) (2) (3)"],["romanUcPeriod","I. II. III."],["romanLcPeriod","i. ii. iii."],["alphaUcPeriod","A. B. C."],["alphaLcPeriod","a. b. c."],["alphaLcParenR","a) b) c)"]],TS=[["horz","横排"],["eaVert","竖排"],["vert","所有文字旋转 90°"],["vert270","所有文字旋转 270°"],["wordArtVert","堆积"]];function AS(e){const t=e.textEditor.value===void 0&&e.selected.value.length===0;return[{value:"clipboard:paste",kind:"split",label:"粘贴",icon:"clipboardPaste",disclosureLabel:"粘贴选项",shortcut:[xt,"V"],disabled:e.current.value===void 0,items:[{value:"clipboard:paste",label:"粘贴"},{value:"clipboard:paste-source",label:"保留源格式"},{value:"clipboard:paste-text",label:"只粘贴文本"},{value:"paste-special",label:"选择性粘贴…",shortcut:[xt,uS,"V"]}]},{value:"clipboard:cut",label:"剪切",icon:"scissors",shortcut:[xt,"X"],disabled:t},{value:"clipboard:copy",label:"复制",icon:"clipboardCopy",shortcut:[xt,"C"],disabled:t}]}function ES(e){e.tick.value;const t=e.current.value===void 0,n=e.textSelection.value.length===0,l=e.selected.value.length===0,s=e.format.value;return[...wt(e),...AS(e),{value:"format-painter",label:"格式刷",icon:"formatPainter",kind:"toggle",pressed:e.painter.value!==void 0,tooltip:"复制格式,再点选目标;连按两下可连续使用,Esc 结束",disabled:l&&e.textEditor.value===void 0&&e.painter.value===void 0},ut("slides"),{value:"present-current",label:"当页开始",tooltip:"当页开始:从当前幻灯片开始放映",icon:"monitor",disabled:t},{value:"design:new-slide",kind:"split",label:"新建幻灯片",icon:"rectangleHorizontal",disclosureLabel:"选择版式新建",contentRenderer:"layoutGallery",overlayProps:{width:"auto"}},{value:"design:apply-layout",label:"版式",icon:"layoutDashboard",kind:"disclosure",indicator:!0,contentRenderer:"layoutGallery",disabled:t,overlayProps:{width:"auto"}},{value:"reset-slide",label:"重置幻灯片",tooltip:"重置幻灯片:占位符恢复版式中的位置和格式",icon:"refreshCcw",disabled:t},FS(e),ut("font"),{value:"font-family",label:"字体",kind:"custom",renderer:"fontFamily",disabled:n},{value:"font-size",label:"字号",kind:"custom",renderer:"fontSize",disabled:n},{value:"size-increase",label:"增大字号",icon:"fontSizeIncrease",disabled:n},{value:"size-decrease",label:"减小字号",icon:"fontSizeDecrease",disabled:n},SS(e),{value:"change-case",kind:"menu",trigger:"disclosure",label:"更改大小写",icon:"caseSensitive",disabled:n,items:[["sentence","句首字母大写"],["lower","全部小写"],["upper","全部大写"],["title","每个单词首字母大写"],["toggle","切换大小写"]].map(([o,a])=>({value:`case:${o}`,label:a}))},{value:"clear-format",label:"清除格式",icon:"clearFormatting",disabled:n},{value:"enclose-characters",label:"带圈字符",tooltip:"带圈字符:给选中的数字、字母或部分汉字加圈,再次使用取消",icon:"circle",disabled:e.textEditor.value===void 0},{value:"bold",label:"加粗",icon:"bold",kind:"toggle",pressed:s?.bold===!0,shortcut:[xt,"B"],disabled:n},{value:"italic",label:"斜体",icon:"italic",kind:"toggle",pressed:s?.italic===!0,shortcut:[xt,"I"],disabled:n},{value:"underline",label:"下划线",icon:"underline",kind:"toggle",pressed:s?.underline===!0,shortcut:[xt,"U"],disabled:n},{value:"strike",label:"删除线",icon:"strike",kind:"toggle",pressed:s?.strike===!0,shortcut:[xt,"Shift","X"],disabled:n},{value:"superscript",label:"上标",icon:"superscript",kind:"toggle",pressed:(s?.baseline??0)>0,disabled:n},{value:"subscript",label:"下标",icon:"subscript",kind:"toggle",pressed:(s?.baseline??0)<0,disabled:n},{value:"text-color",label:"字体颜色",icon:"textColor",kind:"custom",renderer:"color",disabled:n},{value:"highlight",label:"突出显示",icon:"textHighlight",kind:"custom",renderer:"color",disabled:n},PS(e,n),ut("paragraph"),...["left","center","right","justify"].map(o=>({value:`align-${o}`,kind:"toggle",pressed:s?.align===o,disabled:n,label:{left:"左对齐",center:"居中",right:"右对齐",justify:"两端对齐"}[o],icon:{left:"alignStart",center:"alignCenter",right:"alignEnd",justify:"alignJustify"}[o]})),{value:"paragraph:distribute",label:"分散对齐",icon:"alignDistribute",disabled:n},{value:"anchor",kind:"menu",trigger:"disclosure",label:"垂直对齐",disabled:n,icon:{top:"alignStartHorizontal",center:"alignCenterHorizontal",bottom:"alignEndHorizontal"}[s?.anchor??"top"],items:[["top","靠上对齐","alignStartHorizontal"],["center","垂直居中","alignCenterHorizontal"],["bottom","靠下对齐","alignEndHorizontal"]].map(([o,a,i])=>({value:`anchor-${o}`,label:a,icon:i}))},{value:"text-direction",kind:"menu",trigger:"disclosure",label:"文字方向",icon:"textDirectionVertical",disabled:n,items:TS.map(([o,a])=>({value:`direction-${o}`,label:a,...o===(s?.direction??"horz")?{icon:"check"}:{}}))},CS(e),MS(e.textEditor.value!==void 0||e.textSelection.value.length!==1),ut("lists"),{value:"list-toggle-bullet",kind:"split",label:"项目符号",icon:"listBullet",disclosureLabel:"选择项目符号",disabled:n,pressed:s?.list==="bullet",items:[...fm.map(([o,a])=>({value:`list-bullet:${o}`,label:`${o} ${a}`})),{value:"list-separator-bullet",label:"",kind:"separator"},{value:"list-none",label:"无",icon:"minus"}]},{value:"list-toggle-number",kind:"split",label:"编号",icon:"listNumbered",disclosureLabel:"选择编号格式",disabled:n,pressed:s?.list==="number",items:[...mm.map(([o,a])=>({value:`list-number:${o}`,label:a})),{value:"list-separator-number",label:"",kind:"separator"},{value:"list-none",label:"无",icon:"minus"}]},{value:"indent-decrease",label:"减少缩进",icon:"indentDecrease",disabled:n},{value:"indent-increase",label:"增加缩进",icon:"indentIncrease",disabled:n},{value:"line-spacing",kind:"menu",trigger:"disclosure",label:"行距",icon:"lineSpacing",disabled:n,items:["1.0","1.15","1.5","2.0","2.5","3.0"].map(o=>({value:`spacing-${o}`,label:o}))},{value:"paragraph:dialog",label:"段落设置",icon:"paragraphSettings",disabled:n&&e.textEditor.value===void 0},ut("arrange"),um(e,t),cm(e,t),cS(e.selected.value.length),Yo(e),ut("edit"),{value:"find-replace",kind:"split",label:"查找和替换",icon:"textSearch",shortcut:[xt,"F"],disclosureLabel:"替换选项",disabled:t,items:[{value:"find-replace",label:"查找和替换"},{value:"replace-font",label:"替换字体"}]},{value:"panel:selection",kind:"split",label:"选择窗格",icon:"listTree",disclosureLabel:"选择",items:[{value:"objects:select-all",label:"全选对象",disabled:t},{value:"panel:selection",label:"选择窗格"}]}]}function FS(e){const t=it(e.session.document.presentation()),n=e.current.value?.index??-1,l=t.map(o=>o.start<=n).lastIndexOf(!0),s=l<0;return{value:"section",kind:"menu",trigger:"disclosure",label:"节",icon:"sectionBreak",disabled:e.current.value===void 0,items:[{value:"section:add",label:"新增节"},{value:`section:rename:${l}`,label:"重命名节",disabled:s},{value:`section:remove:${l}`,label:"删除节",disabled:s},{value:"section:remove-all",label:"删除所有节",disabled:s},{value:"section-separator",label:"",kind:"separator"},{value:"section:collapse-all",label:"全部折叠",disabled:s},{value:"section:expand-all",label:"全部展开",disabled:s}]}}const hm=new WeakMap;function Yt(e){let t=hm.get(e);return t||(t={show:Q(null),tick:Q(0),pending:Q(null),settingsOpen:Q(!1),customOpen:Q(!1),presenterInline:Q(!1),presenter:Q(!1)},hm.set(e,t)),t}function zS(e,t){const n=`${e} 副本`;if(!t.includes(n))return n;for(let l=2;;l+=1)if(!t.includes(`${n} ${l}`))return`${n} ${l}`}function vm(e,t){const n=e.trim();return n===""?"请输入放映名称。":t.includes(n)?"已有同名的自定义放映。":""}function Hr(e,t,n){const l=[...e];if(t<0||t>=l.length||n<0||n>=l.length||t===n)return l;const[s]=l.splice(t,1);return l.splice(n,0,s),l}function DS(e,t){const n=new Map(t.map((l,s)=>[l,s]));return[...e].sort((l,s)=>(n.get(l)??1/0)-(n.get(s)??1/0))}const LS={class:"pptx-custom-editor-lists"},VS={class:"pptx-custom-editor-column","aria-label":"演示文稿中的幻灯片"},IS={class:"pptx-custom-editor-heading"},BS={class:"pptx-custom-editor-box"},OS={class:"pptx-custom-editor-column","aria-label":"自定义放映中的幻灯片"},US={class:"pptx-custom-editor-heading"},NS={class:"pptx-custom-editor-count text-qk-text-tertiary"},RS={class:"pptx-custom-editor-box pptx-custom-editor-order"},jS=["onDragstart","onDragover"],KS={class:"pptx-custom-editor-label"},WS={class:"pptx-custom-editor-footer"},qS=O({__name:"custom-show-editor",props:{state:{},show:{},taken:{}},emits:["save","cancel"],setup(e,{emit:t}){const n=e,l=t,s=F(()=>n.state.slides.value),o=V(n.show?.name??p()),a=V([...n.show?.slides??[]]),i=V(new Set),r=F(()=>o.value.trim()),u=F(()=>vm(o.value,n.taken)),c=F(()=>s.value.length>0&&i.value.size===s.value.length),d=V();function p(){for(let S=1;;S+=1)if(!n.taken.includes(`自定义放映 ${S}`))return`自定义放映 ${S}`}function f(S){const C=s.value.find(E=>E.part===S);return C?`${C.index+1}. ${C.title||"无标题"}`:S}function h(){a.value.push(...s.value.filter(S=>i.value.has(S.part)).map(S=>S.part)),i.value=new Set}function v(S,C){a.value=Hr(a.value,S,S+C)}function g(S){a.value.push(S)}function $(){i.value=c.value?new Set:new Set(s.value.map(S=>S.part))}function b(){const S=d.value;d.value=void 0,S&&(a.value=Hr(a.value,S.from,S.to))}function w(S,C){const E=new Set(i.value);C?E.add(S):E.delete(S),i.value=E}return(S,C)=>(x(),M("form",{class:"pptx-custom-editor",onSubmit:C[4]||(C[4]=J(E=>!u.value&&l("save",{id:e.show?.id,name:r.value,slides:a.value}),["prevent"]))},[y(m(re),ie({label:"放映名称"},u.value?{errorText:u.value}:{},{invalid:!!u.value}),{default:A(({controlProps:E})=>[y(m(Oe),ie(E,{modelValue:o.value,"onUpdate:modelValue":C[0]||(C[0]=T=>o.value=T),maxlength:80}),null,16,["modelValue"])]),_:1},16,["invalid"]),k("div",LS,[k("section",VS,[k("div",IS,[C[5]||(C[5]=k("h3",null,"演示文稿中的幻灯片",-1)),y(m(q),{type:"button",variant:"ghost",size:"sm",disabled:s.value.length===0,onClick:$},{default:A(()=>[R(N(c.value?"全不选":"全选"),1)]),_:1},8,["disabled"])]),k("div",BS,[(x(!0),M(U,null,H(s.value,E=>(x(),B(m(Ce),{key:E.part,checked:i.value.has(E.part),label:f(E.part),size:"sm",title:"双击直接添加","onUpdate:checked":T=>w(E.part,T===!0),onDblclick:T=>g(E.part)},null,8,["checked","label","onUpdate:checked","onDblclick"]))),128))])]),y(m(q),{type:"button",class:"pptx-custom-editor-add",disabled:i.value.size===0,onClick:h},{default:A(()=>[...C[6]||(C[6]=[R("添加",-1)])]),_:1},8,["disabled"]),k("section",OS,[k("div",US,[k("h3",null,[C[7]||(C[7]=R("放映中的幻灯片",-1)),k("span",NS,N(a.value.length)+" 页",1)]),y(m(q),{type:"button",variant:"ghost",size:"sm",disabled:a.value.length<2,onClick:C[1]||(C[1]=E=>a.value=m(DS)(a.value,s.value.map(T=>T.part)))},{default:A(()=>[...C[8]||(C[8]=[R("按原顺序排列",-1)])]),_:1},8,["disabled"])]),k("ol",RS,[(x(!0),M(U,null,H(a.value,(E,T)=>(x(),M("li",{key:`${T}-${E}`,class:Ne(["pptx-custom-editor-row",{"drop-target":d.value&&d.value.to===T&&d.value.from!==T}]),draggable:"true",onDragstart:z=>d.value={from:T,to:T},onDragover:J(z=>d.value&&(d.value={...d.value,to:T}),["prevent"]),onDrop:J(b,["prevent"]),onDragend:C[2]||(C[2]=z=>d.value=void 0)},[k("span",KS,N(f(E)),1),y(m(ye),{label:"上移",variant:"ghost",size:"sm",disabled:T===0,onClick:z=>v(T,-1)},{default:A(()=>[y(m(me),{name:"arrowUp"})]),_:1},8,["disabled","onClick"]),y(m(ye),{label:"下移",variant:"ghost",size:"sm",disabled:T===a.value.length-1,onClick:z=>v(T,1)},{default:A(()=>[y(m(me),{name:"arrowDown"})]),_:1},8,["disabled","onClick"]),y(m(ye),{label:"移除",variant:"ghost",size:"sm",onClick:z=>a.value.splice(T,1)},{default:A(()=>[y(m(me),{name:"close"})]),_:1},8,["onClick"])],42,jS))),128))])])]),k("div",WS,[y(m(q),{type:"button",onClick:C[3]||(C[3]=E=>l("cancel"))},{default:A(()=>[...C[9]||(C[9]=[R("取消",-1)])]),_:1}),y(m(q),{type:"submit",color:"primary",variant:"solid",disabled:!!u.value||a.value.length===0},{default:A(()=>[...C[10]||(C[10]=[R("确定",-1)])]),_:1},8,["disabled"])])],32))}}),_S={key:1,class:"pptx-custom-shows"},GS={key:0,class:"pptx-custom-shows-list",role:"listbox","aria-label":"自定义放映"},HS=["aria-selected","onClick","onDblclick","onKeydown"],QS={key:1},XS={class:"text-qk-text-tertiary"},ZS={class:"pptx-custom-shows-actions"},YS=O({__name:"custom-shows-dialog",props:{state:{},host:{}},setup(e){const t=e,n=Yt(t.state).customOpen,l=F(()=>(t.state.tick.value,$f(t.state.session.document.presentation()))),s=V(),o=Q(void 0),a=V();X(n,g=>{o.value=void 0,a.value=void 0,g&&(s.value=l.value[0]?.id)});const i=F(()=>l.value.find(g=>g.id===s.value));function r(g){t.state.session.commands.setCustomShows({shows:g})}function u(g){r(g.id===void 0?[...l.value,g]:l.value.map($=>$.id===g.id?g:$)),s.value=g.id??l.value.at(-1)?.id,o.value=void 0}function c(){if(!i.value)return;const g=l.value.indexOf(i.value);r(l.value.filter($=>$!==i.value)),s.value=(l.value[g]??l.value[g-1])?.id}function d(){if(!i.value)return;const g=l.value.indexOf(i.value),$={name:zS(i.value.name,l.value.map(b=>b.name)),slides:i.value.slides};r([...l.value.slice(0,g+1),$,...l.value.slice(g+1)]),s.value=l.value[g+1]?.id}function p(){i.value&&(a.value={id:i.value.id,name:i.value.name})}function f(){const g=a.value;a.value=void 0;const $=l.value.find(w=>w.id===g?.id);if(!g||!$||g.name.trim()===$.name)return;const b=vm(g.name,l.value.filter(w=>w!==$).map(w=>w.name));if(b){t.state.toaster.create({type:"error",title:"无法重命名",description:b});return}r(l.value.map(w=>w===$?{...w,name:g.name.trim()}:w))}function h(g){if(!i.value)return;const $=l.value.indexOf(i.value);r(Hr(l.value,$,$+g))}function v(){i.value&&(n.value=!1,t.host.intent("show:custom-start",i.value.id))}return(g,$)=>(x(),B(m(Ae),{open:m(n),"onUpdate:open":$[10]||($[10]=b=>n.value=b)},{default:A(()=>[y(m(Te),{title:o.value===void 0?"自定义放映":"定义自定义放映",size:"medium","show-close":!1},Fb({default:A(()=>[o.value!==void 0?(x(),B(qS,{key:0,state:e.state,show:o.value,taken:l.value.filter(b=>b.id!==o.value?.id).map(b=>b.name),onSave:u,onCancel:$[0]||($[0]=b=>o.value=void 0)},null,8,["state","show","taken"])):(x(),M("div",_S,[l.value.length>0?(x(),M("ul",GS,[(x(!0),M(U,null,H(l.value,b=>(x(),M("li",{key:b.id,role:"option","aria-selected":b.id===s.value,tabindex:"0",class:"pptx-custom-shows-item",onClick:w=>s.value=b.id,onDblclick:w=>o.value=b,onKeydown:ue(w=>o.value=b,["enter"])},[a.value&&a.value.id===b.id?(x(),B(m(Oe),{key:0,modelValue:a.value.name,"onUpdate:modelValue":$[1]||($[1]=w=>a.value.name=w),class:"pptx-custom-shows-rename","aria-label":"放映名称",maxlength:80,autofocus:"",onKeydown:[ue(J(f,["stop","prevent"]),["enter"]),$[2]||($[2]=ue(J(w=>a.value=void 0,["stop","prevent"]),["esc"]))],onBlur:f,onClick:$[3]||($[3]=J(()=>{},["stop"])),onDblclick:$[4]||($[4]=J(()=>{},["stop"]))},null,8,["modelValue","onKeydown"])):(x(),M("span",QS,N(b.name),1)),k("span",XS,N(b.slides.length)+" 页",1)],40,HS))),128))])):(x(),B(m(Nb),{key:1,class:"pptx-custom-shows-list",title:"还没有自定义放映"})),k("div",ZS,[y(m(q),{type:"button",onClick:$[5]||($[5]=b=>o.value=null)},{default:A(()=>[...$[11]||($[11]=[R("新建…",-1)])]),_:1}),y(m(q),{type:"button",disabled:!i.value,onClick:$[6]||($[6]=b=>o.value=i.value??void 0)},{default:A(()=>[...$[12]||($[12]=[R("编辑…",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",disabled:!i.value,onClick:p},{default:A(()=>[...$[13]||($[13]=[R("重命名",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",disabled:!i.value,onClick:d},{default:A(()=>[...$[14]||($[14]=[R("复制",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",disabled:!i.value,onClick:c},{default:A(()=>[...$[15]||($[15]=[R("删除",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",disabled:!i.value||l.value.indexOf(i.value)===0,onClick:$[7]||($[7]=b=>h(-1))},{default:A(()=>[...$[16]||($[16]=[R("上移",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",disabled:!i.value||l.value.indexOf(i.value)===l.value.length-1,onClick:$[8]||($[8]=b=>h(1))},{default:A(()=>[...$[17]||($[17]=[R("下移",-1)])]),_:1},8,["disabled"])])]))]),_:2},[o.value===void 0?{name:"footer",fn:A(()=>[y(m(q),{type:"button",onClick:$[9]||($[9]=b=>n.value=!1)},{default:A(()=>[...$[18]||($[18]=[R("关闭",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!i.value||i.value.slides.length===0,onClick:v},{default:A(()=>[...$[19]||($[19]=[R("放映",-1)])]),_:1},8,["disabled"])]),key:"0"}:void 0]),1032,["title"])]),_:1},8,["open"]))}});function Jt(e){const t=Math.max(0,Math.floor(e/1e3)),n=o=>String(o).padStart(2,"0"),l=Math.floor(t/3600),s=`${n(Math.floor(t/60)%60)}:${n(t%60)}`;return l>0?`${l}:${s}`:s}function gm(e=()=>performance.now()){let t=0,n=e();return{elapsed:()=>t+(n===null?0:e()-n),get running(){return n!==null},toggle(){n===null?n=e():(t+=e()-n,n=null)},reset(){t=0,n!==null&&(n=e())}}}const JS={key:0,class:"pptx-keep-text"},eC={key:1,class:"pptx-keep-text"},tC=O({__name:"keep-dialog",props:{state:{},host:{}},setup(e){const t=e,{pending:n}=Yt(t.state),l=Q(null);X(n,i=>{l.value=i===null?null:i.result.ink.length>0?"ink":"timings"});const s=F(()=>l.value!==null),o=F(()=>n.value?.result.ink.reduce((i,r)=>i+r.strokes.length,0)??0);function a(i){const r=n.value;if(!r)return;const{commands:u}=t.state.session;if(l.value==="ink"){if(i&&u.addInkShapes({slides:r.result.ink}),r.result.timings!==null){l.value="timings";return}}else l.value==="timings"&&i&&r.result.timings&&r.result.timings.length>0&&u.setSlideTimings({timings:r.result.timings});n.value=null}return(i,r)=>(x(),B(m(Ae),{open:s.value,"onUpdate:open":r[2]||(r[2]=u=>!u&&a(!1))},{default:A(()=>[y(m(Te),{title:l.value==="ink"?"保留墨迹注释":"保留排练时间",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:r[0]||(r[0]=u=>a(!1))},{default:A(()=>[R(N(l.value==="ink"?"放弃":"不保留"),1)]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",onClick:r[1]||(r[1]=u=>a(!0))},{default:A(()=>[...r[3]||(r[3]=[R("保留",-1)])]),_:1})]),default:A(()=>[l.value==="ink"?(x(),M("p",JS,"放映中画了 "+N(o.value)+" 处墨迹,是否保留墨迹注释?",1)):(x(),M("p",eC,"幻灯片放映共需时间 "+N(m(Jt)(m(n)?.totalMs??0))+",是否保留新的幻灯片排练时间?",1))]),_:1},8,["title"])]),_:1},8,["open"]))}}),nC={class:"pptx-show-settings-group"},lC={class:"pptx-show-settings-range"},sC={class:"pptx-show-settings-pages"},oC=O({__name:"settings-dialog",props:{state:{},host:{}},setup(e){const t=e,n=Yt(t.state),l=n.settingsOpen,s=V("present"),o=V(!1),a=V("all"),i=V("1"),r=V("1"),u=V(""),c=V("timings"),d=V([]),p=V(1);X(l,$=>{if(!$)return;const b=t.state.session.document.presentation(),w=m2(b);p.value=pe(b).length,d.value=$f(b),s.value=w.mode,o.value=w.loop,a.value=w.slides.kind,i.value=String(w.slides.kind==="range"?w.slides.start:1),r.value=String(w.slides.kind==="range"?w.slides.end:p.value),u.value=String(w.slides.kind==="customShow"?w.slides.id:d.value[0]?.id??""),c.value=w.useTimings?"timings":"manual"});const f=F(()=>d.value.map($=>({value:String($.id),label:$.name}))),h=F(()=>{if(a.value==="all")return{kind:"all"};if(a.value==="customShow")return u.value===""?null:{kind:"customShow",id:Number(u.value)};const $=Number(i.value),b=Number(r.value);return Number.isInteger($)&&Number.isInteger(b)&&$>=1&&$<=b&&b<=p.value?{kind:"range",start:$,end:b}:null});function v(){h.value&&t.state.session.commands.setShowSettings({settings:{mode:s.value,loop:s.value==="kiosk"||o.value,slides:h.value,useTimings:c.value==="timings"}})&&(l.value=!1)}function g(){l.value=!1,n.customOpen.value=!0}return($,b)=>(x(),B(m(Ae),{open:m(l),"onUpdate:open":b[8]||(b[8]=w=>l.value=w)},{default:A(()=>[y(m(Te),{title:"设置放映方式",size:"medium",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",variant:"ghost",class:"pptx-show-settings-custom",onClick:g},{default:A(()=>[...b[11]||(b[11]=[R("自定义放映…",-1)])]),_:1}),y(m(q),{type:"button",onClick:b[7]||(b[7]=w=>l.value=!1)},{default:A(()=>[...b[12]||(b[12]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!h.value,onClick:v},{default:A(()=>[...b[13]||(b[13]=[R("确定",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("form",{class:"pptx-show-settings",onSubmit:J(v,["prevent"])},[y(m(Ke),{modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=w=>s.value=w),label:"放映类型",items:[{value:"present",label:"演讲者放映(全屏幕)"},{value:"kiosk",label:"展台自动循环放映(全屏幕)"}]},null,8,["modelValue"]),k("fieldset",nC,[b[9]||(b[9]=k("legend",{class:"pptx-show-settings-legend"},"放映选项",-1)),y(m(Ce),{checked:s.value==="kiosk"||o.value,disabled:s.value==="kiosk",label:"循环放映,按 Esc 键终止","onUpdate:checked":b[1]||(b[1]=w=>o.value=w===!0)},null,8,["checked","disabled"])]),k("div",lC,[y(m(Ke),{modelValue:a.value,"onUpdate:modelValue":b[2]||(b[2]=w=>a.value=w),label:"放映幻灯片",items:[{value:"all",label:"全部"},{value:"range",label:"从…到…"},{value:"customShow",label:"自定义放映",disabled:d.value.length===0}]},null,8,["modelValue","items"]),k("div",sC,[y(m(de),{modelValue:i.value,"onUpdate:modelValue":b[3]||(b[3]=w=>i.value=w),label:"起始页",min:1,max:p.value,step:1,disabled:a.value!=="range"},null,8,["modelValue","max","disabled"]),b[10]||(b[10]=k("span",null,"到",-1)),y(m(de),{modelValue:r.value,"onUpdate:modelValue":b[4]||(b[4]=w=>r.value=w),label:"结束页",min:1,max:p.value,step:1,disabled:a.value!=="range"},null,8,["modelValue","max","disabled"])]),y(m(ce),{modelValue:u.value,"onUpdate:modelValue":b[5]||(b[5]=w=>u.value=w),label:"自定义放映",items:f.value,disabled:a.value!=="customShow"||d.value.length===0},null,8,["modelValue","items","disabled"])]),y(m(Ke),{modelValue:c.value,"onUpdate:modelValue":b[6]||(b[6]=w=>c.value=w),label:"换片方式",items:[{value:"manual",label:"手动"},{value:"timings",label:"如果存在排练时间,则使用它"}]},null,8,["modelValue"])],32)]),_:1})]),_:1},8,["open"]))}}),aC={class:"pptx-show-overview-head"},iC=["aria-current","aria-label","onClick"],rC=["src"],uC={class:"text-qk-text-secondary"},bm=O({__name:"overview",props:{show:{}},emits:["close"],setup(e,{emit:t}){const n=e,l=t,{deck:s}=n.show,o=Array.from({length:s.count},(u,c)=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s.render(c))}`),a=je("grid");function i(u){n.show.go(u),l("close")}function r(u){u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),l("close"))}return ft(()=>requestAnimationFrame(()=>{const u=a.value?.querySelector("[aria-current='true']")??a.value?.querySelector("button");u?.scrollIntoView({block:"center"}),u?.focus({preventScroll:!0})})),(u,c)=>(x(),M("div",{class:"pptx-show-overview bg-qk-surface-workspace text-qk-text-primary",role:"dialog","aria-label":"全部幻灯片",onKeydown:r},[k("header",aC,[c[1]||(c[1]=k("strong",null,"全部幻灯片",-1)),y(m(ye),{label:"关闭",variant:"ghost",onClick:c[0]||(c[0]=d=>l("close"))},{default:A(()=>[y(m(me),{name:"close"})]),_:1})]),k("div",{ref_key:"grid",ref:a,class:"pptx-show-overview-grid"},[(x(!0),M(U,null,H(m(o),(d,p)=>(x(),M("button",{key:p,type:"button",class:"pptx-show-overview-item","aria-current":p===e.show.index,"aria-label":`第 ${m(s).numbers[p]} 页`,onClick:f=>i(p)},[k("img",{src:d,alt:""},null,8,rC),k("span",uC,N(m(s).numbers[p]),1)],8,iC))),128))],512)],32))}}),ym=pc({profile:"stone",scheme:"dark",sources:{primary:"#d4441c"}}),cC={class:"pptx-presenter-bar"},dC={class:"pptx-presenter-clock","aria-label":"已放映时间"},pC={class:"pptx-presenter-slide-clock text-qk-text-secondary","aria-label":"本页用时"},fC={class:"text-qk-text-secondary"},mC={class:"pptx-presenter-body"},hC={class:"pptx-presenter-current","aria-label":"当前幻灯片"},vC=["src"],gC={class:"pptx-presenter-tools"},bC={class:"pptx-presenter-page"},yC={class:"pptx-presenter-side"},xC={"aria-label":"下一张"},wC={class:"pptx-presenter-heading"},kC=["src"],$C={key:1,class:"pptx-presenter-end text-qk-text-secondary"},SC={class:"pptx-presenter-notes","aria-label":"备注"},CC={class:"pptx-presenter-heading"},xm=O({__name:"presenter-view",props:{show:{},page:{},inline:{type:Boolean},stopwatch:{},saveNotes:{type:Function}},emits:["close"],setup(e,{emit:t}){const n=e,l=t,s=Q(0),o=n.stopwatch??gm(),a=Q(20),i=n.show.subscribe(()=>{s.value+=1}),r=setInterval(()=>{s.value+=1},500),u=F(()=>(s.value,n.show.index)),{deck:c}=n.show,d=new Map;function p(K){const G=c.parts[K]??String(K);let ee=d.get(G);return ee===void 0&&d.set(G,ee=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c.render(K))}`),ee}const f=Q(!1);let h=o.elapsed();X(u,()=>{h=o.elapsed()});const v=F(()=>(s.value,Jt(o.elapsed()-h))),g=F(()=>{s.value;const{played:K,total:G}=n.show.animation;return K<G?`下一步:本页动画 ${K+1} / ${G}`:"下一张"}),$=F(()=>u.value+1<c.count?u.value+1:c.settings.loop&&c.count>0?0:null),b=F(()=>(s.value,c.count>0?c.notes(u.value):"")),w=F(()=>(s.value,Math.max(0,...c.numbers))),S=V(""),C=V(),E=F(()=>(s.value,Jt(o.elapsed()))),T=F(()=>(s.value,new Date().toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}))),z=F(()=>(s.value,{tool:n.show.tool,blank:n.show.blank,running:o.running}));function D(){const K=c.numbers.indexOf(Number(S.value));S.value="",K>=0&&n.show.go(K)}function P(){const K=C.value;C.value=void 0,!(!K||K.text===c.notes(K.index))&&(c.writeNotes(K.index,K.text),n.saveNotes?.(c.parts[K.index],K.text),s.value+=1)}X(u,()=>P(),{flush:"sync"});function I(K){K.target instanceof Element&&K.target.closest("input,textarea,[role='dialog']")||n.show.handleKey(K)&&K.preventDefault()}return n.page?.addEventListener("keydown",I),Re(()=>{i(),clearInterval(r),n.page?.removeEventListener("keydown",I)}),(K,G)=>(x(),B(m(ti),{theme:m(ym)},{default:A(()=>[y(m(Ya),{registry:m(Qs)},{default:A(()=>[k("div",{class:Ne(["pptx-presenter bg-qk-surface-workspace text-qk-text-primary qk-type-body",{"pptx-presenter-fill":e.inline}]),role:"region","aria-label":"演讲者视图"},[k("header",cC,[k("span",dC,N(E.value),1),k("span",pC,"本页 "+N(v.value),1),y(m(ye),{label:z.value.running?"暂停计时":"继续计时",variant:"ghost",size:"sm",onClick:G[0]||(G[0]=ee=>{m(o).toggle(),s.value+=1})},{default:A(()=>[y(m(me),{name:z.value.running?"pause":"play"},null,8,["name"])]),_:1},8,["label"]),y(m(ye),{label:"重新计时",variant:"ghost",size:"sm",onClick:G[1]||(G[1]=ee=>{m(o).reset(),Db(h)?h.value=0:h=0,s.value+=1})},{default:A(()=>[y(m(me),{name:"rotateCcw"})]),_:1}),G[20]||(G[20]=k("span",{class:"pptx-presenter-spacer"},null,-1)),k("span",fC,N(T.value),1),e.inline?(x(),B(m(q),{key:0,variant:"ghost",size:"sm",onClick:G[2]||(G[2]=ee=>l("close"))},{default:A(()=>[...G[19]||(G[19]=[R("观众视图",-1)])]),_:1})):L("v-if",!0)]),k("main",mC,[k("section",hC,[m(c).count>0?(x(),M("img",{key:0,class:"pptx-presenter-slide",src:p(u.value),alt:""},null,8,vC)):L("v-if",!0),k("div",gC,[y(m(ye),{label:"全部幻灯片",variant:"ghost",onClick:G[3]||(G[3]=ee=>f.value=!0)},{default:A(()=>[y(m(me),{name:"layoutGrid"})]),_:1}),y(m(ye),{label:"上一页",variant:"ghost",onClick:G[4]||(G[4]=ee=>e.show.previous())},{default:A(()=>[y(m(me),{name:"chevronLeft"})]),_:1}),G[22]||(G[22]=k("span",{class:"pptx-presenter-page"},"第",-1)),y(m(de),{modelValue:S.value,"onUpdate:modelValue":G[5]||(G[5]=ee=>S.value=ee),label:"跳到幻灯片",placeholder:String(m(c).numbers[u.value]??u.value+1),min:1,max:w.value,width:"72px",onKeydown:ue(J(D,["prevent"]),["enter"]),onFocusChange:G[6]||(G[6]=ee=>!ee.focused&&S.value&&D())},null,8,["modelValue","placeholder","max","onKeydown"]),k("span",bC,"页 · "+N(u.value+1)+" / "+N(m(c).count),1),y(m(ye),{label:"下一页",variant:"ghost",onClick:G[7]||(G[7]=ee=>e.show.next())},{default:A(()=>[y(m(me),{name:"chevronRight"})]),_:1}),G[23]||(G[23]=k("span",{class:"pptx-presenter-divider"},null,-1)),y(m(ye),{label:"激光笔",variant:"ghost",pressed:z.value.tool==="laser",onClick:G[8]||(G[8]=ee=>e.show.setTool(z.value.tool==="laser"?"pointer":"laser"))},{default:A(()=>[y(m(me),{name:"laserPointer"})]),_:1},8,["pressed"]),y(m(ye),{label:"画笔",variant:"ghost",pressed:z.value.tool==="pen",onClick:G[9]||(G[9]=ee=>e.show.setTool(z.value.tool==="pen"?"pointer":"pen"))},{default:A(()=>[y(m(me),{name:"inkPen"})]),_:1},8,["pressed"]),y(m(ye),{label:"黑屏",variant:"ghost",pressed:z.value.blank==="black",onClick:G[10]||(G[10]=ee=>e.show.setBlank(z.value.blank==="black"?null:"black"))},{default:A(()=>[y(m(me),{name:"moon"})]),_:1},8,["pressed"]),y(m(ye),{label:"白屏",variant:"ghost",pressed:z.value.blank==="white",onClick:G[11]||(G[11]=ee=>e.show.setBlank(z.value.blank==="white"?null:"white"))},{default:A(()=>[y(m(me),{name:"sun"})]),_:1},8,["pressed"]),G[24]||(G[24]=k("span",{class:"pptx-presenter-spacer"},null,-1)),y(m(q),{variant:"solid",color:"primary",onClick:G[12]||(G[12]=ee=>e.show.close())},{default:A(()=>[...G[21]||(G[21]=[R("结束放映",-1)])]),_:1})])]),k("aside",yC,[k("section",xC,[k("h2",wC,N(g.value),1),$.value!==null?(x(),M("img",{key:0,class:"pptx-presenter-slide",src:p($.value),alt:""},null,8,kC)):(x(),M("p",$C,"放映结束"))]),k("section",SC,[k("h2",CC,[G[25]||(G[25]=R(" 备注 ",-1)),G[26]||(G[26]=k("span",{class:"pptx-presenter-spacer"},null,-1)),y(m(ye),{label:"缩小备注文字",variant:"ghost",size:"sm",disabled:a.value<=12,onClick:G[13]||(G[13]=ee=>a.value-=2)},{default:A(()=>[y(m(me),{name:"fontSizeDecrease"})]),_:1},8,["disabled"]),y(m(ye),{label:"放大备注文字",variant:"ghost",size:"sm",disabled:a.value>=40,onClick:G[14]||(G[14]=ee=>a.value+=2)},{default:A(()=>[y(m(me),{name:"fontSizeIncrease"})]),_:1},8,["disabled"]),e.saveNotes&&m(c).count>0?(x(),M(U,{key:0},[C.value?(x(),B(m(ye),{key:0,label:"完成编辑",variant:"ghost",size:"sm",onClick:P},{default:A(()=>[y(m(me),{name:"check"})]),_:1})):(x(),B(m(ye),{key:1,label:"编辑备注",variant:"ghost",size:"sm",onClick:G[15]||(G[15]=ee=>C.value={index:u.value,text:b.value})},{default:A(()=>[y(m(me),{name:"edit"})]),_:1}))],64)):L("v-if",!0)]),C.value?(x(),B(m(Ct),{key:0,modelValue:C.value.text,"onUpdate:modelValue":G[16]||(G[16]=ee=>C.value.text=ee),class:"pptx-presenter-notes-edit",label:"备注",style:fe({fontSize:`${a.value}px`}),resize:"none",autofocus:"",onKeydown:G[17]||(G[17]=ue(J(ee=>C.value=void 0,["stop","prevent"]),["esc"])),onBlur:P},null,8,["modelValue","style"])):(x(),M("div",{key:1,class:"pptx-presenter-notes-text",style:fe({fontSize:`${a.value}px`})},N(b.value||"这一页没有备注"),5))])])]),f.value?(x(),B(bm,{key:0,show:e.show,onClose:G[18]||(G[18]=ee=>f.value=!1)},null,8,["show"])):L("v-if",!0)],2)]),_:1},8,["registry"])]),_:1},8,["theme"]))}}),MC=100,PC=50,Qr=new WeakMap;function Xr(e){const t=e.defaultView,n=Math.min(1280,t?.screen.availWidth??1280),l=Math.min(800,t?.screen.availHeight??800);return t?.open("","pptx-presenter-view",`popup,width=${n},height=${l}`)??null}function wm(e){try{return e.closed?null:e.document}catch{return null}}function TC(e,t,n,l){e.title="演讲者视图",e.head.replaceChildren(...[...t.surface.ownerDocument.querySelectorAll("style, link[rel='stylesheet']")].map(i=>e.importNode(i,!0)));const s=e.createElement("meta");s.setAttribute("charset","utf-8"),e.head.prepend(s),e.body.replaceChildren(),e.body.style.margin="0";const o=e.createElement("div");e.body.append(o);const a=rc(xm,{show:t,page:e,stopwatch:n,saveNotes:l});return a.mount(o),a}function km(e,t,n){const l=Qr.get(e);if(l)return e.focus(),l;const s=t.surface.ownerDocument.defaultView,o=gm();let a=null,i=null,r=!1,u;function c(){if(i=wm(e),!i)return f();a=TC(i,t,o,n),e.addEventListener("pagehide",d,{once:!0})}function d(){a?.unmount(),a=null,r||p(0)}function p(h){u=setTimeout(()=>{const v=wm(e);v&&v!==i&&v.readyState==="complete"?c():v&&h<PC?p(h+1):f()},MC)}function f(){r||(r=!0,clearTimeout(u),a?.unmount(),a=null,Qr.delete(e),s?.removeEventListener("pagehide",f),e.closed||e.close())}return Qr.set(e,f),s?.addEventListener("pagehide",f),c(),f}async function Gn(e,t,n){const l=Yt(e);if(l.show.value)return;const s=n.presenter?n.presenterWindow??Xr(t.ownerDocument):null,{document:o}=e.session,a=await lc(await o.save(),{slides:n.slides}).catch(p=>{throw s?.close(),p}),i=nb(a,{start:n.from==="current"?AC(e,a):n.from,rehearse:n.rehearse,windowed:n.reading,container:t.ownerDocument.body});l.show.value=i;const r=i.subscribe(()=>{l.tick.value+=1}),u=s?km(s,i,Zr(e)):void 0;n.presenter&&!s&&(l.presenterInline.value=!0);const c=await i.closed;r(),u?.(),l.show.value=null;const d=c.timings?.reduce((p,f)=>p+f.ms,0)??0;(c.ink.length>0||c.timings!==null)&&(l.pending.value={result:c,totalMs:d})}function AC(e,t){const n=e.session.document.selection().slide,l=n===null?-1:t.parts.indexOf(n);if(l>=0)return l;const s=e.slides.value.findIndex(o=>o.part===n)+1;return s>0&&e.slides.value[s-1]?.hidden?Math.max(0,t.reveal(s)):0}function EC(e,t){const n=Yt(e).show.value;if(!n)return;n.expectWindowed();const l=Xr(t.ownerDocument);if(!l){Yt(e).presenterInline.value=!0;return}const s=km(l,n,Zr(e));n.closed.then(s)}function Zr(e){return(t,n)=>{e.session.commands.setSlideNotes({slide:t,notes:n})}}function FC(e,t,n,l){const s=Yt(e),o=s.presenter.value;if(t==="present-start")Gn(e,l,{from:0,presenter:o});else if(t==="present-current")Gn(e,l,{from:"current",presenter:o});else if(t==="show:reading")Gn(e,l,{from:"current",reading:!0});else if(t==="show:rehearse")Gn(e,l,{from:0,rehearse:!0});else if(t==="show:presenter")Gn(e,l,{from:"current",presenter:!0});else if(t==="show:presenter-default")s.presenter.value=!s.presenter.value;else if(t.startsWith("show:custom-start")){const a=t==="show:custom-start"?n:Number(t.slice(18));typeof a=="number"&&Number.isInteger(a)&&Gn(e,l,{from:0,slides:{kind:"customShow",id:a},presenter:o})}else if(t==="show:settings")s.settingsOpen.value=!0;else if(t==="show:custom")s.customOpen.value=!0;else return!1;return!0}function zl(e){e.tick.value;const t=e.current.value?.part;if(!t||e.selected.value.length!==1)return;const n=e.boxes.value.find(a=>a.id===e.selected.value[0]);if(n?.kind!=="media")return;const l=le(e.session.document.presentation(),t,n.id),s=l?Oc(l):null,o=l?Uc(l):null;if(!(!s||!o))return{slide:t,shape:n.id,kind:s.kind==="audio"?"audio":"video",playback:o}}const Yr=[["low","低",.25],["medium","中",.5],["high","高",1]],$m=e=>({value:e,label:"",kind:"separator"});function Sm(e){const t=zl(e),n=t?.playback,l=t===void 0,s=t?.kind==="audio",o=n?.muted?"mute":Yr.reduce((a,i)=>Math.abs(i[2]-(n?.volume??1))<Math.abs(a[2]-(n?.volume??1))?i:a)[0];return[{value:"media:start",label:"开始",kind:"menu",trigger:"selector",text:n?.autoplay?"自动":"单击时",disabled:l,items:[{value:"start",label:"开始",kind:"radio-group",selectedValue:n?.autoplay?"media:start:auto":"media:start:click",children:[{value:"media:start:click",label:"单击时"},{value:"media:start:auto",label:"自动"}]}]},{value:"media:volume",label:"音量",icon:n?.muted?"volumeX":"volume2",kind:"menu",trigger:"disclosure",disabled:l,items:[{value:"volume",label:"音量",kind:"radio-group",selectedValue:`media:volume:${o}`,children:[...Yr.map(([a,i])=>({value:`media:volume:${a}`,label:i})),{value:"media:volume:mute",label:"静音"}]}]},$m("media-play"),...s?[{value:"media:background",label:"在后台播放"},{value:"media:across",label:"跨幻灯片播放",icon:"skipForward",kind:"toggle",pressed:(n?.slideCount??1)>1,disabled:l}]:[],{value:"media:loop",label:"循环播放,直到停止",icon:"refreshCw",kind:"toggle",pressed:n?.loop===!0,disabled:l},{value:"media:rewind",label:"播放完毕返回开头",icon:"rotateCcw",kind:"toggle",pressed:n?.rewindAfterPlaying===!0,disabled:l},{value:"media:hide",label:s?"放映时隐藏":"未播放时隐藏",icon:"eyeOff",kind:"toggle",pressed:n?.hideWhenStopped===!0,disabled:l},...t?.kind==="audio"?[]:[{value:"media:fullscreen",label:"全屏播放",icon:"maximize",kind:"toggle",pressed:n?.fullScreen===!0,disabled:l}],$m("media-times"),{value:"media:times",label:"剪裁、淡化与延迟",kind:"custom",renderer:"mediaTimes",disabled:l}]}function zC(e,t,n){if(!t.startsWith("media:"))return!1;const l=zl(e);if(!l)return!0;const{playback:s}=l;let o=null;if(t==="media:start:auto"||t==="media:start:click")o={autoplay:t==="media:start:auto"};else if(t==="media:volume:mute")o={muted:!0};else if(t.startsWith("media:volume:")){const a=Yr.find(([i])=>`media:volume:${i}`===t);a&&(o={volume:a[2],muted:!1})}else t==="media:background"?o={autoplay:!0,slideCount:999,loop:!0,hideWhenStopped:!0,rewindAfterPlaying:!1}:t==="media:across"?o={slideCount:(s.slideCount??1)>1?1:999}:t==="media:loop"?o={loop:!s.loop}:t==="media:rewind"?o={rewindAfterPlaying:!s.rewindAfterPlaying}:t==="media:hide"?o={hideWhenStopped:!s.hideWhenStopped}:t==="media:fullscreen"?o={fullScreen:!s.fullScreen}:t==="media:times"&&n&&typeof n=="object"&&(o=n);return o&&!e.session.commands.setMediaPlayback({slide:l.slide,shape:l.shape,playback:o})&&e.toaster.create({type:"error",title:"无法应用这项设置",description:"数值超出范围,或延迟需要先改为自动开始。"}),!0}const DC={class:"pptx-media-times"},LC={class:"pptx-media-times-label text-qk-text-secondary","aria-hidden":"true"},VC=O({__name:"media-times",props:{scope:{}},setup(e){const t=e,n=[["start","剪裁开头(秒)","剪裁开头"],["end","剪裁结尾(秒)","结尾"],["fadeIn","淡入(秒)","淡入"],["fadeOut","淡出(秒)","淡出"],["delay","延迟(秒)","延迟"]],l=F(()=>t.scope.context),s=r=>String(Math.round((r??0)/100)/10),o=F(()=>{const r=l.value?.playback;return{start:s(r?.trim?.startMs),end:s(r?.trim?.endMs),fadeIn:s(r?.fade?.inMs),fadeOut:s(r?.fade?.outMs),delay:s(r?.delayMs)}}),a=V({...o.value});X(o,r=>{a.value={...r}});function i(r){const u=Number(a.value[r]);if(a.value[r]===o.value[r])return;if(!Number.isFinite(u)||u<0){a.value={...o.value};return}const c=d=>Math.round(Number(a.value[d])*1e3);r==="start"||r==="end"?t.scope.execute({trim:{startMs:c("start"),endMs:c("end")}}):r==="fadeIn"||r==="fadeOut"?t.scope.execute({fade:{inMs:c("fadeIn"),outMs:c("fadeOut")}}):t.scope.execute({delayMs:c("delay")})}return(r,u)=>(x(),M("div",DC,[(x(),M(U,null,H(n,([c,d,p])=>(x(),M(U,{key:c},[k("span",LC,N(p),1),y(m(Fn),{label:d,disabled:e.scope.disabled||c==="delay"&&!l.value?.playback.autoplay,width:"56px"},{default:A(({size:f})=>[y(m(de),{modelValue:a.value[c],"onUpdate:modelValue":h=>a.value[c]=h,label:d,size:f,disabled:e.scope.disabled||c==="delay"&&!l.value?.playback.autoplay,min:0,step:.5,width:"56px",onBlur:h=>i(c),onKeydown:ue(h=>i(c),["enter"])},null,8,["modelValue","onUpdate:modelValue","label","size","disabled","onBlur","onKeydown"])]),_:2},1032,["label","disabled"])],64))),64))]))}}),IC=[["#E53935","红色"],["#FDD835","黄色"],["#1E88E5","蓝色"],["#43A047","绿色"],["#000000","黑色"],["#FFFFFF","白色"]],Cm={pointer:"mousePointer2",laser:"laserPointer",spotlight:"locateFixed",magnifier:"zoomIn",pen:"inkPen",highlighter:"inkHighlighter",eraser:"eraser"},Dl=typeof navigator<"u"&&/Mac|iPhone|iPad/u.test(navigator.platform)?"⌘":"Ctrl";function BC(e){const{tool:t}=e;return[{value:"previous",label:"上一页",icon:"chevronLeft"},{value:"next",label:"下一页",icon:"chevronRight"},{value:"tools",label:"指针选项",icon:Cm[t],kind:"menu",trigger:"disclosure",indicator:!1,items:Mm(e)},{value:"overview",label:"全部幻灯片",icon:"layoutGrid"},{value:"more",label:"更多",icon:"moreHorizontal",kind:"menu",trigger:"disclosure",indicator:!1,items:[{value:"presenter",label:"演讲者视图"},{value:"blank:black",label:"黑屏",shortcut:["B"]},{value:"blank:white",label:"白屏",shortcut:["W"]},{value:"separator",label:"",kind:"separator"},{value:"help",label:"快捷键帮助",shortcut:["?"]},{value:"end",label:"结束放映",shortcut:["Esc"]}]}]}function Mm(e){const{tool:t}=e;return[{value:"tool",label:"指针",kind:"radio-group",selectedValue:t,children:[{value:"pointer",label:"箭头",shortcut:[Dl,"A"]},{value:"laser",label:"激光笔",shortcut:[Dl,"L"]},{value:"spotlight",label:"聚光灯"},{value:"magnifier",label:"放大镜"},{value:"pen",label:"画笔",shortcut:[Dl,"P"]},{value:"highlighter",label:"荧光笔",shortcut:[Dl,"I"]},{value:"eraser",label:"橡皮擦",shortcut:[Dl,"E"]}]},{value:"colors",label:"墨迹颜色",kind:"submenu",children:[{value:"color",label:"墨迹颜色",kind:"radio-group",selectedValue:e.inkColor,children:IC.map(([n,l])=>({value:n,label:l}))}]},{value:"separator",label:"",kind:"separator"},{value:"clear-ink",label:"擦除本页墨迹",shortcut:["E"],disabled:!e.hasInk},{value:"clear-all-ink",label:"清除全部墨迹",disabled:!e.hasInk},{value:"ink-visible",label:"显示墨迹",checked:e.inkVisible,shortcut:[Dl,"M"]}]}function OC(e,t){if(t==="previous")e.previous();else if(t==="next")e.next();else if(t==="last-viewed")e.goLastViewed();else if(t.startsWith("go:"))e.go(Number(t.slice(3)));else if(t==="pause")e.setPaused(!e.paused);else if(t==="ink-visible")e.setInkVisible(!e.inkVisible);else if(t in Cm)e.setTool(t);else if(t.startsWith("#"))e.setInkColor(t);else if(t==="clear-ink"||t==="clear-all-ink")e.clearInk(t==="clear-ink"?"slide":"all");else if(t==="blank:black"||t==="blank:white"){const n=t==="blank:black"?"black":"white";e.setBlank(e.blank===n?null:n)}else if(t==="end")e.close();else if(t==="overview"||t==="presenter"||t==="help")return t;return null}const Jr=e=>({value:e,label:"",kind:"separator"});function UC(e,t){const{deck:n}=e,l=e.rehearsal!==null||n.settings.useTimings&&Array.from({length:n.count},(s,o)=>n.transition(o).advanceAfterMs!==void 0).some(Boolean);return[{value:"next",label:"下一页",shortcut:["N"]},{value:"previous",label:"上一页",shortcut:["P"]},{value:"last-viewed",label:"上次查看过的"},{value:"goto",label:"定位到",kind:"submenu",children:[{value:"overview",label:"全部幻灯片…",shortcut:["G"]},Jr("goto-slides"),{value:"slides",label:"幻灯片",kind:"radio-group",selectedValue:`go:${e.index}`,children:n.parts.map((s,o)=>({value:`go:${o}`,label:`${n.numbers[o]??o+1}. ${t(s)||"无标题"}`}))}]},{value:"pointer",label:"指针选项",kind:"submenu",children:Mm(e)},{value:"screen",label:"屏幕",kind:"submenu",children:[{value:"blank:black",label:"黑屏",shortcut:["B"],checked:e.blank==="black"},{value:"blank:white",label:"白屏",shortcut:["W"],checked:e.blank==="white"},...l?[{value:"pause",label:"暂停自动放映",shortcut:["S"],checked:e.paused}]:[],Jr("screen-views"),{value:"presenter",label:"演讲者视图"}]},Jr("help"),{value:"help",label:"快捷键帮助",shortcut:["?"]},{value:"end",label:"结束放映",shortcut:["Esc"]}]}const NC={class:"pptx-reading-bar bg-qk-surface-raised text-qk-text-primary",role:"toolbar","aria-label":"阅读视图"},RC={class:"pptx-reading-page","aria-live":"polite"},jC={class:"pptx-reading-spacer pptx-reading-end"},KC=O({__name:"reading-bar",props:{show:{},tick:{}},emits:["overview","present"],setup(e,{emit:t}){const n=e,l=t,s=F(()=>(n.tick,`${n.show.index+1} / ${n.show.deck.count}`));return(o,a)=>(x(),M("div",NC,[a[5]||(a[5]=k("span",{class:"pptx-reading-spacer"},null,-1)),y(m(ye),{label:"上一页",variant:"ghost",size:"sm",onClick:a[0]||(a[0]=i=>e.show.previous())},{default:A(()=>[y(m(me),{name:"chevronLeft"})]),_:1}),k("span",RC,N(s.value),1),y(m(ye),{label:"下一页",variant:"ghost",size:"sm",onClick:a[1]||(a[1]=i=>e.show.next())},{default:A(()=>[y(m(me),{name:"chevronRight"})]),_:1}),k("span",jC,[y(m(ye),{label:"全部幻灯片",variant:"ghost",size:"sm",onClick:a[2]||(a[2]=i=>l("overview"))},{default:A(()=>[y(m(me),{name:"layoutGrid"})]),_:1}),y(m(ye),{label:"从当前页全屏放映",variant:"ghost",size:"sm",onClick:a[3]||(a[3]=i=>l("present",e.show.index))},{default:A(()=>[y(m(me),{name:"monitor"})]),_:1}),y(m(ye),{label:"退出阅读视图",variant:"ghost",size:"sm",onClick:a[4]||(a[4]=i=>e.show.close())},{default:A(()=>[y(m(me),{name:"close"})]),_:1})])]))}}),WC={class:"pptx-show-rehearsal bg-qk-surface-raised text-qk-text-primary",role:"group","aria-label":"排练计时"},qC={class:"pptx-show-rehearsal-time","aria-label":"本页用时"},_C={class:"pptx-show-rehearsal-total text-qk-text-secondary","aria-label":"总用时"},GC=O({__name:"rehearsal-bar",props:{show:{},tick:{}},setup(e){const t=e,n=Q(0),l=setInterval(()=>{n.value+=1},500);Re(()=>clearInterval(l));const s=F(()=>{n.value,t.tick;const o=t.show.rehearsal;return{slide:Jt(o?.slideMs()??0),total:Jt(o?.totalMs()??0),paused:o?.paused===!0}});return(o,a)=>(x(),M("div",WC,[y(m(ye),{label:"下一项",variant:"ghost",size:"sm",onClick:a[0]||(a[0]=i=>e.show.next())},{default:A(()=>[y(m(me),{name:"chevronRight"})]),_:1}),y(m(ye),{label:s.value.paused?"继续录制":"暂停录制",variant:"ghost",size:"sm",onClick:a[1]||(a[1]=i=>{e.show.rehearsal?.toggle(),n.value+=1})},{default:A(()=>[y(m(me),{name:s.value.paused?"play":"pause"},null,8,["name"])]),_:1},8,["label"]),k("span",qC,N(s.value.slide),1),y(m(ye),{label:"重复本页",variant:"ghost",size:"sm",onClick:a[2]||(a[2]=i=>{e.show.rehearsal?.repeat(),n.value+=1})},{default:A(()=>[y(m(me),{name:"rotateCcw"})]),_:1}),k("span",_C,N(s.value.total),1)]))}});function HC(e){return[{title:"翻页",items:[{keys:[["→"],["↓"],["空格"],["Enter"],["PageDown"],["N"]],action:"下一个动画或下一页"},{keys:[["←"],["↑"],["Backspace"],["PageUp"],["P"]],action:"上一个动画或上一页"},{keys:[["Home"]],action:"第一页"},{keys:[["End"]],action:"最后一页"},{keys:[["数字","Enter"]],action:"跳到该页"},{keys:[["H"]],action:"放映下一张隐藏的幻灯片"},{keys:[["G"],["-"]],action:"查看全部幻灯片"}]},{title:"屏幕",items:[{keys:[["B"],["."]],action:"黑屏,再按一次返回"},{keys:[["W"],[","]],action:"白屏,再按一次返回"}]},{title:"指针与墨迹",items:[{keys:[[e,"L"]],action:"激光笔,再按一次返回箭头"},{keys:[[e,"P"]],action:"画笔"},{keys:[[e,"I"]],action:"荧光笔"},{keys:[[e,"E"]],action:"橡皮擦"},{keys:[[e,"A"]],action:"箭头"},{keys:[["E"]],action:"擦除本页墨迹"},{keys:[[e,"M"]],action:"显示或隐藏墨迹"},{keys:[["滚轮"]],action:"调整聚光灯光圈或放大镜倍数"}]},{title:"其他",items:[{keys:[["S"],["+"]],action:"暂停或继续自动放映"},{keys:[["右键"]],action:"放映菜单"},{keys:[["?"]],action:"显示或关闭快捷键帮助"},{keys:[["Esc"]],action:"结束放映"}]}]}const QC={class:"pptx-show-help-head"},XC={class:"pptx-show-help-groups"},ZC={class:"pptx-show-help-title text-qk-text-secondary"},YC={class:"pptx-show-help-list"},JC={class:"pptx-show-help-keys"},eM={class:"pptx-show-help-action"},tM=O({__name:"shortcut-help",emits:["close"],setup(e,{emit:t}){const n=t,l=HC(/Mac|iPhone|iPad/u.test(navigator.platform)?"⌘":"Ctrl"),s=je("panel");function o(a){a.key!=="Escape"&&a.key!=="?"||(a.preventDefault(),a.stopPropagation(),n("close"))}return ft(()=>s.value?.focus()),(a,i)=>(x(),M("div",{ref_key:"panel",ref:s,class:"pptx-show-help bg-qk-surface-raised text-qk-text-primary",role:"dialog","aria-label":"快捷键帮助",tabindex:"-1",onKeydown:o},[k("header",QC,[i[1]||(i[1]=k("strong",null,"快捷键帮助",-1)),y(m(ye),{label:"关闭",variant:"ghost",size:"sm",onClick:i[0]||(i[0]=r=>n("close"))},{default:A(()=>[y(m(me),{name:"close"})]),_:1})]),k("div",XC,[(x(!0),M(U,null,H(m(l),r=>(x(),M("section",{key:r.title},[k("h3",ZC,N(r.title),1),k("dl",YC,[(x(!0),M(U,null,H(r.items,u=>(x(),M(U,{key:u.action},[k("dt",JC,[(x(!0),M(U,null,H(u.keys,c=>(x(),B(m(Rb),{key:c.join("+"),keys:c,size:"sm"},null,8,["keys"]))),128))]),k("dd",eM,N(u.action),1)],64))),128))])]))),128))])],544))}}),nM={key:1,class:"pptx-show-toolbar"},lM={id:"slide-show",intent:(e,t,n,l)=>zC(e,t,n)||FC(e,t,n,l),tabs:[{value:"video-tools",label:"视频工具",order:110,contextual:e=>zl(e)?.kind==="video",entries:Sm,context:zl},{value:"audio-tools",label:"音频工具",order:111,contextual:e=>zl(e)?.kind==="audio",entries:Sm,context:zl}],renderers:{mediaTimes:VC},overlays:[O({__name:"show-tools",props:{state:{},host:{}},setup(e){const t=e,n=Yt(t.state),l=je("root"),s=Q(!1),o=Q(!1),a=n.show,i=F(()=>(n.tick.value,a.value?BC(a.value):[])),r=F(()=>a.value?.deck.settings.kiosk===!0);X(a,()=>{s.value=!1,o.value=!1,a.value||(n.presenterInline.value=!1)});async function u(v){const g=a.value;if(!g)return;const $=n.presenter.value,b=$?Xr(t.host.ownerDocument):null;g.close(),await g.closed,await Promise.resolve(),await Gn(t.state,t.host,{from:v,presenter:$,presenterWindow:b})}function c(v){if(!a.value||v.defaultPrevented||o.value||s.value||v.ctrlKey||v.metaKey||v.altKey)return;const g=v.target instanceof Element?v.target.closest("input,textarea,[role='menu'],[role='dialog']"):null;if(!(g&&!g.hasAttribute("data-pptx-show-surface"))){if(v.key==="?")o.value=!0;else if(["g","G","-"].includes(v.key)&&!a.value.windowed&&!n.presenterInline.value)s.value=!0;else return;v.preventDefault()}}const d=Q(),p=F(()=>(n.tick.value,a.value&&d.value?UC(a.value,v=>t.state.slides.value.find(g=>g.part===v)?.title??""):[]));function f(v){const g=a.value;!g||r.value||g.windowed||n.presenterInline.value||v.target instanceof Element&&v.target.closest("[data-pptx-show-ui]")||(v.preventDefault(),v.stopImmediatePropagation(),d.value={x:v.clientX,y:v.clientY})}X(a,(v,g)=>{d.value=void 0,g?.surface.removeEventListener("contextmenu",f,!0),v?.surface.addEventListener("contextmenu",f,!0)},{immediate:!0}),window.addEventListener("keydown",c),Re(()=>window.removeEventListener("keydown",c));function h(v){if(!a.value)return;const g=OC(a.value,v.value);g==="overview"?s.value=!0:g==="help"?o.value=!0:g==="presenter"?EC(t.state,t.host):a.value?.surface.focus()}return(v,g)=>m(a)?(x(),B(Eb,{key:0,to:m(a).surface},[y(m(ti),{theme:m(ym)},{default:A(()=>[y(m(Ya),{registry:m(Qs)},{default:A(()=>[y(m(fc),{target:l.value??void 0,strategy:"fixed"},{default:A(()=>[L(" Clicks on the controls stay with them and never advance the show beneath. "),k("div",{ref_key:"root",ref:l,class:"pptx-show-ui","data-pptx-show-ui":"",onClick:g[6]||(g[6]=J(()=>{},["stop"])),onContextmenu:g[7]||(g[7]=J(()=>{},["stop"])),onPointerdown:g[8]||(g[8]=J(()=>{},["stop"]))},[m(a).windowed?(x(),B(KC,{key:0,show:m(a),tick:m(n).tick.value,onOverview:g[0]||(g[0]=$=>s.value=!0),onPresent:u},null,8,["show","tick"])):!r.value&&!m(n).presenterInline.value?(x(),M("div",nM,[y(m(Nt),{label:"放映工具",items:i.value,onExecute:h},null,8,["items"])])):L("v-if",!0),m(a).rehearsal?(x(),B(GC,{key:2,show:m(a),tick:m(n).tick.value},null,8,["show","tick"])):L("v-if",!0),s.value?(x(),B(bm,{key:3,show:m(a),onClose:g[1]||(g[1]=$=>s.value=!1)},null,8,["show"])):L("v-if",!0),o.value?(x(),B(tM,{key:4,onClose:g[2]||(g[2]=$=>{o.value=!1,m(a).surface.focus()})})):L("v-if",!0),d.value?(x(),B(m(Xs),{key:`${d.value.x}:${d.value.y}`,open:!0,items:p.value,"anchor-point":d.value,placement:"bottom-start","aria-label":"放映菜单","initial-focus":"menu",onSelect:g[3]||(g[3]=$=>{d.value=void 0,h({value:$})}),"onUpdate:open":g[4]||(g[4]=$=>!$&&(d.value=void 0))},null,8,["items","anchor-point"])):L("v-if",!0),m(n).presenterInline.value?(x(),B(xm,{key:6,class:"pptx-presenter-inline",show:m(a),page:null,"save-notes":m(Zr)(e.state),inline:"",onClose:g[5]||(g[5]=$=>{m(n).presenterInline.value=!1,m(a).surface.focus()})},null,8,["show","save-notes"])):L("v-if",!0)],544)]),_:1},8,["target"])]),_:1},8,["registry"])]),_:1},8,["theme"])],8,["to"])):L("v-if",!0)}}),tC,oC,YS]};function sM(e){e.tick.value;const t=e.current.value,n=Gl(e.session.document.presentation());return[...wt(e),{value:"present-start",label:"从头开始",icon:"play"},{value:"present-current",label:"从当前页开始",icon:"monitor"},{value:"show:custom-menu",kind:"menu",trigger:"disclosure",label:"自定义放映",icon:"layoutList",items:[...n.map(l=>({value:`show:custom-start:${l.id}`,label:l.name})),...n.length?[{value:"show:custom-separator",label:"",kind:"separator"}]:[],{value:"show:custom",label:"管理自定义放映…"}]},ut("show-setup"),{value:"show:settings",label:"放映设置",icon:"settings"},{value:"toggle-hidden",label:"隐藏幻灯片",icon:"eyeOff",kind:"toggle",pressed:t?.hidden===!0,disabled:t===void 0},{value:"show:rehearse",label:"排练计时",icon:"timer",tooltip:"排练计时:从头放映并记录每页停留时间,结束时可保存为自动换片时间"},ut("show-presenter"),{value:"show:presenter-default",label:"演讲者视图",icon:"presenterView",kind:"toggle",pressed:Yt(e).presenter.value,tooltip:"演讲者视图:放映时另开窗口显示备注、下一页和计时"}]}const Pm=new WeakMap;function Ll(e){let t=Pm.get(e);return t||(t=Q({color:"#000000",width:1,preset:"all",dash:"solid"}),Pm.set(e,t)),t}const Tm=new WeakMap;function eu(e){let t=Tm.get(e);return t||(t=Q(),Tm.set(e,t)),t}const Hn=e=>({value:e,label:"",kind:"separator"}),Am=[["normal","普通",{left:91440,right:91440,top:45720,bottom:45720}],["narrow","窄",{left:45720,right:45720,top:22860,bottom:22860}],["wide","宽",{left:182880,right:182880,top:91440,bottom:91440}],["none","无",{left:0,right:0,top:0,bottom:0}]],tu=[["all","所有框线","tableBorderAll"],["outside","外侧框线","tableBorderOutside"],["inside","内部框线","tableBorderInside"],["top","上框线","tableBorderTop"],["bottom","下框线","tableBorderBottom"],["left","左框线","tableBorderLeft"],["right","右框线","tableBorderRight"],["diagonalDown","斜下框线","tableBorderDiagonalDown"],["diagonalUp","斜上框线","tableBorderDiagonalUp"],["none","无框线","tableBorderNone"]],oM=[["firstRow","标题行"],["lastRow","汇总行"],["bandRow","镶边行"],["firstCol","第一列"],["lastCol","最后一列"],["bandCol","镶边列"]],aM=[["horz","横排"],["eaVert","竖排"],["vert","所有文字旋转 90°"],["vert270","所有文字旋转 270°"]];function iM(e){const t=yt(e),n=t===void 0,l=t?.range,s=t?.info,o=t?or(e.session.document.presentation(),t.slide,t.shape)?.options:void 0,a=s!==void 0&&!s.regular,i=a?{disabled:!0,disabledReason:"这个表格有缺少单元格的行,不能增删行列或合并拆分"}:{disabled:n},r=!l||!s||l.rows*l.columns===1||s.merges.some(c=>c.row===l.row&&c.column===l.column&&c.rows===l.rows&&c.columns===l.columns),u=!!l&&!!s?.merges.some(c=>c.row<l.row+l.rows&&l.row<c.row+c.rows&&c.column<l.column+l.columns&&l.column<c.column+c.columns);return[...wt(e),{value:"table-font-family",label:"字体",kind:"custom",renderer:"fontFamily",disabled:n},{value:"table-font-size",label:"字号",kind:"custom",renderer:"fontSize",disabled:n},{value:"table-bold",label:"加粗",icon:"bold",kind:"toggle",pressed:s?.text.bold===!0,disabled:n},{value:"table-italic",label:"斜体",icon:"italic",kind:"toggle",pressed:s?.text.italic===!0,disabled:n},{value:"table-underline",label:"下划线",icon:"underline",kind:"toggle",pressed:s?.text.underline===!0,disabled:n},{value:"table-strike",label:"删除线",icon:"strike",kind:"toggle",pressed:s?.text.strike===!0,disabled:n},{value:"table-text-color",label:"字体颜色",icon:"textColor",kind:"custom",renderer:"color",disabled:n},Hn("table-pick"),{value:"table-select",kind:"menu",trigger:"disclosure",label:"选择",icon:"tableSelectCell",disabled:n,items:[{value:"table-select:row",label:"选择行",icon:"tableSelectRow"},{value:"table-select:column",label:"选择列",icon:"tableSelectColumn"},{value:"table-select:table",label:"选择表格",icon:"table"}]},Hn("table-insert"),{value:"table-insert-row:above",label:"在上方插入行",icon:"tableInsertRowAbove",...i},{value:"table-insert-row:below",label:"在下方插入行",icon:"tableInsertRowBelow",...i},{value:"table-insert-column:left",label:"在左侧插入列",icon:"tableInsertColumnLeft",...i},{value:"table-insert-column:right",label:"在右侧插入列",icon:"tableInsertColumnRight",...i},{value:"table-delete",kind:"menu",trigger:"disclosure",label:"删除",icon:"tableDelete",disabled:n,items:[{value:"table-delete:rows",label:"删除行",icon:"tableDeleteRow",disabled:a},{value:"table-delete:columns",label:"删除列",icon:"tableDeleteColumn",disabled:a},{value:"table-delete:table",label:"删除表格",icon:"trash"}]},Hn("table-merge"),{value:"table-merge",label:"合并单元格",icon:"tableMergeCells",disabled:n||r||a,...a?{disabledReason:i.disabledReason}:r&&!n?{disabledReason:"先拖动选中多个单元格"}:{}},{value:"table-split",label:"拆分单元格",icon:"tableSplitCell",kind:"disclosure",indicator:!0,contentRenderer:"tableSplit",disabled:n||a||!u&&!r,...a?{disabledReason:i.disabledReason}:{},overlayProps:{width:"auto"}},Hn("table-size"),{value:"table-size",label:"行高与列宽",kind:"custom",renderer:"tableCellSize",disabled:n},{value:"table-distribute-rows",label:"平均分布各行",icon:"tableDistributeRows",disabled:n||l.rows<2},{value:"table-distribute-columns",label:"平均分布各列",icon:"tableDistributeColumns",disabled:n||l.columns<2},Hn("table-align"),...["left","center","right","justify"].map(c=>({value:`table-align:${c}`,kind:"toggle",pressed:s?.align===c,disabled:n,label:{left:"左对齐",center:"居中",right:"右对齐",justify:"两端对齐"}[c],icon:{left:"alignStart",center:"alignCenter",right:"alignEnd",justify:"alignJustify"}[c]})),{value:"table-align-grid",label:"对齐方式",kind:"disclosure",indicator:!0,contentRenderer:"tableAlignGrid",disabled:n,overlayProps:{width:"auto"},icon:{top:"tableAlignTop",center:"tableAlignCenter",bottom:"tableAlignBottom"}[s?.anchor??"top"]},{value:"table-calc",kind:"menu",trigger:"disclosure",label:"快速计算",icon:"sigma",disabled:n,items:[["sum","求和"],["average","平均值"],["max","最大值"],["min","最小值"]].map(([c,d])=>({value:`table-calc:${c}`,label:d}))},{value:"table-style-options",kind:"menu",trigger:"disclosure",label:"表格样式选项",icon:"slidersVertical",disabled:n,items:oM.map(([c,d])=>({value:`table-style-option:${c}`,label:d,checked:o?.[c]===!0}))},{value:"table-diagonal",kind:"menu",trigger:"disclosure",label:"斜线表头",icon:"tableBorderDiagonalDown",disabled:n,items:[{value:"table-diagonal-group",label:"斜线",kind:"radio-group",selectedValue:`table-diagonal:${s?.diagonals.down?s.diagonals.up?"both":"down":s?.diagonals.up?"up":"none"}`,children:[["none","无斜线"],["down","斜下"],["up","斜上"],["both","双斜线"]].map(([c,d])=>({value:`table-diagonal:${c}`,label:d}))}]},{value:"table-direction",kind:"menu",trigger:"disclosure",label:"文字方向",icon:"textDirectionVertical",disabled:n,items:aM.map(([c,d])=>({value:`table-direction:${c}`,label:d,...c===s?.direction?{icon:"check"}:{}}))},{value:"table-margins",kind:"menu",trigger:"disclosure",label:"单元格边距",icon:"tableCellMargins",disabled:n,items:[...Am.map(([c,d,p])=>({value:`table-margins:${c}`,label:d,...s&&Object.entries(p).every(([f,h])=>s.margins[f]===h)?{icon:"check"}:{}})),{value:"table-margins-separator",label:"",kind:"separator"},{value:"table-properties:margins",label:"自定义边距…"}]},{value:"table-properties",label:"表格属性",icon:"tableProperties",disabled:n}]}function rM(e){const t=yt(e)===void 0,n=eu(e).value,l=tu.find(([s])=>s===Ll(e).value.preset)??tu[0];return[...wt(e),{value:"table-style-gallery",label:"表格样式",icon:"tableStyle",kind:"disclosure",indicator:!0,contentRenderer:"tableStyleGallery",disabled:t,overlayProps:{width:"auto"}},Hn("table-fill"),{value:"table-fill",label:"底纹",icon:"tableCellFill",kind:"custom",renderer:"tableCellFill",disabled:t},{value:"table-background",label:"表格背景",icon:"backgroundStyle",kind:"custom",renderer:"tableCellFill",disabled:t},Hn("table-borders"),{value:"table-border-color",label:"边框颜色",icon:"outlineColor",kind:"custom",renderer:"tableBorderColor",disabled:t},{value:"table-border-width",label:"边框粗细",kind:"custom",renderer:"tableBorderWidth",disabled:t},{value:"table-border-dash",label:"线型",kind:"custom",renderer:"tableBorderDash",disabled:t},{value:"table-border",kind:"split",label:l[1],icon:l[2],disclosureLabel:"选择边框",disabled:t,items:tu.map(([s,o,a])=>({value:`table-border:${s}`,label:o,icon:a}))},{value:"table-draw:draw",label:"绘制边框",tooltip:"绘制边框:在表格上拖过单元格边线即画上当前颜色和粗细的线,Esc 结束",icon:"inkPen",kind:"toggle",pressed:n==="draw",disabled:t},{value:"table-draw:erase",label:"擦除边框",tooltip:"擦除:拖过两个单元格之间的线即合并它们,拖过外框线即去掉线,Esc 结束",icon:"eraser",kind:"toggle",pressed:n==="erase",disabled:t}]}const Em=new WeakMap;function Fm(e){let t=Em.get(e);return t||(t=Q(),Em.set(e,t)),t}function Cn(e,t,n){Tl(e).value={slide:t.slide,shape:t.shape,anchor:{row:n.row,column:n.column},head:{row:n.row+n.rows-1,column:n.column+n.columns-1}}}function uM(e,t,n,l){if(!t.startsWith("table-")||t==="table-style-gallery")return!1;Zt(e,!0);const s=yt(e);if(!s)return!0;const{slide:o,shape:a,range:i,info:r}=s,u=e.session.commands,[c,d]=t.split(":"),p=Ll(e);switch(c){case"table-properties":return Fm(e).value={slide:o,shape:a,range:i},!0;case"table-select":{const f=d==="column"||d==="table"?{row:0,rows:r.rows}:{row:i.row,rows:i.rows},h=d==="row"||d==="table"?{column:0,columns:r.columns}:{column:i.column,columns:i.columns};return Cn(e,s,{...f,...h}),!0}case"table-insert-row":{const f=s.picked?i.rows:1,h=d==="above";return u.insertTableRows({slide:o,shape:a,row:h?i.row:i.row+i.rows-1,count:f,side:h?"above":"below"})&&s.picked&&h&&Cn(e,s,{...i,row:i.row+f}),!0}case"table-insert-column":{const f=s.picked?i.columns:1,h=d==="left";return u.insertTableColumns({slide:o,shape:a,column:h?i.column:i.column+i.columns-1,count:f,side:h?"left":"right"})&&s.picked&&h&&Cn(e,s,{...i,column:i.column+f}),!0}case"table-delete":return d==="table"||d==="rows"&&i.rows>=r.rows||d==="columns"&&i.columns>=r.columns?l.intent("delete-shapes"):d==="rows"&&u.deleteTableRows({slide:o,shape:a,row:i.row,count:i.rows})?Cn(e,s,{row:Math.min(i.row,r.rows-i.rows-1),column:i.column,rows:1,columns:1}):d==="columns"&&u.deleteTableColumns({slide:o,shape:a,column:i.column,count:i.columns})&&Cn(e,s,{row:i.row,column:Math.min(i.column,r.columns-i.columns-1),rows:1,columns:1}),!0;case"table-merge":return u.mergeTableCells({slide:o,shape:a,range:i})&&Cn(e,s,i),!0;case"table-split":{const f=n;return u.splitTableCells({slide:o,shape:a,range:i,...f})&&Cn(e,s,{row:i.row,column:i.column,rows:1,columns:1}),!0}case"table-size":{const f=n;return f?.height!==void 0&&u.setTableRowHeight({slide:o,shape:a,row:i.row,count:i.rows,height:f.height*rt}),f?.width!==void 0&&u.setTableColumnWidth({slide:o,shape:a,column:i.column,count:i.columns,width:f.width*rt}),!0}case"table-distribute-rows":return u.distributeTableRows({slide:o,shape:a,row:i.row,count:i.rows}),!0;case"table-distribute-columns":return u.distributeTableColumns({slide:o,shape:a,column:i.column,count:i.columns}),!0;case"table-align":return u.setTableCellsAlignment({slide:o,shape:a,range:i,align:d}),!0;case"table-align-grid":{const f=n;return f?.align&&f.anchor&&e.session.chain().setTableCellsAlignment({slide:o,shape:a,range:i,align:f.align}).setTableCellsAnchor({slide:o,shape:a,range:i,anchor:f.anchor}).run(),!0}case"table-anchor":return u.setTableCellsAnchor({slide:o,shape:a,range:i,anchor:d}),!0;case"table-margins":{const f=d?Am.find(([h])=>h===d)?.[2]:n;return f&&u.setTableCellsMargins({slide:o,shape:a,range:i,margins:f}),!0}case"table-fill":return u.setTableCellsFill({slide:o,shape:a,range:i,color:typeof n=="string"?n:"none"}),!0;case"table-background":return u.setTableBackground({slide:o,shape:a,color:typeof n=="string"?n:"none"}),!0;case"table-border-color":case"table-border-width":case"table-border-dash":if(c==="table-border-color"&&typeof n=="string")p.value={...p.value,color:n};else if(c==="table-border-width"&&typeof n=="number")p.value={...p.value,width:n};else if(c==="table-border-dash"&&typeof n=="string")p.value={...p.value,dash:n};else return!0;return p.value.preset!=="none"&&u.setTableCellsBorders({slide:o,shape:a,range:i,preset:p.value.preset,pen:{color:p.value.color,width:p.value.width,dash:p.value.dash}}),!0;case"table-draw":{const f=eu(e);return f.value=f.value===d?void 0:d,!0}case"table-calc":return u.calculateTableCells({slide:o,shape:a,range:i,op:d})||e.toaster.create({type:"info",title:"所选单元格中没有数字"}),!0;case"table-style-option":{const f=or(e.session.document.presentation(),o,a),h=d;return f&&h in f.options&&u.setTableStyleOptions({slide:o,shape:a,options:{[h]:!f.options[h]}}),!0}case"table-font-family":return typeof n=="string"&&n&&u.setTableCellsTextFormat({slide:o,shape:a,range:i,format:{font:n}}),!0;case"table-font-size":return typeof n=="number"&&u.setTableCellsTextFormat({slide:o,shape:a,range:i,format:{size:n}}),!0;case"table-bold":return u.setTableCellsTextFormat({slide:o,shape:a,range:i,format:{bold:!r.text.bold}}),!0;case"table-italic":return u.setTableCellsTextFormat({slide:o,shape:a,range:i,format:{italic:!r.text.italic}}),!0;case"table-underline":return u.setTableCellsTextFormat({slide:o,shape:a,range:i,format:{underline:!r.text.underline}}),!0;case"table-strike":return u.setTableCellsTextFormat({slide:o,shape:a,range:i,format:{strike:!r.text.strike}}),!0;case"table-text-color":return u.setTableCellsTextFormat({slide:o,shape:a,range:i,format:{color:typeof n=="string"?n:null}}),!0;case"table-diagonal":return u.setTableCellsDiagonals({slide:o,shape:a,range:i,down:d==="down"||d==="both",up:d==="up"||d==="both",pen:{color:p.value.color,width:p.value.width,dash:p.value.dash}}),!0;case"table-direction":return u.setTableCellsTextDirection({slide:o,shape:a,range:i,direction:d}),!0;case"table-paste":return typeof n=="string"?nu(e,s,n):iS().then(({html:f,text:h})=>{(!f||!aS(e,s,f,l.ownerDocument))&&nu(e,s,h)},()=>{}),!0;case"table-border":{const f=d??p.value.preset;return p.value={...p.value,preset:f},u.setTableCellsBorders({slide:o,shape:a,range:i,preset:f,pen:{color:p.value.color,width:p.value.width,dash:p.value.dash}}),!0}default:return!1}}function nu(e,t,n){const l=dp(n),{slide:s,shape:o,range:a,info:i}=t;if(l.length===0||!e.session.commands.setTableCellsText({slide:s,shape:o,row:a.row,column:a.column,texts:l}))return!1;const r=Math.max(...l.map(u=>u.length));return Cn(e,t,{row:a.row,column:a.column,rows:Math.min(l.length,i.rows-a.row),columns:Math.min(r,i.columns-a.column)}),!0}function cM(e,t){const{target:n,picked:l,picking:s,editing:o,pick:a,edit:i}=t,r=(d,p)=>{d.preventDefault(),p()};return{onKey:d=>{const p=n.value,f=l.value;if(!p?.picked||!f||!s.value||o.value||d.defaultPrevented||!d.target?.closest?.(".pptx-stage"))return;if((d.metaKey||d.ctrlKey)&&!d.altKey&&!d.shiftKey&&d.key.toLowerCase()==="v"){d.stopPropagation();return}if(d.metaKey||d.ctrlKey||d.altKey)return;const h={row:p.range.row,column:p.range.column};if(d.key==="Delete"||d.key==="Backspace")r(d,()=>e.session.commands.clearTableCells({slide:p.slide,shape:p.shape,range:p.range}));else if(d.key==="Escape")r(d,()=>{l.value=void 0});else if(d.key==="Enter"||d.key==="F2")r(d,()=>{i(h)});else if(d.key.length===1||d.key==="Process")r(d,()=>{i(h,{replaceWith:d.key.length===1?d.key:""})});else{const v={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]}[d.key];if(!v)return;r(d,()=>{const g={row:Math.min(p.info.rows-1,Math.max(0,f.head.row+v[0])),column:Math.min(p.info.columns-1,Math.max(0,f.head.column+v[1]))};a(d.shiftKey?f.anchor:g,g)})}},onPaste:d=>{const p=n.value,f=d.clipboardData?.getData("text/plain")??"",h=d.clipboardData?.getData("text/html")??"",v=d.target;!p?.picked||!s.value||o.value||!f&&!h||!v?.closest?.(".pptx-stage")||(d.preventDefault(),(!h||!Xf(e,h,v.ownerDocument))&&nu(e,p,f))}}}const dM=".pptx-command-bar, .pptx-selection-toolbar, .pptx-inspector, [data-scope], [role='menu'], [role='listbox'], [role='dialog']";function pM(e,t,n){const l=Tl(e),s=Zo(e),o=F(()=>yt(e)),a=F(()=>o.value!==void 0&&e.armedShape.value===void 0&&e.painter.value===void 0&&e.pointEditing.value===void 0&&(e.textEditor.value===void 0||s.value!==void 0)),i=()=>t.value?.closest(".pptx-slide-frame")?.querySelector(".pptx-slide-art")??null,r=z=>{const D=t.value.getBoundingClientRect();return{x:(z.clientX-D.left)/n(),y:(z.clientY-D.top)/n()}},u=z=>{const D=Ot(e);return D&&o.value&&t.value&&n()>0?k$(o.value.info,D.box,r(z)):void 0},c=z=>{const D=Ot(e)?.box;if(!D||!t.value)return!1;const P=r(z),I=6/n();return P.x>D.x+I&&P.y>D.y+I&&P.x<D.x+D.width-I&&P.y<D.y+D.height-I},d=(z,D)=>{o.value&&(l.value={slide:o.value.slide,shape:o.value.shape,anchor:z,head:D})};async function p(z,D={}){const P=o.value,I=i();!P||!I||(d(z,z),await J$(e,P.slide,P.shape,{art:I,cell:z,...D},f))}function f(z){if(z.key!=="Tab"||z.metaKey||z.ctrlKey||z.altKey)return!1;const D=s.value;return D&&h(D.cell,z.shiftKey?-1:1),!0}async function h(z,D){Zt(e,!0);const P=o.value;if(!P)return;const{rows:I,columns:K,merges:G}=P.info,ee=(W,te)=>G.some(he=>W>=he.row&&W<he.row+he.rows&&te>=he.column&&te<he.column+he.columns&&(W!==he.row||te!==he.column));for(let W=z.row*K+z.column+D;W>=0&&W<I*K;W+=D){const te={row:Math.floor(W/K),column:W%K};if(!ee(te.row,te.column)){await pt(),await p(te);return}}D===1&&e.session.commands.insertTableRows({slide:P.slide,shape:P.shape,row:I-1,count:1,side:"below"})&&(await pt(),await p({row:I,column:0}))}let v;function g(z){const D=u(z);if(!D)return;const P=l.value,I=z.shiftKey&&P!==void 0&&P.shape===o.value?.shape;d(I?P.anchor:D,D),v={start:D,moved:I};const K={x:z.clientX,y:z.clientY},G=W=>{const te=u(W),he=l.value;!te||!he||!v||((te.row!==v.start.row||te.column!==v.start.column)&&(v.moved=!0),(te.row!==he.head.row||te.column!==he.head.column)&&d(he.anchor,te))},ee=()=>{window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",ee);const W=v;v=void 0,W&&!W.moved&&p(W.start,{at:K})};window.addEventListener("pointermove",G),window.addEventListener("pointerup",ee)}function $(z){z.button===0&&(z.stopPropagation(),z.preventDefault(),g(z))}let b;const w=z=>{const D=z.target,P=s.value;if(b=void 0,!D?.closest(".pptx-table-edge, .pptx-table-draw")){if(P){if(!D||P.mount.contains(D)||D.closest(dM))return;Zt(e,!0),z.button===0&&D.closest(".pptx-slide-frame")&&c(z)&&(z.stopPropagation(),z.preventDefault(),g(z));return}z.button===0&&D?.closest(".pptx-slide-frame")&&!D.closest(".pptx-table-cells")&&(b={x:z.clientX,y:z.clientY})}},S=z=>{const D=b;if(b=void 0,!D||Math.hypot(z.clientX-D.x,z.clientY-D.y)>3||!a.value||s.value||!c(z))return;const P=u(z);P&&p(P,{at:{x:z.clientX,y:z.clientY}})},{onKey:C,onPaste:E}=cM(e,{target:o,picked:l,picking:a,editing:s,pick:d,edit:p});X(()=>[Ot(e)?.box.id,e.current.value?.part],([z])=>{s.value&&s.value.shape!==z&&Zt(e,!0),l.value&&l.value.shape!==z&&(l.value=void 0)});const T=[["paste",E],["pointerdown",w],["pointerup",S],["keydown",C]];return ft(()=>{for(const[z,D]of T)document.addEventListener(z,D,!0)}),Re(()=>{for(const[z,D]of T)document.removeEventListener(z,D,!0);Zt(e,!0)}),{target:o,picking:a,onPointerDown:$}}const fM=6;function mM(e,t,n){const l=eu(e),s=Q([]);function o(c){const d=Ot(e)?.box,p=yt(e)?.info,f=t.value?.getBoundingClientRect();if(!d||!p||!f)return;const h=(c.clientX-f.left)/n()-d.x,v=(c.clientY-f.top)/n()-d.y,g=fM/n(),$=(P,I)=>P.findIndex((K,G)=>G>0&&I<K)-1,b=(P,I)=>P.reduce((K,G,ee)=>Math.abs(G-I)<K.distance?{line:ee,distance:Math.abs(G-I)}:K,{line:-1,distance:Number.POSITIVE_INFINITY}),w=b(p.rowEdges,v),S=b(p.columnEdges,h),C={axis:"row",line:w.line,index:$(p.columnEdges,h)},E={axis:"column",line:S.line,index:$(p.rowEdges,v)},T=[[w.distance,C],[S.distance,E]],[z,D]=T[0][0]<=T[1][0]?T[0]:T[1];return z<=g&&D.index>=0?D:void 0}function a(c){const d=o(c);d&&!s.value.some(p=>p.axis===d.axis&&p.line===d.line&&p.index===d.index)&&(s.value=[...s.value,d])}function i(c){if(c.button!==0)return;c.stopPropagation(),c.preventDefault(),Zt(e,!0),s.value=[],a(c);const d=f=>a(f),p=()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",p);const f=yt(e),h=s.value;if(s.value=[],!f||h.length===0)return;const v=Ll(e).value;l.value==="erase"?e.session.commands.eraseTableEdges({slide:f.slide,shape:f.shape,edges:h}):e.session.commands.setTableEdges({slide:f.slide,shape:f.shape,edges:h,pen:{color:v.color,width:v.width,dash:v.dash}})};window.addEventListener("pointermove",d),window.addEventListener("pointerup",p)}const r=F(()=>{const c=yt(e)?.info;if(!c)return[];const d=n();return s.value.map(p=>p.axis==="row"?{key:`r${p.line}-${p.index}`,x1:c.columnEdges[p.index]*d,y1:c.rowEdges[p.line]*d,x2:c.columnEdges[p.index+1]*d,y2:c.rowEdges[p.line]*d}:{key:`c${p.line}-${p.index}`,x1:c.columnEdges[p.line]*d,y1:c.rowEdges[p.index]*d,x2:c.columnEdges[p.line]*d,y2:c.rowEdges[p.index+1]*d})});X(()=>Ot(e)?.box.id,c=>{c===void 0&&(l.value=void 0)});const u=c=>{c.key==="Escape"&&l.value&&(c.preventDefault(),c.stopPropagation(),l.value=void 0)};return ft(()=>document.addEventListener("keydown",u,!0)),Re(()=>document.removeEventListener("keydown",u,!0)),{mode:l,stroke:s,lines:r,onPointerDown:i}}const zm=72e3;function hM(e,t){const n=Q(),l=F(()=>{const o=yt(e)?.info;return o?[...o.columnEdges.slice(1,-1).map((a,i)=>({axis:"column",index:i+1,offset:a})),...o.rowEdges.slice(1,-1).map((a,i)=>({axis:"row",index:i+1,offset:a}))]:[]});function s(o,a){if(o.button!==0)return;o.stopPropagation(),o.preventDefault(),Zt(e,!0);const i=yt(e);if(!i)return;const r=a.axis==="column"?i.info.columnEdges:i.info.rowEdges,u=r[a.index-1]+zm,c=a.axis==="column"?r[a.index+1]-zm:Number.POSITIVE_INFINITY,d=a.axis==="column"?o.clientX:o.clientY;n.value={edge:a,offset:a.offset};const p=h=>{const v=((a.axis==="column"?h.clientX:h.clientY)-d)/t();n.value={edge:a,offset:Math.min(c,Math.max(u,a.offset+v))}},f=()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",f);const h=n.value?.offset??a.offset;n.value=void 0;const v=h-a.offset;if(Math.abs(v)<1)return;const{slide:g,shape:$}=i,b=r[a.index]-r[a.index-1];if(a.axis==="row"){e.session.commands.setTableRowHeight({slide:g,shape:$,row:a.index-1,count:1,height:b+v});return}const w=r[a.index+1]-r[a.index];e.session.chain().setTableColumnWidth({slide:g,shape:$,column:a.index-1,count:1,width:b+v}).setTableColumnWidth({slide:g,shape:$,column:a.index,count:1,width:w-v}).run()};window.addEventListener("pointermove",p),window.addEventListener("pointerup",f)}return{edges:l,dragging:n,onEdgeDown:s}}const vM=["onPointerdown"],gM={class:"pptx-table-stroke","aria-hidden":"true"},bM=["x1","y1","x2","y2"],la=6,yM=O({__name:"cell-layer",props:{state:{},scale:{}},setup(e){const t=e,n=je("root"),{target:l,picking:s,onPointerDown:o}=pM(t.state,n,()=>t.scale),a=Zo(t.state),{edges:i,dragging:r,onEdgeDown:u}=hM(t.state,()=>t.scale),c=mM(t.state,n,()=>t.scale),d=(h,v)=>h==="column"?{left:`${v*t.scale-la/2}px`,top:"0",bottom:"0",width:`${la}px`}:{top:`${v*t.scale-la/2}px`,left:"0",right:"0",height:`${la}px`},p=F(()=>{const h=Ot(t.state)?.box;if(!h)return;const v=t.scale;return{left:`${h.x*v}px`,top:`${h.y*v}px`,width:`${h.width*v}px`,height:`${h.height*v}px`,transform:h.rotation?`rotate(${h.rotation}deg)`:""}}),f=F(()=>{const h=l.value;if(!h?.picked)return;const{rowEdges:v,columnEdges:g}=h.info,{row:$,column:b,rows:w,columns:S}=h.range,C=t.scale;return{single:h.info.merges.some(E=>E.row===$&&E.column===b&&E.rows===w&&E.columns===S)||w*S===1,style:{left:`${g[b]*C}px`,top:`${v[$]*C}px`,width:`${(g[b+S]-g[b])*C}px`,height:`${(v[$+w]-v[$])*C}px`}}});return(h,v)=>(x(),M("div",{ref_key:"root",ref:n,class:"pptx-table-layer"},[p.value&&m(s)?(x(),M("div",{key:0,class:"pptx-table-frame",style:fe(p.value)},[f.value?(x(),M("div",{key:0,class:Ne(["pptx-table-pick",{"pptx-table-pick-single":f.value.single}]),style:fe(f.value.style)},null,6)):L("v-if",!0),m(a)?L("v-if",!0):(x(),M("div",{key:1,class:"pptx-table-cells",style:fe({inset:`${m(6)}px`}),onPointerdown:v[0]||(v[0]=(...g)=>m(o)&&m(o)(...g))},null,36)),(x(!0),M(U,null,H(m(i),g=>(x(),M("div",{key:`${g.axis}-${g.index}`,class:Ne(["pptx-table-edge",`pptx-table-edge-${g.axis}`]),style:fe(d(g.axis,g.offset)),onPointerdown:$=>m(u)($,g)},null,46,vM))),128)),m(c).mode.value?(x(),M("div",{key:2,class:Ne(["pptx-table-draw",`pptx-table-draw-${m(c).mode.value}`]),onPointerdown:v[1]||(v[1]=(...g)=>m(c).onPointerDown&&m(c).onPointerDown(...g))},[(x(),M("svg",gM,[(x(!0),M(U,null,H(m(c).lines.value,g=>(x(),M("line",{key:g.key,x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2},null,8,bM))),128))]))],34)):L("v-if",!0),m(r)?(x(),M("div",{key:3,class:Ne(["pptx-table-guide",`pptx-table-guide-${m(r).edge.axis}`]),style:fe(d(m(r).edge.axis,m(r).offset))},null,6)):L("v-if",!0)],4)):L("v-if",!0)],512))}}),xM={key:0,class:"pptx-align-grid",role:"grid","aria-label":"对齐方式"},wM=["aria-pressed","aria-label","title","onClick"],kM=O({__name:"align-grid",props:{scope:{}},setup(e){const t=e,n=[["top","顶端"],["center","垂直居中"],["bottom","底端"]],l=[["left","左对齐"],["center","居中"],["right","右对齐"]],s=F(()=>t.scope.context?.target?.info);function o(a,i){t.scope.execute({align:a,anchor:i}),t.scope.setExpanded(!1)}return(a,i)=>e.scope.expanded?(x(),M("div",xM,[(x(),M(U,null,H(n,([r,u])=>k("div",{key:r,role:"row",class:"pptx-align-row"},[(x(),M(U,null,H(l,([c,d])=>k("button",{key:c,type:"button",role:"gridcell",class:Ne(["pptx-align-cell",[`pptx-align-${c}`,`pptx-anchor-${r}`]]),"aria-pressed":s.value?.align===c&&s.value?.anchor===r,"aria-label":`${u}${d}`,title:`${u}${d}`,onClick:p=>o(c,r)},[...i[0]||(i[0]=[k("span",{class:"pptx-align-lines","aria-hidden":"true"},[k("span"),k("span")],-1)])],10,wM)),64))])),64))])):L("v-if",!0)}}),$M={class:"pptx-table-size"},SM=O({__name:"cell-size",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context?.target),l=i=>String(Math.round(i/rt*100)/100),s=F(()=>{const i=n.value;if(!i)return{height:"",width:""};const{rowEdges:r,columnEdges:u}=i.info,{row:c,column:d}=i.range;return{height:l(r[c+1]-r[c]),width:l(u[d+1]-u[d])}}),o=V({...s.value});X(s,i=>{o.value={...i}});function a(i){const r=Number(o.value[i]);if(o.value[i]===s.value[i]||!Number.isFinite(r)||r<.1){o.value={...s.value};return}t.scope.execute({[i]:r})}return(i,r)=>(x(),M("div",$M,[y(m(Fn),{label:"行高(厘米)",disabled:e.scope.disabled,width:"76px"},{default:A(({size:u})=>[y(m(de),{modelValue:o.value.height,"onUpdate:modelValue":r[0]||(r[0]=c=>o.value.height=c),label:"行高(厘米)",size:u,disabled:e.scope.disabled,min:.1,step:.1,width:"76px",onBlur:r[1]||(r[1]=c=>a("height")),onKeydown:r[2]||(r[2]=ue(c=>a("height"),["enter"]))},null,8,["modelValue","size","disabled"])]),_:1},8,["disabled"]),r[6]||(r[6]=k("span",{class:"pptx-table-size-times text-qk-text-tertiary","aria-hidden":"true"},"×",-1)),y(m(Fn),{label:"列宽(厘米)",disabled:e.scope.disabled,width:"76px"},{default:A(({size:u})=>[y(m(de),{modelValue:o.value.width,"onUpdate:modelValue":r[3]||(r[3]=c=>o.value.width=c),label:"列宽(厘米)",size:u,disabled:e.scope.disabled,min:.1,step:.1,width:"76px",onBlur:r[4]||(r[4]=c=>a("width")),onKeydown:r[5]||(r[5]=ue(c=>a("width"),["enter"]))},null,8,["modelValue","size","disabled"])]),_:1},8,["disabled"])]))}}),CM=O({__name:"border-dash",props:{scope:{}},setup(e){const t=e,n=[["solid","实线"],["sysDot","圆点"],["sysDash","方点"],["dash","短划线"],["lgDash","长划线"],["dashDot","点划线"]].map(([a,i])=>({value:a,label:i})),l=F(()=>t.scope.context),s=F(()=>l.value?Ll(l.value.state).value.dash:"solid");function o(a){typeof a=="string"&&t.scope.execute(a),t.scope.setExpanded(!1)}return(a,i)=>(x(),B(m(Fn),{label:"线型",expanded:e.scope.expanded,disabled:e.scope.disabled,width:"88px"},{default:A(({size:r})=>[y(m(ce),{label:"线型",size:r,width:"88px","model-value":s.value,items:m(n),disabled:e.scope.disabled,open:e.scope.expanded,"onUpdate:open":i[0]||(i[0]=u=>e.scope.setExpanded(u===!0)),"onUpdate:modelValue":o},null,8,["size","model-value","items","disabled","open"])]),_:1},8,["expanded","disabled"]))}}),MM=O({__name:"border-width",props:{scope:{}},setup(e){const t=e,n=[.25,.5,.75,1,1.5,2.25,3,4.5,6].map(a=>({value:String(a),label:`${a} 磅`})),l=F(()=>t.scope.context),s=F(()=>l.value?String(Ll(l.value.state).value.width):"1");function o(a){const i=Number(a);Number.isFinite(i)&&i>0&&t.scope.execute(i),t.scope.setExpanded(!1)}return(a,i)=>(x(),B(m(Fn),{label:"边框粗细",expanded:e.scope.expanded,disabled:e.scope.disabled,width:"84px"},{default:A(({size:r})=>[y(m(ce),{label:"边框粗细",size:r,width:"84px","model-value":s.value,items:m(n),disabled:e.scope.disabled,open:e.scope.expanded,"onUpdate:open":i[0]||(i[0]=u=>e.scope.setExpanded(u===!0)),"onUpdate:modelValue":o},null,8,["size","model-value","items","disabled","open"])]),_:1},8,["expanded","disabled"]))}}),PM={key:0,class:"pptx-table-split-note qk-type-body text-qk-text-secondary"},TM={key:1,class:"pptx-table-split-note qk-type-body text-qk-text-secondary"},AM={key:2,class:"pptx-table-split-fields"},EM={class:"pptx-table-split-actions"},FM=O({__name:"split-form",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context?.target),l=F(()=>{const c=n.value;if(!c)return[];const{range:d,info:p}=c;return p.merges.filter(f=>f.row<d.row+d.rows&&d.row<f.row+f.rows&&f.column<d.column+d.columns&&d.column<f.column+f.columns)}),s=F(()=>l.value.length>0),o=F(()=>l.value.length===1?l.value[0]:void 0),a=V("1"),i=V("2");X(()=>t.scope.expanded,c=>{c&&(a.value=String(o.value?.rows??1),i.value=String(o.value?.columns??2))},{immediate:!0});const r=F(()=>{const[c,d]=[Number(a.value),Number(i.value)];return Number.isInteger(c)&&Number.isInteger(d)&&c>=1&&d>=1&&c<=20&&d<=20&&c*d>=2&&(!o.value||o.value.rows%c===0&&o.value.columns%d===0)});function u(){(o.value||!s.value)&&!r.value||(t.scope.execute(s.value&&!o.value?void 0:{rows:Number(a.value),columns:Number(i.value)}),t.scope.setExpanded(!1))}return(c,d)=>e.scope.expanded?(x(),M("form",{key:0,class:"pptx-table-split",onSubmit:J(u,["prevent"])},[s.value&&!o.value?(x(),M("p",PM,"把选中的合并单元格还原为原来的单元格。")):o.value?(x(),M("p",TM,"这个合并单元格占 "+N(o.value.rows)+" 行 "+N(o.value.columns)+" 列,拆分的行列数要能整除它。",1)):L("v-if",!0),!s.value||o.value?(x(),M("div",AM,[y(m(re),{label:"列数"},{default:A(({controlProps:p})=>[y(m(de),ie(p,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=f=>i.value=f),label:"列数",min:1,max:20,step:1}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"行数"},{default:A(({controlProps:p})=>[y(m(de),ie(p,{modelValue:a.value,"onUpdate:modelValue":d[1]||(d[1]=f=>a.value=f),label:"行数",min:1,max:20,step:1}),null,16,["modelValue"])]),_:1})])):L("v-if",!0),k("div",EM,[y(m(q),{size:"sm",variant:"ghost",onClick:d[2]||(d[2]=p=>e.scope.setExpanded(!1))},{default:A(()=>[...d[3]||(d[3]=[R("取消",-1)])]),_:1}),y(m(q),{size:"sm",type:"submit",color:"primary",variant:"solid",disabled:(o.value||!s.value)&&!r.value},{default:A(()=>[...d[4]||(d[4]=[R("拆分",-1)])]),_:1},8,["disabled"])])],32)):L("v-if",!0)}}),Dm=[["bestMatch","最佳匹配"],["light","浅色"],["medium","中等"],["dark","深色"]],sa={width:1371600,height:1028700};let Ut;const Lm=new Map;function zM(e,t,n=Number.POSITIVE_INFINITY){const l=Mt(e),s=JSON.stringify(l),o=JSON.stringify(t),a={};let i=!1;for(const[r]of Dm)for(const u of ni){if(u.category!==r)continue;const c=`${s}|${o}|${u.id}`;let d=Lm.get(c);d===void 0&&performance.now()<n&&(d=DM(l,s,t,u.id),Lm.set(c,d)),d===void 0&&(i=!0),(a[r]??=[]).push({id:u.id,label:LM(u.name),image:d??""})}return{sections:a,pending:i}}function DM(e,t,n,l){Ut??=(()=>{const o=_a();wo(o,{width:j(sa.width),height:j(sa.height)});const a=pe(o)[0],i=Array.from({length:5},()=>Array.from({length:5},()=>""));return{deck:o,table:oi(a,{x:j(0),y:j(0),w:j(sa.width),h:j(sa.height),rows:i}),theme:"",options:""}})(),Ut.theme!==t&&(e&&gl(Ut.deck,e),Ut.theme=t);const s=JSON.stringify(n);return Ut.options!==s&&(is(Ut.table,n),Ut.options=s),Mo(Ut.table,l),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Wt(Ut.deck,pe(Ut.deck)[0]))}`}function LM(e){return e==="No Style, No Grid"?"无样式,无网格":e==="No Style, Table Grid"?"无样式,网格型":e.replace(/^Themed Style/u,"主题样式").replace(/^Light Style/u,"浅色样式").replace(/^Medium Style/u,"中度样式").replace(/^Dark Style/u,"深色样式").replace(/ - Accent (\d)$/u," - 强调 $1")}const Vm=8;function VM(e,t){const n=Q({});let l;function s(o=Vm){l?.(),l=void 0;const a=t();if(!a){n.value={};return}const i=zM(e.session.document.presentation(),a,performance.now()+o);n.value=i.sections,i.pending&&(l=IM(r=>s(Math.max(Vm,r))))}return X(()=>{e.tick.value;const o=t();return o?`${e.session.document.version()}|${JSON.stringify(o)}`:""},()=>s(0),{immediate:!0}),Za(()=>l?.()),n}function IM(e){if(typeof requestIdleCallback=="function"){const n=requestIdleCallback(l=>e(l.timeRemaining()),{timeout:200});return()=>cancelIdleCallback(n)}const t=setTimeout(()=>e(0),0);return()=>clearTimeout(t)}const BM={key:0,class:"pptx-property-section","aria-label":"表格样式"},OM={class:"pptx-table-options"},UM={class:"pptx-table-style-actions"},NM={class:"pptx-table-styles"},RM=["src"],jM={key:1,class:"pptx-table-style-image pptx-table-style-pending"},Im=O({__name:"table-style",props:{state:{},shape:{}},setup(e){const t=e,n=[["firstRow","标题行"],["firstCol","第一列"],["lastRow","汇总行"],["lastCol","最后一列"],["bandRow","镶边行"],["bandCol","镶边列"]],l=F(()=>{t.state.tick.value;const r=t.state.current.value?.part;return r?or(t.state.session.document.presentation(),r,t.shape):null}),s=VM(t.state,()=>l.value?.options),o=V(!1);function a(r){const u=t.state.current.value?.part;if(!u)return;const c=ar(t.state.session.document.presentation(),u,t.shape),d=t.state.session.chain().setTableStyle({slide:u,shape:t.shape,style:r});o.value&&c&&d.clearTableCellsFormat({slide:u,shape:t.shape,range:{row:0,column:0,rows:c.rows,columns:c.columns}}),d.run()}function i(r,u){const c=t.state.current.value?.part;c&&t.state.session.commands.setTableStyleOptions({slide:c,shape:t.shape,options:{[r]:u===!0}})}return(r,u)=>l.value?(x(),M("section",BM,[u[4]||(u[4]=k("div",{class:"pptx-section-label"},[k("span",null,"表格样式选项")],-1)),k("div",OM,[(x(),M(U,null,H(n,([c,d])=>y(m(Ce),{key:c,label:d,checked:l.value.options[c],"onUpdate:checked":p=>i(c,p)},null,8,["label","checked","onUpdate:checked"])),64))]),u[5]||(u[5]=k("div",{class:"pptx-section-label"},[k("span",null,"表格样式")],-1)),k("div",UM,[y(m(Ce),{label:"套用时清除手动设置的底纹和边框",checked:o.value,"onUpdate:checked":u[0]||(u[0]=c=>o.value=c===!0)},null,8,["checked"]),y(m(q),{size:"sm",variant:"ghost",onClick:u[1]||(u[1]=c=>a(m("{2D5ABB26-0587-4C30-8999-92F81FD0307C}")))},{default:A(()=>[...u[3]||(u[3]=[R("清除表格样式",-1)])]),_:1})]),k("div",NM,[(x(!0),M(U,null,H(m(Dm),([c,d])=>(x(),B(m(Ja),{key:c,label:d,presentation:"icons","max-columns":4,"min-item-width":"48px",items:(m(s)[c]??[]).map(p=>({value:p.id,label:p.label,data:{image:p.image}})),"model-value":l.value.style,"onUpdate:modelValue":u[2]||(u[2]=p=>p&&a(p))},{preview:A(({item:p})=>[p.data?.image?(x(),M("img",{key:0,class:"pptx-table-style-image",src:String(p.data.image),alt:"",draggable:"false"},null,8,RM)):(x(),M("span",jM))]),_:1},8,["label","items","model-value"]))),128))])])):L("v-if",!0)}}),KM={key:0,class:"pptx-table-style-popup"},WM=O({__name:"style-gallery",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context);return(l,s)=>e.scope.expanded&&n.value?.target?(x(),M("div",KM,[y(Im,{state:n.value.state,shape:n.value.target.shape},null,8,["state","shape"])])):L("v-if",!0)}}),Bm=O({__name:"table-color",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context),l=F(()=>t.scope.item.value==="table-background"),s=F(()=>t.scope.item.value==="table-fill"||l.value),o=V("#FFC000"),a=V([]),i=V(),r=F(()=>{if(!s.value)return n.value?Ll(n.value.state).value.color:"#000000";const d=n.value?.target?.info,p=l.value?d?.background:d?.fill;return p&&/^#[\da-f]{6}$/iu.test(p)?p:o.value});X(()=>t.scope.expanded,()=>{i.value=void 0});const u=F(()=>({...t.scope,item:{...t.scope.item,iconAccentColor:s.value?o.value:r.value}}));function c(d){d!==null&&!/^#[\da-f]{6}$/iu.test(d)||(t.scope.setExpanded(!1),t.scope.execute(d),d!==null&&(s.value&&(o.value=d),a.value=[d,...a.value.filter(p=>p!==d)].slice(0,8)))}return(d,p)=>(x(),B(m(Po),{scope:u.value,"disclosure-label":l.value?"选择表格背景颜色":s.value?"选择底纹颜色":"选择边框颜色",color:i.value??r.value,"reset-active":s.value&&(l.value?n.value?.target?.info.background:n.value?.target?.info.fill)==="none","recent-colors":a.value,"picker-props":s.value?{resetLabel:"无填充",showMore:!0}:{allowReset:!1,showMore:!0},onAction:p[0]||(p[0]=f=>c(s.value?o.value:r.value)),onPreview:p[1]||(p[1]=f=>i.value=f),onCommit:c,onReset:p[2]||(p[2]=f=>c(null))},null,8,["scope","disclosure-label","color","reset-active","recent-colors","picker-props"]))}}),qM={"aria-label":"大小与位置"},_M={class:"pptx-table-properties-grid"},GM={"aria-label":"单元格"},HM={class:"pptx-table-properties-grid"},QM={"aria-label":"替换文字"},XM=O({__name:"properties-dialog",props:{state:{}},setup(e){const t=e,n=Fm(t.state),l=r=>String(Math.round(r/rt*100)/100),s=V({x:"0",y:"0",width:"0",height:"0",top:"0",bottom:"0",left:"0",right:"0",anchor:"top",title:"",description:""});let o={...s.value};X(n,r=>{if(!r)return;const u=t.state.session.document.presentation(),c=De(u,r.slide,r.shape),d=ar(u,r.slide,r.shape,r.range),p=c?tt(c):null;if(!c||!d||!p){n.value=void 0;return}s.value={x:l(p.x),y:l(p.y),width:l(p.w),height:l(p.h),top:l(d.margins.top??0),bottom:l(d.margins.bottom??0),left:l(d.margins.left??0),right:l(d.margins.right??0),anchor:d.anchor??"top",title:to(c)??"",description:Ec(c)??""},o={...s.value}});const a=(...r)=>r.some(u=>s.value[u]!==o[u]);function i(){const r=n.value;if(!r)return;const{slide:u,shape:c,range:d}=r,p=s.value,[f,h,v,g,$,b,w,S]=[p.x,p.y,p.width,p.height,p.top,p.bottom,p.left,p.right].map(Number);let C=t.state.session.chain();a("x","y","width","height")&&[f,h].every(Number.isFinite)&&v>0&&g>0&&(C=C.setTableFrame({slide:u,shape:c,x:be(f),y:be(h),width:be(v),height:be(g)})),a("top","bottom","left","right")&&[$,b,w,S].every(E=>E>=0)&&(C=C.setTableCellsMargins({slide:u,shape:c,range:d,margins:{top:be($),bottom:be(b),left:be(w),right:be(S)}})),a("anchor")&&(C=C.setTableCellsAnchor({slide:u,shape:c,range:d,anchor:p.anchor})),a("title","description")&&(C=C.setShapeAltText({slide:u,shapes:[c],title:p.title.trim()||null,description:p.description.trim()||null})),a(...Object.keys(o))&&C.run(),n.value=void 0}return(r,u)=>(x(),B(m(Ae),{open:m(n)!==void 0,"onUpdate:open":u[12]||(u[12]=c=>c||(n.value=void 0))},{default:A(()=>[y(m(Te),{title:"表格属性",size:"medium",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:u[11]||(u[11]=c=>n.value=void 0)},{default:A(()=>[...u[16]||(u[16]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",onClick:i},{default:A(()=>[...u[17]||(u[17]=[R("确定",-1)])]),_:1})]),default:A(()=>[k("div",{class:"pptx-table-properties",onKeydown:ue(i,["enter"])},[k("section",qM,[u[13]||(u[13]=k("div",{class:"pptx-section-label"},[k("span",null,"大小与位置"),k("span",{class:"text-qk-text-tertiary"},"厘米")],-1)),k("div",_M,[y(m(re),{label:"宽度"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"宽度",modelValue:s.value.width,"onUpdate:modelValue":u[0]||(u[0]=d=>s.value.width=d),min:.1,step:.1}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"高度"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"高度",modelValue:s.value.height,"onUpdate:modelValue":u[1]||(u[1]=d=>s.value.height=d),min:.1,step:.1}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"水平位置"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"水平位置",modelValue:s.value.x,"onUpdate:modelValue":u[2]||(u[2]=d=>s.value.x=d),step:.1}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"垂直位置"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"垂直位置",modelValue:s.value.y,"onUpdate:modelValue":u[3]||(u[3]=d=>s.value.y=d),step:.1}),null,16,["modelValue"])]),_:1})])]),k("section",GM,[u[14]||(u[14]=k("div",{class:"pptx-section-label"},[k("span",null,"单元格边距"),k("span",{class:"text-qk-text-tertiary"},"厘米")],-1)),k("div",HM,[y(m(re),{label:"上"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"上",modelValue:s.value.top,"onUpdate:modelValue":u[4]||(u[4]=d=>s.value.top=d),min:0,step:.05}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"下"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"下",modelValue:s.value.bottom,"onUpdate:modelValue":u[5]||(u[5]=d=>s.value.bottom=d),min:0,step:.05}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"左"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"左",modelValue:s.value.left,"onUpdate:modelValue":u[6]||(u[6]=d=>s.value.left=d),min:0,step:.05}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"右"},{default:A(({controlProps:c})=>[y(m(de),ie(c,{label:"右",modelValue:s.value.right,"onUpdate:modelValue":u[7]||(u[7]=d=>s.value.right=d),min:0,step:.05}),null,16,["modelValue"])]),_:1})]),y(m(Ke),{modelValue:s.value.anchor,"onUpdate:modelValue":u[8]||(u[8]=c=>s.value.anchor=c),label:"垂直对齐",orientation:"horizontal",items:[{value:"top",label:"顶端"},{value:"center",label:"居中"},{value:"bottom",label:"底端"}]},null,8,["modelValue"])]),k("section",QM,[u[15]||(u[15]=k("div",{class:"pptx-section-label"},[k("span",null,"替换文字")],-1)),y(m(Oe),{modelValue:s.value.title,"onUpdate:modelValue":u[9]||(u[9]=c=>s.value.title=c),"aria-label":"替换文字标题",placeholder:"标题"},null,8,["modelValue"]),y(m(Ct),{modelValue:s.value.description,"onUpdate:modelValue":u[10]||(u[10]=c=>s.value.description=c),width:"100%","aria-label":"替换文字说明",rows:2,"auto-resize":"",placeholder:"说明表格的内容,屏幕阅读器会读出它"},null,8,["modelValue"])])],32)]),_:1})]),_:1},8,["open"]))}}),Om=e=>{const t=yt(e);return{state:e,target:t,size:t?.info.text.size??null,font:t?.info.text.font??null,color:t?.info.text.color??null}},ZM={id:"table",tabs:[{value:"table-tools",label:"表格工具",order:100,contextual:e=>Ot(e)!==void 0,entries:iM,context:Om},{value:"table-style",label:"表格样式",order:101,contextual:e=>Ot(e)!==void 0,entries:rM,context:Om}],renderers:{tableAlignGrid:kM,tableCellSize:SM,tableSplit:FM,tableCellFill:Bm,tableBorderColor:Bm,tableBorderWidth:MM,tableBorderDash:CM,tableStyleGallery:WM},overlays:[XM],intent:uM,inspector:[{kinds:["table"],component:M$}],stageLayers:[yM]};function Um(e){return e.selected.value.length!==1?!1:e.boxes.value.find(t=>t.id===e.selected.value[0])?.kind==="chart"}let Vl;function Nm(e,t,n){const{document:l}=e.session,s=l.presentation(),o=l.version(),a=`${t}|${n}`;if(Vl&&Vl.presentation===s&&Vl.version===o&&Vl.key===a)return Vl.info;const i=hr(s,t,n);return Vl={presentation:s,version:o,key:a,info:i},i}function lu(e){e.tick.value;const t=e.current.value?.part;if(!t||!Um(e))return;const n=e.selected.value[0],l=e.session.document.presentation(),s=Nm(e,t,n);return s?{slide:t,shape:n,info:s,accents:mr(l)}:void 0}function Ps(e,t){return F(()=>{e.tick.value;const n=e.current.value?.part,l=n?Nm(e,n,t()):null;return n&&l?.editable?{slide:n,shape:t(),info:l}:void 0})}const YM={key:0,class:"pptx-property-section","aria-label":"图表标题"},JM=O({__name:"titles",props:{state:{},shape:{}},setup(e){const t=e,n=Ps(t.state,()=>t.shape),l=[["title","图表标题"],["categoryAxisTitle","横坐标轴标题"],["valueAxisTitle","纵坐标轴标题"]],s=V({title:"",categoryAxisTitle:"",valueAxisTitle:""});X(()=>n.value?.info.texts,a=>{a&&(s.value={...a})},{immediate:!0});function o(a){const i=n.value,r=s.value[a].trim();!i||r===i.info.texts[a]||t.state.session.commands.setChartElements({slide:i.slide,shape:i.shape,elements:{[a]:r===""?null:r}})}return(a,i)=>m(n)?(x(),M("section",YM,[i[0]||(i[0]=k("div",{class:"pptx-section-label"},[k("span",null,"标题"),k("span",{class:"text-qk-text-tertiary"},"留空即不显示")],-1)),(x(),M(U,null,H(l,([r,u])=>(x(),M(U,{key:r},[r==="title"||m(n).info.axes?(x(),B(m(re),{key:0,label:u},{default:A(({controlProps:c})=>[y(m(Oe),ie({ref_for:!0},c,{modelValue:s.value[r],"onUpdate:modelValue":d=>s.value[r]=d,size:"sm",maxlength:200,onBlur:d=>o(r),onKeydown:ue(d=>o(r),["enter"])}),null,16,["modelValue","onUpdate:modelValue","onBlur","onKeydown"])]),_:2},1032,["label"])):L("v-if",!0)],64))),64))])):L("v-if",!0)}});function lt(e){const t=/^#?([\da-f]{6})(?:[\da-f]{2})?$/iu.exec(e??"");return t?`#${t[1].toUpperCase()}`:null}const e8={key:0,class:"pptx-property-section","aria-label":"数据系列格式"},t8={class:"pptx-property-row"},n8=O({__name:"series",props:{state:{},shape:{}},setup(e){const t=e,n=Ps(t.state,()=>t.shape),l=V("");X(()=>t.shape,()=>{l.value=""});const s=F(()=>n.value?.info.seriesFormats.map((v,g)=>({value:v.name,label:v.name||`系列 ${g+1}`}))??[]),o=F(()=>Math.max(0,n.value?.info.seriesFormats.findIndex(v=>v.name===l.value)??0)),a=F(()=>n.value?.info.seriesFormats[o.value]),i=F(()=>["column","line","area"].includes(n.value?.info.kind??"")),r=[{value:"column",label:"柱形"},{value:"line",label:"折线"},{value:"area",label:"面积"}],u=F(()=>n.value?.info.kind==="pie"||n.value?.info.kind==="doughnut"),c=F(()=>a.value?.chartKind==="line"||["scatter","radar"].includes(n.value?.info.kind??"")),d=[{value:"none",label:"无"},{value:"linear",label:"线性"},{value:"exp",label:"指数"},{value:"log",label:"对数"},{value:"movingAvg",label:"移动平均"}],p=Array.from({length:9},(v,g)=>({value:String(g+2),label:`${g+2} 个点`}));function f(v){const g=n.value;!g||!a.value||(l.value=a.value.name,t.state.session.commands.setChartSeriesFormat({slide:g.slide,shape:g.shape,series:o.value,format:v}))}function h(v){const g=lt(v);g&&f({color:g})}return(v,g)=>m(n)&&a.value&&!u.value?(x(),M("section",e8,[g[8]||(g[8]=k("div",{class:"pptx-section-label"},[k("span",null,"数据系列")],-1)),y(m(re),{label:"系列"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"系列","model-value":a.value.name,items:s.value,"onUpdate:modelValue":g[0]||(g[0]=b=>b!=null&&(l.value=String(b)))}),null,16,["model-value","items"])]),_:1}),k("div",t8,[g[7]||(g[7]=k("span",null,"颜色",-1)),y(m(an),{label:"系列颜色","model-value":a.value.color??"#4472C4","allow-reset":!1,"show-alpha":!1,onCommit:h},null,8,["model-value"])]),i.value?(x(),M(U,{key:0},[y(m(re),{label:"系列图表类型"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"系列图表类型","model-value":a.value.chartKind,items:r,"onUpdate:modelValue":g[1]||(g[1]=b=>b&&f({chartKind:b}))}),null,16,["model-value"])]),_:1}),y(m(En),{checked:a.value.secondaryAxis,label:"次坐标轴","onUpdate:checked":g[2]||(g[2]=$=>f({secondaryAxis:$===!0}))},null,8,["checked"])],64)):L("v-if",!0),c.value?(x(),M(U,{key:1},[y(m(En),{checked:a.value.smooth,label:"平滑线","onUpdate:checked":g[3]||(g[3]=$=>f({smooth:$===!0}))},null,8,["checked"]),y(m(En),{checked:a.value.markers,label:"数据标记","onUpdate:checked":g[4]||(g[4]=$=>f({markers:$===!0}))},null,8,["checked"])],64)):L("v-if",!0),m(kp).has(m(n).info.kind)?(x(),B(m(re),{key:2,label:"趋势线"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"趋势线","model-value":a.value.trendline??"none",items:d,"onUpdate:modelValue":g[5]||(g[5]=b=>b&&f({trendline:b==="none"?null:b}))}),null,16,["model-value"])]),_:1})):L("v-if",!0),a.value.trendline==="movingAvg"?(x(),B(m(re),{key:3,label:"移动平均周期"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"移动平均周期","model-value":String(a.value.trendPeriod??2),items:m(p),"onUpdate:modelValue":g[6]||(g[6]=b=>b&&f({trendPeriod:Number(b)}))}),null,16,["model-value","items"])]),_:1})):L("v-if",!0)])):L("v-if",!0)}}),l8={key:0,class:"pptx-property-section","aria-label":"坐标轴与标签"},s8={class:"pptx-property-grid"},o8={class:"pptx-property-grid"},a8={class:"pptx-property-grid"},i8={class:"pptx-property-grid"},r8=O({__name:"axis",props:{state:{},shape:{}},setup(e){const t=e,n=Ps(t.state,()=>t.shape),l=F(()=>n.value?.info.kind==="column"||n.value?.info.kind==="bar"),s=[{value:"auto",label:"常规"},{value:"0",label:"整数"},{value:"0.0",label:"一位小数"},{value:"0.00",label:"两位小数"},{value:"#,##0",label:"千位分隔"},{value:"0%",label:"百分比"}],o=[["min","最小值"],["max","最大值"],["majorUnit","主要单位"]],a=[["none","无"],["hundreds","百"],["thousands","千"],["tenThousands","万"],["hundredThousands","十万"],["millions","百万"],["tenMillions","千万"],["hundredMillions","亿"],["billions","十亿"]].map(([v,g])=>({value:v,label:g})),i=[{value:"none",label:"无"},{value:"in",label:"内部"},{value:"out",label:"外部"},{value:"cross",label:"交叉"}],r=[{value:"auto",label:"自动"},...[1,2,3,4,5].map(v=>({value:String(v),label:v===1?"每个标签":`每 ${v} 个`}))],u=[{value:"auto",label:"自动"},{value:"0",label:"水平"},{value:"-45",label:"斜 45°"},{value:"-90",label:"竖直"}],c=F(()=>n.value?.info.kind!=="scatter"),d=V({min:"",max:"",majorUnit:"",gapWidth:"",overlap:""});X(()=>n.value?.info,v=>{if(!v)return;const g=v.valueAxisScaling;d.value={min:g.min===void 0?"":String(g.min),max:g.max===void 0?"":String(g.max),majorUnit:g.majorUnit===void 0?"":String(g.majorUnit),gapWidth:v.gapWidth===null?"":String(v.gapWidth),overlap:v.overlap===null?"":String(v.overlap)}},{immediate:!0});function p(v){const g=n.value;g&&t.state.session.commands.setChartOptions({slide:g.slide,shape:g.shape,options:v})}function f(v){const g=d.value[v].trim(),$=n.value?.info.valueAxisScaling[v];(g===""?$===void 0:Number(g)===$)||p({valueAxis:{[v]:g===""?null:Number(g)}})}function h(v){const g=Number(d.value[v]);d.value[v].trim()!==""&&Number.isFinite(g)&&g!==n.value?.info[v]&&p({[v]:g})}return(v,g)=>m(n)&&m(n).info.axes?(x(),M("section",l8,[m(n).info.axes?(x(),M(U,{key:0},[g[12]||(g[12]=k("div",{class:"pptx-section-label"},[k("span",null,"纵坐标轴"),k("span",{class:"text-qk-text-tertiary"},"留空为自动")],-1)),k("div",s8,[(x(),M(U,null,H(o,([$,b])=>y(m(re),{key:$,label:b},{default:A(({controlProps:w})=>[y(m(de),ie({ref_for:!0},w,{modelValue:d.value[$],"onUpdate:modelValue":S=>d.value[$]=S,label:b,onBlur:S=>f($),onKeydown:ue(S=>f($),["enter"])}),null,16,["modelValue","onUpdate:modelValue","label","onBlur","onKeydown"])]),_:2},1032,["label"])),64)),y(m(re),{label:"数字格式"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"数字格式","model-value":m(n).info.valueAxisScaling.numberFormat??"auto",items:s,"onUpdate:modelValue":g[0]||(g[0]=b=>b&&p({valueAxis:{numberFormat:b==="auto"?null:String(b)}}))}),null,16,["model-value"])]),_:1})]),k("div",o8,[y(m(re),{label:"显示单位"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"显示单位","model-value":m(n).info.valueAxisScaling.displayUnits??"none",items:m(a),"onUpdate:modelValue":g[1]||(g[1]=b=>b&&p({valueAxis:{displayUnits:b==="none"?null:b}}))}),null,16,["model-value","items"])]),_:1}),y(m(re),{label:"刻度线"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"纵坐标轴刻度线","model-value":m(n).info.axisFormat.valueTickMark??"out",items:i,"onUpdate:modelValue":g[2]||(g[2]=b=>b&&p({valueTickMark:b}))}),null,16,["model-value"])]),_:1})])],64)):L("v-if",!0),m(n).info.axes?(x(),M(U,{key:1},[g[13]||(g[13]=k("div",{class:"pptx-section-label"},[k("span",null,"横坐标轴")],-1)),k("div",a8,[y(m(re),{label:"刻度线"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"横坐标轴刻度线","model-value":m(n).info.axisFormat.categoryTickMark??"out",items:i,"onUpdate:modelValue":g[3]||(g[3]=b=>b&&p({categoryTickMark:b}))}),null,16,["model-value"])]),_:1}),c.value?(x(),B(m(re),{key:0,label:"标签间隔"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"标签间隔","model-value":m(n).info.axisFormat.labelInterval===null?"auto":String(m(n).info.axisFormat.labelInterval),items:r,"onUpdate:modelValue":g[4]||(g[4]=b=>b&&p({categoryLabelInterval:b==="auto"?null:Number(b)}))}),null,16,["model-value"])]),_:1})):L("v-if",!0),y(m(re),{label:"标签角度"},{default:A(({controlProps:$})=>[y(m(ce),ie($,{label:"标签角度","model-value":m(n).info.axisFormat.labelRotation===null?"auto":String(m(n).info.axisFormat.labelRotation),items:u,"onUpdate:modelValue":g[5]||(g[5]=b=>b&&p({categoryLabelRotation:b==="auto"?null:Number(b)}))}),null,16,["model-value"])]),_:1})])],64)):L("v-if",!0),l.value?(x(),M(U,{key:2},[g[14]||(g[14]=k("div",{class:"pptx-section-label"},[k("span",null,"柱形"),k("span",{class:"text-qk-text-tertiary"},"%")],-1)),k("div",i8,[y(m(re),{label:"间隙宽度"},{default:A(({controlProps:$})=>[y(m(de),ie($,{modelValue:d.value.gapWidth,"onUpdate:modelValue":g[6]||(g[6]=b=>d.value.gapWidth=b),label:"间隙宽度",min:0,max:500,step:10,placeholder:"150",onBlur:g[7]||(g[7]=b=>h("gapWidth")),onKeydown:g[8]||(g[8]=ue(b=>h("gapWidth"),["enter"]))}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"系列重叠"},{default:A(({controlProps:$})=>[y(m(de),ie($,{modelValue:d.value.overlap,"onUpdate:modelValue":g[9]||(g[9]=b=>d.value.overlap=b),label:"系列重叠",min:-100,max:100,step:10,placeholder:"0",onBlur:g[10]||(g[10]=b=>h("overlap")),onKeydown:g[11]||(g[11]=ue(b=>h("overlap"),["enter"]))}),null,16,["modelValue"])]),_:1})])],64)):L("v-if",!0)])):L("v-if",!0)}}),u8={key:0,class:"pptx-property-section","aria-label":"数据标签"},c8={class:"pptx-table-options"},d8={key:1,class:"pptx-property-grid"},p8=O({__name:"labels",props:{state:{},shape:{}},setup(e){const t=e,n=Ps(t.state,()=>t.shape),l=F(()=>n.value?.info.kind==="pie"||n.value?.info.kind==="doughnut"),s=F(()=>[["showValue","值"],["showCategory","类别名称"],["showSeriesName","系列名称"],...l.value?[["showPercent","百分比"]]:[]]),o={ctr:"居中",inEnd:"内侧末端",inBase:"内侧底部",outEnd:"外侧",l:"左侧",r:"右侧",t:"上方",b:"下方",bestFit:"最佳位置"},a=F(()=>(dr[n.value?.info.kind??""]??[]).map(p=>({value:p,label:o[p]??p}))),i=[{value:"auto",label:"与数据相同"},{value:"0",label:"整数"},{value:"0.0",label:"一位小数"},{value:"0.00",label:"两位小数"},{value:"#,##0",label:"千位分隔"},{value:"0%",label:"百分比"}],r=[{value:" ",label:"空格"},{value:", ",label:"逗号"},{value:"; ",label:"分号"},{value:`
|
|
61
|
+
`,label:"换行"}],u=F(()=>n.value?.info.labels),c=F(()=>u.value?s.value.filter(([p])=>u.value[p]).length:0);function d(p){const f=n.value;f&&t.state.session.commands.setChartDataLabels({slide:f.slide,shape:f.shape,labels:p})}return(p,f)=>m(n)&&u.value?(x(),M("section",u8,[f[3]||(f[3]=k("div",{class:"pptx-section-label"},[k("span",null,"数据标签")],-1)),k("div",c8,[(x(!0),M(U,null,H(s.value,([h,v])=>(x(),B(m(Ce),{key:h,label:v,checked:u.value[h],"onUpdate:checked":g=>d({[h]:g===!0})},null,8,["label","checked","onUpdate:checked"]))),128))]),a.value.length>0?(x(),B(m(re),{key:0,label:"标签位置"},{default:A(({controlProps:h})=>[y(m(ce),ie(h,{label:"标签位置","model-value":m(n).info.labelPosition??"",items:a.value,placeholder:"选择后显示数据标签","onUpdate:modelValue":f[0]||(f[0]=v=>v&&d({position:v,...c.value===0?{showValue:!0}:{}}))}),null,16,["model-value","items"])]),_:1})):L("v-if",!0),c.value>0?(x(),M("div",d8,[y(m(re),{label:"数字格式"},{default:A(({controlProps:h})=>[y(m(ce),ie(h,{label:"数字格式","model-value":u.value.numberFormat??"auto",items:i,"onUpdate:modelValue":f[1]||(f[1]=v=>v&&d({numberFormat:v==="auto"?null:String(v)}))}),null,16,["model-value"])]),_:1}),c.value>1?(x(),B(m(re),{key:0,label:"分隔符"},{default:A(({controlProps:h})=>[y(m(ce),ie(h,{label:"分隔符","model-value":u.value.separator??" ",items:r,"onUpdate:modelValue":f[2]||(f[2]=v=>v!=null&&d({separator:String(v)}))}),null,16,["model-value"])]),_:1})):L("v-if",!0)])):L("v-if",!0)])):L("v-if",!0)}}),f8={key:0,class:"pptx-property-section","aria-label":"图表区与绘图区"},m8=O({__name:"areas",props:{state:{},shape:{}},setup(e){const t=e,n=Ps(t.state,()=>t.shape),l=[["chartFill","图表区填充","无填充"],["chartBorder","图表区边框","无边框"],["plotFill","绘图区填充","无填充"],["plotBorder","绘图区边框","无边框"]];function s(o,a){const i=n.value,r=a===null?null:lt(a);i&&(a===null||r)&&t.state.session.commands.setChartOptions({slide:i.slide,shape:i.shape,options:{areas:{[o]:r}}})}return(o,a)=>m(n)?(x(),M("section",f8,[a[0]||(a[0]=k("div",{class:"pptx-section-label"},[k("span",null,"图表区与绘图区")],-1)),(x(),M(U,null,H(l,([i,r,u])=>k("div",{key:i,class:"pptx-property-row"},[k("span",null,N(r),1),y(m(an),{label:r,"model-value":m(n).info.areas[i]??"#FFFFFF","reset-label":u,"reset-active":m(n).info.areas[i]===null,"show-alpha":!1,onCommit:c=>s(i,c),onReset:c=>s(i,null)},null,8,["label","model-value","reset-label","reset-active","onCommit","onReset"])])),64))])):L("v-if",!0)}}),Rm=[["column","柱形图","chartColumn"],["bar","条形图","chartBar"],["line","折线图","chartLine"],["pie","饼图","chartPie"],["doughnut","环形图","chartDoughnut"],["area","面积图","chartArea"],["scatter","散点图","chartScatter"],["radar","雷达图","chartRadar"]],h8=[["r","右侧"],["t","顶部"],["b","底部"],["l","左侧"]],jm=[["title-legend-bottom","标题,图例在底部",{title:"图表标题",legend:"b",dataLabels:!1,categoryAxisTitle:null,valueAxisTitle:null,valueGridlines:!0}],["title-legend-right","标题,图例在右侧",{title:"图表标题",legend:"r",dataLabels:!1,categoryAxisTitle:null,valueAxisTitle:null,valueGridlines:!0}],["title-labels","标题与数据标签,无图例",{title:"图表标题",legend:null,dataLabels:!0,categoryAxisTitle:null,valueAxisTitle:null,valueGridlines:!1}],["axis-titles","标题、坐标轴标题与底部图例",{title:"图表标题",legend:"b",dataLabels:!1,categoryAxisTitle:"坐标轴标题",valueAxisTitle:"坐标轴标题",valueGridlines:!0}],["legend-top","无标题,图例在顶部",{title:null,legend:"t",dataLabels:!1,categoryAxisTitle:null,valueAxisTitle:null,valueGridlines:!0}],["plain","仅图形",{title:null,legend:null,dataLabels:!1,categoryAxisTitle:null,valueAxisTitle:null,valueGridlines:!1,categoryGridlines:!1}]],Tt=(e,t,n,l=!1)=>({value:e,label:t,checked:n,disabled:l});function v8(e){const t=lu(e),n=t?.info,l=!t||!n?.editable,s=t&&!n?.editable?{disabledReason:"这个图表含有无法重写的格式,只能编辑数据。"}:{},o=n?.elements,a=!n?.axes,i=Rm.find(([r])=>r===n?.insertKind);return[...wt(e),{value:"chart-kind",kind:"menu",trigger:"disclosure",label:"更改图表类型",icon:i?.[2]??"chartColumn",disabled:l,...s,items:[{value:"chart-kind-group",label:"图表类型",kind:"radio-group",selectedValue:n?.insertKind?`chart-kind:${n.insertKind}`:void 0,children:Rm.map(([r,u,c])=>({value:`chart-kind:${r}`,label:u,icon:c,...(r==="pie"||r==="doughnut")&&(n?.series??0)>1?{disabled:!0,reason:"饼图和环形图只显示一个系列"}:{}}))}]},{value:"chart-separator-elements",label:"",kind:"separator"},{value:"chart-elements",kind:"menu",trigger:"disclosure",label:"图表元素",icon:"chartElements",disabled:l,...s,items:[Tt("chart-element:title","图表标题",o?.title===!0),Tt("chart-element:dataLabels","数据标签",o?.dataLabels===!0),{value:"chart-legend",label:"图例",kind:"submenu",children:[{value:"chart-legend-group",label:"图例位置",kind:"radio-group",selectedValue:`chart-legend:${o?.legendPosition??"none"}`,children:[{value:"chart-legend:none",label:"无"},...h8.map(([r,u])=>({value:`chart-legend:${r}`,label:u}))]}]},{value:"chart-elements-axes",label:"",kind:"separator"},Tt("chart-element:categoryAxis","横坐标轴",o?.categoryAxis===!0,a),Tt("chart-element:valueAxis","纵坐标轴",o?.valueAxis===!0,a),Tt("chart-element:categoryAxisTitle","横坐标轴标题",o?.categoryAxisTitle===!0,a),Tt("chart-element:valueAxisTitle","纵坐标轴标题",o?.valueAxisTitle===!0,a),{value:"chart-elements-grid",label:"",kind:"separator"},Tt("chart-element:valueGridlines","主要水平网格线",o?.valueGridlines===!0,a),Tt("chart-element:categoryGridlines","主要垂直网格线",o?.categoryGridlines===!0,a),Tt("chart-element:valueMinorGridlines","次要水平网格线",o?.valueMinorGridlines===!0,a),...n?.kind==="line"?[{value:"chart-elements-lines",label:"",kind:"separator"},Tt("chart-element:dropLines","垂直线",o?.dropLines===!0),Tt("chart-element:hiLowLines","高低点连线",o?.hiLowLines===!0)]:[]]},{value:"chart-layout",kind:"menu",trigger:"disclosure",label:"快速布局",icon:"chartQuickLayout",disabled:l,...s,items:jm.map(([r,u])=>({value:`chart-layout:${r}`,label:u}))},{value:"chart-style",label:"图表样式",icon:"shapeStyles",kind:"disclosure",indicator:!0,contentRenderer:"chartStyles",disabled:l||(t?.accents.length??0)===0,...s,overlayProps:{width:"auto"}},{value:"chart-colors",label:"更改颜色",icon:"chartColors",kind:"disclosure",indicator:!0,contentRenderer:"chartColors",disabled:l||(t?.accents.length??0)===0,...s,overlayProps:{width:"auto"}},{value:"chart-select-data",label:"选择数据",icon:"listFilter",disabled:!t||!n?.editable},{value:"chart-switch",label:"切换行列",icon:"chartSwitchRowColumn",disabled:l||a||n?.insertKind==="scatter",...s},{value:"show-panel:properties",label:"设置图表格式",icon:"slidersHorizontal",disabled:!t},{value:"chart-separator-data",label:"",kind:"separator"},{value:"chart-data",label:"编辑数据",icon:"database",disabled:!t||n?.insertKind==="scatter",...n?.insertKind==="scatter"?{disabledReason:"散点图的数据暂不能在这里编辑。"}:{}}]}const Km=new WeakMap;function su(e){let t=Km.get(e);return t||(t=Q(),Km.set(e,t)),t}const Wm=new WeakMap;function qm(e){let t=Wm.get(e);return t||(t=Q(!1),Wm.set(e,t)),t}const _m=new WeakMap;function Gm(e){let t=_m.get(e);return t||(t=Q(),_m.set(e,t)),t}function Hm(e){const t=Number.parseInt(e.slice(1),16);return[t>>16&255,t>>8&255,t&255]}function Ts(e,t,n){const[l,s]=[Hm(e),Hm(t)];return`#${l.map((o,a)=>Math.round(o+(s[a]-o)*n).toString(16).padStart(2,"0")).join("").toUpperCase()}`}function Qm(e){const t=e.filter(l=>/^#[\da-f]{6}$/iu.test(l)).map(l=>l.toUpperCase());if(t.length===0)return[];const n=l=>t.map((s,o)=>t[(o+l)%t.length]);return[{id:"colorful",label:"彩色",colors:t},{id:"colorful-2",label:"彩色(从强调色 2 起)",colors:n(1)},{id:"colorful-3",label:"彩色(从强调色 3 起)",colors:n(2)},...t.map((l,s)=>({id:`mono-${s+1}`,label:`单色:强调色 ${s+1}`,colors:[Ts(l,"#000000",.35),Ts(l,"#000000",.15),l,Ts(l,"#FFFFFF",.3),Ts(l,"#FFFFFF",.55),Ts(l,"#FFFFFF",.75)]}))]}const Xm=[{id:"standard",label:"标准",palette:"colorful",elements:{valueGridlines:!0,categoryGridlines:!1,dataLabels:!1,legend:"b"}},{id:"clean",label:"简洁",palette:"colorful",elements:{valueGridlines:!1,categoryGridlines:!1,dataLabels:!0,legend:null}},{id:"grid",label:"网格",palette:"colorful-2",elements:{valueGridlines:!0,categoryGridlines:!0,dataLabels:!1,legend:"r"}},{id:"labelled",label:"标签",palette:"colorful-3",elements:{valueGridlines:!1,categoryGridlines:!1,dataLabels:!0,legend:"t"}},{id:"mono-1",label:"单色一",palette:"mono-1",elements:{valueGridlines:!0,categoryGridlines:!1,dataLabels:!1,legend:"b"}},{id:"mono-2",label:"单色二",palette:"mono-2",elements:{valueGridlines:!1,categoryGridlines:!1,dataLabels:!0,legend:"b"}},{id:"mono-5",label:"单色三",palette:"mono-5",elements:{valueGridlines:!0,categoryGridlines:!1,dataLabels:!1,legend:"r"}},{id:"mono-6",label:"单色四",palette:"mono-6",elements:{valueGridlines:!1,categoryGridlines:!1,dataLabels:!0,legend:null}}];function Zm(e,t){return Qm(t).find(n=>n.id===e.palette)?.colors??null}const Ym={title:"图表标题",categoryAxisTitle:"坐标轴标题",valueAxisTitle:"坐标轴标题"};function g8(e,t,n){if(t==="chart:insert-dialog")return qm(e).value=!0,!0;if(!t.startsWith("chart-"))return!1;const l=lu(e);if(!l)return!0;const{slide:s,shape:o,info:a}=l,i=e.session.commands,[r,u]=t.split(":");switch(r){case"chart-kind":return u&&i.setChartKind({slide:s,shape:o,kind:u}),!0;case"chart-element":{const c=u;if(!c||!(c in a.elements))return!0;const d=a.elements[c],p=c in Ym?{[c]:d?null:Ym[c]}:c==="legend"?{legend:d?null:"r"}:{[c]:!d};return i.setChartElements({slide:s,shape:o,elements:p}),!0}case"chart-legend":return i.setChartElements({slide:s,shape:o,elements:{legend:u==="none"||!u?null:u}}),!0;case"chart-layout":{const c=jm.find(([d])=>d===u);return c&&i.setChartElements({slide:s,shape:o,elements:c[2]}),!0}case"chart-data":return su(e).value={slide:s,shape:o},!0;case"chart-select-data":return Gm(e).value={slide:s,shape:o},!0;case"chart-switch":return i.switchChartRowColumn({slide:s,shape:o}),!0;case"chart-style":{const c=Xm.find(p=>p.id===n),d=c?Zm(c,l.accents):null;return c&&d&&e.session.chain().setChartColors({slide:s,shape:o,colors:d}).setChartElements({slide:s,shape:o,elements:c.elements}).run(),!0}case"chart-colors":return Array.isArray(n)&&i.setChartColors({slide:s,shape:o,colors:n}),!0;default:return!1}}const b8={key:0,class:"pptx-chart-colors"},y8={class:"pptx-chart-swatches"},x8=O({__name:"colors",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context),l=F(()=>Qm(n.value?.accents??[])),s=F(()=>l.value.filter(r=>r.id.startsWith("colorful"))),o=F(()=>l.value.filter(r=>r.id.startsWith("mono"))),a=r=>r.map(u=>({value:u.id,label:u.label,data:{colors:u.colors}}));function i(r){const u=l.value.find(c=>c.id===r);u&&(t.scope.execute([...u.colors]),t.scope.setExpanded(!1))}return(r,u)=>e.scope.expanded?(x(),M("div",b8,[(x(!0),M(U,null,H([["彩色",s.value],["单色",o.value]],([c,d])=>(x(),B(m(Ja),{key:c,label:c,presentation:"icons","max-columns":1,"min-item-width":"180px",items:a(d),"model-value":null,"onUpdate:modelValue":i},{preview:A(({item:p})=>[k("span",y8,[(x(!0),M(U,null,H(p.data?.colors,(f,h)=>(x(),M("span",{key:h,style:fe({background:f})},null,4))),128))])]),_:1},8,["label","items"]))),128))])):L("v-if",!0)}}),Jm={width:12192e3,height:6858e3};function eh(e,t){try{const n=Sc(),l=Mt(t);l&&gl(n,l),gc(n);const s=pe(n)[0];return yc(s,{spec:e,x:j(0),y:j(0),w:j(Jm.width),h:j(Jm.height)}),Wt(n,s)}catch{return""}}const w8={key:0,class:"pptx-chart-styles",role:"listbox","aria-label":"图表样式"},k8=["title","aria-label","onClick"],$8=["innerHTML"],S8=O({__name:"styles",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context),l=F(()=>{const o=n.value;if(!t.scope.expanded||!o)return[];const a=o.state.session.document.presentation(),i=ps(a,o.slide,o.shape);return i?Xm.map(r=>{const u=Zm(r,o.accents),c=Tp(u?Ap(i.spec,u):i.spec,r.elements);return{style:r,svg:hl(c)?eh(c,a):""}}):[]});function s(o){t.scope.execute(o),t.scope.setExpanded(!1)}return(o,a)=>e.scope.expanded?(x(),M("div",w8,[(x(!0),M(U,null,H(l.value,i=>(x(),M("button",{key:i.style.id,type:"button",role:"option",class:"pptx-chart-style",title:i.style.label,"aria-label":i.style.label,onClick:r=>s(i.style.id)},[k("span",{class:"pptx-chart-style-thumb","aria-hidden":"true",innerHTML:i.svg},null,8,$8)],8,k8))),128))])):L("v-if",!0)}});function C8(e,t){return[["",...t.map(n=>n.name)],...e.map((n,l)=>[n,...t.map(s=>s.values[l]===null||s.values[l]===void 0?"":String(s.values[l]))])]}function M8(e){let t=e.replace(/[\s,,]/gu,"").replace(/^[¥¥$€£]|[¥¥$€£]$/gu,""),n=1;/^\(.*\)$/u.test(t)&&(n=-1,t=t.slice(1,-1).replace(/^[¥¥$€£]/u,""));const l=/[%%]$/u.test(t);if(l&&(t=t.slice(0,-1)),!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/iu.test(t))return null;const s=Number(t)*n;return Number.isFinite(s)?l?s/100:s:null}function P8(e){const t=[],n=e[0]?.slice(1)??[],l=e.slice(1),s=n.map((o,a)=>({name:o.trim()||`系列 ${a+1}`,values:l.map((i,r)=>{const u=(i[a+1]??"").trim();if(u==="")return null;const c=M8(u);return c===null&&t.push(`${r+1},${a+1}`),c})}));return t.length>0?{invalid:t}:{categories:l.map((o,a)=>(o[0]??"").trim()||`类别 ${a+1}`),series:s}}function T8(e,t,n,l){const s=Math.max(e[0]?.length??1,n+Math.max(0,...l.map(a=>a.length))),o=Math.max(e.length,t+l.length);return Array.from({length:o},(a,i)=>Array.from({length:s},(r,u)=>l[i-t]?.[u-n]??e[i]?.[u]??""))}const A8=(e,t)=>e.filter((n,l)=>l!==t).map(n=>[...n]),E8=(e,t)=>e.map(n=>n.filter((l,s)=>s!==t));function F8(e,t){const n=e[0]?.length??1,l=[`类别 ${e.length}`,...Array.from({length:n-1},()=>"")];return[...e.slice(0,t).map(s=>[...s]),l,...e.slice(t).map(s=>[...s])]}function z8(e,t){const n=e[0]?.length??1;return e.map((l,s)=>[...l.slice(0,t),s===0?`系列 ${n}`:"",...l.slice(t)])}function D8(e,t){return e.slice(0,t.rows).map(n=>n.slice(0,t.columns))}function L8(e,t){const n=Q({rows:2,columns:2});function l(a){const i=e.value.length,r=e.value[0]?.length??0,u=Math.max(2,Math.min(i,a.rows)),c=Math.max(2,Math.min(t()?2:r,a.columns));(u!==n.value.rows||c!==n.value.columns)&&(n.value={rows:u,columns:c})}function s(a){if(a.button!==0)return;a.preventDefault();const i=a.currentTarget.ownerDocument,r=c=>{const d=i.elementFromPoint(c.clientX,c.clientY)?.closest("[data-sheet-row]");d&&l({rows:Number(d.dataset.sheetRow)+1,columns:Number(d.dataset.sheetColumn)+1})},u=()=>{i.removeEventListener("pointermove",r),i.removeEventListener("pointerup",u),i.removeEventListener("pointercancel",u)};i.addEventListener("pointermove",r),i.addEventListener("pointerup",u),i.addEventListener("pointercancel",u)}function o(a){const i={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]}[a.key];i&&(a.preventDefault(),l({rows:n.value.rows+i[0],columns:n.value.columns+i[1]}))}return{region:n,set:l,drag:s,key:o,inside:(a,i)=>a<n.value.rows&&i<n.value.columns}}const V8={class:"pptx-chart-sheet-tools"},I8={class:"pptx-chart-sheet"},B8=["value","inputmode","aria-label","readonly","onFocus","onInput","onPaste"],O8=["aria-valuetext"],U8={class:"pptx-chart-sheet-hint qk-type-body text-qk-text-tertiary"},N8={key:0,class:"pptx-chart-sheet-error qk-type-body"},R8=O({__name:"data-dialog",props:{state:{}},setup(e){const t=e,n=su(t.state),l=V([]),s=V({row:1,column:1}),o=V(!1),a=V(""),i=L8(l,()=>o.value);X(n,C=>{a.value="";const E=C?ps(t.state.session.document.presentation(),C.slide,C.shape):null;if(!E){l.value=[];return}o.value=E.spec.kind==="pie"||E.spec.kind==="doughnut",l.value=C8(E.spec.categories,E.spec.series),i.region.value={rows:l.value.length,columns:l.value[0]?.length??2},s.value={row:1,column:1}});const r=F(()=>D8(l.value,i.region.value)),u=F(()=>P8(r.value)),c=F(()=>new Set("invalid"in u.value?u.value.invalid:[])),d=C=>(C>=26?d(Math.floor(C/26)-1):"")+String.fromCharCode(65+C%26),p=F(()=>`A1:${d(i.region.value.columns-1)}${i.region.value.rows}`);function f(C){C||(n.value=void 0)}function h(C){const E=Math.max(1,s.value.row+(C?1:0));l.value=F8(l.value,E),E<=i.region.value.rows&&i.set({...i.region.value,rows:i.region.value.rows+1}),s.value={row:E,column:s.value.column}}function v(C){const E=Math.max(1,s.value.column+(C?1:0));l.value=z8(l.value,E),E<=i.region.value.columns&&i.set({...i.region.value,columns:i.region.value.columns+1}),s.value={row:s.value.row,column:E}}function g(){const C=s.value.row;l.value.length<=2||C<1||(l.value=A8(l.value,C),i.set({...i.region.value,rows:i.region.value.rows-(C<i.region.value.rows?1:0)}))}function $(){const C=s.value.column;(l.value[0]?.length??0)<=2||C<1||(l.value=E8(l.value,C),i.set({...i.region.value,columns:i.region.value.columns-(C<i.region.value.columns?1:0)}))}function b(C,E,T){const z=l.value.map(D=>[...D]);z[C][E]=T.target.value,l.value=z}function w(C,E,T){const z=T.clipboardData?.getData("text/plain")??"";if(!/[\t\n]/u.test(z))return;T.preventDefault();const D=dp(z);l.value=T8(l.value,C,E,D);const{rows:P,columns:I}=i.region.value,K=Math.max(0,...D.map(G=>G.length));C===0&&E===0?i.set({rows:D.length,columns:K}):C<=P&&E<=I&&i.set({rows:Math.max(P,C+D.length),columns:Math.max(I,E+K)})}function S(){const C=n.value,E=u.value;if(!C||"invalid"in E)return;if(o.value&&E.series.length!==1){a.value="饼图和环形图只能有一个系列。";return}if(new Set(E.series.map(D=>D.name)).size!==E.series.length){a.value="系列名称不能重复。";return}const T=hr(t.state.session.document.presentation(),C.slide,C.shape)?.blanks;let z=!1;try{const D=t.state.session.chain().setChartData({slide:C.slide,shape:C.shape,categories:E.categories,series:E.series});z=(T&&T!=="gap"?D.setChartOptions({slide:C.slide,shape:C.shape,options:{blanks:T}}):D).run()}catch{z=!1}z?n.value=void 0:a.value="这些数据无法写入图表。"}return(C,E)=>(x(),B(m(Ae),{open:m(n)!==void 0,"onUpdate:open":E[7]||(E[7]=T=>f(T))},{default:A(()=>[y(m(Te),{title:"编辑图表数据",size:"large","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:E[6]||(E[6]=T=>f(!1))},{default:A(()=>[...E[14]||(E[14]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:c.value.size>0,onClick:S},{default:A(()=>[...E[15]||(E[15]=[R("确定",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("div",V8,[y(m(q),{size:"sm",variant:"ghost",onClick:E[0]||(E[0]=T=>h(!1))},{default:A(()=>[...E[8]||(E[8]=[R("上方插入类别",-1)])]),_:1}),y(m(q),{size:"sm",variant:"ghost",onClick:E[1]||(E[1]=T=>h(!0))},{default:A(()=>[...E[9]||(E[9]=[R("下方插入类别",-1)])]),_:1}),y(m(q),{size:"sm",variant:"ghost",disabled:l.value.length<=2,onClick:g},{default:A(()=>[...E[10]||(E[10]=[R("删除所在类别",-1)])]),_:1},8,["disabled"]),o.value?L("v-if",!0):(x(),M(U,{key:0},[y(m(q),{size:"sm",variant:"ghost",onClick:E[2]||(E[2]=T=>v(!1))},{default:A(()=>[...E[11]||(E[11]=[R("左侧插入系列",-1)])]),_:1}),y(m(q),{size:"sm",variant:"ghost",onClick:E[3]||(E[3]=T=>v(!0))},{default:A(()=>[...E[12]||(E[12]=[R("右侧插入系列",-1)])]),_:1}),y(m(q),{size:"sm",variant:"ghost",disabled:(l.value[0]?.length??0)<=2,onClick:$},{default:A(()=>[...E[13]||(E[13]=[R("删除所在系列",-1)])]),_:1},8,["disabled"])],64))]),k("div",I8,[k("table",null,[k("tbody",null,[(x(!0),M(U,null,H(l.value,(T,z)=>(x(),M("tr",{key:z},[(x(!0),M(U,null,H(T,(D,P)=>(x(),B(An(z===0||P===0?"th":"td"),{key:P,"data-sheet-row":z,"data-sheet-column":P,class:Ne({"pptx-chart-sheet-invalid":c.value.has(`${z},${P}`),"pptx-chart-sheet-outside":!m(i).inside(z,P),"pptx-chart-sheet-edge-right":P===m(i).region.value.columns-1&&z<m(i).region.value.rows,"pptx-chart-sheet-edge-bottom":z===m(i).region.value.rows-1&&P<m(i).region.value.columns})},{default:A(()=>[k("input",{value:D,inputmode:z>0&&P>0?"decimal":"text","aria-label":z===0&&P===0?"表格左上角":z===0?"系列名称":P===0?"类别名称":`${T[0]} · ${l.value[0][P]}`,readonly:z===0&&P===0,onFocus:I=>s.value={row:z,column:P},onInput:I=>b(z,P,I),onPaste:I=>w(z,P,I)},null,40,B8),z===m(i).region.value.rows-1&&P===m(i).region.value.columns-1?(x(),M("span",{key:0,class:"pptx-chart-sheet-handle",role:"slider",tabindex:"0","aria-label":"数据区域右下角","aria-valuetext":p.value,onPointerdown:E[4]||(E[4]=(...I)=>m(i).drag&&m(i).drag(...I)),onKeydown:E[5]||(E[5]=(...I)=>m(i).key&&m(i).key(...I))},null,40,O8)):L("v-if",!0)]),_:2},1032,["data-sheet-row","data-sheet-column","class"]))),128))]))),128))])])]),k("p",U8,"数据区域 "+N(p.value)+":拖动右下角调整,区域外的数据不写入图表。可直接粘贴从表格软件复制的数据。",1),a.value||c.value.size>0?(x(),M("p",N8,N(a.value||"标红的单元格不是数字。"),1)):L("v-if",!0)]),_:1})]),_:1},8,["open"]))}}),j8={class:"pptx-chart-insert"},K8={class:"pptx-chart-insert-groups","aria-label":"图表类型"},W8=["aria-pressed","onClick"],q8={class:"pptx-chart-insert-body"},_8={class:"pptx-chart-insert-variants",role:"listbox","aria-label":"子类型"},G8=["aria-selected","title","onClick","onDblclick"],H8=["innerHTML"],Q8={class:"pptx-chart-insert-name qk-type-label"},X8=["innerHTML"],Z8=O({__name:"insert-dialog",props:{state:{}},setup(e){const t=e,n=qm(t.state),l=V("column"),s=V("column-clustered"),o=Q(new Map);X(n,c=>{c&&(o.value=new Map)});const a=F(()=>pr.filter(c=>c.group===l.value));X(l,()=>{s.value=a.value[0]?.id??s.value});function i(c){const d=o.value.get(c);if(d!==void 0)return d;const p=t.state.session.document.presentation(),f=Mt(p),h=Sp(c,f?[f.accent1,f.accent2,f.accent3,f.accent4]:[]),v=h?eh(h,p):"";return o.value.set(c,v),v}const r=F(()=>pr.find(c=>c.id===s.value)?.label??"");function u(){const c=t.state.current.value?.part;c&&t.state.session.commands.addChartPreset({slide:c,preset:s.value,...Ie(t.state,16,9)})&&(Le(t.state,c),n.value=!1)}return(c,d)=>(x(),B(m(Ae),{open:m(n),"onUpdate:open":d[1]||(d[1]=p=>n.value=p===!0)},{default:A(()=>[y(m(Te),{title:"插入图表",size:"large","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:d[0]||(d[0]=p=>n.value=!1)},{default:A(()=>[...d[2]||(d[2]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",onClick:u},{default:A(()=>[...d[3]||(d[3]=[R("插入",-1)])]),_:1})]),default:A(()=>[k("div",j8,[k("nav",K8,[(x(!0),M(U,null,H(m(Bw),([p,f])=>(x(),M("button",{key:p,type:"button",class:"pptx-chart-insert-group","aria-pressed":l.value===p,onClick:h=>l.value=p},N(f),9,W8))),128))]),k("div",q8,[k("div",_8,[(x(!0),M(U,null,H(a.value,p=>(x(),M("button",{key:p.id,type:"button",role:"option",class:"pptx-chart-insert-variant","aria-selected":s.value===p.id,title:p.label,onClick:f=>s.value=p.id,onDblclick:f=>{s.value=p.id,u()}},[k("span",{class:"pptx-chart-insert-thumb","aria-hidden":"true",innerHTML:i(p.id)},null,8,H8)],40,G8))),128))]),k("p",Q8,N(r.value),1),k("div",{class:"pptx-chart-insert-preview","aria-hidden":"true",innerHTML:i(s.value)},null,8,X8)])])]),_:1})]),_:1},8,["open"]))}}),Y8={key:0,class:"pptx-chart-select"},J8={class:"pptx-chart-select-list","aria-label":"系列"},e3={class:"pptx-chart-select-name"},t3={key:0,class:"pptx-chart-select-list","aria-label":"类别"},n3={class:"pptx-chart-select-name"},l3={id:"chart",tabs:[{value:"chart-tools",label:"图表工具",order:102,contextual:Um,entries:v8,context:e=>{const t=lu(e);return t?{...t,state:e}:void 0}}],renderers:{chartColors:x8,chartStyles:S8},overlays:[R8,Z8,O({__name:"select-data-dialog",props:{state:{}},setup(e){const t=e,n=Gm(t.state),l=F(()=>{t.state.tick.value;const f=n.value,h=f?ps(t.state.session.document.presentation(),f.slide,f.shape):null;return f&&h?{...f,spec:h.spec}:void 0}),s=F(()=>l.value?hr(t.state.session.document.presentation(),l.value.slide,l.value.shape)?.blanks??null:null),o=[{value:"gap",label:"空距"},{value:"zero",label:"零值"},{value:"span",label:"用直线连接数据点"}];function a(f){const h=l.value;h&&(f==="gap"||f==="zero"||f==="span")&&t.state.session.commands.setChartOptions({slide:h.slide,shape:h.shape,options:{blanks:f}})}const i=F(()=>l.value!==void 0&&l.value.spec.categories.length>0&&!["pie","doughnut","scatter","bubble"].includes(l.value.spec.kind));function r(f,h){const v=l.value;if(!v)return;const g=v.spec.series.map((b,w)=>w),$=f+h;$<0||$>=g.length||([g[f],g[$]]=[g[$],g[f]],t.state.session.commands.setChartSeriesOrder({slide:v.slide,shape:v.shape,order:g}))}function u(f){const h=l.value;h&&t.state.session.commands.removeChartSeries({slide:h.slide,shape:h.shape,series:f})}function c(f){const h=l.value;h&&t.state.session.commands.removeChartCategory({slide:h.slide,shape:h.shape,category:f})}function d(){const f=l.value;f&&t.state.session.commands.switchChartRowColumn({slide:f.slide,shape:f.shape})}function p(){const f=l.value;n.value=void 0,f&&(su(t.state).value={slide:f.slide,shape:f.shape})}return(f,h)=>(x(),B(m(Ae),{open:m(n)!==void 0,"onUpdate:open":h[1]||(h[1]=v=>v||(n.value=void 0))},{default:A(()=>[y(m(Te),{title:"选择数据",size:"medium","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",variant:"ghost",disabled:!i.value,onClick:d},{default:A(()=>[...h[4]||(h[4]=[R("切换行列",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",variant:"ghost",disabled:l.value?.spec.kind==="scatter"||l.value?.spec.kind==="bubble",onClick:p},{default:A(()=>[...h[5]||(h[5]=[R("编辑数据…",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",color:"primary",variant:"solid",onClick:h[0]||(h[0]=v=>n.value=void 0)},{default:A(()=>[...h[6]||(h[6]=[R("完成",-1)])]),_:1})]),default:A(()=>[l.value?(x(),M("div",Y8,[k("section",J8,[h[2]||(h[2]=k("div",{class:"pptx-section-label"},[k("span",null,"系列")],-1)),k("ul",null,[(x(!0),M(U,null,H(l.value.spec.series,(v,g)=>(x(),M("li",{key:`${v.name}-${g}`},[k("span",e3,N(v.name||`系列 ${g+1}`),1),y(m(ye),{label:"上移",variant:"ghost",size:"sm",disabled:g===0,onClick:$=>r(g,-1)},{default:A(()=>[y(m(me),{name:"arrowUp"})]),_:1},8,["disabled","onClick"]),y(m(ye),{label:"下移",variant:"ghost",size:"sm",disabled:g===l.value.spec.series.length-1,onClick:$=>r(g,1)},{default:A(()=>[y(m(me),{name:"arrowDown"})]),_:1},8,["disabled","onClick"]),y(m(ye),{label:"删除系列",variant:"ghost",size:"sm",disabled:l.value.spec.series.length<2,onClick:$=>u(g)},{default:A(()=>[y(m(me),{name:"trash"})]),_:1},8,["disabled","onClick"])]))),128))])]),l.value.spec.categories.length>0?(x(),M("section",t3,[h[3]||(h[3]=k("div",{class:"pptx-section-label"},[k("span",null,"类别")],-1)),k("ul",null,[(x(!0),M(U,null,H(l.value.spec.categories,(v,g)=>(x(),M("li",{key:`${v}-${g}`},[k("span",n3,N(v||`类别 ${g+1}`),1),y(m(ye),{label:"删除类别",variant:"ghost",size:"sm",disabled:l.value.spec.categories.length<2||l.value.spec.categoryGroupLevels!==void 0,onClick:$=>c(g)},{default:A(()=>[y(m(me),{name:"trash"})]),_:1},8,["disabled","onClick"])]))),128))])])):L("v-if",!0)])):L("v-if",!0),s.value!==null?(x(),B(m(Ke),{key:1,class:"pptx-chart-select-blanks","model-value":s.value,label:"空单元格显示为",orientation:"horizontal",items:o,"onUpdate:modelValue":a},null,8,["model-value"])):L("v-if",!0)]),_:1})]),_:1},8,["open"]))}})],intent:(e,t,n)=>g8(e,t,n),inspector:[{kinds:["chart"],component:JM},{kinds:["chart"],component:n8},{kinds:["chart"],component:p8},{kinds:["chart"],component:r8},{kinds:["chart"],component:m8}]};function _e(e,t){const n=e.boxes.value;return e.selected.value.filter(l=>{const s=n.find(o=>o.id===l);return s!==void 0&&t.includes(s.kind)})}function ou(e){const t=e.current.value?.part,n=e.session.document.presentation();return _e(e,["text","connector"]).filter(l=>{const s=t?le(n,t,l):null;return s!==null&&zp(s)})}function He(e,t,n){const l=e.current.value?.part;l&&t.length>0&&n(l,t)}function au(e){return new Promise(t=>{const n=e.createElement("input");n.type="file",n.accept="image/png,image/jpeg,image/gif,image/bmp,image/webp,image/svg+xml",n.addEventListener("change",()=>{const l=n.files?.[0];l?l.arrayBuffer().then(s=>t(new Uint8Array(s)),()=>t(null)):t(null)},{once:!0}),n.addEventListener("cancel",()=>t(null),{once:!0}),n.click()})}const th={width:128e4,height:96e4},nh=new Map,As=new Map;function s3(e,t,n){const l=pe(t)[0],s={x:j(166e3),y:j(144e3),w:j(948e3),h:j(47e4)};if(e==="line")return xc(l,{from:{x:j(226e3),y:j(746e3)},to:{x:j(1054e3),y:j(213e3)},color:"#404040",widthEmu:28575});if(e==="picture")return n?Zs(l,n,{...s,fit:"contain"}):null;if(e==="text"){const a=Ys(l,{...s,text:"文字 Abc"});return nt(a,{size:22,bold:!0}),Nn(a,"center"),a}const o=zn(l,{preset:"rect",...s,text:"Aa",textAnchor:"ctr"});return yo(o,To),nt(o,{size:14}),Nn(o,"center"),o}function en(e,t,n,l,s){const o=Mt(e),a=`${JSON.stringify(o)}|${t}|${s?.id??""}|${n}`,i=As.get(a);if(i!==void 0)return i;let r=nh.get(t);if(!r){const d=Sc();gc(d),wo(d,{width:j(th.width),height:j(th.height)}),r={deck:d,theme:"",shape:null},nh.set(t,r)}if(r.theme!==JSON.stringify(o)&&(o&&gl(r.deck,o),r.theme=JSON.stringify(o)),r.shape&&pn(r.shape),r.shape=s3(t,r.deck,s?.bytes),!r.shape)return"";try{l(r.shape)}catch{return""}const u=pe(r.deck)[0],c=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Hs(r.deck,u,Wt(r.deck,u)))}`;return As.set(a,c),As.size>800&&As.delete(As.keys().next().value),c}const iu={shadow:"阴影",glow:"发光",reflection:"倒影",softEdge:"柔化边缘",rotation:"三维旋转",bevel:"棱台"},lh={shape:["shadow","glow","reflection","softEdge","rotation","bevel"],picture:["shadow","glow","reflection","softEdge","rotation","bevel"],line:["shadow","glow","reflection"],text:["shadow","glow","reflection"]};function o3(e){return e.kind==="none"?e:{kind:e.kind,value:null}}function a3(e,t){const n=l=>({id:`${e}-none`,label:`无${iu[e]}`,effect:o3(l)});switch(e){case"shadow":return[{label:"外部",presets:[n({kind:"shadow",value:null}),...Ws.filter(l=>l.id.startsWith("outer-"))]},{label:"内部",presets:Ws.filter(l=>l.id.startsWith("inner-"))},...t==="text"?[]:[{label:"透视",presets:Ws.filter(l=>l.id.startsWith("perspective-"))}]];case"glow":return ic.map(([l,s],o)=>({label:`${s}(${l} 磅)`,presets:[...o===0?[n({kind:"glow",value:null})]:[],...[1,2,3,4,5,6].map(a=>({id:`glow-${l}-${a}`,label:`强调 ${a},${l} 磅`,effect:Qu(`accent${a}`,l)}))]}));case"reflection":return[{label:"倒影变体",presets:[n({kind:"reflection",value:null}),...ju]}];case"softEdge":return[{label:"柔化边缘",presets:[n({kind:"softEdge",value:null}),...Xu.map(l=>({id:`soft-${l}`,label:`${l} 磅`,effect:{kind:"softEdge",value:Math.round(l*12700)}}))]}];case"rotation":return[{label:"平行",presets:[n({kind:"rotation",value:null}),...Zu]}];case"bevel":return[{label:"棱台",presets:[n({kind:"bevel",value:null}),..._u]}]}}function i3(e,t,n){if(e!=="text"){wn(t,n);return}const l=Hp(n);l&&nt(t,l)}function r3(e,t){const n=new Map;return{sections:a3(t,e.subject).map(l=>({label:l.label,items:l.presets.map(s=>(n.set(s.id,s.effect),{value:s.id,label:s.label,image:en(e.presentation,e.subject,`effect:${s.id}`,o=>i3(e.subject,o,s.effect),e.picture)}))})),effects:n}}const u3={class:"pptx-property-grid"},sh=O({__name:"effect-fields",props:{state:{},shapes:{},look:{},subject:{}},setup(e){const t=e,n={shadow:["shadow","innerShadow"],glow:["glow"],reflection:["reflection"],softEdge:["softEdge"],rotation:["rotation"],bevel:["bevel"]};function l(a){const i={id:"none",label:"无",effect:{kind:a==="shadow"?"shadow":a,value:null}};switch(a){case"shadow":return[i,...Ws];case"glow":return[i,...ic.flatMap(([r])=>[1,2,3,4,5,6].map(u=>({id:`glow-${r}-${u}`,label:`强调 ${u},${r} 磅`,effect:Qu(`accent${u}`,r)})))];case"reflection":return[i,...ju];case"softEdge":return[i,...Xu.map(r=>({id:`soft-${r}`,label:`${r} 磅`,effect:{kind:"softEdge",value:Math.round(r*12700)}}))];case"rotation":return[i,...Zu];case"bevel":return[i,..._u]}}const s=F(()=>lh[t.subject].map(a=>({family:a,label:iu[a],choices:l(a),set:n[a].some(i=>t.look.effects.includes(i))})));function o(a,i){const r=l(a).find(c=>c.id===i)?.effect,u=t.state.current.value?.part;r&&u&&t.state.session.commands.setShapeEffect({slide:u,shapes:t.shapes,effect:r})}return(a,i)=>(x(),M("div",u3,[(x(!0),M(U,null,H(s.value,r=>(x(),M("div",{key:r.family,class:"pptx-tools-field"},[k("span",null,N(r.label),1),y(m(ce),{"model-value":r.set?"":"none",placeholder:r.set?"已设置":"无",items:r.choices.map(u=>({value:u.id,label:u.label})),label:r.label,size:"sm",width:"100%","onUpdate:modelValue":u=>o(r.family,u)},null,8,["model-value","placeholder","items","label","onUpdate:modelValue"])]))),128))]))}}),oh=new WeakMap;function ah(e){let t=oh.get(e);return t||(t=Q(),oh.set(e,t)),t}function ru(e){return ah(e).value??(e.selected.value.length>1?"selection":"slide")}function uu(e){const t=e.selected.value.length,n=ru(e),l=[["left","左对齐","alignStartVertical"],["center","水平居中","alignCenterVertical"],["right","右对齐","alignEndVertical"],["top","顶端对齐","alignStartHorizontal"],["middle","垂直居中","alignCenterHorizontal"],["bottom","底端对齐","alignEndHorizontal"]],s=n==="slide"?t<1:t<3;return{value:"align-to",kind:"menu",trigger:"disclosure",label:"对齐",icon:"alignStartVertical",disabled:t===0,disabledReason:"先选择幻灯片上的对象。",items:[...l.map(([o,a,i])=>({value:`align-to:edge:${o}`,label:a,icon:i})),{value:"align-to-separator",label:"",kind:"separator"},{value:"align-to:distribute:horizontal",label:"横向分布",disabled:s},{value:"align-to:distribute:vertical",label:"纵向分布",disabled:s},{value:"align-to-reference-separator",label:"",kind:"separator"},{value:"align-to:references",label:"对齐到",kind:"radio-group",selectedValue:`align-to:reference:${n}`,children:[{value:"align-to:reference:slide",label:"相对于幻灯片"},{value:"align-to:reference:selection",label:"相对于所选对象",disabled:t<2}]}]}}function c3(e,t){if(!t.startsWith("align-to:"))return!1;const n=e.current.value?.part,l=e.selected.value,[,s,o]=t.split(":");return s==="reference"?ah(e).value=o:n&&l.length>0&&s==="edge"?e.session.commands.alignShapesTo({slide:n,shapes:l,edge:o,to:ru(e)}):n&&l.length>0&&s==="distribute"&&e.session.commands.distributeShapesTo({slide:n,shapes:l,axis:o,to:ru(e)}),!0}function d3(e){const t=e.current.value?.part,n=e.selected.value.length===1?e.selected.value[0]:void 0,l=t&&n!==void 0?Xe(e.session.document.presentation(),t,n):null;return l?{width:l.frame.width,height:l.frame.height,locked:Ai(l.shape)}:void 0}function p3(e){if(typeof e!="object"||e===null)return!1;const{width:t,height:n}=e;return(typeof t=="number"||typeof n=="number")&&[t,n].every(l=>l===void 0||typeof l=="number"&&l>0)}function f3(e,t){const n=e.current.value?.part,l=e.selected.value[0],s=n&&l!==void 0&&e.selected.value.length===1?Xe(e.session.document.presentation(),n,l):null;if(!s)return;const{frame:o}=s;let a=t.width===void 0?o.width:t.width*rt,i=t.height===void 0?o.height:t.height*rt;Ai(s.shape)&&o.width>0&&o.height>0&&(t.width!==void 0?i=o.height*a/o.width:a=o.width*i/o.height),e.session.commands.setShapeBounds({slide:n,shape:l,width:Math.round(a),height:Math.round(i)})}const m3=[.25,.5,.75,1,1.5,2.25,3,4.5,6],ih=[["solid","实线"],["sysDot","圆点"],["sysDash","方点"],["dash","短划线"],["dashDot","点划线"],["lgDash","长划线"],["lgDashDot","长点划线"],["lgDashDotDot","长双点划线"]],oa=[["none","无"],["triangle","三角箭头"],["stealth","燕尾箭头"],["diamond","菱形箭头"],["oval","圆形箭头"]],aa=[["sm","小"],["med","中"],["lg","大"]],rh=[["flat","平"],["rnd","圆"],["sq","方"]],uh=[["round","圆形"],["bevel","斜角"],["miter","斜接"]],ch=[["sng","单线"],["dbl","双线"],["thickThin","由粗到细"],["thinThick","由细到粗"],["tri","三线"]];function dh(e){const t=d3(e);return t?{size:t}:{}}function ph(e){return{value:"insert-text-box",kind:"split",label:"横向文本框",icon:"textBox",disclosureLabel:"选择文本框方向",pressed:Fl.has(e.armedShape.value??""),items:[{value:"insert-text-box",label:"横向文本框",icon:"textBox"},{value:"insert-text-box:vertical",label:"竖向文本框",icon:"textBoxVertical"}]}}function fh(e){const t=e.armedShape.value;return[{value:"shape",label:"插入形状",icon:"shapes",kind:"disclosure",indicator:!0,contentRenderer:"shapeGallery",overlayProps:{width:"auto"},pressed:t!==void 0&&!El.has(t)&&!Fl.has(t)},ph(e),vt("drawing-insert")]}const mh={value:"drawing:size",label:"大小",kind:"custom",renderer:"toolsSize"};function h3(e){const t=e.current.value?.part,n=e.selected.value[0],l=t&&n!==void 0?le(e.session.document.presentation(),t,n):null;return!!(l&&Ao(l))}const vt=e=>({value:e,label:"",kind:"separator"});function Es(e,t){const n=e.current.value?.part,l=e.session.document.presentation(),s=n&&t[0]!==void 0?le(l,n,t[0]):null;return s?fs(l,s):void 0}function ia(e,t,n,l="轮廓样式"){const s=(o,a,i,r)=>({value:o,label:a,kind:"submenu",children:[{value:`${o}-choices`,label:a,kind:"radio-group",...r===void 0?{}:{selectedValue:`${o}:${r}`},children:i.map(([u,c])=>({value:`${o}:${u}`,label:c}))}]});return{value:`${e}:line`,label:l,icon:"lineDash",kind:"menu",trigger:"disclosure",items:[s(`${e}:line-width`,"粗细",m3.map(o=>[String(o),`${o} 磅`]),t?.lineWidth===null||t===void 0?void 0:String(t.lineWidth)),s(`${e}:line-dash`,"虚线线型",ih,t?.dash),s(`${e}:line-compound`,"复合类型",ch,t?.compound),...n?[s(`${e}:line-head`,"起点箭头",oa,t?.head),s(`${e}:line-headSize`,"起点箭头大小",aa,t?.headSize),s(`${e}:line-tail`,"终点箭头",oa,t?.tail),s(`${e}:line-tailSize`,"终点箭头大小",aa,t?.tailSize)]:[],s(`${e}:line-cap`,"端点类型",rh,t?.cap),s(`${e}:line-join`,"联接类型",uh,t?.join),{value:`${e}:line-separator`,label:"",kind:"separator"},{value:`${e}:more`,label:"更多设置"}]}}function v3(e){e.tick.value;const t=_e(e,["text","connector"]),n=ou(e).length,l=n<t.length,s=n>0,o=Es(e,_e(e,["text","connector"])),a={value:"drawing:arrows",label:"箭头样式",kind:"disclosure",contentRenderer:"drawingArrows",popup:"dialog",overlayProps:{width:"auto"}},i=e.selected.value.length===1&&h3(e),r={value:"edit-points",label:"编辑顶点",icon:"editPoints",pressed:e.pointEditing.value!==void 0,disabled:!i,disabledReason:"选择一个形状或线条来编辑顶点。"},u=[vt("drawing-arrange"),uu(e),Yo(e),{value:"panel:selection",label:"选择窗格",icon:"listTree"},vt("drawing-size"),mh];return l?[...fh(e),{value:"drawing:style",label:"形状样式",icon:"shapeStyles",kind:"disclosure",contentRenderer:"drawingStyles",popup:"dialog",overlayProps:{width:"auto"}},vt("drawing-fill"),{value:"shape-fill",label:"填充",icon:"fillColor",kind:"custom",renderer:"color"},{value:"drawing:fill",label:"填充效果",icon:"gradientFill",kind:"disclosure",contentRenderer:"drawingFill",popup:"dialog",overlayProps:{width:"auto"}},{value:"shape-outline",label:"轮廓",icon:"outlineColor",kind:"custom",renderer:"color"},ia("drawing",o,s),...s?[a]:[],vt("drawing-effects"),{value:"drawing:effect",label:"形状效果",icon:"shapeEffects",kind:"disclosure",contentRenderer:"toolsEffects",popup:"dialog",overlayProps:{width:"auto"}},{value:"edit-text",label:"编辑文字",icon:"textCursor",disabled:e.selected.value.length!==1,disabledReason:"选择一个形状来编辑文字。"},{value:"drawing:preset",label:"更改形状",icon:"changeShape",kind:"disclosure",contentRenderer:"drawingChangeShape",popup:"dialog",overlayProps:{width:"auto"}},r,{value:"picture:save-image",label:"另存为图片",icon:"imageDown"},...u]:[...fh(e),{value:"shape-outline",label:"线条颜色",icon:"outlineColor",kind:"custom",renderer:"color"},ia("drawing",o,!0,"线条样式"),a,r,vt("drawing-effects"),{value:"drawing:effect",label:"形状效果",icon:"shapeEffects",kind:"disclosure",contentRenderer:"toolsEffects",popup:"dialog",overlayProps:{width:"auto"}},{value:"picture:save-image",label:"另存为图片",icon:"imageDown"},...u]}function g3(e){e.tick.value;const t=Es(e,_e(e,["text","connector"])),n=ou(e).length===_e(e,["text","connector"]).length;return{presentation:e.session.document.presentation(),fill:t?.fillColor??null,outline:t?.lineColor??null,...t?{appearance:t}:{},subject:n?"line":"shape",hasDefault:Ms(e).value!==void 0,...dh(e)}}const b3={class:"pptx-property-row"},y3={class:"pptx-property-grid"},x3={class:"pptx-tools-field"},w3={class:"pptx-tools-field"},k3={key:0,class:"pptx-property-grid"},$3={class:"pptx-tools-field"},S3={class:"pptx-tools-field"},C3={key:1,class:"pptx-property-grid"},M3={class:"pptx-tools-field"},P3={class:"pptx-tools-field"},T3={class:"pptx-property-grid"},A3={class:"pptx-tools-field"},E3={class:"pptx-tools-field"},hh=O({__name:"line-fields",props:{state:{},shapes:{},look:{},arrows:{type:Boolean},name:{}},setup(e){const t=e;function n(o){const a=t.state.current.value?.part;a&&t.state.session.commands.setShapeLineStyle({slide:a,shapes:t.shapes,line:o})}const l=V("");X(()=>t.look.lineWidth,o=>{l.value=o===null?"":String(o)},{immediate:!0});function s(){const o=Number(l.value);Number.isFinite(o)&&o>0&&o!==t.look.lineWidth&&n({width:o,...t.look.lineColor===null?{color:"#000000"}:{}})}return(o,a)=>(x(),M(U,null,[k("div",b3,[k("span",null,N(e.name??"轮廓"),1),y(m(an),{label:`${e.name??"轮廓"}颜色`,"model-value":e.look.lineColor??"#000000","reset-active":e.look.lineColor===null,"reset-label":`无${e.name??"轮廓"}`,"show-alpha":!1,onCommit:a[0]||(a[0]=i=>n({color:m(lt)(i)??"#000000"})),onReset:a[1]||(a[1]=i=>n({color:null}))},null,8,["label","model-value","reset-active","reset-label"])]),k("div",y3,[y(m(re),{label:"粗细(磅)"},{default:A(({controlProps:i})=>[y(m(de),ie(i,{modelValue:l.value,"onUpdate:modelValue":a[2]||(a[2]=r=>l.value=r),label:"粗细",min:.25,max:100,step:.25,onBlur:s,onKeydown:ue(s,["enter"])}),null,16,["modelValue"])]),_:1}),k("div",x3,[a[11]||(a[11]=k("span",null,"线型",-1)),y(m(ce),{"model-value":e.look.dash,items:m(ih).map(([i,r])=>({value:i,label:r})),label:"虚线线型",size:"sm",width:"100%",disabled:e.look.lineColor===null,"onUpdate:modelValue":a[3]||(a[3]=i=>i&&i!==e.look.dash&&n({dash:i}))},null,8,["model-value","items","disabled"])]),k("div",w3,[a[12]||(a[12]=k("span",null,"复合类型",-1)),y(m(ce),{"model-value":e.look.compound,items:m(ch).map(([i,r])=>({value:i,label:r})),label:"复合类型",size:"sm",width:"100%",disabled:e.look.lineColor===null,"onUpdate:modelValue":a[4]||(a[4]=i=>i&&i!==e.look.compound&&n({compound:i}))},null,8,["model-value","items","disabled"])])]),e.arrows?(x(),M("div",k3,[k("div",$3,[a[13]||(a[13]=k("span",null,"起点箭头",-1)),y(m(ce),{"model-value":e.look.head,items:m(oa).map(([i,r])=>({value:i,label:r})),label:"起点箭头",size:"sm",width:"100%","onUpdate:modelValue":a[5]||(a[5]=i=>i&&i!==e.look.head&&n({head:i}))},null,8,["model-value","items"])]),k("div",S3,[a[14]||(a[14]=k("span",null,"终点箭头",-1)),y(m(ce),{"model-value":e.look.tail,items:m(oa).map(([i,r])=>({value:i,label:r})),label:"终点箭头",size:"sm",width:"100%","onUpdate:modelValue":a[6]||(a[6]=i=>i&&i!==e.look.tail&&n({tail:i}))},null,8,["model-value","items"])])])):L("v-if",!0),e.arrows?(x(),M("div",C3,[k("div",M3,[a[15]||(a[15]=k("span",null,"起点大小",-1)),y(m(ce),{"model-value":e.look.headSize,items:m(aa).map(([i,r])=>({value:i,label:r})),label:"起点箭头大小",size:"sm",width:"100%",disabled:e.look.head==="none","onUpdate:modelValue":a[7]||(a[7]=i=>i&&i!==e.look.headSize&&n({headSize:i}))},null,8,["model-value","items","disabled"])]),k("div",P3,[a[16]||(a[16]=k("span",null,"终点大小",-1)),y(m(ce),{"model-value":e.look.tailSize,items:m(aa).map(([i,r])=>({value:i,label:r})),label:"终点箭头大小",size:"sm",width:"100%",disabled:e.look.tail==="none","onUpdate:modelValue":a[8]||(a[8]=i=>i&&i!==e.look.tailSize&&n({tailSize:i}))},null,8,["model-value","items","disabled"])])])):L("v-if",!0),k("div",T3,[k("div",A3,[a[17]||(a[17]=k("span",null,"端点类型",-1)),y(m(ce),{"model-value":e.look.cap,items:m(rh).map(([i,r])=>({value:i,label:r})),label:"端点类型",size:"sm",width:"100%",disabled:e.look.lineColor===null,"onUpdate:modelValue":a[9]||(a[9]=i=>i&&i!==e.look.cap&&n({cap:i}))},null,8,["model-value","items","disabled"])]),k("div",E3,[a[18]||(a[18]=k("span",null,"联接类型",-1)),y(m(ce),{"model-value":e.look.join,items:m(uh).map(([i,r])=>({value:i,label:r})),label:"联接类型",size:"sm",width:"100%",disabled:e.look.lineColor===null,"onUpdate:modelValue":a[10]||(a[10]=i=>i&&i!==e.look.join&&n({join:i}))},null,8,["model-value","items","disabled"])])])],64))}}),F3=["onPointerup","onKeyup"],z3={class:"pptx-fill-value"},D3={class:"pptx-tools-field"},L3=O({__name:"adjust-fields",props:{state:{},shape:{},look:{}},setup(e){const t=e,n=[["brightness","亮度",-100],["contrast","对比度",-100],["transparency","透明度",0]],l=r=>Math.round((r==="transparency"?1-t.look.opacity:t.look[r])*100),s=V({brightness:[0],contrast:[0],transparency:[0]});X(()=>t.look,()=>{s.value={brightness:[l("brightness")],contrast:[l("contrast")],transparency:[l("transparency")]}},{immediate:!0});function o(r){const u=t.state.current.value?.part;u&&t.state.session.commands.setPictureColor({slide:u,shapes:[t.shape],color:r})}function a(r){const u=s.value[r][0];u===void 0||u===l(r)||o(r==="transparency"?{opacity:1-u/100}:{[r]:u/100})}const i=[{value:"none",label:"原色"},{value:"grayscale",label:"灰度"},{value:"blackWhite",label:"黑白"},{value:"washout",label:"冲蚀"}];return(r,u)=>(x(),M(U,null,[(x(),M(U,null,H(n,([c,d,p])=>k("div",{key:c,class:"pptx-fill-transparency",onPointerup:f=>a(c),onKeyup:f=>a(c)},[k("span",null,N(d),1),y(m(il),{modelValue:s.value[c],"onUpdate:modelValue":f=>s.value[c]=f,label:d,"hide-label":"","show-value":!1,min:p,max:100,step:1,origin:p<0?"center":"start"},null,8,["modelValue","onUpdate:modelValue","label","min","origin"]),k("span",z3,N(s.value[c][0])+"%",1)],40,F3)),64)),k("div",D3,[u[1]||(u[1]=k("span",null,"颜色",-1)),y(m(ce),{"model-value":e.look.recolor??"",items:i,label:"重新着色",placeholder:"其他着色",size:"sm",width:"100%","onUpdate:modelValue":u[0]||(u[0]=c=>c&&c!==e.look.recolor&&o({recolor:c}))},null,8,["model-value"])])],64))}}),V3={class:"pptx-property-section","aria-label":"图片调整"},I3={class:"pptx-property-section","aria-label":"边框"},B3={class:"pptx-property-section","aria-label":"效果"},O3=O({__name:"panel",props:{state:{},shape:{}},setup(e){const t=e,n=F(()=>{t.state.tick.value;const l=t.state.current.value?.part,s=t.state.session.document.presentation(),o=l?le(s,l,t.shape):null;return o?{look:$n(s,o),appearance:fs(s,o)}:null});return(l,s)=>n.value?(x(),M(U,{key:0},[k("section",V3,[s[0]||(s[0]=k("div",{class:"pptx-section-label"},[k("span",null,"图片调整")],-1)),y(L3,{state:e.state,shape:e.shape,look:n.value.look},null,8,["state","shape","look"])]),k("section",I3,[s[1]||(s[1]=k("div",{class:"pptx-section-label"},[k("span",null,"边框")],-1)),y(hh,{state:e.state,shapes:[e.shape],look:n.value.appearance,name:"边框"},null,8,["state","shapes","look"])]),k("section",B3,[s[2]||(s[2]=k("div",{class:"pptx-section-label"},[k("span",null,"效果")],-1)),y(sh,{state:e.state,shapes:[e.shape],look:n.value.appearance,subject:"picture"},null,8,["state","shapes","look"])])],64)):L("v-if",!0)}}),vh=new WeakMap;function ra(e){let t=vh.get(e);return t||(t=Q(),vh.set(e,t)),t}const U3=["src"],N3=["onPointerdown"],R3=["onPointerdown"],gh=8,j3=O({__name:"crop-layer",props:{state:{},scale:{}},setup(e){const t=e,n=ra(t.state),l=F(()=>{t.state.tick.value;const g=n.value,$=t.state.current.value?.part,b=t.state.session.document.presentation(),w=$&&g!==void 0&&t.state.selected.value.includes(g)?Xe(b,$,g):null;if(!w)return null;const{shape:S}=w,{rotation:C,...E}=w.frame,T=$n(b,S),z=Ln(S),D={rotation:C,flipH:z?.horizontal??!1,flipV:z?.vertical??!1};return{id:g,part:$,frame:E,image:ys(E,T.crop),turn:D,shape:S}});X(l,g=>{!g&&!d&&(n.value=void 0)});const s=Q();X(()=>l.value?.shape,g=>{s.value&&URL.revokeObjectURL(s.value);const $=g?un(g):null,b=g?no(g):null;s.value=$?URL.createObjectURL(new Blob([$.slice()],{type:b==="svg"?"image/svg+xml":`image/${b??"png"}`})):void 0},{immediate:!0});const o=(g,$={x:0,y:0})=>({left:`${(g.x-$.x)*t.scale}px`,top:`${(g.y-$.y)*t.scale}px`,width:`${g.width*t.scale}px`,height:`${g.height*t.scale}px`}),a=F(()=>{const g=l.value;if(!g)return{};const{rotation:$,flipH:b,flipV:w}=g.turn;return{...o(g.frame),transform:`rotate(${$}deg) scale(${b?-1:1}, ${w?-1:1})`}}),i=F(()=>{const g=l.value;if(!g)return"";const{frame:$,image:b}=g,[w,S]=[($.x-b.x)/b.width*100,($.y-b.y)/b.height*100],[C,E]=[w+$.width/b.width*100,S+$.height/b.height*100];return`polygon(evenodd, 0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, ${w}% ${S}%, ${C}% ${S}%, ${C}% ${E}%, ${w}% ${E}%, ${w}% ${S}%)`}),r=[["nw",{left:!0,top:!0}],["n",{top:!0}],["ne",{right:!0,top:!0}],["e",{right:!0}],["se",{right:!0,bottom:!0}],["s",{bottom:!0}],["sw",{left:!0,bottom:!0}],["w",{left:!0}]],u=[["nw",{right:!1,bottom:!1}],["ne",{right:!0,bottom:!1}],["se",{right:!0,bottom:!0}],["sw",{right:!1,bottom:!0}]],c=g=>{const $=l.value;return{left:`${($.image.x-$.frame.x+(g.right?$.image.width:0))*t.scale+(g.right?gh:-8)}px`,top:`${($.image.y-$.frame.y+(g.bottom?$.image.height:0))*t.scale+(g.bottom?gh:-8)}px`}};let d=null;function p(g,$,b=null){const w=l.value;!w||g.button!==0||(g.currentTarget.setPointerCapture(g.pointerId),d={pointer:g.pointerId,x:g.clientX,y:g.clientY,frame:w.frame,image:w.image,sides:$,corner:b,moved:!1})}function f(g){const $=l.value,b=t.state.session.table.factories.cropPicture;if(!d||g.pointerId!==d.pointer||!$||!b)return;const{dx:w,dy:S}=dk((g.clientX-d.x)/t.scale,(g.clientY-d.y)/t.scale,$.turn),{frame:C,image:E}=d.sides?pk(d.frame,rk(d.frame,d.image,d.sides,w,S),d.image,$.turn):d.corner?{frame:d.frame,image:wk(d.image,d.frame,d.corner,w,S)}:{frame:d.frame,image:{...d.image,x:Math.round(d.image.x+w),y:Math.round(d.image.y+S)}};d.moved=!0,t.state.session.document.live(T=>{b({slide:$.part,shape:$.id,frame:C,crop:Kp(E,C)})({presentation:T,dispatch:!0})})}function h(g){if(!d||g.pointerId!==d.pointer)return;const $=d.moved;d=null,$&&t.state.session.document.commit("裁剪图片")}function v(g){n.value===void 0||g.key!=="Escape"&&g.key!=="Enter"||(g.preventDefault(),g.stopPropagation(),n.value=void 0)}return window.addEventListener("keydown",v,!0),Re(()=>{window.removeEventListener("keydown",v,!0),s.value&&URL.revokeObjectURL(s.value)}),(g,$)=>l.value?(x(),M("div",{key:0,class:"pptx-crop-layer",onPointermove:f,onPointerup:h,onPointercancel:h,onPointerdown:$[1]||($[1]=J(()=>{},["stop"])),onDblclick:$[2]||($[2]=J(b=>n.value=void 0,["stop"]))},[k("div",{class:"pptx-crop-turn",style:fe(a.value)},[s.value?(x(),M("img",{key:0,class:"pptx-crop-ghost",src:s.value,alt:"",draggable:"false",style:fe({...o(l.value.image,l.value.frame),clipPath:i.value})},null,12,U3)):L("v-if",!0),(x(),M(U,null,H(u,([b,w])=>k("span",{key:b,class:Ne(["pptx-crop-scale",`pptx-crop-scale--${b}`]),style:fe(c(w)),role:"button","aria-label":"拖动缩放图片",onPointerdown:J(S=>p(S,null,w),["stop"])},null,46,N3)),64)),k("div",{class:"pptx-crop-frame",role:"img","aria-label":"裁剪区域:拖动边角调整,拖动内部移动图片,拖动图片四角的圆点缩放图片,回车或 Esc 完成",onPointerdown:$[0]||($[0]=b=>p(b,null))},[(x(),M(U,null,H(r,([b,w])=>k("span",{key:b,class:Ne(["pptx-crop-handle",`pptx-crop-handle--${b}`]),onPointerdown:J(S=>p(S,w),["stop"])},null,42,R3)),64))],32)],4)],32)):L("v-if",!0)}}),bh=new WeakMap;function cu(e){let t=bh.get(e);return t||(t=Q(),bh.set(e,t)),t}const K3=O({__name:"transparent-layer",props:{state:{},scale:{}},setup(e){const t=e,n=cu(t.state),l=F(()=>{t.state.tick.value;const r=n.value,u=t.state.current.value?.part,c=t.state.session.document.presentation(),d=u&&r!==void 0&&t.state.selected.value.includes(r)?Xe(c,u,r):null;if(!d||no(d.shape)==="svg")return null;const{rotation:p,...f}=d.frame,h=Ln(d.shape);return{id:r,part:u,frame:f,image:ys(f,$n(c,d.shape).crop),rotation:p,flip:h,shape:d.shape}});X(l,r=>{r||(n.value=void 0)});const s=Q();X(()=>l.value?.shape,async r=>{s.value=void 0;const u=r?un(r):null;if(u)try{const c=await createImageBitmap(new Blob([u.slice()])),d=new OffscreenCanvas(c.width,c.height).getContext("2d");d?.drawImage(c,0,0);const p=d?.getImageData(0,0,c.width,c.height).data;p&&l.value?.shape===r&&(s.value={data:p,width:c.width,height:c.height})}catch{s.value=void 0}},{immediate:!0});const o=F(()=>{const r=l.value;if(!r)return{};const{frame:u,rotation:c,flip:d}=r;return{left:`${u.x*t.scale}px`,top:`${u.y*t.scale}px`,width:`${u.width*t.scale}px`,height:`${u.height*t.scale}px`,transform:`rotate(${c}deg) scale(${d?.horizontal?-1:1}, ${d?.vertical?-1:1})`}});function a(r){const u=l.value,c=s.value;if(!u||!c)return;const d=u.frame.x+r.offsetX/t.scale,p=u.frame.y+r.offsetY/t.scale,f=Math.min(c.width-1,Math.max(0,Math.floor((d-u.image.x)/u.image.width*c.width))),h=(Math.min(c.height-1,Math.max(0,Math.floor((p-u.image.y)/u.image.height*c.height)))*c.width+f)*4,v=`#${[0,1,2].map(g=>c.data[h+g].toString(16).padStart(2,"0")).join("").toUpperCase()}`;t.state.session.commands.setPictureTransparentColor({slide:u.part,shapes:[u.id],color:v}),n.value=void 0}function i(r){n.value===void 0||r.key!=="Escape"||(r.preventDefault(),r.stopPropagation(),n.value=void 0)}return window.addEventListener("keydown",i,!0),Re(()=>window.removeEventListener("keydown",i,!0)),(r,u)=>l.value?(x(),M("div",{key:0,class:"pptx-transparent-layer",onPointerdown:u[0]||(u[0]=J(()=>{},["stop"]))},[k("div",{class:"pptx-transparent-pick",style:fe(o.value),role:"button","aria-label":"单击图片中要变透明的颜色,Esc 取消",onClick:a},null,4)],32)):L("v-if",!0)}}),ua=[["print",220,"打印(220 ppi)"],["screen",150,"网页与屏幕(150 ppi)"],["email",96,"电子邮件(96 ppi)"]],yh=914400;async function xh(e,t,n,l,s){const o=un(e),a=no(e);if(!o||a!=="png"&&a!=="jpeg")return null;const i=ys(t,n),r=await createImageBitmap(new Blob([o.slice()],{type:`image/${a}`})).catch(()=>null);if(!r)return null;const u=Math.min(1,i.width/yh*l/r.width,i.height/yh*l/r.height);if(u>.95)return null;const c=s.createElement("canvas");c.width=Math.max(1,Math.round(r.width*u)),c.height=Math.max(1,Math.round(r.height*u)),c.getContext("2d")?.drawImage(r,0,0,c.width,c.height),r.close();const d=await new Promise(f=>c.toBlob(f,`image/${a}`,.85));if(!d)return null;const p=new Uint8Array(await d.arrayBuffer());return p.length<o.length?p:null}const ca=512;function W3(e,t){const n=e.current.value?.part,l=e.session.document.presentation(),s=n&&t[0]!==void 0?le(l,n,t[0]):null;return!!(n&&s&&Gu(l,n,s))}async function q3(e,t,n,l,s){const o=e.current.value?.part;if(!o)return;const a=e.session.document.presentation(),i=new Map;for(const r of t){const u=le(a,o,r),c=u?Gu(a,o,u):null,d=c?jt(a,c):null,p=u?tt(u):null;if(!u||!d)continue;const f=p&&p.h>0?p.w/p.h:1,h=await wb(s,db(new TextDecoder().decode(d),n,l),f>=1?ca:ca*f,f>=1?ca/f:ca);h&&i.set(Fe(u),h)}e.session.commands.setSvgPictureColor({slide:o,shapes:t,color:n,paint:l,fallbacks:i})}const wh=[["1:1",1],["4:3",4/3],["3:4",3/4],["16:9",16/9],["9:16",9/16],["3:2",3/2],["2:3",2/3]],_3=[-.4,-.2,0,.2,.4],G3=[["row","横向排列"],["column","纵向排列"],["2","两列网格"],["3","三列网格"]],H3=[0,.15,.3,.5,.65,.8];function Q3(e){const t=e.current.value?.part,n=_e(e,["picture"])[0],l=e.session.document.presentation(),s=t&&n!==void 0?le(l,t,n):null;return s?$n(l,s):void 0}function kh(e,t,n,l){return{value:e,label:t,icon:n,kind:"menu",trigger:"disclosure",items:[{value:`${e}-choices`,label:t,kind:"radio-group",...l===void 0?{}:{selectedValue:`${e}:${l}`},children:_3.map(s=>({value:`${e}:${s}`,label:s===0?"正常":`${s>0?"+":""}${Math.round(s*100)}%`}))}]}}function X3(e){e.tick.value;const t=Q3(e),n=t?.recolor??void 0;return[{value:"picture:crop",kind:"split",label:"裁剪",icon:"crop",actionLabel:"裁剪",disclosureLabel:"裁剪选项",pressed:ra(e).value!==void 0,disabled:t?.locked===!0,disabledReason:"图片已锁定,不能裁剪。",items:[{value:"picture:crop-ratio",label:"按比例裁剪",kind:"submenu",children:wh.map(([l])=>({value:`picture:crop-ratio:${l}`,label:l}))},{value:"picture:crop-fill",label:"填充"},{value:"picture:crop-fit",label:"适应"},{value:"picture:crop-reset",label:"取消裁剪"}]},{value:"picture:crop-shape",label:"裁剪为形状",icon:"cropToShape",kind:"disclosure",contentRenderer:"drawingChangeShape",popup:"dialog",overlayProps:{width:"auto"}},{value:"picture:replace",label:"替换图片",icon:"replaceImage"},{value:"picture:reset",kind:"split",label:"重设图片",icon:"resetImage",actionLabel:"重设图片",disclosureLabel:"重设选项",items:[{value:"picture:reset-size",label:"重设大小",disabled:t?.locked===!0}]},vt("picture-style"),{value:"picture:style",label:"图片样式",icon:"pictureStyles",kind:"disclosure",contentRenderer:"pictureStyles",popup:"dialog",overlayProps:{width:"auto"}},...W3(e,_e(e,["picture"]))?[{value:"picture:svg-fill",label:"图形填充",icon:"fillColor",kind:"custom",renderer:"pictureSvgColor"},{value:"picture:svg-outline",label:"图形轮廓",icon:"outlineColor",kind:"custom",renderer:"pictureSvgColor"}]:[],{value:"shape-outline",label:"图片边框",icon:"outlineColor",kind:"custom",renderer:"color"},ia("picture",Es(e,_e(e,["picture"])),!1,"边框样式"),{value:"picture:effect",label:"图片效果",icon:"pictureEffects",kind:"disclosure",contentRenderer:"toolsEffects",popup:"dialog",overlayProps:{width:"auto"}},vt("picture-color"),kh("picture:brightness","亮度","brightness",t?.brightness),kh("picture:contrast","对比度","contrast",t?.contrast),{value:"picture:transparent",kind:"split",label:"设置透明色",icon:"pipette",actionLabel:"设置透明色",disclosureLabel:"透明色选项",pressed:cu(e).value!==void 0,disabled:t===void 0||t.format==="svg",disabledReason:"SVG 图标请用图形填充换色。",items:[{value:"picture:transparent-clear",label:"取消透明色",disabled:!t?.transparentColor}]},{value:"picture:recolor",label:"颜色",icon:"recolor",kind:"menu",trigger:"disclosure",items:[{value:"picture:recolor-choices",label:"颜色",kind:"radio-group",...n?{selectedValue:`picture:recolor:${n}`}:{},children:[["none","原色"],["grayscale","灰度"],["blackWhite","黑白"],["washout","冲蚀"]].map(([l,s])=>({value:`picture:recolor:${l}`,label:s}))}]},{value:"picture:transparency",label:"透明度",icon:"transparency",kind:"menu",trigger:"disclosure",items:[{value:"picture:transparency-choices",label:"透明度",kind:"radio-group",...t?{selectedValue:`picture:transparency:${Math.round((1-t.opacity)*100)/100}`}:{},children:H3.map(l=>({value:`picture:transparency:${l}`,label:`${Math.round(l*100)}%`}))}]},{value:"picture:set-background",label:"设为背景",kind:"menu",trigger:"disclosure",items:[{value:"picture:set-background",label:"设为当前幻灯片背景"},{value:"picture:set-background:all",label:"设为全部幻灯片背景"}]},{value:"picture:collage",label:"拼图",icon:"layoutGrid",kind:"menu",trigger:"disclosure",disabled:_e(e,["picture"]).length<2,disabledReason:"选择两张或更多图片来拼图。",items:G3.map(([l,s])=>({value:`picture:collage:${l}`,label:s}))},{value:"picture:save-image",label:"另存为图片",icon:"imageDown"},{value:"picture:compress",label:"压缩图片",icon:"compressImage",kind:"menu",trigger:"disclosure",items:ua.map(([l,,s])=>({value:`picture:compress:${l}`,label:s}))},vt("picture-arrange"),uu(e),Yo(e),vt("picture-size"),mh]}function Z3(e){e.tick.value;const t=_e(e,["picture"]),n=Es(e,t),l=e.current.value?.part,s=e.session.document.presentation(),o=l&&t[0]!==void 0?le(s,l,t[0]):null,a=o?un(o):null;return{presentation:s,outline:n?.lineColor??null,...n?{appearance:n}:{},subject:"picture",...dh(e),...o&&a?{picture:{id:I0(o)??String(t[0]),bytes:a}}:{}}}function $h(e,t){const n=new RegExp(`^${e}:line-(width|dash|compound|head|tail|headSize|tailSize|cap|join):(.+)$`,"u").exec(t);if(!n)return null;const[,l,s]=n;return l==="width"?{width:Number(s)}:{[l]:s}}function du(e){return typeof e=="object"&&e!==null&&typeof e.kind=="string"}function Y3(e,t,n){const l=_e(e,["text"]),{commands:s}=e.session;t.action==="more"?n.intent("show-panel:properties"):t.action==="fill"?He(e,l,(o,a)=>s.setShapeFillStyle({slide:o,shapes:a,fill:t.fill})):t.action==="opacity"?He(e,l,(o,a)=>s.setShapeFillOpacity({slide:o,shapes:a,opacity:t.opacity})):au(n.ownerDocument).then(o=>{o&&He(e,l,(a,i)=>s.setShapeFillStyle({slide:a,shapes:i,fill:{kind:"image",bytes:o}}))})}function J3(e){const t=e?.default;return t==="set"||t==="clear"}function eP(e,t){if(t==="clear"){Ms(e).value=void 0;return}const n=_e(e,["text"])[0];n!==void 0&&fS(e,n)&&e.toaster.create({type:"success",title:"已设为默认形状",description:"之后画的形状会沿用这个样式。"})}function tP(e,t,n,l){if(c3(e,t))return!0;if(!t.startsWith("drawing:"))return!1;const{commands:s}=e.session,o=_e(e,["text","connector"]),a=$h("drawing",t);if(a)He(e,o,(i,r)=>s.setShapeLineStyle({slide:i,shapes:r,line:a}));else if(t==="drawing:more")l.intent("show-panel:properties");else if(t==="drawing:size"&&p3(n))f3(e,n);else if(t==="drawing:style"&&J3(n))eP(e,n.default);else if(t==="drawing:style"&&typeof n=="string")He(e,_e(e,["text"]),(i,r)=>s.applyShapeStyle({slide:i,shapes:r,style:n}));else if(t==="drawing:fill"&&typeof n=="object"&&n!==null)Y3(e,n,l);else if(t==="drawing:arrows"&&typeof n=="string"){const i=Fp.find(r=>r.id===n);i&&He(e,o,(r,u)=>s.setShapeLineStyle({slide:r,shapes:u,line:{head:i.head,tail:i.tail}}))}else t==="drawing:effect"&&du(n)?He(e,o,(i,r)=>s.setShapeEffect({slide:i,shapes:r,effect:n})):t==="drawing:preset"&&typeof n=="string"&&He(e,_e(e,["text"]),(i,r)=>s.changeShapePreset({slide:i,shapes:r,preset:n}));return!0}function kt(e,t,n,l){const s=URL.createObjectURL(t instanceof Blob?t:new Blob([t],{type:l})),o=e.createElement("a");o.href=s,o.download=n,o.rel="noopener",o.style.display="none",e.body.append(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(s),1e3)}function Qn(e){return e.replace(/\.pptx$/iu,"")||"演示文稿"}let da;function Sh(e){if(!da){da=new Uint32Array(256);for(let n=0;n<256;n+=1){let l=n;for(let s=0;s<8;s+=1)l=l&1?3988292384^l>>>1:l>>>1;da[n]=l>>>0}}let t=4294967295;for(const n of e)t=da[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function Ch(e){const t=new TextEncoder,n=[],l=[];let s=0;for(const c of e){const d=t.encode(c.name),p=Sh(c.bytes),f=new DataView(new ArrayBuffer(30));f.setUint32(0,67324752,!0),f.setUint16(4,20,!0),f.setUint16(6,2048,!0),f.setUint32(14,p,!0),f.setUint32(18,c.bytes.length,!0),f.setUint32(22,c.bytes.length,!0),f.setUint16(26,d.length,!0),n.push(new Uint8Array(f.buffer),d,c.bytes);const h=new DataView(new ArrayBuffer(46));h.setUint32(0,33639248,!0),h.setUint16(4,20,!0),h.setUint16(6,20,!0),h.setUint16(8,2048,!0),h.setUint32(16,p,!0),h.setUint32(20,c.bytes.length,!0),h.setUint32(24,c.bytes.length,!0),h.setUint16(28,d.length,!0),h.setUint32(42,s,!0),l.push(new Uint8Array(h.buffer),d),s+=30+d.length+c.bytes.length}const o=l.reduce((c,d)=>c+d.length,0),a=new DataView(new ArrayBuffer(22));a.setUint32(0,101010256,!0),a.setUint16(8,e.length,!0),a.setUint16(10,e.length,!0),a.setUint32(12,o,!0),a.setUint32(16,s,!0);const i=[...n,...l,new Uint8Array(a.buffer)],r=new Uint8Array(i.reduce((c,d)=>c+d.length,0));let u=0;for(const c of i)r.set(c,u),u+=c.length;return r}function nP(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let n=-1;for(let a=e.length-22;a>=Math.max(0,e.length-65557);a-=1)if(t.getUint32(a,!0)===101010256){n=a;break}if(n<0)throw new Error("Not a zip archive.");const l=t.getUint16(n+10,!0);let s=t.getUint32(n+16,!0);const o=[];for(let a=0;a<l;a+=1){if(t.getUint32(s,!0)!==33639248)throw new Error("Broken zip directory.");const i=t.getUint16(s+28,!0),r=t.getUint16(s+30,!0),u=t.getUint16(s+32,!0);o.push({name:new TextDecoder().decode(e.subarray(s+46,s+46+i)),offset:t.getUint32(s+42,!0),record:s,recordLength:46+i+r+u,method:t.getUint16(s+10,!0),size:t.getUint32(s+20,!0)}),s+=46+i+r+u}return o}async function lP(e){const t=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate-raw"));return new Uint8Array(await new Response(t).arrayBuffer())}async function sP(e,t,n){const l=nP(e),s=l.find($=>$.name===t);if(!s)throw new Error(`${t} is not in the archive.`);const o=new DataView(e.buffer,e.byteOffset,e.byteLength),a=[...l].sort(($,b)=>$.offset-b.offset),i=Math.min(...l.map($=>$.record)),r=[],u=new Map;let c=0,d=null;for(const[$,b]of a.entries()){if(u.set(b,c),b!==s){const P=e.subarray(b.offset,a[$+1]?.offset??i);r.push(P),c+=P.length;continue}const w=o.getUint16(b.offset+26,!0),S=o.getUint16(b.offset+28,!0),C=b.offset+30+w+S,E=e.subarray(C,C+b.size),T=n(b.method===8?await lP(E):E.slice());d={data:T,crc:Sh(T)};const z=new Uint8Array(30+w);z.set(e.subarray(b.offset,b.offset+30+w));const D=new DataView(z.buffer);D.setUint16(6,D.getUint16(6,!0)&-9,!0),D.setUint16(8,0,!0),D.setUint32(14,d.crc,!0),D.setUint32(18,T.length,!0),D.setUint32(22,T.length,!0),D.setUint16(28,0,!0),r.push(z,T),c+=z.length+T.length}const p=c;for(const $ of l){const b=e.slice($.record,$.record+$.recordLength),w=new DataView(b.buffer);w.setUint32(42,u.get($),!0),$===s&&d&&(w.setUint16(8,w.getUint16(8,!0)&-9,!0),w.setUint16(10,0,!0),w.setUint32(16,d.crc,!0),w.setUint32(20,d.data.length,!0),w.setUint32(24,d.data.length,!0)),r.push(b),c+=b.length}const f=new Uint8Array(22),h=new DataView(f.buffer);h.setUint32(0,101010256,!0),h.setUint16(8,l.length,!0),h.setUint16(10,l.length,!0),h.setUint32(12,c-p,!0),h.setUint32(16,p,!0),r.push(f);const v=new Uint8Array(c+f.length);let g=0;for(const $ of r)v.set($,g),g+=$.length;return v}const Xn={presentation:"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml",template:"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml",slideShow:"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml"};function pu(e,t,n){return sP(e,"[Content_Types].xml",l=>{let s=new TextDecoder().decode(l);for(const o of t)s=s.replace(o,n);return new TextEncoder().encode(s)})}function oP(e){return pu(e,[Xn.presentation],Xn.template)}function aP(e){return pu(e,[Xn.presentation],Xn.slideShow)}function iP(e){return pu(e,[Xn.template,Xn.slideShow],Xn.presentation)}async function rP(e,t){return/\.(potx|ppsx)$/iu.test(e)?{name:e.replace(/\.(potx|ppsx)$/iu,".pptx"),bytes:await iP(t).catch(()=>t)}:{name:e,bytes:t}}const pa={short:210,long:297},Je={side:12,top:14,bottom:14,header:5,gap:6,cellGap:8,lineGap:5},uP={1:{portrait:[1,1],landscape:[1,1]},2:{portrait:[1,2],landscape:[2,1]},3:{portrait:[1,3],landscape:[3,1]},4:{portrait:[2,2],landscape:[2,2]},6:{portrait:[2,3],landscape:[3,2]},9:{portrait:[3,3],landscape:[3,3]}};function fa(e,t,n){const l=Math.min(e,t*n);return{width:l,height:l/n}}function Mh(e,t,n,l="horizontal"){const s=t==="landscape",[o,a]=s?[pa.long,pa.short]:[pa.short,pa.long],i=Je,r=i.side,u=i.top+i.header+i.gap,c=o-2*i.side,d=a-u-i.bottom,[p,f]=uP[e][t],h=(c-i.cellGap*(p-1))/p,v=(d-i.cellGap*(f-1))/f,g=e===3,$=Array.from({length:e},(b,w)=>{const S=l==="vertical"?Math.floor(w/f):w%p,C=l==="vertical"?w%f:Math.floor(w/p),E=r+S*(h+i.cellGap),T=u+C*(v+i.cellGap);if(!g){const P=fa(h,v,n);return{slide:{x:E+(h-P.width)/2,y:T+(v-P.height)/2,...P},lines:null}}if(s){const P=fa(h,(v-i.lineGap)/2,n);return{slide:{x:E+(h-P.width)/2,y:T,...P},lines:{x:E,y:T+P.height+i.lineGap,width:h,height:v-P.height-i.lineGap}}}const z=fa((h-i.lineGap)/2,v,n),D={x:E,y:T+(v-z.height)/2,...z};return{slide:D,lines:{x:E+z.width+i.lineGap,y:D.y,width:h-z.width-i.lineGap,height:z.height}}});return{page:{width:o,height:a},slots:$}}const ma={short:210,long:297};function Ph(e){return e.replace(/[&<>"]/gu,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}const Th=(e,t)=>t?`<img class="slide framed" style="width:${t.width.toFixed(2)}mm;height:${t.height.toFixed(2)}mm" src="${e.source}" alt="第 ${e.number} 页">`:`<img class="slide" src="${e.source}" alt="第 ${e.number} 页">`,Ah=e=>`position:absolute;left:${e.x.toFixed(2)}mm;top:${e.y.toFixed(2)}mm;width:${e.width.toFixed(2)}mm;height:${e.height.toFixed(2)}mm`;function cP(e,t,n,l,s={}){const o=Ph(l),a=n.width/n.height;let i,r,u;if(e.kind==="slides")i=`${n.width}in ${n.height}in`,r=`.page{width:${n.width}in;height:${n.height}in}.slide{width:100%;height:100%;box-sizing:border-box}${s.frame?".slide{border:0.3mm solid #666}":""}`,u=t.map(c=>`<section class="page">${Th(c)}</section>`);else{const[c,d]=e.kind==="handout"&&e.orientation==="landscape"?[ma.long,ma.short]:[ma.short,ma.long];i=`${c}mm ${d}mm`;const p=c-2*Je.side,f=d-Je.top-Je.bottom-Je.header-Je.gap,h=(v,g)=>`<header>${o}</header><footer>${v+1} / ${g}</footer>`;if(r=`.page{width:${c}mm;height:${d}mm;box-sizing:border-box;padding:${Je.top}mm ${Je.side}mm ${Je.bottom}mm;display:flex;flex-direction:column;gap:${Je.gap}mm;font:10pt sans-serif;color:#333;position:relative}header{height:${Je.header}mm;font-size:9pt;color:#666}footer{position:absolute;bottom:6mm;right:${Je.side}mm;font-size:9pt;color:#666}.framed{border:0.3mm solid #999;box-sizing:border-box;object-fit:contain}.lines{background:repeating-linear-gradient(to bottom,transparent 0 7.5mm,#bbb 7.5mm 7.8mm)}.notes{flex:1;white-space:pre-wrap;line-height:1.6;font-size:11pt;overflow:hidden}`,e.kind==="notes"){const v=fa(p*.85,f*.45,a);u=t.map((g,$)=>`<section class="page">${h($,t.length)}<div style="display:flex;justify-content:center">${Th(g,v)}</div><div class="notes">${Ph(g.notes)}</div></section>`)}else{const{slots:v}=Mh(e.perPage,e.orientation,a,s.order),g=(b,w)=>{const S=v[w],C=S.lines?`<div class="lines" style="${Ah(S.lines)}"></div>`:"";return`<img class="slide framed" style="${Ah(S.slide)}" src="${b.source}" alt="第 ${b.number} 页">${C}`},$=[];for(let b=0;b<t.length;b+=e.perPage)$.push(t.slice(b,b+e.perPage));u=$.map((b,w)=>`<section class="page">${h(w,$.length)}${b.map(g).join("")}</section>`)}}return`<!doctype html><html><head><meta charset="utf-8"><title>${o}</title><style>@page{size:${i};margin:0}html,body{margin:0;padding:0}.page{break-after:page;page-break-after:always;overflow:hidden;background:#fff}.page:last-child{break-after:auto;page-break-after:auto}img{display:block}${r}${s.grayscale?"img{filter:grayscale(1)}":""}</style></head><body>${u.join("")}</body></html>`}async function Eh(e,t,n=!1,l=!1){const s=await lc(await e.session.document.save(),{slides:{kind:"all"},includeHidden:!0,render:n?{textLayout:"svg",resolveFamily:r=>r??"sans-serif",measureText:am(document)}:void 0}),o=e.slides.value,a=Array.from({length:s.count},(r,u)=>u),i=e.current.value?.index??0;return{deck:s,positions:t.kind==="current"?[Math.min(i,s.count-1)]:t.kind==="range"?a.filter(r=>r+1>=t.start&&r+1<=t.end):a.filter(r=>l||o[r]?.hidden!==!0)}}const Fh=914400;async function zh(e,t,n,l={}){const{deck:s,positions:o}=await Eh(e,t,!1,l.includeHidden),a=o.map(i=>({source:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s.render(i))}`,number:i+1,notes:s.notes(i)}));return{html:cP(n,a,{width:s.size.width/Fh,height:s.size.height/Fh},e.session.name().replace(/\.pptx$/iu,""),l),count:a.length}}async function dP(e,t,n,l,s={}){const{html:o,count:a}=await zh(e,t,n,s);if(a===0)return 0;const i=l.createElement("iframe");i.setAttribute("aria-hidden","true"),i.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden",l.body.append(i);const r=i.contentDocument;r.open(),r.write(o),r.close(),await Promise.all([...r.images].map(d=>d.decode().catch(()=>{})));const u=i.contentWindow,c=()=>setTimeout(()=>i.remove(),1e3);return u.addEventListener("afterprint",c,{once:!0}),u.focus(),u.print(),a}const pP=32e3,fP=.012;async function mP(e,t,n,l=""){const s=t[0]?.width??0,o=Math.round(s*fP),a=t.reduce((p,f)=>p+f.height,0)+o*Math.max(0,t.length-1),i=Math.min(1,pP/Math.max(1,a)),r=e.createElement("canvas");r.width=Math.round(s*i),r.height=Math.round(a*i);const u=r.getContext("2d");if(!u)throw new Error("Canvas 2D is unavailable.");u.fillStyle="#f2f2f2",u.fillRect(0,0,r.width,r.height);let c=0;for(const p of t){const f=await createImageBitmap(new Blob([p.bytes],{type:n}));u.drawImage(f,0,c*i,p.width*i,p.height*i),f.close(),c+=p.height+o}l.trim()!==""&&hP(u,l.trim());const d=await new Promise(p=>r.toBlob(p,n,.92));if(!d)throw new Error("The long picture could not be encoded.");return{bytes:new Uint8Array(await d.arrayBuffer()),width:r.width,height:r.height}}function hP(e,t){const{width:n,height:l}=e.canvas,s=Math.max(14,Math.round(n*.03));e.save(),e.font=`${s}px sans-serif`,e.fillStyle="rgba(0, 0, 0, 0.12)",e.textBaseline="middle";const o=e.measureText(t).width+s*4,a=s*6;e.translate(n/2,l/2),e.rotate(-Math.PI/6);const i=Math.hypot(n,l)/2+o;for(let r=0,u=-i;u<=i;r+=1,u+=a)for(let c=-i+(r%2===0?0:o/2);c<=i;c+=o)e.fillText(t,c,u);e.restore()}const Dh={width:1240,height:1754,points:{width:595.28,height:841.89}},vP=/^[,。、;:!?)」』”’》〉,.;:!?)\]}]$/u;function gP(e,t,n){const l=[];for(const s of t.split(/\r?\n/u)){let o="";for(const a of s.match(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]|\s+|[^\s\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+/gu)??[""]){const i=o+a;o!==""&&!vP.test(a)&&e.measureText(i).width>n?(l.push(o.trimEnd()),o=a.trimStart()):o=i}l.push(o)}return l}async function bP(e,t,n,l,s){const{width:o,height:a}=Dh,i=e.createElement("canvas");i.width=o,i.height=a;const r=i.getContext("2d");if(!r)throw new Error("Canvas 2D is unavailable.");const u=110;r.fillStyle="#fff",r.fillRect(0,0,o,a),r.fillStyle="#666",r.font="22px sans-serif",r.fillText(s,u,80),r.fillText(`${l.number} / ${l.total}`,o-u-r.measureText(`${l.number} / ${l.total}`).width,a-60);const c=Math.min(o-2*u,(a/2-140)*t.width/t.height),d=c*t.height/t.width,p=(o-c)/2,f=120,h=await createImageBitmap(new Blob([t.bytes],{type:t.type}));r.drawImage(h,p,f,c,d),h.close(),r.strokeStyle="#999",r.lineWidth=2,r.strokeRect(p,f,c,d),r.fillStyle="#222",r.font="30px sans-serif";const v=48;let g=f+d+90;for(const b of gP(r,n,o-2*u)){if(g>a-110)break;r.fillText(b,u,g),g+=v}const $=await new Promise(b=>i.toBlob(b,"image/jpeg",.92));if(!$)throw new Error("The notes page could not be encoded.");return{bytes:new Uint8Array(await $.arrayBuffer()),width:o,height:a}}async function yP(e,t,n,l,s){const o=5.905511811023622,a=e.createElement("canvas");a.width=Math.round(t.page.width*o),a.height=Math.round(t.page.height*o);const i=a.getContext("2d");if(!i)throw new Error("Canvas 2D is unavailable.");i.fillStyle="#fff",i.fillRect(0,0,a.width,a.height),i.fillStyle="#666",i.font="22px sans-serif",i.fillText(s,Je.side*o,(Je.top+Je.header)*o);const r=`${l.number} / ${l.total}`;i.fillText(r,a.width-Je.side*o-i.measureText(r).width,a.height-6*o);for(const[c,d]of n.entries()){const p=t.slots[c];if(!p)break;const f=p.slide,h=await createImageBitmap(new Blob([d.bytes],{type:d.type}));if(i.drawImage(h,f.x*o,f.y*o,f.width*o,f.height*o),h.close(),i.strokeStyle="#999",i.lineWidth=2,i.strokeRect(f.x*o,f.y*o,f.width*o,f.height*o),p.lines){i.strokeStyle="#bbb",i.lineWidth=1.5;for(let v=p.lines.y+7.5;v<=p.lines.y+p.lines.height;v+=7.8)i.beginPath(),i.moveTo(p.lines.x*o,v*o),i.lineTo((p.lines.x+p.lines.width)*o,v*o),i.stroke()}}const u=await new Promise(c=>a.toBlob(c,"image/jpeg",.92));if(!u)throw new Error("The handout page could not be encoded.");return{bytes:new Uint8Array(await u.arrayBuffer()),width:a.width,height:a.height}}function fu(e,t,n){const l=new TextEncoder,s=[],o=[];let a=0;const i=$=>{const b=typeof $=="string"?l.encode($):$;s.push(b),a+=b.length},r=($,b)=>{o[$]=a,i(`${$} 0 obj
|
|
62
|
+
`),b(),i(`
|
|
63
|
+
endobj
|
|
64
|
+
`)},u=Lh(t.width),c=Lh(t.height),d=4,p=e.map(($,b)=>`${d+b*3} 0 R`).join(" ");i(`%PDF-1.4
|
|
65
|
+
%âãÏÓ
|
|
66
|
+
`),r(1,()=>i("<< /Type /Catalog /Pages 2 0 R >>")),r(2,()=>i(`<< /Type /Pages /Kids [${p}] /Count ${e.length} >>`)),r(3,()=>i(`<< /Title ${xP(n)} /Producer (QuireKit) >>`)),e.forEach(($,b)=>{const w=d+b*3,S=`q ${u} 0 0 ${c} 0 0 cm /Im0 Do Q`;r(w,()=>i(`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${u} ${c}] /Resources << /XObject << /Im0 ${w+2} 0 R >> >> /Contents ${w+1} 0 R >>`)),r(w+1,()=>i(`<< /Length ${S.length} >>
|
|
67
|
+
stream
|
|
68
|
+
${S}
|
|
69
|
+
endstream`)),r(w+2,()=>{i(`<< /Type /XObject /Subtype /Image /Width ${$.width} /Height ${$.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${$.jpeg.length} >>
|
|
70
|
+
stream
|
|
71
|
+
`),i($.jpeg),i(`
|
|
72
|
+
endstream`)})});const f=d+e.length*3,h=a;i(`xref
|
|
73
|
+
0 ${f}
|
|
74
|
+
0000000000 65535 f
|
|
75
|
+
`);for(let $=1;$<f;$+=1)i(`${String(o[$]).padStart(10,"0")} 00000 n
|
|
76
|
+
`);i(`trailer
|
|
77
|
+
<< /Size ${f} /Root 1 0 R /Info 3 0 R >>
|
|
78
|
+
startxref
|
|
79
|
+
${h}
|
|
80
|
+
%%EOF
|
|
81
|
+
`);const v=new Uint8Array(a);let g=0;for(const $ of s)v.set($,g),g+=$.length;return v}function Lh(e){return Math.round(e*100)/100}function xP(e){let t="FEFF";for(let n=0;n<e.length;n+=1)t+=e.charCodeAt(n).toString(16).padStart(4,"0").toUpperCase();return`<${t}>`}const Vh=12700;async function ha(e,t,n){const l=t.format==="png"?"image/png":"image/jpeg";for(const s of[!1,!0]){const{deck:o,positions:a}=await Eh(e,t.range,s);try{const i=[];for(const r of a)n(i.length,a.length),i.push(await ta(document,o.render(r),t.width,l));return n(i.length,a.length),{pictures:i,numbers:a.map(r=>r+1),positions:a,deck:o,size:o.size}}catch(i){if(!(i instanceof om)||s)throw i}}throw new Error("unreachable")}async function wP(e,t,n){const l=e.slides.value.findIndex(o=>o.part===t);if(l<0)throw new Error("The slide no longer exists.");const{pictures:s}=await ha(e,{format:"png",range:{kind:"range",start:l+1,end:l+1},width:n},()=>{});if(s[0]===void 0)throw new Error("The slide could not be drawn.");return s[0].bytes}async function kP(e,t,n=()=>{}){const l=Qn(e.session.name()),{pictures:s,numbers:o,size:a,deck:i,positions:r}=await ha(e,t,n);if(s.length===0)return 0;if(t.format==="pdf"&&t.handout){const p=Mh(t.handout.perPage,t.handout.orientation,a.width/a.height),f=[],h=Math.ceil(s.length/t.handout.perPage);for(let $=0;$<s.length;$+=t.handout.perPage){const b=s.slice($,$+t.handout.perPage).map(w=>({...w,type:"image/jpeg"}));f.push(await yP(document,p,b,{number:f.length+1,total:h},l))}const v={width:p.page.width*72/25.4,height:p.page.height*72/25.4},g=fu(f.map($=>({jpeg:$.bytes,width:$.width,height:$.height})),v,l);return kt(document,g,`${l}-讲义.pdf`,"application/pdf"),s.length}if(t.format==="pdf"&&t.notes){const p=[];for(const[h,v]of s.entries())p.push(await bP(document,{...v,type:"image/jpeg"},i.notes(r[h]),{number:h+1,total:s.length},l));const f=fu(p.map(h=>({jpeg:h.bytes,width:h.width,height:h.height})),Dh.points,l);return kt(document,f,`${l}-备注页.pdf`,"application/pdf"),s.length}if(t.format==="pdf"){const p=fu(s.map(f=>({jpeg:f.bytes,width:f.width,height:f.height})),{width:a.width/Vh,height:a.height/Vh},l);return kt(document,p,`${l}.pdf`,"application/pdf"),s.length}const u=t.format==="png"?"png":"jpg",c=t.format==="png"?"image/png":"image/jpeg";if(t.long&&s.length>1){const p=await mP(document,s,c,t.watermark);return kt(document,p.bytes,`${l}-长图.${u}`,c),s.length}const d=s.map((p,f)=>({name:`${l}-${o[f]}.${u}`,bytes:p.bytes}));if(d.length>1&&t.bundle==="zip")kt(document,Ch(d),`${l}.zip`,"application/zip");else for(const[p,f]of d.entries())p>0&&await new Promise(h=>setTimeout(h,250)),kt(document,f.bytes,f.name,c);return d.length}const Fs=9525,va=12,Ih=2;function $P(e){const t=e.rotation*Math.PI/180,[n,l]=[Math.abs(Math.cos(t)),Math.abs(Math.sin(t))],[s,o]=[e.width*n+e.height*l,e.width*l+e.height*n],[a,i]=[e.x+e.width/2,e.y+e.height/2];return{left:a-s/2,top:i-o/2,right:a+s/2,bottom:i+o/2}}function Bh(e,t){return t.has(Fe(e))||Yl(e)==="group"&&eo(e).some(n=>Bh(n,t))}async function SP(e,t,n,l){const s=new Image;s.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,await s.decode();const o=e.createElement("canvas");o.width=n,o.height=l,o.getContext("2d")?.drawImage(s,0,0,n,l);const a=await new Promise(i=>o.toBlob(i,"image/png"));if(!a)throw new Error("The picture could not be encoded.");return a}async function Oh(e,t,n){const l=e.current.value?.part,s=e.boxes.value.filter(b=>t.includes(b.id));if(!l||s.length===0)return null;const o=s.map($P),a=Math.min(...o.map(b=>b.left))/Fs-va,i=Math.min(...o.map(b=>b.top))/Fs-va,r=Math.max(...o.map(b=>b.right))/Fs+va-a,u=Math.max(...o.map(b=>b.bottom))/Fs+va-i,c=await dn(await e.session.document.save()),d=rl(c,l);if(!d)return null;const p=new Set(t);for(const b of Jg(d))Bh(b,p)||pn(b);const f=Hs(c,d,Wt(c,d,{background:!1,textLayout:"svg",measureText:am(n),resolveFamily:b=>b??"sans-serif"})),h=new DOMParser().parseFromString(f,"image/svg+xml").documentElement,v={width:Math.round(r*Ih),height:Math.round(u*Ih)};h.setAttribute("viewBox",`${a} ${i} ${r} ${u}`),h.setAttribute("width",String(v.width)),h.setAttribute("height",String(v.height));const g=await SP(n,new XMLSerializer().serializeToString(h),v.width,v.height),$=b=>Math.round(b*Fs);return{png:g,frame:{x:$(a),y:$(i),width:$(r),height:$(u)}}}async function CP(e,t,n){const l=await Oh(e,t,n);return l?(kt(n,l.png,`${Qn(e.session.name())}-图片.png`,"image/png"),!0):!1}function MP(e){const t=/^picture:(brightness|contrast|recolor|transparency):(.+)$/u.exec(e);if(!t)return null;const[,n,l]=t;if(n==="recolor")return{recolor:l};const s=Number(l);return Number.isFinite(s)?n==="transparency"?{opacity:1-s}:{[n]:s}:null}async function PP(e,t,n){const l=ua.find(([a])=>a===t),s=e.current.value?.part;if(!l||!s)return;let o=0;for(const a of _e(e,["picture"])){const i=e.session.document.presentation(),r=Xe(i,s,a);if(!r)continue;const u=await xh(r.shape,r.frame,$n(i,r.shape).crop,l[1],n.ownerDocument);u&&e.session.commands.setPictureImage({slide:s,shape:a,bytes:u,compression:l[0]})&&(o+=1)}e.toaster.create({type:o>0?"success":"info",title:o>0?`已压缩 ${o} 张图片`:"图片已足够小,无需压缩"})}function TP(e,t){const n=e.current.value?.part;if(!n||t.length===0)return;const l=e.session.document.presentation();let s=e.session.chain();for(const o of t){const a=Xe(l,n,o);a&&(s=s.cropPicture({slide:n,shape:o,frame:ys(a.frame,$n(l,a.shape).crop),crop:_n}))}s.run()}const AP=36e3;function EP(e,t,n,l){if(!t.startsWith("picture:"))return!1;const{commands:s}=e.session,o=_e(e,["picture"]),a=ra(e),i=MP(t),r=$h("picture",t);if(i)He(e,o,(u,c)=>s.setPictureColor({slide:u,shapes:c,color:i}));else if(r)He(e,o,(u,c)=>s.setShapeLineStyle({slide:u,shapes:c,line:r}));else if(t==="picture:crop")a.value=a.value===void 0?o[0]:void 0;else if(t.startsWith("picture:crop-ratio:")){const u=wh.find(([c])=>c===t.slice(19))?.[1];u&&He(e,o,(c,d)=>s.cropPictureToRatio({slide:c,shapes:d,ratio:u})),a.value=o[0]}else if(t==="picture:crop-reset")TP(e,o);else if(t==="picture:crop-fill"||t==="picture:crop-fit")He(e,o,(u,c)=>s.fitPicture({slide:u,shapes:c,mode:t==="picture:crop-fill"?"fill":"fit"}));else if(t==="picture:reset-size")He(e,o,(u,c)=>s.resetPictureSize({slide:u,shapes:c}));else if(t==="picture:crop-shape"&&typeof n=="string")He(e,o,(u,c)=>s.changeShapePreset({slide:u,shapes:c,preset:n}));else if(t==="picture:replace")au(l.ownerDocument).then(u=>{u&&He(e,o,(c,d)=>s.replacePicture({slide:c,shapes:d,bytes:u}))});else if(t==="picture:reset")He(e,o,(u,c)=>s.resetPicture({slide:u,shapes:c}));else if(t==="picture:style"&&typeof n=="string")He(e,o,(u,c)=>s.setPictureStyle({slide:u,shapes:c,style:n}));else if(t==="picture:effect"&&du(n))He(e,o,(u,c)=>s.setShapeEffect({slide:u,shapes:c,effect:n}));else if((t==="picture:svg-fill"||t==="picture:svg-outline")&&typeof n=="string")q3(e,o,n,t==="picture:svg-fill"?"fill":"stroke",l.ownerDocument);else if(t==="picture:transparent"){const u=cu(e);u.value=u.value===void 0?o[0]:void 0}else if(t==="picture:transparent-clear")He(e,o,(u,c)=>s.setPictureTransparentColor({slide:u,shapes:c,color:null}));else if(t.startsWith("picture:collage:")){const u=t.slice(16),c=u==="row"?o.length:u==="column"?1:Number(u);He(e,o,(d,p)=>s.arrangePictures({slide:d,shapes:p,columns:c,gap:AP}))}else if(t==="picture:more")l.intent("show-panel:properties");else if(t.startsWith("picture:compress:"))PP(e,t.slice(17),l);else if(t==="picture:save-image")CP(e,e.selected.value,l.ownerDocument).catch(()=>e.toaster.create({type:"error",title:"无法另存为图片"}));else if(t==="picture:set-background"||t==="picture:set-background:all"){const u=o[0],c=e.current.value?.part;u!==void 0&&c&&s.setPictureAsBackground({slide:c,shape:u,all:t.endsWith(":all")})&&e.toaster.create({type:"success",title:t.endsWith(":all")?"已设为全部幻灯片的背景":"已设为当前幻灯片的背景"})}return!0}const FP={class:"pptx-thumb-gallery"},zP=["src"],Mn=O({__name:"thumb-gallery",props:{sections:{},selected:{},columns:{},tileWidth:{}},emits:["pick"],setup(e,{emit:t}){const n=t;return(l,s)=>(x(),M("div",FP,[(x(!0),M(U,null,H(e.sections,o=>(x(),B(m(Ja),{key:o.label,label:o.label,presentation:"icons","max-columns":e.columns??6,"min-item-width":e.tileWidth??"44px",items:o.items.map(a=>({value:a.value,label:a.label,data:{image:a.image}})),"model-value":e.selected??null,"onUpdate:modelValue":s[0]||(s[0]=a=>a&&n("pick",a))},{preview:A(({item:a})=>[k("img",{class:"pptx-thumb-image",src:String(a.data?.image),alt:"",draggable:"false"},null,8,zP)]),_:1},8,["label","max-columns","min-item-width","items","model-value"]))),128))]))}}),DP={id:"picture",tabs:[{value:"picture-tools",label:"图片工具",order:105,contextual:e=>_e(e,["picture"]).length>0,entries:X3,context:Z3}],renderers:{pictureStyles:O({__name:"style-gallery",props:{scope:{}},setup(e){const t=e,n=F(()=>{const s=t.scope.context;return!t.scope.expanded||!s.picture?[]:[{label:"图片样式",items:vc.map(o=>({value:o,label:gk[o]??o,image:en(s.presentation,"picture",`style:${o}`,a=>cd(a,o),s.picture)}))}]});function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),B(Mn,{key:0,class:"pptx-tools-popup pptx-picture-styles",sections:n.value,columns:4,"tile-width":"80px",onPick:l,onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},null,8,["sections"])):L("v-if",!0)}}),pictureSvgColor:O({__name:"svg-fill",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.item.value==="picture:svg-outline"),l=V(n.value?"#2F528F":"#4472C4"),s=V(),o=V([]);X(()=>t.scope.expanded,()=>{s.value=void 0});const a=F(()=>({...t.scope,item:{...t.scope.item,iconAccentColor:l.value}}));function i(r){/^#[\da-f]{6}$/iu.test(r)&&(t.scope.execute(r),t.scope.setExpanded(!1),l.value=r,o.value=[r,...o.value.filter(u=>u!==r)].slice(0,8))}return(r,u)=>(x(),B(m(Po),{scope:a.value,"disclosure-label":n.value?"选择图形轮廓颜色":"选择图形填充颜色",color:s.value??l.value,"reset-active":!1,"recent-colors":o.value,"picker-props":{allowReset:!1,showMore:!0},onAction:u[0]||(u[0]=c=>i(l.value)),onPreview:u[1]||(u[1]=c=>s.value=c),onCommit:i},null,8,["scope","disclosure-label","color","recent-colors"]))}})},intent:EP,inspector:[{kinds:["picture"],component:O3}],stageLayers:[j3,K3]},Uh=O({__name:"arrow-gallery",props:{scope:{}},setup(e){const t=e,n=F(()=>{if(!t.scope.expanded)return[];const{presentation:s}=t.scope.context;return[{label:"箭头样式",items:Fp.map(o=>({value:o.id,label:o.label,image:en(s,"line",`arrow:${o.id}`,a=>vs(a,{head:o.head,tail:o.tail}))}))}]});function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),B(Mn,{key:0,class:"pptx-tools-popup",sections:n.value,columns:4,"tile-width":"80px",onPick:l,onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},null,8,["sections"])):L("v-if",!0)}}),mu=Symbol("pptx-workspace-state"),Nh=new WeakMap;function Rh(e){let t=Nh.get(e);return t||(t=Q(),Nh.set(e,t)),t}const LP=O({__name:"change-shape",props:{scope:{}},setup(e){const t=e,n=f1.filter(i=>i.id!=="lines").flatMap(i=>i.items.map(([r])=>r)),l=uc(mu),s=l?Rh(l):void 0;function o(i){s&&(s.value=i??void 0)}X(()=>t.scope.expanded,i=>{i||o(null)}),Re(()=>o(null));function a(i){o(null),t.scope.execute(i),t.scope.setExpanded(!1)}return(i,r)=>e.scope.expanded?(x(),B(m(Ed),{key:0,class:"pptx-tools-popup",label:"更改形状",presets:m(n),onSelect:a,onHighlight:o,onKeydown:r[0]||(r[0]=ue(J(u=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},null,8,["presets"])):L("v-if",!0)}}),VP={class:"pptx-effects-tiles"},IP=O({__name:"effects-popup",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context),l=F(()=>lh[n.value.subject]),s=V("shadow"),o=F(()=>t.scope.expanded?r3(n.value,s.value):{sections:[],effects:new Map});function a(r){const u=o.value.effects.get(r);u&&t.scope.execute(u)}function i(){t.scope.execute({kind:"none"}),t.scope.setExpanded(!1)}return(r,u)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-tools-popup pptx-effects-popup",onKeydown:u[1]||(u[1]=ue(J(c=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[y(m(al),{"model-value":s.value,items:l.value.map(c=>({value:c,label:m(iu)[c].slice(0,2)})),label:"效果类别",size:"sm",equal:"","onUpdate:modelValue":u[0]||(u[0]=c=>c&&(s.value=c))},null,8,["model-value","items"]),k("div",VP,[y(Mn,{sections:o.value.sections,columns:4,"tile-width":"80px",onPick:a},null,8,["sections"])]),y(m(q),{size:"sm",variant:"ghost",block:"",onClick:i},{default:A(()=>[...u[2]||(u[2]=[R("清除全部效果",-1)])]),_:1})],32)):L("v-if",!0)}}),BP={class:"pptx-fill-tiles"},OP={class:"pptx-fill-value"},UP={class:"pptx-fill-actions"},NP=O({__name:"fill-popup",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context),l=F(()=>{const c=new Map;if(!t.scope.expanded)return c;for(const d of bs(n.value.presentation))c.set(`gradient:${d.id}`,{kind:"gradient",...d.gradient});for(const[d]of vr)c.set(`pattern:${d}`,{kind:"pattern",preset:d,foreground:"accent1",background:"bg1"});return c}),s=F(()=>new Map([...bs(n.value.presentation).map(c=>[`gradient:${c.id}`,c.label]),...vr.map(([c,d])=>[`pattern:${c}`,d])])),o=F(()=>{const c=[...l.value].map(([d,p])=>({value:d,label:s.value.get(d)??d,image:en(n.value.presentation,"shape",`fill:${d}`,f=>hs(f,p))}));return[{label:"渐变",items:c.filter(d=>d.value.startsWith("gradient:"))},{label:"图案",items:c.filter(d=>d.value.startsWith("pattern:"))}]}),a=V([0]);X(()=>[t.scope.expanded,n.value.appearance?.fillOpacity],([,c])=>{a.value=[Math.round((1-(c??1))*100)]},{immediate:!0});function i(c){const d=l.value.get(c);d&&t.scope.execute({action:"fill",fill:d})}function r(){const c=a.value[0];c!==void 0&&c!==Math.round((1-(n.value.appearance?.fillOpacity??1))*100)&&t.scope.execute({action:"opacity",opacity:1-c/100})}function u(c){t.scope.execute({action:c}),t.scope.setExpanded(!1)}return(c,d)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-tools-popup pptx-fill-popup",onKeydown:d[3]||(d[3]=ue(J(p=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[k("div",BP,[y(Mn,{sections:o.value,columns:8,onPick:i},null,8,["sections"])]),k("div",{class:"pptx-fill-transparency",onPointerup:r,onKeyup:r},[d[4]||(d[4]=k("span",null,"透明度",-1)),y(m(il),{modelValue:a.value,"onUpdate:modelValue":d[0]||(d[0]=p=>a.value=p),label:"填充透明度","hide-label":"","show-value":!1,min:0,max:100,step:1,disabled:n.value.appearance?.fill==="none"||n.value.appearance?.fill==="pattern"},null,8,["modelValue","disabled"]),k("span",OP,N(a.value[0])+"%",1)],32),k("div",UP,[y(m(q),{size:"sm",variant:"outline",onClick:d[1]||(d[1]=p=>u("picture"))},{default:A(()=>[...d[5]||(d[5]=[R("图片填充…",-1)])]),_:1}),y(m(q),{size:"sm",variant:"ghost",onClick:d[2]||(d[2]=p=>u("more"))},{default:A(()=>[...d[6]||(d[6]=[R("更多设置",-1)])]),_:1})])],32)):L("v-if",!0)}}),RP={class:"pptx-style-actions"},jh=O({__name:"style-gallery",props:{scope:{}},setup(e){const t=e,n=[["outline","彩色轮廓"],["fill","彩色填充"],["light","浅色填充"],["intense","强烈效果"]],l=F(()=>{if(!t.scope.expanded)return[];const{presentation:a}=t.scope.context,i=Wu(a);return n.map(([r,u])=>({label:u,items:i.filter(c=>c.id.startsWith(`${r}-`)).map(c=>({value:c.id,label:c.label,image:en(a,"shape",`style:${c.id}`,d=>{hs(d,c.fill),vs(d,c.line),c.effect&&wn(d,c.effect),nt(d,{color:c.text})})}))}))});function s(a){t.scope.execute({default:a}),t.scope.setExpanded(!1)}function o(a){t.scope.execute(a),t.scope.setExpanded(!1)}return(a,i)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-tools-popup pptx-style-popup",onKeydown:i[2]||(i[2]=ue(J(r=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[y(Mn,{sections:l.value,columns:7,onPick:o},null,8,["sections"]),k("div",RP,[y(m(q),{size:"sm",variant:"outline",onClick:i[0]||(i[0]=r=>s("set"))},{default:A(()=>[...i[3]||(i[3]=[R("设为默认形状",-1)])]),_:1}),e.scope.context.hasDefault?(x(),B(m(q),{key:0,size:"sm",variant:"ghost",onClick:i[1]||(i[1]=r=>s("clear"))},{default:A(()=>[...i[4]||(i[4]=[R("恢复初始默认",-1)])]),_:1})):L("v-if",!0)])],32)):L("v-if",!0)}}),jP={class:"pptx-tools-size"},KP=O({__name:"size-fields",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context?.size),l=r=>String(Math.round(r/rt*100)/100),s=F(()=>n.value?{height:l(n.value.height),width:l(n.value.width)}:{height:"",width:""}),o=V({...s.value});X(s,r=>{o.value={...r}});const a=F(()=>t.scope.disabled||!n.value);function i(r){const u=Number(o.value[r]);if(o.value[r]===s.value[r]||!Number.isFinite(u)||u<.01){o.value={...s.value};return}t.scope.execute({[r]:u})}return(r,u)=>(x(),M("div",jP,[y(m(Fn),{label:"高度(厘米)",disabled:a.value,width:"72px"},{default:A(({size:c})=>[y(m(de),{modelValue:o.value.height,"onUpdate:modelValue":u[0]||(u[0]=d=>o.value.height=d),label:"高度(厘米)",size:c,disabled:a.value,min:.01,step:.1,width:"72px",onBlur:u[1]||(u[1]=d=>i("height")),onKeydown:u[2]||(u[2]=ue(d=>i("height"),["enter"]))},null,8,["modelValue","size","disabled"])]),_:1},8,["disabled"]),u[6]||(u[6]=k("span",{class:"pptx-tools-size-times text-qk-text-tertiary","aria-hidden":"true"},"×",-1)),y(m(Fn),{label:"宽度(厘米)",disabled:a.value,width:"72px"},{default:A(({size:c})=>[y(m(de),{modelValue:o.value.width,"onUpdate:modelValue":u[3]||(u[3]=d=>o.value.width=d),label:"宽度(厘米)",size:c,disabled:a.value,min:.01,step:.1,width:"72px",onBlur:u[4]||(u[4]=d=>i("width")),onKeydown:u[5]||(u[5]=ue(d=>i("width"),["enter"]))},null,8,["modelValue","size","disabled"])]),_:1},8,["disabled"])]))}});function WP(e,t,n){return!kd(e)||!(t>0)||!(n>0)?null:m1(e,t,n).paths.filter(l=>l.fill).map(l=>{const s=a=>`${(a.x*t/l.width).toFixed(2)} ${(a.y*n/l.height).toFixed(2)}`,o=a=>a.kind==="close-path"?"Z":a.kind==="bezier-curve-to"?`C${s(a.control1)} ${s(a.control2)} ${s(a.point)}`:a.kind==="quadratic-curve-to"?`Q${s(a.control)} ${s(a.point)}`:`${a.kind==="move-to"?"M":"L"}${s(a.point)}`;return l.segments.map(o).join(" ")}).join(" ")||null}const qP={key:0,class:"pptx-shape-preview-layer","aria-hidden":"true"},_P=["viewBox"],GP=["d"],HP=["d"],QP=O({__name:"layer",props:{state:{},scale:{}},setup(e){const t=e,n=Rh(t.state),l=F(()=>{t.state.tick.value;const s=n.value,o=t.state.current.value?.part;if(!s||!o)return[];const a=t.state.session.document.presentation();return t.state.selected.value.flatMap(i=>{const r=Xe(a,o,i);if(!r)return[];const{x:u,y:c,width:d,height:p,rotation:f}=r.frame,[h,v]=[d*t.scale,p*t.scale],g=WP(s,h,v);if(!g)return[];const $=Ln(r.shape);return[{id:i,outline:g,width:h,height:v,style:{left:`${u*t.scale}px`,top:`${c*t.scale}px`,width:`${h}px`,height:`${v}px`,transform:`rotate(${f}deg) scale(${$?.horizontal?-1:1}, ${$?.vertical?-1:1})`}}]})});return(s,o)=>l.value.length>0?(x(),M("div",qP,[L(" What the shape cuts away is veiled, and its outline drawn, until a shape is chosen or the gallery closes. "),(x(!0),M(U,null,H(l.value,a=>(x(),M("svg",{key:a.id,class:"pptx-shape-preview",style:fe(a.style),viewBox:`0 0 ${a.width} ${a.height}`},[k("path",{d:`M0 0 H${a.width} V${a.height} H0 Z ${a.outline}`,"fill-rule":"evenodd",class:"pptx-shape-preview__veil"},null,8,GP),k("path",{d:a.outline,class:"pptx-shape-preview__outline"},null,8,HP)],12,_P))),128))])):L("v-if",!0)}}),XP={key:0,class:"pptx-property-row"},ZP={class:"pptx-fill-value"},YP=O({__name:"fill-fields",props:{state:{},shapes:{},look:{}},setup(e){const t=e,n=[{value:"none",label:"无填充"},{value:"solid",label:"纯色填充"},{value:"gradient",label:"渐变填充"},{value:"image",label:"图片填充"},{value:"pattern",label:"图案填充"}],l=[["centre","从中心",{x:.5,y:.5}],["tl","从左上角",{x:0,y:0}],["tr","从右上角",{x:1,y:0}],["bl","从左下角",{x:0,y:1}],["br","从右下角",{x:1,y:1}]],s=F(()=>t.look.fillColor??t.look.gradient?.stops.at(-1)?.color??"#4472C4"),o=F(()=>t.look.gradient??{path:"linear",angle:90,stops:[{offset:0,color:Hu(s.value,"#FFFFFF",.6)},{offset:1,color:s.value}]}),a=F(()=>l.find(([,,g])=>g.x===(o.value.focus?.x??.5)&&g.y===(o.value.focus?.y??.5))?.[0]??"centre");function i(g){const $=t.state.current.value?.part;$&&t.state.session.commands.setShapeFillStyle({slide:$,shapes:t.shapes,fill:g})}async function r(g){if(g==="none")i({kind:"none"});else if(g==="solid")i({kind:"solid",color:s.value});else if(g==="gradient")i({kind:"gradient",...o.value});else if(g==="pattern")i({kind:"pattern",preset:"pct50",foreground:s.value,background:"#FFFFFF"});else if(g==="image"){const $=await au(document);$&&i({kind:"image",bytes:$})}}function u(g){i({kind:"gradient",...o.value,...g})}function c(g,$){$&&u({stops:o.value.stops.map((b,w)=>w===g?{...b,color:$}:b)})}const d=V("90");X(()=>o.value.angle,g=>{d.value=String(Math.round(g))},{immediate:!0});function p(){const g=Number(d.value);Number.isFinite(g)&&g!==o.value.angle&&u({angle:(g%360+360)%360})}const f=V([0]);X(()=>t.look.fillOpacity,g=>{f.value=[Math.round((1-g)*100)]},{immediate:!0});function h(){const g=t.state.current.value?.part,$=f.value[0];g&&$!==void 0&&$!==Math.round((1-t.look.fillOpacity)*100)&&t.state.session.commands.setShapeFillOpacity({slide:g,shapes:t.shapes,opacity:1-$/100})}const v=F(()=>t.look.fill==="solid"||t.look.fill==="gradient"||t.look.fill==="image");return(g,$)=>(x(),M(U,null,[y(m(ce),{"model-value":e.look.fill==="other"?"":e.look.fill,items:n,label:"填充类型",placeholder:"跟随版式",size:"sm",width:"100%","onUpdate:modelValue":r},null,8,["model-value"]),e.look.fill==="solid"?(x(),M("div",XP,[$[7]||($[7]=k("span",null,"颜色",-1)),y(m(an),{label:"填充颜色","model-value":e.look.fillColor??"#FFFFFF","show-alpha":!1,onCommit:$[0]||($[0]=b=>i({kind:"solid",color:m(lt)(b)??s.value}))},null,8,["model-value"])])):L("v-if",!0),e.look.fill==="gradient"?(x(),M(U,{key:1},[y(m(ce),{"model-value":o.value.path==="linear"?"linear":"radial",items:[{value:"linear",label:"线性渐变"},{value:"radial",label:"射线渐变"}],label:"渐变类型",size:"sm",width:"100%","onUpdate:modelValue":$[1]||($[1]=b=>u(b==="radial"?{path:"circle",focus:{x:.5,y:.5}}:{path:"linear"}))},null,8,["model-value"]),o.value.path==="linear"?(x(),M("div",{key:0,class:"pptx-property-row",onKeydown:ue(p,["enter"])},[$[8]||($[8]=k("span",null,"角度(度)",-1)),y(m(de),{modelValue:d.value,"onUpdate:modelValue":$[2]||($[2]=b=>d.value=b),label:"渐变角度",min:0,max:359,step:15,onBlur:p},null,8,["modelValue"])],32)):(x(),B(m(ce),{key:1,"model-value":a.value,items:l.map(([b,w])=>({value:b,label:w})),label:"射线方向",size:"sm",width:"100%","onUpdate:modelValue":$[3]||($[3]=b=>u({focus:l.find(([w])=>w===b)?.[2]??{x:.5,y:.5}}))},null,8,["model-value","items"])),(x(!0),M(U,null,H(o.value.stops.slice(0,2),(b,w)=>(x(),M("div",{key:w,class:"pptx-property-row"},[k("span",null,N(w===0?"起始颜色":"结束颜色"),1),y(m(an),{label:w===0?"起始颜色":"结束颜色","model-value":b.color,"show-alpha":!1,onCommit:S=>c(w===0?0:o.value.stops.length-1,m(lt)(S))},null,8,["label","model-value","onCommit"])]))),128))],64)):L("v-if",!0),e.look.fill==="pattern"?(x(),B(m(ce),{key:2,items:m(vr).map(([b,w])=>({value:b,label:w})),label:"图案",placeholder:"选择图案",size:"sm",width:"100%","onUpdate:modelValue":$[4]||($[4]=b=>b&&i({kind:"pattern",preset:b,foreground:s.value,background:"#FFFFFF"}))},null,8,["items"])):L("v-if",!0),e.look.fill==="image"?(x(),B(m(q),{key:3,size:"sm",variant:"outline",block:"",onClick:$[5]||($[5]=b=>r("image"))},{default:A(()=>[...$[9]||($[9]=[R("更换图片…",-1)])]),_:1})):L("v-if",!0),v.value?(x(),M("div",{key:4,class:"pptx-fill-transparency",onPointerup:h,onKeyup:h},[$[10]||($[10]=k("span",null,"透明度",-1)),y(m(il),{modelValue:f.value,"onUpdate:modelValue":$[6]||($[6]=b=>f.value=b),label:"填充透明度","hide-label":"","show-value":!1,min:0,max:100,step:1},null,8,["modelValue"]),k("span",ZP,N(f.value[0])+"%",1)],32)):L("v-if",!0)],64))}}),JP={key:0,class:"pptx-property-section","aria-label":"填充"},e4={class:"pptx-property-section","aria-label":"线条"},t4={class:"pptx-section-label"},n4={class:"pptx-property-section","aria-label":"效果"},Kh=O({__name:"shape-style",props:{state:{},shape:{}},setup(e){const t=e,n=F(()=>{t.state.tick.value;const l=t.state.current.value?.part,s=t.state.session.document.presentation(),o=l?le(s,l,t.shape):null;return o?{look:fs(s,o),line:zp(o)}:null});return(l,s)=>n.value?(x(),M(U,{key:0},[n.value.line?L("v-if",!0):(x(),M("section",JP,[s[0]||(s[0]=k("div",{class:"pptx-section-label"},[k("span",null,"填充")],-1)),y(YP,{state:e.state,shapes:[e.shape],look:n.value.look},null,8,["state","shapes","look"])])),k("section",e4,[k("div",t4,[k("span",null,N(n.value.line?"线条":"轮廓"),1)]),y(hh,{state:e.state,shapes:[e.shape],look:n.value.look,arrows:n.value.line,name:n.value.line?"线条":"轮廓"},null,8,["state","shapes","look","arrows","name"])]),k("section",n4,[s[1]||(s[1]=k("div",{class:"pptx-section-label"},[k("span",null,"效果")],-1)),y(sh,{state:e.state,shapes:[e.shape],look:n.value.look,subject:n.value.line?"line":"shape"},null,8,["state","shapes","look","subject"])])],64)):L("v-if",!0)}}),l4=O({__name:"section",props:{state:{},shape:{}},setup(e){const t=e,n=F(()=>{const l=t.state.boxes.value.find(s=>s.id===t.shape);return l!==void 0&&(l.kind==="connector"||l.kind==="text"&&l.placeholder!==null)});return(l,s)=>n.value?(x(),B(Kh,{key:0,state:e.state,shape:e.shape},null,8,["state","shape"])):L("v-if",!0)}}),s4={class:"pptx-property-section","aria-label":"缩放"},o4={class:"pptx-property-note text-qk-text-tertiary"},a4={class:"pptx-property-section","aria-label":"可选文字"},i4={id:"drawing",tabs:[{value:"drawing-tools",label:"绘图工具",order:110,contextual:e=>_e(e,["text","connector"]).length>0,entries:v3,context:g3}],renderers:{drawingStyles:jh,drawingFill:NP,toolsEffects:IP,drawingChangeShape:LP,drawingArrows:Uh,toolsSize:KP},intent:tP,stageLayers:[QP],inspector:[{kinds:["text","connector"],component:l4},{kinds:No,component:O({__name:"size-properties",props:{state:{},shape:{}},setup(e){const t=e,n=F(()=>{t.state.tick.value;const p=t.state.current.value?.part,f=p?le(t.state.session.document.presentation(),p,t.shape):null;return f?nk(f):null}),l=()=>t.state.current.value?.part,s=V({x:"100",y:"100"}),o=V({title:"",description:""});X(n,p=>{s.value={x:"100",y:"100"},p&&(o.value={title:p.title,description:p.description})},{immediate:!0});function a(p){n.value?.aspectLocked&&(s.value={x:s.value[p],y:s.value[p]})}function i(){const[p,f]=[Number(s.value.x)/100,Number(s.value.y)/100],h=l();h&&(p!==1||f!==1)&&t.state.session.commands.scaleShapes({slide:h,shapes:[t.shape],x:p,y:f}),s.value={x:"100",y:"100"}}function r(p){const f=l();f&&t.state.session.commands.setShapeAspectLock({slide:f,shapes:[t.shape],locked:p===!0})}function u(){const p=l();p&&t.state.session.commands.resetPictureSize({slide:p,shapes:[t.shape]})}function c(p){const f=l();f&&n.value&&o.value[p]!==n.value[p]&&t.state.session.commands.setShapeAltText({slide:f,shapes:[t.shape],[p]:o.value[p]})}const d=p=>Math.round(p/rt*100)/100;return(p,f)=>n.value?(x(),M(U,{key:0},[k("section",s4,[f[10]||(f[10]=k("div",{class:"pptx-section-label"},[k("span",null,"缩放"),k("span",{class:"text-qk-text-tertiary"},"%")],-1)),y(m(En),{checked:n.value.aspectLocked,label:"锁定纵横比","onUpdate:checked":r},null,8,["checked"]),k("div",{class:"pptx-property-grid",onKeydown:ue(i,["enter"])},[y(m(re),{label:"宽度比例"},{default:A(({controlProps:h})=>[y(m(de),ie(h,{modelValue:s.value.x,"onUpdate:modelValue":[f[0]||(f[0]=v=>s.value.x=v),f[1]||(f[1]=v=>a("x"))],label:"宽度比例",min:1,max:1e3,step:10,onBlur:i}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"高度比例"},{default:A(({controlProps:h})=>[y(m(de),ie(h,{modelValue:s.value.y,"onUpdate:modelValue":[f[2]||(f[2]=v=>s.value.y=v),f[3]||(f[3]=v=>a("y"))],label:"高度比例",min:1,max:1e3,step:10,onBlur:i}),null,16,["modelValue"])]),_:1})],32),n.value.natural?(x(),M(U,{key:0},[k("p",o4,"原始尺寸 "+N(d(n.value.natural.width))+" × "+N(d(n.value.natural.height))+" 厘米",1),y(m(q),{size:"sm",variant:"outline",block:"",onClick:u},{default:A(()=>[...f[9]||(f[9]=[R("恢复原始尺寸",-1)])]),_:1})],64)):L("v-if",!0)]),k("section",a4,[f[11]||(f[11]=k("div",{class:"pptx-section-label"},[k("span",null,"可选文字")],-1)),y(m(Oe),{modelValue:o.value.title,"onUpdate:modelValue":f[4]||(f[4]=h=>o.value.title=h),"aria-label":"可选文字标题",placeholder:"标题",onBlur:f[5]||(f[5]=h=>c("title")),onKeydown:f[6]||(f[6]=ue(h=>c("title"),["enter"]))},null,8,["modelValue"]),y(m(Ct),{modelValue:o.value.description,"onUpdate:modelValue":f[7]||(f[7]=h=>o.value.description=h),width:"100%","aria-label":"可选文字说明",placeholder:"说明:为读屏软件描述这个对象",rows:3,"auto-resize":"",onBlur:f[8]||(f[8]=h=>c("description"))},null,8,["modelValue"])])],64)):L("v-if",!0)}})}]},r4=[.25,.5,.75,1,1.5,2.25,3],Wh=[[-3,"很紧"],[-1.5,"紧密"],[0,"常规"],[3,"稀疏"],[6,"很松"]],u4=[["horz","横排"],["eaVert","竖排"],["vert","所有文字旋转 90°"],["vert270","所有文字旋转 270°"],["wordArtVert","堆积"]];function c4(e){return e.textSelection.value.length>0||e.textEditor.value!==void 0}function zs(e){const t=e.current.value?.part,n=e.textEditor.value?.shape??e.textSelection.value[0],l=e.session.document.presentation(),s=t&&n!==void 0?le(l,t,n):null;return s?xr(l,s):void 0}function qh(e){const t=e.textEditor.value?.shape;return t===void 0?e.textSelection.value:[t]}function d4(e){const t=e.current.value?.part,n=qh(e)[0],l=e.session.document.presentation(),s=t&&n!==void 0?le(l,t,n):null;return s?xs(l,s):void 0}function p4(e){const t={value:"text-tools:more",label:"更多文本框选项"};return[{value:"text-tools:autofit",label:"自动调整",icon:"textAutoFit",kind:"menu",trigger:"disclosure",items:[{value:"text-tools:autofits",label:"自动调整",kind:"radio-group",...e?{selectedValue:`text-tools:autofit:${e.autoFit}`}:{},children:[["none","不自动调整"],["normal","溢出时缩排文字"],["shape","根据文字调整形状大小"]].map(([n,l])=>({value:`text-tools:autofit:${n}`,label:l}))},{value:"text-tools:autofit-separator",label:"",kind:"separator"},t]},{value:"text-tools:wrap",label:"形状中的文字自动换行",icon:"textWrap",kind:"toggle",pressed:e?.wrap??!0},{value:"text-tools:columns",label:"分栏",icon:"columns",kind:"menu",trigger:"disclosure",items:[{value:"text-tools:column-counts",label:"分栏",kind:"radio-group",...e?{selectedValue:`text-tools:columns:${e.columns}`}:{},children:[[1,"一栏"],[2,"两栏"],[3,"三栏"]].map(([n,l])=>({value:`text-tools:columns:${n}`,label:l}))},{value:"text-tools:columns-separator",label:"",kind:"separator"},{value:"text-tools:more",label:"更多分栏"}]}]}function f4(e,t){const n=new Map;for(const l of bs(e.session.document.presentation())){const[s,o]=l.label.split(":");n.set(s,[...n.get(s)??[],{value:`text-tools:outline-gradient:${l.id}`,label:o}])}return{value:"text-tools:outline-width",label:"轮廓样式",icon:"lineWeight",kind:"menu",trigger:"disclosure",items:[{value:"text-tools:outline-width-menu",label:"粗细",kind:"submenu",children:[{value:"text-tools:outline-widths",label:"轮廓粗细",kind:"radio-group",...t?.outlineWidth?{selectedValue:`text-tools:outline-width:${t.outlineWidth}`}:{},children:r4.map(l=>({value:`text-tools:outline-width:${l}`,label:`${l} 磅`}))}]},{value:"text-tools:outline-gradients",label:"渐变",kind:"submenu",children:[...n].map(([l,s])=>({value:`text-tools:outline-gradient-${l}`,label:l,kind:"submenu",children:s}))}]}}function m4(e){e.tick.value,e.editorTick.value;const t=zs(e),n=t?Wh.find(([s])=>Math.abs(s-t.spacing)<.01)?.[0]:void 0,l=e.format.value?.direction??"horz";return[ph(e),vt("text-tools-insert"),{value:"text-tools:style",label:"艺术字样式",icon:"wordArtStyles",kind:"disclosure",contentRenderer:"textArtStyles",popup:"dialog",overlayProps:{width:"auto"}},vt("text-tools-fill"),{value:"text-color",label:"文本填充",icon:"textColor",kind:"custom",renderer:"color"},{value:"text-tools:fill",label:"渐变填充",icon:"gradientFill",kind:"disclosure",contentRenderer:"textGradients",popup:"dialog",overlayProps:{width:"auto"}},{value:"text-tools:outline",label:"文本轮廓",icon:"outlineColor",kind:"custom",renderer:"textOutlineColor"},f4(e,t),{value:"text-tools:warp",label:"转换",kind:"disclosure",contentRenderer:"textWarps",popup:"dialog",overlayProps:{width:"auto"}},{value:"text-tools:effect",label:"文本效果",icon:"textEffects",kind:"disclosure",contentRenderer:"toolsEffects",popup:"dialog",overlayProps:{width:"auto"}},vt("text-tools-layout"),{value:"text-tools:spacing",label:"字符间距",icon:"characterSpacing",kind:"menu",trigger:"disclosure",items:[{value:"text-tools:spacings",label:"字符间距",kind:"radio-group",...n===void 0?{}:{selectedValue:`text-tools:spacing:${n}`},children:Wh.map(([s,o])=>({value:`text-tools:spacing:${s}`,label:s===0?o:`${o}(${s>0?"+":""}${s} 磅)`}))}]},{value:"text-tools:direction",label:"文字方向",icon:"textDirectionVertical",kind:"menu",trigger:"disclosure",items:[{value:"text-tools:directions",label:"文字方向",kind:"radio-group",selectedValue:`direction-${l}`,children:u4.map(([s,o])=>({value:`direction-${s}`,label:o}))}]},...p4(d4(e))]}function h4(e){e.tick.value,e.editorTick.value;const t=zs(e);return{presentation:e.session.document.presentation(),color:e.format.value?.color??t?.color??null,outline:t?.outlineColor??null,subject:"text"}}const _h=9525;function v4(e,t,n){const l=[...e.querySelector(`.pptx-slide-art [data-pptx-shape-id="${t}"]`)?.querySelectorAll("foreignObject")??[]].find(r=>r.querySelector("p[data-pptx-paragraph]")),s=[...l?.querySelectorAll("p[data-pptx-paragraph]")??[]],o=Number(l?.getAttribute("height"));if(s.length===0||!Number.isFinite(o))return null;const a=Math.min(...s.map(r=>r.offsetTop)),i=Math.max(...s.map(r=>r.offsetTop+r.offsetHeight));return Math.max(_h,Math.round(n+(i-a-o)*_h))}async function Gh(e,t,n){const l=e.current.value?.part,s=e.session.table.factories.setTextBoxOptions,{document:o}=e.session;if(!(!l||!s||t.length===0)){o.live(a=>{s({slide:l,shapes:t,options:{autoFit:"shape"}})({presentation:a,dispatch:!0})}),await pt();for(const a of t){const i=le(o.presentation(),l,a),r=i?tt(i)?.h:void 0,u=r===void 0?null:v4(n,a,r);u!==null&&o.live(c=>{s({slide:l,shapes:[a],options:{},height:u})({presentation:c,dispatch:!0})})}o.commit("根据文字调整形状大小")}}function Hh(e,t,n,l){const s=e.textEditor.value?.shape;if(e.editParagraphs.value&&s!==void 0&&n.length===1&&n[0]===s){setTimeout(()=>{const o=e.editParagraphs.value;o&&e.textEditor.value?.shape===s?o(a=>e.session.commands.setTextBoxOptions({slide:t,shapes:[a],options:l})):e.session.commands.setTextBoxOptions({slide:t,shapes:n,options:l})});return}e.session.commands.setTextBoxOptions({slide:t,shapes:n,options:l})}function g4(e,t,n){if(t==="text-tools:more"){n.intent("show-panel:properties");return}const l=e.current.value?.part,s=qh(e);if(!l||s.length===0)return;const o=e.session.document.presentation(),a=i=>Hh(e,l,s,i);if(t==="text-tools:autofit:shape")Gh(e,s,n.ownerDocument);else if(t.startsWith("text-tools:autofit:"))a({autoFit:t.slice(19)});else if(t.startsWith("text-tools:columns:"))a({columns:Number(t.slice(19))});else if(t==="text-tools:wrap"){const i=le(o,l,s[0]);a({wrap:!(i&&xs(o,i).wrap)})}}function Zn(e,t){const n=e.current.value?.part;if(!n)return;const{commands:l}=e.session,s=e.editParagraphs.value;if(e.textEditor.value&&s){s((o,a)=>t(l,n,[o],a.end>a.start?a:void 0));return}e.textSelection.value.length>0&&t(l,n,e.textSelection.value,void 0)}const Qh=e=>zs(e)?.outlineWidth??.75,b4=e=>zs(e)?.outlineColor??"#000000";function y4(e){const t=e?.kind;return t==="solid"||t==="gradient"||t==="none"}function x4(e,t,n,l){if(!t.startsWith("text-tools:"))return!1;const s=o=>o?{range:o}:{};if(t==="text-tools:style"&&typeof n=="string")Zn(e,(o,a,i,r)=>o.applyWordArtStyle({slide:a,shapes:i,style:n,...s(r)}));else if(t==="text-tools:fill"&&y4(n))Zn(e,(o,a,i,r)=>o.setTextFill({slide:a,shapes:i,fill:n,...s(r)}));else if(t==="text-tools:outline"&&(n===null||typeof n=="string")){const o=Math.max(.75,Qh(e));Zn(e,(a,i,r,u)=>a.setTextOutline({slide:i,shapes:r,outline:n===null?null:{color:n,width:o},...s(u)}))}else if(t.startsWith("text-tools:outline-gradient:")){const o=bs(e.session.document.presentation()).find(i=>i.id===t.slice(28)),a=Math.max(1.5,Qh(e));o&&Zn(e,(i,r,u,c)=>i.setTextOutline({slide:r,shapes:u,outline:{gradient:o.gradient,width:a},...s(c)}))}else if(t.startsWith("text-tools:outline-width:")){const o=Number(t.slice(25)),a=zs(e)?.outlineFill==="gradient";Zn(e,(i,r,u,c)=>i.setTextOutline({slide:r,shapes:u,outline:a?{width:o}:{color:b4(e),width:o},...s(c)}))}else if(t==="text-tools:effect"&&du(n))Zn(e,(o,a,i,r)=>o.setTextEffect({slide:a,shapes:i,effect:n,...s(r)}));else if(t==="text-tools:warp"&&(n===null||typeof n=="string")){const o=e.current.value?.part,a=e.textEditor.value?[e.textEditor.value.shape]:e.textSelection.value;o&&a.length>0&&e.session.commands.setTextWarp({slide:o,shapes:a,warp:n})}else if(t.startsWith("text-tools:spacing:")){const o=Number(t.slice(19));Zn(e,(a,i,r,u)=>a.setCharacterSpacing({slide:i,shapes:r,points:o,...s(u)}))}else g4(e,t,l);return!0}const w4=O({__name:"gradient-popup",props:{scope:{}},setup(e){const t=e,n=F(()=>{const s=new Map;if(!t.scope.expanded)return{fills:s,sections:[]};const{presentation:o}=t.scope.context,a=bs(o).filter(r=>!r.id.endsWith("-corner")),i=(r,u)=>en(o,"text",`text-fill:${r}`,c=>nt(c,{textFill:{kind:"gradient",...ms(u)}}));for(const r of a)s.set(r.id,{kind:"gradient",...r.gradient});return s.set("none",{kind:"none"}),{fills:s,sections:[{label:"渐变",items:a.map(r=>({value:r.id,label:r.label,image:i(r.id,r.gradient)}))},{label:"其他",items:[{value:"none",label:"无填充(只留轮廓)",image:en(o,"text","text-fill:none",r=>nt(r,{textFill:{kind:"none"},outline:{color:"tx1",widthEmu:9525}}))}]}]}});function l(s){const o=n.value.fills.get(s);o&&t.scope.execute(o),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),B(Mn,{key:0,class:"pptx-tools-popup",sections:n.value.sections,columns:6,"tile-width":"56px",onPick:l,onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},null,8,["sections"])):L("v-if",!0)}}),k4=O({__name:"outline-color",props:{scope:{}},setup(e){const t=e,n=V("#C0392B"),l=F(()=>t.scope.context?.outline??null),s=V(),o=V([]);X(()=>t.scope.expanded,()=>{s.value=void 0});const a=F(()=>({...t.scope,item:{...t.scope.item,iconAccentColor:n.value}}));function i(r){r!==null&&!/^#[\da-f]{6}$/iu.test(r)||(t.scope.setExpanded(!1),t.scope.execute(r),r!==null&&(n.value=r,o.value=[r,...o.value.filter(u=>u!==r)].slice(0,8)))}return(r,u)=>(x(),B(m(Po),{scope:a.value,"disclosure-label":"选择文本轮廓颜色",color:s.value??l.value??n.value,"reset-active":!l.value,"recent-colors":o.value,"picker-props":{resetLabel:"无轮廓",showMore:!0},onAction:u[0]||(u[0]=c=>i(n.value)),onPreview:u[1]||(u[1]=c=>s.value=c),onCommit:i,onReset:u[2]||(u[2]=c=>i(null))},null,8,["scope","color","reset-active","recent-colors"]))}}),$4=O({__name:"style-gallery",props:{scope:{}},setup(e){const t=e,n=F(()=>{if(!t.scope.expanded)return[];const{presentation:s}=t.scope.context;return[{label:"艺术字样式",items:Qp.map(o=>({value:o.id,label:o.label,image:en(s,"text",`wordart:${o.id}`,a=>nt(a,{...Xp,...o.format}))}))}]});function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),B(Mn,{key:0,class:"pptx-tools-popup",sections:n.value,columns:4,"tile-width":"80px",onPick:l,onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},null,8,["sections"])):L("v-if",!0)}}),Xh={none:"无转换",textArchUp:"上弯弧",textArchDown:"下弯弧",textCircle:"圆",textWave1:"波形 1",textWave2:"波形 2",textDoubleWave1:"双波形 1",textWave4:"双波形 2",textCanUp:"上弯",textCanDown:"下弯",textCurveUp:"上升曲线",textCurveDown:"下降曲线",textChevron:"正 V 形",textChevronInverted:"倒 V 形",textSlantUp:"右上斜",textSlantDown:"右下斜",textInflate:"膨胀",textDeflate:"收缩",textInflateTop:"上部膨胀",textInflateBottom:"下部膨胀",textDeflateTop:"上部收缩",textDeflateBottom:"下部收缩",textTriangle:"正三角",textTriangleInverted:"倒三角",textFadeRight:"右远",textFadeLeft:"左远",textStop:"停止"},S4=O({__name:"warp-gallery",props:{scope:{}},setup(e){const t=e,n=F(()=>{if(!t.scope.expanded)return[];const{presentation:s}=t.scope.context,o=i=>({value:i,label:Xh[i]??i,image:en(s,"text",`warp:${i}`,r=>{Wg(r,i==="none"?null:i)})}),a=Object.keys(Xa).filter(i=>Xh[i]);return[{label:"跟随路径",items:["none",...a.filter(i=>Xa[i].kind==="path")].map(o)},{label:"弯曲",items:a.filter(i=>Xa[i].kind==="envelope").map(o)}]});function l(s){t.scope.execute(s==="none"?null:s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),B(Mn,{key:0,class:"pptx-tools-popup pptx-warp-gallery",sections:n.value,columns:5,"tile-width":"64px",onPick:l,onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},null,8,["sections"])):L("v-if",!0)}}),C4={key:0,class:"pptx-property-section","aria-label":"文本框"},M4={class:"pptx-tools-field"},P4={id:"text-tools",tabs:[{value:"text-tools",label:"文本工具",order:120,contextual:c4,entries:m4,context:h4}],renderers:{textArtStyles:$4,textGradients:w4,textOutlineColor:k4,textWarps:S4},intent:x4,inspector:[{kinds:["text"],component:O({__name:"text-box",props:{state:{},shape:{}},setup(e){const t=e,n=F(()=>{t.state.tick.value;const p=t.state.current.value?.part,f=t.state.session.document.presentation(),h=p?le(f,p,t.shape):null;return h?xs(f,h):null}),l=[{value:"none",label:"不自动调整"},{value:"normal",label:"溢出时缩排文字"},{value:"shape",label:"根据文字调整形状大小"}],s=[["left","左边距"],["right","右边距"],["top","上边距"],["bottom","下边距"]],o=p=>String(Math.round(p/rt*100)/100),a=V({left:"0",right:"0",top:"0",bottom:"0"}),i=V({count:"1",gap:"0"});X(n,p=>{p&&(a.value={left:o(p.margins.left),right:o(p.margins.right),top:o(p.margins.top),bottom:o(p.margins.bottom)},i.value={count:String(p.columns),gap:o(p.columnGap)})},{immediate:!0});function r(p){const f=t.state.current.value?.part;f&&Hh(t.state,f,[t.shape],p)}function u(p){!p||p===n.value?.autoFit||(p==="shape"?Gh(t.state,[t.shape],document):r({autoFit:p}))}function c(){const p=n.value,f=Math.round(Number(i.value.count)),h=Math.round(Number(i.value.gap)*rt);!p||!(f>=1&&f<=16)||!(h>=0)||(f!==p.columns||h!==p.columnGap)&&r({columns:f,columnGap:h})}function d(){const p=n.value,f=Object.fromEntries(s.map(([h])=>[h,Math.round(Number(a.value[h])*rt)]));p&&Object.values(f).every(h=>Number.isFinite(h)&&h>=0)&&s.some(([h])=>f[h]!==p.margins[h])&&r({margins:f})}return(p,f)=>n.value?(x(),M("section",C4,[f[4]||(f[4]=k("div",{class:"pptx-section-label"},[k("span",null,"文本框"),k("span",{class:"text-qk-text-tertiary"},"厘米")],-1)),k("div",M4,[f[3]||(f[3]=k("span",null,"自动调整",-1)),y(m(ce),{"model-value":n.value.autoFit,items:l,label:"自动调整",size:"sm",width:"100%","onUpdate:modelValue":u},null,8,["model-value"])]),y(m(En),{checked:n.value.wrap,label:"形状中的文字自动换行","onUpdate:checked":f[0]||(f[0]=h=>r({wrap:h===!0}))},null,8,["checked"]),k("div",{class:"pptx-property-grid",onKeydown:ue(d,["enter"])},[(x(),M(U,null,H(s,([h,v])=>y(m(re),{key:h,label:v},{default:A(({controlProps:g})=>[y(m(de),ie({ref_for:!0},g,{modelValue:a.value[h],"onUpdate:modelValue":$=>a.value[h]=$,label:v,min:0,step:.05,onBlur:d}),null,16,["modelValue","onUpdate:modelValue","label"])]),_:2},1032,["label"])),64))],32),k("div",{class:"pptx-property-grid",onKeydown:ue(c,["enter"])},[y(m(re),{label:"栏数"},{default:A(({controlProps:h})=>[y(m(de),ie(h,{modelValue:i.value.count,"onUpdate:modelValue":f[1]||(f[1]=v=>i.value.count=v),label:"栏数",min:1,max:16,step:1,onBlur:c}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"栏间距"},{default:A(({controlProps:h})=>[y(m(de),ie(h,{modelValue:i.value.gap,"onUpdate:modelValue":f[2]||(f[2]=v=>i.value.gap=v),label:"栏间距",min:0,step:.05,onBlur:c}),null,16,["modelValue"])]),_:1})],32)])):L("v-if",!0)}})}]};let ga;const Zh=new Map;function T4(e){const t=Mt(e),n=JSON.stringify(t);ga??=(()=>{const s=_a();return wo(s,{width:j(1625600),height:j(914400)}),s})(),t&&gl(ga,t);const l=pe(ga)[0];return Array.from({length:12},(s,o)=>{const a=o+1,i=Zh.get(`${n}|${a}`);if(i)return i;gd(l,a);const r=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Wt(ga,l))}`;return Zh.set(`${n}|${a}`,r),r})}const A4=["aria-label","title","onClick"],E4=["src"],F4=O({__name:"background-styles",props:{scope:{}},setup(e){const t=e,n=F(()=>{const s=t.scope.context?.state;return!t.scope.expanded||!s?[]:(s.tick.value,T4(s.session.document.presentation()))});function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-background-styles",role:"group","aria-label":"背景样式",onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(!0),M(U,null,H(n.value,(a,i)=>(x(),M("button",{key:i,type:"button",class:"pptx-background-style","aria-label":`背景样式 ${i+1}`,title:`背景样式 ${i+1}`,onClick:r=>l(i+1)},[k("img",{src:a,alt:"",draggable:"false"},null,8,E4)],8,A4))),128))],32)):L("v-if",!0)}}),z4={hyperlink:"#0563C1",followedHyperlink:"#954F72"},D4={dark1:"#000000",light1:"#FFFFFF"};function $t(e,t,n,l){const[s,o,a,i,r,u]=l;return{name:e,colors:{...D4,dark2:t,light2:n,accent1:s,accent2:o,accent3:a,accent4:i,accent5:r,accent6:u,...z4}}}const Ds=[$t("Office","#44546A","#E7E6E6",["#4472C4","#ED7D31","#A5A5A5","#FFC000","#5B9BD5","#70AD47"]),$t("灰度","#000000","#F8F8F8",["#DDDDDD","#B2B2B2","#969696","#808080","#5F5F5F","#4D4D4D"]),$t("沉稳蓝","#1F3B57","#E8EEF4",["#1F5FA8","#2E86C1","#5DADE2","#1ABC9C","#7F8C8D","#34495E"]),$t("科技","#0F172A","#E2E8F0",["#2563EB","#0EA5E9","#14B8A6","#8B5CF6","#F59E0B","#EF4444"]),$t("海洋","#0B3C5D","#E6F1F6",["#0B7A9F","#328CC1","#5CC2C6","#1D2731","#D9B310","#F06C64"]),$t("清新绿","#23483B","#EAF3EE",["#2E8B57","#6BBF59","#A3D977","#3FA7A0","#F2C14E","#8C6E54"]),$t("森林","#2F3E2E","#EEF0E8",["#4A6B3D","#7D9A4F","#B5C689","#C98B4B","#6E5A47","#3C6E71"]),$t("暖橙","#4A2C1D","#FBEFE6",["#D4441C","#F08A24","#F4B942","#8E5B3E","#4E7D7A","#9AA0A6"]),$t("中国红","#5A1A1A","#F8ECE8",["#C0392B","#D35400","#E6B33C","#7F1D1D","#5D6D7E","#A04000"]),$t("紫罗兰","#3B2A55","#F1ECF7",["#6C4AB6","#8D72E1","#B9A5E8","#E36BAE","#4FB0C6","#F2A65A"]),$t("莫兰迪","#4A4A48","#EFEBE7",["#9E8F84","#B5A69A","#8A9A8F","#A3B1B4","#C2A89D","#8C8C9E"]),$t("商务金","#2B2B2B","#F2EFE9",["#B08D57","#7A6A53","#3E4A59","#8C9AA6","#C9B79C","#5E5E5E"])];function Pn(e,t,n){return{name:e,fonts:{majorLatin:t[0],majorEastAsian:t[1],minorLatin:n[0],minorEastAsian:n[1]}}}const Ls=[Pn("Office",["Calibri Light","等线 Light"],["Calibri","等线"]),Pn("微软雅黑",["Arial","微软雅黑"],["Arial","微软雅黑"]),Pn("黑体与宋体",["Arial","黑体"],["Times New Roman","宋体"]),Pn("黑体与楷体",["Arial","黑体"],["Georgia","楷体"]),Pn("黑体与仿宋",["Arial","黑体"],["Times New Roman","仿宋"]),Pn("经典衬线",["Georgia","宋体"],["Georgia","宋体"]),Pn("现代简约",["Segoe UI Semibold","微软雅黑"],["Segoe UI","微软雅黑 Light"]),Pn("思源",["Source Sans Pro","思源黑体"],["Source Serif Pro","思源宋体"])],L4=36e4,Vs=[{id:"16x9",label:"宽屏(16:9)",width:12192e3,height:6858e3},{id:"4x3",label:"标准(4:3)",width:9144e3,height:6858e3},{id:"16x10",label:"宽屏(16:10)",width:12192e3,height:762e4},{id:"a4",label:"A4 纸张",width:9906e3,height:6858e3}],V4=["aria-pressed","onClick"],I4={class:"pptx-scheme-swatches","aria-hidden":"true"},B4={class:"pptx-scheme-name"},O4=O({__name:"color-schemes",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context?.colors??-1);function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-scheme-list",role:"group","aria-label":"配色方案",onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(!0),M(U,null,H(m(Ds),(a,i)=>(x(),M("button",{key:a.name,type:"button",class:"pptx-scheme","aria-pressed":i===n.value,onClick:r=>l(i)},[k("span",I4,[(x(),M(U,null,H(["dark2","light2","accent1","accent2","accent3","accent4","accent5","accent6"],r=>k("i",{key:r,style:fe({background:a.colors[r]})},null,4)),64))]),k("span",B4,N(a.name),1)],8,V4))),128))],32)):L("v-if",!0)}}),Yh=e=>({value:e,label:"",kind:"separator"});function U4(e){const t=e.current.value===void 0,n=N4(e);return[...wt(e),{value:"design:theme",label:"主题",icon:"designTheme",kind:"disclosure",indicator:!0,contentRenderer:"designThemes",disabled:t,overlayProps:{width:"auto"}},{value:"design:colors",label:"配色方案",icon:"colorScheme",kind:"disclosure",indicator:!0,contentRenderer:"designColors",overlayProps:{width:"auto"}},{value:"design:fonts",label:"字体方案",icon:"fontLibrary",kind:"disclosure",indicator:!0,contentRenderer:"designFonts",overlayProps:{width:"auto"}},{value:"design:background-style",label:"背景样式",icon:"backgroundStyle",kind:"disclosure",indicator:!0,contentRenderer:"designBackgrounds",disabled:t,overlayProps:{width:"auto"}},Yh("design-background"),{value:"design:background-format",label:"背景格式",tooltip:"背景格式:在属性面板设置当前幻灯片的纯色、渐变或图片背景",icon:"fillColor",disabled:t},Yh("design-size"),{value:"design:size",kind:"menu",trigger:"disclosure",label:"幻灯片大小",icon:"slideSize",items:[...Vs.map(l=>({value:`design:size:${l.id}`,label:l.label,...l.id===n?{icon:"check"}:{}})),{value:"design:size-separator",label:"",kind:"separator"},{value:"design:size-dialog",label:"自定义大小…"}]}]}function Jh(e){e.tick.value;const t=e.session.document.presentation(),n=Mt(t),l=Xl(t),s=(o,a)=>(o??"").toUpperCase()===a.toUpperCase();return{colors:n?Ds.findIndex(o=>["accent1","accent2","accent3","accent4","accent5","accent6","dark2","light2"].every(a=>s(n[a],o.colors[a]))):-1,fonts:l?Ls.findIndex(o=>l.majorEastAsian===o.fonts.majorEastAsian&&l.minorEastAsian===o.fonts.minorEastAsian&&l.majorLatin===o.fonts.majorLatin&&l.minorLatin===o.fonts.minorLatin):-1,state:e}}function N4(e){e.tick.value;const t=Rt(e.session.document.presentation());return t?Vs.find(n=>Math.abs(n.width-t.width)<1e3&&Math.abs(n.height-t.height)<1e3)?.id:void 0}const R4=["aria-pressed","aria-label","onClick"],j4={class:"pptx-font-scheme-name"},K4=O({__name:"font-schemes",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context?.fonts??-1);function l(o){t.scope.execute(o),t.scope.setExpanded(!1)}const s=(o,a)=>`"${o}", "${a}", sans-serif`;return(o,a)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-scheme-list",role:"group","aria-label":"字体方案",onKeydown:a[0]||(a[0]=ue(J(i=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(!0),M(U,null,H(m(Ls),(i,r)=>(x(),M("button",{key:i.name,type:"button",class:"pptx-font-scheme","aria-pressed":r===n.value,"aria-label":`${i.name}:标题 ${i.fonts.majorEastAsian},正文 ${i.fonts.minorEastAsian}`,onClick:u=>l(r)},[k("span",j4,N(i.name),1),k("span",{class:"pptx-font-scheme-heading",style:fe({fontFamily:s(i.fonts.majorLatin,i.fonts.majorEastAsian)})},"标题 Heading",4),k("span",{class:"pptx-font-scheme-body",style:fe({fontFamily:s(i.fonts.minorLatin,i.fonts.minorEastAsian)})},"正文 Body",4)],8,R4))),128))],32)):L("v-if",!0)}}),W4=["innerHTML"],q4=["onPointerdown"],_4=["onPointerdown"],ba=O({__name:"layout-picture",props:{svg:{},placeholders:{},size:{},editable:{type:Boolean}},emits:["bounds"],setup(e,{emit:t}){const n=e,l=t,s=Q(),o=F(()=>n.placeholders.map(c=>s.value?.index===c.index?{...c,bounds:s.value.bounds}:c)),a=c=>({left:`${c.x/n.size.width*100}%`,top:`${c.y/n.size.height*100}%`,width:`${c.width/n.size.width*100}%`,height:`${c.height/n.size.height*100}%`});function i(c,d,p){!n.editable||!d.own||(c.stopPropagation(),c.currentTarget.setPointerCapture(c.pointerId),s.value={index:d.index,mode:p,pointer:c.pointerId,x:c.clientX,y:c.clientY,start:d.bounds,bounds:d.bounds})}function r(c){const d=s.value;if(!d||d.pointer!==c.pointerId)return;const p=c.currentTarget.closest(".pptx-layout-picture").getBoundingClientRect(),f=n.size.width/p.width,h=(c.clientX-d.x)*f,v=(c.clientY-d.y)*f,{start:g}=d,$=d.mode==="move"?{...g,x:Math.round(g.x+h),y:Math.round(g.y+v)}:{...g,width:Math.max(18e4,Math.round(g.width+h)),height:Math.max(18e4,Math.round(g.height+v))};s.value={...d,bounds:$}}function u(c){const d=s.value;!d||d.pointer!==c.pointerId||(s.value=void 0,d.bounds!==d.start&&l("bounds",d.index,d.bounds))}return(c,d)=>(x(),M("div",{class:"pptx-layout-picture",style:fe({aspectRatio:`${e.size.width} / ${e.size.height}`})},[k("div",{class:"pptx-layout-art","aria-hidden":"true",innerHTML:e.svg},null,8,W4),(x(!0),M(U,null,H(o.value,p=>(x(),M("div",{key:p.index,class:Ne(["pptx-layout-placeholder",{editable:e.editable&&p.own,[`type-${p.type}`]:!0}]),style:fe(a(p.bounds)),onPointerdown:f=>i(f,p,"move"),onPointermove:r,onPointerup:u,onPointercancel:d[0]||(d[0]=f=>s.value=void 0)},[k("span",null,N(p.label),1),e.editable&&p.own?(x(),M("i",{key:0,class:"pptx-layout-resize","aria-hidden":"true",onPointerdown:f=>i(f,p,"resize"),onPointermove:r,onPointerup:u},null,40,_4)):L("v-if",!0)],46,q4))),128))],4))}}),G4={title:"单击此处编辑母版标题样式",ctrTitle:"单击此处编辑母版标题样式",subTitle:"单击此处编辑母版副标题样式",body:"单击此处编辑母版文本样式",obj:"单击此处编辑母版文本样式",dt:"日期",ftr:"页脚",sldNum:"编号",pic:"图片",chart:"图表",tbl:"表格",media:"媒体",dgm:"智能图形"};function H4(e){return ss(e).map(t=>({part:t,name:Z0(e,t),layouts:ls(e,t).map(n=>({part:Vt(n),name:Lt(n),usedBy:ki(e,n).map(l=>Vn(e,l)+1),layout:n}))}))}function hu(e,t,n){const l=yi(e,t);return(n?ns(n):l).flatMap((s,o)=>{const a=s.type??"obj",i=l.find(u=>(u.type??"obj")===(a==="ctrTitle"?"title":a==="subTitle"||a==="obj"?"body":a))?.bounds,r=s.bounds??i;return r?[{index:o,type:a,label:G4[a]??s.name,bounds:{x:r.x,y:r.y,width:r.w,height:r.h},own:!!n}]:[]})}const ev={"Title Slide":"标题幻灯片","Title and Content":"标题和内容","Section Header":"节标题","Two Content":"两栏内容",Comparison:"比较","Title Only":"仅标题",Blank:"空白","Content with Caption":"内容与标题","Picture with Caption":"图片与标题","Title and Vertical Text":"标题和竖排文字","Vertical Title and Text":"竖排标题与文本","Custom Layout":"自定义版式"};function Q4(e){const t=/^(\d+_)(.+)$/u.exec(e);return t?`${ev[t[2]]??t[2]} ${t[1].slice(0,-1)}`:ev[e]??e}const X4=["aria-label"],Z4=["aria-pressed","onClick"],Y4=O({__name:"layout-gallery",props:{scope:{}},setup(e){const t=e,n=uc(mu),l=F(()=>{if(!t.scope.expanded)return[];n.tick.value;const o=n.session.document.presentation(),a=n.current.value?.part,i=a?n.slide(a):null,r=i?Pt(i):null,u=r?Vt(r):void 0,c=ss(o).find(d=>ls(o,d).some(p=>Vt(p)===u))??ss(o)[0];return c?ls(o,c).map(d=>({part:Vt(d),name:Lt(d),current:Vt(d)===u,svg:qi(o,d),placeholders:hu(o,c,d)})):[]});function s(o){t.scope.execute({name:o.name,part:o.part}),t.scope.setExpanded(!1)}return(o,a)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-layout-gallery",role:"group","aria-label":e.scope.item.label,onKeydown:a[0]||(a[0]=ue(J(i=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(!0),M(U,null,H(l.value,i=>(x(),M("button",{key:i.part,type:"button",class:"pptx-layout-option","aria-pressed":i.current,onClick:r=>s(i)},[y(ba,{svg:i.svg,placeholders:i.placeholders,size:m(n).size.value},null,8,["svg","placeholders","size"]),k("span",null,N(m(Q4)(i.name)),1)],8,Z4))),128))],40,X4)):L("v-if",!0)}}),tv=new WeakMap;function nv(e){let t=tv.get(e);return t||(t={sizeDialog:Q(!1)},tv.set(e,t)),t}const lv=[{name:"简约",colors:0,fonts:1,background:"#FFFFFF",marks:[{kind:"rect",x:0,y:0,width:.012,height:1,color:"#4472C4"}]},{name:"商务",colors:2,fonts:1,background:"#FFFFFF",marks:[{kind:"rect",x:0,y:.93,width:1,height:.07,color:"#1F3B57"},{kind:"rect",x:0,y:.918,width:1,height:.006,color:"#2E86C1"}]},{name:"雅致",colors:10,fonts:5,background:"#EFEBE7",marks:[{kind:"triangle",points:[[1,0],[1,.32],[.82,0]],color:"#B5A69A"},{kind:"rect",x:.06,y:.9,width:.12,height:.006,color:"#9E8F84"}]},{name:"清新",colors:5,fonts:6,background:"#FFFFFF",marks:[{kind:"rect",x:0,y:0,width:1,height:.035,color:"#2E8B57"},{kind:"circle",x:.97,y:.95,radius:.12,color:"#EAF3EE"}]},{name:"暖阳",colors:7,fonts:1,background:"#FBF6F1",marks:[{kind:"rect",x:.955,y:0,width:.045,height:1,color:"#D4441C"},{kind:"rect",x:.94,y:0,width:.006,height:1,color:"#F4B942"}]},{name:"中国红",colors:8,fonts:2,background:"#FFFFFF",marks:[{kind:"rect",x:0,y:0,width:1,height:.06,color:"#C0392B"},{kind:"rect",x:0,y:.066,width:1,height:.004,color:"#E6B33C"}]},{name:"科技",colors:3,fonts:6,background:"#F8FAFC",marks:[{kind:"triangle",points:[[0,1],[.16,1],[0,.72]],color:"#2563EB"},{kind:"triangle",points:[[0,1],[.08,1],[0,.86]],color:"#0EA5E9"}]},{name:"学院",colors:4,fonts:5,background:"#FFFFFF",marks:[{kind:"rect",x:.05,y:.08,width:.004,height:.84,color:"#0B7A9F"},{kind:"rect",x:.05,y:.92,width:.9,height:.003,color:"#5CC2C6"}]}];function J4(e,t,n){const l=new OffscreenCanvas(t,n),s=l.getContext("2d");s.fillStyle=e.background,s.fillRect(0,0,t,n);for(const o of e.marks)s.fillStyle=o.color,o.kind==="rect"?s.fillRect(o.x*t,o.y*n,o.width*t,o.height*n):o.kind==="circle"?(s.beginPath(),s.arc(o.x*t,o.y*n,o.radius*t,0,Math.PI*2),s.fill()):(s.beginPath(),o.points.forEach(([a,i],r)=>r===0?s.moveTo(a*t,i*n):s.lineTo(a*t,i*n)),s.closePath(),s.fill());return l}async function eT(e,t,n){const l=await J4(e,t,n).convertToBlob({type:"image/png"});return new Uint8Array(await l.arrayBuffer())}function tT(e){const l=e.marks.map(s=>s.kind==="rect"?`<rect x="${s.x*160}" y="${s.y*90}" width="${s.width*160}" height="${s.height*90}" fill="${s.color}"/>`:s.kind==="circle"?`<circle cx="${s.x*160}" cy="${s.y*90}" r="${s.radius*160}" fill="${s.color}"/>`:`<polygon points="${s.points.map(([o,a])=>`${o*160},${a*90}`).join(" ")}" fill="${s.color}"/>`);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 90" preserveAspectRatio="none"><rect width="160" height="90" fill="${e.background}"/>${l.join("")}</svg>`}function nT(e,t,n,l){if(!t.startsWith("design:"))return!1;const{commands:s}=e.session,o=e.current.value?.part;if(t==="design:colors"&&typeof n=="number"){const a=Ds[n];a&&s.setThemeColors({colors:a.colors,name:a.name})}else if(t==="design:fonts"&&typeof n=="number"){const a=Ls[n];a&&s.setThemeFonts({fonts:a.fonts})}else if(t==="design:background-style"&&typeof n=="number"&&o)s.setMasterBackgroundStyle({slide:o,style:n})&&e.renders.clear();else if(t==="design:theme"&&typeof n=="number"&&o)lT(e,o,n);else if(t==="design:background-format")e.session.document.select({slide:o??null,shapes:[]}),l.intent("show-panel:properties");else if(t==="design:size-dialog")nv(e).sizeDialog.value=!0;else if(t==="design:apply-layout"&&sv(n)&&o)s.setSlideLayout({slide:o,layout:n.name});else if(t==="design:new-slide"&&sv(n)){const a=e.current.value?.index??-1;if(s.addSlideOnLayout({layout:n.part,...a<0?{}:{after:a}})){const i=e.slides.value[a+1];i&&e.session.document.select({slide:i.part,shapes:[]})}}return!0}function sv(e){return typeof e=="object"&&e!==null&&typeof e.name=="string"&&typeof e.part=="string"}async function lT(e,t,n){const l=lv[n],s=l?Ds[l.colors]:void 0,o=l?Ls[l.fonts]:void 0;if(!l||!s||!o)return;const a=e.size.value,i=await eT(l,1920,Math.round(1920*a.height/a.width));e.session.chain().setThemeColors({colors:s.colors,name:s.name}).setThemeFonts({fonts:o.fonts}).setSlideBackgroundFill({slide:t,fill:{kind:"picture",bytes:i}}).applyBackgroundToAll({slide:t}).run()&&e.renders.clear()}const sT={class:"pptx-size-sides"},oT=O({__name:"slide-size-dialog",props:{state:{}},setup(e){const t=e,n=nv(t.state).sizeDialog,l=V(""),s=V(""),o=V("fit"),a=[...Vs.map(p=>({value:p.id,label:p.label})),{value:"custom",label:"自定义"}],i=p=>String(Math.round(p/L4*100)/100);X(n,p=>{if(!p)return;const f=Rt(t.state.session.document.presentation());l.value=i(f?.width??12192e3),s.value=i(f?.height??6858e3),o.value="fit"});const r=F({get:()=>Vs.find(p=>i(p.width)===l.value&&i(p.height)===s.value)?.id??"custom",set:p=>{const f=Vs.find(h=>h.id===p);f&&(l.value=i(f.width),s.value=i(f.height))}}),u=F({get:()=>Number(l.value)>=Number(s.value)?"landscape":"portrait",set:p=>{p!==u.value&&([l.value,s.value]=[s.value,l.value])}}),c=F(()=>[l.value,s.value].map(Number).every(p=>Number.isFinite(p)&&p>=2.54&&p<=142.24));function d(){c.value&&t.state.session.commands.setDeckSlideSize({width:Number(l.value)*36e4,height:Number(s.value)*36e4,content:o.value})&&(n.value=!1)}return(p,f)=>(x(),B(m(Ae),{open:m(n),"onUpdate:open":f[6]||(f[6]=h=>n.value=h)},{default:A(()=>[y(m(Te),{title:"幻灯片大小",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:f[5]||(f[5]=h=>n.value=!1)},{default:A(()=>[...f[7]||(f[7]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!c.value,onClick:d},{default:A(()=>[...f[8]||(f[8]=[R("确定",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("form",{class:"pptx-size-form",onSubmit:J(d,["prevent"])},[y(m(re),{label:"幻灯片大小"},{default:A(({controlProps:h})=>[y(m(ce),ie(h,{modelValue:r.value,"onUpdate:modelValue":f[0]||(f[0]=v=>r.value=v),label:"幻灯片大小",items:a}),null,16,["modelValue"])]),_:1}),k("div",sT,[y(m(re),{label:"宽度(厘米)"},{default:A(({controlProps:h})=>[y(m(de),ie(h,{modelValue:l.value,"onUpdate:modelValue":f[1]||(f[1]=v=>l.value=v),label:"宽度(厘米)",min:2.54,max:142.24,step:.1}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"高度(厘米)"},{default:A(({controlProps:h})=>[y(m(de),ie(h,{modelValue:s.value,"onUpdate:modelValue":f[2]||(f[2]=v=>s.value=v),label:"高度(厘米)",min:2.54,max:142.24,step:.1}),null,16,["modelValue"])]),_:1})]),y(m(Ke),{modelValue:u.value,"onUpdate:modelValue":f[3]||(f[3]=h=>u.value=h),label:"方向",orientation:"horizontal",items:[{value:"landscape",label:"横向"},{value:"portrait",label:"纵向"}]},null,8,["modelValue"]),y(m(Ke),{modelValue:o.value,"onUpdate:modelValue":f[4]||(f[4]=h=>o.value=h),label:"内容",items:[{value:"fit",label:"缩放内容以适合新大小"},{value:"keep",label:"保持内容大小"}]},null,8,["modelValue"])],32)]),_:1})]),_:1},8,["open"]))}}),aT=["aria-label","onClick"],iT={class:"pptx-theme-accents"},rT={class:"pptx-theme-name"},uT={id:"design",tabs:[{value:"design",label:"设计",order:20,entries:U4,context:Jh}],renderers:{designColors:O4,designFonts:K4,designBackgrounds:F4,layoutGallery:Y4,designThemes:O({__name:"theme-gallery",props:{scope:{}},setup(e){const t=e,n=lv.map(s=>{const o=Ds[s.colors].colors,a=Ls[s.fonts].fonts;return{name:s.name,background:`url("data:image/svg+xml;charset=utf-8,${encodeURIComponent(tT(s))}")`,heading:{color:o.dark2,fontFamily:`"${a.majorLatin}", "${a.majorEastAsian}", sans-serif`},accents:[o.accent1,o.accent2,o.accent3]}});function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-theme-gallery",role:"group","aria-label":"主题",onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(!0),M(U,null,H(m(n),(a,i)=>(x(),M("button",{key:a.name,type:"button",class:"pptx-theme-tile","aria-label":`主题:${a.name}`,onClick:r=>l(i)},[k("span",{class:"pptx-theme-art",style:fe({backgroundImage:a.background})},[k("span",{class:"pptx-theme-heading",style:fe(a.heading)},"标题",4),k("span",iT,[(x(!0),M(U,null,H(a.accents,r=>(x(),M("i",{key:r,style:fe({background:r})},null,4))),128))])],4),k("span",rT,N(a.name),1)],8,aT))),128))],32)):L("v-if",!0)}})},intent:nT,overlays:[oT]},Se=O({__name:"icon-action",props:{icon:{},label:{},disabled:{type:Boolean},pressed:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=t;return(l,s)=>(x(),B(m(Xb),{placement:"top","open-delay":400},{default:A(()=>[y(m(Zb),{"as-child":""},{default:A(()=>[y(m(ye),{label:e.label,size:"sm",variant:"ghost",disabled:e.disabled,"aria-pressed":e.pressed,"data-pressed":e.pressed||void 0,onClick:s[0]||(s[0]=o=>n("click",o))},{default:A(()=>[y(m(me),{name:e.icon},null,8,["name"])]),_:1},8,["label","disabled","aria-pressed","data-pressed"])]),_:1}),y(m(Qb),{content:e.label},null,8,["content"])]),_:1}))}}),cT={class:"pptx-accessibility-panel"},dT={class:"pptx-panel-header"},pT={class:"pptx-accessibility-body"},fT={class:"pptx-accessibility-summary",role:"status"},mT={class:"pptx-accessibility-advice"},hT=["data-severity","onClick"],vT={class:"pptx-accessibility-where"},gT={class:"pptx-accessibility-detail"},bT=["onSubmit"],yT=12,xT=O({__name:"accessibility-panel",props:{state:{},host:{}},emits:["close"],setup(e,{emit:t}){const n=e,l=t,s=[["missing-alt","缺少替代文字","为图片、图表和组合写一句说明,屏幕阅读器会读出它。"],["missing-title","缺少幻灯片标题","给每张幻灯片一个标题,便于按标题浏览。"],["duplicate-title","幻灯片标题重复","让每张幻灯片的标题能区分开。"],["reading-order","阅读顺序","在选择窗格中调整对象顺序:列表最下面的对象最先读出。"],["low-contrast","文字对比度不足","加深文字颜色或换浅色背景,让文字更易辨认。"]],o=Jk(),a=Q({issues:[],pending:0});let i,r;function u(){const{document:w}=n.state.session,S=w.presentation(),C=w.version();i?.presentation===S&&i.version===C&&a.value.pending===0||(clearTimeout(r),i={presentation:S,version:C},a.value=o.check(S,{budgetMs:yT,revision:C}),a.value.pending>0&&(r=setTimeout(u,0)))}X(()=>n.state.settled.value,u,{immediate:!0}),Re(()=>clearTimeout(r));const c=F(()=>a.value.issues),d=F(()=>s.map(([w,S,C])=>({kind:w,title:S,advice:C,items:c.value.filter(E=>E.kind===w)})).filter(w=>w.items.length>0)),p=F(()=>c.value.filter(w=>w.severity==="error").length),f=V(),h=V(""),v=w=>`${w.kind}:${w.slide}:${w.shape??""}`;function g(w){n.state.session.document.select({slide:w.slide,shapes:w.shape===null?[]:[w.shape]}),w.kind==="reading-order"&&n.host.intent("show-panel:selection")}function $(w){g(w),f.value=v(w),h.value="",pt(()=>n.host.ownerDocument.querySelector(".pptx-accessibility-alt input")?.focus())}function b(w){w.shape!==null&&h.value.trim()&&n.state.session.commands.setShapeAltText({slide:w.slide,shapes:[w.shape],description:h.value.trim()}),f.value=void 0}return(w,S)=>(x(),M("div",cT,[k("div",dT,[S[2]||(S[2]=k("span",{class:"qk-type-label"},"辅助功能",-1)),y(Se,{icon:"close",label:"关闭辅助功能窗格",onClick:S[0]||(S[0]=C=>l("close"))})]),k("div",pT,[k("p",fT,N(c.value.length===0?a.value.pending>0?"正在检查":"没有发现问题":`${p.value} 个错误,${c.value.length-p.value} 个警告`)+N(a.value.pending>0?`,还有 ${a.value.pending} 张待查对比度`:""),1),(x(!0),M(U,null,H(d.value,C=>(x(),M("section",{key:C.kind,class:"pptx-accessibility-group"},[k("h4",null,N(C.title)+"("+N(C.items.length)+")",1),k("p",mT,N(C.advice),1),k("ul",null,[(x(!0),M(U,null,H(C.items,E=>(x(),M("li",{key:v(E)},[k("button",{type:"button",class:"pptx-accessibility-item","data-severity":E.severity,onClick:T=>g(E)},[k("span",vT,"第 "+N(E.slideIndex+1)+" 张 · "+N(E.label),1),k("span",gT,N(E.detail),1)],8,hT),E.kind==="missing-alt"?(x(),M(U,{key:0},[f.value===v(E)?(x(),M("form",{key:0,class:"pptx-accessibility-alt",onSubmit:J(T=>b(E),["prevent"])},[y(m(Oe),{modelValue:h.value,"onUpdate:modelValue":S[1]||(S[1]=T=>h.value=T),size:"sm","aria-label":"替代文字",placeholder:"描述这个对象"},null,8,["modelValue"]),y(m(q),{type:"submit",size:"sm",disabled:!h.value.trim()},{default:A(()=>[...S[3]||(S[3]=[R("确定",-1)])]),_:1},8,["disabled"])],40,bT)):(x(),B(m(q),{key:1,type:"button",size:"sm",variant:"ghost",onClick:T=>$(E)},{default:A(()=>[...S[4]||(S[4]=[R("添加替代文字",-1)])]),_:1},8,["onClick"]))],64)):L("v-if",!0)]))),128))])]))),128))])]))}});function vu(e,t){return t?t.unresolvedOnly&&e.resolved===!0?!1:t.author===null||e.author===t.author||e.replies.some(n=>n.author===t.author):!0}function wT(e,t){return pe(e).flatMap(n=>Ko(n).filter(l=>vu(l,t)).map(l=>({slide:We(n),index:l.index})))}function kT(e,t,n,l){if(e.length===0)return;const s=e.findIndex(a=>a.slide===t.slide&&a.index===t.index);if(s>=0)return e[(s+n+e.length)%e.length];const o=a=>l.indexOf(a.slide);return(n===1?e.find(a=>o(a)>=t.slideIndex):[...e].reverse().find(a=>o(a)<=t.slideIndex))??(n===1?e[0]:e.at(-1))}const ov=new WeakMap;function Yn(e){let t=ov.get(e);return t||(t={markersVisible:Q(!0),active:Q(),compose:Q(0),spellcheck:Q(!0),wordCountOpen:Q(!1),filter:Q({author:null,unresolvedOnly:!1})},ov.set(e,t)),t}const $T=["aria-label","title","data-active","data-resolved","onClick"],ST=O({__name:"comment-markers",props:{state:{},scale:{}},setup(e){const t=e,n=Yn(t.state),l=F(()=>{t.state.tick.value;const o=t.state.current.value?.part,a=o&&n.markersVisible.value?t.state.slide(o):null;return!a||!o?[]:Ko(a).filter(i=>vu(i,n.filter.value)).map((i,r)=>({thread:i,part:o,label:`第 ${r+1} 条批注:${i.author}`,left:(i.position?.x??0)*t.scale+(i.position?0:r*26),top:(i.position?.y??0)*t.scale}))});function s(o,a){n.active.value={slide:o,index:a},document.querySelector(".pptx-comments-panel")?.offsetParent||document.querySelector(".pptx-side-rail [aria-label='批注']")?.click()}return(o,a)=>(x(!0),M(U,null,H(l.value,i=>(x(),M("button",{key:i.thread.index,type:"button",class:"pptx-comment-marker","aria-label":i.label,title:i.label,"data-active":m(n).active.value?.slide===i.part&&m(n).active.value?.index===i.thread.index||void 0,"data-resolved":i.thread.resolved===!0||void 0,style:fe({left:`${i.left}px`,top:`${i.top}px`}),onPointerdown:a[0]||(a[0]=J(()=>{},["stop"])),onDblclick:a[1]||(a[1]=J(()=>{},["stop"])),onClick:J(r=>s(i.part,i.thread.index),["stop"])},[y(m(me),{name:"messageSquareText",size:12}),k("span",null,N(i.thread.replies.length+1),1)],44,$T))),128))}}),av="quirekit.pptx-editor.comment-author";function CT(){try{return localStorage.getItem(av)?.trim()||"我"}catch{return"我"}}function MT(e){try{localStorage.setItem(av,e.trim())}catch{}}function PT(e){return[...new Set(S0(e).map(t=>t.name.trim()).filter(Boolean))].map(t=>({id:t,label:t,url:`pptx-author:${encodeURIComponent(t)}`,description:"批注者"}))}function gu(e){return e.replace(/\[@((?:\\.|[^\]\\])+)\]\(<(?:\\.|[^>\\])*>\)/gu,(t,n)=>`@${n.replace(/\\(.)/gu,"$1").replaceAll("&","&")}`)}const TT={class:"pptx-panel-header"},AT={class:"pptx-comments-tools"},ET={class:"pptx-comments-controls"},FT={class:"pptx-comments-filter"},zT={class:"pptx-comments-body"},DT={key:1,class:"pptx-comments-empty"},LT={class:"pptx-comments-author"},VT=O({__name:"comments-panel",props:{state:{},host:{}},emits:["close"],setup(e,{emit:t}){const n=e,l=t,s=Yn(n.state),o=V(CT()),a=V(!1),i=je("root"),r=F(()=>n.state.current.value?.part),u=F(()=>{n.state.tick.value;const D=r.value?n.state.slide(r.value):null;return D?Ko(D):[]}),c=F(()=>u.value.filter(D=>vu(D,s.filter.value))),d=F(()=>[{value:"",label:"全部批注者"},...v.value.map(D=>({value:D.label,label:D.label}))]),p=F({get:()=>s.filter.value.author??"",set:D=>{s.filter.value={...s.filter.value,author:D||null}}}),f=[{value:"all",label:"全部"},{value:"open",label:"未解决"}],h=F({get:()=>s.filter.value.unresolvedOnly?"open":"all",set:D=>{s.filter.value={...s.filter.value,unresolvedOnly:D==="open"}}}),v=F(()=>(n.state.settled.value,PT(n.state.session.document.presentation())));X(o,D=>{D.trim()&&MT(D)}),X(s.compose,()=>{a.value=!0,pt(()=>i.value?.querySelector(".pptx-comment-draft textarea")?.focus())});function g(D){return{id:String(D.index),author:{name:D.author},time:D.date??"",body:D.text,editable:!0,deletable:!0}}function $(){const D=n.state.boxes.value.find(P=>P.id===n.state.selected.value[0]);return D?{x:Math.round(D.x+D.width),y:Math.round(D.y)}:{x:0,y:0}}function b(D){if(!r.value||!o.value.trim())return;const P=u.value.length;if(n.state.session.commands.addComment({slide:r.value,text:gu(D),author:{name:o.value.trim()},position:$()})){a.value=!1;const I=u.value[P];I&&(s.active.value={slide:r.value,index:I.index})}}function w(D,P){r.value&&n.state.session.commands.replyComment({slide:r.value,index:D.index,text:gu(P),author:{name:o.value.trim()||"我"}})}function S(D,P){r.value&&n.state.session.commands.setCommentResolved({slide:r.value,index:D.index,resolved:P})}function C(D){r.value&&n.state.session.commands.deleteComment({slide:r.value,index:Number(D)}),s.active.value=void 0}function E(D,P){r.value&&n.state.session.commands.editComment({slide:r.value,index:Number(D),text:gu(P)})}function T(D){r.value&&(s.active.value={slide:r.value,index:D.index})}function z(D){n.host.intent(D===1?"comment:next":"comment:prev")}return(D,P)=>(x(),M("div",{ref_key:"root",ref:i,class:"pptx-comments-panel"},[k("div",TT,[P[9]||(P[9]=k("span",{class:"qk-type-label"},"批注",-1)),k("span",AT,[y(Se,{icon:"commentPrevious",label:"上一条批注",onClick:P[0]||(P[0]=I=>z(-1))}),y(Se,{icon:"commentNext",label:"下一条批注",onClick:P[1]||(P[1]=I=>z(1))}),y(Se,{icon:"close",label:"关闭批注窗格",onClick:P[2]||(P[2]=I=>l("close"))})])]),L(" The add action leads, the filters sit on one line, and the signature is a setting kept at the foot. "),k("div",ET,[y(m(q),{block:"",variant:"soft",size:"sm",disabled:!r.value||a.value,onClick:P[3]||(P[3]=I=>m(s).compose.value+=1)},{default:A(()=>[...P[10]||(P[10]=[R("添加批注",-1)])]),_:1},8,["disabled"]),k("div",FT,[y(m(ce),{modelValue:p.value,"onUpdate:modelValue":P[4]||(P[4]=I=>p.value=I),size:"sm",width:"100%",label:"按批注者筛选",items:d.value},null,8,["modelValue","items"]),y(m(al),{modelValue:h.value,"onUpdate:modelValue":P[5]||(P[5]=I=>h.value=I),size:"sm",label:"按状态筛选",items:f},null,8,["modelValue"])])]),k("div",zT,[a.value?(x(),B(m(Bb),{key:0,class:"pptx-comment-draft",author:{name:o.value||"我"},placeholder:"输入批注,@ 提及他人",mentions:v.value,onSubmit:b,onCancel:P[6]||(P[6]=I=>a.value=!1)},null,8,["author","mentions"])):L("v-if",!0),(x(!0),M(U,null,H(c.value,I=>(x(),B(m(Ob),{key:I.index,messages:[g(I),...I.replies.map(g)],"quote-state":"none",resolved:I.resolved===!0,resolvable:I.resolved!==null,replyable:"",mentions:v.value,active:m(s).active.value?.slide===r.value&&m(s).active.value?.index===I.index,onActivate:K=>T(I),onReply:K=>w(I,K),onResolve:K=>S(I,!0),onReopen:K=>S(I,!1),onDelete:C,onEdit:P[7]||(P[7]=(K,G)=>E(K,G))},null,8,["messages","resolved","resolvable","mentions","active","onActivate","onReply","onResolve","onReopen"]))),128)),c.value.length===0&&!a.value?(x(),M("p",DT,N(u.value.length===0?"这张幻灯片没有批注":"没有符合筛选的批注"),1)):L("v-if",!0)]),k("label",LT,[P[11]||(P[11]=k("span",null,"署名",-1)),y(m(Oe),{modelValue:o.value,"onUpdate:modelValue":P[8]||(P[8]=I=>o.value=I),size:"sm","aria-label":"批注署名",placeholder:"批注显示的名字"},null,8,["modelValue"])])],512))}});function IT(e){const t=Yn(e),n=e.current.value===void 0;return[...wt(e),{value:"comment:new",label:"新建批注",icon:"messageSquare",disabled:n},{value:"comment:prev",label:"上一条批注",icon:"commentPrevious",disabled:n},{value:"comment:next",label:"下一条批注",icon:"commentNext",disabled:n},{value:"comment:delete",kind:"split",label:"删除批注",icon:"trash",disclosureLabel:"删除选项",disabled:n,items:[{value:"comment:delete",label:"删除批注",disabled:t.active.value===void 0},{value:"comment:delete-slide",label:"删除本页所有批注",disabled:n},{value:"comment:delete-all",label:"删除演示文稿中的所有批注"}]},{value:"comment:markers",label:"显示批注标记",icon:"eye",kind:"toggle",pressed:t.markersVisible.value},{value:"panel:comments",label:"批注窗格",icon:"messageSquareText"},{value:"comment:export",kind:"menu",trigger:"disclosure",label:"导出批注",icon:"messageSquareMore",disabled:n,tooltip:"导出批注:写入演讲者备注后可随备注页、讲义导出为 PDF,或另存为文本文件",items:[{value:"comment:to-notes",label:"导出到演讲者备注"},{value:"comment:remove-notes",label:"从演讲者备注中移除批注"},{value:"comment:export-text",label:"导出为文本文件…"}]},{value:"review-separator",label:"",kind:"separator"},{value:"convert",kind:"menu",trigger:"disclosure",label:"简繁转换",tooltip:"简繁转换:编辑文字时转换选中的文字,选中对象时转换对象,否则转换整份演示文稿",icon:"languages",disabled:n,items:[{value:"convert:toTraditional",label:"简转繁"},{value:"convert:toSimplified",label:"繁转简"}]},{value:"word-count",label:"字数统计",icon:"fileText",disabled:n},{value:"panel:accessibility",label:"检查辅助功能",icon:"shieldCheck",tooltip:"检查辅助功能:找出缺少替代文字、标题、阅读顺序与对比度方面的问题"},{value:"spellcheck",label:"拼写检查",kind:"toggle",icon:"spellCheck",pressed:t.spellcheck.value,tooltip:"拼写检查:编辑文字时由浏览器标出拼写错误,支持的语言取决于浏览器,不检查中文"}]}function BT(e,t){const n=e.textEditor.value.view,{selection:l,doc:s}=n.state,[o,a]=l.empty?[0,s.content.size]:[l.from,l.to],i=n.state.tr;return s.nodesBetween(o,a,(r,u)=>{if(!r.isText||!r.text)return;const c=Math.max(o,u),d=r.text.slice(c-u,Math.min(a,u+r.nodeSize)-u);for(const p of hf(d,mf(d,t)))i.insertText(p.text,c+p.start,c+p.end)}),i.docChanged?(n.dispatch(i),n.focus(),!0):!1}function OT(e,t){const n=e.current.value?.part;let l;e.textEditor.value?l=BT(e,t):n&&e.selected.value.length>0?l=e.session.commands.convertChineseText({direction:t,target:{kind:"shapes",slide:n,shapes:e.selected.value}}):l=e.session.commands.convertChineseText({direction:t,target:{kind:"deck"}}),l||e.toaster.create({type:"info",title:t==="toTraditional"?"没有需要转为繁体的文字":"没有需要转为简体的文字"})}function UT(e,t){const n=Yn(e),{commands:l}=e.session;if(t==="comment:delete"){const r=n.active.value;r?l.deleteComment({slide:r.slide,index:r.index})&&(n.active.value=void 0):e.toaster.create({type:"info",title:"先在批注窗格中选中要删除的批注"});return}const s=e.session.document.presentation(),o=e.current.value?.part,a=t==="comment:delete-all"?pe(s).map(We):o?[o]:[],i=pe(s).filter(r=>a.includes(We(r))).reduce((r,u)=>r+ao(u).length,0);if(!l.deleteSlideComments({slides:a})){e.toaster.create({type:"info",title:t==="comment:delete-all"?"演示文稿中没有批注":"这张幻灯片没有批注"});return}n.active.value=void 0,e.toaster.create({type:"success",title:`已删除 ${i} 条批注`})}function NT(e,t,n){const l=Yn(e);if(t==="comment:new")return n.intent("show-panel:comments"),l.compose.value+=1,!0;if(t==="comment:next"||t==="comment:prev"){const s=e.session.document.presentation(),o=e.current.value,a=pe(s).map(We),i=l.active.value,r=i?{slide:i.slide,index:i.index,slideIndex:a.indexOf(i.slide)}:{slide:o?.part??"",slideIndex:o?.index??0},u=kT(wT(s,l.filter.value),r,t==="comment:next"?1:-1,a);return u?(e.session.document.select({slide:u.slide,shapes:[]}),l.active.value=u,n.intent("show-panel:comments"),!0):(e.toaster.create({type:"info",title:"演示文稿中没有批注"}),!0)}if(t==="comment:to-notes"||t==="comment:remove-notes"){const s=t==="comment:remove-notes",o=e.session.commands.copyCommentsToNotes({remove:s});return e.toaster.create(o?{type:"success",title:s?"已从备注中移除批注":"已把批注写入演讲者备注",description:s?void 0:"导出备注页或讲义时会一并带上。"}:{type:"info",title:s?"备注中没有批注":"没有需要写入的批注"}),!0}if(t==="comment:export-text"){const s=Dk(e.session.document.presentation());return s?kt(n.ownerDocument,new Blob([s],{type:"text/plain;charset=utf-8"}),`${Qn(e.session.name())}-批注.txt`,"text/plain"):e.toaster.create({type:"info",title:"演示文稿中没有批注"}),!0}if(t.startsWith("comment:delete"))return UT(e,t),!0;if(t==="comment:markers")l.markersVisible.value=!l.markersVisible.value;else if(t==="convert:toTraditional"||t==="convert:toSimplified")OT(e,t==="convert:toTraditional"?"toTraditional":"toSimplified");else if(t==="spellcheck")l.spellcheck.value=!l.spellcheck.value;else if(t==="word-count")l.wordCountOpen.value=!0;else return!1;return!0}const RT={hidden:""},jT=O({__name:"review-effects",props:{state:{}},setup(e){const t=e,n=Yn(t.state);return dc(()=>{const l=t.state.textEditor.value;l&&(l.view.dom.spellcheck=n.spellcheck.value)}),(l,s)=>(x(),M("span",RT))}}),KT={key:0,class:"pptx-word-count"},WT={scope:"row"},qT={id:"review",tabs:[{value:"review",label:"审阅",order:60,entries:IT}],intent:(e,t,n,l)=>NT(e,t,l),overlays:[jT,O({__name:"word-count-dialog",props:{state:{}},setup(e){const t=e,n=Yn(t.state),l=F(()=>{if(!n.wordCountOpen.value)return null;t.state.settled.value;const o=t.state.current.value?.part,a=o?t.state.slide(o):null;return{deck:bf(pe(t.state.session.document.presentation())),slide:bf(a?[a]:[])}}),s=[["slides","幻灯片"],["hiddenSlides","隐藏幻灯片"],["words","字数"],["characters","字符数(不计空格)"],["charactersWithSpaces","字符数(计空格)"],["paragraphs","段落数"],["notesWords","备注字数"]];return(o,a)=>(x(),B(m(Ae),{open:m(n).wordCountOpen.value,"onUpdate:open":a[1]||(a[1]=i=>m(n).wordCountOpen.value=i)},{default:A(()=>[y(m(Te),{title:"字数统计",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",color:"primary",variant:"solid",onClick:a[0]||(a[0]=i=>m(n).wordCountOpen.value=!1)},{default:A(()=>[...a[3]||(a[3]=[R("关闭",-1)])]),_:1})]),default:A(()=>[l.value?(x(),M("table",KT,[a[2]||(a[2]=k("thead",null,[k("tr",null,[k("th",{scope:"col"},"统计项"),k("th",{scope:"col"},"整份演示文稿"),k("th",{scope:"col"},"当前幻灯片")])],-1)),k("tbody",null,[(x(),M(U,null,H(s,([i,r])=>k("tr",{key:i},[k("th",WT,N(r),1),k("td",null,N(l.value.deck[i]),1),k("td",null,N(l.value.slide[i]),1)])),64))])])):L("v-if",!0)]),_:1})]),_:1},8,["open"]))}})],panels:[{id:"comments",label:"批注",icon:"messageSquareText",component:VT},{id:"accessibility",label:"辅助功能",icon:"shieldCheck",component:xT}],stageLayers:[ST]},iv=new WeakMap;function Ve(e){let t=iv.get(e);return t||(t={mode:Q("normal"),ruler:Q(!1),grid:Q(!1),master:Q()},iv.set(e,t)),t}const Il=new WeakMap,_T=e=>({value:e,label:"",kind:"separator"});function GT(e){e.tick.value;const t=Ve(e),n=e.session.document.presentation(),l=t.mode.value,s=l==="normal";return[...wt(e),{value:"view:mode:normal",label:"普通",icon:"panelLeft",kind:"toggle",pressed:s},{value:"view:mode:storyline",label:"故事线",icon:"listNumbered",kind:"toggle",pressed:l==="storyline",tooltip:"故事线:成稿前的逐页规划,可以直接改,确认后交给助手生成"},{value:"view:mode:directions",label:"设计方向",icon:"colorScheme",kind:"toggle",pressed:l==="directions",tooltip:"设计方向:助手用真实内容画的几种样子,选一个后按它画整套"},{value:"view:mode:outline",label:"大纲",icon:"documentOutline",kind:"toggle",pressed:l==="outline"},{value:"view:mode:sorter",label:"幻灯片浏览",icon:"slideSorter",kind:"toggle",pressed:l==="sorter"},{value:"view:mode:notes",label:"备注页",icon:"notesPage",kind:"toggle",pressed:l==="notes"},{value:"show:reading",label:"阅读视图",icon:"bookOpen",tooltip:"阅读视图:在窗口内放映,不全屏"},{value:"view:mode:master",label:"幻灯片母版",icon:"layoutDashboard",kind:"toggle",pressed:l==="master"},_T("view-show"),{value:"view:ruler",label:"标尺",icon:"ruler",kind:"toggle",pressed:t.ruler.value,disabled:!s},{value:"view:grid",label:"网格线",icon:"gridlines",kind:"toggle",pressed:t.grid.value,disabled:!s},{value:"view:guides",kind:"split",label:"参考线",icon:"guides",disclosureLabel:"参考线选项",pressed:Hl(n),disabled:!s,items:[{value:"view:guides",label:"显示参考线"},{value:"view:guide-add:y",label:"添加水平参考线"},{value:"view:guide-add:x",label:"添加垂直参考线"},{value:"view:guides-clear",label:"删除全部参考线"},{value:"view-guides-separator",label:"",kind:"separator"},{value:"view:snap-grid",label:"对象与网格对齐",...$i(n)?{icon:"check"}:{}}]}]}function HT(e,t,n){if(!t.startsWith("view:"))return!1;const l=Ve(e),{commands:s,document:o}=e.session,a=o.presentation();if(t.startsWith("view:mode:"))l.mode.value=t.slice(10),l.mode.value==="master"&&n.selectTab("master");else if(t==="view:ruler")l.ruler.value=!l.ruler.value;else if(t==="view:grid")l.grid.value=!l.grid.value;else if(t==="view:guides")s.setGuidesVisible({visible:!Hl(a)});else if(t==="view:snap-grid")s.setGridSettings({snap:!$i(a)});else if(t==="view:guides-clear")s.setGuides({guides:[]});else if(t.startsWith("view:guide-add:")){const i=t.slice(15),r=Rt(a),u=ui(a)??[];if(!r)return!0;const c=Math.max(0,...u.map(d=>d.id))+1;e.session.chain().setGuides({guides:[...u,{id:c,axis:i,position:Math.round((i==="x"?r.width:r.height)/2)}]}).setGuidesVisible({visible:!0}).run()}return!0}const QT=["width","height"],XT=["x1","x2","y2"],ZT=["y1","y2","x2"],YT=72e3,JT=12,eA=O({__name:"grid-layer",props:{state:{},scale:{}},setup(e){const t=e,n=F(()=>{if(!Ve(t.state).grid.value)return null;t.state.tick.value;const l=t.state.size.value,s=Pc(t.state.session.document.presentation())?.x||YT,o=s*Math.max(1,Math.ceil(JT/(s*t.scale)));return{xs:Array.from({length:Math.floor(l.width/o)},(a,i)=>(i+1)*o*t.scale),ys:Array.from({length:Math.floor(l.height/o)},(a,i)=>(i+1)*o*t.scale),width:l.width*t.scale,height:l.height*t.scale}});return(l,s)=>n.value?(x(),M("svg",{key:0,class:"pptx-grid-layer",width:n.value.width,height:n.value.height,"aria-hidden":"true"},[(x(!0),M(U,null,H(n.value.xs,o=>(x(),M("line",{key:`x${o}`,x1:o,x2:o,y1:"0",y2:n.value.height},null,8,XT))),128)),(x(!0),M(U,null,H(n.value.ys,o=>(x(),M("line",{key:`y${o}`,y1:o,y2:o,x1:"0",x2:n.value.width},null,8,ZT))),128))],8,QT)):L("v-if",!0)}}),tA=["onPointerdown","onPointermove"],nA={key:0,class:"pptx-guide-label"},lA=36e4,sA=O({__name:"guides-layer",props:{state:{},scale:{}},setup(e){const t=e,n=Q(),l=F(()=>{t.state.tick.value;const c=t.state.session.document.presentation();return Hl(c)?ui(c)??[]:[]}),s=F(()=>t.state.size.value),o=c=>n.value?.id===c.id?n.value.position:c.position,a=c=>(Math.abs(o(c)-(c.axis==="x"?s.value.width:s.value.height)/2)/lA).toFixed(2);function i(c,d){c.stopPropagation(),c.preventDefault(),c.currentTarget.setPointerCapture(c.pointerId),n.value={id:d.id,position:d.position,pointer:c.pointerId,outside:!1}}function r(c,d){const p=n.value;if(!p||p.pointer!==c.pointerId)return;const f=c.currentTarget.closest(".pptx-slide-frame").getBoundingClientRect(),h=d.axis==="x"?(c.clientX-f.left)/t.scale:(c.clientY-f.top)/t.scale,v=d.axis==="x"?s.value.width:s.value.height;n.value={...p,position:Math.min(v,Math.max(0,h)),outside:h<0||h>v}}function u(c){const d=n.value;if(!d||d.pointer!==c.pointerId)return;n.value=void 0;const p=l.value.flatMap(f=>f.id!==d.id?[f]:d.outside?[]:[{...f,position:Math.round(d.position)}]);t.state.session.commands.setGuides({guides:p})}return(c,d)=>(x(!0),M(U,null,H(l.value,p=>(x(),M("div",{key:p.id,class:Ne(["pptx-guide",[`pptx-guide-${p.axis}`,{dragging:n.value?.id===p.id,leaving:n.value?.id===p.id&&n.value.outside}]]),style:fe(p.axis==="x"?{left:`${o(p)*e.scale}px`}:{top:`${o(p)*e.scale}px`}),onPointerdown:f=>i(f,p),onPointermove:f=>r(f,p),onPointerup:u,onPointercancel:d[0]||(d[0]=f=>n.value=void 0)},[n.value?.id===p.id?(x(),M("span",nA,N(a(p)),1)):L("v-if",!0)],46,tA))),128))}}),oA={key:0},aA={key:0},Is=36e4,iA=O({__name:"ruler-layer",props:{state:{},scale:{}},setup(e){const t=e;function n(s){const o=t.scale*Is>=24?Is/2:Is,a=s/2,i=[];for(let r=-Math.floor(a/o)*o;a+r<=s;r+=o){const u=Math.abs(r%Is)<1;i.push({at:(a+r)*t.scale,label:u?String(Math.round(Math.abs(r)/Is)):null,major:u})}return i}const l=F(()=>{if(!Ve(t.state).ruler.value)return null;const s=t.state.size.value;return{width:s.width*t.scale,height:s.height*t.scale,x:n(s.width),y:n(s.height)}});return(s,o)=>l.value?(x(),M(U,{key:0},[k("div",{class:"pptx-ruler pptx-ruler-x",style:fe({width:`${l.value.width}px`}),"aria-hidden":"true"},[(x(!0),M(U,null,H(l.value.x,a=>(x(),M("span",{key:a.at,class:Ne(["pptx-ruler-tick",{major:a.major}]),style:fe({left:`${a.at}px`})},[a.label?(x(),M("i",oA,N(a.label),1)):L("v-if",!0)],6))),128))],4),k("div",{class:"pptx-ruler pptx-ruler-y",style:fe({height:`${l.value.height}px`}),"aria-hidden":"true"},[(x(!0),M(U,null,H(l.value.y,a=>(x(),M("span",{key:a.at,class:Ne(["pptx-ruler-tick",{major:a.major}]),style:fe({top:`${a.at}px`})},[a.label?(x(),M("i",aA,N(a.label),1)):L("v-if",!0)],6))),128))],4)],64)):L("v-if",!0)}}),bu=e=>({value:e,label:"",kind:"separator"}),rA=[["title","标题"],["body","文本"],["dt","日期"],["ftr","页脚"],["sldNum","幻灯片编号"]],uA=[["content","内容"],["verticalContent","内容(竖排)"],["text","文本"],["verticalText","文本(竖排)"],["picture","图片"],["chart","图表"],["table","表格"],["smartArt","智能图形"],["media","媒体"]];function cA(e){e.tick.value;const t=Ve(e).master.value,n=e.session.document.presentation(),l=t?.kind==="layout"?ul(n,t.part):null,s=new Set((l?ns(l):t?yi(n,t.part):[]).map(a=>a.type??"obj")),o=l?ki(n,l).length>0:!0;return[...wt(e),{value:"master:add-layout",label:"插入版式",icon:"layoutDashboard",disabled:!t},{value:"master:remove-layout",label:"删除版式",icon:"trash",disabled:!l||o,disabledReason:l?"有幻灯片在使用这个版式":"先选择一个版式"},{value:"master:rename",label:"重命名",icon:"edit",disabled:!l},bu("master-parts"),{value:"master:parts",kind:"menu",trigger:"disclosure",label:"母版版式",icon:"textCursorInput",disabled:t?.kind!=="master",items:rA.map(([a,i])=>({value:`master:part:${a}`,label:i,...s.has(a)?{icon:"check"}:{}}))},{value:"master:placeholder",kind:"menu",trigger:"disclosure",label:"插入占位符",icon:"rectangleHorizontal",disabled:!l,items:uA.map(([a,i])=>({value:`master:placeholder:${a}`,label:i}))},{value:"master:title",label:"标题",icon:"heading",kind:"toggle",pressed:s.has("title")||s.has("ctrTitle"),disabled:!l},{value:"master:footers",label:"页脚",icon:"type",kind:"toggle",pressed:s.has("ftr"),disabled:!l},{value:"master:graphics",label:"隐藏背景图形",icon:"eyeOff",kind:"toggle",pressed:!!l&&Jc(l),disabled:!l},bu("master-theme"),{value:"design:colors",label:"配色方案",icon:"colorScheme",kind:"disclosure",indicator:!0,contentRenderer:"designColors",overlayProps:{width:"auto"}},{value:"design:fonts",label:"字体方案",icon:"fontLibrary",kind:"disclosure",indicator:!0,contentRenderer:"designFonts",overlayProps:{width:"auto"}},{value:"design:background-style",label:"背景样式",icon:"backgroundStyle",kind:"disclosure",indicator:!0,contentRenderer:"designBackgrounds",overlayProps:{width:"auto"}},bu("master-close"),{value:"master:close",label:"关闭母版视图",icon:"close"}]}const rv=new WeakMap;function uv(e){let t=rv.get(e);return t||(t=Q(),rv.set(e,t)),t}function dA(e,t,n){if(!t.startsWith("master:"))return!1;const l=Ve(e),s=l.master.value,{commands:o,document:a}=e.session,i=a.presentation(),r=s?.kind==="layout"?ul(i,s.part):null,u=s?.kind==="master"?s.part:r?pA(e,s.part):void 0,c=new Set((r?ns(r):u?yi(i,u):[]).map(p=>p.type??"obj"));let d=!1;if(t==="master:close")return l.mode.value="normal",n.selectTab("view"),!0;if(t==="master:add-layout"&&u)d=o.addLayout({master:u});else if(t==="master:remove-layout"&&s?.kind==="layout")d=o.removeLayout({layout:s.part}),d&&(l.master.value=void 0);else if(t==="master:rename"&&s?.kind==="layout")uv(e).value=s.part;else if(t.startsWith("master:part:")&&u){const p=t.slice(12);d=o.setMasterPlaceholder({master:u,type:p,included:!c.has(p)})}else if(t.startsWith("master:placeholder:")&&s?.kind==="layout"){const p=Rt(i)??{width:12192e3,height:6858e3};d=o.addLayoutPlaceholder({layout:s.part,kind:t.slice(19),bounds:{x:p.width/3,y:p.height/3,width:p.width/3,height:p.height/3}})}else t==="master:title"&&s?.kind==="layout"?d=o.setLayoutParts({layout:s.part,title:!(c.has("title")||c.has("ctrTitle"))}):t==="master:footers"&&s?.kind==="layout"?d=o.setLayoutParts({layout:s.part,footers:!c.has("ftr")}):t==="master:graphics"&&r&&s&&(d=o.setLayoutParts({layout:s.part,graphicsHidden:!Jc(r)}));return d&&e.renders.clear(),!0}function pA(e,t){const n=e.session.document.presentation();return ss(n).find(l=>ls(n,l).some(s=>Vt(s)===t))}const fA={class:"pptx-master-view","aria-label":"幻灯片母版"},mA={class:"pptx-master-list","aria-label":"母版与版式"},hA=["aria-pressed","title","onClick"],vA=["aria-pressed","title","onClick"],gA={class:"pptx-master-stage"},bA={key:0,class:"pptx-master-canvas"},yA={class:"pptx-master-caption"},xA=O({__name:"master-view",props:{state:{}},setup(e){const t=e,n=Ve(t.state),l=()=>t.state.session.document.presentation(),s=F(()=>{t.state.tick.value;const u=l();return H4(u).map(c=>{const d=c.layouts[0]?.layout;return{...c,svg:d?qi(u,d,{master:!0}):"",placeholders:hu(u,c.part),layouts:c.layouts.map(p=>({...p,svg:qi(u,p.layout),placeholders:hu(u,c.part,p.layout)}))}})});dc(()=>{if(n.master.value&&(n.master.value.kind==="master"?s.value.some(f=>f.part===n.master.value.part):ul(l(),n.master.value.part)))return;const u=t.state.current.value?.part,c=u?t.state.slide(u):null,d=c?Pt(c):null,p=s.value[0];n.master.value=d?{kind:"layout",part:Vt(d)}:p?{kind:"master",part:p.part}:void 0});const o=F(()=>{const u=n.master.value;if(u)for(const c of s.value){if(u.kind==="master"&&c.part===u.part)return{name:c.name,svg:c.svg,placeholders:c.placeholders,layout:void 0};const d=c.layouts.find(p=>p.part===u.part);if(u.kind==="layout"&&d)return{name:d.name,svg:d.svg,placeholders:d.placeholders,layout:d.part}}});function a(u,c){const d=o.value?.layout;d&&t.state.session.commands.setLayoutPlaceholderBounds({layout:d,index:u,bounds:c})&&t.state.renders.clear()}const i=u=>u.length?`由幻灯片 ${u.join("、")} 使用`:"任何幻灯片都未使用",r=u=>ls(l(),u).length;return(u,c)=>(x(),M("section",fA,[k("nav",mA,[(x(!0),M(U,null,H(s.value,d=>(x(),M(U,{key:d.part},[k("button",{type:"button",class:"pptx-master-item master","aria-pressed":m(n).master.value?.kind==="master"&&m(n).master.value.part===d.part,title:`${d.name}:由 ${r(d.part)} 个版式使用`,onClick:p=>m(n).master.value={kind:"master",part:d.part}},[y(ba,{svg:d.svg,placeholders:d.placeholders,size:e.state.size.value},null,8,["svg","placeholders","size"])],8,hA),(x(!0),M(U,null,H(d.layouts,p=>(x(),M("button",{key:p.part,type:"button",class:"pptx-master-item","aria-pressed":m(n).master.value?.kind==="layout"&&m(n).master.value.part===p.part,title:`${p.name}:${i(p.usedBy)}`,onClick:f=>m(n).master.value={kind:"layout",part:p.part}},[y(ba,{svg:p.svg,placeholders:p.placeholders,size:e.state.size.value},null,8,["svg","placeholders","size"])],8,vA))),128))],64))),128))]),k("div",gA,[o.value?(x(),M("div",bA,[y(ba,{svg:o.value.svg,placeholders:o.value.placeholders,size:e.state.size.value,editable:!!o.value.layout,onBounds:a},null,8,["svg","placeholders","size","editable"]),k("p",yA,N(o.value.name),1)])):L("v-if",!0)])]))}}),wA=O({__name:"rename-dialog",props:{state:{}},setup(e){const t=e,n=uv(t.state),l=V(""),s=F({get:()=>n.value!==void 0,set:a=>{a||(n.value=void 0)}});X(n,a=>{const i=a?ul(t.state.session.document.presentation(),a):null;l.value=i?Lt(i):""});function o(){const a=n.value;a&&l.value.trim()&&t.state.session.commands.renameLayout({layout:a,name:l.value})&&(n.value=void 0)}return(a,i)=>(x(),B(m(Ae),{open:s.value,"onUpdate:open":i[2]||(i[2]=r=>s.value=r)},{default:A(()=>[y(m(Te),{title:"重命名版式",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:i[1]||(i[1]=r=>s.value=!1)},{default:A(()=>[...i[3]||(i[3]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!l.value.trim(),onClick:o},{default:A(()=>[...i[4]||(i[4]=[R("重命名",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("form",{onSubmit:J(o,["prevent"])},[y(m(re),{label:"版式名称"},{default:A(({controlProps:r})=>[y(m(Oe),ie(r,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=u=>l.value=u),autofocus:""}),null,16,["modelValue"])]),_:1})],32)]),_:1})]),_:1},8,["open"]))}}),kA={class:"pptx-notes-pages","aria-label":"备注页"},$A=["aria-label"],SA=["innerHTML"],CA={class:"pptx-notes-page-number"},MA=O({__name:"notes-page",props:{state:{}},setup(e){const t=e,n=F(()=>(t.state.settled.value,t.state.slides.value.map(o=>{const a=t.state.slide(o.part);return{...o,svg:t.state.render(o.part),notes:a?In(a)??"":""}}))),l=V({});X(n,o=>{l.value=Object.fromEntries(o.map(a=>[a.part,a.notes]))},{immediate:!0});function s(o){const a=n.value.find(r=>r.part===o),i=l.value[o]??"";a&&i!==a.notes&&t.state.session.commands.setSlideNotes({slide:o,notes:i})}return(o,a)=>(x(),M("section",kA,[(x(!0),M(U,null,H(n.value,(i,r)=>(x(),M("article",{key:i.part,class:"pptx-notes-page","aria-label":`第 ${r+1} 页`},[k("div",{class:"pptx-notes-page-slide","aria-hidden":"true",innerHTML:i.svg},null,8,SA),y(m(Ct),{"model-value":l.value[i.part]??"","aria-label":`第 ${r+1} 页备注`,placeholder:"单击此处添加备注",rows:6,"auto-resize":"",width:"100%","onUpdate:modelValue":u=>l.value[i.part]=u,onBlur:u=>s(i.part)},null,8,["model-value","aria-label","onUpdate:modelValue","onBlur"]),k("span",CA,N(r+1),1)],8,$A))),128))]))}}),PA={class:"pptx-outline-view","aria-label":"大纲"},TA={class:"pptx-outline-list"},AA=["onFocusin","onClick"],EA={class:"pptx-outline-number"},FA={class:"pptx-outline-fields"},zA=["value","aria-label","onInput","onBlur"],DA={key:1,class:"pptx-outline-empty"},LA=["value","aria-label","rows","onInput","onBlur"],VA={class:"pptx-outline-preview","aria-hidden":"true"},IA=["innerHTML"],BA=O({__name:"outline",props:{state:{}},setup(e){const t=e,n=F(()=>(t.state.settled.value,t.state.slides.value.map(u=>{const c=t.state.slide(u.part),d=c?Tr(c):null,p=c?Ar(c):null;return{...u,title:d?ze(d):null,body:p?ze(p):null}}))),l=F(()=>t.state.current.value?.part),s=F(()=>(t.state.settled.value,l.value?t.state.render(l.value):"")),o=V({});X(n,u=>{o.value=Object.fromEntries(u.map(c=>[c.part,{title:c.title??"",body:c.body??""}]))},{immediate:!0});function a(u,c){const d=n.value.find(f=>f.part===u),p=o.value[u];d&&p&&d[c]!==null&&p[c]!==d[c]&&t.state.session.commands.setOutlineText({slide:u,[c]:p[c]})}function i(u){u!==l.value&&t.state.session.document.select({slide:u,shapes:[]})}function r(u,c,d){const p=u.target.value;o.value={...o.value,[c]:{...o.value[c],[d]:p}}}return(u,c)=>(x(),M("section",PA,[k("ol",TA,[(x(!0),M(U,null,H(n.value,(d,p)=>(x(),M("li",{key:d.part,class:Ne(["pptx-outline-entry",{current:d.part===l.value}]),onFocusin:f=>i(d.part),onClick:f=>i(d.part)},[k("span",EA,N(p+1),1),k("div",FA,[d.title!==null?(x(),M("input",{key:0,class:"pptx-outline-title",value:o.value[d.part]?.title,"aria-label":`第 ${p+1} 页标题`,placeholder:"标题",onInput:f=>r(f,d.part,"title"),onBlur:f=>a(d.part,"title"),onKeydown:c[0]||(c[0]=ue(J(f=>f.target.blur(),["prevent"]),["enter"]))},null,40,zA)):(x(),M("span",DA,"(这页没有标题占位符)")),d.body!==null?(x(),M("textarea",{key:2,class:"pptx-outline-body",value:o.value[d.part]?.body,"aria-label":`第 ${p+1} 页正文`,placeholder:"正文",rows:Math.max(1,(o.value[d.part]?.body??"").split(`
|
|
82
|
+
`).length),onInput:f=>r(f,d.part,"body"),onBlur:f=>a(d.part,"body")},null,40,LA)):L("v-if",!0)])],42,AA))),128))]),k("div",VA,[k("div",{class:"pptx-outline-slide",innerHTML:s.value},null,8,IA)])]))}});function OA(e){const t=e?ro(e)?.advanceAfterMs:void 0;return t===void 0?null:Jt(t)}const UA={class:"pptx-sorter-grid",role:"listbox","aria-label":"幻灯片"},NA=["aria-selected","onClick","onDblclick","onDragstart","onDragover"],RA=["innerHTML"],jA={class:"pptx-sorter-meta"},KA={class:"pptx-sorter-number"},WA=["title"],qA=O({__name:"sorter",props:{state:{}},setup(e){const t=e,n=F(()=>(t.state.settled.value,t.state.slides.value.map(d=>({...d,svg:t.state.render(d.part),timing:OA(t.state.slide(d.part))})))),l=F(()=>t.state.current.value?.part),s=Q();function o(d){t.state.session.document.select({slide:d,shapes:[]})}function a(d){o(d),Ve(t.state).mode.value="normal"}function i(d){const p=n.value,f=p.findIndex(v=>v.part===l.value),h={ArrowRight:1,ArrowDown:4,ArrowLeft:-1,ArrowUp:-4}[d.key];if(h!==void 0){const v=p[Math.min(p.length-1,Math.max(0,f+h))];v&&o(v.part)}else if((d.key==="Delete"||d.key==="Backspace")&&l.value&&p.length>1)t.state.session.commands.deleteSlide({slide:l.value});else if(d.key==="Enter"&&l.value)a(l.value);else return;d.preventDefault()}function r(d,p){d.dataTransfer?.setData("text/plain",p),s.value={part:p,target:n.value.findIndex(f=>f.part===p)}}function u(d,p){if(!s.value)return;d.preventDefault();const f=d.currentTarget.getBoundingClientRect();s.value={...s.value,target:d.clientX>f.left+f.width/2?p+1:p}}function c(){const d=s.value;if(s.value=void 0,!d)return;const p=n.value.findIndex(h=>h.part===d.part),f=d.target>p?d.target-1:d.target;p>=0&&f!==p&&t.state.session.commands.moveSlide({slide:d.part,to:f})}return(d,p)=>(x(),M("section",{class:"pptx-sorter",tabindex:"0","aria-label":"幻灯片浏览",onKeydown:i},[k("div",UA,[(x(!0),M(U,null,H(n.value,(f,h)=>(x(),M("div",{key:f.part,class:Ne(["pptx-sorter-card",{hidden:f.hidden,"drop-before":s.value?.target===h,"drop-after":s.value?.target===h+1&&h===n.value.length-1}]),role:"option","aria-selected":f.part===l.value,draggable:"true",onClick:v=>o(f.part),onDblclick:v=>a(f.part),onDragstart:v=>r(v,f.part),onDragover:v=>u(v,h),onDrop:J(c,["prevent"]),onDragend:p[0]||(p[0]=v=>s.value=void 0)},[k("div",{class:"pptx-sorter-thumb","aria-hidden":"true",innerHTML:f.svg},null,8,RA),k("div",jA,[k("span",KA,N(h+1),1),f.timing?(x(),M("span",{key:0,class:"pptx-sorter-timing",title:`排练计时 ${f.timing}`},N(f.timing),9,WA)):L("v-if",!0)])],42,NA))),128))])],32))}});var Bs=(e,t)=>{const n=e.__vccOpts||e;for(const[l,s]of t)n[l]=s;return n};const _A={class:"pptx-directions","aria-label":"设计方向"},GA={class:"pptx-directions-head"},HA={key:0,class:"pptx-directions-hint"},QA={class:"pptx-direction-info"},XA={class:"pptx-direction-name qk-type-heading"},ZA={key:0,class:"pptx-direction-style"},YA={class:"pptx-direction-colors","aria-label":"配色"},JA=["title"],eE={class:"pptx-direction-motif"},tE={class:"pptx-direction-samples"},nE=["src","alt"],lE={class:"pptx-directions-describe"};var sE=Bs(O({__name:"directions",props:{state:{},host:{}},setup(e){const t=e,n=F(()=>{t.state.settled.value;const i=t.state.session.document.presentation();return ec(i).map(r=>({direction:r,style:Zg(r.design.style)?.name,colors:["primary","accent","dark","background","surface"].map(u=>Ig(r.design.palette).palette[u]),samples:r.samples.map((u,c)=>{const d=ib(i,r,c);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Wt(d.presentation,d.slide))}`})}))}),l=V("");function s(){return pe(t.state.session.document.presentation()).some(i=>ot(i).some(r=>(dl(r)??"").startsWith("qk:draw:")))}async function o(i){const r=s();Il.set(t.state,await t.state.session.document.save()),t.state.session.chain().setDeckDesign(i.design).setDeckDirections({directions:[]}).run(),Ve(t.state).mode.value="normal";const u=i.design.name;await t.host.ask(r?`按「${u}」方向把整套幻灯片重画一遍,内容不变。`:`用「${u}」方向,按故事线生成整套幻灯片。`,{create:!0})}async function a(){const i=l.value.trim();i&&(l.value="",await t.host.ask(`再给几个设计方向,我想要的感觉是:${i}`))}return(i,r)=>(x(),M("section",_A,[k("header",GA,[r[3]||(r[3]=k("div",null,[k("h2",{class:"pptx-directions-title qk-type-title"},"设计方向"),k("p",{class:"pptx-directions-hint"},"用这份稿件的真实内容画的样张。选一个方向,助手按它画整套。")],-1)),y(m(q),{variant:"ghost",size:"sm",onClick:r[0]||(r[0]=u=>m(Ve)(e.state).mode.value="normal")},{default:A(()=>[...r[2]||(r[2]=[R("回到幻灯片",-1)])]),_:1})]),n.value.length?L("v-if",!0):(x(),M("p",HA,"还没有设计方向。让助手先提几个,或者在下面描述你想要的感觉。")),(x(!0),M(U,null,H(n.value,(u,c)=>(x(),M("article",{key:c,class:"pptx-direction"},[k("div",QA,[k("div",null,[k("div",XA,N(u.direction.design.name),1),u.style?(x(),M("div",ZA,"风格:"+N(u.style),1)):L("v-if",!0)]),k("div",YA,[(x(!0),M(U,null,H(u.colors,d=>(x(),M("span",{key:d,class:"pptx-direction-color",style:fe({background:d}),title:d},null,12,JA))),128))]),k("p",eE,N(u.direction.design.motif),1),y(m(q),{color:"primary",variant:"solid",size:"sm",onClick:d=>o(u.direction)},{default:A(()=>[...r[4]||(r[4]=[R("用这个方向",-1)])]),_:1},8,["onClick"])]),k("div",tE,[(x(!0),M(U,null,H(u.samples,(d,p)=>(x(),M("img",{key:p,src:d,alt:`${u.direction.design.name} 样张 ${p+1}`,class:"pptx-direction-sample"},null,8,nE))),128))])]))),128)),k("footer",lE,[y(m(Ct),{modelValue:l.value,"onUpdate:modelValue":r[1]||(r[1]=u=>l.value=u),width:"100%",rows:1,"auto-resize":"","max-rows":4,placeholder:"都不满意?描述你想要的感觉,例如:更活泼一点,像给家长看的;或者用我们的品牌色深绿","aria-label":"想要的感觉"},null,8,["modelValue"]),y(m(q),{variant:"soft",size:"sm",disabled:!l.value.trim(),onClick:a},{default:A(()=>[...r[5]||(r[5]=[R("再给几个方向",-1)])]),_:1},8,["disabled"])])]))}}),[["__scopeId","data-v-ae680f9f"]]);const yu=e=>`结论「${e.point}」,证明方式「${e.proof}」`;function oE(e,t){if(t===void 0)return"故事线已确认,按故事线生成整套幻灯片。";const n=(i,r)=>i.point===r.point&&i.proof===r.proof,l=new Set,s=e.map(i=>{const r=t.findIndex((u,c)=>!l.has(c)&&n(u,i));return r>=0&&l.add(r),r}),o=[],a=[];return e.forEach((i,r)=>{if(s[r]>=0){a.push(s[r]);return}let u=t.findIndex((c,d)=>!l.has(d)&&(c.point===i.point||c.proof===i.proof));if(u<0&&r<t.length&&!l.has(r)&&(u=r),u>=0)l.add(u),a.push(u),o.push(`- 「${t[u].point}」这一页改为:${yu(i)}`);else{const c=e[r-1];o.push(c?`- 在「${c.point}」之后新增一页:${yu(i)}`:`- 在最前面新增一页:${yu(i)}`)}}),t.forEach((i,r)=>{l.has(r)||o.push(`- 删除「${i.point}」这一页`)}),a.some((i,r)=>r>0&&i<a[r-1])&&o.push("- 页序按故事线现在的顺序调整"),o.length===0?"按故事线重新生成整套幻灯片。":["故事线改了,只改动下面这些页,其余页保持不变:",...o].join(`
|
|
83
|
+
`)}const aE={class:"pptx-storyline","aria-label":"故事线"},iE={class:"pptx-storyline-head"},rE={class:"pptx-storyline-title qk-type-title"},uE={key:0,class:"pptx-storyline-count"},cE={key:0,class:"pptx-storyline-chips"},dE={class:"pptx-storyline-actions"},pE={key:0,class:"pptx-storyline-empty"},fE={class:"pptx-storyline-list"},mE={key:0,class:"pptx-storyline-section"},hE={class:"pptx-storyline-card"},vE={class:"pptx-storyline-number"},gE={class:"pptx-storyline-fields"},bE={key:0,class:"pptx-storyline-chips"},yE={class:"pptx-storyline-tools"},xE={class:"pptx-storyline-add"};var wE=Bs(O({__name:"storyline",props:{state:{},host:{}},setup(e){const t=e,n=F(()=>(t.state.settled.value,Wa(t.state.session.document.presentation()))),l=F(()=>(t.state.settled.value,hb(t.state.session.document.presentation()))),s=V([]);X(n,b=>{s.value=b?b.slides.map(w=>({...w})):[]},{immediate:!0});const o=F(()=>{const b=l.value;return b?[b.delivery==="spoken"?"现场讲":"给人自己看",b.minutes?`${b.minutes} 分钟`:"",b.audience??"",b.purpose??""].filter(Boolean):[]}),a=F(()=>[...new Set(s.value.flatMap(b=>b.missing??[]))]),i=F(()=>n.value?.status==="confirmed"),r=F(()=>(t.state.settled.value,Wl(t.state.session.document.presentation())===null));function u(b,w=n.value?.status??"draft",S=n.value?.built??(n.value?.status==="confirmed"?n.value.slides:void 0)){t.state.session.commands.setDeckPlan({status:w,slides:b.filter(C=>C.point.trim()),...S?{built:S}:{}})}function c(b){const w=n.value?.slides[b],S=s.value[b];S&&(w?.point!==S.point||w?.proof!==S.proof)&&u(s.value)}function d(b,w){const S=b+w;if(S<0||S>=s.value.length)return;const C=[...s.value];[C[b],C[S]]=[C[S],C[b]],u(C)}function p(b){u(s.value.filter((w,S)=>S!==b))}function f(){s.value=[...s.value,{point:"",proof:""}]}async function h(){const b=r.value?"故事线已确认。样子还没定,先给我两三个设计方向的样张,我选好再生成整套。":oE(s.value.filter(w=>w.point.trim()),n.value?.built??(i.value?n.value?.slides:void 0));Il.set(t.state,await t.state.session.document.save()),u(s.value,"confirmed",void 0),Ve(t.state).mode.value="normal",await t.host.ask(b,{create:!0})}async function v(){const b=Il.get(t.state);b!==void 0&&(await t.state.session.document.adopt(b,"退回到生成前","user")&&Il.delete(t.state),g.value=Il.has(t.state))}const g=V(Il.has(t.state)),$=b=>{const w=s.value[b]?.section;return w!==void 0&&w!==s.value[b-1]?.section?w:void 0};return(b,w)=>(x(),M("section",aE,[k("header",iE,[k("div",null,[k("h2",rE,[w[1]||(w[1]=R("故事线",-1)),s.value.length?(x(),M("span",uE," · "+N(s.value.length)+" 页",1)):L("v-if",!0)]),o.value.length||a.value.length?(x(),M("div",cE,[(x(!0),M(U,null,H(o.value,S=>(x(),B(m(ei),{key:S,size:"sm"},{default:A(()=>[R(N(S),1)]),_:2},1024))),128)),a.value.length?(x(),B(m(ei),{key:0,size:"sm",color:"warning"},{default:A(()=>[R("缺:"+N(a.value.join("、"))+",先用占位",1)]),_:1})):L("v-if",!0)])):L("v-if",!0)]),k("div",dE,[g.value?(x(),B(m(q),{key:0,variant:"ghost",size:"sm",onClick:v},{default:A(()=>[...w[2]||(w[2]=[R("退回到生成前",-1)])]),_:1})):L("v-if",!0),y(m(q),{variant:"ghost",size:"sm",onClick:w[0]||(w[0]=S=>m(Ve)(e.state).mode.value="normal")},{default:A(()=>[...w[3]||(w[3]=[R("回到幻灯片",-1)])]),_:1}),s.value.length?(x(),B(m(q),{key:1,color:"primary",variant:"solid",size:"sm",onClick:h},{default:A(()=>[R(N(r.value?"确认故事线,看设计方向":i.value?"按故事线重新生成":"确认故事线,开始生成"),1)]),_:1})):L("v-if",!0)])]),s.value.length?L("v-if",!0):(x(),M("p",pE,"还没有故事线。让助手先规划一份,或者从这里开始写。")),k("ol",fE,[(x(!0),M(U,null,H(s.value,(S,C)=>(x(),M(U,{key:C},[$(C)?(x(),M("li",mE,N($(C)),1)):L("v-if",!0),k("li",hE,[k("span",vE,N(String(C+1).padStart(2,"0")),1),k("div",gE,[y(m(Ct),{modelValue:S.point,"onUpdate:modelValue":E=>S.point=E,variant:"embedded",width:"100%",rows:1,"auto-resize":"","max-rows":3,placeholder:"这一页要说的结论","aria-label":`第 ${C+1} 页结论`,class:"pptx-storyline-point",onBlur:E=>c(C)},null,8,["modelValue","onUpdate:modelValue","aria-label","onBlur"]),y(m(Ct),{modelValue:S.proof,"onUpdate:modelValue":E=>S.proof=E,variant:"embedded",width:"100%",rows:1,"auto-resize":"","max-rows":3,placeholder:"用什么来证明:大数字、三个步骤、对比、图表…","aria-label":`第 ${C+1} 页证明方式`,class:"pptx-storyline-proof",onBlur:E=>c(C)},null,8,["modelValue","onUpdate:modelValue","aria-label","onBlur"]),S.missing?.length?(x(),M("div",bE,[(x(!0),M(U,null,H(S.missing,E=>(x(),B(m(ei),{key:E,size:"sm",color:"warning"},{default:A(()=>[R("缺:"+N(E),1)]),_:2},1024))),128))])):L("v-if",!0)]),k("div",yE,[y(Se,{icon:"arrowUp",label:"上移",disabled:C===0,onClick:E=>d(C,-1)},null,8,["disabled","onClick"]),y(Se,{icon:"arrowDown",label:"下移",disabled:C===s.value.length-1,onClick:E=>d(C,1)},null,8,["disabled","onClick"]),y(Se,{icon:"trash",label:"删除这一页",onClick:E=>p(C)},null,8,["onClick"])])])],64))),128)),k("li",xE,[y(m(q),{variant:"ghost",size:"sm",onClick:f},{default:A(()=>[...w[4]||(w[4]=[R("加一页",-1)])]),_:1})])])]))}}),[["__scopeId","data-v-29b4152a"]]);const kE={hidden:""},$E={id:"view",tabs:[{value:"view",label:"视图",order:70,entries:GT},{value:"master",label:"幻灯片母版",order:-10,contextual:e=>Ve(e).mode.value==="master",entries:cA,context:Jh}],intent:(e,t,n,l)=>dA(e,t,l)||HT(e,t,l),overlays:[wA,O({__name:"storyline-watch",props:{state:{}},setup(e){const t=e;return X(F(()=>{t.state.settled.value;const n=Wa(t.state.session.document.presentation());return n?.status==="draft"?JSON.stringify(n.slides):null}),(n,l)=>{n!==null&&n!==l&&Ve(t.state).mode.value==="normal"&&(Ve(t.state).mode.value="storyline")}),X(F(()=>{t.state.settled.value;const n=t.state.session.document.presentation(),l=pe(n),s=l.map(o=>ot(o).map(Fe).join(",")).join("|");return{status:Wa(n)?.status??"none",count:l.length,shapes:s}}),(n,l)=>{const s=n.status==="confirmed"&&l?.status==="draft"||n.count>(l?.count??n.count)||l!==void 0&&n.shapes!==l.shapes,o=Ve(t.state).mode.value;s&&(o==="storyline"||o==="directions")&&(Ve(t.state).mode.value="normal")}),X(F(()=>{t.state.settled.value;const n=ec(t.state.session.document.presentation());return n.length?JSON.stringify(n.map(l=>l.design.name)):null}),(n,l)=>{n!==null&&n!==l&&Ve(t.state).mode.value!=="directions"&&(Ve(t.state).mode.value="directions"),n===null&&l!==null&&Ve(t.state).mode.value==="directions"&&(Ve(t.state).mode.value="normal")}),(n,l)=>(x(),M("span",kE))}})],stageLayers:[eA,sA,iA],mainView:e=>({storyline:wE,directions:sE,outline:BA,sorter:qA,notes:MA,master:xA,normal:void 0})[Ve(e).mode.value]},cv=new WeakMap;function Bl(e){let t=cv.get(e);return t||(t={dialog:Q(null)},cv.set(e,t)),t}const SE={class:"pptx-export-handout"},dv=O({__name:"handout-options",props:{perPage:{required:!0},perPageModifiers:{},orientation:{required:!0},orientationModifiers:{}},emits:["update:perPage","update:orientation"],setup(e){const t=["1","2","3","4","6","9"].map(s=>({value:s,label:`${s} 张`})),n=on(e,"perPage"),l=on(e,"orientation");return(s,o)=>(x(),M("div",SE,[y(m(re),{label:"每页幻灯片数"},{default:A(({controlProps:a})=>[y(m(ce),ie(a,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=i=>n.value=i),label:"每页幻灯片数",items:m(t)}),null,16,["modelValue","items"])]),_:1}),y(m(Ke),{modelValue:l.value,"onUpdate:modelValue":o[1]||(o[1]=a=>l.value=a),label:"方向",items:[{value:"portrait",label:"纵向"},{value:"landscape",label:"横向"}],orientation:"horizontal"},null,8,["modelValue"])]))}}),CE={class:"pptx-print-preview","aria-label":"打印预览"},ME=["srcdoc"],PE={class:"pptx-print-preview-count text-qk-text-secondary"},TE=O({__name:"print-preview",props:{state:{},range:{},layout:{},options:{}},setup(e){const t=e,n=Q(""),l=Q(0);let s=0;return X(()=>[t.range,t.layout,t.options],async([o,a,i])=>{const r=++s;if(!o){n.value="",l.value=0;return}const u=await zh(t.state,o,a,i);if(r!==s)return;l.value=u.count;const c=a.kind==="slides"?.26:a.kind==="handout"&&a.orientation==="landscape"?.3:.4;n.value=u.html.replace("</style>",`html{background:#e8e8e8}body{zoom:${c};padding:6mm 0}.page{margin:0 auto 6mm;box-shadow:0 0 0 .4mm #c8c8c8}</style>`)},{immediate:!0,deep:!0}),(o,a)=>(x(),M("section",CE,[k("iframe",{class:"pptx-print-preview-frame",title:"打印预览",srcdoc:n.value},null,8,ME),k("p",PE,"共 "+N(l.value)+" 张幻灯片",1)]))}}),AE={key:0,class:"pptx-export-pages"},EE={key:4,class:"pptx-export-watermark"},FE={class:"pptx-export-print-options"},zE=O({__name:"export-dialog",props:{state:{},host:{}},setup(e){const t=e,n=Bl(t.state).dialog,l=Q(n.value),s=V("all"),o=V("1"),a=V("1"),i=V("png"),r=V("1920"),u=V("zip"),c=V("each"),d=V(!1),p=V(""),f=V("slides"),h=V("color"),v=V(!1),g=V(!1),$=V("horizontal"),b=F(()=>({grayscale:h.value==="gray",frame:v.value,includeHidden:g.value,order:$.value})),w=V("slides"),S=V("6"),C=V("portrait"),E=F(()=>w.value==="handout"?{kind:"handout",perPage:Number(S.value),orientation:C.value}:{kind:w.value}),T=Q(null),z=F(()=>t.state.slides.value.length),D=F(()=>t.state.size.value.height/t.state.size.value.width),P=F(()=>[1280,1920,3840].map((ee,W)=>({value:String(ee),label:`${["标准","高清","超清"][W]}(${ee}×${Math.round(ee*D.value)})`}))),I=F(()=>({pdf:"导出为 PDF",image:"导出为图片",print:"打印",video:"",gif:"",outline:"",properties:"",compress:""})[l.value??"pdf"]);X(n,ee=>{ee!=="pdf"&&ee!=="image"&&ee!=="print"||(l.value=ee,s.value="all",o.value="1",a.value=String(z.value))});const K=F(()=>{if(s.value!=="range")return{kind:s.value};const ee=Number(o.value),W=Number(a.value);return Number.isInteger(ee)&&Number.isInteger(W)&&ee>=1&&ee<=W&&W<=z.value?{kind:"range",start:ee,end:W}:null});async function G(){const ee=K.value;if(!(!ee||T.value!==null||l.value===null)&&!(d.value&&c.value==="long"&&p.value.trim()==="")){T.value=l.value==="print"?"正在准备…":"正在导出…";try{if(l.value==="print")await dP(t.state,ee,E.value,t.host.ownerDocument,b.value);else{const W=await kP(t.state,{format:l.value==="pdf"?"pdf":i.value,range:ee,width:Number(r.value),bundle:u.value,long:c.value==="long",watermark:d.value?p.value:"",notes:l.value==="pdf"&&f.value==="notes",handout:l.value==="pdf"&&f.value==="handout"?{perPage:Number(S.value),orientation:C.value}:void 0},(te,he)=>{T.value=`正在导出 ${te}/${he}`});t.state.toaster.create({type:"success",title:W>0?`已导出 ${W} 页`:"没有可导出的幻灯片"})}n.value=null}catch{t.state.toaster.create({type:"error",title:l.value==="print"?"无法打印":"导出失败",description:"幻灯片未能绘制成图片,请重试。"})}finally{T.value=null}}}return(ee,W)=>(x(),B(m(Ae),{open:m(n)==="pdf"||m(n)==="image"||m(n)==="print","onUpdate:open":W[20]||(W[20]=te=>!te&&T.value===null&&(n.value=null))},{default:A(()=>[y(m(Te),{title:I.value,size:l.value==="print"?"large":"medium","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",disabled:T.value!==null,onClick:W[19]||(W[19]=te=>n.value=null)},{default:A(()=>[...W[22]||(W[22]=[R("取消",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!K.value,busy:T.value!==null,onClick:G},{default:A(()=>[R(N(T.value??(l.value==="print"?"打印…":"导出")),1)]),_:1},8,["disabled","busy"])]),default:A(()=>[k("form",{class:"pptx-export-form",onSubmit:J(G,["prevent"])},[y(m(Ke),{modelValue:s.value,"onUpdate:modelValue":W[0]||(W[0]=te=>s.value=te),label:"范围",items:[{value:"all",label:"全部幻灯片"},{value:"current",label:"当前幻灯片"},{value:"range",label:"指定页"}],orientation:"horizontal"},null,8,["modelValue"]),s.value==="range"?(x(),M("div",AE,[y(m(de),{modelValue:o.value,"onUpdate:modelValue":W[1]||(W[1]=te=>o.value=te),label:"起始页",min:1,max:z.value,step:1},null,8,["modelValue","max"]),W[21]||(W[21]=k("span",null,"到",-1)),y(m(de),{modelValue:a.value,"onUpdate:modelValue":W[2]||(W[2]=te=>a.value=te),label:"结束页",min:1,max:z.value,step:1},null,8,["modelValue","max"])])):L("v-if",!0),l.value==="image"?(x(),B(m(Ke),{key:1,modelValue:i.value,"onUpdate:modelValue":W[3]||(W[3]=te=>i.value=te),label:"格式",items:[{value:"png",label:"PNG"},{value:"jpeg",label:"JPG"}],orientation:"horizontal"},null,8,["modelValue"])):L("v-if",!0),l.value!=="print"?(x(),B(m(re),{key:2,label:"清晰度"},{default:A(({controlProps:te})=>[y(m(ce),ie(te,{modelValue:r.value,"onUpdate:modelValue":W[4]||(W[4]=he=>r.value=he),label:"清晰度",items:P.value}),null,16,["modelValue","items"])]),_:1})):L("v-if",!0),l.value==="image"&&s.value!=="current"?(x(),B(m(Ke),{key:3,modelValue:c.value,"onUpdate:modelValue":W[5]||(W[5]=te=>c.value=te),label:"输出方式",items:[{value:"each",label:"每页一张"},{value:"long",label:"拼成长图"}],orientation:"horizontal"},null,8,["modelValue"])):L("v-if",!0),l.value==="image"&&s.value!=="current"&&c.value==="long"?(x(),M("div",EE,[y(m(Ce),{checked:d.value,"onUpdate:checked":W[6]||(W[6]=te=>d.value=te),label:"加水印文字"},null,8,["checked"]),y(m(Oe),{modelValue:p.value,"onUpdate:modelValue":W[7]||(W[7]=te=>p.value=te),"aria-label":"水印文字",placeholder:"水印文字",disabled:!d.value,maxlength:40},null,8,["modelValue","disabled"])])):L("v-if",!0),l.value==="pdf"?(x(),M(U,{key:5},[y(m(Ke),{modelValue:f.value,"onUpdate:modelValue":W[8]||(W[8]=te=>f.value=te),label:"输出内容",items:[{value:"slides",label:"幻灯片"},{value:"handout",label:"讲义"},{value:"notes",label:"备注页"}],orientation:"horizontal"},null,8,["modelValue"]),f.value==="handout"?(x(),B(dv,{key:0,"per-page":S.value,"onUpdate:perPage":W[9]||(W[9]=te=>S.value=te),orientation:C.value,"onUpdate:orientation":W[10]||(W[10]=te=>C.value=te)},null,8,["per-page","orientation"])):L("v-if",!0)],64)):L("v-if",!0),l.value==="image"&&s.value!=="current"&&c.value==="each"?(x(),B(m(Ke),{key:6,modelValue:u.value,"onUpdate:modelValue":W[11]||(W[11]=te=>u.value=te),label:"多张图片",items:[{value:"zip",label:"打包为 ZIP"},{value:"each",label:"逐张下载"}],orientation:"horizontal"},null,8,["modelValue"])):L("v-if",!0),l.value==="print"?(x(),M(U,{key:7},[y(m(Ke),{modelValue:w.value,"onUpdate:modelValue":W[12]||(W[12]=te=>w.value=te),label:"打印内容",items:[{value:"slides",label:"整页幻灯片"},{value:"handout",label:"讲义"},{value:"notes",label:"备注页"}],orientation:"horizontal"},null,8,["modelValue"]),w.value==="handout"?(x(),B(dv,{key:0,"per-page":S.value,"onUpdate:perPage":W[13]||(W[13]=te=>S.value=te),orientation:C.value,"onUpdate:orientation":W[14]||(W[14]=te=>C.value=te)},null,8,["per-page","orientation"])):L("v-if",!0),w.value==="handout"&&S.value!=="1"?(x(),B(m(Ke),{key:1,modelValue:$.value,"onUpdate:modelValue":W[15]||(W[15]=te=>$.value=te),label:"顺序",items:[{value:"horizontal",label:"水平"},{value:"vertical",label:"垂直"}],orientation:"horizontal"},null,8,["modelValue"])):L("v-if",!0),k("div",FE,[y(m(Ke),{modelValue:h.value,"onUpdate:modelValue":W[16]||(W[16]=te=>h.value=te),label:"颜色",items:[{value:"color",label:"彩色"},{value:"gray",label:"灰度"}],orientation:"horizontal"},null,8,["modelValue"]),w.value==="slides"?(x(),B(m(Ce),{key:0,checked:v.value,"onUpdate:checked":W[17]||(W[17]=te=>v.value=te),label:"幻灯片加框"},null,8,["checked"])):L("v-if",!0),s.value==="all"?(x(),B(m(Ce),{key:1,checked:g.value,"onUpdate:checked":W[18]||(W[18]=te=>g.value=te),label:"打印隐藏幻灯片"},null,8,["checked"])):L("v-if",!0)]),y(TE,{state:e.state,range:K.value,layout:E.value,options:b.value},null,8,["state","range","layout","options"])],64)):L("v-if",!0)],32)]),_:1},8,["title","size"])]),_:1},8,["open"]))}}),DE={"file:export-pdf":"pdf","file:export-image":"image","file:print":"print","file:export-video":"video","file:export-gif":"gif","file:export-outline":"outline","file:properties":"properties","file:compress":"compress"};function pv(e,t){if(t==="file:save-template"||t==="file:save-show")return VE(e,t==="file:save-show"?"show":"template"),!0;const n=DE[t];return n?(Bl(e).dialog.value=n,!0):!1}const LE={template:{convert:oP,extension:"potx",type:"application/vnd.openxmlformats-officedocument.presentationml.template",failed:"无法另存为模板",what:"模板文件"},show:{convert:aP,extension:"ppsx",type:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",failed:"无法另存为放映文件",what:"放映文件"}};async function VE(e,t){const n=LE[t];try{const l=await n.convert(await e.session.document.save());kt(document,l,`${Qn(e.session.name())}.${n.extension}`,n.type)}catch{e.toaster.create({type:"error",title:n.failed,description:`文稿未能写成${n.what},请重试。`})}}async function IE(e,t,n,l,s=()=>{}){const o=ua.find(([p])=>p===t),{document:a}=e.session,i=(await a.save()).length;if(!o)return{pictures:0,before:i,after:i};const r=a.presentation(),u=pe(r).flatMap(p=>nc(r,p).filter(f=>f.kind==="picture").map(f=>({part:We(p),id:f.id})));let c=e.session.chain(),d=0;for(const[p,{part:f,id:h}]of u.entries()){s(p,u.length);const v=Xe(r,f,h);if(!v)continue;const g=await xh(v.shape,v.frame,$n(r,v.shape).crop,o[1],l);g&&(c=c.setPictureImage({slide:f,shape:h,bytes:g,compression:o[0]}),d+=1)}return s(u.length,u.length),n&&(c=c.compactMedia({})),(d>0||n)&&!c.run()?{pictures:0,before:i,after:i}:{pictures:d,before:i,after:(await a.save()).length}}const BE={class:"pptx-compress"},OE={class:"pptx-compress-note text-qk-text-secondary"},UE=O({__name:"compress-dialog",props:{state:{},host:{}},setup(e){const t=e,n=Bl(t.state).dialog,l=F(()=>n.value==="compress"),s=V("screen"),o=V(!0),a=Q(null),i=Q(null),r=c=>c>=1024*1024?`${(c/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(c/1024))} KB`;X(l,async c=>{c&&(a.value=null,a.value=(await t.state.session.document.save()).length)});async function u(){if(!i.value){i.value="正在压缩…";try{const c=await IE(t.state,s.value,o.value,t.host.ownerDocument,(d,p)=>{i.value=`正在压缩 ${d}/${p}`});t.state.toaster.create(c.after<c.before?{type:"success",title:`已压缩 ${c.pictures} 张图片`,description:`文件从 ${r(c.before)} 减小到 ${r(c.after)}`}:{type:"info",title:"图片已足够小,无需压缩"}),n.value=null}finally{i.value=null}}}return(c,d)=>(x(),B(m(Ae),{open:l.value,"onUpdate:open":d[3]||(d[3]=p=>!p&&!i.value&&(n.value=null))},{default:A(()=>[y(m(Te),{title:"压缩图片",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",disabled:i.value!==null,onClick:d[2]||(d[2]=p=>n.value=null)},{default:A(()=>[...d[4]||(d[4]=[R("取消",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",color:"primary",variant:"solid",busy:i.value!==null,onClick:u},{default:A(()=>[R(N(i.value??"压缩"),1)]),_:1},8,["busy"])]),default:A(()=>[k("div",BE,[y(m(Ke),{modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=p=>s.value=p),label:"分辨率",items:m(ua).map(([p,,f])=>({value:p,label:f}))},null,8,["modelValue","items"]),y(m(Ce),{checked:o.value,"onUpdate:checked":d[1]||(d[1]=p=>o.value=p),label:"删除文稿中未使用的媒体"},null,8,["checked"]),k("p",OE,"当前文件 "+N(a.value===null?"…":r(a.value))+",压缩作用于所有幻灯片中的图片,可撤销。",1)])]),_:1})]),_:1},8,["open"]))}}),NE={class:"pptx-properties"},RE={class:"pptx-properties-facts"},jE={class:"text-qk-text-secondary"},KE=O({__name:"properties-dialog",props:{state:{},host:{}},setup(e){const t=e,n=Bl(t.state).dialog,l=F(()=>n.value==="properties"),s=Vb({title:"",subject:"",creator:"",keywords:"",description:""}),o=Q([]),a=[["title","标题"],["subject","主题"],["creator","作者"],["keywords","关键词"]],i=c=>c?new Date(c).toLocaleString("zh-CN",{dateStyle:"medium",timeStyle:"short"}):"—",r=c=>c>=1024*1024?`${(c/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(c/1024))} KB`;X(l,async c=>{if(!c)return;const{document:d}=t.state.session,p=d.presentation();Object.assign(s,c2(p));const f=Mc(p),h=[{label:"幻灯片",value:`${pe(p).length} 张`},{label:"字数",value:String(p2(p))},{label:"创建时间",value:i(f?.created)},{label:"修改时间",value:i(f?.modified)}];o.value=[...h,{label:"文件大小",value:"…"}];const v=await d.save();l.value&&(o.value=[...h,{label:"文件大小",value:r(v.length)}])});function u(){t.state.session.commands.setDocumentProperties({properties:{...s}})&&(n.value=null)}return(c,d)=>(x(),B(m(Ae),{open:l.value,"onUpdate:open":d[2]||(d[2]=p=>!p&&(n.value=null))},{default:A(()=>[y(m(Te),{title:"文档属性",size:"medium",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:d[1]||(d[1]=p=>n.value=null)},{default:A(()=>[...d[3]||(d[3]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",onClick:u},{default:A(()=>[...d[4]||(d[4]=[R("确定",-1)])]),_:1})]),default:A(()=>[k("div",NE,[k("form",{class:"pptx-properties-form",onSubmit:J(u,["prevent"])},[(x(),M(U,null,H(a,([p,f])=>y(m(re),{key:p,label:f},{default:A(({controlProps:h})=>[y(m(Oe),ie({ref_for:!0},h,{modelValue:s[p],"onUpdate:modelValue":v=>s[p]=v,maxlength:1e3}),null,16,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])),64)),y(m(re),{label:"备注"},{default:A(({controlProps:p})=>[y(m(Ct),ie(p,{modelValue:s.description,"onUpdate:modelValue":d[0]||(d[0]=f=>s.description=f),width:"100%",rows:3,maxlength:1e3}),null,16,["modelValue"])]),_:1})],32),k("dl",RE,[(x(!0),M(U,null,H(o.value,p=>(x(),M(U,{key:p.label},[k("dt",jE,N(p.label),1),k("dd",null,N(p.value),1)],64))),128))])])]),_:1})]),_:1},8,["open"]))}}),fv=54e5,xu=['xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"','xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"','xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"','xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"','xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"'].join(" "),Jn='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',mv=e=>e.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/gu,"").replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">");function ya(e,t=!1){const n=e.split(" ").map(l=>`<w:t xml:space="preserve">${mv(l)}</w:t>`).join("<w:tab/>");return`<w:r>${t?"<w:rPr><w:b/></w:rPr>":""}${n}</w:r>`}const Ol=(e,t)=>`<w:p>${e?`<w:pPr>${e}</w:pPr>`:""}${t}</w:p>`;function WE(e,t,n){const l=fv,s=Math.round(fv*n.height/n.width);return Ol('<w:jc w:val="center"/>',`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${l}" cy="${s}"/><wp:docPr id="${e}" name="幻灯片 ${e}"/><a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic><pic:nvPicPr><pic:cNvPr id="${e}" name="slide${e}.png"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${t}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${l}" cy="${s}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`)}const qE=`${Jn}<w:styles ${xu}><w:docDefaults><w:rPrDefault><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="en-US" w:eastAsia="zh-CN"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="120" w:line="300" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style><w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="360" w:after="160"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:b/><w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="ListParagraph"><w:name w:val="List Paragraph"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:after="60"/></w:pPr></w:style><w:style w:type="paragraph" w:styleId="Notes"><w:name w:val="Notes"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:pBdr><w:left w:val="single" w:sz="12" w:space="8" w:color="BFBFBF"/></w:pBdr><w:ind w:left="200"/></w:pPr><w:rPr><w:color w:val="595959"/></w:rPr></w:style></w:styles>`,_E=`${Jn}<w:numbering ${xu}><w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="hybridMultilevel"/>`+Array.from({length:9},(e,t)=>`<w:lvl w:ilvl="${t}"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="${["•","–","▪"][t%3]}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${420*(t+1)}" w:hanging="420"/></w:pPr></w:lvl>`).join("")+'</w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num></w:numbering>';function GE(e,t){const n=[],l=`${Jn}<w:document ${xu}><w:body>${e.map((u,c)=>{const d=Ol(`<w:pStyle w:val="Heading1"/>${u.picture&&c>0?"<w:pageBreakBefore/>":""}`,ya(u.title||`第 ${u.number} 页`));let p="";if(u.picture){const v=`rIdImage${n.length+1}`;n.push({name:`word/media/slide${n.length+1}.png`,bytes:u.picture.bytes,relation:v}),p=WE(n.length,v,u.picture)}const f=u.body.map(v=>Ol(`<w:pStyle w:val="ListParagraph"/><w:numPr><w:ilvl w:val="${v.level}"/><w:numId w:val="1"/></w:numPr>`,ya(v.text))).join(""),h=u.notes?Ol('<w:pStyle w:val="Notes"/>',ya("备注",!0))+u.notes.split(`
|
|
84
|
+
`).map(v=>Ol('<w:pStyle w:val="Notes"/>',ya(v))).join(""):"";return d+p+f+h}).join("")||Ol("","")}<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="851" w:footer="992" w:gutter="0"/></w:sectPr></w:body></w:document>`,s=`${Jn}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rIdNumbering" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/>`+n.map(u=>`<Relationship Id="${u.relation}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="${u.name.slice(5)}"/>`).join("")+"</Relationships>",o=`${Jn}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Default Extension="png" ContentType="image/png"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/></Types>`,a=`${Jn}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/></Relationships>`,i=`${Jn}<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:title>${mv(t)}</dc:title></cp:coreProperties>`,r=(u,c)=>({name:u,bytes:new TextEncoder().encode(c)});return Ch([r("[Content_Types].xml",o),r("_rels/.rels",a),r("docProps/core.xml",i),r("word/document.xml",l),r("word/_rels/document.xml.rels",s),r("word/styles.xml",qE),r("word/numbering.xml",_E),...n.map(u=>({name:u.name,bytes:u.bytes}))])}function hv(e){if(!e)return null;try{return{text:ze(e),paragraphs:pl(e)}}catch{return null}}function HE(e,t){const n=hv(Tr(t)),l=Ar(t),s=hv(l),o=[];if(l&&s){const a=s.text.split(`
|
|
85
|
+
`),i=a.length===s.paragraphs;a.forEach((r,u)=>{if(r.trim()==="")return;const c=i?di(e,l,u).level:0;o.push({text:r,level:Math.min(8,Math.max(0,c))})})}return{title:n?n.text.replace(/\s*\n\s*/gu," ").trim():"",body:o,notes:(In(t)??"").trim()}}const QE=1280;async function XE(e,t,n=()=>{}){const l=e.session.document.presentation();let s;if(t.pictures){const i=await ha(e,{format:"png",range:{kind:"all"},width:QE},n);s=i.positions.map((r,u)=>({part:i.deck.parts[r],number:r+1,picture:i.pictures[u]}))}else s=e.slides.value.flatMap((i,r)=>i.hidden?[]:[{part:i.part,number:r+1}]);const o=s.flatMap(i=>{const r=e.slide(i.part);if(!r)return[];const u=HE(l,r);return[{...u,notes:t.notes?u.notes:"",number:i.number,picture:i.picture}]}),a=Qn(e.session.name());return kt(document,GE(o,a),`${a}.docx`,"application/vnd.openxmlformats-officedocument.wordprocessingml.document"),o.length}const ZE={key:0,class:"pptx-outline-form"},YE=O({__name:"outline-dialog",props:{state:{},host:{}},setup(e){const t=e,n=Bl(t.state).dialog,l=F(()=>n.value==="outline"),s=V(!0),o=V(!0),a=Q(null);async function i(){if(!a.value){a.value={done:0};try{const r=await XE(t.state,{pictures:s.value,notes:o.value},(u,c)=>{a.value={done:c===0?1:u/c}});t.state.toaster.create({type:"success",title:`已导出 ${r} 页的 Word 讲义`}),n.value=null}catch{t.state.toaster.create({type:"error",title:"导出 Word 讲义失败",description:"大纲未能写成 Word 文档,请重试。"})}finally{a.value=null}}}return(r,u)=>(x(),B(m(Ae),{open:l.value,"onUpdate:open":u[3]||(u[3]=c=>!c&&!a.value&&(n.value=null))},{default:A(()=>[y(m(Te),{title:"导出为 Word 讲义",size:"small","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",disabled:!!a.value,onClick:u[2]||(u[2]=c=>n.value=null)},{default:A(()=>[...u[5]||(u[5]=[R("取消",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!!a.value,onClick:i},{default:A(()=>[...u[6]||(u[6]=[R("导出",-1)])]),_:1},8,["disabled"])]),default:A(()=>[a.value?(x(),B(m(mc),{key:1,"model-value":Math.round(a.value.done*100),label:"正在绘制幻灯片…","show-label":"","show-value":""},null,8,["model-value"])):(x(),M("div",ZE,[u[4]||(u[4]=k("p",{class:"pptx-outline-note text-qk-text-secondary"},"每页标题写成 Word 标题,正文按大纲级别写成项目列表,可在 Word 的导航窗格中按页跳转。",-1)),y(m(Ce),{checked:s.value,"onUpdate:checked":u[0]||(u[0]=c=>s.value=c),label:"包含幻灯片图片(每页一张)"},null,8,["checked"]),y(m(Ce),{checked:o.value,"onUpdate:checked":u[1]||(u[1]=c=>o.value=c),label:"包含备注"},null,8,["checked"])]))]),_:1})]),_:1},8,["open"]))}}),JE=["opacity","visibility","transform","translate","rotate","scale","clip-path","filter","transform-origin","transform-box"];function vv(e,t,n,l){const{width:s,height:o}=l,a=e.createElement("div");a.style.cssText=`position:fixed;left:-${s*4}px;top:0;width:${s}px;height:${o}px;pointer-events:none;contain:strict`,e.body.append(a);const i=Qa(a,t,n,[],()=>!1),r=i.element.querySelector("svg"),u=r?[...r.querySelectorAll("*")]:[],c=new Map(u.map((b,w)=>[b,w])),d=sc(n),p=d.map((b,w)=>d.slice(0,w).reduce((S,C)=>S+C,0)),f=d.reduce((b,w)=>b+w,0),h=e.createElement("canvas");h.width=s,h.height=o;const v=h.getContext("2d");function g(b){if(b<0)return i.player.jumpTo(0);if(b>=f)return i.player.finish();let w=d.length-1;for(;w>0&&p[w]>b;)w-=1;i.player.seek(w+1,b-p[w])}function $(){const b=r.cloneNode(!0),w=[...b.querySelectorAll("*")];for(const S of r.getAnimations({subtree:!0})){const C=S.effect?.target,E=C?c.get(C):void 0,T=E===void 0?void 0:w[E];if(!C||!(T instanceof SVGElement||T instanceof HTMLElement))continue;const z=e.defaultView.getComputedStyle(C);for(const D of JE)T.style.setProperty(D,z.getPropertyValue(D))}return b.setAttribute("width",String(s)),b.setAttribute("height",String(o)),new XMLSerializer().serializeToString(b)}return{totalMs:f,async frame(b){if(!r||!v)throw new Error("The slide could not be drawn.");g(b);const w=new Image;return w.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent($())}`,await w.decode(),v.fillStyle="#fff",v.fillRect(0,0,s,o),v.drawImage(w,0,0,s,o),createImageBitmap(h)},dispose(){i.player.dispose(),a.remove()}}}const e6=e=>e<.5?2*e*e:1-(-2*e+2)**2/2,t6={right:[1,0],left:[-1,0],bottom:[0,1],top:[0,-1]};function n6(e,t,n=[]){const{width:l,height:s}=e.canvas,o=new Map,a=(u,c=1)=>{e.globalAlpha=c,u&&e.drawImage(u,0,0,l,s),e.globalAlpha=1},i=(u,c,d)=>{u&&e.drawImage(u,c,d,l,s)},r=(u,c)=>{const d=new Path2D;u(d),e.save(),e.clip(d),a(c),e.restore()};return{paint(u,c){if(e.fillStyle="#000",e.fillRect(0,0,l,s),c){a(c);return}const d=u.settled?t[u.slide]:n[u.slide]??t[u.slide],p=u.previous===null?void 0:t[u.previous],f=u.transition;if(!f||u.progress>=1){a(d);return}let h=o.get(f);if(!h){const w=f.effect==="random"?mb():f.effect;h={effect:w,region:ob(w,f.direction,f.spokes)},o.set(f,h)}const v=u.progress,g=e6(v),[$,b]=t6[f.from??"right"];if(h.region){a(p);const w=h.region(v,l,s);w&&r(S=>S.addPath(new Path2D(w)),d);return}switch(h.effect){case"push":case"pan":i(p,-$*g*l,-b*g*s),i(d,$*(1-g)*l,b*(1-g)*s);return;case"cover":a(p),i(d,$*(1-g)*l,b*(1-g)*s);return;case"pull":case"reveal":a(d),i(p,-$*g*l,-b*g*s);return;case"wipe":{a(p);const w=$>0?l*(1-g):0,S=b>0?s*(1-g):0;r(C=>C.rect(w,S,$===0?l:l*g,b===0?s:s*g),d);return}case"split":case"doors":case"window":{const w=(f.orientation??(f.direction==="horz"?"horz":"vert"))!=="horz",S=h.effect==="split"&&f.inOut==="in",C=S?1-g:g;a(S?d:p),r(E=>w?E.rect(l*(1-C)/2,0,l*C,s):E.rect(0,s*(1-C)/2,l,s*C),S?p:d);return}case"zoom":case"warp":case"flythrough":{const w=f.inOut==="out";a(p,w?1:1-g);const S=w?1.6-.6*g:.3+.7*g;e.save(),e.translate(l/2,s/2),e.scale(S,S),e.translate(-l/2,-s/2),a(d,g),e.restore();return}case"newsflash":a(p),e.save(),e.translate(l/2,s/2),e.rotate((1-g)*4*Math.PI),e.scale(Math.max(.001,g),Math.max(.001,g)),e.translate(-l/2,-s/2),a(d),e.restore();return;case"flash":a(d,Math.min(1,v/.3)),e.fillStyle=`rgba(255,255,255,${Math.max(0,1-v)*.9})`,e.fillRect(0,0,l,s);return;case"cut":v>=.5&&a(d);return;default:f.thruBlack?v<.5?a(p,1-v*2):a(d,v*2-1):(a(p),a(d,g))}}}}function gv(e,t,n=[]){let l=0;return{segments:e.map((s,o)=>{const a=t.transitions&&o>0&&s.effect!=="none"&&s.durationMs>0,i=a?s.effect==="cut"?400:s.durationMs:0,r=Math.max(0,n[o]??0),u=t.useTimings&&s.advanceAfterMs!==void 0?Math.max(0,s.advanceAfterMs-r):t.seconds*1e3,c={slide:o,transition:a?s:null,transitionMs:i,animationMs:r,holdMs:u,startMs:l};return l+=i+r+u,c}),totalMs:l}}function l6(e,t){const n=[...e].reverse().find(a=>a.startMs<=t)??e[0],l=t-n.startMs;if(n.transition&&l<n.transitionMs)return{slide:n.slide,previous:n.slide-1,progress:Math.max(0,l/n.transitionMs),transition:n.transition,animation:null,settled:!1};const s=l-n.transitionMs,o=s<n.animationMs;return{slide:n.slide,previous:null,progress:1,transition:null,animation:o?s:null,settled:!o}}function bv(e,t,n){const l=[],s=1e3/n,o=(i,r,u)=>{for(let c=i;c<r-.5;c+=u)l.push(Math.round(c))};for(const i of e){const r=i.startMs+i.transitionMs+i.animationMs;o(i.startMs,r,s),o(r,r+i.holdMs,1e3)}const a=Math.round(t-s);return(l.length===0||l.at(-1)<a)&&l.push(Math.max(0,a)),[...new Set(l)].sort((i,r)=>i-r)}const yv=e=>sc(e).reduce((t,n)=>t+n,0);async function s6(e,t,n,l,s){const o=[];for(const[a,i]of t.entries()){if(n[a].length===0)continue;const r=vv(document,e.render(i),n[a],s);try{o[a]=await r.frame(-1),l[a].close(),l[a]=await r.frame(r.totalMs)}finally{r.dispose()}}return o}async function xv(e,t,n){const l=await ha(e,{format:"png",range:t.range,width:t.width},(f,h)=>n(h===0?1:f/h));if(l.pictures.length===0)return null;const s=await Promise.all(l.pictures.map(f=>createImageBitmap(new Blob([f.bytes],{type:"image/png"})))),o=document.createElement("canvas");o.width=Math.round(l.pictures[0].width/2)*2,o.height=Math.round(l.pictures[0].height/2)*2;const a=o.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("Canvas 2D is unavailable.");const i=l.positions.map(f=>t.animations?l.deck.animations(f):[]),r=await s6(l.deck,l.positions,i,s,o),u=n6(a,s,r),{segments:c,totalMs:d}=gv(l.positions.map(f=>l.deck.transition(f)),t,i.map(yv));let p=null;return{canvas:o,segments:c,totalMs:d,async draw(f){const h=l6(c,f);if(h.animation===null)return u.paint(h);p?.index!==h.slide&&(p?.animator.dispose(),p={index:h.slide,animator:vv(document,l.deck.render(l.positions[h.slide]),i[h.slide],o)});const v=await p.animator.frame(h.animation);u.paint(h,v),v.close()},dispose(){p?.animator.dispose(),p=null;for(const f of[...s,...r])f?.close()}}}function o6(e,t,n){const l=t.length/4/n;if(!e)return{left:0,top:0,width:n,height:l};let s=n,o=-1,a=l,i=-1;const r=new Uint32Array(e.buffer,e.byteOffset,e.length/4),u=new Uint32Array(t.buffer,t.byteOffset,t.length/4);for(let c=0;c<l;c+=1){const d=c*n;for(let p=0;p<n;p+=1)r[d+p]!==u[d+p]&&(p<s&&(s=p),p>o&&(o=p),c<a&&(a=c),i=c)}return o<0?null:{left:s,top:a,width:o-s+1,height:i-a+1}}function a6(e,t,n){const l=new Uint8ClampedArray(n.width*n.height*4);for(let s=0;s<n.height;s+=1){const o=((n.top+s)*t+n.left)*4;l.set(e.subarray(o,o+n.width*4),s*n.width*4)}return l}const wu=(e,t)=>e>>10-t*5&31;function i6(e){const t=new Uint32Array(32768),n=new Float64Array(32768*3),l=new Uint16Array(e.length/4);for(let u=0,c=0;c<e.length;u+=1,c+=4){const d=e[c]>>3<<10|e[c+1]>>3<<5|e[c+2]>>3;l[u]=d,t[d]+=1,n[d*3]+=e[c],n[d*3+1]+=e[c+1],n[d*3+2]+=e[c+2]}const s=[];for(let u=0;u<32768;u+=1)t[u]>0&&s.push(u);const o=[{keys:s,count:l.length}];for(;o.length<256;){let u=-1,c=0,d=0;for(const[b,w]of o.entries())if(!(w.keys.length<2))for(let S=0;S<3;S+=1){let C=31,E=0;for(const z of w.keys){const D=wu(z,S);D<C&&(C=D),D>E&&(E=D)}const T=(E-C)*w.count;T>c&&([u,c,d]=[b,T,S])}if(u<0)break;const p=o[u];p.keys.sort((b,w)=>wu(b,d)-wu(w,d));let f=0,h=1;for(;h<p.keys.length-1&&(f+=t[p.keys[h-1]],!(f*2>=p.count));h+=1);const v=p.keys.slice(0,h),g=p.keys.slice(h),$=b=>b.reduce((w,S)=>w+t[S],0);o.splice(u,1,{keys:v,count:$(v)},{keys:g,count:$(g)})}const a=new Uint8Array(768),i=new Uint8Array(32768);for(const[u,c]of o.entries()){let d=0,p=0,f=0;for(const v of c.keys)i[v]=u,d+=n[v*3],p+=n[v*3+1],f+=n[v*3+2];const h=Math.max(1,c.count);a.set([Math.round(d/h),Math.round(p/h),Math.round(f/h)],u*3)}const r=new Uint8Array(l.length);for(let u=0;u<l.length;u+=1)r[u]=i[l[u]];return{palette:a,indices:r}}const r6=4095;function u6(e){const s=[];let o=0,a=0;const i=(f,h)=>{for(o|=f<<a,a+=h;a>=8;)s.push(o&255),o>>>=8,a-=8},r=new Map;let u=258,c=9;i(256,c);let d=e.length>0?e[0]:-1;for(let f=1;f<e.length;f+=1){const h=e[f],v=d<<8|h,g=r.get(v);if(g!==void 0){d=g;continue}i(d,c),u<=r6?(r.set(v,u),u===1<<c&&c<12&&(c+=1),u+=1):(i(256,c),r.clear(),u=258,c=9),d=h}d>=0&&i(d,c),i(257,c),a>0&&s.push(o&255);const p=[8];for(let f=0;f<s.length;f+=255){const h=s.slice(f,f+255);p.push(h.length,...h)}return p.push(0),new Uint8Array(p)}const el=e=>[e&255,e>>8&255];function c6(e,t,n,l){const s=[];s.push(new Uint8Array([...new TextEncoder().encode("GIF89a"),...el(e),...el(t),0,0,0])),l&&s.push(new Uint8Array([33,255,11,...new TextEncoder().encode("NETSCAPE2.0"),3,1,0,0,0]));for(const i of n)s.push(new Uint8Array([33,249,4,4,...el(Math.max(2,Math.round(i.delayCs))),0,0])),s.push(new Uint8Array([44,...el(i.left),...el(i.top),...el(i.width),...el(i.height),135])),s.push(i.picture.palette),s.push(u6(i.picture.indices));s.push(new Uint8Array([59]));const o=new Uint8Array(s.reduce((i,r)=>i+r.length,0));let a=0;for(const i of s)o.set(i,a),a+=i.length;return o}const d6=15;async function p6(e,t,n,l){const s=await xv(e,t,o=>n("draw",o));if(!s)return!1;try{const{canvas:o,totalMs:a}=s,{width:i,height:r}=o,u=o.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("Canvas 2D is unavailable.");const c=bv(s.segments,a,d6),d=[];let p=null,f=null;const h=v=>{f&&d.push({...f.rect,picture:f.picture,delayCs:Math.round(v/10)-Math.round(f.start/10)}),f=null};for(const[v,g]of c.entries()){if(l.aborted)return!1;await s.draw(g);const $=u.getImageData(0,0,i,r).data,b=o6(p,$,i);n("record",(v+1)/c.length),b&&(h(g),f={rect:b,picture:i6(a6($,i,b)),start:g},p=$,await new Promise(w=>setTimeout(w,0)))}return h(a),kt(document,c6(i,r,d,t.loop),`${Qn(e.session.name())}.gif`,"image/gif"),!0}finally{s.dispose()}}const f6=3e4;function xa(e){const t=new Uint8Array(e.reduce((l,s)=>l+s.length,0));let n=0;for(const l of e)t.set(l,n),n+=l.length;return t}function Ge(e,t){let n=t??1;for(;t===void 0&&n<8&&e>=2**(8*n);)n+=1;const l=new Uint8Array(n);for(let s=n-1,o=e;s>=0;s-=1,o=Math.floor(o/256))l[s]=o%256;return l}function m6(e){let t=1;for(;t<8&&e>=2**(7*t)-1;)t+=1;const n=Ge(e,t);return n[0]|=128>>t-1,n}function ve(e,t){const n=t instanceof Uint8Array?t:xa(t);return xa([Ge(e),m6(n.length),n])}const wa=e=>new TextEncoder().encode(e);function h6(e){const t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e),t}function v6(e,t){const n=ve(440786851,[ve(17030,Ge(1)),ve(17143,Ge(1)),ve(17138,Ge(4)),ve(17139,Ge(8)),ve(17026,wa("webm")),ve(17031,Ge(4)),ve(17029,Ge(2))]),l=ve(357149030,[ve(2807729,Ge(1e6)),ve(19840,wa("QuireKit")),ve(22337,wa("QuireKit")),ve(17545,h6(t.durationMs))]),s=ve(374648427,[ve(174,[ve(215,Ge(1)),ve(29637,Ge(1)),ve(131,Ge(1)),ve(156,Ge(0)),ve(134,wa(t.codec)),ve(224,[ve(176,Ge(t.width)),ve(186,Ge(t.height))])])]),o=[];for(const d of e){const p=Math.round(d.timeMs);let f=o.at(-1);(!f||d.key||p-f.timeMs>f6)&&o.push(f={timeMs:p,blocks:[]});const h=new Uint8Array([129,0,0,d.key?128:0]);new DataView(h.buffer).setInt16(1,p-f.timeMs),f.blocks.push(ve(163,xa([h,d.data])))}const a=o.map(d=>ve(524531317,[ve(231,Ge(d.timeMs)),...d.blocks])),i=(d,p)=>ve(19899,[ve(21419,Ge(d)),ve(21420,Ge(p,8))]),r=ve(290298740,[i(357149030,0),i(374648427,0),i(475249515,0)]).length;let u=r+l.length+s.length;const c=ve(475249515,a.map((d,p)=>{const f=ve(187,[ve(179,Ge(o[p].timeMs)),ve(183,[ve(247,Ge(1)),ve(241,Ge(u))])]);return u+=d.length,f}));return xa([n,ve(408125543,[ve(290298740,[i(357149030,r),i(374648427,r+l.length),i(475249515,u)]),l,s,...a,c])])}const g6=[["vp09.00.10.08","V_VP9"],["vp8","V_VP8"]],b6=2e3,y6=8;function wv(){return typeof VideoEncoder<"u"&&typeof VideoFrame<"u"}async function x6(e,t){for(const[n,l]of g6){const s={codec:n,width:e,height:t,bitrate:8e6,framerate:30};if((await VideoEncoder.isConfigSupported(s).catch(()=>null))?.supported)return{config:s,codec:l}}return null}async function w6(e){for(;e.encodeQueueSize>y6;)await new Promise(t=>{e.addEventListener("dequeue",()=>t(),{once:!0}),setTimeout(t,50)})}async function k6(e,t,n,l,s={}){const o=await x6(e.width,e.height);if(!o)throw new Error("This browser does not encode VP9 or VP8 video.");const a=[];let i=null;const r=new VideoEncoder({output(d){const p=new Uint8Array(d.byteLength);d.copyTo(p),a.push({timeMs:d.timestamp/1e3,key:d.type==="key",data:p})},error(d){i=d}});r.configure(o.config);let u=-1/0;try{for(const[d,p]of t.entries()){if(s.signal?.aborted||i)break;await l(p);const f=p-u>=b6;f&&(u=p);const h=new VideoFrame(e,{timestamp:Math.round(p*1e3)});r.encode(h,{keyFrame:f}),h.close(),s.progress?.((d+1)/t.length),await w6(r)}!s.signal?.aborted&&!i&&await r.flush()}finally{r.state!=="closed"&&r.close()}if(i)throw i;if(s.signal?.aborted)return null;a.sort((d,p)=>d.timeMs-p.timeMs);const c=v6(a,{codec:o.codec,width:e.width,height:e.height,durationMs:n});return new Blob([c],{type:"video/webm"})}const kv=30;function $v(){return typeof MediaRecorder>"u"?null:["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"].find(e=>MediaRecorder.isTypeSupported(e))??null}async function $6(e,t,n,l={}){const s=$v();if(!s)throw new Error("This browser does not record WebM video.");const o=e.captureStream(kv),a=new MediaRecorder(o,{mimeType:s,videoBitsPerSecond:8e6}),i=[];a.addEventListener("dataavailable",c=>{c.data.size>0&&i.push(c.data)});const r=new Promise(c=>a.addEventListener("stop",()=>c(),{once:!0}));n(0),a.start(1e3);const u=performance.now();await new Promise(c=>{const d=setInterval(()=>{const p=performance.now()-u;if(l.signal?.aborted||p>=t){clearInterval(d),n(Math.min(p,t)),c();return}n(p),l.progress?.(p/t)},1e3/kv)}),a.stop(),await r;for(const c of o.getTracks())c.stop();return l.signal?.aborted?null:(l.progress?.(1),new Blob(i,{type:"video/webm"}))}const S6=30;async function C6(e,t,n,l){const s=wv(),o=await xv(e,{...t,animations:t.animations&&s},a=>n("draw",a));if(!o)return!1;try{if(l.aborted)return!1;const a={signal:l,progress:r=>n("record",r)},i=s?await k6(o.canvas,bv(o.segments,o.totalMs,S6),o.totalMs,o.draw,a):await $6(o.canvas,o.totalMs,r=>{o.draw(r)},a);return i?(kt(document,i,`${Qn(e.session.name())}.webm`,"video/webm"),!0):!1}finally{o.dispose()}}const M6={class:"pptx-video-row"},P6={class:"pptx-video-note text-qk-text-secondary"},T6={key:1,class:"pptx-video-progress"},A6={id:"file",intent:(e,t)=>pv(e,t),overlays:[zE,O({__name:"video-dialog",props:{state:{},host:{}},setup(e){const t=e,n=Bl(t.state).dialog,l=F(()=>n.value==="gif"),s=F(()=>n.value==="video"||l.value),o=V("all"),a=V("1920"),i=V("5"),r=V(!0),u=V(!0),c=V(!0),d=V(!0),p=Q(null),f=wv(),h=F(()=>l.value||f||$v()!==null),v=F(()=>l.value||f),g=F(()=>t.state.size.value.height/t.state.size.value.width),$=F(()=>(l.value?[480,640,960]:[1280,1920]).map(C=>({value:String(C),label:`${C}×${Math.round(C*g.value/2)*2}`})));X(s,C=>{C&&(r.value=os(t.state.session.document.presentation()).useTimings,a.value=l.value?"640":"1920")});const b=F(()=>{t.state.tick.value;const C=t.state.current.value,E=(o.value==="current"?C?[C]:[]:t.state.slides.value.filter(D=>!D.hidden)).map(D=>t.state.slide(D.part)),T=E.map(D=>ac(ro(D))),z=v.value&&c.value?E.map(D=>yv(rb(D).main)):[];return gv(T,{seconds:Math.max(1,Number(i.value)||5),useTimings:r.value,transitions:u.value},z).totalMs}),w=F(()=>{const C=p.value;return C?C.stage==="draw"?"正在绘制幻灯片…":`${v.value?"正在输出":"正在录制"} ${Jt(C.done*b.value)} / ${Jt(b.value)}`:""});async function S(){if(p.value)return;const C=new AbortController;p.value={stage:"draw",done:0,controller:C};const E=l.value,T={range:{kind:o.value},width:Number(a.value),seconds:Math.max(1,Number(i.value)||5),useTimings:r.value,transitions:u.value,animations:c.value},z=(D,P)=>{p.value={stage:D,done:P,controller:C}};try{(E?await p6(t.state,{...T,loop:d.value},z,C.signal):await C6(t.state,T,z,C.signal))&&(t.state.toaster.create({type:"success",title:E?"GIF 动图已输出":"视频已输出"}),n.value=null)}catch{t.state.toaster.create({type:"error",title:E?"输出 GIF 失败":"输出视频失败",description:E?"幻灯片未能做成动图,请重试。":"幻灯片未能录制成视频,请重试。"})}finally{p.value=null}}return(C,E)=>(x(),B(m(Ae),{open:s.value,"onUpdate:open":E[9]||(E[9]=T=>!T&&!p.value&&(n.value=null))},{default:A(()=>[y(m(Te),{title:l.value?"输出为 GIF":"输出为视频",size:"medium","show-close":!1},{footer:A(()=>[p.value?(x(),B(m(q),{key:0,type:"button",onClick:E[7]||(E[7]=T=>p.value.controller.abort())},{default:A(()=>[...E[10]||(E[10]=[R("取消",-1)])]),_:1})):(x(),M(U,{key:1},[y(m(q),{type:"button",onClick:E[8]||(E[8]=T=>n.value=null)},{default:A(()=>[...E[11]||(E[11]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!h.value||b.value<=0,onClick:S},{default:A(()=>[...E[12]||(E[12]=[R("输出",-1)])]),_:1},8,["disabled"])],64))]),default:A(()=>[p.value?(x(),M("div",T6,[y(m(mc),{"model-value":Math.round(p.value.done*100),label:w.value,"show-label":"","show-value":""},null,8,["model-value","label"])])):(x(),M("form",{key:0,class:"pptx-video-form",onSubmit:J(S,["prevent"])},[y(m(Ke),{modelValue:o.value,"onUpdate:modelValue":E[0]||(E[0]=T=>o.value=T),label:"范围",items:[{value:"all",label:"全部幻灯片"},{value:"current",label:"当前幻灯片"}],orientation:"horizontal"},null,8,["modelValue"]),k("div",M6,[y(m(re),{label:"分辨率"},{default:A(({controlProps:T})=>[y(m(ce),ie(T,{modelValue:a.value,"onUpdate:modelValue":E[1]||(E[1]=z=>a.value=z),label:"分辨率",items:$.value}),null,16,["modelValue","items"])]),_:1}),y(m(re),{label:"每页停留(秒)"},{default:A(({controlProps:T})=>[y(m(de),ie(T,{modelValue:i.value,"onUpdate:modelValue":E[2]||(E[2]=z=>i.value=z),label:"每页停留(秒)",min:1,max:600,step:1}),null,16,["modelValue"])]),_:1})]),y(m(Ce),{checked:r.value,"onUpdate:checked":E[3]||(E[3]=T=>r.value=T),label:"有排练计时的页按排练时间停留"},null,8,["checked"]),y(m(Ce),{checked:u.value,"onUpdate:checked":E[4]||(E[4]=T=>u.value=T),label:"包含切换效果"},null,8,["checked"]),v.value?(x(),B(m(Ce),{key:0,checked:c.value,"onUpdate:checked":E[5]||(E[5]=T=>c.value=T),label:"包含对象动画"},null,8,["checked"])):L("v-if",!0),l.value?(x(),B(m(Ce),{key:1,checked:d.value,"onUpdate:checked":E[6]||(E[6]=T=>d.value=T),label:"循环播放"},null,8,["checked"])):L("v-if",!0),k("p",P6,N(l.value?"动图":"视频")+"时长 "+N(m(Jt)(b.value))+N(v.value?"。":",输出需要同样长的时间。")+N(h.value?"":"当前浏览器不支持输出 WebM 视频。"),1)],32))]),_:1},8,["title"])]),_:1},8,["open"]))}}),YE,KE,UE]};async function ka(e,t,n,l=!0){await pt();const s=e.boxes.value.find(c=>c.id===n),o=t.ownerDocument.querySelector(".pptx-slide-frame");if(!s||!o)return;const a=o.getBoundingClientRect(),i=a.width/e.size.value.width,r={clientX:a.left+(s.x+s.width/2)*i,clientY:a.top+(s.y+s.height/2)*i};o.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0,cancelable:!0,...r}));for(let c=0;c<20&&e.textEditor.value?.shape!==n;c+=1)await new Promise(d=>setTimeout(d,25));const u=e.textEditor.value;u?.shape===n&&(await new Promise(c=>setTimeout(c,50)),u.view.focus(),l&&t.intent("text:select-all"))}const Sv=new WeakMap;function St(e){let t=Sv.get(e);return t||(t={findOpen:Q(!1),replaceFontOpen:Q(!1),renaming:Q(),collapsed:Q(new Set),lastPaste:Q(),pasteSpecialOpen:Q(!1)},Sv.set(e,t)),t}const E6={class:"pptx-find-options"},F6={class:"pptx-find-status",role:"status"},z6=O({__name:"find-dialog",props:{state:{},host:{}},setup(e){const t=e,n=St(t.state),l=je("root"),s=V(""),o=V(""),a=V(!1),i=V(!1),r=V(!0),u=V(-1),c=F(()=>({query:s.value,matchCase:a.value,wholeWord:i.value,matchWidth:r.value})),d=F(()=>(t.state.settled.value,n.findOpen.value?of(t.state.session.document.presentation(),c.value):[]));X(c,()=>{u.value=-1}),X(n.findOpen,w=>{w&&(u.value=-1)});const p=F(()=>{if(s.value.length===0)return"";if(d.value.length===0)return"未找到匹配内容";const w=d.value[u.value];if(!w)return`共 ${d.value.length} 处`;const S=w.location.kind==="notes"?"备注":w.location.kind==="cell"?"表格":"文字";return`第 ${u.value+1} / ${d.value.length} 处 · 第 ${w.slideIndex+1} 张幻灯片的${S}`});function f(){t.state.textEditor.value&&t.host.ownerDocument.querySelector(".pptx-stage")?.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0}))}async function h(w){if(f(),t.state.session.document.select({slide:w.slide,shapes:w.location.kind==="notes"?[]:[w.location.shape]}),w.location.kind!=="shape")return;const S=w.location.shape;await ka(t.state,t.host,S,!1);const C=t.state.textEditor.value,E=d.value[u.value];C?.shape!==S||!E||JSON.stringify(E)!==JSON.stringify(w)||(C.select({start:w.start,end:w.end}),l.value?.ownerDocument.querySelector(".pptx-find input")?.focus())}function v(w){const S=d.value.length;S!==0&&(u.value=u.value<0?w===1?0:S-1:(u.value+w+S)%S,h(d.value[u.value]))}function g(){const w=d.value[u.value];if(!w){v(1);return}if(f(),!t.state.session.commands.replaceTextMatch({match:w,replace:o.value}))return;const S=d.value;if(S.length===0){u.value=-1;return}u.value=Math.min(u.value,S.length-1)-1,v(1)}function $(){const w=d.value.length;f(),!(w===0||!t.state.session.commands.replaceAllText({...c.value,replace:o.value}))&&(u.value=-1,t.state.toaster.create({type:"success",title:`已替换 ${w} 处`}))}function b(w){if(!(w.metaKey||w.ctrlKey)||w.altKey||w.shiftKey)return;const S=w.key.toLowerCase();S!=="f"&&S!=="h"||w.target?.closest?.(".pptx-app")&&(w.preventDefault(),n.findOpen.value=!0)}return ft(()=>t.host.ownerDocument.addEventListener("keydown",b)),Re(()=>t.host.ownerDocument.removeEventListener("keydown",b)),(w,S)=>(x(),B(m(Ae),{open:m(n).findOpen.value,modal:!1,"trap-focus":!1,"close-on-interact-outside":!1,"onUpdate:open":S[11]||(S[11]=C=>m(n).findOpen.value=C)},{default:A(()=>[y(m(Te),{title:"查找和替换",size:"mini",height:"auto","show-backdrop":!1},{footer:A(()=>[y(m(q),{type:"button",disabled:d.value.length===0,onClick:S[7]||(S[7]=C=>$())},{default:A(()=>[...S[12]||(S[12]=[R("全部替换",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",disabled:d.value.length===0,onClick:S[8]||(S[8]=C=>g())},{default:A(()=>[...S[13]||(S[13]=[R("替换",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",disabled:d.value.length===0,onClick:S[9]||(S[9]=C=>v(-1))},{default:A(()=>[...S[14]||(S[14]=[R("上一个",-1)])]),_:1},8,["disabled"]),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:d.value.length===0,onClick:S[10]||(S[10]=C=>v(1))},{default:A(()=>[...S[15]||(S[15]=[R("查找下一个",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("div",{ref_key:"root",ref:l,class:"pptx-find"},[y(m(Oe),{modelValue:s.value,"onUpdate:modelValue":S[0]||(S[0]=C=>s.value=C),"aria-label":"查找内容",placeholder:"查找内容",clearable:"",onKeydown:S[1]||(S[1]=ue(J(C=>v(C.shiftKey?-1:1),["prevent"]),["enter"]))},null,8,["modelValue"]),y(m(Oe),{modelValue:o.value,"onUpdate:modelValue":S[2]||(S[2]=C=>o.value=C),"aria-label":"替换为",placeholder:"替换为",onKeydown:S[3]||(S[3]=ue(J(C=>g(),["prevent"]),["enter"]))},null,8,["modelValue"]),k("div",E6,[y(m(Ce),{checked:a.value,"onUpdate:checked":S[4]||(S[4]=C=>a.value=C),label:"区分大小写"},null,8,["checked"]),y(m(Ce),{checked:i.value,"onUpdate:checked":S[5]||(S[5]=C=>i.value=C),label:"全字匹配"},null,8,["checked"]),y(m(Ce),{checked:r.value,"onUpdate:checked":S[6]||(S[6]=C=>r.value=C),label:"区分全/半角"},null,8,["checked"])]),k("p",F6,N(p.value),1)],512)]),_:1})]),_:1},8,["open"]))}}),Cv=[["微软雅黑","中文"],["宋体","中文"],["黑体","中文"],["楷体","中文"],["仿宋","中文"],["等线","中文"],["思源黑体","中文"],["思源宋体","中文"],["Arial","西文"],["Calibri","西文"],["Times New Roman","西文"],["Helvetica","西文"],["Georgia","西文"],["Verdana","西文"],["Segoe UI","西文"],["Consolas","西文"]],D6={class:"pptx-replace-font"},L6=O({__name:"replace-font-dialog",props:{state:{}},setup(e){const t=e,n=St(t.state),l=V("eastAsian"),s=V(""),o=V(""),a=F(()=>(t.state.settled.value,n.replaceFontOpen.value?cf(t.state.session.document.presentation()):{latin:[],eastAsian:[]})),i=F(()=>a.value[l.value].map(c=>({value:c,label:c}))),r=F(()=>{const c=Cv.filter(([,d])=>d===(l.value==="eastAsian"?"中文":"西文")).map(([d])=>d);return[...new Set([...c,...a.value[l.value]])].filter(d=>d!==s.value).map(d=>({value:d,label:d}))});X([n.replaceFontOpen,l],()=>{s.value=i.value[0]?.value??"",o.value=""});function u(){!s.value||!o.value||t.state.session.commands.replaceFont({script:l.value,from:s.value,to:o.value})&&(t.state.toaster.create({type:"success",title:`已将“${s.value}”替换为“${o.value}”`}),n.replaceFontOpen.value=!1)}return(c,d)=>(x(),B(m(Ae),{open:m(n).replaceFontOpen.value,"onUpdate:open":d[5]||(d[5]=p=>m(n).replaceFontOpen.value=p)},{default:A(()=>[y(m(Te),{title:"替换字体",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:d[3]||(d[3]=p=>m(n).replaceFontOpen.value=!1)},{default:A(()=>[...d[6]||(d[6]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!s.value||!o.value,onClick:d[4]||(d[4]=p=>u())},{default:A(()=>[...d[7]||(d[7]=[R("替换",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("div",D6,[y(m(al),{"model-value":l.value,label:"字体类别",items:[{value:"eastAsian",label:"中文字体"},{value:"latin",label:"西文字体"}],"onUpdate:modelValue":d[0]||(d[0]=p=>l.value=p==="latin"?"latin":"eastAsian")},null,8,["model-value"]),y(m(re),{label:"替换"},{default:A(({controlProps:p})=>[y(m(ce),ie(p,{modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=f=>s.value=f),label:"替换",items:i.value,width:"100%",placeholder:"文稿中没有这类字体"}),null,16,["modelValue","items"])]),_:1}),y(m(re),{label:"替换为"},{default:A(({controlProps:p})=>[y(m(ce),ie(p,{modelValue:o.value,"onUpdate:modelValue":d[2]||(d[2]=f=>o.value=f),label:"替换为",items:r.value,width:"100%",placeholder:"选择字体"}),null,16,["modelValue","items"])]),_:1})])]),_:1})]),_:1},8,["open"]))}}),$a=18e4;let Ul;function Nl(e,t,n){const l=e.slide(t),s=l?Dn(l):0;if(!n())return;const o=e.slide(t);o&&e.session.document.select({slide:t,shapes:ot(o).map(Fe).filter(a=>a>s)})}async function Sa(e){const t=e.current.value?.part,n=e.selected.value;return!t||n.length===0?!1:(Ul={source:await dn(await vl(e.session.document.presentation())),slide:t,shapes:[...n],pastes:0},!0)}function Ca(e){const t=e.current.value?.part,n=Ul;if(!t||!n)return;const l=t===n.slide?$a*(n.pastes+1):0;Nl(e,t,()=>e.session.commands.pasteShapes({slide:t,source:n.source,sourceSlide:n.slide,shapes:n.shapes,offset:l})),n.pastes+=1}function Mv(e){const t=e.current.value?.part,n=e.selected.value;!t||n.length===0||Nl(e,t,()=>e.session.commands.duplicateShapes({slide:t,shapes:n,offset:$a}))}function Rl(){return Ul!==void 0}function Pv(e){const t=e.current.value?.part,n=Ul;if(!t||!n)return;const l=t===n.slide?$a*(n.pastes+1):0;Nl(e,t,()=>e.session.commands.pasteShapesKeepingFormat({slide:t,source:n.source,sourceSlide:n.slide,shapes:n.shapes,offset:l})),n.pastes+=1}function V6(e,t){const n=e.current.value?.part,l=Ul;if(!n||!l)return;const s=n===l.slide?$a*Math.max(1,l.pastes):0,o={slide:n,source:l.source,sourceSlide:l.slide,shapes:l.shapes,offset:s};Nl(e,n,()=>t?e.session.commands.pasteShapesKeepingFormat(o):e.session.commands.pasteShapes(o))}function ku(){const e=Ul;if(!e)return"";const t=rl(e.source,e.slide);return t?e.shapes.map(n=>{const l=_l(t,n);try{return l?ze(l):""}catch{return""}}).filter(n=>n.length>0).join(`
|
|
86
|
+
`):""}function Ma(e,t){const n=e.current.value?.part;if(!n||t.trim().length===0)return!1;const l=t.split(/\r?\n/u).length;return Nl(e,n,()=>e.session.commands.addTextBox({slide:n,text:t.replace(/\r\n/gu,`
|
|
87
|
+
`),...Ie(e,16,Math.min(12,1.2*l))})),!0}async function Pa(e,t){const n=e.current.value?.part;if(n)try{for(const l of await navigator.clipboard.read()){if(t!=="text"&&l.types.includes("text/html")&&Xf(e,await(await l.getType("text/html")).text(),document))return;const s=t==="text"?void 0:l.types.find(o=>/^image\/(png|jpeg|gif)$/u.test(o));if(s){await I6(e,n,await l.getType(s));return}if(l.types.includes("text/plain")&&Ma(e,await(await l.getType("text/plain")).text()))return}e.toaster.create({type:"info",title:"剪贴板中没有可粘贴的内容"})}catch{e.toaster.create({type:"error",title:"无法读取剪贴板",description:"浏览器没有允许读取剪贴板。"})}}async function I6(e,t,n){const l=new Uint8Array(await n.arrayBuffer());let s=2/3;try{const o=await createImageBitmap(n);o.width>0&&(s=o.height/o.width),o.close()}catch{}Nl(e,t,()=>e.session.commands.addPicture({slide:t,bytes:l,name:"粘贴的图片",...Ie(e,12,12*s)}))}const Ta="web application/x-quirekit-slides",$u="web application/x-quirekit-copy-id";let jl,Tv;function Su(e){Tv=e}function Aa(){return Tv==="slides"}async function Cu(e){const t=e.current.value?.part;if(!t)return!1;const n=await vl(e.session.document.presentation()),l=Wi();return jl={source:await dn(n),slides:[t],id:l},Su("slides"),B6(n,[t],l,e.current.value?.title??""),!0}async function B6(e,t,n,l){try{const s=await dn(e);for(const a of pe(s).filter(i=>!t.includes(We(i))))Ei(s,a);const o=new Blob([new Uint8Array(await vl(s))],{type:Ta.slice(4)});await navigator.clipboard.write([new ClipboardItem({[Ta]:o,[$u]:new Blob([n],{type:"text/plain"}),"text/plain":new Blob([l],{type:"text/plain"})})])}catch{}}async function O6(){try{if((await navigator.permissions.query({name:"clipboard-read"})).state!=="granted"&&jl)return;for(const e of await navigator.clipboard.read()){if(!e.types.includes(Ta))continue;const t=e.types.includes($u)?await(await e.getType($u)).text():"";if(jl&&t===jl.id)return jl;const n=await dn(new Uint8Array(await(await e.getType(Ta)).arrayBuffer()));return{source:n,slides:pe(n).map(We),id:t}}}catch{}}async function Av(e,t,n){const l=await O6()??jl;if(!l){e.toaster.create({type:"info",title:"还没有复制幻灯片"});return}const s=n??(e.current.value?.index??-1)+1;if(!e.session.commands.pasteSlides({source:l.source,slides:l.slides,at:s,mode:t}))return;const o=pe(e.session.document.presentation())[s];return o&&e.session.document.select({slide:We(o),shapes:[]}),{at:s,count:l.slides.length}}async function Ev(e){const t=e.current.value?.part;return!t||e.slides.value.length<=1||!await Cu(e)?!1:e.session.commands.deleteSlide({slide:t})}function tn(e,t,n,l={}){const s=e.current.value?.part,o=t==="shapes"?e.selected.value:[];St(e).lastPaste.value=s&&(t==="slides"||o.length>0)?{kind:t,slide:s,ids:[...o],version:e.session.document.version(),mode:n,...l}:void 0}async function Mu(e,t,n){const l=St(e).lastPaste.value;if(!l||l.mode===t||l.version!==e.session.document.version())return;const{document:s,commands:o}=e.session;if(l.kind==="shapes"&&l.mode==="picture"){await s.undo(),tn(e,"shapes",l.previous??"theme"),t!==(l.previous??"theme")&&await Mu(e,t,n);return}if(l.kind==="shapes"&&t==="picture"){const a=await Oh(e,l.ids,n);if(!a)return;const i=new Uint8Array(await a.png.arrayBuffer()),r=e.session.chain();for(const u of l.ids)r.deleteShape({slide:l.slide,shape:u});r.addPicture({slide:l.slide,bytes:i,name:"粘贴的图片",...a.frame}).run()&&Le(e,l.slide),tn(e,"shapes","picture",{previous:l.mode});return}else if(l.kind==="slides"&&t==="picture"){const a=(await ta(n,e.render(l.slide),1280,"image/png")).bytes;await s.undo();const i=e.current.value?.part,{width:r,height:u}=e.size.value;i&&o.addPicture({slide:i,bytes:a,name:"粘贴的幻灯片",...Ie(e,16,16*u/r)})&&Le(e,i)}else await s.undo(),l.kind==="slides"?await Av(e,t==="source"?"source":"theme",l.at):t==="text"?Ma(e,ku()):V6(e,t==="source");tn(e,l.kind,t,l.kind==="slides"?{...l.at===void 0?{}:{at:l.at}}:{})}async function Os(e,t){const n=await Av(e,t);n&&tn(e,"slides",t,{at:n.at})}const U6={"clipboard:cut":"text:cut","clipboard:copy":"text:copy","clipboard:paste":"text:paste","clipboard:paste-source":"text:paste","clipboard:paste-text":"text:paste-plain"};function N6(e,t,n){if(!t.startsWith("clipboard:"))return!1;const l=U6[t];return e.textEditor.value&&l?(n.intent(l),!0):t==="clipboard:copy"||t==="clipboard:cut"?(e.selected.value.length>0&&Su("shapes"),!1):Aa()&&(t==="clipboard:paste"||t==="clipboard:paste-source")?(Os(e,t==="clipboard:paste"?"theme":"source"),!0):t==="clipboard:paste"?(Rl()?(Ca(e),tn(e,"shapes","theme")):Pa(e),!0):t==="clipboard:paste-source"?(Rl()?(Pv(e),tn(e,"shapes","source")):Pa(e),!0):t==="clipboard:paste-text"?(Rl()?Ma(e,ku())?tn(e,"shapes","text"):e.toaster.create({type:"info",title:"复制的对象中没有文字"}):Pa(e,"text"),!0):!1}function R6(e){const t=e.textEditor.value?.view,n=t?.state.selection;if(!t||!n||n.empty){e.toaster.create({type:"info",title:"先选中要加圈的文字"});return}const l=[];t.state.doc.nodesBetween(n.from,n.to,(a,i)=>{if(!a.isText||!a.text)return;const r=Math.max(n.from,i),u=Math.min(n.to,i+a.nodeSize);l.push({start:r,end:u,text:a.text.slice(r-i,u-i)})});const s=t.state.tr,o=new Set;for(const a of l.reverse()){const i=e2(a.text);i.missing.forEach(r=>o.add(r)),i.text!==a.text&&s.insertText(i.text,a.start,a.end)}s.docChanged&&t.dispatch(s),t.focus(),o.size>0&&e.toaster.create({type:"info",title:"部分字符没有现成的带圈字符",description:`${[...o].slice(0,12).join("、")} 保持原样。带圈字符支持 0–50 的数字、英文字母和“一”至“十”等部分汉字。`})}function j6(e,t){if(!t.startsWith("section:"))return!1;const[,n,l]=t.split(":"),s=Number(l),{commands:o,document:a}=e.session,i=St(e),r=it(a.presentation());if(n==="add"){const u=e.current.value?.index??0,c=new Set(r.map(p=>p.name));let d="无标题节";for(let p=2;c.has(d);p+=1)d=`无标题节 ${p}`;o.addSection({at:u,name:d})&&(i.renaming.value=it(a.presentation()).findIndex(p=>p.start===u&&p.name===d))}else n==="rename"?i.renaming.value=s:n==="remove"?o.removeSection({index:s}):n==="remove-slides"?o.removeSection({index:s,slides:!0}):n==="remove-all"?o.removeAllSections({}):n==="up"?o.moveSection({index:s,to:s-1}):n==="down"?o.moveSection({index:s,to:s+1}):n==="collapse-all"?i.collapsed.value=new Set(r.map((u,c)=>c)):n==="expand-all"&&(i.collapsed.value=new Set);return!0}function K6(e,t,n,l){if(N6(e,t,l)||j6(e,t))return!0;if(t==="design:new-slide"&&n===void 0)return l.intent("add-slide"),!0;if(t.startsWith("table-fill-menu:")){const s=t.slice(16);return l.intent("table-fill",s==="none"?null:s),!0}if(t==="replace-font")return St(e).replaceFontOpen.value=!0,!0;if(t==="find-replace")return St(e).findOpen.value=!0,!0;if(t==="edit-text"){const s=e.selected.value.length===1?e.selected.value[0]:void 0;return s!==void 0&&ka(e,l,s,!1),!0}if(t.startsWith("slides:"))return t==="slides:copy"?Cu(e):t==="slides:cut"?Ev(e):(t==="slides:paste"||t==="slides:paste-source")&&Os(e,t==="slides:paste"?"theme":"source"),!0;if(t==="text-shadow")return l.intent("text-tools:effect",{kind:"shadow",value:pm(e)?null:{color:"#000000",opacity:.43,blurEmu:38100,offsetEmu:38100,angleDeg:45}}),!0;if(t==="enclose-characters")return R6(e),!0;if(t==="paste-special")return St(e).pasteSpecialOpen.value=!0,!0;if(t==="shape:set-default")return l.intent("drawing:style",{default:"set"}),!0;if(t==="paragraph:distribute")return l.intent("paragraph-format",{align:"dist"}),!0;if(t.startsWith("text-columns:")){const s=e.current.value?.part,o=e.textSelection.value;return s&&o.length>0&&e.session.commands.setTextBoxOptions({slide:s,shapes:o,options:{columns:Number(t.slice(13))}}),!0}if(t==="objects:select-all"){const s=e.current.value?.part;return s&&e.session.document.select({slide:s,shapes:e.boxes.value.filter(o=>o.parent===null).map(o=>o.id)}),!0}if(t==="reset-slide"){const s=e.current.value?.part;return s&&!e.session.commands.resetSlide({slide:s})&&e.toaster.create({type:"info",title:"这张幻灯片的版式没有占位符可恢复"}),!0}return!1}const Fv=400;let Ea=0;function zv(e){return{bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike??!1,highlight:e.highlight??null,...e.size===null?{}:{size:e.size},...e.color===null?{}:{color:e.color},...e.font?{font:e.font}:{}}}function Dv(e){const t=Date.now(),n=e.painter.value,l=t-Ea<Fv;if(Ea=t,n){e.painter.value=l&&!n.sticky?{...n,sticky:!0}:void 0;return}const s=e.textEditor.value;if(s){e.painter.value={text:zv(s.format()),shape:null,sticky:!1};return}const o=e.current.value?.part,a=e.boxes.value.find(c=>c.id===e.selected.value[0]),i=e.session.document.presentation(),r=o&&a&&e.selected.value.length===1?le(i,o,a.id):null;if(!r||!a)return;const u=vi(r);e.painter.value={text:a.kind==="text"&&e.format.value?zv(e.format.value):null,shape:a.kind==="text"&&a.placeholder===null?{fill:lt(Zl(i,r)),outline:lt(oo(i,r)),width:u===null?null:u/12700}:null,sticky:!1}}function W6(e){const t=Date.now(),n=e.painter.value,l=t-Ea<Fv;if(Ea=t,n){e.painter.value=l&&!n.sticky&&n.animationsFrom!==void 0?{...n,sticky:!0}:void 0;return}const[s]=e.selected.value;e.selected.value.length!==1||s===void 0||!e.motion.animations.value.some(o=>o.shape===s)||(e.painter.value={text:null,shape:null,sticky:!1,animationsFrom:s})}function Pu(e){e.painter.value?.sticky||(e.painter.value=void 0)}function Lv(e,t){const n=e.painter.value,l=e.current.value?.part,s=e.boxes.value.find(i=>i.id===t);if(!n||!l||!s)return;if(n.animationsFrom!==void 0){t!==n.animationsFrom&&e.session.commands.copyShapeAnimations({slide:l,from:n.animationsFrom,to:[t]}),Pu(e);return}const{factories:o}=e.session.table,a=[t];e.session.document.transact("格式刷",i=>{const r=c=>c?.({presentation:i,dispatch:!0})??!1;let u=!1;return n.text&&s.kind==="text"&&(u=r(o.setTextFormat?.({slide:l,shapes:a,format:n.text}))||u),n.shape&&s.kind==="text"&&s.placeholder===null&&(u=r(o.setShapeFill?.({slide:l,shapes:a,color:n.shape.fill}))||u,u=r(o.setShapeOutline?.({slide:l,shapes:a,color:n.shape.outline,width:n.shape.width??1}))||u),u}),Pu(e)}function Vv(e,t){const n=e.painter.value;if(!n?.text)return;const l=t.selection();l.start!==l.end&&(t.apply(n.text),Pu(e))}const Iv=new WeakMap;function q6(e){const t=e.painter.value;e.painter.value=void 0,Dv(e);const n=e.painter.value;return e.painter.value=t,n?(Iv.set(e,{...n,sticky:!1}),!0):!1}function _6(e){const t=Iv.get(e);if(!t)return!1;const n=e.painter.value,l=e.textEditor.value;if(e.painter.value={...t,sticky:!0},l)Vv(e,l);else for(const s of e.selected.value)Lv(e,s);return e.painter.value=n,l!==void 0||e.selected.value.length>0}function G6(e,t){const n=t.ownerDocument,l=(u,c,d)=>(u?.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:c,clientY:d,button:2})),u&&H6(t),u!==null),s=t.closest(".pptx-slide-thumb");if(s){const u=s.getBoundingClientRect();return l(s,u.left+u.width/2,u.top+u.height/2)}if(t.closest(".ProseMirror")){const u=n.getSelection()?.rangeCount?n.getSelection().getRangeAt(0).getBoundingClientRect():t.getBoundingClientRect();return l(t,u.left,u.bottom)}const o=n.querySelector(".pptx-slide-frame");if(!o||!t.closest(".pptx-stage"))return!1;const a=o.getBoundingClientRect(),i=a.width/e.size.value.width,r=e.boxes.value.find(u=>u.id===e.selected.value.at(-1));return r?l(o,a.left+(r.x+r.width/2)*i,a.top+(r.y+r.height/2)*i):l(o,a.left+4,a.top+4)}function H6(e){const t=e.ownerDocument;let n=!1;const l=setInterval(()=>{const s=t.querySelector("[role=menu]")!==null;if(n||=s,s||!n)return;clearInterval(l);const o=t.activeElement;(o===null||o===t.body)&&e.isConnected&&e.focus({preventScroll:!0})},100);setTimeout(()=>{n||clearInterval(l)},2e3)}const Q6=[".pptx-app [role=tablist]",".pptx-app [role=toolbar]",".pptx-slide-list",".pptx-stage",".pptx-notes",".pptx-app aside:not(.pptx-slides)"],X6="[tabindex='0'], button:not([disabled]):not([tabindex='-1']), input:not([disabled]), textarea:not([disabled]), select, [aria-selected='true'][role=tab]",Tu=e=>e.offsetParent!==null||e.getClientRects().length>0;function Z6(e){if(e.matches(".pptx-stage"))return e;const t=e.querySelector("[aria-selected='true'][tabindex='0'], [role=tab][aria-selected='true'], [tabindex='0']");return t&&Tu(t)?t:[...e.querySelectorAll(X6)].find(Tu)??null}function Y6(e,t){const n=Q6.flatMap(o=>[...e.querySelectorAll(o)].filter(Tu).slice(0,1));if(n.length===0)return!1;const l=e.activeElement,s=n.findIndex(o=>o===l||o.contains(l));for(let o=1;o<=n.length;o+=1){const a=n[((s<0?t===1?-1:0:s)+t*o+n.length*2)%n.length],i=Z6(a);if(i)return i.focus(),!0}return!1}function J6(e,t,n){const l=e.find(a=>a.id===t.at(-1)),s=e.filter(a=>a.parent===(l?.parent??null));if(s.length===0)return;const o=l?s.indexOf(l):-1;return s[o<0?n===1?0:s.length-1:(o+n+s.length)%s.length]?.id}function Bv(e,t){const n=e.filter(l=>l.parent===null&&l.placeholder!==null&&l.kind==="text"&&!["dt","ftr","sldNum"].includes(l.placeholder));return n[n.findIndex(l=>l.id===t)+1]?.id}function e5(e,t,n){const l={ArrowRight:[n,0],ArrowLeft:[-n,0],ArrowUp:[0,n],ArrowDown:[0,-n]}[t];if(!l)return;let[s,o]=l;return e.aspectLocked&&e.width>0&&e.height>0&&(s!==0?o=s*e.height/e.width:s=o*e.width/e.height),{width:Math.max(n,Math.round(e.width+s)),height:Math.max(n,Math.round(e.height+o))}}const Au=9525,t5=36e3,n5=15;async function Fa(e,t,n){e.textEditor.value&&t.ownerDocument.querySelector(".pptx-stage")?.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0}));const l=e.current.value?.part;l&&e.session.document.select({slide:l,shapes:[n]}),await ka(e,t,n,!0)}async function Ov(e,t){const n=e.textEditor.value?.shape??(e.selected.value.length===1?e.selected.value[0]:void 0),l=Bv(e.boxes.value,n);if(l!==void 0){await Fa(e,t,l);return}const s=e.current.value?.part;e.textEditor.value&&t.ownerDocument.querySelector(".pptx-stage")?.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0})),t.intent("add-slide");for(let a=0;a<20&&e.current.value?.part===s;a+=1)await new Promise(i=>setTimeout(i,25));const o=Bv(e.boxes.value,void 0);o!==void 0&&e.current.value?.part!==s&&await Fa(e,t,o)}async function l5(e,t,n){const l=e.current.value?.part;if(e.armedShape.value=void 0,!l||El.has(n))return;const s=Fl.get(n);if(s===void 0){tm(e,{slide:l,preset:n,...Ie(e,4,4)})&&Le(e,l);return}if(!e.session.commands.addTextBox({slide:l,text:"",vertical:s,...s?Ie(e,1.5,6):Ie(e,8,1.5)}))return;Le(e,l);const o=e.selected.value[0];o!==void 0&&await Fa(e,t,o)}function s5(e,t){let n=!1;return l=>{const s=l.target;if(l.defaultPrevented||!s?.closest?.(".pptx-app"))return;const o=l.metaKey||l.ctrlKey,a=l.key.length===1?l.key.toLowerCase():l.key,i=s.closest(".ProseMirror")!==null;if((a==="ContextMenu"||a==="F10"&&l.shiftKey&&!o)&&s.closest(".pptx-stage, .pptx-slide-list")){G6(e,s)&&l.preventDefault();return}if(a==="F6"&&!o&&!l.altKey){l.preventDefault(),Y6(t.ownerDocument,l.shiftKey?-1:1);return}if(!i&&s.closest("input, textarea, select, [contenteditable='true']"))return;const r=s.closest(".pptx-stage")!==null,u=f=>{l.preventDefault(),f()};if((l.code==="KeyV"||a==="v")&&o&&l.altKey&&!l.shiftKey&&!i&&(r||s.closest(".pptx-slide-list"))){u(()=>{St(e).pasteSpecialOpen.value=!0});return}if(a!=="Tab"&&(n=a==="Escape"&&r&&!i&&e.selected.value.length===0&&!e.textEditor.value),(r||i)&&o&&l.shiftKey&&!l.altKey&&(a==="c"||a==="v")){u(()=>{(a==="c"?q6(e):_6(e))||e.toaster.create({type:"info",title:a==="c"?"先选中一个对象或一段文字":"还没有复制格式",description:a==="c"?void 0:"用 Ctrl+Shift+C 复制格式。"})});return}if(r&&!i&&o&&!l.shiftKey&&!l.altKey&&a==="Enter"){u(()=>{Ov(e,t)});return}if(s.closest(".pptx-slide-list")&&!l.altKey){a==="Enter"&&!o&&!l.shiftKey?u(()=>t.intent("add-slide")):a==="d"&&o&&!l.shiftKey?u(()=>t.intent("duplicate-slide")):a==="c"&&o&&!l.shiftKey?u(()=>{Cu(e)}):a==="x"&&o&&!l.shiftKey?u(()=>{Ev(e)}):a==="v"&&o&&!l.shiftKey&&u(()=>{Os(e,"theme")});return}if(!r||i||e.textEditor.value)return;const c=e.current.value?.part,d=e.selected.value,p=e.boxes.value;if(c)if(o&&!l.shiftKey&&!l.altKey&&a==="a")u(()=>e.session.document.select({slide:c,shapes:p.filter(f=>f.parent===null).map(f=>f.id)}));else if(a==="Enter"&&!o&&!l.altKey&&!l.shiftKey&&e.armedShape.value!==void 0){const f=e.armedShape.value;u(()=>{l5(e,t,f)})}else if(a==="Tab"&&!o&&!l.altKey&&!n){const f=J6(p,d,l.shiftKey?-1:1);f!==void 0&&u(()=>e.session.document.select({slide:c,shapes:[f]}))}else if((a==="F2"||a==="Enter")&&!o&&!l.shiftKey&&!l.altKey&&d.length===1){const f=p.find(h=>h.id===d[0]);f?.kind==="text"&&u(()=>{Fa(e,t,f.id)})}else o&&!l.altKey&&!l.shiftKey&&a==="k"&&d.length>0?u(()=>t.intent("action-settings:url")):d.length>0&&a.startsWith("Arrow")&&l.shiftKey&&!l.altKey?u(()=>{const f=e.session.chain();for(const h of p.filter(v=>d.includes(v.id))){const v=e5(h,a,o?Au:t5);v&&f.setShapeBounds({slide:c,shape:h.id,...v})}f.run()}):d.length>0&&a.startsWith("Arrow")&&!l.shiftKey&&o!==l.altKey&&u(()=>{if(l.altKey){(a==="ArrowLeft"||a==="ArrowRight")&&e.session.commands.rotateShapes({slide:c,shapes:d,by:a==="ArrowLeft"?-15:n5});return}const[f,h]={ArrowLeft:[-9525,0],ArrowRight:[Au,0],ArrowUp:[0,-9525],ArrowDown:[0,Au]}[a]??[0,0],v=e.session.chain();for(const g of p.filter($=>d.includes($.id)))v.setShapeBounds({slide:c,shape:g.id,x:g.x+f,y:g.y+h});v.run()})}}function o5(e,t){return n=>{const l=n.target;if(!(n.metaKey||n.ctrlKey)||n.shiftKey||n.altKey)return;const s=n.key.toLowerCase(),o=!!l?.closest?.(".pptx-stage")&&!l?.closest(".ProseMirror")&&!e.textEditor.value;if(s==="v"&&o&&Aa()){n.preventDefault(),n.stopPropagation(),Os(e,"theme");return}(s==="c"||s==="x")&&o&&e.selected.value.length>0&&Su("shapes"),s==="v"&&o&&Rl()&&setTimeout(()=>tn(e,"shapes","theme"),0),!(n.key!=="Enter"||!l?.closest?.(".pptx-stage .ProseMirror"))&&(n.preventDefault(),n.stopPropagation(),Ov(e,t))}}const a5={hidden:""},i5=O({__name:"keyboard",props:{state:{},host:{}},setup(e){const t=e,n=s5(t.state,t.host),l=o5(t.state,t.host);return ft(()=>{t.host.ownerDocument.addEventListener("keydown",l,!0),t.host.ownerDocument.addEventListener("keydown",n)}),Re(()=>{t.host.ownerDocument.removeEventListener("keydown",l,!0),t.host.ownerDocument.removeEventListener("keydown",n)}),(s,o)=>(x(),M("span",a5))}}),r5=O({__name:"paste-chip",props:{state:{},scale:{}},setup(e){const t=e,n=St(t.state),l=F(()=>{t.state.tick.value;const i=n.lastPaste.value;if(!(!i||i.version!==t.state.session.document.version()||i.slide!==t.state.current.value?.part))return i}),s=F(()=>{const i=l.value,r=i?t.state.boxes.value.filter(f=>i.ids.includes(f.id)):[],{width:u,height:c}=t.state.size.value,d=r.length?Math.max(...r.map(f=>f.x+f.width)):u,p=r.length?Math.max(...r.map(f=>f.y+f.height)):c;return{left:`${Math.min(d,u)*t.scale+4}px`,top:`${Math.min(p,c)*t.scale+4}px`}}),o=F(()=>{const i=l.value,r=i?.kind==="slides"?[["theme","使用目标主题"],["source","保留源格式"],["picture","图片"]]:[["theme","使用目标主题"],["source","保留源格式"],["text","只保留文本"],["picture","图片"]];return[{value:"paste-modes",label:"粘贴选项",kind:"radio-group",selectedValue:i?.mode,children:r.map(([u,c])=>({value:u,label:c}))}]});function a(i){Mu(t.state,i,document)}return(i,r)=>l.value?(x(),M("div",{key:0,class:"pptx-paste-chip",style:fe(s.value),onPointerdown:r[0]||(r[0]=J(()=>{},["stop"])),onDblclick:r[1]||(r[1]=J(()=>{},["stop"]))},[y(m(Xs),{items:o.value,"aria-label":"粘贴选项",width:"auto",onSelect:a},{trigger:A(()=>[y(m(ye),{label:"粘贴选项",variant:"outline",size:"sm"},{default:A(()=>[y(m(me),{name:"clipboardPaste"})]),_:1})]),_:1},8,["items"])],36)):L("v-if",!0)}});function u5(){return Aa()?[{mode:"theme",label:"幻灯片(使用目标主题)",result:"在当前幻灯片后插入复制的幻灯片,套用本文稿的版式和主题。"},{mode:"source",label:"幻灯片(保留源格式)",result:"在当前幻灯片后插入复制的幻灯片,连同它原来的版式、母版和主题。"},{mode:"picture",label:"图片(PNG)",result:"把复制的幻灯片作为一张图片放到当前幻灯片上。"}]:Rl()?[{mode:"theme",label:"演示文稿对象(使用目标主题)",result:"粘贴可编辑的对象,颜色和字体随本文稿的主题。"},{mode:"source",label:"演示文稿对象(保留源格式)",result:"粘贴可编辑的对象,保留它们在原文稿中的颜色。"},{mode:"text",label:"无格式文本",result:"只粘贴对象中的文字,放在新的文本框里。"},{mode:"picture",label:"图片(PNG)",result:"把复制的对象作为一张图片粘贴,不能再编辑其中的文字。"}]:[{mode:"theme",label:"剪贴板内容",result:"粘贴系统剪贴板中的图片或文本。"},{mode:"text",label:"无格式文本",result:"只粘贴系统剪贴板中的文本,放在新的文本框里。"}]}async function c5(e,t,n){if(Aa())await Os(e,t==="source"?"source":"theme");else if(Rl()){if(t==="source")Pv(e);else if(t==="text"){if(!Ma(e,ku())){e.toaster.create({type:"info",title:"复制的对象中没有文字"});return}}else Ca(e);tn(e,"shapes",t==="picture"?"theme":t)}else{await Pa(e,t==="text"?"text":void 0);return}t==="picture"&&await Mu(e,"picture",n)}const d5={class:"pptx-paste-special"},p5={class:"pptx-paste-special-result"},f5=O({__name:"paste-special-dialog",props:{state:{}},setup(e){const t=e,n=St(t.state),l=F(()=>n.pasteSpecialOpen.value?u5():[]),s=V("theme");X(n.pasteSpecialOpen,i=>{i&&(s.value=l.value[0]?.mode??"theme")});const o=F(()=>l.value.find(i=>i.mode===s.value)?.result??"");function a(){n.pasteSpecialOpen.value=!1,c5(t.state,s.value,document)}return(i,r)=>(x(),B(m(Ae),{open:m(n).pasteSpecialOpen.value,"onUpdate:open":r[3]||(r[3]=u=>m(n).pasteSpecialOpen.value=u)},{default:A(()=>[y(m(Te),{title:"选择性粘贴",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:r[1]||(r[1]=u=>m(n).pasteSpecialOpen.value=!1)},{default:A(()=>[...r[4]||(r[4]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",onClick:r[2]||(r[2]=u=>a())},{default:A(()=>[...r[5]||(r[5]=[R("确定",-1)])]),_:1})]),default:A(()=>[k("div",d5,[y(m(Ke),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=u=>s.value=u),label:"粘贴为",items:l.value.map(u=>({value:u.mode,label:u.label}))},null,8,["modelValue","items"]),k("p",p5,N(o.value),1)])]),_:1})]),_:1},8,["open"]))}}),m5={class:"pptx-selection-pane"},h5={class:"pptx-panel-header"},v5={class:"pptx-selection-tools"},g5={key:0,class:"pptx-selection-list",role:"listbox","aria-label":"本页对象","aria-multiselectable":"true"},b5=["aria-selected","data-hidden","data-drop","data-dragging","draggable","onClick","onDragstart","onDragover","onDrop"],y5=["aria-label","onClick"],x5={key:1,class:"pptx-selection-fold","aria-hidden":"true"},w5=["title","onDblclick"],k5={key:1,class:"pptx-selection-empty"},$5={id:"home-extras",intent:(e,t,n,l)=>K6(e,t,n,l),overlays:[z6,L6,i5,f5],stageLayers:[r5],panels:[{id:"selection",label:"选择窗格",icon:"listTree",component:O({__name:"selection-pane",props:{state:{}},emits:["close"],setup(e,{emit:t}){const n=e,l=t,s=V(new Set),o=V(),a=V(""),i=V(),r=V(),u=F(()=>{const D=n.state.current.value?.part,P=n.state.session.document.presentation(),I=n.state.boxes.value,K=[],G=(ee,W)=>{for(const te of[...ee].reverse()){const he=D?le(P,D,te.id):null;K.push({box:te,depth:W,hidden:he!==null&&Xc(he)}),te.kind==="group"&&!s.value.has(te.id)&&G(te.children,W+1)}};return G(I.filter(ee=>ee.parent===null),0),K}),c=F(()=>n.state.selected.value),d=F(()=>n.state.current.value?.part);function p(D){return D.name||{text:"文本框",picture:"图片",table:"表格",chart:"图表",group:"组合",connector:"连接线",media:"媒体",other:"对象"}[D.kind]}function f(D,P){const I=D.box.id,K=c.value,G=P.shiftKey||P.metaKey||P.ctrlKey?K.includes(I)?K.filter(ee=>ee!==I):[...K,I]:[I];n.state.session.document.select({slide:d.value??null,shapes:G})}function h(D){d.value&&n.state.session.commands.setShapesHidden({slide:d.value,shapes:[D.box.id],hidden:!D.hidden})}function v(D){const P=n.state.boxes.value.filter(I=>I.parent===null).map(I=>I.id);d.value&&P.length>0&&n.state.session.commands.setShapesHidden({slide:d.value,shapes:P,hidden:D})}function g(D){d.value&&c.value.length>0&&n.state.session.commands.arrangeShapes({slide:d.value,shapes:c.value,order:D})}function $(D){const P=u.value.findIndex(K=>K.box.id===i.value),I=u.value.indexOf(D);if(!(P<0||I<0||P===I||u.value[P].box.parent!==D.box.parent))return P>I?"before":"after"}function b(D,P){i.value=D.box.id,P.dataTransfer?.setData("text/plain",p(D.box)),P.dataTransfer&&(P.dataTransfer.effectAllowed="move")}function w(D,P){if(i.value===void 0||!$(D)){r.value=void 0;return}P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),r.value=D.box.id}function S(D){const P=i.value;C(),P!==void 0&&d.value&&n.state.session.commands.moveShapeTo({slide:d.value,shape:P,before:D.box.id})}function C(){i.value=void 0,r.value=void 0}function E(D){const P=new Set(s.value);P.delete(D.id)||P.add(D.id),s.value=P}function T(D){o.value=D.box.id,a.value=p(D.box),pt(()=>document.querySelector(".pptx-selection-rename input")?.select())}function z(D){const P=o.value;o.value=void 0,D&&P!==void 0&&d.value&&a.value.trim()&&n.state.session.commands.renameShape({slide:d.value,shape:P,name:a.value})}return(D,P)=>(x(),M("div",m5,[k("div",h5,[P[11]||(P[11]=k("span",{class:"qk-type-label"},"选择窗格",-1)),k("span",v5,[y(Se,{icon:"eye",label:"全部显示",disabled:u.value.length===0,onClick:P[0]||(P[0]=I=>v(!1))},null,8,["disabled"]),y(Se,{icon:"eyeOff",label:"全部隐藏",disabled:u.value.length===0,onClick:P[1]||(P[1]=I=>v(!0))},null,8,["disabled"]),y(Se,{icon:"arrowUp",label:"上移一层",disabled:c.value.length===0,onClick:P[2]||(P[2]=I=>g("forward"))},null,8,["disabled"]),y(Se,{icon:"arrowDown",label:"下移一层",disabled:c.value.length===0,onClick:P[3]||(P[3]=I=>g("backward"))},null,8,["disabled"]),y(Se,{icon:"close",label:"关闭选择窗格",onClick:P[4]||(P[4]=I=>l("close"))})])]),u.value.length>0?(x(),M("ul",g5,[(x(!0),M(U,null,H(u.value,I=>(x(),M("li",{key:I.box.id,class:"pptx-selection-row",role:"option","aria-selected":c.value.includes(I.box.id),"data-hidden":I.hidden||void 0,"data-drop":r.value===I.box.id?$(I):void 0,"data-dragging":i.value===I.box.id||void 0,style:fe({paddingLeft:`${8+I.depth*16}px`}),draggable:o.value!==I.box.id,onClick:K=>f(I,K),onDragstart:K=>b(I,K),onDragover:K=>w(I,K),onDrop:J(K=>S(I),["prevent"]),onDragend:P[10]||(P[10]=K=>C())},[I.box.kind==="group"?(x(),M("button",{key:0,type:"button",class:"pptx-selection-fold","aria-label":s.value.has(I.box.id)?"展开组合":"折叠组合",onClick:J(K=>E(I.box),["stop"])},[y(m(me),{name:s.value.has(I.box.id)?"chevronRight":"chevronDown"},null,8,["name"])],8,y5)):(x(),M("span",x5)),o.value===I.box.id?(x(),B(m(Oe),{key:2,modelValue:a.value,"onUpdate:modelValue":P[5]||(P[5]=K=>a.value=K),class:"pptx-selection-rename",size:"sm","aria-label":"对象名称",onClick:P[6]||(P[6]=J(()=>{},["stop"])),onKeydown:[P[7]||(P[7]=ue(J(K=>z(!0),["prevent"]),["enter"])),P[8]||(P[8]=ue(J(K=>z(!1),["stop","prevent"]),["esc"]))],onBlur:P[9]||(P[9]=K=>z(!0))},null,8,["modelValue"])):(x(),M("span",{key:3,class:"pptx-selection-name",title:p(I.box),onDblclick:J(K=>T(I),["stop"])},N(p(I.box)),41,w5)),y(Se,{icon:I.hidden?"eyeOff":"eye",label:I.hidden?"显示对象":"隐藏对象",pressed:I.hidden,onClick:J(K=>h(I),["stop"])},null,8,["icon","label","pressed","onClick"])],44,b5))),128))])):(x(),M("p",k5,"本页没有对象"))]))}})}]},S5={class:"pptx-action"},C5=O({__name:"action-dialog",props:{state:{}},setup(e){const t=e,n=Sn(t.state),l=V("none"),s=V(""),o=V(""),a=[{value:"none",label:"无动作"},{value:"prevSlide",label:"上一张幻灯片"},{value:"nextSlide",label:"下一张幻灯片"},{value:"firstSlide",label:"第一张幻灯片"},{value:"lastSlide",label:"最后一张幻灯片"},{value:"lastSlideViewed",label:"最近观看的幻灯片"},{value:"slide",label:"幻灯片…"},{value:"url",label:"网址…"},{value:"endShow",label:"结束放映"}],i=F(()=>t.state.slides.value.map(c=>({value:c.part,label:`${c.index+1}. ${c.title||"无标题"}`})));X(n.actionOpen,c=>{const d=t.state.current.value?.part,p=t.state.selected.value[0],f=c&&d&&p!==void 0?le(t.state.session.document.presentation(),d,p):null;if(!c)return;const h=f?x2(f):null;l.value=h?.kind??n.actionPreset.value??"none",s.value=h?.kind==="slide"?h.slide:i.value[0]?.value??"",o.value=h?.kind==="url"?h.url:""});const r=F(()=>l.value==="none"?null:l.value==="slide"?s.value?{kind:"slide",slide:s.value}:void 0:l.value==="url"?/^(https?:|mailto:)/iu.test(o.value.trim())?{kind:"url",url:o.value.trim()}:void 0:{kind:l.value});function u(){const c=t.state.current.value?.part,d=r.value;if(!(!c||d===void 0)){if(!t.state.session.commands.setShapeAction({slide:c,shapes:t.state.selected.value,action:d})){t.state.toaster.create({type:"error",title:"无法设置动作",description:"组合不能直接设置动作,请选中组合里的对象。"});return}n.actionOpen.value=!1}}return(c,d)=>(x(),B(m(Ae),{open:m(n).actionOpen.value,"onUpdate:open":d[5]||(d[5]=p=>m(n).actionOpen.value=p)},{default:A(()=>[y(m(Te),{title:"动作设置",description:"放映时单击所选对象:",size:"medium","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:d[3]||(d[3]=p=>m(n).actionOpen.value=!1)},{default:A(()=>[...d[6]||(d[6]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:r.value===void 0,onClick:d[4]||(d[4]=p=>u())},{default:A(()=>[...d[7]||(d[7]=[R("确定",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("div",S5,[y(m(Ke),{"model-value":l.value,label:"单击时","hide-label":"",items:a,"onUpdate:modelValue":d[0]||(d[0]=p=>l.value=p??"none")},null,8,["model-value"]),l.value==="slide"?(x(),B(m(ce),{key:0,modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=p=>s.value=p),label:"目标幻灯片",items:i.value,width:"100%"},null,8,["modelValue","items"])):L("v-if",!0),l.value==="url"?(x(),B(m(Oe),{key:1,modelValue:o.value,"onUpdate:modelValue":d[2]||(d[2]=p=>o.value=p),type:"url","aria-label":"网址",placeholder:"https://example.com"},null,8,["modelValue"])):L("v-if",!0)])]),_:1})]),_:1},8,["open"]))}}),M5=["212222","222122","222221","121223","121322","131222","122213","122312","132212","221213","221312","231212","112232","122132","122231","113222","123122","123221","223211","221132","221231","213212","223112","312131","311222","321122","321221","312212","322112","322211","212123","212321","232121","111323","131123","131321","112313","132113","132311","211313","231113","231311","112133","112331","132131","113123","113321","133121","313121","211331","231131","213113","213311","213131","311123","311321","331121","312113","312311","332111","314111","221411","431111","111224","111422","121124","121421","141122","141221","112214","112412","122114","122411","142112","142211","241211","221114","413111","241112","134111","111242","121142","121241","114212","124112","124211","411212","421112","421211","212141","214121","412121","111143","111341","131141","114113","114311","411113","411311","113141","114131","311141","411131","211412","211214","211232","2331112"],Uv={B:104,C:105},P5=106;function T5(e){if(e.length===0)return null;let t,n;if(/^(\d\d){2,}$/.test(e))n="C",t=e.match(/\d\d/g).map(Number);else if(/^[\x20-\x7e]+$/.test(e))n="B",t=[...e].map(s=>s.charCodeAt(0)-32);else return null;const l=t.reduce((s,o,a)=>s+o*(a+1),Uv[n])%103;return[Uv[n],...t,l,P5]}function Nv(e){const t=T5(e);return t?t.flatMap(n=>[...M5[n]].map(Number)):null}const tl=4,Rv=10,A5=60;async function E5(e){const t=Nv(e);if(!t)return null;const n=t.reduce((i,r)=>i+r,0)+Rv*2,l=new OffscreenCanvas(n*tl,320),s=l.getContext("2d");if(!s)return null;s.fillStyle="#ffffff",s.fillRect(0,0,l.width,l.height),s.fillStyle="#000000";let o=Rv;t.forEach((i,r)=>{r%2===0&&s.fillRect(o*tl,2*tl,i*tl,A5*tl),o+=i}),s.font=`${12*tl}px "Helvetica Neue", Arial, sans-serif`,s.textAlign="center",s.textBaseline="top",s.fillText(e,l.width/2,64*tl);const a=await l.convertToBlob({type:"image/png"});return{bytes:new Uint8Array(await a.arrayBuffer()),ratio:l.width/l.height}}const F5={class:"pptx-barcode"},z5={class:"pptx-barcode-preview"},D5=["viewBox"],L5=["x","width"],V5={key:1,class:"pptx-barcode-hint"},I5=O({__name:"barcode-dialog",props:{state:{}},setup(e){const t=e,n=Sn(t.state),l=V("");X(n.barcodeOpen,r=>{r&&(l.value="")});const s=F(()=>Nv(l.value.trim())),o=F(()=>{let r=10;return(s.value??[]).flatMap((u,c)=>{const d=c%2===0?[{x:r,width:u}]:[];return r+=u,d})}),a=F(()=>(s.value??[]).reduce((r,u)=>r+u,20));async function i(){const r=t.state.current.value?.part,u=await E5(l.value.trim());!r||!u||(t.state.session.commands.addPicture({slide:r,bytes:u.bytes,name:"条形码",...Ie(t.state,8,8/u.ratio)})&&Le(t.state,r),n.barcodeOpen.value=!1)}return(r,u)=>(x(),B(m(Ae),{open:m(n).barcodeOpen.value,"onUpdate:open":u[4]||(u[4]=c=>m(n).barcodeOpen.value=c)},{default:A(()=>[y(m(Te),{title:"插入条形码",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:u[2]||(u[2]=c=>m(n).barcodeOpen.value=!1)},{default:A(()=>[...u[5]||(u[5]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!s.value,onClick:u[3]||(u[3]=c=>i())},{default:A(()=>[...u[6]||(u[6]=[R("插入",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("div",F5,[y(m(Oe),{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=c=>l.value=c),"aria-label":"条形码内容",placeholder:"输入字母、数字或符号",onKeydown:u[1]||(u[1]=ue(J(c=>s.value&&i(),["prevent"]),["enter"]))},null,8,["modelValue"]),k("div",z5,[s.value?(x(),M("svg",{key:0,viewBox:`0 0 ${a.value} 40`,preserveAspectRatio:"none",role:"img","aria-label":"条形码预览"},[(x(!0),M(U,null,H(o.value,c=>(x(),M("rect",{key:c.x,x:c.x,width:c.width,y:"0",height:"40"},null,8,L5))),128))],8,D5)):(x(),M("p",V5,N(l.value.trim()?"条形码 Code 128 只能包含英文字母、数字和符号":"输入内容后显示条形码"),1))])])]),_:1})]),_:1},8,["open"]))}}),B5={key:0,class:"pptx-diagram-items","aria-label":"智能图形项目"},O5={class:"pptx-diagram-items-title"},U5=O({__name:"diagram-items",props:{state:{},shape:{}},setup(e){const t=e,n=F(()=>{t.state.tick.value;const a=t.state.current.value?.part,i=a?le(t.state.session.document.presentation(),a,t.shape):null;return i?Pf(i):null}),l=V([]);X(()=>n.value?.items,a=>{l.value=[...a??[]]},{immediate:!0});function s(a){const i=t.state.current.value?.part;i&&t.state.session.commands.setDiagramItems({slide:i,shape:t.shape,items:a})&&Le(t.state,i)}function o(a){l.value[a]!==n.value?.items[a]&&s(l.value)}return(a,i)=>n.value?(x(),M("section",B5,[k("h3",O5,N(n.value.layout.label),1),(x(!0),M(U,null,H(l.value,(r,u)=>(x(),M("div",{key:u,class:"pptx-diagram-item"},[y(m(Oe),{"model-value":l.value[u]??"",size:"sm","onUpdate:modelValue":c=>l.value[u]=c,"aria-label":`第 ${u+1} 项`,onBlur:c=>o(u),onKeydown:ue(J(c=>o(u),["prevent"]),["enter"])},null,8,["model-value","onUpdate:modelValue","aria-label","onBlur","onKeydown"]),y(Se,{icon:"minus",label:`删除第 ${u+1} 项`,disabled:l.value.length<=1,onClick:c=>s(l.value.filter((d,p)=>p!==u))},null,8,["label","disabled","onClick"])]))),128)),y(m(q),{size:"sm",variant:"soft",block:"",onClick:i[0]||(i[0]=r=>s([...l.value,`项目 ${l.value.length+1}`]))},{default:A(()=>[...i[1]||(i[1]=[R("添加项目",-1)])]),_:1}),i[2]||(i[2]=k("p",{class:"pptx-diagram-items-note"},"增删项目会按版式重新排列,项目的单独格式不保留。",-1))])):L("v-if",!0)}}),N5={hidden:""},R5=O({__name:"date-fields",props:{state:{}},setup(e){const t=e;let n=!1;async function l(){const{document:o}=t.state.session;if(!(n||o.isDirty()||Tf(o.presentation(),new Date,!1)===0)){n=!0;try{const a=await dn(await o.save());Tf(a,new Date)>0&&await o.replace(await vl(a))}finally{n=!1}}}let s;return ft(()=>{l(),s=t.state.session.document.subscribe(o=>{o.origin==="file"&&o.content&&l()})}),Re(()=>s?.()),(o,a)=>(x(),M("span",N5))}}),j5={class:"pptx-header-footer"},K5={key:0,class:"pptx-header-footer-indent"},W5={key:1,class:"pptx-header-footer-indent"},q5={key:2,class:"pptx-header-footer-indent"},_5=O({__name:"header-footer-dialog",props:{state:{}},setup(e){const t=e,n=Sn(t.state),l=V(!1),s=V("auto"),o=V("datetime1"),a=V(""),i=V(!1),r=V(!1),u=V(""),c=V(!1),d=V("1"),p=new Date,f=["datetime1","datetime2","datetime4","datetime10"].map(g=>({value:g,label:Ho(p,g)}));X(n.headerFooterOpen,g=>{const $=t.state.current.value?.part,b=g&&$?t.state.slide($):null;if(!b)return;const w=L2(b);l.value=w.date!==null,s.value=w.date?.kind??"auto",w.date?.kind==="auto"&&(o.value=w.date.format),a.value=w.date?.kind==="fixed"?w.date.text:Ho(new Date,"datetime2"),i.value=w.slideNumber,d.value=String(Ql(t.state.session.document.presentation())),r.value=w.footer!==null,u.value=w.footer??""});const h=F(()=>({footer:r.value?u.value:null,slideNumber:i.value,date:l.value?s.value==="auto"?{kind:"auto",format:o.value}:{kind:"fixed",text:a.value}:null,skipTitle:c.value}));function v(g){const $=g?t.state.slides.value.map(E=>E.part):[t.state.current.value?.part].filter(E=>!!E),{session:b}=t.state,w=Number(d.value),S=Number.isInteger(w)&&w>=0&&w<=9999&&w!==Ql(b.document.presentation()),C=b.chain().setHeaderFooter({slides:$,settings:h.value});$.length>0&&!(S?C.setFirstSlideNumber({value:w}):C).run()&&t.state.toaster.create({type:"error",title:"无法设置页眉页脚",description:"这些幻灯片的版式没有页脚位置。"}),n.headerFooterOpen.value=!1}return(g,$)=>(x(),B(m(Ae),{open:m(n).headerFooterOpen.value,"onUpdate:open":$[12]||($[12]=b=>m(n).headerFooterOpen.value=b)},{default:A(()=>[y(m(Te),{title:"页眉和页脚",size:"medium","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:$[9]||($[9]=b=>m(n).headerFooterOpen.value=!1)},{default:A(()=>[...$[13]||($[13]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",onClick:$[10]||($[10]=b=>v(!1))},{default:A(()=>[...$[14]||($[14]=[R("应用",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",onClick:$[11]||($[11]=b=>v(!0))},{default:A(()=>[...$[15]||($[15]=[R("全部应用",-1)])]),_:1})]),default:A(()=>[k("div",j5,[y(m(Ce),{checked:l.value,"onUpdate:checked":$[0]||($[0]=b=>l.value=b),label:"日期和时间"},null,8,["checked"]),l.value?(x(),M("div",K5,[y(m(Ke),{modelValue:s.value,"onUpdate:modelValue":$[1]||($[1]=b=>s.value=b),label:"日期类型",items:[{value:"auto",label:"自动更新"},{value:"fixed",label:"固定"}],orientation:"horizontal"},null,8,["modelValue"]),s.value==="auto"?(x(),B(m(ce),{key:0,modelValue:o.value,"onUpdate:modelValue":$[2]||($[2]=b=>o.value=b),label:"日期格式",items:m(f),width:"100%"},null,8,["modelValue","items"])):(x(),B(m(Oe),{key:1,modelValue:a.value,"onUpdate:modelValue":$[3]||($[3]=b=>a.value=b),"aria-label":"固定日期"},null,8,["modelValue"]))])):L("v-if",!0),y(m(Ce),{checked:i.value,"onUpdate:checked":$[4]||($[4]=b=>i.value=b),label:"幻灯片编号"},null,8,["checked"]),i.value?(x(),M("div",W5,[y(m(re),{label:"起始编号"},{default:A(({controlProps:b})=>[y(m(de),ie(b,{modelValue:d.value,"onUpdate:modelValue":$[5]||($[5]=w=>d.value=w),label:"起始编号",min:0,max:m(N2),step:1}),null,16,["modelValue","max"])]),_:1})])):L("v-if",!0),y(m(Ce),{checked:r.value,"onUpdate:checked":$[6]||($[6]=b=>r.value=b),label:"页脚"},null,8,["checked"]),r.value?(x(),M("div",q5,[y(m(Oe),{modelValue:u.value,"onUpdate:modelValue":$[7]||($[7]=b=>u.value=b),"aria-label":"页脚文字",placeholder:"页脚文字"},null,8,["modelValue"])])):L("v-if",!0),y(m(Ce),{checked:c.value,"onUpdate:checked":$[8]||($[8]=b=>c.value=b),label:"标题幻灯片中不显示"},null,8,["checked"])])]),_:1})]),_:1},8,["open"]))}}),G5={class:"pptx-text-link"},H5=O({__name:"text-link-dialog",props:{state:{}},setup(e){const t=e,n=Sn(t.state),l=V(""),s=V();X(n.textLinkOpen,i=>{const r=t.state.textEditor.value?.view;s.value=i&&r?jr(r.state)?.href:void 0,l.value=s.value??""});const o=F(()=>/^(https?:|mailto:)/iu.test(l.value.trim()));function a(i){const r=t.state.textEditor.value?.view;n.textLinkOpen.value=!1,r&&Kr(r,i)}return(i,r)=>(x(),B(m(Ae),{open:m(n).textLinkOpen.value,"onUpdate:open":r[5]||(r[5]=u=>m(n).textLinkOpen.value=u)},{default:A(()=>[y(m(Te),{title:"超链接",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[s.value?(x(),B(m(q),{key:0,type:"button",onClick:r[2]||(r[2]=u=>a(null))},{default:A(()=>[...r[7]||(r[7]=[R("取消链接",-1)])]),_:1})):L("v-if",!0),y(m(q),{type:"button",onClick:r[3]||(r[3]=u=>m(n).textLinkOpen.value=!1)},{default:A(()=>[...r[8]||(r[8]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!o.value,onClick:r[4]||(r[4]=u=>a(l.value.trim()))},{default:A(()=>[...r[9]||(r[9]=[R("确定",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("div",G5,[y(m(Oe),{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=u=>l.value=u),type:"url","aria-label":"链接地址",placeholder:"https://example.com",onKeydown:r[1]||(r[1]=ue(J(u=>o.value&&a(l.value.trim()),["prevent"]),["enter"]))},null,8,["modelValue"]),r[6]||(r[6]=k("p",{class:"pptx-text-link-hint"},"选中文字时为所选文字添加链接;光标在链接内时修改整段链接;未选文字时插入地址本身。",-1))])]),_:1})]),_:1},8,["open"]))}}),jv=[{label:"人物与沟通",icons:[["user","人物"],["users","团队"],["contact","联系人"],["mail","邮件"],["messageSquare","消息"],["send","发送"],["bell","通知"],["share2","分享"]]},{label:"商务与数据",icons:[["chartColumn","柱形图"],["chartLine","折线图"],["chartPie","饼图"],["database","数据库"],["layoutDashboard","仪表板"],["calendar","日历"],["clock","时钟"],["flag","旗帜"]]},{label:"状态与安全",icons:[["circleCheck","完成"],["circleX","错误"],["circleAlert","提醒"],["circleHelp","疑问"],["lock","锁定"],["shield","防护"],["keyRound","钥匙"],["eye","查看"]]},{label:"科技与设备",icons:[["monitor","显示器"],["smartphone","手机"],["cloud","云"],["wifi","无线网络"],["globe","地球"],["code","代码"],["settings","设置"],["wrench","工具"]]},{label:"生活与物品",icons:[["house","房屋"],["car","汽车"],["utensils","餐饮"],["lightbulb","灯泡"],["heart","爱心"],["bookOpen","书本"],["camera","相机"],["sun","太阳"]]},{label:"方向与箭头",icons:[["arrowRight","向右"],["arrowUp","向上"],["arrowUpRight","增长"],["refreshCw","循环"],["download","下载"],["upload","上传"],["link","链接"],["search","搜索"]]}],Q5=["aria-label"],X5={class:"pptx-icon-gallery-group"},Z5={class:"pptx-icon-gallery-row"},Y5=["aria-label","title","onClick"],J5=O({__name:"icon-gallery",props:{scope:{}},setup(e){const t=e;function n(l){t.scope.execute(l),t.scope.setExpanded(!1)}return(l,s)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-icon-gallery",onKeydown:s[0]||(s[0]=ue(J(o=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(!0),M(U,null,H(m(jv),o=>(x(),M("section",{key:o.label,"aria-label":o.label},[k("h4",X5,N(o.label),1),k("div",Z5,[(x(!0),M(U,null,H(o.icons,([a,i])=>(x(),M("button",{key:a,type:"button",class:"pptx-icon-gallery-item","aria-label":`插入图标:${i}`,title:i,onClick:r=>n(a)},[y(m(me),{name:a,size:20},null,8,["name"])],8,Y5))),128))])],8,Q5))),128))],32)):L("v-if",!0)}});async function eF(e){const t=e.defaultView?.navigator.mediaDevices;if(!t?.getDisplayMedia)return null;let n;try{n=await t.getDisplayMedia({video:!0,audio:!1})}catch{return null}try{const l=e.createElement("video");l.muted=!0,l.srcObject=n,await l.play(),await new Promise(a=>setTimeout(a,150));const s=e.createElement("canvas");s.width=l.videoWidth,s.height=l.videoHeight,s.getContext("2d")?.drawImage(l,0,0),l.srcObject=null;const o=await new Promise(a=>s.toBlob(a,"image/png"));return o&&s.width>0?{png:new Uint8Array(await o.arrayBuffer()),width:s.width,height:s.height}:null}finally{for(const l of n.getTracks())l.stop()}}async function tF(e,t){const n=e.current.value?.part;if(!n)return;const l=await eF(t);if(!l){e.toaster.create({type:"error",title:"无法截屏",description:"浏览器不支持屏幕共享,或没有允许共享屏幕。"});return}const s=16;e.session.commands.addPicture({slide:n,bytes:l.png,name:"屏幕截图",...Ie(e,s,s*l.height/l.width)})&&Le(e,n)}const nF=["video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4","video/webm;codecs=vp9,opus","video/webm"],Eu=new WeakMap;function lF(e,t){const n=nF.find(c=>t.isTypeSupported(c)),l=new t(e,n?{mimeType:n}:{}),s=[],[o]=e.getVideoTracks(),{width:a=16,height:i=9}=o?.getSettings()??{};l.addEventListener("dataavailable",c=>{c.data.size>0&&s.push(c.data)});const r=new Promise(c=>{l.addEventListener("stop",()=>{for(const p of e.getTracks())p.stop();const d=new Blob(s,{type:l.mimeType});d.size===0?c(null):d.arrayBuffer().then(p=>c({bytes:new Uint8Array(p),width:a,height:i}))})}),u=()=>{l.state!=="inactive"&&l.stop()};return o?.addEventListener("ended",u),l.start(1e3),{recording:{stop:u},clip:r}}async function sF(e,t){const n=Eu.get(e);if(n){n.stop();return}const l=t.defaultView,s=l?.navigator.mediaDevices;if(!l?.MediaRecorder||!s?.getDisplayMedia){e.toaster.create({type:"error",title:"无法录制屏幕",description:"浏览器不支持屏幕录制。"});return}let o;try{o=await s.getDisplayMedia({video:{frameRate:30},audio:!0})}catch{e.toaster.create({type:"error",title:"无法录制屏幕",description:"没有允许共享屏幕。"});return}const a=Sn(e),{recording:i,clip:r}=lF(o,l.MediaRecorder);Eu.set(e,i),a.recording.value=!0;const u=e.toaster.create({type:"info",title:"正在录制屏幕",description:"结束后插入为视频。",duration:Number.POSITIVE_INFINITY,action:{label:"停止录制",onClick:()=>i.stop()}}),c=await r;Eu.delete(e),a.recording.value=!1,e.toaster.dismiss(u),await oF(e,c)}async function oF(e,t){const n=e.current.value?.part;if(!n||!t)return;const l=16,s=Ie(e,l,l*t.height/Math.max(1,t.width));e.session.commands.addMedia({slide:n,kind:"video",bytes:t.bytes,name:"屏幕录制",...s})?Le(e,n):e.toaster.create({type:"error",title:"无法插入录制的视频"})}function aF(e,t,n,l){const s=e.current.value?.part,{commands:o}=e.session,a=Sn(e);if(t==="insert-wordart"){const i=typeof n=="string"?n:"fill-accent";return s&&o.addWordArt({slide:s,preset:i,text:"请在此处输入文字",...Ie(e,20,3.5)})&&(Le(e,s),ka(e,l,e.selected.value[0])),!0}if(t==="insert-icon"&&typeof n=="string"){const i=Qs.resolve(n),r=i?p$(i.svg):null,u=jv.flatMap(d=>d.icons).find(([d])=>d===n)?.[1]??"图标",c=Ie(e,2.5,2.5);return s&&r&&o.addIcon({slide:s,name:u,paths:[r],x:c.x,y:c.y,size:c.width})&&Le(e,s),!0}if(t.startsWith("insert-diagram:")){const i=zr(t.slice(15));return s&&i&&o.addDiagram({slide:s,layout:i.id,items:i.sample,...Ie(e,22,10)})&&Le(e,s),!0}if(t==="insert-screen-recording")return sF(e,l.ownerDocument),!0;if(t==="insert-barcode")return a.barcodeOpen.value=!0,!0;if(t.startsWith("convert-diagram:")){const i=e.textSelection.value[0];return s&&i!==void 0&&e.textSelection.value.length===1&&(o.convertTextToDiagram({slide:s,shape:i,layout:t.slice(16)})?Le(e,s):e.toaster.create({type:"info",title:"这个文本框没有可转换的文字"})),!0}if(t==="text-link"||t==="text-unlink"){const i=e.textEditor.value?.view;return t==="text-unlink"?i&&Kr(i,null):i&&(a.textLinkOpen.value=!0),!0}if(t==="zoom-go"){const i=e.selected.value[0],r=s&&i!==void 0?le(e.session.document.presentation(),s,i):null,u=r?mi(r):null;return u?.kind==="slide"&&e.session.document.select({slide:We(u.slide),shapes:[]}),!0}if(t==="smartart-convert"){const i=e.selected.value[0];return s&&i!==void 0&&(o.convertSmartArt({slide:s,shape:i})?Le(e,s):e.toaster.create({type:"error",title:"无法转换这个智能图形",description:"文件里没有保存排好的形状。"})),!0}return t==="insert-screenshot"?(tF(e,l.ownerDocument),!0):t==="header-footer"||t==="insert-slide-number"||t==="insert-date"?(a.headerFooterOpen.value=!0,!0):t==="action-settings"||t==="action-settings:url"?(a.actionPreset.value=t==="action-settings:url"?"url":void 0,e.selected.value.length>0?a.actionOpen.value=!0:e.toaster.create({type:"info",title:"先选中要设置动作的对象"}),!0):t.startsWith("insert-section-zoom:")?(yS(e,l.ownerDocument,Number(t.slice(20))),!0):t==="insert-summary-zoom"?(xS(e,l.ownerDocument),!0):t.startsWith("insert-zoom:")?(bS(e,l.ownerDocument,t.slice(12)),!0):!1}const iF=["data-preset","title","aria-label","onClick"],rF=O({__name:"wordart-gallery",props:{scope:{}},setup(e){const t=e;function n(l){t.scope.execute(l),t.scope.setExpanded(!1)}return(l,s)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-wordart-gallery",role:"group","aria-label":"艺术字样式",onKeydown:s[0]||(s[0]=ue(J(o=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(!0),M(U,null,H(m(yr),o=>(x(),M("button",{key:o.id,type:"button",class:"pptx-wordart-tile","data-preset":o.id,title:o.label,"aria-label":o.label,onClick:a=>n(o.id)},[...s[1]||(s[1]=[k("span",null,"文字",-1)])],8,iF))),128))],32)):L("v-if",!0)}}),uF={hidden:""},cF={id:"insert-extras",renderers:{wordArtGallery:rF,iconGallery:J5},intent:(e,t,n,l)=>aF(e,t,n,l),overlays:[_5,C5,H5,I5,R5,O({__name:"zoom-frames",props:{state:{}},setup(e){const t=e;function n(){Q2(t.state.session.document.presentation())}let l;return ft(()=>{n(),l=t.state.session.document.subscribe(s=>{s.content&&!s.live&&n()})}),Re(()=>l?.()),(s,o)=>(x(),M("span",uF))}})],inspector:[{kinds:["group"],component:U5}]};function Kv(e){const t=e.current.value?.part,n=e.textEditor.value,l=n?.shape??e.textSelection.value[0],s=t&&l!==void 0?le(e.session.document.presentation(),t,l):null;if(!s)return null;const o=n?ze(s).slice(0,n.selection().start).split(`
|
|
88
|
+
`).length-1:0,a=(h,v)=>{try{return h()??v}catch{return v}},i=a(()=>w0(s,o),{leftEmu:null,rightEmu:null,firstLineEmu:null}),r=a(()=>$0(s,o),{beforePts:null,afterPts:null}),u=a(()=>k0(s,o),null),c=a(()=>ci(s,o),null),d=e.session.document.presentation(),p=a(()=>di(d,s,o),null),f=i.firstLineEmu??0;return{align:c==="ctr"||c==="r"||c==="just"||c==="dist"?c:"l",indentLeft:i.leftEmu??0,firstLine:f,firstLineChars:Math.round(f/(yp(d,s,o)*12700)*100)/100,asianLineBreak:p?.asianLineBreak??!0,latinLineBreak:p?.latinLineBreak??!1,hangingPunctuation:p?.hangingPunctuation??!1,fontAlignment:p?.fontAlignment??"auto",spaceBefore:r.beforePts??0,spaceAfter:r.afterPts??0,lineSpacing:u?{kind:u.kind==="pct"?"multiple":"exact",value:u.value}:{kind:"multiple",value:1}}}const Wv=new WeakMap;function qv(e){let t=Wv.get(e);return t||(t=Q(!1),Wv.set(e,t)),t}const dF={class:"pptx-paragraph-row"},pF={class:"pptx-paragraph-row"},fF={class:"pptx-paragraph-row"},Fu=36e4,mF={id:"paragraph",intent:(e,t)=>t!=="paragraph:dialog"?!1:(Kv(e)&&(qv(e).value=!0),!0),overlays:[O({__name:"paragraph-dialog",props:{state:{},host:{}},setup(e){const t=e,n=qv(t.state),l=V("l"),s=V("0"),o=V("none"),a=V("0"),i=V("0"),r=V("0"),u=V("1"),c=V("1"),d=V("char"),p=V(!0),f=V(!1),h=V(!1),v=V("auto");let g={};const $=[{value:"char",label:"字符"},{value:"cm",label:"厘米"}],b=[{value:"auto",label:"自动"},{value:"top",label:"顶端"},{value:"center",label:"居中"},{value:"baseline",label:"基线对齐"},{value:"bottom",label:"底端"}],w=[{value:"l",label:"左对齐"},{value:"ctr",label:"居中"},{value:"r",label:"右对齐"},{value:"just",label:"两端对齐"},{value:"dist",label:"分散对齐"}],S=[{value:"none",label:"(无)"},{value:"first",label:"首行缩进"},{value:"hanging",label:"悬挂缩进"}],C=[{value:"1",label:"单倍行距"},{value:"1.5",label:"1.5 倍行距"},{value:"2",label:"2 倍行距"},{value:"multiple",label:"多倍行距"},{value:"exact",label:"固定值"}],E=D=>String(Math.round(D/Fu*100)/100);X(n,D=>{const P=D?Kv(t.state):null;if(!P)return;l.value=P.align,s.value=E(P.indentLeft),o.value=P.firstLine>0?"first":P.firstLine<0?"hanging":"none",d.value=P.firstLine===0||Number.isInteger(P.firstLineChars)?"char":"cm",a.value=d.value==="char"?String(Math.abs(P.firstLineChars)||2):E(Math.abs(P.firstLine)),p.value=P.asianLineBreak,f.value=P.latinLineBreak,h.value=P.hangingPunctuation,v.value=P.fontAlignment,g={asianLineBreak:P.asianLineBreak,latinLineBreak:P.latinLineBreak,hangingPunctuation:P.hangingPunctuation,fontAlignment:P.fontAlignment},i.value=String(P.spaceBefore),r.value=String(P.spaceAfter);const{kind:I,value:K}=P.lineSpacing;u.value=I==="exact"?"exact":K===1||K===1.5||K===2?String(K):"multiple",c.value=String(K)});const T=F(()=>{const D=[s.value,a.value,i.value,r.value,c.value].map(Number);if(!D.every(Number.isFinite))return null;const[P,I,K,G,ee]=D,W=u.value==="1"||u.value==="1.5"||u.value==="2",te=o.value==="hanging"?-1:1,he={asianLineBreak:p.value,latinLineBreak:f.value,hangingPunctuation:h.value,fontAlignment:v.value},Ye=Object.fromEntries(Object.entries(he).filter(([et,ct])=>g[et]!==ct));return{align:l.value,indentLeft:Math.round(P*Fu),...o.value!=="none"&&d.value==="char"?{firstLineChars:I*te}:{firstLine:o.value==="none"?0:Math.round(I*Fu)*te},...Ye,spaceBefore:K,spaceAfter:G,lineSpacing:W?{kind:"multiple",value:Number(u.value)}:{kind:u.value==="exact"?"exact":"multiple",value:ee}}});function z(){T.value&&(t.host.intent("paragraph-format",T.value),n.value=!1)}return(D,P)=>(x(),B(m(Ae),{open:m(n),"onUpdate:open":P[14]||(P[14]=I=>n.value=I)},{default:A(()=>[y(m(Te),{title:"段落",size:"medium",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:P[13]||(P[13]=I=>n.value=!1)},{default:A(()=>[...P[19]||(P[19]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!T.value,onClick:z},{default:A(()=>[...P[20]||(P[20]=[R("确定",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("form",{class:"pptx-paragraph-form",onSubmit:J(z,["prevent"])},[P[15]||(P[15]=k("h4",null,"常规",-1)),y(m(re),{label:"对齐方式"},{default:A(({controlProps:I})=>[y(m(ce),ie(I,{modelValue:l.value,"onUpdate:modelValue":P[0]||(P[0]=K=>l.value=K),label:"对齐方式",items:w}),null,16,["modelValue"])]),_:1}),P[16]||(P[16]=k("h4",null,"缩进",-1)),k("div",dF,[y(m(re),{label:"文本之前(厘米)"},{default:A(({controlProps:I})=>[y(m(de),ie(I,{modelValue:s.value,"onUpdate:modelValue":P[1]||(P[1]=K=>s.value=K),label:"文本之前(厘米)",min:0,step:.1}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"特殊格式"},{default:A(({controlProps:I})=>[y(m(ce),ie(I,{modelValue:o.value,"onUpdate:modelValue":P[2]||(P[2]=K=>o.value=K),label:"特殊格式",items:S}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"度量值"},{default:A(({controlProps:I})=>[y(m(de),ie(I,{modelValue:a.value,"onUpdate:modelValue":P[3]||(P[3]=K=>a.value=K),label:"度量值",min:0,step:d.value==="char"?.5:.1,disabled:o.value==="none"}),null,16,["modelValue","step","disabled"])]),_:1}),y(m(re),{label:"单位"},{default:A(({controlProps:I})=>[y(m(ce),ie(I,{modelValue:d.value,"onUpdate:modelValue":P[4]||(P[4]=K=>d.value=K),label:"单位",items:$,disabled:o.value==="none"}),null,16,["modelValue","disabled"])]),_:1})]),P[17]||(P[17]=k("h4",null,"间距",-1)),k("div",pF,[y(m(re),{label:"段前(磅)"},{default:A(({controlProps:I})=>[y(m(de),ie(I,{modelValue:i.value,"onUpdate:modelValue":P[5]||(P[5]=K=>i.value=K),label:"段前(磅)",min:0,step:1}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"段后(磅)"},{default:A(({controlProps:I})=>[y(m(de),ie(I,{modelValue:r.value,"onUpdate:modelValue":P[6]||(P[6]=K=>r.value=K),label:"段后(磅)",min:0,step:1}),null,16,["modelValue"])]),_:1})]),k("div",fF,[y(m(re),{label:"行距"},{default:A(({controlProps:I})=>[y(m(ce),ie(I,{modelValue:u.value,"onUpdate:modelValue":P[7]||(P[7]=K=>u.value=K),label:"行距",items:C}),null,16,["modelValue"])]),_:1}),y(m(re),{label:u.value==="exact"?"设置值(磅)":"设置值(倍)"},{default:A(({controlProps:I})=>[y(m(de),ie(I,{modelValue:c.value,"onUpdate:modelValue":P[8]||(P[8]=K=>c.value=K),label:u.value==="exact"?"设置值(磅)":"设置值(倍)",min:u.value==="exact"?1:.1,step:u.value==="exact"?1:.1,disabled:u.value!=="multiple"&&u.value!=="exact"}),null,16,["modelValue","label","min","step","disabled"])]),_:1},8,["label"])]),P[18]||(P[18]=k("h4",null,"中文版式",-1)),y(m(Ce),{checked:p.value,"onUpdate:checked":P[9]||(P[9]=I=>p.value=I),label:"按中文习惯控制首尾字符"},null,8,["checked"]),y(m(Ce),{checked:f.value,"onUpdate:checked":P[10]||(P[10]=I=>f.value=I),label:"允许西文在单词中间换行"},null,8,["checked"]),y(m(Ce),{checked:h.value,"onUpdate:checked":P[11]||(P[11]=I=>h.value=I),label:"允许标点溢出边界"},null,8,["checked"]),y(m(re),{label:"文本对齐方式"},{default:A(({controlProps:I})=>[y(m(ce),ie(I,{modelValue:v.value,"onUpdate:modelValue":P[12]||(P[12]=K=>v.value=K),label:"文本对齐方式",items:b}),null,16,["modelValue"])]),_:1})],32)]),_:1})]),_:1},8,["open"]))}})]};function hF(e,t){return e.kind==="slide"?`只改第 ${e.index+1} 页:${t}`:`只改选中的内容:${t}`}function vF(e,t){return`重做第 ${e+1} 页${t?`「${t}」`:""}:内容不变,按设计语言换一种更合适的版式,只改这一页。`}const _v=new WeakMap;function zu(e){let t=_v.get(e);return t||(t=Q(),_v.set(e,t)),t}const gF=["aria-label"],bF={class:"pptx-assist-prompt-title qk-type-control"},yF={class:"pptx-assist-prompt-actions"},nn=[$5,cF,mF,ZM,l3,DP,i4,P4,uT,qT,$E,lM,A6,{id:"assist",intent:(e,t,n,l)=>{if(!t.startsWith("assist:"))return!1;const s=e.current.value;return t==="assist:edit-shapes"?zu(e).value={kind:"shapes"}:t==="assist:edit-slide"&&s?zu(e).value={kind:"slide",index:s.index}:t==="assist:redo-slide"&&s&&l.ask(vF(s.index,s.title)),!0},overlays:[Bs(O({__name:"prompt",props:{state:{},host:{}},setup(e){const t=e,n=zu(t.state),l=V(""),s=V(),o=V({left:"50%",top:"120px",transform:"translateX(-50%)"});X(n,async u=>{if(!u)return;l.value="";const c=[...t.host.ownerDocument.querySelectorAll(".pptx-selection-box")].map(p=>p.getBoundingClientRect()),d=t.host.ownerDocument.querySelector(".pptx-stage")?.getBoundingClientRect();if(u.kind==="shapes"&&c.length>0){const p=Math.min(...c.map($=>$.left)),f=Math.max(...c.map($=>$.bottom)),h=t.host.ownerDocument.defaultView,v=Math.min(f+12,(h?.innerHeight??800)-180),g=Math.min(p,(h?.innerWidth??1200)-380);o.value={left:`${Math.round(g)}px`,top:`${Math.round(v)}px`,transform:"none"}}else d&&(o.value={left:`${Math.round(d.left+d.width/2)}px`,top:`${Math.round(d.top+24)}px`,transform:"translateX(-50%)"});await pt(),s.value?.$el?.querySelector("textarea")?.focus()});const a=F(()=>n.value?.kind==="slide"?`让 AI 改第 ${n.value.index+1} 页`:"让 AI 改选中的内容");async function i(){const u=n.value,c=l.value.trim();!u||!c||(n.value=void 0,await t.host.ask(hF(u,c)))}function r(u){u.key==="Escape"?n.value=void 0:u.key==="Enter"&&!u.shiftKey&&!u.isComposing&&(u.preventDefault(),i())}return(u,c)=>m(n)?(x(),M("div",{key:0,class:"pptx-assist-prompt",style:fe(o.value),role:"dialog","aria-label":a.value,onPointerdown:c[2]||(c[2]=J(()=>{},["stop"])),onKeydown:J(r,["stop"])},[k("div",bF,N(a.value),1),y(m(Ct),{ref_key:"box",ref:s,modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d),width:"100%",rows:2,"auto-resize":"","max-rows":6,placeholder:"想怎么改?例如:数字再大一点,换成左右对比","aria-label":"修改要求"},null,8,["modelValue"]),k("div",yF,[y(m(q),{variant:"ghost",size:"sm",onClick:c[1]||(c[1]=d=>n.value=void 0)},{default:A(()=>[...c[3]||(c[3]=[R("取消",-1)])]),_:1}),y(m(q),{color:"primary",variant:"solid",size:"sm",disabled:!l.value.trim(),onClick:i},{default:A(()=>[...c[4]||(c[4]=[R("发送",-1)])]),_:1},8,["disabled"])])],44,gF)):L("v-if",!0)}}),[["__scopeId","data-v-75f91808"]])]}];function Gv(e){return nn.flatMap(t=>t.tabs??[]).filter(t=>!t.contextual||t.contextual(e)).sort((t,n)=>t.order-n.order)}const xF={class:"pptx-header"},wF={class:"task-left"},kF={class:"document-identity"},$F={class:"brand-mark","aria-hidden":"true"},SF=["title"],CF={key:0,class:"modified-dot",role:"status","aria-label":"有未保存的修改",title:"有未保存的修改"},MF={class:"task-center"},PF={class:"header-actions"},TF=O({__name:"header",props:ol({state:{},hosted:{type:Boolean}},{tab:{required:!0},tabModifiers:{}}),emits:ol(["open","present"],["update:tab"]),setup(e,{emit:t}){const n=e,l=t,s=on(e,"tab"),o=F(()=>(n.state.tick.value,n.state.session.name().replace(/\.pptx$/iu,""))),a=V(o.value);X(o,v=>{a.value=v});function i(v){n.state.session.rename(v),n.state.tick.value+=1}const r=/Mac|iPhone|iPad/u.test(navigator.platform)?"⌘":"Ctrl",u=[{value:"home",label:"开始",panelId:"pptx-tools-home"},{value:"insert",label:"插入",panelId:"pptx-tools-insert"},{value:"transition",label:"切换",panelId:"pptx-tools-transition"},{value:"animation",label:"动画",panelId:"pptx-tools-animation"},{value:"show",label:"放映",panelId:"pptx-tools-show"}],c={home:0,insert:10,transition:30,animation:40,show:50},d=F(()=>[...u.map(v=>({...v,order:c[v.value]??0})),...Gv(n.state).map(v=>({value:v.value,label:v.label,panelId:`pptx-tools-${v.value}`,order:v.order}))].sort((v,g)=>v.order-g.order).map(({order:v,...g})=>g));X(d,v=>{v.some(g=>g.value===s.value)||(s.value="home")});const p=F(()=>[{value:"new",label:"新建演示文稿",icon:"file"},{value:"open",label:"打开…",icon:"folderOpen",shortcut:[r,"O"]},{value:"separator",label:"",kind:"separator"},{value:"save",label:n.hosted?"保存":"下载副本",icon:n.hosted?"save":"download",shortcut:[r,"S"]},{value:"file:save-template",label:"另存为模板…",icon:"fileOutput"},{value:"file:save-show",label:"另存为放映文件…",icon:"play"},{value:"separator-export",label:"",kind:"separator"},{value:"file:export-pdf",label:"导出为 PDF…",icon:"exportFile"},{value:"file:export-image",label:"导出为图片…",icon:"fileImage"},{value:"file:export-video",label:"输出为视频…",icon:"video"},{value:"file:export-gif",label:"输出为 GIF…",icon:"images"},{value:"file:export-outline",label:"导出为 Word 讲义…",icon:"fileText"},{value:"file:print",label:"打印…",icon:"printer"},{value:"separator-properties",label:"",kind:"separator"},{value:"file:compress",label:"压缩图片…",icon:"compressImage"},{value:"file:properties",label:"属性…",icon:"circleInfo"}]);function f(v){v==="new"&&n.state.session.createDocument(),v==="open"&&l("open"),v==="save"&&n.state.session.save(),v.startsWith("file:")&&pv(n.state,v)}function h(v){v!==void 0&&d.value.some(g=>g.value===v)&&(s.value=v)}return(v,g)=>(x(),M("header",xF,[k("div",wF,[y(m(Xs),{items:p.value,"aria-label":"文件",width:"auto",onSelect:f},{trigger:A(()=>[y(m(ye),{label:"文件",variant:"ghost",size:"sm"},{default:A(()=>[y(m(me),{name:"menu"})]),_:1})]),_:1},8,["items"]),k("div",kF,[k("span",$F,[y(m(me),{name:"monitor"})]),g[4]||(g[4]=k("strong",{class:"product-name"},[R("QuireKit "),k("span",{class:"text-qk-text-tertiary"},"演示")],-1)),g[5]||(g[5]=k("span",{class:"identity-divider","aria-hidden":"true"},null,-1)),k("div",{class:"document-name",title:e.state.session.name()},[y(m(Ub),{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=$=>a.value=$),label:"文稿名称","hide-label":"",placeholder:"未命名演示文稿",controls:!1,"activation-mode":"click","submit-mode":"both","auto-resize":"","max-length":120,onValueCommit:g[1]||(g[1]=$=>i($.value))},null,8,["modelValue"])],8,SF),e.state.dirty.value?(x(),M("span",CF)):L("v-if",!0)])]),k("div",MF,[y(m(hc),{class:"task-tabs",label:"编辑任务",size:"sm",items:d.value,"render-panels":!1,"model-value":s.value,"onUpdate:modelValue":h},null,8,["items","model-value"])]),k("div",PF,[y(m(q),{variant:"ghost",size:"sm",onClick:g[2]||(g[2]=$=>e.state.session.save())},{default:A(()=>[R(N(e.hosted?"保存":"下载"),1)]),_:1}),y(m(q),{color:"primary",variant:"solid",size:"sm",onClick:g[3]||(g[3]=$=>l("present","current"))},{default:A(()=>[...g[6]||(g[6]=[R(" 放映 ",-1)])]),_:1})])]))}}),AF={key:0,class:"pptx-chart-data","aria-label":"图表数据"},EF={class:"pptx-chart-data-scroll"},FF={class:"pptx-chart-data-table"},zF=["value","onChange"],DF=["value","onChange"],LF=["value","aria-label","onChange"],VF={class:"pptx-chart-data-actions"},IF=O({__name:"chart-data",props:{state:{},shape:{}},setup(e){const t=e,n=F(()=>{t.state.tick.value;const c=t.state.current.value?.part,d=c?le(t.state.session.document.presentation(),c,t.shape):null,p=d?A0(d):null;if(!d||["scatter","bubble","stock","surface"].includes(p??""))return null;const f=T0(d),h=E0(d);return!f||!h?null:{single:p==="pie"||p==="doughnut",categories:f,series:h.map(v=>({name:v,values:f.map((g,$)=>F0(d,v)?.[$]??null)}))}});function l(c){const d=t.state.current.value?.part;d&&t.state.session.commands.setChartData({slide:d,shape:t.shape,categories:c.categories,series:c.series})}function s(c,d){const p=n.value;p&&p.categories[c]!==d&&l({...p,categories:p.categories.map((f,h)=>h===c?d:f)})}function o(c,d){const p=n.value;p&&d.trim()&&p.series[c]?.name!==d&&l({...p,series:p.series.map((f,h)=>h===c?{...f,name:d.trim()}:f)})}function a(c,d,p){const f=n.value,h=p.trim()===""?null:Number(p);!f||h!==null&&!Number.isFinite(h)||f.series[d]?.values[c]===h||l({...f,series:f.series.map((v,g)=>g===d?{...v,values:v.values.map(($,b)=>b===c?h:$)}:v)})}function i(){const c=n.value;c&&l({categories:[...c.categories,`类别 ${c.categories.length+1}`],series:c.series.map(d=>({...d,values:[...d.values,null]}))})}function r(){const c=n.value;c&&l({...c,series:[...c.series,{name:`系列 ${c.series.length+1}`,values:c.categories.map(()=>null)}]})}const u=c=>c.target.value;return(c,d)=>n.value?(x(),M("section",AF,[d[6]||(d[6]=k("h3",{class:"pptx-chart-data-title"},"图表数据",-1)),k("div",EF,[k("table",FF,[k("thead",null,[k("tr",null,[d[3]||(d[3]=k("th",null,null,-1)),(x(!0),M(U,null,H(n.value.series,(p,f)=>(x(),M("th",{key:`s${f}`},[k("input",{value:p.name,"aria-label":"系列名称",onChange:h=>o(f,u(h)),onKeydown:d[0]||(d[0]=ue(h=>h.target.blur(),["enter"]))},null,40,zF)]))),128))])]),k("tbody",null,[(x(!0),M(U,null,H(n.value.categories,(p,f)=>(x(),M("tr",{key:`c${f}`},[k("th",null,[k("input",{value:p,"aria-label":"类别名称",onChange:h=>s(f,u(h)),onKeydown:d[1]||(d[1]=ue(h=>h.target.blur(),["enter"]))},null,40,DF)]),(x(!0),M(U,null,H(n.value.series,(h,v)=>(x(),M("td",{key:`v${v}`},[k("input",{value:h.values[f]??"",inputmode:"decimal","aria-label":`${p} · ${h.name}`,onChange:g=>a(f,v,u(g)),onKeydown:d[2]||(d[2]=ue(g=>g.target.blur(),["enter"]))},null,40,LF)]))),128))]))),128))])])]),k("div",VF,[y(m(q),{size:"sm",variant:"ghost",onClick:i},{default:A(()=>[...d[4]||(d[4]=[R("添加类别",-1)])]),_:1}),n.value.single?L("v-if",!0):(x(),B(m(q),{key:0,size:"sm",variant:"ghost",onClick:r},{default:A(()=>[...d[5]||(d[5]=[R("添加系列",-1)])]),_:1}))])])):L("v-if",!0)}}),BF={key:0,class:"pptx-property-section","aria-label":"背景"},OF={key:0,class:"pptx-property-row"},UF={class:"pptx-property-row"},NF={class:"pptx-property-row"},RF={class:"pptx-background-actions"},jF=O({__name:"slide-style",props:{state:{}},setup(e){const t=e,n=F(()=>{t.state.tick.value;const f=t.state.current.value?.part,h=f?t.state.slide(f):null;if(!f||!h)return null;const v=H0(h),g=v.kind==="gradient"?Q0(h):null,$=g?.stops??[];return{part:f,kind:v.kind==="solid"?"solid":v.kind==="gradient"?"gradient":v.kind==="image"?"picture":"inherit",color:v.kind==="solid"?lt(v.color):null,from:lt($[0]?.resolvedColor??$[0]?.color??null)??"#FFFFFF",to:lt($.at(-1)?.resolvedColor??$.at(-1)?.color??null)??"#D9E2F3",angle:g?.angleDeg??90,radial:g?.path==="circle",graphicsHidden:oy(h)}}),l=V("inherit");X(()=>n.value?.kind,f=>{l.value=f??"inherit"},{immediate:!0});const s=[{value:"inherit",label:"默认"},{value:"solid",label:"纯色"},{value:"gradient",label:"渐变"},{value:"picture",label:"图片"}],o=[{value:"90",label:"从上到下"},{value:"0",label:"从左到右"},{value:"45",label:"左上到右下"},{value:"135",label:"右上到左下"},{value:"circle",label:"从中心向外"}],a=je("pictureInput");function i(f){const h=n.value;!h||!f||(l.value=f,f==="inherit"?t.state.session.commands.resetSlideBackground({slide:h.part}):f==="solid"?r(h.color??"#FFFFFF"):f==="gradient"&&u(h.from,h.to,h.radial?"circle":String(h.angle)))}function r(f){const h=n.value?.part;h&&f&&t.state.session.commands.setSlideBackground({slide:h,color:f})}function u(f,h,v){const g=n.value?.part;if(!g||!f||!h)return;const $=v==="circle";t.state.session.commands.setSlideBackgroundFill({slide:g,fill:{kind:"gradient",stops:[{offset:0,color:f},{offset:1,color:h}],angle:$?90:Number(v),path:$?"circle":"linear"}})}async function c(f){const h=f.target,v=h.files?.[0];h.value="";const g=n.value?.part;v&&g&&t.state.session.commands.setSlideBackgroundFill({slide:g,fill:{kind:"picture",bytes:new Uint8Array(await v.arrayBuffer())}})}function d(f){const h=n.value?.part;h&&t.state.session.commands.setBackgroundGraphicsHidden({slide:h,hidden:f===!0})}function p(){const f=n.value?.part;f&&t.state.session.commands.applyBackgroundToAll({slide:f})&&(t.state.renders.clear(),t.state.toaster.create({type:"success",title:"已应用到全部幻灯片"}))}return(f,h)=>n.value?(x(),M("section",BF,[h[11]||(h[11]=k("div",{class:"pptx-section-label"},[k("span",null,"背景")],-1)),y(m(al),{"model-value":l.value,label:"背景填充",items:s,size:"sm","onUpdate:modelValue":i},null,8,["model-value"]),l.value==="solid"?(x(),M("div",OF,[h[6]||(h[6]=k("span",null,"颜色",-1)),y(m(an),{label:"背景颜色","model-value":n.value.color??"#FFFFFF","allow-reset":!1,"show-alpha":!1,onCommit:h[0]||(h[0]=v=>r(m(lt)(v)))},null,8,["model-value"])])):l.value==="gradient"?(x(),M(U,{key:1},[k("div",UF,[h[7]||(h[7]=k("span",null,"起始颜色",-1)),y(m(an),{label:"起始颜色","model-value":n.value.from,"allow-reset":!1,"show-alpha":!1,onCommit:h[1]||(h[1]=v=>u(m(lt)(v),n.value.to,n.value.radial?"circle":String(n.value.angle)))},null,8,["model-value"])]),k("div",NF,[h[8]||(h[8]=k("span",null,"结束颜色",-1)),y(m(an),{label:"结束颜色","model-value":n.value.to,"allow-reset":!1,"show-alpha":!1,onCommit:h[2]||(h[2]=v=>u(n.value.from,m(lt)(v),n.value.radial?"circle":String(n.value.angle)))},null,8,["model-value"])]),y(m(re),{label:"方向"},{default:A(({controlProps:v})=>[y(m(ce),ie(v,{label:"方向","model-value":n.value.radial?"circle":String(n.value.angle),items:o,"onUpdate:modelValue":h[3]||(h[3]=g=>g&&u(n.value.from,n.value.to,g))}),null,16,["model-value"])]),_:1})],64)):l.value==="picture"?(x(),B(m(q),{key:2,block:"",variant:"outline",onClick:h[4]||(h[4]=v=>a.value?.click())},{default:A(()=>[R(N(n.value.kind==="picture"?"更换图片…":"选择图片…"),1)]),_:1})):L("v-if",!0),y(m(Ce),{label:"隐藏背景图形",checked:n.value.graphicsHidden,"onUpdate:checked":d},null,8,["checked"]),k("div",RF,[y(m(q),{variant:"outline",disabled:e.state.slides.value.length<2,onClick:p},{default:A(()=>[...h[9]||(h[9]=[R("全部应用",-1)])]),_:1},8,["disabled"]),y(m(q),{variant:"text",disabled:n.value.kind==="inherit",onClick:h[5]||(h[5]=v=>i("inherit"))},{default:A(()=>[...h[10]||(h[10]=[R("重置背景",-1)])]),_:1},8,["disabled"])]),k("input",{ref_key:"pictureInput",ref:a,type:"file",accept:"image/png,image/jpeg,image/gif",hidden:"","aria-label":"选择背景图片",onChange:c},null,544)])):L("v-if",!0)}}),KF={class:"pptx-inspector","aria-label":"属性"},WF={class:"pptx-panel-header"},qF={class:"qk-type-label"},_F={key:0,class:"pptx-inspector-name text-qk-text-tertiary"},GF={key:0,class:"pptx-inspector-branch"},HF={class:"pptx-property-section"},QF={class:"pptx-property-section"},XF={key:1,class:"pptx-inspector-branch"},ZF={class:"pptx-property-section"},YF=O({__name:"inspector",props:{state:{}},emits:["deleteShapes"],setup(e,{emit:t}){const n=e,l=t,s={text:"文本框",picture:"图片",table:"表格",chart:"图表",group:"组合",connector:"连接线",media:"媒体",other:"对象"},o=F(()=>n.state.selected.value.length===1?n.state.boxes.value.find(b=>b.id===n.state.selected.value[0]):void 0),a=F(b=>{const w=n.state.current.value?.part;if(!w)return;if(o.value)return b?.slide===w&&b.box===o.value?b:{slide:w,box:o.value};if(b?.slide!==w)return;const S=n.state.boxes.value.find(C=>C.id===b.box.id);if(!(!S||S.kind!==b.box.kind))return S===b.box?b:{slide:w,box:S}}),i=F(()=>{const b=o.value,w=n.state.current.value?.part;if(!b||!w)return"";n.state.tick.value;const S=b.kind==="text"?le(n.state.session.document.presentation(),w,b.id):null;return S&&b.placeholder===null&&!Yc(S)?"形状":s[b.kind]}),r=b=>String(Math.round(b/rt*100)/100),u=V({x:"0",y:"0",width:"0",height:"0",rotation:"0"});X(o,b=>{b&&(u.value={x:r(b.x),y:r(b.y),width:r(b.width),height:r(b.height),rotation:String(Math.round(b.rotation*10)/10)})},{immediate:!0});const c=nn.flatMap(b=>b.inspector??[]),d=F(()=>a.value?c.filter(b=>b.kinds!=="slide"&&b.kinds.includes(a.value.box.kind)):[]),p=c.filter(b=>b.kinds==="slide"),f=F(()=>o.value!==void 0&&o.value.kind!=="table"&&o.value.kind!=="chart");function h(){const b=n.state.current.value?.part,w=o.value;if(!b||!w)return;const[S,C,E,T]=[u.value.x,u.value.y,u.value.width,u.value.height].map(Number);[S,C,E,T].every(Number.isFinite)&&n.state.session.commands.setShapeBounds({slide:b,shape:w.id,x:be(S),y:be(C),width:be(Math.max(.01,E)),height:be(Math.max(.01,T))})}function v(){const b=n.state.current.value?.part,w=o.value,S=Number(u.value.rotation);b&&w&&Number.isFinite(S)&&n.state.session.commands.rotateShapes({slide:b,shapes:[w.id],to:S})}const g=F(()=>n.state.current.value?.hidden??!1);function $(b){const w=n.state.current.value?.part;w&&n.state.session.commands.setSlideHidden({slide:w,hidden:b===!0})}return(b,w)=>(x(),M("aside",KF,[k("div",WF,[k("span",qF,N(o.value?i.value:"幻灯片"),1),o.value?(x(),M("span",_F,N(o.value.name),1)):L("v-if",!0)]),a.value?ht((x(),M("div",GF,[k("section",HF,[w[6]||(w[6]=k("div",{class:"pptx-section-label"},[k("span",null,"位置与大小"),k("span",{class:"text-qk-text-tertiary"},"厘米")],-1)),k("div",{class:"pptx-property-grid",onKeydown:ue(h,["enter"])},[y(m(re),{label:"X"},{default:A(({controlProps:S})=>[y(m(de),ie(S,{modelValue:u.value.x,"onUpdate:modelValue":w[0]||(w[0]=C=>u.value.x=C),label:"X",step:.1,onBlur:h}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"Y"},{default:A(({controlProps:S})=>[y(m(de),ie(S,{modelValue:u.value.y,"onUpdate:modelValue":w[1]||(w[1]=C=>u.value.y=C),label:"Y",step:.1,onBlur:h}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"宽度"},{default:A(({controlProps:S})=>[y(m(de),ie(S,{modelValue:u.value.width,"onUpdate:modelValue":w[2]||(w[2]=C=>u.value.width=C),label:"宽度",min:.01,step:.1,onBlur:h}),null,16,["modelValue"])]),_:1}),y(m(re),{label:"高度"},{default:A(({controlProps:S})=>[y(m(de),ie(S,{modelValue:u.value.height,"onUpdate:modelValue":w[3]||(w[3]=C=>u.value.height=C),label:"高度",min:.01,step:.1,onBlur:h}),null,16,["modelValue"])]),_:1})],32),f.value?(x(),M("div",{key:0,class:"pptx-property-grid",onKeydown:ue(v,["enter"])},[y(m(re),{label:"旋转(度)"},{default:A(({controlProps:S})=>[y(m(de),ie(S,{modelValue:u.value.rotation,"onUpdate:modelValue":w[4]||(w[4]=C=>u.value.rotation=C),label:"旋转(度)",step:1,onBlur:v}),null,16,["modelValue"])]),_:1})],32)):L("v-if",!0)]),a.value.box.kind==="text"&&a.value.box.placeholder===null?(x(),B(Kh,{key:0,state:e.state,shape:a.value.box.id},null,8,["state","shape"])):L("v-if",!0),a.value.box.kind==="chart"?(x(),B(IF,{key:1,state:e.state,shape:a.value.box.id},null,8,["state","shape"])):L("v-if",!0),a.value.box.kind==="table"?(x(),B(Im,{key:2,state:e.state,shape:a.value.box.id},null,8,["state","shape"])):L("v-if",!0),(x(!0),M(U,null,H(d.value,(S,C)=>(x(),B(An(S.component),{key:C,state:e.state,shape:a.value.box.id},null,8,["state","shape"]))),128)),k("section",QF,[y(m(q),{block:"",variant:"outline",color:"danger",onClick:w[5]||(w[5]=S=>l("deleteShapes"))},{default:A(()=>[...w[7]||(w[7]=[R("删除对象",-1)])]),_:1})])],512)),[[mt,o.value]]):L("v-if",!0),e.state.current.value?ht((x(),M("div",XF,[k("section",ZF,[y(m(En),{checked:g.value,label:"放映时隐藏","onUpdate:checked":$},null,8,["checked"])]),y(jF,{state:e.state},null,8,["state"]),(x(!0),M(U,null,H(m(p),(S,C)=>(x(),B(An(S.component),{key:C,state:e.state},null,8,["state"]))),128)),w[8]||(w[8]=k("section",{class:"pptx-property-section"},[k("p",{class:"pptx-property-note text-qk-text-tertiary"},"点击幻灯片上的对象查看和调整它的位置与大小,双击文本框修改文字。")],-1))],512)),[[mt,!o.value]]):L("v-if",!0)]))}}),JF=1500;let Us;const Hv=new Map;function ez(e,t,n){const l=`${e}:${t??""}:${n??""}`,s=Hv.get(l);if(s!==void 0)return s;Us??=(()=>{const a=pe(_a())[0];return{slide:a,shape:zn(a,{preset:"rect",x:j(0),y:j(0),w:j(1e6),h:j(1e6)})}})();let o=null;try{vo(Us.shape,{effect:e,...t?{shape:t}:{},...n?{direction:n}:{}});const a=Dt(Us.slide).filter(i=>i.targetShapeIds.includes(Fe(Us.shape))).at(-1);a&&(a.id!==null&&mo(Us.slide,a.id),o={...a,start:"click",delayMs:0,targetShapeIds:[1],target:{...a.target,shapeId:1},...a.durationMs===null?{}:{durationMs:Math.min(a.durationMs,JF)}})}catch{o=null}return Hv.set(l,o),o}const tz=["data-exit","data-playing"],nz={viewBox:"0 0 160 100",width:"100%",height:"100%"},lz=["data-pptx-shape-id"],sz=600,Qv=O({__name:"effect-preview",props:{effect:{},shape:{},direction:{},playing:{type:Boolean}},setup(e){const t=e,n=V(),l=F(()=>t.effect.endsWith("Out")||t.effect==="disappear");let s;function o(){const a=ez(t.effect,t.shape,t.direction);if(!a||!n.value)return;const i=w1({root:n.value,steps:[a],reducedMotion:tc});let r=!0,u=0,c;const d=()=>{if(!r)return;i.reset(),i.advance();const p=()=>{r&&(i.running?u=requestAnimationFrame(p):c=setTimeout(d,sz))};u=requestAnimationFrame(p)};d(),s=()=>{r=!1,cancelAnimationFrame(u),clearTimeout(c),i.dispose()}}return X(()=>[t.playing,t.effect,t.shape,t.direction],([a])=>{s?.(),s=void 0,a&&o()},{flush:"post"}),Re(()=>s?.()),(a,i)=>(x(),M("span",{ref_key:"root",ref:n,class:"pptx-effect-preview","data-exit":l.value||void 0,"data-playing":e.playing||void 0,"aria-hidden":"true"},[(x(),M("svg",nz,[k("g",{"data-pptx-shape-id":m(1)},[...i[0]||(i[0]=[k("rect",{x:"50",y:"32",width:"60",height:"36",rx:"3"},null,-1)])],8,lz)]))],8,tz))}}),Du=[{kind:"entrance",label:"进入",icon:"animationEntrance"},{kind:"emphasis",label:"强调",icon:"animationEmphasis"},{kind:"exit",label:"退出",icon:"animationExit"}],Xv={none:"无",fade:"淡入淡出",cut:"切入",push:"推入",pan:"平移",wipe:"擦除",cover:"覆盖",pull:"揭开",reveal:"显示",flip:"翻转",split:"分割",zoom:"缩放",warp:"扭曲",flythrough:"飞过",doors:"门",window:"窗口",blinds:"百叶窗",checker:"棋盘",comb:"梳理",randomBar:"随机线条",strips:"条纹",newsflash:"新闻快报",flash:"闪光",dissolve:"溶解",circle:"圆形",diamond:"菱形",plus:"加号",wedge:"楔形",wheel:"轮辐",random:"随机"},oz={l:"自右侧",r:"自左侧",u:"自底部",d:"自顶部",lu:"自右下部",ru:"自左下部",ld:"自右上部",rd:"自左上部",horz:"水平",vert:"垂直",in:"向内",out:"向外"},az={bottom:["自底部","到底部"],top:["自顶部","到顶部"],left:["自左侧","到左侧"],right:["自右侧","到右侧"],bottomLeft:["自左下部","到左下部"],bottomRight:["自右下部","到右下部"],topLeft:["自左上部","到左上部"],topRight:["自右上部","到右上部"]},iz=["data-selected","aria-selected"],rz={class:"pptx-animation-card-head"},uz={class:"pptx-animation-card-thumb"},cz={class:"pptx-animation-card-text"},dz={class:"pptx-animation-card-name"},pz=["data-kind"],fz={class:"pptx-animation-card-target"},mz={class:"pptx-animation-card-timeline","aria-hidden":"true"},hz={class:"pptx-animation-field"},vz={key:0,class:"pptx-animation-field"},gz={class:"pptx-animation-field"},bz={class:"pptx-animation-duration"},yz={class:"pptx-animation-value"},xz={class:"pptx-animation-field"},wz={key:1,class:"pptx-animation-field"},kz={class:"pptx-animation-field"},$z={class:"pptx-animation-field"},Sz={class:"pptx-animation-card-footer"},Cz={key:0,class:"pptx-animation-plays"},Zv=O({__name:"animation-card",props:{entry:{},selected:{type:Boolean},begin:{},span:{},objects:{}},emits:["select","play","intent"],setup(e,{emit:t}){const n=e,l=t,s=V(!1),o=F(()=>Du.find(T=>T.kind===n.entry.kind)??{label:"其他",icon:void 0}),a=[{value:"click",label:"单击时"},{value:"withPrevious",label:"同时"},{value:"afterPrevious",label:"之后"}],i=[{value:"asOneObject",label:"作为一个对象"},{value:"allAtOnce",label:"整批发送"},{value:"byParagraph",label:"按段落"}],r=(T,z)=>Math.round((T??z)/100)/10,u=F(()=>n.entry.preset?.label??n.entry.effect??"其他效果"),c=F(()=>n.entry.effect?Ra(n.entry.effect):[]),d=F(()=>yn.filter(T=>T.kind===n.entry.kind).map(T=>({value:T.id,label:T.label}))),p=F(()=>{const T=n.entry.durationMs??500;return{left:`${n.begin/n.span*100}%`,width:`${Math.max(4,T/n.span*100)}%`}}),f=V([r(n.entry.durationMs,500)]);X(()=>n.entry.durationMs,T=>{f.value=[r(T,500)]});function h(){const T=f.value[0];T!==void 0&&T!==r(n.entry.durationMs,500)&&l("intent","animation-duration",T)}const v=V(String(r(n.entry.delayMs,0)));X(()=>n.entry.delayMs,T=>{v.value=String(r(T,0))});function g(){const T=Number(v.value);Number.isFinite(T)&&T>=0&&T!==r(n.entry.delayMs,0)&&l("intent","animation-delay",T)}const $=[{value:"1",label:"无"},...[2,3,4,5,10].map(T=>({value:String(T),label:`${T} 次`})),{value:"untilNextClick",label:"直到下一次单击"},{value:"untilEnd",label:"直到幻灯片末尾"}],b=F(()=>n.entry.repeat===null?"1":String(n.entry.repeat));function w(T){!T||T===b.value||l("intent","animation:repeat",/^\d/u.test(T)?Number(T):T)}const S=F(()=>[{value:"",label:"按单击顺序"},...n.objects.filter(T=>T.id!==n.entry.shape).map(T=>({value:String(T.id),label:`单击“${T.name}”时`}))]);function C(T){T==null||T===String(n.entry.trigger??"")||l("intent","animation:trigger",T===""?null:Number(T))}const E={style:"unit",unit:"second",unitDisplay:"short",maximumFractionDigits:2};return(T,z)=>(x(),M("li",{class:"pptx-animation-card","data-selected":e.selected||void 0,role:"option","aria-selected":e.selected,onClick:z[13]||(z[13]=D=>l("select")),onPointerenter:z[14]||(z[14]=D=>s.value=!0),onPointerleave:z[15]||(z[15]=D=>s.value=!1)},[k("div",rz,[k("span",uz,[e.entry.effect?(x(),B(Qv,{key:0,effect:e.entry.effect,shape:e.entry.preset?.shape,direction:e.entry.direction,playing:s.value},null,8,["effect","shape","direction","playing"])):L("v-if",!0)]),k("span",cz,[k("span",dz,[R(N(u.value),1),k("span",{class:"pptx-animation-card-kind","data-kind":e.entry.kind},[o.value.icon?(x(),B(m(me),{key:0,name:o.value.icon},null,8,["name"])):L("v-if",!0),R(N(o.value.label),1)],8,pz)]),k("span",fz,N(e.entry.shapeName),1)]),k("span",{class:"pptx-animation-card-actions",onClick:z[2]||(z[2]=J(()=>{},["stop"]))},[y(Se,{icon:"play",label:"播放这个动画",onClick:z[0]||(z[0]=D=>l("play"))}),y(Se,{icon:"trash",label:"删除这个动画",onClick:z[1]||(z[1]=D=>l("intent","animation:remove"))})])]),k("div",mz,[k("span",{style:fe(p.value)},null,4)]),e.selected?(x(),M("div",{key:0,class:"pptx-animation-card-form",onClick:z[12]||(z[12]=J(()=>{},["stop"]))},[k("div",hz,[z[16]||(z[16]=k("span",null,"效果",-1)),d.value.length>0?(x(),B(m(ce),{key:0,"model-value":e.entry.preset?.id??"",items:d.value,label:"效果",size:"sm",width:"100%","onUpdate:modelValue":z[3]||(z[3]=D=>D&&D!==e.entry.preset?.id&&l("intent","animation:effect",D))},null,8,["model-value","items"])):L("v-if",!0)]),c.value.length>0?(x(),M("div",vz,[z[17]||(z[17]=k("span",null,"方向",-1)),y(m(ce),{"model-value":e.entry.direction??c.value[0]??"",items:c.value.map(D=>({value:D,label:m(az)[D][e.entry.kind==="exit"?1:0]})),label:"方向",size:"sm",width:"100%","onUpdate:modelValue":z[4]||(z[4]=D=>D&&l("intent",`animation:direction:${D}`))},null,8,["model-value","items"])])):L("v-if",!0),k("div",gz,[z[18]||(z[18]=k("span",null,"开始",-1)),y(m(al),{"model-value":e.entry.start,items:a,label:"开始",size:"sm",equal:"","onUpdate:modelValue":z[5]||(z[5]=D=>D&&D!==e.entry.start&&l("intent",`animation:start:${D}`))},null,8,["model-value"])]),k("div",{class:"pptx-animation-field",onPointerup:h,onKeyup:h},[z[19]||(z[19]=k("span",null,"时长",-1)),k("span",bz,[y(m(il),{modelValue:f.value,"onUpdate:modelValue":z[6]||(z[6]=D=>f.value=D),label:"时长","hide-label":"","show-value":!1,min:.25,max:5,step:.25},null,8,["modelValue"]),k("span",yz,N(f.value[0])+" 秒",1)])],32),k("div",xz,[z[20]||(z[20]=k("span",null,"延迟",-1)),y(m(de),{modelValue:v.value,"onUpdate:modelValue":z[7]||(z[7]=D=>v.value=D),label:"延迟",size:"sm",width:"100%",min:0,max:60,step:.25,"format-options":E,onBlur:g,onKeydown:ue(J(g,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),e.entry.text&&e.entry.kind!=="other"?(x(),M("div",wz,[z[21]||(z[21]=k("span",null,"文本",-1)),y(m(ce),{"model-value":e.entry.build==="custom"?"":e.entry.build,items:i,label:"文本",size:"sm",width:"100%","onUpdate:modelValue":z[8]||(z[8]=D=>D&&D!==e.entry.build&&l("intent",`animation:build:${D}`))},null,8,["model-value"])])):L("v-if",!0),k("div",kz,[z[22]||(z[22]=k("span",null,"重复",-1)),y(m(ce),{"model-value":b.value,items:$,label:"重复",size:"sm",width:"100%","onUpdate:modelValue":w},null,8,["model-value"])]),k("div",$z,[z[23]||(z[23]=k("span",null,"触发",-1)),y(m(ce),{"model-value":String(e.entry.trigger??""),items:S.value,label:"触发",size:"sm",width:"100%","onUpdate:modelValue":C},null,8,["model-value","items"])]),k("div",Sz,[y(m(Ce),{label:"播完后快退",checked:e.entry.rewind,"onUpdate:checked":z[9]||(z[9]=D=>l("intent","animation:rewind",D===!0))},null,8,["checked"]),e.entry.trigger===null?(x(),M("span",Cz,[y(m(q),{size:"sm",variant:"text",onClick:z[10]||(z[10]=D=>l("intent","animation:preview-to"))},{default:A(()=>[...z[24]||(z[24]=[R("播放到此",-1)])]),_:1}),y(m(q),{size:"sm",variant:"text",onClick:z[11]||(z[11]=D=>l("intent","animation:preview-from"))},{default:A(()=>[...z[25]||(z[25]=[R("从这里播放",-1)])]),_:1})])):L("v-if",!0)])])):L("v-if",!0)],40,iz))}}),Mz={class:"pptx-effect-gallery"},Pz={class:"pptx-effect-sections"},Tz=["aria-label"],Az={class:"pptx-effect-section-title"},Ez={class:"pptx-effect-grid",role:"list"},Fz=["aria-pressed","onPointerenter","onFocus","onClick"],zz={class:"pptx-effect-name"},Dz={key:0,class:"pptx-animation-hint"},Yv=O({__name:"effect-gallery",props:{current:{},kind:{}},emits:["pick"],setup(e,{emit:t}){const n=e,l=t,s=Du.map(u=>({value:u.kind,label:u.label})),o=V(n.kind??"entrance"),a=V(""),i=V(),r=F(()=>{const u=a.value.trim(),c=yn.filter(d=>d.kind===(n.kind??o.value)&&(u===""||d.label.includes(u)));return Object.keys(hp).map(d=>({group:d,label:hp[d],presets:c.filter(p=>p.group===d)})).filter(d=>d.presets.length>0)});return(u,c)=>(x(),M("div",Mz,[n.kind?L("v-if",!0):(x(),B(m(al),{key:0,modelValue:o.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),items:m(s),label:"动画类别",size:"sm",equal:""},null,8,["modelValue","items"])),y(m(Oe),{modelValue:a.value,"onUpdate:modelValue":c[1]||(c[1]=d=>a.value=d),type:"search",size:"sm",clearable:"",placeholder:"搜索效果","aria-label":"搜索效果"},null,8,["modelValue"]),k("div",Pz,[(x(!0),M(U,null,H(r.value,d=>(x(),M("section",{key:d.group,class:"pptx-effect-section","aria-label":d.label},[k("h4",Az,N(d.label),1),k("div",Ez,[(x(!0),M(U,null,H(d.presets,p=>(x(),M("button",{key:p.id,type:"button",role:"listitem",class:"pptx-effect-tile","aria-pressed":p.id===e.current,onPointerenter:f=>i.value=p.id,onPointerleave:c[2]||(c[2]=f=>i.value=void 0),onFocus:f=>i.value=p.id,onBlur:c[3]||(c[3]=f=>i.value=void 0),onClick:f=>l("pick",p)},[y(Qv,{effect:p.effect,shape:p.shape,playing:i.value===p.id},null,8,["effect","shape","playing"]),k("span",zz,N(p.label),1)],40,Fz))),128))])],8,Tz))),128)),r.value.length===0?(x(),M("p",Dz,"没有名称包含“"+N(a.value.trim())+"”的效果",1)):L("v-if",!0)])]))}}),Lz={class:"pptx-animation-add"},Vz={class:"pptx-animation-kinds"},Iz=["data-kind","disabled","aria-label"],Bz={key:0,class:"pptx-animation-hint"},Oz={class:"pptx-animation-group-head"},Uz={class:"pptx-animation-group-label"},Nz={class:"pptx-animation-cards"},Rz={class:"pptx-animation-group-head"},jz={class:"pptx-animation-group-label"},Kz={class:"pptx-animation-cards"},Wz={key:1,class:"pptx-animation-empty"},qz=O({__name:"object-animations",props:{state:{}},emits:["intent"],setup(e,{emit:t}){const n=e,l=t,s=n.state.motion,o=V(),a=V(),i=V(),r=F(()=>n.state.selected.value.length>0),u=F(()=>{const b=[];let w={begin:0,end:0};for(const S of s.animations.value){const C=b.at(-1),E=C!==void 0&&C.click===S.click,T=E?S.start==="afterPrevious"?w.end:w.begin:0,z=T+(S.delayMs??0);w={begin:T,end:z+(S.durationMs??500)},E?(C.entries.push({entry:S,begin:z}),C.end=Math.max(C.end,w.end)):b.push({click:S.click,entries:[{entry:S,begin:z}],end:w.end})}return b}),c=F(()=>Math.max(1e3,...u.value.map(b=>b.end))),d=F(()=>{const b=new Map;for(const w of s.triggered.value)b.set(w.trigger,[...b.get(w.trigger)??[],w]);return[...b].map(([w,S])=>({shape:w,name:p.value.find(C=>C.id===w)?.name??"对象",entries:S}))}),p=F(()=>{n.state.tick.value;const b=n.state.current.value?.part,w=b?n.state.slide(b):null;return w?ot(w).map(S=>({id:Fe(S),name:dl(S)||"对象"})):[]});function f(b){s.selected.value=b.id,n.state.session.document.select({slide:n.state.current.value?.part??null,shapes:[b.shape]})}function h(b,w,S){f(b),l("intent",w,S)}function v(b){o.value=void 0,l("intent","animation:add",b.id)}function g(b){const w=s.animations.value.find(C=>C.id===a.value),S=s.animations.value.findIndex(C=>C.id===b.id);a.value=void 0,i.value=void 0,!(!w||w.id===b.id)&&(s.selected.value=w.id,l("intent","animation:move",S))}function $(b){const w=s.animations.value,S=w.findIndex(E=>E.id===s.current.value?.id),C=b.key==="ArrowDown"?1:b.key==="ArrowUp"?-1:0;if(b.key==="Delete"||b.key==="Backspace")l("intent","animation:remove");else if(C!==0&&b.altKey&&S>=0)l("intent","animation:move",S+C);else if(C!==0&&w[S+C])f(w[S+C]);else return;b.preventDefault()}return(b,w)=>(x(),M(U,null,[k("div",Lz,[k("div",Vz,[(x(!0),M(U,null,H(m(Du),S=>(x(),B(m(Kb),{key:S.kind,open:o.value===S.kind,placement:"left-start","onUpdate:open":C=>{o.value=C?S.kind:o.value===S.kind?void 0:o.value}},{default:A(()=>[y(m(Wb),{"as-child":""},{default:A(()=>[k("button",{type:"button",class:"pptx-animation-kind","data-kind":S.kind,disabled:!r.value,"aria-label":`添加${S.label}动画`},[y(m(me),{name:S.icon},null,8,["name"]),k("span",null,N(S.label),1)],8,Iz)]),_:2},1024),o.value===S.kind?(x(),B(m(jb),{key:0,width:"auto","show-arrow":!1,"aria-label":`选择${S.label}效果`},{default:A(()=>[y(Yv,{kind:S.kind,onPick:v},null,8,["kind"])]),_:2},1032,["aria-label"])):L("v-if",!0)]),_:2},1032,["open","onUpdate:open"]))),128))]),r.value?L("v-if",!0):(x(),M("p",Bz,"先在幻灯片上选中要动起来的对象"))]),u.value.length>0||d.value.length>0?(x(),M("ol",{key:0,class:"pptx-animation-groups",role:"listbox","aria-label":"本页对象动画",tabindex:"0",onKeydown:$},[(x(!0),M(U,null,H(u.value,S=>(x(),M("li",{key:`${S.click}-${S.entries[0].entry.id}`,class:"pptx-animation-group"},[k("div",Oz,[k("span",Uz,N(S.click===0?"进入页面时":`第 ${S.click} 次单击`),1),y(Se,{icon:"play",label:S.click===0?"播放进入页面时的动画":`播放第 ${S.click} 次单击的动画`,onClick:C=>l("intent","animation:preview-click",S.click)},null,8,["label","onClick"])]),k("ol",Nz,[(x(!0),M(U,null,H(S.entries,({entry:C,begin:E})=>(x(),B(Zv,{key:C.id,entry:C,begin:E,selected:C.id===m(s).current.value?.id,span:c.value,objects:p.value,draggable:"true","data-drop-target":i.value===C.id||void 0,onDragstart:T=>a.value=C.id,onDragend:w[0]||(w[0]=T=>{a.value=void 0,i.value=void 0}),onDragover:J(T=>i.value=C.id,["prevent"]),onDrop:J(T=>g(C),["prevent"]),onSelect:T=>f(C),onPlay:T=>h(C,"animation:preview-one"),onIntent:(T,z)=>h(C,T,z)},null,8,["entry","begin","selected","span","objects","data-drop-target","onDragstart","onDragover","onDrop","onSelect","onPlay","onIntent"]))),128))])]))),128)),(x(!0),M(U,null,H(d.value,S=>(x(),M("li",{key:`trigger-${S.shape}`,class:"pptx-animation-group"},[k("div",Rz,[k("span",jz,"单击“"+N(S.name)+"”时",1)]),k("ol",Kz,[(x(!0),M(U,null,H(S.entries,C=>(x(),B(Zv,{key:C.id,entry:C,begin:0,selected:C.id===m(s).current.value?.id,span:c.value,objects:p.value,onSelect:E=>f(C),onPlay:E=>h(C,"animation:preview-one"),onIntent:(E,T)=>h(C,E,T)},null,8,["entry","selected","span","objects","onSelect","onPlay","onIntent"]))),128))])]))),128))],32)):(x(),M("div",Wz,[...w[1]||(w[1]=[k("p",{class:"pptx-animation-empty-title"},"这一页还没有对象动画",-1),k("p",{class:"pptx-animation-hint"},"选中对象后点“进入”“强调”或“退出”添加效果,拖动卡片可调整顺序。",-1)])]))],64))}}),za=e=>({value:e,label:"",kind:"separator"}),_z={push:[["from:bottom","自底部"],["from:left","自左侧"],["from:right","自右侧"],["from:top","自顶部"]],wipe:[["from:right","自右侧"],["from:left","自左侧"],["from:bottom","自底部"],["from:top","自顶部"]],split:[["split:vert:out","中央向左右展开"],["split:vert:in","左右向中央收缩"],["split:horz:out","中央向上下展开"],["split:horz:in","上下向中央收缩"]],zoom:[["zoom:in","放大"],["zoom:out","缩小"]]};function Gz(e){const t=e?.effect??"none",n=_z[t==="cover"||t==="pull"?"wipe":t];if(n)return{variants:n,chosen:t==="split"?`split:${e?.orientation??"vert"}:${e?.inOut??"out"}`:t==="zoom"?`zoom:${e?.inOut??"in"}`:`from:${e?.from??n[0]?.[0].slice(5)??""}`};if(t==="fade"||t==="cut")return{variants:[["black:0","平滑"],["black:1","全黑"]],chosen:e?.thruBlack?"black:1":"black:0"};if(t==="wheel")return{variants:[1,2,3,4,8].map(o=>[`spokes:${o}`,`${o} 根轮辐`]),chosen:`spokes:${e?.spokes??4}`};const l=bb.find(o=>o.effect===t)?.directions??[],s=o=>t==="flip"||t==="reveal"?o==="l"?"向左":"向右":oz[o]??o;return{variants:l.map(o=>[`dir:${o}`,s(o)]),chosen:`dir:${e?.direction??l[0]??""}`}}function Hz(e,t){const n=e.motion.transition.value?.effect??"none",l=e.current.value===void 0;return[...wt(e),{value:"transition:preview",label:"预览切换",icon:"play",disabled:l||n==="none"},za("effects"),{value:"transition-effect",kind:"menu",trigger:"disclosure",label:"切换效果",icon:"slideTransition",disabled:l,items:ds.map(s=>({value:`transition:effect:${s}`,label:Xv[s],...s===n?{icon:"check"}:{}}))},za("pane"),{value:"panel:animations",label:"动画面板",icon:"panelRight",kind:"toggle",pressed:t}]}function Qz(e,t){const n=e.motion.animations.value;return[...wt(e),{value:"animation:preview",label:"预览本页动画",icon:"play",disabled:n.length===0},za("gallery"),{value:"animation:add",label:"添加动画",icon:"animation",kind:"disclosure",indicator:!0,contentRenderer:"effectGallery",disabled:e.selected.value.length===0,disabledReason:"先选择幻灯片上的对象。",overlayProps:{width:"auto"}},{value:"animation:painter",label:"动画刷",icon:"formatPainter",kind:"toggle",pressed:e.painter.value?.animationsFrom!==void 0,tooltip:"动画刷:复制所选对象的动画,再点选目标;连按两下可连续使用,Esc 结束",disabled:e.painter.value?.animationsFrom===void 0&&!n.some(l=>e.selected.value.length===1&&l.shape===e.selected.value[0]),disabledReason:"先选择一个有动画的对象。"},za("pane"),{value:"panel:animations",label:"动画面板",icon:"panelRight",kind:"toggle",pressed:t}]}const Kl=22050,Jv=30;async function Xz(e){if(String.fromCharCode(...e.subarray(0,4))==="RIFF"&&String.fromCharCode(...e.subarray(8,12))==="WAVE")return e;const t=new OfflineAudioContext(1,Kl*Jv,Kl);let n;try{n=await t.decodeAudioData(e.slice().buffer)}catch{return null}const l=Math.min(Math.ceil(n.duration*Kl),Kl*Jv),s=new OfflineAudioContext(1,l,Kl),o=s.createBufferSource();return o.buffer=n,o.connect(s.destination),o.start(),Zz((await s.startRendering()).getChannelData(0),Kl)}function Zz(e,t){const n=e.length*2,l=new DataView(new ArrayBuffer(44+n)),s=(o,a)=>[...a].forEach((i,r)=>l.setUint8(o+r,i.charCodeAt(0)));return s(0,"RIFF"),l.setUint32(4,36+n,!0),s(8,"WAVE"),s(12,"fmt "),l.setUint32(16,16,!0),l.setUint16(20,1,!0),l.setUint16(22,1,!0),l.setUint32(24,t,!0),l.setUint32(28,t*2,!0),l.setUint16(32,2,!0),l.setUint16(34,16,!0),s(36,"data"),l.setUint32(40,n,!0),e.forEach((o,a)=>l.setInt16(44+a*2,Math.max(-1,Math.min(1,o))*32767,!0)),new Uint8Array(l.buffer)}const Yz={class:"pptx-motion-section","aria-label":"幻灯片切换"},Jz={class:"pptx-transition-list",role:"radiogroup","aria-label":"切换效果"},eD=["aria-checked","disabled","onClick"],tD={key:0,class:"pptx-animation-field"},nD={class:"pptx-animation-duration"},lD={class:"pptx-animation-value"},sD={class:"pptx-animation-field"},oD={class:"pptx-animation-field"},aD={class:"pptx-animation-field"},iD=O({__name:"transition-section",props:{state:{}},emits:["intent"],setup(e,{emit:t}){const n=e,l=t,s=F(()=>n.state.motion.transition.value),o=F(()=>s.value?.effect??"none"),a=F(()=>[...ds.map(w=>({value:w,label:Xv[w]})),...ds.includes(o.value)?[]:[{value:o.value,label:`文件中的效果(${o.value})`,disabled:!0}]]),i=F(()=>Gz(s.value)),r=w=>w===void 0?0:Math.round(w/100)/10,u=V([r(s.value?.durationMs)]);X(()=>s.value?.durationMs,w=>{u.value=[r(w)]});function c(){const w=u.value[0];w!==void 0&&w!==r(s.value?.durationMs)&&l("intent","transition-duration",w)}const d=V("");X(()=>s.value?.advanceAfterMs,w=>{d.value=w===void 0?"":String(r(w))},{immediate:!0});function p(){const w=d.value.trim(),S=w===""?null:Number(w);S!==null&&!(Number.isFinite(S)&&S>=0)||S!==(s.value?.advanceAfterMs===void 0?null:r(s.value.advanceAfterMs))&&l("intent","transition-after",S)}const f=F(()=>{n.state.tick.value;const w=n.state.current.value?.part,S=w?n.state.slide(w):null;return S?wi(S):null}),h=F(()=>[{value:"none",label:"无声音"},{value:"stop",label:"停止前一声音"},...f.value?.kind==="play"?[{value:"play",label:f.value.name||"声音"}]:[],{value:"pick",label:"选择音频…"}]),v=je("soundInput");function g(w){w==="pick"?v.value?.click():(w==="none"||w==="stop")&&l("intent","transition:sound",w==="stop"?{kind:"stop"}:null)}async function $(w){const S=w.target,C=S.files?.[0];if(S.value="",!C)return;const E=await Xz(new Uint8Array(await C.arrayBuffer()));E?l("intent","transition:sound",{kind:"play",data:E,name:C.name.replace(/\.[^.]+$/u,".wav")}):n.state.toaster.create({type:"error",title:"无法读取这个音频文件"})}const b={style:"unit",unit:"second",unitDisplay:"short",maximumFractionDigits:2};return(w,S)=>(x(),M("section",Yz,[L(" A transition belongs to the slide it brings in; there is no separate exit, so the hint says so. "),S[12]||(S[12]=k("p",{class:"pptx-animation-hint"},"设置本页出现的方式,它会替换掉上一页",-1)),L(" Every effect is in view at once, the current one checked, so picking one is a single click. "),k("div",Jz,[(x(!0),M(U,null,H(a.value,C=>(x(),M("button",{key:C.value,type:"button",role:"radio",class:"pptx-transition-item","aria-checked":C.value===o.value,disabled:C.disabled,onClick:E=>C.value!==o.value&&l("intent",`transition:effect:${C.value}`)},[k("span",null,N(C.label),1),C.value===o.value?(x(),B(m(me),{key:0,name:"check"})):L("v-if",!0)],8,eD))),128))]),i.value.variants.length>0?(x(),M("div",tD,[S[6]||(S[6]=k("span",null,"方向",-1)),y(m(ce),{"model-value":i.value.chosen,items:i.value.variants.map(([C,E])=>({value:C,label:E})),label:"切换方向",size:"sm",width:"100%","onUpdate:modelValue":S[0]||(S[0]=C=>C&&l("intent",`transition:variant:${C}`))},null,8,["model-value","items"])])):L("v-if",!0),o.value!=="none"?(x(),M("div",{key:1,class:"pptx-animation-field",onPointerup:c,onKeyup:c},[S[7]||(S[7]=k("span",null,"时长",-1)),k("span",nD,[y(m(il),{modelValue:u.value,"onUpdate:modelValue":S[1]||(S[1]=C=>u.value=C),label:"切换时长","hide-label":"","show-value":!1,min:.25,max:5,step:.25},null,8,["modelValue"]),k("span",lD,N(u.value[0])+" 秒",1)])],32)):L("v-if",!0),k("div",sD,[S[8]||(S[8]=k("span",null,"声音",-1)),y(m(ce),{"model-value":f.value?.kind??"none",items:h.value,label:"切换声音",size:"sm",width:"100%","onUpdate:modelValue":g},null,8,["model-value","items"])]),f.value?.kind==="play"?(x(),B(m(Ce),{key:2,label:"循环播放,到下一声音开始时",checked:f.value.loop,"onUpdate:checked":S[2]||(S[2]=C=>l("intent","transition:sound-loop",C===!0))},null,8,["checked"])):L("v-if",!0),k("input",{ref_key:"soundInput",ref:v,type:"file",accept:"audio/*,.wav,.mp3,.m4a",hidden:"","aria-label":"选择切换声音",onChange:$},null,544),k("div",oD,[S[9]||(S[9]=k("span",null,"换片",-1)),y(m(En),{checked:s.value?.advanceOnClick!==!1,label:"单击时换片","onUpdate:checked":S[3]||(S[3]=C=>l("intent","transition:on-click"))},null,8,["checked"])]),k("div",aD,[S[10]||(S[10]=k("span",null,"自动",-1)),y(m(de),{modelValue:d.value,"onUpdate:modelValue":S[4]||(S[4]=C=>d.value=C),label:"自动换片时间",size:"sm",width:"100%",min:0,max:600,step:1,"format-options":b,placeholder:"不自动换片",onBlur:p,onKeydown:ue(J(p,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"])]),y(m(q),{block:"",variant:"outline",size:"sm",disabled:e.state.slides.value.length<2,onClick:S[5]||(S[5]=C=>l("intent","transition:apply-all"))},{default:A(()=>[...S[11]||(S[11]=[R("应用到全部幻灯片",-1)])]),_:1},8,["disabled"])]))}}),rD={class:"pptx-inspector pptx-animation-pane","aria-label":"动画"},uD={class:"pptx-panel-header pptx-animation-pane-header"},cD={class:"pptx-animation-pane-tools"},dD={class:"pptx-animation-scroll"},pD=O({__name:"pane",props:{state:{}},emits:["intent","close"],setup(e,{emit:t}){const n=e,l=t,s=n.state.motion,o=[{value:"objects",label:"对象动画"},{value:"transition",label:"切页动画"}],a=F(()=>s.pane.value==="objects"?{label:"播放本页对象动画",intent:"animation:preview",disabled:s.animations.value.length===0}:{label:"预览切页动画",intent:"transition:preview",disabled:(s.transition.value?.effect??"none")==="none"});return(i,r)=>(x(),M("aside",rD,[k("div",uD,[y(m(hc),{class:"pptx-animation-pane-tabs",label:"动画类别",size:"sm",items:o,"render-panels":!1,"model-value":m(s).pane.value,"onUpdate:modelValue":r[0]||(r[0]=u=>{m(s).pane.value=u==="transition"?"transition":"objects"})},null,8,["model-value"]),k("span",cD,[y(Se,{icon:"play",label:a.value.label,disabled:a.value.disabled,onClick:r[1]||(r[1]=u=>l("intent",a.value.intent))},null,8,["label","disabled"]),y(Se,{icon:"close",label:"关闭动画面板",onClick:r[2]||(r[2]=u=>l("close"))})])]),k("div",dD,[m(s).pane.value==="objects"?(x(),B(qz,{key:0,state:e.state,onIntent:r[3]||(r[3]=(u,c)=>l("intent",u,c))},null,8,["state"])):(x(),B(iD,{key:1,state:e.state,onIntent:r[4]||(r[4]=(u,c)=>l("intent",u,c))},null,8,["state"]))])]))}}),eg={"rotate-right":{by:90},"rotate-left":{by:-90},"flip-horizontal":{axis:"horizontal"},"flip-vertical":{axis:"vertical"}};function tg(e,t){const{session:n}=e,l=e.current.value?.part,s=e.selected.value,[o,a]=t.split(":"),i=o==="object-align"||o==="object-distribute"||t.startsWith("arrange-")||t==="group"||t==="ungroup"||t in eg;if(!i||!l||s.length===0)return i;if(o==="object-align")n.commands.alignShapes({slide:l,shapes:s,edge:a});else if(o==="object-distribute")n.commands.distributeShapes({slide:l,shapes:s,axis:a});else if(t.startsWith("arrange-"))n.commands.arrangeShapes({slide:l,shapes:s,order:t.slice(8)});else if(t==="group"){if(!n.commands.groupShapes({slide:l,shapes:s}))return!0;const r=Ha(n.document.presentation(),l,s[0])?.at(-1);r&&n.document.select({slide:l,shapes:[Fe(r)]})}else if(t==="ungroup"){const r=e.boxes.value.filter(u=>u.parent!==null&&s.includes(u.parent)).map(u=>u.id);n.commands.ungroupShapes({slide:l,shapes:s})&&n.document.select({slide:l,shapes:r})}else{const r=eg[t];"by"in r?n.commands.rotateShapes({slide:l,shapes:s,by:r.by}):n.commands.flipShapes({slide:l,shapes:s,axis:r.axis})}return!0}const ng=[8,9,10,10.5,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,66,72,80,88,96],fD=new Set(["font-family","font-size","size-increase","size-decrease","bold","italic","underline","strike","superscript","subscript","text-color","highlight"]);function mD(e,t){return t>0?ng.find(n=>n>e)??Math.round(e*1.1):[...ng].reverse().find(n=>n<e)??Math.max(1,Math.round(e*.9))}function lg(e,t,n){switch(e){case"font-family":return typeof t=="string"&&t.length>0?{font:t}:null;case"font-size":return typeof t=="number"?{size:t}:null;case"size-increase":case"size-decrease":return{size:mD(n?.size??18,e==="size-increase"?1:-1)};case"bold":return{bold:!n?.bold};case"italic":return{italic:!n?.italic};case"underline":return{underline:!n?.underline};case"strike":return{strike:!n?.strike};case"superscript":return{baseline:(n?.baseline??0)>0?0:.3};case"subscript":return{baseline:(n?.baseline??0)<0?0:-.25};case"text-color":return t===null||typeof t=="string"?{color:t}:null;case"highlight":return t===null||typeof t=="string"?{highlight:t}:null;default:return null}}function hD(e,t,n){if(!fD.has(t)&&!t.startsWith("align-"))return!1;const l=e.textEditor.value;if(l)return vD(l,t,n),!0;const s=e.current.value?.part,o=e.textSelection.value;if(!s||o.length===0)return!0;if(t.startsWith("align-"))return e.session.commands.setTextAlignment({slide:s,shapes:o,align:t.slice(6)}),!0;const a=lg(t,n,e.format.value);return a&&e.session.commands.setTextFormat({slide:s,shapes:o,format:a}),!0}function vD(e,t,n){if(t.startsWith("align-")){e.align(t.slice(6));return}const l=lg(t,n,e.format());l&&!(t==="text-color"&&n===null)&&e.apply(l)}const gD={none:0,fade:700,cut:100,split:1500,newsflash:2e3,flythrough:1500,doors:1400,window:1400,flash:800,dissolve:1200,wheel:1500},bD=e=>gD[e]??1e3;function yD(e){const t=e.motion.transition.value;return!t||!ds.includes(t.effect)?null:{effect:t.effect,from:t.from,inOut:t.inOut,orientation:t.orientation,direction:t.direction,thruBlack:t.thruBlack,spokes:t.spokes,durationMs:t.durationMs,advanceOnClick:t.advanceOnClick,advanceAfterMs:t.advanceAfterMs}}function At(e,t,n){const l=e.current.value?.part;if(!l)return;const s=e.motion.transition.value,o=yD(e)??{effect:"none",advanceOnClick:s?.advanceOnClick??!0,advanceAfterMs:s?.advanceAfterMs};e.session.commands.setSlideTransition({slides:n??[l],transition:{...o,...t}})}function xD(e,t,n){if(t.startsWith("transition"))wD(e,t,n);else if(t.startsWith("animation"))kD(e,t,n);else return!1;return!0}function wD(e,t,n){const[,l,...s]=t.split(":");if(t==="transition:preview")e.motion.preview.value="transition";else if(l==="effect"){const o=s[0];At(e,{effect:o,durationMs:bD(o),from:void 0,inOut:void 0,orientation:void 0,direction:void 0,thruBlack:void 0,spokes:void 0}),o!=="none"&&(e.motion.preview.value="transition")}else if(l==="variant"){const[o,a,i]=s;o==="from"?At(e,{from:a}):o==="split"?At(e,{orientation:a,inOut:i}):o==="zoom"?At(e,{inOut:a}):o==="dir"?At(e,{direction:a}):o==="black"?At(e,{thruBlack:a==="1"}):o==="spokes"&&At(e,{spokes:Number(a)}),e.motion.preview.value="transition"}else t==="transition-duration"&&typeof n=="number"&&n>0?At(e,{durationMs:n*1e3}):t==="transition-after"?At(e,{advanceAfterMs:typeof n=="number"?n*1e3:void 0}):t==="transition:on-click"?At(e,{advanceOnClick:e.motion.transition.value?.advanceOnClick===!1}):t==="transition:sound"?e.session.commands.setTransitionSound({slides:e.current.value?[e.current.value.part]:[],sound:n??null}):t==="transition:sound-loop"?e.session.commands.setTransitionSoundLoop({slides:e.current.value?[e.current.value.part]:[],loop:n===!0}):t==="transition:apply-all"&&At(e,{},pe(e.session.document.presentation()).map(We))}function kD(e,t,n){const l=e.current.value?.part,{commands:s}=e.session,o=e.motion.current.value,[,a,i]=t.split(":");if(l)if(t==="animation:painter")W6(e);else if(t==="animation:preview")e.motion.preview.value="animations";else if(t==="animation:preview-click"&&typeof n=="number")e.motion.preview.value={click:n};else if(a==="add"&&(i||typeof n=="string")){const r=yn.find(c=>c.id===(i??n)),u=new Set(e.motion.animations.value.map(c=>c.id));r&&s.addShapeAnimation({slide:l,shapes:e.selected.value,animation:{effect:r.effect,...r.shape?{shape:r.shape}:{}}})&&(e.motion.selected.value=e.motion.animations.value.find(c=>!u.has(c.id))?.id,e.motion.preview.value="animations")}else if(o)if(t==="animation:preview-one")e.motion.preview.value="selected";else if(t==="animation:preview-from")e.motion.preview.value={from:o.id};else if(t==="animation:preview-to")e.motion.preview.value={to:o.id};else if(t==="animation:repeat")s.setAnimationTiming({slide:l,id:o.id,repeat:$D(n)});else if(t==="animation:rewind")s.setAnimationTiming({slide:l,id:o.id,rewind:n===!0});else if(t==="animation:trigger")s.setAnimationTiming({slide:l,id:o.id,trigger:typeof n=="number"?n:null});else if(a==="effect"&&typeof n=="string"){const r=yn.find(c=>c.id===n);if(!r)return;const u=Ra(r.effect)[0];s.updateAnimation({slide:l,id:o.id,patch:{effect:r.effect,...u===void 0?{}:{direction:u},...r.shape?{shape:r.shape}:{}}}),e.motion.preview.value="selected"}else if(t==="animation:move"&&typeof n=="number")s.moveAnimation({slide:l,id:o.id,index:n});else if(a==="direction")s.updateAnimation({slide:l,id:o.id,patch:{direction:i}});else if(a==="start")s.updateAnimation({slide:l,id:o.id,patch:{start:i}});else if(a==="build"&&(i==="asOneObject"||i==="allAtOnce"||i==="byParagraph"))s.updateAnimation({slide:l,id:o.id,patch:{build:i}});else if(t==="animation-duration"&&typeof n=="number"&&n>0)s.updateAnimation({slide:l,id:o.id,patch:{durationMs:n*1e3}});else if(t==="animation-delay")s.updateAnimation({slide:l,id:o.id,patch:{delayMs:typeof n=="number"?n*1e3:0}});else if(t==="animation:earlier"||t==="animation:later"){const r=e.motion.animations.value.findIndex(u=>u.id===o.id);s.moveAnimation({slide:l,id:o.id,index:r+(t==="animation:later"?1:-1)})}else t==="animation:remove"&&(s.removeAnimation({slide:l,id:o.id}),e.motion.selected.value=void 0);else return}function $D(e){return typeof e=="number"&&e>1||e==="untilNextClick"||e==="untilEnd"?e:null}function SD(e,t){if(e==="list-none")return{kind:"none"};if(e==="list-toggle-bullet")return t==="bullet"?{kind:"none"}:{kind:"bullet",char:"•"};if(e==="list-toggle-number")return t==="number"?{kind:"none"}:{kind:"number",scheme:"arabicPeriod"};if(e.startsWith("list-bullet:"))return{kind:"bullet",char:e.slice(12)};if(e.startsWith("list-number:"))return{kind:"number",scheme:e.slice(12)}}function CD(e,t){const n=SD(e,t);if(n)return(l,s,o,a)=>{l.setParagraphBullets({slide:s,shapes:o,style:n,...a?{range:a}:{}})};if(e==="indent-increase"||e==="indent-decrease"){const l=e==="indent-increase"?1:-1;return(s,o,a,i)=>{s.changeListLevel({slide:o,shapes:a,offset:l,...i?{range:i}:{}})}}if(e.startsWith("spacing-")){const l=Number(e.slice(8));return(s,o,a,i)=>{s.setLineSpacing({slide:o,shapes:a,multiple:l,...i?{range:i}:{}})}}if(e.startsWith("case:")){const l=e.slice(5);return(s,o,a,i)=>{s.changeTextCase({slide:o,shapes:a,case:l,...i&&i.end>i.start?{range:i}:{}})}}if(e==="clear-format")return(l,s,o,a)=>{l.clearTextFormat({slide:s,shapes:o,...a&&a.end>a.start?{range:a}:{}})};if(e.startsWith("direction-")){const l=e.slice(10);return(s,o,a)=>{s.setTextDirection({slide:o,shapes:a,direction:l})}}if(e.startsWith("anchor-")){const l=e.slice(7);return(s,o,a)=>{s.setTextAnchor({slide:o,shapes:a,anchor:l})}}}function MD(e,t,n){const l=t==="paragraph-format"&&typeof n=="object"&&n!==null?(i,r,u,c)=>{i.setParagraphFormat({slide:r,shapes:u,format:n,...c?{range:c}:{}})}:CD(t,e.format.value?.list);if(!l)return!1;const s=e.current.value?.part;if(!s)return!0;const o=e.session.commands,a=e.editParagraphs.value;return e.textEditor.value&&a?(a((i,r)=>l(o,s,[i],r)),!0):(e.textSelection.value.length>0&&l(o,s,e.textSelection.value),!0)}function PD(e,t){if(!t.startsWith("text:"))return!1;const n=e.textEditor.value;if(!n)return!0;const{view:l}=n;return l.focus(),t==="text:cut"||t==="text:copy"?document.execCommand(t==="text:cut"?"cut":"copy"):t==="text:select-all"?l.dispatch(l.state.tr.setSelection(new k1(l.state.doc))):t==="text:paste-plain"?navigator.clipboard.readText().then(s=>{s&&l.pasteText(s)},()=>{}):t==="text:paste"&&TD(l),!0}async function TD(e){try{for(const t of await navigator.clipboard.read()){if(t.types.includes("text/html")){e.pasteHTML(await(await t.getType("text/html")).text());return}if(t.types.includes("text/plain")){e.pasteText(await(await t.getType("text/plain")).text());return}}}catch{}}function AD(e,t,n){const l=e.current.value?.part,{commands:s}=e.session;if(t.startsWith("insert-chart:")){const o=t.slice(13);return l&&ja.includes(o)&&s.addChart({slide:l,kind:o,...Ie(e,16,9)})&&Le(e,l),!0}if(t==="insert-link"){if(!l||typeof n!="string"&&n!==null)return!0;const o=e.textEditor.value?.view;if(o)return(n===null||/^(https?:|mailto:)/iu.test(n.trim()))&&Kr(o,n===null?null:n.trim()),!0;if(!s.setShapeLink({slide:l,shapes:e.selected.value,url:n})){const a=n!==null&&!/^(https?:|mailto:)/iu.test(n.trim());e.toaster.create({type:"error",title:"无法添加链接",description:a?"链接地址要以 http://、https:// 或 mailto: 开头。":"组合不能直接加链接,请选中组合里的对象。"})}return!0}return t==="text-link"?(e.textEditor.value&&(Sn(e).textLinkOpen.value=!0),!0):t==="insert-symbol"&&typeof n=="string"?(ED(e,n),!0):!1}function ED(e,t){const n=e.textEditor.value;if(n){n.view.dispatch(n.view.state.tr.insertText(t)),requestAnimationFrame(()=>n.view.focus());return}const l=e.current.value?.part;l&&e.session.commands.addTextBox({slide:l,text:t,...Ie(e,3,2)})&&Le(e,l)}async function FD(e,t,n){const l=e.current.value?.part;if(!l)return;const s=new Uint8Array(await t.arrayBuffer()),o=n==="video"?Ie(e,16,9):Ie(e,1.5,1.5);if(e.session.commands.addMedia({slide:l,kind:n,bytes:s,name:t.name,...o})){Le(e,l);return}e.toaster.create({type:"error",title:n==="video"?"无法插入这个视频":"无法插入这个音频",description:n==="video"?"支持 MP4、M4V、MOV、WebM、AVI 与 WMV 视频。":"支持 MP3、WAV、M4A、OGG 与 WMA 音频。"})}function sg(e,t){const n=pe(e.session.document.presentation())[t];n&&e.session.document.select({slide:We(n),shapes:[]})}function Lu(e,t,n){const{session:l}=e,s=e.current.value,o=s?.part;if(MD(e,t,n)||hD(e,t,n)||xD(e,t,n)||tg(e,t)||PD(e,t)||AD(e,t,n))return!0;if(t.startsWith("layout:"))return o&&l.commands.setSlideLayout({slide:o,layout:t.slice(7)}),!0;if((t==="shape-fill"||t==="shape-outline")&&(n===null||typeof n=="string")){const a=e.selected.value;return!o||a.length===0||(t==="shape-fill"?l.commands.setShapeFill({slide:o,shapes:a,color:n}):l.commands.setShapeOutline({slide:o,shapes:a,color:n})),!0}if(t.startsWith("clipboard:")){const a=t.slice(10);return a==="copy"?Sa(e):a==="cut"?Sa(e).then(i=>{i&&Lu(e,"delete-shapes")}):a==="paste"?Ca(e):a==="duplicate"&&Mv(e),!0}if(t.startsWith("draw:")){const a=t.slice(5);return e.armedShape.value=e.armedShape.value===a?void 0:a,!0}if(t==="edit-points"){const a=e.selected.value.length===1?e.selected.value[0]:void 0,i=o&&a!==void 0?le(l.document.presentation(),o,a):null;return i&&Ao(i)&&(e.pointEditing.value=a),!0}switch(t){case"format-painter":return Dv(e),!0;case"shape":return typeof n=="string"&&(e.armedShape.value=n),!0;case"toggle-hidden":return o&&l.commands.setSlideHidden({slide:o,hidden:!s.hidden}),!0;case"undo":return l.undo(),!0;case"redo":return l.redo(),!0;case"add-slide":return l.commands.addSlide(s===void 0?{}:{after:s.index})&&sg(e,(s?.index??-1)+1),!0;case"duplicate-slide":return o&&l.commands.duplicateSlide({slide:o})&&sg(e,s.index+1),!0;case"delete-slide":return o&&e.slides.value.length>1&&l.commands.deleteSlide({slide:o}),!0;case"delete-shapes":{const a=e.selected.value;if(!o||a.length===0)return!0;const i=l.chain();for(const r of a)i.deleteShape({slide:o,shape:r});return i.run(),!0}case"insert-text-box":case"insert-text-box:vertical":{const a=t==="insert-text-box"?"textbox":"textbox:vertical";return e.armedShape.value=e.armedShape.value===a?void 0:a,!0}case"insert-table":{const a=n,i=a?.rowCount??3,r=a?.columnCount??3,u=Array.from({length:i},()=>Array.from({length:r},()=>""));return o&&l.commands.addTable({slide:o,rows:u,...Ie(e,16,Math.min(12,i*1.2))})&&Le(e,o),!0}default:return!1}}async function zD(e,t){const n=e.current.value?.part;if(!n)return;const l=new Uint8Array(await t.arrayBuffer()),s=await DD(t),o=12,a=s?o*s.height/s.width:8;e.session.commands.addPicture({slide:n,bytes:l,name:t.name,...Ie(e,o,a)})&&Le(e,n)}async function DD(e){try{const t=await createImageBitmap(e),n={width:t.width,height:t.height};return t.close(),n.width>0&&n.height>0?n:void 0}catch{return}}const LD={key:0,class:"pptx-notes"},VD=O({__name:"notes",props:{state:{}},setup(e){const t=e,n=V(t.state.notes.value);X(()=>[t.state.current.value?.part,t.state.notes.value],([,s])=>{n.value=s});function l(){const s=t.state.current.value?.part;s&&n.value!==t.state.notes.value&&t.state.session.commands.setSlideNotes({slide:s,notes:n.value})}return(s,o)=>e.state.current.value?(x(),M("div",LD,[y(m(Ct),{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=a=>n.value=a),variant:"embedded",width:"100%",rows:1,"auto-resize":"","max-rows":8,placeholder:"单击此处添加演讲者备注","aria-label":"演讲者备注",onBlur:l},null,8,["modelValue"])])):L("v-if",!0)}}),ID=["aria-label"],BD=O({__name:"panel-host",props:{panel:{},session:{},open:{type:Boolean},render:{type:Function},picture:{type:Function},layout:{},register:{type:Function}},emits:["close","layout"],setup(e,{emit:t}){const n=e,l=t,s=je("host");let o;return X(()=>n.open&&s.value!==null,a=>{if(!a||o||!s.value)return;o=n.panel.mount({session:n.session,ownerDocument:s.value.ownerDocument,renderSlide:r=>n.render(r),pictureSlide:(r,u)=>n.picture(r,u),close:()=>l("close"),setLayout:r=>l("layout",r)}),s.value.append(o.element);const i=o;i.ask&&n.register?.(n.panel.id,(r,u)=>i.ask(r,u)),n.layout!=="side"&&o.layout?.(n.layout)},{immediate:!0,flush:"post"}),X(()=>n.layout,a=>o?.layout?.(a)),Re(()=>{o?.destroy(),o=void 0}),(a,i)=>ht((x(),M("aside",{ref_key:"host",ref:s,class:"pptx-side-panel","aria-label":e.panel.label},null,8,ID)),[[mt,e.open]])}}),OD={class:"pptx-side-rail","aria-label":"侧边栏"},UD=O({__name:"side-rail",props:{active:{},panels:{},featurePanels:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,l=t,s=F(()=>[{value:"properties",label:"属性",icon:"slidersHorizontal",kind:"toggle",pressed:n.active==="properties"},{value:"animations",label:"切换与动画",icon:"animation",kind:"toggle",pressed:n.active==="animations"},...n.featurePanels.map(a=>({value:a.id,label:a.label,icon:a.icon,kind:"toggle",pressed:n.active===a.id})),...n.panels.map(a=>({value:a.id,label:a.label,icon:a.icon??(a.id==="quirekit.ai"?"messageCircle":"panelRight"),kind:"toggle",pressed:n.active===a.id}))]);function o(a){l("toggle",a.value)}return(a,i)=>(x(),M("nav",OD,[y(m(Nt),{label:"侧边栏",orientation:"vertical","preserve-focus":"",items:s.value,onExecute:o},null,8,["items"])]))}}),ND=["data-collapsed","data-layout"],RD={key:0,class:"pptx-split-main"},jD={key:1,class:"pptx-split-side"},KD=272;var WD=Bs(O({__name:"side-split",props:{panel:{},layout:{default:"side"}},setup(e){const t=e,n={id:"main",label:"编辑区",minSize:"360px"},l={id:"side",label:"侧边面板",minSize:"240px",maxSize:"720px",collapsible:!0,collapsedSize:0,resizeBehavior:"preserve-pixel-size"},s=Object.freeze({side:Object.freeze([n,l]),wide:Object.freeze([n,{...l,minSize:"480px",maxSize:"1400px"}]),page:Object.freeze([{...l,label:"对话",minSize:"420px",maxSize:"100%"},{...n,label:"幻灯片预览",minSize:"280px"}])}),o=F(()=>s[t.layout]),a=F(()=>t.layout==="page"?0:1),i=je("frame"),r=V(),u=new Map;let c=!1;function d(g){const $=i.value?.clientWidth||1,b=Math.min(100,g/$*100);return a.value===0?[b,100-b]:[100-b,b]}function p(g){const $=i.value?.clientWidth||0,b=u.get(`${t.layout}:${g}`);return b!==void 0?b:t.layout==="wide"?Math.max(560,Math.round($*.5)):t.layout==="page"?Math.max(420,Math.round($*.6)):KD}async function f(g=!1){await pt();const $=r.value;$&&(t.panel===void 0?$.collapsePanel("side"):(g&&c&&($.getSizes()[a.value]??0)===0&&$.collapsePanel("side"),$.setSizes(d(p(t.panel))),c=!0))}function h(g){if(t.panel===void 0)return;const $=i.value?.clientWidth||0,b=g.sizes[a.value]??0;$>0&&b>0&&u.set(`${t.layout}:${t.panel}`,Math.round(b/100*$))}X(()=>[t.panel,t.layout],()=>f());let v;return ft(()=>{if(f(),i.value&&typeof ResizeObserver<"u"){let g;v=new ResizeObserver($=>{const b=$[0]?.contentRect.width;g!==void 0&&b!==g&&t.panel!==void 0&&f(!0),g=b}),v.observe(i.value)}}),Re(()=>v?.disconnect()),(g,$)=>(x(),M("div",{ref_key:"frame",ref:i,class:"pptx-split","data-collapsed":e.panel===void 0||void 0,"data-layout":e.layout},[y(m(_b),{ref_key:"splitter",ref:r,label:"编辑区与侧边面板",panels:o.value,"default-size":[100,0],disabled:e.panel===void 0,bordered:!1,"handle-variant":"hover-line",onResizeEnd:h},{panel:A(({panel:b})=>[b.id==="main"?(x(),M("div",RD,[cc(g.$slots,"main",{},void 0,!0)])):(x(),M("div",jD,[cc(g.$slots,"side",{},void 0,!0)]))]),_:3},8,["panels","disabled"])],8,ND))}}),[["__scopeId","data-v-4ae8f244"]]);const og=O({__name:"effect-gallery-renderer",props:{scope:{}},setup(e){const t=e;function n(l){t.scope.execute(l.id),t.scope.setExpanded(!1)}return(l,s)=>e.scope.expanded?(x(),B(Yv,{key:0,onPick:n,onKeydown:s[0]||(s[0]=ue(J(o=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))})):L("v-if",!0)}}),ag=new WeakMap,qD="pptx-popup";function ln(e){return e.map(t=>_D(t))}function _D(e){const t=ag.get(e);if(t)return t;const n=e;let l=e;return n.contentRenderer&&n.contentPadding===void 0&&(l=GD(l)),n.children&&(l={...l,children:ln(n.children)}),n.kind==="group"&&n.items&&(l={...l,items:ln(n.items)}),ag.set(e,l),l}function GD(e){const t=e.overlayProps,n=t?.contentAttributes??{},l=[n.class,qD].filter(Boolean).join(" ");return{...e,contentPadding:"none",overlayProps:{...t,contentAttributes:{...n,class:l}}}}const ig=O({__name:"color-button",props:{scope:{}},setup(e){const t=e,n={"text-color":{key:"color",first:"#C0392B",disclosure:"选择字体颜色",reset:"主题颜色"},highlight:{key:"highlight",first:"#FFF59D",disclosure:"选择突出显示颜色",reset:"无颜色"},"shape-fill":{key:"fill",first:"#4472C4",disclosure:"选择填充颜色",reset:"无填充"},"shape-outline":{key:"outline",first:"#2F528F",disclosure:"选择轮廓颜色",reset:"无轮廓"}},l=F(()=>n[t.scope.item.value]??n["text-color"]),s=V(l.value.first),o=F(()=>t.scope.context?.[l.value.key]??null),a=V(),i=V([]);X(()=>t.scope.expanded,()=>{a.value=void 0});const r=F(()=>({...t.scope,item:{...t.scope.item,iconAccentColor:s.value}}));function u(c){c!==null&&!/^#[\da-f]{6}$/iu.test(c)||(t.scope.setExpanded(!1),t.scope.execute(c),c!==null&&(s.value=c,i.value=[c,...i.value.filter(d=>d!==c)].slice(0,8)))}return(c,d)=>(x(),B(m(Po),{scope:r.value,"disclosure-label":l.value.disclosure,color:a.value??o.value??s.value,"reset-active":!o.value,"recent-colors":i.value,"picker-props":{resetLabel:l.value.reset,showMore:!0},onAction:d[0]||(d[0]=p=>u(s.value)),onPreview:d[1]||(d[1]=p=>a.value=p),onCommit:u,onReset:d[2]||(d[2]=p=>u(null))},null,8,["scope","disclosure-label","color","reset-active","recent-colors","picker-props"]))}}),HD=O({__name:"font-family",props:{scope:{}},setup(e){const t=e,n=Cv,l=F(()=>t.scope.context?.font??null),s=F(()=>{const a=n.map(([i,r])=>({value:i,label:i,group:`${r}字体`}));return l.value&&!n.some(([i])=>i===l.value)?[{value:l.value,label:l.value,group:"文档字体"},...a]:a});function o(a){typeof a!="string"||a.length===0||(t.scope.setExpanded(!1),t.scope.execute(a))}return(a,i)=>(x(),B(m(Ad),{scope:e.scope,kind:"family",label:"字体",value:l.value??"",options:s.value,placeholder:l.value??"主题字体","allow-custom-value":"",onSelect:o},null,8,["scope","value","options","placeholder"]))}}),rg=O({__name:"font-size",props:{scope:{}},setup(e){const t=e,n=F(()=>{const o=D1("zh-CN",t.scope.context?.size??null);return o===null?null:String(o)}),l=z1("zh-CN").map(o=>({...o,value:String(o.value)}));function s(o){const a=o===void 0?null:L1(o);a!==null&&(t.scope.setExpanded(!1),t.scope.execute(a))}return(o,a)=>(x(),B(m(Ad),{scope:e.scope,kind:"size",label:"字号",value:n.value,options:m(l),placeholder:"字号","allow-custom-value":"",onSelect:s},null,8,["scope","value","options"]))}});var QD=Bs(O({__name:"shape-gallery",props:{scope:{}},setup(e){const t=e;function n(l){t.scope.execute(l),t.scope.setExpanded(!1)}return(l,s)=>e.scope.expanded?(x(),B(m(Ed),{key:0,class:"pptx-shape-gallery",label:"插入形状",onSelect:n,onKeydown:s[0]||(s[0]=ue(J(o=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))})):L("v-if",!0)}}),[["__scopeId","data-v-347f84f3"]]);const XD={class:"pptx-link-form-actions"},ZD=O({__name:"link-form",props:{scope:{}},setup(e){const t=e,n=F(()=>t.scope.context?.link??null),l=V("");X(()=>t.scope.expanded,o=>{o&&(l.value=n.value??"")},{immediate:!0});function s(o){t.scope.execute(o),t.scope.setExpanded(!1)}return(o,a)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-link-form",onKeydown:a[4]||(a[4]=ue(J(i=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[a[7]||(a[7]=k("label",{class:"pptx-link-form-label",for:"pptx-link-address"},"链接地址",-1)),y(m(Oe),{id:"pptx-link-address",modelValue:l.value,"onUpdate:modelValue":a[0]||(a[0]=i=>l.value=i),size:"sm",width:"100%",type:"url",clearable:"",placeholder:"https://example.com",onKeydown:a[1]||(a[1]=ue(J(i=>l.value.trim()&&s(l.value.trim()),["stop","prevent"]),["enter"]))},null,8,["modelValue"]),k("div",XD,[n.value?(x(),B(m(q),{key:0,size:"sm",variant:"ghost",onClick:a[2]||(a[2]=i=>s(null))},{default:A(()=>[...a[5]||(a[5]=[R("移除链接",-1)])]),_:1})):L("v-if",!0),y(m(q),{size:"sm",variant:"solid",disabled:!l.value.trim(),onClick:a[3]||(a[3]=i=>s(l.value.trim()))},{default:A(()=>[...a[6]||(a[6]=[R("应用",-1)])]),_:1},8,["disabled"])])],32)):L("v-if",!0)}}),YD=["aria-label"],JD={class:"pptx-symbol-group"},eL={class:"pptx-symbol-row"},tL=["aria-label","onClick"],nL=O({__name:"symbol-grid",props:{scope:{}},setup(e){const t=e,n=[{label:"数学",symbols:[..."+−×÷≠≈<>≤≥≦≧≡±%‰‱½⅓⅔¼¾¹²³ⁿ₁₂₃∟∠⊿△∥⊥∫∬∭∮∯∰∝∞∽≌∈∉⊆⊂∅∩∪∧∨·∶∵∴∷∏∑∃∄∀∂∆⊙⊕√∛"]},{label:"希腊字母",symbols:[..."αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"]},{label:"序号",symbols:[..."①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ"]},{label:"箭头",symbols:[..."→←↑↓↔↕⇒⇐⇔↗↘↖↙➜⟶⟵"]},{label:"单位与符号",symbols:[..."℃℉°㎏㎎㎜㎝㎞㎡㎥№§※©®™€£¥$¢@&#*|"]},{label:"标记",symbols:[..."✓✔✗✘★☆●○◎■□▲△▼▽◆◇♦♥♠♣"]},{label:"标点",symbols:[..."…—·「」『』【】《》〈〉〖〗{}〔〕"]}];function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),M("div",{key:0,class:"pptx-symbol-grid",onKeydown:o[0]||(o[0]=ue(J(a=>e.scope.setExpanded(!1),["stop","prevent"]),["esc"]))},[(x(),M(U,null,H(n,a=>k("section",{key:a.label,"aria-label":a.label},[k("h4",JD,N(a.label),1),k("div",eL,[(x(!0),M(U,null,H(a.symbols,i=>(x(),M("button",{key:i,type:"button",class:"pptx-symbol","aria-label":`插入 ${i}`,onClick:r=>l(i)},N(i),9,tL))),128))])],8,YD)),64))],32)):L("v-if",!0)}}),lL=O({__name:"table-picker",props:{scope:{}},setup(e){const t=e,n={title:"插入表格",custom:"自定义行列…",rows:"行数",columns:"列数",back:"返回快速网格",submit:"插入",size:s=>`${s.rowCount} 行 × ${s.columnCount} 列`};function l(s){t.scope.execute(s),t.scope.setExpanded(!1)}return(s,o)=>e.scope.expanded?(x(),B(m(Gb),{key:0,labels:n,"initial-size":{rowCount:3,columnCount:3},"max-dimension":30,disabled:e.scope.disabled,onSelect:l,onCancel:o[0]||(o[0]=a=>e.scope.setExpanded(!1))},null,8,["disabled"])):L("v-if",!0)}}),ug=8;function Vu(e,t,n=0){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||n>=ug)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(!Vu(e[s],t[s],n+1))return!1;return!0}if(Array.isArray(t)||Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype)return!1;const l=Object.keys(e);if(l.length!==Object.keys(t).length)return!1;for(const s of l)if(!Object.hasOwn(t,s)||!Vu(e[s],t[s],n+1))return!1;return!0}function nl(e,t,n=0){if(e===void 0||Object.is(e,t))return t;if(Vu(e,t,n))return e;if(n>=ug||typeof t!="object"||t===null||typeof e!="object"||e===null)return t;if(Array.isArray(t))return Array.isArray(e)?t.map((s,o)=>nl(e[o],s,n+1)):t;if(Array.isArray(e)||Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(e)!==Object.prototype)return t;const l=e;return Object.fromEntries(Object.entries(t).map(([s,o])=>[s,nl(l[s],o,n+1)]))}function cg(e){return F(t=>nl(t,e()))}const sL={class:"pptx-command-bar"},oL={id:"pptx-tools-home",role:"tabpanel","aria-label":"开始"},aL={id:"pptx-tools-insert",role:"tabpanel","aria-label":"插入"},iL={id:"pptx-tools-transition",role:"tabpanel","aria-label":"切换"},rL={id:"pptx-tools-animation",role:"tabpanel","aria-label":"动画"},uL={id:"pptx-tools-show",role:"tabpanel","aria-label":"放映"},cL=["id","aria-label"],dL=O({__name:"ribbon",props:{state:{},tab:{},openPanel:{}},emits:["intent"],setup(e,{emit:t}){const n=e,l=t,s={fontFamily:HD,fontSize:rg,color:ig,shapeGallery:QD,effectGallery:og,linkForm:ZD,symbolGrid:nL,tablePicker:lL,...Object.assign({},...nn.map(v=>v.renderers??{}))},o=F(v=>{n.state.tick.value;const g=Gv(n.state).find(w=>w.value===n.tab);if(!g)return;const $=ln(g.entries(n.state)),b=g.context?.(n.state);return v?.value!==g.value?{value:g.value,label:g.label,items:$,context:b}:nl(v,{value:g.value,label:g.label,items:$,context:b})});function a(v,g){return F($=>n.tab!==v&&$!==void 0?$:nl($,g()))}const i=a("home",()=>ln(ES(n.state))),r=a("home",()=>n.state.format.value),u=a("insert",()=>ln(kS(n.state))),c=a("insert",()=>{n.state.tick.value;const v=n.state.current.value?.part,g=n.state.selected.value[0],$=v&&g!==void 0?le(n.state.session.document.presentation(),v,g):null,b=$?mi($):null;return{link:b?.kind==="url"?b.url:null}}),d=a("show",()=>ln(sM(n.state))),p=a("transition",()=>ln(Hz(n.state,n.openPanel==="animations"))),f=a("animation",()=>ln(Qz(n.state,n.openPanel==="animations")));function h(v){l("intent",v.value,v.payload)}return(v,g)=>(x(),M("div",sL,[ht(k("div",oL,[y(m(Nt),{label:"开始工具栏",class:"w-full",variant:"elevated","preserve-focus":"",items:m(i),renderers:s,context:m(r),onExecute:h},null,8,["items","context"])],512),[[mt,e.tab==="home"]]),ht(k("div",aL,[y(m(Nt),{label:"插入工具栏",class:"w-full",variant:"elevated","preserve-focus":"",items:m(u),renderers:s,context:m(c),onExecute:h},null,8,["items","context"])],512),[[mt,e.tab==="insert"]]),ht(k("div",iL,[y(m(Nt),{label:"切换工具栏",class:"w-full",variant:"elevated","preserve-focus":"",items:m(p),renderers:s,onExecute:h},null,8,["items"])],512),[[mt,e.tab==="transition"]]),ht(k("div",rL,[y(m(Nt),{label:"动画工具栏",class:"w-full",variant:"elevated","preserve-focus":"",items:m(f),renderers:s,onExecute:h},null,8,["items"])],512),[[mt,e.tab==="animation"]]),ht(k("div",uL,[y(m(Nt),{label:"放映工具栏",class:"w-full",variant:"elevated","preserve-focus":"",items:m(d),renderers:s,onExecute:h},null,8,["items"])],512),[[mt,e.tab==="show"]]),o.value?(x(),M("div",{id:`pptx-tools-${o.value.value}`,key:o.value.value,role:"tabpanel","aria-label":o.value.label},[y(m(Nt),{label:`${o.value.label}工具栏`,class:"w-full",variant:"elevated","preserve-focus":"",items:o.value.items,renderers:s,context:o.value.context,onExecute:h},null,8,["label","items","context"])],8,cL)):L("v-if",!0)]))}}),pL=["aria-expanded","aria-label"],fL=["title"],mL={key:2,class:"pptx-section-count"},hL=O({__name:"section-head",props:{section:{},collapsed:{type:Boolean},renaming:{type:Boolean}},emits:["toggle","menu","edit","rename"],setup(e,{emit:t}){const n=e,l=t,s=V(""),o=je("root");X(()=>n.renaming,i=>{i&&(s.value=n.section.name,pt(()=>o.value?.querySelector("input")?.select()))},{immediate:!0});function a(i){n.renaming&&l("rename",i&&s.value.trim()?s.value.trim():null)}return(i,r)=>(x(),M("li",{ref_key:"root",ref:o,class:"pptx-section-head",onContextmenu:r[6]||(r[6]=J(u=>l("menu",u.clientX,u.clientY),["prevent"]))},[k("button",{type:"button",class:"pptx-section-toggle","aria-expanded":!e.collapsed,"aria-label":`${e.collapsed?"展开":"折叠"}节:${e.section.name}`,onClick:r[0]||(r[0]=u=>l("toggle"))},[y(m(me),{name:e.collapsed?"chevronRight":"chevronDown"},null,8,["name"])],8,pL),e.renaming?(x(),B(m(Oe),{key:0,modelValue:s.value,"onUpdate:modelValue":r[1]||(r[1]=u=>s.value=u),size:"sm","aria-label":"节名称",class:"pptx-section-input",onKeydown:[r[2]||(r[2]=ue(J(u=>a(!0),["prevent"]),["enter"])),r[3]||(r[3]=ue(J(u=>a(!1),["stop","prevent"]),["esc"]))],onBlur:r[4]||(r[4]=u=>a(!0))},null,8,["modelValue"])):(x(),M("span",{key:1,class:"pptx-section-name",title:e.section.name,onDblclick:r[5]||(r[5]=u=>l("edit"))},N(e.section.name),41,fL)),e.renaming?L("v-if",!0):(x(),M("span",mL,N(e.section.count),1))],544))}}),vL={class:"pptx-slides","aria-label":"幻灯片"},gL={class:"pptx-panel-header"},bL=["onDragover"],yL={class:"pptx-slide-number","aria-hidden":"true"},xL=["aria-selected","aria-label","tabindex","data-slide-index","data-part","onDragstart","onClick","onContextmenu"],wL=["innerHTML"],kL={class:"pptx-slide-add"},$L=O({__name:"panel",props:{state:{}},emits:["add","remove","menu","collapse"],setup(e,{emit:t}){const n=e,l=t,s=je("list"),o=Q(new Set);let a;const i=new WeakSet;function r(T){!(T instanceof Element)||i.has(T)||(a??=new IntersectionObserver(z=>{const D=z.filter(P=>P.isIntersecting).map(P=>P.target.dataset.part??"").filter(P=>!o.value.has(P));D.length>0&&(o.value=new Set([...o.value,...D]))},{root:s.value,rootMargin:"600px 0px"}),i.add(T),a.observe(T))}Re(()=>a?.disconnect());const u=cg(()=>{n.state.settled.value;const T=n.state.current.value?.part;return n.state.slides.value.map(z=>({...z,svg:o.value.has(z.part)||z.part===T?n.state.render(z.part):""}))}),c=St(n.state),d=cg(()=>{n.state.settled.value;const T=it(n.state.session.document.presentation()),z=u.value;return T.length===0?[{key:"all",index:-1,section:void 0,slides:z}]:T.map((D,P)=>({key:`${P}:${D.name}`,index:P,section:D,slides:c.collapsed.value.has(P)?[]:z.slice(D.start,D.start+D.count)}))});function p(T){const z=new Set(c.collapsed.value);z.delete(T)||z.add(T),c.collapsed.value=z}function f(T,z){c.renaming.value=void 0,z!==null&&n.state.session.commands.renameSection({index:T,name:z})}function h(T,z,D){const P=it(n.state.session.document.presentation())[T],I=P&&P.count>0?n.state.slides.value[P.start]:void 0;I&&C(I.part),l("menu",{target:"section",section:T,x:z,y:D})}const v=F(()=>`${n.state.size.value.width} / ${n.state.size.value.height}`),g=V(),$=V();function b(T,z){g.value=z,T.dataTransfer?.setData("text/plain",z),T.dataTransfer&&(T.dataTransfer.effectAllowed="move")}function w(T,z){if(g.value===void 0)return;T.preventDefault();const D=T.currentTarget.getBoundingClientRect();$.value=T.clientY<D.top+D.height/2?z:z+1}function S(){const T=g.value,z=$.value;if(g.value=void 0,$.value=void 0,T===void 0||z===void 0)return;const D=n.state.slides.value.findIndex(I=>I.part===T),P=z>D?z-1:z;D>=0&&P!==D&&n.state.session.commands.moveSlide({slide:T,to:P})}function C(T){n.state.session.document.select({slide:T,shapes:[]})}function E(T){const z=n.state.slides.value,D=n.state.current.value?.index??0;let P=D;if(T.key==="ArrowDown"||T.key==="ArrowRight")P=Math.min(z.length-1,D+1);else if(T.key==="ArrowUp"||T.key==="ArrowLeft")P=Math.max(0,D-1);else if(T.key==="Home")P=0;else if(T.key==="End")P=z.length-1;else if(T.key==="Delete"||T.key==="Backspace"){T.preventDefault(),l("remove");return}else return;T.preventDefault();const I=z[P];I&&(C(I.part),pt(()=>s.value?.querySelector(`[data-slide-index="${P}"]`)?.focus({preventScroll:!1})))}return(T,z)=>(x(),M("aside",vL,[k("div",gL,[z[3]||(z[3]=k("span",{class:"qk-type-label"},"幻灯片",-1)),y(Se,{icon:"panelLeftClose",label:"收起幻灯片列表",onClick:z[0]||(z[0]=D=>l("collapse"))})]),k("ol",{ref_key:"list",ref:s,class:"pptx-slide-list",role:"listbox","aria-label":"幻灯片列表",onKeydown:E},[(x(!0),M(U,null,H(m(d),D=>(x(),M(U,{key:D.key},[D.section?(x(),B(hL,{key:0,section:D.section,collapsed:m(c).collapsed.value.has(D.index),renaming:m(c).renaming.value===D.index,onToggle:P=>p(D.index),onEdit:P=>m(c).renaming.value=D.index,onRename:P=>f(D.index,P),onMenu:(P,I)=>h(D.index,P,I)},null,8,["section","collapsed","renaming","onToggle","onEdit","onRename","onMenu"])):L("v-if",!0),(x(!0),M(U,null,H(D.slides,P=>(x(),M("li",{key:P.part,class:Ne(["pptx-slide-item",{"drop-before":$.value===P.index,"drop-after":$.value===P.index+1&&P.index===m(u).length-1}]),onDragover:I=>w(I,P.index),onDrop:J(S,["prevent"])},[k("span",yL,N(P.index+1),1),k("button",{type:"button",role:"option",class:Ne(["pptx-slide-thumb",{"is-current":e.state.current.value?.part===P.part,"is-hidden":P.hidden}]),"aria-selected":e.state.current.value?.part===P.part,"aria-label":`第 ${P.index+1} 张${P.title?`:${P.title}`:""}${P.hidden?"(已隐藏)":""}`,tabindex:e.state.current.value?.part===P.part?0:-1,ref_for:!0,ref:r,"data-slide-index":P.index,"data-part":P.part,style:fe({aspectRatio:v.value}),draggable:"true",onDragstart:I=>b(I,P.part),onDragend:z[1]||(z[1]=I=>{g.value=void 0,$.value=void 0}),onClick:I=>C(P.part),onContextmenu:J(I=>{C(P.part),l("menu",{target:"slide",x:I.clientX,y:I.clientY})},["prevent"])},[k("span",{class:"pptx-slide-art",innerHTML:P.svg},null,8,wL),P.hidden?(x(),B(m(me),{key:0,class:"pptx-slide-hidden",name:"eyeOff"})):L("v-if",!0)],46,xL)],42,bL))),128))],64))),128))],544),k("div",kL,[y(m(q),{block:"",variant:"ghost",size:"sm","aria-label":"新建幻灯片",title:"新建幻灯片",onClick:z[2]||(z[2]=D=>l("add"))},{default:A(()=>[y(m(me),{name:"plus",size:16})]),_:1})])]))}}),dg="quirekit.pptx-editor.slides-visible";function SL(){try{return localStorage.getItem(dg)!=="false"}catch{return!0}}function CL(e){try{localStorage.setItem(dg,String(e))}catch{}}const Qe=e=>({value:e,label:"",kind:"separator"});function ML(e){const t=e.session.document.presentation(),n=e.current.value?e.slide(e.current.value.part):null,l=n?Pt(n):null,s=l?Lt(l):null,o=[...new Set(io(t).map(Lt))];return{value:"layout",label:"版式",kind:"submenu",icon:"layoutDashboard",disabled:o.length===0,children:o.map(a=>({value:`layout:${a}`,label:a,checked:a===s}))}}function pg(){return[{value:"clipboard:paste",label:"粘贴",icon:"clipboardPaste",shortcut:qe(!1,"V")},{value:"paste-options",label:"粘贴选项",kind:"submenu",children:[{value:"clipboard:paste-source",label:"保留源格式"},{value:"clipboard:paste-text",label:"只粘贴文本"},{value:"paste-special",label:"选择性粘贴…"}]}]}function fg(e){return[ML(e),{value:"reset-slide",label:"重置幻灯片",icon:"refreshCcw"},{value:"show-panel:properties",label:"设置背景格式",icon:"fillColor"},{value:"show-panel:animations",label:"切换与动画",icon:"slideTransition"},Qe("slide-review"),{value:"comment:new",label:"新建批注",icon:"messageSquare"}]}function PL(e){const t=e.boxes.value.filter(i=>e.selected.value.includes(i.id)),n=t.length===1?t[0]:void 0,l=n?.kind==="text"&&n.placeholder===null,s=t.length>=2&&t.every(i=>i.placeholder===null&&i.parent===t[0].parent),o=t.some(i=>i.kind==="group"),a=[["left","左对齐"],["center","水平居中"],["right","右对齐"],["top","顶端对齐"],["middle","垂直居中"],["bottom","底端对齐"]];return[{value:"clipboard:cut",label:"剪切",icon:"scissors",shortcut:qe(!1,"X")},{value:"clipboard:copy",label:"复制",icon:"clipboardCopy",shortcut:qe(!1,"C")},...pg(),{value:"clipboard:duplicate",label:"再制",icon:"copy",shortcut:qe(!1,"D")},...e.assistant.value?[Qe("object-assist"),{value:"assist:edit-shapes",label:"让 AI 改选中的内容…"}]:[],Qe("object-edit"),...n?.kind==="text"?[{value:"edit-text",label:"编辑文字",icon:"textCursor"},{value:"paragraph:dialog",label:"段落…",icon:"paragraphSettings"},EL()]:[],...l?[{value:"edit-points",label:"编辑顶点",icon:"editPoints"},{value:"shape:set-default",label:"设置为默认形状"}]:[],...n?.kind==="picture"?TL():[],{value:"group",label:"组合",icon:"group",shortcut:qe(!1,"G"),disabled:!s},{value:"ungroup",label:"取消组合",icon:"ungroup",shortcut:qe(!0,"G"),disabled:!o},{value:"order",label:"层级",kind:"submenu",icon:"layers",children:[{value:"arrange-front",label:"置于顶层",icon:"bringToFront"},{value:"arrange-forward",label:"上移一层",icon:"arrowUp"},{value:"arrange-backward",label:"下移一层",icon:"arrowDown"},{value:"arrange-back",label:"置于底层",icon:"sendToBack"}]},{value:"align",label:"对齐",kind:"submenu",icon:"alignStartVertical",children:a.map(([i,r])=>({value:`object-align:${i}`,label:r}))},...n?.kind==="table"?DL():[],...n?.kind==="chart"?AL():[],...n&&FL(e,n.id)?[Qe("smartart"),{value:"smartart-convert",label:"转换为形状",icon:"shapes"}]:[],...n&&zL(e,n.id)?[Qe("zoom"),{value:"zoom-go",label:"转到目标幻灯片",icon:"arrowUpRight"}]:[],Qe("object-link"),{value:"action-settings:url",label:"超链接",icon:"link",disabled:o},{value:"action-settings",label:"动作设置",icon:"mousePointer2",disabled:o},Qe("object-format"),{value:"show-panel:properties",label:"设置对象格式",icon:"slidersHorizontal"},{value:"show-panel:animations",label:"添加动画",icon:"animation"},{value:"comment:new",label:"新建批注",icon:"messageSquare"},{value:"panel:selection",label:"选择窗格",icon:"listTree"},{value:"picture:save-image",label:"另存为图片…",icon:"imageDown"},Qe("object-delete"),{value:"delete-shapes",label:"删除",icon:"trash",shortcut:rS}]}function TL(){return[Qe("picture"),{value:"picture:replace",label:"更改图片…",icon:"replaceImage"},{value:"picture:crop",label:"裁剪",icon:"crop"},{value:"picture:reset",label:"重设图片",icon:"resetImage"},{value:"picture:set-background",label:"设为当前幻灯片背景"}]}function AL(){return[Qe("chart"),{value:"chart-data",label:"编辑数据",icon:"database"},{value:"chart-select-data",label:"选择数据…",icon:"listFilter"},{value:"chart-kind",label:"更改图表类型",kind:"submenu",icon:"chartColumn",children:dm.map(([e,t,n])=>({value:`chart-kind:${e}`,label:t,icon:n}))}]}function EL(){return{value:"convert-diagram",label:"转换为智能图形",kind:"submenu",icon:"network",children:Fr.map(([e,t])=>({value:`convert-diagram-kind:${e}`,label:t,kind:"submenu",children:Pl.filter(n=>n.kind===e).map(n=>({value:`convert-diagram:${n.id}`,label:n.label}))}))}}function FL(e,t){const n=e.current.value?.part,l=n?le(e.session.document.presentation(),n,t):null;return l!==null&&Mb(l)}function zL(e,t){const n=e.current.value?.part;return n!==void 0&&X2(e.session.document.presentation(),n,t)!==null}function DL(){return[Qe("table"),{value:"table-insert",label:"插入",kind:"submenu",icon:"tableInsert",children:[{value:"table-insert-row:above",label:"在上方插入行",icon:"tableInsertRowAbove"},{value:"table-insert-row:below",label:"在下方插入行",icon:"tableInsertRowBelow"},{value:"table-insert-column:left",label:"在左侧插入列",icon:"tableInsertColumnLeft"},{value:"table-insert-column:right",label:"在右侧插入列",icon:"tableInsertColumnRight"}]},{value:"table-delete",label:"删除",kind:"submenu",icon:"tableDelete",children:[{value:"table-delete:rows",label:"删除行",icon:"tableDeleteRow"},{value:"table-delete:columns",label:"删除列",icon:"tableDeleteColumn"},{value:"table-delete:table",label:"删除表格",icon:"trash"}]},{value:"table-merge",label:"合并单元格",icon:"tableMergeCells"},{value:"table-split",label:"拆分单元格",icon:"tableSplitCell"},{value:"table-fill-menu",label:"单元格底纹",kind:"submenu",icon:"tableCellFill",children:[...[["#FFFFFF","白色"],["#F2F2F2","浅灰"],["#D9D9D9","灰色"],["#FFF2CC","浅黄"],["#DEEBF7","浅蓝"],["#E2F0D9","浅绿"]].map(([e,t])=>({value:`table-fill-menu:${e}`,label:t})),{value:"table-fill-menu:none",label:"无填充"}]},{value:"table-paste",label:"粘贴到单元格",icon:"clipboardPaste"}]}function LL(e){const t=Ve(e),n=Hl(e.session.document.presentation());return[...pg(),{value:"objects:select-all",label:"全选对象",shortcut:qe(!1,"A")},Qe("canvas-slide"),...fg(e),{value:"canvas-view",label:"网格和参考线",kind:"submenu",icon:"gridlines",children:[{value:"view:ruler",label:"标尺",checked:t.ruler.value},{value:"view:grid",label:"网格线",checked:t.grid.value},{value:"view:guides",label:"参考线",checked:n}]},{value:"panel:selection",label:"选择窗格",icon:"listTree"}]}function VL(e){return[{value:"slides:cut",label:"剪切",icon:"scissors",shortcut:qe(!1,"X"),disabled:e.slides.value.length<=1},{value:"slides:copy",label:"复制",icon:"clipboardCopy",shortcut:qe(!1,"C")},{value:"slides:paste",label:"粘贴",icon:"clipboardPaste",shortcut:qe(!1,"V")},{value:"slides:paste-options",label:"粘贴选项",kind:"submenu",children:[{value:"slides:paste",label:"使用目标主题"},{value:"slides:paste-source",label:"保留源格式"}]},Qe("slide-edit"),{value:"add-slide",label:"新建幻灯片",icon:"rectangleHorizontal"},{value:"duplicate-slide",label:"复制幻灯片",icon:"copy"},{value:"delete-slide",label:"删除幻灯片",icon:"trash",disabled:e.slides.value.length<=1},{value:"section:add",label:"新增节",icon:"sectionBreak"},Qe("slide-view"),{value:"present-current",label:"从此幻灯片开始放映",icon:"monitor"},{value:"toggle-hidden",label:"隐藏幻灯片",checked:e.current.value?.hidden===!0},...e.assistant.value?[Qe("slide-assist"),{value:"assist:edit-slide",label:"让 AI 改这一页…"},{value:"assist:redo-slide",label:"让 AI 重做这一页"}]:[],...fg(e)]}function IL(e,t){const n=it(e.session.document.presentation()),l=n[t];return[{value:`section:rename:${t}`,label:"重命名节",icon:"edit"},{value:`section:remove:${t}`,label:"删除节"},{value:`section:remove-slides:${t}`,label:"删除节和幻灯片",icon:"trash",disabled:!l||l.count>=e.slides.value.length},{value:"section:remove-all",label:"删除所有节"},Qe("section-move"),{value:`section:up:${t}`,label:"向上移动节",icon:"arrowUp",disabled:t<=0},{value:`section:down:${t}`,label:"向下移动节",icon:"arrowDown",disabled:t>=n.length-1},Qe("section-fold"),{value:"section:collapse-all",label:"全部折叠"},{value:"section:expand-all",label:"全部展开"}]}function BL(e){const t=e.format.value,n=t?.align??"left";return[{value:"text:cut",label:"剪切",icon:"scissors",shortcut:qe(!1,"X")},{value:"text:copy",label:"复制",icon:"clipboardCopy",shortcut:qe(!1,"C")},{value:"text:paste",label:"粘贴",icon:"clipboardPaste",shortcut:qe(!1,"V")},{value:"text:paste-plain",label:"粘贴为纯文本",shortcut:qe(!0,"V")},{value:"text:select-all",label:"全选",shortcut:qe(!1,"A")},Qe("text-format"),{value:"bold",label:"加粗",icon:"bold",shortcut:qe(!1,"B"),checked:t?.bold===!0},{value:"italic",label:"斜体",icon:"italic",shortcut:qe(!1,"I"),checked:t?.italic===!0},{value:"underline",label:"下划线",icon:"underline",shortcut:qe(!1,"U"),checked:t?.underline===!0},{value:"text-align",label:"对齐",kind:"submenu",icon:"alignStart",children:["left","center","right","justify"].map(l=>({value:`align-${l}`,label:{left:"左对齐",center:"居中",right:"右对齐",justify:"两端对齐"}[l],checked:l===n}))},{value:"text-bullets",label:"项目符号",kind:"submenu",icon:"listBullet",children:[...fm.map(([l,s])=>({value:`list-bullet:${l}`,label:`${l} ${s}`})),{value:"list-none",label:"无"}]},{value:"text-numbers",label:"编号",kind:"submenu",icon:"listNumbered",children:[...mm.map(([l,s])=>({value:`list-number:${l}`,label:s})),{value:"list-none",label:"无"}]},{value:"paragraph:dialog",label:"段落…",icon:"paragraphSettings"},{value:"clear-format",label:"清除格式",icon:"clearFormatting"},Qe("text-more"),{value:"text-link",label:"超链接…",icon:"link",shortcut:qe(!1,"K")},...e.textEditor.value&&jr(e.textEditor.value.view.state)?[{value:"text-unlink",label:"取消超链接",icon:"linkOff"}]:[],{value:"show-panel:properties",label:"设置对象格式",icon:"slidersHorizontal"},{value:"comment:new",label:"新建批注",icon:"messageSquare"}]}function OL(e,t,n=-1){return t==="text"?BL(e):t==="section"?IL(e,n):t==="slide"?VL(e):t==="object"?PL(e):LL(e)}const UL=O({__name:"menu",props:{state:{},request:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,l=t,s=F(()=>OL(n.state,n.request.target,n.request.section));return(o,a)=>(x(),B(m(Xs),{key:`${e.request.x}:${e.request.y}`,open:!0,items:s.value,"anchor-point":{x:e.request.x,y:e.request.y},placement:"bottom-start","aria-label":"右键菜单","initial-focus":"menu",onSelect:a[0]||(a[0]=i=>{l("select",i),l("close")}),"onUpdate:open":a[1]||(a[1]=i=>!i&&l("close"))},null,8,["items","anchor-point"]))}}),Da=36e3;function mg(e,t,n,l,s){let o=e.x,a=e.y,i=e.x+e.width,r=e.y+e.height;if(t.includes("w")&&(o=Math.min(o+n,i-Da)),t.includes("e")&&(i=Math.max(i+n,o+Da)),t.includes("n")&&(a=Math.min(a+l,r-Da)),t.includes("s")&&(r=Math.max(r+l,a+Da)),s&&t.length===2&&e.height>0){const u=e.width/e.height,c=i-o,d=r-a;if(c/e.width>=d/e.height){const p=c/u;t.includes("n")?a=r-p:r=a+p}else{const p=d*u;t.includes("w")?o=i-p:i=o+p}}return{x:Math.round(o),y:Math.round(a),width:Math.round(i-o),height:Math.round(r-a)}}function NL(e,t,n,l,s,o){if(t%360===0)return mg(e,n,l,s,o);const a=hg(l,s,-t),i=mg(e,n,a.x,a.y,o),r=hg(i.x+i.width/2-(e.x+e.width/2),i.y+i.height/2-(e.y+e.height/2),t),u=e.x+e.width/2+r.x,c=e.y+e.height/2+r.y;return{x:Math.round(u-i.width/2),y:Math.round(c-i.height/2),width:i.width,height:i.height}}function hg(e,t,n){const l=n*Math.PI/180;return{x:e*Math.cos(l)-t*Math.sin(l),y:e*Math.sin(l)+t*Math.cos(l)}}function RL(e,t,n,l,s){const o=e+(Math.atan2(l.y-t.y,l.x-t.x)-Math.atan2(n.y-t.y,n.x-t.x))*180/Math.PI;return((s?Math.round(o/15)*15:Math.round(o*10)/10)%360+360)%360}function vg(e,t){return t==="x"?{start:e.left,end:e.right,rect:e}:{start:e.top,end:e.bottom,rect:e}}function jL(e,t,n){const[l,s,o,a]=n==="x"?[e.top,e.bottom,t.top,t.bottom]:[e.left,e.right,t.left,t.right];return(Math.max(l,o)+Math.min(s,a))/2}function KL(e,t,n){const l=vg(e,t),s=l.end-l.start,o=(l.start+l.end)/2,a=n.filter(p=>t==="x"?p.top<e.bottom&&p.bottom>e.top:p.left<e.right&&p.right>e.left).map(p=>vg(p,t)).sort((p,f)=>p.start-f.start),i=a.filter(p=>p.end<=o).sort((p,f)=>f.end-p.end)[0],r=a.filter(p=>p.start>=o).sort((p,f)=>p.start-f.start)[0],u=(p,f,h,v)=>({axis:t,start:h,end:v,at:jL(p,f,t)}),c=[];if(i&&r&&r.start-i.end>s){const p=(i.end+r.start-s)/2;c.push({start:p,gaps:[u(i.rect,e,i.end,p),u(e,r.rect,p+s,r.start)]})}const d=a.slice(1).flatMap((p,f)=>{const h=a[f];return p.start>h.end?[{length:p.start-h.end,gap:u(h.rect,p.rect,h.end,p.start)}]:[]});for(const{length:p,gap:f}of d)i&&c.push({start:i.end+p,gaps:[f,u(i.rect,e,i.end,i.end+p)]}),r&&c.push({start:r.start-p-s,gaps:[f,u(e,r.rect,r.start-p,r.start)]});return c}function ll(e,t){const[n,l]=t==="x"?[e.left,e.right]:[e.top,e.bottom];return[n,(n+l)/2,l]}function WL(e,t,n){return t==="x"?{...e,left:e.left+n,right:e.right+n}:{...e,top:e.top+n,bottom:e.bottom+n}}function Iu(e,t){const n=t==="x"?e.width:e.height;return[0,n/2,n,...e.guides?.[t]??[]]}const Bu=(e,t)=>Math.round(e/t)*t;function qL(e,t,n){const l=t==="x"?e.right-e.left:e.bottom-e.top,s=[...Iu(n,t),...n.rects.flatMap(i=>ll(i,t))].flatMap(i=>[i,i-l/2,i-l].map(r=>({start:r})));if(!n.grid)return s;const[o,,a]=ll(e,t);return[...s,{start:Bu(o,n.grid)},{start:Bu(a,n.grid)-l}]}function _L(e,t,n,l){const s=t==="x"?e.left:e.top;let o;for(const a of n){const i=Math.abs(a.start-s);i<=l&&(!o||i<Math.abs(o.start-s))&&(o=a)}return o?{by:o.start-s,candidate:o}:{by:0}}function La(e,t,n){const l=new Map,s=ll(e,t),o=t==="x"?"y":"x",a=t==="x"?n.height:n.width,i=(r,u,c)=>{const d=Math.round(r),p=l.get(d);l.set(d,{axis:t,at:r,from:Math.min(u,p?.from??u),to:Math.max(c,p?.to??c)})};for(const r of Iu(n,t))s.some(u=>Math.abs(u-r)<1)&&i(r,0,a);for(const r of n.rects)for(const u of ll(r,t)){if(!s.some(h=>Math.abs(h-u)<1))continue;const[c,,d]=ll(e,o),[p,,f]=ll(r,o);i(u,Math.min(c,p),Math.max(d,f))}return[...l.values()]}function GL(e,t,n){let l=e;const s=[],o={x:0,y:0};for(const i of["x","y"]){const r=[...qL(l,i,t),...KL(l,i,t.rects)],u=_L(l,i,r,n);o[i]=u.by,l=WL(l,i,u.by);const c=u.candidate?.start;if(c!==void 0)for(const d of r)d.gaps&&Math.abs(d.start-c)<1&&s.push(...d.gaps)}const a=[...new Map(s.map(i=>[`${i.axis}:${Math.round(i.start)}:${Math.round(i.end)}`,i])).values()];return{dx:o.x,dy:o.y,guides:[...La(l,"x",t),...La(l,"y",t)],gaps:a}}function HL(e,t,n,l){const s={...e};for(const o of t){const a=o==="left"||o==="right"?"x":"y",i=[...Iu(n,a),...n.rects.flatMap(u=>ll(u,a)),...n.grid?[Bu(s[o],n.grid)]:[]];let r;for(const u of i)Math.abs(u-s[o])<=l&&(r===void 0||Math.abs(u-s[o])<Math.abs(r-s[o]))&&(r=u);r!==void 0&&(s[o]=r)}return{rect:s,guides:[...La(s,"x",n),...La(s,"y",n)].filter(o=>t.some(a=>Math.abs(s[a]-o.at)<1&&(a==="left"||a==="right")==(o.axis==="x"))),gaps:[]}}function gg(e){const t=ql(e);return{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height}}function QL(e){return{left:Math.min(...e.map(t=>t.left)),top:Math.min(...e.map(t=>t.top)),right:Math.max(...e.map(t=>t.right)),bottom:Math.max(...e.map(t=>t.bottom))}}function XL(e,t,n,l={}){const s=new Set(t.map(r=>r.id)),o=new Set(t.map(r=>r.parent)),a=new Map(e.map(r=>[r.id,r])),i=new Set;for(const r of t)for(let u=r.parent;u!==null;u=a.get(u)?.parent??null)i.add(u);return{rects:e.filter(r=>!s.has(r.id)&&!i.has(r.id)&&(r.parent===null||o.has(r.parent))).map(gg),width:n.width,height:n.height,...l}}function ZL(e){const t=Hl(e)?ui(e)??[]:[],n=$i(e)?Pc(e)?.x||72e3:void 0;return{...t.length?{guides:{x:t.filter(l=>l.axis==="x").map(l=>l.position),y:t.filter(l=>l.axis==="y").map(l=>l.position)}}:{},...n?{grid:n}:{}}}const YL=6;function JL(e){return[...e.includes("w")?["left"]:[],...e.includes("e")?["right"]:[],...e.includes("n")?["top"]:[],...e.includes("s")?["bottom"]:[]]}function Ou(e,t){const n=t.length===1?t[0]:void 0,l=n===void 0?-1:e.findIndex(a=>a.id===n.id);if(l>=0)return{level:l,drill:e[l].kind==="group"?e[l+1]?.id:void 0};const s=t[0]?.parent??null,o=s===null?-1:e.findIndex(a=>a.parent===s);return{level:Math.max(0,o),drill:void 0}}function eV(e,t){let n=null;const l=Q(!1),s=Q(!1),o=Q();function a(i,r,u,c){const d=t.selected();if(d.length===0)return!1;const p=XL(e.boxes.value,d,e.size.value,ZL(e.session.document.presentation()));return n={pointer:i.pointerId,origin:r,boxes:d,handle:u,drill:c,targets:p,cover:QL(d.map(gg)),moved:!1},i.currentTarget.setPointerCapture(i.pointerId),i.preventDefault(),!0}return{pressShape(i,r,u){const c=t.selected(),{level:d,drill:p}=Ou(u,c),f=u[d],h=c.map(v=>v.id);return i.shiftKey?t.select(h.includes(f.id)?h.filter(v=>v!==f.id):[...h.filter(v=>e.boxes.value.find(g=>g.id===v)?.parent===f.parent),f.id]):h.includes(f.id)||t.select([f.id]),a(i,r,null,i.shiftKey?void 0:p)},pressHandle(i,r,u){return a(i,r,u)},move(i,r){if(!n||n.pointer!==i.pointerId)return!1;let u=r.x-n.origin.x,c=r.y-n.origin.y;if(!n.moved&&Math.hypot(u,c)*t.scale()<3)return!0;const d=YL/(t.scale()||1);if(n.handle===null&&i.shiftKey&&(Math.abs(u)>=Math.abs(c)?c=0:u=0),o.value=void 0,n.handle===null&&!i.altKey){const{left:b,top:w,right:S,bottom:C}=n.cover,E=GL({left:b+u,top:w+c,right:S+u,bottom:C+c},n.targets,d);i.shiftKey&&c===0||(c+=E.dy),i.shiftKey&&u===0||(u+=E.dx),o.value={guides:E.guides,gaps:E.gaps}}n.moved=!0,l.value=n.handle==="rotate",s.value=!0;const p=e.current.value?.part,{setShapeBounds:f,rotateShapes:h}=e.session.table.factories;if(!p||!f||!h)return!0;const{handle:v,boxes:g,origin:$}=n;return e.session.document.live(b=>{for(const w of g){if(v==="rotate"){const C={x:w.x+w.width/2,y:w.y+w.height/2};h({slide:p,shapes:[w.id],to:RL(w.rotation,C,$,r,i.shiftKey)})({presentation:b,dispatch:!0});continue}let S=v===null?{x:Math.round(w.x+u),y:Math.round(w.y+c),width:w.width,height:w.height}:NL(w,w.rotation,v,u,c,i.shiftKey||w.aspectLocked);if(v!==null&&w.rotation%360===0&&!i.altKey&&!i.shiftKey&&!w.aspectLocked){const C=HL({left:S.x,top:S.y,right:S.x+S.width,bottom:S.y+S.height},JL(v),n.targets,d);S={x:Math.round(C.rect.left),y:Math.round(C.rect.top),width:Math.round(C.rect.right-C.rect.left),height:Math.round(C.rect.bottom-C.rect.top)},o.value={guides:C.guides,gaps:[]}}f({slide:p,shape:w.id,...S})({presentation:b,dispatch:!0})}}),!0},release(i){if(!n||n.pointer!==i.pointerId)return!1;const{moved:r,handle:u,drill:c}=n;return n=null,l.value=!1,s.value=!1,o.value=void 0,r?e.session.document.commit(u===null?"移动对象":u==="rotate"?"旋转":"调整大小"):c!==void 0&&t.select([c]),!0},cancel(){n?.moved&&e.session.document.cancelLive(),n=null,l.value=!1,s.value=!1,o.value=void 0},rotating:l,moving:s,snap:o}}function tV(e,t){return n=>{if(t.editing()||n.defaultPrevented)return;const l=e.current.value?.part,s=t.selected();if(n.key==="Escape"){if(e.painter.value!==void 0)e.painter.value=void 0;else if(e.armedShape.value!==void 0)e.armedShape.value=void 0;else{const r=s[0]?.parent;t.select(r==null?[]:[r])}return}if(nV(e,n,t))return;if((n.metaKey||n.ctrlKey)&&!n.altKey&&n.key.toLowerCase()==="g"){n.preventDefault(),tg(e,n.shiftKey?"ungroup":"group");return}if(!l||s.length===0)return;if(n.key==="Delete"||n.key==="Backspace"){n.preventDefault(),t.deleteShapes();return}if(n.ctrlKey||n.metaKey||n.altKey||n.shiftKey)return;const o=36e3,a={ArrowLeft:[-36e3,0],ArrowRight:[o,0],ArrowUp:[0,-36e3],ArrowDown:[0,o]}[n.key];if(!a)return;n.preventDefault();const i=e.session.chain();for(const r of s)i.setShapeBounds({slide:l,shape:r.id,x:r.x+a[0],y:r.y+a[1]});i.run()}}function nV(e,t,n){if(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey)return!1;const l=t.key.toLowerCase();return["c","x","v","d"].includes(l)?(t.preventDefault(),l==="c"?Sa(e):l==="x"?Sa(e).then(s=>{s&&n.deleteShapes()}):l==="v"?Ca(e):Mv(e),!0):!1}const Ns=e=>({value:e,label:"",kind:"separator"});function lV(e){const t=e.current.value?.part,n=e.session.document.presentation();return e.boxes.value.some(l=>{if(!e.selected.value.includes(l.id)||l.kind!=="text"||l.placeholder!==null)return!1;const s=t?le(n,t,l.id):null;return s!==null&&!Yc(s)})}function sV(e){e.tick.value;const t=e.textEditor.value===void 0&&e.selected.value.length>0&&ou(e).length===e.selected.value.length,n=!t&&(e.textSelection.value.length>0||e.textEditor.value!==void 0),l=e.format.value,s=l?.align??"left",o=[];return n&&o.push({value:"font-size",label:"字号",kind:"custom",renderer:"fontSize"},{value:"bold",label:"加粗",icon:"bold",kind:"toggle",pressed:l?.bold===!0},{value:"italic",label:"斜体",icon:"italic",kind:"toggle",pressed:l?.italic===!0},{value:"underline",label:"下划线",icon:"underline",kind:"toggle",pressed:l?.underline===!0},{value:"text-color",label:"字体颜色",icon:"textColor",kind:"custom",renderer:"color"},{value:"paragraph-align",kind:"menu",trigger:"disclosure",label:"对齐",icon:{left:"alignStart",center:"alignCenter",right:"alignEnd",justify:"alignJustify"}[s],items:["left","center","right","justify"].map(a=>({value:`align-${a}`,label:{left:"左对齐",center:"居中",right:"右对齐",justify:"两端对齐"}[a],icon:{left:"alignStart",center:"alignCenter",right:"alignEnd",justify:"alignJustify"}[a]}))}),t?o.push({value:"shape-outline",label:"线条颜色",icon:"outlineColor",kind:"custom",renderer:"color"},ia("drawing",Es(e,e.selected.value),!0,"线条样式"),{value:"drawing:arrows",label:"箭头样式",kind:"disclosure",contentRenderer:"drawingArrows",popup:"dialog",overlayProps:{width:"auto"}}):lV(e)&&(o.length>0&&o.push(Ns("shape")),o.push({value:"drawing:style",label:"形状样式",icon:"shapeStyles",kind:"disclosure",contentRenderer:"drawingStyles",popup:"dialog",overlayProps:{width:"auto"}},{value:"shape-fill",label:"填充",icon:"fillColor",kind:"custom",renderer:"color"},{value:"shape-outline",label:"轮廓",icon:"outlineColor",kind:"custom",renderer:"color"},...e.selected.value.length===1?[{value:"edit-text",label:"编辑文字",icon:"textCursor"},{value:"edit-points",label:"编辑顶点",icon:"editPoints"}]:[])),_e(e,["picture"]).length>0&&(o.length>0&&o.push(Ns("picture")),o.push({value:"picture:crop",label:"裁剪",icon:"crop",kind:"toggle",pressed:ra(e).value!==void 0},{value:"picture:replace",label:"替换图片",icon:"replaceImage"},{value:"shape-outline",label:"图片边框",icon:"outlineColor",kind:"custom",renderer:"color"})),!t&&e.selected.value.length>0&&_e(e,["group"]).length===e.selected.value.length&&(o.length>0&&o.push(Ns("group")),o.push({value:"ungroup",label:"取消组合",icon:"ungroup"})),o.length>0&&o.push(Ns("object")),o.push({value:"animation:add",label:"添加动画",icon:"animation",kind:"disclosure",indicator:!0,contentRenderer:"effectGallery",overlayProps:{width:"auto"}},uu(e),Yo(e)),e.assistant.value&&o.push(Ns("assist"),{value:"assist:edit-shapes",label:"AI",tooltip:"让 AI 改选中的内容"}),o}function oV(e){e.tick.value;const t=e.current.value?.part,n=e.session.document.presentation(),l=e.selected.value[0],s=t&&l!==void 0?le(n,t,l):null;return{...e.format.value,fill:s?lt(Zl(n,s)):null,outline:s?lt(oo(n,s)):null,presentation:n,subject:"shape",hasDefault:Ms(e).value!==void 0}}const Uu=10,bg=44,aV=O({__name:"toolbar",props:{state:{},anchor:{},bounds:{},active:{type:Boolean}},emits:["intent"],setup(e,{emit:t}){const n=e,l=t,s={fontSize:rg,color:ig,effectGallery:og,drawingStyles:jh,drawingArrows:Uh},o=F(p=>!n.active&&p?p:nl(p,ln(sV(n.state)))),a=F(p=>!n.active&&p?p:nl(p,oV(n.state))),i=je("root"),r=V({width:0,height:40}),u=F(()=>{const{anchor:p,bounds:f}=n,h=p.top-bg-r.value.height,v=h>=f.top+Uu?h:p.top+p.height+bg,g=p.left+p.width/2-r.value.width/2,$=Math.max(f.left+Uu,Math.min(g,f.right-r.value.width-Uu));return{left:`${Math.round($)}px`,top:`${Math.round(v)}px`}});function c(p){l("intent",p.value,p.payload)}let d;return ft(()=>{d=new ResizeObserver(([p])=>{p&&(r.value={width:p.borderBoxSize[0]?.inlineSize??0,height:p.borderBoxSize[0]?.blockSize??40})}),i.value&&d.observe(i.value)}),Re(()=>d?.disconnect()),(p,f)=>(x(),M("div",{ref_key:"root",ref:i,class:"pptx-selection-toolbar",style:fe(u.value),onPointerdown:f[0]||(f[0]=J(()=>{},["stop"])),onKeydown:f[1]||(f[1]=J(()=>{},["stop"])),onDblclick:f[2]||(f[2]=J(()=>{},["stop"]))},[y(m(Nt),{label:"对象工具栏",variant:"elevated","preserve-focus":"",items:o.value,renderers:s,context:a.value,onExecute:c},null,8,["items","context"])],36))}}),iV={class:"pptx-snap","aria-hidden":"true"},rV=["data-axis"],uV=["data-axis"],cV=O({__name:"guides",props:{feedback:{},scale:{}},setup(e){return(t,n)=>(x(),M("div",iV,[(x(!0),M(U,null,H(e.feedback.guides,(l,s)=>(x(),M("span",{key:`guide-${s}`,class:"pptx-snap-guide","data-axis":l.axis,style:fe(l.axis==="x"?{left:`${l.at*e.scale}px`,top:`${l.from*e.scale}px`,height:`${(l.to-l.from)*e.scale}px`}:{top:`${l.at*e.scale}px`,left:`${l.from*e.scale}px`,width:`${(l.to-l.from)*e.scale}px`})},null,12,rV))),128)),(x(!0),M(U,null,H(e.feedback.gaps,(l,s)=>(x(),M("span",{key:`gap-${s}`,class:"pptx-snap-gap","data-axis":l.axis,style:fe(l.axis==="x"?{left:`${l.start*e.scale}px`,top:`${l.at*e.scale}px`,width:`${(l.end-l.start)*e.scale}px`}:{top:`${l.start*e.scale}px`,left:`${l.at*e.scale}px`,height:`${(l.end-l.start)*e.scale}px`})},null,12,uV))),128))]))}});function Va(e,t){const{box:n}=e,l=e.flipH?1-t.x:t.x,s=e.flipV?1-t.y:t.y;return qa(n.x+l*n.width,n.y+s*n.height,n.x+n.width/2,n.y+n.height/2,n.rotation)}function Ia(e,t){const{box:n}=e,l=qa(t.x,t.y,n.x+n.width/2,n.y+n.height/2,-n.rotation),s=(l.x-n.x)/(n.width||1),o=(l.y-n.y)/(n.height||1);return{x:e.flipH?1-s:s,y:e.flipV?1-o:o}}function dV(e,t){const n=l=>{const s=t(l);return`${s.x.toFixed(1)} ${s.y.toFixed(1)}`};return e.flatMap(l=>l.subpaths.map(({nodes:s,closed:o})=>{if(s.length===0)return"";const a=[`M${n(s[0])}`],i=o?s.length:s.length-1;for(let r=0;r<i;r+=1){const u=s[r],c=s[(r+1)%s.length];a.push(!u.out&&!c.in?`L${n(c)}`:`C${n(u.out??u)} ${n(c.in??c)} ${n(c)}`)}return o?`${a.join("")}Z`:a.join("")})).join("")}function Rs(e){return e.map(t=>({...t,subpaths:t.subpaths.map(n=>({closed:n.closed,nodes:n.nodes.map(l=>({...l,in:l.in&&{...l.in},out:l.out&&{...l.out}}))}))}))}function sl(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function pV(e,t,n){let l;return e.forEach((s,o)=>s.subpaths.forEach(({nodes:a,closed:i},r)=>{const u=i?a.length:a.length-1;for(let c=0;c<u;c+=1){const d=a[c],p=a[(c+1)%a.length];for(let f=1;f<24;f+=1){const h=f/24,v=yg(d,p,h).node,g=n(v,t);(!l||g<l.gap)&&(l={at:{path:o,subpath:r,node:c},t:h,gap:g})}}})),l}function yg(e,t,n){if(!e.out&&!t.in)return{node:{...sl(e,t,n),in:null,out:null},fromOut:null,toIn:null};const l=e.out??e,s=t.in??t,o=sl(e,l,n),a=sl(l,s,n),i=sl(s,t,n),r=sl(o,a,n),u=sl(a,i,n);return{node:{...sl(r,u,n),in:r,out:u},fromOut:o,toIn:i}}function fV(e){if(!e.in||!e.out)return!1;const t=Math.atan2(e.in.y-e.y,e.in.x-e.x),n=Math.atan2(e.out.y-e.y,e.out.x-e.x);return Math.abs(Math.abs(t-n)-Math.PI)<.05}const mV={class:"pptx-points","aria-label":"编辑顶点:拖动顶点或控制柄,单击轮廓添加顶点,双击顶点切换平滑与尖角,Delete 删除顶点,Esc 结束"},hV=["d"],vV=["d"],gV=["x1","y1","x2","y2"],bV=["cx","cy","onPointerdown"],yV=["data-selected","x","y","onPointerdown","onDblclick"],xV=O({__name:"point-editor",props:{state:{},box:{},scale:{},locate:{type:Function}},emits:["done"],setup(e,{emit:t}){const n=e,l=t,s=F(()=>n.state.current.value?.part),o=()=>s.value?le(n.state.session.document.presentation(),s.value,n.box.id):null,a=Q(),i=Q(),r=F(()=>{n.state.tick.value;const S=o(),C=S?Ln(S):null;return{paths:S?Ao(S)??[]:[],frame:{box:n.box,flipH:C?.horizontal??!1,flipV:C?.vertical??!1}}}),u=F(()=>i.value??r.value),c=S=>{const C=Va(u.value.frame,S);return{x:C.x*n.scale,y:C.y*n.scale}},d=F(()=>dV(u.value.paths,c)),p=F(()=>u.value.paths.flatMap((S,C)=>S.subpaths.flatMap((E,T)=>E.nodes.map((z,D)=>({ref:{path:C,subpath:T,node:D},at:c(z)}))))),f=F(()=>{const S=a.value,C=S&&u.value.paths[S.path]?.subpaths[S.subpath]?.nodes[S.node];return C?["in","out"].flatMap(E=>C[E]?[{side:E,from:c(C),to:c(C[E])}]:[]):[]}),h=S=>a.value?.path===S.path&&a.value.subpath===S.subpath&&a.value.node===S.node;function v(S,C){if(!s.value)return;const E={slide:s.value,shape:n.box.id,paths:S};if(!C){n.state.session.commands.setShapePaths(E);return}const T=n.state.session.table.factories.setShapePaths;T&&n.state.session.document.live(z=>{T(E)({presentation:z,dispatch:!0})})}function g(S,C,E,T=r.value.paths){S.stopPropagation(),S.preventDefault(),a.value=C;const z={paths:Rs(T),frame:r.value.frame},D=Ia(z.frame,n.locate(S)),P=z.paths[C.path].subpaths[C.subpath].nodes[C.node],I=fV(P);let K=!1;const G=S.currentTarget;G.setPointerCapture(S.pointerId),i.value=z;const ee=te=>{const he=Ia(z.frame,n.locate(te)),Ye=he.x-D.x,et=he.y-D.y,ct=Rs(z.paths),Be=ct[C.path].subpaths[C.subpath].nodes[C.node],Tn=ne=>ne&&{x:ne.x+Ye,y:ne.y+et};if(!E)Object.assign(Be,{x:Be.x+Ye,y:Be.y+et,in:Tn(Be.in),out:Tn(Be.out)});else{Be[E]=Tn(Be[E]);const ne=E==="in"?"out":"in",Y=Be[E],Z=P[ne];if(I&&Z){const ke=Math.hypot(Z.x-Be.x,Z.y-Be.y),Et=Math.atan2(Be.y-Y.y,Be.x-Y.x);Be[ne]={x:Be.x+Math.cos(Et)*ke,y:Be.y+Math.sin(Et)*ke}}}K=!0,i.value={paths:ct,frame:z.frame},v(ct,!0)},W=()=>{G.removeEventListener("pointermove",ee),G.removeEventListener("pointerup",W),K?n.state.session.document.commit("编辑顶点"):T!==r.value.paths&&v(z.paths,!1),i.value=void 0};G.addEventListener("pointermove",ee),G.addEventListener("pointerup",W)}function $(S){const C=r.value.frame,E=Ia(C,n.locate(S)),T=pV(r.value.paths,E,(G,ee)=>{const W=Va(C,G),te=Va(C,ee);return Math.hypot(W.x-te.x,W.y-te.y)*n.scale});if(!T||T.gap>8)return;const z=Rs(r.value.paths),D=z[T.at.path].subpaths[T.at.subpath],P=D.nodes[T.at.node],I=D.nodes[(T.at.node+1)%D.nodes.length],K=yg(P,I,T.t);P.out=K.fromOut,I.in=K.toIn,D.nodes.splice(T.at.node+1,0,K.node),g(S,{...T.at,node:T.at.node+1},void 0,z)}function b(S){const C=Rs(r.value.paths),E=C[S.path].subpaths[S.subpath],T=E.nodes[S.node];if(T.in||T.out)Object.assign(T,{in:null,out:null});else{const z=E.nodes[S.node-1]??(E.closed?E.nodes.at(-1):void 0)??T,D=E.nodes[S.node+1]??(E.closed?E.nodes[0]:void 0)??T,P=(D.x-z.x)/6,I=(D.y-z.y)/6;Object.assign(T,{in:{x:T.x-P,y:T.y-I},out:{x:T.x+P,y:T.y+I}})}v(C,!1)}function w(S){if(S.key==="Escape")l("done");else if((S.key==="Delete"||S.key==="Backspace")&&a.value){const C=a.value,E=Rs(r.value.paths),T=E[C.path].subpaths[C.subpath];T.nodes.length>(T.closed?3:2)&&(T.nodes.splice(C.node,1),a.value=void 0,v(E,!1))}else return;S.preventDefault(),S.stopPropagation()}return ft(()=>window.addEventListener("keydown",w,!0)),Re(()=>window.removeEventListener("keydown",w,!0)),(S,C)=>(x(),M("svg",mV,[k("path",{class:"pptx-points-outline",d:d.value},null,8,hV),k("path",{class:"pptx-points-hit",d:d.value,onPointerdown:$},null,40,vV),(x(!0),M(U,null,H(f.value,E=>(x(),M("g",{key:E.side},[k("line",{class:"pptx-points-arm",x1:E.from.x,y1:E.from.y,x2:E.to.x,y2:E.to.y},null,8,gV),k("circle",{class:"pptx-points-handle",cx:E.to.x,cy:E.to.y,r:"4",onPointerdown:T=>g(T,a.value,E.side)},null,40,bV)]))),128)),(x(!0),M(U,null,H(p.value,E=>(x(),M("rect",{key:`${E.ref.path}-${E.ref.subpath}-${E.ref.node}`,class:"pptx-points-node","data-selected":h(E.ref)||void 0,x:E.at.x-4,y:E.at.y-4,width:"8",height:"8",onPointerdown:T=>g(T,E.ref),onDblclick:J(T=>b(E.ref),["stop"])},null,40,yV))),128))]))}}),wV=["data-adjust-handle","aria-label","onPointerdown"],kV=O({__name:"adjust-handles",props:{state:{},box:{},scale:{},locate:{type:Function}},setup(e){const t=e,n=F(()=>t.state.current.value?.part),l=F(()=>{t.state.tick.value;const a=t.state.session.document.presentation(),i=n.value?Id(a,n.value,t.box.id):null,r=i&&n.value?Ln(le(a,n.value,t.box.id)):null,u={box:t.box,flipH:r?.horizontal??!1,flipV:r?.vertical??!1};return i&&{adjustment:i,frame:u}}),s=F(()=>{const a=l.value;if(!a)return[];const{preset:i,values:r,width:u,height:c}=a.adjustment;return $d(i,u,c,r).map(d=>{const p=Va(a.frame,{x:d.position.x/(u||1),y:d.position.y/(c||1)});return{index:d.index,left:p.x*t.scale,top:p.y*t.scale}})});function o(a,i){const r=l.value,u=n.value,c=t.state.session.table.factories.setShapeAdjustments;if(a.button!==0||!r||!u||!c)return;a.stopPropagation(),a.preventDefault();const{adjustment:d,frame:p}=r,f=a.currentTarget;f.setPointerCapture(a.pointerId);let h=!1;const v=w=>{const S=Ia(p,t.locate(w)),C=h1({preset:d.preset,width:d.width,height:d.height,adjustments:d.values,handle:i,point:{x:S.x*d.width,y:S.y*d.height}});h=!0,t.state.session.document.live(E=>{c({slide:u,shape:t.box.id,values:C})({presentation:E,dispatch:!0})})},g=w=>{f.removeEventListener("pointermove",v),f.removeEventListener("pointerup",$),f.removeEventListener("pointercancel",b),h&&w?t.state.session.document.commit("调整形状"):h&&t.state.session.document.cancelLive()},$=()=>g(!0),b=()=>g(!1);f.addEventListener("pointermove",v),f.addEventListener("pointerup",$),f.addEventListener("pointercancel",b)}return(a,i)=>(x(!0),M(U,null,H(s.value,r=>(x(),M("button",{key:r.index,type:"button",class:"pptx-adjust-handle","data-adjust-handle":r.index,style:fe({left:`${r.left}px`,top:`${r.top}px`}),"aria-label":`调整形状 ${r.index+1}`,onPointerdown:u=>o(u,r.index)},null,44,wV))),128))}}),$V=500;function SV(e,t){let n;function l(){const a=t.value;if(!a)return null;const i=document.createElement("div");return i.className="pptx-preview-host",i.addEventListener("pointerdown",r=>{r.stopPropagation(),n?.()}),a.append(i),i}function s(a){const i=l(),r=e.motion.transition.value;if(!i||!r)return;const u=e.slides.value.findIndex(f=>f.part===a),c=e.slides.value[u-1],d=document.createElement("div");d.className="pptx-preview-layer",c&&(d.innerHTML=e.render(c.part)),i.append(d);const p=sb(d,Qa(i,e.render(a),[]).element,r,tc());n=()=>{p.finish()},p.done.then(()=>setTimeout(()=>i.remove(),200))}function o(a,i){const r=l();if(!r||!e.slide(a))return;const u=i===void 0?e.motion.steps.value:e.motion.steps.value.filter(f=>i(f.id)).map(f=>f.playable||f.effect===null||f.target.kind==="unsupported"?f:{...f,sequence:"mainSeq",playable:!0,start:"click"}),c=Qa(r,e.render(a),u);let d=!0;n=()=>{d=!1,c.player.dispose(),r.remove()},c.player.reset();const p=()=>{d&&(c.player.running||c.player.advance()?requestAnimationFrame(p):setTimeout(()=>n?.(),$V))};requestAnimationFrame(p)}X(()=>e.motion.preview.value,a=>{const i=e.current.value?.part;if(a&&(e.motion.preview.value=void 0,n?.(),!!i))if(a==="transition")s(i);else if(a==="selected")o(i,r=>r===e.motion.current.value?.id);else if(typeof a=="object"&&"from"in a){const r=e.motion.animations.value,u=new Set(r.slice(Math.max(0,r.findIndex(c=>c.id===a.from))).map(c=>c.id));o(i,c=>c!==null&&u.has(c))}else if(typeof a=="object"&&"to"in a){const r=e.motion.animations.value,u=new Set(r.slice(0,r.findIndex(c=>c.id===a.to)+1).map(c=>c.id));o(i,c=>c!==null&&u.has(c))}else if(typeof a=="object"){const r=new Set(e.motion.animations.value.filter(u=>u.click===a.click).map(u=>u.id));o(i,u=>u!==null&&r.has(u))}else o(i)}),X(()=>e.current.value?.part,()=>n?.())}function CV(e,t,n,l){let s;return X(l,(o,a)=>{const i=s;if(!i||a!==i.id||o===i.id)return;s=void 0;const r=le(e.session.document.presentation(),i.part,i.id);r&&ze(r)===""&&e.session.document.discard("addTextBox")}),o=>{const a=e.current.value?.part;a&&(t([o]),pt(async()=>{const i=e.boxes.value.find(r=>r.id===o);!i||e.current.value?.part!==a||(s={id:o,part:a},await n(i),l.value!==o&&(s=void 0))}))}}const Nu=9525;function MV(e,t,n,l){const s=le(e.session.document.presentation(),t,n),o=e.boxes.value.find(d=>d.id===n);if(!s||!o||_0(s)!=="shape")return null;const a=Number(l.closest("foreignObject")?.getAttribute("height")),i=[...l.querySelectorAll("p")];if(!Number.isFinite(a)||i.length===0)return null;const r=Math.min(...i.map(d=>d.offsetTop)),u=Math.max(...i.map(d=>d.offsetTop+d.offsetHeight)),c=Math.max(Nu,Math.round(o.height+(u-r-a)*Nu));return Math.abs(c-o.height)>=Nu?c:null}function PV(e){const t=Q();let n;const l=a=>{const i=a.target;!n||!i||n.mount.contains(i)||i.closest(".pptx-command-bar, .pptx-selection-toolbar, [data-scope], [role='menu'], [role='listbox'], [role='dialog']")||s(!0)};function s(a){const i=n;if(!i)return;n=void 0,t.value=void 0,e.textEditor.value=void 0,document.removeEventListener("pointerdown",l,!0);const r=i.editor.result(),u=i.editor.links(),c=i.editor.lists(),d=i.editor.shape,p=a?MV(e,i.part,d,i.mount):null;i.editor.destroy(),i.restore();const f=r.replace!==null||r.formats.length>0||r.aligns.some(h=>h!==null);if(a&&(f||u.length>0||c.length>0)){const h=e.session.chain();f&&h.editShapeText({slide:i.part,shape:d,edit:r}),u.length>0&&h.setTextLinks({slide:i.part,shape:d,links:u});for(const{start:v,end:g,style:$,level:b}of c){h.setParagraphBullets({slide:i.part,shapes:[d],style:$,range:{start:v,end:g}});for(let w=0;w<b;w+=1)h.changeListLevel({slide:i.part,shapes:[d],offset:1,range:{start:v,end:g}})}p!==null&&h.setShapeBounds({slide:i.part,shape:d,height:p}),h.run()}}async function o(a,i,r){const u=e.current.value?.part;if(a.kind!=="text"||!u)return;s(!0);const c=i.querySelector("svg"),d=c?.viewBox.baseVal;if(!c||!d||d.width===0)return;const p=Nr(i,a.id)??await AV(e,u,a.id);if(!p||e.current.value?.part!==u)return;const f=le(e.session.document.presentation(),u,a.id);if(!f||Xo(p.doc).replaceAll(/[\u2028\u2029]/gu,`
|
|
89
|
+
`)!==ze(f))return;const{mount:h,restore:v}=TV(i,a.id,p),g=Rf({shape:a.id,source:p,mount:h,pixelsPerPoint:d.width/(e.size.value.width/12700),onChange:()=>{e.editorTick.value+=1},onExit:()=>{e.painter.value=void 0,s(!0)},onShortcut:$=>Lu(e,$)});h.addEventListener("pointerup",()=>setTimeout(()=>{n?.editor===g&&Vv(e,g)})),n={editor:g,mount:h,restore:v,part:u,art:i},t.value=a.id,e.textEditor.value=g,e.session.document.select({slide:u,shapes:[a.id]}),document.addEventListener("pointerdown",l,!0),g.focus(),r&&g.caretAt(r.x,r.y)}return{editing:t,open:o,finish:s,async paragraphs(a){const i=n;if(!i)return;const r=i.editor.shape,u=i.editor.selection(),{art:c}=i;s(!0),a(r,u),await pt();const d=e.boxes.value.find(p=>p.id===r);d&&(await o(d,c),e.textEditor.value?.select(u))}}}function TV(e,t,n){const l=document.createElement("div");l.className="pptx-text-editor",l.setAttribute("style",n.containerStyle);const s=e.getAttribute("aria-hidden");e.removeAttribute("aria-hidden");const o=n.rendered?.firstElementChild;if(n.rendered&&o){const i=o.getAttribute("style");return o.style.display="none",n.rendered.append(l),{mount:l,restore(){l.remove(),i===null?o.removeAttribute("style"):o.setAttribute("style",i),s!==null&&e.setAttribute("aria-hidden",s)}}}const a=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");for(const[i,r]of Object.entries(n.box))a.setAttribute(i,String(r));return a.setAttribute("overflow","visible"),a.append(l),(e.querySelector(`[data-pptx-shape-id="${t}"]`)??e.querySelector("svg"))?.append(a),{mount:l,restore(){a.remove(),s!==null&&e.setAttribute("aria-hidden",s)}}}async function AV(e,t,n){const l=await dn(await vl(e.session.document.presentation())),s=le(l,t,n),o=rl(l,t);if(s===null||o===null)return null;at(s,"X",{preserveFormatting:!0});const a=document.createElement("div");a.innerHTML=Wt(l,o);const i=Nr(a,n),r=i?.doc.firstChild;if(!i||!r)return null;const u=Ee.node("paragraph",{...r.attrs,style:Rr(String(r.attrs.style),i.runStyle)});return{...i,doc:Ee.node("doc",null,[u]),rendered:null}}const EV=["innerHTML"],FV={class:"pptx-overlay"},zV={key:0},DV={key:2,class:"pptx-draw-preview","aria-hidden":"true"},LV=["points"],VV=["points"],IV=["aria-label"],BV={key:1,class:"pptx-empty qk-type-body text-qk-text-tertiary"},xg=96/914400,OV=O({__name:"stage",props:{state:{},zoom:{},showAnimationTags:{type:Boolean}},emits:["deleteShapes","scale","intent","menu"],setup(e,{emit:t}){const n=e,l=t,s=je("stage"),o=je("frame"),a=je("art"),i=V({width:0,height:0}),r=V(),{editing:u,open:c,finish:d,paragraphs:p}=PV(n.state);n.state.editParagraphs.value=p;const f=CV(n.state,Z,_=>a.value?c(_,a.value):Promise.resolve(),u),h=vS(n.state,Z,f);SV(n.state,o);const v=F(()=>{if(!n.showAnimationTags)return[];const _=new Map;for(const oe of n.state.motion.animations.value)_.set(oe.shape,[...new Set([..._.get(oe.shape)??[],oe.click])]);return n.state.boxes.value.filter(oe=>_.has(oe.id)).map(oe=>({box:oe,text:_.get(oe.id).join(",")}))}),g=h.rect,$=nn.flatMap(_=>_.stageLayers??[]),b=pS(n.state,Z),w=F(()=>{const _=T.value.scale,oe=b.points.value.map(we=>`${we.x*_},${we.y*_}`),se=b.cursor.value;return{placed:oe.join(" "),next:se&&oe.length>0?`${oe.at(-1)} ${se.x*_},${se.y*_}`:""}}),S=F(()=>n.state.boxes.value.find(_=>_.id===n.state.pointEditing.value));X(()=>n.state.current.value?.part,()=>{n.state.pointEditing.value=void 0});const C=tV(n.state,{editing:()=>u.value!==void 0,selected:()=>P.value,select:Z,deleteShapes:()=>l("deleteShapes")});function E(_){b.key(_)||C(_)}const T=F(()=>{const{width:_,height:oe}=n.state.size.value,se=i.value,we=n.zoom==="fit"?Math.min(se.width/_,se.height/oe)||0:n.zoom/100*xg;return{width:_*we,height:oe*we,scale:we}});X(()=>T.value.scale,_=>l("scale",Math.round(_/xg*100)),{immediate:!0}),X(u,(_,oe)=>{_===void 0&&oe!==void 0&&(document.activeElement===null||document.activeElement===document.body)&&s.value?.focus({preventScroll:!0})}),X(()=>n.state.current.value?.part,()=>d(!0));const z=F(()=>{const _=n.state.current.value?.part;return n.state.tick.value,_?n.state.render(_):""}),D=F(()=>n.state.boxes.value.filter(_=>_.placeholder!==null&&_.empty).map(_=>({box:_,text:_.placeholder==="title"||_.placeholder==="ctrTitle"?"单击此处添加标题":_.placeholder==="subTitle"?"单击此处添加副标题":"单击此处添加文本"}))),P=F(()=>n.state.boxes.value.filter(_=>n.state.selected.value.includes(_.id))),I=F(()=>n.state.boxes.value.find(_=>_.id===r.value&&!n.state.selected.value.includes(_.id))),K=F(()=>{const _=P.value[0]?.parent;return _==null?void 0:n.state.boxes.value.find(oe=>oe.id===_)}),G=F(()=>P.value.length===1&&!u.value?P.value[0]:void 0),ee=eV(n.state,{scale:()=>T.value.scale,selected:()=>P.value,select:Z}),W=ee.rotating,te=V({left:0,top:0}),he=V({frameLeft:0,frameTop:0,stageLeft:0,stageRight:0,stageTop:0});function Ye(){const _=o.value?.getBoundingClientRect(),oe=s.value?.getBoundingClientRect();_&&oe&&(he.value={frameLeft:_.left,frameTop:_.top,stageLeft:oe.left,stageRight:oe.right,stageTop:oe.top})}X([()=>T.value.scale,i,te,()=>n.state.current.value?.part,()=>n.state.selected.value],Ye,{flush:"post",immediate:!0});const et=F(()=>{const _=u.value===void 0?P.value:n.state.boxes.value.filter(dt=>dt.id===u.value);if(_.length===0||!o.value||n.state.pointEditing.value!==void 0||ee.moving.value||g.value||n.state.armedShape.value!==void 0||n.state.painter.value!==void 0)return;const oe=_.map(dt=>ql(dt)),se=Math.min(...oe.map(dt=>dt.x)),we=Math.min(...oe.map(dt=>dt.y)),Ft=Math.max(...oe.map(dt=>dt.x+dt.width)),Tg=Math.max(...oe.map(dt=>dt.y+dt.height)),Ks=T.value.scale,{frameLeft:Ag,frameTop:Eg}=he.value;return{left:Ag+se*Ks,top:Eg+we*Ks,width:(Ft-se)*Ks,height:(Tg-we)*Ks}}),ct=F(_=>et.value??_),Be=F(()=>({left:he.value.stageLeft,right:he.value.stageRight,top:he.value.stageTop})),Tn={"north-west":"nw",north:"n","north-east":"ne",east:"e","south-east":"se",south:"s","south-west":"sw",west:"w"};function ne(_){const oe=T.value.scale,se="rotation"in _&&_.rotation!==0?{transform:`rotate(${_.rotation}deg)`}:{};return{left:`${_.x*oe}px`,top:`${_.y*oe}px`,width:`${_.width*oe}px`,height:`${_.height*oe}px`,...se}}function Y(_){const oe=o.value.getBoundingClientRect(),se=T.value.scale||1;return{x:(_.clientX-oe.left)/se,y:(_.clientY-oe.top)/se}}function Z(_){const oe=n.state.current.value?.part??null;n.state.session.document.select({slide:oe,shapes:_})}function ke(_,oe=null){if(_.button!==0||u.value)return;s.value?.focus({preventScroll:!0});const se=Y(_);if(b.armed()){b.press(_,se,T.value.scale);return}if(n.state.pointEditing.value=void 0,oe!==null){ee.pressHandle(_,se,oe);return}const we=n.state.armedShape.value===void 0?Gs(n.state.boxes.value,se.x,se.y):[];if(n.state.painter.value){const Ft=we.at(-1);Ft?(Lv(n.state,Ft.id),Z([Ft.id])):n.state.painter.value=void 0,_.preventDefault();return}if(we.length===0){h.begin(_.pointerId,se,_.shiftKey),_.currentTarget.setPointerCapture(_.pointerId),_.preventDefault();return}ee.pressShape(_,se,we)}function Et(_){const oe=Y(_);if(b.move(_,oe,T.value.scale)||h.move(_.pointerId,oe,_.shiftKey,T.value.scale)||ee.move(_,oe))return;const se=Gs(n.state.boxes.value,oe.x,oe.y);r.value=se.length===0?void 0:se[Ou(se,P.value).level].id}function Sg(_){b.release(_,T.value.scale)||h.end(_.pointerId)||ee.release(_)}function Cg(_){if(_.preventDefault(),u.value!==void 0){_.target?.closest(".pptx-text-editor")&&l("menu",{target:"text",x:_.clientX,y:_.clientY});return}const oe=Y(_),se=Gs(n.state.boxes.value,oe.x,oe.y),we=se.length===0?void 0:se[Ou(se,P.value).level];we&&!n.state.selected.value.includes(we.id)?Z([we.id]):we||Z([]),l("menu",{target:we?"object":"canvas",x:_.clientX,y:_.clientY})}function Mg(_){if(u.value!==void 0||n.state.pointEditing.value!==void 0)return;if(b.armed()){b.finishOpen();return}const oe=Y(_),se=Gs(n.state.boxes.value,oe.x,oe.y).at(-1),we=n.state.current.value?.part,Ft=se&&we?le(n.state.session.document.presentation(),we,se.id):null;if(se&&Ft&&cr(Ft)){Z([se.id]),l("intent","edit-equation",se.id);return}if(se&&we&&Bo(n.state.session.document.presentation(),we,se.id)){Z([se.id]),l("intent","edit-object",se.id);return}se&&a.value&&c(se,a.value,{x:_.clientX,y:_.clientY})}function Pg(_){return _.name||"对象"}let Ua;return ft(()=>{window.addEventListener("resize",Ye),Ua=new ResizeObserver(([_])=>{_&&(i.value={width:_.contentRect.width,height:_.contentRect.height})}),Ua.observe(s.value)}),Re(()=>{Ua?.disconnect(),window.removeEventListener("resize",Ye)}),(_,oe)=>(x(),M("section",{ref_key:"stage",ref:s,class:"pptx-stage",tabindex:"0","aria-label":"幻灯片编辑区",onKeydown:E,onPointerdown:oe[6]||(oe[6]=J(se=>!m(u)&&Z([]),["self"])),onScroll:oe[7]||(oe[7]=se=>te.value={left:se.target.scrollLeft,top:se.target.scrollTop})},[e.state.current.value?(x(),M("div",{key:0,ref_key:"frame",ref:o,class:Ne(["pptx-slide-frame",{"pptx-armed":e.state.armedShape.value!==void 0,"pptx-painting":e.state.painter.value!==void 0,"pptx-rotating":m(W)}]),style:fe({width:`${T.value.width}px`,height:`${T.value.height}px`}),onPointerdown:oe[2]||(oe[2]=se=>ke(se)),onPointermove:Et,onPointerup:Sg,onPointercancel:oe[3]||(oe[3]=se=>m(ee).cancel()),onPointerleave:oe[4]||(oe[4]=se=>r.value=void 0),onDblclick:Mg,onContextmenu:Cg},[k("div",{ref_key:"art",ref:a,class:"pptx-slide-art","aria-hidden":"true",innerHTML:z.value},null,8,EV),k("div",FV,[(x(!0),M(U,null,H(D.value,se=>(x(),M("div",{key:`prompt-${se.box.id}`,class:"pptx-placeholder",style:fe(ne(se.box))},[m(u)!==se.box.id?(x(),M("span",zV,N(se.text),1)):L("v-if",!0)],4))),128)),(x(!0),M(U,null,H(v.value,se=>(x(),M("span",{key:`tag-${se.box.id}`,class:"pptx-animation-tag",style:fe({left:`${se.box.x*T.value.scale}px`,top:`${se.box.y*T.value.scale}px`})},N(se.text),5))),128)),I.value&&!m(g)?(x(),M("div",{key:0,class:"pptx-hover-box",style:fe(ne(I.value))},null,4)):L("v-if",!0),m(ee).snap.value?(x(),B(cV,{key:1,feedback:m(ee).snap.value,scale:T.value.scale},null,8,["feedback","scale"])):L("v-if",!0),w.value.placed?(x(),M("svg",DV,[k("polyline",{points:w.value.placed},null,8,LV),w.value.next?(x(),M("polyline",{key:0,class:"pptx-draw-next",points:w.value.next},null,8,VV)):L("v-if",!0)])):L("v-if",!0),S.value?(x(),B(xV,{key:3,state:e.state,box:S.value,scale:T.value.scale,locate:Y,onDone:oe[0]||(oe[0]=se=>e.state.pointEditing.value=void 0)},null,8,["state","box","scale"])):L("v-if",!0),m(g)?(x(),M("div",{key:4,class:Ne(e.state.armedShape.value===void 0?"pptx-marquee":"pptx-sketch"),style:fe(ne(m(g)))},null,6)):L("v-if",!0),K.value?(x(),M("div",{key:5,class:"pptx-group-box",style:fe(ne(K.value))},null,4)):L("v-if",!0),(x(!0),M(U,null,H(e.state.pointEditing.value===void 0?P.value:[],se=>(x(),M("div",{key:se.id,class:"pptx-selection-box",style:fe(ne(se)),role:"img","aria-label":`已选中:${Pg(se)}`},[y(m(V1),{resizable:G.value===se,rotatable:G.value===se&&se.kind!=="table"&&se.kind!=="chart",rotation:se.rotation,"object-label":"对象",onPress:oe[1]||(oe[1]=(we,Ft)=>ke(Ft,we==="rotate"?we:Tn[we]))},null,8,["resizable","rotatable","rotation"])],12,IV))),128)),(x(!0),M(U,null,H(m($),(se,we)=>(x(),B(An(se),{key:`layer-${we}`,state:e.state,scale:T.value.scale},null,8,["state","scale"]))),128)),G.value&&e.state.pointEditing.value===void 0&&!m(ee).moving.value?(x(),B(kV,{key:6,state:e.state,box:G.value,scale:T.value.scale,locate:Y},null,8,["state","box","scale"])):L("v-if",!0)])],38)):(x(),M("p",BV,"没有幻灯片")),ct.value?ht((x(),B(aV,{key:2,state:e.state,anchor:ct.value,active:et.value!==void 0,bounds:Be.value,onIntent:oe[5]||(oe[5]=(se,we)=>l("intent",se,we))},null,8,["state","anchor","active","bounds"])),[[mt,et.value]]):L("v-if",!0)],544))}});function UV(e,t,n){return!t.includes("r:embed")&&!t.includes("r:link")?[]:Y0(e).map(l=>jt(n,l))}function wg(e,t){return e.length===t.length&&e.every((n,l)=>{const s=t[l];if(n===s)return!0;if(!n||!s||n.length!==s.length)return!1;for(let o=0;o<n.length;o+=1)if(n[o]!==s[o])return!1;return!0})}const NV=/^\/ppt\/(?:slideLayouts|slideMasters|theme)\//u;function RV(e,t){const n=ed(e),l=new Map(ed(t).map(s=>[s.name,s.byteLength]));return n.length!==l.size||n.some(s=>l.get(s.name)!==s.byteLength)?!1:n.filter(s=>NV.test(s.name)).every(s=>wg([jt(e,s.name)],[jt(t,s.name)]))}function jV(e){const t=new Map;let n;return{render(l,s,o,a="",i){n!==l&&(n&&!RV(n,l)&&t.clear(),n=l);let r=t.get(o);if(!(r&&i!==void 0&&r.version===i&&r.presentation===l&&r.deck===a)){const u=ey(s),c=u.includes("drawingml/2006/chart")?u+JSON.stringify(gi(s).map(p=>p.spec)):u,d=UV(s,u,l);if(!r||r.xml!==c||r.deck!==a||!wg(r.media,d)){const p=Wt(l,s);r={xml:c,deck:a,version:i,media:d,svg:e?p:Hs(l,s,p),presentation:l}}else r={...r,version:i,media:d,presentation:l};t.set(o,r)}return e?(r.typeset?.generation!==e.generation&&(r.typeset={generation:e.generation,svg:Hs(l,s,e.typeset(r.svg,s))}),r.typeset.svg):r.svg},clear(){t.clear()}}}const KV={entr:"entrance",emph:"emphasis",exit:"exit"};function WV(e){try{return ze(e).trim()!==""}catch{return!1}}function qV(e){const t=Q(),n=()=>{e.tick.value;const a=e.current.value?.part;return a?e.slide(a):null},l=F(()=>{const a=n();return a?ac(ro(a)):null}),s=F(()=>{const a=n();return a?Dt(a):[]}),o=F(()=>{const a=n();if(!a)return[];const i=ot(a),r=new Map(i.map(d=>[Fe(d),dl(d)])),u=new Set(i.filter(WV).map(Fe));let c=0;return s.value.filter(d=>(d.sequence==="mainSeq"||d.sequence==="interactiveSeq")&&d.id!==null).map((d,p)=>{d.sequence==="mainSeq"&&(d.start==="click"||p>0&&d.start==="unknown")&&(c+=1);const f=d.target.shapeId??d.targetShapeIds[0]??0,h=oc(a,d.id)??{repeat:null,rewind:!1,trigger:null};return{id:d.id,effect:d.effect,preset:tw(d.effect,d.shape),kind:KV[d.presetClass??""]??"other",shape:f,shapeName:r.get(f)??"对象",start:d.start,click:d.sequence==="mainSeq"?c:0,direction:d.direction,durationMs:d.durationMs,delayMs:d.delayMs,...h,build:d.build,text:u.has(f)}})});return{transition:l,steps:s,animations:F(()=>o.value.filter(a=>a.trigger===null)),triggered:F(()=>o.value.filter(a=>a.trigger!==null)),selected:t,current:F(()=>{const a=o.value,i=a.find(u=>u.id===t.value);if(i)return i;const r=e.selected.value;return r.length===1?a.find(u=>u.shape===r[0]):void 0}),pane:Q("objects"),preview:Q()}}function _V(e){const{document:t}=e,n=Q(0),l=Q(0),s=Q(0),o=ab(()=>{s.value+=1});Za(()=>o.dispose());const a=jV(o);function i(w,S){let C;return F(()=>{n.value;const E=t.presentation(),T=t.version(),z=w();return C&&C.presentation===E&&C.version===T&&C.key===z||(C={presentation:E,version:T,key:z,value:S()}),C.value})}const r=i(()=>"",()=>{const w=t.presentation();return JSON.stringify([Mt(w),Xl(w),Rt(w),GV(w),Ql(w)])});Za(t.subscribe(w=>{w.origin==="file"&&a.clear(),n.value+=1,w.live||(l.value+=1)}));const u=i(()=>"",()=>pe(t.presentation()).map((w,S)=>({part:We(w),index:S,title:xi(w)??"",hidden:co(w)}))),c=F(()=>{n.value;const w=t.selection().slide;return u.value.find(S=>S.part===w)}),d=w=>rl(t.presentation(),w),p=i(()=>c.value?.part??"",()=>{const w=c.value&&d(c.value.part);return w?nc(t.presentation(),w):[]}),f=F(()=>(n.value,t.selection().shapes)),h=Q(),v=Q(0),g=Q(),$=F(()=>p.value.filter(w=>w.kind==="text"&&f.value.includes(w.id)).map(w=>w.id)),b={session:e,tick:n,settled:l,slides:u,current:c,boxes:p,selected:f,textSelection:$,format:F(()=>{const w=c.value?.part,S=h.value;if(S){v.value,n.value;const P=w===void 0?null:le(t.presentation(),w,S.shape),I=P?ze(P).slice(0,S.selection().start).split(`
|
|
90
|
+
`).length-1:0;return{...S.format(),anchor:(P?Rc(P):null)??"top",direction:P?$g(P):"horz",list:P?kg(t.presentation(),P,I):null}}const C=$.value[0];if(w===void 0||C===void 0)return;const E=le(t.presentation(),w,C);if(E===null)return;let T;try{T=Jl(t.presentation(),E,0,0)}catch{T=void 0}let z=null;try{z=ci(E,0)}catch{z=null}const D=z==="ctr"?"center":z==="r"?"right":z==="just"?"justify":z==="l"?"left":null;return{size:T?.size??null,bold:T?.bold===!0,italic:T?.italic===!0,underline:T?.underline!==void 0&&T.underline!==!1&&T.underline!=="none",strike:T?.strike!==void 0&&T.strike!==!1&&T.strike!=="noStrike",baseline:T?.baseline??0,highlight:typeof T?.highlight=="string"&&/^#?[0-9a-f]{6}$/iu.test(T.highlight)?`#${T.highlight.replace("#","")}`:null,font:[T?.fontEastAsian,T?.font].find(P=>typeof P=="string"&&!P.startsWith("+"))??null,color:typeof T?.color=="string"&&/^#?[0-9a-f]{6}$/iu.test(T.color)?`#${T.color.replace("#","")}`:null,align:D,anchor:Rc(E)??"top",direction:$g(E),list:kg(t.presentation(),E,0)}}),textEditor:h,editorTick:v,editParagraphs:g,armedShape:Q(),pointEditing:Q(),painter:Q(),toaster:Yb({placement:"bottom-end",duration:4e3,max:2}),assistant:Q(!1),size:i(()=>"",()=>Ga(t.presentation())),notes:i(()=>c.value?.part??"",()=>{const w=c.value&&d(c.value.part);return w?In(w)??"":""}),history:F(()=>(n.value,{undo:t.canUndo(),redo:t.canRedo()})),dirty:F(()=>(n.value,t.isDirty())),renders:a,slide:d,render(w){s.value;const S=d(w);return S?a.render(t.presentation(),S,w,r.value,t.version()):""}};return Object.assign(b,{motion:qV(b)})}function kg(e,t,n){let l;try{l=di(e,t,n).bullet}catch{return null}return l==null||l==="none"?null:l==="number"||typeof l=="object"&&"autoNum"in l?"number":"bullet"}function $g(e){const t=G0(e);return t==="eaVert"||t==="vert"||t==="vert270"||t==="wordArtVert"?t:"horz"}function GV(e){return JSON.stringify(io(e).map(t=>X0(e,t)))}const HV={class:"pptx-status-bar qk-type-caption text-qk-text-secondary"},QV={role:"status"},XV={role:"status"},ZV={class:"pptx-status-views",role:"group","aria-label":"视图"},YV={class:"pptx-zoom",role:"group","aria-label":"缩放"},JV=O({__name:"status-bar",props:ol({state:{},scale:{}},{zoom:{required:!0},zoomModifiers:{},notes:{type:Boolean,required:!0},notesModifiers:{},slides:{type:Boolean,required:!0},slidesModifiers:{}}),emits:ol(["present","reading"],["update:zoom","update:notes","update:slides"]),setup(e,{emit:t}){const n=e,l=on(e,"zoom"),s=on(e,"notes"),o=on(e,"slides"),a=t,i=Ve(n.state).mode,r=F({get:()=>[n.scale<=100?(n.scale-25)/75*50:50+(n.scale-100)/300*50],set:p=>{const f=p[0];f!==void 0&&(l.value=Math.round(f<=50?25+f/50*75:100+(f-50)/50*300))}}),u=[25,33,50,67,75,90,100,125,150,175,200,300,400],c=F(()=>{const p=n.state.slides.value.length,f=n.state.current.value;return f?`幻灯片 ${f.index+1}/${p}`:"没有幻灯片"});function d(p){const f=p>0?u.find(h=>h>n.scale):[...u].reverse().find(h=>h<n.scale);f!==void 0&&(l.value=f)}return(p,f)=>(x(),M("footer",HV,[k("span",QV,N(c.value),1),f[10]||(f[10]=k("span",{class:"pptx-status-spacer"},null,-1)),y(Se,{icon:"notebookPen",label:s.value?"收起备注":"显示备注",pressed:s.value,onClick:f[0]||(f[0]=h=>s.value=!s.value)},null,8,["label","pressed"]),k("span",XV,N(e.state.dirty.value?"有未保存的修改":"已保存"),1),k("div",ZV,[y(Se,{icon:"panelLeft",label:"普通视图",pressed:m(i)==="normal",onClick:f[1]||(f[1]=h=>{i.value="normal",o.value=!0})},null,8,["pressed"]),y(Se,{icon:"slideSorter",label:"幻灯片浏览",pressed:m(i)==="sorter",onClick:f[2]||(f[2]=h=>i.value="sorter")},null,8,["pressed"]),y(Se,{icon:"bookOpen",label:"阅读视图",onClick:f[3]||(f[3]=h=>a("reading"))}),y(Se,{icon:"play",label:"从当前页开始放映",onClick:f[4]||(f[4]=h=>a("present"))})]),k("div",YV,[y(Se,{icon:"minus",label:"缩小",disabled:e.scale<=u[0],onClick:f[5]||(f[5]=h=>d(-1))},null,8,["disabled"]),y(m(il),{modelValue:r.value,"onUpdate:modelValue":f[6]||(f[6]=h=>r.value=h),class:"pptx-zoom-slider",label:"缩放比例","hide-label":"","show-value":!1,min:0,max:100,step:.5,disabled:m(i)!=="normal"},null,8,["modelValue","disabled"]),y(m(q),{variant:"ghost",size:"xs","aria-label":`缩放 ${e.scale}%,单击适应窗口`,onClick:f[7]||(f[7]=h=>l.value="fit")},{default:A(()=>[R(N(e.scale)+"%",1)]),_:1},8,["aria-label"]),y(Se,{icon:"plus",label:"放大",disabled:e.scale>=u.at(-1),onClick:f[8]||(f[8]=h=>d(1))},null,8,["disabled"]),y(Se,{icon:"scan",label:"适应窗口",pressed:l.value==="fit",onClick:f[9]||(f[9]=h=>l.value="fit")},null,8,["pressed"])])]))}}),eI={key:0,class:"pptx-equation-notice"},tI=O({__name:"equation-dialog",props:ol({state:{},shape:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:["update:open"],setup(e){const t=e,n=on(e,"open"),l=zb(async()=>(await import("@quirekit/math-ui/styles.css"),(await import("@quirekit/math-ui")).MathAuthoringPanel)),s=V(""),o=V(0),a=V(),i=V();X(n,u=>{if(!u)return;a.value=void 0,s.value="",o.value+=1;const c=t.state.current.value?.part;if(t.shape===void 0||!c)return;const d=Mw(t.state.session.document.presentation(),c,t.shape);d?.ok?s.value=d.latex:d&&(a.value=`这个公式无法转成可编辑的写法(${d.reason}),可以重新输入后替换。`)},{immediate:!0});function r(u){const c=t.state.current.value?.part;if(!c)return!1;const{commands:d}=t.state.session;return(t.shape!==void 0?d.setEquation({slide:c,shape:t.shape,latex:u.latex}):d.addEquation({slide:c,latex:u.latex,...Ie(t.state,16,4)}))?(t.shape===void 0&&Le(t.state,c),n.value=!1,!0):!1}return(u,c)=>(x(),B(m(Ae),{open:n.value,"onUpdate:open":c[1]||(c[1]=d=>n.value=d)},{default:A(()=>[y(m(Te),{title:e.shape===void 0?"插入公式":"编辑公式",size:"large",width:736,"show-close":!1},{default:A(()=>[a.value?(x(),M("p",eI,N(a.value),1)):L("v-if",!0),k("div",{ref_key:"surface",ref:i,class:"pptx-equation-panel"},[(x(),B(m(l),{key:o.value,latex:s.value,commit:r,"popup-target":i.value,autofocus:"",onCancel:c[0]||(c[0]=d=>n.value=!1)},null,8,["latex","popup-target"]))],512)]),_:1},8,["title"])]),_:1},8,["open"]))}}),Ru={flowchart:{format:"quirekit.flowchart",label:"流程图",load:async()=>{const[e,t]=await Promise.all([import("@quirekit/flowchart"),import("@quirekit/flow-editor"),import("@quirekit/flow-editor/styles.css")]);return Ba(n=>e.createFlowchartEmbed(n),n=>e.readFlowchartEmbed(n),n=>n.document.revision,n=>t.openFlowchartDialog(n))}},"mind-map":{format:"quirekit.mind-map",label:"思维导图",load:async()=>{const[e,t]=await Promise.all([import("@quirekit/mind-map"),import("@quirekit/mind-editor"),import("@quirekit/mind-editor/styles.css")]);return Ba(n=>e.createMindMapEmbed(n),n=>e.readMindMapEmbed(n),n=>n.document.revision,n=>t.openMindMapDialog(n))}},whiteboard:{format:"quirekit.whiteboard",label:"白板",load:async()=>{const[e,t]=await Promise.all([import("@quirekit/whiteboard"),import("@quirekit/whiteboard-editor"),import("@quirekit/whiteboard-editor/styles.css")]);return Ba(n=>e.createWhiteboardDocument(n),n=>e.readWhiteboardDocument(n),n=>n.revision,n=>t.openWhiteboardDialog(n))}},"text-diagram":{format:"quirekit.text-diagram",label:"文本绘图",load:async()=>{const[e,t]=await Promise.all([import("@quirekit/text-diagram"),import("@quirekit/text-diagram-editor"),import("@quirekit/text-diagram-editor/styles.css")]);return Ba((n,l)=>e.createTextDiagram(n,"mermaid",e.textDiagramTemplates(l)[0].source),n=>e.readTextDiagram(n),n=>n.document.revision,n=>t.openTextDiagramDialog(n))}}};function Ba(e,t,n,l){return{create:(s,o)=>e(s,o),read:s=>{try{return t(s)}catch{return null}},revision:n,open:l}}const Oa=9525;function nI(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:t.getUint32(16),height:t.getUint32(20)}}function lI(e){return Object.keys(Ru).find(t=>Ru[t].format===e)}async function sI(e,t,n){const l=e.current.value?.part;if(!l)return!1;const s=n.locale??"zh-CN",o="shape"in t?Bo(e.session.document.presentation(),l,t.shape):null,a="kind"in t?t.kind:o?lI(o.source.format):void 0;if(!a||"shape"in t&&!o)return!1;const i=Ru[a];if(o&&o.source.version>1)return!1;const r=await i.load(),u=o?nI(o.png):null,c=o?r.read({...o.source.data,preview:{dataUrl:g1("image/png",o.png),...u}}):r.create(Wi(),s);if(!c)return!1;const d=o?JSON.stringify(o.source):null;let p=!0,f=!1;const h={intent:o?"edit":"insert",document:c,commit(v){if(!p||f)return"missing";if(v.id!==c.id||r.revision(v)!==r.revision(c)+1||!v.preview?.dataUrl)return"conflict";const g=v1(v.preview.dataUrl)?.bytes;if(!g)return"conflict";const{preview:$,...b}=v,w={format:i.format,version:1,data:b},{commands:S}=e.session;if("shape"in t){const C=Bo(e.session.document.presentation(),l,t.shape);if(!C)return"missing";if(JSON.stringify(C.source)!==d)return"conflict";f=S.setEditablePicture({slide:l,shape:t.shape,png:g,source:w,aspect:v.preview.width/v.preview.height})}else f=S.addEditablePicture({slide:l,png:g,source:w,name:v.title||i.label,...oI(e,v.preview)}),f&&Le(e,l);return f?"saved":"conflict"},release(){p=!1}};return r.open({request:h,ownerDocument:n.ownerDocument,locale:s,...n.theme?{theme:n.theme}:{}}),!0}function oI(e,t){const n=Rt(e.session.document.presentation())??{width:12192e3,height:6858e3},l=Math.min(1,n.width*.8/(t.width*Oa),n.height*.8/(t.height*Oa)),s=Math.round(t.width*Oa*l),o=Math.round(t.height*Oa*l);return{x:Math.round((n.width-s)/2),y:Math.round((n.height-o)/2),width:s,height:o}}const js=16;async function aI(e){let t;try{t=I1(e,{ecc:"M",border:4}).data}catch{return null}const n=t.length*js,l=new OffscreenCanvas(n,n),s=l.getContext("2d");if(!s)return null;s.fillStyle="#ffffff",s.fillRect(0,0,n,n),s.fillStyle="#000000",t.forEach((a,i)=>a.forEach((r,u)=>{r&&s.fillRect(u*js,i*js,js,js)}));const o=await l.convertToBlob({type:"image/png"});return new Uint8Array(await o.arrayBuffer())}const iI={class:"pptx-qr"},rI={class:"pptx-qr-preview"},uI={key:1,class:"pptx-qr-placeholder"},cI={key:0,class:"pptx-qr-error",role:"alert"},dI=O({__name:"qr-dialog",props:ol({state:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:["update:open"],setup(e){const t=e,n=on(e,"open"),l=V(""),s=V(!1);X(n,a=>{a&&(l.value="",s.value=!1)});async function o(){const a=t.state.current.value?.part,i=l.value.trim()?await aI(l.value.trim()):null;if(!a||!i){s.value=i===null;return}t.state.session.commands.addPicture({slide:a,bytes:i,name:"二维码",...Ie(t.state,5,5)})&&Le(t.state,a),n.value=!1}return(a,i)=>(x(),B(m(Ae),{open:n.value,"onUpdate:open":i[3]||(i[3]=r=>n.value=r)},{default:A(()=>[y(m(Te),{title:"插入二维码",size:"mini",height:"auto","show-close":!1},{footer:A(()=>[y(m(q),{type:"button",onClick:i[1]||(i[1]=r=>n.value=!1)},{default:A(()=>[...i[4]||(i[4]=[R("取消",-1)])]),_:1}),y(m(q),{type:"button",color:"primary",variant:"solid",disabled:!l.value.trim(),onClick:i[2]||(i[2]=r=>o())},{default:A(()=>[...i[5]||(i[5]=[R("插入",-1)])]),_:1},8,["disabled"])]),default:A(()=>[k("div",iI,[y(m(Ct),{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=r=>l.value=r),width:"100%","aria-label":"二维码内容",rows:3,"auto-resize":"",placeholder:"输入网址或文字"},null,8,["modelValue"]),k("div",rI,[l.value.trim()?(x(),B(m(qb),{key:0,value:l.value.trim(),label:"二维码预览",size:160,"error-correction":"M"},null,8,["value"])):(x(),M("p",uI,"输入内容后显示二维码"))]),s.value?(x(),M("p",cI,"内容太长,放不进一个二维码。")):L("v-if",!0)])]),_:1})]),_:1},8,["open"]))}}),pI=["data-slides","data-full-page","data-panel"],fI={key:0,class:"pptx-main pptx-main-view"},mI={class:"pptx-main"},hI={key:0,class:"pptx-slides-reopen"},vI=["aria-label"],gI=O({__name:"app",props:{options:{}},setup(e){const t=e,n=vb(t.options,f$,{text:typeof OffscreenCanvas>"u"?void 0:y$(new OffscreenCanvas(1,1)),layout:typeof document>"u"?void 0:tb(document)}),l=_V(n);Lb(mu,l);const s=pc({profile:"stone",scheme:"light",sources:{primary:"#d4441c"}}),o=V("home"),a=V("fit"),i=V(100),r=V(!0),u=V(SL());X(u,CL);const c=V(),d=t.options.panels??[];l.assistant.value=d.some(ne=>ne.assistant===!0);const p=V(d.find(ne=>ne.defaultOpen)?.id??"properties"),f=V("side");X(p,()=>{f.value="side"});const h=F(()=>f.value==="page");function v(ne,Y){const Z=d.find(ke=>ke.id===ne);p.value===ne&&(Y==="side"||Z?.layouts?.includes(Y))&&(f.value=Y)}function g(ne){p.value=p.value===ne?void 0:ne}const $=new Set(["transition","animation"]);X(o,(ne,Y)=>{$.has(ne)?(p.value="animations",l.motion.pane.value=ne==="transition"?"transition":"objects"):$.has(Y)&&p.value==="animations"&&(p.value="properties")});const b=je("root"),w=je("fileInput"),S=je("pictureInput"),C=je("audioInput"),E=je("videoInput"),T=V({open:!1,shape:void 0}),z=V(!1),D=new Map,P={get ownerDocument(){return b.value?.ownerDocument??document},theme:s,intent:(ne,Y)=>W(ne,Y),selectTab:ne=>{o.value=ne},async ask(ne,Y){const Z=d.find(ke=>ke.assistant);if(Z===void 0)return!1;p.value=Z.id;for(let ke=0;ke<100&&!D.has(Z.id);ke+=1)await new Promise(Et=>setTimeout(Et,50));return D.get(Z.id)?.(ne,Y)??!1}},I=nn.flatMap(ne=>ne.panels??[]),K=nn.flatMap(ne=>ne.overlays??[]),G=F(()=>nn.map(ne=>ne.mainView?.(l)).find(ne=>ne!==void 0));async function ee(ne){const Y=ne==="start"?"present-start":"present-current";nn.some(Z=>Z.intent?.(l,Y,void 0,P))||await n.present(ne==="start"?0:void 0)}function W(ne,Y){nn.some(Z=>Z.intent?.(l,ne,Y,P))||(ne==="present-start"||ne==="present-current"?ee(ne==="present-start"?"start":"current"):ne==="insert-picture"?S.value?.click():ne==="insert-audio"?C.value?.click():ne==="insert-video"?E.value?.click():ne==="insert-equation"?T.value={open:!0,shape:void 0}:ne==="edit-equation"&&typeof Y=="number"?T.value={open:!0,shape:Y}:ne==="insert-qr"?z.value=!0:ne.startsWith("insert-object:")?Ye({kind:ne.slice(14)}):ne==="edit-object"&&typeof Y=="number"?Ye({shape:Y}):ne.startsWith("panel:")?g(ne.slice(6)):ne.startsWith("show-panel:")?p.value=ne.slice(11):Lu(l,ne,Y))}async function te(ne){const Y=ne.target,Z=Y.files?.[0];if(Y.value="",!Z)return;const ke=await rP(Z.name,new Uint8Array(await Z.arrayBuffer()));await n.open(ke.name,ke.bytes)}async function he(ne){const Y=ne.target,Z=Y.files?.[0];Y.value="",Z&&await zD(l,Z)}async function Ye(ne){b.value&&!await sI(l,ne,{ownerDocument:b.value.ownerDocument,theme:s})&&"shape"in ne&&l.toaster.create({type:"error",title:"无法打开这个图形",description:"图形数据缺失、版本更新或已被其他程序改动。"})}async function et(ne,Y){const Z=ne.target,ke=Z.files?.[0];Z.value="",ke&&await FD(l,ke,Y)}const ct={m:"add-slide",b:"bold",i:"italic",u:"underline",l:"align-left",e:"align-center",r:"align-right",j:"align-justify","]":"size-increase","[":"size-decrease"},Be={">":"size-increase","<":"size-decrease",".":"size-increase",",":"size-decrease"};function Tn(ne){if(ne.target?.closest("input, textarea, [contenteditable='true']"))return;const Y=ne.metaKey||ne.ctrlKey;if(ne.key==="F5"&&!Y){ne.preventDefault(),ee(ne.shiftKey?"current":"start");return}if(!Y)return;const Z=ne.key.toLowerCase(),ke=ne.altKey?void 0:(ne.shiftKey?Be:ct)[Z];if(Z==="z")ne.shiftKey?n.redo():n.undo();else if(Z==="y")n.redo();else if(Z==="s")n.save();else if(Z==="o")w.value?.click();else if(ke)W(ke);else return;ne.preventDefault()}return ft(()=>{t.options.onSessionChange?.(n)}),Re(()=>{t.options.onSessionChange?.(void 0),n.destroy()}),(ne,Y)=>(x(),B(m(ti),{theme:m(s)},{default:A(()=>[y(m(Ya),{registry:m(Qs)},{default:A(()=>[y(m(fc),{target:b.value??void 0,strategy:"fixed"},{default:A(()=>[k("div",{ref_key:"root",ref:b,class:"pptx-app bg-qk-surface-workspace text-qk-text-primary qk-type-body",onKeydown:Tn},[y(TF,{tab:o.value,"onUpdate:tab":Y[0]||(Y[0]=Z=>o.value=Z),state:m(l),hosted:!!e.options.save,onOpen:Y[1]||(Y[1]=Z=>w.value?.click()),onPresent:ee},null,8,["tab","state","hosted"]),h.value?L("v-if",!0):(x(),B(dL,{key:0,state:m(l),tab:o.value,"open-panel":p.value,onIntent:W},null,8,["state","tab","open-panel"])),k("div",{class:"pptx-body","data-slides":!G.value&&(!u.value||h.value)?"hidden":void 0,"data-full-page":h.value||void 0,"data-panel":p.value===void 0?"none":p.value==="properties"||p.value==="animations"?p.value:m(I).some(Z=>Z.id===p.value)?"feature":"plugin"},[!G.value&&u.value&&!h.value?(x(),B($L,{key:0,state:m(l),onCollapse:Y[2]||(Y[2]=Z=>u.value=!1),onAdd:Y[3]||(Y[3]=Z=>W("add-slide")),onRemove:Y[4]||(Y[4]=Z=>W("delete-slide")),onMenu:Y[5]||(Y[5]=Z=>c.value=Z)},null,8,["state"])):L("v-if",!0),y(WD,{panel:p.value,layout:f.value,class:Ne({"pptx-split-wide":!!G.value})},{main:A(()=>[G.value?(x(),M("main",fI,[(x(),B(An(G.value),{state:m(l),host:P},null,8,["state"]))])):L("v-if",!0),ht(k("main",mI,[L(" A collapsed slide list leaves a button where it was, so it can be found again. "),!u.value&&!h.value?(x(),M("div",hI,[y(Se,{icon:"panelLeftOpen",label:"展开幻灯片列表",onClick:Y[6]||(Y[6]=Z=>u.value=!0)})])):L("v-if",!0),y(OV,{state:m(l),zoom:a.value,"show-animation-tags":o.value==="animation"||p.value==="animations",onDeleteShapes:Y[7]||(Y[7]=Z=>W("delete-shapes")),onScale:Y[8]||(Y[8]=Z=>i.value=Z||i.value),onIntent:W,onMenu:Y[9]||(Y[9]=Z=>c.value=Z)},null,8,["state","zoom","show-animation-tags"]),r.value?(x(),B(VD,{key:1,state:m(l)},null,8,["state"])):L("v-if",!0)],512),[[mt,!G.value]])]),side:A(()=>[ht(y(YF,{state:m(l),onDeleteShapes:Y[10]||(Y[10]=Z=>W("delete-shapes"))},null,8,["state"]),[[mt,p.value==="properties"]]),ht(y(pD,{state:m(l),onIntent:W,onClose:Y[11]||(Y[11]=Z=>p.value=void 0)},null,8,["state"]),[[mt,p.value==="animations"]]),(x(!0),M(U,null,H(m(I),Z=>ht((x(),M("aside",{key:Z.id,class:"pptx-feature-panel","aria-label":Z.label},[L(" A feature panel works only while it shows; hidden, it would follow every change for nothing. "),p.value===Z.id?(x(),B(An(Z.component),{key:0,state:m(l),host:P,onClose:Y[12]||(Y[12]=ke=>p.value=void 0)},null,40,["state"])):L("v-if",!0)],8,vI)),[[mt,p.value===Z.id]])),128)),(x(!0),M(U,null,H(m(d),Z=>(x(),B(BD,{key:Z.id,panel:Z,session:m(n),open:p.value===Z.id,render:m(l).render,picture:(ke,Et)=>m(wP)(m(l),ke,Et),layout:p.value===Z.id?f.value:"side",register:(ke,Et)=>m(D).set(ke,Et),onClose:Y[13]||(Y[13]=ke=>p.value=void 0),onLayout:ke=>v(Z.id,ke)},null,8,["panel","session","open","render","picture","layout","register","onLayout"]))),128))]),_:1},8,["panel","layout","class"]),y(UD,{active:p.value,panels:m(d),"feature-panels":m(I),onToggle:g},null,8,["active","panels","feature-panels"])],8,pI),c.value?(x(),B(UL,{key:1,state:m(l),request:c.value,onSelect:W,onClose:Y[14]||(Y[14]=Z=>c.value=void 0)},null,8,["state","request"])):L("v-if",!0),y(JV,{zoom:a.value,"onUpdate:zoom":Y[15]||(Y[15]=Z=>a.value=Z),notes:r.value,"onUpdate:notes":Y[16]||(Y[16]=Z=>r.value=Z),slides:u.value,"onUpdate:slides":Y[17]||(Y[17]=Z=>u.value=Z),state:m(l),scale:i.value,onPresent:Y[18]||(Y[18]=Z=>ee("current")),onReading:Y[19]||(Y[19]=Z=>W("show:reading"))},null,8,["zoom","notes","slides","state","scale"]),k("input",{ref_key:"fileInput",ref:w,type:"file",accept:".pptx,.potx,.ppsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.presentationml.template,application/vnd.openxmlformats-officedocument.presentationml.slideshow",hidden:"","aria-label":"打开演示文稿",onChange:te},null,544),k("input",{ref_key:"pictureInput",ref:S,type:"file",accept:"image/png,image/jpeg,image/gif",hidden:"","aria-label":"选择插入图片",onChange:he},null,544),k("input",{ref_key:"audioInput",ref:C,type:"file",accept:"audio/*,.mp3,.m4a,.wav",hidden:"","aria-label":"选择插入音频",onChange:Y[20]||(Y[20]=Z=>et(Z,"audio"))},null,544),k("input",{ref_key:"videoInput",ref:E,type:"file",accept:"video/*,.mp4,.mov",hidden:"","aria-label":"选择插入视频",onChange:Y[21]||(Y[21]=Z=>et(Z,"video"))},null,544),y(m(Hb),{toaster:m(l).toaster},null,8,["toaster"]),y(tI,{open:T.value.open,"onUpdate:open":Y[22]||(Y[22]=Z=>T.value.open=Z),state:m(l),shape:T.value.shape},null,8,["open","state","shape"]),y(dI,{open:z.value,"onUpdate:open":Y[23]||(Y[23]=Z=>z.value=Z),state:m(l)},null,8,["open","state"]),(x(!0),M(U,null,H(m(K),(Z,ke)=>(x(),B(An(Z),{key:ke,state:m(l),host:P},null,8,["state"]))),128))],544)]),_:1},8,["target"])]),_:1},8,["registry"])]),_:1},8,["theme"]))}});var bI=class{#e;#t;constructor(e={}){this.#e=e}mount(e){if(this.#t)throw new Error("PPTX 编辑器已挂载。");const t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error("找不到 PPTX 编辑器挂载容器。");this.#e.licenseKey!==void 0&&Ib(this.#e.licenseKey);const n=rc(gI,{options:this.#e});return n.mount(t),this.#t=n,this}destroy(){this.#t?.unmount(),this.#t=void 0}};export{bI as Editor};
|