diff --git a/dist/bundle.js b/dist/bundle.js index 71591f84..57a5f5c7 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1,5 +1,5 @@ -!function(e){function t(n){if(a[n])return a[n].exports;var r=a[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var a={};t.m=e,t.c=a,t.d=function(e,a,n){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=25)}([function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={};n.VERSION="4.0.0",n.TRANSPARENCY=!1,n.TRANSPARENCY_TYPE="squares",n.LANG="en",n.WIDTH=null,n.HEIGHT=null,n.visible_width=null,n.visible_height=null,n.COLOR="#008000",n.ALPHA=255,n.ZOOM=1,n.pixabay_key="3ca2cd8af3fde33af218bea02-9021417",n.layers=[],n.layer=null,n.need_render=!1,n.mouse={},n.TOOLS=[{name:"select",title:"Select object tool",attributes:{auto_select:!0}},{name:"selection",title:"Selection",attributes:{},on_leave:"on_leave"},{name:"brush",title:"Brush",attributes:{size:4,smart_brush:!0}},{name:"pencil",title:"Pencil",on_update:"on_params_update",attributes:{antialiasing:!0,size:2}},{name:"pick_color",title:"Pick Color",attributes:{global:!1}},{name:"erase",title:"Erase",on_update:"on_params_update",attributes:{size:30,circle:!0,strict:!0}},{name:"magic_wand",title:"Magic Wand Tool",attributes:{power:15,anti_aliasing:!0,contiguous:!1}},{name:"fill",title:"Fill",attributes:{power:5,anti_aliasing:!1,contiguous:!1}},{name:"line",title:"Line",attributes:{size:1,type:{value:"Simple",values:["Simple","Arrow"]}}},{name:"rectangle",title:"Rectangle",attributes:{size:1,fill:!0,square:!1}},{name:"circle",title:"Circle",attributes:{size:1,fill:!0,circle:!1}},{name:"media",title:"Search images",on_activate:"on_activate",attributes:{size:30}},{name:"text",title:"Text",attributes:{size:40,bold:!1,italic:!1,stroke:!1,align:{value:"Left",values:["Left","Center","Right"]},family:{value:"Arial",values:["Arial","Courier","Impact","Helvetica","monospace","Times New Roman","Verdana"]},stroke_size:1}},{name:"gradient",title:"Gradient",attributes:{color_1:"#008000",color_2:"#ffffff",alpha:0,radial:!1,radial_power:50}},{name:"clone",title:"Clone tool",attributes:{size:30,anti_aliasing:!0,source_layer:{value:"Current",values:["Current","Previous"]}}},{name:"crop",title:"Crop",on_update:"on_params_update",on_leave:"on_leave",attributes:{crop:!0}},{name:"blur",title:"Blur tool",attributes:{size:30,strength:1}},{name:"sharpen",title:"Sharpen tool",attributes:{size:30}},{name:"desaturate",title:"Desaturate",attributes:{size:50,anti_aliasing:!0}},{name:"bulge_pinch",title:"Bulge/Pinch tool",attributes:{radius:80,power:50,bulge:!0}},{name:"animation",title:"Play animation",on_update:"on_params_update",on_leave:"on_leave",attributes:{play:!1,delay:400}}],n.TOOL=n.TOOLS[2],t.default=n},function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var a=0;a=0;i--){var o=r[i];this.ctx.globalAlpha=o.opacity/100,this.ctx.globalCompositeOperation=o.composition,this.render_object(this.ctx,o)}this.Base_gui.draw_grid(this.ctx),this.Base_selection.draw_selection(),this.render_preview(r),this.after_render(),this.last_zoom=l.default.ZOOM,this.Base_gui.GUI_details.render_details()}requestAnimationFrame(function(){t.render(e)})}},{key:"render_preview",value:function(e){var t=this.Base_gui.GUI_preview.PREVIEW_SIZE.w,a=this.Base_gui.GUI_preview.PREVIEW_SIZE.h;this.ctx_preview.save(),this.ctx_preview.clearRect(0,0,t,a),this.ctx_preview.scale(t/l.default.WIDTH,a/l.default.HEIGHT);for(var n=e.length-1;n>=0;n--){var r=e[n];0!=r.visible&&(null!=r.type&&(this.ctx_preview.globalAlpha=r.opacity/100,this.ctx_preview.globalCompositeOperation=r.composition,this.render_object(this.ctx_preview,r)))}this.ctx_preview.restore(),this.Base_gui.GUI_preview.render_preview_active_zone()}},{key:"render_object",value:function(e,t){if(0!=t.visible&&null!=t.type){var a="";for(var n in t.filters){var r=t.filters[n];""!=a&&(a+=" "),a+=r.name+"("+r.params.value+")"}if(e.filter=""!=a?a:"none","image"==t.type){e.save(),e.translate(t.x+t.width/2,t.y+t.height/2),e.rotate(t.rotate*Math.PI/180),void 0!=t.link_canvas&&null!=t.link_canvas?e.drawImage(t.link_canvas,-t.width/2,-t.height/2,t.width,t.height):e.drawImage(t.link,-t.width/2,-t.height/2,t.width,t.height),e.restore()}else{var i=t.render_function[0],o=t.render_function[1];this.Base_gui.GUI_tools.tools_modules[i][o](e,t)}e.filter="none"}}},{key:"insert",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,n=!1,r={id:this.auto_increment,parent_id:0,name:this.Helper.ucfirst(l.default.TOOL.name)+" #"+this.auto_increment,type:null,link:null,x:0,y:0,width:0,width_original:null,height:0,height_original:null,visible:!0,opacity:100,order:this.auto_increment,composition:"source-over",rotate:0,data:null,params:{},status:null,color:l.default.COLOR,filters:[],render_function:null};for(var o in e)void 0!==r[o]?r[o]=e[o]:x.default.error("Error: wrong key: "+o);if("image"==r.type&&(1==l.default.layers.length&&0==l.default.layer.width&&0==l.default.layer.height&&null==l.default.layer.data&&this.delete(l.default.layer.id,!0),null==r.link&&("object"==i(r.data)?(0==r.width&&(r.width=r.data.width),0==r.height&&(r.height=r.data.height),r.link=r.data.cloneNode(!0),r.data=null,n=!0):"string"==typeof r.data?(r.link=new Image,r.link.onload=function(){0==r.width&&(r.width=r.link.width),0==r.height&&(r.height=r.link.height),null==r.width_original&&(r.width_original=r.width),null==r.height_original&&(r.height_original=r.height),r.data=null,a.autoresize(r.width,r.height,r.id,t),a.render(),r.link.onload=function(){l.default.need_render=!0}},r.link.src=r.data):x.default.error("Error: can not load image."))),void 0!=e&&l.default.layers.length>0&&0==l.default.layer.width&&0==l.default.layer.height&&null==l.default.layer.data&&"image"!=r.type&&!1!==t)for(var o in r)"id"!=o&&"name"!=o&&"order"!=o&&(l.default.layer[o]=r[o]);else l.default.layers.push(r),l.default.layer=this.get_layer(this.auto_increment),this.auto_increment++,null==l.default.layer&&(l.default.layer=l.default.layers[0]);r.id>=this.auto_increment&&(this.auto_increment=r.id+1),1==n&&this.autoresize(l.default.layer.width,l.default.layer.height),this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"autoresize",value:function(e,t,a){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this,i=!1;if(void 0==a&&(a=l.default.layer),e>l.default.WIDTH||t>l.default.HEIGHT){var o=document.getElementById("main_wrapper"),s=o.clientWidth,u=o.clientHeight;(e>s||t>u)&&(i=!0),e>l.default.WIDTH&&(l.default.WIDTH=parseInt(e)),t>l.default.HEIGHT&&(l.default.HEIGHT=parseInt(t))}if(1==l.default.layers.length&&!1!==n&&(e=0;t--)this.delete(l.default.layers[t].id,!0);if(this.auto_increment=1,void 0!=e&&!0===e){var a={};this.insert(a)}this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"toggle_visibility",value:function(e){e=parseInt(e);var t=this.get_layer(e);0==t.visible?t.visible=!0:t.visible=!1,this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"refresh_gui",value:function(){this.Base_gui.GUI_layers.render_layers()}},{key:"select",value:function(e){e=parseInt(e),l.default.layer=this.get_layer(e),this.Base_selection.reset_selection(),this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"set_opacity",value:function(e,t){e=parseInt(e),((t=parseInt(t))<0||t>100)&&(t=100),this.get_layer(e).opacity=t}},{key:"layer_clear",value:function(e){e=parseInt(e);var t=this.get_layer(e);t.data=null,t.x=0,t.y=0,t.width=0,t.height=0}},{key:"move",value:function(e,t){e=parseInt(e);var a=this.get_layer(e);if(t<0)var n=this.find_previous(e);else var n=this.find_next(e);if(null!=n){var r=a.order;a.order=n.order,n.order=r}this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"get_sorted_layers",value:function(){return l.default.layers.concat().sort(function(e,t){return t.order-e.order})}},{key:"is_layer_empty",value:function(e){var t=this.get_layer(e);return 0==t.width&&0==t.height&&null==t.data}},{key:"find_next",value:function(e){e=parseInt(e);for(var t=this.get_layer(e),a=this.get_sorted_layers(),n=null,r=a.length-1;r>=0;r--){var i=a[r];if(null!=n&&n.id==t.id)return i;n=i}return null}},{key:"find_previous",value:function(e){e=parseInt(e);var t=this.get_layer(e),a=this.get_sorted_layers(),n=null;for(var r in a){var i=a[r];if(null!=n&&n.id==t.id)return i;n=i}return null}},{key:"get_world_coords",value:function(e,t){return y.default.toWorld(e,t)}},{key:"getCurrentPos",value:function(){return y.default.getCurrentPos()}},{key:"add_filter",value:function(e,t,a){null==e&&(e=l.default.layer.id);var n=this.get_layer(e),r={id:this.Helper.getRandomInt(1,999999999),name:t,params:a};n.filters.push(r),l.default.need_render=!0,this.Base_gui.GUI_layers.render_layers()}},{key:"delete_filter",value:function(e,t){null==e&&(e=l.default.layer.id);var a=this.get_layer(e);for(var n in a.filters)a.filters[n].id==t&&a.filters.splice(n,1);l.default.need_render=!0,this.Base_gui.GUI_layers.render_layers()}},{key:"convert_layers_to_canvas",value:function(e,t){for(var a=this.get_sorted_layers(),n=a.length-1;n>=0;n--){var r=a[n];0!=r.visible&&null!=r.type&&(void 0!=t&&r.id!=t||(e.globalAlpha=r.opacity/100,e.globalCompositeOperation=r.composition,this.render_object(e,r)))}}},{key:"convert_layer_to_canvas",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments[2];null==e&&(e=l.default.layer.id);var n=this.get_layer(e),r=0,i=0,o=document.createElement("canvas");if(!0===t&&"image"==n.type?(o.width=n.width_original,o.height=n.height_original,a=!1):(o.width=Math.max(n.width,l.default.WIDTH),o.height=Math.max(n.height,l.default.HEIGHT)),!0===t&&"image"==n.type?o.getContext("2d").drawImage(n.link,0,0):this.render_object(o.getContext("2d"),n),(1==a||void 0==a)&&null!=n.type){var s=this.Image_trim.get_trim_info(e);(s.left>0||s.top>0||s.right>0||s.bottom>0)&&(r=s.left,i=s.top,this.Helper.change_canvas_size(o,o.width-s.left-s.right,o.height-s.top-s.bottom,r,i))}return o.dataset.x=r,o.dataset.y=i,o}},{key:"update_layer_image",value:function(e,t){null==t&&(t=l.default.layer.id);var a=this.get_layer(t);if("image"!=a.type)return null;0==this.Helper.is_edge_or_ie()?e.toBlob(function(e){a.link.src=window.URL.createObjectURL(e),l.default.need_render=!0},"image/png"):a.link.src=e.toDataURL(),l.default.need_render=!0}},{key:"get_dimensions",value:function(){return{width:l.default.WIDTH,height:l.default.HEIGHT}}}]),e}();t.default=C},function(e,t,a){var n,r;/*! alertifyjs - v1.11.0 - Mohammad Younes (http://alertifyjs.com) */ -!function(a){"use strict";function i(e,t){e.className+=" "+t}function o(e,t){for(var a=e.className.split(" "),n=t.split(" "),r=0;r-1&&a.splice(i,1)}e.className=a.join(" ")}function s(){return"rtl"===a.getComputedStyle(document.body).direction}function l(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}function u(){return document.documentElement&&document.documentElement.scrollLeft||document.body.scrollLeft}function c(e){for(;e.lastChild;)e.removeChild(e.lastChild)}function d(e){if(null===e)return e;var t;if(Array.isArray(e)){t=[];for(var a=0;a0){for(var a=[],n=0;n=0?(o(document.body,Te.noOverflow),g(!1)):e>0&&document.body.className.indexOf(Te.noOverflow)<0&&(g(!0),i(document.body,Te.noOverflow))}function g(e){S.defaults.preventBodyShift&&document.documentElement.scrollHeight>document.documentElement.clientHeight&&(e?(Ie=ke,Oe=a.getComputedStyle(document.body).top,i(document.body,Te.fixed),document.body.style.top=-ke+"px"):(ke=Ie,document.body.style.top=Oe,o(document.body,Te.fixed),n()))}function y(e,t,a){"string"==typeof a&&o(e.elements.root,Te.prefix+a),i(e.elements.root,Te.prefix+t),Se=e.elements.root.offsetWidth}function k(e){e.get("modal")?(o(e.elements.root,Te.modeless),e.isOpen()&&(me(e),z(e),r())):(i(e.elements.root,Te.modeless),e.isOpen()&&(pe(e),z(e),r()))}function C(e){e.get("basic")?i(e.elements.root,Te.basic):o(e.elements.root,Te.basic)}function E(e){e.get("frameless")?i(e.elements.root,Te.frameless):o(e.elements.root,Te.frameless)}function P(e,t){for(var a=b.indexOf(t),n=a+1;n-1?(W(t,function(e){return e.key===a}),!1):void 0}function q(e){var t=b[b.length-1],a=e.keyCode;if(a===v.LEFT||a===v.RIGHT){for(var n=t.__internal.buttons,r=0;rv.F1-1&&Ce.indexOf(a)>-1)return e.preventDefault(),e.stopPropagation(),W(t,function(e){return e.key===a}),!1}function Z(e,t){if(t)t.focus();else{var a=e.__internal.focus,n=a.element;switch(typeof a.element){case"number":e.__internal.buttons.length>a.element&&(n=!0===e.get("basic")?e.elements.reset[0]:e.__internal.buttons[a.element].element);break;case"string":n=e.elements.body.querySelector(a.element);break;case"function":n=a.element.call(e)}void 0!==n&&null!==n||0!==e.__internal.buttons.length||(n=e.elements.reset[0]),n&&n.focus&&(n.focus(),a.select&&n.select&&n.select())}}function X(e,t){if(!t)for(var a=b.length-1;a>-1;a-=1)if(b[a].isModal()){t=b[a];break}if(t&&t.isModal()){var n,r=e.srcElement||e.target,i=r===t.elements.reset[1]||0===t.__internal.buttons.length&&r===document.body;i&&(t.get("maximizable")?n=t.elements.commands.maximize:t.get("closable")&&(n=t.elements.commands.close)),void 0===n&&("number"==typeof t.__internal.focus.element?r===t.elements.reset[0]?n=t.elements.buttons.auxiliary.firstChild||t.elements.buttons.primary.firstChild:i&&(n=t.elements.reset[0]):r===t.elements.reset[0]&&(n=t.elements.buttons.primary.lastChild||t.elements.buttons.auxiliary.lastChild)),Z(t,n)}}function J(e,t){clearTimeout(t.__internal.timerIn),Z(t),n(),Be=!1,m("onfocus",t),w(t.elements.dialog,x.type,t.__internal.transitionInHandler),o(t.elements.root,Te.animationIn)}function K(e,t){clearTimeout(t.__internal.timerOut),w(t.elements.dialog,x.type,t.__internal.transitionOutHandler),ne(t),ue(t),t.isMaximized()&&!t.get("startMaximized")&&M(t),S.defaults.maintainFocus&&t.__internal.activeElement&&(t.__internal.activeElement.focus(),t.__internal.activeElement=null),"function"==typeof t.__internal.destroy&&t.__internal.destroy.apply(t)}function Q(e,t){var a=e[De]-Ae,n=e[Le]-Me;ze&&(n-=document.body.scrollTop),t.style.left=a+"px",t.style.top=n+"px"}function $(e,t){var a=e[De]-Ae,n=e[Le]-Me;ze&&(n-=document.body.scrollTop),t.style.left=Math.min(He.maxLeft,Math.max(He.minLeft,a))+"px",t.style.top=ze?Math.min(He.maxTop,Math.max(He.minTop,n))+"px":Math.max(He.minTop,n)+"px"}function ee(e,t){if(null===Ne&&!t.isMaximized()&&t.get("movable")){var a,n=0,r=0;if("touchstart"===e.type?(e.preventDefault(),a=e.targetTouches[0],De="clientX",Le="clientY"):0===e.button&&(a=e),a){var o=t.elements.dialog;if(i(o,Te.capture),o.style.left&&(n=parseInt(o.style.left,10)),o.style.top&&(r=parseInt(o.style.top,10)),Ae=a[De]-n,Me=a[Le]-r,t.isModal()?Me+=t.elements.modal.scrollTop:t.isPinned()&&(Me-=document.body.scrollTop),t.get("moveBounded")){var s=o,l=-n,u=-r;do{l+=s.offsetLeft,u+=s.offsetTop}while(s=s.offsetParent);He={maxLeft:l,minLeft:-l,maxTop:document.documentElement.clientHeight-o.clientHeight-u,minTop:-u},Ge=$}else He=null,Ge=Q;return m("onmove",t),ze=!t.isModal()&&t.isPinned(),je=t,Ge(a,o),i(document.body,Te.noSelection),!1}}}function te(e){if(je){var t;"touchmove"===e.type?(e.preventDefault(),t=e.targetTouches[0]):0===e.button&&(t=e),t&&Ge(t,je.elements.dialog)}}function ae(){if(je){var e=je;je=He=null,o(document.body,Te.noSelection),o(e.elements.dialog,Te.capture),m("onmoved",e)}}function ne(e){je=null;var t=e.elements.dialog;t.style.left=t.style.top=""}function re(e){e.get("movable")?(i(e.elements.root,Te.movable),e.isOpen()&&ge(e)):(ne(e),o(e.elements.root,Te.movable),e.isOpen()&&ve(e))}function ie(e,t,a){var n=t,r=0,i=0;do{r+=n.offsetLeft,i+=n.offsetTop}while(n=n.offsetParent);var o,l;!0===a?(o=e.pageX,l=e.pageY):(o=e.clientX,l=e.clientY);var u=s();if(u&&(o=document.body.offsetWidth-o,isNaN(Fe)||(r=document.body.offsetWidth-r-t.offsetWidth)),t.style.height=l-i+Ve+"px",t.style.width=o-r+Ve+"px",!isNaN(Fe)){var c=.5*Math.abs(t.offsetWidth-Ue);u&&(c*=-1),t.offsetWidth>Ue?t.style.left=Fe+c+"px":t.offsetWidth>=We&&(t.style.left=Fe-c+"px")}}function oe(e,t){if(!t.isMaximized()){var a;if("touchstart"===e.type?(e.preventDefault(),a=e.targetTouches[0]):0===e.button&&(a=e),a){m("onresize",t),Ne=t,Ve=t.elements.resizeHandle.offsetHeight/2;var n=t.elements.dialog;return i(n,Te.capture),Fe=parseInt(n.style.left,10),n.style.height=n.offsetHeight+"px",n.style.minHeight=t.elements.header.offsetHeight+t.elements.footer.offsetHeight+"px",n.style.width=(Ue=n.offsetWidth)+"px","none"!==n.style.maxWidth&&(n.style.minWidth=(We=n.offsetWidth)+"px"),n.style.maxWidth="none",i(document.body,Te.noSelection),!1}}}function se(e){if(Ne){var t;"touchmove"===e.type?(e.preventDefault(),t=e.targetTouches[0]):0===e.button&&(t=e),t&&ie(t,Ne.elements.dialog,!Ne.get("modal")&&!Ne.get("pinned"))}}function le(){if(Ne){var e=Ne;Ne=null,o(document.body,Te.noSelection),o(e.elements.dialog,Te.capture),Re=!0,m("onresized",e)}}function ue(e){Ne=null;var t=e.elements.dialog;"none"===t.style.maxWidth&&(t.style.maxWidth=t.style.minWidth=t.style.width=t.style.height=t.style.minHeight=t.style.left="",Fe=Number.Nan,Ue=We=Ve=0)}function ce(e){e.get("resizable")?(i(e.elements.root,Te.resizable),e.isOpen()&&ye(e)):(ue(e),o(e.elements.root,Te.resizable),e.isOpen()&&be(e))}function de(){for(var e=0;e-1&&a.navigator.userAgent.indexOf("Chrome")<0,Pe={dimmer:'
',modal:'
',dialog:'
',reset:'',commands:'
',header:'
',body:'
',content:'
',footer:'',buttons:{primary:'
',auxiliary:'
'},button:'',resizeHandle:'
'},Te={animationIn:"ajs-in",animationOut:"ajs-out",base:"alertify",basic:"ajs-basic",capture:"ajs-capture",closable:"ajs-closable",fixed:"ajs-fixed",frameless:"ajs-frameless",hidden:"ajs-hidden",maximize:"ajs-maximize",maximized:"ajs-maximized",maximizable:"ajs-maximizable",modeless:"ajs-modeless",movable:"ajs-movable",noSelection:"ajs-no-selection",noOverflow:"ajs-no-overflow",noPadding:"ajs-no-padding",pin:"ajs-pin",pinnable:"ajs-pinnable",prefix:"ajs-",resizable:"ajs-resizable",restore:"ajs-restore",shake:"ajs-shake",unpinned:"ajs-unpinned"},Oe="",Ie=0,Re=!1,Be=!1,je=null,Ae=0,Me=0,De="pageX",Le="pageY",He=null,ze=!1,Ge=null,Ne=null,Fe=Number.Nan,Ue=0,We=0,Ve=0;return{__init:e,isOpen:function(){return this.__internal.isOpen},isModal:function(){return this.elements.root.className.indexOf(Te.modeless)<0},isMaximized:function(){return this.elements.root.className.indexOf(Te.maximized)>-1},isPinned:function(){return this.elements.root.className.indexOf(Te.unpinned)<0},maximize:function(){return this.isMaximized()||A(this),this},restore:function(){return this.isMaximized()&&M(this),this},pin:function(){return this.isPinned()||B(this),this},unpin:function(){return this.isPinned()&&j(this),this},bringToFront:function(){return P(null,this),this},moveTo:function(e,t){if(!isNaN(e)&&!isNaN(t)){m("onmove",this);var a=this.elements.dialog,n=a,r=0,i=0;a.style.left&&(r-=parseInt(a.style.left,10)),a.style.top&&(i-=parseInt(a.style.top,10));do{r+=n.offsetLeft,i+=n.offsetTop}while(n=n.offsetParent);var o=e-r,l=t-i;s()&&(o*=-1),a.style.left=o+"px",a.style.top=l+"px",m("onmoved",this)}return this},resizeTo:function(e,t){var a=parseFloat(e),n=parseFloat(t),r=/(\d*\.\d+|\d+)%/;if(!isNaN(a)&&!isNaN(n)&&!0===this.get("resizable")){m("onresize",this),(""+e).match(r)&&(a=a/100*document.documentElement.clientWidth),(""+t).match(r)&&(n=n/100*document.documentElement.clientHeight);var i=this.elements.dialog;"none"!==i.style.maxWidth&&(i.style.minWidth=(We=i.offsetWidth)+"px"),i.style.maxWidth="none",i.style.minHeight=this.elements.header.offsetHeight+this.elements.footer.offsetHeight+"px",i.style.width=a+"px",i.style.height=n+"px",m("onresized",this)}return this},setting:function(e,t){var a=this,n=O(this,this.__internal.options,function(e,t,n){T(a,e,t,n)},e,t);if("get"===n.op)return n.found?n.value:void 0!==this.settings?O(this,this.settings,this.settingUpdated||function(){},e,t).value:void 0;if("set"===n.op){if(n.items.length>0)for(var r=this.settingUpdated||function(){},i=0;i0){var t=this;this.__internal.timer=setTimeout(function(){t.dismiss()},1e3*this.__internal.delay)}return this},setContent:function(e){if("string"==typeof e?(c(this.element),this.element.innerHTML=e):e instanceof a.HTMLElement&&this.element.firstChild!==e&&(c(this.element),this.element.appendChild(e)),this.__internal.closeButton){var t=document.createElement("span");i(t,f.close),t.setAttribute("data-close",!0),this.element.appendChild(t)}return this},dismissOthers:function(){return C.dismissAll(this),this}})}var l,u,d=[],f={base:"alertify-notifier",message:"ajs-message",top:"ajs-top",right:"ajs-right",bottom:"ajs-bottom",left:"ajs-left",center:"ajs-center",visible:"ajs-visible",hidden:"ajs-hidden",close:"ajs-close"};return{setting:function(t,a){if(e(this),void 0===a)return this.__internal[t];switch(t){case"position":this.__internal.position=a,r(this);break;case"delay":this.__internal.delay=a}return this},set:function(e,t){return this.setting(e,t),this},get:function(e){return this.setting(e)},create:function(t,a){e(this);var n=document.createElement("div");return n.className=f.message+("string"==typeof t&&""!==t?" ajs-"+t:""),s(n,a)},dismissAll:function(e){for(var t=d.slice(0),a=0;a',t+='',t+='
',t+='\t',t+='\t',t+="
",t+=""),a+=this.generateParamsHtml(),document.getElementById("popup").innerHTML='\n\t
\n\t\n\t\n\t
\n\t\t
\n\t\t
\n\t
\n\t
\n\t\t\n\t\t\n\t
\n',document.getElementById("pretitle_area").innerHTML=e,document.getElementById("popup_title").innerHTML=this.title,document.getElementById("popup_comment").innerHTML=this.comment,document.getElementById("preview_content").innerHTML=t,document.getElementById("params_content").innerHTML=a,0!=this.onfinish?document.getElementById("popup_cancel").style.display="":document.getElementById("popup_cancel").style.display="none",document.getElementById("popup").style.display="block",document.getElementById("popup").className=this.className;var n=this;document.getElementById("popup_ok").addEventListener("click",function(e){n.save()});for(var r=document.querySelectorAll("#popup input"),i=0;i',"Error"!=s&&void 0!=a.title&&(e+=''+a.title+""),void 0!=a.name){if(void 0!=a.values)if(a.values.length>10||"select"==a.type){e+='"}else{e+='',a.values.length>2&&(e+='
');var n=0;for(var r in a.values){var o="";a.value==a.values[r]&&(o='checked="checked"'),void 0==a.value&&0==n&&(o='checked="checked"');var s=a.values[r],l=a.values[r].split(" - ");l.length>1&&(s=l[0]+' - '+l[1]+""),e+='',e+='",a.values.length>2&&(e+="
"),n++}a.values.length>2&&(e+="
"),e+=""}else if(void 0!=a.value){var u=1;if(void 0!=a.step&&(u=a.step),void 0!=a.range)e+='',e+=''+a.value+"";else if("color"==a.type)e+='';else if("boolean"==typeof a.value){var c="";!0===a.value&&(c="checked"),e+=' '}else if(void 0==a.placeholder&&(a.placeholder=""),"textarea"==a.type)e+='";else{var d="text";void 0==a.placeholder||""==a.placeholder||isNaN(a.placeholder)||(d="number"),void 0!=a.value&&"number"==typeof a.value&&(d="number"),e+=''}}}else if(void 0!=a.function){var f;f=a.function(),e+=''+f+""}else if(void 0!=a.html)e+=''+a.html+"";else if(void 0==a.title)e+='';else{var h=""+a.value,p=a.title.toLowerCase().replace(/[^\w]+/g,"").replace(/ +/g,"-");p=p.substring(0,10),e+=h.length<40?'
'+a.value+"
":'"}e+=""}return e+=""}},{key:"validate",value:function(e){for(var t in this.parameters){var a=this.parameters[t];if("pop_data_"+a.name==e.id&&void 0!=a.range){if("-"==e.value||""==e.value)return!0;var n=parseFloat(e.value);(isNaN(n)||n!=e.value)&&(e.value=a.value),na.range[1]&&(e.value=a.range[1])}}}},{key:"onkeyup",value:function(e){"13"==e.keyCode&&this.save()}},{key:"get_dimensions",value:function(){var e,t;return window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&(e=document.body.clientWidth),window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&(t=document.body.clientHeight),[e,t]}},{key:"getRandomInt",value:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}},{key:"strpos",value:function(e,t,a){var n=(e+"").indexOf(t,a||0);return-1!==n&&n}},{key:"draw_background",value:function(e,t,a,n,r){if(0==s.default.TRANSPARENCY&&void 0==r)return e.beginPath(),e.rect(0,0,t,a),e.fillStyle="#ffffff",e.fill(),!1;void 0==n&&(n=10);for(var i=!0,o=0;o-1||(e[t]=this.Base_gui.modules[t]);return e}},{key:"render_effect_browser",value:function(){if(0==this.effects)return"";var e="",t=this.get_effects_list(),a=!1;this.ef_index=null,this.ef_next_index=null,this.ef_prev_index=null;for(var n in t){if(1==a){this.ef_next_index=n;break}var r=this.get_filter_title(n);r.toLowerCase()!=this.title.toLowerCase()?this.ef_prev_index=n:(this.ef_index=n,a=!0)}e+='',e+=' ',e+='",e+=' ',e+=""}},{key:"add_effects_browser_events",value:function(){if(0!=this.effects){var e=this,t=this.get_effects_list(),a=this.ef_prev_index,n=this.ef_next_index;document.getElementById("previous_filter").disabled=!1,document.getElementById("next_filter").disabled=!1,null==a&&(document.getElementById("previous_filter").disabled=!0),null==n&&(document.getElementById("next_filter").disabled=!0),document.getElementById("previous_filter").addEventListener("click",function(n){e.hide();var r=a.toLowerCase().replace(/ /g,"_").replace("effects/","");t[a][r]()}),document.getElementById("next_filter").addEventListener("click",function(a){e.hide();var r=n.toLowerCase().replace(/ /g,"_").replace("effects/","");t[n][r]()});var r=document.getElementById("effect_browser");r.addEventListener("change",function(a){e.hide();var n=r.options[r.selectedIndex].value,i=n.toLowerCase().replace(/ /g,"_").replace("effects/","");t[n][i]()})}}},{key:"get_filter_title",value:function(e){var t=e.replace("effects/","").replace(/_/g," ");return"negative"==t&&(t="invert"),t}}]),e}();t.default=m},function(e,t,a){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var a=0;a0){var t=document.cookie.indexOf(e+"=");if(-1!=t){t+=e.length+1;var a=document.cookie.indexOf(";",t);return-1==a&&(a=document.cookie.length),document.cookie.substring(t,a)}}return""}},{key:"_setCookie",value:function(e,t,a){void 0==a&&(a=180);var n=new Date;n.setTime(n.getTime()+24*a*3600*1e3),document.cookie=e+"="+t+(null==a?"":"; expires="+n.toGMTString())}},{key:"delCookie",value:function(e){this.getCookie(e)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT")}},{key:"getRandomInt",value:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}},{key:"font_pixel_to_height",value:function(e){return Math.round(.75*e)}},{key:"rgbToHex",value:function(e,t,a){if(e>255||t>255||a>255)throw"Invalid color component";return"#"+("000000"+(e<<16|t<<8|a).toString(16)).slice(-6)}},{key:"rgb2hex_all",value:function(e){return e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),"#"+this.hex(e[1])+this.hex(e[2])+this.hex(e[3])}},{key:"hex",value:function(e){return e=parseInt(e),("0"+e.toString(16)).slice(-2)}},{key:"hex2rgb",value:function(e){if("#"==e[0]&&(e=e.substr(1)),3==e.length){var t=e;e="",t=/^([a-f0-9])([a-f0-9])([a-f0-9])$/i.exec(t).slice(1);for(var a=0;a<3;a++)e+=t[a]+t[a]}var n=/^([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(e).slice(1);return{r:parseInt(n[0],16),g:parseInt(n[1],16),b:parseInt(n[2],16),a:255}}},{key:"remove_selection",value:function(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty()}},{key:"darkenColor",value:function(e,t){e.length>6&&(e=e.substring(1,e.length));var a=parseInt(e,16),n=Math.abs((a>>16&255)+t);n>255&&(n-=n-255);var r=Math.abs((a>>8&255)+t);r>255&&(r-=r-255);var i=Math.abs((255&a)+t);return i>255&&(i-=i-255),n=Number(n<0||isNaN(n))?0:(n>255?255:n).toString(16),1==n.length&&(n="0"+n),r=Number(r<0||isNaN(r))?0:(r>255?255:r).toString(16),1==r.length&&(r="0"+r),i=Number(i<0||isNaN(i))?0:(i>255?255:i).toString(16),1==i.length&&(i="0"+i),"#"+n+r+i}},{key:"number_format",value:function(e,t,a,n){var t=isNaN(t=Math.abs(t))?2:t,n=void 0==n?".":n,a=void 0==a?",":a,r=e<0?"-":"",i=parseInt(e=Math.abs(+e||0).toFixed(t))+"",o=(o=i.length)>3?o%3:0;return r+(o?i.substr(0,o)+a:"")+i.substr(o).replace(/(\d{3})(?=\d)/g,"$1"+a)+(t?n+Math.abs(e-i).toFixed(t).slice(2):"")}},{key:"chech_input_color_support",value:function(){var e=document.createElement("input");return e.setAttribute("type","color"),"text"!==e.type}},{key:"b64toBlob",value:function(e,t,a){t=t||"",a=a||512;for(var n=atob(e),r=[],i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}},{key:"isNumeric",value:function(e){return!isNaN(parseFloat(e))&&isFinite(e)}},{key:"hslToRgb",value:function(e,t,a){var n,r,i;if(0==t)n=r=i=a;else{var o=a<.5?a*(1+t):a+t-a*t,s=2*a-o;n=this.hue2rgb(s,o,e+1/3),r=this.hue2rgb(s,o,e),i=this.hue2rgb(s,o,e-1/3)}return[Math.round(255*n),Math.round(255*r),Math.round(255*i)]}},{key:"hue2rgb",value:function(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e}},{key:"rgbToHsl",value:function(e,t,a){e/=255,t/=255,a/=255;var n,r,i=Math.max(e,t,a),o=Math.min(e,t,a),s=(i+o)/2;if(i==o)n=r=0;else{var l=i-o;switch(r=s>.5?l/(2-i-o):l/(i+o),i){case e:n=(t-a)/l+(t6&&void 0!==arguments[6]&&arguments[6],s=document.createElement("canvas");s.width=n,s.height=r;var l=Math.round(n/2),u=Math.round(r/2),c=s.getContext("2d"),d=s.width,f=s.height,h=t-l,p=a-u;c.clearRect(0,0,d,f),c.save(),c.putImageData(i,0,0),c.globalCompositeOperation="destination-in";var m=c.createRadialGradient(l,u,0,l,u,l);m.addColorStop(0,"#ffffff"),1==o?m.addColorStop(.8,"#ffffff"):m.addColorStop(.99,"#ffffff"),m.addColorStop(1,"rgba(255,255,255,0"),c.fillStyle=m,c.beginPath(),c.ellipse(l,u,2*n,2*r,0,0,2*Math.PI),c.fill(),e.drawImage(s,0,0,n,r,h,p,n,r),c.restore(),c.clearRect(0,0,d,f)}},{key:"is_edge_or_ie",value:function(){return!window.ActiveXObject&&"ActiveXObject"in window||-1!=navigator.userAgent.indexOf("Edge/")}}]),e}();t.default=i},function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a15?i+=2:i-=2,i=Math.max(0,i),i=Math.min(30,i)}},{key:"get_params_hash",value:function(){var e=[this.getParams(),s.default.COLOR,s.default.ALPHA];return JSON.stringify(e)}},{key:"clone",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"show_mouse_cursor",value:function(e,t,a,n){var r=this.Base_layers.get_world_coords(0,0);e-=r.x,t-=r.y;var i=document.getElementById("mouse");if(a*=s.default.ZOOM,e*=s.default.ZOOM,t*=s.default.ZOOM,a<5)return void(i.className="");i.style.width=a+"px",i.style.height=a+"px",i.style.left=e-Math.ceil(a/2)+"px",i.style.top=t-Math.ceil(a/2)+"px",i.className="",i.classList.add(n)}},{key:"getParams",value:function(){return s.default.TOOL.attributes}},{key:"adaptSize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"width";return null==s.default.layer.width_original?e:"width"===t?e/(s.default.layer.width/s.default.layer.width_original):e/(s.default.layer.height/s.default.layer.height_original)}}]),e}();t.default=c},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={};n.utils={initSampleCanvas:function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.width=0,e.height=0,this.getSampleCanvas=function(){return e},this.getSampleContext=function(){return t},this.createImageData=t.createImageData?function(e,a){return t.createImageData(e,a)}:function(e,t){return new ImageData(e,t)}},getSampleCanvas:function(){return this.initSampleCanvas(),this.getSampleCanvas()},getSampleContext:function(){return this.initSampleCanvas(),this.getSampleContext()},createImageData:function(e,t){return this.initSampleCanvas(),this.createImageData(e,t)},clamp:function(e){return e>255?255:e<0?0:e},buildMap:function(e){for(var t,a=[],n=0;n<256;n+=1)a[n]=(t=e(n))>255?255:t<0?0:0|t;return a},applyMap:function(e,t,a){for(var n=0,r=e.length;n=a||t<0||t>=n)switch(r){case 1:e=e<0?0:e>=a?a-1:e,t=t<0?0:t>=n?n-1:t;break;case 2:e=(e%=a)<0?e+a:e,t=(t%=n)<0?t+n:t;break;default:return null}return t*a+e<<2},getPixel:function(e,t,a,n,r,i){if(t<0||t>=n||a<0||a>=r)switch(i){case 1:t=t<0?0:t>=n?n-1:t,a=a<0?0:a>=r?r-1:a;break;case 2:t=(t%=n)<0?t+n:t,a=(a%=r)<0?a+r:a;break;default:return 0}var o=a*n+t<<2;return e[o+3]<<24|e[o]<<16|e[o+1]<<8|e[o+2]},getPixelByIndex:function(e,t){return e[t+3]<<24|e[t]<<16|e[t+1]<<8|e[t+2]},copyBilinear:function(e,t,a,n,r,i,o,s){var l,u,c,d,f,h,p,m=t<0?t-1|0:0|t,g=a<0?a-1|0:0|a,v=t-m,y=a-g,b=0,_=0,w=0,x=0;if(m>=0&&m=0&&g>16&255,i[o+1]=b>>8&255,i[o+2]=255&b,void(i[o+3]=b>>24&255);_=this.getPixel(e,m+1,g,n,r,s),w=this.getPixel(e,m,g+1,n,r,s),x=this.getPixel(e,m+1,g+1,n,r,s)}u=1-v,c=1-y,d=((b>>16&255)*u+(_>>16&255)*v)*c+((w>>16&255)*u+(x>>16&255)*v)*y,f=((b>>8&255)*u+(_>>8&255)*v)*c+((w>>8&255)*u+(x>>8&255)*v)*y,h=((255&b)*u+(255&_)*v)*c+((255&w)*u+(255&x)*v)*y,p=((b>>24&255)*u+(_>>24&255)*v)*c+((w>>24&255)*u+(x>>24&255)*v)*y,i[o]=d>255?255:d<0?0:0|d,i[o+1]=f>255?255:f<0?0:0|f,i[o+2]=h>255?255:h<0?0:0|h,i[o+3]=p>255?255:p<0?0:0|p},rgbToHsl:function(e,t,a){e/=255,t/=255,a/=255;var n=e>t?e>a?e:a:t>a?t:a,r=e.5?i/(2-n-r):i/(n+r)),[o,s,l]},hslToRgb:function(e,t,a){var n,r,i,o,s,l,u=[];if(0===t)o=s=l=255*a+.5|0,u=[o,s,l];else{r=a<=.5?a*(t+1):a+t-a*t,n=2*a-r,i=e+1/3;for(var c,d=0;d<3;d+=1)i<0?i+=1:i>1&&(i-=1),c=6*i<1?n+(r-n)*i*6:2*i<1?r:3*i<2?n+(r-n)*(2/3-i)*6:n,u[d]=255*c+.5|0,i-=1/3}return u}},n.Translate=function(e,t,a,n){},n.Scale=function(e,t,a,n){},n.Rotate=function(e,t,a,n,r,i){},n.Affine=function(e,t,a,n){},n.UnsharpMask=function(e,t){},n.ConvolutionFilter=function(e,t,a,n,r,i,o,s,l,u){var c=e.data,d=e.width,f=e.height,h=(c.length,this.utils.createImageData(d,f)),p=h.data;r=r||1,i=i||0,!1!==o&&(o=!0),!1!==s&&(s=!0),l=l||0,u=u||0;for(var m=0,g=t>>1,v=a>>1,y=l>>16&255,b=l>>8&255,_=255&l,w=255*u,x=0;x255?255:C<0?0:0|C,p[m+1]=(C=E/r+i)>255?255:C<0?0:0|C,p[m+2]=(C=P/r+i)>255?255:C<0?0:0|C,p[m+3]=o?c[m+3]:(C=T/r+i)>255?255:C<0?0:0|C}return h},n.Binarize=function(e,t){var a=e.data,n=e.width,r=e.height,i=a.length,o=this.utils.createImageData(n,r),s=o.data;isNaN(t)&&(t=.5),t*=255;for(var l=0;l255?255:r,c[f+1]=(r=i[f+1]+d[f+1])>255?255:r,c[f+2]=(r=i[f+2]+d[f+2])>255?255:r,c[f+3]=255;return u},n.BlendSubtract=function(e,t,a,n){for(var r,i=e.data,o=e.width,s=e.height,l=i.length,u=this.utils.createImageData(o,s),c=u.data,d=t.data,f=0;fw&&(v=w),y=m-r,y<0&&(y=0),d=x+v<<2,f=x+y<<2,i+=e[d]-e[f],o+=e[d+1]-e[f+1],s+=e[d+2]-e[f+2],l+=e[d+3]-e[f+3],u+=n;x+=a}};return function(t,a,n,r){for(var i=t.data,o=t.width,s=t.height,l=(i.length,this.utils.createImageData(o,s)),u=l.data,c=this.utils.createImageData(o,s),d=c.data,f=0;f>V,D[c+1]=h*W>>V,D[c+2]=p*W>>V,D[c+3]=m*W>>V,f-=g,h-=v,p-=y,m-=b,g-=O.r,v-=O.g,y-=O.b,b-=O.a,l=d+((l=i+r+1)>V,D[l+1]=h*W>>V,D[l+2]=p*W>>V,D[l+3]=m*W>>V,f-=g,h-=v,p-=y,m-=b,g-=O.r,v-=O.g,y-=O.b,b-=O.a,l=i+((l=o+G)255?255:e}),i},n.BrightnessContrastGimp=function(e,t,a){var n=e.data,r=e.width,i=e.height,o=n.length,s=this.utils.createImageData(r,i),l=s.data,u=Math.PI/4;t/=100,a*=.99,a/=100,a=Math.tan((a+1)*u);for(var c=0,d=0;d>16;return c/=o/4,this.utils.mapRGB(n,l,function(e){return t<0?e*=1+t:t>0&&(e+=(255-e)*t),0!==a&&(e=(e-c)*a+c),e+.5|0}),s},n.BrightnessContrastPhotoshop=function(e,t,a){var n=e.data,r=e.width,i=e.height,o=(n.length,this.utils.createImageData(r,i)),s=o.data;return t=(t+100)/100,a=(a+100)/100,this.utils.mapRGB(n,s,function(e){return e*=t,(e=(e-127.5)*a+127.5)+.5|0}),o},n.Channels=function(e,t){var a;switch(t){case 2:a=[0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0];break;case 3:a=[0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0];break;default:a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0]}return this.ColorMatrixFilter(e,a)},n.Clone=function(e){return this.Copy(e,this.utils.createImageData(e.width,e.height))},n.CloneBuiltin=function(e){var t,a=e.width,n=e.height,r=this.utils.getSampleCanvas(),i=this.utils.getSampleContext();return r.width=a,r.height=n,i.putImageData(e,0,0),t=i.getImageData(0,0,a,n),r.width=0,r.height=0,t},n.ColorMatrixFilter=function(e,t){var a,n,r,i,o,s,l=e.data,u=e.width,c=e.height,d=l.length,f=this.utils.createImageData(u,c),h=f.data,p=t[0],m=t[1],g=t[2],v=t[3],y=t[4],b=t[5],_=t[6],w=t[7],x=t[8],k=t[9],C=t[10],S=t[11],E=t[12],P=t[13],T=t[14],O=t[15],I=t[16],R=t[17],B=t[18],j=t[19];for(n=0;n255?255:a<0?0:0|a,h[n+1]=(a=r*b+i*_+o*w+s*x+k)>255?255:a<0?0:0|a,h[n+2]=(a=r*C+i*S+o*E+s*P+T)>255?255:a<0?0:0|a,h[n+3]=(a=r*O+i*I+o*R+s*B+j)>255?255:a<0?0:0|a;return f},n.ColorTransformFilter=function(e,t,a,n,r,i,o,s,l){var u,c,d=e.data,f=e.width,h=e.height,p=d.length,m=this.utils.createImageData(f,h),g=m.data;for(u=0;u255?255:c<0?0:c,g[u+1]=(c=d[u+1]*a+o)>255?255:c<0?0:c,g[u+2]=(c=d[u+2]*n+s)>255?255:c<0?0:c,g[u+3]=(c=d[u+3]*r+l)>255?255:c<0?0:c;return m},n.Copy=function(e,t){for(var a=e.data,n=a.length,r=t.data;n--;)r[n]=a[n];return t},n.Crop=function(e,t,a,n,r){var i,o,s,l,u=e.data,c=e.width,d=e.height,f=(u.length,this.utils.createImageData(n,r)),h=f.data,p=Math.max(t,0),m=Math.max(a,0),g=Math.min(t+n,c),v=Math.min(a+r,d),y=p-t,b=m-a;for(i=m,dstRow=b;iu?l>c?l:c:u>c?u:c,f=l=P||k>=T?g=m:(v=(k-r)*C+(x-a)<<2,y=E[v+i],_=x+((y-128)*s>>8),b=E[v+o],w=k+((b-128)*l>>8),null===(g=n.utils.getPixelIndex(_+.5|0,w+.5|0,d,f,u))&&(g=m)),p[m]=c[g],p[m+1]=c[g+1],p[m+2]=c[g+2],p[m+3]=c[g+3];return h},n.Dither=function(e,t){var a=e.width,n=e.height,r=this.Clone(e),i=r.data;t=t<2?2:t>255?255:t;var o,s,l=[],u=t-1,c=0,d=0;for(s=0;s255&&(d-=255,c+=1),a});var f,h,p,m,g,v,y,b,_,w,x,k,C,S,E,P=a-1,T=n-1,O=7/16,I=3/16,R=5/16,B=1/16;for(h=0;h255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E),p+=a-2<<2,f>0&&h255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E),p+=4,h255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E),p+=4,f255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E);return r},n.Edge=function(e){return this.ConvolutionFilter(e,3,3,[-1,-1,-1,-1,8,-1,-1,-1,-1])},n.Emboss=function(e){return this.ConvolutionFilter(e,3,3,[-2,-1,0,-1,1,1,0,1,2])},n.Enrich=function(e){return this.ConvolutionFilter(e,3,3,[0,-2,0,-2,20,-2,0,-2,0],10,-40)},n.Flip=function(e,t){var a,n,r,i,o=e.data,s=e.width,l=e.height,u=(o.length,this.utils.createImageData(s,l)),c=u.data;for(n=0;n255?255:e+.5|0}),i},n.GrayScale=function(e){for(var t=e.data,a=e.width,n=e.height,r=t.length,i=this.utils.createImageData(a,n),o=i.data,s=0;s>16;o[s]=o[s+1]=o[s+2]=l,o[s+3]=t[s+3]}return i},n.HSLAdjustment=function(e,t,a,n){var r=e.data,i=e.width,o=e.height,s=r.length,l=this.utils.createImageData(i,o),u=l.data;t/=360,a/=100,n/=100;var c,d,f,h,p,m,g=this.utils.rgbToHsl,v=this.utils.hslToRgb;for(m=0;m1;)c-=1;d=h[1]+h[1]*a,d<0?d=0:d>1&&(d=1),f=h[2],n>0?f+=(1-f)*n:n<0&&(f+=f*n),p=v(c,d,f),u[m]=p[0],u[m+1]=p[1],u[m+2]=p[2],u[m+3]=r[m+3]}return l},n.Invert=function(e){var t=e.data,a=e.width,n=e.height,r=(t.length,this.utils.createImageData(a,n)),i=r.data;return this.utils.mapRGB(t,i,function(e){return 255-e}),r},n.Mosaic=function(e,t){var a,n,r,i,o,s,l,u,c,d,f,h,p,m,g,v=e.data,y=e.width,b=e.height,_=(v.length,this.utils.createImageData(y,b)),w=_.data,x=Math.ceil(y/t),k=Math.ceil(b/t);for(a=0;ab&&(s=b),n=0;ny&&(i=y),h=p=m=g=0,f=(i-r)*(s-o),u=o;u=k))for(c=l*x,s=-t;s<=t;s+=1)(u=n+s)<0||u>=x||(d=c+u<<2,f=w[d],h=w[d+1],p=w[d+2],m=f*a>>8,g=h*a>>8,v=p*a>>8,I[m]+=f,R[g]+=h,B[v]+=p,P[m]+=1,T[g]+=1,O[v]+=1);for(y=b=_=0,i=1;iP[y]&&(y=i),T[i]>T[b]&&(b=i),O[i]>O[_]&&(_=i);S[E]=I[y]/P[y]|0,S[E+1]=R[b]/T[b]|0,S[E+2]=B[_]/O[_]|0,S[E+3]=w[E+3],E+=4}return C},n.OpacityFilter=function(e,t){for(var a=e.data,n=e.width,r=e.height,i=a.length,o=this.utils.createImageData(n,r),s=o.data,l=0;l255?255:t;var s,l=[],u=t-1,c=0,d=0;for(s=0;s255&&(d-=255,c+=1),a}),i},n.Rescale=function(e,t){var a=e.data,n=e.width,r=e.height,i=(a.length,this.utils.createImageData(n,r)),o=i.data;return this.utils.mapRGB(a,o,function(e){return e*=t,e>255?255:e+.5|0}),i},n.ResizeNearestNeighbor=function(e,t,a){var n,r,i,o,s=e.data,l=e.width,u=e.height,c=(s.length,this.utils.createImageData(t,a)),d=c.data,f=l/t,h=u/a,p=0;for(i=0;i255?255:i<0?0:i+.5|0,d[r+1]=(i=.349*t+.686*a+.168*n)>255?255:i<0?0:i+.5|0,d[r+2]=(i=.272*t+.534*a+.131*n)>255?255:i<0?0:i+.5|0,d[r+3]=o[r+3];return c},n.Sharpen=function(e,t){return this.ConvolutionFilter(e,3,3,[-t/16,-t/8,-t/16,-t/8,.75*t+1,-t/8,-t/16,-t/8,-t/16])},n.Solarize=function(e){var t=e.data,a=e.width,n=e.height,r=(t.length,this.utils.createImageData(a,n)),i=r.data;return this.utils.mapRGB(t,i,function(e){return e>127?2*(e-127.5):2*(127.5-e)}),r},n.Transpose=function(e){var t,a,n=e.data,r=e.width,i=e.height,o=(n.length,this.utils.createImageData(i,r)),s=o.data;for(y=0;yw?(d[x]=s[x],d[x+1]=s[x+1],d[x+2]=s[x+2],d[x+3]=s[x+3]):(g=Math.sqrt(g),v=Math.atan2(m,p)+r*(n-g)/n,y=t+g*Math.cos(v),b=a+g*Math.sin(v),o?this.utils.copyBilinear(s,y,b,l,u,d,x,i):(_=(b+.5|0)*l+(y+.5|0)<<2,d[x]=s[_],d[x+1]=s[_+1],d[x+2]=s[_+2],d[x+3]=s[_+3])),x+=4;return c},t.default=n},function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a=0;o--)if(!(this.common_dimensions[o][0]>t||this.common_dimensions[o][1]>a)){s.default.WIDTH=parseInt(this.common_dimensions[o][0]),s.default.HEIGHT=parseInt(this.common_dimensions[o][1]),n=!0;break}0==n&&(s.default.WIDTH=parseInt(t)-5,s.default.HEIGHT=parseInt(a)-10,t<585&&(s.default.HEIGHT=s.default.HEIGHT-15))}}},{key:"render_canvas_background",value:function(e,t){void 0==t&&(t=10);var a=document.getElementById(e+"_background");if(0==s.default.TRANSPARENCY)return a.className="transparent-grid white",!1;a.className="transparent-grid "+s.default.TRANSPARENCY_TYPE,a.style.backgroundSize=2*t+"px auto"}},{key:"draw_grid",value:function(e){if(0!=this.grid){var t=this.grid_size[0],a=this.grid_size[1],n=s.default.WIDTH,r=s.default.HEIGHT;void 0!=t&&void 0!=a?this.grid_size=[t,a]:(t=this.grid_size[0],a=this.grid_size[1]),t=parseInt(t),a=parseInt(a),e.lineWidth=1,e.beginPath(),t<2&&(t=2),a<2&&(a=2);for(var i=t;i0.0){color.rgb=(color.rgb-0.5)/(1.0-contrast)+0.5;}else{color.rgb=(color.rgb-0.5)*(1.0+contrast)+0.5;}gl_FragColor=color;}"),o.call(this,z.brightnessContrast,{brightness:e(-1,t,1),contrast:e(-1,a,1)}),this}function g(t){t=new h(t);for(var a=[],n=0;256>n;n++)a.push(e(0,Math.floor(256*t.interpolate(n/255)),255));return a}function v(e,t,a){e=g(e),1==arguments.length?t=a=e:(t=g(t),a=g(a));for(var n=[],r=0;256>r;r++)n.splice(n.length,0,e[r],t[r],a[r],255);return this._.extraTexture.initFromBytes(256,1,n),this._.extraTexture.use(1),z.curves=z.curves||new G(null,"uniform sampler2D texture;uniform sampler2D map;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);color.r=texture2D(map,vec2(color.r)).r;color.g=texture2D(map,vec2(color.g)).g;color.b=texture2D(map,vec2(color.b)).b;gl_FragColor=color;}"),z.curves.textures({map:1}),o.call(this,z.curves,{}),this}function y(e){z.denoise=z.denoise||new G(null,"uniform sampler2D texture;uniform float exponent;uniform float strength;uniform vec2 texSize;varying vec2 texCoord;void main(){vec4 center=texture2D(texture,texCoord);vec4 color=vec4(0.0);float total=0.0;for(float x=-4.0;x<=4.0;x+=1.0){for(float y=-4.0;y<=4.0;y+=1.0){vec4 sample=texture2D(texture,texCoord+vec2(x,y)/texSize);float weight=1.0-abs(dot(sample.rgb-center.rgb,vec3(0.25)));weight=pow(weight,exponent);color+=sample*weight;total+=weight;}}gl_FragColor=color/total;}");for(var t=0;2>t;t++)o.call(this,z.denoise,{exponent:Math.max(0,e),texSize:[this.width,this.height]});return this}function b(t,a){return z.hueSaturation=z.hueSaturation||new G(null,"uniform sampler2D texture;uniform float hue;uniform float saturation;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float angle=hue*3.14159265;float s=sin(angle),c=cos(angle);vec3 weights=(vec3(2.0*c,-sqrt(3.0)*s-c,sqrt(3.0)*s-c)+1.0)/3.0;float len=length(color.rgb);color.rgb=vec3(dot(color.rgb,weights.xyz),dot(color.rgb,weights.zxy),dot(color.rgb,weights.yzx));float average=(color.r+color.g+color.b)/3.0;if(saturation>0.0){color.rgb+=(average-color.rgb)*(1.0-1.0/(1.001-saturation));}else{color.rgb+=(average-color.rgb)*(-saturation);}gl_FragColor=color;}"),o.call(this,z.hueSaturation,{hue:e(-1,t,1),saturation:e(-1,a,1)}),this}function _(t){return z.noise=z.noise||new G(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;float rand(vec2 co){return fract(sin(dot(co.xy,vec2(12.9898,78.233)))*43758.5453);}void main(){vec4 color=texture2D(texture,texCoord);float diff=(rand(texCoord)-0.5)*amount;color.r+=diff;color.g+=diff;color.b+=diff;gl_FragColor=color;}"),o.call(this,z.noise,{amount:e(0,t,1)}),this}function w(t){return z.sepia=z.sepia||new G(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float r=color.r;float g=color.g;float b=color.b;color.r=min(1.0,(r*(1.0-(0.607*amount)))+(g*(0.769*amount))+(b*(0.189*amount)));color.g=min(1.0,(r*0.349*amount)+(g*(1.0-(0.314*amount)))+(b*0.168*amount));color.b=min(1.0,(r*0.272*amount)+(g*0.534*amount)+(b*(1.0-(0.869*amount))));gl_FragColor=color;}"),o.call(this,z.sepia,{amount:e(0,t,1)}),this}function x(e,t){return z.unsharpMask=z.unsharpMask||new G(null,"uniform sampler2D blurredTexture;uniform sampler2D originalTexture;uniform float strength;uniform float threshold;varying vec2 texCoord;void main(){vec4 blurred=texture2D(blurredTexture,texCoord);vec4 original=texture2D(originalTexture,texCoord);gl_FragColor=mix(blurred,original,1.0+strength);}"),this._.extraTexture.ensureFormat(this._.texture),this._.texture.use(),this._.extraTexture.drawTo(function(){G.getDefaultShader().drawRect()}),this._.extraTexture.use(1),this.triangleBlur(e),z.unsharpMask.textures({originalTexture:1}),o.call(this,z.unsharpMask,{strength:t}),this._.extraTexture.unuse(1),this}function k(t){return z.vibrance=z.vibrance||new G(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float average=(color.r+color.g+color.b)/3.0;float mx=max(color.r,max(color.g,color.b));float amt=(mx-average)*(-amount*3.0);color.rgb=mix(color.rgb,vec3(mx),amt);gl_FragColor=color;}"),o.call(this,z.vibrance,{amount:e(-1,t,1)}),this}function C(t,a){return z.vignette=z.vignette||new G(null,"uniform sampler2D texture;uniform float size;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float dist=distance(texCoord,vec2(0.5,0.5));color.rgb*=smoothstep(0.8,size*0.799,dist*(amount+size));gl_FragColor=color;}"),o.call(this,z.vignette,{size:e(0,t,1),amount:e(0,a,1)}),this}function S(t,a,n){z.lensBlurPrePass=z.lensBlurPrePass||new G(null,"uniform sampler2D texture;uniform float power;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);color=pow(color,vec4(power));gl_FragColor=vec4(color);}");var r="uniform sampler2D texture0;uniform sampler2D texture1;uniform vec2 delta0;uniform vec2 delta1;uniform float power;varying vec2 texCoord;"+F+"vec4 sample(vec2 delta){float offset=random(vec3(delta,151.7182),0.0);vec4 color=vec4(0.0);float total=0.0;for(float t=0.0;t<=30.0;t++){float percent=(t+offset)/30.0;color+=texture2D(texture0,texCoord+delta*percent);total+=1.0;}return color/total;}";z.lensBlur0=z.lensBlur0||new G(null,r+"void main(){gl_FragColor=sample(delta0);}"),z.lensBlur1=z.lensBlur1||new G(null,r+"void main(){gl_FragColor=(sample(delta0)+sample(delta1))*0.5;}"),z.lensBlur2=z.lensBlur2||new G(null,r+"void main(){vec4 color=(sample(delta0)+2.0*texture2D(texture1,texCoord))/3.0;gl_FragColor=pow(color,vec4(power));}").textures({texture1:1});for(var r=[],i=0;3>i;i++){var s=n+2*i*Math.PI/3;r.push([t*Math.sin(s)/this.width,t*Math.cos(s)/this.height])}return t=Math.pow(10,e(-1,a,1)),o.call(this,z.lensBlurPrePass,{power:t}),this._.extraTexture.ensureFormat(this._.texture),o.call(this,z.lensBlur0,{delta0:r[0]},this._.texture,this._.extraTexture),o.call(this,z.lensBlur1,{delta0:r[1],delta1:r[2]},this._.extraTexture,this._.extraTexture),o.call(this,z.lensBlur0,{delta0:r[1]}),this._.extraTexture.use(1),o.call(this,z.lensBlur2,{power:1/t,delta0:r[2]}),this}function E(e,t,a,n,r,i){z.tiltShift=z.tiltShift||new G(null,"uniform sampler2D texture;uniform float blurRadius;uniform float gradientRadius;uniform vec2 start;uniform vec2 end;uniform vec2 delta;uniform vec2 texSize;varying vec2 texCoord;"+F+"void main(){vec4 color=vec4(0.0);float total=0.0;float offset=random(vec3(12.9898,78.233,151.7182),0.0);vec2 normal=normalize(vec2(start.y-end.y,end.x-start.x));float radius=smoothstep(0.0,1.0,abs(dot(texCoord*texSize-start,normal))/gradientRadius)*blurRadius;for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec4 sample=texture2D(texture,texCoord+delta/texSize*percent*radius);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}");var s=a-e,l=n-t,u=Math.sqrt(s*s+l*l);return o.call(this,z.tiltShift,{blurRadius:r,gradientRadius:i,start:[e,t],end:[a,n],delta:[s/u,l/u],texSize:[this.width,this.height]}),o.call(this,z.tiltShift,{blurRadius:r,gradientRadius:i,start:[e,t],end:[a,n],delta:[-l/u,s/u],texSize:[this.width,this.height]}),this}function P(e){return z.triangleBlur=z.triangleBlur||new G(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+F+"void main(){vec4 color=vec4(0.0);float total=0.0;float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec4 sample=texture2D(texture,texCoord+delta*percent);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}"),o.call(this,z.triangleBlur,{delta:[e/this.width,0]}),o.call(this,z.triangleBlur,{delta:[0,e/this.height]}),this}function T(e,t,a){return z.zoomBlur=z.zoomBlur||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float strength;uniform vec2 texSize;varying vec2 texCoord;"+F+"void main(){vec4 color=vec4(0.0);float total=0.0;vec2 toCenter=center-texCoord*texSize;float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=0.0;t<=40.0;t++){float percent=(t+offset)/40.0;float weight=4.0*(percent-percent*percent);vec4 sample=texture2D(texture,texCoord+toCenter*percent*strength/texSize);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}"),o.call(this,z.zoomBlur,{center:[e,t],strength:a,texSize:[this.width,this.height]}),this}function O(e,t,a,n){return z.colorHalftone=z.colorHalftone||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float angle;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;float pattern(float angle){float s=sin(angle),c=cos(angle);vec2 tex=texCoord*texSize-center;vec2 point=vec2(c*tex.x-s*tex.y,s*tex.x+c*tex.y)*scale;return(sin(point.x)*sin(point.y))*4.0;}void main(){vec4 color=texture2D(texture,texCoord);vec3 cmy=1.0-color.rgb;float k=min(cmy.x,min(cmy.y,cmy.z));cmy=(cmy-k)/(1.0-k);cmy=clamp(cmy*10.0-3.0+vec3(pattern(angle+0.26179),pattern(angle+1.30899),pattern(angle)),0.0,1.0);k=clamp(k*10.0-5.0+pattern(angle+0.78539),0.0,1.0);gl_FragColor=vec4(1.0-cmy-k,color.a);}"),o.call(this,z.colorHalftone,{center:[e,t],angle:a,scale:Math.PI/n,texSize:[this.width,this.height]}),this}function I(e,t,a,n){return z.dotScreen=z.dotScreen||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float angle;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;float pattern(){float s=sin(angle),c=cos(angle);vec2 tex=texCoord*texSize-center;vec2 point=vec2(c*tex.x-s*tex.y,s*tex.x+c*tex.y)*scale;return(sin(point.x)*sin(point.y))*4.0;}void main(){vec4 color=texture2D(texture,texCoord);float average=(color.r+color.g+color.b)/3.0;gl_FragColor=vec4(vec3(average*10.0-5.0+pattern()),color.a);}"),o.call(this,z.dotScreen,{center:[e,t],angle:a,scale:Math.PI/n,texSize:[this.width,this.height]}),this}function R(e){return z.edgeWork1=z.edgeWork1||new G(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+F+"void main(){vec2 color=vec2(0.0);vec2 total=vec2(0.0);float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec3 sample=texture2D(texture,texCoord+delta*percent).rgb;float average=(sample.r+sample.g+sample.b)/3.0;color.x+=average*weight;total.x+=weight;if(abs(t)<15.0){weight=weight*2.0-1.0;color.y+=average*weight;total.y+=weight;}}gl_FragColor=vec4(color/total,0.0,1.0);}"),z.edgeWork2=z.edgeWork2||new G(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+F+"void main(){vec2 color=vec2(0.0);vec2 total=vec2(0.0);float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec2 sample=texture2D(texture,texCoord+delta*percent).xy;color.x+=sample.x*weight;total.x+=weight;if(abs(t)<15.0){weight=weight*2.0-1.0;color.y+=sample.y*weight;total.y+=weight;}}float c=clamp(10000.0*(color.y/total.y-color.x/total.x)+0.5,0.0,1.0);gl_FragColor=vec4(c,c,c,1.0);}"),o.call(this,z.edgeWork1,{delta:[e/this.width,0]}),o.call(this,z.edgeWork2,{delta:[0,e/this.height]}),this}function B(e,t,a){return z.hexagonalPixelate=z.hexagonalPixelate||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;void main(){vec2 tex=(texCoord*texSize-center)/scale;tex.y/=0.866025404;tex.x-=tex.y*0.5;vec2 a;if(tex.x+tex.y-floor(tex.x)-floor(tex.y)<1.0)a=vec2(floor(tex.x),floor(tex.y));else a=vec2(ceil(tex.x),ceil(tex.y));vec2 b=vec2(ceil(tex.x),floor(tex.y));vec2 c=vec2(floor(tex.x),ceil(tex.y));vec3 TEX=vec3(tex.x,tex.y,1.0-tex.x-tex.y);vec3 A=vec3(a.x,a.y,1.0-a.x-a.y);vec3 B=vec3(b.x,b.y,1.0-b.x-b.y);vec3 C=vec3(c.x,c.y,1.0-c.x-c.y);float alen=length(TEX-A);float blen=length(TEX-B);float clen=length(TEX-C);vec2 choice;if(alen0.0){coord*=mix(1.0,smoothstep(0.0,radius/distance,percent),strength*0.75);}else{coord*=mix(1.0,pow(percent,1.0+strength*0.75)*radius/distance,1.0-percent);}}coord+=center;"),o.call(this,z.bulgePinch,{radius:n,strength:e(-1,r,1),center:[t,a],texSize:[this.width,this.height]}),this}function M(e,t,a){if(z.matrixWarp=z.matrixWarp||p("uniform mat3 matrix;uniform bool useTextureSpace;","if(useTextureSpace)coord=coord/texSize*2.0-1.0;vec3 warp=matrix*vec3(coord,1.0);coord=warp.xy/warp.z;if(useTextureSpace)coord=(coord*0.5+0.5)*texSize;"),e=Array.prototype.concat.apply([],e),4==e.length)e=[e[0],e[1],0,e[2],e[3],0,0,0,1];else if(9!=e.length)throw"can only warp with 2x2 or 3x3 matrix";return o.call(this,z.matrixWarp,{matrix:t?f(e):e,texSize:[this.width,this.height],useTextureSpace:0|a}),this}function D(e,t){var a=d.apply(null,t),n=d.apply(null,e),a=f(a);return this.matrixWarp([a[0]*n[0]+a[1]*n[3]+a[2]*n[6],a[0]*n[1]+a[1]*n[4]+a[2]*n[7],a[0]*n[2]+a[1]*n[5]+a[2]*n[8],a[3]*n[0]+a[4]*n[3]+a[5]*n[6],a[3]*n[1]+a[4]*n[4]+a[5]*n[7],a[3]*n[2]+a[4]*n[5]+a[5]*n[8],a[6]*n[0]+a[7]*n[3]+a[8]*n[6],a[6]*n[1]+a[7]*n[4]+a[8]*n[7],a[6]*n[2]+a[7]*n[5]+a[8]*n[8]])}function L(e,t,a,n){return z.swirl=z.swirl||p("uniform float radius;uniform float angle;uniform vec2 center;","coord-=center;float distance=length(coord);if(distance>1;this.xa[n]>e?a=n:t=n}var n=this.xa[a]-this.xa[t],r=(this.xa[a]-e)/n;return e=(e-this.xa[t])/n,r*this.ya[t]+e*this.ya[a]+((r*r*r-r)*this.y2[t]+(e*e*e-e)*this.y2[a])*n*n/6};var N=function(){function e(e,t,a,n){this.gl=z,this.id=z.createTexture(),this.width=e,this.height=t,this.format=a,this.type=n,z.bindTexture(z.TEXTURE_2D,this.id),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MAG_FILTER,z.LINEAR),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MIN_FILTER,z.LINEAR),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_WRAP_S,z.CLAMP_TO_EDGE),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_WRAP_T,z.CLAMP_TO_EDGE),e&&t&&z.texImage2D(z.TEXTURE_2D,0,this.format,e,t,0,this.format,this.type,null)}function t(e){return null==a&&(a=document.createElement("canvas")),a.width=e.width,a.height=e.height,e=a.getContext("2d"),e.clearRect(0,0,a.width,a.height),e}e.fromElement=function(t){var a=new e(0,0,z.RGBA,z.UNSIGNED_BYTE);return a.loadContentsOf(t),a},e.prototype.loadContentsOf=function(e){this.width=e.width||e.videoWidth,this.height=e.height||e.videoHeight,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,this.format,this.format,this.type,e)},e.prototype.initFromBytes=function(e,t,a){this.width=e,this.height=t,this.format=z.RGBA,this.type=z.UNSIGNED_BYTE,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,z.RGBA,e,t,0,z.RGBA,this.type,new Uint8Array(a))},e.prototype.destroy=function(){z.deleteTexture(this.id),this.id=null},e.prototype.use=function(e){z.activeTexture(z.TEXTURE0+(e||0)),z.bindTexture(z.TEXTURE_2D,this.id)},e.prototype.unuse=function(e){z.activeTexture(z.TEXTURE0+(e||0)),z.bindTexture(z.TEXTURE_2D,null)},e.prototype.ensureFormat=function(e,t,a,n){if(1==arguments.length){var r=arguments[0];e=r.width,t=r.height,a=r.format,n=r.type}e==this.width&&t==this.height&&a==this.format&&n==this.type||(this.width=e,this.height=t,this.format=a,this.type=n,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,this.format,e,t,0,this.format,this.type,null))},e.prototype.drawTo=function(e){if(z.framebuffer=z.framebuffer||z.createFramebuffer(),z.bindFramebuffer(z.FRAMEBUFFER,z.framebuffer),z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,this.id,0),z.checkFramebufferStatus(z.FRAMEBUFFER)!==z.FRAMEBUFFER_COMPLETE)throw Error("incomplete framebuffer");z.viewport(0,0,this.width,this.height),e(),z.bindFramebuffer(z.FRAMEBUFFER,null)};var a=null;return e.prototype.fillUsingCanvas=function(e){return e(t(this)),this.format=z.RGBA,this.type=z.UNSIGNED_BYTE,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,z.RGBA,z.RGBA,z.UNSIGNED_BYTE,a),this},e.prototype.toImage=function(e){this.use(),G.getDefaultShader().drawRect();var n=4*this.width*this.height,r=new Uint8Array(n),i=t(this),o=i.createImageData(this.width,this.height);z.readPixels(0,0,this.width,this.height,z.RGBA,z.UNSIGNED_BYTE,r);for(var s=0;s=0&&b.splice(t,1)}function s(e){var t=document.createElement("style");return e.attrs.type="text/css",u(t,e.attrs),i(e,t),t}function l(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",u(t,e.attrs),i(e,t),t}function u(e,t){Object.keys(t).forEach(function(a){e.setAttribute(a,t[a])})}function c(e,t){var a,n,r,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var u=y++;a=v||(v=s(t)),n=d.bind(null,a,u,!1),r=d.bind(null,a,u,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(a=l(t),n=h.bind(null,a,t),r=function(){o(a),a.href&&URL.revokeObjectURL(a.href)}):(a=s(t),n=f.bind(null,a),r=function(){o(a)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}function d(e,t,a,n){var r=a?"":n.css;if(e.styleSheet)e.styleSheet.cssText=w(t,r);else{var i=document.createTextNode(r),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(i,o[t]):e.appendChild(i)}}function f(e,t){var a=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=a;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(a))}}function h(e,t,a){var n=a.css,r=a.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(n=_(n)),r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(o),s&&URL.revokeObjectURL(s)}var p={},m=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}}(function(){return window&&document&&document.all&&!window.atob}),g=function(e){var t={};return function(a){if(void 0===t[a]){var n=e.call(this,a);if(n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[a]=n}return t[a]}}(function(e){return document.querySelector(e)}),v=null,y=0,b=[],_=a(29);e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");t=t||{},t.attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||(t.singleton=m()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var a=r(e,t);return n(a,t),function(e){for(var i=[],o=0;o=0;i--){var o=r[i];this.ctx.globalAlpha=o.opacity/100,this.ctx.globalCompositeOperation=o.composition,this.render_object(this.ctx,o)}this.Base_gui.draw_grid(this.ctx),this.Base_selection.draw_selection(),this.render_preview(r),this.after_render(),this.last_zoom=l.default.ZOOM,this.Base_gui.GUI_details.render_details()}requestAnimationFrame(function(){t.render(e)})}},{key:"render_preview",value:function(e){var t=this.Base_gui.GUI_preview.PREVIEW_SIZE.w,a=this.Base_gui.GUI_preview.PREVIEW_SIZE.h;this.ctx_preview.save(),this.ctx_preview.clearRect(0,0,t,a),this.ctx_preview.scale(t/l.default.WIDTH,a/l.default.HEIGHT);for(var n=e.length-1;n>=0;n--){var r=e[n];0!=r.visible&&(null!=r.type&&(this.ctx_preview.globalAlpha=r.opacity/100,this.ctx_preview.globalCompositeOperation=r.composition,this.render_object(this.ctx_preview,r)))}this.ctx_preview.restore(),this.Base_gui.GUI_preview.render_preview_active_zone()}},{key:"render_object",value:function(e,t){if(0!=t.visible&&null!=t.type){var a="";for(var n in t.filters){var r=t.filters[n];""!=a&&(a+=" "),a+=r.name+"("+r.params.value+")"}if(e.filter=""!=a?a:"none","image"==t.type){e.save(),e.translate(t.x+t.width/2,t.y+t.height/2),e.rotate(t.rotate*Math.PI/180),void 0!=t.link_canvas&&null!=t.link_canvas?e.drawImage(t.link_canvas,-t.width/2,-t.height/2,t.width,t.height):e.drawImage(t.link,-t.width/2,-t.height/2,t.width,t.height),e.restore()}else{var i=t.render_function[0],o=t.render_function[1];this.Base_gui.GUI_tools.tools_modules[i][o](e,t)}e.filter="none"}}},{key:"insert",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,n=!1,r={id:this.auto_increment,parent_id:0,name:this.Helper.ucfirst(l.default.TOOL.name)+" #"+this.auto_increment,type:null,link:null,x:0,y:0,width:0,width_original:null,height:0,height_original:null,visible:!0,opacity:100,order:this.auto_increment,composition:"source-over",rotate:0,data:null,params:{},status:null,color:l.default.COLOR,filters:[],render_function:null};for(var o in e)void 0!==r[o]?r[o]=e[o]:x.default.error("Error: wrong key: "+o);if("image"==r.type&&(1==l.default.layers.length&&0==l.default.layer.width&&0==l.default.layer.height&&null==l.default.layer.data&&this.delete(l.default.layer.id,!0),null==r.link&&("object"==i(r.data)?(0==r.width&&(r.width=r.data.width),0==r.height&&(r.height=r.data.height),r.link=r.data.cloneNode(!0),r.data=null,n=!0):"string"==typeof r.data?(r.link=new Image,r.link.onload=function(){0==r.width&&(r.width=r.link.width),0==r.height&&(r.height=r.link.height),null==r.width_original&&(r.width_original=r.width),null==r.height_original&&(r.height_original=r.height),r.data=null,a.autoresize(r.width,r.height,r.id,t),a.render(),r.link.onload=function(){l.default.need_render=!0}},r.link.src=r.data):x.default.error("Error: can not load image."))),void 0!=e&&l.default.layers.length>0&&0==l.default.layer.width&&0==l.default.layer.height&&null==l.default.layer.data&&"image"!=r.type&&!1!==t)for(var o in r)"id"!=o&&"name"!=o&&"order"!=o&&(l.default.layer[o]=r[o]);else l.default.layers.push(r),l.default.layer=this.get_layer(this.auto_increment),this.auto_increment++,null==l.default.layer&&(l.default.layer=l.default.layers[0]);r.id>=this.auto_increment&&(this.auto_increment=r.id+1),1==n&&this.autoresize(l.default.layer.width,l.default.layer.height),this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"autoresize",value:function(e,t,a){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this,i=!1;if(void 0==a&&(a=l.default.layer),e>l.default.WIDTH||t>l.default.HEIGHT){var o=document.getElementById("main_wrapper"),s=o.clientWidth,u=o.clientHeight;(e>s||t>u)&&(i=!0),e>l.default.WIDTH&&(l.default.WIDTH=parseInt(e)),t>l.default.HEIGHT&&(l.default.HEIGHT=parseInt(t))}if(1==l.default.layers.length&&!1!==n&&(e=0;t--)this.delete(l.default.layers[t].id,!0);if(this.auto_increment=1,void 0!=e&&!0===e){var a={};this.insert(a)}this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"toggle_visibility",value:function(e){e=parseInt(e);var t=this.get_layer(e);0==t.visible?t.visible=!0:t.visible=!1,this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"refresh_gui",value:function(){this.Base_gui.GUI_layers.render_layers()}},{key:"select",value:function(e){e=parseInt(e),l.default.layer=this.get_layer(e),this.Base_selection.reset_selection(),this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"set_opacity",value:function(e,t){e=parseInt(e),((t=parseInt(t))<0||t>100)&&(t=100),this.get_layer(e).opacity=t}},{key:"layer_clear",value:function(e){e=parseInt(e);var t=this.get_layer(e);t.data=null,t.x=0,t.y=0,t.width=0,t.height=0}},{key:"move",value:function(e,t){e=parseInt(e);var a=this.get_layer(e);if(t<0)var n=this.find_previous(e);else var n=this.find_next(e);if(null!=n){var r=a.order;a.order=n.order,n.order=r}this.render(),this.Base_gui.GUI_layers.render_layers()}},{key:"get_sorted_layers",value:function(){return l.default.layers.concat().sort(function(e,t){return t.order-e.order})}},{key:"is_layer_empty",value:function(e){var t=this.get_layer(e);return 0==t.width&&0==t.height&&null==t.data}},{key:"find_next",value:function(e){e=parseInt(e);for(var t=this.get_layer(e),a=this.get_sorted_layers(),n=null,r=a.length-1;r>=0;r--){var i=a[r];if(null!=n&&n.id==t.id)return i;n=i}return null}},{key:"find_previous",value:function(e){e=parseInt(e);var t=this.get_layer(e),a=this.get_sorted_layers(),n=null;for(var r in a){var i=a[r];if(null!=n&&n.id==t.id)return i;n=i}return null}},{key:"get_world_coords",value:function(e,t){return y.default.toWorld(e,t)}},{key:"getCurrentPos",value:function(){return y.default.getCurrentPos()}},{key:"add_filter",value:function(e,t,a){null==e&&(e=l.default.layer.id);var n=this.get_layer(e),r={id:this.Helper.getRandomInt(1,999999999),name:t,params:a};n.filters.push(r),l.default.need_render=!0,this.Base_gui.GUI_layers.render_layers()}},{key:"delete_filter",value:function(e,t){null==e&&(e=l.default.layer.id);var a=this.get_layer(e);for(var n in a.filters)a.filters[n].id==t&&a.filters.splice(n,1);l.default.need_render=!0,this.Base_gui.GUI_layers.render_layers()}},{key:"convert_layers_to_canvas",value:function(e,t){for(var a=this.get_sorted_layers(),n=a.length-1;n>=0;n--){var r=a[n];0!=r.visible&&null!=r.type&&(void 0!=t&&r.id!=t||(e.globalAlpha=r.opacity/100,e.globalCompositeOperation=r.composition,this.render_object(e,r)))}}},{key:"convert_layer_to_canvas",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments[2];null==e&&(e=l.default.layer.id);var n=this.get_layer(e),r=0,i=0,o=document.createElement("canvas");if(!0===t&&"image"==n.type?(o.width=n.width_original,o.height=n.height_original,a=!1):(o.width=Math.max(n.width,l.default.WIDTH),o.height=Math.max(n.height,l.default.HEIGHT)),!0===t&&"image"==n.type?o.getContext("2d").drawImage(n.link,0,0):this.render_object(o.getContext("2d"),n),(1==a||void 0==a)&&null!=n.type){var s=this.Image_trim.get_trim_info(e);(s.left>0||s.top>0||s.right>0||s.bottom>0)&&(r=s.left,i=s.top,this.Helper.change_canvas_size(o,o.width-s.left-s.right,o.height-s.top-s.bottom,r,i))}return o.dataset.x=r,o.dataset.y=i,o}},{key:"update_layer_image",value:function(e,t){null==t&&(t=l.default.layer.id);var a=this.get_layer(t);if("image"!=a.type)return null;0==this.Helper.is_edge_or_ie()?e.toBlob(function(e){a.link.src=window.URL.createObjectURL(e),l.default.need_render=!0},"image/png"):a.link.src=e.toDataURL(),l.default.need_render=!0}},{key:"get_dimensions",value:function(){return{width:l.default.WIDTH,height:l.default.HEIGHT}}}]),e}();t.default=C},function(e,t,a){var n,r;/*! alertifyjs - v1.11.0 - Mohammad Younes (http://alertifyjs.com) */ +!function(a){"use strict";function i(e,t){e.className+=" "+t}function o(e,t){for(var a=e.className.split(" "),n=t.split(" "),r=0;r-1&&a.splice(i,1)}e.className=a.join(" ")}function s(){return"rtl"===a.getComputedStyle(document.body).direction}function l(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}function u(){return document.documentElement&&document.documentElement.scrollLeft||document.body.scrollLeft}function c(e){for(;e.lastChild;)e.removeChild(e.lastChild)}function d(e){if(null===e)return e;var t;if(Array.isArray(e)){t=[];for(var a=0;a0){for(var a=[],n=0;n=0?(o(document.body,Te.noOverflow),g(!1)):e>0&&document.body.className.indexOf(Te.noOverflow)<0&&(g(!0),i(document.body,Te.noOverflow))}function g(e){S.defaults.preventBodyShift&&document.documentElement.scrollHeight>document.documentElement.clientHeight&&(e?(Ie=ke,Oe=a.getComputedStyle(document.body).top,i(document.body,Te.fixed),document.body.style.top=-ke+"px"):(ke=Ie,document.body.style.top=Oe,o(document.body,Te.fixed),n()))}function y(e,t,a){"string"==typeof a&&o(e.elements.root,Te.prefix+a),i(e.elements.root,Te.prefix+t),Se=e.elements.root.offsetWidth}function k(e){e.get("modal")?(o(e.elements.root,Te.modeless),e.isOpen()&&(me(e),z(e),r())):(i(e.elements.root,Te.modeless),e.isOpen()&&(pe(e),z(e),r()))}function C(e){e.get("basic")?i(e.elements.root,Te.basic):o(e.elements.root,Te.basic)}function E(e){e.get("frameless")?i(e.elements.root,Te.frameless):o(e.elements.root,Te.frameless)}function P(e,t){for(var a=b.indexOf(t),n=a+1;n-1?(W(t,function(e){return e.key===a}),!1):void 0}function q(e){var t=b[b.length-1],a=e.keyCode;if(a===v.LEFT||a===v.RIGHT){for(var n=t.__internal.buttons,r=0;rv.F1-1&&Ce.indexOf(a)>-1)return e.preventDefault(),e.stopPropagation(),W(t,function(e){return e.key===a}),!1}function Z(e,t){if(t)t.focus();else{var a=e.__internal.focus,n=a.element;switch(typeof a.element){case"number":e.__internal.buttons.length>a.element&&(n=!0===e.get("basic")?e.elements.reset[0]:e.__internal.buttons[a.element].element);break;case"string":n=e.elements.body.querySelector(a.element);break;case"function":n=a.element.call(e)}void 0!==n&&null!==n||0!==e.__internal.buttons.length||(n=e.elements.reset[0]),n&&n.focus&&(n.focus(),a.select&&n.select&&n.select())}}function X(e,t){if(!t)for(var a=b.length-1;a>-1;a-=1)if(b[a].isModal()){t=b[a];break}if(t&&t.isModal()){var n,r=e.srcElement||e.target,i=r===t.elements.reset[1]||0===t.__internal.buttons.length&&r===document.body;i&&(t.get("maximizable")?n=t.elements.commands.maximize:t.get("closable")&&(n=t.elements.commands.close)),void 0===n&&("number"==typeof t.__internal.focus.element?r===t.elements.reset[0]?n=t.elements.buttons.auxiliary.firstChild||t.elements.buttons.primary.firstChild:i&&(n=t.elements.reset[0]):r===t.elements.reset[0]&&(n=t.elements.buttons.primary.lastChild||t.elements.buttons.auxiliary.lastChild)),Z(t,n)}}function J(e,t){clearTimeout(t.__internal.timerIn),Z(t),n(),Be=!1,m("onfocus",t),w(t.elements.dialog,x.type,t.__internal.transitionInHandler),o(t.elements.root,Te.animationIn)}function K(e,t){clearTimeout(t.__internal.timerOut),w(t.elements.dialog,x.type,t.__internal.transitionOutHandler),ne(t),ue(t),t.isMaximized()&&!t.get("startMaximized")&&M(t),S.defaults.maintainFocus&&t.__internal.activeElement&&(t.__internal.activeElement.focus(),t.__internal.activeElement=null),"function"==typeof t.__internal.destroy&&t.__internal.destroy.apply(t)}function Q(e,t){var a=e[De]-Ae,n=e[Le]-Me;ze&&(n-=document.body.scrollTop),t.style.left=a+"px",t.style.top=n+"px"}function $(e,t){var a=e[De]-Ae,n=e[Le]-Me;ze&&(n-=document.body.scrollTop),t.style.left=Math.min(He.maxLeft,Math.max(He.minLeft,a))+"px",t.style.top=ze?Math.min(He.maxTop,Math.max(He.minTop,n))+"px":Math.max(He.minTop,n)+"px"}function ee(e,t){if(null===Ne&&!t.isMaximized()&&t.get("movable")){var a,n=0,r=0;if("touchstart"===e.type?(e.preventDefault(),a=e.targetTouches[0],De="clientX",Le="clientY"):0===e.button&&(a=e),a){var o=t.elements.dialog;if(i(o,Te.capture),o.style.left&&(n=parseInt(o.style.left,10)),o.style.top&&(r=parseInt(o.style.top,10)),Ae=a[De]-n,Me=a[Le]-r,t.isModal()?Me+=t.elements.modal.scrollTop:t.isPinned()&&(Me-=document.body.scrollTop),t.get("moveBounded")){var s=o,l=-n,u=-r;do{l+=s.offsetLeft,u+=s.offsetTop}while(s=s.offsetParent);He={maxLeft:l,minLeft:-l,maxTop:document.documentElement.clientHeight-o.clientHeight-u,minTop:-u},Ge=$}else He=null,Ge=Q;return m("onmove",t),ze=!t.isModal()&&t.isPinned(),je=t,Ge(a,o),i(document.body,Te.noSelection),!1}}}function te(e){if(je){var t;"touchmove"===e.type?(e.preventDefault(),t=e.targetTouches[0]):0===e.button&&(t=e),t&&Ge(t,je.elements.dialog)}}function ae(){if(je){var e=je;je=He=null,o(document.body,Te.noSelection),o(e.elements.dialog,Te.capture),m("onmoved",e)}}function ne(e){je=null;var t=e.elements.dialog;t.style.left=t.style.top=""}function re(e){e.get("movable")?(i(e.elements.root,Te.movable),e.isOpen()&&ge(e)):(ne(e),o(e.elements.root,Te.movable),e.isOpen()&&ve(e))}function ie(e,t,a){var n=t,r=0,i=0;do{r+=n.offsetLeft,i+=n.offsetTop}while(n=n.offsetParent);var o,l;!0===a?(o=e.pageX,l=e.pageY):(o=e.clientX,l=e.clientY);var u=s();if(u&&(o=document.body.offsetWidth-o,isNaN(Fe)||(r=document.body.offsetWidth-r-t.offsetWidth)),t.style.height=l-i+Ve+"px",t.style.width=o-r+Ve+"px",!isNaN(Fe)){var c=.5*Math.abs(t.offsetWidth-Ue);u&&(c*=-1),t.offsetWidth>Ue?t.style.left=Fe+c+"px":t.offsetWidth>=We&&(t.style.left=Fe-c+"px")}}function oe(e,t){if(!t.isMaximized()){var a;if("touchstart"===e.type?(e.preventDefault(),a=e.targetTouches[0]):0===e.button&&(a=e),a){m("onresize",t),Ne=t,Ve=t.elements.resizeHandle.offsetHeight/2;var n=t.elements.dialog;return i(n,Te.capture),Fe=parseInt(n.style.left,10),n.style.height=n.offsetHeight+"px",n.style.minHeight=t.elements.header.offsetHeight+t.elements.footer.offsetHeight+"px",n.style.width=(Ue=n.offsetWidth)+"px","none"!==n.style.maxWidth&&(n.style.minWidth=(We=n.offsetWidth)+"px"),n.style.maxWidth="none",i(document.body,Te.noSelection),!1}}}function se(e){if(Ne){var t;"touchmove"===e.type?(e.preventDefault(),t=e.targetTouches[0]):0===e.button&&(t=e),t&&ie(t,Ne.elements.dialog,!Ne.get("modal")&&!Ne.get("pinned"))}}function le(){if(Ne){var e=Ne;Ne=null,o(document.body,Te.noSelection),o(e.elements.dialog,Te.capture),Re=!0,m("onresized",e)}}function ue(e){Ne=null;var t=e.elements.dialog;"none"===t.style.maxWidth&&(t.style.maxWidth=t.style.minWidth=t.style.width=t.style.height=t.style.minHeight=t.style.left="",Fe=Number.Nan,Ue=We=Ve=0)}function ce(e){e.get("resizable")?(i(e.elements.root,Te.resizable),e.isOpen()&&ye(e)):(ue(e),o(e.elements.root,Te.resizable),e.isOpen()&&be(e))}function de(){for(var e=0;e-1&&a.navigator.userAgent.indexOf("Chrome")<0,Pe={dimmer:'
',modal:'
',dialog:'
',reset:'',commands:'
',header:'
',body:'
',content:'
',footer:'',buttons:{primary:'
',auxiliary:'
'},button:'',resizeHandle:'
'},Te={animationIn:"ajs-in",animationOut:"ajs-out",base:"alertify",basic:"ajs-basic",capture:"ajs-capture",closable:"ajs-closable",fixed:"ajs-fixed",frameless:"ajs-frameless",hidden:"ajs-hidden",maximize:"ajs-maximize",maximized:"ajs-maximized",maximizable:"ajs-maximizable",modeless:"ajs-modeless",movable:"ajs-movable",noSelection:"ajs-no-selection",noOverflow:"ajs-no-overflow",noPadding:"ajs-no-padding",pin:"ajs-pin",pinnable:"ajs-pinnable",prefix:"ajs-",resizable:"ajs-resizable",restore:"ajs-restore",shake:"ajs-shake",unpinned:"ajs-unpinned"},Oe="",Ie=0,Re=!1,Be=!1,je=null,Ae=0,Me=0,De="pageX",Le="pageY",He=null,ze=!1,Ge=null,Ne=null,Fe=Number.Nan,Ue=0,We=0,Ve=0;return{__init:e,isOpen:function(){return this.__internal.isOpen},isModal:function(){return this.elements.root.className.indexOf(Te.modeless)<0},isMaximized:function(){return this.elements.root.className.indexOf(Te.maximized)>-1},isPinned:function(){return this.elements.root.className.indexOf(Te.unpinned)<0},maximize:function(){return this.isMaximized()||A(this),this},restore:function(){return this.isMaximized()&&M(this),this},pin:function(){return this.isPinned()||B(this),this},unpin:function(){return this.isPinned()&&j(this),this},bringToFront:function(){return P(null,this),this},moveTo:function(e,t){if(!isNaN(e)&&!isNaN(t)){m("onmove",this);var a=this.elements.dialog,n=a,r=0,i=0;a.style.left&&(r-=parseInt(a.style.left,10)),a.style.top&&(i-=parseInt(a.style.top,10));do{r+=n.offsetLeft,i+=n.offsetTop}while(n=n.offsetParent);var o=e-r,l=t-i;s()&&(o*=-1),a.style.left=o+"px",a.style.top=l+"px",m("onmoved",this)}return this},resizeTo:function(e,t){var a=parseFloat(e),n=parseFloat(t),r=/(\d*\.\d+|\d+)%/;if(!isNaN(a)&&!isNaN(n)&&!0===this.get("resizable")){m("onresize",this),(""+e).match(r)&&(a=a/100*document.documentElement.clientWidth),(""+t).match(r)&&(n=n/100*document.documentElement.clientHeight);var i=this.elements.dialog;"none"!==i.style.maxWidth&&(i.style.minWidth=(We=i.offsetWidth)+"px"),i.style.maxWidth="none",i.style.minHeight=this.elements.header.offsetHeight+this.elements.footer.offsetHeight+"px",i.style.width=a+"px",i.style.height=n+"px",m("onresized",this)}return this},setting:function(e,t){var a=this,n=O(this,this.__internal.options,function(e,t,n){T(a,e,t,n)},e,t);if("get"===n.op)return n.found?n.value:void 0!==this.settings?O(this,this.settings,this.settingUpdated||function(){},e,t).value:void 0;if("set"===n.op){if(n.items.length>0)for(var r=this.settingUpdated||function(){},i=0;i0){var t=this;this.__internal.timer=setTimeout(function(){t.dismiss()},1e3*this.__internal.delay)}return this},setContent:function(e){if("string"==typeof e?(c(this.element),this.element.innerHTML=e):e instanceof a.HTMLElement&&this.element.firstChild!==e&&(c(this.element),this.element.appendChild(e)),this.__internal.closeButton){var t=document.createElement("span");i(t,f.close),t.setAttribute("data-close",!0),this.element.appendChild(t)}return this},dismissOthers:function(){return C.dismissAll(this),this}})}var l,u,d=[],f={base:"alertify-notifier",message:"ajs-message",top:"ajs-top",right:"ajs-right",bottom:"ajs-bottom",left:"ajs-left",center:"ajs-center",visible:"ajs-visible",hidden:"ajs-hidden",close:"ajs-close"};return{setting:function(t,a){if(e(this),void 0===a)return this.__internal[t];switch(t){case"position":this.__internal.position=a,r(this);break;case"delay":this.__internal.delay=a}return this},set:function(e,t){return this.setting(e,t),this},get:function(e){return this.setting(e)},create:function(t,a){e(this);var n=document.createElement("div");return n.className=f.message+("string"==typeof t&&""!==t?" ajs-"+t:""),s(n,a)},dismissAll:function(e){for(var t=d.slice(0),a=0;a',t+='',t+='
',t+='\t',t+='\t',t+="
",t+=""),a+=this.generateParamsHtml(),document.getElementById("popup").innerHTML='\n\t
\n\t\n\t\n\t
\n\t\t
\n\t\t
\n\t
\n\t
\n\t\t\n\t\t\n\t
\n',document.getElementById("pretitle_area").innerHTML=e,document.getElementById("popup_title").innerHTML=this.title,document.getElementById("popup_comment").innerHTML=this.comment,document.getElementById("preview_content").innerHTML=t,document.getElementById("params_content").innerHTML=a,0!=this.onfinish?document.getElementById("popup_cancel").style.display="":document.getElementById("popup_cancel").style.display="none",document.getElementById("popup").style.display="block",document.getElementById("popup").className=this.className;var n=this;document.getElementById("popup_ok").addEventListener("click",function(e){n.save()});for(var r=document.querySelectorAll("#popup input"),i=0;i',"Error"!=s&&void 0!=a.title&&(e+=''+a.title+""),void 0!=a.name){if(void 0!=a.values)if(a.values.length>10||"select"==a.type){e+='"}else{e+='',a.values.length>2&&(e+='
');var n=0;for(var r in a.values){var o="";a.value==a.values[r]&&(o='checked="checked"'),void 0==a.value&&0==n&&(o='checked="checked"');var s=a.values[r],l=a.values[r].split(" - ");l.length>1&&(s=l[0]+' - '+l[1]+""),e+='',e+='",a.values.length>2&&(e+="
"),n++}a.values.length>2&&(e+="
"),e+=""}else if(void 0!=a.value){var u=1;if(void 0!=a.step&&(u=a.step),void 0!=a.range)e+='',e+=''+a.value+"";else if("color"==a.type)e+='';else if("boolean"==typeof a.value){var c="";!0===a.value&&(c="checked"),e+=' '}else if(void 0==a.placeholder&&(a.placeholder=""),"textarea"==a.type)e+='";else{var d="text";void 0==a.placeholder||""==a.placeholder||isNaN(a.placeholder)||(d="number"),void 0!=a.value&&"number"==typeof a.value&&(d="number"),e+=''}}}else if(void 0!=a.function){var f;f=a.function(),e+=''+f+""}else if(void 0!=a.html)e+=''+a.html+"";else if(void 0==a.title)e+='';else{var h=""+a.value,p=a.title.toLowerCase().replace(/[^\w]+/g,"").replace(/ +/g,"-");p=p.substring(0,10),e+=h.length<40?'
'+a.value+"
":'"}e+=""}return e+=""}},{key:"validate",value:function(e){for(var t in this.parameters){var a=this.parameters[t];if("pop_data_"+a.name==e.id&&void 0!=a.range){if("-"==e.value||""==e.value)return!0;var n=parseFloat(e.value);(isNaN(n)||n!=e.value)&&(e.value=a.value),na.range[1]&&(e.value=a.range[1])}}}},{key:"onkeyup",value:function(e){"13"==e.keyCode&&this.save()}},{key:"get_dimensions",value:function(){var e,t;return window.innerWidth?e=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?e=document.documentElement.clientWidth:document.body&&(e=document.body.clientWidth),window.innerHeight?t=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?t=document.documentElement.clientHeight:document.body&&(t=document.body.clientHeight),[e,t]}},{key:"getRandomInt",value:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}},{key:"strpos",value:function(e,t,a){var n=(e+"").indexOf(t,a||0);return-1!==n&&n}},{key:"draw_background",value:function(e,t,a,n,r){if(0==s.default.TRANSPARENCY&&void 0==r)return e.beginPath(),e.rect(0,0,t,a),e.fillStyle="#ffffff",e.fill(),!1;void 0==n&&(n=10);for(var i=!0,o=0;o-1||(e[t]=this.Base_gui.modules[t]);return e}},{key:"render_effect_browser",value:function(){if(0==this.effects)return"";var e="",t=this.get_effects_list(),a=!1;this.ef_index=null,this.ef_next_index=null,this.ef_prev_index=null;for(var n in t){if(1==a){this.ef_next_index=n;break}var r=this.get_filter_title(n);r.toLowerCase()!=this.title.toLowerCase()?this.ef_prev_index=n:(this.ef_index=n,a=!0)}e+='',e+=' ',e+='",e+=' ',e+=""}},{key:"add_effects_browser_events",value:function(){if(0!=this.effects){var e=this,t=this.get_effects_list(),a=this.ef_prev_index,n=this.ef_next_index;document.getElementById("previous_filter").disabled=!1,document.getElementById("next_filter").disabled=!1,null==a&&(document.getElementById("previous_filter").disabled=!0),null==n&&(document.getElementById("next_filter").disabled=!0),document.getElementById("previous_filter").addEventListener("click",function(n){e.hide();var r=a.toLowerCase().replace(/ /g,"_").replace("effects/","");t[a][r]()}),document.getElementById("next_filter").addEventListener("click",function(a){e.hide();var r=n.toLowerCase().replace(/ /g,"_").replace("effects/","");t[n][r]()});var r=document.getElementById("effect_browser");r.addEventListener("change",function(a){e.hide();var n=r.options[r.selectedIndex].value,i=n.toLowerCase().replace(/ /g,"_").replace("effects/","");t[n][i]()})}}},{key:"get_filter_title",value:function(e){var t=e.replace("effects/","").replace(/_/g," ");return"negative"==t&&(t="invert"),t}}]),e}();t.default=m},function(e,t,a){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var a=0;a0){var t=document.cookie.indexOf(e+"=");if(-1!=t){t+=e.length+1;var a=document.cookie.indexOf(";",t);return-1==a&&(a=document.cookie.length),document.cookie.substring(t,a)}}return""}},{key:"_setCookie",value:function(e,t,a){void 0==a&&(a=180);var n=new Date;n.setTime(n.getTime()+24*a*3600*1e3),document.cookie=e+"="+t+(null==a?"":"; expires="+n.toGMTString())}},{key:"delCookie",value:function(e){this.getCookie(e)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT")}},{key:"getRandomInt",value:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}},{key:"font_pixel_to_height",value:function(e){return Math.round(.75*e)}},{key:"rgbToHex",value:function(e,t,a){if(e>255||t>255||a>255)throw"Invalid color component";return"#"+("000000"+(e<<16|t<<8|a).toString(16)).slice(-6)}},{key:"rgb2hex_all",value:function(e){return e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),"#"+this.hex(e[1])+this.hex(e[2])+this.hex(e[3])}},{key:"hex",value:function(e){return e=parseInt(e),("0"+e.toString(16)).slice(-2)}},{key:"hex2rgb",value:function(e){if("#"==e[0]&&(e=e.substr(1)),3==e.length){var t=e;e="",t=/^([a-f0-9])([a-f0-9])([a-f0-9])$/i.exec(t).slice(1);for(var a=0;a<3;a++)e+=t[a]+t[a]}var n=/^([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(e).slice(1);return{r:parseInt(n[0],16),g:parseInt(n[1],16),b:parseInt(n[2],16),a:255}}},{key:"remove_selection",value:function(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty()}},{key:"darkenColor",value:function(e,t){e.length>6&&(e=e.substring(1,e.length));var a=parseInt(e,16),n=Math.abs((a>>16&255)+t);n>255&&(n-=n-255);var r=Math.abs((a>>8&255)+t);r>255&&(r-=r-255);var i=Math.abs((255&a)+t);return i>255&&(i-=i-255),n=Number(n<0||isNaN(n))?0:(n>255?255:n).toString(16),1==n.length&&(n="0"+n),r=Number(r<0||isNaN(r))?0:(r>255?255:r).toString(16),1==r.length&&(r="0"+r),i=Number(i<0||isNaN(i))?0:(i>255?255:i).toString(16),1==i.length&&(i="0"+i),"#"+n+r+i}},{key:"number_format",value:function(e,t,a,n){var t=isNaN(t=Math.abs(t))?2:t,n=void 0==n?".":n,a=void 0==a?",":a,r=e<0?"-":"",i=parseInt(e=Math.abs(+e||0).toFixed(t))+"",o=(o=i.length)>3?o%3:0;return r+(o?i.substr(0,o)+a:"")+i.substr(o).replace(/(\d{3})(?=\d)/g,"$1"+a)+(t?n+Math.abs(e-i).toFixed(t).slice(2):"")}},{key:"chech_input_color_support",value:function(){var e=document.createElement("input");return e.setAttribute("type","color"),"text"!==e.type}},{key:"b64toBlob",value:function(e,t,a){t=t||"",a=a||512;for(var n=atob(e),r=[],i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}},{key:"isNumeric",value:function(e){return!isNaN(parseFloat(e))&&isFinite(e)}},{key:"hslToRgb",value:function(e,t,a){var n,r,i;if(0==t)n=r=i=a;else{var o=a<.5?a*(1+t):a+t-a*t,s=2*a-o;n=this.hue2rgb(s,o,e+1/3),r=this.hue2rgb(s,o,e),i=this.hue2rgb(s,o,e-1/3)}return[Math.round(255*n),Math.round(255*r),Math.round(255*i)]}},{key:"hue2rgb",value:function(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e}},{key:"rgbToHsl",value:function(e,t,a){e/=255,t/=255,a/=255;var n,r,i=Math.max(e,t,a),o=Math.min(e,t,a),s=(i+o)/2;if(i==o)n=r=0;else{var l=i-o;switch(r=s>.5?l/(2-i-o):l/(i+o),i){case e:n=(t-a)/l+(t6&&void 0!==arguments[6]&&arguments[6],s=document.createElement("canvas");s.width=n,s.height=r;var l=Math.round(n/2),u=Math.round(r/2),c=s.getContext("2d"),d=s.width,f=s.height,h=t-l,p=a-u;c.clearRect(0,0,d,f),c.save(),c.putImageData(i,0,0),c.globalCompositeOperation="destination-in";var m=c.createRadialGradient(l,u,0,l,u,l);m.addColorStop(0,"#ffffff"),1==o?m.addColorStop(.8,"#ffffff"):m.addColorStop(.99,"#ffffff"),m.addColorStop(1,"rgba(255,255,255,0"),c.fillStyle=m,c.beginPath(),c.ellipse(l,u,2*n,2*r,0,0,2*Math.PI),c.fill(),e.drawImage(s,0,0,n,r,h,p,n,r),c.restore(),c.clearRect(0,0,d,f)}},{key:"is_edge_or_ie",value:function(){return!window.ActiveXObject&&"ActiveXObject"in window||-1!=navigator.userAgent.indexOf("Edge/")}}]),e}();t.default=i},function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a15?i+=2:i-=2,i=Math.max(0,i),i=Math.min(30,i)}},{key:"get_params_hash",value:function(){var e=[this.getParams(),s.default.COLOR,s.default.ALPHA];return JSON.stringify(e)}},{key:"clone",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"show_mouse_cursor",value:function(e,t,a,n){var r=this.Base_layers.get_world_coords(0,0);e-=r.x,t-=r.y;var i=document.getElementById("mouse");if(a*=s.default.ZOOM,e*=s.default.ZOOM,t*=s.default.ZOOM,a<5)return void(i.className="");i.style.width=a+"px",i.style.height=a+"px",i.style.left=e-Math.ceil(a/2)+"px",i.style.top=t-Math.ceil(a/2)+"px",i.className="",i.classList.add(n)}},{key:"getParams",value:function(){return s.default.TOOL.attributes}},{key:"adaptSize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"width";return null==s.default.layer.width_original?e:"width"===t?e/(s.default.layer.width/s.default.layer.width_original):e/(s.default.layer.height/s.default.layer.height_original)}}]),e}();t.default=c},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={};n.utils={initSampleCanvas:function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.width=0,e.height=0,this.getSampleCanvas=function(){return e},this.getSampleContext=function(){return t},this.createImageData=t.createImageData?function(e,a){return t.createImageData(e,a)}:function(e,t){return new ImageData(e,t)}},getSampleCanvas:function(){return this.initSampleCanvas(),this.getSampleCanvas()},getSampleContext:function(){return this.initSampleCanvas(),this.getSampleContext()},createImageData:function(e,t){return this.initSampleCanvas(),this.createImageData(e,t)},clamp:function(e){return e>255?255:e<0?0:e},buildMap:function(e){for(var t,a=[],n=0;n<256;n+=1)a[n]=(t=e(n))>255?255:t<0?0:0|t;return a},applyMap:function(e,t,a){for(var n=0,r=e.length;n=a||t<0||t>=n)switch(r){case 1:e=e<0?0:e>=a?a-1:e,t=t<0?0:t>=n?n-1:t;break;case 2:e=(e%=a)<0?e+a:e,t=(t%=n)<0?t+n:t;break;default:return null}return t*a+e<<2},getPixel:function(e,t,a,n,r,i){if(t<0||t>=n||a<0||a>=r)switch(i){case 1:t=t<0?0:t>=n?n-1:t,a=a<0?0:a>=r?r-1:a;break;case 2:t=(t%=n)<0?t+n:t,a=(a%=r)<0?a+r:a;break;default:return 0}var o=a*n+t<<2;return e[o+3]<<24|e[o]<<16|e[o+1]<<8|e[o+2]},getPixelByIndex:function(e,t){return e[t+3]<<24|e[t]<<16|e[t+1]<<8|e[t+2]},copyBilinear:function(e,t,a,n,r,i,o,s){var l,u,c,d,f,h,p,m=t<0?t-1|0:0|t,g=a<0?a-1|0:0|a,v=t-m,y=a-g,b=0,_=0,w=0,x=0;if(m>=0&&m=0&&g>16&255,i[o+1]=b>>8&255,i[o+2]=255&b,void(i[o+3]=b>>24&255);_=this.getPixel(e,m+1,g,n,r,s),w=this.getPixel(e,m,g+1,n,r,s),x=this.getPixel(e,m+1,g+1,n,r,s)}u=1-v,c=1-y,d=((b>>16&255)*u+(_>>16&255)*v)*c+((w>>16&255)*u+(x>>16&255)*v)*y,f=((b>>8&255)*u+(_>>8&255)*v)*c+((w>>8&255)*u+(x>>8&255)*v)*y,h=((255&b)*u+(255&_)*v)*c+((255&w)*u+(255&x)*v)*y,p=((b>>24&255)*u+(_>>24&255)*v)*c+((w>>24&255)*u+(x>>24&255)*v)*y,i[o]=d>255?255:d<0?0:0|d,i[o+1]=f>255?255:f<0?0:0|f,i[o+2]=h>255?255:h<0?0:0|h,i[o+3]=p>255?255:p<0?0:0|p},rgbToHsl:function(e,t,a){e/=255,t/=255,a/=255;var n=e>t?e>a?e:a:t>a?t:a,r=e.5?i/(2-n-r):i/(n+r)),[o,s,l]},hslToRgb:function(e,t,a){var n,r,i,o,s,l,u=[];if(0===t)o=s=l=255*a+.5|0,u=[o,s,l];else{r=a<=.5?a*(t+1):a+t-a*t,n=2*a-r,i=e+1/3;for(var c,d=0;d<3;d+=1)i<0?i+=1:i>1&&(i-=1),c=6*i<1?n+(r-n)*i*6:2*i<1?r:3*i<2?n+(r-n)*(2/3-i)*6:n,u[d]=255*c+.5|0,i-=1/3}return u}},n.Translate=function(e,t,a,n){},n.Scale=function(e,t,a,n){},n.Rotate=function(e,t,a,n,r,i){},n.Affine=function(e,t,a,n){},n.UnsharpMask=function(e,t){},n.ConvolutionFilter=function(e,t,a,n,r,i,o,s,l,u){var c=e.data,d=e.width,f=e.height,h=(c.length,this.utils.createImageData(d,f)),p=h.data;r=r||1,i=i||0,!1!==o&&(o=!0),!1!==s&&(s=!0),l=l||0,u=u||0;for(var m=0,g=t>>1,v=a>>1,y=l>>16&255,b=l>>8&255,_=255&l,w=255*u,x=0;x255?255:C<0?0:0|C,p[m+1]=(C=E/r+i)>255?255:C<0?0:0|C,p[m+2]=(C=P/r+i)>255?255:C<0?0:0|C,p[m+3]=o?c[m+3]:(C=T/r+i)>255?255:C<0?0:0|C}return h},n.Binarize=function(e,t){var a=e.data,n=e.width,r=e.height,i=a.length,o=this.utils.createImageData(n,r),s=o.data;isNaN(t)&&(t=.5),t*=255;for(var l=0;l255?255:r,c[f+1]=(r=i[f+1]+d[f+1])>255?255:r,c[f+2]=(r=i[f+2]+d[f+2])>255?255:r,c[f+3]=255;return u},n.BlendSubtract=function(e,t,a,n){for(var r,i=e.data,o=e.width,s=e.height,l=i.length,u=this.utils.createImageData(o,s),c=u.data,d=t.data,f=0;fw&&(v=w),y=m-r,y<0&&(y=0),d=x+v<<2,f=x+y<<2,i+=e[d]-e[f],o+=e[d+1]-e[f+1],s+=e[d+2]-e[f+2],l+=e[d+3]-e[f+3],u+=n;x+=a}};return function(t,a,n,r){for(var i=t.data,o=t.width,s=t.height,l=(i.length,this.utils.createImageData(o,s)),u=l.data,c=this.utils.createImageData(o,s),d=c.data,f=0;f>V,D[c+1]=h*W>>V,D[c+2]=p*W>>V,D[c+3]=m*W>>V,f-=g,h-=v,p-=y,m-=b,g-=O.r,v-=O.g,y-=O.b,b-=O.a,l=d+((l=i+r+1)>V,D[l+1]=h*W>>V,D[l+2]=p*W>>V,D[l+3]=m*W>>V,f-=g,h-=v,p-=y,m-=b,g-=O.r,v-=O.g,y-=O.b,b-=O.a,l=i+((l=o+G)255?255:e}),i},n.BrightnessContrastGimp=function(e,t,a){var n=e.data,r=e.width,i=e.height,o=n.length,s=this.utils.createImageData(r,i),l=s.data,u=Math.PI/4;t/=100,a*=.99,a/=100,a=Math.tan((a+1)*u);for(var c=0,d=0;d>16;return c/=o/4,this.utils.mapRGB(n,l,function(e){return t<0?e*=1+t:t>0&&(e+=(255-e)*t),0!==a&&(e=(e-c)*a+c),e+.5|0}),s},n.BrightnessContrastPhotoshop=function(e,t,a){var n=e.data,r=e.width,i=e.height,o=(n.length,this.utils.createImageData(r,i)),s=o.data;return t=(t+100)/100,a=(a+100)/100,this.utils.mapRGB(n,s,function(e){return e*=t,(e=(e-127.5)*a+127.5)+.5|0}),o},n.Channels=function(e,t){var a;switch(t){case 2:a=[0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0];break;case 3:a=[0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0];break;default:a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0]}return this.ColorMatrixFilter(e,a)},n.Clone=function(e){return this.Copy(e,this.utils.createImageData(e.width,e.height))},n.CloneBuiltin=function(e){var t,a=e.width,n=e.height,r=this.utils.getSampleCanvas(),i=this.utils.getSampleContext();return r.width=a,r.height=n,i.putImageData(e,0,0),t=i.getImageData(0,0,a,n),r.width=0,r.height=0,t},n.ColorMatrixFilter=function(e,t){var a,n,r,i,o,s,l=e.data,u=e.width,c=e.height,d=l.length,f=this.utils.createImageData(u,c),h=f.data,p=t[0],m=t[1],g=t[2],v=t[3],y=t[4],b=t[5],_=t[6],w=t[7],x=t[8],k=t[9],C=t[10],S=t[11],E=t[12],P=t[13],T=t[14],O=t[15],I=t[16],R=t[17],B=t[18],j=t[19];for(n=0;n255?255:a<0?0:0|a,h[n+1]=(a=r*b+i*_+o*w+s*x+k)>255?255:a<0?0:0|a,h[n+2]=(a=r*C+i*S+o*E+s*P+T)>255?255:a<0?0:0|a,h[n+3]=(a=r*O+i*I+o*R+s*B+j)>255?255:a<0?0:0|a;return f},n.ColorTransformFilter=function(e,t,a,n,r,i,o,s,l){var u,c,d=e.data,f=e.width,h=e.height,p=d.length,m=this.utils.createImageData(f,h),g=m.data;for(u=0;u255?255:c<0?0:c,g[u+1]=(c=d[u+1]*a+o)>255?255:c<0?0:c,g[u+2]=(c=d[u+2]*n+s)>255?255:c<0?0:c,g[u+3]=(c=d[u+3]*r+l)>255?255:c<0?0:c;return m},n.Copy=function(e,t){for(var a=e.data,n=a.length,r=t.data;n--;)r[n]=a[n];return t},n.Crop=function(e,t,a,n,r){var i,o,s,l,u=e.data,c=e.width,d=e.height,f=(u.length,this.utils.createImageData(n,r)),h=f.data,p=Math.max(t,0),m=Math.max(a,0),g=Math.min(t+n,c),v=Math.min(a+r,d),y=p-t,b=m-a;for(i=m,dstRow=b;iu?l>c?l:c:u>c?u:c,f=l=P||k>=T?g=m:(v=(k-r)*C+(x-a)<<2,y=E[v+i],_=x+((y-128)*s>>8),b=E[v+o],w=k+((b-128)*l>>8),null===(g=n.utils.getPixelIndex(_+.5|0,w+.5|0,d,f,u))&&(g=m)),p[m]=c[g],p[m+1]=c[g+1],p[m+2]=c[g+2],p[m+3]=c[g+3];return h},n.Dither=function(e,t){var a=e.width,n=e.height,r=this.Clone(e),i=r.data;t=t<2?2:t>255?255:t;var o,s,l=[],u=t-1,c=0,d=0;for(s=0;s255&&(d-=255,c+=1),a});var f,h,p,m,g,v,y,b,_,w,x,k,C,S,E,P=a-1,T=n-1,O=7/16,I=3/16,R=5/16,B=1/16;for(h=0;h255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E),p+=a-2<<2,f>0&&h255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E),p+=4,h255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E),p+=4,f255?255:C<0?0:0|C,i[p+1]=S>255?255:S<0?0:0|S,i[p+2]=E>255?255:E<0?0:0|E);return r},n.Edge=function(e){return this.ConvolutionFilter(e,3,3,[-1,-1,-1,-1,8,-1,-1,-1,-1])},n.Emboss=function(e){return this.ConvolutionFilter(e,3,3,[-2,-1,0,-1,1,1,0,1,2])},n.Enrich=function(e){return this.ConvolutionFilter(e,3,3,[0,-2,0,-2,20,-2,0,-2,0],10,-40)},n.Flip=function(e,t){var a,n,r,i,o=e.data,s=e.width,l=e.height,u=(o.length,this.utils.createImageData(s,l)),c=u.data;for(n=0;n255?255:e+.5|0}),i},n.GrayScale=function(e){for(var t=e.data,a=e.width,n=e.height,r=t.length,i=this.utils.createImageData(a,n),o=i.data,s=0;s>16;o[s]=o[s+1]=o[s+2]=l,o[s+3]=t[s+3]}return i},n.HSLAdjustment=function(e,t,a,n){var r=e.data,i=e.width,o=e.height,s=r.length,l=this.utils.createImageData(i,o),u=l.data;t/=360,a/=100,n/=100;var c,d,f,h,p,m,g=this.utils.rgbToHsl,v=this.utils.hslToRgb;for(m=0;m1;)c-=1;d=h[1]+h[1]*a,d<0?d=0:d>1&&(d=1),f=h[2],n>0?f+=(1-f)*n:n<0&&(f+=f*n),p=v(c,d,f),u[m]=p[0],u[m+1]=p[1],u[m+2]=p[2],u[m+3]=r[m+3]}return l},n.Invert=function(e){var t=e.data,a=e.width,n=e.height,r=(t.length,this.utils.createImageData(a,n)),i=r.data;return this.utils.mapRGB(t,i,function(e){return 255-e}),r},n.Mosaic=function(e,t){var a,n,r,i,o,s,l,u,c,d,f,h,p,m,g,v=e.data,y=e.width,b=e.height,_=(v.length,this.utils.createImageData(y,b)),w=_.data,x=Math.ceil(y/t),k=Math.ceil(b/t);for(a=0;ab&&(s=b),n=0;ny&&(i=y),h=p=m=g=0,f=(i-r)*(s-o),u=o;u=k))for(c=l*x,s=-t;s<=t;s+=1)(u=n+s)<0||u>=x||(d=c+u<<2,f=w[d],h=w[d+1],p=w[d+2],m=f*a>>8,g=h*a>>8,v=p*a>>8,I[m]+=f,R[g]+=h,B[v]+=p,P[m]+=1,T[g]+=1,O[v]+=1);for(y=b=_=0,i=1;iP[y]&&(y=i),T[i]>T[b]&&(b=i),O[i]>O[_]&&(_=i);S[E]=I[y]/P[y]|0,S[E+1]=R[b]/T[b]|0,S[E+2]=B[_]/O[_]|0,S[E+3]=w[E+3],E+=4}return C},n.OpacityFilter=function(e,t){for(var a=e.data,n=e.width,r=e.height,i=a.length,o=this.utils.createImageData(n,r),s=o.data,l=0;l255?255:t;var s,l=[],u=t-1,c=0,d=0;for(s=0;s255&&(d-=255,c+=1),a}),i},n.Rescale=function(e,t){var a=e.data,n=e.width,r=e.height,i=(a.length,this.utils.createImageData(n,r)),o=i.data;return this.utils.mapRGB(a,o,function(e){return e*=t,e>255?255:e+.5|0}),i},n.ResizeNearestNeighbor=function(e,t,a){var n,r,i,o,s=e.data,l=e.width,u=e.height,c=(s.length,this.utils.createImageData(t,a)),d=c.data,f=l/t,h=u/a,p=0;for(i=0;i255?255:i<0?0:i+.5|0,d[r+1]=(i=.349*t+.686*a+.168*n)>255?255:i<0?0:i+.5|0,d[r+2]=(i=.272*t+.534*a+.131*n)>255?255:i<0?0:i+.5|0,d[r+3]=o[r+3];return c},n.Sharpen=function(e,t){return this.ConvolutionFilter(e,3,3,[-t/16,-t/8,-t/16,-t/8,.75*t+1,-t/8,-t/16,-t/8,-t/16])},n.Solarize=function(e){var t=e.data,a=e.width,n=e.height,r=(t.length,this.utils.createImageData(a,n)),i=r.data;return this.utils.mapRGB(t,i,function(e){return e>127?2*(e-127.5):2*(127.5-e)}),r},n.Transpose=function(e){var t,a,n=e.data,r=e.width,i=e.height,o=(n.length,this.utils.createImageData(i,r)),s=o.data;for(y=0;yw?(d[x]=s[x],d[x+1]=s[x+1],d[x+2]=s[x+2],d[x+3]=s[x+3]):(g=Math.sqrt(g),v=Math.atan2(m,p)+r*(n-g)/n,y=t+g*Math.cos(v),b=a+g*Math.sin(v),o?this.utils.copyBilinear(s,y,b,l,u,d,x,i):(_=(b+.5|0)*l+(y+.5|0)<<2,d[x]=s[_],d[x+1]=s[_+1],d[x+2]=s[_+2],d[x+3]=s[_+3])),x+=4;return c},t.default=n},function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var a=0;a=0;o--)if(!(this.common_dimensions[o][0]>t||this.common_dimensions[o][1]>a)){s.default.WIDTH=parseInt(this.common_dimensions[o][0]),s.default.HEIGHT=parseInt(this.common_dimensions[o][1]),n=!0;break}0==n&&(s.default.WIDTH=parseInt(t)-5,s.default.HEIGHT=parseInt(a)-10,t<585&&(s.default.HEIGHT=s.default.HEIGHT-15))}}},{key:"render_canvas_background",value:function(e,t){void 0==t&&(t=10);var a=document.getElementById(e+"_background");if(0==s.default.TRANSPARENCY)return a.className="transparent-grid white",!1;a.className="transparent-grid "+s.default.TRANSPARENCY_TYPE,a.style.backgroundSize=2*t+"px auto"}},{key:"draw_grid",value:function(e){if(0!=this.grid){var t=this.grid_size[0],a=this.grid_size[1],n=s.default.WIDTH,r=s.default.HEIGHT;void 0!=t&&void 0!=a?this.grid_size=[t,a]:(t=this.grid_size[0],a=this.grid_size[1]),t=parseInt(t),a=parseInt(a),e.lineWidth=1,e.beginPath(),t<2&&(t=2),a<2&&(a=2);for(var i=t;i0.0){color.rgb=(color.rgb-0.5)/(1.0-contrast)+0.5;}else{color.rgb=(color.rgb-0.5)*(1.0+contrast)+0.5;}gl_FragColor=color;}"),o.call(this,z.brightnessContrast,{brightness:e(-1,t,1),contrast:e(-1,a,1)}),this}function g(t){t=new h(t);for(var a=[],n=0;256>n;n++)a.push(e(0,Math.floor(256*t.interpolate(n/255)),255));return a}function v(e,t,a){e=g(e),1==arguments.length?t=a=e:(t=g(t),a=g(a));for(var n=[],r=0;256>r;r++)n.splice(n.length,0,e[r],t[r],a[r],255);return this._.extraTexture.initFromBytes(256,1,n),this._.extraTexture.use(1),z.curves=z.curves||new G(null,"uniform sampler2D texture;uniform sampler2D map;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);color.r=texture2D(map,vec2(color.r)).r;color.g=texture2D(map,vec2(color.g)).g;color.b=texture2D(map,vec2(color.b)).b;gl_FragColor=color;}"),z.curves.textures({map:1}),o.call(this,z.curves,{}),this}function y(e){z.denoise=z.denoise||new G(null,"uniform sampler2D texture;uniform float exponent;uniform float strength;uniform vec2 texSize;varying vec2 texCoord;void main(){vec4 center=texture2D(texture,texCoord);vec4 color=vec4(0.0);float total=0.0;for(float x=-4.0;x<=4.0;x+=1.0){for(float y=-4.0;y<=4.0;y+=1.0){vec4 sample=texture2D(texture,texCoord+vec2(x,y)/texSize);float weight=1.0-abs(dot(sample.rgb-center.rgb,vec3(0.25)));weight=pow(weight,exponent);color+=sample*weight;total+=weight;}}gl_FragColor=color/total;}");for(var t=0;2>t;t++)o.call(this,z.denoise,{exponent:Math.max(0,e),texSize:[this.width,this.height]});return this}function b(t,a){return z.hueSaturation=z.hueSaturation||new G(null,"uniform sampler2D texture;uniform float hue;uniform float saturation;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float angle=hue*3.14159265;float s=sin(angle),c=cos(angle);vec3 weights=(vec3(2.0*c,-sqrt(3.0)*s-c,sqrt(3.0)*s-c)+1.0)/3.0;float len=length(color.rgb);color.rgb=vec3(dot(color.rgb,weights.xyz),dot(color.rgb,weights.zxy),dot(color.rgb,weights.yzx));float average=(color.r+color.g+color.b)/3.0;if(saturation>0.0){color.rgb+=(average-color.rgb)*(1.0-1.0/(1.001-saturation));}else{color.rgb+=(average-color.rgb)*(-saturation);}gl_FragColor=color;}"),o.call(this,z.hueSaturation,{hue:e(-1,t,1),saturation:e(-1,a,1)}),this}function _(t){return z.noise=z.noise||new G(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;float rand(vec2 co){return fract(sin(dot(co.xy,vec2(12.9898,78.233)))*43758.5453);}void main(){vec4 color=texture2D(texture,texCoord);float diff=(rand(texCoord)-0.5)*amount;color.r+=diff;color.g+=diff;color.b+=diff;gl_FragColor=color;}"),o.call(this,z.noise,{amount:e(0,t,1)}),this}function w(t){return z.sepia=z.sepia||new G(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float r=color.r;float g=color.g;float b=color.b;color.r=min(1.0,(r*(1.0-(0.607*amount)))+(g*(0.769*amount))+(b*(0.189*amount)));color.g=min(1.0,(r*0.349*amount)+(g*(1.0-(0.314*amount)))+(b*0.168*amount));color.b=min(1.0,(r*0.272*amount)+(g*0.534*amount)+(b*(1.0-(0.869*amount))));gl_FragColor=color;}"),o.call(this,z.sepia,{amount:e(0,t,1)}),this}function x(e,t){return z.unsharpMask=z.unsharpMask||new G(null,"uniform sampler2D blurredTexture;uniform sampler2D originalTexture;uniform float strength;uniform float threshold;varying vec2 texCoord;void main(){vec4 blurred=texture2D(blurredTexture,texCoord);vec4 original=texture2D(originalTexture,texCoord);gl_FragColor=mix(blurred,original,1.0+strength);}"),this._.extraTexture.ensureFormat(this._.texture),this._.texture.use(),this._.extraTexture.drawTo(function(){G.getDefaultShader().drawRect()}),this._.extraTexture.use(1),this.triangleBlur(e),z.unsharpMask.textures({originalTexture:1}),o.call(this,z.unsharpMask,{strength:t}),this._.extraTexture.unuse(1),this}function k(t){return z.vibrance=z.vibrance||new G(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float average=(color.r+color.g+color.b)/3.0;float mx=max(color.r,max(color.g,color.b));float amt=(mx-average)*(-amount*3.0);color.rgb=mix(color.rgb,vec3(mx),amt);gl_FragColor=color;}"),o.call(this,z.vibrance,{amount:e(-1,t,1)}),this}function C(t,a){return z.vignette=z.vignette||new G(null,"uniform sampler2D texture;uniform float size;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float dist=distance(texCoord,vec2(0.5,0.5));color.rgb*=smoothstep(0.8,size*0.799,dist*(amount+size));gl_FragColor=color;}"),o.call(this,z.vignette,{size:e(0,t,1),amount:e(0,a,1)}),this}function S(t,a,n){z.lensBlurPrePass=z.lensBlurPrePass||new G(null,"uniform sampler2D texture;uniform float power;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);color=pow(color,vec4(power));gl_FragColor=vec4(color);}");var r="uniform sampler2D texture0;uniform sampler2D texture1;uniform vec2 delta0;uniform vec2 delta1;uniform float power;varying vec2 texCoord;"+F+"vec4 sample(vec2 delta){float offset=random(vec3(delta,151.7182),0.0);vec4 color=vec4(0.0);float total=0.0;for(float t=0.0;t<=30.0;t++){float percent=(t+offset)/30.0;color+=texture2D(texture0,texCoord+delta*percent);total+=1.0;}return color/total;}";z.lensBlur0=z.lensBlur0||new G(null,r+"void main(){gl_FragColor=sample(delta0);}"),z.lensBlur1=z.lensBlur1||new G(null,r+"void main(){gl_FragColor=(sample(delta0)+sample(delta1))*0.5;}"),z.lensBlur2=z.lensBlur2||new G(null,r+"void main(){vec4 color=(sample(delta0)+2.0*texture2D(texture1,texCoord))/3.0;gl_FragColor=pow(color,vec4(power));}").textures({texture1:1});for(var r=[],i=0;3>i;i++){var s=n+2*i*Math.PI/3;r.push([t*Math.sin(s)/this.width,t*Math.cos(s)/this.height])}return t=Math.pow(10,e(-1,a,1)),o.call(this,z.lensBlurPrePass,{power:t}),this._.extraTexture.ensureFormat(this._.texture),o.call(this,z.lensBlur0,{delta0:r[0]},this._.texture,this._.extraTexture),o.call(this,z.lensBlur1,{delta0:r[1],delta1:r[2]},this._.extraTexture,this._.extraTexture),o.call(this,z.lensBlur0,{delta0:r[1]}),this._.extraTexture.use(1),o.call(this,z.lensBlur2,{power:1/t,delta0:r[2]}),this}function E(e,t,a,n,r,i){z.tiltShift=z.tiltShift||new G(null,"uniform sampler2D texture;uniform float blurRadius;uniform float gradientRadius;uniform vec2 start;uniform vec2 end;uniform vec2 delta;uniform vec2 texSize;varying vec2 texCoord;"+F+"void main(){vec4 color=vec4(0.0);float total=0.0;float offset=random(vec3(12.9898,78.233,151.7182),0.0);vec2 normal=normalize(vec2(start.y-end.y,end.x-start.x));float radius=smoothstep(0.0,1.0,abs(dot(texCoord*texSize-start,normal))/gradientRadius)*blurRadius;for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec4 sample=texture2D(texture,texCoord+delta/texSize*percent*radius);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}");var s=a-e,l=n-t,u=Math.sqrt(s*s+l*l);return o.call(this,z.tiltShift,{blurRadius:r,gradientRadius:i,start:[e,t],end:[a,n],delta:[s/u,l/u],texSize:[this.width,this.height]}),o.call(this,z.tiltShift,{blurRadius:r,gradientRadius:i,start:[e,t],end:[a,n],delta:[-l/u,s/u],texSize:[this.width,this.height]}),this}function P(e){return z.triangleBlur=z.triangleBlur||new G(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+F+"void main(){vec4 color=vec4(0.0);float total=0.0;float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec4 sample=texture2D(texture,texCoord+delta*percent);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}"),o.call(this,z.triangleBlur,{delta:[e/this.width,0]}),o.call(this,z.triangleBlur,{delta:[0,e/this.height]}),this}function T(e,t,a){return z.zoomBlur=z.zoomBlur||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float strength;uniform vec2 texSize;varying vec2 texCoord;"+F+"void main(){vec4 color=vec4(0.0);float total=0.0;vec2 toCenter=center-texCoord*texSize;float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=0.0;t<=40.0;t++){float percent=(t+offset)/40.0;float weight=4.0*(percent-percent*percent);vec4 sample=texture2D(texture,texCoord+toCenter*percent*strength/texSize);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}"),o.call(this,z.zoomBlur,{center:[e,t],strength:a,texSize:[this.width,this.height]}),this}function O(e,t,a,n){return z.colorHalftone=z.colorHalftone||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float angle;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;float pattern(float angle){float s=sin(angle),c=cos(angle);vec2 tex=texCoord*texSize-center;vec2 point=vec2(c*tex.x-s*tex.y,s*tex.x+c*tex.y)*scale;return(sin(point.x)*sin(point.y))*4.0;}void main(){vec4 color=texture2D(texture,texCoord);vec3 cmy=1.0-color.rgb;float k=min(cmy.x,min(cmy.y,cmy.z));cmy=(cmy-k)/(1.0-k);cmy=clamp(cmy*10.0-3.0+vec3(pattern(angle+0.26179),pattern(angle+1.30899),pattern(angle)),0.0,1.0);k=clamp(k*10.0-5.0+pattern(angle+0.78539),0.0,1.0);gl_FragColor=vec4(1.0-cmy-k,color.a);}"),o.call(this,z.colorHalftone,{center:[e,t],angle:a,scale:Math.PI/n,texSize:[this.width,this.height]}),this}function I(e,t,a,n){return z.dotScreen=z.dotScreen||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float angle;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;float pattern(){float s=sin(angle),c=cos(angle);vec2 tex=texCoord*texSize-center;vec2 point=vec2(c*tex.x-s*tex.y,s*tex.x+c*tex.y)*scale;return(sin(point.x)*sin(point.y))*4.0;}void main(){vec4 color=texture2D(texture,texCoord);float average=(color.r+color.g+color.b)/3.0;gl_FragColor=vec4(vec3(average*10.0-5.0+pattern()),color.a);}"),o.call(this,z.dotScreen,{center:[e,t],angle:a,scale:Math.PI/n,texSize:[this.width,this.height]}),this}function R(e){return z.edgeWork1=z.edgeWork1||new G(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+F+"void main(){vec2 color=vec2(0.0);vec2 total=vec2(0.0);float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec3 sample=texture2D(texture,texCoord+delta*percent).rgb;float average=(sample.r+sample.g+sample.b)/3.0;color.x+=average*weight;total.x+=weight;if(abs(t)<15.0){weight=weight*2.0-1.0;color.y+=average*weight;total.y+=weight;}}gl_FragColor=vec4(color/total,0.0,1.0);}"),z.edgeWork2=z.edgeWork2||new G(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+F+"void main(){vec2 color=vec2(0.0);vec2 total=vec2(0.0);float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec2 sample=texture2D(texture,texCoord+delta*percent).xy;color.x+=sample.x*weight;total.x+=weight;if(abs(t)<15.0){weight=weight*2.0-1.0;color.y+=sample.y*weight;total.y+=weight;}}float c=clamp(10000.0*(color.y/total.y-color.x/total.x)+0.5,0.0,1.0);gl_FragColor=vec4(c,c,c,1.0);}"),o.call(this,z.edgeWork1,{delta:[e/this.width,0]}),o.call(this,z.edgeWork2,{delta:[0,e/this.height]}),this}function B(e,t,a){return z.hexagonalPixelate=z.hexagonalPixelate||new G(null,"uniform sampler2D texture;uniform vec2 center;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;void main(){vec2 tex=(texCoord*texSize-center)/scale;tex.y/=0.866025404;tex.x-=tex.y*0.5;vec2 a;if(tex.x+tex.y-floor(tex.x)-floor(tex.y)<1.0)a=vec2(floor(tex.x),floor(tex.y));else a=vec2(ceil(tex.x),ceil(tex.y));vec2 b=vec2(ceil(tex.x),floor(tex.y));vec2 c=vec2(floor(tex.x),ceil(tex.y));vec3 TEX=vec3(tex.x,tex.y,1.0-tex.x-tex.y);vec3 A=vec3(a.x,a.y,1.0-a.x-a.y);vec3 B=vec3(b.x,b.y,1.0-b.x-b.y);vec3 C=vec3(c.x,c.y,1.0-c.x-c.y);float alen=length(TEX-A);float blen=length(TEX-B);float clen=length(TEX-C);vec2 choice;if(alen0.0){coord*=mix(1.0,smoothstep(0.0,radius/distance,percent),strength*0.75);}else{coord*=mix(1.0,pow(percent,1.0+strength*0.75)*radius/distance,1.0-percent);}}coord+=center;"),o.call(this,z.bulgePinch,{radius:n,strength:e(-1,r,1),center:[t,a],texSize:[this.width,this.height]}),this}function M(e,t,a){if(z.matrixWarp=z.matrixWarp||p("uniform mat3 matrix;uniform bool useTextureSpace;","if(useTextureSpace)coord=coord/texSize*2.0-1.0;vec3 warp=matrix*vec3(coord,1.0);coord=warp.xy/warp.z;if(useTextureSpace)coord=(coord*0.5+0.5)*texSize;"),e=Array.prototype.concat.apply([],e),4==e.length)e=[e[0],e[1],0,e[2],e[3],0,0,0,1];else if(9!=e.length)throw"can only warp with 2x2 or 3x3 matrix";return o.call(this,z.matrixWarp,{matrix:t?f(e):e,texSize:[this.width,this.height],useTextureSpace:0|a}),this}function D(e,t){var a=d.apply(null,t),n=d.apply(null,e),a=f(a);return this.matrixWarp([a[0]*n[0]+a[1]*n[3]+a[2]*n[6],a[0]*n[1]+a[1]*n[4]+a[2]*n[7],a[0]*n[2]+a[1]*n[5]+a[2]*n[8],a[3]*n[0]+a[4]*n[3]+a[5]*n[6],a[3]*n[1]+a[4]*n[4]+a[5]*n[7],a[3]*n[2]+a[4]*n[5]+a[5]*n[8],a[6]*n[0]+a[7]*n[3]+a[8]*n[6],a[6]*n[1]+a[7]*n[4]+a[8]*n[7],a[6]*n[2]+a[7]*n[5]+a[8]*n[8]])}function L(e,t,a,n){return z.swirl=z.swirl||p("uniform float radius;uniform float angle;uniform vec2 center;","coord-=center;float distance=length(coord);if(distance>1;this.xa[n]>e?a=n:t=n}var n=this.xa[a]-this.xa[t],r=(this.xa[a]-e)/n;return e=(e-this.xa[t])/n,r*this.ya[t]+e*this.ya[a]+((r*r*r-r)*this.y2[t]+(e*e*e-e)*this.y2[a])*n*n/6};var N=function(){function e(e,t,a,n){this.gl=z,this.id=z.createTexture(),this.width=e,this.height=t,this.format=a,this.type=n,z.bindTexture(z.TEXTURE_2D,this.id),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MAG_FILTER,z.LINEAR),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MIN_FILTER,z.LINEAR),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_WRAP_S,z.CLAMP_TO_EDGE),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_WRAP_T,z.CLAMP_TO_EDGE),e&&t&&z.texImage2D(z.TEXTURE_2D,0,this.format,e,t,0,this.format,this.type,null)}function t(e){return null==a&&(a=document.createElement("canvas")),a.width=e.width,a.height=e.height,e=a.getContext("2d"),e.clearRect(0,0,a.width,a.height),e}e.fromElement=function(t){var a=new e(0,0,z.RGBA,z.UNSIGNED_BYTE);return a.loadContentsOf(t),a},e.prototype.loadContentsOf=function(e){this.width=e.width||e.videoWidth,this.height=e.height||e.videoHeight,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,this.format,this.format,this.type,e)},e.prototype.initFromBytes=function(e,t,a){this.width=e,this.height=t,this.format=z.RGBA,this.type=z.UNSIGNED_BYTE,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,z.RGBA,e,t,0,z.RGBA,this.type,new Uint8Array(a))},e.prototype.destroy=function(){z.deleteTexture(this.id),this.id=null},e.prototype.use=function(e){z.activeTexture(z.TEXTURE0+(e||0)),z.bindTexture(z.TEXTURE_2D,this.id)},e.prototype.unuse=function(e){z.activeTexture(z.TEXTURE0+(e||0)),z.bindTexture(z.TEXTURE_2D,null)},e.prototype.ensureFormat=function(e,t,a,n){if(1==arguments.length){var r=arguments[0];e=r.width,t=r.height,a=r.format,n=r.type}e==this.width&&t==this.height&&a==this.format&&n==this.type||(this.width=e,this.height=t,this.format=a,this.type=n,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,this.format,e,t,0,this.format,this.type,null))},e.prototype.drawTo=function(e){if(z.framebuffer=z.framebuffer||z.createFramebuffer(),z.bindFramebuffer(z.FRAMEBUFFER,z.framebuffer),z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,this.id,0),z.checkFramebufferStatus(z.FRAMEBUFFER)!==z.FRAMEBUFFER_COMPLETE)throw Error("incomplete framebuffer");z.viewport(0,0,this.width,this.height),e(),z.bindFramebuffer(z.FRAMEBUFFER,null)};var a=null;return e.prototype.fillUsingCanvas=function(e){return e(t(this)),this.format=z.RGBA,this.type=z.UNSIGNED_BYTE,z.bindTexture(z.TEXTURE_2D,this.id),z.texImage2D(z.TEXTURE_2D,0,z.RGBA,z.RGBA,z.UNSIGNED_BYTE,a),this},e.prototype.toImage=function(e){this.use(),G.getDefaultShader().drawRect();var n=4*this.width*this.height,r=new Uint8Array(n),i=t(this),o=i.createImageData(this.width,this.height);z.readPixels(0,0,this.width,this.height,z.RGBA,z.UNSIGNED_BYTE,r);for(var s=0;s=0&&b.splice(t,1)}function s(e){var t=document.createElement("style");return e.attrs.type="text/css",u(t,e.attrs),i(e,t),t}function l(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",u(t,e.attrs),i(e,t),t}function u(e,t){Object.keys(t).forEach(function(a){e.setAttribute(a,t[a])})}function c(e,t){var a,n,r,i;if(t.transform&&e.css){if(!(i=t.transform(e.css)))return function(){};e.css=i}if(t.singleton){var u=y++;a=v||(v=s(t)),n=d.bind(null,a,u,!1),r=d.bind(null,a,u,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(a=l(t),n=h.bind(null,a,t),r=function(){o(a),a.href&&URL.revokeObjectURL(a.href)}):(a=s(t),n=f.bind(null,a),r=function(){o(a)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}function d(e,t,a,n){var r=a?"":n.css;if(e.styleSheet)e.styleSheet.cssText=w(t,r);else{var i=document.createTextNode(r),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(i,o[t]):e.appendChild(i)}}function f(e,t){var a=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=a;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(a))}}function h(e,t,a){var n=a.css,r=a.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(n=_(n)),r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(o),s&&URL.revokeObjectURL(s)}var p={},m=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}}(function(){return window&&document&&document.all&&!window.atob}),g=function(e){var t={};return function(a){if(void 0===t[a]){var n=e.call(this,a);if(n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[a]=n}return t[a]}}(function(e){return document.querySelector(e)}),v=null,y=0,b=[],_=a(29);e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");t=t||{},t.attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||(t.singleton=m()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var a=r(e,t);return n(a,t),function(e){for(var i=[],o=0;o2&&void 0!==arguments[2]?arguments[2]:null;if(n(this,e),null!=r&&(l[r]=a),s)return s;s=this,this.ctx=t,this.mouse_lock=null,this.selected_obj_positions={},this.selected_object_drag_type=null,this.events()}return r(e,[{key:"events",value:function(){var e=this;document.addEventListener("mousedown",function(t){e.selected_object_actions(t)}),document.addEventListener("mousemove",function(t){e.selected_object_actions(t)}),document.addEventListener("mouseup",function(t){e.selected_object_actions(t)})}},{key:"set_selection",value:function(e,t,a,n){var r=this.find_settings();null!=e&&(r.data.x=e),null!=t&&(r.data.y=t),null!=a&&(r.data.width=a),null!=n&&(r.data.height=n),o.default.need_render=!0}},{key:"reset_selection",value:function(){this.find_settings().data={x:null,y:null,width:null,height:null},o.default.need_render=!0}},{key:"get_selection",value:function(){return this.find_settings().data}},{key:"find_settings",value:function(){var e=o.default.TOOL.name,t=null;for(var a in l)a==e&&(t=l[a]);return null===t&&(t=l.main),t.data=t.data_function.call(),t}},{key:"draw_selection",value:function(){function e(e,n,r,i,s){var l=2*Math.round(u/2);e=Math.round(e),n=Math.round(n);var c=0;null!=a.data.rotate&&a.data.rotate>0&&(c=a.data.rotate),t.selected_obj_positions[s]={x:e+r*l,y:n+i*l,size:l},0==a.enable_controlls||c>0?(t.ctx.strokeStyle="rgba(0, 128, 0, 0.4)",t.ctx.fillStyle="rgba(255, 255, 255, 0.8)"):(t.ctx.strokeStyle="#008000",t.ctx.fillStyle="#ffffff"),t.ctx.lineWidth=1,o.default.ZOOM<1&&(t.ctx.lineWidth=2),t.ctx.beginPath(),t.ctx.arc(e+r*l+d,n+i*l+d,d,0,2*Math.PI),t.ctx.fill(),t.ctx.stroke()}var t=this,a=this.find_settings(),n=a.data;if(null!==a.data&&"draft"!=a.data.status){var r=a.data.x,i=a.data.y,s=a.data.width,l=a.data.height;if(null!=r&&null!=i&&null!=s&&null!=l){var u=14;u=Math.ceil(u/o.default.ZOOM),1!=o.default.ZOOM&&(r=Math.round(r),i=Math.round(i),s=Math.round(s),l=Math.round(l));var c=u,d=Math.ceil(c/2);this.ctx.save(),null!=n.rotate&&0!=n.rotate&&(this.ctx.translate(n.x+n.width/2,n.y+n.height/2),this.ctx.rotate(n.rotate*Math.PI/180),r=Math.round(-n.width/2),i=Math.round(-n.height/2));1==a.enable_background&&(this.ctx.fillStyle="rgba(0, 255, 0, 0.3)",this.ctx.fillRect(r,i,s,l)),1==a.enable_borders&&o.default.layers.length>1&&(this.ctx.lineWidth=1,this.ctx.strokeStyle="rgba(0, 128, 0, 0.5)",this.ctx.strokeRect(r+.5,i+.5,s,l)),Math.abs(s)>3*c&&Math.abs(l)>3*c&&(e(r-d,i-d,0,0,"left_top"),e(r+s+d,i-d,-1,0,"right_top"),e(r-d,i+l+d,0,-1,"left_bottom"),e(r+s+d,i+l+d,-1,-1,"right_bottom")),1==a.enable_controlls&&(Math.abs(s)>5*c&&(e(r+s/2-c/2,i-d,0,0,"top"),e(r+s/2-c/2,i+l+d,0,-1,"bottom")),Math.abs(l)>5*c&&(e(r-d,i+l/2-c/2,0,0,"left"),e(r+s+d,i+l/2-c/2,-1,0,"right"))),this.ctx.restore()}}}},{key:"selected_object_actions",value:function(e){var t=this.find_settings();if("default"!=document.body.style.cursor&&(document.body.style.cursor="default"),!("mousedown"==e.type&&0==o.default.mouse.valid||0==t.enable_controlls||null!=t.data.rotate&&t.data.rotate>0)){var a=o.default.mouse,n=this.selected_object_drag_type;if("mousemove"!=e.type||"selected_object_actions"!=this.mouse_lock){"mouseup"==e.type&&"selected_object_actions"==this.mouse_lock&&(this.mouse_lock=null);for(var r in this.selected_obj_positions){var i=this.selected_obj_positions[r];a.x>=i.x&&a.x<=i.x+i.size&&a.y>=i.y&&a.y<=i.y+i.size&&("mousedown"==e.type&&1==e.buttons&&(this.mouse_lock="selected_object_actions",this.selected_object_drag_type=r),"mousemove"==e.type&&(document.body.style.cursor="pointer"))}}else if(document.body.style.cursor="pointer",1==e.buttons){var s=a.x-a.last_x,l=a.y-a.last_y;"left_top"==n?(t.data.x+=s,t.data.y+=l,t.data.width-=s,t.data.height-=l):"right_top"==n?(t.data.width+=s,t.data.y+=l,t.data.height-=l):"left_bottom"==n?(t.data.x+=s,t.data.height+=l,t.data.width-=s):"right_bottom"==n?(t.data.width+=s,t.data.height+=l):"top"==n?(t.data.y+=l,t.data.height-=l):"bottom"==n?t.data.height+=l:"left"==n?(t.data.x+=s,t.data.width-=s):"right"==n&&(t.data.width+=s),o.default.need_render=!0}}}}]),e}();t.default=u},function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var a=0;a100&&"power"==this.id&&(a=100,e.action_data().attributes[this.id]=a,e.show_action_attributes()),e.action_data().attributes[this.id]=a}),u.addEventListener("change",function(t){var a=parseInt(this.value);e.action_data().attributes[this.id]=a});var c=document.createElement("button");c.type="button",c.id=t,c.innerHTML="+",c.dataset.target=t,c.addEventListener("click",function(t){var a=document.getElementById(this.dataset.target).value;a=Math.abs(parseInt(a)),a+=a>=500?100:a>=100?50:a>=10?10:a>=5?5:1,a>100&&"power"==this.id&&(a=100),e.action_data().attributes[this.id]=a,e.show_action_attributes()});var d=document.createElement("button");d.type="button",d.id=t,d.innerHTML="-",d.dataset.target=t,d.addEventListener("click",function(t){var a=document.getElementById(this.dataset.target).value;a=Math.abs(parseInt(a)),a-=a>500?100:a>100?50:a>10?10:a>5?5:1,a=Math.max(a,1),e.action_data().attributes[this.id]=a,e.show_action_attributes()}),r.appendChild(s),r.appendChild(u),r.appendChild(c),r.appendChild(d)}else if("object"==(void 0===a?"undefined":i(a))){var s=document.createElement("span");s.innerHTML=n+": ";var f=document.createElement("select");f.id=t;for(var h in a.values){var m=document.createElement("option");a.value==a.values[h]&&(m.selected="selected"),m.className="trn",m.name=a.values[h],m.value=a.values[h],m.text=a.values[h],f.appendChild(m)}f.addEventListener("change",function(t){e.action_data().attributes[this.id].value=this.value,e.show_action_attributes()}),r.appendChild(s),r.appendChild(f)}else if("string"==typeof a&&"#"==a[0]){var s=document.createElement("span");s.innerHTML=n+": ";var u=document.createElement("input");u.type="color",u.id=t,u.value=a,u.addEventListener("keyup",function(t){e.action_data().attributes[this.id]=this.value}),u.addEventListener("change",function(t){e.action_data().attributes[this.id]=this.value}),r.appendChild(s),r.appendChild(u)}else p.default.error("Error: unsupported attribute type:"+(void 0===a?"undefined":i(a))+", "+t)}"en"!=l.default.LANG&&this.Help_translate.translate(l.default.LANG)}}]),e}();t.default=g},function(e,t,a){var n,r;/*! * jQuery JavaScript Library v3.2.1 * https://jquery.com/ * @@ -22,7 +22,7 @@ * * Date: 2016-08-08 */ -function(e){function t(e,t,a,n){var r,i,o,s,l,c,f,h=t&&t.ownerDocument,p=t?t.nodeType:9;if(a=a||[],"string"!=typeof e||!e||1!==p&&9!==p&&11!==p)return a;if(!n&&((t?t.ownerDocument||t:z)!==R&&I(t),t=t||R,j)){if(11!==p&&(l=me.exec(e)))if(r=l[1]){if(9===p){if(!(o=t.getElementById(r)))return a;if(o.id===r)return a.push(o),a}else if(h&&(o=h.getElementById(r))&&L(t,o)&&o.id===r)return a.push(o),a}else{if(l[2])return J.apply(a,t.getElementsByTagName(e)),a;if((r=l[3])&&_.getElementsByClassName&&t.getElementsByClassName)return J.apply(a,t.getElementsByClassName(r)),a}if(_.qsa&&!W[e+" "]&&(!A||!A.test(e))){if(1!==p)h=t,f=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(be,_e):t.setAttribute("id",s=H),c=C(e),i=c.length;i--;)c[i]="#"+s+" "+d(c[i]);f=c.join(","),h=ge.test(e)&&u(t.parentNode)||t}if(f)try{return J.apply(a,h.querySelectorAll(f)),a}catch(e){}finally{s===H&&t.removeAttribute("id")}}}return E(e.replace(ie,"$1"),t,a,n)}function a(){function e(a,n){return t.push(a+" ")>w.cacheLength&&delete e[t.shift()],e[a+" "]=n}var t=[];return e}function n(e){return e[H]=!0,e}function r(e){var t=R.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function i(e,t){for(var a=e.split("|"),n=a.length;n--;)w.attrHandle[a[n]]=t}function o(e,t){var a=t&&e,n=a&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(n)return n;if(a)for(;a=a.nextSibling;)if(a===t)return-1;return e?1:-1}function s(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&xe(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function l(e){return n(function(t){return t=+t,n(function(a,n){for(var r,i=e([],a.length,t),o=i.length;o--;)a[r=i[o]]&&(a[r]=!(n[r]=a[r]))})})}function u(e){return e&&void 0!==e.getElementsByTagName&&e}function c(){}function d(e){for(var t=0,a=e.length,n="";t1?function(t,a,n){for(var r=e.length;r--;)if(!e[r](t,a,n))return!1;return!0}:e[0]}function p(e,a,n){for(var r=0,i=a.length;r-1&&(n[u]=!(o[u]=d))}}else b=m(b===o?b.splice(g,b.length):b),i?i(null,o,b,l):J.apply(o,b)})}function v(e){for(var t,a,n,r=e.length,i=w.relative[e[0].type],o=i||w.relative[" "],s=i?1:0,l=f(function(e){return e===t},o,!0),u=f(function(e){return Q(t,e)>-1},o,!0),c=[function(e,a,n){var r=!i&&(n||a!==P)||((t=a).nodeType?l(e,a,n):u(e,a,n));return t=null,r}];s1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ie,"$1"),a,s0,i=e.length>0,o=function(n,o,s,l,u){var c,d,f,h=0,p="0",g=n&&[],v=[],y=P,b=n||i&&w.find.TAG("*",u),_=G+=null==y?1:Math.random()||.1,x=b.length;for(u&&(P=o===R||o||u);p!==x&&null!=(c=b[p]);p++){if(i&&c){for(d=0,o||c.ownerDocument===R||(I(c),s=!j);f=e[d++];)if(f(c,o||R,s)){l.push(c);break}u&&(G=_)}r&&((c=!f&&c)&&h--,n&&g.push(c))}if(h+=p,r&&p!==h){for(d=0;f=a[d++];)f(g,v,o,s);if(n){if(h>0)for(;p--;)g[p]||v[p]||(v[p]=Z.call(l));v=m(v)}J.apply(l,v),u&&!n&&v.length>0&&h+a.length>1&&t.uniqueSort(l)}return u&&(G=_,P=y),g};return r?n(o):o}var b,_,w,x,k,C,S,E,P,T,O,I,R,B,j,A,M,D,L,H="sizzle"+1*new Date,z=e.document,G=0,N=0,F=a(),U=a(),W=a(),V=function(e,t){return e===t&&(O=!0),0},Y={}.hasOwnProperty,q=[],Z=q.pop,X=q.push,J=q.push,K=q.slice,Q=function(e,t){for(var a=0,n=e.length;a+~]|"+ee+")"+ee+"*"),le=new RegExp("="+ee+"*([^\\]'\"]*?)"+ee+"*\\]","g"),ue=new RegExp(ne),ce=new RegExp("^"+te+"$"),de={ID:new RegExp("^#("+te+")"),CLASS:new RegExp("^\\.("+te+")"),TAG:new RegExp("^("+te+"|[*])"),ATTR:new RegExp("^"+ae),PSEUDO:new RegExp("^"+ne),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ee+"*(even|odd|(([+-]|)(\\d*)n|)"+ee+"*(?:([+-]|)"+ee+"*(\\d+)|))"+ee+"*\\)|)","i"),bool:new RegExp("^(?:"+$+")$","i"),needsContext:new RegExp("^"+ee+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ee+"*((?:-\\d)?\\d*)"+ee+"*\\)|)(?=[^-]|$)","i")},fe=/^(?:input|select|textarea|button)$/i,he=/^h\d$/i,pe=/^[^{]+\{\s*\[native \w/,me=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ge=/[+~]/,ve=new RegExp("\\\\([\\da-f]{1,6}"+ee+"?|("+ee+")|.)","ig"),ye=function(e,t,a){var n="0x"+t-65536;return n!==n||a?t:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)},be=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,_e=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},we=function(){I()},xe=f(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{J.apply(q=K.call(z.childNodes),z.childNodes),q[z.childNodes.length].nodeType}catch(e){J={apply:q.length?function(e,t){X.apply(e,K.call(t))}:function(e,t){for(var a=e.length,n=0;e[a++]=t[n++];);e.length=a-1}}}_=t.support={},k=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},I=t.setDocument=function(e){var t,a,n=e?e.ownerDocument||e:z;return n!==R&&9===n.nodeType&&n.documentElement?(R=n,B=R.documentElement,j=!k(R),z!==R&&(a=R.defaultView)&&a.top!==a&&(a.addEventListener?a.addEventListener("unload",we,!1):a.attachEvent&&a.attachEvent("onunload",we)),_.attributes=r(function(e){return e.className="i",!e.getAttribute("className")}),_.getElementsByTagName=r(function(e){return e.appendChild(R.createComment("")),!e.getElementsByTagName("*").length}),_.getElementsByClassName=pe.test(R.getElementsByClassName),_.getById=r(function(e){return B.appendChild(e).id=H,!R.getElementsByName||!R.getElementsByName(H).length}),_.getById?(w.filter.ID=function(e){var t=e.replace(ve,ye);return function(e){return e.getAttribute("id")===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&j){var a=t.getElementById(e);return a?[a]:[]}}):(w.filter.ID=function(e){var t=e.replace(ve,ye);return function(e){var a=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return a&&a.value===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&j){var a,n,r,i=t.getElementById(e);if(i){if((a=i.getAttributeNode("id"))&&a.value===e)return[i];for(r=t.getElementsByName(e),n=0;i=r[n++];)if((a=i.getAttributeNode("id"))&&a.value===e)return[i]}return[]}}),w.find.TAG=_.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):_.qsa?t.querySelectorAll(e):void 0}:function(e,t){var a,n=[],r=0,i=t.getElementsByTagName(e);if("*"===e){for(;a=i[r++];)1===a.nodeType&&n.push(a);return n}return i},w.find.CLASS=_.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&j)return t.getElementsByClassName(e)},M=[],A=[],(_.qsa=pe.test(R.querySelectorAll))&&(r(function(e){B.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&A.push("[*^$]="+ee+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||A.push("\\["+ee+"*(?:value|"+$+")"),e.querySelectorAll("[id~="+H+"-]").length||A.push("~="),e.querySelectorAll(":checked").length||A.push(":checked"),e.querySelectorAll("a#"+H+"+*").length||A.push(".#.+[+~]")}),r(function(e){e.innerHTML="";var t=R.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&A.push("name"+ee+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&A.push(":enabled",":disabled"),B.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&A.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),A.push(",.*:")})),(_.matchesSelector=pe.test(D=B.matches||B.webkitMatchesSelector||B.mozMatchesSelector||B.oMatchesSelector||B.msMatchesSelector))&&r(function(e){_.disconnectedMatch=D.call(e,"*"),D.call(e,"[s!='']:x"),M.push("!=",ne)}),A=A.length&&new RegExp(A.join("|")),M=M.length&&new RegExp(M.join("|")),t=pe.test(B.compareDocumentPosition),L=t||pe.test(B.contains)?function(e,t){var a=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(a.contains?a.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},V=t?function(e,t){if(e===t)return O=!0,0;var a=!e.compareDocumentPosition-!t.compareDocumentPosition;return a||(a=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&a||!_.sortDetached&&t.compareDocumentPosition(e)===a?e===R||e.ownerDocument===z&&L(z,e)?-1:t===R||t.ownerDocument===z&&L(z,t)?1:T?Q(T,e)-Q(T,t):0:4&a?-1:1)}:function(e,t){if(e===t)return O=!0,0;var a,n=0,r=e.parentNode,i=t.parentNode,s=[e],l=[t];if(!r||!i)return e===R?-1:t===R?1:r?-1:i?1:T?Q(T,e)-Q(T,t):0;if(r===i)return o(e,t);for(a=e;a=a.parentNode;)s.unshift(a);for(a=t;a=a.parentNode;)l.unshift(a);for(;s[n]===l[n];)n++;return n?o(s[n],l[n]):s[n]===z?-1:l[n]===z?1:0},R):R},t.matches=function(e,a){return t(e,null,null,a)},t.matchesSelector=function(e,a){if((e.ownerDocument||e)!==R&&I(e),a=a.replace(le,"='$1']"),_.matchesSelector&&j&&!W[a+" "]&&(!M||!M.test(a))&&(!A||!A.test(a)))try{var n=D.call(e,a);if(n||_.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return t(a,R,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==R&&I(e),L(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==R&&I(e);var a=w.attrHandle[t.toLowerCase()],n=a&&Y.call(w.attrHandle,t.toLowerCase())?a(e,t,!j):void 0;return void 0!==n?n:_.attributes||!j?e.getAttribute(t):(n=e.getAttributeNode(t))&&n.specified?n.value:null},t.escape=function(e){return(e+"").replace(be,_e)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,a=[],n=0,r=0;if(O=!_.detectDuplicates,T=!_.sortStable&&e.slice(0),e.sort(V),O){for(;t=e[r++];)t===e[r]&&(n=a.push(r));for(;n--;)e.splice(a[n],1)}return T=null,e},x=t.getText=function(e){var t,a="",n=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)a+=x(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[n++];)a+=x(t);return a},w=t.selectors={cacheLength:50,createPseudo:n,match:de,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ve,ye),e[3]=(e[3]||e[4]||e[5]||"").replace(ve,ye),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,a=!e[6]&&e[2];return de.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":a&&ue.test(a)&&(t=C(a,!0))&&(t=a.indexOf(")",a.length-t)-a.length)&&(e[0]=e[0].slice(0,t),e[2]=a.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ve,ye).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=F[e+" "];return t||(t=new RegExp("(^|"+ee+")"+e+"("+ee+"|$)"))&&F(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,a,n){return function(r){var i=t.attr(r,e);return null==i?"!="===a:!a||(i+="","="===a?i===n:"!="===a?i!==n:"^="===a?n&&0===i.indexOf(n):"*="===a?n&&i.indexOf(n)>-1:"$="===a?n&&i.slice(-n.length)===n:"~="===a?(" "+i.replace(re," ")+" ").indexOf(n)>-1:"|="===a&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,a,n,r){var i="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===n&&0===r?function(e){return!!e.parentNode}:function(t,a,l){var u,c,d,f,h,p,m=i!==o?"nextSibling":"previousSibling",g=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!l&&!s,b=!1;if(g){if(i){for(;m;){for(f=t;f=f[m];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;p=m="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?g.firstChild:g.lastChild],o&&y){for(f=g,d=f[H]||(f[H]={}),c=d[f.uniqueID]||(d[f.uniqueID]={}),u=c[e]||[],h=u[0]===G&&u[1],b=h&&u[2],f=h&&g.childNodes[h];f=++h&&f&&f[m]||(b=h=0)||p.pop();)if(1===f.nodeType&&++b&&f===t){c[e]=[G,h,b];break}}else if(y&&(f=t,d=f[H]||(f[H]={}),c=d[f.uniqueID]||(d[f.uniqueID]={}),u=c[e]||[],h=u[0]===G&&u[1],b=h),!1===b)for(;(f=++h&&f&&f[m]||(b=h=0)||p.pop())&&((s?f.nodeName.toLowerCase()!==v:1!==f.nodeType)||!++b||(y&&(d=f[H]||(f[H]={}),c=d[f.uniqueID]||(d[f.uniqueID]={}),c[e]=[G,b]),f!==t)););return(b-=r)===n||b%n==0&&b/n>=0}}},PSEUDO:function(e,a){var r,i=w.pseudos[e]||w.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return i[H]?i(a):i.length>1?(r=[e,e,"",a],w.setFilters.hasOwnProperty(e.toLowerCase())?n(function(e,t){for(var n,r=i(e,a),o=r.length;o--;)n=Q(e,r[o]),e[n]=!(t[n]=r[o])}):function(e){return i(e,0,r)}):i}},pseudos:{not:n(function(e){var t=[],a=[],r=S(e.replace(ie,"$1"));return r[H]?n(function(e,t,a,n){for(var i,o=r(e,null,n,[]),s=e.length;s--;)(i=o[s])&&(e[s]=!(t[s]=i))}):function(e,n,i){return t[0]=e,r(t,null,i,a),t[0]=null,!a.pop()}}),has:n(function(e){return function(a){return t(e,a).length>0}}),contains:n(function(e){return e=e.replace(ve,ye),function(t){return(t.textContent||t.innerText||x(t)).indexOf(e)>-1}}),lang:n(function(e){return ce.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(ve,ye).toLowerCase(),function(t){var a;do{if(a=j?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(a=a.toLowerCase())===e||0===a.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var a=e.location&&e.location.hash;return a&&a.slice(1)===t.id},root:function(e){return e===B},focus:function(e){return e===R.activeElement&&(!R.hasFocus||R.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:s(!1),disabled:s(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!w.pseudos.empty(e)},header:function(e){return he.test(e.nodeName)},input:function(e){return fe.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,a){return[a<0?a+t:a]}),even:l(function(e,t){for(var a=0;a=0;)e.push(n);return e}),gt:l(function(e,t,a){for(var n=a<0?a+t:a;++n2&&"ID"===(o=i[0]).type&&9===t.nodeType&&j&&w.relative[i[1].type]){if(!(t=(w.find.ID(o.matches[0].replace(ve,ye),t)||[])[0]))return a;c&&(t=t.parentNode),e=e.slice(i.shift().value.length)}for(r=de.needsContext.test(e)?0:i.length;r--&&(o=i[r],!w.relative[s=o.type]);)if((l=w.find[s])&&(n=l(o.matches[0].replace(ve,ye),ge.test(i[0].type)&&u(t.parentNode)||t))){if(i.splice(r,1),!(e=n.length&&d(i)))return J.apply(a,n),a;break}}return(c||S(e,f))(n,t,!j,a,!t||ge.test(e)&&u(t.parentNode)||t),a},_.sortStable=H.split("").sort(V).join("")===H,_.detectDuplicates=!!O,I(),_.sortDetached=r(function(e){return 1&e.compareDocumentPosition(R.createElement("fieldset"))}),r(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||i("type|href|height|width",function(e,t,a){if(!a)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),_.attributes&&r(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||i("value",function(e,t,a){if(!a&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),r(function(e){return null==e.getAttribute("disabled")})||i($,function(e,t,a){var n;if(!a)return!0===e[t]?t.toLowerCase():(n=e.getAttributeNode(t))&&n.specified?n.value:null}),t}(a);ye.find=ke,ye.expr=ke.selectors,ye.expr[":"]=ye.expr.pseudos,ye.uniqueSort=ye.unique=ke.uniqueSort,ye.text=ke.getText,ye.isXMLDoc=ke.isXML,ye.contains=ke.contains,ye.escapeSelector=ke.escape;var Ce=function(e,t,a){for(var n=[],r=void 0!==a;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&ye(e).is(a))break;n.push(e)}return n},Se=function(e,t){for(var a=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&a.push(e);return a},Ee=ye.expr.match.needsContext,Pe=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Te=/^.[^:#\[\.,]*$/;ye.filter=function(e,t,a){var n=t[0];return a&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?ye.find.matchesSelector(n,e)?[n]:[]:ye.find.matches(e,ye.grep(t,function(e){return 1===e.nodeType}))},ye.fn.extend({find:function(e){var t,a,n=this.length,r=this;if("string"!=typeof e)return this.pushStack(ye(e).filter(function(){for(t=0;t1?ye.uniqueSort(a):a},filter:function(e){return this.pushStack(u(this,e||[],!1))},not:function(e){return this.pushStack(u(this,e||[],!0))},is:function(e){return!!u(this,"string"==typeof e&&Ee.test(e)?ye(e):e||[],!1).length}});var Oe,Ie=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ye.fn.init=function(e,t,a){var n,r;if(!e)return this;if(a=a||Oe,"string"==typeof e){if(!(n="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Ie.exec(e))||!n[1]&&t)return!t||t.jquery?(t||a).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof ye?t[0]:t,ye.merge(this,ye.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:oe,!0)),Pe.test(n[1])&&ye.isPlainObject(t))for(n in t)ye.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return r=oe.getElementById(n[2]),r&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):ye.isFunction(e)?void 0!==a.ready?a.ready(e):e(ye):ye.makeArray(e,this)}).prototype=ye.fn,Oe=ye(oe);var Re=/^(?:parents|prev(?:Until|All))/,Be={children:!0,contents:!0,next:!0,prev:!0};ye.fn.extend({has:function(e){var t=ye(e,this),a=t.length;return this.filter(function(){for(var e=0;e-1:1===a.nodeType&&ye.find.matchesSelector(a,e))){i.push(a);break}return this.pushStack(i.length>1?ye.uniqueSort(i):i)},index:function(e){return e?"string"==typeof e?de.call(ye(e),this[0]):de.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ye.uniqueSort(ye.merge(this.get(),ye(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ye.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Ce(e,"parentNode")},parentsUntil:function(e,t,a){return Ce(e,"parentNode",a)},next:function(e){return c(e,"nextSibling")},prev:function(e){return c(e,"previousSibling")},nextAll:function(e){return Ce(e,"nextSibling")},prevAll:function(e){return Ce(e,"previousSibling")},nextUntil:function(e,t,a){return Ce(e,"nextSibling",a)},prevUntil:function(e,t,a){return Ce(e,"previousSibling",a)},siblings:function(e){return Se((e.parentNode||{}).firstChild,e)},children:function(e){return Se(e.firstChild)},contents:function(e){return l(e,"iframe")?e.contentDocument:(l(e,"template")&&(e=e.content||e),ye.merge([],e.childNodes))}},function(e,t){ye.fn[e]=function(a,n){var r=ye.map(this,t,a);return"Until"!==e.slice(-5)&&(n=a),n&&"string"==typeof n&&(r=ye.filter(n,r)),this.length>1&&(Be[e]||ye.uniqueSort(r),Re.test(e)&&r.reverse()),this.pushStack(r)}});var je=/[^\x20\t\r\n\f]+/g;ye.Callbacks=function(e){e="string"==typeof e?d(e):ye.extend({},e);var t,a,n,r,i=[],o=[],s=-1,l=function(){for(r=r||e.once,n=t=!0;o.length;s=-1)for(a=o.shift();++s-1;)i.splice(a,1),a<=s&&s--}),this},has:function(e){return e?ye.inArray(e,i)>-1:i.length>0},empty:function(){return i&&(i=[]),this},disable:function(){return r=o=[],i=a="",this},disabled:function(){return!i},lock:function(){return r=o=[],a||t||(i=a=""),this},locked:function(){return!!r},fireWith:function(e,a){return r||(a=a||[],a=[e,a.slice?a.slice():a],o.push(a),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!n}};return u},ye.extend({Deferred:function(e){var t=[["notify","progress",ye.Callbacks("memory"),ye.Callbacks("memory"),2],["resolve","done",ye.Callbacks("once memory"),ye.Callbacks("once memory"),0,"resolved"],["reject","fail",ye.Callbacks("once memory"),ye.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return ye.Deferred(function(a){ye.each(t,function(t,n){var r=ye.isFunction(e[n[4]])&&e[n[4]];i[n[1]](function(){var e=r&&r.apply(this,arguments);e&&ye.isFunction(e.promise)?e.promise().progress(a.notify).done(a.resolve).fail(a.reject):a[n[0]+"With"](this,r?[e]:arguments)})}),e=null}).promise()},then:function(e,n,r){function i(e,t,n,r){return function(){var s=this,l=arguments,u=function(){var a,u;if(!(e=o&&(n!==h&&(s=void 0,l=[a]),t.rejectWith(s,l))}};e?c():(ye.Deferred.getStackHook&&(c.stackTrace=ye.Deferred.getStackHook()),a.setTimeout(c))}}var o=0;return ye.Deferred(function(a){t[0][3].add(i(0,a,ye.isFunction(r)?r:f,a.notifyWith)),t[1][3].add(i(0,a,ye.isFunction(e)?e:f)),t[2][3].add(i(0,a,ye.isFunction(n)?n:h))}).promise()},promise:function(e){return null!=e?ye.extend(e,r):r}},i={};return ye.each(t,function(e,a){var o=a[2],s=a[5];r[a[1]]=o.add,s&&o.add(function(){n=s},t[3-e][2].disable,t[0][2].lock),o.add(a[3].fire),i[a[0]]=function(){return i[a[0]+"With"](this===i?void 0:this,arguments),this},i[a[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=arguments.length,a=t,n=Array(a),r=le.call(arguments),i=ye.Deferred(),o=function(e){return function(a){n[e]=this,r[e]=arguments.length>1?le.call(arguments):a,--t||i.resolveWith(n,r)}};if(t<=1&&(p(e,i.done(o(a)).resolve,i.reject,!t),"pending"===i.state()||ye.isFunction(r[a]&&r[a].then)))return i.then();for(;a--;)p(r[a],o(a),i.reject);return i.promise()}});var Ae=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ye.Deferred.exceptionHook=function(e,t){a.console&&a.console.warn&&e&&Ae.test(e.name)&&a.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ye.readyException=function(e){a.setTimeout(function(){throw e})};var Me=ye.Deferred();ye.fn.ready=function(e){return Me.then(e).catch(function(e){ye.readyException(e)}),this},ye.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ye.readyWait:ye.isReady)||(ye.isReady=!0,!0!==e&&--ye.readyWait>0||Me.resolveWith(oe,[ye]))}}),ye.ready.then=Me.then,"complete"===oe.readyState||"loading"!==oe.readyState&&!oe.documentElement.doScroll?a.setTimeout(ye.ready):(oe.addEventListener("DOMContentLoaded",m),a.addEventListener("load",m));var De=function(e,t,a,n,r,i,o){var s=0,l=e.length,u=null==a;if("object"===ye.type(a)){r=!0;for(s in a)De(e,t,s,a[s],!0,i,o)}else if(void 0!==n&&(r=!0,ye.isFunction(n)||(o=!0),u&&(o?(t.call(e,n),t=null):(u=t,t=function(e,t,a){return u.call(ye(e),a)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){ze.remove(this,e)})}}),ye.extend({queue:function(e,t,a){var n;if(e)return t=(t||"fx")+"queue",n=He.get(e,t),a&&(!n||Array.isArray(a)?n=He.access(e,t,ye.makeArray(a)):n.push(a)),n||[]},dequeue:function(e,t){t=t||"fx";var a=ye.queue(e,t),n=a.length,r=a.shift(),i=ye._queueHooks(e,t),o=function(){ye.dequeue(e,t)};"inprogress"===r&&(r=a.shift(),n--),r&&("fx"===t&&a.unshift("inprogress"),delete i.stop,r.call(e,o,i)),!n&&i&&i.empty.fire()},_queueHooks:function(e,t){var a=t+"queueHooks";return He.get(e,a)||He.access(e,a,{empty:ye.Callbacks("once memory").add(function(){He.remove(e,[t+"queue",a])})})}}),ye.fn.extend({queue:function(e,t){var a=2;return"string"!=typeof e&&(t=e,e="fx",a--),arguments.length\x20\t\r\n\f]+)/i,Je=/^$|\/(?:java|ecma)script/i,Ke={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ke.optgroup=Ke.option,Ke.tbody=Ke.tfoot=Ke.colgroup=Ke.caption=Ke.thead,Ke.th=Ke.td;var Qe=/<|&#?\w+;/;!function(){var e=oe.createDocumentFragment(),t=e.appendChild(oe.createElement("div")),a=oe.createElement("input");a.setAttribute("type","radio"),a.setAttribute("checked","checked"),a.setAttribute("name","t"),t.appendChild(a),ve.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",ve.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var $e=oe.documentElement,et=/^key/,tt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,at=/^([^.]*)(?:\.(.+)|)/;ye.event={global:{},add:function(e,t,a,n,r){var i,o,s,l,u,c,d,f,h,p,m,g=He.get(e);if(g)for(a.handler&&(i=a,a=i.handler,r=i.selector),r&&ye.find.matchesSelector($e,r),a.guid||(a.guid=ye.guid++),(l=g.events)||(l=g.events={}),(o=g.handle)||(o=g.handle=function(t){return void 0!==ye&&ye.event.triggered!==t.type?ye.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(je)||[""],u=t.length;u--;)s=at.exec(t[u])||[],h=m=s[1],p=(s[2]||"").split(".").sort(),h&&(d=ye.event.special[h]||{},h=(r?d.delegateType:d.bindType)||h,d=ye.event.special[h]||{},c=ye.extend({type:h,origType:m,data:n,handler:a,guid:a.guid,selector:r,needsContext:r&&ye.expr.match.needsContext.test(r),namespace:p.join(".")},i),(f=l[h])||(f=l[h]=[],f.delegateCount=0,d.setup&&!1!==d.setup.call(e,n,p,o)||e.addEventListener&&e.addEventListener(h,o)),d.add&&(d.add.call(e,c),c.handler.guid||(c.handler.guid=a.guid)),r?f.splice(f.delegateCount++,0,c):f.push(c),ye.event.global[h]=!0)},remove:function(e,t,a,n,r){var i,o,s,l,u,c,d,f,h,p,m,g=He.hasData(e)&&He.get(e);if(g&&(l=g.events)){for(t=(t||"").match(je)||[""],u=t.length;u--;)if(s=at.exec(t[u])||[],h=m=s[1],p=(s[2]||"").split(".").sort(),h){for(d=ye.event.special[h]||{},h=(n?d.delegateType:d.bindType)||h,f=l[h]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=i=f.length;i--;)c=f[i],!r&&m!==c.origType||a&&a.guid!==c.guid||s&&!s.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(f.splice(i,1),c.selector&&f.delegateCount--,d.remove&&d.remove.call(e,c));o&&!f.length&&(d.teardown&&!1!==d.teardown.call(e,p,g.handle)||ye.removeEvent(e,h,g.handle),delete l[h])}else for(h in l)ye.event.remove(e,h+t[u],a,n,!0);ye.isEmptyObject(l)&&He.remove(e,"handle events")}},dispatch:function(e){var t,a,n,r,i,o,s=ye.event.fix(e),l=new Array(arguments.length),u=(He.get(this,"events")||{})[s.type]||[],c=ye.event.special[s.type]||{};for(l[0]=s,t=1;t=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==e.type||!0!==u.disabled)){for(i=[],o={},a=0;a-1:ye.find(r,this,null,[u]).length),o[r]&&i.push(n);i.length&&s.push({elem:u,handlers:i})}return u=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,rt=/\s*$/g;ye.extend({htmlPrefilter:function(e){return e.replace(nt,"<$1>")},clone:function(e,t,a){var n,r,i,o,s=e.cloneNode(!0),l=ye.contains(e.ownerDocument,e);if(!(ve.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ye.isXMLDoc(e)))for(o=x(s),i=x(e),n=0,r=i.length;n0&&k(o,!l&&x(e,"script")),s},cleanData:function(e){for(var t,a,n,r=ye.event.special,i=0;void 0!==(a=e[i]);i++)if(Le(a)){if(t=a[He.expando]){if(t.events)for(n in t.events)r[n]?ye.event.remove(a,n):ye.removeEvent(a,n,t.handle);a[He.expando]=void 0}a[ze.expando]&&(a[ze.expando]=void 0)}}}),ye.fn.extend({detach:function(e){return M(this,e,!0)},remove:function(e){return M(this,e)},text:function(e){return De(this,function(e){return void 0===e?ye.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){O(this,e).appendChild(e)}})},prepend:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=O(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ye.cleanData(x(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ye.clone(this,e,t)})},html:function(e){return De(this,function(e){var t=this[0]||{},a=0,n=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!rt.test(e)&&!Ke[(Xe.exec(e)||["",""])[1].toLowerCase()]){e=ye.htmlPrefilter(e);try{for(;a1)}}),ye.Tween=U,U.prototype={constructor:U,init:function(e,t,a,n,r,i){this.elem=e,this.prop=a,this.easing=r||ye.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=i||(ye.cssNumber[a]?"":"px")},cur:function(){var e=U.propHooks[this.prop];return e&&e.get?e.get(this):U.propHooks._default.get(this)},run:function(e){var t,a=U.propHooks[this.prop];return this.options.duration?this.pos=t=ye.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),a&&a.set?a.set(this):U.propHooks._default.set(this),this}},U.prototype.init.prototype=U.prototype,U.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ye.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){ye.fx.step[e.prop]?ye.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[ye.cssProps[e.prop]]&&!ye.cssHooks[e.prop]?e.elem[e.prop]=e.now:ye.style(e.elem,e.prop,e.now+e.unit)}}},U.propHooks.scrollTop=U.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ye.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ye.fx=U.prototype.init,ye.fx.step={};var vt,yt,bt=/^(?:toggle|show|hide)$/,_t=/queueHooks$/;ye.Animation=ye.extend(J,{tweeners:{"*":[function(e,t){var a=this.createTween(e,t);return b(a.elem,e,Ue.exec(t),a),a}]},tweener:function(e,t){ye.isFunction(e)?(t=e,e=["*"]):e=e.match(je);for(var a,n=0,r=e.length;n1)},removeAttr:function(e){return this.each(function(){ye.removeAttr(this,e)})}}),ye.extend({attr:function(e,t,a){var n,r,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return void 0===e.getAttribute?ye.prop(e,t,a):(1===i&&ye.isXMLDoc(e)||(r=ye.attrHooks[t.toLowerCase()]||(ye.expr.match.bool.test(t)?wt:void 0)),void 0!==a?null===a?void ye.removeAttr(e,t):r&&"set"in r&&void 0!==(n=r.set(e,a,t))?n:(e.setAttribute(t,a+""),a):r&&"get"in r&&null!==(n=r.get(e,t))?n:(n=ye.find.attr(e,t),null==n?void 0:n))},attrHooks:{type:{set:function(e,t){if(!ve.radioValue&&"radio"===t&&l(e,"input")){var a=e.value;return e.setAttribute("type",t),a&&(e.value=a),t}}}},removeAttr:function(e,t){var a,n=0,r=t&&t.match(je);if(r&&1===e.nodeType)for(;a=r[n++];)e.removeAttribute(a)}}),wt={set:function(e,t,a){return!1===t?ye.removeAttr(e,a):e.setAttribute(a,a),a}},ye.each(ye.expr.match.bool.source.match(/\w+/g),function(e,t){var a=xt[t]||ye.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var kt=/^(?:input|select|textarea|button)$/i,Ct=/^(?:a|area)$/i;ye.fn.extend({prop:function(e,t){return De(this,ye.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[ye.propFix[e]||e]})}}),ye.extend({prop:function(e,t,a){var n,r,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return 1===i&&ye.isXMLDoc(e)||(t=ye.propFix[t]||t,r=ye.propHooks[t]),void 0!==a?r&&"set"in r&&void 0!==(n=r.set(e,a,t))?n:e[t]=a:r&&"get"in r&&null!==(n=r.get(e,t))?n:e[t]},propHooks:{tabIndex:{get:function(e){var t=ye.find.attr(e,"tabindex");return t?parseInt(t,10):kt.test(e.nodeName)||Ct.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),ve.optSelected||(ye.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ye.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ye.propFix[this.toLowerCase()]=this}),ye.fn.extend({addClass:function(e){var t,a,n,r,i,o,s,l=0;if(ye.isFunction(e))return this.each(function(t){ye(this).addClass(e.call(this,t,Q(this)))});if("string"==typeof e&&e)for(t=e.match(je)||[];a=this[l++];)if(r=Q(a),n=1===a.nodeType&&" "+K(r)+" "){for(o=0;i=t[o++];)n.indexOf(" "+i+" ")<0&&(n+=i+" ");s=K(n),r!==s&&a.setAttribute("class",s)}return this},removeClass:function(e){var t,a,n,r,i,o,s,l=0;if(ye.isFunction(e))return this.each(function(t){ye(this).removeClass(e.call(this,t,Q(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(je)||[];a=this[l++];)if(r=Q(a),n=1===a.nodeType&&" "+K(r)+" "){for(o=0;i=t[o++];)for(;n.indexOf(" "+i+" ")>-1;)n=n.replace(" "+i+" "," ");s=K(n),r!==s&&a.setAttribute("class",s)}return this},toggleClass:function(e,t){var a=typeof e;return"boolean"==typeof t&&"string"===a?t?this.addClass(e):this.removeClass(e):ye.isFunction(e)?this.each(function(a){ye(this).toggleClass(e.call(this,a,Q(this),t),t)}):this.each(function(){var t,n,r,i;if("string"===a)for(n=0,r=ye(this),i=e.match(je)||[];t=i[n++];)r.hasClass(t)?r.removeClass(t):r.addClass(t);else void 0!==e&&"boolean"!==a||(t=Q(this),t&&He.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":He.get(this,"__className__")||""))})},hasClass:function(e){var t,a,n=0;for(t=" "+e+" ";a=this[n++];)if(1===a.nodeType&&(" "+K(Q(a))+" ").indexOf(t)>-1)return!0;return!1}});var St=/\r/g;ye.fn.extend({val:function(e){var t,a,n,r=this[0];{if(arguments.length)return n=ye.isFunction(e),this.each(function(a){var r;1===this.nodeType&&(r=n?e.call(this,a,ye(this).val()):e,null==r?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=ye.map(r,function(e){return null==e?"":e+""})),(t=ye.valHooks[this.type]||ye.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))});if(r)return(t=ye.valHooks[r.type]||ye.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(a=t.get(r,"value"))?a:(a=r.value,"string"==typeof a?a.replace(St,""):null==a?"":a)}}}),ye.extend({valHooks:{option:{get:function(e){var t=ye.find.attr(e,"value");return null!=t?t:K(ye.text(e))}},select:{get:function(e){var t,a,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type,s=o?null:[],u=o?i+1:r.length;for(n=i<0?u:o?i:0;n-1)&&(a=!0);return a||(e.selectedIndex=-1),i}}}}),ye.each(["radio","checkbox"],function(){ye.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=ye.inArray(ye(e).val(),t)>-1}},ve.checkOn||(ye.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Et=/^(?:focusinfocus|focusoutblur)$/;ye.extend(ye.event,{trigger:function(e,t,n,r){var i,o,s,l,u,c,d,f=[n||oe],h=pe.call(e,"type")?e.type:e,p=pe.call(e,"namespace")?e.namespace.split("."):[];if(o=s=n=n||oe,3!==n.nodeType&&8!==n.nodeType&&!Et.test(h+ye.event.triggered)&&(h.indexOf(".")>-1&&(p=h.split("."),h=p.shift(),p.sort()),u=h.indexOf(":")<0&&"on"+h,e=e[ye.expando]?e:new ye.Event(h,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ye.makeArray(t,[e]),d=ye.event.special[h]||{},r||!d.trigger||!1!==d.trigger.apply(n,t))){if(!r&&!d.noBubble&&!ye.isWindow(n)){for(l=d.delegateType||h,Et.test(l+h)||(o=o.parentNode);o;o=o.parentNode)f.push(o),s=o;s===(n.ownerDocument||oe)&&f.push(s.defaultView||s.parentWindow||a)}for(i=0;(o=f[i++])&&!e.isPropagationStopped();)e.type=i>1?l:d.bindType||h,c=(He.get(o,"events")||{})[e.type]&&He.get(o,"handle"),c&&c.apply(o,t),(c=u&&o[u])&&c.apply&&Le(o)&&(e.result=c.apply(o,t),!1===e.result&&e.preventDefault());return e.type=h,r||e.isDefaultPrevented()||d._default&&!1!==d._default.apply(f.pop(),t)||!Le(n)||u&&ye.isFunction(n[h])&&!ye.isWindow(n)&&(s=n[u],s&&(n[u]=null),ye.event.triggered=h,n[h](),ye.event.triggered=void 0,s&&(n[u]=s)),e.result}},simulate:function(e,t,a){var n=ye.extend(new ye.Event,a,{type:e,isSimulated:!0});ye.event.trigger(n,null,t)}}),ye.fn.extend({trigger:function(e,t){return this.each(function(){ye.event.trigger(e,t,this)})},triggerHandler:function(e,t){var a=this[0];if(a)return ye.event.trigger(e,t,a,!0)}}),ye.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){ye.fn[t]=function(e,a){return arguments.length>0?this.on(t,null,e,a):this.trigger(t)}}),ye.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),ve.focusin="onfocusin"in a,ve.focusin||ye.each({focus:"focusin",blur:"focusout"},function(e,t){var a=function(e){ye.event.simulate(t,e.target,ye.event.fix(e))};ye.event.special[t]={setup:function(){var n=this.ownerDocument||this,r=He.access(n,t);r||n.addEventListener(e,a,!0),He.access(n,t,(r||0)+1)},teardown:function(){var n=this.ownerDocument||this,r=He.access(n,t)-1;r?He.access(n,t,r):(n.removeEventListener(e,a,!0),He.remove(n,t))}}});var Pt=a.location,Tt=ye.now(),Ot=/\?/;ye.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new a.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||ye.error("Invalid XML: "+e),t};var It=/\[\]$/,Rt=/\r?\n/g,Bt=/^(?:submit|button|image|reset|file)$/i,jt=/^(?:input|select|textarea|keygen)/i;ye.param=function(e,t){var a,n=[],r=function(e,t){var a=ye.isFunction(t)?t():t;n[n.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==a?"":a)};if(Array.isArray(e)||e.jquery&&!ye.isPlainObject(e))ye.each(e,function(){r(this.name,this.value)});else for(a in e)$(a,e[a],t,r);return n.join("&")},ye.fn.extend({serialize:function(){return ye.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ye.prop(this,"elements");return e?ye.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ye(this).is(":disabled")&&jt.test(this.nodeName)&&!Bt.test(e)&&(this.checked||!Ze.test(e))}).map(function(e,t){var a=ye(this).val();return null==a?null:Array.isArray(a)?ye.map(a,function(e){return{name:t.name,value:e.replace(Rt,"\r\n")}}):{name:t.name,value:a.replace(Rt,"\r\n")}}).get()}});var At=/%20/g,Mt=/#.*$/,Dt=/([?&])_=[^&]*/,Lt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ht=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,zt=/^(?:GET|HEAD)$/,Gt=/^\/\//,Nt={},Ft={},Ut="*/".concat("*"),Wt=oe.createElement("a");Wt.href=Pt.href,ye.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Pt.href,type:"GET",isLocal:Ht.test(Pt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ut,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ye.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ae(ae(e,ye.ajaxSettings),t):ae(ye.ajaxSettings,e)},ajaxPrefilter:ee(Nt),ajaxTransport:ee(Ft),ajax:function(e,t){function n(e,t,n,s){var u,f,h,_,w,x=t;c||(c=!0,l&&a.clearTimeout(l),r=void 0,o=s||"",k.readyState=e>0?4:0,u=e>=200&&e<300||304===e,n&&(_=ne(p,k,n)),_=re(p,_,k,u),u?(p.ifModified&&(w=k.getResponseHeader("Last-Modified"),w&&(ye.lastModified[i]=w),(w=k.getResponseHeader("etag"))&&(ye.etag[i]=w)),204===e||"HEAD"===p.type?x="nocontent":304===e?x="notmodified":(x=_.state,f=_.data,h=_.error,u=!h)):(h=x,!e&&x||(x="error",e<0&&(e=0))),k.status=e,k.statusText=(t||x)+"",u?v.resolveWith(m,[f,x,k]):v.rejectWith(m,[k,x,h]),k.statusCode(b),b=void 0,d&&g.trigger(u?"ajaxSuccess":"ajaxError",[k,p,u?f:h]),y.fireWith(m,[k,x]),d&&(g.trigger("ajaxComplete",[k,p]),--ye.active||ye.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,s,l,u,c,d,f,h,p=ye.ajaxSetup({},t),m=p.context||p,g=p.context&&(m.nodeType||m.jquery)?ye(m):ye.event,v=ye.Deferred(),y=ye.Callbacks("once memory"),b=p.statusCode||{},_={},w={},x="canceled",k={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s)for(s={};t=Lt.exec(o);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?o:null},setRequestHeader:function(e,t){return null==c&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,_[e]=t),this},overrideMimeType:function(e){return null==c&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)k.always(e[k.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||x;return r&&r.abort(t),n(0,t),this}};if(v.promise(k),p.url=((e||p.url||Pt.href)+"").replace(Gt,Pt.protocol+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(je)||[""],null==p.crossDomain){u=oe.createElement("a");try{u.href=p.url,u.href=u.href,p.crossDomain=Wt.protocol+"//"+Wt.host!=u.protocol+"//"+u.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=ye.param(p.data,p.traditional)),te(Nt,p,t,k),c)return k;d=ye.event&&p.global,d&&0==ye.active++&&ye.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!zt.test(p.type),i=p.url.replace(Mt,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(At,"+")):(h=p.url.slice(i.length),p.data&&(i+=(Ot.test(i)?"&":"?")+p.data,delete p.data),!1===p.cache&&(i=i.replace(Dt,"$1"),h=(Ot.test(i)?"&":"?")+"_="+Tt+++h),p.url=i+h),p.ifModified&&(ye.lastModified[i]&&k.setRequestHeader("If-Modified-Since",ye.lastModified[i]),ye.etag[i]&&k.setRequestHeader("If-None-Match",ye.etag[i])),(p.data&&p.hasContent&&!1!==p.contentType||t.contentType)&&k.setRequestHeader("Content-Type",p.contentType),k.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Ut+"; q=0.01":""):p.accepts["*"]);for(f in p.headers)k.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(!1===p.beforeSend.call(m,k,p)||c))return k.abort();if(x="abort",y.add(p.complete),k.done(p.success),k.fail(p.error),r=te(Ft,p,t,k)){if(k.readyState=1,d&&g.trigger("ajaxSend",[k,p]),c)return k;p.async&&p.timeout>0&&(l=a.setTimeout(function(){k.abort("timeout")},p.timeout));try{c=!1,r.send(_,n)}catch(e){if(c)throw e;n(-1,e)}}else n(-1,"No Transport");return k},getJSON:function(e,t,a){return ye.get(e,t,a,"json")},getScript:function(e,t){return ye.get(e,void 0,t,"script")}}),ye.each(["get","post"],function(e,t){ye[t]=function(e,a,n,r){return ye.isFunction(a)&&(r=r||n,n=a,a=void 0),ye.ajax(ye.extend({url:e,type:t,dataType:r,data:a,success:n},ye.isPlainObject(e)&&e))}}),ye._evalUrl=function(e){return ye.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},ye.fn.extend({wrapAll:function(e){var t;return this[0]&&(ye.isFunction(e)&&(e=e.call(this[0])),t=ye(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return ye.isFunction(e)?this.each(function(t){ye(this).wrapInner(e.call(this,t))}):this.each(function(){var t=ye(this),a=t.contents();a.length?a.wrapAll(e):t.append(e)})},wrap:function(e){var t=ye.isFunction(e);return this.each(function(a){ye(this).wrapAll(t?e.call(this,a):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ye(this).replaceWith(this.childNodes)}),this}}),ye.expr.pseudos.hidden=function(e){return!ye.expr.pseudos.visible(e)},ye.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ye.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Yt=ye.ajaxSettings.xhr();ve.cors=!!Yt&&"withCredentials"in Yt,ve.ajax=Yt=!!Yt,ye.ajaxTransport(function(e){var t,n;if(ve.cors||Yt&&!e.crossDomain)return{send:function(r,i){var o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)s[o]=e.xhrFields[o];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)s.setRequestHeader(o,r[o]);t=function(e){return function(){t&&(t=n=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?i(0,"error"):i(s.status,s.statusText):i(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),n=s.onerror=t("error"),void 0!==s.onabort?s.onabort=n:s.onreadystatechange=function(){4===s.readyState&&a.setTimeout(function(){t&&n()})},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}}),ye.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ye.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ye.globalEval(e),e}}}),ye.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ye.ajaxTransport("script",function(e){if(e.crossDomain){var t,a;return{send:function(n,r){t=ye("