(function(){function e(t,r,n){function i(o,l){if(!r[o]){if(!t[o]){var u="function"==typeof require&&require;if(!l&&u)return u(o,!0);if(a)return a(o,!0);var s=new Error("Cannot find module '"+o+"'");throw s.code="MODULE_NOT_FOUND",s}var f=r[o]={exports:{}};t[o][0].call(f.exports,function(e){var r=t[o][1][e];return i(r||e)},f,f.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}return e})()({1:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n=i(e("./utils"));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function l(e,t,r){if(t)o(e.prototype,t);if(r)o(e,r);return e}var u=function(){function e(t,r){a(this,e);this.dataUrl=t;this.type=r}l(e,[{key:"minify",value:function t(){var r=this;var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new Promise(function(t,i){var a=n.maxWidth||800;var o=n.maxHeight||800;var l=n.quality||.8;if(!r.dataUrl){return i({message:"[error] QuillImageDropAndPaste: Fail to minify the image, dataUrl should not be empty."})}var u=new Image;u.onload=function(){var n=u.width;var i=u.height;if(n>i){if(n>a){u.height=i*a/n;u.width=a}}else{if(i>o){u.width=n*o/i;u.height=o}}var s=document.createElement("canvas");s.width=u.width;s.height=u.height;var f=s.getContext("2d");f.drawImage(u,0,0,u.width,u.height);var d=r.type||"image/png";var h=s.toDataURL(d,l);t(new e(h,d))};u.src=r.dataUrl})}},{key:"toFile",value:function e(t){if(!window.File){console.error("[error] QuillImageDropAndPaste: Your browser didnot support File API.");return null}return new File([this.toBlob()],t,{type:this.type})}},{key:"toBlob",value:function e(){var t=this.dataUrl.replace(/^[^,]+,/,"");var r=this.binaryStringToArrayBuffer(atob(t));return this.createBlob([r],{type:this.type})}},{key:"binaryStringToArrayBuffer",value:function e(t){var r=t.length;var n=new ArrayBuffer(r);var i=new Uint8Array(n);var a=-1;while(++a<r){i[a]=t.charCodeAt(a)}return n}},{key:"createBlob",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(typeof r==="string")r={type:r};try{return new Blob(t,r)}catch(e){if(e.name!=="TypeError")throw e;var n=typeof BlobBuilder!=="undefined"?BlobBuilder:typeof MSBlobBuilder!=="undefined"?MSBlobBuilder:typeof MozBlobBuilder!=="undefined"?MozBlobBuilder:WebKitBlobBuilder;var i=new n;for(var a=0;a<t.length;a++){i.append(t[a])}return i.getBlob(r.type)}}}]);return e}();var s=function(){function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};a(this,e);this.quill=t;this.options=r;this.handleDrop=this.handleDrop.bind(this);this.handlePaste=this.handlePaste.bind(this);this.insert=this.insert.bind(this);this.quill.root.addEventListener("drop",this.handleDrop,false);this.quill.root.addEventListener("paste",this.handlePaste,false)}l(e,[{key:"handleDrop",value:function e(t){var r=this;t.preventDefault();if(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length){if(document.caretRangeFromPoint){var n=document.getSelection();var i=document.caretRangeFromPoint(t.clientX,t.clientY);if(n&&i){n.setBaseAndExtent(i.startContainer,i.startOffset,i.startContainer,i.startOffset)}}this.readFiles(t.dataTransfer.files,function(e,t){t=t||"image/png";if(typeof r.options.handler==="function"){r.options.handler.call(r,e,t,new u(e,t))}else{r.insert.call(r,e,t)}},t)}}},{key:"handlePaste",value:function e(t){
                                var r=this;
                                if(t.clipboardData&&t.clipboardData.items&&t.clipboardData.items.length){
                                    console.log(t.clipboardData.items);
                                    this.readFiles(t.clipboardData.items,function(e,t){
                                                                                    console.log("fgunkton");

                                        t=t||"image/png";
                                        if(typeof r.options.handler==="function"){
                                            r.options.handler.call(r,e,t,new u(e,t))
                                        }else{
                                            r.insert(e,"image")}},t)}
                            }
                        },{key:"readFiles",value:function e(t,r,i){i.preventDefault();var a=this;Array.prototype.forEach.call(t,function(e){var t=e.type;if(t.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp)/i)){var i=new FileReader;i.onload=function(e){r(e.target.result,t)};var o=e.getAsFile?e.getAsFile():e;if(o instanceof Blob)i.readAsDataURL(o)}else if(t.match(/^text\/plain$/i)){e.getAsString(function(e){n["default"].urlIsImage(e).then(function(){a.insert(e,"image")})["catch"](function(){a.insert(e,"text")})})}})}},{key:"insert",value:function e(t,r){var n=(this.quill.getSelection(true)||{}).index;if(n===undefined||n<0)n=this.quill.getLength();if(r==="image"){this.quill.insertEmbed(n,r,t,"user")}else if(r==="text"){this.quill.insertText(n,t,"user")}}}]);return e}();s.ImageData=u;window.QuillImageDropAndPaste=s;if("Quill"in window){window.Quill.register("modules/imageDropAndPaste",s)}var f=s;r["default"]=f},{"./utils":2}],2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n={hash:function e(t){var r="abcdefghijklmnopqrstuvwxyz0123456789";var n=r.length;var i=[];while(t--){i.push(r[Math.floor(Math.random()*n)])}return i.join("")},urlIsImage:function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:3e3;if(!this.validURL(t)){return Promise.reject(false)}if(/\.(jpeg|jpg|gif|png|webp|tiff|bmp)$/.test(t)){return Promise.resolve(true)}return new Promise(function(e,n){var i,a=new Image;a.onerror=a.onabort=function(){clearTimeout(i);n(false)};a.onload=function(){clearTimeout(i);e(true)};i=setTimeout(function(){a.src="//!/an/invalid.jpg";n(false)},r);a.src=t})},validURL:function e(t){try{return Boolean(new URL(t))}catch(e){return false}}};r["default"]=n},{}]},{},[1]);
