@pi-outpost/embed 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversationExport-BZIl4piw.cjs +71 -0
- package/dist/conversationExport-C6_QGm7R.js +804 -0
- package/dist/conversationHistory-BDtVdjM-.js +40984 -0
- package/dist/conversationHistory-XS2q82ov.cjs +286 -0
- package/dist/{docxExport-CwnVYwBN.cjs → docxExport-CBWiUi3X.cjs} +4 -4
- package/dist/{docxExport-6TmQjWC6.js → docxExport-DfoUfB8p.js} +314 -453
- package/dist/{lib-BV1VyBDK.js → lib-BgQYQRfw.js} +1104 -1097
- package/dist/lib-DVuUFI8o.cjs +26 -0
- package/dist/loadReferencedImage-CNK1LKTU.cjs +1 -0
- package/dist/loadReferencedImage-CUSqS4eN.js +266 -0
- package/dist/pi-outpost-embed.cjs +28 -313
- package/dist/pi-outpost-embed.js +4540 -45202
- package/package.json +1 -1
- package/dist/lib-CRwQ7yuW.cjs +0 -26
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { g as e } from "./lib-BgQYQRfw.js";
|
|
2
|
+
import { a as t, n, o as r } from "./workspacePath-CfDl0V4n.js";
|
|
3
|
+
//#region ../ui/src/export/mermaidToImage.ts
|
|
4
|
+
var i = class extends Error {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
super(e), this.name = "DiagramError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
function a(e) {
|
|
10
|
+
let t = /viewBox="\s*[\d.-]+[\s,]+[\d.-]+[\s,]+([\d.]+)[\s,]+([\d.]+)/.exec(e), n = t ? Number(t[1]) : NaN, r = t ? Number(t[2]) : NaN;
|
|
11
|
+
if (!Number.isFinite(n) || !Number.isFinite(r) || n <= 0 || r <= 0) throw new i("diagram has no usable viewBox");
|
|
12
|
+
return {
|
|
13
|
+
width: n,
|
|
14
|
+
height: r
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function o(e, t, n) {
|
|
18
|
+
let r = /^[\s\S]*?<svg\b[^>]*>/.exec(e);
|
|
19
|
+
return r === null ? e : r[0].replace(/\swidth="[^"]*"/, "").replace(/\sheight="[^"]*"/, "").replace(/\sstyle="[^"]*"/, (e) => {
|
|
20
|
+
let t = e.replace(/max-width:[^;"]*;?/, "");
|
|
21
|
+
return /style="\s*"/.test(t) ? "" : t;
|
|
22
|
+
}).replace(/>$/, ` width="${t}" height="${n}">`) + e.slice(r[0].length);
|
|
23
|
+
}
|
|
24
|
+
var s = [
|
|
25
|
+
"fill",
|
|
26
|
+
"fill-opacity",
|
|
27
|
+
"stroke",
|
|
28
|
+
"stroke-width",
|
|
29
|
+
"stroke-opacity",
|
|
30
|
+
"stroke-dasharray",
|
|
31
|
+
"stroke-linecap",
|
|
32
|
+
"stroke-linejoin",
|
|
33
|
+
"opacity",
|
|
34
|
+
"font-family",
|
|
35
|
+
"font-size",
|
|
36
|
+
"font-weight",
|
|
37
|
+
"font-style",
|
|
38
|
+
"text-anchor",
|
|
39
|
+
"dominant-baseline"
|
|
40
|
+
];
|
|
41
|
+
function c(e) {
|
|
42
|
+
let t = document.createElement("div");
|
|
43
|
+
t.setAttribute("style", "position:absolute;left:-10000px;top:0;width:0;height:0;overflow:hidden"), t.innerHTML = e;
|
|
44
|
+
let n = t.querySelector("svg");
|
|
45
|
+
if (n === null) return e;
|
|
46
|
+
document.body.append(t);
|
|
47
|
+
try {
|
|
48
|
+
let e = [n, ...n.querySelectorAll("*")].filter((e) => e.tagName.toLowerCase() !== "style").map((e) => {
|
|
49
|
+
let t = window.getComputedStyle(e), n = [];
|
|
50
|
+
for (let e of s) {
|
|
51
|
+
let r = t.getPropertyValue(e);
|
|
52
|
+
r !== "" && n.push([e, r]);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
element: e,
|
|
56
|
+
painted: n
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
for (let { element: t, painted: n } of e) {
|
|
60
|
+
for (let [e, r] of n) t.setAttribute(e, r);
|
|
61
|
+
t.removeAttribute("style"), t.removeAttribute("class");
|
|
62
|
+
}
|
|
63
|
+
for (let e of [...n.querySelectorAll("style")]) e.remove();
|
|
64
|
+
return n.outerHTML;
|
|
65
|
+
} finally {
|
|
66
|
+
t.remove();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function l(t, n) {
|
|
70
|
+
return e(async () => {
|
|
71
|
+
let e = (await import("./mermaid.core-DI1iFk6G.js").then((e) => e.t)).default, r;
|
|
72
|
+
try {
|
|
73
|
+
e.initialize({
|
|
74
|
+
startOnLoad: !1,
|
|
75
|
+
theme: "default",
|
|
76
|
+
securityLevel: "strict",
|
|
77
|
+
suppressErrorRendering: !0,
|
|
78
|
+
flowchart: { htmlLabels: !1 },
|
|
79
|
+
htmlLabels: !1
|
|
80
|
+
}), {svg: r} = await e.render(n, t);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
throw new i(`mermaid could not render the diagram: ${String(e)}`);
|
|
83
|
+
} finally {
|
|
84
|
+
e.initialize({
|
|
85
|
+
startOnLoad: !1,
|
|
86
|
+
securityLevel: "strict",
|
|
87
|
+
suppressErrorRendering: !0
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
let { width: s, height: l } = a(r), u = o(r, s, l), f = await d(u, s, l);
|
|
91
|
+
return {
|
|
92
|
+
svg: c(u),
|
|
93
|
+
png: f,
|
|
94
|
+
width: s,
|
|
95
|
+
height: l
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
var u = 2;
|
|
100
|
+
async function d(e, t, n) {
|
|
101
|
+
let r = document.createElement("canvas");
|
|
102
|
+
r.width = Math.max(1, Math.round(t * u)), r.height = Math.max(1, Math.round(n * u));
|
|
103
|
+
let a = r.getContext("2d");
|
|
104
|
+
if (a === null) throw new i("no 2d canvas context for the fallback image");
|
|
105
|
+
let o = URL.createObjectURL(new Blob([e], { type: "image/svg+xml;charset=utf-8" }));
|
|
106
|
+
try {
|
|
107
|
+
let e = await f(o);
|
|
108
|
+
return a.fillStyle = "#ffffff", a.fillRect(0, 0, r.width, r.height), a.drawImage(e, 0, 0, r.width, r.height), await p(r);
|
|
109
|
+
} finally {
|
|
110
|
+
URL.revokeObjectURL(o);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function f(e) {
|
|
114
|
+
return new Promise((t, n) => {
|
|
115
|
+
let r = new Image();
|
|
116
|
+
r.onload = () => t(r), r.onerror = () => n(new i("the browser would not draw the diagram")), r.src = e;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async function p(e) {
|
|
120
|
+
let t = await new Promise((t) => e.toBlob(t, "image/png"));
|
|
121
|
+
if (t === null) throw new i("the canvas produced no image");
|
|
122
|
+
return new Uint8Array(await t.arrayBuffer());
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region ../ui/src/export/loadReferencedImage.ts
|
|
126
|
+
function m(e) {
|
|
127
|
+
return e !== "" && !n(e);
|
|
128
|
+
}
|
|
129
|
+
function h(e, n, i, a) {
|
|
130
|
+
if (m(n)) return t(i, r(e, n), a);
|
|
131
|
+
}
|
|
132
|
+
async function g(e, t, n, r) {
|
|
133
|
+
let i = h(e, t, n, r);
|
|
134
|
+
if (i !== void 0) try {
|
|
135
|
+
let e = await fetch(i);
|
|
136
|
+
return e.ok ? await _(new Uint8Array(await e.arrayBuffer())) : void 0;
|
|
137
|
+
} catch {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function _(e) {
|
|
142
|
+
if (v(e)) return y(new TextDecoder().decode(e));
|
|
143
|
+
let t = S(e);
|
|
144
|
+
return t === void 0 ? void 0 : {
|
|
145
|
+
kind: "raster",
|
|
146
|
+
...t,
|
|
147
|
+
bytes: e
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function v(e) {
|
|
151
|
+
return new TextDecoder().decode(e.subarray(0, 512)).toLowerCase().includes("<svg");
|
|
152
|
+
}
|
|
153
|
+
async function y(e) {
|
|
154
|
+
try {
|
|
155
|
+
let { width: t, height: n } = b(e), r = o(e, t, n), i = await d(r, t, n);
|
|
156
|
+
return {
|
|
157
|
+
kind: "vector",
|
|
158
|
+
image: {
|
|
159
|
+
svg: c(r),
|
|
160
|
+
png: i,
|
|
161
|
+
width: t,
|
|
162
|
+
height: n
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
} catch {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function b(e) {
|
|
170
|
+
try {
|
|
171
|
+
return a(e);
|
|
172
|
+
} catch {
|
|
173
|
+
let t = /<svg\b[^>]*>/.exec(e), n = x(t?.[0] ?? "", "width"), r = x(t?.[0] ?? "", "height");
|
|
174
|
+
if (n === void 0 || r === void 0) throw new i("the referenced svg states no size");
|
|
175
|
+
return {
|
|
176
|
+
width: n,
|
|
177
|
+
height: r
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function x(e, t) {
|
|
182
|
+
let n = RegExp(`\\s${t}="([^"]*)"`).exec(e)?.[1];
|
|
183
|
+
if (n === void 0) return;
|
|
184
|
+
let r = Number.parseFloat(n.replace(/px$/i, ""));
|
|
185
|
+
return Number.isFinite(r) && r > 0 && !n.includes("%") ? r : void 0;
|
|
186
|
+
}
|
|
187
|
+
function S(e) {
|
|
188
|
+
return D(e) ?? O(e) ?? k(e) ?? j(e);
|
|
189
|
+
}
|
|
190
|
+
function C(e, t) {
|
|
191
|
+
return (e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]) >>> 0;
|
|
192
|
+
}
|
|
193
|
+
function w(e, t) {
|
|
194
|
+
return e[t] | e[t + 1] << 8;
|
|
195
|
+
}
|
|
196
|
+
function T(e, t) {
|
|
197
|
+
return e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24 | 0;
|
|
198
|
+
}
|
|
199
|
+
var E = [
|
|
200
|
+
137,
|
|
201
|
+
80,
|
|
202
|
+
78,
|
|
203
|
+
71,
|
|
204
|
+
13,
|
|
205
|
+
10,
|
|
206
|
+
26,
|
|
207
|
+
10
|
|
208
|
+
];
|
|
209
|
+
function D(e) {
|
|
210
|
+
if (!(e.length < 24) && E.every((t, n) => e[n] === t)) return M("png", C(e, 16), C(e, 20));
|
|
211
|
+
}
|
|
212
|
+
function O(e) {
|
|
213
|
+
if (e.length < 10) return;
|
|
214
|
+
let t = String.fromCharCode(...e.subarray(0, 6));
|
|
215
|
+
if (t === "GIF87a" || t === "GIF89a") return M("gif", w(e, 6), w(e, 8));
|
|
216
|
+
}
|
|
217
|
+
function k(e) {
|
|
218
|
+
if (!(e.length < 26 || e[0] !== 66 || e[1] !== 77)) return M("bmp", Math.abs(T(e, 18)), Math.abs(T(e, 22)));
|
|
219
|
+
}
|
|
220
|
+
var A = /* @__PURE__ */ new Set([
|
|
221
|
+
192,
|
|
222
|
+
193,
|
|
223
|
+
194,
|
|
224
|
+
195,
|
|
225
|
+
197,
|
|
226
|
+
198,
|
|
227
|
+
199,
|
|
228
|
+
201,
|
|
229
|
+
202,
|
|
230
|
+
203,
|
|
231
|
+
205,
|
|
232
|
+
206,
|
|
233
|
+
207
|
|
234
|
+
]);
|
|
235
|
+
function j(e) {
|
|
236
|
+
if (e.length < 4 || e[0] !== 255 || e[1] !== 216) return;
|
|
237
|
+
let t = 2;
|
|
238
|
+
for (; t + 9 < e.length;) {
|
|
239
|
+
if (e[t] !== 255) {
|
|
240
|
+
t += 1;
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
let n = e[t + 1];
|
|
244
|
+
if (n === 255) {
|
|
245
|
+
t += 1;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (n === 216 || n === 1 || n >= 208 && n <= 215) {
|
|
249
|
+
t += 2;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (A.has(n)) return M("jpg", e[t + 7] << 8 | e[t + 8], e[t + 5] << 8 | e[t + 6]);
|
|
253
|
+
let r = e[t + 2] << 8 | e[t + 3];
|
|
254
|
+
if (r < 2) return;
|
|
255
|
+
t += 2 + r;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function M(e, t, n) {
|
|
259
|
+
return t > 0 && n > 0 ? {
|
|
260
|
+
type: e,
|
|
261
|
+
width: t,
|
|
262
|
+
height: n
|
|
263
|
+
} : void 0;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
export { a, l as i, h as n, o, c as r, g as t };
|