UNPKG

naive-upload

Version:

<p align="left"> <a href="https://www.npmjs.org/package/naive-upload"> <img src="https://img.shields.io/npm/v/naive-upload.svg"> </a> <a href="https://bundlephobia.com/package/naive-upload@latest"> <img src="https://img.shields.io/bundl

1,161 lines 104 kB
var Ee = Object.defineProperty; var ke = (f, e, t) => e in f ? Ee(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t; var c = (f, e, t) => (ke(f, typeof e != "symbol" ? e + "" : e, t), t); import { defineComponent as T, openBlock as C, createElementBlock as S, unref as w, createElementVNode as _, withModifiers as De, renderSlot as M, normalizeClass as de, normalizeStyle as ue, createCommentVNode as L, createBlock as W, resolveDynamicComponent as ae, withCtx as P, Fragment as Z, withDirectives as he, vModelText as ge, createTextVNode as se, createSlots as pe, renderList as ie, createVNode as V, TransitionGroup as Se, toDisplayString as Ae } from "vue"; import { inject as I, reactive as R, getCurrentInstance as fe, shallowRef as N, watch as ne, provide as Be } from "vue-demi"; import _e from "spark-md5"; var q = /* @__PURE__ */ ((f) => (f.\u5168\u81EA\u52A8 = "AT", f.\u624B\u52A8\u6321 = "MT", f.\u534A\u81EA\u52A8 = "AMT", f))(q || {}), X = /* @__PURE__ */ ((f) => (f.\u5361\u7247 = "Card", f.\u6E05\u5355 = "Detailedly", f))(X || {}); class $ { constructor(e, t, s, o) { c(this, "r"); c(this, "g"); c(this, "b"); c(this, "a"); c(this, "toString", () => `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`); this.r = e, this.g = t, this.b = s, this.a = o; } static convertFrom(e) { return new $(e.r, e.g, e.b, e.a); } } const te = class { constructor() { c(this, "build", (e) => (e(this), this)); c(this, "setup", (e) => (e(this), this)); c(this, "configCode", "default"); c(this, "concurrentFile", 3); c(this, "concurrentChunkFile", 3); c(this, "tip", "\u5355\u51FB\u6216\u62D6\u52A8\u6587\u4EF6\u5230\u6B64\u533A\u57DF\u5373\u53EF\u4E0A\u4F20"); c(this, "layout", X.\u5361\u7247); c(this, "runMode", q.\u5168\u81EA\u52A8); c(this, "enableChunk", !0); c(this, "chunkSize", 2097152); c(this, "retry", 3); c(this, "enableWorker", !0); c(this, "readonly", !1); c(this, "debug", !1); c(this, "alertErrorInfo", !1); c(this, "enableDrag", !0); c(this, "statusCheckingColor", new $(255, 235, 59, 0.5)); c(this, "statusUploadingColor", new $(144, 206, 255, 0.5)); c(this, "statusPausedColor", new $(158, 158, 158, 0.5)); c(this, "statusPausedSubColor", new $(244, 154, 3, 0.5)); c(this, "statusDoneColor", new $(76, 175, 80, 0.1)); c(this, "statusDoneSubColor", new $(3, 169, 244, 0.5)); c(this, "statusErrorColor", new $(255, 0, 30, 0.35)); c(this, "statusErrorSubColor", new $(232, 31, 31, 0.5)); c(this, "dragReadyColor", new $(255, 152, 0, 0.8)); c(this, "dragMovingColor", new $(255, 152, 0, 0.5)); c(this, "dragOverColor", new $(255, 87, 34, 0.8)); c(this, "dragPreparationTime", 1500); c(this, "dragChangePositionTime", 1300); } }; let Y = te; c(Y, "default", () => new te()), c(Y, "defaultWithConfigCode", (e) => new te().setup((t) => t.configCode = e)); const Le = ["title"], ve = ["multiple", "accept"], $e = { class: "upload-box-content" }, Fe = /* @__PURE__ */ T({ __name: "FileInput.vue3", setup(f) { const e = I("upload")(); R({}); let t; const s = (l) => { l && (t = l); }, o = (l) => { e.limited() || t == null || t.click(); }, r = (l) => { if (t && t.files) for (let g = 0; g < t.files.length; g++) e.append(t.files[g]); t && (t.value = ""); }; return (async () => e.getSettings().debug && console.debug("Piece: File Input Component(vue3) \u5DF2\u52A0\u8F7D"))(), (l, g) => (C(), S("div", { class: "upload-btn", onClick: o, title: w(e).getSettings().tip }, [ _("div", { onClick: g[0] || (g[0] = De(() => { }, ["stop"])) }, [ _("input", { type: "file", multiple: w(e).getConfig().upperLimit > 1, ref: s, accept: w(e).getAllowedTypes(), onChange: r }, null, 40, ve) ]), _("div", $e, [ M(l.$slots, "default") ]) ], 8, Le)); } }); var E = /* @__PURE__ */ ((f) => (f.\u7535\u5B50\u6587\u6863 = "\u7535\u5B50\u6587\u6863", f.\u7535\u5B50\u8868\u683C = "\u7535\u5B50\u8868\u683C", f.\u6587\u672C\u6587\u4EF6 = "\u6587\u672C\u6587\u4EF6", f.\u56FE\u7247 = "\u56FE\u7247", f.\u97F3\u9891 = "\u97F3\u9891", f.\u89C6\u9891 = "\u89C6\u9891", f.\u538B\u7F29\u5305 = "\u538B\u7F29\u5305", f.\u672A\u77E5 = "\u672A\u77E5", f.\u5916\u94FE\u8D44\u6E90 = "\u5916\u94FE\u8D44\u6E90", f))(E || {}); const Ue = ["title"], Pe = { key: 0, class: "item-body" }, Te = { class: "item-image" }, xe = ["src", "alt"], He = { key: 0, class: "item-tools" }, Ie = { key: 1, class: "item-sub sub-paused" }, Me = { key: 2, class: "item-sub sub-done" }, Re = { key: 3, class: "item-sub sub-error" }, be = /* @__PURE__ */ T({ __name: "SelectedFileInfo.vue3", props: { key: null, selectedFile: null, readyDrag: { type: Boolean }, startDrag: { type: Boolean }, dragging: { type: Boolean }, dragover: { type: Boolean } }, emits: ["setContainerRef", "mouseDown", "mouseUp", "mouseEnter", "mouseLeave"], setup(f, { emit: e }) { const t = f, { proxy: s } = fe(), o = I("upload")(); let r = R({ hover: !1, container: { style: () => `item-container ${t.selectedFile.done && !o.getSettings().readonly ? " item-done" : ""} ${t.selectedFile.error ? " item-error" : ""} ${r.hover && !r.rename.active && !t.selectedFile.checking && !t.selectedFile.uploading && !t.readyDrag && !t.startDrag ? " item-hover" : ""} ${t.selectedFile.checking ? " item-checking" : ""} ${t.selectedFile.uploading ? " item-uploading" : ""} ${t.selectedFile.canceled ? " item-canceled" : ""} ${t.selectedFile.paused ? " item-paused" : ""} ${t.readyDrag ? " item-ready-drag" : ""} ${t.dragging ? " item-dragging" : ""} ${t.dragover ? " item-drag-over" : ""}`, styleVar: () => ({ "--statusCheckingColor": o.getSettings().statusCheckingColor.toString(), "--statusUploadingColor": o.getSettings().statusUploadingColor.toString(), "--statusPausedColor": o.getSettings().statusPausedColor.toString(), "--statusPausedSubColor": o.getSettings().statusPausedSubColor.toString(), "--statusDoneColor": o.getSettings().statusDoneColor.toString(), "--statusDoneSubColor": o.getSettings().statusDoneSubColor.toString(), "--statusErrorColor": o.getSettings().statusErrorColor.toString(), "--statusErrorSubColor": o.getSettings().statusErrorSubColor.toString(), "--dragPreparationTime": `${(o.getSettings().dragPreparationTime / 1e3).toFixed(2)}s`, "--dragChangePositionTime": `${(o.getSettings().dragChangePositionTime / 1e3).toFixed(2)}s`, "--dragReadyColor": o.getSettings().dragReadyColor.toString(), "--dragMovingColor": o.getSettings().dragMovingColor.toString(), "--dragOverColor": o.getSettings().dragOverColor.toString() }), info: () => `${t.selectedFile.done ? "\u4E0A\u4F20\u6210\u529F" : ""} ${t.selectedFile.error ? t.selectedFile.errorMessage : ""} ${t.selectedFile.paused ? "\u5DF2\u6682\u505C" : ""}` }, loading: { show: () => !r.rename.active && (t.selectedFile.checking || t.selectedFile.uploading), info: () => `${t.selectedFile.checking ? "\u626B\u63CF\u4E2D..." + t.selectedFile.percent + "%" : ""} ${t.selectedFile.uploading ? "\u4E0A\u4F20\u4E2D..." + t.selectedFile.percent + "%" : ""}` }, tools: { show: () => r.hover && t.dragging === !1 && !r.rename.active && !t.selectedFile.checking && !t.selectedFile.uploading }, rename: { enable: () => !t.selectedFile.uploading, active: !1, value: "" }, view: { enable: () => { switch (t.selectedFile.fileType) { case E.\u56FE\u7247: case E.\u97F3\u9891: return t.selectedFile.extensionLower !== ".flac"; case E.\u89C6\u9891: return !0; case E.\u6587\u672C\u6587\u4EF6: return !0; case E.\u7535\u5B50\u6587\u6863: return t.selectedFile.extensionLower === ".pdf" || t.selectedFile.extensionLower === ".doc" || t.selectedFile.extensionLower === ".docx"; default: return !1; } } }, save: { enable: () => !0 } }), l; const g = (a) => { a && e("setContainerRef", a); }, p = (a) => { a && (l = a); }, A = (a) => { t.readyDrag || t.startDrag ? (e("mouseEnter", a), r.hover = !1) : r.hover = !0; }, b = (a) => { (t.readyDrag || t.startDrag) && e("mouseLeave", a), r.hover = !1; }, y = (a) => { e("mouseDown", a); }, m = (a) => { e("mouseUp", a); }, F = () => { r.rename.active = !0, s.$nextTick(() => { l && l.focus(); }); }, k = (a) => { a.key == "Enter" && h(); }, h = () => { o.rename(t.selectedFile.token, r.rename.value).then(() => { r.rename.active = !1; }).catch(() => { r.rename.active = !1; }); }, d = () => { const a = o.getRawFile(t.selectedFile), u = "margin:0px;text-align: center;display: flex;flex-direction: row;justify-content: center;align-items: center"; switch (t.selectedFile.fileType) { case E.\u56FE\u7247: let B = window.open(); B == null || B.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${u};background-color: black;"><img style="max-width: 100%;max-height: 100%;" src="${a.objectURL}" alt="${t.selectedFile.fullname()}"></body>` ); break; case E.\u97F3\u9891: if (t.selectedFile.extensionLower === ".flac") return; let v = window.open(); v == null || v.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${u};background-color: black;"><audio style="max-width: 100%;max-height: 100%;" src="${a.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</audio></body>` ); break; case E.\u89C6\u9891: let U = window.open(); U == null || U.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${u};background-color: black;"><video style="max-width: 100%;max-height: 100%;" src="${a.objectURL}" controls="controls">\u62B1\u6B49, \u6682\u4E0D\u652F\u6301</video></body>` ); break; default: let Q = window.open(); Q == null || Q.document.write( `<head><title>${t.selectedFile.fullname()}</title></head><body style="${u};"><object style="max-width: 100%;max-height: 100%;" data="${a.objectURL}" type="${t.selectedFile.extensionLower === ".txt" ? "text/plain" : t.selectedFile.extensionLower === ".pdf" ? "application/pdf" : "application/octet-stream"}" width="100%" height="100%"><iframe src="${a.objectURL}" width="100%" height="100%" ></iframe></object></body>` ); break; } }, n = () => { const a = o.getRawFile(t.selectedFile), u = document.createElement("a"); u.style.display = "none", u.href = o.getDownloadUrl(t.selectedFile), a.file && (u.download = t.selectedFile.fullname()), document.body.appendChild(u), u.click(), document.body.removeChild(u); }, i = () => { o.remove(t.selectedFile.token); }; return (async () => o.getSettings().debug && console.debug("Piece: Selected File Info Component(vue3) \u5DF2\u52A0\u8F7D"))(), (a, u) => (C(), S("div", { class: de(w(r).container.style()), style: ue(w(r).container.styleVar()), title: w(r).container.info(), onMouseenter: A, onMouseleave: b, onMousedown: y, onMouseup: m, ref: g }, [ t.selectedFile.canceled ? L("", !0) : (C(), S("div", Pe, [ _("div", Te, [ _("img", { src: t.selectedFile.thumbnail, loading: "lazy", alt: t.selectedFile.fullname() }, null, 8, xe) ]), w(r).tools.show() ? (C(), S("span", He, [ w(r).rename.enable() && !w(o).getSettings().readonly ? (C(), S("span", { key: 0, class: "upload-icon icon-rename", title: "\u91CD\u547D\u540D", onClick: u[0] || (u[0] = (B) => F()) })) : L("", !0), w(r).view.enable() ? (C(), S("span", { key: 1, class: "upload-icon icon-view", title: "\u67E5\u770B", onClick: u[1] || (u[1] = (B) => d()) })) : L("", !0), w(r).save.enable() ? (C(), S("span", { key: 2, class: "upload-icon icon-download", title: "\u4FDD\u5B58", onClick: u[2] || (u[2] = (B) => n()) })) : L("", !0), w(o).getSettings().readonly ? L("", !0) : (C(), S("span", { key: 3, class: "upload-icon icon-remove", title: "\u5220\u9664", onClick: u[3] || (u[3] = (B) => i()) })) ])) : L("", !0), M(a.$slots, "default", { selectedFile: t.selectedFile, rename: w(r).rename, funs: { setRenameInputRef: p, renameKeydown: k, renameDone: h }, loading: w(r).loading }), t.selectedFile.paused ? (C(), S("div", Ie, " \u6682\u505C ")) : L("", !0), t.selectedFile.done && !w(o).getSettings().readonly ? (C(), S("div", Me, " \u5B8C\u6210 ")) : L("", !0), t.selectedFile.error ? (C(), S("div", Re, "\u9519\u8BEF")) : L("", !0) ])) ], 46, Ue)); } }), Oe = { class: "upload-container independent" }, ze = { class: "upload-list" }, We = /* @__PURE__ */ T({ __name: "index.vue3", setup(f) { const e = I("upload")(); return (async () => e.getSettings().debug && console.debug("Layout: Card Index Component(vue3) \u5DF2\u52A0\u8F7D"))(), (t, s) => (C(), S("div", Oe, [ M(t.$slots, "uploadContainer", {}, void 0, !0), _("div", ze, [ M(t.$slots, "listContainer", {}, void 0, !0) ]) ])); } }); const ye = (f, e) => { const t = f.__vccOpts || f; for (const [s, o] of e) t[s] = o; return t; }, je = /* @__PURE__ */ ye(We, [["__scopeId", "data-v-dfb9d6ed"]]), Qe = { class: "upload-container independent" }, Ne = { class: "upload-list" }, Xe = /* @__PURE__ */ T({ __name: "index.vue3", setup(f) { const e = I("upload")(); return (async () => e.getSettings().debug && console.debug("Layout: Detailedly Index Component(vue3) \u5DF2\u52A0\u8F7D"))(), (t, s) => (C(), S("div", Qe, [ M(t.$slots, "uploadContainer", {}, void 0, !0), _("div", Ne, [ M(t.$slots, "listContainer", {}, void 0, !0) ]) ])); } }); const Ye = /* @__PURE__ */ ye(Xe, [["__scopeId", "data-v-ae4f85bd"]]), Ke = { key: 0 }, me = /* @__PURE__ */ T({ __name: "index.vue3", setup(f) { const e = I("upload")(); let t = R({ loading: !0, currentThemeIndex: null }); return (async () => { const s = (o) => { switch (t.loading = !0, o) { case X.\u5361\u7247: t.currentThemeIndex = N(je); break; case X.\u6E05\u5355: t.currentThemeIndex = N(Ye); break; } t.loading = !1, e.getSettings().debug && console.debug("Layout: Index Component(vue3) \u5DF2\u53D8\u66F4"); }; e.registerLayoutChanged(s), s(e.getSettings().layout), e.getSettings().debug && console.debug("Layout: Index Component(vue3) \u5DF2\u52A0\u8F7D"); })(), (s, o) => w(t).loading ? L("", !0) : (C(), S("div", Ke, [ (C(), W(ae(w(t).currentThemeIndex), null, { uploadContainer: P(() => [ M(s.$slots, "uploadContainer") ]), listContainer: P(() => [ M(s.$slots, "listContainer") ]), _: 3 })) ])); } }), Ve = { class: "item-info" }, qe = ["title", "innerHTML"], Je = ["title"], Ge = /* @__PURE__ */ T({ __name: "info.vue3", props: { slotProps: null }, setup(f) { const e = f, t = I("upload")(); let s = R({ selectedFileSortMap: t.getSelectedFileSortMap(), lodingStyle: () => `${e.slotProps.selectedFile.checking ? t.getGradientStyle( "conic", "rgba(255, 236, 201, 0.5)", e.slotProps.selectedFile.percent, e.slotProps.selectedFile.virtualPercent ) : ""} ${e.slotProps.selectedFile.uploading ? t.getGradientStyle( "conic", "rgba(144, 206, 255, 0.5)", e.slotProps.selectedFile.percent, e.slotProps.selectedFile.virtualPercent ) : ""} ${e.slotProps.selectedFile.paused ? t.getGradientStyle( "conic", "rgba(158, 158, 158, 0.5)", e.slotProps.selectedFile.percent, e.slotProps.selectedFile.virtualPercent ) : ""}` }); return (async () => t.getSettings().debug && console.debug("Layout: Card Info Component(vue3) \u5DF2\u52A0\u8F7D"))(), (o, r) => (C(), S(Z, null, [ _("div", Ve, [ e.slotProps.rename.active ? L("", !0) : (C(), S("span", { key: 0, class: "single-text-omitted item-name", title: e.slotProps.selectedFile.fileType + `\r ` + e.slotProps.selectedFile.size + `\r ` + e.slotProps.selectedFile.fullname(), innerHTML: e.slotProps.selectedFile.fullname() }, null, 8, qe)), e.slotProps.rename.active ? he((C(), S("input", { key: 1, class: "item-rename-input", type: "text", "onUpdate:modelValue": r[0] || (r[0] = (l) => e.slotProps.rename.value = l), ref: e.slotProps.funs.setRenameInputRef, onKeydown: r[1] || (r[1] = (l) => e.slotProps.funs.renameKeydown(l)), onBlur: r[2] || (r[2] = (l) => e.slotProps.funs.renameDone()) }, null, 544)), [ [ge, e.slotProps.rename.value] ]) : L("", !0) ]), e.slotProps.loading.show() ? (C(), S("div", { key: 0, class: "item-loading", style: ue(w(s).lodingStyle()), title: e.slotProps.loading.info() }, null, 12, Je)) : L("", !0) ], 64)); } }), Ze = { class: "item-info" }, et = { class: "single-text-omitted item-name" }, tt = ["title", "innerHTML"], st = { class: "single-text-omitted item-size" }, nt = ["title", "innerHTML"], it = { class: "single-text-omitted item-filetype" }, rt = ["title", "innerHTML"], ut = ["title"], at = /* @__PURE__ */ T({ __name: "info.vue3", props: { slotProps: null }, setup(f) { const e = f, t = I("upload")(); let s = R({ selectedFileSortMap: t.getSelectedFileSortMap(), lodingStyle: () => `${e.slotProps.selectedFile.checking ? t.getGradientStyle( "linear", "rgba(255, 236, 201, 0.5)", e.slotProps.selectedFile.percent, e.slotProps.selectedFile.virtualPercent ) : ""} ${e.slotProps.selectedFile.uploading ? t.getGradientStyle( "linear", "rgba(144, 206, 255, 0.5)", e.slotProps.selectedFile.percent, e.slotProps.selectedFile.virtualPercent ) : ""} ${e.slotProps.selectedFile.paused ? t.getGradientStyle( "linear", "rgba(158, 158, 158, 0.5)", e.slotProps.selectedFile.percent, e.slotProps.selectedFile.virtualPercent ) : ""}` }); return (async () => t.getSettings().debug && console.debug("Layout: Detailedly Info Component(vue3) \u5DF2\u52A0\u8F7D"))(), (o, r) => (C(), S(Z, null, [ _("div", Ze, [ _("span", et, [ se(" \u540D\u79F0\uFF1A"), e.slotProps.rename.active ? L("", !0) : (C(), S("span", { key: 0, title: e.slotProps.selectedFile.fullname(), innerHTML: e.slotProps.selectedFile.fullname() }, null, 8, tt)), e.slotProps.rename.value ? he((C(), S("input", { key: 1, class: "item-rename-input", type: "text", "onUpdate:modelValue": r[0] || (r[0] = (l) => e.slotProps.selectedFile.newName = l), ref: e.slotProps.funs.setRenameInputRef, onKeydown: r[1] || (r[1] = (l) => e.slotProps.funs.renameKeydown(l)), onBlur: r[2] || (r[2] = (l) => e.slotProps.funs.renameDone()) }, null, 544)), [ [ge, e.slotProps.selectedFile.newName] ]) : L("", !0) ]), _("span", st, [ se(" \u5927\u5C0F\uFF1A"), _("span", { title: e.slotProps.selectedFile.size, innerHTML: e.slotProps.selectedFile.size }, null, 8, nt) ]), _("span", it, [ se(" \u7C7B\u578B\uFF1A"), _("span", { title: e.slotProps.selectedFile.fileType, innerHTML: e.slotProps.selectedFile.fileType }, null, 8, rt) ]) ]), e.slotProps.loading.show() ? (C(), S("div", { key: 0, class: "item-loading", style: ue(w(s).lodingStyle()), title: e.slotProps.loading.info() }, null, 12, ut)) : L("", !0) ], 64)); } }), ot = { key: 0 }, we = /* @__PURE__ */ T({ __name: "info.vue3", props: { slotProps: null }, setup(f) { const e = f, t = I("upload")(); let s = R({ loading: !0, currentThemeInfo: null }); return (async () => (((r) => { switch (s.loading = !0, t.getSettings().layout) { case X.\u5361\u7247: s.currentThemeInfo = N(Ge); break; case X.\u6E05\u5355: s.currentThemeInfo = N(at); break; } s.loading = !1, t.getSettings().debug && console.debug("Layout: Info Component(vue3) \u5DF2\u53D8\u66F4"); })(), t.getSettings().debug && console.debug("Layout: Info Component(vue3) \u5DF2\u52A0\u8F7D")))(), (o, r) => w(s).loading ? L("", !0) : (C(), S("div", ot, [ (C(), W(ae(w(s).currentThemeInfo), { slotProps: e.slotProps }, null, 8, ["slotProps"])) ])); } }), lt = /* @__PURE__ */ _("p", { class: "upload-icon icon-select-file" }, null, -1), ct = /* @__PURE__ */ T({ __name: "SingleUpload.vue3", setup(f) { const e = I("upload")(); return (async () => e.getSettings().debug && console.debug("Piece: Single Upload Component(vue3) \u5DF2\u52A0\u8F7D"))(), (t, s) => (C(), W(me, null, pe({ listContainer: P(() => [ (C(!0), S(Z, null, ie(w(e).getSelectedFileSortMap().size, (o) => (C(), W(be, { key: o, selectedFile: w(e).getSelectedFile(o) }, { default: P((r) => [ V(we, { class: "item-info-container", slotProps: r }, null, 8, ["slotProps"]) ]), _: 2 }, 1032, ["selectedFile"]))), 128)) ]), _: 2 }, [ w(e).getSettings().readonly ? void 0 : { name: "uploadContainer", fn: P(() => [ w(e).anyFile() ? L("", !0) : (C(), W(Fe, { key: 0, class: "upload-box-container single", title: w(e).getConfig().explain }, { default: P(() => [ lt ]), _: 1 }, 8, ["title"])) ]), key: "0" } ]), 1024)); } }), dt = ["title"], ht = /* @__PURE__ */ T({ __name: "DropFileInput.vue3", setup(f) { const e = I("upload")(), t = (o) => { o.preventDefault(); }, s = (o) => { if (o.preventDefault(), o.dataTransfer) for (let r = 0; r < o.dataTransfer.files.length; r++) e.append(o.dataTransfer.files[r]); }; return (async () => e.getSettings().debug && console.debug("Piece: Drop File Input Component(vue3) \u5DF2\u52A0\u8F7D"))(), (o, r) => (C(), S("div", { class: de(w(e).getSelectCLass()), onDrop: s, onDragover: t, title: w(e).getSelectFileAlarmInfo() }, [ V(Fe, null, { default: P(() => [ M(o.$slots, "default") ]), _: 3 }) ], 42, dt)); } }); class J { constructor() { c(this, "containerEl"); c(this, "el"); c(this, "flag", !1); c(this, "x", 0); c(this, "y", 0); c(this, "currentX", 0); c(this, "currentY", 0); c(this, "offsetX", 0); c(this, "offsetY", 0); c(this, "scrollX", 0); c(this, "scrollY", 0); c(this, "transX", 0); c(this, "transY", 0); c(this, "lastTransX", 0); c(this, "lastTransY", 0); c(this, "zIndex", ""); c(this, "position", ""); c(this, "transform", ""); c(this, "transLate", 1); c(this, "restoreError", [20, 10]); c(this, "mouseMove"); c(this, "scroll"); } moving(e, t) { this.currentX = e, this.currentY = t, this.checkRestore() ? (this.transX = 0, this.transY = 0, this.el.style.transform = this.transform) : (this.transX = this.currentX - this.x + this.scrollX + this.offsetX, this.transY = this.currentY - this.y + this.scrollY + this.offsetY, (Math.abs(this.transX - this.lastTransX) >= this.transLate || Math.abs(this.transY - this.lastTransY) >= this.transLate) && (this.el.style.transform = `translate(${this.transX}px, ${this.transY}px)`)), this.lastTransX = this.transX, this.lastTransY = this.transY; } checkRestore() { return J.equalError(this.x, this.currentX, this.restoreError[0]) && J.equalError(this.y, this.currentY, this.restoreError[1]); } static equalError(e, t, s) { return t + s >= e && t - s <= e; } static getInstance(e, t) { let s = new J(); return s.el = t, s.containerEl = e, s; } start(e, t, s) { this.flag = !0, this.currentX = e, this.currentY = t, this.save(); let o = !1; this.mouseMove = (r) => { !this.flag || o || (r.preventDefault(), o = !0, this.moving(r.clientX, r.clientY), s && s(r), o = !1); }, this.containerEl.addEventListener("mousemove", this.mouseMove), this.scroll = (r) => { this.scrollX = this.containerEl.scrollLeft, this.scrollY = this.containerEl.scrollTop; }, this.containerEl.addEventListener("scroll", this.scroll); } offset(e, t) { this.offsetX = e, this.offsetY = t; } save() { this.x = this.currentX, this.y = this.currentY, this.zIndex = this.el.style.zIndex, this.position = this.el.style.position, this.transform = this.el.style.transform; } restore() { this.flag = !1, this.x = this.currentX, this.y = this.currentY, this.el.style.zIndex = this.zIndex, this.el.style.position = this.position, this.el.style.transform = this.transform; } end(e) { e && this.restore(), this.containerEl.removeEventListener("mousemove", this.mouseMove), this.containerEl.removeEventListener("scroll", this.scroll); } } const gt = /* @__PURE__ */ _("p", { class: "upload-icon icon-inbox" }, null, -1), pt = ["innerHTML"], ft = ["innerHTML"], Ft = { class: "upload-error-list pretty-scrollbar" }, bt = /* @__PURE__ */ T({ __name: "MultipleUpload.vue3", setup(f) { const { proxy: e } = fe(), t = I("upload")(); let s = R({ scrollLock: !1, readyDraggingSortKey: null, currentDraggingSortKey: null, lastDraggingSortKey: null, errors: [] }), o, r = /* @__PURE__ */ new Map(), l = { startTick: null, changeTick: null, draggingHelper: null, ready2start: (F, k, h) => { if (!t.getSettings().enableDrag) { t.getSettings().debug && console.debug( "Piece: Multiple Upload Component(vue3) \u672A\u542F\u7528\u62D6\u52A8\u6392\u5E8F\u529F\u80FD" ); return; } t.getSelectedFileList(!1).length <= 1 || (l.startTick = setTimeout(() => { s.readyDraggingSortKey = F, l.startTick = setTimeout(() => { !o || (s.readyDraggingSortKey = null, s.currentDraggingSortKey = F, l.draggingHelper = J.getInstance( o, r.get(s.currentDraggingSortKey) ), l.draggingHelper.start(k, h), r.forEach((d, n) => { n !== s.currentDraggingSortKey && (d.style.zIndex = "1"); })); }, t.getSettings().dragPreparationTime); }, 500)); }, ready2change: (F) => { s.lastDraggingSortKey = F, s.currentDraggingSortKey !== s.lastDraggingSortKey && (l.changeTick = setTimeout(() => { t.changeSort( s.currentDraggingSortKey, s.lastDraggingSortKey ), l.end(); }, t.getSettings().dragChangePositionTime)); }, cancelChange: () => { l.changeTick && clearTimeout(l.changeTick), s.lastDraggingSortKey = null; }, end: () => { l.startTick && clearTimeout(l.startTick), l.changeTick && clearTimeout(l.changeTick), s.readyDraggingSortKey = null, l.draggingHelper && (l.draggingHelper.end(!0), l.draggingHelper = null, r.forEach((F, k) => { k !== s.currentDraggingSortKey && (F.style.zIndex = ""); }), s.lastDraggingSortKey = null, s.currentDraggingSortKey = null); } }; const g = (F) => { F && (o = F); }, p = (F, k) => { !o || r.set(F, k); }, A = (F, k) => { l.ready2start(F, k.clientX, k.clientY); }, b = (F, k) => { l.end(); }, y = (F, k) => { l.ready2change(F); }, m = (F, k) => { l.cancelChange(); }; return (async () => { const F = (h) => { s.scrollLock || h.length == 0 || e.$nextTick(() => { let d = null, n = !1; for (let i = 0; i < h.length; i++) { let a = h[i]; if (!n && a.checking && (n = !0, d = r.get(i)), a.uploading) { d = r.get(i); break; } } !d || o && (o.scrollTop = d.offsetTop - o.offsetTop - 20); }); }; t.registerSelectedFileListChanged(F); const k = (h) => { s.errors.push(h.message), setTimeout(() => { s.errors.shift(); }, 5e3); }; t.getSettings().alertErrorInfo && t.registerAlertError(k), t.getSettings().debug && console.debug("Piece: Multiple Upload Component(vue3) \u5DF2\u52A0\u8F7D"); })(), (F, k) => (C(), W(me, null, pe({ listContainer: P(() => [ _("div", { class: "scroll-container pretty-scrollbar", ref: g, onMouseenter: k[0] || (k[0] = (h) => w(s).scrollLock = !0), onMouseleave: k[1] || (k[1] = (h) => w(s).scrollLock = !1) }, [ V(Se, { name: "fade" }, { default: P(() => [ (C(!0), S(Z, null, ie(w(t).getSelectedFileSortMap().size, (h) => { var d; return C(), W(be, { key: (d = w(t).getSelectedFileSortMap().get(h)) != null ? d : -1, selectedFile: w(t).getSelectedFile(h), readyDrag: w(s).readyDraggingSortKey === h, startDrag: w(s).currentDraggingSortKey !== null, dragging: w(s).currentDraggingSortKey === h, dragover: w(s).lastDraggingSortKey === h && w(s).currentDraggingSortKey !== h, onSetContainerRef: (n) => p(h, n), onMouseDown: (n) => A(h, n), onMouseUp: (n) => b(), onMouseEnter: (n) => y(h), onMouseLeave: (n) => m() }, { default: P((n) => [ V(we, { class: "item-info-container", slotProps: n }, null, 8, ["slotProps"]) ]), _: 2 }, 1032, ["selectedFile", "readyDrag", "startDrag", "dragging", "dragover", "onSetContainerRef", "onMouseDown", "onMouseUp", "onMouseEnter", "onMouseLeave"]); }), 128)) ]), _: 1 }) ], 32) ]), _: 2 }, [ w(t).getSettings().readonly ? void 0 : { name: "uploadContainer", fn: P(() => [ V(ht, { class: "upload-box-container" }, { default: P(() => [ gt, _("p", { class: "upload-text", innerHTML: w(t).getConfig().explain }, null, 8, pt), _("p", { class: "upload-hint", innerHTML: w(t).getSettings().tip }, null, 8, ft), _("div", Ft, [ (C(!0), S(Z, null, ie(w(s).errors, (h, d) => (C(), S("p", { class: "error-info", key: d }, Ae(h), 1))), 128)) ]) ]), _: 1 }) ]), key: "0" } ]), 1024)); } }); class D extends Error { constructor(t, s) { super(t); c(this, "innerError"); this.innerError = s; } static consoleWriteWithIndex(t, s) { console.error(`\u7B2C${s}\u5C42\u9519\u8BEF`, t), t instanceof D && t.innerError && D.consoleWriteWithIndex(t.innerError, ++s); } static consoleWrite(t) { D.consoleWriteWithIndex(t, 1); } } class re { constructor(e) { c(this, "file"); c(this, "size", 0); c(this, "checkPosition", 0); c(this, "uploadPosition", 0); c(this, "objectURL"); c(this, "md5", null); c(this, "extension"); c(this, "name"); c(this, "needSection", !1); c(this, "specs"); c(this, "key"); c(this, "chunks", []); c(this, "chunkIndexQueue", []); c(this, "userFileInfo"); c(this, "configCode"); c(this, "token"); c(this, "echo", !1); e != null && (this.file = e, this.size = e.size, this.objectURL = URL.createObjectURL(e)); } } class ee { static getByExtension(e) { switch (e) { case ".webp": case ".jpg": case ".png": case ".ioc": case ".bmp": case ".gif": case ".tif": case ".tga": case ".jpeg": return E.\u56FE\u7247; case ".mp2": case ".ac3": case ".mp3": case ".m4a": case ".m4r": case ".mmf": case ".ogg": case ".amr": case ".aac": case ".vqf": case ".wma": case ".ape": case ".wav": case ".flac": case ".cda": case ".dts": return E.\u97F3\u9891; case ".swf": case ".3gp": case ".3g2": case ".mp4": case ".mpeg": case ".mpg": case ".dat": case ".mov": case ".vob": case ".qt": case ".rm": case ".asf": case ".avi": case ".navi": case ".divx": case ".flv": case ".f4v": case ".qsv": case ".wmv": case ".mkv": case ".rmvb": case ".webm": return E.\u89C6\u9891; case ".xls": case ".xlsx": case ".csv": return E.\u7535\u5B50\u8868\u683C; case ".pdf": case ".doc": case ".docx": return E.\u7535\u5B50\u6587\u6863; case ".txt": case ".js": case ".css": case ".cs": case ".html": case ".vue": case ".ts": case ".xml": case ".json": return E.\u6587\u672C\u6587\u4EF6; case ".zip": case ".rar": case ".7z": return E.\u538B\u7F29\u5305; default: return E.\u672A\u77E5; } } static getByMIME(e) { const t = e.toLocaleLowerCase(); if (t.indexOf("image/", 0) != -1) return E.\u56FE\u7247; if (t.indexOf("audio/", 0) != -1) return E.\u97F3\u9891; if (t.indexOf("video/", 0) != -1) return E.\u89C6\u9891; if (t.indexOf("text/", 0) != -1) return E.\u6587\u672C\u6587\u4EF6; switch (e) { case "application/ogg": return E.\u97F3\u9891; case "application/mp4": return E.\u89C6\u9891; case "application/vnd.ms-excel": case "vnd.openxmlformats-officedocument.spreadsheetml.sheet": return E.\u7535\u5B50\u8868\u683C; case "application/pdf": case "application/msword": case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return E.\u7535\u5B50\u6587\u6863; case "application/json": case "application/javascript": return E.\u6587\u672C\u6587\u4EF6; case "application/x-tar": case "application/zip": case "application/x-compressed": case "application/x-zip-compressed": return E.\u538B\u7F29\u5305; default: return E.\u672A\u77E5; } } } class ce { constructor(e) { c(this, "rawIndex"); c(this, "name"); c(this, "newName"); c(this, "extension"); c(this, "fullname", () => { var e, t; return `${(e = this.name) != null ? e : ""}${(t = this.extension) != null ? t : ""}`; }); c(this, "extensionLower"); c(this, "size", ""); c(this, "fileType", E.\u672A\u77E5); c(this, "thumbnail", "/filetypes/empty.png"); c(this, "class", []); c(this, "checking", !1); c(this, "checked", !1); c(this, "uploading", !1); c(this, "uploaded", !1); c(this, "done", !1); c(this, "reTry", 0); c(this, "error", !1); c(this, "errorMessage"); c(this, "percent", 0); c(this, "virtualPercent", 0); c(this, "percentBeforPaused", 0); c(this, "virtualPercentBeforPaused", 0); c(this, "paused", !1); c(this, "canceled", !1); c(this, "token"); c(this, "echo", !1); var s; const t = e.name.lastIndexOf("."); this.name = e.name.substring(0, t), this.extension = e.name.substring(t), this.extensionLower = (s = this.extension) == null ? void 0 : s.toLowerCase(), this.fileType = e.type ? ee.getByMIME(e.type) : ee.getByExtension(this.extension); } } class H { static s4() { return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1); } static new() { return `${H.s4()}${H.s4()}-${H.s4()}-${H.s4()}-${H.s4()}-${H.s4()}${H.s4()}${H.s4()}`; } } const j = class { static getSize(e, t = 1024, s = 2) { if (e <= 0) return "0 KB"; for (let o = 0; o < j.formats.length; o++) { let r = e / Math.pow(t, o + 1); if (r < t) return `${r.toFixed(s)} ${j.formats[o]}`; } return `${(e / Math.pow(t, j.formats.length)).toFixed(s)} ${j.formats[j.formats.length - 1]}`; } }; let z = j; c(z, "formats", [ "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ]); class yt { constructor(e, t) { c(this, "index"); c(this, "blob"); c(this, "size"); c(this, "checkPosition", 0); c(this, "md5", null); c(this, "forced", !1); c(this, "checking", !1); c(this, "checked", !1); c(this, "uploading", !1); c(this, "uploaded", !1); c(this, "done", !1); c(this, "error", !1); c(this, "errorMessage"); this.index = e, this.blob = t, this.size = t.size; } } const mt = () => { let f = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; function e(h, d) { let n = h[0], i = h[1], a = h[2], u = h[3]; n += (i & a | ~i & u) + d[0] - 680876936 | 0, n = (n << 7 | n >>> 25) + i | 0, u += (n & i | ~n & a) + d[1] - 389564586 | 0, u = (u << 12 | u >>> 20) + n | 0, a += (u & n | ~u & i) + d[2] + 606105819 | 0, a = (a << 17 | a >>> 15) + u | 0, i += (a & u | ~a & n) + d[3] - 1044525330 | 0, i = (i << 22 | i >>> 10) + a | 0, n += (i & a | ~i & u) + d[4] - 176418897 | 0, n = (n << 7 | n >>> 25) + i | 0, u += (n & i | ~n & a) + d[5] + 1200080426 | 0, u = (u << 12 | u >>> 20) + n | 0, a += (u & n | ~u & i) + d[6] - 1473231341 | 0, a = (a << 17 | a >>> 15) + u | 0, i += (a & u | ~a & n) + d[7] - 45705983 | 0, i = (i << 22 | i >>> 10) + a | 0, n += (i & a | ~i & u) + d[8] + 1770035416 | 0, n = (n << 7 | n >>> 25) + i | 0, u += (n & i | ~n & a) + d[9] - 1958414417 | 0, u = (u << 12 | u >>> 20) + n | 0, a += (u & n | ~u & i) + d[10] - 42063 | 0, a = (a << 17 | a >>> 15) + u | 0, i += (a & u | ~a & n) + d[11] - 1990404162 | 0, i = (i << 22 | i >>> 10) + a | 0, n += (i & a | ~i & u) + d[12] + 1804603682 | 0, n = (n << 7 | n >>> 25) + i | 0, u += (n & i | ~n & a) + d[13] - 40341101 | 0, u = (u << 12 | u >>> 20) + n | 0, a += (u & n | ~u & i) + d[14] - 1502002290 | 0, a = (a << 17 | a >>> 15) + u | 0, i += (a & u | ~a & n) + d[15] + 1236535329 | 0, i = (i << 22 | i >>> 10) + a | 0, n += (i & u | a & ~u) + d[1] - 165796510 | 0, n = (n << 5 | n >>> 27) + i | 0, u += (n & a | i & ~a) + d[6] - 1069501632 | 0, u = (u << 9 | u >>> 23) + n | 0, a += (u & i | n & ~i) + d[11] + 643717713 | 0, a = (a << 14 | a >>> 18) + u | 0, i += (a & n | u & ~n) + d[0] - 373897302 | 0, i = (i << 20 | i >>> 12) + a | 0, n += (i & u | a & ~u) + d[5] - 701558691 | 0, n = (n << 5 | n >>> 27) + i | 0, u += (n & a | i & ~a) + d[10] + 38016083 | 0, u = (u << 9 | u >>> 23) + n | 0, a += (u & i | n & ~i) + d[15] - 660478335 | 0, a = (a << 14 | a >>> 18) + u | 0, i += (a & n | u & ~n) + d[4] - 405537848 | 0, i = (i << 20 | i >>> 12) + a | 0, n += (i & u | a & ~u) + d[9] + 568446438 | 0, n = (n << 5 | n >>> 27) + i | 0, u += (n & a | i & ~a) + d[14] - 1019803690 | 0, u = (u << 9 | u >>> 23) + n | 0, a += (u & i | n & ~i) + d[3] - 187363961 | 0, a = (a << 14 | a >>> 18) + u | 0, i += (a & n | u & ~n) + d[8] + 1163531501 | 0, i = (i << 20 | i >>> 12) + a | 0, n += (i & u | a & ~u) + d[13] - 1444681467 | 0, n = (n << 5 | n >>> 27) + i | 0, u += (n & a | i & ~a) + d[2] - 51403784 | 0, u = (u << 9 | u >>> 23) + n | 0, a += (u & i | n & ~i) + d[7] + 1735328473 | 0, a = (a << 14 | a >>> 18) + u | 0, i += (a & n | u & ~n) + d[12] - 1926607734 | 0, i = (i << 20 | i >>> 12) + a | 0, n += (i ^ a ^ u) + d[5] - 378558 | 0, n = (n << 4 | n >>> 28) + i | 0, u += (n ^ i ^ a) + d[8] - 2022574463 | 0, u = (u << 11 | u >>> 21) + n | 0, a += (u ^ n ^ i) + d[11] + 1839030562 | 0, a = (a << 16 | a >>> 16) + u | 0, i += (a ^ u ^ n) + d[14] - 35309556 | 0, i = (i << 23 | i >>> 9) + a | 0, n += (i ^ a ^ u) + d[1] - 1530992060 | 0, n = (n << 4 | n >>> 28) + i | 0, u += (n ^ i ^ a) + d[4] + 1272893353 | 0, u = (u << 11 | u >>> 21) + n | 0, a += (u ^ n ^ i) + d[7] - 155497632 | 0, a = (a << 16 | a >>> 16) + u | 0, i += (a ^ u ^ n) + d[10] - 1094730640 | 0, i = (i << 23 | i >>> 9) + a | 0, n += (i ^ a ^ u) + d[13] + 681279174 | 0, n = (n << 4 | n >>> 28) + i | 0, u += (n ^ i ^ a) + d[0] - 358537222 | 0, u = (u << 11 | u >>> 21) + n | 0, a += (u ^ n ^ i) + d[3] - 722521979 | 0, a = (a << 16 | a >>> 16) + u | 0, i += (a ^ u ^ n) + d[6] + 76029189 | 0, i = (i << 23 | i >>> 9) + a | 0, n += (i ^ a ^ u) + d[9] - 640364487 | 0, n = (n << 4 | n >>> 28) + i | 0, u += (n ^ i ^ a) + d[12] - 421815835 | 0, u = (u << 11 | u >>> 21) + n | 0, a += (u ^ n ^ i) + d[15] + 530742520 | 0, a = (a << 16 | a >>> 16) + u | 0, i += (a ^ u ^ n) + d[2] - 995338651 | 0, i = (i << 23 | i >>> 9) + a | 0, n += (a ^ (i | ~u)) + d[0] - 198630844 | 0, n = (n << 6 | n >>> 26) + i | 0, u += (i ^ (n | ~a)) + d[7] + 1126891415 | 0, u = (u << 10 | u >>> 22) + n | 0, a += (n ^ (u | ~i)) + d[14] - 1416354905 | 0, a = (a << 15 | a >>> 17) + u | 0, i += (u ^ (a | ~n)) + d[5] - 57434055 | 0, i = (i << 21 | i >>> 11) + a | 0, n += (a ^ (i | ~u)) + d[12] + 1700485571 | 0, n = (n << 6 | n >>> 26) + i | 0, u += (i ^ (n | ~a)) + d[3] - 1894986606 | 0, u = (u << 10 | u >>> 22) + n | 0, a += (n ^ (u | ~i)) + d[10] - 1051523 | 0, a = (a << 15 | a >>> 17) + u | 0, i += (u ^ (a | ~n)) + d[1] - 2054922799 | 0, i = (i << 21 | i >>> 11) + a | 0, n += (a ^ (i | ~u)) + d[8] + 1873313359 | 0, n = (n << 6 | n >>> 26) + i | 0, u += (i ^ (n | ~a)) + d[15] - 30611744 | 0, u = (u << 10 | u >>> 22) + n | 0, a += (n ^ (u | ~i)) + d[6] - 1560198380 | 0, a = (a << 15 | a >>> 17) + u | 0, i += (u ^ (a | ~n)) + d[13] + 1309151649 | 0, i = (i << 21 | i >>> 11) + a | 0, n += (a ^ (i | ~u)) + d[4] - 145523070 | 0, n = (n << 6 | n >>> 26) + i | 0, u += (i ^ (n | ~a)) + d[11] - 1120210379 | 0, u = (u << 10 | u >>> 22) + n | 0, a += (n ^ (u | ~i)) + d[2] + 718787259 | 0, a = (a << 15 | a >>> 17) + u | 0, i += (u ^ (a | ~n)) + d[9] - 343485551 | 0, i = (i << 21 | i >>> 11) + a | 0, h[0] = n + h[0] | 0, h[1] = i + h[1] | 0, h[2] = a + h[2] | 0, h[3] = u + h[3] | 0; } function t(h) { let d = [], n; for (n = 0; n < 64; n += 4) d[n >> 2] = h.charCodeAt(n) + (h.charCodeAt(n + 1) << 8) + (h.charCodeAt(n + 2) << 16) + (h.charCodeAt(n + 3) << 24); return d; } function s(h) { let d = [], n; for (n = 0; n < 64; n += 4) d[n >> 2] = h[n] + (h[n + 1] << 8) + (h[n + 2] << 16) + (h[n + 3] << 24); return d; } function o(h) { let d = h.length, n = [1732584193, -271733879, -1732584194, 271733878], i, a, u, B, v, U; for (i = 64; i <= d; i += 64) e(n, t(h.substring(i - 64, i))); for (h = h.substring(i - 64), a = h.length, u = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i = 0; i < a; i += 1) u[i >> 2] |= h.charCodeAt(i) << (i % 4 << 3); if (u[i >> 2] |= 128 << (i % 4 << 3), i > 55) for (e(n, u), i = 0; i < 16; i += 1) u[i] = 0; return B = d * 8, B = B.toString(16).match(/(.*?)(.{0,8})$/), v = parseInt(B[2], 16), U = parseInt(B[1], 16) || 0, u[14] = v, u[15] = U, e(n, u), n; } function r(h) { let d = h.length, n = [1732584193, -271733879, -1732584194, 271733878], i, a, u, B, v, U; for (i = 64; i <= d; i += 64) e(n, s(h.subarray(i - 64, i))); for (h = i - 64 < d ? h.subarray(i - 64) : new Uint8Array(0), a = h.length, u = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i = 0; i < a; i += 1) u[i >> 2] |= h[i] << (i % 4 << 3); if (u[i >> 2] |= 128 << (i % 4 << 3), i > 55) for (e(n, u), i = 0; i < 16; i += 1) u[i] = 0; return B = d * 8, B = B.toString(16).match(/(.*?)(.{0,8})$/), v = parseInt(B[2], 16), U = parseInt(B[1], 16) || 0, u[14] = v, u[15] = U, e(n, u), n; } function l(h) { let d = "", n; for (n = 0; n < 4; n += 1) d += f[h >> n * 8 + 4 & 15] + f[h >> n * 8 & 15]; return d; } function g(h) { let d; for (d = 0; d < h.length; d += 1) h[d] = l(h[d]); return h.join(""); } g(o("hello")), typeof ArrayBuffer < "u" && !ArrayBuffer.prototype.slice && function() { function h(d, n) { return d = d | 0 || 0, d < 0 ? Math.max(d + n, 0) : Math.min(d, n); } ArrayBuffer.prototype.slice = function(d, n) { let i = this.byteLength, a = h(d, i), u = i, B, v, U, Q; return n !== void 0 && (u = h(n, i)), a > u ? new ArrayBuffer(0) : (B = u - a, v = new ArrayBuffer(B), U = new Uint8Array(v), Q = new Uint8Array(this, a, B), U.set(Q), v); }; }(); function p(h) { return /[\u0080-\uFFFF]/.test(h) && (h = unescape(encodeURIComponent(h))), h; } function A(h, d) { let n = h.length, i = new ArrayBuffer(n), a = new Uint8Array(i), u; for (u = 0; u < n; u += 1) a[u] = h.charCodeAt(u); return d ? a : i; } function b(h) { return String.fromCharCode.apply(null, new Uint8Array(h)); } function y(h, d, n) { let i = new Uint8Array(h.byteLength + d.byteLength); return i.set(new Uint8Array(h)), i.set(new Uint8Array(d), h.byteLength), n ? i : i.buffer; } function m(h) { let d = [], n = h.length, i; for (i = 0; i < n - 1; i += 2) d.push(parseInt(h.substr(i, 2), 16)); return String.fromCharCode.apply(String, d); } function F() { this.reset(); } F.prototype.append = function(h) { return this.appendBinary(p(h)), this; }, F.prototype.appendBinary = function(h) { this._buff += h, this._length += h.length; let d = this._buff.length, n; for (n = 64; n <= d; n += 64) e(this._hash, t(this._buff.substring(n - 64, n))); return this._buff = this._buff.substring(n - 64), this; }, F.prototype.end = function(h) { let d = this._buff, n = d.length, i, a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], u; for (i = 0; i < n; i += 1) a[i >> 2] |= d.charCodeAt(i) << (i % 4 << 3); return this._finish(a, n), u = g(this._hash), h && (u = m(u)), this.reset(), u; }, F.prototype.reset = function() { return this._buff = "", this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this; }, F.prototype.getState = function() { return { buff: this._buff, length: this._length, hash: this._hash.slice() }; }, F.prototype.setState = function(h) { return this._buff = h.buff, this._length = h.length, this._hash = h.hash, this; }, F.prototype.destroy = function() { delete this._hash, delete this._buff, delete this._length; }, F.prototype._finish = function(h, d) { let n = d, i, a, u; if (h[n >> 2] |= 128 << (n % 4 << 3), n > 55) for (e(this._hash, h), n = 0; n < 16; n += 1) h[n] = 0; i = this._length * 8, i = i.toString(16).match(/(.*?)(.{0,8})$/), a = parseInt(i[2], 16), u = parseInt(i[1], 16) || 0, h[14] = a, h[15] = u, e(this._hash, h); }, F.hash = function(h, d) { return F.hashBinary(p(h), d); }, F.hashBinary = function(h, d) { let n = o(h), i = g(n); return d ? m(i) : i; }, F.ArrayBuffer = function() { this.reset(); }, F.ArrayBuffer.prototype.append = function(h) { let d = y(this._buff.buffer, h, !0), n = d.length, i; for (this._length += h.byteLength, i = 64; i <= n; i += 64) e(this._hash, s(d.subarray(i - 64, i))); return this._buff = i - 64 < n ? new Uint8Array(d.buffer.slice(i - 64)) : new Uint8Array(0), this; }, F.ArrayBuffer.prototype.end = function(h) { let d = this._buff, n = d.length, i = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], a, u; for (a = 0; a < n; a += 1) i[a >> 2] |= d[a] << (a % 4 << 3); return this._finish(i, n), u = g(this._hash), h && (u = m(u)), this.reset(), u; }, F.ArrayBuffer.prototype.reset = function() { return this._buff = new Uint8Array(0), this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this; }, F.ArrayBuffer.prototype.getState = function() { let h = F.prototype.getState.call(this); return h.buff = b(h.buff), h; }, F.ArrayBuffer.prototype.setState = function(h) { return h.buff = A(h.buff, !0), F.prototype.setState.call(this, h); },