@pptx-editor.dev/pro 0.0.1-placeholder → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,84 @@
1
+ # EigenPal Pro Evaluation License 1.0
2
+
3
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
4
+
5
+ By copying, modifying, or using the Software, you agree to these terms.
6
+
7
+ ## 1. Covered Software
8
+
9
+ “Software” means all source code, object code, documentation, assets, and other materials contained in the “packages/pro/” directory of the EigenPal PPTX Editor repository, except for any material that expressly states that it is subject to a different license.
10
+
11
+ ## 2. Evaluation Permission; Modifications
12
+
13
+ Subject to these terms, Eigenpal, Inc. grants you a limited, non-exclusive, non-transferable, non-sublicensable, royalty-free license to:
14
+
15
+ 1. view, clone, and copy the Software;
16
+ 2. run the Software internally in a non-production environment solely to    evaluate its suitability for your intended application; and
17
+ 3. modify the Software solely as reasonably necessary for that internal,    non-production evaluation.
18
+
19
+ For any such modification, the following applies:
20
+
21
+ You may keep any modification to yourself. If you do not disclose it to Eigenpal, Inc. or to anyone else, it remains yours. If you disclose a modification to Eigenpal, Inc. or to any third party, in any form, you assign all right, title, and interest in it to Eigenpal, Inc. at the moment of disclosure. The same applies to any feedback you give Eigenpal, Inc. You will promptly send Eigenpal, Inc. the source code of any modification you disclose, and will sign any document needed to record the assignment. Disclosing a modification to a third party grants that third party no rights in it or in the Software. You will not license or purport to license any modification to anyone. You may continue using an assigned modification for the internal, non-production evaluation permitted by Section 2 for as long as this license is in effect. Eigenpal, Inc. is not obliged to use or support any modification or feedback, and owes you nothing for it. You confirm that any modification or feedback you disclose is yours to assign and is not subject to any license that would impose obligations on Eigenpal, Inc. or grant rights to any third party.
22
+
23
+ No other rights are granted.
24
+
25
+ ## 3. No Production Use
26
+
27
+ You may not use the Software for Production Use.
28
+
29
+ “Production Use” means any use of the Software:
30
+
31
+ 1. in a live, operational, or customer-facing environment;
32
+ 2. to provide, operate, support, or enhance a product or service for another    person or organization;
33
+ 3. to process live, customer, or business-operational data; or
34
+ 4. as part of your ordinary internal business operations, other than evaluation    and testing.
35
+
36
+ For the avoidance of doubt, Production Use includes embedding the Software in a product made available to others, offering the Software through a hosted or managed service, and using it in a customer pilot or paid proof of concept.
37
+
38
+ ## 4. No Distribution or Sublicensing
39
+
40
+ You may not sell, sublicense, distribute, publish, transfer, or otherwise make the Software or modifications to the Software available to any third party.
41
+
42
+ You may allow your employees and contractors to access the Software solely for your evaluation, provided they are bound by restrictions at least as protective as these terms. You are responsible for their compliance.
43
+
44
+ ## 5. Commercial Rights
45
+
46
+ Production Use and any rights not expressly granted by this license require a separate written commercial agreement signed by Eigenpal, Inc.
47
+
48
+ Commercial licenses are available by contacting licensing@eigenpal.com.
49
+
50
+ Access to the Software, correspondence with Eigenpal, Inc., or payment of an invoice does not by itself grant production or commercial rights unless those rights are set out in a written agreement signed by Eigenpal, Inc.
51
+
52
+ ## 6. Ownership
53
+
54
+ Eigenpal, Inc. and its licensors retain all rights, title, and interest in the Software. This license does not transfer ownership or grant any rights by implication.
55
+
56
+ Modifying the Software does not grant you the right to use the Software or those modifications in production.
57
+
58
+ ## 7. Termination
59
+
60
+ Your rights under this license terminate automatically if you breach these terms or if EigenPal terminates this license.
61
+
62
+ Following termination, you must stop using the Software and delete your copies and modifications, except for copies that you are legally required to retain. Eigenpal, Inc. may reinstate your rights in writing.
63
+
64
+ ## 8. No Warranty
65
+
66
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED “AS IS” AND WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT.
67
+
68
+ ## 9. Limitation of Liability
69
+
70
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, EIGENPAL, INC. AND ITS LICENSORS WILL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES, OR FOR ANY LOSS OF DATA, REVENUE, PROFITS, OR BUSINESS, ARISING FROM OR RELATING TO THE SOFTWARE OR THIS LICENSE. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE TOTAL AGGREGATE LIABILITY OF EIGENPAL, INC. AND ITS LICENSORS FOR ALL CLAIMS ARISING FROM OR RELATING TO THE SOFTWARE OR THIS LICENSE, WHETHER IN CONTRACT, TORT, STRICT LIABILITY, OR ANY OTHER THEORY, WILL NOT EXCEED TEN UNITED STATES DOLLARS (US$10). THE FOREGOING LIMITATIONS APPLY EVEN IF EIGENPAL, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND EVEN IF ANY LIMITED REMEDY IS FOUND TO HAVE FAILED OF ITS ESSENTIAL PURPOSE.
71
+
72
+ ## 10. Trademarks
73
+
74
+ This license does not grant permission to use the names, trademarks, service marks, or logos of Eigenpal, Inc., except to identify the origin of an unmodified copy of the Software.
75
+
76
+ ## 11. Governing Law and Jurisdiction
77
+
78
+ This license is governed by the laws of the State of California, without regard to its conflict-of-laws rules.
79
+
80
+ Any dispute arising from or relating to this license will be subject to the exclusive jurisdiction of the state and federal courts located in California, and you consent to their jurisdiction.
81
+
82
+ ## 12. Separate Commercial Agreements
83
+
84
+ If Eigenpal, Inc. and you enter into a separate written commercial agreement, that agreement controls to the extent it grants additional rights or conflicts with this license.
package/README.md CHANGED
@@ -1,5 +1,163 @@
1
+ <p align="center">
2
+ <a href="https://pptx-editor.dev/">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/eigenpal/pptx-editor/main/.github/assets/readme-logo-dark.svg" />
5
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/eigenpal/pptx-editor/main/.github/assets/readme-logo-light.svg" />
6
+ <img src="https://raw.githubusercontent.com/eigenpal/pptx-editor/main/.github/assets/readme-logo-light.svg" alt="PPTX Editor by EigenPal" width="320" height="90" />
7
+ </picture>
8
+ </a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@pptx-editor.dev/pro"><img src="https://img.shields.io/npm/v/@pptx-editor.dev/pro.svg?style=flat-square&color=C43E1C" alt="npm version" /></a>
13
+ <a href="https://www.npmjs.com/package/@pptx-editor.dev/pro"><img src="https://img.shields.io/npm/dm/@pptx-editor.dev/pro.svg?style=flat-square&color=C43E1C" alt="npm downloads" /></a>
14
+ <a href="https://github.com/eigenpal/pptx-editor/blob/main/packages/pro/LICENSE.md"><img src="https://img.shields.io/badge/license-EigenPal_Pro_License-blue.svg?style=flat-square&color=C43E1C" alt="EigenPal Pro License" /></a>
15
+ </p>
16
+
1
17
  # @pptx-editor.dev/pro
2
18
 
