openxiangda 1.0.153 → 1.0.154
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/openxiangda-skills/references/troubleshooting.md +18 -5
- package/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +41 -1
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.d.mts +2 -1
- package/packages/sdk/dist/components/index.d.ts +2 -1
- package/packages/sdk/dist/components/index.mjs +41 -1
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +40 -1
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +40 -1
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +40 -1
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.mjs +40 -1
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
|
@@ -4190,6 +4190,45 @@ var normalizePreviewBlobResponse = (response) => {
|
|
|
4190
4190
|
if (blob) return blob;
|
|
4191
4191
|
throw new Error(getBinaryResponseMessage(payload) || "\u6587\u4EF6\u5185\u5BB9\u54CD\u5E94\u4E0D\u662F\u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4192
4192
|
};
|
|
4193
|
+
var isZipBytes = (bytes) => bytes.length >= 4 && bytes[0] === 80 && bytes[1] === 75 && (bytes[2] === 3 && bytes[3] === 4 || bytes[2] === 5 && bytes[3] === 6 || bytes[2] === 7 && bytes[3] === 8);
|
|
4194
|
+
var decodeBase64ZipBlob = async (blob) => {
|
|
4195
|
+
const prefix = (await blob.slice(0, 96).text()).replace(/^\uFEFF/, "").replace(/\s+/g, "");
|
|
4196
|
+
if (!prefix.startsWith("UEsDB")) return blob;
|
|
4197
|
+
if (blob.size > 32 * 1024 * 1024) {
|
|
4198
|
+
throw new Error("Base64 \u6587\u4EF6\u8D85\u8FC7\u6D4F\u89C8\u5668\u517C\u5BB9\u89E3\u7801\u4E0A\u9650");
|
|
4199
|
+
}
|
|
4200
|
+
const base64 = (await blob.text()).replace(/^\uFEFF/, "").replace(/\s+/g, "");
|
|
4201
|
+
if (!/^[A-Za-z0-9+/]+={0,2}$/.test(base64)) {
|
|
4202
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4203
|
+
}
|
|
4204
|
+
let binary = "";
|
|
4205
|
+
try {
|
|
4206
|
+
binary = globalThis.atob(base64);
|
|
4207
|
+
} catch {
|
|
4208
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4209
|
+
}
|
|
4210
|
+
const bytes = new Uint8Array(binary.length);
|
|
4211
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
4212
|
+
bytes[index] = binary.charCodeAt(index);
|
|
4213
|
+
}
|
|
4214
|
+
if (!isZipBytes(bytes)) {
|
|
4215
|
+
throw new Error("Base64 \u6587\u4EF6\u89E3\u7801\u540E\u4E0D\u662F\u6709\u6548\u7684 Office \u6587\u6863");
|
|
4216
|
+
}
|
|
4217
|
+
if (globalThis.btoa(binary).replace(/=+$/, "") !== base64.replace(/=+$/, "")) {
|
|
4218
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
4219
|
+
}
|
|
4220
|
+
return new Blob([bytes], { type: blob.type || "application/zip" });
|
|
4221
|
+
};
|
|
4222
|
+
var normalizePreviewBlobContent = async (response) => {
|
|
4223
|
+
const blob = normalizePreviewBlobResponse(response);
|
|
4224
|
+
if (String(blob.type || "").toLowerCase().includes("application/json")) {
|
|
4225
|
+
const payload = await blob.text().then((value) => JSON.parse(value)).catch(() => null);
|
|
4226
|
+
if (payload) {
|
|
4227
|
+
throw new Error(getBinaryResponseMessage(payload) || "\u6587\u4EF6\u5185\u5BB9\u8BF7\u6C42\u5931\u8D25");
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
return decodeBase64ZipBlob(blob);
|
|
4231
|
+
};
|
|
4193
4232
|
var isDirectStorageItem = (item) => item.provider === "oss" || item.uploadProvider === "oss" || item.uploadProvider === "builtin-oss" || Boolean(item.storageCode);
|
|
4194
4233
|
var getPreviewItemKey = (item, index = 0) => getAttachmentItemIdentity(item) || item.id || item.uid || `${item.name || "file"}-${index}`;
|
|
4195
4234
|
var getPreviewSourceUrl = (item) => item.previewUrl || item.publicUrl || item.url || "";
|
|
@@ -4363,7 +4402,7 @@ var prepareFilePreview = async (options) => {
|
|
|
4363
4402
|
};
|
|
4364
4403
|
var loadPreviewBlob = async (request, url) => {
|
|
4365
4404
|
const response = await request({ url, method: "get", responseType: "blob" });
|
|
4366
|
-
return
|
|
4405
|
+
return normalizePreviewBlobContent(response);
|
|
4367
4406
|
};
|
|
4368
4407
|
var convertHeicPreview = async (request, url) => {
|
|
4369
4408
|
const source = await loadPreviewBlob(request, url);
|