/** PTNovelSearch-v4.1.2 LPPL License By http://www.ptcms.com/ */ ;!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Cropper=i()}(this,function(){"use strict";function t(i){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(i)}function i(t,i){for(var e=0;et.width?3===e?r=t.height*h:s=t.width/h:3===e?s=t.width/h:r=t.height*h;var c={aspectRatio:h,naturalWidth:n,naturalHeight:o,width:r,height:s};c.left=(t.width-r)/2,c.top=(t.height-s)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===e||2===e,this.limitCanvas(!0,!0),this.initialImageData=xt({},i),this.initialCanvasData=xt({},c)},limitCanvas:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=e.viewMode,r=n.aspectRatio,s=this.cropped&&o;if(t){var c=Number(e.minCanvasWidth)||0,d=Number(e.minCanvasHeight)||0;1=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,m),n.maxTop=Math.max(0,m))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,i){var e=this.canvasData,a=this.imageData;if(i){var n=function(t){var i=t.width,e=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:e,height:i};var n=a%90*Math.PI/180,o=Math.sin(n),h=Math.cos(n),r=i*h+e*o,s=i*o+e*h;return 90e.maxWidth||e.widthe.maxHeight||e.heighti.width?n.height=n.width/e:n.width=n.height*e),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=i.left+(i.width-n.width)/2,n.top=i.top+(i.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=xt({},n)},limitCropBox:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=this.limited,r=e.aspectRatio;if(t){var s=Number(e.minCropBoxWidth)||0,c=Number(e.minCropBoxHeight)||0,d=h?Math.min(a.width,n.width,n.width+n.left,a.width-n.left):a.width,l=h?Math.min(a.height,n.height,n.height+n.top,a.height-n.top):a.height;s=Math.min(s,a.width),c=Math.min(c,a.height),r&&(s&&c?se.maxWidth||e.widthe.maxHeight||e.height=i.width&&e.height>=i.height?L:N),d(this.cropBox,xt({width:e.width,height:e.height},C({translateX:e.left,translateY:e.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),b(this.element,tt,this.getData())}},Lt={initPreview:function(){var t=this.crossOrigin,i=this.options.preview,e=t?this.crossOriginUrl:this.url,a=document.createElement("img");if(t&&(a.crossOrigin=t),a.src=e,this.viewBox.appendChild(a),this.viewBoxImage=a,i){var n=i;"string"==typeof i?n=this.element.ownerDocument.querySelectorAll(i):i.querySelector&&(n=[i]),s(this.previews=n,function(i){var a=document.createElement("img");f(i,G,{width:i.offsetWidth,height:i.offsetHeight,html:i.innerHTML}),t&&(a.crossOrigin=t),a.src=e,a.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',i.innerHTML="",i.appendChild(a)})}},resetPreview:function(){s(this.previews,function(t){var i=u(t,G);d(t,{width:i.width,height:i.height}),t.innerHTML=i.html,function(t,i){if(o(t[i]))try{delete t[i]}catch(e){t[i]=void 0}else if(t.dataset)try{delete t.dataset[i]}catch(e){t.dataset[i]=void 0}else t.removeAttribute("data-".concat(g(i)))}(t,G)})},preview:function(){var t=this.imageData,i=this.canvasData,e=this.cropBoxData,a=e.width,n=e.height,o=t.width,h=t.height,r=e.left-i.left-t.left,c=e.top-i.top-t.top;this.cropped&&!this.disabled&&(d(this.viewBoxImage,xt({width:o,height:h},C(xt({translateX:-r,translateY:-c},t)))),s(this.previews,function(i){var e=u(i,G),s=e.width,l=e.height,p=s,m=l,g=1;a&&(m=n*(g=s/a)),n&&lb&&(T.x=b-u);break;case Y:d+T.xy&&(T.y=y-f)}};switch(r){case N:d+=T.x,l+=T.y;break;case z:if(0<=T.x&&(b<=u||c&&(l<=w||y<=f))){M=!1;break}E(z),(m+=T.x)<0&&(r=Y,d-=m=-m),c&&(g=m/c,l+=(o.height-g)/2);break;case R:if(T.y<=0&&(l<=w||c&&(d<=v||b<=u))){M=!1;break}E(R),g-=T.y,l+=T.y,g<0&&(r=X,l-=g=-g),c&&(m=g*c,d+=(o.width-m)/2);break;case Y:if(T.x<=0&&(d<=v||c&&(l<=w||y<=f))){M=!1;break}E(Y),m-=T.x,d+=T.x,m<0&&(r=z,d-=m=-m),c&&(g=m/c,l+=(o.height-g)/2);break;case X:if(0<=T.y&&(y<=f||c&&(d<=v||b<=u))){M=!1;break}E(X),(g+=T.y)<0&&(r=R,l-=g=-g),c&&(m=g*c,d+=(o.width-m)/2);break;case S:if(c){if(T.y<=0&&(l<=w||b<=u)){M=!1;break}E(R),g-=T.y,l+=T.y,m=g*c}else E(R),E(z),0<=T.x?u or element.");this.element=i,this.options=xt({},vt,h(e)&&e),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var a,n,o;return a=t,o=[{key:"noConflict",value:function(){return window.Cropper=Rt,t}},{key:"setDefaults",value:function(t){xt(vt,h(t)&&t)}}],(n=[{key:"init",value:function(){var t,i=this.element,e=i.tagName.toLowerCase();if(!i[W]){if(i[W]=this,"img"===e){if(this.isImg=!0,t=i.getAttribute("src")||"",!(this.originalUrl=t))return;t=i.src}else"canvas"===e&&window.HTMLCanvasElement&&(t=i.toDataURL());this.load(t)}}},{key:"load",value:function(t){var i=this;if(t){this.url=t,this.imageData={};var e=this.element,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(gt.test(t))ut.test(t)?this.read((n=t.replace(Nt,""),o=atob(n),h=new ArrayBuffer(o.length),s(r=new Uint8Array(h),function(t,i){r[i]=o.charCodeAt(i)}),h)):this.clone();else{var n,o,h,r,c=new XMLHttpRequest,d=this.clone.bind(this);this.reloading=!0,(this.xhr=c).ontimeout=d,c.onabort=d,c.onerror=d,c.onprogress=function(){c.getResponseHeader("content-type")!==pt&&c.abort()},c.onload=function(){i.read(c.response)},c.onloadend=function(){i.reloading=!1,i.xhr=null},a.checkCrossOrigin&&y(t)&&e.crossOrigin&&(t=M(t)),c.open("GET",t),c.responseType="arraybuffer",c.withCredentials="use-credentials"===e.crossOrigin,c.send()}else this.clone()}}},{key:"read",value:function(t){var i=this.options,a=this.imageData,n=k(t),o=0,h=1,r=1;if(1
';var o=n.querySelector(".".concat(W,"-container")),h=o.querySelector(".".concat(W,"-canvas")),s=o.querySelector(".".concat(W,"-drag-box")),c=o.querySelector(".".concat(W,"-crop-box")),d=c.querySelector(".".concat(W,"-face"));this.container=a,this.cropper=o,this.canvas=h,this.dragBox=s,this.cropBox=c,this.viewBox=o.querySelector(".".concat(W,"-view-box")),this.face=d,h.appendChild(e),l(t,q),a.insertBefore(o,t.nextSibling),this.isImg||p(e,$),this.initPreview(),this.bind(),i.initialAspectRatio=Math.max(0,i.initialAspectRatio)||NaN,i.aspectRatio=Math.max(0,i.aspectRatio)||NaN,i.viewMode=Math.max(0,Math.min(3,Math.round(i.viewMode)))||0,l(c,q),i.guides||l(c.getElementsByClassName("".concat(W,"-dashed")),q),i.center||l(c.getElementsByClassName("".concat(W,"-center")),q),i.background&&l(o,"".concat(W,"-bg")),i.highlight||l(d,Q),i.cropBoxMovable&&(l(d,F),f(d,K,N)),i.cropBoxResizable||(l(c.getElementsByClassName("".concat(W,"-line")),q),l(c.getElementsByClassName("".concat(W,"-point")),q)),this.render(),this.ready=!0,this.setDragMode(i.dragMode),i.autoCrop&&this.crop(),this.setData(i.data),r(i.ready)&&w(t,st,i.ready,{once:!0}),b(t,st)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),p(this.element,q))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}])&&i(a.prototype,n),o&&i(a,o),t}();return xt(St.prototype,Ht,Lt,Ot,zt,Yt,Xt),St});