import { w as withInstall } from "../badge/index2.js"; import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, createCommentVNode, toDisplayString, normalizeClass, ref, watch, onMounted, nextTick, withModifiers, createElementVNode, Fragment, renderList, shallowRef, createTextVNode, createVNode, useSlots, inject, Transition, withCtx, createBlock, renderSlot, h, render, isVNode, getCurrentInstance, onUnmounted } from "vue"; import { I as ImageCompressor } from "../_chunks/js-image-compressor/index.js"; import { t as templateRef } from "../_chunks/@vueuse/index.js"; import { _ as _sfc_main$9 } from "../button/index2.js"; import { C as Cropper } from "../_chunks/cropperjs/index.js"; import { u as useI18n } from "../datePicker/index2.js"; var index$1 = /* @__PURE__ */ (() => '/*!\n * Cropper.js v1.5.12\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-06-12T08:00:11.623Z\n */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{image-orientation:0deg;display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:#3399ffbf;overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}:root{--button-primary-text-color: #fff;--button-primary-background-color: var(--global-primary-color);--button-primary-border-color: var(--global-primary-color);--button-normal-text-color: #fff;--button-normal-background-color: var(--global-normal-color);--button-normal-border-color: var(--global-normal-color);--button-warm-text-color: #fff;--button-warm-background-color: var(--global-warm-color);--button-warm-border-color: var(--global-warm-color);--button-danger-text-color: #fff;--button-danger-background-color: var(--global-danger-color);--button-danger-border-color: var(--global-danger-color);--button-border-radius: var(--global-border-radius);--button-border-color: var(--global-neutral-color-6);--button-background-color: 0 0;--button-text-color: #666}.layui-btn{height:38px;line-height:36px;padding:0 18px;font-size:14px;text-align:center;white-space:nowrap;color:var(--button-text-color);background:var(--button-background-color);border-radius:var(--button-border-radius);border-color:var(--button-border-color);border-width:1px;border-style:solid;cursor:pointer}.layui-btn-primary{color:var(--button-primary-text-color);background-color:var(--button-primary-background-color);border-color:var(--button-primary-border-color)}.layui-btn-normal{color:var(--button-normal-text-color);background-color:var(--button-normal-background-color);border-color:var(--button-normal-border-color)}.layui-btn-warm{color:var(--button-warm-text-color);background-color:var(--button-warm-background-color);border-color:var(--button-warm-border-color)}.layui-btn-danger{color:var(--button-danger-text-color);background-color:var(--button-danger-background-color);border-color:var(--button-danger-border-color)}.layui-btn:hover{opacity:.8;filter:alpha(opacity=80)}.layui-btn:active{opacity:1;filter:alpha(opacity=100)}.layui-btn-lg{height:44px;line-height:44px;padding:0 25px;font-size:16px}.layui-btn-sm{height:30px;line-height:30px;padding:0 10px;font-size:12px}.layui-btn-xs{height:22px;line-height:22px;padding:0 5px;font-size:12px}.layui-btn-xs i{font-size:12px!important}.layui-btn-fluid{width:100%}.layui-btn-radius{border-radius:100px}.layui-btn-disabled,.layui-btn-disabled:active,.layui-btn-disabled:hover{border-color:#eee!important;background-color:#fbfbfb!important;color:#d2d2d2!important;cursor:not-allowed!important;opacity:1}.layui-btn+.layui-btn{margin-left:10px}.layui-btn .layui-icon{padding:0 2px;vertical-align:middle\\ ;vertical-align:bottom}.layui-upload-file{opacity:.01;position:relative;filter:alpha(opacity=1);cursor:pointer}.layui-upload-btn-box{position:relative;overflow:hidden}.layui-upload-drag,.layui-upload-form,.layui-upload-wrap{display:inline-block}.layui-upload-list{margin:10px 0}.layui-upload-choose{max-width:200px;padding:0 10px;color:#999;font-size:14px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-upload-drag{position:relative;padding:30px;border:1px dashed var(--global-neutral-color-4);background-color:#fff;text-align:center;cursor:pointer;color:#999}.layui-upload-drag .layui-icon{font-size:50px;color:var(--global-primary-color)}.layui-upload-drag[lay-over],.layui-upload-drag-draging{border-color:var(--global-primary-color)}.layui-upload-iframe{position:absolute;width:0;height:0;border:0;visibility:hidden}.layui-upload-wrap{position:relative;vertical-align:middle;cursor:pointer}.layui-upload-wrap .layui-upload-file{display:block!important;position:absolute;left:0;top:0;z-index:10;font-size:100px;width:1px;height:1px;opacity:.01;filter:alpha(opacity=1)}.layui-upload-file-disabled{cursor:not-allowed!important}.layui-btn-container .layui-upload-choose{padding-left:0}.layui-upload-drag-disable{opacity:.8;z-index:1;cursor:not-allowed}._lay_upload_img{display:block;max-width:100%}.layui-upload-list-disabled{width:auto;height:auto;pointer-events:none!important;background-color:#fbfbfb!important;filter:opacity(.9)}\n')(); function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { return typeof o2; } : function(o2) { return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; }, _typeof$1(o); } function toPrimitive(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function toPropertyKey(t) { var i = toPrimitive(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; } function _defineProperty(e, r, t) { return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; } function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n2) { return void e(n2); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function() { var t = this, e = arguments; return new Promise(function(r, o) { var a = n.apply(t, e); function _next(n2) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n2); } function _throw(n2) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2); } _next(void 0); }); }; } var regeneratorRuntime$1 = { exports: {} }; var _typeof = { exports: {} }; (function(module) { function _typeof2(o) { "@babel/helpers - typeof"; return module.exports = _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { return typeof o2; } : function(o2) { return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof2(o); } module.exports = _typeof2, module.exports.__esModule = true, module.exports["default"] = module.exports; })(_typeof); (function(module) { var _typeof$12 = _typeof.exports["default"]; function _regeneratorRuntime() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ module.exports = _regeneratorRuntime = function _regeneratorRuntime2() { return e; }, module.exports.__esModule = true, module.exports["default"] = module.exports; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) { t2[e2] = r2.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t2, e2, r2) { return Object.defineProperty(t2, e2, { value: r2, enumerable: true, configurable: true, writable: true }), t2[e2]; } try { define({}, ""); } catch (t2) { define = function define2(t3, e2, r2) { return t3[e2] = r2; }; } function wrap(t2, e2, r2, n2) { var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []); return o(a2, "_invoke", { value: makeInvokeMethod(t2, r2, c2) }), a2; } function tryCatch(t2, e2, r2) { try { return { type: "normal", arg: t2.call(e2, r2) }; } catch (t3) { return { type: "throw", arg: t3 }; } } e.wrap = wrap; var h2 = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() { } function GeneratorFunction() { } function GeneratorFunctionPrototype() { } var p = {}; define(p, a, function() { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t2) { ["next", "throw", "return"].forEach(function(e2) { define(t2, e2, function(t3) { return this._invoke(e2, t3); }); }); } function AsyncIterator(t2, e2) { function invoke(r3, o2, i2, a2) { var c2 = tryCatch(t2[r3], t2, o2); if ("throw" !== c2.type) { var u2 = c2.arg, h3 = u2.value; return h3 && "object" == _typeof$12(h3) && n.call(h3, "__await") ? e2.resolve(h3.__await).then(function(t3) { invoke("next", t3, i2, a2); }, function(t3) { invoke("throw", t3, i2, a2); }) : e2.resolve(h3).then(function(t3) { u2.value = t3, i2(u2); }, function(t3) { return invoke("throw", t3, i2, a2); }); } a2(c2.arg); } var r2; o(this, "_invoke", { value: function value(t3, n2) { function callInvokeWithMethodAndArg() { return new e2(function(e3, r3) { invoke(t3, n2, e3, r3); }); } return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e2, r2, n2) { var o2 = h2; return function(i2, a2) { if (o2 === f) throw Error("Generator is already running"); if (o2 === s) { if ("throw" === i2) throw a2; return { value: t, done: true }; } for (n2.method = i2, n2.arg = a2; ; ) { var c2 = n2.delegate; if (c2) { var u2 = maybeInvokeDelegate(c2, n2); if (u2) { if (u2 === y) continue; return u2; } } if ("next" === n2.method) n2.sent = n2._sent = n2.arg; else if ("throw" === n2.method) { if (o2 === h2) throw o2 = s, n2.arg; n2.dispatchException(n2.arg); } else "return" === n2.method && n2.abrupt("return", n2.arg); o2 = f; var p2 = tryCatch(e2, r2, n2); if ("normal" === p2.type) { if (o2 = n2.done ? s : l, p2.arg === y) continue; return { value: p2.arg, done: n2.done }; } "throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg); } }; } function maybeInvokeDelegate(e2, r2) { var n2 = r2.method, o2 = e2.iterator[n2]; if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator["return"] && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y; var i2 = tryCatch(o2, e2.iterator, r2.arg); if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y; var a2 = i2.arg; return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y); } function pushTryEntry(t2) { var e2 = { tryLoc: t2[0] }; 1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2); } function resetTryEntry(t2) { var e2 = t2.completion || {}; e2.type = "normal", delete e2.arg, t2.completion = e2; } function Context(t2) { this.tryEntries = [{ tryLoc: "root" }], t2.forEach(pushTryEntry, this), this.reset(true); } function values(e2) { if (e2 || "" === e2) { var r2 = e2[a]; if (r2) return r2.call(e2); if ("function" == typeof e2.next) return e2; if (!isNaN(e2.length)) { var o2 = -1, i2 = function next() { for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next; return next.value = t, next.done = true, next; }; return i2.next = i2; } } throw new TypeError(_typeof$12(e2) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: true }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) { var e2 = "function" == typeof t2 && t2.constructor; return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name)); }, e.mark = function(t2) { return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2; }, e.awrap = function(t2) { return { __await: t2 }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function() { return this; }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) { void 0 === i2 && (i2 = Promise); var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2); return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) { return t3.done ? t3.value : a2.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function() { return this; }), define(g, "toString", function() { return "[object Generator]"; }), e.keys = function(t2) { var e2 = Object(t2), r2 = []; for (var n2 in e2) r2.push(n2); return r2.reverse(), function next() { for (; r2.length; ) { var t3 = r2.pop(); if (t3 in e2) return next.value = t3, next.done = false, next; } return next.done = true, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset2(e2) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t); }, stop: function stop() { this.done = true; var t2 = this.tryEntries[0].completion; if ("throw" === t2.type) throw t2.arg; return this.rval; }, dispatchException: function dispatchException(e2) { if (this.done) throw e2; var r2 = this; function handle(n2, o3) { return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3; } for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) { var i2 = this.tryEntries[o2], a2 = i2.completion; if ("root" === i2.tryLoc) return handle("end"); if (i2.tryLoc <= this.prev) { var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc"); if (c2 && u2) { if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); } else if (c2) { if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); } else { if (!u2) throw Error("try statement without catch or finally"); if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); } } } }, abrupt: function abrupt(t2, e2) { for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) { var o2 = this.tryEntries[r2]; if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) { var i2 = o2; break; } } i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null); var a2 = i2 ? i2.completion : {}; return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2); }, complete: function complete(t2, e2) { if ("throw" === t2.type) throw t2.arg; return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y; }, finish: function finish(t2) { for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { var r2 = this.tryEntries[e2]; if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y; } }, "catch": function _catch(t2) { for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { var r2 = this.tryEntries[e2]; if (r2.tryLoc === t2) { var n2 = r2.completion; if ("throw" === n2.type) { var o2 = n2.arg; resetTryEntry(r2); } return o2; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e2, r2, n2) { return this.delegate = { iterator: values(e2), resultName: r2, nextLoc: n2 }, "next" === this.method && (this.arg = t), y; } }, e; } module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; })(regeneratorRuntime$1); var runtime = regeneratorRuntime$1.exports(); var regenerator = runtime; try { regeneratorRuntime = runtime; } catch (accidentalStrictMode) { if ((typeof globalThis === "undefined" ? "undefined" : _typeof$1(globalThis)) === "object") { globalThis.regeneratorRuntime = runtime; } else { Function("r", "regeneratorRuntime = r")(runtime); } } function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var __default__$6 = { name: "Shade" }; var _sfc_main$7 = defineComponent(_objectSpread$7(_objectSpread$7({}, __default__$6), {}, { props: { opacity: null, index: null, visible: { type: [Boolean, String] } }, emits: ["shadeClick"], setup: function setup(__props, _ref) { var emit = _ref.emit; var props = __props; var styles = computed(function() { return { opacity: props.opacity, zIndex: props.index }; }); var shadeClick = function shadeClick2() { emit("shadeClick"); }; return function(_ctx, _cache) { return __props.visible ? (openBlock(), createElementBlock("div", { key: 0, class: "layui-layer-shade", style: normalizeStyle(unref(styles)), onClick: shadeClick }, null, 4)) : createCommentVNode("", true); }; } })); function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var _hoisted_1$5 = ["src"]; var __default__$5 = { name: "Iframe" }; var _sfc_main$6 = defineComponent(_objectSpread$6(_objectSpread$6({}, __default__$5), {}, { props: { src: null }, setup: function setup2(__props) { var props = __props; var src = computed(function() { return props.src; }); return function(_ctx, _cache) { return openBlock(), createElementBlock("iframe", { scrolling: "auto", class: "layui-layer-iframe", allowtransparency: "true", frameborder: "0", src: unref(src) }, null, 8, _hoisted_1$5); }; } })); function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var _hoisted_1$4 = { class: "layui-layer-title", style: { "cursor": "move" } }; var __default__$4 = { name: "Title" }; var _sfc_main$5 = defineComponent(_objectSpread$5(_objectSpread$5({}, __default__$4), {}, { props: { title: { type: [String, Boolean, Function] } }, setup: function setup3(__props) { var renderContent = function renderContent2(content) { if (typeof content === "function") { return content(); } return content; }; return function(_ctx, _cache) { return openBlock(), createElementBlock("div", _hoisted_1$4, toDisplayString(renderContent(__props.title)), 1); }; } })); function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var __default__$3 = { name: "CloseBtn" }; var _sfc_main$4 = defineComponent(_objectSpread$4(_objectSpread$4({}, __default__$3), {}, { props: { closeBtn: { type: [Number, String, Boolean] } }, emits: ["closeHandle"], setup: function setup4(__props, _ref) { var emit = _ref.emit; var closeHandle = function closeHandle2() { emit("closeHandle"); }; return function(_ctx, _cache) { return openBlock(), createElementBlock("a", { class: normalizeClass(["layui-layer-ico layui-layer-close layui-layer-close" + __props.closeBtn]), href: "javascript:;", onClick: closeHandle }, null, 2); }; } })); var _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; var _sfc_main$3 = { name: "Resize" }; var _hoisted_1$3 = { class: "layui-layer-resize" }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", _hoisted_1$3); } var Resize = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]); function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var _hoisted_1$2 = ["onWheel"]; var _hoisted_2$2 = ["src"]; var _hoisted_3$2 = { key: 0, class: "layui-layer-imgsee" }; var _hoisted_4$1 = { key: 0, class: "layui-layer-imguide" }; var _hoisted_5$1 = { key: 0, class: "thumb-row" }; var _hoisted_6$1 = ["onClick"]; var _hoisted_7$1 = ["src"]; var _hoisted_8$1 = { key: 1, class: "layui-layer-imgtit" }; var _hoisted_9 = { key: 0 }; var _hoisted_10 = { key: 1 }; var __default__$2 = { name: "Photos" }; var _sfc_main$2 = defineComponent(_objectSpread$3(_objectSpread$3({}, __default__$2), {}, { props: { imgList: null, startIndex: { default: 0 } }, emits: ["resetCalculationPohtosArea"], setup: function setup5(__props, _ref) { var emit = _ref.emit; var props = __props; var index2 = ref(props.startIndex); watch(index2, function() { emit("resetCalculationPohtosArea", index2.value); }); var changeIndex = function changeIndex2(step) { var nowIndex = index2.value; var next = nowIndex + step; if (next < 0) { next = props.imgList.length - 1; } if (next >= props.imgList.length) { next = 0; } index2.value = next; }; var showLayerImgBar = ref(false); onMounted(function() { nextTick(function() { showLayerImgBar.value = true; }); }); var ifSetThumb = computed(function() { var res = false; props.imgList.forEach(function(e) { if (e.thumb) { res = true; } }); return res; }); var scale = ref(1); var handleWheel = function handleWheel2(event) { var delta = event.deltaY > 0 ? -0.1 : 0.1; var newScale = scale.value + delta; scale.value = Math.min(Math.max(newScale, 0.5), 3); }; return function(_ctx, _cache) { return openBlock(), createElementBlock("div", { class: "layui-layer-phimg", onWheel: withModifiers(handleWheel, ["prevent"]), style: normalizeStyle({ transform: "scale(".concat(scale.value, ")") }) }, [createElementVNode("img", { src: __props.imgList[index2.value].src }, null, 8, _hoisted_2$2), __props.imgList.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [__props.imgList.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_4$1, [createElementVNode("a", { href: "javascript:;", class: "layui-layer-iconext layui-layer-imgprev", onClick: _cache[0] || (_cache[0] = function($event) { return changeIndex(-1); }) }), createElementVNode("a", { href: "javascript:;", class: "layui-layer-iconext layui-layer-imgnext", onClick: _cache[1] || (_cache[1] = function($event) { return changeIndex(1); }) })])) : createCommentVNode("", true), __props.imgList.length > 1 || __props.imgList[index2.value].alt ? (openBlock(), createElementBlock("div", { key: 1, class: "layui-layer-imgbar", style: normalizeStyle({ opacity: showLayerImgBar.value ? 1 : 0 }) }, [unref(ifSetThumb) ? (openBlock(), createElementBlock("div", _hoisted_5$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.imgList, function(item, i) { return openBlock(), createElementBlock("div", { class: "thumb-box", key: "thumb-box" + i, onClick: function onClick($event) { return index2.value = i; } }, [createElementVNode("img", { src: item.thumb }, null, 8, _hoisted_7$1)], 8, _hoisted_6$1); }), 128)), createElementVNode("div", { class: "thumb-box-border", style: normalizeStyle({ left: "calc(calc( calc(100% - ".concat(100 * __props.imgList.length, "px) / 2) + ").concat(index2.value * 100, "px)") }) }, null, 4)])) : (openBlock(), createElementBlock("span", _hoisted_8$1, [__props.imgList[index2.value].alt ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(__props.imgList[index2.value].alt), 1)) : createCommentVNode("", true), __props.imgList.length > 1 ? (openBlock(), createElementBlock("em", _hoisted_10, toDisplayString(index2.value + 1) + " / " + toDisplayString(__props.imgList.length), 1)) : createCommentVNode("", true)]))], 4)) : createCommentVNode("", true)])) : createCommentVNode("", true)], 44, _hoisted_1$2); }; } })); function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var _hoisted_1$1 = { class: "title" }; var _hoisted_2$1 = { key: 0, class: "content" }; var _hoisted_3$1 = ["innerHTML"]; var __default__$1 = { name: "Notifiy" }; var _sfc_main$1 = defineComponent(_objectSpread$2(_objectSpread$2({}, __default__$1), {}, { props: { title: null, content: null, isHtmlFragment: { type: Boolean, default: false }, icon: null, iconClass: null }, emits: ["close"], setup: function setup6(__props, _ref) { var emit = _ref.emit; var notifyRef = shallowRef(null); var close2 = function close3() { emit("close"); }; function addClass(obj, cls) { var obj_class = obj.className, blank = obj_class != "" ? " " : ""; var added = obj_class + blank + cls; obj.className = added; } onMounted(function() { nextTick(function() { setTimeout(function() { var _notifyRef$value, _notifyRef$value2; if (!((_notifyRef$value = notifyRef.value) !== null && _notifyRef$value !== void 0 && (_notifyRef$value = _notifyRef$value.parentElement) !== null && _notifyRef$value !== void 0 && _notifyRef$value.parentElement)) return; addClass((_notifyRef$value2 = notifyRef.value) === null || _notifyRef$value2 === void 0 || (_notifyRef$value2 = _notifyRef$value2.parentElement) === null || _notifyRef$value2 === void 0 ? void 0 : _notifyRef$value2.parentElement, "layui-layer-notifiy-transition"); }, 300); }); }); return function(_ctx, _cache) { return openBlock(), createElementBlock("div", { class: "layui-layer-notifiy-wrapper", ref_key: "notifyRef", ref: notifyRef }, [createElementVNode("h2", _hoisted_1$1, [__props.icon ? (openBlock(), createElementBlock("i", { key: 0, class: normalizeClass(__props.iconClass) }, null, 2)) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(__props.title), 1)]), !__props.isHtmlFragment ? (openBlock(), createElementBlock("div", _hoisted_2$1, [createElementVNode("p", null, toDisplayString(__props.content), 1)])) : (openBlock(), createElementBlock("div", { key: 1, class: "content", innerHTML: __props.content }, null, 8, _hoisted_3$1)), createVNode(_sfc_main$4, { onClick: close2 })], 512); }; } })); function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function nextId() { var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 16), 1); } s[14] = "4"; s[19] = hexDigits.substr(s[19] & 3 | 8, 1); s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } function calculateArea(type, area, offset) { return type != "drawer" ? calculateBaseArea(area) : calculateDrawerArea(offset, area); } function calculateBaseArea(area) { if (area === "auto") { return []; } if (typeof area == "string") { return [area]; } return _toConsumableArray(area); } function calculateDrawerArea(offset) { var drawerArea = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "30%"; if (drawerArea instanceof Array) { return drawerArea; } if (drawerArea === "auto") { drawerArea = "30%"; } if (offset === "l" || offset === "r") { return [drawerArea, "100%"]; } else if (offset === "t" || offset === "b") { return ["100%", drawerArea]; } return [drawerArea, "100%"]; } function calculateOffset(offset, area, type) { var arr = ["t", "r", "b", "l", "lt", "lb", "rt", "rb"]; var t = offset[0]; var l = offset[1]; if (offset instanceof Array && type === "drawer") { offset = "r"; } if (arr.indexOf(offset) > -1) { t = "50%"; l = "50%"; } if (arr.indexOf(offset) != -1 || t.indexOf("%") > -1) t = "calc(" + t + " - (" + (area === "auto" ? "100px" : area[1]) + "/2 ))"; if (arr.indexOf(offset) != -1 || l.indexOf("%") > -1) l = "calc(" + l + " - (" + (area === "auto" ? "100px" : area[0]) + "/2 ))"; if (offset === "t") t = "0px"; else if (offset === "r") l = "calc(100% - " + area[0] + ")"; else if (offset === "b") t = "calc(100% - " + area[1] + ")"; else if (offset === "l") l = "0px"; else if (offset === "lt") { t = "0px"; l = "0px"; } else if (offset === "lb") { t = "calc(100% - " + area[1] + ")"; l = "0px"; } else if (offset === "rt") { t = "0px"; l = "calc(100% - " + area[0] + ")"; } else if (offset === "rb") { t = "calc(100% - " + area[1] + ")"; l = "calc(100% - " + area[0] + ")"; } return [t, l]; } function calculateType(modalType) { if (modalType === "dialog" || modalType == 0) { return 0; } else if (modalType === "page" || modalType == 1) { return 1; } else if (modalType === "iframe" || modalType == 2) { return 2; } else if (modalType === "loading" || modalType == 3) { return 3; } else if (modalType === "drawer" || modalType == 4) { return 4; } else if (modalType === "photos" || modalType == 5) { return 5; } else if (modalType === "notifiy" || modalType == 6) { return 6; } return 0; } function calculateContent(title2, height, btn, type, isMessage) { if (height && height.indexOf("%") != -1) { height = "100%"; } if (btn && btn.length > 0) { if (type == 0) { if (title2) { return "calc(" + height + " - 90px)"; } else { return "calc(" + height + " - 86px)"; } } if (type == 1 || type == 4) { if (title2) { return "calc(" + height + " - 102px)"; } else { return "calc(" + height + " - 51px)"; } } if (type == 2) { if (title2) { return "calc(" + height + " - 102px)"; } else { return "calc(" + height + " - 51px)"; } } } else { if (type == 0) { if (title2) { return isMessage ? "" : "calc(" + height + " - 137px)"; } else { return isMessage ? "" : "calc(" + height + " - 86px)"; } } if (type == 1 || type == 4) { if (title2) { return "calc(" + height + " - 51px)"; } else { return "calc(" + height + " - 0px)"; } } if (type == 2) { if (title2) { return "calc(" + height + " - 51px)"; } else { return "calc(" + height + " - 0px)"; } } } } function maxArea() { return { w: "100%", h: "100%" }; } function maxOffset() { return { t: "0px", l: "0px" }; } function minArea() { return { w: "180px", h: "51px" }; } function minOffset(left) { return { t: "calc(100% - 51px)", l: left + "px" }; } function getArea(dom) { var width = getComputedStyle(dom, null).width; var height = getComputedStyle(dom, null).height; return [width, height]; } var minArrays = []; function updateMinArrays(id, state) { var i = 0; if (state) { var index2 = minArrays.findIndex(function(v) { return v === void 0; }); if (index2 === -1) { minArrays.push(id); i = minArrays.length - 1; } else { minArrays[index2] = id; i = index2; } } else { delete minArrays[minArrays.findIndex(function(v) { return v == id; })]; i = -1; } return i; } function getDrawerAnimationClass(offset) { var isClose = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var prefix = "layer-drawer-anim layer-anim"; var suffix = "rl"; if (offset === "l") { suffix = "lr"; } else if (offset === "r") { suffix = "rl"; } else if (offset === "t") { suffix = "tb"; } else if (offset === "b") { suffix = "bt"; } return isClose ? "".concat(prefix, "-").concat(suffix, "-close") : "".concat(prefix, "-").concat(suffix); } function calculatePhotosArea(_x, _x2) { return _calculatePhotosArea.apply(this, arguments); } function _calculatePhotosArea() { _calculatePhotosArea = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee(url, options) { var img, area; return regenerator.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: area = function _area(img2) { var imgarea = [img2.width, img2.height]; var winarea = [window.innerWidth - 250, window.innerHeight - 250]; if (imgarea[0] > winarea[0] || imgarea[1] > winarea[1]) { var wh = [imgarea[0] / winarea[0], imgarea[1] / winarea[1]]; if (wh[0] > wh[1]) { imgarea[0] = imgarea[0] / wh[0]; imgarea[1] = imgarea[1] / wh[0]; } else if (wh[0] < wh[1]) { imgarea[0] = imgarea[0] / wh[1]; imgarea[1] = imgarea[1] / wh[1]; } } return [imgarea[0] + "px", imgarea[1] + "px"]; }; img = new Image(); img.src = url; return _context.abrupt("return", new Promise(function(resolve, reject) { if (img.complete) { resolve(area(img)); return; } var layerId = layer.load(2); img.onload = function() { layer.close(layerId); resolve(area(img)); }; img.onerror = function() { layer.close(layerId); layer.msg("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"); reject(false); }; })); case 4: case "end": return _context.stop(); } }, _callee); })); return _calculatePhotosArea.apply(this, arguments); } function calculateNotifOffset(offset, area, layerId) { var arr = ["lt", "lb", "rt", "rb"]; var t = "0", l = "0"; var transOffsetLeft = 15; var transOffsetTop = 15; window.NotifiyQueen = window.NotifiyQueen || []; var notifiyQueen = window.NotifiyQueen; if (typeof offset != "string" || arr.indexOf(offset) === -1) { offset = "rt"; } var nodeList = notifiyQueen.filter(function(e) { if (e.offset === offset) { return e; } }); var prevNode = nodeList.length > 0 ? nodeList[nodeList.length - 1] : null; if (prevNode) { var _document$getElementB; prevNode = (_document$getElementB = document.getElementById(prevNode["id"])) === null || _document$getElementB === void 0 || (_document$getElementB = _document$getElementB.firstElementChild) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.firstElementChild; if (offset === "rt" || offset === "lt") { transOffsetTop += prevNode.offsetHeight + parseFloat(prevNode.style["top"]); } else { var bottom = parseFloat(prevNode.style["top"].split(" - ")[1]); transOffsetTop += prevNode.offsetHeight + bottom; } } else { if (offset === "rb" || offset === "lb") { transOffsetTop += parseFloat(area[1]); } } if (offset === "rt") { t = transOffsetTop + "px"; l = "calc(100% - " + (parseFloat(area[0]) + transOffsetLeft) + "px)"; } else if (offset === "rb") { t = "calc(100vh - " + transOffsetTop + "px)"; l = "calc(100% - " + (parseFloat(area[0]) + transOffsetLeft) + "px)"; } else if (offset === "lt") { t = transOffsetTop + "px"; l = transOffsetLeft + "px"; } else if (offset === "lb") { t = "calc(100vh - " + transOffsetTop + "px)"; l = transOffsetLeft + "px"; } notifiyQueen.push({ id: layerId, offset }); return [t, l]; } function removeNotifiyFromQueen(layerId) { var _document$getElementB2; var transOffsetTop = 15; var notifiyDom = (_document$getElementB2 = document.getElementById(layerId)) === null || _document$getElementB2 === void 0 || (_document$getElementB2 = _document$getElementB2.firstElementChild) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.firstElementChild; var offsetHeight = notifiyDom.offsetHeight; window.NotifiyQueen = window.NotifiyQueen || []; var notifiyQueen = window.NotifiyQueen; var index2 = notifiyQueen.findIndex(function(e) { return e.id === layerId; }); var offsetType = notifiyQueen[index2].offset; var list = notifiyQueen.filter(function(e) { if (e.offset === offsetType) { return e; } }); var findIndex = list.findIndex(function(e) { return e.id === layerId; }); var needCalculatelist = list.slice(findIndex + 1); needCalculatelist.forEach(function(e) { var _document$getElementB3; var dom = (_document$getElementB3 = document.getElementById(e.id)) === null || _document$getElementB3 === void 0 || (_document$getElementB3 = _document$getElementB3.firstElementChild) === null || _document$getElementB3 === void 0 ? void 0 : _document$getElementB3.firstElementChild; if (offsetType === "rt" || offsetType === "lt") { dom.style["top"] = parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px"; } else { var bottom = parseFloat(dom.style["top"].split(" - ")[1]) - transOffsetTop - offsetHeight; dom.style["top"] = "calc(100vh - " + bottom + "px)"; } }); notifiyQueen.splice(index2, 1); } function getNotifyAnimationClass(offset) { var prefix = "layer-drawer-anim layer-anim"; var suffix = ""; if (offset === "lt" || offset === "lb") { suffix = "lr"; } else { suffix = "rl"; } return "".concat(prefix, "-").concat(suffix); } var useMove$1 = function useMove(el, callback) { if (el != null) { el.addEventListener("mousedown", function(event) { var path = event.composedPath && event.composedPath() || event.path; if (path[0].className === "layui-layer-resize") { if (event.button == 0 && el != null) { var x = el.offsetLeft; var y = el.offsetTop; var move = function move2(moveEvent) { if (el != null) { var offsetX = moveEvent.clientX; var offsetY = moveEvent.clientY; var w = offsetX - x; var h2 = offsetY - y; w < 260 && (w = 260); h2 < 115 && (h2 = 115); el.style.width = "".concat(w, "px"); el.style.height = "".concat(h2, "px"); callback(el.style.width, el.style.height); } return false; }; document.addEventListener("mousemove", move); var _stop = function stop() { document.removeEventListener("mousemove", move); document.removeEventListener("mouseup", _stop); }; document.addEventListener("mouseup", _stop); } } return false; }); } }; var useMove2 = function useMove3(el, callback) { el.style.position = "fixed"; var offsetX; var offsetY; if (el != null) { el.addEventListener("mousedown", function(event) { var path = event.composedPath && event.composedPath() || event.path; if (path[0].className === "layui-layer-title") { if (event.button == 0 && el != null) { var lexObj = getComputedStyle(el); offsetX = event.pageX - el.offsetLeft + parseInt(lexObj["margin-left"]); offsetY = event.pageY - el.offsetTop + parseInt(lexObj["margin-right"]); var move = function move2(event2) { if (el != null) { var x = event2.pageX - offsetX; var y = event2.pageY - offsetY; if (x < 0) { x = 0; } else if (x > document.documentElement.clientWidth - el.offsetWidth) { x = document.documentElement.clientWidth - el.offsetWidth; } if (y < 0) { y = 0; } else if (y > document.documentElement.clientHeight - el.offsetHeight) { y = document.documentElement.clientHeight - el.offsetHeight; } el.style.left = "".concat(x, "px"); el.style.top = "".concat(y, "px"); callback(el.style.left, el.style.top); } return false; }; document.addEventListener("mousemove", move); var _stop = function stop() { document.removeEventListener("mousemove", move); document.removeEventListener("mouseup", _stop); }; document.addEventListener("mouseup", _stop); } } return false; }); } }; var zIndexKey = Symbol("zIndex"); function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var _hoisted_1$6 = { key: 0, style: { "scale": "0.5" } }; var _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { class: "loading" }, null, -1); var _hoisted_3$3 = /* @__PURE__ */ createElementVNode("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1" }, [/* @__PURE__ */ createElementVNode("defs", null, [/* @__PURE__ */ createElementVNode("filter", { id: "goo" }, [/* @__PURE__ */ createElementVNode("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "6.3", result: "blur" }), /* @__PURE__ */ createElementVNode("feColorMatrix", { in: "blur", mode: "matrix", values: "1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 14 -4", result: "goo" }), /* @__PURE__ */ createElementVNode("feBlend", { in: "SourceGraphic", in2: "goo" })])])], -1); var _hoisted_4$2 = [_hoisted_2$3, _hoisted_3$3]; var _hoisted_5$2 = ["innerHTML"]; var _hoisted_6$2 = { key: 1, class: "layui-layer-setwin" }; var _hoisted_7$2 = { key: 0 }; var _hoisted_8 = ["onClick"]; var __default__$7 = { name: "LayLayer" }; var _sfc_main$8 = defineComponent(_objectSpread$1(_objectSpread$1({}, __default__$7), {}, { props: { id: null, title: { type: [String, Boolean, Function], default: "\u6807\u9898" }, icon: null, skin: null, zIndex: null, setTop: { type: Boolean, default: false }, offset: { default: function _default() { return ["50%", "50%"]; } }, area: { default: "auto" }, modelValue: { type: Boolean, default: false }, maxmin: { type: [Boolean, String], default: false }, btn: { type: [Array, Boolean] }, move: { type: [Boolean, String], default: true }, resize: { type: [Boolean, String], default: false }, type: { default: 1 }, content: null, isHtmlFragment: { type: Boolean, default: false }, shade: { type: [Boolean, String], default: true }, shadeClose: { type: [Boolean, String], default: true }, shadeOpacity: { default: "0.1" }, closeBtn: { type: [Boolean, String], default: "1" }, btnAlign: { default: "r" }, time: { default: 0 }, load: { default: 0 }, anim: { default: 0 }, isOutAnim: { type: Boolean, default: true }, destroy: { type: Function, default: function _default2() { } }, success: { type: Function, default: function _default3() { } }, end: { type: Function, default: function _default4() { } }, yes: null, yesText: { default: "\u786E\u5B9A" }, isFunction: { type: Boolean, default: false }, isMessage: { type: Boolean, default: false }, appContext: null, startIndex: { default: 0 }, imgList: { default: function _default5() { return []; } }, min: { type: Function, default: function _default6() { } }, full: { type: Function, default: function _default7() { } }, restore: { type: Function, default: function _default8() { } } }, emits: ["close", "update:modelValue"], setup: function setup7(__props, _ref) { var _props$zIndex; var expose = _ref.expose, emit = _ref.emit; var props = __props; var slots = useSlots(); var max = ref(false); var min = ref(false); var id = ref(props.id || nextId()); var layero = ref(null); var type = calculateType(props.type); var area = ref(calculateArea(props.type, props.area, props.offset)); var offset = ref(calculateOffset(props.offset, area.value, props.type)); var contentHeight = ref(calculateContent(props.title, area.value[1], props.btn, type, props.isMessage)); var index2 = ref((_props$zIndex = props.zIndex) !== null && _props$zIndex !== void 0 ? _props$zIndex : inject(zIndexKey, 99999)); var visible = ref(false); var first = ref(true); var w = ref(area.value[0]); var h2 = ref(area.value[1]); var t = ref(offset.value[0]); var l = ref(offset.value[1]); var _w = ref(area.value[0]); var _h = ref(area.value[0]); var _t = ref(offset.value[0]); var _l = ref(offset.value[1]); var firstOpenDelayCalculation = function firstOpenDelayCalculation2() { nextTick(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee() { return regenerator.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: area.value = getArea(layero.value); if (type == 4) { area.value = calculateDrawerArea(props.offset, props.area); } if (!(type == 5)) { _context.next = 6; break; } _context.next = 5; return calculatePhotosArea(props.imgList[props.startIndex].src, props); case 5: area.value = _context.sent; case 6: offset.value = calculateOffset(props.offset, area.value, props.type); if (type == 6) { offset.value = calculateNotifOffset(props.offset, area.value, id.value); } w.value = area.value[0]; h2.value = area.value[1]; _w.value = area.value[0]; _l.value = area.value[1]; t.value = offset.value[0]; l.value = offset.value[1]; _t.value = offset.value[0]; _l.value = offset.value[1]; supportMove(); case 17: case "end": return _context.stop(); } }, _callee); }))); }; var notFirstOpenLayerInit = function notFirstOpenLayerInit2() { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; supportMove(); }; var beforeCloseSaveData = function beforeCloseSaveData2() { if (min.value) minHandle(); if (max.value) maxHandle(); _w.value = w.value; _h.value = h2.value; _t.value = t.value; _l.value = l.value; }; var maxHandle = function maxHandle2() { if (max.value) { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; props.restore(props.id); } else { _t.value = t.value; _l.value = l.value; _w.value = w.value; _h.value = h2.value; w.value = maxArea().w; h2.value = maxArea().h; t.value = maxOffset().t; l.value = maxOffset().l; props.full(props.id); } max.value = !max.value; }; var minHandle = function minHandle2() { var left = 180 * updateMinArrays(id.value, !min.value); if (left > document.documentElement.clientWidth - 180) { left = document.documentElement.clientWidth - 180; } if (min.value) { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; props.restore(props.id); } else { _w.value = w.value; _h.value = h2.value; _t.value = t.value; _l.value = l.value; h2.value = minArea().h; w.value = minArea().w; t.value = minOffset(left).t; l.value = minOffset(left).l; props.min(props.id); } min.value = !min.value; }; var reset2 = function reset3() { if (!first.value) { min.value = false; max.value = false; w.value = area.value[0]; h2.value = area.value[1]; t.value = offset.value[0]; l.value = offset.value[1]; _w.value = area.value[0]; _h.value = area.value[1]; _t.value = offset.value[0]; _l.value = offset.value[1]; } if (!props.modelValue) { emit("update:modelValue", true); } }; watch(function() { return props.modelValue; }, function() { visible.value = props.modelValue; if (visible.value) { if (first.value) { first.value = false; firstOpenDelayCalculation(); } else { notFirstOpenLayerInit(); } } else { beforeCloseSaveData(); } }, { deep: true, immediate: true }); watch(function() { return visible.value; }, function() { if (visible.value) { if (props.isFunction) { firstOpenDelayCalculation(); } props.success(); } }, { immediate: true, flush: "post" }); watch(function() { return visible.value; }, function() { if (!visible.value) { props.end(); } }); watch(function() { return h2.value; }, function() { contentHeight.value = calculateContent(props.title, h2.value, props.btn, type, props.isMessage); }); var boxClasses = computed(function() { return [{ "layui-layer-dialog": type === 0, "layui-layer-page": type === 1, "layui-layer-iframe": type === 2, "layui-layer-loading": type === 3, "layui-layer-drawer": type === 4, "layui-layer-photos": type === 5, "layui-layer-notifiy": type === 6, "layui-layer-msg": props.isMessage, "layui-layer-hui": props.isMessage && !props.icon }, props.skin]; }); var supportMove = function supportMove2() { if (props.move && type != 4) { nextTick(function() { if (!layero.value) return; useMove2(layero.value, function(left, top) { l.value = left; t.value = top; }); useMove$1(layero.value, function(width, height) { h2.value = height; w.value = width; }); }); } }; var styles = computed(function() { var style = { top: t.value, left: l.value, width: w.value, height: h2.value, zIndex: index2.value }; return style; }); var contentClasses = computed(function() { return [type === 3 ? "layui-layer-loading".concat(props.load) : "", props.icon ? "layui-layer-padding" : ""]; }); var closeHandle = function closeHandle2() { emit("close"); emit("update:modelValue", false); props.destroy(); if (type === 6) { removeNotifiyFromQueen(props.id); } }; var yesHandle = function yesHandle2() { if (props.yes != void 0) props.yes(); else closeHandle(); }; var shadeHandle = function shadeHandle2() { if (props.shadeClose) closeHandle(); }; var renderContent = function renderContent2(content) { if (content instanceof Function) { return content(); } return content; }; var iconClass = computed(function() { return ["layui-layer-ico", "layui-layer-ico".concat(props.icon)]; }); var enterActiveClass = computed(function() { if (type === 4) { return getDrawerAnimationClass(props.offset); } if (type === 6) { return getNotifyAnimationClass(props.offset); } return "layer-anim layer-anim-0".concat(props.anim); }); var leaveActiveClass = computed(function() { if (type === 4) { return getDrawerAnimationClass(props.offset, true); } return props.isOutAnim ? "layer-anim-close" : ""; }); var open2 = function open3() { visible.value = true; }; var close2 = function close3() { visible.value = false; }; var shadeVisible = computed(function() { return visible.value && props.shade && !min.value; }); var showResize = computed(function() { return props.resize && !max.value && !min.value; }); var showTitle = computed(function() { return props.title && props.type != 3 && props.type != 5 && props.type != 6; }); var resetCalculationPohtosArea = function resetCalculationPohtosArea2(index22) { nextTick(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee2() { return regenerator.wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return calculatePhotosArea(props.imgList[index22].src, props); case 2: area.value = _context2.sent; offset.value = calculateOffset(props.offset, area.value, props.type); w.value = area.value[0]; h2.value = area.value[1]; t.value = offset.value[0]; l.value = offset.value[1]; _w.value = area.value[0]; _l.value = area.value[1]; _t.value = offset.value[0]; _l.value = offset.value[1]; case 12: case "end": return _context2.stop(); } }, _callee2); }))); }; expose({ reset: reset2, open: open2, close: close2 }); return function(_ctx, _cache) { return openBlock(), createElementBlock("div", null, [createVNode(_sfc_main$7, { index: index2.value, visible: unref(shadeVisible), opacity: __props.shadeOpacity, onShadeClick: shadeHandle }, null, 8, ["index", "visible", "opacity"]), createVNode(Transition, { "enter-active-class": unref(enterActiveClass), "leave-active-class": unref(leaveActiveClass) }, { default: withCtx(function() { return [visible.value ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "layero", ref: layero, class: normalizeClass(["layui-layer layui-layer-border", unref(boxClasses)]), style: normalizeStyle(unref(styles)) }, [unref(showTitle) ? (openBlock(), createBlock(_sfc_main$5, { key: 0, title: __props.title }, null, 8, ["title"])) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(["layui-layer-content", unref(contentClasses)]), style: normalizeStyle({ height: contentHeight.value }) }, [unref(type) === 3 ? (openBlock(), createElementBlock("div", _hoisted_1$6, _hoisted_4$2)) : createCommentVNode("", true), unref(type) === 0 || unref(type) === 1 || unref(type) === 4 ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [__props.icon ? (openBlock(), createElementBlock("i", { key: 0, class: normalizeClass(unref(iconClass)) }, null, 2)) : createCommentVNode("", true), unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [__props.isHtmlFragment ? (openBlock(), createElementBlock("span", { key: 0, innerHTML: renderContent(props.content) }, null, 8, _hoisted_5$2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(renderContent(props.content)), 1)], 64))], 64))], 64)) : createCommentVNode("", true), unref(type) === 2 ? (openBlock(), createBlock(_sfc_main$6, { key: 2, src: props.content }, null, 8, ["src"])) : createCommentVNode("", true), unref(type) === 5 ? (openBlock(), createBlock(_sfc_main$2, { key: 3, imgList: props.imgList, startIndex: props.startIndex, onResetCalculationPohtosArea: resetCalculationPohtosArea }, null, 8, ["imgList", "startIndex"])) : createCommentVNode("", true), unref(type) === 6 ? (openBlock(), createBlock(_sfc_main$1, { key: 4, onClose: closeHandle, title: props.title, content: props.content, isHtmlFragment: props.isHtmlFragment, icon: props.icon, iconClass: unref(iconClass) }, null, 8, ["title", "content", "isHtmlFragment", "icon", "iconClass"])) : createCommentVNode("", true)], 6), unref(type) != 3 && unref(type) != 5 && unref(type) != 6 ? (openBlock(), createElementBlock("span", _hoisted_6$2, [__props.maxmin && !max.value ? (openBlock(), createElementBlock("a", { key: 0, class: normalizeClass(["layui-layer-min", [min.value ? "layui-layer-ico layui-layer-maxmin" : ""]]), href: "javascript:;", onClick: minHandle }, [!min.value ? (openBlock(), createElementBlock("cite", _hoisted_7$2)) : createCommentVNode("", true)], 2)) : createCommentVNode("", true), __props.maxmin && !min.value ? (openBlock(), createElementBlock("a", { key: 1, class: normalizeClass(["layui-layer-ico layui-layer-max", [max.value ? "layui-layer-maxmin" : ""]]), href: "javascript:;", onClick: maxHandle }, null, 2)) : createCommentVNode("", true), __props.closeBtn != false ? (openBlock(), createBlock(_sfc_main$4, { key: 2, "close-btn": __props.closeBtn, onCloseHandle: closeHandle }, null, 8, ["close-btn"])) : createCommentVNode("", true)])) : createCommentVNode("", true), (__props.btn && __props.btn.length > 0 || unref(type) === 0) && !__props.isMessage ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass(["layui-layer-btn", ["layui-layer-btn-".concat(__props.btnAlign)]]) }, [__props.btn && __props.btn.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.btn, function(b, index22) { return openBlock(), createElementBlock("a", { key: index22, class: normalizeClass(["layui-layer-btn".concat(index22)]), onClick: function onClick($event) { return b.callback(id.value); } }, toDisplayString(b.text), 11, _hoisted_8); }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(type) === 0 ? (openBlock(), createElementBlock("a", { key: 0, class: "layui-layer-btn0", onClick: _cache[0] || (_cache[0] = function($event) { return yesHandle(); }) }, toDisplayString(__props.yesText), 1)) : createCommentVNode("", true)], 64))], 2)) : createCommentVNode("", true), unref(showResize) ? (openBlock(), createBlock(Resize, { key: 3 })) : createCommentVNode("", true)], 6)) : createCommentVNode("", true)]; }), _: 3 }, 8, ["enter-active-class", "leave-active-class"])]); }; } })); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r2) { return Object.getOwnPropertyDescriptor(e, r2).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function(r2) { _defineProperty(e, r2, t[r2]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } var layerInstance = []; var addInstance = function addInstance2(instance) { layerInstance.push(instance); }; var delInstance = function delInstance2(id) { layerInstance.forEach(function(item, index2) { if (item.modalContainer.id === id) { layerInstance.splice(index2, 1); } }); }; var cleanInstance = function cleanInstance2() { layerInstance.splice(0, layerInstance.length); }; var isExist = function isExist2(id) { var b = false; layerInstance.forEach(function(item, index2) { if (item.modalContainer.id == id) { b = true; } }); return b; }; var findById = function findById2(id) { var instance = null; layerInstance.forEach(function(item, index2) { if (item.modalContainer.id === id) { instance = item; } }); return instance; }; var mergeOption = function mergeOption2(option, defaultOption) { if (option) defaultOption = Object.assign(defaultOption, option); return defaultOption; }; var createContainer = function createContainer2(options) { var modalContainer = document.createElement("div"); modalContainer.id = options.id; document.body.appendChild(modalContainer); return modalContainer; }; var modalChildrenVNode = function modalChildrenVNode2(content) { if (typeof content === "function") { return isVNode(content()) ? { default: function _default9() { return content(); } } : void 0; } return isVNode(content) ? { default: function _default9() { return content; } } : void 0; }; var layer = { _context: null, open: function open(option, callback) { var defaultOption = {}; return layer.create(option, defaultOption, callback); }, drawer: function drawer(option, callback) { var defaultOption = { type: "drawer" }; return layer.create(option, defaultOption, callback); }, msg: function msg(message, option, callback) { var defaultOption = { type: 0, title: false, content: message, closeBtn: false, shadeClose: false, isMessage: true, shade: false, time: 1e3, btn: false }; return layer.create(option, defaultOption, callback); }, load: function load(_load, option, callback) { var defaultOption = { type: 3, load: _load, anim: 5, isOutAnim: false, shadeClose: false }; return layer.create(option, defaultOption, callback); }, confirm: function confirm(msg2, option, callback) { var defaultOption = { type: 0, content: msg2, shadeClose: false }; return layer.create(option, defaultOption, callback); }, photos: function photos(option, callback) { if (typeof option === "string") { option = { imgList: [{ src: option }] }; } var defaultOption = { type: 5, anim: 2, startIndex: 0, isOutAnim: true, shadeClose: true, shadeOpacity: "0.7" }; return layer.create(option, defaultOption, callback); }, notifiy: function notifiy() { var option = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var callback = arguments.length > 1 ? arguments[1] : void 0; option.type = 6; var defaultOption = { offset: "rt", time: 2e3, area: "auto", shade: false }; return layer.create(option, defaultOption, callback); }, create: function create(option, defaultOption, callback) { var _modalInstance$compon2; var timer; var options = mergeOption(option, defaultOption); if (options.hasOwnProperty("id")) { layer.close(options.id); } else { options.id = nextId(); } var modalContainer = createContainer(options); var modalInstance = h(_sfc_main$8, _objectSpread(_objectSpread({}, options), {}, { isFunction: true, destroy: function destroy() { var _modalInstance$compon; clearTimeout(timer); (_modalInstance$compon = modalInstance.component) === null || _modalInstance$compon === void 0 || (_modalInstance$compon = _modalInstance$compon.exposed) === null || _modalInstance$compon === void 0 || _modalInstance$compon.close(); setTimeout(function() { render(null, modalContainer); if (document.body.contains(modalContainer)) { document.body.removeChild(modalContainer); } }, 2e3); delInstance(modalContainer.id); } }), modalChildrenVNode(options.content)); modalInstance.appContext = options.appContext || layer._context; render(modalInstance, modalContainer); (_modalInstance$compon2 = modalInstance.component) === null || _modalInstance$compon2 === void 0 || (_modalInstance$compon2 = _modalInstance$compon2.exposed) === null || _modalInstance$compon2 === void 0 || _modalInstance$compon2.open(); if (defaultOption && defaultOption.time != void 0 && defaultOption.time != 0) { timer = setTimeout(function() { var _modalInstance$compon3; (_modalInstance$compon3 = modalInstance.component) === null || _modalInstance$compon3 === void 0 || (_modalInstance$compon3 = _modalInstance$compon3.exposed) === null || _modalInstance$compon3 === void 0 || _modalInstance$compon3.close(); if (callback) callback(modalContainer.id); setTimeout(function() { render(null, modalContainer); if (document.body.contains(modalContainer)) { document.body.removeChild(modalContainer); } }, 2e3); delInstance(modalContainer.id); if (options.type === 6) { removeNotifiyFromQueen(options.id); } }, defaultOption.time); } addInstance({ modalContainer, modalInstance }); return modalContainer.id; }, close: function close(id) { if (id != null && isExist(id)) { var _instance$modalInstan; var instance = findById(id); (_instance$modalInstan = instance.modalInstance.component) === null || _instance$modalInstan === void 0 || (_instance$modalInstan = _instance$modalInstan.exposed) === null || _instance$modalInstan === void 0 || _instance$modalInstan.close(); setTimeout(function() { render(null, instance.modalContainer); if (document.body.contains(instance.modalContainer)) document.body.removeChild(instance.modalContainer); }, 2e3); } delInstance(id); }, closeAll: function closeAll() { layerInstance.forEach(function(item) { var _item$modalInstance$c; (_item$modalInstance$c = item.modalInstance.component) === null || _item$modalInstance$c === void 0 || (_item$modalInstance$c = _item$modalInstance$c.exposed) === null || _item$modalInstance$c === void 0 || _item$modalInstance$c.close(); setTimeout(function() { render(null, item.modalContainer); if (document.body.contains(item.modalContainer)) document.body.removeChild(item.modalContainer); }, 2e3); }); cleanInstance(); }, reset: function reset(instance) { var _instance$modalInstan2; (_instance$modalInstan2 = instance.modalInstance.component) === null || _instance$modalInstan2 === void 0 || (_instance$modalInstan2 = _instance$modalInstan2.exposed) === null || _instance$modalInstan2 === void 0 || _instance$modalInstan2.reset(); } }; var install = function install2(app, options) { layer._context = app._context; app.component(_sfc_main$8.name, _sfc_main$8); app.config.globalProperties.$layer = layer; if (options) { app.provide(zIndexKey, options.zIndex); } }; var index = { install }; const _hoisted_1 = ["name", "field", "multiple", "accept", "disabled"]; const _hoisted_2 = { key: 0 }; const _hoisted_3 = ["onClick"]; const _hoisted_4 = ["onClick"]; const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "layui-icon" }, "\uE67C", -1); const _hoisted_6 = /* @__PURE__ */ createElementVNode("div", { class: "layui-hide", id: "uploadDemoView" }, [ /* @__PURE__ */ createElementVNode("hr"), /* @__PURE__ */ createElementVNode("img", { src: "", alt: "\u4E0A\u4F20\u6210\u529F\u540E\u6E32\u67D3", style: { "max-width": "196px" } }) ], -1); const _hoisted_7 = ["src", "id"]; const __default__ = { name: "LayUpload" }; const _sfc_main = defineComponent({ ...__default__, props: { url: null, data: null, headers: null, acceptMime: { default: "MIME_type" }, field: { default: "file" }, size: { default: 0 }, multiple: { type: Boolean, default: false }, number: { default: 0 }, drag: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, disabledPreview: { type: Boolean, default: false }, cut: { type: Boolean, default: false }, cutOptions: { default: void 0 }, text: null, dragText: null, modelValue: { default: null }, auto: { type: Boolean, default: true }, sizeOutMsg: null, quality: null }, emits: [ "choose", "chooseAfter", "before", "done", "error", "cutdone", "cutcancel", "update:modelValue" ], setup(__props, { emit }) { const props = __props; function imgcomp(file) { return new Promise((resolve, reject) => { var options = { file, quality: props.quality, mimeType: "image/jpeg", maxWidth: 2e3, maxHeight: 2e3, convertSize: Infinity, loose: true, redressOrientation: true, success: function(result) { resolve(result); } }; new ImageCompressor(options); }); } const getCutDownResult = () => { if (_cropper) { const canvas = _cropper.getCroppedCanvas(); let imgData = canvas.toDataURL('"image/png"'); let currentTimeStamp = new Date().valueOf(); let orgInfo = activeUploadFiles.value[0]; emit( "cutdone", Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo }) ); let newFile = dataURLtoFile(imgData); if (!props.auto) { emit("update:modelValue", [newFile]); clearLightCutEffect(); return; } commonUploadTransaction([newFile]); nextTick(() => clearAllCutEffect()); } else { errorF(cutInitErrorMsg.value); } }; const closeCutDownModal = () => { let currentTimeStamp = new Date().valueOf(); emit("cutcancel", Object.assign({ currentTimeStamp })); nextTick(() => clearAllCutEffect()); }; const clearAllCutEffect = () => { activeUploadFiles.value = []; activeUploadFilesImgs.value = []; innerCutVisible.value = false; orgFileInput.value.value = ""; _cropper = null; }; const clearLightCutEffect = () => { activeUploadFiles.value = []; activeUploadFilesImgs.value = []; innerCutVisible.value = false; _cropper = null; }; const { t } = useI18n(); const text = computed(() => { return props.text ? props.text : t("upload.text"); }); const dragText = computed(() => { return props.dragText ? props.dragText : t("upload.dragText"); }); const defaultErrorMsg = computed(() => t("upload.defaultErrorMsg")); const urlErrorMsg = computed(() => t("upload.urlErrorMsg")); const numberErrorMsg = computed(() => t("upload.numberErrorMsg")); const occurFileSizeErrorMsg = computed(() => t("upload.occurFileSizeErrorMsg")); const cutInitErrorMsg = computed(() => t("upload.cutInitErrorMsg")); const uploadSuccess = computed(() => t("upload.uploadSuccess")); const startUploadMsg = computed(() => t("upload.startUploadMsg")); const cannotSupportCutMsg = computed(() => t("upload.cannotSupportCutMsg")); const title = computed(() => t("upload.title")); const confirmBtn = computed(() => t("upload.confirmBtn")); const cancelBtn = computed(() => t("upload.cancelBtn")); let defaultCutLayerOption = computed(() => { return { type: "component", title: title.value, shade: true, shadeClose: true, area: ["640px", "640px"], btn: [ { text: confirmBtn.value, callback: getCutDownResult }, { text: cancelBtn.value, callback: closeCutDownModal } ] }; }); const slot = useSlots(); slot.default && slot.default(); getCurrentInstance(); watch( () => props.modelValue, () => { if (!props.modelValue) { clearAllCutEffect(); } } ); const isDragEnter = ref(false); const activeUploadFiles = ref([]); const activeUploadFilesImgs = ref([]); const orgFileInput = templateRef("orgFileInput"); let _cropper = null; let computedCutLayerOption; if (props.cutOptions && props.cutOptions.layerOption) { computedCutLayerOption = computed( () => Object.assign(defaultCutLayerOption, props.cutOptions.layerOption) ); } else { computedCutLayerOption = computed(() => defaultCutLayerOption.value); } const innerCutVisible = ref(false); const localUploadTransaction = async (option) => { const { url, files } = option; let formData = new FormData(); if (url.length <= 5) { errorF(urlErrorMsg.value); return; } if (Array.isArray(files) && files.length > 0) { for (let i = 0; i < files.length; i++) { let _file = files[i]; let f; if (props.quality) { f = await imgcomp(_file); } else { f = _file; } formData.append(props.field + "[" + i + "]", f); } } if (props.data && props.data instanceof Object) { let _requestDate = props.data; for (const key in _requestDate) { formData.append(key, _requestDate[key]); } } let utimer = window.setTimeout(() => { localUpload({ url, formData }, function() { clearTimeout(utimer); }); }, 200); }; const dataURLtoFile = (dataurl) => { let arr = dataurl.split(","); let mime = ""; if (arr.length > 0) { mime = arr[0].match(/:(.*?);/)[1]; } let bstr = atob(arr[1]); let n = bstr.length; let u8arr = new Uint8Array(n); while (n--) { u8arr[n] = bstr.charCodeAt(n); } return new Blob([u8arr], { type: mime }); }; const errorF = (errorText) => { let currentTimeStamp = new Date().valueOf(); let errorMsg = errorText ? errorText : defaultErrorMsg; errorMsg = `${errorMsg}`; console.warn(errorMsg); layer.msg(errorMsg, { icon: 2, time: 1e3 }, function(res) { }); emit("error", Object.assign({ currentTimeStamp, msg: errorMsg })); }; const localUpload = (option, callback) => { let xhr = new XMLHttpRequest(); let url = option.url; let formData = option.formData; const cb = callback; xhr.onreadystatechange = function() { let currentTimeStamp2 = new Date().valueOf(); if (xhr.readyState === 1) { if (xhr.status >= 200 && xhr.status <= 300 || xhr.status === 304 || xhr.status == 0) { let successText = startUploadMsg.value; emit( "before", Object.assign({ currentTimeStamp: currentTimeStamp2, msg: successText, ...option }) ); } } else if (xhr.readyState === 4) { let successText = xhr.responseText ? xhr.responseText : uploadSuccess; if (xhr.status >= 200 && xhr.status <= 300 || xhr.status === 304 || xhr.status == 0) { let data = xhr.responseText; emit("done", { currentTimeStamp: currentTimeStamp2, msg: successText, data }); } } }; xhr.open("post", url, true); if (props.headers) { for (let key in props.headers) { xhr.setRequestHeader(key, props.headers[key]); } } else { xhr.setRequestHeader("Accept", "application/json, text/javascript"); } let currentTimeStamp = new Date().valueOf(); emit("before", Object.assign(option, currentTimeStamp)); xhr.send(formData); if (cb && typeof cb == "function") { cb(); } clearAllCutEffect(); }; const filetoDataURL = (file, fn) => { const reader = new FileReader(); reader.onloadend = function(e) { fn(e.target.result); }; reader.readAsDataURL(file); }; const uploadChange = (e) => { e.preventDefault(); const _files = [...e.target.files || e.dataTransfer.files]; if (props.multiple && props.number != 0 && props.number < _files.length) { errorF(numberErrorMsg.value); return; } if (props.size && props.size != 0) { for (let i = 0; i < _files.length; i++) { let _file = _files[i]; let _size = _file.size; if (_size > props.size * 1024) { errorF(props.sizeOutMsg || occurFileSizeErrorMsg.value); return; } } } for (let item of _files) { activeUploadFiles.value.push(item); filetoDataURL(item, function(res) { activeUploadFilesImgs.value.push(res); }); } let arm1 = props.cut && props.acceptMime.indexOf("image") != -1 && props.multiple == false; let arm2 = props.cut && props.acceptMime.indexOf("image") != -1 && props.multiple == true; if (arm1) { innerCutVisible.value = true; setTimeout(() => { let _imgs = document.getElementsByClassName("_lay_upload_img"); if (_imgs && _imgs.length > 0) { let _img = _imgs[0]; _cropper = new Cropper(_img, { aspectRatio: 16 / 9 }); } else { clearAllCutEffect(); } }, 200); } else { if (arm2) { console.warn(cannotSupportCutMsg.value); } if (!props.auto) { emit("update:modelValue", _files); return; } commonUploadTransaction(_files); } }; const commonUploadTransaction = (_files) => { let currentTimeStamp = new Date().valueOf(); let successText = uploadSuccess; if (props.url) { localUploadTransaction({ url: props.url, files: _files }); } else { emit("done", { currentTimeStamp, msg: successText, data: _files }); clearAllCutEffect(); } }; const chooseFile = () => { let _target = orgFileInput.value; if (_target) { _target.click(); } }; const clickOrgInput = () => { let currentTimeStamp = new Date().valueOf(); emit("choose", currentTimeStamp); }; const dragRef = ref(); function dragEnter(e) { e.stopPropagation(); e.preventDefault(); } function dragOver(e) { e.stopPropagation(); e.preventDefault(); } onMounted(() => { nextTick(() => { if (dragRef.value) { dragRef.value.addEventListener("dragenter", dragEnter, false); dragRef.value.addEventListener("dragover", dragOver, false); dragRef.value.addEventListener("drop", uploadChange, false); } }); }); onUnmounted(() => { if (dragRef.value) { dragRef.value.removeEventListener("dragenter"); dragRef.value.removeEventListener("dragover"); dragRef.value.removeEventListener("drop"); } }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["layui-upload layui-upload-wrap", __props.disabledPreview ? "layui-upload-file-disabled" : ""]) }, [ createElementVNode("input", { type: "file", class: "layui-upload-file", ref_key: "orgFileInput", ref: orgFileInput, name: __props.field, field: __props.field, multiple: __props.multiple, accept: __props.acceptMime, disabled: __props.disabled, onClick: clickOrgInput, onChange: uploadChange }, null, 40, _hoisted_1), !__props.drag ? (openBlock(), createElementBlock("div", _hoisted_2, [ createElementVNode("div", { class: "layui-upload-btn-box", onClick: withModifiers(chooseFile, ["stop"]) }, [ unref(slot).default ? renderSlot(_ctx.$slots, "default", { key: 0, disabled: __props.disabled }) : (openBlock(), createBlock(_sfc_main$9, { key: 1, type: "primary", disabled: __props.disabled }, { default: withCtx(() => [ createTextVNode(toDisplayString(unref(text)), 1) ]), _: 1 }, 8, ["disabled"])) ], 8, _hoisted_3) ])) : (openBlock(), createElementBlock("div", { key: 1, ref_key: "dragRef", ref: dragRef, class: normalizeClass([ "layui-upload-drag", __props.disabled ? "layui-upload-drag-disable" : isDragEnter.value ? "layui-upload-drag-draging" : "" ]), onClick: withModifiers(chooseFile, ["stop"]) }, [ _hoisted_5, createElementVNode("p", null, toDisplayString(unref(dragText)), 1), _hoisted_6 ], 10, _hoisted_4)), createVNode(unref(_sfc_main$8), { modelValue: innerCutVisible.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => innerCutVisible.value = $event), title: unref(computedCutLayerOption).title, move: unref(computedCutLayerOption).move, resize: unref(computedCutLayerOption).resize, shade: unref(computedCutLayerOption).shade, shadeClose: unref(computedCutLayerOption).shadeClose, shadeOpacity: unref(computedCutLayerOption).shadeOpacity, zIndex: unref(computedCutLayerOption).zIndex, btnAlign: unref(computedCutLayerOption).btnAlign, area: unref(computedCutLayerOption).area, anim: unref(computedCutLayerOption).anim, isOutAnim: unref(computedCutLayerOption).isOutAnim, btn: unref(computedCutLayerOption).btn, onClose: clearAllCutEffect }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(activeUploadFilesImgs.value, (base64str, index2) => { return openBlock(), createElementBlock("div", { class: "copper-container", key: `file${index2}` }, [ createElementVNode("img", { src: base64str, id: `_lay_upload_img${index2}`, class: "_lay_upload_img" }, null, 8, _hoisted_7) ]); }), 128)) ]), _: 1 }, 8, ["modelValue", "title", "move", "resize", "shade", "shadeClose", "shadeOpacity", "zIndex", "btnAlign", "area", "anim", "isOutAnim", "btn"]), createElementVNode("div", { class: normalizeClass(["layui-upload-list", __props.disabledPreview ? "layui-upload-list-disabled" : ""]) }, [ renderSlot(_ctx.$slots, "preview") ], 2) ], 2); }; } }); const component = withInstall(_sfc_main); export { component as c, index as i, layer as l };