3
- Placeholder package reserving this name.
19
+ Commercial capabilities for PPTX Editor, delivered as `EditorModule`s, in the same shape as DOCX Editor's `@docx-editor.dev/pro`:
20
+
21
+ - `reviewModule()`: the review queue. It reads legacy comments (`p:cmLst`, ECMA-376 Part 1, 19.4) and their replies today.
22
+ - `collaborationModule({ session })`: attaches a host-created collaboration session to each opened deck.
23
+ - `createYjsCollaborationSession({ doc, documentId, identity, awareness })`: a session over a Y.Doc. It mirrors the deck into Yjs, as DOCX Editor does, so concurrent edits merge without a server sequencer.
24
+ - **History:** while the session is attached, the editor's undo and redo revert only your own changes (`Y.UndoManager`), never a peer's, and return to the slide and selection of the undone change.
25
+ - **Status:** `statusSnapshot()` and `subscribeStatus()` report the state and a typed `CollaborationFailureCode`, as in DOCX Editor. Call `setConnected()` from your provider's status event.
26
+ - **Concurrent edits:** two peers that add or replace an element that a slide, shape, or paragraph holds once end with one element, and the other peer's copy stays hidden in the room until the winner undoes. Property elements merge. Concurrent splits of one run keep its text once, and a node moved into content that a peer removes at once goes back. The `collaboration.realtime` row in `docs/site/data/pptx-features.ts` states what is supported and its limits. A room from a pre-release build (room format 1) refuses to attach.
27
+ - **Presence:** with a Yjs `awareness` (`y-protocols/awareness`), the editor publishes its selection, and the canvas shows each peer's selected shapes and text caret, with the peer's name and color. Your caret stays on its character while peers type before it.
28
+ - `drawingModule()` from `@pptx-editor.dev/pro/drawing`: paints the shape and picture effects glow, inner shadow, reflection, and soft edge (ECMA-376 Part 1, 20.1.8). The free engine paints outer shadows. Without the module, a shape or picture paints without these four effects, and the editor chrome does not offer them: Shape Effects shows only the outer shadows, and Picture Styles shows only the frame styles. Removing an effect needs no module: when the selection has a reflection, glow, or soft edge, Shape Effects offers its No row, and No shadow also removes an inner shadow. The effect commands still write every effect, and save keeps it. PDF export (`@pptx-editor.dev/pptx-to-pdf`) always includes the module. It also draws charts from the values cached in their chart parts (ECMA-376 Part 1, 21.2); see [Charts](#charts).
29
+
30
+ This package uses the EigenPal Pro License (`LICENSE.md`). Evaluation is permitted. Production use requires a commercial agreement.
31
+
32
+ For task guides and API details, see the [developer documentation](https://pptx-editor.dev/docs/pro).
33
+
34
+ ## Use
35
+
36
+ ```ts
37
+ import { createPptxEditor } from '@pptx-editor.dev/core';
38
+ import { collaborationModule, reviewModule } from '@pptx-editor.dev/pro';
39
+
40
+ const editor = createPptxEditor({
41
+ document: bytes,
42
+ modules: [reviewModule(), collaborationModule({ session })],
43
+ });
44
+ ```
45
+
46
+ ### Drawing effects
47
+
48
+ ```ts
49
+ import { createPptxEditor } from '@pptx-editor.dev/core';
50
+ import { drawingModule } from '@pptx-editor.dev/pro/drawing';
51
+
52
+ const editor = createPptxEditor({
53
+ document: bytes,
54
+ modules: [drawingModule({ licenseKey: import.meta.env.VITE_PPTX_LICENSE })],
55
+ });
56
+ ```
57
+
58
+ The drawing renderers serve every editor and export in the process. Create the module before the first document opens; a later install logs a console warning once, and slides painted before it keep their paint until they paint again. The chrome controls refresh after an install: in React and Vue, menus and `useEditorValueCommand` options then offer the effects. For headless rendering without an editor, call `installDrawing()` from the same entry.
59
+
60
+ In the React or Vue adapter, pass the same list in the `modules` prop of `PptxEditor` or its root. The editor reads it once, when it is created. Keep the list stable, for example in `useMemo` or a `const` in `setup`:
61
+
62
+ ```tsx
63
+ <PptxEditor document={bytes} modules={modules} />
64
+ ```
65
+
66
+ To collaborate over Yjs, create one session per editor from a Y.Doc and an awareness that your provider connects. This example links two editors in one page; in an app, each editor runs in its own browser with a provider such as Hocuspocus.
67
+
68
+ ```ts
69
+ import * as Y from 'yjs';
70
+ import { Awareness, applyAwarenessUpdate, encodeAwarenessUpdate } from 'y-protocols/awareness';
71
+ import { createPptxEditor } from '@pptx-editor.dev/core';
72
+ import { collaborationModule, createYjsCollaborationSession } from '@pptx-editor.dev/pro';
73
+
74
+ // The deck to open, for example from a file input.
75
+ const bytes = new Uint8Array(await file.arrayBuffer());
76
+
77
+ function openReplica(doc: Y.Doc, awareness: Awareness, actorId: string, name: string) {
78
+ const session = createYjsCollaborationSession({
79
+ doc,
80
+ awareness,
81
+ documentId: 'quarterly-review',
82
+ identity: { actorId, name, color: '#2563eb' },
83
+ });
84
+ const editor = createPptxEditor({ document: bytes, modules: [collaborationModule({ session })] });
85
+ return { editor, session };
86
+ }
87
+
88
+ const docA = new Y.Doc();
89
+ const docB = new Y.Doc();
90
+ const awarenessA = new Awareness(docA);
91
+ const awarenessB = new Awareness(docB);
92
+ // A provider does this over the network. Here, two docs in one page.
93
+ docA.on('update', (update, origin) => origin !== 'peer' && Y.applyUpdate(docB, update, 'peer'));
94
+ docB.on('update', (update, origin) => origin !== 'peer' && Y.applyUpdate(docA, update, 'peer'));
95
+ for (const [from, to] of [
96
+ [awarenessA, awarenessB],
97
+ [awarenessB, awarenessA],
98
+ ] as const)
99
+ from.on('update', ({ added, updated, removed }, origin) => {
100
+ if (origin === 'peer') return;
101
+ const changed = [...added, ...updated, ...removed];
102
+ applyAwarenessUpdate(to, encodeAwarenessUpdate(from, changed), 'peer');
103
+ });
104
+
105
+ const a = openReplica(docA, awarenessA, 'user-1', 'Ada');
106
+ const b = openReplica(docB, awarenessB, 'user-2', 'Grace');
107
+ a.editor.attach(document.getElementById('editor-a')!);
108
+ b.editor.attach(document.getElementById('editor-b')!);
109
+
110
+ // When a person leaves: destroy the editor, then the session. Peers stop showing them.
111
+ a.editor.destroy();
112
+ a.session.destroy();
113
+ ```
114
+
115
+ The first replica in an empty room seeds it from its deck. Later replicas adopt the room.
116
+
117
+ Your host must authenticate participants and authorize access to each document before connecting its provider. A `documentId` identifies a document; it does not grant access. Enforce read and write permissions in your provider or server, including update and awareness messages. Disconnect participants when their access ends. Use an encrypted connection for network transport.
118
+
119
+ Registering a module is the whole enablement story. Without modules, the free engine works the same: decks round-trip, comments and effects are kept, and no replica attaches.
120
+
121
+ ## Charts
122
+
123
+ `@pptx-editor.dev/pro/drawing` draws bar and column charts (clustered, stacked, and percent stacked), line, area, scatter, pie, doughnut, and radar charts, with titles, legends, axes, gridlines, data labels, and number formats. 3-D, of-pie, stock, bubble, and surface charts, and charts with trendlines or error bars, keep the placeholder. A chart is not editable, and its part saves unchanged.
124
+
125
+ ```ts
126
+ import { createPptxEditor } from '@pptx-editor.dev/core/editor';
127
+ import { drawingModule } from '@pptx-editor.dev/pro/drawing';
128
+
129
+ const editor = createPptxEditor({ document: bytes, modules: [drawingModule({ licenseKey })] });
130
+ ```
131
+
132
+ For headless layout, call `installDrawing({ licenseKey })` once. The renderers serve every editor and export in the process, so install them before the first deck opens. `@pptx-editor.dev/pptx-to-pdf` always installs them.
133
+
134
+ A chart becomes shapes and labels that the engine lays out like any other shape, with the same text measurer. The editor and the PDF export draw that one layout.
135
+
136
+ ## How it connects to the engine
137
+
138
+ ```mermaid
139
+ flowchart LR
140
+ A["host: collaboration session"] --> B["collaborationModule()"]
141
+ C["reviewModule()"] --> D["createPptxEditor({ modules })"]
142
+ B --> D
143
+ D --> E["resolveEditorModules: closed registry"]
144
+ E --> F["CollaborationDocumentPort over PptxDocumentStore"]
145
+ F -- "local ops" --> A
146
+ A -- "remote ops: applyRemote" --> F
147
+ G["drawingModule() / installDrawing()"] --> H["installDrawingRenderers: effects"]
148
+ H --> I["SVG paint and PDF export"]
149
+ ```
150
+
151
+ The module seam is in `packages/core/src/editor/modules.ts`. It is closed, as in DOCX Editor: every contribution point is named there, and core never imports this package. The drawing seam is in `packages/core/src/layout/drawing-renderers.ts`, after DOCX Editor's: the effects renderer returns SVG as plain data, and the engine's paint builds it.
152
+
153
+ ## Tracked changes in PPTX
154
+
155
+ PresentationML has no tracked-change markup: there is no equivalent of WordprocessingML `w:ins` and `w:del`. Review in a PPTX file is comments only. So a PPTX Editor suggestion cannot live in the deck the way a `w:ins` or `w:del` revision lives in a DOCX file.
156
+
157
+ ## License
158
+
159
+ The EigenPal Pro License permits evaluation. Production use requires a commercial agreement. The package makes no network requests for licensing.
160
+
161
+ ## Room access
4
162
 
5
- See [pptx-editor.dev](https://pptx-editor.dev/) for docs.
163
+ Your host must authenticate participants and authorize document access before connecting the provider. A `documentId` identifies a document; it does not grant access. Enforce read and write permissions in your provider or server, including update and awareness messages. Disconnect participants when their access ends. Use an encrypted connection for network transport.
@@ -0,0 +1,3 @@
1
+ # Third-party notices for @pptx-editor.dev/pro
2
+
3
+ This package bundles no third-party code.
@@ -0,0 +1,6 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ var n;function i(e){e!==void 0&&(n=e)}export{i as a};
@@ -0,0 +1,139 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import { EditorModule } from '@pptx-editor.dev/core/editor';
7
+ import { P as ProLicenseOptions } from './license-Boo2wwCs.js';
8
+ import { ResolvedEffects } from '@pptx-editor.dev/core/cascade';
9
+ import { Matrix } from '@pptx-editor.dev/core/layout';
10
+
11
+ /**
12
+ * The Gaussian σ for a reflection's blur radius.
13
+ *
14
+ * @internal
15
+ */
16
+ declare function reflectionBlurSigma(blurRad: number): number;
17
+ /**
18
+ * How far the outline moves and how much it then blurs, in EMU. A positive `spread` grows the
19
+ * outline (a dilation), a negative one shrinks it (an erosion).
20
+ *
21
+ * @internal
22
+ */
23
+ interface SpreadBlur {
24
+ /** How far the outline moves, in EMU: outward when positive. */
25
+ readonly spread: number;
26
+ /** The Gaussian σ of the blur after the move, in EMU. */
27
+ readonly sigma: number;
28
+ }
29
+ /**
30
+ * A glow of radius `rad` (ECMA-376 Part 1, 20.1.8, CT_GlowEffect: "a color blurred outline is
31
+ * added outside the edges of the object"). The reference PDFs put the glow's half level at half
32
+ * the radius outside the edge, and its tail ends at the radius. So the outline grows by `rad / 2`
33
+ * and blurs with a radius of `rad / 2`. The glow is at its full alpha on the edge.
34
+ *
35
+ * @internal
36
+ */
37
+ declare function glowSpread(rad: number): SpreadBlur;
38
+ /**
39
+ * How far an inner shadow moves the shape's inverse, in slide space (ECMA-376 Part 1, 20.1.8,
40
+ * CT_InnerShadowEffect: `dist` at `dir`). The shadow shows on the side that `dir` points to: in
41
+ * the reference PDFs, `dir="0"` shades the right edge, `5400000` the bottom edge, and `13500000`
42
+ * the top and left edges (`shape-effects-presets` slide 1, `effects` slide 1). So the inverse,
43
+ * which casts the shadow, moves the opposite way.
44
+ *
45
+ * @internal
46
+ */
47
+ declare function innerShadowShift(dist: number, dir: number): {
48
+ dx: number;
49
+ dy: number;
50
+ };
51
+ /**
52
+ * Where a reflection paints and how it fades. The SVG renderer and the PDF writer
53
+ * (`@pptx-editor.dev/pptx-to-pdf`) both paint from it, so their reflections agree.
54
+ *
55
+ * @internal
56
+ */
57
+ interface ReflectionFade {
58
+ /** The slide-space matrix that moves the shape's content to its reflection. */
59
+ readonly matrix: Matrix;
60
+ /** The fade's gradient line: offset 0 at (`x1`, `y1`), offset 1 at (`x2`, `y2`). */
61
+ readonly line: {
62
+ readonly x1: number;
63
+ readonly y1: number;
64
+ readonly x2: number;
65
+ readonly y2: number;
66
+ };
67
+ /** The offset of the first fade stop, in [0, 1]. */
68
+ readonly start: number;
69
+ /** The offset of the last fade stop, in [`start`, 1]. */
70
+ readonly end: number;
71
+ }
72
+ /**
73
+ * The placement and fade of a reflection (ECMA-376 Part 1, 20.1.8, CT_ReflectionEffect, as the
74
+ * cascade resolves it) of a `w` × `h` shape whose local box maps to the slide
75
+ * through `shape`. The fade runs across the reflected shape box, in the slide's frame, or in
76
+ * the shape's when `rotWithShape` is set. The last stop is at the later of the two positions.
77
+ *
78
+ * @internal
79
+ */
80
+ declare function reflectionFade(ref: NonNullable<ResolvedEffects['reflection']>, shape: Matrix, w: number, h: number): ReflectionFade;
81
+
82
+ /**
83
+ * `@pptx-editor.dev/pro/drawing`: advanced drawing rendering.
84
+ *
85
+ * The free engine paints pictures, shapes with fills, gradients, patterns, lines and outer
86
+ * shadows, text, tables, and groups. This module adds:
87
+ *
88
+ * - the shape and picture effects glow, inner shadow, reflection, and soft edge (ECMA-376
89
+ * Part 1, 20.1.8);
90
+ * - charts, drawn from the values cached in their chart parts (ECMA-376 Part 1, 21.2): bar and
91
+ * column charts (clustered, stacked, and percent stacked), line, area, scatter, pie, doughnut,
92
+ * and radar charts, with titles, legends, axes, gridlines, data labels, and number formats.
93
+ * 3-D, of-pie, stock, bubble, and surface charts, and charts with trendlines or error bars,
94
+ * keep the placeholder. A chart becomes shapes and labels that the engine lays out like any
95
+ * other shape, so the editor and the PDF export draw one layout. Its part saves unchanged.
96
+ *
97
+ * Without it, a chart shows a labeled placeholder, and a shape or picture paints without those
98
+ * effects, and the editor chrome does not offer them (Shape Effects shows only the outer
99
+ * shadows, Picture Styles only the frame styles). The effect commands still write them to the
100
+ * file, and save keeps them. PDF export
101
+ * (`@pptx-editor.dev/pptx-to-pdf`) always includes this module.
102
+ *
103
+ * The renderers serve every editor and export in the process. Install them before any document
104
+ * opens; a later install logs a console warning once. The chrome controls refresh after an
105
+ * install.
106
+ *
107
+ * @example Enable advanced drawing rendering in an editor
108
+ * ```ts
109
+ * import { createPptxEditor } from '@pptx-editor.dev/core';
110
+ * import { drawingModule } from '@pptx-editor.dev/pro/drawing';
111
+ *
112
+ * // Next.js; with Vite, read import.meta.env.VITE_PPTX_LICENSE.
113
+ * const modules = [drawingModule({ licenseKey: process.env.NEXT_PUBLIC_PPTX_LICENSE })];
114
+ * const editor = createPptxEditor({ document: bytes, modules });
115
+ * ```
116
+ *
117
+ * @packageDocumentation
118
+ * @public
119
+ */
120
+
121
+ /**
122
+ * Install the drawing renderers (charts, glow, inner shadow, reflection, and soft edge) for
123
+ * every editor and export in this process, without an editor module: for headless rendering.
124
+ * Installing again is harmless. A host without the EigenPal Pro License leaves this call out;
125
+ * its charts then show placeholders, and its shapes and pictures paint without those effects.
126
+ *
127
+ * @public
128
+ */
129
+ declare function installDrawing(options?: ProLicenseOptions): void;
130
+ /**
131
+ * The drawing module for `createPptxEditor({ modules })` and the adapters' `modules` prop.
132
+ * Creating it installs the drawing renderers process-wide, as {@link installDrawing} does.
133
+ *
134
+ * @public
135
+ */
136
+ declare function drawingModule(options?: ProLicenseOptions): EditorModule;
137
+
138
+ export { ProLicenseOptions, drawingModule, glowSpread, innerShadowShift, installDrawing, reflectionBlurSigma, reflectionFade };
139
+ export type { ReflectionFade, SpreadBlur };
@@ -0,0 +1,7 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import{a as Vt}from"./chunk-HCD7IVOL.js";import{installDrawingRenderers as al}from"@pptx-editor.dev/core/layout";import{resolveThemeFont as ur}from"@pptx-editor.dev/core/cascade";import{isValidXmlText as cr}from"@pptx-editor.dev/core/store";import{resolveColor as lr}from"@pptx-editor.dev/core/cascade";import{NS as je}from"@pptx-editor.dev/core/store";var $t=je.c,he=je.a;function ee(e){return e?.type==="element"}function J(e,t){for(let n of e)if(n.type==="element"&&n.ns===t.namespaceUri&&n.local===t.localName)return n;return null}function Y(e,t){for(let n of e)if(n.local===t&&n.ns==="")return n.value}var ar=20116800;function Wt(e){if(e===void 0||!/^-?\d{1,15}$/.test(e))return null;let t=Number(e);return Number.isFinite(t)?Math.min(Math.max(t,0),ar):null}function ir(e){let t=n=>Math.round(Math.min(255,Math.max(0,n))).toString(16).padStart(2,"0");return{hex:`${t(e.r)}${t(e.g)}${t(e.b)}`.toUpperCase(),alpha:e.a}}function xe(e,t){if(!ee(e)||!t)return null;let n=lr(e,t);return n?ir(n):null}var sr=new Set(["noFill","solidFill","gradFill","blipFill","pattFill","grpFill"]);function Gt(e,t){let n=e.children.find(o=>o.type==="element"&&o.ns===je.a&&sr.has(o.local));if(!n)return{present:!1,color:null};if(n.local!=="solidFill")return{present:!0,color:null};let r=n.children.find(ee);return{present:!0,color:xe(r,t)}}var zt=0;function mt(e,t,n=[]){return zt+=1,{type:"element",id:`chart-generated-${zt}`,kind:"generic",ns:je.a,local:e,nsDecls:[],attrs:Object.entries(t).map(([r,o])=>({ns:"",local:r,value:o})),children:n}}var Se=he,Ie=512,dr=128,fr=16,hr=.952,mr=.268;function Ht(e,t){let n=Y(e.attrs,t);return n==="1"||n==="true"?!0:n==="0"||n==="false"?!1:null}function pt(e,t){let n=J(e.children,{namespaceUri:Se,localName:t}),r=n?Y(n.attrs,"typeface"):void 0;return r&&r.length<=dr&&cr(r)?r:null}function Ne(e,t,n){if(!t)return e;let r=Y(t.attrs,"sz"),o=r&&/^\d{3,6}$/.test(r)?Number(r)/100:null,a=J(t.children,{namespaceUri:Se,localName:"solidFill"})?.children.find(ee),i=a?xe(a,n):null,s=Y(t.attrs,"u");return{sizePt:o!==null&&o>=1&&o<=400?o:e.sizePt,bold:Ht(t,"b")??e.bold,italic:Ht(t,"i")??e.italic,underline:s===void 0?e.underline:s!=="none",colorHex:i?.hex??e.colorHex,latin:pt(t,"latin")??e.latin,eastAsian:pt(t,"ea")??e.eastAsian,complex:pt(t,"cs")??e.complex}}function xt(e){if(!e)return null;let t=J(e.children,{namespaceUri:Se,localName:"p"}),n=t?J(t.children,{namespaceUri:Se,localName:"pPr"}):null;return n?J(n.children,{namespaceUri:Se,localName:"defRPr"}):null}function Oe(e){let t=e?J(e.children,{namespaceUri:Se,localName:"bodyPr"}):null;if(!t)return null;let n=Y(t.attrs,"vert");if(n==="vert")return 90;if(n==="vert270")return-90;let r=Y(t.attrs,"rot");if(r===void 0||!/^-?\d{1,9}$/.test(r))return null;let o=Number(r);return o===-6e7||Math.abs(o)>54e5?null:o/6e4}var me=null;function Xt(e,t){let n=me;me=e;try{return t()}finally{me=n}}function De(e,t){return ur(e,t)??t.minorFont.latin??"Calibri"}function jt(e,{measurer:t,theme:n}){return t.resolve({family:De(e.latin,n),bold:e.bold,italic:e.italic})}function Q(e,t){if(!me)return 0;let n=e.length>Ie?e.slice(0,Ie):e;if(n==="")return 0;let r=jt(t,me),o=0;for(let l of me.measurer.advances(r,n))o+=l;return o*t.sizePt}function Kt(e){let t=me?jt(e,me).metrics:null;return t&&t.ascent>0&&t.descent>=0?t:{ascent:hr,descent:mr}}function q(e){let{ascent:t,descent:n}=Kt(e);return e.sizePt*(t+n)}function yt(e){return e.sizePt*Kt(e).ascent}function Fe(e,t){let n=0;for(let r of e)n+=r.length>0?Math.max(...r.map(o=>q(o.style))):q(t);return n}function Ke(e){let t=0;for(let n of e)t=Math.max(t,n.reduce((r,o)=>r+Q(o.text,o.style),0));return t}function Yt(e){let t=[];for(let n of e){let r=[];for(let o of n){let l=o.text.split(/\r\n|\r|\n/);for(let[a,i]of l.entries())a>0&&(t.push(r),r=[]),i!==""&&r.push({text:i,style:o.style})}t.push(r)}return t.slice(0,fr)}var pr=12700,xr=4096,Zt=2,ye=e=>Math.round(e*pr);function yr(e){let t=/^[0-9a-f]{6}$/i.test(e.hex)?Number.parseInt(e.hex,16):0,n=Number.isFinite(e.alpha)?Math.min(1,Math.max(0,e.alpha)):1;return{r:t>>16&255,g:t>>8&255,b:t&255,a:n}}function bt(e){return{type:"solid",color:yr(e)}}function br(e,t){return{fill:bt(e),width:ye(e.widthPt),cap:e.cap==="round"?"rnd":e.cap==="square"?"sq":"flat",join:t??"miter",miterLimit:8,dash:e.dash?"custom":"solid",...e.dash?{dashes:e.dash}:{},compound:"sng"}}var Jt=e=>e!==null&&/^[0-9a-f]{6}$/i.test(e.hex);function gr(e,t,n){let r=[];for(let o of e.subpaths){for(let[l,a]of o.entries())r.push({op:l===0?"M":"L",x:ye(a.x),y:ye(a.y)});e.closed&&r.push({op:"Z"})}return{commands:r,fill:t?"norm":"none",stroke:n}}function qt(e,t,n){let r=e.frame;return{nodeId:`${r.nodeId}#chart-${n}:${t}`,partName:r.partName,layer:r.layer,name:"",hidden:!1}}function Cr(e,t,n){let r=e.closed&&Jt(e.fill)?e.fill:null,o=e.stroke&&Jt(e.stroke)?e.stroke:null;if(!r&&!o)return null;let{cx:l,cy:a}=n.frame.xfrm;return{...qt(n,t,"shape"),kind:"shape",xfrm:{x:0,y:0,cx:l,cy:a,rot:0,flipH:!1,flipV:!1},geometry:{kind:"paths",paths:[gr(e,!!r,!!o)]},fill:r?bt(r):{type:"none"},...o?{line:br(o,e.join)}:{}}}var Mr={lIns:0,tIns:0,rIns:0,bIns:0,anchor:"ctr",anchorCtr:!1,wrap:"square",vert:"horz",rot:0,upright:!1,numCol:1,spcCol:0,autofit:{kind:"none"},spcFirstLastPara:!1};function Qt(e,t){let n=e.style,r=n.latin.startsWith("+mj")?"major":n.latin.startsWith("+mn")?"minor":void 0,o=De(n.latin,t);return{size:Math.round(n.sizePt*100),bold:n.bold,italic:n.italic,underline:n.underline?"sng":"none",strike:"noStrike",caps:"none",spacing:0,baseline:0,latin:o,...r?{latinTheme:r}:{},ea:n.eastAsian?De(n.eastAsian,t):o,cs:n.complex?De(n.complex,t):o,fill:bt({hex:n.colorHex,alpha:1})}}function Pr(e,t,n,r){let o=e.filter(a=>a.text!==""),l=o.reduce((a,i)=>i.style.sizePt<a.style.sizePt?i:a);return{nodeId:`${n}:p`,level:0,align:t,marL:0,marR:0,indent:0,lineSpacing:{pct:1},spaceBefore:{pts:0},spaceAfter:{pts:0},bullet:null,defaultTab:914400,tabs:[],rtl:!1,eaLineBreak:!0,latinLineBreak:!1,hangingPunct:!1,runs:o.map((a,i)=>({kind:"text",nodeId:`${n}:r${i}`,text:a.text.length>Ie?a.text.slice(0,Ie):a.text,props:Qt(a,r)})),endProps:Qt(l,r)}}function Sr(e,t,n){let r=`${n.frame.nodeId}#chart-label:${t}`,o=[];for(let[s,u]of Yt(e.paragraphs).entries())u.some(d=>d.text!=="")&&o.push(Pr(u,e.align,`${r}:${s}`,n.theme));if(o.length===0)return null;let l=e.align==="l"?0:Zt,a=e.align==="r"?0:Zt,i=(e.rotation%360+360)%360;return{...qt(n,t,"label"),kind:"shape",xfrm:{x:ye(e.x-l),y:ye(e.y),cx:Math.max(1,ye(e.width+l+a)),cy:Math.max(1,ye(e.height)),rot:Number.isFinite(i)?i:0,flipH:!1,flipV:!1},geometry:{kind:"preset",preset:"rect",adjust:new Map},fill:{type:"none"},text:{body:Mr,paragraphs:o}}}function en(e,t,n,r){if(t.length>xr)return null;let o={frame:n,theme:r},l=[];for(let[a,i]of e.entries()){let s=Cr(i,a,o);s&&l.push(s)}for(let[a,i]of t.entries()){let s=Sr(i,a,o);s&&l.push(s)}return l}var Mt=$t,kr=8,gt=255,Je=4096,Er=32768,tn=1024,rn=new Map([["barChart",{kind:"bar",threeD:!1}],["bar3DChart",{kind:"bar",threeD:!0}],["lineChart",{kind:"line",threeD:!1}],["line3DChart",{kind:"line",threeD:!0}],["areaChart",{kind:"area",threeD:!1}],["area3DChart",{kind:"area",threeD:!0}],["pieChart",{kind:"pie",threeD:!1}],["pie3DChart",{kind:"pie",threeD:!0}],["doughnutChart",{kind:"doughnut",threeD:!1}],["scatterChart",{kind:"scatter",threeD:!1}],["radarChart",{kind:"radar",threeD:!1}],["bubbleChart",{kind:"bubble",threeD:!1}],["stockChart",{kind:"line",threeD:!1}],["ofPieChart",{kind:"ofPie",threeD:!1}],["surfaceChart",{kind:"surface",threeD:!1}],["surface3DChart",{kind:"surface",threeD:!0}]]);function P(e,t){return e?J(e.children,{namespaceUri:Mt,localName:t}):null}function oe(e,t){let n=[];for(let r of e?.children??[])ee(r)&&r.ns===Mt&&r.local===t&&n.push(r);return n}function z(e,t){let n=P(e,t);return n?Y(n.attrs,"val"):void 0}function re(e,t,n){let r=P(e,t);if(!r)return n;let o=Y(r.attrs,"val");return o===void 0?!0:o==="1"||o==="true"}function K(e,t,n,r){let o=z(e,t);if(o===void 0||o.length>40)return null;let l=Number(o);return Number.isFinite(l)&&l>=n&&l<=r?l:null}function Ct(e){let t="";for(let n of e?.children??[])n.type==="text"&&(t+=n.value);return t.length>tn?t.slice(0,tn):t}function on(e,t){let n=z(e,"ptCount")?.trim(),r=K(e,"ptCount",0,Je);return P(e,"ptCount")&&(!n||!/^\+?\d+$/.test(n)||r===null)?(t.remaining=-1,null):r}function Ze(e,t){if(!e)return null;let n=on(e,t);if(t.remaining<0)return null;let r=oe(e,"pt"),o=n??0,l=[];for(let i of r){let s=Y(i.attrs,"idx"),u=s!==void 0&&/^\d{1,6}$/.test(s)?Number(s):-1;if(u<0||u>=Je||n!==null&&u>=n)return t.remaining=-1,null;l.push([u,Ct(P(i,"v"))]),n===null&&(o=Math.max(o,u+1))}if(o>Je||(t.remaining-=o,t.remaining<0))return null;let a=Array.from({length:o},()=>null);for(let[i,s]of l)a[i]=s;return a}function Ye(e,t){let n={text:null,numbers:null,formatCode:null};if(!e)return n;let r=P(e,"numRef"),o=P(r,"numCache")??P(e,"numLit");if(o){let u=Ze(o,t),d=Ct(P(o,"formatCode"))||null;return{text:u,numbers:u?.map(f=>ln(f))??null,formatCode:d}}let l=P(e,"strRef"),a=P(l,"strCache")??P(e,"strLit");if(a)return{text:Ze(a,t),numbers:null,formatCode:null};let i=P(P(e,"multiLvlStrRef"),"multiLvlStrCache");if(i){let u=oe(i,"lvl")[0]??null;if(u){let d=on(i,t),f=Ze(u,t)??[],h=d??f.length;return h<f.length?(t.remaining=-1,n):(t.remaining-=Math.max(0,h-f.length),t.remaining<0?n:{text:Array.from({length:h},(y,b)=>f[b]??null),numbers:null,formatCode:null})}}let s=P(e,"v");return s?{text:[Ct(s)],numbers:null,formatCode:null}:n}function ln(e){if(e===null)return null;let t=e.trim();if(t===""||t.length>40)return null;let n=Number(t);return Number.isFinite(n)?n:null}function Lr(e){return e?{symbol:z(e,"symbol")??null,size:K(e,"size",2,72),spPr:P(e,"spPr")}:null}function vr(e,t,n){let r=Ye(P(e,"tx"),n).text?.[0]??null,o=t==="scatter"||t==="bubble",l=Ye(P(e,o?"xVal":"cat"),n),a=Ye(P(e,o?"yVal":"val"),n);if(n.remaining<0)return null;let i=new Map;for(let s of oe(e,"dPt")){let u=K(s,"idx",0,Je-1);u!==null&&i.set(u,s)}return{index:K(e,"idx",0,2**31)??0,order:K(e,"order",0,2**31)??0,name:r,categories:o?null:l.text,categoryNumbers:o?null:l.numbers,categoryFormat:l.formatCode,xValues:o?l.numbers:null,values:a.numbers??(a.text??[]).map(ln),formatCode:a.formatCode,spPr:P(e,"spPr"),marker:Lr(P(e,"marker")),dLbls:P(e,"dLbls"),points:i,smooth:re(e,"smooth",!1),explosion:K(e,"explosion",0,400)??0,invertIfNegative:re(e,"invertIfNegative",!1),bubbleSizes:t==="bubble"?Ye(P(e,"bubbleSize"),n).numbers??null:null,trendlines:oe(e,"trendline").slice(0,8),errorBars:oe(e,"errBars").slice(0,2),labelRange:Ze(Ar(e),n)}}function nn(e,t){for(let n of e?.children??[])if(ee(n)&&n.local===t)return n;return null}function Ar(e){for(let t of oe(P(e,"extLst"),"ext")){let n=nn(nn(t,"datalabelsRange"),"dlblRangeCache");if(n)return n}return null}var wr=new Set(["clustered","stacked","percentStacked","standard"]);function Tr(e,t){let n=rn.get(e.local);if(!n)return null;let r=[];for(let a of oe(e,"ser")){if(r.length>=gt)return null;let i=vr(a,n.kind,t);if(!i||t.remaining<0)return null;r.push(i)}r.sort((a,i)=>a.order-i.order);let o=z(e,"grouping"),l=n.kind;return{kind:l,threeD:n.threeD,element:e,horizontal:l==="bar"&&z(e,"barDir")==="bar",grouping:o&&wr.has(o)?o:l==="bar"?"clustered":"standard",varyColors:re(e,"varyColors",l==="pie"||l==="doughnut"),gapWidth:K(e,"gapWidth",0,500)??150,overlap:K(e,"overlap",-100,100)??0,gapDepth:K(e,"gapDepth",0,500)??150,series:r,axisIds:oe(e,"axId").map(a=>Y(a.attrs,"val")??""),dLbls:P(e,"dLbls"),firstSliceAngle:K(e,"firstSliceAng",0,360)??0,holeSize:K(e,"holeSize",1,90)??50,markers:re(e,"marker",!0),scatterStyle:z(e,"scatterStyle")??null,radarStyle:z(e,"radarStyle")??null,hiLowLines:P(e,"hiLowLines"),upDownBars:P(e,"upDownBars"),bubbleScale:K(e,"bubbleScale",0,300)??100,bubbleArea:z(e,"sizeRepresents")!=="w",ofPie:l==="ofPie"?{type:z(e,"ofPieType")==="bar"?"bar":"pie",splitType:z(e,"splitType")??"auto",splitPos:K(e,"splitPos",-1e300,1e300),secondSize:K(e,"secondPieSize",5,200)??75,serLines:P(e,"serLines")}:null,wireframe:l==="surface"&&re(e,"wireframe",!1),bandFormats:l==="surface"?Rr(e):new Map}}function Rr(e){let t=new Map;for(let n of oe(P(e,"bandFmts"),"bandFmt").slice(0,gt)){let r=K(n,"idx",0,gt),o=P(n,"spPr");r!==null&&o&&t.set(r,o)}return t}var _r=new Set(["b","t","l","r"]);function Ir(e){let t=e.local==="catAx"?"category":e.local==="valAx"?"value":e.local==="dateAx"?"date":e.local==="serAx"?"series":null;if(!t)return null;let n=z(e,"axId");if(!n)return null;let r=P(e,"scaling"),o=P(e,"numFmt"),l=z(e,"axPos"),a=K(e,"crossesAt",-1e300,1e300),i=z(e,"crosses"),s=z(e,"majorTickMark"),u=z(e,"minorTickMark"),d=z(e,"tickLblPos"),f=z(e,"crossBetween"),h=z(e,"baseTimeUnit");return{id:n,kind:t,element:e,deleted:re(e,"delete",!1),position:l&&_r.has(l)?l:"b",crossAxisId:z(e,"crossAx")??null,reversed:z(r,"orientation")==="maxMin",min:K(r,"min",-1e300,1e300),max:K(r,"max",-1e300,1e300),majorUnit:K(e,"majorUnit",1e-300,1e300),minorUnit:K(e,"minorUnit",1e-300,1e300),logBase:K(r,"logBase",2,1e3),formatCode:o?Y(o.attrs,"formatCode")??null:null,sourceLinked:o?Y(o.attrs,"sourceLinked")==="1":!0,majorGridlines:P(e,"majorGridlines"),minorGridlines:P(e,"minorGridlines"),majorTickMark:s==="none"||s==="in"||s==="out"||s==="cross"?s:"cross",minorTickMark:u==="none"||u==="in"||u==="out"||u==="cross"?u:"cross",tickLabelPosition:d==="low"||d==="high"||d==="none"?d:"nextTo",spPr:P(e,"spPr"),txPr:P(e,"txPr"),title:P(e,"title"),crosses:a!==null?a:i==="min"||i==="max"?i:"autoZero",crossBetween:f==="between"||f==="midCat"?f:null,tickLabelSkip:K(e,"tickLblSkip",1,32e3),baseTimeUnit:h==="days"||h==="months"||h==="years"?h:null}}function Qe(e){let t=P(e,"manualLayout");if(!t)return null;let n=i=>K(t,i,-10,10),r=n("x"),o=n("y"),l=n("w"),a=n("h");return r===null||o===null||z(t,"xMode")==="factor"||z(t,"yMode")==="factor"?null:{inner:z(t,"layoutTarget")!=="outer",x:r,y:o,w:l??0,h:a??0}}function Nr(e){if(!e)return null;let t=z(e,"legendPos"),n=new Set;for(let r of oe(e,"legendEntry")){let o=K(r,"idx",0,1e5);o!==null&&re(r,"delete",!1)&&n.add(o)}return{element:e,position:t==="b"||t==="t"||t==="l"||t==="tr"?t:"r",overlay:re(e,"overlay",!1),txPr:P(e,"txPr"),spPr:P(e,"spPr"),layout:Qe(P(e,"layout")),deleted:n}}function Or(e){let t=K(e,"style",1,48);if(t!==null)return t;for(let n of e.children)if(!(!ee(n)||n.local!=="AlternateContent"))for(let r of n.children){if(!ee(r)||r.local!=="Fallback")continue;let o=K(r,"style",1,48);if(o!==null)return o}return 2}function an(e){let t=P(e,"chart"),n=P(t,"plotArea");if(!t||!n)return null;let r={remaining:Er},o=[],l=new Map;for(let a of n.children){if(!ee(a)||a.ns!==Mt)continue;if(rn.has(a.local)){if(o.length>=kr)return null;let s=Tr(a,r);if(!s)return null;o.push(s);continue}let i=Ir(a);i&&l.set(i.id,i)}return o.length===0?null:{chartSpace:e,date1904:re(e,"date1904",!1),style:Or(e),roundedCorners:re(e,"roundedCorners",!0),spPr:P(e,"spPr"),txPr:P(e,"txPr"),title:P(t,"title"),autoTitleDeleted:re(t,"autoTitleDeleted",!1),plotSpPr:P(n,"spPr"),plotLayout:Qe(P(n,"layout")),plots:o,axes:l,legend:Nr(P(t,"legend")),view3D:P(t,"view3D"),floor:P(t,"floor"),sideWall:P(t,"sideWall"),backWall:P(t,"backWall")}}var Pt=["January","February","March","April","May","June","July","August","September","October","November","December"],sn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function St(e){if(!Number.isFinite(e))return"";if(e===0)return"0";let t=Math.abs(e);if(t>=1e11||t<1e-9){let[o,l]=e.toExponential(5).split("e"),a=o.replace(/\.?0+$/,""),i=Number(l);return`${a}E${i<0?"-":"+"}${String(Math.abs(i)).padStart(2,"0")}`}let n=Math.max(0,10-Math.max(1,Math.floor(Math.log10(t))+1)),r=e.toFixed(Math.min(n,20));return r.includes(".")?r.replace(/\.?0+$/,""):r}function un(e){let t=[],n="",r=!1,o=!1;for(let l=0;l<e.length;l+=1){let a=e[l];if(a==="\\"&&!r&&l+1<e.length){n+=a+e[l+1],l+=1;continue}if(a==='"'?r=!r:!r&&a==="["?o=!0:!r&&a==="]"&&(o=!1),a===";"&&!r&&!o){t.push(n),n="";continue}n+=a}return t.push(n),t}function cn(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r==='"'){let o=e.indexOf('"',n+1),l=o===-1?e.length:o;t.push({kind:"literal",text:e.slice(n+1,l)}),n=l}else if(r==="\\"&&n+1<e.length)t.push({kind:"literal",text:e[n+1]}),n+=1;else if(r==="_"&&n+1<e.length)t.push({kind:"literal",text:" "}),n+=1;else if(r==="*"&&n+1<e.length)n+=1;else if(r==="["){let o=e.indexOf("]",n+1),l=o===-1?e.length:o,a=e.slice(n+1,l);if(/^(?:h+|m+|s+)$/i.test(a))t.push({kind:"code",text:`[${a}]`});else if(a.startsWith("$")){let i=a.indexOf("-");t.push({kind:"literal",text:a.slice(1,i===-1?a.length:i)})}n=l}else"$-+/():!^&'~{}<>= ".includes(r)?t.push({kind:"literal",text:r}):t.push({kind:"code",text:r})}return t}function qe(e){return(e[0]==="["?e[1]:e[0]).toLowerCase()}function dn(e){let t=!1,n="",r=!1;for(let o of e){if(o.kind!=="code")continue;let l=qe(o.text);if(l===".")r=n==="s";else{if(l==="0"&&r)continue;if(l==="0"||l==="#"||l==="?")return!1;r=!1}"ymdhs".includes(l)&&(t=!0),n=l}return t}function Dr(e){let t="";for(let n=0;n<e.length;n+=1)n>0&&(e.length-n)%3===0&&(t+=","),t+=e[n];return t}function Fr(e,t){let n=t.map(M=>M.kind==="code"?M.text:""),r=n.findIndex(M=>M==="E"||M==="e"),o=M=>M==="0"||M==="#"||M==="?",l=0,a=-1,i=-1,s=-1;for(let M=0;M<n.length&&!(r!==-1&&M>=r);M+=1){let S=n[M];S==="%"&&(l+=1),S==="."&&a===-1&&(a=M),o(S)&&(s===-1&&(s=M),i=M)}if(s===-1)return t.map(M=>M.kind==="literal"?M.text:"").join("");let u=e*100**Math.min(l,3),d=i+1;for(;d<n.length&&n[d]===",";)u/=1e3,d+=1;let f=a===-1?i+1:a,h=!1,y=0;for(let M=s;M<f;M+=1)n[M]===","&&(h=!0),n[M]==="0"&&(y+=1);let b=0,x=0;if(a!==-1)for(let M=a+1;M<=i;M+=1)o(n[M])&&(x+=1,n[M]==="0"&&(b=x));x=Math.min(x,30),b=Math.min(b,x);let g;if(r!==-1){let M=x,[S,w]=Math.abs(u).toExponential(M).split("e"),O=Number(w),L=t[r+1]?.text==="+"||t[r+1]?.text==="-",_=O<0?"-":t[r+1]?.text==="+"?"+":"",k=0;for(let $=r+(L?2:1);$<n.length&&o(n[$]);$+=1)k+=1;g=`${S}E${_}${String(Math.abs(O)).padStart(Math.max(1,k),"0")}`}else{let M=Math.abs(u).toFixed(x),[S,w=""]=M.split(".");for(;w.length>b&&w.endsWith("0");)w=w.slice(0,-1);S==="0"&&y===0&&(S=""),S=S.padStart(y,"0"),h&&(S=Dr(S)),g=a===-1?S:`${S}.${w}`}let T="",A="";for(let M=0;M<t.length;M+=1){let S=t[M],w=S.kind==="literal"?S.text:S.text==="%"?"%":"";M<s?T+=w:M>(r!==-1?n.length:i)&&S.text!==","&&(A+=w)}return T+g+A}function pe(e,t){return String(e).padStart(t,"0")}function Br(e,t){if(!Number.isFinite(e)||e<0||e>2958465)return null;let n=t?e+1462:e<61?e+1:e,r=Math.round((n-25569)*864e5);return new Date(r)}function Ur(e,t,n){let r=Br(Math.abs(e),n);if(!r)return St(e);let o=[];for(let i of t){let s=o[o.length-1];s&&s.kind==="code"&&i.kind==="code"&&s.text[0]!=="["&&i.text[0]!=="["&&s.text[0].toLowerCase()===i.text.toLowerCase()?s.text+=i.text:o.push({kind:i.kind,text:i.text})}let l=t.some(i=>i.kind==="code"&&i.text.toLowerCase()==="a"),a="";for(let i=0;i<o.length;i+=1){let s=o[i];if(s.kind==="literal"){a+=s.text;continue}let u=s.text.toLowerCase(),d=qe(s.text),f=s.text.length;if(u[0]==="["){let h=d==="h"?24:d==="m"?1440:86400;a+=pe(Math.floor(Math.abs(e)*h+1e-9),f-2)}else if(d==="0"&&o[i-1]?.text==="."){let h=r.getUTCMilliseconds();a+=pe(Math.floor(h/10**(3-Math.min(f,3))),Math.min(f,3)).padEnd(f,"0")}else if(d==="y")a+=f<=2?pe(r.getUTCFullYear()%100,2):String(r.getUTCFullYear());else if(d==="d")f>=4?a+=sn[r.getUTCDay()]:f===3?a+=sn[r.getUTCDay()].slice(0,3):a+=f===2?pe(r.getUTCDate(),2):String(r.getUTCDate());else if(d==="m"){let h=o.slice(0,i).reverse().find(x=>x.kind==="code"),y=o.slice(i+1).find(x=>x.kind==="code");f<=2&&(h&&qe(h.text)==="h"||y&&qe(y.text)==="s")?a+=f===2?pe(r.getUTCMinutes(),2):String(r.getUTCMinutes()):f>=5?a+=Pt[r.getUTCMonth()][0]:f===4?a+=Pt[r.getUTCMonth()]:f===3?a+=Pt[r.getUTCMonth()].slice(0,3):a+=f===2?pe(r.getUTCMonth()+1,2):String(r.getUTCMonth()+1)}else if(d==="h"){let h=r.getUTCHours();l&&(h=h%12===0?12:h%12),a+=f>=2?pe(h,2):String(h)}else if(d==="s")a+=f>=2?pe(r.getUTCSeconds(),2):String(r.getUTCSeconds());else if(d==="a"){let h=r.getUTCHours()>=12,y=o[i+2]?.text.toLowerCase()==="p";for(a+=y?h?"P":"A":h?"PM":"AM";i+1<o.length&&/^[mp/]/i.test(o[i+1].text);)i+=1}else if(d==="e")a+=String(r.getUTCFullYear());else{if(d==="g"||d==="b")continue;a+=s.text}}return a}function ce(e,t,n=!1){if(!Number.isFinite(e))return"";if(!t||t.length>256||/^general$/i.test(t.trim()))return St(e);let r=un(t),o=r[0],l=e;if(e<0&&r.length>=2?(o=r[1],l=-e):e===0&&r.length>=3&&(o=r[2]),/^general$/i.test(o.trim()))return St(l);let a=cn(o);if(dn(a))return Ur(e,a,n);let i=Fr(l,a),s=/^[^1-9]*$/.test(i);return l<0&&!s?`-${i}`:i}function fn(e){return!e||e.length>256||/^general$/i.test(e.trim())?!1:dn(cn(un(e)[0]))}function et(e,t,n){let r=e.categoryNumbers?.[t];return r!=null&&e.categoryFormat?ce(r,e.categoryFormat,n):e.categories?.[t]??null}function pn(e,t){if(e.logBase!==void 0){if(!(t>0))return 0;let n=Math.log(e.max/e.min)||1;return Math.log(t/e.min)/n}return(t-e.min)/(e.max-e.min||1)}function xn(e,t,n,r,o){let l=f=>Math.log(f)/Math.log(n),a=e>0?e:1,i=t>0?Math.max(t,a):a,s=r!==null&&r>0?r:n**Math.floor(l(a)+1e-9),u=o!==null&&o>0?o:n**Math.ceil(l(i)-1e-9);u>s||(u=s*n);let d=[];for(let f=0;f<=1e3;f+=1){let h=Number((s*n**f).toPrecision(12));if(h>u*(1+1e-9))break;d.push(h)}return{min:s,max:u,major:n,ticks:d,logBase:n}}function hn(e){let t=10**Math.floor(Math.log10(e));return[1,2,5,10,20].map(n=>n*t)}function mn(e,t){return Number((Math.round(e/t)*t).toPrecision(12))}function tt(e){let t=Number.isFinite(e.dataMin)?e.dataMin:0,n=Number.isFinite(e.dataMax)?e.dataMax:1;t>n&&([t,n]=[n,t]),e.fixedMin!==null&&(t=Math.min(t,e.fixedMin)),e.fixedMax!==null&&(n=Math.max(n,e.fixedMax)),t===n&&(n===0?n=1:n>0?t=0:n=0);let r=t,o=n;e.fixedMin===null&&t>=0&&(r=t>5/6*n?t-(n-t)/2:0),e.fixedMax===null&&n<=0&&(o=n<5/6*t?n+(n-t)/2:0);let l=e.noHeadroom?0:.05*(o-r),a=e.fixedMax??(o>0?o+l:o),i=e.fixedMin??(r<0?r-l:r),s=Math.max(a-i,Number.EPSILON),u=Math.max(1,Math.floor(e.lengthPt/Math.max(1,e.minIntervalPt))),d=e.fixedMajor??0;if(!(d>0)||s/d>1e3){d=0;let b=e.roomOnly===!0||e.fixedMin!==null&&e.fixedMax!==null,x=(e.fixedMax??o)-(e.fixedMin??r);for(let g of hn(s/10)){let T=Math.ceil(a/g-1e-9)-Math.floor(i/g+1e-9),A=e.roomOnly?Math.min(u,10):u;if(T<=A&&(b||x/g<=9.5)){d=g;break}}d===0&&(d=hn(s)[2])}let f=e.fixedMin??mn(Math.floor(i/d+1e-9)*d,d),h=e.fixedMax??mn(Math.ceil(a/d-1e-9)*d,d);h<=f&&(h=f+d);let y=[];for(let b=0;b<=1e3;b+=1){let x=Number((f+b*d).toPrecision(12));if(x>h+d*1e-9)break;y.push(x)}return{min:f,max:h,major:d,ticks:y}}var Vr=1,zr=1.4;function be(e,t,n){let r=t.axisIds.map(o=>e.axes.get(o)).filter(o=>o!==void 0);if(t.kind==="scatter"||t.kind==="bubble"){let o=i=>i.position==="b"||i.position==="t",l=r.find(o)??r[0]??null,a=r.find(i=>i!==l)??null;return n==="value"?a:n==="x"?l:null}return n==="value"?r.find(o=>o.kind==="value")??null:r.find(o=>o.kind==="category"||o.kind==="date")??null}function nt(e,t,n){let r=0,o=null,l=null,a=null;for(let b of t)for(let x of b.series)r=Math.max(r,x.values.length),!o&&x.categories&&(o=[...x.categories],l=x.categoryNumbers?[...x.categoryNumbers]:null,a=x.categoryFormat);let i=t.length>0?be(e,t[0],"category"):null;o&&(r=Math.max(r,o.length)),r=Math.min(r,n);let u=(i&&!i.sourceLinked?i.formatCode:null)??a,d=l!==null&&(i?.kind==="date"||i?.kind!=="category"&&fn(u))&&l.every(b=>b!==null),f=[];for(let b=0;b<r;b+=1){let x=l?.[b];x!=null&&u?f.push(ce(x,u,e.date1904)):f.push(o?.[b]??String(b+1))}let h=t.length>0?be(e,t[0],"value"):null,y=h?.crossBetween==="midCat"||h?.crossBetween===null&&t.every(b=>b.kind==="area");return{axis:i,count:r,labels:f,serials:d?$r(l.slice(0,r),i,e.date1904):null,between:!y}}function $r(e,t,n){let r=a=>e.map(i=>{let s=n?i+1462:i<61?i+1:i,u=new Date(Math.round((s-25569)*864e5)),d=u.getUTCFullYear();return a==="years"?d:d*12+u.getUTCMonth()}),o=t?.baseTimeUnit??null;if(o==="days")return[...e];if(o!==null)return r(o);let l=new Set(e).size;for(let a of["years","months"]){let i=r(a);if(new Set(i).size===l)return i}return[...e]}function Be(e,t,n,r){let o=r-n;if(e.serials&&e.serials.length>0){let l=Math.min(...e.serials),a=Math.max(...e.serials),i=Math.max(1,a-l+(e.between?1:0)),s=(e.serials[t]??l)-l+(e.between?.5:0);return n+s/i*o}return e.between?n+(t+.5)/Math.max(1,e.count)*o:e.count<=1?n+o/2:n+t/(e.count-1)*o}function Ue(e,t){if(e.serials&&e.serials.length>1){let n=[...e.serials].sort((i,s)=>i-s),r=1/0;for(let i=1;i<n.length;i+=1){let s=n[i]-n[i-1];s>0&&(r=Math.min(r,s))}let o=n[0],l=n[n.length-1],a=Math.max(1,l-o+1);return Number.isFinite(r)?r/a*t:t/e.count}return t/Math.max(1,e.between?e.count:Math.max(1,e.count-1))}function Ve(e,t,n=!1){let r=t.grouping==="stacked"||t.grouping==="percentStacked";if(t.grouping==="percentStacked"&&t.kind!=="scatter"&&t.kind!=="bubble"){e.percent=!0;let o=!1;for(let l of t.series)for(let a of l.values)a!==null&&a<0&&(o=!0);e.dataMin=Math.min(e.dataMin,o?-1:0),e.dataMax=Math.max(e.dataMax,1);return}if(r&&t.kind!=="scatter"&&t.kind!=="bubble"){let o=Math.max(0,...t.series.map(l=>l.values.length));for(let l=0;l<o;l+=1){let a=0,i=0,s=0;for(let u of t.series){let d=u.values[l]??0;t.kind==="bar"?d>=0?a+=d:i+=d:(s+=d,a=Math.max(a,s),i=Math.min(i,s))}e.dataMin=Math.min(e.dataMin,i),e.dataMax=Math.max(e.dataMax,a)}return}for(let o of t.series){let l=n?o.xValues??o.values.map((a,i)=>i+1):o.values;for(let a of l)a===null||!Number.isFinite(a)||(e.dataMin=Math.min(e.dataMin,a),e.dataMax=Math.max(e.dataMax,a))}}function ze(e,t){let n=e.axis;return n&&!n.sourceLinked&&n.formatCode?n.formatCode:e.percent?"0%":t??n?.formatCode??null}function yn(e,t,n,r,o,l=!1){let a=e.dataMin>e.dataMax,i=a?0:e.dataMin,s=a?1:e.dataMax,u=e.axis,d=e.percent,f=ce(Math.max(Math.abs(i),Math.abs(s)),e.formatCode,o),h=Q(f,r);if(u?.logBase&&!d)return xn(i,s,u.logBase,u.min,u.max);let y=n?(l?zr:1.6)*r.sizePt:h+Vr*r.sizePt,b=Math.floor(t/y)+(d?1:0);return tt({dataMin:i,dataMax:s,lengthPt:Math.max(1,b)*y,minIntervalPt:y,fixedMin:u?.min??(d?i<0?-1:0:null),fixedMax:u?.max??(d?1:null),fixedMajor:u?.majorUnit??null,noHeadroom:l,roomOnly:l})}function kt(e,t,n,r,o){let l=pn(e,t);return o?r+(n-r)*l:n+(r-n)*l}var ke=he,Wr=16,Gr=128,bn={sizePt:10,bold:!1,italic:!1,underline:!1,colorHex:"000000",latin:"+mn-lt",eastAsian:"+mn-ea",complex:"+mn-cs"};function gn(e,t,n){let r=n?{...bn,themeFaces:n}:bn;return Ne(r,xt(e.txPr),t)}function ae(e,t,n,r={}){return Ne({...e,...r},xt(t),n)}function Ee(e,t,n,r,o){let l=P(e,"tx"),a=P(l,"rich");if(a){let s=[],u=0;for(let d of a.children){if(!ee(d)||d.ns!==ke||d.local!=="p")continue;if(s.length>=Wr)break;let f=J(d.children,{namespaceUri:ke,localName:"pPr"}),h=f?J(f.children,{namespaceUri:ke,localName:"defRPr"}):null,y=Ne(t,h,r),b=[];for(let x of d.children){if(!ee(x)||x.ns!==ke)continue;if(++u>Gr)break;if(x.local==="br"){s.push(b),b=[];continue}if(x.local!=="r"&&x.local!=="fld")continue;let g=J(x.children,{namespaceUri:ke,localName:"rPr"}),T=J(x.children,{namespaceUri:ke,localName:"t"}),A="";for(let M of T?.children??[])M.type==="text"&&(A+=M.value);x.local==="fld"&&o&&(A=o(Y(x.attrs,"type"),A)),b.push({text:A,style:Ne(y,g,r)})}s.push(b)}if(s.some(d=>d.some(f=>f.text.trim()!=="")))return s}let i=P(P(l,"strRef"),"strCache");if(i){let s=oe(i,"pt")[0],u="";for(let d of P(s,"v")?.children??[])d.type==="text"&&(u+=d.value);if(u.trim()!=="")return[[{text:u,style:t}]]}return n?[[{text:n,style:t}]]:[]}function Hr(e){let t=P(P(e,"layout"),"manualLayout"),n=i=>{let s=z(t,i),u=s!==void 0&&s.length<=32?Number(s):NaN;return Number.isFinite(u)&&Math.abs(u)<=10?u:null},r=n("x"),o=n("y");if(r===null&&o===null)return null;let l=z(t,"xMode")==="edge"&&r!==null,a=z(t,"yMode")==="edge"&&o!==null;return{x:r??0,y:o??0,xEdge:l,yEdge:a}}function Et(e,t){if(re(e,"delete",!1))return null;let n=P(e,"numFmt"),r=n?Y(n.attrs,"sourceLinked")==="1":!0,o=t?.separator??null,l=P(e,"separator");if(l){let a="";for(let i of l.children)i.type==="text"&&(a+=i.value);o=a.slice(0,16)}return{showValue:re(e,"showVal",t?.showValue??!1),showPercent:re(e,"showPercent",t?.showPercent??!1),showCategory:re(e,"showCatName",t?.showCategory??!1),showSeries:re(e,"showSerName",t?.showSeries??!1),separator:o,position:z(e,"dLblPos")??t?.position??null,formatCode:n&&!r?Y(n.attrs,"formatCode")??null:t?.formatCode??null,txPr:P(e,"txPr")??t?.txPr??null,spPr:P(e,"spPr")??t?.spPr??null,custom:null,moved:null}}function ge(e,t,n){let r=e.dLbls?Et(e.dLbls,null):null,o=t.dLbls?Et(t.dLbls,r):r,l=o;for(let s of oe(t.dLbls,"dLbl")){if(z(s,"idx")!==String(n))continue;let u=Et(s,o??r);l=u&&{...u,custom:P(s,"tx")?s:null,moved:Hr(s)};break}if(!l||!(l.showValue||l.showPercent||l.showCategory||l.showSeries)&&!l.custom)return null;let i=e.kind==="pie"||e.kind==="doughnut"||e.kind==="ofPie";return l.separator===null?{...l,separator:i?`
7
+ `:", "}:l}function rt(e,t,n){switch(n){case"VALUE":return ce(t.value,e.formatCode??t.seriesFormat,t.date1904);case"PERCENTAGE":return t.percent===null?"":ce(t.percent,e.formatCode&&e.formatCode.includes("%")?e.formatCode:"0%",t.date1904);case"CATEGORYNAME":return t.category??"";case"SERIESNAME":return t.seriesName??"";case"CELLRANGE":return t.cell??"";default:return null}}function ot(e,t){let n=[];return e.showSeries&&t.seriesName&&n.push(t.seriesName),e.showCategory&&t.category&&n.push(t.category),e.showValue&&n.push(rt(e,t,"VALUE")),e.showPercent&&t.percent!==null&&n.push(rt(e,t,"PERCENTAGE")),n.join(e.separator??", ")}var lt=class{components=[];points=0;ok=!0;path(t,n,r,o,l){if(!this.ok||!r&&!o)return;for(let s of t)for(let u of s)if(!Number.isFinite(u.x*12700)||!Number.isFinite(u.y*12700)){this.ok=!1;return}if(o&&o.dash&&!n&&!r){this.dashed(t,o,l);return}let a=t.filter(s=>s.length>=2);if(a.length===0)return;for(let s of a)this.points+=s.length;if(this.points>2e5){this.ok=!1;return}let i=o?Math.max(0,o.widthPt):0;this.components.push({subpaths:a,closed:n,fill:n?r:null,stroke:o&&i>0?{...o,widthPt:i}:null,...l?{join:l}:{}})}rect(t,n,r,o,l,a){let i=Math.min(t,t+r),s=Math.min(n,n+o),u=Math.max(t,t+r),d=Math.max(n,n+o);this.path([[{x:i,y:s},{x:u,y:s},{x:u,y:d},{x:i,y:d}]],!0,l,a)}line(t,n,r){n&&this.path([t],!1,null,n,r)}dashed(t,n,r){let o=Math.max(n.widthPt,.5),l=n.cap!=="butt",a=n.dash.map((s,u)=>{let d=s*o;return l?u%2===0?Math.max(.01,d-o):d+o:Math.max(.1,d)}),i=[];for(let s of t){let u=0,d=a[0],f=!0,h=[s[0]];for(let y=1;y<s.length;y+=1){let b=s[y-1],x=s[y],g=Math.hypot(x.x-b.x,x.y-b.y);for(;g>0&&i.length<2e3;){let T=Math.min(d,g),A=T/g,M={x:b.x+(x.x-b.x)*A,y:b.y+(x.y-b.y)*A};f&&h.push(M),g-=T,d-=T,b=M,d<=1e-9&&(f&&h.length>=2&&i.push(h),f=!f,u=(u+1)%a.length,d=a[u],h=[M])}}f&&h.length>=2&&i.push(h)}i.length>0&&this.path(i,!1,null,{...n,dash:null},r)}};function Lt(e,t,n,r,o=24){let l=[];for(let a=0;a<o;a+=1){let i=a/o*Math.PI*2;l.push({x:e+n*Math.cos(i),y:t+r*Math.sin(i)})}return l}function Cn(e,t,n,r,o,l){let a=Math.max(0,l-o);if(!Number.isFinite(a)||a>360+1e-6)throw new RangeError("Chart slice exceeds the angular limit");let i=Math.min(180,Math.max(2,Math.ceil(a/2))),s=(d,f)=>{let h=f*Math.PI/180;return{x:e+d*Math.sin(h),y:t-d*Math.cos(h)}},u=[];for(let d=0;d<=i;d+=1)u.push(s(n,o+a*d/i));if(r>0)for(let d=i;d>=0;d-=1)u.push(s(r,o+a*d/i));else a<360&&u.push({x:e,y:t});return u}function vt(e,t=10){if(e.length<3)return[...e];let n=[e[0]];for(let r=0;r<e.length-1;r+=1){let o=e[Math.max(0,r-1)],l=e[r],a=e[r+1],i=e[Math.min(e.length-1,r+2)],s={x:l.x+(a.x-o.x)/6,y:l.y+(a.y-o.y)/6},u={x:a.x-(i.x-l.x)/6,y:a.y-(i.y-l.y)/6};for(let d=1;d<=t;d+=1){let f=d/t,h=1-f;n.push({x:h*h*h*l.x+3*h*h*f*s.x+3*h*f*f*u.x+f*f*f*a.x,y:h*h*h*l.y+3*h*h*f*s.y+3*h*f*f*u.y+f*f*f*a.y})}}return n}function Le(e,t,n,r){let o=r/2;switch(e){case"square":return[[{x:t-o,y:n-o},{x:t+o,y:n-o},{x:t+o,y:n+o},{x:t-o,y:n+o}]];case"diamond":return[[{x:t,y:n-o},{x:t+o,y:n},{x:t,y:n+o},{x:t-o,y:n}]];case"triangle":return[[{x:t,y:n-o},{x:t+o,y:n+o},{x:t-o,y:n+o}]];case"dash":return[[{x:t-o,y:n-r*.1},{x:t+o,y:n-r*.1},{x:t+o,y:n+r*.1},{x:t-o,y:n+r*.1}]];case"dot":return[[{x:t,y:n-r*.12},{x:t+r*.55,y:n-r*.12},{x:t+r*.55,y:n+r*.12},{x:t,y:n+r*.12}]];case"x":case"star":case"plus":return[];default:return[Lt(t,n,o,o,16)]}}function ve(e,t,n,r){let o=r/2,l=[[{x:t-o,y:n-o},{x:t+o,y:n+o}],[{x:t-o,y:n+o},{x:t+o,y:n-o}]],a=[[{x:t-o,y:n},{x:t+o,y:n}],[{x:t,y:n-o},{x:t,y:n+o}]];return e==="x"?l:e==="plus"?a:e==="star"?[...l,a[1]]:[]}var Ae=he,Xr=12700,jr=new Map([["dash",[4,3]],["dashDot",[4,3,1,3]],["dot",[1,3]],["lgDash",[8,3]],["lgDashDot",[8,3,1,3]],["lgDashDotDot",[8,3,1,3,1,3]],["sysDash",[3,1]],["sysDashDot",[3,1,1,1]],["sysDashDotDot",[3,1,1,1,1,1]],["sysDot",[1,1]]]);function Kr(e,t){let n=J(e.children,{namespaceUri:Ae,localName:"gsLst"}),r=0,o=0,l=0,a=0,i=0;for(let u of n?.children??[]){if(!ee(u)||u.local!=="gs"||i>=16)continue;let d=u.children.find(ee),f=d?xe(d,t):null;f&&(r+=Number.parseInt(f.hex.slice(0,2),16),o+=Number.parseInt(f.hex.slice(2,4),16),l+=Number.parseInt(f.hex.slice(4,6),16),a+=f.alpha,i+=1)}return i===0?null:{hex:[r,o,l].map(u=>Math.round(u/i).toString(16).padStart(2,"0")).join("").toUpperCase(),alpha:a/i}}function Mn(e,t){let n=Gt(e,t);if(!n.present)return;if(n.color)return n.color;let r=J(e.children,{namespaceUri:Ae,localName:"gradFill"});if(r)return Kr(r,t);let o=J(e.children,{namespaceUri:Ae,localName:"pattFill"});if(o){let a=J(o.children,{namespaceUri:Ae,localName:"fgClr"})?.children.find(ee);return a?xe(a,t):null}return null}function ne(e,t){if(!e)return{fill:void 0,line:void 0};let n=Mn(e,t),r=J(e.children,{namespaceUri:Ae,localName:"ln"});if(!r)return{fill:n,line:void 0};let o=Mn(r,t),l=Wt(Y(r.attrs,"w")),a=Y(r.attrs,"cap"),i=J(r.children,{namespaceUri:Ae,localName:"prstDash"}),s=i?Y(i.attrs,"val"):void 0;return o===null?{fill:n,line:null}:{fill:n,line:o===void 0&&l===null&&s===void 0?void 0:{hex:o?.hex??"",alpha:o?.alpha??1,widthPt:l!==null?l/Xr:.75,cap:a==="rnd"?"round":a==="sq"?"square":"butt",dash:s?jr.get(s)??null:null}}}function ue(e,t){return e===null?null:e===void 0?t:e.hex!==""?e:t?{...e,hex:t.hex,alpha:t.alpha}:null}var Pn=[[],[["lumMod",6e4],["lumOff",4e4]],[["lumMod",6e4]],[["lumMod",8e4],["lumOff",2e4]],[["lumMod",8e4]],[["lumMod",5e4]],[["lumMod",7e4],["lumOff",3e4]],[["lumMod",7e4]],[["lumMod",5e4],["lumOff",5e4]]];function at(e,t,n){let r=mt("schemeClr",{val:e},t.map(([o,l])=>mt(o,{val:String(l)})));return xe(r,n)}function Sn(e,t,n,r){let o=(e-1)%8|0,l;if(o===1){let a=t%6+1,i=Pn[Math.floor(t/6)%Pn.length];l=at(`accent${a}`,i,r)}else{let a=o===0?"tx1":`accent${o-1}`,i=n>1?t/(n-1):.5,s=Math.round((n>1?.6+i*.8:1)*1e5),u=o===0?[["lumMod",Math.round((.2+i*.6)*1e5)],["lumOff",Math.round((.35+i*.4)*1e5)]]:s<=1e5?[["shade",s]]:[["tint",2e5-s]];l=at(a,u,r)}return l??{hex:"4472C4",alpha:1}}var kn=["diamond","square","triangle","x","star","circle","plus","dot","dash"];function it(e){return e.kind==="line"||e.kind==="scatter"||e.kind==="radar"&&e.radarStyle!=="filled"}function Ce(e){return e.varyColors&&e.series.length===1&&(e.kind==="pie"||e.kind==="doughnut"||e.kind==="bar"||e.kind==="ofPie")}function Yr(e,t,n,r,o){if(!it(e))return null;let l=t.marker,a=e.kind==="scatter"&&(e.scatterStyle==="line"||e.scatterStyle==="smooth");if(l?.symbol==="none")return null;let i=e.kind==="line"?e.markers:e.kind==="radar"?e.radarStyle==="marker":!a;if(!l?.symbol&&!i)return null;let s=l?.symbol??kn[o%kn.length],u=ne(l?.spPr??null,r.colors),d=u.fill===void 0?n:u.fill,f=ue(u.line,{...n,widthPt:.75,cap:"round",dash:null});return{symbol:s,size:l?.size??(l?.symbol?5:7),fill:d,line:f}}function de(e,t,n,r){let o=r!==void 0&&Ce(e),l=o?r.index:t.index,a=o?r.count:n.seriesCount,i=Sn(n.model.style,l,a,n.colors),s=ne(t.spPr,n.colors),u=r?t.points.get(r.index):void 0,d=u?ne(P(u,"spPr"),n.colors):{fill:void 0,line:void 0},f=o?void 0:s.fill,h=it(e),y=h?{...i,widthPt:2.25,cap:"round",dash:null}:null,b=h?null:d.fill!==void 0?d.fill:f!==void 0?f:i,x=ue(d.line!==void 0?d.line:s.line,y??(b?{...b,widthPt:.75,cap:"butt",dash:null}:null)),g=h||d.line!==void 0||s.line!==void 0?x:null,T=(h?g??null:b)??i;return{fill:b,line:g,marker:Yr(e,t,{hex:T.hex,alpha:T.alpha},n,l)}}var Zr=he,Jr=12700,Qr=.2,qr=3,eo=16;function Ln(e,t){for(let n of[P(P(e.custom,"tx"),"rich"),e.txPr]){let r=n?J(n.children,{namespaceUri:Zr,localName:"bodyPr"}):null,o=r?Y(r.attrs,t):void 0;if(o!==void 0)return o}}function En(e,t){let n=Ln(e,t);return n!==void 0&&/^\d{1,8}$/.test(n)?Number(n)/Jr:qr}function to(e,t){return t===null||!(t>0)||Ln(e,"wrap")==="none"?null:t*Qr-En(e,"lIns")-En(e,"rIns")}function no(e){let t=[];for(let n of e){let r=[];for(let o of n)for(let[l,a]of o.text.split(/\r\n|\r|\n/).entries())l>0&&(t.push(r),r=[]),a!==""&&r.push({text:a,style:o.style});t.push(r)}return t.slice(0,eo)}function ro(e,t){let n=[];for(let s of e)for(let u of s.text.match(/\S+|\s+/g)??[]){let d=Q(u,s.style);/^\s/.test(u)?n.length>0&&(n[n.length-1].space+=d):n.push({width:d,space:0})}if(n.length===0)return{count:1,widest:0,word:0};let r=1,o=0,l=0,a=0,i=0;for(let s of n)i=Math.max(i,s.width),l>0&&t!==null&&l+a+s.width>t?(o=Math.max(o,l),r+=1,l=s.width):l+=a+s.width,a=s.space;return{count:r,widest:Math.max(o,l),word:i}}function we(e,t,n,r,o){let l=ot(e,t),a=e.custom?Ee(e.custom,n,l,o,(y,b)=>rt(e,t,y)??b):[[{text:l,style:n}]],i=to(e,r),s=0,u=0,d=!1,f=0;for(let y of no(a)){let b=ro(y,i);s=Math.max(s,b.widest),f=Math.max(f,b.word),d||=b.count>1;let x=Math.max(q(n),...y.map(g=>q(g.style)));u+=b.count*x}let h=i!==null&&d?Math.max(i,f):s*1.3+n.sizePt*2;return{paragraphs:a,width:s,height:u,frame:h}}function st(e,t,n,r,o,l){if(!e||!t)return{x:n,y:r,moved:!1};let a=t.r-t.l,i=t.b-t.t;return{x:e.xEdge?t.l+e.x*a+o/2:n+e.x*a,y:e.yEdge?t.t+e.y*i+l/2:r+e.y*i,moved:!0}}var oo={hex:"FFFFFF",alpha:1};function wn(e,t,n,r,o,l){let{scene:a}=o,i=o.look,s=r.categories?.count??0,u=e.grouping==="percentStacked",d=e.grouping==="stacked"||u,f=[];if(u)for(let x=0;x<s;x+=1){let g=0;for(let T of e.series)g+=Math.abs(T.values[x]??0);f.push(g||1)}let h=(x,g)=>u?x/f[g]:x,y=(x,g)=>r.horizontal?{x:r.valueAt(t,g),y:r.categoryAt(x)}:{x:r.categoryAt(x),y:r.valueAt(t,g)},b=(x,g,T,A,M)=>{let S=ge(e,x,g);if(!S)return;let w=ae(o.baseText,S.txPr,i.colors),O=r.categories?.labels[g]??null,L={value:T,percent:u?T/f[g]:null,category:O,seriesName:x.name,seriesFormat:x.formatCode,date1904:o.model.date1904,cell:x.labelRange?.[g]??null};if(!S.custom&&ot(S,L)==="")return;let _=we(S,L,w,o.chartWidth,i.colors),k=_.width,$=_.height,G=_.frame,E=.48*w.sizePt,N=A.x,D=A.y;if(M.kind==="bar"){let C=S.position??(d?"ctr":"outEnd"),{start:m,end:v}=M,I=Math.sign(v.x-m.x)||1,p=Math.sign(v.y-m.y)||-1;if(C==="ctr")N=(m.x+v.x)/2,D=(m.y+v.y)/2;else if(r.horizontal)N=C==="inBase"?m.x+I*(E+k/2):C==="inEnd"?v.x-I*(E+k/2):v.x+I*(E+k/2),D=v.y;else{let R=C==="inBase"?m.y+p*(E+$/2):C==="inEnd"?v.y-p*(E+$/2):v.y+p*(E+$/2);N=v.x,D=R}}else{let C=S.position??(e.kind==="area"?"ctr":"r"),m=M.markerHalf+E;C==="r"?N=A.x+m+k/2:C==="l"?N=A.x-m-k/2:C==="t"?D=A.y-m-$/2:C==="b"&&(D=A.y+m+$/2)}let V={l:0,t:0,r:o.chartWidth,b:o.chartHeight},c=st(S.moved,V,N,D,k,$);l.push({paragraphs:_.paragraphs,align:"ctr",x:c.x-G/2,y:c.y-$/2,width:G,height:$,rotation:0})};if(e.kind==="bar"&&r.categories){let x=r.horizontal?r.plot.b-r.plot.t:r.plot.r-r.plot.l,g=Ue(r.categories,x),T=e.gapWidth/100,A=d?1:e.series.length,M=d?1:e.overlap/100,S=g/(A-(A-1)*M+T),w=[],O=[];for(let[L,_]of e.series.entries()){let k=Ce(e),$=de(e,_,i),G=[];for(let E=0;E<Math.min(s,_.values.length);E+=1){let N=_.values[E];if(N==null)continue;let D=h(N,E),V=n,c=D;if(d){let Z=D>=0?w:O;V=Z[E]??0,c=V+D,Z[E]=c}let C=r.categoryAt(E),m=-g/2+T*S/2+(d?0:L*S*(1-M)),v=r.horizontal?C-m:C+m,I=r.horizontal?v-S:v+S,p=r.valueAt(t,V),R=r.valueAt(t,c),F=k||_.points.has(E)?de(e,_,i,{index:E,count:_.values.length}):$,W=_.invertIfNegative&&D<0?oo:F.fill;r.horizontal?(a.rect(Math.min(p,R),Math.min(v,I),Math.abs(R-p),S,W,F.line),G.push({index:E,start:{x:p,y:(v+I)/2},end:{x:R,y:(v+I)/2},value:N})):(a.rect(Math.min(v,I),Math.min(p,R),S,Math.abs(R-p),W,F.line),G.push({index:E,start:{x:(v+I)/2,y:p},end:{x:(v+I)/2,y:R},value:N}))}for(let E of G)b(_,E.index,E.value,E.end,{kind:"bar",start:E.start,end:E.end})}return}if((e.kind==="line"||e.kind==="area")&&r.categories){let x=[],g=null;for(let T of e.series){let A=de(e,T,i),M=[],S=[];for(let w=0;w<s;w+=1){let O=T.values[w]??null;if(O===null&&(o.blanks==="zero"||e.kind==="area"||d)&&(O=0),O===null){M.push(null),S.push(0);continue}let L=h(O,w);d&&(L+=x[w]??0,x[w]=L),S.push(O),M.push(y(w,L))}if(e.kind==="area"){let w=M.filter(L=>L!==null),O=g??w.map(L=>r.horizontal?{x:r.valueAt(t,n),y:L.y}:{x:L.x,y:r.valueAt(t,n)});w.length>=2&&a.path([[...w,...[...O].reverse()]],!0,A.fill,A.line),d&&(g=w)}else{let w=[],O=[];for(let L of M){if(L===null){o.blanks!=="span"&&(O.length&&w.push(O),O=[]);continue}O.push(L)}if(O.length&&w.push(O),A.line)for(let L of w)a.line(T.smooth?vt(L):L,A.line,"round");vn(M,A.marker,a)}for(let[w,O]of M.entries())O&&b(T,w,S[w],O,{kind:"point",markerHalf:A.marker?A.marker.size/2:0})}e.kind==="line"&&io(e,t,r,o);return}if(e.kind==="scatter"&&r.xInfo?.scale)for(let x of e.series){let g=de(e,x,i),T=[];for(let S=0;S<x.values.length;S+=1){let w=x.values[S],O=x.xValues?x.xValues[S]:S+1;if(w==null||O===null||O===void 0){T.push(null);continue}T.push({x:r.valueAt(r.xInfo,O),y:r.valueAt(t,w)})}let A=T.filter(S=>S!==null);if(g.line!==null&&e.scatterStyle!=="marker"&&e.scatterStyle!=="none"&&A.length>=2){let S=x.smooth||e.scatterStyle==="smooth"||e.scatterStyle==="smoothMarker";a.line(S?vt(A):A,g.line,"round")}vn(T,g.marker,a);for(let[S,w]of T.entries())w&&b(x,S,x.values[S],w,{kind:"point",markerHalf:g.marker?g.marker.size/2:0})}}function vn(e,t,n){if(!t)return;let r=t.size*.96,o=[],l=[];for(let a of e)if(a){for(let i of Le(t.symbol,a.x,a.y,r))o.push(i);for(let i of ve(t.symbol,a.x,a.y,r))l.push(i)}o.length>0&&n.path(o,!0,t.fill,t.line),l.length>0&&n.path(l,!1,null,t.line)}var An={hex:"000000",alpha:1,widthPt:.75,cap:"butt",dash:null},lo={hex:"FFFFFF",alpha:1},ao={hex:"000000",alpha:1};function io(e,t,n,r){let o=n.categories;if(!o||e.series.length<2)return;let l=r.look.colors,a=(s,u)=>n.horizontal?{x:n.valueAt(t,u),y:n.categoryAt(s)}:{x:n.categoryAt(s),y:n.valueAt(t,u)};if(e.hiLowLines){let s=ue(ne(P(e.hiLowLines,"spPr"),l).line,An),u=[];for(let d=0;d<o.count;d+=1){let f=e.series.map(h=>h.values[d]).filter(h=>h!=null);f.length<2||u.push([a(d,Math.min(...f)),a(d,Math.max(...f))])}s&&u.length>0&&r.scene.path(u,!1,null,s)}let i=e.upDownBars;if(i){let s=(Number(z(i,"gapWidth")??150)||150)/100,d=Ue(o,n.horizontal?n.plot.b-n.plot.t:n.plot.r-n.plot.l)/(1+s),f=(g,T)=>{let A=ne(P(P(i,g),"spPr"),l);return{fill:A.fill===void 0?T:A.fill,line:ue(A.line,An)}},h=f("upBars",lo),y=f("downBars",ao),b=e.series[0],x=e.series[e.series.length-1];for(let g=0;g<o.count;g+=1){let T=b.values[g],A=x.values[g];if(T==null||A===null||A===void 0)continue;let M=a(g,T),S=a(g,A),w=A>=T?h:y;n.horizontal?r.scene.rect(Math.min(M.x,S.x),M.y-d/2,Math.abs(S.x-M.x),d,w.fill,w.line):r.scene.rect(M.x-d/2,Math.min(M.y,S.y),d,Math.abs(S.y-M.y),w.fill,w.line)}}}var so=4096,uo=3.1,co=2.3,Tt=5e3,$e=.08,Tn=.91,Te=.64,At=4.5,fo=7,On={hex:"000000",alpha:1,widthPt:.5,cap:"butt",dash:null};function le(e){return e==="l"||e==="r"}function ho(e,t){if(!e)return null;let n=ne(e.spPr,t.look.colors);return ue(n.line,On)}function mo(e,t){if(!e)return null;let n=ne(P(e,"spPr"),t.look.colors);return ue(n.line,On)}function wt(e,t){let n=e.value;return n.scale?n.scale.ticks.map(r=>ce(Math.abs(r)<n.scale.major*1e-9?0:r,n.formatCode,t.date1904)):[]}function Rn(e,t){let n=0;for(let r of e)n=Math.max(n,Q(r,t));return n}function _n(e,t,n){let r=Q(" ",t),o=1,l=0;for(let a of e.split(/\s+/).slice(0,256)){let i=Q(a,t);l>0&&l+r+i>n?(o+=1,l=i):l+=(l>0?r:0)+i}return o}function Dn(e,t,n){let{model:r}=n,o=c=>c.kind==="scatter"||c.kind==="bubble",l=e.filter(o),a=e.filter(c=>!o(c));if(l.length>0&&a.length>0)return!1;let i=a.some(c=>c.kind==="bar"&&c.horizontal);if(i&&a.some(c=>c.kind!=="bar"||!c.horizontal))return!1;let s=n.look.colors,u=new Map,d=c=>{let C=c?.id??"",m=u.get(C);return m||(m={axis:c,id:C,dataMin:1/0,dataMax:-1/0,percent:!1,scale:null,formatCode:null},u.set(C,m)),m},f=new Map,h=null;for(let c of e){let C=d(be(r,c,"value"));if(Ve(C,c),C.formatCode??=c.series.find(m=>m.formatCode)?.formatCode??null,f.set(c,C),o(c)){let m=be(r,c,"x");h??={axis:m,id:`x:${m?.id??""}`,dataMin:1/0,dataMax:-1/0,percent:!1,scale:null,formatCode:null},Ve(h,c,!0)}}for(let c of u.values())c.formatCode=ze(c,c.formatCode);h&&(h.formatCode=ze(h,null));let y=a.length>0?nt(r,a,so):null,b=[],x=c=>ae(n.baseText,c?.txPr??null,s),g=c=>c!==null&&!c.deleted,T=c=>g(c)&&c.tickLabelPosition!=="none";if(y){let c=y.axis;b.push({axis:c,role:"category",side:i?c?.position==="r"?"r":"l":c?.position==="t"?"t":"b",style:x(c),labelled:T(c),value:null,title:null})}else h&&b.push({axis:h.axis,role:"x",side:h.axis?.position==="t"?"t":"b",style:x(h.axis),labelled:T(h.axis),value:h,title:null});let A=!0;for(let c of u.values()){let C=c.axis,m=i?A?"b":"t":A?"l":"r",v=C?.position??m;b.push({axis:C,role:"value",side:i?v==="t"?"t":"b":v==="r"?"r":"l",style:x(C),labelled:T(C),value:c,title:null}),A=!1}for(let c of b){if(!g(c.axis)||!c.axis.title)continue;let C=ae(n.baseText,P(c.axis.title,"txPr"),s,{bold:!0}),m=Ee(c.axis.title,C,"Axis Title",s);if(m.length===0)continue;let v=P(P(c.axis.title,"tx"),"rich");c.title={paragraphs:m,style:C,rotation:Oe(v??P(c.axis.title,"txPr"))}}let M=b.find(c=>c.role==="category")??null,S=r.plotLayout,w=b.find(c=>c.role==="value")??null,O=()=>{if(S&&S.inner){let p=n.chartWidth,R=n.chartHeight;return{plot:{l:S.x*p,t:S.y*R,r:(S.x+S.w)*p,b:(S.y+S.h)*R},categoryRotation:0,categorySkip:1,categoryWrap:0}}let c=S&&!S.inner?{l:S.x*n.chartWidth,t:S.y*n.chartHeight,r:(S.x+S.w)*n.chartWidth,b:(S.y+S.h)*n.chartHeight}:{...t};for(let p of b){if(!p.title)continue;let R=Fe(p.title.paragraphs,p.title.style)+9;p.side==="l"?c.l+=R:p.side==="r"?c.r-=R:p.side==="t"?c.t+=R:c.b-=R}for(let p of b){if(!p.labelled||!le(p.side))continue;let R=p.value?wt(p,r):y?.labels??[],F=p.value?ce(p.value.dataMax>-1/0?p.value.dataMax:1,p.value.formatCode,r.date1904):"",W=Rn(R.length?R:[F],p.style)+Tn*p.style.sizePt-At;p.side==="l"?c.l+=W:c.r-=W}let C=0;for(let p of b){if(!p.labelled||!p.value||!le(p.side))continue;let R=q(p.style)/2+$e*p.style.sizePt;C=Math.max(C,R-fo)}c.t+=C;let m=0,v=1,I=0;for(let p of b){if(!p.labelled||le(p.side))continue;let R=p.style.sizePt,F=q(p.style)+Te*R-At;if(p.role==="category"&&y){let W=Ue(y,c.r-c.l),Z=Rn(y.labels,p.style),H=Oe(p.axis?.txPr??null),te=y.labels.every(B=>B.split(/\s+/).slice(0,256).every(X=>Q(X,p.style)<=W*.98));if(H!==null&&H!==0?m=H:Z>W*.98&&y.count>1&&(te?I=W:m=-45),I>0){let B=Math.max(...y.labels.map(X=>_n(X,p.style,I)));F+=(B-1)*q(p.style)}if(m!==0){let B=Math.abs(m)*Math.PI/180;F=Z*Math.sin(B)+q(p.style)*Math.cos(B)+Te*R-At;let X=q(p.style)/Math.sin(B);v=Math.max(1,Math.ceil(X/Math.max(W,1e-6)))}p.axis?.tickLabelSkip&&(v=p.axis.tickLabelSkip),w?.value?.scale&&In(p,w.value.scale)&&(F=0)}p.side==="t"?c.t+=F:c.b-=F}for(let p of b){if(!p.labelled||le(p.side)||!p.value)continue;let R=wt(p,r);R.length>0&&(c.r-=Q(R[R.length-1],p.style)/2)}return{plot:c,categoryRotation:m,categorySkip:v,categoryWrap:I}},L=c=>{for(let C of b){if(!C.value)continue;let m=le(C.side)?c.b-c.t:c.r-c.l;C.value.scale=yn(C.value,Math.max(1,m),le(C.side),C.style,r.date1904)}},_=O();L(_.plot),_=O(),L(_.plot);let k=_.plot;if(!(k.r-k.l>1)||!(k.b-k.t>1))return!0;let $=M?.axis?.reversed??!1,G=c=>y?i?$?Be(y,c,k.t,k.b):Be(y,c,k.b,k.t):$?Be(y,c,k.r,k.l):Be(y,c,k.l,k.r):0,E=(c,C)=>{let m=c.scale,v=c.axis?.reversed??!1;return i||c===h?kt(m,C,k.l,k.r,v):kt(m,C,k.b,k.t,v)},N=(c,C)=>{let m=C?.crosses??"autoZero";if(m==="min")return c.min;if(m==="max")return c.max;let v=typeof m=="number"?m:0;return Math.min(c.max,Math.max(c.min,v))},D=ne(r.plotSpPr,s);n.scene.rect(k.l,k.t,k.r-k.l,k.b-k.t,D.fill??null,D.line??null);for(let c of b)if(!(!c.axis||c.axis.deleted&&!c.axis.majorGridlines))for(let[C,m]of[[c.axis.minorGridlines,!0],[c.axis.majorGridlines,!1]]){let v=mo(C,n);if(!v)continue;let I=[];if(c.value?.scale){let p=c.value.scale;for(let R of po(p,m,Nn(p,c.axis))){let F=E(c.value,R);I.push(le(c.side)?[{x:k.l,y:F},{x:k.r,y:F}]:[{x:F,y:k.t},{x:F,y:k.b}])}}else if(y&&!m){let p=y.between?y.count+1:y.count;for(let R=0;R<p;R+=1){let F=y.between?G(R)-(G(1)-G(0))/2:G(R);I.push(le(c.side)?[{x:k.l,y:F},{x:k.r,y:F}]:[{x:F,y:k.t},{x:F,y:k.b}])}}I.length>0&&n.scene.path(I,!1,null,v)}let V=[];for(let c of e){let C=f.get(c);if(!C.scale)continue;let m=N(C.scale,M?.axis??null);wn(c,C,m,{categoryAt:G,valueAt:E,categories:y,horizontal:i,xInfo:h,plot:k},n,V)}for(let c of b){if(!g(c.axis))continue;let C=ho(c.axis,n);if(!C)continue;let m;if(c.role==="category"||c.role==="x"){let B=w?.value;m=B?.scale?E(B,N(B.scale,c.axis)):le(c.side)?k.l:k.b}else{let X=c.axis.crosses==="max";m=le(c.side)?c.side==="r"||X?k.r:k.l:c.side==="t"||X?k.t:k.b,h?.scale&&c.value!==h&&!i&&(m=E(h,N(h.scale,c.axis)))}let v=le(c.side)?[{x:m,y:k.t},{x:m,y:k.b}]:[{x:k.l,y:m},{x:k.r,y:m}];n.scene.line(v,C);let I=c.axis.majorTickMark,p=c.side==="l"||c.side==="t"?-1:1,R=[];if(c.value?.scale)for(let B of c.value.scale.ticks)R.push(E(c.value,B));else if(y){let B=y.between?y.count+1:y.count;for(let X=0;X<B;X+=1)R.push(y.between?G(X)-(G(1)-G(0))/2:G(X))}let F=(B,X)=>ie=>{let fe=B==="cross"?-X:0,se=B==="in"?-X:X;return le(c.side)?[{x:m+p*fe,y:ie},{x:m+p*se,y:ie}]:[{x:ie,y:m+p*fe},{x:ie,y:m+p*se}]},W=c.axis.minorTickMark,Z=[],H=c.value?.scale,te=H?Nn(H,c.axis):0;if(W!=="none"&&H&&H.logBase===void 0&&te>0){let B=Math.min(Tt,Math.floor((H.max-H.min)/te+1e-9));for(let X=0;X<=B;X+=1)Z.push(E(c.value,H.min+X*te))}else if(W!=="none"&&!H&&y?.between)for(let B=0;B<Math.min(y.count,Tt);B+=1)Z.push(G(B));Z.length>0&&n.scene.path(Z.map(F(W,co)),!1,null,C),!(I==="none"||R.length===0)&&n.scene.path(R.map(F(I,uo)),!1,null,C)}for(let c of V)n.labels.push(c);for(let c of b){if(!c.labelled)continue;let C=c.style.sizePt,m=q(c.style),v=Tn*C;if(c.value?.scale){let p=wt(c,r);for(let[R,F]of c.value.scale.ticks.entries()){let W=p[R],H=Q(W,c.style)*1.3+C*2,te=E(c.value,F);if(le(c.side)){let B=c.side==="l";n.labels.push({paragraphs:[[{text:W,style:c.style}]],align:B?"r":"l",x:B?k.l-v-H:k.r+v,y:te-m/2-$e*C,width:H,height:m,rotation:0})}else{let B=c.side==="b"?k.b+Te*C:k.t-Te*C-m;n.labels.push({paragraphs:[[{text:W,style:c.style}]],align:"ctr",x:te-H/2,y:B,width:H,height:m,rotation:0})}}continue}if(!y)continue;let I=w?.value?.scale&&In(c,w.value.scale)?E(w.value,N(w.value.scale,c.axis)):null;for(let p=0;p<y.count;p+=_.categorySkip){let R=y.labels[p];if(R==="")continue;let W=Q(R,c.style)*1.3+C*2,Z=G(p);if(le(c.side)){let fe=I??(c.side==="l"?k.l:k.r),se=c.side==="l";n.labels.push({paragraphs:[[{text:R,style:c.style}]],align:se?"r":"l",x:se?fe-v-W:fe+v,y:Z-m/2-$e*C,width:W,height:m,rotation:0});continue}let H=I??(c.side==="b"?k.b:k.t),te=c.side==="b"?H+Te*C:H-Te*C-m;if(_.categoryRotation!==0){let fe=_.categoryRotation*Math.PI/180,se=W/2,Pe=Z,He=te+m/2,Xe=Pe-se*Math.cos(fe),_e=He-se*Math.sin(fe);n.labels.push({paragraphs:[[{text:R,style:c.style}]],align:"r",x:Xe-se,y:_e-m/2,width:W,height:m,rotation:_.categoryRotation});continue}let B=_.categoryWrap,X=B>0?_n(R,c.style,B):1,ie=B>0?B:W;n.labels.push({paragraphs:[[{text:R,style:c.style}]],align:"ctr",x:Z-ie/2,y:c.side==="b"?te:te-(X-1)*m,width:ie,height:m*X,rotation:0})}}for(let c of b){if(!c.title)continue;let C=c.title.style,m=Fe(c.title.paragraphs,C),I=Ke(c.title.paragraphs)*1.3+C.sizePt*2;if(le(c.side)){let p=c.title.rotation??-90,R=c.side==="l"?t.l+1.5+m/2:t.r-1.5-m/2,F=(k.t+k.b)/2,W=Math.abs(Math.abs(p)-90)<1;n.labels.push({paragraphs:c.title.paragraphs,align:"ctr",x:R-I/2,y:F-m/2,width:I,height:m,rotation:p})}else{let p=c.side==="b"?t.b-1.4-m:t.t+1.5;n.labels.push({paragraphs:c.title.paragraphs,align:"ctr",x:(k.l+k.r)/2-I/2,y:p,width:I,height:m,rotation:c.title.rotation??0})}}return!0}function In(e,t){return e.role!=="category"||e.axis?.tickLabelPosition!=="nextTo"||e.axis.crosses!=="autoZero"?!1:t.min<0&&t.max>0}function Nn(e,t){let n=t.minorUnit;return n!==null&&n>0&&(e.max-e.min)/n<=Tt?n:e.major>0?e.major/5:0}function po(e,t,n){let r=[];if(e.logBase!==void 0){if(!t)return[...e.ticks];let l=Math.min(Math.floor(e.logBase),100);for(let a of e.ticks)for(let i=2;i<l&&r.length<1e3;i+=1)a*i<e.max&&r.push(a*i);return r}let o=t?n:e.major;if(!(o>0))return r;for(let l=0,a=e.min;a<=e.max+o*1e-9&&l<1e3;l+=1,a=e.min+l*o)r.push(a);return r}var Fn=256;function Un(e,t,n){let r=[],o=t.position==="l"||t.position==="r"||t.position==="tr";for(let l of e.plots){let a=[],i=it(l),s=e.plots.length===1&&l.series.length===1,u=Ce(l);if(u||s&&l.series[0].points.size>0&&!i){let d=l.series[0],f=d.values.length;for(let h=0;h<f&&h<Fn;h+=1){let y=et(d,h,e.date1904)??String(h+1),b=u||d.points.has(h)?{index:h,count:f}:void 0;a.push({text:y,look:de(l,d,n,b),line:i,point:!0})}}else{for(let d of l.series){if(a.length>=Fn)break;a.push({text:d.name??`Series${d.index+1}`,look:de(l,d,n),line:i,round:l.kind==="bubble"})}xo(l,o)&&a.reverse()}for(let d of a)r.push(d)}return r.filter((l,a)=>!t.deleted.has(a))}function xo(e,t){let n=e.grouping==="stacked"||e.grouping==="percentStacked";return e.kind==="bar"&&e.horizontal?e.grouping==="clustered":t?n&&(e.kind==="bar"||e.kind==="area"||e.kind==="line"):!1}function We(e,t){if(e.line&&e.look.line){let l=6.43+.386*t;return{key:Bn,text:Bn+2.03,after:l,shift:1.76,gap:15.66}}let n=.55*t,r=n+Math.max(0,.275*t-.4),o=(e.point?1.615:1.65)*t-r;return{key:n,text:r,after:o,shift:.55+.138*t,gap:13.25+n/2}}var Bn=19.2,yo=5.85,Rt=.27;function bo(e){return 9+.6045*e}function go(e){return 14.2+.59*e}var Me=11,Co=16.5;function Vn(e,t,n,r,o,l){let a=n.sizePt,i=q(n),s={...l},u=[],d=yt(n);if(t.length===0)return{layout:{items:u},plot:s};let f=e.layout;if(e.position==="b"||e.position==="t"){let L=r-20,_=[[]],k=0;for(let c of t){let C=We(c,a),m=C.text+Q(c.text,n),v=_[_.length-1],I=v.length>0?v[v.length-1].after:0;k+I+m>L&&v.length>0?(_.push([]),k=0):k+=I,k+=m,_[_.length-1].push({entry:c,width:m,after:C.after})}let $=1.84*a,G=bo(a),E=e.position==="b"?o-G-(_.length-1)*$:l.t-Me+G,N=We(t[0],a).shift,D=E+(_.length-1)*$,V=f?f.y*o:null;for(let[c,C]of _.entries()){let m=C.reduce((p,R,F)=>p+R.width+(F>0?C[F-1].after:0),0),v=f?f.x*r:r/2+N-m/2,I=V===null?E+c*$+Rt*a:V+c*$+d;for(let p of C)u.push({entry:p.entry,x:v,baseline:I}),v+=p.width+p.after}if(!e.overlay&&!f){let c=go(a);e.position==="b"?s.b=Math.min(s.b,E-c):s.t=Math.max(s.t,D+c)}return{layout:{items:u},plot:s}}let h=i+yo,y=Math.max(...t.map(L=>Q(L.text,n))),b=Math.max(...t.map(L=>We(L,a).text)),x=f&&f.h>0?f.h*o:o-20,g=Math.max(1,Math.floor((x-i)/h)+1),T=t.slice(0,g),A=i+(T.length-1)*h,M=f?f.x*r:e.position==="l"?10.7:r-10-y-b,S=(l.t+o-Me)/2,w=f?f.y*o+Math.max(0,(x-A)/2):e.position==="tr"?l.t:S-A/2,O=!f&&e.position!=="tr";for(let[L,_]of T.entries()){let k=O?S+(L-(T.length-1)/2)*h+Rt*a:w+L*h+d;u.push({entry:_,x:M,baseline:k})}if(!e.overlay&&!f)if(e.position==="l")s.l=Math.max(s.l,M+b+y+Co);else{let L=Math.max(...t.map(_=>We(_,a).gap));s.r=Math.min(s.r,M-L)}return{layout:{items:u},plot:s}}function zn(e,t,n,r){let o=t.sizePt,l=q(t);for(let a of e.items){let{entry:i}=a,s=We(i,o),u=a.baseline-Rt*o;if(i.line){i.look.line&&n.line([{x:a.x,y:u},{x:a.x+s.key,y:u}],i.look.line,"round");let h=i.look.marker;if(h){let y=a.x+s.key/2;n.path(Le(h.symbol,y,u,h.size*.96),!0,h.fill,h.line);for(let b of ve(h.symbol,y,u,h.size*.96))n.line(b,h.line)}}else if(i.round){let h=s.key/2;n.path([Lt(a.x+h,u,h,h)],!0,i.look.fill,i.look.line)}else{let h=s.key/2;n.rect(a.x,u-h,s.key,s.key,i.look.fill,i.look.line)}let d=a.x+s.text,f=Q(i.text,t);r.push({paragraphs:[[{text:i.text,style:t}]],align:"l",x:d,y:a.baseline-yt(t),width:f*1.3+o*2,height:l,rotation:0})}}function Mo(e,t,n){let r=e.series[t],o=r.points.get(n),l=o?z(o,"explosion"):void 0,a=l!==void 0&&/^\d{1,3}$/.test(l)?Number(l):NaN;return a>=0&&a<=400?a:r.explosion}var $n=.85,Wn=.5,Gn=.16,Po=.75;function So(e){return e*ko+Eo}var ko=.123,Eo=3.5,ut=10,Hn={hex:"A6A6A6",alpha:1,widthPt:.75,cap:"butt",dash:null};function Lo(e,t){let r=P(e,"leaderLines");if(!r)for(let l of oe(P(e,"extLst"),"ext"))for(let a of l.children)ee(a)&&a.local==="leaderLines"&&(r=a);let o=ne(P(r,"spPr"),t.look.colors);return ue(o.line,Hn)??Hn}function vo(e,t,n){return((e-t)%360+360)%360<=n}function Ao(e,t,n,r,o){if(o.sweep>=359.9)return!0;for(let[l,a]of[[-1,-1],[1,-1],[1,1],[-1,1]]){let i=e+l*n*$n/2-o.cx,s=t+a*r*$n/2-o.cy,u=Math.hypot(i,s);if(u>o.outer||u<o.inner)return!1;let d=Math.atan2(i,-s)*180/Math.PI;if(!vo(d,o.from,o.sweep))return!1}return!0}function jn(e,t,n){let r=e.series.filter(g=>g.values.some(T=>T!==null&&T>0));if(r.length===0)return;let o=e.kind==="doughnut",l=o?r:r.slice(0,1),a=l.some(g=>g.values.some((T,A)=>{let M=ge(e,g,A);return M!==null&&M.position!=="inEnd"&&M.position!=="ctr"})),i=Math.min(t.r-t.l,t.b-t.t),s=a&&!n.placed?So(i):0,u=Math.max(1,i-s),d=(t.l+t.r)/2,f=(t.t+t.b)/2,h=(g,T)=>{let A=o?g*e.holeSize/100:0,M=(g-A)/l.length,S=[];for(let[w,O]of l.entries()){let L=O.values.reduce((E,N)=>E+(N!==null&&N>0?N:0),0);if(!Number.isFinite(L))return n.scene.ok=!1,[];if(!(L>0))continue;let _=o?A+w*M:0,k=o?_+M:g,$=e.firstSliceAngle,G=O.values.length;for(let E=0;E<G;E+=1){let N=O.values[E];if(N==null||!(N>0))continue;let D=N/L*360,V=$+D/2,c=Mo(e,e.series.indexOf(O),E)/100*g,C=V*Math.PI/180,m=d+c*Math.sin(C),v=f-c*Math.cos(C),I=de(e,O,n.look,Ce(e)||O.points.has(E)?{index:E,count:G}:void 0);T&&n.scene.path([Cn(m,v,k,_,$,$+D)],!0,I.fill,I.line,"round");let p=ge(e,O,E);if(p){let R=ae(n.baseText,p.txPr,n.look.colors),F={value:N,percent:N/L,category:et(O,E,n.date1904),seriesName:O.name,seriesFormat:O.formatCode,date1904:n.date1904,cell:O.labelRange?.[E]??null},W=we(p,F,R,n.bounds?n.bounds.r-n.bounds.l:null,n.look.colors),Z=W.width,H=W.height,te=Math.sin(C),B=Math.cos(C),X=Z/2*Math.abs(te)+H/2*Math.abs(B),ie=p.position??(o?"ctr":"bestFit"),fe={cx:m,cy:v,inner:_,outer:k,from:$,sweep:D},se=ie==="ctr"||o?(_+k)/2:k-X-4,Pe=ie==="outEnd";ie==="bestFit"&&(Pe=!Ao(m+se*te,v-se*B,Z,H,fe));let He=Pe?k+X+(ie==="outEnd"?6:0):se,Xe=W.frame,_e=st(p.moved,n.bounds,m+He*te,v-He*B,Z,H);_e.moved&&(Pe=!1);let ft=_e.x,ht=_e.y;S.push({label:{paragraphs:W.paragraphs,align:"ctr",x:ft-Xe/2,y:ht-H/2,width:Xe,height:H,rotation:0},anchor:{x:m+k*te,y:v-k*B},outside:Pe,right:te>=0,cx:ft,cy:ht,naturalX:ft,naturalY:ht,angle:V,middle:V,origin:{x:m,y:v},reach:k+(ie==="outEnd"?6:0),drift:0,lineHeight:q(R),size:R.sizePt,width:Z,height:H})}$+=D}}return S},y=u/2;for(let g=0;g<3&&!n.placed;g+=1){let T=0;for(let A of h(y,!1))A.outside&&(T=Math.max(T,A.cx+A.width/2-(t.r+ut),t.l-ut-(A.cx-A.width/2),t.t-ut-(A.cy-A.height/2),A.cy+A.height/2-(t.b+ut)));if(T<=.5)break;y=Math.max(u/4,y-T)}let b=h(y,!0);Oo(b,n.avoid??[],n.bounds??null);let x=Lo(l[0]?.dLbls??e.dLbls,n);for(let g of b){let T={...g.label,x:g.label.x+(g.cx-g.naturalX),y:g.cy-g.height/2};n.labels.push(T);let A=Ge(g),M=Math.max(A.l-g.anchor.x,0,g.anchor.x-A.r),S=Math.max(A.t-g.anchor.y,0,g.anchor.y-A.b),w=Math.hypot(g.cx-g.naturalX,g.cy-g.naturalY);g.outside&&w>1&&Math.hypot(M,S)>Po*g.size&&n.scene.line(wo(g,f),x)}}function wo(e,t){let n=e.cy-e.height/2,r=Math.max(1,Math.round(e.height/e.lineHeight)),o=e.cy<t?r-1:0,l=n+(o+1)*e.lineHeight-.35*e.size,a=e.cx-e.width/2,i=e.cx+e.width/2,s=e.anchor.x<e.cx,u=s?a-Gn*e.size:i+Gn*e.size,d=s?u-Wn*e.size:u+Wn*e.size;return[{x:e.anchor.x,y:e.anchor.y},{x:d,y:l},{x:u,y:l}]}function Xn(e,t){return e.l<t.r&&t.l<e.r&&e.t<t.b&&t.t<e.b}function Ge(e,t=0){let n=t*e.size;return{l:e.cx-e.width/2-n,r:e.cx+e.width/2+n,t:e.cy-e.height/2,b:e.cy+e.height/2}}var _t=.25,To=.5,Ro=150,_o=1e3;function Io(e){let t=e.angle*Math.PI/180,n=Math.sin(t),r=Math.cos(t),o=e.width/2*Math.abs(n)+e.height/2*Math.abs(r);e.cx=e.origin.x+(e.reach+o)*n,e.cy=e.origin.y-(e.reach+o)*r}function No(e,t,n,r){let o=Math.atan2((t.l+t.r)/2-n,r-(t.t+t.b)/2)*180/Math.PI;return((e.angle-o)%360+540)%360-180>=0?1:-1}function Oo(e,t,n){let r=e.filter(u=>u.outside);if(r.length===0)return;let o=[...t];for(let u of e)u.outside||o.push(Ge(u));let l=r[0].origin.x,a=r[0].origin.y,i=u=>n!==null&&(u.l<n.l||u.r>n.r||u.t<n.t||u.b>n.b),s=(u,d)=>{let f=u.angle+d*To;return Math.abs(f-u.middle)>Ro?!1:(u.angle=f,u.drift=d,Io(u),!0)};for(let u=0;u<_o;u+=1){let d=!1,f=[...r].sort((y,b)=>(y.angle%360+360)%360-(b.angle%360+360)%360),h=f.length>2?f.length:f.length-1;for(let y=0;y<h;y+=1){let b=f[y],x=f[(y+1)%f.length];Xn(Ge(b,_t),Ge(x,_t))&&(d=s(b,-1)||d,d=s(x,1)||d)}for(let y of r){let b=Ge(y,_t),x=o.find(g=>Xn(b,g));if(x)d=s(y,y.drift||No(y,x,l,a))||d;else if(i(b)){let g=b.t<n.t?0:b.b>n.b?180:b.l<n.l?270:90,T=((y.angle-g)%360+540)%360-180;d=s(y,y.drift||(T>=0?1:-1))||d}}if(!d)break}}var Do=1024;function Fo(e){return Math.max(0,.9275*e-5.25)}var Bo=.04,Uo=.08,Vo=1,zo={hex:"000000",alpha:1,widthPt:.5,cap:"butt",dash:null};function Kn(e,t,n){let{model:r,scene:o}=n,l=n.look.colors,a=nt(r,e,Do),i=a.count;if(i<1)return;let s=be(r,e[0],"value"),u=a.axis,d={axis:s,id:s?.id??"",dataMin:1/0,dataMax:-1/0,percent:!1,scale:null,formatCode:null};for(let E of e)Ve(d,E);d.formatCode=ze(d,e[0].series.find(E=>E.formatCode)?.formatCode??null);let f=ae(n.baseText,s?.txPr??null,l),h=ae(n.baseText,u?.txPr??null,l),y=q(h),b=Math.max(0,...a.labels.map(E=>Q(E,h))),x=u!==null&&!u.deleted&&u.tickLabelPosition!=="none",g=Fo(h.sizePt),T=Math.max(1,Math.min((t.b-t.t)/2-(x?y/2+g:0),(t.r-t.l)/2-(x?b+g:0))),A=(t.l+t.r)/2,M=(t.t+t.b)/2,S=d.dataMin>d.dataMax,w=tt({dataMin:S?0:d.dataMin,dataMax:S?1:d.dataMax,lengthPt:T,minIntervalPt:1.6*f.sizePt,fixedMin:s?.min??null,fixedMax:s?.max??null,fixedMajor:s?.majorUnit??null,noHeadroom:!0}),O=w.max-w.min||1,L=(E,N)=>{let D=E/i*Math.PI*2,V=(N-w.min)/O*T;return{x:A+V*Math.sin(D),y:M-V*Math.cos(D)}},_=E=>E?ue(ne(P(E,"spPr"),l).line,zo):null,k=_(s?.majorGridlines??null);if(k){let E=[];for(let N of w.ticks){if(N<=w.min)continue;let D=[];for(let V=0;V<i;V+=1)D.push(L(V,N));E.push(D)}o.path(E,!0,null,k)}let $=_(u?.majorGridlines??null);if($){let E=[];for(let N=0;N<i;N+=1)E.push([{x:A,y:M},L(N,w.max)]);o.path(E,!1,null,$)}let G=[];for(let E of e){let N=E.radarStyle==="filled";for(let D of E.series){let V=de(E,D,n.look),c=[];for(let v=0;v<i;v+=1){let I=D.values[v];c.push(I==null?null:L(v,I))}let C=c.filter(v=>v!==null);N?C.length>=3&&o.path([C],!0,V.fill,V.line):V.line&&C.length>=2&&o.path([C],C.length===i&&C.length>=3,null,V.line,"round");let m=N?null:V.marker;if(m){let v=m.size*.96,I=[],p=[];for(let R of C){for(let F of Le(m.symbol,R.x,R.y,v))I.push(F);for(let F of ve(m.symbol,R.x,R.y,v))p.push(F)}I.length&&o.path(I,!0,m.fill,m.line),p.length&&o.path(p,!1,null,m.line)}for(let[v,I]of c.entries()){let p=I?ge(E,D,v):null;if(!p||!I)continue;let R=ae(n.baseText,p.txPr,l),F={value:D.values[v],percent:null,category:a.labels[v]??null,seriesName:D.name,seriesFormat:D.formatCode,date1904:r.date1904,cell:D.labelRange?.[v]??null},W=we(p,F,R,null,l),Z=W.height,H=W.frame;G.push({paragraphs:W.paragraphs,align:"ctr",x:I.x-H/2,y:I.y-Z-2,width:H,height:Z,rotation:0})}}}if(s&&!s.deleted&&s.tickLabelPosition!=="none"){let E=q(f);for(let N of w.ticks){let D=ce(N,d.formatCode,r.date1904),V=Q(D,f)*1.3+f.sizePt*2,c=L(0,N);n.labels.push({paragraphs:[[{text:D,style:f}]],align:"r",x:c.x-Vo*f.sizePt-V,y:c.y-E/2,width:V,height:E,rotation:0})}}if(x)for(let E=0;E<i;E+=1){let N=a.labels[E],D=E/i*Math.PI*2,V=Math.sin(D),c=Math.cos(D),C=L(E,w.max),m=Q(N,h),v=Bo*T,I=v+Uo*h.sizePt,p=C.x+v*V+m/2*V,R=C.y-I*c-y/2*c-$e*h.sizePt,F=m*1.3+h.sizePt*2;n.labels.push({paragraphs:[[{text:N,style:h}]],align:"ctr",x:p-F/2,y:R-y/2,width:F,height:y,rotation:0})}for(let E of G)n.labels.push(E)}function $o(e,t,n){return{l:e.x*t,t:e.y*n,r:(e.x+e.w)*t,b:(e.y+e.h)*n}}function Yn(e,t,n,r){let o=new lt,l=[],a=gn(e,r),i=e.plots.reduce((L,_)=>L+_.series.length,0),s={model:e,colors:r,seriesCount:i},u=ne(e.spPr,r),d=u.fill===void 0?at("bg1",[],r)??{hex:"FFFFFF",alpha:1}:u.fill;o.rect(0,0,t,n,d,u.line??null);let f={l:Me,t:Me,r:t-Me,b:n-Me},h=[],y=i===1?e.plots.find(L=>L.series.length===1).series[0]:null;if(e.title!==null||!e.autoTitleDeleted&&y!==null){let L=e.title,_=ae(a,P(L,"txPr"),r,{sizePt:a.sizePt*1.8,bold:!0}),k=y?.name??(i>1?"Chart Title":null),$=L?Ee(L,_,k,r):k?[[{text:k,style:_}]]:[];if($.length>0){let G=Ke($),E=Qe(P(L,"layout")),N=z(L,"overlay")==="1",D=P(P(L,"tx"),"rich"),V=t*.8,c=!E&&G>V,C=c?V:G*1.3+_.sizePt*2,m=Fe($,_)*(c?Math.ceil(G/V):1),v=E?E.y*n:f.t-3.4,I=E?E.x*t+G/2:t/2;l.push({paragraphs:$,align:"ctr",x:I-C/2,y:v,width:C,height:m,rotation:Oe(D)??0}),!E&&!N&&(f.t=v+m+12.5);let p=(c?V:G)/2+_.sizePt*.66;h.push({l:I-p,r:I+p,t:v,b:v+m})}}let x=e.legend?ae(a,e.legend.txPr,r):null,g=null;if(e.legend&&x){let L=Un(e,e.legend,s),_=Vn(e.legend,L,x,t,n,f);g=_.layout,Object.assign(f,_.plot)}let T=z(P(e.chartSpace,"chart"),"dispBlanksAs"),A=T==="zero"||T==="span"?T:"gap",M=e.plots.filter(L=>L.kind==="pie"||L.kind==="doughnut"),S=e.plots.filter(L=>L.kind==="radar"),w=e.plots.filter(L=>!M.includes(L)&&!S.includes(L));if([M,S,w].filter(L=>L.length>0).length!==1)return null;if(S.length>0)Kn(S,e.plotLayout?.inner?$o(e.plotLayout,t,n):f,{model:e,look:s,scene:o,labels:l,baseText:a});else if(w.length>0){if(!Dn(w,f,{model:e,look:s,scene:o,labels:l,baseText:a,blanks:A,chartWidth:t,chartHeight:n}))return null}else{let L=e.plotLayout?{l:e.plotLayout.x*t,t:e.plotLayout.y*n,r:(e.plotLayout.x+e.plotLayout.w)*t,b:(e.plotLayout.y+e.plotLayout.h)*n}:f,_=ne(e.plotSpPr,r);(_.fill||_.line)&&o.rect(L.l,L.t,L.r-L.l,L.b-L.t,_.fill??null,_.line??null);for(let k of M)jn(k,L,{look:s,scene:o,labels:l,baseText:a,date1904:e.date1904,placed:e.plotLayout?.inner===!0,avoid:h,bounds:{l:0,t:0,r:t,b:n}})}return g&&x&&zn(g,x,o,l),!o.ok||l.some(L=>[L.x,L.y,L.width,L.height,L.rotation].some(_=>!Number.isFinite(_*12700)))?null:{scene:o,labels:l}}var Zn=12700;function Wo(e){if(e.plots.length===0)return!1;for(let t of e.plots){if(t.threeD||t.element.local==="stockChart"||!["bar","line","area","scatter","pie","doughnut","radar"].includes(t.kind))return!1;for(let n of t.series)if(n.trendlines.length>0||n.errorBars.length>0)return!1}return!0}var Jn=new WeakMap;function Go({chart:e}){let t=[...e.colors.scheme].map(([o,l])=>`${o}=${l.r},${l.g},${l.b},${l.a}`),n=[...e.colors.colorMap].map(([o,l])=>`${o}=${l}`),r=[e.theme.majorFont.latin,e.theme.minorFont.latin];return[...t,...n,...r].join("|")}function Qn(e){let{frame:t,chart:n,measurer:r}=e,{cx:o,cy:l}=t.xfrm;if(!(o>0)||!(l>0))return null;let a=`${t.partName}|${t.layer}|${t.nodeId}`,i=Go(e),s=Jn.get(n.chartSpace);if(s&&s.cx===o&&s.cy===l&&s.measurer===r&&s.owner===a&&s.theme===i)return s.result;let u=Ho(e);return Jn.set(n.chartSpace,{cx:o,cy:l,measurer:r,owner:a,theme:i,result:u}),u}function Ho({frame:e,chart:t,measurer:n}){let r=an(t.chartSpace);return!r||!Wo(r)?null:Xt({measurer:n,theme:t.theme},()=>{let o=Yn(r,e.xfrm.cx/Zn,e.xfrm.cy/Zn,t.colors);return o?en(o.scene.components,o.labels,e,t.theme):null})}import{toCss as nr}from"@pptx-editor.dev/core/cascade";import{apply as Qo}from"@pptx-editor.dev/core/layout";import{blurSigma as qo}from"@pptx-editor.dev/core/output";import{blurSigma as er,effectMatrix as Xo}from"@pptx-editor.dev/core/output";import{apply as ct,multiply as jo}from"@pptx-editor.dev/core/layout";var It=Math.PI/180,Re=9525,Ko=.5;function Nt(e){return Math.max(0,e)*Ko}function Ot(e){let t=Math.max(0,e)/2;return{spread:t,sigma:er(t)}}var Yo=.84;function tr(e){let t=Math.max(0,e);return{spread:-t*Yo,sigma:er(t)}}function Dt(e,t){let n=t*It;return{dx:-Math.cos(n)*e,dy:-Math.sin(n)*e}}function Ft(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let l of e)t=Math.min(t,l.x),n=Math.min(n,l.y),r=Math.max(r,l.x),o=Math.max(o,l.y);return{x:t,y:n,r,b:o}}function Zo(e,t,n){return[ct(e,0,0),ct(e,t,0),ct(e,t,n),ct(e,0,n)]}function dt(e,t){return{x:e.x-t,y:e.y-t,r:e.r+t,b:e.b+t}}function Jo(e,t){let n=Math.cos(t*It),r=Math.sin(t*It),l=[{x:e.x,y:e.y},{x:e.r,y:e.y},{x:e.r,y:e.b},{x:e.x,y:e.b}].map(f=>f.x*n+f.y*r),a=l.reduce((f,h)=>Math.min(f,h),1/0),i=l.reduce((f,h)=>Math.max(f,h),-1/0),s=(e.x+e.r)/2,u=(e.y+e.b)/2,d=s*n+u*r;return{x1:s+(a-d)*n,y1:u+(a-d)*r,x2:s+(i-d)*n,y2:u+(i-d)*r}}var qn=e=>Math.max(0,Math.min(1,e));function Bt(e,t,n,r){let o=Xo(e,t,n,r),l=Ft(Zo(jo(o,t),n,r)),a=e.rotWithShape?Math.atan2(t[1],t[0])*180/Math.PI:0,i=qn(e.startPos);return{matrix:o,line:Jo(l,e.fadeDir+a),start:i,end:Math.max(i,qn(e.endPos))}}function j(e){if(!Number.isFinite(e))return"0";let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)}function U(e,t={},n=[]){return n.length>0?{tag:e,attrs:t,children:n}:{tag:e,attrs:t}}function el(e){return`matrix(${e.map(j).join(" ")})`}function Ut(e){return{filterUnits:"userSpaceOnUse",x:j(e.x),y:j(e.y),width:j(Math.max(1,e.r-e.x)),height:j(Math.max(1,e.b-e.y)),"color-interpolation-filters":"sRGB"}}var tl="0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1",nl="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0";function rr(e,t){let n=Math.abs(e),r=e>0,o=n/Math.SQRT2,l=Math.min(Re,n),a=(s,u,d)=>U("feMorphology",{in:`${t}-g`,operator:r?"dilate":"erode",radius:`${j(s)} ${j(u)}`,result:d}),i=r?"lighten":"darken";return[U("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:tl,result:`${t}-g`}),a(n,l,`${t}-h`),a(l,n,`${t}-v`),a(o,o,`${t}-d`),U("feBlend",{in:`${t}-h`,in2:`${t}-v`,mode:i,result:`${t}-hv`}),U("feBlend",{in:`${t}-d`,in2:`${t}-hv`,mode:i,result:`${t}-m`}),U("feColorMatrix",{in:`${t}-m`,type:"matrix",values:nl,result:t})]}function rl(e,t,n){let r=[],{softEdge:o,innerShadow:l}=e,a="SourceGraphic",i=Math.max(t.r-t.x,t.b-t.y)/10+Re;if(l){let u=qo(l.blur),{dx:d,dy:f}=Dt(l.dist,l.dir);i+=Math.abs(l.dist)+3*u,r.push(U("feComponentTransfer",{in:"SourceAlpha",result:"ia"},[U("feFuncA",{type:"table",tableValues:"1 0"})]),U("feGaussianBlur",{in:"ia",stdDeviation:j(u),result:"ib"}),U("feOffset",{in:"ib",dx:j(d),dy:j(f),result:"io"}),U("feFlood",{"flood-color":nr({...l.color,a:1}),"flood-opacity":j(l.color.a),result:"ic"}),U("feComposite",{in:"ic",in2:"io",operator:"in",result:"ish"}),U("feComposite",{in:"ish",in2:"SourceAlpha",operator:"in",result:"isc"}),U("feMerge",{result:"inner"},[U("feMergeNode",{in:"SourceGraphic"}),U("feMergeNode",{in:"isc"})])),a="inner"}if(o&&o.radius>0){let{spread:u,sigma:d}=tr(o.radius);i=Math.max(i,Math.abs(u)+Re),r.push(...rr(u,"se"),U("feGaussianBlur",{in:"se",stdDeviation:j(d),result:"sm"}),U("feComponentTransfer",{in:a,result:"so"},[U("feFuncA",{type:"discrete",tableValues:"1"})]),U("feComposite",{in:"so",in2:"sm",operator:"in",result:"sc"}),U("feComponentTransfer",{in:"SourceAlpha",result:"sb"},[U("feFuncA",{type:"linear",slope:"255",intercept:"0"})]),U("feComposite",{in:"sc",in2:"sb",operator:"in",result:"soft"}))}if(r.length===0)return null;let s=n.id("fx");return{defs:[U("filter",{id:s,...Ut(dt(t,i))},r)],filter:s}}function ol(e,t,n){let r=e.glow;if(!r||r.radius<=0)return null;let o=n.id("glow"),{spread:l,sigma:a}=Ot(r.radius);return{defs:[U("filter",{id:o,...Ut(dt(t,l+3*a+Re))},[...rr(l,"gd"),U("feGaussianBlur",{in:"gd",stdDeviation:j(a),result:"gb"}),U("feFlood",{"flood-color":nr({...r.color,a:1}),"flood-opacity":j(r.color.a),result:"gc"}),U("feComposite",{in:"gc",in2:"gb",operator:"in",result:"glow"}),U("feMerge",{},[U("feMergeNode",{in:"glow"}),U("feMergeNode",{in:"SourceGraphic"})])])],filter:o}}function ll(e,t,n){let r=e.reflection;if(!r||r.startAlpha<=0&&r.endAlpha<=0)return null;let{matrix:o,line:l,start:a,end:i}=Bt(r,t.matrix,t.width,t.height),s=Nt(r.blur),u=dt(Ft(t.corners.map(x=>Qo(o,x.x,x.y))),3*s+Re),d=[],f=n.id("fade");d.push(U("linearGradient",{id:f,gradientUnits:"userSpaceOnUse",x1:j(l.x1),y1:j(l.y1),x2:j(l.x2),y2:j(l.y2)},[U("stop",{offset:j(a),"stop-color":"#ffffff","stop-opacity":j(r.startAlpha)}),U("stop",{offset:j(i),"stop-color":"#ffffff","stop-opacity":j(r.endAlpha)})]));let h=n.id("reflect"),y={x:j(u.x),y:j(u.y),width:j(Math.max(1,u.r-u.x)),height:j(Math.max(1,u.b-u.y))};d.push(U("mask",{id:h,maskUnits:"userSpaceOnUse",...y},[U("rect",{...y,fill:`url(#${f})`})]));let b=U("use",{href:`#${t.contentId}`,transform:el(o)});if(s>0){let x=n.id("rblur");d.push(U("filter",{id:x,...Ut(u)},[U("feGaussianBlur",{in:"SourceGraphic",stdDeviation:j(s)})])),b=U("g",{filter:`url(#${x})`},[b])}return{defs:d,node:U("g",{mask:`url(#${h})`,"data-effect":"reflection"},[b])}}var or=Object.freeze({body:rl,glow:ol,reflection:ll});function il(e={}){Vt(e.licenseKey),al({effects:or,chart:Qn})}function ri(e={}){return il(e),Object.freeze({id:"drawing"})}export{ri as drawingModule,Ot as glowSpread,Dt as innerShadowShift,il as installDrawing,Nt as reflectionBlurSigma,Bt as reflectionFade};
@@ -0,0 +1,103 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import { ReviewDisplayMode, EditorModule, ReviewItem, EditorCollaborationSession, CollaborationIdentity, CollaborationFailureCode } from '@pptx-editor.dev/core/editor';
7
+ import { P as ProLicenseOptions } from './license-Boo2wwCs.js';
8
+ import { PptxPackage } from '@pptx-editor.dev/core/store';
9
+ import * as Y from 'yjs';
10
+
11
+ /** Options of `reviewModule`. @public */
12
+ interface ReviewModuleOptions extends ProLicenseOptions {
13
+ /** Display modes to unlock. Default: `final` and `markup`. */
14
+ readonly displayModes?: readonly ReviewDisplayMode[];
15
+ }
16
+ /**
17
+ * The review module. Register it with `createPptxEditor({ modules: [reviewModule()] })`.
18
+ *
19
+ * @public
20
+ */
21
+ declare function reviewModule(options?: ReviewModuleOptions): EditorModule;
22
+
23
+ /** Every legacy comment of every slide, in slide order and then file order. */
24
+ declare function legacyComments(pkg: PptxPackage): ReviewItem[];
25
+
26
+ /** Options of `collaborationModule`. @public */
27
+ interface CollaborationModuleOptions extends ProLicenseOptions {
28
+ /** A ready session, for example from `createYjsCollaborationSession`. */
29
+ readonly session: EditorCollaborationSession;
30
+ }
31
+ /**
32
+ * The collaboration module. Register it with
33
+ * `createPptxEditor({ modules: [collaborationModule({ session })] })`.
34
+ *
35
+ * @public
36
+ */
37
+ declare function collaborationModule(options: CollaborationModuleOptions): EditorModule;
38
+
39
+ /** The minimal awareness surface the session uses (`y-protocols/awareness`'s `Awareness`). */
40
+ interface AwarenessLike {
41
+ /** This replica's awareness client id. */
42
+ readonly clientID: number;
43
+ /** Every connected client's state, by client id. */
44
+ getStates(): Map<number, Record<string, unknown>>;
45
+ /** Set one field of this replica's state; peers see it on their next update. */
46
+ setLocalStateField(field: string, value: unknown): void;
47
+ /** Listen to changes of any client's state. */
48
+ on(event: 'change', handler: () => void): void;
49
+ /** Stop listening to state changes. */
50
+ off(event: 'change', handler: () => void): void;
51
+ }
52
+
53
+ /** Options of `createYjsCollaborationSession`. @public */
54
+ interface YjsCollaborationSessionOptions {
55
+ /** The shared document. The host connects it to a provider. */
56
+ readonly doc: Y.Doc;
57
+ /** The room's document identity. */
58
+ readonly documentId: string;
59
+ /** The local author. */
60
+ readonly identity: CollaborationIdentity;
61
+ /**
62
+ * Yjs awareness for presence (`new Awareness(doc)` from `y-protocols/awareness`), usually
63
+ * the provider's. Absent, the session lists only the local participant.
64
+ */
65
+ readonly awareness?: AwarenessLike;
66
+ }
67
+ /** A session over a Y.Doc. @public */
68
+ interface YjsCollaborationSession extends EditorCollaborationSession {
69
+ /**
70
+ * Report the provider's connection. `false` sets `disconnected` with
71
+ * `transport-disconnected`; edits continue and merge on reconnect. `true` returns to `ready`.
72
+ * Call it from the provider's status event.
73
+ */
74
+ setConnected(connected: boolean): void;
75
+ }
76
+ /**
77
+ * Create a session over a Y.Doc. Register it with `collaborationModule({ session })`. Throws
78
+ * `CollaborationSchemaError` for an invalid document id or identity.
79
+ *
80
+ * @public
81
+ */
82
+ declare function createYjsCollaborationSession(options: YjsCollaborationSessionOptions): YjsCollaborationSession;
83
+
84
+ /**
85
+ * Typed collaboration schema or trust-boundary failure, thrown for invalid factory input.
86
+ * Use `code` for application logic; `detail` is diagnostic information.
87
+ *
88
+ * @public
89
+ */
90
+ declare class CollaborationSchemaError extends Error {
91
+ /** Stable failure code. Branch on it. */
92
+ readonly code: CollaborationFailureCode;
93
+ /** Bounded diagnostic text for logs. Not a parsing contract. */
94
+ readonly detail?: string | undefined;
95
+ constructor(
96
+ /** Stable failure code. Branch on it. */
97
+ code: CollaborationFailureCode,
98
+ /** Bounded diagnostic text for logs. Not a parsing contract. */
99
+ detail?: string | undefined);
100
+ }
101
+
102
+ export { CollaborationSchemaError, ProLicenseOptions, collaborationModule, createYjsCollaborationSession, legacyComments, reviewModule };
103
+ export type { AwarenessLike, CollaborationModuleOptions, ReviewModuleOptions, YjsCollaborationSession, YjsCollaborationSessionOptions };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ import{a as mt}from"./chunk-HCD7IVOL.js";import{attr as Oe,binaryPartOf as Ks,elements as Ut,parseXmlPart as $s,mainPresentationPart as Ws,presentationInfo as Gs,relTargetByType as Fn,textOf as Xs,xmlPartOf as Bs}from"@pptx-editor.dev/core/store";var zn="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Us=`${zn}/comments`,Hs=`${zn}/commentAuthors`;function jn(t,e){let n=Bs(t,e);if(n||!e)return n;let o=Ks(t,e);if(!o)return;let s=$s(e,new TextDecoder().decode(o));return s.ok?s.part:void 0}function Vs(t){let e=Object.create(null),n=Ws(t);if(!n)return e;let o=jn(t,Fn(t,n,Hs));for(let s of Ut(o?.root)){if(s.local!=="cmAuthor")continue;let i=Oe(s,"id"),r=Oe(s,"name");i!==void 0&&r!==void 0&&(e[i]=r)}return e}function Bt(t,e){for(let n of Ut(t)){if(n.local===e)return n;let o=Bt(n,e);if(o)return o}}var _n=(t,e,n)=>`${t}#cm-${e}-${n}`;function Ht(t){let e=Vs(t),n=[];for(let o of Gs(t).slides){let s=jn(t,Fn(t,o.partName,Us));for(let i of Ut(s?.root)){if(i.local!=="cm")continue;let r=Oe(i,"authorId")??"",u=Oe(i,"idx")??"",l=Bt(i,"parentCm"),f=e[r],d=Oe(i,"dt");n.push({id:_n(o.partName,r,u),kind:"comment",slidePart:o.partName,text:Xs(Bt(i,"text")),...f!==void 0?{author:f}:{},...d!==void 0?{date:d}:{},...l?{parentId:_n(o.partName,Oe(l,"authorId")??"",Oe(l,"idx")??"")}:{}})}}return n}function qs(t={}){return mt(t.licenseKey),{id:"review",review:{displayModes:t.displayModes??["final","markup"],collectReviewItems:({package:e})=>Ht(e)}}}function Js(t){return mt(t.licenseKey),{id:"collaboration",collaboration:{session:t.session}}}import*as me from"yjs";import{createCollaborationStatusTracker as ki}from"@pptx-editor.dev/core/editor";var Ke=class extends Error{constructor(n,o){let s=o?`${n}: ${o}`:n;super(n==="schema-version-mismatch"?`${s}
7
+ Collaboration upgrade required. Save local changes and use a compatible app version.`:s);this.code=n;this.detail=o;this.name="CollaborationSchemaError"}code;detail};import*as B from"yjs";import{buildReplicaPart as $r}from"@pptx-editor.dev/core/store";import"yjs";var Vt=5,Qs="pptx-meta-v1",Zs="pptx-parts-v1",er="pptx-binaries-v1",tr="pptx-nodes-v1",N=Object.freeze({part:"p",key:"k",shell:"s",attrs:"a",children:"c",text:"x"}),yt="",Kn=2**40,kt=Object.freeze({kind:"pptx-local"}),qt=Object.freeze({kind:"pptx-undo-repair"}),Jt=Object.freeze({kind:"pptx-redo-repair"}),Qt=Object.freeze({kind:"pptx-text-repair"}),Zt=Object.freeze({kind:"pptx-tidy"}),Ze=Object.freeze({kind:"pptx-undone-listing"}),en=Object.freeze({kind:"pptx-seed"}),et=Object.freeze({maxBinaryBytes:256*1024*1024,maxReadDepth:300,maxCopiesPerGroup:256});function $n(t){return{doc:t,meta:t.getMap(Qs),parts:t.getMap(Zs),binaries:t.getMap(er),nodes:t.getMap(tr)}}function $e(t){if(typeof t!="object"||t===null)return null;let e=t;return e.kind==="binary"?{kind:"binary"}:e.kind==="xml"&&typeof e.root=="string"?{kind:"xml",root:e.root}:null}import{asciiFold as nr}from"@pptx-editor.dev/core/store";var nn="http://schemas.openxmlformats.org/drawingml/2006/main",Un="http://schemas.openxmlformats.org/presentationml/2006/main",Y=t=>[t,[t]],ne=(t,e)=>[t,e],nt=["*",[]],ot=ne("fill",["noFill","solidFill","gradFill","blipFill","pattFill","grpFill"]),or=ne("fill",["noFill","solidFill","gradFill","pattFill"]),xt=ne("effect",["effectLst","effectDag"]),sr=[ne("color",["scrgbClr","srgbClr","hslClr","sysClr","schemeClr","prstClr"])],Wn=[Y("xfrm"),ne("geometry",["custGeom","prstGeom"]),ot,Y("ln"),xt,Y("scene3d"),Y("sp3d"),Y("extLst")],Gn=[or,ne("dash",["prstDash","custDash"]),ne("join",["round","bevel","miter"]),Y("headEnd"),Y("tailEnd"),Y("extLst")],tn=[Y("ln"),ot,xt,Y("highlight"),ne("uLn",["uLnTx","uLn"]),ne("uFill",["uFillTx","uFill"]),Y("latin"),Y("ea"),Y("cs"),Y("sym"),Y("hlinkClick"),Y("hlinkMouseOver"),Y("rtl"),Y("extLst")],tt=t=>[Y("cNvPr"),Y(t),Y("nvPr")],wt=t=>[Y(t),Y("extLst")],on=["lnL","lnR","lnT","lnB","lnTlToBr","lnBlToTr"],rr=Object.assign(Object.create(null),{sld:[Y("cSld"),Y("clrMapOvr"),Y("transition"),Y("timing"),Y("extLst")],cSld:[Y("bg"),Y("spTree"),Y("custDataLst"),Y("controls"),Y("extLst")],bg:[ne("background",["bgPr","bgRef"])],bgPr:[ot,xt,Y("extLst")],spPr:Wn,grpSpPr:Wn,ln:Gn,...Object.fromEntries(on.map(t=>[t,Gn])),effectLst:[Y("blur"),Y("fillOverlay"),Y("glow"),Y("innerShdw"),Y("outerShdw"),Y("prstShdw"),Y("reflection"),Y("softEdge")],...Object.fromEntries(["solidFill","outerShdw","innerShdw","prstShdw","glow","highlight","buClr","lnRef","fillRef","effectRef","fontRef"].map(t=>[t,sr])),style:[Y("lnRef"),Y("fillRef"),Y("effectRef"),Y("fontRef")],sp:[Y("nvSpPr"),Y("spPr"),Y("style"),Y("txBody"),Y("extLst")],pic:[Y("nvPicPr"),Y("blipFill"),Y("spPr"),Y("style"),Y("extLst")],cxnSp:[Y("nvCxnSpPr"),Y("spPr"),Y("style"),Y("extLst")],grpSp:[Y("nvGrpSpPr"),Y("grpSpPr"),nt,Y("extLst")],graphicFrame:[Y("nvGraphicFramePr"),Y("xfrm"),Y("graphic"),Y("extLst")],nvSpPr:tt("cNvSpPr"),nvPicPr:tt("cNvPicPr"),nvCxnSpPr:tt("cNvCxnSpPr"),nvGrpSpPr:tt("cNvGrpSpPr"),nvGraphicFramePr:tt("cNvGraphicFramePr"),cNvPr:[Y("hlinkClick"),Y("hlinkHover"),Y("extLst")],nvPr:[Y("ph"),ne("media",["audioCd","wavAudioFile","audioFile","videoFile","quickTimeFile"]),Y("custDataLst"),Y("extLst")],cNvSpPr:wt("spLocks"),cNvPicPr:wt("picLocks"),cNvGrpSpPr:wt("grpSpLocks"),cNvGraphicFramePr:wt("graphicFrameLocks"),cNvCxnSpPr:[Y("cxnSpLocks"),Y("stCxn"),Y("endCxn"),Y("extLst")],xfrm:[Y("off"),Y("ext"),Y("chOff"),Y("chExt")],blipFill:[Y("blip"),Y("srcRect"),ne("fillMode",["tile","stretch"])],txBody:[Y("bodyPr"),Y("lstStyle"),nt],bodyPr:[Y("prstTxWarp"),ne("autofit",["noAutofit","normAutofit","spAutoFit"]),Y("scene3d"),ne("text3d",["sp3d","flatTx"]),Y("extLst")],p:[Y("pPr"),nt,Y("endParaRPr")],r:[Y("rPr"),Y("t")],fld:[Y("rPr"),Y("pPr"),Y("t")],br:[Y("rPr")],pPr:[Y("lnSpc"),Y("spcBef"),Y("spcAft"),ne("buClr",["buClrTx","buClr"]),ne("buSz",["buSzTx","buSzPct","buSzPts"]),ne("buFont",["buFontTx","buFont"]),ne("bullet",["buNone","buAutoNum","buChar","buBlip"]),Y("tabLst"),Y("defRPr"),Y("extLst")],rPr:tn,defRPr:tn,endParaRPr:tn,tbl:[Y("tblPr"),Y("tblGrid"),nt],tblPr:[ot,xt,ne("tableStyle",["tableStyle","tableStyleId"]),Y("extLst")],tc:[Y("txBody"),Y("tcPr"),Y("extLst")],tcPr:[...on.map(Y),Y("cell3D"),ot,Y("headers"),Y("extLst")]}),rn=t=>t.ns===nn||t.ns===Un,ir=new Set(["sld","cSld","bg","bgPr","sp","pic","cxnSp","grpSp","graphicFrame","nvSpPr","nvPicPr","nvCxnSpPr","nvGrpSpPr","nvGraphicFramePr","nvPr","style"]);function Hn(t){if(!(!rn(t)||ir.has(t.local)&&t.ns!==Un))return rr[t.local]}function Vn(t,e){return rn(e)?t.findIndex(([,n])=>n.includes(e.local)):-1}var cr=new Set(["pPr","rPr","defRPr","endParaRPr","bodyPr","tblPr","tcPr","ln",...on]);function qn(t){return rn(t)&&cr.has(t.local)}function ar(t,e){let n=Hn(t),o=n?Vn(n,e):-1;return o<0?void 0:n[o][0]}var lr=(t,e)=>t.ns===nn&&t.local==="tc"&&e.ns===nn&&e.local==="txBody",dr="http://schemas.openxmlformats.org/package/2006/content-types",fr="http://schemas.openxmlformats.org/package/2006/relationships",ur=Object.assign(Object.create(null),{[`${dr}|Types`]:{Default:{attr:"Extension",caseless:!0},Override:{attr:"PartName",caseless:!0}},[`${fr}|Relationships`]:{Relationship:{attr:"Id",caseless:!1}}});function We(t,e,n){let o=ur[`${t.ns}|${t.local}`];if(o&&Object.prototype.hasOwnProperty.call(o,e.local)){let{attr:i,caseless:r}=o[e.local],u=n(i);return u===void 0?void 0:{slot:`${e.local}:${r?nr(u):u}`,rule:"key"}}let s=ar(t,e);if(!(s===void 0||lr(t,e)))return{slot:s,rule:qn(e)?"merge":"first"}}function Ge(t,e,n){let o=Hn(t);if(!o)return e;let s=o.indexOf(nt),i=-1,r=!0,u=e.map((l,f)=>{let d=n(l),c=d?Vn(o,d):-1,g=c>=0?c:s>=0?s:i;return g<i&&(r=!1),i=g,{c:l,rank:g,i:f}});return r?e:u.sort((l,f)=>l.rank-f.rank||l.i-f.i).map(l=>l.c)}var Xn=t=>`${t.ns}${yt}${t.local}`,ge=t=>t.slice(0,Math.max(0,t.indexOf("."))),St="_",Bn=t=>t.slice(t.indexOf(".")+1).startsWith(St);function Jn(t,e){let n=t.get(e);return n||(n={merge:!1,companions:[],attrFrom:new Map,childFrom:new Map,shadowed:new Map},t.set(e,n)),n}var sn=(t,e)=>t.attrs?.find(n=>n.ns===""&&n.local===e)?.value;function pr(t,e,n){let o=Jn(n,t.key);o.merge=!0;let s=new Map;for(let a of t.attrs??[])s.set(Xn(a),a);let i=a=>"text"in a?void 0:We(t,a,h=>sn(a,h))?.slot,r=t.children??[],u=new Set(r.map(i)),l=[...r],f=new Map;for(let a of e){o.companions.push(a.key);for(let h of a.attrs??[]){let p=Xn(h);s.has(p)||(s.set(p,h),o.attrFrom.set(p,a.key))}for(let h of a.children??[]){if("text"in h)continue;let p=i(h);if(p===void 0){l.push(h),f.set(h.key,a.key);continue}if(u.has(p)&&!qn(h)){o.shadowed.set(h.key,p);continue}u.add(p),l.push(h),f.set(h.key,a.key)}}let d=cn(t,l,n);if(!d)return null;for(let a of d){let h="text"in a?void 0:f.get(a.key);h!==void 0&&o.childFrom.set(a.key,h)}let c=Ge(t,d,a=>"text"in a?void 0:a),g=[...s.entries()].sort(([a],[h])=>a<h?-1:a>h?1:0);return{...t,attrs:g.map(([,a])=>a),children:[...c]}}function cn(t,e,n){let o=new Map,s=[],i=new Map;for(let r of e){let u="text"in r?void 0:We(t,r,g=>sn(r,g)),l=u?o.get(u.slot):void 0,f=l===void 0?void 0:s[l],d=f!==void 0&&!(Bn(f.key)&&Bn(r.key));if(u&&l===void 0&&o.set(u.slot,s.length),!d){s.push(r);continue}let c=i.get(l);if(c||i.set(l,c=[]),c.length>=et.maxCopiesPerGroup)return null;c.push(r)}for(let[r,u]of i){let l=s[r];if(We(t,l,f=>sn(l,f))?.rule==="merge"){let f=pr(l,u,n);if(!f)return null;s[r]=f}else{let f=Jn(n,l.key);for(let d of u)f.companions.push(d.key)}}return s}import*as fe from"yjs";var z=Object.freeze({splitFrom:"sf",splitBaseText:"sb",splitAt:"sa",splitLength:"sl",splitGeneration:"sg",splitEdited:"se",splitBreak:"sk",movedFrom:"mf",movedIndex:"mi",movedClock:"mq",movedTo:"mt",movedEarlier:"mo",removedWith:"rw"}),Ne="pptx-pieces-v1",at="pptx-moves-v1",bt="pptx-splits-v1",it=2e4,no=64,oo=`${z.removedWith}.`,un=2**31,pn=300,gn=8,Xe=4096,Ae=t=>Number.isSafeInteger(t)&&t>=0,gr=t=>Number.isSafeInteger(t)&&t>=1&&t<un,so="http://schemas.openxmlformats.org/drawingml/2006/main",ct=new Set,xe=t=>t?.type==="element",hn=t=>t===z.removedWith||t.startsWith(oo);function he(t){for(let e of t.keys())if(hn(e))return!0;return!1}function Qn(t,e,n){t.set(`${oo}${e}`,n)}var ln=t=>t.children.filter(xe);function st(t){let n=ln(t).find(o=>o.local==="t")?.children.find(o=>o.type==="text");return n?.type==="text"?n.value:""}function ro(t){if(!t||"text"in t)return"";let e=t.children?.find(o=>!("text"in o)&&o.local==="t"),n=e&&!("text"in e)?e.children?.find(o=>"text"in o):void 0;return n&&"text"in n?n.text:""}function io(t){let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619)>>>0;return e.toString(36)}function dn(t,e,n,o){let s=`${t}\0${io(e)}\0${n}`;return o===void 0?s:`${s}\0${o}`}var Zn=t=>{let e=Number.parseInt(t,36);return Number.isFinite(e)?e:Number.MAX_SAFE_INTEGER};function co(t,e,n,o,s){if(o.size===0)return;let i=m=>{let k=s.get(m),S=k===void 0?void 0:t.nodes.get(k);return S instanceof fe.Map?S:void 0},r=t.doc.clientID.toString(36),u=new Map,l=[],f=new Set,d=new Set,c=m=>{for(let k of ln(m)){if(k.local!=="r"||d.has(k.id))continue;let S=o.get(k.id);if(!xe(S)||S===k||st(S)===st(k))continue;let w=i(k.id);w&&typeof w.get(z.splitFrom)=="string"&&w.get(z.splitEdited)!==!0&&w.set(z.splitEdited,!0)}},g=m=>{let k=ln(m);k.forEach((S,w)=>{if(S.local!=="r"||!o.has(S.id))return;let A=o.get(S.id);if(!xe(A)||A===S)return;let R=st(A),P=st(S);if(R.length<=P.length||!R.startsWith(P))return;let b=R.slice(P.length),I=[],C="",j=[];for(let D=w+1;D<k.length&&C.length<b.length;D+=1){let K=k[D];if(K.local==="br"&&!o.has(K.id)){j.push({el:K,at:P.length+C.length});continue}if(K.local!=="r"||o.has(K.id))break;let T=st(K);I.push({el:K,at:P.length+C.length,length:T.length}),C+=T}let _=s.get(S.id);if(C!==b||_===void 0||I.length===0)return;d.add(S.id);let E=`${_}\0${io(R)}`,O=Math.min((ao(t).latest.get(E)??0)+1,un-1);for(let{el:D,at:K,length:T}of I){let F=i(D.id);if(!F||F.has(z.splitFrom))continue;F.set(z.splitFrom,_),F.set(z.splitBaseText,R),F.set(z.splitAt,K),F.set(z.splitLength,T),F.set(z.splitGeneration,O);let M=s.get(D.id);M!==void 0&&t.doc.getMap(Ne).set(M,e)}for(let{el:D,at:K}of j){let T=i(D.id);!T||T.has(z.splitBreak)||(T.set(z.splitBreak,dn(_,R,O)),T.set(z.splitAt,K))}t.doc.getMap(bt).set(dn(_,R,O,r),P.length)})},a=(m,k)=>{let S=o.get(m.id);if(S===m)return;let w=s.get(m.id),A=w===void 0?k:[w,...k].slice(0,pn),R=xe(S)?new Set(S.children.map(P=>P.id)):new Set;for(let P of m.children)f.add(P.id),!R.has(P.id)&&o.has(P.id)&&l.push({node:P,path:A});if(xe(S)){let P=new Set(m.children.map(b=>b.id));for(let b of S.children)P.has(b.id)||u.set(b.id,b)}m.ns===so&&m.local==="p"&&xe(S)&&(g(m),c(m));for(let P of m.children)xe(P)&&a(P,A)};if(a(n,[]),l.length>0){let m=new Map;for(let w of o.values())xe(w)&&w.children.forEach((A,R)=>m.set(A.id,{parent:w.id,index:R}));let k=t.doc.getMap(at),S=fe.getState(t.doc.store,t.doc.clientID);for(let{node:w,path:A}of l){let R=m.get(w.id),P=R===void 0?void 0:s.get(R.parent),b=s.get(w.id),I=i(w.id);if(!I||!R||P===void 0||b===void 0)continue;let C=I.get(z.movedFrom);if(typeof C=="string"&&C!==P){let j=I.get(z.movedEarlier),_=Array.isArray(j)?j.filter(E=>typeof E=="string"&&E!==C):[];I.set(z.movedEarlier,[C,..._].slice(0,gn))}I.set(z.movedFrom,P),I.set(z.movedIndex,R.index),I.set(z.movedClock,S),I.set(z.movedTo,A),k.set(b,e)}}let h=t.doc.getMap(Ne),p,y,x=m=>(p??=eo(n,s)).has(m);for(let[m,k]of u){if(f.has(m))continue;let S=new Set,w=[k];for(;w.length>0&&S.size<=it;){let b=w.pop(),I=s.get(b.id);if(I!==void 0&&S.add(I),xe(b))for(let C of b.children)f.has(C.id)||w.push(C)}let A=s.get(m);A!==void 0&&mr(t,A,S,x);let R=i(m);if(!R||S.size>it)continue;let P=[...S];Qn(R,r,P);for(let b of S){if(b===A||!h.has(b)||(p??=eo(n,s)).has(b))continue;let I=t.nodes.get(b);!(I instanceof fe.Map)||he(I)||(y??=new Set([...o.keys()].flatMap(C=>s.get(C)??[])),!(!y.has(b)&&hr(t,e,I,p))&&Qn(I,r,[b]))}}}function eo(t,e){let n=new Set,o=[t];for(;o.length>0;){let s=o.pop(),i=e.get(s.id);if(i!==void 0&&n.add(i),xe(s))for(let r of s.children)o.push(r)}return n}function hr(t,e,n,o){let s=Te(n),i=s?Be(t)(s.group):void 0;if(!s||i===void 0)return!1;let r=0;for(let[u,l]of t.doc.getMap(Ne).entries())if(!(l!==e||ge(u)!==i||!o.has(u))&&((r+=1)>Xe||Te(t.nodes.get(u))?.group===s.group))return!0;return!1}function mr(t,e,n,o){let s=[e],i=new Set;for(;s.length>0&&n.size<=it;){let r=s.pop();if(i.has(r))continue;i.add(r),n.add(r);let u=t.nodes.get(r),l=u instanceof fe.Map?u.get(N.children):void 0;if(l instanceof fe.Array)for(let f of l.toArray())typeof f=="string"&&!i.has(f)&&!o(f)&&s.push(f)}}var an=new WeakMap,to=new WeakSet;function ao(t){let e=t.doc.getMap(bt),n=an.get(e);if(n)return n;let o={groups:new Map,latest:new Map};for(let[s,i]of e.entries()){let r=s.split("\0");if(!Ae(i)||r.length!==4)continue;let[u,l,f,d]=r,c=Number(f);if(!Number.isSafeInteger(c)||c<1||c>=un)continue;let g=`${u}\0${l}`,a=`${g}\0${c}`,h=o.groups.get(a);h||o.groups.set(a,h=new Map),h.set(d,i),o.latest.set(g,Math.max(o.latest.get(g)??0,c))}return an.set(e,o),to.has(e)||(to.add(e),e.observe(()=>an.delete(e))),o}function Te(t){if(!(t instanceof fe.Map))return null;let e=t.get(z.splitFrom),n=t.get(z.splitBaseText),o=t.get(z.splitAt),s=t.get(z.splitLength),i=t.get(z.splitGeneration);return typeof e!="string"||typeof n!="string"||!Ae(o)||!Ae(s)||!gr(i)?null:{from:e,group:dn(e,n,i),original:n.slice(o,o+s),at:o,edited:t.get(z.splitEdited)===!0}}function Be(t){let{groups:e}=ao(t),n=new Map;return o=>{if(n.has(o))return n.get(o);let s=e.get(o),i;if(s&&s.size>=2){let r;for(let[u,l]of s)(!r||l<r[1]||l===r[1]&&Zn(u)<Zn(r[0]))&&(r=[u,l]);i=r?.[0]}return n.set(o,i),i}}function lo(t,e,n){let o=new Map,s=new Set,i=r=>{let u=o.get(r);if(u!==void 0||o.has(r))return u??null;let l=e(r);if(!l||l.edited||s.has(r)||s.size>Xe)return null;s.add(r);let f=n(r);for(let d of t.get(r)??[]){let c=i(d);if(c===null){f=null;break}f+=c}return s.delete(r),o.set(r,f),f};return i}function fn(t){let e=new Map;for(let[o,s]of t){let i=e.get(s.from);i?i.push([o,s.at]):e.set(s.from,[[o,s.at]])}let n=new Map;for(let[o,s]of e)n.set(o,s.sort((i,r)=>i[1]-r[1]||(i[0]<r[0]?-1:i[0]>r[0]?1:0)).map(([i])=>i));return n}function fo(t,e){let n=0;for(let o=0;o<e.length&&n<t.length;o+=1)e[o]===t[n]&&(n+=1);return n===t.length}function uo(t,e,n,o,s=ct){if(e.ns!==so||e.local!=="p")return n;let i=new Map,r=new Map;for(let a of n){if("text"in a)continue;let h=Te(t.nodes.get(a.key));if(h){if(i.size>=Xe)return n;i.set(a.key,h),r.set(a.key,ro(a))}}if(i.size===0)return n;let u=fn(i),l=lo(u,a=>i.get(a),a=>r.get(a)??""),f=Be(t),d=new Set;for(let[a,h]of i){let p=f(h.group);if(p===void 0||ge(a)===p||s.has(h.group))continue;let y=l(a);y!==null&&fo(y,h.original)&&d.add(a)}if(d.size===0)return n;let c=[...d];for(;c.length>0;)for(let a of u.get(c.pop())??[])d.has(a)||(d.add(a),c.push(a));for(let a of d)o.add(a);let g=n.filter(a=>"text"in a||!d.has(a.key));return yr(t,g,d,i,f)}function yr(t,e,n,o,s){let i=new Set;for(let f of n){let d=o.get(f);d&&i.add(`${d.group}\0${ge(f)}`)}let r=new Map;for(let f of e){if("text"in f||f.local!=="br")continue;let d=t.nodes.get(f.key);if(!(d instanceof fe.Map))continue;let c=d.get(z.splitBreak),g=d.get(z.splitAt);if(typeof c!="string"||!Ae(g)||!i.has(`${c}\0${ge(f.key)}`))continue;let a;for(let h of e){let p="text"in h?void 0:o.get(h.key);!p||p.group!==c||ge(h.key)!==s(c)||p.at<g||(!a||p.at<a[1])&&(a=[h.key,p.at])}a&&r.set(f.key,a[0])}if(r.size===0)return e;let u=new Map;for(let f of e){let d=r.get(f.key);if(d===void 0)continue;let c=u.get(d);c?c.push(f):u.set(d,[f])}let l=[];for(let f of e)if(!r.has(f.key)){for(let d of u.get(f.key)??[])l.push(d);l.push(f)}return l}function po(t,e,n){if(!n||n.size===0)return e;let o=new Set(e),s=[...e],i=-1;for(let r of t){let u=s.indexOf(r);if(u>=0&&o.has(r)){i=u;continue}!n.has(r)||o.has(r)||(s.splice(i+1,0,r),i+=1)}return s}function go(t,e,n,o,s=ct){let i=t.doc.getMap(Ne);if(i.size===0)return n;let r=new Map,u=E=>{(E.children??[]).forEach((O,D)=>{r.set(O.key,{parent:E,at:D,order:r.size}),"text"in O||u(O)})};u(n);let l=new Map;for(let[E,O]of i.entries()){if(O!==e)continue;let D=t.nodes.get(E);if(!(D instanceof fe.Map)||he(D))continue;let K=Te(D);K&&(l.size>=Xe&&(r.has(E)||l.size>=2*Xe)||l.set(E,K))}let f=Be(t),d=new Map,c=E=>{let O=d.get(E);if(O===void 0){let D=r.get(E);O=ro(D?D.parent.children[D.at]:o(E,new Set,1)??void 0),d.set(E,O)}return O},g=lo(fn(l),E=>l.get(E),c),a=new Map;for(let[E,O]of l){if(ge(E)!==f(O.group))continue;let D=r.get(E)?.order;if(D===void 0)continue;let K=a.get(O.group);(!K||D>K.order)&&a.set(O.group,{key:E,order:D})}let h=new Map,p=E=>{let O=l.get(E).from;O!==E&&h.set(E,O)},y=[];for(let E of[...l.keys()].sort()){let O=l.get(E),D=f(O.group);if(D===void 0||ge(E)===D){s.has(E)&&!r.has(E)&&y.push(E);continue}let K=g(E);if(K!==null&&fo(K,O.original))continue;let T=a.get(O.group)?.key??(r.has(O.from)?O.from:void 0);T!==void 0&&T!==E&&h.set(E,T)}let x=new Set(y);for(let E of y){let O=l.get(E).from;(r.has(O)||x.has(O))&&p(E)}let m=fn(l),k=[...h.keys()];for(;k.length>0;)for(let E of m.get(k.pop())??[])!h.has(E)&&r.has(E)&&(p(E),k.push(E));if(h.size===0)return n;let S=new Map,w=new Set(r.keys());for(let E of h.keys()){let O=r.get(E),D=O?O.parent.children[O.at]:o(E,w,1);D&&S.set(E,D)}let A=new Map,R=E=>{let O=A.get(E);if(O!==void 0)return O;let D=h.get(E);A.set(E,!1);let K=D===void 0?r.has(E):S.has(E)&&R(D);return A.set(E,K),K},P=new Map,b=new Set;for(let[E,O]of h){let D=S.get(E);if(!D||!R(E))continue;b.add(E);let K=P.get(O);K?K.push(D):P.set(O,[D])}if(b.size===0)return n;let I=(E,O)=>{let D=l.get(O);return D?.from===E?D.at:1/0};for(let[E,O]of P)O.sort((D,K)=>I(E,D.key)-I(E,K.key)||(D.key<K.key?-1:D.key>K.key?1:0));let C=new Set,j=(E,O)=>{for(let D of P.get(E)??[])C.has(D.key)||(C.add(D.key),O.push(D),j(D.key,O))},_=E=>{let O=[];for(let D of E.children??[])b.has(D.key)||(O.push("text"in D?D:_(D)),j(D.key,O));return{...E,children:O}};return _(n)}var rt=Object.freeze({unseenWinners:ct,lost:ct});function lt(t,e,n,o=ct){let s=t.doc.getMap(Ne);if(s.size===0)return rt;let i=Be(t),r=new Set,u=new Map,l=0;for(let[y,x]of s.entries()){if(x!==e)continue;let m=t.nodes.get(y);if(!(m instanceof fe.Map)||m.get(N.part)!==e)continue;let k=Te(m);if(k){if(he(m)){ge(y)===i(k.group)&&r.add(k.group);continue}if((l+=1)>Xe)return rt;u.set(y,k)}}if(u.size===0)return rt;let f=new Set,d=[n];for(;d.length>0;){let y=d.pop();if(f.has(y))continue;f.add(y);let x=t.nodes.get(y);if(!(x instanceof fe.Map)||x.get(N.part)!==e)continue;let m=x.get(N.children);if(m instanceof fe.Array)for(let k of m.toArray())typeof k=="string"&&!f.has(k)&&d.push(k)}let c=new Set,g=new Map;for(let[y,x]of u){let m=ge(y)===i(x.group);if(f.has(y)||o.has(y)){m&&r.add(x.group);continue}if(c.add(y),!m)continue;let k=g.get(x.group);k?k.push(y):g.set(x.group,[y])}let a=new Map,h=y=>{let x=a.get(y);if(x!==void 0)return x;a.set(y,!1);let m=u.get(y)?.from,k=m!==void 0&&(f.has(m)||o.has(m)||c.has(m)&&h(m));return a.set(y,k),k},p=new Set;for(let[y,x]of g)!r.has(y)&&!x.some(h)&&p.add(y);return{unseenWinners:p,lost:c}}import*as Mt from"yjs";var kr=1024;function wr(t){if(!(t instanceof Mt.Map))return null;let e=null,n=0;for(let[o,s]of t.entries())if(!(!hn(o)||!Array.isArray(s))){if(s.length>it+1||(n+=1)>no)return"all";e??=new Set;for(let i of s)typeof i=="string"&&e.add(i)}return e}function xr(t,e,n,o,s){if(n.length>pn)return null;for(let i of n){if(typeof i!="string"||o.has(i))return null;let r=s.get(i);if(r===void 0&&(r=wr(t.nodes.get(i)),s.set(i,r)),r==="all")return null;if(r)return r.has(e)?null:i}return null}var mn=(t,e)=>t<e?-1:t>e?1:0,yn=class extends Set{#e;constructor(e){super(),this.#e=e}has(e){return this.#e.has(e)||super.has(e)}};function mo(t,e,n,o,s){let i=t.doc.getMap(at);if(i.size===0)return n;let r=new Map,u=new Map,l=new Map,f=(R,P,b)=>{if(r.set(R.key,P),l.set(R.key,l.size),b!==null&&u.set(R.key,b),!("text"in R))for(let I of R.children??[])f(I,P+1,R.key)};f(n,0,null);let d=[],c=[],g=new Map,a,h=R=>{if(!a){a=new Map;for(let P of i.keys()){if(!u.has(P))continue;let b=t.nodes.get(P),I=b instanceof Mt.Map?b.get(z.movedFrom):void 0;if(typeof I!="string")continue;let C=a.get(I);(C===void 0||l.get(P)>l.get(C))&&a.set(I,P)}}return a.get(R)};for(let[R,P]of i.entries()){if(P!==e||r.has(R))continue;let b=t.nodes.get(R);if(!(b instanceof Mt.Map)||b.get(N.part)!==e||he(b))continue;let I=b.get(z.movedFrom),C=b.get(z.movedTo);if(typeof I!="string"||!Array.isArray(C))continue;let j=b.get(z.movedEarlier),_=r.has(I)?I:(Array.isArray(j)?j.slice(0,gn):[]).find(T=>typeof T=="string"&&r.has(T)),E=b.get(z.movedIndex),O=b.get(z.movedClock),D=typeof O=="number"&&Number.isFinite(O)?O:0,K=xr(t,R,C,r,g);if(K!==null){if(d.length+c.length>=kr)return n;if(_!==void 0){let T=_===I&&Ae(E)?E:1/0;d.push({key:R,from:_,index:T,clock:D,to:C})}else c.push({key:R,last:I,removed:K,index:Ae(E)?E:1/0,clock:D,to:C})}}let p=new Map,y=c,x=0;for(;y.length>0;){let R=[],P=[];for(let b of y){let I=p.get(b.removed),C=I?void 0:h(b.removed),j=I?I.into:C===void 0?void 0:u.get(C),_=I?I.key:C;_===void 0||j===void 0?P.push(b):R.push({...b,after:_,into:j})}if(R.length===0)break;R.sort((b,I)=>b.clock-I.clock||b.index-I.index||mn(b.key,I.key));for(let b of R)d.push({...b,from:b.into,seq:x++}),p.set(b.last,{key:b.key,into:b.into});y=P}if(d.length===0)return n;let m=new Set(d.map(R=>R.key)),k=new Map(d.map(R=>[R.key,R.to.filter(P=>typeof P=="string"&&m.has(P)).length]));d.sort((R,P)=>k.get(R.key)-k.get(P.key)||mn(R.key,P.key));let S=new yn(new Set(r.keys())),w=new Map;for(let R of d){let P=o(R.key,S,r.get(R.from)+1);if(!P)continue;s?.add(P.key);let b={node:P,index:R.index,clock:R.clock,after:R.after,seq:R.seq??0},I=w.get(R.from);I?I.push(b):w.set(R.from,[b])}if(w.size===0)return n;let A=R=>{let P=w.get(R.key),b=(R.children??[]).map(O=>"text"in O?O:A(O));if(!P)return{...R,children:b};let I=[...b],C=P.filter(O=>O.after===void 0).sort((O,D)=>D.clock-O.clock||O.index-D.index||mn(O.node.key,D.node.key));for(let{node:O,index:D}of C)I.splice(Math.min(D,I.length),0,O);let j=P.filter(O=>O.after!==void 0).sort((O,D)=>O.seq-D.seq),_=new Map;for(let{node:O,after:D}of j){let K=_.get(D)??D,T=I.findIndex(F=>F.key===K);I.splice(T<0?I.length:T+1,0,O),_.set(D,O.key)}let E={ns:R.ns,local:R.local};return{...R,children:[...Ge(E,I,O=>"text"in O?void 0:O)]}};return A(n)}function Rt(t){let e=new Set,n=[t];for(;n.length>0;){let o=n.pop();if(e.add(o.key),!("text"in o))for(let s of o.children??[])n.push(s)}return e}var ho=(t,e)=>t.size===e.size&&[...t].every(n=>e.has(n));function yo(t,e){return ho(t.lost,e.lost)&&ho(t.unseenWinners,e.unseenWinners)}import*as ft from"yjs";import{children as kn,elements as Ue,isStructureEdited as Sr,path as ko,TABLE_MAX_COLUMNS as br,TABLE_MAX_ROWS as Mr,tableGridOf as Rr}from"@pptx-editor.dev/core/store";var Yt=Object.freeze({holder:"mh",cover:"cv."}),xn="http://schemas.openxmlformats.org/drawingml/2006/main",Yr="http://schemas.openxmlformats.org/presentationml/2006/main",It=256,wo=4096,dt=t=>t?.type==="element",Et=(t,e)=>!!t&&!("text"in t)&&t.ns===xn&&t.local===e;function Er(t){return(Ue(t).find(n=>n.local==="t")?.children??[]).map(n=>n.type==="text"?n.value:"").join("")}function Sn(t){return Ue(t).some(e=>e.local==="br"||(e.local==="r"||e.local==="fld")&&Er(e).length>0)}function xo(t){return"text"in t?!1:(t.children??[]).some(e=>{if("text"in e||!(e.local==="br"||e.local==="r"||e.local==="fld"))return!1;if(e.local==="br")return!0;let n=e.children?.find(o=>!("text"in o)&&o.local==="t");return!!n&&!("text"in n)&&(n.children??[]).some(o=>"text"in o&&o.text!=="")})}function So(t,e){let n=[],o=(s,i)=>{if(s.ns===Yr&&s.local==="graphicFrame"){n.push(s);return}if(i<It)for(let r of e(s))o(r,i+1)};return o(t,0),n}function bo(t){let e=ko(t,"a:graphic","a:graphicData","a:tbl"),n=Math.min(kn(ko(e,"a:tblGrid"),"a:gridCol").length,br),o=kn(e,"a:tr").slice(0,Mr).map(r=>kn(r,"a:tc"));if(n===0||o.length===0)return[];let s=Rr(t,o,n),i=[];return o.forEach((r,u)=>r.slice(0,n).forEach((l,f)=>{let d=s.blocks[s.owner[u*n+f]],c=d&&o[d.row][d.col];c&&(d.row!==u||d.col!==f)&&i.push({tc:l,over:c})})),i}var wn=t=>Ue(t).filter(e=>e.ns===xn&&e.local==="txBody");function Mo(t){let e=new Set;if(!(t instanceof ft.Map))return e;for(let[n,o]of t.entries())if(!(!n.startsWith(Yt.cover)||!Array.isArray(o))){if(o.length>wo)return"all";for(let s of o)typeof s=="string"&&e.add(s)}return e}function Ro(t,e,n,o){if(n.size===0)return;let s=d=>{let c=o.get(d),g=c===void 0?void 0:t.nodes.get(c);return g instanceof ft.Map?g:void 0},i=new Set,r=[],u=(d,c)=>{let g=n.get(d.id);if(g!==d){for(let a of d.children)i.add(a.id);if(d.ns===xn&&d.local==="txBody"&&dt(g)){let a=new Set(d.children.map(p=>p.id)),h=g.children.filter(p=>dt(p)&&p.local==="p");h.length>0&&h.every(p=>!a.has(p.id))&&r.push({body:d,old:g})}if(c<It)for(let a of d.children)dt(a)&&u(a,c+1)}};u(e,0);for(let{body:d,old:c}of r)if(c.children.filter(a=>dt(a)&&a.local==="p").every(a=>i.has(a.id)))for(let a of d.children)dt(a)&&a.local==="p"&&!n.has(a.id)&&!Sn(a)&&s(a.id)?.set(Yt.holder,!0);let l=`${Yt.cover}${t.doc.clientID.toString(36)}`,f=d=>Ue(d).filter(c=>n.get(c.id)!==c);for(let d of So(e,f))for(let{tc:c}of bo(d)){let g=s(c.id),a=wn(c);if(!g||a.length===0)continue;let h=Mo(g);if(h==="all")continue;let p=a.flatMap(m=>Ue(m).filter(k=>k.local==="p")).map(m=>o.get(m.id)).filter(m=>m!==void 0&&!h.has(m));if(p.length===0)continue;let y=g.get(l),x=Array.isArray(y)?y.filter(m=>typeof m=="string"):[];g.set(l,[...x,...p].slice(0,wo+1))}}function Yo(t,e){let n=new Map(t);return n.delete(e),n}function Eo(t,e,n){let o=[];if(!e||e.size===0)return o;let s=(i,r)=>{let u=n.get(i.id);if(u!==void 0&&e.has(u)&&o.push(i),r<It)for(let l of Ue(i))s(l,r+1)};return s(t,0),o}function Io(t,e){e.set(t.key,t);let n=(t.children??[]).map(o=>"text"in o?{type:"text",id:o.key,value:o.text}:Io(o,e));return{type:"element",id:t.key,kind:"generic",ns:t.ns,local:t.local,...t.prefix?{prefix:t.prefix}:{},nsDecls:[],attrs:t.attrs??[],children:n}}function Ir(t,e,n,o,s){let i=new Map,r=Io(n,i),u=Sr(r);for(let{tc:l,over:f}of bo(r)){let d=wn(f)[0],c=d&&i.get(d.id);if(!c)continue;let g=Mo(t.nodes.get(l.id)),a=x=>{if(g==="all"||g.has(x))return!1;let m=t.nodes.get(x);return m instanceof ft.Map?u?!0:typeof m.get(z.movedFrom)=="string"||he(m):!1},h=wn(l).flatMap(x=>{let m=i.get(x.id);if(!m)return[];let k=m.children??[],S=k.filter(w=>Et(w,"p")&&(e.has(w.key)||xo(w)&&a(w.key)));return[{from:m,kids:k,going:S,paragraphs:k.filter(w=>Et(w,"p")).length}]});h.every(x=>x.going.length===x.paragraphs)&&[...h].reverse().find(x=>x.going.length>0)?.going.pop();let p=new Set(h.filter(x=>x.going.length===x.paragraphs).map(x=>x.from)),y=i.get(l.id);y&&p.size>0&&p.size<h.length&&s.set(y.key,(y.children??[]).filter(x=>!p.has(x)));for(let{from:x,kids:m,going:k}of h){if(k.length===0)continue;let S=new Set(k);s.set(x.key,m.filter(A=>!S.has(A)));let w=o.get(c.key);if(w)for(let A of k)w.push(A);else o.set(c.key,k)}}}function vo(t,e,n,o){let s=new Map,i=new Map,r=So(e,f=>(f.children??[]).filter(d=>!("text"in d)));for(let f of r)Ir(t,n,f,s,i);if(s.size===0&&n.size===0)return e;let u=f=>{if(!Et(f,"p")||xo(f))return!1;let d=t.nodes.get(f.key);return d instanceof ft.Map&&d.get(Yt.holder)===!0},l=(f,d)=>{let c=i.get(f.key)??f.children??[],g=s.get(f.key);g&&(c=[...c,...g]),f.local==="txBody"&&c.some(p=>Et(p,"p")&&n.has(p.key))&&(c=c.filter(p=>!u(p)));let a=d<It?c.map(p=>"text"in p?p:l(p,d+1)):c,h=a.length===(f.children??[]).length&&a.every((p,y)=>p===f.children[y]);return!h&&f.local==="txBody"&&o?.add(f.key),h?f:{...f,children:a}};return l(e,0)}import*as U from"yjs";var ee=Object.freeze({copyOf:"ci",newParagraph:"cp",seen:"cs",followed:"cf.",removedRun:"rr."}),De="pptx-copies-v1",Po=1<<20,Co=4096,vr=1024,Mn=32,bn=1024,vt=1024,Nt="http://schemas.openxmlformats.org/drawingml/2006/main",H=(t,e)=>`${t}:${e}`,Ye=t=>Number.isSafeInteger(t)&&t>=0,Oo=new WeakMap;function Ee(t){if(!(t instanceof U.Map))return null;let e=t.get(ee.copyOf),n=Oo.get(t);if(n&&n.value===e)return n.copy;let o=Do(e,t.get(ee.newParagraph)===!0);return Oo.set(t,{value:e,copy:o}),o}function Do(t,e){if(!Array.isArray(t)||t.length<5||(t.length-2)%3!==0||t.length>2+3*Po)return null;let[n,o]=t;if(!Ye(n)||!Ye(o))return null;let s=[],i=0;for(let u=2;u<t.length;u+=3){let l=t[u],f=t[u+1],d=t[u+2];if(!Ye(l)||!Ye(f)||!Ye(d)||d===0||(s.push(i),i+=d,i>Po))return null}let r=t;return{client:n,clock:o,length:i,newParagraph:e,source(u){let l=0,f=s.length-1;for(;l<f;){let c=l+f+1>>1;s[c]<=u?l=c:f=c-1}let d=2+3*l;return U.createID(r[d],r[d+1]+(u-s[l]))}}}var No=new WeakMap;function At(t){let e=[];if(!(t instanceof U.Map))return e;let n=0;for(let[o,s]of t.entries()){if(++n>vr)break;if(!o.startsWith(ee.followed)||!Array.isArray(s))continue;let i=No.get(s);i===void 0&&No.set(s,i=Do(s,!1)),i&&e.push(i)}return e}function Pr(t,e){let n=s=>s!==null&&s.client===e.client&&e.clock>=s.clock&&e.clock<s.clock+s.length,o=Ee(t);return n(o)?o:At(t).find(n)??null}function Lo(t,e,n,o){t.set(`${ee.followed}${H(e,n)}`,[e,n,...Fo(o)])}function _o(t,e){let n=new Set,o=t.nodes;for(let[s,i]of e.changed){if(s===o){for(let u of i)u!==null&&At(o.get(u)).length>0&&n.add(u);continue}if(!(s instanceof U.Map)||s.parent!==o)continue;let r=s.get(N.key);if(typeof r=="string")for(let u of i)u?.startsWith(ee.followed)&&n.add(r)}return n}var Ie="pptx-restored-v1",Le=65536,Or=/^(\d{1,16}):(\d{1,16})$/,Pt=new WeakMap,Ao=new WeakSet;function Nr(t){let e=Pt.get(t);if(e)return e;Ao.has(t)||(Ao.add(t),t.observe(()=>Pt.delete(t))),e=new Map;for(let[n,o]of t.entries()){let s=Or.exec(n);if(!s||!Array.isArray(o)||o.length!==3||!o.every(Ye))continue;let[i,r,u]=o;if(u===0||u>Le)continue;let l=Number(s[1]),f=Number(s[2]);if(!Number.isSafeInteger(l)||!Number.isSafeInteger(f))continue;let d=e.get(l),c=[f,i,r,u];d?d.push(c):e.set(l,[c])}for(let n of e.values())n.sort((o,s)=>o[0]-s[0]);return Pt.set(t,e),e}function He(t,e){let n=t.getMap(Ie);if(n.size===0)return null;let o=Nr(n).get(e.client);if(!o)return null;let s=0,i=o.length-1;for(;s<i;){let u=s+i+1>>1;o[u][0]<=e.clock?s=u:i=u-1}let r=o[s];return!r||e.clock<r[0]||e.clock>=r[0]+r[3]?null:U.createID(r[1],r[2]+(e.clock-r[0]))}function pt(t,e){if(e.length===0)return;let n=t.getMap(Ie);for(let o=0;o+3<e.length;o+=4)n.set(H(t.clientID,e[o]),[e[o+1],e[o+2],e[o+3]]);Pt.delete(n)}function Fo(t){let e=[];for(let n of t){let o=e.length;o>0&&e[o-3]===n.client&&e[o-2]+e[o-1]===n.clock?e[o-1]+=1:e.push(n.client,n.clock,1)}return e}function Ar(t,e){let n=new Set;for(let s=e._start;s!==null;s=s.right)if(n.add(s.id.client),n.size>Co)return null;let o=[];for(let s of[...n].sort((i,r)=>i-r))o.push(s,U.getState(t.store,s));return o}var To=new WeakMap;function zo(t){if(!(t instanceof U.Map))return null;let e=t.get(ee.seen),n=To.get(t);(!n||n.value!==e)&&(n={value:e,seen:Tr(e)},To.set(t,n));let o=n.seen;return o?s=>s.clock<(o.get(s.client)??0):null}function Tr(t){if(!Array.isArray(t)||t.length%2!==0||t.length>2*Co)return null;let e=new Map;for(let n=0;n<t.length;n+=2){let o=t[n],s=t[n+1];if(!Ye(o)||!Ye(s)||e.has(o))return null;e.set(o,s)}return e}function Tt(t,e,n){let o=[],s=0;for(let i=t._start;i!==null&&o.length<n;i=i.right)if(!(i.deleted||!i.countable))for(let r=0;r<i.length&&o.length<n;r+=1,s+=1)s>=e&&o.push(U.createID(i.id.client,i.id.clock+r));return o}function ye(t,e){if(U.getState(t.store,e.client)<=e.clock)return null;let n=U.getItem(t.store,e);return n instanceof U.Item?n:null}function Rn(t){let e=t.parent,n=e instanceof U.Text?e.parent:null;return n instanceof U.Map?n:null}function Ct(t,e){let n=ye(t,e);return!n||n.deleted}function ue(t,e,n,o=!0){let s=H(e.client,e.clock),i=n?.get(s);if(i)return i;let r=e;for(let u=0;u<Mn;u+=1){let l=ye(t,r),f=l?Pr(Rn(l),r):null;if(f){r=f.source(r.clock-f.clock);continue}let d=o?He(t,r):null;if(!d)break;r=d}return n?.set(s,r),r}var Ce=t=>t?.type==="element",Ot=t=>t.children.filter(Ce),le=(t,e)=>t.ns===Nt&&t.local===e;function jo(t){return Ot(t).find(n=>le(n,"t"))?.children.find(n=>n.type==="text")}var ut=t=>{let e=jo(t);return e?.type==="text"?e.value:""};function Ko(t,e,n,o,s,i){let r=new Set;if(o.size===0||i.size===0)return r;let u=t.doc.getMap(De),l=c=>{let g=jo(c);return g?s.get(g.id):void 0},f=(c,g,a)=>{let h=Ot(c);h.forEach((p,y)=>{if(!le(p,"r"))return;let x=o.get(p.id);if(!Ce(x)||x===p)return;let m=ut(x),k=ut(p);if(m.length<=k.length||!m.startsWith(k))return;let S=l(p),w=S===void 0?void 0:i.get(S),A=m.length-k.length;if(!w||w.deleted.length!==A)return;let R=[],P=0,b=(F,M,L)=>{for(let v=M;v<F.length&&P<A;v+=1){let $=F[v];if(!(!o.has($.id)&&le($,"br"))&&!le($,"pPr")){if(le($,"endParaRPr"))return!0;if(!le($,"r")||o.has($.id))return!1;R.push({run:$,newParagraph:L}),P+=ut($).length}}return!0},I=b(h,y+1,!1),C=g[a+1],j=h.slice(y+1).every(F=>o.has(F.id)||le(F,"endParaRPr"));P<A&&I&&j&&C&&le(C,"p")&&!o.has(C.id)&&b(Ot(C),0,!0);let _=R.length>0&&R.every(F=>F.newParagraph),E=R.map(F=>ut(F.run)).join("");if(P>A||P<A&&!(_&&m.endsWith(E)))return;let O=S===void 0?void 0:t.nodes.get(S),D=O instanceof U.Map?O.get(N.text):void 0,K=D instanceof U.Text?Ar(t.doc,D):null,T=A-P;for(let F of R){let M=l(F.run),L=ut(F.run).length,v=M===void 0?void 0:i.get(M),$=M===void 0?void 0:t.nodes.get(M),G=w.deleted.slice(T,T+L);if(T+=L,!(L===0||!v?.created||v.inserted?.length!==L)&&!(!($ instanceof U.Map)||M===void 0)){$.set(ee.copyOf,[v.inserted.client,v.inserted.clock,...Fo(G)]),F.newParagraph&&$.set(ee.newParagraph,!0),K&&$.set(ee.seen,K),u.set(M,e);for(let oe of G)r.add(H(oe.client,oe.clock))}}})},d=c=>{if(o.get(c.id)===c)return;let g=Ot(c);g.forEach((a,h)=>{le(a,"p")&&Ce(o.get(a.id))&&f(a,g,h)});for(let a of g)d(a)};return d(n),r}function $o(t,e,n,o){let s=[];if(n.size===0)return s;let i=new Set,r=[],u=l=>{let f=n.get(l.id);if(f!==l){for(let d of l.children)i.add(d.id);if(Ce(f)){let d=new Set(l.children.map(g=>g.id)),c="";for(let g of f.children)!d.has(g.id)&&Ce(g)&&(le(g,"r")||le(g,"p"))&&r.push({node:g,from:l,prev:c}),c=o.get(g.id)??c}for(let d of l.children)Ce(d)&&u(d)}};u(e);for(let{node:l,from:f,prev:d}of r){if(i.has(l.id))continue;let c=o.get(l.id),g=o.get(f.id),a=g===void 0?void 0:t.nodes.get(g);(le(l,"r")&&le(f,"p")||le(l,"p")&&le(f,"txBody")&&!Sn(l))&&c!==void 0&&a instanceof U.Map&&a.set(`${ee.removedRun}${c}`,d);let p=[l];for(;p.length>0;){let y=p.pop();if(y!==l&&i.has(y.id))continue;if(Ce(y)){for(let S of y.children)p.push(S);continue}let x=o.get(y.id),m=x===void 0?void 0:t.nodes.get(x),k=m instanceof U.Map?m.get(N.text):void 0;if(!(!(k instanceof U.Text)||y.type!=="text"||y.value.length===0)&&k.toString()===y.value){for(let S of Tt(k,0,k.length))s.push(S);k.delete(0,k.length)}}}return s}function Wo(t,e){let n=o=>{let s=o.get(N.children);return s instanceof U.Array?s.toArray().filter(i=>typeof i=="string"):[]};for(let o of n(e).slice(0,bn)){let s=t.nodes.get(o);if(!(s instanceof U.Map))continue;let i=s.get(N.shell);if(!(i?.ns!==Nt||i.local!=="t"))for(let r of n(s).slice(0,bn)){let u=t.nodes.get(r),l=u instanceof U.Map?u.get(N.text):void 0;if(l instanceof U.Text&&l.length>0)return!0}}return!1}var Cr=t=>(t.children??[]).some(e=>!("text"in e)&&e.local==="t"&&(e.children??[]).some(n=>"text"in n&&n.text.length>0));function Dr(t,e){let n=e.get(N.children);if(!(n instanceof U.Array))return!1;let o=e.get(N.key),s=new Set;for(let r of e.keys())r.startsWith(ee.removedRun)&&s.size<vt&&s.add(r.slice(ee.removedRun.length));let i=n.toArray().slice(0,bn);for(let r of[...i,...s]){let u=typeof r=="string"?t.nodes.get(r):void 0;if(!(u instanceof U.Map))continue;let l=u.get(N.shell);if(l?.ns!==Nt)continue;if(l.local==="br")return!0;if(l.local!=="r"&&l.local!=="fld")continue;if(!(s.has(r)&&(!he(u)||u.get(z.movedFrom)===o))&&Wo(t,u))return!0}return!1}function Go(t,e,n,o,s){let i=new Map;for(let m of n.keys()){if(!m.startsWith(ee.removedRun))continue;let k=n.get(m);if(typeof k=="string"&&(i.set(m.slice(ee.removedRun.length),k),i.size>=vt))break}if(i.size===0)return o;let r=new Set(o.map(m=>m.key)),u=n.get(N.key),l=n.get(N.shell)?.local==="txBody",f=l?"p":"r",d=l?["bodyPr","lstStyle"]:["pPr"],c=new Map;for(let m of[...i.keys()].sort()){if(r.has(m))continue;let k=t.nodes.get(m);if(!(k instanceof U.Map)||k.get(N.part)!==e)continue;let S=k.get(N.shell);if(S?.ns!==Nt||S.local!==f||!he(k)||k.get(z.movedFrom)===u)continue;let A=(l?Dr:Wo)(t,k),R=s(m);R&&(A||Cr(R))&&c.set(m,R)}if(c.size===0)return o;let g=m=>{let k=i.get(m)??"";for(let S=0;S<vt&&k!==""&&!r.has(k)&&!c.has(k);S+=1)k=i.get(k)??"";return r.has(k)||c.has(k)?k:""},a=new Map;for(let[m,k]of c){let S=g(m),w=a.get(S);w?w.push(k):a.set(S,[k])}let h=[],p=new Set,y=(m,k)=>{if(!(k>vt))for(let S of a.get(m)??[])p.has(S.key)||(p.add(S.key),h.push(S),y(S.key,k+1))},x=!1;for(let m of o)!x&&("text"in m||!d.includes(m.local))&&(x=!0,y("",0)),h.push(m),y(m.key,0);x||y("",0);for(let m of c.values())p.has(m.key)||h.push(m);return h}import*as q from"yjs";import*as ke from"yjs";function be(t){if(!(t instanceof ke.AbstractType))return null;let e=t._item;return e instanceof ke.Item?e:null}function pe(t,e,n){for(let[o,s]of e.clients){let i=t.store.clients.get(o);if(!(!i||i.length===0))for(let{clock:r,len:u}of s){let l=i[i.length-1];if(!(r>=l.id.clock+l.length))for(let f=ke.findIndexSS(i,r);f<i.length;f+=1){let d=i[f];if(d.id.clock>=r+u)break;d instanceof ke.Item&&n(d)}}}}function Dt(t,e,n){let o=ke.createDeleteSet();for(let[s,i]of e.clients){let r=t.store.clients.get(s),u=[];for(let{clock:l,len:f}of i){if(!r||r.length===0){u.push({clock:l,len:f});continue}let d=l+f,c=l,g=r[r.length-1];if(l<g.id.clock+g.length)for(let a=ke.findIndexSS(r,l);a<r.length;a+=1){let h=r[a];if(h.id.clock>=d)break;if(!(h instanceof ke.Item)||!n(h))continue;let p=Math.max(l,h.id.clock);p>c&&u.push({clock:c,len:p-c}),c=Math.min(d,h.id.clock+h.length)}d>c&&u.push({clock:c,len:d-c})}u.length>0&&o.clients.set(s,u)}return o}function*Yn(t){for(let e=t._start;e;e=e.right)e.deleted||(yield e)}function*Xo(t){for(let e of t._map.values())e.deleted||(yield e)}function Lt(t,e){let n=0;for(let o=t._start;o!==null;o=o.right)if(!(o.deleted||!o.countable)){if(o.id.client===e.client&&e.clock>=o.id.clock&&e.clock<o.id.clock+o.length)return n+(e.clock-o.id.clock);n+=o.length}return-1}function _e(t,e){let n=[],o=0;for(let s=t._start;s!==null&&n.length<e.size;s=s.right)if(!(s.deleted||!s.countable)){for(let i=0;i<s.length;i+=1)e.has(`${s.id.client}:${s.id.clock+i}`)&&n.push(o+i);o+=s.length}for(let s=n.length-1;s>=0;){let i=s;for(;i>0&&n[i-1]===n[i]-1;)i-=1;t.delete(n[i],n[s]-n[i]+1),s=i-1}}var Bo=t=>t.left===null;var ve="pptx-undone-v1",Lr=64,Uo=1024,_r=1<<18,Fr=(t,e)=>t.id.client!==e.client||t.id.clock>=e.clock;function zr(t,e,n){if(typeof e!="object"||e===null)return null;let o=e;if(typeof o.p!="string"||n!==void 0&&o.p!==n||typeof o.u!="string"||typeof o.a!="string"||!Number.isSafeInteger(o.c)||o.c<0)return null;let s=Number.isSafeInteger(o.q)&&o.q>=0?o.q:1/0,i=typeof o.n=="string"?o.n:"",r=typeof o.s=="string"?o.s:null;return{key:t,parent:o.u,after:o.a,before:i,client:o.c,clock:s,shownIn:r}}function qo(t,e,n){let o=t.nodes,s=new Map,i=new Set;if(pe(t.doc,e.insertions,d=>{d.parent===t.parts&&d.parentSub!==null&&!d.deleted&&i.add(d.parentSub)}),pe(t.doc,e.insertions,d=>{let c=d.parent;if(d.deleted||!(c instanceof q.Array))return;let g=c.parent;if(!(g instanceof q.Map)||be(g)?.parent!==o||g.get(N.children)!==c||d.parentSub!==null||!(d.content instanceof q.ContentAny))return;let a=s.get(c);a||s.set(c,a=new Set);for(let h of d.content.getContent())typeof h=="string"&&a.add(h)}),s.size===0)return;let r=t.doc.getMap(ve),u=t.doc.clientID,l=q.getState(t.doc.store,u),f=[];for(let[d,c]of s){let g=d.parent;if(!(g instanceof q.Map)||g.get(N.children)!==d)continue;let a=g.get(N.key),h=g.get(N.part);if(typeof a!="string"||typeof h!="string"||i.has(h))continue;let p=d.toArray().filter(y=>typeof y=="string");p.forEach((y,x)=>{if(!c.has(y))return;let m=p[x+1]??"",k={p:h,u:a,a:p[x-1]??"",n:m,c:u,q:l};JSON.stringify(r.get(y))!==JSON.stringify(k)&&f.push([y,k])})}f.length>0&&n(()=>{for(let[d,c]of f)r.set(d,c)})}function Jo(t,e,n,o,s,i){let r=t.doc.getMap(ve),u=t.doc.clientID,l=new Set;for(let f of s){let d=o[f],c=typeof d=="string"?i(d):void 0;if(typeof d!="string"||c===void 0||l.has(d))continue;l.add(d);let g="";for(let p=f-1;p>=0&&g==="";p-=1)o[p]!==d&&typeof o[p]=="string"&&(g=o[p]);let a="";for(let p=f+1;p<o.length&&a==="";p+=1)o[p]!==d&&typeof o[p]=="string"&&(a=o[p]);let h={p:e,u:n,a:g,n:a,c:u,q:0,s:c};JSON.stringify(r.get(d))!==JSON.stringify(h)&&r.set(d,h)}}function Qo(t,e,n){let o=t.doc.getMap(ve);if(o.size===0)return;let s=new Set;pe(t.doc,e.deletions,i=>{if(!(!(i.parent instanceof q.Array)||!(i.content instanceof q.ContentAny)))for(let u of i.content.getContent())typeof u=="string"&&o.has(u)&&s.add(u)}),s.size>0&&n(()=>{for(let i of s)o.delete(i)})}function Zo(t,e,n){let o=new Map;if(pe(t.doc,e.insertions,r=>{if(r.parent!==t.nodes||r.parentSub===null||!(r.content instanceof q.ContentType)||!(r.content.type instanceof q.Map))return;let u=r.content.type;if(t.nodes.get(r.parentSub)!==u)return;let l=u.get(N.part),f=u.get(N.attrs),d=u.get(N.children);if(typeof l!="string"||!(f instanceof q.Map)||!(d instanceof q.Array)||f.size>0||d.length>0||!n(l,r.parentSub))return;let c=o.get(l);c||o.set(l,c=new Set),c.add(r.parentSub)}),o.size===0)return!1;let s=!1,i=0;for(let r of t.nodes.values()){if((i+=1)>_r)break;if(!(r instanceof q.Map))continue;let u=r.get(N.part),l=typeof u=="string"?o.get(u):void 0,f=r.get(N.children);if(!l||!(f instanceof q.Array))continue;let d=f.toArray();for(let c=d.length-1;c>=0;c-=1){let g=d[c];typeof g=="string"&&l.has(g)&&(f.delete(c,1),s=!0)}}return s}var Ho=new WeakMap;function Vo(t,e,n){let o=t.placeOf.get(e);if(o){let l=t.byPart.get(o.part),f=l?.get(o.parent);f?.delete(e),f?.size===0&&l.delete(o.parent),t.placeOf.delete(e)}let s=n===void 0?null:zr(e,n),i=s?n.p:null;if(!s||i===null)return;let r=t.byPart.get(i);r||t.byPart.set(i,r=new Map);let u=r.get(s.parent);u||r.set(s.parent,u=new Map),u.set(e,s),t.placeOf.set(e,{part:i,parent:s.parent})}function jr(t,e){let n=t.doc.getMap(ve),o=Ho.get(n);if(!o){let s={byPart:new Map,placeOf:new Map};o=s;for(let[i,r]of n.entries())Vo(s,i,r);Ho.set(n,s),n.observe(i=>{for(let r of i.keysChanged)Vo(s,r,n.get(r))})}return o.byPart.get(e)??new Map}var En="http://schemas.openxmlformats.org/drawingml/2006/main",es=new Set(["p","pPr","rPr","endParaRPr","ln","bodyPr","tcPr"]);function ts(t){if("text"in t)return t.text.length>0;if(t.ns!==En)return!1;let e=t.children??[];return t.local==="r"?e.some(n=>!("text"in n)&&n.ns===En&&n.local==="t"&&ts(n)):t.local==="t"?e.some(n=>"text"in n&&n.text.length>0):es.has(t.local)&&(e.length>0||(t.attrs??[]).length>0)}var _t=class t{#e;#t;#n;#i=new Map;shown=new Set;constructor(e,n,o){this.#e=e,this.#t=n,this.#n=o}static of(e,n,o){if(e.doc.getMap(ve).size===0)return null;let s=jr(e,n);if(s.size===0)return null;let i=new Set,r=[o];for(;r.length>0;){let u=r.pop();if(i.has(u))continue;i.add(u);let l=e.nodes.get(u);if(!(l instanceof q.Map)||l.get(N.part)!==n)continue;let f=l.get(N.children);if(f instanceof q.Array)for(let d of f.toArray())typeof d=="string"&&!i.has(d)&&r.push(d)}return new t(e,s,i)}#s(e,n,o){let s=`${e}\0${n.client}\0${n.clock}`,i=this.#i.get(s);if(i!==void 0)return i;this.#i.set(s,!1);let r=o<=Lr&&this.#l(e,n,o);return this.#i.set(s,r),r}#l(e,n,o){let s=this.#e.nodes.get(e);if(!(s instanceof q.Map))return!1;let i=d=>Fr(d,n),r=s.get(N.text);if(r instanceof q.Text){for(let d of Yn(r))if(d.countable&&i(d))return!0}let u=s.get(N.attrs);if(u instanceof q.Map){for(let d of Xo(u))if(i(d))return!0}let l=s.get(N.children);if(l instanceof q.Array){for(let d of Yn(l))if(i(d))return!0}let f=0;for(let d of s.keys())if(d.startsWith(ee.removedRun)){if((f+=1)>Uo)break;if(this.#s(d.slice(ee.removedRun.length),n,o+1))return!0}return this.#r(e).some(d=>this.#s(d.key,d,o+1))}#r(e){return[...this.#t.get(e)?.values()??[]].filter(n=>{if(this.#n.has(n.key)||n.shownIn!==null&&!this.#n.has(n.shownIn))return!1;let o=this.#e.nodes.get(n.key);return o instanceof q.Map&&!he(o)})}withUndone(e,n,o,s,i){let r=this.#r(e).filter(g=>!s.has(g.key)&&this.#s(g.key,g,0)).sort((g,a)=>g.key<a.key?-1:g.key>a.key?1:0).slice(0,Uo);if(r.length===0)return o;let u=[...o],l=new Set(u.map(g=>g.key)),f=new Map([...this.#t.get(e)?.values()??[]].map(g=>[g.key,g.after])),d=new Set(r.map(g=>g.key)),c="\0";for(let g=!1;d.size>0;){let a=!1;for(let h of r){if(!d.has(h.key))continue;let p=h.after,y=p!==""&&!l.has(p)&&!d.has(p)&&l.has(h.before)?h.before:null;y!==null&&(p=c);let x=new Set([h.key]),m=!1;for(;p!==""&&p!==c&&!l.has(p);){if(d.has(p)&&!g){m=!0;break}x.has(p)?p=c:(x.add(p),p=f.get(p)??c)}if(m)continue;d.delete(h.key),a=!0;let k=this.#c(h.key,n,s,i);if(!k||!ts(k))continue;let S=y!==null?u.findIndex(w=>w.key===y):p===""?0:p===c?u.length:u.findIndex(w=>w.key===p)+1;u.splice(S,0,k),l.add(h.key),this.shown.add(h.key)}a||(g=!0)}return u}#c(e,n,o,s){let i=this.#e.nodes.get(e);if(!(i instanceof q.Map)||i.get(N.part)!==n)return null;let r=i.get(N.text);if(r instanceof q.Text)return o.add(e),{key:e,text:r.toString()};let u=i.get(N.shell),{ns:l,local:f}=typeof u=="object"&&u!==null?u:{};return l!==En||typeof f!="string"||!es.has(f)&&f!=="r"&&f!=="t"?null:s(e)}};function os(t){let e=new Map;if(!t)return e;let n=[t];for(;n.length>0;){let o=n.pop();if(e.set(o.id,o),o.type==="element")for(let s of o.children)n.push(s)}return e}function Kr(t,e){let n=t.length,o=e.length,s=new Uint32Array((n+1)*(o+1));for(let f=n-1;f>=0;f--)for(let d=o-1;d>=0;d--)s[f*(o+1)+d]=t[f]===e[d]?s[(f+1)*(o+1)+d+1]+1:Math.max(s[(f+1)*(o+1)+d],s[f*(o+1)+d+1]);let i=new Set,r=new Set,u=0,l=0;for(;u<n&&l<o;)t[u]===e[l]?(i.add(u++),r.add(l++)):s[(u+1)*(o+1)+l]>=s[u*(o+1)+l+1]?u++:l++;return{keepA:i,keepB:r}}function In(t,e){let n=t.toArray();if(n.length===e.length&&n.every((r,u)=>r===e[u]))return;if(n.length*e.length>25e4){t.delete(0,n.length),t.insert(0,[...e]);return}let{keepA:o,keepB:s}=Kr(n,e);for(let r=n.length-1;r>=0;r--)o.has(r)||t.delete(r,1);let i=0;e.forEach((r,u)=>{s.has(u)||t.insert(i,[r]),i+=1})}function ss(t,e){if(t.size===0)return t;let n=Rt(e);return new Map([...t].filter(([o])=>n.has(o)))}function ns(t){let e=new Map;if(t?.kind!=="xml")return e;let n=[[t.xml.root,""]];for(;n.length>0;){let[o,s]=n.pop();if(e.set(o.id,s),o.type==="element")for(let i of o.children)n.push([i,`${o.id}/${s}`])}return e}function rs(t,e,n){let o,s;return i=>{let r=t?.get(i);if(r===void 0)return!1;o??=ns(e),s??=ns(n);let u=o.get(r);return u!==void 0&&u===s.get(r)}}function is(t,e,n){let o;return s=>{let i=t?.get(s);if(i===void 0||n?.kind!=="xml")return;if(!o){let u=new Map,l=[n.xml.root];for(;l.length>0;){let f=l.pop();if(f.type==="element")for(let d of f.children)u.set(d.id,f.id),l.push(d)}o=u}let r=o.get(i);return r===void 0?void 0:e?.get(r)}}var Wr="http://schemas.openxmlformats.org/drawingml/2006/main",Gr=1<<20;function Xr(t,e,n){let o=t.toString();if(o===e)return;let s=0;for(;s<o.length&&s<e.length&&o[s]===e[s];)s++;let i=0;for(;i<o.length-s&&i<e.length-s&&o[o.length-1-i]===e[e.length-1-i];)i++;let r=a=>a>=55296&&a<=56319,u=a=>a>=56320&&a<=57343;s>0&&r(o.charCodeAt(s-1))&&s--,i>0&&u(o.charCodeAt(o.length-i))&&i--;let l=o.length-s-i,f=e.length-s-i;if(l===f&&!/[\uD800-\uDFFF]/.test(o.slice(s,s+l)+e.slice(s,s+f))){let a=Tt(t,s,l),h=[];for(let p=s;p<s+l;p++){if(o[p]===e[p])continue;let y=a[p-s];y&&h.push(y),t.insert(p,e[p]),t.delete(p+1,1)}return{created:n,deleted:h}}let d=l>0?Tt(t,s,l):[];l>0&&t.delete(s,l);let c=t.doc,g=c?B.getState(c.store,c.clientID):0;return f>0&&t.insert(s,e.slice(s,e.length-i)),{created:n,deleted:d,...f>0&&c?{inserted:{client:c.clientID,clock:g,length:f}}:{}}}var cs=(t,e)=>t.attrs.find(n=>n.ns===""&&n.local===e)?.value,Br=t=>({ns:t.ns,local:t.local,...t.prefix?{prefix:t.prefix}:{},nsDecls:t.nsDecls.map(e=>({prefix:e.prefix,uri:e.uri}))}),Ft=class{#e;#t=new Map;#n=new Map;#i=new Map;#s=new Set;#l=new Map;#r=new Map;#c=new Map;#g=new Set;#a=new Map;#d=new Map;#f=rt;#u=null;#w=new Map;#h=new Map;#x;#m=new Set;constructor(e,n={value:0}){this.#e=e,this.#x=n;let o=`${e.doc.clientID.toString(36)}.`;for(let s of e.nodes.keys()){if(!s.startsWith(o))continue;let i=Number.parseInt(s.slice(o.length).replace(St,""),36);Number.isSafeInteger(i)&&i<=Kn&&i>n.value&&(n.value=i)}}get seeded(){return this.#e.parts.size>0}#M(e,n){for(let o of this.#i.get(e)??[])this.#n.delete(o);for(let[o,s]of n)this.#n.set(o,s);this.#i.set(e,new Set(n.keys())),this.#s.clear(),this.#w.clear();for(let[o,s]of this.#n)for(let i of s.companions)this.#s.add(i),this.#w.set(i,o)}#S(e,n){for(let o of this.#t.get(e)?.idOf.keys()??[])this.#h.delete(o);if(!n){this.#t.delete(e);return}this.#t.set(e,n);for(let o of n.idOf.keys())this.#h.set(o,e)}#E(e){let n=this.#t.get(e);return n||(n={keyOf:new Map,idOf:new Map},this.#t.set(e,n)),n}#y=!1;#I(){let e=this.#e.doc.clientID.toString(36),n=this.#y?St:"",o;do this.#x.value+=1,o=`${e}.${n}${this.#x.value.toString(36)}`;while(this.#e.nodes.has(o));return o}seed(e){this.#y=!0;try{for(let n of e.parts.values())this.#R(n,void 0)}finally{this.#y=!1}}hasHiddenListings(e){return e.some(n=>this.#a.has(n))}dropHiddenListings(e,n,o){for(let s of e){let i=this.#a.get(s);if(!i)continue;let r=rs(this.#t.get(s)?.idOf,n.parts.get(s),o.parts.get(s)),u=this.#t.get(s),l=is(u?.idOf,u?.keyOf,n.parts.get(s));this.#a.delete(s);for(let[f,d]of i){let c=this.#Y(f);if(!c||c.length!==d.length)continue;let g=[...d.at.keys()].sort((h,p)=>p-h);if(g.some(h=>c.get(h)!==d.at.get(h)))continue;let a=g.filter(h=>r(d.at.get(h)));a.length>0&&Jo(this.#e,s,f,c.toArray(),a,l);for(let h=0;h<g.length;){let p=h+1;for(;p<g.length&&g[p]===g[p-1]-1;)p++;c.delete(g[p-1],p-h),h=p}}}}writeChange(e,n,o){for(let s of o){let i=n.parts.get(s);if(!i){this.#e.parts.delete(s),this.#e.binaries.delete(s),this.#S(s,void 0);continue}this.#R(i,e.parts.get(s))}}#R(e,n){if(e.kind==="binary"){(n?.kind!=="binary"||n.bytes!==e.bytes)&&this.#e.binaries.set(e.partName,e.bytes),$e(this.#e.parts.get(e.partName))?.kind!=="binary"&&this.#e.parts.set(e.partName,{kind:"binary"});return}n?.kind==="binary"&&this.#e.binaries.delete(e.partName);let o={partName:e.partName,ids:this.#E(e.partName),before:os(n?.kind==="xml"?n.xml.root:void 0),texts:new Map},s=this.#b(e.xml.root,o),i=this.#r.get(e.partName);this.#r.delete(e.partName);for(let u of Eo(e.xml.root,i,o.ids.keyOf))this.#b(u,{...o,before:Yo(o.before,u.id)});co(this.#e,e.partName,e.xml.root,o.before,o.ids.keyOf),Ro(this.#e,e.xml.root,o.before,o.ids.keyOf),this.#v(e.partName,e.xml.root,o);let r=$e(this.#e.parts.get(e.partName));(r?.kind!=="xml"||r.root!==s)&&this.#e.parts.set(e.partName,{kind:"xml",root:s})}#v(e,n,o){if(this.#y)return;let s=Ko(this.#e,e,n,o.before,o.ids.keyOf,o.texts),i=$o(this.#e,n,o.before,o.ids.keyOf),r=this.#e.doc,u=new Map,l=f=>{if(this.#m.size>=Gr||s.has(H(f.client,f.clock)))return;let d=ue(r,f,u,!1);this.#m.add(H(d.client,d.clock))};for(let f of o.texts.values())for(let d of f.deleted)l(d);for(let f of i)l(f)}get deletedText(){return this.#m}showingUnlisted(e){return e.filter(n=>(this.#c.get(n)?.size??0)>0)}forgetDeleted(e){for(let n of e)this.#m.delete(n)}newCopies(e){let n=new Map,o=e.changed.get(this.#e.nodes);if(!o)return n;let s=this.#e.doc.getMap(De);for(let i of o){if(i===null)continue;let r=s.get(i),u=this.#e.nodes.get(i),l=Ee(u);if(typeof r!="string"||!l||l.client===this.#e.doc.clientID||u.get(N.part)!==r)continue;let f=n.get(r);f?f.push(i):n.set(r,[i])}return n}#b(e,n){let{partName:o,ids:s,before:i}=n,r=s.keyOf.get(e.id),u=r===void 0?void 0:this.#e.nodes.get(r);if(r!==void 0&&u instanceof B.Map&&i.get(e.id)===e)return r;let l=r===void 0||!(u instanceof B.Map);if(r===void 0||!(u instanceof B.Map)){r=this.#I();let b=new B.Map;this.#e.nodes.set(r,b),b.set(N.part,o),b.set(N.key,r),e.type==="text"?b.set(N.text,new B.Text):(b.set(N.attrs,new B.Map),b.set(N.children,new B.Array)),u=b,s.keyOf.set(e.id,r),s.idOf.set(r,e.id),this.#h.set(r,o)}let f=u;if(e.type==="text"){let b=f.get(N.text),I=b instanceof B.Text?Xr(b,e.value,l):void 0;return I&&n.texts.set(r,I),r}let d=Br(e);JSON.stringify(f.get(N.shell))!==JSON.stringify(d)&&f.set(N.shell,d);let c=this.#n.get(r),g=this.#e.doc.clientID.toString(36),a=c?.merge?[r,...c.companions].find(b=>ge(b)===g)??r:r,h=f.get(N.attrs);if(h instanceof B.Map){let b=new Map;for(let C of e.attrs)b.set(`${C.ns}${yt}${C.local}`,{ns:C.ns,local:C.local,value:C.value,...C.prefix?{prefix:C.prefix}:{}});let I=c?.merge?c.companions.map(C=>this.#k(C)):[];for(let C of[...h.keys()])b.has(C)||h.delete(C);for(let C of I)for(let j of[...C?.keys()??[]])b.has(j)||C.delete(j);for(let[C,j]of b){let _=c?.attrFrom.get(C)??(h.has(C)?r:void 0),E=_===void 0?void 0:this.#k(_);if(E&&JSON.stringify(E.get(C))===JSON.stringify(j))continue;if((this.#k(a)??h).set(C,j),c?.merge)for(let D of[r,...c.companions])D!==a&&this.#k(D)?.delete(C)}}let p=e.children.map(b=>this.#b(b,n)),y=new Set(p),x=f.get(N.children),m=(b,I)=>{let C=[],j=new Set,_=E=>{j.has(E)||(j.add(E),C.push(E))};for(let E of b){_(E);for(let O of this.#n.get(E)?.companions??[])I.has(O)&&_(O)}return C},k=new Set(x instanceof B.Array?x.toArray():[]),S=this.#c.get(o),w=c?p.filter(b=>!c.childFrom.has(b)&&!k.has(b)&&!S?.has(b)):[],A=(c?p.filter(b=>!c.childFrom.has(b)&&(k.has(b)||a===r)):p).filter(b=>!S?.has(b)||k.has(b));if(x instanceof B.Array){let b=x,I=b.toArray();In(b,po(I,this.#P(e,I,m(A,new Set(I))),this.#l.get(o)))}let R=new Set;if(c?.merge)for(let b of e.children)b.type==="element"&&R.add(We(e,b,I=>cs(b,I))?.slot);let P=new Set(w);c?.merge&&e.children.forEach((b,I)=>{b.type==="element"&&P.has(p[I])&&R.delete(We(e,b,C=>cs(b,C))?.slot)});for(let b of c?.merge?c.companions:[]){let I=this.#Y(b);if(!I)continue;let C=I.toArray(),j=C.filter(_=>{if(this.#s.has(_))return y.has(this.#w.get(_));if(c.childFrom.get(_)===b)return y.has(_);let E=c.shadowed.get(_);return E!==void 0&&R.has(E)});In(I,m([...j,...b===a?w:[]],new Set(C)))}return r}#P(e,n,o){let s=new Set(o),i=new Set(n),r=n.filter(a=>s.has(a)),u=o.filter(a=>i.has(a)),l=(a,h)=>a.length===h.length&&a.every((p,y)=>p===h[y]);if(l(r,u)||!l(Ge(e,r,a=>this.#O(a)),u))return o;let f=new Map,d=[],c;for(let a=o.length-1;a>=0;a--){let h=o[a];if(i.has(h))c=h;else if(c===void 0)d.unshift(h);else{let p=f.get(c);p||f.set(c,p=[]),p.unshift(h)}}let g=[];for(let a of r){for(let h of f.get(a)??[])g.push(h);g.push(a)}for(let a of d)g.push(a);return g}#O(e){let n=this.#e.nodes.get(e),o=n instanceof B.Map?n.get(N.shell):void 0;if(typeof o!="object"||o===null)return;let{ns:s,local:i}=o;return typeof s=="string"&&typeof i=="string"?{ns:s,local:i}:void 0}#k(e){let n=this.#e.nodes.get(e),o=n instanceof B.Map?n.get(N.attrs):void 0;return o instanceof B.Map?o:void 0}#Y(e){let n=this.#e.nodes.get(e),o=n instanceof B.Map?n.get(N.children):void 0;return o instanceof B.Array?o:void 0}keyOf(e,n){return this.#t.get(e)?.keyOf.get(n)}idOf(e,n){return this.#t.get(e)?.idOf.get(n)}textOf(e){let n=this.#e.nodes.get(e),o=n instanceof B.Map?n.get(N.text):void 0;return o instanceof B.Text?o:void 0}partOf(e){let n=this.#e.nodes.get(e),o=n instanceof B.Map?n.get(N.part):void 0;return typeof o=="string"?o:void 0}recordOfText(e){let n=e.parent,o=n instanceof B.Map?n.get(N.key):void 0;if(typeof o!="string"||this.#e.nodes.get(o)!==n)return;let s=n.get(N.part);return typeof s=="string"?{key:o,part:s}:void 0}touchedParts(e){let n=new Set,o=this.#e.parts,s=this.#e.binaries,i=this.#e.nodes,r=this.#e.doc,u=[r.getMap(Ne),r.getMap(at)],l=r.getMap(bt),f=r.getMap(ve);for(let[d,c]of e.changed){let g=d;if(g===o||g===s){for(let p of c)p!==null&&n.add(p);continue}if(u.includes(g)){for(let p of c){let y=p===null?void 0:d.get(p);typeof y=="string"&&n.add(y)}continue}if(g===f){for(let p of c){if(p===null)continue;let y=this.#e.doc.getMap(ve).get(p),x=typeof y=="object"&&y!==null?y.p:void 0,m=this.#e.nodes.get(p),k=typeof x=="string"?x:m instanceof B.Map?m.get(N.part):void 0;typeof k=="string"&&n.add(k)}continue}if(g===l){for(let p of c){let y=p===null?void 0:this.#e.nodes.get(p.split("\0")[0]),x=y instanceof B.Map?y.get(N.part):void 0;typeof x=="string"&&n.add(x)}continue}if(g===i){for(let p of c){if(p===null)continue;let y=this.#e.nodes.get(p),x=y instanceof B.Map?y.get(N.part):void 0;if(typeof x=="string"){n.add(x);continue}let m=this.#h.get(p);m!==void 0&&n.add(m)}continue}let a=g;for(;a instanceof B.AbstractType&&a.parent!==i;)a=a.parent;let h=a instanceof B.Map?a.get(N.part):void 0;typeof h=="string"&&n.add(h)}return n}allParts(e){let n=new Set(this.#e.parts.keys());for(let o of e.parts.keys())n.add(o);return n}rebuild(e,n,o=!1){let s=[],i=[],r=new Map,u=new Map,l=new Map,f=new Map,d=new Map,c=[...e];for(let a of c)[this.#a,this.#r].forEach(h=>h.delete(a));let g=new Map;for(let a of c){let h=$e(this.#e.parts.get(a));if(!h){if(this.#e.parts.has(a))return{ok:!1,reason:`invalid part entry ${a}`};n.parts.has(a)&&i.push(a);continue}if(h.kind==="binary"){let _=this.#e.binaries.get(a);if(!(_ instanceof Uint8Array)||_.length>et.maxBinaryBytes)return{ok:!1,reason:`invalid binary part ${a}`};s.push({kind:"binary",partName:a,bytes:_});continue}let p=new Map;this.#g=new Set,this.#o=void 0,this.#f=lt(this.#e,a,h.root),this.#d=new Map,this.#u=_t.of(this.#e,a,h.root);let y=(_,E,O)=>this.#p(_,a,E,O,p),x=new Set,m=()=>{x=new Set;let _=this.#p(h.root,a,new Set,0,p);return _&&mo(this.#e,a,_,y,x)},k=m(),S=this.#f;if(k&&(S.lost.size>0||S.unseenWinners.size>0)){let _=lt(this.#e,a,h.root,Rt(k));yo(_,S)||(this.#f=_,this.#g=new Set,this.#d=new Map,p.clear(),k=m())}if(!k)return{ok:!1,reason:`${this.#o??"invalid node records"} in ${a}`};let w=go(this.#e,a,k,y,this.#f.lost);if(this.#o)return{ok:!1,reason:`${this.#o} in ${a}`};let A=new Set,R=vo(this.#e,w,x,A);d.set(a,A);let P=o?void 0:this.#t.get(a),b=n.parts.get(a),I=b?.kind==="xml"?b.xml.nextId:1,C=$r(a,R,{idOf:_=>P?.idOf.get(_),nextId:I});if(!C.ok)return{ok:!1,reason:`${a}: ${C.reason}`};let j={keyOf:new Map,idOf:new Map};for(let[_,E]of C.ids)j.idOf.set(_,E),j.keyOf.set(E,_);r.set(a,j),u.set(a,p),l.set(a,this.#g),f.set(a,ss(this.#d,R)),g.set(a,this.#u?.shown??new Set),s.push({kind:"xml",partName:a,xml:C.part})}for(let[a,h]of r)this.#S(a,h);for(let a of i)this.#S(a,void 0);for(let[a,h]of u)this.#M(a,h);for(let a of i)this.#M(a,new Map);for(let[a,h]of l)this.#l.set(a,h);for(let a of i)this.#l.delete(a);for(let[a,h]of f)h.size>0&&this.#a.set(a,h);for(let a of i)this.#a.delete(a);for(let[a,h]of g)this.#c.set(a,h);for(let a of i)this.#c.delete(a);for(let[a,h]of d)this.#r.set(a,h);return this.#u=null,{ok:!0,parts:s,removed:i}}#o;#p(e,n,o,s,i){if(s>et.maxReadDepth||o.has(e))return null;o.add(e);let r=this.#e.nodes.get(e);if(!(r instanceof B.Map)||r.get(N.part)!==n)return null;let u=r.get(N.shell),l=r.get(N.attrs),f=r.get(N.children);if(typeof u!="object"||u===null||!(l instanceof B.Map)||!(f instanceof B.Array))return null;let d=u,c=[],g=f.toArray();for(let[S,w]of g.entries()){if(typeof w!="string")continue;if(o.has(w)){let P=this.#d.get(e);P||this.#d.set(e,P={length:g.length,at:new Map}),P.at.set(S,w);continue}let A=this.#e.nodes.get(w);if(A instanceof B.Map&&A.get(N.text)instanceof B.Text){if(A.get(N.part)!==n)continue;o.add(w),c.push({key:w,text:A.get(N.text).toString()});continue}let R=this.#p(w,n,o,s+1,i);if(R)c.push(R);else if(this.#o)return null}let a=[...l.entries()].sort(([S],[w])=>S<w?-1:S>w?1:0).map(([,S])=>S),h=d.ns,p=d.local,y=(p==="p"||p==="txBody")&&h===Wr?Go(this.#e,n,r,c,S=>{let w=this.#p(S,n,o,s+1,i);return this.#o?null:w}):c,x=this.#u?this.#u.withUndone(e,n,y,o,S=>this.#p(S,n,o,s+1,i)):y;if(this.#o)return null;let m=uo(this.#e,{ns:h,local:p},x,this.#g,this.#f.unseenWinners),k=cn({ns:h,local:p},m,i);return k?{key:e,ns:h,local:p,...typeof d.prefix=="string"?{prefix:d.prefix}:{},nsDecls:Array.isArray(d.nsDecls)?d.nsDecls:[],attrs:a,children:[...Ge({ns:h,local:p},k,S=>"text"in S?void 0:S)]}:(this.#o="too many concurrent copies of one element",null)}};import*as Se from"yjs";var zt="pptxEditor",Ur=256,ls=256,ds=512,fs=256,us=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,Fe=(t,e=Ur)=>typeof t=="string"&&t.trim().length>0&&t.length<=e;function ps(t){return!Fe(t.actorId)||!Fe(t.name)||t.role!==void 0&&t.role!=="human"&&t.role!=="agent"?"invalid-identity":t.color!==void 0&&!us.test(t.color)?"invalid-identity-color":null}function gs(t){let{actorId:e,name:n,color:o,role:s}=t;return!Fe(e)||!Fe(n)?null:{actorId:e,name:n,...typeof o=="string"&&us.test(o)?{color:o}:{},...s==="human"||s==="agent"?{role:s}:{}}}function hs(t){let e=t?.[zt];return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function ms(t,e){if(t.kind==="shapes"){let i=t.shapes.slice(0,ds).map(r=>e.keyOf(t.part,r)).filter(r=>r!==void 0);return i.length>0?{kind:"shapes",part:t.part,keys:i}:void 0}let n=i=>{let r=e.keyOf(t.part,i.node);if(r===void 0)return;let u=e.textOf(r);if(!u)return{key:r};let l=Math.max(0,Math.min(Math.trunc(i.offset)||0,u.length));return{rel:Se.relativePositionToJSON(Se.createRelativePositionFromTypeIndex(u,l))}},o=n(t.anchor),s=n(t.head);return o&&s?{kind:"text",anchor:o,head:s}:void 0}function ys(t,e){return{actorId:t.actorId,name:t.name,...t.color?{color:t.color}:{},...t.role?{role:t.role}:{},...e?{selection:e}:{}}}function ks(t){let e=[];for(let[n,o]of t.getStates()){if(e.length>=ls)break;let s=hs(o),i=s?gs(s):null;i&&e.push({...i,isLocal:n===t.clientID})}return e}function as(t,e,n){if(typeof t!="object"||t===null)return null;let o=t;if(Fe(o.key,fs)){let l=n.partOf(o.key),f=l?n.idOf(l,o.key):void 0;return l&&f?{part:l,node:f,offset:0}:null}let s=o.rel;if(typeof s!="object"||s===null)return null;let i;try{i=Se.createAbsolutePositionFromRelativePosition(Se.createRelativePositionFromJSON(s),e)}catch{return null}if(!i||!(i.type instanceof Se.Text))return null;let r=n.recordOfText(i.type),u=r?n.idOf(r.part,r.key):void 0;return r&&u?{part:r.part,node:u,offset:i.index}:null}function jt(t,e,n){if(typeof t!="object"||t===null)return null;let o=t;if(o.kind==="shapes"&&Fe(o.part,1024)&&Array.isArray(o.keys)){let s=o.part,i=o.keys.slice(0,ds).filter(r=>Fe(r,fs)).map(r=>n.idOf(s,r)).filter(r=>r!==void 0);return i.length>0?{kind:"shapes",part:s,shapes:i}:null}if(o.kind==="text"){let s=as(o.anchor,e,n),i=as(o.head,e,n);return!s||!i||s.part!==i.part?null:{kind:"text",part:s.part,anchor:{node:s.node,offset:s.offset},head:{node:i.node,offset:i.offset}}}return null}function ws(t,e,n){let o=[],s=0;for(let[i,r]of t.getStates()){if(++s>ls)break;if(i===t.clientID)continue;let u=hs(r),l=u?gs(u):null;if(!u||!l)continue;let f=jt(u.selection,e,n);f&&o.push({actorId:l.actorId,name:l.name,...l.color?{color:l.color}:{},selection:f})}return o}import*as J from"yjs";var Hr=4096,Ss=1<<20,Vr=65536,qr=1<<20,xs="http://schemas.openxmlformats.org/drawingml/2006/main",Jr=t=>t.type==="element";function Qr(t,e){let n=ye(t,e);if(!n)return null;let o=0;for(let s=n.parent instanceof J.Text?n.parent._start:null;s;s=s.right){if(s===n)return{text:n.parent,at:o+(e.clock-n.id.clock)};o+=s.length}return null}function Zr(t,e){let n=new Map,o=t.package.parts.get(e);if(o?.kind!=="xml")return n;let s=(i,r,u)=>{let l=t.keyOf(e,i.id),f=i.ns===xs&&i.local==="p"&&l&&u?{p:{key:l,parent:u}}:i.ns===xs&&i.local==="r"&&l?{...r,run:l}:r;for(let d of i.children)if(Jr(d))s(d,f,l);else{let c=t.keyOf(e,d.id);c!==void 0&&n.set(c,{order:n.size,...f})}};return s(o.xml.root,{},void 0),n}function bs(t,e,n,o,s,i){let r=t.doc,u=r.clientID,l=M=>{let L=t.nodes.get(M),v=Ee(L),$=L instanceof J.Map?L.get(N.text):void 0;return!v||!($ instanceof J.Text)||L.get(N.part)!==e?null:{key:M,copy:v,text:$}},f=new Set(n.filter(M=>{let L=l(M);return L!==null&&L.copy.client!==u}));if(f.size===0)return;let d=Zr(s,e),c=[],g=0;for(let[M,L]of t.doc.getMap(De).entries()){if(L!==e)continue;let v=l(M);if(!(!v||v.text.length===0&&!d.has(M))){if(c.length>=Hr||(g+=v.copy.length)>Ss)return;c.push(v)}}let a=c.filter(M=>f.has(M.key));if(a.length===0)return;let h=new Map,p=M=>ue(r,M,h),y=new Map,x=new Map,m=M=>(x.has(M.key)||x.set(M.key,Qr(r,p(M.copy.source(0)))),x.get(M.key)),k=(M,L)=>{let v=m(M),$=m(L);return v&&$&&v.text===$.text?v.at-$.at:0},S=M=>d.get(M.key)?.order??-1,w=(M,L)=>(k(M,L)||S(M)-S(L))>=0?M:L,A=(M,L)=>J.createID(M.copy.client,M.copy.clock+L),R=M=>{if(M.copy.newParagraph)return!0;let L=M.copy.source(0);for(let v=0;v<Mn;v+=1){let $=ye(r,L),G=$?Ee(Rn($)):null,oe=G?L.clock-G.clock:-1;if(!G||L.client!==G.client||oe<0||oe>=G.length)return!1;if(G.newParagraph)return!0;L=G.source(oe)}return!1},P=new Map;for(let M of c)if(d.has(M.key))for(let L=0;L<M.copy.length;L+=1){let v=A(M,L);if(Ct(r,v))continue;let $=p(M.copy.source(L)),G=H($.client,$.clock),oe=P.get(G);oe?oe.push({copy:M,id:v}):P.set(G,[{copy:M,id:v}])}let b=M=>P.get(H(M.client,M.clock))?.reduce((L,v)=>w(L.copy,v.copy)===L.copy?L:v);for(let M of a)ti(t,M,zo(t.nodes.get(M.key)),L=>b(p(L)),i);let I=new Map,C=(M,L)=>{let v=I.get(M);v?v.push(L):I.set(M,[L])};if(o.size>0)for(let M of a)for(let L=0;L<M.copy.length;L+=1){let v=ue(r,M.copy.source(L),y,!1);o.has(H(v.client,v.clock))&&!Ct(r,A(M,L))&&C(M.text,A(M,L))}let j=new Map,_=M=>{let L=j.get(M.key);return L===void 0&&j.set(M.key,L=R(M)),L};for(let M of P.values()){if(M.length<2||!M.some(v=>f.has(v.copy.key))||!M.some(v=>_(v.copy))||new Set(M.map(v=>v.copy.key)).size<2)continue;let L=M.reduce((v,$)=>w(v.copy,$.copy)===v.copy?v:$);for(let v of M)v!==L&&C(v.copy.text,v.id)}for(let[M,L]of I)_e(M,new Set(L.map(v=>H(v.client,v.clock))));let E=new Map,O=M=>{let L=E.get(M.key);if(!L){L=new Set;for(let v=0;v<M.copy.length;v+=1){let $=p(M.copy.source(v));L.add(H($.client,$.clock))}E.set(M.key,L)}return L},D=qr,K=(M=1)=>(D-=M)>=0,F={room:t,me:u,incoming:a,all:c,placed:d,share:(M,L)=>{let[v,$]=[O(M),O(L)].sort((G,oe)=>G.size-oe.size);if(!K(v.size))return!1;for(let G of v)if($.has(G))return!0;return!1},laterStart:k,step:K};ni(F),ei(F)}function Kt(t,e){let n=t.nodes.get(e),o=n instanceof J.Map?n.get(N.children):void 0;return o instanceof J.Array?o:void 0}function ei({room:t,me:e,incoming:n,all:o,placed:s,share:i,step:r}){let u=new Map,l=(f,d)=>{let c=u.get(f);if(!c){u.set(f,c=new Map);let g=Vr,a=h=>{let p=Kt(t,h)?.toArray()??[];return g-=p.length,g<0?[]:p};for(let h of a(f))for(let p of a(h))for(let y of a(p))for(let x of a(y))c.set(x,{p:h,run:p})}return c.get(d)};for(let f of n){let d=s.get(f.key);if(!(!d?.p||!d.run))for(let c of o){if(!r())return;if(c.copy.client!==e||c.key===f.key||!i(f,c))continue;let g=l(d.p.parent,c.key),a=g?t.nodes.get(g.run):void 0;if(!g||g.p===d.p.key||!(a instanceof J.Map)||a.get(z.movedFrom)!==d.p.key)continue;let h=Kt(t,d.p.key),p=Kt(t,g.p),y=h?.toArray().indexOf(d.run)??-1;if(!(!h||!p||y<0)){h.delete(y,1),p.insert(p.toArray().indexOf(g.run),[d.run]);break}}}}function ti(t,e,n,o,s){let i=t.doc,r=i.clientID,l=ye(i,e.copy.source(0))?.parent;if(!(l instanceof J.Text))return;let f=new Set;for(let a=0;a<e.copy.length;a+=1){let h=e.copy.source(a);f.add(H(h.client,h.clock))}let d=new Map,c=[],g=null;for(let a=l._start;a!==null;a=a.right){if(a.deleted||!(a.content instanceof J.ContentString))continue;let h=a.content.str;for(let p=0;p<h.length;p+=1){let y=J.createID(a.id.client,a.id.clock+p),x=p===0?a.origin:J.createID(a.id.client,a.id.clock+p-1),m=x?H(x.client,x.clock):"",k=a.id.client!==r||!x?void 0:f.has(m)?x:d.get(m);if(!k){g=null;continue}if(d.set(H(y.client,y.clock),k),n?.(y))continue;(!g||!J.compareIDs(g.anchor,k))&&(g={anchor:k,ids:[],written:[],text:"",marks:[]},c.push(g)),g.ids.push(y);let S=He(i,y);S&&o(y)||(S&&g.marks.push([g.text.length,S]),g.written.push(y),g.text+=h[p])}}for(let a of c){let h=o(a.anchor),p=h?Lt(h.copy.text,h.id):-1;if(!h||p<0||(_e(l,new Set(a.ids.map(m=>H(m.client,m.clock)))),a.text.length===0))continue;let y=J.getState(i.store,r);h.copy.text.insert(p+1,a.text);let x=t.nodes.get(h.copy.key);x instanceof J.Map&&Lo(x,r,y,a.written),pt(i,a.marks.flatMap(([m,k])=>[y+m,k.client,k.clock,1])),s(a.ids[0],J.createID(r,y),a.text.length)}}function Ms(t,e,n){if(n.size===0)return;let o=t.doc,s=new Map,i=0;for(let r of e){let u=t.nodes.get(r),l=u instanceof J.Map?u.get(N.text):void 0;if(!(l instanceof J.Text))continue;let f=[];for(let d of At(u))if(!(d.client===o.clientID||(i+=d.length)>Ss))for(let c=0;c<d.length;c+=1){let g=J.createID(d.client,d.clock+c),a=ue(o,d.source(c),s,!1);n.has(H(a.client,a.clock))&&!Ct(o,g)&&f.push(g)}f.length>0&&_e(l,new Set(f.map(d=>H(d.client,d.clock))))}}function ni({room:t,me:e,incoming:n,all:o,placed:s,share:i,laterStart:r,step:u}){for(let l of o){if(l.copy.client!==e||!l.copy.newParagraph)continue;let f=s.get(l.key)?.p,d=f?Kt(t,f.parent):void 0;if(!f||!d)continue;let c=d.toArray();if(!u(c.length))return;let g=new Map(c.map((p,y)=>[p,y])),a=g.get(f.key)??-1;if(a<0)continue;let h;for(let p of n){if(!u())return;if(p.key===l.key||r(l,p)<=0)continue;let y=s.get(p.key)?.p;if(!y||y.parent!==f.parent||y.key===f.key)continue;let x=g.get(y.key)??-1;x<=a||h&&x<=h.at||!i(p,l)||(h={key:y.key,at:x})}h&&(d.delete(a,1),d.insert(d.toArray().indexOf(h.key)+1,[f.key]))}}import*as Rs from"yjs";var oi=new Set([N.part,N.key,N.shell,ee.copyOf,ee.newParagraph]);function Ys(t){return e=>{let n=e.parent;if(n===t)return!1;let o=be(n);return o===null||o.parent!==t?!0:e.content instanceof Rs.ContentType?!1:!(e.parentSub!==null&&oi.has(e.parentSub)&&Bo(e))}}import*as re from"yjs";var si=4096,ri=4096,ii=32;function ci(t,e,n,o,s=new Set){let i=t.doc,r=new Map,u=0;for(let[l,f]of i.getMap(De).entries()){if(typeof f!="string"||!e.has(f)||!n(f,l))continue;if((u+=1)>si)return null;let d=t.nodes.get(l),c=d instanceof re.Map?d.get(N.text):void 0;if(!(!Ee(d)||!(c instanceof re.Text))){for(let g=c._start;g!==null;g=g.right)if(!(g.deleted||!g.countable))for(let a=0;a<g.length;a+=1){let h=H(g.id.client,g.id.clock+a);if(s.has(h))continue;let p=ue(i,re.createID(g.id.client,g.id.clock+a),o),y=H(p.client,p.clock);y!==h&&!r.has(y)&&r.set(y,{text:c,item:g,j:a})}}}return r}function ze(t,e){let n=e.parent;if(!(n instanceof re.Map)||be(n)?.parent!==t.nodes)return null;let o=n.get(N.part);return typeof o=="string"?o:null}function Es(t,e){let n=t.content.getContent();return n.length>0&&typeof n[0]=="string"?String(n.join("")).charAt(e):""}var ai=t=>re.createID(t.item.id.client,t.item.id.clock+t.j);function Is(t,e,n){let o=t.doc,s=[],i=new Map,r=!1;return pe(o,e,u=>{if(r||!u.countable||!(u.parent instanceof re.Text)||u.redone===null)return;let l=u.parent,f=ye(o,u.redone);if(!ze(t,l)||!f||f.deleted||f.parent!==l)return;let d=Math.min(u.length,f.length);for(let c=0;c<d;c+=1){if(s.length>=Le){r=!0;return}let g=ue(o,re.createID(u.id.client,u.id.clock+c),i);s.push({text:l,item:f,j:c,root:g,char:Es(f,c)})}}),!r&&vs(t,s,n,i,()=>!0)}function vs(t,e,n,o,s){let i=t.doc;if(e.length===0)return!1;let r=new Set;for(let p of e)r.add(ze(t,p.text));let u=p=>H(p.item.id.client,p.item.id.clock+p.j),l=new Set(e.map(u)),f=ci(t,r,n,o,l);if(!f||f.size===0)return!1;let d=p=>{let y=0,x=p.item,m=p.j-1;for(;x!==null&&y<ri;){for(;m>=0&&x.countable;m-=1,y+=1){let k=re.createID(x.id.client,x.id.clock+m);if(l.has(H(k.client,k.clock)))continue;let S=ue(i,k,o),w=f.get(H(S.client,S.clock));if(w&&w.text!==p.text)return w;if(!x.deleted)return null}x=x.left,m=x?x.length-1:-1}return null},c=[],g=[];for(let p of e){let y=f.get(H(p.root.client,p.root.clock));if(y&&y.text!==p.text){c.push(p);continue}let x=s(p)?d(p):null;if(!x)continue;let m=g[g.length-1];m&&m.to.item===x.item&&m.to.j===x.j?m.chars.push(p):g.push({to:x,chars:[p]})}if(c.length===0&&g.length===0)return!1;let a=[];for(let{to:p,chars:y}of g){let x=Lt(p.text,ai(p));if(x<0)continue;let m=y.map(S=>S.char).join("");if(m.length===0)continue;let k=re.getState(i.store,i.clientID);p.text.insert(x+1,m),y.forEach((S,w)=>a.push(k+w,S.root.client,S.root.clock,1)),c.push(...y)}pt(i,a);let h=new Map;for(let p of c){let y=h.get(p.text);y?y.add(u(p)):h.set(p.text,new Set([u(p)]))}for(let[p,y]of h)_e(p,y);return!0}function vn(t,e){let n=t.doc,o=[],s=new Set,i=new Set,r=new Map,u=0;return pe(n,e,l=>{if(!l.countable||!(l.parent instanceof re.Text)||l.redone===null)return;let f=l.parent,d=l.redone;if(d.client!==n.clientID||ze(t,f)===null)return;let c=ye(n,d);if(!(!c||c.parent!==f)){i.add(f);for(let g=0;g<l.length;g+=1){if((u+=1)>Le)return;let a=re.createID(l.id.client,l.id.clock+g);for(let m=0;m<ii;m+=1){let k=He(n,a);if(!k)break;a=k}let h=ue(n,a,r,!1);s.add(H(h.client,h.clock));let p=d.clock+g,y=o.length;y>0&&o[y-4]+o[y-1]===p&&o[y-3]===a.client&&o[y-2]+o[y-1]===a.clock?o[y-1]+=1:o.push(p,a.client,a.clock,1)}}}),pt(n,o),{roots:s,texts:i}}function Pn(t,e){let n=t.doc,o=n.getMap(Ie),s=new Set;for(let i of e){let r=i===null?null:/^(\d{1,16}):(\d{1,16})$/.exec(i),u=i===null?void 0:o.get(i);if(!r||!Array.isArray(u))continue;let l=Math.min(Number(u[2])||0,Le),f=Number(r[1]);for(let d=Number(r[2]),c=d+l;d<c;){let g=ye(n,re.createID(f,d));if(!g)break;if(!g.deleted&&g.parent instanceof re.Text&&ze(t,g.parent)){s.add(g.parent);break}d=g.id.clock+g.length}}return s}function On(t,e){let n=new Set,o=0;for(let s of t.doc.getMap(Ie).keys()){if((o+=1)>Le)break;for(let i of Pn(t,[s])){let r=ze(t,i);r!==null&&e.has(r)&&n.add(i)}}return n}function li(t,e){let n=be(e.parent);return n&&n.parent===t.nodes&&typeof n.parentSub=="string"?n.parentSub:null}var di=(t,e)=>t.client<e.client||t.client===e.client&&t.clock>e.clock;function Nn(t,e,n){let o=t.doc,s=new Map,i=[...e],r=new Set;for(let p of i){let y=ze(t,p);y!==null&&r.add(y)}if(r.size===0)return!1;let u=new Set(On(t,r));for(let p of i)u.add(p);let l=new Map,f=new Map,d=(p,y)=>{let x=f.get(p);x?x.add(H(y.client,y.clock)):f.set(p,new Set([H(y.client,y.clock)]))},c=0;for(let p of u){let y=ze(t,p),x=li(t,p);if(y===null||x===null)continue;let m=n(y,x)?"":`${x}\0`;for(let k=p._start;k!==null&&c<Le;k=k.right)if(!(k.deleted||!k.countable))for(let S=0;S<k.length;S+=1,c+=1){let w=re.createID(k.id.client,k.id.clock+S);if(!He(o,w))continue;let A=ue(o,w,s),R=m+H(A.client,A.clock),P=l.get(R);P?di(w,P.id)?(d(P.text,P.id),l.set(R,{id:w,text:p})):d(p,w):l.set(R,{id:w,text:p})}}for(let[p,y]of f)_e(p,y);let g=[];for(let{id:p,text:y}of l.values()){let x=ye(o,p);if(!x||x.deleted||x.parent!==y)continue;let m=p.clock-x.id.clock;g.push({text:y,item:x,j:m,root:ue(o,p,s),char:Es(x,m)})}let a=o.clientID;return vs(t,g,n,s,p=>p.item.id.client===a)||f.size>0}import*as ie from"yjs";function Ps(t,e,n){let o=s=>{let i=t.nodes.get(s),r=i instanceof ie.Map?i.get(N.children):void 0;return r instanceof ie.Array?r.toArray():[]};for(let s of o(e))if(!(typeof s!="string"||t.nodes.get(s)?.get?.(N.shell)?.local!=="t"))for(let r of o(s)){let u=typeof r=="string"?t.nodes.get(r):void 0,l=u instanceof ie.Map?u.get(N.text):void 0;l instanceof ie.Text&&n.add(l)}}var Ve=(t,e)=>be(e)?.parent===t.nodes&&e instanceof ie.Map?e:null;function Os(t,e){let n=t.doc.clientID.toString(36),o=Be(t),s=new Set,i=new Map,r=l=>{if(typeof l!="string")return new Set;let f=i.get(l);if(!f){let d=$e(t.parts.get(l));f=d?.kind==="xml"?lt(t,l,d.root).unseenWinners:new Set,i.set(l,f)}return f};if(pe(t.doc,e.insertions,l=>{if(l.parent!==t.nodes||l.deleted||!(l.content instanceof ie.ContentType))return;let f=l.content.type,d=Te(f),c=d?o(d.group):void 0;!d||c===void 0||c===n||r(f.get(N.part)).has(d.group)||s.add(d.from)}),s.size===0)return e.deletions;let u=new Set;for(let l of s)Ps(t,l,u);return u.size===0?e.deletions:Dt(t.doc,e.deletions,l=>u.has(l.parent))}function Ns(t,e){let n=new Map;if(pe(t.doc,e.insertions,c=>{let g=c.parent;!(g instanceof ie.Text)||!c.countable||Ve(t,g.parent)&&n.set(g,(n.get(g)??!1)||c.deleted)}),![...n.values()].some(Boolean))return e;let o=new Map,s=new Set;if(pe(t.doc,e.deletions,c=>{let g=Ve(t,c.parent);if(!g||c.parentSub!==z.splitFrom||!(c.content instanceof ie.ContentAny))return;let a=c.content.getContent()[0];if(typeof a!="string")return;let h=new Set;Ps(t,a,h);let p=[...h].filter(x=>n.get(x)===!0);if(p.length===0)return;for(let x of p)s.add(x);let y=g.get(N.key);typeof y=="string"&&o.set(g,y)}),o.size===0)return e;let i=new Map;pe(t.doc,e.deletions,c=>{let g=c.parent,h=(g instanceof ie.Array?Ve(t,g.parent):null)?.get(N.key);if(typeof h!="string"||!(c.content instanceof ie.ContentAny))return;let p=i.get(h);p||i.set(h,p=[]);for(let y of c.content.getContent())typeof y=="string"&&p.push(y)});let r=new Set(o.values()),u=new Set,l=[...r];for(;l.length>0;){let c=l.pop(),g=t.nodes.get(c);if(!(u.has(g)||!(g instanceof ie.Map))){u.add(g);for(let a of i.get(c)??[])l.push(a)}}let f=c=>Ve(t,c.parent)??Ve(t,c.parent?.parent),d=c=>c.parent instanceof ie.Array&&Ve(t,c.parent.parent)!==null&&c.content instanceof ie.ContentAny&&c.content.getContent().some(g=>typeof g=="string"&&r.has(g));return{insertions:Dt(t.doc,e.insertions,c=>s.has(c.parent)),deletions:Dt(t.doc,e.deletions,c=>u.has(f(c))||d(c))}}import*as Ds from"yjs";import{CONTENT_TYPES_PART as $t,asciiFold as je,NS as ae,attr as we,children as Gt,materialize as fi,relationshipsOf as gt,relsPartName as Wt,specOf as ui}from"@pptx-editor.dev/core/store";var Tn=Symbol("absent");function Ls(t,e,n){let o=pi(n);for(let s of t){let i=s.target;if(!(i instanceof Ds.Map)||!e(i))continue;let r=o.get(i);r||o.set(i,r=new Map);for(let[u,l]of s.changes.keys){let f=i.get(u),d=r.get(u);if(d)d[3]=f;else{let c=[i,u,l.action==="add"?Tn:l.oldValue,f];n.push(c),r.set(u,c)}}}}var As=new WeakMap;function pi(t){let e=As.get(t);if(e)return e;e=new Map;for(let n of t){let o=e.get(n[0]);o||e.set(n[0],o=new Map),o.has(n[1])||o.set(n[1],n)}return As.set(t,e),e}var _s=t=>t._item?.deleted!==!0;function Fs(t){return t.filter(([e,n,o])=>o!==Tn&&_s(e)&&!e.has(n)).map(([e,n,o])=>[e,n,o])}function Cn(t){let e=(n,o)=>JSON.stringify(n)===JSON.stringify(o);return t.filter(([n,o,s,i])=>_s(n)&&i!==void 0&&s!==Tn&&e(n.get(o),s)&&!e(s,i)).map(([n,o,,s])=>[n,o,s])}function gi(t){let e=new Set,n=[t];for(;n.length>0;){let o=n.pop();if(!(o.type!=="element"||zs(o))){for(let s of o.attrs)s.ns===ae.r&&e.add(s.value);for(let s of o.children)n.push(s)}}return e}function Ts(t,e){let n={next:t.nextId},o=e.map(s=>fi(ui(s),t.root.kind,n));return{partName:t.partName,root:{...t.root,children:[...t.root.children,...o]},nextId:n.next}}var zs=t=>t.ns===ae.p&&t.local==="sldId";function hi(t,e){for(let n of t.parts.values()){if(n.kind!=="xml")continue;let o=n.xml.root;if(o.ns!==ae.p||o.local!=="presentation")continue;let s=o.children.find(m=>m.type==="element"&&m.ns===ae.p&&m.local==="sldIdLst");if(!s)return;let i=[],r=new Set;for(let m of s.children){if(m.type!=="element"||!zs(m))continue;let k=m.attrs.find(S=>S.ns===ae.r&&S.local==="id")?.value;k===void 0||!e.has(k)?r.add(m):i.push(we(m,"id")??"")}let u=[],l=m=>{for(let k of m.children)k.type==="element"&&(k.ns===ae.p14&&k.local==="section"?u.push(k):l(k))};l(o);let f=new Map(u.map((m,k)=>[m,k])),d=new Map;u.forEach((m,k)=>{let S=m.children.find(w=>w.type==="element"&&w.ns===ae.p14&&w.local==="sldIdLst");if(S)for(let w of Gt(S,{ns:ae.p14,local:"sldId"})){let A=we(w,"id")??"",R=d.get(A);R?R[R.length-1]!==k&&R.push(k):d.set(A,[k])}});let c=new Map,g=0;for(let m of i){let k=d.get(m);if(!k)continue;let S=k.find(w=>w>=g)??k[0];c.set(m,S),g=Math.max(g,S)}let a=new Map(i.map((m,k)=>[m,k])),h=r.size>0,p=(m,k)=>{let S=m.children.map(w=>{if(w.type!=="element"||w.ns!==ae.p14||w.local!=="sldIdLst")return w;let A=new Set,P=[...w.children.filter(b=>{if(b.type!=="element"||b.ns!==ae.p14||b.local!=="sldId")return!0;let I=we(b,"id")??"";return c.get(I)!==k||A.has(I)?!1:(A.add(I),!0)})].sort((b,I)=>{let C=b.type==="element"?a.get(we(b,"id")??"")??0:0,j=I.type==="element"?a.get(we(I,"id")??"")??0:0;return C-j});return P.length===w.children.length&&P.every((b,I)=>b===w.children[I])?w:(h=!0,{...w,children:P})});return S.every((w,A)=>w===m.children[A])?m:{...m,children:S}},y=m=>{let k=m.children.filter(w=>w.type!=="element"||!r.has(w)).map(w=>{if(w.type!=="element")return w;let A=f.get(w)??-1;return A>=0?p(w,A):y(w)});return k.length===m.children.length&&k.every((w,A)=>w===m.children[A])?m:{...m,children:k}},x=y(o);return h?{...n.xml,root:x}:void 0}}var mi=new Set(["hlinkClick","hlinkHover","hlinkMouseOver"]),An=t=>t.endsWith("/relationships/slide");function Cs(t,e){let n=!1,o=i=>{let r=!1,u=[];for(let l of i.children){if(l.type!=="element"){u.push(l);continue}let f=l.attrs.some(c=>c.ns===ae.r&&c.value===e);if(f&&l.ns===ae.a&&mi.has(l.local)){r=!0;continue}f&&(n=!0);let d=o(l);d!==l&&(r=!0),u.push(d)}return r?{...i,children:u}:i},s=o(t);return n?void 0:s}function yi(t,e){return{...t,root:{...t.root,children:t.root.children.filter(n=>n.type!=="element"||n.local!=="Relationship"||we(n,"Id")!==e)}}}var qe=(t,e)=>{let n=t.parts.get(e);return n?.kind==="xml"?n.xml:void 0};function Dn(t,e){let n=new Map,o=new Set;for(let c of e.parts.keys())o.add(je(c));let s=c=>e.parts.has(c)||o.has(je(c)),i=[],r=new Set,u=c=>{!c||r.has(c.partName)||(r.add(c.partName),i.push(c))},l=!1;for(let c of t.parts.keys())e.parts.has(c)||(l=!0);for(let[c,g]of e.parts){if(g.kind!=="xml")continue;let a=Wt(c);if(!l&&t.parts.get(c)===g&&t.parts.get(a)===e.parts.get(a))continue;let h=w=>{let A=Cs((n.get(c)??g.xml).root,w);if(!A)return!1;n.set(c,{...n.get(c)??g.xml,root:A});let R=n.get(a)??qe(e,a);return R&&n.set(a,yi(R,w)),!0};for(let w of gt(e,c))!w.external&&w.target&&!s(w.target)&&An(w.type)&&h(w.id);let p=gi((n.get(c)??g.xml).root);if(p.size===0)continue;for(let w of gt(e,c))!p.has(w.id)||w.external||!w.target||s(w.target)||An(w.type)||u(t.parts.get(w.target));let y=new Set(gt(e,c).map(w=>w.id)),x=qe(t,a);if(!x)continue;let m=Gt(x.root,{ns:ae.rel,local:"Relationship"}).filter(w=>{let A=we(w,"Id");return A!==void 0&&p.has(A)&&!y.has(A)});for(let w of gt(t,c)){let A=m.findIndex(P=>we(P,"Id")===w.id);if(A<0||w.external||!w.target||s(w.target)||!An(w.type))continue;let R=Cs((n.get(c)??g.xml).root,w.id);R&&(n.set(c,{...n.get(c)??g.xml,root:R}),m.splice(A,1))}if(m.length===0)continue;let k=n.get(a)??qe(e,a)??{partName:a,root:{...x.root,children:[]},nextId:x.nextId};n.set(a,Ts(k,m));let S=new Set(m.map(w=>we(w,"Id")));for(let w of gt(t,c))!S.has(w.id)||w.external||!w.target||s(w.target)||u(t.parts.get(w.target))}{let c=[...e.parts.values()].find(p=>p.kind==="xml"&&p.xml.root.ns===ae.p&&p.xml.root.local==="presentation"),g=c&&(n.get(Wt(c.partName))??qe(e,Wt(c.partName))),a=c&&Wt(c.partName),h=c&&(t.parts.get(c.partName)!==c||t.parts.get(a)!==e.parts.get(a)||n.has(a));if(g&&h&&a&&e.parts.has(a)){let p=new Set(Gt(g.root,{ns:ae.rel,local:"Relationship"}).map(x=>we(x,"Id")??"")),y=hi(e,p);y&&n.set(y.partName,y)}}let f=qe(e,$t),d=qe(t,$t);if(f&&d){let c=(m,k,S)=>{let w=new Map;for(let A of Gt(m,{ns:ae.ct,local:k})){let R=we(A,S);R!==void 0&&!w.has(je(R))&&w.set(je(R),A)}return w},g=c(f.root,"Override","PartName"),a=c(f.root,"Default","Extension"),h=c(d.root,"Override","PartName"),p=c(d.root,"Default","Extension"),y=new Set,x=new Set(e.parts.keys());for(let m of i)x.add(m.partName);for(let m of x){if(m===$t)continue;let k=je(m.slice(m.lastIndexOf(".")+1));if(g.has(je(m))||a.has(k))continue;let S=h.get(je(m))??p.get(k);S&&y.add(S)}y.size>0&&n.set($t,Ts(f,[...y]))}return[...[...n.values()].map(c=>({kind:"xml",partName:c.partName,xml:c})),...i]}var js=0;function Ln(t,...e){for(let n of[...t])try{n(...e)}catch(o){console.warn("[pptx-editor] collaboration listener failed",o)}}function wi(t){let{doc:e,documentId:n,identity:o,awareness:s}=t;if(typeof n!="string"||n.trim()===""||n.length>256)throw new Ke("invalid-document-id");let i=ps(o);if(i)throw new Ke(i);let r=$n(e),u=ki("initializing"),l=new Set,f=new Set,d=new Set,c=null,g=null,a={value:0},h=null,p=null,y=null,x=!1,m=!0,k=[{...o,isLocal:!0}],S=[],w=null,A=null,R=null,P=!1;js+=1;let b=`${e.clientID.toString(36)}-${js}`,I=(T,F,M,L=!1)=>{if(!u.set(T,F,M,L))return;let v=u.snapshot().reason;Ln(l,T,v?.code,v?.detail)},C=()=>m?I("ready"):I("disconnected","transport-disconnected"),j=T=>{s&&!x&&s.setLocalStateField(zt,ys(o,T))},_=()=>{if(!s)return;let T=ks(s);JSON.stringify(T)!==JSON.stringify(k)&&(k=T,Ln(f,k));let F=g?ws(s,e,g):[];JSON.stringify(F)!==JSON.stringify(S)&&(S=F,Ln(d,S))};j(void 0),s?.on("change",_),_();let E=(T,F,M,L=!0)=>{let v=F?T.redoStack:T.undoStack,$=v.length;F?T.undoing=!0:T.redoing=!0;try{e.transact(M,Jt)}finally{T.undoing=!1,T.redoing=!1}if(v.length!==$+1)return!1;let G=v[v.length-2];if(!L||!G)return!0;let oe=v.pop();return G.deletions=me.mergeDeleteSets([G.deletions,oe.deletions]),G.insertions=me.mergeDeleteSets([G.insertions,oe.insertions]),!0},O=(T,F,M)=>F.length>0&&E(T,!1,()=>{for(let[L,v,$]of F)L.set(v,$)},M),D=(T,F)=>{let M=F?T?.undoStack:T?.redoStack;if(!T||!M||M.length===0)return!1;P=!1;let L=p?.package(),v=M[M.length-1];if(F)qo(r,v,X=>e.transact(X,Ze)),v.deletions=Os(r,v);else{let X=Ns(r,v);v.insertions=X.insertions,v.deletions=X.deletions}let $=[...M];y=null,F?T.undo():T.redo(),!F&&y===v&&Qo(r,v,X=>e.transact(X,Ze));let G=y,oe=new Set(M),Xt=$.reverse().filter(X=>!oe.has(X)&&X!==G),Je=X=>X.meta.get("attrs")??[],Qe=!1,Me=!1,Re=null;if(F&&G&&G!==v)y=null,T.redo(),Re=y,Me=!0;else if(!F&&G===v)Qe=O(T,Cn(Je(v)),!0);else if(!F){G&&(y=null,T.undo(),Re=y);for(let X of Xt.slice(1).reverse())T.redoStack.push(X);Qe=O(T,Cn(Je(v)),!1)}if(Re){let X=Re;e.transact(()=>vn(r,X.deletions),Ze)}let W=G&&!Me&&(F||G===v)?G:null;if(W&&g){let X=g,te=W,Q=(ce,Pe)=>X.idOf(ce,Pe)!==void 0,de=new Set;E(T,F,()=>{let ce=vn(r,te.deletions);de=ce.roots,F&&Zo(r,te,Q),Is(r,te.deletions,Q),Nn(r,ce.texts,Q)}),X.forgetDeleted(de)}let V=p?.package(),se=F&&G&&!Me?Fs(Je(G)):[],Z=L&&V&&!Me?Dn(L,V):[];if((se.length>0||Z.length>0)&&V&&g){let X=g;e.transact(()=>{for(let[Q,de,ce]of se)Q.set(de,ce);if(Z.length===0)return;let te=new Map(V.parts);for(let Q of Z)te.set(Q.partName,Q);X.writeChange(V,{parts:te},Z.map(Q=>Q.partName))},qt)}return!P&&(F?G!==null&&!Me:G===v||Qe)};return{documentId:n,sessionId:b,identity:o,get attached(){return c!==null},status:()=>u.status(),statusSnapshot:()=>u.snapshot(),subscribeStatus(T){return l.add(T),()=>l.delete(T)},setConnected(T){if(x||T===m)return;m=T;let F=u.snapshot();(F.status==="ready"||F.status==="disconnected")&&C()},participants:()=>k,subscribeParticipants(T){return f.add(T),()=>f.delete(T)},remoteSelections:()=>S,subscribeRemoteSelections(T){return d.add(T),()=>d.delete(T)},setLocalSelection(T){let F=T&&g?ms(T,g):void 0;w=T&&F?{selection:T,encoded:F}:null,j(F)},remoteSelectionMove:()=>A,historySelection:()=>R&&g?jt(R,e,g):null,canUndo:()=>h?h.undoStack.length>0:!1,canRedo:()=>h?h.redoStack.length>0:!1,undo:()=>D(h,!0),redo:()=>D(h,!1),attach(T){if(x)return()=>{};c?.(),I("initializing");let F=r.meta.get("schema");if(F!==void 0&&F!==Vt)return I("error","schema-version-mismatch",`room schema ${String(F)}`),()=>{};let M=new Ft(r,a);p=T,g=M;let L=(W,V,se=!1)=>{let Z=T.package(),X=M.rebuild(W,Z,V);if(!X.ok)return P=!0,I("error","remote-apply-failed",X.reason,!0);let te=w?jt(w.encoded,e,M):null;if(A=w&&te&&JSON.stringify(te)!==JSON.stringify(w.selection)?{from:w.selection,to:te}:null,A&&w&&(w={selection:A.to,encoded:w.encoded}),X.parts.length>0||X.removed.length>0){let de=T.applyRemoteParts(X.parts,X.removed,"collaboration");if(A=null,!de.ok){P=!0;let ce=de.rejection.code;return ce==="unsafe-part-name"?I("error","unsafe-part-name",ce):I("error","remote-apply-failed",ce,!0)}}A=null,se&&Xt(Z,T.package());let Q=u.snapshot();Q.status==="error"&&Q.recovering&&C(),_()};M.seeded?L(M.allParts(T.package()),!0):e.transact(()=>{r.meta.set("schema",Vt),r.meta.set("documentId",n),M.seed(T.package())},en);let v=new me.UndoManager([r.parts,r.binaries,r.nodes],{trackedOrigins:new Set([kt,Jt]),captureTimeout:Number.POSITIVE_INFINITY,deleteFilter:Ys(r.nodes)}),$=W=>{let V=W.parent;return V instanceof me.Map&&V.get(N.attrs)===W},G=W=>{let V=v.currStackItem;if((v.undoing||v.redoing)&&V){W.stackItem.meta.set("attrs",V.meta.get("attrs")??[]);return}let se=W.stackItem.meta.get("attrs")??[],Z=new Set;for(let X of W.changedParentTypes?.values()??[])for(let te of X)Z.add(te);Ls(Z,$,se),W.stackItem.meta.set("attrs",se)};v.on("stack-item-added",W=>{w&&W.stackItem.meta.set("selection",w.encoded),G(W)}),v.on("stack-item-updated",G),v.on("stack-item-popped",W=>{R=W.stackItem.meta.get("selection")??null,y=W.stackItem}),h=v;let oe=T.subscribeLocal(W=>{W.merged||v.stopCapturing(),M.hasHiddenListings(W.parts)&&e.transact(()=>M.dropHiddenListings(W.parts,W.before,W.after),Zt),e.transact(()=>M.writeChange(W.before,W.after,W.parts),kt);let V=M.showingUnlisted(W.parts);V.length>0&&L(V,!1),_()}),Xt=(W,V)=>{let se=Dn(W,V);if(se.length===0)return;let Z=new Map(V.parts);for(let X of se)Z.set(X.partName,X);e.transact(()=>M.writeChange(V,{parts:Z},se.map(X=>X.partName)),qt)},Je=(W,V)=>{let se=M.deletedText,Z=se.size>0?_o(r,W):new Set;if(V.size===0&&Z.size===0)return;let X={keyOf:M.keyOf.bind(M),package:T.package()},te=[];e.transact(()=>{for(let[Q,de]of V)bs(r,Q,de,se,X,(ce,Pe,ht)=>te.push([ce,Pe,ht]));Ms(r,Z,se)},Qt);for(let[Q,de,ce]of te)for(let Pe of[...v.undoStack,...v.redoStack]){if(!me.isDeleted(Pe.insertions,Q))continue;let ht=me.createDeleteSet();ht.clients.set(de.client,[{clock:de.clock,len:ce}]),Pe.insertions=me.mergeDeleteSets([Pe.insertions,ht])}},Qe=e.getMap(Ie),Me=W=>{let V=W.origin;if(V===kt||V===en||V===Ze||V===Zt)return;let se=M.touchedParts(W);if(se.size>0&&L(se,!1,!W.local),W.local)return;let Z=M.newCopies(W);Je(W,Z);let X=W.changed.get(Qe),te=X?Pn(r,X):new Set;if(Z.size>0&&r.doc.getMap(Ie).size>0)for(let Q of On(r,new Set(Z.keys())))te.add(Q);if(te.size>0){let Q=(de,ce)=>M.idOf(de,ce)!==void 0;e.transact(()=>Nn(r,te,Q),Qt)}};e.on("afterTransaction",Me),u.status()==="initializing"&&C(),_();let Re=()=>{oe(),e.off("afterTransaction",Me),v.destroy(),h===v&&(h=null),g===M&&(g=null),p===T&&(p=null),w=null,R=null,j(void 0),_(),c===Re&&(c=null)};return c=Re,Re},destroy(){x||(c?.(),s?.off("change",_),s?.setLocalStateField(zt,null),x=!0,I("destroyed","collaboration-session-destroyed"),l.clear(),f.clear(),d.clear())}}}export{Ke as CollaborationSchemaError,Js as collaborationModule,wi as createYjsCollaborationSession,Ht as legacyComments,qs as reviewModule};
@@ -0,0 +1,15 @@
1
+ /*!
2
+ Copyright (c) 2026 Eigenpal, Inc. All rights reserved.
3
+ Licensed under the EigenPal Pro Evaluation License 1.0. See LICENSE.md in this package.
4
+ Production use requires a commercial agreement: licensing@eigenpal.com
5
+ */
6
+ /** Accepted by every pro entry point. @public */
7
+ interface ProLicenseOptions {
8
+ /**
9
+ * Your license key. Optional: evaluation use is permitted, production use requires a
10
+ * commercial agreement under the EigenPal Pro License (see LICENSE.md).
11
+ */
12
+ readonly licenseKey?: string;
13
+ }
14
+
15
+ export type { ProLicenseOptions as P };
package/package.json CHANGED
@@ -1,21 +1,49 @@
1
1
  {
2
2
  "name": "@pptx-editor.dev/pro",
3
- "version": "0.0.1-placeholder",
4
- "description": "Commercial capabilities for PPTX Editor, as EditorModules: the review module (comments and suggestions) and realtime collaboration.",
3
+ "version": "0.2.0",
4
+ "description": "Commercial capabilities for PPTX Editor, as EditorModules: the review module (comments and suggestions), realtime collaboration, and advanced drawing rendering (charts, glow, inner shadow, reflection, and soft edge).",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./drawing": {
13
+ "types": "./dist/drawing.d.ts",
14
+ "import": "./dist/drawing.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE.md",
22
+ "THIRD_PARTY_NOTICES.md",
23
+ "!dist/metafile-*.json"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "typecheck": "bun check",
28
+ "api:extract": "node ../../scripts/api-extractor.mjs --package @pptx-editor.dev/pro --local",
29
+ "api:check": "node ../../scripts/api-extractor.mjs --package @pptx-editor.dev/pro"
30
+ },
31
+ "peerDependencies": {
32
+ "@pptx-editor.dev/core": "~0.2.0"
33
+ },
34
+ "devDependencies": {
35
+ "@pptx-editor.dev/core": "workspace:*"
36
+ },
5
37
  "license": "LicenseRef-EigenPal-Pro-Evaluation-1.0",
6
- "main": "index.js",
38
+ "dependencies": {
39
+ "y-protocols": "^1.0.7",
40
+ "yjs": "^13.6.32"
41
+ },
7
42
  "repository": {
8
43
  "type": "git",
9
44
  "url": "https://github.com/eigenpal/pptx-editor.git",
10
45
  "directory": "packages/pro"
11
46
  },
12
- "homepage": "https://pptx-editor.dev/",
13
- "keywords": [
14
- "pptx",
15
- "presentation",
16
- "editor",
17
- "ooxml"
18
- ],
19
47
  "publishConfig": {
20
48
  "access": "public"
21
49
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = {};