PageSourceSearch

https://app.nichebrains.ai/_content/MudExRichTextEditor/modules/qu….imageCompressor.min.js?c=8.5.2.0?c=8.5.2.0

js nichebrains.ai collected 2026-10-05 12:20:10 UTC 19,908 bytes, 1 lines download raw bytes

1!function (t, e) { if ("object" == typeof exports && "object" == typeof module) module.exports = e(); else if ("function" == typeof define && define.amd) define([], e); else { var r = e(); for (var n in r) ("object" == typeof exports ? exports : t)[n] = r[n] } }(window, (function () { return function (t) { var e = {}; function r(n) { if (e[n]) return e[n].exports; var i = e[n] = { i: n, l: !1, exports: {} }; return t[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports } return r.m = t, r.c = e, r.d = function (t, e, n) { r.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: n }) }, r.r = function (t) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 }) }, r.t = function (t, e) { if (1 & e && (t = r(t)), 8 & e) return t; if (4 & e && "object" == typeof t && t && t.__esModule) return t; var n = Object.create(null); if (r.r(n), Object.defineProperty(n, "default", { enumerable: !0, value: t }), 2 & e && "string" != typeof t) for (var i in t) r.d(n, i, function (e) { return t[e] }.bind(null, i)); return n }, r.n = function (t) { var e = t && t.__esModule ? function () { return t.default } : function () { return t }; return r.d(e, "a", e), e }, r.o = function (t, e) { return Object.prototype.hasOwnProperty.call(t, e) }, r.p = "/dist/", r(r.s = 6) }([function (t, e, r) { t.exports = r(12) }, function (t, e) { function r(t, e, r, n, i, o, a) { try { var u = t[o](a), c = u.value } catch (t) { return void r(t) } u.done ? e(c) : Promise.resolve(c).then(n, i) } t.exports = function (t) { return function () { var e = this, n = arguments; return new Promise((function (i, o) { var a = t.apply(e, n); function u(t) { r(a, i, o, u, c, "next", t) } function c(t) { r(a, i, o, u, c, "throw", t) } u(void 0) })) } } }, function (t, e) { t.exports = function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } }, function (t, e) { function r(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } t.exports = function (t, e, n) { return e && r(t.prototype, e), n && r(t, n), t } }, function (t, e, r) { "use strict"; r.r(e), r.d(e, "file2b64", (function () { return u })); var n = r(0), i = r.n(n), o = r(1), a = r.n(o); function u(t) { return c.apply(this, arguments) } function c() { return (c = a()(i.a.mark((function t(e) { var r, n; return i.a.wrap((function (t) { for (; ;)switch (t.prev = t.next) { case 0: return r = new FileReader, n = new Promise((function (t) { r.addEventListener("load", (function () { var e = r.result; t(e) }), !1) })), r.readAsDataURL(e), t.abrupt("return", n); case 4: case "end": return t.stop() } }), t) })))).apply(this, arguments) } }, function (t, e, r) { var n = r(7), i = r(8), o = r(9), a = r(11); t.exports = function (t, e) { return n(t) || i(t, e) || o(t, e) || a() } }, function (t, e, r) { "use strict"; r.r(e), r.d(e, "imageCompressor", (function () { return v })); var n = r(5), i = r.n(n), o = r(0), a = r.n(o), u = r(1), c = r.n(u), s = r(2), l = r.n(s), f = r(3), h = r.n(f); var d = !0, p = { prefixString: function () { return "</> quill-image-compress: " }, get log() { return d ? console.log.bind(console, this.prefixString()) : function () { } }, get error() { return console.error.bind(console, this.prefixString()) }, get warn() { return console.warn.bind(console, this.prefixString()) } }, g = r(13).ImageDrop, m = r(4).file2b64, v = function () { function t(e, r) { var n = this; l()(this, t), this.quill = e, this.range = null, this.options = r, d = r && r.debug; var i = function () { var t = c()(a.a.mark((function t(e) { var r; return a.a.wrap((function (t) { for (; ;)switch (t.prev = t.next) { case 0: return p.log("onImageDrop", { dataUrl: e }), t.next = 3, n.downscaleImageFromUrl(e); case 3: r = t.sent, n.insertToEditor(r); case 5: case "end": return t.stop() } }), t) }))); return function (e) { return t.apply(this, arguments) } }(); this.imageDrop = new g(e, i, p), function (t) { t.maxWidth = t.maxWidth || 1e3, t.maxHeight = t.maxHeight || 1e3, t.maxWidth && "number" != typeof t.maxWidth && (p.warn("[config error] 'maxWidth' is required to be a \"number\" (in pixels), \nrecieved: ".concat(t.maxWidth, "\n-> using default 1000")), t.maxWidth = 1e3), t.maxHeight && "number" != typeof t.maxHeight && (p.warn("[config error] 'maxHeight' is required to be a \"number\" (in pixels), \nrecieved: ".concat(t.maxHeight, "\n-> using default 1000")), t.maxHeight = 1e3), t.quality && "number" != typeof t.quality && (p.warn("quill.imageCompressor: [config error] 'quality' is required to be a \"number\", \nrecieved: ".concat(t.quality, "\n-> using default 0.7")), t.quality = .7), !t.imageType || "string" == typeof t.imageType && t.imageType.startsWith("image/") || (p.warn('quill.imageCompressor: [config error] \'imageType\' is required be in the form of "image/png" or "image/jpeg" etc ..., \nrecieved: '.concat(t.imageType, "\n-> using default image/jpeg")), t.imageType = "image/jpeg") }(r), p.log("fileChanged", { options: r, quill: e, debug: d }); var o = this.quill.getModule("toolbar"); o ? o.addHandler("image", (function () { return n.selectLocalImage() })) : p.error("Quill toolbar module not found! need { toolbar: // options } in Quill.modules for image icon to sit in") } var e, r; return h()(t, [{ key: "selectLocalImage", value: function () { var t = this; this.range = this.quill.getSelection(), this.fileHolder = document.createElement("input"), this.fileHolder.setAttribute("type", "file"), this.fileHolder.setAttribute("accept", "image/*"), this.fileHolder.setAttribute("style", "visibility:hidden"), this.fileHolder.onchange = function () { return t.fileChanged() }, document.body.appendChild(this.fileHolder), this.fileHolder.click(), window.requestAnimationFrame((function () { document.body.removeChild(t.fileHolder) })) } }, { key: "fileChanged", value: (r = c()(a.a.mark((function t() { var e, r, n; return a.a.wrap((function (t) { for (; ;
1)switch (t.prev = t.next) { case 0: if (e = this.fileHolder.files[0], p.log("fileChanged", { file: e }), e) { t.next = 4; break } return t.abrupt("return"); case 4: return t.next = 6, m(e); case 6: return r = t.sent, t.next = 9, this.downscaleImageFromUrl(r); case 9: n = t.sent, this.insertToEditor(n); case 11: case "end": return t.stop() } }), t, this) }))), function () { return r.apply(this, arguments) }) }, { key: "downscaleImageFromUrl", value: (e = c()(a.a.mark((function t(e) { var r; return a.a.wrap((function (t) { for (; ;)switch (t.prev = t.next) { case 0: return t.next = 2, y(e, this.options.maxWidth, this.options.maxHeight, this.options.imageType, this.options.quality, this.debug); case 2: return r = t.sent, p.log("downscaleImageFromUrl", { dataUrl: e, dataUrlCompressed: r }), t.abrupt("return", r); case 5: case "end": return t.stop() } }), t, this) }))), function (t) { return e.apply(this, arguments) }) }, { key: "insertToEditor", value: function (t) { p.log("insertToEditor", { url: t }), this.range = this.quill.getSelection(); var e = this.range; this.logFileSize(t), this.quill.insertEmbed(e.index, "image", "".concat(t), "user"), e.index++, this.quill.setSelection(e, "api") } }, { key: "logFileSize", value: function (t) { var e = (Math.round(3 * (t.length - "data:image/png;base64,".length) / 4) / 1024).toFixed(0); p.log("estimated img size: " + e + " kb") } }]), t }(); function y(t, e, r, n, i) { return b.apply(this, arguments) } function b() { return (b = c()(a.a.mark((function t(e, r, n, o, u) { var c, s, l, f, h, g, m; return a.a.wrap((function (t) { for (; ;)switch (t.prev = t.next) { case 0: return o = o || "image/jpeg", u = u || .7, (c = new Image).src = e, t.next = 6, new Promise((function (t) { c.onload = function () { t() } })); case 6: return s = w(c.width, c.height, r, n), l = i()(s, 2), f = l[0], h = l[1], (g = document.createElement("canvas")).width = f, g.height = h, g.getContext("2d").drawImage(c, 0, 0, f, h), m = g.toDataURL(o, u), p.log("downscaling image...", { args: { dataUrl: e, maxWidth: r, maxHeight: n, imageType: o, imageQuality: u, debug: d }, newHeight: h, newWidth: f }), t.abrupt("return", m); case 15: case "end": return t.stop() } }), t) })))).apply(this, arguments) } function w(t, e, r, n) { if (t <= r && e <= n) return [t, e]; if (t > r) { var i = r, o = Math.floor(e / t * i); if (o > n) { var a = n; return [Math.floor(t / e * a), a] } return [i, o] } if (e > n) { var u = n; return [Math.floor(t / e * u), u] } } window.imageCompressor = v, e.default = v }, function (t, e) { t.exports = function (t) { if (Array.isArray(t)) return t } }, function (t, e) { t.exports = function (t, e) { if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) { var r = [], n = !0, i = !1, o = void 0; try { for (var a, u = t[Symbol.iterator](); !(n = (a = u.next()).done) && (r.push(a.value), !e || r.length !== e); n = !0); } catch (t) { i = !0, o = t } finally { try { n || null == u.return || u.return() } finally { if (i) throw o } } return r } } }, function (t, e, r) { var n = r(10); t.exports = function (t, e) { if (t) { if ("string" == typeof t) return n(t, e); var r = Object.prototype.toString.call(t).slice(8, -1); return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? n(t, e) : void 0 } } }, function (t, e) { t.exports = function (t, e) { (null == e || e > t.length) && (e = t.length); for (var r = 0, n = new Array(e); r < e; r++)n[r] = t[r]; return n } }, function (t, e) { t.exports = function () { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") } }, function (t, e, r) { var n = function (t) { "use strict"; var e = Object.prototype, r = e.hasOwnProperty, n = "function" == typeof Symbol ? Symbol : {}, i = n.iterator || "@@iterator", o = n.asyncIterator || "@@asyncIterator", a = n.toStringTag || "@@toStringTag"; function u(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e] } try { u({}, "") } catch (t) { u = function (t, e, r) { return t[e] = r } } function c(t, e, r, n) { var i = e && e.prototype instanceof f ? e : f, o = Object.create(i.prototype), a = new L(n || []); return o._invoke = function (t, e, r) { var n = "suspendedStart"; return function (i, o) { if ("executing" === n) throw new Error("Generator is already running"); if ("completed" === n) { if ("throw" === i) throw o; return k() } for (r.method = i, r.arg = o; ;) { var a = r.delegate; if (a) { var u = w(a, r); if (u) { if (u === l) continue; return u } } if ("next" === r.method) r.sent = r._sent = r.arg; else if ("throw" === r.method) { if ("suspendedStart" === n) throw n = "completed", r.arg; r.dispatchException(r.arg) } else "return" === r.method && r.abrupt("return", r.arg); n = "executing"; var c = s(t, e, r); if ("normal" === c.type) { if (n = r.done ? "completed" : "suspendedYield", c.arg === l) continue; return { value: c.arg, done: r.done } } "throw" === c.type && (n = "completed", r.method = "throw", r.arg = c.arg) } } }(t, r, a), o } function s(t, e, r) { try { return { type: "normal", arg: t.call(e, r) } } catch (t) { return { type: "throw", arg: t } } } t.wrap = c; var l = {}; function f() { } function h() { } function d() { }
vendor: 6,774 bytes, line 1
1 var p = {}; p[i] = function () { return this }; var g = Object.getPrototypeOf, m = g && g(g(j([]))); m && m !== e && r.call(m, i) && (p = m); var v = d.prototype = f.prototype = Object.create(p); function y(t) { ["next", "throw", "return"].forEach((function (e) { u(t, e, (function (t) { return this._invoke(e, t) })) })) } function b(t, e) { var n; this._invoke = function (i, o) { function a() { return new e((function (n, a) { !function n(i, o, a, u) { var c = s(t[i], t, o); if ("throw" !== c.type) { var l = c.arg, f = l.value; return f && "object" == typeof f && r.call(f, "__await") ? e.resolve(f.__await).then((function (t) { n("next", t, a, u) }), (function (t) { n("throw", t, a, u) })) : e.resolve(f).then((function (t) { l.value = t, a(l) }), (function (t) { return n("throw", t, a, u) })) } u(c.arg) }(i, o, n, a) })) } return n = n ? n.then(a, a) : a() } } function w(t, e) { var r = t.iterator[e.method]; if (void 0 === r) { if (e.delegate = null, "throw" === e.method) { if (t.iterator.return && (e.method = "return", e.arg = void 0, w(t, e), "throw" === e.method)) return l; e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method") } return l } var n = s(r, t.iterator, e.arg); if ("throw" === n.type) return e.method = "throw", e.arg = n.arg, e.delegate = null, l; var i = n.arg; return i ? i.done ? (e[t.resultName] = i.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next", e.arg = void 0), e.delegate = null, l) : i : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, l) } function x(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e) } function E(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e } function L(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(x, this), this.reset(!0) } function j(t) { if (t) { var e = t[i]; if (e) return e.call(t); if ("function" == typeof t.next) return t; if (!isNaN(t.length)) { var n = -1, o = function e() { for (; ++n < t.length;)if (r.call(t, n)) return e.value = t[n], e.done = !1, e; return e.value = void 0, e.done = !0, e }; return o.next = o } } return { next: k } } function k() { return { value: void 0, done: !0 } } return h.prototype = v.constructor = d, d.constructor = h, h.displayName = u(d, a, "GeneratorFunction"), t.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === h || "GeneratorFunction" === (e.displayName || e.name)) }, t.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, d) : (t.__proto__ = d, u(t, a, "GeneratorFunction")), t.prototype = Object.create(v), t }, t.awrap = function (t) { return { __await: t } }, y(b.prototype), b.prototype[o] = function () { return this }, t.AsyncIterator = b, t.async = function (e, r, n, i, o) { void 0 === o && (o = Promise); var a = new b(c(e, r, n, i), o); return t.isGeneratorFunction(r) ? a : a.next().then((function (t) { return t.done ? t.value : a.next() })) }, y(v), u(v, a, "Generator"), v[i] = function () { return this }, v.toString = function () { return "[object Generator]" }, t.keys = function (t) { var e = []; for (var r in t) e.push(r); return e.reverse(), function r() { for (; e.length;) { var n = e.pop(); if (n in t) return r.value = n, r.done = !1, r } return r.done = !0, r } }, t.values = j, L.prototype = { constructor: L, reset: function (t) { if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(E), !t) for (var e in this) "t" === e.charAt(0) && r.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = void 0) }, stop: function () { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval }, dispatchException: function (t) { if (this.done) throw t; var e = this; function n(r, n) { return a.type = "throw", a.arg = t, e.next = r, n && (e.method = "next", e.arg = void 0), !!n } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var o = this.tryEntries[i], a = o.completion; if ("root" === o.tryLoc) return n("end"); if (o.tryLoc <= this.prev) { var u = r.call(o, "catchLoc"), c = r.call(o, "finallyLoc"); if (u && c) { if (this.prev < o.catchLoc) return n(o.catchLoc, !0); if (this.prev < o.finallyLoc) return n(o.finallyLoc) } else if (u) { if (this.prev < o.catchLoc) return n(o.catchLoc, !0) } else { if (!c) throw new Error("try statement without catch or finally"); if (this.prev < o.finallyLoc) return n(o.finallyLoc) } } } }, abrupt: function (t, e) { for (var n = this.tryEntries.length - 1; n >= 0; --n) { var i = this.tryEntries[n]; if (i.tryLoc <= this.prev && r.call(i, "finallyLoc") && this.prev < i.finallyLoc) { var o = i; break } } o && ("break" === t || "continue" === t) && o.tryLoc <= e && e <= o.finallyLoc && (o = null); var a = o ? o.completion : {}; return a.type = t, a.arg = e, o ? (this.method = "next", this.next = o.finallyLoc, l) : this.complete(a) }, complete: function (t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), l }, finish: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), E(r), l } }, catch: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var i = n.arg; E(r) } return i } } throw new Error("illegal catch attempt") }, delegateYield: function (t, e, r) { return this.delegate = { iterator: j(t), resultName: e, nextLoc: r }, "next" === this.method && (this.arg = void 0), l } }, t }(t.exports); try { regeneratorRuntime = n } catch (t) { Function("r", "regeneratorRuntime = r")(n) } }, function (t, e, r) { "use strict"; r.r(e), r.d(e, "ImageDrop", (function () { return h })); var n = r(0), i = r.n(n), o = r(1), a = r.n(o), u = r(2), c = r.n(u), s = r(3), l = r.n(s), f = r(4).file2b64, h = function () { function t(e, r, n) { var i = this; c()(this, t), this.logger = n, this.quill = e, this.onNewDataUrl = r, this.quill.root.addEventListener("drop", (function (t) { return i.handleDrop(t) }), !1), this.quill.root.addEventListener("paste", (function (t) { return i.handlePaste(t) }), !1) } var e; return l()(t, [{ key: "handleNewImageFiles", value: (e = a()(i.a.mark((function t(e) { var r, n, o; return i.a.wrap((function (t) { for (; ;
1)switch (t.prev = t.next) { case 0: if (Array.isArray(e)) { t.next = 2; break } return t.abrupt("return"); case 2: if (r = e.pop()) { t.next = 5; break } return t.abrupt("return"); case 5: return n = r.getAsFile ? r.getAsFile() : r, t.next = 8, f(n); case 8: o = t.sent, this.logger.log("handlePaste", { base64ImageSrc: o }), this.onNewDataUrl(o); case 11: case "end": return t.stop() } }), t, this) }))), function (t) { return e.apply(this, arguments) }) }, { key: "handleDrop", value: function (t) { t.preventDefault(); var e = t.dataTransfer && t.dataTransfer.files && t.dataTransfer.files.length; if (this.logger.log("handleDrop", { hasFiles: e }), e) { if (document.caretRangeFromPoint) { var r = document.getSelection(), n = document.caretRangeFromPoint(t.clientX, t.clientY); r && n && r.setBaseAndExtent(n.startContainer, n.startOffset, n.startContainer, n.startOffset) } var i = this.getImageFiles(t.dataTransfer.files); this.handleNewImageFiles(i) } } }, { key: "handlePaste", value: function (t) { var e = t.clipboardData && t.clipboardData.items && !!t.clipboardData.items.length; if (this.logger.log("handlePaste", { hasItems: e }), e) { var r = this.getImageFiles(t.clipboardData.items); 0 !== r.length && (t.preventDefault(), this.handleNewImageFiles(r)) } } }, { key: "getImageFiles", value: function (t) { var e = Array.from(t); return this.logger.log("readFiles", { files: e }), e.filter((function (t) { return !!t.type.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp|vnd\.microsoft\.icon)/i) })) || [] } }]), t }() }]) }));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.