@silurus/ooxml 0.89.4 → 0.89.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{render-worker-CyUrUidp.js → render-worker-B5HWxkbU.js} +7 -7
- package/dist/assets/render-worker-Ba4LYMJd.js +15 -0
- package/dist/assets/{render-worker-Bye3wDV9.js → render-worker-DkqinUC6.js} +28 -28
- package/dist/{bounded-raw-part-cache-Bi_VqXmg.js → bounded-raw-part-cache-B8t03tSP.js} +740 -731
- package/dist/{canvas-viewer-mechanics-ycCX6v-z.js → canvas-viewer-mechanics-DI38gHNV.js} +1 -1
- package/dist/{comment-overlay-controller-CR5ySvki.js → comment-overlay-controller-Crm5Syhx.js} +2 -2
- package/dist/{comment-ui-runtime-CwTOCwA8.js → comment-ui-runtime-BfEPgl5r.js} +2 -2
- package/dist/{comment-ui-runtime-BWhLz4gq.js → comment-ui-runtime-hfewTmVJ.js} +3 -3
- package/dist/{document-model-source-Csow9uxO.js → document-model-source-BUTSwkyP.js} +6 -6
- package/dist/{document-pull-client-CHpz0Q1p.js → document-pull-client-C_D779tO.js} +60 -58
- package/dist/{document-pull-worker-1ZJv9f9W.js → document-pull-worker-Bkewz-So.js} +2 -2
- package/dist/{docx-D9E0vCq-.js → docx-BC2HQtjg.js} +9 -9
- package/dist/{docx-GXxH0AwW.js → docx-BfLZeiwa.js} +16 -16
- package/dist/{docx-model-source-aKx2gZH9.js → docx-model-source-IjrOZgnl.js} +6 -6
- package/dist/docx.mjs +3 -3
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{drawingml-shape-BwELUfNW.js → drawingml-shape-BcXkRayC.js} +1 -1
- package/dist/{font-preload-demand-BuMy4iJ1.js → font-preload-demand-B6HPFxDp.js} +1 -1
- package/dist/{host-layout-measure-GU0oJ4Me.js → host-layout-measure-DJvccDI3.js} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal-companion.mjs +2 -2
- package/dist/{line-distribute-C_CJisnJ.js → line-distribute-DR9Qwd3u.js} +1 -1
- package/dist/{model-source-DLXFe4_2.js → model-source-DcI3vC00.js} +1 -1
- package/dist/{model-source-session-B3WVQCM5.js → model-source-session-BCteVilS.js} +2 -2
- package/dist/{model-source-session-BVZBHZ04.js → model-source-session-BlQWNyj2.js} +2 -2
- package/dist/{model-source-session-DfUgVpr1.js → model-source-session-D0LF49Ve.js} +2 -2
- package/dist/node.mjs +4 -4
- package/dist/{pptx-CLyebeF_.js → pptx-CfCiVlNB.js} +15 -15
- package/dist/{pptx-BD0jwWs6.js → pptx-SmjDGyub.js} +8 -8
- package/dist/{pptx-model-source-D_2mnSxI.js → pptx-model-source-B2Irk68a.js} +5 -5
- package/dist/pptx.mjs +4 -4
- package/dist/{presentation-model-source-rWZ3Y-S_.js → presentation-model-source-DL6duh5l.js} +5 -5
- package/dist/{render-Cs1bgbEm.js → render-CMUEAeHp.js} +2 -2
- package/dist/{render-worker-host-BR7n4xKy.js → render-worker-host-CtlBbau5.js} +1 -1
- package/dist/{render-worker-host-BxsA-yJo.js → render-worker-host-D_0g-TQ2.js} +1 -1
- package/dist/{render-worker-host-CZC0WOn8.js → render-worker-host-DjBotZNL.js} +1 -1
- package/dist/{renderer-DFDF48zw.js → renderer-IFuBkPvF.js} +848 -773
- package/dist/{resource-measurement-CTGrNAsD.js → resource-measurement-D2bu0Qfx.js} +1 -1
- package/dist/{session-B5CgMc2N.js → session-KIWcCCP2.js} +4 -4
- package/dist/{slide-pull-client-43mS9T70.js → slide-pull-client-BUuJQQVE.js} +48 -48
- package/dist/{wasm-runtime-generation-BsWKRY7U.js → wasm-runtime-generation-BLweKv8r.js} +1 -1
- package/dist/{workbook-model-source-CZtKSWad.js → workbook-model-source-DBfVsWj7.js} +6 -6
- package/dist/{worksheet-pull-client-D5zAevQv.js → worksheet-pull-client-Du0MuIro.js} +2 -2
- package/dist/{xlsx-lvftmF1U.js → xlsx-CCMRAxPB.js} +431 -426
- package/dist/{xlsx-S6orTmKI.js → xlsx-CD1VeDIg.js} +4 -4
- package/dist/{xlsx-model-source-Cm9ocDgT.js → xlsx-model-source-udh7Q4WB.js} +6 -6
- package/dist/xlsx.mjs +4 -4
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/assets/render-worker-BUa1gyCE.js +0 -15
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { t as e } from "./chunk-D5OxutzX.js";
|
|
2
2
|
import { Aa as t, Er as n, Tr as r, Yn as i, a, c as o, d as s, h as c, ja as l, ka as u, m as d, o as f, r as p, u as m, vo as h, wr as g, yo as _ } from "./plot-area-frame-D3JtHvov.js";
|
|
3
3
|
import { n as v, t as y } from "./cfb-guard-BIaHdonq.js";
|
|
4
|
-
import { Dn as b, M as x, N as S, On as C, P as w, V as T, X as E, Xt as D, Y as O, Yt as k, _t as A,
|
|
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 Yt = "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{}}};", Xt = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Yt], { type: "text/javascript;charset=utf-8" });
|
|
15
|
-
function
|
|
4
|
+
import { Dn as b, M as x, N as S, On as C, P as w, V as T, X as E, Xt as D, Y as O, Yt as k, _t as A, ft as ee, gt as te, hn as j, j as M, lt as N, nt as P, ot as ne, qt as F, rt as re, st as I, t as ie, tt as ae, u as L, vt as oe, yt as se } from "./bounded-raw-part-cache-B8t03tSP.js";
|
|
5
|
+
import { f as R, u as ce } from "./pixel-budget-DI82Hn3R.js";
|
|
6
|
+
import { L as le, R as ue, V as de, n as fe, t as pe } from "./renderer-xdugdcMd.js";
|
|
7
|
+
import { i as me, t as he } from "./tiff-contract-DEd8CGuz.js";
|
|
8
|
+
import { C as ge, D as _e, E as ve, S as ye, T as be, _ as xe, a as Se, b as Ce, d as we, f as Te, g as Ee, h as De, m as Oe, o as ke, p as Ae, t as je, u as Me, w as Ne, x as Pe, y as Fe } from "./canvas-viewer-mechanics-DI38gHNV.js";
|
|
9
|
+
import { A as Ie, B as Le, C as Re, D as ze, E as Be, F as Ve, H as He, I as Ue, L as We, M as z, N as Ge, O as Ke, P as qe, R as Je, S as Ye, T as Xe, V as B, _ as Ze, b as V, c as Qe, d as $e, f as et, g as tt, h as nt, i as rt, j as it, k as at, l as ot, m as st, n as ct, o as lt, p as ut, r as dt, s as H, t as ft, u as pt, v as mt, w as ht, x as gt, y as _t, z as vt } from "./renderer-IFuBkPvF.js";
|
|
10
|
+
import { n as yt } from "./renderer-module-contract-BuTx2FWJ.js";
|
|
11
|
+
import { _ as bt, a as xt, b as U, c as St, d as Ct, f as wt, g as Tt, h as Et, l as Dt, m as Ot, n as kt, o as At, p as jt, s as Mt, t as Nt, u as Pt, v as Ft, y as It } from "./worksheet-pull-client-Du0MuIro.js";
|
|
12
|
+
import { n as Lt, r as Rt, t as zt } from "./visible-index-vN-4BNn7.js";
|
|
13
|
+
import { a as Bt, c as Vt, d as Ht, f as Ut, l as W, n as G, o as Wt, p as Gt, r as K, t as q, u as Kt } from "./grid-geometry-CqTDvpDr.js";
|
|
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 Yt(e) {
|
|
16
16
|
let t;
|
|
17
17
|
try {
|
|
18
|
-
if (t =
|
|
18
|
+
if (t = Jt && (self.URL || self.webkitURL).createObjectURL(Jt), !t) throw "";
|
|
19
19
|
let n = new Worker(t, {
|
|
20
20
|
type: "module",
|
|
21
21
|
name: e?.name
|
|
@@ -24,27 +24,27 @@ function Zt(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(qt), {
|
|
28
28
|
type: "module",
|
|
29
29
|
name: e?.name
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
var
|
|
34
|
-
function
|
|
33
|
+
var Xt = new URL("xlsx_parser_bg.wasm", import.meta.url).href;
|
|
34
|
+
function Zt(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 Qt = Symbol("xlsx-render-commit-guard");
|
|
38
|
+
function $t(e, t) {
|
|
39
39
|
return {
|
|
40
40
|
...e,
|
|
41
|
-
[
|
|
41
|
+
[Qt]: t
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function en(e, t) {
|
|
45
45
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function tn(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,27 +54,27 @@ function nn(e, t) {
|
|
|
54
54
|
b: a?.b ?? 0
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function nn(e, t) {
|
|
58
58
|
return e ? t ? e === t ? e : void 0 : e : t;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function rn(e, t) {
|
|
61
61
|
return {
|
|
62
62
|
...e,
|
|
63
|
-
svgImagePath:
|
|
64
|
-
widthPt:
|
|
65
|
-
heightPt:
|
|
66
|
-
srcRect:
|
|
63
|
+
svgImagePath: nn(e.svgImagePath, t.svgImagePath),
|
|
64
|
+
widthPt: en(e.widthPt, t.widthPt),
|
|
65
|
+
heightPt: en(e.heightPt, t.heightPt),
|
|
66
|
+
srcRect: tn(e.srcRect, t.srcRect),
|
|
67
67
|
failClosedOnDuotoneFailure: e.failClosedOnDuotoneFailure || t.failClosedOnDuotoneFailure || void 0,
|
|
68
|
-
targetWidthPx:
|
|
69
|
-
targetHeightPx:
|
|
68
|
+
targetWidthPx: en(e.targetWidthPx, t.targetWidthPx),
|
|
69
|
+
targetHeightPx: en(e.targetHeightPx, t.targetHeightPx)
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function an(e, t, n) {
|
|
73
73
|
let r = e.get(t);
|
|
74
|
-
e.set(t, r ?
|
|
74
|
+
e.set(t, r ? rn(r, n) : n);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let { col: i, row: a } = (n ??
|
|
76
|
+
function on(e, t, n, r) {
|
|
77
|
+
let { col: i, row: a } = (n ?? H(t)).axesAtScale(r), o = Ie(t, e, i, a, r);
|
|
78
78
|
return o.width > 0 && o.height > 0 ? {
|
|
79
79
|
width: o.width,
|
|
80
80
|
height: o.height
|
|
@@ -86,7 +86,7 @@ var sn = {
|
|
|
86
86
|
};
|
|
87
87
|
function cn(e, t, n, r, i) {
|
|
88
88
|
if (!e?.length) return sn;
|
|
89
|
-
let a =
|
|
89
|
+
let a = re(e, t, n);
|
|
90
90
|
return a === null ? null : a.x === 0 && a.y === 0 ? sn : r > 0 && i > 0 ? {
|
|
91
91
|
x: a.x / r,
|
|
92
92
|
y: a.y / i
|
|
@@ -99,10 +99,10 @@ function ln(e, t) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
function un(e, t, n, r, i, a = sn) {
|
|
102
|
-
if (!n || a === null) return e.anchorTag === void 0 ||
|
|
103
|
-
let o = r ??
|
|
102
|
+
if (!n || a === null) return e.anchorTag === void 0 || on(e, t, r, i?.scale ?? 1) !== null;
|
|
103
|
+
let o = r ?? H(t), s = i?.scale ?? 1, { col: c, row: l } = o.axesAtScale(s), u = Ie(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 = Re({
|
|
106
106
|
x: u.x - d,
|
|
107
107
|
y: u.y - f,
|
|
108
108
|
width: u.width + 2 * d,
|
|
@@ -136,36 +136,36 @@ async function dn(e, t, r, i, a = 0, o = 0, s = null, c = null, l, u = !1, d, f,
|
|
|
136
136
|
offscreenFactory: l,
|
|
137
137
|
failClosedOnDuotoneFailure: u,
|
|
138
138
|
tiff: d,
|
|
139
|
-
svgDecoder: p ?? (typeof Image < "u" ?
|
|
139
|
+
svgDecoder: p ?? (typeof Image < "u" ? A : 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 && P(b)) try {
|
|
147
|
+
return await I(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 _ || R(t)) throw t;
|
|
154
|
+
return h ? I(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 ? I(e, i, {
|
|
161
161
|
...f,
|
|
162
162
|
maxRetainedPixels: m,
|
|
163
163
|
workerDecoder: p
|
|
164
164
|
}) : y();
|
|
165
165
|
}
|
|
166
166
|
async function fn(e, n, i, g) {
|
|
167
|
-
if (n.clear(),
|
|
168
|
-
let v = i, y = /* @__PURE__ */ new Map(), b = g?.viewport ?
|
|
167
|
+
if (n.clear(), ht(n), !i) return;
|
|
168
|
+
let v = i, y = /* @__PURE__ */ new Map(), b = g?.viewport ? H(e) : void 0, x = g?.viewport && g.width !== void 0 && g.height !== void 0 ? {
|
|
169
169
|
width: g.width,
|
|
170
170
|
height: g.height,
|
|
171
171
|
scale: g.cellScale ?? 1,
|
|
@@ -173,9 +173,9 @@ async function fn(e, n, i, g) {
|
|
|
173
173
|
freezeCols: g.freezeCols ?? e.freezeCols ?? 0
|
|
174
174
|
} : void 0;
|
|
175
175
|
if (e.images) for (let n of e.images) {
|
|
176
|
-
if (!un(n, e, g?.viewport, b, x, ((e) => cn(n.blipEffects, e.cx, e.cy, e.cx, e.cy))(
|
|
177
|
-
let i =
|
|
178
|
-
|
|
176
|
+
if (!un(n, e, g?.viewport, b, x, ((e) => cn(n.blipEffects, e.cx, e.cy, e.cx, e.cy))(pt(n)))) continue;
|
|
177
|
+
let i = on(n, e, b, g?.cellScale ?? 1), a = pt(n), o = et(n, a), s = n.blipEffects?.length ? rt(a) : null;
|
|
178
|
+
an(y, $e(n.imagePath, o, a), {
|
|
179
179
|
imagePath: n.imagePath,
|
|
180
180
|
mimeType: n.mimeType,
|
|
181
181
|
svgImagePath: n.svgImagePath,
|
|
@@ -195,8 +195,8 @@ async function fn(e, n, i, g) {
|
|
|
195
195
|
if (e.shapeGroups) {
|
|
196
196
|
for (let n of e.shapeGroups) if (un(n, e, g?.viewport, b, x, n.shapes.reduce((e, t) => t.geom?.type === "image" ? ln(e, cn(t.geom.blipEffects, n.nativeExtCx * t.w, n.nativeExtCy * t.h, n.nativeExtCx, n.nativeExtCy)) : e, sn))) {
|
|
197
197
|
for (let i of n.shapes) if (i.geom.type === "image") {
|
|
198
|
-
let a =
|
|
199
|
-
|
|
198
|
+
let a = on(n, e, b, g?.cellScale ?? 1), o = Qe(n, i), s = et(i.geom, o), c = i.geom.blipEffects?.length ? rt(o) : null;
|
|
199
|
+
an(y, $e(i.geom.imagePath, s, o), {
|
|
200
200
|
imagePath: i.geom.imagePath,
|
|
201
201
|
mimeType: i.geom.mimeType,
|
|
202
202
|
svgImagePath: i.geom.svgImagePath,
|
|
@@ -215,10 +215,10 @@ async function fn(e, n, i, g) {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
let S = e.charts ?? [], C = S.length > 0 ? b ??
|
|
218
|
+
let S = e.charts ?? [], C = S.length > 0 ? b ?? H(e) : b, w = [];
|
|
219
219
|
for (let n of S) {
|
|
220
220
|
if (!un(n, e, g?.viewport, C, x)) continue;
|
|
221
|
-
let r =
|
|
221
|
+
let r = on(n, e, C, g?.cellScale ?? 1);
|
|
222
222
|
if (!r || !Number.isFinite(r.width) || !Number.isFinite(r.height) || r.width <= 0 || r.height <= 0) continue;
|
|
223
223
|
let i = d(n.chart), a = {
|
|
224
224
|
widthPt: r.width * (t / u),
|
|
@@ -260,7 +260,7 @@ async function fn(e, n, i, g) {
|
|
|
260
260
|
}
|
|
261
261
|
let D = new Set(T.map(({ fill: e }) => a(e))), O = (e) => {
|
|
262
262
|
let t = [], n = g?.cellScale ?? 1;
|
|
263
|
-
for (let r of w) for (let { fill: i, occurrence: o } of
|
|
263
|
+
for (let r of w) for (let { fill: i, occurrence: o } of fe(r.chart.chart, {
|
|
264
264
|
x: 0,
|
|
265
265
|
y: 0,
|
|
266
266
|
w: r.displayWidth / n,
|
|
@@ -277,7 +277,7 @@ async function fn(e, n, i, g) {
|
|
|
277
277
|
renderedSize: o
|
|
278
278
|
}), t.push(e));
|
|
279
279
|
}
|
|
280
|
-
return
|
|
280
|
+
return pe(E.size), t;
|
|
281
281
|
};
|
|
282
282
|
O();
|
|
283
283
|
for (let e of w) for (let { usage: t, size: n } of e.usages) {
|
|
@@ -298,7 +298,7 @@ async function fn(e, n, i, g) {
|
|
|
298
298
|
}
|
|
299
299
|
let k = (e, t) => {
|
|
300
300
|
let { fill: n, widthPt: r, heightPt: i, targetWidthPx: a, targetHeightPx: s, hasSourceCrop: c, renderedSize: l } = t;
|
|
301
|
-
|
|
301
|
+
an(y, e, {
|
|
302
302
|
imagePath: n.imagePath,
|
|
303
303
|
mimeType: n.mimeType,
|
|
304
304
|
svgImagePath: n.svgImagePath,
|
|
@@ -320,22 +320,22 @@ async function fn(e, n, i, g) {
|
|
|
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 = oe(g?.imageResources), te = se((await Promise.all([...y].map(async ([e, t]) => {
|
|
324
|
+
if (!t.targetWidthPx || !t.targetHeightPx || t.mimeType === "image/svg+xml" || t.duotone || !t.duotone && P({
|
|
325
325
|
svgImagePath: t.svgImagePath,
|
|
326
326
|
srcRect: t.srcRect
|
|
327
327
|
})) return null;
|
|
328
|
-
if (
|
|
328
|
+
if (le(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 ee(t.imagePath, t.mimeType, v).catch((e) => {
|
|
335
|
+
if (e instanceof _ || R(e)) throw e;
|
|
336
336
|
return null;
|
|
337
337
|
});
|
|
338
|
-
return !n?.dimensions || !
|
|
338
|
+
return !n?.dimensions || !ue(n.format, g?.tiff !== void 0) ? null : {
|
|
339
339
|
key: e,
|
|
340
340
|
targetWidthPx: t.targetWidthPx,
|
|
341
341
|
targetHeightPx: t.targetHeightPx,
|
|
@@ -345,14 +345,14 @@ 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 && P({
|
|
349
349
|
svgImagePath: t.svgImagePath,
|
|
350
350
|
srcRect: t.srcRect
|
|
351
351
|
})) continue;
|
|
352
|
-
let n =
|
|
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 j = async ([e, t]) => {
|
|
356
356
|
try {
|
|
357
357
|
let r = await dn(t.imagePath, t.mimeType, t.svgImagePath, v, t.widthPt, t.heightPt, t.srcRect, t.duotone, g?.offscreenFactory, t.failClosedOnDuotoneFailure ?? !1, g?.tiff, t.targetWidthPx && t.targetHeightPx ? {
|
|
358
358
|
targetWidthPx: t.targetWidthPx,
|
|
@@ -360,46 +360,46 @@ async function fn(e, n, i, g) {
|
|
|
360
360
|
} : void 0, g?.svgDecoder, t.plannedPixelLimit);
|
|
361
361
|
n.set(e, r);
|
|
362
362
|
} catch (t) {
|
|
363
|
-
if (
|
|
364
|
-
n.set(e, null),
|
|
363
|
+
if (de(t, "tiff") || me(t)) {
|
|
364
|
+
n.set(e, null), Xe(n, e, "tiff");
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
|
-
if (t instanceof _ ||
|
|
367
|
+
if (t instanceof _ || R(t) || t instanceof h && t.code === "unsupported-image-effect") throw t;
|
|
368
368
|
n.delete(e);
|
|
369
369
|
}
|
|
370
370
|
};
|
|
371
|
-
for (await Promise.all([...y.entries()].map(
|
|
371
|
+
for (await Promise.all([...y.entries()].map(j));;) {
|
|
372
372
|
let e = O(m(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) => j([e, y.get(e)])));
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
var pn = /* @__PURE__ */ new WeakMap();
|
|
379
379
|
function mn(e, t, n, r) {
|
|
380
|
-
if (
|
|
381
|
-
let i =
|
|
382
|
-
if (a && a.sourceGeometry === i &&
|
|
380
|
+
if (ot(t)) return t;
|
|
381
|
+
let i = H(t), a = pn.get(t);
|
|
382
|
+
if (a && a.sourceGeometry === i && bt(a.projection) === bt(t)) return a.projection;
|
|
383
383
|
let o = {
|
|
384
384
|
...t,
|
|
385
385
|
rowHeights: { ...t.rowHeights }
|
|
386
386
|
};
|
|
387
|
-
|
|
387
|
+
Wt(t, o), ut(t, o);
|
|
388
388
|
let s = i.maximumDigitWidth;
|
|
389
|
-
return
|
|
389
|
+
return q.forWorksheet(o, s), ft(e, o, n, r), q.forWorksheet(o, s), pn.set(t, {
|
|
390
390
|
projection: o,
|
|
391
391
|
sourceGeometry: i
|
|
392
392
|
}), o;
|
|
393
393
|
}
|
|
394
394
|
async function hn(e, t, n, r = {}, i) {
|
|
395
395
|
let a = () => gn(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) || c((e.ws.charts ?? []).map((e) => e.chart)).length > 0);
|
|
396
|
-
return r.fetchImage && o ?
|
|
396
|
+
return r.fetchImage && o ? te(r.fetchImage, r.imageResources, a) : a();
|
|
397
397
|
}
|
|
398
398
|
async function gn(e, t, n, r = {}, a) {
|
|
399
|
-
if (r[
|
|
399
|
+
if (r[Qt]?.() === !1) return;
|
|
400
400
|
let o = e.styles, s = t.getContext("2d");
|
|
401
401
|
if (!s) throw Error("XLSX render target does not provide a 2-D canvas context");
|
|
402
|
-
|
|
402
|
+
ct(s, e.ws, r.officeFontRoutes, r.googleSubstitutes === !0), tt(e.ws, r.authoritativeMdw);
|
|
403
403
|
let c = e.ws.isDialogSheet ? e.ws : mn(s, e.ws, o, e.cjkFallback), l = E(t) ? t.clientWidth || 800 : t.width, u = E(t) ? t.clientHeight || 600 : t.height, d = r.width ?? l, f = r.height ?? u, p = r.dpr ?? O(), m = i(d * p, f * p), h = m.clamped ? p * m.scale : p, g = /* @__PURE__ */ new Map();
|
|
404
404
|
if (c.isDialogSheet || await fn(c, g, r.fetchImage, {
|
|
405
405
|
viewport: n,
|
|
@@ -415,7 +415,7 @@ async function gn(e, t, n, r = {}, a) {
|
|
|
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 && gt(c) && await Ze(c, e.math), r[Qt]?.() === !1) return;
|
|
419
419
|
let _ = m.width, v = m.height;
|
|
420
420
|
if (t.width !== _ && (t.width = _), t.height !== v && (t.height = v), E(t)) {
|
|
421
421
|
let e = `${d}px`, n = `${f}px`;
|
|
@@ -430,7 +430,7 @@ async function gn(e, t, n, r = {}, a) {
|
|
|
430
430
|
_n(y, d, f);
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
mt(y, c, o, n, {
|
|
434
434
|
...r,
|
|
435
435
|
dpr: h,
|
|
436
436
|
loadedImages: g,
|
|
@@ -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 = z(a ?? "");
|
|
481
481
|
if (s) {
|
|
482
|
-
let e = o ?
|
|
482
|
+
let e = o ? z(o) : s;
|
|
483
483
|
if (e) {
|
|
484
484
|
let t = {
|
|
485
485
|
row: Math.min(s.row, e.row),
|
|
@@ -540,15 +540,15 @@ function Sn(e, t) {
|
|
|
540
540
|
function Cn(e, t) {
|
|
541
541
|
if (!t) return;
|
|
542
542
|
let n = !1;
|
|
543
|
-
if (t.rowHeightRanges && (
|
|
544
|
-
n &&
|
|
543
|
+
if (t.rowHeightRanges && (Kt(e, t.rowHeightRanges), n = !0), t.rows && (n = Sn(e.rowHeights, t.rows) || n), t.cols && (n = Sn(e.colWidths, t.cols) || n), t.columnCssWidths) for (let [r, i] of Object.entries(t.columnCssWidths)) W(e, Number(r), i) && (n = !0);
|
|
544
|
+
n && q.invalidate(e);
|
|
545
545
|
}
|
|
546
546
|
function wn(e, t) {
|
|
547
547
|
return t ? Tn(e, t) : e;
|
|
548
548
|
}
|
|
549
549
|
function Tn(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 }), B(e, n), Ft(e, n), Wt(e, n), Cn(n, t), n;
|
|
552
552
|
}
|
|
553
553
|
var En = Symbol("xlsx-viewer-render-context");
|
|
554
554
|
function Dn(e, t, n) {
|
|
@@ -571,9 +571,9 @@ function On(e) {
|
|
|
571
571
|
projection: t.projection
|
|
572
572
|
} : { opts: n };
|
|
573
573
|
}
|
|
574
|
-
var kn = "load-delimited-text", J =
|
|
574
|
+
var kn = "load-delimited-text", J = At;
|
|
575
575
|
function An(e) {
|
|
576
|
-
if (e > J) throw
|
|
576
|
+
if (e > J) throw Et(kn, void 0, "delimited-text-source", "bytes", J, e);
|
|
577
577
|
}
|
|
578
578
|
Object.freeze({
|
|
579
579
|
fonts: [Object.freeze({
|
|
@@ -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(K, r),
|
|
727
|
+
maxCol: Math.min(G, i)
|
|
728
728
|
};
|
|
729
729
|
}
|
|
730
730
|
var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-row-heights"), Vn = Symbol("release-xlsx-viewer-projection"), Hn = Symbol("load-xlsx-sheet-source"), Un = class e {
|
|
731
731
|
metrics = null;
|
|
732
732
|
bridge = null;
|
|
733
733
|
delimitedTextBacked = !1;
|
|
734
|
-
japaneseCellFonts =
|
|
734
|
+
japaneseCellFonts = He();
|
|
735
735
|
parsedWorkbook = null;
|
|
736
736
|
sheetCache = /* @__PURE__ */ new Map();
|
|
737
737
|
sheetCacheUsage = /* @__PURE__ */ new Map();
|
|
@@ -741,11 +741,11 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
741
741
|
sheetPreviews = /* @__PURE__ */ new Map();
|
|
742
742
|
rawParts = new ie({
|
|
743
743
|
maxEntries: 64,
|
|
744
|
-
maxBytes:
|
|
744
|
+
maxBytes: j
|
|
745
745
|
});
|
|
746
746
|
queuedImageLoads = /* @__PURE__ */ new Map();
|
|
747
747
|
_fetchImage = (e, t) => this.getImageWithinArchiveOperation(e, t);
|
|
748
|
-
worksheetPolicy =
|
|
748
|
+
worksheetPolicy = It;
|
|
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 ve(e, {
|
|
774
774
|
correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
|
|
775
775
|
toError: (e) => "type" in e && e.type === "error" ? T(e) : void 0,
|
|
776
776
|
onUnsolicited: (t) => {
|
|
777
|
-
|
|
777
|
+
Ne((t, n) => e.postMessage(t, n), t);
|
|
778
778
|
}
|
|
779
779
|
}), r)) {
|
|
780
|
-
let e = new URL(n ??
|
|
780
|
+
let e = new URL(n ?? Xt, location.href).href;
|
|
781
781
|
this.bridge.post({
|
|
782
782
|
type: "init",
|
|
783
783
|
wasmUrl: e
|
|
@@ -793,7 +793,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
793
793
|
throw TypeError("Unsupported XlsxSheetViewer source format");
|
|
794
794
|
}
|
|
795
795
|
static async loadDelimitedText(t, n, r) {
|
|
796
|
-
let i =
|
|
796
|
+
let i = U(n);
|
|
797
797
|
n = {
|
|
798
798
|
...n,
|
|
799
799
|
xlsxWorksheetLimits: i.worksheet
|
|
@@ -801,7 +801,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
801
801
|
...n,
|
|
802
802
|
cjkFallback: F(n.cjkFallback)
|
|
803
803
|
};
|
|
804
|
-
let a = jn(r), o = S(n), s = n.mode ?? "main", c = new
|
|
804
|
+
let a = jn(r), o = S(n), s = n.mode ?? "main", c = new M({
|
|
805
805
|
enabled: !0,
|
|
806
806
|
format: "xlsx",
|
|
807
807
|
mode: s,
|
|
@@ -819,29 +819,29 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
819
819
|
i = await Mn(e);
|
|
820
820
|
} else i = t;
|
|
821
821
|
An(i.byteLength), c.setSourceBytes(i.byteLength), c.checkpoint("source ready");
|
|
822
|
-
let o = s === "worker" ? (await import("./render-worker-host-
|
|
822
|
+
let o = s === "worker" ? (await import("./render-worker-host-D_0g-TQ2.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 be(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 = U(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-DBfVsWj7.js")).loadXlsxModelSource(t, n, e);
|
|
840
840
|
n = {
|
|
841
841
|
...n,
|
|
842
842
|
cjkFallback: F(n.cjkFallback)
|
|
843
843
|
};
|
|
844
|
-
let i = S(n), a = n.mode ?? "main", o = new
|
|
844
|
+
let i = S(n), a = n.mode ?? "main", o = new M({
|
|
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-D_0g-TQ2.js")).createRenderWorker() : new Yt(), 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 be(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
875
|
async _load(e, t = {}, n = w(t), r, i = !1) {
|
|
876
|
-
let a =
|
|
876
|
+
let a = U(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
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 = F(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" ?
|
|
883
|
+
let s = this._mode === "worker" ? yt(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 = Ve(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 = We(u), t.useGoogleFonts && (this.googleFontNames = [...Ue(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 =
|
|
916
|
+
let r = U(t), i = this.requireBridge();
|
|
917
917
|
this.worksheetPolicy = r, this.delimitedTextBacked = !0, this.workerTimeoutMs = t.workerTimeoutMs, this.googleSubstitutes = t.useGoogleFonts === !0, this.cjkFallback = F(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" ?
|
|
918
|
+
let a = this._mode === "worker" ? yt(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
|
+
Tt(s, r), Le(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 = Ot(s, r);
|
|
933
|
+
if (Ct(l, "load-delimited-text", void 0, void 0, r), Pt(l.jsonBytes, "load-delimited-text", void 0, void 0, r), Dt(l, "load-delimited-text", void 0, void 0, r), this.parsedWorkbook = o.workbook, this.cjkFallback = Ve(o.workbook, this.cjkFallback), this.sheetCache.set(0, s), this.sheetCacheUsage.set(0, l), this.retainedSheetUsage = l, this.officeFontRequests = We(o.workbook), t.useGoogleFonts && (this.googleFontNames = [...Ue(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
|
+
dt(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([b(this.googleFontNames,
|
|
944
|
+
let n = Promise.all([b(this.googleFontNames, qe, e), k(this.officeFontRequests, e)]).then(([e, t]) => ({
|
|
945
945
|
google: e,
|
|
946
946
|
office: t
|
|
947
947
|
}));
|
|
@@ -965,7 +965,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
967
|
async retainWorksheetOfficeFonts(e) {
|
|
968
|
-
let t =
|
|
968
|
+
let t = Je(e).filter((e) => !this.officeFontRequests.some((t) => vt(t) === vt(e)));
|
|
969
969
|
t.length !== 0 && (this.officeFontRequests.push(...t), await Promise.all([...this.retainedFontSets].map(async ([e, n]) => {
|
|
970
970
|
let r = await n.loading, i = await k(t, e);
|
|
971
971
|
if (this.fontsDestroyed || this.retainedFontSets.get(e) !== n || n.refs <= 0) D(i.faces);
|
|
@@ -983,7 +983,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
983
983
|
[Bn](e, t) {
|
|
984
984
|
if (!this.parsedWorkbook) return;
|
|
985
985
|
let n = E(t.canvas) ? t.canvas.ownerDocument.fonts : null;
|
|
986
|
-
|
|
986
|
+
ct(t, e, n ? this.retainedFontSets.get(n)?.loaded?.office.routes : void 0, this.googleSubstitutes), H(e), ft(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 Zt(this.parsedWorkbook?.workbook.sheets ?? [], e);
|
|
999
999
|
}
|
|
1000
1000
|
isHidden(e) {
|
|
1001
1001
|
return this.sheetVisibility(e) !== "visible";
|
|
@@ -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 && (
|
|
1116
|
+
if (u.worksheet && (Tt(u.worksheet, r), Le(u.worksheet, this.japaneseCellFonts)), n.preview(u.worksheet, u.reason, u.maxRow, u.maxCol), u.worksheet) {
|
|
1117
1117
|
In(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
|
+
dt(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 = St(o, jt(u.rows, r), r);
|
|
1128
|
+
Ct(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
|
+
Tt(e, r), Le(e, this.japaneseCellFonts), e.rows = e.parseError ? [] : a;
|
|
1133
|
+
let t = wt(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
|
+
Ct(t, "get-worksheet", void 0, u.usage, r), Pt(t.jsonBytes, "get-worksheet", void 0, u.usage, r);
|
|
1139
|
+
let i = this.retainedSheetUsage, d = Mt(i, t, {}, r), f = [];
|
|
1140
1140
|
for (let [e] of this.sheetCache) {
|
|
1141
1141
|
try {
|
|
1142
|
-
|
|
1142
|
+
Dt(d, "get-worksheet", void 0, u.usage, r);
|
|
1143
1143
|
break;
|
|
1144
1144
|
} catch (e) {
|
|
1145
1145
|
if (!(e instanceof _)) 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 = Mt(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 = Mt(i, t, {}, r), f.push(e));
|
|
1155
1155
|
}
|
|
1156
|
-
|
|
1156
|
+
Dt(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 dt(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 Nt({
|
|
1199
1199
|
generation: this.generation || 1,
|
|
1200
|
-
transport: this.requireBridge().transport(
|
|
1200
|
+
transport: this.requireBridge().transport(kt),
|
|
1201
1201
|
sharedStrings: this.parsedWorkbook.sharedStrings,
|
|
1202
1202
|
timeoutMs: this.workerTimeoutMs,
|
|
1203
1203
|
open: async (e, t, n, r) => {
|
|
@@ -1269,14 +1269,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1269
1269
|
for (let t of e.rows) for (let e of t.cells) r.set(`${e.row}:${e.col}`, e);
|
|
1270
1270
|
return bn(n, (n, i) => {
|
|
1271
1271
|
let a = r.get(`${n}:${i}`);
|
|
1272
|
-
return a ?
|
|
1272
|
+
return a ? Ge(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 ? Ge(t, this.parsedWorkbook.styles, null, e.date1904) : "";
|
|
1280
1280
|
}
|
|
1281
1281
|
async renderViewport(e, t, n, r = {}) {
|
|
1282
1282
|
if (this.assertResourceHealthy(), n = {
|
|
@@ -1310,7 +1310,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1310
1310
|
}
|
|
1311
1311
|
return this.withWorksheetArchiveOperation(t, (t) => {
|
|
1312
1312
|
let r = a.worksheet ?? wn(t, o);
|
|
1313
|
-
return r !== t &&
|
|
1313
|
+
return r !== t && ut(t, r), hn({
|
|
1314
1314
|
ws: r,
|
|
1315
1315
|
styles: i,
|
|
1316
1316
|
cjkFallback: this.cjkFallback,
|
|
@@ -1409,7 +1409,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1409
1409
|
for (let e of this.sheetPreviews?.values() ?? []) e.fail(/* @__PURE__ */ Error("XLSX workbook has been destroyed"));
|
|
1410
1410
|
this.sheetPreviews?.clear(), this.fontsDestroyed = !0;
|
|
1411
1411
|
for (let e of this.retainedFontSets.values()) e.loaded && (C(e.loaded.google), D(e.loaded.office.faces));
|
|
1412
|
-
this.retainedFontSets.clear(), this.googleFontNames = [], this.googleSubstitutes = !1, this.officeFontRequests = [],
|
|
1412
|
+
this.retainedFontSets.clear(), this.googleFontNames = [], this.googleSubstitutes = !1, this.officeFontRequests = [], N(this._fetchImage), ne(this._fetchImage), this.rawParts.clear(), this.queuedImageLoads?.clear();
|
|
1413
1413
|
}
|
|
1414
1414
|
assertResourceHealthy() {
|
|
1415
1415
|
if (this.resourceFailure) throw this.resourceFailure;
|
|
@@ -1461,11 +1461,11 @@ function Zn(e, t, n) {
|
|
|
1461
1461
|
return t < 1 ? null : Yn(e, 1, t, n) ? "drawing-dependency" : null;
|
|
1462
1462
|
}
|
|
1463
1463
|
function Qn(e, t) {
|
|
1464
|
-
let n =
|
|
1464
|
+
let n = Ie(t.worksheet, e, t.colAxis, t.rowAxis, t.scale), { width: r, height: i } = n;
|
|
1465
1465
|
if (r <= 0 || i <= 0) return null;
|
|
1466
1466
|
let a = t.colAxis.offsetOf(t.startCol), o = t.rowAxis.offsetOf(t.startRow);
|
|
1467
1467
|
return {
|
|
1468
|
-
x:
|
|
1468
|
+
x: V(t.scrollAreaX + (n.x - a) - t.scrollOffsetX, r, t.canvasWidth, t.rtl),
|
|
1469
1469
|
y: t.scrollAreaY + (n.y - o) - t.scrollOffsetY,
|
|
1470
1470
|
width: r,
|
|
1471
1471
|
height: i
|
|
@@ -1475,15 +1475,15 @@ function $n(e, t) {
|
|
|
1475
1475
|
return e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1476
1476
|
}
|
|
1477
1477
|
function er(e, t) {
|
|
1478
|
-
let n =
|
|
1478
|
+
let n = V(t.scrollAreaX, t.scrollAreaW, t.canvasWidth, t.rtl);
|
|
1479
1479
|
return e.x + e.width >= n && e.x <= n + t.scrollAreaW && e.y + e.height >= t.scrollAreaY && e.y <= t.scrollAreaY + t.scrollAreaH;
|
|
1480
1480
|
}
|
|
1481
1481
|
function tr(e, t) {
|
|
1482
|
-
let n =
|
|
1482
|
+
let n = V(t.scrollAreaX, t.scrollAreaW, t.canvasWidth, t.rtl);
|
|
1483
1483
|
return e.x >= n && e.x <= n + t.scrollAreaW && e.y >= t.scrollAreaY && e.y <= t.scrollAreaY + t.scrollAreaH;
|
|
1484
1484
|
}
|
|
1485
1485
|
function nr(e, t) {
|
|
1486
|
-
let n =
|
|
1486
|
+
let n = H(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
1487
|
return {
|
|
1488
1488
|
worksheet: e,
|
|
1489
1489
|
colAxis: i,
|
|
@@ -1515,7 +1515,7 @@ function rr(e, t, n) {
|
|
|
1515
1515
|
height: r.h * o.height
|
|
1516
1516
|
}, a = r.rot);
|
|
1517
1517
|
}
|
|
1518
|
-
let s =
|
|
1518
|
+
let s = V(r.scrollAreaX, r.scrollAreaW, r.canvasWidth, r.rtl);
|
|
1519
1519
|
return {
|
|
1520
1520
|
rect: o,
|
|
1521
1521
|
clip: {
|
|
@@ -1558,7 +1558,7 @@ function ar(e, t) {
|
|
|
1558
1558
|
n.push("\n"), r++;
|
|
1559
1559
|
}
|
|
1560
1560
|
for (let e of o.runs) {
|
|
1561
|
-
let a = e.type === "text" ? e.text : e.type === "break" ? "\n" : "[equation]", o =
|
|
1561
|
+
let a = e.type === "text" ? e.text : e.type === "break" ? "\n" : "[equation]", o = Ae(a, Math.max(0, t - r));
|
|
1562
1562
|
if (n.push(o), r += o.length, o.length < a.length) {
|
|
1563
1563
|
i = !0;
|
|
1564
1564
|
break;
|
|
@@ -1592,7 +1592,7 @@ function sr(e, t, n, r, i) {
|
|
|
1592
1592
|
for (let a = e.charts.length - 1; a >= 0; a--) {
|
|
1593
1593
|
let o = e.charts[a], s = Qn(o, r);
|
|
1594
1594
|
if (!s || !er(s, r) || !$n(n, s)) continue;
|
|
1595
|
-
let c =
|
|
1595
|
+
let c = Te(o.chart, i);
|
|
1596
1596
|
return {
|
|
1597
1597
|
...or(e, t, "chart", a, o, c.text, c.truncated, c.maxTextCharacters),
|
|
1598
1598
|
seriesCount: o.chart.series.length
|
|
@@ -1638,23 +1638,23 @@ function lr(e, t, n, r, i) {
|
|
|
1638
1638
|
function ur(e, t, n, r, i) {
|
|
1639
1639
|
for (let a = e.images.length - 1; a >= 0; a--) {
|
|
1640
1640
|
let o = e.images[a], s = Qn(o, r);
|
|
1641
|
-
if (s && er(
|
|
1641
|
+
if (s && er(Re(s, o.rotation), r) && $n(Ye(n, s, o.rotation, o.flipH, o.flipV), s)) return {
|
|
1642
1642
|
...or(e, t, "image", a, o, void 0, !1, i),
|
|
1643
1643
|
mimeType: o.svgImagePath ? "image/svg+xml" : o.mimeType
|
|
1644
1644
|
};
|
|
1645
1645
|
}
|
|
1646
1646
|
return null;
|
|
1647
1647
|
}
|
|
1648
|
-
function dr(e, t, n, r, i =
|
|
1648
|
+
function dr(e, t, n, r, i = we) {
|
|
1649
1649
|
if (!Number.isFinite(n.x) || !Number.isFinite(n.y)) throw RangeError("XLSX hit-test point must contain finite coordinates.");
|
|
1650
1650
|
if (!Number.isFinite(i) || i < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
1651
|
-
let a = Math.min(
|
|
1651
|
+
let a = Math.min(we, Math.floor(i)), o = nr(e, r);
|
|
1652
1652
|
return tr(n, o) ? sr(e, t, n, o, a) ?? lr(e, t, n, o, a) ?? ur(e, t, n, o, a) : null;
|
|
1653
1653
|
}
|
|
1654
1654
|
function fr(e, t) {
|
|
1655
1655
|
let n = t ?? e.maxTextCharacters;
|
|
1656
1656
|
if (!Number.isFinite(n) || n < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
1657
|
-
let r = Math.min(
|
|
1657
|
+
let r = Math.min(we, Math.floor(n)), i = e.text === void 0 ? void 0 : Ae(e.text, r), a = e.truncated || e.text !== void 0 && i.length < e.text.length;
|
|
1658
1658
|
return {
|
|
1659
1659
|
...structuredClone(e),
|
|
1660
1660
|
...i === void 0 ? {} : { text: i },
|
|
@@ -1666,7 +1666,7 @@ function fr(e, t) {
|
|
|
1666
1666
|
}
|
|
1667
1667
|
var pr = 128, mr = 1e4, hr = 8 * 1024 * 1024;
|
|
1668
1668
|
function gr(e) {
|
|
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) *
|
|
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) * G : t.kind === "columns" ? (t.lastColumn - t.firstColumn + 1) * K : K * G), 0);
|
|
1670
1670
|
}
|
|
1671
1671
|
function Y(e, t) {
|
|
1672
1672
|
return Number.isInteger(e) && e >= 1 && e <= t;
|
|
@@ -1785,7 +1785,7 @@ function xr(e) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
let i = t.split(":");
|
|
1787
1787
|
if (i.length > 2) return null;
|
|
1788
|
-
let a =
|
|
1788
|
+
let a = z(i[0]), o = i.length === 2 ? z(i[1]) : a;
|
|
1789
1789
|
if (!a || !o) return null;
|
|
1790
1790
|
let s = {
|
|
1791
1791
|
kind: "cells",
|
|
@@ -1830,7 +1830,7 @@ function Cr(e, t, n) {
|
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
1833
|
-
return
|
|
1833
|
+
return Ht(i), Object.freeze(i.map((e) => Object.freeze(e)));
|
|
1834
1834
|
}
|
|
1835
1835
|
var wr = class {
|
|
1836
1836
|
stashedRowHeights = /* @__PURE__ */ new Map();
|
|
@@ -1857,11 +1857,11 @@ var wr = class {
|
|
|
1857
1857
|
let t = this.stashedRowHeights.get(r);
|
|
1858
1858
|
t === void 0 ? delete e.rowHeights[r] : e.rowHeights[r] = t, this.stashedRowHeights.delete(r);
|
|
1859
1859
|
} 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,
|
|
1860
|
+
else if (i) this.stashedColWidths.has(r) || (this.stashedColWidths.set(r, e.colWidths[r]), this.stashedColCssWidths.set(r, Bt(e, r))), e.colWidths[r] = 0, W(e, r, null);
|
|
1861
1861
|
else if (this.stashedColWidths.has(r)) {
|
|
1862
1862
|
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],
|
|
1863
|
+
t === void 0 ? delete e.colWidths[r] : e.colWidths[r] = t, W(e, r, this.stashedColCssWidths.get(r) ?? null), this.stashedColWidths.delete(r), this.stashedColCssWidths.delete(r);
|
|
1864
|
+
} else e.colWidths[r] === 0 && (delete e.colWidths[r], W(e, r, null));
|
|
1865
1865
|
this.recordSizeOverride(e, t, n, r);
|
|
1866
1866
|
}
|
|
1867
1867
|
recordSizeOverride(e, t, n, r, i) {
|
|
@@ -1877,8 +1877,8 @@ var wr = class {
|
|
|
1877
1877
|
n === "row" && a.automaticRows.delete(r);
|
|
1878
1878
|
let s = n === "row" ? e.rowHeights[r] ?? null : e.colWidths[r] ?? null, c = !1;
|
|
1879
1879
|
if (o.get(r) !== s && (o.set(r, s), c = !0), n === "col") {
|
|
1880
|
-
i !== void 0 &&
|
|
1881
|
-
let t =
|
|
1880
|
+
i !== void 0 && W(e, r, i);
|
|
1881
|
+
let t = Bt(e, r) ?? null;
|
|
1882
1882
|
(a.colCss.has(r) ? a.colCss.get(r) !== t : t !== null) && (a.colCss.set(r, t), c = !0);
|
|
1883
1883
|
}
|
|
1884
1884
|
c && (a.revision++, a.wire = void 0);
|
|
@@ -1889,7 +1889,7 @@ var wr = class {
|
|
|
1889
1889
|
if (o > r) throw RangeError(`A resize projection may retain at most ${r} manually edited bands per axis.`);
|
|
1890
1890
|
}
|
|
1891
1891
|
beginRowResizePreview(e, t, n) {
|
|
1892
|
-
let r =
|
|
1892
|
+
let r = Vt(e), i = !1, a = (n) => {
|
|
1893
1893
|
let r = this.sizeOverrideStore.get(t);
|
|
1894
1894
|
!r && n.length && (r = {
|
|
1895
1895
|
rows: /* @__PURE__ */ new Map(),
|
|
@@ -1897,7 +1897,7 @@ var wr = class {
|
|
|
1897
1897
|
cols: /* @__PURE__ */ new Map(),
|
|
1898
1898
|
colCss: /* @__PURE__ */ new Map(),
|
|
1899
1899
|
revision: 0
|
|
1900
|
-
}, this.sizeOverrideStore.set(t, r)),
|
|
1900
|
+
}, this.sizeOverrideStore.set(t, r)), Kt(e, n), r && (r.rowHeightRanges = n, r.revision++, r.wire = void 0), q.invalidate(e);
|
|
1901
1901
|
};
|
|
1902
1902
|
return {
|
|
1903
1903
|
apply: (e) => {
|
|
@@ -1909,8 +1909,8 @@ var wr = class {
|
|
|
1909
1909
|
};
|
|
1910
1910
|
}
|
|
1911
1911
|
restoreRowResizeRanges(e, t) {
|
|
1912
|
-
let n = this.sizeOverrideStore.get(e)?.rowHeightRanges ?? [], r =
|
|
1913
|
-
(n.length || r.length) && n !== r && (
|
|
1912
|
+
let n = this.sizeOverrideStore.get(e)?.rowHeightRanges ?? [], r = Vt(t);
|
|
1913
|
+
(n.length || r.length) && n !== r && (Kt(t, n), q.invalidate(t));
|
|
1914
1914
|
}
|
|
1915
1915
|
wireSizeOverrides(e) {
|
|
1916
1916
|
let t = this.sizeOverrideStore.get(e);
|
|
@@ -1938,7 +1938,7 @@ var wr = class {
|
|
|
1938
1938
|
return this.sizeOverrideStore.get(e)?.revision ?? 0;
|
|
1939
1939
|
}
|
|
1940
1940
|
syncAutomaticRowOverrides(e, t) {
|
|
1941
|
-
let n = new Map(
|
|
1941
|
+
let n = new Map(lt(t)), r = this.sizeOverrideStore.get(e);
|
|
1942
1942
|
!r && n.size === 0 || (r || (r = {
|
|
1943
1943
|
rows: /* @__PURE__ */ new Map(),
|
|
1944
1944
|
automaticRows: /* @__PURE__ */ new Map(),
|
|
@@ -1960,7 +1960,7 @@ var wr = class {
|
|
|
1960
1960
|
if (n) {
|
|
1961
1961
|
for (let [e, r] of n.rows) r === null ? delete t.rowHeights[e] : t.rowHeights[e] = r;
|
|
1962
1962
|
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)
|
|
1963
|
+
for (let [e, r] of n.colCss) W(t, e, r);
|
|
1964
1964
|
}
|
|
1965
1965
|
let r = this.outlineStateStore.get(e);
|
|
1966
1966
|
if (r) {
|
|
@@ -2209,7 +2209,7 @@ var Z = class {
|
|
|
2209
2209
|
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
2210
|
let d = 19 * n;
|
|
2211
2211
|
u.strokeStyle = r.border ?? "#808080", u.lineWidth = 1, u.fillStyle = r.text ?? "#404040";
|
|
2212
|
-
let f =
|
|
2212
|
+
let f = H(t), p = f.effectiveFrozenBands({
|
|
2213
2213
|
scale: n,
|
|
2214
2214
|
width: this.host.canvasArea.clientWidth,
|
|
2215
2215
|
height: this.host.canvasArea.clientHeight,
|
|
@@ -2313,7 +2313,7 @@ var Z = class {
|
|
|
2313
2313
|
destroy() {
|
|
2314
2314
|
this.listeners.dispose(), this.rowOutlineBands = [], this.colOutlineBands = [], this.rowOutline = null, this.colOutline = null;
|
|
2315
2315
|
}
|
|
2316
|
-
}, Rr = 30, zr = 50, Br = 1, Vr = .45, Q = 8, Hr = 320, Ur = " (right-click for sheet list)", Wr = class {
|
|
2316
|
+
}, Rr = 30, zr = 50, Br = 1, Vr = .45, Q = 8, Hr = 320, Ur = " (right-click for sheet list)", Wr = /^#[0-9A-Fa-f]{6}$/, Gr = class {
|
|
2317
2317
|
host;
|
|
2318
2318
|
tabBar;
|
|
2319
2319
|
tabStrip;
|
|
@@ -2345,9 +2345,12 @@ var Z = class {
|
|
|
2345
2345
|
this.tabBar.appendChild(e);
|
|
2346
2346
|
}
|
|
2347
2347
|
build(e, t) {
|
|
2348
|
-
this.cancelPendingOpen(), this.closeSheetList(), this.sheetNames = e, this.tabListeners.dispose(), this.tabListeners = new Z(), this.tabList.innerHTML = "", this.tabs = [], this.tabColors =
|
|
2348
|
+
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
|
+
let r = t[n];
|
|
2350
|
+
return r && Wr.test(r) ? r : null;
|
|
2351
|
+
}), e.forEach((e, t) => {
|
|
2349
2352
|
let n = this.ownerDocument.createElement("button");
|
|
2350
|
-
n.textContent = e, n.title = e,
|
|
2353
|
+
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);
|
|
2351
2354
|
}), this.updateNavButtons();
|
|
2352
2355
|
}
|
|
2353
2356
|
makeNavButton(e, t, n) {
|
|
@@ -2382,9 +2385,7 @@ var Z = class {
|
|
|
2382
2385
|
}
|
|
2383
2386
|
setActive(e) {
|
|
2384
2387
|
let t = this.activeIndex;
|
|
2385
|
-
this.activeIndex = e, this.styleListItem(t), this.styleListItem(e), this.tabs.forEach((t, n) =>
|
|
2386
|
-
t.style.cssText = this.tabCss(n, n === e);
|
|
2387
|
-
});
|
|
2388
|
+
this.activeIndex = e, this.styleListItem(t), this.styleListItem(e), this.tabs.forEach((t, n) => this.styleTab(t, n, n === e));
|
|
2388
2389
|
let n = this.tabs[e];
|
|
2389
2390
|
if (n && n.offsetParent !== null) {
|
|
2390
2391
|
let e = this.tabStrip, t = n.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
@@ -2395,12 +2396,16 @@ var Z = class {
|
|
|
2395
2396
|
setDirection(e) {
|
|
2396
2397
|
this.rtl = e, this.tabBar.style.flexDirection = e ? "row-reverse" : "row", this.tabStrip.style.marginLeft = e ? "0" : `${Br}px`, this.tabStrip.style.marginRight = e ? `${Br}px` : "0", this.tabList.style.flexDirection = e ? "row-reverse" : "row";
|
|
2397
2398
|
}
|
|
2398
|
-
tabStyle(e
|
|
2399
|
-
|
|
2400
|
-
|
|
2399
|
+
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:${Rr - 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:${Rr - 5}px;font-size:11px;background:var(--ooxml-xlsx-chrome-surface-muted,#e0e0e0);color:var(--ooxml-xlsx-chrome-text-muted,#555);`;
|
|
2401
|
+
}
|
|
2402
|
+
styleTab(e, t, n) {
|
|
2403
|
+
e.style.cssText = this.tabCss(t, n);
|
|
2404
|
+
let r = this.tabColors[t];
|
|
2405
|
+
r && (e.style.boxShadow = `inset 0 -${n ? 2 : 3}px 0 0 ${r}`);
|
|
2401
2406
|
}
|
|
2402
2407
|
tabCss(e, t) {
|
|
2403
|
-
let n = this.tabStyle(t
|
|
2408
|
+
let n = this.tabStyle(t), r = this.host.hiddenSheetMode();
|
|
2404
2409
|
return r !== "show" && this.host.isHidden(e) && (n += r === "skip" ? "display:none;" : `opacity:${Vr};`), n;
|
|
2405
2410
|
}
|
|
2406
2411
|
initSheetList() {
|
|
@@ -2509,15 +2514,15 @@ var Z = class {
|
|
|
2509
2514
|
destroy() {
|
|
2510
2515
|
this.cancelPendingOpen(), this.closeSheetList(), this.listItems = [], this.tabListeners.dispose(), this.listeners.dispose();
|
|
2511
2516
|
}
|
|
2512
|
-
},
|
|
2513
|
-
function
|
|
2517
|
+
}, Kr = 2;
|
|
2518
|
+
function qr(e, t, n) {
|
|
2514
2519
|
return e <= 50 ? t + e / 50 * (1 - t) : 1 + (e - 50) / 50 * (n - 1);
|
|
2515
2520
|
}
|
|
2516
|
-
function
|
|
2521
|
+
function Jr(e, t, n) {
|
|
2517
2522
|
let r = Math.min(n, Math.max(t, e));
|
|
2518
2523
|
return r <= 1 ? (r - t) / (1 - t) * 50 : 50 + (r - 1) / (n - 1) * 50;
|
|
2519
2524
|
}
|
|
2520
|
-
var
|
|
2525
|
+
var Yr = class {
|
|
2521
2526
|
host;
|
|
2522
2527
|
element;
|
|
2523
2528
|
slider;
|
|
@@ -2531,43 +2536,43 @@ var Jr = class {
|
|
|
2531
2536
|
let i = e.createElement("button");
|
|
2532
2537
|
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;
|
|
2533
2538
|
}, s = e.createElement("input");
|
|
2534
|
-
s.type = "range", s.min = "0", s.max = "100", s.step = "any", s.value = String(
|
|
2535
|
-
let e = Number(s.value), t = Math.abs(e - 50) <=
|
|
2536
|
-
t === 50 && (s.value = "50"), this.host.setScale(
|
|
2539
|
+
s.type = "range", s.min = "0", s.max = "100", s.step = "any", s.value = String(Jr(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", () => {
|
|
2540
|
+
let e = Number(s.value), t = Math.abs(e - 50) <= Kr ? 50 : e;
|
|
2541
|
+
t === 50 && (s.value = "50"), this.host.setScale(qr(t, r, i));
|
|
2537
2542
|
});
|
|
2538
2543
|
let c = e.createElement("span");
|
|
2539
2544
|
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;
|
|
2540
2545
|
}
|
|
2541
2546
|
sync(e, t, n, r) {
|
|
2542
|
-
this.slider.value = String(
|
|
2547
|
+
this.slider.value = String(Jr(e, n, r)), this.label.textContent = `${t}%`;
|
|
2543
2548
|
}
|
|
2544
2549
|
destroy() {
|
|
2545
2550
|
this.listeners.dispose();
|
|
2546
2551
|
}
|
|
2547
2552
|
};
|
|
2548
|
-
function
|
|
2553
|
+
function Xr(e, t, n) {
|
|
2549
2554
|
if (!e) return !1;
|
|
2550
2555
|
for (let r of e.split(/\s+/)) {
|
|
2551
2556
|
if (!r) continue;
|
|
2552
|
-
let [e, i] = r.split(":"), a =
|
|
2557
|
+
let [e, i] = r.split(":"), a = z(e);
|
|
2553
2558
|
if (!a) continue;
|
|
2554
2559
|
if (!i) {
|
|
2555
2560
|
if (a.row === t && a.col === n) return !0;
|
|
2556
2561
|
continue;
|
|
2557
2562
|
}
|
|
2558
|
-
let o =
|
|
2563
|
+
let o = z(i);
|
|
2559
2564
|
if (!o) continue;
|
|
2560
2565
|
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);
|
|
2561
2566
|
if (t >= s && t <= c && n >= l && n <= u) return !0;
|
|
2562
2567
|
}
|
|
2563
2568
|
return !1;
|
|
2564
2569
|
}
|
|
2565
|
-
function
|
|
2570
|
+
function Zr(e, t, n) {
|
|
2566
2571
|
if (!e) return null;
|
|
2567
|
-
for (let r of e) if (r.validationType === "list" &&
|
|
2572
|
+
for (let r of e) if (r.validationType === "list" && Xr(r.sqref, t, n)) return r;
|
|
2568
2573
|
return null;
|
|
2569
2574
|
}
|
|
2570
|
-
var
|
|
2575
|
+
var Qr = class {
|
|
2571
2576
|
host;
|
|
2572
2577
|
panel;
|
|
2573
2578
|
panelKey = null;
|
|
@@ -2590,7 +2595,7 @@ var Zr = class {
|
|
|
2590
2595
|
drawDropdown() {
|
|
2591
2596
|
if (this.arrowRect = null, this.host.selectionMode() !== "cells") return;
|
|
2592
2597
|
let e = this.host.worksheet(), t = this.host.activeCell();
|
|
2593
|
-
if (!e || !t || !
|
|
2598
|
+
if (!e || !t || !Zr(e.dataValidations, t.row, t.col)) return;
|
|
2594
2599
|
let n = this.host.cellRect(t.row, t.col);
|
|
2595
2600
|
if (!n) return;
|
|
2596
2601
|
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;
|
|
@@ -2613,7 +2618,7 @@ var Zr = class {
|
|
|
2613
2618
|
this.hide();
|
|
2614
2619
|
return;
|
|
2615
2620
|
}
|
|
2616
|
-
let r =
|
|
2621
|
+
let r = Zr(e.dataValidations, t.row, t.col);
|
|
2617
2622
|
r && (this.hide(), this.panelKey = n, this.open(t, r.formula1));
|
|
2618
2623
|
}
|
|
2619
2624
|
async open(e, t) {
|
|
@@ -2690,22 +2695,22 @@ var Zr = class {
|
|
|
2690
2695
|
this.hide(), this.itemListeners.dispose();
|
|
2691
2696
|
}
|
|
2692
2697
|
};
|
|
2693
|
-
function
|
|
2698
|
+
function $r(e) {
|
|
2694
2699
|
let t = e.trim();
|
|
2695
2700
|
return t.startsWith("#") && (t = t.slice(1).trim()), t.startsWith("=") && (t = t.slice(1).trim()), t;
|
|
2696
2701
|
}
|
|
2697
|
-
function
|
|
2702
|
+
function ei(e) {
|
|
2698
2703
|
let t = !1, n = -1;
|
|
2699
2704
|
for (let r = 0; r < e.length; r++) e[r] === "'" ? t && e[r + 1] === "'" ? r++ : t = !t : e[r] === "!" && !t && (n = r);
|
|
2700
2705
|
return t ? -1 : n;
|
|
2701
2706
|
}
|
|
2702
|
-
function
|
|
2707
|
+
function ti(e) {
|
|
2703
2708
|
let t = e.trim();
|
|
2704
2709
|
return t.length >= 2 && t.startsWith("'") && t.endsWith("'") ? t.slice(1, -1).replace(/''/g, "'") : t;
|
|
2705
2710
|
}
|
|
2706
|
-
function
|
|
2707
|
-
let r =
|
|
2708
|
-
if (!
|
|
2711
|
+
function ni(e, t, n) {
|
|
2712
|
+
let r = ei(e), i = r >= 0 ? ti(e.slice(0, r)) : void 0, a = (r >= 0 ? e.slice(r + 1) : e).split(":", 1)[0]?.trim() ?? "";
|
|
2713
|
+
if (!z(a)) return null;
|
|
2709
2714
|
let o = t;
|
|
2710
2715
|
if (i !== void 0) {
|
|
2711
2716
|
let e = i.toLocaleLowerCase("en-US");
|
|
@@ -2716,22 +2721,22 @@ function ti(e, t, n) {
|
|
|
2716
2721
|
cellRef: a
|
|
2717
2722
|
};
|
|
2718
2723
|
}
|
|
2719
|
-
function
|
|
2724
|
+
function ri(e, t, n, r) {
|
|
2720
2725
|
let i = /* @__PURE__ */ new Map();
|
|
2721
2726
|
for (let e of r) i.set(e.name.toLocaleLowerCase("en-US"), e);
|
|
2722
|
-
let a =
|
|
2727
|
+
let a = $r(e), o = /* @__PURE__ */ new Set();
|
|
2723
2728
|
for (;;) {
|
|
2724
|
-
let e =
|
|
2729
|
+
let e = ni(a, t, n);
|
|
2725
2730
|
if (e) return e;
|
|
2726
2731
|
let r = a.toLocaleLowerCase("en-US");
|
|
2727
2732
|
if (!r || o.has(r)) return null;
|
|
2728
2733
|
o.add(r);
|
|
2729
2734
|
let s = i.get(r);
|
|
2730
2735
|
if (!s) return null;
|
|
2731
|
-
a =
|
|
2736
|
+
a = $r(s.formula);
|
|
2732
2737
|
}
|
|
2733
2738
|
}
|
|
2734
|
-
var
|
|
2739
|
+
var ii = class {
|
|
2735
2740
|
host;
|
|
2736
2741
|
hyperlinkMap = /* @__PURE__ */ new Map();
|
|
2737
2742
|
constructor(e) {
|
|
@@ -2758,16 +2763,16 @@ var ri = class {
|
|
|
2758
2763
|
};
|
|
2759
2764
|
else return !1;
|
|
2760
2765
|
let r = this.host.onHyperlinkClick();
|
|
2761
|
-
return r ? (r(n), !0) : (n.kind === "external" ?
|
|
2766
|
+
return r ? (r(n), !0) : (n.kind === "external" ? L(n.url, void 0, this.host.hostWindow) : this.navigateInternal(n.ref).catch((e) => this.host.reportError(e)), !0);
|
|
2762
2767
|
}
|
|
2763
2768
|
async navigateInternal(e) {
|
|
2764
|
-
let t =
|
|
2769
|
+
let t = ri(e, this.host.currentSheet(), this.host.sheetNames(), this.host.definedNames());
|
|
2765
2770
|
t && (t.sheetIndex !== this.host.currentSheet() && await this.host.goToSheet(t.sheetIndex), await this.host.scrollToCell(t.cellRef));
|
|
2766
2771
|
}
|
|
2767
2772
|
destroy() {
|
|
2768
2773
|
this.hyperlinkMap.clear();
|
|
2769
2774
|
}
|
|
2770
|
-
},
|
|
2775
|
+
}, ai = class {
|
|
2771
2776
|
_sheetCount;
|
|
2772
2777
|
_sheetName;
|
|
2773
2778
|
_collectSheetCells;
|
|
@@ -2800,7 +2805,7 @@ var ri = class {
|
|
|
2800
2805
|
return t ? {
|
|
2801
2806
|
sheet: t.sheet,
|
|
2802
2807
|
sheetName: t.sheetName,
|
|
2803
|
-
ref:
|
|
2808
|
+
ref: it(t.row, t.col),
|
|
2804
2809
|
row: t.row,
|
|
2805
2810
|
col: t.col
|
|
2806
2811
|
} : null;
|
|
@@ -2830,7 +2835,7 @@ var ri = class {
|
|
|
2830
2835
|
if (n !== this._generation) return [];
|
|
2831
2836
|
let o = this._sheetName(a);
|
|
2832
2837
|
for (let n of r) {
|
|
2833
|
-
let r =
|
|
2838
|
+
let r = xe(Ee([{ text: n.text }]), e, t);
|
|
2834
2839
|
for (let e of r) {
|
|
2835
2840
|
let t = e.slices[0], r = n.text.slice(t.start, t.end);
|
|
2836
2841
|
i.push({
|
|
@@ -2846,10 +2851,10 @@ var ri = class {
|
|
|
2846
2851
|
return n === this._generation ? (this._matches = i, this._active = -1, this.matches()) : [];
|
|
2847
2852
|
}
|
|
2848
2853
|
next() {
|
|
2849
|
-
return this._active =
|
|
2854
|
+
return this._active = Oe(this._active, this._matches.length), this._activePublic();
|
|
2850
2855
|
}
|
|
2851
2856
|
prev() {
|
|
2852
|
-
return this._active =
|
|
2857
|
+
return this._active = De(this._active, this._matches.length), this._activePublic();
|
|
2853
2858
|
}
|
|
2854
2859
|
_activePublic() {
|
|
2855
2860
|
let e = this._locationAt(this._active);
|
|
@@ -2859,19 +2864,19 @@ var ri = class {
|
|
|
2859
2864
|
location: e
|
|
2860
2865
|
} : null;
|
|
2861
2866
|
}
|
|
2862
|
-
},
|
|
2863
|
-
function
|
|
2864
|
-
let n = e ? "#fb8c00" : "#ffb300", r = e ? t.active : t.match, i = r ?? (e ?
|
|
2867
|
+
}, oi = "color-mix(in srgb, #ffb300 8%, transparent)", si = "color-mix(in srgb, #fb8c00 8%, transparent)";
|
|
2868
|
+
function ci(e, t = {}) {
|
|
2869
|
+
let n = e ? "#fb8c00" : "#ffb300", r = e ? t.active : t.match, i = r ?? (e ? si : oi);
|
|
2865
2870
|
return {
|
|
2866
2871
|
border: `2px solid ${r ?? n}`,
|
|
2867
2872
|
background: i
|
|
2868
2873
|
};
|
|
2869
2874
|
}
|
|
2870
|
-
var
|
|
2875
|
+
var li = class {
|
|
2871
2876
|
host;
|
|
2872
2877
|
controller;
|
|
2873
2878
|
constructor(e) {
|
|
2874
|
-
this.host = e, this.controller = new
|
|
2879
|
+
this.host = e, this.controller = new ai(() => e.sheetCount(), (t) => e.workbook()?.sheetNames[t] ?? "", (e) => this.collectSheetCells(e));
|
|
2875
2880
|
}
|
|
2876
2881
|
async collectSheetCells(e) {
|
|
2877
2882
|
let t = this.host.workbook();
|
|
@@ -2900,7 +2905,7 @@ var ci = class {
|
|
|
2900
2905
|
e.clearFind();
|
|
2901
2906
|
let t = this.host.worksheet();
|
|
2902
2907
|
if (!t) return;
|
|
2903
|
-
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 =
|
|
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 = H(t).roundedFrozenExtent(n), l = i + c.width, u = a + c.height, d = this.host.highlightColors(), f = ci(!1, d), p = ci(!0, d);
|
|
2904
2909
|
for (let t of this.controller.sheetHighlights(this.host.currentSheet())) {
|
|
2905
2910
|
let n = this.host.cellRect(t.row, t.col);
|
|
2906
2911
|
if (!n) continue;
|
|
@@ -2932,8 +2937,8 @@ var ci = class {
|
|
|
2932
2937
|
destroy() {
|
|
2933
2938
|
this.controller.invalidate();
|
|
2934
2939
|
}
|
|
2935
|
-
},
|
|
2936
|
-
function
|
|
2940
|
+
}, ui = 25e4, di = 8 * 1024 * 1024;
|
|
2941
|
+
function fi(e, t) {
|
|
2937
2942
|
let n = 0, r = !1;
|
|
2938
2943
|
for (let t = 0; t < e.length; t++) {
|
|
2939
2944
|
let i = e.charCodeAt(t);
|
|
@@ -2941,7 +2946,7 @@ function di(e, t) {
|
|
|
2941
2946
|
}
|
|
2942
2947
|
return e.length + (r ? n + 2 : 0) > t ? null : r ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
2943
2948
|
}
|
|
2944
|
-
var
|
|
2949
|
+
var pi = class {
|
|
2945
2950
|
host;
|
|
2946
2951
|
constructor(e) {
|
|
2947
2952
|
this.host = e;
|
|
@@ -2976,12 +2981,12 @@ var fi = class {
|
|
|
2976
2981
|
c1: n.left,
|
|
2977
2982
|
c2: n.right
|
|
2978
2983
|
}, u = s - o + 1, d = l - c + 1;
|
|
2979
|
-
if (u > Math.floor(
|
|
2984
|
+
if (u > Math.floor(ui / d)) return {
|
|
2980
2985
|
status: "too-large",
|
|
2981
2986
|
limit: "cells"
|
|
2982
2987
|
};
|
|
2983
2988
|
let f = u * d, p = Math.max(0, u - 1) + u * Math.max(0, d - 1);
|
|
2984
|
-
if (p >
|
|
2989
|
+
if (p > di) return {
|
|
2985
2990
|
status: "too-large",
|
|
2986
2991
|
limit: "text"
|
|
2987
2992
|
};
|
|
@@ -2990,7 +2995,7 @@ var fi = class {
|
|
|
2990
2995
|
if (n.col < c || n.col > l) continue;
|
|
2991
2996
|
let i = n.value, a = r?.cellText(e, n) ?? "";
|
|
2992
2997
|
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) {
|
|
2993
|
-
let e =
|
|
2998
|
+
let e = fi(a, di - p);
|
|
2994
2999
|
if (e === null) return {
|
|
2995
3000
|
status: "too-large",
|
|
2996
3001
|
limit: "text"
|
|
@@ -3021,29 +3026,29 @@ var fi = class {
|
|
|
3021
3026
|
return { status: "clipboard-denied" };
|
|
3022
3027
|
}
|
|
3023
3028
|
}
|
|
3024
|
-
},
|
|
3025
|
-
function
|
|
3029
|
+
}, mi = 40, hi = 900;
|
|
3030
|
+
function gi(e, t) {
|
|
3026
3031
|
if (t <= 0) return 0;
|
|
3027
|
-
let n = Math.min(
|
|
3028
|
-
return e < n ? -900 * Math.min(1, Math.max(0, (n - e) / n)) : e > t - n ?
|
|
3032
|
+
let n = Math.min(mi, t / 2);
|
|
3033
|
+
return e < n ? -900 * Math.min(1, Math.max(0, (n - e) / n)) : e > t - n ? hi * Math.min(1, Math.max(0, (e - (t - n)) / n)) : 0;
|
|
3029
3034
|
}
|
|
3030
|
-
function
|
|
3035
|
+
function _i(e, t, n, r) {
|
|
3031
3036
|
if (r === "all") return {
|
|
3032
3037
|
x: 0,
|
|
3033
3038
|
y: 0
|
|
3034
3039
|
};
|
|
3035
|
-
let i = r === "rows" ? 0 :
|
|
3040
|
+
let i = r === "rows" ? 0 : gi(e.x, t.width), a = r === "cols" ? 0 : gi(e.y, t.height);
|
|
3036
3041
|
return {
|
|
3037
3042
|
x: n ? -i : i,
|
|
3038
3043
|
y: a
|
|
3039
3044
|
};
|
|
3040
3045
|
}
|
|
3041
|
-
var
|
|
3042
|
-
function
|
|
3046
|
+
var vi = 4, yi = 5, bi = 16384;
|
|
3047
|
+
function xi(e, t, n, r) {
|
|
3043
3048
|
for (let { index: i, edge: a } of t) if (!(a <= r) && Math.abs(e - a) <= n) return i;
|
|
3044
3049
|
return null;
|
|
3045
3050
|
}
|
|
3046
|
-
var
|
|
3051
|
+
var Si = class {
|
|
3047
3052
|
host;
|
|
3048
3053
|
cleanups = [];
|
|
3049
3054
|
pendingTap = null;
|
|
@@ -3095,7 +3100,7 @@ var xi = class {
|
|
|
3095
3100
|
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;
|
|
3096
3101
|
if (!u && !d) return null;
|
|
3097
3102
|
if (u && d) return { kind: "corner" };
|
|
3098
|
-
let f =
|
|
3103
|
+
let f = H(r), p = n === "logical" ? {
|
|
3099
3104
|
x: this.host.scrollLeft(),
|
|
3100
3105
|
y: this.host.scrollTop()
|
|
3101
3106
|
} : this.host.displayedViewportOffset();
|
|
@@ -3119,7 +3124,7 @@ var xi = class {
|
|
|
3119
3124
|
getResizeTarget(e, t) {
|
|
3120
3125
|
let n = this.host.worksheet();
|
|
3121
3126
|
if (!n) return null;
|
|
3122
|
-
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 =
|
|
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 = H(n), u = l.maximumDigitWidth, d = l.axesAtScale(r);
|
|
3123
3128
|
if (o <= c && a > s) {
|
|
3124
3129
|
let n = this.getHeaderHit(e, t);
|
|
3125
3130
|
if (n?.kind !== "col") return null;
|
|
@@ -3132,7 +3137,7 @@ var xi = class {
|
|
|
3132
3137
|
edge: t.x + t.w
|
|
3133
3138
|
}));
|
|
3134
3139
|
}
|
|
3135
|
-
let c =
|
|
3140
|
+
let c = xi(a, i, vi, s);
|
|
3136
3141
|
return c === null ? null : {
|
|
3137
3142
|
kind: "col",
|
|
3138
3143
|
index: c,
|
|
@@ -3152,7 +3157,7 @@ var xi = class {
|
|
|
3152
3157
|
edge: t.y + t.h
|
|
3153
3158
|
}));
|
|
3154
3159
|
}
|
|
3155
|
-
let s =
|
|
3160
|
+
let s = xi(o, i, vi, c);
|
|
3156
3161
|
return s === null ? null : {
|
|
3157
3162
|
kind: "row",
|
|
3158
3163
|
index: s,
|
|
@@ -3171,8 +3176,8 @@ var xi = class {
|
|
|
3171
3176
|
let t = i.at(-1);
|
|
3172
3177
|
t && e[0] <= t[1] + 1 ? t[1] = Math.max(t[1], e[1]) : i.push([...e]);
|
|
3173
3178
|
}
|
|
3174
|
-
if (i.reduce((e, [t, n]) => e + n - t + 1, 0) >
|
|
3175
|
-
let a =
|
|
3179
|
+
if (i.reduce((e, [t, n]) => e + n - t + 1, 0) > bi) throw RangeError(`A resize gesture may affect at most ${bi} selected bands.`);
|
|
3180
|
+
let a = H(n), o = e === "col" ? a.col : a.row, s = [];
|
|
3176
3181
|
for (let [e, t] of i) for (let n = e; n <= t; n++) o.sizeOf(n) > 0 && s.push(n);
|
|
3177
3182
|
return s;
|
|
3178
3183
|
}
|
|
@@ -3192,9 +3197,9 @@ var xi = class {
|
|
|
3192
3197
|
let t = i.at(-1);
|
|
3193
3198
|
t && e.first <= t.last + 1 ? t.last = Math.max(t.last, e.last) : i.push({ ...e });
|
|
3194
3199
|
}
|
|
3195
|
-
if (!t && !
|
|
3200
|
+
if (!t && !Vt(n).length && i.reduce((e, t) => e + t.last - t.first + 1, 0) <= bi) return;
|
|
3196
3201
|
let a = [], o = 0;
|
|
3197
|
-
for (let e of
|
|
3202
|
+
for (let e of H(n).row.positiveRanges()) {
|
|
3198
3203
|
for (; o < i.length && i[o].last < e.first;) o++;
|
|
3199
3204
|
for (let t = o; t < i.length && i[t].first <= e.last; t++) {
|
|
3200
3205
|
let n = Math.max(e.first, i[t].first), r = Math.min(e.last, i[t].last);
|
|
@@ -3238,21 +3243,21 @@ var xi = class {
|
|
|
3238
3243
|
}
|
|
3239
3244
|
let i = this.host.scale(), a = this.host.canvasArea.getBoundingClientRect();
|
|
3240
3245
|
if (n.kind === "col") {
|
|
3241
|
-
let t = this.host.screenX(e - a.left, 0), o = Math.max(
|
|
3246
|
+
let t = this.host.screenX(e - a.left, 0), o = Math.max(yi, Math.round((t - n.originScaled) / i)), s = Ut(o, n.mdw);
|
|
3242
3247
|
for (let e of n.indices) r.colWidths[e] = s, this.host.recordSizeOverride("col", e, o);
|
|
3243
3248
|
} else if (n.rowPreview) {
|
|
3244
|
-
let e = t - a.top, o = Math.max(
|
|
3249
|
+
let e = t - a.top, o = Math.max(yi, Math.round((e - n.originScaled) / i));
|
|
3245
3250
|
try {
|
|
3246
|
-
n.rowPreview.apply(
|
|
3251
|
+
n.rowPreview.apply(Gt(o)), this.host.updateSpacerSize(r), this.host.updateSelectionOverlay(), this.host.scheduleRender();
|
|
3247
3252
|
} catch (e) {
|
|
3248
3253
|
this.finishResize(n.pointerId, !1, !0), this.host.reportError(e);
|
|
3249
3254
|
}
|
|
3250
3255
|
return;
|
|
3251
3256
|
} else {
|
|
3252
|
-
let e = t - a.top, o =
|
|
3257
|
+
let e = t - a.top, o = Gt(Math.max(yi, Math.round((e - n.originScaled) / i)));
|
|
3253
3258
|
for (let e of n.indices) r.rowHeights[e] = o, this.host.recordSizeOverride("row", e);
|
|
3254
3259
|
}
|
|
3255
|
-
|
|
3260
|
+
q.invalidate(r), this.host.updateSpacerSize(r), this.host.updateSelectionOverlay(), this.host.scheduleRender();
|
|
3256
3261
|
}
|
|
3257
3262
|
applyPointerSelection(e, t, n, r, i, a) {
|
|
3258
3263
|
let o = this.getHeaderHit(e, t);
|
|
@@ -3336,7 +3341,7 @@ var xi = class {
|
|
|
3336
3341
|
y: 0
|
|
3337
3342
|
};
|
|
3338
3343
|
let t = this.viewportInputBounds();
|
|
3339
|
-
return
|
|
3344
|
+
return _i({
|
|
3340
3345
|
x: e.clientX - t.left,
|
|
3341
3346
|
y: e.clientY - t.top
|
|
3342
3347
|
}, {
|
|
@@ -3416,7 +3421,7 @@ var xi = class {
|
|
|
3416
3421
|
try {
|
|
3417
3422
|
let n = this.host.worksheet(), r = t.kind === "row" ? this.compactRowTargets(t.index) : void 0, i = r ? [] : this.resizeIndices(t.kind, t.index);
|
|
3418
3423
|
if (!r) try {
|
|
3419
|
-
this.host.assertResizeBudget(t.kind, i,
|
|
3424
|
+
this.host.assertResizeBudget(t.kind, i, bi);
|
|
3420
3425
|
} catch (e) {
|
|
3421
3426
|
if (t.kind !== "row" || !(e instanceof RangeError)) throw e;
|
|
3422
3427
|
r = this.compactRowTargets(t.index, !0), i = [];
|
|
@@ -3545,7 +3550,7 @@ var xi = class {
|
|
|
3545
3550
|
this.host.zoomAt(Number.isFinite(t) && Number.isFinite(n) ? {
|
|
3546
3551
|
x: t,
|
|
3547
3552
|
y: n
|
|
3548
|
-
} : null,
|
|
3553
|
+
} : null, ge(this.host.scale(), e.deltaY, e.deltaMode));
|
|
3549
3554
|
}, { passive: !1 }), this.on("pointerleave", (e) => {
|
|
3550
3555
|
let t = e.relatedTarget;
|
|
3551
3556
|
t && this.host.comments.contains(t) || this.host.hideCommentPopup();
|
|
@@ -3559,14 +3564,14 @@ var xi = class {
|
|
|
3559
3564
|
e.preventDefault(), this.host.copySelection();
|
|
3560
3565
|
} 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")) {
|
|
3561
3566
|
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 ? {
|
|
3562
|
-
row: Math.max(1, Math.min(
|
|
3563
|
-
col: Math.max(1, Math.min(
|
|
3567
|
+
row: Math.max(1, Math.min(K, t.row + n)),
|
|
3568
|
+
col: Math.max(1, Math.min(G, t.col + r))
|
|
3564
3569
|
} : {
|
|
3565
3570
|
row: 1,
|
|
3566
3571
|
col: 1
|
|
3567
3572
|
};
|
|
3568
3573
|
e.preventDefault(), this.host.hideCommentPopup();
|
|
3569
|
-
let a =
|
|
3574
|
+
let a = it(i.row, i.col);
|
|
3570
3575
|
this.host.setSelection(a), this.host.scrollCellIntoView(i.row, i.col), this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.emitViewportChange();
|
|
3571
3576
|
} else if (e.key === "Escape" && this.resizeDrag?.rowPreview) e.preventDefault(), this.finishResize(this.resizeDrag.pointerId, !1, !0);
|
|
3572
3577
|
else if (e.key === "Escape" && this.host.validation.isOpen()) this.host.hideValidationPanel();
|
|
@@ -3581,14 +3586,14 @@ var xi = class {
|
|
|
3581
3586
|
this.resizeDrag && this.finishResize(this.resizeDrag.pointerId, !1, !0), this.stopSelectionAutoScroll(), this.pendingTap = null, this.pendingClick = null, this.pendingElementClick = null, this.resizeDrag = null;
|
|
3582
3587
|
for (let e of this.cleanups.splice(0)) e();
|
|
3583
3588
|
}
|
|
3584
|
-
},
|
|
3585
|
-
function
|
|
3589
|
+
}, Ci = "#1a73e8";
|
|
3590
|
+
function wi(e) {
|
|
3586
3591
|
return {
|
|
3587
3592
|
border: `2px solid ${e}`,
|
|
3588
3593
|
background: `color-mix(in srgb, ${e} 8%, transparent)`
|
|
3589
3594
|
};
|
|
3590
3595
|
}
|
|
3591
|
-
function
|
|
3596
|
+
function Ti(e) {
|
|
3592
3597
|
let t = [];
|
|
3593
3598
|
for (let n of e) {
|
|
3594
3599
|
let e = n.x + n.width, r = n.y + n.height;
|
|
@@ -3634,7 +3639,7 @@ function wi(e) {
|
|
|
3634
3639
|
}
|
|
3635
3640
|
return r.join("");
|
|
3636
3641
|
}
|
|
3637
|
-
var
|
|
3642
|
+
var Ei = 0, Di = class {
|
|
3638
3643
|
host;
|
|
3639
3644
|
constructor(e) {
|
|
3640
3645
|
this.host = e;
|
|
@@ -3648,7 +3653,7 @@ var Ti = 0, Ei = class {
|
|
|
3648
3653
|
if (!e) return;
|
|
3649
3654
|
let t = this.host.scale(), n = this.host.worksheet();
|
|
3650
3655
|
if (!n) return;
|
|
3651
|
-
let r = (e) => Math.round(e * t), i = r(50), a = r(22), o = this.host.canvasArea.clientWidth, s = this.host.canvasArea.clientHeight, c =
|
|
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 = H(n), l = c.effectiveFrozenBands({
|
|
3652
3657
|
scale: t,
|
|
3653
3658
|
width: o,
|
|
3654
3659
|
height: s,
|
|
@@ -3663,12 +3668,12 @@ var Ti = 0, Ei = class {
|
|
|
3663
3668
|
end: Math.min(o, i + d)
|
|
3664
3669
|
}, {
|
|
3665
3670
|
first: l.cols + 1,
|
|
3666
|
-
last:
|
|
3671
|
+
last: G,
|
|
3667
3672
|
start: Math.min(o, i + d),
|
|
3668
3673
|
end: o
|
|
3669
3674
|
}] : [{
|
|
3670
3675
|
first: 1,
|
|
3671
|
-
last:
|
|
3676
|
+
last: G,
|
|
3672
3677
|
start: i,
|
|
3673
3678
|
end: o
|
|
3674
3679
|
}], m = l.rows > 0 ? [{
|
|
@@ -3678,15 +3683,15 @@ var Ti = 0, Ei = class {
|
|
|
3678
3683
|
end: Math.min(s, a + f)
|
|
3679
3684
|
}, {
|
|
3680
3685
|
first: l.rows + 1,
|
|
3681
|
-
last:
|
|
3686
|
+
last: K,
|
|
3682
3687
|
start: Math.min(s, a + f),
|
|
3683
3688
|
end: s
|
|
3684
3689
|
}] : [{
|
|
3685
3690
|
first: 1,
|
|
3686
|
-
last:
|
|
3691
|
+
last: K,
|
|
3687
3692
|
start: a,
|
|
3688
3693
|
end: s
|
|
3689
|
-
}], h = p.filter((e) => e.end > e.start), g = m.filter((e) => e.end > e.start), _ = this.host.selectionColor() ??
|
|
3694
|
+
}], h = p.filter((e) => e.end > e.start), g = m.filter((e) => e.end > e.start), _ = this.host.selectionColor() ?? Ci, { background: v } = wi(_), y = /* @__PURE__ */ new Set(), b = [], x = [];
|
|
3690
3695
|
for (let t of e.areas) {
|
|
3691
3696
|
let e = t.kind === "cells" ? {
|
|
3692
3697
|
top: t.top,
|
|
@@ -3701,14 +3706,14 @@ var Ti = 0, Ei = class {
|
|
|
3701
3706
|
top: t.firstRow,
|
|
3702
3707
|
bottom: t.lastRow,
|
|
3703
3708
|
left: 1,
|
|
3704
|
-
right:
|
|
3709
|
+
right: G,
|
|
3705
3710
|
topEdge: !0,
|
|
3706
3711
|
bottomEdge: !0,
|
|
3707
3712
|
leftEdge: !1,
|
|
3708
3713
|
rightEdge: !1
|
|
3709
3714
|
} : t.kind === "columns" ? {
|
|
3710
3715
|
top: 1,
|
|
3711
|
-
bottom:
|
|
3716
|
+
bottom: K,
|
|
3712
3717
|
left: t.firstColumn,
|
|
3713
3718
|
right: t.lastColumn,
|
|
3714
3719
|
topEdge: !1,
|
|
@@ -3717,9 +3722,9 @@ var Ti = 0, Ei = class {
|
|
|
3717
3722
|
rightEdge: !0
|
|
3718
3723
|
} : {
|
|
3719
3724
|
top: 1,
|
|
3720
|
-
bottom:
|
|
3725
|
+
bottom: K,
|
|
3721
3726
|
left: 1,
|
|
3722
|
-
right:
|
|
3727
|
+
right: G,
|
|
3723
3728
|
topEdge: !1,
|
|
3724
3729
|
bottomEdge: !1,
|
|
3725
3730
|
leftEdge: !1,
|
|
@@ -3732,35 +3737,35 @@ var Ti = 0, Ei = class {
|
|
|
3732
3737
|
if (!u || !d) continue;
|
|
3733
3738
|
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;
|
|
3734
3739
|
if (T <= 0 || E <= 0) continue;
|
|
3735
|
-
let D = t.kind === "columns" && n === g[0], O = t.kind === "columns" && n === g.at(-1), k = t.kind === "rows" && r === h[0], A = t.kind === "rows" && r === h.at(-1),
|
|
3736
|
-
|
|
3740
|
+
let D = t.kind === "columns" && n === g[0], O = t.kind === "columns" && n === g.at(-1), k = t.kind === "rows" && r === h[0], A = t.kind === "rows" && r === h.at(-1), ee = D || e.topEdge && i === e.top && p >= n.start, te = O || e.bottomEdge && a === e.bottom && _ <= n.end, j = k || e.leftEdge && c === e.left && f >= r.start, M = A || e.rightEdge && l === e.right && m <= r.end, N = this.host.screenX(v, T), P = this.host.isRtl() ? M : j, ne = this.host.isRtl() ? j : M, F = [
|
|
3741
|
+
N,
|
|
3737
3742
|
S,
|
|
3738
3743
|
T,
|
|
3739
3744
|
E,
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3745
|
+
ee,
|
|
3746
|
+
ne,
|
|
3747
|
+
te,
|
|
3748
|
+
P
|
|
3744
3749
|
].join("|");
|
|
3745
|
-
if (y.has(
|
|
3746
|
-
y.add(
|
|
3747
|
-
let re = Math.min(1, T / 2),
|
|
3750
|
+
if (y.has(F)) continue;
|
|
3751
|
+
y.add(F), b.push(`M${N} ${S}h${T}v${E}h${-T}Z`);
|
|
3752
|
+
let re = Math.min(1, T / 2), I = Math.min(1, E / 2), ie = this.host.isRtl() ? A : k, ae = this.host.isRtl() ? k : A, L = (e, t) => e <= 0 || e >= t, oe = N + (ie && L(N, o) ? re : 0), se = N + T - (ae && L(N + T, o) ? re : 0), R = S + (D && L(S, s) ? I : 0), ce = w - (O && L(w, s) ? I : 0);
|
|
3748
3753
|
x.push({
|
|
3749
|
-
x:
|
|
3750
|
-
y:
|
|
3751
|
-
width:
|
|
3752
|
-
height:
|
|
3753
|
-
top:
|
|
3754
|
-
right:
|
|
3755
|
-
bottom:
|
|
3756
|
-
left:
|
|
3754
|
+
x: oe,
|
|
3755
|
+
y: R,
|
|
3756
|
+
width: se - oe,
|
|
3757
|
+
height: ce - R,
|
|
3758
|
+
top: ee,
|
|
3759
|
+
right: ne,
|
|
3760
|
+
bottom: te,
|
|
3761
|
+
left: P
|
|
3757
3762
|
});
|
|
3758
3763
|
}
|
|
3759
3764
|
}
|
|
3760
3765
|
if (b.length > 0) {
|
|
3761
3766
|
let t = "http://www.w3.org/2000/svg", n = this.host.ownerDocument.createElementNS(t, "svg");
|
|
3762
3767
|
n.setAttribute("data-xlsx-selection-fill", ""), n.style.cssText = "position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none;";
|
|
3763
|
-
let r = e.areas.length > 1, i = this.host.cellRect(e.activeCell.row, e.activeCell.col), a = `xlsx-selection-mask-${++
|
|
3768
|
+
let r = e.areas.length > 1, i = this.host.cellRect(e.activeCell.row, e.activeCell.col), a = `xlsx-selection-mask-${++Ei}`, c = this.host.ownerDocument.createElementNS(t, "defs"), l = this.host.ownerDocument.createElementNS(t, "mask");
|
|
3764
3769
|
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));
|
|
3765
3770
|
let u = this.host.ownerDocument.createElementNS(t, "path");
|
|
3766
3771
|
if (u.setAttribute("d", b.join("")), u.setAttribute("fill", "#fff"), l.appendChild(u), i) for (let e of m) for (let n of p) {
|
|
@@ -3772,7 +3777,7 @@ var Ti = 0, Ei = class {
|
|
|
3772
3777
|
c.appendChild(l), n.appendChild(c);
|
|
3773
3778
|
let d = this.host.ownerDocument.createElementNS(t, "rect");
|
|
3774
3779
|
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);
|
|
3775
|
-
let f = r ? "" :
|
|
3780
|
+
let f = r ? "" : Ti(x);
|
|
3776
3781
|
if (f) {
|
|
3777
3782
|
let e = this.host.ownerDocument.createElementNS(t, "path");
|
|
3778
3783
|
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);
|
|
@@ -3796,10 +3801,10 @@ var Ti = 0, Ei = class {
|
|
|
3796
3801
|
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;`;
|
|
3797
3802
|
let a = this.host.ownerDocument.createElement("div");
|
|
3798
3803
|
a.setAttribute("data-xlsx-element-context-outline", e.elementType);
|
|
3799
|
-
let o = this.host.selectionColor() ??
|
|
3804
|
+
let o = this.host.selectionColor() ?? Ci;
|
|
3800
3805
|
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);
|
|
3801
3806
|
}
|
|
3802
|
-
},
|
|
3807
|
+
}, Oi = 65536, ki = 100, Ai = class {
|
|
3803
3808
|
host;
|
|
3804
3809
|
lastNotified = null;
|
|
3805
3810
|
emitting = !1;
|
|
@@ -3815,7 +3820,7 @@ var Ti = 0, Ei = class {
|
|
|
3815
3820
|
if (!this.host.onSelectionContextChange() || this.host.isDestroyed() || this.contextFrame !== null || this.contextMicrotask) return;
|
|
3816
3821
|
let e = () => {
|
|
3817
3822
|
if (this.contextFrame = null, this.contextMicrotask = !1, this.host.isDestroyed()) return;
|
|
3818
|
-
let e = this.host.readContext(
|
|
3823
|
+
let e = this.host.readContext(Oi);
|
|
3819
3824
|
this.host.onSelectionContextChange()?.(e ? structuredClone(e) : null);
|
|
3820
3825
|
};
|
|
3821
3826
|
typeof this.host.hostWindow.requestAnimationFrame == "function" ? this.contextFrame = this.host.hostWindow.requestAnimationFrame(e) : (this.contextMicrotask = !0, queueMicrotask(e));
|
|
@@ -3830,7 +3835,7 @@ var Ti = 0, Ei = class {
|
|
|
3830
3835
|
this.finishChain();
|
|
3831
3836
|
return;
|
|
3832
3837
|
}
|
|
3833
|
-
if (this.chainLength >=
|
|
3838
|
+
if (this.chainLength >= ki) {
|
|
3834
3839
|
this.lastNotified = e ? structuredClone(e) : null, this.finishChain();
|
|
3835
3840
|
return;
|
|
3836
3841
|
}
|
|
@@ -3864,7 +3869,7 @@ function $(e) {
|
|
|
3864
3869
|
}
|
|
3865
3870
|
return n;
|
|
3866
3871
|
}
|
|
3867
|
-
function
|
|
3872
|
+
function ji(e, t) {
|
|
3868
3873
|
let n = 0, r = e.length - 1;
|
|
3869
3874
|
for (; n <= r;) {
|
|
3870
3875
|
let i = n + r >>> 1, a = e[i];
|
|
@@ -3874,7 +3879,7 @@ function Ai(e, t) {
|
|
|
3874
3879
|
}
|
|
3875
3880
|
return !1;
|
|
3876
3881
|
}
|
|
3877
|
-
function
|
|
3882
|
+
function Mi(e, t, n) {
|
|
3878
3883
|
let r = 0, i = e.length;
|
|
3879
3884
|
for (; r < i;) {
|
|
3880
3885
|
let a = r + i >>> 1;
|
|
@@ -3882,26 +3887,26 @@ function ji(e, t, n) {
|
|
|
3882
3887
|
}
|
|
3883
3888
|
return r;
|
|
3884
3889
|
}
|
|
3885
|
-
function
|
|
3890
|
+
function Ni(e, t) {
|
|
3886
3891
|
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));
|
|
3887
3892
|
return e;
|
|
3888
3893
|
}
|
|
3889
|
-
var
|
|
3890
|
-
function
|
|
3891
|
-
return
|
|
3894
|
+
var Pi = 1 * 1024 * 1024, Fi = 65536;
|
|
3895
|
+
function Ii(e, t) {
|
|
3896
|
+
return Ae(e, Math.max(0, t));
|
|
3892
3897
|
}
|
|
3893
|
-
var
|
|
3898
|
+
var Li = class {
|
|
3894
3899
|
rows = /* @__PURE__ */ new WeakMap();
|
|
3895
3900
|
cells = /* @__PURE__ */ new WeakMap();
|
|
3896
3901
|
read(e, t, n, r, i, a) {
|
|
3897
3902
|
let o = a.maxCells ?? 1e3;
|
|
3898
3903
|
if (!Number.isFinite(o) || o < 0) throw RangeError("maxCells must be a finite non-negative number.");
|
|
3899
|
-
let s = Math.min(mr, Math.floor(o)), c = a.maxTextCharacters ??
|
|
3904
|
+
let s = Math.min(mr, Math.floor(o)), c = a.maxTextCharacters ?? Pi;
|
|
3900
3905
|
if (!Number.isFinite(c) || c < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
3901
3906
|
let l = Math.min(hr, Math.floor(c)), u = 0, d = !1, f = (e) => {
|
|
3902
3907
|
let t = typeof e == "string" ? [e] : e, n = [], r = 0;
|
|
3903
3908
|
for (let e = 0; e < t.length; e++) {
|
|
3904
|
-
let i = t[e], a = typeof i == "string" ? i : i.text, o = Math.max(0, Math.min(
|
|
3909
|
+
let i = t[e], a = typeof i == "string" ? i : i.text, o = Math.max(0, Math.min(Fi - r, l - u)), s = Ii(a, o);
|
|
3905
3910
|
if (n.push(s), r += s.length, u += s.length, s.length < a.length || e + 1 < t.length && o === 0) {
|
|
3906
3911
|
d = !0;
|
|
3907
3912
|
break;
|
|
@@ -3924,14 +3929,14 @@ var Ii = class {
|
|
|
3924
3929
|
active: !1
|
|
3925
3930
|
}]).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 ? [{
|
|
3926
3931
|
first: 1,
|
|
3927
|
-
last:
|
|
3932
|
+
last: K
|
|
3928
3933
|
}] : $([...m, ...g.map((e) => ({
|
|
3929
3934
|
first: e.top,
|
|
3930
3935
|
last: e.bottom
|
|
3931
3936
|
}))]), w = this.rows.get(e);
|
|
3932
|
-
w || (w =
|
|
3937
|
+
w || (w = Ni(e.rows, (e) => e.index), this.rows.set(e, w));
|
|
3933
3938
|
cellScan: for (let t of C) {
|
|
3934
|
-
let n =
|
|
3939
|
+
let n = Mi(w, t.first, (e) => e.index);
|
|
3935
3940
|
for (; n < w.length;) {
|
|
3936
3941
|
let a = w[n++];
|
|
3937
3942
|
if (a.index > t.last) break;
|
|
@@ -3944,14 +3949,14 @@ var Ii = class {
|
|
|
3944
3949
|
first: g[e].left,
|
|
3945
3950
|
last: g[e].right
|
|
3946
3951
|
}))));
|
|
3947
|
-
let c = p ||
|
|
3952
|
+
let c = p || ji(m, a.index) ? [{
|
|
3948
3953
|
first: 1,
|
|
3949
|
-
last:
|
|
3954
|
+
last: G
|
|
3950
3955
|
}] : $([...h, ...b]);
|
|
3951
3956
|
for (let t of c) {
|
|
3952
3957
|
let n = this.cells.get(a);
|
|
3953
|
-
n || (n =
|
|
3954
|
-
let o =
|
|
3958
|
+
n || (n = Ni(a.cells, (e) => e.col), this.cells.set(a, n));
|
|
3959
|
+
let o = Mi(n, t.first, (e) => e.col);
|
|
3955
3960
|
for (; o < n.length;) {
|
|
3956
3961
|
let a = n[o++];
|
|
3957
3962
|
if (a.col > t.last) break;
|
|
@@ -4008,7 +4013,7 @@ var Ii = class {
|
|
|
4008
4013
|
maxTextCharacters: l
|
|
4009
4014
|
};
|
|
4010
4015
|
}
|
|
4011
|
-
},
|
|
4016
|
+
}, Ri = {
|
|
4012
4017
|
background: "--ooxml-xlsx-chrome-background",
|
|
4013
4018
|
surface: "--ooxml-xlsx-chrome-surface",
|
|
4014
4019
|
mutedSurface: "--ooxml-xlsx-chrome-surface-muted",
|
|
@@ -4018,10 +4023,10 @@ var Ii = class {
|
|
|
4018
4023
|
selectedSurface: "--ooxml-xlsx-chrome-selection-background",
|
|
4019
4024
|
accent: "--ooxml-xlsx-chrome-accent"
|
|
4020
4025
|
};
|
|
4021
|
-
function
|
|
4022
|
-
return Object.keys(
|
|
4026
|
+
function zi(e, t) {
|
|
4027
|
+
return Object.keys(Ri).every((n) => e[n] === t[n]);
|
|
4023
4028
|
}
|
|
4024
|
-
var
|
|
4029
|
+
var Bi = class {
|
|
4025
4030
|
host;
|
|
4026
4031
|
colors = {};
|
|
4027
4032
|
styleObserver = null;
|
|
@@ -4035,12 +4040,12 @@ var zi = class {
|
|
|
4035
4040
|
let e = this.host.hostWindow, t = e.getComputedStyle?.bind(e);
|
|
4036
4041
|
if (!t) return;
|
|
4037
4042
|
let n = t(this.host.wrapper), r = {};
|
|
4038
|
-
for (let [e, t] of Object.entries(
|
|
4043
|
+
for (let [e, t] of Object.entries(Ri)) {
|
|
4039
4044
|
let i = n.getPropertyValue(t).trim();
|
|
4040
4045
|
i && (r[e] = i);
|
|
4041
4046
|
}
|
|
4042
4047
|
let i = r;
|
|
4043
|
-
|
|
4048
|
+
zi(this.colors, i) || (this.colors = i, this.host.onChange());
|
|
4044
4049
|
}
|
|
4045
4050
|
install() {
|
|
4046
4051
|
this.refresh();
|
|
@@ -4065,9 +4070,9 @@ var zi = class {
|
|
|
4065
4070
|
destroy() {
|
|
4066
4071
|
this.styleObserver?.disconnect(), this.styleObserver = null, this.schemeMedia && this.schemeListener && this.schemeMedia.removeEventListener?.("change", this.schemeListener), this.schemeMedia = null, this.schemeListener = null;
|
|
4067
4072
|
}
|
|
4068
|
-
},
|
|
4069
|
-
function
|
|
4070
|
-
let { cell: t, popup: n, viewport: r, rtl: i } = e, a =
|
|
4073
|
+
}, Vi = 8;
|
|
4074
|
+
function Hi(e) {
|
|
4075
|
+
let { cell: t, popup: n, viewport: r, rtl: i } = e, a = Vi, o = t.x + t.w + a, s = t.x - a - n.w, c = o + n.w <= r.w, l = s >= 0, u;
|
|
4071
4076
|
u = i ? l ? s : c ? o : s : c ? o : l ? s : o, u = Math.max(0, Math.min(u, r.w - n.w));
|
|
4072
4077
|
let d = t.y;
|
|
4073
4078
|
return d = Math.max(0, Math.min(d, r.h - n.h)), {
|
|
@@ -4075,20 +4080,20 @@ function Vi(e) {
|
|
|
4075
4080
|
top: d
|
|
4076
4081
|
};
|
|
4077
4082
|
}
|
|
4078
|
-
var
|
|
4079
|
-
function
|
|
4080
|
-
return
|
|
4083
|
+
var Ui;
|
|
4084
|
+
function Wi() {
|
|
4085
|
+
return Ui ??= import("./comment-ui-runtime-BtP_TpvT.js");
|
|
4081
4086
|
}
|
|
4082
|
-
var
|
|
4083
|
-
function
|
|
4087
|
+
var Gi = 150;
|
|
4088
|
+
function Ki(e) {
|
|
4084
4089
|
let t = /* @__PURE__ */ new Map();
|
|
4085
4090
|
for (let n of e) {
|
|
4086
|
-
let e =
|
|
4091
|
+
let e = z(n.cellRef);
|
|
4087
4092
|
e && t.set(`${e.row}:${e.col}`, n);
|
|
4088
4093
|
}
|
|
4089
4094
|
return t;
|
|
4090
4095
|
}
|
|
4091
|
-
var
|
|
4096
|
+
var qi = class {
|
|
4092
4097
|
host;
|
|
4093
4098
|
popup;
|
|
4094
4099
|
commentMap = /* @__PURE__ */ new Map();
|
|
@@ -4107,7 +4112,7 @@ var Ki = class {
|
|
|
4107
4112
|
}), this.resizeObserver.observe(this.popup));
|
|
4108
4113
|
}
|
|
4109
4114
|
setComments(e) {
|
|
4110
|
-
this.commentMap =
|
|
4115
|
+
this.commentMap = Ki(e);
|
|
4111
4116
|
}
|
|
4112
4117
|
commentAt(e) {
|
|
4113
4118
|
return this.commentMap.get(`${e.row}:${e.col}`);
|
|
@@ -4126,10 +4131,10 @@ var Ki = class {
|
|
|
4126
4131
|
}
|
|
4127
4132
|
this.popupKey !== t && (this.hide(), this.popupKey = t, this.timer = setTimeout(() => {
|
|
4128
4133
|
this.timer = null, this.show(e, n).catch((e) => this.host.reportError(e));
|
|
4129
|
-
},
|
|
4134
|
+
}, Gi));
|
|
4130
4135
|
}
|
|
4131
4136
|
async loadUi() {
|
|
4132
|
-
let e = this.ui ?? await
|
|
4137
|
+
let e = this.ui ?? await Wi();
|
|
4133
4138
|
return this.host.isDestroyed() || (this.ui = e), e;
|
|
4134
4139
|
}
|
|
4135
4140
|
async show(e, t) {
|
|
@@ -4176,7 +4181,7 @@ var Ki = class {
|
|
|
4176
4181
|
if (!e || this.popup.style.display === "none") return;
|
|
4177
4182
|
let t = this.host.cellRect(e.row, e.col);
|
|
4178
4183
|
if (!t) return;
|
|
4179
|
-
let n =
|
|
4184
|
+
let n = Hi({
|
|
4180
4185
|
cell: {
|
|
4181
4186
|
x: this.host.screenX(t.x, t.w),
|
|
4182
4187
|
y: t.y,
|
|
@@ -4201,8 +4206,8 @@ var Ki = class {
|
|
|
4201
4206
|
destroy() {
|
|
4202
4207
|
this.resizeObserver?.disconnect(), this.resizeObserver = null, this.hide(), this.commentMap.clear();
|
|
4203
4208
|
}
|
|
4204
|
-
},
|
|
4205
|
-
owner = new
|
|
4209
|
+
}, Ji = class {
|
|
4210
|
+
owner = new ke("SheetAcquisition");
|
|
4206
4211
|
get current() {
|
|
4207
4212
|
return this.owner.current;
|
|
4208
4213
|
}
|
|
@@ -4216,16 +4221,16 @@ var Ki = class {
|
|
|
4216
4221
|
this.owner.close();
|
|
4217
4222
|
}
|
|
4218
4223
|
};
|
|
4219
|
-
function
|
|
4224
|
+
function Yi(e) {
|
|
4220
4225
|
let t = {
|
|
4221
4226
|
...e,
|
|
4222
4227
|
rows: e.rows.map((e) => ({ ...e })),
|
|
4223
4228
|
rowHeights: { ...e.rowHeights },
|
|
4224
4229
|
colWidths: { ...e.colWidths }
|
|
4225
4230
|
};
|
|
4226
|
-
return e.colCollapsed && (t.colCollapsed = { ...e.colCollapsed }),
|
|
4231
|
+
return e.colCollapsed && (t.colCollapsed = { ...e.colCollapsed }), B(e, t), Ln(e, t), Ft(e, t), Wt(e, t), t;
|
|
4227
4232
|
}
|
|
4228
|
-
var
|
|
4233
|
+
var Xi = class {
|
|
4229
4234
|
scaleValue;
|
|
4230
4235
|
offsetX = 0;
|
|
4231
4236
|
offsetY = 0;
|
|
@@ -4272,7 +4277,7 @@ var Yi = class {
|
|
|
4272
4277
|
reset() {
|
|
4273
4278
|
this.offsetX = 0, this.offsetY = 0;
|
|
4274
4279
|
}
|
|
4275
|
-
},
|
|
4280
|
+
}, Zi = class {
|
|
4276
4281
|
animationFrame = null;
|
|
4277
4282
|
activeRender = !1;
|
|
4278
4283
|
pendingRender = null;
|
|
@@ -4285,7 +4290,7 @@ var Yi = class {
|
|
|
4285
4290
|
this.frameScheduler = typeof r.requestAnimationFrame == "function" && typeof r.cancelAnimationFrame == "function" ? {
|
|
4286
4291
|
requestAnimationFrame: (e) => r.requestAnimationFrame(e),
|
|
4287
4292
|
cancelAnimationFrame: (e) => r.cancelAnimationFrame(e)
|
|
4288
|
-
} : null, this.staticDispatcher = e ? new
|
|
4293
|
+
} : null, this.staticDispatcher = e ? new Se(e, t) : null;
|
|
4289
4294
|
}
|
|
4290
4295
|
begin() {
|
|
4291
4296
|
return this.staticDispatcher ? this.staticDispatcher.begin() : ++this.generation;
|
|
@@ -4337,7 +4342,7 @@ var Yi = class {
|
|
|
4337
4342
|
destroy() {
|
|
4338
4343
|
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++);
|
|
4339
4344
|
}
|
|
4340
|
-
},
|
|
4345
|
+
}, Qi = class {
|
|
4341
4346
|
state = null;
|
|
4342
4347
|
dragPointerId = null;
|
|
4343
4348
|
get anchor() {
|
|
@@ -4514,7 +4519,7 @@ var Yi = class {
|
|
|
4514
4519
|
};
|
|
4515
4520
|
}
|
|
4516
4521
|
}
|
|
4517
|
-
},
|
|
4522
|
+
}, $i = class {
|
|
4518
4523
|
canvas;
|
|
4519
4524
|
area;
|
|
4520
4525
|
input;
|
|
@@ -4552,7 +4557,7 @@ var Yi = class {
|
|
|
4552
4557
|
destroy() {
|
|
4553
4558
|
for (let e of this.cleanups.splice(0)) e();
|
|
4554
4559
|
}
|
|
4555
|
-
},
|
|
4560
|
+
}, ea = class {
|
|
4556
4561
|
stopValidationWheel = (e) => e.stopPropagation();
|
|
4557
4562
|
selection;
|
|
4558
4563
|
find;
|
|
@@ -4593,13 +4598,13 @@ var Yi = class {
|
|
|
4593
4598
|
destroy() {
|
|
4594
4599
|
this.validation.removeEventListener("wheel", this.stopValidationWheel);
|
|
4595
4600
|
}
|
|
4596
|
-
},
|
|
4597
|
-
function
|
|
4598
|
-
if (!e.head || e.head.querySelector(`style[${
|
|
4601
|
+
}, ta = Symbol("XlsxViewer.borrowedWorkbook"), na = Symbol("XlsxViewer.loadSource"), ra = 240, ia = 200, aa = 1, oa = "data-xlsx-viewer-styles", sa = ".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;}";
|
|
4602
|
+
function ca(e) {
|
|
4603
|
+
if (!e.head || e.head.querySelector(`style[${oa}]`)) return;
|
|
4599
4604
|
let t = e.createElement("style");
|
|
4600
|
-
t.setAttribute(
|
|
4605
|
+
t.setAttribute(oa, ""), t.textContent = sa, e.head.appendChild(t);
|
|
4601
4606
|
}
|
|
4602
|
-
function
|
|
4607
|
+
function la(e, t) {
|
|
4603
4608
|
let n = {
|
|
4604
4609
|
password: e.password,
|
|
4605
4610
|
useGoogleFonts: e.useGoogleFonts,
|
|
@@ -4623,24 +4628,24 @@ function ca(e, t) {
|
|
|
4623
4628
|
legacyXls: e.legacyXls
|
|
4624
4629
|
};
|
|
4625
4630
|
}
|
|
4626
|
-
function
|
|
4631
|
+
function ua(e, t, n) {
|
|
4627
4632
|
let r = e ?? t;
|
|
4628
4633
|
if (!Number.isSafeInteger(r) || r < 0) throw TypeError(`${n} must be a non-negative safe integer`);
|
|
4629
4634
|
return r;
|
|
4630
4635
|
}
|
|
4631
|
-
function
|
|
4636
|
+
function da(e) {
|
|
4632
4637
|
return {
|
|
4633
|
-
minRows:
|
|
4634
|
-
minCols:
|
|
4635
|
-
marginRows:
|
|
4636
|
-
marginCols:
|
|
4638
|
+
minRows: ua(e.minRows, Fn.minRows, "minRows"),
|
|
4639
|
+
minCols: ua(e.minCols, Fn.minCols, "minCols"),
|
|
4640
|
+
marginRows: ua(e.marginRows, 30, "marginRows"),
|
|
4641
|
+
marginCols: ua(e.marginCols, 10, "marginCols")
|
|
4637
4642
|
};
|
|
4638
4643
|
}
|
|
4639
|
-
var
|
|
4644
|
+
var fa = class {
|
|
4640
4645
|
container;
|
|
4641
4646
|
hostDocument;
|
|
4642
4647
|
hostWindow;
|
|
4643
|
-
acquisition = new
|
|
4648
|
+
acquisition = new Ji();
|
|
4644
4649
|
viewport;
|
|
4645
4650
|
renderDispatcher;
|
|
4646
4651
|
wrapper;
|
|
@@ -4648,7 +4653,7 @@ var da = class {
|
|
|
4648
4653
|
gridRegion;
|
|
4649
4654
|
outlineGutter;
|
|
4650
4655
|
viewEdits = new wr();
|
|
4651
|
-
projectionId =
|
|
4656
|
+
projectionId = aa++;
|
|
4652
4657
|
canvasArea;
|
|
4653
4658
|
scrollHost;
|
|
4654
4659
|
spacer;
|
|
@@ -4696,14 +4701,14 @@ var da = class {
|
|
|
4696
4701
|
}
|
|
4697
4702
|
_pendingZoomAnchor = null;
|
|
4698
4703
|
displayedViewport = null;
|
|
4699
|
-
selectionController = new
|
|
4704
|
+
selectionController = new Qi();
|
|
4700
4705
|
notifier;
|
|
4701
|
-
contextReader = new
|
|
4706
|
+
contextReader = new Li();
|
|
4702
4707
|
gridExtent;
|
|
4703
4708
|
elementContext = null;
|
|
4704
4709
|
selectionPaint;
|
|
4705
4710
|
finder;
|
|
4706
|
-
copier = new
|
|
4711
|
+
copier = new pi({
|
|
4707
4712
|
worksheet: () => this.currentWorksheet,
|
|
4708
4713
|
selection: () => this.selectionState,
|
|
4709
4714
|
workbook: () => this.wb,
|
|
@@ -4717,14 +4722,14 @@ var da = class {
|
|
|
4717
4722
|
this.container = e, this.hostDocument = (n.kind === "sheet" ? n.canvas.ownerDocument : e.ownerDocument) ?? document;
|
|
4718
4723
|
let r = this.hostDocument.defaultView;
|
|
4719
4724
|
if (!r) throw Error("XlsxViewer requires a document with an active Window");
|
|
4720
|
-
this.hostWindow = r, this.opts = t, this.gridExtent =
|
|
4721
|
-
let i = t[
|
|
4722
|
-
this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode :
|
|
4725
|
+
this.hostWindow = r, this.opts = t, this.gridExtent = da(t), this._mountKind = n.kind, this._nativeScrollbars = t.showScrollbars ?? !0;
|
|
4726
|
+
let i = t[ta];
|
|
4727
|
+
this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode : Me("XlsxViewer", t.mode, i), this._hiddenSheetMode = t.hiddenSheetMode ?? "show", this.viewport = new Xi(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 Zi(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 $i(this.canvas, this.canvasArea, this.scrollHost), this.overlayHost = new ea(this.canvasArea, this.canvas, this.scrollHost, {
|
|
4723
4728
|
commentMaxWidth: 280,
|
|
4724
4729
|
commentMaxHeight: 200,
|
|
4725
|
-
validationMaxWidth:
|
|
4726
|
-
validationMaxHeight:
|
|
4727
|
-
}), this.notifier = new
|
|
4730
|
+
validationMaxWidth: ra,
|
|
4731
|
+
validationMaxHeight: ia
|
|
4732
|
+
}), this.notifier = new Ai({
|
|
4728
4733
|
hostWindow: this.hostWindow,
|
|
4729
4734
|
isDestroyed: () => this._destroyed,
|
|
4730
4735
|
selectionState: () => this.selectionState,
|
|
@@ -4733,7 +4738,7 @@ var da = class {
|
|
|
4733
4738
|
readContext: (e) => this.getSelectionContext({ maxTextCharacters: e }),
|
|
4734
4739
|
emitSelectionChange: () => this.emitSelectionChange(),
|
|
4735
4740
|
scheduleSelectionContextNotification: () => this.scheduleSelectionContextNotification()
|
|
4736
|
-
}), this.selectionPaint = new
|
|
4741
|
+
}), this.selectionPaint = new Di({
|
|
4737
4742
|
ownerDocument: this.hostDocument,
|
|
4738
4743
|
canvasArea: this.canvasArea,
|
|
4739
4744
|
overlayHost: this.overlayHost,
|
|
@@ -4748,7 +4753,7 @@ var da = class {
|
|
|
4748
4753
|
cellRect: (e, t) => this._cellRect(e, t),
|
|
4749
4754
|
screenX: (e, t) => this.screenX(e, t),
|
|
4750
4755
|
drawValidationDropdown: () => this.validation.drawDropdown()
|
|
4751
|
-
}), this.comments = new
|
|
4756
|
+
}), this.comments = new qi({
|
|
4752
4757
|
ownerDocument: this.hostDocument,
|
|
4753
4758
|
canvasArea: this.canvasArea,
|
|
4754
4759
|
overlayHost: this.overlayHost,
|
|
@@ -4758,7 +4763,7 @@ var da = class {
|
|
|
4758
4763
|
cellRect: (e, t) => this._cellRect(e, t),
|
|
4759
4764
|
screenX: (e, t) => this.screenX(e, t),
|
|
4760
4765
|
reportError: (e) => this._reportRenderError(e)
|
|
4761
|
-
}), this.hyperlinks = new
|
|
4766
|
+
}), this.hyperlinks = new ii({
|
|
4762
4767
|
hostWindow: this.hostWindow,
|
|
4763
4768
|
enabled: () => this.opts.enableHyperlinks !== !1,
|
|
4764
4769
|
onHyperlinkClick: () => this.opts.onHyperlinkClick,
|
|
@@ -4768,7 +4773,7 @@ var da = class {
|
|
|
4768
4773
|
goToSheet: (e) => this.goToSheet(e),
|
|
4769
4774
|
scrollToCell: (e) => this.scrollToCell(e),
|
|
4770
4775
|
reportError: (e) => this._reportRenderError(e)
|
|
4771
|
-
}), this.validation = new
|
|
4776
|
+
}), this.validation = new Qr({
|
|
4772
4777
|
ownerDocument: this.hostDocument,
|
|
4773
4778
|
canvasArea: this.canvasArea,
|
|
4774
4779
|
surface: this.surface,
|
|
@@ -4795,17 +4800,17 @@ var da = class {
|
|
|
4795
4800
|
setBandHidden: (e, t, n) => this.setBandHidden(e, t, n),
|
|
4796
4801
|
setBandCollapsed: (e, t, n) => this.setBandCollapsed(e, t, n),
|
|
4797
4802
|
afterOutlineMutation: (e, t) => this.afterOutlineMutation(e, t)
|
|
4798
|
-
}),
|
|
4803
|
+
}), ca(this.hostDocument), n.kind === "composite" && (this.sheetTabs = new Gr(this.hostDocument, {
|
|
4799
4804
|
hiddenSheetMode: () => this._hiddenSheetMode,
|
|
4800
4805
|
isHidden: (e) => !!this.wb?.isHidden(e),
|
|
4801
4806
|
selectSheet: (e) => {
|
|
4802
4807
|
this.goToSheet(e).catch((e) => this._reportRenderError(e));
|
|
4803
4808
|
}
|
|
4804
|
-
}), this.opts.showZoomSlider !== !1 && (this.zoomControl = new
|
|
4809
|
+
}), this.opts.showZoomSlider !== !1 && (this.zoomControl = new Yr(this.hostDocument, {
|
|
4805
4810
|
setScale: (e) => this.setScale(e),
|
|
4806
4811
|
zoomIn: () => this.zoomIn(),
|
|
4807
4812
|
zoomOut: () => this.zoomOut()
|
|
4808
|
-
}, 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
|
|
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 Bi({
|
|
4809
4814
|
hostWindow: this.hostWindow,
|
|
4810
4815
|
container: this.container,
|
|
4811
4816
|
wrapper: this.wrapper,
|
|
@@ -4827,7 +4832,7 @@ var da = class {
|
|
|
4827
4832
|
};
|
|
4828
4833
|
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();
|
|
4829
4834
|
});
|
|
4830
|
-
a.observe(this.gridRegion), this.resizeObserver = a, this.selectionInput = new
|
|
4835
|
+
a.observe(this.gridRegion), this.resizeObserver = a, this.selectionInput = new Si({
|
|
4831
4836
|
surface: this.surface,
|
|
4832
4837
|
scrollHost: this.scrollHost,
|
|
4833
4838
|
canvasArea: this.canvasArea,
|
|
@@ -4881,7 +4886,7 @@ var da = class {
|
|
|
4881
4886
|
updateSpacerSize: (e) => this.updateSpacerSize(e),
|
|
4882
4887
|
refitAutoRowsAfterColumnResize: () => this.refitAutoRowsAfterColumnResize(),
|
|
4883
4888
|
reportError: (e) => this._reportRenderError(e)
|
|
4884
|
-
}), this.selectionInput.install(), this.finder = new
|
|
4889
|
+
}), this.selectionInput.install(), this.finder = new li({
|
|
4885
4890
|
ownerDocument: this.hostDocument,
|
|
4886
4891
|
overlayHost: this.overlayHost,
|
|
4887
4892
|
workbook: () => this.wb,
|
|
@@ -4896,10 +4901,10 @@ var da = class {
|
|
|
4896
4901
|
scrollCellIntoView: (e, t) => this._scrollCellIntoView(e, t)
|
|
4897
4902
|
}), i && (this.acquisition.install(i, !1), this._mountKind === "composite" && this.activateWorkbook(i).catch((e) => this._reportRenderError(e)));
|
|
4898
4903
|
}
|
|
4899
|
-
async [
|
|
4904
|
+
async [na](e, t = {}) {
|
|
4900
4905
|
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.`);
|
|
4901
4906
|
try {
|
|
4902
|
-
let n = await this.acquisition.replace(() => Un[Hn](e,
|
|
4907
|
+
let n = await this.acquisition.replace(() => Un[Hn](e, la(this.opts, this._mode), t), () => {
|
|
4903
4908
|
this.sheetRequestGeneration++, this.renderDispatcher.begin(), this.finder.invalidate(), this.hideValidationPanel(), this.releaseHostFonts();
|
|
4904
4909
|
});
|
|
4905
4910
|
if (!n) return;
|
|
@@ -4951,13 +4956,13 @@ var da = class {
|
|
|
4951
4956
|
i = u.worksheet, a = u.release;
|
|
4952
4957
|
let d = () => this.isCurrentSheetRequest(t, n) ? !1 : (a?.(), a = void 0, !0);
|
|
4953
4958
|
if (d()) return;
|
|
4954
|
-
let f = u.partial, p = this.sheetViews.get(e), m = this.initialAnchorReferenceFor(n, e), h = m === void 0 ?
|
|
4959
|
+
let f = u.partial, p = this.sheetViews.get(e), m = this.initialAnchorReferenceFor(n, e), h = m === void 0 ? Ke(i) : void 0, g = h !== void 0;
|
|
4955
4960
|
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.`);
|
|
4956
4961
|
let _ = (t) => {
|
|
4957
4962
|
let n = t.parseError || p?.parseError ? void 0 : p, r = n ?? this.createVisibleSheetView(t);
|
|
4958
|
-
return (n || u.partial) && (r.rows = t.rows), n || (m && !t.parseError &&
|
|
4963
|
+
return (n || u.partial) && (r.rows = t.rows), n || (m && !t.parseError && Be(r, m), this.viewEdits.restoreSheetViewState(e, r)), r;
|
|
4959
4964
|
}, v = (r, i) => {
|
|
4960
|
-
i &&
|
|
4965
|
+
i && st(r);
|
|
4961
4966
|
let a = n[Bn];
|
|
4962
4967
|
if (typeof a == "function") {
|
|
4963
4968
|
let e = this.hostDocument.createElement("canvas").getContext("2d");
|
|
@@ -4966,8 +4971,8 @@ var da = class {
|
|
|
4966
4971
|
this.isCurrentSheetRequest(t, n) && this.viewEdits.syncAutomaticRowOverrides(e, r);
|
|
4967
4972
|
}, y = (e) => {
|
|
4968
4973
|
if (!g || e.parseError || !this.isCurrentSheetRequest(t, n)) return;
|
|
4969
|
-
let r =
|
|
4970
|
-
return r &&
|
|
4974
|
+
let r = ze(e, H(e), this.viewport.scale) ?? null;
|
|
4975
|
+
return r && Be(e, r), r;
|
|
4971
4976
|
};
|
|
4972
4977
|
if (r = _(i), u.partial) {
|
|
4973
4978
|
let e = {
|
|
@@ -4976,7 +4981,7 @@ var da = class {
|
|
|
4976
4981
|
scale: this.viewport.scale
|
|
4977
4982
|
};
|
|
4978
4983
|
s = e;
|
|
4979
|
-
let t = () =>
|
|
4984
|
+
let t = () => H(r).visibleRange({
|
|
4980
4985
|
width: e.width,
|
|
4981
4986
|
height: e.height,
|
|
4982
4987
|
scale: e.scale,
|
|
@@ -5008,11 +5013,11 @@ var da = class {
|
|
|
5008
5013
|
} else v(r, !1), c = y(r);
|
|
5009
5014
|
o = f ? u.completion : null;
|
|
5010
5015
|
} catch (e) {
|
|
5011
|
-
if (a?.(), c &&
|
|
5016
|
+
if (a?.(), c && at(c), !this.isCurrentSheetRequest(t, n)) return;
|
|
5012
5017
|
throw await this.restoreDisplayedWorksheetLease(n, t), e;
|
|
5013
5018
|
}
|
|
5014
5019
|
if (!this.isCurrentSheetRequest(t, n)) {
|
|
5015
|
-
a?.(), c &&
|
|
5020
|
+
a?.(), c && at(c);
|
|
5016
5021
|
return;
|
|
5017
5022
|
}
|
|
5018
5023
|
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) => {
|
|
@@ -5021,13 +5026,13 @@ var da = class {
|
|
|
5021
5026
|
let a = !!i.parseError;
|
|
5022
5027
|
this.selectionInput.clearSheetGestures();
|
|
5023
5028
|
let o = this.createVisibleSheetView(i), s = a ? void 0 : this.initialAnchorReferenceFor(n, e);
|
|
5024
|
-
if (s &&
|
|
5029
|
+
if (s && Be(o, s), this.viewEdits.restoreSheetViewState(e, o), this.displayedViewport = null, this.currentWorksheet = o, this.sheetViews.set(e, o), a) {
|
|
5025
5030
|
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();
|
|
5026
5031
|
return;
|
|
5027
5032
|
}
|
|
5028
|
-
|
|
5033
|
+
nt(r), st(r);
|
|
5029
5034
|
let c = this.hostDocument.createElement("canvas").getContext("2d");
|
|
5030
|
-
c && (n[Bn](o, c), this.currentAutoRowHeightsPrepared = !0), this.viewEdits.syncAutomaticRowOverrides(e, o), this.currentSourceComments = i.comments ?? [], this.sourceCommentMap =
|
|
5035
|
+
c && (n[Bn](o, c), this.currentAutoRowHeightsPrepared = !0), this.viewEdits.syncAutomaticRowOverrides(e, o), this.currentSourceComments = i.comments ?? [], this.sourceCommentMap = Ki(this.currentSourceComments), this.buildCommentMap(o), this.buildHyperlinkMap(o), this.buildOutline(o), this.layoutGutters(), this.updateSpacerSize(o), this.scheduleRender(), this.scheduleSelectionContextNotification();
|
|
5031
5036
|
}).catch((e) => {
|
|
5032
5037
|
if (!(!this.isCurrentSheetRequest(t, n) || this.currentWorksheet !== r)) {
|
|
5033
5038
|
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") {
|
|
@@ -5038,7 +5043,7 @@ var da = class {
|
|
|
5038
5043
|
} else this.canvas.getContext("2d")?.clearRect?.(0, 0, this.canvas.width, this.canvas.height);
|
|
5039
5044
|
this._reportRenderError(e);
|
|
5040
5045
|
}
|
|
5041
|
-
}), this.currentSourceComments = i.comments ?? [], this.opts.comments !== !1 && this.currentSourceComments.length > 0 && this.comments.loadUi().catch((e) => this._reportRenderError(e)), this.sourceCommentMap =
|
|
5046
|
+
}), this.currentSourceComments = i.comments ?? [], this.opts.comments !== !1 && this.currentSourceComments.length > 0 && this.comments.loadUi().catch((e) => this._reportRenderError(e)), this.sourceCommentMap = Ki(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();
|
|
5042
5047
|
let u = this.committedFrameCount;
|
|
5043
5048
|
await this.renderCurrentSheet();
|
|
5044
5049
|
let d = this.committedFrameCount > u;
|
|
@@ -5058,7 +5063,7 @@ var da = class {
|
|
|
5058
5063
|
this.initialAnchorWorkbook !== e && (this.releaseInitialAnchorReferences(), this.initialAnchorWorkbook = e), this.initialAnchorReferences.has(t) || this.initialAnchorReferences.set(t, n);
|
|
5059
5064
|
}
|
|
5060
5065
|
releaseInitialAnchorReferences() {
|
|
5061
|
-
for (let e of this.initialAnchorReferences.values()) e &&
|
|
5066
|
+
for (let e of this.initialAnchorReferences.values()) e && at(e);
|
|
5062
5067
|
this.initialAnchorReferences.clear(), this.initialAnchorWorkbook = null;
|
|
5063
5068
|
}
|
|
5064
5069
|
async restoreDisplayedWorksheetLease(e, t) {
|
|
@@ -5078,7 +5083,7 @@ var da = class {
|
|
|
5078
5083
|
scrollOutlineSummaryToStart(e, t) {
|
|
5079
5084
|
let n = this.currentWorksheet;
|
|
5080
5085
|
if (!n) return;
|
|
5081
|
-
let r = this.viewport.scale, i =
|
|
5086
|
+
let r = this.viewport.scale, i = H(n).scrollOffsetForCell(e === "row" ? t : 1, e === "col" ? t : 1, {
|
|
5082
5087
|
scale: r,
|
|
5083
5088
|
viewportWidth: this.canvasArea.clientWidth,
|
|
5084
5089
|
viewportHeight: this.canvasArea.clientHeight,
|
|
@@ -5106,7 +5111,7 @@ var da = class {
|
|
|
5106
5111
|
r && this.viewEdits.setBandCollapsed(r, this.currentSheet, e, t, n);
|
|
5107
5112
|
}
|
|
5108
5113
|
afterOutlineMutation(e, t) {
|
|
5109
|
-
|
|
5114
|
+
q.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();
|
|
5110
5115
|
}
|
|
5111
5116
|
get isRtl() {
|
|
5112
5117
|
return this.currentWorksheet?.rightToLeft === !0;
|
|
@@ -5141,7 +5146,7 @@ var da = class {
|
|
|
5141
5146
|
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);
|
|
5142
5147
|
}
|
|
5143
5148
|
screenX(e, t) {
|
|
5144
|
-
return this.isRtl ?
|
|
5149
|
+
return this.isRtl ? _t(e, t, this.canvasArea.clientWidth) : e;
|
|
5145
5150
|
}
|
|
5146
5151
|
resetHorizontalScroll() {
|
|
5147
5152
|
this.viewport.setOffset(0, this.viewport.y), this._nativeScrollbars && (this.scrollHost.scrollLeft = this.isRtl ? this.maxScrollLeft : 0);
|
|
@@ -5195,14 +5200,14 @@ var da = class {
|
|
|
5195
5200
|
this.reanchorHorizontalScroll(), this.layoutGutters(), this.currentWorksheet && this.updateSpacerSize(this.currentWorksheet), await this.renderCurrentSheet(), this.updateSelectionOverlay(), this.updateFindOverlay();
|
|
5196
5201
|
}
|
|
5197
5202
|
async scrollToCell(e, t = {}) {
|
|
5198
|
-
let n =
|
|
5203
|
+
let n = z(e);
|
|
5199
5204
|
!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());
|
|
5200
5205
|
}
|
|
5201
5206
|
_stepSheet(e) {
|
|
5202
|
-
return this._hiddenSheetMode === "skip" && this.wb ?
|
|
5207
|
+
return this._hiddenSheetMode === "skip" && this.wb ? Lt(this.currentSheet, e, (e) => this.wb.isHidden(e), this.sheetCount) : this.currentSheet + e;
|
|
5203
5208
|
}
|
|
5204
5209
|
_initialSheet() {
|
|
5205
|
-
return this._hiddenSheetMode === "skip" && this.wb ?
|
|
5210
|
+
return this._hiddenSheetMode === "skip" && this.wb ? Rt(0, (e) => this.wb.isHidden(e), this.sheetCount) : 0;
|
|
5206
5211
|
}
|
|
5207
5212
|
displayedViewportOffset() {
|
|
5208
5213
|
let e = this.displayedViewport;
|
|
@@ -5224,7 +5229,7 @@ var da = class {
|
|
|
5224
5229
|
x: this.effectiveScrollLeft,
|
|
5225
5230
|
y: this.viewportTop
|
|
5226
5231
|
} : this.displayedViewportOffset();
|
|
5227
|
-
return
|
|
5232
|
+
return H(r).cellAt(u, d, {
|
|
5228
5233
|
scrollX: f.x,
|
|
5229
5234
|
scrollY: f.y,
|
|
5230
5235
|
scale: i
|
|
@@ -5235,7 +5240,7 @@ var da = class {
|
|
|
5235
5240
|
if (!e) return null;
|
|
5236
5241
|
let t = this.canvasArea.clientWidth, n = this.canvasArea.clientHeight;
|
|
5237
5242
|
if (t <= 0 || n <= 0) return null;
|
|
5238
|
-
let r = this.viewport.scale, i =
|
|
5243
|
+
let r = this.viewport.scale, i = H(e).visibleRange({
|
|
5239
5244
|
width: t,
|
|
5240
5245
|
height: n,
|
|
5241
5246
|
scale: r,
|
|
@@ -5270,7 +5275,7 @@ var da = class {
|
|
|
5270
5275
|
let n = this.currentWorksheet;
|
|
5271
5276
|
if (!n) return null;
|
|
5272
5277
|
let r = this.viewport.scale;
|
|
5273
|
-
return
|
|
5278
|
+
return H(n).cellRect(e, t, {
|
|
5274
5279
|
scale: r,
|
|
5275
5280
|
scrollX: this.displayedViewportOffset().x,
|
|
5276
5281
|
scrollY: this.displayedViewportOffset().y,
|
|
@@ -5280,7 +5285,7 @@ var da = class {
|
|
|
5280
5285
|
}
|
|
5281
5286
|
getCellViewportRect(e) {
|
|
5282
5287
|
if (this._destroyed) return null;
|
|
5283
|
-
let t = typeof e == "string" ?
|
|
5288
|
+
let t = typeof e == "string" ? z(e) : e;
|
|
5284
5289
|
if (!t || t.row < 1 || t.col < 1) return null;
|
|
5285
5290
|
let n = this._cellRect(t.row, t.col);
|
|
5286
5291
|
return n ? Object.freeze({
|
|
@@ -5294,12 +5299,12 @@ var da = class {
|
|
|
5294
5299
|
return this.assertOpen(), structuredClone(this.currentSourceComments);
|
|
5295
5300
|
}
|
|
5296
5301
|
async goToComment(e, t, n) {
|
|
5297
|
-
let r =
|
|
5302
|
+
let r = z(t), i = this.wb;
|
|
5298
5303
|
if (!r || !i || !Number.isInteger(e) || e < 0 || e >= i.sheetCount) return !1;
|
|
5299
5304
|
let a = ++this.commentNavigationGeneration, o = e === this.currentSheet && this.currentWorksheet !== null ? this.currentSourceComments : await i.getComments(e);
|
|
5300
5305
|
if (this._destroyed) throw this.destroyedError();
|
|
5301
5306
|
if (a !== this.commentNavigationGeneration || i !== this.wb || !o.some((e) => {
|
|
5302
|
-
let t =
|
|
5307
|
+
let t = z(e.cellRef);
|
|
5303
5308
|
return t?.row === r.row && t.col === r.col;
|
|
5304
5309
|
})) return !1;
|
|
5305
5310
|
if (e !== this.currentSheet || this.currentWorksheet === null) {
|
|
@@ -5344,7 +5349,7 @@ var da = class {
|
|
|
5344
5349
|
refitAutoRowsAfterColumnResize() {
|
|
5345
5350
|
let e = this.currentWorksheet, t = this.preparedWorkbook;
|
|
5346
5351
|
if (!e || !t) return;
|
|
5347
|
-
|
|
5352
|
+
st(e, this.viewEdits.manualRows(this.currentSheet));
|
|
5348
5353
|
let n = t[Bn];
|
|
5349
5354
|
if (typeof n != "function") return;
|
|
5350
5355
|
let r = this.hostDocument.createElement("canvas").getContext("2d");
|
|
@@ -5354,7 +5359,7 @@ var da = class {
|
|
|
5354
5359
|
this.opts.selectionColor = e, this.updateSelectionOverlay();
|
|
5355
5360
|
}
|
|
5356
5361
|
async setHiddenSheetMode(e) {
|
|
5357
|
-
this._hiddenSheetMode = e, this.buildTabs(), e === "skip" && this.wb && this.wb.isHidden(this.currentSheet) ? await this.showSheet(
|
|
5362
|
+
this._hiddenSheetMode = e, this.buildTabs(), e === "skip" && this.wb && this.wb.isHidden(this.currentSheet) ? await this.showSheet(Rt(this.currentSheet, (e) => this.wb.isHidden(e), this.sheetCount)) : this.updateTabActive(this.currentSheet);
|
|
5358
5363
|
}
|
|
5359
5364
|
get hiddenSheetMode() {
|
|
5360
5365
|
return this._hiddenSheetMode;
|
|
@@ -5362,7 +5367,7 @@ var da = class {
|
|
|
5362
5367
|
get visibleSheetCount() {
|
|
5363
5368
|
if (!this.wb) return 0;
|
|
5364
5369
|
let e = this.wb;
|
|
5365
|
-
return
|
|
5370
|
+
return zt((t) => e.isHidden(t), this.sheetCount);
|
|
5366
5371
|
}
|
|
5367
5372
|
async copySelection() {
|
|
5368
5373
|
return this.assertOpen(), this.previewCompletion && await this.previewCompletion, this.copier.copy();
|
|
@@ -5388,7 +5393,7 @@ var da = class {
|
|
|
5388
5393
|
_scrollCellIntoView(e, t, n = "nearest") {
|
|
5389
5394
|
let r = this.currentWorksheet;
|
|
5390
5395
|
if (!r) return;
|
|
5391
|
-
let i = this.viewport.scale, a =
|
|
5396
|
+
let i = this.viewport.scale, a = H(r).scrollOffsetForCell(e, t, {
|
|
5392
5397
|
scale: i,
|
|
5393
5398
|
viewportWidth: this.canvasArea.clientWidth,
|
|
5394
5399
|
viewportHeight: this.canvasArea.clientHeight,
|
|
@@ -5407,14 +5412,14 @@ var da = class {
|
|
|
5407
5412
|
this.comments.setComments(e.comments ?? []);
|
|
5408
5413
|
}
|
|
5409
5414
|
createVisibleSheetView(e) {
|
|
5410
|
-
let t =
|
|
5415
|
+
let t = Yi(e);
|
|
5411
5416
|
if (this.opts.comments === !1) {
|
|
5412
5417
|
let e = {
|
|
5413
5418
|
...t,
|
|
5414
5419
|
commentRefs: [],
|
|
5415
5420
|
comments: []
|
|
5416
5421
|
};
|
|
5417
|
-
return
|
|
5422
|
+
return B(t, e), Ln(t, e), Ft(t, e), e;
|
|
5418
5423
|
}
|
|
5419
5424
|
if ((typeof this.opts.comments == "object" ? this.opts.comments : void 0)?.includeResolved !== !1) return t;
|
|
5420
5425
|
let n = new Set((t.comments ?? []).filter((e) => e.resolved === !0).map((e) => e.cellRef));
|
|
@@ -5424,7 +5429,7 @@ var da = class {
|
|
|
5424
5429
|
commentRefs: t.commentRefs?.filter((e) => !n.has(e)),
|
|
5425
5430
|
comments: t.comments?.filter((e) => !n.has(e.cellRef))
|
|
5426
5431
|
};
|
|
5427
|
-
return
|
|
5432
|
+
return B(t, r), Ln(t, r), Ft(t, r), r;
|
|
5428
5433
|
}
|
|
5429
5434
|
buildHyperlinkMap(e) {
|
|
5430
5435
|
this.hyperlinks.build(e);
|
|
@@ -5444,8 +5449,8 @@ var da = class {
|
|
|
5444
5449
|
if (this.viewport.setScale(i), this.zoomControl?.sync(i, r, t, n), this.currentWorksheet) {
|
|
5445
5450
|
let e = this.effectiveScrollLeft, t = this.viewportTop;
|
|
5446
5451
|
if (this.layoutGutters(), this.updateSpacerSize(this.currentWorksheet), o) {
|
|
5447
|
-
this.viewportTop =
|
|
5448
|
-
let n = this.screenX(o.x, 0), r = this.maxScrollLeft, s =
|
|
5452
|
+
this.viewportTop = ye(t, o.y, a, i, { maxScroll: this.maxScrollTop });
|
|
5453
|
+
let n = this.screenX(o.x, 0), r = this.maxScrollLeft, s = ye(e, n, a, i, { maxScroll: r });
|
|
5449
5454
|
this.setViewportLeft(s);
|
|
5450
5455
|
} else this.setViewportLeft(e);
|
|
5451
5456
|
}
|
|
@@ -5456,10 +5461,10 @@ var da = class {
|
|
|
5456
5461
|
return this.viewport.scale;
|
|
5457
5462
|
}
|
|
5458
5463
|
zoomIn() {
|
|
5459
|
-
this.setScale(
|
|
5464
|
+
this.setScale(Ce(this.getScale()));
|
|
5460
5465
|
}
|
|
5461
5466
|
zoomOut() {
|
|
5462
|
-
this.setScale(
|
|
5467
|
+
this.setScale(Pe(this.getScale()));
|
|
5463
5468
|
}
|
|
5464
5469
|
fitWidth() {
|
|
5465
5470
|
this._fit("width");
|
|
@@ -5470,7 +5475,7 @@ var da = class {
|
|
|
5470
5475
|
_fit(e) {
|
|
5471
5476
|
let t = this.currentWorksheet;
|
|
5472
5477
|
if (!t) return;
|
|
5473
|
-
let { width: n, height: r } = this._naturalContentExtent(t), i =
|
|
5478
|
+
let { width: n, height: r } = this._naturalContentExtent(t), i = Fe({
|
|
5474
5479
|
contentWidth: n,
|
|
5475
5480
|
contentHeight: r,
|
|
5476
5481
|
containerWidth: this.canvasArea.clientWidth,
|
|
@@ -5480,12 +5485,12 @@ var da = class {
|
|
|
5480
5485
|
}
|
|
5481
5486
|
_naturalContentExtent(e) {
|
|
5482
5487
|
let { maxRow: t, maxCol: n } = Rn(e, this.gridExtent);
|
|
5483
|
-
return
|
|
5488
|
+
return H(e).logicalContentExtent(t, n, 50, 22);
|
|
5484
5489
|
}
|
|
5485
5490
|
updateSpacerSize(e) {
|
|
5486
5491
|
let t = this.viewport.scale, { maxRow: n, maxCol: r } = Rn(e, this.gridExtent);
|
|
5487
5492
|
n += this.gridExtent.marginRows, r += this.gridExtent.marginCols;
|
|
5488
|
-
let i =
|
|
5493
|
+
let i = H(e).roundedContentExtent(n, r, t, 50, 22), a = i.width, o = i.height;
|
|
5489
5494
|
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;
|
|
5490
5495
|
}
|
|
5491
5496
|
scheduleRender(e = !1) {
|
|
@@ -5516,7 +5521,7 @@ var da = class {
|
|
|
5516
5521
|
}
|
|
5517
5522
|
let t = this.currentWorksheet, n = this.canvasArea.clientWidth, r = this.canvasArea.clientHeight;
|
|
5518
5523
|
if (n <= 0 || r <= 0) return;
|
|
5519
|
-
let i = this.viewport.scale, a = this.surface.dpr, o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = this.effectiveScrollLeft, l = this.viewportTop, u =
|
|
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 = H(t).visibleRange({
|
|
5520
5525
|
width: n,
|
|
5521
5526
|
height: r,
|
|
5522
5527
|
scale: i,
|
|
@@ -5546,7 +5551,7 @@ var da = class {
|
|
|
5546
5551
|
} : void 0, b = Dn(_ ? {
|
|
5547
5552
|
...g,
|
|
5548
5553
|
sizeOverrides: _.overrides
|
|
5549
|
-
} : g,
|
|
5554
|
+
} : g, H(t).maximumDigitWidth, {
|
|
5550
5555
|
worksheet: t,
|
|
5551
5556
|
projection: y
|
|
5552
5557
|
});
|
|
@@ -5561,7 +5566,7 @@ var da = class {
|
|
|
5561
5566
|
width: n,
|
|
5562
5567
|
height: r
|
|
5563
5568
|
}, this.updateSelectionOverlay(), this.updateFindOverlay(), this._lastViewportNotification && this.emitViewportChange();
|
|
5564
|
-
} else if (await this.workbook.renderViewport(this.canvas, this.currentSheet, d,
|
|
5569
|
+
} else if (await this.workbook.renderViewport(this.canvas, this.currentSheet, d, $t(b, () => !this._destroyed && this.renderDispatcher.isCurrent(e))), !this.renderDispatcher.isCurrent(e) || this._destroyed) return;
|
|
5565
5570
|
this.renderGutters(), this.firstPreviewRender = !1, this.committedFrameCount++;
|
|
5566
5571
|
}
|
|
5567
5572
|
computeHeaderHighlight() {
|
|
@@ -5589,20 +5594,20 @@ var da = class {
|
|
|
5589
5594
|
destroyedError() {
|
|
5590
5595
|
return /* @__PURE__ */ Error(this._mountKind === "sheet" ? "XlsxSheetViewer is destroyed" : "XlsxViewer is destroyed");
|
|
5591
5596
|
}
|
|
5592
|
-
},
|
|
5597
|
+
}, pa = class e extends fa {
|
|
5593
5598
|
static fromWorkbook(t, n, r = {}) {
|
|
5594
5599
|
return new e(t, {
|
|
5595
5600
|
...r,
|
|
5596
|
-
[
|
|
5601
|
+
[ta]: n
|
|
5597
5602
|
});
|
|
5598
5603
|
}
|
|
5599
5604
|
constructor(e, t = {}) {
|
|
5600
5605
|
super(e, t, { kind: "composite" });
|
|
5601
5606
|
}
|
|
5602
5607
|
async load(e) {
|
|
5603
|
-
await this[
|
|
5608
|
+
await this[na](e);
|
|
5604
5609
|
}
|
|
5605
|
-
},
|
|
5610
|
+
}, ma = class e {
|
|
5606
5611
|
canvasElement;
|
|
5607
5612
|
engine;
|
|
5608
5613
|
canvasMount;
|
|
@@ -5612,16 +5617,16 @@ var da = class {
|
|
|
5612
5617
|
static fromWorkbook(t, n, r = {}) {
|
|
5613
5618
|
return new e(t, {
|
|
5614
5619
|
...r,
|
|
5615
|
-
[
|
|
5620
|
+
[ta]: n
|
|
5616
5621
|
});
|
|
5617
5622
|
}
|
|
5618
5623
|
constructor(e, t = {}) {
|
|
5619
5624
|
this.canvasElement = e;
|
|
5620
|
-
let n = t[
|
|
5621
|
-
this.canvasMount = new
|
|
5625
|
+
let n = t[ta], r = Me("XlsxSheetViewer", t.mode, n), i = e.getBoundingClientRect();
|
|
5626
|
+
this.canvasMount = new je(e, {
|
|
5622
5627
|
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`};`,
|
|
5623
5628
|
restoreMode: "style-and-bitmap"
|
|
5624
|
-
}), this.engine = new
|
|
5629
|
+
}), this.engine = new fa(this.canvasMount.wrapper, {
|
|
5625
5630
|
...t,
|
|
5626
5631
|
onResourceMetrics: (e) => {
|
|
5627
5632
|
this.lastMetrics = e, t.onResourceMetrics?.(e);
|
|
@@ -5647,7 +5652,7 @@ var da = class {
|
|
|
5647
5652
|
async load(e, t = {}) {
|
|
5648
5653
|
this.assertOpen();
|
|
5649
5654
|
try {
|
|
5650
|
-
await this.engine[
|
|
5655
|
+
await this.engine[na](e, t);
|
|
5651
5656
|
} finally {
|
|
5652
5657
|
this.destroyed || this.captureSnapshot();
|
|
5653
5658
|
}
|
|
@@ -5789,21 +5794,21 @@ var da = class {
|
|
|
5789
5794
|
destroyedError() {
|
|
5790
5795
|
return /* @__PURE__ */ Error("XlsxSheetViewer is destroyed");
|
|
5791
5796
|
}
|
|
5792
|
-
},
|
|
5797
|
+
}, ha = /* @__PURE__ */ e({
|
|
5793
5798
|
MAX_SELECTION_AREAS: () => 128,
|
|
5794
5799
|
MAX_SELECTION_CONTEXT_CELLS: () => mr,
|
|
5795
5800
|
MAX_SELECTION_CONTEXT_TEXT_CHARACTERS: () => hr,
|
|
5796
|
-
OoxmlDecodedImageLimitError: () =>
|
|
5801
|
+
OoxmlDecodedImageLimitError: () => ce,
|
|
5797
5802
|
OoxmlError: () => h,
|
|
5798
5803
|
OoxmlResourceLimitError: () => _,
|
|
5799
|
-
TiffDecodeError: () =>
|
|
5800
|
-
XlsxSheetViewer: () =>
|
|
5801
|
-
XlsxViewer: () =>
|
|
5804
|
+
TiffDecodeError: () => he,
|
|
5805
|
+
XlsxSheetViewer: () => ma,
|
|
5806
|
+
XlsxViewer: () => pa,
|
|
5802
5807
|
XlsxWorkbook: () => Un,
|
|
5803
|
-
autoResize: () =>
|
|
5804
|
-
isOoxmlDecodedImageLimitError: () =>
|
|
5805
|
-
isTiffDecodeError: () =>
|
|
5806
|
-
openExternalHyperlink: () =>
|
|
5807
|
-
resolveSharedStrings: () =>
|
|
5808
|
+
autoResize: () => _e,
|
|
5809
|
+
isOoxmlDecodedImageLimitError: () => R,
|
|
5810
|
+
isTiffDecodeError: () => me,
|
|
5811
|
+
openExternalHyperlink: () => L,
|
|
5812
|
+
resolveSharedStrings: () => xt
|
|
5808
5813
|
});
|
|
5809
|
-
export { mr as a, On as c, pr as i, Dn as l,
|
|
5814
|
+
export { mr as a, On as c, pr as i, Dn as l, ma as n, hr as o, pa as r, Un as s, ha as t };
|