efficient-office 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Documents-ISV66NLW.js +1 -0
- package/dist/Slides-JI73C3NW.js +1 -0
- package/dist/SlidesEditor-5WCXE27J.js +1 -0
- package/dist/Spreadsheet-I3RO4HSS.js +1 -0
- package/dist/chunk-3RFDQOTI.js +1 -0
- package/dist/chunk-4NKXNXKY.js +1 -0
- package/dist/chunk-6ZFEBY6H.js +1 -0
- package/dist/chunk-7K7AY3V3.js +1 -0
- package/dist/chunk-B2X3NIQR.js +1 -0
- package/dist/chunk-B32ASXHM.js +1 -0
- package/dist/chunk-B6JN7D6G.js +1 -0
- package/dist/{chunk-QSM7NWZ2.js → chunk-BGAR3P46.js} +1 -1
- package/dist/chunk-COXKOQPZ.js +1 -0
- package/dist/chunk-GLT7O6TV.js +1 -0
- package/dist/{chunk-E4N3DBYM.js → chunk-HU4RI2OM.js} +1 -1
- package/dist/chunk-I3AC6PYR.js +1 -0
- package/dist/chunk-JCSB2PHB.js +1 -0
- package/dist/{chunk-USKJW3BA.js → chunk-MDG2ADZ7.js} +1 -1
- package/dist/chunk-PMGQ5GUH.js +1 -0
- package/dist/chunk-PXOQN7D6.js +1 -0
- package/dist/chunk-Q7NVDOCX.js +1 -0
- package/dist/chunk-XYVQTQ6N.js +1 -0
- package/dist/{deckPdf-Q4OXQ7HV.js → deckPdf-4RC7QJ45.js} +1 -1
- package/dist/documents/documents.css +4 -0
- package/dist/documents/index.d.ts +22 -7
- package/dist/documents/index.js +1 -1
- package/dist/docxPdf-EW5I5JR3.js +1 -0
- package/dist/importDocument-274VK7OM.js +1 -0
- package/dist/importSpreadsheet-4U3KEJ76.js +1 -0
- package/dist/pptxImport-Y7TB6PYP.js +1 -0
- package/dist/slides/index.d.ts +534 -7
- package/dist/slides/index.js +1 -1
- package/dist/slides/slides.css +102 -0
- package/dist/spreadsheet/index.d.ts +62 -44
- package/dist/spreadsheet/index.js +1 -1
- package/dist/spreadsheet/spreadsheet.css +4 -0
- package/dist/words-DK_ajpEa.d.ts +67 -0
- package/dist/workbookPdf-C5SSN226.js +1 -0
- package/package.json +2 -2
- package/dist/Documents-HT324TAY.js +0 -1
- package/dist/Slides-EUDBOA5K.js +0 -1
- package/dist/SlidesEditor-6KDRHX4H.js +0 -1
- package/dist/Spreadsheet-SOF7NDLP.js +0 -1
- package/dist/chunk-2AKHYM66.js +0 -1
- package/dist/chunk-2PIEDEY5.js +0 -1
- package/dist/chunk-2TZUCKZ7.js +0 -1
- package/dist/chunk-3SRMKGQW.js +0 -1
- package/dist/chunk-AVUZSUQD.js +0 -1
- package/dist/chunk-SB3YS3LH.js +0 -1
- package/dist/chunk-XKOHIZO5.js +0 -1
- package/dist/chunk-YYHJJIA4.js +0 -1
- package/dist/docxPdf-NCSEKI4J.js +0 -1
- package/dist/options-Djr917yc.d.ts +0 -10
- package/dist/pptxImport-QEKBZWT2.js +0 -1
- package/dist/workbookPdf-OJDSHKRR.js +0 -1
package/dist/Slides-EUDBOA5K.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSlidesHost as e,useSlidesWords as i}from"./chunk-QSM7NWZ2.js";import"./chunk-SB3YS3LH.js";import{lazy as l,Suspense as t,useCallback as n,useEffect as s,useState as r}from"react";import{Button as c}from"efficient-shell/ui";import{Icon as o}from"efficient-shell/icons";import{confirmDestructive as d}from"efficient-shell";import{EmptyState as a}from"efficient-shell/ui";import{WindowTitle as m}from"efficient-shell";import{toast as h}from"efficient-shell";import{jsx as f,jsxs as p}from"react/jsx-runtime";var u=l(()=>import("./SlidesEditor-6KDRHX4H.js"));function k({id:l,onClose:o}){const d=i(),{store:m}=e(),[h,p]=r(null),[k,C]=r(!1),v=n(()=>{m.get(l).then(e=>p(i=>({deck:e,nonce:(i?.nonce??0)+1})),()=>C(!0))},[l,m]);return s(v,[v]),k?f("div",{className:"slides-list-empty",children:f(a,{title:d.openFailed,children:f(c,{onClick:o,children:d.backToDecks})})}):h?f(t,{fallback:null,children:f(u,{deck:h.deck,onClose:o,onReload:v},h.nonce)}):null}function C(){const l=i(),{store:t,canCreate:u=!0,canDelete:C=!0}=e(),[v,N]=r(null),[D,g]=r(null),y=n(()=>{t.list().then(g,()=>g([]))},[t]);if(s(y,[y]),v)return f(k,{id:v,onClose:()=>{N(null),y()}});const w=f(c,{disabled:!u,onClick:()=>{t.create(l.untitledDeck).then(e=>N(e.id),()=>h.error(l.createFailed))},children:l.newDeck});return p("div",{className:"slides-list",children:[f(m,{title:l.slidesPanel}),p("div",{className:"slides-list-head",children:[f("h2",{children:l.decks}),D&&D.length>0&&w]}),0===D?.length?f("div",{className:"slides-list-empty",children:f(a,{title:l.emptyTitle,description:l.emptyBody,children:w})}):f("ul",{className:"slides-list-rows",children:D?.map(e=>p("li",{className:"slides-list-row",children:[f(c,{variant:"link",onClick:()=>N(e.id),children:e.title}),f("span",{className:"slides-list-date",children:new Date(e.updatedAt).toLocaleDateString()}),C&&f(c,{variant:"ghost",leftIcon:f(o,{name:"trash",size:16}),onClick:async()=>{await d({message:l.deleteConfirm(e.title),confirmWord:l.delete})&&t.remove(e.id).then(y,()=>h.error(l.deleteFailed))},children:l.delete})]},e.id))})]})}export{k as OpenDeck,C as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SlidesConflict as e,useSlidesHost as t,useSlidesWords as n}from"./chunk-QSM7NWZ2.js";import{SlideView as l}from"./chunk-2AKHYM66.js";import{HANDLES as i,NO_FILL as a,SLIDE_H as s,SLIDE_W as r,alignElements as o,angleTo as d,asDocument as c,boundsOf as h,boxesTouch as u,bringForward as m,chartToText as p,copySlide as f,duplicateElements as v,historyReducer as b,insertSlideAfter as g,moveSlide as y,newElement as w,newSlide as x,removeElements as k,removeSlide as C,resizeBox as S,snapBox as N,tableToText as D,textToChart as z,textToTable as M,updateElements as I,updateSlide as T}from"./chunk-2TZUCKZ7.js";import"./chunk-SB3YS3LH.js";import{useCallback as P,useEffect as j,useReducer as A,useRef as E,useState as K}from"react";import{saveIndicator as L,useAutosave as R}from"efficient-easel/autosave";import{EaselIconButton as F,EaselTopBar as B,SaveState as W,TopBarCluster as H,TopBarDivider as U}from"efficient-easel/chrome";import{useEaselStrings as O}from"efficient-easel/strings";import"efficient-easel/shell.css";import"efficient-easel/chrome.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import{Button as $}from"efficient-shell/ui";import{IconButton as q}from"efficient-shell/ui";import{Input as _}from"efficient-shell/ui";import{Textarea as Y}from"efficient-shell/ui";import{Icon as Z}from"efficient-shell/icons";import{toast as V}from"efficient-shell";import{useEffect as X,useRef as Q,useState as G}from"react";import{Button as J}from"efficient-shell/ui";import{Icon as ee}from"efficient-shell/icons";import{useLayoutEffect as te,useState as ne}from"react";import{createPortal as le}from"react-dom";import{jsx as ie}from"react/jsx-runtime";function ae(e){const[t,n]=ne(0);return te(()=>{const t=e.current;if(!t)return;const l=t.ownerDocument.defaultView,i=()=>n(Math.min(t.clientWidth,t.clientHeight*r/s));i();const a=new(l?.ResizeObserver??ResizeObserver)(i);return a.observe(t),()=>a.disconnect()},[e]),t}function se({slide:e,popup:t}){const[n]=ne(()=>{const e=t.document.createElement("div");return e.style.cssText="position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#000;cursor:pointer",t.document.body.appendChild(e),{current:e}}),i=ae(n);return le(ie("div",{onClick:()=>{t.document.documentElement.requestFullscreen?.()},children:ie(l,{slide:e,width:i})}),n.current)}import{jsx as re,jsxs as oe}from"react/jsx-runtime";var de=e=>String(e).padStart(2,"0");function ce({slides:e,startIndex:t,popup:i,onEnd:a}){const[s,r]=G(t),o=function(){const[e,t]=G(0);return X(()=>{const e=Date.now(),n=setInterval(()=>t(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(n)},[]),`${de(Math.floor(e/60))}:${de(e%60)}`}(),d=n(),c=e.length-1,h=Q(null),u=ae(h),m=e=>r(Math.max(0,Math.min(e,c)));X(()=>{const e=e=>{["ArrowRight","ArrowDown","PageDown"," "].includes(e.key)?(e.preventDefault(),r(e=>Math.min(e+1,c))):["ArrowLeft","ArrowUp","PageUp"].includes(e.key)?(e.preventDefault(),r(e=>Math.max(e-1,0))):"Escape"===e.key&&a()};return window.addEventListener("keydown",e),i?.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e),i?.removeEventListener("keydown",e)}},[c,a,i]),X(()=>{if(i)return()=>i.close()},[i]);const p=e[s],f=e[s+1];return oe("div",{className:"slides-presenter",children:[oe("div",{className:"slides-presenter-head",children:[re("span",{className:"slides-presenter-clock",children:o}),re("span",{children:d.slideOf(s+1,e.length)}),re(J,{variant:"secondary",onClick:a,leftIcon:re(ee,{name:"close",size:16}),children:d.endShow})]}),!i&&re("p",{className:"slides-presenter-blocked",children:d.popupBlocked}),oe("div",{className:"slides-presenter-body",children:[oe("div",{className:"slides-presenter-main",children:[re("div",{ref:h,className:"slides-presenter-current",children:re(l,{slide:p,width:u})}),oe("div",{className:"slides-presenter-steps",children:[re(J,{variant:"secondary",onClick:()=>m(s-1),leftIcon:re(ee,{name:"arrow-left",size:16}),children:d.back}),re(J,{variant:"secondary",onClick:()=>m(s+1),rightIcon:re(ee,{name:"arrow-right",size:16}),children:d.next})]})]}),oe("div",{className:"slides-presenter-side",children:[re("p",{className:"slides-presenter-label",children:d.nextSlide}),f?re(l,{slide:f,width:280}):re("p",{children:d.endOfDeck}),re("p",{className:"slides-presenter-label",children:d.notes}),re("p",{className:"slides-presenter-notes",children:p.notes||d.noNotes})]})]}),i&&re(se,{slide:p,popup:i})]})}import{useState as he}from"react";import{SettingsColour as ue}from"efficient-easel/panel";import{Button as me}from"efficient-shell/ui";import{IconButton as pe}from"efficient-shell/ui";import{Input as fe}from"efficient-shell/ui";import{Select as ve}from"efficient-shell/ui";import{Textarea as be}from"efficient-shell/ui";import{Icon as ge}from"efficient-shell/icons";import{jsx as ye,jsxs as we}from"react/jsx-runtime";var xe=e=>e===a?"#ffffff":e;function ke({label:e,value:t,onChange:n}){return we("label",{className:"slides-number",children:[ye("span",{children:e}),ye(fe,{type:"number",value:Math.round(t),onChange:e=>{const t=Number(e.target.value);""!==e.target.value&&Number.isFinite(t)&&n(t)}})]})}function Ce({label:e,hint:t,value:n,onChange:l}){const[i,a]=he(null);return we("label",{className:"slides-field",children:[ye("span",{children:e}),ye(be,{rows:5,value:i??n,onFocus:()=>a(n),onBlur:()=>a(null),onChange:e=>{a(e.target.value),l(e.target.value)}}),ye("small",{children:t})]})}function Se({slide:e,selected:l,onChangeSlide:i,onChangeSelected:a,onAlign:s,onForward:r,onDelete:o}){const d=n(),{pickImage:c}=t();if(0===l.length)return we("aside",{className:"slides-inspector",children:[ye("h3",{children:d.slide}),ye("div",{className:"slides-section",children:ye(ue,{label:d.background,value:e.background,onChange:e=>i({background:e})})})]});const h=1===l.length?l[0]:null,u={text:d.elementText,shape:d.elementShape,image:d.elementImage,chart:d.elementChart,table:d.elementTable},m=e=>a(t=>({...t,...e}));return we("aside",{className:"slides-inspector",children:[ye("h3",{children:h?u[h.type]:d.objects(l.length)}),h&&we("div",{className:"slides-section",children:[ye("p",{className:"slides-label",children:d.positionAndSize}),we("div",{className:"slides-numbers",children:[ye(ke,{label:"X",value:h.x,onChange:e=>m({x:e})}),ye(ke,{label:"Y",value:h.y,onChange:e=>m({y:e})}),ye(ke,{label:d.width,value:h.w,onChange:e=>m({w:Math.max(20,e)})}),ye(ke,{label:d.height,value:h.h,onChange:e=>m({h:Math.max(20,e)})}),ye(ke,{label:d.angle,value:h.rotation,onChange:e=>m({rotation:e})})]})]}),we("div",{className:"slides-section",children:[ye("p",{className:"slides-label",children:d.align}),we("div",{className:"slides-actions",children:[ye(pe,{"aria-label":d.alignLeft,onClick:()=>s("left"),children:ye(ge,{name:"align-left",size:16})}),ye(pe,{"aria-label":d.alignCentre,onClick:()=>s("center"),children:ye(ge,{name:"align-center",size:16})}),ye(pe,{"aria-label":d.alignRight,onClick:()=>s("right"),children:ye(ge,{name:"align-right",size:16})}),ye(pe,{"aria-label":d.bringForward,onClick:r,children:ye(ge,{name:"layers",size:16})}),ye(pe,{"aria-label":d.delete,onClick:o,children:ye(ge,{name:"trash",size:16})})]})]}),"text"===h?.type&&we("div",{className:"slides-section",children:[ye("div",{className:"slides-numbers",children:ye(ke,{label:d.size,value:h.fontSize,onChange:e=>m({fontSize:Math.max(8,e)})})}),ye(ve,{"aria-label":d.weight,value:h.bold?"bold":"regular",onChange:e=>m({bold:"bold"===e}),options:[{value:"regular",label:d.regular},{value:"bold",label:d.bold}]}),ye(ve,{"aria-label":d.textAlignment,value:h.align,onChange:e=>m({align:e}),options:[{value:"left",label:d.left},{value:"center",label:d.centre},{value:"right",label:d.right}]}),ye(ue,{label:d.colour,value:h.color,onChange:e=>m({color:e})})]}),"shape"===h?.type&&we("div",{className:"slides-section",children:[ye(ve,{"aria-label":d.elementShape,value:h.shape,onChange:e=>m({shape:e}),options:[{value:"rect",label:d.rectangle},{value:"roundRect",label:d.roundedRectangle},{value:"ellipse",label:d.ellipse},{value:"diamond",label:d.diamond},{value:"line",label:d.lineShape}]}),"line"!==h.shape&&ye(ue,{label:d.colour,value:xe(h.fill),onChange:e=>m({fill:e})}),(h.stroke||"line"===h.shape)&&ye(ue,{label:d.outlineColour,value:xe(h.stroke??h.fill),onChange:e=>m({stroke:e})})]}),"image"===h?.type&&we("div",{className:"slides-section",children:[c?ye(me,{variant:"secondary",block:!0,onClick:()=>{const{id:e}=h;c().then(t=>{t&&a(n=>n.id===e?{...n,src:t}:n)})},children:d.chooseImage}):we("label",{className:"slides-field",children:[ye("span",{children:d.imageAddress}),ye(fe,{value:h.src,onChange:e=>m({src:e.target.value})})]}),we("label",{className:"slides-field",children:[ye("span",{children:d.description}),ye(fe,{value:h.alt,onChange:e=>m({alt:e.target.value})})]})]}),"chart"===h?.type&&we("div",{className:"slides-section",children:[ye("p",{className:"slides-label",children:d.data}),ye(ve,{"aria-label":d.chartType,value:h.kind,onChange:e=>m({kind:e}),options:[{value:"bar",label:d.bar},{value:"line",label:d.line}]}),ye(Ce,{label:d.values,hint:d.valuesHint,value:p(h.points),onChange:e=>m({points:z(e)})}),ye(ue,{label:d.colour,value:h.color,onChange:e=>m({color:e})})]}),"table"===h?.type&&we("div",{className:"slides-section",children:[ye(Ce,{label:d.rows,hint:d.rowsHint,value:D(h.rows),onChange:e=>m({rows:M(e)})}),ye(ue,{label:d.headingColour,value:xe(h.headerFill),onChange:e=>m({headerFill:e})})]})]})}import{useState as Ne}from"react";import{Button as De}from"efficient-shell/ui";import{IconButton as ze}from"efficient-shell/ui";import{Icon as Me}from"efficient-shell/icons";import{jsx as Ie,jsxs as Te}from"react/jsx-runtime";function Pe({slides:e,currentId:t,onShow:i,onAdd:a,onMove:s,onDuplicate:r,onDelete:o}){const[d,c]=Ne(null),h=n();return Te("nav",{className:"slides-rail","aria-label":h.slidesPanel,children:[e.map((e,n)=>Te("div",{className:"slides-thumb","data-current":e.id===t||void 0,draggable:!0,onDragStart:()=>c(e.id),onDragEnd:()=>c(null),onDragOver:e=>e.preventDefault(),onDrop:()=>{d&&d!==e.id&&s(d,n),c(null)},children:[Ie("span",{className:"slides-thumb-number",children:n+1}),Ie("div",{role:"button",tabIndex:0,"aria-label":h.slideNumber(n+1),"aria-current":e.id===t,className:"slides-thumb-image",onClick:()=>i(e.id),onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),i(e.id))},children:Ie(l,{slide:e,width:132})}),e.id===t&&Te("div",{className:"slides-thumb-actions",children:[Ie(ze,{"aria-label":h.duplicateSlide,size:"sm",onClick:()=>r(e.id),children:Ie(Me,{name:"copy",size:14})}),Ie(ze,{"aria-label":h.deleteSlide,size:"sm",onClick:()=>o(e.id),children:Ie(Me,{name:"trash",size:14})})]})]},e.id)),Ie(De,{variant:"secondary",block:!0,onClick:a,children:h.addSlide})]})}import{useLayoutEffect as je,useRef as Ae,useState as Ee}from"react";import{Fragment as Ke,jsx as Le,jsxs as Re}from"react/jsx-runtime";var Fe={x:[],y:[]};function Be({element:e,onDone:t}){const l=Ae(null),i=n();return je(()=>{const t=l.current;t&&(t.innerText=e.text,t.focus(),document.getSelection()?.selectAllChildren(t))},[e.text]),Le("div",{ref:l,contentEditable:"plaintext-only",role:"textbox","aria-label":i.slideText,suppressContentEditableWarning:!0,className:"slides-text-edit",onPointerDown:e=>e.stopPropagation(),onBlur:e=>t(e.currentTarget.innerText),onKeyDown:e=>{e.stopPropagation(),"Escape"===e.key&&e.currentTarget.blur()},style:{fontSize:e.fontSize,fontWeight:e.bold?600:400,color:e.color,textAlign:e.align}})}function We({slide:e,selected:t,onSelect:n,onLive:a,onSettle:o,onCommit:c}){const m=Ae(null),[p,f]=Ee(0),[v,b]=Ee(Fe),[g,y]=Ee(null),[w,x]=Ee(null),k=Ae(null);je(()=>{const e=m.current;if(!e)return;const t=()=>{f(Math.max(0,Math.min(e.clientWidth-48,(e.clientHeight-48)*r/s)))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);const C=p/r,D=Ae(null),z=e=>{const t=D.current?.getBoundingClientRect();return{x:(e.clientX-(t?.left??0))/C,y:(e.clientY-(t?.top??0))/C}},M=(t,n)=>{for(let l=e.elements.length-1;l>=0;l-=1){const i=e.elements[l],a=-i.rotation*Math.PI/180,s=t-(i.x+i.w/2),r=n-(i.y+i.h/2),o=s*Math.cos(a)-r*Math.sin(a),d=s*Math.sin(a)+r*Math.cos(a);if(Math.abs(o)<=i.w/2&&Math.abs(d)<=i.h/2)return i}return null},T=(e,t)=>{e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),k.current=t},P=l=>{const i=k.current;if(!i)return;const{x:s,y:r}=z(l);if("marquee"===i.kind){const t={x:Math.min(i.px,s),y:Math.min(i.py,r),w:Math.abs(s-i.px),h:Math.abs(r-i.py)};y(t),n(new Set(e.elements.filter(e=>u(t,e)).map(e=>e.id)))}else if("move"===i.kind){const e=i.start.elements.filter(e=>t.has(e.id)),n=i.start.elements.filter(e=>!t.has(e.id)),o=h(e),d={...o,x:o.x+s-i.px,y:o.y+r-i.py},c=l.altKey?{box:d,guides:Fe}:N(d,n);b(c.guides);const u=c.box.x-o.x,m=c.box.y-o.y;a(I(i.start,t,e=>({...e,x:e.x+u,y:e.y+m})))}else"resize"===i.kind?a(I(i.start,new Set([i.id]),e=>{const t=-e.rotation*Math.PI/180,n=s-i.px,a=r-i.py,o=n*Math.cos(t)-a*Math.sin(t),d=n*Math.sin(t)+a*Math.cos(t);return{...e,...S(e,i.handle,o,d,l.shiftKey)}})):a(I(i.start,new Set([i.id]),e=>({...e,rotation:d(e,s,r,l.shiftKey)})))},j=()=>{const e=k.current;k.current=null,b(Fe),y(null),e&&"marquee"!==e.kind&&o()},A=1===t.size?e.elements.find(e=>t.has(e.id)):void 0,E=e.elements.filter(e=>t.has(e.id)),K=e.elements.find(e=>e.id===w&&"text"===e.type);return Le("div",{ref:m,className:"slides-pane",children:Re("div",{ref:D,className:"slides-stage",style:{width:p,height:p*s/r},onPointerDown:l=>{if(0!==l.button)return;const{x:i,y:a}=z(l),s=M(i,a);if(!s)return l.shiftKey||n(new Set),void T(l,{kind:"marquee",px:i,py:a});let r=t;if(l.shiftKey){const e=new Set(t);e.has(s.id)?e.delete(s.id):e.add(s.id),r=e,n(e)}else t.has(s.id)||(r=new Set([s.id]),n(r));r.has(s.id)&&T(l,{kind:"move",start:e,px:i,py:a})},onPointerMove:P,onPointerUp:j,onPointerCancel:j,onDoubleClick:e=>{const{x:t,y:n}=z(e),l=M(t,n);"text"===l?.type&&x(l.id)},children:[Le(l,{slide:e,width:p,editingId:K?.id,editor:K&&Le(Be,{element:K,onDone:t=>{x(null),t!==K.text&&c(I(e,new Set([K.id]),e=>({...e,text:t})))}})}),!K&&E.map(t=>Le("div",{className:"slides-selection",style:{left:t.x*C,top:t.y*C,width:t.w*C,height:t.h*C,transform:t.rotation?`rotate(${t.rotation}deg)`:void 0},children:A?.id===t.id&&Re(Ke,{children:[i.map(n=>Le("div",{className:`slides-handle slides-handle-${n}`,onPointerDown:l=>T(l,{kind:"resize",start:e,id:t.id,handle:n,...He(z(l))}),onPointerMove:P,onPointerUp:j,onPointerCancel:j},n)),Le("div",{className:"slides-rotate-stem"}),Le("div",{className:"slides-rotate",onPointerDown:n=>T(n,{kind:"rotate",start:e,id:t.id}),onPointerMove:P,onPointerUp:j,onPointerCancel:j})]})},t.id)),v.x.map(e=>Le("div",{className:"slides-guide slides-guide-x",style:{left:e*C}},`x${e}`)),v.y.map(e=>Le("div",{className:"slides-guide slides-guide-y",style:{top:e*C}},`y${e}`)),g&&Le("div",{className:"slides-marquee",style:{left:g.x*C,top:g.y*C,width:g.w*C,height:g.h*C}})]})})}var He=({x:e,y:t})=>({px:e,py:t}),Ue=13.333,Oe=e=>e/r*Ue,$e=e=>e.replace("#","").toUpperCase(),qe=e=>Math.round(72*Oe(e));function _e(e){return`${e.replace(/[^\p{L}\p{N} _-]+/gu," ").replace(/ +/g," ").trim()||"Deck"}.pptx`}var Ye=e=>e===a?{type:"none"}:{color:$e(e)},Ze=e=>e.stroke?{color:$e(e.stroke),width:qe(e.strokeWidth??1)}:void 0;function Ve(e,t,n){const{columnWidths:l,rowHeights:i,fontSize:a}=t;e.addTable(t.rows.map((e,n)=>e.map((e,l)=>function(e,t,n,l){const i=e.cellFills?.[n]?.[l]??(0===n?e.headerFill:null),a=e.cellColors?.[n]?.[l]??(0===n?e.headerColor:void 0);return{text:t,options:{...0===n?{bold:!0}:{},...i?{fill:Ye(i)}:{},...a?{color:$e(a)}:{}}}}(t,e,n,l))),{...n,border:{type:"solid",color:"B4B2A9",pt:1},...a?{fontSize:qe(a)}:{},...l?{colW:l.map(e=>e*n.w)}:{},...i?{rowH:i.map(Oe)}:{}})}function Xe(e,t,n){const l={x:Oe(n.x),y:Oe(n.y),w:Oe(n.w),h:Oe(n.h),rotate:n.rotation};switch(n.type){case"text":t.addText(n.text,{...l,fontSize:qe(n.fontSize),bold:n.bold,color:$e(n.color),align:n.align,valign:"top",margin:0});break;case"shape":!function(e,t,n,l){if("line"===n.shape)return void t.addShape(e.ShapeType.line,{...l,y:l.y+l.h/2,h:0,line:{color:$e(n.stroke??n.fill),width:qe(n.strokeWidth??1),beginArrowType:n.arrowStart?"triangle":"none",endArrowType:n.arrowEnd?"triangle":"none"}});const i={rect:e.ShapeType.rect,ellipse:e.ShapeType.ellipse,roundRect:e.ShapeType.roundRect,diamond:e.ShapeType.diamond};t.addShape(i[n.shape],{...l,fill:Ye(n.fill),line:Ze(n),rectRadius:"roundRect"===n.shape&&void 0!==n.radius?Oe(n.radius):void 0})}(e,t,n,l);break;case"image":n.src&&t.addImage({...l,path:n.src,altText:n.alt});break;case"chart":t.addChart("line"===n.kind?e.ChartType.line:e.ChartType.bar,[{name:"Series",labels:n.points.map(e=>e.label),values:n.points.map(e=>e.value)}],{...l,chartColors:[$e(n.color)],showValue:!0,showLegend:!1});break;case"table":Ve(t,n,l)}}async function Qe(e,t){const n=await async function(e,t){const{default:n}=await(import("pptxgenjs")),l=new n;l.defineLayout({name:"SLIDE_16_9",width:Ue,height:7.5}),l.layout="SLIDE_16_9",l.title=e;for(const e of t.slides){const t=l.addSlide();t.background={color:$e(e.background)},e.notes&&t.addNotes(e.notes);for(const n of e.elements)Xe(l,t,n)}return l}(e,t);await n.writeFile({fileName:_e(e)})}import{jsx as Ge,jsxs as Je}from"react/jsx-runtime";var et=[{type:"text",labelKey:"addText",icon:"type"},{type:"shape",labelKey:"addShape",icon:"square"},{type:"image",labelKey:"addImage",icon:"image"},{type:"chart",labelKey:"addChart",icon:"chart-bar"},{type:"table",labelKey:"addTable",icon:"table"}];function tt({deck:l,onClose:i,onReload:a}){const s=n(),{store:r}=t(),[d,h]=K(l.title),[u,p]=A(b,void 0,()=>({past:[],present:c(l.document),future:[]})),S=u.present,[N,D]=K(S.slides[0].id),[z,M]=K(new Set),[X,Q]=K(!0),[G,J]=K(null),ee=S.slides.find(e=>e.id===N)??S.slides[0],te=S.slides.indexOf(ee),ne=E(l.version),[le,ie]=K(!1),ae=O(),se=R({save:async e=>{ne.current=await r.save(l.id,e,ne.current)},onFailure:(t,n)=>{t instanceof e?(se.stop(),ie(!0)):0===n&&V.error(s.saveFailed)}}),re=E(S),{push:oe,flush:de}=se;j(()=>{S!==re.current&&(re.current=S,oe(S))},[S,oe]),j(()=>()=>{de()},[de]);const he=P(e=>p({type:"commit",doc:e}),[]),ue=e=>he(T(S,ee.id,()=>e)),me=E(null),pe=e=>{D(e),M(new Set)},fe=()=>{ue(k(ee,z)),M(new Set)};return Je("div",{className:"es-editor slides-editor",onKeyDown:e=>{if(G)return;if(e.target.closest('input, textarea, select, [contenteditable], [role="listbox"]'))return;const t=e.metaKey||e.ctrlKey;if(t&&"z"===e.key.toLowerCase())e.preventDefault(),p({type:e.shiftKey?"redo":"undo"});else if(t&&"y"===e.key.toLowerCase())e.preventDefault(),p({type:"redo"});else if(t&&"a"===e.key.toLowerCase())e.preventDefault(),M(new Set(ee.elements.map(e=>e.id)));else if(t&&"d"===e.key.toLowerCase()&&z.size>0){e.preventDefault();const t=v(ee,z);ue(t.slide),M(new Set(t.ids))}else if(("Delete"===e.key||"Backspace"===e.key)&&z.size>0)e.preventDefault(),fe();else if("Escape"===e.key)M(new Set);else if(e.key.startsWith("Arrow")&&z.size>0){e.preventDefault();const t=e.shiftKey?1:10,n="ArrowLeft"===e.key?-t:"ArrowRight"===e.key?t:0,l="ArrowUp"===e.key?-t:"ArrowDown"===e.key?t:0;ue(I(ee,z,e=>({...e,x:e.x+n,y:e.y+l})))}},tabIndex:-1,children:[Je(B,{children:[Je(H,{children:[Ge(F,{label:s.backToDecks,onClick:i,children:Ge(Z,{name:"chevron-left",size:16})}),Ge(F,{label:s.slidesPanel,state:X?"active":"inactive",onClick:()=>Q(e=>!e),children:Ge(Z,{name:"bars-3-bottom-left",size:16})}),Ge("div",{className:"slides-title",children:Ge(_,{"aria-label":s.deckName,value:d,onChange:e=>h(e.target.value),onBlur:()=>{const e=d.trim();e&&e!==l.title?r.rename(l.id,e).catch(()=>V.error(s.renameFailed)):h(e||l.title)}})}),Ge(W,{...L(se.state,ae.save)}),Ge(U,{}),Ge(F,{label:s.undo,disabled:0===u.past.length,onClick:()=>p({type:"undo"}),children:Ge(Z,{name:"undo",size:16})}),Ge(F,{label:s.redo,disabled:0===u.future.length,onClick:()=>p({type:"redo"}),children:Ge(Z,{name:"redo",size:16})})]}),Je(H,{kind:"right",children:[Ge($,{variant:"secondary",leftIcon:Ge(Z,{name:"download",size:16}),onClick:()=>Qe(d,S).catch(()=>V.error(s.exportFailed)),children:s.export}),Ge($,{leftIcon:Ge(Z,{name:"play",size:16}),onClick:()=>{const e=window.open("about:blank","_blank","popup,width=1280,height=720");e&&(e.document.title=d),J({popup:e})},children:s.present})]})]}),le&&Je("div",{className:"slides-conflict",role:"alert",children:[Ge("span",{children:s.conflict}),Ge($,{variant:"secondary",onClick:a,children:s.reload})]}),Je("div",{className:"slides-body",children:[X&&Ge(Pe,{slides:S.slides,currentId:ee.id,onShow:pe,onAdd:()=>{const e=x();he(g(S,ee.id,e)),pe(e.id)},onMove:(e,t)=>he(y(S,e,t)),onDuplicate:e=>{const t=S.slides.find(t=>t.id===e);if(!t)return;const n=f(t);he(g(S,e,n)),pe(n.id)},onDelete:e=>{const t=C(S,e);he(t),e===ee.id&&pe(t.slides[Math.min(te,t.slides.length-1)].id)}}),Je("div",{className:"slides-centre",children:[Ge("div",{className:"slides-toolbar",children:et.map(({type:e,labelKey:t,icon:n})=>Ge(q,{"aria-label":s[t],onClick:()=>(e=>{const t=w(e);ue({...ee,elements:[...ee.elements,t]}),M(new Set([t.id]))})(e),children:Ge(Z,{name:n,size:16})},e))}),Ge(We,{slide:ee,selected:z,onSelect:M,onLive:e=>{me.current??=S,p({type:"live",doc:T(me.current,ee.id,()=>e)})},onSettle:()=>{me.current&&p({type:"settle",from:me.current}),me.current=null},onCommit:ue},ee.id),Je("label",{className:"slides-notes",children:[Ge("span",{children:s.speakerNotes}),Ge(Y,{rows:2,value:ee.notes,onChange:e=>ue({...ee,notes:e.target.value})})]})]}),Ge(Se,{slide:ee,selected:ee.elements.filter(e=>z.has(e.id)),onChangeSlide:e=>ue({...ee,...e}),onChangeSelected:e=>ue(I(ee,z,e)),onAlign:e=>ue(o(ee,z,e)),onForward:()=>ue(m(ee,z)),onDelete:fe})]}),G&&Ge(ce,{slides:S.slides,startIndex:te,popup:G.popup,onEnd:()=>J(null)})]})}export{tt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readXlsx as e,writeXlsx as t}from"./chunk-N26CBJZA.js";import{SpreadsheetsConflict as r,sheetsOf as n,useSpreadsheetWords as o,useSpreadsheetsHost as l}from"./chunk-YYHJJIA4.js";import"./chunk-2PIEDEY5.js";import{DEFAULT_COL_WIDTH as a,DEFAULT_FONT_SIZE as i,DEFAULT_ROW_HEIGHT as c,FUNCTION_NAMES as s,MAX_COLS as u,MAX_ROWS as d,NUMBER_FORMATS as f,adjustDecimals as h,applyBorders as m,cellDisplay as g,cellLabel as p,changeStructure as v,clearValues as w,colLabel as x,columnValues as b,commitEntry as y,copyClip as C,cycleRefAbsolute as k,dataRegion as N,deleteSheet as S,duplicateSheet as D,editText as R,expandForMerges as E,fillRange as M,filteredRows as T,findCells as z,formatKey as A,formatNumber as F,isFormula as I,makeEvaluator as O,mergeRange as L,mergedAt as P,moveCells as $,newSheet as U,nextSheetName as B,normalizeRange as K,parseCsv as H,parseRangeLabel as W,pasteClip as X,printRef as Y,rangeContains as V,rangeLabel as G,rawAt as j,readEntry as _,renameSheet as Z,replaceInCell as J,selectionStats as Q,serializeCsv as q,sheetFromRows as ee,shiftFormula as te,sortRange as re,tokenize as ne,unmergeRange as oe,updateFormats as le,usedBounds as ae,withFormat as ie,writeCells as ce}from"./chunk-VKCG3LPQ.js";import{FileList as se}from"./chunk-3SRMKGQW.js";import{useCallback as ue,useEffect as de,useMemo as fe,useRef as he,useState as me}from"react";import{saveIndicator as ge,useAutosave as pe}from"efficient-easel/autosave";import{SaveState as ve}from"efficient-easel/chrome";import"efficient-easel/chrome.css";import{useEaselStrings as we}from"efficient-easel/strings";import{WindowTitle as xe,useBrowserLayoutEffect as be,useWindowDirty as ye}from"efficient-shell";import{Icon as Ce}from"efficient-shell/icons";import{Button as ke,Checkbox as Ne,ColorPickerPanel as Se,ContextMenu as De,DropdownMenu as Re,EmptyState as Ee,IconButton as Me,Input as Te,LoadingSpinner as ze,Popover as Ae,PopupMenu as Fe,PopupMenuDivider as Ie,PopupMenuItem as Oe,confirmDestructive as Le,registerModalEscapeInterceptor as Pe,toDateKey as $e,toast as Ue,useContextMenu as Be}from"efficient-shell/ui";import{SPREADSHEET_PREVIEW_UPDATE_EVENT as Ke,peekSpreadsheetPreviewStage as He,claimSpreadsheetPreviewStage as We}from"efficient-shell/apps";import{forwardRef as Xe,useCallback as Ye,useEffect as Ve,useImperativeHandle as Ge,useMemo as je,useRef as _e,useState as Ze}from"react";import{Icon as Je}from"efficient-shell/icons";import{jsx as Qe,jsxs as qe}from"react/jsx-runtime";var et,tt=46,rt=24,nt=4/3;function ot(e,t){const r=new Float64Array(e+1);for(let n=0;n<e;n++)r[n+1]=r[n]+t(n);return r}function lt(e,t){let r=0,n=e.length-2;for(;r<n;){const o=r+n+1>>1;e[o]<=t?r=o:n=o-1}return r}function at(e,t){if(void 0===et)try{et=document.createElement("canvas").getContext("2d")}catch{et=null}const r=(t?.fontSize??i)*nt;return et?(et.font=`${t?.italic?"italic ":""}${t?.bold?"bold ":""}${r}px system-ui, sans-serif`,et.measureText(e).width):e.length*r*.55}var it=Xe(function({sheet:e,sheetIndex:t,evaluator:r,filterHidden:n,selection:l,showGridlines:s,showFormulas:u,clipRange:d,highlights:f,pointing:h,onSelect:m,onPoint:p,onEdit:v,onFill:w,onResizeCol:b,onResizeRow:y,onAutoFitCol:C,onAutoFitRow:k,onHeaderMenu:N,onFilterButton:S,renderEditor:D,onKeyDown:R,onCopy:M,onCut:T,onPaste:z},F){const I=o(),O=_e(null),[L,$]=Ze({x:0,y:0}),[U,B]=Ze({width:1e3,height:600}),[H,W]=Ze(null),[X,Y]=Ze(null),[V,G]=Ze(null);Ve(()=>{const e=O.current;if(!e)return;const t=()=>{e.clientWidth&&e.clientHeight&&B({width:e.clientWidth,height:e.clientHeight})};if(t(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]);const _=je(()=>{const n=new Map;for(const[o,l]of Object.entries(e.formats)){if(!l.fontSize&&!l.wrap)continue;const[s,u]=o.split(":").map(Number);if(void 0!==e.rowHeights[s])continue;const d=(l.fontSize??i)*nt*1.4;let f=1;if(l.wrap&&""!==j(e,s,u)){const n=(e.colWidths[u]??a)-8;f=g(e,t,r,s,u).text.split("\n").reduce((e,t)=>e+Math.max(1,Math.ceil(at(t,l)/Math.max(n,1))),0)}const h=Math.ceil(d*f+6);h>(n.get(s)??c)&&n.set(s,h)}return n},[e,t,r]),Z=je(()=>new Set(e.hiddenRows),[e.hiddenRows]),J=je(()=>new Set(e.hiddenCols),[e.hiddenCols]),Q=je(()=>ot(e.rowCount,t=>Z.has(t)||n.has(t)?0:X?.row===t?X.height:e.rowHeights[t]??_.get(t)??c),[e.rowCount,e.rowHeights,Z,n,_,X]),q=je(()=>ot(e.colCount,t=>J.has(t)?0:H?.col===t?H.width:e.colWidths[t]??a),[e.colCount,e.colWidths,J,H]),ee=Math.min(e.frozenRows,e.rowCount),te=Math.min(e.frozenCols,e.colCount),re=Q[ee],ne=q[te],oe=q[e.colCount],le=Q[e.rowCount],ae=Ye(e=>tt+q[e]-(e>=te?L.x:0),[q,te,L.x]),ie=Ye(e=>rt+Q[e]-(e>=ee?L.y:0),[Q,ee,L.y]),ce=Ye(e=>{const t=O.current;if(!t)return;const r=t.clientWidth-tt-ne,n=t.clientHeight-rt-re;let{scrollLeft:o,scrollTop:l}=t;if(e.col>=te){const t=q[e.col]-ne,n=q[e.col+1]-ne;t<o?o=t:n>o+r&&(o=n-r)}if(e.row>=ee){const t=Q[e.row]-re,r=Q[e.row+1]-re;t<l?l=t:r>l+n&&(l=r-n)}t.scrollTo(o,l)},[q,Q,ne,re,te,ee]);Ge(F,()=>({focus:()=>O.current?.focus({preventScroll:!0}),scrollTo:ce,measureColumn:n=>{let o=0;for(let l=0;l<e.cells.length;l++){if(""===j(e,l,n))continue;const a=e.formats[A(l,n)];o=Math.max(o,at(g(e,t,r,l,n).text,a))}return Math.ceil(o+8+4)}}),[ce,e,t,r]);const se=Ye((e,t)=>{const r=O.current.getBoundingClientRect(),n=e-r.left-tt,o=t-r.top-rt,l=n<ne?n:n+O.current.scrollLeft,a=o<re?o:o+O.current.scrollTop;return{row:lt(Q,Math.max(0,Math.min(a,le-1))),col:lt(q,Math.max(0,Math.min(l,oe-1)))}},[q,Q,ne,re,oe,le]),ue=Ye((e,t)=>{const r=O.current,n=t=>{const n=r.getBoundingClientRect();t.clientY>n.bottom-4?r.scrollBy(0,24):t.clientY<n.top+rt&&r.scrollBy(0,-24),t.clientX>n.right-4?r.scrollBy(24,0):t.clientX<n.left+tt&&r.scrollBy(-24,0),e(t)},o=e=>{window.removeEventListener("pointermove",n),window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o),t(e)};window.addEventListener("pointermove",n),window.addEventListener("pointerup",o),window.addEventListener("pointercancel",o)},[]),de=Ye((t,r)=>{const n=E(e,K(t,r));m({active:t,range:n})},[e,m]),fe=Math.max(0,U.width-tt-ne),he=Math.max(0,U.height-rt-re),me=lt(Q,re+L.y),ge=lt(q,ne+L.x),pe=Math.min(e.rowCount-1,lt(Q,re+L.y+he)),ve=Math.min(e.colCount-1,lt(q,ne+L.x+fe)),we=(n,o,l,a)=>{const c=[],d=[],f=new Set,h=(n,o,l)=>{const a=A(n,o);if(f.has(a))return;f.add(a);const h=l?l.r2:n,m=l?l.c2:o,p=q[o],v=Q[n],w=q[m+1]-p,x=Q[h+1]-v;if(w<=0||x<=0)return;const b=e.formats[a],y=j(e,n,o),C=u&&"="===y[0]?{text:y,color:null,align:"left",error:!1}:g(e,t,r,n,o),k=b?.border,N="1px solid var(--ink)",S=!!b?.fill||!!k||!!l,D=s?"1px solid var(--line-subtle)":"1px solid transparent",R={position:"absolute",left:p,top:v,width:w,height:x,boxSizing:"border-box",borderRight:k?.right?N:D,borderBottom:k?.bottom?N:D,borderTop:k?.top?N:void 0,borderLeft:k?.left?N:void 0,background:b?.fill??(l?"var(--surface)":void 0)};if((S||s)&&c.push(Qe("div",{style:R},`b${a}`)),!C.text)return;const E=b?.align??C.align;let M=C.text;"string"==typeof M&&!C.error&&"right"===C.align&&!b?.wrap&&at(M,b)>w-4&&(M="#".repeat(Math.max(1,Math.floor(w/8))));let T=w,z=0;if(!l&&!b?.wrap&&"left"===C.align&&at(M,b)>w-8){if("left"===E||"center"===E)for(let t=o+1;t<=Math.min(o+40,e.colCount-1)&&(""===j(e,n,t)&&!P(e,n,t));t++)T+=q[t+1]-q[t];if("right"===E||"center"===E)for(let t=o-1;t>=Math.max(o-40,0)&&(""===j(e,n,t)&&!P(e,n,t));t--)z+=q[t+1]-q[t]}const F=b?.vAlign??"bottom",I=C.error?"var(--danger-text)":C.color??b?.color;d.push(Qe("div",{"data-cell":a,className:"pointer-events-none",style:{position:"absolute",left:p-z,top:v,width:T+z,height:x,boxSizing:"border-box",padding:"0 4px",overflow:"hidden",display:"flex",alignItems:"top"===F?"flex-start":"middle"===F?"center":"flex-end",justifyContent:b?.wrap?void 0:"right"===E?"flex-end":"center"===E?"center":"flex-start",textAlign:E,whiteSpace:b?.wrap?"pre-wrap":"pre",wordBreak:b?.wrap?"break-word":void 0,fontSize:(b?.fontSize??i)*nt,lineHeight:1.3,paddingBottom:"bottom"===F?2:void 0,fontWeight:b?.bold?700:void 0,fontStyle:b?.italic?"italic":void 0,textDecoration:[b?.underline?"underline":"",b?.strike?"line-through":""].join(" ").trim()||void 0,color:I},children:Qe("span",{style:b?.wrap?{width:"100%"}:void 0,children:M})},`t${a}`))};for(let t=n;t<=o;t++)for(let r=l;r<=a;r++){const n=P(e,t,r);(!n||n.r1===t&&n.c1===r)&&h(t,r,n)}for(const t of e.merges)(t.r1<n||t.c1<l)&&t.r2>=n&&t.r1<=o&&t.c2>=l&&t.c1<=a&&h(t.r1,t.c1,t);return[...c,...d]},xe=(t,r,n,o)=>{const a=[],i=(e,l,i,c)=>{e.r2<t||e.r1>r||e.c2<n||e.c1>o||a.push(Qe("div",{style:{position:"absolute",boxSizing:"border-box",pointerEvents:"none",left:q[e.c1],top:Q[e.r1],width:q[e.c2+1]-q[e.c1],height:Q[e.r2+1]-Q[e.r1],...i},children:c},l))},c=l.range,s=c.r1!==c.r2||c.c1!==c.c2,u=P(e,l.active.row,l.active.col),h=!!u&&u.r1===c.r1&&u.r2===c.r2&&u.c1===c.c1&&u.c2===c.c2;return i(c,"sel",{background:s&&!h?"color-mix(in srgb, var(--accent-fill) 12%, transparent)":void 0,border:"2px solid var(--accent-fill)"}),V&&i(V,"fill",{border:"1px dashed var(--ink-muted)"}),d&&i(d,"clip",{border:"2px dashed var(--accent-fill)"}),f.forEach((e,t)=>i(e.range,`ref${t}`,{border:`2px solid ${e.color}`,background:`color-mix(in srgb, ${e.color} 10%, transparent)`})),a},be=[];ee&&te&&be.push({key:"corner",left:tt,top:rt,width:ne,height:re,offsetX:0,offsetY:0,r1:0,r2:ee-1,c1:0,c2:te-1}),ee&&be.push({key:"top",left:tt+ne,top:rt,width:fe,height:re,offsetX:L.x,offsetY:0,r1:0,r2:ee-1,c1:ge,c2:ve}),te&&be.push({key:"left",left:tt,top:rt+re,width:ne,height:he,offsetX:0,offsetY:L.y,r1:me,r2:pe,c1:0,c2:te-1}),be.push({key:"main",left:tt+ne,top:rt+re,width:fe,height:he,offsetX:L.x,offsetY:L.y,r1:me,r2:pe,c1:ge,c2:ve});const ye=l.range,Ce=[];for(let e=0;e<te;e++)Ce.push(e);for(let e=ge;e<=ve;e++)Ce.push(e);const ke=[];for(let e=0;e<ee;e++)ke.push(e);for(let e=me;e<=pe;e++)ke.push(e);const Ne=0===ye.r1&&ye.r2===e.rowCount-1,Se=0===ye.c1&&ye.c2===e.colCount-1,De="absolute flex items-center justify-center select-none text-xs border-r border-b border-line",Re="bg-accent-tint text-accent-text",Ee="bg-surface-sunken text-ink-muted",Me=ye.r2<ee||ye.r2>=me,Te=ae(ye.c2+1),ze=ie(ye.r2+1),Ae=Me&&!h&&Te>=tt&&ze>=rt&&Te<=U.width&&ze<=U.height,Fe=P(e,l.active.row,l.active.col)??{r1:l.active.row,c1:l.active.col,r2:l.active.row,c2:l.active.col},Ie={x:ae(Fe.c1),y:ie(Fe.r1),width:q[Fe.c2+1]-q[Fe.c1],height:Q[Fe.r2+1]-Q[Fe.r1],viewportWidth:U.width,viewportHeight:U.height},{filter:Oe}=e,Le=Oe?.range.r1??-1,Pe=[];if(Oe&&(Le<ee||Le>=me&&Le<=pe))for(let e=Oe.range.c1;e<=Oe.range.c2;e++)q[e+1]>q[e]&&(e<te||e>=ge&&e<=ve)&&Pe.push(e);return Qe("div",{ref:O,tabIndex:0,role:"grid","aria-label":e.name,"aria-rowcount":e.rowCount,"aria-colcount":e.colCount,className:"relative h-full w-full overflow-auto outline-none bg-surface text-ink",onScroll:e=>$({x:e.currentTarget.scrollLeft,y:e.currentTarget.scrollTop}),onKeyDown:R,onCopy:M,onCut:T,onPaste:z,children:Qe("div",{style:{width:tt+oe,height:rt+le},children:qe("div",{className:"sticky top-0 left-0 overflow-hidden",style:{width:U.width,height:U.height},children:[qe("div",{className:"absolute inset-0",onPointerDown:t=>{if(0!==t.button)return;const r=se(t.clientX,t.clientY);if(h)return t.preventDefault(),p(K(r,r),!1),void ue(e=>p(K(r,se(e.clientX,e.clientY)),!1),e=>p(K(r,se(e.clientX,e.clientY)),!0));if(O.current?.focus({preventScroll:!0}),t.detail>=2)return t.preventDefault(),void v(r);const n=t.shiftKey?l.active:P(e,r.row,r.col)?{row:P(e,r.row,r.col).r1,col:P(e,r.row,r.col).c1}:r;de(n,r),ue(e=>de(n,se(e.clientX,e.clientY)),()=>{})},onContextMenu:e=>N(e,"cell",se(e.clientX,e.clientY)),children:[be.map(e=>Qe("div",{className:"absolute overflow-hidden",style:{left:e.left,top:e.top,width:e.width,height:e.height},children:qe("div",{className:"absolute",style:{left:-e.offsetX,top:-e.offsetY,width:oe,height:le},children:[we(e.r1,e.r2,e.c1,e.c2),xe(e.r1,e.r2,e.c1,e.c2)]})},e.key)),re>0&&Qe("div",{className:"absolute bg-line-strong pointer-events-none",style:{left:0,right:0,top:rt+re-1,height:2}}),ne>0&&Qe("div",{className:"absolute bg-line-strong pointer-events-none",style:{top:0,bottom:0,left:tt+ne-1,width:2}})]}),Pe.map(e=>{const t=ae(e+1),r=ie(Le),n=Q[Le+1]-Q[Le],o=(Oe?.excluded[e]?.length??0)>0;return Qe("button",{type:"button","aria-label":I.filterColumn(x(e)),onClick:t=>{t.stopPropagation(),S(e,t.currentTarget.getBoundingClientRect())},onPointerDown:e=>e.stopPropagation(),className:`absolute flex items-center justify-center rounded border ${o?"":"border-line"} ${o?"border-accent-fill bg-accent-tint":"bg-surface hover:bg-surface-sunken"}`,style:{left:t-19,top:r+Math.max(0,(n-17)/2),width:17,height:17},children:Qe(Je,{name:"filter",size:11})},e)}),Ae&&Qe("div",{"aria-label":I.fillHandle,className:"absolute bg-accent-fill border border-surface cursor-crosshair",style:{left:Te-5,top:ze-5,width:8,height:8},onPointerDown:e=>{e.preventDefault(),e.stopPropagation();const t=l.range;let r=null;ue(e=>{r=(e=>{const r=se(e.clientX,e.clientY);return(r.row>t.r2?r.row-t.r2:r.row<t.r1?t.r1-r.row:0)>=(r.col>t.c2?r.col-t.c2:r.col<t.c1?t.c1-r.col:0)?{...t,r1:Math.min(t.r1,r.row),r2:Math.max(t.r2,r.row)}:{...t,c1:Math.min(t.c1,r.col),c2:Math.max(t.c2,r.col)}})(e),G(r)},()=>{G(null),!r||r.r1===t.r1&&r.r2===t.r2&&r.c1===t.c1&&r.c2===t.c2||w(r)})}}),Qe("div",{className:"absolute top-0 overflow-hidden bg-surface-sunken",style:{left:tt,right:0,height:rt},children:Ce.map(t=>{const r=q[t+1]-q[t];if(r<=0)return null;const n=q[t]-(t>=te?L.x:0),o=t>=ye.c1&&t<=ye.c2;return qe("div",{className:`${De} ${o?Re:Ee} ${o&&Ne?"font-semibold":""}`,style:{left:n,top:0,width:r,height:rt},onPointerDown:r=>((t,r)=>{if(0!==t.button)return;O.current?.focus({preventScroll:!0});const n=t.shiftKey?l.active.col:r,o=t=>{const r={r1:0,c1:Math.min(n,t),r2:e.rowCount-1,c2:Math.max(n,t)};m({active:{row:0,col:n},range:r})};o(r),ue(e=>o(se(e.clientX,e.clientY).col),()=>{})})(r,t),onContextMenu:e=>N(e,"col",{row:0,col:t}),children:[x(t),Qe("div",{className:"absolute top-0 bottom-0 cursor-col-resize",style:{right:-3,width:7},onPointerDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const r=e.clientX,n=q[t+1]-q[t],o=e=>Math.max(16,Math.round(n+e.clientX-r));ue(e=>W({col:t,width:o(e)}),e=>{W(null),o(e)!==n&&b(t,o(e))})})(e,t),onDoubleClick:e=>{e.stopPropagation(),C(t)}})]},t)})}),Qe("div",{className:"absolute left-0 overflow-hidden bg-surface-sunken",style:{top:rt,bottom:0,width:tt},children:ke.map(t=>{const r=Q[t+1]-Q[t];if(r<=0)return null;const n=Q[t]-(t>=ee?L.y:0),o=t>=ye.r1&&t<=ye.r2;return qe("div",{className:`${De} ${o?Re:Ee} ${o&&Se?"font-semibold":""}`,style:{left:0,top:n,width:tt,height:r},onPointerDown:r=>((t,r)=>{if(0!==t.button)return;O.current?.focus({preventScroll:!0});const n=t.shiftKey?l.active.row:r,o=t=>{const r={r1:Math.min(n,t),c1:0,r2:Math.max(n,t),c2:e.colCount-1};m({active:{row:n,col:0},range:r})};o(r),ue(e=>o(se(e.clientX,e.clientY).row),()=>{})})(r,t),onContextMenu:e=>N(e,"row",{row:t,col:0}),children:[t+1,Qe("div",{className:"absolute left-0 right-0 cursor-row-resize",style:{bottom:-3,height:7},onPointerDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const r=e.clientY,n=Q[t+1]-Q[t],o=e=>Math.max(12,Math.round(n+e.clientY-r));ue(e=>Y({row:t,height:o(e)}),e=>{Y(null),o(e)!==n&&y(t,o(e))})})(e,t),onDoubleClick:e=>{e.stopPropagation(),k(t)}})]},t)})}),Qe("div",{role:"button","aria-label":I.selectAll,className:`${De} top-0 left-0 cursor-pointer bg-surface-sunken hover:bg-line`,style:{width:tt,height:rt},onPointerDown:t=>{t.preventDefault(),O.current?.focus({preventScroll:!0}),m({active:{row:0,col:0},range:{r1:0,c1:0,r2:e.rowCount-1,c2:e.colCount-1}})},onContextMenu:e=>N(e,"corner",{row:0,col:0})}),D?.(Ie)]})})})}),ct=["#000000","#434343","#666666","#999999","#cccccc","#efefef","#ffffff","#c00000","#ff0000","#ffc000","#ffff00","#92d050","#00b050","#00b0f0","#0070c0","#002060","#7030a0","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#d9d2e9","#ead1dc"],st=["#1a73e8","#d93025","#7b1fa2","#188038","#e37400","#c5221f"];function ut(e,t){let r=!1;for(let n=0;n<t;n++)'"'===e[n]&&(r=!r);return r}function dt(e,t){if("="!==e[0]||ut(e,t))return null;const r=/[A-Za-z][A-Za-z0-9.]*$/.exec(e.slice(0,t));if(!r)return null;if("!"===e[r.index-1]||"("===e[t])return null;const n=r[0].toUpperCase(),o=s.filter(e=>e.startsWith(n));return o.length?{start:r.index,prefix:n,matches:o.slice(0,8)}:null}var ft={ABS:"value",AND:"condition1, [condition2, ...]",AVERAGE:"value1, [value2, ...]",AVERAGEIF:"range, criterion, [average_range]",AVERAGEIFS:"average_range, range1, criterion1, ...",CEILING:"value, [factor]","CEILING.MATH":"value, [factor]",CHOOSE:"index, choice1, [choice2, ...]",COLUMN:"[cell]",COLUMNS:"range",CONCAT:"value1, [value2, ...]",CONCATENATE:"value1, [value2, ...]",COS:"angle",COUNT:"value1, [value2, ...]",COUNTA:"value1, [value2, ...]",COUNTBLANK:"range",COUNTIF:"range, criterion",COUNTIFS:"range1, criterion1, ...",DATE:"year, month, day",DATEDIF:"start, end, unit",DAY:"date",DAYS:"end, start",EDATE:"start, months",EOMONTH:"start, months",EXACT:"text1, text2",EXP:"value",FIND:"find, within, [start]",FLOOR:"value, [factor]","FLOOR.MATH":"value, [factor]",FV:"rate, periods, payment, [present], [type]",HLOOKUP:"key, range, row, [approximate]",HOUR:"time",IF:"condition, if_true, [if_false]",IFERROR:"value, [if_error]",IFNA:"value, [if_na]",IFS:"condition1, value1, ...",INDEX:"range, row, [column]",INT:"value",ISBLANK:"value",ISERROR:"value",ISLOGICAL:"value",ISNA:"value",ISNUMBER:"value",ISTEXT:"value",LARGE:"range, k",LEFT:"text, [count]",LEN:"text",LN:"value",LOG:"value, [base]",LOG10:"value",LOWER:"text",MATCH:"key, range, [type]",MAX:"value1, [value2, ...]",MEDIAN:"value1, [value2, ...]",MID:"text, start, count",MIN:"value1, [value2, ...]",MINUTE:"time",MOD:"value, divisor",MODE:"value1, [value2, ...]","MODE.SNGL":"value1, [value2, ...]",MONTH:"date",N:"value",NA:"",NETWORKDAYS:"start, end, [holidays]",NOT:"condition",NOW:"",NPV:"rate, value1, [value2, ...]",OR:"condition1, [condition2, ...]",PI:"",PMT:"rate, periods, present, [future], [type]",POWER:"value, exponent",PRODUCT:"value1, [value2, ...]",PROPER:"text",PV:"rate, periods, payment, [future], [type]",RAND:"",RANDBETWEEN:"low, high",RANK:"value, range, [ascending]","RANK.EQ":"value, range, [ascending]",REPLACE:"text, start, count, new",REPT:"text, count",RIGHT:"text, [count]",ROUND:"value, [places]",ROUNDDOWN:"value, [places]",ROUNDUP:"value, [places]",ROW:"[cell]",ROWS:"range",SEARCH:"find, within, [start]",SECOND:"time",SIGN:"value",SIN:"angle",SMALL:"range, k",SQRT:"value",STDEV:"value1, [value2, ...]","STDEV.P":"value1, [value2, ...]","STDEV.S":"value1, [value2, ...]",STDEVP:"value1, [value2, ...]",SUBSTITUTE:"text, find, new, [occurrence]",SUM:"value1, [value2, ...]",SUMIF:"range, criterion, [sum_range]",SUMIFS:"sum_range, range1, criterion1, ...",SUMPRODUCT:"range1, [range2, ...]",SWITCH:"value, case1, result1, ..., [default]",TAN:"angle",TEXT:"value, format",TEXTJOIN:"delimiter, skip_blank, value1, ...",TIME:"hour, minute, second",TODAY:"",TRIM:"text",TRUNC:"value, [places]",UPPER:"text",VALUE:"text",VAR:"value1, [value2, ...]","VAR.P":"value1, [value2, ...]","VAR.S":"value1, [value2, ...]",VARP:"value1, [value2, ...]",VLOOKUP:"key, range, column, [approximate]",WEEKDAY:"date, [type]",XLOOKUP:"key, lookup_range, result_range, [if_not_found], [match_mode]",XOR:"condition1, [condition2, ...]",YEAR:"date"};import{Fragment as ht,jsx as mt,jsxs as gt}from"react/jsx-runtime";var pt=[8,9,10,11,12,14,16,18,20,24,28,36],vt="undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform),wt=vt?"⌘":"Ctrl+";function xt(e,t,r){const n=URL.createObjectURL(new Blob([e],{type:t})),o=document.createElement("a");o.href=n,o.download=r,o.click(),URL.revokeObjectURL(n)}var bt=".csv,.tsv,.txt,.xlsx,.xls,.ods";function yt({spreadsheetId:e,onClose:t}){const r=o(),{store:n,canCreate:a=!0,canDelete:i=!0}=l(),[c]=me(()=>null!=He()),[s,u]=me(null);return!n||c?mt(St,{onClose:t}):e?mt(kt,{store:n,id:e,onClose:t}):s?.id?mt(kt,{store:n,id:s.id,onClose:()=>u(null)},s.key):s?.file?mt(St,{initialFile:s.file,hasStore:!0,onClose:()=>u(null)},s.key):mt(se,{words:{windowTitle:r.filesHeading,heading:r.filesHeading,newFile:r.newFile,openFile:r.openFile,emptyTitle:r.filesEmptyTitle,emptyBody:r.filesEmptyBody,delete:r.deleteFile,deleteConfirm:r.deleteConfirm,createFailed:r.createFailed,deleteFailed:r.deleteFailed},list:n.list,create:()=>n.create(r.untitled),remove:n.remove,canCreate:a,canDelete:i,accept:bt,onOpen:e=>u({key:Date.now(),id:e}),onOpenFile:e=>u({key:Date.now(),file:e})})}function Ct({id:e,onClose:t}){return mt(yt,{spreadsheetId:e,onClose:t})}function kt({store:e,id:t,onClose:r,pane:n}){const l=o(),[a,i]=me(null),[c,s]=me(!1),u=ue(()=>{s(!1),e.get(t).then(e=>i(t=>({kept:e,nonce:(t?.nonce??0)+1})),()=>s(!0))},[t,e]);return de(u,[u]),c?mt("div",{className:"office-open-failed",children:mt(Ee,{title:l.storedOpenFailed,children:r&&mt(ke,{onClick:r,children:l.backToFiles})})}):a?mt(St,{stored:{store:e,...a.kept},onClose:r,onReload:u,pane:n},a.nonce):mt(ze,{size:"sm",padding:"",className:"h-full",label:l.loading})}function Nt({initial:e,spreadsheetId:t,bridge:r,onSaveToFiles:n}){const{store:o}=l(),a=fe(()=>({bridge:r,onSaveToFiles:n}),[r,n]);return o&&t?mt(kt,{store:o,id:t,pane:a}):mt(St,{initial:e??{rows:[],filename:""},pane:a})}function St({stored:l,initialFile:a,hasStore:c,onClose:s,onReload:g,initial:x,pane:se}){const Ee=o(),ze=he(void 0);void 0===ze.current&&(ze.current=l?null:x?{token:-1,data:x}:He());const Xe=he(ze.current?.data??null),[Ye]=me(()=>{const e=ze.current;if(!e)return null;const t=Dt(e.data,Ee.sheetName(1));return t?{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}:-1===e.token&&e.data.filename?{sheet:U(Ee.sheetName(1)),title:e.data.filename}:null}),[Ve,Ge]=me(()=>l?n(l.workbook,Ee.sheetName(1)):Ye?[Ye.sheet]:[U(Ee.sheetName(1))]),[je,_e]=me(0),[Ze,Je]=me(l?.title??Ye?.title??Ee.untitled),[Qe,qe]=me(()=>ze.current?.data.onEmail),et=he(Ve),tt=he([]),rt=he([]),[,nt]=me(0),ot=ue(e=>{const t=et.current,r=e(t);r!==t&&(tt.current.push(t),tt.current.length>100&&tt.current.shift(),rt.current=[],et.current=r,Ge(r),nt(e=>e+1))},[]),lt=ue(e=>{tt.current=[],rt.current=[],et.current=e,Ge(e),_e(0),nt(e=>e+1)},[]),at=ue(()=>{const e=tt.current.pop();e&&(rt.current.push(et.current),et.current=e,Ge(e),_e(t=>Math.min(t,e.length-1)),nt(e=>e+1))},[]),yt=ue(()=>{const e=rt.current.pop();e&&(tt.current.push(et.current),et.current=e,Ge(e),_e(t=>Math.min(t,e.length-1)),nt(e=>e+1))},[]),Ct=he(Ve),kt=he(l?.version??""),Nt=he(l?.title??""),[St,Rt]=me(!1),Et=we(),Mt=pe({save:async e=>{l&&(kt.current=await l.store.save(l.id,{sheets:e},kt.current))},onFailure:(e,t)=>{e instanceof r?(Mt.stop(),Rt(!0)):0===t&&Ue.error(Ee.saveFailed)}}),{push:Tt,flush:zt}=Mt,At=he(Ve);de(()=>{l&&Ve!==At.current&&(At.current=Ve,Tt(Ve))},[Tt,Ve,l]),de(()=>()=>{zt()},[zt]),ye(l?Mt.state.pending||St:Ve!==Ct.current);const Ft=ue(e=>{const t=Dt(e,Ee.sheetName(1));t&&(lt([t]),Ct.current=et.current,Je(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),qe(()=>e.onEmail))},[lt,Ee]);de(()=>{const e=ze.current;null!=e&&(We(e),e.data!==Xe.current&&Ft(e.data))},[]),de(()=>{const e=ze.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&Ft(r.data)};return window.addEventListener(Ke,t),()=>window.removeEventListener(Ke,t)},[]);const It=Math.min(je,Ve.length-1),Ot=Ve[It],Lt=fe(()=>O(Ve),[Ve]),Pt=fe(()=>T(Ot,It,Lt),[Ot,It,Lt]),$t=he(null),Ut=he(null),[Bt,Kt]=me({}),Ht=Bt[Ot.id]??{active:{row:0,col:0},range:{r1:0,c1:0,r2:0,c2:0}},Wt=he(je);Wt.current=je;const Xt=ue(e=>{Kt(t=>({...t,[et.current[Math.min(Wt.current,et.current.length-1)].id]:e}))},[]),Yt=Ht.active,Vt=Ot.formats[A(Yt.row,Yt.col)]??{},Gt=j(Ot,Yt.row,Yt.col),[jt,_t]=me(null),Zt=he(jt);Zt.current=jt;const[Jt,Qt]=me(null),[qt,er]=me(!0),[tr,rr]=me(!1),[nr,or]=me(null),[lr,ar]=me(null),[ir,cr]=me(!1),[sr,ur]=me(null),[dr,fr]=me(null),[hr,mr]=me(!1),[gr,pr]=me(""),[vr,wr]=me(""),[xr,br]=me({matchCase:!1,wholeCell:!1,inFormulas:!1}),yr=he(null),Cr=he(null),kr=he(null),Nr=Be(),Sr=Be(),Dr=ue(()=>{$t.current?.focus(),setTimeout(()=>{const e=document.activeElement;e&&e!==document.body&&!e.closest("[aria-haspopup]")||$t.current?.focus()},0)},[]),Rr=ue(e=>{ot(t=>{const r=Math.min(Wt.current,t.length-1),n=e(t[r]);return n===t[r]?t:t.map((e,t)=>t===r?n:e)})},[ot]),Er=he(null),Mr=he(()=>!1);de(()=>Pe(()=>!!Er.current?.contains(document.activeElement)&&Mr.current()),[]);const Tr=ue(e=>Ot.hiddenRows.includes(e)||Pt.has(e),[Ot.hiddenRows,Pt]),zr=ue(e=>Ot.hiddenCols.includes(e),[Ot.hiddenCols]),Ar=ue(e=>{const t=P(Ot,e.row,e.col),r=t??{r1:e.row,c1:e.col,r2:e.row,c2:e.col};Xt({active:t?{row:t.r1,col:t.c1}:e,range:r}),$t.current?.scrollTo(e)},[Ot,Xt]),Fr=ue((e,t,r)=>{let{row:n,col:o}=e;const l=P(Ot,n,o);l&&(t>0&&(n=l.r2),t<0&&(n=l.r1),r>0&&(o=l.c2),r<0&&(o=l.c1));do{n+=t,o+=r}while(n>=0&&n<Ot.rowCount&&o>=0&&o<Ot.colCount&&(Tr(n)||zr(o)));return n<0||n>=Ot.rowCount||o<0||o>=Ot.colCount?e:{row:n,col:o}},[Ot,Tr,zr]),Ir=ue((e,t,r)=>{const n=e=>""!==j(Ot,e.row,e.col);let o=e,l=Fr(o,t,r);if(l===o)return o;if(n(o)&&n(l)){for(;n(l);)if(o=l,l=Fr(o,t,r),l===o)return o;return o}for(;!n(l);)if(o=l,l=Fr(o,t,r),l===o)return o;return l},[Ot,Fr]),Or=ue(e=>{const t=E(Ot,K(Ht.active,e));Xt({active:Ht.active,range:t}),$t.current?.scrollTo(e)},[Ot,Ht.active,Xt]),Lr=ue(()=>{const{range:e,active:t}=Ht;return{row:t.row===e.r1?e.r2:e.r1,col:t.col===e.c1?e.c2:e.c1}},[Ht]),Pr=he(null),$r=ue((e,t={})=>{const r=j(Ot,e.row,e.col),n=t.text??R(r,Ot.formats[A(e.row,e.col)]);Qt(e=>e?.cut?null:e),t.inBar||null!==Pr.current||(Pr.current=n.length),_t({sheetId:Ot.id,row:e.row,col:e.col,text:n,mode:t.mode??(void 0!==t.text?"enter":"edit"),inBar:!!t.inBar,caret:n.length,pick:null,suggestion:0})},[Ot]),Ur=ue(e=>{const t=Zt.current;if(!t)return!1;Zt.current=null,_t(null),ot(r=>{const n=r.findIndex(e=>e.id===t.sheetId);if(n<0)return r;const o=r[n];if(t.text===R(j(o,t.row,t.col),o.formats[A(t.row,t.col)])&&!e)return r;let l=o;if(e)for(let r=e.r1;r<=e.r2;r++)for(let n=e.c1;n<=e.c2;n++){const e=I(t.text)?te(_(t.text).raw,r-t.row,n-t.col):t.text;l=y(l,r,n,e)}else l=y(l,t.row,t.col,t.text);return r.map((e,t)=>t===n?l:e)});const r=et.current.findIndex(e=>e.id===t.sheetId);return r>=0&&r!==Wt.current&&_e(r),!0},[ot]),Br=ue(()=>{const e=Zt.current;if(Zt.current=null,_t(null),e){const t=et.current.findIndex(t=>t.id===e.sheetId);t>=0&&t!==Wt.current&&_e(t)}Dr()},[Dr]),Kr=ue((e,t)=>{Ar(Fr(Ht.active,e,t)),Dr()},[Dr,Ar,Ht.active,Fr]);be(()=>{if(!jt)return;const e=jt.inBar?yr.current:Cr.current;e&&(document.activeElement!==e&&e.focus({preventScroll:!0}),null!==Pr.current&&(e.setSelectionRange(Pr.current,Pr.current),Pr.current=null))},[jt]);const Hr=ue((e,t)=>{_t(r=>r?{...r,text:e,caret:t,pick:null,suggestion:0}:r)},[]),Wr=jt?.sheetId===Ot.id,Xr=jt?dt(jt.text,jt.caret):null,Yr=jt?function(e,t){if("="!==e[0])return null;const r=[];let n=!1;for(let o=1;o<t;o++){const t=e[o];if('"'===t&&(n=!n),!n)if("("===t){const t=/([A-Za-z][A-Za-z0-9.]*)$/.exec(e.slice(1,o));r.push({name:t?t[1].toUpperCase():"",argIndex:0})}else")"===t?r.pop():","!==t&&";"!==t||!r.length||r[r.length-1].argIndex++}for(let e=r.length-1;e>=0;e--)if(r[e].name)return r[e];return null}(jt.text,jt.caret):null,Vr=!!jt&&(null!==jt.pick||function(e,t){if("="!==e[0]||ut(e,t))return!1;const r=e.slice(0,t).trimEnd(),n=e.slice(t).trimStart()[0];return!(void 0!==n&&!/[,;)+\-*/^&=<>%]/.test(n))&&/[=(,;+\-*/^&<>]$/.test(r)}(jt.text,jt.caret)),Gr=fe(()=>jt?function(e,t,r,n,o){if("="!==e[0])return[];const l=[];let a=0;for(const i of ne(e.slice(1)).tokens){if("ref"!==i.type)continue;const e=st[a++%st.length];if(!(null===i.ref.sheet?r:i.ref.sheet.toLowerCase()===t.toLowerCase()))continue;const c=i.ref.b??i.ref.a,s=K({row:i.ref.a.row??0,col:i.ref.a.col??0},{row:c.row??n-1,col:c.col??o-1});l.push({range:s,color:e})}return l}(jt.text,Ot.name,Wr,Ot.rowCount,Ot.colCount):[],[jt,Ot.name,Ot.rowCount,Ot.colCount,Wr]),jr=ue((e,t)=>{const r=Zt.current;if(!r)return;const n=Y({sheet:r.sheetId===et.current[Wt.current].id?null:et.current[Wt.current].name,a:{row:e.r1,col:e.c1,rowAbs:!1,colAbs:!1},b:e.r1===e.r2&&e.c1===e.c2?null:{row:e.r2,col:e.c2,rowAbs:!1,colAbs:!1}}),o=r.pick?.start??r.caret,l=r.pick?.end??r.caret,a=r.text.slice(0,o)+n+r.text.slice(l),i=o+n.length;Pr.current=i,_t({...r,text:a,caret:i,pick:t?null:{start:o,end:i}})},[]),_r=ue(e=>{const t=Zt.current,r=t?dt(t.text,t.caret):null;if(!t||!r)return;const n=function(e,t,r,n){const o=`${n}(`;return{text:e.slice(0,r)+o+e.slice(t),caret:r+o.length}}(t.text,t.caret,r.start,e);Pr.current=n.caret,_t({...t,text:n.text,caret:n.caret,suggestion:0,pick:null})},[]),Zr=e=>{if(jt){if(e.stopPropagation(),Xr){if("ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=Xr.matches.length;return void _t({...jt,suggestion:(jt.suggestion+("ArrowDown"===e.key?1:t-1))%t})}if("Tab"===e.key||"Enter"===e.key&&jt.suggestion>0)return e.preventDefault(),void _r(Xr.matches[jt.suggestion])}if("Enter"===e.key){if(e.altKey){e.preventDefault();const{selectionStart:t,selectionEnd:r,value:n}=e.currentTarget,o=`${n.slice(0,t)}\n${n.slice(r)}`;return Pr.current=t+1,void Hr(o,t+1)}return e.preventDefault(),e.ctrlKey||e.metaKey?(Ur(Ht.range),void Dr()):(Ur(),void Kr(e.shiftKey?-1:1,0))}if("Tab"===e.key)return e.preventDefault(),Ur(),void Kr(0,e.shiftKey?-1:1);if("F4"===e.key){e.preventDefault();const t=function(e,t){if("="!==e[0])return null;const r=t-1;for(const t of ne(e.slice(1)).tokens){if("ref"!==t.type||r<t.start||r>t.end)continue;const n={...t.ref,a:k(t.ref.a),b:t.ref.b?k(t.ref.b):null},o=Y(n);return{text:`=${e.slice(1,t.start+1)}${o}${e.slice(t.end+1)}`,caret:t.start+1+o.length}}return null}(jt.text,e.currentTarget.selectionStart);return void(t&&(Pr.current=t.caret,Hr(t.text,t.caret)))}"enter"!==jt.mode||jt.inBar||I(jt.text)||!e.key.startsWith("Arrow")||(e.preventDefault(),Ur(),Kr("ArrowDown"===e.key?1:"ArrowUp"===e.key?-1:0,"ArrowRight"===e.key?1:"ArrowLeft"===e.key?-1:0))}},Jr=e=>{const t=e.currentTarget.selectionStart;_t(e=>e&&e.caret!==t?{...e,caret:t,pick:null}:e)},Qr=ue(e=>{Ur(),e(),Dr()},[Ur,Dr]),qr=he(Ht);qr.current=Ht;const en=se?.bridge,tn=he(Ze);tn.current=Ze;const rn=Bt[Ot.id]?Ht:null,nn=he(rn);nn.current=rn,de(()=>{if(en)return en.attach({sheets:()=>et.current,activeSheet:()=>Math.min(Wt.current,et.current.length-1),title:()=>tn.current||Ee.untitled,selection:()=>nn.current?{sheet:Math.min(Wt.current,et.current.length-1),range:nn.current.range}:null,commit:e=>ot(()=>e),undoLast:at})},[en,ot,Ee,at]),de(()=>{en?.changed()},[en,rn,It,Ve,Ze]);const on=ue(e=>{Qr(()=>Rr(t=>le(t,qr.current.range,e)))},[Qr,Rr]),ln=ue(e=>{const t=!Vt[e];on(r=>ie(r,e,t||void 0))},[Vt,on]),an=ue(e=>{on(t=>ie(t,"numFmt","General"===e?void 0:e))},[on]),cn=ue(e=>{const t=Lt.value(It,Yt.row,Yt.col),r=h(Vt.numFmt??"General",e,"number"==typeof t?t:null);an(r)},[Yt,Vt.numFmt,Lt,It,an]),sn=ue((e,t)=>{const{range:r}=Ht,[n,o]="row"===e?[r.r1,r.r2]:[r.c1,r.c2],l="row"===e?Ot.rowCount:Ot.colCount,a=o-n+1>=l?1:o-n+1;l+a>("row"===e?d:u)||Qr(()=>ot(r=>v(r,It,e,t?o+1:n,a)))},[Ot.colCount,Ot.rowCount,ot,It,Qr,Ht]),un=ue(e=>{const{range:t}=Ht,[r,n]="row"===e?[t.r1,t.r2]:[t.c1,t.c2],o="row"===e?Ot.rowCount:Ot.colCount,l=Math.min(n-r+1,o-1);l<1||Qr(()=>{ot(t=>v(t,It,e,r,-l)),Ar({row:"row"===e?Math.min(r,o-l-1):Ht.active.row,col:"col"===e?Math.min(r,o-l-1):Ht.active.col})})},[Ot.colCount,Ot.rowCount,ot,It,Qr,Ar,Ht]),dn=ue(e=>{const{range:t}=Ht;Qr(()=>Rr(r=>{if("row"===e){const e=new Set(r.hiddenRows);for(let r=t.r1;r<=t.r2;r++)e.add(r);return{...r,hiddenRows:[...e]}}const n=new Set(r.hiddenCols);for(let e=t.c1;e<=t.c2;e++)n.add(e);return{...r,hiddenCols:[...n]}}))},[Qr,Ht,Rr]),fn=ue(e=>{Qr(()=>Rr(t=>"row"===e?{...t,hiddenRows:[]}:{...t,hiddenCols:[]}))},[Qr,Rr]),hn=ue(e=>{Qr(()=>Rr(t=>{const r=Ht.range.r1===Ht.range.r2&&Ht.range.c1===Ht.range.c2,n=0===Ht.range.r1&&Ht.range.r2===t.rowCount-1;let o=r?N(t,Ht.range):Ht.range;return n&&(o={...o,r2:Math.max(o.r1,ae(t)?.row??0)}),t.filter&&V(t.filter.range,Ht.active.row,Ht.active.col)&&(o={...t.filter.range,r1:t.filter.range.r1+1}),re(t,It,Lt,o,Ht.active.col,e)}))},[Lt,It,Qr,Ht,Rr]),mn=ue(()=>{ar(null),Qr(()=>Rr(e=>{if(e.filter)return{...e,filter:null};const t=N(e,Ht.range);return t.r1===t.r2?e:{...e,filter:{range:t,excluded:{}}}}))},[Qr,Ht.range,Rr]),gn=ue(()=>{Qr(()=>Rr(e=>e.merges.some(e=>V(Ht.range,e.r1,e.c1))?oe(e,Ht.range):L(e,Ht.range)))},[Qr,Ht.range,Rr]),pn=ue((e,t)=>{Qr(()=>Rr(r=>({...r,frozenRows:e??r.frozenRows,frozenCols:t??r.frozenCols})))},[Qr,Rr]),vn=ue(e=>{const{range:t,active:r}=Ht,n=t.r1===t.r2&&t.c1===t.c2;let o="";if(n){const e=(e,t)=>"number"==typeof Lt.value(It,e,t);let t=r.row;for(;t>0&&e(t-1,r.col);)t--;let n=r.col;for(;n>0&&e(r.row,n-1);)n--;t<r.row?o=G({r1:t,c1:r.col,r2:r.row-1,c2:r.col}):n<r.col&&(o=G({r1:r.row,c1:n,r2:r.row,c2:r.col-1}))}else o=G(t);const l=n?r:{row:t.r2+1,col:t.c1};Ur(),n||Ar(l);const a=`=${e}(${o})`;Pr.current=a.length-1,$r(l,{text:a})},[Ur,Lt,It,Ar,Ht,$r]),wn=ue((e,t)=>{const r=Ht.range,n={...r,r2:Math.min(r.r2,Math.max(r.r1,Ot.cells.length-1))},o=C(Ot,It,Lt,n,e);Qt(o),t?(t.preventDefault(),t.clipboardData.setData("text/plain",o.text)):navigator.clipboard?.writeText(o.text).catch(()=>{})},[Ot,Lt,It,Ht.range]),xn=ue((e,t)=>{const{range:r}=Ht;if(Jt&&Jt.text===e){if(Jt.cut){const e=et.current.findIndex(e=>e.id===Jt.sheetId);if(e<0)return;let t=null;return ot(n=>{const o=$(n,e,Jt,It,r);return t=o.range,o.sheets}),t&&Xt({active:{row:t.r1,col:t.c1},range:t}),void Qt(null)}return void Rr(e=>{const n=X(e,Jt,r,t);return Xt({active:Ht.active,range:n.range}),n.sheet})}if(!e)return;const n=function(e){const t=e.replace(/\r\n?/g,"\n").replace(/\n$/,"");if(!t.includes("\t")&&!t.includes("\n"))return[[t]];if(!t.includes('"'))return t.split("\n").map(e=>e.split("\t"));const r=H(t.includes("\t")?t:`${t}\t`);return r.length?r:[[t]]}(e);Rr(e=>{let t=e;n.forEach((e,n)=>e.forEach((e,o)=>{t=y(t,r.r1+n,r.c1+o,e)}));const o=n.reduce((e,t)=>Math.max(e,t.length),1);return Xt({active:Ht.active,range:{r1:r.r1,c1:r.c1,r2:r.r1+n.length-1,c2:r.c1+o-1}}),t})},[Jt,ot,It,Ht,Xt,Rr]),bn=ue(e=>{Qr(()=>{const t=navigator.clipboard?.readText?.();t?t.then(t=>xn(t,e)).catch(()=>{Jt&&xn(Jt.text,e)}):Jt&&xn(Jt.text,e)})},[Jt,xn,Qr]);Mr.current=()=>Zt.current?(Br(),!0):lr?(ar(null),Dr(),!0):sr?(ur(null),Dr(),!0):ir?(cr(!1),Dr(),!0):null!==dr?(fr(null),Dr(),!0):hr?(mr(!1),Dr(),!0):!(!Jt&&!nr)&&(Qt(null),or(null),!0);const yn=Ze||Ee.spreadsheetFile,Cn=ue(async()=>{Ur();try{const e=et.current;xt(await t(e,O(e)),"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",`${yn}.xlsx`),Ct.current=e,nt(e=>e+1)}catch{Ue.error(Ee.saveFailed)}},[Ur,yn,Ee]),kn=()=>{const e=et.current,t=Math.min(Wt.current,e.length-1);return q(e[t],t,O(e))},Nn=async t=>{const r=t.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");try{if(Ur(),/\.(xlsx|xls|ods)$/i.test(t.name)){const r=new Uint8Array(await t.arrayBuffer()),n=/\.xlsx$/i.test(t.name)&&"undefined"!=typeof DecompressionStream?await e(r):await async function(e){const t=await(import("xlsx")),r=t.read(e,{type:"array",cellFormula:!0,cellNF:!0});return r.SheetNames.map(e=>{const n=r.Sheets[e],o=U(e),l=[],a={};if(n["!ref"]){const e=t.utils.decode_range(n["!ref"]);for(let r=e.s.r;r<=e.e.r;r++)for(let o=e.s.c;o<=e.e.c;o++){const e=n[t.utils.encode_cell({r:r,c:o})];if(!e||void 0===e.v&&!e.f)continue;const i=e.f?`=${e.f}`:"b"===e.t?e.v?"TRUE":"FALSE":String(e.v);l.push({row:r,col:o,raw:"s"===e.t&&/^(?:=|-?\d|'|true$|false$)/i.test(i)?`'${i}`:i}),e.z&&"General"!==e.z&&(a[A(r,o)]={numFmt:e.z})}}const i={};(n["!cols"]??[]).forEach((e,t)=>{e?.wpx&&(i[t]=e.wpx)});const c=(n["!merges"]??[]).map(e=>({r1:e.s.r,c1:e.s.c,r2:e.e.r,c2:e.e.c}));return{...ce(o,l),formats:a,colWidths:i,merges:c}})}(r);ot(()=>n),_e(0)}else{const e=H(await t.text());if(!e.length)return;Rr(t=>({...ee(t.name,e),id:t.id}))}l||Je(r)}catch{Ue.error(Ee.openFailed)}};de(()=>{a&&Nn(a)},[]);const Sn=fe(()=>hr?z(Ot,It,Lt,gr,xr):[],[Ot,Lt,hr,xr,gr,It]),Dn=Sn.findIndex(e=>e.row===Ht.active.row&&e.col===Ht.active.col),Rn=e=>{if(!Sn.length)return;const t=Dn<0?e>0?0:Sn.length-1:(Dn+e+Sn.length)%Sn.length;Ar(Sn[t])},En=()=>{Ur();const e=It+1;ot(t=>{const r=B(t,Ee.sheetBase);return[...t.slice(0,e),U(r),...t.slice(e)]}),_e(e),Dr()},Mn=()=>{if(!sr)return;const{index:e,name:t}=sr;ur(null);const r=t.trim();r&&r!==Ve[e]?.name&&(Ve.some((t,n)=>n!==e&&t.name.toLowerCase()===r.toLowerCase())?Ue.error(Ee.sheetNameTaken):ot(t=>Z(t,e,r)))},Tn=(e,t)=>{const r=e+t;r<0||r>=Ve.length||(ot(t=>{const n=[...t],[o]=n.splice(e,1);return n.splice(r,0,o),n}),e===It?_e(r):r===It&&_e(e))},zn=ue(e=>{Zt.current&&Ur(),Xt(e),nr&&(Rr(t=>le(t,e.range,()=>nr)),or(null))},[Ur,nr,Xt,Rr]),An=ue((e,t,r)=>{"cell"!==t||V(Ht.range,r.row,r.col)?"col"!==t||0===Ht.range.r1&&Ht.range.r2===Ot.rowCount-1&&r.col>=Ht.range.c1&&r.col<=Ht.range.c2?"row"!==t||0===Ht.range.c1&&Ht.range.c2===Ot.colCount-1&&r.row>=Ht.range.r1&&r.row<=Ht.range.r2||Xt({active:{row:r.row,col:0},range:{r1:r.row,c1:0,r2:r.row,c2:Ot.colCount-1}}):Xt({active:{row:0,col:r.col},range:{r1:0,c1:r.col,r2:Ot.rowCount-1,c2:r.col}}):Ar(r),Nr.open(e,{kind:t,pos:r})},[Ot.colCount,Ot.rowCount,Nr,Ar,Ht.range,Xt]),Fn=ue((e,t)=>{if(!Ot.filter)return;const r=b(Ot,It,Lt,Ot.filter.range,e);ar({col:e,x:t.left,y:t.bottom+2,values:r,unticked:new Set(Ot.filter.excluded[e]??[]),search:""})},[Ot,Lt,It]),In=(e,t)=>{ar(null),Qr(()=>Rr(r=>{if(!r.filter)return r;const{range:n}=r.filter;return re(r,It,Lt,{...n,r1:n.r1+1},e,t)}))},On=fe(()=>{const{range:e}=Ht;return e.r1===e.r2&&e.c1===e.c2?null:Q(Ot,It,Lt,e,Pt)},[Ot,Lt,Pt,It,Ht]),Ln=e=>F(Number(e.toPrecision(12)),On?.firstFormat??"#,##0.##").text,Pn=(e,t)=>gt("span",{className:"flex w-full items-center justify-between gap-6",children:[mt("span",{children:e}),mt("span",{className:"text-xs text-ink-faint",children:t})]}),$n=(e,t,r,n={})=>({key:e,label:t,onSelect:r,...n}),Un=e=>({type:"divider",key:e}),Bn=[{key:"general",label:Ee.formatGeneral,code:f.general},{key:"number",label:Ee.formatNumber,code:f.number},{key:"percent",label:Ee.formatPercent,code:f.percent},{key:"scientific",label:Ee.formatScientific,code:f.scientific},{key:"currency",label:Ee.formatCurrency,code:f.currency},{key:"date",label:Ee.formatDate,code:f.date},{key:"time",label:Ee.formatTime,code:f.time},{key:"dateTime",label:Ee.formatDateTime,code:f.dateTime},{key:"text",label:Ee.formatText,code:f.text}].map(e=>({type:"radio",key:e.key,label:e.label,checked:(Vt.numFmt??"General")===e.code,onSelect:()=>an(e.code)})),Kn=[["all",Ee.bordersAll],["outer",Ee.bordersOuter],["top",Ee.bordersTop],["bottom",Ee.bordersBottom],["left",Ee.bordersLeft],["right",Ee.bordersRight],["none",Ee.bordersNone]].map(([e,t])=>$n(e,t,()=>Qr(()=>Rr(t=>m(t,Ht.range,e))))),Hn=[...["left","center","right"].map(e=>({type:"radio",key:e,label:"left"===e?Ee.alignLeft:"center"===e?Ee.alignCenter:Ee.alignRight,checked:Vt.align===e,onSelect:()=>on(t=>ie(t,"align",e))})),Un("v"),...["top","middle","bottom"].map(e=>({type:"radio",key:e,label:"top"===e?Ee.alignTop:"middle"===e?Ee.alignMiddle:Ee.alignBottom,checked:(Vt.vAlign??"bottom")===e,onSelect:()=>on(t=>ie(t,"vAlign",e))}))],Wn=pt.map(e=>({type:"radio",key:String(e),label:String(e),checked:(Vt.fontSize??i)===e,onSelect:()=>on(t=>ie(t,"fontSize",e===i?void 0:e))})),Xn=["SUM","AVERAGE","COUNT","MAX","MIN"].map(e=>$n(e,e,()=>vn(e))),Yn=[...[0,1,2].map(e=>({type:"radio",key:`r${e}`,label:Ee.freezeRows(e),checked:Ot.frozenRows===e,onSelect:()=>pn(e,null)})),{type:"radio",key:"rUp",label:Ee.freezeUpToRow(Yt.row+1),checked:Ot.frozenRows===Yt.row+1&&Yt.row>1,onSelect:()=>pn(Yt.row+1,null)},Un("c"),...[0,1,2].map(e=>({type:"radio",key:`c${e}`,label:Ee.freezeColumns(e),checked:Ot.frozenCols===e,onSelect:()=>pn(null,e)})),{type:"radio",key:"cUp",label:Ee.freezeUpToColumn(p(0,Yt.col).replace(/\d+$/,"")),checked:Ot.frozenCols===Yt.col+1&&Yt.col>1,onSelect:()=>pn(null,Yt.col+1)}],Vn=[...l?[]:[$n("new",Ee.menuNew,()=>Qr(()=>{ot(()=>[U(Ee.sheetName(1))]),_e(0),Je(Ee.untitled)}))],$n("open",Ee.menuOpen,()=>Ut.current?.click()),Un("a"),$n("xlsx",Pn(Ee.saveExcel,`${wt}S`),()=>{Cn()}),$n("csv",Ee.saveCsv,()=>Qr(()=>xt(kn(),"text/csv",`${yn}.csv`))),...Qe?[Un("b"),$n("email",Ee.email,()=>Qr(()=>Qe(kn(),`${yn}.csv`)))]:[],...!l&&se?.onSaveToFiles?[Un("c"),$n("keep",Ee.saveToFiles,()=>Qr(()=>se.onSaveToFiles?.(Ze.trim()||Ee.untitled,et.current)))]:[]],Gn=[$n("undo",Pn(Ee.undo,`${wt}Z`),()=>Qr(at),{disabled:0===tt.current.length}),$n("redo",Pn(Ee.redo,vt?"⇧⌘Z":"Ctrl+Y"),()=>Qr(yt),{disabled:0===rt.current.length}),Un("a"),$n("cut",Pn(Ee.cut,`${wt}X`),()=>Qr(()=>wn(!0))),$n("copy",Pn(Ee.copy,`${wt}C`),()=>Qr(()=>wn(!1))),$n("paste",Pn(Ee.paste,`${wt}V`),()=>bn("all")),$n("pasteValues",Ee.pasteValues,()=>bn("values")),$n("pasteFormats",Ee.pasteFormats,()=>bn("formats")),Un("b"),$n("find",Pn(Ee.findReplace,`${wt}F`),()=>{mr(!0),setTimeout(()=>kr.current?.focus(),0)}),$n("clear",Pn(Ee.clearValues,"Delete"),()=>Qr(()=>Rr(e=>w(e,Ht.range))))],jn=[{type:"submenu",key:"freeze",label:Ee.freeze,items:Yn},{type:"checkbox",key:"gridlines",label:Ee.gridlines,checked:qt,onSelect:()=>er(e=>!e)},{type:"checkbox",key:"formulas",label:Pn(Ee.showFormulas,`${wt}\``),checked:tr,onSelect:()=>rr(e=>!e)}],_n=[$n("rowAbove",Ee.rowsAbove,()=>sn("row",!1)),$n("rowBelow",Ee.rowsBelow,()=>sn("row",!0)),$n("colLeft",Ee.columnsLeft,()=>sn("col",!1)),$n("colRight",Ee.columnsRight,()=>sn("col",!0)),Un("a"),$n("sheet",Ee.sheet,En),{type:"submenu",key:"fn",label:Ee.function,items:Xn}],Zn=[{type:"submenu",key:"number",label:Ee.number,items:Bn},Un("a"),$n("bold",Pn(Ee.bold,`${wt}B`),()=>ln("bold")),$n("italic",Pn(Ee.italic,`${wt}I`),()=>ln("italic")),$n("underline",Pn(Ee.underline,`${wt}U`),()=>ln("underline")),$n("strike",Ee.strikethrough,()=>ln("strike")),{type:"submenu",key:"size",label:Ee.fontSize,items:Wn},Un("b"),{type:"submenu",key:"align",label:Ee.alignment,items:Hn},{type:"submenu",key:"borders",label:Ee.borders,items:Kn},$n("wrap",Ee.wrapText,()=>ln("wrap")),$n("merge",Ee.mergeCells,gn),Un("c"),$n("clearFormat",Ee.clearFormatting,()=>Qr(()=>Rr(e=>le(e,Ht.range,()=>({})))))],Jn=[$n("asc",Ee.sortAscending,()=>hn(!0)),$n("desc",Ee.sortDescending,()=>hn(!1)),Un("a"),{type:"checkbox",key:"filter",label:Ee.filter,checked:!!Ot.filter,onSelect:mn},Un("b"),$n("hideRows",Ee.hideRows,()=>dn("row")),$n("hideCols",Ee.hideColumns,()=>dn("col")),$n("unhideRows",Ee.unhideRows,()=>fn("row"),{disabled:!Ot.hiddenRows.length}),$n("unhideCols",Ee.unhideColumns,()=>fn("col"),{disabled:!Ot.hiddenCols.length})],Qn="rounded px-2 py-0.5 text-xs text-ink-muted hover:bg-line-subtle hover:text-ink",qn="inline-flex h-7 items-center gap-1 rounded px-2 text-xs text-ink-muted hover:bg-line-subtle hover:text-ink",eo=mt("div",{className:"mx-1 h-4 w-px bg-line"}),to=e=>e.preventDefault(),ro=(e,t,r,n={})=>mt(Me,{"aria-label":e,title:e,size:"sm",variant:"ghost",onMouseDown:to,onClick:r,disabled:n.disabled,...void 0!==n.pressed?{"aria-pressed":n.pressed}:{},children:t}),no=(e,t,r)=>mt(Ae,{triggerLabel:e,align:"start",triggerClassName:"inline-flex h-7 w-7 flex-col items-center justify-center rounded text-ink-muted hover:bg-line-subtle hover:text-ink",trigger:gt(ht,{children:[t,mt("span",{className:"h-0.5 w-4 rounded-sm",style:{background:Vt[r]??("color"===r?"var(--ink)":"var(--line)")}})]}),children:({close:t})=>mt(Se,{label:e,value:Vt[r]??"",presets:ct,clearable:!0,dragWrites:"end",onChange:e=>{on(t=>ie(t,r,e||void 0)),t()}})}),oo=e=>{if(!jt||!Wr||jt.inBar)return null;const t=Ot.formats[A(jt.row,jt.col)],r=(t?.fontSize??i)*(4/3),n=Math.min(Math.max(e.width,jt.text.length*r*.62+16),e.viewportWidth-e.x-4);return mt("textarea",{ref:Cr,"aria-label":Ee.cellEditor,value:jt.text,spellCheck:!1,rows:1,onChange:e=>Hr(e.target.value,e.target.selectionStart),onSelect:Jr,onKeyDown:Zr,onPointerDown:e=>e.stopPropagation(),className:"absolute resize-none overflow-hidden border-2 border-accent-fill bg-surface text-ink outline-none",style:{left:e.x,top:e.y,width:n,minHeight:e.height,height:Math.max(e.height,jt.text.split("\n").length*r*1.35+6),padding:"0 2px",fontSize:r,lineHeight:1.3,fontWeight:t?.bold?700:void 0,fontStyle:t?.italic?"italic":void 0,background:t?.fill??void 0,color:t?.color??void 0}})},lo=e=>{if(!jt||!Wr)return null;const t=e.y+e.height+2,r=Math.max(0,Math.min(e.x,e.viewportWidth-320));if(Xr)return gt("div",{role:"listbox","aria-label":Ee.functions,className:"absolute w-80 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",style:{left:r,top:t},onPointerDown:e=>e.preventDefault(),children:[Xr.matches.map((e,t)=>gt("div",{role:"option","aria-selected":t===jt.suggestion,onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),_r(e)},className:"flex cursor-pointer items-center justify-between gap-3 px-2 py-1 text-xs "+(t===jt.suggestion?"bg-accent-tint text-accent-text":"text-ink hover:bg-surface-sunken"),children:[mt("span",{className:"font-medium",children:e}),mt("span",{className:"truncate "+(t===jt.suggestion?"text-accent-text":"text-ink-muted"),children:Ee.functionHelp(e)})]},e)),gt("div",{className:"border-t border-line px-2 py-1 font-mono text-xs text-ink-muted",children:[Xr.matches[jt.suggestion],"(",ft[Xr.matches[jt.suggestion]]??"",")"]})]});if(Yr&&void 0!==ft[Yr.name]){const e=ft[Yr.name].split(", ");return gt("div",{className:"absolute max-w-md rounded-lg border border-line bg-surface px-2 py-1 text-xs text-ink-muted shadow-lg",style:{left:r,top:t},children:[gt("div",{className:"font-mono",children:[Yr.name,"(",e.map((t,r)=>gt("span",{children:[r>0?", ":"",mt("span",{className:r===Math.min(Yr.argIndex,e.length-1)?"font-semibold text-ink":"",children:t})]},t+r)),")"]}),mt("div",{className:"mt-0.5",children:Ee.functionHelp(Yr.name)})]})}return null},ao=lr?lr.values.filter(e=>e.toLowerCase().includes(lr.search.toLowerCase())):[];return gt("div",{ref:Er,className:"flex h-full flex-col bg-surface text-ink",children:[!se&&mt(xe,{title:`${so=Ze||Ee.untitled,so.length>24?`${so.slice(0,23)}…`:so} - Spreadsheets`}),mt("input",{ref:Ut,type:"file",accept:bt,onChange:e=>{const t=e.target.files?.[0];Ut.current&&(Ut.current.value=""),t&&Nn(t)},className:"hidden"}),gt("div",{className:"flex shrink-0 items-center gap-1 border-b border-line bg-surface-sunken px-2 py-1",children:[s&&mt(Me,{"aria-label":Ee.backToFiles,title:Ee.backToFiles,size:"sm",variant:"ghost",onClick:()=>{zt(),s()},children:mt(Ce,{name:"arrow-left",size:16})}),ir?mt("input",{type:"text",value:Ze,autoFocus:!0,"aria-label":Ee.rename,onChange:e=>Je(e.target.value),onBlur:()=>{cr(!1);const e=Ze.trim()||Ee.untitled;if(e!==Ze&&Je(e),l&&e!==Nt.current){const t=Nt.current;Nt.current=e,l.store.rename(l.id,e).catch(()=>{Ue.error(Ee.renameFailed),Nt.current=t,Je(t)})}},onKeyDown:e=>{"Enter"===e.key&&(e.currentTarget.blur(),Dr())},className:"w-40 rounded border border-line bg-surface px-2 py-0.5 text-sm font-medium text-ink"}):mt("button",{type:"button",onClick:()=>cr(!0),title:Ee.rename,className:"max-w-[200px] truncate rounded px-2 py-0.5 text-sm font-medium text-ink hover:bg-line-subtle",children:Ze||Ee.untitled}),mt(Re,{trigger:Ee.menuFile,items:Vn,align:"start",triggerClassName:Qn}),mt(Re,{trigger:Ee.menuEdit,items:Gn,align:"start",triggerClassName:Qn}),mt(Re,{trigger:Ee.menuView,items:jn,align:"start",triggerClassName:Qn}),mt(Re,{trigger:Ee.menuInsert,items:_n,align:"start",triggerClassName:Qn}),mt(Re,{trigger:Ee.menuFormat,items:Zn,align:"start",triggerClassName:Qn}),mt(Re,{trigger:Ee.menuData,items:Jn,align:"start",triggerClassName:Qn}),(l||c)&&mt("span",{className:"office-save-state",children:mt(ve,{...l?ge(Mt.state,Et.save):{tone:Ve!==Ct.current?"off-unsaved":"off",label:Ve!==Ct.current?Ee.noStoreEdited:Ee.noStoreClean}})})]}),St&>("div",{className:"office-conflict",role:"alert",children:[mt("span",{children:Ee.conflict}),mt(ke,{variant:"secondary",onClick:g,children:Ee.reload})]}),gt("div",{className:"flex shrink-0 flex-wrap items-center gap-0.5 border-b border-line bg-surface-sunken px-2 py-1",children:[ro(Ee.undo,mt(Ce,{name:"undo",size:16}),()=>Qr(at),{disabled:0===tt.current.length}),ro(Ee.redo,mt(Ce,{name:"redo",size:16}),()=>Qr(yt),{disabled:0===rt.current.length}),ro(Ee.formatPainter,mt(Ce,{name:"copy-style",size:16}),()=>or(e=>e?null:Vt),{pressed:!!nr}),eo,ro(Ee.formatCurrency,mt(Ce,{name:"dollar",size:16}),()=>an(Vt.numFmt===f.currency?"General":f.currency),{pressed:Vt.numFmt===f.currency}),ro(Ee.formatPercent,mt(Ce,{name:"percent",size:16}),()=>an(/%/.test(Vt.numFmt??"")?"General":"0%"),{pressed:/%/.test(Vt.numFmt??"")}),ro(Ee.fewerDecimals,mt("span",{className:"text-xs",children:".0"}),()=>cn(-1)),ro(Ee.moreDecimals,mt("span",{className:"text-xs",children:".00"}),()=>cn(1)),mt(Re,{trigger:gt("span",{title:Ee.number,className:"flex items-center gap-0.5",children:["123",mt(Ce,{name:"chevron-down",size:12})]}),"aria-label":Ee.number,items:Bn,align:"start",triggerClassName:qn}),eo,mt(Re,{trigger:gt("span",{title:Ee.fontSize,className:"flex items-center gap-0.5",children:[Vt.fontSize??i,mt(Ce,{name:"chevron-down",size:12})]}),"aria-label":Ee.fontSize,items:Wn,align:"start",triggerClassName:qn}),ro(Ee.bold,mt(Ce,{name:"bold",size:16}),()=>ln("bold"),{pressed:!!Vt.bold}),ro(Ee.italic,mt(Ce,{name:"italic",size:16}),()=>ln("italic"),{pressed:!!Vt.italic}),ro(Ee.underline,mt(Ce,{name:"underline",size:16}),()=>ln("underline"),{pressed:!!Vt.underline}),ro(Ee.strikethrough,mt(Ce,{name:"strike",size:16}),()=>ln("strike"),{pressed:!!Vt.strike}),no(Ee.textColor,mt(Ce,{name:"text-color",size:14}),"color"),no(Ee.fillColor,mt(Ce,{name:"palette",size:14}),"fill"),eo,mt(Re,{trigger:gt("span",{title:Ee.borders,className:"flex items-center gap-0.5",children:[mt(Ce,{name:"border-all",size:16}),mt(Ce,{name:"chevron-down",size:12})]}),"aria-label":Ee.borders,items:Kn,align:"start",triggerClassName:qn}),ro(Ee.mergeCells,mt(Ce,{name:"grid",size:16}),gn,{pressed:Ot.merges.some(e=>V(e,Yt.row,Yt.col))}),mt(Re,{trigger:gt("span",{title:Ee.alignment,className:"flex items-center gap-0.5",children:["center"===Vt.align?mt(Ce,{name:"align-center",size:16}):"right"===Vt.align?mt(Ce,{name:"align-right",size:16}):mt(Ce,{name:"align-left",size:16}),mt(Ce,{name:"chevron-down",size:12})]}),"aria-label":Ee.alignment,items:Hn,align:"start",triggerClassName:qn}),ro(Ee.wrapText,mt(Ce,{name:"wrap",size:16}),()=>ln("wrap"),{pressed:!!Vt.wrap}),eo,ro(Ee.filter,mt(Ce,{name:"filter",size:16}),mn,{pressed:!!Ot.filter}),ro(Ee.sortAscending,mt(Ce,{name:"sort",size:16}),()=>hn(!0)),mt(Re,{trigger:gt("span",{title:Ee.functions,className:"flex items-center gap-0.5 text-sm",children:["Σ",mt(Ce,{name:"chevron-down",size:12})]}),"aria-label":Ee.functions,items:Xn,align:"end",triggerClassName:qn})]}),gt("div",{className:"flex shrink-0 items-start gap-1 border-b border-line bg-surface px-2 py-1",children:[mt("input",{type:"text","aria-label":Ee.nameBox,spellCheck:!1,value:dr??(jt&&Wr?p(jt.row,jt.col):G(Ht.range)),onFocus:e=>{fr(e.target.value),e.target.select()},onChange:e=>fr(e.target.value),onBlur:()=>fr(null),onKeyDown:e=>{if("Enter"===e.key){const e=W(dr??"");e&&e.r2<Ot.rowCount&&e.c2<Ot.colCount&&(Xt({active:{row:e.r1,col:e.c1},range:E(Ot,e)}),$t.current?.scrollTo({row:e.r1,col:e.c1})),fr(null),Dr()}},className:"w-20 shrink-0 rounded border border-line bg-surface px-2 py-0.5 text-center text-xs text-ink"}),mt("span",{className:"select-none pt-0.5 font-serif text-sm italic text-ink-faint","aria-hidden":"true",children:"fx"}),mt("textarea",{ref:yr,"aria-label":Ee.formulaBar,spellCheck:!1,rows:1,value:jt?jt.text:R(Gt,Vt),onFocus:()=>{jt?jt.inBar||_t({...jt,inBar:!0}):$r(Yt,{inBar:!0,mode:"edit"})},onChange:e=>{jt&&Hr(e.target.value,e.target.selectionStart)},onSelect:Jr,onKeyDown:Zr,className:"max-h-24 min-h-[22px] flex-1 resize-y rounded border border-line bg-surface px-2 py-0.5 font-mono text-xs text-ink outline-none focus:border-accent-fill"})]}),hr&>("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-line bg-surface-sunken px-2 py-1 text-xs",children:[mt("div",{className:"w-44",children:mt(Te,{ref:kr,size:"sm","aria-label":Ee.find,placeholder:Ee.find,value:gr,onChange:e=>pr(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Rn(e.shiftKey?-1:1))}})}),mt("span",{className:"w-16 text-center text-ink-muted",children:gr?Ee.hitCount(Dn<0?0:Dn+1,Sn.length):""}),ro(Ee.previous,mt(Ce,{name:"arrow-up",size:14}),()=>Rn(-1)),ro(Ee.next,mt(Ce,{name:"arrow-down",size:14}),()=>Rn(1)),mt("div",{className:"w-44",children:mt(Te,{size:"sm","aria-label":Ee.replaceWith,placeholder:Ee.replaceWith,value:vr,onChange:e=>wr(e.target.value)})}),mt(ke,{size:"sm",variant:"secondary",disabled:!Sn.length,onClick:()=>{if(Dn<0)return void Rn(1);const{row:e,col:t}=Sn[Dn];Rr(r=>{const n=J(j(r,e,t),gr,vr,xr);return n===j(r,e,t)?r:ce(r,[{row:e,col:t,raw:n}])}),Rn(1)},children:Ee.replace}),mt(ke,{size:"sm",variant:"secondary",disabled:!Sn.length,onClick:()=>{let e=0;Rr(t=>{const r=[];for(const{row:e,col:n}of Sn){const o=J(j(t,e,n),gr,vr,xr);o!==j(t,e,n)&&r.push({row:e,col:n,raw:o})}return e=r.length,ce(t,r)}),Ue.success(Ee.replacedCount(e))},children:Ee.replaceAll}),mt(Ne,{label:Ee.matchCase,checked:xr.matchCase,onChange:e=>br(t=>({...t,matchCase:e}))}),mt(Ne,{label:Ee.wholeCell,checked:xr.wholeCell,onChange:e=>br(t=>({...t,wholeCell:e}))}),mt(Ne,{label:Ee.inFormulas,checked:xr.inFormulas,onChange:e=>br(t=>({...t,inFormulas:e}))}),mt("div",{className:"ml-auto",children:ro(Ee.close,mt(Ce,{name:"close",size:14}),()=>{mr(!1),Dr()})})]}),mt("div",{className:"min-h-0 flex-1",children:mt(it,{ref:$t,sheet:Ot,sheetIndex:It,evaluator:Lt,filterHidden:Pt,selection:Ht,showGridlines:qt,showFormulas:tr,clipRange:Jt&&Jt.sheetId===Ot.id?Jt.range:null,highlights:Gr,pointing:Vr,onSelect:zn,onPoint:jr,onEdit:e=>{Ur(),Ar(e),$r(P(Ot,e.row,e.col)?{row:P(Ot,e.row,e.col).r1,col:P(Ot,e.row,e.col).c1}:e)},onFill:e=>{const t=Ht.range;Rr(r=>M(r,t,e)),Xt({active:Ht.active,range:e})},onResizeCol:(e,t)=>Rr(r=>{const{range:n}=Ht,o=0===n.r1&&n.r2===r.rowCount-1&&e>=n.c1&&e<=n.c2,l={...r.colWidths};if(o)for(let e=n.c1;e<=n.c2;e++)l[e]=t;else l[e]=t;return{...r,colWidths:l}}),onResizeRow:(e,t)=>Rr(r=>({...r,rowHeights:{...r.rowHeights,[e]:t}})),onAutoFitCol:e=>{const t=Math.max(40,$t.current?.measureColumn(e)??0);Rr(r=>({...r,colWidths:{...r.colWidths,[e]:t}}))},onAutoFitRow:e=>Rr(t=>{const r={...t.rowHeights};return delete r[e],{...t,rowHeights:r}}),onHeaderMenu:An,onFilterButton:Fn,renderEditor:e=>gt(ht,{children:[oo(e),lo(e)]}),onKeyDown:e=>{if(jt)return;const t=e.ctrlKey||e.metaKey,r=e.key,n=r.toLowerCase(),o="ArrowUp"===r?[-1,0]:"ArrowDown"===r?[1,0]:"ArrowLeft"===r?[0,-1]:"ArrowRight"===r?[0,1]:null;if(o){e.preventDefault();const r=e.shiftKey?Lr():Ht.active,n=t?Ir(r,o[0],o[1]):Fr(r,o[0],o[1]);return void(e.shiftKey?Or(n):Ar(n))}if("Tab"===r||"Enter"===r){if(e.preventDefault(),"Enter"===r&&t)return;const n=Ht.range.r1!==Ht.range.r2||Ht.range.c1!==Ht.range.c2,o="Enter"===r?e.shiftKey?-1:1:0,l="Tab"===r?e.shiftKey?-1:1:0;if(n){const{range:e}=Ht;let{row:t,col:r}=Ht.active;return t+=o,r+=l,r>e.c2&&(r=e.c1,t=t+1>e.r2?e.r1:t+1),r<e.c1&&(r=e.c2,t=t-1<e.r1?e.r2:t-1),t>e.r2&&(t=e.r1,r=r+1>e.c2?e.c1:r+1),t<e.r1&&(t=e.r2,r=r-1<e.c1?e.c2:r-1),Xt({active:{row:t,col:r},range:e}),void $t.current?.scrollTo({row:t,col:r})}return void Ar(Fr(Ht.active,o,l))}if("Home"===r)return e.preventDefault(),void Ar(t?{row:Ot.frozenRows,col:Ot.frozenCols}:{row:Ht.active.row,col:0});if("End"===r){e.preventDefault();const r=ae(Ot);return void Ar(t?{row:r?.row??0,col:r?.col??0}:{row:Ht.active.row,col:Math.max(0,(Ot.cells[Ht.active.row]?.length??1)-1)})}if("PageDown"===r||"PageUp"===r){e.preventDefault();const t="PageDown"===r?25:-25;return void Ar({row:Math.max(0,Math.min(Ot.rowCount-1,Ht.active.row+t)),col:Ht.active.col})}if("Delete"===r||"Backspace"===r)return e.preventDefault(),void Rr(e=>w(e,Ht.range));if("F2"===r)return e.preventDefault(),void $r(Ht.active);if(" "===r&&(t||e.shiftKey))return e.preventDefault(),void Xt(t?{active:Ht.active,range:{r1:0,c1:Ht.range.c1,r2:Ot.rowCount-1,c2:Ht.range.c2}}:{active:Ht.active,range:{r1:Ht.range.r1,c1:0,r2:Ht.range.r2,c2:Ot.colCount-1}});if(!t)return!e.altKey||"="!==r&&"≠"!==r?1!==r.length||e.altKey?void("Process"!==r&&229!==e.keyCode||$r(Ht.active,{text:""})):(e.preventDefault(),void $r(Ht.active,{text:r})):(e.preventDefault(),void vn("SUM"));switch(n){case"z":return e.preventDefault(),void(e.shiftKey?yt():at());case"y":return e.preventDefault(),void yt();case"a":return e.preventDefault(),void Xt({active:Ht.active,range:{r1:0,c1:0,r2:Ot.rowCount-1,c2:Ot.colCount-1}});case"b":return e.preventDefault(),void ln("bold");case"i":return e.preventDefault(),void ln("italic");case"u":return e.preventDefault(),void ln("underline");case"f":case"h":return e.preventDefault(),mr(!0),void setTimeout(()=>kr.current?.focus(),0);case"s":return e.preventDefault(),void(l?zt():Cn());case"d":{e.preventDefault();const{range:t}=Ht;return void(t.r2>t.r1?Rr(e=>M(e,{...t,r2:t.r1},t)):t.r1>0&&Rr(e=>M(e,{...t,r1:t.r1-1,r2:t.r1-1},{...t,r1:t.r1-1})))}case"r":{e.preventDefault();const{range:t}=Ht;return void(t.c2>t.c1?Rr(e=>M(e,{...t,c2:t.c1},t)):t.c1>0&&Rr(e=>M(e,{...t,c1:t.c1-1,c2:t.c1-1},{...t,c1:t.c1-1})))}case";":return e.preventDefault(),void Rr(e=>y(e,Ht.active.row,Ht.active.col,$e(new Date)));case"`":return e.preventDefault(),void rr(e=>!e)}if(e.shiftKey){if("$"===r||"4"===r)return e.preventDefault(),void an(f.currency);if("%"===r||"5"===r)return e.preventDefault(),void an("0%")}},onCopy:e=>{jt||wn(!1,e)},onCut:e=>{jt||wn(!0,e)},onPaste:e=>{jt||(e.preventDefault(),xn(e.clipboardData.getData("text/plain"),"all"))}})}),gt("div",{className:"flex shrink-0 items-center border-t border-line bg-surface-sunken",children:[gt("div",{className:"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-1 py-1",children:[mt(Me,{"aria-label":Ee.addSheet,title:Ee.addSheet,size:"sm",variant:"ghost",onClick:En,children:mt(Ce,{name:"add",size:14})}),Ve.map((e,t)=>mt("button",{type:"button",onClick:()=>(e=>{jt&&!Vr&&Ur(),_e(e),ar(null)})(t),onDoubleClick:()=>ur({index:t,name:e.name}),onContextMenu:e=>Sr.open(e,t),style:e.tabColor?{boxShadow:`inset 0 -3px 0 ${e.tabColor}`}:void 0,className:"whitespace-nowrap rounded px-3 py-1 text-xs font-medium "+(t===It?"bg-accent-tint text-accent-text":"text-ink-muted hover:bg-line-subtle hover:text-ink"),children:sr?.index===t?mt("input",{type:"text",value:sr.name,autoFocus:!0,"aria-label":Ee.rename,onChange:e=>ur({index:t,name:e.target.value}),onBlur:Mn,onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key&&Mn()},onClick:e=>e.stopPropagation(),className:"w-24 rounded border border-accent-fill bg-surface px-1 text-xs text-ink outline-none"}):e.name},e.id))]}),On&&On.count>0&>("div",{className:"flex shrink-0 items-center gap-3 border-l border-line px-3 py-1 text-xs text-ink-muted",children:[On.numbers>0&>("span",{children:[Ee.statSum,": ",Ln(On.sum)]}),null!==On.average&>("span",{children:[Ee.statAverage,": ",Ln(On.average)]}),gt("span",{children:[Ee.statCount,": ",On.count]}),On.numbers>0&>("span",{children:[Ee.statMin,": ",Ln(On.min)]}),On.numbers>0&>("span",{children:[Ee.statMax,": ",Ln(On.max)]})]})]}),Nr.state&&mt(De,{...Nr.props,items:(co=Nr.state.data.kind,[$n("cut",Ee.cut,()=>Qr(()=>wn(!0))),$n("copy",Ee.copy,()=>Qr(()=>wn(!1))),$n("paste",Ee.paste,()=>bn("all")),$n("pasteValues",Ee.pasteValues,()=>bn("values")),Un("a"),..."col"!==co?[$n("rowAbove",Ee.rowsAbove,()=>sn("row",!1)),$n("rowBelow",Ee.rowsBelow,()=>sn("row",!0))]:[],..."row"!==co?[$n("colLeft",Ee.columnsLeft,()=>sn("col",!1)),$n("colRight",Ee.columnsRight,()=>sn("col",!0))]:[],Un("b"),..."col"!==co?[$n("delRows",Ee.deleteRows,()=>un("row"),{danger:!0})]:[],..."row"!==co?[$n("delCols",Ee.deleteColumns,()=>un("col"),{danger:!0})]:[],$n("clear",Ee.clearValues,()=>Qr(()=>Rr(e=>w(e,Ht.range)))),Un("c"),..."col"!==co?[$n("hideRows",Ee.hideRows,()=>dn("row"))]:[],..."row"!==co?[$n("hideCols",Ee.hideColumns,()=>dn("col"))]:[],..."col"!==co&&Ot.hiddenRows.length?[$n("unhideRows",Ee.unhideRows,()=>fn("row"))]:[],..."row"!==co&&Ot.hiddenCols.length?[$n("unhideCols",Ee.unhideColumns,()=>fn("col"))]:[]])}),Sr.state&&mt(De,{...Sr.props,items:(io=Sr.state.data,[$n("rename",Ee.rename,()=>ur({index:io,name:Ve[io].name})),$n("duplicate",Ee.duplicate,()=>{ot(e=>D(e,io,B(e,Ve[io].name))),_e(io+1)}),$n("left",Ee.moveLeft,()=>Tn(io,-1),{disabled:0===io}),$n("right",Ee.moveRight,()=>Tn(io,1),{disabled:io===Ve.length-1}),{type:"submenu",key:"colour",label:Ee.tabColor,items:[$n("none",Ee.noColor,()=>ot(e=>e.map((e,t)=>t===io?{...e,tabColor:void 0}:e))),...ct.slice(7,17).map(e=>$n(e,gt("span",{className:"flex items-center gap-2",children:[mt("span",{className:"inline-block h-3 w-3 rounded-sm",style:{background:e}}),e]}),()=>ot(t=>t.map((t,r)=>r===io?{...t,tabColor:e}:t))))]},Un("a"),$n("delete",Ee.deleteSheet,()=>{(async e=>{Ve.length<=1||(null===ae(Ve[e])||await Le({title:Ee.deleteSheetTitle,message:Ee.deleteSheetMessage(Ve[e].name),confirmLabel:Ee.deleteSheet}))&&(ot(t=>S(t,e)),_e(t=>t>e||t>=Ve.length-1?Math.max(0,t-1):t))})(io)},{danger:!0,disabled:Ve.length<=1})])}),lr&>(Fe,{portal:!0,minWidth:230,onClose:()=>ar(null),style:{position:"fixed",left:lr.x,top:lr.y},children:[mt(Oe,{onClick:()=>In(lr.col,!0),children:Ee.sortAscending}),mt(Oe,{onClick:()=>In(lr.col,!1),children:Ee.sortDescending}),mt(Ie,{}),mt("div",{className:"px-2 py-1",children:mt(Te,{size:"sm","aria-label":Ee.find,placeholder:Ee.find,value:lr.search,onChange:e=>ar({...lr,search:e.target.value})})}),mt("div",{className:"max-h-52 overflow-y-auto px-2 py-1",children:ao.map(e=>mt("div",{className:"py-0.5",children:mt(Ne,{label:e||Ee.blank,checked:!lr.unticked.has(e),onChange:t=>{const r=new Set(lr.unticked);t?r.delete(e):r.add(e),ar({...lr,unticked:r})}})},e))}),gt("div",{className:"flex items-center justify-between gap-2 border-t border-line px-2 py-1",children:[mt(ke,{size:"sm",variant:"ghost",onClick:()=>ar({...lr,unticked:new Set}),children:Ee.clear}),mt(ke,{size:"sm",variant:"primary",onClick:()=>{if(!lr)return;const{col:e,unticked:t}=lr;ar(null),Qr(()=>Rr(r=>{if(!r.filter)return r;const n={...r.filter.excluded};return t.size?n[e]=[...t]:delete n[e],{...r,filter:{...r.filter,excluded:n}}}))},children:Ee.apply})]})]})]});var io,co,so}function Dt(e,t){const r=e.rows?e.rows.map(e=>e.map(e=>String(e??""))):H(e.csv??"");return 0===r.length?null:ee(t,r)}export{kt as OpenSpreadsheet,Ct as SpreadsheetById,Nt as SpreadsheetPane,yt as default};
|
package/dist/chunk-2AKHYM66.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DECK_FONT as e,NO_FILL as t,SLIDE_H as i,SLIDE_W as o}from"./chunk-2TZUCKZ7.js";import{Fragment as r,jsx as l,jsxs as n}from"react/jsx-runtime";function a({shape:e}){const{w:i,h:o,arrowEnd:a,arrowStart:h}=e,s=e.stroke??(e.fill===t?"#2c2c2a":e.fill),d=e.strokeWidth??4,c=o/2,p=Math.min(Math.max(4*d,14),i/2),u=p/2;return n(r,{children:[l("line",{x1:h?p:0,y1:c,x2:a?i-p:i,y2:c,stroke:s,strokeWidth:d}),h&&l("polygon",{points:`0,${c} ${p},${c-u} ${p},${c+u}`,fill:s}),a&&l("polygon",{points:`${i},${c} ${i-p},${c-u} ${i-p},${c+u}`,fill:s})]})}function h({shape:e}){const{w:t,h:i,fill:o,stroke:r,strokeWidth:n}=e,a={fill:o,stroke:r,strokeWidth:r?n??4:void 0};switch(e.shape){case"ellipse":return l("ellipse",{cx:t/2,cy:i/2,rx:t/2,ry:i/2,...a});case"diamond":return l("polygon",{points:`${t/2},0 ${t},${i/2} ${t/2},${i} 0,${i/2}`,...a});case"roundRect":return l("rect",{width:t,height:i,rx:Math.min(e.radius??Math.min(t,i)/6,t/2,i/2),...a});default:return l("rect",{width:t,height:i,...a})}}function s({shape:e}){const t=Math.max(e.w,1),i=Math.max(e.h,1);return l("svg",{width:t,height:i,viewBox:`0 0 ${t} ${i}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:"line"===e.shape?l(a,{shape:e}):l(h,{shape:e})})}import{jsx as d,jsxs as c}from"react/jsx-runtime";var p=`${e}, ui-sans-serif, system-ui, sans-serif`;function u(e){return{position:"absolute",left:e.x,top:e.y,width:e.w,height:e.h,transform:e.rotation?`rotate(${e.rotation}deg)`:void 0}}function f({chart:e}){const{w:t,h:i,points:o,color:r,kind:l}=e,n=i-56,a=Math.max(...o.map(e=>e.value),1),h=t/Math.max(o.length,1),s=e=>n-Math.max(e,0)/a*(n-40);return c("svg",{width:t,height:i,viewBox:`0 0 ${t} ${i}`,role:"img","aria-label":"Chart",style:{display:"block"},children:["line"===l?d("polyline",{fill:"none",stroke:r,strokeWidth:8,points:o.map((e,t)=>`${h*t+h/2},${s(e.value)}`).join(" ")}):o.map((e,t)=>d("rect",{x:h*t+.15*h,y:s(e.value),width:.7*h,height:n-s(e.value),fill:r},t)),o.map((e,t)=>c("g",{fontFamily:p,fontSize:30,fill:"#444441",textAnchor:"middle",children:[d("text",{x:h*t+h/2,y:i-14,children:e.label}),d("text",{x:h*t+h/2,y:s(e.value)-12,children:e.value})]},t))]})}function g({table:e}){const t=e.fontSize??32,i=e.rows[0]?.length??0,{columnWidths:o,rowHeights:r}=e,l=r?.slice(0,e.rows.length).reduce((e,t)=>e+t,0)??0,n=t=>r?.[t]&&l?r[t]*(e.h-2)/l:void 0;return c("table",{style:{width:"100%",height:"100%",borderCollapse:"collapse",fontFamily:p,fontSize:t,lineHeight:e.fontSize?1.2:void 0,color:"#2c2c2a",tableLayout:"fixed"},children:[o?.length===i&&d("colgroup",{children:o.map((e,t)=>d("col",{style:{width:100*e+"%"}},t))}),d("tbody",{children:e.rows.map((i,o)=>d("tr",{style:{height:n(o),background:0===o?e.headerFill:void 0,color:0===o?e.headerColor:void 0,fontWeight:0===o?500:400},children:i.map((i,r)=>d("td",{style:{border:"2px solid #b4b2a9",padding:`${.25*t}px ${.5*t}px`,overflow:"hidden",background:e.cellFills?.[o]?.[r]??void 0,color:e.cellColors?.[o]?.[r]??void 0},children:i},r))},o))})]})}function m({element:e}){switch(e.type){case"text":return d("div",{style:{width:"100%",height:"100%",fontFamily:p,fontSize:e.fontSize,fontWeight:e.bold?600:400,color:e.color,textAlign:e.align,lineHeight:1.25,whiteSpace:"pre-wrap",overflowWrap:"break-word"},children:e.text});case"shape":return d(s,{shape:e});case"image":return e.src?d("img",{src:e.src,alt:e.alt,draggable:!1,style:{width:"100%",height:"100%",objectFit:"contain",display:"block"}}):d("div",{style:{width:"100%",height:"100%",background:"#f1efe8",border:"4px dashed #b4b2a9",boxSizing:"border-box"}});case"chart":return d(f,{chart:e});case"table":return d(g,{table:e})}}function w({slide:e,width:t,editingId:r,editor:l}){const n=t/o;return d("div",{style:{width:t,height:i*n,overflow:"hidden",position:"relative",background:e.background},children:d("div",{style:{width:o,height:i,transform:`scale(${n})`,transformOrigin:"0 0",position:"absolute",left:0,top:0},children:e.elements.map(e=>d("div",{style:u(e),children:e.id===r?l:d(m,{element:e})},e.id))})})}export{p as SLIDE_FONT,w as SlideView};
|
package/dist/chunk-2PIEDEY5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={ABS:"Absolute value",AND:"True if all are true",AVERAGE:"Average of numbers",AVERAGEIF:"Average where a test passes",AVERAGEIFS:"Average on many tests",CEILING:"Rounds up to a multiple","CEILING.MATH":"Rounds up to a multiple",CHOOSE:"Picks by position",COLUMN:"Column number",COLUMNS:"Number of columns",CONCAT:"Joins text",CONCATENATE:"Joins text",COS:"Cosine",COUNT:"Counts numbers",COUNTA:"Counts non-blank cells",COUNTBLANK:"Counts blank cells",COUNTIF:"Counts where a test passes",COUNTIFS:"Counts on many tests",DATE:"Builds a date",DATEDIF:"Time between dates",DAY:"Day of the month",DAYS:"Days between dates",EDATE:"Date some months away",EOMONTH:"Last day of a month",EXACT:"Same text, case included",EXP:"e to a power",FIND:"Position of text, case exact",FLOOR:"Rounds down to a multiple","FLOOR.MATH":"Rounds down to a multiple",FV:"Future value",HLOOKUP:"Looks along the top row",HOUR:"Hour of a time",IF:"One value or another",IFERROR:"A fallback for an error",IFNA:"A fallback for #N/A",IFS:"First test that passes",INDEX:"The cell at a position",INT:"Rounds down to a whole number",ISBLANK:"True if blank",ISERROR:"True if an error",ISLOGICAL:"True if TRUE or FALSE",ISNA:"True if #N/A",ISNUMBER:"True if a number",ISTEXT:"True if text",LARGE:"The kth largest",LEFT:"Text from the start",LEN:"Length of text",LN:"Natural logarithm",LOG:"Logarithm",LOG10:"Base-10 logarithm",LOWER:"Lower case",MATCH:"Position of a value",MAX:"Largest number",MEDIAN:"Middle number",MID:"Text from the middle",MIN:"Smallest number",MINUTE:"Minute of a time",MOD:"Remainder",MODE:"Most common number","MODE.SNGL":"Most common number",MONTH:"Month of a date",N:"A value as a number",NA:"The #N/A error",NETWORKDAYS:"Working days between dates",NOT:"The opposite",NOW:"Date and time now",NPV:"Net present value",OR:"True if any is true",PI:"The number pi",PMT:"Loan payment",POWER:"A number to a power",PRODUCT:"Multiplies numbers",PROPER:"Capitals on each word",PV:"Present value",RAND:"Random from 0 to 1",RANDBETWEEN:"Random whole number",RANK:"Rank in a list","RANK.EQ":"Rank in a list",REPLACE:"Replaces by position",REPT:"Repeats text",RIGHT:"Text from the end",ROUND:"Rounds a number",ROUNDDOWN:"Rounds toward zero",ROUNDUP:"Rounds away from zero",ROW:"Row number",ROWS:"Number of rows",SEARCH:"Position of text, any case",SECOND:"Second of a time",SIGN:"Sign of a number",SIN:"Sine",SMALL:"The kth smallest",SQRT:"Square root",STDEV:"Standard deviation of a sample","STDEV.P":"Standard deviation of everything","STDEV.S":"Standard deviation of a sample",STDEVP:"Standard deviation of everything",SUBSTITUTE:"Replaces text",SUM:"Adds numbers",SUMIF:"Adds where a test passes",SUMIFS:"Adds on many tests",SUMPRODUCT:"Multiplies, then adds",SWITCH:"Picks a result by value",TAN:"Tangent",TEXT:"A number as formatted text",TEXTJOIN:"Joins with a separator",TIME:"Builds a time",TODAY:"Today's date",TRIM:"Removes extra spaces",TRUNC:"Cuts off decimals",UPPER:"Upper case",VALUE:"Text as a number",VAR:"Variance of a sample","VAR.P":"Variance of everything","VAR.S":"Variance of a sample",VARP:"Variance of everything",VLOOKUP:"Looks down the first column",WEEKDAY:"Day of the week",XLOOKUP:"Looks up in any column",XOR:"True if an odd number are true",YEAR:"Year of a date"},t={ABS:"绝对值",AND:"全部为真时返回真",AVERAGE:"数字的平均值",AVERAGEIF:"满足条件的平均值",AVERAGEIFS:"满足多个条件的平均值",CEILING:"向上舍入到倍数","CEILING.MATH":"向上舍入到倍数",CHOOSE:"按位置选择",COLUMN:"列号",COLUMNS:"列数",CONCAT:"连接文本",CONCATENATE:"连接文本",COS:"余弦",COUNT:"统计数字个数",COUNTA:"统计非空单元格",COUNTBLANK:"统计空单元格",COUNTIF:"统计满足条件的个数",COUNTIFS:"统计满足多个条件的个数",DATE:"生成日期",DATEDIF:"两个日期的间隔",DAY:"月份中的第几天",DAYS:"两个日期相差的天数",EDATE:"相隔若干个月的日期",EOMONTH:"月份的最后一天",EXACT:"文本完全相同",EXP:"e 的幂",FIND:"文本位置(区分大小写)",FLOOR:"向下舍入到倍数","FLOOR.MATH":"向下舍入到倍数",FV:"未来值",HLOOKUP:"在首行中查找",HOUR:"时间中的小时",IF:"二选一返回值",IFERROR:"出错时的备用值",IFNA:"#N/A 时的备用值",IFS:"第一个满足的条件",INDEX:"指定位置的单元格",INT:"向下取整",ISBLANK:"为空时返回真",ISERROR:"为错误时返回真",ISLOGICAL:"为逻辑值时返回真",ISNA:"为 #N/A 时返回真",ISNUMBER:"为数字时返回真",ISTEXT:"为文本时返回真",LARGE:"第 k 大的值",LEFT:"从开头截取文本",LEN:"文本长度",LN:"自然对数",LOG:"对数",LOG10:"以 10 为底的对数",LOWER:"转为小写",MATCH:"值的位置",MAX:"最大值",MEDIAN:"中位数",MID:"从中间截取文本",MIN:"最小值",MINUTE:"时间中的分钟",MOD:"余数",MODE:"出现最多的数字","MODE.SNGL":"出现最多的数字",MONTH:"日期中的月份",N:"转为数字",NA:"#N/A 错误",NETWORKDAYS:"两个日期之间的工作日",NOT:"取反",NOW:"当前日期和时间",NPV:"净现值",OR:"任一为真时返回真",PI:"圆周率",PMT:"贷款每期还款额",POWER:"幂运算",PRODUCT:"数字相乘",PROPER:"每个单词首字母大写",PV:"现值",RAND:"0 到 1 之间的随机数",RANDBETWEEN:"随机整数",RANK:"在列表中的排名","RANK.EQ":"在列表中的排名",REPLACE:"按位置替换",REPT:"重复文本",RIGHT:"从末尾截取文本",ROUND:"四舍五入",ROUNDDOWN:"向零舍入",ROUNDUP:"远离零舍入",ROW:"行号",ROWS:"行数",SEARCH:"文本位置(不区分大小写)",SECOND:"时间中的秒",SIGN:"数字的符号",SIN:"正弦",SMALL:"第 k 小的值",SQRT:"平方根",STDEV:"样本标准差","STDEV.P":"总体标准差","STDEV.S":"样本标准差",STDEVP:"总体标准差",SUBSTITUTE:"替换文本",SUM:"数字求和",SUMIF:"对满足条件的值求和",SUMIFS:"对满足多个条件的值求和",SUMPRODUCT:"相乘后求和",SWITCH:"按值选择结果",TAN:"正切",TEXT:"数字转为带格式的文本",TEXTJOIN:"用分隔符连接",TIME:"生成时间",TODAY:"今天的日期",TRIM:"删除多余空格",TRUNC:"截去小数",UPPER:"转为大写",VALUE:"文本转为数字",VAR:"样本方差","VAR.P":"总体方差","VAR.S":"样本方差",VARP:"总体方差",VLOOKUP:"在首列中查找",WEEKDAY:"星期几",XLOOKUP:"在任意列中查找",XOR:"奇数个为真时返回真",YEAR:"日期中的年份"},o={pdfPageFailed:e=>`Page ${e} couldn't be drawn for the PDF.`,untitled:"Untitled",backToFiles:"Back to files",filesHeading:"Spreadsheets",newFile:"New spreadsheet",openFile:"Open a file",filesEmptyTitle:"Make your first spreadsheet",filesEmptyBody:"Every change saves by itself.",deleteFile:"Delete",createFailed:"The spreadsheet could not be made.",deleteFailed:"The spreadsheet could not be deleted.",storedOpenFailed:"This spreadsheet could not be opened.",loading:"Loading",renameFailed:"The spreadsheet could not be renamed.",conflict:"Somebody else saved this spreadsheet, so your latest changes are not saved. Reload to see theirs.",reload:"Reload",noStoreEdited:"Not saved. Save as Excel to keep your changes",saveToFiles:"Save to Files",noStoreClean:"No autosave here. Save as Excel to keep a copy",deleteConfirm:e=>`Delete "${e}"? Nobody can open it again.`,spreadsheetFile:"spreadsheet",sheetBase:"Sheet",menuFile:"File",menuEdit:"Edit",menuView:"View",menuInsert:"Insert",menuFormat:"Format",menuData:"Data",menuNew:"New",menuOpen:"Open",saveExcel:"Save as Excel (.xlsx)",saveCsv:"Download this sheet as CSV",email:"Email",undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste",pasteValues:"Paste values only",pasteFormats:"Paste formatting only",findReplace:"Find and replace",clearValues:"Clear contents",freeze:"Freeze",gridlines:"Gridlines",showFormulas:"Show formulas",rowsAbove:"Rows above",rowsBelow:"Rows below",columnsLeft:"Columns left",columnsRight:"Columns right",sheet:"Sheet",function:"Function",functions:"Functions",number:"Number format",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontSize:"Font size",alignment:"Alignment",borders:"Borders",wrapText:"Wrap text",mergeCells:"Merge cells",clearFormatting:"Clear formatting",sortAscending:"Sort A to Z",sortDescending:"Sort Z to A",filter:"Filter",hideRows:"Hide rows",hideColumns:"Hide columns",unhideRows:"Show hidden rows",unhideColumns:"Show hidden columns",deleteRows:"Delete rows",deleteColumns:"Delete columns",formatGeneral:"Automatic",formatNumber:"Number",formatPercent:"Percent",formatScientific:"Scientific",formatCurrency:"Currency",formatDate:"Date",formatTime:"Time",formatDateTime:"Date and time",formatText:"Plain text",bordersAll:"All borders",bordersOuter:"Outer borders",bordersTop:"Top border",bordersBottom:"Bottom border",bordersLeft:"Left border",bordersRight:"Right border",bordersNone:"No borders",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",alignTop:"Top",alignMiddle:"Middle",alignBottom:"Bottom",formatPainter:"Paint format",fewerDecimals:"Fewer decimal places",moreDecimals:"More decimal places",textColor:"Text color",fillColor:"Fill color",nameBox:"Selected cells",formulaBar:"Formula bar",cellEditor:"Cell contents",selectAll:"Select all",fillHandle:"Fill",find:"Find",replaceWith:"Replace with",replace:"Replace",replaceAll:"Replace all",previous:"Previous",next:"Next",close:"Close",matchCase:"Match case",wholeCell:"Whole cell",inFormulas:"In formulas",addSheet:"Add sheet",rename:"Rename",duplicate:"Duplicate",moveLeft:"Move left",moveRight:"Move right",tabColor:"Tab color",noColor:"No color",deleteSheet:"Delete sheet",deleteSheetTitle:"Delete this sheet?",sheetNameTaken:"Another sheet already has that name.",saveFailed:"Could not save the workbook. Try again.",openFailed:"Could not open that file. It may be damaged or an unsupported type.",statSum:"Sum",statAverage:"Average",statCount:"Count",statMin:"Min",statMax:"Max",blank:"(Blank)",clear:"Clear",apply:"Apply",sheetName:e=>`Sheet ${e}`,filterColumn:e=>`Filter column ${e}`,freezeRows:e=>0===e?"No frozen rows":1===e?"1 row":`${e} rows`,freezeColumns:e=>0===e?"No frozen columns":1===e?"1 column":`${e} columns`,freezeUpToRow:e=>`Up to row ${e}`,freezeUpToColumn:e=>`Up to column ${e}`,hitCount:(e,t)=>`${e} of ${t}`,replacedCount:e=>1===e?"Replaced in 1 cell":`Replaced in ${e} cells`,deleteSheetMessage:e=>`"${e}" and everything on it will be deleted. Formulas that use it will show #REF!.`,functionHelp:t=>e[t]??String(t)},a={pdfPageFailed:e=>`第 ${e} 页无法绘制到 PDF。`,untitled:"未命名",backToFiles:"返回文件",filesHeading:"电子表格",newFile:"新建电子表格",openFile:"打开文件",filesEmptyTitle:"创建您的第一个电子表格",filesEmptyBody:"每次更改都会自动保存。",deleteFile:"删除",createFailed:"无法创建电子表格。",deleteFailed:"无法删除电子表格。",storedOpenFailed:"无法打开此电子表格。",loading:"正在加载",renameFailed:"无法重命名电子表格。",conflict:"其他人已保存此电子表格,您最近的更改尚未保存。请重新加载以查看他们的版本。",reload:"重新加载",noStoreEdited:"未保存。请另存为 Excel 以保留更改",saveToFiles:"保存到文件",noStoreClean:"此处不会自动保存。请另存为 Excel 以保留副本",deleteConfirm:e=>`删除“${e}”?之后任何人都无法再打开它。`,spreadsheetFile:"电子表格",sheetBase:"工作表",menuFile:"文件",menuEdit:"编辑",menuView:"视图",menuInsert:"插入",menuFormat:"格式",menuData:"数据",menuNew:"新建",menuOpen:"打开",saveExcel:"另存为 Excel(.xlsx)",saveCsv:"将此工作表下载为 CSV",email:"发送邮件",undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴",pasteValues:"仅粘贴数值",pasteFormats:"仅粘贴格式",findReplace:"查找和替换",clearValues:"清除内容",freeze:"冻结",gridlines:"网格线",showFormulas:"显示公式",rowsAbove:"在上方插入行",rowsBelow:"在下方插入行",columnsLeft:"在左侧插入列",columnsRight:"在右侧插入列",sheet:"工作表",function:"函数",functions:"函数",number:"数字格式",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontSize:"字号",alignment:"对齐",borders:"边框",wrapText:"自动换行",mergeCells:"合并单元格",clearFormatting:"清除格式",sortAscending:"升序排序",sortDescending:"降序排序",filter:"筛选",hideRows:"隐藏行",hideColumns:"隐藏列",unhideRows:"显示隐藏的行",unhideColumns:"显示隐藏的列",deleteRows:"删除行",deleteColumns:"删除列",formatGeneral:"自动",formatNumber:"数字",formatPercent:"百分比",formatScientific:"科学计数",formatCurrency:"货币",formatDate:"日期",formatTime:"时间",formatDateTime:"日期和时间",formatText:"纯文本",bordersAll:"所有边框",bordersOuter:"外边框",bordersTop:"上边框",bordersBottom:"下边框",bordersLeft:"左边框",bordersRight:"右边框",bordersNone:"无边框",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",formatPainter:"格式刷",fewerDecimals:"减少小数位",moreDecimals:"增加小数位",textColor:"文字颜色",fillColor:"填充颜色",nameBox:"所选单元格",formulaBar:"编辑栏",cellEditor:"单元格内容",selectAll:"全选",fillHandle:"填充",find:"查找",replaceWith:"替换为",replace:"替换",replaceAll:"全部替换",previous:"上一个",next:"下一个",close:"关闭",matchCase:"区分大小写",wholeCell:"整个单元格",inFormulas:"在公式中",addSheet:"添加工作表",rename:"重命名",duplicate:"复制工作表",moveLeft:"左移",moveRight:"右移",tabColor:"标签颜色",noColor:"无颜色",deleteSheet:"删除工作表",deleteSheetTitle:"删除此工作表?",sheetNameTaken:"已有工作表使用该名称。",saveFailed:"无法保存工作簿,请重试。",openFailed:"无法打开该文件,文件可能已损坏或类型不受支持。",statSum:"求和",statAverage:"平均值",statCount:"计数",statMin:"最小值",statMax:"最大值",blank:"(空白)",clear:"清除",apply:"应用",sheetName:e=>`工作表 ${e}`,filterColumn:e=>`筛选 ${e} 列`,freezeRows:e=>0===e?"不冻结行":`${e} 行`,freezeColumns:e=>0===e?"不冻结列":`${e} 列`,freezeUpToRow:e=>`冻结至第 ${e} 行`,freezeUpToColumn:e=>`冻结至 ${e} 列`,hitCount:(e,t)=>`${e} / ${t}`,replacedCount:e=>`已替换 ${e} 个单元格`,deleteSheetMessage:e=>`将删除“${e}”及其全部内容。引用它的公式将显示 #REF!。`,functionHelp:e=>t[e]??String(e)};export{o as ENGLISH_WORDS,a as ZH_HANS_WORDS};
|
package/dist/chunk-2TZUCKZ7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=1920,t=1080,n="Inter",s="transparent",r=20,a=()=>crypto.randomUUID();function i(){return{id:a(),background:"#ffffff",notes:"",elements:[]}}function l(e){const t=e?.slides;return Array.isArray(t)&&t.length>0?{slides:t}:{slides:[i()]}}function u(n){const s=(n,s)=>({id:a(),x:(e-n)/2,y:(t-s)/2,w:n,h:s,rotation:0});switch(n){case"text":return{...s(800,160),type:n,text:"Text",fontSize:64,bold:!1,color:"#2c2c2a",align:"left"};case"shape":return{...s(400,400),type:n,shape:"rect",fill:"#afa9ec"};case"image":return{...s(800,450),type:n,src:"",alt:""};case"chart":return{...s(900,600),type:n,kind:"bar",color:"#534ab7",points:[{label:"A",value:40},{label:"B",value:65},{label:"C",value:90}]};case"table":return{...s(1e3,400),type:n,headerFill:"#eeedfe",rows:[["Heading","Heading"],["Cell","Cell"]]}}}function c(e,t,n){return{slides:e.slides.map(e=>e.id===t?n(e):e)}}function o(e,t,n){const s=e.slides.findIndex(e=>e.id===t),r=[...e.slides];return r.splice(-1===s?r.length:s+1,0,n),{slides:r}}function f(e){return{...e,id:a(),elements:e.elements.map(e=>({...e,id:a()}))}}function h(e,t){const n=e.slides.filter(e=>e.id!==t);return{slides:n.length>0?n:[i()]}}function d(e,t,n){const s=e.slides.findIndex(e=>e.id===t);if(-1===s)return e;const r=[...e.slides],[a]=r.splice(s,1);return r.splice(Math.max(0,Math.min(n,r.length)),0,a),{slides:r}}function p(e,t,n){return{...e,elements:e.elements.map(e=>t.has(e.id)?n(e):e)}}function m(e,t){return{...e,elements:e.elements.filter(e=>!t.has(e.id))}}function x(e,t){const n=e.elements.filter(e=>t.has(e.id)).map(e=>({...e,id:a(),x:e.x+40,y:e.y+40}));return{slide:{...e,elements:[...e.elements,...n]},ids:n.map(e=>e.id)}}function y(e,t){const n=[...e.elements];for(let e=n.length-2;e>=0;e-=1)t.has(n[e].id)&&!t.has(n[e+1].id)&&([n[e],n[e+1]]=[n[e+1],n[e]]);return{...e,elements:n}}function w(e){const t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,w:Math.max(...e.map(e=>e.x+e.w))-t,h:Math.max(...e.map(e=>e.y+e.h))-n}}function M(n,s,r){const a=n.elements.filter(e=>s.has(e.id));if(0===a.length)return n;const i=1===a.length?{x:0,y:0,w:e,h:t}:w(a);return p(n,s,e=>"left"===r?{...e,x:i.x}:"right"===r?{...e,x:i.x+i.w-e.w}:{...e,x:i.x+(i.w-e.w)/2})}function g(n,s){const r=[{x:0,y:0,w:e,h:t},...s],a=(e,t,n)=>{let s=null;for(const r of[e,e+t/2,e+t])for(const e of n){const t=e-r;Math.abs(t)<=8&&(!s||Math.abs(t)<Math.abs(s.shift))&&(s={shift:t,at:e})}return s},i=a(n.x,n.w,r.flatMap(e=>[e.x,e.x+e.w/2,e.x+e.w])),l=a(n.y,n.h,r.flatMap(e=>[e.y,e.y+e.h/2,e.y+e.h]));return{box:{...n,x:n.x+(i?.shift??0),y:n.y+(l?.shift??0)},guides:{x:i?[i.at]:[],y:l?[l.at]:[]}}}var b=["nw","n","ne","e","se","s","sw","w"];function v(e,t,n,s,r=!1){let{x:a,y:i,w:l,h:u}=e;if(t.includes("e")&&(l=Math.max(20,e.w+n)),t.includes("s")&&(u=Math.max(20,e.h+s)),t.includes("w")&&(l=Math.max(20,e.w-n),a=e.x+e.w-l),t.includes("n")&&(u=Math.max(20,e.h-s),i=e.y+e.h-u),r&&2===t.length){const n=Math.max(l/e.w,u/e.h);l=e.w*n,u=e.h*n,t.includes("w")&&(a=e.x+e.w-l),t.includes("n")&&(i=e.y+e.h-u)}return{x:a,y:i,w:l,h:u}}function I(e,t,n,s=!1){const r=180*Math.atan2(n-(e.y+e.h/2),t-(e.x+e.w/2))/Math.PI+90;return((s?15*Math.round(r/15):Math.round(r))%360+360)%360}function A(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function j(e,t){switch(t.type){case"commit":return t.doc===e.present?e:{past:[...e.past,e.present].slice(-200),present:t.doc,future:[]};case"live":return{...e,present:t.doc};case"settle":return t.from===e.present?e:{past:[...e.past,t.from].slice(-200),present:e.present,future:[]};case"undo":{const t=e.past[e.past.length-1];return t?{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}:e}case"redo":{const[t,...n]=e.future;return t?{past:[...e.past,e.present],present:t,future:n}:e}}}function C(e){return e.map(e=>`${e.label}, ${e.value}`).join("\n")}function k(e){return e.split("\n").flatMap(e=>{const t=e.lastIndexOf(",");if(-1===t)return[];const n=Number(e.slice(t+1).trim()),s=e.slice(0,t).trim();return s&&e.slice(t+1).trim()&&Number.isFinite(n)?[{label:s,value:n}]:[]})}function F(e){return e.map(e=>e.join(", ")).join("\n")}function H(e){const t=e.split("\n").map(e=>e.split(",").map(e=>e.trim())),n=Math.max(...t.map(e=>e.length));return t.map(e=>[...e,...Array(n-e.length).fill("")])}export{e as SLIDE_W,t as SLIDE_H,n as DECK_FONT,s as NO_FILL,r as MIN_SIZE,a as newId,i as newSlide,l as asDocument,u as newElement,c as updateSlide,o as insertSlideAfter,f as copySlide,h as removeSlide,d as moveSlide,p as updateElements,m as removeElements,x as duplicateElements,y as bringForward,w as boundsOf,M as alignElements,g as snapBox,b as HANDLES,v as resizeBox,I as angleTo,A as boxesTouch,j as historyReducer,C as chartToText,k as textToChart,F as tableToText,H as textToTable};
|
package/dist/chunk-3SRMKGQW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useCallback as e,useEffect as i,useRef as t,useState as l}from"react";import{WindowTitle as n,confirmDestructive as c,toast as r}from"efficient-shell";import{Icon as a}from"efficient-shell/icons";import{Button as o,EmptyState as s}from"efficient-shell/ui";import{jsx as f,jsxs as d}from"react/jsx-runtime";function m({words:m,list:h,create:p,remove:u,canCreate:g,canDelete:v,accept:w,onOpen:C,onOpenFile:N}){const[k,y]=l(null),F=t(null),D=e(()=>{h().then(y,()=>y([]))},[h]);i(D,[D]);const x=g&&f(o,{onClick:()=>{p().then(({id:e})=>C(e),()=>r.error(m.createFailed))},children:m.newFile}),z=f(o,{variant:"ghost",leftIcon:f(a,{name:"folder-open",size:16}),onClick:()=>F.current?.click(),children:m.openFile});return d("div",{className:"office-filelist",children:[f(n,{title:m.windowTitle}),f("input",{ref:F,type:"file",accept:w,className:"office-filelist-input",onChange:e=>{const i=e.target.files?.[0];e.target.value="",i&&N(i)}}),d("div",{className:"office-filelist-head",children:[f("h2",{children:m.heading}),z,k&&k.length>0&&x]}),0===k?.length?f("div",{className:"office-filelist-empty",children:f(s,{title:m.emptyTitle,description:m.emptyBody,children:x})}):f("ul",{className:"office-filelist-rows",children:k?.map(e=>d("li",{className:"office-filelist-row",children:[f(o,{variant:"link",onClick:()=>C(e.id),children:e.title}),f("span",{className:"office-filelist-date",children:new Date(e.updatedAt).toLocaleDateString()}),v&&f(o,{variant:"ghost",leftIcon:f(a,{name:"trash",size:16}),onClick:async()=>{await c({message:m.deleteConfirm(e.title),confirmWord:m.delete})&&u(e.id).then(D,()=>r.error(m.deleteFailed))},children:m.delete})]},e.id))})]})}export{m as FileList};
|
package/dist/chunk-AVUZSUQD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={pdfPageFailed:e=>`Page ${e} couldn't be drawn for the PDF.`,backToFiles:"Back to files",filesHeading:"Documents",newFile:"New document",openFile:"Open a file",filesEmptyTitle:"Write your first document",filesEmptyBody:"Every change saves by itself.",deleteFile:"Delete",createFailed:"The document could not be made.",deleteFailed:"The document could not be deleted.",deleteConfirm:e=>`Delete "${e}"? Nobody can open it again.`,documentName:"Document name",documentPanel:"Document",pagePanel:"Page",outline:"Outline",outlineEmpty:"Headings in the document show here.",morePageSetup:"More page setup",export:"Export",renameFailed:"The document could not be renamed.",openFailed:"This document could not be opened.",conflict:"Somebody else saved this document, so your latest changes are not saved. Reload to see theirs.",reload:"Reload",noStoreEdited:"Not saved. Export to keep your changes",noStoreClean:"No autosave here. Export to keep a copy",openFromFiles:"Go back to your files to open another document.",untitled:"Untitled",loading:"Loading",newDocument:"New",open:"Open",rename:"Rename",menuFile:"File",menuInsert:"Insert",menuLayout:"Layout",save:"Save",saveDocx:"Save (.docx)",saveKeepType:"Save",saveAs:"Save as",saveAsWord:"Word document (.docx)",saveAsPdf:"PDF (from the print dialog)",saveAsWeb:"Web page (.html)",saveAsText:"Plain text (.txt)",print:"Print",undo:"Undo",redo:"Redo",find:"Find",replaceWith:"Replace with",replace:"Replace",replaceAll:"Replace all",matchCase:"Match case",previousMatch:"Previous match",nextMatch:"Next match",closeFind:"Close find",noMatches:"No matches",paragraphStyle:"Paragraph style",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",textColor:"Text color",highlight:"Highlight color",clearFormatting:"Clear formatting",bulletedList:"Bulleted list",numberedList:"Numbered list",decreaseIndent:"Decrease indent",increaseIndent:"Increase indent",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",justify:"Justify",lineSpacing:"Line spacing",styleNormal:"Normal",styleTitle:"Title",styleHeading1:"Heading 1",styleHeading2:"Heading 2",styleHeading3:"Heading 3",styleQuote:"Quote",table:"Table",image:"Image",link:"Link",linkPrompt:"Web address, or leave empty to remove the link.",linkInvalid:"That address can't be used as a link.",pageBreak:"Page break",pageNumber:"Page number",horizontalLine:"Horizontal line",rowAbove:"Insert row above",rowBelow:"Insert row below",columnLeft:"Insert column left",columnRight:"Insert column right",mergeCells:"Merge cells",mergeFailed:"These cells can't be merged: the selection would cut a merged cell.",cellShading:"Cell shading",noColor:"No color",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",imageWidth:"Image width",imageOriginalSize:"Original size",imageRemove:"Remove image",pageSetup:"Page setup",paperSize:"Size",paperLetter:"US Letter",paperLegal:"US Legal",custom:"Custom",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"Margins",marginsNormal:"Normal, 2.54 cm",marginsNarrow:"Narrow, 1.27 cm",marginsModerate:"Moderate, 1.91 cm sides",marginsWide:"Wide, 5.08 cm sides",header:"Header",footer:"Footer",headerFooterHint:"{page} and {pages} become page numbers. A | pushes the text after it to the right.",headerFooterLocked:"This one holds a picture or a table, so it is kept as it is. Edit it in Word.",ok:"OK",cancel:"Cancel",dismiss:"Dismiss",zoomIn:"Zoom in",zoomOut:"Zoom out",wrapLines:"Wrap lines",objectTextBox:"Text box",objectChart:"Chart from Word. Kept as is.",objectDiagram:"Diagram from Word. Kept as is.",objectEquation:"Equation from Word. Kept as is.",objectPicture:"Picture from Word. Kept as is.",objectOther:"Object from Word. Kept as is.",objectField:"Field",discardMessage:"They haven't been saved.",discard:"Discard",keepEditing:"Keep editing",legacyDoc:".doc is the old Word format. Save it as .docx in Word first.",openedOldSave:"Opened as a document. Save it to get a Word file.",saveFailed:"The document could not be saved.",savedAsUtf8:"Saved as UTF-8: the original encoding can't be written from a browser.",dropHint:"Drop a document to open. Images insert into the page.",matchCount:(e,t)=>`${e} of ${t}`,replacedCount:e=>1===e?"1 replacement":`${e} replacements`,tableSize:(e,t)=>`${e} × ${t}`,pageLabel:e=>`Page ${e}`,pageOf:(e,t)=>`Page ${e} of ${t}`,wordCount:e=>1===e?"1 word":`${e.toLocaleString()} words`,lineColumn:(e,t)=>`Ln ${e}, Col ${t}`,lineCount:e=>1===e?"1 line":`${e.toLocaleString()} lines`,noticeComments:e=>1===e?"1 comment":`${e} comments`,noticeTracked:e=>1===e?"1 tracked change":`${e} tracked changes`,noticeObjects:e=>1===e?"1 object such as a text box":`${e} objects such as text boxes`,noticeFootnotes:e=>1===e?"1 footnote":`${e} footnotes`,noticeLead:e=>`Has ${e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]}. They stay in the file, but need Word to edit.`,discardTitle:e=>`Discard your changes to ${e}?`,cannotRead:e=>`${e} can't be opened. It may be damaged or password protected.`,unsupported:e=>`Unsupported file type: .${e||"unknown"}`},t={pdfPageFailed:e=>`第 ${e} 页无法绘制到 PDF。`,backToFiles:"返回文件",filesHeading:"文档",newFile:"新建文档",openFile:"打开文件",filesEmptyTitle:"写下您的第一份文档",filesEmptyBody:"每次更改都会自动保存。",deleteFile:"删除",createFailed:"无法创建文档。",deleteFailed:"无法删除文档。",deleteConfirm:e=>`删除“${e}”?之后任何人都无法再打开它。`,documentName:"文档名称",documentPanel:"文档",pagePanel:"页面",outline:"大纲",outlineEmpty:"文档中的标题会显示在这里。",morePageSetup:"更多页面设置",export:"导出",renameFailed:"无法重命名文档。",openFailed:"无法打开此文档。",conflict:"其他人已保存此文档,您最近的更改尚未保存。请重新加载以查看他们的版本。",reload:"重新加载",noStoreEdited:"未保存。请导出以保留更改",noStoreClean:"此处不会自动保存。请导出以保留副本",openFromFiles:"请返回文件列表以打开其他文档。",untitled:"未命名",loading:"正在加载",newDocument:"新建",open:"打开",rename:"重命名",menuFile:"文件",menuInsert:"插入",menuLayout:"布局",save:"保存",saveDocx:"保存 (.docx)",saveKeepType:"保存",saveAs:"另存为",saveAsWord:"Word 文档 (.docx)",saveAsPdf:"PDF(通过打印对话框)",saveAsWeb:"网页 (.html)",saveAsText:"纯文本 (.txt)",print:"打印",undo:"撤销",redo:"重做",find:"查找",replaceWith:"替换为",replace:"替换",replaceAll:"全部替换",matchCase:"区分大小写",previousMatch:"上一个匹配项",nextMatch:"下一个匹配项",closeFind:"关闭查找",noMatches:"无匹配项",paragraphStyle:"段落样式",font:"字体",fontSize:"字号",bold:"加粗",italic:"倾斜",underline:"下划线",strikethrough:"删除线",superscript:"上标",subscript:"下标",textColor:"文字颜色",highlight:"突出显示颜色",clearFormatting:"清除格式",bulletedList:"项目符号列表",numberedList:"编号列表",decreaseIndent:"减少缩进",increaseIndent:"增加缩进",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",justify:"两端对齐",lineSpacing:"行距",styleNormal:"正文",styleTitle:"标题",styleHeading1:"标题 1",styleHeading2:"标题 2",styleHeading3:"标题 3",styleQuote:"引用",table:"表格",image:"图片",link:"链接",linkPrompt:"输入网址;留空则移除链接。",linkInvalid:"该地址不能用作链接。",pageBreak:"分页符",pageNumber:"页码",horizontalLine:"水平线",rowAbove:"在上方插入行",rowBelow:"在下方插入行",columnLeft:"在左侧插入列",columnRight:"在右侧插入列",mergeCells:"合并单元格",mergeFailed:"无法合并这些单元格:所选范围会切开已合并的单元格。",cellShading:"单元格底纹",noColor:"无颜色",deleteRow:"删除行",deleteColumn:"删除列",deleteTable:"删除表格",imageWidth:"图片宽度",imageOriginalSize:"原始大小",imageRemove:"移除图片",pageSetup:"页面设置",paperSize:"纸张大小",paperLetter:"美国信纸",paperLegal:"美国法律用纸",custom:"自定义",orientation:"方向",portrait:"纵向",landscape:"横向",margins:"页边距",marginsNormal:"常规,2.54 厘米",marginsNarrow:"窄,1.27 厘米",marginsModerate:"中等,左右 1.91 厘米",marginsWide:"宽,左右 5.08 厘米",header:"页眉",footer:"页脚",headerFooterHint:"{page} 和 {pages} 会变成页码。| 会把其后的文字推到右侧。",headerFooterLocked:"此处包含图片或表格,因此保持原样。请在 Word 中编辑。",ok:"确定",cancel:"取消",dismiss:"关闭",zoomIn:"放大",zoomOut:"缩小",wrapLines:"自动换行",objectTextBox:"文本框",objectChart:"来自 Word 的图表,保持原样。",objectDiagram:"来自 Word 的示意图,保持原样。",objectEquation:"来自 Word 的公式,保持原样。",objectPicture:"来自 Word 的图片,保持原样。",objectOther:"来自 Word 的对象,保持原样。",objectField:"域",discardMessage:"这些更改尚未保存。",discard:"放弃",keepEditing:"继续编辑",legacyDoc:".doc 是旧版 Word 格式,请先在 Word 中另存为 .docx。",openedOldSave:"已作为文档打开。保存后即可得到 Word 文件。",saveFailed:"无法保存文档。",savedAsUtf8:"已保存为 UTF-8:浏览器无法写入原始编码。",dropHint:"拖放文档以打开;图片会插入页面。",matchCount:(e,t)=>`第 ${e} 个,共 ${t} 个`,replacedCount:e=>`已替换 ${e} 处`,tableSize:(e,t)=>`${e} × ${t}`,pageLabel:e=>`第 ${e} 页`,pageOf:(e,t)=>`第 ${e} 页,共 ${t} 页`,wordCount:e=>`${e.toLocaleString()} 字`,lineColumn:(e,t)=>`第 ${e} 行,第 ${t} 列`,lineCount:e=>`${e.toLocaleString()} 行`,noticeComments:e=>`${e} 条批注`,noticeTracked:e=>`${e} 处修订`,noticeObjects:e=>`${e} 个文本框等对象`,noticeFootnotes:e=>`${e} 条脚注`,noticeLead:e=>`包含 ${e.join("、")}。它们会保留在文件中,但需要在 Word 中编辑。`,discardTitle:e=>`放弃对 ${e} 的更改?`,cannotRead:e=>`无法打开 ${e}。文件可能已损坏或受密码保护。`,unsupported:e=>`不支持的文件类型:.${e||"未知"}`};export{e as ENGLISH_WORDS,t as ZH_HANS_WORDS};
|
package/dist/chunk-SB3YS3LH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={decks:"Decks",newDeck:"New deck",untitledDeck:"Untitled deck",emptyTitle:"Make your first deck",emptyBody:"Build slides here, then present them or export to PowerPoint.",openFailed:"Couldn't open this deck",createFailed:"Could not create a deck.",deleteFailed:"Could not delete this deck.",backToDecks:"Back to decks",deleteConfirm:e=>`Delete "${e}"? This can't be undone.`,delete:"Delete",deckName:"Deck name",slidesPanel:"Slides",slideNumber:e=>`Slide ${e}`,slideOf:(e,t)=>`Slide ${e} of ${t}`,addSlide:"Add slide",duplicateSlide:"Duplicate slide",deleteSlide:"Delete slide",slideText:"Slide text",undo:"Undo",redo:"Redo",export:"Export",exportFailed:"Could not export this deck.",present:"Present",endShow:"End show",popupBlocked:"Your browser blocked the audience window. Allow pop-ups for this site, then end the show and present again.",back:"Back",next:"Next",nextSlide:"Next slide",endOfDeck:"End of the deck.",notes:"Notes",noNotes:"No notes for this slide.",speakerNotes:"Speaker notes",saveFailed:"Could not save this deck. Trying again.",renameFailed:"Could not rename this deck.",conflict:"Somebody else changed this deck. Your latest edits aren't saved. Reload to see their version.",reload:"Reload",addText:"Add text",addShape:"Add shape",addImage:"Add image",addChart:"Add chart",addTable:"Add table",elementText:"Text",elementShape:"Shape",elementImage:"Image",elementChart:"Chart",elementTable:"Table",slide:"Slide",objects:e=>`${e} objects`,background:"Background",positionAndSize:"Position and size",width:"W",height:"H",angle:"Angle",align:"Align",alignLeft:"Align left",alignCentre:"Align centre",alignRight:"Align right",bringForward:"Bring forward",size:"Size",weight:"Weight",regular:"Regular",bold:"Bold",textAlignment:"Text alignment",left:"Left",centre:"Centre",right:"Right",colour:"Colour",rectangle:"Rectangle",ellipse:"Ellipse",roundedRectangle:"Rounded rectangle",diamond:"Diamond",lineShape:"Line",outlineColour:"Outline colour",imageAddress:"Image address",chooseImage:"Choose image",imageTitle:"Slide image",description:"Description",data:"Data",chartType:"Chart type",bar:"Bar",line:"Line",values:"Values",valuesHint:"One label and number a line, like Sept, 42.",rows:"Rows",rowsHint:"One row a line, with commas between cells.",headingColour:"Heading colour",pptxPasswordProtected:"This file has a password. Remove it in PowerPoint, then import the file again.",pptxUnreadable:"This file can't be read as a PowerPoint (.pptx) file.",pptxLegacyFormat:"This is an older Office file. Save it as .pptx in PowerPoint, then import it again.",pptxTooManySlides:(e,t)=>`This deck has ${e} slides, and a deck can have at most ${t}.`,pptxTooLarge:(e,t)=>`This deck comes to ${e} MiB without its pictures, and a deck can be at most ${t} MiB. Split it into smaller decks.`,pdfSlideFailed:e=>`Slide ${e} couldn't be drawn for the PDF.`},t={decks:"演示文稿",newDeck:"新建演示文稿",untitledDeck:"未命名演示文稿",emptyTitle:"制作第一份演示文稿",emptyBody:"在这里制作幻灯片,然后放映或导出为 PowerPoint。",openFailed:"无法打开此演示文稿",createFailed:"无法创建演示文稿。",deleteFailed:"无法删除此演示文稿。",backToDecks:"返回演示文稿列表",deleteConfirm:e=>`要删除“${e}”吗?此操作无法撤销。`,delete:"删除",deckName:"演示文稿名称",slidesPanel:"幻灯片",slideNumber:e=>`第 ${e} 张幻灯片`,slideOf:(e,t)=>`第 ${e} 张,共 ${t} 张`,addSlide:"添加幻灯片",duplicateSlide:"复制幻灯片",deleteSlide:"删除幻灯片",slideText:"幻灯片文字",undo:"撤销",redo:"重做",export:"导出",exportFailed:"无法导出此演示文稿。",present:"放映",endShow:"结束放映",popupBlocked:"浏览器阻止了观众窗口。请允许此网站的弹出窗口,然后结束放映并重新放映。",back:"上一张",next:"下一张",nextSlide:"下一张幻灯片",endOfDeck:"演示文稿已结束。",notes:"备注",noNotes:"此幻灯片没有备注。",speakerNotes:"演讲者备注",saveFailed:"无法保存此演示文稿,正在重试。",renameFailed:"无法重命名此演示文稿。",conflict:"其他人修改了此演示文稿,您最近的编辑未保存。请重新加载以查看对方的版本。",reload:"重新加载",addText:"添加文字",addShape:"添加形状",addImage:"添加图片",addChart:"添加图表",addTable:"添加表格",elementText:"文字",elementShape:"形状",elementImage:"图片",elementChart:"图表",elementTable:"表格",slide:"幻灯片",objects:e=>`${e} 个对象`,background:"背景",positionAndSize:"位置和大小",width:"宽",height:"高",angle:"角度",align:"对齐",alignLeft:"左对齐",alignCentre:"居中对齐",alignRight:"右对齐",bringForward:"上移一层",size:"字号",weight:"字重",regular:"常规",bold:"粗体",textAlignment:"文字对齐",left:"左",centre:"中",right:"右",colour:"颜色",rectangle:"矩形",ellipse:"椭圆",roundedRectangle:"圆角矩形",diamond:"菱形",lineShape:"线条",outlineColour:"轮廓颜色",imageAddress:"图片地址",chooseImage:"选择图片",imageTitle:"幻灯片图片",description:"描述",data:"数据",chartType:"图表类型",bar:"柱形图",line:"折线图",values:"数值",valuesHint:"每行一个标签和数字,例如 九月, 42。",rows:"行",rowsHint:"每行一行数据,单元格之间用逗号分隔。",headingColour:"标题颜色",pptxPasswordProtected:"此文件设有密码。请先在 PowerPoint 中移除密码,再重新导入。",pptxUnreadable:"无法将此文件读取为 PowerPoint (.pptx) 文件。",pptxLegacyFormat:"这是旧版 Office 文件。请先在 PowerPoint 中另存为 .pptx,再重新导入。",pptxTooManySlides:(e,t)=>`此演示文稿有 ${e} 张幻灯片,最多只能有 ${t} 张。`,pptxTooLarge:(e,t)=>`此演示文稿不计图片已达 ${e} MiB,上限为 ${t} MiB。请拆分成较小的演示文稿。`,pdfSlideFailed:e=>`第 ${e} 张幻灯片无法绘制到 PDF。`};export{e as ENGLISH_WORDS,t as ZH_HANS_WORDS};
|
package/dist/chunk-XKOHIZO5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BUILTIN_STYLES as e,DEFAULT_PAGE as t,REL as n,child as o,childrenOf as a,descendants as r,paraCss as s,parseParaProps as c,parseRunProps as l,parseXml as i,partText as d,readRels as p,readThemeFonts as f,readZip as w,resolveTarget as m,runCss as u}from"./chunk-RHW2M2UY.js";import{escapeHtml as g}from"efficient-shell/ui";var h={textBox:"Text box",chart:"Chart",diagram:"Diagram",equation:"Equation",picture:"Picture",object:"Object",contents:"Field"},b=new Set(["w:ins","w:del","w:moveFrom","w:moveTo","w:rPrChange","w:pPrChange","w:tcPrChange","w:trPrChange","w:tblPrChange","w:sectPrChange","w:cellIns","w:cellDel"]),$=new Set(["w:ins","w:del","w:moveFrom","w:moveTo"]),y={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml"},k=/^(https?:|mailto:|tel:)/i,v=e=>g(e);function x(e,t){let n="";for(let t=0;t<e.length;t+=32768)n+=String.fromCharCode(...e.subarray(t,t+32768));return`data:${t};base64,${btoa(n)}`}var T=(e,t)=>`${t}${++e.nextId}`,C=(e,t)=>e.src.slice(t.start,t.end),A=(e,t)=>t?C(e,t):void 0;function S(e,t){const n=[],a=new Set;let r=t;for(;r&&!a.has(r);){a.add(r);const t=e.styles.get(r);if(!t)break;n.unshift(t),r=o(t,"w:basedOn")?.attrs["w:val"]}return n}var P=e=>`"${e.replace(/["\\\n\r]/g,"")}"`;function j(e){return"w:t"===e.name||"w:delText"===e.name?e.text:"w:tab"===e.name?"\t":"w:instrText"===e.name||"w:instrDelText"===e.name?"":e.children.map(j).join("")}function N(e,t,n,o,a=""){const r=T(e,"x");return e.doc.raw.set(r,t),`<span data-raw="${r}" data-kind="${n}" contenteditable="false"${a}>${g(o)}</span>`}function E(e,t){const n=T(e,"x");return e.doc.raw.set(n,t),`<span data-raw="${n}" data-kind="mark"></span>`}function I(e,t,n){const a=n(C(e,t)),s=e=>r(t,new Set([e])).length>0,c=o(t,"wp:inline"),l=r(t,new Set(["a:blip"]))[0],i=l&&e.rels.get(l.attrs["r:embed"]),d=i&&!i.external?m(e.doc.docPath,i.target):void 0,p=d?.split(".").pop()?.toLowerCase()??"",f=d?e.doc.parts.get(d):void 0;if(f&&y[p]&&!s("wps:txbx")){const n=T(e,"x");e.doc.raw.set(n,a);const r=o(c??o(t,"wp:anchor"),"wp:extent"),s=Number(r?.attrs.cx)/12700,l=Number(r?.attrs.cy)/12700,i=s&&l?` style="width:${Math.round(100*s)/100}pt;height:${Math.round(100*l)/100}pt"`:"",d=c?"":' contenteditable="false"';return c||e.doc.notices.objects++,`<img data-raw="${n}" src="${v(e.imageUrl(f,y[p]))}"${i}${d} alt="">`}return e.doc.notices.objects++,s("wps:txbx")||s("w:txbxContent")?N(e,a,"object",`${e.labels.textBox}: ${j(t).slice(0,80)}`):s("c:chart")?N(e,a,"object",e.labels.chart):s("dgm:relIds")?N(e,a,"object",e.labels.diagram):N(e,a,"object",l?e.labels.picture:e.labels.object)}function M(e,t){const n=o(t,"w:rPr"),a=l(n,e.theme),s=A(e,n)??"",c=e=>`<w:r>${s}${e}</w:r>`;let i="";for(const n of t.children)switch(n.name){case"w:rPr":case"w:lastRenderedPageBreak":case"w:commentReference":case"w:fldChar":case"w:instrText":case"w:delInstrText":break;case"w:t":case"w:delText":i+=g(n.text);break;case"w:tab":i+="\t";break;case"w:noBreakHyphen":i+="‑";break;case"w:softHyphen":i+="";break;case"w:br":case"w:cr":"page"===n.attrs["w:type"]?i+='<span data-page-break contenteditable="false"></span>':"column"===n.attrs["w:type"]?i+=N(e,c(C(e,n)),"mark",""):i+="<br>";break;case"w:drawing":i+=I(e,n,c);break;case"mc:AlternateContent":case"w:pict":case"w:object":e.doc.notices.objects++,i+=N(e,c(C(e,n)),"object",r(n,new Set(["wps:txbx","w:txbxContent","v:textbox"])).length?`${e.labels.textBox}: ${j(r(n,new Set(["wps:txbx","w:txbxContent","v:textbox"]))[0]).slice(0,80)}`:e.labels.object);break;case"w:footnoteReference":case"w:endnoteReference":{const t=++e.footnoteCount;e.doc.notices.footnotes++;const o=e.footnotes.get(n.attrs["w:id"]);i+=N(e,c(C(e,n)),"note",String(t),o?` title="${v(o)}"`:"");break}default:i+=N(e,c(C(e,n)),"mark","")}if(!i)return"";if(a.vert&&(i=`<${"sub"===a.vert?"sub":"sup"}>${i}</${"sub"===a.vert?"sub":"sup"}>`),n){const t=T(e,"r");e.doc.runs.set(t,s);const r=u(a),c=o(n,"w:rStyle")?.attrs["w:val"];i=`<span data-r="${t}"${c?` data-rstyle="${v(c)}"`:""}${r?` style="${v(r)}"`:""}>${i}</span>`}for(const t of e.openComments)i=`<span data-comment="${v(t)}" title="${v(e.comments.get(t)??"")}">${i}</span>`;return i}function L(e,t){let n="",o=0,r=-1,s=-1,c="",l=!1;const i=()=>{r>=0&&(n+=N(e,e.src.slice(r,s),"field",c||e.labels.contents)),r=-1,c="",l=!1};for(const d of t){if("w:r"===d.name){const t=a(d,"w:fldChar");if(t.length||o>0){0===o&&(r=d.start,l=!1),l&&(c+=j(d));for(const e of t){const t=e.attrs["w:fldCharType"];"begin"===t?o++:"separate"===t&&1===o?l=!0:"end"===t&&o--}s=d.end,0===o&&i();continue}n+=M(e,d);continue}if(o>0)s=d.end;else switch(d.name){case"w:pPr":case"w:proofErr":break;case"w:commentRangeStart":e.openComments.add(d.attrs["w:id"]);break;case"w:commentRangeEnd":e.openComments.delete(d.attrs["w:id"]);break;case"w:hyperlink":{const t=d.attrs["r:id"]?e.rels.get(d.attrs["r:id"]):void 0,o=d.attrs["w:anchor"],a=t?.target??(o?`#${o}`:""),r=k.test(a)||a.startsWith("#"),s=`${t?` data-rel="${v(d.attrs["r:id"])}"`:""}${o?` data-anchor="${v(o)}"`:""}`;n+=`<a${r?` href="${v(a)}"`:""}${s}>${L(e,d.children)}</a>`;break}case"w:ins":case"w:moveTo":n+=`<ins>${L(e,d.children)}</ins>`;break;case"w:del":case"w:moveFrom":n+=`<del>${L(e,d.children)}</del>`;break;case"w:bookmarkStart":case"w:bookmarkEnd":case"w:permStart":case"w:permEnd":default:n+=E(e,C(e,d));break;case"m:oMath":case"m:oMathPara":e.doc.notices.objects++,n+=N(e,C(e,d),"object",e.labels.equation);break;case"w:fldSimple":case"w:sdt":case"w:smartTag":case"w:customXml":n+=N(e,C(e,d),"field",j(d)||e.labels.contents)}}return o>0&&(n+=g(c)),n}function O(e){return r(e,b).length>0}function B(e,t){const n=o(t,"w:pPr"),a=o(n,"w:pStyle")?.attrs["w:val"],r=o(n,"w:numPr")??function(e,t){let n;for(const a of S(e,t))n=o(o(a,"w:pPr"),"w:numPr")??n;return n}(e,a),s=o(r,"w:numId")?.attrs["w:val"];if(!s||"0"===s)return null;const c=Number(o(r,"w:ilvl")?.attrs["w:val"]??0),l=e.numbering.get(s)?.get(c);return{numId:s,ilvl:c,ordered:l?.ordered??!1,marker:l?.marker??""}}function R(e){const t=[],n=o(e,"w:pBdr");for(const e of["top","bottom","left","right"]){const a=o(n,`w:${e}`);if(!a||"nil"===a.attrs["w:val"]||"none"===a.attrs["w:val"])continue;const r=/^[0-9a-fA-F]{6}$/.test(a.attrs["w:color"]??"")?`#${a.attrs["w:color"]}`:"currentcolor";t.push(`border-${e}:${(Number(a.attrs["w:sz"])||4)/8}pt solid ${r}`)}const a=o(e,"w:shd")?.attrs["w:fill"];return a&&/^[0-9a-fA-F]{6}$/.test(a)&&t.push(`background-color:#${a}`),t.join(";")}function H(e,t,n){const a=o(t,"w:pPr"),l=o(a,"w:pStyle")?.attrs["w:val"],i=e.fieldOpen,d=function(e){let t=0;for(const n of r(e,new Set(["w:fldChar"]))){const e=n.attrs["w:fldCharType"];"begin"===e?t++:"end"===e&&t--}return t}(t),p=O(t)||i||0!==d;d>0&&(e.fieldOpen=!0),i&&d<0&&(e.fieldOpen=!1);const f=T(e,"p");e.doc.blocks.set(f,{xml:C(e,t),fingerprint:"",props:A(e,a),numId:n?.numId,ilvl:n?.ilvl});const w=n?0:function(e,t){if(!t)return 0;const n=o(e.styles.get(t),"w:name")?.attrs["w:val"]??"",a=/^heading ([1-6])$/i.exec(n);return a?Number(a[1]):0}(e,l),m=n?"li":w?`h${w}`:"p",u=c(a);n&&delete u.indentLeft,n&&delete u.firstLine;const g=[s(u),R(a)].filter(Boolean).join(";");let h=p?D(e,t):L(e,t.children);h&&!/<br>(<\/[^>]+>)*$/.test(h)||(h+="<br>");return`<${m} data-docx="${f}"${o(a,"w:pageBreakBefore")?" data-break-before":""}${l?` data-pstyle="${v(l)}"`:""}${g?` style="${v(g)}"`:""}${p?' data-locked contenteditable="false"':""}>${h}</${m}>`}function D(e,t){let n="";for(const o of t.children)"w:pPr"!==o.name&&"w:rPr"!==o.name&&"w:instrText"!==o.name&&"w:delInstrText"!==o.name&&("w:ins"===o.name||"w:moveTo"===o.name?n+=`<ins>${D(e,o)}</ins>`:"w:del"===o.name||"w:moveFrom"===o.name?n+=`<del>${D(e,o)}</del>`:"w:commentRangeStart"===o.name?e.openComments.add(o.attrs["w:id"]):"w:commentRangeEnd"===o.name?e.openComments.delete(o.attrs["w:id"]):"w:t"===o.name||"w:delText"===o.name?n+=g(o.text):"w:tab"===o.name?n+="\t":"w:br"===o.name?n+="<br>":"w:drawing"===o.name||"mc:AlternateContent"===o.name||"w:pict"===o.name?n+=`<span data-kind="object">${g(e.labels.object)}</span>`:n+=D(e,o));return n}function U(e,t){const n=T(e,"t"),r=o(t,"w:tblPr"),s=o(t,"w:tblGrid"),c=a(t,"w:tr"),l=c.some(e=>o(o(e,"w:trPr"),"w:gridBefore")||o(o(e,"w:trPr"),"w:gridAfter")),i=O(t)||l;l&&e.doc.notices.objects++,e.doc.blocks.set(n,{xml:C(e,t),fingerprint:"",props:A(e,r),tblGrid:A(e,s)});const d=o(r,"w:tblStyle")?.attrs["w:val"],p=a(s,"w:gridCol").map(e=>Number(e.attrs["w:w"])/20),f=new Map,w=c.map(e=>{const t=[];let n=0;for(const r of a(e,"w:tc")){const e=o(r,"w:tcPr"),a=Number(o(e,"w:gridSpan")?.attrs["w:val"]??1),s=o(e,"w:vMerge");if(s&&"restart"!==s.attrs["w:val"]&&f.has(n))f.get(n).rowSpan++;else{const e={node:r,rowSpan:1,col:n,span:a};t.push(e),s?f.set(n,e):f.delete(n)}n+=a}return t}),m=function(e,t,n){let a=o(t,"w:tblBorders");if(!a)for(const t of S(e,n))a=o(o(t,"w:tblPr"),"w:tblBorders")??a;return!!a&&a.children.some(e=>!["nil","none"].includes(e.attrs["w:val"]))}(e,r,d),u=c.map((t,n)=>{const a=T(e,"t");e.doc.blocks.set(a,{xml:"",fingerprint:"",props:A(e,o(t,"w:trPr"))});return`<tr data-docx="${a}">${w[n].map(t=>{const n=T(e,"t"),a=o(t.node,"w:tcPr");e.doc.blocks.set(n,{xml:"",fingerprint:"",props:A(e,a)});const r=o(a,"w:shd")?.attrs["w:fill"],s=[];r&&/^[0-9a-fA-F]{6}$/.test(r)&&s.push(`background-color:#${r.toLowerCase()}`);const c=o(a,"w:vAlign")?.attrs["w:val"];return"center"===c&&s.push("vertical-align:middle"),"bottom"===c&&s.push("vertical-align:bottom"),`<td data-docx="${n}"${t.span>1?` colspan="${t.span}"`:""}${t.rowSpan>1?` rowspan="${t.rowSpan}"`:""}${s.length?` style="${s.join(";")}"`:""}>${F(e,t.node.children)}</td>`}).join("")}</tr>`}).join(""),g=p.length?`<colgroup>${p.map(e=>`<col style="width:${Math.round(100*e)/100}pt">`).join("")}</colgroup>`:"";return`<table data-docx="${n}"${d?` data-tstyle="${v(d)}"`:""}${m?"":" data-no-borders"}${i?' data-locked contenteditable="false"':""}>${g}<tbody>${u}</tbody></table>`}function F(e,t){const n=[],r=[],s=e=>{for(;r.length>e;){const e=r.pop();n.push(`</li></${e.tag}>`)}};for(const c of t){const t="w:p"===c.name?B(e,c):null;if(t){for(;r.length&&r[r.length-1].ilvl>t.ilvl;)s(r.length-1);const o=r[r.length-1];!o||o.ilvl!==t.ilvl||o.numId===t.numId&&o.tag===(t.ordered?"ol":"ul")||s(r.length-1);const a=`${t.numId}:${t.ilvl}`,l=e.listCounters.get(a)??0;e.listCounters.set(a,l+1);const i=H(e,c,t),d=r[r.length-1];if(d&&d.ilvl===t.ilvl)n.push(`</li>${i.slice(0,i.lastIndexOf("</li>"))}`);else{const e=t.ordered?"ol":"ul",o=t.marker?` style="list-style-type:${t.marker}"`:"",a=t.ordered&&l?` start="${l+1}"`:"";n.push(`<${e} data-num-id="${v(t.numId)}" data-ilvl="${t.ilvl}"${a}${o}>${i.slice(0,i.lastIndexOf("</li>"))}`),r.push({tag:e,numId:t.numId,ilvl:t.ilvl})}continue}if("w:tcPr"!==c.name&&"w:sectPr"!==c.name)if(s(0),"w:p"===c.name)n.push(H(e,c,null));else if("w:tbl"===c.name)n.push(U(e,c));else if("w:sdt"===c.name){const t=T(e,"p");e.doc.blocks.set(t,{xml:C(e,c),fingerprint:""}),e.doc.notices.objects++;const r=F(e,a(o(c,"w:sdtContent"),"w:p"));n.push(`<div data-docx="${t}" data-locked contenteditable="false">${r}</div>`)}else{const t=T(e,"p");e.doc.blocks.set(t,{xml:C(e,c),fingerprint:""}),n.push(`<div data-docx="${t}" data-locked data-hidden contenteditable="false"></div>`)}}return s(0),n.join("")}function z(e){if("LI"!==e.tagName)return e.outerHTML;const t=e.cloneNode(!0);return Array.from(t.children).forEach(e=>{"UL"!==e.tagName&&"OL"!==e.tagName||e.remove()}),t.outerHTML}function V(e){const t=document.createElement("div");t.innerHTML=e.html,t.querySelectorAll("[data-docx]").forEach(t=>{const n=e.blocks.get(t.getAttribute("data-docx"));n&&(n.fingerprint=z(t))})}function q(e,t){const n=t?d(e,t):void 0;if(!n)return{text:"",editable:!0};const o=i(n),a=o.children.filter(e=>"w:p"===e.name),s=o.children.every(e=>"w:p"===e.name)&&0===r(o,new Set(["w:drawing","w:pict","mc:AlternateContent","w:sdt"])).length,c=a.map(e=>{let t="",n="",o=!1;const a=e=>{for(const r of e.children)if("w:t"===r.name)o||(t+=r.text);else if("w:tab"===r.name)o||(t+=" | ");else if("w:instrText"===r.name)n+=r.text;else if("w:fldChar"===r.name){const e=r.attrs["w:fldCharType"];"separate"!==e&&"end"!==e||(n&&(t+=G(n),n=""),o="separate"===e)}else"w:fldSimple"===r.name?t+=G(r.attrs["w:instr"]??"")||r.children.map(j).join(""):"w:pPr"!==r.name&&"w:rPr"!==r.name&&a(r)};return a(e),t}).filter(Boolean);return{text:c.join(" "),editable:s&&c.length<=1,part:t}}function G(e){const t=e.trim().split(/\s+/)[0]?.toUpperCase();return"PAGE"===t?"{page}":"NUMPAGES"===t?"{pages}":""}async function W(e,t={}){return K(await w(e),e,t)}function K(w,g,b={}){const y=p(w,"").find(e=>e.type.endsWith("/officeDocument")),k=y?m("",y.target):"word/document.xml",v=d(w,k);if(!v)throw new Error("Not a Word document");const T=i(v),C=o(T,"w:body");if(!C)throw new Error("Not a Word document");const A=p(w,k),N=e=>{const t=(e=>A.find(t=>t.type===e))(e);return t?m(k,t.target):void 0},E=f(N(n.theme)?d(w,N(n.theme)):void 0),I={parts:w,docPath:k,source:g,html:"",css:"",page:{...t},header:{text:"",editable:!0},footer:{text:"",editable:!0},blocks:new Map,runs:new Map,raw:new Map,notices:{comments:0,tracked:0,objects:0,footnotes:0},styles:[],theme:E},M={src:v,doc:I,labels:b.labels??h,rels:new Map(A.map(e=>[e.id,e])),theme:E,imageUrl:b.imageUrl??x,styles:new Map,numbering:new Map,listCounters:new Map,comments:new Map,footnotes:new Map,nextId:0,footnoteCount:0,openComments:new Set,fieldOpen:!1},L=N(n.styles),O=L?d(w,L):void 0,B=O?i(O):void 0;for(const e of a(B,"w:style"))M.styles.set(e.attrs["w:styleId"],e);const R=new Set(M.styles.keys());for(const[t,n]of Object.entries(e))R.has(t)||M.styles.set(t,i(n.xml));const H=o(B,"w:docDefaults");I.lang=o(o(o(H,"w:rPrDefault"),"w:rPr"),"w:lang")?.attrs["w:val"],I.css=function(e,t){const n=[],a=l(o(o(t,"w:rPrDefault"),"w:rPr"),e.theme),r=c(o(o(t,"w:pPrDefault"),"w:pPr"));e.doc.defaultFont=a.font,e.doc.defaultSize=a.size;let i=a,d=r;for(const[t,p]of e.styles){const f=p.attrs["w:type"];if("paragraph"!==f&&"character"!==f&&"table"!==f)continue;let w={},m={};for(const n of S(e,t))w={...w,...l(o(n,"w:rPr"),e.theme)},m={...m,...c(o(n,"w:pPr"))};if("paragraph"===f)n.push(`.docs-page [data-pstyle=${P(t)}]{${[u(w),s(m)].filter(Boolean).join(";")}}`),"1"===p.attrs["w:default"]&&(i={...a,...w},d={...r,...m});else if("character"===f)n.push(`.docs-page [data-rstyle=${P(t)}]{${u(w)}}`);else{const e=s(m);e&&n.push(`.docs-page table[data-tstyle=${P(t)}] p{${e}}`)}}return n.unshift(`.docs-page{${u(i)}}`,`.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6,.docs-page li{${s(d)}}`),n.join("\n")}(M,H);const D=new Set(Object.keys(e));I.styles=[...M.styles.values()].filter(e=>"paragraph"===e.attrs["w:type"]&&"1"!==e.attrs["w:default"]&&(D.has(e.attrs["w:styleId"])||o(e,"w:qFormat"))&&!o(e,"w:hidden")&&!o(e,"w:semiHidden")).map(e=>({id:e.attrs["w:styleId"],name:o(e,"w:name")?.attrs["w:val"]??e.attrs["w:styleId"]}));const U=N(n.numbering),z=U?d(w,U):void 0;z&&function(e,t){const n=new Map;for(const e of a(t,"w:abstractNum")){const t=new Map;for(const n of a(e,"w:lvl")){const e=o(n,"w:numFmt")?.attrs["w:val"]??"decimal";t.set(Number(n.attrs["w:ilvl"]),{ordered:"bullet"!==e&&"none"!==e,marker:Y[e]??""})}n.set(e.attrs["w:abstractNumId"],t)}for(const r of a(t,"w:num")){const t=n.get(o(r,"w:abstractNumId")?.attrs["w:val"]??"");t&&e.numbering.set(r.attrs["w:numId"],t)}}(M,i(z));const G=N(n.comments),W=G?d(w,G):void 0;if(W){for(const e of a(i(W),"w:comment"))M.comments.set(e.attrs["w:id"],`${e.attrs["w:author"]??""}: ${j(e)}`);I.notices.comments=M.comments.size}const K=N(n.footnotes),Q=K?d(w,K):void 0;if(Q)for(const e of a(i(Q),"w:footnote"))M.footnotes.set(e.attrs["w:id"],j(e));I.notices.tracked=r(C,$).length;const X=o(C,"w:sectPr"),J=o(X,"w:pgSz"),Z=o(X,"w:pgMar"),_=(e,t,n)=>{const o=Number(e?.attrs[t]);return Number.isFinite(o)&&void 0!==e?.attrs[t]?o:n};I.page={width:_(J,"w:w",t.width),height:_(J,"w:h",t.height),top:Math.abs(_(Z,"w:top",t.top)),right:_(Z,"w:right",t.right),bottom:Math.abs(_(Z,"w:bottom",t.bottom)),left:_(Z,"w:left",t.left),header:_(Z,"w:header",t.header),footer:_(Z,"w:footer",t.footer)};const ee=e=>{const t=a(X,e).find(e=>"default"===e.attrs["w:type"]),n=t&&M.rels.get(t.attrs["r:id"]);return n?m(k,n.target):void 0};return I.header=q(w,ee("w:headerReference")),I.footer=q(w,ee("w:footerReference")),I.html=F(M,C.children),I.html||(I.html="<p><br></p>"),V(I),I}var Y={lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",decimalZero:"decimal-leading-zero"};var Q=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI","TR","TABLE","UL","OL","TBODY"]);function X(e){let t="";const n=e=>{for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t+=(o.nodeValue??"").replace(//g,"");continue}if(1!==o.nodeType)continue;const e=o;if("BR"===e.tagName){t+="\n";continue}if("DEL"===e.tagName||e.hasAttribute("data-hidden"))continue;if("object"===e.getAttribute("data-kind")||"mark"===e.getAttribute("data-kind"))continue;if("TD"===e.tagName||"TH"===e.tagName){n(e),t=`${t.replace(/\n+$/,"")}\t`;continue}const a=Q.has(e.tagName);n(e),a&&!t.endsWith("\n")&&(t+="\n")}};return n(e),t.replace(/\t\n/g,"\n").replace(/\n+$/,"\n")}function J(e){return(e.match(/[-ヿ㐀-鿿豈-]/g)?.length??0)+(e.replace(/[-ヿ㐀-鿿豈-]/g," ").match(/\S+/g)?.length??0)}function Z(e,t,n){if(!t)return[];const o=function(e){const t=[],n=e=>{for(const o of Array.from(e.childNodes))if(3===o.nodeType)t.push(o);else if(1===o.nodeType){const e=o;if("false"===e.getAttribute("contenteditable")||e.hasAttribute("data-raw"))continue;n(e)}};return n(e),t}(e),a=t=>{let n=t.parentNode;for(;n&&n!==e&&!Q.has(n.tagName)&&"TD"!==n.tagName;)n=n.parentNode;return n},r=[];let s=0;for(;s<o.length;){const e=a(o[s]);let c=s;const l=[];for(;c<o.length&&a(o[c])===e;)l.push(o[c++]);const i=l.map(e=>e.nodeValue??"").join(""),d=n?i:i.toLowerCase(),p=n?t:t.toLowerCase(),f=d.length===i.length?d:i;for(let e=f.indexOf(p);e>=0;e=f.indexOf(p,e+p.length)){const t=[];let n=0;for(const o of l){const a=(o.nodeValue??"").length,r=Math.max(e,n),s=Math.min(e+p.length,n+a);r<s&&t.push({node:o,start:r-n,end:s-n}),n+=a}r.push(t)}s=c}return r}function _(e,t){e.forEach((e,n)=>{const o=e.node.nodeValue??"";e.node.nodeValue=o.slice(0,e.start)+(0===n?t:"")+o.slice(e.end)})}function ee(e,t){const n=[0];if(t<=0)return n;let o=0;for(const a of e)if(a.breakBefore&&a.top>o&&(o=a.top,n.push(o)),!(a.top+a.height-o<=t))if(a.height<=t)a.top>o&&(o=a.top,n.push(o));else for(;a.top+a.height-o>t;)o+=t,n.push(o);return n}function te(e,t,n=1){const o=[],a=e=>{const a=e.getBoundingClientRect();o.push({top:(a.top-t)/n,height:a.height/n,breakBefore:e.hasAttribute("data-break-before")})};for(const r of Array.from(e.children))"TABLE"===r.tagName?r.querySelectorAll("tr").forEach(a):"UL"===r.tagName||"OL"===r.tagName?r.querySelectorAll("li").forEach(a):a(r),r.querySelectorAll("[data-page-break]").forEach(e=>{const a=e.getBoundingClientRect();o.push({top:(a.bottom-t)/n,height:0,breakBefore:!0})});return o}var ne=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","COLGROUP","COL","B","STRONG","I","EM","U","S","STRIKE","SUB","SUP","SPAN","FONT","A","BR","IMG","PRE","HR"]),oe=new Set(["SCRIPT","STYLE","TITLE","META","LINK","OBJECT","EMBED","IFRAME","NOSCRIPT","TEMPLATE","SVG","MATH","FORM","INPUT","BUTTON","SELECT","TEXTAREA","VIDEO","AUDIO","CANVAS"]),ae=new Set(["color","background-color","font-weight","font-style","text-decoration-line","text-decoration","font-family","font-size","text-align","margin-left","line-height","width","height","list-style-type"]),re=/^(https?:|mailto:|tel:|#)/i,se=/^(data:image\/(png|jpe?g|gif|webp|bmp);base64,|blob:)/i;function ce(e){const t=document.implementation.createHTMLDocument("");t.body.innerHTML=e;const n=(e,t,o)=>{for(const a of Array.from(e.childNodes)){if(3===a.nodeType){t.appendChild(o.createTextNode(a.nodeValue??""));continue}if(1!==a.nodeType)continue;const e=a,r=e.tagName.toUpperCase();if(oe.has(r))continue;if(!ne.has(r)){n(e,t,o);continue}if("IMG"===r&&!se.test(e.getAttribute("src")??""))continue;const s=o.createElement(r),c=(e.getAttribute("style")??"").split(";").map(e=>{const t=e.indexOf(":");if(t<0)return"";const n=e.slice(0,t).trim().toLowerCase(),o=e.slice(t+1).trim();return ae.has(n)&&!/url\(|expression|mso-/i.test(o)?`${n}:${o}`:""}).filter(Boolean).join(";");c&&s.setAttribute("style",c),"A"===r&&re.test(e.getAttribute("href")??"")&&s.setAttribute("href",e.getAttribute("href")),"IMG"===r&&s.setAttribute("src",e.getAttribute("src"));for(const t of["colspan","rowspan","start","color","face","size"]){const n=e.getAttribute(t);null!==n&&s.setAttribute(t,n)}n(e,s,o),t.appendChild(s)}},o=document.createElement("div");return n(t.body,o,document),o.innerHTML}import{escapeHtml as le}from"efficient-shell/ui";var ie="\nhtml,body{margin:0;background:#fff}\n.docs-page [data-comment]{background:none;border:0}\n.docs-page [data-locked]{background:none;box-shadow:none}\n.docs-page [data-page-break]{break-after:page;border:0;margin:0}\n.docs-page [data-break-before]{break-before:page}\n.docs-page tr,.docs-page img{break-inside:avoid}\n";function de(e,t){return`\n.docs-sheet{background:#fff;color:#777}\n.docs-sheet-line{border-color:#aaa}\n\n${`\n.docs-page{color:#000;background:#fff;white-space:pre-wrap;overflow-wrap:break-word;outline:none;line-height:1.08;tab-size:36pt;font-family:Calibri,Carlito,Arial,sans-serif;font-size:11pt}\n.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6{margin:0;font:inherit;font-weight:400}\n.docs-page ul,.docs-page ol{margin:0;padding-left:24pt}\n.docs-page ul{list-style-type:disc}.docs-page ol{list-style-type:decimal}\n.docs-page ul ul{list-style-type:circle}.docs-page ul ul ul{list-style-type:square}\n.docs-page a{color:#0563c1;text-decoration:underline}\n.docs-page sub,.docs-page sup{font-size:.66em}\n.docs-page img{max-width:100%}\n.docs-page table{border-collapse:collapse;table-layout:fixed;width:100%}\n.docs-page td,.docs-page th{border:.5pt solid #000;padding:0 5.4pt;vertical-align:top}\n.docs-page table[data-no-borders] td,.docs-page table[data-no-borders] th{border:.5pt dotted #bbb}\n.docs-page td p{margin-bottom:0}\n.docs-page blockquote{margin:0 0 8pt 24pt;font-style:italic}\n.docs-page hr{border:0;border-top:.75pt solid #000;margin:6pt 0}\n.docs-page [data-hidden]{display:none}\n.docs-page [data-page-break]{display:block;height:0;border-top:1pt dashed #999;margin:6pt 0;user-select:none}\n.docs-page [data-comment]{background:#fff2cc;border-bottom:1.5pt solid #e0b000}\n.docs-page [data-locked]{background:#f4f4f4;box-shadow:-5pt 0 0 #bbb;cursor:not-allowed}\n.docs-page ins{color:#c00000;text-decoration:underline}\n.docs-page del{color:#c00000;text-decoration:line-through}\n.docs-page [data-kind="object"]{display:inline-block;background:#f4f4f4;border:.75pt dashed #999;color:#555;padding:1pt 5pt;cursor:not-allowed;white-space:normal}\n.docs-page [data-kind="field"]{background:#ededed}\n.docs-page [data-kind="note"]{vertical-align:super;font-size:.66em}\n.docs-page ::highlight(docs-find){background:#ffe680}\n.docs-page ::highlight(docs-find-current){background:#ff9f1a}\n\n${e.css}`.replaceAll(".docs-page",`.docs-page[data-doc="${t}"]`)}`}var pe=e=>ie.replaceAll(".docs-page",`.docs-page[data-doc="${e}"]`);function fe(e,t,n){const o=e=>(e??"").replaceAll("{page}",String(t)).replaceAll("{pages}",String(n)),[a,r]=e.split(/\s*\|\s*/);return[o(a),o(r)]}function we(e,t){const[n,o]=function(e){return e.split(/\s*\|\s*/).map(e=>e.split(/(\{page\}|\{pages\})/).map(e=>"{page}"===e?"counter(page)":"{pages}"===e?"counter(pages)":e?`"${e.replace(/["\\\n\r]/g,"")}"`:"").filter(Boolean).join(" "))}(t),a="font:9pt Calibri,Carlito,Arial,sans-serif;color:#555";return`${n?`@${e}-left{content:${n};${a}}`:""}${o?`@${e}-right{content:${o};${a}}`:""}`}function me({title:e,html:t,doc:n,scope:o,page:a,header:r,footer:s}){const c=e=>Math.round(e)/20+"pt",l=`@page{size:${c(a.width)} ${c(a.height)};margin:${c(a.top)} ${c(a.right)} ${c(a.bottom)} ${c(a.left)};${we("top",r)}${we("bottom",s)}}`;return`<!doctype html><html><head><meta charset="utf-8"><meta name="generator" content="efficient-shell Documents"><title>${le(e)}</title><style>${de(n,o)}\n${pe(o)}\n${l}</style></head><body><div class="docs-page" data-doc="${o}">${t}</div></body></html>`}export{z as fingerprintOf,V as stampFingerprints,W as readDocx,K as readParts,X as documentText,J as countWords,Z as findInNodes,_ as replaceSpots,ee as pageStarts,te as pageBlocks,ce as sanitizeHtml,de as pageStyles,pe as printStyles,fe as marginText,me as pageDocument};
|
package/dist/chunk-YYHJJIA4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ENGLISH_WORDS as r}from"./chunk-2PIEDEY5.js";import{newSheet as e}from"./chunk-VKCG3LPQ.js";import{createContext as t,useContext as n}from"react";import{jsx as o}from"react/jsx-runtime";var a=t(r);function s({words:r,children:e}){return o(a.Provider,{value:r,children:e})}var c=()=>n(a);import{createContext as i,useContext as m}from"react";import{jsx as u}from"react/jsx-runtime";var l=class extends Error{},p=i({});function f({value:r,children:e}){return u(p.Provider,{value:r,children:e})}var h=()=>m(p);function v(r,t){const n=Array.isArray(r?.sheets)?r.sheets:[];return n.length?n.map(r=>({...e(r.name),...r,cells:(r.cells??[]).map(r=>(r??[]).map(r=>r??""))})):[e(t)]}export{s as SpreadsheetWordsProvider,c as useSpreadsheetWords,l as SpreadsheetsConflict,f as SpreadsheetsProvider,h as useSpreadsheetsHost,v as sheetsOf};
|
package/dist/docxPdf-NCSEKI4J.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{boxesInWindow as t,pageWindows as e}from"./chunk-PWF37Y2N.js";import{drawJpeg as o,embeddedFonts as n,jpegPdf as i,openStage as r,settled as a}from"./chunk-JKYJGXJE.js";import{marginText as s,pageBlocks as p,pageStarts as c,pageStyles as l,printStyles as h,readDocx as d}from"./chunk-XKOHIZO5.js";import{ENGLISH_WORDS as f}from"./chunk-AVUZSUQD.js";import"./chunk-RHW2M2UY.js";var g="pdf",u=t=>t/20*(4/3);function m(t){const e=t.getBoundingClientRect().top;return Array.from(t.children,t=>{const o=t.getBoundingClientRect();return{top:o.top-e,height:o.height}})}function x(t,e,o,n,i){const r=document.createElement("div");r.style.cssText=`position:absolute;display:flex;justify-content:space-between;font:9pt Calibri,Carlito,Arial,sans-serif;color:#555;white-space:pre;left:${u(e.left)}px;right:${u(e.right)}px;${i}`;for(const e of s(t,o,n))r.append(Object.assign(document.createElement("span"),{textContent:e}));return r}function w(e,o,n,i){const{page:r,header:a,footer:s}=e.doc,p=document.createElement("div");p.style.cssText=`position:relative;overflow:hidden;background:#fff;width:${u(r.width)}px;height:${u(r.height)}px`;const c=document.createElement("div");return c.style.cssText=`position:absolute;overflow:hidden;left:${u(r.left)}px;top:${u(r.top)}px;right:${u(r.right)}px;height:${o.height}px`,c.append(function({body:e,boxes:o},n){const i=e.cloneNode(!1),r=t(o,n);if(!r)return i;for(let t=r.first;t<=r.last;t+=1)i.append(e.children[t].cloneNode(!0));const a=parseFloat(getComputedStyle(e.children[r.first]).marginTop)||0;return i.style.position="absolute",i.style.left="0",i.style.top=o[r.first].top-a-n.top+"px",i}(e,o)),p.append(c),a.text&&p.append(x(a.text,r,n,i,`top:${u(r.header)}px`)),s.text&&p.append(x(s.text,r,n,i,`bottom:${u(r.footer)}px`)),p}async function y(t,e,n,i,r){e.append(t);try{await a(t);return{jpeg:await o(t,{width:u(n.width),height:u(n.height),pixelRatio:2,quality:r,fontCss:i}),width:n.width/20,height:n.height/20}}finally{t.remove()}}async function b(t,o={}){const{signal:s,onProgress:x,quality:b}=o;s?.throwIfAborted();const $=await d(new Uint8Array(await t.arrayBuffer())),C=r();try{const t=function(t,e){const o=document.createElement("style");o.textContent=`${l(t,g)}\n${h(g)}`;const n=document.createElement("div");return n.className="docs-page",n.dataset.doc=g,n.style.cssText=`display:flow-root;width:${u(t.page.width-t.page.left-t.page.right)}px`,n.innerHTML=t.html,e.append(o,n),n}($,C.root);await a(t);const o={doc:$,body:t,boxes:m(t)},r=function(t,o){const n=u(t.page.height-t.page.top-t.page.bottom),i=c(p(o,o.getBoundingClientRect().top),n);return e(i,n,o.getBoundingClientRect().height)}($,t),d=await n(t),v=[];for(const[t,e]of r.entries()){s?.throwIfAborted();const n=w(o,e,t+1,r.length);v.push(await y(n,C.root,$.page,d,b).catch(e=>{throw new Error(f.pdfPageFailed(t+1),{cause:e})})),x?.(t+1,r.length)}return i(v)}finally{C.close()}}export{b as docxToPdf};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** How any of the three apps makes a PDF. */
|
|
2
|
-
interface PdfOptions {
|
|
3
|
-
/** Called after each page. */
|
|
4
|
-
onProgress?: (done: number, total: number) => void;
|
|
5
|
-
signal?: AbortSignal;
|
|
6
|
-
/** JPEG quality of each page, 0..1. */
|
|
7
|
-
quality?: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type { PdfOptions as P };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{PptxPasswordError as t,PptxUnreadableError as e}from"./chunk-USKJW3BA.js";import{DECK_FONT as n,MIN_SIZE as r,NO_FILL as a,SLIDE_H as o,SLIDE_W as s,newId as i,newSlide as l}from"./chunk-2TZUCKZ7.js";import{ENGLISH_WORDS as c}from"./chunk-SB3YS3LH.js";import{child as p,childrenOf as f,descendants as u,openZip as d,parseXml as m,partText as h,readRels as y,readThemeFonts as g,resolveTarget as w}from"./chunk-RHW2M2UY.js";var x=2097152;function b(t){if(Array.isArray(t))return t.reduce((t,e)=>t+b(e)+2,t.length?0:2);if(t&&"object"==typeof t){const e=Object.entries(t).filter(([,t])=>void 0!==t);return e.reduce((t,[e,n])=>t+b(e)+2+b(n)+2,e.length?0:2)}const e=JSON.stringify(t)??"null";return e.length+5*(e.match(/[^\x20-\x7e]/g)?.length??0)}var v=[208,207,17,224],M=Array.from("EncryptedPackage").flatMap(t=>[t.charCodeAt(0),0]),k=4194304;function P(t){for(let e=t.indexOf(M[0]);e>=0;e=t.indexOf(M[0],e+1))if(M.every((n,r)=>t[e+r]===n))return!0;return!1}var S={black:"000000",white:"ffffff",red:"ff0000",green:"008000",blue:"0000ff",yellow:"ffff00",gray:"808080",grey:"808080"},C={bg1:"lt1",tx1:"dk1",bg2:"lt2",tx2:"dk2"};function N(t){const e=t.children[0];return e?.attrs.lastClr??e?.attrs.val}function B(t,e){const n=new Map,r=p(p(t,"a:themeElements"),"a:clrScheme")?.children??[];for(const t of r){const e=N(t);e&&n.set(t.name.replace(/^a:/,""),e)}return{scheme:n,map:{...C,...e?.attrs}}}function A(t,e){const n=p(p(e,"p:clrMapOvr"),"a:overrideClrMapping");return n?{...t,map:{...t.map,...n.attrs}}:t}var I=t=>[0,2,4].map(e=>parseInt(t.slice(e,e+2),16)),F=t=>t.map(t=>{return(e=t,Math.max(0,Math.min(255,Math.round(e)))).toString(16).padStart(2,"0");var e}).join("");function T(t,e,n){const[r,a,o]=function([t,e,n]){const[r,a,o]=[t/255,e/255,n/255],s=Math.max(r,a,o),i=Math.min(r,a,o),l=(s+i)/2;if(s===i)return[0,0,l];const c=s-i;return[(s===r?(a-o)/c+(a<o?6:0):s===a?(o-r)/c+2:(r-a)/c+4)/6,l>.5?c/(2-s-i):c/(s+i),l]}(I(t));return F(function([t,e,n]){if(0===e)return[255*n,255*n,255*n];const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r,o=t=>{const e=(t+1)%1;return e<1/6?a+6*(r-a)*e:e<.5?r:e<2/3?a+(r-a)*(2/3-e)*6:a};return[o(t+1/3),o(t),o(t-1/3)].map(t=>255*t)}([r,a,Math.max(0,Math.min(1,o*e+n))]))}function $(t,e){const n=Number(e.attrs.val)/1e5;if(!Number.isFinite(n))return t;switch(e.name){case"a:lumMod":return T(t,n,0);case"a:lumOff":return T(t,1,n);case"a:tint":return F(I(t).map(t=>t+(255-t)*(1-n)));case"a:shade":return F(I(t).map(t=>t*n));default:return t}}function j(t,e){const n=e.scheme.get(e.map[t]??t);return n?`#${n.toLowerCase()}`:void 0}function z(t,e){const n=t&&function(t,e){switch(t.name){case"a:srgbClr":return t.attrs.val;case"a:sysClr":return t.attrs.lastClr;case"a:prstClr":return S[t.attrs.val];case"a:schemeClr":return e.scheme.get(e.map[t.attrs.val]??t.attrs.val);default:return}}(t,e);if(t&&n&&/^[0-9a-f]{6}$/i.test(n)&&"0"!==p(t,"a:alpha")?.attrs.val)return`#${t.children.reduce($,n).toLowerCase()}`}function R(t,e){return z(p(t,"a:solidFill")?.children[0],e)}var O=t=>"1"===t||"true"===t,L=t=>Math.round(100*t)/100+0,H=(t,e)=>L(12700*t*e.scale),E=t=>t*Math.PI/180;function D(t){const e=p(t,"a:off")?.attrs,n=p(t,"a:ext")?.attrs;if(t&&e&&n)return{x:Number(e.x)||0,y:Number(e.y)||0,w:Number(n.cx)||0,h:Number(n.cy)||0,rotation:(Number(t.attrs.rot)||0)/6e4}}function V(t){const e=p(p(t,"p:grpSpPr"),"a:xfrm"),n=D(e),r=p(e,"a:chOff")?.attrs,a=p(e,"a:chExt")?.attrs;if(n&&r&&a)return{box:n,childX:Number(r.x)||0,childY:Number(r.y)||0,scaleX:Number(a.cx)?n.w/Number(a.cx):1,scaleY:Number(a.cy)?n.h/Number(a.cy):1,flipH:O(e?.attrs.flipH),flipV:O(e?.attrs.flipV)}}function W(t,e){const{box:n}=e,r=n.x+n.w/2,a=n.y+n.h/2;let o=n.x+(t.x-e.childX)*e.scaleX,s=n.y+(t.y-e.childY)*e.scaleY;e.flipH&&(o=2*r-o),e.flipV&&(s=2*a-s);const i=E(n.rotation),l=o-r,c=s-a;return{x:r+l*Math.cos(i)-c*Math.sin(i),y:a+l*Math.sin(i)+c*Math.cos(i)}}function Y(t,e){const n=W({x:t.x+t.w/2,y:t.y+t.h/2},e),r=t.w*e.scaleX,a=t.h*e.scaleY,o=e.flipH!==e.flipV;return{x:n.x-r/2,y:n.y-a/2,w:r,h:a,rotation:(o?-t.rotation:t.rotation)+e.box.rotation}}var U=t=>L((t%360+360)%360);function X(t,e,n){const r=e.reduce(Y,t);return{id:i(),x:L(n.left+r.x*n.scale),y:L(n.top+r.y*n.scale),w:L(r.w*n.scale),h:L(r.h*n.scale),rotation:U(r.rotation)}}function G(t,e,n,a){const o=t.x+t.w/2,s=t.y+t.h/2,l=E(t.rotation),c=r=>{const i=r*(e.flipH?-1:1)*t.w/2,c=r*(e.flipV?-1:1)*t.h/2,p={x:o+i*Math.cos(l)-c*Math.sin(l),y:s+i*Math.sin(l)+c*Math.cos(l)},f=n.reduce(W,p);return{x:a.left+f.x*a.scale,y:a.top+f.y*a.scale}},p=c(-1),f=c(1),u=Math.hypot(f.x-p.x,f.y-p.y);return{id:i(),x:L((p.x+f.x-u)/2),y:L((p.y+f.y-r)/2),w:L(u),h:r,rotation:U(180*Math.atan2(f.y-p.y,f.x-p.x)/Math.PI)}}var q={scheme:new Map,map:{}},J=(t,e)=>[...t.rels.values()].find(t=>t.type.endsWith(e)),K=t=>p(p(t,"p:cSld"),"p:spTree");function Z(t,e){const n=h(t,e);if(n)return{part:e,root:m(n),rels:new Map(y(t,e).map(t=>[t.id,t]))}}function Q(t,e,n){const r=Z(t,e);if(!r)return;const a=J(r,"/slideMaster"),o=a&&w(e,a.target);return o&&!n.has(o)&&n.set(o,function(t,e){const n=Z(t,e);if(!n)return;const r=J(n,"/theme"),a=r?h(t,w(e,r.target)):void 0;return{...n,palette:B(a?m(a):void 0,p(n.root,"p:clrMap")),fonts:g(a)}}(t,o)),{...r,master:o?n.get(o):void 0}}var _={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp"};var tt=t=>p(p(p(t,"p:nvSpPr"),"p:nvPr"),"p:ph")??p(p(p(t,"p:nvPicPr"),"p:nvPr"),"p:ph"),et=t=>!!tt(t),nt=t=>(K(t.root)?.children??[]).filter(t=>"p:sp"===t.name&&tt(t)),rt=new Set(["title","ctrTitle"]),at=new Set(["dt","ftr","sldNum"]);function ot(t){return t&&rt.has(t)?"title":t&&at.has(t)?t:"body"}function st(t,e){const n=tt(t);if(!n)return{shapes:[],style:"p:otherStyle",isPlaceholder:!1};const r=e.layout&&function(t,e){const n=nt(t),{idx:r,type:a}=e.attrs;return(void 0!==r?n.find(t=>tt(t)?.attrs.idx===r):void 0)??(void 0!==a?n.find(t=>tt(t)?.attrs.type===a):void 0)}(e.layout,n),a=r?tt(r)??n:n,o=e.master&&function(t,e){const n=ot(e.attrs.type);return nt(t).find(t=>ot(tt(t)?.attrs.type)===n)}(e.master,a),s=ot(a.attrs.type);return{shapes:[r,o].filter(t=>!!t),style:"title"===s?"p:titleStyle":"body"===s?"p:bodyStyle":"p:otherStyle",isPlaceholder:!0}}function it(t,e,n,r){const a=t=>p(p(t,"p:txBody"),"a:lstStyle"),o=p(p(n.master?.root,"p:txStyles"),e.style),s=e.isPlaceholder?[o,r]:[r,o];return[a(t),...e.shapes.map(a),...s]}function lt(t,e,n){for(const r of[t,...e.shapes]){const t=p(p(r,"p:txBody"),"a:bodyPr")?.attrs[n];if(void 0!==t)return t}}var ct={l:"left",ctr:"center",r:"right"},pt=(t,e)=>t.lists.flatMap(t=>{const n=p(t,`a:lvl${e+1}pPr`);return n?[n]:[]});function ft(t,e){return"+mj-lt"===t?e.fonts.major:"+mn-lt"===t?e.fonts.minor:t}function ut(t,e,n,r){const a=[t,p(e,"a:defRPr"),...n.map(t=>p(t,"a:defRPr"))].filter(t=>!!t),o=t=>a.find(e=>void 0!==e.attrs[t])?.attrs[t],s=Number(o("sz")),i=o("b"),l=a.map(t=>R(t,r.palette)),c=a.map(t=>p(t,"a:latin")?.attrs.typeface).find(Boolean);return{sizePt:Number.isFinite(s)&&s>0?s/100:18,bold:"1"===i||"true"===i,colour:l.find(Boolean)??r.styleColour??j("tx1",r.palette)??"#000000",typeface:ft(c,r)??(r.isTitle?r.fonts.major:r.fonts.minor)}}function dt(t,e){for(const n of[t,...e]){if(p(n,"a:buNone"))return{kind:"none"};if(p(n,"a:buChar")||p(n,"a:buBlip"))return{kind:"bullet"};const t=p(n,"a:buAutoNum");if(t)return{kind:"number",startAt:Number(t.attrs.startAt)||1}}return{kind:"none"}}function mt(t,e){const n=[t,...e].map(t=>t?.attrs.algn).find(Boolean);return n&&ct[n]||"left"}function ht(t,e,n){const r=p(t,"a:pPr"),a=[];let o="";for(const s of t.children){if("a:br"===s.name&&(o+="\n"),"a:r"!==s.name&&"a:fld"!==s.name)continue;const t=p(s,"a:t")?.text??"";o+=t,t.trim()&&a.push({text:t,style:ut(p(s,"a:rPr"),r,e,n)})}return{text:o,runs:a}}var yt=(t,e)=>t.sizePt===e.sizePt&&t.bold===e.bold&&t.colour===e.colour;function gt(t,e){const n=[],r=[],a=function(){const t=[];return(e,n)=>"bullet"===e.kind?"• ":"none"===e.kind?(t.length=Math.min(t.length,n),""):(t.length=Math.min(t.length,n+1),t[n]=(t[n]??e.startAt-1)+1,`${t[n]}. `)}();let o;for(const s of f(t,"a:p")){const t=p(s,"a:pPr"),i=Number(t?.attrs.lvl)||0,l=pt(e,i),c=ht(s,l,e),f=dt(t,l),u=c.text.trim()?a(f,i):"";n.push(u?`${" ".repeat(i)}${u}${c.text}`:c.text),c.runs.length&&!o&&(o=mt(t,l)),r.push(...c.runs)}if(!r[0])return null;const s=function(t){const e=[];for(const n of t){const t=e.find(t=>yt(t.style,n.style));t?t.length+=n.text.length:e.push({style:n.style,length:n.text.length})}return e.reduce((t,e)=>e.length>t.length?e:t).style}(r),i=Number(p(p(t,"a:bodyPr"),"a:normAutofit")?.attrs.fontScale);return{text:n.join("\n").trimEnd(),sizePt:s.sizePt*(i>0?i/1e5:1),bold:s.bold,colour:s.colour,align:o??"left",mixed:r.some(t=>!yt(t.style,s)),typefaces:new Set(r.flatMap(t=>t.style.typeface?[t.style.typeface]:[]))}}function wt(t,e){const n=t.map(t=>t.map(e));return n.some(t=>t.some(Boolean))?n:void 0}var xt=t=>t.reduce((t,e)=>t+e,0);function bt(t,e,n,r){const o=D(p(t,"p:xfrm")),s=f(e,"a:tr");if(!o||!s.length)return void(n.tally.skipped+=1);const i=f(p(e,"a:tblGrid"),"a:gridCol").map(t=>Number(t.attrs.w)||0),l=s.map(t=>Number(t.attrs.h)||0),c=s.map(t=>f(t,"a:tc").map(t=>function(t,e){const n=p(t,"a:txBody"),r=gt(n,{palette:e.palette,fonts:e.master?.fonts??{},lists:[p(n,"a:lstStyle"),e.presentation.defaultTextStyle],isTitle:!1});for(const t of r?.typefaces??[])e.tally.typefaces.add(t);return{text:r?.text.replace(/\s*\n\s*/g," ")??"",block:r,fill:R(p(t,"a:tcPr"),e.palette)??null}}(t,n))),u=X({...o,w:xt(i)||o.w,h:xt(l)||o.h},r,n.frame),d=function(t){const e=new Map;for(const{block:n}of t)n&&e.set(n.sizePt,(e.get(n.sizePt)??0)+1);return[...e].sort((t,e)=>e[1]-t[1])[0]?.[0]}(c.flat()),m={...u,type:"table",rows:c.map(t=>t.map(t=>t.text)),headerFill:c[0].map(t=>t.fill).find(Boolean)??a,headerColor:c[0].map(t=>t.block?.colour).find(Boolean),fontSize:void 0===d?void 0:H(d,n.frame),columnWidths:xt(i)?i.map(t=>{return e=t,n=xt(i),Math.round(e/n*1e4)/1e4;var e,n}):void 0,rowHeights:xt(l)?l.map(t=>Math.round(t/xt(l)*u.h*100)/100):void 0,cellFills:wt(c,t=>t.fill),cellColors:wt(c,t=>t.block?.colour??null)};n.elements.push(m)}var vt={rect:"rect",ellipse:"ellipse",roundRect:"roundRect",diamond:"diamond",line:"line",straightConnector1:"line",flowChartProcess:"rect",flowChartAlternateProcess:"roundRect",flowChartDecision:"diamond",flowChartConnector:"ellipse"},Mt=new Set(["a:videoFile","a:audioFile","a:quickTimeFile","p14:media"]);function kt(t,e,n,r){const a=gt(p(t,"p:txBody"),function(t,e,n){const r=p(p(t,"p:style"),"a:fontRef")?.children[0];return{palette:n.palette,fonts:n.master?.fonts??{},lists:it(t,e,n,n.presentation.defaultTextStyle),isTitle:"p:titleStyle"===e.style,styleColour:z(r,n.palette)}}(t,n,r));if(!a)return;const{scale:o}=r.frame,s=(e,r)=>(Number(lt(t,n,e)??r)||0)*o,l=H(a.sizePt,r.frame),c=s("lIns",91440),f=s("tIns",45720),u=Math.max(e.w-c-s("rIns",91440),1),d=Math.max(e.h-f-s("bIns",45720),1),m=lt(t,n,"anchor"),h=Math.max(d-function(t,e,n){const r=Math.max(1,Math.floor(n/(.52*e)));return t.split("\n").reduce((t,e)=>t+Math.max(1,Math.ceil(e.length/r)),0)*e*1.25}(a.text,l,u),0),y="ctr"===m?h/2:"b"===m?h:0;r.elements.push({id:i(),type:"text",rotation:e.rotation,x:L(e.x+c),y:L(e.y+f+y),w:L(u),h:L(d-y),text:a.text,fontSize:l,bold:a.bold,color:a.colour,align:a.align});for(const t of a.typefaces)r.tally.typefaces.add(t);a.mixed&&(r.tally.mixedTextSimplified+=1)}function Pt(t,e){const n=p(t,"p:spPr");if(p(n,"a:noFill"))return{kind:"none"};if(p(n,"a:solidFill")){const t=R(n,e.palette);return t?{kind:"colour",colour:t}:{kind:"none"}}if(["a:gradFill","a:blipFill","a:pattFill","a:grpFill"].some(t=>p(n,t))){const t=function(t,e){const n=p(p(p(t,"a:gradFill"),"a:gsLst"),"a:gs")?.children[0],r=p(p(t,"a:pattFill"),"a:fgClr")?.children[0];return z(n??r,e.palette)}(n,e);return t?{kind:"colour",colour:t}:{kind:"undrawable"}}const r=p(p(t,"p:style"),"a:fillRef"),a=r&&"0"!==r.attrs.idx?z(r.children[0],e.palette):void 0;return a?{kind:"colour",colour:a}:{kind:"none"}}function St(t,e){const n=p(p(t,"p:spPr"),"a:ln");if(p(n,"a:noFill"))return;const r=p(p(t,"p:style"),"a:lnRef"),a=R(n,e.palette)??(r&&"0"!==r.attrs.idx?z(r.children[0],e.palette):void 0);return a?{stroke:a,strokeWidth:L((Number(n?.attrs.w)||9525)*e.frame.scale)}:void 0}function Ct(t,e){const n=p(p(p(t,"a:prstGeom"),"a:avLst"),"a:gd")?.attrs.fmla,r=Number(n?.replace("val ",""));return L((Number.isFinite(r)?r:16667)/1e5*Math.min(e.w,e.h))}var Nt=t=>!!t?.attrs.type&&"none"!==t.attrs.type;function Bt(t,e,n){const r=p(t,"p:spPr"),o=p(r,"a:xfrm"),s=D(o);if(!s)return void(e.tally.skipped+=1);const i=St(t,e);if(!i)return;const l=p(r,"a:ln");e.elements.push({...G(s,{flipH:O(o?.attrs.flipH),flipV:O(o?.attrs.flipV)},n,e.frame),type:"shape",shape:"line",fill:a,...i,...Nt(p(l,"a:tailEnd"))?{arrowEnd:!0}:{},...Nt(p(l,"a:headEnd"))?{arrowStart:!0}:{}})}function At(t,e,n){const r=st(t,e),o=p(t,"p:spPr"),s=function(t){return vt[p(t,"a:prstGeom")?.attrs.prst??"rect"]??"rect"}(o);if("line"===s)return void Bt(t,e,n);const i=D(p(o,"a:xfrm"))??r.shapes.map(t=>D(p(p(t,"p:spPr"),"a:xfrm"))).find(Boolean);if(!i)return void(p(t,"p:txBody")&&u(t,new Set(["a:t"])).length&&(e.tally.skipped+=1));const l=X(i,n,e.frame),c=Pt(t,e),f=St(t,e),d="colour"===c.kind||!!f;d&&function(t,e,n,r,o,s){s.elements.push({...t,type:"shape",shape:e,fill:"colour"===n.kind?n.colour:a,...r,..."roundRect"===e?{radius:Ct(o,t)}:{}})}(l,s,c,f,o,e),kt(t,l,r,e),"undrawable"!==c.kind||d||(e.tally.skipped+=1)}function It(t,e){const n=e.rels.get(t?.attrs["r:embed"]??"");return n&&!n.external?w(e.part,n.target):void 0}function Ft(t,e,n){const r=p(t,"p:nvPicPr"),a=st(t,e),o=D(p(p(t,"p:spPr"),"a:xfrm"))??a.shapes.map(t=>D(p(p(t,"p:spPr"),"a:xfrm"))).find(Boolean),s=p(t,"p:blipFill"),i=It(p(s,"a:blip"),e.slide),l=i&&!u(t,Mt).length?e.useImage(i,function(t){const e=e=>(Number(t?.attrs[e])||0)/1e5,n={left:e("l"),top:e("t"),right:e("r"),bottom:e("b")},r=Object.values(n);if(!r.every(t=>0===t)&&!r.some(t=>t<0))return n.left+n.right<1&&n.top+n.bottom<1?n:void 0}(p(s,"a:srcRect"))):void 0;o&&l?e.elements.push({...X(o,n,e.frame),type:"image",src:l,alt:p(r,"p:cNvPr")?.attrs.descr??""}):e.tally.skipped+=1}function Tt(t,e,n){const r=p(p(p(t,"a:graphic"),"a:graphicData"),"a:tbl");r?bt(t,r,e,n):e.tally.skipped+=1}function $t(t,e,n=[]){for(const r of t)switch(r.name){case"p:sp":At(r,e,n);break;case"p:pic":Ft(r,e,n);break;case"p:graphicFrame":Tt(r,e,n);break;case"p:cxnSp":Bt(r,e,n);break;case"p:contentPart":e.tally.skipped+=1;break;case"p:grpSp":{const t=V(r);$t(r.children,e,t?[t,...n]:n);break}case"mc:AlternateContent":$t(p(r,"mc:Fallback")?.children??[],e,n)}}function jt(t){const e=function(t){const e=h(t,"[Content_Types].xml"),n=e?m(e):void 0,r=new Map(f(n,"Override").map(t=>[t.attrs.PartName,t.attrs.ContentType])),a=new Map(f(n,"Default").map(t=>[t.attrs.Extension?.toLowerCase(),t.attrs.ContentType]));return t=>{const e=t.slice(t.lastIndexOf(".")+1).toLowerCase();return r.get(`/${t}`)??a.get(e)??_[e]??"application/octet-stream"}}(t),n=new Map;return{use:(t,r)=>{const a=e(t);if(!a.startsWith("image/"))return;const o=`${t}${function(t){return t?`#${t.left},${t.top},${t.right},${t.bottom}`:""}(r)}`;return n.has(o)||n.set(o,{key:o,part:t,contentType:a,crop:r}),o},uses:n}}function zt(t){return t.children.map(t=>"a:br"===t.name?"\n":"a:r"===t.name||"a:fld"===t.name?p(t,"a:t")?.text??"":"").join("")}function Rt(t,e){const n=J(e,"/notesSlide"),r=n&&Z(t,w(e.part,n.target)),a=((r&&K(r.root)?.children)??[]).find(t=>"body"===p(p(p(t,"p:nvSpPr"),"p:nvPr"),"p:ph")?.attrs.type);return f(p(a,"p:txBody"),"a:p").map(zt).join("\n").trim()}function Ot(t,e){const n=p(p(t.root,"p:cSld"),"p:bg");if(!n)return;const r=p(n,"p:bgPr"),a=R(r,e.palette)??z(p(n,"p:bgRef")?.children[0],e.palette);if(a)return{colour:a};const o=It(p(p(r,"a:blipFill"),"a:blip"),t);return o?{picture:o}:void 0}var Lt=t=>"0"===t.root.attrs.showMasterSp||"false"===t.root.attrs.showMasterSp;function Ht(t,e){const n=function(t){for(const e of[t.slide,t.layout,t.master]){const n=e&&Ot(e,t);if(n)return n}return{}}(t);return n.picture&&function(t,e){const n=e.useImage(t,void 0);if(!n)return void(e.tally.skipped+=1);const{left:r,top:a,width:o,height:s}=e.frame;e.elements.push({id:i(),type:"image",x:r,y:a,w:o,h:s,rotation:0,src:n,alt:""})}(n.picture,t),function(t){const{layout:e,master:n,slide:r}=t;if(!Lt(r))for(const r of[e&&Lt(e)?void 0:n,e]){const e=r?K(r.root)?.children??[]:[];r&&$t(e.filter(t=>!et(t)),{...t,slide:r})}}(t),$t(K(t.slide.root)?.children??[],t),{id:i(),background:n.colour??"#ffffff",notes:Rt(e,t.slide),elements:(r=t.elements,a=t.tally,a.skipped+=Math.max(r.length-200,0),r.slice(0,200))};var r,a}var Et=t=>"0"===t.root.attrs.show||"false"===t.root.attrs.show;function Dt(t){const n=function(t){const n=y(t,"").find(t=>t.type.endsWith("/officeDocument")),r=Z(t,n?w("",n.target):"ppt/presentation.xml");if(!r||"p:presentation"!==r.root.name)throw new e;const a=f(p(r.root,"p:sldIdLst"),"p:sldId").flatMap(t=>{const e=r.rels.get(t.attrs["r:id"]);return e?[w(r.part,e.target)]:[]}),o=p(r.root,"p:sldSz")?.attrs;return{width:Number(o?.cx)||9144e3,height:Number(o?.cy)||5143500,slides:a,defaultTextStyle:p(r.root,"p:defaultTextStyle")}}(t),r=function(t){const e=new Map,n=new Map;return r=>{const a=J(r,"/slideLayout"),o=a&&w(r.part,a.target);o&&!n.has(o)&&n.set(o,Q(t,o,e));const s=o?n.get(o):void 0,i=s?.master,l=i?.palette??q;return{slide:r,layout:s,master:i,palette:A(s?A(l,s.root):l,r.root)}}}(t),a=jt(t),i=function(t,e){const n=Math.min(s/t,o/e);return{scale:n,left:(s-t*n)/2,top:(o-e*n)/2,width:t*n,height:e*n}}(n.width,n.height),c={skipped:0,mixedTextSimplified:0,typefaces:new Set},u=[];let d=0;for(const e of n.slides){const o=Z(t,e);o&&!Et(o)&&(p(o.root,"p:timing")&&(d+=1),u.push(Ht({...r(o),presentation:n,frame:i,tally:c,elements:[],useImage:a.use},t)))}const m=new Set(u.flatMap(t=>t.elements.flatMap(t=>"image"===t.type?[t.src]:[])));return{document:{slides:u.length?u:[l()]},slideCount:u.length,images:[...a.uses.values()].filter(t=>m.has(t.key)),animationsDropped:d,tally:c}}var Vt=.15,Wt=1048576,Yt=/\.(xml|rels)$/i;async function Ut(n,r){if(await async function(t){const e=new Uint8Array(await t.slice(0,v.length).arrayBuffer());return v.every((t,n)=>e[n]===t)}(n))throw await async function(t,e){for(let n=0;n<t.size;n+=k-M.length)if(e?.throwIfAborted(),P(new Uint8Array(await t.slice(n,n+k).arrayBuffer())))return!0;return!1}(n,r)?new t:new e(c.pptxLegacyFormat)}function Xt(t){if(t.slides.length>300)throw new e(c.pptxTooManySlides(t.slides.length,300));const n=b(t);if(n>x)throw new e(c.pptxTooLarge((n/Wt).toFixed(1),2))}var Gt={"image/webp":"webp","image/png":"png","image/jpeg":"jpg","image/gif":"gif"};async function qt(t,e,n){try{return await(n.prepareImage?n.prepareImage(e,t.contentType):async function(t,e,n){const r=await createImageBitmap(new Blob([t],{type:e}));try{const t=r.width*(n?.left??0),e=r.height*(n?.top??0),a=r.width-t-r.width*(n?.right??0),o=r.height-e-r.height*(n?.bottom??0),s=Math.min(1,1920/Math.max(a,o)),i=new OffscreenCanvas(Math.max(1,Math.round(a*s)),Math.max(1,Math.round(o*s))),l=i.getContext("2d");if(!l)throw new Error("No drawing context");return l.imageSmoothingQuality="high",l.drawImage(r,t,e,a,o,0,0,i.width,i.height),await i.convertToBlob({type:"image/webp",quality:.85})}finally{r.close()}}(e,t.contentType,t.crop))}catch(e){return n.signal?.throwIfAborted(),console.warn("A picture in the deck could not be read",t.part,e),null}}async function Jt(t,e,n){const r={addresses:new Map,count:0,bytesBefore:0,bytesAfter:0},a=function(t,e){const n=new Map;for(const r of t){const t=e.prepareImage?r.part:r.key;n.set(t,[...n.get(t)??[],r])}return[...n.values()]}(t,n),o=new Map;let s=0;return await async function(t,e,n){let r=0,a=!1;await Promise.all(Array.from({length:Math.min(e,t.length)},async()=>{for(;!a&&r<t.length;){const e=t[r];r+=1;try{await n(e)}catch(t){throw a=!0,t}}}))}(a,4,async t=>{n.signal?.throwIfAborted();const[i]=t,l=o.get(i.part)??0;o.set(i.part,l+1);const c=await e.read(i.part).catch(()=>null),p=c&&await qt(i,c,n);if(c&&p){n.signal?.throwIfAborted();const e=await n.storeImage(p,function(t,e,n){return`${t.slice(t.lastIndexOf("/")+1).replace(/\.[^.]*$/,"")}${n?`-${n}`:""}.${Gt[e.type]??"img"}`}(i.part,p,l));for(const{key:n}of t)r.addresses.set(n,e);r.count+=1,r.bytesBefore+=c.length,r.bytesAfter+=p.size}s+=1,n.onProgress?.(Vt+.85*s/a.length)}),r}async function Kt(t,r){r.signal?.throwIfAborted(),await Ut(t,r.signal);const a=await async function(t){try{return await d(t)}catch{throw new e}}(t),o=await async function(t,e){const n=new Map,r=t.names.filter(t=>Yt.test(t));for(const[a,o]of r.entries())e.signal?.throwIfAborted(),n.set(o,await t.read(o)),e.onProgress?.(Vt*(a+1)/r.length);return n}(a,r).catch(t=>{throw r.signal?.throwIfAborted(),t instanceof e?t:new e}),s=function(t){try{return Dt(t)}catch(t){if(t instanceof e)throw t;throw new e}}(o);Xt(s.document);const i=await Jt(s.images,a,r),l=function(t,e,n){const r=t=>{if("image"!==t.type)return[t];const r=e.get(t.src);return void 0===r&&(n.skipped+=1),void 0===r?[]:[{...t,src:r}]};return{slides:t.slides.map(t=>({...t,elements:t.elements.flatMap(r)}))}}(s.document,i.addresses,s.tally);return Xt(l),r.onProgress?.(1),{document:l,notes:{slides:s.slideCount,images:i.count,imageBytesBefore:i.bytesBefore,imageBytesAfter:i.bytesAfter,fontsReplaced:[...s.tally.typefaces].filter(t=>t!==n).sort(),animationsDropped:s.animationsDropped,mixedTextSimplified:s.tally.mixedTextSimplified,skipped:s.tally.skipped}}}export{Kt as importPptx};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{rowPageStarts as t}from"./chunk-PWF37Y2N.js";import{ENGLISH_WORDS as e}from"./chunk-2PIEDEY5.js";import{DEFAULT_COL_WIDTH as o,cellDisplay as n,filteredRows as r,formatKey as s,makeEvaluator as a,usedBounds as i}from"./chunk-VKCG3LPQ.js";import{drawJpeg as l,embeddedFonts as c,jpegPdf as d,openStage as p,settled as h}from"./chunk-JKYJGXJE.js";var m=t=>t*(4/3),f=m(842),u=m(595),w=f-2*m(36),g=u-2*m(36),y="Calibri,Carlito,Arial,sans-serif",b=t=>Array.from({length:t},(t,e)=>e);function x(t,e,a){const l=i(t);if(!l)return{name:t.name,widths:[],rows:[],headerRows:0};const c=new Set([...t.hiddenRows,...r(t,e,a)]),d=new Set(t.hiddenCols),p=b(l.col+1).filter(t=>!d.has(t)),h=b(l.row+1).filter(t=>!c.has(t)).map(o=>p.map(r=>{const{text:i,align:l,color:c}=n(t,e,a,o,r),d=t.formats[s(o,r)];return{text:i,align:d?.align??l,color:d?.color??c,format:d}}));return{name:t.name,widths:p.map(e=>t.colWidths[e]??o),rows:h,headerRows:Math.min(Math.max(t.frozenRows,1),h.length)}}function E(t){const e=document.createElement("td");e.textContent=t.text;const{format:o}=t;return e.style.cssText=`border:.5pt solid #bbb;padding:1pt 3pt;vertical-align:top;overflow-wrap:anywhere;white-space:pre-wrap;text-align:${t.align}`,t.color&&(e.style.color=t.color),o?.fill&&(e.style.background=o.fill),o?.bold&&(e.style.fontWeight="700"),o?.italic&&(e.style.fontStyle="italic"),o?.fontSize&&(e.style.fontSize=`${o.fontSize}pt`),e}function R(t){const e=document.createElement("tr");return e.append(...t.map(E)),e}function v(t,e){const o=document.createElement("table"),n=t.widths.reduce((t,e)=>t+e,0);o.style.cssText=`border-collapse:collapse;table-layout:fixed;width:${n}px;font:10pt ${y};color:#000`;const r=document.createElement("colgroup");r.append(...t.widths.map(t=>Object.assign(document.createElement("col"),{style:`width:${t}px`})));const s=document.createElement("tbody");return s.append(...e.map(R)),o.append(r,s),o}function $(t){const e=document.createElement("div");return e.textContent=t,e.style.cssText=`font:600 13pt ${y};color:#000;margin-bottom:6pt`,e}function C({table:t,scale:e,starts:o},n){const r=document.createElement("div");if(r.style.cssText=`position:relative;overflow:hidden;background:#fff;width:${f}px;height:${u}px;padding:${m(36)}px;box-sizing:border-box`,r.append($(t.name)),t.rows.length){const s=o[n+1]??t.rows.length,a=v(t,[...t.rows.slice(0,t.headerRows),...t.rows.slice(o[n],s)]);a.style.transform=`scale(${e})`,a.style.transformOrigin="0 0",r.append(a)}return r}async function k(t,e,o,n){e.append(t);try{await h(t);return{jpeg:await l(t,{width:f,height:u,pixelRatio:2,quality:n,fontCss:o}),width:842,height:595}}finally{t.remove()}}async function S(o,n={}){const{signal:r,onProgress:s,quality:i}=n;r?.throwIfAborted();const l=p();try{const n=a(o),p=o.map((e,o)=>function(e,o){const n=e.widths.reduce((t,e)=>t+e,0),r=n>w?w/n:1,s=$(e.name),a=v(e,e.rows);o.append(s,a);const i=s.getBoundingClientRect().height+m(6),l=Array.from(a.querySelectorAll("tr"),t=>t.getBoundingClientRect().height);s.remove(),a.remove();const c=l.slice(0,e.headerRows).reduce((t,e)=>t+e,0),d=(g-i)/r,p=t(l.slice(e.headerRows),d,c).map(t=>t+e.headerRows);return{table:e,scale:r,starts:p}}(x(e,o,n),l.root)),h=p.reduce((t,e)=>t+e.starts.length,0),f=await c(l.root),u=[];for(const t of p)for(const o of t.starts.keys())r?.throwIfAborted(),u.push(await k(C(t,o),l.root,f,i).catch(t=>{throw new Error(e.pdfPageFailed(u.length+1),{cause:t})})),s?.(u.length,h);return d(u)}finally{l.close()}}export{x as sheetTable,S as workbookToPdf};
|