@arcsin1/html2pptx 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,184 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work (an example is provided in the Appendix
36
+ below).
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
39
+ is based on (or derived from) the Work and for which the editorial revisions,
40
+ annotations, elaborations, or other modifications represent, as a whole, an
41
+ original work of authorship. For the purposes of this License, Derivative Works
42
+ shall not include works that remain separable from, or merely link (or bind by
43
+ name) to the interfaces of, the Work and Derivative Works thereof.
44
+
45
+ "Contribution" shall mean any work of authorship, including the original version
46
+ of the Work and any modifications or additions to that Work or Derivative Works
47
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
48
+ by the copyright owner or by an individual or Legal Entity authorized to submit
49
+ on behalf of the copyright owner. For the purposes of this definition,
50
+ "submitted" means any form of electronic, verbal, or written communication sent
51
+ to the Licensor or its representatives, including but not limited to
52
+ communication on electronic mailing lists, source code control systems, and
53
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
54
+ the purpose of discussing and improving the Work, but excluding communication
55
+ that is conspicuously marked or otherwise designated in writing by the copyright
56
+ owner as "Not a Contribution."
57
+
58
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
59
+ of whom a Contribution has been received by Licensor and subsequently
60
+ incorporated within the Work.
61
+
62
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
63
+ License, each Contributor hereby grants to You a perpetual, worldwide,
64
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
65
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
66
+ sublicense, and distribute the Work and such Derivative Works in Source or
67
+ Object form.
68
+
69
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
70
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
71
+ no-charge, royalty-free, irrevocable (except as stated in this section) patent
72
+ license to make, have made, use, offer to sell, sell, import, and otherwise
73
+ transfer the Work, where such license applies only to those patent claims
74
+ licensable by such Contributor that are necessarily infringed by their
75
+ Contribution(s) alone or by combination of their Contribution(s) with the Work
76
+ to which such Contribution(s) was submitted. If You institute patent litigation
77
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
78
+ alleging that the Work or a Contribution incorporated within the Work
79
+ constitutes direct or contributory patent infringement, then any patent licenses
80
+ granted to You under this License for that Work shall terminate as of the date
81
+ such litigation is filed.
82
+
83
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
84
+ Derivative Works thereof in any medium, with or without modifications, and in
85
+ Source or Object form, provided that You meet the following conditions:
86
+
87
+ (a) You must give any other recipients of the Work or Derivative Works a
88
+ copy of this License; and
89
+
90
+ (b) You must cause any modified files to carry prominent notices stating that
91
+ You changed the files; and
92
+
93
+ (c) You must retain, in the Source form of any Derivative Works that You
94
+ distribute, all copyright, patent, trademark, and attribution notices
95
+ from the Source form of the Work, excluding those notices that do not
96
+ pertain to any part of the Derivative Works; and
97
+
98
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
99
+ then any Derivative Works that You distribute must include a readable
100
+ copy of the attribution notices contained within such NOTICE file,
101
+ excluding those notices that do not pertain to any part of the
102
+ Derivative Works, in at least one of the following places: within a NOTICE
103
+ text file distributed as part of the Derivative Works; within the Source
104
+ form or documentation, if provided along with the Derivative Works; or,
105
+ within a display generated by the Derivative Works, if and wherever such
106
+ third-party notices normally appear. The contents of the NOTICE file are
107
+ for informational purposes only and do not modify the License. You may
108
+ add Your own attribution notices within Derivative Works that You
109
+ distribute, alongside or as an addendum to the NOTICE text from the Work,
110
+ provided that such additional attribution notices cannot be construed as
111
+ modifying the License.
112
+
113
+ You may add Your own copyright statement to Your modifications and may
114
+ provide additional or different license terms and conditions for use,
115
+ reproduction, or distribution of Your modifications, or for any such
116
+ Derivative Works as a whole, provided Your use, reproduction, and distribution
117
+ of the Work otherwise complies with the conditions stated in this License.
118
+
119
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
120
+ Contribution intentionally submitted for inclusion in the Work by You to the
121
+ Licensor shall be under the terms and conditions of this License, without any
122
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
123
+ supersede or modify the terms of any separate license agreement you may have
124
+ executed with Licensor regarding such Contributions.
125
+
126
+ 6. Trademarks. This License does not grant permission to use the trade names,
127
+ trademarks, service marks, or product names of the Licensor, except as required
128
+ for reasonable and customary use in describing the origin of the Work and
129
+ reproducing the content of the NOTICE file.
130
+
131
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
132
+ writing, Licensor provides the Work (and each Contributor provides its
133
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
134
+ KIND, either express or implied, including, without limitation, any warranties or
135
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
136
+ PARTICULAR PURPOSE. You are solely responsible for determining the
137
+ appropriateness of using or redistributing the Work and assume any risks
138
+ associated with Your exercise of permissions under this License.
139
+
140
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
141
+ tort (including negligence), contract, or otherwise, unless required by
142
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
143
+ writing, shall any Contributor be liable to You for damages, including any
144
+ direct, indirect, special, incidental, or consequential damages of any character
145
+ arising as a result of this License or out of the use or inability to use the
146
+ Work (including but not limited to damages for loss of goodwill, work stoppage,
147
+ computer failure or malfunction, or any and all other commercial damages or
148
+ losses), even if such Contributor has been advised of the possibility of such
149
+ damages.
150
+
151
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
152
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
153
+ acceptance of support, warranty, indemnity, or other liability obligations
154
+ and/or rights consistent with this License. However, in accepting such
155
+ obligations, You may act only on Your own behalf and on Your sole
156
+ responsibility, not on behalf of any other Contributor, and only if You agree to
157
+ indemnify, defend, and hold each Contributor harmless for any liability incurred
158
+ by, or claims asserted against, such Contributor by reason of your accepting any
159
+ such warranty or additional liability.
160
+
161
+ END OF TERMS AND CONDITIONS
162
+
163
+ APPENDIX: How to apply the Apache License to your work.
164
+
165
+ To apply the Apache License to your work, attach the following boilerplate
166
+ notice, with the fields enclosed by brackets "[]" replaced with your own
167
+ identifying information. (Don't include the brackets!) The text should be
168
+ enclosed in the appropriate comment syntax for the file format. We also
169
+ recommend that a file or class name and description of purpose be included on
170
+ the same "printed page" as the copyright notice for easier identification within
171
+ third-party archives.
172
+
173
+ Copyright [yyyy] [name of copyright owner]
174
+
175
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
176
+ this file except in compliance with the License. You may obtain a copy of the
177
+ License at
178
+
179
+ http://www.apache.org/licenses/LICENSE-2.0
180
+
181
+ Unless required by applicable law or agreed to in writing, software distributed
182
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
183
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
184
+ specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @arcsin1/html2pptx
2
+
3
+ Convert an HTML slide page into an editable PPTX document. It provides HTML
4
+ extraction scripts, normalization, and OOXML writing without
5
+ depending on Electron.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @arcsin1/html2pptx
11
+ ```
12
+
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import {
18
+ buildHtmlToPptxExtractScript,
19
+ generatePptx,
20
+ normalizeExtractedHtmlToPptxSlide,
21
+ } from '@arcsin1/html2pptx'
22
+
23
+ const rawSlide = await browserRuntime.evaluate(
24
+ buildHtmlToPptxExtractScript({ pageWidthPx: 1600, pageHeightPx: 900 })
25
+ )
26
+ const slide = normalizeExtractedHtmlToPptxSlide(rawSlide, 'Overview')
27
+
28
+ const pptx = generatePptx({
29
+ title: 'Deck',
30
+ slides: [slide]
31
+ })
32
+ ```
33
+
34
+ `pptx` is a `Uint8Array` containing a standards-compliant `.pptx` Open Packaging
35
+ Convention ZIP. Save it in a browser, Worker, server, or Electron application.
36
+ For Node.js file output, import `writeHtmlToPptx` from `@arcsin1/html2pptx/node`.
37
+
38
+ ## License
39
+
40
+ Apache-2.0
@@ -0,0 +1 @@
1
+ const e={fade:{presetId:10,presetClass:"entr",fade:!0},"fade-up":{presetId:2,presetClass:"entr",presetSubtype:8,motion:"fromBottom",fade:!0},"fade-down":{presetId:2,presetClass:"entr",presetSubtype:1,motion:"fromTop",fade:!0},"fade-left":{presetId:2,presetClass:"entr",presetSubtype:3,motion:"fromRight",fade:!0},"fade-right":{presetId:2,presetClass:"entr",presetSubtype:2,motion:"fromLeft",fade:!0},"scale-in":{presetId:31,presetClass:"entr",scale:!0,fade:!0},"slide-up":{presetId:2,presetClass:"entr",presetSubtype:8,motion:"fromBottom",fade:!0},"slide-down":{presetId:2,presetClass:"entr",presetSubtype:1,motion:"fromTop",fade:!0},"slide-left":{presetId:2,presetClass:"entr",presetSubtype:3,motion:"fromRight",fade:!0},"slide-right":{presetId:2,presetClass:"entr",presetSubtype:2,motion:"fromLeft",fade:!0},"fly-in":{presetId:2,presetClass:"entr",motion:"fromTrace",fade:!0},wipe:{presetId:5,presetClass:"entr",effectFilter:"wipe"},"zoom-in":{presetId:31,presetClass:"entr",scale:!0,scaleFrom:75e3,scaleTo:1e5,fade:!0},"spin-in":{presetId:31,presetClass:"entr",scale:!0,scaleFrom:92e3,scaleTo:1e5,rotateFrom:-72e4,rotateTo:0,fade:!0},"grow-shrink-soft":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:95e3,scaleTo:104e3},"grow-shrink":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:9e4,scaleTo:108e3},"grow-shrink-strong":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:85e3,scaleTo:112e3},"pulse-soft":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:1e5,scaleTo:103e3},pulse:{presetId:6,presetClass:"emph",scale:!0,scaleFrom:1e5,scaleTo:106e3},"pulse-strong":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:1e5,scaleTo:11e4},"exit-fade":{presetId:10,presetClass:"exit",fade:!0,transition:"out"},"exit-scale":{presetId:31,presetClass:"exit",scale:!0,scaleFrom:1e5,scaleTo:85e3,fade:!0,transition:"out"},"exit-zoom":{presetId:31,presetClass:"exit",scale:!0,scaleFrom:1e5,scaleTo:75e3,fade:!0,transition:"out"},"exit-wipe":{presetId:5,presetClass:"exit",effectFilter:"wipe",transition:"out"},"exit-fly":{presetId:2,presetClass:"exit",motion:"fromTrace",fade:!0,transition:"out"},path:{presetId:10,presetClass:"entr"}},t=t=>e[t],n=(e,t)=>{const n=Number.isFinite(e)?e:t;return Math.round(Math.max(100,Math.min(5e3,n)))},p=' accel="20000" decel="60000"',s=e=>`<p:tgtEl><p:spTgt spid="${e}"/></p:tgtEl>`,r=e=>{const n=t(e.type);return n?"exit"===n.presetClass?' accel="70000" decel="0"':"entr"===n.presetClass?' accel="0" decel="70000"':p:p},i=(e,t,n,r="in",i="fade",a=p)=>`<p:animEffect transition="${r}" filter="${i}">\n <p:cBhvr>\n <p:cTn id="${t}" dur="${n}" fill="hold"${a}/>\n ${s(e)}\n </p:cBhvr>\n</p:animEffect>`,a=(e,t,n,r,i,a,o=p)=>`<p:anim calcmode="lin" valueType="num">\n <p:cBhvr additive="base">\n <p:cTn id="${t}" dur="${n}" fill="hold"${o}/>\n ${s(e)}\n <p:attrNameLst>\n <p:attrName>${r}</p:attrName>\n </p:attrNameLst>\n </p:cBhvr>\n <p:tavLst>\n <p:tav tm="0">\n <p:val><p:strVal val="${i}"/></p:val>\n </p:tav>\n <p:tav tm="100000">\n <p:val><p:strVal val="${a}"/></p:val>\n </p:tav>\n </p:tavLst>\n</p:anim>`,o=/^M\s+-?\d+(?:\.\d+)?\s+-?\d+(?:\.\d+)?\s+L\s+-?\d+(?:\.\d+)?\s+-?\d+(?:\.\d+)?\s*$/i,d=e=>{const t=Math.round(1e3*e)/1e3;return Math.abs(t)<5e-4?"":t>=0?`+${t}`:`${t}`},l=(e,n,p)=>{const s=t(e.type),i=r(e);if("path"===e.type){const t=(e=>{const t=String(e||"").trim();if(!t||!o.test(t))return null;const n=t.match(/-?\d+(?:\.\d+)?/g);if(!n||n.length<4)return null;const p=Number(n[0]),s=Number(n[1]),r=Number(n[n.length-2]),i=Number(n[n.length-1]);return[p,s,r,i].every(Number.isFinite)?{x:r-p,y:i-s}:null})(e.path);return t?[a(e.spid,p(),n,"ppt_x","#ppt_x",`#ppt_x${d(t.x)}`,i),a(e.spid,p(),n,"ppt_y","#ppt_y",`#ppt_y${d(t.y)}`,i)]:[]}const l=(e=>{switch(e.type){case"fade-up":return{y:20};case"fade-down":return{y:-20};case"fade-left":return{x:20};case"fade-right":return{x:-20};case"slide-up":return{y:40};case"slide-down":return{y:-40};case"slide-left":return{x:40};case"slide-right":return{x:-40};default:return null}})(e);if(l&&"entr"===s?.presetClass){const t=void 0===l.x?"#ppt_x":`#ppt_x${d(l.x)}`,s=void 0===l.y?"#ppt_y":`#ppt_y${d(l.y)}`;return[a(e.spid,p(),n,"ppt_x",t,"#ppt_x",i),a(e.spid,p(),n,"ppt_y",s,"#ppt_y",i)]}const c="fromTrace"===s?.motion?(e=>{switch(e){case"left":return"fromLeft";case"right":return"fromRight";case"top":return"fromTop";default:return"fromBottom"}})(e.from):s?.motion;if(!s||!c)return[];const f="fromLeft"===c?"#ppt_x-#ppt_w/2":"fromRight"===c?"#ppt_x+#ppt_w/2":"#ppt_x",m="fromTop"===c?"#ppt_y-#ppt_h/2":"fromBottom"===c?"#ppt_y+#ppt_h/2":"#ppt_y",u="exit"===s.presetClass;return[a(e.spid,p(),n,"ppt_x",u?"#ppt_x":f,u?f:"#ppt_x",i),a(e.spid,p(),n,"ppt_y",u?"#ppt_y":m,u?m:"#ppt_y",i)]},c=(e,a,o)=>{const d=t(e.type);if(!d)return"";const c=n(e.duration,500),f=Math.max(0,Math.round(Number.isFinite(e.delay)?e.delay:0)),m=r(e),u=a(),h=[($=e.spid,y=a(),`<p:set>\n <p:cBhvr>\n <p:cTn id="${y}" dur="1" fill="hold">\n <p:stCondLst>\n <p:cond delay="0"/>\n </p:stCondLst>\n </p:cTn>\n ${s($)}\n <p:attrNameLst>\n <p:attrName>style.visibility</p:attrName>\n </p:attrNameLst>\n </p:cBhvr>\n <p:to>\n <p:strVal val="visible"/>\n </p:to>\n</p:set>`),...l(e,c,a)];var $,y;if(d.scale){const t="emph"===d.presetClass,n=a();h.push(((e,t,n,r=85e3,i=1e5,a)=>{if(a?.emphasisRebound&&r!==i){const o=Math.floor(n/2);return`<p:seq>\n <p:cTn id="${t}" fill="hold">\n <p:childTnLst>\n <p:animScale>\n <p:cBhvr additive="base">\n <p:cTn id="${t+1}" dur="${o}" fill="hold"${a.smoothAttrs||p}/>\n ${s(e)}\n </p:cBhvr>\n <p:from x="${r}" y="${r}"/>\n <p:to x="${i}" y="${i}"/>\n </p:animScale>\n <p:animScale>\n <p:cBhvr additive="base">\n <p:cTn id="${t+2}" dur="${o}" fill="remove"${a.smoothAttrs||p}/>\n ${s(e)}\n </p:cBhvr>\n <p:from x="${i}" y="${i}"/>\n <p:to x="100000" y="100000"/>\n </p:animScale>\n </p:childTnLst>\n </p:cTn>\n</p:seq>`}return`<p:animScale>\n <p:cBhvr additive="base">\n <p:cTn id="${t}" dur="${n}" fill="hold"${a?.smoothAttrs||p}/>\n ${s(e)}\n </p:cBhvr>\n <p:from x="${r}" y="${r}"/>\n <p:to x="${i}" y="${i}"/>\n</p:animScale>`})(e.spid,n,c,d.scaleFrom,d.scaleTo,{emphasisRebound:t,smoothAttrs:m})),t&&(a(),a())}return void 0===d.rotateFrom&&void 0===d.rotateTo||h.push(((e,t,n,r=0,i=0,a=p)=>`<p:animRot from="${r}" to="${i}">\n <p:cBhvr additive="base">\n <p:cTn id="${t}" dur="${n}" fill="hold"${a}/>\n ${s(e)}\n </p:cBhvr>\n</p:animRot>`)(e.spid,a(),c,d.rotateFrom,d.rotateTo,m)),"wipe"===d.effectFilter?h.push(i(e.spid,a(),c,d.transition??"in",(e=>{switch(e){case"right":return"wipe(l)";case"top":return"wipe(d)";case"bottom":return"wipe(u)";default:return"wipe(r)"}})(e.from),m)):d.fade&&h.push(i(e.spid,a(),c,d.transition??"in","fade",m)),`<p:par>\n <p:cTn ${(e=>{const{anim:n,id:p,nodeTypeOverride:s,grpIdOverride:r}=e,i=t(n.type);if(!i)return"";const a=s||("click"===n.trigger?"clickEffect":"withEffect"),o=void 0===i.presetSubtype?"":` presetSubtype="${i.presetSubtype}"`,d=void 0===r?0:r;return`id="${p}" presetID="${i.presetId}" presetClass="${i.presetClass}"${o} fill="hold" grpId="${d}" nodeType="${a}"`})({anim:e,id:u,nodeTypeOverride:o?.nodeTypeOverride,grpIdOverride:o?.grpIdOverride})}>\n <p:stCondLst>\n <p:cond delay="${f}"/>\n </p:stCondLst>\n <p:childTnLst>\n ${h.join("\n ")}\n </p:childTnLst>\n </p:cTn>\n</p:par>`};exports.buildSlideTimingXml=function(e,n=0){if(0===e.length)return"";let p=n;const s=()=>(p+=1,p),r=[...e].filter(e=>t(e.type)&&Number.isFinite(e.spid)).sort((e,t)=>e.order-t.order||e.delay-t.delay||e.spid-t.spid);if(0===r.length)return"";const i=s(),a=s(),o=s(),d=s();let l,f,m=1;return`<p:timing>\n <p:tnLst>\n <p:par>\n <p:cTn id="${i}" dur="indefinite" restart="never" nodeType="tmRoot">\n <p:childTnLst>\n <p:seq concurrent="1" nextAc="seek">\n <p:cTn id="${a}" dur="indefinite" nodeType="mainSeq">\n <p:childTnLst>\n <p:par>\n <p:cTn id="${o}" fill="hold">\n <p:stCondLst>\n <p:cond delay="0"/>\n <p:cond evt="onBegin" delay="0">\n <p:tn val="${a}"/>\n </p:cond>\n </p:stCondLst>\n <p:childTnLst>\n <p:par>\n <p:cTn id="${d}" fill="hold">\n <p:stCondLst>\n <p:cond delay="0"/>\n </p:stCondLst>\n <p:childTnLst>\n ${r.map(e=>"click"!==e.trigger?c(e,s):e.clickGroup?e.clickGroup!==l?(l=e.clickGroup,f=m,m+=1,c(e,s,{nodeTypeOverride:"clickEffect",grpIdOverride:f})):c(e,s,{nodeTypeOverride:"withEffect",grpIdOverride:f}):(l=void 0,f=void 0,c(e,s))).join("\n")}\n </p:childTnLst>\n </p:cTn>\n </p:par>\n </p:childTnLst>\n </p:cTn>\n </p:par>\n </p:childTnLst>\n </p:cTn>\n <p:prevCondLst>\n <p:cond evt="onPrev" delay="0">\n <p:tgtEl><p:sldTgt/></p:tgtEl>\n </p:cond>\n </p:prevCondLst>\n <p:nextCondLst>\n <p:cond evt="onNext" delay="0">\n <p:tgtEl><p:sldTgt/></p:tgtEl>\n </p:cond>\n </p:nextCondLst>\n </p:seq>\n </p:childTnLst>\n </p:cTn>\n </p:par>\n </p:tnLst>\n <p:bldLst>\n ${[...new Set(r.map(e=>e.spid))].map(e=>`<p:bldP spid="${e}" grpId="0"/>`).join("\n ")}\n </p:bldLst>\n</p:timing>`},exports.buildSlideTransitionXml=function(e,t){if("none"===e)return"";const p=function(e){switch(e){case"none":return"none";case"push":case"wipe":case"cover":case"uncover":case"dissolve":case"fade":return e;case"slide-left":case"slide-up":return"push";case"zoom":return"dissolve";default:return"fade"}}(e);if("none"===p)return"";const s=n(t??400,400);return`<p:transition spd="${s<=300?"fast":s<=700?"med":"slow"}" dur="${s}" advClick="1"><p:${p}/></p:transition>`};
@@ -0,0 +1,14 @@
1
+ import type { HtmlToPptxAnimationFrom, HtmlToPptxAnimationTrigger, HtmlToPptxAnimationType } from './types.js';
2
+ export interface PptxTargetAnimation {
3
+ spid: number;
4
+ type: HtmlToPptxAnimationType;
5
+ trigger: HtmlToPptxAnimationTrigger;
6
+ clickGroup?: string;
7
+ from?: HtmlToPptxAnimationFrom;
8
+ path?: string;
9
+ duration: number;
10
+ delay: number;
11
+ order: number;
12
+ }
13
+ export declare function buildSlideTimingXml(animations: PptxTargetAnimation[], startNodeId?: number): string;
14
+ export declare function buildSlideTransitionXml(type: string, durationMs?: number): string;
@@ -0,0 +1 @@
1
+ const e={fade:{presetId:10,presetClass:"entr",fade:!0},"fade-up":{presetId:2,presetClass:"entr",presetSubtype:8,motion:"fromBottom",fade:!0},"fade-down":{presetId:2,presetClass:"entr",presetSubtype:1,motion:"fromTop",fade:!0},"fade-left":{presetId:2,presetClass:"entr",presetSubtype:3,motion:"fromRight",fade:!0},"fade-right":{presetId:2,presetClass:"entr",presetSubtype:2,motion:"fromLeft",fade:!0},"scale-in":{presetId:31,presetClass:"entr",scale:!0,fade:!0},"slide-up":{presetId:2,presetClass:"entr",presetSubtype:8,motion:"fromBottom",fade:!0},"slide-down":{presetId:2,presetClass:"entr",presetSubtype:1,motion:"fromTop",fade:!0},"slide-left":{presetId:2,presetClass:"entr",presetSubtype:3,motion:"fromRight",fade:!0},"slide-right":{presetId:2,presetClass:"entr",presetSubtype:2,motion:"fromLeft",fade:!0},"fly-in":{presetId:2,presetClass:"entr",motion:"fromTrace",fade:!0},wipe:{presetId:5,presetClass:"entr",effectFilter:"wipe"},"zoom-in":{presetId:31,presetClass:"entr",scale:!0,scaleFrom:75e3,scaleTo:1e5,fade:!0},"spin-in":{presetId:31,presetClass:"entr",scale:!0,scaleFrom:92e3,scaleTo:1e5,rotateFrom:-72e4,rotateTo:0,fade:!0},"grow-shrink-soft":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:95e3,scaleTo:104e3},"grow-shrink":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:9e4,scaleTo:108e3},"grow-shrink-strong":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:85e3,scaleTo:112e3},"pulse-soft":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:1e5,scaleTo:103e3},pulse:{presetId:6,presetClass:"emph",scale:!0,scaleFrom:1e5,scaleTo:106e3},"pulse-strong":{presetId:6,presetClass:"emph",scale:!0,scaleFrom:1e5,scaleTo:11e4},"exit-fade":{presetId:10,presetClass:"exit",fade:!0,transition:"out"},"exit-scale":{presetId:31,presetClass:"exit",scale:!0,scaleFrom:1e5,scaleTo:85e3,fade:!0,transition:"out"},"exit-zoom":{presetId:31,presetClass:"exit",scale:!0,scaleFrom:1e5,scaleTo:75e3,fade:!0,transition:"out"},"exit-wipe":{presetId:5,presetClass:"exit",effectFilter:"wipe",transition:"out"},"exit-fly":{presetId:2,presetClass:"exit",motion:"fromTrace",fade:!0,transition:"out"},path:{presetId:10,presetClass:"entr"}},t=t=>e[t],n=(e,t)=>{const n=Number.isFinite(e)?e:t;return Math.round(Math.max(100,Math.min(5e3,n)))},p=' accel="20000" decel="60000"',s=e=>`<p:tgtEl><p:spTgt spid="${e}"/></p:tgtEl>`,r=e=>{const n=t(e.type);return n?"exit"===n.presetClass?' accel="70000" decel="0"':"entr"===n.presetClass?' accel="0" decel="70000"':p:p},i=(e,t,n,r="in",i="fade",a=p)=>`<p:animEffect transition="${r}" filter="${i}">\n <p:cBhvr>\n <p:cTn id="${t}" dur="${n}" fill="hold"${a}/>\n ${s(e)}\n </p:cBhvr>\n</p:animEffect>`,a=(e,t,n,r,i,a,o=p)=>`<p:anim calcmode="lin" valueType="num">\n <p:cBhvr additive="base">\n <p:cTn id="${t}" dur="${n}" fill="hold"${o}/>\n ${s(e)}\n <p:attrNameLst>\n <p:attrName>${r}</p:attrName>\n </p:attrNameLst>\n </p:cBhvr>\n <p:tavLst>\n <p:tav tm="0">\n <p:val><p:strVal val="${i}"/></p:val>\n </p:tav>\n <p:tav tm="100000">\n <p:val><p:strVal val="${a}"/></p:val>\n </p:tav>\n </p:tavLst>\n</p:anim>`,o=/^M\s+-?\d+(?:\.\d+)?\s+-?\d+(?:\.\d+)?\s+L\s+-?\d+(?:\.\d+)?\s+-?\d+(?:\.\d+)?\s*$/i,d=e=>{const t=Math.round(1e3*e)/1e3;return Math.abs(t)<5e-4?"":t>=0?`+${t}`:`${t}`},l=(e,n,p)=>{const s=t(e.type),i=r(e);if("path"===e.type){const t=(e=>{const t=String(e||"").trim();if(!t||!o.test(t))return null;const n=t.match(/-?\d+(?:\.\d+)?/g);if(!n||n.length<4)return null;const p=Number(n[0]),s=Number(n[1]),r=Number(n[n.length-2]),i=Number(n[n.length-1]);return[p,s,r,i].every(Number.isFinite)?{x:r-p,y:i-s}:null})(e.path);return t?[a(e.spid,p(),n,"ppt_x","#ppt_x",`#ppt_x${d(t.x)}`,i),a(e.spid,p(),n,"ppt_y","#ppt_y",`#ppt_y${d(t.y)}`,i)]:[]}const l=(e=>{switch(e.type){case"fade-up":return{y:20};case"fade-down":return{y:-20};case"fade-left":return{x:20};case"fade-right":return{x:-20};case"slide-up":return{y:40};case"slide-down":return{y:-40};case"slide-left":return{x:40};case"slide-right":return{x:-40};default:return null}})(e);if(l&&"entr"===s?.presetClass){const t=void 0===l.x?"#ppt_x":`#ppt_x${d(l.x)}`,s=void 0===l.y?"#ppt_y":`#ppt_y${d(l.y)}`;return[a(e.spid,p(),n,"ppt_x",t,"#ppt_x",i),a(e.spid,p(),n,"ppt_y",s,"#ppt_y",i)]}const c="fromTrace"===s?.motion?(e=>{switch(e){case"left":return"fromLeft";case"right":return"fromRight";case"top":return"fromTop";default:return"fromBottom"}})(e.from):s?.motion;if(!s||!c)return[];const f="fromLeft"===c?"#ppt_x-#ppt_w/2":"fromRight"===c?"#ppt_x+#ppt_w/2":"#ppt_x",m="fromTop"===c?"#ppt_y-#ppt_h/2":"fromBottom"===c?"#ppt_y+#ppt_h/2":"#ppt_y",u="exit"===s.presetClass;return[a(e.spid,p(),n,"ppt_x",u?"#ppt_x":f,u?f:"#ppt_x",i),a(e.spid,p(),n,"ppt_y",u?"#ppt_y":m,u?m:"#ppt_y",i)]},c=(e,a,o)=>{const d=t(e.type);if(!d)return"";const c=n(e.duration,500),f=Math.max(0,Math.round(Number.isFinite(e.delay)?e.delay:0)),m=r(e),u=a(),h=[($=e.spid,y=a(),`<p:set>\n <p:cBhvr>\n <p:cTn id="${y}" dur="1" fill="hold">\n <p:stCondLst>\n <p:cond delay="0"/>\n </p:stCondLst>\n </p:cTn>\n ${s($)}\n <p:attrNameLst>\n <p:attrName>style.visibility</p:attrName>\n </p:attrNameLst>\n </p:cBhvr>\n <p:to>\n <p:strVal val="visible"/>\n </p:to>\n</p:set>`),...l(e,c,a)];var $,y;if(d.scale){const t="emph"===d.presetClass,n=a();h.push(((e,t,n,r=85e3,i=1e5,a)=>{if(a?.emphasisRebound&&r!==i){const o=Math.floor(n/2);return`<p:seq>\n <p:cTn id="${t}" fill="hold">\n <p:childTnLst>\n <p:animScale>\n <p:cBhvr additive="base">\n <p:cTn id="${t+1}" dur="${o}" fill="hold"${a.smoothAttrs||p}/>\n ${s(e)}\n </p:cBhvr>\n <p:from x="${r}" y="${r}"/>\n <p:to x="${i}" y="${i}"/>\n </p:animScale>\n <p:animScale>\n <p:cBhvr additive="base">\n <p:cTn id="${t+2}" dur="${o}" fill="remove"${a.smoothAttrs||p}/>\n ${s(e)}\n </p:cBhvr>\n <p:from x="${i}" y="${i}"/>\n <p:to x="100000" y="100000"/>\n </p:animScale>\n </p:childTnLst>\n </p:cTn>\n</p:seq>`}return`<p:animScale>\n <p:cBhvr additive="base">\n <p:cTn id="${t}" dur="${n}" fill="hold"${a?.smoothAttrs||p}/>\n ${s(e)}\n </p:cBhvr>\n <p:from x="${r}" y="${r}"/>\n <p:to x="${i}" y="${i}"/>\n</p:animScale>`})(e.spid,n,c,d.scaleFrom,d.scaleTo,{emphasisRebound:t,smoothAttrs:m})),t&&(a(),a())}return void 0===d.rotateFrom&&void 0===d.rotateTo||h.push(((e,t,n,r=0,i=0,a=p)=>`<p:animRot from="${r}" to="${i}">\n <p:cBhvr additive="base">\n <p:cTn id="${t}" dur="${n}" fill="hold"${a}/>\n ${s(e)}\n </p:cBhvr>\n</p:animRot>`)(e.spid,a(),c,d.rotateFrom,d.rotateTo,m)),"wipe"===d.effectFilter?h.push(i(e.spid,a(),c,d.transition??"in",(e=>{switch(e){case"right":return"wipe(l)";case"top":return"wipe(d)";case"bottom":return"wipe(u)";default:return"wipe(r)"}})(e.from),m)):d.fade&&h.push(i(e.spid,a(),c,d.transition??"in","fade",m)),`<p:par>\n <p:cTn ${(e=>{const{anim:n,id:p,nodeTypeOverride:s,grpIdOverride:r}=e,i=t(n.type);if(!i)return"";const a=s||("click"===n.trigger?"clickEffect":"withEffect"),o=void 0===i.presetSubtype?"":` presetSubtype="${i.presetSubtype}"`,d=void 0===r?0:r;return`id="${p}" presetID="${i.presetId}" presetClass="${i.presetClass}"${o} fill="hold" grpId="${d}" nodeType="${a}"`})({anim:e,id:u,nodeTypeOverride:o?.nodeTypeOverride,grpIdOverride:o?.grpIdOverride})}>\n <p:stCondLst>\n <p:cond delay="${f}"/>\n </p:stCondLst>\n <p:childTnLst>\n ${h.join("\n ")}\n </p:childTnLst>\n </p:cTn>\n</p:par>`};function f(e,n=0){if(0===e.length)return"";let p=n;const s=()=>(p+=1,p),r=[...e].filter(e=>t(e.type)&&Number.isFinite(e.spid)).sort((e,t)=>e.order-t.order||e.delay-t.delay||e.spid-t.spid);if(0===r.length)return"";const i=s(),a=s(),o=s(),d=s();let l,f,m=1;return`<p:timing>\n <p:tnLst>\n <p:par>\n <p:cTn id="${i}" dur="indefinite" restart="never" nodeType="tmRoot">\n <p:childTnLst>\n <p:seq concurrent="1" nextAc="seek">\n <p:cTn id="${a}" dur="indefinite" nodeType="mainSeq">\n <p:childTnLst>\n <p:par>\n <p:cTn id="${o}" fill="hold">\n <p:stCondLst>\n <p:cond delay="0"/>\n <p:cond evt="onBegin" delay="0">\n <p:tn val="${a}"/>\n </p:cond>\n </p:stCondLst>\n <p:childTnLst>\n <p:par>\n <p:cTn id="${d}" fill="hold">\n <p:stCondLst>\n <p:cond delay="0"/>\n </p:stCondLst>\n <p:childTnLst>\n ${r.map(e=>"click"!==e.trigger?c(e,s):e.clickGroup?e.clickGroup!==l?(l=e.clickGroup,f=m,m+=1,c(e,s,{nodeTypeOverride:"clickEffect",grpIdOverride:f})):c(e,s,{nodeTypeOverride:"withEffect",grpIdOverride:f}):(l=void 0,f=void 0,c(e,s))).join("\n")}\n </p:childTnLst>\n </p:cTn>\n </p:par>\n </p:childTnLst>\n </p:cTn>\n </p:par>\n </p:childTnLst>\n </p:cTn>\n <p:prevCondLst>\n <p:cond evt="onPrev" delay="0">\n <p:tgtEl><p:sldTgt/></p:tgtEl>\n </p:cond>\n </p:prevCondLst>\n <p:nextCondLst>\n <p:cond evt="onNext" delay="0">\n <p:tgtEl><p:sldTgt/></p:tgtEl>\n </p:cond>\n </p:nextCondLst>\n </p:seq>\n </p:childTnLst>\n </p:cTn>\n </p:par>\n </p:tnLst>\n <p:bldLst>\n ${[...new Set(r.map(e=>e.spid))].map(e=>`<p:bldP spid="${e}" grpId="0"/>`).join("\n ")}\n </p:bldLst>\n</p:timing>`}function m(e,t){if("none"===e)return"";const p=function(e){switch(e){case"none":return"none";case"push":case"wipe":case"cover":case"uncover":case"dissolve":case"fade":return e;case"slide-left":case"slide-up":return"push";case"zoom":return"dissolve";default:return"fade"}}(e);if("none"===p)return"";const s=n(t??400,400);return`<p:transition spd="${s<=300?"fast":s<=700?"med":"slow"}" dur="${s}" advClick="1"><p:${p}/></p:transition>`}export{f as buildSlideTimingXml,m as buildSlideTransitionXml};
@@ -0,0 +1,41 @@
1
+ export declare const DATA_ANIM_SUPPORTED_TYPES: readonly ["fade", "fade-up", "fade-down", "fade-left", "fade-right", "scale-in", "slide-up", "slide-down", "slide-left", "slide-right", "fly-in", "wipe", "zoom-in", "spin-in", "grow-shrink-soft", "grow-shrink", "grow-shrink-strong", "pulse-soft", "pulse", "pulse-strong", "exit-fade", "exit-scale", "exit-zoom", "exit-wipe", "exit-fly", "path"];
2
+ export type DataAnimType = (typeof DATA_ANIM_SUPPORTED_TYPES)[number];
3
+ export declare const DATA_ANIM_EDITABLE_TYPES: ("fade" | "fade-up" | "fade-down" | "fade-left" | "fade-right" | "scale-in" | "slide-up" | "slide-down" | "slide-left" | "slide-right" | "fly-in" | "wipe" | "zoom-in" | "spin-in" | "grow-shrink-soft" | "grow-shrink" | "grow-shrink-strong" | "pulse-soft" | "pulse" | "pulse-strong" | "exit-fade" | "exit-scale" | "exit-zoom" | "exit-wipe" | "exit-fly")[];
4
+ export type ElementAnimationEditableType = (typeof DATA_ANIM_EDITABLE_TYPES)[number];
5
+ export declare const DATA_ANIM_FROM_VALUES: readonly ["left", "right", "top", "bottom", "center"];
6
+ export type DataAnimFrom = (typeof DATA_ANIM_FROM_VALUES)[number];
7
+ export type ElementAnimationEditableFrom = Exclude<DataAnimFrom, 'center'>;
8
+ export declare const DATA_ANIM_TRIGGERS: readonly ["load", "with", "after", "click"];
9
+ export type DataAnimTrigger = (typeof DATA_ANIM_TRIGGERS)[number];
10
+ export type DataAnimPptxTrigger = Extract<DataAnimTrigger, 'load' | 'click'>;
11
+ export declare const DATA_ANIM_SEQUENCES: readonly ["with", "after"];
12
+ export type DataAnimSequence = (typeof DATA_ANIM_SEQUENCES)[number];
13
+ export interface ElementAnimationConfig {
14
+ type: DataAnimType;
15
+ trigger: DataAnimTrigger;
16
+ durationMs: number;
17
+ from?: DataAnimFrom;
18
+ delay?: string;
19
+ staggerMs?: number;
20
+ sequence?: DataAnimSequence;
21
+ clickGroup?: string;
22
+ path?: string;
23
+ }
24
+ export interface ElementAnimationPatch {
25
+ type?: ElementAnimationEditableType | null;
26
+ trigger?: 'load' | 'click';
27
+ durationMs?: number;
28
+ from?: ElementAnimationEditableFrom | null;
29
+ }
30
+ export declare function isDataAnimType(value: unknown): value is DataAnimType;
31
+ export declare function isDataAnimTrigger(value: unknown): value is DataAnimTrigger;
32
+ export declare function isDataAnimFrom(value: unknown): value is DataAnimFrom;
33
+ export declare function isDataAnimSequence(value: unknown): value is DataAnimSequence;
34
+ /**
35
+ * Normalize data-anim-trigger to a canonical value.
36
+ * Tolerates PowerPoint-style legacy aliases (on-click / after-previous / with-previous)
37
+ * so old/hand-edited pages stay editable. Returns null for truly invalid values.
38
+ */
39
+ export declare function normalizeDataAnimTrigger(value: string | undefined | null): DataAnimTrigger | null;
40
+ export declare function isElementAnimationEditableType(value: unknown): value is ElementAnimationEditableType;
41
+ export declare function isElementAnimationEditableFrom(value: unknown): value is ElementAnimationEditableFrom;
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ var t=require("module"),e=require("url"),r=require("./ooxml-writer.cjs");require("fflate"),require("./animation-writer.cjs");var n="undefined"!=typeof document?document.currentScript:null;const o=13.333,i=7.5,a=12582912,l=144,s=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("index.cjs",document.baseURI).href),c=e.pathToFileURL(s.resolve("@chenglou/pretext")).toString(),d=(t,e,r)=>Math.max(e,Math.min(r,t)),u=(t,e="111827")=>{if(!t)return e;const r=t.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(r)?r.split("").map(t=>`${t}${t}`).join(""):/^[0-9A-F]{6}$/.test(r)?r:e},h=t=>{const e=t.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\n")},g=(t,e)=>{const r=(t=>String(t||"").split(",").map(t=>t.trim().replace(/^["']|["']$/g,"")).find(Boolean)||"Aptos")(e);return(t=>/[\u3400-\u9fff\uf900-\ufaff]/.test(t))(t)&&/^(aptos|arial|helvetica|inter|system-ui|-apple-system|sans-serif|serif)$/i.test(r)?"Microsoft YaHei":r},m=t=>{const e=t&&"object"==typeof t?t:{},r=h(String(e.text||""));if(!r)return null;const n=Math.max(1,Number(e.rowspan)||1),a=Math.max(1,Number(e.colspan)||1),s=e.border&&"object"==typeof e.border?e.border:null,c=s?u(String(s.color||""),""):"";return{text:r,rowspan:n,colspan:a,x:d(Number(e.x)||0,0,o),y:d(Number(e.y)||0,0,i),w:d(Number(e.w)||.1,.05,o),h:d(Number(e.h)||.05,.03,i),fontSize:e.fontSize?d(Number(e.fontSize),6,l):void 0,fontFace:g(r,String(e.fontFace||"")),color:u(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",valign:"middle"===e.valign||"bottom"===e.valign?e.valign:"top",fill:e.fill?u(String(e.fill),""):void 0,fillTransparency:e.fillTransparency?d(Number(e.fillTransparency),0,100):void 0,border:c?{color:c,widthPt:d(Number(s?.widthPt??.75),.1,20),dash:"dash"===s?.dash?"dash":"solid"}:void 0}},p=t=>{const e=t&&"object"==typeof t?t:{},r=Array.isArray(e.rows)?e.rows:[],n=Array.isArray(e.colWidths)?e.colWidths:[],a=Array.isArray(e.rowHeights)?e.rowHeights:[];if(0===r.length)return null;const l=r.map(t=>(Array.isArray(t)?t:[]).map(m).filter(t=>null!==t)).filter(t=>t.length>0);return 0===l.length?null:{x:d(Number(e.x)||0,0,o),y:d(Number(e.y)||0,0,i),w:d(Number(e.w)||.1,.1,o),h:d(Number(e.h)||.1,.1,i),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0,colWidths:n.map(t=>Math.max(.05,Number(t)||.05)),rowHeights:a.map(t=>Math.max(.03,Number(t)||.03)),rows:l}},f=t=>{const e=t&&"object"==typeof t?t:{},r=h(String(e.text||""));return r?{text:r,fontSize:Number(e.fontSize)>0?d(Number(e.fontSize),6,l):void 0,fontFace:g(r,String(e.fontFace||"")),color:u(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike)}:null};exports.buildHtmlToPptxExtractScript=t=>{const e=t.slideWidthIn??o,r=t.slideHeightIn??i,n=Math.max(1,Math.floor(t.maxTextBoxes??360)),s=Math.max(0,Math.floor(t.maxShapes??400)),d=Math.max(0,Math.floor(t.maxImages??80)),u=Math.max(80,Math.floor(t.maxTextChars??1e3)),h=Math.max(0,Math.floor(t.maxImageBytes??a)),g=(t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5;return'(function(){const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,o=t=>{const e=String(t||"").trim();if(!e||"transparent"===e)return"";if(e.startsWith("#")){const t=e.slice(1).toUpperCase();return 3===t.length?t.split("").map(t=>t+t).join(""):t}const o=e.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);return o?(void 0===o[4]?1:String(o[4]).endsWith("%")?Number.parseFloat(o[4])/100:Number(o[4]))<=.02?"":[o[1],o[2],o[3]].map(t=>Math.max(0,Math.min(255,Math.round(Number(t)||0))).toString(16).padStart(2,"0")).join("").toUpperCase():""},n=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const o=String(e[1]);return o.endsWith("%")?Number.parseFloat(o)/100:Number(o)},r=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,i=r.getBoundingClientRect(),l=i.left||0,a=i.top||0,s=i.width||__HTML2PPTX_TEMPLATE_SLOT_2__,d=i.height||__HTML2PPTX_TEMPLATE_SLOT_3__,c=e=>((Number(e)||0)-l)/s*t,u=t=>((Number(t)||0)-a)/d*e,g=e=>(Number(e)||0)/s*t,p=t=>(Number(t)||0)/d*e,h=72*Math.min(t/s,e/d),m=[],f=[],b=r.querySelectorAll("table");for(const t of b){if(t.closest("script, style, noscript, .katex, .katex-mathml"))continue;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();if("none"===e.display||"hidden"===e.visibility)continue;if(r.width<10||r.height<10)continue;const i=t.querySelectorAll("tr");if(!i.length)continue;let l=0;for(const t of i){let e=0;for(const o of t.children)"TD"!==o.tagName&&"TH"!==o.tagName||(e+=Number(o.getAttribute("colspan")||1));l=Math.max(l,e)}if(0===l)continue;const a=new Array(l).fill(0),s=[],d=new Array(i.length).fill(null).map(()=>new Array(l).fill(!1));for(let t=0;t<i.length;t++){const e=i[t],o=e.getBoundingClientRect();s.push(o.height);let n=0;for(const o of e.children){if("TD"!==o.tagName&&"TH"!==o.tagName)continue;const e=Number(o.getAttribute("colspan")||1),r=Number(o.getAttribute("rowspan")||1);for(;n<l&&d[t][n];)n++;if(n>=l)break;const s=o.getBoundingClientRect().width/e;for(let t=0;t<e&&n+t<l;t++)a[n+t]=Math.max(a[n+t],s);for(let o=1;o<r&&t+o<i.length;o++)for(let r=0;r<e&&n+r<l;r++)d[t+o][n+r]=!0;n+=e}}const b=[];for(const t of i){const e=[];for(const r of t.children){if("TD"!==r.tagName&&"TH"!==r.tagName)continue;const t=window.getComputedStyle(r),i=r.getBoundingClientRect(),l=Number(r.getAttribute("rowspan")||1),a=Number(r.getAttribute("colspan")||1),s=String(r.textContent||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),d=Number.parseFloat(t.fontSize||"16")||16,m=Number.parseInt(t.fontWeight||"400",10)||400,f=o(t.backgroundColor),b=n(t.backgroundColor),S=o(t.borderColor),T=Number.parseFloat(t.borderWidth||"0")||0,_=T>0&&"none"!==t.borderStyle&&S;let y="top";const N=String(t.verticalAlign||"");"middle"===N?y="middle":"bottom"===N&&(y="bottom");let w="left";const A=String(t.textAlign||"");"center"===A?w="center":"right"===A||"end"===A?w="right":"justify"===A&&(w="justify"),e.push({text:s,rowspan:l,colspan:a,x:c(i.left),y:u(i.top),w:g(i.width),h:p(i.height),fontSize:Math.max(6,Math.min(144,d*h)),fontFace:String(t.fontFamily||"").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",color:o(t.color)||"111827",bold:m>=600,italic:"italic"===t.fontStyle||"oblique"===t.fontStyle,underline:String(t.textDecoration||"").includes("underline"),strike:String(t.textDecoration||"").includes("line-through"),align:w,valign:y,fill:f||void 0,fillTransparency:f?Math.round(100*(1-b)):void 0,border:_?{color:S,widthPt:.75*T,dash:"dashed"===t.borderStyle?"dash":"solid"}:void 0})}b.push(e)}const S="pptx-table-"+m.length;t.setAttribute("data-pptx-consumed-table",S),f.push(S),m.push({x:c(r.left),y:u(r.top),w:g(r.width),h:p(r.height),colWidths:a.map(t=>g(t)),rowHeights:s.map(t=>p(t)),rows:b})}return{tables:m,consumedTableElementIds:f}}())'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(t.pageHeightPx)))})(t);return'(async()=>{const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,r=__HTML2PPTX_TEMPLATE_SLOT_2__,n=__HTML2PPTX_TEMPLATE_SLOT_3__,o=__HTML2PPTX_TEMPLATE_SLOT_4__,i=__HTML2PPTX_TEMPLATE_SLOT_5__,a=__HTML2PPTX_TEMPLATE_SLOT_6__,s=__HTML2PPTX_TEMPLATE_SLOT_7__,l=__HTML2PPTX_TEMPLATE_SLOT_8__,c=__HTML2PPTX_TEMPLATE_SLOT_9__;let d=null;try{d=await import(c)}catch(t){d=null}const h=t=>String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),u=t=>h(t).slice(0,s),g=t=>(t=>{const e=String(t||"").replace(/\\r\\n?/g,"\\n").replace(/[\\u200b-\\u200d\\ufeff]/g,"").split("\\n").map(t=>t.replace(/[^\\S\\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\\n")})(t).slice(0,s);__HTML2PPTX_TEMPLATE_SLOT_10__;const f=__HTML2PPTX_TEMPLATE_SLOT_11__,m=f.tables||[],p=new Set(f.consumedTableElementIds||[]),b=t=>{if(t.getAttribute&&p.has(t.getAttribute("data-pptx-consumed-table")))return!0;const e=t.closest&&t.closest("[data-pptx-consumed-table]");return!!e&&p.has(e.getAttribute("data-pptx-consumed-table"))},x=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,F=x.getBoundingClientRect(),E=F.left||0,w=F.top||0,S=F.width||t,M=F.height||e,y=(x instanceof HTMLElement&&x.offsetWidth&&x.offsetWidth,t=>((Number(t)||0)-E)/S*r),A=t=>((Number(t)||0)-w)/M*n,C=t=>(Number(t)||0)/S*r,T=t=>(Number(t)||0)/M*n,N=72*Math.min(r/S,n/M),B=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const r=String(e[1]),n=r.endsWith("%")?Number.parseFloat(r)/100:Number(r);return Math.max(0,Math.min(1,Number.isFinite(n)?n:1))},D=(t,e)=>{const r=B(t)*Math.max(0,Math.min(1,Number(e||1)));return Math.round(100*(1-r))},_=t=>{const e=t.webkitTextFillColor||t.getPropertyValue?.("-webkit-text-fill-color")||"",r=rgbToHex(e)?e:t.color;return{color:rgbToHex(r)||rgbToHex(t.color)||"111827",opacity:B(r)*Math.max(0,Math.min(1,Number(t.opacity||1)))}},v=t=>{if(!t.transform||"none"===t.transform)return;const e=t.transform.match(/matrix\\(([^)]+)\\)/)?.[1]?.split(",").map(t=>Number(t.trim()));return!e||e.length<4?void 0:Math.round(180*Math.atan2(e[1],e[0])/Math.PI)||void 0},L=(()=>{const t=rgbToHex(window.getComputedStyle(x).backgroundColor);if(t)return t;const e=rgbToHex(window.getComputedStyle(document.documentElement).backgroundColor);if(e)return e;const r=S*M,n=x.querySelectorAll(":scope > div, :scope > section, :scope > main");for(const t of n){const e=window.getComputedStyle(t),n=rgbToHex(e.backgroundColor);if(!n)continue;const o=t.getBoundingClientRect();if(o.width*o.height>=.5*r)return n}return"FFFFFF"})(),k=(r,n,o)=>{if(!n||"none"===n.display||"hidden"===n.visibility)return!1;if(Number(n.opacity||"1")<.04)return!1;const i=["Top","Right","Bottom","Left"].some(t=>{const e=Number.parseFloat(n["border"+t+"Width"]||"0")||0,r=n["border"+t+"Style"];return e>0&&"none"!==r});return!((o.width<2||o.height<2)&&!i||o.width<2&&o.height<2||o.bottom<0||o.right<0||o.left>t||o.top>e||r.closest("script, style, noscript, .katex, .katex-mathml, [data-pptx-formula-block]"))},P=t=>{const e=t.getBoundingClientRect();return{rect:e,x:y(e.left),y:A(e.top),w:C(e.width),h:T(e.height)}},I=new WeakMap;Array.from(x.querySelectorAll("*")).forEach((t,e)=>{I.set(t,e+1)});const R=t=>I.get(t)||0,H=t=>{const e=String(t?.zIndex||"").trim();if(!e||"auto"===e)return;const r=Number.parseInt(e,10);return Number.isFinite(r)?Math.max(-1e5,Math.min(1e5,r)):void 0},W=(t,e)=>!(!t||t===x||!(void 0!==H(e)&&("static"!==e.position||(t=>{const e=t?.parentElement;return!!e&&/(?:^|\\s)(?:inline-)?(?:flex|grid)(?:\\s|$)/.test(window.getComputedStyle(e).display||"")})(t))||Number(e.opacity||"1")<1||e.transform&&"none"!==e.transform||e.filter&&"none"!==e.filter||e.backdropFilter&&"none"!==e.backdropFilter||e.perspective&&"none"!==e.perspective||e.mixBlendMode&&"normal"!==e.mixBlendMode||"isolate"===e.isolation||/(?:layout|paint|strict|content)/.test(e.contain||"")||/(?:transform|opacity|filter|perspective|contents)/.test(e.willChange||""))),O=t=>{const e=[];let r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE&&(e.push(r),r!==x);)r=r.parentElement;e.reverse();const n=[{z:0,order:0}];for(const t of e){if(!t||t===x)continue;const e=window.getComputedStyle(t);W(t,e)&&n.push({z:H(e)??0,order:R(t)})}const o=R(t);return n.some(t=>t.order===o)||n.push({z:0,order:o}),{key:n,order:o}},j=t=>{let e=1,r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE;){const t=Number(window.getComputedStyle(r).opacity||"1");if(Number.isFinite(t)&&(e*=Math.max(0,Math.min(1,t))),r===x)break;r=r.parentElement}return Math.max(0,Math.min(1,e))},z=new Map;let U=0;const q=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE)return"";let e=t.getAttribute("data-pptx-paint-id");return e||(U+=1,e="pptx-paint-"+String(U),t.setAttribute("data-pptx-paint-id",e)),z.set(e,t),e},$=new Map([["ring",3],["ring-0",0],["ring-1",1],["ring-2",2],["ring-4",4],["ring-8",8]]),X=new Map([["border",1],["border-0",0],["border-2",2],["border-4",4],["border-8",8]]),V=new Map([["rounded-none",0],["rounded-sm",2],["rounded",4],["rounded-md",6],["rounded-lg",8],["rounded-xl",12],["rounded-2xl",16],["rounded-3xl",24]]),G=new Map([["font-thin",100],["font-extralight",200],["font-light",300],["font-normal",400],["font-medium",500],["font-semibold",600],["font-bold",700],["font-extrabold",800],["font-black",900]]),K=new Map([["black","#000000"],["white","#FFFFFF"],["transparent","rgba(0, 0, 0, 0)"]]),Q=["50","100","200","300","400","500","600","700","800","900","950"],Y=new Map(Object.entries({slate:["#F8FAFC","#F1F5F9","#E2E8F0","#CBD5E1","#94A3B8","#64748B","#475569","#334155","#1E293B","#0F172A","#020617"],gray:["#F9FAFB","#F3F4F6","#E5E7EB","#D1D5DB","#9CA3AF","#6B7280","#4B5563","#374151","#1F2937","#111827","#030712"],zinc:["#FAFAFA","#F4F4F5","#E4E4E7","#D4D4D8","#A1A1AA","#71717A","#52525B","#3F3F46","#27272A","#18181B","#09090B"],neutral:["#FAFAFA","#F5F5F5","#E5E5E5","#D4D4D4","#A3A3A3","#737373","#525252","#404040","#262626","#171717","#0A0A0A"],stone:["#FAFAF9","#F5F5F4","#E7E5E4","#D6D3D1","#A8A29E","#78716C","#57534E","#44403C","#292524","#1C1917","#0C0A09"],red:["#FEF2F2","#FEE2E2","#FECACA","#FCA5A5","#F87171","#EF4444","#DC2626","#B91C1C","#991B1B","#7F1D1D","#450A0A"],orange:["#FFF7ED","#FFEDD5","#FED7AA","#FDBA74","#FB923C","#F97316","#EA580C","#C2410C","#9A3412","#7C2D12","#431407"],amber:["#FFFBEB","#FEF3C7","#FDE68A","#FCD34D","#FBBF24","#F59E0B","#D97706","#B45309","#92400E","#78350F","#451A03"],yellow:["#FEFCE8","#FEF9C3","#FEF08A","#FDE047","#FACC15","#EAB308","#CA8A04","#A16207","#854D0E","#713F12","#422006"],lime:["#F7FEE7","#ECFCCB","#D9F99D","#BEF264","#A3E635","#84CC16","#65A30D","#4D7C0F","#3F6212","#365314","#1A2E05"],green:["#F0FDF4","#DCFCE7","#BBF7D0","#86EFAC","#4ADE80","#22C55E","#16A34A","#15803D","#166534","#14532D","#052E16"],emerald:["#ECFDF5","#D1FAE5","#A7F3D0","#6EE7B7","#34D399","#10B981","#059669","#047857","#065F46","#064E3B","#022C22"],teal:["#F0FDFA","#CCFBF1","#99F6E4","#5EEAD4","#2DD4BF","#14B8A6","#0D9488","#0F766E","#115E59","#134E4A","#042F2E"],cyan:["#ECFEFF","#CFFAFE","#A5F3FC","#67E8F9","#22D3EE","#06B6D4","#0891B2","#0E7490","#155E75","#164E63","#083344"],sky:["#F0F9FF","#E0F2FE","#BAE6FD","#7DD3FC","#38BDF8","#0EA5E9","#0284C7","#0369A1","#075985","#0C4A6E","#082F49"],blue:["#EFF6FF","#DBEAFE","#BFDBFE","#93C5FD","#60A5FA","#3B82F6","#2563EB","#1D4ED8","#1E40AF","#1E3A8A","#172554"],indigo:["#EEF2FF","#E0E7FF","#C7D2FE","#A5B4FC","#818CF8","#6366F1","#4F46E5","#4338CA","#3730A3","#312E81","#1E1B4B"],violet:["#F5F3FF","#EDE9FE","#DDD6FE","#C4B5FD","#A78BFA","#8B5CF6","#7C3AED","#6D28D9","#5B21B6","#4C1D95","#2E1065"],purple:["#FAF5FF","#F3E8FF","#E9D5FF","#D8B4FE","#C084FC","#A855F7","#9333EA","#7E22CE","#6B21A8","#581C87","#3B0764"],fuchsia:["#FDF4FF","#FAE8FF","#F5D0FE","#F0ABFC","#E879F9","#D946EF","#C026D3","#A21CAF","#86198F","#701A75","#4A044E"],pink:["#FDF2F8","#FCE7F3","#FBCFE8","#F9A8D4","#F472B6","#EC4899","#DB2777","#BE185D","#9D174D","#831843","#500724"],rose:["#FFF1F2","#FFE4E6","#FECDD3","#FDA4AF","#FB7185","#F43F5E","#E11D48","#BE123C","#9F1239","#881337","#4C0519"]})),J=t=>{const e=String(t||"").trim();if(!e)return"";const r=e.split(":");return r[r.length-1]||e},Z=(t,e)=>{let r="",n="";const o=e+"-[";if(t.startsWith(o)){const e=t.indexOf("]");if(e<0)return null;r=t.slice(o.length,e),n=t.slice(e+1).startsWith("/")?t.slice(e+2):""}else if(t.startsWith(e+"-")){const o=t.slice(e.length+1),i=o.indexOf("/");r=(t=>{if(K.has(t))return K.get(t);const e=String(t||"").match(/^([a-z]+)-(50|100|200|300|400|500|600|700|800|900|950)$/);if(!e)return"";const r=Y.get(e[1]),n=Q.indexOf(e[2]);return r&&n>=0?r[n]:""})(i>=0?o.slice(0,i):o),n=i>=0?o.slice(i+1):""}if(!r||/^-?\\d/.test(r)||/px\\]?$/.test(r))return null;const i=(t=>{const e=String(t||"").replace(/^\\[|\\]$/g,"").trim();if(!e)return;const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r>1?r/100:r)):void 0})(n);return void 0!==i&&r.startsWith("#")?((t,e)=>{const r=String(t||"").trim().replace(/^#/,""),n=3===r.length?r.split("").map(t=>t+t).join(""):r.slice(0,6);return/^[0-9a-f]{6}$/i.test(n)?"rgba("+Number.parseInt(n.slice(0,2),16)+", "+Number.parseInt(n.slice(2,4),16)+", "+Number.parseInt(n.slice(4,6),16)+", "+e+")":t})(r,i):r},tt=t=>Z(t,"ring"),et=t=>Z(t,"border"),rt=t=>Z(t,"bg"),nt=t=>{if($.has(t))return $.get(t);const e=t.match(/^ring-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},ot=t=>{if(X.has(t))return X.get(t);const e=t.match(/^border-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},it=t=>{const e=String(t||"").match(/^border-([trblxy])(?:-(0|2|4|8|\\[(-?\\d*\\.?\\d+)px\\]))?$/);if(!e)return null;const r=e[1],n=e[2],o=e[3],i=void 0!==o?Number.parseFloat(o):n?Number.parseFloat(n):1;return!Number.isFinite(i)||i<0?null:{sides:"x"===r?["left","right"]:"y"===r?["top","bottom"]:"t"===r?["top"]:"r"===r?["right"]:"b"===r?["bottom"]:["left"],width:i}},at=t=>{const e=String(t||"").match(/^border-([trblxy])-(.+)$/);if(!e)return null;const r=e[2];if(/^(?:0|2|4|8|\\[-?\\d*\\.?\\d+px\\])$/.test(r))return null;const n=et("border-"+r);if(!n)return null;const o=e[1];return{sides:"x"===o?["left","right"]:"y"===o?["top","bottom"]:"t"===o?["top"]:"r"===o?["right"]:"b"===o?["bottom"]:["left"],colorSource:n}},st=t=>{if("rounded-full"===t)return{full:!0};if(V.has(t))return{px:V.get(t)};const e=t.match(/^rounded-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return null;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?{px:Math.max(0,r)}:null},lt=t=>{if(G.has(t))return G.get(t);const e=t.match(/^font-\\[([1-9]\\d{0,2})\\]$/);if(!e)return;const r=Number.parseInt(e[1],10);return Number.isFinite(r)?Math.max(1,Math.min(1e3,r)):void 0},ct=t=>{const e=String(t?.className||"").split(/\\s+/).filter(Boolean);let r;for(const t of e){const e=lt(J(t));void 0!==e&&(r=e)}return r},dt=t=>{const e=String(t.fontWeight||"").trim().toLowerCase();if(!e)return;if("normal"===e)return 400;if("bold"===e)return 700;const r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:void 0},ht=t=>{const e=t?.style?.fontWeight;if(e)return dt({fontWeight:e})},ut=(t,e,r)=>{const n=String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"");if(!n)return null;const o=Number.parseFloat(e.fontSize||"16")||16,i=ht(r),a=ct(r),s=dt(e),l=i||a||s||400,c=String(e.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",d=_(e);return{text:n,fontSize:Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_12__,o*N)),fontFace:c,color:d.color,bold:l>=600||/^H[1-6]$/i.test(r?.tagName||""),italic:"italic"===e.fontStyle||"oblique"===e.fontStyle,underline:String(e.textDecoration||"").includes("underline"),strike:String(e.textDecoration||"").includes("line-through")}},gt=t=>{for(;t.length>0&&(t[0].text=String(t[0].text||"").trimStart(),!t[0].text);)t.shift();for(;t.length>0;){const e=t[t.length-1];if(e.text=String(e.text||"").trimEnd(),e.text)break;t.pop()}return t.filter(t=>t.text)},ft=(t,e)=>t&&e&&t.fontSize===e.fontSize&&t.fontFace===e.fontFace&&t.color===e.color&&Boolean(t.bold)===Boolean(e.bold)&&Boolean(t.italic)===Boolean(e.italic)&&Boolean(t.underline)===Boolean(e.underline)&&Boolean(t.strike)===Boolean(e.strike),mt=(t,e)=>{if(!t||kt(e))return;const r=[],n=(t,e,o)=>{if(t.nodeType===Node.TEXT_NODE){const n=ut(t.textContent,o,e);return void(n&&r.push(n))}if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t;if(i.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const a=window.getComputedStyle(i);i.childNodes.forEach(t=>n(t,i,a))};if(t.childNodes.forEach(r=>n(r,t,e)),gt(r),0===r.length)return;const o=h(r.map(t=>t.text).join("")),i=h(t.innerText||t.textContent);if(!o||o!==i)return;const a=ut(i,e,t);return r.some(t=>!ft(t,a))?r:void 0},pt=(t,e)=>{if(!e||!e.text)return;const r=t[t.length-1];ft(r,e)?r.text+=e.text:t.push({...e})},bt=(t,e)=>{if(!t||kt(e))return[];const r=h(t.innerText||t.textContent);if(!r||r.length>Ct)return[];const n=[];let o=null;const i=(t,e,r)=>{if(t.nodeType===Node.TEXT_NODE){const i=String(t.textContent||"");for(let a=0;a<i.length;a+=1){const s=i[a];if(!s)continue;const l=document.createRange();l.setStart(t,a),l.setEnd(t,a+1);const c=l.getBoundingClientRect();if(l.detach(),c.width<.5||c.height<.5){o&&/\\s/.test(s)&&(pt(o.runs,ut(s,r,e)),o.text+=s);continue}let d=n.find(t=>Math.abs(t.top-c.top)<Math.max(3,.3*c.height));d||(d={top:c.top,left:c.left,right:c.right,bottom:c.bottom,text:"",runs:[]},n.push(d)),pt(d.runs,ut(s,r,e)),d.text+=s,d.left=Math.min(d.left,c.left),d.right=Math.max(d.right,c.right),d.bottom=Math.max(d.bottom,c.bottom),o=d}return}if(t.nodeType!==Node.ELEMENT_NODE)return;const a=t;if(a.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const s=window.getComputedStyle(a);a.childNodes.forEach(t=>i(t,a,s))};t.childNodes.forEach(r=>i(r,t,e));const a=n.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>{gt(t.runs);const e=h(t.runs.map(t=>t.text).join(""));return e?{text:e,rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top},runs:t.runs}:null}).filter(Boolean);return h(a.map(t=>t.text).join(""))===r?a:[]},xt=t=>{const e={ringWidthPx:void 0,ringColorSource:"",ringInset:!1,borderWidthPx:void 0,borderSideWidthPx:{left:void 0,top:void 0,right:void 0,bottom:void 0},borderSideColorSource:{left:"",top:"",right:"",bottom:""},borderColorSource:"",borderDash:void 0,backgroundColorSource:"",radiusPx:void 0,radiusFull:!1},r=String(t?.className||"").split(/\\s+/).filter(Boolean);for(const t of r){const r=J(t);if("ring-inset"===r){e.ringInset=!0;continue}"border-dashed"===r||"border-dotted"===r?e.borderDash="dash":"border-solid"===r&&(e.borderDash="solid");const n=nt(r);void 0!==n&&(e.ringWidthPx=n);const o=tt(r);o&&(e.ringColorSource=o);const i=ot(r);void 0!==i&&(e.borderWidthPx=i);const a=it(r);a&&a.sides.forEach(t=>{e.borderSideWidthPx[t]=a.width});const s=at(r);s&&s.sides.forEach(t=>{e.borderSideColorSource[t]=s.colorSource});const l=et(r);l&&(e.borderColorSource=l);const c=rt(r);c&&(e.backgroundColorSource=c);const d=st(r);d?.full?e.radiusFull=!0:void 0!==d?.px&&(e.radiusPx=d.px)}return e},Ft=(t,e,r)=>{let n=null;if(t.boxShadow&&"none"!==t.boxShadow)for(const r of(t=>{const e=[];let r="",n=0;for(const o of String(t||""))"("===o?n+=1:")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(r.trim()&&e.push(r.trim()),r=""):r+=o;return r.trim()&&e.push(r.trim()),e})(t.boxShadow)){if(/\\binset\\b/i.test(r))continue;const t=r.match(/rgba?\\([^)]*\\)|#[0-9a-fa-f]{3,8}/i);if(!t)continue;const o=t[0],i=rgbToHex(o);if(!i||B(o)*e<.04)continue;const a=r.replace(o," ").match(/-?\\d*\\.?\\d+(?:px)?/g)?.map(t=>Number.parseFloat(t))||[];if(a.length<4)continue;const[s,l,c,d]=a;Math.abs(s)>.5||Math.abs(l)>.5||Math.abs(c)>.5||!Number.isFinite(d)||d<=.5||(!n||d>n.w)&&(n={w:d,c:i,colorSource:o})}if(r?.ringInset)return n;if(r?.ringWidthPx>0){const t=r.ringColorSource||n?.colorSource||"rgba(59, 130, 246, 0.5)",o=rgbToHex(t);if(o&&B(t)*e>=.04){const e={w:r.ringWidthPx,c:o,colorSource:t};if(!n||e.w>n.w)return e}}return n},Et=Array.from(x.querySelectorAll("section,main,article,header,footer,aside,div,figure,figcaption,table,td,th,span")),wt=[],St=S*M*.005;for(const t of Et){if(wt.length>=i)continue;if(b(t))continue;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:a,h:s}=P(t);if(!k(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;const l=(e.backgroundImage||"").trim();if(l&&"none"!==l)continue;if(e.clipPath&&"none"!==e.clipPath||e.maskImage&&"none"!==e.maskImage||e.webkitMaskImage&&"none"!==e.webkitMaskImage||e.mixBlendMode&&"normal"!==e.mixBlendMode||e.backgroundBlendMode&&"normal"!==e.backgroundBlendMode||e.backdropFilter&&"none"!==e.backdropFilter)continue;const c=Number(e.opacity||"1");if(c<.15)continue;const d=xt(t),u=rgbToHex(e.backgroundColor)?e.backgroundColor:d.backgroundColorSource,g=rgbToHex(u),f=()=>{const t=[{side:"left",w:e.borderLeftWidth,c:e.borderLeftColor,s:e.borderLeftStyle},{side:"top",w:e.borderTopWidth,c:e.borderTopColor,s:e.borderTopStyle},{side:"right",w:e.borderRightWidth,c:e.borderRightColor,s:e.borderRightStyle},{side:"bottom",w:e.borderBottomWidth,c:e.borderBottomColor,s:e.borderBottomStyle}],r=[],n=(t,e=!1)=>{const n=r.findIndex(e=>e.side===t.side);n>=0?e&&(r[n]=t):r.push(t)},o=t=>{const e=r.findIndex(e=>e.side===t);e>=0&&r.splice(e,1)};for(const e of t){const t=Number.parseFloat(e.w||"0")||0;if(t<=0||"none"===e.s)continue;const r=rgbToHex(e.c);r&&n({side:e.side,w:t,c:r,colorSource:e.c,dash:"dashed"===e.s||"dotted"===e.s?"dash":"solid"})}if(d.borderWidthPx>0){const t=d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",r=rgbToHex(t);if(r&&B(t)*c>=.04)for(const e of["left","top","right","bottom"])n({side:e,w:d.borderWidthPx,c:r,colorSource:t,dash:d.borderDash||"solid"},!0)}for(const t of["left","top","right","bottom"]){const i=d.borderSideWidthPx?.[t],a=d.borderSideColorSource?.[t];if(void 0===i&&!a)continue;if(void 0!==i&&i<=0){o(t);continue}const s=r.find(e=>e.side===t),l=i>0?i:s?.w;if(!(l>0))continue;const h=a||s?.colorSource||d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",u=rgbToHex(h);!u||B(h)*c<.04||n({side:t,w:l,c:u,colorSource:h,dash:s?.dash||d.borderDash||"solid"},!0)}return r},m=f(),p=(()=>{let t=null;for(const e of m)(!t||e.w>t.w)&&(t=e);if(d.borderWidthPx>0){const r=d.borderColorSource||t?.colorSource||e.borderColor||"rgba(229, 231, 235, 1)",n=rgbToHex(r);if(n&&B(r)*c>=.04){const e={w:d.borderWidthPx,c:n,colorSource:r,dash:d.borderDash||"solid"};(!t||e.w>t.w)&&(t=e)}}const r=Ft(e,c,d);return r&&(!t||r.w>t.w)?{...r,dash:"solid"}:t})(),x=(t,e)=>t&&e&&t.c===e.c&&t.dash===e.dash&&Math.abs(t.w-e.w)<.1&&Math.abs(D(t.colorSource,c)-D(e.colorSource,c))<=1,F=4===m.length&&m.every(t=>x(t,m[0])),E=m.length>0&&!F&&!d.ringWidthPx,w=E?null:p,S=w?w.c:"",M=w?w.w:0,N=Boolean(p),_=Boolean(w),I=Math.min(r.width,r.height),H=Number.parseFloat(e.borderTopLeftRadius||e.borderRadius||"0")||(d.radiusFull?I/2:d.radiusPx||0),W=Boolean(e.boxShadow&&"none"!==e.boxShadow),O=i=>{if(!i)return null;const l=.001;let d=n,h=o,u=a,g=l;return"bottom"===i.side?h=A(r.bottom-i.w/2):"top"===i.side?h=A(r.top+i.w/2):"right"===i.side?(d=y(r.right-i.w/2),u=l,g=s):(d=y(r.left+i.w/2),u=l,g=s),{x:d,y:h,w:Math.max(l,u),h:Math.max(l,g),order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",rotate:v(e),border:{color:i.c,widthPt:.75*i.w,transparency:D(i.colorSource,c),dash:i.dash||"solid"}}},j=!g&&!H&&!W,z=(t,e)=>m.map(t=>t.side).sort().join("|")===[t,e].sort().join("|"),U=j&&2===m.length&&void 0!==v(e)&&r.width<=42&&r.height<=42&&(z("top","right")||z("right","bottom")||z("bottom","left")||z("left","top")),$=(()=>{if(!U)return[];const e=m[0];if(!e)return[];const n=r.left+.18*r.width,o=r.top+.18*r.height,i=.58*r.width,a=.32*r.height,s={order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",border:{color:e.c,widthPt:.75*e.w,transparency:D(e.colorSource,c),dash:e.dash||"solid"}};return[{...s,x:y(n),y:A(o),w:Math.max(.001,C(i)),h:Math.max(.001,T(a))},{...s,x:y(n),y:A(o+.32*r.height),w:Math.max(.001,C(i)),h:Math.max(.001,T(a)),flipV:!0}]})();if($.length>0){if(wt.length+$.length>i)continue;$.forEach(t=>wt.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}const X=E?m.map(t=>O(t)).filter(Boolean):[];if(X.length>0&&j){if(wt.length+X.length>i)continue;X.forEach(t=>wt.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}if(!(g&&(g!==L||H||W)||N))continue;const V=Boolean(h(t.innerText||t.textContent)),G=g&&g!==L&&(H>0||W||V&&r.width>=12&&r.height>=12),K=t.parentElement?String(window.getComputedStyle(t.parentElement).display||""):"",Q=g&&g!==L&&!N&&!H&&!W&&/grid/i.test(K)&&!h(t.innerText||t.textContent)&&r.width>=8&&r.height>=8,Y=g&&g!==L&&!H&&!W&&!h(t.innerText||t.textContent)&&(r.width>=24&&r.height>=2&&r.height<12||r.height>=24&&r.width>=2&&r.width<12);if(!N&&!G&&!Q&&r.width*r.height<St)continue;if((r.width<12||r.height<12)&&!Y)continue;if(wt.length+1+X.length>i)continue;const J=Math.max(0,Math.min(H,I/2)),Z=J>0&&I>0?Math.max(0,Math.min(5e4,Math.round(J/I*1e5))):0,tt=J>0&&Math.abs(r.width-r.height)<1.5&&J>=I/2-.5?"ellipse":J>0?"roundRect":"rect";wt.push({x:n,y:o,w:a,h:s,order:R(t),paintId:q(t),fill:g,transparency:g?D(u,c):100,radius:H,radiusAdj:Z,shapeType:tt,rotate:v(e),border:_?{color:S,widthPt:.75*M,transparency:D(w.colorSource||e.borderColor,c),dash:w.dash||"solid"}:void 0}),X.length>0&&X.forEach(t=>wt.push(t)),t.setAttribute("data-pptx-extracted-shape","1")}const Mt=[],yt=new Set,At=new Set,Ct=180,Tt=t=>{for(const e of At)if(e.contains(t))return!0;return!1},Nt=(t,e,n,o,i=!1)=>{if(i)return Math.max(.12,Math.min(r-t,1.1*e));const a=/[\\u3400-\\u9fff\\uf900-\\ufaff]/.test(o)?1.15:1.08,s=Math.max(.08,Math.min(.3,n/72*.2));return Math.max(.12,Math.min(r-t,e*a+s))},Bt=(t,e)=>{const r=Math.max(.02,Math.min(.1,e/72*.08));return Math.max(.06,1.08*t+r)},Dt=t=>{if(!t.letterSpacing||"normal"===t.letterSpacing)return 0;const e=Number.parseFloat(t.letterSpacing);return Number.isFinite(e)?e:0},_t=(t,e)=>{const r=Number.parseFloat(t[e]||"0")||0;return Math.max(0,Math.min(72,r*N))},vt=t=>{const e=Number.parseFloat(String(t||"0"));return Number.isFinite(e)?Math.max(0,e):0},Lt=t=>{if(!t||"LI"!==String(t.tagName||"").toUpperCase())return;const e=t.parentElement?.closest?.("ol,ul");if(!e)return;if("none"===String(window.getComputedStyle(t).listStyleType||""))return;let r=0,n=t.parentElement;for(;n&&n!==x;)"OL"!==n.tagName&&"UL"!==n.tagName||(r+=1),n=n.parentElement;const o=Math.max(0,r-1);if("OL"===String(e.tagName||"").toUpperCase()){const r=Number.parseInt(t.getAttribute("value")||"",10);if(Number.isFinite(r)&&r>0)return{type:"number",level:o,startAt:r};const n=Number.parseInt(e.getAttribute("start")||"1",10)||1,i=Array.from(e.children||[]).filter(t=>"LI"===t.tagName).indexOf(t);return{type:"number",level:o,startAt:Math.max(1,n+Math.max(0,i))}}return{type:"bullet",level:o}},kt=t=>/vertical/i.test(String(t.writingMode||"")),Pt=t=>{const e=_(t);return[e.color,Math.round(100*e.opacity),String(t.fontSize||""),String(t.fontWeight||""),String(t.fontStyle||""),String(t.textDecorationLine||t.textDecoration||"")].join("|")},It=(t,e)=>{const r=Pt(e),n=Array.from(t.children||[]);for(const t of n){if(!h(t.innerText||t.textContent)||t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;const n=window.getComputedStyle(t),o=t.getBoundingClientRect();if(k(t,n,o)){if(Pt(n)!==r)return!0;if(It(t,e))return!0}}return!1},Rt=(t,e,n,i,a=!1,s={})=>{if(Mt.length>=o)return;if(!(t=a?g(t):u(t)))return;if(!k(i,n,e))return;if(e.width<2||e.height<2)return;const l=kt(n);if(l){if(!(t=(t=>{const e=h(t).replace(/\\s+/g,"");return e?Array.from(e).join("\\n"):""})(t)))return;a=!1}const c=Lt(i),f=s.useElementInsets&&!l?((t,e)=>{const r=vt(t.paddingLeft)+vt(t.borderLeftWidth),n=vt(t.paddingRight)+vt(t.borderRightWidth),o=vt(t.paddingTop)+vt(t.borderTopWidth),i=vt(t.paddingBottom)+vt(t.borderBottomWidth),a=Math.max(0,.45*e.width),s=Math.max(0,.45*e.height);return{paddingLeft:C(Math.min(r,a)),paddingRight:C(Math.min(n,a)),paddingTop:T(Math.min(o,s)),paddingBottom:T(Math.min(i,s))}})(n,e):void 0,m=Boolean(f&&(f.paddingLeft||f.paddingRight||f.paddingTop||f.paddingBottom)),p=Array.isArray(s.runs)?s.runs.filter(t=>t&&h(t.text)):void 0;if(a&&!l&&!c&&!m&&!p?.length){const r=((t,e,r)=>{if(!d||!t||e.width<4||e.height<4)return null;if(v(r))return null;const n=Number.parseFloat(r.fontSize||"16")||16,o=((t,e)=>{const r=Number.parseFloat(t.lineHeight||"");return Number.isFinite(r)&&r>0?r:1.18*e})(r,n);try{const i=d.prepareWithSegments(t,((t,e)=>{const r=Number.parseInt(t.fontWeight||"400",10)||400,n="italic"===t.fontStyle||"oblique"===t.fontStyle?"italic":"",o=String(t.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",i=/^[a-z0-9 -]+$/i.test(o)?o:\'"\'+o.replace(/"/g,"")+\'"\';return[n,String(r),e.toFixed(2)+"px",i].filter(Boolean).join(" ")})(r,n),{whiteSpace:"pre-wrap",letterSpacing:Dt(r)}),a=d.layoutWithLines(i,Math.max(1,e.width),o);return a?.lines?.length?{lineHeightPx:o,lines:a.lines.map((t,n)=>{const i=h(String(t.text||""));if(!i)return null;const a=Math.max(1,Math.min(e.width,Number(t.width)||e.width));let s=e.left;return"center"===r.textAlign?s+=Math.max(0,(e.width-a)/2):"right"!==r.textAlign&&"end"!==r.textAlign||(s+=Math.max(0,e.width-a)),{text:i,rect:{left:s,top:e.top+n*o,right:s+a,bottom:e.top+(n+1)*o,width:a,height:o}}}).filter(Boolean)}:null}catch(t){return null}})(t,e,n);if(r&&r.lines.length>0)return void r.lines.forEach(t=>Rt(t.text,t.rect,n,i,!1))}const b=((t,e)=>[t.toLowerCase(),Math.round(e.left),Math.round(e.top),Math.round(e.width),Math.round(e.height)].join("|"))(t,e);if(yt.has(b))return;yt.add(b);const x=Number.parseFloat(n.fontSize||"16")||16,F=Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_13__,x*N)),E=ht(i),w=ct(i),S=dt(n),M=E||w||S||400,B=String(n.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",D=y(e.left),L=_(n),P=((t,e,r)=>{if(e)return"center";const n=String(t.textAlign||"");if("center"===n)return"center";if("right"===n||"end"===n)return"right";if(r&&"justify"===n)return"justify";const o=String(t.display||"");if(o.includes("flex")||o.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/row-reverse/i.test(e),o=String(r?t.alignItems||"":t.justifyContent||"");if("center"===o)return"center";if(!r&&("start"===o||"flex-start"===o))return n?"right":"left";if("end"===o||"flex-end"===o||"right"===o)return n?"left":"right"}return"left"})(n,l,a),I=(t=>{const e=String(t.verticalAlign||"");if("middle"===e)return"middle";if("bottom"===e||"text-bottom"===e)return"bottom";const r=String(t.display||"");if(r.includes("flex")||r.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/column-reverse/i.test(e),o=/column/i.test(e)?String(t.justifyContent||""):String(t.alignItems||"");if("center"===o)return"middle";if(r&&("start"===o||"flex-start"===o))return n?"bottom":"top";if("end"===o||"flex-end"===o)return n?"top":"bottom"}return"top"})(n);Mt.push({text:t,x:D,y:A(e.top),w:l?Math.max(.12,C(e.width)+Math.max(.02,F/72*.08)):m||"left"!==P?Math.max(.12,Math.min(r-D,C(e.width))):Nt(D,C(e.width),F,t,a),h:l?Math.max(.12,T(e.height)):m?Math.max(.08,T(e.height)):a?Math.max(.12,T(e.height)+Math.max(.02,F/72*.08)):"top"!==I?Math.max(.08,T(e.height)):Bt(T(e.height),F),fontSize:F,fontFace:B,color:L.color,bold:M>=600||/^H[1-6]$/i.test(i.tagName),italic:"italic"===n.fontStyle||"oblique"===n.fontStyle,underline:String(n.textDecoration||"").includes("underline"),strike:String(n.textDecoration||"").includes("line-through"),align:P,opacity:L.opacity,rotate:v(n),order:R(i),paintId:q(i),paragraphSpacingBefore:_t(n,"marginTop"),paragraphSpacingAfter:_t(n,"marginBottom"),verticalAlign:I,...m?f:{},bullet:c,lineSpacing:n.lineHeight&&"normal"!==n.lineHeight?Math.max(1.08*F,(Number.parseFloat(n.lineHeight)||0)*N):l?1.02*F:t.includes("\\n")?1.18*F:void 0,charSpacing:n.letterSpacing&&"normal"!==n.letterSpacing?(Number.parseFloat(n.letterSpacing)||0)*N:void 0,...p?.length?{runs:p}:{},wrap:a})},Ht=(t,e,r)=>{if(!r)return!1;if(t.querySelector?.(".katex"))return!1;if(t.closest?.("[data-pptx-formula-block]"))return!1;if((t=>Boolean(t.querySelector(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,div,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,.katex\')))(t))return!1;if(["SCRIPT","STYLE","NOSCRIPT","SVG","CANVAS","VIDEO","IFRAME","MATH"].includes(t.tagName))return!1;const n=t.tagName;if(/^H[1-6]$/.test(n)||["P","LI","BLOCKQUOTE","TD","TH","FIGCAPTION"].includes(n))return!0;if(It(t,e))return!1;if(t.matches(\'[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title\'))return!0;if(!["block","flex","grid","table-cell","list-item"].includes(e.display)&&!["absolute","fixed"].includes(e.position)||r.length<6||r.length>180)return!1;const o=Array.from(t.children);if(o.length>=2){let t=0,e=0;for(const r of o){if(r.closest("script, style, noscript"))continue;const n=window.getComputedStyle(r);if("none"===n.display||"hidden"===n.visibility||Number(n.opacity||"1")<.04)continue;e++;const o=rgbToHex(n.backgroundColor);o&&o!==L&&t++}if(e>=2&&t===e)return!1}return!0},Wt=(t,e,r)=>{if(Mt.length>=o)return;if(t.nodeType===Node.TEXT_NODE)return void((t,e,r)=>{if(Mt.length>=o)return;if(r&&Tt(r))return;if(r&&r.closest?.(".katex, .katex-mathml, [data-pptx-formula-block]"))return;if(r&&b(r))return;const n=u(t.textContent);if(!n)return;const i=document.createRange();i.selectNode(t);const a=i.getBoundingClientRect(),s=Array.from(i.getClientRects());i.detach();const l=Number.parseFloat(e.fontSize||"16")||16;if(s.length>1||a.height>1.7*l){const o=(t=>{const e=String(t.textContent||"");if(e.length>Ct)return[];const r=[];let n=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(!i)continue;const a=document.createRange();a.setStart(t,o),a.setEnd(t,o+1);const s=a.getBoundingClientRect();if(a.detach(),s.width<.5||s.height<.5){n&&/\\s/.test(i)&&(n.text+=i);continue}let l=r.find(t=>Math.abs(t.top-s.top)<Math.max(3,.3*s.height));l||(l={top:s.top,text:"",left:s.left,right:s.right,bottom:s.bottom},r.push(l)),l.text+=i,l.left=Math.min(l.left,s.left),l.right=Math.max(l.right,s.right),l.bottom=Math.max(l.bottom,s.bottom),n=l}return r.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>({text:h(t.text),rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top}})).filter(t=>t.text)})(t);return o.length>1?void o.forEach(t=>Rt(t.text,t.rect,e,r,!1)):void Rt(n,a,e,r,!0)}Rt(n,a,e,r,!1)})(t,e,r);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(At.has(n))return;if(n.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;if(b(n))return;const i=window.getComputedStyle(n),a=n.getBoundingClientRect();if(!k(n,i,a))return;const s=!["block","flex","grid","table","list-item"].includes(i.display)&&!["absolute","fixed","sticky"].includes(i.position)||(t=>["SPAN","B","STRONG","I","EM","U","FONT","SUB","SUP","A","SMALL","BIG","MARK"].includes(t.tagName))(n)?i||e:i;n.childNodes.forEach(t=>Wt(t,s,n))};(()=>{const t=Array.from(x.querySelectorAll(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,div\'));for(const e of t){if(Mt.length>=o)break;if(e.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;if(b(e))continue;if(Tt(e))continue;const t=window.getComputedStyle(e),r=e.getBoundingClientRect(),n=g(e.innerText||e.textContent);if(!k(e,t,r))continue;if(!Ht(e,t,n))continue;const i=Number.parseFloat(t.fontSize||"16")||16,a=r.height<=1.55*i,s=i>=28||/^H[1-6]$/.test(e.tagName),l=mt(e,t),c=l?.length?bt(e,t):[];c.length>1&&!Lt(e)?(c.forEach(r=>{Rt(r.text,r.rect,t,e,!1,{runs:r.runs})}),At.add(e),e.setAttribute("data-pptx-extracted-text","1")):(Rt(n,r,t,e,!(a&&s),{useElementInsets:!0,runs:l}),At.add(e),e.setAttribute("data-pptx-extracted-text","1"))}})(),x.childNodes.forEach(t=>{const e=window.getComputedStyle(x);Wt(t,e,x)});const Ot=t=>/^data:image\\/(?:png|jpeg|jpg|gif);base64,/i.test(String(t||"")),jt=async(t,e,r)=>t?await new Promise(n=>{const o=t instanceof HTMLImageElement?t:new Image;let i="";const a=()=>{i&&URL.revokeObjectURL(i)},s=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,s=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=document.createElement("canvas");l.width=Math.max(1,Math.min(4096,Math.round(t*s))),l.height=Math.max(1,Math.min(4096,Math.round(i*s)));const c=l.getContext("2d");if(!c)return a(),void n("");c.clearRect(0,0,l.width,l.height),c.drawImage(o,0,0,l.width,l.height),a(),n(l.toDataURL("image/png"))}catch(t){a(),n("")}};if(t instanceof HTMLImageElement)return t.complete&&(t.naturalWidth||t.width)?void s():(t.addEventListener("load",s,{once:!0}),void t.addEventListener("error",()=>n(""),{once:!0}));o.onload=s,o.onerror=()=>{a(),n("")},t instanceof Blob?(i=URL.createObjectURL(t),o.src=i):(o.crossOrigin="anonymous",o.src=String(t))}):"",zt=async(t,e,r)=>{const n=String(t||"").trim();if(!n)return"";if(Ot(n))return n;if(/^data:image\\//i.test(n))return await jt(n,e,r);try{return await(async(t,e,r)=>{try{const n=await fetch(t);if(!n.ok)return"";const o=await n.blob(),i=String(o.type||"").toLowerCase();return/^image\\/(?:png|jpeg|jpg|gif)$/.test(i)?await(async t=>await new Promise(e=>{const r=new FileReader;r.onloadend=()=>e(String(r.result||"")),r.onerror=()=>e(""),r.readAsDataURL(t)}))(o):await jt(o,e,r)}catch{return""}})(new URL(n,document.baseURI).toString(),e,r)}catch{return""}},Ut=t=>{try{return t.width&&t.height?t.toDataURL("image/png"):""}catch{return""}},qt=async(t,e,r)=>{if(!t.currentSrc&&!t.src)return"";try{const n=t.currentSrc||t.src;return Ot(n)?n:await jt(t,e,r)||await zt(n,e,r)}catch{return await zt(t.currentSrc||t.src,e,r)}},$t=async(t,e,r)=>t?await new Promise(n=>{const o=new Image;o.onload=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,a=Math.max(1,Math.min(2,window.devicePixelRatio||1)),s=document.createElement("canvas");s.width=Math.max(1,Math.min(4096,Math.round(t*a))),s.height=Math.max(1,Math.min(4096,Math.round(i*a)));const l=s.getContext("2d");if(!l)return void n("");l.clearRect(0,0,s.width,s.height),l.drawImage(o,0,0,s.width,s.height),n(s.toDataURL("image/png"))}catch(t){n("")}},o.onerror=()=>n(""),o.src=t}):"",Xt=async(t,e,r)=>Ot(t)?l<=128||t.length<=l?t:await new Promise(n=>{const o=new Image;o.onload=()=>{try{const i=o.naturalWidth||o.width||Number(e)||1,a=o.naturalHeight||o.height||Number(r)||1,s=Math.min(1,.9*Math.sqrt(l/t.length)),c=[s,.72*s,.5*s].filter((t,e,r)=>t>.08&&r.indexOf(t)===e);for(const t of c){const e=document.createElement("canvas");e.width=Math.max(1,Math.min(4096,Math.round(i*t))),e.height=Math.max(1,Math.min(4096,Math.round(a*t)));const r=e.getContext("2d");if(!r)continue;r.clearRect(0,0,e.width,e.height),r.drawImage(o,0,0,e.width,e.height);const s=e.toDataURL("image/png");if(s.length<=l)return void n(s);const c=e.toDataURL("image/jpeg",.9);if(c.length<=l)return void n(c)}}catch(t){}n("")},o.onerror=()=>n(""),o.src=t}):"",Vt=async(t,e,r)=>{try{const n=t.cloneNode(!0),o=(t,e)=>{if(!t||!e||t.nodeType!==Node.ELEMENT_NODE||e.nodeType!==Node.ELEMENT_NODE)return;const r=window.getComputedStyle(t),n=r.color||"";!n||e.getAttribute("color")&&"currentColor"!==e.getAttribute("color")||e.setAttribute("color",n),["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","letter-spacing","text-anchor","dominant-baseline","visibility","display"].forEach(t=>{const o=e.getAttribute(t),i=r.getPropertyValue(t)||r[t]||"";o&&"currentColor"!==o||!i||"none"===i?"currentColor"===o&&n&&e.setAttribute(t,n):e.setAttribute(t,i)});const i=Array.from(t.children||[]);Array.from(e.children||[]).forEach((t,e)=>o(i[e],t))};if(o(t,n),n.getAttribute("xmlns")||n.setAttribute("xmlns","http://www.w3.org/2000/svg"),!n.getAttribute("viewBox")&&t.getBBox)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&n.setAttribute("viewBox",[e.x,e.y,e.width,e.height].join(" "))}catch(t){}const i=(new XMLSerializer).serializeToString(n),a=btoa(unescape(encodeURIComponent(i)));return await $t("data:image/svg+xml;base64,"+a,e,r)}catch{return""}};await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));const Gt=[],Kt=Array.from(x.querySelectorAll("img,canvas,svg"));for(const t of Kt){if(Gt.length>=a)break;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!k(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;if(Number(e.opacity||"1")<.15)continue;const l=String(t.tagName||"").toUpperCase(),c="CANVAS"===l?Ut(t):"SVG"===l?await Vt(t,r.width,r.height):await qt(t,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:t.getAttribute("alt")||"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1"))}const Qt=new Set(Gt.map(t=>t.dataUri)),Yt=t=>{const e=String(t||"");if(!e||"none"===e)return[];const r=[],n=/url\\((?:["\']?)(.*?)(?:["\']?)\\)/gi;let o;for(;o=n.exec(e);){const t=String(o[1]||"").trim();t&&!t.startsWith("data:font/")&&r.push(t)}return r},Jt=[];for(const t of x.querySelectorAll("*")){if(Jt.length>=a)break;const e=window.getComputedStyle(t),r=e.backgroundImage||"";0!==Yt(r).length&&1===Yt(r).length&&!/gradient\\(|image-set\\(|cross-fade\\(/i.test(r)&&["auto","auto auto","100% 100%"].includes(String(e.backgroundSize||"").trim())&&/^(?:0(?:px|%)?\\s+)?0(?:px|%)?$/i.test(String(e.backgroundPosition||"").trim())&&"no-repeat"===String(e.backgroundRepeat||"").trim()&&Jt.push({el:t,style:e})}for(const{el:t,style:e}of Jt){if(Gt.length>=a)break;const{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!k(t,e,r))continue;const l=Yt(e.backgroundImage||"")[0];if(!l)continue;const c=/^data:image\\/svg\\+xml;base64,/i.test(l)?await $t(l,r.width,r.height):await zt(l,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Qt.has(d)||(Qt.add(d),Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")))}return(t=>{const e=(()=>{const t=Array.from(z.entries()).filter(([,t])=>t&&t.isConnected);if(0===t.length)return new Map;const e=t.map(([t])=>t),r=new Map(t.map(([t,e])=>[t,O(e)])),n=(t,e)=>((t,e)=>{const r=t?.key||[],n=e?.key||[],o=Math.max(r.length,n.length);for(let t=0;t<o;t+=1){const e=r[t]||{z:0,order:0},o=n[t]||{z:0,order:0};if(e.z!==o.z)return e.z-o.z;if(e.order!==o.order)return e.order-o.order}return(t?.order||0)-(e?.order||0)})(r.get(t),r.get(e));if(!document.elementsFromPoint)return(()=>{const t=new Map;let r=1;return e.slice().sort(n).forEach(e=>{t.set(e,r),r+=1}),t})();const o=new Map(e.map(t=>[t,new Set])),i=new Map(e.map(t=>[t,0])),a=(t,e)=>{if(!(t&&e&&t!==e&&o.has(t)&&i.has(e)))return;const r=o.get(t);r.has(e)||(r.add(e),i.set(e,(i.get(e)||0)+1))},s=t=>{let e=t;for(;e&&e!==document&&e!==document.documentElement;){const t=e.getAttribute?.("data-pptx-paint-id")||"";if(t&&z.has(t))return t;e=e.parentElement}return""},l=(t,e)=>{const r=new Set,n=[];for(const o of document.elementsFromPoint(t,e)){const t=s(o);t&&!r.has(t)&&(r.add(t),n.push(t))}return n},c=t=>{const e=Math.max(0,t.left),r=Math.max(0,t.top),n=Math.min(window.innerWidth,t.right),o=Math.min(window.innerHeight,t.bottom);if(n<=e||o<=r)return[];const i=e+.25*(n-e),a=e+.5*(n-e),s=e+.75*(n-e),l=r+.25*(o-r),c=r+.5*(o-r),d=r+.75*(o-r);return[[a,c],[i,l],[s,l],[i,d],[s,d],[a,l],[a,d],[i,c],[s,c]]},d=document.createElement("style");d.id="ohmyppt-paint-order-pointer-events",d.textContent="[data-pptx-paint-id] { pointer-events: auto !important; }",document.head.appendChild(d);try{for(const[,e]of t){const t=e.getBoundingClientRect();for(const[e,r]of c(t)){const t=l(e,r);for(let e=0;e<t.length;e+=1)for(let r=e+1;r<t.length;r+=1)a(t[r],t[e])}}}finally{d.remove()}const h=e.filter(t=>0===(i.get(t)||0)).sort(n),u=new Map;let g=1;for(;h.length>0;){const t=h.shift();if(t&&!u.has(t)){u.set(t,g),g+=1;for(const e of o.get(t)||[])i.set(e,Math.max(0,(i.get(e)||0)-1)),0===(i.get(e)||0)&&(h.push(e),h.sort(n))}}return e.filter(t=>!u.has(t)).sort(n).forEach(t=>{u.set(t,g),g+=1}),u})();t.forEach(t=>{t&&t.paintId&&(e.has(t.paintId)&&(t.order=e.get(t.paintId)),delete t.paintId)})})([...wt,...Mt,...Gt]),{backgroundColor:L,shapes:wt,texts:Mt,images:Gt,tables:m}})()'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(t.pageHeightPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_4__",String(JSON.stringify(n))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_5__",String(JSON.stringify(s))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_6__",String(JSON.stringify(d))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_7__",String(JSON.stringify(u))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_8__",String(JSON.stringify(Math.ceil(4*h/3)+128))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_9__",String(JSON.stringify(c))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_10__",String("\nconst rgbToHex = (value) => {\n const source = String(value || '').trim();\n if (!source || source === 'transparent') return '';\n if (source.startsWith('#')) {\n const raw = source.slice(1).toUpperCase();\n return raw.length === 3 ? raw.split('').map((part) => part + part).join('') : raw;\n }\n const match = source.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);\n if (!match) return '';\n const alpha = match[4] === undefined\n ? 1\n : String(match[4]).endsWith('%')\n ? Number.parseFloat(match[4]) / 100\n : Number(match[4]);\n if (alpha <= 0.02) return '';\n return [match[1], match[2], match[3]]\n .map((part) => Math.max(0, Math.min(255, Math.round(Number(part) || 0))).toString(16).padStart(2, '0'))\n .join('')\n .toUpperCase();\n};\n")).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_11__",String(g)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_12__",String(l)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_13__",String(l))},exports.generatePptx=t=>r.buildPptxDocument(t),exports.normalizeExtractedHtmlToPptxSlide=(t,e)=>{const r=t&&"object"==typeof t?t:{},n=Array.isArray(r.texts)?r.texts:[],s=Array.isArray(r.shapes)?r.shapes:[],c=Array.isArray(r.images)?r.images:[],m=Array.isArray(r.tables)?r.tables:[],b=n.map(t=>{const e=t&&"object"==typeof t?t:{},r=h(String(e.text||"")).slice(0,1e3);if(!r)return null;const n=Array.isArray(e.runs)?e.runs.map(f).filter(t=>null!==t):[],a=e.bullet&&"object"==typeof e.bullet?e.bullet:null,s="bullet"===a?.type||"number"===a?.type?a.type:void 0,c=s&&a?{type:s,level:Number.isFinite(Number(a.level))?d(Number(a.level),0,8):void 0,startAt:Number.isFinite(Number(a.startAt))?d(Number(a.startAt),1,32767):void 0}:void 0;return{text:r,x:d(Number(e.x)||0,0,o),y:d(Number(e.y)||0,0,i),w:d(Number(e.w)||.4,.1,o),h:d(Number(e.h)||.2,.08,i),fontSize:d(Number(e.fontSize)||12,6,l),fontFace:g(r,String(e.fontFace||"")),color:u(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",opacity:d(Number(e.opacity??1),0,1),rotate:d(Number(e.rotate??0),-360,360),lineSpacing:Number(e.lineSpacing)>0?d(Number(e.lineSpacing),1,200):void 0,charSpacing:Number.isFinite(Number(e.charSpacing))?d(Number(e.charSpacing),-20,200):void 0,paragraphSpacingBefore:Number(e.paragraphSpacingBefore)>0?d(Number(e.paragraphSpacingBefore),0,72):void 0,paragraphSpacingAfter:Number(e.paragraphSpacingAfter)>0?d(Number(e.paragraphSpacingAfter),0,72):void 0,verticalAlign:"middle"===e.verticalAlign||"bottom"===e.verticalAlign?e.verticalAlign:"top",paddingLeft:Number(e.paddingLeft)>0?d(Number(e.paddingLeft),0,2):void 0,paddingRight:Number(e.paddingRight)>0?d(Number(e.paddingRight),0,2):void 0,paddingTop:Number(e.paddingTop)>0?d(Number(e.paddingTop),0,1):void 0,paddingBottom:Number(e.paddingBottom)>0?d(Number(e.paddingBottom),0,1):void 0,bullet:c,runs:n.length>0?n:void 0,wrap:Boolean(e.wrap),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),x=s.map(t=>{const e=t&&"object"==typeof t?t:{},r=u(String(e.fill||""),""),n=e.border&&"object"==typeof e.border?e.border:null,a=u(String(n?.color||""),"");if(!r&&!a)return null;const l="ellipse"===e.shapeType||"roundRect"===e.shapeType||"line"===e.shapeType?e.shapeType:"rect",s="line"===l?.001:.05,c="line"===l?.001:.05;return{x:d(Number(e.x)||0,0,o),y:d(Number(e.y)||0,0,i),w:d(Number(e.w)||s,s,o),h:d(Number(e.h)||c,c,i),fill:r,transparency:d(Number(e.transparency??0),0,100),radius:d(Number(e.radius??0),0,100),radiusAdj:d(Number(e.radiusAdj??0),0,5e4),border:a?{color:a,widthPt:d(Number(n?.widthPt??.75),.1,20),transparency:d(Number(n?.transparency??0),0,100),dash:"dash"===n?.dash?"dash":"solid"}:void 0,shapeType:l,rotate:d(Number(e.rotate??0),-360,360),flipV:Boolean(e.flipV),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),S=c.map(t=>{const e=t&&"object"==typeof t?t:{},r=String(e.dataUri||""),n=(t=>{const e=t.match(/^data:(image\/(?:png|jpeg|jpg|gif));base64,/i);return e?"image/jpg"===e[1].toLowerCase()?"image/jpeg":e[1].toLowerCase():""})(r);return!n||(t=>{const e=t.indexOf(",");if(e<0)return 0;const r=t.slice(e+1).replace(/\s/g,"");if(!r)return 0;const n=r.endsWith("==")?2:r.endsWith("=")?1:0;return Math.max(0,Math.floor(3*r.length/4)-n)})(r)>a?null:{dataUri:r,mimeType:n,x:d(Number(e.x)||0,0,o),y:d(Number(e.y)||0,0,i),w:d(Number(e.w)||.1,.05,o),h:d(Number(e.h)||.1,.05,i),alt:(l=String(e.alt||""),l.replace(/\s+/g," ").replace(/[\u200b-\u200d\ufeff]/g,"").trim()),rotate:d(Number(e.rotate??0),-360,360),opacity:d(Number(e.opacity??1),0,1),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0};var l}).filter(t=>Boolean(t)),F=m.map(p).filter(t=>null!==t);return{title:e,backgroundColor:u(String(r.backgroundColor||""),"FFFFFF"),backgroundImage:void 0,texts:b,shapes:x,images:S,tables:F.length>0?F:void 0,overlayImages:void 0}};
@@ -0,0 +1,5 @@
1
+ export type { HtmlToPptxTextAlign, HtmlToPptxTextRun, HtmlToPptxTextBox, HtmlToPptxShapeType, HtmlToPptxBorder, HtmlToPptxShape, HtmlToPptxImage, HtmlToPptxTableCell, HtmlToPptxTable, HtmlToPptxSlide, HtmlToPptxDocument, HtmlToPptxExtractOptions, HtmlToPptxExtractedSlide, HtmlToPptxEmbeddedFont, HtmlToPptxAnimationType, HtmlToPptxAnimationTrigger, HtmlToPptxAnimationFrom, HtmlToPptxAnimationTrace } from './types.js';
2
+ import type { HtmlToPptxSlide, HtmlToPptxDocument, HtmlToPptxExtractOptions } from './types.js';
3
+ export declare const buildHtmlToPptxExtractScript: (options: HtmlToPptxExtractOptions) => string;
4
+ export declare const normalizeExtractedHtmlToPptxSlide: (raw: unknown, fallbackTitle?: string) => HtmlToPptxSlide;
5
+ export declare const generatePptx: (document: HtmlToPptxDocument) => Uint8Array;
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{createRequire as t}from"module";import{pathToFileURL as e}from"url";import{buildPptxDocument as r}from"./ooxml-writer.js";import"fflate";import"./animation-writer.js";const n=13.333,o=7.5,i=12582912,a=144,l=e(t(import.meta.url).resolve("@chenglou/pretext")).toString(),s=(t,e,r)=>Math.max(e,Math.min(r,t)),c=(t,e="111827")=>{if(!t)return e;const r=t.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(r)?r.split("").map(t=>`${t}${t}`).join(""):/^[0-9A-F]{6}$/.test(r)?r:e},d=t=>{const e=t.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(t=>t.replace(/[^\S\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\n")},u=(t,e)=>{const r=(t=>String(t||"").split(",").map(t=>t.trim().replace(/^["']|["']$/g,"")).find(Boolean)||"Aptos")(e);return(t=>/[\u3400-\u9fff\uf900-\ufaff]/.test(t))(t)&&/^(aptos|arial|helvetica|inter|system-ui|-apple-system|sans-serif|serif)$/i.test(r)?"Microsoft YaHei":r},h=t=>{const e=t.slideWidthIn??n,r=t.slideHeightIn??o,s=Math.max(1,Math.floor(t.maxTextBoxes??360)),c=Math.max(0,Math.floor(t.maxShapes??400)),d=Math.max(0,Math.floor(t.maxImages??80)),u=Math.max(80,Math.floor(t.maxTextChars??1e3)),h=Math.max(0,Math.floor(t.maxImageBytes??i)),g=(t=>{const e=t.slideWidthIn??13.333,r=t.slideHeightIn??7.5;return'(function(){const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,o=t=>{const e=String(t||"").trim();if(!e||"transparent"===e)return"";if(e.startsWith("#")){const t=e.slice(1).toUpperCase();return 3===t.length?t.split("").map(t=>t+t).join(""):t}const o=e.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);return o?(void 0===o[4]?1:String(o[4]).endsWith("%")?Number.parseFloat(o[4])/100:Number(o[4]))<=.02?"":[o[1],o[2],o[3]].map(t=>Math.max(0,Math.min(255,Math.round(Number(t)||0))).toString(16).padStart(2,"0")).join("").toUpperCase():""},n=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const o=String(e[1]);return o.endsWith("%")?Number.parseFloat(o)/100:Number(o)},r=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,i=r.getBoundingClientRect(),l=i.left||0,a=i.top||0,s=i.width||__HTML2PPTX_TEMPLATE_SLOT_2__,d=i.height||__HTML2PPTX_TEMPLATE_SLOT_3__,c=e=>((Number(e)||0)-l)/s*t,u=t=>((Number(t)||0)-a)/d*e,g=e=>(Number(e)||0)/s*t,p=t=>(Number(t)||0)/d*e,h=72*Math.min(t/s,e/d),m=[],f=[],b=r.querySelectorAll("table");for(const t of b){if(t.closest("script, style, noscript, .katex, .katex-mathml"))continue;const e=window.getComputedStyle(t),r=t.getBoundingClientRect();if("none"===e.display||"hidden"===e.visibility)continue;if(r.width<10||r.height<10)continue;const i=t.querySelectorAll("tr");if(!i.length)continue;let l=0;for(const t of i){let e=0;for(const o of t.children)"TD"!==o.tagName&&"TH"!==o.tagName||(e+=Number(o.getAttribute("colspan")||1));l=Math.max(l,e)}if(0===l)continue;const a=new Array(l).fill(0),s=[],d=new Array(i.length).fill(null).map(()=>new Array(l).fill(!1));for(let t=0;t<i.length;t++){const e=i[t],o=e.getBoundingClientRect();s.push(o.height);let n=0;for(const o of e.children){if("TD"!==o.tagName&&"TH"!==o.tagName)continue;const e=Number(o.getAttribute("colspan")||1),r=Number(o.getAttribute("rowspan")||1);for(;n<l&&d[t][n];)n++;if(n>=l)break;const s=o.getBoundingClientRect().width/e;for(let t=0;t<e&&n+t<l;t++)a[n+t]=Math.max(a[n+t],s);for(let o=1;o<r&&t+o<i.length;o++)for(let r=0;r<e&&n+r<l;r++)d[t+o][n+r]=!0;n+=e}}const b=[];for(const t of i){const e=[];for(const r of t.children){if("TD"!==r.tagName&&"TH"!==r.tagName)continue;const t=window.getComputedStyle(r),i=r.getBoundingClientRect(),l=Number(r.getAttribute("rowspan")||1),a=Number(r.getAttribute("colspan")||1),s=String(r.textContent||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),d=Number.parseFloat(t.fontSize||"16")||16,m=Number.parseInt(t.fontWeight||"400",10)||400,f=o(t.backgroundColor),b=n(t.backgroundColor),S=o(t.borderColor),T=Number.parseFloat(t.borderWidth||"0")||0,_=T>0&&"none"!==t.borderStyle&&S;let y="top";const N=String(t.verticalAlign||"");"middle"===N?y="middle":"bottom"===N&&(y="bottom");let w="left";const A=String(t.textAlign||"");"center"===A?w="center":"right"===A||"end"===A?w="right":"justify"===A&&(w="justify"),e.push({text:s,rowspan:l,colspan:a,x:c(i.left),y:u(i.top),w:g(i.width),h:p(i.height),fontSize:Math.max(6,Math.min(144,d*h)),fontFace:String(t.fontFamily||"").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",color:o(t.color)||"111827",bold:m>=600,italic:"italic"===t.fontStyle||"oblique"===t.fontStyle,underline:String(t.textDecoration||"").includes("underline"),strike:String(t.textDecoration||"").includes("line-through"),align:w,valign:y,fill:f||void 0,fillTransparency:f?Math.round(100*(1-b)):void 0,border:_?{color:S,widthPt:.75*T,dash:"dashed"===t.borderStyle?"dash":"solid"}:void 0})}b.push(e)}const S="pptx-table-"+m.length;t.setAttribute("data-pptx-consumed-table",S),f.push(S),m.push({x:c(r.left),y:u(r.top),w:g(r.width),h:p(r.height),colWidths:a.map(t=>g(t)),rowHeights:s.map(t=>p(t)),rows:b})}return{tables:m,consumedTableElementIds:f}}())'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(t.pageHeightPx)))})(t);return'(async()=>{const t=__HTML2PPTX_TEMPLATE_SLOT_0__,e=__HTML2PPTX_TEMPLATE_SLOT_1__,r=__HTML2PPTX_TEMPLATE_SLOT_2__,n=__HTML2PPTX_TEMPLATE_SLOT_3__,o=__HTML2PPTX_TEMPLATE_SLOT_4__,i=__HTML2PPTX_TEMPLATE_SLOT_5__,a=__HTML2PPTX_TEMPLATE_SLOT_6__,s=__HTML2PPTX_TEMPLATE_SLOT_7__,l=__HTML2PPTX_TEMPLATE_SLOT_8__,c=__HTML2PPTX_TEMPLATE_SLOT_9__;let d=null;try{d=await import(c)}catch(t){d=null}const h=t=>String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"").trim(),u=t=>h(t).slice(0,s),g=t=>(t=>{const e=String(t||"").replace(/\\r\\n?/g,"\\n").replace(/[\\u200b-\\u200d\\ufeff]/g,"").split("\\n").map(t=>t.replace(/[^\\S\\n]+/g," ").trim());for(;e.length>0&&!e[0];)e.shift();for(;e.length>0&&!e[e.length-1];)e.pop();return e.join("\\n")})(t).slice(0,s);__HTML2PPTX_TEMPLATE_SLOT_10__;const f=__HTML2PPTX_TEMPLATE_SLOT_11__,m=f.tables||[],p=new Set(f.consumedTableElementIds||[]),b=t=>{if(t.getAttribute&&p.has(t.getAttribute("data-pptx-consumed-table")))return!0;const e=t.closest&&t.closest("[data-pptx-consumed-table]");return!!e&&p.has(e.getAttribute("data-pptx-consumed-table"))},x=document.querySelector(\'.ppt-page-root[data-ppt-guard-root="1"]\')||document.querySelector(".ppt-page-root")||document.querySelector("[data-ppt-page], [data-page], .ppt-page, .slide, .page")||document.body,F=x.getBoundingClientRect(),E=F.left||0,w=F.top||0,S=F.width||t,M=F.height||e,y=(x instanceof HTMLElement&&x.offsetWidth&&x.offsetWidth,t=>((Number(t)||0)-E)/S*r),A=t=>((Number(t)||0)-w)/M*n,C=t=>(Number(t)||0)/S*r,T=t=>(Number(t)||0)/M*n,N=72*Math.min(r/S,n/M),B=t=>{const e=String(t||"").match(/rgba?\\(\\s*\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*,\\s*|\\s+)\\d+(?:\\.\\d+)?(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);if(!e||void 0===e[1])return 1;const r=String(e[1]),n=r.endsWith("%")?Number.parseFloat(r)/100:Number(r);return Math.max(0,Math.min(1,Number.isFinite(n)?n:1))},D=(t,e)=>{const r=B(t)*Math.max(0,Math.min(1,Number(e||1)));return Math.round(100*(1-r))},_=t=>{const e=t.webkitTextFillColor||t.getPropertyValue?.("-webkit-text-fill-color")||"",r=rgbToHex(e)?e:t.color;return{color:rgbToHex(r)||rgbToHex(t.color)||"111827",opacity:B(r)*Math.max(0,Math.min(1,Number(t.opacity||1)))}},v=t=>{if(!t.transform||"none"===t.transform)return;const e=t.transform.match(/matrix\\(([^)]+)\\)/)?.[1]?.split(",").map(t=>Number(t.trim()));return!e||e.length<4?void 0:Math.round(180*Math.atan2(e[1],e[0])/Math.PI)||void 0},L=(()=>{const t=rgbToHex(window.getComputedStyle(x).backgroundColor);if(t)return t;const e=rgbToHex(window.getComputedStyle(document.documentElement).backgroundColor);if(e)return e;const r=S*M,n=x.querySelectorAll(":scope > div, :scope > section, :scope > main");for(const t of n){const e=window.getComputedStyle(t),n=rgbToHex(e.backgroundColor);if(!n)continue;const o=t.getBoundingClientRect();if(o.width*o.height>=.5*r)return n}return"FFFFFF"})(),k=(r,n,o)=>{if(!n||"none"===n.display||"hidden"===n.visibility)return!1;if(Number(n.opacity||"1")<.04)return!1;const i=["Top","Right","Bottom","Left"].some(t=>{const e=Number.parseFloat(n["border"+t+"Width"]||"0")||0,r=n["border"+t+"Style"];return e>0&&"none"!==r});return!((o.width<2||o.height<2)&&!i||o.width<2&&o.height<2||o.bottom<0||o.right<0||o.left>t||o.top>e||r.closest("script, style, noscript, .katex, .katex-mathml, [data-pptx-formula-block]"))},P=t=>{const e=t.getBoundingClientRect();return{rect:e,x:y(e.left),y:A(e.top),w:C(e.width),h:T(e.height)}},I=new WeakMap;Array.from(x.querySelectorAll("*")).forEach((t,e)=>{I.set(t,e+1)});const R=t=>I.get(t)||0,H=t=>{const e=String(t?.zIndex||"").trim();if(!e||"auto"===e)return;const r=Number.parseInt(e,10);return Number.isFinite(r)?Math.max(-1e5,Math.min(1e5,r)):void 0},W=(t,e)=>!(!t||t===x||!(void 0!==H(e)&&("static"!==e.position||(t=>{const e=t?.parentElement;return!!e&&/(?:^|\\s)(?:inline-)?(?:flex|grid)(?:\\s|$)/.test(window.getComputedStyle(e).display||"")})(t))||Number(e.opacity||"1")<1||e.transform&&"none"!==e.transform||e.filter&&"none"!==e.filter||e.backdropFilter&&"none"!==e.backdropFilter||e.perspective&&"none"!==e.perspective||e.mixBlendMode&&"normal"!==e.mixBlendMode||"isolate"===e.isolation||/(?:layout|paint|strict|content)/.test(e.contain||"")||/(?:transform|opacity|filter|perspective|contents)/.test(e.willChange||""))),O=t=>{const e=[];let r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE&&(e.push(r),r!==x);)r=r.parentElement;e.reverse();const n=[{z:0,order:0}];for(const t of e){if(!t||t===x)continue;const e=window.getComputedStyle(t);W(t,e)&&n.push({z:H(e)??0,order:R(t)})}const o=R(t);return n.some(t=>t.order===o)||n.push({z:0,order:o}),{key:n,order:o}},j=t=>{let e=1,r=t;for(;r&&r.nodeType===Node.ELEMENT_NODE;){const t=Number(window.getComputedStyle(r).opacity||"1");if(Number.isFinite(t)&&(e*=Math.max(0,Math.min(1,t))),r===x)break;r=r.parentElement}return Math.max(0,Math.min(1,e))},z=new Map;let U=0;const q=t=>{if(!t||t.nodeType!==Node.ELEMENT_NODE)return"";let e=t.getAttribute("data-pptx-paint-id");return e||(U+=1,e="pptx-paint-"+String(U),t.setAttribute("data-pptx-paint-id",e)),z.set(e,t),e},$=new Map([["ring",3],["ring-0",0],["ring-1",1],["ring-2",2],["ring-4",4],["ring-8",8]]),X=new Map([["border",1],["border-0",0],["border-2",2],["border-4",4],["border-8",8]]),V=new Map([["rounded-none",0],["rounded-sm",2],["rounded",4],["rounded-md",6],["rounded-lg",8],["rounded-xl",12],["rounded-2xl",16],["rounded-3xl",24]]),G=new Map([["font-thin",100],["font-extralight",200],["font-light",300],["font-normal",400],["font-medium",500],["font-semibold",600],["font-bold",700],["font-extrabold",800],["font-black",900]]),K=new Map([["black","#000000"],["white","#FFFFFF"],["transparent","rgba(0, 0, 0, 0)"]]),Q=["50","100","200","300","400","500","600","700","800","900","950"],Y=new Map(Object.entries({slate:["#F8FAFC","#F1F5F9","#E2E8F0","#CBD5E1","#94A3B8","#64748B","#475569","#334155","#1E293B","#0F172A","#020617"],gray:["#F9FAFB","#F3F4F6","#E5E7EB","#D1D5DB","#9CA3AF","#6B7280","#4B5563","#374151","#1F2937","#111827","#030712"],zinc:["#FAFAFA","#F4F4F5","#E4E4E7","#D4D4D8","#A1A1AA","#71717A","#52525B","#3F3F46","#27272A","#18181B","#09090B"],neutral:["#FAFAFA","#F5F5F5","#E5E5E5","#D4D4D4","#A3A3A3","#737373","#525252","#404040","#262626","#171717","#0A0A0A"],stone:["#FAFAF9","#F5F5F4","#E7E5E4","#D6D3D1","#A8A29E","#78716C","#57534E","#44403C","#292524","#1C1917","#0C0A09"],red:["#FEF2F2","#FEE2E2","#FECACA","#FCA5A5","#F87171","#EF4444","#DC2626","#B91C1C","#991B1B","#7F1D1D","#450A0A"],orange:["#FFF7ED","#FFEDD5","#FED7AA","#FDBA74","#FB923C","#F97316","#EA580C","#C2410C","#9A3412","#7C2D12","#431407"],amber:["#FFFBEB","#FEF3C7","#FDE68A","#FCD34D","#FBBF24","#F59E0B","#D97706","#B45309","#92400E","#78350F","#451A03"],yellow:["#FEFCE8","#FEF9C3","#FEF08A","#FDE047","#FACC15","#EAB308","#CA8A04","#A16207","#854D0E","#713F12","#422006"],lime:["#F7FEE7","#ECFCCB","#D9F99D","#BEF264","#A3E635","#84CC16","#65A30D","#4D7C0F","#3F6212","#365314","#1A2E05"],green:["#F0FDF4","#DCFCE7","#BBF7D0","#86EFAC","#4ADE80","#22C55E","#16A34A","#15803D","#166534","#14532D","#052E16"],emerald:["#ECFDF5","#D1FAE5","#A7F3D0","#6EE7B7","#34D399","#10B981","#059669","#047857","#065F46","#064E3B","#022C22"],teal:["#F0FDFA","#CCFBF1","#99F6E4","#5EEAD4","#2DD4BF","#14B8A6","#0D9488","#0F766E","#115E59","#134E4A","#042F2E"],cyan:["#ECFEFF","#CFFAFE","#A5F3FC","#67E8F9","#22D3EE","#06B6D4","#0891B2","#0E7490","#155E75","#164E63","#083344"],sky:["#F0F9FF","#E0F2FE","#BAE6FD","#7DD3FC","#38BDF8","#0EA5E9","#0284C7","#0369A1","#075985","#0C4A6E","#082F49"],blue:["#EFF6FF","#DBEAFE","#BFDBFE","#93C5FD","#60A5FA","#3B82F6","#2563EB","#1D4ED8","#1E40AF","#1E3A8A","#172554"],indigo:["#EEF2FF","#E0E7FF","#C7D2FE","#A5B4FC","#818CF8","#6366F1","#4F46E5","#4338CA","#3730A3","#312E81","#1E1B4B"],violet:["#F5F3FF","#EDE9FE","#DDD6FE","#C4B5FD","#A78BFA","#8B5CF6","#7C3AED","#6D28D9","#5B21B6","#4C1D95","#2E1065"],purple:["#FAF5FF","#F3E8FF","#E9D5FF","#D8B4FE","#C084FC","#A855F7","#9333EA","#7E22CE","#6B21A8","#581C87","#3B0764"],fuchsia:["#FDF4FF","#FAE8FF","#F5D0FE","#F0ABFC","#E879F9","#D946EF","#C026D3","#A21CAF","#86198F","#701A75","#4A044E"],pink:["#FDF2F8","#FCE7F3","#FBCFE8","#F9A8D4","#F472B6","#EC4899","#DB2777","#BE185D","#9D174D","#831843","#500724"],rose:["#FFF1F2","#FFE4E6","#FECDD3","#FDA4AF","#FB7185","#F43F5E","#E11D48","#BE123C","#9F1239","#881337","#4C0519"]})),J=t=>{const e=String(t||"").trim();if(!e)return"";const r=e.split(":");return r[r.length-1]||e},Z=(t,e)=>{let r="",n="";const o=e+"-[";if(t.startsWith(o)){const e=t.indexOf("]");if(e<0)return null;r=t.slice(o.length,e),n=t.slice(e+1).startsWith("/")?t.slice(e+2):""}else if(t.startsWith(e+"-")){const o=t.slice(e.length+1),i=o.indexOf("/");r=(t=>{if(K.has(t))return K.get(t);const e=String(t||"").match(/^([a-z]+)-(50|100|200|300|400|500|600|700|800|900|950)$/);if(!e)return"";const r=Y.get(e[1]),n=Q.indexOf(e[2]);return r&&n>=0?r[n]:""})(i>=0?o.slice(0,i):o),n=i>=0?o.slice(i+1):""}if(!r||/^-?\\d/.test(r)||/px\\]?$/.test(r))return null;const i=(t=>{const e=String(t||"").replace(/^\\[|\\]$/g,"").trim();if(!e)return;const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r>1?r/100:r)):void 0})(n);return void 0!==i&&r.startsWith("#")?((t,e)=>{const r=String(t||"").trim().replace(/^#/,""),n=3===r.length?r.split("").map(t=>t+t).join(""):r.slice(0,6);return/^[0-9a-f]{6}$/i.test(n)?"rgba("+Number.parseInt(n.slice(0,2),16)+", "+Number.parseInt(n.slice(2,4),16)+", "+Number.parseInt(n.slice(4,6),16)+", "+e+")":t})(r,i):r},tt=t=>Z(t,"ring"),et=t=>Z(t,"border"),rt=t=>Z(t,"bg"),nt=t=>{if($.has(t))return $.get(t);const e=t.match(/^ring-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},ot=t=>{if(X.has(t))return X.get(t);const e=t.match(/^border-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?Math.max(0,r):void 0},it=t=>{const e=String(t||"").match(/^border-([trblxy])(?:-(0|2|4|8|\\[(-?\\d*\\.?\\d+)px\\]))?$/);if(!e)return null;const r=e[1],n=e[2],o=e[3],i=void 0!==o?Number.parseFloat(o):n?Number.parseFloat(n):1;return!Number.isFinite(i)||i<0?null:{sides:"x"===r?["left","right"]:"y"===r?["top","bottom"]:"t"===r?["top"]:"r"===r?["right"]:"b"===r?["bottom"]:["left"],width:i}},at=t=>{const e=String(t||"").match(/^border-([trblxy])-(.+)$/);if(!e)return null;const r=e[2];if(/^(?:0|2|4|8|\\[-?\\d*\\.?\\d+px\\])$/.test(r))return null;const n=et("border-"+r);if(!n)return null;const o=e[1];return{sides:"x"===o?["left","right"]:"y"===o?["top","bottom"]:"t"===o?["top"]:"r"===o?["right"]:"b"===o?["bottom"]:["left"],colorSource:n}},st=t=>{if("rounded-full"===t)return{full:!0};if(V.has(t))return{px:V.get(t)};const e=t.match(/^rounded-\\[(-?\\d*\\.?\\d+)px\\]$/);if(!e)return null;const r=Number.parseFloat(e[1]);return Number.isFinite(r)?{px:Math.max(0,r)}:null},lt=t=>{if(G.has(t))return G.get(t);const e=t.match(/^font-\\[([1-9]\\d{0,2})\\]$/);if(!e)return;const r=Number.parseInt(e[1],10);return Number.isFinite(r)?Math.max(1,Math.min(1e3,r)):void 0},ct=t=>{const e=String(t?.className||"").split(/\\s+/).filter(Boolean);let r;for(const t of e){const e=lt(J(t));void 0!==e&&(r=e)}return r},dt=t=>{const e=String(t.fontWeight||"").trim().toLowerCase();if(!e)return;if("normal"===e)return 400;if("bold"===e)return 700;const r=Number.parseInt(e,10);return Number.isFinite(r)&&r>0?r:void 0},ht=t=>{const e=t?.style?.fontWeight;if(e)return dt({fontWeight:e})},ut=(t,e,r)=>{const n=String(t||"").replace(/\\s+/g," ").replace(/[\\u200b-\\u200d\\ufeff]/g,"");if(!n)return null;const o=Number.parseFloat(e.fontSize||"16")||16,i=ht(r),a=ct(r),s=dt(e),l=i||a||s||400,c=String(e.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",d=_(e);return{text:n,fontSize:Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_12__,o*N)),fontFace:c,color:d.color,bold:l>=600||/^H[1-6]$/i.test(r?.tagName||""),italic:"italic"===e.fontStyle||"oblique"===e.fontStyle,underline:String(e.textDecoration||"").includes("underline"),strike:String(e.textDecoration||"").includes("line-through")}},gt=t=>{for(;t.length>0&&(t[0].text=String(t[0].text||"").trimStart(),!t[0].text);)t.shift();for(;t.length>0;){const e=t[t.length-1];if(e.text=String(e.text||"").trimEnd(),e.text)break;t.pop()}return t.filter(t=>t.text)},ft=(t,e)=>t&&e&&t.fontSize===e.fontSize&&t.fontFace===e.fontFace&&t.color===e.color&&Boolean(t.bold)===Boolean(e.bold)&&Boolean(t.italic)===Boolean(e.italic)&&Boolean(t.underline)===Boolean(e.underline)&&Boolean(t.strike)===Boolean(e.strike),mt=(t,e)=>{if(!t||kt(e))return;const r=[],n=(t,e,o)=>{if(t.nodeType===Node.TEXT_NODE){const n=ut(t.textContent,o,e);return void(n&&r.push(n))}if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t;if(i.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const a=window.getComputedStyle(i);i.childNodes.forEach(t=>n(t,i,a))};if(t.childNodes.forEach(r=>n(r,t,e)),gt(r),0===r.length)return;const o=h(r.map(t=>t.text).join("")),i=h(t.innerText||t.textContent);if(!o||o!==i)return;const a=ut(i,e,t);return r.some(t=>!ft(t,a))?r:void 0},pt=(t,e)=>{if(!e||!e.text)return;const r=t[t.length-1];ft(r,e)?r.text+=e.text:t.push({...e})},bt=(t,e)=>{if(!t||kt(e))return[];const r=h(t.innerText||t.textContent);if(!r||r.length>Ct)return[];const n=[];let o=null;const i=(t,e,r)=>{if(t.nodeType===Node.TEXT_NODE){const i=String(t.textContent||"");for(let a=0;a<i.length;a+=1){const s=i[a];if(!s)continue;const l=document.createRange();l.setStart(t,a),l.setEnd(t,a+1);const c=l.getBoundingClientRect();if(l.detach(),c.width<.5||c.height<.5){o&&/\\s/.test(s)&&(pt(o.runs,ut(s,r,e)),o.text+=s);continue}let d=n.find(t=>Math.abs(t.top-c.top)<Math.max(3,.3*c.height));d||(d={top:c.top,left:c.left,right:c.right,bottom:c.bottom,text:"",runs:[]},n.push(d)),pt(d.runs,ut(s,r,e)),d.text+=s,d.left=Math.min(d.left,c.left),d.right=Math.max(d.right,c.right),d.bottom=Math.max(d.bottom,c.bottom),o=d}return}if(t.nodeType!==Node.ELEMENT_NODE)return;const a=t;if(a.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;const s=window.getComputedStyle(a);a.childNodes.forEach(t=>i(t,a,s))};t.childNodes.forEach(r=>i(r,t,e));const a=n.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>{gt(t.runs);const e=h(t.runs.map(t=>t.text).join(""));return e?{text:e,rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top},runs:t.runs}:null}).filter(Boolean);return h(a.map(t=>t.text).join(""))===r?a:[]},xt=t=>{const e={ringWidthPx:void 0,ringColorSource:"",ringInset:!1,borderWidthPx:void 0,borderSideWidthPx:{left:void 0,top:void 0,right:void 0,bottom:void 0},borderSideColorSource:{left:"",top:"",right:"",bottom:""},borderColorSource:"",borderDash:void 0,backgroundColorSource:"",radiusPx:void 0,radiusFull:!1},r=String(t?.className||"").split(/\\s+/).filter(Boolean);for(const t of r){const r=J(t);if("ring-inset"===r){e.ringInset=!0;continue}"border-dashed"===r||"border-dotted"===r?e.borderDash="dash":"border-solid"===r&&(e.borderDash="solid");const n=nt(r);void 0!==n&&(e.ringWidthPx=n);const o=tt(r);o&&(e.ringColorSource=o);const i=ot(r);void 0!==i&&(e.borderWidthPx=i);const a=it(r);a&&a.sides.forEach(t=>{e.borderSideWidthPx[t]=a.width});const s=at(r);s&&s.sides.forEach(t=>{e.borderSideColorSource[t]=s.colorSource});const l=et(r);l&&(e.borderColorSource=l);const c=rt(r);c&&(e.backgroundColorSource=c);const d=st(r);d?.full?e.radiusFull=!0:void 0!==d?.px&&(e.radiusPx=d.px)}return e},Ft=(t,e,r)=>{let n=null;if(t.boxShadow&&"none"!==t.boxShadow)for(const r of(t=>{const e=[];let r="",n=0;for(const o of String(t||""))"("===o?n+=1:")"===o&&(n=Math.max(0,n-1)),","===o&&0===n?(r.trim()&&e.push(r.trim()),r=""):r+=o;return r.trim()&&e.push(r.trim()),e})(t.boxShadow)){if(/\\binset\\b/i.test(r))continue;const t=r.match(/rgba?\\([^)]*\\)|#[0-9a-fa-f]{3,8}/i);if(!t)continue;const o=t[0],i=rgbToHex(o);if(!i||B(o)*e<.04)continue;const a=r.replace(o," ").match(/-?\\d*\\.?\\d+(?:px)?/g)?.map(t=>Number.parseFloat(t))||[];if(a.length<4)continue;const[s,l,c,d]=a;Math.abs(s)>.5||Math.abs(l)>.5||Math.abs(c)>.5||!Number.isFinite(d)||d<=.5||(!n||d>n.w)&&(n={w:d,c:i,colorSource:o})}if(r?.ringInset)return n;if(r?.ringWidthPx>0){const t=r.ringColorSource||n?.colorSource||"rgba(59, 130, 246, 0.5)",o=rgbToHex(t);if(o&&B(t)*e>=.04){const e={w:r.ringWidthPx,c:o,colorSource:t};if(!n||e.w>n.w)return e}}return n},Et=Array.from(x.querySelectorAll("section,main,article,header,footer,aside,div,figure,figcaption,table,td,th,span")),wt=[],St=S*M*.005;for(const t of Et){if(wt.length>=i)continue;if(b(t))continue;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:a,h:s}=P(t);if(!k(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;const l=(e.backgroundImage||"").trim();if(l&&"none"!==l)continue;if(e.clipPath&&"none"!==e.clipPath||e.maskImage&&"none"!==e.maskImage||e.webkitMaskImage&&"none"!==e.webkitMaskImage||e.mixBlendMode&&"normal"!==e.mixBlendMode||e.backgroundBlendMode&&"normal"!==e.backgroundBlendMode||e.backdropFilter&&"none"!==e.backdropFilter)continue;const c=Number(e.opacity||"1");if(c<.15)continue;const d=xt(t),u=rgbToHex(e.backgroundColor)?e.backgroundColor:d.backgroundColorSource,g=rgbToHex(u),f=()=>{const t=[{side:"left",w:e.borderLeftWidth,c:e.borderLeftColor,s:e.borderLeftStyle},{side:"top",w:e.borderTopWidth,c:e.borderTopColor,s:e.borderTopStyle},{side:"right",w:e.borderRightWidth,c:e.borderRightColor,s:e.borderRightStyle},{side:"bottom",w:e.borderBottomWidth,c:e.borderBottomColor,s:e.borderBottomStyle}],r=[],n=(t,e=!1)=>{const n=r.findIndex(e=>e.side===t.side);n>=0?e&&(r[n]=t):r.push(t)},o=t=>{const e=r.findIndex(e=>e.side===t);e>=0&&r.splice(e,1)};for(const e of t){const t=Number.parseFloat(e.w||"0")||0;if(t<=0||"none"===e.s)continue;const r=rgbToHex(e.c);r&&n({side:e.side,w:t,c:r,colorSource:e.c,dash:"dashed"===e.s||"dotted"===e.s?"dash":"solid"})}if(d.borderWidthPx>0){const t=d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",r=rgbToHex(t);if(r&&B(t)*c>=.04)for(const e of["left","top","right","bottom"])n({side:e,w:d.borderWidthPx,c:r,colorSource:t,dash:d.borderDash||"solid"},!0)}for(const t of["left","top","right","bottom"]){const i=d.borderSideWidthPx?.[t],a=d.borderSideColorSource?.[t];if(void 0===i&&!a)continue;if(void 0!==i&&i<=0){o(t);continue}const s=r.find(e=>e.side===t),l=i>0?i:s?.w;if(!(l>0))continue;const h=a||s?.colorSource||d.borderColorSource||e.borderColor||"rgba(229, 231, 235, 1)",u=rgbToHex(h);!u||B(h)*c<.04||n({side:t,w:l,c:u,colorSource:h,dash:s?.dash||d.borderDash||"solid"},!0)}return r},m=f(),p=(()=>{let t=null;for(const e of m)(!t||e.w>t.w)&&(t=e);if(d.borderWidthPx>0){const r=d.borderColorSource||t?.colorSource||e.borderColor||"rgba(229, 231, 235, 1)",n=rgbToHex(r);if(n&&B(r)*c>=.04){const e={w:d.borderWidthPx,c:n,colorSource:r,dash:d.borderDash||"solid"};(!t||e.w>t.w)&&(t=e)}}const r=Ft(e,c,d);return r&&(!t||r.w>t.w)?{...r,dash:"solid"}:t})(),x=(t,e)=>t&&e&&t.c===e.c&&t.dash===e.dash&&Math.abs(t.w-e.w)<.1&&Math.abs(D(t.colorSource,c)-D(e.colorSource,c))<=1,F=4===m.length&&m.every(t=>x(t,m[0])),E=m.length>0&&!F&&!d.ringWidthPx,w=E?null:p,S=w?w.c:"",M=w?w.w:0,N=Boolean(p),_=Boolean(w),I=Math.min(r.width,r.height),H=Number.parseFloat(e.borderTopLeftRadius||e.borderRadius||"0")||(d.radiusFull?I/2:d.radiusPx||0),W=Boolean(e.boxShadow&&"none"!==e.boxShadow),O=i=>{if(!i)return null;const l=.001;let d=n,h=o,u=a,g=l;return"bottom"===i.side?h=A(r.bottom-i.w/2):"top"===i.side?h=A(r.top+i.w/2):"right"===i.side?(d=y(r.right-i.w/2),u=l,g=s):(d=y(r.left+i.w/2),u=l,g=s),{x:d,y:h,w:Math.max(l,u),h:Math.max(l,g),order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",rotate:v(e),border:{color:i.c,widthPt:.75*i.w,transparency:D(i.colorSource,c),dash:i.dash||"solid"}}},j=!g&&!H&&!W,z=(t,e)=>m.map(t=>t.side).sort().join("|")===[t,e].sort().join("|"),U=j&&2===m.length&&void 0!==v(e)&&r.width<=42&&r.height<=42&&(z("top","right")||z("right","bottom")||z("bottom","left")||z("left","top")),$=(()=>{if(!U)return[];const e=m[0];if(!e)return[];const n=r.left+.18*r.width,o=r.top+.18*r.height,i=.58*r.width,a=.32*r.height,s={order:R(t),paintId:q(t),fill:void 0,transparency:100,shapeType:"line",border:{color:e.c,widthPt:.75*e.w,transparency:D(e.colorSource,c),dash:e.dash||"solid"}};return[{...s,x:y(n),y:A(o),w:Math.max(.001,C(i)),h:Math.max(.001,T(a))},{...s,x:y(n),y:A(o+.32*r.height),w:Math.max(.001,C(i)),h:Math.max(.001,T(a)),flipV:!0}]})();if($.length>0){if(wt.length+$.length>i)continue;$.forEach(t=>wt.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}const X=E?m.map(t=>O(t)).filter(Boolean):[];if(X.length>0&&j){if(wt.length+X.length>i)continue;X.forEach(t=>wt.push(t)),t.setAttribute("data-pptx-extracted-shape","1");continue}if(!(g&&(g!==L||H||W)||N))continue;const V=Boolean(h(t.innerText||t.textContent)),G=g&&g!==L&&(H>0||W||V&&r.width>=12&&r.height>=12),K=t.parentElement?String(window.getComputedStyle(t.parentElement).display||""):"",Q=g&&g!==L&&!N&&!H&&!W&&/grid/i.test(K)&&!h(t.innerText||t.textContent)&&r.width>=8&&r.height>=8,Y=g&&g!==L&&!H&&!W&&!h(t.innerText||t.textContent)&&(r.width>=24&&r.height>=2&&r.height<12||r.height>=24&&r.width>=2&&r.width<12);if(!N&&!G&&!Q&&r.width*r.height<St)continue;if((r.width<12||r.height<12)&&!Y)continue;if(wt.length+1+X.length>i)continue;const J=Math.max(0,Math.min(H,I/2)),Z=J>0&&I>0?Math.max(0,Math.min(5e4,Math.round(J/I*1e5))):0,tt=J>0&&Math.abs(r.width-r.height)<1.5&&J>=I/2-.5?"ellipse":J>0?"roundRect":"rect";wt.push({x:n,y:o,w:a,h:s,order:R(t),paintId:q(t),fill:g,transparency:g?D(u,c):100,radius:H,radiusAdj:Z,shapeType:tt,rotate:v(e),border:_?{color:S,widthPt:.75*M,transparency:D(w.colorSource||e.borderColor,c),dash:w.dash||"solid"}:void 0}),X.length>0&&X.forEach(t=>wt.push(t)),t.setAttribute("data-pptx-extracted-shape","1")}const Mt=[],yt=new Set,At=new Set,Ct=180,Tt=t=>{for(const e of At)if(e.contains(t))return!0;return!1},Nt=(t,e,n,o,i=!1)=>{if(i)return Math.max(.12,Math.min(r-t,1.1*e));const a=/[\\u3400-\\u9fff\\uf900-\\ufaff]/.test(o)?1.15:1.08,s=Math.max(.08,Math.min(.3,n/72*.2));return Math.max(.12,Math.min(r-t,e*a+s))},Bt=(t,e)=>{const r=Math.max(.02,Math.min(.1,e/72*.08));return Math.max(.06,1.08*t+r)},Dt=t=>{if(!t.letterSpacing||"normal"===t.letterSpacing)return 0;const e=Number.parseFloat(t.letterSpacing);return Number.isFinite(e)?e:0},_t=(t,e)=>{const r=Number.parseFloat(t[e]||"0")||0;return Math.max(0,Math.min(72,r*N))},vt=t=>{const e=Number.parseFloat(String(t||"0"));return Number.isFinite(e)?Math.max(0,e):0},Lt=t=>{if(!t||"LI"!==String(t.tagName||"").toUpperCase())return;const e=t.parentElement?.closest?.("ol,ul");if(!e)return;if("none"===String(window.getComputedStyle(t).listStyleType||""))return;let r=0,n=t.parentElement;for(;n&&n!==x;)"OL"!==n.tagName&&"UL"!==n.tagName||(r+=1),n=n.parentElement;const o=Math.max(0,r-1);if("OL"===String(e.tagName||"").toUpperCase()){const r=Number.parseInt(t.getAttribute("value")||"",10);if(Number.isFinite(r)&&r>0)return{type:"number",level:o,startAt:r};const n=Number.parseInt(e.getAttribute("start")||"1",10)||1,i=Array.from(e.children||[]).filter(t=>"LI"===t.tagName).indexOf(t);return{type:"number",level:o,startAt:Math.max(1,n+Math.max(0,i))}}return{type:"bullet",level:o}},kt=t=>/vertical/i.test(String(t.writingMode||"")),Pt=t=>{const e=_(t);return[e.color,Math.round(100*e.opacity),String(t.fontSize||""),String(t.fontWeight||""),String(t.fontStyle||""),String(t.textDecorationLine||t.textDecoration||"")].join("|")},It=(t,e)=>{const r=Pt(e),n=Array.from(t.children||[]);for(const t of n){if(!h(t.innerText||t.textContent)||t.closest?.("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;const n=window.getComputedStyle(t),o=t.getBoundingClientRect();if(k(t,n,o)){if(Pt(n)!==r)return!0;if(It(t,e))return!0}}return!1},Rt=(t,e,n,i,a=!1,s={})=>{if(Mt.length>=o)return;if(!(t=a?g(t):u(t)))return;if(!k(i,n,e))return;if(e.width<2||e.height<2)return;const l=kt(n);if(l){if(!(t=(t=>{const e=h(t).replace(/\\s+/g,"");return e?Array.from(e).join("\\n"):""})(t)))return;a=!1}const c=Lt(i),f=s.useElementInsets&&!l?((t,e)=>{const r=vt(t.paddingLeft)+vt(t.borderLeftWidth),n=vt(t.paddingRight)+vt(t.borderRightWidth),o=vt(t.paddingTop)+vt(t.borderTopWidth),i=vt(t.paddingBottom)+vt(t.borderBottomWidth),a=Math.max(0,.45*e.width),s=Math.max(0,.45*e.height);return{paddingLeft:C(Math.min(r,a)),paddingRight:C(Math.min(n,a)),paddingTop:T(Math.min(o,s)),paddingBottom:T(Math.min(i,s))}})(n,e):void 0,m=Boolean(f&&(f.paddingLeft||f.paddingRight||f.paddingTop||f.paddingBottom)),p=Array.isArray(s.runs)?s.runs.filter(t=>t&&h(t.text)):void 0;if(a&&!l&&!c&&!m&&!p?.length){const r=((t,e,r)=>{if(!d||!t||e.width<4||e.height<4)return null;if(v(r))return null;const n=Number.parseFloat(r.fontSize||"16")||16,o=((t,e)=>{const r=Number.parseFloat(t.lineHeight||"");return Number.isFinite(r)&&r>0?r:1.18*e})(r,n);try{const i=d.prepareWithSegments(t,((t,e)=>{const r=Number.parseInt(t.fontWeight||"400",10)||400,n="italic"===t.fontStyle||"oblique"===t.fontStyle?"italic":"",o=String(t.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",i=/^[a-z0-9 -]+$/i.test(o)?o:\'"\'+o.replace(/"/g,"")+\'"\';return[n,String(r),e.toFixed(2)+"px",i].filter(Boolean).join(" ")})(r,n),{whiteSpace:"pre-wrap",letterSpacing:Dt(r)}),a=d.layoutWithLines(i,Math.max(1,e.width),o);return a?.lines?.length?{lineHeightPx:o,lines:a.lines.map((t,n)=>{const i=h(String(t.text||""));if(!i)return null;const a=Math.max(1,Math.min(e.width,Number(t.width)||e.width));let s=e.left;return"center"===r.textAlign?s+=Math.max(0,(e.width-a)/2):"right"!==r.textAlign&&"end"!==r.textAlign||(s+=Math.max(0,e.width-a)),{text:i,rect:{left:s,top:e.top+n*o,right:s+a,bottom:e.top+(n+1)*o,width:a,height:o}}}).filter(Boolean)}:null}catch(t){return null}})(t,e,n);if(r&&r.lines.length>0)return void r.lines.forEach(t=>Rt(t.text,t.rect,n,i,!1))}const b=((t,e)=>[t.toLowerCase(),Math.round(e.left),Math.round(e.top),Math.round(e.width),Math.round(e.height)].join("|"))(t,e);if(yt.has(b))return;yt.add(b);const x=Number.parseFloat(n.fontSize||"16")||16,F=Math.max(6,Math.min(__HTML2PPTX_TEMPLATE_SLOT_13__,x*N)),E=ht(i),w=ct(i),S=dt(n),M=E||w||S||400,B=String(n.fontFamily||"Aptos").split(",")[0].replace(/["\']/g,"").trim()||"Aptos",D=y(e.left),L=_(n),P=((t,e,r)=>{if(e)return"center";const n=String(t.textAlign||"");if("center"===n)return"center";if("right"===n||"end"===n)return"right";if(r&&"justify"===n)return"justify";const o=String(t.display||"");if(o.includes("flex")||o.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/row-reverse/i.test(e),o=String(r?t.alignItems||"":t.justifyContent||"");if("center"===o)return"center";if(!r&&("start"===o||"flex-start"===o))return n?"right":"left";if("end"===o||"flex-end"===o||"right"===o)return n?"left":"right"}return"left"})(n,l,a),I=(t=>{const e=String(t.verticalAlign||"");if("middle"===e)return"middle";if("bottom"===e||"text-bottom"===e)return"bottom";const r=String(t.display||"");if(r.includes("flex")||r.includes("grid")){const e=String(t.flexDirection||"row"),r=/column/i.test(e),n=/column-reverse/i.test(e),o=/column/i.test(e)?String(t.justifyContent||""):String(t.alignItems||"");if("center"===o)return"middle";if(r&&("start"===o||"flex-start"===o))return n?"bottom":"top";if("end"===o||"flex-end"===o)return n?"top":"bottom"}return"top"})(n);Mt.push({text:t,x:D,y:A(e.top),w:l?Math.max(.12,C(e.width)+Math.max(.02,F/72*.08)):m||"left"!==P?Math.max(.12,Math.min(r-D,C(e.width))):Nt(D,C(e.width),F,t,a),h:l?Math.max(.12,T(e.height)):m?Math.max(.08,T(e.height)):a?Math.max(.12,T(e.height)+Math.max(.02,F/72*.08)):"top"!==I?Math.max(.08,T(e.height)):Bt(T(e.height),F),fontSize:F,fontFace:B,color:L.color,bold:M>=600||/^H[1-6]$/i.test(i.tagName),italic:"italic"===n.fontStyle||"oblique"===n.fontStyle,underline:String(n.textDecoration||"").includes("underline"),strike:String(n.textDecoration||"").includes("line-through"),align:P,opacity:L.opacity,rotate:v(n),order:R(i),paintId:q(i),paragraphSpacingBefore:_t(n,"marginTop"),paragraphSpacingAfter:_t(n,"marginBottom"),verticalAlign:I,...m?f:{},bullet:c,lineSpacing:n.lineHeight&&"normal"!==n.lineHeight?Math.max(1.08*F,(Number.parseFloat(n.lineHeight)||0)*N):l?1.02*F:t.includes("\\n")?1.18*F:void 0,charSpacing:n.letterSpacing&&"normal"!==n.letterSpacing?(Number.parseFloat(n.letterSpacing)||0)*N:void 0,...p?.length?{runs:p}:{},wrap:a})},Ht=(t,e,r)=>{if(!r)return!1;if(t.querySelector?.(".katex"))return!1;if(t.closest?.("[data-pptx-formula-block]"))return!1;if((t=>Boolean(t.querySelector(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,div,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,.katex\')))(t))return!1;if(["SCRIPT","STYLE","NOSCRIPT","SVG","CANVAS","VIDEO","IFRAME","MATH"].includes(t.tagName))return!1;const n=t.tagName;if(/^H[1-6]$/.test(n)||["P","LI","BLOCKQUOTE","TD","TH","FIGCAPTION"].includes(n))return!0;if(It(t,e))return!1;if(t.matches(\'[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title\'))return!0;if(!["block","flex","grid","table-cell","list-item"].includes(e.display)&&!["absolute","fixed"].includes(e.position)||r.length<6||r.length>180)return!1;const o=Array.from(t.children);if(o.length>=2){let t=0,e=0;for(const r of o){if(r.closest("script, style, noscript"))continue;const n=window.getComputedStyle(r);if("none"===n.display||"hidden"===n.visibility||Number(n.opacity||"1")<.04)continue;e++;const o=rgbToHex(n.backgroundColor);o&&o!==L&&t++}if(e>=2&&t===e)return!1}return!0},Wt=(t,e,r)=>{if(Mt.length>=o)return;if(t.nodeType===Node.TEXT_NODE)return void((t,e,r)=>{if(Mt.length>=o)return;if(r&&Tt(r))return;if(r&&r.closest?.(".katex, .katex-mathml, [data-pptx-formula-block]"))return;if(r&&b(r))return;const n=u(t.textContent);if(!n)return;const i=document.createRange();i.selectNode(t);const a=i.getBoundingClientRect(),s=Array.from(i.getClientRects());i.detach();const l=Number.parseFloat(e.fontSize||"16")||16;if(s.length>1||a.height>1.7*l){const o=(t=>{const e=String(t.textContent||"");if(e.length>Ct)return[];const r=[];let n=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(!i)continue;const a=document.createRange();a.setStart(t,o),a.setEnd(t,o+1);const s=a.getBoundingClientRect();if(a.detach(),s.width<.5||s.height<.5){n&&/\\s/.test(i)&&(n.text+=i);continue}let l=r.find(t=>Math.abs(t.top-s.top)<Math.max(3,.3*s.height));l||(l={top:s.top,text:"",left:s.left,right:s.right,bottom:s.bottom},r.push(l)),l.text+=i,l.left=Math.min(l.left,s.left),l.right=Math.max(l.right,s.right),l.bottom=Math.max(l.bottom,s.bottom),n=l}return r.sort((t,e)=>t.top-e.top||t.left-e.left).map(t=>({text:h(t.text),rect:{left:t.left,top:t.top,right:t.right,bottom:t.bottom,width:t.right-t.left,height:t.bottom-t.top}})).filter(t=>t.text)})(t);return o.length>1?void o.forEach(t=>Rt(t.text,t.rect,e,r,!1)):void Rt(n,a,e,r,!0)}Rt(n,a,e,r,!1)})(t,e,r);if(t.nodeType!==Node.ELEMENT_NODE)return;const n=t;if(At.has(n))return;if(n.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))return;if(b(n))return;const i=window.getComputedStyle(n),a=n.getBoundingClientRect();if(!k(n,i,a))return;const s=!["block","flex","grid","table","list-item"].includes(i.display)&&!["absolute","fixed","sticky"].includes(i.position)||(t=>["SPAN","B","STRONG","I","EM","U","FONT","SUB","SUP","A","SMALL","BIG","MARK"].includes(t.tagName))(n)?i||e:i;n.childNodes.forEach(t=>Wt(t,s,n))};(()=>{const t=Array.from(x.querySelectorAll(\'h1,h2,h3,h4,h5,h6,p,li,blockquote,td,th,figcaption,[data-ppt-text],[data-role="title"],.title,.slide-title,.page-title,div\'));for(const e of t){if(Mt.length>=o)break;if(e.closest("script, style, noscript, svg, canvas, video, iframe, .katex, .katex-mathml, [data-pptx-formula-block]"))continue;if(b(e))continue;if(Tt(e))continue;const t=window.getComputedStyle(e),r=e.getBoundingClientRect(),n=g(e.innerText||e.textContent);if(!k(e,t,r))continue;if(!Ht(e,t,n))continue;const i=Number.parseFloat(t.fontSize||"16")||16,a=r.height<=1.55*i,s=i>=28||/^H[1-6]$/.test(e.tagName),l=mt(e,t),c=l?.length?bt(e,t):[];c.length>1&&!Lt(e)?(c.forEach(r=>{Rt(r.text,r.rect,t,e,!1,{runs:r.runs})}),At.add(e),e.setAttribute("data-pptx-extracted-text","1")):(Rt(n,r,t,e,!(a&&s),{useElementInsets:!0,runs:l}),At.add(e),e.setAttribute("data-pptx-extracted-text","1"))}})(),x.childNodes.forEach(t=>{const e=window.getComputedStyle(x);Wt(t,e,x)});const Ot=t=>/^data:image\\/(?:png|jpeg|jpg|gif);base64,/i.test(String(t||"")),jt=async(t,e,r)=>t?await new Promise(n=>{const o=t instanceof HTMLImageElement?t:new Image;let i="";const a=()=>{i&&URL.revokeObjectURL(i)},s=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,s=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=document.createElement("canvas");l.width=Math.max(1,Math.min(4096,Math.round(t*s))),l.height=Math.max(1,Math.min(4096,Math.round(i*s)));const c=l.getContext("2d");if(!c)return a(),void n("");c.clearRect(0,0,l.width,l.height),c.drawImage(o,0,0,l.width,l.height),a(),n(l.toDataURL("image/png"))}catch(t){a(),n("")}};if(t instanceof HTMLImageElement)return t.complete&&(t.naturalWidth||t.width)?void s():(t.addEventListener("load",s,{once:!0}),void t.addEventListener("error",()=>n(""),{once:!0}));o.onload=s,o.onerror=()=>{a(),n("")},t instanceof Blob?(i=URL.createObjectURL(t),o.src=i):(o.crossOrigin="anonymous",o.src=String(t))}):"",zt=async(t,e,r)=>{const n=String(t||"").trim();if(!n)return"";if(Ot(n))return n;if(/^data:image\\//i.test(n))return await jt(n,e,r);try{return await(async(t,e,r)=>{try{const n=await fetch(t);if(!n.ok)return"";const o=await n.blob(),i=String(o.type||"").toLowerCase();return/^image\\/(?:png|jpeg|jpg|gif)$/.test(i)?await(async t=>await new Promise(e=>{const r=new FileReader;r.onloadend=()=>e(String(r.result||"")),r.onerror=()=>e(""),r.readAsDataURL(t)}))(o):await jt(o,e,r)}catch{return""}})(new URL(n,document.baseURI).toString(),e,r)}catch{return""}},Ut=t=>{try{return t.width&&t.height?t.toDataURL("image/png"):""}catch{return""}},qt=async(t,e,r)=>{if(!t.currentSrc&&!t.src)return"";try{const n=t.currentSrc||t.src;return Ot(n)?n:await jt(t,e,r)||await zt(n,e,r)}catch{return await zt(t.currentSrc||t.src,e,r)}},$t=async(t,e,r)=>t?await new Promise(n=>{const o=new Image;o.onload=()=>{try{const t=Number(e)||o.naturalWidth||o.width||1,i=Number(r)||o.naturalHeight||o.height||1,a=Math.max(1,Math.min(2,window.devicePixelRatio||1)),s=document.createElement("canvas");s.width=Math.max(1,Math.min(4096,Math.round(t*a))),s.height=Math.max(1,Math.min(4096,Math.round(i*a)));const l=s.getContext("2d");if(!l)return void n("");l.clearRect(0,0,s.width,s.height),l.drawImage(o,0,0,s.width,s.height),n(s.toDataURL("image/png"))}catch(t){n("")}},o.onerror=()=>n(""),o.src=t}):"",Xt=async(t,e,r)=>Ot(t)?l<=128||t.length<=l?t:await new Promise(n=>{const o=new Image;o.onload=()=>{try{const i=o.naturalWidth||o.width||Number(e)||1,a=o.naturalHeight||o.height||Number(r)||1,s=Math.min(1,.9*Math.sqrt(l/t.length)),c=[s,.72*s,.5*s].filter((t,e,r)=>t>.08&&r.indexOf(t)===e);for(const t of c){const e=document.createElement("canvas");e.width=Math.max(1,Math.min(4096,Math.round(i*t))),e.height=Math.max(1,Math.min(4096,Math.round(a*t)));const r=e.getContext("2d");if(!r)continue;r.clearRect(0,0,e.width,e.height),r.drawImage(o,0,0,e.width,e.height);const s=e.toDataURL("image/png");if(s.length<=l)return void n(s);const c=e.toDataURL("image/jpeg",.9);if(c.length<=l)return void n(c)}}catch(t){}n("")},o.onerror=()=>n(""),o.src=t}):"",Vt=async(t,e,r)=>{try{const n=t.cloneNode(!0),o=(t,e)=>{if(!t||!e||t.nodeType!==Node.ELEMENT_NODE||e.nodeType!==Node.ELEMENT_NODE)return;const r=window.getComputedStyle(t),n=r.color||"";!n||e.getAttribute("color")&&"currentColor"!==e.getAttribute("color")||e.setAttribute("color",n),["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","letter-spacing","text-anchor","dominant-baseline","visibility","display"].forEach(t=>{const o=e.getAttribute(t),i=r.getPropertyValue(t)||r[t]||"";o&&"currentColor"!==o||!i||"none"===i?"currentColor"===o&&n&&e.setAttribute(t,n):e.setAttribute(t,i)});const i=Array.from(t.children||[]);Array.from(e.children||[]).forEach((t,e)=>o(i[e],t))};if(o(t,n),n.getAttribute("xmlns")||n.setAttribute("xmlns","http://www.w3.org/2000/svg"),!n.getAttribute("viewBox")&&t.getBBox)try{const e=t.getBBox();e&&e.width>0&&e.height>0&&n.setAttribute("viewBox",[e.x,e.y,e.width,e.height].join(" "))}catch(t){}const i=(new XMLSerializer).serializeToString(n),a=btoa(unescape(encodeURIComponent(i)));return await $t("data:image/svg+xml;base64,"+a,e,r)}catch{return""}};await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));const Gt=[],Kt=Array.from(x.querySelectorAll("img,canvas,svg"));for(const t of Kt){if(Gt.length>=a)break;const e=window.getComputedStyle(t),{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!k(t,e,r))continue;if(/blur/i.test(e.filter||""))continue;if(Number(e.opacity||"1")<.15)continue;const l=String(t.tagName||"").toUpperCase(),c="CANVAS"===l?Ut(t):"SVG"===l?await Vt(t,r.width,r.height):await qt(t,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:t.getAttribute("alt")||"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1"))}const Qt=new Set(Gt.map(t=>t.dataUri)),Yt=t=>{const e=String(t||"");if(!e||"none"===e)return[];const r=[],n=/url\\((?:["\']?)(.*?)(?:["\']?)\\)/gi;let o;for(;o=n.exec(e);){const t=String(o[1]||"").trim();t&&!t.startsWith("data:font/")&&r.push(t)}return r},Jt=[];for(const t of x.querySelectorAll("*")){if(Jt.length>=a)break;const e=window.getComputedStyle(t),r=e.backgroundImage||"";0!==Yt(r).length&&1===Yt(r).length&&!/gradient\\(|image-set\\(|cross-fade\\(/i.test(r)&&["auto","auto auto","100% 100%"].includes(String(e.backgroundSize||"").trim())&&/^(?:0(?:px|%)?\\s+)?0(?:px|%)?$/i.test(String(e.backgroundPosition||"").trim())&&"no-repeat"===String(e.backgroundRepeat||"").trim()&&Jt.push({el:t,style:e})}for(const{el:t,style:e}of Jt){if(Gt.length>=a)break;const{rect:r,x:n,y:o,w:i,h:s}=P(t);if(!k(t,e,r))continue;const l=Yt(e.backgroundImage||"")[0];if(!l)continue;const c=/^data:image\\/svg\\+xml;base64,/i.test(l)?await $t(l,r.width,r.height):await zt(l,r.width,r.height),d=await Xt(c,r.width,r.height);Ot(d)&&(Qt.has(d)||(Qt.add(d),Gt.push({dataUri:d,mimeType:d.match(/^data:(image\\/(?:png|jpeg|jpg|gif));base64,/i)?.[1]||"image/png",x:n,y:o,w:i,h:s,order:R(t),paintId:q(t),opacity:j(t),alt:"",rotate:v(e)}),t.setAttribute("data-pptx-extracted-image","1")))}return(t=>{const e=(()=>{const t=Array.from(z.entries()).filter(([,t])=>t&&t.isConnected);if(0===t.length)return new Map;const e=t.map(([t])=>t),r=new Map(t.map(([t,e])=>[t,O(e)])),n=(t,e)=>((t,e)=>{const r=t?.key||[],n=e?.key||[],o=Math.max(r.length,n.length);for(let t=0;t<o;t+=1){const e=r[t]||{z:0,order:0},o=n[t]||{z:0,order:0};if(e.z!==o.z)return e.z-o.z;if(e.order!==o.order)return e.order-o.order}return(t?.order||0)-(e?.order||0)})(r.get(t),r.get(e));if(!document.elementsFromPoint)return(()=>{const t=new Map;let r=1;return e.slice().sort(n).forEach(e=>{t.set(e,r),r+=1}),t})();const o=new Map(e.map(t=>[t,new Set])),i=new Map(e.map(t=>[t,0])),a=(t,e)=>{if(!(t&&e&&t!==e&&o.has(t)&&i.has(e)))return;const r=o.get(t);r.has(e)||(r.add(e),i.set(e,(i.get(e)||0)+1))},s=t=>{let e=t;for(;e&&e!==document&&e!==document.documentElement;){const t=e.getAttribute?.("data-pptx-paint-id")||"";if(t&&z.has(t))return t;e=e.parentElement}return""},l=(t,e)=>{const r=new Set,n=[];for(const o of document.elementsFromPoint(t,e)){const t=s(o);t&&!r.has(t)&&(r.add(t),n.push(t))}return n},c=t=>{const e=Math.max(0,t.left),r=Math.max(0,t.top),n=Math.min(window.innerWidth,t.right),o=Math.min(window.innerHeight,t.bottom);if(n<=e||o<=r)return[];const i=e+.25*(n-e),a=e+.5*(n-e),s=e+.75*(n-e),l=r+.25*(o-r),c=r+.5*(o-r),d=r+.75*(o-r);return[[a,c],[i,l],[s,l],[i,d],[s,d],[a,l],[a,d],[i,c],[s,c]]},d=document.createElement("style");d.id="ohmyppt-paint-order-pointer-events",d.textContent="[data-pptx-paint-id] { pointer-events: auto !important; }",document.head.appendChild(d);try{for(const[,e]of t){const t=e.getBoundingClientRect();for(const[e,r]of c(t)){const t=l(e,r);for(let e=0;e<t.length;e+=1)for(let r=e+1;r<t.length;r+=1)a(t[r],t[e])}}}finally{d.remove()}const h=e.filter(t=>0===(i.get(t)||0)).sort(n),u=new Map;let g=1;for(;h.length>0;){const t=h.shift();if(t&&!u.has(t)){u.set(t,g),g+=1;for(const e of o.get(t)||[])i.set(e,Math.max(0,(i.get(e)||0)-1)),0===(i.get(e)||0)&&(h.push(e),h.sort(n))}}return e.filter(t=>!u.has(t)).sort(n).forEach(t=>{u.set(t,g),g+=1}),u})();t.forEach(t=>{t&&t.paintId&&(e.has(t.paintId)&&(t.order=e.get(t.paintId)),delete t.paintId)})})([...wt,...Mt,...Gt]),{backgroundColor:L,shapes:wt,texts:Mt,images:Gt,tables:m}})()'.replaceAll("__HTML2PPTX_TEMPLATE_SLOT_0__",String(JSON.stringify(t.pageWidthPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_1__",String(JSON.stringify(t.pageHeightPx))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_2__",String(JSON.stringify(e))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_3__",String(JSON.stringify(r))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_4__",String(JSON.stringify(s))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_5__",String(JSON.stringify(c))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_6__",String(JSON.stringify(d))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_7__",String(JSON.stringify(u))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_8__",String(JSON.stringify(Math.ceil(4*h/3)+128))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_9__",String(JSON.stringify(l))).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_10__",String("\nconst rgbToHex = (value) => {\n const source = String(value || '').trim();\n if (!source || source === 'transparent') return '';\n if (source.startsWith('#')) {\n const raw = source.slice(1).toUpperCase();\n return raw.length === 3 ? raw.split('').map((part) => part + part).join('') : raw;\n }\n const match = source.match(/rgba?\\(\\s*(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*,\\s*|\\s+)(\\d+(?:\\.\\d+)?)(?:\\s*(?:,|\\/)\\s*(\\d+(?:\\.\\d+)?%?))?/i);\n if (!match) return '';\n const alpha = match[4] === undefined\n ? 1\n : String(match[4]).endsWith('%')\n ? Number.parseFloat(match[4]) / 100\n : Number(match[4]);\n if (alpha <= 0.02) return '';\n return [match[1], match[2], match[3]]\n .map((part) => Math.max(0, Math.min(255, Math.round(Number(part) || 0))).toString(16).padStart(2, '0'))\n .join('')\n .toUpperCase();\n};\n")).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_11__",String(g)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_12__",String(a)).replaceAll("__HTML2PPTX_TEMPLATE_SLOT_13__",String(a))},g=t=>{const e=t&&"object"==typeof t?t:{},r=d(String(e.text||""));if(!r)return null;const i=Math.max(1,Number(e.rowspan)||1),l=Math.max(1,Number(e.colspan)||1),h=e.border&&"object"==typeof e.border?e.border:null,g=h?c(String(h.color||""),""):"";return{text:r,rowspan:i,colspan:l,x:s(Number(e.x)||0,0,n),y:s(Number(e.y)||0,0,o),w:s(Number(e.w)||.1,.05,n),h:s(Number(e.h)||.05,.03,o),fontSize:e.fontSize?s(Number(e.fontSize),6,a):void 0,fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",valign:"middle"===e.valign||"bottom"===e.valign?e.valign:"top",fill:e.fill?c(String(e.fill),""):void 0,fillTransparency:e.fillTransparency?s(Number(e.fillTransparency),0,100):void 0,border:g?{color:g,widthPt:s(Number(h?.widthPt??.75),.1,20),dash:"dash"===h?.dash?"dash":"solid"}:void 0}},m=t=>{const e=t&&"object"==typeof t?t:{},r=Array.isArray(e.rows)?e.rows:[],i=Array.isArray(e.colWidths)?e.colWidths:[],a=Array.isArray(e.rowHeights)?e.rowHeights:[];if(0===r.length)return null;const l=r.map(t=>(Array.isArray(t)?t:[]).map(g).filter(t=>null!==t)).filter(t=>t.length>0);return 0===l.length?null:{x:s(Number(e.x)||0,0,n),y:s(Number(e.y)||0,0,o),w:s(Number(e.w)||.1,.1,n),h:s(Number(e.h)||.1,.1,o),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0,colWidths:i.map(t=>Math.max(.05,Number(t)||.05)),rowHeights:a.map(t=>Math.max(.03,Number(t)||.03)),rows:l}},p=t=>{const e=t&&"object"==typeof t?t:{},r=d(String(e.text||""));return r?{text:r,fontSize:Number(e.fontSize)>0?s(Number(e.fontSize),6,a):void 0,fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike)}:null},f=(t,e)=>{const r=t&&"object"==typeof t?t:{},l=Array.isArray(r.texts)?r.texts:[],h=Array.isArray(r.shapes)?r.shapes:[],g=Array.isArray(r.images)?r.images:[],f=Array.isArray(r.tables)?r.tables:[],b=l.map(t=>{const e=t&&"object"==typeof t?t:{},r=d(String(e.text||"")).slice(0,1e3);if(!r)return null;const i=Array.isArray(e.runs)?e.runs.map(p).filter(t=>null!==t):[],l=e.bullet&&"object"==typeof e.bullet?e.bullet:null,h="bullet"===l?.type||"number"===l?.type?l.type:void 0,g=h&&l?{type:h,level:Number.isFinite(Number(l.level))?s(Number(l.level),0,8):void 0,startAt:Number.isFinite(Number(l.startAt))?s(Number(l.startAt),1,32767):void 0}:void 0;return{text:r,x:s(Number(e.x)||0,0,n),y:s(Number(e.y)||0,0,o),w:s(Number(e.w)||.4,.1,n),h:s(Number(e.h)||.2,.08,o),fontSize:s(Number(e.fontSize)||12,6,a),fontFace:u(r,String(e.fontFace||"")),color:c(String(e.color||""),"111827"),bold:Boolean(e.bold),italic:Boolean(e.italic),underline:Boolean(e.underline),strike:Boolean(e.strike),align:"center"===e.align||"right"===e.align||"justify"===e.align?e.align:"left",opacity:s(Number(e.opacity??1),0,1),rotate:s(Number(e.rotate??0),-360,360),lineSpacing:Number(e.lineSpacing)>0?s(Number(e.lineSpacing),1,200):void 0,charSpacing:Number.isFinite(Number(e.charSpacing))?s(Number(e.charSpacing),-20,200):void 0,paragraphSpacingBefore:Number(e.paragraphSpacingBefore)>0?s(Number(e.paragraphSpacingBefore),0,72):void 0,paragraphSpacingAfter:Number(e.paragraphSpacingAfter)>0?s(Number(e.paragraphSpacingAfter),0,72):void 0,verticalAlign:"middle"===e.verticalAlign||"bottom"===e.verticalAlign?e.verticalAlign:"top",paddingLeft:Number(e.paddingLeft)>0?s(Number(e.paddingLeft),0,2):void 0,paddingRight:Number(e.paddingRight)>0?s(Number(e.paddingRight),0,2):void 0,paddingTop:Number(e.paddingTop)>0?s(Number(e.paddingTop),0,1):void 0,paddingBottom:Number(e.paddingBottom)>0?s(Number(e.paddingBottom),0,1):void 0,bullet:g,runs:i.length>0?i:void 0,wrap:Boolean(e.wrap),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),x=h.map(t=>{const e=t&&"object"==typeof t?t:{},r=c(String(e.fill||""),""),i=e.border&&"object"==typeof e.border?e.border:null,a=c(String(i?.color||""),"");if(!r&&!a)return null;const l="ellipse"===e.shapeType||"roundRect"===e.shapeType||"line"===e.shapeType?e.shapeType:"rect",d="line"===l?.001:.05,u="line"===l?.001:.05;return{x:s(Number(e.x)||0,0,n),y:s(Number(e.y)||0,0,o),w:s(Number(e.w)||d,d,n),h:s(Number(e.h)||u,u,o),fill:r,transparency:s(Number(e.transparency??0),0,100),radius:s(Number(e.radius??0),0,100),radiusAdj:s(Number(e.radiusAdj??0),0,5e4),border:a?{color:a,widthPt:s(Number(i?.widthPt??.75),.1,20),transparency:s(Number(i?.transparency??0),0,100),dash:"dash"===i?.dash?"dash":"solid"}:void 0,shapeType:l,rotate:s(Number(e.rotate??0),-360,360),flipV:Boolean(e.flipV),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0}}).filter(t=>Boolean(t)),S=g.map(t=>{const e=t&&"object"==typeof t?t:{},r=String(e.dataUri||""),a=(t=>{const e=t.match(/^data:(image\/(?:png|jpeg|jpg|gif));base64,/i);return e?"image/jpg"===e[1].toLowerCase()?"image/jpeg":e[1].toLowerCase():""})(r);return!a||(t=>{const e=t.indexOf(",");if(e<0)return 0;const r=t.slice(e+1).replace(/\s/g,"");if(!r)return 0;const n=r.endsWith("==")?2:r.endsWith("=")?1:0;return Math.max(0,Math.floor(3*r.length/4)-n)})(r)>i?null:{dataUri:r,mimeType:a,x:s(Number(e.x)||0,0,n),y:s(Number(e.y)||0,0,o),w:s(Number(e.w)||.1,.05,n),h:s(Number(e.h)||.1,.05,o),alt:(l=String(e.alt||""),l.replace(/\s+/g," ").replace(/[\u200b-\u200d\ufeff]/g,"").trim()),rotate:s(Number(e.rotate??0),-360,360),opacity:s(Number(e.opacity??1),0,1),order:Number.isFinite(Number(e.order))?Math.max(0,Number(e.order)):void 0};var l}).filter(t=>Boolean(t)),F=f.map(m).filter(t=>null!==t);return{title:e,backgroundColor:c(String(r.backgroundColor||""),"FFFFFF"),backgroundImage:void 0,texts:b,shapes:x,images:S,tables:F.length>0?F:void 0,overlayImages:void 0}},b=t=>r(t);export{h as buildHtmlToPptxExtractScript,b as generatePptx,f as normalizeExtractedHtmlToPptxSlide};
package/dist/node.cjs ADDED
@@ -0,0 +1 @@
1
+ var e=require("node:fs"),r=require("./ooxml-writer.cjs");require("fflate"),require("./animation-writer.cjs"),exports.writeHtmlToPptx=(i,t)=>{e.writeFileSync(i,r.buildPptxDocument(t))};
package/dist/node.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { HtmlToPptxDocument } from './types.js';
2
+ export declare const writeHtmlToPptx: (outputPath: string, document: HtmlToPptxDocument) => void;
package/dist/node.js ADDED
@@ -0,0 +1 @@
1
+ import{writeFileSync as o}from"node:fs";import{buildPptxDocument as r}from"./ooxml-writer.js";import"fflate";import"./animation-writer.js";const t=(t,i)=>{o(t,r(i))};export{t as writeHtmlToPptx};
@@ -0,0 +1 @@
1
+ var a=require("fflate"),t=require("./animation-writer.cjs");const e=13.333333333,n=a=>Math.round(914400*a),r=a=>Math.round(12700*a),l=a=>Math.round(6e4*a),s=a=>String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),o='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n',i=a=>{switch(a){case"center":return"ctr";case"right":return"r";case"justify":return"just";default:return"l"}},p=(a,t="000000")=>{if(!a)return t;const e=a.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(e)?e.split("").map(a=>a+a).join(""):/^[0-9A-F]{6}$/.test(e)?e:t};function c(a,t){const e=h(t.text);if(!e&&!t.runs?.length)return"";const r=t.runs&&t.runs.length>0,o=(a,e)=>{const n=[];if(t.align&&"left"!==t.align&&n.push(` algn="${i(t.align)}"`),t.bullet){const a=342900+228600*Math.max(0,Math.min(8,Math.floor(t.bullet.level||0))),e=-171450;n.push(` marL="${a}" indent="${e}"`)}if(t.paragraphSpacingBefore&&t.paragraphSpacingBefore>0&&n.push(`<a:spcBef><a:spcPts val="${Math.round(100*t.paragraphSpacingBefore)}"/></a:spcBef>`),t.paragraphSpacingAfter&&t.paragraphSpacingAfter>0&&n.push(`<a:spcAft><a:spcPts val="${Math.round(100*t.paragraphSpacingAfter)}"/></a:spcAft>`),t.lineSpacing&&t.lineSpacing>0&&n.push(`<a:lnSpc><a:spcPts val="${Math.round(100*t.lineSpacing)}"/></a:lnSpc>`),"number"===t.bullet?.type){const a=Math.max(1,Math.min(32767,Math.floor(t.bullet.startAt||1)));n.push(`<a:buAutoNum type="arabicPeriod" startAt="${a}"/>`)}else"bullet"===t.bullet?.type&&(n.push('<a:buFont typeface="Arial"/>'),n.push('<a:buChar char="•"/>'));const r=n.length>0?`<a:pPr${n.filter(a=>!a.startsWith("<")).join("")}>${n.filter(a=>a.startsWith("<")).join("")}</a:pPr>`:"<a:pPr/>";let l;if(e&&e.length>0)l=e.map(a=>function(a,t,e,n){const r=/[\u4e00-\u9fff]/.test(a.text)?"zh-CN":"en-US",l=a.fontSize?` sz="${Math.round(100*a.fontSize)}"`:t?` sz="${Math.round(100*t)}"`:"",o=a.bold?' b="1"':"",i=a.italic?' i="1"':"",p=a.underline?' u="sng"':"",c=a.strike?' strike="sngStrike"':"",m=f(a.color||"111827",n),d=a.fontFace||e;return`<a:r>\n <a:rPr lang="${r}"${l}${o}${i}${p}${c} dirty="0">\n ${m}\n <a:latin typeface="${s(d)}"/>\n <a:ea typeface="${s(d)}"/>\n </a:rPr>\n <a:t>${s(a.text)}</a:t>\n </a:r>`}(a,t.fontSize,t.fontFace||"Aptos",t.opacity)).join("\n ");else{const e=f(t.color||"111827",t.opacity),n=/[\u4e00-\u9fff]/.test(a)?"zh-CN":"en-US",r=t.fontSize?` sz="${Math.round(100*t.fontSize)}"`:"",o=t.bold?' b="1"':"",i=t.italic?' i="1"':"",p=t.underline?' u="sng"':"",c=t.strike?' strike="sngStrike"':"",m=t.charSpacing?` spc="${Math.round(100*t.charSpacing)}"`:"",d=t.fontFace||"Aptos";l=`<a:r>\n <a:rPr lang="${n}"${r}${o}${i}${p}${c}${m} dirty="0">\n ${e}\n <a:latin typeface="${s(d)}"/>\n <a:ea typeface="${s(d)}"/>\n </a:rPr>\n <a:t>${s(a)}</a:t>\n </a:r>`}return` <a:p>\n ${r}\n ${l}\n </a:p>`};let p;if(r){const a=[[]];for(const e of t.runs){const t=e.text.split("\n");for(let n=0;n<t.length;n++){n>0&&a.push([]);const r=t[n];r&&a[a.length-1].push({...e,text:r})}}p=a.filter(a=>a.length>0).map(a=>o("",a)).join("\n")}else p=e.split("\n").map(a=>o(a)).join("\n");const c=t.rotate?` rot="${l(t.rotate)}"`:"",m=t.wrap?"square":"none",d=t.wrap?'<a:normAutofit fontScale="100000"/>':"<a:noAutofit/>",g="middle"===t.verticalAlign?"ctr":"bottom"===t.verticalAlign?"b":"t",u=n(Math.max(0,t.paddingLeft??0)),x=n(Math.max(0,t.paddingRight??0)),$=n(Math.max(0,t.paddingTop??0)),y=n(Math.max(0,t.paddingBottom??0));return`<p:sp>\n <p:nvSpPr>\n <p:cNvPr id="${a}" name="TextBox ${a}"/>\n <p:cNvSpPr txBox="1"/>\n <p:nvPr/>\n </p:nvSpPr>\n <p:spPr>\n <a:xfrm${c}>\n <a:off x="${n(t.x)}" y="${n(t.y)}"/>\n <a:ext cx="${n(t.w)}" cy="${n(t.h)}"/>\n </a:xfrm>\n <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>\n <a:noFill/>\n </p:spPr>\n <p:txBody>\n <a:bodyPr wrap="${m}" lIns="${u}" tIns="${$}" rIns="${x}" bIns="${y}" anchor="${g}">${d}</a:bodyPr>\n <a:lstStyle/>\n${p}\n </p:txBody>\n </p:sp>`}function m(a,t,e){const r=e.rotate?` rot="${l(e.rotate)}"`:"",s="number"==typeof e.opacity&&Number.isFinite(e.opacity)?Math.max(0,Math.min(1,e.opacity)):1,o=s<.999?`<a:alphaModFix amt="${Math.round(1e5*s)}"/>`:"";return`<p:pic>\n <p:nvPicPr>\n <p:cNvPr id="${a}" name="Image ${a}"/>\n <p:cNvPicPr/>\n <p:nvPr/>\n </p:nvPicPr>\n <p:blipFill>\n ${o?`<a:blip r:embed="${t}">${o}</a:blip>`:`<a:blip r:embed="${t}"/>`}\n <a:stretch><a:fillRect/></a:stretch>\n </p:blipFill>\n <p:spPr>\n <a:xfrm${r}>\n <a:off x="${n(e.x)}" y="${n(e.y)}"/>\n <a:ext cx="${n(e.w)}" cy="${n(e.h)}"/>\n </a:xfrm>\n <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>\n </p:spPr>\n </p:pic>`}function d(a,t){const e=(a=>{switch(a){case"ellipse":return"ellipse";case"line":return"line";case"roundRect":return"roundRect";default:return"rect"}})(t.shapeType),s=[t.rotate?`rot="${l(t.rotate)}"`:"",t.flipV?'flipV="1"':""].filter(Boolean).join(" "),o=s?` ${s}`:"";let i,c,m;if("roundRect"===e&&t.radius){const a=t.radius/120,e=Math.min(t.w,t.h)>0?Math.round(a/Math.min(t.w,t.h)*1e5):0;i=`<a:prstGeom prst="roundRect"><a:avLst><a:gd name="adj" fmla="val ${Math.min(5e4,Math.max(0,Math.round(t.radiusAdj||e)))}"/></a:avLst></a:prstGeom>`}else i=`<a:prstGeom prst="${e}"><a:avLst/></a:prstGeom>`;if(t.fill){const a=p(t.fill),e=void 0!==t.transparency?Math.round(1e3*(100-t.transparency)):1e5;c=e<1e5?`<a:solidFill><a:srgbClr val="${a}"><a:alpha val="${e}"/></a:srgbClr></a:solidFill>`:`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill>`}else c="<a:noFill/>";if(t.border){const a=p(t.border.color),e=r(t.border.widthPt),n=void 0!==t.border.transparency?Math.round(1e3*(100-t.border.transparency)):1e5;m=`<a:ln w="${e}">${n<1e5?`<a:solidFill><a:srgbClr val="${a}"><a:alpha val="${n}"/></a:srgbClr></a:solidFill>`:`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill>`}<a:prstDash val="${"dash"===t.border.dash?"dash":"solid"}"/></a:ln>`}else m="<a:ln><a:noFill/></a:ln>";return`<p:sp>\n <p:nvSpPr>\n <p:cNvPr id="${a}" name="Shape ${a}"/>\n <p:cNvSpPr/>\n <p:nvPr/>\n </p:nvSpPr>\n <p:spPr>\n <a:xfrm${o}>\n <a:off x="${n(t.x)}" y="${n(t.y)}"/>\n <a:ext cx="${n(t.w)}" cy="${n(t.h)}"/>\n </a:xfrm>\n ${i}\n ${c}\n ${m}\n </p:spPr>\n </p:sp>`}function f(a,t){const e=p(a);return void 0!==t&&t<1?`<a:solidFill><a:srgbClr val="${e}"><a:alpha val="${Math.round(1e5*t)}"/></a:srgbClr></a:solidFill>`:`<a:solidFill><a:srgbClr val="${e}"/></a:solidFill>`}function h(a){const t=a.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(a=>a.replace(/[^\S\n]+/g," ").trim());for(;t.length>0&&!t[0];)t.shift();for(;t.length>0&&!t[t.length-1];)t.pop();return t.join("\n")}function g(a,t){const e=t.colWidths.length>0?t.colWidths.length:Math.max(1,...t.rows.map(a=>a.reduce((a,t)=>a+Math.max(1,t.colspan||1),0))),l=t.rows.length,o=Array.from({length:l},()=>new Array(e).fill(null));for(let a=0;a<l;a++){let n=0;for(const r of t.rows[a]){const t=Math.max(1,r.rowspan||1),s=Math.max(1,r.colspan||1);for(;n<e&&o[a][n];)n++;if(n>=e)break;const i=Math.min(t,l-a),p=Math.min(s,e-n);for(let t=0;t<i;t++)for(let e=0;e<p;e++)o[a+t][n+e]={cell:r,origin:0===t&&0===e,rowSpan:i,colSpan:p,hMerge:e>0,vMerge:t>0};n+=p}}const c=(t.colWidths.length>0?t.colWidths:Array(e).fill(t.w/e)).map(a=>`<a:gridCol w="${n(a)}"/>`).join("\n "),m=(a="")=>`<a:tc${a}>\n <a:txBody>\n <a:bodyPr/>\n <a:lstStyle/>\n <a:p><a:endParaRPr lang="zh-CN"/></a:p>\n </a:txBody>\n <a:tcPr/>\n </a:tc>`,d=t.rows.map((a,c)=>{const d=t.rowHeights[c]||t.h/l,f=[];for(let a=0;a<e;a++){const t=o[c][a];if(!t){f.push(m());continue}if(!t.origin){const a=[t.hMerge?'hMerge="1"':"",t.vMerge?'vMerge="1"':""].filter(Boolean).join(" ");f.push(m(a?` ${a}`:""));continue}const e=t.cell,n=t.colSpan,l=t.rowSpan,d=n>1?` gridSpan="${n}"`:"",g=l>1?` rowSpan="${l}"`:"",u=h(e.text||""),x=/[\u4e00-\u9fff]/.test(u)?"zh-CN":"en-US",$=e.fontSize?` sz="${Math.round(100*e.fontSize)}"`:"",y=e.bold?' b="1"':"",b=e.italic?' i="1"':"",v=e.underline?' u="sng"':"",S=e.strike?' strike="sngStrike"':"",F=p(e.color||"111827"),M=e.fontFace||"Aptos",P=i(e.align);let C;C=u?`<a:p>\n <a:pPr algn="${P}"/>\n <a:r>\n <a:rPr lang="${x}"${$}${y}${b}${v}${S} dirty="0">\n <a:solidFill><a:srgbClr val="${F}"/></a:solidFill>\n <a:latin typeface="${s(M)}"/>\n <a:ea typeface="${s(M)}"/>\n </a:rPr>\n <a:t>${s(u)}</a:t>\n </a:r>\n </a:p>`:`<a:p><a:pPr algn="${P}"/><a:endParaRPr lang="zh-CN"/></a:p>`;const w=[],T=[];if("middle"===e.valign?T.push('anchor="ctr"'):"bottom"===e.valign&&T.push('anchor="b"'),e.fill){const a=p(e.fill),t=void 0!==e.fillTransparency?Math.round(1e3*(100-e.fillTransparency)):1e5;t<1e5?w.push(`<a:solidFill><a:srgbClr val="${a}"><a:alpha val="${t}"/></a:srgbClr></a:solidFill>`):w.push(`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill>`)}if(e.border){const a=p(e.border.color),t=r(e.border.widthPt),n=`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill><a:prstDash val="${"dash"===e.border.dash?"dash":"solid"}"/>`;w.push(`<a:lnL w="${t}">${n}</a:lnL>`,`<a:lnR w="${t}">${n}</a:lnR>`,`<a:lnT w="${t}">${n}</a:lnT>`,`<a:lnB w="${t}">${n}</a:lnB>`)}else{const a='<a:solidFill><a:srgbClr val="D9D9D9"/></a:solidFill>';w.push(`<a:lnL w="12700">${a}</a:lnL>`,`<a:lnR w="12700">${a}</a:lnR>`,`<a:lnT w="12700">${a}</a:lnT>`,`<a:lnB w="12700">${a}</a:lnB>`)}const I=w.length>0||T.length>0?`<a:tcPr${T.length>0?` ${T.join(" ")}`:""}>${w.join("")}</a:tcPr>`:"";f.push(`<a:tc${d}${g}>\n <a:txBody>\n <a:bodyPr/>\n <a:lstStyle/>\n ${C}\n </a:txBody>\n ${I}\n </a:tc>`)}return`<a:tr h="${n(d)}">\n ${f.join("\n ")}\n </a:tr>`}).join("\n ");return`<p:graphicFrame>\n <p:nvGraphicFramePr>\n <p:cNvPr id="${a}" name="Table ${a}"/>\n <p:cNvGraphicFramePr/>\n <p:nvPr/>\n </p:nvGraphicFramePr>\n <p:xfrm>\n <a:off x="${n(t.x)}" y="${n(t.y)}"/>\n <a:ext cx="${n(t.w)}" cy="${n(t.h)}"/>\n </p:xfrm>\n <a:graphic>\n <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">\n <a:tbl>\n <a:tblPr firstRow="0" lastRow="0" firstCol="0" lastCol="0" noBandRow="1" noBandCol="1">\n </a:tblPr>\n <a:tblGrid>\n ${c}\n </a:tblGrid>\n ${d}\n </a:tbl>\n </a:graphicData>\n </a:graphic>\n </p:graphicFrame>`}const u=(a,t)=>Number.isFinite(a)?Number(a):t,x=a=>({x:a.x/1600*e,y:a.y/900*7.5,w:a.w/1600*e,h:a.h/900*7.5}),$=(a,t)=>Math.max(0,Math.min(a.x+a.w,t.x+t.w)-Math.max(a.x,t.x))*Math.max(0,Math.min(a.y+a.h,t.y+t.h)-Math.max(a.y,t.y)),y=(a,t)=>{const e=a.x+a.w/2,n=a.y+a.h/2;return e>=t.x&&e<=t.x+t.w&&n>=t.y&&n<=t.y+t.h};function b(a,n,r){let l=r;const s=[],i=[],f=(a,t)=>{i.push({pptxId:a,x:t.x,y:t.y,w:t.w,h:t.h})};let h="";if(a.backgroundColor&&(h=`<p:bg><p:bgPr><a:solidFill><a:srgbClr val="${p(a.backgroundColor)}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>`),a.backgroundImage){l++;const t=n.get(a.backgroundImage.dataUri);t&&s.push(m(l,t.rId,{dataUri:a.backgroundImage.dataUri,mimeType:a.backgroundImage.mimeType,x:0,y:0,w:e,h:7.5,alt:a.backgroundImage.alt}))}const b=[];let v=1e6;for(const t of a.shapes||[])b.push({kind:"shape",order:u(t.order,v++),priority:10,item:t});for(const t of a.tables||[])b.push({kind:"table",order:u(t.order,v++),priority:20,item:t});for(const t of a.images||[])b.push({kind:"image",order:u(t.order,v++),priority:30,item:t});for(const t of a.texts)b.push({kind:"text",order:u(t.order,v++),priority:40,item:t});b.sort((a,t)=>a.order-t.order||a.priority-t.priority);for(const a of b)if(l++,"shape"===a.kind)s.push(d(l,a.item)),f(l,a.item);else if("table"===a.kind)s.push(g(l,a.item)),f(l,a.item);else if("image"===a.kind){const t=n.get(a.item.dataUri);t&&(s.push(m(l,t.rId,a.item)),f(l,a.item))}else{const t=c(l,a.item);t&&(s.push(t),f(l,a.item))}for(const t of a.overlayImages||[]){l++;const a=n.get(t.dataUri);a&&(s.push(m(l,a.rId,t)),f(l,t))}const S=t.buildSlideTimingXml(function(a,t){if(!a?.length||0===t.length)return[];const e=[],n=new Set,r=[...a].sort((a,t)=>a.order-t.order||a.delay-t.delay);for(const a of r){const r=x(a),l=Math.max(1e-4,r.w*r.h),s=t.map(a=>{const t={x:a.x,y:a.y,w:a.w,h:a.h},e=$(r,t),n=Math.max(1e-4,a.w*a.h);return{shape:a,overlap:e,eligible:e>0&&(y(t,r)||e/n>=.35||e/l>=.16)}}).filter(a=>a.eligible&&!n.has(a.shape.pptxId)).sort((a,t)=>t.overlap-a.overlap||a.shape.pptxId-t.shape.pptxId),o=s.length>0?s.map(a=>a.shape):t.map(a=>{const t={x:a.x,y:a.y,w:a.w,h:a.h};return{shape:a,overlap:$(r,t)}}).filter(a=>a.overlap>0&&!n.has(a.shape.pptxId)).sort((a,t)=>t.overlap-a.overlap).slice(0,1).map(a=>a.shape);for(const t of o)n.add(t.pptxId),e.push({spid:t.pptxId,type:a.type,trigger:a.trigger,clickGroup:a.clickGroup,from:a.from,path:a.path,duration:a.duration,delay:a.delay,order:a.order})}return e}(a.animationTraces,i)),F=a.transitionType?t.buildSlideTransitionXml(a.transitionType,a.transitionDurationMs):"";return`${o}<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">\n <p:cSld>\n ${h}\n <p:spTree>\n <p:nvGrpSpPr>\n <p:cNvPr id="1" name=""/>\n <p:cNvGrpSpPr/>\n <p:nvPr/>\n </p:nvGrpSpPr>\n <p:grpSpPr>\n <a:xfrm>\n <a:off x="0" y="0"/>\n <a:ext cx="0" cy="0"/>\n <a:chOff x="0" y="0"/>\n <a:chExt cx="0" cy="0"/>\n </a:xfrm>\n </p:grpSpPr>\n ${s.join("\n ")}\n </p:spTree>\n </p:cSld>\n <p:clrMapOvr>\n <a:masterClrMapping/>\n </p:clrMapOvr>\n ${F}\n ${S}\n</p:sld>`}function v(a){const t=['<Relationship Id="rIdLayout" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>'];for(const e of a)t.push(`<Relationship Id="${e.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/${e.mediaFile}"/>`);return`${o}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n ${t.join("\n ")}\n</Relationships>`}function S(a){const t=a.match(/^data:image\/(png|jpeg|jpg|gif);base64,(.+)$/i);if(!t)return null;const e=t[1].toLowerCase(),n="jpg"===e?"jpg":e,r=atob(t[2]),l=new Uint8Array(r.length);for(let a=0;a<r.length;a++)l[a]=r.charCodeAt(a);return{buffer:l,ext:n}}exports.buildPptxDocument=t=>{const e=t.slides.length>0?t.slides:[{texts:[]}],n=e.length,r=t.embeddedFonts||[],l=new Map;let i=0;const p=a=>{if(l.has(a))return;const t=S(a);if(!t)return;i++;const e=`image${i}.${t.ext}`;l.set(a,{mediaFile:e,ext:t.ext})};for(const a of e){a.backgroundImage&&p(a.backgroundImage.dataUri);for(const t of a.images||[])p(t.dataUri);for(const t of a.overlayImages||[])p(t.dataUri)}const c=[];for(const a of e){const t=new Map;let e=0;const n=a=>{if(t.has(a))return;const n=l.get(a);n&&(e++,t.set(a,{rId:`rId${e}`,mediaFile:n.mediaFile}))};a.backgroundImage&&n(a.backgroundImage.dataUri);for(const t of a.images||[])n(t.dataUri);for(const t of a.overlayImages||[])n(t.dataUri);c.push(t)}const m=new Set;for(const[,a]of l)m.add(a.ext);const d=new Map,f=[],h=new Map;let g=n+1,u=1;for(const a of r){const t=`${a.fontFace}::${a.style}`;if(d.has(t))continue;const e=`rId${g}`,n=`font${u}.fntdata`;d.set(t,e),f.push({key:t,rId:e,fontFile:n}),h.set(n,a.ttfBuffer),g++,u++}const x=f.length>0,$={};$["[Content_Types].xml"]=a.strToU8(function(a,t,e=!1){const n=['<Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>','<Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>','<Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>','<Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>'];for(let t=1;t<=a;t++)n.push(`<Override PartName="/ppt/slides/slide${t}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`);const r=['<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>','<Default Extension="xml" ContentType="application/xml"/>'];e&&r.push('<Default Extension="fntdata" ContentType="application/x-fontdata"/>');for(const a of t){const t="jpg"===a||"jpeg"===a?"image/jpeg":"svg"===a?"image/svg+xml":`image/${a}`;r.push(`<Default Extension="${a}" ContentType="${t}"/>`)}return`${o}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">\n ${r.join("\n ")}\n ${n.join("\n ")}\n</Types>`}(n,m,x)),$["_rels/.rels"]=a.strToU8(`${o}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>\n</Relationships>`),$["ppt/presentation.xml"]=a.strToU8(function(a,t=[],e=new Map){const n=[];for(let t=1;t<=a;t++)n.push(`<p:sldId id="${255+t}" r:id="rId${t}"/>`);let r="";if(t.length>0){const a=new Map;for(const e of t){const t=a.get(e.fontFace)||[];t.push(e),a.set(e.fontFace,t)}const n=["regular","bold","italic","boldItalic"],l=[];for(const[t,r]of a){const a=[];for(const t of n){const n=r.find(a=>a.style===t);if(!n)continue;const l=e.get(`${n.fontFace}::${n.style}`);l&&a.push(` <p:${t} r:id="${l}"/>`)}if(0===a.length)continue;const o=/[\u3400-\u9fff]|(?:Noto Sans SC|Ma Shan Zheng|Source Han|PingFang|Microsoft YaHei)/i.test(t)?"134":"0";l.push(` <p:embeddedFont>\n <p:font typeface="${s(t)}" panose="0 0 0 0 0 0 0 0 0 0" pitchFamily="34" charset="${o}"/>\n${a.join("\n")}\n </p:embeddedFont>`)}l.length>0&&(r=`\n<p:embeddedFontLst>\n${l.join("\n")}\n</p:embeddedFontLst>`)}return`${o}<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"\n embedTrueTypeFonts="1"\n saveSubsetFonts="1">\n <p:sldMasterIdLst>\n <p:sldMasterId id="2147483648" r:id="rIdSm"/>\n </p:sldMasterIdLst>\n <p:sldIdLst>\n ${n.join("\n ")}\n </p:sldIdLst>\n <p:sldSz cx="12192000" cy="6858000" type="wide"/>\n <p:notesSz cx="6858000" cy="12192000"/>${r}\n</p:presentation>`}(n,r,d)),$["ppt/_rels/presentation.xml.rels"]=a.strToU8(function(a,t=[]){const e=['<Relationship Id="rIdSm" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>'];for(let t=1;t<=a;t++)e.push(`<Relationship Id="rId${t}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide${t}.xml"/>`);for(const a of t)e.push(`<Relationship Id="${a.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/font" Target="fonts/${a.fontFile}"/>`);return`${o}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n ${e.join("\n ")}\n</Relationships>`}(n,f)),$["ppt/theme/theme1.xml"]=a.strToU8(`${o}<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">\n <a:themeElements>\n <a:clrScheme name="Office">\n <a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>\n <a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>\n <a:dk2><a:srgbClr val="44546A"/></a:dk2>\n <a:lt2><a:srgbClr val="E7E6E6"/></a:lt2>\n <a:accent1><a:srgbClr val="4472C4"/></a:accent1>\n <a:accent2><a:srgbClr val="ED7D31"/></a:accent2>\n <a:accent3><a:srgbClr val="A5A5A5"/></a:accent3>\n <a:accent4><a:srgbClr val="FFC000"/></a:accent4>\n <a:accent5><a:srgbClr val="5B9BD5"/></a:accent5>\n <a:accent6><a:srgbClr val="70AD47"/></a:accent6>\n <a:hlink><a:srgbClr val="0563C1"/></a:hlink>\n <a:folHlink><a:srgbClr val="954F72"/></a:folHlink>\n </a:clrScheme>\n <a:fontScheme name="Office">\n <a:majorFont>\n <a:latin typeface="Aptos Display"/>\n <a:ea typeface=""/>\n <a:cs typeface=""/>\n </a:majorFont>\n <a:minorFont>\n <a:latin typeface="Aptos"/>\n <a:ea typeface=""/>\n <a:cs typeface=""/>\n </a:minorFont>\n </a:fontScheme>\n <a:fmtScheme name="Office">\n <a:fillStyleLst>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n </a:fillStyleLst>\n <a:lnStyleLst>\n <a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln>\n <a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln>\n <a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln>\n </a:lnStyleLst>\n <a:effectStyleLst>\n <a:effectStyle><a:effectLst/></a:effectStyle>\n <a:effectStyle><a:effectLst/></a:effectStyle>\n <a:effectStyle><a:effectLst/></a:effectStyle>\n </a:effectStyleLst>\n <a:bgFillStyleLst>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n </a:bgFillStyleLst>\n </a:fmtScheme>\n </a:themeElements>\n <a:objectDefaults/>\n <a:extraClrSchemeLst/>\n</a:theme>`),$["ppt/slideMasters/slideMaster1.xml"]=a.strToU8(`${o}<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">\n <p:cSld>\n <p:bg>\n <p:bgRef idx="1001">\n <a:schemeClr val="bg1"/>\n </p:bgRef>\n </p:bg>\n <p:spTree>\n <p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>\n <p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>\n </p:spTree>\n </p:cSld>\n <p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>\n <p:sldLayoutIdLst>\n <p:sldLayoutId id="2147483649" r:id="rId1"/>\n </p:sldLayoutIdLst>\n</p:sldMaster>`),$["ppt/slideMasters/_rels/slideMaster1.xml.rels"]=a.strToU8(`${o}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>\n <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>\n</Relationships>`),$["ppt/slideLayouts/slideLayout1.xml"]=a.strToU8(`${o}<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="blank" preserve="1">\n <p:cSld name="Blank">\n <p:spTree>\n <p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>\n <p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>\n </p:spTree>\n </p:cSld>\n <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>\n</p:sldLayout>`),$["ppt/slideLayouts/_rels/slideLayout1.xml.rels"]=a.strToU8(`${o}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster1.xml"/>\n</Relationships>`);for(let t=0;t<n;t++){const n=c[t],r=Array.from(n.values());$[`ppt/slides/slide${t+1}.xml`]=a.strToU8(b(e[t],n,1)),$[`ppt/slides/_rels/slide${t+1}.xml.rels`]=a.strToU8(v(r))}for(const[a,t]of l){const e=S(a);e&&($[`ppt/media/${t.mediaFile}`]=e.buffer)}for(const[a,t]of h)$[`ppt/fonts/${a}`]=t;return a.zipSync($,{level:6})},exports.buildSlideXml=b;
@@ -0,0 +1,8 @@
1
+ import type { HtmlToPptxDocument, HtmlToPptxSlide } from './types.js';
2
+ interface ImageRel {
3
+ rId: string;
4
+ mediaFile: string;
5
+ }
6
+ export declare function buildSlideXml(slide: HtmlToPptxSlide, imageRels: Map<string, ImageRel>, idStart: number): string;
7
+ export declare const buildPptxDocument: (document: HtmlToPptxDocument) => Uint8Array;
8
+ export {};
@@ -0,0 +1 @@
1
+ import{strToU8 as a,zipSync as t}from"fflate";import{buildSlideTimingXml as n,buildSlideTransitionXml as e}from"./animation-writer.js";const r=13.333333333,l=a=>Math.round(914400*a),s=a=>Math.round(12700*a),o=a=>Math.round(6e4*a),i=a=>String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),p='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n',c=a=>{switch(a){case"center":return"ctr";case"right":return"r";case"justify":return"just";default:return"l"}},m=(a,t="000000")=>{if(!a)return t;const n=a.trim().replace(/^#/,"").toUpperCase();return/^[0-9A-F]{3}$/.test(n)?n.split("").map(a=>a+a).join(""):/^[0-9A-F]{6}$/.test(n)?n:t};function d(a,t){const n=u(t.text);if(!n&&!t.runs?.length)return"";const e=t.runs&&t.runs.length>0,r=(a,n)=>{const e=[];if(t.align&&"left"!==t.align&&e.push(` algn="${c(t.align)}"`),t.bullet){const a=342900+228600*Math.max(0,Math.min(8,Math.floor(t.bullet.level||0))),n=-171450;e.push(` marL="${a}" indent="${n}"`)}if(t.paragraphSpacingBefore&&t.paragraphSpacingBefore>0&&e.push(`<a:spcBef><a:spcPts val="${Math.round(100*t.paragraphSpacingBefore)}"/></a:spcBef>`),t.paragraphSpacingAfter&&t.paragraphSpacingAfter>0&&e.push(`<a:spcAft><a:spcPts val="${Math.round(100*t.paragraphSpacingAfter)}"/></a:spcAft>`),t.lineSpacing&&t.lineSpacing>0&&e.push(`<a:lnSpc><a:spcPts val="${Math.round(100*t.lineSpacing)}"/></a:lnSpc>`),"number"===t.bullet?.type){const a=Math.max(1,Math.min(32767,Math.floor(t.bullet.startAt||1)));e.push(`<a:buAutoNum type="arabicPeriod" startAt="${a}"/>`)}else"bullet"===t.bullet?.type&&(e.push('<a:buFont typeface="Arial"/>'),e.push('<a:buChar char="•"/>'));const r=e.length>0?`<a:pPr${e.filter(a=>!a.startsWith("<")).join("")}>${e.filter(a=>a.startsWith("<")).join("")}</a:pPr>`:"<a:pPr/>";let l;if(n&&n.length>0)l=n.map(a=>function(a,t,n,e){const r=/[\u4e00-\u9fff]/.test(a.text)?"zh-CN":"en-US",l=a.fontSize?` sz="${Math.round(100*a.fontSize)}"`:t?` sz="${Math.round(100*t)}"`:"",s=a.bold?' b="1"':"",o=a.italic?' i="1"':"",p=a.underline?' u="sng"':"",c=a.strike?' strike="sngStrike"':"",m=g(a.color||"111827",e),d=a.fontFace||n;return`<a:r>\n <a:rPr lang="${r}"${l}${s}${o}${p}${c} dirty="0">\n ${m}\n <a:latin typeface="${i(d)}"/>\n <a:ea typeface="${i(d)}"/>\n </a:rPr>\n <a:t>${i(a.text)}</a:t>\n </a:r>`}(a,t.fontSize,t.fontFace||"Aptos",t.opacity)).join("\n ");else{const n=g(t.color||"111827",t.opacity),e=/[\u4e00-\u9fff]/.test(a)?"zh-CN":"en-US",r=t.fontSize?` sz="${Math.round(100*t.fontSize)}"`:"",s=t.bold?' b="1"':"",o=t.italic?' i="1"':"",p=t.underline?' u="sng"':"",c=t.strike?' strike="sngStrike"':"",m=t.charSpacing?` spc="${Math.round(100*t.charSpacing)}"`:"",d=t.fontFace||"Aptos";l=`<a:r>\n <a:rPr lang="${e}"${r}${s}${o}${p}${c}${m} dirty="0">\n ${n}\n <a:latin typeface="${i(d)}"/>\n <a:ea typeface="${i(d)}"/>\n </a:rPr>\n <a:t>${i(a)}</a:t>\n </a:r>`}return` <a:p>\n ${r}\n ${l}\n </a:p>`};let s;if(e){const a=[[]];for(const n of t.runs){const t=n.text.split("\n");for(let e=0;e<t.length;e++){e>0&&a.push([]);const r=t[e];r&&a[a.length-1].push({...n,text:r})}}s=a.filter(a=>a.length>0).map(a=>r("",a)).join("\n")}else s=n.split("\n").map(a=>r(a)).join("\n");const p=t.rotate?` rot="${o(t.rotate)}"`:"",m=t.wrap?"square":"none",d=t.wrap?'<a:normAutofit fontScale="100000"/>':"<a:noAutofit/>",f="middle"===t.verticalAlign?"ctr":"bottom"===t.verticalAlign?"b":"t",h=l(Math.max(0,t.paddingLeft??0)),x=l(Math.max(0,t.paddingRight??0)),$=l(Math.max(0,t.paddingTop??0)),y=l(Math.max(0,t.paddingBottom??0));return`<p:sp>\n <p:nvSpPr>\n <p:cNvPr id="${a}" name="TextBox ${a}"/>\n <p:cNvSpPr txBox="1"/>\n <p:nvPr/>\n </p:nvSpPr>\n <p:spPr>\n <a:xfrm${p}>\n <a:off x="${l(t.x)}" y="${l(t.y)}"/>\n <a:ext cx="${l(t.w)}" cy="${l(t.h)}"/>\n </a:xfrm>\n <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>\n <a:noFill/>\n </p:spPr>\n <p:txBody>\n <a:bodyPr wrap="${m}" lIns="${h}" tIns="${$}" rIns="${x}" bIns="${y}" anchor="${f}">${d}</a:bodyPr>\n <a:lstStyle/>\n${s}\n </p:txBody>\n </p:sp>`}function f(a,t,n){const e=n.rotate?` rot="${o(n.rotate)}"`:"",r="number"==typeof n.opacity&&Number.isFinite(n.opacity)?Math.max(0,Math.min(1,n.opacity)):1,s=r<.999?`<a:alphaModFix amt="${Math.round(1e5*r)}"/>`:"";return`<p:pic>\n <p:nvPicPr>\n <p:cNvPr id="${a}" name="Image ${a}"/>\n <p:cNvPicPr/>\n <p:nvPr/>\n </p:nvPicPr>\n <p:blipFill>\n ${s?`<a:blip r:embed="${t}">${s}</a:blip>`:`<a:blip r:embed="${t}"/>`}\n <a:stretch><a:fillRect/></a:stretch>\n </p:blipFill>\n <p:spPr>\n <a:xfrm${e}>\n <a:off x="${l(n.x)}" y="${l(n.y)}"/>\n <a:ext cx="${l(n.w)}" cy="${l(n.h)}"/>\n </a:xfrm>\n <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>\n </p:spPr>\n </p:pic>`}function h(a,t){const n=(a=>{switch(a){case"ellipse":return"ellipse";case"line":return"line";case"roundRect":return"roundRect";default:return"rect"}})(t.shapeType),e=[t.rotate?`rot="${o(t.rotate)}"`:"",t.flipV?'flipV="1"':""].filter(Boolean).join(" "),r=e?` ${e}`:"";let i,p,c;if("roundRect"===n&&t.radius){const a=t.radius/120,n=Math.min(t.w,t.h)>0?Math.round(a/Math.min(t.w,t.h)*1e5):0;i=`<a:prstGeom prst="roundRect"><a:avLst><a:gd name="adj" fmla="val ${Math.min(5e4,Math.max(0,Math.round(t.radiusAdj||n)))}"/></a:avLst></a:prstGeom>`}else i=`<a:prstGeom prst="${n}"><a:avLst/></a:prstGeom>`;if(t.fill){const a=m(t.fill),n=void 0!==t.transparency?Math.round(1e3*(100-t.transparency)):1e5;p=n<1e5?`<a:solidFill><a:srgbClr val="${a}"><a:alpha val="${n}"/></a:srgbClr></a:solidFill>`:`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill>`}else p="<a:noFill/>";if(t.border){const a=m(t.border.color),n=s(t.border.widthPt),e=void 0!==t.border.transparency?Math.round(1e3*(100-t.border.transparency)):1e5;c=`<a:ln w="${n}">${e<1e5?`<a:solidFill><a:srgbClr val="${a}"><a:alpha val="${e}"/></a:srgbClr></a:solidFill>`:`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill>`}<a:prstDash val="${"dash"===t.border.dash?"dash":"solid"}"/></a:ln>`}else c="<a:ln><a:noFill/></a:ln>";return`<p:sp>\n <p:nvSpPr>\n <p:cNvPr id="${a}" name="Shape ${a}"/>\n <p:cNvSpPr/>\n <p:nvPr/>\n </p:nvSpPr>\n <p:spPr>\n <a:xfrm${r}>\n <a:off x="${l(t.x)}" y="${l(t.y)}"/>\n <a:ext cx="${l(t.w)}" cy="${l(t.h)}"/>\n </a:xfrm>\n ${i}\n ${p}\n ${c}\n </p:spPr>\n </p:sp>`}function g(a,t){const n=m(a);return void 0!==t&&t<1?`<a:solidFill><a:srgbClr val="${n}"><a:alpha val="${Math.round(1e5*t)}"/></a:srgbClr></a:solidFill>`:`<a:solidFill><a:srgbClr val="${n}"/></a:solidFill>`}function u(a){const t=a.replace(/\r\n?/g,"\n").replace(/[\u200b-\u200d\ufeff]/g,"").split("\n").map(a=>a.replace(/[^\S\n]+/g," ").trim());for(;t.length>0&&!t[0];)t.shift();for(;t.length>0&&!t[t.length-1];)t.pop();return t.join("\n")}function x(a,t){const n=t.colWidths.length>0?t.colWidths.length:Math.max(1,...t.rows.map(a=>a.reduce((a,t)=>a+Math.max(1,t.colspan||1),0))),e=t.rows.length,r=Array.from({length:e},()=>new Array(n).fill(null));for(let a=0;a<e;a++){let l=0;for(const s of t.rows[a]){const t=Math.max(1,s.rowspan||1),o=Math.max(1,s.colspan||1);for(;l<n&&r[a][l];)l++;if(l>=n)break;const i=Math.min(t,e-a),p=Math.min(o,n-l);for(let t=0;t<i;t++)for(let n=0;n<p;n++)r[a+t][l+n]={cell:s,origin:0===t&&0===n,rowSpan:i,colSpan:p,hMerge:n>0,vMerge:t>0};l+=p}}const o=(t.colWidths.length>0?t.colWidths:Array(n).fill(t.w/n)).map(a=>`<a:gridCol w="${l(a)}"/>`).join("\n "),p=(a="")=>`<a:tc${a}>\n <a:txBody>\n <a:bodyPr/>\n <a:lstStyle/>\n <a:p><a:endParaRPr lang="zh-CN"/></a:p>\n </a:txBody>\n <a:tcPr/>\n </a:tc>`,d=t.rows.map((a,o)=>{const d=t.rowHeights[o]||t.h/e,f=[];for(let a=0;a<n;a++){const t=r[o][a];if(!t){f.push(p());continue}if(!t.origin){const a=[t.hMerge?'hMerge="1"':"",t.vMerge?'vMerge="1"':""].filter(Boolean).join(" ");f.push(p(a?` ${a}`:""));continue}const n=t.cell,e=t.colSpan,l=t.rowSpan,d=e>1?` gridSpan="${e}"`:"",h=l>1?` rowSpan="${l}"`:"",g=u(n.text||""),x=/[\u4e00-\u9fff]/.test(g)?"zh-CN":"en-US",$=n.fontSize?` sz="${Math.round(100*n.fontSize)}"`:"",y=n.bold?' b="1"':"",v=n.italic?' i="1"':"",b=n.underline?' u="sng"':"",F=n.strike?' strike="sngStrike"':"",S=m(n.color||"111827"),M=n.fontFace||"Aptos",P=c(n.align);let C;C=g?`<a:p>\n <a:pPr algn="${P}"/>\n <a:r>\n <a:rPr lang="${x}"${$}${y}${v}${b}${F} dirty="0">\n <a:solidFill><a:srgbClr val="${S}"/></a:solidFill>\n <a:latin typeface="${i(M)}"/>\n <a:ea typeface="${i(M)}"/>\n </a:rPr>\n <a:t>${i(g)}</a:t>\n </a:r>\n </a:p>`:`<a:p><a:pPr algn="${P}"/><a:endParaRPr lang="zh-CN"/></a:p>`;const w=[],I=[];if("middle"===n.valign?I.push('anchor="ctr"'):"bottom"===n.valign&&I.push('anchor="b"'),n.fill){const a=m(n.fill),t=void 0!==n.fillTransparency?Math.round(1e3*(100-n.fillTransparency)):1e5;t<1e5?w.push(`<a:solidFill><a:srgbClr val="${a}"><a:alpha val="${t}"/></a:srgbClr></a:solidFill>`):w.push(`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill>`)}if(n.border){const a=m(n.border.color),t=s(n.border.widthPt),e=`<a:solidFill><a:srgbClr val="${a}"/></a:solidFill><a:prstDash val="${"dash"===n.border.dash?"dash":"solid"}"/>`;w.push(`<a:lnL w="${t}">${e}</a:lnL>`,`<a:lnR w="${t}">${e}</a:lnR>`,`<a:lnT w="${t}">${e}</a:lnT>`,`<a:lnB w="${t}">${e}</a:lnB>`)}else{const a='<a:solidFill><a:srgbClr val="D9D9D9"/></a:solidFill>';w.push(`<a:lnL w="12700">${a}</a:lnL>`,`<a:lnR w="12700">${a}</a:lnR>`,`<a:lnT w="12700">${a}</a:lnT>`,`<a:lnB w="12700">${a}</a:lnB>`)}const T=w.length>0||I.length>0?`<a:tcPr${I.length>0?` ${I.join(" ")}`:""}>${w.join("")}</a:tcPr>`:"";f.push(`<a:tc${d}${h}>\n <a:txBody>\n <a:bodyPr/>\n <a:lstStyle/>\n ${C}\n </a:txBody>\n ${T}\n </a:tc>`)}return`<a:tr h="${l(d)}">\n ${f.join("\n ")}\n </a:tr>`}).join("\n ");return`<p:graphicFrame>\n <p:nvGraphicFramePr>\n <p:cNvPr id="${a}" name="Table ${a}"/>\n <p:cNvGraphicFramePr/>\n <p:nvPr/>\n </p:nvGraphicFramePr>\n <p:xfrm>\n <a:off x="${l(t.x)}" y="${l(t.y)}"/>\n <a:ext cx="${l(t.w)}" cy="${l(t.h)}"/>\n </p:xfrm>\n <a:graphic>\n <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">\n <a:tbl>\n <a:tblPr firstRow="0" lastRow="0" firstCol="0" lastCol="0" noBandRow="1" noBandCol="1">\n </a:tblPr>\n <a:tblGrid>\n ${o}\n </a:tblGrid>\n ${d}\n </a:tbl>\n </a:graphicData>\n </a:graphic>\n </p:graphicFrame>`}const $=(a,t)=>Number.isFinite(a)?Number(a):t,y=a=>({x:a.x/1600*r,y:a.y/900*7.5,w:a.w/1600*r,h:a.h/900*7.5}),v=(a,t)=>Math.max(0,Math.min(a.x+a.w,t.x+t.w)-Math.max(a.x,t.x))*Math.max(0,Math.min(a.y+a.h,t.y+t.h)-Math.max(a.y,t.y)),b=(a,t)=>{const n=a.x+a.w/2,e=a.y+a.h/2;return n>=t.x&&n<=t.x+t.w&&e>=t.y&&e<=t.y+t.h};function F(a,t,l){let s=l;const o=[],i=[],c=(a,t)=>{i.push({pptxId:a,x:t.x,y:t.y,w:t.w,h:t.h})};let g="";if(a.backgroundColor&&(g=`<p:bg><p:bgPr><a:solidFill><a:srgbClr val="${m(a.backgroundColor)}"/></a:solidFill><a:effectLst/></p:bgPr></p:bg>`),a.backgroundImage){s++;const n=t.get(a.backgroundImage.dataUri);n&&o.push(f(s,n.rId,{dataUri:a.backgroundImage.dataUri,mimeType:a.backgroundImage.mimeType,x:0,y:0,w:r,h:7.5,alt:a.backgroundImage.alt}))}const u=[];let F=1e6;for(const t of a.shapes||[])u.push({kind:"shape",order:$(t.order,F++),priority:10,item:t});for(const t of a.tables||[])u.push({kind:"table",order:$(t.order,F++),priority:20,item:t});for(const t of a.images||[])u.push({kind:"image",order:$(t.order,F++),priority:30,item:t});for(const t of a.texts)u.push({kind:"text",order:$(t.order,F++),priority:40,item:t});u.sort((a,t)=>a.order-t.order||a.priority-t.priority);for(const a of u)if(s++,"shape"===a.kind)o.push(h(s,a.item)),c(s,a.item);else if("table"===a.kind)o.push(x(s,a.item)),c(s,a.item);else if("image"===a.kind){const n=t.get(a.item.dataUri);n&&(o.push(f(s,n.rId,a.item)),c(s,a.item))}else{const t=d(s,a.item);t&&(o.push(t),c(s,a.item))}for(const n of a.overlayImages||[]){s++;const a=t.get(n.dataUri);a&&(o.push(f(s,a.rId,n)),c(s,n))}const S=n(function(a,t){if(!a?.length||0===t.length)return[];const n=[],e=new Set,r=[...a].sort((a,t)=>a.order-t.order||a.delay-t.delay);for(const a of r){const r=y(a),l=Math.max(1e-4,r.w*r.h),s=t.map(a=>{const t={x:a.x,y:a.y,w:a.w,h:a.h},n=v(r,t),e=Math.max(1e-4,a.w*a.h);return{shape:a,overlap:n,eligible:n>0&&(b(t,r)||n/e>=.35||n/l>=.16)}}).filter(a=>a.eligible&&!e.has(a.shape.pptxId)).sort((a,t)=>t.overlap-a.overlap||a.shape.pptxId-t.shape.pptxId),o=s.length>0?s.map(a=>a.shape):t.map(a=>{const t={x:a.x,y:a.y,w:a.w,h:a.h};return{shape:a,overlap:v(r,t)}}).filter(a=>a.overlap>0&&!e.has(a.shape.pptxId)).sort((a,t)=>t.overlap-a.overlap).slice(0,1).map(a=>a.shape);for(const t of o)e.add(t.pptxId),n.push({spid:t.pptxId,type:a.type,trigger:a.trigger,clickGroup:a.clickGroup,from:a.from,path:a.path,duration:a.duration,delay:a.delay,order:a.order})}return n}(a.animationTraces,i)),M=a.transitionType?e(a.transitionType,a.transitionDurationMs):"";return`${p}<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">\n <p:cSld>\n ${g}\n <p:spTree>\n <p:nvGrpSpPr>\n <p:cNvPr id="1" name=""/>\n <p:cNvGrpSpPr/>\n <p:nvPr/>\n </p:nvGrpSpPr>\n <p:grpSpPr>\n <a:xfrm>\n <a:off x="0" y="0"/>\n <a:ext cx="0" cy="0"/>\n <a:chOff x="0" y="0"/>\n <a:chExt cx="0" cy="0"/>\n </a:xfrm>\n </p:grpSpPr>\n ${o.join("\n ")}\n </p:spTree>\n </p:cSld>\n <p:clrMapOvr>\n <a:masterClrMapping/>\n </p:clrMapOvr>\n ${M}\n ${S}\n</p:sld>`}function S(a){const t=['<Relationship Id="rIdLayout" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>'];for(const n of a)t.push(`<Relationship Id="${n.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/${n.mediaFile}"/>`);return`${p}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n ${t.join("\n ")}\n</Relationships>`}function M(a){const t=a.match(/^data:image\/(png|jpeg|jpg|gif);base64,(.+)$/i);if(!t)return null;const n=t[1].toLowerCase(),e="jpg"===n?"jpg":n,r=atob(t[2]),l=new Uint8Array(r.length);for(let a=0;a<r.length;a++)l[a]=r.charCodeAt(a);return{buffer:l,ext:e}}const P=n=>{const e=n.slides.length>0?n.slides:[{texts:[]}],r=e.length,l=n.embeddedFonts||[],s=new Map;let o=0;const c=a=>{if(s.has(a))return;const t=M(a);if(!t)return;o++;const n=`image${o}.${t.ext}`;s.set(a,{mediaFile:n,ext:t.ext})};for(const a of e){a.backgroundImage&&c(a.backgroundImage.dataUri);for(const t of a.images||[])c(t.dataUri);for(const t of a.overlayImages||[])c(t.dataUri)}const m=[];for(const a of e){const t=new Map;let n=0;const e=a=>{if(t.has(a))return;const e=s.get(a);e&&(n++,t.set(a,{rId:`rId${n}`,mediaFile:e.mediaFile}))};a.backgroundImage&&e(a.backgroundImage.dataUri);for(const t of a.images||[])e(t.dataUri);for(const t of a.overlayImages||[])e(t.dataUri);m.push(t)}const d=new Set;for(const[,a]of s)d.add(a.ext);const f=new Map,h=[],g=new Map;let u=r+1,x=1;for(const a of l){const t=`${a.fontFace}::${a.style}`;if(f.has(t))continue;const n=`rId${u}`,e=`font${x}.fntdata`;f.set(t,n),h.push({key:t,rId:n,fontFile:e}),g.set(e,a.ttfBuffer),u++,x++}const $=h.length>0,y={};y["[Content_Types].xml"]=a(function(a,t,n=!1){const e=['<Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>','<Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>','<Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>','<Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>'];for(let t=1;t<=a;t++)e.push(`<Override PartName="/ppt/slides/slide${t}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`);const r=['<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>','<Default Extension="xml" ContentType="application/xml"/>'];n&&r.push('<Default Extension="fntdata" ContentType="application/x-fontdata"/>');for(const a of t){const t="jpg"===a||"jpeg"===a?"image/jpeg":"svg"===a?"image/svg+xml":`image/${a}`;r.push(`<Default Extension="${a}" ContentType="${t}"/>`)}return`${p}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">\n ${r.join("\n ")}\n ${e.join("\n ")}\n</Types>`}(r,d,$)),y["_rels/.rels"]=a(`${p}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>\n</Relationships>`),y["ppt/presentation.xml"]=a(function(a,t=[],n=new Map){const e=[];for(let t=1;t<=a;t++)e.push(`<p:sldId id="${255+t}" r:id="rId${t}"/>`);let r="";if(t.length>0){const a=new Map;for(const n of t){const t=a.get(n.fontFace)||[];t.push(n),a.set(n.fontFace,t)}const e=["regular","bold","italic","boldItalic"],l=[];for(const[t,r]of a){const a=[];for(const t of e){const e=r.find(a=>a.style===t);if(!e)continue;const l=n.get(`${e.fontFace}::${e.style}`);l&&a.push(` <p:${t} r:id="${l}"/>`)}if(0===a.length)continue;const s=/[\u3400-\u9fff]|(?:Noto Sans SC|Ma Shan Zheng|Source Han|PingFang|Microsoft YaHei)/i.test(t)?"134":"0";l.push(` <p:embeddedFont>\n <p:font typeface="${i(t)}" panose="0 0 0 0 0 0 0 0 0 0" pitchFamily="34" charset="${s}"/>\n${a.join("\n")}\n </p:embeddedFont>`)}l.length>0&&(r=`\n<p:embeddedFontLst>\n${l.join("\n")}\n</p:embeddedFontLst>`)}return`${p}<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"\n embedTrueTypeFonts="1"\n saveSubsetFonts="1">\n <p:sldMasterIdLst>\n <p:sldMasterId id="2147483648" r:id="rIdSm"/>\n </p:sldMasterIdLst>\n <p:sldIdLst>\n ${e.join("\n ")}\n </p:sldIdLst>\n <p:sldSz cx="12192000" cy="6858000" type="wide"/>\n <p:notesSz cx="6858000" cy="12192000"/>${r}\n</p:presentation>`}(r,l,f)),y["ppt/_rels/presentation.xml.rels"]=a(function(a,t=[]){const n=['<Relationship Id="rIdSm" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>'];for(let t=1;t<=a;t++)n.push(`<Relationship Id="rId${t}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide${t}.xml"/>`);for(const a of t)n.push(`<Relationship Id="${a.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/font" Target="fonts/${a.fontFile}"/>`);return`${p}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n ${n.join("\n ")}\n</Relationships>`}(r,h)),y["ppt/theme/theme1.xml"]=a(`${p}<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">\n <a:themeElements>\n <a:clrScheme name="Office">\n <a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>\n <a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>\n <a:dk2><a:srgbClr val="44546A"/></a:dk2>\n <a:lt2><a:srgbClr val="E7E6E6"/></a:lt2>\n <a:accent1><a:srgbClr val="4472C4"/></a:accent1>\n <a:accent2><a:srgbClr val="ED7D31"/></a:accent2>\n <a:accent3><a:srgbClr val="A5A5A5"/></a:accent3>\n <a:accent4><a:srgbClr val="FFC000"/></a:accent4>\n <a:accent5><a:srgbClr val="5B9BD5"/></a:accent5>\n <a:accent6><a:srgbClr val="70AD47"/></a:accent6>\n <a:hlink><a:srgbClr val="0563C1"/></a:hlink>\n <a:folHlink><a:srgbClr val="954F72"/></a:folHlink>\n </a:clrScheme>\n <a:fontScheme name="Office">\n <a:majorFont>\n <a:latin typeface="Aptos Display"/>\n <a:ea typeface=""/>\n <a:cs typeface=""/>\n </a:majorFont>\n <a:minorFont>\n <a:latin typeface="Aptos"/>\n <a:ea typeface=""/>\n <a:cs typeface=""/>\n </a:minorFont>\n </a:fontScheme>\n <a:fmtScheme name="Office">\n <a:fillStyleLst>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n </a:fillStyleLst>\n <a:lnStyleLst>\n <a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln>\n <a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln>\n <a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln>\n </a:lnStyleLst>\n <a:effectStyleLst>\n <a:effectStyle><a:effectLst/></a:effectStyle>\n <a:effectStyle><a:effectLst/></a:effectStyle>\n <a:effectStyle><a:effectLst/></a:effectStyle>\n </a:effectStyleLst>\n <a:bgFillStyleLst>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n <a:solidFill><a:schemeClr val="phClr"/></a:solidFill>\n </a:bgFillStyleLst>\n </a:fmtScheme>\n </a:themeElements>\n <a:objectDefaults/>\n <a:extraClrSchemeLst/>\n</a:theme>`),y["ppt/slideMasters/slideMaster1.xml"]=a(`${p}<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">\n <p:cSld>\n <p:bg>\n <p:bgRef idx="1001">\n <a:schemeClr val="bg1"/>\n </p:bgRef>\n </p:bg>\n <p:spTree>\n <p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>\n <p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>\n </p:spTree>\n </p:cSld>\n <p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>\n <p:sldLayoutIdLst>\n <p:sldLayoutId id="2147483649" r:id="rId1"/>\n </p:sldLayoutIdLst>\n</p:sldMaster>`),y["ppt/slideMasters/_rels/slideMaster1.xml.rels"]=a(`${p}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>\n <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>\n</Relationships>`),y["ppt/slideLayouts/slideLayout1.xml"]=a(`${p}<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"\n xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"\n xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="blank" preserve="1">\n <p:cSld name="Blank">\n <p:spTree>\n <p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>\n <p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>\n </p:spTree>\n </p:cSld>\n <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>\n</p:sldLayout>`),y["ppt/slideLayouts/_rels/slideLayout1.xml.rels"]=a(`${p}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster1.xml"/>\n</Relationships>`);for(let t=0;t<r;t++){const n=m[t],r=Array.from(n.values());y[`ppt/slides/slide${t+1}.xml`]=a(F(e[t],n,1)),y[`ppt/slides/_rels/slide${t+1}.xml.rels`]=a(S(r))}for(const[a,t]of s){const n=M(a);n&&(y[`ppt/media/${t.mediaFile}`]=n.buffer)}for(const[a,t]of g)y[`ppt/fonts/${a}`]=t;return t(y,{level:6})};export{P as buildPptxDocument,F as buildSlideXml};
@@ -0,0 +1,45 @@
1
+ import type { DataAnimFrom, DataAnimType } from './animation.js';
2
+ export type PptxPresetClass = 'entr' | 'emph' | 'exit';
3
+ export type PptxMotion = 'fromTop' | 'fromBottom' | 'fromLeft' | 'fromRight' | 'fromTrace';
4
+ export interface PptxAnimationPreset {
5
+ presetId: number;
6
+ presetClass: PptxPresetClass;
7
+ presetSubtype?: number;
8
+ motion?: PptxMotion;
9
+ scale?: boolean;
10
+ scaleFrom?: number;
11
+ scaleTo?: number;
12
+ rotateFrom?: number;
13
+ rotateTo?: number;
14
+ fade?: boolean;
15
+ effectFilter?: 'wipe';
16
+ transition?: 'in' | 'out';
17
+ }
18
+ export declare const PPTX_ANIMATION_PRESETS: Record<DataAnimType, PptxAnimationPreset>;
19
+ export declare const getPptxAnimationPreset: (type: DataAnimType) => PptxAnimationPreset | undefined;
20
+ export declare const resolveTraceMotion: (from: DataAnimFrom | undefined) => Exclude<PptxMotion, "fromTrace">;
21
+ export declare const wipeFilterForFrom: (from: DataAnimFrom | undefined) => string;
22
+ export declare const mapPptxPresetToDataAnimType: (args: {
23
+ presetId?: string;
24
+ presetSubtype?: string;
25
+ presetClass?: string;
26
+ hasScale: boolean;
27
+ hasRotation?: boolean;
28
+ scaleFrom?: number;
29
+ scaleTo?: number;
30
+ effectFilter?: string;
31
+ motionXFrom?: string;
32
+ motionXTo?: string;
33
+ motionYFrom?: string;
34
+ motionYTo?: string;
35
+ }) => DataAnimType;
36
+ export declare const mapPptxPresetToDataAnimFrom: (args: {
37
+ presetId?: string;
38
+ presetClass?: string;
39
+ presetSubtype?: string;
40
+ effectFilter?: string;
41
+ motionXFrom?: string;
42
+ motionXTo?: string;
43
+ motionYFrom?: string;
44
+ motionYTo?: string;
45
+ }) => DataAnimFrom | undefined;
@@ -0,0 +1,2 @@
1
+ import type { HtmlToPptxExtractOptions } from './types.js';
2
+ export declare const buildTableExtractScript: (options: HtmlToPptxExtractOptions) => string;
@@ -0,0 +1,174 @@
1
+ import type { DataAnimFrom, DataAnimPptxTrigger, DataAnimType } from './animation.js';
2
+ export type HtmlToPptxTextAlign = 'left' | 'center' | 'right' | 'justify';
3
+ export interface HtmlToPptxTextRun {
4
+ text: string;
5
+ fontSize?: number;
6
+ fontFace?: string;
7
+ color?: string;
8
+ bold?: boolean;
9
+ italic?: boolean;
10
+ underline?: boolean;
11
+ strike?: boolean;
12
+ }
13
+ export interface HtmlToPptxTextBox {
14
+ text: string;
15
+ x: number;
16
+ y: number;
17
+ w: number;
18
+ h: number;
19
+ fontSize: number;
20
+ fontFace?: string;
21
+ color?: string;
22
+ bold?: boolean;
23
+ italic?: boolean;
24
+ underline?: boolean;
25
+ strike?: boolean;
26
+ align?: HtmlToPptxTextAlign;
27
+ opacity?: number;
28
+ rotate?: number;
29
+ lineSpacing?: number;
30
+ charSpacing?: number;
31
+ paragraphSpacingBefore?: number;
32
+ paragraphSpacingAfter?: number;
33
+ verticalAlign?: 'top' | 'middle' | 'bottom';
34
+ paddingLeft?: number;
35
+ paddingRight?: number;
36
+ paddingTop?: number;
37
+ paddingBottom?: number;
38
+ bullet?: {
39
+ type: 'bullet' | 'number';
40
+ level?: number;
41
+ startAt?: number;
42
+ };
43
+ wrap?: boolean;
44
+ runs?: HtmlToPptxTextRun[];
45
+ order?: number;
46
+ }
47
+ export type HtmlToPptxShapeType = 'rect' | 'roundRect' | 'ellipse' | 'line';
48
+ export interface HtmlToPptxBorder {
49
+ color: string;
50
+ widthPt: number;
51
+ transparency?: number;
52
+ dash?: 'solid' | 'dash';
53
+ }
54
+ export interface HtmlToPptxShape {
55
+ x: number;
56
+ y: number;
57
+ w: number;
58
+ h: number;
59
+ fill?: string;
60
+ transparency?: number;
61
+ radius?: number;
62
+ radiusAdj?: number;
63
+ border?: HtmlToPptxBorder;
64
+ shapeType?: HtmlToPptxShapeType;
65
+ rotate?: number;
66
+ flipV?: boolean;
67
+ order?: number;
68
+ }
69
+ export interface HtmlToPptxImage {
70
+ dataUri: string;
71
+ mimeType: string;
72
+ x: number;
73
+ y: number;
74
+ w: number;
75
+ h: number;
76
+ alt?: string;
77
+ rotate?: number;
78
+ opacity?: number;
79
+ order?: number;
80
+ }
81
+ export interface HtmlToPptxTableCell {
82
+ text: string;
83
+ rowspan: number;
84
+ colspan: number;
85
+ x: number;
86
+ y: number;
87
+ w: number;
88
+ h: number;
89
+ fontSize?: number;
90
+ fontFace?: string;
91
+ color?: string;
92
+ bold?: boolean;
93
+ italic?: boolean;
94
+ underline?: boolean;
95
+ strike?: boolean;
96
+ align?: HtmlToPptxTextAlign;
97
+ valign?: 'top' | 'middle' | 'bottom';
98
+ fill?: string;
99
+ fillTransparency?: number;
100
+ border?: HtmlToPptxBorder;
101
+ }
102
+ export interface HtmlToPptxTable {
103
+ x: number;
104
+ y: number;
105
+ w: number;
106
+ h: number;
107
+ colWidths: number[];
108
+ rowHeights: number[];
109
+ rows: HtmlToPptxTableCell[][];
110
+ order?: number;
111
+ }
112
+ export type HtmlToPptxAnimationType = DataAnimType;
113
+ export type HtmlToPptxAnimationTrigger = DataAnimPptxTrigger;
114
+ export type HtmlToPptxAnimationFrom = DataAnimFrom;
115
+ export interface HtmlToPptxAnimationTrace {
116
+ type: HtmlToPptxAnimationType;
117
+ trigger: HtmlToPptxAnimationTrigger;
118
+ clickGroup?: string;
119
+ from?: HtmlToPptxAnimationFrom;
120
+ path?: string;
121
+ duration: number;
122
+ delay: number;
123
+ order: number;
124
+ x: number;
125
+ y: number;
126
+ w: number;
127
+ h: number;
128
+ }
129
+ export interface HtmlToPptxSlide {
130
+ title?: string;
131
+ backgroundColor?: string;
132
+ backgroundImage?: HtmlToPptxImage;
133
+ texts: HtmlToPptxTextBox[];
134
+ shapes?: HtmlToPptxShape[];
135
+ images?: HtmlToPptxImage[];
136
+ tables?: HtmlToPptxTable[];
137
+ /** Overlay images rendered on top of shapes/texts (e.g. KaTeX formula screenshots) */
138
+ overlayImages?: HtmlToPptxImage[];
139
+ /** Element animation boxes collected from data-anim attributes in the source HTML. */
140
+ animationTraces?: HtmlToPptxAnimationTrace[];
141
+ /** Native slide transition type, when configured by callers. */
142
+ transitionType?: string;
143
+ transitionDurationMs?: number;
144
+ }
145
+ export interface HtmlToPptxEmbeddedFont {
146
+ fontFace: string;
147
+ style: 'regular' | 'bold' | 'italic' | 'boldItalic';
148
+ ttfBuffer: Uint8Array;
149
+ }
150
+ export interface HtmlToPptxDocument {
151
+ title: string;
152
+ author?: string;
153
+ slides: HtmlToPptxSlide[];
154
+ embeddedFonts?: HtmlToPptxEmbeddedFont[];
155
+ }
156
+ export interface HtmlToPptxExtractOptions {
157
+ pageWidthPx: number;
158
+ pageHeightPx: number;
159
+ slideWidthIn?: number;
160
+ slideHeightIn?: number;
161
+ maxTextChars?: number;
162
+ maxTextBoxes?: number;
163
+ maxShapes?: number;
164
+ maxImages?: number;
165
+ maxImageBytes?: number;
166
+ }
167
+ export interface HtmlToPptxExtractedSlide {
168
+ backgroundColor?: string;
169
+ texts: HtmlToPptxTextBox[];
170
+ shapes: HtmlToPptxShape[];
171
+ images: HtmlToPptxImage[];
172
+ tables: HtmlToPptxTable[];
173
+ consumedTableElementIds: string[];
174
+ }
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@arcsin1/html2pptx",
3
+ "version": "0.0.1",
4
+ "description": "Extract editable PowerPoint presentations from HTML pages",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./ooxml": {
16
+ "types": "./dist/ooxml-writer.d.ts",
17
+ "import": "./dist/ooxml-writer.js",
18
+ "require": "./dist/ooxml-writer.cjs"
19
+ },
20
+ "./animation": {
21
+ "types": "./dist/animation-writer.d.ts",
22
+ "import": "./dist/animation-writer.js",
23
+ "require": "./dist/animation-writer.cjs"
24
+ },
25
+ "./node": {
26
+ "types": "./dist/node.d.ts",
27
+ "import": "./dist/node.js",
28
+ "require": "./dist/node.cjs"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist/**/*.js",
33
+ "dist/**/*.cjs",
34
+ "dist/**/*.d.ts",
35
+ "LICENSE",
36
+ "README.md"
37
+ ],
38
+ "scripts": {
39
+ "dev": "rollup -c -w",
40
+ "typecheck": "tsc --noEmit",
41
+ "test": "vitest run",
42
+ "build": "rollup -c",
43
+ "prepack": "rollup -c"
44
+ },
45
+ "keywords": [
46
+ "html",
47
+ "pptx",
48
+ "powerpoint",
49
+ "ooxml",
50
+ "html-to-pptx"
51
+ ],
52
+ "license": "Apache-2.0",
53
+ "dependencies": {
54
+ "@chenglou/pretext": "^0.0.6",
55
+ "fflate": "^0.8.2"
56
+ },
57
+ "devDependencies": {
58
+ "@rollup/plugin-commonjs": "^28.0.6",
59
+ "@rollup/plugin-node-resolve": "^16.0.1",
60
+ "@rollup/plugin-terser": "^0.4.4",
61
+ "@rollup/plugin-typescript": "^12.1.4",
62
+ "@types/node": "^22.19.1",
63
+ "rollup": "^4.44.2",
64
+ "terser": "^5.44.1",
65
+ "tslib": "^2.8.1",
66
+ "typescript": "^5.9.3",
67
+ "vitest": "^4.1.6"
68
+ }
69
+ }