import '@das-fed/ui/packages/components/image-viewer/style.css';
import { withInstall as rt } from "@das-fed/utils/with-install/index";
import { setThemeRule as ot } from "@das-fed/web/packages/theme/index";
import { ref as Ee, computed as x, watch as st, createApp as lt, defineComponent as ut, createElementBlock as U, openBlock as y, Fragment as de, createCommentVNode as p, createElementVNode as X, withDirectives as J, normalizeStyle as fe, createVNode as ie, unref as n, normalizeClass as ge, withCtx as ne, createBlock as O, vShow as j, isRef as Qe, createTextVNode as Pe, toDisplayString as Te, renderList as Me } from "vue";
import { ElImageViewer as ct, ElImage as Le } from "element-plus";
import { Upload as Fe } from "ant-design-vue";
import { vDasTooltip as Ne } from "@das-fed/ui/packages/components/text-tooltip/index";
import { DasImageUpload as Ve } from "@das-fed/ui/packages/components/image-upload/index";
import { DasSpin as Je } from "@das-fed/ui/packages/components/spin/index";
import { DasAudioVideo as ve } from "@das-fed/ui/packages/components/audio-video/index";
import { DasIconDownload as je } from "@das-fed/ui/packages/icons/download/index";
import { DasIconChange as pe } from "@das-fed/ui/packages/icons/change/index";
import { DasIconDelete as ze } from "@das-fed/ui/packages/icons/delete/index";
import { useModelValue as be } from "@das-fed/utils/vue";
import { DasMessage as xe } from "@das-fed/ui/packages/components/message/index";
import { extractFilename as _e, getFileExtension as mt } from "@das-fed/utils/common-tools";
import { getConfig as De } from "@das-fed/utils/config";
import { currentLang as Ke, i18n as He } from "@das-fed/web/packages/i18n/index";
import { iotMinio as et } from "@das-fed/utils/api-services/modules/iot";
import { useFile as dt } from "@das-fed/utils/api-services/modules/file";
import { getUserInfo as ft } from "@das-fed/utils/common-info";
import { pureImageSrc as Re } from "@das-fed/utils/pure-image-src";
import "ant-design-vue/es/upload/style/css";
import "element-plus/es/components/image/style/css";
import "element-plus/es/components/image-viewer/style/css";
import "@das-fed/ui/packages/global/theme";
const Ie = "data:image/png;base64, ", gt = (t, e) => {
  const i = new Image();
  i.setAttribute("crossOrigin", "Anonymous"), i.onload = function() {
    let a = document.createElement("canvas");
    const r = a.getContext("2d");
    a.width = i.width, a.height = i.height, r.drawImage(i, 0, 0, i.width, i.height), a.toBlob((o) => {
      let g = URL.createObjectURL(o), s = document.createElement("a"), f = new MouseEvent("click");
      const c = t.substring(t.lastIndexOf(".")).toLowerCase();
      s.download = e || `default${c}`, s.href = g, s.dispatchEvent(f), URL.revokeObjectURL(g);
    });
  }, i.src = t + "?v=" + Date.now();
}, vt = (t, e) => {
  t && fetch(t).then((i) => i.blob()).then((i) => {
    const a = document.createElement("a");
    document.body.appendChild(a), a.style.display = "none";
    const r = window.URL.createObjectURL(i);
    a.href = r, a.download = e, a.click(), document.body.removeChild(a), window.URL.revokeObjectURL(r);
  });
}, pt = (t) => {
  const e = (t == null ? void 0 : t.minioTokenApi) ?? "token";
  return et.get(e, (i) => (i.headers || (i.headers = {}), t != null && t.baseUrl && (i.baseURL = t.baseUrl), i));
}, ht = (t) => et.post("put-object", (e) => (e.headers || (e.headers = {}), t && (e.baseURL = t), e.headers["Content-Type"] = "multipart/form-data", e)), wt = () => {
  const t = ft();
  return t ? t.tenantId : "";
}, At = (t) => {
  const { baseUrl: e, serviceName: i, pathPrefix: a, bucketName: r, minioTokenApi: o, autoContentType: g } = t, s = async () => {
    const [v, d] = await pt({ baseUrl: e, minioTokenApi: o })().run();
    return v ? { stauts: !1 } : { status: !0, data: d };
  }, { generateUniqueName: f } = dt();
  return { upload: async (v, d = {}) => {
    const C = await s();
    if (!C.status) return;
    const h = v.name, m = C.data, E = a || wt(), k = h.substring(h.lastIndexOf(".")).toLowerCase(), S = t.randomName ? `${f("")}${k}` : h, K = i ? `${E}/${i}/${S}` : `${E}/${S}`, T = {
      accessKeyId: m.accessKeyId,
      secretAccessKey: m.secretAccessKey,
      sessionToken: m.sessionToken,
      file: v,
      bucketName: r || "business",
      filePath: K,
      isThumbnail: !0,
      autoContentType: g === !0 ? !0 : void 0,
      ...d
    }, [M, L] = await ht(e)(T).run();
    return M ? "error" : L.value;
  } };
}, yt = () => ({ size2B: (e) => {
  isNaN(Number(e)) ? e = e.toString() : e = e + "M";
  const i = Number(e.slice(0, -1)), a = e[e.length - 1].toUpperCase(), r = 1024, o = {
    M: r * r,
    K: r,
    B: 1
  };
  return { finalSize: i * o[a], sizeText: e };
} }), Ct = (t) => ({ handlerImageSrc: (i, a) => {
  if (a.startsWith("http")) return a;
  const r = t.useOriginUrl ? a : Re(a);
  return i + r;
} }), Et = async (t) => {
  const i = De().baseURL + Re(t);
  return await _e(i);
}, bt = async (t) => {
  const e = De();
  let i = [];
  for (const a of t) {
    const r = e.baseURL + Re(a), o = await _e(r);
    i.push(o);
  }
  return i;
};
/*!
 * Compressor.js v1.2.1
 * https://fengyuanchen.github.io/compressorjs
 *
 * Copyright 2018-present Chen Fengyuan
 * Released under the MIT license
 *
 * Date: 2023-02-28T14:09:41.732Z
 */
