@silurus/ooxml 0.89.7 → 0.89.9
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/README.md +9 -3
- package/dist/assets/render-worker-CSJJ7vFD.js +15 -0
- package/dist/assets/render-worker-Ck21oePL.js +16 -0
- package/dist/assets/render-worker-jGsxSIGb.js +35 -0
- package/dist/{bounded-raw-part-cache-B8t03tSP.js → bounded-raw-part-cache-B5a6cGKO.js} +1713 -1515
- package/dist/{canvas-viewer-mechanics-DI38gHNV.js → canvas-viewer-mechanics-BsqaoYgK.js} +2 -2
- package/dist/{cfb-guard-BIaHdonq.js → cfb-guard-DzYlucez.js} +1 -1
- package/dist/chart-ex.mjs +367 -367
- package/dist/{comment-overlay-controller-Crm5Syhx.js → comment-overlay-controller-b3tKmzMa.js} +29 -25
- package/dist/{comment-ui-runtime-DKlEfBPp.js → comment-ui-runtime-BlgDzQx_.js} +3 -3
- package/dist/{comment-ui-runtime-BfEPgl5r.js → comment-ui-runtime-Bp37ytDC.js} +3 -3
- package/dist/{document-model-source-xnkMoTZ_.js → document-model-source-BlMfm6po.js} +37 -37
- package/dist/{document-pull-client-CzhPbnY_.js → document-pull-client-_G-DIh2T.js} +17071 -13819
- package/dist/{document-pull-worker-Bkewz-So.js → document-pull-worker-hMKJ5RdB.js} +14 -14
- package/dist/{docx-BWyACb-n.js → docx-DE-Di6SH.js} +33 -33
- package/dist/{docx-BgCQiuuN.js → docx-Do90Z4L7.js} +593 -593
- package/dist/{docx-model-source-DCRFgO7-.js → docx-model-source-zYIufUjR.js} +6 -6
- package/dist/docx.mjs +4 -4
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{drawingml-shape-BcXkRayC.js → drawingml-shape-B1_kg4BV.js} +55 -55
- package/dist/{duotone-BI7CoghW.js → duotone-GK4Hqn7f.js} +1 -1
- package/dist/{emf-DgUBx9BU.js → emf--QWY-UlT.js} +50 -50
- package/dist/{font-preload-demand-B6HPFxDp.js → font-preload-demand-NqcVKIpX.js} +2 -2
- package/dist/{grid-geometry-CqTDvpDr.js → grid-geometry-DpMAiSZb.js} +1 -1
- package/dist/{host-layout-measure-CXKOWA5J.js → host-layout-measure-IFLllYwV.js} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal-companion.mjs +2 -2
- package/dist/{line-distribute-DR9Qwd3u.js → line-distribute-CwtditQo.js} +31 -25
- package/dist/{model-source-DcI3vC00.js → model-source-Cch44xsb.js} +2 -2
- package/dist/{model-source-session-BlQWNyj2.js → model-source-session-ClNCRDOg.js} +21 -21
- package/dist/{model-source-session-D0LF49Ve.js → model-source-session-DRcqFGfM.js} +2 -2
- package/dist/{model-source-session-BCteVilS.js → model-source-session-DSABX94B.js} +2 -2
- package/dist/node.mjs +5 -5
- package/dist/{plot-area-frame-D3JtHvov.js → plot-area-frame-DNYMd9Pf.js} +1914 -1890
- package/dist/{pptx-SmjDGyub.js → pptx-C1CiFW1D.js} +35 -33
- package/dist/{pptx-CfCiVlNB.js → pptx-DbjWegUB.js} +283 -266
- package/dist/{pptx-model-source-B2Irk68a.js → pptx-model-source-C9TuBisH.js} +18 -12
- package/dist/pptx-parsed-slides-BMGr4khe.js +8 -0
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{presentation-model-source-DL6duh5l.js → presentation-model-source-DLNioq7T.js} +6 -6
- package/dist/region-map.mjs +39 -39
- package/dist/{render-CMUEAeHp.js → render-Bf_Gywxw.js} +32 -30
- package/dist/{render-worker-host-CZHIKTtZ.js → render-worker-host-CVr53kg0.js} +1 -1
- package/dist/{render-worker-host-CtlBbau5.js → render-worker-host-EgUrirnQ.js} +1 -1
- package/dist/{render-worker-host-G1fnymI8.js → render-worker-host-pKls3F_t.js} +1 -1
- package/dist/renderer-DpTePxGq.js +5887 -0
- package/dist/{renderer-B4KIpz-2.js → renderer-DuYC3xXi.js} +1336 -1224
- package/dist/{resource-measurement-D2bu0Qfx.js → resource-measurement-CfJtbwiR.js} +129 -129
- package/dist/{session-KIWcCCP2.js → session-DPXK_lpI.js} +64 -64
- package/dist/{slide-pull-client-BUuJQQVE.js → slide-pull-client-3g6TxaKa.js} +1421 -1421
- package/dist/{three-d-ByHGsYrX.js → three-d-BfMZVR0w.js} +98 -98
- package/dist/three-d.mjs +678 -678
- package/dist/types/chart-ex.d.ts +5 -2
- package/dist/types/docx.d.ts +30 -8
- package/dist/types/index.d.ts +37 -12
- package/dist/types/node.d.ts +28 -6
- package/dist/types/pptx.d.ts +13 -7
- package/dist/types/region-map.d.ts +5 -2
- package/dist/types/three-d.d.ts +5 -2
- package/dist/types/xlsx.d.ts +10 -7
- package/dist/{wasm-runtime-generation-BLweKv8r.js → wasm-runtime-generation-D97yoAXz.js} +17 -17
- package/dist/{workbook-model-source-J9ir5Kov.js → workbook-model-source-D1dmkDMP.js} +6 -6
- package/dist/{worksheet-pull-client-Du0MuIro.js → worksheet-pull-client-BudfclVl.js} +84 -84
- package/dist/{xlsx-BbQ7RcNc.js → xlsx-DA0uR1B1.js} +44 -44
- package/dist/{xlsx-ClQiNSrr.js → xlsx-DBhYlJKp.js} +728 -716
- package/dist/{xlsx-model-source-C-Riw89p.js → xlsx-model-source-zemVDAfl.js} +36 -36
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/assets/render-worker-B3hF7Akg.js +0 -35
- package/dist/assets/render-worker-B5HWxkbU.js +0 -16
- package/dist/assets/render-worker-DNGf06QT.js +0 -15
- package/dist/renderer-xdugdcMd.js +0 -5769
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { t as e } from "./chunk-D5OxutzX.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as v, t as y } from "./cfb-guard-
|
|
4
|
-
import {
|
|
5
|
-
import { f as
|
|
6
|
-
import { L as
|
|
7
|
-
import { i as
|
|
8
|
-
import { C as
|
|
9
|
-
import { A as
|
|
10
|
-
import { n as
|
|
11
|
-
import { _ as
|
|
12
|
-
import { n as
|
|
13
|
-
import { a as
|
|
14
|
-
var qt = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,ee,te=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,ee=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function ne(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var re=e((()=>{}));function f(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function ie(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return f(t.requiredBytes)&&f(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var p=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function ae(e){if(e instanceof p)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!ie(r)))return new p(r)}i(),te(),re();const m=`OOXML_RESOURCE_LIMIT:`;function h(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function oe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return h(t.archiveEntryCount)&&h(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||h(t.largestInflatedEntryBytes))&&h(t.distinctInflatedBytes)&&h(t.operationInflatedBytes)}function g(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!oe(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function se(e){return e===`docx`||e===`xlsx`||e===`pptx`}function ce(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function _(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function v(e){return _(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function le(e){return!_(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const y=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ue=new Set([...y.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),de=new Set([...y.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function fe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!se(t.format)||!_(t.operation,256)||!v(t.resource)||!v(t.metric)||!h(t.limit)||!h(t.observed)||typeof t.configurable!=`boolean`||!oe(t.usage)?!1:!(`part`in t)||le(t.part)}function b(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!ce(t.stage)||!fe(t.violation))return!1;let n=t.violation,r=y.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ue.has(n.resource)&&de.has(n.metric))}function pe(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function me(e){if(!b(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:pe(t.usage)}};return b(n)?n:void 0}function x(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function S(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(m))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!b(i.details)))return new r(x(i.details),i.details)}function he(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:S(e)??e}}function ge(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!v(n)||r!==`source-subset`))return{format:n,reason:r}}function _e(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ve(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=C(JSON.parse(t.slice(25)));return e?_e(e):void 0}catch{return}}function ye(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ve(e)??S(e)??ge(e)}function be(e){let t=s(e);if(t){let e=new ee(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=ne(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=ae(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:ye(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=me(e.details);return t?{message:typeof e.message==`string`?e.message:x(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=C(c.details);return e?{message:_e(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:_(o.name,128)?o.name:`OoxmlError`,...v(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(m))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:_(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function w(e){try{return be(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var xe=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},T=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function Se(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function Ce(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function we(e,t){return e({module_or_path:t})}var Te=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new xe(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),Ee),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return he(()=>this.runtime.run(e))}poison(){this.runtime.poison(new T(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):we(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,Ce(e)}};function Ee(e){return Se(e)?new T(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function De(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Oe(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const E=`ooxml-pull-v1`;function D(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function ke(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var Ae=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,D(this.maxRetainedBytes,`max retained lease bytes`),D(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},je=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){ke(e.sessionId),D(e.operationId,`operation id`),D(e.generation,`generation`),D(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&D(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=w(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(D(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:E,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){D(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(D(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:E,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:E,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};const O=2**53-1-1;function k(e){return Object.freeze({maxRows:e.maxRows,maxCells:e.maxCells,maxOwnedUtf8Bytes:e.maxOwnedUtf8Bytes,maxJsonBytes:e.maxJsonBytes})}const A=Object.freeze({worksheet:k({maxRows:1e5,maxCells:25e4,maxOwnedUtf8Bytes:33554432,maxJsonBytes:67108864}),cache:k({maxRows:2e5,maxCells:5e5,maxOwnedUtf8Bytes:67108864,maxJsonBytes:134217728}),maxCoordinateIndexEntries:25e4});function j(e,t){let n=e[t];if(n===void 0)return A.worksheet[t];if(typeof n!=`number`)throw TypeError(`xlsxWorksheetLimits.${t} must be a number`);if(!Number.isSafeInteger(n)||n<=0||n>O)throw RangeError(`xlsxWorksheetLimits.${t} must be a positive safe integer no greater than ${O}`);return n}function Me(e={}){let t=e.xlsxWorksheetLimits,n={};if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`xlsxWorksheetLimits must be a non-null, non-array object`);n=t}let r=k({maxRows:j(n,`maxRows`),maxCells:j(n,`maxCells`),maxOwnedUtf8Bytes:j(n,`maxOwnedUtf8Bytes`),maxJsonBytes:j(n,`maxJsonBytes`)}),i=A,a=k({maxRows:Math.max(i.cache.maxRows,r.maxRows),maxCells:Math.max(i.cache.maxCells,r.maxCells),maxOwnedUtf8Bytes:Math.max(i.cache.maxOwnedUtf8Bytes,r.maxOwnedUtf8Bytes),maxJsonBytes:Math.max(i.cache.maxJsonBytes,r.maxJsonBytes)});return Object.freeze({worksheet:r,cache:a,maxCoordinateIndexEntries:Math.max(i.maxCoordinateIndexEntries,r.maxCells)})}function Ne(e){let{worksheet:t}=e;return[BigInt(t.maxRows),BigInt(t.maxCells),BigInt(t.maxOwnedUtf8Bytes),BigInt(t.maxJsonBytes)]}var M=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_xlsxarchive_free(e,0)}acknowledge_sheet_cursor_terminal(){let e=K.xlsxarchive_acknowledge_sheet_cursor_terminal(this.__wbg_ptr);if(e[1])throw V(e[0])}assert_healthy(){let e=K.xlsxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw V(e[0])}cancel_sheet_cursor(){K.xlsxarchive_cancel_sheet_cursor(this.__wbg_ptr)}close_sheet_cursor(){K.xlsxarchive_close_sheet_cursor(this.__wbg_ptr)}extract_image(e){let t=B(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.xlsxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw V(r[2]);var i=P(r[0],r[1]).slice();return K.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Ie(e,K.__wbindgen_malloc),a=G,o=K.xlsxarchive_new(i,a,!z(t),z(t)?BigInt(0):t,!z(n),z(n)?BigInt(0):n,!z(r),z(r)?BigInt(0):r);if(o[2])throw V(o[1]);return this.__wbg_ptr=o[0]>>>0,N.register(this,this.__wbg_ptr,this),this}open_sheet_cursor(e,t){let n=B(t,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.xlsxarchive_open_sheet_cursor(this.__wbg_ptr,e,n,r);if(i[1])throw V(i[0])}parse(){let e=K.xlsxarchive_parse(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}pull_sheet_cursor(e){let t=K.xlsxarchive_pull_sheet_cursor(this.__wbg_ptr,e);if(t[3])throw V(t[2]);var n=P(t[0],t[1]).slice();return K.__wbindgen_free(t[0],t[1]*1,1),n}resource_usage(){let e=K.xlsxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}set_worksheet_limits(e,t,n,r){let i=K.xlsxarchive_set_worksheet_limits(this.__wbg_ptr,e,t,n,r);if(i[1])throw V(i[0])}sheet_cursor_pull_finished(){return K.xlsxarchive_sheet_cursor_pull_finished(this.__wbg_ptr)!==0}sheet_cursor_resource_usage(){let e=K.xlsxarchive_sheet_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=K.xlsxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,V(i[2]);return e=n,t=r,I(n,r)}finally{K.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);function Pe(){return{__proto__:null,\"./xlsx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(I(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(I(e,t))}finally{K.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=B(n,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G;Fe().setInt32(e+4,i,!0),Fe().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return I(e,t)},__wbindgen_init_externref_table:function(){let e=K.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const N=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_xlsxarchive_free(e>>>0,1));function P(e,t){return e>>>=0,R().subarray(e/1,e/1+t)}let F=null;function Fe(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==K.memory.buffer)&&(F=new DataView(K.memory.buffer)),F}function I(e,t){return e>>>=0,Le(e,t)}let L=null;function R(){return(L===null||L.byteLength===0)&&(L=new Uint8Array(K.memory.buffer)),L}function z(e){return e==null}function Ie(e,t){let n=t(e.length*1,1)>>>0;return R().set(e,n/1),G=e.length,n}function B(e,t,n){if(n===void 0){let n=W.encode(e),r=t(n.length,1)>>>0;return R().subarray(r,r+n.length).set(n),G=n.length,r}let r=e.length,i=t(r,1)>>>0,a=R(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=R().subarray(i+o,i+r),a=W.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return G=o,i}function V(e){let t=K.__wbindgen_externrefs.get(e);return K.__externref_table_dealloc(e),t}let H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});H.decode();let U=0;function Le(e,t){return U+=t,U>=2146435072&&(H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),H.decode(),U=t),H.decode(R().subarray(e,e+t))}const W=new TextEncoder;`encodeInto`in W||(W.encodeInto=function(e,t){let n=W.encode(e);return t.set(n),{read:e.length,written:n.length}});let G=0,K;function Re(e,t){return K=e.exports,F=null,L=null,K.__wbindgen_start(),K}async function ze(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Be(e){if(K!==void 0)return K;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=Pe();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await ze(await e,t);return Re(n,r)}async function Ve(e){return K=void 0,F=null,L=null,Be(e)}function He(e,t){return{workbook:e(),usage:g(t())}}function Ue(e,t){for(let n of e)for(let e of n.cells){let n=e.value;if(n.type===`shared`){let r=t[n.si];if(r){let t={type:`text`,text:r.text};r.runs!==void 0&&(t.runs=r.runs),r.phoneticRuns!==void 0&&(t.phoneticRuns=r.phoneticRuns),r.phoneticPr!==void 0&&(t.phoneticPr=r.phoneticPr),e.value=t}else e.value={type:`text`,text:``}}}return e}const We=new Set([`outline`,`merge`,`conditional-format`,`ancillary-content`,`metadata-unavailable`,`unordered-rows`]);function Ge(e,t,n,r){let i=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=JSON.parse(new TextDecoder().decode(i));if(!a||typeof a!=`object`||!(`kind`in a))throw Error(`worksheet cursor returned an invalid unit`);let o=a;if(t!==(o.kind===`finished`))throw Error(`worksheet cursor terminal marker mismatch`);if(o.kind===`rows`){if(!Array.isArray(o.rows))throw Error(`worksheet row unit is missing rows`);return n&&Ue(o.rows,n),r?.(o.rows),{kind:`rows`,rows:o.rows}}if(o.kind===`preview`){if(!Number.isSafeInteger(o.maxRow)||!Number.isSafeInteger(o.maxCol)||o.maxRow<0||o.maxCol<0||o.worksheet===null==(o.reason===null)||o.worksheet!==null&&(typeof o.worksheet!=`object`||Array.isArray(o.worksheet))||o.reason!==null&&!We.has(o.reason))throw Error(`worksheet preview unit is invalid`);return o.worksheet&&(o.worksheet.rows=[]),o}if(o.kind===`finished`){if(!o.worksheet||typeof o.worksheet!=`object`)throw Error(`worksheet terminal unit is missing its worksheet`);return o.worksheet.rows=[],{kind:`finished`,worksheet:o.worksheet}}throw Error(`worksheet cursor returned an unknown unit kind`)}const Ke=new WeakMap;function qe(e,t){Ke.set(e,t)}function q(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`${t} must be a non-negative safe integer`)}function J(e,t,n){return q(e,`resource measurement`),q(t,`resource measurement`),q(n,`resource measurement limit`),e>n||t>n||t>n-e?n===2**53-1?n:n+1:e+t}function Je(e,t=2**53-1){q(t,`resource measurement limit`);let n=0;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=3}else a=3;if(n=J(n,a,t),n>t)return n}return n}function Ye(e,t=2**53-1){q(t,`resource measurement limit`);let n=J(0,2,t);if(n>t)return n;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i===34||i===92||i===8||i===9||i===10||i===12||i===13)a=2;else if(i<=31)a=6;else if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=6}else a=i>=55296&&i<=57343?6:3;if(n=J(n,a,t),n>t)return n}return n}function Y(e,t){return J(0,e,t)}function X(e,t=2**53-1,n=!1){if(q(t,`resource measurement limit`),e===null)return{jsonBytes:Y(4,t),stringValueUtf8Bytes:0};if(typeof e==`string`)return{jsonBytes:Ye(e,t),stringValueUtf8Bytes:Je(e,t)};if(typeof e==`boolean`)return{jsonBytes:Y(e?4:5,t),stringValueUtf8Bytes:0};if(typeof e==`number`)return{jsonBytes:Y((Number.isFinite(e)?String(Object.is(e,-0)?0:e):`null`).length,t),stringValueUtf8Bytes:0};if(typeof e==`bigint`)throw TypeError(`BigInt values cannot be serialized to JSON`);if(Array.isArray(e)){let n=Y(2,t),r=0;for(let i=0;i<e.length;i+=1){i!==0&&(n=J(n,1,t));let a=X(e[i],t,!0);n=J(n,a.jsonBytes,t),r=J(r,a.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}if(typeof e==`object`){let n=Y(2,t),r=0,i=0;for(let[a,o]of Object.entries(e)){if(o===void 0||typeof o==`function`||typeof o==`symbol`)continue;i++!==0&&(n=J(n,1,t)),n=J(n,Ye(a,t),t),n=J(n,1,t);let e=X(o,t);n=J(n,e.jsonBytes,t),r=J(r,e.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}return{jsonBytes:n?Y(4,t):0,stringValueUtf8Bytes:0}}i();const Xe=Object.freeze({archiveEntryCount:0,declaredInflatedBytes:0,distinctInflatedBytes:0,operationInflatedBytes:0});function Ze(e,t=A){let{maxCells:n,maxOwnedUtf8Bytes:r}=t.worksheet,i=e.reduce((e,t)=>J(e,t.cells.length,n),0);return{rows:e.length,cells:i,ownedUtf8Bytes:e.reduce((e,t)=>t.cells.reduce((e,t)=>{let n=X(t.value,r).stringValueUtf8Bytes;return J(e,J(n,t.formula===void 0?0:Je(t.formula,r),r),r)},e),0)}}function Qe(e,t,n=A){let r=X(e,n.worksheet.maxJsonBytes);return{...t,jsonBytes:r.jsonBytes}}function $e(e,t,n=A){let r=n.worksheet;return{rows:J(e.rows,t.rows,r.maxRows),cells:J(e.cells,t.cells,r.maxCells),ownedUtf8Bytes:J(e.ownedUtf8Bytes,t.ownedUtf8Bytes,r.maxOwnedUtf8Bytes)}}function et(e,t,n,i,a,o,s,c=n!==`delimited-text-source`){let l=n===`worksheet-json`?`serialization`:`parsing`;return new r(x({stage:l,violation:{part:t,resource:n,metric:i,observed:o,limit:a}}),{stage:l,violation:{format:`xlsx`,operation:e,resource:n,metric:i,...t===void 0?{}:{part:t},limit:a,observed:Math.min(o,a+1),configurable:c,usage:s??Xe}})}function tt(e,t,n,r,i=A){let a=i.worksheet,o=[[`rows`,e.rows,a.maxRows],[`cells`,e.cells,a.maxCells],[`owned-utf8-bytes`,e.ownedUtf8Bytes,a.maxOwnedUtf8Bytes]];for(let[e,i,a]of o)if(i>a)throw et(t,n,e===`owned-utf8-bytes`?`worksheet-cell-content`:`worksheet-model`,e,a,i,r)}function nt(e,t,n,r,i=A){let a=i.worksheet.maxJsonBytes;if(e>a)throw et(t,n,`worksheet-json`,`bytes`,a,e,r)}i();var rt=class{archive;acceptWorksheet;executeArchive;prepareRows;provisional;worksheetPolicy;coordinator=new Ae;sessions=new Map;operationTail=Promise.resolve();pendingOpens=new Map;resourceFailure;constructor(e,t,n=e=>e(this.requireArchive()),r,i,a=()=>A){this.archive=e,this.acceptWorksheet=t,this.executeArchive=n,this.prepareRows=r,this.provisional=i,this.worksheetPolicy=a}reserveOpen(e){this.pendingOpens.set(e.sessionId,{identity:e,canceled:!1})}abandonOpen(e){this.pendingOpens.delete(e)}get pendingOpenCount(){return this.pendingOpens.size}runDuringPull(e){return this.sessions.size===0?this.run(e):this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;try{return e()}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}})}async open(e,t,n){if(this.resourceFailure)throw this.resourceFailure;let i=this.pendingOpens.get(n.sessionId);if(!i||i.identity.operationId!==n.operationId||i.identity.generation!==n.generation)throw Error(`worksheet pull session open reservation is stale or missing`);let a=this.worksheetPolicy(),o,s=new Promise(e=>{o=e}),c=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(i.canceled)throw Error(`worksheet pull session open was canceled`);this.executeArchive(n=>n.open_sheet_cursor(e,t));let s=[],c={rows:0,cells:0,ownedUtf8Bytes:0},l,u=!1,d=new je({...n,maxByteCredit:67108864,coordinator:this.coordinator,driver:{pull:()=>{let t=this.executeArchive(e=>e.pull_sheet_cursor(128)),n=this.executeArchive(e=>e.sheet_cursor_pull_finished());if(this.acceptWorksheet){let i=Ge(t,n,void 0,this.prepareRows);try{if(i.kind===`preview`)i.worksheet&&(i.worksheet.rows=s,qe(i.worksheet,a),this.provisional?.preview(e,i.worksheet));else if(i.kind===`rows`){let e=$e(c,Ze(i.rows,a),a);tt(e,`get-worksheet-worker`,void 0,this.readResourceUsage(),a),s.push(...i.rows),c=e}else i.kind===`finished`&&(l=i.worksheet)}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}}u=n;let i=De(t);return{payload:i,byteLength:i.byteLength,done:n,transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:()=>{if(!u)return;let t,i;try{if(this.acceptWorksheet){if(!l)throw Error(`worksheet terminal payload is missing`);l.rows=l.parseError?[]:s;let n=l.parseError?{rows:0,cells:0,ownedUtf8Bytes:0}:c,r=Qe(l,n,a),o=this.readResourceUsage();tt(r,`get-worksheet-worker`,void 0,o,a),nt(r.jsonBytes,`get-worksheet-worker`,void 0,o,a),qe(l,a);let u=this.acceptWorksheet(e,l,r,o);typeof u==`function`?t=u:u&&({rollback:t,commit:i}=u)}this.executeArchive(e=>e.acknowledge_sheet_cursor_terminal()),i?.()}catch(e){throw t?.(),e instanceof r&&(this.resourceFailure??=e),e}u=!1,this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()},cancel:()=>{try{this.archive()&&this.executeArchive(e=>e.cancel_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},close:()=>{try{this.archive()&&this.executeArchive(e=>e.close_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},resourceUsage:()=>this.readResourceUsage()}});this.sessions.set(n.sessionId,{host:d,identity:n}),this.pendingOpens.delete(n.sessionId)}));this.operationTail=c.then(()=>s,()=>void 0);try{await c}catch(e){throw this.pendingOpens.delete(n.sessionId),o(),e}}async postOpenedSafely(e,t,n){try{t()}catch(t){await this.closeIdentity(e);try{n(t)}catch{}}}dispatch(e,t){let n=this.sessions.get(e.sessionId);if(n)return n.host.dispatch(e,t);let r=this.pendingOpens.get(e.sessionId);if(r&&(e.kind===`cancel`||e.kind===`close`)){let n=r.identity.operationId===e.operationId&&r.identity.generation===e.generation;return n&&(r.canceled=!0),t(n?{protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}:{protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:{message:`stale lifecycle targets another pending worksheet operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`}}),Promise.resolve()}return e.kind===`cancel`||e.kind===`close`?(t({protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}),Promise.resolve()):(t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(Error(`worksheet pull session is not open`))}),Promise.resolve())}async dispatchSafely(e,t){try{await this.dispatch(e,t)}catch(n){try{t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(n)})}catch{}}}run(e){let t=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;return e()})).catch(e=>{throw e instanceof r&&(this.resourceFailure??=e),e});return this.operationTail=t.then(()=>void 0,()=>void 0),t}async reset(){for(let e of this.pendingOpens.values())e.canceled=!0;let e=1;for(let{host:t,identity:n}of[...this.sessions.values()])await t.dispatch({protocol:E,kind:`close`,...n,requestId:e++},()=>void 0);this.sessions.clear(),await this.operationTail,this.pendingOpens.clear(),this.resourceFailure=void 0}requireArchive(){let e=this.archive();if(!e)throw Error(`Workbook not loaded`);return e}async closeIdentity(e){let t=this.sessions.get(e.sessionId);if(t){await t.host.dispatch({protocol:E,kind:`close`,...e,requestId:1},()=>void 0);return}let n=this.pendingOpens.get(e.sessionId);n&&n.identity.operationId===e.operationId&&n.identity.generation===e.generation&&(n.canceled=!0)}readResourceUsage(){return g(this.executeArchive(e=>e.sheet_cursor_resource_usage()))}};function it(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const Z=new Te(Be,{freeArchive:e=>e.free(),reinit:Ve});let Q=A;const $=new rt(()=>Z.archive,void 0,e=>{let t=Z.archive;if(!t)throw Error(`Workbook not loaded`);return Z.run(()=>e(t))},void 0,void 0,()=>Q);self.onmessage=async e=>{let n=e.data;if(it(n)){await $.dispatchSafely(n,(e,t)=>self.postMessage(e,t));return}if(n.type===`init`){Z.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;n.type===`openSheetSession`&&$.reserveOpen(n);try{let e=n.type===`parse`?Me({xlsxWorksheetLimits:n.worksheetPolicy?.worksheet}):void 0;if(n.type===`openSheetSession`){await Z.ensureReady(),Z.archive&&Z.run(()=>Z.archive?.assert_healthy()),await $.open(n.sheetIndex,n.sheetName,n),await $.postOpenedSafely(n,()=>self.postMessage({type:`sheetSessionOpened`,id:r,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation}),e=>self.postMessage({type:`error`,id:r,...w(e)}));return}n.type===`parse`&&await $.reset(),await(n.type===`extractImage`?$.runDuringPull:$.run).call($,async()=>{if(await Z.ensureReady(),n.type!==`parse`&&Z.archive){let e=Z.archive;Z.run(()=>e.assert_healthy())}if(n.type===`parse`){let[t,i,a]=Oe(n.resourcePolicy),o=new Uint8Array(n.data);Q=e??A;let s=Ne(Q),{workbook:c,usage:l}=He(()=>Z.run(()=>{let e=new M(o,t,i,a);return Z.setArchive(e),e.set_worksheet_limits(...s),e.parse()}),()=>Z.run(()=>Z.archive.resource_usage())),u=c.buffer,d={type:`parsed`,id:r,workbookJson:u,usage:l};self.postMessage(d,[u]);return}let t=Z.archive;if(n.type===`extractImage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>t.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:e};self.postMessage(i,[e]);return}if(n.type===`resourceUsage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>g(t.resource_usage()));self.postMessage({type:`resourceUsage`,id:r,usage:e});return}if(n.type===`toMarkdown`){if(!t)throw Error(`No xlsx loaded`);let e={type:`markdownRendered`,id:r,markdown:Z.run(()=>t.to_markdown())};self.postMessage(e);return}})}catch(e){n.type===`openSheetSession`&&$.abandonOpen(n.sessionId);let t={type:`error`,id:r,...w(e)};try{self.postMessage(t)}catch{}}};", Jt = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", qt], { type: "text/javascript;charset=utf-8" });
|
|
15
|
-
function
|
|
2
|
+
import { Co as t, Er as n, Fa as r, Ia as i, Pa as a, Tr as o, Yn as s, a as c, c as l, d as u, h as d, m as f, o as p, r as m, u as h, wo as g, wr as _ } from "./plot-area-frame-DNYMd9Pf.js";
|
|
3
|
+
import { n as v, t as y } from "./cfb-guard-DzYlucez.js";
|
|
4
|
+
import { $ as b, $t as x, An as S, F as C, I as w, L as T, P as E, Q as D, Qt as O, St as ee, W as k, Xt as A, at as j, bt as te, ft as M, ht as N, it as ne, jn as P, lt as re, ot as ie, p as ae, t as oe, ut as se, vn as F, xt as ce, yt as le } from "./bounded-raw-part-cache-B5a6cGKO.js";
|
|
5
|
+
import { f as I, u as ue } from "./pixel-budget-DI82Hn3R.js";
|
|
6
|
+
import { L as de, R as fe, V as pe, n as me, t as he } from "./renderer-DpTePxGq.js";
|
|
7
|
+
import { i as ge, t as _e } from "./tiff-contract-DEd8CGuz.js";
|
|
8
|
+
import { C as ve, D as ye, E as be, S as xe, T as Se, _ as Ce, a as we, b as Te, d as Ee, f as De, g as Oe, h as ke, m as Ae, o as je, p as Me, t as Ne, u as Pe, w as Fe, x as Ie, y as Le } from "./canvas-viewer-mechanics-BsqaoYgK.js";
|
|
9
|
+
import { A as Re, B as ze, C as Be, D as Ve, E as He, F as Ue, G as We, H as Ge, I as Ke, L as qe, M as L, N as Je, O as Ye, P as Xe, R as Ze, S as Qe, T as $e, U as et, V as tt, W as nt, _ as rt, b as R, c as it, d as at, f as ot, g as st, h as ct, i as lt, j as ut, k as dt, l as ft, m as pt, n as mt, o as ht, p as gt, r as _t, s as z, t as vt, u as yt, v as bt, w as xt, x as St, y as Ct, z as wt } from "./renderer-DuYC3xXi.js";
|
|
10
|
+
import { n as Tt } from "./renderer-module-contract-BuTx2FWJ.js";
|
|
11
|
+
import { _ as Et, a as Dt, b as Ot, c as kt, d as At, f as jt, g as Mt, h as Nt, l as Pt, m as Ft, n as It, o as Lt, p as Rt, s as zt, t as Bt, u as Vt, v as Ht, y as Ut } from "./worksheet-pull-client-BudfclVl.js";
|
|
12
|
+
import { n as Wt, r as Gt, t as Kt } from "./visible-index-vN-4BNn7.js";
|
|
13
|
+
import { a as qt, c as Jt, d as Yt, f as Xt, l as B, n as V, o as Zt, p as Qt, r as H, t as U, u as $t } from "./grid-geometry-DpMAiSZb.js";
|
|
14
|
+
var en = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,ee,te=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,ee=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function ne(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var re=e((()=>{}));function f(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function ie(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return f(t.requiredBytes)&&f(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var p=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function ae(e){if(e instanceof p)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!ie(r)))return new p(r)}i(),te(),re();const m=`OOXML_RESOURCE_LIMIT:`;function h(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function oe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return h(t.archiveEntryCount)&&h(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||h(t.largestInflatedEntryBytes))&&h(t.distinctInflatedBytes)&&h(t.operationInflatedBytes)}function g(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!oe(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function se(e){return e===`docx`||e===`xlsx`||e===`pptx`}function ce(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function _(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function v(e){return _(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function le(e){return!_(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const y=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ue=new Set([...y.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),de=new Set([...y.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function fe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!se(t.format)||!_(t.operation,256)||!v(t.resource)||!v(t.metric)||!h(t.limit)||!h(t.observed)||typeof t.configurable!=`boolean`||!oe(t.usage)?!1:!(`part`in t)||le(t.part)}function b(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!ce(t.stage)||!fe(t.violation))return!1;let n=t.violation,r=y.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ue.has(n.resource)&&de.has(n.metric))}function pe(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function me(e){if(!b(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:pe(t.usage)}};return b(n)?n:void 0}function x(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function S(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(m))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!b(i.details)))return new r(x(i.details),i.details)}function he(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:S(e)??e}}function ge(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!v(n)||r!==`source-subset`))return{format:n,reason:r}}function _e(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ve(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=C(JSON.parse(t.slice(25)));return e?_e(e):void 0}catch{return}}function ye(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ve(e)??S(e)??ge(e)}function be(e){let t=s(e);if(t){let e=new ee(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=ne(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=ae(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:ye(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=me(e.details);return t?{message:typeof e.message==`string`?e.message:x(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=C(c.details);return e?{message:_e(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:_(o.name,128)?o.name:`OoxmlError`,...v(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(m))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:_(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function w(e){try{return be(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var xe=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},T=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function Se(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function Ce(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function we(e,t){return e({module_or_path:t})}var Te=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new xe(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),Ee),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return he(()=>this.runtime.run(e))}poison(){this.runtime.poison(new T(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):we(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,Ce(e)}};function Ee(e){return Se(e)?new T(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function De(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Oe(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const E=`ooxml-pull-v1`;function D(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function ke(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var Ae=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,D(this.maxRetainedBytes,`max retained lease bytes`),D(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},je=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){ke(e.sessionId),D(e.operationId,`operation id`),D(e.generation,`generation`),D(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&D(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=w(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(D(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:E,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){D(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(D(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:E,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:E,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};const O=2**53-1-1;function k(e){return Object.freeze({maxRows:e.maxRows,maxCells:e.maxCells,maxOwnedUtf8Bytes:e.maxOwnedUtf8Bytes,maxJsonBytes:e.maxJsonBytes})}const A=Object.freeze({worksheet:k({maxRows:1e5,maxCells:25e4,maxOwnedUtf8Bytes:33554432,maxJsonBytes:67108864}),cache:k({maxRows:2e5,maxCells:5e5,maxOwnedUtf8Bytes:67108864,maxJsonBytes:134217728}),maxCoordinateIndexEntries:25e4});function j(e,t){let n=e[t];if(n===void 0)return A.worksheet[t];if(typeof n!=`number`)throw TypeError(`xlsxWorksheetLimits.${t} must be a number`);if(!Number.isSafeInteger(n)||n<=0||n>O)throw RangeError(`xlsxWorksheetLimits.${t} must be a positive safe integer no greater than ${O}`);return n}function Me(e={}){let t=e.xlsxWorksheetLimits,n={};if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`xlsxWorksheetLimits must be a non-null, non-array object`);n=t}let r=k({maxRows:j(n,`maxRows`),maxCells:j(n,`maxCells`),maxOwnedUtf8Bytes:j(n,`maxOwnedUtf8Bytes`),maxJsonBytes:j(n,`maxJsonBytes`)}),i=A,a=k({maxRows:Math.max(i.cache.maxRows,r.maxRows),maxCells:Math.max(i.cache.maxCells,r.maxCells),maxOwnedUtf8Bytes:Math.max(i.cache.maxOwnedUtf8Bytes,r.maxOwnedUtf8Bytes),maxJsonBytes:Math.max(i.cache.maxJsonBytes,r.maxJsonBytes)});return Object.freeze({worksheet:r,cache:a,maxCoordinateIndexEntries:Math.max(i.maxCoordinateIndexEntries,r.maxCells)})}function Ne(e){let{worksheet:t}=e;return[BigInt(t.maxRows),BigInt(t.maxCells),BigInt(t.maxOwnedUtf8Bytes),BigInt(t.maxJsonBytes)]}var M=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_xlsxarchive_free(e,0)}acknowledge_sheet_cursor_terminal(){let e=K.xlsxarchive_acknowledge_sheet_cursor_terminal(this.__wbg_ptr);if(e[1])throw V(e[0])}assert_healthy(){let e=K.xlsxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw V(e[0])}cancel_sheet_cursor(){K.xlsxarchive_cancel_sheet_cursor(this.__wbg_ptr)}close_sheet_cursor(){K.xlsxarchive_close_sheet_cursor(this.__wbg_ptr)}extract_image(e){let t=B(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.xlsxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw V(r[2]);var i=P(r[0],r[1]).slice();return K.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Ie(e,K.__wbindgen_malloc),a=G,o=K.xlsxarchive_new(i,a,!z(t),z(t)?BigInt(0):t,!z(n),z(n)?BigInt(0):n,!z(r),z(r)?BigInt(0):r);if(o[2])throw V(o[1]);return this.__wbg_ptr=o[0]>>>0,N.register(this,this.__wbg_ptr,this),this}open_sheet_cursor(e,t){let n=B(t,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.xlsxarchive_open_sheet_cursor(this.__wbg_ptr,e,n,r);if(i[1])throw V(i[0])}parse(){let e=K.xlsxarchive_parse(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}pull_sheet_cursor(e){let t=K.xlsxarchive_pull_sheet_cursor(this.__wbg_ptr,e);if(t[3])throw V(t[2]);var n=P(t[0],t[1]).slice();return K.__wbindgen_free(t[0],t[1]*1,1),n}resource_usage(){let e=K.xlsxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}set_worksheet_limits(e,t,n,r){let i=K.xlsxarchive_set_worksheet_limits(this.__wbg_ptr,e,t,n,r);if(i[1])throw V(i[0])}sheet_cursor_pull_finished(){return K.xlsxarchive_sheet_cursor_pull_finished(this.__wbg_ptr)!==0}sheet_cursor_resource_usage(){let e=K.xlsxarchive_sheet_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=K.xlsxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,V(i[2]);return e=n,t=r,I(n,r)}finally{K.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);function Pe(){return{__proto__:null,\"./xlsx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(I(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(I(e,t))}finally{K.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=B(n,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G;Fe().setInt32(e+4,i,!0),Fe().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return I(e,t)},__wbindgen_init_externref_table:function(){let e=K.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const N=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_xlsxarchive_free(e>>>0,1));function P(e,t){return e>>>=0,R().subarray(e/1,e/1+t)}let F=null;function Fe(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==K.memory.buffer)&&(F=new DataView(K.memory.buffer)),F}function I(e,t){return e>>>=0,Le(e,t)}let L=null;function R(){return(L===null||L.byteLength===0)&&(L=new Uint8Array(K.memory.buffer)),L}function z(e){return e==null}function Ie(e,t){let n=t(e.length*1,1)>>>0;return R().set(e,n/1),G=e.length,n}function B(e,t,n){if(n===void 0){let n=W.encode(e),r=t(n.length,1)>>>0;return R().subarray(r,r+n.length).set(n),G=n.length,r}let r=e.length,i=t(r,1)>>>0,a=R(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=R().subarray(i+o,i+r),a=W.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return G=o,i}function V(e){let t=K.__wbindgen_externrefs.get(e);return K.__externref_table_dealloc(e),t}let H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});H.decode();let U=0;function Le(e,t){return U+=t,U>=2146435072&&(H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),H.decode(),U=t),H.decode(R().subarray(e,e+t))}const W=new TextEncoder;`encodeInto`in W||(W.encodeInto=function(e,t){let n=W.encode(e);return t.set(n),{read:e.length,written:n.length}});let G=0,K;function Re(e,t){return K=e.exports,F=null,L=null,K.__wbindgen_start(),K}async function ze(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Be(e){if(K!==void 0)return K;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=Pe();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await ze(await e,t);return Re(n,r)}async function Ve(e){return K=void 0,F=null,L=null,Be(e)}function He(e,t){return{workbook:e(),usage:g(t())}}function Ue(e,t){for(let n of e)for(let e of n.cells){let n=e.value;if(n.type===`shared`){let r=t[n.si];if(r){let t={type:`text`,text:r.text};r.runs!==void 0&&(t.runs=r.runs),r.phoneticRuns!==void 0&&(t.phoneticRuns=r.phoneticRuns),r.phoneticPr!==void 0&&(t.phoneticPr=r.phoneticPr),e.value=t}else e.value={type:`text`,text:``}}}return e}const We=new Set([`outline`,`merge`,`conditional-format`,`ancillary-content`,`metadata-unavailable`,`unordered-rows`]);function Ge(e,t,n,r){let i=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=JSON.parse(new TextDecoder().decode(i));if(!a||typeof a!=`object`||!(`kind`in a))throw Error(`worksheet cursor returned an invalid unit`);let o=a;if(t!==(o.kind===`finished`))throw Error(`worksheet cursor terminal marker mismatch`);if(o.kind===`rows`){if(!Array.isArray(o.rows))throw Error(`worksheet row unit is missing rows`);return n&&Ue(o.rows,n),r?.(o.rows),{kind:`rows`,rows:o.rows}}if(o.kind===`preview`){if(!Number.isSafeInteger(o.maxRow)||!Number.isSafeInteger(o.maxCol)||o.maxRow<0||o.maxCol<0||o.worksheet===null==(o.reason===null)||o.worksheet!==null&&(typeof o.worksheet!=`object`||Array.isArray(o.worksheet))||o.reason!==null&&!We.has(o.reason))throw Error(`worksheet preview unit is invalid`);return o.worksheet&&(o.worksheet.rows=[]),o}if(o.kind===`finished`){if(!o.worksheet||typeof o.worksheet!=`object`)throw Error(`worksheet terminal unit is missing its worksheet`);return o.worksheet.rows=[],{kind:`finished`,worksheet:o.worksheet}}throw Error(`worksheet cursor returned an unknown unit kind`)}const Ke=new WeakMap;function qe(e,t){Ke.set(e,t)}function q(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`${t} must be a non-negative safe integer`)}function J(e,t,n){return q(e,`resource measurement`),q(t,`resource measurement`),q(n,`resource measurement limit`),e>n||t>n||t>n-e?n===2**53-1?n:n+1:e+t}function Je(e,t=2**53-1){q(t,`resource measurement limit`);let n=0;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=3}else a=3;if(n=J(n,a,t),n>t)return n}return n}function Ye(e,t=2**53-1){q(t,`resource measurement limit`);let n=J(0,2,t);if(n>t)return n;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i===34||i===92||i===8||i===9||i===10||i===12||i===13)a=2;else if(i<=31)a=6;else if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=6}else a=i>=55296&&i<=57343?6:3;if(n=J(n,a,t),n>t)return n}return n}function Y(e,t){return J(0,e,t)}function X(e,t=2**53-1,n=!1){if(q(t,`resource measurement limit`),e===null)return{jsonBytes:Y(4,t),stringValueUtf8Bytes:0};if(typeof e==`string`)return{jsonBytes:Ye(e,t),stringValueUtf8Bytes:Je(e,t)};if(typeof e==`boolean`)return{jsonBytes:Y(e?4:5,t),stringValueUtf8Bytes:0};if(typeof e==`number`)return{jsonBytes:Y((Number.isFinite(e)?String(Object.is(e,-0)?0:e):`null`).length,t),stringValueUtf8Bytes:0};if(typeof e==`bigint`)throw TypeError(`BigInt values cannot be serialized to JSON`);if(Array.isArray(e)){let n=Y(2,t),r=0;for(let i=0;i<e.length;i+=1){i!==0&&(n=J(n,1,t));let a=X(e[i],t,!0);n=J(n,a.jsonBytes,t),r=J(r,a.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}if(typeof e==`object`){let n=Y(2,t),r=0,i=0;for(let[a,o]of Object.entries(e)){if(o===void 0||typeof o==`function`||typeof o==`symbol`)continue;i++!==0&&(n=J(n,1,t)),n=J(n,Ye(a,t),t),n=J(n,1,t);let e=X(o,t);n=J(n,e.jsonBytes,t),r=J(r,e.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}return{jsonBytes:n?Y(4,t):0,stringValueUtf8Bytes:0}}i();const Xe=Object.freeze({archiveEntryCount:0,declaredInflatedBytes:0,distinctInflatedBytes:0,operationInflatedBytes:0});function Ze(e,t=A){let{maxCells:n,maxOwnedUtf8Bytes:r}=t.worksheet,i=e.reduce((e,t)=>J(e,t.cells.length,n),0);return{rows:e.length,cells:i,ownedUtf8Bytes:e.reduce((e,t)=>t.cells.reduce((e,t)=>{let n=X(t.value,r).stringValueUtf8Bytes;return J(e,J(n,t.formula===void 0?0:Je(t.formula,r),r),r)},e),0)}}function Qe(e,t,n=A){let r=X(e,n.worksheet.maxJsonBytes);return{...t,jsonBytes:r.jsonBytes}}function $e(e,t,n=A){let r=n.worksheet;return{rows:J(e.rows,t.rows,r.maxRows),cells:J(e.cells,t.cells,r.maxCells),ownedUtf8Bytes:J(e.ownedUtf8Bytes,t.ownedUtf8Bytes,r.maxOwnedUtf8Bytes)}}function et(e,t,n,i,a,o,s,c=n!==`delimited-text-source`){let l=n===`worksheet-json`?`serialization`:`parsing`;return new r(x({stage:l,violation:{part:t,resource:n,metric:i,observed:o,limit:a}}),{stage:l,violation:{format:`xlsx`,operation:e,resource:n,metric:i,...t===void 0?{}:{part:t},limit:a,observed:Math.min(o,a+1),configurable:c,usage:s??Xe}})}function tt(e,t,n,r,i=A){let a=i.worksheet,o=[[`rows`,e.rows,a.maxRows],[`cells`,e.cells,a.maxCells],[`owned-utf8-bytes`,e.ownedUtf8Bytes,a.maxOwnedUtf8Bytes]];for(let[e,i,a]of o)if(i>a)throw et(t,n,e===`owned-utf8-bytes`?`worksheet-cell-content`:`worksheet-model`,e,a,i,r)}function nt(e,t,n,r,i=A){let a=i.worksheet.maxJsonBytes;if(e>a)throw et(t,n,`worksheet-json`,`bytes`,a,e,r)}i();var rt=class{archive;acceptWorksheet;executeArchive;prepareRows;provisional;worksheetPolicy;coordinator=new Ae;sessions=new Map;operationTail=Promise.resolve();pendingOpens=new Map;resourceFailure;constructor(e,t,n=e=>e(this.requireArchive()),r,i,a=()=>A){this.archive=e,this.acceptWorksheet=t,this.executeArchive=n,this.prepareRows=r,this.provisional=i,this.worksheetPolicy=a}reserveOpen(e){this.pendingOpens.set(e.sessionId,{identity:e,canceled:!1})}abandonOpen(e){this.pendingOpens.delete(e)}get pendingOpenCount(){return this.pendingOpens.size}runDuringPull(e){return this.sessions.size===0?this.run(e):this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;try{return e()}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}})}async open(e,t,n){if(this.resourceFailure)throw this.resourceFailure;let i=this.pendingOpens.get(n.sessionId);if(!i||i.identity.operationId!==n.operationId||i.identity.generation!==n.generation)throw Error(`worksheet pull session open reservation is stale or missing`);let a=this.worksheetPolicy(),o,s=new Promise(e=>{o=e}),c=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(i.canceled)throw Error(`worksheet pull session open was canceled`);this.executeArchive(n=>n.open_sheet_cursor(e,t));let s=[],c={rows:0,cells:0,ownedUtf8Bytes:0},l,u=!1,d=new je({...n,maxByteCredit:67108864,coordinator:this.coordinator,driver:{pull:()=>{let t=this.executeArchive(e=>e.pull_sheet_cursor(128)),n=this.executeArchive(e=>e.sheet_cursor_pull_finished());if(this.acceptWorksheet){let i=Ge(t,n,void 0,this.prepareRows);try{if(i.kind===`preview`)i.worksheet&&(i.worksheet.rows=s,qe(i.worksheet,a),this.provisional?.preview(e,i.worksheet));else if(i.kind===`rows`){let e=$e(c,Ze(i.rows,a),a);tt(e,`get-worksheet-worker`,void 0,this.readResourceUsage(),a),s.push(...i.rows),c=e}else i.kind===`finished`&&(l=i.worksheet)}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}}u=n;let i=De(t);return{payload:i,byteLength:i.byteLength,done:n,transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:()=>{if(!u)return;let t,i;try{if(this.acceptWorksheet){if(!l)throw Error(`worksheet terminal payload is missing`);l.rows=l.parseError?[]:s;let n=l.parseError?{rows:0,cells:0,ownedUtf8Bytes:0}:c,r=Qe(l,n,a),o=this.readResourceUsage();tt(r,`get-worksheet-worker`,void 0,o,a),nt(r.jsonBytes,`get-worksheet-worker`,void 0,o,a),qe(l,a);let u=this.acceptWorksheet(e,l,r,o);typeof u==`function`?t=u:u&&({rollback:t,commit:i}=u)}this.executeArchive(e=>e.acknowledge_sheet_cursor_terminal()),i?.()}catch(e){throw t?.(),e instanceof r&&(this.resourceFailure??=e),e}u=!1,this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()},cancel:()=>{try{this.archive()&&this.executeArchive(e=>e.cancel_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},close:()=>{try{this.archive()&&this.executeArchive(e=>e.close_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},resourceUsage:()=>this.readResourceUsage()}});this.sessions.set(n.sessionId,{host:d,identity:n}),this.pendingOpens.delete(n.sessionId)}));this.operationTail=c.then(()=>s,()=>void 0);try{await c}catch(e){throw this.pendingOpens.delete(n.sessionId),o(),e}}async postOpenedSafely(e,t,n){try{t()}catch(t){await this.closeIdentity(e);try{n(t)}catch{}}}dispatch(e,t){let n=this.sessions.get(e.sessionId);if(n)return n.host.dispatch(e,t);let r=this.pendingOpens.get(e.sessionId);if(r&&(e.kind===`cancel`||e.kind===`close`)){let n=r.identity.operationId===e.operationId&&r.identity.generation===e.generation;return n&&(r.canceled=!0),t(n?{protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}:{protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:{message:`stale lifecycle targets another pending worksheet operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`}}),Promise.resolve()}return e.kind===`cancel`||e.kind===`close`?(t({protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}),Promise.resolve()):(t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(Error(`worksheet pull session is not open`))}),Promise.resolve())}async dispatchSafely(e,t){try{await this.dispatch(e,t)}catch(n){try{t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(n)})}catch{}}}run(e){let t=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;return e()})).catch(e=>{throw e instanceof r&&(this.resourceFailure??=e),e});return this.operationTail=t.then(()=>void 0,()=>void 0),t}async reset(){for(let e of this.pendingOpens.values())e.canceled=!0;let e=1;for(let{host:t,identity:n}of[...this.sessions.values()])await t.dispatch({protocol:E,kind:`close`,...n,requestId:e++},()=>void 0);this.sessions.clear(),await this.operationTail,this.pendingOpens.clear(),this.resourceFailure=void 0}requireArchive(){let e=this.archive();if(!e)throw Error(`Workbook not loaded`);return e}async closeIdentity(e){let t=this.sessions.get(e.sessionId);if(t){await t.host.dispatch({protocol:E,kind:`close`,...e,requestId:1},()=>void 0);return}let n=this.pendingOpens.get(e.sessionId);n&&n.identity.operationId===e.operationId&&n.identity.generation===e.generation&&(n.canceled=!0)}readResourceUsage(){return g(this.executeArchive(e=>e.sheet_cursor_resource_usage()))}};function it(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const Z=new Te(Be,{freeArchive:e=>e.free(),reinit:Ve});let Q=A;const $=new rt(()=>Z.archive,void 0,e=>{let t=Z.archive;if(!t)throw Error(`Workbook not loaded`);return Z.run(()=>e(t))},void 0,void 0,()=>Q);self.onmessage=async e=>{let n=e.data;if(it(n)){await $.dispatchSafely(n,(e,t)=>self.postMessage(e,t));return}if(n.type===`init`){Z.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;n.type===`openSheetSession`&&$.reserveOpen(n);try{let e=n.type===`parse`?Me({xlsxWorksheetLimits:n.worksheetPolicy?.worksheet}):void 0;if(n.type===`openSheetSession`){await Z.ensureReady(),Z.archive&&Z.run(()=>Z.archive?.assert_healthy()),await $.open(n.sheetIndex,n.sheetName,n),await $.postOpenedSafely(n,()=>self.postMessage({type:`sheetSessionOpened`,id:r,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation}),e=>self.postMessage({type:`error`,id:r,...w(e)}));return}n.type===`parse`&&await $.reset(),await(n.type===`extractImage`?$.runDuringPull:$.run).call($,async()=>{if(await Z.ensureReady(),n.type!==`parse`&&Z.archive){let e=Z.archive;Z.run(()=>e.assert_healthy())}if(n.type===`parse`){let[t,i,a]=Oe(n.resourcePolicy),o=new Uint8Array(n.data);Q=e??A;let s=Ne(Q),{workbook:c,usage:l}=He(()=>Z.run(()=>{let e=new M(o,t,i,a);return Z.setArchive(e),e.set_worksheet_limits(...s),e.parse()}),()=>Z.run(()=>Z.archive.resource_usage())),u=c.buffer,d={type:`parsed`,id:r,workbookJson:u,usage:l};self.postMessage(d,[u]);return}let t=Z.archive;if(n.type===`extractImage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>t.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:e};self.postMessage(i,[e]);return}if(n.type===`resourceUsage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>g(t.resource_usage()));self.postMessage({type:`resourceUsage`,id:r,usage:e});return}if(n.type===`toMarkdown`){if(!t)throw Error(`No xlsx loaded`);let e={type:`markdownRendered`,id:r,markdown:Z.run(()=>t.to_markdown())};self.postMessage(e);return}})}catch(e){n.type===`openSheetSession`&&$.abandonOpen(n.sessionId);let t={type:`error`,id:r,...w(e)};try{self.postMessage(t)}catch{}}};", tn = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", en], { type: "text/javascript;charset=utf-8" });
|
|
15
|
+
function nn(e) {
|
|
16
16
|
let t;
|
|
17
17
|
try {
|
|
18
|
-
if (t =
|
|
18
|
+
if (t = tn && (self.URL || self.webkitURL).createObjectURL(tn), !t) throw "";
|
|
19
19
|
let n = new Worker(t, {
|
|
20
20
|
type: "module",
|
|
21
21
|
name: e?.name
|
|
@@ -24,27 +24,27 @@ function Yt(e) {
|
|
|
24
24
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
25
25
|
}), n;
|
|
26
26
|
} catch {
|
|
27
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
27
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(en), {
|
|
28
28
|
type: "module",
|
|
29
29
|
name: e?.name
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
var
|
|
34
|
-
function
|
|
33
|
+
var rn = new URL("xlsx_parser_bg.wasm", import.meta.url).href;
|
|
34
|
+
function an(e, t) {
|
|
35
35
|
return !Number.isInteger(t) || t < 0 || t >= e.length ? "visible" : e[t].visibility ?? "visible";
|
|
36
36
|
}
|
|
37
|
-
var
|
|
38
|
-
function
|
|
37
|
+
var on = Symbol("xlsx-render-commit-guard");
|
|
38
|
+
function sn(e, t) {
|
|
39
39
|
return {
|
|
40
40
|
...e,
|
|
41
|
-
[
|
|
41
|
+
[on]: t
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function W(e, t) {
|
|
45
45
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function cn(e, t) {
|
|
48
48
|
if (!e && !t) return null;
|
|
49
49
|
let n = e ? 1 - e.l - e.r : 1, r = (t ? 1 - t.l - t.r : 1) < n ? t : e, i = e ? 1 - e.t - e.b : 1, a = (t ? 1 - t.t - t.b : 1) < i ? t : e;
|
|
50
50
|
return {
|
|
@@ -54,55 +54,55 @@ function tn(e, t) {
|
|
|
54
54
|
b: a?.b ?? 0
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function ln(e, t) {
|
|
58
58
|
return e ? t ? e === t ? e : void 0 : e : t;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function un(e, t) {
|
|
61
61
|
return {
|
|
62
62
|
...e,
|
|
63
|
-
svgImagePath:
|
|
64
|
-
widthPt:
|
|
65
|
-
heightPt:
|
|
66
|
-
srcRect:
|
|
63
|
+
svgImagePath: ln(e.svgImagePath, t.svgImagePath),
|
|
64
|
+
widthPt: W(e.widthPt, t.widthPt),
|
|
65
|
+
heightPt: W(e.heightPt, t.heightPt),
|
|
66
|
+
srcRect: cn(e.srcRect, t.srcRect),
|
|
67
67
|
failClosedOnDuotoneFailure: e.failClosedOnDuotoneFailure || t.failClosedOnDuotoneFailure || void 0,
|
|
68
|
-
targetWidthPx:
|
|
69
|
-
targetHeightPx:
|
|
68
|
+
targetWidthPx: W(e.targetWidthPx, t.targetWidthPx),
|
|
69
|
+
targetHeightPx: W(e.targetHeightPx, t.targetHeightPx)
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function dn(e, t, n) {
|
|
73
73
|
let r = e.get(t);
|
|
74
|
-
e.set(t, r ?
|
|
74
|
+
e.set(t, r ? un(r, n) : n);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let { col: i, row: a } = (n ??
|
|
76
|
+
function G(e, t, n, r) {
|
|
77
|
+
let { col: i, row: a } = (n ?? z(t)).axesAtScale(r), o = Re(t, e, i, a, r);
|
|
78
78
|
return o.width > 0 && o.height > 0 ? {
|
|
79
79
|
width: o.width,
|
|
80
80
|
height: o.height
|
|
81
81
|
} : null;
|
|
82
82
|
}
|
|
83
|
-
var
|
|
83
|
+
var K = {
|
|
84
84
|
x: 0,
|
|
85
85
|
y: 0
|
|
86
86
|
};
|
|
87
|
-
function
|
|
88
|
-
if (!e?.length) return
|
|
89
|
-
let a =
|
|
90
|
-
return a === null ? null : a.x === 0 && a.y === 0 ?
|
|
87
|
+
function fn(e, t, n, r, i) {
|
|
88
|
+
if (!e?.length) return K;
|
|
89
|
+
let a = ie(e, t, n);
|
|
90
|
+
return a === null ? null : a.x === 0 && a.y === 0 ? K : r > 0 && i > 0 ? {
|
|
91
91
|
x: a.x / r,
|
|
92
92
|
y: a.y / i
|
|
93
93
|
} : null;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function pn(e, t) {
|
|
96
96
|
return e === null || t === null ? null : {
|
|
97
97
|
x: Math.max(e.x, t.x),
|
|
98
98
|
y: Math.max(e.y, t.y)
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
if (!n || a === null) return e.anchorTag === void 0 ||
|
|
103
|
-
let o = r ??
|
|
101
|
+
function mn(e, t, n, r, i, a = K) {
|
|
102
|
+
if (!n || a === null) return e.anchorTag === void 0 || G(e, t, r, i?.scale ?? 1) !== null;
|
|
103
|
+
let o = r ?? z(t), s = i?.scale ?? 1, { col: c, row: l } = o.axesAtScale(s), u = Re(t, e, c, l, s);
|
|
104
104
|
if (u.width <= 0 || u.height <= 0) return !1;
|
|
105
|
-
let d = u.width * a.x, f = u.height * a.y, p =
|
|
105
|
+
let d = u.width * a.x, f = u.height * a.y, p = Be({
|
|
106
106
|
x: u.x - d,
|
|
107
107
|
y: u.y - f,
|
|
108
108
|
width: u.width + 2 * d,
|
|
@@ -124,67 +124,67 @@ function un(e, t, n, r, i, a = sn) {
|
|
|
124
124
|
};
|
|
125
125
|
return h(p.x, p.x + p.width, c.offsetOf(m.cols + 1), c.offsetOf(n.col), c.offsetOf(n.col + n.cols)) && h(p.y, p.y + p.height, l.offsetOf(m.rows + 1), l.offsetOf(n.row), l.offsetOf(n.row + n.rows));
|
|
126
126
|
}
|
|
127
|
-
async function
|
|
127
|
+
async function hn(e, t, r, i, a = 0, o = 0, s = null, c = null, l, u = !1, d, f, p, m) {
|
|
128
128
|
let h = t === "image/svg+xml", v = c && "effects" in c ? s && !n(s) ? null : {
|
|
129
129
|
widthPt: a,
|
|
130
130
|
heightPt: o
|
|
131
|
-
} :
|
|
131
|
+
} : _(t, s, a, o);
|
|
132
132
|
if (!v) return null;
|
|
133
|
-
let y = () =>
|
|
133
|
+
let y = () => ne(e, t, c, i, {
|
|
134
134
|
widthPt: v.widthPt,
|
|
135
135
|
heightPt: v.heightPt,
|
|
136
136
|
offscreenFactory: l,
|
|
137
137
|
failClosedOnDuotoneFailure: u,
|
|
138
138
|
tiff: d,
|
|
139
|
-
svgDecoder: p ?? (typeof Image < "u" ?
|
|
139
|
+
svgDecoder: p ?? (typeof Image < "u" ? te : void 0),
|
|
140
140
|
...f ?? {},
|
|
141
141
|
...m ? { maxRetainedPixels: m } : {}
|
|
142
142
|
}), b = {
|
|
143
143
|
svgImagePath: r,
|
|
144
144
|
srcRect: s
|
|
145
145
|
};
|
|
146
|
-
if (!c &&
|
|
147
|
-
return await
|
|
146
|
+
if (!c && j(b)) try {
|
|
147
|
+
return await se(b.svgImagePath, i, {
|
|
148
148
|
...f,
|
|
149
149
|
maxRetainedPixels: m,
|
|
150
150
|
workerDecoder: p
|
|
151
151
|
});
|
|
152
152
|
} catch (t) {
|
|
153
|
-
if (t instanceof
|
|
154
|
-
return h ?
|
|
153
|
+
if (t instanceof g || I(t)) throw t;
|
|
154
|
+
return h ? se(e, i, {
|
|
155
155
|
...f,
|
|
156
156
|
maxRetainedPixels: m,
|
|
157
157
|
workerDecoder: p
|
|
158
158
|
}) : y();
|
|
159
159
|
}
|
|
160
|
-
return h && c ? y() : h ?
|
|
160
|
+
return h && c ? y() : h ? se(e, i, {
|
|
161
161
|
...f,
|
|
162
162
|
maxRetainedPixels: m,
|
|
163
163
|
workerDecoder: p
|
|
164
164
|
}) : y();
|
|
165
165
|
}
|
|
166
|
-
async function
|
|
167
|
-
if (n.clear(),
|
|
168
|
-
let v =
|
|
169
|
-
width:
|
|
170
|
-
height:
|
|
171
|
-
scale:
|
|
172
|
-
freezeRows:
|
|
173
|
-
freezeCols:
|
|
166
|
+
async function gn(e, n, s, _) {
|
|
167
|
+
if (n.clear(), xt(n), !s) return;
|
|
168
|
+
let v = s, y = /* @__PURE__ */ new Map(), b = _?.viewport ? z(e) : void 0, x = _?.viewport && _.width !== void 0 && _.height !== void 0 ? {
|
|
169
|
+
width: _.width,
|
|
170
|
+
height: _.height,
|
|
171
|
+
scale: _.cellScale ?? 1,
|
|
172
|
+
freezeRows: _.freezeRows ?? e.freezeRows ?? 0,
|
|
173
|
+
freezeCols: _.freezeCols ?? e.freezeCols ?? 0
|
|
174
174
|
} : void 0;
|
|
175
|
-
if (e.images) for (let
|
|
176
|
-
if (!
|
|
177
|
-
let
|
|
178
|
-
|
|
179
|
-
imagePath:
|
|
180
|
-
mimeType:
|
|
181
|
-
svgImagePath:
|
|
182
|
-
widthPt:
|
|
183
|
-
heightPt:
|
|
184
|
-
srcRect:
|
|
185
|
-
duotone:
|
|
175
|
+
if (e.images) for (let t of e.images) {
|
|
176
|
+
if (!mn(t, e, _?.viewport, b, x, ((e) => fn(t.blipEffects, e.cx, e.cy, e.cx, e.cy))(yt(t)))) continue;
|
|
177
|
+
let n = G(t, e, b, _?.cellScale ?? 1), i = yt(t), s = ot(t, i), c = t.blipEffects?.length ? lt(i) : null;
|
|
178
|
+
dn(y, at(t.imagePath, s, i), {
|
|
179
|
+
imagePath: t.imagePath,
|
|
180
|
+
mimeType: t.mimeType,
|
|
181
|
+
svgImagePath: t.svgImagePath,
|
|
182
|
+
widthPt: c ? c.widthPt : t.anchorTag === void 0 ? t.nativeExtCx > 0 ? t.nativeExtCx / a : 0 : (n?.width ?? 0) * (r / a),
|
|
183
|
+
heightPt: c ? c.heightPt : t.anchorTag === void 0 ? t.nativeExtCy > 0 ? t.nativeExtCy / a : 0 : (n?.height ?? 0) * (r / a),
|
|
184
|
+
srcRect: t.srcRect ?? null,
|
|
185
|
+
duotone: s,
|
|
186
186
|
...(() => {
|
|
187
|
-
let e =
|
|
187
|
+
let e = n && _?.effectiveDpr ? o(n.width * _.effectiveDpr, n.height * _.effectiveDpr, t.srcRect) : null;
|
|
188
188
|
return e ? {
|
|
189
189
|
targetWidthPx: e.width,
|
|
190
190
|
targetHeightPx: e.height
|
|
@@ -193,19 +193,19 @@ async function fn(e, n, i, g) {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
if (e.shapeGroups) {
|
|
196
|
-
for (let
|
|
197
|
-
for (let
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
imagePath:
|
|
201
|
-
mimeType:
|
|
202
|
-
svgImagePath:
|
|
203
|
-
widthPt:
|
|
204
|
-
heightPt:
|
|
205
|
-
srcRect:
|
|
206
|
-
duotone:
|
|
196
|
+
for (let t of e.shapeGroups) if (mn(t, e, _?.viewport, b, x, t.shapes.reduce((e, n) => n.geom?.type === "image" ? pn(e, fn(n.geom.blipEffects, t.nativeExtCx * n.w, t.nativeExtCy * n.h, t.nativeExtCx, t.nativeExtCy)) : e, K))) {
|
|
197
|
+
for (let n of t.shapes) if (n.geom.type === "image") {
|
|
198
|
+
let i = G(t, e, b, _?.cellScale ?? 1), s = it(t, n), c = ot(n.geom, s), l = n.geom.blipEffects?.length ? lt(s) : null;
|
|
199
|
+
dn(y, at(n.geom.imagePath, c, s), {
|
|
200
|
+
imagePath: n.geom.imagePath,
|
|
201
|
+
mimeType: n.geom.mimeType,
|
|
202
|
+
svgImagePath: n.geom.svgImagePath,
|
|
203
|
+
widthPt: l ? l.widthPt : t.anchorTag === void 0 ? t.nativeExtCx > 0 ? t.nativeExtCx * n.w / a : 0 : (i?.width ?? 0) * n.w * (r / a),
|
|
204
|
+
heightPt: l ? l.heightPt : t.anchorTag === void 0 ? t.nativeExtCy > 0 ? t.nativeExtCy * n.h / a : 0 : (i?.height ?? 0) * n.h * (r / a),
|
|
205
|
+
srcRect: n.geom.srcRect ?? null,
|
|
206
|
+
duotone: c,
|
|
207
207
|
...(() => {
|
|
208
|
-
let e =
|
|
208
|
+
let e = i && _?.effectiveDpr ? o(i.width * n.w * _.effectiveDpr, i.height * n.h * _.effectiveDpr, n.geom.srcRect) : null;
|
|
209
209
|
return e ? {
|
|
210
210
|
targetWidthPx: e.width,
|
|
211
211
|
targetHeightPx: e.height
|
|
@@ -215,41 +215,41 @@ async function fn(e, n, i, g) {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
let S = e.charts ?? [], C = S.length > 0 ? b ??
|
|
219
|
-
for (let
|
|
220
|
-
if (!
|
|
221
|
-
let
|
|
222
|
-
if (!
|
|
223
|
-
let i =
|
|
224
|
-
widthPt:
|
|
225
|
-
heightPt:
|
|
226
|
-
targetWidthPx:
|
|
227
|
-
targetHeightPx:
|
|
228
|
-
},
|
|
218
|
+
let S = e.charts ?? [], C = S.length > 0 ? b ?? z(e) : b, w = [];
|
|
219
|
+
for (let t of S) {
|
|
220
|
+
if (!mn(t, e, _?.viewport, C, x)) continue;
|
|
221
|
+
let n = G(t, e, C, _?.cellScale ?? 1);
|
|
222
|
+
if (!n || !Number.isFinite(n.width) || !Number.isFinite(n.height) || n.width <= 0 || n.height <= 0) continue;
|
|
223
|
+
let i = f(t.chart), o = {
|
|
224
|
+
widthPt: n.width * (r / a),
|
|
225
|
+
heightPt: n.height * (r / a),
|
|
226
|
+
targetWidthPx: _?.effectiveDpr === void 0 ? void 0 : n.width * _.effectiveDpr,
|
|
227
|
+
targetHeightPx: _?.effectiveDpr === void 0 ? void 0 : n.height * _.effectiveDpr
|
|
228
|
+
}, s = [], c = !0;
|
|
229
229
|
for (let e of i) {
|
|
230
|
-
let t =
|
|
230
|
+
let t = u(e, o);
|
|
231
231
|
if (!t) {
|
|
232
232
|
c = !1;
|
|
233
233
|
break;
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
s.push({
|
|
236
236
|
usage: e,
|
|
237
237
|
size: t
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
c && w.push({
|
|
241
|
-
chart:
|
|
242
|
-
frame:
|
|
243
|
-
usages:
|
|
244
|
-
displayWidth:
|
|
245
|
-
displayHeight:
|
|
241
|
+
chart: t,
|
|
242
|
+
frame: o,
|
|
243
|
+
usages: s,
|
|
244
|
+
displayWidth: n.width,
|
|
245
|
+
displayHeight: n.height
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
|
-
let T =
|
|
248
|
+
let T = d(w.map(({ chart: e }) => e.chart), (e, t) => u(e, w[t].frame) != null), E = /* @__PURE__ */ new Map();
|
|
249
249
|
for (let e of T) {
|
|
250
250
|
let { fill: t } = e;
|
|
251
|
-
if (
|
|
252
|
-
let n =
|
|
251
|
+
if (p(t)) continue;
|
|
252
|
+
let n = m(t);
|
|
253
253
|
E.set(n, {
|
|
254
254
|
fill: t,
|
|
255
255
|
widthPt: 0,
|
|
@@ -258,32 +258,32 @@ async function fn(e, n, i, g) {
|
|
|
258
258
|
hasSourceCrop: e.hasSourceCrop
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
-
let D = new Set(T.map(({ fill: e }) =>
|
|
262
|
-
let t = [], n =
|
|
263
|
-
for (let r of w) for (let { fill:
|
|
261
|
+
let D = new Set(T.map(({ fill: e }) => c(e))), O = (e) => {
|
|
262
|
+
let t = [], n = _?.cellScale ?? 1;
|
|
263
|
+
for (let r of w) for (let { fill: a, occurrence: o } of me(r.chart.chart, {
|
|
264
264
|
x: 0,
|
|
265
265
|
y: 0,
|
|
266
266
|
w: r.displayWidth / n,
|
|
267
267
|
h: r.displayHeight / n
|
|
268
|
-
},
|
|
269
|
-
if (!D.has(a
|
|
270
|
-
let e =
|
|
268
|
+
}, i, 0, _?.threeD, _?.regionMap, _?.chartEx, e)) {
|
|
269
|
+
if (!D.has(c(a))) continue;
|
|
270
|
+
let e = m(a, void 0, o);
|
|
271
271
|
E.has(e) || (E.set(e, {
|
|
272
|
-
fill:
|
|
272
|
+
fill: a,
|
|
273
273
|
widthPt: o.widthPt,
|
|
274
274
|
heightPt: o.heightPt,
|
|
275
275
|
preserveNaturalSize: !0,
|
|
276
|
-
hasSourceCrop:
|
|
276
|
+
hasSourceCrop: a.srcRect != null,
|
|
277
277
|
renderedSize: o
|
|
278
278
|
}), t.push(e));
|
|
279
279
|
}
|
|
280
|
-
return
|
|
280
|
+
return he(E.size), t;
|
|
281
281
|
};
|
|
282
282
|
O();
|
|
283
283
|
for (let e of w) for (let { usage: t, size: n } of e.usages) {
|
|
284
284
|
let { fill: e } = t;
|
|
285
|
-
if (
|
|
286
|
-
let r =
|
|
285
|
+
if (p(e)) continue;
|
|
286
|
+
let r = m(e), i = E.get(r);
|
|
287
287
|
if (!i) continue;
|
|
288
288
|
let a = i.preserveNaturalSize || t.preserveNaturalSize;
|
|
289
289
|
E.set(r, {
|
|
@@ -297,45 +297,45 @@ async function fn(e, n, i, g) {
|
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
299
|
let k = (e, t) => {
|
|
300
|
-
let { fill: n, widthPt: r, heightPt: i, targetWidthPx: a, targetHeightPx:
|
|
301
|
-
|
|
300
|
+
let { fill: n, widthPt: r, heightPt: i, targetWidthPx: a, targetHeightPx: o, hasSourceCrop: s, renderedSize: c } = t;
|
|
301
|
+
dn(y, e, {
|
|
302
302
|
imagePath: n.imagePath,
|
|
303
303
|
mimeType: n.mimeType,
|
|
304
304
|
svgImagePath: n.svgImagePath,
|
|
305
|
-
widthPt:
|
|
306
|
-
heightPt:
|
|
307
|
-
srcRect:
|
|
305
|
+
widthPt: c ? c.widthPt : n.blipEffects?.length ? 0 : r,
|
|
306
|
+
heightPt: c ? c.heightPt : n.blipEffects?.length ? 0 : i,
|
|
307
|
+
srcRect: s ? {
|
|
308
308
|
l: 0,
|
|
309
309
|
t: 0,
|
|
310
310
|
r: 0,
|
|
311
311
|
b: 0
|
|
312
312
|
} : null,
|
|
313
|
-
duotone:
|
|
313
|
+
duotone: l(n, void 0, c),
|
|
314
314
|
failClosedOnDuotoneFailure: !0,
|
|
315
|
-
...a &&
|
|
315
|
+
...a && o && !n.blipEffects?.length ? {
|
|
316
316
|
targetWidthPx: a,
|
|
317
|
-
targetHeightPx:
|
|
317
|
+
targetHeightPx: o
|
|
318
318
|
} : {}
|
|
319
319
|
});
|
|
320
320
|
};
|
|
321
321
|
for (let [e, t] of E) k(e, t);
|
|
322
322
|
if (y.size === 0) return;
|
|
323
|
-
let A =
|
|
324
|
-
if (!t.targetWidthPx || !t.targetHeightPx || t.mimeType === "image/svg+xml" || t.duotone || !t.duotone &&
|
|
323
|
+
let A = ce(_?.imageResources), te = ee((await Promise.all([...y].map(async ([e, t]) => {
|
|
324
|
+
if (!t.targetWidthPx || !t.targetHeightPx || t.mimeType === "image/svg+xml" || t.duotone || !t.duotone && j({
|
|
325
325
|
svgImagePath: t.svgImagePath,
|
|
326
326
|
srcRect: t.srcRect
|
|
327
327
|
})) return null;
|
|
328
|
-
if (
|
|
328
|
+
if (de(t.mimeType) && (A.resolution === "display" || A.strategy === "adaptive")) return {
|
|
329
329
|
key: e,
|
|
330
330
|
targetWidthPx: t.targetWidthPx,
|
|
331
331
|
targetHeightPx: t.targetHeightPx,
|
|
332
332
|
retainedSurfaceCount: 1
|
|
333
333
|
};
|
|
334
|
-
let n = await
|
|
335
|
-
if (e instanceof
|
|
334
|
+
let n = await N(t.imagePath, t.mimeType, v).catch((e) => {
|
|
335
|
+
if (e instanceof g || I(e)) throw e;
|
|
336
336
|
return null;
|
|
337
337
|
});
|
|
338
|
-
return !n?.dimensions || !
|
|
338
|
+
return !n?.dimensions || !fe(n.format, _?.tiff !== void 0) ? null : {
|
|
339
339
|
key: e,
|
|
340
340
|
targetWidthPx: t.targetWidthPx,
|
|
341
341
|
targetHeightPx: t.targetHeightPx,
|
|
@@ -345,63 +345,63 @@ async function fn(e, n, i, g) {
|
|
|
345
345
|
};
|
|
346
346
|
}))).filter((e) => e !== null), A);
|
|
347
347
|
for (let [e, t] of y) {
|
|
348
|
-
if (t.mimeType === "image/svg+xml" || !t.duotone &&
|
|
348
|
+
if (t.mimeType === "image/svg+xml" || !t.duotone && j({
|
|
349
349
|
svgImagePath: t.svgImagePath,
|
|
350
350
|
srcRect: t.srcRect
|
|
351
351
|
})) continue;
|
|
352
352
|
let n = te.targets.get(e);
|
|
353
353
|
t.targetWidthPx = n?.width, t.targetHeightPx = n?.height, t.plannedPixelLimit = n?.maxRetainedPixels;
|
|
354
354
|
}
|
|
355
|
-
let
|
|
355
|
+
let M = async ([e, r]) => {
|
|
356
356
|
try {
|
|
357
|
-
let
|
|
358
|
-
targetWidthPx:
|
|
359
|
-
targetHeightPx:
|
|
360
|
-
} : void 0,
|
|
361
|
-
n.set(e,
|
|
362
|
-
} catch (
|
|
363
|
-
if (
|
|
364
|
-
n.set(e, null),
|
|
357
|
+
let t = await hn(r.imagePath, r.mimeType, r.svgImagePath, v, r.widthPt, r.heightPt, r.srcRect, r.duotone, _?.offscreenFactory, r.failClosedOnDuotoneFailure ?? !1, _?.tiff, r.targetWidthPx && r.targetHeightPx ? {
|
|
358
|
+
targetWidthPx: r.targetWidthPx,
|
|
359
|
+
targetHeightPx: r.targetHeightPx
|
|
360
|
+
} : void 0, _?.svgDecoder, r.plannedPixelLimit);
|
|
361
|
+
n.set(e, t);
|
|
362
|
+
} catch (r) {
|
|
363
|
+
if (pe(r, "tiff") || ge(r)) {
|
|
364
|
+
n.set(e, null), $e(n, e, "tiff");
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
|
-
if (
|
|
367
|
+
if (r instanceof g || I(r) || r instanceof t && r.code === "unsupported-image-effect") throw r;
|
|
368
368
|
n.delete(e);
|
|
369
369
|
}
|
|
370
370
|
};
|
|
371
|
-
for (await Promise.all([...y.entries()].map(
|
|
372
|
-
let e = O(
|
|
371
|
+
for (await Promise.all([...y.entries()].map(M));;) {
|
|
372
|
+
let e = O(h(n, void 0, !1));
|
|
373
373
|
if (e.length === 0) break;
|
|
374
374
|
for (let t of e) k(t, E.get(t));
|
|
375
|
-
await Promise.all(e.map((e) =>
|
|
375
|
+
await Promise.all(e.map((e) => M([e, y.get(e)])));
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
var
|
|
379
|
-
function
|
|
380
|
-
if (
|
|
381
|
-
let i =
|
|
382
|
-
if (a && a.sourceGeometry === i &&
|
|
378
|
+
var _n = /* @__PURE__ */ new WeakMap();
|
|
379
|
+
function vn(e, t, n, r) {
|
|
380
|
+
if (ft(t)) return t;
|
|
381
|
+
let i = z(t), a = _n.get(t);
|
|
382
|
+
if (a && a.sourceGeometry === i && Et(a.projection) === Et(t)) return a.projection;
|
|
383
383
|
let o = {
|
|
384
384
|
...t,
|
|
385
385
|
rowHeights: { ...t.rowHeights }
|
|
386
386
|
};
|
|
387
|
-
|
|
387
|
+
Zt(t, o), gt(t, o);
|
|
388
388
|
let s = i.maximumDigitWidth;
|
|
389
|
-
return
|
|
389
|
+
return U.forWorksheet(o, s), vt(e, o, n, r), U.forWorksheet(o, s), _n.set(t, {
|
|
390
390
|
projection: o,
|
|
391
391
|
sourceGeometry: i
|
|
392
392
|
}), o;
|
|
393
393
|
}
|
|
394
|
-
async function
|
|
395
|
-
let a = () =>
|
|
396
|
-
return r.fetchImage && o ?
|
|
394
|
+
async function yn(e, t, n, r = {}, i) {
|
|
395
|
+
let a = () => bn(e, t, n, r, i), o = !e.ws.isDialogSheet && ((e.ws.images?.length ?? 0) > 0 || (e.ws.shapeGroups?.some((e) => e.shapes.some((e) => e.geom.type === "image")) ?? !1) || d((e.ws.charts ?? []).map((e) => e.chart)).length > 0);
|
|
396
|
+
return r.fetchImage && o ? le(r.fetchImage, r.imageResources, a) : a();
|
|
397
397
|
}
|
|
398
|
-
async function
|
|
399
|
-
if (r[
|
|
400
|
-
let
|
|
401
|
-
if (!
|
|
402
|
-
|
|
403
|
-
let c = e.ws.isDialogSheet ? e.ws :
|
|
404
|
-
if (c.isDialogSheet || await
|
|
398
|
+
async function bn(e, t, n, r = {}, i) {
|
|
399
|
+
if (r[on]?.() === !1) return;
|
|
400
|
+
let a = e.styles, o = t.getContext("2d");
|
|
401
|
+
if (!o) throw Error("XLSX render target does not provide a 2-D canvas context");
|
|
402
|
+
mt(o, e.ws, r.officeFontRoutes, r.googleSubstitutes === !0), st(e.ws, r.authoritativeMdw);
|
|
403
|
+
let c = e.ws.isDialogSheet ? e.ws : vn(o, e.ws, a, e.cjkFallback), l = b(t) ? t.clientWidth || 800 : t.width, u = b(t) ? t.clientHeight || 600 : t.height, d = r.width ?? l, f = r.height ?? u, p = r.dpr ?? D(), m = s(d * p, f * p), h = m.clamped ? p * m.scale : p, g = /* @__PURE__ */ new Map();
|
|
404
|
+
if (c.isDialogSheet || await gn(c, g, r.fetchImage, {
|
|
405
405
|
viewport: n,
|
|
406
406
|
width: d,
|
|
407
407
|
height: f,
|
|
@@ -410,27 +410,27 @@ async function gn(e, t, n, r = {}, a) {
|
|
|
410
410
|
freezeCols: r.freezeCols,
|
|
411
411
|
tiff: e.tiff,
|
|
412
412
|
effectiveDpr: h,
|
|
413
|
-
svgDecoder:
|
|
413
|
+
svgDecoder: i,
|
|
414
414
|
imageResources: r.imageResources,
|
|
415
415
|
threeD: e.threeD,
|
|
416
416
|
regionMap: e.regionMap,
|
|
417
417
|
chartEx: e.chartEx
|
|
418
|
-
}), !c.isDialogSheet && e.math &&
|
|
418
|
+
}), !c.isDialogSheet && e.math && St(c) && await rt(c, e.math), r[on]?.() === !1) return;
|
|
419
419
|
let _ = m.width, v = m.height;
|
|
420
|
-
if (t.width !== _ && (t.width = _), t.height !== v && (t.height = v),
|
|
420
|
+
if (t.width !== _ && (t.width = _), t.height !== v && (t.height = v), b(t)) {
|
|
421
421
|
let e = `${d}px`, n = `${f}px`;
|
|
422
422
|
t.style.width !== e && (t.style.width = e), t.style.height !== n && (t.style.height = n);
|
|
423
423
|
}
|
|
424
424
|
let y = t.getContext("2d");
|
|
425
425
|
if (y.setTransform(h, 0, 0, h, 0, 0), c.parseError) {
|
|
426
|
-
|
|
426
|
+
Sn(y, d, f, c.name, c.parseError);
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
429
|
if (c.isDialogSheet) {
|
|
430
|
-
|
|
430
|
+
xn(y, d, f);
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
bt(y, c, a, n, {
|
|
434
434
|
...r,
|
|
435
435
|
dpr: h,
|
|
436
436
|
loadedImages: g,
|
|
@@ -439,12 +439,12 @@ async function gn(e, t, n, r = {}, a) {
|
|
|
439
439
|
chartEx: e.chartEx
|
|
440
440
|
}, e.cjkFallback);
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function xn(e, t, n) {
|
|
443
443
|
e.save(), e.fillStyle = "#f7f7f8", e.fillRect(0, 0, t, n);
|
|
444
444
|
let r = Math.min(t, n);
|
|
445
445
|
e.fillStyle = "#555555", e.textAlign = "center", e.textBaseline = "middle", e.font = `${Math.max(13, r * .035)}px sans-serif`, e.fillText("Legacy dialog sheets are not displayed", t / 2, n / 2), e.restore();
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function Sn(e, t, n, r, i) {
|
|
448
448
|
e.save(), e.fillStyle = "#f7f7f8", e.fillRect(0, 0, t, n);
|
|
449
449
|
let a = t / 2, o = Math.min(t, n), s = Math.max(20, o * .1);
|
|
450
450
|
e.fillStyle = "#b23b3b", e.textAlign = "center", e.textBaseline = "middle", e.font = `${s}px sans-serif`, e.fillText("⚠", a, n * .32);
|
|
@@ -462,7 +462,7 @@ function vn(e, t, n, r, i) {
|
|
|
462
462
|
for (let t of f.slice(0, 4)) e.fillText(t, a, h), h += m;
|
|
463
463
|
e.restore();
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function Cn(e) {
|
|
466
466
|
let t = (e ?? "").trim();
|
|
467
467
|
if (!t) return {
|
|
468
468
|
kind: "unresolved",
|
|
@@ -477,9 +477,9 @@ function yn(e) {
|
|
|
477
477
|
let e = t.slice(0, i);
|
|
478
478
|
e.startsWith("'") && e.endsWith("'") && e.length >= 2 && (e = e.slice(1, -1).replace(/''/g, "'")), n = e, r = t.slice(i + 1);
|
|
479
479
|
}
|
|
480
|
-
let [a, o] = r.split(":"), s =
|
|
480
|
+
let [a, o] = r.split(":"), s = L(a ?? "");
|
|
481
481
|
if (s) {
|
|
482
|
-
let e = o ?
|
|
482
|
+
let e = o ? L(o) : s;
|
|
483
483
|
if (e) {
|
|
484
484
|
let t = {
|
|
485
485
|
row: Math.min(s.row, e.row),
|
|
@@ -501,7 +501,7 @@ function yn(e) {
|
|
|
501
501
|
formula: t
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function wn(e, t) {
|
|
505
505
|
if (e.kind === "inline") return {
|
|
506
506
|
kind: "values",
|
|
507
507
|
values: e.values
|
|
@@ -520,7 +520,7 @@ function bn(e, t) {
|
|
|
520
520
|
values: n
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function Tn(e) {
|
|
524
524
|
let { cell: t, panel: n, viewport: r, rtl: i } = e, a = t.y + t.h + 2, o = t.y - 2 - n.h, s;
|
|
525
525
|
s = a + n.h <= r.h ? a : o >= 0 ? o : a, s = Math.max(0, Math.min(s, r.h - n.h));
|
|
526
526
|
let c = i ? t.x + t.w - n.w : t.x;
|
|
@@ -529,7 +529,7 @@ function xn(e) {
|
|
|
529
529
|
top: s
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function En(e, t) {
|
|
533
533
|
let n = !1;
|
|
534
534
|
for (let [r, i] of Object.entries(t)) {
|
|
535
535
|
let t = Number(r);
|
|
@@ -537,43 +537,43 @@ function Sn(e, t) {
|
|
|
537
537
|
}
|
|
538
538
|
return n;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function Dn(e, t) {
|
|
541
541
|
if (!t) return;
|
|
542
542
|
let n = !1;
|
|
543
|
-
if (t.rowHeightRanges && (
|
|
544
|
-
n &&
|
|
543
|
+
if (t.rowHeightRanges && ($t(e, t.rowHeightRanges), n = !0), t.rows && (n = En(e.rowHeights, t.rows) || n), t.cols && (n = En(e.colWidths, t.cols) || n), t.columnCssWidths) for (let [r, i] of Object.entries(t.columnCssWidths)) B(e, Number(r), i) && (n = !0);
|
|
544
|
+
n && U.invalidate(e);
|
|
545
545
|
}
|
|
546
|
-
function
|
|
547
|
-
return t ?
|
|
546
|
+
function On(e, t) {
|
|
547
|
+
return t ? kn(e, t) : e;
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function kn(e, t) {
|
|
550
550
|
let n = { ...e };
|
|
551
|
-
return t && (n.rowHeights = { ...e.rowHeights }, n.colWidths = { ...e.colWidths }),
|
|
551
|
+
return t && (n.rowHeights = { ...e.rowHeights }, n.colWidths = { ...e.colWidths }), nt(e, n), Ht(e, n), Zt(e, n), Dn(n, t), n;
|
|
552
552
|
}
|
|
553
|
-
var
|
|
554
|
-
function
|
|
553
|
+
var An = Symbol("xlsx-viewer-render-context");
|
|
554
|
+
function jn(e, t, n) {
|
|
555
555
|
if (!Number.isFinite(t) || t <= 0) throw Error("XLSX maximum digit width must be a finite positive number");
|
|
556
556
|
return {
|
|
557
557
|
...e,
|
|
558
|
-
[
|
|
558
|
+
[An]: {
|
|
559
559
|
maximumDigitWidth: t,
|
|
560
560
|
worksheet: n?.worksheet,
|
|
561
561
|
projection: n?.projection
|
|
562
562
|
}
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
let t = e[
|
|
567
|
-
return delete n[
|
|
565
|
+
function Mn(e) {
|
|
566
|
+
let t = e[An], n = { ...e };
|
|
567
|
+
return delete n[An], t ? {
|
|
568
568
|
opts: n,
|
|
569
569
|
layoutMetrics: { maximumDigitWidth: t.maximumDigitWidth },
|
|
570
570
|
worksheet: t.worksheet,
|
|
571
571
|
projection: t.projection
|
|
572
572
|
} : { opts: n };
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
function
|
|
576
|
-
if (e >
|
|
574
|
+
var Nn = "load-delimited-text", q = Lt;
|
|
575
|
+
function Pn(e) {
|
|
576
|
+
if (e > q) throw Nt(Nn, void 0, "delimited-text-source", "bytes", q, e);
|
|
577
577
|
}
|
|
578
578
|
Object.freeze({
|
|
579
579
|
fonts: [Object.freeze({
|
|
@@ -608,7 +608,7 @@ Object.freeze({
|
|
|
608
608
|
numFmts: [],
|
|
609
609
|
dxfs: []
|
|
610
610
|
});
|
|
611
|
-
function
|
|
611
|
+
function Fn(e) {
|
|
612
612
|
if (!e || e.format !== "csv" && e.format !== "tsv" && e.format !== "delimited-text") throw TypeError("format must be 'csv', 'tsv', or 'delimited-text'");
|
|
613
613
|
let t = e.delimiter ?? (e.format === "tsv" ? " " : e.format === "csv" ? "," : void 0);
|
|
614
614
|
if (t === void 0) throw TypeError("delimiter is required for format 'delimited-text'");
|
|
@@ -624,11 +624,11 @@ function jn(e) {
|
|
|
624
624
|
sheetName: r
|
|
625
625
|
});
|
|
626
626
|
}
|
|
627
|
-
async function
|
|
627
|
+
async function In(e) {
|
|
628
628
|
let t = e.headers.get("content-encoding")?.trim().toLowerCase(), n = e.headers.get("content-length");
|
|
629
629
|
if ((!t || t === "identity") && n !== null && /^\d+$/.test(n.trim())) {
|
|
630
630
|
let t = Number(n);
|
|
631
|
-
t >
|
|
631
|
+
t > q && (await e.body?.cancel().catch(() => void 0), Pn(t));
|
|
632
632
|
}
|
|
633
633
|
let r = e.body;
|
|
634
634
|
if (!r) return /* @__PURE__ */ new ArrayBuffer(0);
|
|
@@ -637,7 +637,7 @@ async function Mn(e) {
|
|
|
637
637
|
for (;;) {
|
|
638
638
|
let { done: e, value: t } = await i.read();
|
|
639
639
|
if (e) break;
|
|
640
|
-
!t || t.byteLength === 0 || (t.byteLength >
|
|
640
|
+
!t || t.byteLength === 0 || (t.byteLength > q - o && (await i.cancel().catch(() => void 0), Pn(q + 1)), a.push(t), o += t.byteLength);
|
|
641
641
|
}
|
|
642
642
|
} finally {
|
|
643
643
|
i.releaseLock();
|
|
@@ -646,7 +646,7 @@ async function Mn(e) {
|
|
|
646
646
|
for (let e of a) s.set(e, c), c += e.byteLength;
|
|
647
647
|
return s.buffer;
|
|
648
648
|
}
|
|
649
|
-
var
|
|
649
|
+
var Ln = class {
|
|
650
650
|
rows;
|
|
651
651
|
ready;
|
|
652
652
|
resolveReady;
|
|
@@ -695,19 +695,19 @@ var Nn = class {
|
|
|
695
695
|
this.waiters = [];
|
|
696
696
|
for (let t of e) this.complete || this.coveredThrough >= t.row ? t.resolve() : this.waiters.push(t);
|
|
697
697
|
}
|
|
698
|
-
},
|
|
698
|
+
}, Rn = /* @__PURE__ */ new WeakMap(), zn = Object.freeze({
|
|
699
699
|
minRows: 50,
|
|
700
700
|
minCols: 26
|
|
701
701
|
});
|
|
702
|
-
function
|
|
703
|
-
|
|
702
|
+
function Bn(e, t) {
|
|
703
|
+
Rn.set(e, t);
|
|
704
704
|
}
|
|
705
|
-
function
|
|
706
|
-
let n =
|
|
707
|
-
n &&
|
|
705
|
+
function Vn(e, t) {
|
|
706
|
+
let n = Rn.get(e);
|
|
707
|
+
n && Rn.set(t, n);
|
|
708
708
|
}
|
|
709
|
-
function
|
|
710
|
-
let n =
|
|
709
|
+
function Hn(e, t = {}) {
|
|
710
|
+
let n = Rn.get(e), r = Math.max(t.minRows ?? zn.minRows, e.freezeRows ?? 0, n?.maxRow ?? 0), i = Math.max(t.minCols ?? zn.minCols, e.freezeCols ?? 0, n?.maxCol ?? 0);
|
|
711
711
|
for (let t of e.rows) {
|
|
712
712
|
t.index > r && (r = t.index);
|
|
713
713
|
for (let e of t.cells) e.col > i && (i = e.col);
|
|
@@ -723,15 +723,15 @@ function Rn(e, t = {}) {
|
|
|
723
723
|
r = Math.max(r, t, n), i = Math.max(i, a, o);
|
|
724
724
|
}
|
|
725
725
|
return {
|
|
726
|
-
maxRow: Math.min(
|
|
727
|
-
maxCol: Math.min(
|
|
726
|
+
maxRow: Math.min(H, r),
|
|
727
|
+
maxCol: Math.min(V, i)
|
|
728
728
|
};
|
|
729
729
|
}
|
|
730
|
-
var
|
|
730
|
+
var Un = Symbol("retain-xlsx-viewer-fonts"), Wn = Symbol("prepare-xlsx-viewer-row-heights"), Gn = Symbol("release-xlsx-viewer-projection"), Kn = Symbol("load-xlsx-sheet-source"), qn = Symbol("xlsx-cell-display-texts"), Jn = class e {
|
|
731
731
|
metrics = null;
|
|
732
732
|
bridge = null;
|
|
733
733
|
delimitedTextBacked = !1;
|
|
734
|
-
japaneseCellFonts =
|
|
734
|
+
japaneseCellFonts = We();
|
|
735
735
|
parsedWorkbook = null;
|
|
736
736
|
sheetCache = /* @__PURE__ */ new Map();
|
|
737
737
|
sheetCacheUsage = /* @__PURE__ */ new Map();
|
|
@@ -739,13 +739,13 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
739
739
|
evictingSheets = /* @__PURE__ */ new Map();
|
|
740
740
|
sheetLoads = /* @__PURE__ */ new Map();
|
|
741
741
|
sheetPreviews = /* @__PURE__ */ new Map();
|
|
742
|
-
rawParts = new
|
|
742
|
+
rawParts = new oe({
|
|
743
743
|
maxEntries: 64,
|
|
744
|
-
maxBytes:
|
|
744
|
+
maxBytes: F
|
|
745
745
|
});
|
|
746
746
|
queuedImageLoads = /* @__PURE__ */ new Map();
|
|
747
747
|
_fetchImage = (e, t) => this.getImageWithinArchiveOperation(e, t);
|
|
748
|
-
worksheetPolicy =
|
|
748
|
+
worksheetPolicy = Ut;
|
|
749
749
|
cjkFallback = "jp";
|
|
750
750
|
math;
|
|
751
751
|
threeD;
|
|
@@ -770,14 +770,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
770
770
|
};
|
|
771
771
|
resourceFailure = null;
|
|
772
772
|
constructor(e, t, n, r = !0) {
|
|
773
|
-
if (this._mode = t, e && (this.bridge = new
|
|
773
|
+
if (this._mode = t, e && (this.bridge = new be(e, {
|
|
774
774
|
correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
|
|
775
|
-
toError: (e) => "type" in e && e.type === "error" ?
|
|
775
|
+
toError: (e) => "type" in e && e.type === "error" ? k(e) : void 0,
|
|
776
776
|
onUnsolicited: (t) => {
|
|
777
|
-
|
|
777
|
+
Fe((t, n) => e.postMessage(t, n), t);
|
|
778
778
|
}
|
|
779
779
|
}), r)) {
|
|
780
|
-
let e = new URL(n ??
|
|
780
|
+
let e = new URL(n ?? rn, location.href).href;
|
|
781
781
|
this.bridge.post({
|
|
782
782
|
type: "init",
|
|
783
783
|
wasmUrl: e
|
|
@@ -787,21 +787,21 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
787
787
|
get mode() {
|
|
788
788
|
return this._mode;
|
|
789
789
|
}
|
|
790
|
-
static async [
|
|
790
|
+
static async [Kn](e, t, n = {}) {
|
|
791
791
|
if (n.format === void 0 || n.format === "xlsx") return await this.load(e, t);
|
|
792
792
|
if (n.format === "csv" || n.format === "tsv" || n.format === "delimited-text") return await this.loadDelimitedText(e, t, n);
|
|
793
793
|
throw TypeError("Unsupported XlsxSheetViewer source format");
|
|
794
794
|
}
|
|
795
795
|
static async loadDelimitedText(t, n, r) {
|
|
796
|
-
let i =
|
|
796
|
+
let i = Ot(n);
|
|
797
797
|
n = {
|
|
798
798
|
...n,
|
|
799
799
|
xlsxWorksheetLimits: i.worksheet
|
|
800
800
|
}, n = {
|
|
801
801
|
...n,
|
|
802
|
-
cjkFallback:
|
|
802
|
+
cjkFallback: A(n.cjkFallback)
|
|
803
803
|
};
|
|
804
|
-
let a =
|
|
804
|
+
let a = Fn(r), o = w(n), s = n.mode ?? "main", c = new E({
|
|
805
805
|
enabled: !0,
|
|
806
806
|
format: "xlsx",
|
|
807
807
|
mode: s,
|
|
@@ -816,32 +816,32 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
816
816
|
if (typeof t == "string") {
|
|
817
817
|
let e = await fetch(t);
|
|
818
818
|
if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
|
|
819
|
-
i = await
|
|
819
|
+
i = await In(e);
|
|
820
820
|
} else i = t;
|
|
821
|
-
|
|
822
|
-
let o = s === "worker" ? (await import("./render-worker-host-
|
|
821
|
+
Pn(i.byteLength), c.setSourceBytes(i.byteLength), c.checkpoint("source ready");
|
|
822
|
+
let o = s === "worker" ? (await import("./render-worker-host-pKls3F_t.js")).createRenderWorker() : (await import("./delimited-text-worker-host-RwvuSsP2.js")).createDelimitedTextWorker(), l;
|
|
823
823
|
try {
|
|
824
824
|
let t = new e(o, s, void 0, !1);
|
|
825
825
|
return l = t, t.metrics = c, await t._loadDelimitedText(r === i ? i.slice(0) : i, n, a), s === "main" && (t.bridge?.terminate(), t.bridge = null), c.checkpoint("worksheet ready"), c.succeed({ sheets: 1 }), t;
|
|
826
826
|
} catch (e) {
|
|
827
827
|
let t = l;
|
|
828
|
-
throw
|
|
828
|
+
throw Se(o, t ? () => t.destroy() : void 0), e;
|
|
829
829
|
}
|
|
830
830
|
} catch (e) {
|
|
831
831
|
throw c.fail(e), e;
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
static async load(t, n = {}) {
|
|
835
|
-
let r =
|
|
835
|
+
let r = Ot(n);
|
|
836
836
|
if (n = {
|
|
837
837
|
...n,
|
|
838
838
|
xlsxWorksheetLimits: r.worksheet
|
|
839
|
-
}, n.legacyXls !== void 0) return (await import("./workbook-model-source-
|
|
839
|
+
}, n.legacyXls !== void 0) return (await import("./workbook-model-source-D1dmkDMP.js")).loadXlsxModelSource(t, n, e);
|
|
840
840
|
n = {
|
|
841
841
|
...n,
|
|
842
|
-
cjkFallback:
|
|
842
|
+
cjkFallback: A(n.cjkFallback)
|
|
843
843
|
};
|
|
844
|
-
let i =
|
|
844
|
+
let i = w(n), a = n.mode ?? "main", o = new E({
|
|
845
845
|
enabled: !0,
|
|
846
846
|
format: "xlsx",
|
|
847
847
|
mode: a,
|
|
@@ -861,26 +861,26 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
861
861
|
s = v(await y(s, n.password));
|
|
862
862
|
let c = s === r;
|
|
863
863
|
o.setSourceBytes(s.byteLength), o.checkpoint("container ready");
|
|
864
|
-
let l = a === "worker" ? (await import("./render-worker-host-
|
|
864
|
+
let l = a === "worker" ? (await import("./render-worker-host-pKls3F_t.js")).createRenderWorker() : new nn(), u;
|
|
865
865
|
try {
|
|
866
866
|
return u = new e(l, a, n.wasmUrl), u.metrics = o, await u._load(s, n, i.policy, (e) => o.observeUsage(e), c), o.checkpoint("workbook index ready"), o.succeed({ sheets: u.sheetCount }), u;
|
|
867
867
|
} catch (e) {
|
|
868
868
|
let t = u;
|
|
869
|
-
throw
|
|
869
|
+
throw Se(l, t ? () => t.destroy() : void 0), e;
|
|
870
870
|
}
|
|
871
871
|
} catch (e) {
|
|
872
872
|
throw o.fail(e), e;
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
|
-
async _load(e, t = {}, n =
|
|
876
|
-
let a =
|
|
875
|
+
async _load(e, t = {}, n = T(t), r, i = !1) {
|
|
876
|
+
let a = Ot(t), o = this.requireBridge();
|
|
877
877
|
this.worksheetPolicy = a, this.resourceFailure = null, this.retainedSheetUsage = {
|
|
878
878
|
rows: 0,
|
|
879
879
|
cells: 0,
|
|
880
880
|
ownedUtf8Bytes: 0,
|
|
881
881
|
jsonBytes: 0
|
|
882
|
-
}, this.sheetCache.clear(), this.sheetCacheUsage.clear(), this.sheetLeases.clear(), this.completePendingEvictions(), await this.worksheetPullClient?.cancelAll("closed"), this.worksheetPullClient = null, this.generation = (this.generation ?? 0) + 1, this.workerTimeoutMs = t.workerTimeoutMs, this.googleSubstitutes = t.useGoogleFonts === !0, this.cjkFallback =
|
|
883
|
-
let s = this._mode === "worker" ?
|
|
882
|
+
}, this.sheetCache.clear(), this.sheetCacheUsage.clear(), this.sheetLeases.clear(), this.completePendingEvictions(), await this.worksheetPullClient?.cancelAll("closed"), this.worksheetPullClient = null, this.generation = (this.generation ?? 0) + 1, this.workerTimeoutMs = t.workerTimeoutMs, this.googleSubstitutes = t.useGoogleFonts === !0, this.cjkFallback = A(t.cjkFallback), this.math = this._mode === "worker" ? void 0 : t.math, this.threeD = this._mode === "worker" ? void 0 : t.threeD, this.regionMap = this._mode === "worker" ? void 0 : t.regionMap, this.chartEx = this._mode === "worker" ? void 0 : t.chartEx, this.tiff = this._mode === "worker" ? void 0 : t.tiff;
|
|
883
|
+
let s = this._mode === "worker" ? Tt(t) : void 0;
|
|
884
884
|
t.math && this._mode === "worker" && !s?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), t.threeD && this._mode === "worker" && !s?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), t.regionMap && this._mode === "worker" && !s?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), t.chartEx && this._mode === "worker" && !s?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), t.tiff && this._mode === "worker" && !s?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them.");
|
|
885
885
|
let c = i ? e.slice(0) : e, l = await o.request((e) => this._mode === "worker" ? {
|
|
886
886
|
type: "parse",
|
|
@@ -908,14 +908,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
908
908
|
}
|
|
909
909
|
let u = this.parsedWorkbook;
|
|
910
910
|
if (!u) throw Error("XLSX worker returned no workbook metadata");
|
|
911
|
-
this.cjkFallback =
|
|
911
|
+
this.cjkFallback = Ze(u, this.cjkFallback), this.ensureWorksheetPullClient();
|
|
912
912
|
let d = u.workbook.parseError;
|
|
913
|
-
d && console.warn(`[ooxml] xlsx opened with a degraded part: ${d}`), this.officeFontRequests =
|
|
913
|
+
d && console.warn(`[ooxml] xlsx opened with a degraded part: ${d}`), this.officeFontRequests = ze(u), t.useGoogleFonts && (this.googleFontNames = [...wt(u, this.cjkFallback)]), typeof document < "u" && document.fonts && await this.retainFontsInSet(document.fonts);
|
|
914
914
|
}
|
|
915
915
|
async _loadDelimitedText(e, t, n) {
|
|
916
|
-
let r =
|
|
917
|
-
this.worksheetPolicy = r, this.delimitedTextBacked = !0, this.workerTimeoutMs = t.workerTimeoutMs, this.googleSubstitutes = t.useGoogleFonts === !0, this.cjkFallback =
|
|
918
|
-
let a = this._mode === "worker" ?
|
|
916
|
+
let r = Ot(t), i = this.requireBridge();
|
|
917
|
+
this.worksheetPolicy = r, this.delimitedTextBacked = !0, this.workerTimeoutMs = t.workerTimeoutMs, this.googleSubstitutes = t.useGoogleFonts === !0, this.cjkFallback = A(t.cjkFallback), this.generation++, this.math = this._mode === "worker" ? void 0 : t.math, this.threeD = this._mode === "worker" ? void 0 : t.threeD, this.regionMap = this._mode === "worker" ? void 0 : t.regionMap, this.chartEx = this._mode === "worker" ? void 0 : t.chartEx, this.tiff = this._mode === "worker" ? void 0 : t.tiff;
|
|
918
|
+
let a = this._mode === "worker" ? Tt(t) : void 0, o = await i.request((i) => ({
|
|
919
919
|
type: "parseDelimitedText",
|
|
920
920
|
japaneseCellFonts: this.japaneseCellFonts,
|
|
921
921
|
id: i,
|
|
@@ -926,14 +926,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
926
926
|
cjkFallback: this.cjkFallback,
|
|
927
927
|
renderers: a
|
|
928
928
|
}), [e], { timeoutMs: t.workerTimeoutMs }), s = JSON.parse(new TextDecoder().decode(o.worksheetJson));
|
|
929
|
-
|
|
929
|
+
Mt(s, r), et(s, this.japaneseCellFonts);
|
|
930
930
|
let c = o.workbook.workbook.sheets;
|
|
931
931
|
if (c.length !== 1 || c[0]?.name !== s.name) throw Error("Delimited text worker returned inconsistent worksheet metadata");
|
|
932
|
-
let l =
|
|
933
|
-
if (
|
|
932
|
+
let l = Ft(s, r);
|
|
933
|
+
if (At(l, "load-delimited-text", void 0, void 0, r), Vt(l.jsonBytes, "load-delimited-text", void 0, void 0, r), Pt(l, "load-delimited-text", void 0, void 0, r), this.parsedWorkbook = o.workbook, this.cjkFallback = Ze(o.workbook, this.cjkFallback), this.sheetCache.set(0, s), this.sheetCacheUsage.set(0, l), this.retainedSheetUsage = l, this.officeFontRequests = ze(o.workbook), t.useGoogleFonts && (this.googleFontNames = [...wt(o.workbook, this.cjkFallback)]), typeof document < "u" && document.fonts) {
|
|
934
934
|
await this.retainFontsInSet(document.fonts), await this.retainWorksheetOfficeFonts(s);
|
|
935
935
|
let e = this.retainedFontSets.get(document.fonts)?.loaded?.office;
|
|
936
|
-
|
|
936
|
+
_t(s, e?.routes, this.googleSubstitutes);
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
async retainFontsInSet(e) {
|
|
@@ -941,7 +941,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
941
941
|
let t = this.retainedFontSets.get(e);
|
|
942
942
|
if (t) t.refs++;
|
|
943
943
|
else {
|
|
944
|
-
let n = Promise.all([
|
|
944
|
+
let n = Promise.all([S(this.googleFontNames, qe, e), O(this.officeFontRequests, e)]).then(([e, t]) => ({
|
|
945
945
|
google: e,
|
|
946
946
|
office: t
|
|
947
947
|
}));
|
|
@@ -950,7 +950,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
950
950
|
loaded: null,
|
|
951
951
|
loading: n
|
|
952
952
|
}, this.retainedFontSets.set(e, t), n.then((e) => {
|
|
953
|
-
t.loaded = e, this.fontsDestroyed && (
|
|
953
|
+
t.loaded = e, this.fontsDestroyed && (P(e.google), x(e.office.faces));
|
|
954
954
|
});
|
|
955
955
|
}
|
|
956
956
|
await t.loading;
|
|
@@ -959,16 +959,16 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
959
959
|
if (n) return;
|
|
960
960
|
n = !0;
|
|
961
961
|
let r = this.retainedFontSets.get(e);
|
|
962
|
-
r === t && (r.refs--, !(r.refs > 0) && (this.retainedFontSets.delete(e), r.loaded ? (
|
|
963
|
-
|
|
962
|
+
r === t && (r.refs--, !(r.refs > 0) && (this.retainedFontSets.delete(e), r.loaded ? (P(r.loaded.google), x(r.loaded.office.faces)) : r.loading.then((e) => {
|
|
963
|
+
P(e.google), x(e.office.faces);
|
|
964
964
|
})));
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
967
|
async retainWorksheetOfficeFonts(e) {
|
|
968
|
-
let t =
|
|
968
|
+
let t = tt(e).filter((e) => !this.officeFontRequests.some((t) => Ge(t) === Ge(e)));
|
|
969
969
|
t.length !== 0 && (this.officeFontRequests.push(...t), await Promise.all([...this.retainedFontSets].map(async ([e, n]) => {
|
|
970
|
-
let r = await n.loading, i = await
|
|
971
|
-
if (this.fontsDestroyed || this.retainedFontSets.get(e) !== n || n.refs <= 0)
|
|
970
|
+
let r = await n.loading, i = await O(t, e);
|
|
971
|
+
if (this.fontsDestroyed || this.retainedFontSets.get(e) !== n || n.refs <= 0) x(i.faces);
|
|
972
972
|
else {
|
|
973
973
|
r.office.faces.push(...i.faces);
|
|
974
974
|
let e = new Set(r.office.checked);
|
|
@@ -977,13 +977,13 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
977
977
|
}
|
|
978
978
|
})));
|
|
979
979
|
}
|
|
980
|
-
async [
|
|
980
|
+
async [Un](e) {
|
|
981
981
|
return await this.retainFontsInSet(e.fonts);
|
|
982
982
|
}
|
|
983
|
-
[
|
|
983
|
+
[Wn](e, t) {
|
|
984
984
|
if (!this.parsedWorkbook) return;
|
|
985
|
-
let n =
|
|
986
|
-
|
|
985
|
+
let n = b(t.canvas) ? t.canvas.ownerDocument.fonts : null;
|
|
986
|
+
mt(t, e, n ? this.retainedFontSets.get(n)?.loaded?.office.routes : void 0, this.googleSubstitutes), z(e), vt(t, e, this.parsedWorkbook.styles, this.cjkFallback);
|
|
987
987
|
}
|
|
988
988
|
get sheetNames() {
|
|
989
989
|
return this.parsedWorkbook?.workbook.sheets.map((e) => e.name) ?? [];
|
|
@@ -995,7 +995,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
995
995
|
return this.parsedWorkbook?.workbook.sheets.map((e) => e.tabColor ?? null) ?? [];
|
|
996
996
|
}
|
|
997
997
|
sheetVisibility(e) {
|
|
998
|
-
return
|
|
998
|
+
return an(this.parsedWorkbook?.workbook.sheets ?? [], e);
|
|
999
999
|
}
|
|
1000
1000
|
isHidden(e) {
|
|
1001
1001
|
return this.sheetVisibility(e) !== "visible";
|
|
@@ -1016,7 +1016,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1016
1016
|
if (t) return this.touchWorksheet(e, t), t;
|
|
1017
1017
|
let n = this.sheetLoads.get(e);
|
|
1018
1018
|
if (n) return n;
|
|
1019
|
-
let r = new
|
|
1019
|
+
let r = new Ln([]);
|
|
1020
1020
|
(this.sheetPreviews ??= /* @__PURE__ */ new Map()).set(e, r);
|
|
1021
1021
|
let i = this.loadWorksheet(e, r);
|
|
1022
1022
|
i.catch((e) => r.fail(e)), this.sheetLoads.set(e, i);
|
|
@@ -1093,7 +1093,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1093
1093
|
if (!t) throw Error("OOXML resource metrics are not ready");
|
|
1094
1094
|
return t;
|
|
1095
1095
|
}
|
|
1096
|
-
return
|
|
1096
|
+
return C(e, async (e) => (await this.requireBridge().request((e) => ({
|
|
1097
1097
|
type: "resourceUsage",
|
|
1098
1098
|
id: e
|
|
1099
1099
|
}), void 0, { timeoutMs: e })).usage);
|
|
@@ -1113,47 +1113,47 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1113
1113
|
try {
|
|
1114
1114
|
for await (let u of i.stream(e, t)) {
|
|
1115
1115
|
if (u.kind === "preview") {
|
|
1116
|
-
if (u.worksheet && (
|
|
1117
|
-
|
|
1116
|
+
if (u.worksheet && (Mt(u.worksheet, r), et(u.worksheet, this.japaneseCellFonts)), n.preview(u.worksheet, u.reason, u.maxRow, u.maxCol), u.worksheet) {
|
|
1117
|
+
Bn(u.worksheet, {
|
|
1118
1118
|
maxRow: u.maxRow,
|
|
1119
1119
|
maxCol: u.maxCol
|
|
1120
1120
|
}), await this.retainWorksheetOfficeFonts(u.worksheet);
|
|
1121
1121
|
let e = typeof document < "u" ? this.retainedFontSets.get(document.fonts)?.loaded?.office : void 0;
|
|
1122
|
-
|
|
1122
|
+
_t(u.worksheet, e?.routes, this.googleSubstitutes);
|
|
1123
1123
|
}
|
|
1124
1124
|
continue;
|
|
1125
1125
|
}
|
|
1126
1126
|
if (u.kind === "rows") {
|
|
1127
|
-
let e =
|
|
1128
|
-
|
|
1127
|
+
let e = kt(o, Rt(u.rows, r), r);
|
|
1128
|
+
At(e, "get-worksheet", void 0, u.usage, r), n.append(u.rows), o = e;
|
|
1129
1129
|
continue;
|
|
1130
1130
|
}
|
|
1131
1131
|
let e = u.worksheet;
|
|
1132
|
-
|
|
1133
|
-
let t =
|
|
1132
|
+
Mt(e, r), et(e, this.japaneseCellFonts), e.rows = e.parseError ? [] : a;
|
|
1133
|
+
let t = jt(e, e.parseError ? {
|
|
1134
1134
|
rows: 0,
|
|
1135
1135
|
cells: 0,
|
|
1136
1136
|
ownedUtf8Bytes: 0
|
|
1137
1137
|
} : o, r);
|
|
1138
|
-
|
|
1139
|
-
let i = this.retainedSheetUsage, d =
|
|
1138
|
+
At(t, "get-worksheet", void 0, u.usage, r), Vt(t.jsonBytes, "get-worksheet", void 0, u.usage, r);
|
|
1139
|
+
let i = this.retainedSheetUsage, d = zt(i, t, {}, r), f = [];
|
|
1140
1140
|
for (let [e] of this.sheetCache) {
|
|
1141
1141
|
try {
|
|
1142
|
-
|
|
1142
|
+
Pt(d, "get-worksheet", void 0, u.usage, r);
|
|
1143
1143
|
break;
|
|
1144
1144
|
} catch (e) {
|
|
1145
|
-
if (!(e instanceof
|
|
1145
|
+
if (!(e instanceof g)) throw e;
|
|
1146
1146
|
}
|
|
1147
1147
|
if ((this.sheetLeases.get(e) ?? 0) > 0) continue;
|
|
1148
1148
|
let n = this.sheetCacheUsage.get(e);
|
|
1149
|
-
n && (i =
|
|
1149
|
+
n && (i = zt(i, {
|
|
1150
1150
|
rows: 0,
|
|
1151
1151
|
cells: 0,
|
|
1152
1152
|
ownedUtf8Bytes: 0,
|
|
1153
1153
|
jsonBytes: 0
|
|
1154
|
-
}, n, r), d =
|
|
1154
|
+
}, n, r), d = zt(i, t, {}, r), f.push(e));
|
|
1155
1155
|
}
|
|
1156
|
-
|
|
1156
|
+
Pt(d, "get-worksheet", void 0, u.usage, r);
|
|
1157
1157
|
let p;
|
|
1158
1158
|
if (f.length && this._mode === "worker") {
|
|
1159
1159
|
let e;
|
|
@@ -1187,7 +1187,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1187
1187
|
if (u = !0, !s || !c || !l) throw Error(`XLSX worksheet ${e} did not produce a terminal model`);
|
|
1188
1188
|
this.retainedSheetUsage = c, this.sheetCache.set(e, s), this.sheetCacheUsage.set(e, l), await this.retainWorksheetOfficeFonts(s);
|
|
1189
1189
|
let d = typeof document < "u" ? this.retainedFontSets.get(document.fonts)?.loaded?.office : void 0;
|
|
1190
|
-
return
|
|
1190
|
+
return _t(s, d?.routes, this.googleSubstitutes), n.finish(s), s;
|
|
1191
1191
|
} catch (e) {
|
|
1192
1192
|
throw this._mode === "worker" && s && !u && this.destroy(), this.latchFatalResourceFailure(e), n.fail(e), e;
|
|
1193
1193
|
}
|
|
@@ -1195,9 +1195,9 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1195
1195
|
ensureWorksheetPullClient() {
|
|
1196
1196
|
if (this.worksheetPullClient) return this.worksheetPullClient;
|
|
1197
1197
|
if (!this.parsedWorkbook) throw Error("Workbook not loaded");
|
|
1198
|
-
return this.worksheetPullClient = new
|
|
1198
|
+
return this.worksheetPullClient = new Bt({
|
|
1199
1199
|
generation: this.generation || 1,
|
|
1200
|
-
transport: this.requireBridge().transport(
|
|
1200
|
+
transport: this.requireBridge().transport(It),
|
|
1201
1201
|
sharedStrings: this.parsedWorkbook.sharedStrings,
|
|
1202
1202
|
timeoutMs: this.workerTimeoutMs,
|
|
1203
1203
|
open: async (e, t, n, r) => {
|
|
@@ -1252,8 +1252,8 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1252
1252
|
}
|
|
1253
1253
|
async resolveValidationList(e, t) {
|
|
1254
1254
|
if (this.assertResourceHealthy(), !this.parsedWorkbook) throw Error("Workbook not loaded");
|
|
1255
|
-
let n =
|
|
1256
|
-
if (n.kind !== "range") return
|
|
1255
|
+
let n = Cn(t);
|
|
1256
|
+
if (n.kind !== "range") return wn(n, () => null);
|
|
1257
1257
|
let r = e;
|
|
1258
1258
|
if (n.sheet) {
|
|
1259
1259
|
let e = this.sheetNames.findIndex((e) => e.toLowerCase() === n.sheet?.toLowerCase());
|
|
@@ -1267,16 +1267,22 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1267
1267
|
try {
|
|
1268
1268
|
let e = i.worksheet, t = this.parsedWorkbook.styles, r = /* @__PURE__ */ new Map();
|
|
1269
1269
|
for (let t of e.rows) for (let e of t.cells) r.set(`${e.row}:${e.col}`, e);
|
|
1270
|
-
return
|
|
1270
|
+
return wn(n, (n, i) => {
|
|
1271
1271
|
let a = r.get(`${n}:${i}`);
|
|
1272
|
-
return a ?
|
|
1272
|
+
return a ? Ke(a, t, null, e.date1904) : null;
|
|
1273
1273
|
});
|
|
1274
1274
|
} finally {
|
|
1275
1275
|
i.release();
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
cellText(e, t) {
|
|
1279
|
-
return this.parsedWorkbook ?
|
|
1279
|
+
return this.parsedWorkbook ? Ke(t, this.parsedWorkbook.styles, null, e.date1904) : "";
|
|
1280
|
+
}
|
|
1281
|
+
[qn](e) {
|
|
1282
|
+
let t = this.parsedWorkbook;
|
|
1283
|
+
if (!t) return () => [];
|
|
1284
|
+
let n = t.styles, r = e.conditionalFormats?.length ? Je(e) : null;
|
|
1285
|
+
return (t) => Ue(t, n, r ? Xe(t, t.row, t.col, r, n.dxfs ?? []).numFmt : null, e.date1904);
|
|
1280
1286
|
}
|
|
1281
1287
|
async renderViewport(e, t, n, r = {}) {
|
|
1282
1288
|
if (this.assertResourceHealthy(), n = {
|
|
@@ -1286,11 +1292,11 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1286
1292
|
cols: n.cols
|
|
1287
1293
|
}, this._mode === "worker") throw Error("renderViewport(canvas) is unavailable in mode: 'worker'; use renderViewportToBitmap() and paint it via an ImageBitmapRenderingContext");
|
|
1288
1294
|
if (!this.parsedWorkbook) throw Error("Workbook not loaded");
|
|
1289
|
-
let i = this.parsedWorkbook.styles, a =
|
|
1295
|
+
let i = this.parsedWorkbook.styles, a = Mn(r), { sizeOverrides: o, ...s } = a.opts, c = b(e) ? e.ownerDocument.fonts : typeof document < "u" ? document.fonts : null, l = this.sheetPreviews?.get(t);
|
|
1290
1296
|
if (l?.worksheet && a.worksheet) {
|
|
1291
1297
|
await l.waitFor(Math.max(n.row + n.rows - 1, s.freezeRows ?? 0)), this.assertResourceHealthy();
|
|
1292
1298
|
let t = a.worksheet;
|
|
1293
|
-
await
|
|
1299
|
+
await yn({
|
|
1294
1300
|
ws: t,
|
|
1295
1301
|
styles: i,
|
|
1296
1302
|
cjkFallback: this.cjkFallback,
|
|
@@ -1309,8 +1315,8 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1309
1315
|
return;
|
|
1310
1316
|
}
|
|
1311
1317
|
return this.withWorksheetArchiveOperation(t, (t) => {
|
|
1312
|
-
let r = a.worksheet ??
|
|
1313
|
-
return r !== t &&
|
|
1318
|
+
let r = a.worksheet ?? On(t, o);
|
|
1319
|
+
return r !== t && gt(t, r), yn({
|
|
1314
1320
|
ws: r,
|
|
1315
1321
|
styles: i,
|
|
1316
1322
|
cjkFallback: this.cjkFallback,
|
|
@@ -1335,9 +1341,9 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1335
1341
|
rows: t.rows,
|
|
1336
1342
|
cols: t.cols
|
|
1337
1343
|
};
|
|
1338
|
-
let r =
|
|
1344
|
+
let r = Mn(n), i = {
|
|
1339
1345
|
...r.opts,
|
|
1340
|
-
dpr: n.dpr ??
|
|
1346
|
+
dpr: n.dpr ?? D()
|
|
1341
1347
|
};
|
|
1342
1348
|
if (this._mode === "worker") {
|
|
1343
1349
|
if (!Number.isInteger(e) || e < 0 || e >= this.sheetCount) throw Error(`Sheet index ${e} out of range (count: ${this.sheetCount})`);
|
|
@@ -1359,7 +1365,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1359
1365
|
let a = new OffscreenCanvas(1, 1);
|
|
1360
1366
|
return await this.renderViewport(a, e, t, i), a.transferToImageBitmap();
|
|
1361
1367
|
}
|
|
1362
|
-
[
|
|
1368
|
+
[Gn](e) {
|
|
1363
1369
|
this._mode !== "worker" || !this.bridge || this.bridge.post({
|
|
1364
1370
|
type: "releaseViewProjection",
|
|
1365
1371
|
projectionId: e
|
|
@@ -1387,7 +1393,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1387
1393
|
a = e, o = t;
|
|
1388
1394
|
});
|
|
1389
1395
|
s.catch(() => void 0), this.sheetLoads.set(e, s);
|
|
1390
|
-
let c = new
|
|
1396
|
+
let c = new Ln([]);
|
|
1391
1397
|
return (this.sheetPreviews ??= /* @__PURE__ */ new Map()).set(e, c), this.runArchiveOperation(async () => {
|
|
1392
1398
|
try {
|
|
1393
1399
|
let n = await this.loadWorksheetStream(e, i.name, c);
|
|
@@ -1408,14 +1414,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1408
1414
|
}, this.sheetLoads.clear();
|
|
1409
1415
|
for (let e of this.sheetPreviews?.values() ?? []) e.fail(/* @__PURE__ */ Error("XLSX workbook has been destroyed"));
|
|
1410
1416
|
this.sheetPreviews?.clear(), this.fontsDestroyed = !0;
|
|
1411
|
-
for (let e of this.retainedFontSets.values()) e.loaded && (
|
|
1412
|
-
this.retainedFontSets.clear(), this.googleFontNames = [], this.googleSubstitutes = !1, this.officeFontRequests = [],
|
|
1417
|
+
for (let e of this.retainedFontSets.values()) e.loaded && (P(e.loaded.google), x(e.loaded.office.faces));
|
|
1418
|
+
this.retainedFontSets.clear(), this.googleFontNames = [], this.googleSubstitutes = !1, this.officeFontRequests = [], M(this._fetchImage), re(this._fetchImage), this.rawParts.clear(), this.queuedImageLoads?.clear();
|
|
1413
1419
|
}
|
|
1414
1420
|
assertResourceHealthy() {
|
|
1415
1421
|
if (this.resourceFailure) throw this.resourceFailure;
|
|
1416
1422
|
}
|
|
1417
1423
|
latchFatalResourceFailure(e) {
|
|
1418
|
-
e instanceof
|
|
1424
|
+
e instanceof g && e.details.violation.resource !== "worksheet-cache" && (this.resourceFailure ??= e);
|
|
1419
1425
|
}
|
|
1420
1426
|
requireBridge() {
|
|
1421
1427
|
if (!this.bridge) throw Error("This operation requires an active workbook worker");
|
|
@@ -1426,64 +1432,64 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1426
1432
|
return this.bridge;
|
|
1427
1433
|
}
|
|
1428
1434
|
};
|
|
1429
|
-
function
|
|
1435
|
+
function Yn(e, t) {
|
|
1430
1436
|
return e.acquireWorksheetLease(t);
|
|
1431
1437
|
}
|
|
1432
|
-
function
|
|
1438
|
+
function Xn(e, t) {
|
|
1433
1439
|
let n = e.acquireWorksheetPreviewLease;
|
|
1434
|
-
return typeof n == "function" ? n.call(e, t) :
|
|
1440
|
+
return typeof n == "function" ? n.call(e, t) : Yn(e, t).then((e) => ({
|
|
1435
1441
|
...e,
|
|
1436
1442
|
partial: !1,
|
|
1437
1443
|
completion: Promise.resolve(e.worksheet)
|
|
1438
1444
|
}));
|
|
1439
1445
|
}
|
|
1440
|
-
function
|
|
1446
|
+
function Zn(e, t) {
|
|
1441
1447
|
let n = e.retainWorksheetReference;
|
|
1442
1448
|
return typeof n == "function" ? n.call(e, t) : Promise.resolve(() => void 0);
|
|
1443
1449
|
}
|
|
1444
|
-
function
|
|
1450
|
+
function Qn(e, t) {
|
|
1445
1451
|
return e.top <= t.row + t.rows - 1 && e.bottom >= t.row && e.left <= t.col + t.cols - 1 && e.right >= t.col;
|
|
1446
1452
|
}
|
|
1447
|
-
function
|
|
1453
|
+
function $n(e, t) {
|
|
1448
1454
|
let n = e.fromRow + 1 > t.row + t.rows - 1 && Number.isFinite(e.fromRowOff) && e.fromRowOff >= 0, r = e.fromCol + 1 > t.col + t.cols - 1 && Number.isFinite(e.fromColOff) && e.fromColOff >= 0;
|
|
1449
1455
|
return !n && !r;
|
|
1450
1456
|
}
|
|
1451
|
-
function
|
|
1457
|
+
function er(e, t, n, r) {
|
|
1452
1458
|
for (let i of e.conditionalFormats ?? []) if (i.sqref.filter((e) => e.top <= n && e.bottom >= t).length !== 0) {
|
|
1453
1459
|
for (let e of i.rules) if (e.type !== "other" && !(e.type === "cellIs" && e.formulas.every((e) => /^\s*[-+]?(?:\d+(?:\.\d*)?|\.\d+)\s*$/.test(e))) && (i.sqref.some((e) => e.bottom > r) || "activeFormula" in e && e.activeFormula && !/^\s*[-+]?(?:\d+(?:\.\d*)?|\.\d+)\s*$/.test(e.activeFormula) || e.type === "cellIs" || e.type === "expression")) return "conditional-format-range";
|
|
1454
1460
|
}
|
|
1455
1461
|
return null;
|
|
1456
1462
|
}
|
|
1457
|
-
function
|
|
1458
|
-
return (e.mergeCells ?? []).some((e) =>
|
|
1463
|
+
function tr(e, t, n) {
|
|
1464
|
+
return (e.mergeCells ?? []).some((e) => Qn(e, t) && e.bottom > n) ? "merge-range" : er(e, t.row, t.row + t.rows - 1, n) || ((e.charts ?? []).some((e) => $n(e, t)) || (e.shapeGroups ?? []).some((e) => $n(e, t)) || (e.slicers ?? []).some((e) => $n(e, t)) ? "drawing-dependency" : (e.sparklineGroups ?? []).some((e) => e.sparklines.some((e) => e.row >= t.row && e.row < t.row + t.rows && e.col >= t.col && e.col < t.col + t.cols)) ? "sparkline-dependency" : null);
|
|
1459
1465
|
}
|
|
1460
|
-
function
|
|
1461
|
-
return t < 1 ? null :
|
|
1466
|
+
function nr(e, t, n) {
|
|
1467
|
+
return t < 1 ? null : er(e, 1, t, n) ? "drawing-dependency" : null;
|
|
1462
1468
|
}
|
|
1463
|
-
function
|
|
1464
|
-
let n =
|
|
1469
|
+
function rr(e, t) {
|
|
1470
|
+
let n = Re(t.worksheet, e, t.colAxis, t.rowAxis, t.scale), { width: r, height: i } = n;
|
|
1465
1471
|
if (r <= 0 || i <= 0) return null;
|
|
1466
1472
|
let a = t.colAxis.offsetOf(t.startCol), o = t.rowAxis.offsetOf(t.startRow);
|
|
1467
1473
|
return {
|
|
1468
|
-
x:
|
|
1474
|
+
x: R(t.scrollAreaX + (n.x - a) - t.scrollOffsetX, r, t.canvasWidth, t.rtl),
|
|
1469
1475
|
y: t.scrollAreaY + (n.y - o) - t.scrollOffsetY,
|
|
1470
1476
|
width: r,
|
|
1471
1477
|
height: i
|
|
1472
1478
|
};
|
|
1473
1479
|
}
|
|
1474
|
-
function
|
|
1480
|
+
function ir(e, t) {
|
|
1475
1481
|
return e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1476
1482
|
}
|
|
1477
|
-
function
|
|
1478
|
-
let n =
|
|
1483
|
+
function ar(e, t) {
|
|
1484
|
+
let n = R(t.scrollAreaX, t.scrollAreaW, t.canvasWidth, t.rtl);
|
|
1479
1485
|
return e.x + e.width >= n && e.x <= n + t.scrollAreaW && e.y + e.height >= t.scrollAreaY && e.y <= t.scrollAreaY + t.scrollAreaH;
|
|
1480
1486
|
}
|
|
1481
|
-
function
|
|
1482
|
-
let n =
|
|
1487
|
+
function or(e, t) {
|
|
1488
|
+
let n = R(t.scrollAreaX, t.scrollAreaW, t.canvasWidth, t.rtl);
|
|
1483
1489
|
return e.x >= n && e.x <= n + t.scrollAreaW && e.y >= t.scrollAreaY && e.y <= t.scrollAreaY + t.scrollAreaH;
|
|
1484
1490
|
}
|
|
1485
|
-
function
|
|
1486
|
-
let n =
|
|
1491
|
+
function sr(e, t) {
|
|
1492
|
+
let n = z(e), r = t.cellScale, { col: i, row: a } = n.axesAtScale(r), o = Math.round(50 * r), s = Math.round(22 * r), c = i.bandsToCover(1, t.freezeCols, Math.max(0, t.width - o)), l = a.bandsToCover(1, t.freezeRows, Math.max(0, t.height - s)), u = c.reduce((e, t) => e + t.size, 0), d = l.reduce((e, t) => e + t.size, 0);
|
|
1487
1493
|
return {
|
|
1488
1494
|
worksheet: e,
|
|
1489
1495
|
colAxis: i,
|
|
@@ -1501,11 +1507,11 @@ function nr(e, t) {
|
|
|
1501
1507
|
canvasWidth: t.width
|
|
1502
1508
|
};
|
|
1503
1509
|
}
|
|
1504
|
-
function
|
|
1505
|
-
let r =
|
|
1510
|
+
function cr(e, t, n) {
|
|
1511
|
+
let r = sr(e, n), i, a = 0;
|
|
1506
1512
|
if (i = t.elementType === "chart" ? e.charts[t.elementIndex] : t.elementType === "image" ? e.images[t.elementIndex] : (e.shapeGroups ?? [])[t.elementIndex], !i) return null;
|
|
1507
|
-
let o =
|
|
1508
|
-
if (!o || !
|
|
1513
|
+
let o = rr(i, r);
|
|
1514
|
+
if (!o || !ar(o, r)) return null;
|
|
1509
1515
|
if (t.elementType === "shape") {
|
|
1510
1516
|
let n = (e.shapeGroups ?? [])[t.elementIndex], r = t.shapeIndex === void 0 ? void 0 : n?.shapes[t.shapeIndex];
|
|
1511
1517
|
r && (o = {
|
|
@@ -1515,7 +1521,7 @@ function rr(e, t, n) {
|
|
|
1515
1521
|
height: r.h * o.height
|
|
1516
1522
|
}, a = r.rot);
|
|
1517
1523
|
}
|
|
1518
|
-
let s =
|
|
1524
|
+
let s = R(r.scrollAreaX, r.scrollAreaW, r.canvasWidth, r.rtl);
|
|
1519
1525
|
return {
|
|
1520
1526
|
rect: o,
|
|
1521
1527
|
clip: {
|
|
@@ -1527,7 +1533,7 @@ function rr(e, t, n) {
|
|
|
1527
1533
|
rotation: a
|
|
1528
1534
|
};
|
|
1529
1535
|
}
|
|
1530
|
-
function
|
|
1536
|
+
function lr(e) {
|
|
1531
1537
|
return {
|
|
1532
1538
|
from: {
|
|
1533
1539
|
row: e.fromRow + 1,
|
|
@@ -1543,7 +1549,7 @@ function ir(e) {
|
|
|
1543
1549
|
}
|
|
1544
1550
|
};
|
|
1545
1551
|
}
|
|
1546
|
-
function
|
|
1552
|
+
function ur(e, t) {
|
|
1547
1553
|
if (!e.text) return {
|
|
1548
1554
|
truncated: !1,
|
|
1549
1555
|
textCharacters: 0
|
|
@@ -1558,7 +1564,7 @@ function ar(e, t) {
|
|
|
1558
1564
|
n.push("\n"), r++;
|
|
1559
1565
|
}
|
|
1560
1566
|
for (let e of o.runs) {
|
|
1561
|
-
let a = e.type === "text" ? e.text : e.type === "break" ? "\n" : "[equation]", o =
|
|
1567
|
+
let a = e.type === "text" ? e.text : e.type === "break" ? "\n" : "[equation]", o = Me(a, Math.max(0, t - r));
|
|
1562
1568
|
if (n.push(o), r += o.length, o.length < a.length) {
|
|
1563
1569
|
i = !0;
|
|
1564
1570
|
break;
|
|
@@ -1572,7 +1578,7 @@ function ar(e, t) {
|
|
|
1572
1578
|
textCharacters: r
|
|
1573
1579
|
};
|
|
1574
1580
|
}
|
|
1575
|
-
function
|
|
1581
|
+
function dr(e, t, n, r, i, a, o, s) {
|
|
1576
1582
|
return {
|
|
1577
1583
|
format: "xlsx",
|
|
1578
1584
|
kind: "element",
|
|
@@ -1580,7 +1586,7 @@ function or(e, t, n, r, i, a, o, s) {
|
|
|
1580
1586
|
sheetName: e.name,
|
|
1581
1587
|
elementType: n,
|
|
1582
1588
|
elementIndex: r,
|
|
1583
|
-
anchor:
|
|
1589
|
+
anchor: lr(i),
|
|
1584
1590
|
...a === void 0 ? {} : { text: a },
|
|
1585
1591
|
truncated: o,
|
|
1586
1592
|
truncationReasons: o ? ["text"] : [],
|
|
@@ -1588,19 +1594,19 @@ function or(e, t, n, r, i, a, o, s) {
|
|
|
1588
1594
|
maxTextCharacters: s
|
|
1589
1595
|
};
|
|
1590
1596
|
}
|
|
1591
|
-
function
|
|
1597
|
+
function fr(e, t, n, r, i) {
|
|
1592
1598
|
for (let a = e.charts.length - 1; a >= 0; a--) {
|
|
1593
|
-
let o = e.charts[a], s =
|
|
1594
|
-
if (!s || !
|
|
1595
|
-
let c =
|
|
1599
|
+
let o = e.charts[a], s = rr(o, r);
|
|
1600
|
+
if (!s || !ar(s, r) || !ir(n, s)) continue;
|
|
1601
|
+
let c = De(o.chart, i);
|
|
1596
1602
|
return {
|
|
1597
|
-
...
|
|
1603
|
+
...dr(e, t, "chart", a, o, c.text, c.truncated, c.maxTextCharacters),
|
|
1598
1604
|
seriesCount: o.chart.series.length
|
|
1599
1605
|
};
|
|
1600
1606
|
}
|
|
1601
1607
|
return null;
|
|
1602
1608
|
}
|
|
1603
|
-
function
|
|
1609
|
+
function pr(e, t, n) {
|
|
1604
1610
|
let r = {
|
|
1605
1611
|
x: t.x + n.x * t.width,
|
|
1606
1612
|
y: t.y + n.y * t.height,
|
|
@@ -1612,21 +1618,21 @@ function cr(e, t, n) {
|
|
|
1612
1618
|
y: u
|
|
1613
1619
|
};
|
|
1614
1620
|
}
|
|
1615
|
-
function
|
|
1621
|
+
function mr(e, t, n, r, i) {
|
|
1616
1622
|
let a = e.shapeGroups ?? [];
|
|
1617
1623
|
for (let o = a.length - 1; o >= 0; o--) {
|
|
1618
|
-
let s = a[o], c =
|
|
1619
|
-
if (!(!c || !
|
|
1624
|
+
let s = a[o], c = rr(s, r);
|
|
1625
|
+
if (!(!c || !ar(c, r))) for (let r = s.shapes.length - 1; r >= 0; r--) {
|
|
1620
1626
|
let a = s.shapes[r];
|
|
1621
|
-
if (
|
|
1627
|
+
if (!ir(pr(n, c, a), {
|
|
1622
1628
|
x: c.x + a.x * c.width,
|
|
1623
1629
|
y: c.y + a.y * c.height,
|
|
1624
1630
|
width: a.w * c.width,
|
|
1625
1631
|
height: a.h * c.height
|
|
1626
1632
|
})) continue;
|
|
1627
|
-
let l =
|
|
1633
|
+
let l = ur(a, i);
|
|
1628
1634
|
return {
|
|
1629
|
-
...
|
|
1635
|
+
...dr(e, t, "shape", o, s, l.text, l.truncated, i),
|
|
1630
1636
|
shapeIndex: r,
|
|
1631
1637
|
shapeCount: s.shapes.length,
|
|
1632
1638
|
...a.geom.type === "image" ? { mimeType: a.geom.mimeType } : {}
|
|
@@ -1635,26 +1641,26 @@ function lr(e, t, n, r, i) {
|
|
|
1635
1641
|
}
|
|
1636
1642
|
return null;
|
|
1637
1643
|
}
|
|
1638
|
-
function
|
|
1644
|
+
function hr(e, t, n, r, i) {
|
|
1639
1645
|
for (let a = e.images.length - 1; a >= 0; a--) {
|
|
1640
|
-
let o = e.images[a], s =
|
|
1641
|
-
if (s &&
|
|
1642
|
-
...
|
|
1646
|
+
let o = e.images[a], s = rr(o, r);
|
|
1647
|
+
if (s && ar(Be(s, o.rotation), r) && ir(Qe(n, s, o.rotation, o.flipH, o.flipV), s)) return {
|
|
1648
|
+
...dr(e, t, "image", a, o, void 0, !1, i),
|
|
1643
1649
|
mimeType: o.svgImagePath ? "image/svg+xml" : o.mimeType
|
|
1644
1650
|
};
|
|
1645
1651
|
}
|
|
1646
1652
|
return null;
|
|
1647
1653
|
}
|
|
1648
|
-
function
|
|
1654
|
+
function gr(e, t, n, r, i = Ee) {
|
|
1649
1655
|
if (!Number.isFinite(n.x) || !Number.isFinite(n.y)) throw RangeError("XLSX hit-test point must contain finite coordinates.");
|
|
1650
1656
|
if (!Number.isFinite(i) || i < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
1651
|
-
let a = Math.min(
|
|
1652
|
-
return
|
|
1657
|
+
let a = Math.min(Ee, Math.floor(i)), o = sr(e, r);
|
|
1658
|
+
return or(n, o) ? fr(e, t, n, o, a) ?? mr(e, t, n, o, a) ?? hr(e, t, n, o, a) : null;
|
|
1653
1659
|
}
|
|
1654
|
-
function
|
|
1660
|
+
function _r(e, t) {
|
|
1655
1661
|
let n = t ?? e.maxTextCharacters;
|
|
1656
1662
|
if (!Number.isFinite(n) || n < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
1657
|
-
let r = Math.min(
|
|
1663
|
+
let r = Math.min(Ee, Math.floor(n)), i = e.text === void 0 ? void 0 : Me(e.text, r), a = e.truncated || e.text !== void 0 && i.length < e.text.length;
|
|
1658
1664
|
return {
|
|
1659
1665
|
...structuredClone(e),
|
|
1660
1666
|
...i === void 0 ? {} : { text: i },
|
|
@@ -1664,17 +1670,17 @@ function fr(e, t) {
|
|
|
1664
1670
|
maxTextCharacters: r
|
|
1665
1671
|
};
|
|
1666
1672
|
}
|
|
1667
|
-
var
|
|
1668
|
-
function
|
|
1669
|
-
return e.areas.reduce((e, t) => e + (t.kind === "cells" ? (t.bottom - t.top + 1) * (t.right - t.left + 1) : t.kind === "rows" ? (t.lastRow - t.firstRow + 1) *
|
|
1673
|
+
var vr = 128, yr = 1e4, br = 8 * 1024 * 1024;
|
|
1674
|
+
function xr(e) {
|
|
1675
|
+
return e.areas.reduce((e, t) => e + (t.kind === "cells" ? (t.bottom - t.top + 1) * (t.right - t.left + 1) : t.kind === "rows" ? (t.lastRow - t.firstRow + 1) * V : t.kind === "columns" ? (t.lastColumn - t.firstColumn + 1) * H : H * V), 0);
|
|
1670
1676
|
}
|
|
1671
|
-
function
|
|
1677
|
+
function J(e, t) {
|
|
1672
1678
|
return Number.isInteger(e) && e >= 1 && e <= t;
|
|
1673
1679
|
}
|
|
1674
|
-
function
|
|
1680
|
+
function Sr(e) {
|
|
1675
1681
|
switch (e.kind) {
|
|
1676
1682
|
case "cells":
|
|
1677
|
-
if (!
|
|
1683
|
+
if (!J(e.top, 1048576) || !J(e.bottom, 1048576) || !J(e.left, 16384) || !J(e.right, 16384)) throw RangeError("Cell selection bounds must be inside the XLSX grid.");
|
|
1678
1684
|
return {
|
|
1679
1685
|
kind: "cells",
|
|
1680
1686
|
top: Math.min(e.top, e.bottom),
|
|
@@ -1683,14 +1689,14 @@ function _r(e) {
|
|
|
1683
1689
|
right: Math.max(e.left, e.right)
|
|
1684
1690
|
};
|
|
1685
1691
|
case "rows":
|
|
1686
|
-
if (!
|
|
1692
|
+
if (!J(e.firstRow, 1048576) || !J(e.lastRow, 1048576)) throw RangeError("Row selection bounds must be inside the XLSX grid.");
|
|
1687
1693
|
return {
|
|
1688
1694
|
kind: "rows",
|
|
1689
1695
|
firstRow: Math.min(e.firstRow, e.lastRow),
|
|
1690
1696
|
lastRow: Math.max(e.firstRow, e.lastRow)
|
|
1691
1697
|
};
|
|
1692
1698
|
case "columns":
|
|
1693
|
-
if (!
|
|
1699
|
+
if (!J(e.firstColumn, 16384) || !J(e.lastColumn, 16384)) throw RangeError("Column selection bounds must be inside the XLSX grid.");
|
|
1694
1700
|
return {
|
|
1695
1701
|
kind: "columns",
|
|
1696
1702
|
firstColumn: Math.min(e.firstColumn, e.lastColumn),
|
|
@@ -1699,7 +1705,7 @@ function _r(e) {
|
|
|
1699
1705
|
case "sheet": return { kind: "sheet" };
|
|
1700
1706
|
}
|
|
1701
1707
|
}
|
|
1702
|
-
function
|
|
1708
|
+
function Cr(e, t) {
|
|
1703
1709
|
switch (e.kind) {
|
|
1704
1710
|
case "cells": return t.row >= e.top && t.row <= e.bottom && t.col >= e.left && t.col <= e.right;
|
|
1705
1711
|
case "rows": return t.row >= e.firstRow && t.row <= e.lastRow;
|
|
@@ -1707,25 +1713,25 @@ function vr(e, t) {
|
|
|
1707
1713
|
case "sheet": return !0;
|
|
1708
1714
|
}
|
|
1709
1715
|
}
|
|
1710
|
-
function
|
|
1711
|
-
if (!
|
|
1716
|
+
function wr(e, t) {
|
|
1717
|
+
if (!J(e.row, 1048576) || !J(e.col, 16384)) throw RangeError(`${t} must be inside the XLSX grid.`);
|
|
1712
1718
|
return {
|
|
1713
1719
|
row: e.row,
|
|
1714
1720
|
col: e.col
|
|
1715
1721
|
};
|
|
1716
1722
|
}
|
|
1717
|
-
function
|
|
1723
|
+
function Y(e) {
|
|
1718
1724
|
if (!Array.isArray(e.areas) || e.areas.length === 0) throw TypeError("A selection must contain at least one area.");
|
|
1719
1725
|
if (e.areas.length > 128) throw RangeError("A selection may contain at most 128 areas.");
|
|
1720
1726
|
if (!Number.isInteger(e.activeAreaIndex) || e.activeAreaIndex < 0 || e.activeAreaIndex >= e.areas.length) throw RangeError("activeAreaIndex must identify an area in the selection.");
|
|
1721
|
-
let t = e.areas.map(
|
|
1727
|
+
let t = e.areas.map(Sr), n = [], r = /* @__PURE__ */ new Map(), i = 0;
|
|
1722
1728
|
for (let a = 0; a < t.length; a++) {
|
|
1723
1729
|
let o = t[a], s = o.kind === "cells" ? `c:${o.top}:${o.left}:${o.bottom}:${o.right}` : o.kind === "rows" ? `r:${o.firstRow}:${o.lastRow}` : o.kind === "columns" ? `k:${o.firstColumn}:${o.lastColumn}` : "s", c = r.get(s);
|
|
1724
1730
|
c === void 0 && (c = n.length, r.set(s, c), n.push(o)), a === e.activeAreaIndex && (i = c);
|
|
1725
1731
|
}
|
|
1726
|
-
let a =
|
|
1727
|
-
if (!
|
|
1728
|
-
if (!
|
|
1732
|
+
let a = wr(e.activeCell, "activeCell"), o = wr(e.extensionAnchor, "extensionAnchor"), s = n[i];
|
|
1733
|
+
if (!Cr(s, a)) throw RangeError("activeCell must be inside the active selection area.");
|
|
1734
|
+
if (!Cr(s, o)) throw RangeError("extensionAnchor must be inside the active selection area.");
|
|
1729
1735
|
return {
|
|
1730
1736
|
areas: n,
|
|
1731
1737
|
activeAreaIndex: i,
|
|
@@ -1733,16 +1739,16 @@ function X(e) {
|
|
|
1733
1739
|
extensionAnchor: o
|
|
1734
1740
|
};
|
|
1735
1741
|
}
|
|
1736
|
-
function
|
|
1742
|
+
function Tr(e) {
|
|
1737
1743
|
let t = 0;
|
|
1738
1744
|
for (let n of e) t = t * 26 + n.charCodeAt(0) - 64;
|
|
1739
1745
|
return t >= 1 && t <= 16384 ? t : null;
|
|
1740
1746
|
}
|
|
1741
|
-
function
|
|
1747
|
+
function Er(e) {
|
|
1742
1748
|
let t = e.trim().toUpperCase(), n = /^\$?(\d+):\$?(\d+)$/.exec(t);
|
|
1743
1749
|
if (n) {
|
|
1744
1750
|
let e = Number(n[1]), t = Number(n[2]);
|
|
1745
|
-
if (!
|
|
1751
|
+
if (!J(e, 1048576) || !J(t, 1048576)) return null;
|
|
1746
1752
|
let r = Math.min(e, t);
|
|
1747
1753
|
return {
|
|
1748
1754
|
areas: [{
|
|
@@ -1763,7 +1769,7 @@ function xr(e) {
|
|
|
1763
1769
|
}
|
|
1764
1770
|
let r = /^\$?([A-Z]+):\$?([A-Z]+)$/.exec(t);
|
|
1765
1771
|
if (r) {
|
|
1766
|
-
let e =
|
|
1772
|
+
let e = Tr(r[1]), t = Tr(r[2]);
|
|
1767
1773
|
if (e === null || t === null) return null;
|
|
1768
1774
|
let n = Math.min(e, t);
|
|
1769
1775
|
return {
|
|
@@ -1785,7 +1791,7 @@ function xr(e) {
|
|
|
1785
1791
|
}
|
|
1786
1792
|
let i = t.split(":");
|
|
1787
1793
|
if (i.length > 2) return null;
|
|
1788
|
-
let a =
|
|
1794
|
+
let a = L(i[0]), o = i.length === 2 ? L(i[1]) : a;
|
|
1789
1795
|
if (!a || !o) return null;
|
|
1790
1796
|
let s = {
|
|
1791
1797
|
kind: "cells",
|
|
@@ -1804,10 +1810,10 @@ function xr(e) {
|
|
|
1804
1810
|
extensionAnchor: c
|
|
1805
1811
|
};
|
|
1806
1812
|
}
|
|
1807
|
-
function
|
|
1813
|
+
function X(e, t) {
|
|
1808
1814
|
return e === t ? !0 : !e || !t || e.activeAreaIndex !== t.activeAreaIndex || e.areas.length !== t.areas.length || e.activeCell.row !== t.activeCell.row || e.activeCell.col !== t.activeCell.col || e.extensionAnchor.row !== t.extensionAnchor.row || e.extensionAnchor.col !== t.extensionAnchor.col ? !1 : e.areas.every((e, n) => JSON.stringify(e) === JSON.stringify(t.areas[n]));
|
|
1809
1815
|
}
|
|
1810
|
-
function
|
|
1816
|
+
function Dr(e, t, n) {
|
|
1811
1817
|
let r = [...new Set([...e, ...t].flatMap((e) => [e.first, e.last + 1]))].sort((e, t) => e - t), i = [], a = 0, o = 0;
|
|
1812
1818
|
for (let s = 0; s + 1 < r.length; s++) {
|
|
1813
1819
|
let c = r[s], l = r[s + 1] - 1;
|
|
@@ -1830,9 +1836,9 @@ function Cr(e, t, n) {
|
|
|
1830
1836
|
});
|
|
1831
1837
|
}
|
|
1832
1838
|
}
|
|
1833
|
-
return
|
|
1839
|
+
return Yt(i), Object.freeze(i.map((e) => Object.freeze(e)));
|
|
1834
1840
|
}
|
|
1835
|
-
var
|
|
1841
|
+
var Or = class {
|
|
1836
1842
|
stashedRowHeights = /* @__PURE__ */ new Map();
|
|
1837
1843
|
stashedColWidths = /* @__PURE__ */ new Map();
|
|
1838
1844
|
stashedColCssWidths = /* @__PURE__ */ new Map();
|
|
@@ -1857,11 +1863,11 @@ var wr = class {
|
|
|
1857
1863
|
let t = this.stashedRowHeights.get(r);
|
|
1858
1864
|
t === void 0 ? delete e.rowHeights[r] : e.rowHeights[r] = t, this.stashedRowHeights.delete(r);
|
|
1859
1865
|
} else e.rowHeights[r] === 0 && delete e.rowHeights[r];
|
|
1860
|
-
else if (i) this.stashedColWidths.has(r) || (this.stashedColWidths.set(r, e.colWidths[r]), this.stashedColCssWidths.set(r,
|
|
1866
|
+
else if (i) this.stashedColWidths.has(r) || (this.stashedColWidths.set(r, e.colWidths[r]), this.stashedColCssWidths.set(r, qt(e, r))), e.colWidths[r] = 0, B(e, r, null);
|
|
1861
1867
|
else if (this.stashedColWidths.has(r)) {
|
|
1862
1868
|
let t = this.stashedColWidths.get(r);
|
|
1863
|
-
t === void 0 ? delete e.colWidths[r] : e.colWidths[r] = t,
|
|
1864
|
-
} else e.colWidths[r] === 0 && (delete e.colWidths[r],
|
|
1869
|
+
t === void 0 ? delete e.colWidths[r] : e.colWidths[r] = t, B(e, r, this.stashedColCssWidths.get(r) ?? null), this.stashedColWidths.delete(r), this.stashedColCssWidths.delete(r);
|
|
1870
|
+
} else e.colWidths[r] === 0 && (delete e.colWidths[r], B(e, r, null));
|
|
1865
1871
|
this.recordSizeOverride(e, t, n, r);
|
|
1866
1872
|
}
|
|
1867
1873
|
recordSizeOverride(e, t, n, r, i) {
|
|
@@ -1877,8 +1883,8 @@ var wr = class {
|
|
|
1877
1883
|
n === "row" && a.automaticRows.delete(r);
|
|
1878
1884
|
let s = n === "row" ? e.rowHeights[r] ?? null : e.colWidths[r] ?? null, c = !1;
|
|
1879
1885
|
if (o.get(r) !== s && (o.set(r, s), c = !0), n === "col") {
|
|
1880
|
-
i !== void 0 &&
|
|
1881
|
-
let t =
|
|
1886
|
+
i !== void 0 && B(e, r, i);
|
|
1887
|
+
let t = qt(e, r) ?? null;
|
|
1882
1888
|
(a.colCss.has(r) ? a.colCss.get(r) !== t : t !== null) && (a.colCss.set(r, t), c = !0);
|
|
1883
1889
|
}
|
|
1884
1890
|
c && (a.revision++, a.wire = void 0);
|
|
@@ -1889,7 +1895,7 @@ var wr = class {
|
|
|
1889
1895
|
if (o > r) throw RangeError(`A resize projection may retain at most ${r} manually edited bands per axis.`);
|
|
1890
1896
|
}
|
|
1891
1897
|
beginRowResizePreview(e, t, n) {
|
|
1892
|
-
let r =
|
|
1898
|
+
let r = Jt(e), i = !1, a = (n) => {
|
|
1893
1899
|
let r = this.sizeOverrideStore.get(t);
|
|
1894
1900
|
!r && n.length && (r = {
|
|
1895
1901
|
rows: /* @__PURE__ */ new Map(),
|
|
@@ -1897,11 +1903,11 @@ var wr = class {
|
|
|
1897
1903
|
cols: /* @__PURE__ */ new Map(),
|
|
1898
1904
|
colCss: /* @__PURE__ */ new Map(),
|
|
1899
1905
|
revision: 0
|
|
1900
|
-
}, this.sizeOverrideStore.set(t, r)),
|
|
1906
|
+
}, this.sizeOverrideStore.set(t, r)), $t(e, n), r && (r.rowHeightRanges = n, r.revision++, r.wire = void 0), U.invalidate(e);
|
|
1901
1907
|
};
|
|
1902
1908
|
return {
|
|
1903
1909
|
apply: (e) => {
|
|
1904
|
-
a(
|
|
1910
|
+
a(Dr(r, n, e)), i = !0;
|
|
1905
1911
|
},
|
|
1906
1912
|
rollback: () => {
|
|
1907
1913
|
i && a(r), i = !1;
|
|
@@ -1909,8 +1915,8 @@ var wr = class {
|
|
|
1909
1915
|
};
|
|
1910
1916
|
}
|
|
1911
1917
|
restoreRowResizeRanges(e, t) {
|
|
1912
|
-
let n = this.sizeOverrideStore.get(e)?.rowHeightRanges ?? [], r =
|
|
1913
|
-
(n.length || r.length) && n !== r && (
|
|
1918
|
+
let n = this.sizeOverrideStore.get(e)?.rowHeightRanges ?? [], r = Jt(t);
|
|
1919
|
+
(n.length || r.length) && n !== r && ($t(t, n), U.invalidate(t));
|
|
1914
1920
|
}
|
|
1915
1921
|
wireSizeOverrides(e) {
|
|
1916
1922
|
let t = this.sizeOverrideStore.get(e);
|
|
@@ -1938,7 +1944,7 @@ var wr = class {
|
|
|
1938
1944
|
return this.sizeOverrideStore.get(e)?.revision ?? 0;
|
|
1939
1945
|
}
|
|
1940
1946
|
syncAutomaticRowOverrides(e, t) {
|
|
1941
|
-
let n = new Map(
|
|
1947
|
+
let n = new Map(ht(t)), r = this.sizeOverrideStore.get(e);
|
|
1942
1948
|
!r && n.size === 0 || (r || (r = {
|
|
1943
1949
|
rows: /* @__PURE__ */ new Map(),
|
|
1944
1950
|
automaticRows: /* @__PURE__ */ new Map(),
|
|
@@ -1960,7 +1966,7 @@ var wr = class {
|
|
|
1960
1966
|
if (n) {
|
|
1961
1967
|
for (let [e, r] of n.rows) r === null ? delete t.rowHeights[e] : t.rowHeights[e] = r;
|
|
1962
1968
|
for (let [e, r] of n.cols) r === null ? delete t.colWidths[e] : t.colWidths[e] = r;
|
|
1963
|
-
for (let [e, r] of n.colCss)
|
|
1969
|
+
for (let [e, r] of n.colCss) B(t, e, r);
|
|
1964
1970
|
}
|
|
1965
1971
|
let r = this.outlineStateStore.get(e);
|
|
1966
1972
|
if (r) {
|
|
@@ -1978,13 +1984,13 @@ var wr = class {
|
|
|
1978
1984
|
this.outlineStateStore.clear(), this.stashedRowHeights.clear(), this.stashedColWidths.clear(), this.stashedColCssWidths.clear(), this.sizeOverrideStore.clear();
|
|
1979
1985
|
}
|
|
1980
1986
|
};
|
|
1981
|
-
function
|
|
1987
|
+
function kr(e) {
|
|
1982
1988
|
return 8 + (e - 1) * 14;
|
|
1983
1989
|
}
|
|
1984
|
-
function
|
|
1990
|
+
function Ar(e) {
|
|
1985
1991
|
return e > 0 ? (e + 1) * 19 : 0;
|
|
1986
1992
|
}
|
|
1987
|
-
function
|
|
1993
|
+
function jr(e, t, n, r, i, a, o, s, c = !1) {
|
|
1988
1994
|
if (e === "row") {
|
|
1989
1995
|
let e = Math.min(s, i + a), c = Math.min(s, i), l = s;
|
|
1990
1996
|
return r > 0 && n <= r ? l = e : r > 0 && t > r && (c = e), {
|
|
@@ -2011,7 +2017,7 @@ function Dr(e, t, n, r, i, a, o, s, c = !1) {
|
|
|
2011
2017
|
h: s
|
|
2012
2018
|
};
|
|
2013
2019
|
}
|
|
2014
|
-
function
|
|
2020
|
+
function Mr(e, t, n, r, i) {
|
|
2015
2021
|
let a = Math.min(n, r), o = Math.max(n, r);
|
|
2016
2022
|
return e === "row" ? [{
|
|
2017
2023
|
x1: t,
|
|
@@ -2035,7 +2041,7 @@ function Or(e, t, n, r, i) {
|
|
|
2035
2041
|
y2: t + i / 2
|
|
2036
2042
|
}];
|
|
2037
2043
|
}
|
|
2038
|
-
function
|
|
2044
|
+
function Nr(e, t) {
|
|
2039
2045
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0, a = 0;
|
|
2040
2046
|
for (let t of e) t.level > 0 && n.set(t.index, t.level), t.collapsed && r.set(t.index, !0), t.index > i && (i = t.index), t.level > a && (a = t.level);
|
|
2041
2047
|
let o = i, s = [];
|
|
@@ -2049,15 +2055,15 @@ function kr(e, t) {
|
|
|
2049
2055
|
for (let i = 1; i <= o + 1; i++) c(i) >= e ? n ? n.end = i : n = {
|
|
2050
2056
|
start: i,
|
|
2051
2057
|
end: i
|
|
2052
|
-
} : n &&= (s.push(
|
|
2053
|
-
n && s.push(
|
|
2058
|
+
} : n &&= (s.push(Pr(e, n, t, r, c)), null);
|
|
2059
|
+
n && s.push(Pr(e, n, t, r, c));
|
|
2054
2060
|
}
|
|
2055
2061
|
return {
|
|
2056
2062
|
maxLevel: a,
|
|
2057
2063
|
groups: s
|
|
2058
2064
|
};
|
|
2059
2065
|
}
|
|
2060
|
-
function
|
|
2066
|
+
function Pr(e, t, n, r, i) {
|
|
2061
2067
|
let a = null;
|
|
2062
2068
|
if (n) {
|
|
2063
2069
|
let n = t.end + 1;
|
|
@@ -2075,7 +2081,7 @@ function Ar(e, t, n, r, i) {
|
|
|
2075
2081
|
collapsed: o
|
|
2076
2082
|
};
|
|
2077
2083
|
}
|
|
2078
|
-
function
|
|
2084
|
+
function Fr(e, t) {
|
|
2079
2085
|
let n = !e.collapsed, r = /* @__PURE__ */ new Map();
|
|
2080
2086
|
for (let e of t) r.set(e.index, e);
|
|
2081
2087
|
let i = [], a = [];
|
|
@@ -2083,7 +2089,7 @@ function jr(e, t) {
|
|
|
2083
2089
|
else {
|
|
2084
2090
|
let n = /* @__PURE__ */ new Set();
|
|
2085
2091
|
for (let r of t) r.index >= e.start && r.index <= e.end && r.collapsed && n.add(r.index);
|
|
2086
|
-
for (let t = e.start; t <= e.end; t++)
|
|
2092
|
+
for (let t = e.start; t <= e.end; t++) Ir(t, e, r, n) || a.push(t);
|
|
2087
2093
|
}
|
|
2088
2094
|
return {
|
|
2089
2095
|
hide: i,
|
|
@@ -2091,7 +2097,7 @@ function jr(e, t) {
|
|
|
2091
2097
|
nowCollapsed: n
|
|
2092
2098
|
};
|
|
2093
2099
|
}
|
|
2094
|
-
function
|
|
2100
|
+
function Ir(e, t, n, r) {
|
|
2095
2101
|
let i = n.get(e)?.level ?? 0;
|
|
2096
2102
|
if (i <= t.level) return !1;
|
|
2097
2103
|
for (let e of r) {
|
|
@@ -2100,7 +2106,7 @@ function Mr(e, t, n, r) {
|
|
|
2100
2106
|
}
|
|
2101
2107
|
return !1;
|
|
2102
2108
|
}
|
|
2103
|
-
function
|
|
2109
|
+
function Lr(e, t) {
|
|
2104
2110
|
let n = [], r = [];
|
|
2105
2111
|
for (let i of e) i.level >= t ? n.push(i.index) : r.push(i.index);
|
|
2106
2112
|
return {
|
|
@@ -2108,7 +2114,7 @@ function Nr(e, t) {
|
|
|
2108
2114
|
show: r
|
|
2109
2115
|
};
|
|
2110
2116
|
}
|
|
2111
|
-
function
|
|
2117
|
+
function Rr(e) {
|
|
2112
2118
|
let t = [];
|
|
2113
2119
|
for (let n of e.rows) {
|
|
2114
2120
|
let e = n.outlineLevel ?? 0, r = n.collapsed ?? !1;
|
|
@@ -2121,7 +2127,7 @@ function Pr(e) {
|
|
|
2121
2127
|
}
|
|
2122
2128
|
return t;
|
|
2123
2129
|
}
|
|
2124
|
-
function
|
|
2130
|
+
function zr(e) {
|
|
2125
2131
|
let t = e.colOutlineLevels ?? {}, n = e.colCollapsed ?? {}, r = e.colHidden ?? {}, i = /* @__PURE__ */ new Set();
|
|
2126
2132
|
for (let e of Object.keys(t)) i.add(Number(e));
|
|
2127
2133
|
for (let e of Object.keys(n)) i.add(Number(e));
|
|
@@ -2134,7 +2140,7 @@ function Fr(e) {
|
|
|
2134
2140
|
});
|
|
2135
2141
|
return a;
|
|
2136
2142
|
}
|
|
2137
|
-
function
|
|
2143
|
+
function Br(e, t) {
|
|
2138
2144
|
let n = e.outlinePr;
|
|
2139
2145
|
return n ? t === "row" ? n.summaryBelow : n.summaryRight : !0;
|
|
2140
2146
|
}
|
|
@@ -2150,7 +2156,7 @@ var Z = class {
|
|
|
2150
2156
|
dispose() {
|
|
2151
2157
|
for (let e of this.cleanups.splice(0)) e();
|
|
2152
2158
|
}
|
|
2153
|
-
},
|
|
2159
|
+
}, Vr = class {
|
|
2154
2160
|
host;
|
|
2155
2161
|
rowGutter;
|
|
2156
2162
|
colGutter;
|
|
@@ -2173,12 +2179,12 @@ var Z = class {
|
|
|
2173
2179
|
this.listeners.on(this.rowGutter, "pointerdown", (e) => this.onPointerDown(e, "row")), this.listeners.on(this.colGutter, "pointerdown", (e) => this.onPointerDown(e, "col"));
|
|
2174
2180
|
}
|
|
2175
2181
|
rebuild(e) {
|
|
2176
|
-
this.rowOutlineBands =
|
|
2177
|
-
let t =
|
|
2182
|
+
this.rowOutlineBands = Rr(e), this.colOutlineBands = zr(e);
|
|
2183
|
+
let t = Nr(this.rowOutlineBands, Br(e, "row")), n = Nr(this.colOutlineBands, Br(e, "col"));
|
|
2178
2184
|
this.rowOutline = t.maxLevel > 0 ? t : null, this.colOutline = n.maxLevel > 0 ? n : null;
|
|
2179
2185
|
}
|
|
2180
2186
|
layout() {
|
|
2181
|
-
let e = this.host.scale(), t = this.rowOutline ? Math.round(
|
|
2187
|
+
let e = this.host.scale(), t = this.rowOutline ? Math.round(Ar(this.rowOutline.maxLevel) * e) : 0, n = this.colOutline ? Math.round(Ar(this.colOutline.maxLevel) * e) : 0;
|
|
2182
2188
|
this.extent = {
|
|
2183
2189
|
w: t,
|
|
2184
2190
|
h: n
|
|
@@ -2209,7 +2215,7 @@ var Z = class {
|
|
|
2209
2215
|
u.setTransform(l, 0, 0, l, 0, 0), u.clearRect(0, 0, s, c), u.fillStyle = r.background ?? "#f5f5f5", u.fillRect(0, 0, s, c);
|
|
2210
2216
|
let d = 19 * n;
|
|
2211
2217
|
u.strokeStyle = r.border ?? "#808080", u.lineWidth = 1, u.fillStyle = r.text ?? "#404040";
|
|
2212
|
-
let f =
|
|
2218
|
+
let f = z(t), p = f.effectiveFrozenBands({
|
|
2213
2219
|
scale: n,
|
|
2214
2220
|
width: this.host.canvasArea.clientWidth,
|
|
2215
2221
|
height: this.host.canvasArea.clientHeight,
|
|
@@ -2217,7 +2223,7 @@ var Z = class {
|
|
|
2217
2223
|
headerHeight: 22,
|
|
2218
2224
|
rows: t.freezeRows ?? 0,
|
|
2219
2225
|
cols: t.freezeCols ?? 0
|
|
2220
|
-
}), m = f.axesAtScale(n), h = i ? p.rows : p.cols, g = i ? m.row.offsetOf(p.rows + 1) : m.col.offsetOf(p.cols + 1), _ = (i ? 22 : 50) * n, v = (n, r) =>
|
|
2226
|
+
}), m = f.axesAtScale(n), h = i ? p.rows : p.cols, g = i ? m.row.offsetOf(p.rows + 1) : m.col.offsetOf(p.cols + 1), _ = (i ? 22 : 50) * n, v = (n, r) => jr(e, n, r, h, _, g, s, c, !i && t.rightToLeft === !0), y = (e, t) => {
|
|
2221
2227
|
let n = v(e, t);
|
|
2222
2228
|
return n.w <= 0 || n.h <= 0 ? !1 : (u.save(), u.beginPath(), u.rect(n.x, n.y, n.w, n.h), u.clip(), !0);
|
|
2223
2229
|
};
|
|
@@ -2227,7 +2233,7 @@ var Z = class {
|
|
|
2227
2233
|
let s = i ? a.y : this.host.screenX(a.x, a.w), c = i ? o.y + o.h : this.host.screenX(o.x, o.w) + o.w, l = Math.min(s, c), f = Math.max(s, c);
|
|
2228
2234
|
if (!t.collapsed && f - l > 1 && y(t.start, t.end)) {
|
|
2229
2235
|
u.beginPath();
|
|
2230
|
-
for (let t of
|
|
2236
|
+
for (let t of Mr(e, r, s, c, d)) u.moveTo(t.x1, t.y1), u.lineTo(t.x2, t.y2);
|
|
2231
2237
|
u.stroke(), u.restore();
|
|
2232
2238
|
}
|
|
2233
2239
|
if (t.summary != null) {
|
|
@@ -2240,7 +2246,7 @@ var Z = class {
|
|
|
2240
2246
|
}
|
|
2241
2247
|
let b = i ? 22 * n / 2 : 50 * n / 2;
|
|
2242
2248
|
for (let e = 1; e <= o.maxLevel + 1; e++) {
|
|
2243
|
-
let t =
|
|
2249
|
+
let t = kr(e) * n;
|
|
2244
2250
|
if (t + 12 * n / 2 > (i ? s : c) + .5) break;
|
|
2245
2251
|
this.drawLevelButton(u, i ? t : b, i ? b : t, String(e), n);
|
|
2246
2252
|
}
|
|
@@ -2270,7 +2276,7 @@ var Z = class {
|
|
|
2270
2276
|
let i = (n ? this.rowGutter : this.colGutter).getBoundingClientRect(), a = e.clientX - i.left, o = e.clientY - i.top, s = this.host.scale(), c = 19 * s, l = 7 * s, u = n ? 22 * s / 2 : 50 * s / 2;
|
|
2271
2277
|
if ((n ? o : a) <= (n ? 22 : 50) * s) {
|
|
2272
2278
|
for (let i = 1; i <= r.maxLevel + 1; i++) {
|
|
2273
|
-
let r =
|
|
2279
|
+
let r = kr(i) * s, c = n ? r : u, l = n ? u : r, d = 12 * s / 2;
|
|
2274
2280
|
if (Math.abs(a - c) <= d && Math.abs(o - l) <= d) {
|
|
2275
2281
|
e.preventDefault(), this.applyLevelButton(i, t);
|
|
2276
2282
|
return;
|
|
@@ -2292,7 +2298,7 @@ var Z = class {
|
|
|
2292
2298
|
applyGroupToggle(e, t) {
|
|
2293
2299
|
let n = this.host.worksheet();
|
|
2294
2300
|
if (!n) return;
|
|
2295
|
-
let { hide: r, show: i, nowCollapsed: a } =
|
|
2301
|
+
let { hide: r, show: i, nowCollapsed: a } = Fr(e, t === "row" ? this.rowOutlineBands : this.colOutlineBands);
|
|
2296
2302
|
for (let e of r) this.host.setBandHidden(t, e, !0);
|
|
2297
2303
|
for (let e of i) this.host.setBandHidden(t, e, !1);
|
|
2298
2304
|
e.summary != null && this.host.setBandCollapsed(t, e.summary, a), this.host.afterOutlineMutation(n, a && e.summary != null ? {
|
|
@@ -2303,7 +2309,7 @@ var Z = class {
|
|
|
2303
2309
|
applyLevelButton(e, t) {
|
|
2304
2310
|
let n = this.host.worksheet();
|
|
2305
2311
|
if (!n) return;
|
|
2306
|
-
let { hide: r, show: i } =
|
|
2312
|
+
let { hide: r, show: i } = Lr(t === "row" ? this.rowOutlineBands : this.colOutlineBands, e);
|
|
2307
2313
|
for (let e of r) this.host.setBandHidden(t, e, !0);
|
|
2308
2314
|
for (let e of i) this.host.setBandHidden(t, e, !1);
|
|
2309
2315
|
let a = t === "row" ? this.rowOutline : this.colOutline;
|
|
@@ -2313,7 +2319,7 @@ var Z = class {
|
|
|
2313
2319
|
destroy() {
|
|
2314
2320
|
this.listeners.dispose(), this.rowOutlineBands = [], this.colOutlineBands = [], this.rowOutline = null, this.colOutline = null;
|
|
2315
2321
|
}
|
|
2316
|
-
},
|
|
2322
|
+
}, Hr = 30, Ur = 50, Wr = 1, Gr = .45, Q = 8, Kr = 320, qr = " (right-click for sheet list)", Jr = /^#[0-9A-Fa-f]{6}$/, Yr = class {
|
|
2317
2323
|
host;
|
|
2318
2324
|
tabBar;
|
|
2319
2325
|
tabStrip;
|
|
@@ -2337,9 +2343,9 @@ var Z = class {
|
|
|
2337
2343
|
rtl = !1;
|
|
2338
2344
|
openTimer;
|
|
2339
2345
|
constructor(e, t) {
|
|
2340
|
-
this.host = t, this.ownerDocument = e, this.tabBar = e.createElement("div"), this.tabBar.style.cssText = `display:flex;align-items:flex-end;height:${
|
|
2346
|
+
this.host = t, this.ownerDocument = e, this.tabBar = e.createElement("div"), this.tabBar.style.cssText = `display:flex;align-items:flex-end;height:${Hr}px;flex-shrink:0;background:var(--ooxml-xlsx-chrome-background,#f0f0f0);border-top:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);`, this.navPrev = this.makeNavButton("◀", "Scroll tabs left", () => this.scrollTabs(-1)), this.navNext = this.makeNavButton("▶", "Scroll tabs right", () => this.scrollTabs(1)), this.navPrev.dataset.xlsxTabNav = "prev", this.navNext.dataset.xlsxTabNav = "next";
|
|
2341
2347
|
let n = e.createElement("div");
|
|
2342
|
-
n.style.cssText = `display:flex;flex-shrink:0;width:${
|
|
2348
|
+
n.style.cssText = `display:flex;flex-shrink:0;width:${Ur}px;height:100%;`, n.appendChild(this.navPrev), n.appendChild(this.navNext), this.navGroup = n, this.tabStrip = e.createElement("div"), this.tabStrip.style.cssText = `position:relative;display:block;flex:1;min-width:0;height:100%;margin-left:${Wr}px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;`, this.tabStrip.classList.add("xlsx-tab-strip"), this.listeners.on(this.tabStrip, "scroll", () => this.updateNavButtons()), this.tabList = e.createElement("div"), this.tabList.style.cssText = `display:flex;align-items:flex-end;height:100%;gap:${Wr}px;box-sizing:border-box;`, this.tabList.style.width = "max-content", this.tabList.style.minWidth = "100%", this.tabStrip.appendChild(this.tabList), this.tabBar.appendChild(n), this.tabBar.appendChild(this.tabStrip), this.sheetList = e.createElement("div"), this.popoverSupported = typeof this.sheetList.showPopover == "function", this.popoverSupported && this.initSheetList();
|
|
2343
2349
|
}
|
|
2344
2350
|
append(e) {
|
|
2345
2351
|
this.tabBar.appendChild(e);
|
|
@@ -2347,7 +2353,7 @@ var Z = class {
|
|
|
2347
2353
|
build(e, t) {
|
|
2348
2354
|
this.cancelPendingOpen(), this.closeSheetList(), this.sheetNames = e, this.tabListeners.dispose(), this.tabListeners = new Z(), this.tabList.innerHTML = "", this.tabs = [], this.tabColors = e.map((e, n) => {
|
|
2349
2355
|
let r = t[n];
|
|
2350
|
-
return r &&
|
|
2356
|
+
return r && Jr.test(r) ? r : null;
|
|
2351
2357
|
}), e.forEach((e, t) => {
|
|
2352
2358
|
let n = this.ownerDocument.createElement("button");
|
|
2353
2359
|
n.textContent = e, n.title = e, this.styleTab(n, t, !1), this.tabListeners.on(n, "click", () => this.host.selectSheet(t)), this.tabList.appendChild(n), this.tabs.push(n);
|
|
@@ -2394,10 +2400,10 @@ var Z = class {
|
|
|
2394
2400
|
this.updateNavButtons();
|
|
2395
2401
|
}
|
|
2396
2402
|
setDirection(e) {
|
|
2397
|
-
this.rtl = e, this.tabBar.style.flexDirection = e ? "row-reverse" : "row", this.tabStrip.style.marginLeft = e ? "0" : `${
|
|
2403
|
+
this.rtl = e, this.tabBar.style.flexDirection = e ? "row-reverse" : "row", this.tabStrip.style.marginLeft = e ? "0" : `${Wr}px`, this.tabStrip.style.marginRight = e ? `${Wr}px` : "0", this.tabList.style.flexDirection = e ? "row-reverse" : "row";
|
|
2398
2404
|
}
|
|
2399
2405
|
tabStyle(e) {
|
|
2400
|
-
return e ? `display:inline-block;flex:none;padding:0 14px;position:relative;border:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);border-bottom:none;border-radius:3px 3px 0 0;cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;outline:none;box-sizing:border-box;height:${
|
|
2406
|
+
return e ? `display:inline-block;flex:none;padding:0 14px;position:relative;border:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);border-bottom:none;border-radius:3px 3px 0 0;cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;outline:none;box-sizing:border-box;height:${Hr - 2}px;font-size:13px;background:var(--ooxml-xlsx-chrome-surface,#fff);color:var(--ooxml-xlsx-chrome-text,#000);border-bottom:1px solid var(--ooxml-xlsx-chrome-surface,#fff);font-weight:600;top:1px;` : `display:inline-block;flex:none;padding:0 14px;position:relative;border:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);border-bottom:none;border-radius:3px 3px 0 0;cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;outline:none;box-sizing:border-box;height:${Hr - 5}px;font-size:11px;background:var(--ooxml-xlsx-chrome-surface-muted,#e0e0e0);color:var(--ooxml-xlsx-chrome-text-muted,#555);`;
|
|
2401
2407
|
}
|
|
2402
2408
|
styleTab(e, t, n) {
|
|
2403
2409
|
e.style.cssText = this.tabCss(t, n);
|
|
@@ -2406,11 +2412,11 @@ var Z = class {
|
|
|
2406
2412
|
}
|
|
2407
2413
|
tabCss(e, t) {
|
|
2408
2414
|
let n = this.tabStyle(t), r = this.host.hiddenSheetMode();
|
|
2409
|
-
return r !== "show" && this.host.isHidden(e) && (n += r === "skip" ? "display:none;" : `opacity:${
|
|
2415
|
+
return r !== "show" && this.host.isHidden(e) && (n += r === "skip" ? "display:none;" : `opacity:${Gr};`), n;
|
|
2410
2416
|
}
|
|
2411
2417
|
initSheetList() {
|
|
2412
2418
|
let e = this.sheetList;
|
|
2413
|
-
e.setAttribute("popover", "auto"), e.setAttribute("role", "group"), e.setAttribute("aria-label", "Sheets"), e.dataset.xlsxSheetList = "", e.style.cssText = `inset:auto;margin:0;padding:4px 0;box-sizing:border-box;min-width:${
|
|
2419
|
+
e.setAttribute("popover", "auto"), e.setAttribute("role", "group"), e.setAttribute("aria-label", "Sheets"), e.dataset.xlsxSheetList = "", e.style.cssText = `inset:auto;margin:0;padding:4px 0;box-sizing:border-box;min-width:${Ur}px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;background:var(--ooxml-xlsx-chrome-surface,#fff);color:var(--ooxml-xlsx-chrome-text,#000);border:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);border-radius:4px;box-shadow:0 4px 16px rgba(0,0,0,0.2);`, this.tabBar.appendChild(e), this.navPrev.title += qr, this.navNext.title += qr, this.listeners.on(this.navGroup, "contextmenu", (e) => this.onNavContextMenu(e)), this.listeners.on(this.navGroup, "pointerdown", (e) => this.onNavPointerDown(e)), this.listeners.on(this.navGroup, "pointerup", (e) => this.onNavPointerUp(e)), this.listeners.on(this.navGroup, "pointercancel", (e) => this.onNavPointerCancel(e)), this.listeners.on(e, "click", (e) => this.onSheetListClick(e)), this.listeners.on(e, "keydown", (e) => this.onSheetListKeyDown(e)), this.listeners.on(e, "toggle", (e) => {
|
|
2414
2420
|
e.newState === "closed" && (this.listItems = [], this.sheetList.replaceChildren());
|
|
2415
2421
|
});
|
|
2416
2422
|
}
|
|
@@ -2481,11 +2487,11 @@ var Z = class {
|
|
|
2481
2487
|
let t = this.listItems[e];
|
|
2482
2488
|
if (!t) return;
|
|
2483
2489
|
let n = e === this.activeIndex, r = "display:block;width:100%;box-sizing:border-box;margin:0;padding:4px 16px 4px 12px;border:none;text-align:start;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;color:inherit;cursor:pointer;";
|
|
2484
|
-
r += n ? "font-weight:600;background:var(--ooxml-xlsx-chrome-surface-muted,#e0e0e0);" : "background:transparent;", this.host.hiddenSheetMode() === "dim" && this.host.isHidden(e) && (r += `opacity:${
|
|
2490
|
+
r += n ? "font-weight:600;background:var(--ooxml-xlsx-chrome-surface-muted,#e0e0e0);" : "background:transparent;", this.host.hiddenSheetMode() === "dim" && this.host.isHidden(e) && (r += `opacity:${Gr};`), t.style.cssText = r, n ? t.setAttribute("aria-current", "true") : t.removeAttribute("aria-current");
|
|
2485
2491
|
}
|
|
2486
2492
|
placeSheetList(e) {
|
|
2487
2493
|
let t = this.sheetList, n = this.ownerDocument.documentElement, r = e.getBoundingClientRect(), i = r.top - Q, a = n.clientHeight - r.bottom - Q, o = i >= a;
|
|
2488
|
-
t.style.maxHeight = `${Math.max(0, Math.floor(o ? i : a))}px`, t.style.maxWidth = `${Math.max(0, Math.min(
|
|
2494
|
+
t.style.maxHeight = `${Math.max(0, Math.floor(o ? i : a))}px`, t.style.maxWidth = `${Math.max(0, Math.min(Kr, n.clientWidth - 2 * Q))}px`;
|
|
2489
2495
|
let { width: s, height: c } = t.getBoundingClientRect();
|
|
2490
2496
|
t.style.top = `${o ? r.top - c : r.bottom}px`;
|
|
2491
2497
|
let l = this.rtl ? r.right - s : r.left;
|
|
@@ -2514,15 +2520,15 @@ var Z = class {
|
|
|
2514
2520
|
destroy() {
|
|
2515
2521
|
this.cancelPendingOpen(), this.closeSheetList(), this.listItems = [], this.tabListeners.dispose(), this.listeners.dispose();
|
|
2516
2522
|
}
|
|
2517
|
-
},
|
|
2518
|
-
function
|
|
2523
|
+
}, Xr = 2;
|
|
2524
|
+
function Zr(e, t, n) {
|
|
2519
2525
|
return e <= 50 ? t + e / 50 * (1 - t) : 1 + (e - 50) / 50 * (n - 1);
|
|
2520
2526
|
}
|
|
2521
|
-
function
|
|
2527
|
+
function Qr(e, t, n) {
|
|
2522
2528
|
let r = Math.min(n, Math.max(t, e));
|
|
2523
2529
|
return r <= 1 ? (r - t) / (1 - t) * 50 : 50 + (r - 1) / (n - 1) * 50;
|
|
2524
2530
|
}
|
|
2525
|
-
var
|
|
2531
|
+
var $r = class {
|
|
2526
2532
|
host;
|
|
2527
2533
|
element;
|
|
2528
2534
|
slider;
|
|
@@ -2536,43 +2542,43 @@ var Yr = class {
|
|
|
2536
2542
|
let i = e.createElement("button");
|
|
2537
2543
|
return i.type = "button", i.textContent = t, i.setAttribute("aria-label", n), i.title = n, i.style.cssText = "width:18px;height:18px;padding:0;border:none;background:transparent;color:var(--ooxml-xlsx-chrome-text-muted,#555);font-size:14px;line-height:1;cursor:pointer;border-radius:3px;", this.listeners.on(i, "click", r), i;
|
|
2538
2544
|
}, s = e.createElement("input");
|
|
2539
|
-
s.type = "range", s.min = "0", s.max = "100", s.step = "any", s.value = String(
|
|
2540
|
-
let e = Number(s.value), t = Math.abs(e - 50) <=
|
|
2541
|
-
t === 50 && (s.value = "50"), this.host.setScale(
|
|
2545
|
+
s.type = "range", s.min = "0", s.max = "100", s.step = "any", s.value = String(Qr(n, r, i)), s.setAttribute("aria-label", "Zoom"), s.title = "Zoom", s.classList.add("xlsx-zoom-slider"), s.style.cssText = "width:90px;cursor:pointer;", this.listeners.on(s, "input", () => {
|
|
2546
|
+
let e = Number(s.value), t = Math.abs(e - 50) <= Xr ? 50 : e;
|
|
2547
|
+
t === 50 && (s.value = "50"), this.host.setScale(Zr(t, r, i));
|
|
2542
2548
|
});
|
|
2543
2549
|
let c = e.createElement("span");
|
|
2544
2550
|
c.textContent = `${Math.round(n * 100)}%`, c.style.cssText = "min-width:42px;margin-left:6px;text-align:right;font-variant-numeric:tabular-nums;", a.appendChild(o("−", "Zoom out", () => this.host.zoomOut())), a.appendChild(s), a.appendChild(o("+", "Zoom in", () => this.host.zoomIn())), a.appendChild(c), this.element = a, this.slider = s, this.label = c;
|
|
2545
2551
|
}
|
|
2546
2552
|
sync(e, t, n, r) {
|
|
2547
|
-
this.slider.value = String(
|
|
2553
|
+
this.slider.value = String(Qr(e, n, r)), this.label.textContent = `${t}%`;
|
|
2548
2554
|
}
|
|
2549
2555
|
destroy() {
|
|
2550
2556
|
this.listeners.dispose();
|
|
2551
2557
|
}
|
|
2552
2558
|
};
|
|
2553
|
-
function
|
|
2559
|
+
function ei(e, t, n) {
|
|
2554
2560
|
if (!e) return !1;
|
|
2555
2561
|
for (let r of e.split(/\s+/)) {
|
|
2556
2562
|
if (!r) continue;
|
|
2557
|
-
let [e, i] = r.split(":"), a =
|
|
2563
|
+
let [e, i] = r.split(":"), a = L(e);
|
|
2558
2564
|
if (!a) continue;
|
|
2559
2565
|
if (!i) {
|
|
2560
2566
|
if (a.row === t && a.col === n) return !0;
|
|
2561
2567
|
continue;
|
|
2562
2568
|
}
|
|
2563
|
-
let o =
|
|
2569
|
+
let o = L(i);
|
|
2564
2570
|
if (!o) continue;
|
|
2565
2571
|
let s = Math.min(a.row, o.row), c = Math.max(a.row, o.row), l = Math.min(a.col, o.col), u = Math.max(a.col, o.col);
|
|
2566
2572
|
if (t >= s && t <= c && n >= l && n <= u) return !0;
|
|
2567
2573
|
}
|
|
2568
2574
|
return !1;
|
|
2569
2575
|
}
|
|
2570
|
-
function
|
|
2576
|
+
function ti(e, t, n) {
|
|
2571
2577
|
if (!e) return null;
|
|
2572
|
-
for (let r of e) if (r.validationType === "list" &&
|
|
2578
|
+
for (let r of e) if (r.validationType === "list" && ei(r.sqref, t, n)) return r;
|
|
2573
2579
|
return null;
|
|
2574
2580
|
}
|
|
2575
|
-
var
|
|
2581
|
+
var ni = class {
|
|
2576
2582
|
host;
|
|
2577
2583
|
panel;
|
|
2578
2584
|
panelKey = null;
|
|
@@ -2595,7 +2601,7 @@ var Qr = class {
|
|
|
2595
2601
|
drawDropdown() {
|
|
2596
2602
|
if (this.arrowRect = null, this.host.selectionMode() !== "cells") return;
|
|
2597
2603
|
let e = this.host.worksheet(), t = this.host.activeCell();
|
|
2598
|
-
if (!e || !t || !
|
|
2604
|
+
if (!e || !t || !ti(e.dataValidations, t.row, t.col)) return;
|
|
2599
2605
|
let n = this.host.cellRect(t.row, t.col);
|
|
2600
2606
|
if (!n) return;
|
|
2601
2607
|
let r = this.host.scale(), i = Math.round(50 * r), a = Math.round(22 * r), o = Math.max(14, Math.min(n.h, 22 * r)), s = n.x + n.w, c = n.y;
|
|
@@ -2618,7 +2624,7 @@ var Qr = class {
|
|
|
2618
2624
|
this.hide();
|
|
2619
2625
|
return;
|
|
2620
2626
|
}
|
|
2621
|
-
let r =
|
|
2627
|
+
let r = ti(e.dataValidations, t.row, t.col);
|
|
2622
2628
|
r && (this.hide(), this.panelKey = n, this.open(t, r.formula1));
|
|
2623
2629
|
}
|
|
2624
2630
|
async open(e, t) {
|
|
@@ -2663,7 +2669,7 @@ var Qr = class {
|
|
|
2663
2669
|
if (!t) return;
|
|
2664
2670
|
let n = this.host.screenX(t.x, t.w);
|
|
2665
2671
|
this.panel.style.left = "-9999px", this.panel.style.top = "-9999px", this.panel.style.display = "block";
|
|
2666
|
-
let r =
|
|
2672
|
+
let r = Tn({
|
|
2667
2673
|
cell: {
|
|
2668
2674
|
x: n,
|
|
2669
2675
|
y: t.y,
|
|
@@ -2695,22 +2701,22 @@ var Qr = class {
|
|
|
2695
2701
|
this.hide(), this.itemListeners.dispose();
|
|
2696
2702
|
}
|
|
2697
2703
|
};
|
|
2698
|
-
function
|
|
2704
|
+
function ri(e) {
|
|
2699
2705
|
let t = e.trim();
|
|
2700
2706
|
return t.startsWith("#") && (t = t.slice(1).trim()), t.startsWith("=") && (t = t.slice(1).trim()), t;
|
|
2701
2707
|
}
|
|
2702
|
-
function
|
|
2708
|
+
function ii(e) {
|
|
2703
2709
|
let t = !1, n = -1;
|
|
2704
2710
|
for (let r = 0; r < e.length; r++) e[r] === "'" ? t && e[r + 1] === "'" ? r++ : t = !t : e[r] === "!" && !t && (n = r);
|
|
2705
2711
|
return t ? -1 : n;
|
|
2706
2712
|
}
|
|
2707
|
-
function
|
|
2713
|
+
function ai(e) {
|
|
2708
2714
|
let t = e.trim();
|
|
2709
2715
|
return t.length >= 2 && t.startsWith("'") && t.endsWith("'") ? t.slice(1, -1).replace(/''/g, "'") : t;
|
|
2710
2716
|
}
|
|
2711
|
-
function
|
|
2712
|
-
let r =
|
|
2713
|
-
if (!
|
|
2717
|
+
function oi(e, t, n) {
|
|
2718
|
+
let r = ii(e), i = r >= 0 ? ai(e.slice(0, r)) : void 0, a = (r >= 0 ? e.slice(r + 1) : e).split(":", 1)[0]?.trim() ?? "";
|
|
2719
|
+
if (!L(a)) return null;
|
|
2714
2720
|
let o = t;
|
|
2715
2721
|
if (i !== void 0) {
|
|
2716
2722
|
let e = i.toLocaleLowerCase("en-US");
|
|
@@ -2721,22 +2727,22 @@ function ni(e, t, n) {
|
|
|
2721
2727
|
cellRef: a
|
|
2722
2728
|
};
|
|
2723
2729
|
}
|
|
2724
|
-
function
|
|
2730
|
+
function si(e, t, n, r) {
|
|
2725
2731
|
let i = /* @__PURE__ */ new Map();
|
|
2726
2732
|
for (let e of r) i.set(e.name.toLocaleLowerCase("en-US"), e);
|
|
2727
|
-
let a =
|
|
2733
|
+
let a = ri(e), o = /* @__PURE__ */ new Set();
|
|
2728
2734
|
for (;;) {
|
|
2729
|
-
let e =
|
|
2735
|
+
let e = oi(a, t, n);
|
|
2730
2736
|
if (e) return e;
|
|
2731
2737
|
let r = a.toLocaleLowerCase("en-US");
|
|
2732
2738
|
if (!r || o.has(r)) return null;
|
|
2733
2739
|
o.add(r);
|
|
2734
2740
|
let s = i.get(r);
|
|
2735
2741
|
if (!s) return null;
|
|
2736
|
-
a =
|
|
2742
|
+
a = ri(s.formula);
|
|
2737
2743
|
}
|
|
2738
2744
|
}
|
|
2739
|
-
var
|
|
2745
|
+
var ci = class {
|
|
2740
2746
|
host;
|
|
2741
2747
|
hyperlinkMap = /* @__PURE__ */ new Map();
|
|
2742
2748
|
constructor(e) {
|
|
@@ -2763,16 +2769,16 @@ var ii = class {
|
|
|
2763
2769
|
};
|
|
2764
2770
|
else return !1;
|
|
2765
2771
|
let r = this.host.onHyperlinkClick();
|
|
2766
|
-
return r ? (r(n), !0) : (n.kind === "external" ?
|
|
2772
|
+
return r ? (r(n), !0) : (n.kind === "external" ? ae(n.url, void 0, this.host.hostWindow) : this.navigateInternal(n.ref).catch((e) => this.host.reportError(e)), !0);
|
|
2767
2773
|
}
|
|
2768
2774
|
async navigateInternal(e) {
|
|
2769
|
-
let t =
|
|
2775
|
+
let t = si(e, this.host.currentSheet(), this.host.sheetNames(), this.host.definedNames());
|
|
2770
2776
|
t && (t.sheetIndex !== this.host.currentSheet() && await this.host.goToSheet(t.sheetIndex), await this.host.scrollToCell(t.cellRef));
|
|
2771
2777
|
}
|
|
2772
2778
|
destroy() {
|
|
2773
2779
|
this.hyperlinkMap.clear();
|
|
2774
2780
|
}
|
|
2775
|
-
},
|
|
2781
|
+
}, li = class {
|
|
2776
2782
|
_sheetCount;
|
|
2777
2783
|
_sheetName;
|
|
2778
2784
|
_collectSheetCells;
|
|
@@ -2805,7 +2811,7 @@ var ii = class {
|
|
|
2805
2811
|
return t ? {
|
|
2806
2812
|
sheet: t.sheet,
|
|
2807
2813
|
sheetName: t.sheetName,
|
|
2808
|
-
ref:
|
|
2814
|
+
ref: ut(t.row, t.col),
|
|
2809
2815
|
row: t.row,
|
|
2810
2816
|
col: t.col
|
|
2811
2817
|
} : null;
|
|
@@ -2834,27 +2840,28 @@ var ii = class {
|
|
|
2834
2840
|
}
|
|
2835
2841
|
if (n !== this._generation) return [];
|
|
2836
2842
|
let o = this._sheetName(a);
|
|
2837
|
-
for (let n of r) {
|
|
2838
|
-
let
|
|
2839
|
-
for (let e of
|
|
2840
|
-
let t = e.slices[0],
|
|
2843
|
+
for (let n of r) for (let r of [n.text, ...n.alternates ?? []]) {
|
|
2844
|
+
let s = Ce(Oe([{ text: r }]), e, t);
|
|
2845
|
+
for (let e of s) {
|
|
2846
|
+
let t = e.slices[0], s = r.slice(t.start, t.end);
|
|
2841
2847
|
i.push({
|
|
2842
2848
|
sheet: a,
|
|
2843
2849
|
sheetName: o,
|
|
2844
2850
|
row: n.row,
|
|
2845
2851
|
col: n.col,
|
|
2846
|
-
text:
|
|
2852
|
+
text: s
|
|
2847
2853
|
});
|
|
2848
2854
|
}
|
|
2855
|
+
if (s.length > 0) break;
|
|
2849
2856
|
}
|
|
2850
2857
|
}
|
|
2851
2858
|
return n === this._generation ? (this._matches = i, this._active = -1, this.matches()) : [];
|
|
2852
2859
|
}
|
|
2853
2860
|
next() {
|
|
2854
|
-
return this._active =
|
|
2861
|
+
return this._active = Ae(this._active, this._matches.length), this._activePublic();
|
|
2855
2862
|
}
|
|
2856
2863
|
prev() {
|
|
2857
|
-
return this._active =
|
|
2864
|
+
return this._active = ke(this._active, this._matches.length), this._activePublic();
|
|
2858
2865
|
}
|
|
2859
2866
|
_activePublic() {
|
|
2860
2867
|
let e = this._locationAt(this._active);
|
|
@@ -2864,32 +2871,37 @@ var ii = class {
|
|
|
2864
2871
|
location: e
|
|
2865
2872
|
} : null;
|
|
2866
2873
|
}
|
|
2867
|
-
},
|
|
2868
|
-
function
|
|
2869
|
-
let n = e ? "#fb8c00" : "#ffb300", r = e ? t.active : t.match, i = r ?? (e ?
|
|
2874
|
+
}, ui = "color-mix(in srgb, #ffb300 8%, transparent)", di = "color-mix(in srgb, #fb8c00 8%, transparent)";
|
|
2875
|
+
function fi(e, t = {}) {
|
|
2876
|
+
let n = e ? "#fb8c00" : "#ffb300", r = e ? t.active : t.match, i = r ?? (e ? di : ui);
|
|
2870
2877
|
return {
|
|
2871
2878
|
border: `2px solid ${r ?? n}`,
|
|
2872
2879
|
background: i
|
|
2873
2880
|
};
|
|
2874
2881
|
}
|
|
2875
|
-
var
|
|
2882
|
+
var pi = class {
|
|
2876
2883
|
host;
|
|
2877
2884
|
controller;
|
|
2878
2885
|
constructor(e) {
|
|
2879
|
-
this.host = e, this.controller = new
|
|
2886
|
+
this.host = e, this.controller = new li(() => e.sheetCount(), (t) => e.workbook()?.sheetNames[t] ?? "", (e) => this.collectSheetCells(e));
|
|
2880
2887
|
}
|
|
2881
2888
|
async collectSheetCells(e) {
|
|
2882
2889
|
let t = this.host.workbook();
|
|
2883
2890
|
if (!t) return [];
|
|
2884
|
-
let n = await
|
|
2891
|
+
let n = await Yn(t, e);
|
|
2885
2892
|
try {
|
|
2886
|
-
let e = n.worksheet, r = [];
|
|
2887
|
-
for (let
|
|
2888
|
-
let n =
|
|
2889
|
-
|
|
2890
|
-
row:
|
|
2891
|
-
col:
|
|
2892
|
-
text:
|
|
2893
|
+
let e = n.worksheet, r = [], i = t[qn](e);
|
|
2894
|
+
for (let t of e.rows) for (let e of t.cells) {
|
|
2895
|
+
let [t = "", ...n] = i(e);
|
|
2896
|
+
t !== "" && r.push(n.length > 0 ? {
|
|
2897
|
+
row: e.row,
|
|
2898
|
+
col: e.col,
|
|
2899
|
+
text: t,
|
|
2900
|
+
alternates: n
|
|
2901
|
+
} : {
|
|
2902
|
+
row: e.row,
|
|
2903
|
+
col: e.col,
|
|
2904
|
+
text: t
|
|
2893
2905
|
});
|
|
2894
2906
|
}
|
|
2895
2907
|
return r;
|
|
@@ -2905,7 +2917,7 @@ var li = class {
|
|
|
2905
2917
|
e.clearFind();
|
|
2906
2918
|
let t = this.host.worksheet();
|
|
2907
2919
|
if (!t) return;
|
|
2908
|
-
let n = this.host.scale(), r = (e) => Math.round(e * n), i = r(50), a = r(22), o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c =
|
|
2920
|
+
let n = this.host.scale(), r = (e) => Math.round(e * n), i = r(50), a = r(22), o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = z(t).roundedFrozenExtent(n), l = i + c.width, u = a + c.height, d = this.host.highlightColors(), f = fi(!1, d), p = fi(!0, d);
|
|
2909
2921
|
for (let t of this.controller.sheetHighlights(this.host.currentSheet())) {
|
|
2910
2922
|
let n = this.host.cellRect(t.row, t.col);
|
|
2911
2923
|
if (!n) continue;
|
|
@@ -2937,8 +2949,8 @@ var li = class {
|
|
|
2937
2949
|
destroy() {
|
|
2938
2950
|
this.controller.invalidate();
|
|
2939
2951
|
}
|
|
2940
|
-
},
|
|
2941
|
-
function
|
|
2952
|
+
}, mi = 25e4, hi = 8 * 1024 * 1024;
|
|
2953
|
+
function gi(e, t) {
|
|
2942
2954
|
let n = 0, r = !1;
|
|
2943
2955
|
for (let t = 0; t < e.length; t++) {
|
|
2944
2956
|
let i = e.charCodeAt(t);
|
|
@@ -2946,7 +2958,7 @@ function fi(e, t) {
|
|
|
2946
2958
|
}
|
|
2947
2959
|
return e.length + (r ? n + 2 : 0) > t ? null : r ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
2948
2960
|
}
|
|
2949
|
-
var
|
|
2961
|
+
var _i = class {
|
|
2950
2962
|
host;
|
|
2951
2963
|
constructor(e) {
|
|
2952
2964
|
this.host = e;
|
|
@@ -2981,12 +2993,12 @@ var pi = class {
|
|
|
2981
2993
|
c1: n.left,
|
|
2982
2994
|
c2: n.right
|
|
2983
2995
|
}, u = s - o + 1, d = l - c + 1;
|
|
2984
|
-
if (u > Math.floor(
|
|
2996
|
+
if (u > Math.floor(mi / d)) return {
|
|
2985
2997
|
status: "too-large",
|
|
2986
2998
|
limit: "cells"
|
|
2987
2999
|
};
|
|
2988
3000
|
let f = u * d, p = Math.max(0, u - 1) + u * Math.max(0, d - 1);
|
|
2989
|
-
if (p >
|
|
3001
|
+
if (p > hi) return {
|
|
2990
3002
|
status: "too-large",
|
|
2991
3003
|
limit: "text"
|
|
2992
3004
|
};
|
|
@@ -2995,7 +3007,7 @@ var pi = class {
|
|
|
2995
3007
|
if (n.col < c || n.col > l) continue;
|
|
2996
3008
|
let i = n.value, a = r?.cellText(e, n) ?? "";
|
|
2997
3009
|
if (r || (i.type === "text" ? a = i.runs ? i.runs.map((e) => e.text).join("") : i.text : i.type === "number" ? a = String(i.number) : i.type === "bool" ? a = i.bool ? "TRUE" : "FALSE" : i.type === "error" && (a = i.error)), a) {
|
|
2998
|
-
let e =
|
|
3010
|
+
let e = gi(a, hi - p);
|
|
2999
3011
|
if (e === null) return {
|
|
3000
3012
|
status: "too-large",
|
|
3001
3013
|
limit: "text"
|
|
@@ -3026,29 +3038,29 @@ var pi = class {
|
|
|
3026
3038
|
return { status: "clipboard-denied" };
|
|
3027
3039
|
}
|
|
3028
3040
|
}
|
|
3029
|
-
},
|
|
3030
|
-
function
|
|
3041
|
+
}, vi = 40, yi = 900;
|
|
3042
|
+
function bi(e, t) {
|
|
3031
3043
|
if (t <= 0) return 0;
|
|
3032
|
-
let n = Math.min(
|
|
3033
|
-
return e < n ? -900 * Math.min(1, Math.max(0, (n - e) / n)) : e > t - n ?
|
|
3044
|
+
let n = Math.min(vi, t / 2);
|
|
3045
|
+
return e < n ? -900 * Math.min(1, Math.max(0, (n - e) / n)) : e > t - n ? yi * Math.min(1, Math.max(0, (e - (t - n)) / n)) : 0;
|
|
3034
3046
|
}
|
|
3035
|
-
function
|
|
3047
|
+
function xi(e, t, n, r) {
|
|
3036
3048
|
if (r === "all") return {
|
|
3037
3049
|
x: 0,
|
|
3038
3050
|
y: 0
|
|
3039
3051
|
};
|
|
3040
|
-
let i = r === "rows" ? 0 :
|
|
3052
|
+
let i = r === "rows" ? 0 : bi(e.x, t.width), a = r === "cols" ? 0 : bi(e.y, t.height);
|
|
3041
3053
|
return {
|
|
3042
3054
|
x: n ? -i : i,
|
|
3043
3055
|
y: a
|
|
3044
3056
|
};
|
|
3045
3057
|
}
|
|
3046
|
-
var
|
|
3047
|
-
function
|
|
3058
|
+
var Si = 4, Ci = 5, wi = 16384;
|
|
3059
|
+
function Ti(e, t, n, r) {
|
|
3048
3060
|
for (let { index: i, edge: a } of t) if (!(a <= r) && Math.abs(e - a) <= n) return i;
|
|
3049
3061
|
return null;
|
|
3050
3062
|
}
|
|
3051
|
-
var
|
|
3063
|
+
var Ei = class {
|
|
3052
3064
|
host;
|
|
3053
3065
|
cleanups = [];
|
|
3054
3066
|
pendingTap = null;
|
|
@@ -3100,7 +3112,7 @@ var Si = class {
|
|
|
3100
3112
|
let i = this.host.scale(), a = this.host.canvasArea.getBoundingClientRect(), o = this.host.screenX(e - a.left, 0), s = t - a.top, c = Math.round(50 * i), l = Math.round(22 * i), u = o < c, d = s < l;
|
|
3101
3113
|
if (!u && !d) return null;
|
|
3102
3114
|
if (u && d) return { kind: "corner" };
|
|
3103
|
-
let f =
|
|
3115
|
+
let f = z(r), p = n === "logical" ? {
|
|
3104
3116
|
x: this.host.scrollLeft(),
|
|
3105
3117
|
y: this.host.scrollTop()
|
|
3106
3118
|
} : this.host.displayedViewportOffset();
|
|
@@ -3124,7 +3136,7 @@ var Si = class {
|
|
|
3124
3136
|
getResizeTarget(e, t) {
|
|
3125
3137
|
let n = this.host.worksheet();
|
|
3126
3138
|
if (!n) return null;
|
|
3127
|
-
let r = this.host.scale(), i = this.host.canvasArea.getBoundingClientRect(), a = this.host.screenX(e - i.left, 0), o = t - i.top, s = Math.round(50 * r), c = Math.round(22 * r), l =
|
|
3139
|
+
let r = this.host.scale(), i = this.host.canvasArea.getBoundingClientRect(), a = this.host.screenX(e - i.left, 0), o = t - i.top, s = Math.round(50 * r), c = Math.round(22 * r), l = z(n), u = l.maximumDigitWidth, d = l.axesAtScale(r);
|
|
3128
3140
|
if (o <= c && a > s) {
|
|
3129
3141
|
let n = this.getHeaderHit(e, t);
|
|
3130
3142
|
if (n?.kind !== "col") return null;
|
|
@@ -3137,7 +3149,7 @@ var Si = class {
|
|
|
3137
3149
|
edge: t.x + t.w
|
|
3138
3150
|
}));
|
|
3139
3151
|
}
|
|
3140
|
-
let c =
|
|
3152
|
+
let c = Ti(a, i, Si, s);
|
|
3141
3153
|
return c === null ? null : {
|
|
3142
3154
|
kind: "col",
|
|
3143
3155
|
index: c,
|
|
@@ -3157,7 +3169,7 @@ var Si = class {
|
|
|
3157
3169
|
edge: t.y + t.h
|
|
3158
3170
|
}));
|
|
3159
3171
|
}
|
|
3160
|
-
let s =
|
|
3172
|
+
let s = Ti(o, i, Si, c);
|
|
3161
3173
|
return s === null ? null : {
|
|
3162
3174
|
kind: "row",
|
|
3163
3175
|
index: s,
|
|
@@ -3176,8 +3188,8 @@ var Si = class {
|
|
|
3176
3188
|
let t = i.at(-1);
|
|
3177
3189
|
t && e[0] <= t[1] + 1 ? t[1] = Math.max(t[1], e[1]) : i.push([...e]);
|
|
3178
3190
|
}
|
|
3179
|
-
if (i.reduce((e, [t, n]) => e + n - t + 1, 0) >
|
|
3180
|
-
let a =
|
|
3191
|
+
if (i.reduce((e, [t, n]) => e + n - t + 1, 0) > wi) throw RangeError(`A resize gesture may affect at most ${wi} selected bands.`);
|
|
3192
|
+
let a = z(n), o = e === "col" ? a.col : a.row, s = [];
|
|
3181
3193
|
for (let [e, t] of i) for (let n = e; n <= t; n++) o.sizeOf(n) > 0 && s.push(n);
|
|
3182
3194
|
return s;
|
|
3183
3195
|
}
|
|
@@ -3197,9 +3209,9 @@ var Si = class {
|
|
|
3197
3209
|
let t = i.at(-1);
|
|
3198
3210
|
t && e.first <= t.last + 1 ? t.last = Math.max(t.last, e.last) : i.push({ ...e });
|
|
3199
3211
|
}
|
|
3200
|
-
if (!t && !
|
|
3212
|
+
if (!t && !Jt(n).length && i.reduce((e, t) => e + t.last - t.first + 1, 0) <= wi) return;
|
|
3201
3213
|
let a = [], o = 0;
|
|
3202
|
-
for (let e of
|
|
3214
|
+
for (let e of z(n).row.positiveRanges()) {
|
|
3203
3215
|
for (; o < i.length && i[o].last < e.first;) o++;
|
|
3204
3216
|
for (let t = o; t < i.length && i[t].first <= e.last; t++) {
|
|
3205
3217
|
let n = Math.max(e.first, i[t].first), r = Math.min(e.last, i[t].last);
|
|
@@ -3243,21 +3255,21 @@ var Si = class {
|
|
|
3243
3255
|
}
|
|
3244
3256
|
let i = this.host.scale(), a = this.host.canvasArea.getBoundingClientRect();
|
|
3245
3257
|
if (n.kind === "col") {
|
|
3246
|
-
let t = this.host.screenX(e - a.left, 0), o = Math.max(
|
|
3258
|
+
let t = this.host.screenX(e - a.left, 0), o = Math.max(Ci, Math.round((t - n.originScaled) / i)), s = Xt(o, n.mdw);
|
|
3247
3259
|
for (let e of n.indices) r.colWidths[e] = s, this.host.recordSizeOverride("col", e, o);
|
|
3248
3260
|
} else if (n.rowPreview) {
|
|
3249
|
-
let e = t - a.top, o = Math.max(
|
|
3261
|
+
let e = t - a.top, o = Math.max(Ci, Math.round((e - n.originScaled) / i));
|
|
3250
3262
|
try {
|
|
3251
|
-
n.rowPreview.apply(
|
|
3263
|
+
n.rowPreview.apply(Qt(o)), this.host.updateSpacerSize(r), this.host.updateSelectionOverlay(), this.host.scheduleRender();
|
|
3252
3264
|
} catch (e) {
|
|
3253
3265
|
this.finishResize(n.pointerId, !1, !0), this.host.reportError(e);
|
|
3254
3266
|
}
|
|
3255
3267
|
return;
|
|
3256
3268
|
} else {
|
|
3257
|
-
let e = t - a.top, o =
|
|
3269
|
+
let e = t - a.top, o = Qt(Math.max(Ci, Math.round((e - n.originScaled) / i)));
|
|
3258
3270
|
for (let e of n.indices) r.rowHeights[e] = o, this.host.recordSizeOverride("row", e);
|
|
3259
3271
|
}
|
|
3260
|
-
|
|
3272
|
+
U.invalidate(r), this.host.updateSpacerSize(r), this.host.updateSelectionOverlay(), this.host.scheduleRender();
|
|
3261
3273
|
}
|
|
3262
3274
|
applyPointerSelection(e, t, n, r, i, a) {
|
|
3263
3275
|
let o = this.getHeaderHit(e, t);
|
|
@@ -3341,7 +3353,7 @@ var Si = class {
|
|
|
3341
3353
|
y: 0
|
|
3342
3354
|
};
|
|
3343
3355
|
let t = this.viewportInputBounds();
|
|
3344
|
-
return
|
|
3356
|
+
return xi({
|
|
3345
3357
|
x: e.clientX - t.left,
|
|
3346
3358
|
y: e.clientY - t.top
|
|
3347
3359
|
}, {
|
|
@@ -3397,7 +3409,7 @@ var Si = class {
|
|
|
3397
3409
|
if (r?.kind === "row") return n.areas.some((e) => e.kind === "sheet" || e.kind === "rows" && r.row >= e.firstRow && r.row <= e.lastRow);
|
|
3398
3410
|
if (r?.kind === "col") return n.areas.some((e) => e.kind === "sheet" || e.kind === "columns" && r.col >= e.firstColumn && r.col <= e.lastColumn);
|
|
3399
3411
|
let i = this.host.cellAt(e, t);
|
|
3400
|
-
return i !== null && n.areas.some((e) =>
|
|
3412
|
+
return i !== null && n.areas.some((e) => Cr(e, i));
|
|
3401
3413
|
}
|
|
3402
3414
|
resolveContextMenuContext(e) {
|
|
3403
3415
|
if (this.host.isDestroyed()) return Promise.resolve(null);
|
|
@@ -3421,7 +3433,7 @@ var Si = class {
|
|
|
3421
3433
|
try {
|
|
3422
3434
|
let n = this.host.worksheet(), r = t.kind === "row" ? this.compactRowTargets(t.index) : void 0, i = r ? [] : this.resizeIndices(t.kind, t.index);
|
|
3423
3435
|
if (!r) try {
|
|
3424
|
-
this.host.assertResizeBudget(t.kind, i,
|
|
3436
|
+
this.host.assertResizeBudget(t.kind, i, wi);
|
|
3425
3437
|
} catch (e) {
|
|
3426
3438
|
if (t.kind !== "row" || !(e instanceof RangeError)) throw e;
|
|
3427
3439
|
r = this.compactRowTargets(t.index, !0), i = [];
|
|
@@ -3550,7 +3562,7 @@ var Si = class {
|
|
|
3550
3562
|
this.host.zoomAt(Number.isFinite(t) && Number.isFinite(n) ? {
|
|
3551
3563
|
x: t,
|
|
3552
3564
|
y: n
|
|
3553
|
-
} : null,
|
|
3565
|
+
} : null, ve(this.host.scale(), e.deltaY, e.deltaMode));
|
|
3554
3566
|
}, { passive: !1 }), this.on("pointerleave", (e) => {
|
|
3555
3567
|
let t = e.relatedTarget;
|
|
3556
3568
|
t && this.host.comments.contains(t) || this.host.hideCommentPopup();
|
|
@@ -3564,14 +3576,14 @@ var Si = class {
|
|
|
3564
3576
|
e.preventDefault(), this.host.copySelection();
|
|
3565
3577
|
} else if (!e.defaultPrevented && !e.isComposing && !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
3566
3578
|
let t = this.activeCell, n = e.key === "ArrowUp" ? -1 : +(e.key === "ArrowDown"), r = e.key === "ArrowLeft" ? this.host.isRtl() ? 1 : -1 : e.key === "ArrowRight" ? this.host.isRtl() ? -1 : 1 : 0, i = t ? {
|
|
3567
|
-
row: Math.max(1, Math.min(
|
|
3568
|
-
col: Math.max(1, Math.min(
|
|
3579
|
+
row: Math.max(1, Math.min(H, t.row + n)),
|
|
3580
|
+
col: Math.max(1, Math.min(V, t.col + r))
|
|
3569
3581
|
} : {
|
|
3570
3582
|
row: 1,
|
|
3571
3583
|
col: 1
|
|
3572
3584
|
};
|
|
3573
3585
|
e.preventDefault(), this.host.hideCommentPopup();
|
|
3574
|
-
let a =
|
|
3586
|
+
let a = ut(i.row, i.col);
|
|
3575
3587
|
this.host.setSelection(a), this.host.scrollCellIntoView(i.row, i.col), this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.emitViewportChange();
|
|
3576
3588
|
} else if (e.key === "Escape" && this.resizeDrag?.rowPreview) e.preventDefault(), this.finishResize(this.resizeDrag.pointerId, !1, !0);
|
|
3577
3589
|
else if (e.key === "Escape" && this.host.validation.isOpen()) this.host.hideValidationPanel();
|
|
@@ -3586,14 +3598,14 @@ var Si = class {
|
|
|
3586
3598
|
this.resizeDrag && this.finishResize(this.resizeDrag.pointerId, !1, !0), this.stopSelectionAutoScroll(), this.pendingTap = null, this.pendingClick = null, this.pendingElementClick = null, this.resizeDrag = null;
|
|
3587
3599
|
for (let e of this.cleanups.splice(0)) e();
|
|
3588
3600
|
}
|
|
3589
|
-
},
|
|
3590
|
-
function
|
|
3601
|
+
}, Di = "#1a73e8";
|
|
3602
|
+
function Oi(e) {
|
|
3591
3603
|
return {
|
|
3592
3604
|
border: `2px solid ${e}`,
|
|
3593
3605
|
background: `color-mix(in srgb, ${e} 8%, transparent)`
|
|
3594
3606
|
};
|
|
3595
3607
|
}
|
|
3596
|
-
function
|
|
3608
|
+
function ki(e) {
|
|
3597
3609
|
let t = [];
|
|
3598
3610
|
for (let n of e) {
|
|
3599
3611
|
let e = n.x + n.width, r = n.y + n.height;
|
|
@@ -3639,7 +3651,7 @@ function Ti(e) {
|
|
|
3639
3651
|
}
|
|
3640
3652
|
return r.join("");
|
|
3641
3653
|
}
|
|
3642
|
-
var
|
|
3654
|
+
var Ai = 0, ji = class {
|
|
3643
3655
|
host;
|
|
3644
3656
|
constructor(e) {
|
|
3645
3657
|
this.host = e;
|
|
@@ -3653,7 +3665,7 @@ var Ei = 0, Di = class {
|
|
|
3653
3665
|
if (!e) return;
|
|
3654
3666
|
let t = this.host.scale(), n = this.host.worksheet();
|
|
3655
3667
|
if (!n) return;
|
|
3656
|
-
let r = (e) => Math.round(e * t), i = r(50), a = r(22), o = this.host.canvasArea.clientWidth, s = this.host.canvasArea.clientHeight, c =
|
|
3668
|
+
let r = (e) => Math.round(e * t), i = r(50), a = r(22), o = this.host.canvasArea.clientWidth, s = this.host.canvasArea.clientHeight, c = z(n), l = c.effectiveFrozenBands({
|
|
3657
3669
|
scale: t,
|
|
3658
3670
|
width: o,
|
|
3659
3671
|
height: s,
|
|
@@ -3668,12 +3680,12 @@ var Ei = 0, Di = class {
|
|
|
3668
3680
|
end: Math.min(o, i + d)
|
|
3669
3681
|
}, {
|
|
3670
3682
|
first: l.cols + 1,
|
|
3671
|
-
last:
|
|
3683
|
+
last: V,
|
|
3672
3684
|
start: Math.min(o, i + d),
|
|
3673
3685
|
end: o
|
|
3674
3686
|
}] : [{
|
|
3675
3687
|
first: 1,
|
|
3676
|
-
last:
|
|
3688
|
+
last: V,
|
|
3677
3689
|
start: i,
|
|
3678
3690
|
end: o
|
|
3679
3691
|
}], m = l.rows > 0 ? [{
|
|
@@ -3683,15 +3695,15 @@ var Ei = 0, Di = class {
|
|
|
3683
3695
|
end: Math.min(s, a + f)
|
|
3684
3696
|
}, {
|
|
3685
3697
|
first: l.rows + 1,
|
|
3686
|
-
last:
|
|
3698
|
+
last: H,
|
|
3687
3699
|
start: Math.min(s, a + f),
|
|
3688
3700
|
end: s
|
|
3689
3701
|
}] : [{
|
|
3690
3702
|
first: 1,
|
|
3691
|
-
last:
|
|
3703
|
+
last: H,
|
|
3692
3704
|
start: a,
|
|
3693
3705
|
end: s
|
|
3694
|
-
}], h = p.filter((e) => e.end > e.start), g = m.filter((e) => e.end > e.start), _ = this.host.selectionColor() ??
|
|
3706
|
+
}], h = p.filter((e) => e.end > e.start), g = m.filter((e) => e.end > e.start), _ = this.host.selectionColor() ?? Di, { background: v } = Oi(_), y = /* @__PURE__ */ new Set(), b = [], x = [];
|
|
3695
3707
|
for (let t of e.areas) {
|
|
3696
3708
|
let e = t.kind === "cells" ? {
|
|
3697
3709
|
top: t.top,
|
|
@@ -3706,14 +3718,14 @@ var Ei = 0, Di = class {
|
|
|
3706
3718
|
top: t.firstRow,
|
|
3707
3719
|
bottom: t.lastRow,
|
|
3708
3720
|
left: 1,
|
|
3709
|
-
right:
|
|
3721
|
+
right: V,
|
|
3710
3722
|
topEdge: !0,
|
|
3711
3723
|
bottomEdge: !0,
|
|
3712
3724
|
leftEdge: !1,
|
|
3713
3725
|
rightEdge: !1
|
|
3714
3726
|
} : t.kind === "columns" ? {
|
|
3715
3727
|
top: 1,
|
|
3716
|
-
bottom:
|
|
3728
|
+
bottom: H,
|
|
3717
3729
|
left: t.firstColumn,
|
|
3718
3730
|
right: t.lastColumn,
|
|
3719
3731
|
topEdge: !1,
|
|
@@ -3722,9 +3734,9 @@ var Ei = 0, Di = class {
|
|
|
3722
3734
|
rightEdge: !0
|
|
3723
3735
|
} : {
|
|
3724
3736
|
top: 1,
|
|
3725
|
-
bottom:
|
|
3737
|
+
bottom: H,
|
|
3726
3738
|
left: 1,
|
|
3727
|
-
right:
|
|
3739
|
+
right: V,
|
|
3728
3740
|
topEdge: !1,
|
|
3729
3741
|
bottomEdge: !1,
|
|
3730
3742
|
leftEdge: !1,
|
|
@@ -3737,35 +3749,35 @@ var Ei = 0, Di = class {
|
|
|
3737
3749
|
if (!u || !d) continue;
|
|
3738
3750
|
let f = u.x, p = u.y, m = d.x + d.w, _ = d.y + d.h, v = Math.max(f, r.start), S = Math.max(p, n.start), C = Math.min(m, r.end), w = Math.min(_, n.end), T = C - v, E = w - S;
|
|
3739
3751
|
if (T <= 0 || E <= 0) continue;
|
|
3740
|
-
let D = t.kind === "columns" && n === g[0], O = t.kind === "columns" && n === g.at(-1),
|
|
3752
|
+
let D = t.kind === "columns" && n === g[0], O = t.kind === "columns" && n === g.at(-1), ee = t.kind === "rows" && r === h[0], k = t.kind === "rows" && r === h.at(-1), A = D || e.topEdge && i === e.top && p >= n.start, j = O || e.bottomEdge && a === e.bottom && _ <= n.end, te = ee || e.leftEdge && c === e.left && f >= r.start, M = k || e.rightEdge && l === e.right && m <= r.end, N = this.host.screenX(v, T), ne = this.host.isRtl() ? M : te, P = this.host.isRtl() ? te : M, re = [
|
|
3741
3753
|
N,
|
|
3742
3754
|
S,
|
|
3743
3755
|
T,
|
|
3744
3756
|
E,
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3757
|
+
A,
|
|
3758
|
+
P,
|
|
3759
|
+
j,
|
|
3760
|
+
ne
|
|
3749
3761
|
].join("|");
|
|
3750
|
-
if (y.has(
|
|
3751
|
-
y.add(
|
|
3752
|
-
let
|
|
3762
|
+
if (y.has(re)) continue;
|
|
3763
|
+
y.add(re), b.push(`M${N} ${S}h${T}v${E}h${-T}Z`);
|
|
3764
|
+
let ie = Math.min(1, T / 2), ae = Math.min(1, E / 2), oe = this.host.isRtl() ? k : ee, se = this.host.isRtl() ? ee : k, F = (e, t) => e <= 0 || e >= t, ce = N + (oe && F(N, o) ? ie : 0), le = N + T - (se && F(N + T, o) ? ie : 0), I = S + (D && F(S, s) ? ae : 0), ue = w - (O && F(w, s) ? ae : 0);
|
|
3753
3765
|
x.push({
|
|
3754
|
-
x:
|
|
3755
|
-
y:
|
|
3756
|
-
width:
|
|
3757
|
-
height:
|
|
3758
|
-
top:
|
|
3759
|
-
right:
|
|
3760
|
-
bottom:
|
|
3761
|
-
left:
|
|
3766
|
+
x: ce,
|
|
3767
|
+
y: I,
|
|
3768
|
+
width: le - ce,
|
|
3769
|
+
height: ue - I,
|
|
3770
|
+
top: A,
|
|
3771
|
+
right: P,
|
|
3772
|
+
bottom: j,
|
|
3773
|
+
left: ne
|
|
3762
3774
|
});
|
|
3763
3775
|
}
|
|
3764
3776
|
}
|
|
3765
3777
|
if (b.length > 0) {
|
|
3766
3778
|
let t = "http://www.w3.org/2000/svg", n = this.host.ownerDocument.createElementNS(t, "svg");
|
|
3767
3779
|
n.setAttribute("data-xlsx-selection-fill", ""), n.style.cssText = "position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none;";
|
|
3768
|
-
let r = e.areas.length > 1, i = this.host.cellRect(e.activeCell.row, e.activeCell.col), a = `xlsx-selection-mask-${++
|
|
3780
|
+
let r = e.areas.length > 1, i = this.host.cellRect(e.activeCell.row, e.activeCell.col), a = `xlsx-selection-mask-${++Ai}`, c = this.host.ownerDocument.createElementNS(t, "defs"), l = this.host.ownerDocument.createElementNS(t, "mask");
|
|
3769
3781
|
l.setAttribute("id", a), l.setAttribute("maskUnits", "userSpaceOnUse"), l.setAttribute("x", "0"), l.setAttribute("y", "0"), l.setAttribute("width", String(o)), l.setAttribute("height", String(s));
|
|
3770
3782
|
let u = this.host.ownerDocument.createElementNS(t, "path");
|
|
3771
3783
|
if (u.setAttribute("d", b.join("")), u.setAttribute("fill", "#fff"), l.appendChild(u), i) for (let e of m) for (let n of p) {
|
|
@@ -3777,7 +3789,7 @@ var Ei = 0, Di = class {
|
|
|
3777
3789
|
c.appendChild(l), n.appendChild(c);
|
|
3778
3790
|
let d = this.host.ownerDocument.createElementNS(t, "rect");
|
|
3779
3791
|
d.setAttribute("x", "0"), d.setAttribute("y", "0"), d.setAttribute("width", String(o)), d.setAttribute("height", String(s)), d.setAttribute("fill", v), d.setAttribute("mask", `url(#${a})`), n.appendChild(d);
|
|
3780
|
-
let f = r ? "" :
|
|
3792
|
+
let f = r ? "" : ki(x);
|
|
3781
3793
|
if (f) {
|
|
3782
3794
|
let e = this.host.ownerDocument.createElementNS(t, "path");
|
|
3783
3795
|
e.setAttribute("data-xlsx-selection-border", ""), e.setAttribute("d", f), e.setAttribute("fill", "none"), e.setAttribute("stroke", _), e.setAttribute("stroke-width", "2"), e.setAttribute("stroke-linecap", "square"), e.setAttribute("stroke-linejoin", "miter"), n.appendChild(e);
|
|
@@ -3795,16 +3807,16 @@ var Ei = 0, Di = class {
|
|
|
3795
3807
|
drawElementContextOverlay() {
|
|
3796
3808
|
let e = this.host.elementContext(), t = this.host.worksheet(), n = this.host.elementContextViewport();
|
|
3797
3809
|
if (!e || !t || !n || e.sheetIndex !== this.host.currentSheet()) return;
|
|
3798
|
-
let r =
|
|
3810
|
+
let r = cr(t, e, n);
|
|
3799
3811
|
if (!r) return;
|
|
3800
3812
|
let i = this.host.ownerDocument.createElement("div");
|
|
3801
3813
|
i.setAttribute("data-xlsx-element-context-clip", ""), i.style.cssText = `position:absolute;left:${r.clip.x}px;top:${r.clip.y}px;width:${r.clip.width}px;height:${r.clip.height}px;overflow:hidden;pointer-events:none;`;
|
|
3802
3814
|
let a = this.host.ownerDocument.createElement("div");
|
|
3803
3815
|
a.setAttribute("data-xlsx-element-context-outline", e.elementType);
|
|
3804
|
-
let o = this.host.selectionColor() ??
|
|
3816
|
+
let o = this.host.selectionColor() ?? Di;
|
|
3805
3817
|
a.style.cssText = `position:absolute;left:${r.rect.x - r.clip.x}px;top:${r.rect.y - r.clip.y}px;width:${r.rect.width}px;height:${r.rect.height}px;box-sizing:border-box;border:2px solid ${o};background:color-mix(in srgb, ${o} 6%, transparent);transform:rotate(${r.rotation}deg);transform-origin:center;pointer-events:none;`, i.appendChild(a), this.host.overlayHost.appendSelection(i);
|
|
3806
3818
|
}
|
|
3807
|
-
},
|
|
3819
|
+
}, Mi = 65536, Ni = 100, Pi = class {
|
|
3808
3820
|
host;
|
|
3809
3821
|
lastNotified = null;
|
|
3810
3822
|
emitting = !1;
|
|
@@ -3820,22 +3832,22 @@ var Ei = 0, Di = class {
|
|
|
3820
3832
|
if (!this.host.onSelectionContextChange() || this.host.isDestroyed() || this.contextFrame !== null || this.contextMicrotask) return;
|
|
3821
3833
|
let e = () => {
|
|
3822
3834
|
if (this.contextFrame = null, this.contextMicrotask = !1, this.host.isDestroyed()) return;
|
|
3823
|
-
let e = this.host.readContext(
|
|
3835
|
+
let e = this.host.readContext(Mi);
|
|
3824
3836
|
this.host.onSelectionContextChange()?.(e ? structuredClone(e) : null);
|
|
3825
3837
|
};
|
|
3826
3838
|
typeof this.host.hostWindow.requestAnimationFrame == "function" ? this.contextFrame = this.host.hostWindow.requestAnimationFrame(e) : (this.contextMicrotask = !0, queueMicrotask(e));
|
|
3827
3839
|
}
|
|
3828
3840
|
emit() {
|
|
3829
3841
|
let e = this.host.selectionState();
|
|
3830
|
-
if (
|
|
3842
|
+
if (X(e, this.lastNotified) || this.host.scheduleSelectionContextNotification(), this.emitting) {
|
|
3831
3843
|
this.pending = !0, this.scheduleNotification();
|
|
3832
3844
|
return;
|
|
3833
3845
|
}
|
|
3834
|
-
if (this.pending = !1,
|
|
3846
|
+
if (this.pending = !1, X(e, this.lastNotified)) {
|
|
3835
3847
|
this.finishChain();
|
|
3836
3848
|
return;
|
|
3837
3849
|
}
|
|
3838
|
-
if (this.chainLength >=
|
|
3850
|
+
if (this.chainLength >= Ni) {
|
|
3839
3851
|
this.lastNotified = e ? structuredClone(e) : null, this.finishChain();
|
|
3840
3852
|
return;
|
|
3841
3853
|
}
|
|
@@ -3843,7 +3855,7 @@ var Ei = 0, Di = class {
|
|
|
3843
3855
|
try {
|
|
3844
3856
|
this.host.onSelectionStateChange()?.(e ? structuredClone(e) : null);
|
|
3845
3857
|
} finally {
|
|
3846
|
-
this.emitting = !1, this.pending || !
|
|
3858
|
+
this.emitting = !1, this.pending || !X(this.host.selectionState(), this.lastNotified) ? this.scheduleNotification() : this.finishChain();
|
|
3847
3859
|
}
|
|
3848
3860
|
}
|
|
3849
3861
|
scheduleNotification() {
|
|
@@ -3869,7 +3881,7 @@ function $(e) {
|
|
|
3869
3881
|
}
|
|
3870
3882
|
return n;
|
|
3871
3883
|
}
|
|
3872
|
-
function
|
|
3884
|
+
function Fi(e, t) {
|
|
3873
3885
|
let n = 0, r = e.length - 1;
|
|
3874
3886
|
for (; n <= r;) {
|
|
3875
3887
|
let i = n + r >>> 1, a = e[i];
|
|
@@ -3879,7 +3891,7 @@ function ji(e, t) {
|
|
|
3879
3891
|
}
|
|
3880
3892
|
return !1;
|
|
3881
3893
|
}
|
|
3882
|
-
function
|
|
3894
|
+
function Ii(e, t, n) {
|
|
3883
3895
|
let r = 0, i = e.length;
|
|
3884
3896
|
for (; r < i;) {
|
|
3885
3897
|
let a = r + i >>> 1;
|
|
@@ -3887,26 +3899,26 @@ function Mi(e, t, n) {
|
|
|
3887
3899
|
}
|
|
3888
3900
|
return r;
|
|
3889
3901
|
}
|
|
3890
|
-
function
|
|
3902
|
+
function Li(e, t) {
|
|
3891
3903
|
for (let n = 1; n < e.length; n++) if (t(e[n - 1]) > t(e[n])) return [...e].sort((e, n) => t(e) - t(n));
|
|
3892
3904
|
return e;
|
|
3893
3905
|
}
|
|
3894
|
-
var
|
|
3895
|
-
function
|
|
3896
|
-
return
|
|
3906
|
+
var Ri = 1 * 1024 * 1024, zi = 65536;
|
|
3907
|
+
function Bi(e, t) {
|
|
3908
|
+
return Me(e, Math.max(0, t));
|
|
3897
3909
|
}
|
|
3898
|
-
var
|
|
3910
|
+
var Vi = class {
|
|
3899
3911
|
rows = /* @__PURE__ */ new WeakMap();
|
|
3900
3912
|
cells = /* @__PURE__ */ new WeakMap();
|
|
3901
3913
|
read(e, t, n, r, i, a) {
|
|
3902
3914
|
let o = a.maxCells ?? 1e3;
|
|
3903
3915
|
if (!Number.isFinite(o) || o < 0) throw RangeError("maxCells must be a finite non-negative number.");
|
|
3904
|
-
let s = Math.min(
|
|
3916
|
+
let s = Math.min(yr, Math.floor(o)), c = a.maxTextCharacters ?? Ri;
|
|
3905
3917
|
if (!Number.isFinite(c) || c < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
3906
|
-
let l = Math.min(
|
|
3918
|
+
let l = Math.min(br, Math.floor(c)), u = 0, d = !1, f = (e) => {
|
|
3907
3919
|
let t = typeof e == "string" ? [e] : e, n = [], r = 0;
|
|
3908
3920
|
for (let e = 0; e < t.length; e++) {
|
|
3909
|
-
let i = t[e], a = typeof i == "string" ? i : i.text, o = Math.max(0, Math.min(
|
|
3921
|
+
let i = t[e], a = typeof i == "string" ? i : i.text, o = Math.max(0, Math.min(zi - r, l - u)), s = Bi(a, o);
|
|
3910
3922
|
if (n.push(s), r += s.length, u += s.length, s.length < a.length || e + 1 < t.length && o === 0) {
|
|
3911
3923
|
d = !0;
|
|
3912
3924
|
break;
|
|
@@ -3929,14 +3941,14 @@ var Li = class {
|
|
|
3929
3941
|
active: !1
|
|
3930
3942
|
}]).sort((e, t) => e.row - t.row || Number(e.active) - Number(t.active)), v = /* @__PURE__ */ new Set(), y = 0, b = [], x = [], S = !1, C = p || h.length > 0 ? [{
|
|
3931
3943
|
first: 1,
|
|
3932
|
-
last:
|
|
3944
|
+
last: H
|
|
3933
3945
|
}] : $([...m, ...g.map((e) => ({
|
|
3934
3946
|
first: e.top,
|
|
3935
3947
|
last: e.bottom
|
|
3936
3948
|
}))]), w = this.rows.get(e);
|
|
3937
|
-
w || (w =
|
|
3949
|
+
w || (w = Li(e.rows, (e) => e.index), this.rows.set(e, w));
|
|
3938
3950
|
cellScan: for (let t of C) {
|
|
3939
|
-
let n =
|
|
3951
|
+
let n = Ii(w, t.first, (e) => e.index);
|
|
3940
3952
|
for (; n < w.length;) {
|
|
3941
3953
|
let a = w[n++];
|
|
3942
3954
|
if (a.index > t.last) break;
|
|
@@ -3949,14 +3961,14 @@ var Li = class {
|
|
|
3949
3961
|
first: g[e].left,
|
|
3950
3962
|
last: g[e].right
|
|
3951
3963
|
}))));
|
|
3952
|
-
let c = p ||
|
|
3964
|
+
let c = p || Fi(m, a.index) ? [{
|
|
3953
3965
|
first: 1,
|
|
3954
|
-
last:
|
|
3966
|
+
last: V
|
|
3955
3967
|
}] : $([...h, ...b]);
|
|
3956
3968
|
for (let t of c) {
|
|
3957
3969
|
let n = this.cells.get(a);
|
|
3958
|
-
n || (n =
|
|
3959
|
-
let o =
|
|
3970
|
+
n || (n = Li(a.cells, (e) => e.col), this.cells.set(a, n));
|
|
3971
|
+
let o = Ii(n, t.first, (e) => e.col);
|
|
3960
3972
|
for (; o < n.length;) {
|
|
3961
3973
|
let a = n[o++];
|
|
3962
3974
|
if (a.col > t.last) break;
|
|
@@ -4004,7 +4016,7 @@ var Li = class {
|
|
|
4004
4016
|
sheetIndex: t,
|
|
4005
4017
|
sheetName: e.name,
|
|
4006
4018
|
selection: n,
|
|
4007
|
-
coordinateCountUpperBound:
|
|
4019
|
+
coordinateCountUpperBound: xr(n),
|
|
4008
4020
|
cells: x,
|
|
4009
4021
|
truncated: T.length > 0,
|
|
4010
4022
|
truncationReasons: T,
|
|
@@ -4013,7 +4025,7 @@ var Li = class {
|
|
|
4013
4025
|
maxTextCharacters: l
|
|
4014
4026
|
};
|
|
4015
4027
|
}
|
|
4016
|
-
},
|
|
4028
|
+
}, Hi = {
|
|
4017
4029
|
background: "--ooxml-xlsx-chrome-background",
|
|
4018
4030
|
surface: "--ooxml-xlsx-chrome-surface",
|
|
4019
4031
|
mutedSurface: "--ooxml-xlsx-chrome-surface-muted",
|
|
@@ -4023,10 +4035,10 @@ var Li = class {
|
|
|
4023
4035
|
selectedSurface: "--ooxml-xlsx-chrome-selection-background",
|
|
4024
4036
|
accent: "--ooxml-xlsx-chrome-accent"
|
|
4025
4037
|
};
|
|
4026
|
-
function
|
|
4027
|
-
return Object.keys(
|
|
4038
|
+
function Ui(e, t) {
|
|
4039
|
+
return Object.keys(Hi).every((n) => e[n] === t[n]);
|
|
4028
4040
|
}
|
|
4029
|
-
var
|
|
4041
|
+
var Wi = class {
|
|
4030
4042
|
host;
|
|
4031
4043
|
colors = {};
|
|
4032
4044
|
styleObserver = null;
|
|
@@ -4040,12 +4052,12 @@ var Bi = class {
|
|
|
4040
4052
|
let e = this.host.hostWindow, t = e.getComputedStyle?.bind(e);
|
|
4041
4053
|
if (!t) return;
|
|
4042
4054
|
let n = t(this.host.wrapper), r = {};
|
|
4043
|
-
for (let [e, t] of Object.entries(
|
|
4055
|
+
for (let [e, t] of Object.entries(Hi)) {
|
|
4044
4056
|
let i = n.getPropertyValue(t).trim();
|
|
4045
4057
|
i && (r[e] = i);
|
|
4046
4058
|
}
|
|
4047
4059
|
let i = r;
|
|
4048
|
-
|
|
4060
|
+
Ui(this.colors, i) || (this.colors = i, this.host.onChange());
|
|
4049
4061
|
}
|
|
4050
4062
|
install() {
|
|
4051
4063
|
this.refresh();
|
|
@@ -4070,9 +4082,9 @@ var Bi = class {
|
|
|
4070
4082
|
destroy() {
|
|
4071
4083
|
this.styleObserver?.disconnect(), this.styleObserver = null, this.schemeMedia && this.schemeListener && this.schemeMedia.removeEventListener?.("change", this.schemeListener), this.schemeMedia = null, this.schemeListener = null;
|
|
4072
4084
|
}
|
|
4073
|
-
},
|
|
4074
|
-
function
|
|
4075
|
-
let { cell: t, popup: n, viewport: r, rtl: i } = e, a =
|
|
4085
|
+
}, Gi = 8;
|
|
4086
|
+
function Ki(e) {
|
|
4087
|
+
let { cell: t, popup: n, viewport: r, rtl: i } = e, a = Gi, o = t.x + t.w + a, s = t.x - a - n.w, c = o + n.w <= r.w, l = s >= 0, u;
|
|
4076
4088
|
u = i ? l ? s : c ? o : s : c ? o : l ? s : o, u = Math.max(0, Math.min(u, r.w - n.w));
|
|
4077
4089
|
let d = t.y;
|
|
4078
4090
|
return d = Math.max(0, Math.min(d, r.h - n.h)), {
|
|
@@ -4080,20 +4092,20 @@ function Hi(e) {
|
|
|
4080
4092
|
top: d
|
|
4081
4093
|
};
|
|
4082
4094
|
}
|
|
4083
|
-
var
|
|
4084
|
-
function
|
|
4085
|
-
return
|
|
4095
|
+
var qi;
|
|
4096
|
+
function Ji() {
|
|
4097
|
+
return qi ??= import("./comment-ui-runtime-BtP_TpvT.js");
|
|
4086
4098
|
}
|
|
4087
|
-
var
|
|
4088
|
-
function
|
|
4099
|
+
var Yi = 150;
|
|
4100
|
+
function Xi(e) {
|
|
4089
4101
|
let t = /* @__PURE__ */ new Map();
|
|
4090
4102
|
for (let n of e) {
|
|
4091
|
-
let e =
|
|
4103
|
+
let e = L(n.cellRef);
|
|
4092
4104
|
e && t.set(`${e.row}:${e.col}`, n);
|
|
4093
4105
|
}
|
|
4094
4106
|
return t;
|
|
4095
4107
|
}
|
|
4096
|
-
var
|
|
4108
|
+
var Zi = class {
|
|
4097
4109
|
host;
|
|
4098
4110
|
popup;
|
|
4099
4111
|
commentMap = /* @__PURE__ */ new Map();
|
|
@@ -4112,7 +4124,7 @@ var qi = class {
|
|
|
4112
4124
|
}), this.resizeObserver.observe(this.popup));
|
|
4113
4125
|
}
|
|
4114
4126
|
setComments(e) {
|
|
4115
|
-
this.commentMap =
|
|
4127
|
+
this.commentMap = Xi(e);
|
|
4116
4128
|
}
|
|
4117
4129
|
commentAt(e) {
|
|
4118
4130
|
return this.commentMap.get(`${e.row}:${e.col}`);
|
|
@@ -4131,10 +4143,10 @@ var qi = class {
|
|
|
4131
4143
|
}
|
|
4132
4144
|
this.popupKey !== t && (this.hide(), this.popupKey = t, this.timer = setTimeout(() => {
|
|
4133
4145
|
this.timer = null, this.show(e, n).catch((e) => this.host.reportError(e));
|
|
4134
|
-
},
|
|
4146
|
+
}, Yi));
|
|
4135
4147
|
}
|
|
4136
4148
|
async loadUi() {
|
|
4137
|
-
let e = this.ui ?? await
|
|
4149
|
+
let e = this.ui ?? await Ji();
|
|
4138
4150
|
return this.host.isDestroyed() || (this.ui = e), e;
|
|
4139
4151
|
}
|
|
4140
4152
|
async show(e, t) {
|
|
@@ -4181,7 +4193,7 @@ var qi = class {
|
|
|
4181
4193
|
if (!e || this.popup.style.display === "none") return;
|
|
4182
4194
|
let t = this.host.cellRect(e.row, e.col);
|
|
4183
4195
|
if (!t) return;
|
|
4184
|
-
let n =
|
|
4196
|
+
let n = Ki({
|
|
4185
4197
|
cell: {
|
|
4186
4198
|
x: this.host.screenX(t.x, t.w),
|
|
4187
4199
|
y: t.y,
|
|
@@ -4206,8 +4218,8 @@ var qi = class {
|
|
|
4206
4218
|
destroy() {
|
|
4207
4219
|
this.resizeObserver?.disconnect(), this.resizeObserver = null, this.hide(), this.commentMap.clear();
|
|
4208
4220
|
}
|
|
4209
|
-
},
|
|
4210
|
-
owner = new
|
|
4221
|
+
}, Qi = class {
|
|
4222
|
+
owner = new je("SheetAcquisition");
|
|
4211
4223
|
get current() {
|
|
4212
4224
|
return this.owner.current;
|
|
4213
4225
|
}
|
|
@@ -4221,16 +4233,16 @@ var qi = class {
|
|
|
4221
4233
|
this.owner.close();
|
|
4222
4234
|
}
|
|
4223
4235
|
};
|
|
4224
|
-
function
|
|
4236
|
+
function $i(e) {
|
|
4225
4237
|
let t = {
|
|
4226
4238
|
...e,
|
|
4227
4239
|
rows: e.rows.map((e) => ({ ...e })),
|
|
4228
4240
|
rowHeights: { ...e.rowHeights },
|
|
4229
4241
|
colWidths: { ...e.colWidths }
|
|
4230
4242
|
};
|
|
4231
|
-
return e.colCollapsed && (t.colCollapsed = { ...e.colCollapsed }),
|
|
4243
|
+
return e.colCollapsed && (t.colCollapsed = { ...e.colCollapsed }), nt(e, t), Vn(e, t), Ht(e, t), Zt(e, t), t;
|
|
4232
4244
|
}
|
|
4233
|
-
var
|
|
4245
|
+
var ea = class {
|
|
4234
4246
|
scaleValue;
|
|
4235
4247
|
offsetX = 0;
|
|
4236
4248
|
offsetY = 0;
|
|
@@ -4277,7 +4289,7 @@ var Xi = class {
|
|
|
4277
4289
|
reset() {
|
|
4278
4290
|
this.offsetX = 0, this.offsetY = 0;
|
|
4279
4291
|
}
|
|
4280
|
-
},
|
|
4292
|
+
}, ta = class {
|
|
4281
4293
|
animationFrame = null;
|
|
4282
4294
|
activeRender = !1;
|
|
4283
4295
|
pendingRender = null;
|
|
@@ -4290,7 +4302,7 @@ var Xi = class {
|
|
|
4290
4302
|
this.frameScheduler = typeof r.requestAnimationFrame == "function" && typeof r.cancelAnimationFrame == "function" ? {
|
|
4291
4303
|
requestAnimationFrame: (e) => r.requestAnimationFrame(e),
|
|
4292
4304
|
cancelAnimationFrame: (e) => r.cancelAnimationFrame(e)
|
|
4293
|
-
} : null, this.staticDispatcher = e ? new
|
|
4305
|
+
} : null, this.staticDispatcher = e ? new we(e, t) : null;
|
|
4294
4306
|
}
|
|
4295
4307
|
begin() {
|
|
4296
4308
|
return this.staticDispatcher ? this.staticDispatcher.begin() : ++this.generation;
|
|
@@ -4342,7 +4354,7 @@ var Xi = class {
|
|
|
4342
4354
|
destroy() {
|
|
4343
4355
|
this.destroyed || (this.destroyed = !0, this.pendingRender = null, this.animationFrame !== null && this.frameScheduler && (this.frameScheduler.cancelAnimationFrame(this.animationFrame), this.animationFrame = null), this.staticDispatcher?.destroy(), this.generation++);
|
|
4344
4356
|
}
|
|
4345
|
-
},
|
|
4357
|
+
}, na = class {
|
|
4346
4358
|
state = null;
|
|
4347
4359
|
dragPointerId = null;
|
|
4348
4360
|
get anchor() {
|
|
@@ -4374,7 +4386,7 @@ var Xi = class {
|
|
|
4374
4386
|
this.state = null, this.dragPointerId = null;
|
|
4375
4387
|
}
|
|
4376
4388
|
setState(e) {
|
|
4377
|
-
this.state = e ?
|
|
4389
|
+
this.state = e ? Y(e) : null;
|
|
4378
4390
|
}
|
|
4379
4391
|
select(e, t = "cells") {
|
|
4380
4392
|
let n = t === "rows" ? {
|
|
@@ -4392,7 +4404,7 @@ var Xi = class {
|
|
|
4392
4404
|
bottom: e.row,
|
|
4393
4405
|
right: e.col
|
|
4394
4406
|
};
|
|
4395
|
-
this.state =
|
|
4407
|
+
this.state = Y({
|
|
4396
4408
|
areas: [n],
|
|
4397
4409
|
activeAreaIndex: 0,
|
|
4398
4410
|
activeCell: e,
|
|
@@ -4401,8 +4413,8 @@ var Xi = class {
|
|
|
4401
4413
|
}
|
|
4402
4414
|
add(e, t = "cells") {
|
|
4403
4415
|
if (!this.state) return this.select(e, t), !0;
|
|
4404
|
-
let n = this.state.areas.findIndex((n) => (t === "rows" ? n.kind === "rows" : t === "cols" ? n.kind === "columns" : t === "all" ? n.kind === "sheet" : n.kind === "cells") &&
|
|
4405
|
-
if (n >= 0) return this.state =
|
|
4416
|
+
let n = this.state.areas.findIndex((n) => (t === "rows" ? n.kind === "rows" : t === "cols" ? n.kind === "columns" : t === "all" ? n.kind === "sheet" : n.kind === "cells") && Cr(n, e));
|
|
4417
|
+
if (n >= 0) return this.state = Y({
|
|
4406
4418
|
...this.state,
|
|
4407
4419
|
activeAreaIndex: n,
|
|
4408
4420
|
activeCell: e,
|
|
@@ -4424,7 +4436,7 @@ var Xi = class {
|
|
|
4424
4436
|
bottom: e.row,
|
|
4425
4437
|
right: e.col
|
|
4426
4438
|
}, i = [...this.state.areas, r];
|
|
4427
|
-
return this.state =
|
|
4439
|
+
return this.state = Y({
|
|
4428
4440
|
areas: i,
|
|
4429
4441
|
activeAreaIndex: i.length - 1,
|
|
4430
4442
|
activeCell: e,
|
|
@@ -4453,7 +4465,7 @@ var Xi = class {
|
|
|
4453
4465
|
bottom: Math.max(t.row, e.row),
|
|
4454
4466
|
right: Math.max(t.col, e.col)
|
|
4455
4467
|
}, i = [...this.state.areas];
|
|
4456
|
-
i[this.state.activeAreaIndex] = r, this.state =
|
|
4468
|
+
i[this.state.activeAreaIndex] = r, this.state = Y({
|
|
4457
4469
|
...this.state,
|
|
4458
4470
|
areas: i
|
|
4459
4471
|
});
|
|
@@ -4519,7 +4531,7 @@ var Xi = class {
|
|
|
4519
4531
|
};
|
|
4520
4532
|
}
|
|
4521
4533
|
}
|
|
4522
|
-
},
|
|
4534
|
+
}, ra = class {
|
|
4523
4535
|
canvas;
|
|
4524
4536
|
area;
|
|
4525
4537
|
input;
|
|
@@ -4557,7 +4569,7 @@ var Xi = class {
|
|
|
4557
4569
|
destroy() {
|
|
4558
4570
|
for (let e of this.cleanups.splice(0)) e();
|
|
4559
4571
|
}
|
|
4560
|
-
},
|
|
4572
|
+
}, ia = class {
|
|
4561
4573
|
stopValidationWheel = (e) => e.stopPropagation();
|
|
4562
4574
|
selection;
|
|
4563
4575
|
find;
|
|
@@ -4598,13 +4610,13 @@ var Xi = class {
|
|
|
4598
4610
|
destroy() {
|
|
4599
4611
|
this.validation.removeEventListener("wheel", this.stopValidationWheel);
|
|
4600
4612
|
}
|
|
4601
|
-
},
|
|
4602
|
-
function
|
|
4603
|
-
if (!e.head || e.head.querySelector(`style[${
|
|
4613
|
+
}, aa = Symbol("XlsxViewer.borrowedWorkbook"), oa = Symbol("XlsxViewer.loadSource"), sa = 240, ca = 200, la = 1, ua = "data-xlsx-viewer-styles", da = ".xlsx-tab-strip::-webkit-scrollbar{display:none}[data-xlsx-viewport-input]:focus{outline:none}[data-xlsx-viewport-input]:focus-visible{outline:2px solid var(--ooxml-xlsx-focus-ring,transparent);outline-offset:-2px}.xlsx-tab-nav{background:transparent;transition:background 0.1s;}.xlsx-tab-nav:hover{background:color-mix(in srgb,var(--ooxml-xlsx-chrome-text,#444) 8%,transparent);}.xlsx-zoom-slider{-webkit-appearance:none;appearance:none;background:transparent;height:15px;margin:0;}.xlsx-zoom-slider::-webkit-slider-runnable-track{height:4px;background:var(--ooxml-xlsx-chrome-border,#c4c4c4);border-radius:2px;}.xlsx-zoom-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:12px;height:12px;margin-top:-4px;border-radius:50%;background:var(--ooxml-xlsx-chrome-text-muted,#808080);cursor:pointer;}.xlsx-zoom-slider:hover::-webkit-slider-thumb{background:var(--ooxml-xlsx-chrome-text,#5f5f5f);}.xlsx-zoom-slider::-moz-range-track{height:4px;background:var(--ooxml-xlsx-chrome-border,#c4c4c4);border-radius:2px;}.xlsx-zoom-slider::-moz-range-thumb{width:12px;height:12px;border:none;border-radius:50%;background:var(--ooxml-xlsx-chrome-text-muted,#808080);cursor:pointer;}";
|
|
4614
|
+
function fa(e) {
|
|
4615
|
+
if (!e.head || e.head.querySelector(`style[${ua}]`)) return;
|
|
4604
4616
|
let t = e.createElement("style");
|
|
4605
|
-
t.setAttribute(
|
|
4617
|
+
t.setAttribute(ua, ""), t.textContent = da, e.head.appendChild(t);
|
|
4606
4618
|
}
|
|
4607
|
-
function
|
|
4619
|
+
function pa(e, t) {
|
|
4608
4620
|
let n = {
|
|
4609
4621
|
password: e.password,
|
|
4610
4622
|
useGoogleFonts: e.useGoogleFonts,
|
|
@@ -4628,32 +4640,32 @@ function la(e, t) {
|
|
|
4628
4640
|
legacyXls: e.legacyXls
|
|
4629
4641
|
};
|
|
4630
4642
|
}
|
|
4631
|
-
function
|
|
4643
|
+
function ma(e, t, n) {
|
|
4632
4644
|
let r = e ?? t;
|
|
4633
4645
|
if (!Number.isSafeInteger(r) || r < 0) throw TypeError(`${n} must be a non-negative safe integer`);
|
|
4634
4646
|
return r;
|
|
4635
4647
|
}
|
|
4636
|
-
function
|
|
4648
|
+
function ha(e) {
|
|
4637
4649
|
return {
|
|
4638
|
-
minRows:
|
|
4639
|
-
minCols:
|
|
4640
|
-
marginRows:
|
|
4641
|
-
marginCols:
|
|
4650
|
+
minRows: ma(e.minRows, zn.minRows, "minRows"),
|
|
4651
|
+
minCols: ma(e.minCols, zn.minCols, "minCols"),
|
|
4652
|
+
marginRows: ma(e.marginRows, 30, "marginRows"),
|
|
4653
|
+
marginCols: ma(e.marginCols, 10, "marginCols")
|
|
4642
4654
|
};
|
|
4643
4655
|
}
|
|
4644
|
-
var
|
|
4656
|
+
var ga = class {
|
|
4645
4657
|
container;
|
|
4646
4658
|
hostDocument;
|
|
4647
4659
|
hostWindow;
|
|
4648
|
-
acquisition = new
|
|
4660
|
+
acquisition = new Qi();
|
|
4649
4661
|
viewport;
|
|
4650
4662
|
renderDispatcher;
|
|
4651
4663
|
wrapper;
|
|
4652
4664
|
canvas;
|
|
4653
4665
|
gridRegion;
|
|
4654
4666
|
outlineGutter;
|
|
4655
|
-
viewEdits = new
|
|
4656
|
-
projectionId =
|
|
4667
|
+
viewEdits = new Or();
|
|
4668
|
+
projectionId = la++;
|
|
4657
4669
|
canvasArea;
|
|
4658
4670
|
scrollHost;
|
|
4659
4671
|
spacer;
|
|
@@ -4701,14 +4713,14 @@ var fa = class {
|
|
|
4701
4713
|
}
|
|
4702
4714
|
_pendingZoomAnchor = null;
|
|
4703
4715
|
displayedViewport = null;
|
|
4704
|
-
selectionController = new
|
|
4716
|
+
selectionController = new na();
|
|
4705
4717
|
notifier;
|
|
4706
|
-
contextReader = new
|
|
4718
|
+
contextReader = new Vi();
|
|
4707
4719
|
gridExtent;
|
|
4708
4720
|
elementContext = null;
|
|
4709
4721
|
selectionPaint;
|
|
4710
4722
|
finder;
|
|
4711
|
-
copier = new
|
|
4723
|
+
copier = new _i({
|
|
4712
4724
|
worksheet: () => this.currentWorksheet,
|
|
4713
4725
|
selection: () => this.selectionState,
|
|
4714
4726
|
workbook: () => this.wb,
|
|
@@ -4722,14 +4734,14 @@ var fa = class {
|
|
|
4722
4734
|
this.container = e, this.hostDocument = (n.kind === "sheet" ? n.canvas.ownerDocument : e.ownerDocument) ?? document;
|
|
4723
4735
|
let r = this.hostDocument.defaultView;
|
|
4724
4736
|
if (!r) throw Error("XlsxViewer requires a document with an active Window");
|
|
4725
|
-
this.hostWindow = r, this.opts = t, this.gridExtent =
|
|
4726
|
-
let i = t[
|
|
4727
|
-
this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode :
|
|
4737
|
+
this.hostWindow = r, this.opts = t, this.gridExtent = ha(t), this._mountKind = n.kind, this._nativeScrollbars = t.showScrollbars ?? !0;
|
|
4738
|
+
let i = t[aa];
|
|
4739
|
+
this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode : Pe("XlsxViewer", t.mode, i), this._hiddenSheetMode = t.hiddenSheetMode ?? "show", this.viewport = new ea(t.cellScale ?? 1), this.wrapper = this.hostDocument.createElement("div"), this.wrapper.style.cssText = `position:relative;width:100%;height:100%;background:${n.kind === "composite" ? "var(--ooxml-xlsx-chrome-surface,#fff)" : "transparent"};box-sizing:border-box;font-family:sans-serif;display:flex;flex-direction:column;`, this.gridRegion = this.hostDocument.createElement("div"), this.gridRegion.style.cssText = "position:relative;flex:1;min-height:0;overflow:hidden;", this.canvasArea = this.hostDocument.createElement("div"), this.canvasArea.style.cssText = "position:absolute;inset:0;overflow:hidden;", this.canvas = n.kind === "sheet" ? n.canvas : this.hostDocument.createElement("canvas"), this.canvas.style.cssText = "position:absolute;top:0;left:0;z-index:0;display:block;", this.renderDispatcher = new ta(this.canvas, this._mode === "worker", this.hostWindow), this.scrollHost = this.hostDocument.createElement("div"), this.scrollHost.setAttribute("data-xlsx-viewport-input", n.kind), this.scrollHost.setAttribute("role", "region"), this.scrollHost.setAttribute("aria-label", "Spreadsheet viewport. Use Arrow keys to move the selected cell. Press Enter to show its comment."), this.scrollHost.tabIndex = 0, this.scrollHost.style.cssText = `position:absolute;inset:0;overflow:${this._nativeScrollbars ? "auto" : "clip"};z-index:2;background:transparent;scrollbar-color:var(--ooxml-xlsx-chrome-scrollbar-color,auto);`, this.spacer = this.hostDocument.createElement("div"), this.spacer.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;", this._nativeScrollbars && this.scrollHost.appendChild(this.spacer), this.surface = new ra(this.canvas, this.canvasArea, this.scrollHost), this.overlayHost = new ia(this.canvasArea, this.canvas, this.scrollHost, {
|
|
4728
4740
|
commentMaxWidth: 280,
|
|
4729
4741
|
commentMaxHeight: 200,
|
|
4730
|
-
validationMaxWidth:
|
|
4731
|
-
validationMaxHeight:
|
|
4732
|
-
}), this.notifier = new
|
|
4742
|
+
validationMaxWidth: sa,
|
|
4743
|
+
validationMaxHeight: ca
|
|
4744
|
+
}), this.notifier = new Pi({
|
|
4733
4745
|
hostWindow: this.hostWindow,
|
|
4734
4746
|
isDestroyed: () => this._destroyed,
|
|
4735
4747
|
selectionState: () => this.selectionState,
|
|
@@ -4738,7 +4750,7 @@ var fa = class {
|
|
|
4738
4750
|
readContext: (e) => this.getSelectionContext({ maxTextCharacters: e }),
|
|
4739
4751
|
emitSelectionChange: () => this.emitSelectionChange(),
|
|
4740
4752
|
scheduleSelectionContextNotification: () => this.scheduleSelectionContextNotification()
|
|
4741
|
-
}), this.selectionPaint = new
|
|
4753
|
+
}), this.selectionPaint = new ji({
|
|
4742
4754
|
ownerDocument: this.hostDocument,
|
|
4743
4755
|
canvasArea: this.canvasArea,
|
|
4744
4756
|
overlayHost: this.overlayHost,
|
|
@@ -4753,7 +4765,7 @@ var fa = class {
|
|
|
4753
4765
|
cellRect: (e, t) => this._cellRect(e, t),
|
|
4754
4766
|
screenX: (e, t) => this.screenX(e, t),
|
|
4755
4767
|
drawValidationDropdown: () => this.validation.drawDropdown()
|
|
4756
|
-
}), this.comments = new
|
|
4768
|
+
}), this.comments = new Zi({
|
|
4757
4769
|
ownerDocument: this.hostDocument,
|
|
4758
4770
|
canvasArea: this.canvasArea,
|
|
4759
4771
|
overlayHost: this.overlayHost,
|
|
@@ -4763,7 +4775,7 @@ var fa = class {
|
|
|
4763
4775
|
cellRect: (e, t) => this._cellRect(e, t),
|
|
4764
4776
|
screenX: (e, t) => this.screenX(e, t),
|
|
4765
4777
|
reportError: (e) => this._reportRenderError(e)
|
|
4766
|
-
}), this.hyperlinks = new
|
|
4778
|
+
}), this.hyperlinks = new ci({
|
|
4767
4779
|
hostWindow: this.hostWindow,
|
|
4768
4780
|
enabled: () => this.opts.enableHyperlinks !== !1,
|
|
4769
4781
|
onHyperlinkClick: () => this.opts.onHyperlinkClick,
|
|
@@ -4773,7 +4785,7 @@ var fa = class {
|
|
|
4773
4785
|
goToSheet: (e) => this.goToSheet(e),
|
|
4774
4786
|
scrollToCell: (e) => this.scrollToCell(e),
|
|
4775
4787
|
reportError: (e) => this._reportRenderError(e)
|
|
4776
|
-
}), this.validation = new
|
|
4788
|
+
}), this.validation = new ni({
|
|
4777
4789
|
ownerDocument: this.hostDocument,
|
|
4778
4790
|
canvasArea: this.canvasArea,
|
|
4779
4791
|
surface: this.surface,
|
|
@@ -4788,7 +4800,7 @@ var fa = class {
|
|
|
4788
4800
|
isDestroyed: () => this._destroyed,
|
|
4789
4801
|
cellRect: (e, t) => this._cellRect(e, t),
|
|
4790
4802
|
screenX: (e, t) => this.screenX(e, t)
|
|
4791
|
-
}), this.outlineGutter = new
|
|
4803
|
+
}), this.outlineGutter = new Vr({
|
|
4792
4804
|
gridRegion: this.gridRegion,
|
|
4793
4805
|
canvasArea: this.canvasArea,
|
|
4794
4806
|
surface: this.surface,
|
|
@@ -4800,17 +4812,17 @@ var fa = class {
|
|
|
4800
4812
|
setBandHidden: (e, t, n) => this.setBandHidden(e, t, n),
|
|
4801
4813
|
setBandCollapsed: (e, t, n) => this.setBandCollapsed(e, t, n),
|
|
4802
4814
|
afterOutlineMutation: (e, t) => this.afterOutlineMutation(e, t)
|
|
4803
|
-
}),
|
|
4815
|
+
}), fa(this.hostDocument), n.kind === "composite" && (this.sheetTabs = new Yr(this.hostDocument, {
|
|
4804
4816
|
hiddenSheetMode: () => this._hiddenSheetMode,
|
|
4805
4817
|
isHidden: (e) => !!this.wb?.isHidden(e),
|
|
4806
4818
|
selectSheet: (e) => {
|
|
4807
4819
|
this.goToSheet(e).catch((e) => this._reportRenderError(e));
|
|
4808
4820
|
}
|
|
4809
|
-
}), this.opts.showZoomSlider !== !1 && (this.zoomControl = new
|
|
4821
|
+
}), this.opts.showZoomSlider !== !1 && (this.zoomControl = new $r(this.hostDocument, {
|
|
4810
4822
|
setScale: (e) => this.setScale(e),
|
|
4811
4823
|
zoomIn: () => this.zoomIn(),
|
|
4812
4824
|
zoomOut: () => this.zoomOut()
|
|
4813
|
-
}, this.viewport.scale, this.opts.zoomMin ?? .1, this.opts.zoomMax ?? 4), this.sheetTabs.append(this.zoomControl.element))), this.gridRegion.appendChild(this.canvasArea), this.wrapper.appendChild(this.gridRegion), this.sheetTabs && this.wrapper.appendChild(this.sheetTabs.tabBar), e.appendChild(this.wrapper), this.chromeTheme = new
|
|
4825
|
+
}, this.viewport.scale, this.opts.zoomMin ?? .1, this.opts.zoomMax ?? 4), this.sheetTabs.append(this.zoomControl.element))), this.gridRegion.appendChild(this.canvasArea), this.wrapper.appendChild(this.gridRegion), this.sheetTabs && this.wrapper.appendChild(this.sheetTabs.tabBar), e.appendChild(this.wrapper), this.chromeTheme = new Wi({
|
|
4814
4826
|
hostWindow: this.hostWindow,
|
|
4815
4827
|
container: this.container,
|
|
4816
4828
|
wrapper: this.wrapper,
|
|
@@ -4832,7 +4844,7 @@ var fa = class {
|
|
|
4832
4844
|
};
|
|
4833
4845
|
this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.setViewportLeft(e.x), this.viewportTop = e.y, this.reanchorHorizontalScroll(), this.layoutGutters(), this.scheduleRender(), this.updateSelectionOverlay(), this.updateFindOverlay(), this.sheetTabs?.updateNavButtons();
|
|
4834
4846
|
});
|
|
4835
|
-
a.observe(this.gridRegion), this.resizeObserver = a, this.selectionInput = new
|
|
4847
|
+
a.observe(this.gridRegion), this.resizeObserver = a, this.selectionInput = new Ei({
|
|
4836
4848
|
surface: this.surface,
|
|
4837
4849
|
scrollHost: this.scrollHost,
|
|
4838
4850
|
canvasArea: this.canvasArea,
|
|
@@ -4886,7 +4898,7 @@ var fa = class {
|
|
|
4886
4898
|
updateSpacerSize: (e) => this.updateSpacerSize(e),
|
|
4887
4899
|
refitAutoRowsAfterColumnResize: () => this.refitAutoRowsAfterColumnResize(),
|
|
4888
4900
|
reportError: (e) => this._reportRenderError(e)
|
|
4889
|
-
}), this.selectionInput.install(), this.finder = new
|
|
4901
|
+
}), this.selectionInput.install(), this.finder = new pi({
|
|
4890
4902
|
ownerDocument: this.hostDocument,
|
|
4891
4903
|
overlayHost: this.overlayHost,
|
|
4892
4904
|
workbook: () => this.wb,
|
|
@@ -4901,10 +4913,10 @@ var fa = class {
|
|
|
4901
4913
|
scrollCellIntoView: (e, t) => this._scrollCellIntoView(e, t)
|
|
4902
4914
|
}), i && (this.acquisition.install(i, !1), this._mountKind === "composite" && this.activateWorkbook(i).catch((e) => this._reportRenderError(e)));
|
|
4903
4915
|
}
|
|
4904
|
-
async [
|
|
4916
|
+
async [oa](e, t = {}) {
|
|
4905
4917
|
if (this.assertOpen(), this._borrowed) throw Error(`${this._mountKind === "sheet" ? "XlsxSheetViewer" : "XlsxViewer"}.load() is unsupported on a Viewer created by fromWorkbook(); the borrowed workbook is already loaded.`);
|
|
4906
4918
|
try {
|
|
4907
|
-
let n = await this.acquisition.replace(() =>
|
|
4919
|
+
let n = await this.acquisition.replace(() => Jn[Kn](e, pa(this.opts, this._mode), t), () => {
|
|
4908
4920
|
this.sheetRequestGeneration++, this.renderDispatcher.begin(), this.finder.invalidate(), this.hideValidationPanel(), this.releaseHostFonts();
|
|
4909
4921
|
});
|
|
4910
4922
|
if (!n) return;
|
|
@@ -4919,7 +4931,7 @@ var fa = class {
|
|
|
4919
4931
|
}
|
|
4920
4932
|
async ensureHostFonts(e) {
|
|
4921
4933
|
if (this.fontBinding?.workbook === e) return !0;
|
|
4922
|
-
let t = e[
|
|
4934
|
+
let t = e[Un];
|
|
4923
4935
|
if (typeof t != "function") return !0;
|
|
4924
4936
|
let n = ++this.fontBindingGeneration, r = await t.call(e, this.hostDocument);
|
|
4925
4937
|
return this._destroyed || n !== this.fontBindingGeneration || this.wb !== e ? (r(), !1) : (this.fontBinding?.release(), this.fontBinding = {
|
|
@@ -4952,18 +4964,18 @@ var fa = class {
|
|
|
4952
4964
|
try {
|
|
4953
4965
|
if (!await this.ensureHostFonts(n) || !this.isCurrentSheetRequest(t, n)) return;
|
|
4954
4966
|
e !== this.currentSheet && this.currentWorksheet && (this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null);
|
|
4955
|
-
let u = await
|
|
4967
|
+
let u = await Xn(n, e);
|
|
4956
4968
|
i = u.worksheet, a = u.release;
|
|
4957
4969
|
let d = () => this.isCurrentSheetRequest(t, n) ? !1 : (a?.(), a = void 0, !0);
|
|
4958
4970
|
if (d()) return;
|
|
4959
|
-
let f = u.partial, p = this.sheetViews.get(e), m = this.initialAnchorReferenceFor(n, e), h = m === void 0 ?
|
|
4971
|
+
let f = u.partial, p = this.sheetViews.get(e), m = this.initialAnchorReferenceFor(n, e), h = m === void 0 ? Ye(i) : void 0, g = h !== void 0;
|
|
4960
4972
|
if (g && (p !== void 0 && !p.parseError || this.viewEdits.hasViewEdits(e))) throw Error(`XLSX viewer cannot establish the initial size of editAs="oneCell" anchors on sheet ${e} after view edits.`);
|
|
4961
4973
|
let _ = (t) => {
|
|
4962
4974
|
let n = t.parseError || p?.parseError ? void 0 : p, r = n ?? this.createVisibleSheetView(t);
|
|
4963
|
-
return (n || u.partial) && (r.rows = t.rows), n || (m && !t.parseError &&
|
|
4975
|
+
return (n || u.partial) && (r.rows = t.rows), n || (m && !t.parseError && He(r, m), this.viewEdits.restoreSheetViewState(e, r)), r;
|
|
4964
4976
|
}, v = (r, i) => {
|
|
4965
|
-
i &&
|
|
4966
|
-
let a = n[
|
|
4977
|
+
i && pt(r);
|
|
4978
|
+
let a = n[Wn];
|
|
4967
4979
|
if (typeof a == "function") {
|
|
4968
4980
|
let e = this.hostDocument.createElement("canvas").getContext("2d");
|
|
4969
4981
|
e && (a.call(n, r, e), l = !0);
|
|
@@ -4971,8 +4983,8 @@ var fa = class {
|
|
|
4971
4983
|
this.isCurrentSheetRequest(t, n) && this.viewEdits.syncAutomaticRowOverrides(e, r);
|
|
4972
4984
|
}, y = (e) => {
|
|
4973
4985
|
if (!g || e.parseError || !this.isCurrentSheetRequest(t, n)) return;
|
|
4974
|
-
let r =
|
|
4975
|
-
return r &&
|
|
4986
|
+
let r = Ve(e, z(e), this.viewport.scale) ?? null;
|
|
4987
|
+
return r && He(e, r), r;
|
|
4976
4988
|
};
|
|
4977
4989
|
if (r = _(i), u.partial) {
|
|
4978
4990
|
let e = {
|
|
@@ -4981,7 +4993,7 @@ var fa = class {
|
|
|
4981
4993
|
scale: this.viewport.scale
|
|
4982
4994
|
};
|
|
4983
4995
|
s = e;
|
|
4984
|
-
let t = () =>
|
|
4996
|
+
let t = () => z(r).visibleRange({
|
|
4985
4997
|
width: e.width,
|
|
4986
4998
|
height: e.height,
|
|
4987
4999
|
scale: e.scale,
|
|
@@ -5005,7 +5017,7 @@ var fa = class {
|
|
|
5005
5017
|
rows: n.range.row + n.range.rows - ((r.freezeRows ?? 0) > 0 ? 1 : n.range.row),
|
|
5006
5018
|
cols: n.range.col + n.range.cols - ((r.freezeCols ?? 0) > 0 ? 1 : n.range.col)
|
|
5007
5019
|
};
|
|
5008
|
-
if (this.previewFallbackReason =
|
|
5020
|
+
if (this.previewFallbackReason = tr(r, l, a) ?? (g ? nr(r, o, a) : null), this.previewFallbackReason) {
|
|
5009
5021
|
if (i = await u.completion, d()) return;
|
|
5010
5022
|
f = !1, s = null, r = _(i), v(r, !0);
|
|
5011
5023
|
}
|
|
@@ -5013,11 +5025,11 @@ var fa = class {
|
|
|
5013
5025
|
} else v(r, !1), c = y(r);
|
|
5014
5026
|
o = f ? u.completion : null;
|
|
5015
5027
|
} catch (e) {
|
|
5016
|
-
if (a?.(), c &&
|
|
5028
|
+
if (a?.(), c && dt(c), !this.isCurrentSheetRequest(t, n)) return;
|
|
5017
5029
|
throw await this.restoreDisplayedWorksheetLease(n, t), e;
|
|
5018
5030
|
}
|
|
5019
5031
|
if (!this.isCurrentSheetRequest(t, n)) {
|
|
5020
|
-
a?.(), c &&
|
|
5032
|
+
a?.(), c && dt(c);
|
|
5021
5033
|
return;
|
|
5022
5034
|
}
|
|
5023
5035
|
this.selectionInput.clearSheetGestures(), this.viewEdits.restoreRowResizeRanges(e, r), c !== void 0 && this.installInitialAnchorReference(n, e, c), this.currentAutoRowHeightsPrepared = l, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = a ?? null, this.sheetViews.clear(), this.sheetViews.set(e, r), this.currentSheet = e, this.displayedViewport = null, this.currentWorksheet = r, this.previewCompletion = o, this.firstPreviewRender = o !== null, this.previewPreparedViewport = s, o && o.then((i) => {
|
|
@@ -5026,13 +5038,13 @@ var fa = class {
|
|
|
5026
5038
|
let a = !!i.parseError;
|
|
5027
5039
|
this.selectionInput.clearSheetGestures();
|
|
5028
5040
|
let o = this.createVisibleSheetView(i), s = a ? void 0 : this.initialAnchorReferenceFor(n, e);
|
|
5029
|
-
if (s &&
|
|
5041
|
+
if (s && He(o, s), this.viewEdits.restoreSheetViewState(e, o), this.displayedViewport = null, this.currentWorksheet = o, this.sheetViews.set(e, o), a) {
|
|
5030
5042
|
this.currentSourceComments = [], this.sourceCommentMap.clear(), this.selectionController.reset(), this.emitSelectionChange(), this.updateSelectionOverlay(), this.buildCommentMap(o), this.buildHyperlinkMap(o), this.buildOutline(o), this.layoutGutters(), this.updateSpacerSize(o), this.scheduleRender();
|
|
5031
5043
|
return;
|
|
5032
5044
|
}
|
|
5033
|
-
|
|
5045
|
+
ct(r), pt(r);
|
|
5034
5046
|
let c = this.hostDocument.createElement("canvas").getContext("2d");
|
|
5035
|
-
c && (n[
|
|
5047
|
+
c && (n[Wn](o, c), this.currentAutoRowHeightsPrepared = !0), this.viewEdits.syncAutomaticRowOverrides(e, o), this.currentSourceComments = i.comments ?? [], this.sourceCommentMap = Xi(this.currentSourceComments), this.buildCommentMap(o), this.buildHyperlinkMap(o), this.buildOutline(o), this.layoutGutters(), this.updateSpacerSize(o), this.scheduleRender(), this.scheduleSelectionContextNotification();
|
|
5036
5048
|
}).catch((e) => {
|
|
5037
5049
|
if (!(!this.isCurrentSheetRequest(t, n) || this.currentWorksheet !== r)) {
|
|
5038
5050
|
if (this.previewCompletion = null, this.firstPreviewRender = !1, this.previewPreparedViewport = null, this.selectionInput.clearSheetGestures(), this.displayedViewport = null, this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.renderDispatcher.begin(), this._mode === "worker") {
|
|
@@ -5043,7 +5055,7 @@ var fa = class {
|
|
|
5043
5055
|
} else this.canvas.getContext("2d")?.clearRect?.(0, 0, this.canvas.width, this.canvas.height);
|
|
5044
5056
|
this._reportRenderError(e);
|
|
5045
5057
|
}
|
|
5046
|
-
}), this.currentSourceComments = i.comments ?? [], this.opts.comments !== !1 && this.currentSourceComments.length > 0 && this.comments.loadUi().catch((e) => this._reportRenderError(e)), this.sourceCommentMap =
|
|
5058
|
+
}), this.currentSourceComments = i.comments ?? [], this.opts.comments !== !1 && this.currentSourceComments.length > 0 && this.comments.loadUi().catch((e) => this._reportRenderError(e)), this.sourceCommentMap = Xi(this.currentSourceComments), this.setElementContext(null), this.selectionInput.clearSheetGestures(), this.updateFooterDirection(), this.viewportTop = 0, this.selectionController.reset(), this.emitSelectionChange(), this.hideCommentPopup(), this.hideValidationPanel(), this.updateSelectionOverlay(), this.updateTabActive(e), this.buildCommentMap(this.currentWorksheet), this.buildHyperlinkMap(this.currentWorksheet), this.buildOutline(this.currentWorksheet), this.layoutGutters(), this.updateSpacerSize(this.currentWorksheet), this.resetHorizontalScroll();
|
|
5047
5059
|
let u = this.committedFrameCount;
|
|
5048
5060
|
await this.renderCurrentSheet();
|
|
5049
5061
|
let d = this.committedFrameCount > u;
|
|
@@ -5063,12 +5075,12 @@ var fa = class {
|
|
|
5063
5075
|
this.initialAnchorWorkbook !== e && (this.releaseInitialAnchorReferences(), this.initialAnchorWorkbook = e), this.initialAnchorReferences.has(t) || this.initialAnchorReferences.set(t, n);
|
|
5064
5076
|
}
|
|
5065
5077
|
releaseInitialAnchorReferences() {
|
|
5066
|
-
for (let e of this.initialAnchorReferences.values()) e &&
|
|
5078
|
+
for (let e of this.initialAnchorReferences.values()) e && dt(e);
|
|
5067
5079
|
this.initialAnchorReferences.clear(), this.initialAnchorWorkbook = null;
|
|
5068
5080
|
}
|
|
5069
5081
|
async restoreDisplayedWorksheetLease(e, t) {
|
|
5070
5082
|
if (!this.currentWorksheet || this.releaseCurrentWorksheet) return;
|
|
5071
|
-
let n = await
|
|
5083
|
+
let n = await Zn(e, this.currentSheet);
|
|
5072
5084
|
this.isCurrentSheetRequest(t, e) && this.currentWorksheet && !this.releaseCurrentWorksheet ? this.releaseCurrentWorksheet = n : n();
|
|
5073
5085
|
}
|
|
5074
5086
|
buildOutline(e) {
|
|
@@ -5083,7 +5095,7 @@ var fa = class {
|
|
|
5083
5095
|
scrollOutlineSummaryToStart(e, t) {
|
|
5084
5096
|
let n = this.currentWorksheet;
|
|
5085
5097
|
if (!n) return;
|
|
5086
|
-
let r = this.viewport.scale, i =
|
|
5098
|
+
let r = this.viewport.scale, i = z(n).scrollOffsetForCell(e === "row" ? t : 1, e === "col" ? t : 1, {
|
|
5087
5099
|
scale: r,
|
|
5088
5100
|
viewportWidth: this.canvasArea.clientWidth,
|
|
5089
5101
|
viewportHeight: this.canvasArea.clientHeight,
|
|
@@ -5111,7 +5123,7 @@ var fa = class {
|
|
|
5111
5123
|
r && this.viewEdits.setBandCollapsed(r, this.currentSheet, e, t, n);
|
|
5112
5124
|
}
|
|
5113
5125
|
afterOutlineMutation(e, t) {
|
|
5114
|
-
|
|
5126
|
+
U.invalidate(e), this.outlineGutter.rebuild(e), this.updateSpacerSize(e), t && this.scrollOutlineSummaryToStart(t.axis, t.summary), this.updateSelectionOverlay(), this.updateFindOverlay(), this.scheduleRender(), t && this.emitViewportChange();
|
|
5115
5127
|
}
|
|
5116
5128
|
get isRtl() {
|
|
5117
5129
|
return this.currentWorksheet?.rightToLeft === !0;
|
|
@@ -5146,7 +5158,7 @@ var fa = class {
|
|
|
5146
5158
|
this.viewport.setOffset(e, this.viewport.y), this._nativeScrollbars && (this.scrollHost.scrollLeft = this.isRtl ? Math.max(0, this.maxScrollLeft - this.viewport.x) : this.viewport.x);
|
|
5147
5159
|
}
|
|
5148
5160
|
screenX(e, t) {
|
|
5149
|
-
return this.isRtl ?
|
|
5161
|
+
return this.isRtl ? Ct(e, t, this.canvasArea.clientWidth) : e;
|
|
5150
5162
|
}
|
|
5151
5163
|
resetHorizontalScroll() {
|
|
5152
5164
|
this.viewport.setOffset(0, this.viewport.y), this._nativeScrollbars && (this.scrollHost.scrollLeft = this.isRtl ? this.maxScrollLeft : 0);
|
|
@@ -5200,14 +5212,14 @@ var fa = class {
|
|
|
5200
5212
|
this.reanchorHorizontalScroll(), this.layoutGutters(), this.currentWorksheet && this.updateSpacerSize(this.currentWorksheet), await this.renderCurrentSheet(), this.updateSelectionOverlay(), this.updateFindOverlay();
|
|
5201
5213
|
}
|
|
5202
5214
|
async scrollToCell(e, t = {}) {
|
|
5203
|
-
let n =
|
|
5215
|
+
let n = L(e);
|
|
5204
5216
|
!n || !this.currentWorksheet || (this.previewCompletion && await this.previewCompletion, this._scrollCellIntoView(n.row, n.col, t.align ?? "nearest"), await this.renderCurrentSheet(), this.updateSelectionOverlay(), this.updateFindOverlay(), this.emitViewportChange());
|
|
5205
5217
|
}
|
|
5206
5218
|
_stepSheet(e) {
|
|
5207
|
-
return this._hiddenSheetMode === "skip" && this.wb ?
|
|
5219
|
+
return this._hiddenSheetMode === "skip" && this.wb ? Wt(this.currentSheet, e, (e) => this.wb.isHidden(e), this.sheetCount) : this.currentSheet + e;
|
|
5208
5220
|
}
|
|
5209
5221
|
_initialSheet() {
|
|
5210
|
-
return this._hiddenSheetMode === "skip" && this.wb ?
|
|
5222
|
+
return this._hiddenSheetMode === "skip" && this.wb ? Gt(0, (e) => this.wb.isHidden(e), this.sheetCount) : 0;
|
|
5211
5223
|
}
|
|
5212
5224
|
displayedViewportOffset() {
|
|
5213
5225
|
let e = this.displayedViewport;
|
|
@@ -5229,7 +5241,7 @@ var fa = class {
|
|
|
5229
5241
|
x: this.effectiveScrollLeft,
|
|
5230
5242
|
y: this.viewportTop
|
|
5231
5243
|
} : this.displayedViewportOffset();
|
|
5232
|
-
return
|
|
5244
|
+
return z(r).cellAt(u, d, {
|
|
5233
5245
|
scrollX: f.x,
|
|
5234
5246
|
scrollY: f.y,
|
|
5235
5247
|
scale: i
|
|
@@ -5240,7 +5252,7 @@ var fa = class {
|
|
|
5240
5252
|
if (!e) return null;
|
|
5241
5253
|
let t = this.canvasArea.clientWidth, n = this.canvasArea.clientHeight;
|
|
5242
5254
|
if (t <= 0 || n <= 0) return null;
|
|
5243
|
-
let r = this.viewport.scale, i =
|
|
5255
|
+
let r = this.viewport.scale, i = z(e).visibleRange({
|
|
5244
5256
|
width: t,
|
|
5245
5257
|
height: n,
|
|
5246
5258
|
scale: r,
|
|
@@ -5266,7 +5278,7 @@ var fa = class {
|
|
|
5266
5278
|
let n = this.currentWorksheet, r = this.elementContextViewport();
|
|
5267
5279
|
if (!n || !r) return null;
|
|
5268
5280
|
let i = this.canvasArea.getBoundingClientRect();
|
|
5269
|
-
return
|
|
5281
|
+
return gr(n, this.currentSheet, {
|
|
5270
5282
|
x: e - i.left,
|
|
5271
5283
|
y: t - i.top
|
|
5272
5284
|
}, r);
|
|
@@ -5275,7 +5287,7 @@ var fa = class {
|
|
|
5275
5287
|
let n = this.currentWorksheet;
|
|
5276
5288
|
if (!n) return null;
|
|
5277
5289
|
let r = this.viewport.scale;
|
|
5278
|
-
return
|
|
5290
|
+
return z(n).cellRect(e, t, {
|
|
5279
5291
|
scale: r,
|
|
5280
5292
|
scrollX: this.displayedViewportOffset().x,
|
|
5281
5293
|
scrollY: this.displayedViewportOffset().y,
|
|
@@ -5285,7 +5297,7 @@ var fa = class {
|
|
|
5285
5297
|
}
|
|
5286
5298
|
getCellViewportRect(e) {
|
|
5287
5299
|
if (this._destroyed) return null;
|
|
5288
|
-
let t = typeof e == "string" ?
|
|
5300
|
+
let t = typeof e == "string" ? L(e) : e;
|
|
5289
5301
|
if (!t || t.row < 1 || t.col < 1) return null;
|
|
5290
5302
|
let n = this._cellRect(t.row, t.col);
|
|
5291
5303
|
return n ? Object.freeze({
|
|
@@ -5299,12 +5311,12 @@ var fa = class {
|
|
|
5299
5311
|
return this.assertOpen(), structuredClone(this.currentSourceComments);
|
|
5300
5312
|
}
|
|
5301
5313
|
async goToComment(e, t, n) {
|
|
5302
|
-
let r =
|
|
5314
|
+
let r = L(t), i = this.wb;
|
|
5303
5315
|
if (!r || !i || !Number.isInteger(e) || e < 0 || e >= i.sheetCount) return !1;
|
|
5304
5316
|
let a = ++this.commentNavigationGeneration, o = e === this.currentSheet && this.currentWorksheet !== null ? this.currentSourceComments : await i.getComments(e);
|
|
5305
5317
|
if (this._destroyed) throw this.destroyedError();
|
|
5306
5318
|
if (a !== this.commentNavigationGeneration || i !== this.wb || !o.some((e) => {
|
|
5307
|
-
let t =
|
|
5319
|
+
let t = L(e.cellRef);
|
|
5308
5320
|
return t?.row === r.row && t.col === r.col;
|
|
5309
5321
|
})) return !1;
|
|
5310
5322
|
if (e !== this.currentSheet || this.currentWorksheet === null) {
|
|
@@ -5322,20 +5334,20 @@ var fa = class {
|
|
|
5322
5334
|
if (this._destroyed) throw Error("XlsxViewer has been destroyed");
|
|
5323
5335
|
let t;
|
|
5324
5336
|
if (typeof e == "string") {
|
|
5325
|
-
if (t =
|
|
5326
|
-
} else t = e ?
|
|
5337
|
+
if (t = Er(e), !t) throw SyntaxError(`Invalid XLSX selection reference: ${e}`);
|
|
5338
|
+
} else t = e ? Y(e) : null;
|
|
5327
5339
|
this.commitSelection(t);
|
|
5328
5340
|
}
|
|
5329
5341
|
getSelectionContext(e = {}) {
|
|
5330
5342
|
if (this.assertOpen(), this.previewCompletion) return null;
|
|
5331
|
-
if (this.elementContext) return
|
|
5343
|
+
if (this.elementContext) return _r(this.elementContext, e.maxTextCharacters);
|
|
5332
5344
|
let t = this.currentWorksheet, n = this.selectionState;
|
|
5333
5345
|
return !t || !n ? null : this.contextReader.read(t, this.currentSheet, n, this.sourceCommentMap, this.wb, e);
|
|
5334
5346
|
}
|
|
5335
5347
|
commitSelection(e) {
|
|
5336
5348
|
this.setElementContext(null);
|
|
5337
5349
|
let t = this.selectionState;
|
|
5338
|
-
|
|
5350
|
+
X(t, e) || (this.hideValidationPanel(), this.selectionController.setState(e), this.updateSelectionOverlay(), this.wb && this.scheduleRender(), this.emitSelectionChange());
|
|
5339
5351
|
}
|
|
5340
5352
|
setElementContext(e) {
|
|
5341
5353
|
return JSON.stringify(this.elementContext) === JSON.stringify(e) ? !1 : (this.elementContext = e ? structuredClone(e) : null, this.updateSelectionOverlay(), this.scheduleSelectionContextNotification(), !0);
|
|
@@ -5349,8 +5361,8 @@ var fa = class {
|
|
|
5349
5361
|
refitAutoRowsAfterColumnResize() {
|
|
5350
5362
|
let e = this.currentWorksheet, t = this.preparedWorkbook;
|
|
5351
5363
|
if (!e || !t) return;
|
|
5352
|
-
|
|
5353
|
-
let n = t[
|
|
5364
|
+
pt(e, this.viewEdits.manualRows(this.currentSheet));
|
|
5365
|
+
let n = t[Wn];
|
|
5354
5366
|
if (typeof n != "function") return;
|
|
5355
5367
|
let r = this.hostDocument.createElement("canvas").getContext("2d");
|
|
5356
5368
|
r && (n.call(t, e, r), this.viewEdits.syncAutomaticRowOverrides(this.currentSheet, e), this.updateSpacerSize(e), this.updateSelectionOverlay(), this.scheduleRender());
|
|
@@ -5359,7 +5371,7 @@ var fa = class {
|
|
|
5359
5371
|
this.opts.selectionColor = e, this.updateSelectionOverlay();
|
|
5360
5372
|
}
|
|
5361
5373
|
async setHiddenSheetMode(e) {
|
|
5362
|
-
this._hiddenSheetMode = e, this.buildTabs(), e === "skip" && this.wb && this.wb.isHidden(this.currentSheet) ? await this.showSheet(
|
|
5374
|
+
this._hiddenSheetMode = e, this.buildTabs(), e === "skip" && this.wb && this.wb.isHidden(this.currentSheet) ? await this.showSheet(Gt(this.currentSheet, (e) => this.wb.isHidden(e), this.sheetCount)) : this.updateTabActive(this.currentSheet);
|
|
5363
5375
|
}
|
|
5364
5376
|
get hiddenSheetMode() {
|
|
5365
5377
|
return this._hiddenSheetMode;
|
|
@@ -5367,7 +5379,7 @@ var fa = class {
|
|
|
5367
5379
|
get visibleSheetCount() {
|
|
5368
5380
|
if (!this.wb) return 0;
|
|
5369
5381
|
let e = this.wb;
|
|
5370
|
-
return
|
|
5382
|
+
return Kt((t) => e.isHidden(t), this.sheetCount);
|
|
5371
5383
|
}
|
|
5372
5384
|
async copySelection() {
|
|
5373
5385
|
return this.assertOpen(), this.previewCompletion && await this.previewCompletion, this.copier.copy();
|
|
@@ -5393,7 +5405,7 @@ var fa = class {
|
|
|
5393
5405
|
_scrollCellIntoView(e, t, n = "nearest") {
|
|
5394
5406
|
let r = this.currentWorksheet;
|
|
5395
5407
|
if (!r) return;
|
|
5396
|
-
let i = this.viewport.scale, a =
|
|
5408
|
+
let i = this.viewport.scale, a = z(r).scrollOffsetForCell(e, t, {
|
|
5397
5409
|
scale: i,
|
|
5398
5410
|
viewportWidth: this.canvasArea.clientWidth,
|
|
5399
5411
|
viewportHeight: this.canvasArea.clientHeight,
|
|
@@ -5412,14 +5424,14 @@ var fa = class {
|
|
|
5412
5424
|
this.comments.setComments(e.comments ?? []);
|
|
5413
5425
|
}
|
|
5414
5426
|
createVisibleSheetView(e) {
|
|
5415
|
-
let t =
|
|
5427
|
+
let t = $i(e);
|
|
5416
5428
|
if (this.opts.comments === !1) {
|
|
5417
5429
|
let e = {
|
|
5418
5430
|
...t,
|
|
5419
5431
|
commentRefs: [],
|
|
5420
5432
|
comments: []
|
|
5421
5433
|
};
|
|
5422
|
-
return
|
|
5434
|
+
return nt(t, e), Vn(t, e), Ht(t, e), e;
|
|
5423
5435
|
}
|
|
5424
5436
|
if ((typeof this.opts.comments == "object" ? this.opts.comments : void 0)?.includeResolved !== !1) return t;
|
|
5425
5437
|
let n = new Set((t.comments ?? []).filter((e) => e.resolved === !0).map((e) => e.cellRef));
|
|
@@ -5429,7 +5441,7 @@ var fa = class {
|
|
|
5429
5441
|
commentRefs: t.commentRefs?.filter((e) => !n.has(e)),
|
|
5430
5442
|
comments: t.comments?.filter((e) => !n.has(e.cellRef))
|
|
5431
5443
|
};
|
|
5432
|
-
return
|
|
5444
|
+
return nt(t, r), Vn(t, r), Ht(t, r), r;
|
|
5433
5445
|
}
|
|
5434
5446
|
buildHyperlinkMap(e) {
|
|
5435
5447
|
this.hyperlinks.build(e);
|
|
@@ -5449,8 +5461,8 @@ var fa = class {
|
|
|
5449
5461
|
if (this.viewport.setScale(i), this.zoomControl?.sync(i, r, t, n), this.currentWorksheet) {
|
|
5450
5462
|
let e = this.effectiveScrollLeft, t = this.viewportTop;
|
|
5451
5463
|
if (this.layoutGutters(), this.updateSpacerSize(this.currentWorksheet), o) {
|
|
5452
|
-
this.viewportTop =
|
|
5453
|
-
let n = this.screenX(o.x, 0), r = this.maxScrollLeft, s =
|
|
5464
|
+
this.viewportTop = xe(t, o.y, a, i, { maxScroll: this.maxScrollTop });
|
|
5465
|
+
let n = this.screenX(o.x, 0), r = this.maxScrollLeft, s = xe(e, n, a, i, { maxScroll: r });
|
|
5454
5466
|
this.setViewportLeft(s);
|
|
5455
5467
|
} else this.setViewportLeft(e);
|
|
5456
5468
|
}
|
|
@@ -5461,10 +5473,10 @@ var fa = class {
|
|
|
5461
5473
|
return this.viewport.scale;
|
|
5462
5474
|
}
|
|
5463
5475
|
zoomIn() {
|
|
5464
|
-
this.setScale(
|
|
5476
|
+
this.setScale(Te(this.getScale()));
|
|
5465
5477
|
}
|
|
5466
5478
|
zoomOut() {
|
|
5467
|
-
this.setScale(
|
|
5479
|
+
this.setScale(Ie(this.getScale()));
|
|
5468
5480
|
}
|
|
5469
5481
|
fitWidth() {
|
|
5470
5482
|
this._fit("width");
|
|
@@ -5475,7 +5487,7 @@ var fa = class {
|
|
|
5475
5487
|
_fit(e) {
|
|
5476
5488
|
let t = this.currentWorksheet;
|
|
5477
5489
|
if (!t) return;
|
|
5478
|
-
let { width: n, height: r } = this._naturalContentExtent(t), i =
|
|
5490
|
+
let { width: n, height: r } = this._naturalContentExtent(t), i = Le({
|
|
5479
5491
|
contentWidth: n,
|
|
5480
5492
|
contentHeight: r,
|
|
5481
5493
|
containerWidth: this.canvasArea.clientWidth,
|
|
@@ -5484,13 +5496,13 @@ var fa = class {
|
|
|
5484
5496
|
i <= 0 || this.setScale(i);
|
|
5485
5497
|
}
|
|
5486
5498
|
_naturalContentExtent(e) {
|
|
5487
|
-
let { maxRow: t, maxCol: n } =
|
|
5488
|
-
return
|
|
5499
|
+
let { maxRow: t, maxCol: n } = Hn(e, this.gridExtent);
|
|
5500
|
+
return z(e).logicalContentExtent(t, n, 50, 22);
|
|
5489
5501
|
}
|
|
5490
5502
|
updateSpacerSize(e) {
|
|
5491
|
-
let t = this.viewport.scale, { maxRow: n, maxCol: r } =
|
|
5503
|
+
let t = this.viewport.scale, { maxRow: n, maxCol: r } = Hn(e, this.gridExtent);
|
|
5492
5504
|
n += this.gridExtent.marginRows, r += this.gridExtent.marginCols;
|
|
5493
|
-
let i =
|
|
5505
|
+
let i = z(e).roundedContentExtent(n, r, t, 50, 22), a = i.width, o = i.height;
|
|
5494
5506
|
this.spacer.style.width = `${a}px`, this.spacer.style.height = `${o}px`, this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.viewport.setExtent(a, o), this.setViewportLeft(this.viewport.x), this.viewportTop = this.viewport.y;
|
|
5495
5507
|
}
|
|
5496
5508
|
scheduleRender(e = !1) {
|
|
@@ -5521,7 +5533,7 @@ var fa = class {
|
|
|
5521
5533
|
}
|
|
5522
5534
|
let t = this.currentWorksheet, n = this.canvasArea.clientWidth, r = this.canvasArea.clientHeight;
|
|
5523
5535
|
if (n <= 0 || r <= 0) return;
|
|
5524
|
-
let i = this.viewport.scale, a = this.surface.dpr, o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = this.effectiveScrollLeft, l = this.viewportTop, u =
|
|
5536
|
+
let i = this.viewport.scale, a = this.surface.dpr, o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = this.effectiveScrollLeft, l = this.viewportTop, u = z(t).visibleRange({
|
|
5525
5537
|
width: n,
|
|
5526
5538
|
height: r,
|
|
5527
5539
|
scale: i,
|
|
@@ -5548,10 +5560,10 @@ var fa = class {
|
|
|
5548
5560
|
revision: this.viewEdits.sizeRevision(this.currentSheet),
|
|
5549
5561
|
autoRowHeightsPrepared: this.currentAutoRowHeightsPrepared,
|
|
5550
5562
|
...v ? { initialAnchorSizes: v } : {}
|
|
5551
|
-
} : void 0, b =
|
|
5563
|
+
} : void 0, b = jn(_ ? {
|
|
5552
5564
|
...g,
|
|
5553
5565
|
sizeOverrides: _.overrides
|
|
5554
|
-
} : g,
|
|
5566
|
+
} : g, z(t).maximumDigitWidth, {
|
|
5555
5567
|
worksheet: t,
|
|
5556
5568
|
projection: y
|
|
5557
5569
|
});
|
|
@@ -5566,7 +5578,7 @@ var fa = class {
|
|
|
5566
5578
|
width: n,
|
|
5567
5579
|
height: r
|
|
5568
5580
|
}, this.updateSelectionOverlay(), this.updateFindOverlay(), this._lastViewportNotification && this.emitViewportChange();
|
|
5569
|
-
} else if (await this.workbook.renderViewport(this.canvas, this.currentSheet, d,
|
|
5581
|
+
} else if (await this.workbook.renderViewport(this.canvas, this.currentSheet, d, sn(b, () => !this._destroyed && this.renderDispatcher.isCurrent(e))), !this.renderDispatcher.isCurrent(e) || this._destroyed) return;
|
|
5570
5582
|
this.renderGutters(), this.firstPreviewRender = !1, this.committedFrameCount++;
|
|
5571
5583
|
}
|
|
5572
5584
|
computeHeaderHighlight() {
|
|
@@ -5585,7 +5597,7 @@ var fa = class {
|
|
|
5585
5597
|
destroy() {
|
|
5586
5598
|
if (this._destroyed) return;
|
|
5587
5599
|
this._destroyed = !0, this.notifier.destroy(), this.selectionInput.destroy(), this.sheetRequestGeneration++, this.resizeObserver?.disconnect(), this.chromeTheme.destroy(), this.renderDispatcher.destroy(), this.surface.destroy(), this.overlayHost.destroy(), this.sheetTabs?.destroy(), this.zoomControl?.destroy(), this.comments.destroy(), this.validation.destroy(), this.finder.destroy(), this.releaseHostFonts();
|
|
5588
|
-
let e = this.wb?.[
|
|
5600
|
+
let e = this.wb?.[Gn];
|
|
5589
5601
|
typeof e == "function" && e.call(this.wb, this.projectionId), this.displayedViewport = null, this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.sheetViews.clear(), this.releaseInitialAnchorReferences(), this.viewEdits.destroy(), this.currentSourceComments = [], this.sourceCommentMap.clear(), this.hyperlinks.destroy(), this.preparedWorkbook = null, this.outlineGutter.destroy(), this.elementContext = null, this.selectionController.reset(), this.acquisition.destroy(), this.wrapper.remove();
|
|
5590
5602
|
}
|
|
5591
5603
|
assertOpen() {
|
|
@@ -5594,20 +5606,20 @@ var fa = class {
|
|
|
5594
5606
|
destroyedError() {
|
|
5595
5607
|
return /* @__PURE__ */ Error(this._mountKind === "sheet" ? "XlsxSheetViewer is destroyed" : "XlsxViewer is destroyed");
|
|
5596
5608
|
}
|
|
5597
|
-
},
|
|
5609
|
+
}, _a = class e extends ga {
|
|
5598
5610
|
static fromWorkbook(t, n, r = {}) {
|
|
5599
5611
|
return new e(t, {
|
|
5600
5612
|
...r,
|
|
5601
|
-
[
|
|
5613
|
+
[aa]: n
|
|
5602
5614
|
});
|
|
5603
5615
|
}
|
|
5604
5616
|
constructor(e, t = {}) {
|
|
5605
5617
|
super(e, t, { kind: "composite" });
|
|
5606
5618
|
}
|
|
5607
5619
|
async load(e) {
|
|
5608
|
-
await this[
|
|
5620
|
+
await this[oa](e);
|
|
5609
5621
|
}
|
|
5610
|
-
},
|
|
5622
|
+
}, va = class e {
|
|
5611
5623
|
canvasElement;
|
|
5612
5624
|
engine;
|
|
5613
5625
|
canvasMount;
|
|
@@ -5617,16 +5629,16 @@ var fa = class {
|
|
|
5617
5629
|
static fromWorkbook(t, n, r = {}) {
|
|
5618
5630
|
return new e(t, {
|
|
5619
5631
|
...r,
|
|
5620
|
-
[
|
|
5632
|
+
[aa]: n
|
|
5621
5633
|
});
|
|
5622
5634
|
}
|
|
5623
5635
|
constructor(e, t = {}) {
|
|
5624
5636
|
this.canvasElement = e;
|
|
5625
|
-
let n = t[
|
|
5626
|
-
this.canvasMount = new
|
|
5637
|
+
let n = t[aa], r = Pe("XlsxSheetViewer", t.mode, n), i = e.getBoundingClientRect();
|
|
5638
|
+
this.canvasMount = new Ne(e, {
|
|
5627
5639
|
wrapperCssText: `position:relative;display:inline-block;vertical-align:top;overflow:hidden;width:${e.style.width || `${i.width || e.width}px`};height:${e.style.height || `${i.height || e.height}px`};`,
|
|
5628
5640
|
restoreMode: "style-and-bitmap"
|
|
5629
|
-
}), this.engine = new
|
|
5641
|
+
}), this.engine = new ga(this.canvasMount.wrapper, {
|
|
5630
5642
|
...t,
|
|
5631
5643
|
onResourceMetrics: (e) => {
|
|
5632
5644
|
this.lastMetrics = e, t.onResourceMetrics?.(e);
|
|
@@ -5652,7 +5664,7 @@ var fa = class {
|
|
|
5652
5664
|
async load(e, t = {}) {
|
|
5653
5665
|
this.assertOpen();
|
|
5654
5666
|
try {
|
|
5655
|
-
await this.engine[
|
|
5667
|
+
await this.engine[oa](e, t);
|
|
5656
5668
|
} finally {
|
|
5657
5669
|
this.destroyed || this.captureSnapshot();
|
|
5658
5670
|
}
|
|
@@ -5794,21 +5806,21 @@ var fa = class {
|
|
|
5794
5806
|
destroyedError() {
|
|
5795
5807
|
return /* @__PURE__ */ Error("XlsxSheetViewer is destroyed");
|
|
5796
5808
|
}
|
|
5797
|
-
},
|
|
5809
|
+
}, ya = /* @__PURE__ */ e({
|
|
5798
5810
|
MAX_SELECTION_AREAS: () => 128,
|
|
5799
|
-
MAX_SELECTION_CONTEXT_CELLS: () =>
|
|
5800
|
-
MAX_SELECTION_CONTEXT_TEXT_CHARACTERS: () =>
|
|
5801
|
-
OoxmlDecodedImageLimitError: () =>
|
|
5802
|
-
OoxmlError: () =>
|
|
5803
|
-
OoxmlResourceLimitError: () =>
|
|
5804
|
-
TiffDecodeError: () =>
|
|
5805
|
-
XlsxSheetViewer: () =>
|
|
5806
|
-
XlsxViewer: () =>
|
|
5807
|
-
XlsxWorkbook: () =>
|
|
5808
|
-
autoResize: () =>
|
|
5809
|
-
isOoxmlDecodedImageLimitError: () =>
|
|
5810
|
-
isTiffDecodeError: () =>
|
|
5811
|
-
openExternalHyperlink: () =>
|
|
5812
|
-
resolveSharedStrings: () =>
|
|
5811
|
+
MAX_SELECTION_CONTEXT_CELLS: () => yr,
|
|
5812
|
+
MAX_SELECTION_CONTEXT_TEXT_CHARACTERS: () => br,
|
|
5813
|
+
OoxmlDecodedImageLimitError: () => ue,
|
|
5814
|
+
OoxmlError: () => t,
|
|
5815
|
+
OoxmlResourceLimitError: () => g,
|
|
5816
|
+
TiffDecodeError: () => _e,
|
|
5817
|
+
XlsxSheetViewer: () => va,
|
|
5818
|
+
XlsxViewer: () => _a,
|
|
5819
|
+
XlsxWorkbook: () => Jn,
|
|
5820
|
+
autoResize: () => ye,
|
|
5821
|
+
isOoxmlDecodedImageLimitError: () => I,
|
|
5822
|
+
isTiffDecodeError: () => ge,
|
|
5823
|
+
openExternalHyperlink: () => ae,
|
|
5824
|
+
resolveSharedStrings: () => Dt
|
|
5813
5825
|
});
|
|
5814
|
-
export {
|
|
5826
|
+
export { yr as a, Mn as c, vr as i, jn as l, va as n, br as o, _a as r, Jn as s, ya as t };
|