ai-ppt-edit-component 0.0.21 → 0.0.22
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/es/index.mjs +86 -79
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/es/index.mjs
CHANGED
|
@@ -6682,19 +6682,26 @@ var zo = () => {
|
|
|
6682
6682
|
for (e = Os(e); l < e.length;) n = e.charCodeAt(l++), r = e.charCodeAt(l++), i = e.charCodeAt(l++), a = n >> 2, o = (n & 3) << 4 | r >> 4, s = (r & 15) << 2 | i >> 6, c = i & 63, isNaN(r) ? s = c = 64 : isNaN(i) && (c = 64), t = t + Es.charAt(a) + Es.charAt(o) + Es.charAt(s) + Es.charAt(c);
|
|
6683
6683
|
return t;
|
|
6684
6684
|
}, As = (e) => Ds + ks(new XMLSerializer().serializeToString(e)), js = "/api/proxy", Ms = () => {
|
|
6685
|
-
let { slides: e, theme: t, viewportRatio: n, title: i, viewportSize: a } = V(K()), o = r(() => 96 * (a.value / 960)), s = r(() => 96 / 72 * (a.value / 960)), c = C(!1), { t: l } = W()
|
|
6686
|
-
|
|
6685
|
+
let { slides: e, theme: t, viewportRatio: n, title: i, viewportSize: a } = V(K()), o = r(() => 96 * (a.value / 960)), s = r(() => 96 / 72 * (a.value / 960)), c = C(!1), { t: l } = W(), u = {
|
|
6686
|
+
Msyh: "微软雅黑",
|
|
6687
|
+
"Microsoft YaHei": "微软雅黑"
|
|
6688
|
+
}, d = (e) => {
|
|
6689
|
+
if (!e || typeof e != "string") return "微软雅黑";
|
|
6690
|
+
let t = e.split(",")[0].replace(/^['"]|['"]$/g, "").trim();
|
|
6691
|
+
return t ? u[t] || t : "微软雅黑";
|
|
6692
|
+
};
|
|
6693
|
+
function f(e) {
|
|
6687
6694
|
try {
|
|
6688
6695
|
return new URL(e), !0;
|
|
6689
6696
|
} catch {
|
|
6690
6697
|
return !1;
|
|
6691
6698
|
}
|
|
6692
6699
|
}
|
|
6693
|
-
function
|
|
6694
|
-
return
|
|
6700
|
+
function p(e) {
|
|
6701
|
+
return f(e) ? `${js}?url=${encodeURIComponent(e)}` : e;
|
|
6695
6702
|
}
|
|
6696
|
-
async function
|
|
6697
|
-
let t =
|
|
6703
|
+
async function m(e) {
|
|
6704
|
+
let t = f(e) ? p(e) : e, n = await fetch(t);
|
|
6698
6705
|
if (!n.ok) throw Error(`Fetch failed: ${n.status}`);
|
|
6699
6706
|
let r = await n.blob();
|
|
6700
6707
|
return await new Promise((e, t) => {
|
|
@@ -6702,10 +6709,10 @@ var zo = () => {
|
|
|
6702
6709
|
n.onload = () => e(String(n.result)), n.onerror = t, n.readAsDataURL(r);
|
|
6703
6710
|
});
|
|
6704
6711
|
}
|
|
6705
|
-
async function
|
|
6706
|
-
return
|
|
6712
|
+
async function h(e) {
|
|
6713
|
+
return O(e) || k(e) ? e : await m(e);
|
|
6707
6714
|
}
|
|
6708
|
-
let
|
|
6715
|
+
let g = (e, t, n, r = !0) => {
|
|
6709
6716
|
c.value = !0;
|
|
6710
6717
|
let a = t === "png" ? Le : Ie;
|
|
6711
6718
|
e.querySelectorAll("foreignObject [xmlns]").forEach((e) => e.removeAttribute("xmlns")), setTimeout(() => {
|
|
@@ -6719,7 +6726,7 @@ var zo = () => {
|
|
|
6719
6726
|
c.value = !1, Ai.error(l("EXPORT.IMAGE_FAIL"));
|
|
6720
6727
|
});
|
|
6721
6728
|
}, 200);
|
|
6722
|
-
},
|
|
6729
|
+
}, _ = (e) => {
|
|
6723
6730
|
let r = {
|
|
6724
6731
|
title: i.value,
|
|
6725
6732
|
width: a.value,
|
|
@@ -6728,7 +6735,7 @@ var zo = () => {
|
|
|
6728
6735
|
slides: e
|
|
6729
6736
|
};
|
|
6730
6737
|
Ne(new Blob([$a(JSON.stringify(r))], { type: "" }), `${i.value}.pptist`);
|
|
6731
|
-
},
|
|
6738
|
+
}, v = () => {
|
|
6732
6739
|
let r = {
|
|
6733
6740
|
title: i.value,
|
|
6734
6741
|
width: a.value,
|
|
@@ -6737,7 +6744,7 @@ var zo = () => {
|
|
|
6737
6744
|
slides: e.value
|
|
6738
6745
|
};
|
|
6739
6746
|
Ne(new Blob([JSON.stringify(r)], { type: "" }), `${i.value}.json`);
|
|
6740
|
-
},
|
|
6747
|
+
}, y = () => {
|
|
6741
6748
|
let r = {
|
|
6742
6749
|
title: i.value,
|
|
6743
6750
|
width: a.value,
|
|
@@ -6746,7 +6753,7 @@ var zo = () => {
|
|
|
6746
6753
|
slides: e.value
|
|
6747
6754
|
};
|
|
6748
6755
|
return JSON.stringify(r || "");
|
|
6749
|
-
},
|
|
6756
|
+
}, b = (e) => {
|
|
6750
6757
|
if (!e) return {
|
|
6751
6758
|
alpha: 0,
|
|
6752
6759
|
color: "#000000"
|
|
@@ -6756,7 +6763,7 @@ var zo = () => {
|
|
|
6756
6763
|
alpha: n,
|
|
6757
6764
|
color: n === 0 ? "#ffffff" : t.setAlpha(1).toHexString()
|
|
6758
6765
|
};
|
|
6759
|
-
},
|
|
6766
|
+
}, x = (e) => {
|
|
6760
6767
|
let t = Ss(e), n = !1, r = 0, i = [], a = (e, t = {}) => {
|
|
6761
6768
|
for (let o of e) {
|
|
6762
6769
|
if ("tagName" in o && [
|
|
@@ -6785,13 +6792,13 @@ var zo = () => {
|
|
|
6785
6792
|
});
|
|
6786
6793
|
else if ("content" in o) {
|
|
6787
6794
|
let t = o.content.replace(/ /g, " ").replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&").replace(/\n/g, ""), a = {};
|
|
6788
|
-
e["font-size"] && (a.fontSize = parseInt(e["font-size"]) / s.value), e.color && (a.color =
|
|
6795
|
+
e["font-size"] && (a.fontSize = parseInt(e["font-size"]) / s.value), e.color && (a.color = b(e.color).color), e["background-color"] && (a.highlight = b(e["background-color"]).color), e["text-decoration-line"] && (e["text-decoration-line"].indexOf("underline") !== -1 && (a.underline = {
|
|
6789
6796
|
color: a.color || "#000000",
|
|
6790
6797
|
style: "sng"
|
|
6791
6798
|
}), e["text-decoration-line"].indexOf("line-through") !== -1 && (a.strike = "sngStrike")), e["text-decoration"] && (e["text-decoration"].indexOf("underline") !== -1 && (a.underline = {
|
|
6792
6799
|
color: a.color || "#000000",
|
|
6793
6800
|
style: "sng"
|
|
6794
|
-
}), e["text-decoration"].indexOf("line-through") !== -1 && (a.strike = "sngStrike")), e["vertical-align"] && (e["vertical-align"] === "super" && (a.superscript = !0), e["vertical-align"] === "sub" && (a.subscript = !0)), e["text-align"] && (a.align = e["text-align"]), e["font-weight"] && (a.bold = e["font-weight"] === "bold"), e["font-style"] && (a.italic = e["font-style"] === "italic"), e["font-family"] && (a.fontFace = e["font-family"]), e.href && (a.hyperlink = { url: e.href }), n && e["list-type"] === "ol" && (a.bullet = {
|
|
6801
|
+
}), e["text-decoration"].indexOf("line-through") !== -1 && (a.strike = "sngStrike")), e["vertical-align"] && (e["vertical-align"] === "super" && (a.superscript = !0), e["vertical-align"] === "sub" && (a.subscript = !0)), e["text-align"] && (a.align = e["text-align"]), e["font-weight"] && (a.bold = e["font-weight"] === "bold"), e["font-style"] && (a.italic = e["font-style"] === "italic"), e["font-family"] && (a.fontFace = d(e["font-family"])), e.href && (a.hyperlink = { url: e.href }), n && e["list-type"] === "ol" && (a.bullet = {
|
|
6795
6802
|
type: "number",
|
|
6796
6803
|
indent: (a.fontSize || 16) * 1.25
|
|
6797
6804
|
}, a.paraSpaceBefore = .1, n = !1), n && e["list-type"] === "ul" && (a.bullet = { indent: (a.fontSize || 16) * 1.25 }, a.paraSpaceBefore = .1, n = !1), r &&= (a.indentLevel = r, 0), i.push({
|
|
@@ -6802,7 +6809,7 @@ var zo = () => {
|
|
|
6802
6809
|
}
|
|
6803
6810
|
};
|
|
6804
6811
|
return a(t), i;
|
|
6805
|
-
},
|
|
6812
|
+
}, S = (e, t = {
|
|
6806
6813
|
x: 1,
|
|
6807
6814
|
y: 1
|
|
6808
6815
|
}) => e.map((e) => {
|
|
@@ -6838,8 +6845,8 @@ var zo = () => {
|
|
|
6838
6845
|
x: e.x / o.value * t.x,
|
|
6839
6846
|
y: e.y / o.value * t.y
|
|
6840
6847
|
};
|
|
6841
|
-
}),
|
|
6842
|
-
let t =
|
|
6848
|
+
}), w = (e) => {
|
|
6849
|
+
let t = b(e.color), { h: n, v: r } = e, i = 4, a = 45;
|
|
6843
6850
|
return n === 0 && r === 0 ? (i = 4, a = 45) : n === 0 ? r > 0 ? (i = r, a = 90) : (i = -r, a = 270) : r === 0 ? n > 0 ? (i = n, a = 1) : (i = -n, a = 180) : n > 0 && r > 0 ? (i = Math.max(n, r), a = 45) : n > 0 && r < 0 ? (i = Math.max(n, -r), a = 315) : n < 0 && r > 0 ? (i = Math.max(-n, r), a = 135) : n < 0 && r < 0 && (i = Math.max(-n, -r), a = 225), {
|
|
6844
6851
|
type: "outer",
|
|
6845
6852
|
color: t.color.replace("#", ""),
|
|
@@ -6848,19 +6855,19 @@ var zo = () => {
|
|
|
6848
6855
|
offset: i,
|
|
6849
6856
|
angle: a
|
|
6850
6857
|
};
|
|
6851
|
-
},
|
|
6858
|
+
}, T = {
|
|
6852
6859
|
solid: "solid",
|
|
6853
6860
|
dashed: "dash",
|
|
6854
6861
|
dotted: "sysDot"
|
|
6855
|
-
},
|
|
6856
|
-
let t =
|
|
6862
|
+
}, E = (e) => {
|
|
6863
|
+
let t = b(e?.color || "#000000");
|
|
6857
6864
|
return {
|
|
6858
6865
|
color: t.color,
|
|
6859
6866
|
transparency: (1 - t.alpha) * 100,
|
|
6860
6867
|
width: (e.width || 1) / s.value,
|
|
6861
|
-
dashType: e.style ?
|
|
6868
|
+
dashType: e.style ? T[e.style] : "solid"
|
|
6862
6869
|
};
|
|
6863
|
-
},
|
|
6870
|
+
}, D = (t) => {
|
|
6864
6871
|
let { type: n, target: r } = t;
|
|
6865
6872
|
if (n === "web") return { url: r };
|
|
6866
6873
|
if (n === "slide") {
|
|
@@ -6868,29 +6875,29 @@ var zo = () => {
|
|
|
6868
6875
|
if (t !== -1) return { slide: t + 1 };
|
|
6869
6876
|
}
|
|
6870
6877
|
return null;
|
|
6871
|
-
},
|
|
6878
|
+
}, O = (e) => e.match(/^data:image\/[^;]+;base64,/) !== null, k = (e) => {
|
|
6872
6879
|
let t = /^data:image\/svg\+xml;base64,/.test(e), n = /\.svg$/.test(e);
|
|
6873
6880
|
return t || n;
|
|
6874
6881
|
};
|
|
6875
6882
|
return {
|
|
6876
6883
|
exporting: c,
|
|
6877
|
-
exportImage:
|
|
6878
|
-
exportJSON:
|
|
6879
|
-
exportSpecificFile:
|
|
6884
|
+
exportImage: g,
|
|
6885
|
+
exportJSON: v,
|
|
6886
|
+
exportSpecificFile: _,
|
|
6880
6887
|
exportPPTX: async (e, r, u) => {
|
|
6881
6888
|
c.value = !0;
|
|
6882
|
-
let
|
|
6883
|
-
if (n.value === .625 ?
|
|
6889
|
+
let f = new Pe();
|
|
6890
|
+
if (n.value === .625 ? f.layout = "LAYOUT_16x10" : n.value === .75 ? f.layout = "LAYOUT_4x3" : n.value === .70710678 ? (f.defineLayout({
|
|
6884
6891
|
name: "A3",
|
|
6885
6892
|
width: 10,
|
|
6886
6893
|
height: 7.0710678
|
|
6887
|
-
}),
|
|
6894
|
+
}), f.layout = "A3") : n.value === 1.41421356 ? (f.defineLayout({
|
|
6888
6895
|
name: "A3_V",
|
|
6889
6896
|
width: 10,
|
|
6890
6897
|
height: 14.1421356
|
|
6891
|
-
}),
|
|
6892
|
-
let { color: e, alpha: n } =
|
|
6893
|
-
|
|
6898
|
+
}), f.layout = "A3_V") : f.layout = "LAYOUT_16x9", r) {
|
|
6899
|
+
let { color: e, alpha: n } = b(t.value.backgroundColor);
|
|
6900
|
+
f.defineSlideMaster({
|
|
6894
6901
|
title: "PPTIST_MASTER",
|
|
6895
6902
|
background: {
|
|
6896
6903
|
color: e,
|
|
@@ -6899,24 +6906,24 @@ var zo = () => {
|
|
|
6899
6906
|
});
|
|
6900
6907
|
}
|
|
6901
6908
|
for (let t of e) {
|
|
6902
|
-
let e =
|
|
6909
|
+
let e = f.addSlide();
|
|
6903
6910
|
if (t.background) {
|
|
6904
6911
|
let r = t.background;
|
|
6905
|
-
if (r.type === "image" && r.image)
|
|
6912
|
+
if (r.type === "image" && r.image) k(r.image.src) ? e.addImage({
|
|
6906
6913
|
data: r.image.src,
|
|
6907
6914
|
x: 0,
|
|
6908
6915
|
y: 0,
|
|
6909
6916
|
w: a.value / o.value,
|
|
6910
6917
|
h: a.value * n.value / o.value
|
|
6911
|
-
}) :
|
|
6918
|
+
}) : O(r.image.src) ? e.background = { data: r.image.src } : e.background = { data: await h(r.image.src) };
|
|
6912
6919
|
else if (r.type === "solid" && r.color) {
|
|
6913
|
-
let t =
|
|
6920
|
+
let t = b(r.color);
|
|
6914
6921
|
e.background = {
|
|
6915
6922
|
color: t.color,
|
|
6916
6923
|
transparency: (1 - t.alpha) * 100
|
|
6917
6924
|
};
|
|
6918
6925
|
} else if (r.type === "gradient" && r.gradient) {
|
|
6919
|
-
let t = r.gradient.colors, n = t[0].color, i = t[t.length - 1].color, a =
|
|
6926
|
+
let t = r.gradient.colors, n = t[0].color, i = t[t.length - 1].color, a = b(Ae.mix(n, i).toHexString());
|
|
6920
6927
|
e.background = {
|
|
6921
6928
|
color: a.color,
|
|
6922
6929
|
transparency: (1 - a.alpha) * 100
|
|
@@ -6933,7 +6940,7 @@ var zo = () => {
|
|
|
6933
6940
|
}
|
|
6934
6941
|
if (t.elements) {
|
|
6935
6942
|
for (let n of t.elements) if (n.type === "text") {
|
|
6936
|
-
let t =
|
|
6943
|
+
let t = x(n.content), r = {
|
|
6937
6944
|
x: n.left / o.value,
|
|
6938
6945
|
y: n.top / o.value,
|
|
6939
6946
|
w: n.width / o.value,
|
|
@@ -6948,13 +6955,13 @@ var zo = () => {
|
|
|
6948
6955
|
autoFit: !0
|
|
6949
6956
|
};
|
|
6950
6957
|
if (n.rotate && (r.rotate = n.rotate), n.wordSpace && (r.charSpacing = n.wordSpace / s.value), n.lineHeight && (r.lineSpacingMultiple = n.lineHeight / 1.25), n.fill) {
|
|
6951
|
-
let e =
|
|
6958
|
+
let e = b(n.fill), t = n.opacity === void 0 ? 1 : n.opacity;
|
|
6952
6959
|
r.fill = {
|
|
6953
6960
|
color: e.color,
|
|
6954
6961
|
transparency: (1 - e.alpha * t) * 100
|
|
6955
6962
|
};
|
|
6956
6963
|
}
|
|
6957
|
-
n.defaultColor && (r.color =
|
|
6964
|
+
n.defaultColor && (r.color = b(n.defaultColor).color), n.defaultFontName && (r.fontFace = d(n.defaultFontName)), n.shadow && (r.shadow = w(n.shadow)), n.outline && n.outline.width && n.outline.width > 0 && (r.line = E(n.outline)), n.opacity !== void 0 && (r.transparency = (1 - n.opacity) * 100), n.paragraphSpace !== void 0 && (r.paraSpaceBefore = n.paragraphSpace / s.value), n.vertical && (r.vert = "eaVert"), e.addText(t, r);
|
|
6958
6965
|
} else if (n.type === "image") {
|
|
6959
6966
|
let t = {
|
|
6960
6967
|
x: n.left / o.value,
|
|
@@ -6962,8 +6969,8 @@ var zo = () => {
|
|
|
6962
6969
|
w: n.width / o.value,
|
|
6963
6970
|
h: n.height / o.value
|
|
6964
6971
|
};
|
|
6965
|
-
if (
|
|
6966
|
-
let e =
|
|
6972
|
+
if (O(n.src) ? t.data = n.src : t.data = await h(n.src), n.flipH && (t.flipH = n.flipH), n.flipV && (t.flipV = n.flipV), n.rotate && (t.rotate = n.rotate), n.link) {
|
|
6973
|
+
let e = D(n.link);
|
|
6967
6974
|
e && (t.hyperlink = e);
|
|
6968
6975
|
}
|
|
6969
6976
|
if (n.filters?.opacity && (t.transparency = 100 - parseInt(n.filters?.opacity)), n.clip) {
|
|
@@ -6991,11 +6998,11 @@ var zo = () => {
|
|
|
6991
6998
|
h: n.height / o.value
|
|
6992
6999
|
};
|
|
6993
7000
|
if (n.rotate && (r.rotate = n.rotate), n.flipH && (r.flipH = n.flipH), n.flipV && (r.flipV = n.flipV), n.fill) {
|
|
6994
|
-
let e =
|
|
7001
|
+
let e = b(n.fill), t = n.opacity === void 0 ? 1 : n.opacity, i = e.alpha * t;
|
|
6995
7002
|
i < 1 && (r.transparency = (1 - i) * 100);
|
|
6996
7003
|
} else n.opacity !== void 0 && n.opacity < 1 && (r.transparency = (1 - n.opacity) * 100);
|
|
6997
7004
|
if (n.link) {
|
|
6998
|
-
let e =
|
|
7005
|
+
let e = D(n.link);
|
|
6999
7006
|
e && (r.hyperlink = e);
|
|
7000
7007
|
}
|
|
7001
7008
|
e.addImage(r), t = !0;
|
|
@@ -7005,12 +7012,12 @@ var zo = () => {
|
|
|
7005
7012
|
let t = {
|
|
7006
7013
|
x: n.width / n.viewBox[0],
|
|
7007
7014
|
y: n.height / n.viewBox[1]
|
|
7008
|
-
}, r =
|
|
7015
|
+
}, r = S(ws(n.path), t), i = b(n.fill);
|
|
7009
7016
|
if (n.gradient) {
|
|
7010
7017
|
let e = n.gradient.colors, t = e[0].color, r = e[e.length - 1].color;
|
|
7011
|
-
i =
|
|
7018
|
+
i = b(Ae.mix(t, r).toHexString());
|
|
7012
7019
|
}
|
|
7013
|
-
n.pattern && (i =
|
|
7020
|
+
n.pattern && (i = b("#00000000"));
|
|
7014
7021
|
let a = n.opacity === void 0 ? 1 : n.opacity, s = {
|
|
7015
7022
|
x: n.left / o.value,
|
|
7016
7023
|
y: n.top / o.value,
|
|
@@ -7022,14 +7029,14 @@ var zo = () => {
|
|
|
7022
7029
|
},
|
|
7023
7030
|
points: r
|
|
7024
7031
|
};
|
|
7025
|
-
if (n.flipH && (s.flipH = n.flipH), n.flipV && (s.flipV = n.flipV), n.shadow && (s.shadow =
|
|
7026
|
-
let e =
|
|
7032
|
+
if (n.flipH && (s.flipH = n.flipH), n.flipV && (s.flipV = n.flipV), n.shadow && (s.shadow = w(n.shadow)), n.outline && n.outline.width && n.outline.width > 0 && (s.line = E(n.outline)), n.rotate && (s.rotate = n.rotate), n.link) {
|
|
7033
|
+
let e = D(n.link);
|
|
7027
7034
|
e && (s.hyperlink = e);
|
|
7028
7035
|
}
|
|
7029
7036
|
e.addShape("custGeom", s);
|
|
7030
7037
|
}
|
|
7031
7038
|
if (n.text) {
|
|
7032
|
-
let t =
|
|
7039
|
+
let t = x(n.text.content), r = {
|
|
7033
7040
|
x: n.left / o.value,
|
|
7034
7041
|
y: n.top / o.value,
|
|
7035
7042
|
w: n.width / o.value,
|
|
@@ -7040,7 +7047,7 @@ var zo = () => {
|
|
|
7040
7047
|
paraSpaceBefore: 5 / s.value,
|
|
7041
7048
|
valign: n.text.align
|
|
7042
7049
|
};
|
|
7043
|
-
n.rotate && (r.rotate = n.rotate), n.text.defaultColor && (r.color =
|
|
7050
|
+
n.rotate && (r.rotate = n.rotate), n.text.defaultColor && (r.color = b(n.text.defaultColor).color), n.text.defaultFontName && (r.fontFace = d(n.text.defaultFontName)), e.addText(t, r);
|
|
7044
7051
|
}
|
|
7045
7052
|
if (n.pattern) {
|
|
7046
7053
|
let t = {
|
|
@@ -7049,14 +7056,14 @@ var zo = () => {
|
|
|
7049
7056
|
w: n.width / o.value,
|
|
7050
7057
|
h: n.height / o.value
|
|
7051
7058
|
};
|
|
7052
|
-
if (
|
|
7053
|
-
let e =
|
|
7059
|
+
if (O(n.pattern) ? t.data = n.pattern : t.data = await h(n.pattern), n.flipH && (t.flipH = n.flipH), n.flipV && (t.flipV = n.flipV), n.rotate && (t.rotate = n.rotate), n.link) {
|
|
7060
|
+
let e = D(n.link);
|
|
7054
7061
|
e && (t.hyperlink = e);
|
|
7055
7062
|
}
|
|
7056
7063
|
e.addImage(t);
|
|
7057
7064
|
}
|
|
7058
7065
|
} else if (n.type === "line") {
|
|
7059
|
-
let t =
|
|
7066
|
+
let t = S(ws(Ja(n))), { minX: r, maxX: i, minY: a, maxY: c } = Ra(n), l = b(n.color), u = {
|
|
7060
7067
|
x: n.left / o.value,
|
|
7061
7068
|
y: n.top / o.value,
|
|
7062
7069
|
w: (i - r) / o.value,
|
|
@@ -7065,13 +7072,13 @@ var zo = () => {
|
|
|
7065
7072
|
color: l.color,
|
|
7066
7073
|
transparency: (1 - l.alpha) * 100,
|
|
7067
7074
|
width: n.width / s.value,
|
|
7068
|
-
dashType:
|
|
7075
|
+
dashType: T[n.style],
|
|
7069
7076
|
beginArrowType: n.points[0] ? "arrow" : "none",
|
|
7070
7077
|
endArrowType: n.points[1] ? "arrow" : "none"
|
|
7071
7078
|
},
|
|
7072
7079
|
points: t
|
|
7073
7080
|
};
|
|
7074
|
-
n.shadow && (u.shadow =
|
|
7081
|
+
n.shadow && (u.shadow = w(n.shadow)), e.addShape("custGeom", u);
|
|
7075
7082
|
} else if (n.type === "chart") {
|
|
7076
7083
|
let t = [];
|
|
7077
7084
|
for (let e = 0; e < n.data.series.length; e++) {
|
|
@@ -7083,11 +7090,11 @@ var zo = () => {
|
|
|
7083
7090
|
});
|
|
7084
7091
|
}
|
|
7085
7092
|
let r = [];
|
|
7086
|
-
if (n.themeColors.length === 10) r = n.themeColors.map((e) =>
|
|
7087
|
-
else if (n.themeColors.length === 1) r = Ae(n.themeColors[0]).analogous(10).map((e) =>
|
|
7093
|
+
if (n.themeColors.length === 10) r = n.themeColors.map((e) => b(e).color);
|
|
7094
|
+
else if (n.themeColors.length === 1) r = Ae(n.themeColors[0]).analogous(10).map((e) => b(e.toHexString()).color);
|
|
7088
7095
|
else {
|
|
7089
7096
|
let e = n.themeColors.length, t = Ae(n.themeColors[e - 1]).analogous(11 - e).map((e) => e.toHexString());
|
|
7090
|
-
r = [...n.themeColors.slice(0, e - 1), ...t].map((e) =>
|
|
7097
|
+
r = [...n.themeColors.slice(0, e - 1), ...t].map((e) => b(e).color);
|
|
7091
7098
|
}
|
|
7092
7099
|
let i = {
|
|
7093
7100
|
x: n.left / o.value,
|
|
@@ -7095,19 +7102,19 @@ var zo = () => {
|
|
|
7095
7102
|
w: n.width / o.value,
|
|
7096
7103
|
h: n.height / o.value,
|
|
7097
7104
|
chartColors: n.chartType === "pie" || n.chartType === "ring" ? r : r.slice(0, n.data.series.length)
|
|
7098
|
-
}, a =
|
|
7105
|
+
}, a = b(n.textColor || "#000000").color;
|
|
7099
7106
|
i.catAxisLabelColor = a, i.valAxisLabelColor = a;
|
|
7100
7107
|
let c = 14 / s.value;
|
|
7101
7108
|
if (i.catAxisLabelFontSize = c, i.valAxisLabelFontSize = c, n.fill || n.outline) {
|
|
7102
7109
|
let e = {};
|
|
7103
|
-
n.fill && (e.fill = { color:
|
|
7110
|
+
n.fill && (e.fill = { color: b(n.fill).color }), n.outline && (e.border = {
|
|
7104
7111
|
pt: n.outline.width / s.value,
|
|
7105
|
-
color:
|
|
7112
|
+
color: b(n.outline.color).color
|
|
7106
7113
|
}), i.plotArea = e;
|
|
7107
7114
|
}
|
|
7108
7115
|
(n.data.series.length > 1 && n.chartType !== "scatter" || n.chartType === "pie" || n.chartType === "ring") && (i.showLegend = !0, i.legendPos = "b", i.legendColor = a, i.legendFontSize = c);
|
|
7109
|
-
let u =
|
|
7110
|
-
n.chartType === "bar" ? (u =
|
|
7116
|
+
let u = f.ChartType.bar;
|
|
7117
|
+
n.chartType === "bar" ? (u = f.ChartType.bar, i.barDir = "col", n.options?.stack && (i.barGrouping = "stacked")) : n.chartType === "column" ? (u = f.ChartType.bar, i.barDir = "bar", n.options?.stack && (i.barGrouping = "stacked")) : n.chartType === "line" ? (u = f.ChartType.line, n.options?.lineSmooth && (i.lineSmooth = !0)) : n.chartType === "area" ? u = f.ChartType.area : n.chartType === "radar" ? u = f.ChartType.radar : n.chartType === "scatter" ? (u = f.ChartType.scatter, i.lineSize = 0) : n.chartType === "pie" ? u = f.ChartType.pie : n.chartType === "ring" && (u = f.ChartType.doughnut, i.holeSize = 60), e.addChart(u, t, i);
|
|
7111
7118
|
} else if (n.type === "table") {
|
|
7112
7119
|
let t = [];
|
|
7113
7120
|
for (let e = 0; e < n.data.length; e++) {
|
|
@@ -7118,11 +7125,11 @@ var zo = () => {
|
|
|
7118
7125
|
}
|
|
7119
7126
|
}
|
|
7120
7127
|
let r = [], i = n.theme, a = null, c = [];
|
|
7121
|
-
i && (a =
|
|
7128
|
+
i && (a = b(i.color), c = qa(i.color).map((e) => b(e)));
|
|
7122
7129
|
for (let e = 0; e < n.data.length; e++) {
|
|
7123
7130
|
let o = n.data[e], l = [];
|
|
7124
7131
|
for (let r = 0; r < o.length; r++) {
|
|
7125
|
-
let u = o[r],
|
|
7132
|
+
let u = o[r], f = {
|
|
7126
7133
|
colspan: u.colspan,
|
|
7127
7134
|
rowspan: u.rowspan,
|
|
7128
7135
|
bold: u.style?.bold || !1,
|
|
@@ -7130,26 +7137,26 @@ var zo = () => {
|
|
|
7130
7137
|
underline: { style: u.style?.underline ? "sng" : "none" },
|
|
7131
7138
|
align: u.style?.align || "left",
|
|
7132
7139
|
valign: "middle",
|
|
7133
|
-
fontFace: u.style?.fontname || "微软雅黑",
|
|
7140
|
+
fontFace: d(u.style?.fontname || "微软雅黑"),
|
|
7134
7141
|
fontSize: (u.style?.fontsize ? parseInt(u.style?.fontsize) : 14) / s.value
|
|
7135
7142
|
};
|
|
7136
7143
|
if (i && a) {
|
|
7137
7144
|
let t;
|
|
7138
|
-
t = e % 2 == 0 ? c[1] : c[0], (i.rowHeader && e === 0 || i.rowFooter && e === n.data.length - 1 || i.colHeader && r === 0 || i.colFooter && r === o.length - 1) && (t = a),
|
|
7145
|
+
t = e % 2 == 0 ? c[1] : c[0], (i.rowHeader && e === 0 || i.rowFooter && e === n.data.length - 1 || i.colHeader && r === 0 || i.colFooter && r === o.length - 1) && (t = a), f.fill = {
|
|
7139
7146
|
color: t.color,
|
|
7140
7147
|
transparency: (1 - t.alpha) * 100
|
|
7141
7148
|
};
|
|
7142
7149
|
}
|
|
7143
7150
|
if (u.style?.backcolor) {
|
|
7144
|
-
let e =
|
|
7145
|
-
|
|
7151
|
+
let e = b(u.style.backcolor);
|
|
7152
|
+
f.fill = {
|
|
7146
7153
|
color: e.color,
|
|
7147
7154
|
transparency: (1 - e.alpha) * 100
|
|
7148
7155
|
};
|
|
7149
7156
|
}
|
|
7150
|
-
u.style?.color && (
|
|
7157
|
+
u.style?.color && (f.color = b(u.style.color).color), t.includes(`${e}_${r}`) || l.push({
|
|
7151
7158
|
text: u.text,
|
|
7152
|
-
options:
|
|
7159
|
+
options: f
|
|
7153
7160
|
});
|
|
7154
7161
|
}
|
|
7155
7162
|
l.length && r.push(l);
|
|
@@ -7164,7 +7171,7 @@ var zo = () => {
|
|
|
7164
7171
|
n.theme && (l.fill = { color: "#ffffff" }), n.outline.width && n.outline.color && (l.border = {
|
|
7165
7172
|
type: n.outline.style === "solid" ? "solid" : "dash",
|
|
7166
7173
|
pt: n.outline.width / s.value,
|
|
7167
|
-
color:
|
|
7174
|
+
color: b(n.outline.color).color
|
|
7168
7175
|
}), e.addTable(r, l);
|
|
7169
7176
|
} else if (n.type === "latex") {
|
|
7170
7177
|
let t = {
|
|
@@ -7175,7 +7182,7 @@ var zo = () => {
|
|
|
7175
7182
|
h: n.height / o.value
|
|
7176
7183
|
};
|
|
7177
7184
|
if (n.link) {
|
|
7178
|
-
let e =
|
|
7185
|
+
let e = D(n.link);
|
|
7179
7186
|
e && (t.hyperlink = e);
|
|
7180
7187
|
}
|
|
7181
7188
|
e.addImage(t);
|
|
@@ -7188,7 +7195,7 @@ var zo = () => {
|
|
|
7188
7195
|
path: n.src,
|
|
7189
7196
|
type: n.type
|
|
7190
7197
|
};
|
|
7191
|
-
n.type === "video" && n.poster && (t.cover = await
|
|
7198
|
+
n.type === "video" && n.poster && (t.cover = await h(n.poster));
|
|
7192
7199
|
let r = n.src.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
|
|
7193
7200
|
r && r[1] ? t.extn = r[1] : n.ext && (t.extn = n.ext);
|
|
7194
7201
|
let i = [
|
|
@@ -7209,12 +7216,12 @@ var zo = () => {
|
|
|
7209
7216
|
}
|
|
7210
7217
|
}
|
|
7211
7218
|
setTimeout(() => {
|
|
7212
|
-
|
|
7219
|
+
f.writeFile({ fileName: `${i.value}.pptx` }).then(() => c.value = !1).catch(() => {
|
|
7213
7220
|
c.value = !1, Ai.error(l("EXPORT.FAIL"));
|
|
7214
7221
|
});
|
|
7215
7222
|
}, 200);
|
|
7216
7223
|
},
|
|
7217
|
-
getSaveJSON:
|
|
7224
|
+
getSaveJSON: y
|
|
7218
7225
|
};
|
|
7219
7226
|
}, Ns = (e, t) => e.replace(/font-size:\s*([\d.]+)pt/g, (e, n) => `font-size: ${(parseFloat(n) * t).toFixed(1)}px`), Ps = () => {
|
|
7220
7227
|
let e = K(), { theme: t } = V(K()), { addHistorySnapshot: n } = Xa(), { addSlidesFromData: r } = Za(), { isEmptySlide: i } = ko(), { t: a } = W(), o = C(!1), s = (t) => {
|