function We(t, e) {
  var i = Object.keys(t);
  if (Object.getOwnPropertySymbols) {
    var a = Object.getOwnPropertySymbols(t);
    e && (a = a.filter(function(r) {
      return Object.getOwnPropertyDescriptor(t, r).enumerable;
    })), i.push.apply(i, a);
  }
  return i;
}
function he(t) {
  for (var e = 1; e < arguments.length; e++) {
    var i = arguments[e] != null ? arguments[e] : {};
    e % 2 ? We(Object(i), !0).forEach(function(a) {
      kt(t, a, i[a]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : We(Object(i)).forEach(function(a) {
      Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(i, a));
    });
  }
  return t;
}
function Bt(t, e) {
  if (!(t instanceof e))
    throw new TypeError("Cannot call a class as a function");
}
function Ye(t, e) {
  for (var i = 0; i < e.length; i++) {
    var a = e[i];
    a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(t, tt(a.key), a);
  }
}
function It(t, e, i) {
  return e && Ye(t.prototype, e), i && Ye(t, i), Object.defineProperty(t, "prototype", {
    writable: !1
  }), t;
}
function kt(t, e, i) {
  return e = tt(e), e in t ? Object.defineProperty(t, e, {
    value: i,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : t[e] = i, t;
}
function Ae() {
  return Ae = Object.assign ? Object.assign.bind() : function(t) {
    for (var e = 1; e < arguments.length; e++) {
      var i = arguments[e];
      for (var a in i)
        Object.prototype.hasOwnProperty.call(i, a) && (t[a] = i[a]);
    }
    return t;
  }, Ae.apply(this, arguments);
}
function Dt(t, e) {
  if (typeof t != "object" || t === null) return t;
  var i = t[Symbol.toPrimitive];
  if (i !== void 0) {
    var a = i.call(t, e);
    if (typeof a != "object") return a;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return String(t);
}
function tt(t) {
  var e = Dt(t, "string");
  return typeof e == "symbol" ? e : String(e);
}
var at = { exports: {} };
(function(t) {
  typeof window > "u" || function(e) {
    var i = e.HTMLCanvasElement && e.HTMLCanvasElement.prototype, a = e.Blob && function() {
      try {
        return !!new Blob();
      } catch {
        return !1;
      }
    }(), r = a && e.Uint8Array && function() {
      try {
        return new Blob([new Uint8Array(100)]).size === 100;
      } catch {
        return !1;
      }
    }(), o = e.BlobBuilder || e.WebKitBlobBuilder || e.MozBlobBuilder || e.MSBlobBuilder, g = /^data:((.*?)(;charset=.*?)?)(;base64)?,/, s = (a || o) && e.atob && e.ArrayBuffer && e.Uint8Array && function(f) {
      var c, v, d, C, h, m, E, k, S;
      if (c = f.match(g), !c)
        throw new Error("invalid data URI");
      for (v = c[2] ? c[1] : "text/plain" + (c[3] || ";charset=US-ASCII"), d = !!c[4], C = f.slice(c[0].length), d ? h = atob(C) : h = decodeURIComponent(C), m = new ArrayBuffer(h.length), E = new Uint8Array(m), k = 0; k < h.length; k += 1)
        E[k] = h.charCodeAt(k);
      return a ? new Blob([r ? E : m], {
        type: v
      }) : (S = new o(), S.append(m), S.getBlob(v));
    };
    e.HTMLCanvasElement && !i.toBlob && (i.mozGetAsFile ? i.toBlob = function(f, c, v) {
      var d = this;
      setTimeout(function() {
        v && i.toDataURL && s ? f(s(d.toDataURL(c, v))) : f(d.mozGetAsFile("blob", c));
      });
    } : i.toDataURL && s && (i.msToBlob ? i.toBlob = function(f, c, v) {
      var d = this;
      setTimeout(function() {
        (c && c !== "image/png" || v) && i.toDataURL && s ? f(s(d.toDataURL(c, v))) : f(d.msToBlob(c));
      });
    } : i.toBlob = function(f, c, v) {
      var d = this;
      setTimeout(function() {
        f(s(d.toDataURL(c, v)));
      });
    })), t.exports ? t.exports = s : e.dataURLtoBlob = s;
  }(window);
})(at);
var Ge = at.exports, Rt = function(e) {
  return typeof Blob > "u" ? !1 : e instanceof Blob || Object.prototype.toString.call(e) === "[object Blob]";
}, Xe = {
  /**
   * Indicates if output the original image instead of the compressed one
   * when the size of the compressed image is greater than the original one's
   * @type {boolean}
   */
  strict: !0,
  /**
   * Indicates if read the image's Exif Orientation information,
   * and then rotate or flip the image automatically.
   * @type {boolean}
   */
  checkOrientation: !0,
  /**
   * Indicates if retain the image's Exif information after compressed.
   * @type {boolean}
  */
  retainExif: !1,
  /**
   * The max width of the output image.
   * @type {number}
   */
  maxWidth: 1 / 0,
  /**
   * The max height of the output image.
   * @type {number}
   */
  maxHeight: 1 / 0,
  /**
   * The min width of the output image.
   * @type {number}
   */
  minWidth: 0,
  /**
   * The min height of the output image.
   * @type {number}
   */
  minHeight: 0,
  /**
   * The width of the output image.
   * If not specified, the natural width of the source image will be used.
   * @type {number}
   */
  width: void 0,
  /**
   * The height of the output image.
   * If not specified, the natural height of the source image will be used.
   * @type {number}
   */
  height: void 0,
  /**
   * Sets how the size of the image should be resized to the container
   * specified by the `width` and `height` options.
   * @type {string}
   */
  resize: "none",
  /**
   * The quality of the output image.
   * It must be a number between `0` and `1`,
   * and only available for `image/jpeg` and `image/webp` images.
   * Check out {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob canvas.toBlob}.
   * @type {number}
   */
  quality: 0.8,
  /**
   * The mime type of the output image.
   * By default, the original mime type of the source image file will be used.
   * @type {string}
   */
  mimeType: "auto",
  /**
   * Files whose file type is included in this list,
   * and whose file size exceeds the `convertSize` value will be converted to JPEGs.
   * @type {string｜Array}
   */
  convertTypes: ["image/png"],
  /**
   * PNG files over this size (5 MB by default) will be converted to JPEGs.
   * To disable this, just set the value to `Infinity`.
   * @type {number}
   */
  convertSize: 5e6,
  /**
   * The hook function to execute before draw the image into the canvas for compression.
   * @type {Function}
   * @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
   * @param {HTMLCanvasElement} canvas - The canvas for compression.
   * @example
   * function (context, canvas) {
   *   context.fillStyle = '#fff';
   * }
   */
  beforeDraw: null,
  /**
   * The hook function to execute after drew the image into the canvas for compression.
   * @type {Function}
   * @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
   * @param {HTMLCanvasElement} canvas - The canvas for compression.
   * @example
   * function (context, canvas) {
   *   context.filter = 'grayscale(100%)';
   * }
   */
  drew: null,
  /**
   * The hook function to execute when success to compress the image.
   * @type {Function}
   * @param {File} file - The compressed image File object.
   * @example
   * function (file) {
   *   console.log(file);
   * }
   */
  success: null,
  /**
   * The hook function to execute when fail to compress the image.
   * @type {Function}
   * @param {Error} err - An Error object.
   * @example
   * function (err) {
   *   console.log(err.message);
   * }
   */
  error: null
}, St = typeof window < "u" && typeof window.document < "u", q = St ? window : {}, ye = function(e) {
  return e > 0 && e < 1 / 0;
}, Ut = Array.prototype.slice;
function Se(t) {
  return Array.from ? Array.from(t) : Ut.call(t);
}
var Ot = /^image\/.+$/;
function ke(t) {
  return Ot.test(t);
}
function Qt(t) {
  var e = ke(t) ? t.substr(6) : "";
  return e === "jpeg" && (e = "jpg"), ".".concat(e);
}
var it = String.fromCharCode;
function Pt(t, e, i) {
  var a = "", r;
  for (i += e, r = e; r < i; r += 1)
    a += it(t.getUint8(r));
  return a;
}
var Tt = q.btoa;
function qe(t, e) {
  for (var i = [], a = 8192, r = new Uint8Array(t); r.length > 0; )
    i.push(it.apply(null, Se(r.subarray(0, a)))), r = r.subarray(a);
  return "data:".concat(e, ";base64,").concat(Tt(i.join("")));
}
function Mt(t) {
  var e = new DataView(t), i;
  try {
    var a, r, o;
    if (e.getUint8(0) === 255 && e.getUint8(1) === 216)
      for (var g = e.byteLength, s = 2; s + 1 < g; ) {
        if (e.getUint8(s) === 255 && e.getUint8(s + 1) === 225) {
          r = s;
          break;
        }
        s += 1;
      }
    if (r) {
      var f = r + 4, c = r + 10;
      if (Pt(e, f, 4) === "Exif") {
        var v = e.getUint16(c);
        if (a = v === 18761, (a || v === 19789) && e.getUint16(c + 2, a) === 42) {
          var d = e.getUint32(c + 4, a);
          d >= 8 && (o = c + d);
        }
      }
    }
    if (o) {
      var C = e.getUint16(o, a), h, m;
      for (m = 0; m < C; m += 1)
        if (h = o + m * 12 + 2, e.getUint16(h, a) === 274) {
          h += 8, i = e.getUint16(h, a), e.setUint16(h, 1, a);
          break;
        }
    }
  } catch {
    i = 1;
  }
  return i;
}
function Lt(t) {
  var e = 0, i = 1, a = 1;
  switch (t) {
    case 2:
      i = -1;
      break;
    case 3:
      e = -180;
      break;
    case 4:
      a = -1;
      break;
    case 5:
      e = 90, a = -1;
      break;
    case 6:
      e = 90;
      break;
    case 7:
      e = 90, i = -1;
      break;
    case 8:
      e = -90;
      break;
  }
  return {
    rotate: e,
    scaleX: i,
    scaleY: a
  };
}
var Ft = /\.\d*(?:0|9){12}\d*$/;
function Ze(t) {
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e11;
  return Ft.test(t) ? Math.round(t * e) / e : t;
}
function se(t) {
  var e = t.aspectRatio, i = t.height, a = t.width, r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "none", o = ye(a), g = ye(i);
  if (o && g) {
    var s = i * e;
    (r === "contain" || r === "none") && s > a || r === "cover" && s < a ? i = a / e : a = i * e;
  } else o ? i = a / e : g && (a = i * e);
  return {
    width: a,
    height: i
  };
}
function Nt(t) {
  for (var e = Se(new Uint8Array(t)), i = e.length, a = [], r = 0; r + 3 < i; ) {
    var o = e[r], g = e[r + 1];
    if (o === 255 && g === 218)
      break;
    if (o === 255 && g === 216)
      r += 2;
    else {
      var s = e[r + 2] * 256 + e[r + 3], f = r + s + 2, c = e.slice(r, f);
      a.push(c), r = f;
    }
  }
  return a.reduce(function(v, d) {
    return d[0] === 255 && d[1] === 225 ? v.concat(d) : v;
  }, []);
}
function Vt(t, e) {
  var i = Se(new Uint8Array(t));
  if (i[2] !== 255 || i[3] !== 224)
    return t;
  var a = i[4] * 256 + i[5], r = [255, 216].concat(e, i.slice(4 + a));
  return new Uint8Array(r);
}
var Jt = q.ArrayBuffer, Be = q.FileReader, te = q.URL || q.webkitURL, jt = /\.\w+$/, zt = q.Compressor, xt = /* @__PURE__ */ function() {
  function t(e, i) {
    Bt(this, t), this.file = e, this.exif = [], this.image = new Image(), this.options = he(he({}, Xe), i), this.aborted = !1, this.result = null, this.init();
  }
  return It(t, [{
    key: "init",
    value: function() {
      var i = this, a = this.file, r = this.options;
      if (!Rt(a)) {
        this.fail(new Error("The first argument must be a File or Blob object."));
        return;
      }
      var o = a.type;
      if (!ke(o)) {
        this.fail(new Error("The first argument must be an image File or Blob object."));
        return;
      }
      if (!te || !Be) {
        this.fail(new Error("The current browser does not support image compression."));
        return;
      }
      Jt || (r.checkOrientation = !1, r.retainExif = !1);
      var g = o === "image/jpeg", s = g && r.checkOrientation, f = g && r.retainExif;
      if (te && !s && !f)
        this.load({
          url: te.createObjectURL(a)
        });
      else {
        var c = new Be();
        this.reader = c, c.onload = function(v) {
          var d = v.target, C = d.result, h = {}, m = 1;
          s && (m = Mt(C), m > 1 && Ae(h, Lt(m))), f && (i.exif = Nt(C)), s || f ? !te || m > 1 ? h.url = qe(C, o) : h.url = te.createObjectURL(a) : h.url = C, i.load(h);
        }, c.onabort = function() {
          i.fail(new Error("Aborted to read the image with FileReader."));
        }, c.onerror = function() {
          i.fail(new Error("Failed to read the image with FileReader."));
        }, c.onloadend = function() {
          i.reader = null;
        }, s || f ? c.readAsArrayBuffer(a) : c.readAsDataURL(a);
      }
    }
  }, {
    key: "load",
    value: function(i) {
      var a = this, r = this.file, o = this.image;
      o.onload = function() {
        a.draw(he(he({}, i), {}, {
          naturalWidth: o.naturalWidth,
          naturalHeight: o.naturalHeight
        }));
      }, o.onabort = function() {
        a.fail(new Error("Aborted to load the image."));
      }, o.onerror = function() {
        a.fail(new Error("Failed to load the image."));
      }, q.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(q.navigator.userAgent) && (o.crossOrigin = "anonymous"), o.alt = r.name, o.src = i.url;
    }
  }, {
    key: "draw",
    value: function(i) {
      var a = this, r = i.naturalWidth, o = i.naturalHeight, g = i.rotate, s = g === void 0 ? 0 : g, f = i.scaleX, c = f === void 0 ? 1 : f, v = i.scaleY, d = v === void 0 ? 1 : v, C = this.file, h = this.image, m = this.options, E = document.createElement("canvas"), k = E.getContext("2d"), S = Math.abs(s) % 180 === 90, K = (m.resize === "contain" || m.resize === "cover") && ye(m.width) && ye(m.height), T = Math.max(m.maxWidth, 0) || 1 / 0, M = Math.max(m.maxHeight, 0) || 1 / 0, L = Math.max(m.minWidth, 0) || 0, H = Math.max(m.minHeight, 0) || 0, z = r / o, b = m.width, B = m.height;
      if (S) {
        var Z = [M, T];
        T = Z[0], M = Z[1];
        var $ = [H, L];
        L = $[0], H = $[1];
        var u = [B, b];
        b = u[0], B = u[1];
      }
      K && (z = b / B);
      var w = se({
        aspectRatio: z,
        width: T,
        height: M
      }, "contain");
      T = w.width, M = w.height;
      var I = se({
        aspectRatio: z,
        width: L,
        height: H
      }, "cover");
      if (L = I.width, H = I.height, K) {
        var A = se({
          aspectRatio: z,
          width: b,
          height: B
        }, m.resize);
        b = A.width, B = A.height;
      } else {
        var _ = se({
          aspectRatio: z,
          width: b,
          height: B
        }), W = _.width;
        b = W === void 0 ? r : W;
        var l = _.height;
        B = l === void 0 ? o : l;
      }
      b = Math.floor(Ze(Math.min(Math.max(b, L), T))), B = Math.floor(Ze(Math.min(Math.max(B, H), M)));
      var D = -b / 2, F = -B / 2, ee = b, N = B, R = [];
      if (K) {
        var Q = 0, P = 0, G = r, Y = o, le = se({
          aspectRatio: z,
          width: r,
          height: o
        }, {
          contain: "cover",
          cover: "contain"
        }[m.resize]);
        G = le.width, Y = le.height, Q = (r - G) / 2, P = (o - Y) / 2, R.push(Q, P, G, Y);
      }
      if (R.push(D, F, ee, N), S) {
        var ue = [B, b];
        b = ue[0], B = ue[1];
      }
      E.width = b, E.height = B, ke(m.mimeType) || (m.mimeType = C.type);
      var V = "transparent";
      C.size > m.convertSize && m.convertTypes.indexOf(m.mimeType) >= 0 && (m.mimeType = "image/jpeg");
      var ce = m.mimeType === "image/jpeg";
      if (ce && (V = "#fff"), k.fillStyle = V, k.fillRect(0, 0, b, B), m.beforeDraw && m.beforeDraw.call(this, k, E), !this.aborted && (k.save(), k.translate(b / 2, B / 2), k.rotate(s * Math.PI / 180), k.scale(c, d), k.drawImage.apply(k, [h].concat(R)), k.restore(), m.drew && m.drew.call(this, k, E), !this.aborted)) {
        var me = function(re) {
          if (!a.aborted) {
            var Ue = function(oe) {
              return a.done({
                naturalWidth: r,
                naturalHeight: o,
                result: oe
              });
            };
            if (re && ce && m.retainExif && a.exif && a.exif.length > 0) {
              var Oe = function(oe) {
                return Ue(Ge(qe(Vt(oe, a.exif), m.mimeType)));
              };
              if (re.arrayBuffer)
                re.arrayBuffer().then(Oe).catch(function() {
                  a.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."));
                });
              else {
                var ae = new Be();
                a.reader = ae, ae.onload = function(Ce) {
                  var oe = Ce.target;
                  Oe(oe.result);
                }, ae.onabort = function() {
                  a.fail(new Error("Aborted to read the compressed image with FileReader."));
                }, ae.onerror = function() {
                  a.fail(new Error("Failed to read the compressed image with FileReader."));
                }, ae.onloadend = function() {
                  a.reader = null;
                }, ae.readAsArrayBuffer(re);
              }
            } else
              Ue(re);
          }
        };
        E.toBlob ? E.toBlob(me, m.mimeType, m.quality) : me(Ge(E.toDataURL(m.mimeType, m.quality)));
      }
    }
  }, {
    key: "done",
    value: function(i) {
      var a = i.naturalWidth, r = i.naturalHeight, o = i.result, g = this.file, s = this.image, f = this.options;
      if (te && s.src.indexOf("blob:") === 0 && te.revokeObjectURL(s.src), o)
        if (f.strict && !f.retainExif && o.size > g.size && f.mimeType === g.type && !(f.width > a || f.height > r || f.minWidth > a || f.minHeight > r || f.maxWidth < a || f.maxHeight < r))
          o = g;
        else {
          var c = /* @__PURE__ */ new Date();
          o.lastModified = c.getTime(), o.lastModifiedDate = c, o.name = g.name, o.name && o.type !== g.type && (o.name = o.name.replace(jt, Qt(o.type)));
        }
      else
        o = g;
      this.result = o, f.success && f.success.call(this, o);
    }
  }, {
    key: "fail",
    value: function(i) {
      var a = this.options;
      if (a.error)
        a.error.call(this, i);
      else
        throw i;
    }
  }, {
    key: "abort",
    value: function() {
      this.aborted || (this.aborted = !0, this.reader ? this.reader.abort() : this.image.complete ? this.fail(new Error("The compression process has been aborted.")) : (this.image.onload = null, this.image.onabort()));
    }
    /**
     * Get the no conflict compressor class.
     * @returns {Compressor} The compressor class.
     */
  }], [{
    key: "noConflict",
    value: function() {
      return window.Compressor = zt, t;
    }
    /**
     * Change the default options.
     * @param {Object} options - The new default options.
     */
  }, {
    key: "setDefaults",
    value: function(i) {
      Ae(Xe, i);
    }
  }]), t;
}();
const Kt = (t, e) => new Promise((i, a) => {
  if (t.size <= e)
    return t;
  const r = e / t.size, o = Math.max(0.5, Math.min(0.9, 0.8 * r)), g = Math.max(800, Math.min(1920, 1920 * Math.sqrt(r)));
  $e(t, o, g, g, (s) => {
    s.size <= e ? i(s) : $e(
      s,
      Math.max(0.4, o - 0.2),
      // 降低质量
      Math.max(640, g * 0.8),
      // 缩小尺寸
      Math.max(640, g * 0.8),
      i,
      a,
      t
      // 传递原始文件用于错误处理
    );
  }, a, t);
}), $e = (t, e, i, a, r, o, g) => {
  new xt(t, {
    quality: e,
    maxWidth: i,
    maxHeight: a,
    convertSize: 1 / 0,
    success(s) {
      try {
        const f = new File([s], t.name, {
          type: s.type || t.type,
          lastModified: Date.now()
        });
        r(f);
      } catch (f) {
        o({
          message: "文件转换失败",
          error: f,
          original: g || t
        });
      }
    },
    error(s) {
      o({
        message: "图片压缩失败",
        error: s,
        original: g || t
      });
    }
  });
}, Ht = (t, e) => {
  const i = De(), a = be(t, "modelValue"), r = be(t, "status"), { upload: o } = At(t), { size2B: g } = yt(), { handlerImageSrc: s } = Ct(t), f = be(t, "isOverMaxLimitCompressImg"), c = Ee(""), v = Ee([]), d = [".mp4", ".avi", ".mkv", ".mov", ".wmv", ".flv", ".mpeg", ".webm"], C = [".mp3", ".wav", ".aac", ".flac", ".ogg", ".alff", ".wma", ".m4a"], h = x(() => t.baseUrl ? t.baseUrl : process.env.NODE_ENV === "production" ? "" : i.baseURL || ""), m = (l) => {
    if (l) {
      const D = l.substring(l.lastIndexOf(".")).toLowerCase();
      if (d.includes(D)) return "isVideo";
      if (C.includes(D)) return "isAudio";
    }
    return "isImg";
  }, E = x(() => {
    var D;
    let l = t.accept ? (D = t.accept) == null ? void 0 : D.split(",") : [];
    return l.includes("image/jpg") && !l.includes("image/jpeg") && l.push("image/jpeg"), l.includes(".jpg") && !l.includes(".jpeg") && l.push(".jpeg"), t.acceptVideo && (l = [...l, ...d]), t.acceptAudio && (l = [...l, ...C]), l.join(",");
  }), k = x(() => r.value === "uploading"), S = Ee(0), K = (l) => k.value ? S.value === l : !1, T = x(() => a.value ? [s(h.value, a.value)] : []), M = x(() => a.value ? a.value.map((l) => [s(h.value, l)]) : []), L = x(() => t.status !== "info" && (t.needDeleteBtn || t.needChangeBtn) || t.needDownloadBtn), H = x(() => t.status !== "info" && t.needDeleteBtn || t.needDownloadBtn), z = x(() => {
    const l = [], D = t.previewBtnConfig;
    if (typeof D == "boolean")
      return D ? ["zoom_in", "zoom_out", "turn_left", "turn_right", "full_screen"] : [];
    for (const F in D)
      D[F] && l.push(F);
    return l;
  }), b = () => {
    setTimeout(() => {
      const l = document.querySelector(".el-image-viewer__wrapper");
      l == null || l.classList.add("das-image-viewer-preview-btn-groups"), l == null || l.classList.add(...z.value);
    }, 0);
  }, B = (l) => {
    e("clickChangeIcon", l);
  }, Z = (l, D) => {
    t.limitNum === 1 ? (a.value = "", e("update:modelValue", ""), e("deleteImage", l)) : (a.value.splice(D, 1), e("update:modelValue", a.value), e("deleteImage", l));
  }, $ = (l, D = 0) => {
    var ee;
    e("downloadImage", l);
    let F = "";
    t.limitNum === 1 ? F = t.imageName || c.value : F = ((ee = t.imageName) == null ? void 0 : ee[D]) || v.value[D], m(l) === "isImg" ? gt(s(h.value, l), F) : vt(s(h.value, l), F);
  }, u = [
    "image/jpeg",
    "image/png",
    "image/webp",
    "image/gif",
    "image/bmp",
    "image/tiff",
    "image/svg+xml"
  ], w = async (l, D) => {
    var ee;
    if (t.maxSize) {
      const { finalSize: N, sizeText: R } = g(t.maxSize);
      if (l.size > N && !f.value) {
        const Q = Ke.value === "zh-CN" ? "、" : ", ", P = He(
          "das-ui-import-upload-key3",
          R,
          ((ee = E.value) == null ? void 0 : ee.toUpperCase().replaceAll(".", "").replaceAll(",", Q)) ?? ""
        ).value, G = t.errorMessage || P;
        return xe.warning(G), !1;
      }
    }
    const F = async (N) => {
      let R = l;
      if (t.maxSize) {
        const { finalSize: P, sizeText: G } = g(t.maxSize);
        if (l.size > P && f.value && u.includes(l.type))
          try {
            R = await Kt(l, P);
          } catch (Y) {
            R = (Y == null ? void 0 : Y.original) || l;
          }
      }
      S.value = N, e("update:status", "uploading"), e("image-upload", R);
      const Q = await o(R);
      return Q === "error" ? (e("update:status", "error"), !1) : (e("upload-success", R, Q), t.limitNum === 1 ? a.value = Q : a.value[N] = Q, e("update:modelValue", a.value), e("update:status", "normal"), !1);
    };
    if (t.customCheck) {
      const N = t.customCheck(l);
      if (N instanceof Promise)
        return new Promise(async (R, Q) => {
          let P;
          try {
            P = await N.then();
          } catch {
            P = !1;
          }
          P ? F(D) : Q(!1);
        });
      if (!N) return !1;
    } else if (E.value) {
      const N = E.value.split(",").filter((V) => V.trim().startsWith(".")).map((V) => V.trim()), R = E.value.split(",").filter((V) => !V.trim().startsWith(".")).map((V) => V.trim()), Q = mt(l.name), P = N.includes(Q);
      let G = R.includes("image/*") && l.type.split("/")[0].trim() === "image", Y = R.includes("video/*") && l.type.split("/")[0].trim() === "video", le = R.includes("audio/*") && l.type.split("/")[0].trim() === "audio", ue = R.includes(l.type) || G || Y || le;
      if (!P && !ue) {
        const V = t.acceptAudio || t.acceptVideo ? "das-ui-import-upload-key2" : "das-ui-import-upload-key1", ce = Ke.value === "zh-CN" ? "、" : ", ", me = t.errorMessage || He(V, E.value.toUpperCase().replaceAll(".", "").replaceAll(",", ce)).value;
        return xe.warning(me), !1;
      }
    }
    return F(D);
  }, I = async (l) => {
    t.limitNum !== 1 && (S.value = a.length), e("update:status", "uploading"), e("image-upload", l);
    const D = await o(l);
    e("upload-success", l, D), t.limitNum === 1 ? A(D) : _(D);
  }, A = (l) => {
    if (l === "error") {
      e("update:status", "error");
      return;
    }
    a.value = l, e("update:modelValue", a.value), e("update:status", "normal");
  }, _ = (l) => {
    if (l === "error") {
      e("update:status", "error");
      return;
    }
    a.value.push(l), e("update:modelValue", a.value), e("update:status", "normal");
  };
  return st(a, async () => {
    const l = t.limitNum ?? 1;
    l === 1 && a.value ? c.value = await Et(a.value) : l > 1 && a.value.length > 0 && (v.value = await bt(a.value));
  }, {
    deep: !0,
    immediate: !0
  }), {
    url: a,
    singlePreviewList: T,
    multiPreviewList: M,
    isAccept: E,
    loading: k,
    uploadStatus: r,
    previewBtns: z,
    operateShow: L,
    operateShow_Multi: H,
    singlePreviewName: c,
    multiPreviewName: v,
    getFileType: m,
    changeImg: B,
    delImg: Z,
    beforeupload: w,
    uploadImg: I,
    onDownload: $,
    handleImageClick: b,
    isLoadingMulti: K
  };
}, Wt = (t, e) => {
  var o;
  const { __IN_DAS_MICRO_APP: i, __DAS_MAIN_APP_HREF: a } = window;
  if (!i || !a) return;
  const { origin: r } = new URL(a);
  (o = window.top) == null || o.postMessage({ type: t, data: e }, r);
}, nt = "proxy-image-viewer", we = {
  sendMessageToMainApp: Wt,
  // @ts-ignore
  isMicroApp: () => window.__IN_DAS_MICRO_APP && window.top !== window.self,
  addEventFromMicroApp: () => {
    window.addEventListener("message", (t) => {
      const { type: e, data: i } = t.data;
      if (e !== nt) return;
      const a = document.createElement("div");
      a.classList.add("das-image-viewer-preview-btn-groups");
      const { previewList: r, previewBtns: o } = i, g = lt(ct, {
        urlList: r,
        onClose: () => {
          g.unmount(), document.body.removeChild(a);
        }
      });
      document.body.appendChild(a), g.mount(a), setTimeout(() => {
        const s = document.querySelector(".el-image-viewer__wrapper");
        s == null || s.classList.add("das-image-viewer-preview-btn-groups"), s == null || s.classList.add(...o);
      }, 0);
    });
  }
};
we.addEventFromMicroApp();
const Yt = (t) => {
  const { handleImageClickProxy: e, previewBtns: i } = t;
  return { needPreviewImage: x(() => !t.needPreview || we.isMicroApp() ? !1 : t.needPreview), handleImageClick: (o) => {
    if (!t.needPreview) return;
    if (!we.isMicroApp()) {
      e();
      return;
    }
    let g = [];
    Array.isArray(o) && g.push(...o), typeof o == "string" && g.push(o), we.sendMessageToMainApp(nt, {
      previewList: g,
      previewBtns: i.value
    });
  } };
}, Gt = {
  key: 0,
  class: "das-ui-image-viewer-container"
}, Xt = {
  class: "no-data-img",
  src: Ie,
  alt: ""
}, qt = { class: "image-name" }, Zt = { class: "das-ui-image-viewer-groups" }, $t = { class: "image-name" }, _t = { class: "das-ui-image-viewer-container" }, ea = {
  key: 1,
  class: "das-ui-image-viewer-container"
}, ta = { class: "das-ui-image-viewer" }, aa = {
  key: 2,
  class: "das-ui-image-viewer"
}, ia = /* @__PURE__ */ ut({
  __name: "Index",
  props: {
    style: { default: "" },
    modelValue: {},
    status: { default: "normal" },
    imageName: {},
    accept: { default: ".png, .jpg, .jpeg, .gif, .svg" },
    acceptVideo: { type: Boolean },
    acceptAudio: { type: Boolean },
    showImageName: { type: Boolean },
    baseUrl: {},
    serviceName: {},
    pathPrefix: {},
    bucketName: {},
    minioTokenApi: { default: "token" },
    maxSize: {},
    limitNum: { default: 1 },
    errorMessage: {},
    customCheck: {},
    needPreview: { type: Boolean, default: !0 },
    needDownloadBtn: { type: Boolean, default: !0 },
    needDeleteBtn: { type: Boolean, default: !0 },
    needChangeBtn: { type: Boolean, default: !0 },
    mode: { default: "upload" },
    previewBtnConfig: { type: [Boolean, Object], default: !0 },
    imageFit: { default: "cover" },
    autoContentType: { type: Boolean },
    message: {},
    videoWidth: {},
    videoHeight: {},
    randomName: { type: Boolean, default: !1 },
    useOriginUrl: { type: Boolean, default: !1 },
    openFileDialogOnClick: { type: Boolean, default: !0 },
    isOverMaxLimitCompressImg: { type: Boolean, default: !1 }
  },
  emits: ["update:modelValue", "update:status", "downloadImage", "image-upload", "upload-success", "clickChangeIcon", "deleteImage"],
  setup(t, { emit: e }) {
    const i = t, a = e, r = x(() => {
      const w = [
        i.needDownloadBtn,
        i.limitNum === 1 && d.value !== "info" && i.needChangeBtn,
        d.value !== "info" && i.needDeleteBtn
      ].filter((A) => A).length;
      let I = "center";
      return w === 2 && (I = "space-around"), w === 3 && (I = "space-between"), {
        "justify-content": I
      };
    }), o = x(() => i.mode === "view" ? !1 : s.value ? d.value === "error" : d.value !== "info"), g = (u) => {
      u.stopPropagation();
    }, {
      url: s,
      isAccept: f,
      singlePreviewList: c,
      multiPreviewList: v,
      uploadStatus: d,
      loading: C,
      previewBtns: h,
      operateShow: m,
      operateShow_Multi: E,
      singlePreviewName: k,
      multiPreviewName: S,
      changeImg: K,
      delImg: T,
      beforeupload: M,
      uploadImg: L,
      onDownload: H,
      handleImageClick: z,
      getFileType: b,
      isLoadingMulti: B
    } = Ht(i, a), { needPreviewImage: Z, handleImageClick: $ } = Yt({
      needPreview: i.needPreview,
      handleImageClickProxy: z,
      previewBtns: h
    });
    return (u, w) => (y(), U(
      de,
      null,
      [
        p(" 单文件 "),
        u.limitNum === 1 ? (y(), U("div", Gt, [
          X(
            "div",
            {
              class: "das-ui-image-viewer",
              style: fe(u.style)
            },
            [
              p(" 状态不为 error 时显示 "),
              J(ie(n(Je), {
                class: ge([{ "loading-border": n(C) }]),
                type: "component",
                spinning: n(C)
              }, {
                default: ne(() => [
                  p(" 图片 "),
                  n(b)(n(c)[0]) === "isImg" ? J((y(), O(n(Le), {
                    key: 0,
                    class: ge(["image-context", [n(h)]]),
                    "preview-teleported": !0,
                    src: n(c)[0],
                    "preview-src-list": n(Z) ? n(c) : void 0,
                    "initial-index": 0,
                    fit: u.imageFit,
                    onClick: w[0] || (w[0] = (I) => n($)(n(c)))
                  }, null, 8, ["class", "src", "preview-src-list", "fit"])), [
                    [j, !n(C)]
                  ]) : p("v-if", !0),
                  p(" 视频 "),
                  n(b)(n(c)[0]) === "isVideo" ? J((y(), O(n(ve), {
                    key: 1,
                    mode: n(d) === "info" || u.mode === "view" ? "view" : "normal",
                    src: n(c)[0],
                    needPreview: u.needPreview,
                    width: "100%",
                    height: "100%",
                    "player-props": { videoWidth: u.videoWidth, videoHeight: u.videoHeight },
                    fullPath: ""
                  }, null, 8, ["mode", "src", "needPreview", "player-props"])), [
                    [j, !n(C)]
                  ]) : p("v-if", !0),
                  p(" 音频 "),
                  n(b)(n(c)[0]) === "isAudio" ? J((y(), O(n(ve), {
                    key: 2,
                    mode: n(d) === "info" || u.mode === "view" ? "view" : "normal",
                    src: n(c)[0],
                    needPreview: u.needPreview,
                    width: "100%",
                    height: "100%",
                    type: "audio",
                    fullPath: ""
                  }, null, 8, ["mode", "src", "needPreview"])), [
                    [j, !n(C)]
                  ]) : p("v-if", !0),
                  !n(C) && n(m) ? (y(), U(
                    "div",
                    {
                      key: 3,
                      class: "operate-container",
                      style: fe(r.value),
                      onClick: g
                    },
                    [
                      u.needDownloadBtn ? (y(), O(n(je), {
                        key: 0,
                        class: "operate-btn",
                        size: "medium",
                        "icon-color": "#fff",
                        onClick: w[1] || (w[1] = (I) => n(H)(n(s)))
                      })) : p("v-if", !0),
                      n(d) !== "info" && u.needChangeBtn ? (y(), U("div", {
                        key: 1,
                        class: "change-icon-box",
                        onClick: w[2] || (w[2] = (I) => n(K)(n(s)))
                      }, [
                        u.openFileDialogOnClick ? (y(), O(n(Fe), {
                          key: 0,
                          "before-upload": (I) => n(M)(I, 0),
                          accept: n(f),
                          openFileDialogOnClick: u.openFileDialogOnClick
                        }, {
                          itemRender: ne(({ file: I, actions: A }) => w[7] || (w[7] = [])),
                          default: ne(() => [
                            ie(n(pe), {
                              class: "operate-btn m-t-6",
                              "icon-color": "#fff",
                              size: "medium"
                            })
                          ]),
                          _: 1
                          /* STABLE */
                        }, 8, ["before-upload", "accept", "openFileDialogOnClick"])) : p("v-if", !0),
                        u.openFileDialogOnClick ? p("v-if", !0) : (y(), O(n(pe), {
                          key: 1,
                          class: "operate-btn m-t-6",
                          "icon-color": "#fff",
                          size: "medium"
                        }))
                      ])) : p("v-if", !0),
                      n(d) !== "info" && u.needDeleteBtn ? (y(), O(n(ze), {
                        key: 2,
                        class: "operate-btn",
                        "icon-color": "#fff",
                        size: "medium",
                        onClick: w[3] || (w[3] = (I) => n(T)(n(s)))
                      })) : p("v-if", !0)
                    ],
                    4
                    /* STYLE */
                  )) : p("v-if", !0)
                ]),
                _: 1
                /* STABLE */
              }, 8, ["class", "spinning"]), [
                [j, n(s) && u.status !== "error"]
              ]),
              p(" 上传模式，当 url 为空或者 uploading 和 error 时显示 "),
              J(ie(n(Ve), {
                status: n(d),
                "onUpdate:status": w[4] || (w[4] = (I) => Qe(d) ? d.value = I : null),
                "max-size": u.maxSize,
                accept: u.accept,
                acceptVideo: u.acceptVideo,
                message: u.message,
                acceptAudio: u.acceptAudio,
                autoContentType: u.autoContentType,
                "custom-check": u.customCheck,
                "error-message": u.errorMessage,
                openFileDialogOnClick: u.openFileDialogOnClick,
                onImageUpload: n(L),
                isOverMaxLimitCompressImg: u.isOverMaxLimitCompressImg
              }, null, 8, ["status", "max-size", "accept", "acceptVideo", "message", "acceptAudio", "autoContentType", "custom-check", "error-message", "openFileDialogOnClick", "onImageUpload", "isOverMaxLimitCompressImg"]), [
                [j, o.value]
              ]),
              p(" 查看模式 "),
              J(X(
                "img",
                Xt,
                null,
                512
                /* NEED_PATCH */
              ), [
                [j, !n(s) && (n(d) === "info" || u.mode === "view")]
              ])
            ],
            4
            /* STYLE */
          ),
          J((y(), U("div", qt, [
            Pe(
              Te(i.imageName || n(k)),
              1
              /* TEXT */
            )
          ])), [
            [j, n(s) && u.showImageName && (n(d) === "normal" || n(d) === "info")],
            [n(Ne)]
          ])
        ])) : (y(), U(
          de,
          { key: 1 },
          [
            p(" 多文件 "),
            X("div", Zt, [
              p(" 已上传的图片集合 "),
              (y(!0), U(
                de,
                null,
                Me(n(s), (I, A) => {
                  var _;
                  return y(), U("div", {
                    key: A,
                    class: "das-ui-image-viewer-container"
                  }, [
                    X(
                      "div",
                      {
                        class: "das-ui-image-viewer",
                        style: fe(u.style)
                      },
                      [
                        J(ie(n(Je), {
                          class: ge([{ "loading-border": n(B)(A) }]),
                          type: "component",
                          spinning: n(B)(A)
                        }, {
                          default: ne(() => [
                            n(b)(n(v)[A][0]) === "isImg" ? J((y(), O(n(Le), {
                              key: 0,
                              class: ge(["image-context", [n(h)]]),
                              src: n(v)[A][0],
                              "preview-teleported": !0,
                              "preview-src-list": n(Z) ? n(v)[A] : void 0,
                              "initial-index": A,
                              onClick: (W) => n($)(n(v)[A]),
                              fit: "cover"
                            }, null, 8, ["class", "src", "preview-src-list", "initial-index", "onClick"])), [
                              [j, !n(B)(A)]
                            ]) : p("v-if", !0),
                            p(" 视频 "),
                            n(b)(n(v)[A][0]) === "isVideo" ? J((y(), O(n(ve), {
                              key: 1,
                              mode: n(d) === "info" || u.mode === "view" ? "view" : "normal",
                              src: n(v)[A][0],
                              needPreview: u.needPreview,
                              width: "100%",
                              height: "100%",
                              fullPath: "",
                              "player-props": { videoWidth: u.videoWidth, videoHeight: u.videoHeight }
                            }, null, 8, ["mode", "src", "needPreview", "player-props"])), [
                              [j, !n(B)(A)]
                            ]) : p("v-if", !0),
                            p(" 音频 "),
                            n(b)(n(v)[A][0]) === "isAudio" ? J((y(), O(n(ve), {
                              key: 2,
                              mode: n(d) === "info" || u.mode === "view" ? "view" : "normal",
                              src: n(v)[A][0],
                              needPreview: u.needPreview,
                              width: "100%",
                              height: "100%",
                              type: "audio",
                              fullPath: ""
                            }, null, 8, ["mode", "src", "needPreview"])), [
                              [j, !n(B)(A)]
                            ]) : p("v-if", !0),
                            !n(C) && n(E) ? (y(), U(
                              "div",
                              {
                                key: 3,
                                class: "operate-container",
                                style: fe(r.value)
                              },
                              [
                                u.needDownloadBtn ? (y(), O(n(je), {
                                  key: 0,
                                  class: "operate-btn",
                                  size: "medium",
                                  "icon-color": "#fff",
                                  onClick: (W) => n(H)(I, A)
                                }, null, 8, ["onClick"])) : p("v-if", !0),
                                n(d) !== "info" && u.needChangeBtn ? (y(), U("div", {
                                  key: 1,
                                  class: "change-icon-box",
                                  onClick: w[5] || (w[5] = (W) => n(K)(n(s)))
                                }, [
                                  u.openFileDialogOnClick ? (y(), O(n(Fe), {
                                    key: 0,
                                    "before-upload": (W) => n(M)(W, A),
                                    accept: n(f),
                                    openFileDialogOnClick: u.openFileDialogOnClick
                                  }, {
                                    itemRender: ne(({ file: W, actions: l }) => w[8] || (w[8] = [])),
                                    default: ne(() => [
                                      ie(n(pe), {
                                        class: "operate-btn m-t-6",
                                        "icon-color": "#fff",
                                        size: "medium"
                                      })
                                    ]),
                                    _: 2
                                    /* DYNAMIC */
                                  }, 1032, ["before-upload", "accept", "openFileDialogOnClick"])) : p("v-if", !0),
                                  u.openFileDialogOnClick ? p("v-if", !0) : (y(), O(n(pe), {
                                    key: 1,
                                    class: "operate-btn m-t-6",
                                    "icon-color": "#fff",
                                    size: "medium"
                                  }))
                                ])) : p("v-if", !0),
                                n(d) !== "info" && u.needDeleteBtn ? (y(), O(n(ze), {
                                  key: 2,
                                  class: "operate-btn",
                                  "icon-color": "#fff",
                                  size: "medium",
                                  onClick: (W) => n(T)(I, A)
                                }, null, 8, ["onClick"])) : p("v-if", !0)
                              ],
                              4
                              /* STYLE */
                            )) : p("v-if", !0)
                          ]),
                          _: 2
                          /* DYNAMIC */
                        }, 1032, ["class", "spinning"]), [
                          [j, I]
                        ])
                      ],
                      4
                      /* STYLE */
                    ),
                    J((y(), U("div", $t, [
                      Pe(
                        Te(((_ = i.imageName) == null ? void 0 : _[A]) || n(S)[A]),
                        1
                        /* TEXT */
                      )
                    ])), [
                      [j, I && u.showImageName && !n(B)(A)],
                      [n(Ne)]
                    ])
                  ]);
                }),
                128
                /* KEYED_FRAGMENT */
              )),
              p(" 查看模式下，默认占位符 "),
              u.mode === "view" ? (y(!0), U(
                de,
                { key: 0 },
                Me(u.limitNum - n(s).length, (I) => (y(), U("div", _t, w[9] || (w[9] = [
                  X(
                    "div",
                    { class: "das-ui-image-viewer" },
                    [
                      X("img", {
                        class: "no-data-img",
                        src: Ie,
                        alt: ""
                      })
                    ],
                    -1
                    /* CACHED */
                  )
                ])))),
                256
                /* UNKEYED_FRAGMENT */
              )) : p("v-if", !0),
              p(" 图片数量未到达最大数量限制时，显示上传组件 "),
              u.mode === "upload" && n(d) !== "info" && n(s).length < u.limitNum ? (y(), U("div", ea, [
                X("div", ta, [
                  ie(n(Ve), {
                    status: n(d),
                    "onUpdate:status": w[6] || (w[6] = (I) => Qe(d) ? d.value = I : null),
                    "max-size": u.maxSize,
                    accept: u.accept,
                    acceptVideo: u.acceptVideo,
                    acceptAudio: u.acceptAudio,
                    message: u.message,
                    "custom-check": u.customCheck,
                    "error-message": u.errorMessage,
                    openFileDialogOnClick: u.openFileDialogOnClick,
                    onImageUpload: n(L),
                    isOverMaxLimitCompressImg: u.isOverMaxLimitCompressImg
                  }, null, 8, ["status", "max-size", "accept", "acceptVideo", "acceptAudio", "message", "custom-check", "error-message", "openFileDialogOnClick", "onImageUpload", "isOverMaxLimitCompressImg"])
                ])
              ])) : p("v-if", !0),
              p(" 当图片状态为查看态且无数据时，显示无数据图片 "),
              n(d) === "info" && n(s).length === 0 ? (y(), U("div", aa, w[10] || (w[10] = [
                X(
                  "img",
                  {
                    class: "no-data-img",
                    src: Ie,
                    alt: ""
                  },
                  null,
                  -1
                  /* CACHED */
                )
              ]))) : p("v-if", !0)
            ])
          ],
          2112
          /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
        ))
      ],
      2112
      /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
    ));
  }
}), na = (t, e) => {
  const i = t.__vccOpts || t;
  for (const [a, r] of e)
    i[a] = r;
  return i;
}, ra = /* @__PURE__ */ na(ia, [["__scopeId", "data-v-0cbe0660"]]), oa = {
  "--das-ui-image-viewer-bg-color": { light: "rgba(0, 0, 0, 0.5)" },
  "--das-ui-image-viewer-btn-hover": { light: "#87A9FF" },
  "--das-ui-image-viewer-btn-active": { light: "#276FF5" }
}, Pa = rt(ra);
ot(oa);
export {
  Pa as DasImageViewer,
  Pa as default,
  At as minioUpload,
  yt as useCalculateSize
};
