mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
16 lines
491 KiB
JavaScript
16 lines
491 KiB
JavaScript
|
!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?!0:"false"===d?!1:"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;e>d;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;g>f;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;g>f;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;4>e;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(0>=d){if(d=cb(a,b),(0>d||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.b
|
|||
|
c):void 0}})}),$.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){return $.isArray(b)?a.checked=$.inArray($(a).val(),b)>=0:void 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")|
|
|||
|
_a.optgroup=_a.option,_a.tbody=_a.tfoot=_a.colgroup=_a.caption=_a.thead,_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?!1: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(;e>d;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;m>i;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
|
|||
|
var d=c&&"left"===c?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,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;i>h;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
|
|||
|
}}.call(this,this.containers[c])),this.containers[c].containerCache.over=0);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")|
|
|||
|
},a.Deserializer.prototype.deserializeLayer=function(a,b){var c=JSON.parse(a),d=new pskl.model.Layer(c.name);d.setOpacity(c.opacity);var e=c.base64PNG,f=new Image;return f.onload=function(){var a=pskl.utils.LayerUtils.createFramesFromSpritesheet(f,c.frameCount);this.addFramesToLayer(a,d,b)}.bind(this),f.src=e,d},a.Deserializer.prototype.loadExpandedLayer=function(a,b){var c=new pskl.model.Layer(a.name);c.setOpacity(a.opacity);var d=a.grids.map(function(a){return pskl.model.Frame.fromPixelGrid(a)});return this.addFramesToLayer(d,c,b),c},a.Deserializer.prototype.addFramesToLayer=function(a,b,c){a.forEach(b.addFrame.bind(b)),this.layers_[c]=b,this.onLayerLoaded_()},a.Deserializer.prototype.onLayerLoaded_=function(){this.layersToLoad_=this.layersToLoad_-1,0===this.layersToLoad_&&(this.layers_.forEach(function(a){this.piskel_.addLayer(a)}.bind(this)),this.callback_(this.piskel_))}}(),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){return pskl.model.Frame.fromPixelGrid(a)}),c=new pskl.model.piskel.Descriptor("Deserialized piskel",""),d=pskl.model.Layer.fromFrames("Layer 1",b);this.callback_(pskl.model.Piskel.fromLayers([d],c))}}(),function(){var a=$.namespace("pskl.utils.serialization.backward");a.Deserializer_v1=function(a,b){this.callback_=b,this.data_=a},a.Deserializer_v1.prototype.deserialize=function(){var a=this.data_.piskel,b=new pskl.model.piskel.Descriptor("Deserialized piskel",""),c=new pskl.model.Piskel(a.width,a.height,b);a.layers.forEach(function(a){var b=this.deserializeLayer(a);c.addLayer(b)}.bind(this)),this.callback_(c)},a.Deserializer_v1.prototype.deserializeLayer=function(a){var b=JSON.parse(a),c=new pskl.model.Layer(b.name);return b.frames.forEach(function(a){var b=this.deserializeFrame(a);c.addFrame(b)}.bind(this)),c},a.Deserializer_v1.prototype.deserializeFrame=function(a){var b=JSON.parse(a);return pskl.model.Frame.fromPixelGrid(b)}}(),function(){var a=function(){(function(a){function b(a,c){if({}.hasOwnProperty.call(b.cache,a))return b.cache[a];var d=b.resolve(a);if(!d)throw new Error("Failed to resolve module "+a);var e={id:a,require:b,filename:a,exports:{},loaded:!1,parent:c,children:[]};c&&c.children.push(e);var f=a.slice(0,a.lastIndexOf("/")+1);return b.cache[a]=e.exports,d.call(e.exports,e,e.exports,f,a),e.loaded=!0,b.cache[a]=e.exports}b.modules={},b.cache={},b.resolve=function(a){return{}.hasOwnProperty.call(b.modules,a)?b.modules[a]:void 0},b.define=function(a,c){b.modules[a]=c},b.define("/gif.worker.coffee",function(a,c,d,e){var f,g;f=b("/GIFEncoder.js",a),g=function(a){var b,c,d,e;return b=new f(a.width,a.height),0===a.index?b.writeHeader():b.firstFrame=!1,b.setTransparent(a.transparent),b.setRepeat(a.repeat),b.setDelay(a.delay),b.setQuality(a.quality),b.setPreserveColors(a.preserveColors),b.addFrame(a.data),a.last&&b.finish(),d=b.stream(),a.data=d.pages,a.cursor=d.cursor,a.pageSize=d.constructor.pageSize,a.canTransfer?(e=function(b){for(var d=0,e=a.data.length;e>d;++d)c=a.data[d],b.push(c.buffer);return b}.call(this,[]),self.postMessage(a,e)):self.postMessage(a)},self.onmessage=function(a){return g(a.data)}}),b.define("/GIFEncoder.js",function(a,c,d,e){function f(){this.page=-1,this.pages=[],this.newPage()}function g(a,b){this.width=~~a,this.height=~~b,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.out=new f}var h=b("/TypedNeuQuant.js",a),i=b("/SimpleQuant.js",a),j=b("/LZWEncoder.js",a);f.pageSize=4096,f.charMap={};for(var k=0;256>k;k++)f.charMap[k]=String.fromCharCode(k);f.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(f.pageSize),this.cursor=0},f.prototype.getData=function(){for(var a="",b=0;b<this.pages.length;b++)for(var c=0;c<f.pageSize;c++)a+=f.charMap[this.pages[b][c]];return a},f.prototyp
|
|||
|
}],8:[function(a,b){"use strict";var c=a("./base64"),d=a("./zipEntries");b.exports=function(a,b){var e,f,g,h;for(b=b||{},b.base64&&(a=c.decode(a)),f=new d(a,b),e=f.files,g=0;g<e.length;g++)h=e[g],this.file(h.fileName,h.decompressed,{binary:!0,optimizedBinaryString:!0,date:h.date,dir:h.dir});return this}},{"./base64":1,"./zipEntries":15}],9:[function(a,b){"use strict";var c,d,e=a("./support"),f=a("./utils"),g=a("./signature"),h=a("./defaults"),i=a("./base64"),j=a("./compressions"),k=a("./compressedObject"),l=a("./nodeBuffer");e.uint8array&&"function"==typeof TextEncoder&&"function"==typeof TextDecoder&&(c=new TextEncoder("utf-8"),d=new TextDecoder("utf-8"));var m=function(a){if(a._data instanceof k&&(a._data=a._data.getContent(),a.options.binary=!0,a.options.base64=!1,"uint8array"===f.getTypeOf(a._data))){var b=a._data;a._data=new Uint8Array(b.length),0!==b.length&&a._data.set(b,0)}return a._data},n=function(a){var b=m(a),d=f.getTypeOf(b);if("string"===d){if(!a.options.binary){if(c)return c.encode(b);if(e.nodebuffer)return l(b,"utf-8")}return a.asBinary()}return b},o=function(a){var b=m(this);return null===b||"undefined"==typeof b?"":(this.options.base64&&(b=i.decode(b)),b=a&&this.options.binary?A.utf8decode(b):f.transformTo("string",b),a||this.options.binary||(b=A.utf8encode(b)),b)},p=function(a,b,c){this.name=a,this._data=b,this.options=c};p.prototype={asText:function(){return o.call(this,!0)},asBinary:function(){return o.call(this,!1)},asNodeBuffer:function(){var a=n(this);return f.transformTo("nodebuffer",a)},asUint8Array:function(){var a=n(this);return f.transformTo("uint8array",a)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var q=function(a,b){var c,d="";for(c=0;b>c;c++)d+=String.fromCharCode(255&a),a>>>=8;return d},r=function(){var a,b,c={};for(a=0;a<arguments.length;a++)for(b in arguments[a])arguments[a].hasOwnProperty(b)&&"undefined"==typeof c[b]&&(c[b]=arguments[a][b]);return c},s=function(a){return a=a||{},a.base64!==!0||null!==a.binary&&void 0!==a.binary||(a.binary=!0),a=r(a,h),a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),a},t=function(a,b,c){var d=u(a),e=f.getTypeOf(b);if(d&&v.call(this,d),c=s(c),c.dir||null===b||"undefined"==typeof b)c.base64=!1,c.binary=!1,b=null;else if("string"===e)c.binary&&!c.base64&&c.optimizedBinaryString!==!0&&(b=f.string2binary(b));else{if(c.base64=!1,c.binary=!0,!(e||b instanceof k))throw new Error("The data of '"+a+"' is in an unsupported format !");"arraybuffer"===e&&(b=f.transformTo("uint8array",b))}var g=new p(a,b,c);return this.files[a]=g,g},u=function(a){"/"==a.slice(-1)&&(a=a.substring(0,a.length-1));var b=a.lastIndexOf("/");return b>0?a.substring(0,b):""},v=function(a){return"/"!=a.slice(-1)&&(a+="/"),this.files[a]||t.call(this,a,null,{dir:!0}),this.files[a]},w=function(a,b){var c,d=new k;return a._data instanceof k?(d.uncompressedSize=a._data.uncompressedSize,d.crc32=a._data.crc32,0===d.uncompressedSize||a.options.dir?(b=j.STORE,d.compressedContent="",d.crc32=0):a._data.compressionMethod===b.magic?d.compressedContent=a._data.getCompressedContent():(c=a._data.getContent(),d.compressedContent=b.compress(f.transformTo(b.compressInputType,c)))):(c=n(a),(!c||0===c.length||a.options.dir)&&(b=j.STORE,c=""),d.uncompressedSize=c.length,d.crc32=this.crc32(c),d.compressedContent=b.compress(f.transformTo(b.compressInputType,c))),d.compressedSize=d.compressedContent.length,d.compressionMethod=b.magic,d},x=function(a,b,c,d){var e,f,h=(c.compressedContent,this.utf8encode(b.name)),i=h!==b.name,j=b.options,k="",l="";e=j.date.getHours(),e<<=6,e|=j.date.getMinutes(),e<<=5,e|=j.date.getSeconds()/2,f=j.date.getFullYear()-1980,f<<=4,f|=j.date.getMonth()+1,f<<=5,f|=j.date.getDate(),i&&(l=q(1,1)+q(this.crc32(h),4)+h,k+="up"+q(l.length,2)+l);var m="";m+="\n\x00",m+=i?"\x00\b":"\x00\x00",m+=c.compressionMethod,m+=q(e,2),m+=q(f,2),m+=q(c.crc32,4),m+=q(c.compressedSize,4),m+=q(c.uncompressedSize,4),m+=q(h.length,2),m+=q(k.length,2);var n=g.LOCAL_FILE_HEADER+m+h+k,o=g.CENTRAL_FILE_HEADER+"\x00"+m+"\x00\x00\x00\x00\x00\x00"+(b.options.dir
|
|||
|
for(U=V=0;$>U;U++)aa[V++]=H[U];for(U=0;_>U;U++)aa[V++]=J[U];if(!o)for(U=0,X=ca.length;X>U;++U)ca[U]=0;for(U=Y=0,X=aa.length;X>U;U+=V){for(V=1;X>U+V&&aa[U+V]===aa[U];++V);if(W=V,0===aa[U])if(3>W)for(;0<W--;)ba[Y++]=0,ca[0]++;else for(;W>0;)Z=138>W?W:138,Z>W-3&&W>Z&&(Z=W-3),10>=Z?(ba[Y++]=17,ba[Y++]=Z-3,ca[17]++):(ba[Y++]=18,ba[Y++]=Z-11,ca[18]++),W-=Z;else if(ba[Y++]=aa[U],ca[aa[U]]++,W--,3>W)for(;0<W--;)ba[Y++]=aa[U],ca[aa[U]]++;else for(;W>0;)Z=6>W?W:6,Z>W-3&&W>Z&&(Z=W-3),ba[Y++]=16,ba[Y++]=Z-3,ca[16]++,W-=Z}for(a=o?ba.subarray(0,Y):ba.slice(0,Y),L=i(ca,7),P=0;19>P;P++)T[P]=L[S[P]];for(G=19;G>4&&0===T[G-1];G--);for(M=k(L),R.a(E-257,5,m),R.a(F-1,5,m),R.a(G-4,4,m),P=0;G>P;P++)R.a(T[P],3,m);for(P=0,Q=a.length;Q>P;P++)if(N=a[P],R.a(M[N],L[N],m),N>=16){switch(P++,N){case 16:O=2;break;case 17:O=3;break;case 18:O=7;break;default:throw"invalid code: "+N}R.a(a[P],O,m)}var da,ea,fa,ga,ha,ia,ja,ka,la=[I,H],ma=[K,J];for(ha=la[0],ia=la[1],ja=ma[0],ka=ma[1],da=0,ea=D.length;ea>da;++da)if(fa=D[da],R.a(ha[fa],ia[fa],m),fa>256)R.a(D[++da],D[++da],m),ga=D[++da],R.a(ja[ga],ka[ga],m),R.a(D[++da],D[++da],m);else if(256===fa)break;this.b=R.finish(),this.c=this.b.length;break;default:throw"invalid compression type"}return this.b};var y=function(){function a(a){switch(m){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:throw"invalid length: "+a}}var b,c,d=[];for(b=3;258>=b;b++)c=a(b),d[b]=c[2]<<24|c[1]<<16|c[0];return d}(),z=o?new Uint32Array(y):y;a("Zlib.RawDeflate",e),a("Zlib.RawDeflate.prototype.compress",e.prototype.h);var A,B,C,D,E={NONE:0,FIXED:1,DYNAMIC:w};if(Object.keys)A=Object.keys(E);else for(B in A=[],C=0,E)A[C++]=B;for(C=0,D=A.length;D>C;++C)B=A[C],a("Zlib.RawDeflate.CompressionType."+B,E[B])}).call(this)},{}],20:[function(){(function(){"use strict";function a(a,b){var c=a.split("."),d=g;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d=d[e]?d[e]:d[e]={}:d[e]=b}function b(a){var b,c,d,e,f,g,i,j,k,l,m=a.length,n=0,o=Number.POSITIVE_INFINITY;for(j=0;m>j;++j)a[j]>n&&(n=a[j]),a[j]<o&&(o=a[j]);for(b=1<<n,c=new(h?Uint32Array:Array)(b),d=1,e=0,f=2;n>=d;){for(j=0;m>j;++j)if(a[j]===d){for(g=0,i=e,k=0;d>k;++k)g=g<<1|1&i,i>>=1;for(l=d<<16|j,k=g;b>k;k+=f)c[k]=l;++e}++d,e<<=1,f<<=1}return[c,n,o]}function c(a,b){switch(this.g=[],this.h=32768,this.c=this.f=this.d=this.k=0,this.input=h?new Uint8Array(a):a,this.l=!1,this.i=j,this.q=!1,(b||!(b={}))&&(b.index&&(this.d=b.index),b.bufferSize&&(this.h=b.bufferSize),b.bufferType&&(this.i=b.bufferType),b.resize&&(this.q=b.resize)),this.i){case i:this.a=32768,this.b=new(h?Uint8Array:Array)(32768+this.h+258);break;case j:this.a=0,this.b=new(h?Uint8Array:Array)(this.h),this.e=this.v,this.m=this.s,this.j=this.t;break;default:throw Error("invalid inflate mode")}}function d(a,b){for(var c,d=a.f,e=a.c,f=a.input,g=a.d,h=f.length;b>e;){if(g>=h)throw Error("input buffer is broken");d|=f[g++]<<e,e+=8}return c=d&(1<<b)-1,a.f=d>>>b,a.c=e-b,a.d=g,c}function e(a,b){for(var c,d,e=a.f,f=a.c,g=a.input,h=a.d,i=g.length,j=b[0],k=b[1];k>f&&!(h>=i);)e|=g[h++]<<f,f+=8;return c=j[e&(1<<k)-1],d=c>>>16,a.f=e>>d,a.c=f-d,a.d=h,65535&c}function f(a){function c(a,b,c){var f,g,h,i=this.p;for(h=0;a>h;)switch(f=e(this,b)){case 16:for(g=3+d(this,2);g--;)c[
|
|||
|
}function f(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function g(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function h(a){var b=g(a);if(!b)return!1;var c=b[0],d=b[1];return c===R&&d>=T&&ha>=d}function i(){if(P)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=g(c);if(!d)return;return R=d[0],d[1]}}function j(a,b,c){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(b+" is deprecated, use "+c+" instead.",new Error("").stack),a.apply(a,arguments)}}function k(a){return a instanceof o?a:s(a)?B(a):A(a)}function l(){function a(a){b=a,f.source=a,Y(c,function(b,c){k.nextTick(function(){a.promiseDispatch.apply(a,c)})},void 0),c=void 0,d=void 0}var b,c=[],d=[],e=_(l.prototype),f=_(o.prototype);if(f.promiseDispatch=function(a,e,f){var g=X(arguments);c?(c.push(g),"when"===e&&f[1]&&d.push(f[1])):k.nextTick(function(){b.promiseDispatch.apply(b,g)})},f.valueOf=function(){if(c)return f;var a=q(b);return r(a)&&(b=a),a},f.inspect=function(){return b?b.inspect():{state:"pending"}},k.longStackSupport&&P)try{throw new Error}catch(g){f.stack=g.stack.substring(g.stack.indexOf("\n")+1)}return e.promise=f,e.resolve=function(c){b||a(k(c))},e.fulfill=function(c){b||a(A(c))},e.reject=function(c){b||a(z(c))},e.notify=function(a){b||Y(d,function(b,c){k.nextTick(function(){c(a)})},void 0)},e}function m(a){if("function"!=typeof a)throw new TypeError("resolver must be a function.");var b=l();try{a(b.resolve,b.reject,b.notify)}catch(c){b.reject(c)}return b.promise}function n(a){return m(function(b,c){for(var d=0,e=a.length;e>d;d++)k(a[d]).then(b,c)})}function o(a,b,c){void 0===b&&(b=function(a){return z(new Error("Promise does not support operation: "+a))}),void 0===c&&(c=function(){return{state:"unknown"}});var d=_(o.prototype);if(d.promiseDispatch=function(c,e,f){var g;try{g=a[e]?a[e].apply(d,f):b.call(d,e,f)}catch(h){g=z(h)}c&&c(g)},d.inspect=c,c){var e=c();"rejected"===e.state&&(d.exception=e.reason),d.valueOf=function(){var a=c();return"pending"===a.state||"rejected"===a.state?d:a.value}}return d}function p(a,b,c,d){return k(a).then(b,c,d)}function q(a){if(r(a)){var b=a.inspect();if("fulfilled"===b.state)return b.value}return a}function r(a){return a instanceof o}function s(a){return b(a)&&"function"==typeof a.then}function t(a){return r(a)&&"pending"===a.inspect().state}function u(a){return!r(a)||"fulfilled"===a.inspect().state}function v(a){return r(a)&&"rejected"===a.inspect().state}function w(){ea.length=0,fa.length=0,ga||(ga=!0)}function x(a,b){ga&&(fa.push(a),b&&"undefined"!=typeof b.stack?ea.push(b.stack):ea.push("(no stack) "+b))}function y(a){if(ga){var b=Z(fa,a);-1!==b&&(fa.splice(b,1),ea.splice(b,1))}}function z(a){var b=o({when:function(b){return b&&y(this),b?b(a):this}},function(){return this},function(){return{state:"rejected",reason:a}});return x(b,a),b}function A(a){return o({when:function(){return a},get:function(b){return a[b]},set:function(b,c){a[b]=c},"delete":function(b){delete a[b]},post:function(b,c){return null===b||void 0===b?a.apply(void 0,c):a[b].apply(a,c)},apply:function(b,c){return a.apply(b,c)},keys:function(){return ba(a)}},void 0,function(){return{state:"fulfilled",value:a}})}function B(a){var b=l();return k.nextTick(function(){try{a.then(b.resolve,b.reject,b.notify)}catch(c){b.reject(c)}}),b.promise}function C(a){return o({isDef:function(){}},function(b,c){return I(a,b,c)},function(){return k(a).inspect()})}function D(a,b,c){return k(a).spread(b,c)}function E(a){return function(){function b(a,b){var g;if("undefined"==typeof StopIteration){try{g=d[a](b)}catch(h){return z(h)}return g.done?k(g.value):p(g.value,e,f)}try{g=d[a](b)}catch(h){return c(h)?k(h.value):z(h)}return p(g,e,f)}var d=a.apply(this,arguments),e=b.bind(b,"next"),f=b.bind(b,"throw");return e()}}function F(a){k.done(k.async(a)())}function G(a){throw new S(a)}function H(
|
|||
|
b.setGridWidth(a)})},a.CompositeRenderer.prototype.getGridWidth=function(){return this.getSampleRenderer_().getGridWidth()},a.CompositeRenderer.prototype.getSampleRenderer_=function(){if(this.renderers.length>0)return this.renderers[0];throw"Renderer manager is empty"}}(),function(){var a=$.namespace("pskl.rendering.layer");a.LayersRenderer=function(a,b,c){pskl.rendering.CompositeRenderer.call(this),this.piskelController=c,this.belowRenderer=new pskl.rendering.frame.FrameRenderer(a,b,["layers-canvas","layers-below-canvas"]),this.aboveRenderer=new pskl.rendering.frame.FrameRenderer(a,b,["layers-canvas","layers-above-canvas"]),this.add(this.belowRenderer),this.add(this.aboveRenderer),this.serializedRendering="",this.stylesheet_=document.createElement("style"),document.head.appendChild(this.stylesheet_),this.updateLayersCanvasOpacity_(pskl.UserSettings.get(pskl.UserSettings.LAYER_OPACITY)),$.subscribe(Events.PISKEL_RESET,this.flush.bind(this)),$.subscribe(Events.USER_SETTINGS_CHANGED,$.proxy(this.onUserSettingsChange_,this))},pskl.utils.inherit(pskl.rendering.layer.LayersRenderer,pskl.rendering.CompositeRenderer),a.LayersRenderer.prototype.render=function(){var a=this.getOffset(),b=this.getDisplaySize(),c=this.piskelController.getLayers(),d=this.piskelController.getCurrentFrameIndex(),e=this.piskelController.getCurrentLayerIndex(),f=c.slice(0,e),g=c.slice(e+1,c.length),h=[this.getZoom(),this.getGridWidth(),a.x,a.y,b.width,b.height,pskl.utils.LayerUtils.getFrameHashAt(f,d),pskl.utils.LayerUtils.getFrameHashAt(g,d),c.length].join("-");if(this.serializedRendering!=h){if(this.serializedRendering=h,this.clear(),f.length>0){var i=pskl.utils.LayerUtils.mergeFrameAt(f,d);this.belowRenderer.render(i)}if(g.length>0){var j=pskl.utils.LayerUtils.mergeFrameAt(g,d);this.aboveRenderer.render(j)}}},a.LayersRenderer.prototype.setDisplaySize=function(a,b){var c=this.getDisplaySize();c.width===a&&c.height===b||this.superclass.setDisplaySize.call(this,a,b)},a.LayersRenderer.prototype.onUserSettingsChange_=function(a,b,c){b==pskl.UserSettings.LAYER_OPACITY&&this.updateLayersCanvasOpacity_(c)},a.LayersRenderer.prototype.updateLayersCanvasOpacity_=function(a){this.stylesheet_.innerHTML=".layers-canvas { opacity : "+a+"}"},a.LayersRenderer.prototype.flush=function(){this.serializedRendering=""}}(),function(){var a=$.namespace("pskl.rendering.frame");a.FrameRenderer=function(a,b,c){if(this.defaultRenderingOptions={supportGridRendering:!1,zoom:1},b=$.extend(!0,{},this.defaultRenderingOptions,b),void 0===a)throw"Bad FrameRenderer initialization. <container> undefined.";if(isNaN(b.zoom))throw"Bad FrameRenderer initialization. <zoom> not well defined.";this.container=a,this.zoom=b.zoom,this.offset={x:0,y:0},this.margin={x:0,y:0},this.supportGridRendering=b.supportGridRendering,this.classList=c||[],this.classList.push("canvas"),this.canvas=null,this.displayCanvas=null,this.setDisplaySize(b.width,b.height),this.setGridWidth(pskl.UserSettings.get(pskl.UserSettings.GRID_WIDTH)),$.subscribe(Events.USER_SETTINGS_CHANGED,this.onUserSettingsChange_.bind(this))},pskl.utils.inherit(pskl.rendering.frame.FrameRenderer,pskl.rendering.AbstractRenderer),a.FrameRenderer.prototype.render=function(a){a&&(this.clear(),this.renderFrame_(a))},a.FrameRenderer.prototype.clear=function(){pskl.utils.CanvasUtils.clear(this.canvas),pskl.utils.CanvasUtils.clear(this.displayCanvas)},a.FrameRenderer.prototype.setZoom=function(a){var b=1,c=Math.min(this.displayWidth,this.displayHeight)/10;if(a=pskl.utils.Math.minmax(a,b,c),a!=this.zoom){var d=this.offset.x+this.displayWidth/(2*this.zoom),e=this.offset.y+this.displayHeight/(2*this.zoom);this.zoom=a,this.setOffset(d-this.displayWidth/(2*this.zoom),e-this.displayHeight/(2*this.zoom))}},a.FrameRenderer.prototype.getZoom=function(){return this.zoom},a.FrameRenderer.prototype.setDisplaySize=function(a,b){this.displayWidth=a,this.displayHeight=b,this.displayCanvas&&($(this.displayCanvas).remove(),this.displayCanvas=null),this.createDisplayCanvas_()},a.FrameRenderer.prototype.getDisplaySize=function(){return{height:this.displayHeight,width
|
|||
|
},a.DrawingController.prototype.getZoomStep_=function(){return Math.max(.1,this.renderer.getZoom()/15)},a.DrawingController.prototype.setZoom_=function(a){this.compositeRenderer.setZoom(a),$.publish(Events.ZOOM_CHANGED)}}(),function(){var a=$.namespace("pskl.controller.drawing"),b=2;a.DragHandler=function(a){this.drawingController=a,this.isDragging_=!1,this.updateOrigin_(-1,-1)},a.DragHandler.prototype.startDrag=function(a,b){var c=this.drawingController.getSpriteCoordinates(a,b);this.updateOrigin_(c.x,c.y)},a.DragHandler.prototype.updateDrag=function(a,b){var c=this.drawingController.getOffset(),d=this.calculateOffset_(a,b);if(c.y!==d.y||c.x!==d.x){this.isDragging_=!0,this.drawingController.setOffset(d.x,d.y);var e=this.drawingController.getSpriteCoordinates(a,b);this.updateOrigin_(e.x,e.y)}},a.DragHandler.prototype.stopDrag=function(){this.isDragging_=!1,this.origin=null},a.DragHandler.prototype.isDragging=function(){return this.isDragging_},a.DragHandler.prototype.calculateOffset_=function(a,c){var d=this.drawingController.getSpriteCoordinates(a,c),e=this.drawingController.getOffset(),f={x:e.x-b*(d.x-this.origin.x),y:e.y-b*(d.y-this.origin.y)};return f},a.DragHandler.prototype.updateOrigin_=function(a,b){this.origin=this.origin||{},this.origin.x=a,this.origin.y=b}}(),function(){var a=$.namespace("pskl.controller"),b={SELECT:"select",CLONE:"clone",DELETE:"delete",NEW_FRAME:"newframe"};a.FramesListController=function(a,b){this.piskelController=a,this.container=b,this.refreshZoom_(),this.redrawFlag=!0,this.cachedFrameProcessor=new pskl.model.frame.CachedFrameProcessor,this.cachedFrameProcessor.setFrameProcessor(this.frameToPreviewCanvas_.bind(this)),this.cachedFrameProcessor.setOutputCloner(this.clonePreviewCanvas_.bind(this))},a.FramesListController.prototype.init=function(){$.subscribe(Events.TOOL_RELEASED,this.flagForRedraw_.bind(this)),$.subscribe(Events.PISKEL_RESET,this.flagForRedraw_.bind(this)),$.subscribe(Events.USER_SETTINGS_CHANGED,this.flagForRedraw_.bind(this)),$.subscribe(Events.PISKEL_RESET,this.refreshZoom_.bind(this)),$("#preview-list-scroller").scroll(this.updateScrollerOverflows.bind(this)),this.container.get(0).addEventListener("click",this.onContainerClick_.bind(this)),this.updateScrollerOverflows()},a.FramesListController.prototype.flagForRedraw_=function(){this.redrawFlag=!0},a.FramesListController.prototype.refreshZoom_=function(){this.zoom=this.calculateZoom_()},a.FramesListController.prototype.render=function(){this.redrawFlag&&(this.createPreviews_(),this.redrawFlag=!1)},a.FramesListController.prototype.updateScrollerOverflows=function(){var a=$("#preview-list-scroller"),b=a.height(),c=a.scrollTop(),d=$("#preview-list").height(),e=$(".top-overflow").height(),f=!1,g=!1;if(d>b){c>e&&(f=!0);var h=d-c-b;h>e&&(g=!0)}var i=$("#preview-list-wrapper");i.toggleClass("top-overflow-visible",f),i.toggleClass("bottom-overflow-visible",g)},a.FramesListController.prototype.onContainerClick_=function(a){var c=pskl.utils.Dom.getParentWithData(a.target,"tileAction");if(c){var d=c.dataset.tileAction,e=parseInt(c.dataset.tileNumber,10);d===b.CLONE?(this.piskelController.duplicateFrameAt(e),this.updateScrollerOverflows()):d===b.DELETE?(this.piskelController.removeFrameAt(e),this.updateScrollerOverflows()):d===b.SELECT?this.piskelController.setCurrentFrameIndex(e):d===b.NEW_FRAME&&(this.piskelController.addFrame(),this.updateScrollerOverflows())}},a.FramesListController.prototype.createPreviews_=function(){this.container.html(""),$(".tooltip").remove();for(var a=this.piskelController.getFrameCount(),c=0;a>c;c++)this.container.append(this.createPreviewTile_(c));var d=document.createElement("div");d.id="add-frame-action",d.className="add-frame-action",d.setAttribute("data-tile-action",b.NEW_FRAME),d.innerHTML='<div class="add-frame-action-icon icon-frame-plus-white"></div><div class="label">Add new frame</div>',this.container.append(d);var e=a>1;e&&this.initDragndropBehavior_(),this.updateScrollerOverflows()},a.FramesListController.prototype.initDragndropBehavior_=function(){$("#preview-list").sortable({placeholder:"
|
|||
|
pskl.UserSettings.set(pskl.UserSettings.SELECTED_PALETTE,a)},a.PalettesListController.prototype.getSelectedPaletteColors_=function(){var a=[],b=this.getSelectedPalette_();return b&&(a=b.getColors()),a.length>Constants.MAX_PALETTE_COLORS&&(a=a.slice(0,Constants.MAX_PALETTE_COLORS)),a},a.PalettesListController.prototype.getSelectedPalette_=function(){var a=pskl.UserSettings.get(pskl.UserSettings.SELECTED_PALETTE);return this.paletteService.getPaletteById(a)},a.PalettesListController.prototype.selectNextColor_=function(){this.selectColor_(this.getCurrentColorIndex_()+1)},a.PalettesListController.prototype.selectPreviousColor_=function(){this.selectColor_(this.getCurrentColorIndex_()-1)},a.PalettesListController.prototype.getCurrentColorIndex_=function(){var a=0,c=document.querySelector("."+b);return c&&(a=parseInt(c.dataset.colorIndex,10)),a},a.PalettesListController.prototype.selectColorForKey_=function(a){var b=parseInt(a,10);b=(b+9)%10,this.selectColor_(b)},a.PalettesListController.prototype.selectColor_=function(a){var b=this.getSelectedPaletteColors_(),c=b[a];c&&$.publish(Events.SELECT_PRIMARY_COLOR,[c])},a.PalettesListController.prototype.onUserSettingsChange_=function(a,b,c){b==pskl.UserSettings.SELECTED_PALETTE&&this.updateFromUserSettings()},a.PalettesListController.prototype.updateFromUserSettings=function(){var a=pskl.UserSettings.get(pskl.UserSettings.SELECTED_PALETTE);this.fillColorListContainer(),this.colorPaletteSelect_.value=a},a.PalettesListController.prototype.onPaletteSelected_=function(a){var b=this.colorPaletteSelect_.value;this.selectPalette(b),this.colorPaletteSelect_.blur()},a.PalettesListController.prototype.onCreatePaletteClick_=function(a){$.publish(Events.DIALOG_DISPLAY,{dialogId:"create-palette"})},a.PalettesListController.prototype.onEditPaletteClick_=function(a){var b=this.colorPaletteSelect_.value;$.publish(Events.DIALOG_DISPLAY,{dialogId:"create-palette",initArgs:b})},a.PalettesListController.prototype.onColorContainerContextMenu=function(a){a.preventDefault()},a.PalettesListController.prototype.onColorContainerMouseup=function(a){var b=a.target,c=b.dataset.color;c&&(a.button==Constants.LEFT_BUTTON?$.publish(Events.SELECT_PRIMARY_COLOR,[c]):a.button==Constants.RIGHT_BUTTON&&$.publish(Events.SELECT_SECONDARY_COLOR,[c]))},a.PalettesListController.prototype.highlightSelectedColors=function(){this.removeClass_(b),this.removeClass_(c);var a=this.getColorContainer_(pskl.app.selectedColorsService.getSecondaryColor());a&&(a.classList.remove(b),a.classList.add(c)),a=this.getColorContainer_(pskl.app.selectedColorsService.getPrimaryColor()),a&&(a.classList.remove(c),a.classList.add(b))},a.PalettesListController.prototype.getColorContainer_=function(a){return this.colorListContainer_.querySelector('.palettes-list-color[data-color="'+a+'"]')},a.PalettesListController.prototype.removeClass_=function(a){var b=document.querySelector("."+a);b&&b.classList.remove(a)},a.PalettesListController.prototype.onPaletteListUpdated=function(){this.fillPaletteList(),this.updateFromUserSettings()}}(),function(){var a=$.namespace("pskl.controller");a.PenSizeController=function(){},a.PenSizeController.prototype.init=function(){this.container=document.querySelector(".pen-size-container"),pskl.utils.Event.addEventListener(this.container,"click",this.onPenSizeOptionClick_,this),$.subscribe(Events.PEN_SIZE_CHANGED,this.onPenSizeChanged_.bind(this)),this.updateSelectedOption_()},a.PenSizeController.prototype.onPenSizeOptionClick_=function(a){var b=a.target.dataset.size;isNaN(b)||(b=parseInt(b,10),pskl.app.penSizeService.setPenSize(b))},a.PenSizeController.prototype.onPenSizeChanged_=function(a){this.updateSelectedOption_()},a.PenSizeController.prototype.updateSelectedOption_=function(){pskl.utils.Dom.removeClass("selected",this.container);var a=pskl.app.penSizeService.getPenSize(),b=this.container.querySelector('[data-size="'+a+'"]');b&&b.classList.add("selected")}}(),function(){var a=$.namespace("pskl.controller");a.ProgressBarController=function(){this.template=pskl.utils.Template.get("progress-bar-template"),this.progressBa
|
|||
|
}}(),function(){var a=$.namespace("pskl.controller.settings.resize");a.DefaultSizeController=function(a){this.piskelController=a},pskl.utils.inherit(a.DefaultSizeController,pskl.controller.settings.AbstractSettingController),a.DefaultSizeController.prototype.init=function(){this.container=document.querySelector(".settings-default-size");var a=pskl.UserSettings.get(pskl.UserSettings.DEFAULT_SIZE);this.widthInput=this.container.querySelector('[name="default-width"]'),this.heightInput=this.container.querySelector('[name="default-height"]'),this.widthInput.value=a.width,this.heightInput.value=a.height,this.defaultSizeForm=this.container.querySelector("form"),this.addEventListener(this.defaultSizeForm,"submit",this.onFormSubmit_)},a.DefaultSizeController.prototype.onFormSubmit_=function(a){a.preventDefault();var b=pskl.UserSettings.get(pskl.UserSettings.DEFAULT_SIZE),c=this.toNumber_(this.widthInput.value,b.width),d=this.toNumber_(this.heightInput.value,b.height);pskl.UserSettings.set(pskl.UserSettings.DEFAULT_SIZE,{width:c,height:d}),$.publish(Events.CLOSE_SETTINGS_DRAWER)},a.DefaultSizeController.prototype.toNumber_=function(a,b){var c=parseInt(a,10);return(0===c||isNaN(c))&&(c=b),c}}(),function(){var a=$.namespace("pskl.controller.settings"),b={DESKTOP:"save-desktop-partial",GALLERY:"save-gallery-partial",GALLERY_UNAVAILABLE:"save-gallery-unavailable-partial",LOCALSTORAGE:"save-localstorage-partial",FILEDOWNLOAD:"save-file-download-partial"};a.SaveController=function(a){this.piskelController=a},pskl.utils.inherit(a.SaveController,pskl.controller.settings.AbstractSettingController),a.SaveController.prototype.init=function(){this.saveForm=document.querySelector(".save-form"),this.insertSavePartials_(),this.piskelName=document.querySelector(".piskel-name"),this.descriptionInput=document.querySelector("#save-description"),this.nameInput=document.querySelector("#save-name"),this.isPublicCheckbox=document.querySelector("input[name=save-public-checkbox]"),this.updateDescriptorInputs_(),this.saveLocalStorageButton=document.querySelector("#save-localstorage-button"),this.saveGalleryButton=document.querySelector("#save-gallery-button"),this.saveDesktopButton=document.querySelector("#save-desktop-button"),this.saveDesktopAsNewButton=document.querySelector("#save-desktop-as-new-button"),this.saveFileDownloadButton=document.querySelector("#save-file-download-button"),this.safeAddEventListener_(this.saveLocalStorageButton,"click",this.saveToLocalStorage_),this.safeAddEventListener_(this.saveGalleryButton,"click",this.saveToGallery_),this.safeAddEventListener_(this.saveDesktopButton,"click",this.saveToDesktop_),this.safeAddEventListener_(this.saveDesktopAsNewButton,"click",this.saveToDesktopAsNew_),this.safeAddEventListener_(this.saveFileDownloadButton,"click",this.saveToFileDownload_),this.addEventListener(this.saveForm,"submit",this.onSaveFormSubmit_),pskl.app.storageService.isSaving()&&this.disableSaveButtons_(),$.subscribe(Events.BEFORE_SAVING_PISKEL,this.disableSaveButtons_.bind(this)),$.subscribe(Events.AFTER_SAVING_PISKEL,this.enableSaveButtons_.bind(this))},a.SaveController.prototype.insertSavePartials_=function(){this.getPartials_().forEach(function(a){pskl.utils.Template.insert(this.saveForm,"beforeend",a)}.bind(this))},a.SaveController.prototype.getPartials_=function(){return pskl.utils.Environment.detectNodeWebkit()?[b.DESKTOP,b.LOCALSTORAGE,b.GALLERY_UNAVAILABLE]:pskl.app.isLoggedIn()?[b.GALLERY,b.LOCALSTORAGE,b.FILEDOWNLOAD]:[b.FILEDOWNLOAD,b.LOCALSTORAGE,b.GALLERY_UNAVAILABLE]},a.SaveController.prototype.updateDescriptorInputs_=function(a){var b=this.piskelController.getPiskel().getDescriptor();if(this.descriptionInput.value=b.description,this.nameInput.value=b.name,b.isPublic&&this.isPublicCheckbox.setAttribute("checked",!0),!pskl.app.isLoggedIn()){var c=document.querySelector(".save-public-section");c.style.display="none"}},a.SaveController.prototype.onSaveFormSubmit_=function(a){a.preventDefault(),a.stopPropagation(),pskl.app.isLoggedIn()?this.saveToGallery_():this.saveToLocalStorage_()},a.SaveController.prototype.save
|
|||
|
this.container=null,this.colorsList=null,this.colorPreviewEl=null},a.ColorsList.prototype.refreshColorElement_=function(a){var b=this.palette.get(this.selectedIndex),c=document.querySelector('[data-palette-index="'+a+'"]');c&&(c.style.background=b,c.classList.toggle("light-color",this.isLight_(b)))},a.ColorsList.prototype.onColorContainerClick_=function(a){var b=a.target;b.classList.contains("create-palette-color")?this.onPaletteColorClick_(a,b):b.classList.contains("create-palette-new-color")?this.onNewColorClick_(a,b):b.classList.contains("create-palette-remove-color")&&this.onRemoveColorClick_(a,b),this.refresh_()},a.ColorsList.prototype.onColorUpdated_=function(a){var b=a.toHexString();this.colorPreviewEl.style.background=b,this.palette&&(this.palette.set(this.selectedIndex,b),this.refreshColorElement_(this.selectedIndex))},a.ColorsList.prototype.onPaletteColorClick_=function(a,b){var c=parseInt(b.dataset.paletteIndex,10);this.selectColor_(c)},a.ColorsList.prototype.onRemoveColorClick_=function(a,b){var c=b.parentNode,d=parseInt(c.dataset.paletteIndex,10);this.removeColor_(d)},a.ColorsList.prototype.onNewColorClick_=function(a,b){var c=this.palette.get(this.selectedIndex)||"#000000";this.palette.add(c),this.selectColor_(this.palette.size()-1)},a.ColorsList.prototype.refresh_=function(){var a="",b=pskl.utils.Template.get("create-palette-color-template"),c=this.palette.getColors();c.forEach(function(c,d){var e=d===this.selectedIndex;a+=pskl.utils.Template.replace(b,{color:c,index:d,":selected":e,":light-color":this.isLight_(c)})}.bind(this)),a+='<li class="create-palette-new-color">+</li>',this.colorsList.innerHTML=a},a.ColorsList.prototype.selectColor_=function(a){this.selectedIndex=a,this.hslRgbColorPicker.setColor(this.palette.get(a))},a.ColorsList.prototype.removeColor_=function(a){this.palette.removeAt(a),this.refresh_()},a.ColorsList.prototype.isLight_=function(a){var b=window.tinycolor(a).toRgb();return b.r+b.b+b.g>384},a.ColorsList.prototype.onColorDrop_=function(a,b){var c=b.item.get(0),d=parseInt(c.dataset.paletteIndex,10),e=$(".create-palette-color").index(b.item);this.palette.move(d,e),this.selectedIndex=e,this.refresh_()}}(),function(){var a=$.namespace("pskl.widgets");a.HslRgbColorPicker=function(a,b){this.container=a,this.colorUpdatedCallback=b,this.tinyColor=null,this.hsvColor=null,this.rgbColor=null,this.lastInputTimestamp_=0},a.HslRgbColorPicker.prototype.init=function(){var a=pskl.utils.UserAgent.isFirefox,b=pskl.utils.UserAgent.isChrome,c=b||a?"input":"change";this.container.addEventListener(c,this.onPickerChange_.bind(this)),this.container.addEventListener("keydown",this.onKeydown_.bind(this)),this.container.addEventListener("blur",this.onBlur_.bind(this),!0),this.spectrumEl=this.container.querySelector(".color-picker-spectrum"),$(this.spectrumEl).spectrum({flat:!0,showButtons:!1,move:this.setColor.bind(this),change:this.setColor.bind(this)}),this.setColor("#000000")},a.HslRgbColorPicker.prototype.destroy=function(){this.container=null,this.spectrumEl=null},a.HslRgbColorPicker.prototype.onPickerChange_=function(a){var b=a.target;if(b.dataset.dimension){var c=b.dataset.model,d=b.dataset.dimension,e=b.value;this.updateColor_(e,c,d)}},a.HslRgbColorPicker.prototype.onKeydown_=function(a){var b=a.target,c="text"===b.getAttribute("type").toLowerCase();if(c&&b.dataset.dimension){var d=b.dataset.model;if("rgb"===d||"hsv"===d){var e=this.getIncrement_(a);if(e){var f=b.dataset.dimension,g=parseInt(b.value,10);this.updateColor_(g+e,d,f)}}}},a.HslRgbColorPicker.prototype.getIncrement_=function(a){var b=0,c=pskl.service.keyboard.KeycodeTranslator.toChar(a.keyCode);return"up"===c?b=1:"down"===c&&(b=-1),a.shiftKey&&(b=5*b),b},a.HslRgbColorPicker.prototype.updateColor_=function(a,b,c){var d=this.toModelValue_(a,b,c);if("hsv"===b||"rgb"===b){if(!isNaN(d)){var e=this.getColor_(b);e[c]=this.normalizeDimension_(d,c),this.setColor(e)}}else"hex"===b&&/^#([a-f0-9]{3}){1,2}$/i.test(d)&&this.setColor(d)},a.HslRgbColorPicker.prototype.onBlur_=function(a){var b=a.target,c="text"===b.getAttribute("type").toLowerCase();if(c&&
|
|||
|
$.publish(Events.PISKEL_SAVED_STATUS_UPDATE)},a.SavedStatusService.prototype.isDirty=function(){return this.lastSavedStateIndex!=this.historyService.getCurrentStateId()}}(),function(){var a={191:"?",8:"back",27:"esc",37:"left",38:"up",39:"right",40:"down",46:"del",189:"-",109:"-",173:"-",187:"+",107:"+",61:"+",188:"<",190:">",219:"[",221:"]"},b=$.namespace("pskl.service.keyboard");b.KeycodeTranslator={toChar:function(b){return b>=48&&57>=b?b-48+"":b>=96&&105>=b?b-96+"":b>=65&&90>=b?(b-65+10).toString(36):a[b]}}}(),function(){var a=$.namespace("pskl.service.keyboard");a.KeyUtils={createKeyFromString:function(a){a=a.toLowerCase();var b={alt:-1!=a.indexOf("alt+"),shift:-1!=a.indexOf("shift+"),ctrl:-1!=a.indexOf("ctrl+")},c=a.split(/\+(?!$)/),d=c[c.length-1];return{key:d.toUpperCase(),modifiers:b}},createKeyFromEvent:function(b){var c=b.which,d=a.KeycodeTranslator.toChar(c);return d?{key:d.toUpperCase(),modifiers:{alt:b.altKey,shift:b.shiftKey,ctrl:a.KeyUtils.isCtrlKeyPressed_(b)}}:null},equals:function(b,c){b="string"==typeof b?a.KeyUtils.createKeyFromString(b):b,c="string"==typeof c?a.KeyUtils.createKeyFromString(c):c;var d=b.key===c.key&&b.modifiers.alt===c.modifiers.alt&&b.modifiers.shift===c.modifiers.shift&&b.modifiers.ctrl===c.modifiers.ctrl;return d},stringify:function(b){var c=a.KeyUtils.getModifiersString(b.modifiers);return c?c+"+"+b.key:b.key},getModifiersString:function(a){var b=[];return a.alt&&b.push("alt"),a.ctrl&&b.push("ctrl"),a.shift&&b.push("shift"),b.join("+")},isCtrlKeyPressed_:function(a){return pskl.utils.UserAgent.isMac?a.metaKey:a.ctrlKey}}}(),function(){var a=$.namespace("pskl.service.keyboard");a.Shortcut=function(a,b,c,d){this.id_=a,this.description_=b,"string"==typeof c&&(c=[c]),this.defaultKeys_=c,this.displayKey_=d},a.Shortcut.USER_SETTINGS_PREFIX="shortcut.",a.Shortcut.prototype.getId=function(){return this.id_},a.Shortcut.prototype.getDescription=function(){return this.description_},a.Shortcut.prototype.getKeys=function(){var a=pskl.UserSettings.get(this.getLocalStorageKey_())||this.defaultKeys_;return"string"==typeof a?[a]:Array.isArray(a)?a:[]},a.Shortcut.prototype.isEditable=function(){return this.getKeys().length<2},a.Shortcut.prototype.isCustom=function(){var b=this.getKeys();return b.length!==this.defaultKeys_.length?!0:this.defaultKeys_.some(function(c){return!b.some(function(b){return a.KeyUtils.equals(b,c)})})},a.Shortcut.prototype.isUndefined=function(){return 0===this.getKeys().length},a.Shortcut.prototype.getDisplayKey=function(){return this.isUndefined()?"???":this.displayKey_?this.displayKey_:this.getKeys()[0]},a.Shortcut.prototype.restoreDefault=function(a){pskl.UserSettings.set(this.getLocalStorageKey_(),"")},a.Shortcut.prototype.updateKeys=function(a){pskl.UserSettings.set(this.getLocalStorageKey_(),a)},a.Shortcut.prototype.removeKeys=function(b){if(this.isEditable()){var c=this.getKeys(),d=c.filter(function(c){return!b.some(function(b){return a.KeyUtils.equals(c,b)})});return d.length!==c.length?(this.updateKeys(d),!0):!1}},a.Shortcut.prototype.getLocalStorageKey_=function(){return a.Shortcut.USER_SETTINGS_PREFIX+this.id_}}(),function(){var a=$.namespace("pskl.service.keyboard"),b=function(b,c,d,e){return new a.Shortcut(b,c,d,e)};a.Shortcuts={FORBIDDEN_KEYS:["1","2","3","4","5","6","7","8","9","?","shift+?","del","back","ctrl+Y","ctrl+shift+Z"],TOOL:{PEN:b("tool-pen","Pen tool","P"),MIRROR_PEN:b("tool-vertical-mirror-pen","Vertical mirror pen tool","V"),PAINT_BUCKET:b("tool-paint-bucket","Paint bucket tool","B"),COLORSWAP:b("tool-colorswap","Magic bucket tool","A"),ERASER:b("tool-eraser","Eraser pen tool","E"),STROKE:b("tool-stroke","Stroke tool","L"),RECTANGLE:b("tool-rectangle","Rectangle tool","R"),CIRCLE:b("tool-circle","Circle tool","C"),MOVE:b("tool-move","Move tool","M"),SHAPE_SELECT:b("tool-shape-select","Shape selection","Z"),RECTANGLE_SELECT:b("tool-rectangle-select","Rectangle selection","S"),LASSO_SELECT:b("tool-lasso-select","Lasso selection","H"),LIGHTEN:b("tool-lighten","Lighten tool","U"),DITHERING:b("tool-dithering","Dithering tool","T"),COLORPICKER:b("too
|
|||
|
a.BaseSelect.prototype.drawSelectionOnOverlay_=function(a){for(var b=this.selection.pixels,c=0,d=b.length;d>c;c++){var e=b[c],f=e.color&&e.color!==Constants.TRANSPARENT_COLOR,g=f?this.getTransparentVariant_(e.color):Constants.SELECTION_TRANSPARENT_COLOR;a.setPixel(b[c].col,b[c].row,g)}},a.BaseSelect.prototype.getTransparentVariant_=pskl.utils.FunctionUtils.memo(function(a){var b=window.tinycolor(a);return b=window.tinycolor.lighten(b,10),b.setAlpha(.5),b.toRgbString()},{}),a.BaseSelect.prototype.onSelectStart_=function(a,b,c,d){},a.BaseSelect.prototype.onSelect_=function(a,b,c,d){},a.BaseSelect.prototype.onSelectEnd_=function(a,b,c,d){},a.BaseSelect.prototype.onSelectionMoveStart_=function(a,b,c,d){},a.BaseSelect.prototype.onSelectionMove_=function(a,b,c,d){var e=a-this.lastMoveCol,f=b-this.lastMoveRow;a-this.startCol,b-this.startRow;this.selection.move(e,f),d.clear(),this.drawSelectionOnOverlay_(d),this.lastMoveCol=a,this.lastMoveRow=b},a.BaseSelect.prototype.onSelectionMoveEnd_=function(a,b,c,d){this.onSelectionMove_(a,b,c,d)}}(),function(){var a=$.namespace("pskl.tools.drawing.selection");a.AbstractDragSelect=function(){a.BaseSelect.call(this),this.hasSelection=!1},pskl.utils.inherit(a.AbstractDragSelect,a.BaseSelect),a.AbstractDragSelect.prototype.onSelectStart_=function(a,b,c,d){this.hasSelection?(this.hasSelection=!1,d.clear(),$.publish(Events.SELECTION_DISMISSED)):(this.hasSelection=!0,this.onDragSelectStart_(a,b),d.setPixel(a,b,this.getTransparentVariant_(Constants.SELECTION_TRANSPARENT_COLOR)))},a.AbstractDragSelect.prototype.onSelect_=function(a,b,c,d){this.hasSelection||this.startCol===a&&this.startRow===b||(this.hasSelection=!0,this.onDragSelectStart_(a,b)),this.hasSelection&&this.onDragSelect_(a,b,c,d)},a.AbstractDragSelect.prototype.onSelectEnd_=function(a,b,c,d){this.hasSelection&&this.onDragSelectEnd_(a,b,c,d)},a.AbstractDragSelect.prototype.startDragSelection_=function(a,b,c){this.hasSelection=!0,this.onDragSelectStart_(a,b),c.setPixel(a,b,this.getTransparentVariant_(Constants.SELECTION_TRANSPARENT_COLOR))},a.AbstractDragSelect.prototype.onDragSelectStart_=function(a,b,c,d){},a.AbstractDragSelect.prototype.onDragSelect_=function(a,b,c,d){},a.AbstractDragSelect.prototype.onDragSelectEnd_=function(a,b,c,d){}}(),function(){var a=$.namespace("pskl.tools.drawing.selection");a.LassoSelect=function(){a.AbstractDragSelect.call(this),this.toolId="tool-lasso-select",this.helpText="Lasso selection",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.LASSO_SELECT},pskl.utils.inherit(a.LassoSelect,a.AbstractDragSelect),a.LassoSelect.prototype.onDragSelectStart_=function(a,b){this.pixels=[{col:a,row:b}],this.startCol=a,this.startRow=b,this.previousCol=a,this.previousRow=b,$.publish(Events.DRAG_START,[a,b])},a.LassoSelect.prototype.onDragSelect_=function(a,b,c,d){this.addPixel_(a,b,c);var e=new pskl.selection.ShapeSelection(this.getLassoPixels_());this.setSelection_(e,d)},a.LassoSelect.prototype.onDragSelectEnd_=function(a,b,c,d){this.addPixel_(a,b,c);var e=new pskl.selection.LassoSelection(this.getLassoPixels_(),c);this.setSelection_(e,d),$.publish(Events.DRAG_END)},a.LassoSelect.prototype.getLassoPixels_=function(){var a=pskl.PixelUtils.getLinePixels(this.previousCol,this.startCol,this.previousRow,this.startRow);return this.pixels.concat(a)},a.LassoSelect.prototype.addPixel_=function(a,b,c){a=pskl.utils.Math.minmax(a,0,c.getWidth()-1),b=pskl.utils.Math.minmax(b,0,c.getHeight()-1);var d=pskl.PixelUtils.getLinePixels(a,this.previousCol,b,this.previousRow);this.pixels=this.pixels.concat(d),this.previousCol=a,this.previousRow=b},a.LassoSelect.prototype.setSelection_=function(a,b){this.selection=a,$.publish(Events.SELECTION_CREATED,[this.selection]),b.clear(),this.drawSelectionOnOverlay_(b)}}(),function(){var a=$.namespace("pskl.tools.drawing.selection");a.RectangleSelect=function(){a.AbstractDragSelect.call(this),this.toolId="tool-rectangle-select",this.helpText="Rectangle selection",this.shortcut=pskl.service.keyboard.Shortcuts.TOOL.RECTANGLE_SELECT},pskl.utils.inherit(a.RectangleSelect,a.AbstractDragSelect),a.Rectangle
|