piskel/js/piskel-packaged-min-2016-10-01-02-48.js

16 lines
499 KiB
JavaScript
Raw Normal View History

2016-10-01 15:50:25 +03:00
!function(a,b){function c(a){var b=oa[a]={};return $.each(a.split(ba),function(a,c){b[c]=!0}),b}function d(a,c,d){if(d===b&&1===a.nodeType){var e="data-"+c.replace(qa,"-$1").toLowerCase();if(d=a.getAttribute(e),"string"==typeof d){try{d="true"===d||"false"!==d&&("null"===d?null:+d+""===d?+d:pa.test(d)?$.parseJSON(d):d)}catch(f){}$.data(a,c,d)}else d=b}return d}function e(a){var b;for(b in a)if(("data"!==b||!$.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function f(){return!1}function g(){return!0}function h(a){return!a||!a.parentNode||11===a.parentNode.nodeType}function i(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function j(a,b,c){if(b=b||0,$.isFunction(b))return $.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return $.grep(a,function(a,d){return a===b===c});if("string"==typeof b){var d=$.grep(a,function(a){return 1===a.nodeType});if(Ka.test(b))return $.filter(b,d,!c);b=$.filter(b,d)}return $.grep(a,function(a,d){return $.inArray(a,b)>=0===c})}function k(a){var b=Na.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function l(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function m(a,b){if(1===b.nodeType&&$.hasData(a)){var c,d,e,f=$._data(a),g=$._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)$.event.add(b,c,h[c][d])}g.data&&(g.data=$.extend({},g.data))}}function n(a,b){var c;1===b.nodeType&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),$.support.html5Clone&&a.innerHTML&&!$.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Xa.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.selected=a.defaultSelected:"input"===c||"textarea"===c?b.defaultValue=a.defaultValue:"script"===c&&b.text!==a.text&&(b.text=a.text),b.removeAttribute($.expando))}function o(a){return"undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName("*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll("*"):[]}function p(a){Xa.test(a.type)&&(a.defaultChecked=a.checked)}function q(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=qb.length;e--;)if(b=qb[e]+c,b in a)return b;return d}function r(a,b){return a=b||a,"none"===$.css(a,"display")||!$.contains(a.ownerDocument,a)}function s(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)c=a[f],c.style&&(e[f]=$._data(c,"olddisplay"),b?(e[f]||"none"!==c.style.display||(c.style.display=""),""===c.style.display&&r(c)&&(e[f]=$._data(c,"olddisplay",w(c.nodeName)))):(d=cb(c,"display"),e[f]||"none"===d||$._data(c,"olddisplay",d)));for(f=0;f<g;f++)c=a[f],c.style&&(b&&"none"!==c.style.display&&""!==c.style.display||(c.style.display=b?e[f]||"":"none"));return a}function t(a,b,c){var d=jb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function u(a,b,c,d){for(var e=c===(d?"border":"content")?4:"width"===b?1:0,f=0;e<4;e+=2)"margin"===c&&(f+=$.css(a,c+pb[e],!0)),d?("content"===c&&(f-=parseFloat(cb(a,"padding"+pb[e]))||0),"margin"!==c&&(f-=parseFloat(cb(a,"border"+pb[e]+"Width"))||0)):(f+=parseFloat(cb(a,"padding"+pb[e]))||0,"padding"!==c&&(f+=parseFloat(cb(a,"border"+pb[e]+"Width"))||0));return f}function v(a,b,c){var d="width"===b?a.offsetWidth:a.offsetHeight,e=!0,f=$.support.boxSizing&&"border-box"===$.css(a,"boxSizing");if(d<=0){if(d=cb(a,b),(d<0||null==d)&&(d=a.style[b]),kb.test(d))return d;e=f&&($.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+u(a,b,c||(f?"border":"content"),e)+"px"}function w(a){if(mb[a])return mb[a];var b=$("<"+a+">").appendTo(P.body),c=b.css("display");return b.remove(),"none"!==c&&""!==c||(db=P.body.appendChild(db||$.extend(P.createElement("iframe"),{frameBorder:0,width:0,height:0})),eb&&db.createElement||(eb=(db.contentWindow||db.contentDocument).document,eb.write("<!doctype html><html><body>"),eb.close()),b=eb.body.appendChild(eb.createElement(a)),c=cb(b,"display"),P.bod
c}})}),$.attrHooks.contenteditable={get:ra.get,set:function(a,b,c){""===b&&(b="false"),ra.set(a,b,c)}}),$.support.hrefNormalized||$.each(["href","src","width","height"],function(a,c){$.attrHooks[c]=$.extend($.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return null===d?b:d}})}),$.support.style||($.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),$.support.optSelected||($.propHooks.selected=$.extend($.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),$.support.enctype||($.propFix.enctype="encoding"),$.support.checkOn||$.each(["radio","checkbox"],function(){$.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}}),$.each(["radio","checkbox"],function(){$.valHooks[this]=$.extend($.valHooks[this],{set:function(a,b){if($.isArray(b))return a.checked=$.inArray($(a).val(),b)>=0}})});var Ba=/^(?:textarea|input|select)$/i,Ca=/^([^\.]*|)(?:\.(.+)|)$/,Da=/(?:^|\s)hover(\.\S+|)\b/,Ea=/^key/,Fa=/^(?:mouse|contextmenu)|click/,Ga=/^(?:focusinfocus|focusoutblur)$/,Ha=function(a){return $.event.special.hover?a:a.replace(Da,"mouseenter$1 mouseleave$1")};$.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q;if(3!==a.nodeType&&8!==a.nodeType&&c&&d&&(g=$._data(a))){for(d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=$.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return"undefined"==typeof $||a&&$.event.triggered===a.type?b:$.event.dispatch.apply(h.elem,arguments)},h.elem=a),c=$.trim(Ha(c)).split(" "),j=0;j<c.length;j++)k=Ca.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),q=$.event.special[l]||{},l=(f?q.delegateType:q.bindType)||l,q=$.event.special[l]||{},n=$.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),p=i[l],p||(p=i[l]=[],p.delegateCount=0,q.setup&&q.setup.call(a,e,m,h)!==!1||(a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h))),q.add&&(q.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?p.splice(p.delegateCount++,0,n):p.push(n),$.event.global[l]=!0;a=null}},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=$.hasData(a)&&$._data(a);if(q&&(m=q.events)){for(b=$.trim(Ha(b||"")).split(" "),f=0;f<b.length;f++)if(g=Ca.exec(b[f])||[],h=i=g[1],j=g[2],h){for(n=$.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,l=0;l<o.length;l++)p=o[l],!e&&i!==p.origType||c&&c.guid!==p.guid||j&&!j.test(p.namespace)||d&&d!==p.selector&&("**"!==d||!p.selector)||(o.splice(l--,1),p.selector&&o.delegateCount--,n.remove&&n.remove.call(a,p));0===o.length&&k!==o.length&&(n.teardown&&n.teardown.call(a,j,q.handle)!==!1||$.removeEvent(a,h,q.handle),delete m[h])}else for(h in m)$.event.remove(a,h+b[f],c,d,!0);$.isEmptyObject(m)&&(delete q.handle,$.removeData(a,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,f){if(!e||3!==e.nodeType&&8!==e.nodeType){var g,h,i,j,k,l,m,n,o,p,q=c.type||c,r=[];if(!Ga.test(q+$.event.triggered)&&(q.indexOf("!")>=0&&(q=q.slice(0,-1),h=!0),q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),e&&!$.event.customEvent[q]||$.event.global[q]))if(c="object"==typeof c?c[$.expando]?c:new $.Event(q,c):new $.Event(q),c.type=q,c.isTrigger=!0,c.exclusive=h,c.namespace=r.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,l=q.indexOf(":")<0?"on"+q:"",e){if(c.result=b,c.target||(c.target=e),d=null!=d?$.makeArray(d):[],d.unshift(c),m=$.event.special[q]||{},!m.trigger||m.trigger.apply(e,d)!==!1){if(o=[[e,m.bindType||q]],!f&&!m.noBubble&&!$.isWindow(e)){for(p=m.delegateType||q,j=Ga.test(p+q)?e:e.parentNode,k=e;j;j=j.parentNode)o.push([j,p]),k=j;k===(e.ownerDocument||P)&&o.push([k.defaultView||k.parentWindow||a,p])}for(i=0;i<o.length&&!c.isPropagationStopped();i++)j=o[i][0],c.type=o[i][1],n=($._data(j,"events")||{})[c.type]
_a.th=_a.td,$.support.htmlSerialize||(_a._default=[1,"X<div>","</div>"]),$.fn.extend({text:function(a){return $.access(this,function(a){return a===b?$.text(this):this.empty().append((this[0]&&this[0].ownerDocument||P).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if($.isFunction(a))return this.each(function(b){$(this).wrapAll(a.call(this,b))});if(this[0]){var b=$(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return $.isFunction(a)?this.each(function(b){$(this).wrapInner(a.call(this,b))}):this.each(function(){var b=$(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=$.isFunction(a);return this.each(function(c){$(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){$.nodeName(this,"body")||$(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType||this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType||this.insertBefore(a,this.firstChild)})},before:function(){if(!h(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=$.clean(arguments);return this.pushStack($.merge(a,this),"before",this.selector)}},after:function(){if(!h(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=$.clean(arguments);return this.pushStack($.merge(this,a),"after",this.selector)}},remove:function(a,b){for(var c,d=0;null!=(c=this[d]);d++)a&&!$.filter(a,[c]).length||(b||1!==c.nodeType||($.cleanData(c.getElementsByTagName("*")),$.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)for(1===a.nodeType&&$.cleanData(a.getElementsByTagName("*"));a.firstChild;)a.removeChild(a.firstChild);return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return $.clone(this,a,b)})},html:function(a){return $.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return 1===c.nodeType?c.innerHTML.replace(Oa,""):b;if("string"==typeof a&&!Ua.test(a)&&($.support.htmlSerialize||!Wa.test(a))&&($.support.leadingWhitespace||!Pa.test(a))&&!_a[(Ra.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Qa,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},1===c.nodeType&&($.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return h(this[0])?this.length?this.pushStack($($.isFunction(a)?a():a),"replaceWith",a):this:$.isFunction(a)?this.each(function(b){var c=$(this),d=c.html();c.replaceWith(a.call(this,b,d))}):("string"!=typeof a&&(a=$(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;$(this).remove(),b?$(b).before(a):$(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],m=this.length;if(!$.support.checkClone&&m>1&&"string"==typeof j&&Ya.test(j))return this.each(function(){$(this).domManip(a,c,d)});if($.isFunction(j))return this.each(function(e){var f=$(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){if(e=$.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,1===g.childNodes.length&&(g=f),f)for(c=c&&$.nodeName(f,"tr"),h=e.cacheable||m-1;i<m;i++)d.call(c&&$.nodeName(this[i],"table")?l(this[i],"tbody"):this[i],i===h?g:$.clone(g,!0,!0));g=f=null,k.length&&$.each(k,function(a,b){b.src?$.ajax?$.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):$.error("no ajax"):$.globalEval((b.text||b.textContent||b.innerHTML||"").replace($a,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),$.buildFragment=function(a,c,d){var e,f,g,h=a[0];return c=c||P,c=(c[0]
e=b[d]>0,b[d]=0,e)}})}(jQuery),function(a,b){var c=0,d=Array.prototype.slice,e=a.cleanData;a.cleanData=function(b){for(var c,d=0;null!=(c=b[d]);d++)try{a(c).triggerHandler("remove")}catch(f){}e(b)},a.widget=function(b,c,d){var e,f,g,h,i={},j=b.split(".")[0];b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){return this._createWidget?void(arguments.length&&this._createWidget(a,b)):new g(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){return a.isFunction(d)?void(i[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},e=function(a){return c.prototype[b].apply(this,a)};return function(){var b,c=this._super,f=this._superApply;return this._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}()):void(i[b]=d)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g)},a.widget.extend=function(c){for(var e,f,g=d.call(arguments,1),h=0,i=g.length;h<i;h++)for(e in g[h])f=g[h][e],g[h].hasOwnProperty(e)&&f!==b&&(a.isPlainObject(f)?c[e]=a.isPlainObject(c[e])?a.widget.extend({},c[e],f):a.widget.extend({},f):c[e]=f);return c},a.widget.bridge=function(c,e){var f=e.prototype.widgetFullName||c;a.fn[c]=function(g){var h="string"==typeof g,i=d.call(arguments,1),j=this;return g=!h&&i.length?a.widget.extend.apply(null,[g].concat(i)):g,h?this.each(function(){var d,e=a.data(this,f);return e?a.isFunction(e[g])&&"_"!==g.charAt(0)?(d=e[g].apply(e,i),d!==e&&d!==b?(j=d&&d.jquery?j.pushStack(d.get()):d,!1):void 0):a.error("no such method '"+g+"' for "+c+" widget instance"):a.error("cannot call methods on "+c+" prior to initialization; attempted to call method '"+g+"'")}):this.each(function(){var b=a.data(this,f);b?b.option(g||{})._init():a.data(this,f,new e(g,this))}),j}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(b,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===d&&this.destroy()}}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(c,d){var e,f,g,h=c;if(0===arguments.length)return a.widget.extend({},this.options);if("string"==typeof c)if(h={},e=c.split("."),c=e.shift(),e.length){for(f=h[c]=a.widget.extend({},this.options[c]),g=0;g<e.length-1;g++)f[e[g]]=f[e[g]]||{},f=f[e[g]];if(c=e.pop(),d===b)return f[c]===b?null:f[c];f[c]=d}else{if(d===b)return this.options[c]===b?null:this.options[c];h[c]=d}return this._setOptions(h),this},_setOptions:function(a){var b;for(b in a)this._setOption(b,a[b]);return this},_setOption:functi
if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!b){for(this._trigger("beforeStop",a,this._uiHash()),c=0;c<d.length;c++)d[c].call(this,a);this._trigger("stop",a,this._uiHash())}return this.fromOutside=!1,!1}if(b||this._trigger("beforeStop",a,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!b){for(c=0;c<d.length;c++)d[c].call(this,a);this._trigger("stop",a,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}})}(jQuery),function(a){var b=a({});a.subscribe=function(){b.on.apply(b,arguments)},a.unsubscribe=function(){b.off.apply(b,arguments)},a.publish=function(){b.trigger.apply(b,arguments)}}(jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,"click"==this.options.trigger?this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this)):"manual"!=this.options.trigger&&(e="hover"==this.options.trigger?"mouseenter":"focus",f="hover"==this.options.trigger?"mouseleave":"blur",this.$element.on(e+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);return c.options.delay&&c.options.delay.show?(clearTimeout(this.timeout),c.hoverState="in",void(this.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show))):c.show()},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),c.options.delay&&c.options.delay.hide?(c.hoverState="out",void(this.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide))):c.hide()},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){switch(a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f="function"==typeof this.options.placement?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight,b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var c=this.tip();return c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():c.remove(),this},fixTitle:function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-titl
a.WorkerUtils={createWorker:function(c,d){return b[d]||(b[d]=a.WorkerUtils.createWorkerURL(c)),new Worker(b[d])},createWorkerURL:function(a){var b=[(a+"").replace(/function\s*\(\)\s*\{/,"").replace(/\}[^}]*$/,"")],c=new Blob(b,{type:"application/javascript"});return window.URL.createObjectURL(c)}}}(),function(){var a=$.namespace("pskl.utils");a.Xhr={get:function(b,c,d){var e=a.Xhr.xhr_(b,"GET",c,d);e.send()},post:function(b,c,d,e){var f=a.Xhr.xhr_(b,"POST",d,e),g=new FormData;if("object"==typeof c)for(var h in c)c.hasOwnProperty(h)&&g.append(h,c[h]);f.send(g)},xhr_:function(a,b,c,d){c=c||function(){},d=d||function(){};var e=new XMLHttpRequest;return e.open(b,a,!0),e.onload=function(a){200==this.status?c(this):this.onerror(this,a)},e.onerror=function(a){d(a,this)},e}}}(),function(){var a=$.namespace("pskl.utils");a.Serializer={calculateRequiredBytes:function(a,b){var c=(a.getWidth(),a.getHeight(),a.getDescriptor().name.length),d=a.getDescriptor().description.length,e=(a.getLayers().length,0);e+=8,e+=4,e+=2,e+=2*c,e+=2*d;for(var f=0,g=a.getLayers();f<g.length;f++)e+=10,e+=2*g[f].name.length,e+=b[f].length,e%2==1&&e++;return e},serializePiskel:function(a,b){var c,d,e,f,g,h=[];for(c=0,e=a.getLayers();c<e.length;c++){var i=new pskl.rendering.FramesheetRenderer(e[c].getFrames());f=i.renderAsCanvas().toDataURL().split(",")[1],g=f.length,h.push({uri:f,length:g})}var j=pskl.utils.Serializer.calculateRequiredBytes(a,h),k=new ArrayBuffer(j),l=new Uint8Array(k),m=new Uint16Array(k),n=a.getWidth(),o=a.getHeight(),p=a.getDescriptor().name,q=p.length,r=a.getDescriptor().description,s=r.length;for(m[0]=Constants.MODEL_VERSION,m[1]=n,m[2]=o,m[3]=pskl.app.piskelController.getFPS(),m[4]=q,m[5]=s,m[6]=a.getLayers().length,c=0;c<q;c++)m[7+c]=p.charCodeAt(c);for(c=0;c<s;c++)m[7+q+c]=r.charCodeAt(c);var t=7+q+s;for(c=0,e=a.getLayers();c<e.length;c++){var u=e[c],v=u.getFrames(),w=u.getName(),x=w.length,y=u.getOpacity(),z=v.length;for(f=h[c].uri,g=h[c].length,m[t]=x,m[t+1]=Math.floor(65535*y),m[t+2]=z,m[t+3]=(4294901760&g)>>16>>>0,m[t+4]=(65535&g)>>>0,d=0;d<x;d++)m[t+5+d]=w.charCodeAt(d);for(d=0;d<g;d++)l[2*(t+5+x)+d]=f.charCodeAt(d);t+=Math.ceil(5+x+g/2)}return k}}}(),function(){var a=$.namespace("pskl.utils.serialization");a.Deserializer=function(a,b){this.data_=a,this.callback_=b},a.Deserializer.deserialize=function(b,c){var d;if(!(b instanceof ArrayBuffer||b instanceof Array))throw"Invalid data for deserializing: "+b;var e=new Uint8Array(b);if("{"==String.fromCharCode(e[0])){b="";for(var f=0;f<e.length;f++)b+=String.fromCharCode(e[f]);b=JSON.parse(b),d=b.modelVersion}else{var g=new Uint16Array(e.buffer);d=g[0]}var h;h=d==Constants.MODEL_VERSION?new a.Deserializer(b,c):2==d?new a.backward.Deserializer_v2(b,c):1==d?new a.backward.Deserializer_v1(b,c):new a.backward.Deserializer_v0(b,c),h.deserialize()},a.Deserializer.prototype.deserialize=function(a){var b,c,d=this.data_,e=new Uint8Array(d),f=new Uint16Array(e.buffer),g=(f[0],f[1]),h=f[2],i=f[3],j=f[4],k=f[5],l=f[6],m="";for(b=0;b<j;b++)m+=String.fromCharCode(f[7+b]);var n="";for(b=0;b<k;b++)n=String.fromCharCode(f[7+j+b]);var o,p=7+j+k,q=[];for(b=0;b<l;b++){o={};var r=f[p],s=f[p+1]/65535,t=f[p+2],u=f[p+3],v=f[p+4],w=v>>>0|u<<16>>>0,x="";for(c=0;c<r;c++)x+=String.fromCharCode(f[p+5+c]);var y="";for(c=0;c<w;c++)y+=String.fromCharCode(e[2*(p+5+r)+c]);y="data:image/png;base64,"+y,p+=Math.ceil(5+r+w/2),o.name=x,o.opacity=s,o.frameCount=t,o.dataUri=y,q.push(o)}var z=new pskl.model.piskel.Descriptor(m,n),A=new pskl.model.Piskel(g,h,z),B=0,C=function(a,b){var c=new Image;c.onload=function(){var c=pskl.utils.LayerUtils.createFramesFromSpritesheet(this,a.frameCount);c.forEach(a.model.addFrame.bind(a.model)),B++,B==l&&b(A,{fps:i})},c.src=a.dataUri};for(b=0;b<l;b++){o=q[b];var D=new pskl.model.Layer(o.name);o.model=D,D.setOpacity(o.opacity),A.addLayer(D),C.bind(this,o,this.callback_)()}}}(),function(){var a=$.namespace("pskl.utils.serialization.backward");a.Deserializer_v0=function(a,b){this.data_=a,this.callback_=b},a.Deserializer_v0.prototype.deserialize=function(){var a=this.data_,b=a.map(function(a)
e[4*b+1]=c[a][1],e[4*b+2]=c[a][2],e[4*b+3]=255)}),p.putImageData(d,a.leftPos,a.topPos),q=a},B={hdr:x,gce:y,img:A,eof:function(a){z(),j=!1,C&&C()},onError:function(a){E&&E()}},C=!1,D=!1,E=!1,F=document.createElement("canvas");return{load:function(b){if(C=b.success,D=b.step,E=b.error,j=!0,s.src.indexOf("data:")!==-1){var c=s.src.substring(s.src.indexOf(",")+1);g=new d(a.atob(c)),u()}else{var e=new XMLHttpRequest;e.overrideMimeType("text/plain; charset=x-user-defined"),e.onload=function(a){g=new d(e.responseText),setTimeout(u,0)},e.onerror=function(){w("xhr")},e.open("GET",s.getAttribute("data-animated-src")||s.src,!0),e.send()}},getFrames:function(){return r}}};a.SuperGif=g}(window),!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZip=a():"undefined"!=typeof global?global.JSZip=a():"undefined"!=typeof self&&(self.JSZip=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";c.encode=function(a){for(var b,c,e,f,g,h,i,j="",k=0;k<a.length;)b=a.charCodeAt(k++),c=a.charCodeAt(k++),e=a.charCodeAt(k++),f=b>>2,g=(3&b)<<4|c>>4,h=(15&c)<<2|e>>6,i=63&e,isNaN(c)?h=i=64:isNaN(e)&&(i=64),j=j+d.charAt(f)+d.charAt(g)+d.charAt(h)+d.charAt(i);return j},c.decode=function(a){var b,c,e,f,g,h,i,j="",k=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)f=d.indexOf(a.charAt(k++)),g=d.indexOf(a.charAt(k++)),h=d.indexOf(a.charAt(k++)),i=d.indexOf(a.charAt(k++)),b=f<<2|g>>4,c=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(b),64!=h&&(j+=String.fromCharCode(c)),64!=i&&(j+=String.fromCharCode(e));return j}},{}],2:[function(a,b){"use strict";function c(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}c.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},b.exports=c},{}],3:[function(a,b,c){"use strict";c.STORE={magic:"\0\0",compress:function(a){return a},uncompress:function(a){return a},compressInputType:null,uncompressInputType:null},c.DEFLATE=a("./flate")},{"./flate":6}],4:[function(a,b){"use strict";function c(){this.data=null,this.length=0,this.index=0}var d=a("./utils");c.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<a||0>a)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return d.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1)}},b.exports=c},{"./utils":14}],5:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.date=null,c.compression=null},{}],6:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,e=a("zlibjs/bin/rawdeflate.min").Zlib,f=a("zlibjs/bin/rawinflate.min").Zlib;c.uncompressInputType=d?"uint8array":"array",c.compressInputType=d?"uint8array":"array",c.magic="\b\0",c.compress=function(a){var b=new e.RawDeflate(a);return b.compress()},c.uncompress=function(a){var b=new f.RawInflate(a);return b.decompress()}},{"zlibjs/bin/rawdeflate.min":19,"zlibjs/bin/rawinflate.min":20}],7:[function(a,b){"use strict";function c(a,
r[s++]=p,++u[p])}j.push(d)}return r[s++]=256,u[256]++,a.j=u,a.i=v,o?r.subarray(0,s):r}function h(a,b,c){var d,e,g,h,i,j,k=0,l=a.length;h=0,j=c.length;a:for(;j>h;h++){if(d=c[j-h-1],g=3,k>3){for(i=k;i>3;i--)if(a[d+i-1]!==a[b+i-1])continue a;g=k}for(;258>g&&l>b+g&&a[d+g]===a[b+g];)++g;if(g>k&&(e=d,k=g),258===g)break}return new f(k,b-e)}function i(a,b){var c,e,f,g,h,i=a.length,k=new d(572),l=new(o?Uint8Array:Array)(i);if(!o)for(g=0;i>g;g++)l[g]=0;for(g=0;i>g;++g)0<a[g]&&k.push(g,a[g]);if(c=Array(k.length/2),e=new(o?Uint32Array:Array)(k.length/2),1===c.length)return l[k.pop().index]=1,l;for(g=0,h=k.length/2;h>g;++g)c[g]=k.pop(),e[g]=c[g].value;for(f=j(e,e.length,b),g=0,h=c.length;h>g;++g)l[c[g].index]=f[g];return l}function j(a,b,c){function d(a){var c=n[a][p[a]];c===b?(d(a+1),d(a+1)):--l[c],++p[a]}var e,f,g,h,i,j=new(o?Uint16Array:Array)(c),k=new(o?Uint8Array:Array)(c),l=new(o?Uint8Array:Array)(b),m=Array(c),n=Array(c),p=Array(c),q=(1<<c)-b,r=1<<c-1;for(j[c-1]=b,f=0;c>f;++f)r>q?k[f]=0:(k[f]=1,q-=r),q<<=1,j[c-2-f]=(j[c-1-f]/2|0)+b;for(j[0]=k[0],m[0]=Array(j[0]),n[0]=Array(j[0]),f=1;c>f;++f)j[f]>2*j[f-1]+k[f]&&(j[f]=2*j[f-1]+k[f]),m[f]=Array(j[f]),n[f]=Array(j[f]);for(e=0;b>e;++e)l[e]=c;for(g=0;g<j[c-1];++g)m[c-1][g]=a[g],n[c-1][g]=g;for(e=0;c>e;++e)p[e]=0;for(1===k[c-1]&&(--l[0],++p[c-1]),f=c-2;f>=0;--f){for(h=e=0,i=p[f+1],g=0;g<j[f];g++)h=m[f+1][i]+m[f+1][i+1],h>a[e]?(m[f][g]=h,n[f][g]=b,i+=2):(m[f][g]=a[e],n[f][g]=e,++e);p[f]=0,1===k[f]&&d(f)}return l}function k(a){var b,c,d,e,f=new(o?Uint16Array:Array)(a.length),g=[],h=[],i=0;for(b=0,c=a.length;c>b;b++)g[a[b]]=(0|g[a[b]])+1;for(b=1,c=16;c>=b;b++)h[b]=i,i+=0|g[b],i<<=1;for(b=0,c=a.length;c>b;b++)for(i=h[a[b]],h[a[b]]+=1,d=f[b]=0,e=a[b];e>d;d++)f[b]=f[b]<<1|1&i,i>>>=1;return f}var l=void 0,m=!0,n=this,o="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;b.prototype.a=function(a,b,d){var e,f=this.buffer,g=this.index,h=this.d,i=f[g];if(d&&b>1&&(a=b>8?(u[255&a]<<24|u[a>>>8&255]<<16|u[a>>>16&255]<<8|u[a>>>24&255])>>32-b:u[a]>>8-b),8>b+h)i=i<<b|a,h+=b;else for(e=0;b>e;++e)i=i<<1|a>>b-e-1&1,8===++h&&(h=0,f[g++]=u[i],i=0,g===f.length&&(f=c(this)));f[g]=i,this.buffer=f,this.d=h,this.index=g},b.prototype.finish=function(){var a,b=this.buffer,c=this.index;return 0<this.d&&(b[c]<<=8-this.d,b[c]=u[b[c]],c++),o?a=b.subarray(0,c):(b.length=c,a=b),a};var p,q=new(o?Uint8Array:Array)(256);for(p=0;256>p;++p){for(var r=p,s=r,t=7,r=r>>>1;r;r>>>=1)s<<=1,s|=1&r,--t;q[p]=(s<<t&255)>>>0}var u=q;d.prototype.getParent=function(a){return 2*((a-2)/4|0)},d.prototype.push=function(a,b){var c,d,e,f=this.buffer;for(c=this.length,f[this.length++]=b,f[this.length++]=a;c>0&&(d=this.getParent(c),f[c]>f[d]);)e=f[c],f[c]=f[d],f[d]=e,e=f[c+1],f[c+1]=f[d+1],f[d+1]=e,c=d;return this.length},d.prototype.pop=function(){var a,b,c,d,e,f=this.buffer;for(b=f[0],a=f[1],this.length-=2,f[0]=f[this.length],f[1]=f[this.length+1],e=0;d=2*e+2,!(d>=this.length)&&(d+2<this.length&&f[d+2]>f[d]&&(d+=2),f[d]>f[e]);)c=f[e],f[e]=f[d],f[d]=c,c=f[e+1],f[e+1]=f[d+1],f[d+1]=c,e=d;return{index:a,value:b,length:this.length}};var v,w=2,x=[];for(v=0;288>v;v++)switch(m){case 143>=v:x.push([v+48,8]);break;case 255>=v:x.push([v-144+400,9]);break;case 279>=v:x.push([v-256+0,7]);break;case 287>=v:x.push([v-280+192,8]);break;default:throw"invalid literal: "+v}e.prototype.h=function(){var a,c,d,e,f=this.input;switch(this.e){case 0:for(d=0,e=f.length;e>d;){c=o?f.subarray(d,d+65535):f.slice(d,d+65535),d+=c.length;var h=c,j=d===e,n=l,p=l,q=l,r=l,s=l,t=this.b,u=this.c;if(o){for(t=new Uint8Array(this.b.buffer);t.length<=u+h.length+5;)t=new Uint8Array(t.length<<1);t.set(this.b)}if(n=j?1:0,t[u++]=0|n,p=h.length,q=~p+65536&65535,t[u++]=255&p,t[u++]=p>>>8&255,t[u++]=255&q,t[u++]=q>>>8&255,o)t.set(h,u),u+=h.length,t=t.subarray(0,u);else{for(r=0,s=h.length;s>r;++r)t[u++]=h[r];t.length=u}this.c=u,this.b=t}break;case 1:var v=new b(o?new Uint8Array(this.b.buffer):this.b,this.c);v.a(1,1,m),v.a(1,2,m);var y,z,A,B=g(this,f);for(y=0,z=B.length;z>y;y++)if(A=B[y],b.prototype.a.apply(v,x[A]),A>
color:h}},b.readable=function(a,c){var d=b.readability(a,c);return d.brightness>125&&d.color>500},b.mostReadable=function(a,c){for(var d=null,e=0,f=!1,g=0;g<c.length;g++){var h=b.readability(a,c[g]),i=h.brightness>125&&h.color>500,j=3*(h.brightness/125)+h.color/500;(i&&!f||i&&f&&j>e||!i&&!f&&j>e)&&(f=i,e=j,d=b(c[g]))}return d};var B=b.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},C=b.hexNames=j(B),D=function(){var a="[-\\+]?\\d+%?",b="[-\\+]?\\d*\\.\\d+%?",c="(?:"+b+")|(?:"+a+")",d="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",e="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?";return{rgb:new RegExp("rgb"+d),rgba:new RegExp("rgba"+e),hsl:new RegExp("hsl"+d),hsla:new RegExp("hsla"+e),hsv:new RegExp("hsv"+d),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();a.tinycolor=b}();var u=a.tinycolor;b(function(){b.fn.spectrum.load&&b.fn.spectrum.processNativeColorInputs()})}(window,jQuery),function(a){"use strict";if("function"==typeof bootstrap)bootstrap("promise",a);else if("object"==typeof exports&&"object"==typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=a}else{if("undefined"==typeof self)throw new Error("This environment was not anticipated by Q.
}})}},a.SelectionManager.prototype.commit=function(){var a=pskl.app.drawingController.currentToolBehavior,b=a instanceof pskl.tools.drawing.selection.BaseSelect;if(b){var c=pskl.app.drawingController.overlayFrame;a.commitSelection(c)}},a.SelectionManager.prototype.replay=function(a,c){c.type===b.PASTE?this.pastePixels_(a,c.pixels):c.type===b.ERASE&&c.pixels.forEach(function(b){a.setPixel(b.col,b.row,Constants.TRANSPARENT_COLOR)})},a.SelectionManager.prototype.pastePixels_=function(a,b){b.forEach(function(b){b.color!==Constants.TRANSPARENT_COLOR&&null!==b.color&&a.setPixel(b.col,b.row,b.color)})},a.SelectionManager.prototype.copy=function(){this.currentSelection&&this.piskelController.getCurrentFrame()&&this.currentSelection.fillSelectionFromFrame(this.piskelController.getCurrentFrame())},a.SelectionManager.prototype.onSelectionCreated_=function(a,b){b?this.currentSelection=b:console.error("No selection provided to SelectionManager")},a.SelectionManager.prototype.onSelectionMoved_=function(a,b,c){this.currentSelection?this.currentSelection.move(b,c):console.error("Bad state: No currentSelection set when trying to move it in SelectionManager")}}(),function(){var a=$.namespace("pskl.selection");a.BaseSelection=function(){this.reset()},a.BaseSelection.prototype.reset=function(){this.pixels=[],this.hasPastedContent=!1},a.BaseSelection.prototype.move=function(a,b){for(var c=[],d=0,e=this.pixels.length;d<e;d++){var f=this.pixels[d];f.col+=a,f.row+=b,c.push(f)}this.pixels=c},a.BaseSelection.prototype.fillSelectionFromFrame=function(a){this.pixels.forEach(function(b){var c=a.getPixel(b.col,b.row);b.color=c||Constants.TRANSPARENT_COLOR}),this.hasPastedContent=!0}}(),function(){var a=$.namespace("pskl.selection"),b=-1,c=1,d=2;a.LassoSelection=function(a,b){this.pixelsMap={},a.forEach(function(a){this.setPixelInMap_(a,c)}.bind(this)),this.pixels=this.getLassoPixels_(b)},pskl.utils.inherit(a.LassoSelection,a.BaseSelection),a.LassoSelection.prototype.getLassoPixels_=function(a){var b=[];return a.forEachPixel(function(c,d,e){var f={col:d,row:e};this.isInSelection_(f,a)&&b.push(f)}.bind(this)),b},a.LassoSelection.prototype.isInSelection_=function(a,b){var d=this.getPixelInMap_(a);return d||this.visitPixel_(a,b),this.getPixelInMap_(a)==c},a.LassoSelection.prototype.visitPixel_=function(a,e){var f=!1,g=pskl.PixelUtils.visitConnectedPixels(a,e,function(a){var b=this.getPixelInMap_(a);return!b&&(e.containsPixel(a.col,a.row)?(this.setPixelInMap_(a,d),!0):(f=!0,!1))}.bind(this));g.forEach(function(a){this.setPixelInMap_(a,f?b:c)}.bind(this))},a.LassoSelection.prototype.setPixelInMap_=function(a,b){this.pixelsMap[a.col]=this.pixelsMap[a.col]||{},this.pixelsMap[a.col][a.row]=b},a.LassoSelection.prototype.getPixelInMap_=function(a){return this.pixelsMap[a.col]&&this.pixelsMap[a.col][a.row]}}(),function(){var a=$.namespace("pskl.selection");a.RectangularSelection=function(a,b,c,d){this.pixels=pskl.PixelUtils.getRectanglePixels(a,b,c,d)},pskl.utils.inherit(a.RectangularSelection,a.BaseSelection)}(),function(){var a=$.namespace("pskl.selection");a.ShapeSelection=function(a){this.pixels=a},pskl.utils.inherit(a.ShapeSelection,a.BaseSelection)}(),function(){var a=$.namespace("pskl.rendering");a.AbstractRenderer=function(){},a.AbstractRenderer.prototype.clear=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.render=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.getCoordinates=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.setGridWidth=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.getGridWidth=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.setZoom=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.getZoom=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.setOffset=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.getOffset=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.setDisplaySize=Constants.ABSTRACT_FUNCTION,a.AbstractRenderer.prototype.getDisplaySize=Constants.ABSTRACT_FUNCTION}(),function(){var a=$.namespace("pskl.rendering");a.CompositeRenderer=function(){this.renderers
},a.DrawingController.prototype.onMousedown_=function(a){$.publish(Events.MOUSE_EVENT,[a,this]);var b=this.piskelController.getCurrentFrame(),c=this.getSpriteCoordinates(a.clientX,a.clientY);a.changedTouches&&a.changedTouches[0]&&(c=this.getSpriteCoordinates(a.changedTouches[0].clientX,a.changedTouches[0].clientY)),this.isClicked=!0,a.button===Constants.MIDDLE_BUTTON?this.dragHandler.startDrag(a.clientX,a.clientY):(this.currentToolBehavior.hideHighlightedPixel(this.overlayFrame),$.publish(Events.TOOL_PRESSED),this.currentToolBehavior.applyToolAt(c.x,c.y,b,this.overlayFrame,a))},a.DrawingController.prototype.onMousemove_=function(a){this._clientX=a.clientX,this._clientY=a.clientY,a.changedTouches&&a.changedTouches[0]&&(this._clientX=a.changedTouches[0].clientX,this._clientY=a.changedTouches[0].clientY);var b=(new Date).getTime();b-this.previousMousemoveTime>Constants.MOUSEMOVE_THROTTLING&&(this.moveTool_(this._clientX,this._clientY,a),this.previousMousemoveTime=b)},a.DrawingController.prototype.onKeyup_=function(a){this.moveTool_(this._clientX,this._clientY,a)},a.DrawingController.prototype.moveTool_=function(a,b,c){var d=this.getSpriteCoordinates(a,b),e=this.piskelController.getCurrentFrame();this.isClicked?pskl.app.mouseStateService.isMiddleButtonPressed()?this.dragHandler.updateDrag(a,b):($.publish(Events.MOUSE_EVENT,[c,this]),this.currentToolBehavior.moveToolAt(0|d.x,0|d.y,e,this.overlayFrame,c)):this.currentToolBehavior.moveUnactiveToolAt(d.x,d.y,e,this.overlayFrame,c),$.publish(Events.CURSOR_MOVED,[d.x,d.y])},a.DrawingController.prototype.onMousewheel_=function(a){var b,c=a.originalEvent;pskl.utils.UserAgent.isChrome?b=c.wheelDeltaY:pskl.utils.UserAgent.isIE11?b=c.wheelDelta:pskl.utils.UserAgent.isFirefox&&(b=-40*c.deltaY);var d=b/120;(pskl.utils.UserAgent.isMac?c.metaKey:c.ctrlKey)&&(d=5*d,c.preventDefault());var e=this.getSpriteCoordinates(c.clientX,c.clientY);this.updateZoom_(d,e)},a.DrawingController.prototype.updateZoom_=function(a,b){if(0!==a){var c=this.getOffset(),d=this.getContainerWidth_()/this.renderer.getZoom(),e=this.getContainerHeight_()/this.renderer.getZoom(),f=a*this.getZoomStep_();if(this.setZoom_(this.renderer.getZoom()+f),"object"==typeof b){var g=(b.x-c.x)/d,h=(b.y-c.y)/e,i=this.getContainerWidth_()/this.renderer.getZoom(),j=this.getContainerHeight_()/this.renderer.getZoom();this.setOffset(c.x-(i-d)*g,c.y-(j-e)*h)}}},a.DrawingController.prototype.onMouseup_=function(a){var b=this.piskelController.getCurrentFrame(),c=this.getSpriteCoordinates(a.clientX,a.clientY);a.changedTouches&&a.changedTouches[0]&&(c=this.getSpriteCoordinates(a.changedTouches[0].clientX,a.changedTouches[0].clientY)),this.isClicked&&(this.isClicked=!1,pskl.app.mouseStateService.isMiddleButtonPressed()?this.dragHandler.isDragging()?this.dragHandler.stopDrag():b.containsPixel(c.x,c.y)&&$.publish(Events.SELECT_PRIMARY_COLOR,[b.getPixel(c.x,c.y)]):(this.currentToolBehavior.releaseToolAt(c.x,c.y,this.piskelController.getCurrentFrame(),this.overlayFrame,a),$.publish(Events.TOOL_RELEASED)),$.publish(Events.MOUSE_EVENT,[a,this]))},a.DrawingController.prototype.getSpriteCoordinates=function(a,b){return this.renderer.getCoordinates(a,b)},a.DrawingController.prototype.getScreenCoordinates=function(a,b){return this.renderer.reverseCoordinates(a,b)},a.DrawingController.prototype.onCanvasContextMenu_=function(a){if($(a.target).closest("#drawing-canvas-container").length)return a.preventDefault(),a.stopPropagation(),a.cancelBubble=!0,!1},a.DrawingController.prototype.render=function(){var a=this.piskelController.getCurrentFrame();a.isSameSize(this.overlayFrame)||(this.overlayFrame=pskl.model.Frame.createEmptyFromFrame(a)),pskl.UserSettings.get(pskl.UserSettings.ONION_SKIN)&&this.onionSkinRenderer.render(),pskl.UserSettings.get(pskl.UserSettings.LAYER_PREVIEW)&&this.layersRenderer.render(),this.renderer.render(a),this.overlayRenderer.render(this.overlayFrame)},a.DrawingController.prototype.calculateZoom_=function(){var a=this.piskelController.getCurrentFrame().getHeight(),b=this.piskelController.getCurrentFrame().getWidth();return Math.min(t
this.toolIconBuilder=new pskl.tools.ToolIconBuilder},a.ToolController.prototype.init=function(){this.createToolsDom_(),this.addKeyboardShortcuts_(),this.selectTool_(this.tools[0]),$("#tool-section").mousedown($.proxy(this.onToolIconClicked_,this)),$.subscribe(Events.SELECT_TOOL,this.onSelectToolEvent_.bind(this)),$.subscribe(Events.SHORTCUTS_CHANGED,this.createToolsDom_.bind(this))},a.ToolController.prototype.activateToolOnStage_=function(a){var b=$("body"),c=b.data("selected-tool-class");c&&(b.removeClass(c),b.removeClass(pskl.tools.drawing.Move.TOOL_ID)),b.addClass(a.toolId),b.data("selected-tool-class",a.toolId)},a.ToolController.prototype.onSelectToolEvent_=function(a,b){var c=this.getToolById_(b);c&&this.selectTool_(c)},a.ToolController.prototype.selectTool_=function(a){this.currentSelectedTool=a,this.activateToolOnStage_(this.currentSelectedTool);var b=$("#tool-section .tool-icon.selected"),c=$("[data-tool-id="+a.toolId+"]");b.removeClass("selected"),c.addClass("selected"),$.publish(Events.TOOL_SELECTED,[a])},a.ToolController.prototype.onToolIconClicked_=function(a){var b=$(a.target),c=b.closest(".tool-icon");if(c.length){var d=c.data().toolId,e=this.getToolById_(d);e&&this.selectTool_(e)}},a.ToolController.prototype.onKeyboardShortcut_=function(a,b){var c=this.getToolById_(a);null!==c&&this.selectTool_(c)},a.ToolController.prototype.getToolById_=function(a){return pskl.utils.Array.find(this.tools,function(b){return b.toolId==a})},a.ToolController.prototype.createToolsDom_=function(){for(var a="",b=0;b<this.tools.length;b++){var c=this.tools[b];a+=this.toolIconBuilder.createIcon(c)}$("#tools-container").html(a)},a.ToolController.prototype.addKeyboardShortcuts_=function(){for(var a=0;a<this.tools.length;a++){var b=this.tools[a];pskl.app.shortcutService.registerShortcut(b.shortcut,this.onKeyboardShortcut_.bind(this,b.toolId))}}}(),function(){var a=$.namespace("pskl.controller");a.PaletteController=function(){},a.PaletteController.prototype.init=function(){$.subscribe(Events.SELECT_PRIMARY_COLOR,this.onColorSelected_.bind(this,{isPrimary:!0})),$.subscribe(Events.SELECT_SECONDARY_COLOR,this.onColorSelected_.bind(this,{isPrimary:!1}));var a=pskl.service.keyboard.Shortcuts;pskl.app.shortcutService.registerShortcut(a.COLOR.SWAP,this.swapColors.bind(this)),pskl.app.shortcutService.registerShortcut(a.COLOR.RESET,this.resetColors.bind(this));var b={showPalette:!0,showButtons:!1,showInput:!0,palette:[["rgba(0,0,0,0)"]],clickoutFiresChange:!0,beforeShow:function(a){a.setAlpha(1)}},c=$("#color-picker");c.spectrum($.extend({color:Constants.DEFAULT_PEN_COLOR},b)),c.change({isPrimary:!0},$.proxy(this.onPickerChange_,this)),this.setTitleOnPicker_(Constants.DEFAULT_PEN_COLOR,c);var d=$("#secondary-color-picker");d.spectrum($.extend({color:Constants.TRANSPARENT_COLOR},b)),d.change({isPrimary:!1},$.proxy(this.onPickerChange_,this)),this.setTitleOnPicker_(Constants.TRANSPARENT_COLOR,d);var e=$(".swap-colors-button");e.click(this.swapColors.bind(this))},a.PaletteController.prototype.onPickerChange_=function(a,b){var c=$(a.target),d=c.val();d!=Constants.TRANSPARENT_COLOR&&(d=window.tinycolor(d).toHexString()),a.data.isPrimary?this.setPrimaryColor_(d):this.setSecondaryColor_(d)},a.PaletteController.prototype.onColorSelected_=function(a,b,c){$(b.target);a.isPrimary?this.setPrimaryColor_(c):this.setSecondaryColor_(c)},a.PaletteController.prototype.setPrimaryColor_=function(a){this.updateColorPicker_(a,$("#color-picker")),$.publish(Events.PRIMARY_COLOR_SELECTED,[a])},a.PaletteController.prototype.setSecondaryColor_=function(a){this.updateColorPicker_(a,$("#secondary-color-picker")),$.publish(Events.SECONDARY_COLOR_SELECTED,[a])},a.PaletteController.prototype.swapColors=function(){var a=pskl.app.selectedColorsService.getPrimaryColor();this.setPrimaryColor_(pskl.app.selectedColorsService.getSecondaryColor()),this.setSecondaryColor_(a)},a.PaletteController.prototype.resetColors=function(){pskl.app.selectedColorsService.reset()},a.PaletteController.prototype.updateColorPicker_=function(a,b){a==Constants.TRANSPARENT_COLOR?(b.spectrum("set",Const
var b=pskl.UserSettings.get(pskl.UserSettings.EXPORT_TAB);this.selectTab(b)},a.ExportController.prototype.destroy=function(){this.sizeInputWidget.destroy(),this.currentController.destroy(),this.superclass.destroy.call(this)},a.ExportController.prototype.selectTab=function(a){if(b[a]&&this.currentTab!=a){this.currentController&&this.currentController.destroy(),this.exportPanel.innerHTML=pskl.utils.Template.get(b[a].template),this.currentController=new b[a].controller(this.piskelController,this),this.currentController.init(),this.currentTab=a,pskl.UserSettings.set(pskl.UserSettings.EXPORT_TAB,a);var c=this.exportTabs.querySelector(".selected");c&&c.classList.remove("selected"),this.exportTabs.querySelector('[data-tab-id="'+a+'"]').classList.add("selected")}},a.ExportController.prototype.onTabsClicked_=function(a){var b=pskl.utils.Dom.getData(a.target,"tabId");this.selectTab(b)},a.ExportController.prototype.onScaleChange_=function(){var a=parseFloat(this.scaleInput.value);isNaN(a)||(Math.round(this.getExportZoom())!=a&&this.sizeInputWidget.setWidth(this.piskelController.getWidth()*a),pskl.UserSettings.set(pskl.UserSettings.EXPORT_SCALE,a))},a.ExportController.prototype.updateScaleText_=function(a){a=a.toFixed(1);var b=document.querySelector(".export-scale .scale-text");b.innerHTML=a+"x"},a.ExportController.prototype.onSizeInputChange_=function(){var a=this.getExportZoom();isNaN(a)||(this.updateScaleText_(a),$.publish(Events.EXPORT_SCALE_CHANGED),this.scaleInput.value=Math.round(a),a>=1&&a<=32&&this.onScaleChange_())},a.ExportController.prototype.getExportZoom=function(){return parseInt(this.widthInput.value,10)/this.piskelController.getWidth()}}(),function(){var a=$.namespace("pskl.controller.settings.resize"),b="resize-origin-option";a.AnchorWidget=function(a){this.container=a,this.disabled=!1,pskl.utils.Event.addEventListener(this.container,"click",this.onResizeOriginClick_,this)},a.AnchorWidget.ORIGIN={TOPLEFT:"TOPLEFT",TOP:"TOP",TOPRIGHT:"TOPRIGHT",MIDDLELEFT:"MIDDLELEFT",MIDDLE:"MIDDLE",MIDDLERIGHT:"MIDDLERIGHT",BOTTOMLEFT:"BOTTOMLEFT",BOTTOM:"BOTTOM",BOTTOMRIGHT:"BOTTOMRIGHT"},a.AnchorWidget.prototype.destroy=function(a){pskl.utils.Event.removeAllEventListeners(this),this.container=null},a.AnchorWidget.prototype.onResizeOriginClick_=function(b){var c=b.target.dataset.origin;c&&a.AnchorWidget.ORIGIN[c]&&!this.disabled&&this.setOrigin(c)},a.AnchorWidget.prototype.setOrigin=function(a){this.origin=a;var c=document.querySelector("."+b+".selected");c&&c.classList.remove("selected");var d=document.querySelector("."+b+'[data-origin="'+a+'"]');d&&(d.classList.add("selected"),this.refreshNeighbors_(d))},a.AnchorWidget.prototype.getOrigin=function(){return this.origin},a.AnchorWidget.prototype.disable=function(){this.disabled=!0,this.container.classList.add("transition"),this.container.classList.add("disabled")},a.AnchorWidget.prototype.enable=function(){this.disabled=!1,this.container.classList.remove("disabled"),window.setTimeout(this.container.classList.remove.bind(this.container.classList,"transition"),250)},a.AnchorWidget.prototype.refreshNeighbors_=function(a){for(var c=document.querySelectorAll("."+b),d=0;d<c.length;d++)c[d].removeAttribute("data-neighbor");var e=Array.prototype.indexOf.call(c,a);this.setNeighborhood_(c[e-1],"left"),this.setNeighborhood_(c[e+1],"right"),this.setNeighborhood_(c[e-3],"top"),this.setNeighborhood_(c[e+3],"bottom")},a.AnchorWidget.prototype.setNeighborhood_=function(a,b){var c=this.origin.toLowerCase(),d=c.indexOf(b)===-1;d&&a.setAttribute("data-neighbor",b)}}(),function(){var a=$.namespace("pskl.controller.settings.resize");a.ResizeController=function(b){this.piskelController=b,this.container=document.querySelector(".resize-canvas");var c=this.container.querySelector(".resize-origin-container");this.anchorWidget=new a.AnchorWidget(c),this.defaultSizeController=new a.DefaultSizeController(b)},pskl.utils.inherit(a.ResizeController,pskl.controller.settings.AbstractSettingController),a.ResizeController.prototype.init=function(){this.widthInput=this.container.querySelector('[name="resize-width"]
},a.CheatsheetController.prototype.onCheatsheetClick_=function(a){var c=pskl.utils.Dom.getParentWithData(a.target,"shortcutId");if(!c)return void pskl.utils.Dom.removeClass(b);var d=c.dataset.shortcutId,e=pskl.app.shortcutService.getShortcutById(d);c.classList.contains(b)?(pskl.utils.Dom.removeClass(b),this.eventTrapInput.blur()):e.isEditable()&&(pskl.utils.Dom.removeClass(b),c.classList.add(b),this.eventTrapInput.focus())},a.CheatsheetController.prototype.onEventTrapKeydown_=function(a){var c=document.querySelector("."+b);if(c){var d=pskl.service.keyboard.KeyUtils.createKeyFromEvent(a);if(d){var e=pskl.service.keyboard.KeyUtils.stringify(d),f=c.dataset.shortcutId,g=pskl.app.shortcutService.getShortcutById(f);pskl.app.shortcutService.updateShortcut(g,e),c.classList.remove(b),this.eventTrapInput.blur(),a.preventDefault()}}},a.CheatsheetController.prototype.initMarkup_=function(){this.initMarkupForCategory_("TOOL",".cheatsheet-tool-shortcuts",this.getToolIconClass_),this.initMarkupForCategory_("MISC",".cheatsheet-misc-shortcuts"),this.initMarkupForCategory_("COLOR",".cheatsheet-color-shortcuts"),this.initMarkupForCategory_("SELECTION",".cheatsheet-selection-shortcuts"),this.initMarkupForCategory_("STORAGE",".cheatsheet-storage-shortcuts")},a.CheatsheetController.prototype.getToolIconClass_=function(a){return"tool-icon cheatsheet-icon-"+a.getId()},a.CheatsheetController.prototype.initMarkupForCategory_=function(a,b,c){var d=pskl.service.keyboard.Shortcuts[a],e=Object.keys(d).map(function(a){return this.toDescriptor_(d[a],c)}.bind(this));this.initMarkupForDescriptors_(e,b)},a.CheatsheetController.prototype.toDescriptor_=function(a,b){var c="function"==typeof b?b(a):"";return{shortcut:a,iconClass:c}},a.CheatsheetController.prototype.initMarkupForDescriptors_=function(a,b){var c=document.querySelector(b);if(c){var d=a.map(this.getMarkupForDescriptor_.bind(this));c.innerHTML=d.join("")}},a.CheatsheetController.prototype.getMarkupForDescriptor_=function(a){var b=pskl.utils.Template.get("cheatsheet-shortcut-template"),c=a.shortcut,d=c.isCustom()?c.getDescription()+" *":c.getDescription(),e=[];c.isUndefined()&&e.push("cheatsheet-shortcut-undefined"),c.isEditable()&&e.push("cheatsheet-shortcut-editable");var f=c.isEditable()?"Click to edit the key":"Shortcut cannot be remapped",g=pskl.utils.Template.replace(b,{id:c.getId(),title:f,icon:a.iconClass,description:d,key:this.formatKey_(c.getDisplayKey()),className:e.join(" ")});return g},a.CheatsheetController.prototype.formatKey_=function(a){return pskl.utils.UserAgent.isMac&&(a=a.replace("ctrl","cmd"),a=a.replace("alt","option")),a=a.replace(/left/i,"&#65513;"),a=a.replace(/up/i,"&#65514;"),a=a.replace(/right/i,"&#65515;"),a=a.replace(/down/i,"&#65516;"),a=a.replace(/>/g,"&gt;"),a=a.replace(/</g,"&lt;"),a=a.replace(/([^ ])\+([^ ])/g,"$1 + $2")},a.CheatsheetController.prototype.getHelptextTitle_=function(){var a=["Click on a shortcut to change the key.","When the shortcut blinks, press the key on your keyboard to assign it.","White shortcuts can not be edited.","Click on 'Restore default shortcuts' to erase all custom shortcuts."],b=a.reduce(function(a,b){return a+'<div class="cheatsheet-helptext-tooltip-item">'+b+"</div>"},"");return b='<div class="cheatsheet-helptext-tooltip">'+b+"</div>"}}(),function(){var a=$.namespace("pskl.controller.dialogs"),b={cheatsheet:{template:"templates/dialogs/cheatsheet.html",controller:a.CheatsheetController},"create-palette":{template:"templates/dialogs/create-palette.html",controller:a.CreatePaletteController},"browse-local":{template:"templates/dialogs/browse-local.html",controller:a.BrowseLocalController},"import-image":{template:"templates/dialogs/import-image.html",controller:a.ImportImageController}};a.DialogsController=function(a){this.piskelController=a,this.closePopupShortcut=pskl.service.keyboard.Shortcuts.MISC.CLOSE_POPUP,this.currentDialog_=null},a.DialogsController.prototype.init=function(){this.dialogContainer_=document.getElementById("dialog-container"),this.dialogWrapper_=document.getElementById("dialog-container-wrapper"),$.subscribe
},a.PaletteService.prototype.addDynamicPalette=function(a){this.dynamicPalettes.push(a)},a.PaletteService.prototype.deletePaletteById=function(a){var b=this.getPalettes(),c=b.filter(function(b){return b.id!==a});this.savePalettes_(c)},a.PaletteService.prototype.savePalettes_=function(a){a=a.filter(function(a){return this.dynamicPalettes.indexOf(a)===-1}.bind(this)),this.localStorageService.setItem("piskel.palettes",JSON.stringify(a)),$.publish(Events.PALETTE_LIST_UPDATED)},a.PaletteService.prototype.findPaletteInArray_=function(a,b){var c=null;return b.forEach(function(b){b.id===a&&(c=b)}),c}}(),function(){var a=$.namespace("pskl.service.palette");a.PaletteGplWriter=function(a){this.palette=a},a.PaletteGplWriter.prototype.write=function(){var a=[];return a.push("GIMP Palette"),a.push("Name: "+this.palette.name),a.push("Columns: 0"),a.push("#"),this.palette.getColors().forEach(function(b){a.push(this.writeColorLine(b))}.bind(this)),a.push("\r\n"),a.join("\r\n")},a.PaletteGplWriter.prototype.writeColorLine=function(a){var b=window.tinycolor(a),c=b.toRgb(),d=[];return d.push(this.padString(c.r,3)),d.push(this.padString(c.g,3)),d.push(this.padString(c.b,3)),d.push("Untitled"),d.join(" ")},a.PaletteGplWriter.prototype.padString=function(a,b){a=a.toString();var c=new Array(1+b-a.length).join(" ");return c+a}}(),function(){var a=$.namespace("pskl.service.palette.reader");a.AbstractPaletteFileReader=function(a,b,c,d){this.file=a,this.onSuccess=b,this.onError=c,this.colorLineRegexp=d},a.AbstractPaletteFileReader.prototype.extractColorFromLine=Constants.ABSTRACT_FUNCTION,a.AbstractPaletteFileReader.prototype.read=function(){pskl.utils.FileUtils.readFile(this.file,this.onFileLoaded_.bind(this))},a.AbstractPaletteFileReader.prototype.onFileLoaded_=function(a){var b=pskl.utils.Base64.toText(a),c=b.match(/[^\r\n]+/g),d=c.filter(function(a){return this.colorLineRegexp.test(a)}.bind(this)),e=d.map(this.extractColorFromLine.bind(this));if(e.length){var f=pskl.utils.Uuid.generate(),g=new pskl.model.Palette(f,this.file.name,e);this.onSuccess(g)}else this.onError()}}(),function(){var a=$.namespace("pskl.service.palette.reader"),b=/^(\s*\d{1,3})(\s*\d{1,3})(\s*\d{1,3})/;a.PaletteGplReader=function(a,c,d){this.superclass.constructor.call(this,a,c,d,b)},pskl.utils.inherit(a.PaletteGplReader,a.AbstractPaletteFileReader),a.PaletteGplReader.prototype.extractColorFromLine=function(a){var c=a.match(b),d=window.tinycolor({r:parseInt(c[1],10),g:parseInt(c[2],10),b:parseInt(c[3],10)});return d.toHexString()}}(),function(){var a=$.namespace("pskl.service.palette.reader");a.PaletteImageReader=function(a,b,c){this.file=a,this.onSuccess=b,this.onError=c,this.colorSorter_=new pskl.service.color.ColorSorter},a.PaletteImageReader.prototype.read=function(){pskl.utils.FileUtils.readImageFile(this.file,this.onImageLoaded_.bind(this))},a.PaletteImageReader.prototype.onImageLoaded_=function(a){var b=new pskl.worker.imageprocessor.ImageProcessor(a,this.onWorkerSuccess_.bind(this),this.onWorkerStep_.bind(this),this.onWorkerError_.bind(this));$.publish(Events.SHOW_PROGRESS,[{name:"Processing image colors ..."}]),b.process()},a.PaletteImageReader.prototype.onWorkerSuccess_=function(a){var b=a.data,c=b.colorsMap,d=Object.keys(c);if(d.length>Constants.MAX_PALETTE_COLORS)this.onError("Too many colors : "+d.length);else{var e=pskl.utils.Uuid.generate(),f=this.colorSorter_.sort(d),g=new pskl.model.Palette(e,this.file.name+" palette",f);this.onSuccess(g)}$.publish(Events.HIDE_PROGRESS)},a.PaletteImageReader.prototype.onWorkerStep_=function(a){var b=a.data.progress;$.publish(Events.UPDATE_PROGRESS,[{progress:b}])},a.PaletteImageReader.prototype.onWorkerError_=function(a){$.publish(Events.HIDE_PROGRESS),this.onError("Unable to process the image : "+a.data.message)}}(),function(){var a=$.namespace("pskl.service.palette.reader"),b=/^(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})/;a.PalettePalReader=function(a,c,d){this.superclass.constructor.call(this,a,c,d,b)},pskl.utils.inherit(a.PalettePalReader,a.AbstractPaletteFileReader),a.PalettePalReader.prototype.extractColorFromLine=function(a){
this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.MIRROR_PEN,this.tooltipDescriptors=[{key:"ctrl",description:"Use horizontal axis"},{key:"shift",description:"Use horizontal and vertical axis"}]},pskl.utils.inherit(a.VerticalMirrorPen,a.SimplePen),a.VerticalMirrorPen.prototype.applyToolAt=function(a,b,c,d,e){var f=this.getToolColor();this.drawUsingPenSize(f,a,b,c,d);var g=this.getSymmetricCol_(a,c),h=this.getSymmetricRow_(b,c),i=pskl.utils.UserAgent.isMac?e.metaKey:e.ctrlKey;i||this.drawUsingPenSize(f,g,b,c,d),(e.shiftKey||i)&&this.drawUsingPenSize(f,a,h,c,d),e.shiftKey&&this.drawUsingPenSize(f,g,h,c,d),this.previousCol=a,this.previousRow=b},a.VerticalMirrorPen.prototype.getSymmetricCol_=function(a,b){return b.getWidth()-a-1},a.VerticalMirrorPen.prototype.getSymmetricRow_=function(a,b){return b.getHeight()-a-1}}(),function(){var a=$.namespace("pskl.tools.drawing");a.Eraser=function(){this.superclass.constructor.call(this),this.toolId="tool-eraser",this.helpText="Eraser tool",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.ERASER},pskl.utils.inherit(a.Eraser,a.SimplePen),a.Eraser.prototype.getToolColor=function(){return Constants.TRANSPARENT_COLOR}}(),function(){var a=$.namespace("pskl.tools.drawing");a.Stroke=function(){this.toolId="tool-stroke",this.helpText="Stroke tool",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.STROKE,this.tooltipDescriptors=[{key:"shift",description:"Hold shift to draw straight lines"}],this.startCol=null,this.startRow=null},pskl.utils.inherit(a.Stroke,a.BaseTool),a.Stroke.prototype.supportsDynamicPenSize=function(){return!0},a.Stroke.prototype.applyToolAt=function(a,b,c,d,e){this.startCol=a,this.startRow=b,d.setPixel(a,b,this.getToolColor())},a.Stroke.prototype.moveToolAt=function(a,b,c,d,e){d.clear();var f=pskl.app.penSizeService.getPenSize(),g=e.shiftKey,h=this.getToolColor();h==Constants.TRANSPARENT_COLOR&&(h=Constants.SELECTION_TRANSPARENT_COLOR),this.draw_(a,b,h,d,f,g)},a.Stroke.prototype.releaseToolAt=function(a,b,c,d,e){var f=pskl.app.penSizeService.getPenSize(),g=e.shiftKey,h=this.getToolColor();this.draw_(a,b,h,c,f,g),d.clear(),this.raiseSaveStateEvent({col:a,row:b,startCol:this.startCol,startRow:this.startRow,color:h,penSize:f,isStraight:g})},a.Stroke.prototype.draw_=function(a,b,c,d,e,f){var g;g=f?pskl.PixelUtils.getUniformLinePixels(this.startCol,a,this.startRow,b):pskl.PixelUtils.getLinePixels(a,this.startCol,b,this.startRow),pskl.PixelUtils.resizePixels(g,e).forEach(function(a){d.setPixel(a[0],a[1],c)})},a.Stroke.prototype.replay=function(a,b){this.startCol=b.startCol,this.startRow=b.startRow,this.draw_(b.col,b.row,b.color,a,b.penSize,b.isStraight)}}(),function(){var a=$.namespace("pskl.tools.drawing");a.PaintBucket=function(){this.toolId="tool-paint-bucket",this.helpText="Paint bucket tool",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.PAINT_BUCKET},pskl.utils.inherit(a.PaintBucket,a.BaseTool),a.PaintBucket.prototype.applyToolAt=function(a,b,c,d,e){var f=this.getToolColor();pskl.PixelUtils.paintSimilarConnectedPixelsFromFrame(c,a,b,f),this.raiseSaveStateEvent({col:a,row:b,color:f})},a.PaintBucket.prototype.replay=function(a,b){pskl.PixelUtils.paintSimilarConnectedPixelsFromFrame(a,b.col,b.row,b.color)}}(),function(){var a=$.namespace("pskl.tools.drawing");a.Rectangle=function(){a.ShapeTool.call(this),this.toolId="tool-rectangle",this.helpText="Rectangle tool",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.RECTANGLE},pskl.utils.inherit(a.Rectangle,a.ShapeTool),a.Rectangle.prototype.draw=function(a,b,c,d,e){var f=pskl.PixelUtils.getBoundRectanglePixels(this.startCol,this.startRow,a,b);pskl.PixelUtils.resizePixels(f,e).forEach(function(a){d.setPixel(a[0],a[1],c)})}}(),function(){var a=$.namespace("pskl.tools.drawing");a.Circle=function(){a.ShapeTool.call(this),this.toolId="tool-circle",this.helpText="Circle tool",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.CIRCLE},pskl.utils.inherit(a.Circle,a.ShapeTool),a.Circle.prototype.draw=function(a,b,c,d,e){var f=this.getCirclePixels_(this.startCol,this.startRow,a,b);pskl.PixelUtils.resizePixels(f,e).forEach(function(