UNPKG

touchkit

Version:

a touch kit based on mtouch,it make you create a gesture app more quickly and simply

4 lines (3 loc) 39 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Touchkit=e()}(this,function(){"use strict";function t(){var t=document.createElement("style");return t.type="text/css",document.head.appendChild(t),t.sheet}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(!(this instanceof i))return new i(t);this.use={drag:!1,pinch:!1,rotate:!1,singlePinch:!1,singleRotate:!1},this.operator=this.el=l.getEl(t),this.draging=this.pinching=this.rotating=this.singlePinching=this.singleRotating=!1,this.fingers=0,this.startScale=1,this.startPoint={},this.secondPoint={},this.pinchStartLength=null,this.singlePinchStartLength=null,this.vector1={},this.singleBasePoint={},this._css(),this._driveBus(),this._bind()}function o(t,e,i){if(!(this instanceof o))return new o(t,e,i);this.ops={width:t||500,height:e||t,background:i},this.canvas=null,this.ctx=null,this.queue=[],this.end=null,this.textData={},this.bgConfig=null,this._init()}function n(){var t=document.createElement("style");return t.type="text/css",document.head.appendChild(t),t.sheet}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t){var e=this;if(!(this instanceof r))return new r(t);this._ops={el:null,use:{drag:!1,pinch:!1,rotate:!1,singlePinch:!1,singleRotate:!1},limit:!1,event:{}},_.map(function(t){return e._ops.event[t]=P}),"object"==(void 0===t?"undefined":S(t))?this._ops=b.extend(this._ops,t):"string"==typeof t&&(this._ops.el=t),this.el=b.getEl(this._ops.el),b.addClass(this.el,"mt-touch-box"),this.elStatus={width:this.el.clientWidth||this.el.offsetWidth,height:this.el.clientHeight||this.el.offsetHeight},this.mt=i(this.el),this._insertCss()._init()._bind()}var a="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},h="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(t){return void 0===t?"undefined":a(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":a(t)},c=void 0,l={getLength:function(t){return"object"!==(void 0===t?"undefined":h(t))?void console.error("getLength error!"):Math.sqrt(t.x*t.x+t.y*t.y)},getAngle:function(t,e){if("object"!==(void 0===t?"undefined":h(t))||"object"!==(void 0===e?"undefined":h(e)))return void console.error("getAngle error!");var i=t.x*e.y-e.x*t.y>0?1:-1,o=this.getLength(t),n=this.getLength(e),s=o*n,r=void 0,a=void 0;return 0===s?0:(r=t.x*e.x+t.y*e.y,a=r/s,a>1&&(a=1),a<-1&&(a=-1),Math.acos(a)*i*180/Math.PI)},getBasePoint:function(t){if(!t)return{x:0,y:0};var e=this.getOffset(t),i=e.left+t.getBoundingClientRect().width/2,o=e.top+t.getBoundingClientRect().width/2;return{x:Math.round(i),y:Math.round(o)}},extend:function(t,e){for(var i in e)e.hasOwnProperty(i)&&("object"!=h(e[i])||e[i]instanceof Node?t[i]=e[i]:("object"!==h(t[i])&&(t[i]={}),this.extend(t[i],e[i])));return t},getVector:function(t,e){return"object"!==(void 0===t?"undefined":h(t))||"object"!==(void 0===e?"undefined":h(e))?void console.error("getvector error!"):{x:Math.round(t.x-e.x),y:Math.round(t.y-e.y)}},getPoint:function(t,e){return t&&t.touches[e]?{x:Math.round(t.touches[e].pageX),y:Math.round(t.touches[e].pageY)}:void console.error("getPoint error!")},getOffset:function(t){t="string"==typeof t?document.querySelector(t):t;var e=t.getBoundingClientRect();return{left:e.left+document.body.scrollLeft,top:e.top+document.body.scrollTop,width:t.offsetWidth,height:t.offsetHeight}},matrixTo:function(t){var e=t.replace("matrix(","").replace(")","").split(","),i=e[0],o=e[1],n=o/i,s=180*Math.atan(n)/Math.PI,r=i/Math.cos(Math.PI/180*s);return{x:parseInt(e[4]),y:parseInt(e[5]),scale:r,rotate:s}},getUseName:function(t){var e=t.replace("start",""),i=-1!==e.indexOf("rotate")?"nd":"end";return e=e.replace(i,"")},domify:function(t){var e=document.implementation.createHTMLDocument();return e.body.innerHTML=t,e.body.children},getEl:function(t){if(!t)return void console.error("el error,there must be a el!");var e=void 0;if("string"==typeof t)e=document.querySelector(t);else{if(!(t instanceof Node))return void console.error("el error,there must be a el!");e=t}return e},data:function(t,e){return t=this.getEl(t),t.getAttribute("data-"+e)},include:function(t,e){return!!t.indexOf&&-1!==t.indexOf(e)},getPos:function(t){if(t){t=this.getEl(t);var e=void 0,i=window.getComputedStyle(t,null),o=i.transform||i.webkitTransform;return e=window.getComputedStyle&&"none"!==o?this.matrixTo(o):{x:0,y:0,scale:1,rotate:0},JSON.parse(t.getAttribute("data-mtouch-status"))||e}},addCssRule:function(e,i){c||(c=t()),c.insertRule(e+"{"+i+"}",c.rules.length)}},d=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),u=function(){function t(i){e(this,t),this.handlers=[],this.el=i}return d(t,[{key:"add",value:function(t){return this.handlers.push(t),this}},{key:"del",value:function(t){var e=this;return t?this.handlers.forEach(function(i,o){i===t&&e.handlers.splice(o,1)}):this.handlers=[],this}},{key:"fire",value:function(){var t=this,e=arguments;if(this.handlers&&0!==!this.handlers.length)return this.handlers.forEach(function(i){"function"==typeof i&&i.apply(t.el,e)}),this}}]),t}(),p=["touchstart","touchmove","touchend","drag","dragstart","dragend","pinch","pinchstart","pinchend","rotate","rotatestart","rotatend","singlePinchstart","singlePinch","singlePinchend","singleRotate","singleRotatestart","singleRotatend"],f=["touchstart","touchmove","touchend","touchcancel"];i.prototype._driveBus=function(){var t=this;p.forEach(function(e){t[e]=new u(t.el)})},i.prototype._bind=function(){var t=this;f.forEach(function(e){var i="touchcancel"==e?"end":e.replace("touch","");t["_"+i+"_bind"]=t["_"+i].bind(t),t.el.addEventListener(e,t["_"+i+"_bind"],!1)})},i.prototype.destroy=function(){var t=this;f.forEach(function(e){var i="touchcancel"==e?"end":e.replace("touch","");t.el.removeEventListener(e,t["_"+i+"_bind"],!1)})},i.prototype._start=function(t){if(t.touches&&"touchstart"===t.type){if(this.fingers=t.touches.length,this.startPoint=l.getPoint(t,0),this.singleBasePoint=l.getBasePoint(this.operator),this.fingers>1)this.secondPoint=l.getPoint(t,1),this.vector1=l.getVector(this.secondPoint,this.startPoint),this.pinchStartLength=l.getLength(this.vector1);else if(this.use.singlePinch){var e=l.getVector(this.startPoint,this.singleBasePoint);this.singlePinchStartLength=l.getLength(e)}this.touchstart.fire({origin:t,eventType:"touchstart"})}},i.prototype._move=function(t){if(t.touches&&"touchmove"===t.type){var e=l.data(t.target,"singleButton"),i=t.touches.length,o=l.getPoint(t,0),n=void 0,s=void 0,r=void 0,a=void 0,h=void 0;if(i<this.fingers)return this.startPoint=o,void(this.fingers=i);if(!(i>1)||this.secondPoint&&this.vector1&&this.pinchStartLength||(this.secondPoint=l.getPoint(t,1),this.vector1=l.getVector(this.secondPoint,this.startPoint),this.pinchStartLength=l.getLength(this.vector1)),i>1){var c=l.getPoint(t,1),d=l.getVector(c,o);this.use.pinch&&(s=l.getLength(d),this._eventFire("pinch",{delta:{scale:s/this.pinchStartLength},origin:t}),this.pinchStartLength=s),this.use.rotate&&(this._eventFire("rotate",{delta:{rotate:l.getAngle(this.vector1,d)},origin:t}),this.vector1=d)}else this.use.singlePinch&&e&&(h=l.getVector(o,this.singleBasePoint),n=l.getLength(h),this._eventFire("singlePinch",{delta:{scale:n/this.singlePinchStartLength,deltaX:o.x-this.startPoint.x,deltaY:o.y-this.startPoint.y},origin:t}),this.singlePinchStartLength=n),this.use.singleRotate&&e&&(r=l.getVector(this.startPoint,this.singleBasePoint),a=l.getVector(o,this.singleBasePoint),this._eventFire("singleRotate",{delta:{rotate:l.getAngle(r,a)},origin:t}));this.use.drag&&(e||this._eventFire("drag",{delta:{deltaX:o.x-this.startPoint.x,deltaY:o.y-this.startPoint.y},origin:t})),this.startPoint=o,this.touchmove.fire({eventType:"touchmove",origin:t}),t.preventDefault()}},i.prototype._end=function(t){var e=this;(t.touches||"touchend"===t.type||"touchcancel"===t.type)&&(["pinch","drag","rotate","singleRotate","singlePinch"].forEach(function(i){e._eventEnd(i,{origin:t})}),this.touchend.fire({eventType:"touchend",origin:t}))},i.prototype._eventFire=function(t,e){var i=t+"ing",o=t+"start";this[i]?(e.eventType=t,this[t].fire(e)):(e.eventType=o,this[o].fire(e),this[i]=!0)},i.prototype._eventEnd=function(t,e){var i=t+"ing",o=void 0;o="rotate"==t||"singleRotate"==t?t+"nd":t+"end",this[i]&&(e.eventType=o,this[o].fire(e),this[i]=!1)},i.prototype._addButton=function(t){var e=l.domify("<div class=\"mtouch-singleButton\" data-singleButton='true'></div>")[0];t.appendChild(e),t.setAttribute("data-mtouch-addButton",!0)},i.prototype.switch=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=void 0;if(!t)return void(this.operator=this.el);this.operator=i=l.getEl(t),!l.data(i,"mtouch-addButton")&&(this.use.singleRotate||this.use.singlePinch)&&e&&this._addButton(i)},i.prototype.on=function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},o=arguments[2];return l.include(t," ")?t.split(" ").forEach(function(t){e._on(t,i,o)}):this._on(t,i,o),this},i.prototype._on=function(t,e,i){this.use[l.getUseName(t)]=!0,this[t].add(e),this.switch(i)},i.prototype.off=function(t,e){this[t].del(e)},i.prototype._css=function(){l.addCssRule(".mtouch-singleButton","z-index:9999;position:absolute;right:-15px;bottom: -15px;width:30px;height: 30px;background-size: 100% 100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTMyIDc5LjE1OTI4NCwgMjAxNi8wNC8xOS0xMzoxMzo0MCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUuNSAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo3QUY3RkU4M0E5OEIxMUU2QjU0QTkxRjBDMUE2RDg3NCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3QUY3RkU4NEE5OEIxMUU2QjU0QTkxRjBDMUE2RDg3NCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjdBRjdGRTgxQTk4QjExRTZCNTRBOTFGMEMxQTZEODc0IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjdBRjdGRTgyQTk4QjExRTZCNTRBOTFGMEMxQTZEODc0Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+ckj5SQAAA5tJREFUeNrsm0tIVUEYx7+TSuHVIk2sjfTQTaQLo425KXq3yF7gwrASwozKVmG0DNoElUQgYRQECT0JKum1SjeRkFaLnuAmpCxIrxkit//X/W7dpOu9Z+acmSOeD34oepn5fs6Z15nRicViNJ1iBk2zCIVD4VB4akd2ql/UnvGk/CJQBSpBKVgE5oE8+f0w+AI+gnegB3TJz7Sio9mlsEYUgO1COXAm+WyesBCskp/xPNkHbghfjbSwQhSDw/xwgFka5fAfqEJoAVdBKxgISh/OAU3gKditKTsxuKw9UnaT1GVVmPvkXXAcRHwcayJSx31QZkt4HegEywwOskvBPanbqHA9aAf5FmaWiNRdb0q4DpwEWRan0yzJoc5v4Q1SUVCCc1nvlzAPUGctt+z/WrpVcvNUmKeDNkt9Nl3kS27ZXgrvNzwauw3ObZ9XK635oDmDteuCdJ+5/YyGOrp+r5/9iCOyFB3QbeFGL1ZPPssmpqtG3Ue6QGXotyCbiF1gro7wDpCrKTtsSJYk1506wtu0n7OZ5DhmB7CtqsJFsp/VirUVFNm7mmYblK6QlwyuhavSbN4n7bMPeylqSdqR3F1PS5U6A5STJJv89eIT+m7g1f9ycMdtC5epyibe07CcpZYuVXmkS3SnHovSJSrChW5qSDX1WJIuVBHO9ar2hPSjPmPSuX684nEt3f7YqLRr4ZEpLD2iIjwYlJauXel6Hz6oItwfhMebZWtW/DmayTT6VYTf2u7TirIc71RWWj2mBjL+fk35vyuy6E+KKcpyPFcR7pacHFvSGkV2qzzSnyl+imdlytKIXprkuDXdPHzT5DwdHSUv9hW3dF4AXAc/TAjzALVFvc8mgnO9piPMh9EdJmRr9GVJcv2mI8xxDoxOAVnu/63pPpTJe+lPFD9iOeqHMHZZvK0c8qCo05TBLYFMNw/nwWsKbrwCF3Q3D8kxRvErB9EAynJOByRHz4Q53oBDYDxAspzLQcmNvBbm4DsWLQES5lw6vdoPp4orUtG45ZZtkVzIb2GOy6CByNgRysQ+2yA5kClhjgcUvwLx0qAszxSbpG4yLczxAWwGJ3wewaNSx0bdfboXL/HGZJ6uBpc8XpWNSpnVUseYboFe3rXkVc4xcIriR5Z8ipfucmmqjVOv7NQCfbk0ecPRJhRL6/CJ3hKwGMyh+A3aHPp7fZi7xnvwguLXhwf86htO+F8toXAoHAqHwgGOXwIMAGwpGJYKZlZqAAAAAElFTkSuQmCC);")};var g="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},m="function"==typeof Symbol&&"symbol"===g(Symbol.iterator)?function(t){return void 0===t?"undefined":g(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":g(t)},v={extend:function(t,e){for(var i in e)e.hasOwnProperty(i)&&("object"==m(e[i])?("object"===m(t[i])&&null!==t[i]||(t[i]={}),this.extend(t[i],e[i])):t[i]=e[i]);return t},loadImage:function(t,e,i){var o=new Image;0==t.indexOf("http")&&(o.crossOrigin="*"),o.onload=function(){e(o)},o.onerror=function(){i("img load error")},o.src=t},isArr:function(t){return"[object Array]"===Object.prototype.toString.call(t)},getImage:function(t,e){if("string"==typeof t)this.loadImage(t,function(t){e(t)},function(t){console.log(t)});else{if("object"!=(void 0===t?"undefined":m(t)))return void console.log("add image error");e(t)}},forin:function(t,e){for(var i in t)t.hasOwnProperty(i)&&e(i,t[i])}};o.prototype._init=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.ops.width,this.canvas.height=this.ops.height,this.ctx=this.canvas.getContext("2d"),this.ops.background&&(this.ctx.fillStyle=this.ops.background,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height))},o.prototype.background=function(t){var e=this;if(t)this.bgConfig=t;else{if(!this.bgConfig)return void console.error("mcanvas error : the init background must has the bg option params.");t=this.bgConfig}return this.queue.push(function(){t.color&&(e.ctx.fillStyle=t.color,e.ctx.fillRect(0,0,e.canvas.width,e.canvas.height)),t.image?v.getImage(t.image,function(i){e._background(i,t)}):console.error("mcanvas error : background image error!")}),this},o.prototype._background=function(t,e){var i=this._getSize(t),o=i.iw,n=i.ih,s=o/n,r=this.canvas.width/this.canvas.height,a=void 0,h=void 0,c=void 0,l=void 0,d=void 0,u=void 0,p=void 0,f=void 0;switch(e.type){case"crop":a=e.left||0,h=e.top||0,s>r?(c=n*r,l=n):(c=o,l=c/r),u=d=0,f=this.canvas.height,p=this.canvas.width;break;case"contain":h=a=0,c=o,l=n,s>r?(p=this.canvas.width,f=p/s,d=e.left||0,u=e.top||0==e.top?e.top:(this.canvas.height-f)/2):(f=this.canvas.height,p=f*s,u=e.top||0,d=e.left||0==e.left?e.left:(this.canvas.width-p)/2);break;case"origin":this.canvas.width=o,this.canvas.height=n,a=h=0,c=o,l=n,d=u=0,p=this.canvas.width,f=this.canvas.height;break;default:console.error("mcanvas error:background type error!")}this.ctx.drawImage(t,a,h,c,l,d,u,p,f),this._next()},o.prototype.watermark=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments[1];if(!t)return void console.error("mcanvas error : there is not image of watermark.");var i=e.width,o=void 0===i?"40%":i,n=e.pos,s=void 0===n?"rightbottom":n,r=e.margin,a=void 0===r?20:r,h={x:0,y:0,scale:1,rotate:0};switch(s){case"leftTop":h.x="left:"+a,h.y="top:"+a;break;case"leftBottom":h.x="left:"+a,h.y="bottom:"+a;break;case"rightTop":h.x="right:"+a,h.y="top:"+a;break;case"rightBottom":h.x="right:"+a,h.y="bottom:"+a}return this.add(t,{width:o,pos:h}),this},o.prototype.add=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments[1],o={width:"100%",crop:{x:0,y:0,width:"100%",height:"100%"},pos:{x:0,y:0,scale:1,rotate:0}};return v.isArr(e)||(e=[{image:e,options:i}]),e.forEach(function(e){t.queue.push(function(){v.getImage(e.image,function(i){t._add(i,t._handleOps(v.extend(o,e.options),i))})})}),this},o.prototype._add=function(t,e){var i=this._getSize(t),o=i.iw,n=i.ih,s=o/n,r=void 0,a=void 0,h=void 0,c=void 0,l=e.crop,d=l.x,u=l.y,p=l.width,f=l.height,g=void 0,m=void 0,v=void 0,y=void 0,x=document.createElement("canvas"),b=x.getContext("2d"),w=o>n?o/n:n/o,A=1.4*w>5?5:1.4*w,S=void 0,_=void 0;x.width=o*A,x.height=n*A,g=-o/2,m=-n/2,v=o,y=n,b.translate(x.width/2,x.height/2),b.rotate(e.pos.rotate),b.drawImage(t,d,u,p,f,g,m,v,y),h=e.width*A,c=h/s,S=(A-1)*e.width/2,_=S/s,r=e.pos.x+h*(1-e.pos.scale)/2-S,a=e.pos.y+c*(1-e.pos.scale)/2-_,h*=e.pos.scale,c*=e.pos.scale,this.ctx.drawImage(x,r,a,h,c),x=b=null,this._next()},o.prototype._getSize=function(t){var e=void 0,i=void 0;return"IMG"===t.tagName?(e=t.naturalWidth,i=t.naturalHeight):"CANVAS"===t.tagName?(e=t.width,i=t.height):(e=t.offsetWidth,i=t.offsetHeight),{iw:e,ih:i}},o.prototype._handleOps=function(t,e){var i=this.canvas.width,o=this.canvas.height,n=this._getSize(e),s=n.iw,r=n.ih,a=s/r,h=this._get(i,s,t.width,"pos"),c=void 0,l=void 0,d=t.crop,u=d.x,p=d.y,f=d.width,g=d.height,m={x:this._get(i,s,u,"crop"),y:this._get(o,r,p,"crop"),width:this._get(i,s,f,"crop"),height:this._get(o,r,g,"crop")};m.x>s&&(m.x=s),m.y>r&&(m.y=r),c=s-m.x,l=r-m.y,m.width>c&&(m.width=c),m.height>l&&(m.height=l);var v=t.pos,y=v.x,x=v.y,b=v.rotate,w=v.scale;return{width:h,crop:m,pos:{x:this._get(i,h,y,"pos"),y:this._get(o,h/a,x,"pos"),scale:w,rotate:parseFloat(b)*Math.PI/180}}},o.prototype.text=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments[1],o="helvetica neue,hiragino sans gb,Microsoft YaHei,arial,tahoma,sans-serif",n=this.canvas.width/20;return this.queue.push(function(){var s={width:300,align:"left",smallStyle:{font:.8*n+"px "+o,color:"#000",lineheight:.9*n},normalStyle:{font:n+"px "+o,color:"#000",lineheight:1.1*n},largeStyle:{font:1.3*n+"px "+o,color:"#000",lineheight:1.4*n},pos:{x:0,y:0}};s=v.extend(s,i),t._text(t._parse(e),s),t._next()}),this},o.prototype._parse=function(t){for(var e=t.split(/<s>|<b>/),i=[],o=0;o<e.length;o++){var n=e[o];if(/<\/s>|<\/b>/.test(n)){var s=/<\/s>/.test(n)?"</s>":"</b>",r=/<\/s>/.test(n)?"small":"large",a=e[o].split(s);i.push({type:r,text:a[0]}),a[1]&&i.push({type:"normal",text:a[1]})}else e[o]&&i.push({text:e[o],type:"normal"})}return i},o.prototype._text=function(t,e){var i=this;e.width=this._get(this.canvas.width,0,e.width,"pos");var o=void 0,n=1,s=0,r=function(t,e){var i=0,o=void 0;return t.forEach(function(t){(o=e[t.type+"Style"].lineheight)>i&&(i=o)}),i}(t,e),a=this._get(this.canvas.width,e.width,e.pos.x,"pos"),h=this._get(this.canvas.height,0,e.pos.y,"pos")+r;this.textData[n]={data:[],lineWidth:0},t.forEach(function(t){o=e[t.type+"Style"],i.ctx.font=o.font;var c=i.ctx.measureText(t.text).width,l=t.text.replace(/<br>/g,"|");if(s+c>e.width||-1!==l.indexOf("|"))for(var d=0,u=l.length;d<u;d++){var p=l[d];c=i.ctx.measureText(p).width,(s+c>e.width||"|"==p)&&(s=0,a=i._get(i.canvas.width,e.width,e.pos.x,"pos"),h+=r,n+=1,i.textData[n]={data:[],lineWidth:0},"|"==p)||(i.textData[n].data.push({context:p,x:a,y:h,style:o,width:c}),s+=c,a+=c,i.textData[n].lineWidth=s)}else i.textData[n].data.push({context:l,x:a,y:h,style:o,width:c}),s+=c,a+=c,i.textData[n].lineWidth=s}),v.forin(this.textData,function(t,o){var n=0;o.lineWidth<e.width&&("center"==e.align?n=(e.width-o.lineWidth)/2:"right"==e.align&&(n=e.width-o.lineWidth)),o.data.forEach(function(t){t.x+=n,i._fillText(t)})})},o.prototype._fillText=function(t){var e=t.context,i=t.x,o=t.y,n=t.style;this.ctx.font=n.font,this.ctx.textAlign=n.align,this.ctx.textBaseline="bottom",this.ctx.fillStyle=n.color,this.ctx.fillText(e,i,o)},o.prototype._get=function(t,e,i,o){var n=i;if("string"==typeof i)if(-1!==i.indexOf(":")&&"pos"==o){var s=i.split(":");switch(s[0]){case"left":case"top":n=+s[1].replace("px","");break;case"right":case"bottom":n=t-+s[1].replace("px","")-e}}else n=-1!==i.indexOf("px")?+i.replace("px",""):-1!==i.indexOf("%")?"crop"==o?e*+i.replace("%","")/100:t*+i.replace("%","")/100:"center"==i?(t-e)/2:+i;return n},o.prototype.draw=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},i=void 0;return this.end=function(){setTimeout(function(){i=t.canvas.toDataURL("image/png"),e(i)},0)},this._next(),this},o.prototype._next=function(){this.queue.length>0?this.queue.shift()():this.end()};var y="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},x=void 0,b={setPos:function(t,e){var i=JSON.stringify(e),o="translate3d("+e.x+"px,"+e.y+"px,0px) scale("+e.scale+") rotate("+e.rotate+"deg)";t=this.getEl(t),this.setStyle(t,{transform:o,webkitTransform:o}),t.setAttribute("data-mtouch-status",i)},getPos:function(t){if(t){var e=void 0,i=window.getComputedStyle(t,null),o=i.transform||i.webkitTransform;return e=window.getComputedStyle&&"none"!==o?this.matrixTo(o):{x:0,y:0,scale:1,rotate:0},JSON.parse(t.getAttribute("data-mtouch-status"))||e}},extend:function(t,e){for(var i in e)e.hasOwnProperty(i)&&("object"!=y(e[i])||e[i]instanceof Node?t[i]=e[i]:("object"===y(t[i])&&null!==t[i]||(t[i]={}),this.extend(t[i],e[i])));return t},getOffset:function(t){t=this.getEl(t);var e={};return e.width=t.clientWidth||t.offsetWidth,e.height=t.clientHeight||t.offsetHeight,e},matrixTo:function(t){var e=t.replace("matrix(","").replace(")","").split(","),i=e[0],o=e[1],n=o/i,s=180*Math.atan(n)/Math.PI,r=i/Math.cos(Math.PI/180*s);return{x:parseInt(e[4]),y:parseInt(e[5]),scale:r,rotate:s}},domify:function(t){var e=document.implementation.createHTMLDocument();return e.body.innerHTML=t,e.body.children},getEl:function(t){if(!t)return void console.error("el error,there must be a el!");var e=void 0;if("string"==typeof t)e=document.querySelector(t);else{if(!(t instanceof Node))return void console.error("el error,there must be a el!");e=t}return e},setStyle:function(t,e){this.forin(e,function(e,i){t.style[e]=i})},addClass:function(t,e){var i=void 0;return t=this.getEl(t),i=this.trim(t.className)||"",-1==i.indexOf(e)&&(0==i.length?t.className=e:t.className=i+" "+e),this},trim:function(t){if("string"==typeof t)return t.replace(/(^\s*)|(\s*$)/g,"")},removeClass:function(t,e){var i=void 0;t=this.getEl(t),i=t.className||"",-1!==i.indexOf(e)&&(t.className=i.replace(new RegExp(e,"g"),""))},hasClass:function(t,e){return t=this.getEl(t),-1!==t.className.indexOf(e)},forin:function(t,e){for(var i in t)t.hasOwnProperty(i)&&e(i,t[i])},xRatio:function(t,e){return t.x*=e,t.y*=e,t},data:function(t,e,i){return t=this.getEl(t),i?(t.setAttribute("data-"+e,i),this):t.getAttribute("data-"+e)},include:function(t,e){return!!t.indexOf&&-1!==t.indexOf(e)},delegate:function(t,e,i){var o=this,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},s=this.getEl(t);s.addEventListener(e,function(t){for(var e=t.target;e!==s;){if(0==i.indexOf(".")){if(o.include(e.className,i.substring(1))){t.delegateTarget=e,n.bind(e)(t);break}}else if(0==i.indexOf("#")){if(e.id==i.substring(1)){t.delegateTarget=e,n.bind(e)(t);break}}else if(e.tagName.toLowerCase()==i){t.delegateTarget=e,n.bind(e)(t);break}e=e.parentNode}})},addCssRule:function(t,e){x||(x=n()),x.insertRule(t+"{"+e+"}",x.rules.length)},remove:function(t){(t.parentNode||t.parentElement).removeChild(t)},loadImage:function(t,e,i){var o=new Image,n=!1;0==t.indexOf("http")&&(o.crossOrigin="*"),o.onload=function(){n||(n=!0,e(o))},o.onerror=function(){i("img load error")},o.src=t},getImage:function(t,e,i){if("string"==typeof t)this.loadImage(t,function(t){e(t)},function(t){console.log(t),i(t)});else{if(!("object"==(void 0===t?"undefined":y(t))&&t instanceof Node))return console.log("add image error"),void i("type of image is error!");e(t)}},isArr:function(t){return"[object Array]"===Object.prototype.toString.call(t)}},w=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),A=function(){function t(e){s(this,t),this.config={min:50,max:100},this.config=b.extend(this.config,e),this.topIndex=this.config.min,this.zIndexArr=[]}return w(t,[{key:"init",value:function(){this.zIndexArr=[],this.topIndex=this.config.min}},{key:"setIndex",value:function(t){if(this.zIndexArr.push(t),this.topIndex>this.config.max)this.resetIndex();else{document.querySelector("#"+t).style.zIndex=this.topIndex,this.topIndex++}}},{key:"removeIndex",value:function(t){this.zIndexArr.forEach(function(e,i,o){e==t&&o.splice(i,1)})}},{key:"resetIndex",value:function(){var t=this;this.zIndexArr.forEach(function(e,i){document.querySelector("#"+e).style.zIndex=t.config.min+i}),this.topIndex=this.zIndexArr.length+this.config.min}},{key:"toTop",value:function(t){t!==this.zIndexArr[this.zIndexArr.length-1]&&(this.removeIndex(t),this.setIndex(t))}}]),t}(),S="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},_=["touchstart","touchmove","touchend","drag","dragstart","dragend","pinch","pinchstart","pinchend","rotate","rotatestart","rotatend","singlePinchstart","singlePinch","singlePinchend","singleRotate","singleRotatestart","singleRotatend"],P=function(){};return window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}(),r.prototype._init=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.operator=null,this.operatorStatus=null,this._cropBox=!1,this.transform=null,this.freezed=!1,this._childs=t,this._childIndex=0,this._activeChild=null,this._zIndexBox=new A,this},r.prototype.background=function(t){var e=this,i={image:"",type:"contain",left:0,top:0,use:{},static:!1,success:function(){},error:function(){}};return i=b.extend(i,t),b.getImage(i.image,function(o){var n=e._getSize(o),s=n.iw,r=n.ih,a=s/r,h=e.elStatus.width,c=e.elStatus.height,l=h/c,d=void 0,u=void 0,p=void 0,f=void 0,g=0,m=0,v=void 0,y=b.domify('<div class="mt-background" data-mt-index="background" data-mt-bg-type='+i.type+'><div class="mt-prevent"></div></div>')[0];b.addClass(o,"mt-image"),y.appendChild(o),"contain"==i.type?(a>l?(d=i.left||0,u=i.top||(c-h/a)/2,p=h,f=h/a,v=s/p):(d=i.left||(h-c*a)/2,u=i.top||0,p=c*a,f=c,v=r/f),t.static||(i.use={drag:!0,pinch:!0,rotate:!0})):"crop"==i.type&&(d=0,u=0,a>l?(p=c*a,f=c,g=(p-h)/p,v=r/f):(p=h,f=h/a,m=(f-c)/f,v=s/p),i.limit={x:g,y:m,maxScale:1,minScale:1},t.static||(i.use={drag:!0})),b.setStyle(y,{width:p+"px",height:f+"px",transform:"translate("+d+"px,"+u+"px)",webkitTransform:"translate("+d+"px,"+u+"px)"}),i.pos={width:p,height:f,left:d,top:u},e.el.appendChild(y),i.ratio=v,e._childs.background={el:y,ops:i,type:"background"},i.success(e)},function(t){i.error(t)}),this},r.prototype.add=function(t){var e=this,i={image:"",width:"",use:{drag:!1,pinch:!1,rotate:!1,singlePinch:!1,singleRotate:!1},limit:!1,pos:{x:0,y:0,scale:1,rotate:0},close:!1,success:function(){},error:function(){}};return b.isArr(t)||(t=[t]),t.forEach(function(t){b.getImage(t.image,function(o){"all"==t.use&&(t.use={drag:!0,pinch:!0,rotate:!0,singlePinch:!0,singleRotate:!0}),e._add(o,b.extend(i,t))},function(t){i.error(t)})}),this},r.prototype._add=function(t,e){var i=this._getSize(t),o=i.iw,n=i.ih,s=o/n,r=t,a=b.domify('<div class="mt-child" id="mt-child-'+this._childIndex+'" data-mt-index="'+this._childIndex+'"><div class="mt-prevent"></div></div>')[0],h=this._get("hor",e.width),c=h/s,l=(e.pos.scale-1)*h/2,d=(e.pos.scale-1)*c/2;b.setStyle(a,{width:h+"px",height:c+"px"}),b.addClass(r,"mt-image"),a.appendChild(r),(e.close||this._ops.close)&&a.appendChild(b.domify('<div class="mt-close-btn"></div>')[0]),this.el.appendChild(a),e.pos={x:this._get("hor",e.pos.x)+l,y:this._get("ver",e.pos.y)+d,scale:e.pos.scale,rotate:e.pos.rotate},this._childs[this._childIndex]={el:a,ops:e,type:"element"},this._zIndexBox.setIndex("mt-child-"+this._childIndex);var u=!!(e.use.singlePinch||this._ops.use.singlePinch||e.use.singleRotate||this._ops.use.singleRotate);this.switch(a,u),this._setTransform("all",a,e.pos),b.setStyle(a,{visibility:"visible"}),this._childIndex++,e.success(this)},r.prototype.cropBox=function(){var t=b.domify('<div class="mt-crop-box" data-mt-index="cropBox"><div class="mt-close-btn"></div></div>')[0];this.el.appendChild(t),this.switch(t),this._cropBox=!0,this._childs.cropBox={el:t,type:"cropBox",ops:{width:t.offsetWidth,height:t.offsetHeight,use:{drag:!0,pinch:!1,rotate:!1,singlePinch:!0,singleRotate:!1},limit:{x:0,y:0,maxScale:1,minScale:.2}}}},r.prototype.exportImage=function(t,e){var i=this,n=this.elStatus.width,s=this.elStatus.height,r=1,a=[];if(this._childs.background){var h=this._childs.background;r=h.ops.ratio;var c=h.el.querySelector(".mt-image"),l=b.xRatio(b.getPos(h.el),r);a.push({image:c,options:{width:c.width*r,pos:l}})}var d=new o(n*r,s*r,"#ffffff");this._zIndexBox.zIndexArr.forEach(function(t){var e=document.querySelector("#"+t),i=e.querySelector(".mt-image"),o=b.xRatio(b.getPos(e),r),n=i.clientWidth||i.offsetWidth;a.push({image:i,options:{width:n*r,pos:o}})}),d.add(a).draw(function(n){if(i._cropBox){var s=i._childs.cropBox,a=s.el,h=b.getPos(a);new o(s.ops.width*r,s.ops.height*r).add(d.canvas,{width:d.canvas.width,pos:{x:-h.x*r,y:-h.y*r,scale:1,rotate:0}}).draw(function(e){t(e)})}else if(e){var c={x:0,y:0,width:"100%",height:"100%"};e=b.extend(c,e),e.width=i._get("hor",e.width,d.canvas.width-e.x),e.height=i._get("ver",e.height,d.canvas.height-e.y);var l=new o(e.width,e.height);l.add(d.canvas,{width:d.canvas.width,pos:{x:-e.x,y:-e.y,scale:1,rotate:0}}).draw(function(e){t(e)})}else t(n)})},r.prototype._bind=function(){var t=this;_.forEach(function(e){t[e]||(t[e]=function(){t._ops.event[e]()}),t.mt.on(e,t[e].bind(t))});var e=void 0,i=void 0;return b.delegate(this.el,"touchstart",".mt-background",function(){e=(new Date).getTime()}),b.delegate(this.el,"touchend",".mt-background",function(i){(new Date).getTime()-e>300||i.touches.length||t.switch(i.delegateTarget,!1)}),b.delegate(this.el,"touchend",".mt-crop-box",function(e){e.touches.length>0||t.switch(e.delegateTarget)}),this.el.addEventListener("click",function(e){t._isAdd(e.target)||t.switch(null)}),b.delegate(this.el,"touchstart",".mt-child",function(){i=(new Date).getTime()}),b.delegate(this.el,"touchend",".mt-child",function(e){if(!((new Date).getTime()-i>300||e.touches.length>0)){var o=e.delegateTarget,n=t._getOperatorOps(o),s=!!(n.use.singlePinch||t._ops.use.singlePinch||n.use.singleRotate||t._ops.use.singleRotate);t.switch(o,s),t._zIndexBox.toTop(o.id)}}),b.delegate(this.el,"click",".mt-close-btn",function(e){var i=e.delegateTarget,o=i.parentNode||i.parentElement,n=b.data(o,"mt-index");"cropBox"==n?(t.switch(null),t._cropBox=!1):t._zIndexBox.removeIndex(o.id),b.remove(o),t._childs[n]=null}),this},r.prototype.touchstart=function(t){this.freezed||(this.operator&&(this.transform=b.getPos(this.operator)),this._ops.event.touchstart(t))},r.prototype.drag=function(t){if(!this.freezed){if(this.operator){(this._getOperatorOps().use.drag||this._ops.use.drag)&&(this.transform.x+=t.delta.deltaX,this.transform.y+=t.delta.deltaY,this._setTransform("drag"))}this._ops.event.drag(t)}},r.prototype.pinch=function(t){if(!this.freezed){if(this.operator){(this._getOperatorOps().use.pinch||this._ops.use.pinch)&&(this.transform.scale*=t.delta.scale,this._setTransform("pinch"))}this._ops.event.pinch(t)}},r.prototype.rotate=function(t){if(!this.freezed){if(this.operator){(this._getOperatorOps().use.rotate||this._ops.use.rotate)&&(this.transform.rotate+=t.delta.rotate,this._setTransform("rotate"))}this._ops.event.rotate(t)}},r.prototype.singlePinch=function(t){if(!this.freezed){if(this.operator){var e=this._getOperatorOps();if("cropBox"==b.data(this.operator,"mt-index")){ if(e.use.singlePinch||this._ops.use.singlePinch){var i=b.getPos(this.operator);e.width+t.delta.deltaX+i.x<this.elStatus.width&&(e.width+=t.delta.deltaX),e.height+t.delta.deltaY+i.y<this.elStatus.height&&(e.height+=t.delta.deltaY),b.setStyle(this.operator,{width:e.width+"px",height:e.height+"px"})}}else(e.use.singlePinch||this._ops.use.singlePinch)&&(this.transform.scale*=t.delta.scale,this._setTransform("pinch"))}this._ops.event.singlePinch(t)}},r.prototype.singleRotate=function(t){if(!this.freezed){if(this.operator){(this._getOperatorOps().use.singleRotate||this._ops.use.singleRotate)&&(this.transform.rotate+=t.delta.rotate,this._setTransform("rotate"))}this._ops.event.singleRotate(t)}},r.prototype._setTransform=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.operator,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.transform,o=JSON.parse(JSON.stringify(i)),n=this._getOperatorOps(),s=this._ops.limit&&"object"==S(this._ops.limit)?b.extend({x:.5,y:.5,maxScale:3,minScale:.4},this._ops.limit):{x:.5,y:.5,maxScale:3,minScale:.4},r=n.limit&&!0!==n.limit?b.extend(s,n.limit):s;if((n.limit||this._ops.limit)&&(o=this._limitOperator(o,r)),(n.use.singlePinch||this._ops.use.singlePinch)&&("all"==t||"pinch"==t)){var a=e.querySelector(".mtouch-singleButton");b.setStyle(a,{transform:"scale("+1/o.scale+")",webkitTransform:"scale("+1/o.scale+")"})}if((n.close||this._ops.close)&&("all"==t||"pinch"==t)){var h=e.querySelector(".mt-close-btn");b.setStyle(h,{transform:"scale("+1/o.scale+")",webkitTransform:"scale("+1/o.scale+")"})}window.requestAnimFrame(function(){b.setPos(e,o)})},r.prototype._limitOperator=function(t,e){var i=e.minScale,o=e.maxScale,n=void 0,s=void 0,r=void 0,a=void 0,h=void 0,c=void 0,l=void 0,d=void 0,u=void 0;return i&&t.scale<i&&(t.scale=i),o&&t.scale>o&&(t.scale=o),n=b.getOffset(this.operator),s=n.width*(t.scale-1)/2,r=n.height*(t.scale-1)/2,a=n.width*t.scale*e.x,h=n.height*t.scale*e.y,c=s-a,l=s-h,d=this.elStatus.width-n.width*t.scale+s+a,u=this.elStatus.height-n.height*t.scale+r+h,(e.x||0==e.x)&&(t.x>=d&&(t.x=d),t.x<c&&(t.x=c)),(e.y||0==e.y)&&(t.y>u&&(t.y=u),t.y<l&&(t.y=l)),t},r.prototype.switch=function(t,e){if(this.mt&&!this.freezed)return t&&(t=b.getEl(t)),b.forin(this._childs,function(t,e){e&&b.removeClass(e.el,"mt-active")}),this.mt.switch(t,e),this.operator=t,t&&(b.addClass(t,"mt-active"),this._activeChild=t),this},r.prototype._getOperatorOps=function(t){var e=t||this.operator,i=b.data(e,"mt-index");if(this._childs[i])return this._childs[i].ops},r.prototype.freeze=function(t){return t?b.forin(this._childs,function(t,e){e&&b.removeClass(e.el,"mt-active")}):b.addClass(this._activeChild,"mt-active"),this.freezed=!!t,this},r.prototype.clear=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null!==e)try{b.remove(this.getChild(e).el),this._childs[e]=null}catch(t){console.error("Can not find this el or has been deleted!")}else b.forin(this._childs,function(e,i){i&&"element"==i.type&&(b.remove(i.el),t._childs[e]=null)}),this._init(this._childs);return this},r.prototype.reset=function(){return b.forin(this._childs,function(t,e){e&&b.remove(e.el)}),this._init(),this},r.prototype.destory=function(){b.forin(this._childs,function(t,e){e&&b.removeClass(e.el,"mt-active")}),this.mt&&this.mt.destroy(),this.mt=null},r.prototype._get=function(t,e,i,o){var n=e,s=void 0,r=void 0,a=void 0;if(s=document.body&&document.body.clientWidth?"hor"==t?"clientWidth":"clientHeight":"hor"==t?"offsetWidth":"offsetHeight",r=i||this.el[s],a=o||(this.operator?this.operator[s]:0),"string"==typeof e)if(b.include(e,":")){var h=e.split(":");switch(h[0]){case"left":case"top":n=+h[1].replace("px","");break;case"right":case"bottom":n=r-+h[1].replace("px","")-a}}else n=b.include(e,"px")?+e.replace("px",""):b.include(e,"%")?r*+e.replace("%","")/100:"center"==e?(r-a)/2:+e;return n},r.prototype.getChild=function(t){return this._childs[t]||null},r.prototype._isAdd=function(t){for(var e=t;e!==this.el||"body"==e.tagName.toLowerCase();){if(b.include(e.className,"mt-child")||b.include(e.className,"mt-background")||b.include(e.className,"mt-crop-box"))return!0;e=e.parentNode}return!1},r.prototype._getSize=function(t){var e=void 0,i=void 0;return"IMG"===t.tagName?(e=t.naturalWidth,i=t.naturalHeight):"CANVAS"===t.tagName?(e=t.width,i=t.height):(e=t.offsetWidth,i=t.offsetHeight),{iw:e,ih:i}},r.prototype._insertCss=function(){return b.addCssRule(".mt-touch-box","-webkit-user-select: none;"),b.addCssRule(".mtouch-singleButton","display: none;"),b.addCssRule(".mt-child.mt-active","z-index: 99;outline:2px solid hsla(0,0%,100%,.5);"),b.addCssRule(".mt-active .mtouch-singleButton,.mt-active .mt-close-btn","display: inline-block;"),b.addCssRule(".mt-child","position:absolute;text-align:left;visibility:hidden;"),b.addCssRule(".mt-image","width:100%;height:100%;position:absolute;left:0;top:0;text-align:left;"),b.addCssRule(".mt-close-btn","z-index:999;position:absolute;width:30px;height:30px;top:-15px;right:-15px;background-size:100%;display:none;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABEBJREFUeNrsm01IVFEUx9+MpVMzgVrhLoqshdWMTq1GXbQpo1Vf0GChs6gk+sCFzUYwZMQaUTEQwYIQQ4Q+pEUfth5caCaYtCjLaJVkmajTSMh0DnMHJJ/v49x3573ROfAHec579/zmzpyPe+/Y4vG4tJHMLm0wywBngNeZbZK7WFZWtm4AI5GIOrCBtgPkAx0GFYJ2gbaDtrL/R0E/Qd9Ak6BR0BBoJqUzzGl5oHOgUyA3yKbw2mxQLmgv6CjoEgjz5DhoAPQYNGtV4AJQDejiihmkGL5BHqYgqB90DzRtlaCFb9pV/LqArnDC/m9bQAH2bBxjs9nAe0AvQfUgp8BY4GRj4Fj7zQI+DnoNOpjCoHsA9AJUkWrgC6AHoG0mZBqc7fvMh5QAV4HCoCwT02sW86FKNPAxUMhCdUWI+SQEeB+o0+SZlZvpTuabocCYDroER2Ke73SX1pSlFRgroCILl8xFzEdDgLGCqk2DPqGW+coNfMOiH2W5j/ZNXuB8kD+NusHzzGcy8BmQQ++ogUDANTg4WNDc3JzncDhsWu/D14bD4Ty8t7q62kUAdjCfuYB1W2VlpcvpdNrLy8sdLS0tmqDxNa2trfk+n8+B9/r9fhdxlk9TgbF5P0QZcXh4eCn5d0lJSY4adBLW4/FkJ6+NjIzEiMBupeClBFyq0ryvaY2Njb/HxsY0QcvBjo6OLoVCoTmOfrqUAuylRo5YLBavq6ubVYNeCzYYDM7iMziCl4cCXMgTLtWgBcJKbMlIfvrltlrYqiUupu3mzRMIhpAIm7yGb4LdbrcJgkX7KiUWD1etWqoFLW5ba6YFwir6rgTsMmhwWWiBsIq+p3TnAT/GMtdEDPWXArxg1OhyAUpPnibYAgV4xijYtra2VdFYa54m2hwFeMooWLfbvSpAacnTHPaFAjwpChYDlNbihGifKcDvRMHqrcgINk4BxsKDlCqamppy1WDVoBsaGnKJsDhGhAL8A/SeMmJxcXGOnjwrB+31enOIwOjzNDUPP6WM2NvbuxCNRuNQ1sW0FhVJaLwH7+3r65snAg8otlIKtXRyiectZdXDJMMe+gjoV/KCnlpaYjf2p9GaVv9KWGpp2QFaTAPYRearxAuMAaA9DYDbJQ2nBLRW7rg9OWFh2Anmo2QUMHYfeJxh3oKw2CjUKHVI1PYQa+vroGULwaIv15RqZ95++I2UOGthFatnPkmigNF6QLdMnull5kOP7kUI4oCPpMT2pBnfaUw/l5kPUqqA0fAET0WKo/cH0EnQK/IyE6cDU8yBO6ysE1ky3gWdAH3keZARK2iYDvBoIK4Dd0uJA6NG2R/QQymxddKhNfUomZFnLb+DbjP4s1JiFw834/Q28nHW4j0DPVGrjc0EXtlwdDPtZDOP+1R40kbp+PAntsoyxHpxISb6vDQ6/pzJErbhfgJgy/xuKQOcAU5r+yfAAGDyyaocNx08AAAAAElFTkSuQmCC)"),b.addCssRule(".mt-background","position:absolute;left:0;top:0;"),b.addCssRule(".mt-crop-box","position:absolute;left:5px;top:5px;width:90%;height:90%;border:2px dashed #996699;box-sizing:border-box;z-index:20;"),b.addCssRule(".mt-prevent","width:100%;height:100%;position:absolute;left:0;top:0;z-index:99;"),this},r}); //# sourceMappingURL=touchkit.min.js.map