From fa4597f0e6631947c5f5ac0182dfd456002c7ff3 Mon Sep 17 00:00:00 2001 From: PixelsCommander Date: Tue, 14 Apr 2015 21:54:28 +0200 Subject: [PATCH] #47 Fixed reference to jQuery --- dist/htmlgl.js | 34 ++++++++++++++++++---------------- dist/htmlgl.min.js | 22 +++++++++++----------- page/js/htmlgl.min.js | 22 +++++++++++----------- src/gl-element.js | 14 +++++++------- 4 files changed, 47 insertions(+), 45 deletions(-) diff --git a/dist/htmlgl.js b/dist/htmlgl.js index 5e80d30..97b8b00 100644 --- a/dist/htmlgl.js +++ b/dist/htmlgl.js @@ -13,22 +13,24 @@ "undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,o=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};o.prototype={set:function(t,o){var n=t[this.name];return n&&n[0]===t?n[1]=o:e(t,this.name,{value:[t,o],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=o}(),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,o=[],n=function(e){o.push(e)},r=function(){o.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=r,e.hasNative=Boolean(document.registerElement),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(e){function t(e,t){o(e,function(e){return t(e)?!0:void n(e,t)}),n(e,t)}function o(e,t,n){var r=e.firstElementChild;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r=r.nextSibling;for(;r;)t(r,n)!==!0&&o(r,t,n),r=r.nextElementSibling;return null}function n(e,o){for(var n=e.shadowRoot;n;)t(n,o),n=n.olderShadowRoot}function r(e,t){i=[],a(e,t),i=null}function a(e,t){if(e=wrap(e),!(i.indexOf(e)>=0)){i.push(e);for(var o,n=e.querySelectorAll("link[rel="+u+"]"),r=0,d=n.length;d>r&&(o=n[r]);r++)o["import"]&&a(o["import"],t);t(e)}}var i,u=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),CustomElements.addModule(function(e){function t(e){return o(e)||n(e)}function o(t){return e.upgrade(t)?!0:void u(t)}function n(e){y(e,function(e){return o(e)?!0:void 0})}function r(e){u(e),f(e)&&y(e,function(e){u(e)})}function a(e){M.push(e),C||(C=!0,setTimeout(i))}function i(){C=!1;for(var e,t=M,o=0,n=t.length;n>o&&(e=t[o]);o++)e();M=[]}function u(e){E?a(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&!e.__attached&&f(e)&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function c(e){s(e),y(e,function(e){s(e)})}function s(e){E?a(function(){l(e)}):l(e)}function l(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&e.__attached&&!f(e)&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function f(e){for(var t=e,o=wrap(document);t;){if(t==o)return!0;t=t.parentNode||t.host}}function p(e){if(e.shadowRoot&&!e.shadowRoot.__watched){_.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)h(t),t=t.olderShadowRoot}}function m(e){if(_.dom){var o=e[0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var n=o.addedNodes[0];n&&n!==document&&!n.host;)n=n.parentNode;var r=n&&(n.URL||n._URL||n.host&&n.host.localName)||"";r=r.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,r||"")}e.forEach(function(e){"childList"===e.type&&(N(e.addedNodes,function(e){e.localName&&t(e)}),N(e.removedNodes,function(e){e.localName&&c(e)}))}),_.dom&&console.groupEnd()}function w(e){for(e=wrap(e),e||(e=wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(m(t.takeRecords()),i())}function h(e){if(!e.__observer){var t=new MutationObserver(m);t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function g(e){e=wrap(e),_.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop()),t(e),h(e),_.dom&&console.groupEnd()}function v(e){b(e,g)}var _=e.flags,y=e.forSubtree,b=e.forDocumentTree,E=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=E;var C=!1,M=[],N=Array.prototype.forEach.call.bind(Array.prototype.forEach),T=Element.prototype.createShadowRoot;T&&(Element.prototype.createShadowRoot=function(){var e=T.call(this);return CustomElements.watchShadow(this),e}),e.watchShadow=p,e.upgradeDocumentTree=v,e.upgradeSubtree=n,e.upgradeAll=t,e.attachedNode=r,e.takeRecords=w}),CustomElements.addModule(function(e){function t(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is"),r=e.getRegisteredDefinition(n||t.localName);if(r){if(n&&r.tag==t.localName)return o(t,r);if(!n&&!r["extends"])return o(t,r)}}}function o(t,o){return i.upgrade&&console.group("upgrade:",t.localName),o.is&&t.setAttribute("is",o.is),n(t,o),t.__upgraded__=!0,a(t),e.attachedNode(t),e.upgradeSubtree(t),i.upgrade&&console.groupEnd(),t}function n(e,t){Object.__proto__?e.__proto__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function r(e,t,o){for(var n={},r=t;r!==o&&r!==HTMLElement.prototype;){for(var a,i=Object.getOwnPropertyNames(r),u=0;a=i[u];u++)n[a]||(Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a)),n[a]=1);r=Object.getPrototypeOf(r)}}function a(e){e.createdCallback&&e.createdCallback()}var i=e.flags;e.upgrade=t,e.upgradeWithDefinition=o,e.implementPrototype=n}),CustomElements.addModule(function(e){function t(t,n){var d=n||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(c(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return d.prototype||(d.prototype=Object.create(HTMLElement.prototype)),d.__name=t.toLowerCase(),d.lifecycle=d.lifecycle||{},d.ancestry=a(d["extends"]),i(d),u(d),o(d.prototype),s(d.__name,d),d.ctor=l(d),d.ctor.prototype=d.prototype,d.prototype.constructor=d.ctor,e.ready&&h(document),d.ctor}function o(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,o){n.call(this,e,o,t)};var o=e.removeAttribute;e.removeAttribute=function(e){n.call(this,e,null,o)},e.setAttribute._polyfilled=!0}}function n(e,t,o){e=e.toLowerCase();var n=this.getAttribute(e);o.apply(this,arguments);var r=this.getAttribute(e);this.attributeChangedCallback&&r!==n&&this.attributeChangedCallback(e,n,r)}function r(e){for(var t=0;t=0&&_(n,HTMLElement),n)}function m(e){var t=T.call(this,e);return g(t),t}var w,h=e.upgradeDocumentTree,g=e.upgrade,v=e.upgradeWithDefinition,_=e.implementPrototype,y=e.useNative,b=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],E={},C="http://www.w3.org/1999/xhtml",M=document.createElement.bind(document),N=document.createElementNS.bind(document),T=Node.prototype.cloneNode;w=Object.__proto__||y?function(e,t){return e instanceof t}:function(e,t){for(var o=e;o;){if(o===t.prototype)return!0;o=o.__proto__}return!1},document.registerElement=t,document.createElement=p,document.createElementNS=f,Node.prototype.cloneNode=m,e.registry=E,e["instanceof"]=w,e.reservedTagList=b,e.getRegisteredDefinition=c,document.register=document.registerElement}),function(e){function t(){i(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(e){i(wrap(e["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var o=e.useNative,n=e.initializeModules,r=/Trident/.test(navigator.userAgent);if(o){var a=function(){};e.watchShadow=a,e.upgrade=a,e.upgradeAll=a,e.upgradeDocumentTree=a,e.upgradeSubtree=a,e.takeRecords=a,e["instanceof"]=function(e,t){return e instanceof t}}else n();var i=e.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),r&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),o},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var u=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(u,t)}else t()}(window.CustomElements); /** * @license - * pixi.js - v2.2.7 + * pixi.js - v2.2.8 * Copyright (c) 2012-2014, Mat Groves * http://goodboydigital.com/ * - * Compiled: 2015-02-25 + * Compiled: 2015-03-15 * * pixi.js is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license.php */ -(function(){var a=this,b=b||{};b.WEBGL_RENDERER=0,b.CANVAS_RENDERER=1,b.VERSION="v2.2.7",b.blendModes={NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},b.scaleModes={DEFAULT:0,LINEAR:0,NEAREST:1},b._UID=0,"undefined"!=typeof Float32Array?(b.Float32Array=Float32Array,b.Uint16Array=Uint16Array,b.Uint32Array=Uint32Array,b.ArrayBuffer=ArrayBuffer):(b.Float32Array=Array,b.Uint16Array=Array),b.INTERACTION_FREQUENCY=30,b.AUTO_PREVENT_DEFAULT=!0,b.PI_2=2*Math.PI,b.RAD_TO_DEG=180/Math.PI,b.DEG_TO_RAD=Math.PI/180,b.RETINA_PREFIX="@2x",b.dontSayHello=!1,b.defaultRenderOptions={view:null,transparent:!1,antialias:!1,preserveDrawingBuffer:!1,resolution:1,clearBeforeRender:!0,autoResize:!1},b.sayHello=function(a){if(!b.dontSayHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var c=["%c %c %c Pixi.js "+b.VERSION+" - "+a+" %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ ","background: #ff66a5","background: #ff66a5","color: #ff66a5; background: #030307;","background: #ff66a5","background: #ffc3dc","background: #ff66a5","color: #ff2424; background: #fff","color: #ff2424; background: #fff","color: #ff2424; background: #fff"];console.log.apply(console,c)}else window.console&&console.log("Pixi.js "+b.VERSION+" - http://www.pixijs.com/");b.dontSayHello=!0}},b.Point=function(a,b){this.x=a||0,this.y=b||0},b.Point.prototype.clone=function(){return new b.Point(this.x,this.y)},b.Point.prototype.set=function(a,b){this.x=a||0,this.y=b||(0!==b?this.x:0)},b.Point.prototype.constructor=b.Point,b.Rectangle=function(a,b,c,d){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0},b.Rectangle.prototype.clone=function(){return new b.Rectangle(this.x,this.y,this.width,this.height)},b.Rectangle.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=this.x;if(a>=c&&a<=c+this.width){var d=this.y;if(b>=d&&b<=d+this.height)return!0}return!1},b.Rectangle.prototype.constructor=b.Rectangle,b.EmptyRectangle=new b.Rectangle(0,0,0,0),b.Polygon=function(a){if(a instanceof Array||(a=Array.prototype.slice.call(arguments)),a[0]instanceof b.Point){for(var c=[],d=0,e=a.length;e>d;d++)c.push(a[d].x,a[d].y);a=c}this.closed=!0,this.points=a},b.Polygon.prototype.clone=function(){var a=this.points.slice();return new b.Polygon(a)},b.Polygon.prototype.contains=function(a,b){for(var c=!1,d=this.points.length/2,e=0,f=d-1;d>e;f=e++){var g=this.points[2*e],h=this.points[2*e+1],i=this.points[2*f],j=this.points[2*f+1],k=h>b!=j>b&&(i-g)*(b-h)/(j-h)+g>a;k&&(c=!c)}return c},b.Polygon.prototype.constructor=b.Polygon,b.Circle=function(a,b,c){this.x=a||0,this.y=b||0,this.radius=c||0},b.Circle.prototype.clone=function(){return new b.Circle(this.x,this.y,this.radius)},b.Circle.prototype.contains=function(a,b){if(this.radius<=0)return!1;var c=this.x-a,d=this.y-b,e=this.radius*this.radius;return c*=c,d*=d,e>=c+d},b.Circle.prototype.getBounds=function(){return new b.Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},b.Circle.prototype.constructor=b.Circle,b.Ellipse=function(a,b,c,d){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0},b.Ellipse.prototype.clone=function(){return new b.Ellipse(this.x,this.y,this.width,this.height)},b.Ellipse.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=(a-this.x)/this.width,d=(b-this.y)/this.height;return c*=c,d*=d,1>=c+d},b.Ellipse.prototype.getBounds=function(){return new b.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},b.Ellipse.prototype.constructor=b.Ellipse,b.RoundedRectangle=function(a,b,c,d,e){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0,this.radius=e||20},b.RoundedRectangle.prototype.clone=function(){return new b.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},b.RoundedRectangle.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=this.x;if(a>=c&&a<=c+this.width){var d=this.y;if(b>=d&&b<=d+this.height)return!0}return!1},b.RoundedRectangle.prototype.constructor=b.RoundedRectangle,b.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},b.Matrix.prototype.fromArray=function(a){this.a=a[0],this.b=a[1],this.c=a[3],this.d=a[4],this.tx=a[2],this.ty=a[5]},b.Matrix.prototype.toArray=function(a){this.array||(this.array=new b.Float32Array(9));var c=this.array;return a?(c[0]=this.a,c[1]=this.b,c[2]=0,c[3]=this.c,c[4]=this.d,c[5]=0,c[6]=this.tx,c[7]=this.ty,c[8]=1):(c[0]=this.a,c[1]=this.c,c[2]=this.tx,c[3]=this.b,c[4]=this.d,c[5]=this.ty,c[6]=0,c[7]=0,c[8]=1),c},b.Matrix.prototype.apply=function(a,c){return c=c||new b.Point,c.x=this.a*a.x+this.c*a.y+this.tx,c.y=this.b*a.x+this.d*a.y+this.ty,c},b.Matrix.prototype.applyInverse=function(a,c){c=c||new b.Point;var d=1/(this.a*this.d+this.c*-this.b);return c.x=this.d*d*a.x+-this.c*d*a.y+(this.ty*this.c-this.tx*this.d)*d,c.y=this.a*d*a.y+-this.b*d*a.x+(-this.ty*this.a+this.tx*this.b)*d,c},b.Matrix.prototype.translate=function(a,b){return this.tx+=a,this.ty+=b,this},b.Matrix.prototype.scale=function(a,b){return this.a*=a,this.d*=b,this.c*=a,this.b*=b,this.tx*=a,this.ty*=b,this},b.Matrix.prototype.rotate=function(a){var b=Math.cos(a),c=Math.sin(a),d=this.a,e=this.c,f=this.tx;return this.a=d*b-this.b*c,this.b=d*c+this.b*b,this.c=e*b-this.d*c,this.d=e*c+this.d*b,this.tx=f*b-this.ty*c,this.ty=f*c+this.ty*b,this},b.Matrix.prototype.append=function(a){var b=this.a,c=this.b,d=this.c,e=this.d;return this.a=a.a*b+a.b*d,this.b=a.a*c+a.b*e,this.c=a.c*b+a.d*d,this.d=a.c*c+a.d*e,this.tx=a.tx*b+a.ty*d+this.tx,this.ty=a.tx*c+a.ty*e+this.ty,this},b.Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},b.identityMatrix=new b.Matrix,b.DisplayObject=function(){this.position=new b.Point,this.scale=new b.Point(1,1),this.pivot=new b.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new b.Matrix,this._sr=0,this._cr=1,this.filterArea=null,this._bounds=new b.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},b.DisplayObject.prototype.constructor=b.DisplayObject,Object.defineProperty(b.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(a){this._interactive=a,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(b.DisplayObject.prototype,"worldVisible",{get:function(){var a=this;do{if(!a.visible)return!1;a=a.parent}while(a);return!0}}),Object.defineProperty(b.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(a){this._mask&&(this._mask.isMask=!1),this._mask=a,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(b.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(a){if(a){for(var b=[],c=0;c=0&&b<=this.children.length)return a.parent&&a.parent.removeChild(a),a.parent=this,this.children.splice(b,0,a),this.stage&&a.setStageReference(this.stage),a;throw new Error(a+"addChildAt: The index "+b+" supplied is out of bounds "+this.children.length)},b.DisplayObjectContainer.prototype.swapChildren=function(a,b){if(a!==b){var c=this.getChildIndex(a),d=this.getChildIndex(b);if(0>c||0>d)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[c]=b,this.children[d]=a}},b.DisplayObjectContainer.prototype.getChildIndex=function(a){var b=this.children.indexOf(a);if(-1===b)throw new Error("The supplied DisplayObject must be a child of the caller");return b},b.DisplayObjectContainer.prototype.setChildIndex=function(a,b){if(0>b||b>=this.children.length)throw new Error("The supplied index is out of bounds");var c=this.getChildIndex(a);this.children.splice(c,1),this.children.splice(b,0,a)},b.DisplayObjectContainer.prototype.getChildAt=function(a){if(0>a||a>=this.children.length)throw new Error("getChildAt: Supplied index "+a+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[a]},b.DisplayObjectContainer.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(-1!==b)return this.removeChildAt(b)},b.DisplayObjectContainer.prototype.removeChildAt=function(a){var b=this.getChildAt(a);return this.stage&&b.removeStageReference(),b.parent=void 0,this.children.splice(a,1),b},b.DisplayObjectContainer.prototype.removeChildren=function(a,b){var c=a||0,d="number"==typeof b?b:this.children.length,e=d-c;if(e>0&&d>=e){for(var f=this.children.splice(c,e),g=0;ga;a++)this.children[a].updateTransform()},b.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=b.DisplayObjectContainer.prototype.updateTransform,b.DisplayObjectContainer.prototype.getBounds=function(){if(0===this.children.length)return b.EmptyRectangle;for(var a,c,d,e=1/0,f=1/0,g=-1/0,h=-1/0,i=!1,j=0,k=this.children.length;k>j;j++){var l=this.children[j];l.visible&&(i=!0,a=this.children[j].getBounds(),e=ec?g:c,h=h>d?h:d)}if(!i)return b.EmptyRectangle;var m=this._bounds;return m.x=e,m.y=f,m.width=g-e,m.height=h-f,m},b.DisplayObjectContainer.prototype.getLocalBounds=function(){var a=this.worldTransform;this.worldTransform=b.identityMatrix;for(var c=0,d=this.children.length;d>c;c++)this.children[c].updateTransform();var e=this.getBounds();return this.worldTransform=a,e},b.DisplayObjectContainer.prototype.setStageReference=function(a){this.stage=a,this._interactive&&(this.stage.dirty=!0);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d.setStageReference(a)}},b.DisplayObjectContainer.prototype.removeStageReference=function(){for(var a=0,b=this.children.length;b>a;a++){var c=this.children[a];c.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},b.DisplayObjectContainer.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(a);var b,c;if(this._mask||this._filters){for(this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._mask&&a.maskManager.popMask(this._mask,a),this._filters&&a.filterManager.popFilter(),a.spriteBatch.start()}else for(b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},b.DisplayObjectContainer.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(a);this._mask&&a.maskManager.pushMask(this._mask,a);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d._renderCanvas(a)}this._mask&&a.maskManager.popMask(a)}},b.Sprite=function(a){b.DisplayObjectContainer.call(this),this.anchor=new b.Point,this.texture=a||b.Texture.emptyTexture,this._width=0,this._height=0,this.tint=16777215,this.blendMode=b.blendModes.NORMAL,this.shader=null,this.texture.baseTexture.hasLoaded?this.onTextureUpdate():this.texture.on("update",this.onTextureUpdate.bind(this)),this.renderable=!0},b.Sprite.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Sprite.prototype.constructor=b.Sprite,Object.defineProperty(b.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(a){this.scale.x=a/this.texture.frame.width,this._width=a}}),Object.defineProperty(b.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(a){this.scale.y=a/this.texture.frame.height,this._height=a}}),b.Sprite.prototype.setTexture=function(a){this.texture=a,this.cachedTint=16777215},b.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height)},b.Sprite.prototype.getBounds=function(a){var b=this.texture.frame.width,c=this.texture.frame.height,d=b*(1-this.anchor.x),e=b*-this.anchor.x,f=c*(1-this.anchor.y),g=c*-this.anchor.y,h=a||this.worldTransform,i=h.a,j=h.b,k=h.c,l=h.d,m=h.tx,n=h.ty,o=-1/0,p=-1/0,q=1/0,r=1/0;if(0===j&&0===k)0>i&&(i*=-1),0>l&&(l*=-1),q=i*e+m,o=i*d+m,r=l*g+n,p=l*f+n;else{var s=i*e+k*g+m,t=l*g+j*e+n,u=i*d+k*g+m,v=l*g+j*d+n,w=i*d+k*f+m,x=l*f+j*d+n,y=i*e+k*f+m,z=l*f+j*e+n;q=q>s?s:q,q=q>u?u:q,q=q>w?w:q,q=q>y?y:q,r=r>t?t:r,r=r>v?v:r,r=r>x?x:r,r=r>z?z:r,o=s>o?s:o,o=u>o?u:o,o=w>o?w:o,o=y>o?y:o,p=t>p?t:p,p=v>p?v:p,p=x>p?x:p,p=z>p?z:p}var A=this._bounds;return A.x=q,A.width=o-q,A.y=r,A.height=p-r,this._currentBounds=A,A},b.Sprite.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){var b,c;if(this._mask||this._filters){var d=a.spriteBatch;for(this._filters&&(d.flush(),a.filterManager.pushFilter(this._filterBlock)),this._mask&&(d.stop(),a.maskManager.pushMask(this.mask,a),d.start()),d.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);d.stop(),this._mask&&a.maskManager.popMask(this._mask,a),this._filters&&a.filterManager.popFilter(),d.start()}else for(a.spriteBatch.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},b.Sprite.prototype._renderCanvas=function(a){if(!(this.visible===!1||0===this.alpha||this.texture.crop.width<=0||this.texture.crop.height<=0)){if(this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,a.context.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]),this._mask&&a.maskManager.pushMask(this._mask,a),this.texture.valid){var c=this.texture.baseTexture.resolution/a.resolution;a.context.globalAlpha=this.worldAlpha,a.smoothProperty&&a.scaleMode!==this.texture.baseTexture.scaleMode&&(a.scaleMode=this.texture.baseTexture.scaleMode,a.context[a.smoothProperty]=a.scaleMode===b.scaleModes.LINEAR);var d=this.texture.trim?this.texture.trim.x-this.anchor.x*this.texture.trim.width:this.anchor.x*-this.texture.frame.width,e=this.texture.trim?this.texture.trim.y-this.anchor.y*this.texture.trim.height:this.anchor.y*-this.texture.frame.height;a.roundPixels?(a.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*a.resolution|0,this.worldTransform.ty*a.resolution|0),d=0|d,e=0|e):a.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*a.resolution,this.worldTransform.ty*a.resolution),16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=b.CanvasTinter.getTintedTexture(this,this.tint)),a.context.drawImage(this.tintedTexture,0,0,this.texture.crop.width,this.texture.crop.height,d/c,e/c,this.texture.crop.width/c,this.texture.crop.height/c)):a.context.drawImage(this.texture.baseTexture.source,this.texture.crop.x,this.texture.crop.y,this.texture.crop.width,this.texture.crop.height,d/c,e/c,this.texture.crop.width/c,this.texture.crop.height/c)}for(var f=0,g=this.children.length;g>f;f++)this.children[f]._renderCanvas(a);this._mask&&a.maskManager.popMask(a)}},b.Sprite.fromFrame=function(a){var c=b.TextureCache[a];if(!c)throw new Error('The frameId "'+a+'" does not exist in the texture cache'+this);return new b.Sprite(c)},b.Sprite.fromImage=function(a,c,d){var e=b.Texture.fromImage(a,c,d);return new b.Sprite(e)},b.SpriteBatch=function(a){b.DisplayObjectContainer.call(this),this.textureThing=a,this.ready=!1},b.SpriteBatch.prototype=Object.create(b.DisplayObjectContainer.prototype),b.SpriteBatch.prototype.constructor=b.SpriteBatch,b.SpriteBatch.prototype.initWebGL=function(a){this.fastSpriteBatch=new b.WebGLFastSpriteBatch(a),this.ready=!0},b.SpriteBatch.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},b.SpriteBatch.prototype._renderWebGL=function(a){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(a.gl),this.fastSpriteBatch.gl!==a.gl&&this.fastSpriteBatch.setContext(a.gl),a.spriteBatch.stop(),a.shaderManager.setShader(a.shaderManager.fastShader),this.fastSpriteBatch.begin(this,a),this.fastSpriteBatch.render(this),a.spriteBatch.start())},b.SpriteBatch.prototype._renderCanvas=function(a){if(this.visible&&!(this.alpha<=0)&&this.children.length){var b=a.context;b.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var c=this.worldTransform,d=!0,e=0;e=this.textures.length&&(this.gotoAndStop(this.textures.length-1),this.onComplete&&this.onComplete())}},b.MovieClip.fromFrames=function(a){for(var c=[],d=0;di;i++){for(j=0;m>j;j+=4)if(255!==k[n+j]){o=!0;break}if(o)break;n+=m}for(c.ascent=g-i,n=l-m,o=!1,i=h;i>g;i--){for(j=0;m>j;j+=4)if(255!==k[n+j]){o=!0;break}if(o)break;n-=m}c.descent=i-g,c.descent+=6,c.fontSize=c.ascent+c.descent,b.Text.fontPropertiesCache[a]=c}return c},b.Text.prototype.wordWrap=function(a){for(var b="",c=a.split("\n"),d=0;de?(g>0&&(b+="\n"),b+=f[g],e=this.style.wordWrapWidth-h):(e-=i,b+=" "+f[g])}d=2?parseInt(c[c.length-2],10):b.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=a.tint},b.BitmapText.prototype.updateText=function(){for(var a=b.BitmapText.fonts[this.fontName],c=new b.Point,d=null,e=[],f=0,g=[],h=0,i=this.fontSize/a.size,j=0;j=j;j++){var n=0;"right"===this.style.align?n=f-g[j]:"center"===this.style.align&&(n=(f-g[j])/2),m.push(n)}var o=this.children.length,p=e.length,q=this.tint||16777215;for(j=0;p>j;j++){var r=o>j?this.children[j]:this._pool.pop();r?r.setTexture(e[j].texture):r=new b.Sprite(e[j].texture),r.position.x=(e[j].position.x+m[e[j].line])*i,r.position.y=e[j].position.y*i,r.scale.x=r.scale.y=i,r.tint=q,r.parent||this.addChild(r)}for(;this.children.length>p;){var s=this.getChildAt(this.children.length-1);this._pool.push(s),this.removeChild(s)}this.textWidth=f*i,this.textHeight=(c.y+a.lineHeight)*i},b.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),b.DisplayObjectContainer.prototype.updateTransform.call(this)},b.BitmapText.fonts={},b.InteractionData=function(){this.global=new b.Point,this.target=null,this.originalEvent=null},b.InteractionData.prototype.getLocalPosition=function(a,c){var d=a.worldTransform,e=this.global,f=d.a,g=d.c,h=d.tx,i=d.b,j=d.d,k=d.ty,l=1/(f*j+g*-i);return c=c||new b.Point,c.x=j*l*e.x+-g*l*e.y+(k*g-h*j)*l,c.y=f*l*e.y+-i*l*e.x+(-k*f+h*i)*l,c},b.InteractionData.prototype.constructor=b.InteractionData,b.InteractionManager=function(a){this.stage=a,this.mouse=new b.InteractionData,this.touches={},this.tempPoint=new b.Point,this.mouseoverEnabled=!0,this.pool=[],this.interactiveItems=[],this.interactionDOMElement=null,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this.mouseOut=!1,this.resolution=1,this._tempPoint=new b.Point -},b.InteractionManager.prototype.constructor=b.InteractionManager,b.InteractionManager.prototype.collectInteractiveSprite=function(a,b){for(var c=a.children,d=c.length,e=d-1;e>=0;e--){var f=c[e];f._interactive?(b.interactiveChildren=!0,this.interactiveItems.push(f),f.children.length>0&&this.collectInteractiveSprite(f,f)):(f.__iParent=null,f.children.length>0&&this.collectInteractiveSprite(f,b))}},b.InteractionManager.prototype.setTarget=function(a){this.target=a,this.resolution=a.resolution,null===this.interactionDOMElement&&this.setTargetDomElement(a.view)},b.InteractionManager.prototype.setTargetDomElement=function(a){this.removeEvents(),window.navigator.msPointerEnabled&&(a.style["-ms-content-zooming"]="none",a.style["-ms-touch-action"]="none"),this.interactionDOMElement=a,a.addEventListener("mousemove",this.onMouseMove,!0),a.addEventListener("mousedown",this.onMouseDown,!0),a.addEventListener("mouseout",this.onMouseOut,!0),a.addEventListener("touchstart",this.onTouchStart,!0),a.addEventListener("touchend",this.onTouchEnd,!0),a.addEventListener("touchleave",this.onTouchCancel,!0),a.addEventListener("touchcancel",this.onTouchCancel,!0),a.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0)},b.InteractionManager.prototype.removeEvents=function(){this.interactionDOMElement&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]="",this.interactionDOMElement.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchleave",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0))},b.InteractionManager.prototype.update=function(){if(this.target){var a=Date.now(),c=a-this.last;if(c=c*b.INTERACTION_FREQUENCY/1e3,!(1>c)){this.last=a;var d=0;this.dirty&&this.rebuildInteractiveGraph();var e=this.interactiveItems.length,f="inherit",g=!1;for(d=0;e>d;d++){var h=this.interactiveItems[d];h.__hit=this.hitTest(h,this.mouse),this.mouse.target=h,h.__hit&&!g?(h.buttonMode&&(f=h.defaultCursor),h.interactiveChildren||(g=!0),h.__isOver||(h.mouseover&&h.mouseover(this.mouse),h.__isOver=!0)):h.__isOver&&(h.mouseout&&h.mouseout(this.mouse),h.__isOver=!1)}this.currentCursorStyle!==f&&(this.currentCursorStyle=f,this.interactionDOMElement.style.cursor=f)}}},b.InteractionManager.prototype.rebuildInteractiveGraph=function(){this.dirty=!1;for(var a=this.interactiveItems.length,b=0;a>b;b++)this.interactiveItems[b].interactiveChildren=!1;this.interactiveItems=[],this.stage.interactive&&this.interactiveItems.push(this.stage),this.collectInteractiveSprite(this.stage,this.stage)},b.InteractionManager.prototype.onMouseMove=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a;var b=this.interactionDOMElement.getBoundingClientRect();this.mouse.global.x=(a.clientX-b.left)*(this.target.width/b.width)/this.resolution,this.mouse.global.y=(a.clientY-b.top)*(this.target.height/b.height)/this.resolution;for(var c=this.interactiveItems.length,d=0;c>d;d++){var e=this.interactiveItems[d];e.mousemove&&e.mousemove(this.mouse)}},b.InteractionManager.prototype.onMouseDown=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a,b.AUTO_PREVENT_DEFAULT&&this.mouse.originalEvent.preventDefault();for(var c=this.interactiveItems.length,d=this.mouse.originalEvent,e=2===d.button||3===d.which,f=e?"rightdown":"mousedown",g=e?"rightclick":"click",h=e?"__rightIsDown":"__mouseIsDown",i=e?"__isRightDown":"__isDown",j=0;c>j;j++){var k=this.interactiveItems[j];if((k[f]||k[g])&&(k[h]=!0,k.__hit=this.hitTest(k,this.mouse),k.__hit&&(k[f]&&k[f](this.mouse),k[i]=!0,!k.interactiveChildren)))break}},b.InteractionManager.prototype.onMouseOut=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a;var b=this.interactiveItems.length;this.interactionDOMElement.style.cursor="inherit";for(var c=0;b>c;c++){var d=this.interactiveItems[c];d.__isOver&&(this.mouse.target=d,d.mouseout&&d.mouseout(this.mouse),d.__isOver=!1)}this.mouseOut=!0,this.mouse.global.x=-1e4,this.mouse.global.y=-1e4},b.InteractionManager.prototype.onMouseUp=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a;for(var b=this.interactiveItems.length,c=!1,d=this.mouse.originalEvent,e=2===d.button||3===d.which,f=e?"rightup":"mouseup",g=e?"rightclick":"click",h=e?"rightupoutside":"mouseupoutside",i=e?"__isRightDown":"__isDown",j=0;b>j;j++){var k=this.interactiveItems[j];(k[g]||k[f]||k[h])&&(k.__hit=this.hitTest(k,this.mouse),k.__hit&&!c?(k[f]&&k[f](this.mouse),k[i]&&k[g]&&k[g](this.mouse),k.interactiveChildren||(c=!0)):k[i]&&k[h]&&k[h](this.mouse),k[i]=!1)}},b.InteractionManager.prototype.hitTest=function(a,c){var d=c.global;if(!a.worldVisible)return!1;a.worldTransform.applyInverse(d,this._tempPoint);var e,f=this._tempPoint.x,g=this._tempPoint.y;if(c.target=a,a.hitArea&&a.hitArea.contains)return a.hitArea.contains(f,g);if(a instanceof b.Sprite){var h,i=a.texture.frame.width,j=a.texture.frame.height,k=-i*a.anchor.x;if(f>k&&k+i>f&&(h=-j*a.anchor.y,g>h&&h+j>g))return!0}else if(a instanceof b.Graphics){var l=a.graphicsData;for(e=0;ee;e++){var o=a.children[e],p=this.hitTest(o,c);if(p)return c.target=a,!0}return!1},b.InteractionManager.prototype.onTouchMove=function(a){this.dirty&&this.rebuildInteractiveGraph();var b,c=this.interactionDOMElement.getBoundingClientRect(),d=a.changedTouches,e=0;for(e=0;ei;i++){var j=this.interactiveItems[i];if((j.touchstart||j.tap)&&(j.__hit=this.hitTest(j,g),j.__hit&&(j.touchstart&&j.touchstart(g),j.__isDown=!0,j.__touchData=j.__touchData||{},j.__touchData[f.identifier]=g,!j.interactiveChildren)))break}}},b.InteractionManager.prototype.onTouchEnd=function(a){this.dirty&&this.rebuildInteractiveGraph();for(var b=this.interactionDOMElement.getBoundingClientRect(),c=a.changedTouches,d=0;di;i++){var j=this.interactiveItems[i];j.__touchData&&j.__touchData[e.identifier]&&(j.__hit=this.hitTest(j,j.__touchData[e.identifier]),f.originalEvent=a,(j.touchend||j.tap)&&(j.__hit&&!g?(j.touchend&&j.touchend(f),j.__isDown&&j.tap&&j.tap(f),j.interactiveChildren||(g=!0)):j.__isDown&&j.touchendoutside&&j.touchendoutside(f),j.__isDown=!1),j.__touchData[e.identifier]=null)}this.pool.push(f),this.touches[e.identifier]=null}},b.InteractionManager.prototype.onTouchCancel=function(a){this.dirty&&this.rebuildInteractiveGraph();for(var b=this.interactionDOMElement.getBoundingClientRect(),c=a.changedTouches,d=0;di;i++){var j=this.interactiveItems[i];j.__touchData&&j.__touchData[e.identifier]&&(j.__hit=this.hitTest(j,j.__touchData[e.identifier]),f.originalEvent=a,j.touchcancel&&!g&&(j.touchcancel(f),j.interactiveChildren||(g=!0)),j.__isDown=!1,j.__touchData[e.identifier]=null)}this.pool.push(f),this.touches[e.identifier]=null}},b.Stage=function(a){b.DisplayObjectContainer.call(this),this.worldTransform=new b.Matrix,this.interactive=!0,this.interactionManager=new b.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new b.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(a)},b.Stage.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Stage.prototype.constructor=b.Stage,b.Stage.prototype.setInteractionDelegate=function(a){this.interactionManager.setTargetDomElement(a)},b.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var a=0,b=this.children.length;b>a;a++)this.children[a].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},b.Stage.prototype.setBackgroundColor=function(a){this.backgroundColor=a||0,this.backgroundColorSplit=b.hex2rgb(this.backgroundColor);var c=this.backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c,this.backgroundColorString="#"+c},b.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},function(a){for(var b=0,c=["ms","moz","webkit","o"],d=0;d>16&255)/255,(a>>8&255)/255,(255&a)/255]},b.rgb2hex=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){return function(a){function b(){for(var d=arguments.length,f=new Array(d);d--;)f[d]=arguments[d];return f=e.concat(f),c.apply(this instanceof b?this:a,f)}var c=this,d=arguments.length-1,e=[];if(d>0)for(e.length=d;d--;)e[d]=arguments[d+1];if("function"!=typeof c)throw new TypeError;return b.prototype=function f(a){return a&&(f.prototype=a),this instanceof f?void 0:new f}(c.prototype),b}}()),b.AjaxRequest=function(){var a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var b=0;b0&&0===(a&a-1))return a;for(var b=1;a>b;)b<<=1;return b},b.isPowerOfTwo=function(a,b){return a>0&&0===(a&a-1)&&b>0&&0===(b&b-1)},b.EventTarget={call:function(a){a&&(a=a.prototype||a,b.EventTarget.mixin(a))},mixin:function(a){a.listeners=function(a){return this._listeners=this._listeners||{},this._listeners[a]?this._listeners[a].slice():[]},a.emit=a.dispatchEvent=function(a,c){if(this._listeners=this._listeners||{},"object"==typeof a&&(c=a,a=a.type),c&&c.__isEventObject===!0||(c=new b.Event(this,a,c)),this._listeners&&this._listeners[a]){var d,e=this._listeners[a].slice(0),f=e.length,g=e[0];for(d=0;f>d;g=e[++d])if(g.call(this,c),c.stoppedImmediate)return this;if(c.stopped)return this}return this.parent&&this.parent.emit&&this.parent.emit.call(this.parent,a,c),this},a.on=a.addEventListener=function(a,b){return this._listeners=this._listeners||{},(this._listeners[a]=this._listeners[a]||[]).push(b),this},a.once=function(a,b){function c(){b.apply(d.off(a,c),arguments)}this._listeners=this._listeners||{};var d=this;return c._originalHandler=b,this.on(a,c)},a.off=a.removeEventListener=function(a,b){if(this._listeners=this._listeners||{},!this._listeners[a])return this;for(var c=this._listeners[a],d=b?c.length:0;d-->0;)(c[d]===b||c[d]._originalHandler===b)&&c.splice(d,1);return 0===c.length&&delete this._listeners[a],this},a.removeAllListeners=function(a){return this._listeners=this._listeners||{},this._listeners[a]?(delete this._listeners[a],this):this}}},b.Event=function(a,b,c){this.__isEventObject=!0,this.stopped=!1,this.stoppedImmediate=!1,this.target=a,this.type=b,this.data=c,this.content=c,this.timeStamp=Date.now()},b.Event.prototype.stopPropagation=function(){this.stopped=!0},b.Event.prototype.stopImmediatePropagation=function(){this.stoppedImmediate=!0},b.autoDetectRenderer=function(a,c,d){a||(a=800),c||(c=600);var e=function(){try{var a=document.createElement("canvas");return!!window.WebGLRenderingContext&&(a.getContext("webgl")||a.getContext("experimental-webgl"))}catch(b){return!1}}();return e?new b.WebGLRenderer(a,c,d):new b.CanvasRenderer(a,c,d)},b.autoDetectRecommendedRenderer=function(a,c,d){a||(a=800),c||(c=600);var e=function(){try{var a=document.createElement("canvas");return!!window.WebGLRenderingContext&&(a.getContext("webgl")||a.getContext("experimental-webgl"))}catch(b){return!1}}(),f=/Android/i.test(navigator.userAgent);return e&&!f?new b.WebGLRenderer(a,c,d):new b.CanvasRenderer(a,c,d)},b.PolyK={},b.PolyK.Triangulate=function(a){var c=!0,d=a.length>>1;if(3>d)return[];for(var e=[],f=[],g=0;d>g;g++)f.push(g);g=0;for(var h=d;h>3;){var i=f[(g+0)%h],j=f[(g+1)%h],k=f[(g+2)%h],l=a[2*i],m=a[2*i+1],n=a[2*j],o=a[2*j+1],p=a[2*k],q=a[2*k+1],r=!1;if(b.PolyK._convex(l,m,n,o,p,q,c)){r=!0;for(var s=0;h>s;s++){var t=f[s];if(t!==i&&t!==j&&t!==k&&b.PolyK._PointInTriangle(a[2*t],a[2*t+1],l,m,n,o,p,q)){r=!1;break}}}if(r)e.push(i,j,k),f.splice((g+1)%h,1),h--,g=0;else if(g++>3*h){if(!c)return null;for(e=[],f=[],g=0;d>g;g++)f.push(g);g=0,h=d,c=!1}}return e.push(f[0],f[1],f[2]),e},b.PolyK._PointInTriangle=function(a,b,c,d,e,f,g,h){var i=g-c,j=h-d,k=e-c,l=f-d,m=a-c,n=b-d,o=i*i+j*j,p=i*k+j*l,q=i*m+j*n,r=k*k+l*l,s=k*m+l*n,t=1/(o*r-p*p),u=(r*q-p*s)*t,v=(o*s-p*q)*t;return u>=0&&v>=0&&1>u+v},b.PolyK._convex=function(a,b,c,d,e,f,g){return(b-d)*(e-c)+(c-a)*(f-d)>=0===g},b.initDefaultShaders=function(){},b.CompileVertexShader=function(a,c){return b._CompileShader(a,c,a.VERTEX_SHADER)},b.CompileFragmentShader=function(a,c){return b._CompileShader(a,c,a.FRAGMENT_SHADER)},b._CompileShader=function(a,b,c){var d=b.join("\n"),e=a.createShader(c);return a.shaderSource(e,d),a.compileShader(e),a.getShaderParameter(e,a.COMPILE_STATUS)?e:(window.console.log(a.getShaderInfoLog(e)),null)},b.compileProgram=function(a,c,d){var e=b.CompileFragmentShader(a,d),f=b.CompileVertexShader(a,c),g=a.createProgram();return a.attachShader(g,f),a.attachShader(g,e),a.linkProgram(g),a.getProgramParameter(g,a.LINK_STATUS)||window.console.log("Could not initialise shaders"),g},b.PixiShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.firstRun=!0,this.dirty=!0,this.attributes=[],this.init()},b.PixiShader.prototype.constructor=b.PixiShader,b.PixiShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc||b.PixiShader.defaultVertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.dimensions=a.getUniformLocation(c,"dimensions"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=a.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var d in this.uniforms)this.uniforms[d].uniformLocation=a.getUniformLocation(c,d);this.initUniforms(),this.program=c},b.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var a,b=this.gl;for(var c in this.uniforms){a=this.uniforms[c];var d=a.type;"sampler2D"===d?(a._init=!1,null!==a.value&&this.initSampler2D(a)):"mat2"===d||"mat3"===d||"mat4"===d?(a.glMatrix=!0,a.glValueLength=1,"mat2"===d?a.glFunc=b.uniformMatrix2fv:"mat3"===d?a.glFunc=b.uniformMatrix3fv:"mat4"===d&&(a.glFunc=b.uniformMatrix4fv)):(a.glFunc=b["uniform"+d],a.glValueLength="2f"===d||"2i"===d?2:"3f"===d||"3i"===d?3:"4f"===d||"4i"===d?4:1)}},b.PixiShader.prototype.initSampler2D=function(a){if(a.value&&a.value.baseTexture&&a.value.baseTexture.hasLoaded){var b=this.gl;if(b.activeTexture(b["TEXTURE"+this.textureCount]),b.bindTexture(b.TEXTURE_2D,a.value.baseTexture._glTextures[b.id]),a.textureData){var c=a.textureData,d=c.magFilter?c.magFilter:b.LINEAR,e=c.minFilter?c.minFilter:b.LINEAR,f=c.wrapS?c.wrapS:b.CLAMP_TO_EDGE,g=c.wrapT?c.wrapT:b.CLAMP_TO_EDGE,h=c.luminance?b.LUMINANCE:b.RGBA;if(c.repeat&&(f=b.REPEAT,g=b.REPEAT),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!!c.flipY),c.width){var i=c.width?c.width:512,j=c.height?c.height:2,k=c.border?c.border:0;b.texImage2D(b.TEXTURE_2D,0,h,i,j,k,h,b.UNSIGNED_BYTE,null)}else b.texImage2D(b.TEXTURE_2D,0,h,b.RGBA,b.UNSIGNED_BYTE,a.value.baseTexture.source);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,d),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,f),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,g)}b.uniform1i(a.uniformLocation,this.textureCount),a._init=!0,this.textureCount++}},b.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var a,c=this.gl;for(var d in this.uniforms)a=this.uniforms[d],1===a.glValueLength?a.glMatrix===!0?a.glFunc.call(c,a.uniformLocation,a.transpose,a.value):a.glFunc.call(c,a.uniformLocation,a.value):2===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y):3===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y,a.value.z):4===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y,a.value.z,a.value.w):"sampler2D"===a.type&&(a._init?(c.activeTexture(c["TEXTURE"+this.textureCount]),a.value.baseTexture._dirty[c.id]?b.instances[c.id].updateTexture(a.value.baseTexture):c.bindTexture(c.TEXTURE_2D,a.value.baseTexture._glTextures[c.id]),c.uniform1i(a.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(a))},b.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"],b.PixiFastShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init()},b.PixiFastShader.prototype.constructor=b.PixiFastShader,b.PixiFastShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.dimensions=a.getUniformLocation(c,"dimensions"),this.uMatrix=a.getUniformLocation(c,"uMatrix"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aPositionCoord=a.getAttribLocation(c,"aPositionCoord"),this.aScale=a.getAttribLocation(c,"aScale"),this.aRotation=a.getAttribLocation(c,"aRotation"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=a.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=c},b.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.StripShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"],this.init()},b.StripShader.prototype.constructor=b.StripShader,b.StripShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.colorAttribute=a.getAttribLocation(c,"aColor"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.attributes=[this.aVertexPosition,this.aTextureCoord],this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.StripShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},b.PrimitiveShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform float flipY;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},b.PrimitiveShader.prototype.constructor=b.PrimitiveShader,b.PrimitiveShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.tintColor=a.getUniformLocation(c,"tint"),this.flipY=a.getUniformLocation(c,"flipY"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.colorAttribute=a.getAttribLocation(c,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.ComplexPrimitiveShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform vec3 tint;","uniform float alpha;","uniform vec3 color;","uniform float flipY;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = vec4(color * alpha * tint, alpha);","}"],this.init()},b.ComplexPrimitiveShader.prototype.constructor=b.ComplexPrimitiveShader,b.ComplexPrimitiveShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.tintColor=a.getUniformLocation(c,"tint"),this.color=a.getUniformLocation(c,"color"),this.flipY=a.getUniformLocation(c,"flipY"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.ComplexPrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},b.WebGLGraphics=function(){},b.WebGLGraphics.renderGraphics=function(a,c){var d,e=c.gl,f=c.projection,g=c.offset,h=c.shaderManager.primitiveShader;a.dirty&&b.WebGLGraphics.updateGraphics(a,e);for(var i=a._webGL[e.id],j=0;j=6)if(h.points.length<12){g=b.WebGLGraphics.switchMode(d,0);var i=b.WebGLGraphics.buildPoly(h,g);i||(g=b.WebGLGraphics.switchMode(d,1),b.WebGLGraphics.buildComplexPoly(h,g))}else g=b.WebGLGraphics.switchMode(d,1),b.WebGLGraphics.buildComplexPoly(h,g);h.lineWidth>0&&(g=b.WebGLGraphics.switchMode(d,0),b.WebGLGraphics.buildLine(h,g))}else g=b.WebGLGraphics.switchMode(d,0),h.type===b.Graphics.RECT?b.WebGLGraphics.buildRectangle(h,g):h.type===b.Graphics.CIRC||h.type===b.Graphics.ELIP?b.WebGLGraphics.buildCircle(h,g):h.type===b.Graphics.RREC&&b.WebGLGraphics.buildRoundedRectangle(h,g);d.lastIndex++}for(e=0;e=q;q++)p=q/n,h=g(a,c,p),i=g(b,d,p),j=g(c,e,p),k=g(d,f,p),l=g(h,j,p),m=g(i,k,p),o.push(l,m);return o},b.WebGLGraphics.buildCircle=function(a,c){var d,e,f=a.shape,g=f.x,h=f.y;a.type===b.Graphics.CIRC?(d=f.radius,e=f.radius):(d=f.width,e=f.height);var i=40,j=2*Math.PI/i,k=0;if(a.fill){var l=b.hex2rgb(a.fillColor),m=a.fillAlpha,n=l[0]*m,o=l[1]*m,p=l[2]*m,q=c.points,r=c.indices,s=q.length/6;for(r.push(s),k=0;i+1>k;k++)q.push(g,h,n,o,p,m),q.push(g+Math.sin(j*k)*d,h+Math.cos(j*k)*e,n,o,p,m),r.push(s++,s++);r.push(s-1) -}if(a.lineWidth){var t=a.points;for(a.points=[],k=0;i+1>k;k++)a.points.push(g+Math.sin(j*k)*d,h+Math.cos(j*k)*e);b.WebGLGraphics.buildLine(a,c),a.points=t}},b.WebGLGraphics.buildLine=function(a,c){var d=0,e=a.points;if(0!==e.length){if(a.lineWidth%2)for(d=0;dd;d++)l=e[2*(d-1)],m=e[2*(d-1)+1],n=e[2*d],o=e[2*d+1],p=e[2*(d+1)],q=e[2*(d+1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,t=-(o-q),u=n-p,F=Math.sqrt(t*t+u*u),t/=F,u/=F,t*=L,u*=L,x=-s+m-(-s+o),y=-r+n-(-r+l),z=(-r+l)*(-s+o)-(-r+n)*(-s+m),A=-u+q-(-u+o),B=-t+n-(-t+p),C=(-t+p)*(-u+o)-(-t+n)*(-u+q),D=x*B-A*y,Math.abs(D)<.1?(D+=10.1,G.push(n-r,o-s,O,P,Q,N),G.push(n+r,o+s,O,P,Q,N)):(j=(y*C-B*z)/D,k=(A*z-x*C)/D,E=(j-n)*(j-n)+(k-o)+(k-o),E>19600?(v=r-t,w=s-u,F=Math.sqrt(v*v+w*w),v/=F,w/=F,v*=L,w*=L,G.push(n-v,o-w),G.push(O,P,Q,N),G.push(n+v,o+w),G.push(O,P,Q,N),G.push(n-v,o-w),G.push(O,P,Q,N),J++):(G.push(j,k),G.push(O,P,Q,N),G.push(n-(j-n),o-(k-o)),G.push(O,P,Q,N)));for(l=e[2*(I-2)],m=e[2*(I-2)+1],n=e[2*(I-1)],o=e[2*(I-1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,G.push(n-r,o-s),G.push(O,P,Q,N),G.push(n+r,o+s),G.push(O,P,Q,N),H.push(K),d=0;J>d;d++)H.push(K++);H.push(K-1)}},b.WebGLGraphics.buildComplexPoly=function(a,c){var d=a.points.slice();if(!(d.length<6)){var e=c.indices;c.points=d,c.alpha=a.fillAlpha,c.color=b.hex2rgb(a.fillColor);for(var f,g,h=1/0,i=-1/0,j=1/0,k=-1/0,l=0;lf?f:h,i=f>i?f:i,j=j>g?g:j,k=g>k?g:k;d.push(h,j,i,j,i,k,h,k);var m=d.length/2;for(l=0;m>l;l++)e.push(l)}},b.WebGLGraphics.buildPoly=function(a,c){var d=a.points;if(!(d.length<6)){var e=c.points,f=c.indices,g=d.length/2,h=b.hex2rgb(a.fillColor),i=a.fillAlpha,j=h[0]*i,k=h[1]*i,l=h[2]*i,m=b.PolyK.Triangulate(d);if(!m)return!1;var n=e.length/6,o=0;for(o=0;oo;o++)e.push(d[2*o],d[2*o+1],j,k,l,i);return!0}},b.WebGLGraphics.graphicsDataPool=[],b.WebGLGraphicsData=function(a){this.gl=a,this.color=[0,0,0],this.points=[],this.indices=[],this.buffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),this.mode=1,this.alpha=1,this.dirty=!0},b.WebGLGraphicsData.prototype.reset=function(){this.points=[],this.indices=[]},b.WebGLGraphicsData.prototype.upload=function(){var a=this.gl;this.glPoints=new b.Float32Array(this.points),a.bindBuffer(a.ARRAY_BUFFER,this.buffer),a.bufferData(a.ARRAY_BUFFER,this.glPoints,a.STATIC_DRAW),this.glIndicies=new b.Uint16Array(this.indices),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.glIndicies,a.STATIC_DRAW),this.dirty=!1},b.glContexts=[],b.instances=[],b.WebGLRenderer=function(a,c,d){if(d)for(var e in b.defaultRenderOptions)"undefined"==typeof d[e]&&(d[e]=b.defaultRenderOptions[e]);else d=b.defaultRenderOptions;b.defaultRenderer||(b.sayHello("webGL"),b.defaultRenderer=this),this.type=b.WEBGL_RENDERER,this.resolution=d.resolution,this.transparent=d.transparent,this.autoResize=d.autoResize||!1,this.preserveDrawingBuffer=d.preserveDrawingBuffer,this.clearBeforeRender=d.clearBeforeRender,this.width=a||800,this.height=c||600,this.view=d.view||document.createElement("canvas"),this.contextLostBound=this.handleContextLost.bind(this),this.contextRestoredBound=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLostBound,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredBound,!1),this._contextOptions={alpha:this.transparent,antialias:d.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:d.preserveDrawingBuffer},this.projection=new b.Point,this.offset=new b.Point(0,0),this.shaderManager=new b.WebGLShaderManager,this.spriteBatch=new b.WebGLSpriteBatch,this.maskManager=new b.WebGLMaskManager,this.filterManager=new b.WebGLFilterManager,this.stencilManager=new b.WebGLStencilManager,this.blendModeManager=new b.WebGLBlendModeManager,this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.blendModeManager=this.blendModeManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.stencilManager=this.stencilManager,this.renderSession.renderer=this,this.renderSession.resolution=this.resolution,this.initContext(),this.mapBlendModes()},b.WebGLRenderer.prototype.constructor=b.WebGLRenderer,b.WebGLRenderer.prototype.initContext=function(){var a=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=a,!a)throw new Error("This browser does not support webGL. Try using the canvas renderer");this.glContextId=a.id=b.WebGLRenderer.glContextId++,b.glContexts[this.glContextId]=a,b.instances[this.glContextId]=this,a.disable(a.DEPTH_TEST),a.disable(a.CULL_FACE),a.enable(a.BLEND),this.shaderManager.setContext(a),this.spriteBatch.setContext(a),this.maskManager.setContext(a),this.filterManager.setContext(a),this.blendModeManager.setContext(a),this.stencilManager.setContext(a),this.renderSession.gl=this.gl,this.resize(this.width,this.height)},b.WebGLRenderer.prototype.render=function(a){if(!this.contextLost){this.__stage!==a&&(a.interactive&&a.interactionManager.removeEvents(),this.__stage=a),a.updateTransform();var b=this.gl;a._interactive?a._interactiveEventsAdded||(a._interactiveEventsAdded=!0,a.interactionManager.setTarget(this)):a._interactiveEventsAdded&&(a._interactiveEventsAdded=!1,a.interactionManager.setTarget(this)),b.viewport(0,0,this.width,this.height),b.bindFramebuffer(b.FRAMEBUFFER,null),this.clearBeforeRender&&(this.transparent?b.clearColor(0,0,0,0):b.clearColor(a.backgroundColorSplit[0],a.backgroundColorSplit[1],a.backgroundColorSplit[2],1),b.clear(b.COLOR_BUFFER_BIT)),this.renderDisplayObject(a,this.projection)}},b.WebGLRenderer.prototype.renderDisplayObject=function(a,c,d){this.renderSession.blendModeManager.setBlendMode(b.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=d?-1:1,this.renderSession.projection=c,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,d),a._renderWebGL(this.renderSession),this.spriteBatch.end()},b.WebGLRenderer.prototype.resize=function(a,b){this.width=a*this.resolution,this.height=b*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px"),this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2/this.resolution,this.projection.y=-this.height/2/this.resolution},b.WebGLRenderer.prototype.updateTexture=function(a){if(a.hasLoaded){var c=this.gl;return a._glTextures[c.id]||(a._glTextures[c.id]=c.createTexture()),c.bindTexture(c.TEXTURE_2D,a._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultipliedAlpha),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a.mipmap&&b.isPowerOfTwo(a.width,a.height)?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR_MIPMAP_LINEAR:c.NEAREST_MIPMAP_NEAREST),c.generateMipmap(c.TEXTURE_2D)):c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),a._dirty[c.id]=!1,a._glTextures[c.id]}},b.WebGLRenderer.prototype.handleContextLost=function(a){a.preventDefault(),this.contextLost=!0},b.WebGLRenderer.prototype.handleContextRestored=function(){this.initContext();for(var a in b.TextureCache){var c=b.TextureCache[a].baseTexture;c._glTextures=[]}this.contextLost=!1},b.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLostBound),this.view.removeEventListener("webglcontextrestored",this.contextRestoredBound),b.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},b.WebGLRenderer.prototype.mapBlendModes=function(){var a=this.gl;b.blendModesWebGL||(b.blendModesWebGL=[],b.blendModesWebGL[b.blendModes.NORMAL]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.ADD]=[a.SRC_ALPHA,a.DST_ALPHA],b.blendModesWebGL[b.blendModes.MULTIPLY]=[a.DST_COLOR,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SCREEN]=[a.SRC_ALPHA,a.ONE],b.blendModesWebGL[b.blendModes.OVERLAY]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.DARKEN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.LIGHTEN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR_DODGE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR_BURN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.HARD_LIGHT]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SOFT_LIGHT]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.DIFFERENCE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.EXCLUSION]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.HUE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SATURATION]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.LUMINOSITY]=[a.ONE,a.ONE_MINUS_SRC_ALPHA])},b.WebGLRenderer.glContextId=0,b.WebGLBlendModeManager=function(){this.currentBlendMode=99999},b.WebGLBlendModeManager.prototype.constructor=b.WebGLBlendModeManager,b.WebGLBlendModeManager.prototype.setContext=function(a){this.gl=a},b.WebGLBlendModeManager.prototype.setBlendMode=function(a){if(this.currentBlendMode===a)return!1;this.currentBlendMode=a;var c=b.blendModesWebGL[this.currentBlendMode];return this.gl.blendFunc(c[0],c[1]),!0},b.WebGLBlendModeManager.prototype.destroy=function(){this.gl=null},b.WebGLMaskManager=function(){},b.WebGLMaskManager.prototype.constructor=b.WebGLMaskManager,b.WebGLMaskManager.prototype.setContext=function(a){this.gl=a},b.WebGLMaskManager.prototype.pushMask=function(a,c){var d=c.gl;a.dirty&&b.WebGLGraphics.updateGraphics(a,d),a._webGL[d.id].data.length&&c.stencilManager.pushStencil(a,a._webGL[d.id].data[0],c)},b.WebGLMaskManager.prototype.popMask=function(a,b){var c=this.gl;b.stencilManager.popStencil(a,a._webGL[c.id].data[0],b)},b.WebGLMaskManager.prototype.destroy=function(){this.gl=null},b.WebGLStencilManager=function(){this.stencilStack=[],this.reverse=!0,this.count=0},b.WebGLStencilManager.prototype.setContext=function(a){this.gl=a},b.WebGLStencilManager.prototype.pushStencil=function(a,b,c){var d=this.gl;this.bindGraphics(a,b,c),0===this.stencilStack.length&&(d.enable(d.STENCIL_TEST),d.clear(d.STENCIL_BUFFER_BIT),this.reverse=!0,this.count=0),this.stencilStack.push(b);var e=this.count;d.colorMask(!1,!1,!1,!1),d.stencilFunc(d.ALWAYS,0,255),d.stencilOp(d.KEEP,d.KEEP,d.INVERT),1===b.mode?(d.drawElements(d.TRIANGLE_FAN,b.indices.length-4,d.UNSIGNED_SHORT,0),this.reverse?(d.stencilFunc(d.EQUAL,255-e,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)):(d.stencilFunc(d.EQUAL,e,255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)),d.drawElements(d.TRIANGLE_FAN,4,d.UNSIGNED_SHORT,2*(b.indices.length-4)),this.reverse?d.stencilFunc(d.EQUAL,255-(e+1),255):d.stencilFunc(d.EQUAL,e+1,255),this.reverse=!this.reverse):(this.reverse?(d.stencilFunc(d.EQUAL,e,255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)):(d.stencilFunc(d.EQUAL,255-e,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)),d.drawElements(d.TRIANGLE_STRIP,b.indices.length,d.UNSIGNED_SHORT,0),this.reverse?d.stencilFunc(d.EQUAL,e+1,255):d.stencilFunc(d.EQUAL,255-(e+1),255)),d.colorMask(!0,!0,!0,!0),d.stencilOp(d.KEEP,d.KEEP,d.KEEP),this.count++},b.WebGLStencilManager.prototype.bindGraphics=function(a,c,d){this._currentGraphics=a;var e,f=this.gl,g=d.projection,h=d.offset;1===c.mode?(e=d.shaderManager.complexPrimitiveShader,d.shaderManager.setShader(e),f.uniform1f(e.flipY,d.flipY),f.uniformMatrix3fv(e.translationMatrix,!1,a.worldTransform.toArray(!0)),f.uniform2f(e.projectionVector,g.x,-g.y),f.uniform2f(e.offsetVector,-h.x,-h.y),f.uniform3fv(e.tintColor,b.hex2rgb(a.tint)),f.uniform3fv(e.color,c.color),f.uniform1f(e.alpha,a.worldAlpha*c.alpha),f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(e.aVertexPosition,2,f.FLOAT,!1,8,0),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,c.indexBuffer)):(e=d.shaderManager.primitiveShader,d.shaderManager.setShader(e),f.uniformMatrix3fv(e.translationMatrix,!1,a.worldTransform.toArray(!0)),f.uniform1f(e.flipY,d.flipY),f.uniform2f(e.projectionVector,g.x,-g.y),f.uniform2f(e.offsetVector,-h.x,-h.y),f.uniform3fv(e.tintColor,b.hex2rgb(a.tint)),f.uniform1f(e.alpha,a.worldAlpha),f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(e.aVertexPosition,2,f.FLOAT,!1,24,0),f.vertexAttribPointer(e.colorAttribute,4,f.FLOAT,!1,24,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,c.indexBuffer))},b.WebGLStencilManager.prototype.popStencil=function(a,b,c){var d=this.gl;if(this.stencilStack.pop(),this.count--,0===this.stencilStack.length)d.disable(d.STENCIL_TEST);else{var e=this.count;this.bindGraphics(a,b,c),d.colorMask(!1,!1,!1,!1),1===b.mode?(this.reverse=!this.reverse,this.reverse?(d.stencilFunc(d.EQUAL,255-(e+1),255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)):(d.stencilFunc(d.EQUAL,e+1,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)),d.drawElements(d.TRIANGLE_FAN,4,d.UNSIGNED_SHORT,2*(b.indices.length-4)),d.stencilFunc(d.ALWAYS,0,255),d.stencilOp(d.KEEP,d.KEEP,d.INVERT),d.drawElements(d.TRIANGLE_FAN,b.indices.length-4,d.UNSIGNED_SHORT,0),this.reverse?d.stencilFunc(d.EQUAL,e,255):d.stencilFunc(d.EQUAL,255-e,255)):(this.reverse?(d.stencilFunc(d.EQUAL,e+1,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)):(d.stencilFunc(d.EQUAL,255-(e+1),255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)),d.drawElements(d.TRIANGLE_STRIP,b.indices.length,d.UNSIGNED_SHORT,0),this.reverse?d.stencilFunc(d.EQUAL,e,255):d.stencilFunc(d.EQUAL,255-e,255)),d.colorMask(!0,!0,!0,!0),d.stencilOp(d.KEEP,d.KEEP,d.KEEP)}},b.WebGLStencilManager.prototype.destroy=function(){this.stencilStack=null,this.gl=null},b.WebGLShaderManager=function(){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var a=0;ad;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.dirty=!0,this.textures=[],this.blendModes=[],this.shaders=[],this.sprites=[],this.defaultShader=new b.AbstractFilter(["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"])},b.WebGLSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999;var c=new b.PixiShader(a);c.fragmentSrc=this.defaultShader.fragmentSrc,c.uniforms={},c.init(),this.defaultShader.shaders[a.id]=c},b.WebGLSpriteBatch.prototype.begin=function(a){this.renderSession=a,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},b.WebGLSpriteBatch.prototype.end=function(){this.flush()},b.WebGLSpriteBatch.prototype.render=function(a){var b=a.texture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=b.baseTexture);var c=b._uvs;if(c){var d,e,f,g,h=a.anchor.x,i=a.anchor.y;if(b.trim){var j=b.trim;e=j.x-h*j.width,d=e+b.crop.width,g=j.y-i*j.height,f=g+b.crop.height}else d=b.frame.width*(1-h),e=b.frame.width*-h,f=b.frame.height*(1-i),g=b.frame.height*-i;var k=4*this.currentBatchSize*this.vertSize,l=b.baseTexture.resolution,m=a.worldTransform,n=m.a/l,o=m.b/l,p=m.c/l,q=m.d/l,r=m.tx,s=m.ty,t=this.colors,u=this.positions;this.renderSession.roundPixels?(u[k]=n*e+p*g+r|0,u[k+1]=q*g+o*e+s|0,u[k+5]=n*d+p*g+r|0,u[k+6]=q*g+o*d+s|0,u[k+10]=n*d+p*f+r|0,u[k+11]=q*f+o*d+s|0,u[k+15]=n*e+p*f+r|0,u[k+16]=q*f+o*e+s|0):(u[k]=n*e+p*g+r,u[k+1]=q*g+o*e+s,u[k+5]=n*d+p*g+r,u[k+6]=q*g+o*d+s,u[k+10]=n*d+p*f+r,u[k+11]=q*f+o*d+s,u[k+15]=n*e+p*f+r,u[k+16]=q*f+o*e+s),u[k+2]=c.x0,u[k+3]=c.y0,u[k+7]=c.x1,u[k+8]=c.y1,u[k+12]=c.x2,u[k+13]=c.y2,u[k+17]=c.x3,u[k+18]=c.y3;var v=a.tint;t[k+4]=t[k+9]=t[k+14]=t[k+19]=(v>>16)+(65280&v)+((255&v)<<16)+(255*a.worldAlpha<<24),this.sprites[this.currentBatchSize++]=a}},b.WebGLSpriteBatch.prototype.renderTilingSprite=function(a){var c=a.tilingTexture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=c.baseTexture),a._uvs||(a._uvs=new b.TextureUvs);var d=a._uvs;a.tilePosition.x%=c.baseTexture.width*a.tileScaleOffset.x,a.tilePosition.y%=c.baseTexture.height*a.tileScaleOffset.y;var e=a.tilePosition.x/(c.baseTexture.width*a.tileScaleOffset.x),f=a.tilePosition.y/(c.baseTexture.height*a.tileScaleOffset.y),g=a.width/c.baseTexture.width/(a.tileScale.x*a.tileScaleOffset.x),h=a.height/c.baseTexture.height/(a.tileScale.y*a.tileScaleOffset.y);d.x0=0-e,d.y0=0-f,d.x1=1*g-e,d.y1=0-f,d.x2=1*g-e,d.y2=1*h-f,d.x3=0-e,d.y3=1*h-f;var i=a.tint,j=(i>>16)+(65280&i)+((255&i)<<16)+(255*a.alpha<<24),k=this.positions,l=this.colors,m=a.width,n=a.height,o=a.anchor.x,p=a.anchor.y,q=m*(1-o),r=m*-o,s=n*(1-p),t=n*-p,u=4*this.currentBatchSize*this.vertSize,v=c.baseTexture.resolution,w=a.worldTransform,x=w.a/v,y=w.b/v,z=w.c/v,A=w.d/v,B=w.tx,C=w.ty;k[u++]=x*r+z*t+B,k[u++]=A*t+y*r+C,k[u++]=d.x0,k[u++]=d.y0,l[u++]=j,k[u++]=x*q+z*t+B,k[u++]=A*t+y*q+C,k[u++]=d.x1,k[u++]=d.y1,l[u++]=j,k[u++]=x*q+z*s+B,k[u++]=A*s+y*q+C,k[u++]=d.x2,k[u++]=d.y2,l[u++]=j,k[u++]=x*r+z*s+B,k[u++]=A*s+y*r+C,k[u++]=d.x3,k[u++]=d.y3,l[u++]=j,this.sprites[this.currentBatchSize++]=a},b.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var a,c=this.gl;if(this.dirty){this.dirty=!1,c.activeTexture(c.TEXTURE0),c.bindBuffer(c.ARRAY_BUFFER,this.vertexBuffer),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a=this.defaultShader.shaders[c.id];var d=4*this.vertSize;c.vertexAttribPointer(a.aVertexPosition,2,c.FLOAT,!1,d,0),c.vertexAttribPointer(a.aTextureCoord,2,c.FLOAT,!1,d,8),c.vertexAttribPointer(a.colorAttribute,4,c.UNSIGNED_BYTE,!0,d,16)}if(this.currentBatchSize>.5*this.size)c.bufferSubData(c.ARRAY_BUFFER,0,this.vertices);else{var e=this.positions.subarray(0,4*this.currentBatchSize*this.vertSize);c.bufferSubData(c.ARRAY_BUFFER,0,e)}for(var f,g,h,i,j=0,k=0,l=null,m=this.renderSession.blendModeManager.currentBlendMode,n=null,o=!1,p=!1,q=0,r=this.currentBatchSize;r>q;q++){if(i=this.sprites[q],f=i.texture.baseTexture,g=i.blendMode,h=i.shader||this.defaultShader,o=m!==g,p=n!==h,(l!==f||o||p)&&(this.renderBatch(l,j,k),k=q,j=0,l=f,o&&(m=g,this.renderSession.blendModeManager.setBlendMode(m)),p)){n=h,a=n.shaders[c.id],a||(a=new b.PixiShader(c),a.fragmentSrc=n.fragmentSrc,a.uniforms=n.uniforms,a.init(),n.shaders[c.id]=a),this.renderSession.shaderManager.setShader(a),a.dirty&&a.syncUniforms();var s=this.renderSession.projection;c.uniform2f(a.projectionVector,s.x,s.y);var t=this.renderSession.offset;c.uniform2f(a.offsetVector,t.x,t.y)}j++}this.renderBatch(l,j,k),this.currentBatchSize=0}},b.WebGLSpriteBatch.prototype.renderBatch=function(a,b,c){if(0!==b){var d=this.gl;a._dirty[d.id]?this.renderSession.renderer.updateTexture(a):d.bindTexture(d.TEXTURE_2D,a._glTextures[d.id]),d.drawElements(d.TRIANGLES,6*b,d.UNSIGNED_SHORT,6*c*2),this.renderSession.drawCount++}},b.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},b.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},b.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},b.WebGLFastSpriteBatch=function(a){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var c=4*this.size*this.vertSize,d=6*this.maxSize;this.vertices=new b.Float32Array(c),this.indices=new b.Uint16Array(d),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var e=0,f=0;d>e;e+=6,f+=4)this.indices[e+0]=f+0,this.indices[e+1]=f+1,this.indices[e+2]=f+2,this.indices[e+3]=f+0,this.indices[e+4]=f+2,this.indices[e+5]=f+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(a)},b.WebGLFastSpriteBatch.prototype.constructor=b.WebGLFastSpriteBatch,b.WebGLFastSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW)},b.WebGLFastSpriteBatch.prototype.begin=function(a,b){this.renderSession=b,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=a.worldTransform.toArray(!0),this.start()},b.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},b.WebGLFastSpriteBatch.prototype.render=function(a){var b=a.children,c=b[0];if(c.texture._uvs){this.currentBaseTexture=c.texture.baseTexture,c.blendMode!==this.renderSession.blendModeManager.currentBlendMode&&(this.flush(),this.renderSession.blendModeManager.setBlendMode(c.blendMode));for(var d=0,e=b.length;e>d;d++)this.renderSprite(b[d]);this.flush()}},b.WebGLFastSpriteBatch.prototype.renderSprite=function(a){if(a.visible&&(a.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=a.texture.baseTexture,a.texture._uvs))){var b,c,d,e,f,g,h,i,j=this.vertices;if(b=a.texture._uvs,c=a.texture.frame.width,d=a.texture.frame.height,a.texture.trim){var k=a.texture.trim;f=k.x-a.anchor.x*k.width,e=f+a.texture.crop.width,h=k.y-a.anchor.y*k.height,g=h+a.texture.crop.height}else e=a.texture.frame.width*(1-a.anchor.x),f=a.texture.frame.width*-a.anchor.x,g=a.texture.frame.height*(1-a.anchor.y),h=a.texture.frame.height*-a.anchor.y;i=4*this.currentBatchSize*this.vertSize,j[i++]=f,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x0,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x1,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x2,j[i++]=b.y2,j[i++]=a.alpha,j[i++]=f,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x3,j[i++]=b.y3,j[i++]=a.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},b.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var a=this.gl;if(this.currentBaseTexture._glTextures[a.id]||this.renderSession.renderer.updateTexture(this.currentBaseTexture,a),a.bindTexture(a.TEXTURE_2D,this.currentBaseTexture._glTextures[a.id]),this.currentBatchSize>.5*this.size)a.bufferSubData(a.ARRAY_BUFFER,0,this.vertices);else{var b=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);a.bufferSubData(a.ARRAY_BUFFER,0,b)}a.drawElements(a.TRIANGLES,6*this.currentBatchSize,a.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},b.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},b.WebGLFastSpriteBatch.prototype.start=function(){var a=this.gl;a.activeTexture(a.TEXTURE0),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var b=this.renderSession.projection;a.uniform2f(this.shader.projectionVector,b.x,b.y),a.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var c=4*this.vertSize;a.vertexAttribPointer(this.shader.aVertexPosition,2,a.FLOAT,!1,c,0),a.vertexAttribPointer(this.shader.aPositionCoord,2,a.FLOAT,!1,c,8),a.vertexAttribPointer(this.shader.aScale,2,a.FLOAT,!1,c,16),a.vertexAttribPointer(this.shader.aRotation,1,a.FLOAT,!1,c,24),a.vertexAttribPointer(this.shader.aTextureCoord,2,a.FLOAT,!1,c,28),a.vertexAttribPointer(this.shader.colorAttribute,1,a.FLOAT,!1,c,36)},b.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},b.WebGLFilterManager.prototype.constructor=b.WebGLFilterManager,b.WebGLFilterManager.prototype.setContext=function(a){this.gl=a,this.texturePool=[],this.initShaderBuffers()},b.WebGLFilterManager.prototype.begin=function(a,b){this.renderSession=a,this.defaultShader=a.shaderManager.defaultShader;var c=this.renderSession.projection;this.width=2*c.x,this.height=2*-c.y,this.buffer=b},b.WebGLFilterManager.prototype.pushFilter=function(a){var c=this.gl,d=this.renderSession.projection,e=this.renderSession.offset;a._filterArea=a.target.filterArea||a.target.getBounds(),this.filterStack.push(a);var f=a.filterPasses[0];this.offsetX+=a._filterArea.x,this.offsetY+=a._filterArea.y;var g=this.texturePool.pop();g?g.resize(this.width,this.height):g=new b.FilterTexture(this.gl,this.width,this.height),c.bindTexture(c.TEXTURE_2D,g.texture);var h=a._filterArea,i=f.padding;h.x-=i,h.y-=i,h.width+=2*i,h.height+=2*i,h.x<0&&(h.x=0),h.width>this.width&&(h.width=this.width),h.y<0&&(h.y=0),h.height>this.height&&(h.height=this.height),c.bindFramebuffer(c.FRAMEBUFFER,g.frameBuffer),c.viewport(0,0,h.width,h.height),d.x=h.width/2,d.y=-h.height/2,e.x=-h.x,e.y=-h.y,c.colorMask(!0,!0,!0,!0),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),a._glFilterTexture=g},b.WebGLFilterManager.prototype.popFilter=function(){var a=this.gl,c=this.filterStack.pop(),d=c._filterArea,e=c._glFilterTexture,f=this.renderSession.projection,g=this.renderSession.offset;if(c.filterPasses.length>1){a.viewport(0,0,d.width,d.height),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=d.height,this.vertexArray[2]=d.width,this.vertexArray[3]=d.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=d.width,this.vertexArray[7]=0,a.bufferSubData(a.ARRAY_BUFFER,0,this.vertexArray),a.bindBuffer(a.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=d.width/this.width,this.uvArray[5]=d.height/this.height,this.uvArray[6]=d.width/this.width,this.uvArray[7]=d.height/this.height,a.bufferSubData(a.ARRAY_BUFFER,0,this.uvArray);var h=e,i=this.texturePool.pop();i||(i=new b.FilterTexture(this.gl,this.width,this.height)),i.resize(this.width,this.height),a.bindFramebuffer(a.FRAMEBUFFER,i.frameBuffer),a.clear(a.COLOR_BUFFER_BIT),a.disable(a.BLEND);for(var j=0;jB?B:A,c.beginPath(),c.moveTo(w,x+A),c.lineTo(w,x+z-A),c.quadraticCurveTo(w,x+z,w+A,x+z),c.lineTo(w+y-A,x+z),c.quadraticCurveTo(w+y,x+z,w+y,x+z-A),c.lineTo(w+y,x+A),c.quadraticCurveTo(w+y,x,w+y-A,x),c.lineTo(w+A,x),c.quadraticCurveTo(w,x,w,x+A),c.closePath(),(f.fillColor||0===f.fillColor)&&(c.globalAlpha=f.fillAlpha*d,c.fillStyle="#"+("00000"+(0|h).toString(16)).substr(-6),c.fill()),f.lineWidth&&(c.globalAlpha=f.lineAlpha*d,c.strokeStyle="#"+("00000"+(0|i).toString(16)).substr(-6),c.stroke())}}},b.CanvasGraphics.renderGraphicsMask=function(a,c){var d=a.graphicsData.length;if(0!==d){d>1&&(d=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var e=0;1>e;e++){var f=a.graphicsData[e],g=f.shape;if(f.type===b.Graphics.POLY){c.beginPath();var h=g.points;c.moveTo(h[0],h[1]);for(var i=1;iA?A:z,c.beginPath(),c.moveTo(v,w+z),c.lineTo(v,w+y-z),c.quadraticCurveTo(v,w+y,v+z,w+y),c.lineTo(v+x-z,w+y),c.quadraticCurveTo(v+x,w+y,v+x,w+y-z),c.lineTo(v+x,w+z),c.quadraticCurveTo(v+x,w,v+x-z,w),c.lineTo(v+z,w),c.quadraticCurveTo(v,w,v,w+z),c.closePath()}}}},b.CanvasGraphics.updateGraphicsTint=function(a){if(16777215!==a.tint)for(var b=(a.tint>>16&255)/255,c=(a.tint>>8&255)/255,d=(255&a.tint)/255,e=0;e>16&255)/255*b*255<<16)+((g>>8&255)/255*c*255<<8)+(255&g)/255*d*255,f._lineTint=((h>>16&255)/255*b*255<<16)+((h>>8&255)/255*c*255<<8)+(255&h)/255*d*255}},b.Graphics=function(){b.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=b.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new b.Rectangle(0,0,1,1),this.dirty=!0,this.webGLDirty=!1,this.cachedSpriteDirty=!1},b.Graphics.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Graphics.prototype.constructor=b.Graphics,Object.defineProperty(b.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(a){this._cacheAsBitmap=a,this._cacheAsBitmap?this._generateCachedSprite():(this.destroyCachedSprite(),this.dirty=!0)}}),b.Graphics.prototype.lineStyle=function(a,c,d){if(this.lineWidth=a||0,this.lineColor=c||0,this.lineAlpha=arguments.length<3?1:d,this.currentPath){if(this.currentPath.shape.points.length)return this.drawShape(new b.Polygon(this.currentPath.shape.points.slice(-2))),this;this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha}return this},b.Graphics.prototype.moveTo=function(a,c){return this.drawShape(new b.Polygon([a,c])),this},b.Graphics.prototype.lineTo=function(a,b){return this.currentPath.shape.points.push(a,b),this.dirty=!0,this},b.Graphics.prototype.quadraticCurveTo=function(a,b,c,d){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var e,f,g=20,h=this.currentPath.shape.points;0===h.length&&this.moveTo(0,0);for(var i=h[h.length-2],j=h[h.length-1],k=0,l=1;g>=l;l++)k=l/g,e=i+(a-i)*k,f=j+(b-j)*k,h.push(e+(a+(c-a)*k-e)*k,f+(b+(d-b)*k-f)*k);return this.dirty=!0,this},b.Graphics.prototype.bezierCurveTo=function(a,b,c,d,e,f){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var g,h,i,j,k,l=20,m=this.currentPath.shape.points,n=m[m.length-2],o=m[m.length-1],p=0,q=1;l>=q;q++)p=q/l,g=1-p,h=g*g,i=h*g,j=p*p,k=j*p,m.push(i*n+3*h*p*a+3*g*j*c+k*e,i*o+3*h*p*b+3*g*j*d+k*f);return this.dirty=!0,this},b.Graphics.prototype.arcTo=function(a,b,c,d,e){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(a,b):this.moveTo(a,b);var f=this.currentPath.shape.points,g=f[f.length-2],h=f[f.length-1],i=h-b,j=g-a,k=d-b,l=c-a,m=Math.abs(i*l-j*k);if(1e-8>m||0===e)(f[f.length-2]!==a||f[f.length-1]!==b)&&f.push(a,b);else{var n=i*i+j*j,o=k*k+l*l,p=i*k+j*l,q=e*Math.sqrt(n)/m,r=e*Math.sqrt(o)/m,s=q*p/n,t=r*p/o,u=q*l+r*j,v=q*k+r*i,w=j*(r+s),x=i*(r+s),y=l*(q+t),z=k*(q+t),A=Math.atan2(x-v,w-u),B=Math.atan2(z-v,y-u);this.arc(u+a,v+b,e,A,B,j*k>l*i)}return this.dirty=!0,this},b.Graphics.prototype.arc=function(a,b,c,d,e,f){var g,h=a+Math.cos(d)*c,i=b+Math.sin(d)*c;if(this.currentPath?(g=this.currentPath.shape.points,0===g.length?g.push(h,i):(g[g.length-2]!==h||g[g.length-1]!==i)&&g.push(h,i)):(this.moveTo(h,i),g=this.currentPath.shape.points),d===e)return this;!f&&d>=e?e+=2*Math.PI:f&&e>=d&&(d+=2*Math.PI);var j=f?-1*(d-e):e-d,k=Math.abs(j)/(2*Math.PI)*40;if(0===j)return this;for(var l=j/(2*k),m=2*l,n=Math.cos(l),o=Math.sin(l),p=k-1,q=p%1/p,r=0;p>=r;r++){var s=r+q*r,t=l+d+m*s,u=Math.cos(t),v=-Math.sin(t);g.push((n*u+o*v)*c+a,(n*-v+o*u)*c+b)}return this.dirty=!0,this},b.Graphics.prototype.beginFill=function(a,b){return this.filling=!0,this.fillColor=a||0,this.fillAlpha=void 0===b?1:b,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},b.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},b.Graphics.prototype.drawRect=function(a,c,d,e){return this.drawShape(new b.Rectangle(a,c,d,e)),this},b.Graphics.prototype.drawRoundedRect=function(a,c,d,e,f){return this.drawShape(new b.RoundedRectangle(a,c,d,e,f)),this},b.Graphics.prototype.drawCircle=function(a,c,d){return this.drawShape(new b.Circle(a,c,d)),this},b.Graphics.prototype.drawEllipse=function(a,c,d,e){return this.drawShape(new b.Ellipse(a,c,d,e)),this},b.Graphics.prototype.drawPolygon=function(a){return a instanceof Array||(a=Array.prototype.slice.call(arguments)),this.drawShape(new b.Polygon(a)),this},b.Graphics.prototype.clear=function(){return this.lineWidth=0,this.filling=!1,this.dirty=!0,this.clearDirty=!0,this.graphicsData=[],this},b.Graphics.prototype.generateTexture=function(a,c){a=a||1;var d=this.getBounds(),e=new b.CanvasBuffer(d.width*a,d.height*a),f=b.Texture.fromCanvas(e.canvas,c);return f.baseTexture.resolution=a,e.context.scale(a,a),e.context.translate(-d.x,-d.y),b.CanvasGraphics.renderGraphics(this,e.context),f},b.Graphics.prototype._renderWebGL=function(a){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.worldAlpha=this.worldAlpha,void b.Sprite.prototype._renderWebGL.call(this._cachedSprite,a);if(a.spriteBatch.stop(),a.blendModeManager.setBlendMode(this.blendMode),this._mask&&a.maskManager.pushMask(this._mask,a),this._filters&&a.filterManager.pushFilter(this._filterBlock),this.blendMode!==a.spriteBatch.currentBlendMode){a.spriteBatch.currentBlendMode=this.blendMode;var c=b.blendModesWebGL[a.spriteBatch.currentBlendMode];a.spriteBatch.gl.blendFunc(c[0],c[1])}if(this.webGLDirty&&(this.dirty=!0,this.webGLDirty=!1),b.WebGLGraphics.renderGraphics(this,a),this.children.length){a.spriteBatch.start();for(var d=0,e=this.children.length;e>d;d++)this.children[d]._renderWebGL(a);a.spriteBatch.stop()}this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(this.mask,a),a.drawCount++,a.spriteBatch.start()}},b.Graphics.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.alpha=this.alpha,void b.Sprite.prototype._renderCanvas.call(this._cachedSprite,a);var c=a.context,d=this.worldTransform;this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,c.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]),this._mask&&a.maskManager.pushMask(this._mask,a);var e=a.resolution;c.setTransform(d.a*e,d.b*e,d.c*e,d.d*e,d.tx*e,d.ty*e),b.CanvasGraphics.renderGraphics(this,c);for(var f=0,g=this.children.length;g>f;f++)this.children[f]._renderCanvas(a);this._mask&&a.maskManager.popMask(a)}},b.Graphics.prototype.getBounds=function(a){if(this.isMask)return b.EmptyRectangle;this.dirty&&(this.updateLocalBounds(),this.webGLDirty=!0,this.cachedSpriteDirty=!0,this.dirty=!1);var c=this._localBounds,d=c.x,e=c.width+c.x,f=c.y,g=c.height+c.y,h=a||this.worldTransform,i=h.a,j=h.b,k=h.c,l=h.d,m=h.tx,n=h.ty,o=i*e+k*g+m,p=l*g+j*e+n,q=i*d+k*g+m,r=l*g+j*d+n,s=i*d+k*f+m,t=l*f+j*d+n,u=i*e+k*f+m,v=l*f+j*e+n,w=o,x=p,y=o,z=p;return y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,z=z>r?r:z,z=z>t?t:z,z=z>v?v:z,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w,x=r>x?r:x,x=t>x?t:x,x=v>x?v:x,this._bounds.x=y,this._bounds.width=w-y,this._bounds.y=z,this._bounds.height=x-z,this._bounds},b.Graphics.prototype.updateLocalBounds=function(){var a=1/0,c=-1/0,d=1/0,e=-1/0;if(this.graphicsData.length)for(var f,g,h,i,j,k,l=0;lh?h:a,c=h+j>c?h+j:c,d=d>i?i:d,e=i+k>e?i+k:e;else if(n===b.Graphics.CIRC)h=f.x,i=f.y,j=f.radius+o/2,k=f.radius+o/2,a=a>h-j?h-j:a,c=h+j>c?h+j:c,d=d>i-k?i-k:d,e=i+k>e?i+k:e;else if(n===b.Graphics.ELIP)h=f.x,i=f.y,j=f.width+o/2,k=f.height+o/2,a=a>h-j?h-j:a,c=h+j>c?h+j:c,d=d>i-k?i-k:d,e=i+k>e?i+k:e;else{g=f.points;for(var p=0;ph-o?h-o:a,c=h+o>c?h+o:c,d=d>i-o?i-o:d,e=i+o>e?i+o:e}}else a=0,c=0,d=0,e=0;var q=this.boundsPadding;this._localBounds.x=a-q,this._localBounds.width=c-a+2*q,this._localBounds.y=d-q,this._localBounds.height=e-d+2*q},b.Graphics.prototype._generateCachedSprite=function(){var a=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(a.width,a.height);else{var c=new b.CanvasBuffer(a.width,a.height),d=b.Texture.fromCanvas(c.canvas);this._cachedSprite=new b.Sprite(d),this._cachedSprite.buffer=c,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(a.x/a.width),this._cachedSprite.anchor.y=-(a.y/a.height),this._cachedSprite.buffer.context.translate(-a.x,-a.y),this.worldAlpha=1,b.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},b.Graphics.prototype.updateCachedSpriteTexture=function(){var a=this._cachedSprite,b=a.texture,c=a.buffer.canvas;b.baseTexture.width=c.width,b.baseTexture.height=c.height,b.crop.width=b.frame.width=c.width,b.crop.height=b.frame.height=c.height,a._width=c.width,a._height=c.height,b.baseTexture.dirty()},b.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},b.Graphics.prototype.drawShape=function(a){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null;var c=new b.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,a);return this.graphicsData.push(c),c.type===b.Graphics.POLY&&(c.shape.closed=this.filling,this.currentPath=c),this.dirty=!0,c},b.GraphicsData=function(a,b,c,d,e,f,g){this.lineWidth=a,this.lineColor=b,this.lineAlpha=c,this._lineTint=b,this.fillColor=d,this.fillAlpha=e,this._fillTint=d,this.fill=f,this.shape=g,this.type=g.type},b.Graphics.POLY=0,b.Graphics.RECT=1,b.Graphics.CIRC=2,b.Graphics.ELIP=3,b.Graphics.RREC=4,b.Polygon.prototype.type=b.Graphics.POLY,b.Rectangle.prototype.type=b.Graphics.RECT,b.Circle.prototype.type=b.Graphics.CIRC,b.Ellipse.prototype.type=b.Graphics.ELIP,b.RoundedRectangle.prototype.type=b.Graphics.RREC,b.Strip=function(a){b.DisplayObjectContainer.call(this),this.texture=a,this.uvs=new b.Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new b.Float32Array([0,0,100,0,100,100,0,100]),this.colors=new b.Float32Array([1,1,1,1]),this.indices=new b.Uint16Array([0,1,2,3]),this.dirty=!0,this.blendMode=b.blendModes.NORMAL,this.canvasPadding=0,this.drawMode=b.Strip.DrawModes.TRIANGLE_STRIP},b.Strip.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Strip.prototype.constructor=b.Strip,b.Strip.prototype._renderWebGL=function(a){!this.visible||this.alpha<=0||(a.spriteBatch.stop(),this._vertexBuffer||this._initWebGL(a),a.shaderManager.setShader(a.shaderManager.stripShader),this._renderStrip(a),a.spriteBatch.start())},b.Strip.prototype._initWebGL=function(a){var b=a.gl;this._vertexBuffer=b.createBuffer(),this._indexBuffer=b.createBuffer(),this._uvBuffer=b.createBuffer(),this._colorBuffer=b.createBuffer(),b.bindBuffer(b.ARRAY_BUFFER,this._vertexBuffer),b.bufferData(b.ARRAY_BUFFER,this.vertices,b.DYNAMIC_DRAW),b.bindBuffer(b.ARRAY_BUFFER,this._uvBuffer),b.bufferData(b.ARRAY_BUFFER,this.uvs,b.STATIC_DRAW),b.bindBuffer(b.ARRAY_BUFFER,this._colorBuffer),b.bufferData(b.ARRAY_BUFFER,this.colors,b.STATIC_DRAW),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this._indexBuffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER,this.indices,b.STATIC_DRAW)},b.Strip.prototype._renderStrip=function(a){var c=a.gl,d=a.projection,e=a.offset,f=a.shaderManager.stripShader,g=this.drawMode===b.Strip.DrawModes.TRIANGLE_STRIP?c.TRIANGLE_STRIP:c.TRIANGLES;a.blendModeManager.setBlendMode(this.blendMode),c.uniformMatrix3fv(f.translationMatrix,!1,this.worldTransform.toArray(!0)),c.uniform2f(f.projectionVector,d.x,-d.y),c.uniform2f(f.offsetVector,-e.x,-e.y),c.uniform1f(f.alpha,this.worldAlpha),this.dirty?(this.dirty=!1,c.bindBuffer(c.ARRAY_BUFFER,this._vertexBuffer),c.bufferData(c.ARRAY_BUFFER,this.vertices,c.STATIC_DRAW),c.vertexAttribPointer(f.aVertexPosition,2,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,this._uvBuffer),c.bufferData(c.ARRAY_BUFFER,this.uvs,c.STATIC_DRAW),c.vertexAttribPointer(f.aTextureCoord,2,c.FLOAT,!1,0,0),c.activeTexture(c.TEXTURE0),this.texture.baseTexture._dirty[c.id]?a.renderer.updateTexture(this.texture.baseTexture):c.bindTexture(c.TEXTURE_2D,this.texture.baseTexture._glTextures[c.id]),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this._indexBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,this.indices,c.STATIC_DRAW)):(c.bindBuffer(c.ARRAY_BUFFER,this._vertexBuffer),c.bufferSubData(c.ARRAY_BUFFER,0,this.vertices),c.vertexAttribPointer(f.aVertexPosition,2,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,this._uvBuffer),c.vertexAttribPointer(f.aTextureCoord,2,c.FLOAT,!1,0,0),c.activeTexture(c.TEXTURE0),this.texture.baseTexture._dirty[c.id]?a.renderer.updateTexture(this.texture.baseTexture):c.bindTexture(c.TEXTURE_2D,this.texture.baseTexture._glTextures[c.id]),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this._indexBuffer)),c.drawElements(g,this.indices.length,c.UNSIGNED_SHORT,0)},b.Strip.prototype._renderCanvas=function(a){var c=a.context,d=this.worldTransform;a.roundPixels?c.setTransform(d.a,d.b,d.c,d.d,0|d.tx,0|d.ty):c.setTransform(d.a,d.b,d.c,d.d,d.tx,d.ty),this.drawMode===b.Strip.DrawModes.TRIANGLE_STRIP?this._renderCanvasTriangleStrip(c):this._renderCanvasTriangles(c)},b.Strip.prototype._renderCanvasTriangleStrip=function(a){var b=this.vertices,c=this.uvs,d=b.length/2;this.count++;for(var e=0;d-2>e;e++){var f=2*e;this._renderCanvasDrawTriangle(a,b,c,f,f+2,f+4)}},b.Strip.prototype._renderCanvasTriangles=function(a){var b=this.vertices,c=this.uvs,d=this.indices,e=d.length;this.count++;for(var f=0;e>f;f+=3){var g=2*d[f],h=2*d[f+1],i=2*d[f+2];this._renderCanvasDrawTriangle(a,b,c,g,h,i)}},b.Strip.prototype._renderCanvasDrawTriangle=function(a,b,c,d,e,f){var g=this.texture.baseTexture.source,h=this.texture.width,i=this.texture.height,j=b[d],k=b[e],l=b[f],m=b[d+1],n=b[e+1],o=b[f+1],p=c[d]*h,q=c[e]*h,r=c[f]*h,s=c[d+1]*i,t=c[e+1]*i,u=c[f+1]*i;if(this.canvasPadding>0){var v=this.canvasPadding/this.worldTransform.a,w=this.canvasPadding/this.worldTransform.d,x=(j+k+l)/3,y=(m+n+o)/3,z=j-x,A=m-y,B=Math.sqrt(z*z+A*A);j=x+z/B*(B+v),m=y+A/B*(B+w),z=k-x,A=n-y,B=Math.sqrt(z*z+A*A),k=x+z/B*(B+v),n=y+A/B*(B+w),z=l-x,A=o-y,B=Math.sqrt(z*z+A*A),l=x+z/B*(B+v),o=y+A/B*(B+w)}a.save(),a.beginPath(),a.moveTo(j,m),a.lineTo(k,n),a.lineTo(l,o),a.closePath(),a.clip();var C=p*t+s*r+q*u-t*r-s*q-p*u,D=j*t+s*l+k*u-t*l-s*k-j*u,E=p*k+j*r+q*l-k*r-j*q-p*l,F=p*t*l+s*k*r+j*q*u-j*t*r-s*q*l-p*k*u,G=m*t+s*o+n*u-t*o-s*n-m*u,H=p*n+m*r+q*o-n*r-m*q-p*o,I=p*t*o+s*n*r+m*q*u-m*t*r-s*q*o-p*n*u;a.transform(D/C,G/C,E/C,H/C,F/C,I/C),a.drawImage(g,0,0),a.restore()},b.Strip.prototype.renderStripFlat=function(a){var b=this.context,c=a.vertices,d=c.length/2;this.count++,b.beginPath();for(var e=1;d-2>e;e++){var f=2*e,g=c[f],h=c[f+2],i=c[f+4],j=c[f+1],k=c[f+3],l=c[f+5];b.moveTo(g,j),b.lineTo(h,k),b.lineTo(i,l)}b.fillStyle="#FF0000",b.fill(),b.closePath()},b.Strip.prototype.onTextureUpdate=function(){this.updateFrame=!0},b.Strip.prototype.getBounds=function(a){for(var c=a||this.worldTransform,d=c.a,e=c.b,f=c.c,g=c.d,h=c.tx,i=c.ty,j=-1/0,k=-1/0,l=1/0,m=1/0,n=this.vertices,o=0,p=n.length;p>o;o+=2){var q=n[o],r=n[o+1],s=d*q+f*r+h,t=g*r+e*q+i;l=l>s?s:l,m=m>t?t:m,j=s>j?s:j,k=t>k?t:k}if(l===-1/0||1/0===k)return b.EmptyRectangle;var u=this._bounds;return u.x=l,u.width=j-l,u.y=m,u.height=k-m,this._currentBounds=u,u},b.Strip.DrawModes={TRIANGLE_STRIP:0,TRIANGLES:1},b.Rope=function(a,c){b.Strip.call(this,a),this.points=c,this.vertices=new b.Float32Array(4*c.length),this.uvs=new b.Float32Array(4*c.length),this.colors=new b.Float32Array(2*c.length),this.indices=new b.Uint16Array(2*c.length),this.refresh()},b.Rope.prototype=Object.create(b.Strip.prototype),b.Rope.prototype.constructor=b.Rope,b.Rope.prototype.refresh=function(){var a=this.points;if(!(a.length<1)){var b=this.uvs,c=a[0],d=this.indices,e=this.colors;this.count-=.2,b[0]=0,b[1]=0,b[2]=0,b[3]=1,e[0]=1,e[1]=1,d[0]=0,d[1]=1;for(var f,g,h,i=a.length,j=1;i>j;j++)f=a[j],g=4*j,h=j/(i-1),j%2?(b[g]=h,b[g+1]=0,b[g+2]=h,b[g+3]=1):(b[g]=h,b[g+1]=0,b[g+2]=h,b[g+3]=1),g=2*j,e[g]=1,e[g+1]=1,g=2*j,d[g]=g,d[g+1]=g+1,c=f}},b.Rope.prototype.updateTransform=function(){var a=this.points;if(!(a.length<1)){var c,d=a[0],e={x:0,y:0};this.count-=.2;for(var f,g,h,i,j,k=this.vertices,l=a.length,m=0;l>m;m++)f=a[m],g=4*m,c=m1&&(h=1),i=Math.sqrt(e.x*e.x+e.y*e.y),j=this.texture.height/2,e.x/=i,e.y/=i,e.x*=j,e.y*=j,k[g]=f.x+e.x,k[g+1]=f.y+e.y,k[g+2]=f.x-e.x,k[g+3]=f.y-e.y,d=f;b.DisplayObjectContainer.prototype.updateTransform.call(this)}},b.Rope.prototype.setTexture=function(a){this.texture=a},b.TilingSprite=function(a,c,d){b.Sprite.call(this,a),this._width=c||100,this._height=d||100,this.tileScale=new b.Point(1,1),this.tileScaleOffset=new b.Point(1,1),this.tilePosition=new b.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=b.blendModes.NORMAL},b.TilingSprite.prototype=Object.create(b.Sprite.prototype),b.TilingSprite.prototype.constructor=b.TilingSprite,Object.defineProperty(b.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(a){this._width=a}}),Object.defineProperty(b.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(a){this._height=a}}),b.TilingSprite.prototype.setTexture=function(a){this.texture!==a&&(this.texture=a,this.refreshTexture=!0,this.cachedTint=16777215)},b.TilingSprite.prototype._renderWebGL=function(a){if(this.visible!==!1&&0!==this.alpha){var b,c;for(this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(a.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)):a.spriteBatch.renderTilingSprite(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a); -a.spriteBatch.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(this._mask,a),a.spriteBatch.start()}},b.TilingSprite.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){var c=a.context;this._mask&&a.maskManager.pushMask(this._mask,a),c.globalAlpha=this.worldAlpha;var d,e,f=this.worldTransform,g=a.resolution;if(c.setTransform(f.a*g,f.b*g,f.c*g,f.d*g,f.tx*g,f.ty*g),!this.__tilePattern||this.refreshTexture){if(this.generateTilingTexture(!1),!this.tilingTexture)return;this.__tilePattern=c.createPattern(this.tilingTexture.baseTexture.source,"repeat")}this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,c.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]);var h=this.tilePosition,i=this.tileScale;for(h.x%=this.tilingTexture.baseTexture.width,h.y%=this.tilingTexture.baseTexture.height,c.scale(i.x,i.y),c.translate(h.x+this.anchor.x*-this._width,h.y+this.anchor.y*-this._height),c.fillStyle=this.__tilePattern,c.fillRect(-h.x,-h.y,this._width/i.x,this._height/i.y),c.scale(1/i.x,1/i.y),c.translate(-h.x+this.anchor.x*this._width,-h.y+this.anchor.y*this._height),this._mask&&a.maskManager.popMask(a),d=0,e=this.children.length;e>d;d++)this.children[d]._renderCanvas(a)}},b.TilingSprite.prototype.getBounds=function(){var a=this._width,b=this._height,c=a*(1-this.anchor.x),d=a*-this.anchor.x,e=b*(1-this.anchor.y),f=b*-this.anchor.y,g=this.worldTransform,h=g.a,i=g.b,j=g.c,k=g.d,l=g.tx,m=g.ty,n=h*d+j*f+l,o=k*f+i*d+m,p=h*c+j*f+l,q=k*f+i*c+m,r=h*c+j*e+l,s=k*e+i*c+m,t=h*d+j*e+l,u=k*e+i*d+m,v=-1/0,w=-1/0,x=1/0,y=1/0;x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w;var z=this._bounds;return z.x=x,z.width=v-x,z.y=y,z.height=w-y,this._currentBounds=z,z},b.TilingSprite.prototype.onTextureUpdate=function(){},b.TilingSprite.prototype.generateTilingTexture=function(a){if(this.texture.baseTexture.hasLoaded){var c,d,e=this.originalTexture||this.texture,f=e.frame,g=f.width!==e.baseTexture.width||f.height!==e.baseTexture.height,h=!1;if(a?(c=b.getNextPowerOfTwo(f.width),d=b.getNextPowerOfTwo(f.height),(f.width!==c||f.height!==d||e.baseTexture.width!==c||e.baseTexture.height||d)&&(h=!0)):g&&(e.trim?(c=e.trim.width,d=e.trim.height):(c=f.width,d=f.height),h=!0),h){var i;this.tilingTexture&&this.tilingTexture.isTiling?(i=this.tilingTexture.canvasBuffer,i.resize(c,d),this.tilingTexture.baseTexture.width=c,this.tilingTexture.baseTexture.height=d,this.tilingTexture.needsUpdate=!0):(i=new b.CanvasBuffer(c,d),this.tilingTexture=b.Texture.fromCanvas(i.canvas),this.tilingTexture.canvasBuffer=i,this.tilingTexture.isTiling=!0),i.context.drawImage(e.baseTexture.source,e.crop.x,e.crop.y,e.crop.width,e.crop.height,0,0,c,d),this.tileScaleOffset.x=f.width/c,this.tileScaleOffset.y=f.height/d}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=e;this.refreshTexture=!1,this.originalTexture=this.texture,this.texture=this.tilingTexture,this.tilingTexture.baseTexture._powerOf2=!0}},b.TilingSprite.prototype.destroy=function(){b.Sprite.prototype.destroy.call(this),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture.destroy(!0),this.tilingTexture=null};var c={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};c.BoneData=function(a,b){this.name=a,this.parent=b},c.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},c.SlotData=function(a,b){this.name=a,this.boneData=b},c.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},c.IkConstraintData=function(a){this.name=a,this.bones=[]},c.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},c.Bone=function(a,b,c){this.data=a,this.skeleton=b,this.parent=c,this.setToSetupPose()},c.Bone.yDown=!1,c.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var a=this.parent;if(a)this.worldX=this.x*a.m00+this.y*a.m01+a.worldX,this.worldY=this.x*a.m10+this.y*a.m11+a.worldY,this.data.inheritScale?(this.worldScaleX=a.worldScaleX*this.scaleX,this.worldScaleY=a.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?a.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=a.worldFlipX!=this.flipX,this.worldFlipY=a.worldFlipY!=this.flipY;else{var b=this.skeleton.flipX,d=this.skeleton.flipY;this.worldX=b?-this.x:this.x,this.worldY=d!=c.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=b!=this.flipX,this.worldFlipY=d!=this.flipY}var e=this.worldRotation*c.degRad,f=Math.cos(e),g=Math.sin(e);this.worldFlipX?(this.m00=-f*this.worldScaleX,this.m01=g*this.worldScaleY):(this.m00=f*this.worldScaleX,this.m01=-g*this.worldScaleY),this.worldFlipY!=c.Bone.yDown?(this.m10=-g*this.worldScaleX,this.m11=-f*this.worldScaleY):(this.m10=g*this.worldScaleX,this.m11=f*this.worldScaleY)},setToSetupPose:function(){var a=this.data;this.x=a.x,this.y=a.y,this.rotation=a.rotation,this.rotationIK=this.rotation,this.scaleX=a.scaleX,this.scaleY=a.scaleY,this.flipX=a.flipX,this.flipY=a.flipY},worldToLocal:function(a){var b=a[0]-this.worldX,d=a[1]-this.worldY,e=this.m00,f=this.m10,g=this.m01,h=this.m11;this.worldFlipX!=(this.worldFlipY!=c.Bone.yDown)&&(e=-e,h=-h);var i=1/(e*h-g*f);a[0]=b*e*i-d*g*i,a[1]=d*h*i-b*f*i},localToWorld:function(a){var b=a[0],c=a[1];a[0]=b*this.m00+c*this.m01+this.worldX,a[1]=b*this.m10+c*this.m11+this.worldY}},c.Slot=function(a,b){this.data=a,this.bone=b,this.setToSetupPose()},c.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(a){this.attachment=a,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(a){this._attachmentTime=this.bone.skeleton.time-a},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var a=this.data;this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a;for(var b=this.bone.skeleton.data.slots,c=0,d=b.length;d>c;c++)if(b[c]==a){this.setAttachment(a.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(c,a.attachmentName):null);break}}},c.IkConstraint=function(a,b){this.data=a,this.mix=a.mix,this.bendDirection=a.bendDirection,this.bones=[];for(var c=0,d=a.bones.length;d>c;c++)this.bones.push(b.findBone(a.bones[c].name));this.target=b.findBone(a.target.name)},c.IkConstraint.prototype={apply:function(){var a=this.target,b=this.bones;switch(b.length){case 1:c.IkConstraint.apply1(b[0],a.worldX,a.worldY,this.mix);break;case 2:c.IkConstraint.apply2(b[0],b[1],a.worldX,a.worldY,this.bendDirection,this.mix)}}},c.IkConstraint.apply1=function(a,b,d,e){var f=a.data.inheritRotation&&a.parent?a.parent.worldRotation:0,g=a.rotation,h=Math.atan2(d-a.worldY,b-a.worldX)*c.radDeg-f;a.rotationIK=g+(h-g)*e},c.IkConstraint.apply2=function(a,b,d,e,f,g){var h=b.rotation,i=a.rotation;if(!g)return b.rotationIK=h,void(a.rotationIK=i);var j,k,l=c.temp,m=a.parent;m?(l[0]=d,l[1]=e,m.worldToLocal(l),d=(l[0]-a.x)*m.worldScaleX,e=(l[1]-a.y)*m.worldScaleY):(d-=a.x,e-=a.y),b.parent==a?(j=b.x,k=b.y):(l[0]=b.x,l[1]=b.y,b.parent.localToWorld(l),a.worldToLocal(l),j=l[0],k=l[1]);var n=j*a.worldScaleX,o=k*a.worldScaleY,p=Math.atan2(o,n),q=Math.sqrt(n*n+o*o),r=b.data.length*b.worldScaleX,s=2*q*r;if(1e-4>s)return void(b.rotationIK=h+(Math.atan2(e,d)*c.radDeg-i-h)*g);var t=(d*d+e*e-q*q-r*r)/s;-1>t?t=-1:t>1&&(t=1);var u=Math.acos(t)*f,v=q+r*t,w=r*Math.sin(u),x=Math.atan2(e*v-d*w,d*v+e*w),y=(x-p)*c.radDeg-i;y>180?y-=360:-180>y&&(y+=360),a.rotationIK=i+y*g,y=(u+p)*c.radDeg-h,y>180?y-=360:-180>y&&(y+=360),b.rotationIK=h+(y+a.worldRotation-b.parent.worldRotation)*g},c.Skin=function(a){this.name=a,this.attachments={}},c.Skin.prototype={addAttachment:function(a,b,c){this.attachments[a+":"+b]=c},getAttachment:function(a,b){return this.attachments[a+":"+b]},_attachAll:function(a,b){for(var c in b.attachments){var d=c.indexOf(":"),e=parseInt(c.substring(0,d)),f=c.substring(d+1),g=a.slots[e];if(g.attachment&&g.attachment.name==f){var h=this.getAttachment(e,f);h&&g.setAttachment(h)}}}},c.Animation=function(a,b,c){this.name=a,this.timelines=b,this.duration=c},c.Animation.prototype={apply:function(a,b,c,d,e){d&&0!=this.duration&&(c%=this.duration,b%=this.duration);for(var f=this.timelines,g=0,h=f.length;h>g;g++)f[g].apply(a,b,c,e,1)},mix:function(a,b,c,d,e,f){d&&0!=this.duration&&(c%=this.duration,b%=this.duration);for(var g=this.timelines,h=0,i=g.length;i>h;h++)g[h].apply(a,b,c,e,f)}},c.Animation.binarySearch=function(a,b,c){var d=0,e=Math.floor(a.length/c)-2;if(!e)return c;for(var f=e>>>1;;){if(a[(f+1)*c]<=b?d=f+1:e=f,d==e)return(d+1)*c;f=d+e>>>1}},c.Animation.binarySearch1=function(a,b){var c=0,d=a.length-2;if(!d)return 1;for(var e=d>>>1;;){if(a[e+1]<=b?c=e+1:d=e,c==d)return c+1;e=c+d>>>1}},c.Animation.linearSearch=function(a,b,c){for(var d=0,e=a.length-c;e>=d;d+=c)if(a[d]>b)return d;return-1},c.Curves=function(){this.curves=[]},c.Curves.prototype={setLinear:function(a){this.curves[19*a]=0},setStepped:function(a){this.curves[19*a]=1},setCurve:function(a,b,c,d,e){var f=.1,g=f*f,h=g*f,i=3*f,j=3*g,k=6*g,l=6*h,m=2*-b+d,n=2*-c+e,o=3*(b-d)+1,p=3*(c-e)+1,q=b*i+m*j+o*h,r=c*i+n*j+p*h,s=m*k+o*l,t=n*k+p*l,u=o*l,v=p*l,w=19*a,x=this.curves;x[w++]=2;for(var y=q,z=r,A=w+19-1;A>w;w+=2)x[w]=y,x[w+1]=z,q+=s,r+=t,s+=u,t+=v,y+=q,z+=r},getCurvePercent:function(a,b){b=0>b?0:b>1?1:b;var c=this.curves,d=19*a,e=c[d];if(0===e)return b;if(1==e)return 0;d++;for(var f=0,g=d,h=d+19-1;h>d;d+=2)if(f=c[d],f>=b){var i,j;return d==g?(i=0,j=0):(i=c[d-2],j=c[d-1]),j+(c[d+1]-j)*(b-i)/(f-i)}var k=c[d-1];return k+(1-k)*(b-f)/(1-f)}},c.RotateTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=2*a},c.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2,this.frames[a]=b,this.frames[a+1]=c},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-2]){for(var i=h.data.rotation+g[g.length-1]-h.rotation;i>180;)i-=360;for(;-180>i;)i+=360;return void(h.rotation+=i*f)}var j=c.Animation.binarySearch(g,d,2),k=g[j-1],l=g[j],m=1-(d-l)/(g[j-2]-l);m=this.curves.getCurvePercent(j/2-1,m);for(var i=g[j+1]-k;i>180;)i-=360;for(;-180>i;)i+=360;for(i=h.data.rotation+(k+i*m)-h.rotation;i>180;)i-=360;for(;-180>i;)i+=360;h.rotation+=i*f}}},c.TranslateTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=3*a},c.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-3])return h.x+=(h.data.x+g[g.length-2]-h.x)*f,void(h.y+=(h.data.y+g[g.length-1]-h.y)*f);var i=c.Animation.binarySearch(g,d,3),j=g[i-2],k=g[i-1],l=g[i],m=1-(d-l)/(g[i+-3]-l);m=this.curves.getCurvePercent(i/3-1,m),h.x+=(h.data.x+j+(g[i+1]-j)*m-h.x)*f,h.y+=(h.data.y+k+(g[i+2]-k)*m-h.y)*f}}},c.ScaleTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=3*a},c.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-3])return h.scaleX+=(h.data.scaleX*g[g.length-2]-h.scaleX)*f,void(h.scaleY+=(h.data.scaleY*g[g.length-1]-h.scaleY)*f);var i=c.Animation.binarySearch(g,d,3),j=g[i-2],k=g[i-1],l=g[i],m=1-(d-l)/(g[i+-3]-l);m=this.curves.getCurvePercent(i/3-1,m),h.scaleX+=(h.data.scaleX*(j+(g[i+1]-j)*m)-h.scaleX)*f,h.scaleY+=(h.data.scaleY*(k+(g[i+2]-k)*m)-h.scaleY)*f}}},c.ColorTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=5*a},c.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(a,b,c,d,e,f){a*=5,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d,this.frames[a+3]=e,this.frames[a+4]=f},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-5]){var l=g.length-1;h=g[l-3],i=g[l-2],j=g[l-1],k=g[l]}else{var m=c.Animation.binarySearch(g,d,5),n=g[m-4],o=g[m-3],p=g[m-2],q=g[m-1],r=g[m],s=1-(d-r)/(g[m-5]-r);s=this.curves.getCurvePercent(m/5-1,s),h=n+(g[m+1]-n)*s,i=o+(g[m+2]-o)*s,j=p+(g[m+3]-p)*s,k=q+(g[m+4]-q)*s}var t=a.slots[this.slotIndex];1>f?(t.r+=(h-t.r)*f,t.g+=(i-t.g)*f,t.b+=(j-t.b)*f,t.a+=(k-t.a)*f):(t.r=h,t.g=i,t.b=j,t.a=k)}}},c.AttachmentTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=a,this.attachmentNames=[],this.attachmentNames.length=a},c.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b,this.attachmentNames[a]=c},apply:function(a,b,d){var e=this.frames;if(dd&&this.apply(a,b,Number.MAX_VALUE,null,0));b>d&&(b=-1);var f=d>=e[e.length-1]?e.length-1:c.Animation.binarySearch1(e,d)-1;if(!(e[f]d)this.apply(a,b,Number.MAX_VALUE,e,f),b=-1;else if(b>=g[h-1])return;if(!(d0&&g[i-1]==j;)i--}for(var k=this.events;h>i&&d>=g[i];i++)e.push(k[i])}}}},c.DrawOrderTimeline=function(a){this.frames=[],this.frames.length=a,this.drawOrders=[],this.drawOrders.length=a},c.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b,this.drawOrders[a]=c},apply:function(a,b,d){var e=this.frames;if(!(d=e[e.length-1]?e.length-1:c.Animation.binarySearch1(e,d)-1;var g=a.drawOrder,h=a.slots,i=this.drawOrders[f];if(i)for(var j=0,k=i.length;k>j;j++)g[j]=a.slots[i[j]];else for(var j=0,k=h.length;k>j;j++)g[j]=h[j]}}},c.FfdTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=a,this.frameVertices=[],this.frameVertices.length=a},c.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b,this.frameVertices[a]=c},apply:function(a,b,d,e,f){var g=a.slots[this.slotIndex];if(g.attachment==this.attachment){var h=this.frames;if(!(d=h[h.length-1]){var l=i[h.length-1];if(1>f)for(var m=0;j>m;m++)k[m]+=(l[m]-k[m])*f;else for(var m=0;j>m;m++)k[m]=l[m]}else{var n=c.Animation.binarySearch1(h,d),o=h[n],p=1-(d-o)/(h[n-1]-o);p=this.curves.getCurvePercent(n-1,0>p?0:p>1?1:p);var q=i[n-1],r=i[n];if(1>f)for(var m=0;j>m;m++){var s=q[m];k[m]+=(s+(r[m]-s)*p-k[m])*f}else for(var m=0;j>m;m++){var s=q[m];k[m]=s+(r[m]-s)*p}}}}}},c.IkConstraintTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=3*a},c.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-3])return h.mix+=(g[g.length-2]-h.mix)*f,void(h.bendDirection=g[g.length-1]);var i=c.Animation.binarySearch(g,d,3),j=g[i+-2],k=g[i],l=1-(d-k)/(g[i+-3]-k);l=this.curves.getCurvePercent(i/3-1,l);var m=j+(g[i+1]-j)*l;h.mix+=(m-h.mix)*f,h.bendDirection=g[i+-1]}}},c.FlipXTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=2*a},c.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2,this.frames[a]=b,this.frames[a+1]=c?1:0},apply:function(a,b,d){var e=this.frames;if(dd&&this.apply(a,b,Number.MAX_VALUE,null,0));b>d&&(b=-1);var f=(d>=e[e.length-2]?e.length:c.Animation.binarySearch(e,d,2))-2;e[f]d&&this.apply(a,b,Number.MAX_VALUE,null,0));b>d&&(b=-1);var f=(d>=e[e.length-2]?e.length:c.Animation.binarySearch(e,d,2))-2;e[f]c;c++)if(b[c].name==a)return b[c];return null},findBoneIndex:function(a){for(var b=this.bones,c=0,d=b.length;d>c;c++)if(b[c].name==a)return c;return-1},findSlot:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].name==a)return slot[c];return null},findSlotIndex:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].name==a)return c;return-1},findSkin:function(a){for(var b=this.skins,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},findEvent:function(a){for(var b=this.events,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},findAnimation:function(a){for(var b=this.animations,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},findIkConstraint:function(a){for(var b=this.ikConstraints,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null}},c.Skeleton=function(a){this.data=a,this.bones=[];for(var b=0,d=a.bones.length;d>b;b++){var e=a.bones[b],f=e.parent?this.bones[a.bones.indexOf(e.parent)]:null;this.bones.push(new c.Bone(e,this,f))}this.slots=[],this.drawOrder=[];for(var b=0,d=a.slots.length;d>b;b++){var g=a.slots[b],h=this.bones[a.bones.indexOf(g.boneData)],i=new c.Slot(g,h);this.slots.push(i),this.drawOrder.push(i)}this.ikConstraints=[];for(var b=0,d=a.ikConstraints.length;d>b;b++)this.ikConstraints.push(new c.IkConstraint(a.ikConstraints[b],this));this.boneCache=[],this.updateCache()},c.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var a=this.ikConstraints,b=a.length,c=b+1,d=this.boneCache;d.length>c&&(d.length=c);for(var e=0,f=d.length;f>e;e++)d[e].length=0;for(;d.lengthe;e++){var i=h[e],j=i;do{for(var k=0;b>k;k++)for(var l=a[k],m=l.bones[0],n=l.bones[l.bones.length-1];;){if(j==n){d[k].push(i),d[k+1].push(i);continue a}if(n==m)break;n=n.parent}j=j.parent}while(j);g[g.length]=i}},updateWorldTransform:function(){for(var a=this.bones,b=0,c=a.length;c>b;b++){var d=a[b];d.rotationIK=d.rotation}for(var b=0,e=this.boneCache.length-1;;){for(var f=this.boneCache[b],g=0,h=f.length;h>g;g++)f[g].updateWorldTransform();if(b==e)break;this.ikConstraints[b].apply(),b++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var a=this.bones,b=0,c=a.length;c>b;b++)a[b].setToSetupPose();for(var d=this.ikConstraints,b=0,c=d.length;c>b;b++){var e=d[b];e.bendDirection=e.data.bendDirection,e.mix=e.data.mix}},setSlotsToSetupPose:function(){for(var a=this.slots,b=this.drawOrder,c=0,d=a.length;d>c;c++)b[c]=a[c],a[c].setToSetupPose(c)},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(a){for(var b=this.bones,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return b[c];return null},findBoneIndex:function(a){for(var b=this.bones,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return c;return-1},findSlot:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return b[c];return null},findSlotIndex:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return c;return-1},setSkinByName:function(a){var b=this.data.findSkin(a);if(!b)throw"Skin not found: "+a;this.setSkin(b)},setSkin:function(a){if(a)if(this.skin)a._attachAll(this,this.skin);else for(var b=this.slots,c=0,d=b.length;d>c;c++){var e=b[c],f=e.data.attachmentName;if(f){var g=a.getAttachment(c,f);g&&e.setAttachment(g)}}this.skin=a},getAttachmentBySlotName:function(a,b){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(a),b)},getAttachmentBySlotIndex:function(a,b){if(this.skin){var c=this.skin.getAttachment(a,b);if(c)return c}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(a,b):null},setAttachment:function(a,b){for(var c=this.slots,d=0,e=c.length;e>d;d++){var f=c[d];if(f.data.name==a){var g=null;if(b&&(g=this.getAttachmentBySlotIndex(d,b),!g))throw"Attachment not found: "+b+", for slot: "+a;return void f.setAttachment(g)}}throw"Slot not found: "+a},findIkConstraint:function(a){for(var b=this.ikConstraints,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return b[c];return null},update:function(a){this.time+=a}},c.EventData=function(a){this.name=a},c.EventData.prototype={intValue:0,floatValue:0,stringValue:null},c.Event=function(a){this.data=a},c.Event.prototype={intValue:0,floatValue:0,stringValue:null},c.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},c.RegionAttachment=function(a){this.name=a,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},c.RegionAttachment.prototype={type:c.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(a,b,c,d,e){var f=this.uvs;e?(f[2]=a,f[3]=d,f[4]=a,f[5]=b,f[6]=c,f[7]=b,f[0]=c,f[1]=d):(f[0]=a,f[1]=d,f[2]=a,f[3]=b,f[4]=c,f[5]=b,f[6]=c,f[7]=d)},updateOffset:function(){var a=this.width/this.regionOriginalWidth*this.scaleX,b=this.height/this.regionOriginalHeight*this.scaleY,d=-this.width/2*this.scaleX+this.regionOffsetX*a,e=-this.height/2*this.scaleY+this.regionOffsetY*b,f=d+this.regionWidth*a,g=e+this.regionHeight*b,h=this.rotation*c.degRad,i=Math.cos(h),j=Math.sin(h),k=d*i+this.x,l=d*j,m=e*i+this.y,n=e*j,o=f*i+this.x,p=f*j,q=g*i+this.y,r=g*j,s=this.offset;s[0]=k-n,s[1]=m+l,s[2]=k-r,s[3]=q+l,s[4]=o-r,s[5]=q+p,s[6]=o-n,s[7]=m+p},computeVertices:function(a,b,c,d){a+=c.worldX,b+=c.worldY;var e=c.m00,f=c.m01,g=c.m10,h=c.m11,i=this.offset;d[0]=i[0]*e+i[1]*f+a,d[1]=i[0]*g+i[1]*h+b,d[2]=i[2]*e+i[3]*f+a,d[3]=i[2]*g+i[3]*h+b,d[4]=i[4]*e+i[5]*f+a,d[5]=i[4]*g+i[5]*h+b,d[6]=i[6]*e+i[7]*f+a,d[7]=i[6]*g+i[7]*h+b}},c.MeshAttachment=function(a){this.name=a},c.MeshAttachment.prototype={type:c.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var a=this.regionU2-this.regionU,b=this.regionV2-this.regionV,d=this.regionUVs.length;if(this.uvs&&this.uvs.length==d||(this.uvs=new c.Float32Array(d)),this.regionRotate)for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e+1]*a,this.uvs[e+1]=this.regionV+b-this.regionUVs[e]*b;else for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e]*a,this.uvs[e+1]=this.regionV+this.regionUVs[e+1]*b},computeWorldVertices:function(a,b,c,d){var e=c.bone;a+=e.worldX,b+=e.worldY;var f=e.m00,g=e.m01,h=e.m10,i=e.m11,j=this.vertices,k=j.length;c.attachmentVertices.length==k&&(j=c.attachmentVertices);for(var l=0;k>l;l+=2){var m=j[l],n=j[l+1];d[l]=m*f+n*g+a,d[l+1]=m*h+n*i+b}}},c.SkinnedMeshAttachment=function(a){this.name=a},c.SkinnedMeshAttachment.prototype={type:c.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var a=this.regionU2-this.regionU,b=this.regionV2-this.regionV,d=this.regionUVs.length;if(this.uvs&&this.uvs.length==d||(this.uvs=new c.Float32Array(d)),this.regionRotate)for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e+1]*a,this.uvs[e+1]=this.regionV+b-this.regionUVs[e]*b;else for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e]*a,this.uvs[e+1]=this.regionV+this.regionUVs[e+1]*b},computeWorldVertices:function(a,b,c,d){var e,f,g,h,i,j,k,l=c.bone.skeleton.bones,m=this.weights,n=this.bones,o=0,p=0,q=0,r=0,s=n.length;if(c.attachmentVertices.length)for(var t=c.attachmentVertices;s>p;o+=2){for(f=0,g=0,e=n[p++]+p;e>p;p++,q+=3,r+=2)h=l[n[p]],i=m[q]+t[r],j=m[q+1]+t[r+1],k=m[q+2],f+=(i*h.m00+j*h.m01+h.worldX)*k,g+=(i*h.m10+j*h.m11+h.worldY)*k;d[o]=f+a,d[o+1]=g+b}else for(;s>p;o+=2){for(f=0,g=0,e=n[p++]+p;e>p;p++,q+=3)h=l[n[p]],i=m[q],j=m[q+1],k=m[q+2],f+=(i*h.m00+j*h.m01+h.worldX)*k,g+=(i*h.m10+j*h.m11+h.worldY)*k;d[o]=f+a,d[o+1]=g+b}}},c.BoundingBoxAttachment=function(a){this.name=a,this.vertices=[]},c.BoundingBoxAttachment.prototype={type:c.AttachmentType.boundingbox,computeWorldVertices:function(a,b,c,d){a+=c.worldX,b+=c.worldY;for(var e=c.m00,f=c.m01,g=c.m10,h=c.m11,i=this.vertices,j=0,k=i.length;k>j;j+=2){var l=i[j],m=i[j+1];d[j]=l*e+m*f+a,d[j+1]=l*g+m*h+b}}},c.AnimationStateData=function(a){this.skeletonData=a,this.animationToMixTime={}},c.AnimationStateData.prototype={defaultMix:0,setMixByName:function(a,b,c){var d=this.skeletonData.findAnimation(a);if(!d)throw"Animation not found: "+a;var e=this.skeletonData.findAnimation(b);if(!e)throw"Animation not found: "+b;this.setMix(d,e,c)},setMix:function(a,b,c){this.animationToMixTime[a.name+":"+b.name]=c},getMix:function(a,b){var c=a.name+":"+b.name;return this.animationToMixTime.hasOwnProperty(c)?this.animationToMixTime[c]:this.defaultMix}},c.TrackEntry=function(){},c.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},c.AnimationState=function(a){this.data=a,this.tracks=[],this.events=[]},c.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(a){a*=this.timeScale;for(var b=0;b=0&&this.setCurrent(b,e)):!c.loop&&c.lastTime>=c.endTime&&this.clearTrack(b)}}},apply:function(a){for(var b=0;bf&&(d=f);var h=c.previous;if(h){var i=h.time;!h.loop&&i>h.endTime&&(i=h.endTime),h.animation.apply(a,i,i,h.loop,null);var j=c.mixTime/c.mixDuration*c.mix;j>=1&&(j=1,c.previous=null),c.animation.mix(a,c.lastTime,d,g,this.events,j)}else 1==c.mix?c.animation.apply(a,c.lastTime,d,g,this.events):c.animation.mix(a,c.lastTime,d,g,this.events,c.mix);for(var k=0,l=this.events.length;l>k;k++){var m=this.events[k];c.onEvent&&c.onEvent(b,m),this.onEvent&&this.onEvent(b,m)}if(g?e%f>d%f:f>e&&d>=f){var n=Math.floor(d/f);c.onComplete&&c.onComplete(b,n),this.onComplete&&this.onComplete(b,n)}c.lastTime=c.time}}},clearTracks:function(){for(var a=0,b=this.tracks.length;b>a;a++)this.clearTrack(a);this.tracks.length=0},clearTrack:function(a){if(!(a>=this.tracks.length)){var b=this.tracks[a];b&&(b.onEnd&&b.onEnd(a),this.onEnd&&this.onEnd(a),this.tracks[a]=null)}},_expandToIndex:function(a){if(a=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(a,b){var c=this._expandToIndex(a);if(c){var d=c.previous;c.previous=null,c.onEnd&&c.onEnd(a),this.onEnd&&this.onEnd(a),b.mixDuration=this.data.getMix(c.animation,b.animation),b.mixDuration>0&&(b.mixTime=0,b.previous=d&&c.mixTime/c.mixDuration<.5?d:c)}this.tracks[a]=b,b.onStart&&b.onStart(a),this.onStart&&this.onStart(a)},setAnimationByName:function(a,b,c){var d=this.data.skeletonData.findAnimation(b);if(!d)throw"Animation not found: "+b;return this.setAnimation(a,d,c)},setAnimation:function(a,b,d){var e=new c.TrackEntry;return e.animation=b,e.loop=d,e.endTime=b.duration,this.setCurrent(a,e),e},addAnimationByName:function(a,b,c,d){var e=this.data.skeletonData.findAnimation(b);if(!e)throw"Animation not found: "+b;return this.addAnimation(a,e,c,d)},addAnimation:function(a,b,d,e){var f=new c.TrackEntry;f.animation=b,f.loop=d,f.endTime=b.duration;var g=this._expandToIndex(a);if(g){for(;g.next;)g=g.next;g.next=f}else this.tracks[a]=f;return 0>=e&&(g?e+=g.endTime-this.data.getMix(g.animation,b):e=0),f.delay=e,f},getCurrent:function(a){return a>=this.tracks.length?null:this.tracks[a]}},c.SkeletonJson=function(a){this.attachmentLoader=a},c.SkeletonJson.prototype={scale:1,readSkeletonData:function(a,b){var d=new c.SkeletonData;d.name=b;var e=a.skeleton;e&&(d.hash=e.hash,d.version=e.spine,d.width=e.width||0,d.height=e.height||0);for(var f=a.bones,g=0,h=f.length;h>g;g++){var i=f[g],j=null;if(i.parent&&(j=d.findBone(i.parent),!j))throw"Parent bone not found: "+i.parent;var k=new c.BoneData(i.name,j);k.length=(i.length||0)*this.scale,k.x=(i.x||0)*this.scale,k.y=(i.y||0)*this.scale,k.rotation=i.rotation||0,k.scaleX=i.hasOwnProperty("scaleX")?i.scaleX:1,k.scaleY=i.hasOwnProperty("scaleY")?i.scaleY:1,k.inheritScale=i.hasOwnProperty("inheritScale")?i.inheritScale:!0,k.inheritRotation=i.hasOwnProperty("inheritRotation")?i.inheritRotation:!0,d.bones.push(k)}var l=a.ik;if(l)for(var g=0,h=l.length;h>g;g++){for(var m=l[g],n=new c.IkConstraintData(m.name),f=m.bones,o=0,p=f.length;p>o;o++){var q=d.findBone(f[o]);if(!q)throw"IK bone not found: "+f[o];n.bones.push(q)}if(n.target=d.findBone(m.target),!n.target)throw"Target bone not found: "+m.target;n.bendDirection=!m.hasOwnProperty("bendPositive")||m.bendPositive?1:-1,n.mix=m.hasOwnProperty("mix")?m.mix:1,d.ikConstraints.push(n)}for(var r=a.slots,g=0,h=r.length;h>g;g++){var s=r[g],k=d.findBone(s.bone);if(!k)throw"Slot bone not found: "+s.bone;var t=new c.SlotData(s.name,k),u=s.color;u&&(t.r=this.toColor(u,0),t.g=this.toColor(u,1),t.b=this.toColor(u,2),t.a=this.toColor(u,3)),t.attachmentName=s.attachment,t.additiveBlending=s.additive&&"true"==s.additive,d.slots.push(t)}var v=a.skins;for(var w in v)if(v.hasOwnProperty(w)){var x=v[w],y=new c.Skin(w);for(var z in x)if(x.hasOwnProperty(z)){var A=d.findSlotIndex(z),B=x[z];for(var C in B)if(B.hasOwnProperty(C)){var D=this.readAttachment(y,C,B[C]);D&&y.addAttachment(A,C,D)}}d.skins.push(y),"default"==y.name&&(d.defaultSkin=y)}var E=a.events;for(var F in E)if(E.hasOwnProperty(F)){var G=E[F],H=new c.EventData(F);H.intValue=G["int"]||0,H.floatValue=G["float"]||0,H.stringValue=G.string||null,d.events.push(H)}var I=a.animations;for(var J in I)I.hasOwnProperty(J)&&this.readAnimation(J,I[J],d);return d},readAttachment:function(a,b,d){b=d.name||b;var e=c.AttachmentType[d.type||"region"],f=d.path||b,g=this.scale; -if(e==c.AttachmentType.region){var h=this.attachmentLoader.newRegionAttachment(a,b,f);if(!h)return null;h.path=f,h.x=(d.x||0)*g,h.y=(d.y||0)*g,h.scaleX=d.hasOwnProperty("scaleX")?d.scaleX:1,h.scaleY=d.hasOwnProperty("scaleY")?d.scaleY:1,h.rotation=d.rotation||0,h.width=(d.width||0)*g,h.height=(d.height||0)*g;var i=d.color;return i&&(h.r=this.toColor(i,0),h.g=this.toColor(i,1),h.b=this.toColor(i,2),h.a=this.toColor(i,3)),h.updateOffset(),h}if(e==c.AttachmentType.mesh){var j=this.attachmentLoader.newMeshAttachment(a,b,f);return j?(j.path=f,j.vertices=this.getFloatArray(d,"vertices",g),j.triangles=this.getIntArray(d,"triangles"),j.regionUVs=this.getFloatArray(d,"uvs",1),j.updateUVs(),i=d.color,i&&(j.r=this.toColor(i,0),j.g=this.toColor(i,1),j.b=this.toColor(i,2),j.a=this.toColor(i,3)),j.hullLength=2*(d.hull||0),d.edges&&(j.edges=this.getIntArray(d,"edges")),j.width=(d.width||0)*g,j.height=(d.height||0)*g,j):null}if(e==c.AttachmentType.skinnedmesh){var j=this.attachmentLoader.newSkinnedMeshAttachment(a,b,f);if(!j)return null;j.path=f;for(var k=this.getFloatArray(d,"uvs",1),l=this.getFloatArray(d,"vertices",1),m=[],n=[],o=0,p=l.length;p>o;){var q=0|l[o++];n[n.length]=q;for(var r=o+4*q;r>o;)n[n.length]=l[o],m[m.length]=l[o+1]*g,m[m.length]=l[o+2]*g,m[m.length]=l[o+3],o+=4}return j.bones=n,j.weights=m,j.triangles=this.getIntArray(d,"triangles"),j.regionUVs=k,j.updateUVs(),i=d.color,i&&(j.r=this.toColor(i,0),j.g=this.toColor(i,1),j.b=this.toColor(i,2),j.a=this.toColor(i,3)),j.hullLength=2*(d.hull||0),d.edges&&(j.edges=this.getIntArray(d,"edges")),j.width=(d.width||0)*g,j.height=(d.height||0)*g,j}if(e==c.AttachmentType.boundingbox){for(var s=this.attachmentLoader.newBoundingBoxAttachment(a,b),l=d.vertices,o=0,p=l.length;p>o;o++)s.vertices.push(l[o]*g);return s}throw"Unknown attachment type: "+e},readAnimation:function(a,b,d){var e=[],f=0,g=b.slots;for(var h in g)if(g.hasOwnProperty(h)){var i=g[h],j=d.findSlotIndex(h);for(var k in i)if(i.hasOwnProperty(k)){var l=i[k];if("color"==k){var m=new c.ColorTimeline(l.length);m.slotIndex=j;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o],r=q.color,s=this.toColor(r,0),t=this.toColor(r,1),u=this.toColor(r,2),v=this.toColor(r,3);m.setFrame(n,q.time,s,t,u,v),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[5*m.getFrameCount()-5])}else{if("attachment"!=k)throw"Invalid timeline type for a slot: "+k+" ("+h+")";var m=new c.AttachmentTimeline(l.length);m.slotIndex=j;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o];m.setFrame(n++,q.time,q.name)}e.push(m),f=Math.max(f,m.frames[m.getFrameCount()-1])}}}var w=b.bones;for(var x in w)if(w.hasOwnProperty(x)){var y=d.findBoneIndex(x);if(-1==y)throw"Bone not found: "+x;var z=w[x];for(var k in z)if(z.hasOwnProperty(k)){var l=z[k];if("rotate"==k){var m=new c.RotateTimeline(l.length);m.boneIndex=y;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o];m.setFrame(n,q.time,q.angle),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[2*m.getFrameCount()-2])}else if("translate"==k||"scale"==k){var m,A=1;"scale"==k?m=new c.ScaleTimeline(l.length):(m=new c.TranslateTimeline(l.length),A=this.scale),m.boneIndex=y;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o],B=(q.x||0)*A,C=(q.y||0)*A;m.setFrame(n,q.time,B,C),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[3*m.getFrameCount()-3])}else{if("flipX"!=k&&"flipY"!=k)throw"Invalid timeline type for a bone: "+k+" ("+x+")";var B="flipX"==k,m=B?new c.FlipXTimeline(l.length):new c.FlipYTimeline(l.length);m.boneIndex=y;for(var D=B?"x":"y",n=0,o=0,p=l.length;p>o;o++){var q=l[o];m.setFrame(n,q.time,q[D]||!1),n++}e.push(m),f=Math.max(f,m.frames[2*m.getFrameCount()-2])}}}var E=b.ik;for(var F in E)if(E.hasOwnProperty(F)){var G=d.findIkConstraint(F),l=E[F],m=new c.IkConstraintTimeline(l.length);m.ikConstraintIndex=d.ikConstraints.indexOf(G);for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o],H=q.hasOwnProperty("mix")?q.mix:1,I=!q.hasOwnProperty("bendPositive")||q.bendPositive?1:-1;m.setFrame(n,q.time,H,I),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[3*m.frameCount-3])}var J=b.ffd;for(var K in J){var L=d.findSkin(K),i=J[K];for(h in i){var j=d.findSlotIndex(h),M=i[h];for(var N in M){var l=M[N],m=new c.FfdTimeline(l.length),O=L.getAttachment(j,N);if(!O)throw"FFD attachment not found: "+N;m.slotIndex=j,m.attachment=O;var P,Q=O.type==c.AttachmentType.mesh;P=Q?O.vertices.length:O.weights.length/3*2;for(var n=0,o=0,p=l.length;p>o;o++){var R,q=l[o];if(q.vertices){var S=q.vertices,R=[];R.length=P;var T=q.offset||0,U=S.length;if(1==this.scale)for(var V=0;U>V;V++)R[V+T]=S[V];else for(var V=0;U>V;V++)R[V+T]=S[V]*this.scale;if(Q)for(var W=O.vertices,V=0,U=R.length;U>V;V++)R[V]+=W[V]}else Q?R=O.vertices:(R=[],R.length=P);m.setFrame(n,q.time,R),this.readCurve(m,n,q),n++}e[e.length]=m,f=Math.max(f,m.frames[m.frameCount-1])}}}var X=b.drawOrder;if(X||(X=b.draworder),X){for(var m=new c.DrawOrderTimeline(X.length),Y=d.slots.length,n=0,o=0,p=X.length;p>o;o++){var Z=X[o],$=null;if(Z.offsets){$=[],$.length=Y;for(var V=Y-1;V>=0;V--)$[V]=-1;var _=Z.offsets,ab=[];ab.length=Y-_.length;for(var bb=0,cb=0,V=0,U=_.length;U>V;V++){var db=_[V],j=d.findSlotIndex(db.slot);if(-1==j)throw"Slot not found: "+db.slot;for(;bb!=j;)ab[cb++]=bb++;$[bb+db.offset]=bb++}for(;Y>bb;)ab[cb++]=bb++;for(var V=Y-1;V>=0;V--)-1==$[V]&&($[V]=ab[--cb])}m.setFrame(n++,Z.time,$)}e.push(m),f=Math.max(f,m.frames[m.getFrameCount()-1])}var eb=b.events;if(eb){for(var m=new c.EventTimeline(eb.length),n=0,o=0,p=eb.length;p>o;o++){var fb=eb[o],gb=d.findEvent(fb.name);if(!gb)throw"Event not found: "+fb.name;var hb=new c.Event(gb);hb.intValue=fb.hasOwnProperty("int")?fb["int"]:gb.intValue,hb.floatValue=fb.hasOwnProperty("float")?fb["float"]:gb.floatValue,hb.stringValue=fb.hasOwnProperty("string")?fb.string:gb.stringValue,m.setFrame(n++,fb.time,hb)}e.push(m),f=Math.max(f,m.frames[m.getFrameCount()-1])}d.animations.push(new c.Animation(a,e,f))},readCurve:function(a,b,c){var d=c.curve;d?"stepped"==d?a.curves.setStepped(b):d instanceof Array&&a.curves.setCurve(b,d[0],d[1],d[2],d[3]):a.curves.setLinear(b)},toColor:function(a,b){if(8!=a.length)throw"Color hexidecimal length must be 8, recieved: "+a;return parseInt(a.substring(2*b,2*b+2),16)/255},getFloatArray:function(a,b,d){var e=a[b],f=new c.Float32Array(e.length),g=0,h=e.length;if(1==d)for(;h>g;g++)f[g]=e[g];else for(;h>g;g++)f[g]=e[g]*d;return f},getIntArray:function(a,b){for(var d=a[b],e=new c.Uint16Array(d.length),f=0,g=d.length;g>f;f++)e[f]=0|d[f];return e}},c.Atlas=function(a,b){this.textureLoader=b,this.pages=[],this.regions=[];var d=new c.AtlasReader(a),e=[];e.length=4;for(var f=null;;){var g=d.readLine();if(null===g)break;if(g=d.trim(g),g.length)if(f){var h=new c.AtlasRegion;h.name=g,h.page=f,h.rotate="true"==d.readValue(),d.readTuple(e);var i=parseInt(e[0]),j=parseInt(e[1]);d.readTuple(e);var k=parseInt(e[0]),l=parseInt(e[1]);h.u=i/f.width,h.v=j/f.height,h.rotate?(h.u2=(i+l)/f.width,h.v2=(j+k)/f.height):(h.u2=(i+k)/f.width,h.v2=(j+l)/f.height),h.x=i,h.y=j,h.width=Math.abs(k),h.height=Math.abs(l),4==d.readTuple(e)&&(h.splits=[parseInt(e[0]),parseInt(e[1]),parseInt(e[2]),parseInt(e[3])],4==d.readTuple(e)&&(h.pads=[parseInt(e[0]),parseInt(e[1]),parseInt(e[2]),parseInt(e[3])],d.readTuple(e))),h.originalWidth=parseInt(e[0]),h.originalHeight=parseInt(e[1]),d.readTuple(e),h.offsetX=parseInt(e[0]),h.offsetY=parseInt(e[1]),h.index=parseInt(d.readValue()),this.regions.push(h)}else{f=new c.AtlasPage,f.name=g,2==d.readTuple(e)&&(f.width=parseInt(e[0]),f.height=parseInt(e[1]),d.readTuple(e)),f.format=c.Atlas.Format[e[0]],d.readTuple(e),f.minFilter=c.Atlas.TextureFilter[e[0]],f.magFilter=c.Atlas.TextureFilter[e[1]];var m=d.readValue();f.uWrap=c.Atlas.TextureWrap.clampToEdge,f.vWrap=c.Atlas.TextureWrap.clampToEdge,"x"==m?f.uWrap=c.Atlas.TextureWrap.repeat:"y"==m?f.vWrap=c.Atlas.TextureWrap.repeat:"xy"==m&&(f.uWrap=f.vWrap=c.Atlas.TextureWrap.repeat),b.load(f,g,this),this.pages.push(f)}else f=null}},c.Atlas.prototype={findRegion:function(a){for(var b=this.regions,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},dispose:function(){for(var a=this.pages,b=0,c=a.length;c>b;b++)this.textureLoader.unload(a[b].rendererObject)},updateUVs:function(a){for(var b=this.regions,c=0,d=b.length;d>c;c++){var e=b[c];e.page==a&&(e.u=e.x/a.width,e.v=e.y/a.height,e.rotate?(e.u2=(e.x+e.height)/a.width,e.v2=(e.y+e.width)/a.height):(e.u2=(e.x+e.width)/a.width,e.v2=(e.y+e.height)/a.height))}}},c.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},c.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},c.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},c.AtlasPage=function(){},c.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},c.AtlasRegion=function(){},c.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},c.AtlasReader=function(a){this.lines=a.split(/\r\n|\r|\n/)},c.AtlasReader.prototype={index:0,trim:function(a){return a.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var a=this.readLine(),b=a.indexOf(":");if(-1==b)throw"Invalid line: "+a;return this.trim(a.substring(b+1))},readTuple:function(a){var b=this.readLine(),c=b.indexOf(":");if(-1==c)throw"Invalid line: "+b;for(var d=0,e=c+1;3>d;d++){var f=b.indexOf(",",e);if(-1==f)break;a[d]=this.trim(b.substr(e,f-e)),e=f+1}return a[d]=this.trim(b.substring(e)),d+1}},c.AtlasAttachmentLoader=function(a){this.atlas=a},c.AtlasAttachmentLoader.prototype={newRegionAttachment:function(a,b,d){var e=this.atlas.findRegion(d);if(!e)throw"Region not found in atlas: "+d+" (region attachment: "+b+")";var f=new c.RegionAttachment(b);return f.rendererObject=e,f.setUVs(e.u,e.v,e.u2,e.v2,e.rotate),f.regionOffsetX=e.offsetX,f.regionOffsetY=e.offsetY,f.regionWidth=e.width,f.regionHeight=e.height,f.regionOriginalWidth=e.originalWidth,f.regionOriginalHeight=e.originalHeight,f},newMeshAttachment:function(a,b,d){var e=this.atlas.findRegion(d);if(!e)throw"Region not found in atlas: "+d+" (mesh attachment: "+b+")";var f=new c.MeshAttachment(b);return f.rendererObject=e,f.regionU=e.u,f.regionV=e.v,f.regionU2=e.u2,f.regionV2=e.v2,f.regionRotate=e.rotate,f.regionOffsetX=e.offsetX,f.regionOffsetY=e.offsetY,f.regionWidth=e.width,f.regionHeight=e.height,f.regionOriginalWidth=e.originalWidth,f.regionOriginalHeight=e.originalHeight,f},newSkinnedMeshAttachment:function(a,b,d){var e=this.atlas.findRegion(d);if(!e)throw"Region not found in atlas: "+d+" (skinned mesh attachment: "+b+")";var f=new c.SkinnedMeshAttachment(b);return f.rendererObject=e,f.regionU=e.u,f.regionV=e.v,f.regionU2=e.u2,f.regionV2=e.v2,f.regionRotate=e.rotate,f.regionOffsetX=e.offsetX,f.regionOffsetY=e.offsetY,f.regionWidth=e.width,f.regionHeight=e.height,f.regionOriginalWidth=e.originalWidth,f.regionOriginalHeight=e.originalHeight,f},newBoundingBoxAttachment:function(a,b){return new c.BoundingBoxAttachment(b)}},c.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},c.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(a,b){var d=a.slots,e=d.length,f=a.x,g=a.y,h=this.boundingBoxes,i=this.polygonPool,j=this.polygons;h.length=0;for(var k=0,l=j.length;l>k;k++)i.push(j[k]);j.length=0;for(var k=0;e>k;k++){var m=d[k],n=m.attachment;if(n.type==c.AttachmentType.boundingbox){h.push(n);var o,p=i.length;p>0?(o=i[p-1],i.splice(p-1,1)):o=[],j.push(o),o.length=n.vertices.length,n.computeWorldVertices(f,g,m.bone,o)}}b&&this.aabbCompute()},aabbCompute:function(){for(var a=this.polygons,b=Number.MAX_VALUE,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=Number.MIN_VALUE,f=0,g=a.length;g>f;f++)for(var h=a[f],i=0,j=h.length;j>i;i+=2){var k=h[i],l=h[i+1];b=Math.min(b,k),c=Math.min(c,l),d=Math.max(d,k),e=Math.max(e,l)}this.minX=b,this.minY=c,this.maxX=d,this.maxY=e},aabbContainsPoint:function(a,b){return a>=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY},aabbIntersectsSegment:function(a,b,c,d){var e=this.minX,f=this.minY,g=this.maxX,h=this.maxY;if(e>=a&&e>=c||f>=b&&f>=d||a>=g&&c>=g||b>=h&&d>=h)return!1;var i=(d-b)/(c-a),j=i*(e-a)+b;if(j>f&&h>j)return!0;if(j=i*(g-a)+b,j>f&&h>j)return!0;var k=(f-b)/i+a;return k>e&&g>k?!0:(k=(h-b)/i+a,k>e&&g>k?!0:!1)},aabbIntersectsSkeleton:function(a){return this.minXa.minX&&this.minYa.minY},containsPoint:function(a,b){for(var c=this.polygons,d=0,e=c.length;e>d;d++)if(this.polygonContainsPoint(c[d],a,b))return this.boundingBoxes[d];return null},intersectsSegment:function(a,b,c,d){for(var e=this.polygons,f=0,g=e.length;g>f;f++)if(e[f].intersectsSegment(a,b,c,d))return this.boundingBoxes[f];return null},polygonContainsPoint:function(a,b,c){for(var d=a.length,e=d-2,f=!1,g=0;d>g;g+=2){var h=a[g+1],i=a[e+1];if(c>h&&i>=c||c>i&&h>=c){var j=a[g];j+(c-h)/(i-h)*(a[e]-j)l;l+=2){var m=a[l],n=a[l+1],o=j*n-k*m,p=j-m,q=k-n,r=g*q-h*p,s=(i*p-g*o)/r;if((s>=j&&m>=s||s>=m&&j>=s)&&(s>=b&&d>=s||s>=d&&b>=s)){var t=(i*q-h*o)/r;if((t>=k&&n>=t||t>=n&&k>=t)&&(t>=c&&e>=t||t>=e&&c>=t))return!0}j=m,k=n}return!1},getPolygon:function(a){var b=this.boundingBoxes.indexOf(a);return-1==b?null:this.polygons[b]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}},c.Bone.yDown=!0,b.AnimCache={},b.SpineTextureLoader=function(a,c){b.EventTarget.call(this),this.basePath=a,this.crossorigin=c,this.loadingCount=0},b.SpineTextureLoader.prototype=b.SpineTextureLoader,b.SpineTextureLoader.prototype.load=function(a,c){if(a.rendererObject=b.BaseTexture.fromImage(this.basePath+"/"+c,this.crossorigin),!a.rendererObject.hasLoaded){var d=this;++d.loadingCount,a.rendererObject.addEventListener("loaded",function(){--d.loadingCount,d.dispatchEvent({type:"loadedBaseTexture",content:d})})}},b.SpineTextureLoader.prototype.unload=function(a){a.destroy(!0)},b.Spine=function(a){if(b.DisplayObjectContainer.call(this),this.spineData=b.AnimCache[a],!this.spineData)throw new Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: "+a);this.skeleton=new c.Skeleton(this.spineData),this.skeleton.updateWorldTransform(),this.stateData=new c.AnimationStateData(this.spineData),this.state=new c.AnimationState(this.stateData),this.slotContainers=[];for(var d=0,e=this.skeleton.drawOrder.length;e>d;d++){var f=this.skeleton.drawOrder[d],g=f.attachment,h=new b.DisplayObjectContainer;if(this.slotContainers.push(h),this.addChild(h),g instanceof c.RegionAttachment){var i=g.rendererObject.name,j=this.createSprite(f,g);f.currentSprite=j,f.currentSpriteName=i,h.addChild(j)}else{if(!(g instanceof c.MeshAttachment))continue;var k=this.createMesh(f,g);f.currentMesh=k,f.currentMeshName=g.name,h.addChild(k)}}this.autoUpdate=!0},b.Spine.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Spine.prototype.constructor=b.Spine,Object.defineProperty(b.Spine.prototype,"autoUpdate",{get:function(){return this.updateTransform===b.Spine.prototype.autoUpdateTransform},set:function(a){this.updateTransform=a?b.Spine.prototype.autoUpdateTransform:b.DisplayObjectContainer.prototype.updateTransform}}),b.Spine.prototype.update=function(a){this.state.update(a),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var d=this.skeleton.drawOrder,e=0,f=d.length;f>e;e++){var g=d[e],h=g.attachment,i=this.slotContainers[e];if(h){var j=h.type;if(j===c.AttachmentType.region){if(h.rendererObject&&(!g.currentSpriteName||g.currentSpriteName!==h.name)){var k=h.rendererObject.name;if(void 0!==g.currentSprite&&(g.currentSprite.visible=!1),g.sprites=g.sprites||{},void 0!==g.sprites[k])g.sprites[k].visible=!0;else{var l=this.createSprite(g,h);i.addChild(l)}g.currentSprite=g.sprites[k],g.currentSpriteName=k}var m=g.bone;i.position.x=m.worldX+h.x*m.m00+h.y*m.m01,i.position.y=m.worldY+h.x*m.m10+h.y*m.m11,i.scale.x=m.worldScaleX,i.scale.y=m.worldScaleY,i.rotation=-(g.bone.worldRotation*c.degRad),g.currentSprite.tint=b.rgb2hex([g.r,g.g,g.b])}else{if(j!==c.AttachmentType.skinnedmesh){i.visible=!1;continue}if(!g.currentMeshName||g.currentMeshName!==h.name){var n=h.name;if(void 0!==g.currentMesh&&(g.currentMesh.visible=!1),g.meshes=g.meshes||{},void 0!==g.meshes[n])g.meshes[n].visible=!0;else{var o=this.createMesh(g,h);i.addChild(o)}g.currentMesh=g.meshes[n],g.currentMeshName=n}h.computeWorldVertices(g.bone.skeleton.x,g.bone.skeleton.y,g,g.currentMesh.vertices)}i.visible=!0,i.alpha=g.a}else i.visible=!1}},b.Spine.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var a=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(a),b.DisplayObjectContainer.prototype.updateTransform.call(this)},b.Spine.prototype.createSprite=function(a,d){var e=d.rendererObject,f=e.page.rendererObject,g=new b.Rectangle(e.x,e.y,e.rotate?e.height:e.width,e.rotate?e.width:e.height),h=new b.Texture(f,g),i=new b.Sprite(h),j=e.rotate?.5*Math.PI:0;return i.scale.set(e.width/e.originalWidth,e.height/e.originalHeight),i.rotation=j-d.rotation*c.degRad,i.anchor.x=i.anchor.y=.5,a.sprites=a.sprites||{},a.sprites[e.name]=i,i},b.Spine.prototype.createMesh=function(a,c){var d=c.rendererObject,e=d.page.rendererObject,f=new b.Texture(e),g=new b.Strip(f);return g.drawMode=b.Strip.DrawModes.TRIANGLES,g.canvasPadding=1.5,g.vertices=new b.Float32Array(c.uvs.length),g.uvs=c.uvs,g.indices=c.triangles,a.meshes=a.meshes||{},a.meshes[c.name]=g,g},b.BaseTextureCache={},b.BaseTextureCacheIdGenerator=0,b.BaseTexture=function(a,c){if(this.resolution=1,this.width=100,this.height=100,this.scaleMode=c||b.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=a,this._UID=b._UID++,this.premultipliedAlpha=!0,this._glTextures=[],this.mipmap=!1,this._dirty=[!0,!0,!0,!0],a){if((this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this.hasLoaded=!0,this.width=this.source.naturalWidth||this.source.width,this.height=this.source.naturalHeight||this.source.height,this.dirty();else{var d=this;this.source.onload=function(){d.hasLoaded=!0,d.width=d.source.naturalWidth||d.source.width,d.height=d.source.naturalHeight||d.source.height,d.dirty(),d.dispatchEvent({type:"loaded",content:d})},this.source.onerror=function(){d.dispatchEvent({type:"error",content:d})}}this.imageUrl=null,this._powerOf2=!1}},b.BaseTexture.prototype.constructor=b.BaseTexture,b.EventTarget.mixin(b.BaseTexture.prototype),b.BaseTexture.prototype.destroy=function(){this.imageUrl?(delete b.BaseTextureCache[this.imageUrl],delete b.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete b.BaseTextureCache[this.source._pixiId],this.source=null,this.unloadFromGPU()},b.BaseTexture.prototype.updateSourceImage=function(a){this.hasLoaded=!1,this.source.src=null,this.source.src=a},b.BaseTexture.prototype.dirty=function(){for(var a=0;a=0;a--){var c=this._glTextures[a],d=b.glContexts[a];d&&c&&d.deleteTexture(c)}this._glTextures.length=0,this.dirty()},b.BaseTexture.fromImage=function(a,c,d){var e=b.BaseTextureCache[a];if(void 0===c&&-1===a.indexOf("data:")&&(c=!0),!e){var f=new Image;c&&(f.crossOrigin=""),f.src=a,e=new b.BaseTexture(f,d),e.imageUrl=a,b.BaseTextureCache[a]=e,-1!==a.indexOf(b.RETINA_PREFIX+".")&&(e.resolution=2)}return e},b.BaseTexture.fromCanvas=function(a,c){a._pixiId||(a._pixiId="canvas_"+b.TextureCacheIdGenerator++);var d=b.BaseTextureCache[a._pixiId];return d||(d=new b.BaseTexture(a,c),b.BaseTextureCache[a._pixiId]=d),d},b.TextureCache={},b.FrameCache={},b.TextureCacheIdGenerator=0,b.Texture=function(a,c,d,e){this.noFrame=!1,c||(this.noFrame=!0,c=new b.Rectangle(0,0,1,1)),a instanceof b.Texture&&(a=a.baseTexture),this.baseTexture=a,this.frame=c,this.trim=e,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=d||new b.Rectangle(0,0,1,1),a.hasLoaded?(this.noFrame&&(c=new b.Rectangle(0,0,a.width,a.height)),this.setFrame(c)):a.addEventListener("loaded",this.onBaseTextureLoaded.bind(this))},b.Texture.prototype.constructor=b.Texture,b.EventTarget.mixin(b.Texture.prototype),b.Texture.prototype.onBaseTextureLoaded=function(){var a=this.baseTexture;a.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new b.Rectangle(0,0,a.width,a.height)),this.setFrame(this.frame),this.dispatchEvent({type:"update",content:this})},b.Texture.prototype.destroy=function(a){a&&this.baseTexture.destroy(),this.valid=!1},b.Texture.prototype.setFrame=function(a){if(this.noFrame=!1,this.frame=a,this.width=a.width,this.height=a.height,this.crop.x=a.x,this.crop.y=a.y,this.crop.width=a.width,this.crop.height=a.height,!this.trim&&(a.x+a.width>this.baseTexture.width||a.y+a.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=a&&a.width&&a.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs()},b.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new b.TextureUvs);var a=this.crop,c=this.baseTexture.width,d=this.baseTexture.height;this._uvs.x0=a.x/c,this._uvs.y0=a.y/d,this._uvs.x1=(a.x+a.width)/c,this._uvs.y1=a.y/d,this._uvs.x2=(a.x+a.width)/c,this._uvs.y2=(a.y+a.height)/d,this._uvs.x3=a.x/c,this._uvs.y3=(a.y+a.height)/d},b.Texture.fromImage=function(a,c,d){var e=b.TextureCache[a];return e||(e=new b.Texture(b.BaseTexture.fromImage(a,c,d)),b.TextureCache[a]=e),e},b.Texture.fromFrame=function(a){var c=b.TextureCache[a];if(!c)throw new Error('The frameId "'+a+'" does not exist in the texture cache ');return c},b.Texture.fromCanvas=function(a,c){var d=b.BaseTexture.fromCanvas(a,c);return new b.Texture(d)},b.Texture.addTextureToCache=function(a,c){b.TextureCache[c]=a},b.Texture.removeTextureFromCache=function(a){var c=b.TextureCache[a];return delete b.TextureCache[a],delete b.BaseTextureCache[a],c},b.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},b.Texture.emptyTexture=new b.Texture(new b.BaseTexture),b.RenderTexture=function(a,c,d,e,f){if(this.width=a||100,this.height=c||100,this.resolution=f||1,this.frame=new b.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=new b.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.baseTexture=new b.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=e||b.scaleModes.DEFAULT,this.baseTexture.hasLoaded=!0,b.Texture.call(this,this.baseTexture,new b.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution)),this.renderer=d||b.defaultRenderer,this.renderer.type===b.WEBGL_RENDERER){var g=this.renderer.gl;this.baseTexture._dirty[g.id]=!1,this.textureBuffer=new b.FilterTexture(g,this.width,this.height,this.baseTexture.scaleMode),this.baseTexture._glTextures[g.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new b.Point(.5*this.width,.5*-this.height)}else this.render=this.renderCanvas,this.textureBuffer=new b.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()},b.RenderTexture.prototype=Object.create(b.Texture.prototype),b.RenderTexture.prototype.constructor=b.RenderTexture,b.RenderTexture.prototype.resize=function(a,c,d){(a!==this.width||c!==this.height)&&(this.valid=a>0&&c>0,this.width=a,this.height=c,this.frame.width=this.crop.width=a*this.resolution,this.frame.height=this.crop.height=c*this.resolution,d&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===b.WEBGL_RENDERER&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},b.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===b.WEBGL_RENDERER&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},b.RenderTexture.prototype.renderWebGL=function(a,b,c){if(this.valid){var d=a.worldTransform;d.identity(),d.translate(0,2*this.projection.y),b&&d.append(b),d.scale(1,-1),a.worldAlpha=1;for(var e=a.children,f=0,g=e.length;g>f;f++)e[f].updateTransform();var h=this.renderer.gl;h.viewport(0,0,this.width*this.resolution,this.height*this.resolution),h.bindFramebuffer(h.FRAMEBUFFER,this.textureBuffer.frameBuffer),c&&this.textureBuffer.clear(),this.renderer.spriteBatch.dirty=!0,this.renderer.renderDisplayObject(a,this.projection,this.textureBuffer.frameBuffer),this.renderer.spriteBatch.dirty=!0}},b.RenderTexture.prototype.renderCanvas=function(a,b,c){if(this.valid){var d=a.worldTransform;d.identity(),b&&d.append(b),a.worldAlpha=1;for(var e=a.children,f=0,g=e.length;g>f;f++)e[f].updateTransform();c&&this.textureBuffer.clear();var h=this.textureBuffer.context,i=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(a,h),this.renderer.resolution=i}},b.RenderTexture.prototype.getImage=function(){var a=new Image;return a.src=this.getBase64(),a},b.RenderTexture.prototype.getBase64=function(){return this.getCanvas().toDataURL()},b.RenderTexture.prototype.getCanvas=function(){if(this.renderer.type===b.WEBGL_RENDERER){var a=this.renderer.gl,c=this.textureBuffer.width,d=this.textureBuffer.height,e=new Uint8Array(4*c*d);a.bindFramebuffer(a.FRAMEBUFFER,this.textureBuffer.frameBuffer),a.readPixels(0,0,c,d,a.RGBA,a.UNSIGNED_BYTE,e),a.bindFramebuffer(a.FRAMEBUFFER,null);var f=new b.CanvasBuffer(c,d),g=f.context.getImageData(0,0,c,d);return g.data.set(e),f.context.putImageData(g,0,0),f.canvas}return this.textureBuffer.canvas},b.RenderTexture.tempMatrix=new b.Matrix,b.VideoTexture=function(a,c){if(!a)throw new Error("No video source element specified.");(a.readyState===a.HAVE_ENOUGH_DATA||a.readyState===a.HAVE_FUTURE_DATA)&&a.width&&a.height&&(a.complete=!0),b.BaseTexture.call(this,a,c),this.autoUpdate=!1,this.updateBound=this._onUpdate.bind(this),a.complete||(this._onCanPlay=this.onCanPlay.bind(this),a.addEventListener("canplay",this._onCanPlay),a.addEventListener("canplaythrough",this._onCanPlay),a.addEventListener("play",this.onPlayStart.bind(this)),a.addEventListener("pause",this.onPlayStop.bind(this)))},b.VideoTexture.prototype=Object.create(b.BaseTexture.prototype),b.VideoTexture.constructor=b.VideoTexture,b.VideoTexture.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this.updateBound),this.dirty())},b.VideoTexture.prototype.onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this.updateBound),this.autoUpdate=!0)},b.VideoTexture.prototype.onPlayStop=function(){this.autoUpdate=!1},b.VideoTexture.prototype.onCanPlay=function(){"canplaythrough"===event.type&&(this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.__loaded||(this.__loaded=!0,this.dispatchEvent({type:"loaded",content:this}))))},b.VideoTexture.prototype.destroy=function(){this.source&&this.source._pixiId&&(b.BaseTextureCache[this.source._pixiId]=null,delete b.BaseTextureCache[this.source._pixiId],this.source._pixiId=null,delete this.source._pixiId),b.BaseTexture.prototype.destroy.call(this)},b.VideoTexture.baseTextureFromVideo=function(a,c){a._pixiId||(a._pixiId="video_"+b.TextureCacheIdGenerator++);var d=b.BaseTextureCache[a._pixiId];return d||(d=new b.VideoTexture(a,c),b.BaseTextureCache[a._pixiId]=d),d},b.VideoTexture.textureFromVideo=function(a,c){var d=b.VideoTexture.baseTextureFromVideo(a,c);return new b.Texture(d)},b.VideoTexture.fromUrl=function(a,c){var d=document.createElement("video");return d.src=a,d.autoPlay=!0,d.play(),b.VideoTexture.textureFromVideo(d,c)},b.AssetLoader=function(a,c){this.assetURLs=a,this.crossorigin=c,this.loadersByType={jpg:b.ImageLoader,jpeg:b.ImageLoader,png:b.ImageLoader,gif:b.ImageLoader,webp:b.ImageLoader,json:b.JsonLoader,atlas:b.AtlasLoader,anim:b.SpineLoader,xml:b.BitmapFontLoader,fnt:b.BitmapFontLoader}},b.EventTarget.mixin(b.AssetLoader.prototype),b.AssetLoader.prototype.constructor=b.AssetLoader,b.AssetLoader.prototype._getDataType=function(a){var b="data:",c=a.slice(0,b.length).toLowerCase();if(c===b){var d=a.slice(b.length),e=d.indexOf(",");if(-1===e)return null;var f=d.slice(0,e).split(";")[0];return f&&"text/plain"!==f.toLowerCase()?f.split("/").pop().toLowerCase():"txt"}return null},b.AssetLoader.prototype.load=function(){function a(a){b.onAssetLoaded(a.data.content)}var b=this;this.loadCount=this.assetURLs.length;for(var c=0;c0?a.addEventListener("loadedBaseTexture",function(a){a.content.content.loadingCount<=0&&o.onLoaded()}):o.onLoaded()},n.load()}else this.onLoaded()},b.JsonLoader.prototype.onLoaded=function(){this.loaded=!0,this.dispatchEvent({type:"loaded",content:this})},b.JsonLoader.prototype.onError=function(){this.dispatchEvent({type:"error",content:this})},b.AtlasLoader=function(a,b){this.url=a,this.baseUrl=a.replace(/[^\/]*$/,""),this.crossorigin=b,this.loaded=!1},b.AtlasLoader.constructor=b.AtlasLoader,b.EventTarget.mixin(b.AtlasLoader.prototype),b.AtlasLoader.prototype.load=function(){this.ajaxRequest=new b.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onAtlasLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/json"),this.ajaxRequest.send(null)},b.AtlasLoader.prototype.onAtlasLoaded=function(){if(4===this.ajaxRequest.readyState)if(200===this.ajaxRequest.status||-1===window.location.href.indexOf("http")){this.atlas={meta:{image:[]},frames:[]};var a=this.ajaxRequest.responseText.split(/\r?\n/),c=-3,d=0,e=null,f=!1,g=0,h=0,i=this.onLoaded.bind(this);for(g=0;g0){if(f===g)this.atlas.meta.image.push(a[g]),d=this.atlas.meta.image.length-1,this.atlas.frames.push({}),c=-3;else if(c>0)if(c%7===1)null!=e&&(this.atlas.frames[d][e.name]=e),e={name:a[g],frame:{}};else{var j=a[g].split(" ");if(c%7===3)e.frame.x=Number(j[1].replace(",","")),e.frame.y=Number(j[2]);else if(c%7===4)e.frame.w=Number(j[1].replace(",","")),e.frame.h=Number(j[2]);else if(c%7===5){var k={x:0,y:0,w:Number(j[1].replace(",","")),h:Number(j[2])};k.w>e.frame.w||k.h>e.frame.h?(e.trimmed=!0,e.realSize=k):e.trimmed=!1}}c++}if(null!=e&&(this.atlas.frames[d][e.name]=e),this.atlas.meta.image.length>0){for(this.images=[],h=0;hthis.currentImageId?(this.currentImageId++,this.images[this.currentImageId].load()):(this.loaded=!0,this.emit("loaded",{content:this}))},b.AtlasLoader.prototype.onError=function(){this.emit("error",{content:this})},b.SpriteSheetLoader=function(a,b){this.url=a,this.crossorigin=b,this.baseUrl=a.replace(/[^\/]*$/,""),this.texture=null,this.frames={}},b.SpriteSheetLoader.prototype.constructor=b.SpriteSheetLoader,b.EventTarget.mixin(b.SpriteSheetLoader.prototype),b.SpriteSheetLoader.prototype.load=function(){var a=this,c=new b.JsonLoader(this.url,this.crossorigin);c.on("loaded",function(b){a.json=b.data.content.json,a.onLoaded()}),c.load()},b.SpriteSheetLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},b.ImageLoader=function(a,c){this.texture=b.Texture.fromImage(a,c),this.frames=[]},b.ImageLoader.prototype.constructor=b.ImageLoader,b.EventTarget.mixin(b.ImageLoader.prototype),b.ImageLoader.prototype.load=function(){this.texture.baseTexture.hasLoaded?this.onLoaded():this.texture.baseTexture.on("loaded",this.onLoaded.bind(this))},b.ImageLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},b.ImageLoader.prototype.loadFramedSpriteSheet=function(a,c,d){this.frames=[];for(var e=Math.floor(this.texture.width/a),f=Math.floor(this.texture.height/c),g=0,h=0;f>h;h++)for(var i=0;e>i;i++,g++){var j=new b.Texture(this.texture.baseTexture,{x:i*a,y:h*c,width:a,height:c});this.frames.push(j),d&&(b.TextureCache[d+"-"+g]=j)}this.load()},b.BitmapFontLoader=function(a,b){this.url=a,this.crossorigin=b,this.baseUrl=a.replace(/[^\/]*$/,""),this.texture=null},b.BitmapFontLoader.prototype.constructor=b.BitmapFontLoader,b.EventTarget.mixin(b.BitmapFontLoader.prototype),b.BitmapFontLoader.prototype.load=function(){this.ajaxRequest=new b.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onXMLLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/xml"),this.ajaxRequest.send(null)},b.BitmapFontLoader.prototype.onXMLLoaded=function(){if(4===this.ajaxRequest.readyState&&(200===this.ajaxRequest.status||-1===window.location.protocol.indexOf("http"))){var a=this.ajaxRequest.responseXML;if(!a||/MSIE 9/i.test(navigator.userAgent)||navigator.isCocoonJS)if("function"==typeof window.DOMParser){var c=new DOMParser;a=c.parseFromString(this.ajaxRequest.responseText,"text/xml")}else{var d=document.createElement("div");d.innerHTML=this.ajaxRequest.responseText,a=d}var e=this.baseUrl+a.getElementsByTagName("page")[0].getAttribute("file"),f=new b.ImageLoader(e,this.crossorigin);this.texture=f.texture.baseTexture;var g={},h=a.getElementsByTagName("info")[0],i=a.getElementsByTagName("common")[0];g.font=h.getAttribute("face"),g.size=parseInt(h.getAttribute("size"),10),g.lineHeight=parseInt(i.getAttribute("lineHeight"),10),g.chars={};for(var j=a.getElementsByTagName("char"),k=0;ka;a++)this.shaders[a].dirty=!0},b.AlphaMaskFilter=function(a){b.AbstractFilter.call(this),this.passes=[this],a.baseTexture._powerOf2=!0,this.uniforms={mask:{type:"sampler2D",value:a},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},a.baseTexture.hasLoaded?(this.uniforms.mask.value.x=a.width,this.uniforms.mask.value.y=a.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),a.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D mask;","uniform sampler2D uSampler;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," mapCords *= dimensions.xy / mapDimensions;"," vec4 original = texture2D(uSampler, vTextureCoord);"," float maskAlpha = texture2D(mask, mapCords).r;"," original *= maskAlpha;"," gl_FragColor = original;","}"]},b.AlphaMaskFilter.prototype=Object.create(b.AbstractFilter.prototype),b.AlphaMaskFilter.prototype.constructor=b.AlphaMaskFilter,b.AlphaMaskFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.mask.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.mask.value.height,this.uniforms.mask.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(b.AlphaMaskFilter.prototype,"map",{get:function(){return this.uniforms.mask.value},set:function(a){this.uniforms.mask.value=a}}),b.ColorMatrixFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={matrix:{type:"mat4",value:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform mat4 matrix;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * matrix;","}"]},b.ColorMatrixFilter.prototype=Object.create(b.AbstractFilter.prototype),b.ColorMatrixFilter.prototype.constructor=b.ColorMatrixFilter,Object.defineProperty(b.ColorMatrixFilter.prototype,"matrix",{get:function(){return this.uniforms.matrix.value},set:function(a){this.uniforms.matrix.value=a}}),b.GrayFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={gray:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float gray;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);","}"]},b.GrayFilter.prototype=Object.create(b.AbstractFilter.prototype),b.GrayFilter.prototype.constructor=b.GrayFilter,Object.defineProperty(b.GrayFilter.prototype,"gray",{get:function(){return this.uniforms.gray.value},set:function(a){this.uniforms.gray.value=a}}),b.DisplacementFilter=function(a){b.AbstractFilter.call(this),this.passes=[this],a.baseTexture._powerOf2=!0,this.uniforms={displacementMap:{type:"sampler2D",value:a},scale:{type:"2f",value:{x:30,y:30}},offset:{type:"2f",value:{x:0,y:0}},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},a.baseTexture.hasLoaded?(this.uniforms.mapDimensions.value.x=a.width,this.uniforms.mapDimensions.value.y=a.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),a.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D displacementMap;","uniform sampler2D uSampler;","uniform vec2 scale;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," vec2 matSample = texture2D(displacementMap, mapCords).xy;"," matSample -= 0.5;"," matSample *= scale;"," matSample /= mapDimensions;"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);"," vec2 cord = vTextureCoord;","}"]},b.DisplacementFilter.prototype=Object.create(b.AbstractFilter.prototype),b.DisplacementFilter.prototype.constructor=b.DisplacementFilter,b.DisplacementFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.displacementMap.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.displacementMap.value.height,this.uniforms.displacementMap.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(b.DisplacementFilter.prototype,"map",{get:function(){return this.uniforms.displacementMap.value},set:function(a){this.uniforms.displacementMap.value=a}}),Object.defineProperty(b.DisplacementFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(a){this.uniforms.scale.value=a}}),Object.defineProperty(b.DisplacementFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(a){this.uniforms.offset.value=a}}),b.PixelateFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:0},dimensions:{type:"4fv",value:new b.Float32Array([1e4,100,10,10])},pixelSize:{type:"2f",value:{x:10,y:10}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 testDim;","uniform vec4 dimensions;","uniform vec2 pixelSize;","uniform sampler2D uSampler;","void main(void) {"," vec2 coord = vTextureCoord;"," vec2 size = dimensions.xy/pixelSize;"," vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;"," gl_FragColor = texture2D(uSampler, color);","}"]},b.PixelateFilter.prototype=Object.create(b.AbstractFilter.prototype),b.PixelateFilter.prototype.constructor=b.PixelateFilter,Object.defineProperty(b.PixelateFilter.prototype,"size",{get:function(){return this.uniforms.pixelSize.value},set:function(a){this.dirty=!0,this.uniforms.pixelSize.value=a}}),b.BlurXFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;"," gl_FragColor = sum;","}"]},b.BlurXFilter.prototype=Object.create(b.AbstractFilter.prototype),b.BlurXFilter.prototype.constructor=b.BlurXFilter,Object.defineProperty(b.BlurXFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(a){this.dirty=!0,this.uniforms.blur.value=1/7e3*a}}),b.BlurYFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;"," gl_FragColor = sum;","}"]},b.BlurYFilter.prototype=Object.create(b.AbstractFilter.prototype),b.BlurYFilter.prototype.constructor=b.BlurYFilter,Object.defineProperty(b.BlurYFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(a){this.uniforms.blur.value=1/7e3*a}}),b.BlurFilter=function(){this.blurXFilter=new b.BlurXFilter,this.blurYFilter=new b.BlurYFilter,this.passes=[this.blurXFilter,this.blurYFilter]},b.BlurFilter.prototype=Object.create(b.AbstractFilter.prototype),b.BlurFilter.prototype.constructor=b.BlurFilter,Object.defineProperty(b.BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(a){this.blurXFilter.blur=this.blurYFilter.blur=a}}),Object.defineProperty(b.BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(a){this.blurXFilter.blur=a}}),Object.defineProperty(b.BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(a){this.blurYFilter.blur=a}}),b.InvertFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);","}"]},b.InvertFilter.prototype=Object.create(b.AbstractFilter.prototype),b.InvertFilter.prototype.constructor=b.InvertFilter,Object.defineProperty(b.InvertFilter.prototype,"invert",{get:function(){return this.uniforms.invert.value},set:function(a){this.uniforms.invert.value=a}}),b.SepiaFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={sepia:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float sepia;","uniform sampler2D uSampler;","const mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);","}"]},b.SepiaFilter.prototype=Object.create(b.AbstractFilter.prototype),b.SepiaFilter.prototype.constructor=b.SepiaFilter,Object.defineProperty(b.SepiaFilter.prototype,"sepia",{get:function(){return this.uniforms.sepia.value},set:function(a){this.uniforms.sepia.value=a}}),b.TwistFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"2f",value:{x:.5,y:.5}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float radius;","uniform float angle;","uniform vec2 offset;","void main(void) {"," vec2 coord = vTextureCoord - offset;"," float distance = length(coord);"," if (distance < radius) {"," float ratio = (radius - distance) / radius;"," float angleMod = ratio * ratio * angle;"," float s = sin(angleMod);"," float c = cos(angleMod);"," coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);"," }"," gl_FragColor = texture2D(uSampler, coord+offset);","}"]},b.TwistFilter.prototype=Object.create(b.AbstractFilter.prototype),b.TwistFilter.prototype.constructor=b.TwistFilter,Object.defineProperty(b.TwistFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(a){this.dirty=!0,this.uniforms.offset.value=a}}),Object.defineProperty(b.TwistFilter.prototype,"radius",{get:function(){return this.uniforms.radius.value},set:function(a){this.dirty=!0,this.uniforms.radius.value=a}}),Object.defineProperty(b.TwistFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(a){this.dirty=!0,this.uniforms.angle.value=a}}),b.ColorStepFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={step:{type:"1f",value:5}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float step;","void main(void) {"," vec4 color = texture2D(uSampler, vTextureCoord);"," color = floor(color * step) / step;"," gl_FragColor = color;","}"]},b.ColorStepFilter.prototype=Object.create(b.AbstractFilter.prototype),b.ColorStepFilter.prototype.constructor=b.ColorStepFilter,Object.defineProperty(b.ColorStepFilter.prototype,"step",{get:function(){return this.uniforms.step.value},set:function(a){this.uniforms.step.value=a}}),b.DotScreenFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float angle;","uniform float scale;","float pattern() {"," float s = sin(angle), c = cos(angle);"," vec2 tex = vTextureCoord * dimensions.xy;"," vec2 point = vec2("," c * tex.x - s * tex.y,"," s * tex.x + c * tex.y"," ) * scale;"," return (sin(point.x) * sin(point.y)) * 4.0;","}","void main() {"," vec4 color = texture2D(uSampler, vTextureCoord);"," float average = (color.r + color.g + color.b) / 3.0;"," gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);","}"]},b.DotScreenFilter.prototype=Object.create(b.AbstractFilter.prototype),b.DotScreenFilter.prototype.constructor=b.DotScreenFilter,Object.defineProperty(b.DotScreenFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(a){this.dirty=!0,this.uniforms.scale.value=a}}),Object.defineProperty(b.DotScreenFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(a){this.dirty=!0,this.uniforms.angle.value=a}}),b.CrossHatchFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);"," gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"," if (lum < 1.00) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.75) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.50) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.3) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }","}"]},b.CrossHatchFilter.prototype=Object.create(b.AbstractFilter.prototype),b.CrossHatchFilter.prototype.constructor=b.CrossHatchFilter,Object.defineProperty(b.CrossHatchFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(a){this.uniforms.blur.value=1/7e3*a}}),b.RGBSplitFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={red:{type:"2f",value:{x:20,y:20}},green:{type:"2f",value:{x:-20,y:20}},blue:{type:"2f",value:{x:20,y:-20}},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 red;","uniform vec2 green;","uniform vec2 blue;","uniform vec4 dimensions;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;"," gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;"," gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;"," gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;","}"]},b.RGBSplitFilter.prototype=Object.create(b.AbstractFilter.prototype),b.RGBSplitFilter.prototype.constructor=b.RGBSplitFilter,Object.defineProperty(b.RGBSplitFilter.prototype,"red",{get:function(){return this.uniforms.red.value},set:function(a){this.uniforms.red.value=a}}),Object.defineProperty(b.RGBSplitFilter.prototype,"green",{get:function(){return this.uniforms.green.value},set:function(a){this.uniforms.green.value=a}}),Object.defineProperty(b.RGBSplitFilter.prototype,"blue",{get:function(){return this.uniforms.blue.value},set:function(a){this.uniforms.blue.value=a}}),"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.PIXI=b):"undefined"!=typeof define&&define.amd?define(b):a.PIXI=b}).call(this); +(function(){var a=this,b=b||{};b.WEBGL_RENDERER=0,b.CANVAS_RENDERER=1,b.VERSION="v2.2.8",b.blendModes={NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},b.scaleModes={DEFAULT:0,LINEAR:0,NEAREST:1},b._UID=0,"undefined"!=typeof Float32Array?(b.Float32Array=Float32Array,b.Uint16Array=Uint16Array,b.Uint32Array=Uint32Array,b.ArrayBuffer=ArrayBuffer):(b.Float32Array=Array,b.Uint16Array=Array),b.INTERACTION_FREQUENCY=30,b.AUTO_PREVENT_DEFAULT=!0,b.PI_2=2*Math.PI,b.RAD_TO_DEG=180/Math.PI,b.DEG_TO_RAD=Math.PI/180,b.RETINA_PREFIX="@2x",b.dontSayHello=!1,b.defaultRenderOptions={view:null,transparent:!1,antialias:!1,preserveDrawingBuffer:!1,resolution:1,clearBeforeRender:!0,autoResize:!1},b.sayHello=function(a){if(!b.dontSayHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var c=["%c %c %c Pixi.js "+b.VERSION+" - "+a+" %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ ","background: #ff66a5","background: #ff66a5","color: #ff66a5; background: #030307;","background: #ff66a5","background: #ffc3dc","background: #ff66a5","color: #ff2424; background: #fff","color: #ff2424; background: #fff","color: #ff2424; background: #fff"];console.log.apply(console,c)}else window.console&&console.log("Pixi.js "+b.VERSION+" - http://www.pixijs.com/");b.dontSayHello=!0}},b.Point=function(a,b){this.x=a||0,this.y=b||0},b.Point.prototype.clone=function(){return new b.Point(this.x,this.y)},b.Point.prototype.set=function(a,b){this.x=a||0,this.y=b||(0!==b?this.x:0)},b.Point.prototype.constructor=b.Point,b.Rectangle=function(a,b,c,d){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0},b.Rectangle.prototype.clone=function(){return new b.Rectangle(this.x,this.y,this.width,this.height)},b.Rectangle.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=this.x;if(a>=c&&a<=c+this.width){var d=this.y;if(b>=d&&b<=d+this.height)return!0}return!1},b.Rectangle.prototype.constructor=b.Rectangle,b.EmptyRectangle=new b.Rectangle(0,0,0,0),b.Polygon=function(a){if(a instanceof Array||(a=Array.prototype.slice.call(arguments)),a[0]instanceof b.Point){for(var c=[],d=0,e=a.length;e>d;d++)c.push(a[d].x,a[d].y);a=c}this.closed=!0,this.points=a},b.Polygon.prototype.clone=function(){var a=this.points.slice();return new b.Polygon(a)},b.Polygon.prototype.contains=function(a,b){for(var c=!1,d=this.points.length/2,e=0,f=d-1;d>e;f=e++){var g=this.points[2*e],h=this.points[2*e+1],i=this.points[2*f],j=this.points[2*f+1],k=h>b!=j>b&&(i-g)*(b-h)/(j-h)+g>a;k&&(c=!c)}return c},b.Polygon.prototype.constructor=b.Polygon,b.Circle=function(a,b,c){this.x=a||0,this.y=b||0,this.radius=c||0},b.Circle.prototype.clone=function(){return new b.Circle(this.x,this.y,this.radius)},b.Circle.prototype.contains=function(a,b){if(this.radius<=0)return!1;var c=this.x-a,d=this.y-b,e=this.radius*this.radius;return c*=c,d*=d,e>=c+d},b.Circle.prototype.getBounds=function(){return new b.Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},b.Circle.prototype.constructor=b.Circle,b.Ellipse=function(a,b,c,d){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0},b.Ellipse.prototype.clone=function(){return new b.Ellipse(this.x,this.y,this.width,this.height)},b.Ellipse.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=(a-this.x)/this.width,d=(b-this.y)/this.height;return c*=c,d*=d,1>=c+d},b.Ellipse.prototype.getBounds=function(){return new b.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},b.Ellipse.prototype.constructor=b.Ellipse,b.RoundedRectangle=function(a,b,c,d,e){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0,this.radius=e||20},b.RoundedRectangle.prototype.clone=function(){return new b.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},b.RoundedRectangle.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=this.x;if(a>=c&&a<=c+this.width){var d=this.y;if(b>=d&&b<=d+this.height)return!0}return!1},b.RoundedRectangle.prototype.constructor=b.RoundedRectangle,b.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},b.Matrix.prototype.fromArray=function(a){this.a=a[0],this.b=a[1],this.c=a[3],this.d=a[4],this.tx=a[2],this.ty=a[5]},b.Matrix.prototype.toArray=function(a){this.array||(this.array=new b.Float32Array(9));var c=this.array;return a?(c[0]=this.a,c[1]=this.b,c[2]=0,c[3]=this.c,c[4]=this.d,c[5]=0,c[6]=this.tx,c[7]=this.ty,c[8]=1):(c[0]=this.a,c[1]=this.c,c[2]=this.tx,c[3]=this.b,c[4]=this.d,c[5]=this.ty,c[6]=0,c[7]=0,c[8]=1),c},b.Matrix.prototype.apply=function(a,c){return c=c||new b.Point,c.x=this.a*a.x+this.c*a.y+this.tx,c.y=this.b*a.x+this.d*a.y+this.ty,c},b.Matrix.prototype.applyInverse=function(a,c){c=c||new b.Point;var d=1/(this.a*this.d+this.c*-this.b);return c.x=this.d*d*a.x+-this.c*d*a.y+(this.ty*this.c-this.tx*this.d)*d,c.y=this.a*d*a.y+-this.b*d*a.x+(-this.ty*this.a+this.tx*this.b)*d,c},b.Matrix.prototype.translate=function(a,b){return this.tx+=a,this.ty+=b,this},b.Matrix.prototype.scale=function(a,b){return this.a*=a,this.d*=b,this.c*=a,this.b*=b,this.tx*=a,this.ty*=b,this},b.Matrix.prototype.rotate=function(a){var b=Math.cos(a),c=Math.sin(a),d=this.a,e=this.c,f=this.tx;return this.a=d*b-this.b*c,this.b=d*c+this.b*b,this.c=e*b-this.d*c,this.d=e*c+this.d*b,this.tx=f*b-this.ty*c,this.ty=f*c+this.ty*b,this},b.Matrix.prototype.append=function(a){var b=this.a,c=this.b,d=this.c,e=this.d;return this.a=a.a*b+a.b*d,this.b=a.a*c+a.b*e,this.c=a.c*b+a.d*d,this.d=a.c*c+a.d*e,this.tx=a.tx*b+a.ty*d+this.tx,this.ty=a.tx*c+a.ty*e+this.ty,this},b.Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},b.identityMatrix=new b.Matrix,b.DisplayObject=function(){this.position=new b.Point,this.scale=new b.Point(1,1),this.pivot=new b.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new b.Matrix,this._sr=0,this._cr=1,this.filterArea=null,this._bounds=new b.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},b.DisplayObject.prototype.constructor=b.DisplayObject,Object.defineProperty(b.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(a){this._interactive=a,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(b.DisplayObject.prototype,"worldVisible",{get:function(){var a=this;do{if(!a.visible)return!1;a=a.parent}while(a);return!0}}),Object.defineProperty(b.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(a){this._mask&&(this._mask.isMask=!1),this._mask=a,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(b.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(a){if(a){for(var b=[],c=0;c=0&&b<=this.children.length)return a.parent&&a.parent.removeChild(a),a.parent=this,this.children.splice(b,0,a),this.stage&&a.setStageReference(this.stage),a;throw new Error(a+"addChildAt: The index "+b+" supplied is out of bounds "+this.children.length)},b.DisplayObjectContainer.prototype.swapChildren=function(a,b){if(a!==b){var c=this.getChildIndex(a),d=this.getChildIndex(b);if(0>c||0>d)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[c]=b,this.children[d]=a}},b.DisplayObjectContainer.prototype.getChildIndex=function(a){var b=this.children.indexOf(a);if(-1===b)throw new Error("The supplied DisplayObject must be a child of the caller");return b},b.DisplayObjectContainer.prototype.setChildIndex=function(a,b){if(0>b||b>=this.children.length)throw new Error("The supplied index is out of bounds");var c=this.getChildIndex(a);this.children.splice(c,1),this.children.splice(b,0,a)},b.DisplayObjectContainer.prototype.getChildAt=function(a){if(0>a||a>=this.children.length)throw new Error("getChildAt: Supplied index "+a+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[a]},b.DisplayObjectContainer.prototype.removeChild=function(a){var b=this.children.indexOf(a);if(-1!==b)return this.removeChildAt(b)},b.DisplayObjectContainer.prototype.removeChildAt=function(a){var b=this.getChildAt(a);return this.stage&&b.removeStageReference(),b.parent=void 0,this.children.splice(a,1),b},b.DisplayObjectContainer.prototype.removeChildren=function(a,b){var c=a||0,d="number"==typeof b?b:this.children.length,e=d-c;if(e>0&&d>=e){for(var f=this.children.splice(c,e),g=0;ga;a++)this.children[a].updateTransform()},b.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=b.DisplayObjectContainer.prototype.updateTransform,b.DisplayObjectContainer.prototype.getBounds=function(){if(0===this.children.length)return b.EmptyRectangle;for(var a,c,d,e=1/0,f=1/0,g=-(1/0),h=-(1/0),i=!1,j=0,k=this.children.length;k>j;j++){var l=this.children[j];l.visible&&(i=!0,a=this.children[j].getBounds(),e=ec?g:c,h=h>d?h:d)}if(!i)return b.EmptyRectangle;var m=this._bounds;return m.x=e,m.y=f,m.width=g-e,m.height=h-f,m},b.DisplayObjectContainer.prototype.getLocalBounds=function(){var a=this.worldTransform;this.worldTransform=b.identityMatrix;for(var c=0,d=this.children.length;d>c;c++)this.children[c].updateTransform();var e=this.getBounds();return this.worldTransform=a,e},b.DisplayObjectContainer.prototype.setStageReference=function(a){this.stage=a,this._interactive&&(this.stage.dirty=!0);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d.setStageReference(a)}},b.DisplayObjectContainer.prototype.removeStageReference=function(){for(var a=0,b=this.children.length;b>a;a++){var c=this.children[a];c.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},b.DisplayObjectContainer.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(a);var b,c;if(this._mask||this._filters){for(this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._mask&&a.maskManager.popMask(this._mask,a),this._filters&&a.filterManager.popFilter(),a.spriteBatch.start()}else for(b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},b.DisplayObjectContainer.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(a);this._mask&&a.maskManager.pushMask(this._mask,a);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d._renderCanvas(a)}this._mask&&a.maskManager.popMask(a)}},b.Sprite=function(a){b.DisplayObjectContainer.call(this),this.anchor=new b.Point,this.texture=a||b.Texture.emptyTexture,this._width=0,this._height=0,this.tint=16777215,this.blendMode=b.blendModes.NORMAL,this.shader=null,this.texture.baseTexture.hasLoaded?this.onTextureUpdate():this.texture.on("update",this.onTextureUpdate.bind(this)),this.renderable=!0},b.Sprite.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Sprite.prototype.constructor=b.Sprite,Object.defineProperty(b.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(a){this.scale.x=a/this.texture.frame.width,this._width=a}}),Object.defineProperty(b.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(a){this.scale.y=a/this.texture.frame.height,this._height=a}}),b.Sprite.prototype.setTexture=function(a){this.texture=a,this.cachedTint=16777215},b.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height)},b.Sprite.prototype.getBounds=function(a){var b=this.texture.frame.width,c=this.texture.frame.height,d=b*(1-this.anchor.x),e=b*-this.anchor.x,f=c*(1-this.anchor.y),g=c*-this.anchor.y,h=a||this.worldTransform,i=h.a,j=h.b,k=h.c,l=h.d,m=h.tx,n=h.ty,o=-(1/0),p=-(1/0),q=1/0,r=1/0;if(0===j&&0===k)0>i&&(i*=-1),0>l&&(l*=-1),q=i*e+m,o=i*d+m,r=l*g+n,p=l*f+n;else{var s=i*e+k*g+m,t=l*g+j*e+n,u=i*d+k*g+m,v=l*g+j*d+n,w=i*d+k*f+m,x=l*f+j*d+n,y=i*e+k*f+m,z=l*f+j*e+n;q=q>s?s:q,q=q>u?u:q,q=q>w?w:q,q=q>y?y:q,r=r>t?t:r,r=r>v?v:r,r=r>x?x:r,r=r>z?z:r,o=s>o?s:o,o=u>o?u:o,o=w>o?w:o,o=y>o?y:o,p=t>p?t:p,p=v>p?v:p,p=x>p?x:p,p=z>p?z:p}var A=this._bounds;return A.x=q,A.width=o-q,A.y=r,A.height=p-r,this._currentBounds=A,A},b.Sprite.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){var b,c;if(this._mask||this._filters){var d=a.spriteBatch;for(this._filters&&(d.flush(),a.filterManager.pushFilter(this._filterBlock)),this._mask&&(d.stop(),a.maskManager.pushMask(this.mask,a),d.start()),d.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);d.stop(),this._mask&&a.maskManager.popMask(this._mask,a),this._filters&&a.filterManager.popFilter(),d.start()}else for(a.spriteBatch.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},b.Sprite.prototype._renderCanvas=function(a){if(!(this.visible===!1||0===this.alpha||this.texture.crop.width<=0||this.texture.crop.height<=0)){if(this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,a.context.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]),this._mask&&a.maskManager.pushMask(this._mask,a),this.texture.valid){var c=this.texture.baseTexture.resolution/a.resolution;a.context.globalAlpha=this.worldAlpha,a.smoothProperty&&a.scaleMode!==this.texture.baseTexture.scaleMode&&(a.scaleMode=this.texture.baseTexture.scaleMode,a.context[a.smoothProperty]=a.scaleMode===b.scaleModes.LINEAR);var d=this.texture.trim?this.texture.trim.x-this.anchor.x*this.texture.trim.width:this.anchor.x*-this.texture.frame.width,e=this.texture.trim?this.texture.trim.y-this.anchor.y*this.texture.trim.height:this.anchor.y*-this.texture.frame.height;a.roundPixels?(a.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*a.resolution|0,this.worldTransform.ty*a.resolution|0),d=0|d,e=0|e):a.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*a.resolution,this.worldTransform.ty*a.resolution),16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=b.CanvasTinter.getTintedTexture(this,this.tint)),a.context.drawImage(this.tintedTexture,0,0,this.texture.crop.width,this.texture.crop.height,d/c,e/c,this.texture.crop.width/c,this.texture.crop.height/c)):a.context.drawImage(this.texture.baseTexture.source,this.texture.crop.x,this.texture.crop.y,this.texture.crop.width,this.texture.crop.height,d/c,e/c,this.texture.crop.width/c,this.texture.crop.height/c)}for(var f=0,g=this.children.length;g>f;f++)this.children[f]._renderCanvas(a);this._mask&&a.maskManager.popMask(a)}},b.Sprite.fromFrame=function(a){var c=b.TextureCache[a];if(!c)throw new Error('The frameId "'+a+'" does not exist in the texture cache'+this);return new b.Sprite(c)},b.Sprite.fromImage=function(a,c,d){var e=b.Texture.fromImage(a,c,d);return new b.Sprite(e)},b.SpriteBatch=function(a){b.DisplayObjectContainer.call(this),this.textureThing=a,this.ready=!1},b.SpriteBatch.prototype=Object.create(b.DisplayObjectContainer.prototype),b.SpriteBatch.prototype.constructor=b.SpriteBatch,b.SpriteBatch.prototype.initWebGL=function(a){this.fastSpriteBatch=new b.WebGLFastSpriteBatch(a),this.ready=!0},b.SpriteBatch.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},b.SpriteBatch.prototype._renderWebGL=function(a){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(a.gl),this.fastSpriteBatch.gl!==a.gl&&this.fastSpriteBatch.setContext(a.gl),a.spriteBatch.stop(),a.shaderManager.setShader(a.shaderManager.fastShader),this.fastSpriteBatch.begin(this,a),this.fastSpriteBatch.render(this),a.spriteBatch.start())},b.SpriteBatch.prototype._renderCanvas=function(a){if(this.visible&&!(this.alpha<=0)&&this.children.length){var b=a.context;b.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var c=this.worldTransform,d=!0,e=0;e=this.textures.length&&(this.gotoAndStop(this.textures.length-1),this.onComplete&&this.onComplete())}},b.MovieClip.fromFrames=function(a){for(var c=[],d=0;di;i++){for(j=0;m>j;j+=4)if(255!==k[n+j]){o=!0;break}if(o)break;n+=m}for(c.ascent=g-i,n=l-m,o=!1,i=h;i>g;i--){for(j=0;m>j;j+=4)if(255!==k[n+j]){o=!0;break}if(o)break;n-=m}c.descent=i-g,c.descent+=6,c.fontSize=c.ascent+c.descent,b.Text.fontPropertiesCache[a]=c}return c},b.Text.prototype.wordWrap=function(a){for(var b="",c=a.split("\n"),d=0;de?(g>0&&(b+="\n"),b+=f[g],e=this.style.wordWrapWidth-h):(e-=i,b+=" "+f[g])}d=2?parseInt(c[c.length-2],10):b.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=a.tint},b.BitmapText.prototype.updateText=function(){for(var a=b.BitmapText.fonts[this.fontName],c=new b.Point,d=null,e=[],f=0,g=[],h=0,i=this.fontSize/a.size,j=0;j=j;j++){var n=0;"right"===this.style.align?n=f-g[j]:"center"===this.style.align&&(n=(f-g[j])/2),m.push(n)}var o=this.children.length,p=e.length,q=this.tint||16777215;for(j=0;p>j;j++){var r=o>j?this.children[j]:this._pool.pop();r?r.setTexture(e[j].texture):r=new b.Sprite(e[j].texture),r.position.x=(e[j].position.x+m[e[j].line])*i,r.position.y=e[j].position.y*i,r.scale.x=r.scale.y=i,r.tint=q,r.parent||this.addChild(r)}for(;this.children.length>p;){var s=this.getChildAt(this.children.length-1);this._pool.push(s),this.removeChild(s)}this.textWidth=f*i,this.textHeight=(c.y+a.lineHeight)*i},b.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),b.DisplayObjectContainer.prototype.updateTransform.call(this)},b.BitmapText.fonts={},b.InteractionData=function(){this.global=new b.Point,this.target=null,this.originalEvent=null},b.InteractionData.prototype.getLocalPosition=function(a,c,d){var e=a.worldTransform,f=d?d:this.global,g=e.a,h=e.c,i=e.tx,j=e.b,k=e.d,l=e.ty,m=1/(g*k+h*-j);return c=c||new b.Point,c.x=k*m*f.x+-h*m*f.y+(l*h-i*k)*m,c.y=g*m*f.y+-j*m*f.x+(-l*g+i*j)*m,c},b.InteractionData.prototype.constructor=b.InteractionData,b.InteractionManager=function(a){this.stage=a,this.mouse=new b.InteractionData,this.touches={},this.tempPoint=new b.Point,this.mouseoverEnabled=!0,this.pool=[],this.interactiveItems=[],this.interactionDOMElement=null,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this), +this.onTouchMove=this.onTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this.mouseOut=!1,this.resolution=1,this._tempPoint=new b.Point},b.InteractionManager.prototype.constructor=b.InteractionManager,b.InteractionManager.prototype.collectInteractiveSprite=function(a,b){for(var c=a.children,d=c.length,e=d-1;e>=0;e--){var f=c[e];f._interactive?(b.interactiveChildren=!0,this.interactiveItems.push(f),f.children.length>0&&this.collectInteractiveSprite(f,f)):(f.__iParent=null,f.children.length>0&&this.collectInteractiveSprite(f,b))}},b.InteractionManager.prototype.setTarget=function(a){this.target=a,this.resolution=a.resolution,null===this.interactionDOMElement&&this.setTargetDomElement(a.view)},b.InteractionManager.prototype.setTargetDomElement=function(a){this.removeEvents(),window.navigator.msPointerEnabled&&(a.style["-ms-content-zooming"]="none",a.style["-ms-touch-action"]="none"),this.interactionDOMElement=a,a.addEventListener("mousemove",this.onMouseMove,!0),a.addEventListener("mousedown",this.onMouseDown,!0),a.addEventListener("mouseout",this.onMouseOut,!0),a.addEventListener("touchstart",this.onTouchStart,!0),a.addEventListener("touchend",this.onTouchEnd,!0),a.addEventListener("touchleave",this.onTouchCancel,!0),a.addEventListener("touchcancel",this.onTouchCancel,!0),a.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0)},b.InteractionManager.prototype.removeEvents=function(){this.interactionDOMElement&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]="",this.interactionDOMElement.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchleave",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0))},b.InteractionManager.prototype.update=function(){if(this.target){var a=Date.now(),c=a-this.last;if(c=c*b.INTERACTION_FREQUENCY/1e3,!(1>c)){this.last=a;var d=0;this.dirty&&this.rebuildInteractiveGraph();var e=this.interactiveItems.length,f="inherit",g=!1;for(d=0;e>d;d++){var h=this.interactiveItems[d];h.__hit=this.hitTest(h,this.mouse),this.mouse.target=h,h.__hit&&!g?(h.buttonMode&&(f=h.defaultCursor),h.interactiveChildren||(g=!0),h.__isOver||(h.mouseover&&h.mouseover(this.mouse),h.__isOver=!0)):h.__isOver&&(h.mouseout&&h.mouseout(this.mouse),h.__isOver=!1)}this.currentCursorStyle!==f&&(this.currentCursorStyle=f,this.interactionDOMElement.style.cursor=f)}}},b.InteractionManager.prototype.rebuildInteractiveGraph=function(){this.dirty=!1;for(var a=this.interactiveItems.length,b=0;a>b;b++)this.interactiveItems[b].interactiveChildren=!1;this.interactiveItems=[],this.stage.interactive&&this.interactiveItems.push(this.stage),this.collectInteractiveSprite(this.stage,this.stage)},b.InteractionManager.prototype.onMouseMove=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a;var b=this.interactionDOMElement.getBoundingClientRect();this.mouse.global.x=(a.clientX-b.left)*(this.target.width/b.width)/this.resolution,this.mouse.global.y=(a.clientY-b.top)*(this.target.height/b.height)/this.resolution;for(var c=this.interactiveItems.length,d=0;c>d;d++){var e=this.interactiveItems[d];e.mousemove&&e.mousemove(this.mouse)}},b.InteractionManager.prototype.onMouseDown=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a,b.AUTO_PREVENT_DEFAULT&&this.mouse.originalEvent.preventDefault();for(var c=this.interactiveItems.length,d=this.mouse.originalEvent,e=2===d.button||3===d.which,f=e?"rightdown":"mousedown",g=e?"rightclick":"click",h=e?"__rightIsDown":"__mouseIsDown",i=e?"__isRightDown":"__isDown",j=0;c>j;j++){var k=this.interactiveItems[j];if((k[f]||k[g])&&(k[h]=!0,k.__hit=this.hitTest(k,this.mouse),k.__hit&&(k[f]&&k[f](this.mouse),k[i]=!0,!k.interactiveChildren)))break}},b.InteractionManager.prototype.onMouseOut=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a;var b=this.interactiveItems.length;this.interactionDOMElement.style.cursor="inherit";for(var c=0;b>c;c++){var d=this.interactiveItems[c];d.__isOver&&(this.mouse.target=d,d.mouseout&&d.mouseout(this.mouse),d.__isOver=!1)}this.mouseOut=!0,this.mouse.global.x=-1e4,this.mouse.global.y=-1e4},b.InteractionManager.prototype.onMouseUp=function(a){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=a;for(var b=this.interactiveItems.length,c=!1,d=this.mouse.originalEvent,e=2===d.button||3===d.which,f=e?"rightup":"mouseup",g=e?"rightclick":"click",h=e?"rightupoutside":"mouseupoutside",i=e?"__isRightDown":"__isDown",j=0;b>j;j++){var k=this.interactiveItems[j];(k[g]||k[f]||k[h])&&(k.__hit=this.hitTest(k,this.mouse),k.__hit&&!c?(k[f]&&k[f](this.mouse),k[i]&&k[g]&&k[g](this.mouse),k.interactiveChildren||(c=!0)):k[i]&&k[h]&&k[h](this.mouse),k[i]=!1)}},b.InteractionManager.prototype.hitTest=function(a,c){var d=c.global;if(!a.worldVisible)return!1;a.worldTransform.applyInverse(d,this._tempPoint);var e,f=this._tempPoint.x,g=this._tempPoint.y;if(c.target=a,a.hitArea&&a.hitArea.contains)return a.hitArea.contains(f,g);if(a instanceof b.Sprite){var h,i=a.texture.frame.width,j=a.texture.frame.height,k=-i*a.anchor.x;if(f>k&&k+i>f&&(h=-j*a.anchor.y,g>h&&h+j>g))return!0}else if(a instanceof b.Graphics){var l=a.graphicsData;for(e=0;ee;e++){var o=a.children[e],p=this.hitTest(o,c);if(p)return c.target=a,!0}return!1},b.InteractionManager.prototype.onTouchMove=function(a){this.dirty&&this.rebuildInteractiveGraph();for(var b,c,d=this.interactionDOMElement.getBoundingClientRect(),e=a.changedTouches,f=e.length,g=this.target.width/d.width,h=this.target.height/d.height,i=navigator.isCocoonJS&&!d.left&&!d.top&&!a.target.style.width&&!a.target.style.height,j=0;f>j;j++)c=e[j],i?(c.globalX=c.clientX,c.globalY=c.clientY):(c.globalX=(c.clientX-d.left)*g/this.resolution,c.globalY=(c.clientY-d.top)*h/this.resolution);for(var k=0;f>k;k++){c=e[k],b=this.touches[c.identifier],b.originalEvent=a,i?(b.global.x=c.clientX,b.global.y=c.clientY):(c.globalX=b.global.x=(c.clientX-d.left)*g/this.resolution,c.globalY=b.global.y=(c.clientY-d.top)*h/this.resolution);for(var l=0;lj;j++)d=e[j],i?(d.globalX=d.clientX,d.globalY=d.clientY):(d.globalX=(d.clientX-c.left)*g/this.resolution,d.globalY=(d.clientY-c.top)*h/this.resolution);for(var k=0;f>k;k++){d=e[k];var l=this.pool.pop();l||(l=new b.InteractionData),l.originalEvent=a,this.touches[d.identifier]=l,i?(l.global.x=d.clientX,l.global.y=d.clientY):(l.global.x=(d.clientX-c.left)*g/this.resolution,l.global.y=(d.clientY-c.top)*h/this.resolution);for(var m=this.interactiveItems.length,n=0;m>n;n++){var o=this.interactiveItems[n];if((o.touchstart||o.tap)&&(o.__hit=this.hitTest(o,l),o.__hit&&(o.touchstart&&o.touchstart(l),o.__isDown=!0,o.__touchData=o.__touchData||{},o.__touchData[d.identifier]=l,!o.interactiveChildren)))break}}},b.InteractionManager.prototype.onTouchEnd=function(a){this.dirty&&this.rebuildInteractiveGraph();for(var b,c=this.interactionDOMElement.getBoundingClientRect(),d=a.changedTouches,e=d.length,f=this.target.width/c.width,g=this.target.height/c.height,h=navigator.isCocoonJS&&!c.left&&!c.top&&!a.target.style.width&&!a.target.style.height,i=0;e>i;i++)b=d[i],h?(b.globalX=b.clientX,b.globalY=b.clientY):(b.globalX=(b.clientX-c.left)*f/this.resolution,b.globalY=(b.clientY-c.top)*g/this.resolution);for(var j=0;e>j;j++){b=d[j];var k=this.touches[b.identifier],l=!1;h?(k.global.x=b.clientX,k.global.y=b.clientY):(k.global.x=(b.clientX-c.left)*f/this.resolution,k.global.y=(b.clientY-c.top)*g/this.resolution);for(var m=this.interactiveItems.length,n=0;m>n;n++){var o=this.interactiveItems[n];o.__touchData&&o.__touchData[b.identifier]&&(o.__hit=this.hitTest(o,o.__touchData[b.identifier]),k.originalEvent=a,(o.touchend||o.tap)&&(o.__hit&&!l?(o.touchend&&o.touchend(k),o.__isDown&&o.tap&&o.tap(k),o.interactiveChildren||(l=!0)):o.__isDown&&o.touchendoutside&&o.touchendoutside(k),o.__isDown=!1),o.__touchData[b.identifier]=null)}this.pool.push(k),this.touches[b.identifier]=null}},b.InteractionManager.prototype.onTouchCancel=function(a){this.dirty&&this.rebuildInteractiveGraph();for(var b,c=this.interactionDOMElement.getBoundingClientRect(),d=a.changedTouches,e=d.length,f=this.target.width/c.width,g=this.target.height/c.height,h=navigator.isCocoonJS&&!c.left&&!c.top&&!a.target.style.width&&!a.target.style.height,i=0;e>i;i++)b=d[i],h?(b.globalX=b.clientX,b.globalY=b.clientY):(b.globalX=(b.clientX-c.left)*f/this.resolution,b.globalY=(b.clientY-c.top)*g/this.resolution);for(var j=0;e>j;j++){b=d[j];var k=this.touches[b.identifier],l=!1;h?(k.global.x=b.clientX,k.global.y=b.clientY):(k.global.x=(b.clientX-c.left)*f/this.resolution,k.global.y=(b.clientY-c.top)*g/this.resolution);for(var m=this.interactiveItems.length,n=0;m>n;n++){var o=this.interactiveItems[n];o.__touchData&&o.__touchData[b.identifier]&&(o.__hit=this.hitTest(o,o.__touchData[b.identifier]),k.originalEvent=a,o.touchcancel&&!l&&(o.touchcancel(k),o.interactiveChildren||(l=!0)),o.__isDown=!1,o.__touchData[b.identifier]=null)}this.pool.push(k),this.touches[b.identifier]=null}},b.Stage=function(a){b.DisplayObjectContainer.call(this),this.worldTransform=new b.Matrix,this.interactive=!0,this.interactionManager=new b.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new b.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(a)},b.Stage.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Stage.prototype.constructor=b.Stage,b.Stage.prototype.setInteractionDelegate=function(a){this.interactionManager.setTargetDomElement(a)},b.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var a=0,b=this.children.length;b>a;a++)this.children[a].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},b.Stage.prototype.setBackgroundColor=function(a){this.backgroundColor=a||0,this.backgroundColorSplit=b.hex2rgb(this.backgroundColor);var c=this.backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c,this.backgroundColorString="#"+c},b.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},function(a){for(var b=0,c=["ms","moz","webkit","o"],d=0;d>16&255)/255,(a>>8&255)/255,(255&a)/255]},b.rgb2hex=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){return function(a){function b(){for(var d=arguments.length,f=new Array(d);d--;)f[d]=arguments[d];return f=e.concat(f),c.apply(this instanceof b?this:a,f)}var c=this,d=arguments.length-1,e=[];if(d>0)for(e.length=d;d--;)e[d]=arguments[d+1];if("function"!=typeof c)throw new TypeError;return b.prototype=function f(a){return a&&(f.prototype=a),this instanceof f?void 0:new f}(c.prototype),b}}()),b.AjaxRequest=function(){var a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var b=0;b0&&0===(a&a-1))return a;for(var b=1;a>b;)b<<=1;return b},b.isPowerOfTwo=function(a,b){return a>0&&0===(a&a-1)&&b>0&&0===(b&b-1)},b.EventTarget={call:function(a){a&&(a=a.prototype||a,b.EventTarget.mixin(a))},mixin:function(a){a.listeners=function(a){return this._listeners=this._listeners||{},this._listeners[a]?this._listeners[a].slice():[]},a.emit=a.dispatchEvent=function(a,c){if(this._listeners=this._listeners||{},"object"==typeof a&&(c=a,a=a.type),c&&c.__isEventObject===!0||(c=new b.Event(this,a,c)),this._listeners&&this._listeners[a]){var d,e=this._listeners[a].slice(0),f=e.length,g=e[0];for(d=0;f>d;g=e[++d])if(g.call(this,c),c.stoppedImmediate)return this;if(c.stopped)return this}return this.parent&&this.parent.emit&&this.parent.emit.call(this.parent,a,c),this},a.on=a.addEventListener=function(a,b){return this._listeners=this._listeners||{},(this._listeners[a]=this._listeners[a]||[]).push(b),this},a.once=function(a,b){function c(){b.apply(d.off(a,c),arguments)}this._listeners=this._listeners||{};var d=this;return c._originalHandler=b,this.on(a,c)},a.off=a.removeEventListener=function(a,b){if(this._listeners=this._listeners||{},!this._listeners[a])return this;for(var c=this._listeners[a],d=b?c.length:0;d-->0;)(c[d]===b||c[d]._originalHandler===b)&&c.splice(d,1);return 0===c.length&&delete this._listeners[a],this},a.removeAllListeners=function(a){return this._listeners=this._listeners||{},this._listeners[a]?(delete this._listeners[a],this):this}}},b.Event=function(a,b,c){this.__isEventObject=!0,this.stopped=!1,this.stoppedImmediate=!1,this.target=a,this.type=b,this.data=c,this.content=c,this.timeStamp=Date.now()},b.Event.prototype.stopPropagation=function(){this.stopped=!0},b.Event.prototype.stopImmediatePropagation=function(){this.stoppedImmediate=!0},b.autoDetectRenderer=function(a,c,d){a||(a=800),c||(c=600);var e=function(){try{var a=document.createElement("canvas");return!!window.WebGLRenderingContext&&(a.getContext("webgl")||a.getContext("experimental-webgl"))}catch(b){return!1}}();return e?new b.WebGLRenderer(a,c,d):new b.CanvasRenderer(a,c,d)},b.autoDetectRecommendedRenderer=function(a,c,d){a||(a=800),c||(c=600);var e=function(){try{var a=document.createElement("canvas");return!!window.WebGLRenderingContext&&(a.getContext("webgl")||a.getContext("experimental-webgl"))}catch(b){return!1}}(),f=/Android/i.test(navigator.userAgent);return e&&!f?new b.WebGLRenderer(a,c,d):new b.CanvasRenderer(a,c,d)},b.PolyK={},b.PolyK.Triangulate=function(a){var c=!0,d=a.length>>1;if(3>d)return[];for(var e=[],f=[],g=0;d>g;g++)f.push(g);g=0;for(var h=d;h>3;){var i=f[(g+0)%h],j=f[(g+1)%h],k=f[(g+2)%h],l=a[2*i],m=a[2*i+1],n=a[2*j],o=a[2*j+1],p=a[2*k],q=a[2*k+1],r=!1;if(b.PolyK._convex(l,m,n,o,p,q,c)){r=!0;for(var s=0;h>s;s++){var t=f[s];if(t!==i&&t!==j&&t!==k&&b.PolyK._PointInTriangle(a[2*t],a[2*t+1],l,m,n,o,p,q)){r=!1;break}}}if(r)e.push(i,j,k),f.splice((g+1)%h,1),h--,g=0;else if(g++>3*h){if(!c)return null;for(e=[],f=[],g=0;d>g;g++)f.push(g);g=0,h=d,c=!1}}return e.push(f[0],f[1],f[2]),e},b.PolyK._PointInTriangle=function(a,b,c,d,e,f,g,h){var i=g-c,j=h-d,k=e-c,l=f-d,m=a-c,n=b-d,o=i*i+j*j,p=i*k+j*l,q=i*m+j*n,r=k*k+l*l,s=k*m+l*n,t=1/(o*r-p*p),u=(r*q-p*s)*t,v=(o*s-p*q)*t;return u>=0&&v>=0&&1>u+v},b.PolyK._convex=function(a,b,c,d,e,f,g){return(b-d)*(e-c)+(c-a)*(f-d)>=0===g},b.initDefaultShaders=function(){},b.CompileVertexShader=function(a,c){return b._CompileShader(a,c,a.VERTEX_SHADER)},b.CompileFragmentShader=function(a,c){return b._CompileShader(a,c,a.FRAGMENT_SHADER)},b._CompileShader=function(a,b,c){var d=b.join("\n"),e=a.createShader(c);return a.shaderSource(e,d),a.compileShader(e),a.getShaderParameter(e,a.COMPILE_STATUS)?e:(window.console.log(a.getShaderInfoLog(e)),null)},b.compileProgram=function(a,c,d){var e=b.CompileFragmentShader(a,d),f=b.CompileVertexShader(a,c),g=a.createProgram();return a.attachShader(g,f),a.attachShader(g,e),a.linkProgram(g),a.getProgramParameter(g,a.LINK_STATUS)||window.console.log("Could not initialise shaders"),g},b.PixiShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.firstRun=!0,this.dirty=!0,this.attributes=[],this.init()},b.PixiShader.prototype.constructor=b.PixiShader,b.PixiShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc||b.PixiShader.defaultVertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.dimensions=a.getUniformLocation(c,"dimensions"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=a.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var d in this.uniforms)this.uniforms[d].uniformLocation=a.getUniformLocation(c,d);this.initUniforms(),this.program=c},b.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var a,b=this.gl;for(var c in this.uniforms){a=this.uniforms[c];var d=a.type;"sampler2D"===d?(a._init=!1,null!==a.value&&this.initSampler2D(a)):"mat2"===d||"mat3"===d||"mat4"===d?(a.glMatrix=!0,a.glValueLength=1,"mat2"===d?a.glFunc=b.uniformMatrix2fv:"mat3"===d?a.glFunc=b.uniformMatrix3fv:"mat4"===d&&(a.glFunc=b.uniformMatrix4fv)):(a.glFunc=b["uniform"+d],a.glValueLength="2f"===d||"2i"===d?2:"3f"===d||"3i"===d?3:"4f"===d||"4i"===d?4:1)}},b.PixiShader.prototype.initSampler2D=function(a){if(a.value&&a.value.baseTexture&&a.value.baseTexture.hasLoaded){var b=this.gl;if(b.activeTexture(b["TEXTURE"+this.textureCount]),b.bindTexture(b.TEXTURE_2D,a.value.baseTexture._glTextures[b.id]),a.textureData){var c=a.textureData,d=c.magFilter?c.magFilter:b.LINEAR,e=c.minFilter?c.minFilter:b.LINEAR,f=c.wrapS?c.wrapS:b.CLAMP_TO_EDGE,g=c.wrapT?c.wrapT:b.CLAMP_TO_EDGE,h=c.luminance?b.LUMINANCE:b.RGBA;if(c.repeat&&(f=b.REPEAT,g=b.REPEAT),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!!c.flipY),c.width){var i=c.width?c.width:512,j=c.height?c.height:2,k=c.border?c.border:0;b.texImage2D(b.TEXTURE_2D,0,h,i,j,k,h,b.UNSIGNED_BYTE,null)}else b.texImage2D(b.TEXTURE_2D,0,h,b.RGBA,b.UNSIGNED_BYTE,a.value.baseTexture.source);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,d),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,f),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,g)}b.uniform1i(a.uniformLocation,this.textureCount),a._init=!0,this.textureCount++}},b.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var a,c=this.gl;for(var d in this.uniforms)a=this.uniforms[d],1===a.glValueLength?a.glMatrix===!0?a.glFunc.call(c,a.uniformLocation,a.transpose,a.value):a.glFunc.call(c,a.uniformLocation,a.value):2===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y):3===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y,a.value.z):4===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y,a.value.z,a.value.w):"sampler2D"===a.type&&(a._init?(c.activeTexture(c["TEXTURE"+this.textureCount]),a.value.baseTexture._dirty[c.id]?b.instances[c.id].updateTexture(a.value.baseTexture):c.bindTexture(c.TEXTURE_2D,a.value.baseTexture._glTextures[c.id]),c.uniform1i(a.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(a))},b.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"],b.PixiFastShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init()},b.PixiFastShader.prototype.constructor=b.PixiFastShader,b.PixiFastShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.dimensions=a.getUniformLocation(c,"dimensions"),this.uMatrix=a.getUniformLocation(c,"uMatrix"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aPositionCoord=a.getAttribLocation(c,"aPositionCoord"),this.aScale=a.getAttribLocation(c,"aScale"),this.aRotation=a.getAttribLocation(c,"aRotation"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=a.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=c},b.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.StripShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"],this.init()},b.StripShader.prototype.constructor=b.StripShader,b.StripShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.colorAttribute=a.getAttribLocation(c,"aColor"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.attributes=[this.aVertexPosition,this.aTextureCoord],this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.StripShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},b.PrimitiveShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform float flipY;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},b.PrimitiveShader.prototype.constructor=b.PrimitiveShader,b.PrimitiveShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.tintColor=a.getUniformLocation(c,"tint"),this.flipY=a.getUniformLocation(c,"flipY"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.colorAttribute=a.getAttribLocation(c,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.ComplexPrimitiveShader=function(a){this._UID=b._UID++,this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform vec3 tint;","uniform float alpha;","uniform vec3 color;","uniform float flipY;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = vec4(color * alpha * tint, alpha);","}"],this.init()},b.ComplexPrimitiveShader.prototype.constructor=b.ComplexPrimitiveShader,b.ComplexPrimitiveShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.tintColor=a.getUniformLocation(c,"tint"),this.color=a.getUniformLocation(c,"color"),this.flipY=a.getUniformLocation(c,"flipY"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.ComplexPrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},b.WebGLGraphics=function(){},b.WebGLGraphics.renderGraphics=function(a,c){var d,e=c.gl,f=c.projection,g=c.offset,h=c.shaderManager.primitiveShader;a.dirty&&b.WebGLGraphics.updateGraphics(a,e);for(var i=a._webGL[e.id],j=0;j=6)if(h.points.length<12){g=b.WebGLGraphics.switchMode(d,0);var i=b.WebGLGraphics.buildPoly(h,g);i||(g=b.WebGLGraphics.switchMode(d,1),b.WebGLGraphics.buildComplexPoly(h,g))}else g=b.WebGLGraphics.switchMode(d,1),b.WebGLGraphics.buildComplexPoly(h,g);h.lineWidth>0&&(g=b.WebGLGraphics.switchMode(d,0),b.WebGLGraphics.buildLine(h,g))}else g=b.WebGLGraphics.switchMode(d,0),h.type===b.Graphics.RECT?b.WebGLGraphics.buildRectangle(h,g):h.type===b.Graphics.CIRC||h.type===b.Graphics.ELIP?b.WebGLGraphics.buildCircle(h,g):h.type===b.Graphics.RREC&&b.WebGLGraphics.buildRoundedRectangle(h,g);d.lastIndex++}for(e=0;e=q;q++)p=q/n,h=g(a,c,p),i=g(b,d,p),j=g(c,e,p),k=g(d,f,p),l=g(h,j,p),m=g(i,k,p),o.push(l,m);return o},b.WebGLGraphics.buildCircle=function(a,c){var d,e,f=a.shape,g=f.x,h=f.y;a.type===b.Graphics.CIRC?(d=f.radius,e=f.radius):(d=f.width,e=f.height);var i=40,j=2*Math.PI/i,k=0;if(a.fill){var l=b.hex2rgb(a.fillColor),m=a.fillAlpha,n=l[0]*m,o=l[1]*m,p=l[2]*m,q=c.points,r=c.indices,s=q.length/6;for(r.push(s),k=0;i+1>k;k++)q.push(g,h,n,o,p,m),q.push(g+Math.sin(j*k)*d,h+Math.cos(j*k)*e,n,o,p,m),r.push(s++,s++);r.push(s-1)}if(a.lineWidth){var t=a.points;for(a.points=[],k=0;i+1>k;k++)a.points.push(g+Math.sin(j*k)*d,h+Math.cos(j*k)*e);b.WebGLGraphics.buildLine(a,c),a.points=t}},b.WebGLGraphics.buildLine=function(a,c){var d=0,e=a.points;if(0!==e.length){if(a.lineWidth%2)for(d=0;dd;d++)l=e[2*(d-1)],m=e[2*(d-1)+1],n=e[2*d],o=e[2*d+1],p=e[2*(d+1)],q=e[2*(d+1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,t=-(o-q),u=n-p,F=Math.sqrt(t*t+u*u),t/=F,u/=F,t*=L,u*=L,x=-s+m-(-s+o),y=-r+n-(-r+l),z=(-r+l)*(-s+o)-(-r+n)*(-s+m),A=-u+q-(-u+o),B=-t+n-(-t+p),C=(-t+p)*(-u+o)-(-t+n)*(-u+q),D=x*B-A*y,Math.abs(D)<.1?(D+=10.1,G.push(n-r,o-s,O,P,Q,N),G.push(n+r,o+s,O,P,Q,N)):(j=(y*C-B*z)/D,k=(A*z-x*C)/D,E=(j-n)*(j-n)+(k-o)+(k-o),E>19600?(v=r-t,w=s-u,F=Math.sqrt(v*v+w*w),v/=F,w/=F,v*=L,w*=L,G.push(n-v,o-w),G.push(O,P,Q,N),G.push(n+v,o+w),G.push(O,P,Q,N),G.push(n-v,o-w),G.push(O,P,Q,N),J++):(G.push(j,k),G.push(O,P,Q,N),G.push(n-(j-n),o-(k-o)),G.push(O,P,Q,N)));for(l=e[2*(I-2)],m=e[2*(I-2)+1],n=e[2*(I-1)],o=e[2*(I-1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,G.push(n-r,o-s),G.push(O,P,Q,N),G.push(n+r,o+s),G.push(O,P,Q,N),H.push(K),d=0;J>d;d++)H.push(K++);H.push(K-1)}},b.WebGLGraphics.buildComplexPoly=function(a,c){var d=a.points.slice();if(!(d.length<6)){var e=c.indices;c.points=d,c.alpha=a.fillAlpha,c.color=b.hex2rgb(a.fillColor);for(var f,g,h=1/0,i=-(1/0),j=1/0,k=-(1/0),l=0;lf?f:h,i=f>i?f:i,j=j>g?g:j,k=g>k?g:k;d.push(h,j,i,j,i,k,h,k);var m=d.length/2;for(l=0;m>l;l++)e.push(l)}},b.WebGLGraphics.buildPoly=function(a,c){var d=a.points;if(!(d.length<6)){var e=c.points,f=c.indices,g=d.length/2,h=b.hex2rgb(a.fillColor),i=a.fillAlpha,j=h[0]*i,k=h[1]*i,l=h[2]*i,m=b.PolyK.Triangulate(d);if(!m)return!1;var n=e.length/6,o=0;for(o=0;oo;o++)e.push(d[2*o],d[2*o+1],j,k,l,i);return!0}},b.WebGLGraphics.graphicsDataPool=[],b.WebGLGraphicsData=function(a){this.gl=a,this.color=[0,0,0],this.points=[],this.indices=[],this.buffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),this.mode=1,this.alpha=1,this.dirty=!0},b.WebGLGraphicsData.prototype.reset=function(){this.points=[],this.indices=[]},b.WebGLGraphicsData.prototype.upload=function(){var a=this.gl;this.glPoints=new b.Float32Array(this.points),a.bindBuffer(a.ARRAY_BUFFER,this.buffer),a.bufferData(a.ARRAY_BUFFER,this.glPoints,a.STATIC_DRAW),this.glIndicies=new b.Uint16Array(this.indices),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.glIndicies,a.STATIC_DRAW),this.dirty=!1},b.glContexts=[],b.instances=[],b.WebGLRenderer=function(a,c,d){if(d)for(var e in b.defaultRenderOptions)"undefined"==typeof d[e]&&(d[e]=b.defaultRenderOptions[e]);else d=b.defaultRenderOptions;b.defaultRenderer||(b.sayHello("webGL"),b.defaultRenderer=this),this.type=b.WEBGL_RENDERER,this.resolution=d.resolution,this.transparent=d.transparent,this.autoResize=d.autoResize||!1,this.preserveDrawingBuffer=d.preserveDrawingBuffer,this.clearBeforeRender=d.clearBeforeRender,this.width=a||800,this.height=c||600,this.view=d.view||document.createElement("canvas"),this.contextLostBound=this.handleContextLost.bind(this),this.contextRestoredBound=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLostBound,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredBound,!1),this._contextOptions={alpha:this.transparent,antialias:d.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:d.preserveDrawingBuffer},this.projection=new b.Point,this.offset=new b.Point(0,0),this.shaderManager=new b.WebGLShaderManager,this.spriteBatch=new b.WebGLSpriteBatch,this.maskManager=new b.WebGLMaskManager,this.filterManager=new b.WebGLFilterManager,this.stencilManager=new b.WebGLStencilManager,this.blendModeManager=new b.WebGLBlendModeManager,this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.blendModeManager=this.blendModeManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.stencilManager=this.stencilManager,this.renderSession.renderer=this,this.renderSession.resolution=this.resolution,this.initContext(),this.mapBlendModes()},b.WebGLRenderer.prototype.constructor=b.WebGLRenderer,b.WebGLRenderer.prototype.initContext=function(){var a=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=a,!a)throw new Error("This browser does not support webGL. Try using the canvas renderer");this.glContextId=a.id=b.WebGLRenderer.glContextId++,b.glContexts[this.glContextId]=a,b.instances[this.glContextId]=this,a.disable(a.DEPTH_TEST),a.disable(a.CULL_FACE),a.enable(a.BLEND),this.shaderManager.setContext(a),this.spriteBatch.setContext(a),this.maskManager.setContext(a),this.filterManager.setContext(a),this.blendModeManager.setContext(a),this.stencilManager.setContext(a),this.renderSession.gl=this.gl,this.resize(this.width,this.height)},b.WebGLRenderer.prototype.render=function(a){if(!this.contextLost){this.__stage!==a&&(a.interactive&&a.interactionManager.removeEvents(),this.__stage=a),a.updateTransform();var b=this.gl;a._interactive?a._interactiveEventsAdded||(a._interactiveEventsAdded=!0,a.interactionManager.setTarget(this)):a._interactiveEventsAdded&&(a._interactiveEventsAdded=!1,a.interactionManager.setTarget(this)),b.viewport(0,0,this.width,this.height),b.bindFramebuffer(b.FRAMEBUFFER,null),this.clearBeforeRender&&(this.transparent?b.clearColor(0,0,0,0):b.clearColor(a.backgroundColorSplit[0],a.backgroundColorSplit[1],a.backgroundColorSplit[2],1),b.clear(b.COLOR_BUFFER_BIT)),this.renderDisplayObject(a,this.projection)}},b.WebGLRenderer.prototype.renderDisplayObject=function(a,c,d){this.renderSession.blendModeManager.setBlendMode(b.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=d?-1:1,this.renderSession.projection=c,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,d),a._renderWebGL(this.renderSession),this.spriteBatch.end()},b.WebGLRenderer.prototype.resize=function(a,b){this.width=a*this.resolution,this.height=b*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px"),this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2/this.resolution,this.projection.y=-this.height/2/this.resolution},b.WebGLRenderer.prototype.updateTexture=function(a){if(a.hasLoaded){var c=this.gl;return a._glTextures[c.id]||(a._glTextures[c.id]=c.createTexture()),c.bindTexture(c.TEXTURE_2D,a._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultipliedAlpha),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a.mipmap&&b.isPowerOfTwo(a.width,a.height)?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR_MIPMAP_LINEAR:c.NEAREST_MIPMAP_NEAREST),c.generateMipmap(c.TEXTURE_2D)):c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),a._dirty[c.id]=!1,a._glTextures[c.id]}},b.WebGLRenderer.prototype.handleContextLost=function(a){a.preventDefault(),this.contextLost=!0},b.WebGLRenderer.prototype.handleContextRestored=function(){this.initContext();for(var a in b.TextureCache){var c=b.TextureCache[a].baseTexture;c._glTextures=[]}this.contextLost=!1},b.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLostBound),this.view.removeEventListener("webglcontextrestored",this.contextRestoredBound),b.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},b.WebGLRenderer.prototype.mapBlendModes=function(){var a=this.gl;b.blendModesWebGL||(b.blendModesWebGL=[],b.blendModesWebGL[b.blendModes.NORMAL]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.ADD]=[a.SRC_ALPHA,a.DST_ALPHA],b.blendModesWebGL[b.blendModes.MULTIPLY]=[a.DST_COLOR,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SCREEN]=[a.SRC_ALPHA,a.ONE],b.blendModesWebGL[b.blendModes.OVERLAY]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.DARKEN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.LIGHTEN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR_DODGE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR_BURN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.HARD_LIGHT]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SOFT_LIGHT]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.DIFFERENCE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.EXCLUSION]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.HUE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SATURATION]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.LUMINOSITY]=[a.ONE,a.ONE_MINUS_SRC_ALPHA])},b.WebGLRenderer.glContextId=0,b.WebGLBlendModeManager=function(){this.currentBlendMode=99999},b.WebGLBlendModeManager.prototype.constructor=b.WebGLBlendModeManager,b.WebGLBlendModeManager.prototype.setContext=function(a){this.gl=a},b.WebGLBlendModeManager.prototype.setBlendMode=function(a){if(this.currentBlendMode===a)return!1;this.currentBlendMode=a;var c=b.blendModesWebGL[this.currentBlendMode];return this.gl.blendFunc(c[0],c[1]),!0},b.WebGLBlendModeManager.prototype.destroy=function(){this.gl=null},b.WebGLMaskManager=function(){},b.WebGLMaskManager.prototype.constructor=b.WebGLMaskManager,b.WebGLMaskManager.prototype.setContext=function(a){this.gl=a},b.WebGLMaskManager.prototype.pushMask=function(a,c){var d=c.gl;a.dirty&&b.WebGLGraphics.updateGraphics(a,d),a._webGL[d.id].data.length&&c.stencilManager.pushStencil(a,a._webGL[d.id].data[0],c)},b.WebGLMaskManager.prototype.popMask=function(a,b){var c=this.gl;b.stencilManager.popStencil(a,a._webGL[c.id].data[0],b)},b.WebGLMaskManager.prototype.destroy=function(){this.gl=null},b.WebGLStencilManager=function(){this.stencilStack=[],this.reverse=!0,this.count=0},b.WebGLStencilManager.prototype.setContext=function(a){this.gl=a},b.WebGLStencilManager.prototype.pushStencil=function(a,b,c){var d=this.gl;this.bindGraphics(a,b,c),0===this.stencilStack.length&&(d.enable(d.STENCIL_TEST),d.clear(d.STENCIL_BUFFER_BIT),this.reverse=!0,this.count=0),this.stencilStack.push(b);var e=this.count;d.colorMask(!1,!1,!1,!1),d.stencilFunc(d.ALWAYS,0,255),d.stencilOp(d.KEEP,d.KEEP,d.INVERT),1===b.mode?(d.drawElements(d.TRIANGLE_FAN,b.indices.length-4,d.UNSIGNED_SHORT,0),this.reverse?(d.stencilFunc(d.EQUAL,255-e,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)):(d.stencilFunc(d.EQUAL,e,255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)),d.drawElements(d.TRIANGLE_FAN,4,d.UNSIGNED_SHORT,2*(b.indices.length-4)),this.reverse?d.stencilFunc(d.EQUAL,255-(e+1),255):d.stencilFunc(d.EQUAL,e+1,255),this.reverse=!this.reverse):(this.reverse?(d.stencilFunc(d.EQUAL,e,255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)):(d.stencilFunc(d.EQUAL,255-e,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)),d.drawElements(d.TRIANGLE_STRIP,b.indices.length,d.UNSIGNED_SHORT,0),this.reverse?d.stencilFunc(d.EQUAL,e+1,255):d.stencilFunc(d.EQUAL,255-(e+1),255)),d.colorMask(!0,!0,!0,!0),d.stencilOp(d.KEEP,d.KEEP,d.KEEP),this.count++},b.WebGLStencilManager.prototype.bindGraphics=function(a,c,d){this._currentGraphics=a;var e,f=this.gl,g=d.projection,h=d.offset;1===c.mode?(e=d.shaderManager.complexPrimitiveShader,d.shaderManager.setShader(e),f.uniform1f(e.flipY,d.flipY),f.uniformMatrix3fv(e.translationMatrix,!1,a.worldTransform.toArray(!0)),f.uniform2f(e.projectionVector,g.x,-g.y),f.uniform2f(e.offsetVector,-h.x,-h.y),f.uniform3fv(e.tintColor,b.hex2rgb(a.tint)),f.uniform3fv(e.color,c.color),f.uniform1f(e.alpha,a.worldAlpha*c.alpha),f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(e.aVertexPosition,2,f.FLOAT,!1,8,0),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,c.indexBuffer)):(e=d.shaderManager.primitiveShader,d.shaderManager.setShader(e),f.uniformMatrix3fv(e.translationMatrix,!1,a.worldTransform.toArray(!0)),f.uniform1f(e.flipY,d.flipY),f.uniform2f(e.projectionVector,g.x,-g.y),f.uniform2f(e.offsetVector,-h.x,-h.y),f.uniform3fv(e.tintColor,b.hex2rgb(a.tint)),f.uniform1f(e.alpha,a.worldAlpha),f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(e.aVertexPosition,2,f.FLOAT,!1,24,0),f.vertexAttribPointer(e.colorAttribute,4,f.FLOAT,!1,24,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,c.indexBuffer))},b.WebGLStencilManager.prototype.popStencil=function(a,b,c){var d=this.gl;if(this.stencilStack.pop(),this.count--,0===this.stencilStack.length)d.disable(d.STENCIL_TEST);else{var e=this.count;this.bindGraphics(a,b,c),d.colorMask(!1,!1,!1,!1),1===b.mode?(this.reverse=!this.reverse,this.reverse?(d.stencilFunc(d.EQUAL,255-(e+1),255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)):(d.stencilFunc(d.EQUAL,e+1,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)),d.drawElements(d.TRIANGLE_FAN,4,d.UNSIGNED_SHORT,2*(b.indices.length-4)),d.stencilFunc(d.ALWAYS,0,255),d.stencilOp(d.KEEP,d.KEEP,d.INVERT),d.drawElements(d.TRIANGLE_FAN,b.indices.length-4,d.UNSIGNED_SHORT,0),this.reverse?d.stencilFunc(d.EQUAL,e,255):d.stencilFunc(d.EQUAL,255-e,255)):(this.reverse?(d.stencilFunc(d.EQUAL,e+1,255),d.stencilOp(d.KEEP,d.KEEP,d.DECR)):(d.stencilFunc(d.EQUAL,255-(e+1),255),d.stencilOp(d.KEEP,d.KEEP,d.INCR)),d.drawElements(d.TRIANGLE_STRIP,b.indices.length,d.UNSIGNED_SHORT,0),this.reverse?d.stencilFunc(d.EQUAL,e,255):d.stencilFunc(d.EQUAL,255-e,255)),d.colorMask(!0,!0,!0,!0),d.stencilOp(d.KEEP,d.KEEP,d.KEEP)}},b.WebGLStencilManager.prototype.destroy=function(){this.stencilStack=null,this.gl=null},b.WebGLShaderManager=function(){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var a=0;ad;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.dirty=!0,this.textures=[],this.blendModes=[],this.shaders=[],this.sprites=[],this.defaultShader=new b.AbstractFilter(["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"])},b.WebGLSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999;var c=new b.PixiShader(a);c.fragmentSrc=this.defaultShader.fragmentSrc,c.uniforms={},c.init(),this.defaultShader.shaders[a.id]=c},b.WebGLSpriteBatch.prototype.begin=function(a){this.renderSession=a,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},b.WebGLSpriteBatch.prototype.end=function(){this.flush()},b.WebGLSpriteBatch.prototype.render=function(a){var b=a.texture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=b.baseTexture);var c=b._uvs;if(c){var d,e,f,g,h=a.anchor.x,i=a.anchor.y;if(b.trim){var j=b.trim;e=j.x-h*j.width,d=e+b.crop.width,g=j.y-i*j.height,f=g+b.crop.height}else d=b.frame.width*(1-h),e=b.frame.width*-h,f=b.frame.height*(1-i),g=b.frame.height*-i;var k=4*this.currentBatchSize*this.vertSize,l=b.baseTexture.resolution,m=a.worldTransform,n=m.a/l,o=m.b/l,p=m.c/l,q=m.d/l,r=m.tx,s=m.ty,t=this.colors,u=this.positions;this.renderSession.roundPixels?(u[k]=n*e+p*g+r|0,u[k+1]=q*g+o*e+s|0,u[k+5]=n*d+p*g+r|0,u[k+6]=q*g+o*d+s|0,u[k+10]=n*d+p*f+r|0,u[k+11]=q*f+o*d+s|0,u[k+15]=n*e+p*f+r|0,u[k+16]=q*f+o*e+s|0):(u[k]=n*e+p*g+r,u[k+1]=q*g+o*e+s,u[k+5]=n*d+p*g+r,u[k+6]=q*g+o*d+s,u[k+10]=n*d+p*f+r,u[k+11]=q*f+o*d+s,u[k+15]=n*e+p*f+r,u[k+16]=q*f+o*e+s),u[k+2]=c.x0,u[k+3]=c.y0,u[k+7]=c.x1,u[k+8]=c.y1,u[k+12]=c.x2,u[k+13]=c.y2,u[k+17]=c.x3,u[k+18]=c.y3;var v=a.tint;t[k+4]=t[k+9]=t[k+14]=t[k+19]=(v>>16)+(65280&v)+((255&v)<<16)+(255*a.worldAlpha<<24),this.sprites[this.currentBatchSize++]=a}},b.WebGLSpriteBatch.prototype.renderTilingSprite=function(a){var c=a.tilingTexture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=c.baseTexture),a._uvs||(a._uvs=new b.TextureUvs);var d=a._uvs;a.tilePosition.x%=c.baseTexture.width*a.tileScaleOffset.x,a.tilePosition.y%=c.baseTexture.height*a.tileScaleOffset.y;var e=a.tilePosition.x/(c.baseTexture.width*a.tileScaleOffset.x),f=a.tilePosition.y/(c.baseTexture.height*a.tileScaleOffset.y),g=a.width/c.baseTexture.width/(a.tileScale.x*a.tileScaleOffset.x),h=a.height/c.baseTexture.height/(a.tileScale.y*a.tileScaleOffset.y);d.x0=0-e,d.y0=0-f,d.x1=1*g-e,d.y1=0-f,d.x2=1*g-e,d.y2=1*h-f,d.x3=0-e,d.y3=1*h-f;var i=a.tint,j=(i>>16)+(65280&i)+((255&i)<<16)+(255*a.alpha<<24),k=this.positions,l=this.colors,m=a.width,n=a.height,o=a.anchor.x,p=a.anchor.y,q=m*(1-o),r=m*-o,s=n*(1-p),t=n*-p,u=4*this.currentBatchSize*this.vertSize,v=c.baseTexture.resolution,w=a.worldTransform,x=w.a/v,y=w.b/v,z=w.c/v,A=w.d/v,B=w.tx,C=w.ty;k[u++]=x*r+z*t+B,k[u++]=A*t+y*r+C,k[u++]=d.x0,k[u++]=d.y0,l[u++]=j,k[u++]=x*q+z*t+B,k[u++]=A*t+y*q+C,k[u++]=d.x1,k[u++]=d.y1,l[u++]=j,k[u++]=x*q+z*s+B,k[u++]=A*s+y*q+C,k[u++]=d.x2,k[u++]=d.y2,l[u++]=j,k[u++]=x*r+z*s+B,k[u++]=A*s+y*r+C,k[u++]=d.x3,k[u++]=d.y3,l[u++]=j,this.sprites[this.currentBatchSize++]=a},b.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var a,c=this.gl;if(this.dirty){this.dirty=!1,c.activeTexture(c.TEXTURE0),c.bindBuffer(c.ARRAY_BUFFER,this.vertexBuffer),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a=this.defaultShader.shaders[c.id];var d=4*this.vertSize;c.vertexAttribPointer(a.aVertexPosition,2,c.FLOAT,!1,d,0),c.vertexAttribPointer(a.aTextureCoord,2,c.FLOAT,!1,d,8),c.vertexAttribPointer(a.colorAttribute,4,c.UNSIGNED_BYTE,!0,d,16)}if(this.currentBatchSize>.5*this.size)c.bufferSubData(c.ARRAY_BUFFER,0,this.vertices);else{var e=this.positions.subarray(0,4*this.currentBatchSize*this.vertSize);c.bufferSubData(c.ARRAY_BUFFER,0,e)}for(var f,g,h,i,j=0,k=0,l=null,m=this.renderSession.blendModeManager.currentBlendMode,n=null,o=!1,p=!1,q=0,r=this.currentBatchSize;r>q;q++){if(i=this.sprites[q],f=i.texture.baseTexture,g=i.blendMode,h=i.shader||this.defaultShader,o=m!==g,p=n!==h,(l!==f||o||p)&&(this.renderBatch(l,j,k),k=q,j=0,l=f,o&&(m=g,this.renderSession.blendModeManager.setBlendMode(m)),p)){n=h,a=n.shaders[c.id],a||(a=new b.PixiShader(c),a.fragmentSrc=n.fragmentSrc,a.uniforms=n.uniforms,a.init(),n.shaders[c.id]=a),this.renderSession.shaderManager.setShader(a),a.dirty&&a.syncUniforms();var s=this.renderSession.projection;c.uniform2f(a.projectionVector,s.x,s.y);var t=this.renderSession.offset;c.uniform2f(a.offsetVector,t.x,t.y)}j++}this.renderBatch(l,j,k),this.currentBatchSize=0}},b.WebGLSpriteBatch.prototype.renderBatch=function(a,b,c){if(0!==b){var d=this.gl;a._dirty[d.id]?this.renderSession.renderer.updateTexture(a):d.bindTexture(d.TEXTURE_2D,a._glTextures[d.id]),d.drawElements(d.TRIANGLES,6*b,d.UNSIGNED_SHORT,6*c*2),this.renderSession.drawCount++}},b.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},b.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},b.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},b.WebGLFastSpriteBatch=function(a){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var c=4*this.size*this.vertSize,d=6*this.maxSize;this.vertices=new b.Float32Array(c),this.indices=new b.Uint16Array(d),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var e=0,f=0;d>e;e+=6,f+=4)this.indices[e+0]=f+0,this.indices[e+1]=f+1,this.indices[e+2]=f+2,this.indices[e+3]=f+0,this.indices[e+4]=f+2,this.indices[e+5]=f+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(a)},b.WebGLFastSpriteBatch.prototype.constructor=b.WebGLFastSpriteBatch,b.WebGLFastSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW)},b.WebGLFastSpriteBatch.prototype.begin=function(a,b){this.renderSession=b,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=a.worldTransform.toArray(!0),this.start()},b.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},b.WebGLFastSpriteBatch.prototype.render=function(a){var b=a.children,c=b[0];if(c.texture._uvs){this.currentBaseTexture=c.texture.baseTexture,c.blendMode!==this.renderSession.blendModeManager.currentBlendMode&&(this.flush(),this.renderSession.blendModeManager.setBlendMode(c.blendMode));for(var d=0,e=b.length;e>d;d++)this.renderSprite(b[d]);this.flush()}},b.WebGLFastSpriteBatch.prototype.renderSprite=function(a){if(a.visible&&(a.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=a.texture.baseTexture,a.texture._uvs))){var b,c,d,e,f,g,h,i,j=this.vertices;if(b=a.texture._uvs,c=a.texture.frame.width,d=a.texture.frame.height,a.texture.trim){var k=a.texture.trim;f=k.x-a.anchor.x*k.width,e=f+a.texture.crop.width,h=k.y-a.anchor.y*k.height,g=h+a.texture.crop.height}else e=a.texture.frame.width*(1-a.anchor.x),f=a.texture.frame.width*-a.anchor.x,g=a.texture.frame.height*(1-a.anchor.y),h=a.texture.frame.height*-a.anchor.y;i=4*this.currentBatchSize*this.vertSize,j[i++]=f,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x0,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x1,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x2,j[i++]=b.y2,j[i++]=a.alpha,j[i++]=f,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x3,j[i++]=b.y3,j[i++]=a.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},b.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var a=this.gl;if(this.currentBaseTexture._glTextures[a.id]||this.renderSession.renderer.updateTexture(this.currentBaseTexture,a),a.bindTexture(a.TEXTURE_2D,this.currentBaseTexture._glTextures[a.id]),this.currentBatchSize>.5*this.size)a.bufferSubData(a.ARRAY_BUFFER,0,this.vertices);else{var b=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);a.bufferSubData(a.ARRAY_BUFFER,0,b)}a.drawElements(a.TRIANGLES,6*this.currentBatchSize,a.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},b.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},b.WebGLFastSpriteBatch.prototype.start=function(){var a=this.gl;a.activeTexture(a.TEXTURE0),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var b=this.renderSession.projection;a.uniform2f(this.shader.projectionVector,b.x,b.y),a.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var c=4*this.vertSize;a.vertexAttribPointer(this.shader.aVertexPosition,2,a.FLOAT,!1,c,0),a.vertexAttribPointer(this.shader.aPositionCoord,2,a.FLOAT,!1,c,8),a.vertexAttribPointer(this.shader.aScale,2,a.FLOAT,!1,c,16),a.vertexAttribPointer(this.shader.aRotation,1,a.FLOAT,!1,c,24),a.vertexAttribPointer(this.shader.aTextureCoord,2,a.FLOAT,!1,c,28),a.vertexAttribPointer(this.shader.colorAttribute,1,a.FLOAT,!1,c,36)},b.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},b.WebGLFilterManager.prototype.constructor=b.WebGLFilterManager,b.WebGLFilterManager.prototype.setContext=function(a){this.gl=a,this.texturePool=[],this.initShaderBuffers()},b.WebGLFilterManager.prototype.begin=function(a,b){this.renderSession=a,this.defaultShader=a.shaderManager.defaultShader;var c=this.renderSession.projection;this.width=2*c.x,this.height=2*-c.y,this.buffer=b},b.WebGLFilterManager.prototype.pushFilter=function(a){var c=this.gl,d=this.renderSession.projection,e=this.renderSession.offset;a._filterArea=a.target.filterArea||a.target.getBounds(),this.filterStack.push(a);var f=a.filterPasses[0];this.offsetX+=a._filterArea.x,this.offsetY+=a._filterArea.y;var g=this.texturePool.pop();g?g.resize(this.width,this.height):g=new b.FilterTexture(this.gl,this.width,this.height),c.bindTexture(c.TEXTURE_2D,g.texture);var h=a._filterArea,i=f.padding;h.x-=i,h.y-=i,h.width+=2*i,h.height+=2*i,h.x<0&&(h.x=0),h.width>this.width&&(h.width=this.width),h.y<0&&(h.y=0),h.height>this.height&&(h.height=this.height),c.bindFramebuffer(c.FRAMEBUFFER,g.frameBuffer),c.viewport(0,0,h.width,h.height),d.x=h.width/2,d.y=-h.height/2,e.x=-h.x,e.y=-h.y,c.colorMask(!0,!0,!0,!0),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),a._glFilterTexture=g},b.WebGLFilterManager.prototype.popFilter=function(){var a=this.gl,c=this.filterStack.pop(),d=c._filterArea,e=c._glFilterTexture,f=this.renderSession.projection,g=this.renderSession.offset;if(c.filterPasses.length>1){a.viewport(0,0,d.width,d.height),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=d.height,this.vertexArray[2]=d.width,this.vertexArray[3]=d.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=d.width,this.vertexArray[7]=0,a.bufferSubData(a.ARRAY_BUFFER,0,this.vertexArray),a.bindBuffer(a.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=d.width/this.width,this.uvArray[5]=d.height/this.height,this.uvArray[6]=d.width/this.width,this.uvArray[7]=d.height/this.height,a.bufferSubData(a.ARRAY_BUFFER,0,this.uvArray);var h=e,i=this.texturePool.pop();i||(i=new b.FilterTexture(this.gl,this.width,this.height)),i.resize(this.width,this.height),a.bindFramebuffer(a.FRAMEBUFFER,i.frameBuffer),a.clear(a.COLOR_BUFFER_BIT),a.disable(a.BLEND);for(var j=0;jB?B:A,c.beginPath(),c.moveTo(w,x+A),c.lineTo(w,x+z-A),c.quadraticCurveTo(w,x+z,w+A,x+z),c.lineTo(w+y-A,x+z),c.quadraticCurveTo(w+y,x+z,w+y,x+z-A),c.lineTo(w+y,x+A),c.quadraticCurveTo(w+y,x,w+y-A,x),c.lineTo(w+A,x),c.quadraticCurveTo(w,x,w,x+A),c.closePath(),(f.fillColor||0===f.fillColor)&&(c.globalAlpha=f.fillAlpha*d,c.fillStyle="#"+("00000"+(0|h).toString(16)).substr(-6),c.fill()),f.lineWidth&&(c.globalAlpha=f.lineAlpha*d,c.strokeStyle="#"+("00000"+(0|i).toString(16)).substr(-6),c.stroke())}}},b.CanvasGraphics.renderGraphicsMask=function(a,c){var d=a.graphicsData.length;if(0!==d){d>1&&(d=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var e=0;1>e;e++){var f=a.graphicsData[e],g=f.shape;if(f.type===b.Graphics.POLY){c.beginPath();var h=g.points;c.moveTo(h[0],h[1]);for(var i=1;iA?A:z,c.beginPath(),c.moveTo(v,w+z),c.lineTo(v,w+y-z),c.quadraticCurveTo(v,w+y,v+z,w+y),c.lineTo(v+x-z,w+y),c.quadraticCurveTo(v+x,w+y,v+x,w+y-z),c.lineTo(v+x,w+z),c.quadraticCurveTo(v+x,w,v+x-z,w),c.lineTo(v+z,w),c.quadraticCurveTo(v,w,v,w+z),c.closePath()}}}},b.CanvasGraphics.updateGraphicsTint=function(a){if(16777215!==a.tint)for(var b=(a.tint>>16&255)/255,c=(a.tint>>8&255)/255,d=(255&a.tint)/255,e=0;e>16&255)/255*b*255<<16)+((g>>8&255)/255*c*255<<8)+(255&g)/255*d*255,f._lineTint=((h>>16&255)/255*b*255<<16)+((h>>8&255)/255*c*255<<8)+(255&h)/255*d*255}},b.Graphics=function(){b.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=b.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new b.Rectangle(0,0,1,1),this.dirty=!0,this.webGLDirty=!1,this.cachedSpriteDirty=!1},b.Graphics.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Graphics.prototype.constructor=b.Graphics,Object.defineProperty(b.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(a){this._cacheAsBitmap=a,this._cacheAsBitmap?this._generateCachedSprite():(this.destroyCachedSprite(),this.dirty=!0)}}),b.Graphics.prototype.lineStyle=function(a,c,d){if(this.lineWidth=a||0,this.lineColor=c||0,this.lineAlpha=arguments.length<3?1:d,this.currentPath){if(this.currentPath.shape.points.length)return this.drawShape(new b.Polygon(this.currentPath.shape.points.slice(-2))),this;this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha}return this},b.Graphics.prototype.moveTo=function(a,c){return this.drawShape(new b.Polygon([a,c])),this},b.Graphics.prototype.lineTo=function(a,b){return this.currentPath.shape.points.push(a,b),this.dirty=!0,this},b.Graphics.prototype.quadraticCurveTo=function(a,b,c,d){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var e,f,g=20,h=this.currentPath.shape.points;0===h.length&&this.moveTo(0,0);for(var i=h[h.length-2],j=h[h.length-1],k=0,l=1;g>=l;l++)k=l/g,e=i+(a-i)*k,f=j+(b-j)*k,h.push(e+(a+(c-a)*k-e)*k,f+(b+(d-b)*k-f)*k);return this.dirty=!0,this},b.Graphics.prototype.bezierCurveTo=function(a,b,c,d,e,f){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var g,h,i,j,k,l=20,m=this.currentPath.shape.points,n=m[m.length-2],o=m[m.length-1],p=0,q=1;l>=q;q++)p=q/l,g=1-p,h=g*g,i=h*g,j=p*p,k=j*p,m.push(i*n+3*h*p*a+3*g*j*c+k*e,i*o+3*h*p*b+3*g*j*d+k*f);return this.dirty=!0,this},b.Graphics.prototype.arcTo=function(a,b,c,d,e){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(a,b):this.moveTo(a,b);var f=this.currentPath.shape.points,g=f[f.length-2],h=f[f.length-1],i=h-b,j=g-a,k=d-b,l=c-a,m=Math.abs(i*l-j*k);if(1e-8>m||0===e)(f[f.length-2]!==a||f[f.length-1]!==b)&&f.push(a,b);else{var n=i*i+j*j,o=k*k+l*l,p=i*k+j*l,q=e*Math.sqrt(n)/m,r=e*Math.sqrt(o)/m,s=q*p/n,t=r*p/o,u=q*l+r*j,v=q*k+r*i,w=j*(r+s),x=i*(r+s),y=l*(q+t),z=k*(q+t),A=Math.atan2(x-v,w-u),B=Math.atan2(z-v,y-u);this.arc(u+a,v+b,e,A,B,j*k>l*i)}return this.dirty=!0,this},b.Graphics.prototype.arc=function(a,b,c,d,e,f){var g,h=a+Math.cos(d)*c,i=b+Math.sin(d)*c;if(this.currentPath?(g=this.currentPath.shape.points,0===g.length?g.push(h,i):(g[g.length-2]!==h||g[g.length-1]!==i)&&g.push(h,i)):(this.moveTo(h,i),g=this.currentPath.shape.points),d===e)return this;!f&&d>=e?e+=2*Math.PI:f&&e>=d&&(d+=2*Math.PI);var j=f?-1*(d-e):e-d,k=Math.abs(j)/(2*Math.PI)*40;if(0===j)return this;for(var l=j/(2*k),m=2*l,n=Math.cos(l),o=Math.sin(l),p=k-1,q=p%1/p,r=0;p>=r;r++){var s=r+q*r,t=l+d+m*s,u=Math.cos(t),v=-Math.sin(t);g.push((n*u+o*v)*c+a,(n*-v+o*u)*c+b)}return this.dirty=!0,this},b.Graphics.prototype.beginFill=function(a,b){return this.filling=!0,this.fillColor=a||0,this.fillAlpha=void 0===b?1:b,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},b.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},b.Graphics.prototype.drawRect=function(a,c,d,e){return this.drawShape(new b.Rectangle(a,c,d,e)),this},b.Graphics.prototype.drawRoundedRect=function(a,c,d,e,f){return this.drawShape(new b.RoundedRectangle(a,c,d,e,f)),this},b.Graphics.prototype.drawCircle=function(a,c,d){return this.drawShape(new b.Circle(a,c,d)),this},b.Graphics.prototype.drawEllipse=function(a,c,d,e){return this.drawShape(new b.Ellipse(a,c,d,e)),this},b.Graphics.prototype.drawPolygon=function(a){return a instanceof Array||(a=Array.prototype.slice.call(arguments)),this.drawShape(new b.Polygon(a)),this},b.Graphics.prototype.clear=function(){return this.lineWidth=0,this.filling=!1,this.dirty=!0,this.clearDirty=!0,this.graphicsData=[],this},b.Graphics.prototype.generateTexture=function(a,c){a=a||1;var d=this.getBounds(),e=new b.CanvasBuffer(d.width*a,d.height*a),f=b.Texture.fromCanvas(e.canvas,c);return f.baseTexture.resolution=a,e.context.scale(a,a),e.context.translate(-d.x,-d.y),b.CanvasGraphics.renderGraphics(this,e.context),f},b.Graphics.prototype._renderWebGL=function(a){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.worldAlpha=this.worldAlpha,void b.Sprite.prototype._renderWebGL.call(this._cachedSprite,a);if(a.spriteBatch.stop(),a.blendModeManager.setBlendMode(this.blendMode),this._mask&&a.maskManager.pushMask(this._mask,a),this._filters&&a.filterManager.pushFilter(this._filterBlock),this.blendMode!==a.spriteBatch.currentBlendMode){a.spriteBatch.currentBlendMode=this.blendMode;var c=b.blendModesWebGL[a.spriteBatch.currentBlendMode];a.spriteBatch.gl.blendFunc(c[0],c[1])}if(this.webGLDirty&&(this.dirty=!0,this.webGLDirty=!1),b.WebGLGraphics.renderGraphics(this,a),this.children.length){a.spriteBatch.start();for(var d=0,e=this.children.length;e>d;d++)this.children[d]._renderWebGL(a);a.spriteBatch.stop()}this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(this.mask,a),a.drawCount++,a.spriteBatch.start()}},b.Graphics.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.alpha=this.alpha,void b.Sprite.prototype._renderCanvas.call(this._cachedSprite,a);var c=a.context,d=this.worldTransform;this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,c.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]),this._mask&&a.maskManager.pushMask(this._mask,a);var e=a.resolution;c.setTransform(d.a*e,d.b*e,d.c*e,d.d*e,d.tx*e,d.ty*e),b.CanvasGraphics.renderGraphics(this,c);for(var f=0,g=this.children.length;g>f;f++)this.children[f]._renderCanvas(a);this._mask&&a.maskManager.popMask(a)}},b.Graphics.prototype.getBounds=function(a){if(this.isMask)return b.EmptyRectangle;this.dirty&&(this.updateLocalBounds(),this.webGLDirty=!0,this.cachedSpriteDirty=!0,this.dirty=!1);var c=this._localBounds,d=c.x,e=c.width+c.x,f=c.y,g=c.height+c.y,h=a||this.worldTransform,i=h.a,j=h.b,k=h.c,l=h.d,m=h.tx,n=h.ty,o=i*e+k*g+m,p=l*g+j*e+n,q=i*d+k*g+m,r=l*g+j*d+n,s=i*d+k*f+m,t=l*f+j*d+n,u=i*e+k*f+m,v=l*f+j*e+n,w=o,x=p,y=o,z=p;return y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,z=z>r?r:z,z=z>t?t:z,z=z>v?v:z,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w,x=r>x?r:x,x=t>x?t:x,x=v>x?v:x,this._bounds.x=y,this._bounds.width=w-y,this._bounds.y=z,this._bounds.height=x-z,this._bounds},b.Graphics.prototype.updateLocalBounds=function(){var a=1/0,c=-(1/0),d=1/0,e=-(1/0);if(this.graphicsData.length)for(var f,g,h,i,j,k,l=0;lh?h:a,c=h+j>c?h+j:c,d=d>i?i:d,e=i+k>e?i+k:e;else if(n===b.Graphics.CIRC)h=f.x,i=f.y,j=f.radius+o/2,k=f.radius+o/2,a=a>h-j?h-j:a,c=h+j>c?h+j:c,d=d>i-k?i-k:d,e=i+k>e?i+k:e;else if(n===b.Graphics.ELIP)h=f.x,i=f.y,j=f.width+o/2,k=f.height+o/2,a=a>h-j?h-j:a,c=h+j>c?h+j:c,d=d>i-k?i-k:d,e=i+k>e?i+k:e;else{g=f.points;for(var p=0;ph-o?h-o:a,c=h+o>c?h+o:c,d=d>i-o?i-o:d,e=i+o>e?i+o:e}}else a=0,c=0,d=0,e=0;var q=this.boundsPadding;this._localBounds.x=a-q,this._localBounds.width=c-a+2*q,this._localBounds.y=d-q,this._localBounds.height=e-d+2*q},b.Graphics.prototype._generateCachedSprite=function(){var a=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(a.width,a.height);else{var c=new b.CanvasBuffer(a.width,a.height),d=b.Texture.fromCanvas(c.canvas);this._cachedSprite=new b.Sprite(d),this._cachedSprite.buffer=c,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(a.x/a.width),this._cachedSprite.anchor.y=-(a.y/a.height),this._cachedSprite.buffer.context.translate(-a.x,-a.y),this.worldAlpha=1,b.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},b.Graphics.prototype.updateCachedSpriteTexture=function(){var a=this._cachedSprite,b=a.texture,c=a.buffer.canvas;b.baseTexture.width=c.width,b.baseTexture.height=c.height,b.crop.width=b.frame.width=c.width,b.crop.height=b.frame.height=c.height,a._width=c.width,a._height=c.height,b.baseTexture.dirty()},b.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},b.Graphics.prototype.drawShape=function(a){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null;var c=new b.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,a);return this.graphicsData.push(c),c.type===b.Graphics.POLY&&(c.shape.closed=this.filling,this.currentPath=c),this.dirty=!0,c},b.GraphicsData=function(a,b,c,d,e,f,g){this.lineWidth=a,this.lineColor=b,this.lineAlpha=c,this._lineTint=b,this.fillColor=d,this.fillAlpha=e,this._fillTint=d,this.fill=f,this.shape=g,this.type=g.type},b.Graphics.POLY=0,b.Graphics.RECT=1,b.Graphics.CIRC=2,b.Graphics.ELIP=3,b.Graphics.RREC=4,b.Polygon.prototype.type=b.Graphics.POLY,b.Rectangle.prototype.type=b.Graphics.RECT,b.Circle.prototype.type=b.Graphics.CIRC,b.Ellipse.prototype.type=b.Graphics.ELIP,b.RoundedRectangle.prototype.type=b.Graphics.RREC,b.Strip=function(a){b.DisplayObjectContainer.call(this),this.texture=a,this.uvs=new b.Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new b.Float32Array([0,0,100,0,100,100,0,100]),this.colors=new b.Float32Array([1,1,1,1]),this.indices=new b.Uint16Array([0,1,2,3]),this.dirty=!0,this.blendMode=b.blendModes.NORMAL,this.canvasPadding=0,this.drawMode=b.Strip.DrawModes.TRIANGLE_STRIP},b.Strip.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Strip.prototype.constructor=b.Strip,b.Strip.prototype._renderWebGL=function(a){!this.visible||this.alpha<=0||(a.spriteBatch.stop(),this._vertexBuffer||this._initWebGL(a),a.shaderManager.setShader(a.shaderManager.stripShader),this._renderStrip(a),a.spriteBatch.start())},b.Strip.prototype._initWebGL=function(a){var b=a.gl;this._vertexBuffer=b.createBuffer(),this._indexBuffer=b.createBuffer(),this._uvBuffer=b.createBuffer(),this._colorBuffer=b.createBuffer(),b.bindBuffer(b.ARRAY_BUFFER,this._vertexBuffer),b.bufferData(b.ARRAY_BUFFER,this.vertices,b.DYNAMIC_DRAW),b.bindBuffer(b.ARRAY_BUFFER,this._uvBuffer),b.bufferData(b.ARRAY_BUFFER,this.uvs,b.STATIC_DRAW),b.bindBuffer(b.ARRAY_BUFFER,this._colorBuffer),b.bufferData(b.ARRAY_BUFFER,this.colors,b.STATIC_DRAW),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this._indexBuffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER,this.indices,b.STATIC_DRAW)},b.Strip.prototype._renderStrip=function(a){var c=a.gl,d=a.projection,e=a.offset,f=a.shaderManager.stripShader,g=this.drawMode===b.Strip.DrawModes.TRIANGLE_STRIP?c.TRIANGLE_STRIP:c.TRIANGLES;a.blendModeManager.setBlendMode(this.blendMode),c.uniformMatrix3fv(f.translationMatrix,!1,this.worldTransform.toArray(!0)),c.uniform2f(f.projectionVector,d.x,-d.y),c.uniform2f(f.offsetVector,-e.x,-e.y),c.uniform1f(f.alpha,this.worldAlpha),this.dirty?(this.dirty=!1,c.bindBuffer(c.ARRAY_BUFFER,this._vertexBuffer),c.bufferData(c.ARRAY_BUFFER,this.vertices,c.STATIC_DRAW),c.vertexAttribPointer(f.aVertexPosition,2,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,this._uvBuffer),c.bufferData(c.ARRAY_BUFFER,this.uvs,c.STATIC_DRAW),c.vertexAttribPointer(f.aTextureCoord,2,c.FLOAT,!1,0,0),c.activeTexture(c.TEXTURE0),this.texture.baseTexture._dirty[c.id]?a.renderer.updateTexture(this.texture.baseTexture):c.bindTexture(c.TEXTURE_2D,this.texture.baseTexture._glTextures[c.id]),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this._indexBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,this.indices,c.STATIC_DRAW)):(c.bindBuffer(c.ARRAY_BUFFER,this._vertexBuffer),c.bufferSubData(c.ARRAY_BUFFER,0,this.vertices),c.vertexAttribPointer(f.aVertexPosition,2,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,this._uvBuffer),c.vertexAttribPointer(f.aTextureCoord,2,c.FLOAT,!1,0,0),c.activeTexture(c.TEXTURE0),this.texture.baseTexture._dirty[c.id]?a.renderer.updateTexture(this.texture.baseTexture):c.bindTexture(c.TEXTURE_2D,this.texture.baseTexture._glTextures[c.id]),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this._indexBuffer)),c.drawElements(g,this.indices.length,c.UNSIGNED_SHORT,0)},b.Strip.prototype._renderCanvas=function(a){var c=a.context,d=this.worldTransform;a.roundPixels?c.setTransform(d.a,d.b,d.c,d.d,0|d.tx,0|d.ty):c.setTransform(d.a,d.b,d.c,d.d,d.tx,d.ty),this.drawMode===b.Strip.DrawModes.TRIANGLE_STRIP?this._renderCanvasTriangleStrip(c):this._renderCanvasTriangles(c)},b.Strip.prototype._renderCanvasTriangleStrip=function(a){var b=this.vertices,c=this.uvs,d=b.length/2;this.count++;for(var e=0;d-2>e;e++){var f=2*e;this._renderCanvasDrawTriangle(a,b,c,f,f+2,f+4)}},b.Strip.prototype._renderCanvasTriangles=function(a){var b=this.vertices,c=this.uvs,d=this.indices,e=d.length;this.count++;for(var f=0;e>f;f+=3){var g=2*d[f],h=2*d[f+1],i=2*d[f+2];this._renderCanvasDrawTriangle(a,b,c,g,h,i)}},b.Strip.prototype._renderCanvasDrawTriangle=function(a,b,c,d,e,f){var g=this.texture.baseTexture.source,h=this.texture.width,i=this.texture.height,j=b[d],k=b[e],l=b[f],m=b[d+1],n=b[e+1],o=b[f+1],p=c[d]*h,q=c[e]*h,r=c[f]*h,s=c[d+1]*i,t=c[e+1]*i,u=c[f+1]*i;if(this.canvasPadding>0){var v=this.canvasPadding/this.worldTransform.a,w=this.canvasPadding/this.worldTransform.d,x=(j+k+l)/3,y=(m+n+o)/3,z=j-x,A=m-y,B=Math.sqrt(z*z+A*A);j=x+z/B*(B+v),m=y+A/B*(B+w),z=k-x,A=n-y,B=Math.sqrt(z*z+A*A),k=x+z/B*(B+v),n=y+A/B*(B+w),z=l-x,A=o-y,B=Math.sqrt(z*z+A*A),l=x+z/B*(B+v),o=y+A/B*(B+w)}a.save(),a.beginPath(),a.moveTo(j,m),a.lineTo(k,n),a.lineTo(l,o),a.closePath(),a.clip();var C=p*t+s*r+q*u-t*r-s*q-p*u,D=j*t+s*l+k*u-t*l-s*k-j*u,E=p*k+j*r+q*l-k*r-j*q-p*l,F=p*t*l+s*k*r+j*q*u-j*t*r-s*q*l-p*k*u,G=m*t+s*o+n*u-t*o-s*n-m*u,H=p*n+m*r+q*o-n*r-m*q-p*o,I=p*t*o+s*n*r+m*q*u-m*t*r-s*q*o-p*n*u;a.transform(D/C,G/C,E/C,H/C,F/C,I/C),a.drawImage(g,0,0),a.restore()},b.Strip.prototype.renderStripFlat=function(a){var b=this.context,c=a.vertices,d=c.length/2;this.count++,b.beginPath();for(var e=1;d-2>e;e++){var f=2*e,g=c[f],h=c[f+2],i=c[f+4],j=c[f+1],k=c[f+3],l=c[f+5];b.moveTo(g,j),b.lineTo(h,k),b.lineTo(i,l)}b.fillStyle="#FF0000",b.fill(),b.closePath()},b.Strip.prototype.onTextureUpdate=function(){this.updateFrame=!0},b.Strip.prototype.getBounds=function(a){for(var c=a||this.worldTransform,d=c.a,e=c.b,f=c.c,g=c.d,h=c.tx,i=c.ty,j=-(1/0),k=-(1/0),l=1/0,m=1/0,n=this.vertices,o=0,p=n.length;p>o;o+=2){var q=n[o],r=n[o+1],s=d*q+f*r+h,t=g*r+e*q+i;l=l>s?s:l,m=m>t?t:m,j=s>j?s:j,k=t>k?t:k}if(l===-(1/0)||k===1/0)return b.EmptyRectangle;var u=this._bounds;return u.x=l,u.width=j-l,u.y=m,u.height=k-m,this._currentBounds=u,u},b.Strip.DrawModes={TRIANGLE_STRIP:0,TRIANGLES:1},b.Rope=function(a,c){b.Strip.call(this,a),this.points=c,this.vertices=new b.Float32Array(4*c.length),this.uvs=new b.Float32Array(4*c.length),this.colors=new b.Float32Array(2*c.length),this.indices=new b.Uint16Array(2*c.length),this.refresh()},b.Rope.prototype=Object.create(b.Strip.prototype),b.Rope.prototype.constructor=b.Rope,b.Rope.prototype.refresh=function(){var a=this.points;if(!(a.length<1)){var b=this.uvs,c=a[0],d=this.indices,e=this.colors;this.count-=.2,b[0]=0,b[1]=0,b[2]=0,b[3]=1,e[0]=1,e[1]=1,d[0]=0,d[1]=1;for(var f,g,h,i=a.length,j=1;i>j;j++)f=a[j],g=4*j,h=j/(i-1),j%2?(b[g]=h,b[g+1]=0,b[g+2]=h,b[g+3]=1):(b[g]=h,b[g+1]=0,b[g+2]=h,b[g+3]=1),g=2*j,e[g]=1,e[g+1]=1,g=2*j,d[g]=g,d[g+1]=g+1,c=f}},b.Rope.prototype.updateTransform=function(){ +var a=this.points;if(!(a.length<1)){var c,d=a[0],e={x:0,y:0};this.count-=.2;for(var f,g,h,i,j,k=this.vertices,l=a.length,m=0;l>m;m++)f=a[m],g=4*m,c=m1&&(h=1),i=Math.sqrt(e.x*e.x+e.y*e.y),j=this.texture.height/2,e.x/=i,e.y/=i,e.x*=j,e.y*=j,k[g]=f.x+e.x,k[g+1]=f.y+e.y,k[g+2]=f.x-e.x,k[g+3]=f.y-e.y,d=f;b.DisplayObjectContainer.prototype.updateTransform.call(this)}},b.Rope.prototype.setTexture=function(a){this.texture=a},b.TilingSprite=function(a,c,d){b.Sprite.call(this,a),this._width=c||100,this._height=d||100,this.tileScale=new b.Point(1,1),this.tileScaleOffset=new b.Point(1,1),this.tilePosition=new b.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=b.blendModes.NORMAL},b.TilingSprite.prototype=Object.create(b.Sprite.prototype),b.TilingSprite.prototype.constructor=b.TilingSprite,Object.defineProperty(b.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(a){this._width=a}}),Object.defineProperty(b.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(a){this._height=a}}),b.TilingSprite.prototype.setTexture=function(a){this.texture!==a&&(this.texture=a,this.refreshTexture=!0,this.cachedTint=16777215)},b.TilingSprite.prototype._renderWebGL=function(a){if(this.visible!==!1&&0!==this.alpha){var b,c;for(this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(a.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)):a.spriteBatch.renderTilingSprite(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(this._mask,a),a.spriteBatch.start()}},b.TilingSprite.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){var c=a.context;this._mask&&a.maskManager.pushMask(this._mask,a),c.globalAlpha=this.worldAlpha;var d,e,f=this.worldTransform,g=a.resolution;if(c.setTransform(f.a*g,f.b*g,f.c*g,f.d*g,f.tx*g,f.ty*g),!this.__tilePattern||this.refreshTexture){if(this.generateTilingTexture(!1),!this.tilingTexture)return;this.__tilePattern=c.createPattern(this.tilingTexture.baseTexture.source,"repeat")}this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,c.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]);var h=this.tilePosition,i=this.tileScale;for(h.x%=this.tilingTexture.baseTexture.width,h.y%=this.tilingTexture.baseTexture.height,c.scale(i.x,i.y),c.translate(h.x+this.anchor.x*-this._width,h.y+this.anchor.y*-this._height),c.fillStyle=this.__tilePattern,c.fillRect(-h.x,-h.y,this._width/i.x,this._height/i.y),c.scale(1/i.x,1/i.y),c.translate(-h.x+this.anchor.x*this._width,-h.y+this.anchor.y*this._height),this._mask&&a.maskManager.popMask(a),d=0,e=this.children.length;e>d;d++)this.children[d]._renderCanvas(a)}},b.TilingSprite.prototype.getBounds=function(){var a=this._width,b=this._height,c=a*(1-this.anchor.x),d=a*-this.anchor.x,e=b*(1-this.anchor.y),f=b*-this.anchor.y,g=this.worldTransform,h=g.a,i=g.b,j=g.c,k=g.d,l=g.tx,m=g.ty,n=h*d+j*f+l,o=k*f+i*d+m,p=h*c+j*f+l,q=k*f+i*c+m,r=h*c+j*e+l,s=k*e+i*c+m,t=h*d+j*e+l,u=k*e+i*d+m,v=-(1/0),w=-(1/0),x=1/0,y=1/0;x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w;var z=this._bounds;return z.x=x,z.width=v-x,z.y=y,z.height=w-y,this._currentBounds=z,z},b.TilingSprite.prototype.onTextureUpdate=function(){},b.TilingSprite.prototype.generateTilingTexture=function(a){if(this.texture.baseTexture.hasLoaded){var c,d,e=this.originalTexture||this.texture,f=e.frame,g=f.width!==e.baseTexture.width||f.height!==e.baseTexture.height,h=!1;if(a?(c=b.getNextPowerOfTwo(f.width),d=b.getNextPowerOfTwo(f.height),(f.width!==c||f.height!==d||e.baseTexture.width!==c||e.baseTexture.height||d)&&(h=!0)):g&&(e.trim?(c=e.trim.width,d=e.trim.height):(c=f.width,d=f.height),h=!0),h){var i;this.tilingTexture&&this.tilingTexture.isTiling?(i=this.tilingTexture.canvasBuffer,i.resize(c,d),this.tilingTexture.baseTexture.width=c,this.tilingTexture.baseTexture.height=d,this.tilingTexture.needsUpdate=!0):(i=new b.CanvasBuffer(c,d),this.tilingTexture=b.Texture.fromCanvas(i.canvas),this.tilingTexture.canvasBuffer=i,this.tilingTexture.isTiling=!0),i.context.drawImage(e.baseTexture.source,e.crop.x,e.crop.y,e.crop.width,e.crop.height,0,0,c,d),this.tileScaleOffset.x=f.width/c,this.tileScaleOffset.y=f.height/d}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=e;this.refreshTexture=!1,this.originalTexture=this.texture,this.texture=this.tilingTexture,this.tilingTexture.baseTexture._powerOf2=!0}},b.TilingSprite.prototype.destroy=function(){b.Sprite.prototype.destroy.call(this),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture&&(this.tilingTexture.destroy(!0),this.tilingTexture=null)};var c={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};c.BoneData=function(a,b){this.name=a,this.parent=b},c.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},c.SlotData=function(a,b){this.name=a,this.boneData=b},c.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},c.IkConstraintData=function(a){this.name=a,this.bones=[]},c.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},c.Bone=function(a,b,c){this.data=a,this.skeleton=b,this.parent=c,this.setToSetupPose()},c.Bone.yDown=!1,c.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var a=this.parent;if(a)this.worldX=this.x*a.m00+this.y*a.m01+a.worldX,this.worldY=this.x*a.m10+this.y*a.m11+a.worldY,this.data.inheritScale?(this.worldScaleX=a.worldScaleX*this.scaleX,this.worldScaleY=a.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?a.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=a.worldFlipX!=this.flipX,this.worldFlipY=a.worldFlipY!=this.flipY;else{var b=this.skeleton.flipX,d=this.skeleton.flipY;this.worldX=b?-this.x:this.x,this.worldY=d!=c.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=b!=this.flipX,this.worldFlipY=d!=this.flipY}var e=this.worldRotation*c.degRad,f=Math.cos(e),g=Math.sin(e);this.worldFlipX?(this.m00=-f*this.worldScaleX,this.m01=g*this.worldScaleY):(this.m00=f*this.worldScaleX,this.m01=-g*this.worldScaleY),this.worldFlipY!=c.Bone.yDown?(this.m10=-g*this.worldScaleX,this.m11=-f*this.worldScaleY):(this.m10=g*this.worldScaleX,this.m11=f*this.worldScaleY)},setToSetupPose:function(){var a=this.data;this.x=a.x,this.y=a.y,this.rotation=a.rotation,this.rotationIK=this.rotation,this.scaleX=a.scaleX,this.scaleY=a.scaleY,this.flipX=a.flipX,this.flipY=a.flipY},worldToLocal:function(a){var b=a[0]-this.worldX,d=a[1]-this.worldY,e=this.m00,f=this.m10,g=this.m01,h=this.m11;this.worldFlipX!=(this.worldFlipY!=c.Bone.yDown)&&(e=-e,h=-h);var i=1/(e*h-g*f);a[0]=b*e*i-d*g*i,a[1]=d*h*i-b*f*i},localToWorld:function(a){var b=a[0],c=a[1];a[0]=b*this.m00+c*this.m01+this.worldX,a[1]=b*this.m10+c*this.m11+this.worldY}},c.Slot=function(a,b){this.data=a,this.bone=b,this.setToSetupPose()},c.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(a){this.attachment=a,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(a){this._attachmentTime=this.bone.skeleton.time-a},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var a=this.data;this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a;for(var b=this.bone.skeleton.data.slots,c=0,d=b.length;d>c;c++)if(b[c]==a){this.setAttachment(a.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(c,a.attachmentName):null);break}}},c.IkConstraint=function(a,b){this.data=a,this.mix=a.mix,this.bendDirection=a.bendDirection,this.bones=[];for(var c=0,d=a.bones.length;d>c;c++)this.bones.push(b.findBone(a.bones[c].name));this.target=b.findBone(a.target.name)},c.IkConstraint.prototype={apply:function(){var a=this.target,b=this.bones;switch(b.length){case 1:c.IkConstraint.apply1(b[0],a.worldX,a.worldY,this.mix);break;case 2:c.IkConstraint.apply2(b[0],b[1],a.worldX,a.worldY,this.bendDirection,this.mix)}}},c.IkConstraint.apply1=function(a,b,d,e){var f=a.data.inheritRotation&&a.parent?a.parent.worldRotation:0,g=a.rotation,h=Math.atan2(d-a.worldY,b-a.worldX)*c.radDeg-f;a.rotationIK=g+(h-g)*e},c.IkConstraint.apply2=function(a,b,d,e,f,g){var h=b.rotation,i=a.rotation;if(!g)return b.rotationIK=h,void(a.rotationIK=i);var j,k,l=c.temp,m=a.parent;m?(l[0]=d,l[1]=e,m.worldToLocal(l),d=(l[0]-a.x)*m.worldScaleX,e=(l[1]-a.y)*m.worldScaleY):(d-=a.x,e-=a.y),b.parent==a?(j=b.x,k=b.y):(l[0]=b.x,l[1]=b.y,b.parent.localToWorld(l),a.worldToLocal(l),j=l[0],k=l[1]);var n=j*a.worldScaleX,o=k*a.worldScaleY,p=Math.atan2(o,n),q=Math.sqrt(n*n+o*o),r=b.data.length*b.worldScaleX,s=2*q*r;if(1e-4>s)return void(b.rotationIK=h+(Math.atan2(e,d)*c.radDeg-i-h)*g);var t=(d*d+e*e-q*q-r*r)/s;-1>t?t=-1:t>1&&(t=1);var u=Math.acos(t)*f,v=q+r*t,w=r*Math.sin(u),x=Math.atan2(e*v-d*w,d*v+e*w),y=(x-p)*c.radDeg-i;y>180?y-=360:-180>y&&(y+=360),a.rotationIK=i+y*g,y=(u+p)*c.radDeg-h,y>180?y-=360:-180>y&&(y+=360),b.rotationIK=h+(y+a.worldRotation-b.parent.worldRotation)*g},c.Skin=function(a){this.name=a,this.attachments={}},c.Skin.prototype={addAttachment:function(a,b,c){this.attachments[a+":"+b]=c},getAttachment:function(a,b){return this.attachments[a+":"+b]},_attachAll:function(a,b){for(var c in b.attachments){var d=c.indexOf(":"),e=parseInt(c.substring(0,d)),f=c.substring(d+1),g=a.slots[e];if(g.attachment&&g.attachment.name==f){var h=this.getAttachment(e,f);h&&g.setAttachment(h)}}}},c.Animation=function(a,b,c){this.name=a,this.timelines=b,this.duration=c},c.Animation.prototype={apply:function(a,b,c,d,e){d&&0!=this.duration&&(c%=this.duration,b%=this.duration);for(var f=this.timelines,g=0,h=f.length;h>g;g++)f[g].apply(a,b,c,e,1)},mix:function(a,b,c,d,e,f){d&&0!=this.duration&&(c%=this.duration,b%=this.duration);for(var g=this.timelines,h=0,i=g.length;i>h;h++)g[h].apply(a,b,c,e,f)}},c.Animation.binarySearch=function(a,b,c){var d=0,e=Math.floor(a.length/c)-2;if(!e)return c;for(var f=e>>>1;;){if(a[(f+1)*c]<=b?d=f+1:e=f,d==e)return(d+1)*c;f=d+e>>>1}},c.Animation.binarySearch1=function(a,b){var c=0,d=a.length-2;if(!d)return 1;for(var e=d>>>1;;){if(a[e+1]<=b?c=e+1:d=e,c==d)return c+1;e=c+d>>>1}},c.Animation.linearSearch=function(a,b,c){for(var d=0,e=a.length-c;e>=d;d+=c)if(a[d]>b)return d;return-1},c.Curves=function(){this.curves=[]},c.Curves.prototype={setLinear:function(a){this.curves[19*a]=0},setStepped:function(a){this.curves[19*a]=1},setCurve:function(a,b,c,d,e){var f=.1,g=f*f,h=g*f,i=3*f,j=3*g,k=6*g,l=6*h,m=2*-b+d,n=2*-c+e,o=3*(b-d)+1,p=3*(c-e)+1,q=b*i+m*j+o*h,r=c*i+n*j+p*h,s=m*k+o*l,t=n*k+p*l,u=o*l,v=p*l,w=19*a,x=this.curves;x[w++]=2;for(var y=q,z=r,A=w+19-1;A>w;w+=2)x[w]=y,x[w+1]=z,q+=s,r+=t,s+=u,t+=v,y+=q,z+=r},getCurvePercent:function(a,b){b=0>b?0:b>1?1:b;var c=this.curves,d=19*a,e=c[d];if(0===e)return b;if(1==e)return 0;d++;for(var f=0,g=d,h=d+19-1;h>d;d+=2)if(f=c[d],f>=b){var i,j;return d==g?(i=0,j=0):(i=c[d-2],j=c[d-1]),j+(c[d+1]-j)*(b-i)/(f-i)}var k=c[d-1];return k+(1-k)*(b-f)/(1-f)}},c.RotateTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=2*a},c.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2,this.frames[a]=b,this.frames[a+1]=c},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-2]){for(var i=h.data.rotation+g[g.length-1]-h.rotation;i>180;)i-=360;for(;-180>i;)i+=360;return void(h.rotation+=i*f)}var j=c.Animation.binarySearch(g,d,2),k=g[j-1],l=g[j],m=1-(d-l)/(g[j-2]-l);m=this.curves.getCurvePercent(j/2-1,m);for(var i=g[j+1]-k;i>180;)i-=360;for(;-180>i;)i+=360;for(i=h.data.rotation+(k+i*m)-h.rotation;i>180;)i-=360;for(;-180>i;)i+=360;h.rotation+=i*f}}},c.TranslateTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=3*a},c.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-3])return h.x+=(h.data.x+g[g.length-2]-h.x)*f,void(h.y+=(h.data.y+g[g.length-1]-h.y)*f);var i=c.Animation.binarySearch(g,d,3),j=g[i-2],k=g[i-1],l=g[i],m=1-(d-l)/(g[i+-3]-l);m=this.curves.getCurvePercent(i/3-1,m),h.x+=(h.data.x+j+(g[i+1]-j)*m-h.x)*f,h.y+=(h.data.y+k+(g[i+2]-k)*m-h.y)*f}}},c.ScaleTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=3*a},c.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-3])return h.scaleX+=(h.data.scaleX*g[g.length-2]-h.scaleX)*f,void(h.scaleY+=(h.data.scaleY*g[g.length-1]-h.scaleY)*f);var i=c.Animation.binarySearch(g,d,3),j=g[i-2],k=g[i-1],l=g[i],m=1-(d-l)/(g[i+-3]-l);m=this.curves.getCurvePercent(i/3-1,m),h.scaleX+=(h.data.scaleX*(j+(g[i+1]-j)*m)-h.scaleX)*f,h.scaleY+=(h.data.scaleY*(k+(g[i+2]-k)*m)-h.scaleY)*f}}},c.ColorTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=5*a},c.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(a,b,c,d,e,f){a*=5,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d,this.frames[a+3]=e,this.frames[a+4]=f},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-5]){var l=g.length-1;h=g[l-3],i=g[l-2],j=g[l-1],k=g[l]}else{var m=c.Animation.binarySearch(g,d,5),n=g[m-4],o=g[m-3],p=g[m-2],q=g[m-1],r=g[m],s=1-(d-r)/(g[m-5]-r);s=this.curves.getCurvePercent(m/5-1,s),h=n+(g[m+1]-n)*s,i=o+(g[m+2]-o)*s,j=p+(g[m+3]-p)*s,k=q+(g[m+4]-q)*s}var t=a.slots[this.slotIndex];1>f?(t.r+=(h-t.r)*f,t.g+=(i-t.g)*f,t.b+=(j-t.b)*f,t.a+=(k-t.a)*f):(t.r=h,t.g=i,t.b=j,t.a=k)}}},c.AttachmentTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=a,this.attachmentNames=[],this.attachmentNames.length=a},c.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b,this.attachmentNames[a]=c},apply:function(a,b,d){var e=this.frames;if(dd&&this.apply(a,b,Number.MAX_VALUE,null,0));b>d&&(b=-1);var f=d>=e[e.length-1]?e.length-1:c.Animation.binarySearch1(e,d)-1;if(!(e[f]d)this.apply(a,b,Number.MAX_VALUE,e,f),b=-1;else if(b>=g[h-1])return;if(!(d0&&g[i-1]==j;)i--}for(var k=this.events;h>i&&d>=g[i];i++)e.push(k[i])}}}},c.DrawOrderTimeline=function(a){this.frames=[],this.frames.length=a,this.drawOrders=[],this.drawOrders.length=a},c.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b,this.drawOrders[a]=c},apply:function(a,b,d){var e=this.frames;if(!(d=e[e.length-1]?e.length-1:c.Animation.binarySearch1(e,d)-1;var g=a.drawOrder,h=(a.slots,this.drawOrders[f]);if(h)for(var i=0,j=h.length;j>i;i++)g[i]=h[i]}}},c.FfdTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=a,this.frameVertices=[],this.frameVertices.length=a},c.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(a,b,c){this.frames[a]=b,this.frameVertices[a]=c},apply:function(a,b,d,e,f){var g=a.slots[this.slotIndex];if(g.attachment==this.attachment){var h=this.frames;if(!(d=h[h.length-1]){var l=i[h.length-1];if(1>f)for(var m=0;j>m;m++)k[m]+=(l[m]-k[m])*f;else for(var m=0;j>m;m++)k[m]=l[m]}else{var n=c.Animation.binarySearch1(h,d),o=h[n],p=1-(d-o)/(h[n-1]-o);p=this.curves.getCurvePercent(n-1,0>p?0:p>1?1:p);var q=i[n-1],r=i[n];if(1>f)for(var m=0;j>m;m++){var s=q[m];k[m]+=(s+(r[m]-s)*p-k[m])*f}else for(var m=0;j>m;m++){var s=q[m];k[m]=s+(r[m]-s)*p}}}}}},c.IkConstraintTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=3*a},c.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(a,b,c,d){a*=3,this.frames[a]=b,this.frames[a+1]=c,this.frames[a+2]=d},apply:function(a,b,d,e,f){var g=this.frames;if(!(d=g[g.length-3])return h.mix+=(g[g.length-2]-h.mix)*f,void(h.bendDirection=g[g.length-1]);var i=c.Animation.binarySearch(g,d,3),j=g[i+-2],k=g[i],l=1-(d-k)/(g[i+-3]-k);l=this.curves.getCurvePercent(i/3-1,l);var m=j+(g[i+1]-j)*l;h.mix+=(m-h.mix)*f,h.bendDirection=g[i+-1]}}},c.FlipXTimeline=function(a){this.curves=new c.Curves(a),this.frames=[],this.frames.length=2*a},c.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(a,b,c){a*=2,this.frames[a]=b,this.frames[a+1]=c?1:0},apply:function(a,b,d){var e=this.frames;if(dd&&this.apply(a,b,Number.MAX_VALUE,null,0));b>d&&(b=-1);var f=(d>=e[e.length-2]?e.length:c.Animation.binarySearch(e,d,2))-2;e[f]d&&this.apply(a,b,Number.MAX_VALUE,null,0));b>d&&(b=-1);var f=(d>=e[e.length-2]?e.length:c.Animation.binarySearch(e,d,2))-2;e[f]c;c++)if(b[c].name==a)return b[c];return null},findBoneIndex:function(a){for(var b=this.bones,c=0,d=b.length;d>c;c++)if(b[c].name==a)return c;return-1},findSlot:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].name==a)return slot[c];return null},findSlotIndex:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].name==a)return c;return-1},findSkin:function(a){for(var b=this.skins,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},findEvent:function(a){for(var b=this.events,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},findAnimation:function(a){for(var b=this.animations,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},findIkConstraint:function(a){for(var b=this.ikConstraints,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null}},c.Skeleton=function(a){this.data=a,this.bones=[];for(var b=0,d=a.bones.length;d>b;b++){var e=a.bones[b],f=e.parent?this.bones[a.bones.indexOf(e.parent)]:null;this.bones.push(new c.Bone(e,this,f))}this.slots=[],this.drawOrder=[];for(var b=0,d=a.slots.length;d>b;b++){var g=a.slots[b],h=this.bones[a.bones.indexOf(g.boneData)],i=new c.Slot(g,h);this.slots.push(i),this.drawOrder.push(b)}this.ikConstraints=[];for(var b=0,d=a.ikConstraints.length;d>b;b++)this.ikConstraints.push(new c.IkConstraint(a.ikConstraints[b],this));this.boneCache=[],this.updateCache()},c.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var a=this.ikConstraints,b=a.length,c=b+1,d=this.boneCache;d.length>c&&(d.length=c);for(var e=0,f=d.length;f>e;e++)d[e].length=0;for(;d.lengthe;e++){var i=h[e],j=i;do{for(var k=0;b>k;k++)for(var l=a[k],m=l.bones[0],n=l.bones[l.bones.length-1];;){if(j==n){d[k].push(i),d[k+1].push(i);continue a}if(n==m)break;n=n.parent}j=j.parent}while(j);g[g.length]=i}},updateWorldTransform:function(){for(var a=this.bones,b=0,c=a.length;c>b;b++){var d=a[b];d.rotationIK=d.rotation}for(var b=0,e=this.boneCache.length-1;;){for(var f=this.boneCache[b],g=0,h=f.length;h>g;g++)f[g].updateWorldTransform();if(b==e)break;this.ikConstraints[b].apply(),b++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var a=this.bones,b=0,c=a.length;c>b;b++)a[b].setToSetupPose();for(var d=this.ikConstraints,b=0,c=d.length;c>b;b++){var e=d[b];e.bendDirection=e.data.bendDirection,e.mix=e.data.mix}},setSlotsToSetupPose:function(){for(var a=this.slots,b=0,c=a.length;c>b;b++)a[b].setToSetupPose(b);this.resetDrawOrder()},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(a){for(var b=this.bones,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return b[c];return null},findBoneIndex:function(a){for(var b=this.bones,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return c;return-1},findSlot:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return b[c];return null},findSlotIndex:function(a){for(var b=this.slots,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return c;return-1},setSkinByName:function(a){var b=this.data.findSkin(a);if(!b)throw"Skin not found: "+a;this.setSkin(b)},setSkin:function(a){if(a)if(this.skin)a._attachAll(this,this.skin);else for(var b=this.slots,c=0,d=b.length;d>c;c++){var e=b[c],f=e.data.attachmentName;if(f){var g=a.getAttachment(c,f);g&&e.setAttachment(g)}}this.skin=a},getAttachmentBySlotName:function(a,b){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(a),b)},getAttachmentBySlotIndex:function(a,b){if(this.skin){var c=this.skin.getAttachment(a,b);if(c)return c}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(a,b):null},setAttachment:function(a,b){for(var c=this.slots,d=0,e=c.length;e>d;d++){var f=c[d];if(f.data.name==a){var g=null;if(b&&(g=this.getAttachmentBySlotIndex(d,b),!g))throw"Attachment not found: "+b+", for slot: "+a;return void f.setAttachment(g)}}throw"Slot not found: "+a},findIkConstraint:function(a){for(var b=this.ikConstraints,c=0,d=b.length;d>c;c++)if(b[c].data.name==a)return b[c];return null},update:function(a){this.time+=a},resetDrawOrder:function(){for(var a=0,b=this.drawOrder.length;b>a;a++)this.drawOrder[a]=a}},c.EventData=function(a){this.name=a},c.EventData.prototype={intValue:0,floatValue:0,stringValue:null},c.Event=function(a){this.data=a},c.Event.prototype={intValue:0,floatValue:0,stringValue:null},c.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},c.RegionAttachment=function(a){this.name=a,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},c.RegionAttachment.prototype={type:c.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(a,b,c,d,e){var f=this.uvs;e?(f[2]=a,f[3]=d,f[4]=a,f[5]=b,f[6]=c,f[7]=b,f[0]=c,f[1]=d):(f[0]=a,f[1]=d,f[2]=a,f[3]=b,f[4]=c,f[5]=b,f[6]=c,f[7]=d)},updateOffset:function(){var a=this.width/this.regionOriginalWidth*this.scaleX,b=this.height/this.regionOriginalHeight*this.scaleY,d=-this.width/2*this.scaleX+this.regionOffsetX*a,e=-this.height/2*this.scaleY+this.regionOffsetY*b,f=d+this.regionWidth*a,g=e+this.regionHeight*b,h=this.rotation*c.degRad,i=Math.cos(h),j=Math.sin(h),k=d*i+this.x,l=d*j,m=e*i+this.y,n=e*j,o=f*i+this.x,p=f*j,q=g*i+this.y,r=g*j,s=this.offset;s[0]=k-n,s[1]=m+l,s[2]=k-r,s[3]=q+l,s[4]=o-r,s[5]=q+p,s[6]=o-n,s[7]=m+p},computeVertices:function(a,b,c,d){a+=c.worldX,b+=c.worldY;var e=c.m00,f=c.m01,g=c.m10,h=c.m11,i=this.offset;d[0]=i[0]*e+i[1]*f+a,d[1]=i[0]*g+i[1]*h+b,d[2]=i[2]*e+i[3]*f+a,d[3]=i[2]*g+i[3]*h+b,d[4]=i[4]*e+i[5]*f+a,d[5]=i[4]*g+i[5]*h+b,d[6]=i[6]*e+i[7]*f+a,d[7]=i[6]*g+i[7]*h+b}},c.MeshAttachment=function(a){this.name=a},c.MeshAttachment.prototype={type:c.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var a=this.regionU2-this.regionU,b=this.regionV2-this.regionV,d=this.regionUVs.length;if(this.uvs&&this.uvs.length==d||(this.uvs=new c.Float32Array(d)),this.regionRotate)for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e+1]*a,this.uvs[e+1]=this.regionV+b-this.regionUVs[e]*b;else for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e]*a,this.uvs[e+1]=this.regionV+this.regionUVs[e+1]*b},computeWorldVertices:function(a,b,c,d){var e=c.bone;a+=e.worldX,b+=e.worldY;var f=e.m00,g=e.m01,h=e.m10,i=e.m11,j=this.vertices,k=j.length;c.attachmentVertices.length==k&&(j=c.attachmentVertices);for(var l=0;k>l;l+=2){var m=j[l],n=j[l+1];d[l]=m*f+n*g+a,d[l+1]=m*h+n*i+b}}},c.SkinnedMeshAttachment=function(a){this.name=a},c.SkinnedMeshAttachment.prototype={type:c.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var a=this.regionU2-this.regionU,b=this.regionV2-this.regionV,d=this.regionUVs.length;if(this.uvs&&this.uvs.length==d||(this.uvs=new c.Float32Array(d)),this.regionRotate)for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e+1]*a,this.uvs[e+1]=this.regionV+b-this.regionUVs[e]*b;else for(var e=0;d>e;e+=2)this.uvs[e]=this.regionU+this.regionUVs[e]*a,this.uvs[e+1]=this.regionV+this.regionUVs[e+1]*b},computeWorldVertices:function(a,b,c,d){var e,f,g,h,i,j,k,l=c.bone.skeleton.bones,m=this.weights,n=this.bones,o=0,p=0,q=0,r=0,s=n.length;if(c.attachmentVertices.length)for(var t=c.attachmentVertices;s>p;o+=2){for(f=0,g=0,e=n[p++]+p;e>p;p++,q+=3,r+=2)h=l[n[p]],i=m[q]+t[r],j=m[q+1]+t[r+1],k=m[q+2],f+=(i*h.m00+j*h.m01+h.worldX)*k,g+=(i*h.m10+j*h.m11+h.worldY)*k;d[o]=f+a,d[o+1]=g+b}else for(;s>p;o+=2){for(f=0,g=0,e=n[p++]+p;e>p;p++,q+=3)h=l[n[p]],i=m[q],j=m[q+1],k=m[q+2],f+=(i*h.m00+j*h.m01+h.worldX)*k,g+=(i*h.m10+j*h.m11+h.worldY)*k;d[o]=f+a,d[o+1]=g+b}}},c.BoundingBoxAttachment=function(a){this.name=a,this.vertices=[]},c.BoundingBoxAttachment.prototype={type:c.AttachmentType.boundingbox,computeWorldVertices:function(a,b,c,d){a+=c.worldX,b+=c.worldY;for(var e=c.m00,f=c.m01,g=c.m10,h=c.m11,i=this.vertices,j=0,k=i.length;k>j;j+=2){var l=i[j],m=i[j+1];d[j]=l*e+m*f+a,d[j+1]=l*g+m*h+b}}},c.AnimationStateData=function(a){this.skeletonData=a,this.animationToMixTime={}},c.AnimationStateData.prototype={defaultMix:0,setMixByName:function(a,b,c){var d=this.skeletonData.findAnimation(a);if(!d)throw"Animation not found: "+a;var e=this.skeletonData.findAnimation(b);if(!e)throw"Animation not found: "+b;this.setMix(d,e,c)},setMix:function(a,b,c){this.animationToMixTime[a.name+":"+b.name]=c},getMix:function(a,b){var c=a.name+":"+b.name;return this.animationToMixTime.hasOwnProperty(c)?this.animationToMixTime[c]:this.defaultMix}},c.TrackEntry=function(){},c.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},c.AnimationState=function(a){this.data=a,this.tracks=[],this.events=[]},c.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(a){a*=this.timeScale;for(var b=0;b=0&&this.setCurrent(b,e)):!c.loop&&c.lastTime>=c.endTime&&this.clearTrack(b)}}},apply:function(a){a.resetDrawOrder();for(var b=0;bf&&(d=f);var h=c.previous;if(h){var i=h.time;!h.loop&&i>h.endTime&&(i=h.endTime),h.animation.apply(a,i,i,h.loop,null);var j=c.mixTime/c.mixDuration*c.mix;j>=1&&(j=1,c.previous=null),c.animation.mix(a,c.lastTime,d,g,this.events,j)}else 1==c.mix?c.animation.apply(a,c.lastTime,d,g,this.events):c.animation.mix(a,c.lastTime,d,g,this.events,c.mix);for(var k=0,l=this.events.length;l>k;k++){var m=this.events[k];c.onEvent&&c.onEvent(b,m),this.onEvent&&this.onEvent(b,m)}if(g?e%f>d%f:f>e&&d>=f){var n=Math.floor(d/f);c.onComplete&&c.onComplete(b,n),this.onComplete&&this.onComplete(b,n)}c.lastTime=c.time}}},clearTracks:function(){for(var a=0,b=this.tracks.length;b>a;a++)this.clearTrack(a);this.tracks.length=0},clearTrack:function(a){if(!(a>=this.tracks.length)){var b=this.tracks[a];b&&(b.onEnd&&b.onEnd(a),this.onEnd&&this.onEnd(a),this.tracks[a]=null)}},_expandToIndex:function(a){if(a=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(a,b){var c=this._expandToIndex(a);if(c){var d=c.previous;c.previous=null,c.onEnd&&c.onEnd(a),this.onEnd&&this.onEnd(a),b.mixDuration=this.data.getMix(c.animation,b.animation),b.mixDuration>0&&(b.mixTime=0,b.previous=d&&c.mixTime/c.mixDuration<.5?d:c)}this.tracks[a]=b,b.onStart&&b.onStart(a),this.onStart&&this.onStart(a)},setAnimationByName:function(a,b,c){var d=this.data.skeletonData.findAnimation(b);if(!d)throw"Animation not found: "+b;return this.setAnimation(a,d,c)},setAnimation:function(a,b,d){var e=new c.TrackEntry;return e.animation=b,e.loop=d,e.endTime=b.duration,this.setCurrent(a,e),e},addAnimationByName:function(a,b,c,d){var e=this.data.skeletonData.findAnimation(b);if(!e)throw"Animation not found: "+b;return this.addAnimation(a,e,c,d)},addAnimation:function(a,b,d,e){var f=new c.TrackEntry;f.animation=b,f.loop=d,f.endTime=b.duration;var g=this._expandToIndex(a);if(g){for(;g.next;)g=g.next;g.next=f}else this.tracks[a]=f;return 0>=e&&(g?e+=g.endTime-this.data.getMix(g.animation,b):e=0),f.delay=e,f},getCurrent:function(a){return a>=this.tracks.length?null:this.tracks[a]}},c.SkeletonJson=function(a){this.attachmentLoader=a},c.SkeletonJson.prototype={scale:1,readSkeletonData:function(a,b){var d=new c.SkeletonData;d.name=b;var e=a.skeleton;e&&(d.hash=e.hash,d.version=e.spine,d.width=e.width||0,d.height=e.height||0);for(var f=a.bones,g=0,h=f.length;h>g;g++){ +var i=f[g],j=null;if(i.parent&&(j=d.findBone(i.parent),!j))throw"Parent bone not found: "+i.parent;var k=new c.BoneData(i.name,j);k.length=(i.length||0)*this.scale,k.x=(i.x||0)*this.scale,k.y=(i.y||0)*this.scale,k.rotation=i.rotation||0,k.scaleX=i.hasOwnProperty("scaleX")?i.scaleX:1,k.scaleY=i.hasOwnProperty("scaleY")?i.scaleY:1,k.inheritScale=i.hasOwnProperty("inheritScale")?i.inheritScale:!0,k.inheritRotation=i.hasOwnProperty("inheritRotation")?i.inheritRotation:!0,d.bones.push(k)}var l=a.ik;if(l)for(var g=0,h=l.length;h>g;g++){for(var m=l[g],n=new c.IkConstraintData(m.name),f=m.bones,o=0,p=f.length;p>o;o++){var q=d.findBone(f[o]);if(!q)throw"IK bone not found: "+f[o];n.bones.push(q)}if(n.target=d.findBone(m.target),!n.target)throw"Target bone not found: "+m.target;n.bendDirection=!m.hasOwnProperty("bendPositive")||m.bendPositive?1:-1,n.mix=m.hasOwnProperty("mix")?m.mix:1,d.ikConstraints.push(n)}for(var r=a.slots,g=0,h=r.length;h>g;g++){var s=r[g],k=d.findBone(s.bone);if(!k)throw"Slot bone not found: "+s.bone;var t=new c.SlotData(s.name,k),u=s.color;u&&(t.r=this.toColor(u,0),t.g=this.toColor(u,1),t.b=this.toColor(u,2),t.a=this.toColor(u,3)),t.attachmentName=s.attachment,t.additiveBlending=s.additive&&"true"==s.additive,d.slots.push(t)}var v=a.skins;for(var w in v)if(v.hasOwnProperty(w)){var x=v[w],y=new c.Skin(w);for(var z in x)if(x.hasOwnProperty(z)){var A=d.findSlotIndex(z),B=x[z];for(var C in B)if(B.hasOwnProperty(C)){var D=this.readAttachment(y,C,B[C]);D&&y.addAttachment(A,C,D)}}d.skins.push(y),"default"==y.name&&(d.defaultSkin=y)}var E=a.events;for(var F in E)if(E.hasOwnProperty(F)){var G=E[F],H=new c.EventData(F);H.intValue=G["int"]||0,H.floatValue=G["float"]||0,H.stringValue=G.string||null,d.events.push(H)}var I=a.animations;for(var J in I)I.hasOwnProperty(J)&&this.readAnimation(J,I[J],d);return d},readAttachment:function(a,b,d){b=d.name||b;var e=c.AttachmentType[d.type||"region"],f=d.path||b,g=this.scale;if(e==c.AttachmentType.region){var h=this.attachmentLoader.newRegionAttachment(a,b,f);if(!h)return null;h.path=f,h.x=(d.x||0)*g,h.y=(d.y||0)*g,h.scaleX=d.hasOwnProperty("scaleX")?d.scaleX:1,h.scaleY=d.hasOwnProperty("scaleY")?d.scaleY:1,h.rotation=d.rotation||0,h.width=(d.width||0)*g,h.height=(d.height||0)*g;var i=d.color;return i&&(h.r=this.toColor(i,0),h.g=this.toColor(i,1),h.b=this.toColor(i,2),h.a=this.toColor(i,3)),h.updateOffset(),h}if(e==c.AttachmentType.mesh){var j=this.attachmentLoader.newMeshAttachment(a,b,f);return j?(j.path=f,j.vertices=this.getFloatArray(d,"vertices",g),j.triangles=this.getIntArray(d,"triangles"),j.regionUVs=this.getFloatArray(d,"uvs",1),j.updateUVs(),i=d.color,i&&(j.r=this.toColor(i,0),j.g=this.toColor(i,1),j.b=this.toColor(i,2),j.a=this.toColor(i,3)),j.hullLength=2*(d.hull||0),d.edges&&(j.edges=this.getIntArray(d,"edges")),j.width=(d.width||0)*g,j.height=(d.height||0)*g,j):null}if(e==c.AttachmentType.skinnedmesh){var j=this.attachmentLoader.newSkinnedMeshAttachment(a,b,f);if(!j)return null;j.path=f;for(var k=this.getFloatArray(d,"uvs",1),l=this.getFloatArray(d,"vertices",1),m=[],n=[],o=0,p=l.length;p>o;){var q=0|l[o++];n[n.length]=q;for(var r=o+4*q;r>o;)n[n.length]=l[o],m[m.length]=l[o+1]*g,m[m.length]=l[o+2]*g,m[m.length]=l[o+3],o+=4}return j.bones=n,j.weights=m,j.triangles=this.getIntArray(d,"triangles"),j.regionUVs=k,j.updateUVs(),i=d.color,i&&(j.r=this.toColor(i,0),j.g=this.toColor(i,1),j.b=this.toColor(i,2),j.a=this.toColor(i,3)),j.hullLength=2*(d.hull||0),d.edges&&(j.edges=this.getIntArray(d,"edges")),j.width=(d.width||0)*g,j.height=(d.height||0)*g,j}if(e==c.AttachmentType.boundingbox){for(var s=this.attachmentLoader.newBoundingBoxAttachment(a,b),l=d.vertices,o=0,p=l.length;p>o;o++)s.vertices.push(l[o]*g);return s}throw"Unknown attachment type: "+e},readAnimation:function(a,b,d){var e=[],f=0,g=b.slots;for(var h in g)if(g.hasOwnProperty(h)){var i=g[h],j=d.findSlotIndex(h);for(var k in i)if(i.hasOwnProperty(k)){var l=i[k];if("color"==k){var m=new c.ColorTimeline(l.length);m.slotIndex=j;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o],r=q.color,s=this.toColor(r,0),t=this.toColor(r,1),u=this.toColor(r,2),v=this.toColor(r,3);m.setFrame(n,q.time,s,t,u,v),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[5*m.getFrameCount()-5])}else{if("attachment"!=k)throw"Invalid timeline type for a slot: "+k+" ("+h+")";var m=new c.AttachmentTimeline(l.length);m.slotIndex=j;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o];m.setFrame(n++,q.time,q.name)}e.push(m),f=Math.max(f,m.frames[m.getFrameCount()-1])}}}var w=b.bones;for(var x in w)if(w.hasOwnProperty(x)){var y=d.findBoneIndex(x);if(-1==y)throw"Bone not found: "+x;var z=w[x];for(var k in z)if(z.hasOwnProperty(k)){var l=z[k];if("rotate"==k){var m=new c.RotateTimeline(l.length);m.boneIndex=y;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o];m.setFrame(n,q.time,q.angle),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[2*m.getFrameCount()-2])}else if("translate"==k||"scale"==k){var m,A=1;"scale"==k?m=new c.ScaleTimeline(l.length):(m=new c.TranslateTimeline(l.length),A=this.scale),m.boneIndex=y;for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o],B=(q.x||0)*A,C=(q.y||0)*A;m.setFrame(n,q.time,B,C),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[3*m.getFrameCount()-3])}else{if("flipX"!=k&&"flipY"!=k)throw"Invalid timeline type for a bone: "+k+" ("+x+")";var B="flipX"==k,m=B?new c.FlipXTimeline(l.length):new c.FlipYTimeline(l.length);m.boneIndex=y;for(var D=B?"x":"y",n=0,o=0,p=l.length;p>o;o++){var q=l[o];m.setFrame(n,q.time,q[D]||!1),n++}e.push(m),f=Math.max(f,m.frames[2*m.getFrameCount()-2])}}}var E=b.ik;for(var F in E)if(E.hasOwnProperty(F)){var G=d.findIkConstraint(F),l=E[F],m=new c.IkConstraintTimeline(l.length);m.ikConstraintIndex=d.ikConstraints.indexOf(G);for(var n=0,o=0,p=l.length;p>o;o++){var q=l[o],H=q.hasOwnProperty("mix")?q.mix:1,I=!q.hasOwnProperty("bendPositive")||q.bendPositive?1:-1;m.setFrame(n,q.time,H,I),this.readCurve(m,n,q),n++}e.push(m),f=Math.max(f,m.frames[3*m.frameCount-3])}var J=b.ffd;for(var K in J){var L=d.findSkin(K),i=J[K];for(h in i){var j=d.findSlotIndex(h),M=i[h];for(var N in M){var l=M[N],m=new c.FfdTimeline(l.length),O=L.getAttachment(j,N);if(!O)throw"FFD attachment not found: "+N;m.slotIndex=j,m.attachment=O;var P,Q=O.type==c.AttachmentType.mesh;P=Q?O.vertices.length:O.weights.length/3*2;for(var n=0,o=0,p=l.length;p>o;o++){var R,q=l[o];if(q.vertices){var S=q.vertices,R=[];R.length=P;var T=q.offset||0,U=S.length;if(1==this.scale)for(var V=0;U>V;V++)R[V+T]=S[V];else for(var V=0;U>V;V++)R[V+T]=S[V]*this.scale;if(Q)for(var W=O.vertices,V=0,U=R.length;U>V;V++)R[V]+=W[V]}else Q?R=O.vertices:(R=[],R.length=P);m.setFrame(n,q.time,R),this.readCurve(m,n,q),n++}e[e.length]=m,f=Math.max(f,m.frames[m.frameCount-1])}}}var X=b.drawOrder;if(X||(X=b.draworder),X){for(var m=new c.DrawOrderTimeline(X.length),Y=d.slots.length,n=0,o=0,p=X.length;p>o;o++){var Z=X[o],$=null;if(Z.offsets){$=[],$.length=Y;for(var V=Y-1;V>=0;V--)$[V]=-1;var _=Z.offsets,aa=[];aa.length=Y-_.length;for(var ba=0,ca=0,V=0,U=_.length;U>V;V++){var da=_[V],j=d.findSlotIndex(da.slot);if(-1==j)throw"Slot not found: "+da.slot;for(;ba!=j;)aa[ca++]=ba++;$[ba+da.offset]=ba++}for(;Y>ba;)aa[ca++]=ba++;for(var V=Y-1;V>=0;V--)-1==$[V]&&($[V]=aa[--ca])}m.setFrame(n++,Z.time,$)}e.push(m),f=Math.max(f,m.frames[m.getFrameCount()-1])}var ea=b.events;if(ea){for(var m=new c.EventTimeline(ea.length),n=0,o=0,p=ea.length;p>o;o++){var fa=ea[o],ga=d.findEvent(fa.name);if(!ga)throw"Event not found: "+fa.name;var ha=new c.Event(ga);ha.intValue=fa.hasOwnProperty("int")?fa["int"]:ga.intValue,ha.floatValue=fa.hasOwnProperty("float")?fa["float"]:ga.floatValue,ha.stringValue=fa.hasOwnProperty("string")?fa.string:ga.stringValue,m.setFrame(n++,fa.time,ha)}e.push(m),f=Math.max(f,m.frames[m.getFrameCount()-1])}d.animations.push(new c.Animation(a,e,f))},readCurve:function(a,b,c){var d=c.curve;d?"stepped"==d?a.curves.setStepped(b):d instanceof Array&&a.curves.setCurve(b,d[0],d[1],d[2],d[3]):a.curves.setLinear(b)},toColor:function(a,b){if(8!=a.length)throw"Color hexidecimal length must be 8, recieved: "+a;return parseInt(a.substring(2*b,2*b+2),16)/255},getFloatArray:function(a,b,d){var e=a[b],f=new c.Float32Array(e.length),g=0,h=e.length;if(1==d)for(;h>g;g++)f[g]=e[g];else for(;h>g;g++)f[g]=e[g]*d;return f},getIntArray:function(a,b){for(var d=a[b],e=new c.Uint16Array(d.length),f=0,g=d.length;g>f;f++)e[f]=0|d[f];return e}},c.Atlas=function(a,b){this.textureLoader=b,this.pages=[],this.regions=[];var d=new c.AtlasReader(a),e=[];e.length=4;for(var f=null;;){var g=d.readLine();if(null===g)break;if(g=d.trim(g),g.length)if(f){var h=new c.AtlasRegion;h.name=g,h.page=f,h.rotate="true"==d.readValue(),d.readTuple(e);var i=parseInt(e[0]),j=parseInt(e[1]);d.readTuple(e);var k=parseInt(e[0]),l=parseInt(e[1]);h.u=i/f.width,h.v=j/f.height,h.rotate?(h.u2=(i+l)/f.width,h.v2=(j+k)/f.height):(h.u2=(i+k)/f.width,h.v2=(j+l)/f.height),h.x=i,h.y=j,h.width=Math.abs(k),h.height=Math.abs(l),4==d.readTuple(e)&&(h.splits=[parseInt(e[0]),parseInt(e[1]),parseInt(e[2]),parseInt(e[3])],4==d.readTuple(e)&&(h.pads=[parseInt(e[0]),parseInt(e[1]),parseInt(e[2]),parseInt(e[3])],d.readTuple(e))),h.originalWidth=parseInt(e[0]),h.originalHeight=parseInt(e[1]),d.readTuple(e),h.offsetX=parseInt(e[0]),h.offsetY=parseInt(e[1]),h.index=parseInt(d.readValue()),this.regions.push(h)}else{f=new c.AtlasPage,f.name=g,2==d.readTuple(e)&&(f.width=parseInt(e[0]),f.height=parseInt(e[1]),d.readTuple(e)),f.format=c.Atlas.Format[e[0]],d.readTuple(e),f.minFilter=c.Atlas.TextureFilter[e[0]],f.magFilter=c.Atlas.TextureFilter[e[1]];var m=d.readValue();f.uWrap=c.Atlas.TextureWrap.clampToEdge,f.vWrap=c.Atlas.TextureWrap.clampToEdge,"x"==m?f.uWrap=c.Atlas.TextureWrap.repeat:"y"==m?f.vWrap=c.Atlas.TextureWrap.repeat:"xy"==m&&(f.uWrap=f.vWrap=c.Atlas.TextureWrap.repeat),b.load(f,g,this),this.pages.push(f)}else f=null}},c.Atlas.prototype={findRegion:function(a){for(var b=this.regions,c=0,d=b.length;d>c;c++)if(b[c].name==a)return b[c];return null},dispose:function(){for(var a=this.pages,b=0,c=a.length;c>b;b++)this.textureLoader.unload(a[b].rendererObject)},updateUVs:function(a){for(var b=this.regions,c=0,d=b.length;d>c;c++){var e=b[c];e.page==a&&(e.u=e.x/a.width,e.v=e.y/a.height,e.rotate?(e.u2=(e.x+e.height)/a.width,e.v2=(e.y+e.width)/a.height):(e.u2=(e.x+e.width)/a.width,e.v2=(e.y+e.height)/a.height))}}},c.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},c.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},c.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},c.AtlasPage=function(){},c.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},c.AtlasRegion=function(){},c.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},c.AtlasReader=function(a){this.lines=a.split(/\r\n|\r|\n/)},c.AtlasReader.prototype={index:0,trim:function(a){return a.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var a=this.readLine(),b=a.indexOf(":");if(-1==b)throw"Invalid line: "+a;return this.trim(a.substring(b+1))},readTuple:function(a){var b=this.readLine(),c=b.indexOf(":");if(-1==c)throw"Invalid line: "+b;for(var d=0,e=c+1;3>d;d++){var f=b.indexOf(",",e);if(-1==f)break;a[d]=this.trim(b.substr(e,f-e)),e=f+1}return a[d]=this.trim(b.substring(e)),d+1}},c.AtlasAttachmentLoader=function(a){this.atlas=a},c.AtlasAttachmentLoader.prototype={newRegionAttachment:function(a,b,d){var e=this.atlas.findRegion(d);if(!e)throw"Region not found in atlas: "+d+" (region attachment: "+b+")";var f=new c.RegionAttachment(b);return f.rendererObject=e,f.setUVs(e.u,e.v,e.u2,e.v2,e.rotate),f.regionOffsetX=e.offsetX,f.regionOffsetY=e.offsetY,f.regionWidth=e.width,f.regionHeight=e.height,f.regionOriginalWidth=e.originalWidth,f.regionOriginalHeight=e.originalHeight,f},newMeshAttachment:function(a,b,d){var e=this.atlas.findRegion(d);if(!e)throw"Region not found in atlas: "+d+" (mesh attachment: "+b+")";var f=new c.MeshAttachment(b);return f.rendererObject=e,f.regionU=e.u,f.regionV=e.v,f.regionU2=e.u2,f.regionV2=e.v2,f.regionRotate=e.rotate,f.regionOffsetX=e.offsetX,f.regionOffsetY=e.offsetY,f.regionWidth=e.width,f.regionHeight=e.height,f.regionOriginalWidth=e.originalWidth,f.regionOriginalHeight=e.originalHeight,f},newSkinnedMeshAttachment:function(a,b,d){var e=this.atlas.findRegion(d);if(!e)throw"Region not found in atlas: "+d+" (skinned mesh attachment: "+b+")";var f=new c.SkinnedMeshAttachment(b);return f.rendererObject=e,f.regionU=e.u,f.regionV=e.v,f.regionU2=e.u2,f.regionV2=e.v2,f.regionRotate=e.rotate,f.regionOffsetX=e.offsetX,f.regionOffsetY=e.offsetY,f.regionWidth=e.width,f.regionHeight=e.height,f.regionOriginalWidth=e.originalWidth,f.regionOriginalHeight=e.originalHeight,f},newBoundingBoxAttachment:function(a,b){return new c.BoundingBoxAttachment(b)}},c.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},c.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(a,b){var d=a.slots,e=d.length,f=a.x,g=a.y,h=this.boundingBoxes,i=this.polygonPool,j=this.polygons;h.length=0;for(var k=0,l=j.length;l>k;k++)i.push(j[k]);j.length=0;for(var k=0;e>k;k++){var m=d[k],n=m.attachment;if(n.type==c.AttachmentType.boundingbox){h.push(n);var o,p=i.length;p>0?(o=i[p-1],i.splice(p-1,1)):o=[],j.push(o),o.length=n.vertices.length,n.computeWorldVertices(f,g,m.bone,o)}}b&&this.aabbCompute()},aabbCompute:function(){for(var a=this.polygons,b=Number.MAX_VALUE,c=Number.MAX_VALUE,d=Number.MIN_VALUE,e=Number.MIN_VALUE,f=0,g=a.length;g>f;f++)for(var h=a[f],i=0,j=h.length;j>i;i+=2){var k=h[i],l=h[i+1];b=Math.min(b,k),c=Math.min(c,l),d=Math.max(d,k),e=Math.max(e,l)}this.minX=b,this.minY=c,this.maxX=d,this.maxY=e},aabbContainsPoint:function(a,b){return a>=this.minX&&a<=this.maxX&&b>=this.minY&&b<=this.maxY},aabbIntersectsSegment:function(a,b,c,d){var e=this.minX,f=this.minY,g=this.maxX,h=this.maxY;if(e>=a&&e>=c||f>=b&&f>=d||a>=g&&c>=g||b>=h&&d>=h)return!1;var i=(d-b)/(c-a),j=i*(e-a)+b;if(j>f&&h>j)return!0;if(j=i*(g-a)+b,j>f&&h>j)return!0;var k=(f-b)/i+a;return k>e&&g>k?!0:(k=(h-b)/i+a,k>e&&g>k?!0:!1)},aabbIntersectsSkeleton:function(a){return this.minXa.minX&&this.minYa.minY},containsPoint:function(a,b){for(var c=this.polygons,d=0,e=c.length;e>d;d++)if(this.polygonContainsPoint(c[d],a,b))return this.boundingBoxes[d];return null},intersectsSegment:function(a,b,c,d){for(var e=this.polygons,f=0,g=e.length;g>f;f++)if(e[f].intersectsSegment(a,b,c,d))return this.boundingBoxes[f];return null},polygonContainsPoint:function(a,b,c){for(var d=a.length,e=d-2,f=!1,g=0;d>g;g+=2){var h=a[g+1],i=a[e+1];if(c>h&&i>=c||c>i&&h>=c){var j=a[g];j+(c-h)/(i-h)*(a[e]-j)l;l+=2){var m=a[l],n=a[l+1],o=j*n-k*m,p=j-m,q=k-n,r=g*q-h*p,s=(i*p-g*o)/r;if((s>=j&&m>=s||s>=m&&j>=s)&&(s>=b&&d>=s||s>=d&&b>=s)){var t=(i*q-h*o)/r;if((t>=k&&n>=t||t>=n&&k>=t)&&(t>=c&&e>=t||t>=e&&c>=t))return!0}j=m,k=n}return!1},getPolygon:function(a){var b=this.boundingBoxes.indexOf(a);return-1==b?null:this.polygons[b]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}},c.Bone.yDown=!0,b.AnimCache={},b.SpineTextureLoader=function(a,c){b.EventTarget.call(this),this.basePath=a,this.crossorigin=c,this.loadingCount=0},b.SpineTextureLoader.prototype=b.SpineTextureLoader,b.SpineTextureLoader.prototype.load=function(a,c){if(a.rendererObject=b.BaseTexture.fromImage(this.basePath+"/"+c,this.crossorigin),!a.rendererObject.hasLoaded){var d=this;++d.loadingCount,a.rendererObject.addEventListener("loaded",function(){--d.loadingCount,d.dispatchEvent({type:"loadedBaseTexture",content:d})})}},b.SpineTextureLoader.prototype.unload=function(a){a.destroy(!0)},b.Spine=function(a){if(b.DisplayObjectContainer.call(this),this.spineData=b.AnimCache[a],!this.spineData)throw new Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: "+a);this.skeleton=new c.Skeleton(this.spineData),this.skeleton.updateWorldTransform(),this.stateData=new c.AnimationStateData(this.spineData),this.state=new c.AnimationState(this.stateData),this.slotContainers=[];for(var d=0,e=this.skeleton.slots.length;e>d;d++){var f=this.skeleton.slots[d],g=f.attachment,h=new b.DisplayObjectContainer;if(this.slotContainers.push(h),this.addChild(h),g instanceof c.RegionAttachment){var i=g.rendererObject.name,j=this.createSprite(f,g);f.currentSprite=j,f.currentSpriteName=i,h.addChild(j)}else{if(!(g instanceof c.MeshAttachment))continue;var k=this.createMesh(f,g);f.currentMesh=k,f.currentMeshName=g.name,h.addChild(k)}}this.autoUpdate=!0},b.Spine.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Spine.prototype.constructor=b.Spine,Object.defineProperty(b.Spine.prototype,"autoUpdate",{get:function(){return this.updateTransform===b.Spine.prototype.autoUpdateTransform},set:function(a){this.updateTransform=a?b.Spine.prototype.autoUpdateTransform:b.DisplayObjectContainer.prototype.updateTransform}}),b.Spine.prototype.update=function(a){this.state.update(a),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var d=this.skeleton.drawOrder,e=this.skeleton.slots,f=0,g=d.length;g>f;f++)this.children[f]=this.slotContainers[d[f]];for(f=0,g=e.length;g>f;f++){var h=e[f],i=h.attachment,j=this.slotContainers[f];if(i){var k=i.type;if(k===c.AttachmentType.region){if(i.rendererObject&&(!h.currentSpriteName||h.currentSpriteName!==i.name)){var l=i.rendererObject.name;if(void 0!==h.currentSprite&&(h.currentSprite.visible=!1),h.sprites=h.sprites||{},void 0!==h.sprites[l])h.sprites[l].visible=!0;else{var m=this.createSprite(h,i);j.addChild(m)}h.currentSprite=h.sprites[l],h.currentSpriteName=l}var n=h.bone;j.position.x=n.worldX+i.x*n.m00+i.y*n.m01,j.position.y=n.worldY+i.x*n.m10+i.y*n.m11,j.scale.x=n.worldScaleX,j.scale.y=n.worldScaleY,j.rotation=-(h.bone.worldRotation*c.degRad),h.currentSprite.tint=b.rgb2hex([h.r,h.g,h.b])}else{if(k!==c.AttachmentType.skinnedmesh){j.visible=!1;continue}if(!h.currentMeshName||h.currentMeshName!==i.name){var o=i.name;if(void 0!==h.currentMesh&&(h.currentMesh.visible=!1),h.meshes=h.meshes||{},void 0!==h.meshes[o])h.meshes[o].visible=!0;else{var p=this.createMesh(h,i);j.addChild(p)}h.currentMesh=h.meshes[o],h.currentMeshName=o}i.computeWorldVertices(h.bone.skeleton.x,h.bone.skeleton.y,h,h.currentMesh.vertices)}j.visible=!0,j.alpha=h.a}else j.visible=!1}},b.Spine.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var a=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(a),b.DisplayObjectContainer.prototype.updateTransform.call(this)},b.Spine.prototype.createSprite=function(a,d){var e=d.rendererObject,f=e.page.rendererObject,g=new b.Rectangle(e.x,e.y,e.rotate?e.height:e.width,e.rotate?e.width:e.height),h=new b.Texture(f,g),i=new b.Sprite(h),j=e.rotate?.5*Math.PI:0;return i.scale.set(e.width/e.originalWidth,e.height/e.originalHeight),i.rotation=j-d.rotation*c.degRad,i.anchor.x=i.anchor.y=.5,a.sprites=a.sprites||{},a.sprites[e.name]=i,i},b.Spine.prototype.createMesh=function(a,c){var d=c.rendererObject,e=d.page.rendererObject,f=new b.Texture(e),g=new b.Strip(f);return g.drawMode=b.Strip.DrawModes.TRIANGLES,g.canvasPadding=1.5,g.vertices=new b.Float32Array(c.uvs.length),g.uvs=c.uvs,g.indices=c.triangles,a.meshes=a.meshes||{},a.meshes[c.name]=g,g},b.BaseTextureCache={},b.BaseTextureCacheIdGenerator=0,b.BaseTexture=function(a,c){if(this.resolution=1,this.width=100,this.height=100,this.scaleMode=c||b.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=a,this._UID=b._UID++,this.premultipliedAlpha=!0,this._glTextures=[],this.mipmap=!1,this._dirty=[!0,!0,!0,!0],a){if((this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this.hasLoaded=!0,this.width=this.source.naturalWidth||this.source.width,this.height=this.source.naturalHeight||this.source.height,this.dirty();else{var d=this;this.source.onload=function(){d.hasLoaded=!0,d.width=d.source.naturalWidth||d.source.width,d.height=d.source.naturalHeight||d.source.height,d.dirty(),d.dispatchEvent({type:"loaded",content:d})},this.source.onerror=function(){d.dispatchEvent({type:"error",content:d})}}this.imageUrl=null,this._powerOf2=!1}},b.BaseTexture.prototype.constructor=b.BaseTexture,b.EventTarget.mixin(b.BaseTexture.prototype),b.BaseTexture.prototype.destroy=function(){this.imageUrl?(delete b.BaseTextureCache[this.imageUrl],delete b.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete b.BaseTextureCache[this.source._pixiId],this.source=null,this.unloadFromGPU()},b.BaseTexture.prototype.updateSourceImage=function(a){this.hasLoaded=!1,this.source.src=null,this.source.src=a},b.BaseTexture.prototype.dirty=function(){for(var a=0;a=0;a--){var c=this._glTextures[a],d=b.glContexts[a];d&&c&&d.deleteTexture(c)}this._glTextures.length=0,this.dirty()},b.BaseTexture.fromImage=function(a,c,d){var e=b.BaseTextureCache[a];if(void 0===c&&-1===a.indexOf("data:")&&(c=!0),!e){var f=new Image;c&&(f.crossOrigin=""),f.src=a,e=new b.BaseTexture(f,d),e.imageUrl=a,b.BaseTextureCache[a]=e,-1!==a.indexOf(b.RETINA_PREFIX+".")&&(e.resolution=2)}return e},b.BaseTexture.fromCanvas=function(a,c){a._pixiId||(a._pixiId="canvas_"+b.TextureCacheIdGenerator++);var d=b.BaseTextureCache[a._pixiId];return d||(d=new b.BaseTexture(a,c),b.BaseTextureCache[a._pixiId]=d),d},b.TextureCache={},b.FrameCache={},b.TextureCacheIdGenerator=0,b.Texture=function(a,c,d,e){this.noFrame=!1,c||(this.noFrame=!0,c=new b.Rectangle(0,0,1,1)),a instanceof b.Texture&&(a=a.baseTexture),this.baseTexture=a,this.frame=c,this.trim=e,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=d||new b.Rectangle(0,0,1,1),a.hasLoaded?(this.noFrame&&(c=new b.Rectangle(0,0,a.width,a.height)),this.setFrame(c)):a.addEventListener("loaded",this.onBaseTextureLoaded.bind(this))},b.Texture.prototype.constructor=b.Texture,b.EventTarget.mixin(b.Texture.prototype),b.Texture.prototype.onBaseTextureLoaded=function(){var a=this.baseTexture;a.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new b.Rectangle(0,0,a.width,a.height)),this.setFrame(this.frame),this.dispatchEvent({type:"update",content:this})},b.Texture.prototype.destroy=function(a){a&&this.baseTexture.destroy(),this.valid=!1},b.Texture.prototype.setFrame=function(a){if(this.noFrame=!1,this.frame=a,this.width=a.width,this.height=a.height,this.crop.x=a.x,this.crop.y=a.y,this.crop.width=a.width,this.crop.height=a.height,!this.trim&&(a.x+a.width>this.baseTexture.width||a.y+a.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=a&&a.width&&a.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs()},b.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new b.TextureUvs);var a=this.crop,c=this.baseTexture.width,d=this.baseTexture.height;this._uvs.x0=a.x/c,this._uvs.y0=a.y/d,this._uvs.x1=(a.x+a.width)/c,this._uvs.y1=a.y/d,this._uvs.x2=(a.x+a.width)/c,this._uvs.y2=(a.y+a.height)/d,this._uvs.x3=a.x/c,this._uvs.y3=(a.y+a.height)/d},b.Texture.fromImage=function(a,c,d){var e=b.TextureCache[a];return e||(e=new b.Texture(b.BaseTexture.fromImage(a,c,d)),b.TextureCache[a]=e),e},b.Texture.fromFrame=function(a){var c=b.TextureCache[a];if(!c)throw new Error('The frameId "'+a+'" does not exist in the texture cache ');return c},b.Texture.fromCanvas=function(a,c){var d=b.BaseTexture.fromCanvas(a,c);return new b.Texture(d)},b.Texture.addTextureToCache=function(a,c){b.TextureCache[c]=a},b.Texture.removeTextureFromCache=function(a){var c=b.TextureCache[a];return delete b.TextureCache[a],delete b.BaseTextureCache[a],c},b.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},b.Texture.emptyTexture=new b.Texture(new b.BaseTexture),b.RenderTexture=function(a,c,d,e,f){if(this.width=a||100,this.height=c||100,this.resolution=f||1,this.frame=new b.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=new b.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.baseTexture=new b.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=e||b.scaleModes.DEFAULT,this.baseTexture.hasLoaded=!0,b.Texture.call(this,this.baseTexture,new b.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution)),this.renderer=d||b.defaultRenderer,this.renderer.type===b.WEBGL_RENDERER){var g=this.renderer.gl;this.baseTexture._dirty[g.id]=!1,this.textureBuffer=new b.FilterTexture(g,this.width,this.height,this.baseTexture.scaleMode),this.baseTexture._glTextures[g.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new b.Point(.5*this.width,.5*-this.height)}else this.render=this.renderCanvas,this.textureBuffer=new b.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()},b.RenderTexture.prototype=Object.create(b.Texture.prototype),b.RenderTexture.prototype.constructor=b.RenderTexture,b.RenderTexture.prototype.resize=function(a,c,d){(a!==this.width||c!==this.height)&&(this.valid=a>0&&c>0,this.width=a,this.height=c,this.frame.width=this.crop.width=a*this.resolution,this.frame.height=this.crop.height=c*this.resolution,d&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===b.WEBGL_RENDERER&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},b.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===b.WEBGL_RENDERER&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},b.RenderTexture.prototype.renderWebGL=function(a,b,c){if(this.valid){var d=a.worldTransform;d.identity(),d.translate(0,2*this.projection.y),b&&d.append(b),d.scale(1,-1),a.worldAlpha=1;for(var e=a.children,f=0,g=e.length;g>f;f++)e[f].updateTransform();var h=this.renderer.gl;h.viewport(0,0,this.width*this.resolution,this.height*this.resolution),h.bindFramebuffer(h.FRAMEBUFFER,this.textureBuffer.frameBuffer),c&&this.textureBuffer.clear(),this.renderer.spriteBatch.dirty=!0,this.renderer.renderDisplayObject(a,this.projection,this.textureBuffer.frameBuffer),this.renderer.spriteBatch.dirty=!0}},b.RenderTexture.prototype.renderCanvas=function(a,b,c){if(this.valid){var d=a.worldTransform;d.identity(),b&&d.append(b),a.worldAlpha=1;for(var e=a.children,f=0,g=e.length;g>f;f++)e[f].updateTransform();c&&this.textureBuffer.clear();var h=this.textureBuffer.context,i=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(a,h),this.renderer.resolution=i}},b.RenderTexture.prototype.getImage=function(){var a=new Image;return a.src=this.getBase64(),a},b.RenderTexture.prototype.getBase64=function(){return this.getCanvas().toDataURL()},b.RenderTexture.prototype.getCanvas=function(){if(this.renderer.type===b.WEBGL_RENDERER){var a=this.renderer.gl,c=this.textureBuffer.width,d=this.textureBuffer.height,e=new Uint8Array(4*c*d);a.bindFramebuffer(a.FRAMEBUFFER,this.textureBuffer.frameBuffer),a.readPixels(0,0,c,d,a.RGBA,a.UNSIGNED_BYTE,e),a.bindFramebuffer(a.FRAMEBUFFER,null);var f=new b.CanvasBuffer(c,d),g=f.context.getImageData(0,0,c,d);return g.data.set(e),f.context.putImageData(g,0,0),f.canvas}return this.textureBuffer.canvas},b.RenderTexture.tempMatrix=new b.Matrix,b.VideoTexture=function(a,c){if(!a)throw new Error("No video source element specified.");(a.readyState===a.HAVE_ENOUGH_DATA||a.readyState===a.HAVE_FUTURE_DATA)&&a.width&&a.height&&(a.complete=!0),b.BaseTexture.call(this,a,c),this.autoUpdate=!1,this.updateBound=this._onUpdate.bind(this),a.complete||(this._onCanPlay=this.onCanPlay.bind(this),a.addEventListener("canplay",this._onCanPlay),a.addEventListener("canplaythrough",this._onCanPlay),a.addEventListener("play",this.onPlayStart.bind(this)),a.addEventListener("pause",this.onPlayStop.bind(this)))},b.VideoTexture.prototype=Object.create(b.BaseTexture.prototype),b.VideoTexture.constructor=b.VideoTexture,b.VideoTexture.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this.updateBound),this.dirty())},b.VideoTexture.prototype.onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this.updateBound),this.autoUpdate=!0)},b.VideoTexture.prototype.onPlayStop=function(){this.autoUpdate=!1},b.VideoTexture.prototype.onCanPlay=function(){"canplaythrough"===event.type&&(this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.__loaded||(this.__loaded=!0,this.dispatchEvent({type:"loaded",content:this}))))},b.VideoTexture.prototype.destroy=function(){this.source&&this.source._pixiId&&(b.BaseTextureCache[this.source._pixiId]=null,delete b.BaseTextureCache[this.source._pixiId],this.source._pixiId=null,delete this.source._pixiId),b.BaseTexture.prototype.destroy.call(this)},b.VideoTexture.baseTextureFromVideo=function(a,c){a._pixiId||(a._pixiId="video_"+b.TextureCacheIdGenerator++);var d=b.BaseTextureCache[a._pixiId];return d||(d=new b.VideoTexture(a,c),b.BaseTextureCache[a._pixiId]=d),d},b.VideoTexture.textureFromVideo=function(a,c){var d=b.VideoTexture.baseTextureFromVideo(a,c);return new b.Texture(d)},b.VideoTexture.fromUrl=function(a,c){var d=document.createElement("video");return d.src=a,d.autoPlay=!0,d.play(),b.VideoTexture.textureFromVideo(d,c)},b.AssetLoader=function(a,c){this.assetURLs=a,this.crossorigin=c,this.loadersByType={jpg:b.ImageLoader,jpeg:b.ImageLoader,png:b.ImageLoader,gif:b.ImageLoader,webp:b.ImageLoader,json:b.JsonLoader,atlas:b.AtlasLoader,anim:b.SpineLoader,xml:b.BitmapFontLoader,fnt:b.BitmapFontLoader}},b.EventTarget.mixin(b.AssetLoader.prototype),b.AssetLoader.prototype.constructor=b.AssetLoader,b.AssetLoader.prototype._getDataType=function(a){var b="data:",c=a.slice(0,b.length).toLowerCase();if(c===b){var d=a.slice(b.length),e=d.indexOf(",");if(-1===e)return null;var f=d.slice(0,e).split(";")[0];return f&&"text/plain"!==f.toLowerCase()?f.split("/").pop().toLowerCase():"txt"}return null},b.AssetLoader.prototype.load=function(){function a(a){b.onAssetLoaded(a.data.content)}var b=this;this.loadCount=this.assetURLs.length;for(var c=0;c0?a.addEventListener("loadedBaseTexture",function(a){a.content.content.loadingCount<=0&&o.onLoaded()}):o.onLoaded()},n.load()}else this.onLoaded()},b.JsonLoader.prototype.onLoaded=function(){this.loaded=!0,this.dispatchEvent({type:"loaded",content:this})},b.JsonLoader.prototype.onError=function(){this.dispatchEvent({type:"error",content:this})},b.AtlasLoader=function(a,b){this.url=a,this.baseUrl=a.replace(/[^\/]*$/,""),this.crossorigin=b,this.loaded=!1},b.AtlasLoader.constructor=b.AtlasLoader,b.EventTarget.mixin(b.AtlasLoader.prototype),b.AtlasLoader.prototype.load=function(){this.ajaxRequest=new b.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onAtlasLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/json"),this.ajaxRequest.send(null)},b.AtlasLoader.prototype.onAtlasLoaded=function(){if(4===this.ajaxRequest.readyState)if(200===this.ajaxRequest.status||-1===window.location.href.indexOf("http")){this.atlas={meta:{image:[]},frames:[]};var a=this.ajaxRequest.responseText.split(/\r?\n/),c=-3,d=0,e=null,f=!1,g=0,h=0,i=this.onLoaded.bind(this);for(g=0;g0){if(f===g)this.atlas.meta.image.push(a[g]),d=this.atlas.meta.image.length-1,this.atlas.frames.push({}),c=-3;else if(c>0)if(c%7===1)null!=e&&(this.atlas.frames[d][e.name]=e),e={name:a[g],frame:{}};else{var j=a[g].split(" ");if(c%7===3)e.frame.x=Number(j[1].replace(",","")),e.frame.y=Number(j[2]);else if(c%7===4)e.frame.w=Number(j[1].replace(",","")),e.frame.h=Number(j[2]);else if(c%7===5){var k={x:0,y:0,w:Number(j[1].replace(",","")),h:Number(j[2])};k.w>e.frame.w||k.h>e.frame.h?(e.trimmed=!0,e.realSize=k):e.trimmed=!1}}c++}if(null!=e&&(this.atlas.frames[d][e.name]=e),this.atlas.meta.image.length>0){for(this.images=[],h=0;hthis.currentImageId?(this.currentImageId++,this.images[this.currentImageId].load()):(this.loaded=!0,this.emit("loaded",{content:this}))},b.AtlasLoader.prototype.onError=function(){this.emit("error",{content:this})},b.SpriteSheetLoader=function(a,b){this.url=a,this.crossorigin=b,this.baseUrl=a.replace(/[^\/]*$/,""),this.texture=null,this.frames={}},b.SpriteSheetLoader.prototype.constructor=b.SpriteSheetLoader,b.EventTarget.mixin(b.SpriteSheetLoader.prototype),b.SpriteSheetLoader.prototype.load=function(){var a=this,c=new b.JsonLoader(this.url,this.crossorigin);c.on("loaded",function(b){a.json=b.data.content.json,a.onLoaded()}),c.load()},b.SpriteSheetLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},b.ImageLoader=function(a,c){this.texture=b.Texture.fromImage(a,c),this.frames=[]},b.ImageLoader.prototype.constructor=b.ImageLoader,b.EventTarget.mixin(b.ImageLoader.prototype),b.ImageLoader.prototype.load=function(){this.texture.baseTexture.hasLoaded?this.onLoaded():this.texture.baseTexture.on("loaded",this.onLoaded.bind(this))},b.ImageLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},b.ImageLoader.prototype.loadFramedSpriteSheet=function(a,c,d){this.frames=[];for(var e=Math.floor(this.texture.width/a),f=Math.floor(this.texture.height/c),g=0,h=0;f>h;h++)for(var i=0;e>i;i++,g++){var j=new b.Texture(this.texture.baseTexture,{x:i*a,y:h*c,width:a,height:c});this.frames.push(j),d&&(b.TextureCache[d+"-"+g]=j)}this.load()},b.BitmapFontLoader=function(a,b){this.url=a,this.crossorigin=b,this.baseUrl=a.replace(/[^\/]*$/,""),this.texture=null},b.BitmapFontLoader.prototype.constructor=b.BitmapFontLoader,b.EventTarget.mixin(b.BitmapFontLoader.prototype),b.BitmapFontLoader.prototype.load=function(){this.ajaxRequest=new b.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onXMLLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/xml"),this.ajaxRequest.send(null)},b.BitmapFontLoader.prototype.onXMLLoaded=function(){if(4===this.ajaxRequest.readyState&&(200===this.ajaxRequest.status||-1===window.location.protocol.indexOf("http"))){var a=this.ajaxRequest.responseXML;if(!a||/MSIE 9/i.test(navigator.userAgent)||navigator.isCocoonJS)if("function"==typeof window.DOMParser){var c=new DOMParser;a=c.parseFromString(this.ajaxRequest.responseText,"text/xml")}else{var d=document.createElement("div");d.innerHTML=this.ajaxRequest.responseText,a=d}var e=this.baseUrl+a.getElementsByTagName("page")[0].getAttribute("file"),f=new b.ImageLoader(e,this.crossorigin);this.texture=f.texture.baseTexture;var g={},h=a.getElementsByTagName("info")[0],i=a.getElementsByTagName("common")[0];g.font=h.getAttribute("face"),g.size=parseInt(h.getAttribute("size"),10),g.lineHeight=parseInt(i.getAttribute("lineHeight"),10),g.chars={};for(var j=a.getElementsByTagName("char"),k=0;ka;a++)this.shaders[a].dirty=!0},b.AlphaMaskFilter=function(a){b.AbstractFilter.call(this),this.passes=[this],a.baseTexture._powerOf2=!0,this.uniforms={mask:{type:"sampler2D",value:a},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},a.baseTexture.hasLoaded?(this.uniforms.mask.value.x=a.width,this.uniforms.mask.value.y=a.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),a.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D mask;","uniform sampler2D uSampler;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," mapCords *= dimensions.xy / mapDimensions;"," vec4 original = texture2D(uSampler, vTextureCoord);"," float maskAlpha = texture2D(mask, mapCords).r;"," original *= maskAlpha;"," gl_FragColor = original;","}"]},b.AlphaMaskFilter.prototype=Object.create(b.AbstractFilter.prototype),b.AlphaMaskFilter.prototype.constructor=b.AlphaMaskFilter,b.AlphaMaskFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.mask.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.mask.value.height,this.uniforms.mask.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(b.AlphaMaskFilter.prototype,"map",{get:function(){return this.uniforms.mask.value},set:function(a){this.uniforms.mask.value=a}}),b.ColorMatrixFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={matrix:{type:"mat4",value:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform mat4 matrix;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * matrix;","}"]},b.ColorMatrixFilter.prototype=Object.create(b.AbstractFilter.prototype),b.ColorMatrixFilter.prototype.constructor=b.ColorMatrixFilter,Object.defineProperty(b.ColorMatrixFilter.prototype,"matrix",{get:function(){return this.uniforms.matrix.value},set:function(a){this.uniforms.matrix.value=a}}),b.GrayFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={gray:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float gray;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);","}"]},b.GrayFilter.prototype=Object.create(b.AbstractFilter.prototype),b.GrayFilter.prototype.constructor=b.GrayFilter,Object.defineProperty(b.GrayFilter.prototype,"gray",{get:function(){return this.uniforms.gray.value},set:function(a){this.uniforms.gray.value=a}}),b.DisplacementFilter=function(a){b.AbstractFilter.call(this),this.passes=[this],a.baseTexture._powerOf2=!0,this.uniforms={displacementMap:{type:"sampler2D",value:a},scale:{type:"2f",value:{x:30,y:30}},offset:{type:"2f",value:{x:0,y:0}},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},a.baseTexture.hasLoaded?(this.uniforms.mapDimensions.value.x=a.width,this.uniforms.mapDimensions.value.y=a.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),a.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D displacementMap;","uniform sampler2D uSampler;","uniform vec2 scale;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," vec2 matSample = texture2D(displacementMap, mapCords).xy;"," matSample -= 0.5;"," matSample *= scale;"," matSample /= mapDimensions;"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);"," vec2 cord = vTextureCoord;","}"]},b.DisplacementFilter.prototype=Object.create(b.AbstractFilter.prototype),b.DisplacementFilter.prototype.constructor=b.DisplacementFilter,b.DisplacementFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.displacementMap.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.displacementMap.value.height,this.uniforms.displacementMap.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(b.DisplacementFilter.prototype,"map",{get:function(){return this.uniforms.displacementMap.value},set:function(a){this.uniforms.displacementMap.value=a}}),Object.defineProperty(b.DisplacementFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(a){this.uniforms.scale.value=a}}),Object.defineProperty(b.DisplacementFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(a){this.uniforms.offset.value=a}}),b.PixelateFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:0},dimensions:{type:"4fv",value:new b.Float32Array([1e4,100,10,10])},pixelSize:{type:"2f",value:{x:10,y:10}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 testDim;","uniform vec4 dimensions;","uniform vec2 pixelSize;","uniform sampler2D uSampler;","void main(void) {"," vec2 coord = vTextureCoord;"," vec2 size = dimensions.xy/pixelSize;"," vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;"," gl_FragColor = texture2D(uSampler, color);","}"]},b.PixelateFilter.prototype=Object.create(b.AbstractFilter.prototype),b.PixelateFilter.prototype.constructor=b.PixelateFilter,Object.defineProperty(b.PixelateFilter.prototype,"size",{get:function(){return this.uniforms.pixelSize.value},set:function(a){this.dirty=!0,this.uniforms.pixelSize.value=a}}),b.BlurXFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;"," gl_FragColor = sum;","}"]},b.BlurXFilter.prototype=Object.create(b.AbstractFilter.prototype),b.BlurXFilter.prototype.constructor=b.BlurXFilter,Object.defineProperty(b.BlurXFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(a){this.dirty=!0,this.uniforms.blur.value=1/7e3*a}}),b.BlurYFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;"," gl_FragColor = sum;","}"]},b.BlurYFilter.prototype=Object.create(b.AbstractFilter.prototype),b.BlurYFilter.prototype.constructor=b.BlurYFilter,Object.defineProperty(b.BlurYFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(a){this.uniforms.blur.value=1/7e3*a}}),b.BlurFilter=function(){this.blurXFilter=new b.BlurXFilter,this.blurYFilter=new b.BlurYFilter,this.passes=[this.blurXFilter,this.blurYFilter]},b.BlurFilter.prototype=Object.create(b.AbstractFilter.prototype),b.BlurFilter.prototype.constructor=b.BlurFilter,Object.defineProperty(b.BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(a){this.blurXFilter.blur=this.blurYFilter.blur=a}}),Object.defineProperty(b.BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(a){this.blurXFilter.blur=a}}),Object.defineProperty(b.BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(a){this.blurYFilter.blur=a}}),b.InvertFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);","}"]},b.InvertFilter.prototype=Object.create(b.AbstractFilter.prototype),b.InvertFilter.prototype.constructor=b.InvertFilter,Object.defineProperty(b.InvertFilter.prototype,"invert",{get:function(){return this.uniforms.invert.value},set:function(a){this.uniforms.invert.value=a}}),b.SepiaFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={sepia:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float sepia;","uniform sampler2D uSampler;","const mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);","}"]},b.SepiaFilter.prototype=Object.create(b.AbstractFilter.prototype),b.SepiaFilter.prototype.constructor=b.SepiaFilter,Object.defineProperty(b.SepiaFilter.prototype,"sepia",{get:function(){return this.uniforms.sepia.value},set:function(a){this.uniforms.sepia.value=a}}),b.TwistFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"2f",value:{x:.5,y:.5}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float radius;","uniform float angle;","uniform vec2 offset;","void main(void) {"," vec2 coord = vTextureCoord - offset;"," float distance = length(coord);"," if (distance < radius) {"," float ratio = (radius - distance) / radius;"," float angleMod = ratio * ratio * angle;"," float s = sin(angleMod);"," float c = cos(angleMod);"," coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);"," }"," gl_FragColor = texture2D(uSampler, coord+offset);","}"]},b.TwistFilter.prototype=Object.create(b.AbstractFilter.prototype),b.TwistFilter.prototype.constructor=b.TwistFilter,Object.defineProperty(b.TwistFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(a){this.dirty=!0,this.uniforms.offset.value=a}}),Object.defineProperty(b.TwistFilter.prototype,"radius",{get:function(){return this.uniforms.radius.value},set:function(a){this.dirty=!0,this.uniforms.radius.value=a}}),Object.defineProperty(b.TwistFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(a){this.dirty=!0,this.uniforms.angle.value=a}}),b.ColorStepFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={step:{type:"1f",value:5}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float step;","void main(void) {"," vec4 color = texture2D(uSampler, vTextureCoord);"," color = floor(color * step) / step;"," gl_FragColor = color;","}"]},b.ColorStepFilter.prototype=Object.create(b.AbstractFilter.prototype),b.ColorStepFilter.prototype.constructor=b.ColorStepFilter,Object.defineProperty(b.ColorStepFilter.prototype,"step",{get:function(){return this.uniforms.step.value},set:function(a){this.uniforms.step.value=a}}),b.DotScreenFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float angle;","uniform float scale;","float pattern() {"," float s = sin(angle), c = cos(angle);"," vec2 tex = vTextureCoord * dimensions.xy;"," vec2 point = vec2("," c * tex.x - s * tex.y,"," s * tex.x + c * tex.y"," ) * scale;"," return (sin(point.x) * sin(point.y)) * 4.0;","}","void main() {"," vec4 color = texture2D(uSampler, vTextureCoord);"," float average = (color.r + color.g + color.b) / 3.0;"," gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);","}"]},b.DotScreenFilter.prototype=Object.create(b.AbstractFilter.prototype),b.DotScreenFilter.prototype.constructor=b.DotScreenFilter,Object.defineProperty(b.DotScreenFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(a){this.dirty=!0,this.uniforms.scale.value=a}}),Object.defineProperty(b.DotScreenFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(a){this.dirty=!0,this.uniforms.angle.value=a}}),b.CrossHatchFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);"," gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"," if (lum < 1.00) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.75) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.50) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.3) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }","}"]},b.CrossHatchFilter.prototype=Object.create(b.AbstractFilter.prototype),b.CrossHatchFilter.prototype.constructor=b.CrossHatchFilter,Object.defineProperty(b.CrossHatchFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(a){this.uniforms.blur.value=1/7e3*a}}),b.RGBSplitFilter=function(){b.AbstractFilter.call(this),this.passes=[this],this.uniforms={red:{type:"2f",value:{x:20,y:20}},green:{type:"2f",value:{x:-20,y:20}},blue:{type:"2f",value:{x:20,y:-20}},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 red;","uniform vec2 green;","uniform vec2 blue;","uniform vec4 dimensions;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;"," gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;"," gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;"," gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;","}"]},b.RGBSplitFilter.prototype=Object.create(b.AbstractFilter.prototype),b.RGBSplitFilter.prototype.constructor=b.RGBSplitFilter,Object.defineProperty(b.RGBSplitFilter.prototype,"red",{get:function(){return this.uniforms.red.value},set:function(a){this.uniforms.red.value=a}}),Object.defineProperty(b.RGBSplitFilter.prototype,"green",{get:function(){return this.uniforms.green.value},set:function(a){this.uniforms.green.value=a}}),Object.defineProperty(b.RGBSplitFilter.prototype,"blue",{get:function(){return this.uniforms.blue.value},set:function(a){this.uniforms.blue.value=a}}),"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.PIXI=b):"undefined"!=typeof define&&define.amd?define(b):a.PIXI=b}).call(this); /* html2canvas 0.5.0-alpha2 Copyright (c) 2015 Niklas von Hertzen @@ -8940,16 +8942,16 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c } //Wrap to jQuery plugin - if (w.$ !== undefined) { - $[HTMLGL.JQ_PLUGIN_NAME] = {}; - $[HTMLGL.JQ_PLUGIN_NAME].elements = []; + if (w.jQuery !== undefined) { + jQuery[HTMLGL.JQ_PLUGIN_NAME] = {}; + jQuery[HTMLGL.JQ_PLUGIN_NAME].elements = []; - $.fn[HTMLGL.JQ_PLUGIN_NAME] = function () { + jQuery.fn[HTMLGL.JQ_PLUGIN_NAME] = function () { return this.each(function () { - if (!$.data(this, 'plugin_' + HTMLGL.JQ_PLUGIN_NAME)) { + if (!jQuery.data(this, 'plugin_' + HTMLGL.JQ_PLUGIN_NAME)) { var propellerObj = HTMLGL.GLElement.createFromNode(this); - $.data(this, 'plugin_' + HTMLGL.JQ_PLUGIN_NAME, propellerObj); - $[HTMLGL.JQ_PLUGIN_NAME].elements.push(propellerObj); + jQuery.data(this, 'plugin_' + HTMLGL.JQ_PLUGIN_NAME, propellerObj); + jQuery[HTMLGL.JQ_PLUGIN_NAME].elements.push(propellerObj); } }); }; diff --git a/dist/htmlgl.min.js b/dist/htmlgl.min.js index 881d326..e965d10 100644 --- a/dist/htmlgl.min.js +++ b/dist/htmlgl.min.js @@ -1,11 +1,11 @@ -!function(){function t(t,e){return function(){t.apply(e,arguments)}}function e(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],a(e,t(r,this),t(n,this))}function i(t){var e=this;return null===this._state?void this._deferreds.push(t):void l(function(){var i=e._state?t.onFulfilled:t.onRejected;if(null===i)return void(e._state?t.resolve:t.reject)(e._value);var r;try{r=i(e._value)}catch(n){return void t.reject(n)}t.resolve(r)})}function r(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var i=e.then;if("function"==typeof i)return void a(t(i,e),t(r,this),t(n,this))}this._state=!0,this._value=e,o.call(this)}catch(s){n.call(this,s)}}function n(t){this._state=!1,this._value=t,o.call(this)}function o(){for(var t=0,e=this._deferreds.length;e>t;t++)i.call(this,this._deferreds[t]);this._deferreds=null}function s(t,e,i,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=i,this.reject=r}function a(t,e,i){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,i(t))})}catch(n){if(r)return;r=!0,i(n)}}var h;h="object"==typeof window&&window?window:global;var l=e.immediateFn||h.setImmediate||function(t){setTimeout(t,1)},u=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.prototype["catch"]=function(t){return this.then(null,t)},e.prototype.then=function(t,r){var n=this;return new e(function(e,o){i.call(n,new s(t,r,e,o))})},e.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&u(arguments[0])?arguments[0]:arguments);return new e(function(e,i){function r(o,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){r(o,t)},i)}t[o]=s,0===--n&&e(t)}catch(h){i(h)}}if(0===t.length)return e([]);for(var n=t.length,o=0;or;r++)t[r].then(e,i)})},"undefined"!=typeof module&&module.exports?module.exports=e:h.Promise||(h.Promise=e)}(),"undefined"==typeof WeakMap&&!function(){var t=Object.defineProperty,e=Date.now()%1e9,i=function(){this.name="__st"+(1e9*Math.random()>>>0)+(e++ +"__")};i.prototype={set:function(e,i){var r=e[this.name];return r&&r[0]===e?r[1]=i:t(e,this.name,{value:[e,i],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},"delete":function(t){var e=t[this.name];return e&&e[0]===t?(e[0]=e[1]=void 0,!0):!1},has:function(t){var e=t[this.name];return e?e[0]===t:!1}},window.WeakMap=i}(),window.CustomElements=window.CustomElements||{flags:{}},function(t){var e=t.flags,i=[],r=function(t){i.push(t)},n=function(){i.forEach(function(e){e(t)})};t.addModule=r,t.initializeModules=n,t.hasNative=Boolean(document.registerElement),t.useNative=!e.register&&t.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(t){function e(t,e){i(t,function(t){return e(t)?!0:void r(t,e)}),r(t,e)}function i(t,e,r){var n=t.firstElementChild;if(!n)for(n=t.firstChild;n&&n.nodeType!==Node.ELEMENT_NODE;)n=n.nextSibling;for(;n;)e(n,r)!==!0&&i(n,e,r),n=n.nextElementSibling;return null}function r(t,i){for(var r=t.shadowRoot;r;)e(r,i),r=r.olderShadowRoot}function n(t,e){s=[],o(t,e),s=null}function o(t,e){if(t=wrap(t),!(s.indexOf(t)>=0)){s.push(t);for(var i,r=t.querySelectorAll("link[rel="+a+"]"),n=0,h=r.length;h>n&&(i=r[n]);n++)i["import"]&&o(i["import"],e);e(t)}}var s,a=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=n,t.forSubtree=e}),CustomElements.addModule(function(t){function e(t){return i(t)||r(t)}function i(e){return t.upgrade(e)?!0:void a(e)}function r(t){b(t,function(t){return i(t)?!0:void 0})}function n(t){a(t),d(t)&&b(t,function(t){a(t)})}function o(t){C.push(t),S||(S=!0,setTimeout(s))}function s(){S=!1;for(var t,e=C,i=0,r=e.length;r>i&&(t=e[i]);i++)t();C=[]}function a(t){T?o(function(){h(t)}):h(t)}function h(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&!t.__attached&&d(t)&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function l(t){u(t),b(t,function(t){u(t)})}function u(t){T?o(function(){c(t)}):c(t)}function c(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&t.__attached&&!d(t)&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function d(t){for(var e=t,i=wrap(document);e;){if(e==i)return!0;e=e.parentNode||e.host}}function p(t){if(t.shadowRoot&&!t.shadowRoot.__watched){x.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)m(e),e=e.olderShadowRoot}}function f(t){if(x.dom){var i=t[0];if(i&&"childList"===i.type&&i.addedNodes&&i.addedNodes){for(var r=i.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var n=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";n=n.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",t.length,n||"")}t.forEach(function(t){"childList"===t.type&&(E(t.addedNodes,function(t){t.localName&&e(t)}),E(t.removedNodes,function(t){t.localName&&l(t)}))}),x.dom&&console.groupEnd()}function g(t){for(t=wrap(t),t||(t=wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(f(e.takeRecords()),s())}function m(t){if(!t.__observer){var e=new MutationObserver(f);e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function v(t){t=wrap(t),x.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),e(t),m(t),x.dom&&console.groupEnd()}function y(t){w(t,v)}var x=t.flags,b=t.forSubtree,w=t.forDocumentTree,T=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;t.hasPolyfillMutations=T;var S=!1,C=[],E=Array.prototype.forEach.call.bind(Array.prototype.forEach),A=Element.prototype.createShadowRoot;A&&(Element.prototype.createShadowRoot=function(){var t=A.call(this);return CustomElements.watchShadow(this),t}),t.watchShadow=p,t.upgradeDocumentTree=y,t.upgradeSubtree=r,t.upgradeAll=e,t.attachedNode=n,t.takeRecords=g}),CustomElements.addModule(function(t){function e(e){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var r=e.getAttribute("is"),n=t.getRegisteredDefinition(r||e.localName);if(n){if(r&&n.tag==e.localName)return i(e,n);if(!r&&!n["extends"])return i(e,n)}}}function i(e,i){return s.upgrade&&console.group("upgrade:",e.localName),i.is&&e.setAttribute("is",i.is),r(e,i),e.__upgraded__=!0,o(e),t.attachedNode(e),t.upgradeSubtree(e),s.upgrade&&console.groupEnd(),e}function r(t,e){Object.__proto__?t.__proto__=e.prototype:(n(t,e.prototype,e["native"]),t.__proto__=e.prototype)}function n(t,e,i){for(var r={},n=e;n!==i&&n!==HTMLElement.prototype;){for(var o,s=Object.getOwnPropertyNames(n),a=0;o=s[a];a++)r[o]||(Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o)),r[o]=1);n=Object.getPrototypeOf(n)}}function o(t){t.createdCallback&&t.createdCallback()}var s=t.flags;t.upgrade=e,t.upgradeWithDefinition=i,t.implementPrototype=r}),CustomElements.addModule(function(t){function e(e,r){var h=r||{};if(!e)throw new Error("document.registerElement: first argument `name` must not be empty");if(e.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(e)+"'.");if(n(e))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(e)+"'. The type name is invalid.");if(l(e))throw new Error("DuplicateDefinitionError: a type with name '"+String(e)+"' is already registered");return h.prototype||(h.prototype=Object.create(HTMLElement.prototype)),h.__name=e.toLowerCase(),h.lifecycle=h.lifecycle||{},h.ancestry=o(h["extends"]),s(h),a(h),i(h.prototype),u(h.__name,h),h.ctor=c(h),h.ctor.prototype=h.prototype,h.prototype.constructor=h.ctor,t.ready&&m(document),h.ctor}function i(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,i){r.call(this,t,i,e)};var i=t.removeAttribute;t.removeAttribute=function(t){r.call(this,t,null,i)},t.setAttribute._polyfilled=!0}}function r(t,e,i){t=t.toLowerCase();var r=this.getAttribute(t);i.apply(this,arguments);var n=this.getAttribute(t);this.attributeChangedCallback&&n!==r&&this.attributeChangedCallback(t,r,n)}function n(t){for(var e=0;e=0&&x(r,HTMLElement),r)}function f(t){var e=A.call(this,t);return v(e),e}var g,m=t.upgradeDocumentTree,v=t.upgrade,y=t.upgradeWithDefinition,x=t.implementPrototype,b=t.useNative,w=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],T={},S="http://www.w3.org/1999/xhtml",C=document.createElement.bind(document),E=document.createElementNS.bind(document),A=Node.prototype.cloneNode;g=Object.__proto__||b?function(t,e){return t instanceof e}:function(t,e){for(var i=t;i;){if(i===e.prototype)return!0;i=i.__proto__}return!1},document.registerElement=e,document.createElement=p,document.createElementNS=d,Node.prototype.cloneNode=f,t.registry=T,t["instanceof"]=g,t.reservedTagList=w,t.getRegisteredDefinition=l,document.register=document.registerElement}),function(t){function e(){s(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(t){s(wrap(t["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var i=t.useNative,r=t.initializeModules,n=/Trident/.test(navigator.userAgent);if(i){var o=function(){};t.watchShadow=o,t.upgrade=o,t.upgradeAll=o,t.upgradeDocumentTree=o,t.upgradeSubtree=o,t.takeRecords=o,t["instanceof"]=function(t,e){return t instanceof e}}else r();var s=t.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),n&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(t,e){e=e||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),i},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||t.flags.eager)e();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(a,e)}else e()}(window.CustomElements),function(){var t=this,e=e||{};e.WEBGL_RENDERER=0,e.CANVAS_RENDERER=1,e.VERSION="v2.2.7",e.blendModes={NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},e.scaleModes={DEFAULT:0,LINEAR:0,NEAREST:1},e._UID=0,"undefined"!=typeof Float32Array?(e.Float32Array=Float32Array,e.Uint16Array=Uint16Array,e.Uint32Array=Uint32Array,e.ArrayBuffer=ArrayBuffer):(e.Float32Array=Array,e.Uint16Array=Array),e.INTERACTION_FREQUENCY=30,e.AUTO_PREVENT_DEFAULT=!0,e.PI_2=2*Math.PI,e.RAD_TO_DEG=180/Math.PI,e.DEG_TO_RAD=Math.PI/180,e.RETINA_PREFIX="@2x",e.dontSayHello=!1,e.defaultRenderOptions={view:null,transparent:!1,antialias:!1,preserveDrawingBuffer:!1,resolution:1,clearBeforeRender:!0,autoResize:!1},e.sayHello=function(t){if(!e.dontSayHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var i=["%c %c %c Pixi.js "+e.VERSION+" - "+t+" %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ ","background: #ff66a5","background: #ff66a5","color: #ff66a5; background: #030307;","background: #ff66a5","background: #ffc3dc","background: #ff66a5","color: #ff2424; background: #fff","color: #ff2424; background: #fff","color: #ff2424; background: #fff"];console.log.apply(console,i)}else window.console&&console.log("Pixi.js "+e.VERSION+" - http://www.pixijs.com/");e.dontSayHello=!0}},e.Point=function(t,e){this.x=t||0,this.y=e||0},e.Point.prototype.clone=function(){return new e.Point(this.x,this.y)},e.Point.prototype.set=function(t,e){this.x=t||0,this.y=e||(0!==e?this.x:0)},e.Point.prototype.constructor=e.Point,e.Rectangle=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Rectangle.prototype.clone=function(){return new e.Rectangle(this.x,this.y,this.width,this.height)},e.Rectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.Rectangle.prototype.constructor=e.Rectangle,e.EmptyRectangle=new e.Rectangle(0,0,0,0),e.Polygon=function(t){if(t instanceof Array||(t=Array.prototype.slice.call(arguments)),t[0]instanceof e.Point){for(var i=[],r=0,n=t.length;n>r;r++)i.push(t[r].x,t[r].y);t=i}this.closed=!0,this.points=t},e.Polygon.prototype.clone=function(){var t=this.points.slice();return new e.Polygon(t)},e.Polygon.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,o=r-1;r>n;o=n++){var s=this.points[2*n],a=this.points[2*n+1],h=this.points[2*o],l=this.points[2*o+1],u=a>e!=l>e&&(h-s)*(e-a)/(l-a)+s>t;u&&(i=!i)}return i},e.Polygon.prototype.constructor=e.Polygon,e.Circle=function(t,e,i){this.x=t||0,this.y=e||0,this.radius=i||0},e.Circle.prototype.clone=function(){return new e.Circle(this.x,this.y,this.radius)},e.Circle.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.x-t,r=this.y-e,n=this.radius*this.radius;return i*=i,r*=r,n>=i+r},e.Circle.prototype.getBounds=function(){return new e.Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},e.Circle.prototype.constructor=e.Circle,e.Ellipse=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Ellipse.prototype.clone=function(){return new e.Ellipse(this.x,this.y,this.width,this.height)},e.Ellipse.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,1>=i+r},e.Ellipse.prototype.getBounds=function(){return new e.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},e.Ellipse.prototype.constructor=e.Ellipse,e.RoundedRectangle=function(t,e,i,r,n){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0,this.radius=n||20},e.RoundedRectangle.prototype.clone=function(){return new e.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},e.RoundedRectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.RoundedRectangle.prototype.constructor=e.RoundedRectangle,e.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},e.Matrix.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},e.Matrix.prototype.toArray=function(t){this.array||(this.array=new e.Float32Array(9));var i=this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},e.Matrix.prototype.apply=function(t,i){return i=i||new e.Point,i.x=this.a*t.x+this.c*t.y+this.tx,i.y=this.b*t.x+this.d*t.y+this.ty,i},e.Matrix.prototype.applyInverse=function(t,i){i=i||new e.Point;var r=1/(this.a*this.d+this.c*-this.b);return i.x=this.d*r*t.x+-this.c*r*t.y+(this.ty*this.c-this.tx*this.d)*r,i.y=this.a*r*t.y+-this.b*r*t.x+(-this.ty*this.a+this.tx*this.b)*r,i},e.Matrix.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},e.Matrix.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},e.Matrix.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this},e.Matrix.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},e.Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},e.identityMatrix=new e.Matrix,e.DisplayObject=function(){this.position=new e.Point,this.scale=new e.Point(1,1),this.pivot=new e.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new e.Matrix,this._sr=0,this._cr=1,this.filterArea=null,this._bounds=new e.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},e.DisplayObject.prototype.constructor=e.DisplayObject,Object.defineProperty(e.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(t){this._interactive=t,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}}),Object.defineProperty(e.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(t){if(t){for(var e=[],i=0;i=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),this.stage&&t.setStageReference(this.stage),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},e.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),r=this.getChildIndex(e);if(0>i||0>r)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[r]=t}},e.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},e.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(0>e||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},e.DisplayObjectContainer.prototype.getChildAt=function(t){if(0>t||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},e.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);return-1!==e?this.removeChildAt(e):void 0},e.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return this.stage&&e.removeStageReference(),e.parent=void 0,this.children.splice(t,1),e},e.DisplayObjectContainer.prototype.removeChildren=function(t,e){var i=t||0,r="number"==typeof e?e:this.children.length,n=r-i;if(n>0&&r>=n){for(var o=this.children.splice(i,n),s=0;st;t++)this.children[t].updateTransform()},e.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=e.DisplayObjectContainer.prototype.updateTransform,e.DisplayObjectContainer.prototype.getBounds=function(){if(0===this.children.length)return e.EmptyRectangle;for(var t,i,r,n=1/0,o=1/0,s=-1/0,a=-1/0,h=!1,l=0,u=this.children.length;u>l;l++){var c=this.children[l];c.visible&&(h=!0,t=this.children[l].getBounds(),n=ni?s:i,a=a>r?a:r)}if(!h)return e.EmptyRectangle;var d=this._bounds;return d.x=n,d.y=o,d.width=s-n,d.height=a-o,d},e.DisplayObjectContainer.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=e.identityMatrix;for(var i=0,r=this.children.length;r>i;i++)this.children[i].updateTransform();var n=this.getBounds();return this.worldTransform=t,n},e.DisplayObjectContainer.prototype.setStageReference=function(t){this.stage=t,this._interactive&&(this.stage.dirty=!0);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r.setStageReference(t)}},e.DisplayObjectContainer.prototype.removeStageReference=function(){for(var t=0,e=this.children.length;e>t;t++){var i=this.children[t];i.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},e.DisplayObjectContainer.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);var e,i;if(this._mask||this._filters){for(this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),t.spriteBatch.start()}else for(e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.DisplayObjectContainer.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);this._mask&&t.maskManager.pushMask(this._mask,t);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r._renderCanvas(t)}this._mask&&t.maskManager.popMask(t)}},e.Sprite=function(t){e.DisplayObjectContainer.call(this),this.anchor=new e.Point,this.texture=t||e.Texture.emptyTexture,this._width=0,this._height=0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.shader=null,this.texture.baseTexture.hasLoaded?this.onTextureUpdate():this.texture.on("update",this.onTextureUpdate.bind(this)),this.renderable=!0},e.Sprite.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Sprite.prototype.constructor=e.Sprite,Object.defineProperty(e.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(t){this.scale.x=t/this.texture.frame.width,this._width=t}}),Object.defineProperty(e.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(t){this.scale.y=t/this.texture.frame.height,this._height=t}}),e.Sprite.prototype.setTexture=function(t){this.texture=t,this.cachedTint=16777215},e.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height)},e.Sprite.prototype.getBounds=function(t){var e=this.texture.frame.width,i=this.texture.frame.height,r=e*(1-this.anchor.x),n=e*-this.anchor.x,o=i*(1-this.anchor.y),s=i*-this.anchor.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=-1/0,g=-1/0,m=1/0,v=1/0;if(0===l&&0===u)0>h&&(h*=-1),0>c&&(c*=-1),m=h*n+d,f=h*r+d,v=c*s+p,g=c*o+p;else{var y=h*n+u*s+d,x=c*s+l*n+p,b=h*r+u*s+d,w=c*s+l*r+p,T=h*r+u*o+d,S=c*o+l*r+p,C=h*n+u*o+d,E=c*o+l*n+p;m=m>y?y:m,m=m>b?b:m,m=m>T?T:m,m=m>C?C:m,v=v>x?x:v,v=v>w?w:v,v=v>S?S:v,v=v>E?E:v,f=y>f?y:f,f=b>f?b:f,f=T>f?T:f,f=C>f?C:f,g=x>g?x:g,g=w>g?w:g,g=S>g?S:g,g=E>g?E:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=v,A.height=g-v,this._currentBounds=A,A},e.Sprite.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){var e,i;if(this._mask||this._filters){var r=t.spriteBatch;for(this._filters&&(r.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(r.stop(),t.maskManager.pushMask(this.mask,t),r.start()),r.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);r.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),r.start()}else for(t.spriteBatch.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.Sprite.prototype._renderCanvas=function(t){if(!(this.visible===!1||0===this.alpha||this.texture.crop.width<=0||this.texture.crop.height<=0)){if(this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,t.context.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t),this.texture.valid){var i=this.texture.baseTexture.resolution/t.resolution;t.context.globalAlpha=this.worldAlpha,t.smoothProperty&&t.scaleMode!==this.texture.baseTexture.scaleMode&&(t.scaleMode=this.texture.baseTexture.scaleMode,t.context[t.smoothProperty]=t.scaleMode===e.scaleModes.LINEAR);var r=this.texture.trim?this.texture.trim.x-this.anchor.x*this.texture.trim.width:this.anchor.x*-this.texture.frame.width,n=this.texture.trim?this.texture.trim.y-this.anchor.y*this.texture.trim.height:this.anchor.y*-this.texture.frame.height;t.roundPixels?(t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution|0,this.worldTransform.ty*t.resolution|0),r=0|r,n=0|n):t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution,this.worldTransform.ty*t.resolution),16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=e.CanvasTinter.getTintedTexture(this,this.tint)),t.context.drawImage(this.tintedTexture,0,0,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)):t.context.drawImage(this.texture.baseTexture.source,this.texture.crop.x,this.texture.crop.y,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)}for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Sprite.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache'+this); -return new e.Sprite(i)},e.Sprite.fromImage=function(t,i,r){var n=e.Texture.fromImage(t,i,r);return new e.Sprite(n)},e.SpriteBatch=function(t){e.DisplayObjectContainer.call(this),this.textureThing=t,this.ready=!1},e.SpriteBatch.prototype=Object.create(e.DisplayObjectContainer.prototype),e.SpriteBatch.prototype.constructor=e.SpriteBatch,e.SpriteBatch.prototype.initWebGL=function(t){this.fastSpriteBatch=new e.WebGLFastSpriteBatch(t),this.ready=!0},e.SpriteBatch.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},e.SpriteBatch.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(t.gl),this.fastSpriteBatch.gl!==t.gl&&this.fastSpriteBatch.setContext(t.gl),t.spriteBatch.stop(),t.shaderManager.setShader(t.shaderManager.fastShader),this.fastSpriteBatch.begin(this,t),this.fastSpriteBatch.render(this),t.spriteBatch.start())},e.SpriteBatch.prototype._renderCanvas=function(t){if(this.visible&&!(this.alpha<=0)&&this.children.length){var e=t.context;e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var i=this.worldTransform,r=!0,n=0;n=this.textures.length&&(this.gotoAndStop(this.textures.length-1),this.onComplete&&this.onComplete())}},e.MovieClip.fromFrames=function(t){for(var i=[],r=0;rh;h++){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p+=d}for(i.ascent=s-h,p=c-d,f=!1,h=a;h>s;h--){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p-=d}i.descent=h-s,i.descent+=6,i.fontSize=i.ascent+i.descent,e.Text.fontPropertiesCache[t]=i}return i},e.Text.prototype.wordWrap=function(t){for(var e="",i=t.split("\n"),r=0;rn?(s>0&&(e+="\n"),e+=o[s],n=this.style.wordWrapWidth-a):(n-=h,e+=" "+o[s])}r=2?parseInt(i[i.length-2],10):e.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=t.tint},e.BitmapText.prototype.updateText=function(){for(var t=e.BitmapText.fonts[this.fontName],i=new e.Point,r=null,n=[],o=0,s=[],a=0,h=this.fontSize/t.size,l=0;l=l;l++){var p=0;"right"===this.style.align?p=o-s[l]:"center"===this.style.align&&(p=(o-s[l])/2),d.push(p)}var f=this.children.length,g=n.length,m=this.tint||16777215;for(l=0;g>l;l++){var v=f>l?this.children[l]:this._pool.pop();v?v.setTexture(n[l].texture):v=new e.Sprite(n[l].texture),v.position.x=(n[l].position.x+d[n[l].line])*h,v.position.y=n[l].position.y*h,v.scale.x=v.scale.y=h,v.tint=m,v.parent||this.addChild(v)}for(;this.children.length>g;){var y=this.getChildAt(this.children.length-1);this._pool.push(y),this.removeChild(y)}this.textWidth=o*h,this.textHeight=(i.y+t.lineHeight)*h},e.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.BitmapText.fonts={},e.InteractionData=function(){this.global=new e.Point,this.target=null,this.originalEvent=null},e.InteractionData.prototype.getLocalPosition=function(t,i){var r=t.worldTransform,n=this.global,o=r.a,s=r.c,a=r.tx,h=r.b,l=r.d,u=r.ty,c=1/(o*l+s*-h);return i=i||new e.Point,i.x=l*c*n.x+-s*c*n.y+(u*s-a*l)*c,i.y=o*c*n.y+-h*c*n.x+(-u*o+a*h)*c,i},e.InteractionData.prototype.constructor=e.InteractionData,e.InteractionManager=function(t){this.stage=t,this.mouse=new e.InteractionData,this.touches={},this.tempPoint=new e.Point,this.mouseoverEnabled=!0,this.pool=[],this.interactiveItems=[],this.interactionDOMElement=null,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this.mouseOut=!1,this.resolution=1,this._tempPoint=new e.Point},e.InteractionManager.prototype.constructor=e.InteractionManager,e.InteractionManager.prototype.collectInteractiveSprite=function(t,e){for(var i=t.children,r=i.length,n=r-1;n>=0;n--){var o=i[n];o._interactive?(e.interactiveChildren=!0,this.interactiveItems.push(o),o.children.length>0&&this.collectInteractiveSprite(o,o)):(o.__iParent=null,o.children.length>0&&this.collectInteractiveSprite(o,e))}},e.InteractionManager.prototype.setTarget=function(t){this.target=t,this.resolution=t.resolution,null===this.interactionDOMElement&&this.setTargetDomElement(t.view)},e.InteractionManager.prototype.setTargetDomElement=function(t){this.removeEvents(),window.navigator.msPointerEnabled&&(t.style["-ms-content-zooming"]="none",t.style["-ms-touch-action"]="none"),this.interactionDOMElement=t,t.addEventListener("mousemove",this.onMouseMove,!0),t.addEventListener("mousedown",this.onMouseDown,!0),t.addEventListener("mouseout",this.onMouseOut,!0),t.addEventListener("touchstart",this.onTouchStart,!0),t.addEventListener("touchend",this.onTouchEnd,!0),t.addEventListener("touchleave",this.onTouchCancel,!0),t.addEventListener("touchcancel",this.onTouchCancel,!0),t.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0)},e.InteractionManager.prototype.removeEvents=function(){this.interactionDOMElement&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]="",this.interactionDOMElement.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchleave",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0))},e.InteractionManager.prototype.update=function(){if(this.target){var t=Date.now(),i=t-this.last;if(i=i*e.INTERACTION_FREQUENCY/1e3,!(1>i)){this.last=t;var r=0;this.dirty&&this.rebuildInteractiveGraph();var n=this.interactiveItems.length,o="inherit",s=!1;for(r=0;n>r;r++){var a=this.interactiveItems[r];a.__hit=this.hitTest(a,this.mouse),this.mouse.target=a,a.__hit&&!s?(a.buttonMode&&(o=a.defaultCursor),a.interactiveChildren||(s=!0),a.__isOver||(a.mouseover&&a.mouseover(this.mouse),a.__isOver=!0)):a.__isOver&&(a.mouseout&&a.mouseout(this.mouse),a.__isOver=!1)}this.currentCursorStyle!==o&&(this.currentCursorStyle=o,this.interactionDOMElement.style.cursor=o)}}},e.InteractionManager.prototype.rebuildInteractiveGraph=function(){this.dirty=!1;for(var t=this.interactiveItems.length,e=0;t>e;e++)this.interactiveItems[e].interactiveChildren=!1;this.interactiveItems=[],this.stage.interactive&&this.interactiveItems.push(this.stage),this.collectInteractiveSprite(this.stage,this.stage)},e.InteractionManager.prototype.onMouseMove=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactionDOMElement.getBoundingClientRect();this.mouse.global.x=(t.clientX-e.left)*(this.target.width/e.width)/this.resolution,this.mouse.global.y=(t.clientY-e.top)*(this.target.height/e.height)/this.resolution;for(var i=this.interactiveItems.length,r=0;i>r;r++){var n=this.interactiveItems[r];n.mousemove&&n.mousemove(this.mouse)}},e.InteractionManager.prototype.onMouseDown=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t,e.AUTO_PREVENT_DEFAULT&&this.mouse.originalEvent.preventDefault();for(var i=this.interactiveItems.length,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightdown":"mousedown",s=n?"rightclick":"click",a=n?"__rightIsDown":"__mouseIsDown",h=n?"__isRightDown":"__isDown",l=0;i>l;l++){var u=this.interactiveItems[l];if((u[o]||u[s])&&(u[a]=!0,u.__hit=this.hitTest(u,this.mouse),u.__hit&&(u[o]&&u[o](this.mouse),u[h]=!0,!u.interactiveChildren)))break}},e.InteractionManager.prototype.onMouseOut=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactiveItems.length;this.interactionDOMElement.style.cursor="inherit";for(var i=0;e>i;i++){var r=this.interactiveItems[i];r.__isOver&&(this.mouse.target=r,r.mouseout&&r.mouseout(this.mouse),r.__isOver=!1)}this.mouseOut=!0,this.mouse.global.x=-1e4,this.mouse.global.y=-1e4},e.InteractionManager.prototype.onMouseUp=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;for(var e=this.interactiveItems.length,i=!1,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightup":"mouseup",s=n?"rightclick":"click",a=n?"rightupoutside":"mouseupoutside",h=n?"__isRightDown":"__isDown",l=0;e>l;l++){var u=this.interactiveItems[l];(u[s]||u[o]||u[a])&&(u.__hit=this.hitTest(u,this.mouse),u.__hit&&!i?(u[o]&&u[o](this.mouse),u[h]&&u[s]&&u[s](this.mouse),u.interactiveChildren||(i=!0)):u[h]&&u[a]&&u[a](this.mouse),u[h]=!1)}},e.InteractionManager.prototype.hitTest=function(t,i){var r=i.global;if(!t.worldVisible)return!1;t.worldTransform.applyInverse(r,this._tempPoint);var n,o=this._tempPoint.x,s=this._tempPoint.y;if(i.target=t,t.hitArea&&t.hitArea.contains)return t.hitArea.contains(o,s);if(t instanceof e.Sprite){var a,h=t.texture.frame.width,l=t.texture.frame.height,u=-h*t.anchor.x;if(o>u&&u+h>o&&(a=-l*t.anchor.y,s>a&&a+l>s))return!0}else if(t instanceof e.Graphics){var c=t.graphicsData;for(n=0;nn;n++){var f=t.children[n],g=this.hitTest(f,i);if(g)return i.target=t,!0}return!1},e.InteractionManager.prototype.onTouchMove=function(t){this.dirty&&this.rebuildInteractiveGraph();var e,i=this.interactionDOMElement.getBoundingClientRect(),r=t.changedTouches,n=0;for(n=0;nh;h++){var l=this.interactiveItems[h];if((l.touchstart||l.tap)&&(l.__hit=this.hitTest(l,s),l.__hit&&(l.touchstart&&l.touchstart(s),l.__isDown=!0,l.__touchData=l.__touchData||{},l.__touchData[o.identifier]=s,!l.interactiveChildren)))break}}},e.InteractionManager.prototype.onTouchEnd=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e=this.interactionDOMElement.getBoundingClientRect(),i=t.changedTouches,r=0;rh;h++){var l=this.interactiveItems[h];l.__touchData&&l.__touchData[n.identifier]&&(l.__hit=this.hitTest(l,l.__touchData[n.identifier]),o.originalEvent=t,(l.touchend||l.tap)&&(l.__hit&&!s?(l.touchend&&l.touchend(o),l.__isDown&&l.tap&&l.tap(o),l.interactiveChildren||(s=!0)):l.__isDown&&l.touchendoutside&&l.touchendoutside(o),l.__isDown=!1),l.__touchData[n.identifier]=null)}this.pool.push(o),this.touches[n.identifier]=null}},e.InteractionManager.prototype.onTouchCancel=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e=this.interactionDOMElement.getBoundingClientRect(),i=t.changedTouches,r=0;rh;h++){var l=this.interactiveItems[h];l.__touchData&&l.__touchData[n.identifier]&&(l.__hit=this.hitTest(l,l.__touchData[n.identifier]),o.originalEvent=t,l.touchcancel&&!s&&(l.touchcancel(o),l.interactiveChildren||(s=!0)),l.__isDown=!1,l.__touchData[n.identifier]=null)}this.pool.push(o),this.touches[n.identifier]=null}},e.Stage=function(t){e.DisplayObjectContainer.call(this),this.worldTransform=new e.Matrix,this.interactive=!0,this.interactionManager=new e.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new e.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(t)},e.Stage.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Stage.prototype.constructor=e.Stage,e.Stage.prototype.setInteractionDelegate=function(t){this.interactionManager.setTargetDomElement(t)},e.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var t=0,e=this.children.length;e>t;t++)this.children[t].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},e.Stage.prototype.setBackgroundColor=function(t){this.backgroundColor=t||0,this.backgroundColorSplit=e.hex2rgb(this.backgroundColor);var i=this.backgroundColor.toString(16);i="000000".substr(0,6-i.length)+i,this.backgroundColorString="#"+i},e.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},function(t){for(var e=0,i=["ms","moz","webkit","o"],r=0;r>16&255)/255,(t>>8&255)/255,(255&t)/255]},e.rgb2hex=function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){return function(t){function e(){for(var r=arguments.length,o=new Array(r);r--;)o[r]=arguments[r];return o=n.concat(o),i.apply(this instanceof e?this:t,o)}var i=this,r=arguments.length-1,n=[];if(r>0)for(n.length=r;r--;)n[r]=arguments[r+1];if("function"!=typeof i)throw new TypeError;return e.prototype=function o(t){return t&&(o.prototype=t),this instanceof o?void 0:new o}(i.prototype),e}}()),e.AjaxRequest=function(){var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var e=0;e0&&0===(t&t-1))return t;for(var e=1;t>e;)e<<=1;return e},e.isPowerOfTwo=function(t,e){return t>0&&0===(t&t-1)&&e>0&&0===(e&e-1)},e.EventTarget={call:function(t){t&&(t=t.prototype||t,e.EventTarget.mixin(t))},mixin:function(t){t.listeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?this._listeners[t].slice():[]},t.emit=t.dispatchEvent=function(t,i){if(this._listeners=this._listeners||{},"object"==typeof t&&(i=t,t=t.type),i&&i.__isEventObject===!0||(i=new e.Event(this,t,i)),this._listeners&&this._listeners[t]){var r,n=this._listeners[t].slice(0),o=n.length,s=n[0];for(r=0;o>r;s=n[++r])if(s.call(this,i),i.stoppedImmediate)return this;if(i.stopped)return this}return this.parent&&this.parent.emit&&this.parent.emit.call(this.parent,t,i),this},t.on=t.addEventListener=function(t,e){return this._listeners=this._listeners||{},(this._listeners[t]=this._listeners[t]||[]).push(e),this},t.once=function(t,e){function i(){e.apply(r.off(t,i),arguments)}this._listeners=this._listeners||{};var r=this;return i._originalHandler=e,this.on(t,i)},t.off=t.removeEventListener=function(t,e){if(this._listeners=this._listeners||{},!this._listeners[t])return this;for(var i=this._listeners[t],r=e?i.length:0;r-->0;)(i[r]===e||i[r]._originalHandler===e)&&i.splice(r,1);return 0===i.length&&delete this._listeners[t],this},t.removeAllListeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?(delete this._listeners[t],this):this}}},e.Event=function(t,e,i){this.__isEventObject=!0,this.stopped=!1,this.stoppedImmediate=!1,this.target=t,this.type=e,this.data=i,this.content=i,this.timeStamp=Date.now()},e.Event.prototype.stopPropagation=function(){this.stopped=!0},e.Event.prototype.stopImmediatePropagation=function(){this.stoppedImmediate=!0},e.autoDetectRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}();return n?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.autoDetectRecommendedRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}(),o=/Android/i.test(navigator.userAgent);return n&&!o?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.PolyK={},e.PolyK.Triangulate=function(t){var i=!0,r=t.length>>1;if(3>r)return[];for(var n=[],o=[],s=0;r>s;s++)o.push(s);s=0;for(var a=r;a>3;){var h=o[(s+0)%a],l=o[(s+1)%a],u=o[(s+2)%a],c=t[2*h],d=t[2*h+1],p=t[2*l],f=t[2*l+1],g=t[2*u],m=t[2*u+1],v=!1;if(e.PolyK._convex(c,d,p,f,g,m,i)){v=!0;for(var y=0;a>y;y++){var x=o[y];if(x!==h&&x!==l&&x!==u&&e.PolyK._PointInTriangle(t[2*x],t[2*x+1],c,d,p,f,g,m)){v=!1;break}}}if(v)n.push(h,l,u),o.splice((s+1)%a,1),a--,s=0;else if(s++>3*a){if(!i)return null;for(n=[],o=[],s=0;r>s;s++)o.push(s);s=0,a=r,i=!1}}return n.push(o[0],o[1],o[2]),n},e.PolyK._PointInTriangle=function(t,e,i,r,n,o,s,a){var h=s-i,l=a-r,u=n-i,c=o-r,d=t-i,p=e-r,f=h*h+l*l,g=h*u+l*c,m=h*d+l*p,v=u*u+c*c,y=u*d+c*p,x=1/(f*v-g*g),b=(v*m-g*y)*x,w=(f*y-g*m)*x;return b>=0&&w>=0&&1>b+w},e.PolyK._convex=function(t,e,i,r,n,o,s){return(e-r)*(n-i)+(i-t)*(o-r)>=0===s},e.initDefaultShaders=function(){},e.CompileVertexShader=function(t,i){return e._CompileShader(t,i,t.VERTEX_SHADER)},e.CompileFragmentShader=function(t,i){return e._CompileShader(t,i,t.FRAGMENT_SHADER)},e._CompileShader=function(t,e,i){var r=e.join("\n"),n=t.createShader(i);return t.shaderSource(n,r),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(window.console.log(t.getShaderInfoLog(n)),null)},e.compileProgram=function(t,i,r){var n=e.CompileFragmentShader(t,r),o=e.CompileVertexShader(t,i),s=t.createProgram();return t.attachShader(s,o),t.attachShader(s,n),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||window.console.log("Could not initialise shaders"),s},e.PixiShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.firstRun=!0,this.dirty=!0,this.attributes=[],this.init()},e.PixiShader.prototype.constructor=e.PixiShader,e.PixiShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc||e.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var r in this.uniforms)this.uniforms[r].uniformLocation=t.getUniformLocation(i,r);this.initUniforms(),this.program=i},e.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var t,e=this.gl;for(var i in this.uniforms){t=this.uniforms[i];var r=t.type;"sampler2D"===r?(t._init=!1,null!==t.value&&this.initSampler2D(t)):"mat2"===r||"mat3"===r||"mat4"===r?(t.glMatrix=!0,t.glValueLength=1,"mat2"===r?t.glFunc=e.uniformMatrix2fv:"mat3"===r?t.glFunc=e.uniformMatrix3fv:"mat4"===r&&(t.glFunc=e.uniformMatrix4fv)):(t.glFunc=e["uniform"+r],t.glValueLength="2f"===r||"2i"===r?2:"3f"===r||"3i"===r?3:"4f"===r||"4i"===r?4:1)}},e.PixiShader.prototype.initSampler2D=function(t){if(t.value&&t.value.baseTexture&&t.value.baseTexture.hasLoaded){var e=this.gl;if(e.activeTexture(e["TEXTURE"+this.textureCount]),e.bindTexture(e.TEXTURE_2D,t.value.baseTexture._glTextures[e.id]),t.textureData){var i=t.textureData,r=i.magFilter?i.magFilter:e.LINEAR,n=i.minFilter?i.minFilter:e.LINEAR,o=i.wrapS?i.wrapS:e.CLAMP_TO_EDGE,s=i.wrapT?i.wrapT:e.CLAMP_TO_EDGE,a=i.luminance?e.LUMINANCE:e.RGBA;if(i.repeat&&(o=e.REPEAT,s=e.REPEAT),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!i.flipY),i.width){var h=i.width?i.width:512,l=i.height?i.height:2,u=i.border?i.border:0;e.texImage2D(e.TEXTURE_2D,0,a,h,l,u,a,e.UNSIGNED_BYTE,null)}else e.texImage2D(e.TEXTURE_2D,0,a,e.RGBA,e.UNSIGNED_BYTE,t.value.baseTexture.source);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,s)}e.uniform1i(t.uniformLocation,this.textureCount),t._init=!0,this.textureCount++}},e.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var t,i=this.gl;for(var r in this.uniforms)t=this.uniforms[r],1===t.glValueLength?t.glMatrix===!0?t.glFunc.call(i,t.uniformLocation,t.transpose,t.value):t.glFunc.call(i,t.uniformLocation,t.value):2===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y):3===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z):4===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z,t.value.w):"sampler2D"===t.type&&(t._init?(i.activeTexture(i["TEXTURE"+this.textureCount]),t.value.baseTexture._dirty[i.id]?e.instances[i.id].updateTexture(t.value.baseTexture):i.bindTexture(i.TEXTURE_2D,t.value.baseTexture._glTextures[i.id]),i.uniform1i(t.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(t))},e.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"],e.PixiFastShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init() -},e.PixiFastShader.prototype.constructor=e.PixiFastShader,e.PixiFastShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.uMatrix=t.getUniformLocation(i,"uMatrix"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aPositionCoord=t.getAttribLocation(i,"aPositionCoord"),this.aScale=t.getAttribLocation(i,"aScale"),this.aRotation=t.getAttribLocation(i,"aRotation"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=i},e.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.StripShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"],this.init()},e.StripShader.prototype.constructor=e.StripShader,e.StripShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.attributes=[this.aVertexPosition,this.aTextureCoord],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.StripShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.PrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform float flipY;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},e.PrimitiveShader.prototype.constructor=e.PrimitiveShader,e.PrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.ComplexPrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform vec3 tint;","uniform float alpha;","uniform vec3 color;","uniform float flipY;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = vec4(color * alpha * tint, alpha);","}"],this.init()},e.ComplexPrimitiveShader.prototype.constructor=e.ComplexPrimitiveShader,e.ComplexPrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.color=t.getUniformLocation(i,"color"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.ComplexPrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.WebGLGraphics=function(){},e.WebGLGraphics.renderGraphics=function(t,i){var r,n=i.gl,o=i.projection,s=i.offset,a=i.shaderManager.primitiveShader;t.dirty&&e.WebGLGraphics.updateGraphics(t,n);for(var h=t._webGL[n.id],l=0;l=6)if(a.points.length<12){s=e.WebGLGraphics.switchMode(r,0);var h=e.WebGLGraphics.buildPoly(a,s);h||(s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s))}else s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s);a.lineWidth>0&&(s=e.WebGLGraphics.switchMode(r,0),e.WebGLGraphics.buildLine(a,s))}else s=e.WebGLGraphics.switchMode(r,0),a.type===e.Graphics.RECT?e.WebGLGraphics.buildRectangle(a,s):a.type===e.Graphics.CIRC||a.type===e.Graphics.ELIP?e.WebGLGraphics.buildCircle(a,s):a.type===e.Graphics.RREC&&e.WebGLGraphics.buildRoundedRectangle(a,s);r.lastIndex++}for(n=0;n=m;m++)g=m/p,a=s(t,i,g),h=s(e,r,g),l=s(i,n,g),u=s(r,o,g),c=s(a,l,g),d=s(h,u,g),f.push(c,d);return f},e.WebGLGraphics.buildCircle=function(t,i){var r,n,o=t.shape,s=o.x,a=o.y;t.type===e.Graphics.CIRC?(r=o.radius,n=o.radius):(r=o.width,n=o.height);var h=40,l=2*Math.PI/h,u=0;if(t.fill){var c=e.hex2rgb(t.fillColor),d=t.fillAlpha,p=c[0]*d,f=c[1]*d,g=c[2]*d,m=i.points,v=i.indices,y=m.length/6;for(v.push(y),u=0;h+1>u;u++)m.push(s,a,p,f,g,d),m.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n,p,f,g,d),v.push(y++,y++);v.push(y-1)}if(t.lineWidth){var x=t.points;for(t.points=[],u=0;h+1>u;u++)t.points.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n);e.WebGLGraphics.buildLine(t,i),t.points=x}},e.WebGLGraphics.buildLine=function(t,i){var r=0,n=t.points;if(0!==n.length){if(t.lineWidth%2)for(r=0;rr;r++)c=n[2*(r-1)],d=n[2*(r-1)+1],p=n[2*r],f=n[2*r+1],g=n[2*(r+1)],m=n[2*(r+1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,x=-(f-m),b=p-g,P=Math.sqrt(x*x+b*b),x/=P,b/=P,x*=k,b*=k,S=-y+d-(-y+f),C=-v+p-(-v+c),E=(-v+c)*(-y+f)-(-v+p)*(-y+d),A=-b+m-(-b+f),_=-x+p-(-x+g),M=(-x+g)*(-b+f)-(-x+p)*(-b+m),L=S*_-A*C,Math.abs(L)<.1?(L+=10.1,F.push(p-v,f-y,U,j,V,N),F.push(p+v,f+y,U,j,V,N)):(l=(C*M-_*E)/L,u=(A*E-S*M)/L,R=(l-p)*(l-p)+(u-f)+(u-f),R>19600?(w=v-x,T=y-b,P=Math.sqrt(w*w+T*T),w/=P,T/=P,w*=k,T*=k,F.push(p-w,f-T),F.push(U,j,V,N),F.push(p+w,f+T),F.push(U,j,V,N),F.push(p-w,f-T),F.push(U,j,V,N),O++):(F.push(l,u),F.push(U,j,V,N),F.push(p-(l-p),f-(u-f)),F.push(U,j,V,N)));for(c=n[2*(I-2)],d=n[2*(I-2)+1],p=n[2*(I-1)],f=n[2*(I-1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,F.push(p-v,f-y),F.push(U,j,V,N),F.push(p+v,f+y),F.push(U,j,V,N),B.push(D),r=0;O>r;r++)B.push(D++);B.push(D-1)}},e.WebGLGraphics.buildComplexPoly=function(t,i){var r=t.points.slice();if(!(r.length<6)){var n=i.indices;i.points=r,i.alpha=t.fillAlpha,i.color=e.hex2rgb(t.fillColor);for(var o,s,a=1/0,h=-1/0,l=1/0,u=-1/0,c=0;co?o:a,h=o>h?o:h,l=l>s?s:l,u=s>u?s:u;r.push(a,l,h,l,h,u,a,u);var d=r.length/2;for(c=0;d>c;c++)n.push(c)}},e.WebGLGraphics.buildPoly=function(t,i){var r=t.points;if(!(r.length<6)){var n=i.points,o=i.indices,s=r.length/2,a=e.hex2rgb(t.fillColor),h=t.fillAlpha,l=a[0]*h,u=a[1]*h,c=a[2]*h,d=e.PolyK.Triangulate(r);if(!d)return!1;var p=n.length/6,f=0;for(f=0;ff;f++)n.push(r[2*f],r[2*f+1],l,u,c,h);return!0}},e.WebGLGraphics.graphicsDataPool=[],e.WebGLGraphicsData=function(t){this.gl=t,this.color=[0,0,0],this.points=[],this.indices=[],this.buffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.mode=1,this.alpha=1,this.dirty=!0},e.WebGLGraphicsData.prototype.reset=function(){this.points=[],this.indices=[]},e.WebGLGraphicsData.prototype.upload=function(){var t=this.gl;this.glPoints=new e.Float32Array(this.points),t.bindBuffer(t.ARRAY_BUFFER,this.buffer),t.bufferData(t.ARRAY_BUFFER,this.glPoints,t.STATIC_DRAW),this.glIndicies=new e.Uint16Array(this.indices),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.glIndicies,t.STATIC_DRAW),this.dirty=!1},e.glContexts=[],e.instances=[],e.WebGLRenderer=function(t,i,r){if(r)for(var n in e.defaultRenderOptions)"undefined"==typeof r[n]&&(r[n]=e.defaultRenderOptions[n]);else r=e.defaultRenderOptions;e.defaultRenderer||(e.sayHello("webGL"),e.defaultRenderer=this),this.type=e.WEBGL_RENDERER,this.resolution=r.resolution,this.transparent=r.transparent,this.autoResize=r.autoResize||!1,this.preserveDrawingBuffer=r.preserveDrawingBuffer,this.clearBeforeRender=r.clearBeforeRender,this.width=t||800,this.height=i||600,this.view=r.view||document.createElement("canvas"),this.contextLostBound=this.handleContextLost.bind(this),this.contextRestoredBound=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLostBound,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredBound,!1),this._contextOptions={alpha:this.transparent,antialias:r.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:r.preserveDrawingBuffer},this.projection=new e.Point,this.offset=new e.Point(0,0),this.shaderManager=new e.WebGLShaderManager,this.spriteBatch=new e.WebGLSpriteBatch,this.maskManager=new e.WebGLMaskManager,this.filterManager=new e.WebGLFilterManager,this.stencilManager=new e.WebGLStencilManager,this.blendModeManager=new e.WebGLBlendModeManager,this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.blendModeManager=this.blendModeManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.stencilManager=this.stencilManager,this.renderSession.renderer=this,this.renderSession.resolution=this.resolution,this.initContext(),this.mapBlendModes()},e.WebGLRenderer.prototype.constructor=e.WebGLRenderer,e.WebGLRenderer.prototype.initContext=function(){var t=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=t,!t)throw new Error("This browser does not support webGL. Try using the canvas renderer");this.glContextId=t.id=e.WebGLRenderer.glContextId++,e.glContexts[this.glContextId]=t,e.instances[this.glContextId]=this,t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),this.shaderManager.setContext(t),this.spriteBatch.setContext(t),this.maskManager.setContext(t),this.filterManager.setContext(t),this.blendModeManager.setContext(t),this.stencilManager.setContext(t),this.renderSession.gl=this.gl,this.resize(this.width,this.height)},e.WebGLRenderer.prototype.render=function(t){if(!this.contextLost){this.__stage!==t&&(t.interactive&&t.interactionManager.removeEvents(),this.__stage=t),t.updateTransform();var e=this.gl;t._interactive?t._interactiveEventsAdded||(t._interactiveEventsAdded=!0,t.interactionManager.setTarget(this)):t._interactiveEventsAdded&&(t._interactiveEventsAdded=!1,t.interactionManager.setTarget(this)),e.viewport(0,0,this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,null),this.clearBeforeRender&&(this.transparent?e.clearColor(0,0,0,0):e.clearColor(t.backgroundColorSplit[0],t.backgroundColorSplit[1],t.backgroundColorSplit[2],1),e.clear(e.COLOR_BUFFER_BIT)),this.renderDisplayObject(t,this.projection)}},e.WebGLRenderer.prototype.renderDisplayObject=function(t,i,r){this.renderSession.blendModeManager.setBlendMode(e.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=r?-1:1,this.renderSession.projection=i,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,r),t._renderWebGL(this.renderSession),this.spriteBatch.end()},e.WebGLRenderer.prototype.resize=function(t,e){this.width=t*this.resolution,this.height=e*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px"),this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2/this.resolution,this.projection.y=-this.height/2/this.resolution},e.WebGLRenderer.prototype.updateTexture=function(t){if(t.hasLoaded){var i=this.gl;return t._glTextures[i.id]||(t._glTextures[i.id]=i.createTexture()),i.bindTexture(i.TEXTURE_2D,t._glTextures[i.id]),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultipliedAlpha),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t.source),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t.mipmap&&e.isPowerOfTwo(t.width,t.height)?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST),i.generateMipmap(i.TEXTURE_2D)):i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t._powerOf2?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)),t._dirty[i.id]=!1,t._glTextures[i.id]}},e.WebGLRenderer.prototype.handleContextLost=function(t){t.preventDefault(),this.contextLost=!0},e.WebGLRenderer.prototype.handleContextRestored=function(){this.initContext();for(var t in e.TextureCache){var i=e.TextureCache[t].baseTexture;i._glTextures=[]}this.contextLost=!1},e.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLostBound),this.view.removeEventListener("webglcontextrestored",this.contextRestoredBound),e.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},e.WebGLRenderer.prototype.mapBlendModes=function(){var t=this.gl;e.blendModesWebGL||(e.blendModesWebGL=[],e.blendModesWebGL[e.blendModes.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.ADD]=[t.SRC_ALPHA,t.DST_ALPHA],e.blendModesWebGL[e.blendModes.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SCREEN]=[t.SRC_ALPHA,t.ONE],e.blendModesWebGL[e.blendModes.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA])},e.WebGLRenderer.glContextId=0,e.WebGLBlendModeManager=function(){this.currentBlendMode=99999},e.WebGLBlendModeManager.prototype.constructor=e.WebGLBlendModeManager,e.WebGLBlendModeManager.prototype.setContext=function(t){this.gl=t},e.WebGLBlendModeManager.prototype.setBlendMode=function(t){if(this.currentBlendMode===t)return!1;this.currentBlendMode=t;var i=e.blendModesWebGL[this.currentBlendMode];return this.gl.blendFunc(i[0],i[1]),!0},e.WebGLBlendModeManager.prototype.destroy=function(){this.gl=null},e.WebGLMaskManager=function(){},e.WebGLMaskManager.prototype.constructor=e.WebGLMaskManager,e.WebGLMaskManager.prototype.setContext=function(t){this.gl=t},e.WebGLMaskManager.prototype.pushMask=function(t,i){var r=i.gl;t.dirty&&e.WebGLGraphics.updateGraphics(t,r),t._webGL[r.id].data.length&&i.stencilManager.pushStencil(t,t._webGL[r.id].data[0],i)},e.WebGLMaskManager.prototype.popMask=function(t,e){var i=this.gl;e.stencilManager.popStencil(t,t._webGL[i.id].data[0],e)},e.WebGLMaskManager.prototype.destroy=function(){this.gl=null},e.WebGLStencilManager=function(){this.stencilStack=[],this.reverse=!0,this.count=0},e.WebGLStencilManager.prototype.setContext=function(t){this.gl=t},e.WebGLStencilManager.prototype.pushStencil=function(t,e,i){var r=this.gl;this.bindGraphics(t,e,i),0===this.stencilStack.length&&(r.enable(r.STENCIL_TEST),r.clear(r.STENCIL_BUFFER_BIT),this.reverse=!0,this.count=0),this.stencilStack.push(e);var n=this.count;r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),1===e.mode?(r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),this.reverse?r.stencilFunc(r.EQUAL,255-(n+1),255):r.stencilFunc(r.EQUAL,n+1,255),this.reverse=!this.reverse):(this.reverse?(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n+1,255):r.stencilFunc(r.EQUAL,255-(n+1),255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),this.count++},e.WebGLStencilManager.prototype.bindGraphics=function(t,i,r){this._currentGraphics=t;var n,o=this.gl,s=r.projection,a=r.offset;1===i.mode?(n=r.shaderManager.complexPrimitiveShader,r.shaderManager.setShader(n),o.uniform1f(n.flipY,r.flipY),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform3fv(n.color,i.color),o.uniform1f(n.alpha,t.worldAlpha*i.alpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,8,0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer)):(n=r.shaderManager.primitiveShader,r.shaderManager.setShader(n),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform1f(n.flipY,r.flipY),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform1f(n.alpha,t.worldAlpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,24,0),o.vertexAttribPointer(n.colorAttribute,4,o.FLOAT,!1,24,8),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer))},e.WebGLStencilManager.prototype.popStencil=function(t,e,i){var r=this.gl;if(this.stencilStack.pop(),this.count--,0===this.stencilStack.length)r.disable(r.STENCIL_TEST);else{var n=this.count;this.bindGraphics(t,e,i),r.colorMask(!1,!1,!1,!1),1===e.mode?(this.reverse=!this.reverse,this.reverse?(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)):(this.reverse?(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)}},e.WebGLStencilManager.prototype.destroy=function(){this.stencilStack=null,this.gl=null},e.WebGLShaderManager=function(){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var t=0;tr;r+=6,n+=4)this.indices[r+0]=n+0,this.indices[r+1]=n+1,this.indices[r+2]=n+2,this.indices[r+3]=n+0,this.indices[r+4]=n+2,this.indices[r+5]=n+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.dirty=!0,this.textures=[],this.blendModes=[],this.shaders=[],this.sprites=[],this.defaultShader=new e.AbstractFilter(["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"])},e.WebGLSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW),this.currentBlendMode=99999;var i=new e.PixiShader(t);i.fragmentSrc=this.defaultShader.fragmentSrc,i.uniforms={},i.init(),this.defaultShader.shaders[t.id]=i},e.WebGLSpriteBatch.prototype.begin=function(t){this.renderSession=t,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},e.WebGLSpriteBatch.prototype.end=function(){this.flush()},e.WebGLSpriteBatch.prototype.render=function(t){var e=t.texture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture);var i=e._uvs;if(i){var r,n,o,s,a=t.anchor.x,h=t.anchor.y;if(e.trim){var l=e.trim;n=l.x-a*l.width,r=n+e.crop.width,s=l.y-h*l.height,o=s+e.crop.height}else r=e.frame.width*(1-a),n=e.frame.width*-a,o=e.frame.height*(1-h),s=e.frame.height*-h;var u=4*this.currentBatchSize*this.vertSize,c=e.baseTexture.resolution,d=t.worldTransform,p=d.a/c,f=d.b/c,g=d.c/c,m=d.d/c,v=d.tx,y=d.ty,x=this.colors,b=this.positions;this.renderSession.roundPixels?(b[u]=p*n+g*s+v|0,b[u+1]=m*s+f*n+y|0,b[u+5]=p*r+g*s+v|0,b[u+6]=m*s+f*r+y|0,b[u+10]=p*r+g*o+v|0,b[u+11]=m*o+f*r+y|0,b[u+15]=p*n+g*o+v|0,b[u+16]=m*o+f*n+y|0):(b[u]=p*n+g*s+v,b[u+1]=m*s+f*n+y,b[u+5]=p*r+g*s+v,b[u+6]=m*s+f*r+y,b[u+10]=p*r+g*o+v,b[u+11]=m*o+f*r+y,b[u+15]=p*n+g*o+v,b[u+16]=m*o+f*n+y),b[u+2]=i.x0,b[u+3]=i.y0,b[u+7]=i.x1,b[u+8]=i.y1,b[u+12]=i.x2,b[u+13]=i.y2,b[u+17]=i.x3,b[u+18]=i.y3;var w=t.tint;x[u+4]=x[u+9]=x[u+14]=x[u+19]=(w>>16)+(65280&w)+((255&w)<<16)+(255*t.worldAlpha<<24),this.sprites[this.currentBatchSize++]=t}},e.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var i=t.tilingTexture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=i.baseTexture),t._uvs||(t._uvs=new e.TextureUvs);var r=t._uvs;t.tilePosition.x%=i.baseTexture.width*t.tileScaleOffset.x,t.tilePosition.y%=i.baseTexture.height*t.tileScaleOffset.y;var n=t.tilePosition.x/(i.baseTexture.width*t.tileScaleOffset.x),o=t.tilePosition.y/(i.baseTexture.height*t.tileScaleOffset.y),s=t.width/i.baseTexture.width/(t.tileScale.x*t.tileScaleOffset.x),a=t.height/i.baseTexture.height/(t.tileScale.y*t.tileScaleOffset.y);r.x0=0-n,r.y0=0-o,r.x1=1*s-n,r.y1=0-o,r.x2=1*s-n,r.y2=1*a-o,r.x3=0-n,r.y3=1*a-o;var h=t.tint,l=(h>>16)+(65280&h)+((255&h)<<16)+(255*t.alpha<<24),u=this.positions,c=this.colors,d=t.width,p=t.height,f=t.anchor.x,g=t.anchor.y,m=d*(1-f),v=d*-f,y=p*(1-g),x=p*-g,b=4*this.currentBatchSize*this.vertSize,w=i.baseTexture.resolution,T=t.worldTransform,S=T.a/w,C=T.b/w,E=T.c/w,A=T.d/w,_=T.tx,M=T.ty;u[b++]=S*v+E*x+_,u[b++]=A*x+C*v+M,u[b++]=r.x0,u[b++]=r.y0,c[b++]=l,u[b++]=S*m+E*x+_,u[b++]=A*x+C*m+M,u[b++]=r.x1,u[b++]=r.y1,c[b++]=l,u[b++]=S*m+E*y+_,u[b++]=A*y+C*m+M,u[b++]=r.x2,u[b++]=r.y2,c[b++]=l,u[b++]=S*v+E*y+_,u[b++]=A*y+C*v+M,u[b++]=r.x3,u[b++]=r.y3,c[b++]=l,this.sprites[this.currentBatchSize++]=t},e.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,i=this.gl;if(this.dirty){this.dirty=!1,i.activeTexture(i.TEXTURE0),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t=this.defaultShader.shaders[i.id];var r=4*this.vertSize;i.vertexAttribPointer(t.aVertexPosition,2,i.FLOAT,!1,r,0),i.vertexAttribPointer(t.aTextureCoord,2,i.FLOAT,!1,r,8),i.vertexAttribPointer(t.colorAttribute,4,i.UNSIGNED_BYTE,!0,r,16)}if(this.currentBatchSize>.5*this.size)i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices);else{var n=this.positions.subarray(0,4*this.currentBatchSize*this.vertSize);i.bufferSubData(i.ARRAY_BUFFER,0,n)}for(var o,s,a,h,l=0,u=0,c=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,v=this.currentBatchSize;v>m;m++){if(h=this.sprites[m],o=h.texture.baseTexture,s=h.blendMode,a=h.shader||this.defaultShader,f=d!==s,g=p!==a,(c!==o||f||g)&&(this.renderBatch(c,l,u),u=m,l=0,c=o,f&&(d=s,this.renderSession.blendModeManager.setBlendMode(d)),g)){p=a,t=p.shaders[i.id],t||(t=new e.PixiShader(i),t.fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[i.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms(); -var y=this.renderSession.projection;i.uniform2f(t.projectionVector,y.x,y.y);var x=this.renderSession.offset;i.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(c,l,u),this.currentBatchSize=0}},e.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var r=this.gl;t._dirty[r.id]?this.renderSession.renderer.updateTexture(t):r.bindTexture(r.TEXTURE_2D,t._glTextures[r.id]),r.drawElements(r.TRIANGLES,6*e,r.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},e.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},e.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},e.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},e.WebGLFastSpriteBatch=function(t){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var i=4*this.size*this.vertSize,r=6*this.maxSize;this.vertices=new e.Float32Array(i),this.indices=new e.Uint16Array(r),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,o=0;r>n;n+=6,o+=4)this.indices[n+0]=o+0,this.indices[n+1]=o+1,this.indices[n+2]=o+2,this.indices[n+3]=o+0,this.indices[n+4]=o+2,this.indices[n+5]=o+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(t)},e.WebGLFastSpriteBatch.prototype.constructor=e.WebGLFastSpriteBatch,e.WebGLFastSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW)},e.WebGLFastSpriteBatch.prototype.begin=function(t,e){this.renderSession=e,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=t.worldTransform.toArray(!0),this.start()},e.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.render=function(t){var e=t.children,i=e[0];if(i.texture._uvs){this.currentBaseTexture=i.texture.baseTexture,i.blendMode!==this.renderSession.blendModeManager.currentBlendMode&&(this.flush(),this.renderSession.blendModeManager.setBlendMode(i.blendMode));for(var r=0,n=e.length;n>r;r++)this.renderSprite(e[r]);this.flush()}},e.WebGLFastSpriteBatch.prototype.renderSprite=function(t){if(t.visible&&(t.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=t.texture.baseTexture,t.texture._uvs))){var e,i,r,n,o,s,a,h,l=this.vertices;if(e=t.texture._uvs,i=t.texture.frame.width,r=t.texture.frame.height,t.texture.trim){var u=t.texture.trim;o=u.x-t.anchor.x*u.width,n=o+t.texture.crop.width,a=u.y-t.anchor.y*u.height,s=a+t.texture.crop.height}else n=t.texture.frame.width*(1-t.anchor.x),o=t.texture.frame.width*-t.anchor.x,s=t.texture.frame.height*(1-t.anchor.y),a=t.texture.frame.height*-t.anchor.y;h=4*this.currentBatchSize*this.vertSize,l[h++]=o,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x0,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x1,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x2,l[h++]=e.y2,l[h++]=t.alpha,l[h++]=o,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x3,l[h++]=e.y3,l[h++]=t.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},e.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]||this.renderSession.renderer.updateTexture(this.currentBaseTexture,t),t.bindTexture(t.TEXTURE_2D,this.currentBaseTexture._glTextures[t.id]),this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},e.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36)},e.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},e.WebGLFilterManager.prototype.constructor=e.WebGLFilterManager,e.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},e.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},e.WebGLFilterManager.prototype.pushFilter=function(t){var i=this.gl,r=this.renderSession.projection,n=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),this.filterStack.push(t);var o=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var s=this.texturePool.pop();s?s.resize(this.width,this.height):s=new e.FilterTexture(this.gl,this.width,this.height),i.bindTexture(i.TEXTURE_2D,s.texture);var a=t._filterArea,h=o.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),i.bindFramebuffer(i.FRAMEBUFFER,s.frameBuffer),i.viewport(0,0,a.width,a.height),r.x=a.width/2,r.y=-a.height/2,n.x=-a.x,n.y=-a.y,i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),t._glFilterTexture=s},e.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,i=this.filterStack.pop(),r=i._filterArea,n=i._glFilterTexture,o=this.renderSession.projection,s=this.renderSession.offset;if(i.filterPasses.length>1){t.viewport(0,0,r.width,r.height),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=r.height,this.vertexArray[2]=r.width,this.vertexArray[3]=r.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=r.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=r.width/this.width,this.uvArray[5]=r.height/this.height,this.uvArray[6]=r.width/this.width,this.uvArray[7]=r.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=n,h=this.texturePool.pop();h||(h=new e.FilterTexture(this.gl,this.width,this.height)),h.resize(this.width,this.height),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l_?_:A,i.beginPath(),i.moveTo(T,S+A),i.lineTo(T,S+E-A),i.quadraticCurveTo(T,S+E,T+A,S+E),i.lineTo(T+C-A,S+E),i.quadraticCurveTo(T+C,S+E,T+C,S+E-A),i.lineTo(T+C,S+A),i.quadraticCurveTo(T+C,S,T+C-A,S),i.lineTo(T+A,S),i.quadraticCurveTo(T,S,T,S+A),i.closePath(),(o.fillColor||0===o.fillColor)&&(i.globalAlpha=o.fillAlpha*r,i.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),i.fill()),o.lineWidth&&(i.globalAlpha=o.lineAlpha*r,i.strokeStyle="#"+("00000"+(0|h).toString(16)).substr(-6),i.stroke())}}},e.CanvasGraphics.renderGraphicsMask=function(t,i){var r=t.graphicsData.length;if(0!==r){r>1&&(r=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var n=0;1>n;n++){var o=t.graphicsData[n],s=o.shape;if(o.type===e.Graphics.POLY){i.beginPath();var a=s.points;i.moveTo(a[0],a[1]);for(var h=1;hA?A:E,i.beginPath(),i.moveTo(w,T+E),i.lineTo(w,T+C-E),i.quadraticCurveTo(w,T+C,w+E,T+C),i.lineTo(w+S-E,T+C),i.quadraticCurveTo(w+S,T+C,w+S,T+C-E),i.lineTo(w+S,T+E),i.quadraticCurveTo(w+S,T,w+S-E,T),i.lineTo(w+E,T),i.quadraticCurveTo(w,T,w,T+E),i.closePath()}}}},e.CanvasGraphics.updateGraphicsTint=function(t){if(16777215!==t.tint)for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,r=(255&t.tint)/255,n=0;n>16&255)/255*e*255<<16)+((s>>8&255)/255*i*255<<8)+(255&s)/255*r*255,o._lineTint=((a>>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*r*255}},e.Graphics=function(){e.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new e.Rectangle(0,0,1,1),this.dirty=!0,this.webGLDirty=!1,this.cachedSpriteDirty=!1},e.Graphics.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Graphics.prototype.constructor=e.Graphics,Object.defineProperty(e.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(t){this._cacheAsBitmap=t,this._cacheAsBitmap?this._generateCachedSprite():(this.destroyCachedSprite(),this.dirty=!0)}}),e.Graphics.prototype.lineStyle=function(t,i,r){if(this.lineWidth=t||0,this.lineColor=i||0,this.lineAlpha=arguments.length<3?1:r,this.currentPath){if(this.currentPath.shape.points.length)return this.drawShape(new e.Polygon(this.currentPath.shape.points.slice(-2))),this;this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha}return this},e.Graphics.prototype.moveTo=function(t,i){return this.drawShape(new e.Polygon([t,i])),this},e.Graphics.prototype.lineTo=function(t,e){return this.currentPath.shape.points.push(t,e),this.dirty=!0,this},e.Graphics.prototype.quadraticCurveTo=function(t,e,i,r){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var n,o,s=20,a=this.currentPath.shape.points;0===a.length&&this.moveTo(0,0);for(var h=a[a.length-2],l=a[a.length-1],u=0,c=1;s>=c;c++)u=c/s,n=h+(t-h)*u,o=l+(e-l)*u,a.push(n+(t+(i-t)*u-n)*u,o+(e+(r-e)*u-o)*u);return this.dirty=!0,this},e.Graphics.prototype.bezierCurveTo=function(t,e,i,r,n,o){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var s,a,h,l,u,c=20,d=this.currentPath.shape.points,p=d[d.length-2],f=d[d.length-1],g=0,m=1;c>=m;m++)g=m/c,s=1-g,a=s*s,h=a*s,l=g*g,u=l*g,d.push(h*p+3*a*g*t+3*s*l*i+u*n,h*f+3*a*g*e+3*s*l*r+u*o);return this.dirty=!0,this},e.Graphics.prototype.arcTo=function(t,e,i,r,n){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(t,e):this.moveTo(t,e);var o=this.currentPath.shape.points,s=o[o.length-2],a=o[o.length-1],h=a-e,l=s-t,u=r-e,c=i-t,d=Math.abs(h*c-l*u);if(1e-8>d||0===n)(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e);else{var p=h*h+l*l,f=u*u+c*c,g=h*u+l*c,m=n*Math.sqrt(p)/d,v=n*Math.sqrt(f)/d,y=m*g/p,x=v*g/f,b=m*c+v*l,w=m*u+v*h,T=l*(v+y),S=h*(v+y),C=c*(m+x),E=u*(m+x),A=Math.atan2(S-w,T-b),_=Math.atan2(E-w,C-b);this.arc(b+t,w+e,n,A,_,l*u>c*h)}return this.dirty=!0,this},e.Graphics.prototype.arc=function(t,e,i,r,n,o){var s,a=t+Math.cos(r)*i,h=e+Math.sin(r)*i;if(this.currentPath?(s=this.currentPath.shape.points,0===s.length?s.push(a,h):(s[s.length-2]!==a||s[s.length-1]!==h)&&s.push(a,h)):(this.moveTo(a,h),s=this.currentPath.shape.points),r===n)return this;!o&&r>=n?n+=2*Math.PI:o&&n>=r&&(r+=2*Math.PI);var l=o?-1*(r-n):n-r,u=Math.abs(l)/(2*Math.PI)*40;if(0===l)return this;for(var c=l/(2*u),d=2*c,p=Math.cos(c),f=Math.sin(c),g=u-1,m=g%1/g,v=0;g>=v;v++){var y=v+m*v,x=c+r+d*y,b=Math.cos(x),w=-Math.sin(x);s.push((p*b+f*w)*i+t,(p*-w+f*b)*i+e)}return this.dirty=!0,this},e.Graphics.prototype.beginFill=function(t,e){return this.filling=!0,this.fillColor=t||0,this.fillAlpha=void 0===e?1:e,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},e.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},e.Graphics.prototype.drawRect=function(t,i,r,n){return this.drawShape(new e.Rectangle(t,i,r,n)),this},e.Graphics.prototype.drawRoundedRect=function(t,i,r,n,o){return this.drawShape(new e.RoundedRectangle(t,i,r,n,o)),this},e.Graphics.prototype.drawCircle=function(t,i,r){return this.drawShape(new e.Circle(t,i,r)),this},e.Graphics.prototype.drawEllipse=function(t,i,r,n){return this.drawShape(new e.Ellipse(t,i,r,n)),this},e.Graphics.prototype.drawPolygon=function(t){return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.drawShape(new e.Polygon(t)),this},e.Graphics.prototype.clear=function(){return this.lineWidth=0,this.filling=!1,this.dirty=!0,this.clearDirty=!0,this.graphicsData=[],this},e.Graphics.prototype.generateTexture=function(t,i){t=t||1;var r=this.getBounds(),n=new e.CanvasBuffer(r.width*t,r.height*t),o=e.Texture.fromCanvas(n.canvas,i);return o.baseTexture.resolution=t,n.context.scale(t,t),n.context.translate(-r.x,-r.y),e.CanvasGraphics.renderGraphics(this,n.context),o},e.Graphics.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.worldAlpha=this.worldAlpha,void e.Sprite.prototype._renderWebGL.call(this._cachedSprite,t);if(t.spriteBatch.stop(),t.blendModeManager.setBlendMode(this.blendMode),this._mask&&t.maskManager.pushMask(this._mask,t),this._filters&&t.filterManager.pushFilter(this._filterBlock),this.blendMode!==t.spriteBatch.currentBlendMode){t.spriteBatch.currentBlendMode=this.blendMode;var i=e.blendModesWebGL[t.spriteBatch.currentBlendMode];t.spriteBatch.gl.blendFunc(i[0],i[1])}if(this.webGLDirty&&(this.dirty=!0,this.webGLDirty=!1),e.WebGLGraphics.renderGraphics(this,t),this.children.length){t.spriteBatch.start();for(var r=0,n=this.children.length;n>r;r++)this.children[r]._renderWebGL(t);t.spriteBatch.stop()}this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this.mask,t),t.drawCount++,t.spriteBatch.start()}},e.Graphics.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.alpha=this.alpha,void e.Sprite.prototype._renderCanvas.call(this._cachedSprite,t);var i=t.context,r=this.worldTransform;this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t);var n=t.resolution;i.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n,r.ty*n),e.CanvasGraphics.renderGraphics(this,i);for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Graphics.prototype.getBounds=function(t){if(this.isMask)return e.EmptyRectangle;this.dirty&&(this.updateLocalBounds(),this.webGLDirty=!0,this.cachedSpriteDirty=!0,this.dirty=!1);var i=this._localBounds,r=i.x,n=i.width+i.x,o=i.y,s=i.height+i.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=h*n+u*s+d,g=c*s+l*n+p,m=h*r+u*s+d,v=c*s+l*r+p,y=h*r+u*o+d,x=c*o+l*r+p,b=h*n+u*o+d,w=c*o+l*n+p,T=f,S=g,C=f,E=g;return C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,E=E>v?v:E,E=E>x?x:E,E=E>w?w:E,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T,S=v>S?v:S,S=x>S?x:S,S=w>S?w:S,this._bounds.x=C,this._bounds.width=T-C,this._bounds.y=E,this._bounds.height=S-E,this._bounds -},e.Graphics.prototype.updateLocalBounds=function(){var t=1/0,i=-1/0,r=1/0,n=-1/0;if(this.graphicsData.length)for(var o,s,a,h,l,u,c=0;ca?a:t,i=a+l>i?a+l:i,r=r>h?h:r,n=h+u>n?h+u:n;else if(p===e.Graphics.CIRC)a=o.x,h=o.y,l=o.radius+f/2,u=o.radius+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else if(p===e.Graphics.ELIP)a=o.x,h=o.y,l=o.width+f/2,u=o.height+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else{s=o.points;for(var g=0;ga-f?a-f:t,i=a+f>i?a+f:i,r=r>h-f?h-f:r,n=h+f>n?h+f:n}}else t=0,i=0,r=0,n=0;var m=this.boundsPadding;this._localBounds.x=t-m,this._localBounds.width=i-t+2*m,this._localBounds.y=r-m,this._localBounds.height=n-r+2*m},e.Graphics.prototype._generateCachedSprite=function(){var t=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(t.width,t.height);else{var i=new e.CanvasBuffer(t.width,t.height),r=e.Texture.fromCanvas(i.canvas);this._cachedSprite=new e.Sprite(r),this._cachedSprite.buffer=i,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(t.x/t.width),this._cachedSprite.anchor.y=-(t.y/t.height),this._cachedSprite.buffer.context.translate(-t.x,-t.y),this.worldAlpha=1,e.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},e.Graphics.prototype.updateCachedSpriteTexture=function(){var t=this._cachedSprite,e=t.texture,i=t.buffer.canvas;e.baseTexture.width=i.width,e.baseTexture.height=i.height,e.crop.width=e.frame.width=i.width,e.crop.height=e.frame.height=i.height,t._width=i.width,t._height=i.height,e.baseTexture.dirty()},e.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},e.Graphics.prototype.drawShape=function(t){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null;var i=new e.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,t);return this.graphicsData.push(i),i.type===e.Graphics.POLY&&(i.shape.closed=this.filling,this.currentPath=i),this.dirty=!0,i},e.GraphicsData=function(t,e,i,r,n,o,s){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this._lineTint=e,this.fillColor=r,this.fillAlpha=n,this._fillTint=r,this.fill=o,this.shape=s,this.type=s.type},e.Graphics.POLY=0,e.Graphics.RECT=1,e.Graphics.CIRC=2,e.Graphics.ELIP=3,e.Graphics.RREC=4,e.Polygon.prototype.type=e.Graphics.POLY,e.Rectangle.prototype.type=e.Graphics.RECT,e.Circle.prototype.type=e.Graphics.CIRC,e.Ellipse.prototype.type=e.Graphics.ELIP,e.RoundedRectangle.prototype.type=e.Graphics.RREC,e.Strip=function(t){e.DisplayObjectContainer.call(this),this.texture=t,this.uvs=new e.Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new e.Float32Array([0,0,100,0,100,100,0,100]),this.colors=new e.Float32Array([1,1,1,1]),this.indices=new e.Uint16Array([0,1,2,3]),this.dirty=!0,this.blendMode=e.blendModes.NORMAL,this.canvasPadding=0,this.drawMode=e.Strip.DrawModes.TRIANGLE_STRIP},e.Strip.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Strip.prototype.constructor=e.Strip,e.Strip.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||(t.spriteBatch.stop(),this._vertexBuffer||this._initWebGL(t),t.shaderManager.setShader(t.shaderManager.stripShader),this._renderStrip(t),t.spriteBatch.start())},e.Strip.prototype._initWebGL=function(t){var e=t.gl;this._vertexBuffer=e.createBuffer(),this._indexBuffer=e.createBuffer(),this._uvBuffer=e.createBuffer(),this._colorBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices,e.DYNAMIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._uvBuffer),e.bufferData(e.ARRAY_BUFFER,this.uvs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colors,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW)},e.Strip.prototype._renderStrip=function(t){var i=t.gl,r=t.projection,n=t.offset,o=t.shaderManager.stripShader,s=this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?i.TRIANGLE_STRIP:i.TRIANGLES;t.blendModeManager.setBlendMode(this.blendMode),i.uniformMatrix3fv(o.translationMatrix,!1,this.worldTransform.toArray(!0)),i.uniform2f(o.projectionVector,r.x,-r.y),i.uniform2f(o.offsetVector,-n.x,-n.y),i.uniform1f(o.alpha,this.worldAlpha),this.dirty?(this.dirty=!1,i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertices,i.STATIC_DRAW),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.bufferData(i.ARRAY_BUFFER,this.uvs,i.STATIC_DRAW),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,this.indices,i.STATIC_DRAW)):(i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer)),i.drawElements(s,this.indices.length,i.UNSIGNED_SHORT,0)},e.Strip.prototype._renderCanvas=function(t){var i=t.context,r=this.worldTransform;t.roundPixels?i.setTransform(r.a,r.b,r.c,r.d,0|r.tx,0|r.ty):i.setTransform(r.a,r.b,r.c,r.d,r.tx,r.ty),this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?this._renderCanvasTriangleStrip(i):this._renderCanvasTriangles(i)},e.Strip.prototype._renderCanvasTriangleStrip=function(t){var e=this.vertices,i=this.uvs,r=e.length/2;this.count++;for(var n=0;r-2>n;n++){var o=2*n;this._renderCanvasDrawTriangle(t,e,i,o,o+2,o+4)}},e.Strip.prototype._renderCanvasTriangles=function(t){var e=this.vertices,i=this.uvs,r=this.indices,n=r.length;this.count++;for(var o=0;n>o;o+=3){var s=2*r[o],a=2*r[o+1],h=2*r[o+2];this._renderCanvasDrawTriangle(t,e,i,s,a,h)}},e.Strip.prototype._renderCanvasDrawTriangle=function(t,e,i,r,n,o){var s=this.texture.baseTexture.source,a=this.texture.width,h=this.texture.height,l=e[r],u=e[n],c=e[o],d=e[r+1],p=e[n+1],f=e[o+1],g=i[r]*a,m=i[n]*a,v=i[o]*a,y=i[r+1]*h,x=i[n+1]*h,b=i[o+1]*h;if(this.canvasPadding>0){var w=this.canvasPadding/this.worldTransform.a,T=this.canvasPadding/this.worldTransform.d,S=(l+u+c)/3,C=(d+p+f)/3,E=l-S,A=d-C,_=Math.sqrt(E*E+A*A);l=S+E/_*(_+w),d=C+A/_*(_+T),E=u-S,A=p-C,_=Math.sqrt(E*E+A*A),u=S+E/_*(_+w),p=C+A/_*(_+T),E=c-S,A=f-C,_=Math.sqrt(E*E+A*A),c=S+E/_*(_+w),f=C+A/_*(_+T)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(u,p),t.lineTo(c,f),t.closePath(),t.clip();var M=g*x+y*v+m*b-x*v-y*m-g*b,L=l*x+y*c+u*b-x*c-y*u-l*b,R=g*u+l*v+m*c-u*v-l*m-g*c,P=g*x*c+y*u*v+l*m*b-l*x*v-y*m*c-g*u*b,F=d*x+y*f+p*b-x*f-y*p-d*b,B=g*p+d*v+m*f-p*v-d*m-g*f,I=g*x*f+y*p*v+d*m*b-d*x*v-y*m*f-g*p*b;t.transform(L/M,F/M,R/M,B/M,P/M,I/M),t.drawImage(s,0,0),t.restore()},e.Strip.prototype.renderStripFlat=function(t){var e=this.context,i=t.vertices,r=i.length/2;this.count++,e.beginPath();for(var n=1;r-2>n;n++){var o=2*n,s=i[o],a=i[o+2],h=i[o+4],l=i[o+1],u=i[o+3],c=i[o+5];e.moveTo(s,l),e.lineTo(a,u),e.lineTo(h,c)}e.fillStyle="#FF0000",e.fill(),e.closePath()},e.Strip.prototype.onTextureUpdate=function(){this.updateFrame=!0},e.Strip.prototype.getBounds=function(t){for(var i=t||this.worldTransform,r=i.a,n=i.b,o=i.c,s=i.d,a=i.tx,h=i.ty,l=-1/0,u=-1/0,c=1/0,d=1/0,p=this.vertices,f=0,g=p.length;g>f;f+=2){var m=p[f],v=p[f+1],y=r*m+o*v+a,x=s*v+n*m+h;c=c>y?y:c,d=d>x?x:d,l=y>l?y:l,u=x>u?x:u}if(c===-1/0||1/0===u)return e.EmptyRectangle;var b=this._bounds;return b.x=c,b.width=l-c,b.y=d,b.height=u-d,this._currentBounds=b,b},e.Strip.DrawModes={TRIANGLE_STRIP:0,TRIANGLES:1},e.Rope=function(t,i){e.Strip.call(this,t),this.points=i,this.vertices=new e.Float32Array(4*i.length),this.uvs=new e.Float32Array(4*i.length),this.colors=new e.Float32Array(2*i.length),this.indices=new e.Uint16Array(2*i.length),this.refresh()},e.Rope.prototype=Object.create(e.Strip.prototype),e.Rope.prototype.constructor=e.Rope,e.Rope.prototype.refresh=function(){var t=this.points;if(!(t.length<1)){var e=this.uvs,i=t[0],r=this.indices,n=this.colors;this.count-=.2,e[0]=0,e[1]=0,e[2]=0,e[3]=1,n[0]=1,n[1]=1,r[0]=0,r[1]=1;for(var o,s,a,h=t.length,l=1;h>l;l++)o=t[l],s=4*l,a=l/(h-1),l%2?(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1):(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1),s=2*l,n[s]=1,n[s+1]=1,s=2*l,r[s]=s,r[s+1]=s+1,i=o}},e.Rope.prototype.updateTransform=function(){var t=this.points;if(!(t.length<1)){var i,r=t[0],n={x:0,y:0};this.count-=.2;for(var o,s,a,h,l,u=this.vertices,c=t.length,d=0;c>d;d++)o=t[d],s=4*d,i=d1&&(a=1),h=Math.sqrt(n.x*n.x+n.y*n.y),l=this.texture.height/2,n.x/=h,n.y/=h,n.x*=l,n.y*=l,u[s]=o.x+n.x,u[s+1]=o.y+n.y,u[s+2]=o.x-n.x,u[s+3]=o.y-n.y,r=o;e.DisplayObjectContainer.prototype.updateTransform.call(this)}},e.Rope.prototype.setTexture=function(t){this.texture=t},e.TilingSprite=function(t,i,r){e.Sprite.call(this,t),this._width=i||100,this._height=r||100,this.tileScale=new e.Point(1,1),this.tileScaleOffset=new e.Point(1,1),this.tilePosition=new e.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL},e.TilingSprite.prototype=Object.create(e.Sprite.prototype),e.TilingSprite.prototype.constructor=e.TilingSprite,Object.defineProperty(e.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(e.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),e.TilingSprite.prototype.setTexture=function(t){this.texture!==t&&(this.texture=t,this.refreshTexture=!0,this.cachedTint=16777215)},e.TilingSprite.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha){var e,i;for(this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(t.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)):t.spriteBatch.renderTilingSprite(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this._mask,t),t.spriteBatch.start()}},e.TilingSprite.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){var i=t.context;this._mask&&t.maskManager.pushMask(this._mask,t),i.globalAlpha=this.worldAlpha;var r,n,o=this.worldTransform,s=t.resolution;if(i.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*s,o.ty*s),!this.__tilePattern||this.refreshTexture){if(this.generateTilingTexture(!1),!this.tilingTexture)return;this.__tilePattern=i.createPattern(this.tilingTexture.baseTexture.source,"repeat")}this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]);var a=this.tilePosition,h=this.tileScale;for(a.x%=this.tilingTexture.baseTexture.width,a.y%=this.tilingTexture.baseTexture.height,i.scale(h.x,h.y),i.translate(a.x+this.anchor.x*-this._width,a.y+this.anchor.y*-this._height),i.fillStyle=this.__tilePattern,i.fillRect(-a.x,-a.y,this._width/h.x,this._height/h.y),i.scale(1/h.x,1/h.y),i.translate(-a.x+this.anchor.x*this._width,-a.y+this.anchor.y*this._height),this._mask&&t.maskManager.popMask(t),r=0,n=this.children.length;n>r;r++)this.children[r]._renderCanvas(t)}},e.TilingSprite.prototype.getBounds=function(){var t=this._width,e=this._height,i=t*(1-this.anchor.x),r=t*-this.anchor.x,n=e*(1-this.anchor.y),o=e*-this.anchor.y,s=this.worldTransform,a=s.a,h=s.b,l=s.c,u=s.d,c=s.tx,d=s.ty,p=a*r+l*o+c,f=u*o+h*r+d,g=a*i+l*o+c,m=u*o+h*i+d,v=a*i+l*n+c,y=u*n+h*i+d,x=a*r+l*n+c,b=u*n+h*r+d,w=-1/0,T=-1/0,S=1/0,C=1/0;S=S>p?p:S,S=S>g?g:S,S=S>v?v:S,S=S>x?x:S,C=C>f?f:C,C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,w=p>w?p:w,w=g>w?g:w,w=v>w?v:w,w=x>w?x:w,T=f>T?f:T,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T;var E=this._bounds;return E.x=S,E.width=w-S,E.y=C,E.height=T-C,this._currentBounds=E,E},e.TilingSprite.prototype.onTextureUpdate=function(){},e.TilingSprite.prototype.generateTilingTexture=function(t){if(this.texture.baseTexture.hasLoaded){var i,r,n=this.originalTexture||this.texture,o=n.frame,s=o.width!==n.baseTexture.width||o.height!==n.baseTexture.height,a=!1;if(t?(i=e.getNextPowerOfTwo(o.width),r=e.getNextPowerOfTwo(o.height),(o.width!==i||o.height!==r||n.baseTexture.width!==i||n.baseTexture.height||r)&&(a=!0)):s&&(n.trim?(i=n.trim.width,r=n.trim.height):(i=o.width,r=o.height),a=!0),a){var h;this.tilingTexture&&this.tilingTexture.isTiling?(h=this.tilingTexture.canvasBuffer,h.resize(i,r),this.tilingTexture.baseTexture.width=i,this.tilingTexture.baseTexture.height=r,this.tilingTexture.needsUpdate=!0):(h=new e.CanvasBuffer(i,r),this.tilingTexture=e.Texture.fromCanvas(h.canvas),this.tilingTexture.canvasBuffer=h,this.tilingTexture.isTiling=!0),h.context.drawImage(n.baseTexture.source,n.crop.x,n.crop.y,n.crop.width,n.crop.height,0,0,i,r),this.tileScaleOffset.x=o.width/i,this.tileScaleOffset.y=o.height/r}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=n;this.refreshTexture=!1,this.originalTexture=this.texture,this.texture=this.tilingTexture,this.tilingTexture.baseTexture._powerOf2=!0}},e.TilingSprite.prototype.destroy=function(){e.Sprite.prototype.destroy.call(this),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture.destroy(!0),this.tilingTexture=null};var i={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};i.BoneData=function(t,e){this.name=t,this.parent=e},i.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},i.SlotData=function(t,e){this.name=t,this.boneData=e},i.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},i.IkConstraintData=function(t){this.name=t,this.bones=[]},i.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},i.Bone=function(t,e,i){this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()},i.Bone.yDown=!1,i.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var t=this.parent;if(t)this.worldX=this.x*t.m00+this.y*t.m01+t.worldX,this.worldY=this.x*t.m10+this.y*t.m11+t.worldY,this.data.inheritScale?(this.worldScaleX=t.worldScaleX*this.scaleX,this.worldScaleY=t.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?t.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=t.worldFlipX!=this.flipX,this.worldFlipY=t.worldFlipY!=this.flipY;else{var e=this.skeleton.flipX,r=this.skeleton.flipY;this.worldX=e?-this.x:this.x,this.worldY=r!=i.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=e!=this.flipX,this.worldFlipY=r!=this.flipY}var n=this.worldRotation*i.degRad,o=Math.cos(n),s=Math.sin(n);this.worldFlipX?(this.m00=-o*this.worldScaleX,this.m01=s*this.worldScaleY):(this.m00=o*this.worldScaleX,this.m01=-s*this.worldScaleY),this.worldFlipY!=i.Bone.yDown?(this.m10=-s*this.worldScaleX,this.m11=-o*this.worldScaleY):(this.m10=s*this.worldScaleX,this.m11=o*this.worldScaleY)},setToSetupPose:function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.rotationIK=this.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.flipX=t.flipX,this.flipY=t.flipY},worldToLocal:function(t){var e=t[0]-this.worldX,r=t[1]-this.worldY,n=this.m00,o=this.m10,s=this.m01,a=this.m11;this.worldFlipX!=(this.worldFlipY!=i.Bone.yDown)&&(n=-n,a=-a);var h=1/(n*a-s*o);t[0]=e*n*h-r*s*h,t[1]=r*a*h-e*o*h},localToWorld:function(t){var e=t[0],i=t[1];t[0]=e*this.m00+i*this.m01+this.worldX,t[1]=e*this.m10+i*this.m11+this.worldY}},i.Slot=function(t,e){this.data=t,this.bone=e,this.setToSetupPose()},i.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(t){this.attachment=t,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(t){this._attachmentTime=this.bone.skeleton.time-t},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var t=this.data;this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;for(var e=this.bone.skeleton.data.slots,i=0,r=e.length;r>i;i++)if(e[i]==t){this.setAttachment(t.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(i,t.attachmentName):null);break}}},i.IkConstraint=function(t,e){this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.bones=[];for(var i=0,r=t.bones.length;r>i;i++)this.bones.push(e.findBone(t.bones[i].name));this.target=e.findBone(t.target.name)},i.IkConstraint.prototype={apply:function(){var t=this.target,e=this.bones;switch(e.length){case 1:i.IkConstraint.apply1(e[0],t.worldX,t.worldY,this.mix);break;case 2:i.IkConstraint.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.mix)}}},i.IkConstraint.apply1=function(t,e,r,n){var o=t.data.inheritRotation&&t.parent?t.parent.worldRotation:0,s=t.rotation,a=Math.atan2(r-t.worldY,e-t.worldX)*i.radDeg-o;t.rotationIK=s+(a-s)*n},i.IkConstraint.apply2=function(t,e,r,n,o,s){var a=e.rotation,h=t.rotation;if(!s)return e.rotationIK=a,void(t.rotationIK=h);var l,u,c=i.temp,d=t.parent;d?(c[0]=r,c[1]=n,d.worldToLocal(c),r=(c[0]-t.x)*d.worldScaleX,n=(c[1]-t.y)*d.worldScaleY):(r-=t.x,n-=t.y),e.parent==t?(l=e.x,u=e.y):(c[0]=e.x,c[1]=e.y,e.parent.localToWorld(c),t.worldToLocal(c),l=c[0],u=c[1]);var p=l*t.worldScaleX,f=u*t.worldScaleY,g=Math.atan2(f,p),m=Math.sqrt(p*p+f*f),v=e.data.length*e.worldScaleX,y=2*m*v;if(1e-4>y)return void(e.rotationIK=a+(Math.atan2(n,r)*i.radDeg-h-a)*s);var x=(r*r+n*n-m*m-v*v)/y;-1>x?x=-1:x>1&&(x=1);var b=Math.acos(x)*o,w=m+v*x,T=v*Math.sin(b),S=Math.atan2(n*w-r*T,r*w+n*T),C=(S-g)*i.radDeg-h;C>180?C-=360:-180>C&&(C+=360),t.rotationIK=h+C*s,C=(b+g)*i.radDeg-a,C>180?C-=360:-180>C&&(C+=360),e.rotationIK=a+(C+t.worldRotation-e.parent.worldRotation)*s},i.Skin=function(t){this.name=t,this.attachments={}},i.Skin.prototype={addAttachment:function(t,e,i){this.attachments[t+":"+e]=i},getAttachment:function(t,e){return this.attachments[t+":"+e]},_attachAll:function(t,e){for(var i in e.attachments){var r=i.indexOf(":"),n=parseInt(i.substring(0,r)),o=i.substring(r+1),s=t.slots[n];if(s.attachment&&s.attachment.name==o){var a=this.getAttachment(n,o);a&&s.setAttachment(a)}}}},i.Animation=function(t,e,i){this.name=t,this.timelines=e,this.duration=i},i.Animation.prototype={apply:function(t,e,i,r,n){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var o=this.timelines,s=0,a=o.length;a>s;s++)o[s].apply(t,e,i,n,1)},mix:function(t,e,i,r,n,o){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var s=this.timelines,a=0,h=s.length;h>a;a++)s[a].apply(t,e,i,n,o)}},i.Animation.binarySearch=function(t,e,i){var r=0,n=Math.floor(t.length/i)-2;if(!n)return i;for(var o=n>>>1;;){if(t[(o+1)*i]<=e?r=o+1:n=o,r==n)return(r+1)*i;o=r+n>>>1}},i.Animation.binarySearch1=function(t,e){var i=0,r=t.length-2;if(!r)return 1;for(var n=r>>>1;;){if(t[n+1]<=e?i=n+1:r=n,i==r)return i+1;n=i+r>>>1}},i.Animation.linearSearch=function(t,e,i){for(var r=0,n=t.length-i;n>=r;r+=i)if(t[r]>e)return r;return-1},i.Curves=function(){this.curves=[]},i.Curves.prototype={setLinear:function(t){this.curves[19*t]=0},setStepped:function(t){this.curves[19*t]=1},setCurve:function(t,e,i,r,n){var o=.1,s=o*o,a=s*o,h=3*o,l=3*s,u=6*s,c=6*a,d=2*-e+r,p=2*-i+n,f=3*(e-r)+1,g=3*(i-n)+1,m=e*h+d*l+f*a,v=i*h+p*l+g*a,y=d*u+f*c,x=p*u+g*c,b=f*c,w=g*c,T=19*t,S=this.curves;S[T++]=2;for(var C=m,E=v,A=T+19-1;A>T;T+=2)S[T]=C,S[T+1]=E,m+=y,v+=x,y+=b,x+=w,C+=m,E+=v},getCurvePercent:function(t,e){e=0>e?0:e>1?1:e;var i=this.curves,r=19*t,n=i[r];if(0===n)return e;if(1==n)return 0;r++;for(var o=0,s=r,a=r+19-1;a>r;r+=2)if(o=i[r],o>=e){var h,l;return r==s?(h=0,l=0):(h=i[r-2],l=i[r-1]),l+(i[r+1]-l)*(e-h)/(o-h)}var u=i[r-1];return u+(1-u)*(e-o)/(1-o)}},i.RotateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-2]){for(var h=a.data.rotation+s[s.length-1]-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;return void(a.rotation+=h*o)}var l=i.Animation.binarySearch(s,r,2),u=s[l-1],c=s[l],d=1-(r-c)/(s[l-2]-c);d=this.curves.getCurvePercent(l/2-1,d);for(var h=s[l+1]-u;h>180;)h-=360;for(;-180>h;)h+=360;for(h=a.data.rotation+(u+h*d)-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;a.rotation+=h*o}}},i.TranslateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.x+=(a.data.x+s[s.length-2]-a.x)*o,void(a.y+=(a.data.y+s[s.length-1]-a.y)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.x+=(a.data.x+l+(s[h+1]-l)*d-a.x)*o,a.y+=(a.data.y+u+(s[h+2]-u)*d-a.y)*o}}},i.ScaleTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.scaleX+=(a.data.scaleX*s[s.length-2]-a.scaleX)*o,void(a.scaleY+=(a.data.scaleY*s[s.length-1]-a.scaleY)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.scaleX+=(a.data.scaleX*(l+(s[h+1]-l)*d)-a.scaleX)*o,a.scaleY+=(a.data.scaleY*(u+(s[h+2]-u)*d)-a.scaleY)*o}}},i.ColorTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=5*t},i.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(t,e,i,r,n,o){t*=5,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=o},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-5]){var c=s.length-1;a=s[c-3],h=s[c-2],l=s[c-1],u=s[c]}else{var d=i.Animation.binarySearch(s,r,5),p=s[d-4],f=s[d-3],g=s[d-2],m=s[d-1],v=s[d],y=1-(r-v)/(s[d-5]-v);y=this.curves.getCurvePercent(d/5-1,y),a=p+(s[d+1]-p)*y,h=f+(s[d+2]-f)*y,l=g+(s[d+3]-g)*y,u=m+(s[d+4]-m)*y}var x=t.slots[this.slotIndex];1>o?(x.r+=(a-x.r)*o,x.g+=(h-x.g)*o,x.b+=(l-x.b)*o,x.a+=(u-x.a)*o):(x.r=a,x.g=h,x.b=l,x.a=u)}}},i.AttachmentTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.attachmentNames=[],this.attachmentNames.length=t},i.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=r>=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;if(!(n[o]r)this.apply(t,e,Number.MAX_VALUE,n,o),e=-1;else if(e>=s[a-1])return;if(!(r0&&s[h-1]==l;)h--}for(var u=this.events;a>h&&r>=s[h];h++)n.push(u[h])}}}},i.DrawOrderTimeline=function(t){this.frames=[],this.frames.length=t,this.drawOrders=[],this.drawOrders.length=t},i.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},apply:function(t,e,r){var n=this.frames;if(!(r=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;var s=t.drawOrder,a=t.slots,h=this.drawOrders[o];if(h)for(var l=0,u=h.length;u>l;l++)s[l]=t.slots[h[l]];else for(var l=0,u=a.length;u>l;l++)s[l]=a[l]}}},i.FfdTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.frameVertices=[],this.frameVertices.length=t},i.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.frameVertices[t]=i},apply:function(t,e,r,n,o){var s=t.slots[this.slotIndex];if(s.attachment==this.attachment){var a=this.frames;if(!(r=a[a.length-1]){var c=h[a.length-1];if(1>o)for(var d=0;l>d;d++)u[d]+=(c[d]-u[d])*o;else for(var d=0;l>d;d++)u[d]=c[d]}else{var p=i.Animation.binarySearch1(a,r),f=a[p],g=1-(r-f)/(a[p-1]-f);g=this.curves.getCurvePercent(p-1,0>g?0:g>1?1:g);var m=h[p-1],v=h[p];if(1>o)for(var d=0;l>d;d++){var y=m[d];u[d]+=(y+(v[d]-y)*g-u[d])*o}else for(var d=0;l>d;d++){var y=m[d];u[d]=y+(v[d]-y)*g}}}}}},i.IkConstraintTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.mix+=(s[s.length-2]-a.mix)*o,void(a.bendDirection=s[s.length-1]);var h=i.Animation.binarySearch(s,r,3),l=s[h+-2],u=s[h],c=1-(r-u)/(s[h+-3]-u);c=this.curves.getCurvePercent(h/3-1,c);var d=l+(s[h+1]-l)*c;a.mix+=(d-a.mix)*o,a.bendDirection=s[h+-1]}}},i.FlipXTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i?1:0},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]i;i++)if(e[i].name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return slot[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSkin:function(t){for(var e=this.skins,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findEvent:function(t){for(var e=this.events,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findAnimation:function(t){for(var e=this.animations,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null}},i.Skeleton=function(t){this.data=t,this.bones=[];for(var e=0,r=t.bones.length;r>e;e++){var n=t.bones[e],o=n.parent?this.bones[t.bones.indexOf(n.parent)]:null;this.bones.push(new i.Bone(n,this,o))}this.slots=[],this.drawOrder=[];for(var e=0,r=t.slots.length;r>e;e++){var s=t.slots[e],a=this.bones[t.bones.indexOf(s.boneData)],h=new i.Slot(s,a);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=[];for(var e=0,r=t.ikConstraints.length;r>e;e++)this.ikConstraints.push(new i.IkConstraint(t.ikConstraints[e],this));this.boneCache=[],this.updateCache()},i.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var t=this.ikConstraints,e=t.length,i=e+1,r=this.boneCache;r.length>i&&(r.length=i);for(var n=0,o=r.length;o>n;n++)r[n].length=0;for(;r.lengthn;n++){var h=a[n],l=h;do{for(var u=0;e>u;u++)for(var c=t[u],d=c.bones[0],p=c.bones[c.bones.length-1];;){if(l==p){r[u].push(h),r[u+1].push(h);continue t}if(p==d)break;p=p.parent}l=l.parent}while(l);s[s.length]=h}},updateWorldTransform:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++){var r=t[e];r.rotationIK=r.rotation}for(var e=0,n=this.boneCache.length-1;;){for(var o=this.boneCache[e],s=0,a=o.length;a>s;s++)o[s].updateWorldTransform();if(e==n)break;this.ikConstraints[e].apply(),e++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,e=0,i=r.length;i>e;e++){var n=r[e];n.bendDirection=n.data.bendDirection,n.mix=n.data.mix}},setSlotsToSetupPose:function(){for(var t=this.slots,e=this.drawOrder,i=0,r=t.length;r>i;i++)e[i]=t[i],t[i].setToSetupPose(i)},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},setSkinByName:function(t){var e=this.data.findSkin(t);if(!e)throw"Skin not found: "+t;this.setSkin(e)},setSkin:function(t){if(t)if(this.skin)t._attachAll(this,this.skin);else for(var e=this.slots,i=0,r=e.length;r>i;i++){var n=e[i],o=n.data.attachmentName;if(o){var s=t.getAttachment(i,o);s&&n.setAttachment(s)}}this.skin=t},getAttachmentBySlotName:function(t,e){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(t),e) -},getAttachmentBySlotIndex:function(t,e){if(this.skin){var i=this.skin.getAttachment(t,e);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},setAttachment:function(t,e){for(var i=this.slots,r=0,n=i.length;n>r;r++){var o=i[r];if(o.data.name==t){var s=null;if(e&&(s=this.getAttachmentBySlotIndex(r,e),!s))throw"Attachment not found: "+e+", for slot: "+t;return void o.setAttachment(s)}}throw"Slot not found: "+t},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},update:function(t){this.time+=t}},i.EventData=function(t){this.name=t},i.EventData.prototype={intValue:0,floatValue:0,stringValue:null},i.Event=function(t){this.data=t},i.Event.prototype={intValue:0,floatValue:0,stringValue:null},i.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},i.RegionAttachment=function(t){this.name=t,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},i.RegionAttachment.prototype={type:i.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(t,e,i,r,n){var o=this.uvs;n?(o[2]=t,o[3]=r,o[4]=t,o[5]=e,o[6]=i,o[7]=e,o[0]=i,o[1]=r):(o[0]=t,o[1]=r,o[2]=t,o[3]=e,o[4]=i,o[5]=e,o[6]=i,o[7]=r)},updateOffset:function(){var t=this.width/this.regionOriginalWidth*this.scaleX,e=this.height/this.regionOriginalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.regionOffsetX*t,n=-this.height/2*this.scaleY+this.regionOffsetY*e,o=r+this.regionWidth*t,s=n+this.regionHeight*e,a=this.rotation*i.degRad,h=Math.cos(a),l=Math.sin(a),u=r*h+this.x,c=r*l,d=n*h+this.y,p=n*l,f=o*h+this.x,g=o*l,m=s*h+this.y,v=s*l,y=this.offset;y[0]=u-p,y[1]=d+c,y[2]=u-v,y[3]=m+c,y[4]=f-v,y[5]=m+g,y[6]=f-p,y[7]=d+g},computeVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.offset;r[0]=h[0]*n+h[1]*o+t,r[1]=h[0]*s+h[1]*a+e,r[2]=h[2]*n+h[3]*o+t,r[3]=h[2]*s+h[3]*a+e,r[4]=h[4]*n+h[5]*o+t,r[5]=h[4]*s+h[5]*a+e,r[6]=h[6]*n+h[7]*o+t,r[7]=h[6]*s+h[7]*a+e}},i.MeshAttachment=function(t){this.name=t},i.MeshAttachment.prototype={type:i.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n=i.bone;t+=n.worldX,e+=n.worldY;var o=n.m00,s=n.m01,a=n.m10,h=n.m11,l=this.vertices,u=l.length;i.attachmentVertices.length==u&&(l=i.attachmentVertices);for(var c=0;u>c;c+=2){var d=l[c],p=l[c+1];r[c]=d*o+p*s+t,r[c+1]=d*a+p*h+e}}},i.SkinnedMeshAttachment=function(t){this.name=t},i.SkinnedMeshAttachment.prototype={type:i.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n,o,s,a,h,l,u,c=i.bone.skeleton.bones,d=this.weights,p=this.bones,f=0,g=0,m=0,v=0,y=p.length;if(i.attachmentVertices.length)for(var x=i.attachmentVertices;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3,v+=2)a=c[p[g]],h=d[m]+x[v],l=d[m+1]+x[v+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}else for(;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3)a=c[p[g]],h=d[m],l=d[m+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}}},i.BoundingBoxAttachment=function(t){this.name=t,this.vertices=[]},i.BoundingBoxAttachment.prototype={type:i.AttachmentType.boundingbox,computeWorldVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;for(var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.vertices,l=0,u=h.length;u>l;l+=2){var c=h[l],d=h[l+1];r[l]=c*n+d*o+t,r[l+1]=c*s+d*a+e}}},i.AnimationStateData=function(t){this.skeletonData=t,this.animationToMixTime={}},i.AnimationStateData.prototype={defaultMix:0,setMixByName:function(t,e,i){var r=this.skeletonData.findAnimation(t);if(!r)throw"Animation not found: "+t;var n=this.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;this.setMix(r,n,i)},setMix:function(t,e,i){this.animationToMixTime[t.name+":"+e.name]=i},getMix:function(t,e){var i=t.name+":"+e.name;return this.animationToMixTime.hasOwnProperty(i)?this.animationToMixTime[i]:this.defaultMix}},i.TrackEntry=function(){},i.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},i.AnimationState=function(t){this.data=t,this.tracks=[],this.events=[]},i.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(t){t*=this.timeScale;for(var e=0;e=0&&this.setCurrent(e,n)):!i.loop&&i.lastTime>=i.endTime&&this.clearTrack(e)}}},apply:function(t){for(var e=0;eo&&(r=o);var a=i.previous;if(a){var h=a.time;!a.loop&&h>a.endTime&&(h=a.endTime),a.animation.apply(t,h,h,a.loop,null);var l=i.mixTime/i.mixDuration*i.mix;l>=1&&(l=1,i.previous=null),i.animation.mix(t,i.lastTime,r,s,this.events,l)}else 1==i.mix?i.animation.apply(t,i.lastTime,r,s,this.events):i.animation.mix(t,i.lastTime,r,s,this.events,i.mix);for(var u=0,c=this.events.length;c>u;u++){var d=this.events[u];i.onEvent&&i.onEvent(e,d),this.onEvent&&this.onEvent(e,d)}if(s?n%o>r%o:o>n&&r>=o){var p=Math.floor(r/o);i.onComplete&&i.onComplete(e,p),this.onComplete&&this.onComplete(e,p)}i.lastTime=i.time}}},clearTracks:function(){for(var t=0,e=this.tracks.length;e>t;t++)this.clearTrack(t);this.tracks.length=0},clearTrack:function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];e&&(e.onEnd&&e.onEnd(t),this.onEnd&&this.onEnd(t),this.tracks[t]=null)}},_expandToIndex:function(t){if(t=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(t,e){var i=this._expandToIndex(t);if(i){var r=i.previous;i.previous=null,i.onEnd&&i.onEnd(t),this.onEnd&&this.onEnd(t),e.mixDuration=this.data.getMix(i.animation,e.animation),e.mixDuration>0&&(e.mixTime=0,e.previous=r&&i.mixTime/i.mixDuration<.5?r:i)}this.tracks[t]=e,e.onStart&&e.onStart(t),this.onStart&&this.onStart(t)},setAnimationByName:function(t,e,i){var r=this.data.skeletonData.findAnimation(e);if(!r)throw"Animation not found: "+e;return this.setAnimation(t,r,i)},setAnimation:function(t,e,r){var n=new i.TrackEntry;return n.animation=e,n.loop=r,n.endTime=e.duration,this.setCurrent(t,n),n},addAnimationByName:function(t,e,i,r){var n=this.data.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;return this.addAnimation(t,n,i,r)},addAnimation:function(t,e,r,n){var o=new i.TrackEntry;o.animation=e,o.loop=r,o.endTime=e.duration;var s=this._expandToIndex(t);if(s){for(;s.next;)s=s.next;s.next=o}else this.tracks[t]=o;return 0>=n&&(s?n+=s.endTime-this.data.getMix(s.animation,e):n=0),o.delay=n,o},getCurrent:function(t){return t>=this.tracks.length?null:this.tracks[t]}},i.SkeletonJson=function(t){this.attachmentLoader=t},i.SkeletonJson.prototype={scale:1,readSkeletonData:function(t,e){var r=new i.SkeletonData;r.name=e;var n=t.skeleton;n&&(r.hash=n.hash,r.version=n.spine,r.width=n.width||0,r.height=n.height||0);for(var o=t.bones,s=0,a=o.length;a>s;s++){var h=o[s],l=null;if(h.parent&&(l=r.findBone(h.parent),!l))throw"Parent bone not found: "+h.parent;var u=new i.BoneData(h.name,l);u.length=(h.length||0)*this.scale,u.x=(h.x||0)*this.scale,u.y=(h.y||0)*this.scale,u.rotation=h.rotation||0,u.scaleX=h.hasOwnProperty("scaleX")?h.scaleX:1,u.scaleY=h.hasOwnProperty("scaleY")?h.scaleY:1,u.inheritScale=h.hasOwnProperty("inheritScale")?h.inheritScale:!0,u.inheritRotation=h.hasOwnProperty("inheritRotation")?h.inheritRotation:!0,r.bones.push(u)}var c=t.ik;if(c)for(var s=0,a=c.length;a>s;s++){for(var d=c[s],p=new i.IkConstraintData(d.name),o=d.bones,f=0,g=o.length;g>f;f++){var m=r.findBone(o[f]);if(!m)throw"IK bone not found: "+o[f];p.bones.push(m)}if(p.target=r.findBone(d.target),!p.target)throw"Target bone not found: "+d.target;p.bendDirection=!d.hasOwnProperty("bendPositive")||d.bendPositive?1:-1,p.mix=d.hasOwnProperty("mix")?d.mix:1,r.ikConstraints.push(p)}for(var v=t.slots,s=0,a=v.length;a>s;s++){var y=v[s],u=r.findBone(y.bone);if(!u)throw"Slot bone not found: "+y.bone;var x=new i.SlotData(y.name,u),b=y.color;b&&(x.r=this.toColor(b,0),x.g=this.toColor(b,1),x.b=this.toColor(b,2),x.a=this.toColor(b,3)),x.attachmentName=y.attachment,x.additiveBlending=y.additive&&"true"==y.additive,r.slots.push(x)}var w=t.skins;for(var T in w)if(w.hasOwnProperty(T)){var S=w[T],C=new i.Skin(T);for(var E in S)if(S.hasOwnProperty(E)){var A=r.findSlotIndex(E),_=S[E];for(var M in _)if(_.hasOwnProperty(M)){var L=this.readAttachment(C,M,_[M]);L&&C.addAttachment(A,M,L)}}r.skins.push(C),"default"==C.name&&(r.defaultSkin=C)}var R=t.events;for(var P in R)if(R.hasOwnProperty(P)){var F=R[P],B=new i.EventData(P);B.intValue=F["int"]||0,B.floatValue=F["float"]||0,B.stringValue=F.string||null,r.events.push(B)}var I=t.animations;for(var O in I)I.hasOwnProperty(O)&&this.readAnimation(O,I[O],r);return r},readAttachment:function(t,e,r){e=r.name||e;var n=i.AttachmentType[r.type||"region"],o=r.path||e,s=this.scale;if(n==i.AttachmentType.region){var a=this.attachmentLoader.newRegionAttachment(t,e,o);if(!a)return null;a.path=o,a.x=(r.x||0)*s,a.y=(r.y||0)*s,a.scaleX=r.hasOwnProperty("scaleX")?r.scaleX:1,a.scaleY=r.hasOwnProperty("scaleY")?r.scaleY:1,a.rotation=r.rotation||0,a.width=(r.width||0)*s,a.height=(r.height||0)*s;var h=r.color;return h&&(a.r=this.toColor(h,0),a.g=this.toColor(h,1),a.b=this.toColor(h,2),a.a=this.toColor(h,3)),a.updateOffset(),a}if(n==i.AttachmentType.mesh){var l=this.attachmentLoader.newMeshAttachment(t,e,o);return l?(l.path=o,l.vertices=this.getFloatArray(r,"vertices",s),l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=this.getFloatArray(r,"uvs",1),l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l):null}if(n==i.AttachmentType.skinnedmesh){var l=this.attachmentLoader.newSkinnedMeshAttachment(t,e,o);if(!l)return null;l.path=o;for(var u=this.getFloatArray(r,"uvs",1),c=this.getFloatArray(r,"vertices",1),d=[],p=[],f=0,g=c.length;g>f;){var m=0|c[f++];p[p.length]=m;for(var v=f+4*m;v>f;)p[p.length]=c[f],d[d.length]=c[f+1]*s,d[d.length]=c[f+2]*s,d[d.length]=c[f+3],f+=4}return l.bones=p,l.weights=d,l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=u,l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l}if(n==i.AttachmentType.boundingbox){for(var y=this.attachmentLoader.newBoundingBoxAttachment(t,e),c=r.vertices,f=0,g=c.length;g>f;f++)y.vertices.push(c[f]*s);return y}throw"Unknown attachment type: "+n},readAnimation:function(t,e,r){var n=[],o=0,s=e.slots;for(var a in s)if(s.hasOwnProperty(a)){var h=s[a],l=r.findSlotIndex(a);for(var u in h)if(h.hasOwnProperty(u)){var c=h[u];if("color"==u){var d=new i.ColorTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],v=m.color,y=this.toColor(v,0),x=this.toColor(v,1),b=this.toColor(v,2),w=this.toColor(v,3);d.setFrame(p,m.time,y,x,b,w),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[5*d.getFrameCount()-5])}else{if("attachment"!=u)throw"Invalid timeline type for a slot: "+u+" ("+a+")";var d=new i.AttachmentTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p++,m.time,m.name)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}}}var T=e.bones;for(var S in T)if(T.hasOwnProperty(S)){var C=r.findBoneIndex(S);if(-1==C)throw"Bone not found: "+S;var E=T[S];for(var u in E)if(E.hasOwnProperty(u)){var c=E[u];if("rotate"==u){var d=new i.RotateTimeline(c.length);d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m.angle),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}else if("translate"==u||"scale"==u){var d,A=1;"scale"==u?d=new i.ScaleTimeline(c.length):(d=new i.TranslateTimeline(c.length),A=this.scale),d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],_=(m.x||0)*A,M=(m.y||0)*A;d.setFrame(p,m.time,_,M),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.getFrameCount()-3])}else{if("flipX"!=u&&"flipY"!=u)throw"Invalid timeline type for a bone: "+u+" ("+S+")";var _="flipX"==u,d=_?new i.FlipXTimeline(c.length):new i.FlipYTimeline(c.length);d.boneIndex=C;for(var L=_?"x":"y",p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m[L]||!1),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}}}var R=e.ik;for(var P in R)if(R.hasOwnProperty(P)){var F=r.findIkConstraint(P),c=R[P],d=new i.IkConstraintTimeline(c.length);d.ikConstraintIndex=r.ikConstraints.indexOf(F);for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],B=m.hasOwnProperty("mix")?m.mix:1,I=!m.hasOwnProperty("bendPositive")||m.bendPositive?1:-1;d.setFrame(p,m.time,B,I),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.frameCount-3])}var O=e.ffd;for(var D in O){var k=r.findSkin(D),h=O[D];for(a in h){var l=r.findSlotIndex(a),G=h[a];for(var N in G){var c=G[N],d=new i.FfdTimeline(c.length),U=k.getAttachment(l,N);if(!U)throw"FFD attachment not found: "+N;d.slotIndex=l,d.attachment=U;var j,V=U.type==i.AttachmentType.mesh;j=V?U.vertices.length:U.weights.length/3*2;for(var p=0,f=0,g=c.length;g>f;f++){var W,m=c[f];if(m.vertices){var H=m.vertices,W=[];W.length=j;var Y=m.offset||0,X=H.length;if(1==this.scale)for(var z=0;X>z;z++)W[z+Y]=H[z];else for(var z=0;X>z;z++)W[z+Y]=H[z]*this.scale;if(V)for(var q=U.vertices,z=0,X=W.length;X>z;z++)W[z]+=q[z]}else V?W=U.vertices:(W=[],W.length=j);d.setFrame(p,m.time,W),this.readCurve(d,p,m),p++}n[n.length]=d,o=Math.max(o,d.frames[d.frameCount-1])}}}var K=e.drawOrder;if(K||(K=e.draworder),K){for(var d=new i.DrawOrderTimeline(K.length),$=r.slots.length,p=0,f=0,g=K.length;g>f;f++){var Q=K[f],J=null;if(Q.offsets){J=[],J.length=$;for(var z=$-1;z>=0;z--)J[z]=-1;var Z=Q.offsets,te=[];te.length=$-Z.length;for(var ee=0,ie=0,z=0,X=Z.length;X>z;z++){var re=Z[z],l=r.findSlotIndex(re.slot);if(-1==l)throw"Slot not found: "+re.slot;for(;ee!=l;)te[ie++]=ee++;J[ee+re.offset]=ee++}for(;$>ee;)te[ie++]=ee++;for(var z=$-1;z>=0;z--)-1==J[z]&&(J[z]=te[--ie])}d.setFrame(p++,Q.time,J)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}var ne=e.events;if(ne){for(var d=new i.EventTimeline(ne.length),p=0,f=0,g=ne.length;g>f;f++){var oe=ne[f],se=r.findEvent(oe.name);if(!se)throw"Event not found: "+oe.name;var ae=new i.Event(se);ae.intValue=oe.hasOwnProperty("int")?oe["int"]:se.intValue,ae.floatValue=oe.hasOwnProperty("float")?oe["float"]:se.floatValue,ae.stringValue=oe.hasOwnProperty("string")?oe.string:se.stringValue,d.setFrame(p++,oe.time,ae)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}r.animations.push(new i.Animation(t,n,o))},readCurve:function(t,e,i){var r=i.curve;r?"stepped"==r?t.curves.setStepped(e):r instanceof Array&&t.curves.setCurve(e,r[0],r[1],r[2],r[3]):t.curves.setLinear(e)},toColor:function(t,e){if(8!=t.length)throw"Color hexidecimal length must be 8, recieved: "+t;return parseInt(t.substring(2*e,2*e+2),16)/255},getFloatArray:function(t,e,r){var n=t[e],o=new i.Float32Array(n.length),s=0,a=n.length;if(1==r)for(;a>s;s++)o[s]=n[s];else for(;a>s;s++)o[s]=n[s]*r;return o},getIntArray:function(t,e){for(var r=t[e],n=new i.Uint16Array(r.length),o=0,s=r.length;s>o;o++)n[o]=0|r[o];return n}},i.Atlas=function(t,e){this.textureLoader=e,this.pages=[],this.regions=[];var r=new i.AtlasReader(t),n=[];n.length=4;for(var o=null;;){var s=r.readLine();if(null===s)break;if(s=r.trim(s),s.length)if(o){var a=new i.AtlasRegion;a.name=s,a.page=o,a.rotate="true"==r.readValue(),r.readTuple(n);var h=parseInt(n[0]),l=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);a.u=h/o.width,a.v=l/o.height,a.rotate?(a.u2=(h+c)/o.width,a.v2=(l+u)/o.height):(a.u2=(h+u)/o.width,a.v2=(l+c)/o.height),a.x=h,a.y=l,a.width=Math.abs(u),a.height=Math.abs(c),4==r.readTuple(n)&&(a.splits=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],4==r.readTuple(n)&&(a.pads=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],r.readTuple(n))),a.originalWidth=parseInt(n[0]),a.originalHeight=parseInt(n[1]),r.readTuple(n),a.offsetX=parseInt(n[0]),a.offsetY=parseInt(n[1]),a.index=parseInt(r.readValue()),this.regions.push(a)}else{o=new i.AtlasPage,o.name=s,2==r.readTuple(n)&&(o.width=parseInt(n[0]),o.height=parseInt(n[1]),r.readTuple(n)),o.format=i.Atlas.Format[n[0]],r.readTuple(n),o.minFilter=i.Atlas.TextureFilter[n[0]],o.magFilter=i.Atlas.TextureFilter[n[1]];var d=r.readValue();o.uWrap=i.Atlas.TextureWrap.clampToEdge,o.vWrap=i.Atlas.TextureWrap.clampToEdge,"x"==d?o.uWrap=i.Atlas.TextureWrap.repeat:"y"==d?o.vWrap=i.Atlas.TextureWrap.repeat:"xy"==d&&(o.uWrap=o.vWrap=i.Atlas.TextureWrap.repeat),e.load(o,s,this),this.pages.push(o)}else o=null}},i.Atlas.prototype={findRegion:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},dispose:function(){for(var t=this.pages,e=0,i=t.length;i>e;e++)this.textureLoader.unload(t[e].rendererObject)},updateUVs:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++){var n=e[i];n.page==t&&(n.u=n.x/t.width,n.v=n.y/t.height,n.rotate?(n.u2=(n.x+n.height)/t.width,n.v2=(n.y+n.width)/t.height):(n.u2=(n.x+n.width)/t.width,n.v2=(n.y+n.height)/t.height))}}},i.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},i.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},i.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},i.AtlasPage=function(){},i.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},i.AtlasRegion=function(){},i.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},i.AtlasReader=function(t){this.lines=t.split(/\r\n|\r|\n/)},i.AtlasReader.prototype={index:0,trim:function(t){return t.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw"Invalid line: "+t;return this.trim(t.substring(e+1))},readTuple:function(t){var e=this.readLine(),i=e.indexOf(":");if(-1==i)throw"Invalid line: "+e;for(var r=0,n=i+1;3>r;r++){var o=e.indexOf(",",n);if(-1==o)break;t[r]=this.trim(e.substr(n,o-n)),n=o+1}return t[r]=this.trim(e.substring(n)),r+1}},i.AtlasAttachmentLoader=function(t){this.atlas=t},i.AtlasAttachmentLoader.prototype={newRegionAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (region attachment: "+e+")";var o=new i.RegionAttachment(e);return o.rendererObject=n,o.setUVs(n.u,n.v,n.u2,n.v2,n.rotate),o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (mesh attachment: "+e+")";var o=new i.MeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newSkinnedMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (skinned mesh attachment: "+e+")";var o=new i.SkinnedMeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newBoundingBoxAttachment:function(t,e){return new i.BoundingBoxAttachment(e)}},i.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},i.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(t,e){var r=t.slots,n=r.length,o=t.x,s=t.y,a=this.boundingBoxes,h=this.polygonPool,l=this.polygons;a.length=0;for(var u=0,c=l.length;c>u;u++)h.push(l[u]);l.length=0;for(var u=0;n>u;u++){var d=r[u],p=d.attachment;if(p.type==i.AttachmentType.boundingbox){a.push(p);var f,g=h.length;g>0?(f=h[g-1],h.splice(g-1,1)):f=[],l.push(f),f.length=p.vertices.length,p.computeWorldVertices(o,s,d.bone,f)}}e&&this.aabbCompute()},aabbCompute:function(){for(var t=this.polygons,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=Number.MIN_VALUE,n=Number.MIN_VALUE,o=0,s=t.length;s>o;o++)for(var a=t[o],h=0,l=a.length;l>h;h+=2){var u=a[h],c=a[h+1];e=Math.min(e,u),i=Math.min(i,c),r=Math.max(r,u),n=Math.max(n,c)}this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},aabbContainsPoint:function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},aabbIntersectsSegment:function(t,e,i,r){var n=this.minX,o=this.minY,s=this.maxX,a=this.maxY;if(n>=t&&n>=i||o>=e&&o>=r||t>=s&&i>=s||e>=a&&r>=a)return!1;var h=(r-e)/(i-t),l=h*(n-t)+e;if(l>o&&a>l)return!0;if(l=h*(s-t)+e,l>o&&a>l)return!0;var u=(o-e)/h+t;return u>n&&s>u?!0:(u=(a-e)/h+t,u>n&&s>u?!0:!1)},aabbIntersectsSkeleton:function(t){return this.minXt.minX&&this.minYt.minY},containsPoint:function(t,e){for(var i=this.polygons,r=0,n=i.length;n>r;r++)if(this.polygonContainsPoint(i[r],t,e))return this.boundingBoxes[r];return null},intersectsSegment:function(t,e,i,r){for(var n=this.polygons,o=0,s=n.length;s>o;o++)if(n[o].intersectsSegment(t,e,i,r))return this.boundingBoxes[o];return null},polygonContainsPoint:function(t,e,i){for(var r=t.length,n=r-2,o=!1,s=0;r>s;s+=2){var a=t[s+1],h=t[n+1];if(i>a&&h>=i||i>h&&a>=i){var l=t[s];l+(i-a)/(h-a)*(t[n]-l)c;c+=2){var d=t[c],p=t[c+1],f=l*p-u*d,g=l-d,m=u-p,v=s*m-a*g,y=(h*g-s*f)/v;if((y>=l&&d>=y||y>=d&&l>=y)&&(y>=e&&r>=y||y>=r&&e>=y)){var x=(h*m-a*f)/v;if((x>=u&&p>=x||x>=p&&u>=x)&&(x>=i&&n>=x||x>=n&&i>=x))return!0}l=d,u=p}return!1},getPolygon:function(t){var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}},i.Bone.yDown=!0,e.AnimCache={},e.SpineTextureLoader=function(t,i){e.EventTarget.call(this),this.basePath=t,this.crossorigin=i,this.loadingCount=0},e.SpineTextureLoader.prototype=e.SpineTextureLoader,e.SpineTextureLoader.prototype.load=function(t,i){if(t.rendererObject=e.BaseTexture.fromImage(this.basePath+"/"+i,this.crossorigin),!t.rendererObject.hasLoaded){var r=this;++r.loadingCount,t.rendererObject.addEventListener("loaded",function(){--r.loadingCount,r.dispatchEvent({type:"loadedBaseTexture",content:r})})}},e.SpineTextureLoader.prototype.unload=function(t){t.destroy(!0)},e.Spine=function(t){if(e.DisplayObjectContainer.call(this),this.spineData=e.AnimCache[t],!this.spineData)throw new Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: "+t);this.skeleton=new i.Skeleton(this.spineData),this.skeleton.updateWorldTransform(),this.stateData=new i.AnimationStateData(this.spineData),this.state=new i.AnimationState(this.stateData),this.slotContainers=[];for(var r=0,n=this.skeleton.drawOrder.length;n>r;r++){var o=this.skeleton.drawOrder[r],s=o.attachment,a=new e.DisplayObjectContainer;if(this.slotContainers.push(a),this.addChild(a),s instanceof i.RegionAttachment){var h=s.rendererObject.name,l=this.createSprite(o,s);o.currentSprite=l,o.currentSpriteName=h,a.addChild(l)}else{if(!(s instanceof i.MeshAttachment))continue;var u=this.createMesh(o,s);o.currentMesh=u,o.currentMeshName=s.name,a.addChild(u)}}this.autoUpdate=!0},e.Spine.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Spine.prototype.constructor=e.Spine,Object.defineProperty(e.Spine.prototype,"autoUpdate",{get:function(){return this.updateTransform===e.Spine.prototype.autoUpdateTransform},set:function(t){this.updateTransform=t?e.Spine.prototype.autoUpdateTransform:e.DisplayObjectContainer.prototype.updateTransform}}),e.Spine.prototype.update=function(t){this.state.update(t),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var r=this.skeleton.drawOrder,n=0,o=r.length;o>n;n++){var s=r[n],a=s.attachment,h=this.slotContainers[n];if(a){var l=a.type;if(l===i.AttachmentType.region){if(a.rendererObject&&(!s.currentSpriteName||s.currentSpriteName!==a.name)){var u=a.rendererObject.name;if(void 0!==s.currentSprite&&(s.currentSprite.visible=!1),s.sprites=s.sprites||{},void 0!==s.sprites[u])s.sprites[u].visible=!0;else{var c=this.createSprite(s,a);h.addChild(c)}s.currentSprite=s.sprites[u],s.currentSpriteName=u}var d=s.bone;h.position.x=d.worldX+a.x*d.m00+a.y*d.m01,h.position.y=d.worldY+a.x*d.m10+a.y*d.m11,h.scale.x=d.worldScaleX,h.scale.y=d.worldScaleY,h.rotation=-(s.bone.worldRotation*i.degRad),s.currentSprite.tint=e.rgb2hex([s.r,s.g,s.b])}else{if(l!==i.AttachmentType.skinnedmesh){h.visible=!1;continue}if(!s.currentMeshName||s.currentMeshName!==a.name){var p=a.name;if(void 0!==s.currentMesh&&(s.currentMesh.visible=!1),s.meshes=s.meshes||{},void 0!==s.meshes[p])s.meshes[p].visible=!0;else{var f=this.createMesh(s,a);h.addChild(f)}s.currentMesh=s.meshes[p],s.currentMeshName=p}a.computeWorldVertices(s.bone.skeleton.x,s.bone.skeleton.y,s,s.currentMesh.vertices)}h.visible=!0,h.alpha=s.a}else h.visible=!1}},e.Spine.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var t=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(t),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.Spine.prototype.createSprite=function(t,r){var n=r.rendererObject,o=n.page.rendererObject,s=new e.Rectangle(n.x,n.y,n.rotate?n.height:n.width,n.rotate?n.width:n.height),a=new e.Texture(o,s),h=new e.Sprite(a),l=n.rotate?.5*Math.PI:0;return h.scale.set(n.width/n.originalWidth,n.height/n.originalHeight),h.rotation=l-r.rotation*i.degRad,h.anchor.x=h.anchor.y=.5,t.sprites=t.sprites||{},t.sprites[n.name]=h,h},e.Spine.prototype.createMesh=function(t,i){var r=i.rendererObject,n=r.page.rendererObject,o=new e.Texture(n),s=new e.Strip(o);return s.drawMode=e.Strip.DrawModes.TRIANGLES,s.canvasPadding=1.5,s.vertices=new e.Float32Array(i.uvs.length),s.uvs=i.uvs,s.indices=i.triangles,t.meshes=t.meshes||{},t.meshes[i.name]=s,s},e.BaseTextureCache={},e.BaseTextureCacheIdGenerator=0,e.BaseTexture=function(t,i){if(this.resolution=1,this.width=100,this.height=100,this.scaleMode=i||e.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=t,this._UID=e._UID++,this.premultipliedAlpha=!0,this._glTextures=[],this.mipmap=!1,this._dirty=[!0,!0,!0,!0],t){if((this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this.hasLoaded=!0,this.width=this.source.naturalWidth||this.source.width,this.height=this.source.naturalHeight||this.source.height,this.dirty();else{var r=this;this.source.onload=function(){r.hasLoaded=!0,r.width=r.source.naturalWidth||r.source.width,r.height=r.source.naturalHeight||r.source.height,r.dirty(),r.dispatchEvent({type:"loaded",content:r})},this.source.onerror=function(){r.dispatchEvent({type:"error",content:r})}}this.imageUrl=null,this._powerOf2=!1}},e.BaseTexture.prototype.constructor=e.BaseTexture,e.EventTarget.mixin(e.BaseTexture.prototype),e.BaseTexture.prototype.destroy=function(){this.imageUrl?(delete e.BaseTextureCache[this.imageUrl],delete e.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete e.BaseTextureCache[this.source._pixiId],this.source=null,this.unloadFromGPU()},e.BaseTexture.prototype.updateSourceImage=function(t){this.hasLoaded=!1,this.source.src=null,this.source.src=t},e.BaseTexture.prototype.dirty=function(){for(var t=0;t=0;t--){var i=this._glTextures[t],r=e.glContexts[t];r&&i&&r.deleteTexture(i)}this._glTextures.length=0,this.dirty()},e.BaseTexture.fromImage=function(t,i,r){var n=e.BaseTextureCache[t];if(void 0===i&&-1===t.indexOf("data:")&&(i=!0),!n){var o=new Image;i&&(o.crossOrigin=""),o.src=t,n=new e.BaseTexture(o,r),n.imageUrl=t,e.BaseTextureCache[t]=n,-1!==t.indexOf(e.RETINA_PREFIX+".")&&(n.resolution=2)}return n},e.BaseTexture.fromCanvas=function(t,i){t._pixiId||(t._pixiId="canvas_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.BaseTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.TextureCache={},e.FrameCache={},e.TextureCacheIdGenerator=0,e.Texture=function(t,i,r,n){this.noFrame=!1,i||(this.noFrame=!0,i=new e.Rectangle(0,0,1,1)),t instanceof e.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=i,this.trim=n,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=r||new e.Rectangle(0,0,1,1),t.hasLoaded?(this.noFrame&&(i=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(i)):t.addEventListener("loaded",this.onBaseTextureLoaded.bind(this))},e.Texture.prototype.constructor=e.Texture,e.EventTarget.mixin(e.Texture.prototype),e.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;t.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame),this.dispatchEvent({type:"update",content:this})},e.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},e.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,!this.trim&&(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this); -this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs()},e.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new e.TextureUvs);var t=this.crop,i=this.baseTexture.width,r=this.baseTexture.height;this._uvs.x0=t.x/i,this._uvs.y0=t.y/r,this._uvs.x1=(t.x+t.width)/i,this._uvs.y1=t.y/r,this._uvs.x2=(t.x+t.width)/i,this._uvs.y2=(t.y+t.height)/r,this._uvs.x3=t.x/i,this._uvs.y3=(t.y+t.height)/r},e.Texture.fromImage=function(t,i,r){var n=e.TextureCache[t];return n||(n=new e.Texture(e.BaseTexture.fromImage(t,i,r)),e.TextureCache[t]=n),n},e.Texture.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache ');return i},e.Texture.fromCanvas=function(t,i){var r=e.BaseTexture.fromCanvas(t,i);return new e.Texture(r)},e.Texture.addTextureToCache=function(t,i){e.TextureCache[i]=t},e.Texture.removeTextureFromCache=function(t){var i=e.TextureCache[t];return delete e.TextureCache[t],delete e.BaseTextureCache[t],i},e.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},e.Texture.emptyTexture=new e.Texture(new e.BaseTexture),e.RenderTexture=function(t,i,r,n,o){if(this.width=t||100,this.height=i||100,this.resolution=o||1,this.frame=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.baseTexture=new e.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=n||e.scaleModes.DEFAULT,this.baseTexture.hasLoaded=!0,e.Texture.call(this,this.baseTexture,new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution)),this.renderer=r||e.defaultRenderer,this.renderer.type===e.WEBGL_RENDERER){var s=this.renderer.gl;this.baseTexture._dirty[s.id]=!1,this.textureBuffer=new e.FilterTexture(s,this.width,this.height,this.baseTexture.scaleMode),this.baseTexture._glTextures[s.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new e.Point(.5*this.width,.5*-this.height)}else this.render=this.renderCanvas,this.textureBuffer=new e.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()},e.RenderTexture.prototype=Object.create(e.Texture.prototype),e.RenderTexture.prototype.constructor=e.RenderTexture,e.RenderTexture.prototype.resize=function(t,i,r){(t!==this.width||i!==this.height)&&(this.valid=t>0&&i>0,this.width=t,this.height=i,this.frame.width=this.crop.width=t*this.resolution,this.frame.height=this.crop.height=i*this.resolution,r&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===e.WEBGL_RENDERER&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},e.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===e.WEBGL_RENDERER&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},e.RenderTexture.prototype.renderWebGL=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),r.translate(0,2*this.projection.y),e&&r.append(e),r.scale(1,-1),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();var a=this.renderer.gl;a.viewport(0,0,this.width*this.resolution,this.height*this.resolution),a.bindFramebuffer(a.FRAMEBUFFER,this.textureBuffer.frameBuffer),i&&this.textureBuffer.clear(),this.renderer.spriteBatch.dirty=!0,this.renderer.renderDisplayObject(t,this.projection,this.textureBuffer.frameBuffer),this.renderer.spriteBatch.dirty=!0}},e.RenderTexture.prototype.renderCanvas=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),e&&r.append(e),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();i&&this.textureBuffer.clear();var a=this.textureBuffer.context,h=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(t,a),this.renderer.resolution=h}},e.RenderTexture.prototype.getImage=function(){var t=new Image;return t.src=this.getBase64(),t},e.RenderTexture.prototype.getBase64=function(){return this.getCanvas().toDataURL()},e.RenderTexture.prototype.getCanvas=function(){if(this.renderer.type===e.WEBGL_RENDERER){var t=this.renderer.gl,i=this.textureBuffer.width,r=this.textureBuffer.height,n=new Uint8Array(4*i*r);t.bindFramebuffer(t.FRAMEBUFFER,this.textureBuffer.frameBuffer),t.readPixels(0,0,i,r,t.RGBA,t.UNSIGNED_BYTE,n),t.bindFramebuffer(t.FRAMEBUFFER,null);var o=new e.CanvasBuffer(i,r),s=o.context.getImageData(0,0,i,r);return s.data.set(n),o.context.putImageData(s,0,0),o.canvas}return this.textureBuffer.canvas},e.RenderTexture.tempMatrix=new e.Matrix,e.VideoTexture=function(t,i){if(!t)throw new Error("No video source element specified.");(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),e.BaseTexture.call(this,t,i),this.autoUpdate=!1,this.updateBound=this._onUpdate.bind(this),t.complete||(this._onCanPlay=this.onCanPlay.bind(this),t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("play",this.onPlayStart.bind(this)),t.addEventListener("pause",this.onPlayStop.bind(this)))},e.VideoTexture.prototype=Object.create(e.BaseTexture.prototype),e.VideoTexture.constructor=e.VideoTexture,e.VideoTexture.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this.updateBound),this.dirty())},e.VideoTexture.prototype.onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this.updateBound),this.autoUpdate=!0)},e.VideoTexture.prototype.onPlayStop=function(){this.autoUpdate=!1},e.VideoTexture.prototype.onCanPlay=function(){"canplaythrough"===event.type&&(this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.__loaded||(this.__loaded=!0,this.dispatchEvent({type:"loaded",content:this}))))},e.VideoTexture.prototype.destroy=function(){this.source&&this.source._pixiId&&(e.BaseTextureCache[this.source._pixiId]=null,delete e.BaseTextureCache[this.source._pixiId],this.source._pixiId=null,delete this.source._pixiId),e.BaseTexture.prototype.destroy.call(this)},e.VideoTexture.baseTextureFromVideo=function(t,i){t._pixiId||(t._pixiId="video_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.VideoTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.VideoTexture.textureFromVideo=function(t,i){var r=e.VideoTexture.baseTextureFromVideo(t,i);return new e.Texture(r)},e.VideoTexture.fromUrl=function(t,i){var r=document.createElement("video");return r.src=t,r.autoPlay=!0,r.play(),e.VideoTexture.textureFromVideo(r,i)},e.AssetLoader=function(t,i){this.assetURLs=t,this.crossorigin=i,this.loadersByType={jpg:e.ImageLoader,jpeg:e.ImageLoader,png:e.ImageLoader,gif:e.ImageLoader,webp:e.ImageLoader,json:e.JsonLoader,atlas:e.AtlasLoader,anim:e.SpineLoader,xml:e.BitmapFontLoader,fnt:e.BitmapFontLoader}},e.EventTarget.mixin(e.AssetLoader.prototype),e.AssetLoader.prototype.constructor=e.AssetLoader,e.AssetLoader.prototype._getDataType=function(t){var e="data:",i=t.slice(0,e.length).toLowerCase();if(i===e){var r=t.slice(e.length),n=r.indexOf(",");if(-1===n)return null;var o=r.slice(0,n).split(";")[0];return o&&"text/plain"!==o.toLowerCase()?o.split("/").pop().toLowerCase():"txt"}return null},e.AssetLoader.prototype.load=function(){function t(t){e.onAssetLoaded(t.data.content)}var e=this;this.loadCount=this.assetURLs.length;for(var i=0;i0?t.addEventListener("loadedBaseTexture",function(t){t.content.content.loadingCount<=0&&f.onLoaded()}):f.onLoaded()},p.load()}else this.onLoaded()},e.JsonLoader.prototype.onLoaded=function(){this.loaded=!0,this.dispatchEvent({type:"loaded",content:this})},e.JsonLoader.prototype.onError=function(){this.dispatchEvent({type:"error",content:this})},e.AtlasLoader=function(t,e){this.url=t,this.baseUrl=t.replace(/[^\/]*$/,""),this.crossorigin=e,this.loaded=!1},e.AtlasLoader.constructor=e.AtlasLoader,e.EventTarget.mixin(e.AtlasLoader.prototype),e.AtlasLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onAtlasLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/json"),this.ajaxRequest.send(null)},e.AtlasLoader.prototype.onAtlasLoaded=function(){if(4===this.ajaxRequest.readyState)if(200===this.ajaxRequest.status||-1===window.location.href.indexOf("http")){this.atlas={meta:{image:[]},frames:[]};var t=this.ajaxRequest.responseText.split(/\r?\n/),i=-3,r=0,n=null,o=!1,s=0,a=0,h=this.onLoaded.bind(this);for(s=0;s0){if(o===s)this.atlas.meta.image.push(t[s]),r=this.atlas.meta.image.length-1,this.atlas.frames.push({}),i=-3;else if(i>0)if(i%7===1)null!=n&&(this.atlas.frames[r][n.name]=n),n={name:t[s],frame:{}};else{var l=t[s].split(" ");if(i%7===3)n.frame.x=Number(l[1].replace(",","")),n.frame.y=Number(l[2]);else if(i%7===4)n.frame.w=Number(l[1].replace(",","")),n.frame.h=Number(l[2]);else if(i%7===5){var u={x:0,y:0,w:Number(l[1].replace(",","")),h:Number(l[2])};u.w>n.frame.w||u.h>n.frame.h?(n.trimmed=!0,n.realSize=u):n.trimmed=!1}}i++}if(null!=n&&(this.atlas.frames[r][n.name]=n),this.atlas.meta.image.length>0){for(this.images=[],a=0;athis.currentImageId?(this.currentImageId++,this.images[this.currentImageId].load()):(this.loaded=!0,this.emit("loaded",{content:this}))},e.AtlasLoader.prototype.onError=function(){this.emit("error",{content:this})},e.SpriteSheetLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null,this.frames={}},e.SpriteSheetLoader.prototype.constructor=e.SpriteSheetLoader,e.EventTarget.mixin(e.SpriteSheetLoader.prototype),e.SpriteSheetLoader.prototype.load=function(){var t=this,i=new e.JsonLoader(this.url,this.crossorigin);i.on("loaded",function(e){t.json=e.data.content.json,t.onLoaded()}),i.load()},e.SpriteSheetLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader=function(t,i){this.texture=e.Texture.fromImage(t,i),this.frames=[]},e.ImageLoader.prototype.constructor=e.ImageLoader,e.EventTarget.mixin(e.ImageLoader.prototype),e.ImageLoader.prototype.load=function(){this.texture.baseTexture.hasLoaded?this.onLoaded():this.texture.baseTexture.on("loaded",this.onLoaded.bind(this))},e.ImageLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader.prototype.loadFramedSpriteSheet=function(t,i,r){this.frames=[];for(var n=Math.floor(this.texture.width/t),o=Math.floor(this.texture.height/i),s=0,a=0;o>a;a++)for(var h=0;n>h;h++,s++){var l=new e.Texture(this.texture.baseTexture,{x:h*t,y:a*i,width:t,height:i});this.frames.push(l),r&&(e.TextureCache[r+"-"+s]=l)}this.load()},e.BitmapFontLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null},e.BitmapFontLoader.prototype.constructor=e.BitmapFontLoader,e.EventTarget.mixin(e.BitmapFontLoader.prototype),e.BitmapFontLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onXMLLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/xml"),this.ajaxRequest.send(null)},e.BitmapFontLoader.prototype.onXMLLoaded=function(){if(4===this.ajaxRequest.readyState&&(200===this.ajaxRequest.status||-1===window.location.protocol.indexOf("http"))){var t=this.ajaxRequest.responseXML;if(!t||/MSIE 9/i.test(navigator.userAgent)||navigator.isCocoonJS)if("function"==typeof window.DOMParser){var i=new DOMParser;t=i.parseFromString(this.ajaxRequest.responseText,"text/xml")}else{var r=document.createElement("div");r.innerHTML=this.ajaxRequest.responseText,t=r}var n=this.baseUrl+t.getElementsByTagName("page")[0].getAttribute("file"),o=new e.ImageLoader(n,this.crossorigin);this.texture=o.texture.baseTexture;var s={},a=t.getElementsByTagName("info")[0],h=t.getElementsByTagName("common")[0];s.font=a.getAttribute("face"),s.size=parseInt(a.getAttribute("size"),10),s.lineHeight=parseInt(h.getAttribute("lineHeight"),10),s.chars={};for(var l=t.getElementsByTagName("char"),u=0;ut;t++)this.shaders[t].dirty=!0},e.AlphaMaskFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={mask:{type:"sampler2D",value:t},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mask.value.x=t.width,this.uniforms.mask.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D mask;","uniform sampler2D uSampler;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," mapCords *= dimensions.xy / mapDimensions;"," vec4 original = texture2D(uSampler, vTextureCoord);"," float maskAlpha = texture2D(mask, mapCords).r;"," original *= maskAlpha;"," gl_FragColor = original;","}"]},e.AlphaMaskFilter.prototype=Object.create(e.AbstractFilter.prototype),e.AlphaMaskFilter.prototype.constructor=e.AlphaMaskFilter,e.AlphaMaskFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.mask.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.mask.value.height,this.uniforms.mask.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.AlphaMaskFilter.prototype,"map",{get:function(){return this.uniforms.mask.value},set:function(t){this.uniforms.mask.value=t}}),e.ColorMatrixFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={matrix:{type:"mat4",value:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform mat4 matrix;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * matrix;","}"]},e.ColorMatrixFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorMatrixFilter.prototype.constructor=e.ColorMatrixFilter,Object.defineProperty(e.ColorMatrixFilter.prototype,"matrix",{get:function(){return this.uniforms.matrix.value},set:function(t){this.uniforms.matrix.value=t}}),e.GrayFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={gray:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float gray;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);","}"]},e.GrayFilter.prototype=Object.create(e.AbstractFilter.prototype),e.GrayFilter.prototype.constructor=e.GrayFilter,Object.defineProperty(e.GrayFilter.prototype,"gray",{get:function(){return this.uniforms.gray.value},set:function(t){this.uniforms.gray.value=t}}),e.DisplacementFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={displacementMap:{type:"sampler2D",value:t},scale:{type:"2f",value:{x:30,y:30}},offset:{type:"2f",value:{x:0,y:0}},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mapDimensions.value.x=t.width,this.uniforms.mapDimensions.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D displacementMap;","uniform sampler2D uSampler;","uniform vec2 scale;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," vec2 matSample = texture2D(displacementMap, mapCords).xy;"," matSample -= 0.5;"," matSample *= scale;"," matSample /= mapDimensions;"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);"," vec2 cord = vTextureCoord;","}"]},e.DisplacementFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DisplacementFilter.prototype.constructor=e.DisplacementFilter,e.DisplacementFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.displacementMap.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.displacementMap.value.height,this.uniforms.displacementMap.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.DisplacementFilter.prototype,"map",{get:function(){return this.uniforms.displacementMap.value},set:function(t){this.uniforms.displacementMap.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.uniforms.scale.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.uniforms.offset.value=t}}),e.PixelateFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:0},dimensions:{type:"4fv",value:new e.Float32Array([1e4,100,10,10])},pixelSize:{type:"2f",value:{x:10,y:10}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 testDim;","uniform vec4 dimensions;","uniform vec2 pixelSize;","uniform sampler2D uSampler;","void main(void) {"," vec2 coord = vTextureCoord;"," vec2 size = dimensions.xy/pixelSize;"," vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;"," gl_FragColor = texture2D(uSampler, color);","}"]},e.PixelateFilter.prototype=Object.create(e.AbstractFilter.prototype),e.PixelateFilter.prototype.constructor=e.PixelateFilter,Object.defineProperty(e.PixelateFilter.prototype,"size",{get:function(){return this.uniforms.pixelSize.value},set:function(t){this.dirty=!0,this.uniforms.pixelSize.value=t}}),e.BlurXFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurXFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurXFilter.prototype.constructor=e.BlurXFilter,Object.defineProperty(e.BlurXFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.dirty=!0,this.uniforms.blur.value=1/7e3*t}}),e.BlurYFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurYFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurYFilter.prototype.constructor=e.BlurYFilter,Object.defineProperty(e.BlurYFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.BlurFilter=function(){this.blurXFilter=new e.BlurXFilter,this.blurYFilter=new e.BlurYFilter,this.passes=[this.blurXFilter,this.blurYFilter]},e.BlurFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurFilter.prototype.constructor=e.BlurFilter,Object.defineProperty(e.BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t}}),e.InvertFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);","}"]},e.InvertFilter.prototype=Object.create(e.AbstractFilter.prototype),e.InvertFilter.prototype.constructor=e.InvertFilter,Object.defineProperty(e.InvertFilter.prototype,"invert",{get:function(){return this.uniforms.invert.value},set:function(t){this.uniforms.invert.value=t}}),e.SepiaFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={sepia:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float sepia;","uniform sampler2D uSampler;","const mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);","}"]},e.SepiaFilter.prototype=Object.create(e.AbstractFilter.prototype),e.SepiaFilter.prototype.constructor=e.SepiaFilter,Object.defineProperty(e.SepiaFilter.prototype,"sepia",{get:function(){return this.uniforms.sepia.value},set:function(t){this.uniforms.sepia.value=t}}),e.TwistFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"2f",value:{x:.5,y:.5}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float radius;","uniform float angle;","uniform vec2 offset;","void main(void) {"," vec2 coord = vTextureCoord - offset;"," float distance = length(coord);"," if (distance < radius) {"," float ratio = (radius - distance) / radius;"," float angleMod = ratio * ratio * angle;"," float s = sin(angleMod);"," float c = cos(angleMod);"," coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);"," }"," gl_FragColor = texture2D(uSampler, coord+offset);","}"]},e.TwistFilter.prototype=Object.create(e.AbstractFilter.prototype),e.TwistFilter.prototype.constructor=e.TwistFilter,Object.defineProperty(e.TwistFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.dirty=!0,this.uniforms.offset.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"radius",{get:function(){return this.uniforms.radius.value},set:function(t){this.dirty=!0,this.uniforms.radius.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.ColorStepFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={step:{type:"1f",value:5}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float step;","void main(void) {"," vec4 color = texture2D(uSampler, vTextureCoord);"," color = floor(color * step) / step;"," gl_FragColor = color;","}"]},e.ColorStepFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorStepFilter.prototype.constructor=e.ColorStepFilter,Object.defineProperty(e.ColorStepFilter.prototype,"step",{get:function(){return this.uniforms.step.value},set:function(t){this.uniforms.step.value=t}}),e.DotScreenFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float angle;","uniform float scale;","float pattern() {"," float s = sin(angle), c = cos(angle);"," vec2 tex = vTextureCoord * dimensions.xy;"," vec2 point = vec2("," c * tex.x - s * tex.y,"," s * tex.x + c * tex.y"," ) * scale;"," return (sin(point.x) * sin(point.y)) * 4.0;","}","void main() {"," vec4 color = texture2D(uSampler, vTextureCoord);"," float average = (color.r + color.g + color.b) / 3.0;"," gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);","}"] -},e.DotScreenFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DotScreenFilter.prototype.constructor=e.DotScreenFilter,Object.defineProperty(e.DotScreenFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.dirty=!0,this.uniforms.scale.value=t}}),Object.defineProperty(e.DotScreenFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.CrossHatchFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);"," gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"," if (lum < 1.00) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.75) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.50) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.3) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }","}"]},e.CrossHatchFilter.prototype=Object.create(e.AbstractFilter.prototype),e.CrossHatchFilter.prototype.constructor=e.CrossHatchFilter,Object.defineProperty(e.CrossHatchFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.RGBSplitFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={red:{type:"2f",value:{x:20,y:20}},green:{type:"2f",value:{x:-20,y:20}},blue:{type:"2f",value:{x:20,y:-20}},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 red;","uniform vec2 green;","uniform vec2 blue;","uniform vec4 dimensions;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;"," gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;"," gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;"," gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;","}"]},e.RGBSplitFilter.prototype=Object.create(e.AbstractFilter.prototype),e.RGBSplitFilter.prototype.constructor=e.RGBSplitFilter,Object.defineProperty(e.RGBSplitFilter.prototype,"red",{get:function(){return this.uniforms.red.value},set:function(t){this.uniforms.red.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"green",{get:function(){return this.uniforms.green.value},set:function(t){this.uniforms.green.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"blue",{get:function(){return this.uniforms.blue.value},set:function(t){this.uniforms.blue.value=t}}),"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=e),exports.PIXI=e):"undefined"!=typeof define&&define.amd?define(e):t.PIXI=e}.call(this),!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.html2canvas=t()}}(function(){var t;return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var h="function"==typeof require&&require;if(!a&&h)return h(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[s]={exports:{}};t[s][0].call(u.exports,function(e){var i=t[s][1][e];return n(i?i:e)},u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;st;t+=2){var e=W[t],i=W[t+1];e(i),W[t]=void 0,W[t+1]=void 0}G=0}function p(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function m(t){try{return t.then}catch(e){return z.error=e,z}}function v(t,e,i,r){try{t.call(e,i,r)}catch(n){return n}}function y(t,e,i){N(function(t){var r=!1,n=v(i,e,function(i){r||(r=!0,e!==i?w(t,i):S(t,i))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&n&&(r=!0,C(t,n))},t)}function x(t,e){e._state===Y?S(t,e._result):t._state===X?C(t,e._result):E(e,void 0,function(e){w(t,e)},function(e){C(t,e)})}function b(t,e){if(e.constructor===t.constructor)x(t,e);else{var i=m(e);i===z?C(t,z.error):void 0===i?S(t,e):o(i)?y(t,e,i):S(t,e)}}function w(t,e){t===e?C(t,f()):n(e)?b(t,e):S(t,e)}function T(t){t._onerror&&t._onerror(t._result),A(t)}function S(t,e){t._state===H&&(t._result=e,t._state=Y,0===t._subscribers.length||N(A,t))}function C(t,e){t._state===H&&(t._state=X,t._result=e,N(T,t))}function E(t,e,i,r){var n=t._subscribers,o=n.length;t._onerror=null,n[o]=e,n[o+Y]=i,n[o+X]=r,0===o&&t._state&&N(A,t)}function A(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var r,n,o=t._result,s=0;s1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return a.prototype=t,new a},0),N=function(t,e){W[G]=t,W[G+1]=e,G+=2,2===G&&D()},U="undefined"!=typeof window?window:{},j=U.MutationObserver||U.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,W=new Array(1e3);D="undefined"!=typeof e&&"[object process]"==={}.toString.call(e)?h():j?l():V?u():c();var H=void 0,Y=1,X=2,z=new _,q=new _;P.prototype._validateInput=function(t){return k(t)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var K=P;P.prototype._enumerate=function(){for(var t=this.length,e=this.promise,i=this._input,r=0;e._state===H&&t>r;r++)this._eachEntry(i[r],r)},P.prototype._eachEntry=function(t,e){var i=this._instanceConstructor;s(t)?t.constructor===i&&t._state!==H?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(i.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(Y,e,t))},P.prototype._settledAt=function(t,e,i){var r=this.promise;r._state===H&&(this._remaining--,this._abortOnReject&&t===X?C(r,i):this._result[e]=this._makeResult(t,e,i)),0===this._remaining&&S(r,this._result)},P.prototype._makeResult=function(t,e,i){return i},P.prototype._willSettleAt=function(t,e){var i=this;E(t,void 0,function(t){i._settledAt(Y,e,t)},function(t){i._settledAt(X,e,t)})};var $=function(t,e){return new K(this,t,!0,e).promise},Q=function(t,e){function i(t){w(o,t)}function r(t){C(o,t)}var n=this,o=new n(p,e);if(!k(t))return C(o,new TypeError("You must pass an array to race.")),o;for(var s=t.length,a=0;o._state===H&&s>a;a++)E(n.resolve(t[a]),void 0,i,r);return o},J=function(t,e){var i=this;if(t&&"object"==typeof t&&t.constructor===i)return t;var r=new i(p,e);return w(r,t),r},Z=function(t,e){var i=this,r=new i(p,e);return C(r,t),r},te=0,ee=I;I.all=$,I.race=Q,I.resolve=J,I.reject=Z,I.prototype={constructor:I,then:function(t,e){var i=this,r=i._state;if(r===Y&&!t||r===X&&!e)return this;var n=new this.constructor(p),o=i._result;if(r){var s=arguments[r-1];N(function(){L(r,n,s,o)})}else E(i,n,t,e);return n},"catch":function(t){return this.then(null,t)}};var ie=function(){var t;t="undefined"!=typeof r?r:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),o(e)}();e||(t.Promise=ee)},re={Promise:ee,polyfill:ie};"function"==typeof t&&t.amd?t(function(){return re}):"undefined"!=typeof i&&i.exports?i.exports=re:"undefined"!=typeof this&&(this.ES6Promise=re)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(t,e){function i(){if(!s){s=!0;for(var t,e=o.length;e;){t=o,o=[];for(var i=-1;++in;)e=t.charCodeAt(n++),e>=55296&&56319>=e&&o>n?(i=t.charCodeAt(n++),56320==(64512&i)?r.push(((1023&e)<<10)+(1023&i)+65536):(r.push(e),n--)):r.push(e);return r}function l(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=k(t>>>10&1023|55296),t=56320|1023&t),e+=k(t)}).join("")}function u(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function c(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function d(t,e,i){var r=0;for(t=i?D(t/_):t>>1,t+=D(t/e);t>O*E>>1;r+=S)t=D(t/O);return D(r+(O+1)*t/(t+A))}function p(t){var e,i,r,n,s,a,h,c,p,f,g=[],m=t.length,v=0,y=L,x=M;for(i=t.lastIndexOf(R),0>i&&(i=0),r=0;i>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),g.push(t.charCodeAt(r));for(n=i>0?i+1:0;m>n;){for(s=v,a=1,h=S;n>=m&&o("invalid-input"),c=u(t.charCodeAt(n++)),(c>=S||c>D((T-v)/a))&&o("overflow"),v+=c*a,p=x>=h?C:h>=x+E?E:h-x,!(p>c);h+=S)f=S-p,a>D(T/f)&&o("overflow"),a*=f;e=g.length+1,x=d(v-s,e,0==s),D(v/e)>T-y&&o("overflow"),y+=D(v/e),v%=e,g.splice(v++,0,y)}return l(g)}function f(t){var e,i,r,n,s,a,l,u,p,f,g,m,v,y,x,b=[];for(t=h(t),m=t.length,e=L,i=0,s=M,a=0;m>a;++a)g=t[a],128>g&&b.push(k(g));for(r=n=b.length,n&&b.push(R);m>r;){for(l=T,a=0;m>a;++a)g=t[a],g>=e&&l>g&&(l=g);for(v=r+1,l-e>D((T-i)/v)&&o("overflow"),i+=(l-e)*v,e=l,a=0;m>a;++a)if(g=t[a],e>g&&++i>T&&o("overflow"),g==e){for(u=i,p=S;f=s>=p?C:p>=s+E?E:p-s,!(f>u);p+=S)x=u-f,y=S-f,b.push(k(c(f+x%y,0))),u=D(x/y);b.push(k(c(u,0))),s=d(i,v,r==n),i=0,++r}++i,++e}return b.join("")}function g(t){return a(t,function(t){return P.test(t)?p(t.slice(4).toLowerCase()):t})}function m(t){return a(t,function(t){return F.test(t)?"xn--"+f(t):t})}var v="object"==typeof r&&r,y="object"==typeof i&&i&&i.exports==v&&i,x="object"==typeof e&&e;(x.global===x||x.window===x)&&(n=x);var b,w,T=2147483647,S=36,C=1,E=26,A=38,_=700,M=72,L=128,R="-",P=/^xn--/,F=/[^ -~]/,B=/\x2E|\u3002|\uFF0E|\uFF61/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=S-C,D=Math.floor,k=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:h,encode:l},decode:p,encode:f,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&!v.nodeType)if(y)y.exports=b;else for(w in b)b.hasOwnProperty(w)&&(v[w]=b[w]);else n.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(t,e){function i(t,e,i){for(var r=t.getElementsByTagName(i),n=e.getElementsByTagName(i),o=r.length,s=0;o>s;s++)n[s].value=r[s].value}function r(t,e,i){!t.defaultView||e===t.defaultView.pageXOffset&&i===t.defaultView.pageYOffset||t.defaultView.scrollTo(e,i)}function n(t){[].slice.call(t.querySelectorAll("canvas"),0).forEach(function(t){t.setAttribute(d,"canvas-"+p++)})}function o(t,e){[].slice.call(t.querySelectorAll("["+d+"]"),0).forEach(function(t){try{var i=e.querySelector("["+d+'="'+t.getAttribute(d)+'"]');i&&(i.width=t.width,i.height=t.height,i.getContext("2d").putImageData(t.getContext("2d").getImageData(0,0,t.width,t.height),0,0))}catch(r){u("Unable to copy canvas content from",t,r)}t.removeAttribute(d)})}function s(t){return[].slice.call(t.childNodes,0).filter(l).forEach(function(e){"SCRIPT"===e.tagName?t.removeChild(e):s(e)}),t}function a(){return document.documentMode&&document.documentMode<=9}function h(t,e){for(var i=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),r=t.firstChild;r;)(e===!0||1!==r.nodeType||"SCRIPT"!==r.nodeName)&&i.appendChild(h(r,e)),r=r.nextSibling;return i}function l(t){return t.nodeType===Node.ELEMENT_NODE}var u=t("./log"),c=t("./promise"),d="data-html2canvas-canvas-clone",p=0;e.exports=function(t,e,l,u,d,p,f){n(t);var g=a()?h(t.documentElement,d.javascriptEnabled):t.documentElement.cloneNode(!0),m=e.createElement("iframe");return m.className="html2canvas-container",m.style.visibility="hidden",m.style.position="fixed",m.style.left="-10000px",m.style.top="0px",m.style.border="0",m.width=l,m.height=u,m.scrolling="no",e.body.appendChild(m),new c(function(e){var n=m.contentWindow.document;i(t.documentElement,g,"textarea"),i(t.documentElement,g,"select"),m.contentWindow.onload=m.onload=function(){var i=setInterval(function(){n.body.childNodes.length>0&&(o(t,n),clearInterval(i),"view"===d.type&&m.contentWindow.scrollTo(p,f),e(m))},50)},n.open(),n.write(""),r(t,p,f),n.replaceChild(d.javascriptEnabled===!0?n.adoptNode(g):s(n.adoptNode(g)),n.documentElement),n.close()})}},{"./log":15,"./promise":18}],5:[function(t,e){function i(t){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(t)||this.namedColor(t)||this.rgb(t)||this.rgba(t)||this.hex6(t)||this.hex3(t)}i.prototype.darken=function(t){var e=1-t;return new i([Math.round(this.r*e),Math.round(this.g*e),Math.round(this.b*e),this.a])},i.prototype.isTransparent=function(){return 0===this.a},i.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},i.prototype.fromArray=function(t){return Array.isArray(t)&&(this.r=Math.min(t[0],255),this.g=Math.min(t[1],255),this.b=Math.min(t[2],255),t.length>3&&(this.a=t[3])),Array.isArray(t)};var r=/^#([a-f0-9]{3})$/i;i.prototype.hex3=function(t){var e=null;return null!==(e=t.match(r))&&(this.r=parseInt(e[1][0]+e[1][0],16),this.g=parseInt(e[1][1]+e[1][1],16),this.b=parseInt(e[1][2]+e[1][2],16)),null!==e};var n=/^#([a-f0-9]{6})$/i;i.prototype.hex6=function(t){var e=null;return null!==(e=t.match(n))&&(this.r=parseInt(e[1].substring(0,2),16),this.g=parseInt(e[1].substring(2,4),16),this.b=parseInt(e[1].substring(4,6),16)),null!==e};var o=/^rgb\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3})\)$/;i.prototype.rgb=function(t){var e=null;return null!==(e=t.match(o))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3])),null!==e};var s=/^rgba\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *, *(\d+\.?\d*)\)$/;i.prototype.rgba=function(t){var e=null;return null!==(e=t.match(s))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3]),this.a=Number(e[4])),null!==e},i.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},i.prototype.namedColor=function(t){var e=a[t.toLowerCase()];if(e)this.r=e[0],this.g=e[1],this.b=e[2];else if("transparent"===t.toLowerCase())return this.r=this.g=this.b=this.a=0,!0;return!!e},i.prototype.isColor=!0;var a={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};e.exports=i},{}],6:[function(t,e){function i(t,e){var i=T++;if(e=e||{},e.logging&&(window.html2canvas.logging=!0,window.html2canvas.start=Date.now()),e.async="undefined"==typeof e.async?!0:e.async,e.allowTaint="undefined"==typeof e.allowTaint?!1:e.allowTaint,e.removeContainer="undefined"==typeof e.removeContainer?!0:e.removeContainer,e.javascriptEnabled="undefined"==typeof e.javascriptEnabled?!1:e.javascriptEnabled,e.imageTimeout="undefined"==typeof e.imageTimeout?1e4:e.imageTimeout,e.renderer="function"==typeof e.renderer?e.renderer:d,e.strict=!!e.strict,"string"==typeof t){if("string"!=typeof e.proxy)return u.reject("Proxy must be used when rendering url");var o=null!=e.width?e.width:window.innerWidth,s=null!=e.height?e.height:window.innerHeight;return x(l(t),e.proxy,document,o,s,e).then(function(t){return n(t.contentWindow.document.documentElement,t,e,o,s)})}var a=(void 0===t?[document.documentElement]:t.length?t:[t])[0];return a.setAttribute(w+i,i),r(a.ownerDocument,e,a.ownerDocument.defaultView.innerWidth,a.ownerDocument.defaultView.innerHeight,i).then(function(t){return"function"==typeof e.onrendered&&(m("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),e.onrendered(t)),t})}function r(t,e,i,r,o){return y(t,t,i,r,e,t.defaultView.pageXOffset,t.defaultView.pageYOffset).then(function(s){m("Document cloned");var a=w+o,h="["+a+"='"+o+"']";t.querySelector(h).removeAttribute(a);var l=s.contentWindow,c=l.document.querySelector(h);"0"===c.style.opacity&&"webgl"===c.getAttribute("renderer")?c.style.opacity=1:null;var d=u.resolve("function"==typeof e.onclone?e.onclone(l.document):!0);return d.then(function(){return n(c,s,e,i,r)})})}function n(t,e,i,r,n){var l=e.contentWindow,u=new c(l.document),d=new p(i,u),g=b(t),v="view"===i.type?r:a(l.document),y="view"===i.type?n:h(l.document),x=new i.renderer(v,y,d,i,document),w=new f(t,x,u,d,i);return w.ready.then(function(){m("Finished rendering");var r;return r="view"===i.type?s(x.canvas,{width:x.canvas.width,height:x.canvas.height,top:0,left:0,x:0,y:0}):t===l.document.body||t===l.document.documentElement||null!=i.canvas?x.canvas:s(x.canvas,{width:null!=i.width?i.width:g.width,height:null!=i.height?i.height:g.height,top:g.top,left:g.left,x:l.pageXOffset,y:l.pageYOffset}),o(e,i),r})}function o(t,e){e.removeContainer&&(t.parentNode.removeChild(t),m("Cleaned up container"))}function s(t,e){var i=document.createElement("canvas"),r=Math.min(t.width-1,Math.max(0,e.left)),n=Math.min(t.width,Math.max(1,e.left+e.width)),o=Math.min(t.height-1,Math.max(0,e.top)),s=Math.min(t.height,Math.max(1,e.top+e.height));return i.width=e.width,i.height=e.height,m("Cropping canvas at:","left:",e.left,"top:",e.top,"width:",n-r,"height:",s-o),m("Resulting crop with width",e.width,"and height",e.height," with x",r,"and y",o),i.getContext("2d").drawImage(t,r,o,n-r,s-o,e.x,e.y,n-r,s-o),i}function a(t){return Math.max(Math.max(t.body.scrollWidth,t.documentElement.scrollWidth),Math.max(t.body.offsetWidth,t.documentElement.offsetWidth),Math.max(t.body.clientWidth,t.documentElement.clientWidth))}function h(t){return Math.max(Math.max(t.body.scrollHeight,t.documentElement.scrollHeight),Math.max(t.body.offsetHeight,t.documentElement.offsetHeight),Math.max(t.body.clientHeight,t.documentElement.clientHeight))}function l(t){var e=document.createElement("a");return e.href=t,e.href=e.href,e}var u=t("./promise"),c=t("./support"),d=t("./renderers/canvas"),p=t("./imageloader"),f=t("./nodeparser"),g=t("./nodecontainer"),m=t("./log"),v=t("./utils"),y=t("./clone"),x=t("./proxy").loadUrlDocument,b=v.getBounds,w="data-html2canvas-node",T=0;i.Promise=u,i.CanvasRenderer=d,i.NodeContainer=g,i.log=m,i.utils=v,e.exports="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return u.reject("No canvas support")}:i},{"./clone":4,"./imageloader":13,"./log":15,"./nodecontainer":16,"./nodeparser":17,"./promise":18,"./proxy":19,"./renderers/canvas":23,"./support":25,"./utils":29}],7:[function(t,e){function i(t){if(this.src=t,n("DummyImageContainer for",t),!this.promise||!this.image){n("Initiating DummyImageContainer"),i.prototype.image=new Image;var e=this.image;i.prototype.promise=new r(function(t,i){e.onload=t,e.onerror=i,e.src=o(),e.complete===!0&&t(e)})}}var r=t("./promise"),n=t("./log"),o=t("./utils").smallImage;e.exports=i},{"./log":15,"./promise":18,"./utils":29}],8:[function(t,e){function i(t,e){var i,n,o=document.createElement("div"),s=document.createElement("img"),a=document.createElement("span"),h="Hidden Text";o.style.visibility="hidden",o.style.fontFamily=t,o.style.fontSize=e,o.style.margin=0,o.style.padding=0,document.body.appendChild(o),s.src=r(),s.width=1,s.height=1,s.style.margin=0,s.style.padding=0,s.style.verticalAlign="baseline",a.style.fontFamily=t,a.style.fontSize=e,a.style.margin=0,a.style.padding=0,a.appendChild(document.createTextNode(h)),o.appendChild(a),o.appendChild(s),i=s.offsetTop-a.offsetTop+1,o.removeChild(a),o.appendChild(document.createTextNode(h)),o.style.lineHeight="normal",s.style.verticalAlign="super",n=s.offsetTop-o.offsetTop+1,document.body.removeChild(o),this.baseline=i,this.lineWidth=1,this.middle=n}var r=t("./utils").smallImage;e.exports=i},{"./utils":29}],9:[function(t,e){function i(){this.data={}}var r=t("./font");i.prototype.getMetrics=function(t,e){return void 0===this.data[t+"-"+e]&&(this.data[t+"-"+e]=new r(t,e)),this.data[t+"-"+e]},e.exports=i},{"./font":8}],10:[function(t,e){function i(e,i,r){this.image=null,this.src=e;var s=this,a=o(e);this.promise=(i?new n(function(t){"about:blank"===e.contentWindow.document.URL||null==e.contentWindow.document.documentElement?e.contentWindow.onload=e.onload=function(){t(e)}:t(e)}):this.proxyLoad(r.proxy,a,r)).then(function(e){var i=t("./core");return i(e.contentWindow.document.documentElement,{type:"view",width:e.width,height:e.height,proxy:r.proxy,javascriptEnabled:r.javascriptEnabled,removeContainer:r.removeContainer,allowTaint:r.allowTaint,imageTimeout:r.imageTimeout/2})}).then(function(t){return s.image=t})}var r=t("./utils"),n=t("./promise"),o=r.getBounds,s=t("./proxy").loadUrlDocument;i.prototype.proxyLoad=function(t,e,i){var r=this.src;return s(r.src,t,r.ownerDocument,e.width,e.height,i)},e.exports=i},{"./core":6,"./promise":18,"./proxy":19,"./utils":29}],11:[function(t,e){function i(t){this.src=t.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=r.resolve(!0)}var r=t("./promise");i.prototype.TYPES={LINEAR:1,RADIAL:2},e.exports=i},{"./promise":18}],12:[function(t,e){function i(t,e){this.src=t,this.image=new Image;var i=this;this.tainted=null,this.promise=new r(function(r,n){i.image.onload=r,i.image.onerror=n,e&&(i.image.crossOrigin="anonymous"),i.image.src=t,i.image.complete===!0&&r(i.image)})}var r=t("./promise");e.exports=i},{"./promise":18}],13:[function(t,e){function i(t,e){this.link=null,this.options=t,this.support=e,this.origin=this.getOrigin(window.location.href)}var r=t("./promise"),n=t("./log"),o=t("./imagecontainer"),s=t("./dummyimagecontainer"),a=t("./proxyimagecontainer"),h=t("./framecontainer"),l=t("./svgcontainer"),u=t("./svgnodecontainer"),c=t("./lineargradientcontainer"),d=t("./webkitgradientcontainer"),p=t("./utils").bind;i.prototype.findImages=function(t){var e=[];return t.reduce(function(t,e){switch(e.node.nodeName){case"IMG":return t.concat([{args:[e.node.src],method:"url"}]);case"svg":case"IFRAME":return t.concat([{args:[e.node],method:e.node.nodeName}])}return t},[]).forEach(this.addImage(e,this.loadImage),this),e},i.prototype.findBackgroundImage=function(t,e){return e.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(t,this.loadImage),this),t},i.prototype.addImage=function(t,e){return function(i){i.args.forEach(function(r){this.imageExists(t,r)||(t.splice(0,0,e.call(this,i)),n("Added image #"+t.length,"string"==typeof r?r.substring(0,100):r))},this)}},i.prototype.hasImageBackground=function(t){return"none"!==t.method},i.prototype.loadImage=function(t){if("url"===t.method){var e=t.args[0];return!this.isSVG(e)||this.support.svg||this.options.allowTaint?e.match(/data:image\/.*;base64,/i)?new o(e.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(e)||this.options.allowTaint===!0||this.isSVG(e)?new o(e,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new o(e,!0):this.options.proxy?new a(e,this.options.proxy):new s(e):new l(e)}return"linear-gradient"===t.method?new c(t):"gradient"===t.method?new d(t):"svg"===t.method?new u(t.args[0],this.support.svg):"IFRAME"===t.method?new h(t.args[0],this.isSameOrigin(t.args[0].src),this.options):new s(t)},i.prototype.isSVG=function(t){return"svg"===t.substring(t.length-3).toLowerCase()||l.prototype.isInline(t)},i.prototype.imageExists=function(t,e){return t.some(function(t){return t.src===e})},i.prototype.isSameOrigin=function(t){return this.getOrigin(t)===this.origin},i.prototype.getOrigin=function(t){var e=this.link||(this.link=document.createElement("a"));return e.href=t,e.href=e.href,e.protocol+e.hostname+e.port},i.prototype.getPromise=function(t){return this.timeout(t,this.options.imageTimeout)["catch"](function(){var e=new s(t.src);return e.promise.then(function(e){t.image=e})})},i.prototype.get=function(t){var e=null;return this.images.some(function(i){return(e=i).src===t})?e:null},i.prototype.fetch=function(t){return this.images=t.reduce(p(this.findBackgroundImage,this),this.findImages(t)),this.images.forEach(function(t,e){t.promise.then(function(){n("Succesfully loaded image #"+(e+1),t)},function(i){n("Failed loading image #"+(e+1),t,i)})}),this.ready=r.all(this.images.map(this.getPromise,this)),n("Finished searching images"),this},i.prototype.timeout=function(t,e){var i,o=r.race([t.promise,new r(function(r,o){i=setTimeout(function(){n("Timed out loading image",t),o(t)},e)})]).then(function(t){return clearTimeout(i),t});return o["catch"](function(){clearTimeout(i)}),o},e.exports=i},{"./dummyimagecontainer":7,"./framecontainer":10,"./imagecontainer":12,"./lineargradientcontainer":14,"./log":15,"./promise":18,"./proxyimagecontainer":20,"./svgcontainer":26,"./svgnodecontainer":27,"./utils":29,"./webkitgradientcontainer":30}],14:[function(t,e){function i(t){r.apply(this,arguments),this.type=this.TYPES.LINEAR;var e=null===t.args[0].match(this.stepRegExp);e?t.args[0].split(" ").reverse().forEach(function(t){switch(t){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var e=this.y0,i=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=i,this.y1=e}},this):(this.y0=0,this.y1=1),this.colorStops=t.args.slice(e?1:0).map(function(t){var e=t.match(this.stepRegExp);return{color:new n(e[1]),stop:"%"===e[3]?e[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(t,e){null===t.stop&&this.colorStops.slice(e).some(function(i,r){return null!==i.stop?(t.stop=(i.stop-this.colorStops[e-1].stop)/(r+1)+this.colorStops[e-1].stop,!0):!1 -},this)},this)}var r=t("./gradientcontainer"),n=t("./color");i.prototype=Object.create(r.prototype),i.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,e.exports=i},{"./color":5,"./gradientcontainer":11}],15:[function(t,e){e.exports=function(){window.html2canvas.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-window.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}},{}],16:[function(t,e){function i(t,e){this.node=t,this.parent=e,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function r(t){var e=t.options[t.selectedIndex||0];return e?e.text||"":""}function n(t){return t&&"matrix"===t[1]?t[2].split(",").map(function(t){return parseFloat(t.trim())}):void 0}function o(t){return-1!==t.toString().indexOf("%")}function s(t){return t.replace("px","")}function a(t){return parseFloat(t)}var h=t("./color"),l=t("./utils"),u=l.getBounds,c=l.parseBackgrounds,d=l.offsetBounds;i.prototype.cloneTo=function(t){t.visible=this.visible,t.borders=this.borders,t.bounds=this.bounds,t.clip=this.clip,t.backgroundClip=this.backgroundClip,t.computedStyles=this.computedStyles,t.styles=this.styles,t.backgroundImages=this.backgroundImages,t.opacity=this.opacity},i.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},i.prototype.assignStack=function(t){this.stack=t,t.children.push(this)},i.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},i.prototype.css=function(t){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[t]||(this.styles[t]=this.computedStyles[t])},i.prototype.prefixedCss=function(t){var e=["webkit","moz","ms","o"],i=this.css(t);return void 0===i&&e.some(function(e){return i=this.css(e+t.substr(0,1).toUpperCase()+t.substr(1)),void 0!==i},this),void 0===i?null:i},i.prototype.computedStyle=function(t){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,t)},i.prototype.cssInt=function(t){var e=parseInt(this.css(t),10);return isNaN(e)?0:e},i.prototype.color=function(t){return this.colors[t]||(this.colors[t]=new h(this.css(t)))},i.prototype.cssFloat=function(t){var e=parseFloat(this.css(t));return isNaN(e)?0:e},i.prototype.fontWeight=function(){var t=this.css("fontWeight");switch(parseInt(t,10)){case 401:t="bold";break;case 400:t="normal"}return t},i.prototype.parseClip=function(){var t=this.css("clip").match(this.CLIP);return t?{top:parseInt(t[1],10),right:parseInt(t[2],10),bottom:parseInt(t[3],10),left:parseInt(t[4],10)}:null},i.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=c(this.css("backgroundImage")))},i.prototype.cssList=function(t,e){var i=(this.css(t)||"").split(",");return i=i[e||0]||i[0]||"auto",i=i.trim().split(" "),1===i.length&&(i=[i[0],o(i[0])?"auto":i[0]]),i},i.prototype.parseBackgroundSize=function(t,e,i){var r,n,s=this.cssList("backgroundSize",i);if(o(s[0]))r=t.width*parseFloat(s[0])/100;else{if(/contain|cover/.test(s[0])){var a=t.width/t.height,h=e.width/e.height;return h>a^"contain"===s[0]?{width:t.height*h,height:t.height}:{width:t.width,height:t.width/h}}r=parseInt(s[0],10)}return n="auto"===s[0]&&"auto"===s[1]?e.height:"auto"===s[1]?r/e.width*e.height:o(s[1])?t.height*parseFloat(s[1])/100:parseInt(s[1],10),"auto"===s[0]&&(r=n/e.height*e.width),{width:r,height:n}},i.prototype.parseBackgroundPosition=function(t,e,i,r){var n,s,a=this.cssList("backgroundPosition",i);return n=o(a[0])?(t.width-(r||e).width)*(parseFloat(a[0])/100):parseInt(a[0],10),s="auto"===a[1]?n/e.width*e.height:o(a[1])?(t.height-(r||e).height)*parseFloat(a[1])/100:parseInt(a[1],10),"auto"===a[0]&&(n=s/e.height*e.width),{left:n,top:s}},i.prototype.parseBackgroundRepeat=function(t){return this.cssList("backgroundRepeat",t)[0]},i.prototype.parseTextShadows=function(){var t=this.css("textShadow"),e=[];if(t&&"none"!==t)for(var i=t.match(this.TEXT_SHADOW_PROPERTY),r=0;i&&r0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,t)):t():(this.renderQueue.forEach(this.paint,this),t())},this))},this))}function r(t){return t.parent&&t.parent.clip.length}function n(t){return t.replace(/(\-[a-z])/g,function(t){return t.toUpperCase().replace("-","")})}function o(){}function s(t,e,i,r){return t.map(function(n,o){if(n.width>0){var s=e.left,a=e.top,h=e.width,l=e.height-t[2].width;switch(o){case 0:l=t[0].width,n.args=u({c1:[s,a],c2:[s+h,a],c3:[s+h-t[1].width,a+l],c4:[s+t[3].width,a+l]},r[0],r[1],i.topLeftOuter,i.topLeftInner,i.topRightOuter,i.topRightInner);break;case 1:s=e.left+e.width-t[1].width,h=t[1].width,n.args=u({c1:[s+h,a],c2:[s+h,a+l+t[2].width],c3:[s,a+l],c4:[s,a+t[0].width]},r[1],r[2],i.topRightOuter,i.topRightInner,i.bottomRightOuter,i.bottomRightInner);break;case 2:a=a+e.height-t[2].width,l=t[2].width,n.args=u({c1:[s+h,a+l],c2:[s,a+l],c3:[s+t[3].width,a],c4:[s+h-t[3].width,a]},r[2],r[3],i.bottomRightOuter,i.bottomRightInner,i.bottomLeftOuter,i.bottomLeftInner);break;case 3:h=t[3].width,n.args=u({c1:[s,a+l+t[2].width],c2:[s,a],c3:[s+h,a+t[0].width],c4:[s+h,a+l]},r[3],r[0],i.bottomLeftOuter,i.bottomLeftInner,i.topLeftOuter,i.topLeftInner)}}return n})}function a(t,e,i,r){var n=4*((Math.sqrt(2)-1)/3),o=i*n,s=r*n,a=t+i,h=e+r;return{topLeft:l({x:t,y:h},{x:t,y:h-s},{x:a-o,y:e},{x:a,y:e}),topRight:l({x:t,y:e},{x:t+o,y:e},{x:a,y:h-s},{x:a,y:h}),bottomRight:l({x:a,y:e},{x:a,y:e+s},{x:t+o,y:h},{x:t,y:h}),bottomLeft:l({x:a,y:h},{x:a-o,y:h},{x:t,y:e+s},{x:t,y:e})}}function h(t,e,i){var r=t.left,n=t.top,o=t.width,s=t.height,h=e[0][0],l=e[0][1],u=e[1][0],c=e[1][1],d=e[2][0],p=e[2][1],f=e[3][0],g=e[3][1],m=Math.floor(s/2);h=h>m?m:h,l=l>m?m:l,u=u>m?m:u,c=c>m?m:c,d=d>m?m:d,p=p>m?m:p,f=f>m?m:f,g=g>m?m:g;var v=o-u,y=s-p,x=o-d,b=s-g;return{topLeftOuter:a(r,n,h,l).topLeft.subdivide(.5),topLeftInner:a(r+i[3].width,n+i[0].width,Math.max(0,h-i[3].width),Math.max(0,l-i[0].width)).topLeft.subdivide(.5),topRightOuter:a(r+v,n,u,c).topRight.subdivide(.5),topRightInner:a(r+Math.min(v,o+i[3].width),n+i[0].width,v>o+i[3].width?0:u-i[3].width,c-i[0].width).topRight.subdivide(.5),bottomRightOuter:a(r+x,n+y,d,p).bottomRight.subdivide(.5),bottomRightInner:a(r+Math.min(x,o-i[3].width),n+Math.min(y,s+i[0].width),Math.max(0,d-i[1].width),p-i[2].width).bottomRight.subdivide(.5),bottomLeftOuter:a(r,n+b,f,g).bottomLeft.subdivide(.5),bottomLeftInner:a(r+i[3].width,n+b,Math.max(0,f-i[3].width),g-i[2].width).bottomLeft.subdivide(.5)}}function l(t,e,i,r){var n=function(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}};return{start:t,startControl:e,endControl:i,end:r,subdivide:function(o){var s=n(t,e,o),a=n(e,i,o),h=n(i,r,o),u=n(s,a,o),c=n(a,h,o),d=n(u,c,o);return[l(t,s,u,d),l(d,c,h,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,i.x,i.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",i.x,i.y,e.x,e.y,t.x,t.y])}}}function u(t,e,i,r,n,o,s){var a=[];return e[0]>0||e[1]>0?(a.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(a)):a.push(["line",t.c1[0],t.c1[1]]),i[0]>0||i[1]>0?(a.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(a),a.push(["line",s[0].end.x,s[0].end.y]),s[0].curveToReversed(a)):(a.push(["line",t.c2[0],t.c2[1]]),a.push(["line",t.c3[0],t.c3[1]])),e[0]>0||e[1]>0?(a.push(["line",n[1].end.x,n[1].end.y]),n[1].curveToReversed(a)):a.push(["line",t.c4[0],t.c4[1]]),a}function c(t,e,i,r,n,o,s){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",o,s]),(i[0]>0||i[1]>0)&&t.push(["line",n[0].start.x,n[0].start.y])}function d(t){return t.cssInt("zIndex")<0}function p(t){return t.cssInt("zIndex")>0}function f(t){return 0===t.cssInt("zIndex")}function g(t){return-1!==["inline","inline-block","inline-table"].indexOf(t.css("display"))}function m(t){return t instanceof z}function v(t){return t.node.data.trim().length>0}function y(t){return/^(normal|none|0px)$/.test(t.parent.css("letterSpacing"))}function x(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){var i=t.css("border"+e+"Radius"),r=i.split(" ");return r.length<=1&&(r[1]=r[0]),r.map(P)})}function b(t){return t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE}function w(t){var e=t.css("position"),i=-1!==["absolute","relative","fixed"].indexOf(e)?t.css("zIndex"):"auto";return"auto"!==i}function T(t){return"static"!==t.css("position")}function S(t){return"none"!==t.css("float")}function C(t){return-1!==["inline-block","inline-table"].indexOf(t.css("display"))}function E(t){var e=this;return function(){return!t.apply(e,arguments)}}function A(t){return t.node.nodeType===Node.ELEMENT_NODE}function _(t){return t.isPseudoElement===!0}function M(t){return t.node.nodeType===Node.TEXT_NODE}function L(t){return function(e,i){return e.cssInt("zIndex")+t.indexOf(e)/t.length-(i.cssInt("zIndex")+t.indexOf(i)/t.length)}}function R(t){return t.getOpacity()<1}function P(t){return parseInt(t,10)}function F(t){return t.width}function B(t){return t.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(t.node.nodeName)}function I(t){return[].concat.apply([],t)}function O(t){var e=t.substr(0,1);return e===t.substr(t.length-1)&&e.match(/'|"/)?t.substr(1,t.length-2):t}function D(t){for(var e,i=[],r=0,n=!1;t.length;)k(t[r])===n?(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)),n=!n,r=0):r++,r>=t.length&&(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)));return i}function k(t){return-1!==[32,13,10,9,45].indexOf(t)}function G(t){return/[^\u0000-\u00ff]/.test(t)}var N=t("./log"),U=t("punycode"),j=t("./nodecontainer"),V=t("./textcontainer"),W=t("./pseudoelementcontainer"),H=t("./fontmetrics"),Y=t("./color"),X=t("./promise"),z=t("./stackingcontext"),q=t("./utils"),K=q.bind,$=q.getBounds,Q=q.parseBackgrounds,J=q.offsetBounds;i.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(t){if(A(t)){_(t)&&t.appendToDOM(),t.borders=this.parseBorders(t);var e="hidden"===t.css("overflow")?[t.borders.clip]:[],i=t.parseClip();i&&-1!==["absolute","fixed"].indexOf(t.css("position"))&&e.push([["rect",t.bounds.left+i.left,t.bounds.top+i.top,i.right-i.left,i.bottom-i.top]]),t.clip=r(t)?t.parent.clip.concat(e):e,t.backgroundClip="hidden"!==t.css("overflow")?t.clip.concat([t.borders.clip]):t.clip,_(t)&&t.cleanDOM()}else M(t)&&(t.clip=r(t)?t.parent.clip:[]);_(t)||(t.bounds=null)},this)},i.prototype.asyncRenderer=function(t,e,i){i=i||Date.now(),this.paint(t[this.renderIndex++]),t.length===this.renderIndex?e():i+20>Date.now()?this.asyncRenderer(t,e,i):setTimeout(K(function(){this.asyncRenderer(t,e)},this),0)},i.prototype.createPseudoHideStyles=function(t){this.createStyles(t,"."+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},i.prototype.disableAnimations=function(t){this.createStyles(t,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},i.prototype.createStyles=function(t,e){var i=t.createElement("style");i.innerHTML=e,t.body.appendChild(i)},i.prototype.getPseudoElements=function(t){var e=[[t]];if(t.node.nodeType===Node.ELEMENT_NODE){var i=this.getPseudoElement(t,":before"),r=this.getPseudoElement(t,":after");i&&e.push(i),r&&e.push(r)}return I(e)},i.prototype.getPseudoElement=function(t,e){var i=t.computedStyle(e);if(!i||!i.content||"none"===i.content||"-moz-alt-content"===i.content||"none"===i.display)return null;for(var r=O(i.content),o="url"===r.substr(0,3),s=document.createElement(o?"img":"html2canvaspseudoelement"),a=new W(s,t,e),h=i.length-1;h>=0;h--){var l=n(i.item(h));s.style[l]=i[l]}if(s.className=W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,o)return s.src=Q(r)[0].args[0],[a];var u=document.createTextNode(r);return s.appendChild(u),[a,new V(u,a)]},i.prototype.getChildren=function(t){return I([].filter.call(t.node.childNodes,b).map(function(e){var i=[e.nodeType===Node.TEXT_NODE?new V(e,t):new j(e,t)].filter(B);return e.nodeType===Node.ELEMENT_NODE&&i.length&&"TEXTAREA"!==e.tagName?i[0].isElementVisible()?i.concat(this.getChildren(i[0])):[]:i},this))},i.prototype.newStackingContext=function(t,e){var i=new z(e,t.getOpacity(),t.node,t.parent);t.cloneTo(i);var r=e?i.getParentStack(this):i.parent.stack;r.contexts.push(i),t.stack=i},i.prototype.createStackingContexts=function(){this.nodes.forEach(function(t){A(t)&&(this.isRootElement(t)||R(t)||w(t)||this.isBodyWithTransparentRoot(t)||t.hasTransform())?this.newStackingContext(t,!0):A(t)&&(T(t)&&f(t)||C(t)||S(t))?this.newStackingContext(t,!1):t.assignStack(t.parent.stack)},this)},i.prototype.isBodyWithTransparentRoot=function(t){return"BODY"===t.node.nodeName&&t.parent.color("backgroundColor").isTransparent()},i.prototype.isRootElement=function(t){return null===t.parent},i.prototype.sortStackingContexts=function(t){t.contexts.sort(L(t.contexts.slice(0))),t.contexts.forEach(this.sortStackingContexts,this)},i.prototype.parseTextBounds=function(t){return function(e,i,r){if("none"!==t.parent.css("textDecoration").substr(0,4)||0!==e.trim().length){if(this.support.rangeBounds&&!t.parent.hasTransform()){var n=r.slice(0,i).join("").length;return this.getRangeBounds(t.node,n,e.length)}if(t.node&&"string"==typeof t.node.data){var o=t.node.splitText(e.length),s=this.getWrapperBounds(t.node,t.parent.hasTransform());return t.node=o,s}}else(!this.support.rangeBounds||t.parent.hasTransform())&&(t.node=t.node.splitText(e.length));return{}}},i.prototype.getWrapperBounds=function(t,e){var i=t.ownerDocument.createElement("html2canvaswrapper"),r=t.parentNode,n=t.cloneNode(!0);i.appendChild(t.cloneNode(!0)),r.replaceChild(i,t);var o=e?J(i):$(i);return r.replaceChild(n,i),o},i.prototype.getRangeBounds=function(t,e,i){var r=this.range||(this.range=t.ownerDocument.createRange());return r.setStart(t,e),r.setEnd(t,e+i),r.getBoundingClientRect()},i.prototype.parse=function(t){var e=t.contexts.filter(d),i=t.children.filter(A),r=i.filter(E(S)),n=r.filter(E(T)).filter(E(g)),s=i.filter(E(T)).filter(S),a=r.filter(E(T)).filter(g),h=t.contexts.concat(r.filter(T)).filter(f),l=t.children.filter(M).filter(v),u=t.contexts.filter(p);e.concat(n).concat(s).concat(a).concat(h).concat(l).concat(u).forEach(function(t){this.renderQueue.push(t),m(t)&&(this.parse(t),this.renderQueue.push(new o))},this)},i.prototype.paint=function(t){try{t instanceof o?this.renderer.ctx.restore():M(t)?(_(t.parent)&&t.parent.appendToDOM(),this.paintText(t),_(t.parent)&&t.parent.cleanDOM()):this.paintNode(t)}catch(e){if(N(e),this.options.strict)throw e}},i.prototype.paintNode=function(t){m(t)&&(this.renderer.setOpacity(t.opacity),this.renderer.ctx.save(),t.hasTransform()&&this.renderer.setTransform(t.parseTransform())),"INPUT"===t.node.nodeName&&"checkbox"===t.node.type?this.paintCheckbox(t):"INPUT"===t.node.nodeName&&"radio"===t.node.type?this.paintRadio(t):this.paintElement(t)},i.prototype.paintElement=function(t){var e=t.parseBounds();this.renderer.clip(t.backgroundClip,function(){this.renderer.renderBackground(t,e,t.borders.borders.map(F))},this),this.renderer.clip(t.clip,function(){this.renderer.renderBorders(t.borders.borders)},this),this.renderer.clip(t.backgroundClip,function(){switch(t.node.nodeName){case"svg":case"IFRAME":var i=this.images.get(t.node);i?this.renderer.renderImage(t,e,t.borders,i):N("Error loading <"+t.node.nodeName+">",t.node);break;case"IMG":var r=this.images.get(t.node.src);r?this.renderer.renderImage(t,e,t.borders,r):N("Error loading ",t.node.src);break;case"CANVAS":this.renderer.renderImage(t,e,t.borders,{image:t.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(t)}},this)},i.prototype.paintCheckbox=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height),r={width:i-1,height:i-1,top:e.top,left:e.left},n=[3,3],o=[n,n,n,n],a=[1,1,1,1].map(function(t){return{color:new Y("#A5A5A5"),width:t}}),l=h(r,o,a);this.renderer.clip(t.backgroundClip,function(){this.renderer.rectangle(r.left+1,r.top+1,r.width-2,r.height-2,new Y("#DEDEDE")),this.renderer.renderBorders(s(a,r,l,o)),t.node.checked&&(this.renderer.font(new Y("#424242"),"normal","normal","bold",i-3+"px","arial"),this.renderer.text("✔",r.left+i/6,r.top+i-1))},this)},i.prototype.paintRadio=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height)-2;this.renderer.clip(t.backgroundClip,function(){this.renderer.circleStroke(e.left+1,e.top+1,i,new Y("#DEDEDE"),1,new Y("#A5A5A5")),t.node.checked&&this.renderer.circle(Math.ceil(e.left+i/4)+1,Math.ceil(e.top+i/4)+1,Math.floor(i/2),new Y("#424242"))},this)},i.prototype.paintFormValue=function(t){var e=t.getValue();if(e.length>0){var i=t.node.ownerDocument,r=i.createElement("html2canvaswrapper"),n=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];n.forEach(function(e){try{r.style[e]=t.css(e)}catch(i){N("html2canvas: Parse: Exception caught in renderFormValue: "+i.message)}});var o=t.parseBounds();r.style.position="fixed",r.style.left=o.left+"px",r.style.top=o.top+"px",r.textContent=e,i.body.appendChild(r),this.paintText(new V(r.firstChild,t)),i.body.removeChild(r)}},i.prototype.paintText=function(t){t.applyTextTransform();var e=U.ucs2.decode(t.node.data),i=this.options.letterRendering&&!y(t)||G(t.node.data)?e.map(function(t){return U.ucs2.encode([t])}):D(e),r=t.parent.fontWeight(),n=t.parent.css("fontSize"),o=t.parent.css("fontFamily"),s=t.parent.parseTextShadows();this.renderer.font(t.parent.color("color"),t.parent.css("fontStyle"),t.parent.css("fontVariant"),r,n,o),s.length?this.renderer.fontShadow(s[0].color,s[0].offsetX,s[0].offsetY,s[0].blur):this.renderer.clearShadow(),this.renderer.clip(t.parent.clip,function(){i.map(this.parseTextBounds(t),this).forEach(function(e,r){e&&(this.renderer.text(i[r],e.left,e.bottom),this.renderTextDecoration(t.parent,e,this.fontMetrics.getMetrics(o,n)))},this)},this)},i.prototype.renderTextDecoration=function(t,e,i){switch(t.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(e.left,Math.round(e.top+i.baseline+i.lineWidth),e.width,1,t.color("color"));break;case"overline":this.renderer.rectangle(e.left,Math.round(e.top),e.width,1,t.color("color"));break;case"line-through":this.renderer.rectangle(e.left,Math.ceil(e.top+i.middle+i.lineWidth),e.width,1,t.color("color"))}};var Z={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};i.prototype.parseBorders=function(t){var e=t.parseBounds(),i=x(t),r=["Top","Right","Bottom","Left"].map(function(e,i){var r=t.css("border"+e+"Style"),n=t.color("border"+e+"Color");"inset"===r&&n.isBlack()&&(n=new Y([255,255,255,n.a]));var o=Z[r]?Z[r][i]:null;return{width:t.cssInt("border"+e+"Width"),color:o?n[o[0]](o[1]):n,args:null}}),n=h(e,i,r);return{clip:this.parseBackgroundClip(t,n,r,i,e),borders:s(r,e,n,i)}},i.prototype.parseBackgroundClip=function(t,e,i,r,n){var o=t.css("backgroundClip"),s=[];switch(o){case"content-box":case"padding-box":c(s,r[0],r[1],e.topLeftInner,e.topRightInner,n.left+i[3].width,n.top+i[0].width),c(s,r[1],r[2],e.topRightInner,e.bottomRightInner,n.left+n.width-i[1].width,n.top+i[0].width),c(s,r[2],r[3],e.bottomRightInner,e.bottomLeftInner,n.left+n.width-i[1].width,n.top+n.height-i[2].width),c(s,r[3],r[0],e.bottomLeftInner,e.topLeftInner,n.left+i[3].width,n.top+n.height-i[2].width);break;default:c(s,r[0],r[1],e.topLeftOuter,e.topRightOuter,n.left,n.top),c(s,r[1],r[2],e.topRightOuter,e.bottomRightOuter,n.left+n.width,n.top),c(s,r[2],r[3],e.bottomRightOuter,e.bottomLeftOuter,n.left+n.width,n.top+n.height),c(s,r[3],r[0],e.bottomLeftOuter,e.topLeftOuter,n.left,n.top+n.height)}return s},e.exports=i},{"./color":5,"./fontmetrics":9,"./log":15,"./nodecontainer":16,"./promise":18,"./pseudoelementcontainer":21,"./stackingcontext":24,"./textcontainer":28,"./utils":29,punycode:3}],18:[function(t,e){e.exports=t("es6-promise").Promise},{"es6-promise":1}],19:[function(t,e,i){function r(t,e,i){var r="withCredentials"in new XMLHttpRequest;if(!e)return u.reject("No proxy configured");var n=s(r),h=a(e,t,n);return r?c(h):o(i,h,n).then(function(t){return g(t.content)})}function n(t,e,i){var r="crossOrigin"in new Image,n=s(r),h=a(e,t,n);return r?u.resolve(h):o(i,h,n).then(function(t){return"data:"+t.type+";base64,"+t.content})}function o(t,e,i){return new u(function(r,n){var o=t.createElement("script"),s=function(){delete window.html2canvas.proxy[i],t.body.removeChild(o)};window.html2canvas.proxy[i]=function(t){s(),r(t)},o.src=e,o.onerror=function(t){s(),n(t)},t.body.appendChild(o)})}function s(t){return t?"":"html2canvas_"+Date.now()+"_"+ ++m+"_"+Math.round(1e5*Math.random())}function a(t,e,i){return t+"?url="+encodeURIComponent(e)+(i.length?"&callback=html2canvas.proxy."+i:"")}function h(t){return function(e){var i,r=new DOMParser;try{i=r.parseFromString(e,"text/html")}catch(n){p("DOMParser not supported, falling back to createHTMLDocument"),i=document.implementation.createHTMLDocument("");try{i.open(),i.write(e),i.close()}catch(o){p("createHTMLDocument write not supported, falling back to document.body.innerHTML"),i.body.innerHTML=e}}var s=i.querySelector("base");if(!s||!s.href.host){var a=i.createElement("base");a.href=t,i.head.insertBefore(a,i.head.firstChild)}return i}}function l(t,e,i,n,o,s){return new r(t,e,window.document).then(h(t)).then(function(t){return f(t,i,n,o,s,0,0)})}var u=t("./promise"),c=t("./xhr"),d=t("./utils"),p=t("./log"),f=t("./clone"),g=d.decode64,m=0;i.Proxy=r,i.ProxyURL=n,i.loadUrlDocument=l},{"./clone":4,"./log":15,"./promise":18,"./utils":29,"./xhr":31}],20:[function(t,e){function i(t,e){var i=document.createElement("a");i.href=t,t=i.href,this.src=t,this.image=new Image;var o=this;this.promise=new n(function(i,n){o.image.crossOrigin="Anonymous",o.image.onload=i,o.image.onerror=n,new r(t,e,document).then(function(t){o.image.src=t})["catch"](n)})}var r=t("./proxy").ProxyURL,n=t("./promise");e.exports=i},{"./promise":18,"./proxy":19}],21:[function(t,e){function i(t,e,i){r.call(this,t,e),this.isPseudoElement=!0,this.before=":before"===i}var r=t("./nodecontainer");i.prototype.cloneTo=function(t){i.prototype.cloneTo.call(this,t),t.isPseudoElement=!0,t.before=this.before},i.prototype=Object.create(r.prototype),i.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},i.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},i.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",e.exports=i},{"./nodecontainer":16}],22:[function(t,e){function i(t,e,i,r,n){this.width=t,this.height=e,this.images=i,this.options=r,this.document=n}var r=t("./log");i.prototype.renderImage=function(t,e,i,r){var n=t.cssInt("paddingLeft"),o=t.cssInt("paddingTop"),s=t.cssInt("paddingRight"),a=t.cssInt("paddingBottom"),h=i.borders,l=e.width-(h[1].width+h[3].width+n+s),u=e.height-(h[0].width+h[2].width+o+a);this.drawImage(r,0,0,Math.round(r.image.width||l),Math.round(r.image.height||u),Math.round(e.left+n+h[3].width),Math.round(e.top+o+h[0].width),l,u)},i.prototype.renderBackground=function(t,e,i){e.height>0&&e.width>0&&(this.renderBackgroundColor(t,e),this.renderBackgroundImage(t,e,i))},i.prototype.renderBackgroundColor=function(t,e){var i=t.color("backgroundColor");i.isTransparent()||this.rectangle(e.left,e.top,e.width,e.height,i)},i.prototype.renderBorders=function(t){t.forEach(this.renderBorder,this)},i.prototype.renderBorder=function(t){t.color.isTransparent()||null===t.args||this.drawShape(t.args,t.color)},i.prototype.renderBackgroundImage=function(t,e,i){var n=t.parseBackgroundImages();n.reverse().forEach(function(n,o,s){switch(n.method){case"url":var a=this.images.get(n.args[0]);a?this.renderBackgroundRepeating(t,e,a,s.length-(o+1),i):r("Error loading background-image",n.args[0]);break;case"linear-gradient":case"gradient":var h=this.images.get(n.value);h?this.renderBackgroundGradient(h,e,i):r("Error loading background-image",n.args[0]);break;case"none":break;default:r("Unknown background-image type",n.args[0])}},this)},i.prototype.renderBackgroundRepeating=function(t,e,i,r,n){var o=t.parseBackgroundSize(e,i.image,r),s=t.parseBackgroundPosition(e,i.image,r,o),a=t.parseBackgroundRepeat(r);switch(a){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+n[3],e.top+s.top+n[0],99999,o.height,n);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+n[0],o.width,99999,n);break;case"no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+s.top+n[0],o.width,o.height,n);break;default:this.renderBackgroundRepeat(i,s,o,{top:e.top,left:e.left},n[3],n[0])}},e.exports=i},{"./log":15}],23:[function(t,e){function i(t,e){n.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=t,this.canvas.height=e),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},s("Initialized CanvasRenderer with size",t,"x",e)}function r(t){return t.length>0}var n=t("../renderer"),o=t("../lineargradientcontainer"),s=t("../log");i.prototype=Object.create(n.prototype),i.prototype.setFillStyle=function(t){return this.ctx.fillStyle="object"==typeof t&&t.isColor?t.toString():t,this.ctx},i.prototype.rectangle=function(t,e,i,r,n){this.setFillStyle(n).fillRect(t,e,i,r)},i.prototype.circle=function(t,e,i,r){this.setFillStyle(r),this.ctx.beginPath(),this.ctx.arc(t+i/2,e+i/2,i/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},i.prototype.circleStroke=function(t,e,i,r,n,o){this.circle(t,e,i,r),this.ctx.strokeStyle=o.toString(),this.ctx.stroke()},i.prototype.drawShape=function(t,e){this.shape(t),this.setFillStyle(e).fill()},i.prototype.taints=function(t){if(null===t.tainted){this.taintCtx.drawImage(t.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),t.tainted=!1}catch(e){this.taintCtx=document.createElement("canvas").getContext("2d"),t.tainted=!0}}return t.tainted},i.prototype.drawImage=function(t,e,i,r,n,o,s,a,h){(!this.taints(t)||this.options.allowTaint)&&this.ctx.drawImage(t.image,e,i,r,n,o,s,a,h)},i.prototype.clip=function(t,e,i){this.ctx.save(),t.filter(r).forEach(function(t){this.shape(t).clip()},this),e.call(i),this.ctx.restore()},i.prototype.shape=function(t){return this.ctx.beginPath(),t.forEach(function(t,e){"rect"===t[0]?this.ctx.rect.apply(this.ctx,t.slice(1)):this.ctx[0===e?"moveTo":t[0]+"To"].apply(this.ctx,t.slice(1))},this),this.ctx.closePath(),this.ctx},i.prototype.font=function(t,e,i,r,n,o){this.setFillStyle(t).font=[e,i,r,n,o].join(" ").split(",")[0]},i.prototype.fontShadow=function(t,e,i,r){this.setVariable("shadowColor",t.toString()).setVariable("shadowOffsetY",e).setVariable("shadowOffsetX",i).setVariable("shadowBlur",r)},i.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},i.prototype.setOpacity=function(t){this.ctx.globalAlpha=t},i.prototype.setTransform=function(t){this.ctx.translate(t.origin[0],t.origin[1]),this.ctx.transform.apply(this.ctx,t.matrix),this.ctx.translate(-t.origin[0],-t.origin[1])},i.prototype.setVariable=function(t,e){return this.variables[t]!==e&&(this.variables[t]=this.ctx[t]=e),this},i.prototype.text=function(t,e,i){this.ctx.fillText(t,e,i)},i.prototype.backgroundRepeatShape=function(t,e,i,r,n,o,s,a,h){var l=[["line",Math.round(n),Math.round(o)],["line",Math.round(n+s),Math.round(o)],["line",Math.round(n+s),Math.round(a+o)],["line",Math.round(n),Math.round(a+o)]];this.clip([l],function(){this.renderBackgroundRepeat(t,e,i,r,h[3],h[0])},this)},i.prototype.renderBackgroundRepeat=function(t,e,i,r,n,o){var s=Math.round(r.left+e.left+n),a=Math.round(r.top+e.top+o); -this.setFillStyle(this.ctx.createPattern(this.resizeImage(t,i),"repeat")),this.ctx.translate(s,a),this.ctx.fill(),this.ctx.translate(-s,-a)},i.prototype.renderBackgroundGradient=function(t,e){if(t instanceof o){var i=this.ctx.createLinearGradient(e.left+e.width*t.x0,e.top+e.height*t.y0,e.left+e.width*t.x1,e.top+e.height*t.y1);t.colorStops.forEach(function(t){i.addColorStop(t.stop,t.color.toString())}),this.rectangle(e.left,e.top,e.width,e.height,i)}},i.prototype.resizeImage=function(t,e){var i=t.image;if(i.width===e.width&&i.height===e.height)return i;var r,n=document.createElement("canvas");return n.width=e.width,n.height=e.height,r=n.getContext("2d"),r.drawImage(i,0,0,i.width,i.height,0,0,e.width,e.height),n},e.exports=i},{"../lineargradientcontainer":14,"../log":15,"../renderer":22}],24:[function(t,e){function i(t,e,i,n){r.call(this,i,n),this.ownStacking=t,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*e}var r=t("./nodecontainer");i.prototype=Object.create(r.prototype),i.prototype.getParentStack=function(t){var e=this.parent?this.parent.stack:null;return e?e.ownStacking?e:e.getParentStack(t):t.stack},e.exports=i},{"./nodecontainer":16}],25:[function(t,e){function i(t){this.rangeBounds=this.testRangeBounds(t),this.cors=this.testCORS(),this.svg=this.testSVG()}i.prototype.testRangeBounds=function(t){var e,i,r,n,o=!1;return t.createRange&&(e=t.createRange(),e.getBoundingClientRect&&(i=t.createElement("boundtest"),i.style.height="123px",i.style.display="block",t.body.appendChild(i),e.selectNode(i),r=e.getBoundingClientRect(),n=r.height,123===n&&(o=!0),t.body.removeChild(i))),o},i.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},i.prototype.testSVG=function(){var t=new Image,e=document.createElement("canvas"),i=e.getContext("2d");t.src="data:image/svg+xml,";try{i.drawImage(t,0,0),e.toDataURL()}catch(r){return!1}return!0},e.exports=i},{}],26:[function(t,e){function i(t){this.src=t,this.image=null;var e=this;this.promise=this.hasFabric().then(function(){return e.isInline(t)?r.resolve(e.inlineFormatting(t)):n(t)}).then(function(t){return new r(function(i){window.html2canvas.svg.fabric.loadSVGFromString(t,e.createCanvas.call(e,i))})})}var r=t("./promise"),n=t("./xhr"),o=t("./utils").decode64;i.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?r.resolve():r.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},i.prototype.inlineFormatting=function(t){return/^data:image\/svg\+xml;base64,/.test(t)?this.decode64(this.removeContentType(t)):this.removeContentType(t)},i.prototype.removeContentType=function(t){return t.replace(/^data:image\/svg\+xml(;base64)?,/,"")},i.prototype.isInline=function(t){return/^data:image\/svg\+xml/i.test(t)},i.prototype.createCanvas=function(t){var e=this;return function(i,r){var n=new window.html2canvas.svg.fabric.StaticCanvas("c");e.image=n.lowerCanvasEl,n.setWidth(r.width).setHeight(r.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(i,r)).renderAll(),t(n.lowerCanvasEl)}},i.prototype.decode64=function(t){return"function"==typeof window.atob?window.atob(t):o(t)},e.exports=i},{"./promise":18,"./utils":29,"./xhr":31}],27:[function(t,e){function i(t,e){this.src=t,this.image=null;var i=this;this.promise=e?new n(function(e,r){i.image=new Image,i.image.onload=e,i.image.onerror=r,i.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(t),i.image.complete===!0&&e(i.image)}):this.hasFabric().then(function(){return new n(function(e){window.html2canvas.svg.fabric.parseSVGDocument(t,i.createCanvas.call(i,e))})})}var r=t("./svgcontainer"),n=t("./promise");i.prototype=Object.create(r.prototype),e.exports=i},{"./promise":18,"./svgcontainer":26}],28:[function(t,e){function i(t,e){n.call(this,t,e)}function r(t,e,i){return t.length>0?e+i.toUpperCase():void 0}var n=t("./nodecontainer");i.prototype=Object.create(n.prototype),i.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},i.prototype.transform=function(t){var e=this.node.data;switch(t){case"lowercase":return e.toLowerCase();case"capitalize":return e.replace(/(^|\s|:|-|\(|\))([a-z])/g,r);case"uppercase":return e.toUpperCase();default:return e}},e.exports=i},{"./nodecontainer":16}],29:[function(t,e,i){i.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},i.bind=function(t,e){return function(){return t.apply(e,arguments)}},i.decode64=function(t){var e,i,r,n,o,s,a,h,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=t.length,c="";for(e=0;u>e;e+=4)i=l.indexOf(t[e]),r=l.indexOf(t[e+1]),n=l.indexOf(t[e+2]),o=l.indexOf(t[e+3]),s=i<<2|r>>4,a=(15&r)<<4|n>>2,h=(3&n)<<6|o,c+=64===n?String.fromCharCode(s):64===o||-1===o?String.fromCharCode(s,a):String.fromCharCode(s,a,h);return c},i.getBounds=function(t){if(t.getBoundingClientRect){var e=t.getBoundingClientRect(),i=null==t.offsetWidth?e.width:t.offsetWidth;return{top:e.top,bottom:e.bottom||e.top+e.height,right:e.left+i,left:e.left,width:i,height:null==t.offsetHeight?e.height:t.offsetHeight}}return{}},i.offsetBounds=function(t){var e=t.offsetParent?i.offsetBounds(t.offsetParent):{top:0,left:0};return{top:t.offsetTop+e.top,bottom:t.offsetTop+t.offsetHeight+e.top,right:t.offsetLeft+e.left+t.offsetWidth,left:t.offsetLeft+e.left,width:t.offsetWidth,height:t.offsetHeight}},i.parseBackgrounds=function(t){var e,i,r,n,o,s,a,h=" \r\n ",l=[],u=0,c=0,d=function(){e&&('"'===i.substr(0,1)&&(i=i.substr(1,i.length-2)),i&&a.push(i),"-"===e.substr(0,1)&&(n=e.indexOf("-",1)+1)>0&&(r=e.substr(0,n),e=e.substr(n)),l.push({prefix:r,method:e.toLowerCase(),value:o,args:a,image:null})),a=[],e=r=i=o=""};return a=[],e=r=i=o="",t.split("").forEach(function(t){if(!(0===u&&h.indexOf(t)>-1)){switch(t){case'"':s?s===t&&(s=null):s=t;break;case"(":if(s)break;if(0===u)return u=1,void(o+=t);c++;break;case")":if(s)break;if(1===u){if(0===c)return u=0,o+=t,void d();c--}break;case",":if(s)break;if(0===u)return void d();if(1===u&&0===c&&!e.match(/^url$/i))return a.push(i),i="",void(o+=t)}o+=t,0===u?e+=t:i+=t}}),d(),l}},{}],30:[function(t,e){function i(t){r.apply(this,arguments),this.type="linear"===t.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}var r=t("./gradientcontainer");i.prototype=Object.create(r.prototype),e.exports=i},{"./gradientcontainer":11}],31:[function(t,e){function i(t){return new r(function(e,i){var r=new XMLHttpRequest;r.open("GET",t),r.onload=function(){200===r.status?e(r.responseText):i(new Error(r.statusText))},r.onerror=function(){i(new Error("Network Error"))},r.send()})}var r=t("./promise");e.exports=i},{"./promise":18}]},{},[6])(6)}),function(t){function e(t){var e=t.length,r=i.type(t);return"function"===r||i.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===r||0===e||"number"==typeof e&&e>0&&e-1 in t}if(!t.jQuery){var i=function(t,e){return new i.fn.init(t,e)};i.isWindow=function(t){return null!=t&&t==t.window},i.type=function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?n[s.call(t)]||"object":typeof t},i.isArray=Array.isArray||function(t){return"array"===i.type(t)},i.isPlainObject=function(t){var e;if(!t||"object"!==i.type(t)||t.nodeType||i.isWindow(t))return!1;try{if(t.constructor&&!o.call(t,"constructor")&&!o.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}for(e in t);return void 0===e||o.call(t,e)},i.each=function(t,i,r){var n,o=0,s=t.length,a=e(t);if(r){if(a)for(;s>o&&(n=i.apply(t[o],r),n!==!1);o++);else for(o in t)if(n=i.apply(t[o],r),n===!1)break}else if(a)for(;s>o&&(n=i.call(t[o],o,t[o]),n!==!1);o++);else for(o in t)if(n=i.call(t[o],o,t[o]),n===!1)break;return t},i.data=function(t,e,n){if(void 0===n){var o=t[i.expando],s=o&&r[o];if(void 0===e)return s;if(s&&e in s)return s[e]}else if(void 0!==e){var o=t[i.expando]||(t[i.expando]=++i.uuid);return r[o]=r[o]||{},r[o][e]=n,n}},i.removeData=function(t,e){var n=t[i.expando],o=n&&r[n];o&&i.each(e,function(t,e){delete o[e]})},i.extend=function(){var t,e,r,n,o,s,a=arguments[0]||{},h=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[h]||{},h++),"object"!=typeof a&&"function"!==i.type(a)&&(a={}),h===l&&(a=this,h--);l>h;h++)if(null!=(o=arguments[h]))for(n in o)t=a[n],r=o[n],a!==r&&(u&&r&&(i.isPlainObject(r)||(e=i.isArray(r)))?(e?(e=!1,s=t&&i.isArray(t)?t:[]):s=t&&i.isPlainObject(t)?t:{},a[n]=i.extend(u,s,r)):void 0!==r&&(a[n]=r));return a},i.queue=function(t,r,n){function o(t,i){var r=i||[];return null!=t&&(e(Object(t))?!function(t,e){for(var i=+e.length,r=0,n=t.length;i>r;)t[n++]=e[r++];if(i!==i)for(;void 0!==e[r];)t[n++]=e[r++];return t.length=n,t}(r,"string"==typeof t?[t]:t):[].push.call(r,t)),r}if(t){r=(r||"fx")+"queue";var s=i.data(t,r);return n?(!s||i.isArray(n)?s=i.data(t,r,o(n)):s.push(n),s):s||[]}},i.dequeue=function(t,e){i.each(t.nodeType?[t]:t,function(t,r){e=e||"fx";var n=i.queue(r,e),o=n.shift();"inprogress"===o&&(o=n.shift()),o&&("fx"===e&&n.unshift("inprogress"),o.call(r,function(){i.dequeue(r,e)}))})},i.fn=i.prototype={init:function(t){if(t.nodeType)return this[0]=t,this;throw new Error("Not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:e.top+(t.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:e.left+(t.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function t(){for(var t=this.offsetParent||document;t&&"html"===!t.nodeType.toLowerCase&&"static"===t.style.position;)t=t.offsetParent;return t||document}var e=this[0],t=t.apply(e),r=this.offset(),n=/^(?:body|html)$/i.test(t.nodeName)?{top:0,left:0}:i(t).offset();return r.top-=parseFloat(e.style.marginTop)||0,r.left-=parseFloat(e.style.marginLeft)||0,t.style&&(n.top+=parseFloat(t.style.borderTopWidth)||0,n.left+=parseFloat(t.style.borderLeftWidth)||0),{top:r.top-n.top,left:r.left-n.left}}};var r={};i.expando="velocity"+(new Date).getTime(),i.uuid=0;for(var n={},o=n.hasOwnProperty,s=n.toString,a="Boolean Number String Function Array Date RegExp Object Error".split(" "),h=0;hn;++n){var o=l(i,t,r);if(0===o)return i;var s=h(i,t,r)-e;i-=s/o}return i}function c(){for(var e=0;x>e;++e)S[e]=h(e*b,t,r)}function d(e,i,n){var o,s,a=0;do s=i+(n-i)/2,o=h(s,t,r)-e,o>0?n=s:i=s;while(Math.abs(o)>v&&++a=m?u(e,a):0==h?a:d(e,i,i+b)}function f(){C=!0,(t!=i||r!=n)&&c()}var g=4,m=.001,v=1e-7,y=10,x=11,b=1/(x-1),w="Float32Array"in e;if(4!==arguments.length)return!1;for(var T=0;4>T;++T)if("number"!=typeof arguments[T]||isNaN(arguments[T])||!isFinite(arguments[T]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var S=w?new Float32Array(x):new Array(x),C=!1,E=function(e){return C||f(),t===i&&r===n?e:0===e?0:1===e?1:h(p(e),i,n)};E.getControlPoints=function(){return[{x:t,y:i},{x:r,y:n}]};var A="generateBezier("+[t,i,r,n]+")";return E.toString=function(){return A},E}function l(t,e){var i=t;return g.isString(t)?x.Easings[t]||(i=!1):i=g.isArray(t)&&1===t.length?a.apply(null,t):g.isArray(t)&&2===t.length?b.apply(null,t.concat([e])):g.isArray(t)&&4===t.length?h.apply(null,t):!1,i===!1&&(i=x.Easings[x.defaults.easing]?x.defaults.easing:y),i}function u(t){if(t){var e=(new Date).getTime(),i=x.State.calls.length;i>1e4&&(x.State.calls=n(x.State.calls));for(var o=0;i>o;o++)if(x.State.calls[o]){var a=x.State.calls[o],h=a[0],l=a[2],p=a[3],f=!!p,m=null;p||(p=x.State.calls[o][3]=e-16);for(var v=Math.min((e-p)/l.duration,1),y=0,b=h.length;b>y;y++){var T=h[y],C=T.element;if(s(C)){var E=!1;if(l.display!==r&&null!==l.display&&"none"!==l.display){if("flex"===l.display){var A=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];d.each(A,function(t,e){w.setPropertyValue(C,"display",e)})}w.setPropertyValue(C,"display",l.display)}l.visibility!==r&&"hidden"!==l.visibility&&w.setPropertyValue(C,"visibility",l.visibility);for(var _ in T)if("element"!==_){var M,L=T[_],R=g.isString(L.easing)?x.Easings[L.easing]:L.easing;if(1===v)M=L.endValue;else{var P=L.endValue-L.startValue;if(M=L.startValue+P*R(v,l,P),!f&&M===L.currentValue)continue}if(L.currentValue=M,"tween"===_)m=M;else{if(w.Hooks.registered[_]){var F=w.Hooks.getRoot(_),B=s(C).rootPropertyValueCache[F];B&&(L.rootPropertyValue=B)}var I=w.setPropertyValue(C,_,L.currentValue+(0===parseFloat(M)?"":L.unitType),L.rootPropertyValue,L.scrollData);w.Hooks.registered[_]&&(s(C).rootPropertyValueCache[F]=w.Normalizations.registered[F]?w.Normalizations.registered[F]("extract",null,I[1]):I[1]),"transform"===I[0]&&(E=!0)}}l.mobileHA&&s(C).transformCache.translate3d===r&&(s(C).transformCache.translate3d="(0px, 0px, 0px)",E=!0),E&&w.flushTransformCache(C)}}l.display!==r&&"none"!==l.display&&(x.State.calls[o][2].display=!1),l.visibility!==r&&"hidden"!==l.visibility&&(x.State.calls[o][2].visibility=!1),l.progress&&l.progress.call(a[1],a[1],v,Math.max(0,p+l.duration-e),p,m),1===v&&c(o)}}x.State.isTicking&&S(u)}function c(t,e){if(!x.State.calls[t])return!1;for(var i=x.State.calls[t][0],n=x.State.calls[t][1],o=x.State.calls[t][2],a=x.State.calls[t][4],h=!1,l=0,u=i.length;u>l;l++){var c=i[l].element;if(e||o.loop||("none"===o.display&&w.setPropertyValue(c,"display",o.display),"hidden"===o.visibility&&w.setPropertyValue(c,"visibility",o.visibility)),o.loop!==!0&&(d.queue(c)[1]===r||!/\.velocityQueueEntryFlag/i.test(d.queue(c)[1]))&&s(c)){s(c).isAnimating=!1,s(c).rootPropertyValueCache={};var p=!1;d.each(w.Lists.transforms3D,function(t,e){var i=/^scale/.test(e)?1:0,n=s(c).transformCache[e];s(c).transformCache[e]!==r&&new RegExp("^\\("+i+"[^.]").test(n)&&(p=!0,delete s(c).transformCache[e])}),o.mobileHA&&(p=!0,delete s(c).transformCache.translate3d),p&&w.flushTransformCache(c),w.Values.removeClass(c,"velocity-animating")}if(!e&&o.complete&&!o.loop&&l===u-1)try{o.complete.call(n,n)}catch(f){setTimeout(function(){throw f},1)}a&&o.loop!==!0&&a(n),s(c)&&o.loop===!0&&!e&&(d.each(s(c).tweensContainer,function(t,e){/^rotate/.test(t)&&360===parseFloat(e.endValue)&&(e.endValue=0,e.startValue=360),/^backgroundPosition/.test(t)&&100===parseFloat(e.endValue)&&"%"===e.unitType&&(e.endValue=0,e.startValue=100)}),x(c,"reverse",{loop:!0,delay:o.delay})),o.queue!==!1&&d.dequeue(c,o.queue)}x.State.calls[t]=!1;for(var g=0,m=x.State.calls.length;m>g;g++)if(x.State.calls[g]!==!1){h=!0;break}h===!1&&(x.State.isTicking=!1,delete x.State.calls,x.State.calls=[])}var d,p=function(){if(i.documentMode)return i.documentMode;for(var t=7;t>4;t--){var e=i.createElement("div");if(e.innerHTML="",e.getElementsByTagName("span").length)return e=null,t}return r}(),f=function(){var t=0;return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(e){var i,r=(new Date).getTime();return i=Math.max(0,16-(r-t)),t=r+i,setTimeout(function(){e(r+i)},i)}}(),g={isString:function(t){return"string"==typeof t},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)},isNode:function(t){return t&&t.nodeType},isNodeList:function(t){return"object"==typeof t&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&t.length!==r&&(0===t.length||"object"==typeof t[0]&&t[0].nodeType>0)},isWrapped:function(t){return t&&(t.jquery||e.Zepto&&e.Zepto.zepto.isZ(t))},isSVG:function(t){return e.SVGElement&&t instanceof e.SVGElement},isEmptyObject:function(t){for(var e in t)return!1;return!0}},m=!1;if(t.fn&&t.fn.jquery?(d=t,m=!0):d=e.Velocity.Utilities,8>=p&&!m)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(7>=p)return void(jQuery.fn.velocity=jQuery.fn.animate);var v=400,y="swing",x={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:e.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:d,Redirects:{},Easings:{},Promise:e.Promise,defaults:{queue:"",duration:v,easing:y,begin:r,complete:r,progress:r,display:r,visibility:r,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(t){d.data(t,"velocity",{isSVG:g.isSVG(t),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};e.pageYOffset!==r?(x.State.scrollAnchor=e,x.State.scrollPropertyLeft="pageXOffset",x.State.scrollPropertyTop="pageYOffset"):(x.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,x.State.scrollPropertyLeft="scrollLeft",x.State.scrollPropertyTop="scrollTop");var b=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,i,r){var n={x:e.x+r.dx*i,v:e.v+r.dv*i,tension:e.tension,friction:e.friction};return{dx:n.v,dv:t(n)}}function i(i,r){var n={dx:i.v,dv:t(i)},o=e(i,.5*r,n),s=e(i,.5*r,o),a=e(i,r,s),h=1/6*(n.dx+2*(o.dx+s.dx)+a.dx),l=1/6*(n.dv+2*(o.dv+s.dv)+a.dv);return i.x=i.x+h*r,i.v=i.v+l*r,i}return function r(t,e,n){var o,s,a,h={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1e-4,d=.016;for(t=parseFloat(t)||500,e=parseFloat(e)||20,n=n||null,h.tension=t,h.friction=e,o=null!==n,o?(u=r(t,e),s=u/n*d):s=d;;)if(a=i(a||h,s),l.push(1+a.x),u+=16,!(Math.abs(a.x)>c&&Math.abs(a.v)>c))break;return o?function(t){return l[t*(l.length-1)|0]}:u}}();x.Easings={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},spring:function(t){return 1-Math.cos(4.5*t*Math.PI)*Math.exp(6*-t)}},d.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(t,e){x.Easings[e[0]]=h.apply(null,e[1])});var w=x.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var t=0;t=p)switch(t){case"name":return"filter";case"extract":var r=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=r?r[1]/100:1;case"inject":return e.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(t){case"name":return"opacity";case"extract":return i;case"inject":return i}}},register:function(){9>=p||x.State.isGingerbread||(w.Lists.transformsBase=w.Lists.transformsBase.concat(w.Lists.transforms3D));for(var t=0;tn&&(n=1),o=!/(\d)$/i.test(n);break;case"skew":o=!/(deg|\d)$/i.test(n);break;case"rotate":o=!/(deg|\d)$/i.test(n)}return o||(s(i).transformCache[e]="("+n+")"),s(i).transformCache[e]}}}();for(var t=0;t=p||3!==o.split(" ").length||(o+=" 1"),o;case"inject":return 8>=p?4===n.split(" ").length&&(n=n.split(/\s+/).slice(0,3).join(" ")):3===n.split(" ").length&&(n+=" 1"),(8>=p?"rgb":"rgba")+"("+n.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},SVGAttribute:function(t){var e="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(p||x.State.isAndroid&&!x.State.isChrome)&&(e+="|transform"),new RegExp("^("+e+")$","i").test(t)},prefixCheck:function(t){if(x.State.prefixMatches[t])return[x.State.prefixMatches[t],!0];for(var e=["","Webkit","Moz","ms","O"],i=0,r=e.length;r>i;i++){var n;if(n=0===i?t:e[i]+t.replace(/^\w/,function(t){return t.toUpperCase()}),g.isString(x.State.prefixElement.style[n]))return x.State.prefixMatches[t]=n,[n,!0]}return[t,!1]}},Values:{hexToRgb:function(t){var e,i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return t=t.replace(i,function(t,e,i,r){return e+e+i+i+r+r}),e=r.exec(t),e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]},isCSSNullValue:function(t){return 0==t||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(t)},getUnitType:function(t){return/^(rotate|skew)/i.test(t)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(t)?"":"px"},getDisplayType:function(t){var e=t&&t.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(e)?"inline":/^(li)$/i.test(e)?"list-item":/^(tr)$/i.test(e)?"table-row":/^(table)$/i.test(e)?"table":/^(tbody)$/i.test(e)?"table-row-group":"block"},addClass:function(t,e){t.classList?t.classList.add(e):t.className+=(t.className.length?" ":"")+e},removeClass:function(t,e){t.classList?t.classList.remove(e):t.className=t.className.toString().replace(new RegExp("(^|\\s)"+e.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(t,i,n,o){function a(t,i){function n(){l&&w.setPropertyValue(t,"display","none")}var h=0;if(8>=p)h=d.css(t,i);else{var l=!1;if(/^(width|height)$/.test(i)&&0===w.getPropertyValue(t,"display")&&(l=!0,w.setPropertyValue(t,"display",w.Values.getDisplayType(t))),!o){if("height"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var u=t.offsetHeight-(parseFloat(w.getPropertyValue(t,"borderTopWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderBottomWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingTop"))||0)-(parseFloat(w.getPropertyValue(t,"paddingBottom"))||0);return n(),u}if("width"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var c=t.offsetWidth-(parseFloat(w.getPropertyValue(t,"borderLeftWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderRightWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingLeft"))||0)-(parseFloat(w.getPropertyValue(t,"paddingRight"))||0);return n(),c}}var f;f=s(t)===r?e.getComputedStyle(t,null):s(t).computedStyle?s(t).computedStyle:s(t).computedStyle=e.getComputedStyle(t,null),"borderColor"===i&&(i="borderTopColor"),h=9===p&&"filter"===i?f.getPropertyValue(i):f[i],(""===h||null===h)&&(h=t.style[i]),n()}if("auto"===h&&/^(top|right|bottom|left)$/i.test(i)){var g=a(t,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(i))&&(h=d(t).position()[i]+"px")}return h}var h;if(w.Hooks.registered[i]){var l=i,u=w.Hooks.getRoot(l);n===r&&(n=w.getPropertyValue(t,w.Names.prefixCheck(u)[0])),w.Normalizations.registered[u]&&(n=w.Normalizations.registered[u]("extract",t,n)),h=w.Hooks.extractValue(l,n)}else if(w.Normalizations.registered[i]){var c,f;c=w.Normalizations.registered[i]("name",t),"transform"!==c&&(f=a(t,w.Names.prefixCheck(c)[0]),w.Values.isCSSNullValue(f)&&w.Hooks.templates[i]&&(f=w.Hooks.templates[i][1])),h=w.Normalizations.registered[i]("extract",t,f)}if(!/^[\d-]/.test(h))if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))if(/^(height|width)$/i.test(i))try{h=t.getBBox()[i]}catch(g){h=0}else h=t.getAttribute(i);else h=a(t,w.Names.prefixCheck(i)[0]);return w.Values.isCSSNullValue(h)&&(h=0),x.debug>=2&&console.log("Get "+i+": "+h),h},setPropertyValue:function(t,i,r,n,o){var a=i;if("scroll"===i)o.container?o.container["scroll"+o.direction]=r:"Left"===o.direction?e.scrollTo(r,o.alternateValue):e.scrollTo(o.alternateValue,r);else if(w.Normalizations.registered[i]&&"transform"===w.Normalizations.registered[i]("name",t))w.Normalizations.registered[i]("inject",t,r),a="transform",r=s(t).transformCache[i];else{if(w.Hooks.registered[i]){var h=i,l=w.Hooks.getRoot(i);n=n||w.getPropertyValue(t,l),r=w.Hooks.injectValue(h,r,n),i=l}if(w.Normalizations.registered[i]&&(r=w.Normalizations.registered[i]("inject",t,r),i=w.Normalizations.registered[i]("name",t)),a=w.Names.prefixCheck(i)[0],8>=p)try{t.style[a]=r}catch(u){x.debug&&console.log("Browser does not support ["+r+"] for ["+a+"]")}else if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))t.setAttribute(i,r);else{var c="webgl"===t.renderer?t.styleGL:t.style;c[a]=r}x.debug>=2&&console.log("Set "+i+" ("+a+"): "+r)}return[a,r]},flushTransformCache:function(t){function e(e){return parseFloat(w.getPropertyValue(t,e))}var i="";if((p||x.State.isAndroid&&!x.State.isChrome)&&s(t).isSVG){var r={translate:[e("translateX"),e("translateY")],skewX:[e("skewX")],skewY:[e("skewY")],scale:1!==e("scale")?[e("scale"),e("scale")]:[e("scaleX"),e("scaleY")],rotate:[e("rotateZ"),0,0]};d.each(s(t).transformCache,function(t){/^translate/i.test(t)?t="translate":/^scale/i.test(t)?t="scale":/^rotate/i.test(t)&&(t="rotate"),r[t]&&(i+=t+"("+r[t].join(" ")+") ",delete r[t])})}else{var n,o;d.each(s(t).transformCache,function(e){return n=s(t).transformCache[e],"transformPerspective"===e?(o=n,!0):(9===p&&"rotateZ"===e&&(e="rotate"),void(i+=e+n+" "))}),o&&(i="perspective"+o+" "+i)}w.setPropertyValue(t,"transform",i)}};w.Hooks.register(),w.Normalizations.register(),x.hook=function(t,e,i){var n=r;return t=o(t),d.each(t,function(t,o){if(s(o)===r&&x.init(o),i===r)n===r&&(n=x.CSS.getPropertyValue(o,e));else{var a=x.CSS.setPropertyValue(o,e,i);"transform"===a[0]&&x.CSS.flushTransformCache(o),n=a}}),n};var T=function(){function t(){return a?_.promise||null:h}function n(){function t(){function t(t,e){var i=r,n=r,s=r;return g.isArray(t)?(i=t[0],!g.isArray(t[1])&&/^[\d-]/.test(t[1])||g.isFunction(t[1])||w.RegEx.isHex.test(t[1])?s=t[1]:(g.isString(t[1])&&!w.RegEx.isHex.test(t[1])||g.isArray(t[1]))&&(n=e?t[1]:l(t[1],a.duration),t[2]!==r&&(s=t[2]))):i=t,e||(n=n||a.easing),g.isFunction(i)&&(i=i.call(o,C,S)),g.isFunction(s)&&(s=s.call(o,C,S)),[i||0,n,s]}function c(t,e){var i,r;return r=(e||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(t){return i=t,""}),i||(i=w.Values.getUnitType(t)),[r,i]}function p(){var t={myParent:o.parentNode||i.body,position:w.getPropertyValue(o,"position"),fontSize:w.getPropertyValue(o,"fontSize")},r=t.position===I.lastPosition&&t.myParent===I.lastParent,n=t.fontSize===I.lastFontSize;I.lastParent=t.myParent,I.lastPosition=t.position,I.lastFontSize=t.fontSize;var a=100,h={};if(n&&r)h.emToPx=I.lastEmToPx,h.percentToPxWidth=I.lastPercentToPxWidth,h.percentToPxHeight=I.lastPercentToPxHeight;else{var l=s(o).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");x.init(l),t.myParent.appendChild(l),d.each(["overflow","overflowX","overflowY"],function(t,e){x.CSS.setPropertyValue(l,e,"hidden")}),x.CSS.setPropertyValue(l,"position",t.position),x.CSS.setPropertyValue(l,"fontSize",t.fontSize),x.CSS.setPropertyValue(l,"boxSizing","content-box"),d.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(t,e){x.CSS.setPropertyValue(l,e,a+"%")}),x.CSS.setPropertyValue(l,"paddingLeft",a+"em"),h.percentToPxWidth=I.lastPercentToPxWidth=(parseFloat(w.getPropertyValue(l,"width",null,!0))||1)/a,h.percentToPxHeight=I.lastPercentToPxHeight=(parseFloat(w.getPropertyValue(l,"height",null,!0))||1)/a,h.emToPx=I.lastEmToPx=(parseFloat(w.getPropertyValue(l,"paddingLeft"))||1)/a,t.myParent.removeChild(l) -}return null===I.remToPx&&(I.remToPx=parseFloat(w.getPropertyValue(i.body,"fontSize"))||16),null===I.vwToPx&&(I.vwToPx=parseFloat(e.innerWidth)/100,I.vhToPx=parseFloat(e.innerHeight)/100),h.remToPx=I.remToPx,h.vwToPx=I.vwToPx,h.vhToPx=I.vhToPx,x.debug>=1&&console.log("Unit ratios: "+JSON.stringify(h),o),h}if(a.begin&&0===C)try{a.begin.call(f,f)}catch(v){setTimeout(function(){throw v},1)}if("scroll"===M){var b,T,E,A=/^x$/i.test(a.axis)?"Left":"Top",L=parseFloat(a.offset)||0;a.container?g.isWrapped(a.container)||g.isNode(a.container)?(a.container=a.container[0]||a.container,b=a.container["scroll"+A],E=b+d(o).position()[A.toLowerCase()]+L):a.container=null:(b=x.State.scrollAnchor[x.State["scrollProperty"+A]],T=x.State.scrollAnchor[x.State["scrollProperty"+("Left"===A?"Top":"Left")]],E=d(o).offset()[A.toLowerCase()]+L),h={scroll:{rootPropertyValue:!1,startValue:b,currentValue:b,endValue:E,unitType:"",easing:a.easing,scrollData:{container:a.container,direction:A,alternateValue:T}},element:o},x.debug&&console.log("tweensContainer (scroll): ",h.scroll,o)}else if("reverse"===M){if(!s(o).tweensContainer)return void d.dequeue(o,a.queue);"none"===s(o).opts.display&&(s(o).opts.display="auto"),"hidden"===s(o).opts.visibility&&(s(o).opts.visibility="visible"),s(o).opts.loop=!1,s(o).opts.begin=null,s(o).opts.complete=null,y.easing||delete a.easing,y.duration||delete a.duration,a=d.extend({},s(o).opts,a);var R=d.extend(!0,{},s(o).tweensContainer);for(var P in R)if("element"!==P){var F=R[P].startValue;R[P].startValue=R[P].currentValue=R[P].endValue,R[P].endValue=F,g.isEmptyObject(y)||(R[P].easing=a.easing),x.debug&&console.log("reverse tweensContainer ("+P+"): "+JSON.stringify(R[P]),o)}h=R}else if("start"===M){var R;s(o).tweensContainer&&s(o).isAnimating===!0&&(R=s(o).tweensContainer),d.each(m,function(e,i){if(RegExp("^"+w.Lists.colors.join("$|^")+"$").test(e)){var n=t(i,!0),o=n[0],s=n[1],a=n[2];if(w.RegEx.isHex.test(o)){for(var h=["Red","Green","Blue"],l=w.Values.hexToRgb(o),u=a?w.Values.hexToRgb(a):r,c=0;ck;k++){var G={delay:R.delay,progress:R.progress};k===D-1&&(G.display=R.display,G.visibility=R.visibility,G.complete=R.complete),T(f,"reverse",G)}return t()}};x=d.extend(T,x),x.animate=T;var S=e.requestAnimationFrame||f;return x.State.isMobile||i.hidden===r||i.addEventListener("visibilitychange",function(){i.hidden?(S=function(t){return setTimeout(function(){t(!0)},16)},u()):S=e.requestAnimationFrame||f}),t.Velocity=x,t!==e&&(t.fn.velocity=T,t.fn.velocity.defaults=x.defaults),d.each(["Down","Up"],function(t,e){x.Redirects["slide"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l=h.begin,u=h.complete,c={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},p={};h.display===r&&(h.display="Down"===e?"inline"===x.CSS.Values.getDisplayType(t)?"inline-block":"block":"none"),h.begin=function(){var i="webgl"===t.renderer?t.styleGL:t.style;l&&l.call(s,s);for(var r in c){p[r]=i[r];var n=x.CSS.getPropertyValue(t,r);c[r]="Down"===e?[n,0]:[0,n]}p.overflow=i.overflow,i.overflow="hidden"},h.complete=function(){for(var t in p)style[t]=p[t];u&&u.call(s,s),a&&a.resolver(s)},x(t,c,h)}}),d.each(["In","Out"],function(t,e){x.Redirects["fade"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l={opacity:"In"===e?1:0},u=h.complete;h.complete=n!==o-1?h.begin=null:function(){u&&u.call(s,s),a&&a.resolver(s)},h.display===r&&(h.display="In"===e?"auto":"none"),x(this,l,h)}}),x}(window.jQuery||window.Zepto||window,window,document)}),function(t){t.HTMLGL=t.HTMLGL||{},t.HTMLGL.util={getterSetter:function(t,e,i,r){Object.defineProperty?Object.defineProperty(t,e,{get:i,set:r}):document.__defineGetter__&&(t.__defineGetter__(e,i),t.__defineSetter__(e,r)),t["get"+e]=i,t["set"+e]=r},emitEvent:function(t,e){var i=new MouseEvent(e.type,e);i.dispatcher="html-gl",e.stopPropagation(),t.dispatchEvent(i)}}}(window),function(t){var e=function(){},i=e.prototype;i.getElementByCoordinates=function(e,i){var r,n,o=this;return t.HTMLGL.elements.forEach(function(t){r=document.elementFromPoint(e-parseInt(t.transformObject.translateX||0),i-parseInt(t.transformObject.translateY||0)),o.isChildOf(r,t)&&(n=r)}),n},i.isChildOf=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},t.HTMLGL.GLElementResolver=e}(window),function(t){HTMLGL=t.HTMLGL=t.HTMLGL||{},HTMLGL.JQ_PLUGIN_NAME="htmlgl",HTMLGL.CUSTOM_ELEMENT_TAG_NAME="html-gl",HTMLGL.context=void 0,HTMLGL.stage=void 0,HTMLGL.renderer=void 0,HTMLGL.elements=[],HTMLGL.scrollX=0,HTMLGL.scrollY=0;var e=function(){t.HTMLGL.context=this,this.createStage(),this.updateScrollPosition(),this.initListeners(),this.elementResolver=new t.HTMLGL.GLElementResolver(this),document.body?this.initViewer():document.addEventListener("DOMContentLoaded",this.initViewer.bind(this))},i=e.prototype;i.initViewer=function(){this.createViewer(),this.resizeViewer(),this.appendViewer()},i.initListeners=function(){t.addEventListener("scroll",this.updateScrollPosition.bind(this)),t.addEventListener("resize",this.resizeViewer.bind(this)),document.addEventListener("click",this.onMouseEvent.bind(this),!0),document.addEventListener("mousemove",this.onMouseEvent.bind(this),!0),document.addEventListener("mouseup",this.onMouseEvent.bind(this),!0),document.addEventListener("mousedown",this.onMouseEvent.bind(this),!0),document.addEventListener("touchstart",this.onMouseEvent.bind(this)),document.addEventListener("touchend",this.onMouseEvent.bind(this))},i.updateScrollPosition=function(){var e={};if(void 0!=window.pageYOffset)e={left:pageXOffset,top:pageYOffset};else{var i,r,n=document,o=n.documentElement,s=n.body;i=o.scrollLeft||s.scrollLeft||0,r=o.scrollTop||s.scrollTop||0,e={left:i,top:r}}this.document.x=-e.left,this.document.y=-e.top,t.HTMLGL.scrollX=e.left,t.HTMLGL.scrollY=e.top,this.markStageAsChanged()},i.createViewer=function(){t.HTMLGL.renderer=this.renderer=PIXI.autoDetectRenderer(0,0,{transparent:!0}),this.renderer.view.style.position="fixed",this.renderer.view.style.top="0px",this.renderer.view.style.left="0px",this.renderer.view.style["pointer-events"]="none",this.renderer.view.style.pointerEvents="none"},i.appendViewer=function(){document.body.appendChild(this.renderer.view),requestAnimFrame(this.redrawStage.bind(this))},i.resizeViewer=function(){var e=t.innerWidth,i=t.innerHeight;this.renderer.resize(e,i),this.updateTextures(),this.markStageAsChanged()},i.createStage=function(){t.HTMLGL.stage=this.stage=new PIXI.Stage(16777215),t.HTMLGL.document=this.document=new PIXI.DisplayObjectContainer,this.stage.addChild(t.HTMLGL.document)},i.redrawStage=function(){t.HTMLGL.stage.changed&&(t.HTMLGL.renderer.render(t.HTMLGL.stage),t.HTMLGL.stage.changed=!1)},i.updateTextures=function(){t.HTMLGL.elements.forEach(function(t){t.updateTexture()})},i.onMouseEvent=function(e){var i=e.x||e.pageX,r=e.y||e.pageY,n="html-gl"!==e.dispatcher?this.elementResolver.getElementByCoordinates(i,r):null;n?t.HTMLGL.util.emitEvent(n,e):null},i.markStageAsChanged=function(){t.HTMLGL.stage&&!t.HTMLGL.stage.changed&&(requestAnimFrame(this.redrawStage),t.HTMLGL.stage.changed=!0)},t.HTMLGL.GLContext=e,new e}(window),function(t){var e=function(t,e){this.element=t,this.images=this.element.querySelectorAll("img"),this.callback=e,this.imagesLoaded=this.getImagesLoaded(),this.images.length===this.imagesLoaded?this.onImageLoaded():this.addListeners()},i=e.prototype;i.getImagesLoaded=function(){for(var t=0,e=0;et;t++)i.call(this,this._deferreds[t]);this._deferreds=null}function s(t,e,i,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=i,this.reject=r}function a(t,e,i){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,i(t))})}catch(n){if(r)return;r=!0,i(n)}}var h;h="object"==typeof window&&window?window:global;var l=e.immediateFn||h.setImmediate||function(t){setTimeout(t,1)},u=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.prototype["catch"]=function(t){return this.then(null,t)},e.prototype.then=function(t,r){var n=this;return new e(function(e,o){i.call(n,new s(t,r,e,o))})},e.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&u(arguments[0])?arguments[0]:arguments);return new e(function(e,i){function r(o,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){r(o,t)},i)}t[o]=s,0===--n&&e(t)}catch(h){i(h)}}if(0===t.length)return e([]);for(var n=t.length,o=0;or;r++)t[r].then(e,i)})},"undefined"!=typeof module&&module.exports?module.exports=e:h.Promise||(h.Promise=e)}(),"undefined"==typeof WeakMap&&!function(){var t=Object.defineProperty,e=Date.now()%1e9,i=function(){this.name="__st"+(1e9*Math.random()>>>0)+(e++ +"__")};i.prototype={set:function(e,i){var r=e[this.name];return r&&r[0]===e?r[1]=i:t(e,this.name,{value:[e,i],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},"delete":function(t){var e=t[this.name];return e&&e[0]===t?(e[0]=e[1]=void 0,!0):!1},has:function(t){var e=t[this.name];return e?e[0]===t:!1}},window.WeakMap=i}(),window.CustomElements=window.CustomElements||{flags:{}},function(t){var e=t.flags,i=[],r=function(t){i.push(t)},n=function(){i.forEach(function(e){e(t)})};t.addModule=r,t.initializeModules=n,t.hasNative=Boolean(document.registerElement),t.useNative=!e.register&&t.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(t){function e(t,e){i(t,function(t){return e(t)?!0:void r(t,e)}),r(t,e)}function i(t,e,r){var n=t.firstElementChild;if(!n)for(n=t.firstChild;n&&n.nodeType!==Node.ELEMENT_NODE;)n=n.nextSibling;for(;n;)e(n,r)!==!0&&i(n,e,r),n=n.nextElementSibling;return null}function r(t,i){for(var r=t.shadowRoot;r;)e(r,i),r=r.olderShadowRoot}function n(t,e){s=[],o(t,e),s=null}function o(t,e){if(t=wrap(t),!(s.indexOf(t)>=0)){s.push(t);for(var i,r=t.querySelectorAll("link[rel="+a+"]"),n=0,h=r.length;h>n&&(i=r[n]);n++)i["import"]&&o(i["import"],e);e(t)}}var s,a=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=n,t.forSubtree=e}),CustomElements.addModule(function(t){function e(t){return i(t)||r(t)}function i(e){return t.upgrade(e)?!0:void a(e)}function r(t){b(t,function(t){return i(t)?!0:void 0})}function n(t){a(t),d(t)&&b(t,function(t){a(t)})}function o(t){C.push(t),S||(S=!0,setTimeout(s))}function s(){S=!1;for(var t,e=C,i=0,r=e.length;r>i&&(t=e[i]);i++)t();C=[]}function a(t){T?o(function(){h(t)}):h(t)}function h(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&!t.__attached&&d(t)&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function l(t){u(t),b(t,function(t){u(t)})}function u(t){T?o(function(){c(t)}):c(t)}function c(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&t.__attached&&!d(t)&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function d(t){for(var e=t,i=wrap(document);e;){if(e==i)return!0;e=e.parentNode||e.host}}function p(t){if(t.shadowRoot&&!t.shadowRoot.__watched){x.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)m(e),e=e.olderShadowRoot}}function f(t){if(x.dom){var i=t[0];if(i&&"childList"===i.type&&i.addedNodes&&i.addedNodes){for(var r=i.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var n=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";n=n.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",t.length,n||"")}t.forEach(function(t){"childList"===t.type&&(E(t.addedNodes,function(t){t.localName&&e(t)}),E(t.removedNodes,function(t){t.localName&&l(t)}))}),x.dom&&console.groupEnd()}function g(t){for(t=wrap(t),t||(t=wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(f(e.takeRecords()),s())}function m(t){if(!t.__observer){var e=new MutationObserver(f);e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function v(t){t=wrap(t),x.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),e(t),m(t),x.dom&&console.groupEnd()}function y(t){w(t,v)}var x=t.flags,b=t.forSubtree,w=t.forDocumentTree,T=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;t.hasPolyfillMutations=T;var S=!1,C=[],E=Array.prototype.forEach.call.bind(Array.prototype.forEach),A=Element.prototype.createShadowRoot;A&&(Element.prototype.createShadowRoot=function(){var t=A.call(this);return CustomElements.watchShadow(this),t}),t.watchShadow=p,t.upgradeDocumentTree=y,t.upgradeSubtree=r,t.upgradeAll=e,t.attachedNode=n,t.takeRecords=g}),CustomElements.addModule(function(t){function e(e){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var r=e.getAttribute("is"),n=t.getRegisteredDefinition(r||e.localName);if(n){if(r&&n.tag==e.localName)return i(e,n);if(!r&&!n["extends"])return i(e,n)}}}function i(e,i){return s.upgrade&&console.group("upgrade:",e.localName),i.is&&e.setAttribute("is",i.is),r(e,i),e.__upgraded__=!0,o(e),t.attachedNode(e),t.upgradeSubtree(e),s.upgrade&&console.groupEnd(),e}function r(t,e){Object.__proto__?t.__proto__=e.prototype:(n(t,e.prototype,e["native"]),t.__proto__=e.prototype)}function n(t,e,i){for(var r={},n=e;n!==i&&n!==HTMLElement.prototype;){for(var o,s=Object.getOwnPropertyNames(n),a=0;o=s[a];a++)r[o]||(Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o)),r[o]=1);n=Object.getPrototypeOf(n)}}function o(t){t.createdCallback&&t.createdCallback()}var s=t.flags;t.upgrade=e,t.upgradeWithDefinition=i,t.implementPrototype=r}),CustomElements.addModule(function(t){function e(e,r){var h=r||{};if(!e)throw new Error("document.registerElement: first argument `name` must not be empty");if(e.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(e)+"'.");if(n(e))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(e)+"'. The type name is invalid.");if(l(e))throw new Error("DuplicateDefinitionError: a type with name '"+String(e)+"' is already registered");return h.prototype||(h.prototype=Object.create(HTMLElement.prototype)),h.__name=e.toLowerCase(),h.lifecycle=h.lifecycle||{},h.ancestry=o(h["extends"]),s(h),a(h),i(h.prototype),u(h.__name,h),h.ctor=c(h),h.ctor.prototype=h.prototype,h.prototype.constructor=h.ctor,t.ready&&m(document),h.ctor}function i(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,i){r.call(this,t,i,e)};var i=t.removeAttribute;t.removeAttribute=function(t){r.call(this,t,null,i)},t.setAttribute._polyfilled=!0}}function r(t,e,i){t=t.toLowerCase();var r=this.getAttribute(t);i.apply(this,arguments);var n=this.getAttribute(t);this.attributeChangedCallback&&n!==r&&this.attributeChangedCallback(t,r,n)}function n(t){for(var e=0;e=0&&x(r,HTMLElement),r)}function f(t){var e=A.call(this,t);return v(e),e}var g,m=t.upgradeDocumentTree,v=t.upgrade,y=t.upgradeWithDefinition,x=t.implementPrototype,b=t.useNative,w=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],T={},S="http://www.w3.org/1999/xhtml",C=document.createElement.bind(document),E=document.createElementNS.bind(document),A=Node.prototype.cloneNode;g=Object.__proto__||b?function(t,e){return t instanceof e}:function(t,e){for(var i=t;i;){if(i===e.prototype)return!0;i=i.__proto__}return!1},document.registerElement=e,document.createElement=p,document.createElementNS=d,Node.prototype.cloneNode=f,t.registry=T,t["instanceof"]=g,t.reservedTagList=w,t.getRegisteredDefinition=l,document.register=document.registerElement}),function(t){function e(){s(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(t){s(wrap(t["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var i=t.useNative,r=t.initializeModules,n=/Trident/.test(navigator.userAgent);if(i){var o=function(){};t.watchShadow=o,t.upgrade=o,t.upgradeAll=o,t.upgradeDocumentTree=o,t.upgradeSubtree=o,t.takeRecords=o,t["instanceof"]=function(t,e){return t instanceof e}}else r();var s=t.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),n&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(t,e){e=e||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),i},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||t.flags.eager)e();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(a,e)}else e()}(window.CustomElements),function(){var t=this,e=e||{};e.WEBGL_RENDERER=0,e.CANVAS_RENDERER=1,e.VERSION="v2.2.8",e.blendModes={NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},e.scaleModes={DEFAULT:0,LINEAR:0,NEAREST:1},e._UID=0,"undefined"!=typeof Float32Array?(e.Float32Array=Float32Array,e.Uint16Array=Uint16Array,e.Uint32Array=Uint32Array,e.ArrayBuffer=ArrayBuffer):(e.Float32Array=Array,e.Uint16Array=Array),e.INTERACTION_FREQUENCY=30,e.AUTO_PREVENT_DEFAULT=!0,e.PI_2=2*Math.PI,e.RAD_TO_DEG=180/Math.PI,e.DEG_TO_RAD=Math.PI/180,e.RETINA_PREFIX="@2x",e.dontSayHello=!1,e.defaultRenderOptions={view:null,transparent:!1,antialias:!1,preserveDrawingBuffer:!1,resolution:1,clearBeforeRender:!0,autoResize:!1},e.sayHello=function(t){if(!e.dontSayHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var i=["%c %c %c Pixi.js "+e.VERSION+" - "+t+" %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ ","background: #ff66a5","background: #ff66a5","color: #ff66a5; background: #030307;","background: #ff66a5","background: #ffc3dc","background: #ff66a5","color: #ff2424; background: #fff","color: #ff2424; background: #fff","color: #ff2424; background: #fff"];console.log.apply(console,i)}else window.console&&console.log("Pixi.js "+e.VERSION+" - http://www.pixijs.com/");e.dontSayHello=!0}},e.Point=function(t,e){this.x=t||0,this.y=e||0},e.Point.prototype.clone=function(){return new e.Point(this.x,this.y)},e.Point.prototype.set=function(t,e){this.x=t||0,this.y=e||(0!==e?this.x:0)},e.Point.prototype.constructor=e.Point,e.Rectangle=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Rectangle.prototype.clone=function(){return new e.Rectangle(this.x,this.y,this.width,this.height)},e.Rectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.Rectangle.prototype.constructor=e.Rectangle,e.EmptyRectangle=new e.Rectangle(0,0,0,0),e.Polygon=function(t){if(t instanceof Array||(t=Array.prototype.slice.call(arguments)),t[0]instanceof e.Point){for(var i=[],r=0,n=t.length;n>r;r++)i.push(t[r].x,t[r].y);t=i}this.closed=!0,this.points=t},e.Polygon.prototype.clone=function(){var t=this.points.slice();return new e.Polygon(t)},e.Polygon.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,o=r-1;r>n;o=n++){var s=this.points[2*n],a=this.points[2*n+1],h=this.points[2*o],l=this.points[2*o+1],u=a>e!=l>e&&(h-s)*(e-a)/(l-a)+s>t;u&&(i=!i)}return i},e.Polygon.prototype.constructor=e.Polygon,e.Circle=function(t,e,i){this.x=t||0,this.y=e||0,this.radius=i||0},e.Circle.prototype.clone=function(){return new e.Circle(this.x,this.y,this.radius)},e.Circle.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.x-t,r=this.y-e,n=this.radius*this.radius;return i*=i,r*=r,n>=i+r},e.Circle.prototype.getBounds=function(){return new e.Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},e.Circle.prototype.constructor=e.Circle,e.Ellipse=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Ellipse.prototype.clone=function(){return new e.Ellipse(this.x,this.y,this.width,this.height)},e.Ellipse.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,1>=i+r},e.Ellipse.prototype.getBounds=function(){return new e.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},e.Ellipse.prototype.constructor=e.Ellipse,e.RoundedRectangle=function(t,e,i,r,n){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0,this.radius=n||20},e.RoundedRectangle.prototype.clone=function(){return new e.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},e.RoundedRectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.RoundedRectangle.prototype.constructor=e.RoundedRectangle,e.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},e.Matrix.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},e.Matrix.prototype.toArray=function(t){this.array||(this.array=new e.Float32Array(9));var i=this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},e.Matrix.prototype.apply=function(t,i){return i=i||new e.Point,i.x=this.a*t.x+this.c*t.y+this.tx,i.y=this.b*t.x+this.d*t.y+this.ty,i},e.Matrix.prototype.applyInverse=function(t,i){i=i||new e.Point;var r=1/(this.a*this.d+this.c*-this.b);return i.x=this.d*r*t.x+-this.c*r*t.y+(this.ty*this.c-this.tx*this.d)*r,i.y=this.a*r*t.y+-this.b*r*t.x+(-this.ty*this.a+this.tx*this.b)*r,i},e.Matrix.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},e.Matrix.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},e.Matrix.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this},e.Matrix.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},e.Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},e.identityMatrix=new e.Matrix,e.DisplayObject=function(){this.position=new e.Point,this.scale=new e.Point(1,1),this.pivot=new e.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new e.Matrix,this._sr=0,this._cr=1,this.filterArea=null,this._bounds=new e.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},e.DisplayObject.prototype.constructor=e.DisplayObject,Object.defineProperty(e.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(t){this._interactive=t,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}}),Object.defineProperty(e.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(t){if(t){for(var e=[],i=0;i=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),this.stage&&t.setStageReference(this.stage),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},e.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),r=this.getChildIndex(e);if(0>i||0>r)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[r]=t}},e.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},e.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(0>e||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},e.DisplayObjectContainer.prototype.getChildAt=function(t){if(0>t||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},e.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);return-1!==e?this.removeChildAt(e):void 0},e.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return this.stage&&e.removeStageReference(),e.parent=void 0,this.children.splice(t,1),e},e.DisplayObjectContainer.prototype.removeChildren=function(t,e){var i=t||0,r="number"==typeof e?e:this.children.length,n=r-i;if(n>0&&r>=n){for(var o=this.children.splice(i,n),s=0;st;t++)this.children[t].updateTransform()},e.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=e.DisplayObjectContainer.prototype.updateTransform,e.DisplayObjectContainer.prototype.getBounds=function(){if(0===this.children.length)return e.EmptyRectangle;for(var t,i,r,n=1/0,o=1/0,s=-(1/0),a=-(1/0),h=!1,l=0,u=this.children.length;u>l;l++){var c=this.children[l];c.visible&&(h=!0,t=this.children[l].getBounds(),n=ni?s:i,a=a>r?a:r)}if(!h)return e.EmptyRectangle;var d=this._bounds;return d.x=n,d.y=o,d.width=s-n,d.height=a-o,d},e.DisplayObjectContainer.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=e.identityMatrix;for(var i=0,r=this.children.length;r>i;i++)this.children[i].updateTransform();var n=this.getBounds();return this.worldTransform=t,n},e.DisplayObjectContainer.prototype.setStageReference=function(t){this.stage=t,this._interactive&&(this.stage.dirty=!0);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r.setStageReference(t)}},e.DisplayObjectContainer.prototype.removeStageReference=function(){for(var t=0,e=this.children.length;e>t;t++){var i=this.children[t];i.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},e.DisplayObjectContainer.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);var e,i;if(this._mask||this._filters){for(this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),t.spriteBatch.start()}else for(e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.DisplayObjectContainer.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);this._mask&&t.maskManager.pushMask(this._mask,t);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r._renderCanvas(t)}this._mask&&t.maskManager.popMask(t)}},e.Sprite=function(t){e.DisplayObjectContainer.call(this),this.anchor=new e.Point,this.texture=t||e.Texture.emptyTexture,this._width=0,this._height=0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.shader=null,this.texture.baseTexture.hasLoaded?this.onTextureUpdate():this.texture.on("update",this.onTextureUpdate.bind(this)),this.renderable=!0},e.Sprite.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Sprite.prototype.constructor=e.Sprite,Object.defineProperty(e.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(t){this.scale.x=t/this.texture.frame.width,this._width=t}}),Object.defineProperty(e.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(t){this.scale.y=t/this.texture.frame.height,this._height=t}}),e.Sprite.prototype.setTexture=function(t){this.texture=t,this.cachedTint=16777215},e.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height)},e.Sprite.prototype.getBounds=function(t){var e=this.texture.frame.width,i=this.texture.frame.height,r=e*(1-this.anchor.x),n=e*-this.anchor.x,o=i*(1-this.anchor.y),s=i*-this.anchor.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=-(1/0),g=-(1/0),m=1/0,v=1/0;if(0===l&&0===u)0>h&&(h*=-1),0>c&&(c*=-1),m=h*n+d,f=h*r+d,v=c*s+p,g=c*o+p;else{var y=h*n+u*s+d,x=c*s+l*n+p,b=h*r+u*s+d,w=c*s+l*r+p,T=h*r+u*o+d,S=c*o+l*r+p,C=h*n+u*o+d,E=c*o+l*n+p;m=m>y?y:m,m=m>b?b:m,m=m>T?T:m,m=m>C?C:m,v=v>x?x:v,v=v>w?w:v,v=v>S?S:v,v=v>E?E:v,f=y>f?y:f,f=b>f?b:f,f=T>f?T:f,f=C>f?C:f,g=x>g?x:g,g=w>g?w:g,g=S>g?S:g,g=E>g?E:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=v,A.height=g-v,this._currentBounds=A,A},e.Sprite.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){var e,i;if(this._mask||this._filters){var r=t.spriteBatch;for(this._filters&&(r.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(r.stop(),t.maskManager.pushMask(this.mask,t),r.start()),r.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);r.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),r.start()}else for(t.spriteBatch.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.Sprite.prototype._renderCanvas=function(t){if(!(this.visible===!1||0===this.alpha||this.texture.crop.width<=0||this.texture.crop.height<=0)){if(this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,t.context.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t),this.texture.valid){var i=this.texture.baseTexture.resolution/t.resolution;t.context.globalAlpha=this.worldAlpha,t.smoothProperty&&t.scaleMode!==this.texture.baseTexture.scaleMode&&(t.scaleMode=this.texture.baseTexture.scaleMode,t.context[t.smoothProperty]=t.scaleMode===e.scaleModes.LINEAR);var r=this.texture.trim?this.texture.trim.x-this.anchor.x*this.texture.trim.width:this.anchor.x*-this.texture.frame.width,n=this.texture.trim?this.texture.trim.y-this.anchor.y*this.texture.trim.height:this.anchor.y*-this.texture.frame.height;t.roundPixels?(t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution|0,this.worldTransform.ty*t.resolution|0),r=0|r,n=0|n):t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution,this.worldTransform.ty*t.resolution),16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=e.CanvasTinter.getTintedTexture(this,this.tint)),t.context.drawImage(this.tintedTexture,0,0,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)):t.context.drawImage(this.texture.baseTexture.source,this.texture.crop.x,this.texture.crop.y,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)}for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Sprite.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache'+this); +return new e.Sprite(i)},e.Sprite.fromImage=function(t,i,r){var n=e.Texture.fromImage(t,i,r);return new e.Sprite(n)},e.SpriteBatch=function(t){e.DisplayObjectContainer.call(this),this.textureThing=t,this.ready=!1},e.SpriteBatch.prototype=Object.create(e.DisplayObjectContainer.prototype),e.SpriteBatch.prototype.constructor=e.SpriteBatch,e.SpriteBatch.prototype.initWebGL=function(t){this.fastSpriteBatch=new e.WebGLFastSpriteBatch(t),this.ready=!0},e.SpriteBatch.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},e.SpriteBatch.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(t.gl),this.fastSpriteBatch.gl!==t.gl&&this.fastSpriteBatch.setContext(t.gl),t.spriteBatch.stop(),t.shaderManager.setShader(t.shaderManager.fastShader),this.fastSpriteBatch.begin(this,t),this.fastSpriteBatch.render(this),t.spriteBatch.start())},e.SpriteBatch.prototype._renderCanvas=function(t){if(this.visible&&!(this.alpha<=0)&&this.children.length){var e=t.context;e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var i=this.worldTransform,r=!0,n=0;n=this.textures.length&&(this.gotoAndStop(this.textures.length-1),this.onComplete&&this.onComplete())}},e.MovieClip.fromFrames=function(t){for(var i=[],r=0;rh;h++){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p+=d}for(i.ascent=s-h,p=c-d,f=!1,h=a;h>s;h--){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p-=d}i.descent=h-s,i.descent+=6,i.fontSize=i.ascent+i.descent,e.Text.fontPropertiesCache[t]=i}return i},e.Text.prototype.wordWrap=function(t){for(var e="",i=t.split("\n"),r=0;rn?(s>0&&(e+="\n"),e+=o[s],n=this.style.wordWrapWidth-a):(n-=h,e+=" "+o[s])}r=2?parseInt(i[i.length-2],10):e.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=t.tint},e.BitmapText.prototype.updateText=function(){for(var t=e.BitmapText.fonts[this.fontName],i=new e.Point,r=null,n=[],o=0,s=[],a=0,h=this.fontSize/t.size,l=0;l=l;l++){var p=0;"right"===this.style.align?p=o-s[l]:"center"===this.style.align&&(p=(o-s[l])/2),d.push(p)}var f=this.children.length,g=n.length,m=this.tint||16777215;for(l=0;g>l;l++){var v=f>l?this.children[l]:this._pool.pop();v?v.setTexture(n[l].texture):v=new e.Sprite(n[l].texture),v.position.x=(n[l].position.x+d[n[l].line])*h,v.position.y=n[l].position.y*h,v.scale.x=v.scale.y=h,v.tint=m,v.parent||this.addChild(v)}for(;this.children.length>g;){var y=this.getChildAt(this.children.length-1);this._pool.push(y),this.removeChild(y)}this.textWidth=o*h,this.textHeight=(i.y+t.lineHeight)*h},e.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.BitmapText.fonts={},e.InteractionData=function(){this.global=new e.Point,this.target=null,this.originalEvent=null},e.InteractionData.prototype.getLocalPosition=function(t,i,r){var n=t.worldTransform,o=r?r:this.global,s=n.a,a=n.c,h=n.tx,l=n.b,u=n.d,c=n.ty,d=1/(s*u+a*-l);return i=i||new e.Point,i.x=u*d*o.x+-a*d*o.y+(c*a-h*u)*d,i.y=s*d*o.y+-l*d*o.x+(-c*s+h*l)*d,i},e.InteractionData.prototype.constructor=e.InteractionData,e.InteractionManager=function(t){this.stage=t,this.mouse=new e.InteractionData,this.touches={},this.tempPoint=new e.Point,this.mouseoverEnabled=!0,this.pool=[],this.interactiveItems=[],this.interactionDOMElement=null,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this.mouseOut=!1,this.resolution=1,this._tempPoint=new e.Point},e.InteractionManager.prototype.constructor=e.InteractionManager,e.InteractionManager.prototype.collectInteractiveSprite=function(t,e){for(var i=t.children,r=i.length,n=r-1;n>=0;n--){var o=i[n];o._interactive?(e.interactiveChildren=!0,this.interactiveItems.push(o),o.children.length>0&&this.collectInteractiveSprite(o,o)):(o.__iParent=null,o.children.length>0&&this.collectInteractiveSprite(o,e))}},e.InteractionManager.prototype.setTarget=function(t){this.target=t,this.resolution=t.resolution,null===this.interactionDOMElement&&this.setTargetDomElement(t.view)},e.InteractionManager.prototype.setTargetDomElement=function(t){this.removeEvents(),window.navigator.msPointerEnabled&&(t.style["-ms-content-zooming"]="none",t.style["-ms-touch-action"]="none"),this.interactionDOMElement=t,t.addEventListener("mousemove",this.onMouseMove,!0),t.addEventListener("mousedown",this.onMouseDown,!0),t.addEventListener("mouseout",this.onMouseOut,!0),t.addEventListener("touchstart",this.onTouchStart,!0),t.addEventListener("touchend",this.onTouchEnd,!0),t.addEventListener("touchleave",this.onTouchCancel,!0),t.addEventListener("touchcancel",this.onTouchCancel,!0),t.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0)},e.InteractionManager.prototype.removeEvents=function(){this.interactionDOMElement&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]="",this.interactionDOMElement.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchleave",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0))},e.InteractionManager.prototype.update=function(){if(this.target){var t=Date.now(),i=t-this.last;if(i=i*e.INTERACTION_FREQUENCY/1e3,!(1>i)){this.last=t;var r=0;this.dirty&&this.rebuildInteractiveGraph();var n=this.interactiveItems.length,o="inherit",s=!1;for(r=0;n>r;r++){var a=this.interactiveItems[r];a.__hit=this.hitTest(a,this.mouse),this.mouse.target=a,a.__hit&&!s?(a.buttonMode&&(o=a.defaultCursor),a.interactiveChildren||(s=!0),a.__isOver||(a.mouseover&&a.mouseover(this.mouse),a.__isOver=!0)):a.__isOver&&(a.mouseout&&a.mouseout(this.mouse),a.__isOver=!1)}this.currentCursorStyle!==o&&(this.currentCursorStyle=o,this.interactionDOMElement.style.cursor=o)}}},e.InteractionManager.prototype.rebuildInteractiveGraph=function(){this.dirty=!1;for(var t=this.interactiveItems.length,e=0;t>e;e++)this.interactiveItems[e].interactiveChildren=!1;this.interactiveItems=[],this.stage.interactive&&this.interactiveItems.push(this.stage),this.collectInteractiveSprite(this.stage,this.stage)},e.InteractionManager.prototype.onMouseMove=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactionDOMElement.getBoundingClientRect();this.mouse.global.x=(t.clientX-e.left)*(this.target.width/e.width)/this.resolution,this.mouse.global.y=(t.clientY-e.top)*(this.target.height/e.height)/this.resolution;for(var i=this.interactiveItems.length,r=0;i>r;r++){var n=this.interactiveItems[r];n.mousemove&&n.mousemove(this.mouse)}},e.InteractionManager.prototype.onMouseDown=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t,e.AUTO_PREVENT_DEFAULT&&this.mouse.originalEvent.preventDefault();for(var i=this.interactiveItems.length,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightdown":"mousedown",s=n?"rightclick":"click",a=n?"__rightIsDown":"__mouseIsDown",h=n?"__isRightDown":"__isDown",l=0;i>l;l++){var u=this.interactiveItems[l];if((u[o]||u[s])&&(u[a]=!0,u.__hit=this.hitTest(u,this.mouse),u.__hit&&(u[o]&&u[o](this.mouse),u[h]=!0,!u.interactiveChildren)))break}},e.InteractionManager.prototype.onMouseOut=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactiveItems.length;this.interactionDOMElement.style.cursor="inherit";for(var i=0;e>i;i++){var r=this.interactiveItems[i];r.__isOver&&(this.mouse.target=r,r.mouseout&&r.mouseout(this.mouse),r.__isOver=!1)}this.mouseOut=!0,this.mouse.global.x=-1e4,this.mouse.global.y=-1e4},e.InteractionManager.prototype.onMouseUp=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;for(var e=this.interactiveItems.length,i=!1,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightup":"mouseup",s=n?"rightclick":"click",a=n?"rightupoutside":"mouseupoutside",h=n?"__isRightDown":"__isDown",l=0;e>l;l++){var u=this.interactiveItems[l];(u[s]||u[o]||u[a])&&(u.__hit=this.hitTest(u,this.mouse),u.__hit&&!i?(u[o]&&u[o](this.mouse),u[h]&&u[s]&&u[s](this.mouse),u.interactiveChildren||(i=!0)):u[h]&&u[a]&&u[a](this.mouse),u[h]=!1)}},e.InteractionManager.prototype.hitTest=function(t,i){var r=i.global;if(!t.worldVisible)return!1;t.worldTransform.applyInverse(r,this._tempPoint);var n,o=this._tempPoint.x,s=this._tempPoint.y;if(i.target=t,t.hitArea&&t.hitArea.contains)return t.hitArea.contains(o,s);if(t instanceof e.Sprite){var a,h=t.texture.frame.width,l=t.texture.frame.height,u=-h*t.anchor.x;if(o>u&&u+h>o&&(a=-l*t.anchor.y,s>a&&a+l>s))return!0}else if(t instanceof e.Graphics){var c=t.graphicsData;for(n=0;nn;n++){var f=t.children[n],g=this.hitTest(f,i);if(g)return i.target=t,!0}return!1},e.InteractionManager.prototype.onTouchMove=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e,i,r=this.interactionDOMElement.getBoundingClientRect(),n=t.changedTouches,o=n.length,s=this.target.width/r.width,a=this.target.height/r.height,h=navigator.isCocoonJS&&!r.left&&!r.top&&!t.target.style.width&&!t.target.style.height,l=0;o>l;l++)i=n[l],h?(i.globalX=i.clientX,i.globalY=i.clientY):(i.globalX=(i.clientX-r.left)*s/this.resolution,i.globalY=(i.clientY-r.top)*a/this.resolution);for(var u=0;o>u;u++){i=n[u],e=this.touches[i.identifier],e.originalEvent=t,h?(e.global.x=i.clientX,e.global.y=i.clientY):(i.globalX=e.global.x=(i.clientX-r.left)*s/this.resolution,i.globalY=e.global.y=(i.clientY-r.top)*a/this.resolution);for(var c=0;cl;l++)r=n[l],h?(r.globalX=r.clientX,r.globalY=r.clientY):(r.globalX=(r.clientX-i.left)*s/this.resolution,r.globalY=(r.clientY-i.top)*a/this.resolution);for(var u=0;o>u;u++){r=n[u];var c=this.pool.pop();c||(c=new e.InteractionData),c.originalEvent=t,this.touches[r.identifier]=c,h?(c.global.x=r.clientX,c.global.y=r.clientY):(c.global.x=(r.clientX-i.left)*s/this.resolution,c.global.y=(r.clientY-i.top)*a/this.resolution);for(var d=this.interactiveItems.length,p=0;d>p;p++){var f=this.interactiveItems[p];if((f.touchstart||f.tap)&&(f.__hit=this.hitTest(f,c),f.__hit&&(f.touchstart&&f.touchstart(c),f.__isDown=!0,f.__touchData=f.__touchData||{},f.__touchData[r.identifier]=c,!f.interactiveChildren)))break}}},e.InteractionManager.prototype.onTouchEnd=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e,i=this.interactionDOMElement.getBoundingClientRect(),r=t.changedTouches,n=r.length,o=this.target.width/i.width,s=this.target.height/i.height,a=navigator.isCocoonJS&&!i.left&&!i.top&&!t.target.style.width&&!t.target.style.height,h=0;n>h;h++)e=r[h],a?(e.globalX=e.clientX,e.globalY=e.clientY):(e.globalX=(e.clientX-i.left)*o/this.resolution,e.globalY=(e.clientY-i.top)*s/this.resolution);for(var l=0;n>l;l++){e=r[l];var u=this.touches[e.identifier],c=!1;a?(u.global.x=e.clientX,u.global.y=e.clientY):(u.global.x=(e.clientX-i.left)*o/this.resolution,u.global.y=(e.clientY-i.top)*s/this.resolution);for(var d=this.interactiveItems.length,p=0;d>p;p++){var f=this.interactiveItems[p];f.__touchData&&f.__touchData[e.identifier]&&(f.__hit=this.hitTest(f,f.__touchData[e.identifier]),u.originalEvent=t,(f.touchend||f.tap)&&(f.__hit&&!c?(f.touchend&&f.touchend(u),f.__isDown&&f.tap&&f.tap(u),f.interactiveChildren||(c=!0)):f.__isDown&&f.touchendoutside&&f.touchendoutside(u),f.__isDown=!1),f.__touchData[e.identifier]=null)}this.pool.push(u),this.touches[e.identifier]=null}},e.InteractionManager.prototype.onTouchCancel=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e,i=this.interactionDOMElement.getBoundingClientRect(),r=t.changedTouches,n=r.length,o=this.target.width/i.width,s=this.target.height/i.height,a=navigator.isCocoonJS&&!i.left&&!i.top&&!t.target.style.width&&!t.target.style.height,h=0;n>h;h++)e=r[h],a?(e.globalX=e.clientX,e.globalY=e.clientY):(e.globalX=(e.clientX-i.left)*o/this.resolution,e.globalY=(e.clientY-i.top)*s/this.resolution);for(var l=0;n>l;l++){e=r[l];var u=this.touches[e.identifier],c=!1;a?(u.global.x=e.clientX,u.global.y=e.clientY):(u.global.x=(e.clientX-i.left)*o/this.resolution,u.global.y=(e.clientY-i.top)*s/this.resolution);for(var d=this.interactiveItems.length,p=0;d>p;p++){var f=this.interactiveItems[p];f.__touchData&&f.__touchData[e.identifier]&&(f.__hit=this.hitTest(f,f.__touchData[e.identifier]),u.originalEvent=t,f.touchcancel&&!c&&(f.touchcancel(u),f.interactiveChildren||(c=!0)),f.__isDown=!1,f.__touchData[e.identifier]=null)}this.pool.push(u),this.touches[e.identifier]=null}},e.Stage=function(t){e.DisplayObjectContainer.call(this),this.worldTransform=new e.Matrix,this.interactive=!0,this.interactionManager=new e.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new e.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(t)},e.Stage.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Stage.prototype.constructor=e.Stage,e.Stage.prototype.setInteractionDelegate=function(t){this.interactionManager.setTargetDomElement(t)},e.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var t=0,e=this.children.length;e>t;t++)this.children[t].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},e.Stage.prototype.setBackgroundColor=function(t){this.backgroundColor=t||0,this.backgroundColorSplit=e.hex2rgb(this.backgroundColor);var i=this.backgroundColor.toString(16);i="000000".substr(0,6-i.length)+i,this.backgroundColorString="#"+i},e.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},function(t){for(var e=0,i=["ms","moz","webkit","o"],r=0;r>16&255)/255,(t>>8&255)/255,(255&t)/255]},e.rgb2hex=function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){return function(t){function e(){for(var r=arguments.length,o=new Array(r);r--;)o[r]=arguments[r];return o=n.concat(o),i.apply(this instanceof e?this:t,o)}var i=this,r=arguments.length-1,n=[];if(r>0)for(n.length=r;r--;)n[r]=arguments[r+1];if("function"!=typeof i)throw new TypeError;return e.prototype=function o(t){return t&&(o.prototype=t),this instanceof o?void 0:new o}(i.prototype),e}}()),e.AjaxRequest=function(){var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var e=0;e0&&0===(t&t-1))return t;for(var e=1;t>e;)e<<=1;return e},e.isPowerOfTwo=function(t,e){return t>0&&0===(t&t-1)&&e>0&&0===(e&e-1)},e.EventTarget={call:function(t){t&&(t=t.prototype||t,e.EventTarget.mixin(t))},mixin:function(t){t.listeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?this._listeners[t].slice():[]},t.emit=t.dispatchEvent=function(t,i){if(this._listeners=this._listeners||{},"object"==typeof t&&(i=t,t=t.type),i&&i.__isEventObject===!0||(i=new e.Event(this,t,i)),this._listeners&&this._listeners[t]){var r,n=this._listeners[t].slice(0),o=n.length,s=n[0];for(r=0;o>r;s=n[++r])if(s.call(this,i),i.stoppedImmediate)return this;if(i.stopped)return this}return this.parent&&this.parent.emit&&this.parent.emit.call(this.parent,t,i),this},t.on=t.addEventListener=function(t,e){return this._listeners=this._listeners||{},(this._listeners[t]=this._listeners[t]||[]).push(e),this},t.once=function(t,e){function i(){e.apply(r.off(t,i),arguments)}this._listeners=this._listeners||{};var r=this;return i._originalHandler=e,this.on(t,i)},t.off=t.removeEventListener=function(t,e){if(this._listeners=this._listeners||{},!this._listeners[t])return this;for(var i=this._listeners[t],r=e?i.length:0;r-->0;)(i[r]===e||i[r]._originalHandler===e)&&i.splice(r,1);return 0===i.length&&delete this._listeners[t],this},t.removeAllListeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?(delete this._listeners[t],this):this}}},e.Event=function(t,e,i){this.__isEventObject=!0,this.stopped=!1,this.stoppedImmediate=!1,this.target=t,this.type=e,this.data=i,this.content=i,this.timeStamp=Date.now()},e.Event.prototype.stopPropagation=function(){this.stopped=!0},e.Event.prototype.stopImmediatePropagation=function(){this.stoppedImmediate=!0},e.autoDetectRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}();return n?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.autoDetectRecommendedRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}(),o=/Android/i.test(navigator.userAgent);return n&&!o?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.PolyK={},e.PolyK.Triangulate=function(t){var i=!0,r=t.length>>1;if(3>r)return[];for(var n=[],o=[],s=0;r>s;s++)o.push(s);s=0;for(var a=r;a>3;){var h=o[(s+0)%a],l=o[(s+1)%a],u=o[(s+2)%a],c=t[2*h],d=t[2*h+1],p=t[2*l],f=t[2*l+1],g=t[2*u],m=t[2*u+1],v=!1;if(e.PolyK._convex(c,d,p,f,g,m,i)){v=!0;for(var y=0;a>y;y++){var x=o[y];if(x!==h&&x!==l&&x!==u&&e.PolyK._PointInTriangle(t[2*x],t[2*x+1],c,d,p,f,g,m)){v=!1;break}}}if(v)n.push(h,l,u),o.splice((s+1)%a,1),a--,s=0;else if(s++>3*a){if(!i)return null;for(n=[],o=[],s=0;r>s;s++)o.push(s);s=0,a=r,i=!1}}return n.push(o[0],o[1],o[2]),n},e.PolyK._PointInTriangle=function(t,e,i,r,n,o,s,a){var h=s-i,l=a-r,u=n-i,c=o-r,d=t-i,p=e-r,f=h*h+l*l,g=h*u+l*c,m=h*d+l*p,v=u*u+c*c,y=u*d+c*p,x=1/(f*v-g*g),b=(v*m-g*y)*x,w=(f*y-g*m)*x;return b>=0&&w>=0&&1>b+w},e.PolyK._convex=function(t,e,i,r,n,o,s){return(e-r)*(n-i)+(i-t)*(o-r)>=0===s},e.initDefaultShaders=function(){},e.CompileVertexShader=function(t,i){return e._CompileShader(t,i,t.VERTEX_SHADER)},e.CompileFragmentShader=function(t,i){return e._CompileShader(t,i,t.FRAGMENT_SHADER)},e._CompileShader=function(t,e,i){var r=e.join("\n"),n=t.createShader(i);return t.shaderSource(n,r),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(window.console.log(t.getShaderInfoLog(n)),null)},e.compileProgram=function(t,i,r){var n=e.CompileFragmentShader(t,r),o=e.CompileVertexShader(t,i),s=t.createProgram();return t.attachShader(s,o),t.attachShader(s,n),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||window.console.log("Could not initialise shaders"),s},e.PixiShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.firstRun=!0,this.dirty=!0,this.attributes=[],this.init()},e.PixiShader.prototype.constructor=e.PixiShader,e.PixiShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc||e.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var r in this.uniforms)this.uniforms[r].uniformLocation=t.getUniformLocation(i,r);this.initUniforms(),this.program=i},e.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var t,e=this.gl;for(var i in this.uniforms){t=this.uniforms[i];var r=t.type;"sampler2D"===r?(t._init=!1,null!==t.value&&this.initSampler2D(t)):"mat2"===r||"mat3"===r||"mat4"===r?(t.glMatrix=!0,t.glValueLength=1,"mat2"===r?t.glFunc=e.uniformMatrix2fv:"mat3"===r?t.glFunc=e.uniformMatrix3fv:"mat4"===r&&(t.glFunc=e.uniformMatrix4fv)):(t.glFunc=e["uniform"+r],t.glValueLength="2f"===r||"2i"===r?2:"3f"===r||"3i"===r?3:"4f"===r||"4i"===r?4:1)}},e.PixiShader.prototype.initSampler2D=function(t){if(t.value&&t.value.baseTexture&&t.value.baseTexture.hasLoaded){var e=this.gl;if(e.activeTexture(e["TEXTURE"+this.textureCount]),e.bindTexture(e.TEXTURE_2D,t.value.baseTexture._glTextures[e.id]),t.textureData){var i=t.textureData,r=i.magFilter?i.magFilter:e.LINEAR,n=i.minFilter?i.minFilter:e.LINEAR,o=i.wrapS?i.wrapS:e.CLAMP_TO_EDGE,s=i.wrapT?i.wrapT:e.CLAMP_TO_EDGE,a=i.luminance?e.LUMINANCE:e.RGBA;if(i.repeat&&(o=e.REPEAT,s=e.REPEAT),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!i.flipY),i.width){var h=i.width?i.width:512,l=i.height?i.height:2,u=i.border?i.border:0;e.texImage2D(e.TEXTURE_2D,0,a,h,l,u,a,e.UNSIGNED_BYTE,null)}else e.texImage2D(e.TEXTURE_2D,0,a,e.RGBA,e.UNSIGNED_BYTE,t.value.baseTexture.source);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,s)}e.uniform1i(t.uniformLocation,this.textureCount),t._init=!0,this.textureCount++}},e.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var t,i=this.gl;for(var r in this.uniforms)t=this.uniforms[r],1===t.glValueLength?t.glMatrix===!0?t.glFunc.call(i,t.uniformLocation,t.transpose,t.value):t.glFunc.call(i,t.uniformLocation,t.value):2===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y):3===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z):4===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z,t.value.w):"sampler2D"===t.type&&(t._init?(i.activeTexture(i["TEXTURE"+this.textureCount]),t.value.baseTexture._dirty[i.id]?e.instances[i.id].updateTexture(t.value.baseTexture):i.bindTexture(i.TEXTURE_2D,t.value.baseTexture._glTextures[i.id]),i.uniform1i(t.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(t)) +},e.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"],e.PixiFastShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init()},e.PixiFastShader.prototype.constructor=e.PixiFastShader,e.PixiFastShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.uMatrix=t.getUniformLocation(i,"uMatrix"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aPositionCoord=t.getAttribLocation(i,"aPositionCoord"),this.aScale=t.getAttribLocation(i,"aScale"),this.aRotation=t.getAttribLocation(i,"aRotation"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=i},e.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.StripShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"],this.init()},e.StripShader.prototype.constructor=e.StripShader,e.StripShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.attributes=[this.aVertexPosition,this.aTextureCoord],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.StripShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.PrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform float flipY;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},e.PrimitiveShader.prototype.constructor=e.PrimitiveShader,e.PrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.ComplexPrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform vec3 tint;","uniform float alpha;","uniform vec3 color;","uniform float flipY;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = vec4(color * alpha * tint, alpha);","}"],this.init()},e.ComplexPrimitiveShader.prototype.constructor=e.ComplexPrimitiveShader,e.ComplexPrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.color=t.getUniformLocation(i,"color"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.ComplexPrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.WebGLGraphics=function(){},e.WebGLGraphics.renderGraphics=function(t,i){var r,n=i.gl,o=i.projection,s=i.offset,a=i.shaderManager.primitiveShader;t.dirty&&e.WebGLGraphics.updateGraphics(t,n);for(var h=t._webGL[n.id],l=0;l=6)if(a.points.length<12){s=e.WebGLGraphics.switchMode(r,0);var h=e.WebGLGraphics.buildPoly(a,s);h||(s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s))}else s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s);a.lineWidth>0&&(s=e.WebGLGraphics.switchMode(r,0),e.WebGLGraphics.buildLine(a,s))}else s=e.WebGLGraphics.switchMode(r,0),a.type===e.Graphics.RECT?e.WebGLGraphics.buildRectangle(a,s):a.type===e.Graphics.CIRC||a.type===e.Graphics.ELIP?e.WebGLGraphics.buildCircle(a,s):a.type===e.Graphics.RREC&&e.WebGLGraphics.buildRoundedRectangle(a,s);r.lastIndex++}for(n=0;n=m;m++)g=m/p,a=s(t,i,g),h=s(e,r,g),l=s(i,n,g),u=s(r,o,g),c=s(a,l,g),d=s(h,u,g),f.push(c,d);return f},e.WebGLGraphics.buildCircle=function(t,i){var r,n,o=t.shape,s=o.x,a=o.y;t.type===e.Graphics.CIRC?(r=o.radius,n=o.radius):(r=o.width,n=o.height);var h=40,l=2*Math.PI/h,u=0;if(t.fill){var c=e.hex2rgb(t.fillColor),d=t.fillAlpha,p=c[0]*d,f=c[1]*d,g=c[2]*d,m=i.points,v=i.indices,y=m.length/6;for(v.push(y),u=0;h+1>u;u++)m.push(s,a,p,f,g,d),m.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n,p,f,g,d),v.push(y++,y++);v.push(y-1)}if(t.lineWidth){var x=t.points;for(t.points=[],u=0;h+1>u;u++)t.points.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n);e.WebGLGraphics.buildLine(t,i),t.points=x}},e.WebGLGraphics.buildLine=function(t,i){var r=0,n=t.points;if(0!==n.length){if(t.lineWidth%2)for(r=0;rr;r++)c=n[2*(r-1)],d=n[2*(r-1)+1],p=n[2*r],f=n[2*r+1],g=n[2*(r+1)],m=n[2*(r+1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,x=-(f-m),b=p-g,P=Math.sqrt(x*x+b*b),x/=P,b/=P,x*=k,b*=k,S=-y+d-(-y+f),C=-v+p-(-v+c),E=(-v+c)*(-y+f)-(-v+p)*(-y+d),A=-b+m-(-b+f),_=-x+p-(-x+g),M=(-x+g)*(-b+f)-(-x+p)*(-b+m),L=S*_-A*C,Math.abs(L)<.1?(L+=10.1,F.push(p-v,f-y,U,j,V,N),F.push(p+v,f+y,U,j,V,N)):(l=(C*M-_*E)/L,u=(A*E-S*M)/L,R=(l-p)*(l-p)+(u-f)+(u-f),R>19600?(w=v-x,T=y-b,P=Math.sqrt(w*w+T*T),w/=P,T/=P,w*=k,T*=k,F.push(p-w,f-T),F.push(U,j,V,N),F.push(p+w,f+T),F.push(U,j,V,N),F.push(p-w,f-T),F.push(U,j,V,N),O++):(F.push(l,u),F.push(U,j,V,N),F.push(p-(l-p),f-(u-f)),F.push(U,j,V,N)));for(c=n[2*(I-2)],d=n[2*(I-2)+1],p=n[2*(I-1)],f=n[2*(I-1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,F.push(p-v,f-y),F.push(U,j,V,N),F.push(p+v,f+y),F.push(U,j,V,N),B.push(D),r=0;O>r;r++)B.push(D++);B.push(D-1)}},e.WebGLGraphics.buildComplexPoly=function(t,i){var r=t.points.slice();if(!(r.length<6)){var n=i.indices;i.points=r,i.alpha=t.fillAlpha,i.color=e.hex2rgb(t.fillColor);for(var o,s,a=1/0,h=-(1/0),l=1/0,u=-(1/0),c=0;co?o:a,h=o>h?o:h,l=l>s?s:l,u=s>u?s:u;r.push(a,l,h,l,h,u,a,u);var d=r.length/2;for(c=0;d>c;c++)n.push(c)}},e.WebGLGraphics.buildPoly=function(t,i){var r=t.points;if(!(r.length<6)){var n=i.points,o=i.indices,s=r.length/2,a=e.hex2rgb(t.fillColor),h=t.fillAlpha,l=a[0]*h,u=a[1]*h,c=a[2]*h,d=e.PolyK.Triangulate(r);if(!d)return!1;var p=n.length/6,f=0;for(f=0;ff;f++)n.push(r[2*f],r[2*f+1],l,u,c,h);return!0}},e.WebGLGraphics.graphicsDataPool=[],e.WebGLGraphicsData=function(t){this.gl=t,this.color=[0,0,0],this.points=[],this.indices=[],this.buffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.mode=1,this.alpha=1,this.dirty=!0},e.WebGLGraphicsData.prototype.reset=function(){this.points=[],this.indices=[]},e.WebGLGraphicsData.prototype.upload=function(){var t=this.gl;this.glPoints=new e.Float32Array(this.points),t.bindBuffer(t.ARRAY_BUFFER,this.buffer),t.bufferData(t.ARRAY_BUFFER,this.glPoints,t.STATIC_DRAW),this.glIndicies=new e.Uint16Array(this.indices),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.glIndicies,t.STATIC_DRAW),this.dirty=!1},e.glContexts=[],e.instances=[],e.WebGLRenderer=function(t,i,r){if(r)for(var n in e.defaultRenderOptions)"undefined"==typeof r[n]&&(r[n]=e.defaultRenderOptions[n]);else r=e.defaultRenderOptions;e.defaultRenderer||(e.sayHello("webGL"),e.defaultRenderer=this),this.type=e.WEBGL_RENDERER,this.resolution=r.resolution,this.transparent=r.transparent,this.autoResize=r.autoResize||!1,this.preserveDrawingBuffer=r.preserveDrawingBuffer,this.clearBeforeRender=r.clearBeforeRender,this.width=t||800,this.height=i||600,this.view=r.view||document.createElement("canvas"),this.contextLostBound=this.handleContextLost.bind(this),this.contextRestoredBound=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLostBound,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredBound,!1),this._contextOptions={alpha:this.transparent,antialias:r.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:r.preserveDrawingBuffer},this.projection=new e.Point,this.offset=new e.Point(0,0),this.shaderManager=new e.WebGLShaderManager,this.spriteBatch=new e.WebGLSpriteBatch,this.maskManager=new e.WebGLMaskManager,this.filterManager=new e.WebGLFilterManager,this.stencilManager=new e.WebGLStencilManager,this.blendModeManager=new e.WebGLBlendModeManager,this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.blendModeManager=this.blendModeManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.stencilManager=this.stencilManager,this.renderSession.renderer=this,this.renderSession.resolution=this.resolution,this.initContext(),this.mapBlendModes()},e.WebGLRenderer.prototype.constructor=e.WebGLRenderer,e.WebGLRenderer.prototype.initContext=function(){var t=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=t,!t)throw new Error("This browser does not support webGL. Try using the canvas renderer");this.glContextId=t.id=e.WebGLRenderer.glContextId++,e.glContexts[this.glContextId]=t,e.instances[this.glContextId]=this,t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),this.shaderManager.setContext(t),this.spriteBatch.setContext(t),this.maskManager.setContext(t),this.filterManager.setContext(t),this.blendModeManager.setContext(t),this.stencilManager.setContext(t),this.renderSession.gl=this.gl,this.resize(this.width,this.height)},e.WebGLRenderer.prototype.render=function(t){if(!this.contextLost){this.__stage!==t&&(t.interactive&&t.interactionManager.removeEvents(),this.__stage=t),t.updateTransform();var e=this.gl;t._interactive?t._interactiveEventsAdded||(t._interactiveEventsAdded=!0,t.interactionManager.setTarget(this)):t._interactiveEventsAdded&&(t._interactiveEventsAdded=!1,t.interactionManager.setTarget(this)),e.viewport(0,0,this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,null),this.clearBeforeRender&&(this.transparent?e.clearColor(0,0,0,0):e.clearColor(t.backgroundColorSplit[0],t.backgroundColorSplit[1],t.backgroundColorSplit[2],1),e.clear(e.COLOR_BUFFER_BIT)),this.renderDisplayObject(t,this.projection)}},e.WebGLRenderer.prototype.renderDisplayObject=function(t,i,r){this.renderSession.blendModeManager.setBlendMode(e.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=r?-1:1,this.renderSession.projection=i,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,r),t._renderWebGL(this.renderSession),this.spriteBatch.end()},e.WebGLRenderer.prototype.resize=function(t,e){this.width=t*this.resolution,this.height=e*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px"),this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2/this.resolution,this.projection.y=-this.height/2/this.resolution},e.WebGLRenderer.prototype.updateTexture=function(t){if(t.hasLoaded){var i=this.gl;return t._glTextures[i.id]||(t._glTextures[i.id]=i.createTexture()),i.bindTexture(i.TEXTURE_2D,t._glTextures[i.id]),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultipliedAlpha),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t.source),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t.mipmap&&e.isPowerOfTwo(t.width,t.height)?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST),i.generateMipmap(i.TEXTURE_2D)):i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t._powerOf2?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)),t._dirty[i.id]=!1,t._glTextures[i.id]}},e.WebGLRenderer.prototype.handleContextLost=function(t){t.preventDefault(),this.contextLost=!0},e.WebGLRenderer.prototype.handleContextRestored=function(){this.initContext();for(var t in e.TextureCache){var i=e.TextureCache[t].baseTexture;i._glTextures=[]}this.contextLost=!1},e.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLostBound),this.view.removeEventListener("webglcontextrestored",this.contextRestoredBound),e.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},e.WebGLRenderer.prototype.mapBlendModes=function(){var t=this.gl;e.blendModesWebGL||(e.blendModesWebGL=[],e.blendModesWebGL[e.blendModes.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.ADD]=[t.SRC_ALPHA,t.DST_ALPHA],e.blendModesWebGL[e.blendModes.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SCREEN]=[t.SRC_ALPHA,t.ONE],e.blendModesWebGL[e.blendModes.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA])},e.WebGLRenderer.glContextId=0,e.WebGLBlendModeManager=function(){this.currentBlendMode=99999},e.WebGLBlendModeManager.prototype.constructor=e.WebGLBlendModeManager,e.WebGLBlendModeManager.prototype.setContext=function(t){this.gl=t},e.WebGLBlendModeManager.prototype.setBlendMode=function(t){if(this.currentBlendMode===t)return!1;this.currentBlendMode=t;var i=e.blendModesWebGL[this.currentBlendMode];return this.gl.blendFunc(i[0],i[1]),!0},e.WebGLBlendModeManager.prototype.destroy=function(){this.gl=null},e.WebGLMaskManager=function(){},e.WebGLMaskManager.prototype.constructor=e.WebGLMaskManager,e.WebGLMaskManager.prototype.setContext=function(t){this.gl=t},e.WebGLMaskManager.prototype.pushMask=function(t,i){var r=i.gl;t.dirty&&e.WebGLGraphics.updateGraphics(t,r),t._webGL[r.id].data.length&&i.stencilManager.pushStencil(t,t._webGL[r.id].data[0],i)},e.WebGLMaskManager.prototype.popMask=function(t,e){var i=this.gl;e.stencilManager.popStencil(t,t._webGL[i.id].data[0],e)},e.WebGLMaskManager.prototype.destroy=function(){this.gl=null},e.WebGLStencilManager=function(){this.stencilStack=[],this.reverse=!0,this.count=0},e.WebGLStencilManager.prototype.setContext=function(t){this.gl=t},e.WebGLStencilManager.prototype.pushStencil=function(t,e,i){var r=this.gl;this.bindGraphics(t,e,i),0===this.stencilStack.length&&(r.enable(r.STENCIL_TEST),r.clear(r.STENCIL_BUFFER_BIT),this.reverse=!0,this.count=0),this.stencilStack.push(e);var n=this.count;r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),1===e.mode?(r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),this.reverse?r.stencilFunc(r.EQUAL,255-(n+1),255):r.stencilFunc(r.EQUAL,n+1,255),this.reverse=!this.reverse):(this.reverse?(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n+1,255):r.stencilFunc(r.EQUAL,255-(n+1),255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),this.count++},e.WebGLStencilManager.prototype.bindGraphics=function(t,i,r){this._currentGraphics=t;var n,o=this.gl,s=r.projection,a=r.offset;1===i.mode?(n=r.shaderManager.complexPrimitiveShader,r.shaderManager.setShader(n),o.uniform1f(n.flipY,r.flipY),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform3fv(n.color,i.color),o.uniform1f(n.alpha,t.worldAlpha*i.alpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,8,0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer)):(n=r.shaderManager.primitiveShader,r.shaderManager.setShader(n),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform1f(n.flipY,r.flipY),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform1f(n.alpha,t.worldAlpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,24,0),o.vertexAttribPointer(n.colorAttribute,4,o.FLOAT,!1,24,8),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer))},e.WebGLStencilManager.prototype.popStencil=function(t,e,i){var r=this.gl;if(this.stencilStack.pop(),this.count--,0===this.stencilStack.length)r.disable(r.STENCIL_TEST);else{var n=this.count;this.bindGraphics(t,e,i),r.colorMask(!1,!1,!1,!1),1===e.mode?(this.reverse=!this.reverse,this.reverse?(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)):(this.reverse?(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)}},e.WebGLStencilManager.prototype.destroy=function(){this.stencilStack=null,this.gl=null},e.WebGLShaderManager=function(){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var t=0;tr;r+=6,n+=4)this.indices[r+0]=n+0,this.indices[r+1]=n+1,this.indices[r+2]=n+2,this.indices[r+3]=n+0,this.indices[r+4]=n+2,this.indices[r+5]=n+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.dirty=!0,this.textures=[],this.blendModes=[],this.shaders=[],this.sprites=[],this.defaultShader=new e.AbstractFilter(["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"])},e.WebGLSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW),this.currentBlendMode=99999;var i=new e.PixiShader(t);i.fragmentSrc=this.defaultShader.fragmentSrc,i.uniforms={},i.init(),this.defaultShader.shaders[t.id]=i},e.WebGLSpriteBatch.prototype.begin=function(t){this.renderSession=t,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},e.WebGLSpriteBatch.prototype.end=function(){this.flush()},e.WebGLSpriteBatch.prototype.render=function(t){var e=t.texture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture);var i=e._uvs;if(i){var r,n,o,s,a=t.anchor.x,h=t.anchor.y;if(e.trim){var l=e.trim;n=l.x-a*l.width,r=n+e.crop.width,s=l.y-h*l.height,o=s+e.crop.height}else r=e.frame.width*(1-a),n=e.frame.width*-a,o=e.frame.height*(1-h),s=e.frame.height*-h;var u=4*this.currentBatchSize*this.vertSize,c=e.baseTexture.resolution,d=t.worldTransform,p=d.a/c,f=d.b/c,g=d.c/c,m=d.d/c,v=d.tx,y=d.ty,x=this.colors,b=this.positions;this.renderSession.roundPixels?(b[u]=p*n+g*s+v|0,b[u+1]=m*s+f*n+y|0,b[u+5]=p*r+g*s+v|0,b[u+6]=m*s+f*r+y|0,b[u+10]=p*r+g*o+v|0,b[u+11]=m*o+f*r+y|0,b[u+15]=p*n+g*o+v|0,b[u+16]=m*o+f*n+y|0):(b[u]=p*n+g*s+v,b[u+1]=m*s+f*n+y,b[u+5]=p*r+g*s+v,b[u+6]=m*s+f*r+y,b[u+10]=p*r+g*o+v,b[u+11]=m*o+f*r+y,b[u+15]=p*n+g*o+v,b[u+16]=m*o+f*n+y),b[u+2]=i.x0,b[u+3]=i.y0,b[u+7]=i.x1,b[u+8]=i.y1,b[u+12]=i.x2,b[u+13]=i.y2,b[u+17]=i.x3,b[u+18]=i.y3;var w=t.tint;x[u+4]=x[u+9]=x[u+14]=x[u+19]=(w>>16)+(65280&w)+((255&w)<<16)+(255*t.worldAlpha<<24),this.sprites[this.currentBatchSize++]=t}},e.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var i=t.tilingTexture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=i.baseTexture),t._uvs||(t._uvs=new e.TextureUvs);var r=t._uvs;t.tilePosition.x%=i.baseTexture.width*t.tileScaleOffset.x,t.tilePosition.y%=i.baseTexture.height*t.tileScaleOffset.y;var n=t.tilePosition.x/(i.baseTexture.width*t.tileScaleOffset.x),o=t.tilePosition.y/(i.baseTexture.height*t.tileScaleOffset.y),s=t.width/i.baseTexture.width/(t.tileScale.x*t.tileScaleOffset.x),a=t.height/i.baseTexture.height/(t.tileScale.y*t.tileScaleOffset.y); +r.x0=0-n,r.y0=0-o,r.x1=1*s-n,r.y1=0-o,r.x2=1*s-n,r.y2=1*a-o,r.x3=0-n,r.y3=1*a-o;var h=t.tint,l=(h>>16)+(65280&h)+((255&h)<<16)+(255*t.alpha<<24),u=this.positions,c=this.colors,d=t.width,p=t.height,f=t.anchor.x,g=t.anchor.y,m=d*(1-f),v=d*-f,y=p*(1-g),x=p*-g,b=4*this.currentBatchSize*this.vertSize,w=i.baseTexture.resolution,T=t.worldTransform,S=T.a/w,C=T.b/w,E=T.c/w,A=T.d/w,_=T.tx,M=T.ty;u[b++]=S*v+E*x+_,u[b++]=A*x+C*v+M,u[b++]=r.x0,u[b++]=r.y0,c[b++]=l,u[b++]=S*m+E*x+_,u[b++]=A*x+C*m+M,u[b++]=r.x1,u[b++]=r.y1,c[b++]=l,u[b++]=S*m+E*y+_,u[b++]=A*y+C*m+M,u[b++]=r.x2,u[b++]=r.y2,c[b++]=l,u[b++]=S*v+E*y+_,u[b++]=A*y+C*v+M,u[b++]=r.x3,u[b++]=r.y3,c[b++]=l,this.sprites[this.currentBatchSize++]=t},e.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,i=this.gl;if(this.dirty){this.dirty=!1,i.activeTexture(i.TEXTURE0),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t=this.defaultShader.shaders[i.id];var r=4*this.vertSize;i.vertexAttribPointer(t.aVertexPosition,2,i.FLOAT,!1,r,0),i.vertexAttribPointer(t.aTextureCoord,2,i.FLOAT,!1,r,8),i.vertexAttribPointer(t.colorAttribute,4,i.UNSIGNED_BYTE,!0,r,16)}if(this.currentBatchSize>.5*this.size)i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices);else{var n=this.positions.subarray(0,4*this.currentBatchSize*this.vertSize);i.bufferSubData(i.ARRAY_BUFFER,0,n)}for(var o,s,a,h,l=0,u=0,c=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,v=this.currentBatchSize;v>m;m++){if(h=this.sprites[m],o=h.texture.baseTexture,s=h.blendMode,a=h.shader||this.defaultShader,f=d!==s,g=p!==a,(c!==o||f||g)&&(this.renderBatch(c,l,u),u=m,l=0,c=o,f&&(d=s,this.renderSession.blendModeManager.setBlendMode(d)),g)){p=a,t=p.shaders[i.id],t||(t=new e.PixiShader(i),t.fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[i.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms();var y=this.renderSession.projection;i.uniform2f(t.projectionVector,y.x,y.y);var x=this.renderSession.offset;i.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(c,l,u),this.currentBatchSize=0}},e.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var r=this.gl;t._dirty[r.id]?this.renderSession.renderer.updateTexture(t):r.bindTexture(r.TEXTURE_2D,t._glTextures[r.id]),r.drawElements(r.TRIANGLES,6*e,r.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},e.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},e.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},e.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},e.WebGLFastSpriteBatch=function(t){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var i=4*this.size*this.vertSize,r=6*this.maxSize;this.vertices=new e.Float32Array(i),this.indices=new e.Uint16Array(r),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,o=0;r>n;n+=6,o+=4)this.indices[n+0]=o+0,this.indices[n+1]=o+1,this.indices[n+2]=o+2,this.indices[n+3]=o+0,this.indices[n+4]=o+2,this.indices[n+5]=o+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(t)},e.WebGLFastSpriteBatch.prototype.constructor=e.WebGLFastSpriteBatch,e.WebGLFastSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW)},e.WebGLFastSpriteBatch.prototype.begin=function(t,e){this.renderSession=e,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=t.worldTransform.toArray(!0),this.start()},e.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.render=function(t){var e=t.children,i=e[0];if(i.texture._uvs){this.currentBaseTexture=i.texture.baseTexture,i.blendMode!==this.renderSession.blendModeManager.currentBlendMode&&(this.flush(),this.renderSession.blendModeManager.setBlendMode(i.blendMode));for(var r=0,n=e.length;n>r;r++)this.renderSprite(e[r]);this.flush()}},e.WebGLFastSpriteBatch.prototype.renderSprite=function(t){if(t.visible&&(t.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=t.texture.baseTexture,t.texture._uvs))){var e,i,r,n,o,s,a,h,l=this.vertices;if(e=t.texture._uvs,i=t.texture.frame.width,r=t.texture.frame.height,t.texture.trim){var u=t.texture.trim;o=u.x-t.anchor.x*u.width,n=o+t.texture.crop.width,a=u.y-t.anchor.y*u.height,s=a+t.texture.crop.height}else n=t.texture.frame.width*(1-t.anchor.x),o=t.texture.frame.width*-t.anchor.x,s=t.texture.frame.height*(1-t.anchor.y),a=t.texture.frame.height*-t.anchor.y;h=4*this.currentBatchSize*this.vertSize,l[h++]=o,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x0,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x1,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x2,l[h++]=e.y2,l[h++]=t.alpha,l[h++]=o,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x3,l[h++]=e.y3,l[h++]=t.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},e.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]||this.renderSession.renderer.updateTexture(this.currentBaseTexture,t),t.bindTexture(t.TEXTURE_2D,this.currentBaseTexture._glTextures[t.id]),this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},e.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36)},e.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},e.WebGLFilterManager.prototype.constructor=e.WebGLFilterManager,e.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},e.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},e.WebGLFilterManager.prototype.pushFilter=function(t){var i=this.gl,r=this.renderSession.projection,n=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),this.filterStack.push(t);var o=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var s=this.texturePool.pop();s?s.resize(this.width,this.height):s=new e.FilterTexture(this.gl,this.width,this.height),i.bindTexture(i.TEXTURE_2D,s.texture);var a=t._filterArea,h=o.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),i.bindFramebuffer(i.FRAMEBUFFER,s.frameBuffer),i.viewport(0,0,a.width,a.height),r.x=a.width/2,r.y=-a.height/2,n.x=-a.x,n.y=-a.y,i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),t._glFilterTexture=s},e.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,i=this.filterStack.pop(),r=i._filterArea,n=i._glFilterTexture,o=this.renderSession.projection,s=this.renderSession.offset;if(i.filterPasses.length>1){t.viewport(0,0,r.width,r.height),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=r.height,this.vertexArray[2]=r.width,this.vertexArray[3]=r.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=r.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=r.width/this.width,this.uvArray[5]=r.height/this.height,this.uvArray[6]=r.width/this.width,this.uvArray[7]=r.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=n,h=this.texturePool.pop();h||(h=new e.FilterTexture(this.gl,this.width,this.height)),h.resize(this.width,this.height),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l_?_:A,i.beginPath(),i.moveTo(T,S+A),i.lineTo(T,S+E-A),i.quadraticCurveTo(T,S+E,T+A,S+E),i.lineTo(T+C-A,S+E),i.quadraticCurveTo(T+C,S+E,T+C,S+E-A),i.lineTo(T+C,S+A),i.quadraticCurveTo(T+C,S,T+C-A,S),i.lineTo(T+A,S),i.quadraticCurveTo(T,S,T,S+A),i.closePath(),(o.fillColor||0===o.fillColor)&&(i.globalAlpha=o.fillAlpha*r,i.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),i.fill()),o.lineWidth&&(i.globalAlpha=o.lineAlpha*r,i.strokeStyle="#"+("00000"+(0|h).toString(16)).substr(-6),i.stroke())}}},e.CanvasGraphics.renderGraphicsMask=function(t,i){var r=t.graphicsData.length;if(0!==r){r>1&&(r=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var n=0;1>n;n++){var o=t.graphicsData[n],s=o.shape;if(o.type===e.Graphics.POLY){i.beginPath();var a=s.points;i.moveTo(a[0],a[1]);for(var h=1;hA?A:E,i.beginPath(),i.moveTo(w,T+E),i.lineTo(w,T+C-E),i.quadraticCurveTo(w,T+C,w+E,T+C),i.lineTo(w+S-E,T+C),i.quadraticCurveTo(w+S,T+C,w+S,T+C-E),i.lineTo(w+S,T+E),i.quadraticCurveTo(w+S,T,w+S-E,T),i.lineTo(w+E,T),i.quadraticCurveTo(w,T,w,T+E),i.closePath()}}}},e.CanvasGraphics.updateGraphicsTint=function(t){if(16777215!==t.tint)for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,r=(255&t.tint)/255,n=0;n>16&255)/255*e*255<<16)+((s>>8&255)/255*i*255<<8)+(255&s)/255*r*255,o._lineTint=((a>>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*r*255}},e.Graphics=function(){e.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new e.Rectangle(0,0,1,1),this.dirty=!0,this.webGLDirty=!1,this.cachedSpriteDirty=!1},e.Graphics.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Graphics.prototype.constructor=e.Graphics,Object.defineProperty(e.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(t){this._cacheAsBitmap=t,this._cacheAsBitmap?this._generateCachedSprite():(this.destroyCachedSprite(),this.dirty=!0)}}),e.Graphics.prototype.lineStyle=function(t,i,r){if(this.lineWidth=t||0,this.lineColor=i||0,this.lineAlpha=arguments.length<3?1:r,this.currentPath){if(this.currentPath.shape.points.length)return this.drawShape(new e.Polygon(this.currentPath.shape.points.slice(-2))),this;this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha}return this},e.Graphics.prototype.moveTo=function(t,i){return this.drawShape(new e.Polygon([t,i])),this},e.Graphics.prototype.lineTo=function(t,e){return this.currentPath.shape.points.push(t,e),this.dirty=!0,this},e.Graphics.prototype.quadraticCurveTo=function(t,e,i,r){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var n,o,s=20,a=this.currentPath.shape.points;0===a.length&&this.moveTo(0,0);for(var h=a[a.length-2],l=a[a.length-1],u=0,c=1;s>=c;c++)u=c/s,n=h+(t-h)*u,o=l+(e-l)*u,a.push(n+(t+(i-t)*u-n)*u,o+(e+(r-e)*u-o)*u);return this.dirty=!0,this},e.Graphics.prototype.bezierCurveTo=function(t,e,i,r,n,o){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var s,a,h,l,u,c=20,d=this.currentPath.shape.points,p=d[d.length-2],f=d[d.length-1],g=0,m=1;c>=m;m++)g=m/c,s=1-g,a=s*s,h=a*s,l=g*g,u=l*g,d.push(h*p+3*a*g*t+3*s*l*i+u*n,h*f+3*a*g*e+3*s*l*r+u*o);return this.dirty=!0,this},e.Graphics.prototype.arcTo=function(t,e,i,r,n){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(t,e):this.moveTo(t,e);var o=this.currentPath.shape.points,s=o[o.length-2],a=o[o.length-1],h=a-e,l=s-t,u=r-e,c=i-t,d=Math.abs(h*c-l*u);if(1e-8>d||0===n)(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e);else{var p=h*h+l*l,f=u*u+c*c,g=h*u+l*c,m=n*Math.sqrt(p)/d,v=n*Math.sqrt(f)/d,y=m*g/p,x=v*g/f,b=m*c+v*l,w=m*u+v*h,T=l*(v+y),S=h*(v+y),C=c*(m+x),E=u*(m+x),A=Math.atan2(S-w,T-b),_=Math.atan2(E-w,C-b);this.arc(b+t,w+e,n,A,_,l*u>c*h)}return this.dirty=!0,this},e.Graphics.prototype.arc=function(t,e,i,r,n,o){var s,a=t+Math.cos(r)*i,h=e+Math.sin(r)*i;if(this.currentPath?(s=this.currentPath.shape.points,0===s.length?s.push(a,h):(s[s.length-2]!==a||s[s.length-1]!==h)&&s.push(a,h)):(this.moveTo(a,h),s=this.currentPath.shape.points),r===n)return this;!o&&r>=n?n+=2*Math.PI:o&&n>=r&&(r+=2*Math.PI);var l=o?-1*(r-n):n-r,u=Math.abs(l)/(2*Math.PI)*40;if(0===l)return this;for(var c=l/(2*u),d=2*c,p=Math.cos(c),f=Math.sin(c),g=u-1,m=g%1/g,v=0;g>=v;v++){var y=v+m*v,x=c+r+d*y,b=Math.cos(x),w=-Math.sin(x);s.push((p*b+f*w)*i+t,(p*-w+f*b)*i+e)}return this.dirty=!0,this},e.Graphics.prototype.beginFill=function(t,e){return this.filling=!0,this.fillColor=t||0,this.fillAlpha=void 0===e?1:e,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},e.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},e.Graphics.prototype.drawRect=function(t,i,r,n){return this.drawShape(new e.Rectangle(t,i,r,n)),this},e.Graphics.prototype.drawRoundedRect=function(t,i,r,n,o){return this.drawShape(new e.RoundedRectangle(t,i,r,n,o)),this},e.Graphics.prototype.drawCircle=function(t,i,r){return this.drawShape(new e.Circle(t,i,r)),this},e.Graphics.prototype.drawEllipse=function(t,i,r,n){return this.drawShape(new e.Ellipse(t,i,r,n)),this},e.Graphics.prototype.drawPolygon=function(t){return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.drawShape(new e.Polygon(t)),this},e.Graphics.prototype.clear=function(){return this.lineWidth=0,this.filling=!1,this.dirty=!0,this.clearDirty=!0,this.graphicsData=[],this},e.Graphics.prototype.generateTexture=function(t,i){t=t||1;var r=this.getBounds(),n=new e.CanvasBuffer(r.width*t,r.height*t),o=e.Texture.fromCanvas(n.canvas,i);return o.baseTexture.resolution=t,n.context.scale(t,t),n.context.translate(-r.x,-r.y),e.CanvasGraphics.renderGraphics(this,n.context),o},e.Graphics.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.worldAlpha=this.worldAlpha,void e.Sprite.prototype._renderWebGL.call(this._cachedSprite,t);if(t.spriteBatch.stop(),t.blendModeManager.setBlendMode(this.blendMode),this._mask&&t.maskManager.pushMask(this._mask,t),this._filters&&t.filterManager.pushFilter(this._filterBlock),this.blendMode!==t.spriteBatch.currentBlendMode){t.spriteBatch.currentBlendMode=this.blendMode; +var i=e.blendModesWebGL[t.spriteBatch.currentBlendMode];t.spriteBatch.gl.blendFunc(i[0],i[1])}if(this.webGLDirty&&(this.dirty=!0,this.webGLDirty=!1),e.WebGLGraphics.renderGraphics(this,t),this.children.length){t.spriteBatch.start();for(var r=0,n=this.children.length;n>r;r++)this.children[r]._renderWebGL(t);t.spriteBatch.stop()}this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this.mask,t),t.drawCount++,t.spriteBatch.start()}},e.Graphics.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.alpha=this.alpha,void e.Sprite.prototype._renderCanvas.call(this._cachedSprite,t);var i=t.context,r=this.worldTransform;this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t);var n=t.resolution;i.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n,r.ty*n),e.CanvasGraphics.renderGraphics(this,i);for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Graphics.prototype.getBounds=function(t){if(this.isMask)return e.EmptyRectangle;this.dirty&&(this.updateLocalBounds(),this.webGLDirty=!0,this.cachedSpriteDirty=!0,this.dirty=!1);var i=this._localBounds,r=i.x,n=i.width+i.x,o=i.y,s=i.height+i.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=h*n+u*s+d,g=c*s+l*n+p,m=h*r+u*s+d,v=c*s+l*r+p,y=h*r+u*o+d,x=c*o+l*r+p,b=h*n+u*o+d,w=c*o+l*n+p,T=f,S=g,C=f,E=g;return C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,E=E>v?v:E,E=E>x?x:E,E=E>w?w:E,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T,S=v>S?v:S,S=x>S?x:S,S=w>S?w:S,this._bounds.x=C,this._bounds.width=T-C,this._bounds.y=E,this._bounds.height=S-E,this._bounds},e.Graphics.prototype.updateLocalBounds=function(){var t=1/0,i=-(1/0),r=1/0,n=-(1/0);if(this.graphicsData.length)for(var o,s,a,h,l,u,c=0;ca?a:t,i=a+l>i?a+l:i,r=r>h?h:r,n=h+u>n?h+u:n;else if(p===e.Graphics.CIRC)a=o.x,h=o.y,l=o.radius+f/2,u=o.radius+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else if(p===e.Graphics.ELIP)a=o.x,h=o.y,l=o.width+f/2,u=o.height+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else{s=o.points;for(var g=0;ga-f?a-f:t,i=a+f>i?a+f:i,r=r>h-f?h-f:r,n=h+f>n?h+f:n}}else t=0,i=0,r=0,n=0;var m=this.boundsPadding;this._localBounds.x=t-m,this._localBounds.width=i-t+2*m,this._localBounds.y=r-m,this._localBounds.height=n-r+2*m},e.Graphics.prototype._generateCachedSprite=function(){var t=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(t.width,t.height);else{var i=new e.CanvasBuffer(t.width,t.height),r=e.Texture.fromCanvas(i.canvas);this._cachedSprite=new e.Sprite(r),this._cachedSprite.buffer=i,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(t.x/t.width),this._cachedSprite.anchor.y=-(t.y/t.height),this._cachedSprite.buffer.context.translate(-t.x,-t.y),this.worldAlpha=1,e.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},e.Graphics.prototype.updateCachedSpriteTexture=function(){var t=this._cachedSprite,e=t.texture,i=t.buffer.canvas;e.baseTexture.width=i.width,e.baseTexture.height=i.height,e.crop.width=e.frame.width=i.width,e.crop.height=e.frame.height=i.height,t._width=i.width,t._height=i.height,e.baseTexture.dirty()},e.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},e.Graphics.prototype.drawShape=function(t){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null;var i=new e.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,t);return this.graphicsData.push(i),i.type===e.Graphics.POLY&&(i.shape.closed=this.filling,this.currentPath=i),this.dirty=!0,i},e.GraphicsData=function(t,e,i,r,n,o,s){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this._lineTint=e,this.fillColor=r,this.fillAlpha=n,this._fillTint=r,this.fill=o,this.shape=s,this.type=s.type},e.Graphics.POLY=0,e.Graphics.RECT=1,e.Graphics.CIRC=2,e.Graphics.ELIP=3,e.Graphics.RREC=4,e.Polygon.prototype.type=e.Graphics.POLY,e.Rectangle.prototype.type=e.Graphics.RECT,e.Circle.prototype.type=e.Graphics.CIRC,e.Ellipse.prototype.type=e.Graphics.ELIP,e.RoundedRectangle.prototype.type=e.Graphics.RREC,e.Strip=function(t){e.DisplayObjectContainer.call(this),this.texture=t,this.uvs=new e.Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new e.Float32Array([0,0,100,0,100,100,0,100]),this.colors=new e.Float32Array([1,1,1,1]),this.indices=new e.Uint16Array([0,1,2,3]),this.dirty=!0,this.blendMode=e.blendModes.NORMAL,this.canvasPadding=0,this.drawMode=e.Strip.DrawModes.TRIANGLE_STRIP},e.Strip.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Strip.prototype.constructor=e.Strip,e.Strip.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||(t.spriteBatch.stop(),this._vertexBuffer||this._initWebGL(t),t.shaderManager.setShader(t.shaderManager.stripShader),this._renderStrip(t),t.spriteBatch.start())},e.Strip.prototype._initWebGL=function(t){var e=t.gl;this._vertexBuffer=e.createBuffer(),this._indexBuffer=e.createBuffer(),this._uvBuffer=e.createBuffer(),this._colorBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices,e.DYNAMIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._uvBuffer),e.bufferData(e.ARRAY_BUFFER,this.uvs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colors,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW)},e.Strip.prototype._renderStrip=function(t){var i=t.gl,r=t.projection,n=t.offset,o=t.shaderManager.stripShader,s=this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?i.TRIANGLE_STRIP:i.TRIANGLES;t.blendModeManager.setBlendMode(this.blendMode),i.uniformMatrix3fv(o.translationMatrix,!1,this.worldTransform.toArray(!0)),i.uniform2f(o.projectionVector,r.x,-r.y),i.uniform2f(o.offsetVector,-n.x,-n.y),i.uniform1f(o.alpha,this.worldAlpha),this.dirty?(this.dirty=!1,i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertices,i.STATIC_DRAW),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.bufferData(i.ARRAY_BUFFER,this.uvs,i.STATIC_DRAW),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,this.indices,i.STATIC_DRAW)):(i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer)),i.drawElements(s,this.indices.length,i.UNSIGNED_SHORT,0)},e.Strip.prototype._renderCanvas=function(t){var i=t.context,r=this.worldTransform;t.roundPixels?i.setTransform(r.a,r.b,r.c,r.d,0|r.tx,0|r.ty):i.setTransform(r.a,r.b,r.c,r.d,r.tx,r.ty),this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?this._renderCanvasTriangleStrip(i):this._renderCanvasTriangles(i)},e.Strip.prototype._renderCanvasTriangleStrip=function(t){var e=this.vertices,i=this.uvs,r=e.length/2;this.count++;for(var n=0;r-2>n;n++){var o=2*n;this._renderCanvasDrawTriangle(t,e,i,o,o+2,o+4)}},e.Strip.prototype._renderCanvasTriangles=function(t){var e=this.vertices,i=this.uvs,r=this.indices,n=r.length;this.count++;for(var o=0;n>o;o+=3){var s=2*r[o],a=2*r[o+1],h=2*r[o+2];this._renderCanvasDrawTriangle(t,e,i,s,a,h)}},e.Strip.prototype._renderCanvasDrawTriangle=function(t,e,i,r,n,o){var s=this.texture.baseTexture.source,a=this.texture.width,h=this.texture.height,l=e[r],u=e[n],c=e[o],d=e[r+1],p=e[n+1],f=e[o+1],g=i[r]*a,m=i[n]*a,v=i[o]*a,y=i[r+1]*h,x=i[n+1]*h,b=i[o+1]*h;if(this.canvasPadding>0){var w=this.canvasPadding/this.worldTransform.a,T=this.canvasPadding/this.worldTransform.d,S=(l+u+c)/3,C=(d+p+f)/3,E=l-S,A=d-C,_=Math.sqrt(E*E+A*A);l=S+E/_*(_+w),d=C+A/_*(_+T),E=u-S,A=p-C,_=Math.sqrt(E*E+A*A),u=S+E/_*(_+w),p=C+A/_*(_+T),E=c-S,A=f-C,_=Math.sqrt(E*E+A*A),c=S+E/_*(_+w),f=C+A/_*(_+T)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(u,p),t.lineTo(c,f),t.closePath(),t.clip();var M=g*x+y*v+m*b-x*v-y*m-g*b,L=l*x+y*c+u*b-x*c-y*u-l*b,R=g*u+l*v+m*c-u*v-l*m-g*c,P=g*x*c+y*u*v+l*m*b-l*x*v-y*m*c-g*u*b,F=d*x+y*f+p*b-x*f-y*p-d*b,B=g*p+d*v+m*f-p*v-d*m-g*f,I=g*x*f+y*p*v+d*m*b-d*x*v-y*m*f-g*p*b;t.transform(L/M,F/M,R/M,B/M,P/M,I/M),t.drawImage(s,0,0),t.restore()},e.Strip.prototype.renderStripFlat=function(t){var e=this.context,i=t.vertices,r=i.length/2;this.count++,e.beginPath();for(var n=1;r-2>n;n++){var o=2*n,s=i[o],a=i[o+2],h=i[o+4],l=i[o+1],u=i[o+3],c=i[o+5];e.moveTo(s,l),e.lineTo(a,u),e.lineTo(h,c)}e.fillStyle="#FF0000",e.fill(),e.closePath()},e.Strip.prototype.onTextureUpdate=function(){this.updateFrame=!0},e.Strip.prototype.getBounds=function(t){for(var i=t||this.worldTransform,r=i.a,n=i.b,o=i.c,s=i.d,a=i.tx,h=i.ty,l=-(1/0),u=-(1/0),c=1/0,d=1/0,p=this.vertices,f=0,g=p.length;g>f;f+=2){var m=p[f],v=p[f+1],y=r*m+o*v+a,x=s*v+n*m+h;c=c>y?y:c,d=d>x?x:d,l=y>l?y:l,u=x>u?x:u}if(c===-(1/0)||u===1/0)return e.EmptyRectangle;var b=this._bounds;return b.x=c,b.width=l-c,b.y=d,b.height=u-d,this._currentBounds=b,b},e.Strip.DrawModes={TRIANGLE_STRIP:0,TRIANGLES:1},e.Rope=function(t,i){e.Strip.call(this,t),this.points=i,this.vertices=new e.Float32Array(4*i.length),this.uvs=new e.Float32Array(4*i.length),this.colors=new e.Float32Array(2*i.length),this.indices=new e.Uint16Array(2*i.length),this.refresh()},e.Rope.prototype=Object.create(e.Strip.prototype),e.Rope.prototype.constructor=e.Rope,e.Rope.prototype.refresh=function(){var t=this.points;if(!(t.length<1)){var e=this.uvs,i=t[0],r=this.indices,n=this.colors;this.count-=.2,e[0]=0,e[1]=0,e[2]=0,e[3]=1,n[0]=1,n[1]=1,r[0]=0,r[1]=1;for(var o,s,a,h=t.length,l=1;h>l;l++)o=t[l],s=4*l,a=l/(h-1),l%2?(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1):(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1),s=2*l,n[s]=1,n[s+1]=1,s=2*l,r[s]=s,r[s+1]=s+1,i=o}},e.Rope.prototype.updateTransform=function(){var t=this.points;if(!(t.length<1)){var i,r=t[0],n={x:0,y:0};this.count-=.2;for(var o,s,a,h,l,u=this.vertices,c=t.length,d=0;c>d;d++)o=t[d],s=4*d,i=d1&&(a=1),h=Math.sqrt(n.x*n.x+n.y*n.y),l=this.texture.height/2,n.x/=h,n.y/=h,n.x*=l,n.y*=l,u[s]=o.x+n.x,u[s+1]=o.y+n.y,u[s+2]=o.x-n.x,u[s+3]=o.y-n.y,r=o;e.DisplayObjectContainer.prototype.updateTransform.call(this)}},e.Rope.prototype.setTexture=function(t){this.texture=t},e.TilingSprite=function(t,i,r){e.Sprite.call(this,t),this._width=i||100,this._height=r||100,this.tileScale=new e.Point(1,1),this.tileScaleOffset=new e.Point(1,1),this.tilePosition=new e.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL},e.TilingSprite.prototype=Object.create(e.Sprite.prototype),e.TilingSprite.prototype.constructor=e.TilingSprite,Object.defineProperty(e.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(e.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),e.TilingSprite.prototype.setTexture=function(t){this.texture!==t&&(this.texture=t,this.refreshTexture=!0,this.cachedTint=16777215)},e.TilingSprite.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha){var e,i;for(this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(t.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)):t.spriteBatch.renderTilingSprite(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this._mask,t),t.spriteBatch.start()}},e.TilingSprite.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){var i=t.context;this._mask&&t.maskManager.pushMask(this._mask,t),i.globalAlpha=this.worldAlpha;var r,n,o=this.worldTransform,s=t.resolution;if(i.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*s,o.ty*s),!this.__tilePattern||this.refreshTexture){if(this.generateTilingTexture(!1),!this.tilingTexture)return;this.__tilePattern=i.createPattern(this.tilingTexture.baseTexture.source,"repeat")}this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]);var a=this.tilePosition,h=this.tileScale;for(a.x%=this.tilingTexture.baseTexture.width,a.y%=this.tilingTexture.baseTexture.height,i.scale(h.x,h.y),i.translate(a.x+this.anchor.x*-this._width,a.y+this.anchor.y*-this._height),i.fillStyle=this.__tilePattern,i.fillRect(-a.x,-a.y,this._width/h.x,this._height/h.y),i.scale(1/h.x,1/h.y),i.translate(-a.x+this.anchor.x*this._width,-a.y+this.anchor.y*this._height),this._mask&&t.maskManager.popMask(t),r=0,n=this.children.length;n>r;r++)this.children[r]._renderCanvas(t)}},e.TilingSprite.prototype.getBounds=function(){var t=this._width,e=this._height,i=t*(1-this.anchor.x),r=t*-this.anchor.x,n=e*(1-this.anchor.y),o=e*-this.anchor.y,s=this.worldTransform,a=s.a,h=s.b,l=s.c,u=s.d,c=s.tx,d=s.ty,p=a*r+l*o+c,f=u*o+h*r+d,g=a*i+l*o+c,m=u*o+h*i+d,v=a*i+l*n+c,y=u*n+h*i+d,x=a*r+l*n+c,b=u*n+h*r+d,w=-(1/0),T=-(1/0),S=1/0,C=1/0;S=S>p?p:S,S=S>g?g:S,S=S>v?v:S,S=S>x?x:S,C=C>f?f:C,C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,w=p>w?p:w,w=g>w?g:w,w=v>w?v:w,w=x>w?x:w,T=f>T?f:T,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T;var E=this._bounds;return E.x=S,E.width=w-S,E.y=C,E.height=T-C,this._currentBounds=E,E},e.TilingSprite.prototype.onTextureUpdate=function(){},e.TilingSprite.prototype.generateTilingTexture=function(t){if(this.texture.baseTexture.hasLoaded){var i,r,n=this.originalTexture||this.texture,o=n.frame,s=o.width!==n.baseTexture.width||o.height!==n.baseTexture.height,a=!1;if(t?(i=e.getNextPowerOfTwo(o.width),r=e.getNextPowerOfTwo(o.height),(o.width!==i||o.height!==r||n.baseTexture.width!==i||n.baseTexture.height||r)&&(a=!0)):s&&(n.trim?(i=n.trim.width,r=n.trim.height):(i=o.width,r=o.height),a=!0),a){var h;this.tilingTexture&&this.tilingTexture.isTiling?(h=this.tilingTexture.canvasBuffer,h.resize(i,r),this.tilingTexture.baseTexture.width=i,this.tilingTexture.baseTexture.height=r,this.tilingTexture.needsUpdate=!0):(h=new e.CanvasBuffer(i,r),this.tilingTexture=e.Texture.fromCanvas(h.canvas),this.tilingTexture.canvasBuffer=h,this.tilingTexture.isTiling=!0),h.context.drawImage(n.baseTexture.source,n.crop.x,n.crop.y,n.crop.width,n.crop.height,0,0,i,r),this.tileScaleOffset.x=o.width/i,this.tileScaleOffset.y=o.height/r}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=n;this.refreshTexture=!1,this.originalTexture=this.texture,this.texture=this.tilingTexture,this.tilingTexture.baseTexture._powerOf2=!0}},e.TilingSprite.prototype.destroy=function(){e.Sprite.prototype.destroy.call(this),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture&&(this.tilingTexture.destroy(!0),this.tilingTexture=null)};var i={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};i.BoneData=function(t,e){this.name=t,this.parent=e},i.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},i.SlotData=function(t,e){this.name=t,this.boneData=e},i.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},i.IkConstraintData=function(t){this.name=t,this.bones=[]},i.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},i.Bone=function(t,e,i){this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()},i.Bone.yDown=!1,i.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var t=this.parent;if(t)this.worldX=this.x*t.m00+this.y*t.m01+t.worldX,this.worldY=this.x*t.m10+this.y*t.m11+t.worldY,this.data.inheritScale?(this.worldScaleX=t.worldScaleX*this.scaleX,this.worldScaleY=t.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?t.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=t.worldFlipX!=this.flipX,this.worldFlipY=t.worldFlipY!=this.flipY;else{var e=this.skeleton.flipX,r=this.skeleton.flipY;this.worldX=e?-this.x:this.x,this.worldY=r!=i.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=e!=this.flipX,this.worldFlipY=r!=this.flipY}var n=this.worldRotation*i.degRad,o=Math.cos(n),s=Math.sin(n);this.worldFlipX?(this.m00=-o*this.worldScaleX,this.m01=s*this.worldScaleY):(this.m00=o*this.worldScaleX,this.m01=-s*this.worldScaleY),this.worldFlipY!=i.Bone.yDown?(this.m10=-s*this.worldScaleX,this.m11=-o*this.worldScaleY):(this.m10=s*this.worldScaleX,this.m11=o*this.worldScaleY)},setToSetupPose:function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.rotationIK=this.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.flipX=t.flipX,this.flipY=t.flipY},worldToLocal:function(t){var e=t[0]-this.worldX,r=t[1]-this.worldY,n=this.m00,o=this.m10,s=this.m01,a=this.m11;this.worldFlipX!=(this.worldFlipY!=i.Bone.yDown)&&(n=-n,a=-a);var h=1/(n*a-s*o);t[0]=e*n*h-r*s*h,t[1]=r*a*h-e*o*h},localToWorld:function(t){var e=t[0],i=t[1];t[0]=e*this.m00+i*this.m01+this.worldX,t[1]=e*this.m10+i*this.m11+this.worldY}},i.Slot=function(t,e){this.data=t,this.bone=e,this.setToSetupPose()},i.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(t){this.attachment=t,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(t){this._attachmentTime=this.bone.skeleton.time-t},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var t=this.data;this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;for(var e=this.bone.skeleton.data.slots,i=0,r=e.length;r>i;i++)if(e[i]==t){this.setAttachment(t.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(i,t.attachmentName):null);break}}},i.IkConstraint=function(t,e){this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.bones=[];for(var i=0,r=t.bones.length;r>i;i++)this.bones.push(e.findBone(t.bones[i].name));this.target=e.findBone(t.target.name)},i.IkConstraint.prototype={apply:function(){var t=this.target,e=this.bones;switch(e.length){case 1:i.IkConstraint.apply1(e[0],t.worldX,t.worldY,this.mix);break;case 2:i.IkConstraint.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.mix)}}},i.IkConstraint.apply1=function(t,e,r,n){var o=t.data.inheritRotation&&t.parent?t.parent.worldRotation:0,s=t.rotation,a=Math.atan2(r-t.worldY,e-t.worldX)*i.radDeg-o;t.rotationIK=s+(a-s)*n},i.IkConstraint.apply2=function(t,e,r,n,o,s){var a=e.rotation,h=t.rotation;if(!s)return e.rotationIK=a,void(t.rotationIK=h);var l,u,c=i.temp,d=t.parent;d?(c[0]=r,c[1]=n,d.worldToLocal(c),r=(c[0]-t.x)*d.worldScaleX,n=(c[1]-t.y)*d.worldScaleY):(r-=t.x,n-=t.y),e.parent==t?(l=e.x,u=e.y):(c[0]=e.x,c[1]=e.y,e.parent.localToWorld(c),t.worldToLocal(c),l=c[0],u=c[1]);var p=l*t.worldScaleX,f=u*t.worldScaleY,g=Math.atan2(f,p),m=Math.sqrt(p*p+f*f),v=e.data.length*e.worldScaleX,y=2*m*v;if(1e-4>y)return void(e.rotationIK=a+(Math.atan2(n,r)*i.radDeg-h-a)*s);var x=(r*r+n*n-m*m-v*v)/y;-1>x?x=-1:x>1&&(x=1);var b=Math.acos(x)*o,w=m+v*x,T=v*Math.sin(b),S=Math.atan2(n*w-r*T,r*w+n*T),C=(S-g)*i.radDeg-h;C>180?C-=360:-180>C&&(C+=360),t.rotationIK=h+C*s,C=(b+g)*i.radDeg-a,C>180?C-=360:-180>C&&(C+=360),e.rotationIK=a+(C+t.worldRotation-e.parent.worldRotation)*s},i.Skin=function(t){this.name=t,this.attachments={}},i.Skin.prototype={addAttachment:function(t,e,i){this.attachments[t+":"+e]=i},getAttachment:function(t,e){return this.attachments[t+":"+e]},_attachAll:function(t,e){for(var i in e.attachments){var r=i.indexOf(":"),n=parseInt(i.substring(0,r)),o=i.substring(r+1),s=t.slots[n];if(s.attachment&&s.attachment.name==o){var a=this.getAttachment(n,o);a&&s.setAttachment(a)}}}},i.Animation=function(t,e,i){this.name=t,this.timelines=e,this.duration=i},i.Animation.prototype={apply:function(t,e,i,r,n){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var o=this.timelines,s=0,a=o.length;a>s;s++)o[s].apply(t,e,i,n,1)},mix:function(t,e,i,r,n,o){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var s=this.timelines,a=0,h=s.length;h>a;a++)s[a].apply(t,e,i,n,o)}},i.Animation.binarySearch=function(t,e,i){var r=0,n=Math.floor(t.length/i)-2;if(!n)return i;for(var o=n>>>1;;){if(t[(o+1)*i]<=e?r=o+1:n=o,r==n)return(r+1)*i;o=r+n>>>1}},i.Animation.binarySearch1=function(t,e){var i=0,r=t.length-2;if(!r)return 1;for(var n=r>>>1;;){if(t[n+1]<=e?i=n+1:r=n,i==r)return i+1;n=i+r>>>1}},i.Animation.linearSearch=function(t,e,i){for(var r=0,n=t.length-i;n>=r;r+=i)if(t[r]>e)return r;return-1},i.Curves=function(){this.curves=[]},i.Curves.prototype={setLinear:function(t){this.curves[19*t]=0},setStepped:function(t){this.curves[19*t]=1},setCurve:function(t,e,i,r,n){var o=.1,s=o*o,a=s*o,h=3*o,l=3*s,u=6*s,c=6*a,d=2*-e+r,p=2*-i+n,f=3*(e-r)+1,g=3*(i-n)+1,m=e*h+d*l+f*a,v=i*h+p*l+g*a,y=d*u+f*c,x=p*u+g*c,b=f*c,w=g*c,T=19*t,S=this.curves;S[T++]=2;for(var C=m,E=v,A=T+19-1;A>T;T+=2)S[T]=C,S[T+1]=E,m+=y,v+=x,y+=b,x+=w,C+=m,E+=v},getCurvePercent:function(t,e){e=0>e?0:e>1?1:e;var i=this.curves,r=19*t,n=i[r];if(0===n)return e;if(1==n)return 0;r++;for(var o=0,s=r,a=r+19-1;a>r;r+=2)if(o=i[r],o>=e){var h,l;return r==s?(h=0,l=0):(h=i[r-2],l=i[r-1]),l+(i[r+1]-l)*(e-h)/(o-h)}var u=i[r-1];return u+(1-u)*(e-o)/(1-o)}},i.RotateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-2]){for(var h=a.data.rotation+s[s.length-1]-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;return void(a.rotation+=h*o)}var l=i.Animation.binarySearch(s,r,2),u=s[l-1],c=s[l],d=1-(r-c)/(s[l-2]-c);d=this.curves.getCurvePercent(l/2-1,d);for(var h=s[l+1]-u;h>180;)h-=360;for(;-180>h;)h+=360;for(h=a.data.rotation+(u+h*d)-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;a.rotation+=h*o}}},i.TranslateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.x+=(a.data.x+s[s.length-2]-a.x)*o,void(a.y+=(a.data.y+s[s.length-1]-a.y)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.x+=(a.data.x+l+(s[h+1]-l)*d-a.x)*o,a.y+=(a.data.y+u+(s[h+2]-u)*d-a.y)*o}}},i.ScaleTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.scaleX+=(a.data.scaleX*s[s.length-2]-a.scaleX)*o,void(a.scaleY+=(a.data.scaleY*s[s.length-1]-a.scaleY)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.scaleX+=(a.data.scaleX*(l+(s[h+1]-l)*d)-a.scaleX)*o,a.scaleY+=(a.data.scaleY*(u+(s[h+2]-u)*d)-a.scaleY)*o}}},i.ColorTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=5*t},i.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(t,e,i,r,n,o){t*=5,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=o},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-5]){var c=s.length-1;a=s[c-3],h=s[c-2],l=s[c-1],u=s[c]}else{var d=i.Animation.binarySearch(s,r,5),p=s[d-4],f=s[d-3],g=s[d-2],m=s[d-1],v=s[d],y=1-(r-v)/(s[d-5]-v);y=this.curves.getCurvePercent(d/5-1,y),a=p+(s[d+1]-p)*y,h=f+(s[d+2]-f)*y,l=g+(s[d+3]-g)*y,u=m+(s[d+4]-m)*y}var x=t.slots[this.slotIndex];1>o?(x.r+=(a-x.r)*o,x.g+=(h-x.g)*o,x.b+=(l-x.b)*o,x.a+=(u-x.a)*o):(x.r=a,x.g=h,x.b=l,x.a=u)}}},i.AttachmentTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.attachmentNames=[],this.attachmentNames.length=t},i.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=r>=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;if(!(n[o]r)this.apply(t,e,Number.MAX_VALUE,n,o),e=-1;else if(e>=s[a-1])return;if(!(r0&&s[h-1]==l;)h--}for(var u=this.events;a>h&&r>=s[h];h++)n.push(u[h])}}}},i.DrawOrderTimeline=function(t){this.frames=[],this.frames.length=t,this.drawOrders=[],this.drawOrders.length=t},i.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},apply:function(t,e,r){var n=this.frames;if(!(r=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;var s=t.drawOrder,a=(t.slots,this.drawOrders[o]);if(a)for(var h=0,l=a.length;l>h;h++)s[h]=a[h]}}},i.FfdTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.frameVertices=[],this.frameVertices.length=t},i.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.frameVertices[t]=i},apply:function(t,e,r,n,o){var s=t.slots[this.slotIndex];if(s.attachment==this.attachment){var a=this.frames;if(!(r=a[a.length-1]){var c=h[a.length-1];if(1>o)for(var d=0;l>d;d++)u[d]+=(c[d]-u[d])*o;else for(var d=0;l>d;d++)u[d]=c[d]}else{var p=i.Animation.binarySearch1(a,r),f=a[p],g=1-(r-f)/(a[p-1]-f);g=this.curves.getCurvePercent(p-1,0>g?0:g>1?1:g);var m=h[p-1],v=h[p];if(1>o)for(var d=0;l>d;d++){var y=m[d];u[d]+=(y+(v[d]-y)*g-u[d])*o}else for(var d=0;l>d;d++){var y=m[d];u[d]=y+(v[d]-y)*g}}}}}},i.IkConstraintTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.mix+=(s[s.length-2]-a.mix)*o,void(a.bendDirection=s[s.length-1]);var h=i.Animation.binarySearch(s,r,3),l=s[h+-2],u=s[h],c=1-(r-u)/(s[h+-3]-u);c=this.curves.getCurvePercent(h/3-1,c);var d=l+(s[h+1]-l)*c;a.mix+=(d-a.mix)*o,a.bendDirection=s[h+-1]}}},i.FlipXTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i?1:0},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]i;i++)if(e[i].name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return slot[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSkin:function(t){for(var e=this.skins,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findEvent:function(t){for(var e=this.events,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findAnimation:function(t){for(var e=this.animations,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null}},i.Skeleton=function(t){this.data=t,this.bones=[];for(var e=0,r=t.bones.length;r>e;e++){var n=t.bones[e],o=n.parent?this.bones[t.bones.indexOf(n.parent)]:null;this.bones.push(new i.Bone(n,this,o))}this.slots=[],this.drawOrder=[];for(var e=0,r=t.slots.length;r>e;e++){var s=t.slots[e],a=this.bones[t.bones.indexOf(s.boneData)],h=new i.Slot(s,a);this.slots.push(h),this.drawOrder.push(e)}this.ikConstraints=[];for(var e=0,r=t.ikConstraints.length;r>e;e++)this.ikConstraints.push(new i.IkConstraint(t.ikConstraints[e],this));this.boneCache=[],this.updateCache()},i.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var t=this.ikConstraints,e=t.length,i=e+1,r=this.boneCache; +r.length>i&&(r.length=i);for(var n=0,o=r.length;o>n;n++)r[n].length=0;for(;r.lengthn;n++){var h=a[n],l=h;do{for(var u=0;e>u;u++)for(var c=t[u],d=c.bones[0],p=c.bones[c.bones.length-1];;){if(l==p){r[u].push(h),r[u+1].push(h);continue t}if(p==d)break;p=p.parent}l=l.parent}while(l);s[s.length]=h}},updateWorldTransform:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++){var r=t[e];r.rotationIK=r.rotation}for(var e=0,n=this.boneCache.length-1;;){for(var o=this.boneCache[e],s=0,a=o.length;a>s;s++)o[s].updateWorldTransform();if(e==n)break;this.ikConstraints[e].apply(),e++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,e=0,i=r.length;i>e;e++){var n=r[e];n.bendDirection=n.data.bendDirection,n.mix=n.data.mix}},setSlotsToSetupPose:function(){for(var t=this.slots,e=0,i=t.length;i>e;e++)t[e].setToSetupPose(e);this.resetDrawOrder()},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},setSkinByName:function(t){var e=this.data.findSkin(t);if(!e)throw"Skin not found: "+t;this.setSkin(e)},setSkin:function(t){if(t)if(this.skin)t._attachAll(this,this.skin);else for(var e=this.slots,i=0,r=e.length;r>i;i++){var n=e[i],o=n.data.attachmentName;if(o){var s=t.getAttachment(i,o);s&&n.setAttachment(s)}}this.skin=t},getAttachmentBySlotName:function(t,e){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(t),e)},getAttachmentBySlotIndex:function(t,e){if(this.skin){var i=this.skin.getAttachment(t,e);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},setAttachment:function(t,e){for(var i=this.slots,r=0,n=i.length;n>r;r++){var o=i[r];if(o.data.name==t){var s=null;if(e&&(s=this.getAttachmentBySlotIndex(r,e),!s))throw"Attachment not found: "+e+", for slot: "+t;return void o.setAttachment(s)}}throw"Slot not found: "+t},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},update:function(t){this.time+=t},resetDrawOrder:function(){for(var t=0,e=this.drawOrder.length;e>t;t++)this.drawOrder[t]=t}},i.EventData=function(t){this.name=t},i.EventData.prototype={intValue:0,floatValue:0,stringValue:null},i.Event=function(t){this.data=t},i.Event.prototype={intValue:0,floatValue:0,stringValue:null},i.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},i.RegionAttachment=function(t){this.name=t,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},i.RegionAttachment.prototype={type:i.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(t,e,i,r,n){var o=this.uvs;n?(o[2]=t,o[3]=r,o[4]=t,o[5]=e,o[6]=i,o[7]=e,o[0]=i,o[1]=r):(o[0]=t,o[1]=r,o[2]=t,o[3]=e,o[4]=i,o[5]=e,o[6]=i,o[7]=r)},updateOffset:function(){var t=this.width/this.regionOriginalWidth*this.scaleX,e=this.height/this.regionOriginalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.regionOffsetX*t,n=-this.height/2*this.scaleY+this.regionOffsetY*e,o=r+this.regionWidth*t,s=n+this.regionHeight*e,a=this.rotation*i.degRad,h=Math.cos(a),l=Math.sin(a),u=r*h+this.x,c=r*l,d=n*h+this.y,p=n*l,f=o*h+this.x,g=o*l,m=s*h+this.y,v=s*l,y=this.offset;y[0]=u-p,y[1]=d+c,y[2]=u-v,y[3]=m+c,y[4]=f-v,y[5]=m+g,y[6]=f-p,y[7]=d+g},computeVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.offset;r[0]=h[0]*n+h[1]*o+t,r[1]=h[0]*s+h[1]*a+e,r[2]=h[2]*n+h[3]*o+t,r[3]=h[2]*s+h[3]*a+e,r[4]=h[4]*n+h[5]*o+t,r[5]=h[4]*s+h[5]*a+e,r[6]=h[6]*n+h[7]*o+t,r[7]=h[6]*s+h[7]*a+e}},i.MeshAttachment=function(t){this.name=t},i.MeshAttachment.prototype={type:i.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n=i.bone;t+=n.worldX,e+=n.worldY;var o=n.m00,s=n.m01,a=n.m10,h=n.m11,l=this.vertices,u=l.length;i.attachmentVertices.length==u&&(l=i.attachmentVertices);for(var c=0;u>c;c+=2){var d=l[c],p=l[c+1];r[c]=d*o+p*s+t,r[c+1]=d*a+p*h+e}}},i.SkinnedMeshAttachment=function(t){this.name=t},i.SkinnedMeshAttachment.prototype={type:i.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n,o,s,a,h,l,u,c=i.bone.skeleton.bones,d=this.weights,p=this.bones,f=0,g=0,m=0,v=0,y=p.length;if(i.attachmentVertices.length)for(var x=i.attachmentVertices;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3,v+=2)a=c[p[g]],h=d[m]+x[v],l=d[m+1]+x[v+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}else for(;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3)a=c[p[g]],h=d[m],l=d[m+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}}},i.BoundingBoxAttachment=function(t){this.name=t,this.vertices=[]},i.BoundingBoxAttachment.prototype={type:i.AttachmentType.boundingbox,computeWorldVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;for(var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.vertices,l=0,u=h.length;u>l;l+=2){var c=h[l],d=h[l+1];r[l]=c*n+d*o+t,r[l+1]=c*s+d*a+e}}},i.AnimationStateData=function(t){this.skeletonData=t,this.animationToMixTime={}},i.AnimationStateData.prototype={defaultMix:0,setMixByName:function(t,e,i){var r=this.skeletonData.findAnimation(t);if(!r)throw"Animation not found: "+t;var n=this.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;this.setMix(r,n,i)},setMix:function(t,e,i){this.animationToMixTime[t.name+":"+e.name]=i},getMix:function(t,e){var i=t.name+":"+e.name;return this.animationToMixTime.hasOwnProperty(i)?this.animationToMixTime[i]:this.defaultMix}},i.TrackEntry=function(){},i.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},i.AnimationState=function(t){this.data=t,this.tracks=[],this.events=[]},i.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(t){t*=this.timeScale;for(var e=0;e=0&&this.setCurrent(e,n)):!i.loop&&i.lastTime>=i.endTime&&this.clearTrack(e)}}},apply:function(t){t.resetDrawOrder();for(var e=0;eo&&(r=o);var a=i.previous;if(a){var h=a.time;!a.loop&&h>a.endTime&&(h=a.endTime),a.animation.apply(t,h,h,a.loop,null);var l=i.mixTime/i.mixDuration*i.mix;l>=1&&(l=1,i.previous=null),i.animation.mix(t,i.lastTime,r,s,this.events,l)}else 1==i.mix?i.animation.apply(t,i.lastTime,r,s,this.events):i.animation.mix(t,i.lastTime,r,s,this.events,i.mix);for(var u=0,c=this.events.length;c>u;u++){var d=this.events[u];i.onEvent&&i.onEvent(e,d),this.onEvent&&this.onEvent(e,d)}if(s?n%o>r%o:o>n&&r>=o){var p=Math.floor(r/o);i.onComplete&&i.onComplete(e,p),this.onComplete&&this.onComplete(e,p)}i.lastTime=i.time}}},clearTracks:function(){for(var t=0,e=this.tracks.length;e>t;t++)this.clearTrack(t);this.tracks.length=0},clearTrack:function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];e&&(e.onEnd&&e.onEnd(t),this.onEnd&&this.onEnd(t),this.tracks[t]=null)}},_expandToIndex:function(t){if(t=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(t,e){var i=this._expandToIndex(t);if(i){var r=i.previous;i.previous=null,i.onEnd&&i.onEnd(t),this.onEnd&&this.onEnd(t),e.mixDuration=this.data.getMix(i.animation,e.animation),e.mixDuration>0&&(e.mixTime=0,e.previous=r&&i.mixTime/i.mixDuration<.5?r:i)}this.tracks[t]=e,e.onStart&&e.onStart(t),this.onStart&&this.onStart(t)},setAnimationByName:function(t,e,i){var r=this.data.skeletonData.findAnimation(e);if(!r)throw"Animation not found: "+e;return this.setAnimation(t,r,i)},setAnimation:function(t,e,r){var n=new i.TrackEntry;return n.animation=e,n.loop=r,n.endTime=e.duration,this.setCurrent(t,n),n},addAnimationByName:function(t,e,i,r){var n=this.data.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;return this.addAnimation(t,n,i,r)},addAnimation:function(t,e,r,n){var o=new i.TrackEntry;o.animation=e,o.loop=r,o.endTime=e.duration;var s=this._expandToIndex(t);if(s){for(;s.next;)s=s.next;s.next=o}else this.tracks[t]=o;return 0>=n&&(s?n+=s.endTime-this.data.getMix(s.animation,e):n=0),o.delay=n,o},getCurrent:function(t){return t>=this.tracks.length?null:this.tracks[t]}},i.SkeletonJson=function(t){this.attachmentLoader=t},i.SkeletonJson.prototype={scale:1,readSkeletonData:function(t,e){var r=new i.SkeletonData;r.name=e;var n=t.skeleton;n&&(r.hash=n.hash,r.version=n.spine,r.width=n.width||0,r.height=n.height||0);for(var o=t.bones,s=0,a=o.length;a>s;s++){var h=o[s],l=null;if(h.parent&&(l=r.findBone(h.parent),!l))throw"Parent bone not found: "+h.parent;var u=new i.BoneData(h.name,l);u.length=(h.length||0)*this.scale,u.x=(h.x||0)*this.scale,u.y=(h.y||0)*this.scale,u.rotation=h.rotation||0,u.scaleX=h.hasOwnProperty("scaleX")?h.scaleX:1,u.scaleY=h.hasOwnProperty("scaleY")?h.scaleY:1,u.inheritScale=h.hasOwnProperty("inheritScale")?h.inheritScale:!0,u.inheritRotation=h.hasOwnProperty("inheritRotation")?h.inheritRotation:!0,r.bones.push(u)}var c=t.ik;if(c)for(var s=0,a=c.length;a>s;s++){for(var d=c[s],p=new i.IkConstraintData(d.name),o=d.bones,f=0,g=o.length;g>f;f++){var m=r.findBone(o[f]);if(!m)throw"IK bone not found: "+o[f];p.bones.push(m)}if(p.target=r.findBone(d.target),!p.target)throw"Target bone not found: "+d.target;p.bendDirection=!d.hasOwnProperty("bendPositive")||d.bendPositive?1:-1,p.mix=d.hasOwnProperty("mix")?d.mix:1,r.ikConstraints.push(p)}for(var v=t.slots,s=0,a=v.length;a>s;s++){var y=v[s],u=r.findBone(y.bone);if(!u)throw"Slot bone not found: "+y.bone;var x=new i.SlotData(y.name,u),b=y.color;b&&(x.r=this.toColor(b,0),x.g=this.toColor(b,1),x.b=this.toColor(b,2),x.a=this.toColor(b,3)),x.attachmentName=y.attachment,x.additiveBlending=y.additive&&"true"==y.additive,r.slots.push(x)}var w=t.skins;for(var T in w)if(w.hasOwnProperty(T)){var S=w[T],C=new i.Skin(T);for(var E in S)if(S.hasOwnProperty(E)){var A=r.findSlotIndex(E),_=S[E];for(var M in _)if(_.hasOwnProperty(M)){var L=this.readAttachment(C,M,_[M]);L&&C.addAttachment(A,M,L)}}r.skins.push(C),"default"==C.name&&(r.defaultSkin=C)}var R=t.events;for(var P in R)if(R.hasOwnProperty(P)){var F=R[P],B=new i.EventData(P);B.intValue=F["int"]||0,B.floatValue=F["float"]||0,B.stringValue=F.string||null,r.events.push(B)}var I=t.animations;for(var O in I)I.hasOwnProperty(O)&&this.readAnimation(O,I[O],r);return r},readAttachment:function(t,e,r){e=r.name||e;var n=i.AttachmentType[r.type||"region"],o=r.path||e,s=this.scale;if(n==i.AttachmentType.region){var a=this.attachmentLoader.newRegionAttachment(t,e,o);if(!a)return null;a.path=o,a.x=(r.x||0)*s,a.y=(r.y||0)*s,a.scaleX=r.hasOwnProperty("scaleX")?r.scaleX:1,a.scaleY=r.hasOwnProperty("scaleY")?r.scaleY:1,a.rotation=r.rotation||0,a.width=(r.width||0)*s,a.height=(r.height||0)*s;var h=r.color;return h&&(a.r=this.toColor(h,0),a.g=this.toColor(h,1),a.b=this.toColor(h,2),a.a=this.toColor(h,3)),a.updateOffset(),a}if(n==i.AttachmentType.mesh){var l=this.attachmentLoader.newMeshAttachment(t,e,o);return l?(l.path=o,l.vertices=this.getFloatArray(r,"vertices",s),l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=this.getFloatArray(r,"uvs",1),l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l):null}if(n==i.AttachmentType.skinnedmesh){var l=this.attachmentLoader.newSkinnedMeshAttachment(t,e,o);if(!l)return null;l.path=o;for(var u=this.getFloatArray(r,"uvs",1),c=this.getFloatArray(r,"vertices",1),d=[],p=[],f=0,g=c.length;g>f;){var m=0|c[f++];p[p.length]=m;for(var v=f+4*m;v>f;)p[p.length]=c[f],d[d.length]=c[f+1]*s,d[d.length]=c[f+2]*s,d[d.length]=c[f+3],f+=4}return l.bones=p,l.weights=d,l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=u,l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l}if(n==i.AttachmentType.boundingbox){for(var y=this.attachmentLoader.newBoundingBoxAttachment(t,e),c=r.vertices,f=0,g=c.length;g>f;f++)y.vertices.push(c[f]*s);return y}throw"Unknown attachment type: "+n},readAnimation:function(t,e,r){var n=[],o=0,s=e.slots;for(var a in s)if(s.hasOwnProperty(a)){var h=s[a],l=r.findSlotIndex(a);for(var u in h)if(h.hasOwnProperty(u)){var c=h[u];if("color"==u){var d=new i.ColorTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],v=m.color,y=this.toColor(v,0),x=this.toColor(v,1),b=this.toColor(v,2),w=this.toColor(v,3);d.setFrame(p,m.time,y,x,b,w),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[5*d.getFrameCount()-5])}else{if("attachment"!=u)throw"Invalid timeline type for a slot: "+u+" ("+a+")";var d=new i.AttachmentTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p++,m.time,m.name)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}}}var T=e.bones;for(var S in T)if(T.hasOwnProperty(S)){var C=r.findBoneIndex(S);if(-1==C)throw"Bone not found: "+S;var E=T[S];for(var u in E)if(E.hasOwnProperty(u)){var c=E[u];if("rotate"==u){var d=new i.RotateTimeline(c.length);d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m.angle),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}else if("translate"==u||"scale"==u){var d,A=1;"scale"==u?d=new i.ScaleTimeline(c.length):(d=new i.TranslateTimeline(c.length),A=this.scale),d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],_=(m.x||0)*A,M=(m.y||0)*A;d.setFrame(p,m.time,_,M),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.getFrameCount()-3])}else{if("flipX"!=u&&"flipY"!=u)throw"Invalid timeline type for a bone: "+u+" ("+S+")";var _="flipX"==u,d=_?new i.FlipXTimeline(c.length):new i.FlipYTimeline(c.length);d.boneIndex=C;for(var L=_?"x":"y",p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m[L]||!1),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}}}var R=e.ik;for(var P in R)if(R.hasOwnProperty(P)){var F=r.findIkConstraint(P),c=R[P],d=new i.IkConstraintTimeline(c.length);d.ikConstraintIndex=r.ikConstraints.indexOf(F);for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],B=m.hasOwnProperty("mix")?m.mix:1,I=!m.hasOwnProperty("bendPositive")||m.bendPositive?1:-1;d.setFrame(p,m.time,B,I),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.frameCount-3])}var O=e.ffd;for(var D in O){var k=r.findSkin(D),h=O[D];for(a in h){var l=r.findSlotIndex(a),G=h[a];for(var N in G){var c=G[N],d=new i.FfdTimeline(c.length),U=k.getAttachment(l,N);if(!U)throw"FFD attachment not found: "+N;d.slotIndex=l,d.attachment=U;var j,V=U.type==i.AttachmentType.mesh;j=V?U.vertices.length:U.weights.length/3*2;for(var p=0,f=0,g=c.length;g>f;f++){var W,m=c[f];if(m.vertices){var Y=m.vertices,W=[];W.length=j;var H=m.offset||0,X=Y.length;if(1==this.scale)for(var z=0;X>z;z++)W[z+H]=Y[z];else for(var z=0;X>z;z++)W[z+H]=Y[z]*this.scale;if(V)for(var q=U.vertices,z=0,X=W.length;X>z;z++)W[z]+=q[z]}else V?W=U.vertices:(W=[],W.length=j);d.setFrame(p,m.time,W),this.readCurve(d,p,m),p++}n[n.length]=d,o=Math.max(o,d.frames[d.frameCount-1])}}}var Q=e.drawOrder;if(Q||(Q=e.draworder),Q){for(var d=new i.DrawOrderTimeline(Q.length),K=r.slots.length,p=0,f=0,g=Q.length;g>f;f++){var $=Q[f],J=null;if($.offsets){J=[],J.length=K;for(var z=K-1;z>=0;z--)J[z]=-1;var Z=$.offsets,te=[];te.length=K-Z.length;for(var ee=0,ie=0,z=0,X=Z.length;X>z;z++){var re=Z[z],l=r.findSlotIndex(re.slot);if(-1==l)throw"Slot not found: "+re.slot;for(;ee!=l;)te[ie++]=ee++;J[ee+re.offset]=ee++}for(;K>ee;)te[ie++]=ee++;for(var z=K-1;z>=0;z--)-1==J[z]&&(J[z]=te[--ie])}d.setFrame(p++,$.time,J)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}var ne=e.events;if(ne){for(var d=new i.EventTimeline(ne.length),p=0,f=0,g=ne.length;g>f;f++){var oe=ne[f],se=r.findEvent(oe.name);if(!se)throw"Event not found: "+oe.name;var ae=new i.Event(se);ae.intValue=oe.hasOwnProperty("int")?oe["int"]:se.intValue,ae.floatValue=oe.hasOwnProperty("float")?oe["float"]:se.floatValue,ae.stringValue=oe.hasOwnProperty("string")?oe.string:se.stringValue,d.setFrame(p++,oe.time,ae)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}r.animations.push(new i.Animation(t,n,o))},readCurve:function(t,e,i){var r=i.curve;r?"stepped"==r?t.curves.setStepped(e):r instanceof Array&&t.curves.setCurve(e,r[0],r[1],r[2],r[3]):t.curves.setLinear(e)},toColor:function(t,e){if(8!=t.length)throw"Color hexidecimal length must be 8, recieved: "+t;return parseInt(t.substring(2*e,2*e+2),16)/255},getFloatArray:function(t,e,r){var n=t[e],o=new i.Float32Array(n.length),s=0,a=n.length;if(1==r)for(;a>s;s++)o[s]=n[s];else for(;a>s;s++)o[s]=n[s]*r;return o},getIntArray:function(t,e){for(var r=t[e],n=new i.Uint16Array(r.length),o=0,s=r.length;s>o;o++)n[o]=0|r[o];return n}},i.Atlas=function(t,e){this.textureLoader=e,this.pages=[],this.regions=[];var r=new i.AtlasReader(t),n=[];n.length=4;for(var o=null;;){var s=r.readLine();if(null===s)break;if(s=r.trim(s),s.length)if(o){var a=new i.AtlasRegion;a.name=s,a.page=o,a.rotate="true"==r.readValue(),r.readTuple(n);var h=parseInt(n[0]),l=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);a.u=h/o.width,a.v=l/o.height,a.rotate?(a.u2=(h+c)/o.width,a.v2=(l+u)/o.height):(a.u2=(h+u)/o.width,a.v2=(l+c)/o.height),a.x=h,a.y=l,a.width=Math.abs(u),a.height=Math.abs(c),4==r.readTuple(n)&&(a.splits=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],4==r.readTuple(n)&&(a.pads=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],r.readTuple(n))),a.originalWidth=parseInt(n[0]),a.originalHeight=parseInt(n[1]),r.readTuple(n),a.offsetX=parseInt(n[0]),a.offsetY=parseInt(n[1]),a.index=parseInt(r.readValue()),this.regions.push(a)}else{o=new i.AtlasPage,o.name=s,2==r.readTuple(n)&&(o.width=parseInt(n[0]),o.height=parseInt(n[1]),r.readTuple(n)),o.format=i.Atlas.Format[n[0]],r.readTuple(n),o.minFilter=i.Atlas.TextureFilter[n[0]],o.magFilter=i.Atlas.TextureFilter[n[1]];var d=r.readValue();o.uWrap=i.Atlas.TextureWrap.clampToEdge,o.vWrap=i.Atlas.TextureWrap.clampToEdge,"x"==d?o.uWrap=i.Atlas.TextureWrap.repeat:"y"==d?o.vWrap=i.Atlas.TextureWrap.repeat:"xy"==d&&(o.uWrap=o.vWrap=i.Atlas.TextureWrap.repeat),e.load(o,s,this),this.pages.push(o)}else o=null}},i.Atlas.prototype={findRegion:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},dispose:function(){for(var t=this.pages,e=0,i=t.length;i>e;e++)this.textureLoader.unload(t[e].rendererObject)},updateUVs:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++){var n=e[i];n.page==t&&(n.u=n.x/t.width,n.v=n.y/t.height,n.rotate?(n.u2=(n.x+n.height)/t.width,n.v2=(n.y+n.width)/t.height):(n.u2=(n.x+n.width)/t.width,n.v2=(n.y+n.height)/t.height))}}},i.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},i.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},i.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},i.AtlasPage=function(){},i.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},i.AtlasRegion=function(){},i.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},i.AtlasReader=function(t){this.lines=t.split(/\r\n|\r|\n/)},i.AtlasReader.prototype={index:0,trim:function(t){return t.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw"Invalid line: "+t;return this.trim(t.substring(e+1))},readTuple:function(t){var e=this.readLine(),i=e.indexOf(":");if(-1==i)throw"Invalid line: "+e;for(var r=0,n=i+1;3>r;r++){var o=e.indexOf(",",n);if(-1==o)break;t[r]=this.trim(e.substr(n,o-n)),n=o+1}return t[r]=this.trim(e.substring(n)),r+1}},i.AtlasAttachmentLoader=function(t){this.atlas=t},i.AtlasAttachmentLoader.prototype={newRegionAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (region attachment: "+e+")";var o=new i.RegionAttachment(e);return o.rendererObject=n,o.setUVs(n.u,n.v,n.u2,n.v2,n.rotate),o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (mesh attachment: "+e+")";var o=new i.MeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newSkinnedMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (skinned mesh attachment: "+e+")";var o=new i.SkinnedMeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newBoundingBoxAttachment:function(t,e){return new i.BoundingBoxAttachment(e)}},i.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},i.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(t,e){var r=t.slots,n=r.length,o=t.x,s=t.y,a=this.boundingBoxes,h=this.polygonPool,l=this.polygons;a.length=0;for(var u=0,c=l.length;c>u;u++)h.push(l[u]);l.length=0;for(var u=0;n>u;u++){var d=r[u],p=d.attachment;if(p.type==i.AttachmentType.boundingbox){a.push(p);var f,g=h.length;g>0?(f=h[g-1],h.splice(g-1,1)):f=[],l.push(f),f.length=p.vertices.length,p.computeWorldVertices(o,s,d.bone,f)}}e&&this.aabbCompute()},aabbCompute:function(){for(var t=this.polygons,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=Number.MIN_VALUE,n=Number.MIN_VALUE,o=0,s=t.length;s>o;o++)for(var a=t[o],h=0,l=a.length;l>h;h+=2){var u=a[h],c=a[h+1];e=Math.min(e,u),i=Math.min(i,c),r=Math.max(r,u),n=Math.max(n,c)}this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},aabbContainsPoint:function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},aabbIntersectsSegment:function(t,e,i,r){var n=this.minX,o=this.minY,s=this.maxX,a=this.maxY;if(n>=t&&n>=i||o>=e&&o>=r||t>=s&&i>=s||e>=a&&r>=a)return!1;var h=(r-e)/(i-t),l=h*(n-t)+e;if(l>o&&a>l)return!0;if(l=h*(s-t)+e,l>o&&a>l)return!0;var u=(o-e)/h+t;return u>n&&s>u?!0:(u=(a-e)/h+t,u>n&&s>u?!0:!1)},aabbIntersectsSkeleton:function(t){return this.minXt.minX&&this.minYt.minY},containsPoint:function(t,e){for(var i=this.polygons,r=0,n=i.length;n>r;r++)if(this.polygonContainsPoint(i[r],t,e))return this.boundingBoxes[r];return null},intersectsSegment:function(t,e,i,r){for(var n=this.polygons,o=0,s=n.length;s>o;o++)if(n[o].intersectsSegment(t,e,i,r))return this.boundingBoxes[o];return null},polygonContainsPoint:function(t,e,i){for(var r=t.length,n=r-2,o=!1,s=0;r>s;s+=2){var a=t[s+1],h=t[n+1];if(i>a&&h>=i||i>h&&a>=i){var l=t[s];l+(i-a)/(h-a)*(t[n]-l)c;c+=2){var d=t[c],p=t[c+1],f=l*p-u*d,g=l-d,m=u-p,v=s*m-a*g,y=(h*g-s*f)/v;if((y>=l&&d>=y||y>=d&&l>=y)&&(y>=e&&r>=y||y>=r&&e>=y)){var x=(h*m-a*f)/v;if((x>=u&&p>=x||x>=p&&u>=x)&&(x>=i&&n>=x||x>=n&&i>=x))return!0}l=d,u=p}return!1},getPolygon:function(t){var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}},i.Bone.yDown=!0,e.AnimCache={},e.SpineTextureLoader=function(t,i){e.EventTarget.call(this),this.basePath=t,this.crossorigin=i,this.loadingCount=0},e.SpineTextureLoader.prototype=e.SpineTextureLoader,e.SpineTextureLoader.prototype.load=function(t,i){if(t.rendererObject=e.BaseTexture.fromImage(this.basePath+"/"+i,this.crossorigin),!t.rendererObject.hasLoaded){var r=this;++r.loadingCount,t.rendererObject.addEventListener("loaded",function(){--r.loadingCount,r.dispatchEvent({type:"loadedBaseTexture",content:r})})}},e.SpineTextureLoader.prototype.unload=function(t){t.destroy(!0)},e.Spine=function(t){if(e.DisplayObjectContainer.call(this),this.spineData=e.AnimCache[t],!this.spineData)throw new Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: "+t);this.skeleton=new i.Skeleton(this.spineData),this.skeleton.updateWorldTransform(),this.stateData=new i.AnimationStateData(this.spineData),this.state=new i.AnimationState(this.stateData),this.slotContainers=[];for(var r=0,n=this.skeleton.slots.length;n>r;r++){var o=this.skeleton.slots[r],s=o.attachment,a=new e.DisplayObjectContainer;if(this.slotContainers.push(a),this.addChild(a),s instanceof i.RegionAttachment){var h=s.rendererObject.name,l=this.createSprite(o,s);o.currentSprite=l,o.currentSpriteName=h,a.addChild(l)}else{if(!(s instanceof i.MeshAttachment))continue;var u=this.createMesh(o,s);o.currentMesh=u,o.currentMeshName=s.name,a.addChild(u)}}this.autoUpdate=!0},e.Spine.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Spine.prototype.constructor=e.Spine,Object.defineProperty(e.Spine.prototype,"autoUpdate",{get:function(){return this.updateTransform===e.Spine.prototype.autoUpdateTransform},set:function(t){this.updateTransform=t?e.Spine.prototype.autoUpdateTransform:e.DisplayObjectContainer.prototype.updateTransform}}),e.Spine.prototype.update=function(t){this.state.update(t),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var r=this.skeleton.drawOrder,n=this.skeleton.slots,o=0,s=r.length;s>o;o++)this.children[o]=this.slotContainers[r[o]];for(o=0,s=n.length;s>o;o++){var a=n[o],h=a.attachment,l=this.slotContainers[o];if(h){var u=h.type;if(u===i.AttachmentType.region){if(h.rendererObject&&(!a.currentSpriteName||a.currentSpriteName!==h.name)){var c=h.rendererObject.name;if(void 0!==a.currentSprite&&(a.currentSprite.visible=!1),a.sprites=a.sprites||{},void 0!==a.sprites[c])a.sprites[c].visible=!0;else{var d=this.createSprite(a,h);l.addChild(d)}a.currentSprite=a.sprites[c],a.currentSpriteName=c}var p=a.bone;l.position.x=p.worldX+h.x*p.m00+h.y*p.m01,l.position.y=p.worldY+h.x*p.m10+h.y*p.m11,l.scale.x=p.worldScaleX,l.scale.y=p.worldScaleY,l.rotation=-(a.bone.worldRotation*i.degRad),a.currentSprite.tint=e.rgb2hex([a.r,a.g,a.b])}else{if(u!==i.AttachmentType.skinnedmesh){l.visible=!1;continue}if(!a.currentMeshName||a.currentMeshName!==h.name){var f=h.name;if(void 0!==a.currentMesh&&(a.currentMesh.visible=!1),a.meshes=a.meshes||{},void 0!==a.meshes[f])a.meshes[f].visible=!0;else{var g=this.createMesh(a,h);l.addChild(g)}a.currentMesh=a.meshes[f],a.currentMeshName=f}h.computeWorldVertices(a.bone.skeleton.x,a.bone.skeleton.y,a,a.currentMesh.vertices)}l.visible=!0,l.alpha=a.a}else l.visible=!1}},e.Spine.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var t=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(t),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.Spine.prototype.createSprite=function(t,r){var n=r.rendererObject,o=n.page.rendererObject,s=new e.Rectangle(n.x,n.y,n.rotate?n.height:n.width,n.rotate?n.width:n.height),a=new e.Texture(o,s),h=new e.Sprite(a),l=n.rotate?.5*Math.PI:0;return h.scale.set(n.width/n.originalWidth,n.height/n.originalHeight),h.rotation=l-r.rotation*i.degRad,h.anchor.x=h.anchor.y=.5,t.sprites=t.sprites||{},t.sprites[n.name]=h,h},e.Spine.prototype.createMesh=function(t,i){var r=i.rendererObject,n=r.page.rendererObject,o=new e.Texture(n),s=new e.Strip(o);return s.drawMode=e.Strip.DrawModes.TRIANGLES,s.canvasPadding=1.5,s.vertices=new e.Float32Array(i.uvs.length),s.uvs=i.uvs,s.indices=i.triangles,t.meshes=t.meshes||{},t.meshes[i.name]=s,s},e.BaseTextureCache={},e.BaseTextureCacheIdGenerator=0,e.BaseTexture=function(t,i){if(this.resolution=1,this.width=100,this.height=100,this.scaleMode=i||e.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=t,this._UID=e._UID++,this.premultipliedAlpha=!0,this._glTextures=[],this.mipmap=!1,this._dirty=[!0,!0,!0,!0],t){if((this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this.hasLoaded=!0,this.width=this.source.naturalWidth||this.source.width,this.height=this.source.naturalHeight||this.source.height,this.dirty();else{var r=this;this.source.onload=function(){r.hasLoaded=!0,r.width=r.source.naturalWidth||r.source.width,r.height=r.source.naturalHeight||r.source.height,r.dirty(),r.dispatchEvent({type:"loaded",content:r})},this.source.onerror=function(){r.dispatchEvent({type:"error",content:r})}}this.imageUrl=null,this._powerOf2=!1}},e.BaseTexture.prototype.constructor=e.BaseTexture,e.EventTarget.mixin(e.BaseTexture.prototype),e.BaseTexture.prototype.destroy=function(){this.imageUrl?(delete e.BaseTextureCache[this.imageUrl],delete e.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete e.BaseTextureCache[this.source._pixiId],this.source=null,this.unloadFromGPU() +},e.BaseTexture.prototype.updateSourceImage=function(t){this.hasLoaded=!1,this.source.src=null,this.source.src=t},e.BaseTexture.prototype.dirty=function(){for(var t=0;t=0;t--){var i=this._glTextures[t],r=e.glContexts[t];r&&i&&r.deleteTexture(i)}this._glTextures.length=0,this.dirty()},e.BaseTexture.fromImage=function(t,i,r){var n=e.BaseTextureCache[t];if(void 0===i&&-1===t.indexOf("data:")&&(i=!0),!n){var o=new Image;i&&(o.crossOrigin=""),o.src=t,n=new e.BaseTexture(o,r),n.imageUrl=t,e.BaseTextureCache[t]=n,-1!==t.indexOf(e.RETINA_PREFIX+".")&&(n.resolution=2)}return n},e.BaseTexture.fromCanvas=function(t,i){t._pixiId||(t._pixiId="canvas_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.BaseTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.TextureCache={},e.FrameCache={},e.TextureCacheIdGenerator=0,e.Texture=function(t,i,r,n){this.noFrame=!1,i||(this.noFrame=!0,i=new e.Rectangle(0,0,1,1)),t instanceof e.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=i,this.trim=n,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=r||new e.Rectangle(0,0,1,1),t.hasLoaded?(this.noFrame&&(i=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(i)):t.addEventListener("loaded",this.onBaseTextureLoaded.bind(this))},e.Texture.prototype.constructor=e.Texture,e.EventTarget.mixin(e.Texture.prototype),e.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;t.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame),this.dispatchEvent({type:"update",content:this})},e.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},e.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,!this.trim&&(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs()},e.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new e.TextureUvs);var t=this.crop,i=this.baseTexture.width,r=this.baseTexture.height;this._uvs.x0=t.x/i,this._uvs.y0=t.y/r,this._uvs.x1=(t.x+t.width)/i,this._uvs.y1=t.y/r,this._uvs.x2=(t.x+t.width)/i,this._uvs.y2=(t.y+t.height)/r,this._uvs.x3=t.x/i,this._uvs.y3=(t.y+t.height)/r},e.Texture.fromImage=function(t,i,r){var n=e.TextureCache[t];return n||(n=new e.Texture(e.BaseTexture.fromImage(t,i,r)),e.TextureCache[t]=n),n},e.Texture.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache ');return i},e.Texture.fromCanvas=function(t,i){var r=e.BaseTexture.fromCanvas(t,i);return new e.Texture(r)},e.Texture.addTextureToCache=function(t,i){e.TextureCache[i]=t},e.Texture.removeTextureFromCache=function(t){var i=e.TextureCache[t];return delete e.TextureCache[t],delete e.BaseTextureCache[t],i},e.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},e.Texture.emptyTexture=new e.Texture(new e.BaseTexture),e.RenderTexture=function(t,i,r,n,o){if(this.width=t||100,this.height=i||100,this.resolution=o||1,this.frame=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.baseTexture=new e.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=n||e.scaleModes.DEFAULT,this.baseTexture.hasLoaded=!0,e.Texture.call(this,this.baseTexture,new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution)),this.renderer=r||e.defaultRenderer,this.renderer.type===e.WEBGL_RENDERER){var s=this.renderer.gl;this.baseTexture._dirty[s.id]=!1,this.textureBuffer=new e.FilterTexture(s,this.width,this.height,this.baseTexture.scaleMode),this.baseTexture._glTextures[s.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new e.Point(.5*this.width,.5*-this.height)}else this.render=this.renderCanvas,this.textureBuffer=new e.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()},e.RenderTexture.prototype=Object.create(e.Texture.prototype),e.RenderTexture.prototype.constructor=e.RenderTexture,e.RenderTexture.prototype.resize=function(t,i,r){(t!==this.width||i!==this.height)&&(this.valid=t>0&&i>0,this.width=t,this.height=i,this.frame.width=this.crop.width=t*this.resolution,this.frame.height=this.crop.height=i*this.resolution,r&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===e.WEBGL_RENDERER&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},e.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===e.WEBGL_RENDERER&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},e.RenderTexture.prototype.renderWebGL=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),r.translate(0,2*this.projection.y),e&&r.append(e),r.scale(1,-1),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();var a=this.renderer.gl;a.viewport(0,0,this.width*this.resolution,this.height*this.resolution),a.bindFramebuffer(a.FRAMEBUFFER,this.textureBuffer.frameBuffer),i&&this.textureBuffer.clear(),this.renderer.spriteBatch.dirty=!0,this.renderer.renderDisplayObject(t,this.projection,this.textureBuffer.frameBuffer),this.renderer.spriteBatch.dirty=!0}},e.RenderTexture.prototype.renderCanvas=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),e&&r.append(e),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();i&&this.textureBuffer.clear();var a=this.textureBuffer.context,h=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(t,a),this.renderer.resolution=h}},e.RenderTexture.prototype.getImage=function(){var t=new Image;return t.src=this.getBase64(),t},e.RenderTexture.prototype.getBase64=function(){return this.getCanvas().toDataURL()},e.RenderTexture.prototype.getCanvas=function(){if(this.renderer.type===e.WEBGL_RENDERER){var t=this.renderer.gl,i=this.textureBuffer.width,r=this.textureBuffer.height,n=new Uint8Array(4*i*r);t.bindFramebuffer(t.FRAMEBUFFER,this.textureBuffer.frameBuffer),t.readPixels(0,0,i,r,t.RGBA,t.UNSIGNED_BYTE,n),t.bindFramebuffer(t.FRAMEBUFFER,null);var o=new e.CanvasBuffer(i,r),s=o.context.getImageData(0,0,i,r);return s.data.set(n),o.context.putImageData(s,0,0),o.canvas}return this.textureBuffer.canvas},e.RenderTexture.tempMatrix=new e.Matrix,e.VideoTexture=function(t,i){if(!t)throw new Error("No video source element specified.");(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),e.BaseTexture.call(this,t,i),this.autoUpdate=!1,this.updateBound=this._onUpdate.bind(this),t.complete||(this._onCanPlay=this.onCanPlay.bind(this),t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("play",this.onPlayStart.bind(this)),t.addEventListener("pause",this.onPlayStop.bind(this)))},e.VideoTexture.prototype=Object.create(e.BaseTexture.prototype),e.VideoTexture.constructor=e.VideoTexture,e.VideoTexture.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this.updateBound),this.dirty())},e.VideoTexture.prototype.onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this.updateBound),this.autoUpdate=!0)},e.VideoTexture.prototype.onPlayStop=function(){this.autoUpdate=!1},e.VideoTexture.prototype.onCanPlay=function(){"canplaythrough"===event.type&&(this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.__loaded||(this.__loaded=!0,this.dispatchEvent({type:"loaded",content:this}))))},e.VideoTexture.prototype.destroy=function(){this.source&&this.source._pixiId&&(e.BaseTextureCache[this.source._pixiId]=null,delete e.BaseTextureCache[this.source._pixiId],this.source._pixiId=null,delete this.source._pixiId),e.BaseTexture.prototype.destroy.call(this)},e.VideoTexture.baseTextureFromVideo=function(t,i){t._pixiId||(t._pixiId="video_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.VideoTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.VideoTexture.textureFromVideo=function(t,i){var r=e.VideoTexture.baseTextureFromVideo(t,i);return new e.Texture(r)},e.VideoTexture.fromUrl=function(t,i){var r=document.createElement("video");return r.src=t,r.autoPlay=!0,r.play(),e.VideoTexture.textureFromVideo(r,i)},e.AssetLoader=function(t,i){this.assetURLs=t,this.crossorigin=i,this.loadersByType={jpg:e.ImageLoader,jpeg:e.ImageLoader,png:e.ImageLoader,gif:e.ImageLoader,webp:e.ImageLoader,json:e.JsonLoader,atlas:e.AtlasLoader,anim:e.SpineLoader,xml:e.BitmapFontLoader,fnt:e.BitmapFontLoader}},e.EventTarget.mixin(e.AssetLoader.prototype),e.AssetLoader.prototype.constructor=e.AssetLoader,e.AssetLoader.prototype._getDataType=function(t){var e="data:",i=t.slice(0,e.length).toLowerCase();if(i===e){var r=t.slice(e.length),n=r.indexOf(",");if(-1===n)return null;var o=r.slice(0,n).split(";")[0];return o&&"text/plain"!==o.toLowerCase()?o.split("/").pop().toLowerCase():"txt"}return null},e.AssetLoader.prototype.load=function(){function t(t){e.onAssetLoaded(t.data.content)}var e=this;this.loadCount=this.assetURLs.length;for(var i=0;i0?t.addEventListener("loadedBaseTexture",function(t){t.content.content.loadingCount<=0&&f.onLoaded()}):f.onLoaded()},p.load()}else this.onLoaded()},e.JsonLoader.prototype.onLoaded=function(){this.loaded=!0,this.dispatchEvent({type:"loaded",content:this})},e.JsonLoader.prototype.onError=function(){this.dispatchEvent({type:"error",content:this})},e.AtlasLoader=function(t,e){this.url=t,this.baseUrl=t.replace(/[^\/]*$/,""),this.crossorigin=e,this.loaded=!1},e.AtlasLoader.constructor=e.AtlasLoader,e.EventTarget.mixin(e.AtlasLoader.prototype),e.AtlasLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onAtlasLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/json"),this.ajaxRequest.send(null)},e.AtlasLoader.prototype.onAtlasLoaded=function(){if(4===this.ajaxRequest.readyState)if(200===this.ajaxRequest.status||-1===window.location.href.indexOf("http")){this.atlas={meta:{image:[]},frames:[]};var t=this.ajaxRequest.responseText.split(/\r?\n/),i=-3,r=0,n=null,o=!1,s=0,a=0,h=this.onLoaded.bind(this);for(s=0;s0){if(o===s)this.atlas.meta.image.push(t[s]),r=this.atlas.meta.image.length-1,this.atlas.frames.push({}),i=-3;else if(i>0)if(i%7===1)null!=n&&(this.atlas.frames[r][n.name]=n),n={name:t[s],frame:{}};else{var l=t[s].split(" ");if(i%7===3)n.frame.x=Number(l[1].replace(",","")),n.frame.y=Number(l[2]);else if(i%7===4)n.frame.w=Number(l[1].replace(",","")),n.frame.h=Number(l[2]);else if(i%7===5){var u={x:0,y:0,w:Number(l[1].replace(",","")),h:Number(l[2])};u.w>n.frame.w||u.h>n.frame.h?(n.trimmed=!0,n.realSize=u):n.trimmed=!1}}i++}if(null!=n&&(this.atlas.frames[r][n.name]=n),this.atlas.meta.image.length>0){for(this.images=[],a=0;athis.currentImageId?(this.currentImageId++,this.images[this.currentImageId].load()):(this.loaded=!0,this.emit("loaded",{content:this}))},e.AtlasLoader.prototype.onError=function(){this.emit("error",{content:this})},e.SpriteSheetLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null,this.frames={}},e.SpriteSheetLoader.prototype.constructor=e.SpriteSheetLoader,e.EventTarget.mixin(e.SpriteSheetLoader.prototype),e.SpriteSheetLoader.prototype.load=function(){var t=this,i=new e.JsonLoader(this.url,this.crossorigin);i.on("loaded",function(e){t.json=e.data.content.json,t.onLoaded()}),i.load()},e.SpriteSheetLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader=function(t,i){this.texture=e.Texture.fromImage(t,i),this.frames=[]},e.ImageLoader.prototype.constructor=e.ImageLoader,e.EventTarget.mixin(e.ImageLoader.prototype),e.ImageLoader.prototype.load=function(){this.texture.baseTexture.hasLoaded?this.onLoaded():this.texture.baseTexture.on("loaded",this.onLoaded.bind(this))},e.ImageLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader.prototype.loadFramedSpriteSheet=function(t,i,r){this.frames=[];for(var n=Math.floor(this.texture.width/t),o=Math.floor(this.texture.height/i),s=0,a=0;o>a;a++)for(var h=0;n>h;h++,s++){var l=new e.Texture(this.texture.baseTexture,{x:h*t,y:a*i,width:t,height:i});this.frames.push(l),r&&(e.TextureCache[r+"-"+s]=l)}this.load()},e.BitmapFontLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null},e.BitmapFontLoader.prototype.constructor=e.BitmapFontLoader,e.EventTarget.mixin(e.BitmapFontLoader.prototype),e.BitmapFontLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onXMLLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/xml"),this.ajaxRequest.send(null)},e.BitmapFontLoader.prototype.onXMLLoaded=function(){if(4===this.ajaxRequest.readyState&&(200===this.ajaxRequest.status||-1===window.location.protocol.indexOf("http"))){var t=this.ajaxRequest.responseXML;if(!t||/MSIE 9/i.test(navigator.userAgent)||navigator.isCocoonJS)if("function"==typeof window.DOMParser){var i=new DOMParser;t=i.parseFromString(this.ajaxRequest.responseText,"text/xml")}else{var r=document.createElement("div");r.innerHTML=this.ajaxRequest.responseText,t=r}var n=this.baseUrl+t.getElementsByTagName("page")[0].getAttribute("file"),o=new e.ImageLoader(n,this.crossorigin);this.texture=o.texture.baseTexture;var s={},a=t.getElementsByTagName("info")[0],h=t.getElementsByTagName("common")[0];s.font=a.getAttribute("face"),s.size=parseInt(a.getAttribute("size"),10),s.lineHeight=parseInt(h.getAttribute("lineHeight"),10),s.chars={};for(var l=t.getElementsByTagName("char"),u=0;ut;t++)this.shaders[t].dirty=!0},e.AlphaMaskFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={mask:{type:"sampler2D",value:t},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mask.value.x=t.width,this.uniforms.mask.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D mask;","uniform sampler2D uSampler;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," mapCords *= dimensions.xy / mapDimensions;"," vec4 original = texture2D(uSampler, vTextureCoord);"," float maskAlpha = texture2D(mask, mapCords).r;"," original *= maskAlpha;"," gl_FragColor = original;","}"]},e.AlphaMaskFilter.prototype=Object.create(e.AbstractFilter.prototype),e.AlphaMaskFilter.prototype.constructor=e.AlphaMaskFilter,e.AlphaMaskFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.mask.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.mask.value.height,this.uniforms.mask.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.AlphaMaskFilter.prototype,"map",{get:function(){return this.uniforms.mask.value},set:function(t){this.uniforms.mask.value=t}}),e.ColorMatrixFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={matrix:{type:"mat4",value:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform mat4 matrix;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * matrix;","}"]},e.ColorMatrixFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorMatrixFilter.prototype.constructor=e.ColorMatrixFilter,Object.defineProperty(e.ColorMatrixFilter.prototype,"matrix",{get:function(){return this.uniforms.matrix.value},set:function(t){this.uniforms.matrix.value=t}}),e.GrayFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={gray:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float gray;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);","}"]},e.GrayFilter.prototype=Object.create(e.AbstractFilter.prototype),e.GrayFilter.prototype.constructor=e.GrayFilter,Object.defineProperty(e.GrayFilter.prototype,"gray",{get:function(){return this.uniforms.gray.value},set:function(t){this.uniforms.gray.value=t}}),e.DisplacementFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={displacementMap:{type:"sampler2D",value:t},scale:{type:"2f",value:{x:30,y:30}},offset:{type:"2f",value:{x:0,y:0}},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mapDimensions.value.x=t.width,this.uniforms.mapDimensions.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D displacementMap;","uniform sampler2D uSampler;","uniform vec2 scale;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," vec2 matSample = texture2D(displacementMap, mapCords).xy;"," matSample -= 0.5;"," matSample *= scale;"," matSample /= mapDimensions;"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);"," vec2 cord = vTextureCoord;","}"]},e.DisplacementFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DisplacementFilter.prototype.constructor=e.DisplacementFilter,e.DisplacementFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.displacementMap.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.displacementMap.value.height,this.uniforms.displacementMap.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.DisplacementFilter.prototype,"map",{get:function(){return this.uniforms.displacementMap.value},set:function(t){this.uniforms.displacementMap.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.uniforms.scale.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.uniforms.offset.value=t}}),e.PixelateFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:0},dimensions:{type:"4fv",value:new e.Float32Array([1e4,100,10,10])},pixelSize:{type:"2f",value:{x:10,y:10}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 testDim;","uniform vec4 dimensions;","uniform vec2 pixelSize;","uniform sampler2D uSampler;","void main(void) {"," vec2 coord = vTextureCoord;"," vec2 size = dimensions.xy/pixelSize;"," vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;"," gl_FragColor = texture2D(uSampler, color);","}"]},e.PixelateFilter.prototype=Object.create(e.AbstractFilter.prototype),e.PixelateFilter.prototype.constructor=e.PixelateFilter,Object.defineProperty(e.PixelateFilter.prototype,"size",{get:function(){return this.uniforms.pixelSize.value},set:function(t){this.dirty=!0,this.uniforms.pixelSize.value=t}}),e.BlurXFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurXFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurXFilter.prototype.constructor=e.BlurXFilter,Object.defineProperty(e.BlurXFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.dirty=!0,this.uniforms.blur.value=1/7e3*t}}),e.BlurYFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurYFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurYFilter.prototype.constructor=e.BlurYFilter,Object.defineProperty(e.BlurYFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.BlurFilter=function(){this.blurXFilter=new e.BlurXFilter,this.blurYFilter=new e.BlurYFilter,this.passes=[this.blurXFilter,this.blurYFilter]},e.BlurFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurFilter.prototype.constructor=e.BlurFilter,Object.defineProperty(e.BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t}}),e.InvertFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);","}"]},e.InvertFilter.prototype=Object.create(e.AbstractFilter.prototype),e.InvertFilter.prototype.constructor=e.InvertFilter,Object.defineProperty(e.InvertFilter.prototype,"invert",{get:function(){return this.uniforms.invert.value},set:function(t){this.uniforms.invert.value=t}}),e.SepiaFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={sepia:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float sepia;","uniform sampler2D uSampler;","const mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);","}"]},e.SepiaFilter.prototype=Object.create(e.AbstractFilter.prototype),e.SepiaFilter.prototype.constructor=e.SepiaFilter,Object.defineProperty(e.SepiaFilter.prototype,"sepia",{get:function(){return this.uniforms.sepia.value},set:function(t){this.uniforms.sepia.value=t}}),e.TwistFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"2f",value:{x:.5,y:.5}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float radius;","uniform float angle;","uniform vec2 offset;","void main(void) {"," vec2 coord = vTextureCoord - offset;"," float distance = length(coord);"," if (distance < radius) {"," float ratio = (radius - distance) / radius;"," float angleMod = ratio * ratio * angle;"," float s = sin(angleMod);"," float c = cos(angleMod);"," coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);"," }"," gl_FragColor = texture2D(uSampler, coord+offset);","}"] +},e.TwistFilter.prototype=Object.create(e.AbstractFilter.prototype),e.TwistFilter.prototype.constructor=e.TwistFilter,Object.defineProperty(e.TwistFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.dirty=!0,this.uniforms.offset.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"radius",{get:function(){return this.uniforms.radius.value},set:function(t){this.dirty=!0,this.uniforms.radius.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.ColorStepFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={step:{type:"1f",value:5}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float step;","void main(void) {"," vec4 color = texture2D(uSampler, vTextureCoord);"," color = floor(color * step) / step;"," gl_FragColor = color;","}"]},e.ColorStepFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorStepFilter.prototype.constructor=e.ColorStepFilter,Object.defineProperty(e.ColorStepFilter.prototype,"step",{get:function(){return this.uniforms.step.value},set:function(t){this.uniforms.step.value=t}}),e.DotScreenFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float angle;","uniform float scale;","float pattern() {"," float s = sin(angle), c = cos(angle);"," vec2 tex = vTextureCoord * dimensions.xy;"," vec2 point = vec2("," c * tex.x - s * tex.y,"," s * tex.x + c * tex.y"," ) * scale;"," return (sin(point.x) * sin(point.y)) * 4.0;","}","void main() {"," vec4 color = texture2D(uSampler, vTextureCoord);"," float average = (color.r + color.g + color.b) / 3.0;"," gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);","}"]},e.DotScreenFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DotScreenFilter.prototype.constructor=e.DotScreenFilter,Object.defineProperty(e.DotScreenFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.dirty=!0,this.uniforms.scale.value=t}}),Object.defineProperty(e.DotScreenFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.CrossHatchFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);"," gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"," if (lum < 1.00) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.75) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.50) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.3) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }","}"]},e.CrossHatchFilter.prototype=Object.create(e.AbstractFilter.prototype),e.CrossHatchFilter.prototype.constructor=e.CrossHatchFilter,Object.defineProperty(e.CrossHatchFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.RGBSplitFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={red:{type:"2f",value:{x:20,y:20}},green:{type:"2f",value:{x:-20,y:20}},blue:{type:"2f",value:{x:20,y:-20}},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 red;","uniform vec2 green;","uniform vec2 blue;","uniform vec4 dimensions;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;"," gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;"," gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;"," gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;","}"]},e.RGBSplitFilter.prototype=Object.create(e.AbstractFilter.prototype),e.RGBSplitFilter.prototype.constructor=e.RGBSplitFilter,Object.defineProperty(e.RGBSplitFilter.prototype,"red",{get:function(){return this.uniforms.red.value},set:function(t){this.uniforms.red.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"green",{get:function(){return this.uniforms.green.value},set:function(t){this.uniforms.green.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"blue",{get:function(){return this.uniforms.blue.value},set:function(t){this.uniforms.blue.value=t}}),"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=e),exports.PIXI=e):"undefined"!=typeof define&&define.amd?define(e):t.PIXI=e}.call(this),!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.html2canvas=t()}}(function(){var t;return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var h="function"==typeof require&&require;if(!a&&h)return h(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[s]={exports:{}};t[s][0].call(u.exports,function(e){var i=t[s][1][e];return n(i?i:e)},u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;st;t+=2){var e=W[t],i=W[t+1];e(i),W[t]=void 0,W[t+1]=void 0}G=0}function p(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function m(t){try{return t.then}catch(e){return z.error=e,z}}function v(t,e,i,r){try{t.call(e,i,r)}catch(n){return n}}function y(t,e,i){N(function(t){var r=!1,n=v(i,e,function(i){r||(r=!0,e!==i?w(t,i):S(t,i))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&n&&(r=!0,C(t,n))},t)}function x(t,e){e._state===H?S(t,e._result):t._state===X?C(t,e._result):E(e,void 0,function(e){w(t,e)},function(e){C(t,e)})}function b(t,e){if(e.constructor===t.constructor)x(t,e);else{var i=m(e);i===z?C(t,z.error):void 0===i?S(t,e):o(i)?y(t,e,i):S(t,e)}}function w(t,e){t===e?C(t,f()):n(e)?b(t,e):S(t,e)}function T(t){t._onerror&&t._onerror(t._result),A(t)}function S(t,e){t._state===Y&&(t._result=e,t._state=H,0===t._subscribers.length||N(A,t))}function C(t,e){t._state===Y&&(t._state=X,t._result=e,N(T,t))}function E(t,e,i,r){var n=t._subscribers,o=n.length;t._onerror=null,n[o]=e,n[o+H]=i,n[o+X]=r,0===o&&t._state&&N(A,t)}function A(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var r,n,o=t._result,s=0;s1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return a.prototype=t,new a},0),N=function(t,e){W[G]=t,W[G+1]=e,G+=2,2===G&&D()},U="undefined"!=typeof window?window:{},j=U.MutationObserver||U.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,W=new Array(1e3);D="undefined"!=typeof e&&"[object process]"==={}.toString.call(e)?h():j?l():V?u():c();var Y=void 0,H=1,X=2,z=new _,q=new _;P.prototype._validateInput=function(t){return k(t)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var Q=P;P.prototype._enumerate=function(){for(var t=this.length,e=this.promise,i=this._input,r=0;e._state===Y&&t>r;r++)this._eachEntry(i[r],r)},P.prototype._eachEntry=function(t,e){var i=this._instanceConstructor;s(t)?t.constructor===i&&t._state!==Y?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(i.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(H,e,t))},P.prototype._settledAt=function(t,e,i){var r=this.promise;r._state===Y&&(this._remaining--,this._abortOnReject&&t===X?C(r,i):this._result[e]=this._makeResult(t,e,i)),0===this._remaining&&S(r,this._result)},P.prototype._makeResult=function(t,e,i){return i},P.prototype._willSettleAt=function(t,e){var i=this;E(t,void 0,function(t){i._settledAt(H,e,t)},function(t){i._settledAt(X,e,t)})};var K=function(t,e){return new Q(this,t,!0,e).promise},$=function(t,e){function i(t){w(o,t)}function r(t){C(o,t)}var n=this,o=new n(p,e);if(!k(t))return C(o,new TypeError("You must pass an array to race.")),o;for(var s=t.length,a=0;o._state===Y&&s>a;a++)E(n.resolve(t[a]),void 0,i,r);return o},J=function(t,e){var i=this;if(t&&"object"==typeof t&&t.constructor===i)return t;var r=new i(p,e);return w(r,t),r},Z=function(t,e){var i=this,r=new i(p,e);return C(r,t),r},te=0,ee=I;I.all=K,I.race=$,I.resolve=J,I.reject=Z,I.prototype={constructor:I,then:function(t,e){var i=this,r=i._state;if(r===H&&!t||r===X&&!e)return this;var n=new this.constructor(p),o=i._result;if(r){var s=arguments[r-1];N(function(){L(r,n,s,o)})}else E(i,n,t,e);return n},"catch":function(t){return this.then(null,t)}};var ie=function(){var t;t="undefined"!=typeof r?r:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),o(e)}();e||(t.Promise=ee)},re={Promise:ee,polyfill:ie};"function"==typeof t&&t.amd?t(function(){return re}):"undefined"!=typeof i&&i.exports?i.exports=re:"undefined"!=typeof this&&(this.ES6Promise=re)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(t,e){function i(){if(!s){s=!0;for(var t,e=o.length;e;){t=o,o=[];for(var i=-1;++in;)e=t.charCodeAt(n++),e>=55296&&56319>=e&&o>n?(i=t.charCodeAt(n++),56320==(64512&i)?r.push(((1023&e)<<10)+(1023&i)+65536):(r.push(e),n--)):r.push(e);return r}function l(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=k(t>>>10&1023|55296),t=56320|1023&t),e+=k(t)}).join("")}function u(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function c(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function d(t,e,i){var r=0;for(t=i?D(t/_):t>>1,t+=D(t/e);t>O*E>>1;r+=S)t=D(t/O);return D(r+(O+1)*t/(t+A))}function p(t){var e,i,r,n,s,a,h,c,p,f,g=[],m=t.length,v=0,y=L,x=M;for(i=t.lastIndexOf(R),0>i&&(i=0),r=0;i>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),g.push(t.charCodeAt(r));for(n=i>0?i+1:0;m>n;){for(s=v,a=1,h=S;n>=m&&o("invalid-input"),c=u(t.charCodeAt(n++)),(c>=S||c>D((T-v)/a))&&o("overflow"),v+=c*a,p=x>=h?C:h>=x+E?E:h-x,!(p>c);h+=S)f=S-p,a>D(T/f)&&o("overflow"),a*=f;e=g.length+1,x=d(v-s,e,0==s),D(v/e)>T-y&&o("overflow"),y+=D(v/e),v%=e,g.splice(v++,0,y)}return l(g)}function f(t){var e,i,r,n,s,a,l,u,p,f,g,m,v,y,x,b=[];for(t=h(t),m=t.length,e=L,i=0,s=M,a=0;m>a;++a)g=t[a],128>g&&b.push(k(g));for(r=n=b.length,n&&b.push(R);m>r;){for(l=T,a=0;m>a;++a)g=t[a],g>=e&&l>g&&(l=g);for(v=r+1,l-e>D((T-i)/v)&&o("overflow"),i+=(l-e)*v,e=l,a=0;m>a;++a)if(g=t[a],e>g&&++i>T&&o("overflow"),g==e){for(u=i,p=S;f=s>=p?C:p>=s+E?E:p-s,!(f>u);p+=S)x=u-f,y=S-f,b.push(k(c(f+x%y,0))),u=D(x/y);b.push(k(c(u,0))),s=d(i,v,r==n),i=0,++r}++i,++e}return b.join("")}function g(t){return a(t,function(t){return P.test(t)?p(t.slice(4).toLowerCase()):t})}function m(t){return a(t,function(t){return F.test(t)?"xn--"+f(t):t})}var v="object"==typeof r&&r,y="object"==typeof i&&i&&i.exports==v&&i,x="object"==typeof e&&e;(x.global===x||x.window===x)&&(n=x);var b,w,T=2147483647,S=36,C=1,E=26,A=38,_=700,M=72,L=128,R="-",P=/^xn--/,F=/[^ -~]/,B=/\x2E|\u3002|\uFF0E|\uFF61/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=S-C,D=Math.floor,k=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:h,encode:l},decode:p,encode:f,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&!v.nodeType)if(y)y.exports=b;else for(w in b)b.hasOwnProperty(w)&&(v[w]=b[w]);else n.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(t,e){function i(t,e,i){for(var r=t.getElementsByTagName(i),n=e.getElementsByTagName(i),o=r.length,s=0;o>s;s++)n[s].value=r[s].value}function r(t,e,i){!t.defaultView||e===t.defaultView.pageXOffset&&i===t.defaultView.pageYOffset||t.defaultView.scrollTo(e,i)}function n(t){[].slice.call(t.querySelectorAll("canvas"),0).forEach(function(t){t.setAttribute(d,"canvas-"+p++)})}function o(t,e){[].slice.call(t.querySelectorAll("["+d+"]"),0).forEach(function(t){try{var i=e.querySelector("["+d+'="'+t.getAttribute(d)+'"]');i&&(i.width=t.width,i.height=t.height,i.getContext("2d").putImageData(t.getContext("2d").getImageData(0,0,t.width,t.height),0,0))}catch(r){u("Unable to copy canvas content from",t,r)}t.removeAttribute(d)})}function s(t){return[].slice.call(t.childNodes,0).filter(l).forEach(function(e){"SCRIPT"===e.tagName?t.removeChild(e):s(e)}),t}function a(){return document.documentMode&&document.documentMode<=9}function h(t,e){for(var i=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),r=t.firstChild;r;)(e===!0||1!==r.nodeType||"SCRIPT"!==r.nodeName)&&i.appendChild(h(r,e)),r=r.nextSibling;return i}function l(t){return t.nodeType===Node.ELEMENT_NODE}var u=t("./log"),c=t("./promise"),d="data-html2canvas-canvas-clone",p=0;e.exports=function(t,e,l,u,d,p,f){n(t);var g=a()?h(t.documentElement,d.javascriptEnabled):t.documentElement.cloneNode(!0),m=e.createElement("iframe");return m.className="html2canvas-container",m.style.visibility="hidden",m.style.position="fixed",m.style.left="-10000px",m.style.top="0px",m.style.border="0",m.width=l,m.height=u,m.scrolling="no",e.body.appendChild(m),new c(function(e){var n=m.contentWindow.document;i(t.documentElement,g,"textarea"),i(t.documentElement,g,"select"),m.contentWindow.onload=m.onload=function(){var i=setInterval(function(){n.body.childNodes.length>0&&(o(t,n),clearInterval(i),"view"===d.type&&m.contentWindow.scrollTo(p,f),e(m))},50)},n.open(),n.write(""),r(t,p,f),n.replaceChild(d.javascriptEnabled===!0?n.adoptNode(g):s(n.adoptNode(g)),n.documentElement),n.close()})}},{"./log":15,"./promise":18}],5:[function(t,e){function i(t){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(t)||this.namedColor(t)||this.rgb(t)||this.rgba(t)||this.hex6(t)||this.hex3(t)}i.prototype.darken=function(t){var e=1-t;return new i([Math.round(this.r*e),Math.round(this.g*e),Math.round(this.b*e),this.a])},i.prototype.isTransparent=function(){return 0===this.a},i.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},i.prototype.fromArray=function(t){return Array.isArray(t)&&(this.r=Math.min(t[0],255),this.g=Math.min(t[1],255),this.b=Math.min(t[2],255),t.length>3&&(this.a=t[3])),Array.isArray(t)};var r=/^#([a-f0-9]{3})$/i;i.prototype.hex3=function(t){var e=null;return null!==(e=t.match(r))&&(this.r=parseInt(e[1][0]+e[1][0],16),this.g=parseInt(e[1][1]+e[1][1],16),this.b=parseInt(e[1][2]+e[1][2],16)),null!==e};var n=/^#([a-f0-9]{6})$/i;i.prototype.hex6=function(t){var e=null;return null!==(e=t.match(n))&&(this.r=parseInt(e[1].substring(0,2),16),this.g=parseInt(e[1].substring(2,4),16),this.b=parseInt(e[1].substring(4,6),16)),null!==e};var o=/^rgb\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3})\)$/;i.prototype.rgb=function(t){var e=null;return null!==(e=t.match(o))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3])),null!==e};var s=/^rgba\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *, *(\d+\.?\d*)\)$/;i.prototype.rgba=function(t){var e=null;return null!==(e=t.match(s))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3]),this.a=Number(e[4])),null!==e},i.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},i.prototype.namedColor=function(t){var e=a[t.toLowerCase()];if(e)this.r=e[0],this.g=e[1],this.b=e[2];else if("transparent"===t.toLowerCase())return this.r=this.g=this.b=this.a=0,!0;return!!e},i.prototype.isColor=!0;var a={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};e.exports=i},{}],6:[function(t,e){function i(t,e){var i=T++;if(e=e||{},e.logging&&(window.html2canvas.logging=!0,window.html2canvas.start=Date.now()),e.async="undefined"==typeof e.async?!0:e.async,e.allowTaint="undefined"==typeof e.allowTaint?!1:e.allowTaint,e.removeContainer="undefined"==typeof e.removeContainer?!0:e.removeContainer,e.javascriptEnabled="undefined"==typeof e.javascriptEnabled?!1:e.javascriptEnabled,e.imageTimeout="undefined"==typeof e.imageTimeout?1e4:e.imageTimeout,e.renderer="function"==typeof e.renderer?e.renderer:d,e.strict=!!e.strict,"string"==typeof t){if("string"!=typeof e.proxy)return u.reject("Proxy must be used when rendering url");var o=null!=e.width?e.width:window.innerWidth,s=null!=e.height?e.height:window.innerHeight;return x(l(t),e.proxy,document,o,s,e).then(function(t){return n(t.contentWindow.document.documentElement,t,e,o,s)})}var a=(void 0===t?[document.documentElement]:t.length?t:[t])[0];return a.setAttribute(w+i,i),r(a.ownerDocument,e,a.ownerDocument.defaultView.innerWidth,a.ownerDocument.defaultView.innerHeight,i).then(function(t){return"function"==typeof e.onrendered&&(m("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),e.onrendered(t)),t})}function r(t,e,i,r,o){return y(t,t,i,r,e,t.defaultView.pageXOffset,t.defaultView.pageYOffset).then(function(s){m("Document cloned");var a=w+o,h="["+a+"='"+o+"']";t.querySelector(h).removeAttribute(a);var l=s.contentWindow,c=l.document.querySelector(h);"0"===c.style.opacity&&"webgl"===c.getAttribute("renderer")?c.style.opacity=1:null;var d=u.resolve("function"==typeof e.onclone?e.onclone(l.document):!0);return d.then(function(){return n(c,s,e,i,r)})})}function n(t,e,i,r,n){var l=e.contentWindow,u=new c(l.document),d=new p(i,u),g=b(t),v="view"===i.type?r:a(l.document),y="view"===i.type?n:h(l.document),x=new i.renderer(v,y,d,i,document),w=new f(t,x,u,d,i);return w.ready.then(function(){m("Finished rendering");var r;return r="view"===i.type?s(x.canvas,{width:x.canvas.width,height:x.canvas.height,top:0,left:0,x:0,y:0}):t===l.document.body||t===l.document.documentElement||null!=i.canvas?x.canvas:s(x.canvas,{width:null!=i.width?i.width:g.width,height:null!=i.height?i.height:g.height,top:g.top,left:g.left,x:l.pageXOffset,y:l.pageYOffset}),o(e,i),r})}function o(t,e){e.removeContainer&&(t.parentNode.removeChild(t),m("Cleaned up container"))}function s(t,e){var i=document.createElement("canvas"),r=Math.min(t.width-1,Math.max(0,e.left)),n=Math.min(t.width,Math.max(1,e.left+e.width)),o=Math.min(t.height-1,Math.max(0,e.top)),s=Math.min(t.height,Math.max(1,e.top+e.height));return i.width=e.width,i.height=e.height,m("Cropping canvas at:","left:",e.left,"top:",e.top,"width:",n-r,"height:",s-o),m("Resulting crop with width",e.width,"and height",e.height," with x",r,"and y",o),i.getContext("2d").drawImage(t,r,o,n-r,s-o,e.x,e.y,n-r,s-o),i}function a(t){return Math.max(Math.max(t.body.scrollWidth,t.documentElement.scrollWidth),Math.max(t.body.offsetWidth,t.documentElement.offsetWidth),Math.max(t.body.clientWidth,t.documentElement.clientWidth))}function h(t){return Math.max(Math.max(t.body.scrollHeight,t.documentElement.scrollHeight),Math.max(t.body.offsetHeight,t.documentElement.offsetHeight),Math.max(t.body.clientHeight,t.documentElement.clientHeight))}function l(t){var e=document.createElement("a");return e.href=t,e.href=e.href,e}var u=t("./promise"),c=t("./support"),d=t("./renderers/canvas"),p=t("./imageloader"),f=t("./nodeparser"),g=t("./nodecontainer"),m=t("./log"),v=t("./utils"),y=t("./clone"),x=t("./proxy").loadUrlDocument,b=v.getBounds,w="data-html2canvas-node",T=0;i.Promise=u,i.CanvasRenderer=d,i.NodeContainer=g,i.log=m,i.utils=v,e.exports="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return u.reject("No canvas support")}:i},{"./clone":4,"./imageloader":13,"./log":15,"./nodecontainer":16,"./nodeparser":17,"./promise":18,"./proxy":19,"./renderers/canvas":23,"./support":25,"./utils":29}],7:[function(t,e){function i(t){if(this.src=t,n("DummyImageContainer for",t),!this.promise||!this.image){n("Initiating DummyImageContainer"),i.prototype.image=new Image;var e=this.image;i.prototype.promise=new r(function(t,i){e.onload=t,e.onerror=i,e.src=o(),e.complete===!0&&t(e)})}}var r=t("./promise"),n=t("./log"),o=t("./utils").smallImage;e.exports=i},{"./log":15,"./promise":18,"./utils":29}],8:[function(t,e){function i(t,e){var i,n,o=document.createElement("div"),s=document.createElement("img"),a=document.createElement("span"),h="Hidden Text";o.style.visibility="hidden",o.style.fontFamily=t,o.style.fontSize=e,o.style.margin=0,o.style.padding=0,document.body.appendChild(o),s.src=r(),s.width=1,s.height=1,s.style.margin=0,s.style.padding=0,s.style.verticalAlign="baseline",a.style.fontFamily=t,a.style.fontSize=e,a.style.margin=0,a.style.padding=0,a.appendChild(document.createTextNode(h)),o.appendChild(a),o.appendChild(s),i=s.offsetTop-a.offsetTop+1,o.removeChild(a),o.appendChild(document.createTextNode(h)),o.style.lineHeight="normal",s.style.verticalAlign="super",n=s.offsetTop-o.offsetTop+1,document.body.removeChild(o),this.baseline=i,this.lineWidth=1,this.middle=n}var r=t("./utils").smallImage;e.exports=i},{"./utils":29}],9:[function(t,e){function i(){this.data={}}var r=t("./font");i.prototype.getMetrics=function(t,e){return void 0===this.data[t+"-"+e]&&(this.data[t+"-"+e]=new r(t,e)),this.data[t+"-"+e]},e.exports=i},{"./font":8}],10:[function(t,e){function i(e,i,r){this.image=null,this.src=e;var s=this,a=o(e);this.promise=(i?new n(function(t){"about:blank"===e.contentWindow.document.URL||null==e.contentWindow.document.documentElement?e.contentWindow.onload=e.onload=function(){t(e)}:t(e)}):this.proxyLoad(r.proxy,a,r)).then(function(e){var i=t("./core");return i(e.contentWindow.document.documentElement,{type:"view",width:e.width,height:e.height,proxy:r.proxy,javascriptEnabled:r.javascriptEnabled,removeContainer:r.removeContainer,allowTaint:r.allowTaint,imageTimeout:r.imageTimeout/2})}).then(function(t){return s.image=t})}var r=t("./utils"),n=t("./promise"),o=r.getBounds,s=t("./proxy").loadUrlDocument;i.prototype.proxyLoad=function(t,e,i){var r=this.src;return s(r.src,t,r.ownerDocument,e.width,e.height,i)},e.exports=i},{"./core":6,"./promise":18,"./proxy":19,"./utils":29}],11:[function(t,e){function i(t){this.src=t.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=r.resolve(!0)}var r=t("./promise");i.prototype.TYPES={LINEAR:1,RADIAL:2},e.exports=i},{"./promise":18}],12:[function(t,e){function i(t,e){this.src=t,this.image=new Image;var i=this;this.tainted=null,this.promise=new r(function(r,n){i.image.onload=r,i.image.onerror=n,e&&(i.image.crossOrigin="anonymous"),i.image.src=t,i.image.complete===!0&&r(i.image)})}var r=t("./promise");e.exports=i},{"./promise":18}],13:[function(t,e){function i(t,e){this.link=null,this.options=t,this.support=e,this.origin=this.getOrigin(window.location.href)}var r=t("./promise"),n=t("./log"),o=t("./imagecontainer"),s=t("./dummyimagecontainer"),a=t("./proxyimagecontainer"),h=t("./framecontainer"),l=t("./svgcontainer"),u=t("./svgnodecontainer"),c=t("./lineargradientcontainer"),d=t("./webkitgradientcontainer"),p=t("./utils").bind;i.prototype.findImages=function(t){var e=[];return t.reduce(function(t,e){switch(e.node.nodeName){case"IMG":return t.concat([{args:[e.node.src],method:"url"}]);case"svg":case"IFRAME":return t.concat([{args:[e.node],method:e.node.nodeName}])}return t},[]).forEach(this.addImage(e,this.loadImage),this),e},i.prototype.findBackgroundImage=function(t,e){return e.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(t,this.loadImage),this),t},i.prototype.addImage=function(t,e){return function(i){i.args.forEach(function(r){this.imageExists(t,r)||(t.splice(0,0,e.call(this,i)),n("Added image #"+t.length,"string"==typeof r?r.substring(0,100):r))},this)}},i.prototype.hasImageBackground=function(t){return"none"!==t.method},i.prototype.loadImage=function(t){if("url"===t.method){var e=t.args[0];return!this.isSVG(e)||this.support.svg||this.options.allowTaint?e.match(/data:image\/.*;base64,/i)?new o(e.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(e)||this.options.allowTaint===!0||this.isSVG(e)?new o(e,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new o(e,!0):this.options.proxy?new a(e,this.options.proxy):new s(e):new l(e)}return"linear-gradient"===t.method?new c(t):"gradient"===t.method?new d(t):"svg"===t.method?new u(t.args[0],this.support.svg):"IFRAME"===t.method?new h(t.args[0],this.isSameOrigin(t.args[0].src),this.options):new s(t)},i.prototype.isSVG=function(t){return"svg"===t.substring(t.length-3).toLowerCase()||l.prototype.isInline(t) +},i.prototype.imageExists=function(t,e){return t.some(function(t){return t.src===e})},i.prototype.isSameOrigin=function(t){return this.getOrigin(t)===this.origin},i.prototype.getOrigin=function(t){var e=this.link||(this.link=document.createElement("a"));return e.href=t,e.href=e.href,e.protocol+e.hostname+e.port},i.prototype.getPromise=function(t){return this.timeout(t,this.options.imageTimeout)["catch"](function(){var e=new s(t.src);return e.promise.then(function(e){t.image=e})})},i.prototype.get=function(t){var e=null;return this.images.some(function(i){return(e=i).src===t})?e:null},i.prototype.fetch=function(t){return this.images=t.reduce(p(this.findBackgroundImage,this),this.findImages(t)),this.images.forEach(function(t,e){t.promise.then(function(){n("Succesfully loaded image #"+(e+1),t)},function(i){n("Failed loading image #"+(e+1),t,i)})}),this.ready=r.all(this.images.map(this.getPromise,this)),n("Finished searching images"),this},i.prototype.timeout=function(t,e){var i,o=r.race([t.promise,new r(function(r,o){i=setTimeout(function(){n("Timed out loading image",t),o(t)},e)})]).then(function(t){return clearTimeout(i),t});return o["catch"](function(){clearTimeout(i)}),o},e.exports=i},{"./dummyimagecontainer":7,"./framecontainer":10,"./imagecontainer":12,"./lineargradientcontainer":14,"./log":15,"./promise":18,"./proxyimagecontainer":20,"./svgcontainer":26,"./svgnodecontainer":27,"./utils":29,"./webkitgradientcontainer":30}],14:[function(t,e){function i(t){r.apply(this,arguments),this.type=this.TYPES.LINEAR;var e=null===t.args[0].match(this.stepRegExp);e?t.args[0].split(" ").reverse().forEach(function(t){switch(t){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var e=this.y0,i=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=i,this.y1=e}},this):(this.y0=0,this.y1=1),this.colorStops=t.args.slice(e?1:0).map(function(t){var e=t.match(this.stepRegExp);return{color:new n(e[1]),stop:"%"===e[3]?e[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(t,e){null===t.stop&&this.colorStops.slice(e).some(function(i,r){return null!==i.stop?(t.stop=(i.stop-this.colorStops[e-1].stop)/(r+1)+this.colorStops[e-1].stop,!0):!1},this)},this)}var r=t("./gradientcontainer"),n=t("./color");i.prototype=Object.create(r.prototype),i.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,e.exports=i},{"./color":5,"./gradientcontainer":11}],15:[function(t,e){e.exports=function(){window.html2canvas.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-window.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}},{}],16:[function(t,e){function i(t,e){this.node=t,this.parent=e,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function r(t){var e=t.options[t.selectedIndex||0];return e?e.text||"":""}function n(t){return t&&"matrix"===t[1]?t[2].split(",").map(function(t){return parseFloat(t.trim())}):void 0}function o(t){return-1!==t.toString().indexOf("%")}function s(t){return t.replace("px","")}function a(t){return parseFloat(t)}var h=t("./color"),l=t("./utils"),u=l.getBounds,c=l.parseBackgrounds,d=l.offsetBounds;i.prototype.cloneTo=function(t){t.visible=this.visible,t.borders=this.borders,t.bounds=this.bounds,t.clip=this.clip,t.backgroundClip=this.backgroundClip,t.computedStyles=this.computedStyles,t.styles=this.styles,t.backgroundImages=this.backgroundImages,t.opacity=this.opacity},i.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},i.prototype.assignStack=function(t){this.stack=t,t.children.push(this)},i.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},i.prototype.css=function(t){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[t]||(this.styles[t]=this.computedStyles[t])},i.prototype.prefixedCss=function(t){var e=["webkit","moz","ms","o"],i=this.css(t);return void 0===i&&e.some(function(e){return i=this.css(e+t.substr(0,1).toUpperCase()+t.substr(1)),void 0!==i},this),void 0===i?null:i},i.prototype.computedStyle=function(t){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,t)},i.prototype.cssInt=function(t){var e=parseInt(this.css(t),10);return isNaN(e)?0:e},i.prototype.color=function(t){return this.colors[t]||(this.colors[t]=new h(this.css(t)))},i.prototype.cssFloat=function(t){var e=parseFloat(this.css(t));return isNaN(e)?0:e},i.prototype.fontWeight=function(){var t=this.css("fontWeight");switch(parseInt(t,10)){case 401:t="bold";break;case 400:t="normal"}return t},i.prototype.parseClip=function(){var t=this.css("clip").match(this.CLIP);return t?{top:parseInt(t[1],10),right:parseInt(t[2],10),bottom:parseInt(t[3],10),left:parseInt(t[4],10)}:null},i.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=c(this.css("backgroundImage")))},i.prototype.cssList=function(t,e){var i=(this.css(t)||"").split(",");return i=i[e||0]||i[0]||"auto",i=i.trim().split(" "),1===i.length&&(i=[i[0],o(i[0])?"auto":i[0]]),i},i.prototype.parseBackgroundSize=function(t,e,i){var r,n,s=this.cssList("backgroundSize",i);if(o(s[0]))r=t.width*parseFloat(s[0])/100;else{if(/contain|cover/.test(s[0])){var a=t.width/t.height,h=e.width/e.height;return h>a^"contain"===s[0]?{width:t.height*h,height:t.height}:{width:t.width,height:t.width/h}}r=parseInt(s[0],10)}return n="auto"===s[0]&&"auto"===s[1]?e.height:"auto"===s[1]?r/e.width*e.height:o(s[1])?t.height*parseFloat(s[1])/100:parseInt(s[1],10),"auto"===s[0]&&(r=n/e.height*e.width),{width:r,height:n}},i.prototype.parseBackgroundPosition=function(t,e,i,r){var n,s,a=this.cssList("backgroundPosition",i);return n=o(a[0])?(t.width-(r||e).width)*(parseFloat(a[0])/100):parseInt(a[0],10),s="auto"===a[1]?n/e.width*e.height:o(a[1])?(t.height-(r||e).height)*parseFloat(a[1])/100:parseInt(a[1],10),"auto"===a[0]&&(n=s/e.height*e.width),{left:n,top:s}},i.prototype.parseBackgroundRepeat=function(t){return this.cssList("backgroundRepeat",t)[0]},i.prototype.parseTextShadows=function(){var t=this.css("textShadow"),e=[];if(t&&"none"!==t)for(var i=t.match(this.TEXT_SHADOW_PROPERTY),r=0;i&&r0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,t)):t():(this.renderQueue.forEach(this.paint,this),t())},this))},this))}function r(t){return t.parent&&t.parent.clip.length}function n(t){return t.replace(/(\-[a-z])/g,function(t){return t.toUpperCase().replace("-","")})}function o(){}function s(t,e,i,r){return t.map(function(n,o){if(n.width>0){var s=e.left,a=e.top,h=e.width,l=e.height-t[2].width;switch(o){case 0:l=t[0].width,n.args=u({c1:[s,a],c2:[s+h,a],c3:[s+h-t[1].width,a+l],c4:[s+t[3].width,a+l]},r[0],r[1],i.topLeftOuter,i.topLeftInner,i.topRightOuter,i.topRightInner);break;case 1:s=e.left+e.width-t[1].width,h=t[1].width,n.args=u({c1:[s+h,a],c2:[s+h,a+l+t[2].width],c3:[s,a+l],c4:[s,a+t[0].width]},r[1],r[2],i.topRightOuter,i.topRightInner,i.bottomRightOuter,i.bottomRightInner);break;case 2:a=a+e.height-t[2].width,l=t[2].width,n.args=u({c1:[s+h,a+l],c2:[s,a+l],c3:[s+t[3].width,a],c4:[s+h-t[3].width,a]},r[2],r[3],i.bottomRightOuter,i.bottomRightInner,i.bottomLeftOuter,i.bottomLeftInner);break;case 3:h=t[3].width,n.args=u({c1:[s,a+l+t[2].width],c2:[s,a],c3:[s+h,a+t[0].width],c4:[s+h,a+l]},r[3],r[0],i.bottomLeftOuter,i.bottomLeftInner,i.topLeftOuter,i.topLeftInner)}}return n})}function a(t,e,i,r){var n=4*((Math.sqrt(2)-1)/3),o=i*n,s=r*n,a=t+i,h=e+r;return{topLeft:l({x:t,y:h},{x:t,y:h-s},{x:a-o,y:e},{x:a,y:e}),topRight:l({x:t,y:e},{x:t+o,y:e},{x:a,y:h-s},{x:a,y:h}),bottomRight:l({x:a,y:e},{x:a,y:e+s},{x:t+o,y:h},{x:t,y:h}),bottomLeft:l({x:a,y:h},{x:a-o,y:h},{x:t,y:e+s},{x:t,y:e})}}function h(t,e,i){var r=t.left,n=t.top,o=t.width,s=t.height,h=e[0][0],l=e[0][1],u=e[1][0],c=e[1][1],d=e[2][0],p=e[2][1],f=e[3][0],g=e[3][1],m=Math.floor(s/2);h=h>m?m:h,l=l>m?m:l,u=u>m?m:u,c=c>m?m:c,d=d>m?m:d,p=p>m?m:p,f=f>m?m:f,g=g>m?m:g;var v=o-u,y=s-p,x=o-d,b=s-g;return{topLeftOuter:a(r,n,h,l).topLeft.subdivide(.5),topLeftInner:a(r+i[3].width,n+i[0].width,Math.max(0,h-i[3].width),Math.max(0,l-i[0].width)).topLeft.subdivide(.5),topRightOuter:a(r+v,n,u,c).topRight.subdivide(.5),topRightInner:a(r+Math.min(v,o+i[3].width),n+i[0].width,v>o+i[3].width?0:u-i[3].width,c-i[0].width).topRight.subdivide(.5),bottomRightOuter:a(r+x,n+y,d,p).bottomRight.subdivide(.5),bottomRightInner:a(r+Math.min(x,o-i[3].width),n+Math.min(y,s+i[0].width),Math.max(0,d-i[1].width),p-i[2].width).bottomRight.subdivide(.5),bottomLeftOuter:a(r,n+b,f,g).bottomLeft.subdivide(.5),bottomLeftInner:a(r+i[3].width,n+b,Math.max(0,f-i[3].width),g-i[2].width).bottomLeft.subdivide(.5)}}function l(t,e,i,r){var n=function(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}};return{start:t,startControl:e,endControl:i,end:r,subdivide:function(o){var s=n(t,e,o),a=n(e,i,o),h=n(i,r,o),u=n(s,a,o),c=n(a,h,o),d=n(u,c,o);return[l(t,s,u,d),l(d,c,h,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,i.x,i.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",i.x,i.y,e.x,e.y,t.x,t.y])}}}function u(t,e,i,r,n,o,s){var a=[];return e[0]>0||e[1]>0?(a.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(a)):a.push(["line",t.c1[0],t.c1[1]]),i[0]>0||i[1]>0?(a.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(a),a.push(["line",s[0].end.x,s[0].end.y]),s[0].curveToReversed(a)):(a.push(["line",t.c2[0],t.c2[1]]),a.push(["line",t.c3[0],t.c3[1]])),e[0]>0||e[1]>0?(a.push(["line",n[1].end.x,n[1].end.y]),n[1].curveToReversed(a)):a.push(["line",t.c4[0],t.c4[1]]),a}function c(t,e,i,r,n,o,s){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",o,s]),(i[0]>0||i[1]>0)&&t.push(["line",n[0].start.x,n[0].start.y])}function d(t){return t.cssInt("zIndex")<0}function p(t){return t.cssInt("zIndex")>0}function f(t){return 0===t.cssInt("zIndex")}function g(t){return-1!==["inline","inline-block","inline-table"].indexOf(t.css("display"))}function m(t){return t instanceof z}function v(t){return t.node.data.trim().length>0}function y(t){return/^(normal|none|0px)$/.test(t.parent.css("letterSpacing"))}function x(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){var i=t.css("border"+e+"Radius"),r=i.split(" ");return r.length<=1&&(r[1]=r[0]),r.map(P)})}function b(t){return t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE}function w(t){var e=t.css("position"),i=-1!==["absolute","relative","fixed"].indexOf(e)?t.css("zIndex"):"auto";return"auto"!==i}function T(t){return"static"!==t.css("position")}function S(t){return"none"!==t.css("float")}function C(t){return-1!==["inline-block","inline-table"].indexOf(t.css("display"))}function E(t){var e=this;return function(){return!t.apply(e,arguments)}}function A(t){return t.node.nodeType===Node.ELEMENT_NODE}function _(t){return t.isPseudoElement===!0}function M(t){return t.node.nodeType===Node.TEXT_NODE}function L(t){return function(e,i){return e.cssInt("zIndex")+t.indexOf(e)/t.length-(i.cssInt("zIndex")+t.indexOf(i)/t.length)}}function R(t){return t.getOpacity()<1}function P(t){return parseInt(t,10)}function F(t){return t.width}function B(t){return t.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(t.node.nodeName)}function I(t){return[].concat.apply([],t)}function O(t){var e=t.substr(0,1);return e===t.substr(t.length-1)&&e.match(/'|"/)?t.substr(1,t.length-2):t}function D(t){for(var e,i=[],r=0,n=!1;t.length;)k(t[r])===n?(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)),n=!n,r=0):r++,r>=t.length&&(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)));return i}function k(t){return-1!==[32,13,10,9,45].indexOf(t)}function G(t){return/[^\u0000-\u00ff]/.test(t)}var N=t("./log"),U=t("punycode"),j=t("./nodecontainer"),V=t("./textcontainer"),W=t("./pseudoelementcontainer"),Y=t("./fontmetrics"),H=t("./color"),X=t("./promise"),z=t("./stackingcontext"),q=t("./utils"),Q=q.bind,K=q.getBounds,$=q.parseBackgrounds,J=q.offsetBounds;i.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(t){if(A(t)){_(t)&&t.appendToDOM(),t.borders=this.parseBorders(t);var e="hidden"===t.css("overflow")?[t.borders.clip]:[],i=t.parseClip();i&&-1!==["absolute","fixed"].indexOf(t.css("position"))&&e.push([["rect",t.bounds.left+i.left,t.bounds.top+i.top,i.right-i.left,i.bottom-i.top]]),t.clip=r(t)?t.parent.clip.concat(e):e,t.backgroundClip="hidden"!==t.css("overflow")?t.clip.concat([t.borders.clip]):t.clip,_(t)&&t.cleanDOM()}else M(t)&&(t.clip=r(t)?t.parent.clip:[]);_(t)||(t.bounds=null)},this)},i.prototype.asyncRenderer=function(t,e,i){i=i||Date.now(),this.paint(t[this.renderIndex++]),t.length===this.renderIndex?e():i+20>Date.now()?this.asyncRenderer(t,e,i):setTimeout(Q(function(){this.asyncRenderer(t,e)},this),0)},i.prototype.createPseudoHideStyles=function(t){this.createStyles(t,"."+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},i.prototype.disableAnimations=function(t){this.createStyles(t,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},i.prototype.createStyles=function(t,e){var i=t.createElement("style");i.innerHTML=e,t.body.appendChild(i)},i.prototype.getPseudoElements=function(t){var e=[[t]];if(t.node.nodeType===Node.ELEMENT_NODE){var i=this.getPseudoElement(t,":before"),r=this.getPseudoElement(t,":after");i&&e.push(i),r&&e.push(r)}return I(e)},i.prototype.getPseudoElement=function(t,e){var i=t.computedStyle(e);if(!i||!i.content||"none"===i.content||"-moz-alt-content"===i.content||"none"===i.display)return null;for(var r=O(i.content),o="url"===r.substr(0,3),s=document.createElement(o?"img":"html2canvaspseudoelement"),a=new W(s,t,e),h=i.length-1;h>=0;h--){var l=n(i.item(h));s.style[l]=i[l]}if(s.className=W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,o)return s.src=$(r)[0].args[0],[a];var u=document.createTextNode(r);return s.appendChild(u),[a,new V(u,a)]},i.prototype.getChildren=function(t){return I([].filter.call(t.node.childNodes,b).map(function(e){var i=[e.nodeType===Node.TEXT_NODE?new V(e,t):new j(e,t)].filter(B);return e.nodeType===Node.ELEMENT_NODE&&i.length&&"TEXTAREA"!==e.tagName?i[0].isElementVisible()?i.concat(this.getChildren(i[0])):[]:i},this))},i.prototype.newStackingContext=function(t,e){var i=new z(e,t.getOpacity(),t.node,t.parent);t.cloneTo(i);var r=e?i.getParentStack(this):i.parent.stack;r.contexts.push(i),t.stack=i},i.prototype.createStackingContexts=function(){this.nodes.forEach(function(t){A(t)&&(this.isRootElement(t)||R(t)||w(t)||this.isBodyWithTransparentRoot(t)||t.hasTransform())?this.newStackingContext(t,!0):A(t)&&(T(t)&&f(t)||C(t)||S(t))?this.newStackingContext(t,!1):t.assignStack(t.parent.stack)},this)},i.prototype.isBodyWithTransparentRoot=function(t){return"BODY"===t.node.nodeName&&t.parent.color("backgroundColor").isTransparent()},i.prototype.isRootElement=function(t){return null===t.parent},i.prototype.sortStackingContexts=function(t){t.contexts.sort(L(t.contexts.slice(0))),t.contexts.forEach(this.sortStackingContexts,this)},i.prototype.parseTextBounds=function(t){return function(e,i,r){if("none"!==t.parent.css("textDecoration").substr(0,4)||0!==e.trim().length){if(this.support.rangeBounds&&!t.parent.hasTransform()){var n=r.slice(0,i).join("").length;return this.getRangeBounds(t.node,n,e.length)}if(t.node&&"string"==typeof t.node.data){var o=t.node.splitText(e.length),s=this.getWrapperBounds(t.node,t.parent.hasTransform());return t.node=o,s}}else(!this.support.rangeBounds||t.parent.hasTransform())&&(t.node=t.node.splitText(e.length));return{}}},i.prototype.getWrapperBounds=function(t,e){var i=t.ownerDocument.createElement("html2canvaswrapper"),r=t.parentNode,n=t.cloneNode(!0);i.appendChild(t.cloneNode(!0)),r.replaceChild(i,t);var o=e?J(i):K(i);return r.replaceChild(n,i),o},i.prototype.getRangeBounds=function(t,e,i){var r=this.range||(this.range=t.ownerDocument.createRange());return r.setStart(t,e),r.setEnd(t,e+i),r.getBoundingClientRect()},i.prototype.parse=function(t){var e=t.contexts.filter(d),i=t.children.filter(A),r=i.filter(E(S)),n=r.filter(E(T)).filter(E(g)),s=i.filter(E(T)).filter(S),a=r.filter(E(T)).filter(g),h=t.contexts.concat(r.filter(T)).filter(f),l=t.children.filter(M).filter(v),u=t.contexts.filter(p);e.concat(n).concat(s).concat(a).concat(h).concat(l).concat(u).forEach(function(t){this.renderQueue.push(t),m(t)&&(this.parse(t),this.renderQueue.push(new o))},this)},i.prototype.paint=function(t){try{t instanceof o?this.renderer.ctx.restore():M(t)?(_(t.parent)&&t.parent.appendToDOM(),this.paintText(t),_(t.parent)&&t.parent.cleanDOM()):this.paintNode(t)}catch(e){if(N(e),this.options.strict)throw e}},i.prototype.paintNode=function(t){m(t)&&(this.renderer.setOpacity(t.opacity),this.renderer.ctx.save(),t.hasTransform()&&this.renderer.setTransform(t.parseTransform())),"INPUT"===t.node.nodeName&&"checkbox"===t.node.type?this.paintCheckbox(t):"INPUT"===t.node.nodeName&&"radio"===t.node.type?this.paintRadio(t):this.paintElement(t)},i.prototype.paintElement=function(t){var e=t.parseBounds();this.renderer.clip(t.backgroundClip,function(){this.renderer.renderBackground(t,e,t.borders.borders.map(F))},this),this.renderer.clip(t.clip,function(){this.renderer.renderBorders(t.borders.borders)},this),this.renderer.clip(t.backgroundClip,function(){switch(t.node.nodeName){case"svg":case"IFRAME":var i=this.images.get(t.node);i?this.renderer.renderImage(t,e,t.borders,i):N("Error loading <"+t.node.nodeName+">",t.node);break;case"IMG":var r=this.images.get(t.node.src);r?this.renderer.renderImage(t,e,t.borders,r):N("Error loading ",t.node.src);break;case"CANVAS":this.renderer.renderImage(t,e,t.borders,{image:t.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(t)}},this)},i.prototype.paintCheckbox=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height),r={width:i-1,height:i-1,top:e.top,left:e.left},n=[3,3],o=[n,n,n,n],a=[1,1,1,1].map(function(t){return{color:new H("#A5A5A5"),width:t}}),l=h(r,o,a);this.renderer.clip(t.backgroundClip,function(){this.renderer.rectangle(r.left+1,r.top+1,r.width-2,r.height-2,new H("#DEDEDE")),this.renderer.renderBorders(s(a,r,l,o)),t.node.checked&&(this.renderer.font(new H("#424242"),"normal","normal","bold",i-3+"px","arial"),this.renderer.text("✔",r.left+i/6,r.top+i-1))},this)},i.prototype.paintRadio=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height)-2;this.renderer.clip(t.backgroundClip,function(){this.renderer.circleStroke(e.left+1,e.top+1,i,new H("#DEDEDE"),1,new H("#A5A5A5")),t.node.checked&&this.renderer.circle(Math.ceil(e.left+i/4)+1,Math.ceil(e.top+i/4)+1,Math.floor(i/2),new H("#424242"))},this)},i.prototype.paintFormValue=function(t){var e=t.getValue();if(e.length>0){var i=t.node.ownerDocument,r=i.createElement("html2canvaswrapper"),n=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];n.forEach(function(e){try{r.style[e]=t.css(e)}catch(i){N("html2canvas: Parse: Exception caught in renderFormValue: "+i.message)}});var o=t.parseBounds();r.style.position="fixed",r.style.left=o.left+"px",r.style.top=o.top+"px",r.textContent=e,i.body.appendChild(r),this.paintText(new V(r.firstChild,t)),i.body.removeChild(r)}},i.prototype.paintText=function(t){t.applyTextTransform();var e=U.ucs2.decode(t.node.data),i=this.options.letterRendering&&!y(t)||G(t.node.data)?e.map(function(t){return U.ucs2.encode([t])}):D(e),r=t.parent.fontWeight(),n=t.parent.css("fontSize"),o=t.parent.css("fontFamily"),s=t.parent.parseTextShadows();this.renderer.font(t.parent.color("color"),t.parent.css("fontStyle"),t.parent.css("fontVariant"),r,n,o),s.length?this.renderer.fontShadow(s[0].color,s[0].offsetX,s[0].offsetY,s[0].blur):this.renderer.clearShadow(),this.renderer.clip(t.parent.clip,function(){i.map(this.parseTextBounds(t),this).forEach(function(e,r){e&&(this.renderer.text(i[r],e.left,e.bottom),this.renderTextDecoration(t.parent,e,this.fontMetrics.getMetrics(o,n)))},this)},this)},i.prototype.renderTextDecoration=function(t,e,i){switch(t.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(e.left,Math.round(e.top+i.baseline+i.lineWidth),e.width,1,t.color("color"));break;case"overline":this.renderer.rectangle(e.left,Math.round(e.top),e.width,1,t.color("color"));break;case"line-through":this.renderer.rectangle(e.left,Math.ceil(e.top+i.middle+i.lineWidth),e.width,1,t.color("color"))}};var Z={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};i.prototype.parseBorders=function(t){var e=t.parseBounds(),i=x(t),r=["Top","Right","Bottom","Left"].map(function(e,i){var r=t.css("border"+e+"Style"),n=t.color("border"+e+"Color");"inset"===r&&n.isBlack()&&(n=new H([255,255,255,n.a]));var o=Z[r]?Z[r][i]:null;return{width:t.cssInt("border"+e+"Width"),color:o?n[o[0]](o[1]):n,args:null}}),n=h(e,i,r);return{clip:this.parseBackgroundClip(t,n,r,i,e),borders:s(r,e,n,i)}},i.prototype.parseBackgroundClip=function(t,e,i,r,n){var o=t.css("backgroundClip"),s=[];switch(o){case"content-box":case"padding-box":c(s,r[0],r[1],e.topLeftInner,e.topRightInner,n.left+i[3].width,n.top+i[0].width),c(s,r[1],r[2],e.topRightInner,e.bottomRightInner,n.left+n.width-i[1].width,n.top+i[0].width),c(s,r[2],r[3],e.bottomRightInner,e.bottomLeftInner,n.left+n.width-i[1].width,n.top+n.height-i[2].width),c(s,r[3],r[0],e.bottomLeftInner,e.topLeftInner,n.left+i[3].width,n.top+n.height-i[2].width);break;default:c(s,r[0],r[1],e.topLeftOuter,e.topRightOuter,n.left,n.top),c(s,r[1],r[2],e.topRightOuter,e.bottomRightOuter,n.left+n.width,n.top),c(s,r[2],r[3],e.bottomRightOuter,e.bottomLeftOuter,n.left+n.width,n.top+n.height),c(s,r[3],r[0],e.bottomLeftOuter,e.topLeftOuter,n.left,n.top+n.height)}return s},e.exports=i},{"./color":5,"./fontmetrics":9,"./log":15,"./nodecontainer":16,"./promise":18,"./pseudoelementcontainer":21,"./stackingcontext":24,"./textcontainer":28,"./utils":29,punycode:3}],18:[function(t,e){e.exports=t("es6-promise").Promise},{"es6-promise":1}],19:[function(t,e,i){function r(t,e,i){var r="withCredentials"in new XMLHttpRequest;if(!e)return u.reject("No proxy configured");var n=s(r),h=a(e,t,n);return r?c(h):o(i,h,n).then(function(t){return g(t.content)})}function n(t,e,i){var r="crossOrigin"in new Image,n=s(r),h=a(e,t,n);return r?u.resolve(h):o(i,h,n).then(function(t){return"data:"+t.type+";base64,"+t.content})}function o(t,e,i){return new u(function(r,n){var o=t.createElement("script"),s=function(){delete window.html2canvas.proxy[i],t.body.removeChild(o)};window.html2canvas.proxy[i]=function(t){s(),r(t)},o.src=e,o.onerror=function(t){s(),n(t)},t.body.appendChild(o)})}function s(t){return t?"":"html2canvas_"+Date.now()+"_"+ ++m+"_"+Math.round(1e5*Math.random())}function a(t,e,i){return t+"?url="+encodeURIComponent(e)+(i.length?"&callback=html2canvas.proxy."+i:"")}function h(t){return function(e){var i,r=new DOMParser;try{i=r.parseFromString(e,"text/html")}catch(n){p("DOMParser not supported, falling back to createHTMLDocument"),i=document.implementation.createHTMLDocument("");try{i.open(),i.write(e),i.close()}catch(o){p("createHTMLDocument write not supported, falling back to document.body.innerHTML"),i.body.innerHTML=e}}var s=i.querySelector("base");if(!s||!s.href.host){var a=i.createElement("base");a.href=t,i.head.insertBefore(a,i.head.firstChild)}return i}}function l(t,e,i,n,o,s){return new r(t,e,window.document).then(h(t)).then(function(t){return f(t,i,n,o,s,0,0)})}var u=t("./promise"),c=t("./xhr"),d=t("./utils"),p=t("./log"),f=t("./clone"),g=d.decode64,m=0;i.Proxy=r,i.ProxyURL=n,i.loadUrlDocument=l},{"./clone":4,"./log":15,"./promise":18,"./utils":29,"./xhr":31}],20:[function(t,e){function i(t,e){var i=document.createElement("a");i.href=t,t=i.href,this.src=t,this.image=new Image;var o=this;this.promise=new n(function(i,n){o.image.crossOrigin="Anonymous",o.image.onload=i,o.image.onerror=n,new r(t,e,document).then(function(t){o.image.src=t})["catch"](n)})}var r=t("./proxy").ProxyURL,n=t("./promise");e.exports=i},{"./promise":18,"./proxy":19}],21:[function(t,e){function i(t,e,i){r.call(this,t,e),this.isPseudoElement=!0,this.before=":before"===i}var r=t("./nodecontainer");i.prototype.cloneTo=function(t){i.prototype.cloneTo.call(this,t),t.isPseudoElement=!0,t.before=this.before},i.prototype=Object.create(r.prototype),i.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},i.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},i.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",e.exports=i},{"./nodecontainer":16}],22:[function(t,e){function i(t,e,i,r,n){this.width=t,this.height=e,this.images=i,this.options=r,this.document=n}var r=t("./log");i.prototype.renderImage=function(t,e,i,r){var n=t.cssInt("paddingLeft"),o=t.cssInt("paddingTop"),s=t.cssInt("paddingRight"),a=t.cssInt("paddingBottom"),h=i.borders,l=e.width-(h[1].width+h[3].width+n+s),u=e.height-(h[0].width+h[2].width+o+a);this.drawImage(r,0,0,Math.round(r.image.width||l),Math.round(r.image.height||u),Math.round(e.left+n+h[3].width),Math.round(e.top+o+h[0].width),l,u)},i.prototype.renderBackground=function(t,e,i){e.height>0&&e.width>0&&(this.renderBackgroundColor(t,e),this.renderBackgroundImage(t,e,i))},i.prototype.renderBackgroundColor=function(t,e){var i=t.color("backgroundColor");i.isTransparent()||this.rectangle(e.left,e.top,e.width,e.height,i)},i.prototype.renderBorders=function(t){t.forEach(this.renderBorder,this)},i.prototype.renderBorder=function(t){t.color.isTransparent()||null===t.args||this.drawShape(t.args,t.color)},i.prototype.renderBackgroundImage=function(t,e,i){var n=t.parseBackgroundImages();n.reverse().forEach(function(n,o,s){switch(n.method){case"url":var a=this.images.get(n.args[0]);a?this.renderBackgroundRepeating(t,e,a,s.length-(o+1),i):r("Error loading background-image",n.args[0]);break;case"linear-gradient":case"gradient":var h=this.images.get(n.value);h?this.renderBackgroundGradient(h,e,i):r("Error loading background-image",n.args[0]);break;case"none":break;default:r("Unknown background-image type",n.args[0])}},this)},i.prototype.renderBackgroundRepeating=function(t,e,i,r,n){var o=t.parseBackgroundSize(e,i.image,r),s=t.parseBackgroundPosition(e,i.image,r,o),a=t.parseBackgroundRepeat(r);switch(a){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+n[3],e.top+s.top+n[0],99999,o.height,n);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+n[0],o.width,99999,n);break;case"no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+s.top+n[0],o.width,o.height,n);break;default:this.renderBackgroundRepeat(i,s,o,{top:e.top,left:e.left},n[3],n[0])}},e.exports=i},{"./log":15}],23:[function(t,e){function i(t,e){n.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=t,this.canvas.height=e),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},s("Initialized CanvasRenderer with size",t,"x",e)}function r(t){return t.length>0}var n=t("../renderer"),o=t("../lineargradientcontainer"),s=t("../log");i.prototype=Object.create(n.prototype),i.prototype.setFillStyle=function(t){return this.ctx.fillStyle="object"==typeof t&&t.isColor?t.toString():t,this.ctx +},i.prototype.rectangle=function(t,e,i,r,n){this.setFillStyle(n).fillRect(t,e,i,r)},i.prototype.circle=function(t,e,i,r){this.setFillStyle(r),this.ctx.beginPath(),this.ctx.arc(t+i/2,e+i/2,i/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},i.prototype.circleStroke=function(t,e,i,r,n,o){this.circle(t,e,i,r),this.ctx.strokeStyle=o.toString(),this.ctx.stroke()},i.prototype.drawShape=function(t,e){this.shape(t),this.setFillStyle(e).fill()},i.prototype.taints=function(t){if(null===t.tainted){this.taintCtx.drawImage(t.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),t.tainted=!1}catch(e){this.taintCtx=document.createElement("canvas").getContext("2d"),t.tainted=!0}}return t.tainted},i.prototype.drawImage=function(t,e,i,r,n,o,s,a,h){(!this.taints(t)||this.options.allowTaint)&&this.ctx.drawImage(t.image,e,i,r,n,o,s,a,h)},i.prototype.clip=function(t,e,i){this.ctx.save(),t.filter(r).forEach(function(t){this.shape(t).clip()},this),e.call(i),this.ctx.restore()},i.prototype.shape=function(t){return this.ctx.beginPath(),t.forEach(function(t,e){"rect"===t[0]?this.ctx.rect.apply(this.ctx,t.slice(1)):this.ctx[0===e?"moveTo":t[0]+"To"].apply(this.ctx,t.slice(1))},this),this.ctx.closePath(),this.ctx},i.prototype.font=function(t,e,i,r,n,o){this.setFillStyle(t).font=[e,i,r,n,o].join(" ").split(",")[0]},i.prototype.fontShadow=function(t,e,i,r){this.setVariable("shadowColor",t.toString()).setVariable("shadowOffsetY",e).setVariable("shadowOffsetX",i).setVariable("shadowBlur",r)},i.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},i.prototype.setOpacity=function(t){this.ctx.globalAlpha=t},i.prototype.setTransform=function(t){this.ctx.translate(t.origin[0],t.origin[1]),this.ctx.transform.apply(this.ctx,t.matrix),this.ctx.translate(-t.origin[0],-t.origin[1])},i.prototype.setVariable=function(t,e){return this.variables[t]!==e&&(this.variables[t]=this.ctx[t]=e),this},i.prototype.text=function(t,e,i){this.ctx.fillText(t,e,i)},i.prototype.backgroundRepeatShape=function(t,e,i,r,n,o,s,a,h){var l=[["line",Math.round(n),Math.round(o)],["line",Math.round(n+s),Math.round(o)],["line",Math.round(n+s),Math.round(a+o)],["line",Math.round(n),Math.round(a+o)]];this.clip([l],function(){this.renderBackgroundRepeat(t,e,i,r,h[3],h[0])},this)},i.prototype.renderBackgroundRepeat=function(t,e,i,r,n,o){var s=Math.round(r.left+e.left+n),a=Math.round(r.top+e.top+o);this.setFillStyle(this.ctx.createPattern(this.resizeImage(t,i),"repeat")),this.ctx.translate(s,a),this.ctx.fill(),this.ctx.translate(-s,-a)},i.prototype.renderBackgroundGradient=function(t,e){if(t instanceof o){var i=this.ctx.createLinearGradient(e.left+e.width*t.x0,e.top+e.height*t.y0,e.left+e.width*t.x1,e.top+e.height*t.y1);t.colorStops.forEach(function(t){i.addColorStop(t.stop,t.color.toString())}),this.rectangle(e.left,e.top,e.width,e.height,i)}},i.prototype.resizeImage=function(t,e){var i=t.image;if(i.width===e.width&&i.height===e.height)return i;var r,n=document.createElement("canvas");return n.width=e.width,n.height=e.height,r=n.getContext("2d"),r.drawImage(i,0,0,i.width,i.height,0,0,e.width,e.height),n},e.exports=i},{"../lineargradientcontainer":14,"../log":15,"../renderer":22}],24:[function(t,e){function i(t,e,i,n){r.call(this,i,n),this.ownStacking=t,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*e}var r=t("./nodecontainer");i.prototype=Object.create(r.prototype),i.prototype.getParentStack=function(t){var e=this.parent?this.parent.stack:null;return e?e.ownStacking?e:e.getParentStack(t):t.stack},e.exports=i},{"./nodecontainer":16}],25:[function(t,e){function i(t){this.rangeBounds=this.testRangeBounds(t),this.cors=this.testCORS(),this.svg=this.testSVG()}i.prototype.testRangeBounds=function(t){var e,i,r,n,o=!1;return t.createRange&&(e=t.createRange(),e.getBoundingClientRect&&(i=t.createElement("boundtest"),i.style.height="123px",i.style.display="block",t.body.appendChild(i),e.selectNode(i),r=e.getBoundingClientRect(),n=r.height,123===n&&(o=!0),t.body.removeChild(i))),o},i.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},i.prototype.testSVG=function(){var t=new Image,e=document.createElement("canvas"),i=e.getContext("2d");t.src="data:image/svg+xml,";try{i.drawImage(t,0,0),e.toDataURL()}catch(r){return!1}return!0},e.exports=i},{}],26:[function(t,e){function i(t){this.src=t,this.image=null;var e=this;this.promise=this.hasFabric().then(function(){return e.isInline(t)?r.resolve(e.inlineFormatting(t)):n(t)}).then(function(t){return new r(function(i){window.html2canvas.svg.fabric.loadSVGFromString(t,e.createCanvas.call(e,i))})})}var r=t("./promise"),n=t("./xhr"),o=t("./utils").decode64;i.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?r.resolve():r.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},i.prototype.inlineFormatting=function(t){return/^data:image\/svg\+xml;base64,/.test(t)?this.decode64(this.removeContentType(t)):this.removeContentType(t)},i.prototype.removeContentType=function(t){return t.replace(/^data:image\/svg\+xml(;base64)?,/,"")},i.prototype.isInline=function(t){return/^data:image\/svg\+xml/i.test(t)},i.prototype.createCanvas=function(t){var e=this;return function(i,r){var n=new window.html2canvas.svg.fabric.StaticCanvas("c");e.image=n.lowerCanvasEl,n.setWidth(r.width).setHeight(r.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(i,r)).renderAll(),t(n.lowerCanvasEl)}},i.prototype.decode64=function(t){return"function"==typeof window.atob?window.atob(t):o(t)},e.exports=i},{"./promise":18,"./utils":29,"./xhr":31}],27:[function(t,e){function i(t,e){this.src=t,this.image=null;var i=this;this.promise=e?new n(function(e,r){i.image=new Image,i.image.onload=e,i.image.onerror=r,i.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(t),i.image.complete===!0&&e(i.image)}):this.hasFabric().then(function(){return new n(function(e){window.html2canvas.svg.fabric.parseSVGDocument(t,i.createCanvas.call(i,e))})})}var r=t("./svgcontainer"),n=t("./promise");i.prototype=Object.create(r.prototype),e.exports=i},{"./promise":18,"./svgcontainer":26}],28:[function(t,e){function i(t,e){n.call(this,t,e)}function r(t,e,i){return t.length>0?e+i.toUpperCase():void 0}var n=t("./nodecontainer");i.prototype=Object.create(n.prototype),i.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},i.prototype.transform=function(t){var e=this.node.data;switch(t){case"lowercase":return e.toLowerCase();case"capitalize":return e.replace(/(^|\s|:|-|\(|\))([a-z])/g,r);case"uppercase":return e.toUpperCase();default:return e}},e.exports=i},{"./nodecontainer":16}],29:[function(t,e,i){i.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},i.bind=function(t,e){return function(){return t.apply(e,arguments)}},i.decode64=function(t){var e,i,r,n,o,s,a,h,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=t.length,c="";for(e=0;u>e;e+=4)i=l.indexOf(t[e]),r=l.indexOf(t[e+1]),n=l.indexOf(t[e+2]),o=l.indexOf(t[e+3]),s=i<<2|r>>4,a=(15&r)<<4|n>>2,h=(3&n)<<6|o,c+=64===n?String.fromCharCode(s):64===o||-1===o?String.fromCharCode(s,a):String.fromCharCode(s,a,h);return c},i.getBounds=function(t){if(t.getBoundingClientRect){var e=t.getBoundingClientRect(),i=null==t.offsetWidth?e.width:t.offsetWidth;return{top:e.top,bottom:e.bottom||e.top+e.height,right:e.left+i,left:e.left,width:i,height:null==t.offsetHeight?e.height:t.offsetHeight}}return{}},i.offsetBounds=function(t){var e=t.offsetParent?i.offsetBounds(t.offsetParent):{top:0,left:0};return{top:t.offsetTop+e.top,bottom:t.offsetTop+t.offsetHeight+e.top,right:t.offsetLeft+e.left+t.offsetWidth,left:t.offsetLeft+e.left,width:t.offsetWidth,height:t.offsetHeight}},i.parseBackgrounds=function(t){var e,i,r,n,o,s,a,h=" \r\n ",l=[],u=0,c=0,d=function(){e&&('"'===i.substr(0,1)&&(i=i.substr(1,i.length-2)),i&&a.push(i),"-"===e.substr(0,1)&&(n=e.indexOf("-",1)+1)>0&&(r=e.substr(0,n),e=e.substr(n)),l.push({prefix:r,method:e.toLowerCase(),value:o,args:a,image:null})),a=[],e=r=i=o=""};return a=[],e=r=i=o="",t.split("").forEach(function(t){if(!(0===u&&h.indexOf(t)>-1)){switch(t){case'"':s?s===t&&(s=null):s=t;break;case"(":if(s)break;if(0===u)return u=1,void(o+=t);c++;break;case")":if(s)break;if(1===u){if(0===c)return u=0,o+=t,void d();c--}break;case",":if(s)break;if(0===u)return void d();if(1===u&&0===c&&!e.match(/^url$/i))return a.push(i),i="",void(o+=t)}o+=t,0===u?e+=t:i+=t}}),d(),l}},{}],30:[function(t,e){function i(t){r.apply(this,arguments),this.type="linear"===t.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}var r=t("./gradientcontainer");i.prototype=Object.create(r.prototype),e.exports=i},{"./gradientcontainer":11}],31:[function(t,e){function i(t){return new r(function(e,i){var r=new XMLHttpRequest;r.open("GET",t),r.onload=function(){200===r.status?e(r.responseText):i(new Error(r.statusText))},r.onerror=function(){i(new Error("Network Error"))},r.send()})}var r=t("./promise");e.exports=i},{"./promise":18}]},{},[6])(6)}),function(t){function e(t){var e=t.length,r=i.type(t);return"function"===r||i.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===r||0===e||"number"==typeof e&&e>0&&e-1 in t}if(!t.jQuery){var i=function(t,e){return new i.fn.init(t,e)};i.isWindow=function(t){return null!=t&&t==t.window},i.type=function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?n[s.call(t)]||"object":typeof t},i.isArray=Array.isArray||function(t){return"array"===i.type(t)},i.isPlainObject=function(t){var e;if(!t||"object"!==i.type(t)||t.nodeType||i.isWindow(t))return!1;try{if(t.constructor&&!o.call(t,"constructor")&&!o.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}for(e in t);return void 0===e||o.call(t,e)},i.each=function(t,i,r){var n,o=0,s=t.length,a=e(t);if(r){if(a)for(;s>o&&(n=i.apply(t[o],r),n!==!1);o++);else for(o in t)if(n=i.apply(t[o],r),n===!1)break}else if(a)for(;s>o&&(n=i.call(t[o],o,t[o]),n!==!1);o++);else for(o in t)if(n=i.call(t[o],o,t[o]),n===!1)break;return t},i.data=function(t,e,n){if(void 0===n){var o=t[i.expando],s=o&&r[o];if(void 0===e)return s;if(s&&e in s)return s[e]}else if(void 0!==e){var o=t[i.expando]||(t[i.expando]=++i.uuid);return r[o]=r[o]||{},r[o][e]=n,n}},i.removeData=function(t,e){var n=t[i.expando],o=n&&r[n];o&&i.each(e,function(t,e){delete o[e]})},i.extend=function(){var t,e,r,n,o,s,a=arguments[0]||{},h=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[h]||{},h++),"object"!=typeof a&&"function"!==i.type(a)&&(a={}),h===l&&(a=this,h--);l>h;h++)if(null!=(o=arguments[h]))for(n in o)t=a[n],r=o[n],a!==r&&(u&&r&&(i.isPlainObject(r)||(e=i.isArray(r)))?(e?(e=!1,s=t&&i.isArray(t)?t:[]):s=t&&i.isPlainObject(t)?t:{},a[n]=i.extend(u,s,r)):void 0!==r&&(a[n]=r));return a},i.queue=function(t,r,n){function o(t,i){var r=i||[];return null!=t&&(e(Object(t))?!function(t,e){for(var i=+e.length,r=0,n=t.length;i>r;)t[n++]=e[r++];if(i!==i)for(;void 0!==e[r];)t[n++]=e[r++];return t.length=n,t}(r,"string"==typeof t?[t]:t):[].push.call(r,t)),r}if(t){r=(r||"fx")+"queue";var s=i.data(t,r);return n?(!s||i.isArray(n)?s=i.data(t,r,o(n)):s.push(n),s):s||[]}},i.dequeue=function(t,e){i.each(t.nodeType?[t]:t,function(t,r){e=e||"fx";var n=i.queue(r,e),o=n.shift();"inprogress"===o&&(o=n.shift()),o&&("fx"===e&&n.unshift("inprogress"),o.call(r,function(){i.dequeue(r,e)}))})},i.fn=i.prototype={init:function(t){if(t.nodeType)return this[0]=t,this;throw new Error("Not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:e.top+(t.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:e.left+(t.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function t(){for(var t=this.offsetParent||document;t&&"html"===!t.nodeType.toLowerCase&&"static"===t.style.position;)t=t.offsetParent;return t||document}var e=this[0],t=t.apply(e),r=this.offset(),n=/^(?:body|html)$/i.test(t.nodeName)?{top:0,left:0}:i(t).offset();return r.top-=parseFloat(e.style.marginTop)||0,r.left-=parseFloat(e.style.marginLeft)||0,t.style&&(n.top+=parseFloat(t.style.borderTopWidth)||0,n.left+=parseFloat(t.style.borderLeftWidth)||0),{top:r.top-n.top,left:r.left-n.left}}};var r={};i.expando="velocity"+(new Date).getTime(),i.uuid=0;for(var n={},o=n.hasOwnProperty,s=n.toString,a="Boolean Number String Function Array Date RegExp Object Error".split(" "),h=0;hn;++n){var o=l(i,t,r);if(0===o)return i;var s=h(i,t,r)-e;i-=s/o}return i}function c(){for(var e=0;x>e;++e)S[e]=h(e*b,t,r)}function d(e,i,n){var o,s,a=0;do s=i+(n-i)/2,o=h(s,t,r)-e,o>0?n=s:i=s;while(Math.abs(o)>v&&++a=m?u(e,a):0==h?a:d(e,i,i+b)}function f(){C=!0,(t!=i||r!=n)&&c()}var g=4,m=.001,v=1e-7,y=10,x=11,b=1/(x-1),w="Float32Array"in e;if(4!==arguments.length)return!1;for(var T=0;4>T;++T)if("number"!=typeof arguments[T]||isNaN(arguments[T])||!isFinite(arguments[T]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var S=w?new Float32Array(x):new Array(x),C=!1,E=function(e){return C||f(),t===i&&r===n?e:0===e?0:1===e?1:h(p(e),i,n)};E.getControlPoints=function(){return[{x:t,y:i},{x:r,y:n}]};var A="generateBezier("+[t,i,r,n]+")";return E.toString=function(){return A},E}function l(t,e){var i=t;return g.isString(t)?x.Easings[t]||(i=!1):i=g.isArray(t)&&1===t.length?a.apply(null,t):g.isArray(t)&&2===t.length?b.apply(null,t.concat([e])):g.isArray(t)&&4===t.length?h.apply(null,t):!1,i===!1&&(i=x.Easings[x.defaults.easing]?x.defaults.easing:y),i}function u(t){if(t){var e=(new Date).getTime(),i=x.State.calls.length;i>1e4&&(x.State.calls=n(x.State.calls));for(var o=0;i>o;o++)if(x.State.calls[o]){var a=x.State.calls[o],h=a[0],l=a[2],p=a[3],f=!!p,m=null;p||(p=x.State.calls[o][3]=e-16);for(var v=Math.min((e-p)/l.duration,1),y=0,b=h.length;b>y;y++){var T=h[y],C=T.element;if(s(C)){var E=!1;if(l.display!==r&&null!==l.display&&"none"!==l.display){if("flex"===l.display){var A=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];d.each(A,function(t,e){w.setPropertyValue(C,"display",e)})}w.setPropertyValue(C,"display",l.display)}l.visibility!==r&&"hidden"!==l.visibility&&w.setPropertyValue(C,"visibility",l.visibility);for(var _ in T)if("element"!==_){var M,L=T[_],R=g.isString(L.easing)?x.Easings[L.easing]:L.easing;if(1===v)M=L.endValue;else{var P=L.endValue-L.startValue;if(M=L.startValue+P*R(v,l,P),!f&&M===L.currentValue)continue}if(L.currentValue=M,"tween"===_)m=M;else{if(w.Hooks.registered[_]){var F=w.Hooks.getRoot(_),B=s(C).rootPropertyValueCache[F];B&&(L.rootPropertyValue=B)}var I=w.setPropertyValue(C,_,L.currentValue+(0===parseFloat(M)?"":L.unitType),L.rootPropertyValue,L.scrollData);w.Hooks.registered[_]&&(s(C).rootPropertyValueCache[F]=w.Normalizations.registered[F]?w.Normalizations.registered[F]("extract",null,I[1]):I[1]),"transform"===I[0]&&(E=!0)}}l.mobileHA&&s(C).transformCache.translate3d===r&&(s(C).transformCache.translate3d="(0px, 0px, 0px)",E=!0),E&&w.flushTransformCache(C)}}l.display!==r&&"none"!==l.display&&(x.State.calls[o][2].display=!1),l.visibility!==r&&"hidden"!==l.visibility&&(x.State.calls[o][2].visibility=!1),l.progress&&l.progress.call(a[1],a[1],v,Math.max(0,p+l.duration-e),p,m),1===v&&c(o)}}x.State.isTicking&&S(u)}function c(t,e){if(!x.State.calls[t])return!1;for(var i=x.State.calls[t][0],n=x.State.calls[t][1],o=x.State.calls[t][2],a=x.State.calls[t][4],h=!1,l=0,u=i.length;u>l;l++){var c=i[l].element;if(e||o.loop||("none"===o.display&&w.setPropertyValue(c,"display",o.display),"hidden"===o.visibility&&w.setPropertyValue(c,"visibility",o.visibility)),o.loop!==!0&&(d.queue(c)[1]===r||!/\.velocityQueueEntryFlag/i.test(d.queue(c)[1]))&&s(c)){s(c).isAnimating=!1,s(c).rootPropertyValueCache={};var p=!1;d.each(w.Lists.transforms3D,function(t,e){var i=/^scale/.test(e)?1:0,n=s(c).transformCache[e];s(c).transformCache[e]!==r&&new RegExp("^\\("+i+"[^.]").test(n)&&(p=!0,delete s(c).transformCache[e])}),o.mobileHA&&(p=!0,delete s(c).transformCache.translate3d),p&&w.flushTransformCache(c),w.Values.removeClass(c,"velocity-animating")}if(!e&&o.complete&&!o.loop&&l===u-1)try{o.complete.call(n,n)}catch(f){setTimeout(function(){throw f},1)}a&&o.loop!==!0&&a(n),s(c)&&o.loop===!0&&!e&&(d.each(s(c).tweensContainer,function(t,e){/^rotate/.test(t)&&360===parseFloat(e.endValue)&&(e.endValue=0,e.startValue=360),/^backgroundPosition/.test(t)&&100===parseFloat(e.endValue)&&"%"===e.unitType&&(e.endValue=0,e.startValue=100)}),x(c,"reverse",{loop:!0,delay:o.delay})),o.queue!==!1&&d.dequeue(c,o.queue)}x.State.calls[t]=!1;for(var g=0,m=x.State.calls.length;m>g;g++)if(x.State.calls[g]!==!1){h=!0;break}h===!1&&(x.State.isTicking=!1,delete x.State.calls,x.State.calls=[])}var d,p=function(){if(i.documentMode)return i.documentMode;for(var t=7;t>4;t--){var e=i.createElement("div");if(e.innerHTML="",e.getElementsByTagName("span").length)return e=null,t}return r}(),f=function(){var t=0;return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(e){var i,r=(new Date).getTime();return i=Math.max(0,16-(r-t)),t=r+i,setTimeout(function(){e(r+i)},i)}}(),g={isString:function(t){return"string"==typeof t},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)},isNode:function(t){return t&&t.nodeType},isNodeList:function(t){return"object"==typeof t&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&t.length!==r&&(0===t.length||"object"==typeof t[0]&&t[0].nodeType>0)},isWrapped:function(t){return t&&(t.jquery||e.Zepto&&e.Zepto.zepto.isZ(t))},isSVG:function(t){return e.SVGElement&&t instanceof e.SVGElement},isEmptyObject:function(t){for(var e in t)return!1;return!0}},m=!1;if(t.fn&&t.fn.jquery?(d=t,m=!0):d=e.Velocity.Utilities,8>=p&&!m)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(7>=p)return void(jQuery.fn.velocity=jQuery.fn.animate);var v=400,y="swing",x={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:e.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:d,Redirects:{},Easings:{},Promise:e.Promise,defaults:{queue:"",duration:v,easing:y,begin:r,complete:r,progress:r,display:r,visibility:r,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(t){d.data(t,"velocity",{isSVG:g.isSVG(t),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};e.pageYOffset!==r?(x.State.scrollAnchor=e,x.State.scrollPropertyLeft="pageXOffset",x.State.scrollPropertyTop="pageYOffset"):(x.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,x.State.scrollPropertyLeft="scrollLeft",x.State.scrollPropertyTop="scrollTop");var b=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,i,r){var n={x:e.x+r.dx*i,v:e.v+r.dv*i,tension:e.tension,friction:e.friction};return{dx:n.v,dv:t(n)}}function i(i,r){var n={dx:i.v,dv:t(i)},o=e(i,.5*r,n),s=e(i,.5*r,o),a=e(i,r,s),h=1/6*(n.dx+2*(o.dx+s.dx)+a.dx),l=1/6*(n.dv+2*(o.dv+s.dv)+a.dv);return i.x=i.x+h*r,i.v=i.v+l*r,i}return function r(t,e,n){var o,s,a,h={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1e-4,d=.016;for(t=parseFloat(t)||500,e=parseFloat(e)||20,n=n||null,h.tension=t,h.friction=e,o=null!==n,o?(u=r(t,e),s=u/n*d):s=d;;)if(a=i(a||h,s),l.push(1+a.x),u+=16,!(Math.abs(a.x)>c&&Math.abs(a.v)>c))break;return o?function(t){return l[t*(l.length-1)|0]}:u}}();x.Easings={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},spring:function(t){return 1-Math.cos(4.5*t*Math.PI)*Math.exp(6*-t)}},d.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(t,e){x.Easings[e[0]]=h.apply(null,e[1])});var w=x.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var t=0;t=p)switch(t){case"name":return"filter";case"extract":var r=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=r?r[1]/100:1;case"inject":return e.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(t){case"name":return"opacity";case"extract":return i;case"inject":return i}}},register:function(){9>=p||x.State.isGingerbread||(w.Lists.transformsBase=w.Lists.transformsBase.concat(w.Lists.transforms3D));for(var t=0;tn&&(n=1),o=!/(\d)$/i.test(n);break;case"skew":o=!/(deg|\d)$/i.test(n);break;case"rotate":o=!/(deg|\d)$/i.test(n)}return o||(s(i).transformCache[e]="("+n+")"),s(i).transformCache[e]}}}();for(var t=0;t=p||3!==o.split(" ").length||(o+=" 1"),o;case"inject":return 8>=p?4===n.split(" ").length&&(n=n.split(/\s+/).slice(0,3).join(" ")):3===n.split(" ").length&&(n+=" 1"),(8>=p?"rgb":"rgba")+"("+n.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},SVGAttribute:function(t){var e="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(p||x.State.isAndroid&&!x.State.isChrome)&&(e+="|transform"),new RegExp("^("+e+")$","i").test(t)},prefixCheck:function(t){if(x.State.prefixMatches[t])return[x.State.prefixMatches[t],!0];for(var e=["","Webkit","Moz","ms","O"],i=0,r=e.length;r>i;i++){var n;if(n=0===i?t:e[i]+t.replace(/^\w/,function(t){return t.toUpperCase()}),g.isString(x.State.prefixElement.style[n]))return x.State.prefixMatches[t]=n,[n,!0]}return[t,!1]}},Values:{hexToRgb:function(t){var e,i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return t=t.replace(i,function(t,e,i,r){return e+e+i+i+r+r}),e=r.exec(t),e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]},isCSSNullValue:function(t){return 0==t||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(t)},getUnitType:function(t){return/^(rotate|skew)/i.test(t)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(t)?"":"px"},getDisplayType:function(t){var e=t&&t.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(e)?"inline":/^(li)$/i.test(e)?"list-item":/^(tr)$/i.test(e)?"table-row":/^(table)$/i.test(e)?"table":/^(tbody)$/i.test(e)?"table-row-group":"block"},addClass:function(t,e){t.classList?t.classList.add(e):t.className+=(t.className.length?" ":"")+e},removeClass:function(t,e){t.classList?t.classList.remove(e):t.className=t.className.toString().replace(new RegExp("(^|\\s)"+e.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(t,i,n,o){function a(t,i){function n(){l&&w.setPropertyValue(t,"display","none")}var h=0;if(8>=p)h=d.css(t,i);else{var l=!1;if(/^(width|height)$/.test(i)&&0===w.getPropertyValue(t,"display")&&(l=!0,w.setPropertyValue(t,"display",w.Values.getDisplayType(t))),!o){if("height"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var u=t.offsetHeight-(parseFloat(w.getPropertyValue(t,"borderTopWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderBottomWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingTop"))||0)-(parseFloat(w.getPropertyValue(t,"paddingBottom"))||0);return n(),u}if("width"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var c=t.offsetWidth-(parseFloat(w.getPropertyValue(t,"borderLeftWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderRightWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingLeft"))||0)-(parseFloat(w.getPropertyValue(t,"paddingRight"))||0);return n(),c}}var f;f=s(t)===r?e.getComputedStyle(t,null):s(t).computedStyle?s(t).computedStyle:s(t).computedStyle=e.getComputedStyle(t,null),"borderColor"===i&&(i="borderTopColor"),h=9===p&&"filter"===i?f.getPropertyValue(i):f[i],(""===h||null===h)&&(h=t.style[i]),n()}if("auto"===h&&/^(top|right|bottom|left)$/i.test(i)){var g=a(t,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(i))&&(h=d(t).position()[i]+"px")}return h}var h;if(w.Hooks.registered[i]){var l=i,u=w.Hooks.getRoot(l);n===r&&(n=w.getPropertyValue(t,w.Names.prefixCheck(u)[0])),w.Normalizations.registered[u]&&(n=w.Normalizations.registered[u]("extract",t,n)),h=w.Hooks.extractValue(l,n)}else if(w.Normalizations.registered[i]){var c,f;c=w.Normalizations.registered[i]("name",t),"transform"!==c&&(f=a(t,w.Names.prefixCheck(c)[0]),w.Values.isCSSNullValue(f)&&w.Hooks.templates[i]&&(f=w.Hooks.templates[i][1])),h=w.Normalizations.registered[i]("extract",t,f)}if(!/^[\d-]/.test(h))if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))if(/^(height|width)$/i.test(i))try{h=t.getBBox()[i]}catch(g){h=0}else h=t.getAttribute(i);else h=a(t,w.Names.prefixCheck(i)[0]);return w.Values.isCSSNullValue(h)&&(h=0),x.debug>=2&&console.log("Get "+i+": "+h),h},setPropertyValue:function(t,i,r,n,o){var a=i;if("scroll"===i)o.container?o.container["scroll"+o.direction]=r:"Left"===o.direction?e.scrollTo(r,o.alternateValue):e.scrollTo(o.alternateValue,r);else if(w.Normalizations.registered[i]&&"transform"===w.Normalizations.registered[i]("name",t))w.Normalizations.registered[i]("inject",t,r),a="transform",r=s(t).transformCache[i];else{if(w.Hooks.registered[i]){var h=i,l=w.Hooks.getRoot(i);n=n||w.getPropertyValue(t,l),r=w.Hooks.injectValue(h,r,n),i=l}if(w.Normalizations.registered[i]&&(r=w.Normalizations.registered[i]("inject",t,r),i=w.Normalizations.registered[i]("name",t)),a=w.Names.prefixCheck(i)[0],8>=p)try{t.style[a]=r}catch(u){x.debug&&console.log("Browser does not support ["+r+"] for ["+a+"]")}else if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))t.setAttribute(i,r);else{var c="webgl"===t.renderer?t.styleGL:t.style;c[a]=r}x.debug>=2&&console.log("Set "+i+" ("+a+"): "+r)}return[a,r]},flushTransformCache:function(t){function e(e){return parseFloat(w.getPropertyValue(t,e))}var i="";if((p||x.State.isAndroid&&!x.State.isChrome)&&s(t).isSVG){var r={translate:[e("translateX"),e("translateY")],skewX:[e("skewX")],skewY:[e("skewY")],scale:1!==e("scale")?[e("scale"),e("scale")]:[e("scaleX"),e("scaleY")],rotate:[e("rotateZ"),0,0]};d.each(s(t).transformCache,function(t){/^translate/i.test(t)?t="translate":/^scale/i.test(t)?t="scale":/^rotate/i.test(t)&&(t="rotate"),r[t]&&(i+=t+"("+r[t].join(" ")+") ",delete r[t]) +})}else{var n,o;d.each(s(t).transformCache,function(e){return n=s(t).transformCache[e],"transformPerspective"===e?(o=n,!0):(9===p&&"rotateZ"===e&&(e="rotate"),void(i+=e+n+" "))}),o&&(i="perspective"+o+" "+i)}w.setPropertyValue(t,"transform",i)}};w.Hooks.register(),w.Normalizations.register(),x.hook=function(t,e,i){var n=r;return t=o(t),d.each(t,function(t,o){if(s(o)===r&&x.init(o),i===r)n===r&&(n=x.CSS.getPropertyValue(o,e));else{var a=x.CSS.setPropertyValue(o,e,i);"transform"===a[0]&&x.CSS.flushTransformCache(o),n=a}}),n};var T=function(){function t(){return a?_.promise||null:h}function n(){function t(){function t(t,e){var i=r,n=r,s=r;return g.isArray(t)?(i=t[0],!g.isArray(t[1])&&/^[\d-]/.test(t[1])||g.isFunction(t[1])||w.RegEx.isHex.test(t[1])?s=t[1]:(g.isString(t[1])&&!w.RegEx.isHex.test(t[1])||g.isArray(t[1]))&&(n=e?t[1]:l(t[1],a.duration),t[2]!==r&&(s=t[2]))):i=t,e||(n=n||a.easing),g.isFunction(i)&&(i=i.call(o,C,S)),g.isFunction(s)&&(s=s.call(o,C,S)),[i||0,n,s]}function c(t,e){var i,r;return r=(e||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(t){return i=t,""}),i||(i=w.Values.getUnitType(t)),[r,i]}function p(){var t={myParent:o.parentNode||i.body,position:w.getPropertyValue(o,"position"),fontSize:w.getPropertyValue(o,"fontSize")},r=t.position===I.lastPosition&&t.myParent===I.lastParent,n=t.fontSize===I.lastFontSize;I.lastParent=t.myParent,I.lastPosition=t.position,I.lastFontSize=t.fontSize;var a=100,h={};if(n&&r)h.emToPx=I.lastEmToPx,h.percentToPxWidth=I.lastPercentToPxWidth,h.percentToPxHeight=I.lastPercentToPxHeight;else{var l=s(o).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");x.init(l),t.myParent.appendChild(l),d.each(["overflow","overflowX","overflowY"],function(t,e){x.CSS.setPropertyValue(l,e,"hidden")}),x.CSS.setPropertyValue(l,"position",t.position),x.CSS.setPropertyValue(l,"fontSize",t.fontSize),x.CSS.setPropertyValue(l,"boxSizing","content-box"),d.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(t,e){x.CSS.setPropertyValue(l,e,a+"%")}),x.CSS.setPropertyValue(l,"paddingLeft",a+"em"),h.percentToPxWidth=I.lastPercentToPxWidth=(parseFloat(w.getPropertyValue(l,"width",null,!0))||1)/a,h.percentToPxHeight=I.lastPercentToPxHeight=(parseFloat(w.getPropertyValue(l,"height",null,!0))||1)/a,h.emToPx=I.lastEmToPx=(parseFloat(w.getPropertyValue(l,"paddingLeft"))||1)/a,t.myParent.removeChild(l)}return null===I.remToPx&&(I.remToPx=parseFloat(w.getPropertyValue(i.body,"fontSize"))||16),null===I.vwToPx&&(I.vwToPx=parseFloat(e.innerWidth)/100,I.vhToPx=parseFloat(e.innerHeight)/100),h.remToPx=I.remToPx,h.vwToPx=I.vwToPx,h.vhToPx=I.vhToPx,x.debug>=1&&console.log("Unit ratios: "+JSON.stringify(h),o),h}if(a.begin&&0===C)try{a.begin.call(f,f)}catch(v){setTimeout(function(){throw v},1)}if("scroll"===M){var b,T,E,A=/^x$/i.test(a.axis)?"Left":"Top",L=parseFloat(a.offset)||0;a.container?g.isWrapped(a.container)||g.isNode(a.container)?(a.container=a.container[0]||a.container,b=a.container["scroll"+A],E=b+d(o).position()[A.toLowerCase()]+L):a.container=null:(b=x.State.scrollAnchor[x.State["scrollProperty"+A]],T=x.State.scrollAnchor[x.State["scrollProperty"+("Left"===A?"Top":"Left")]],E=d(o).offset()[A.toLowerCase()]+L),h={scroll:{rootPropertyValue:!1,startValue:b,currentValue:b,endValue:E,unitType:"",easing:a.easing,scrollData:{container:a.container,direction:A,alternateValue:T}},element:o},x.debug&&console.log("tweensContainer (scroll): ",h.scroll,o)}else if("reverse"===M){if(!s(o).tweensContainer)return void d.dequeue(o,a.queue);"none"===s(o).opts.display&&(s(o).opts.display="auto"),"hidden"===s(o).opts.visibility&&(s(o).opts.visibility="visible"),s(o).opts.loop=!1,s(o).opts.begin=null,s(o).opts.complete=null,y.easing||delete a.easing,y.duration||delete a.duration,a=d.extend({},s(o).opts,a);var R=d.extend(!0,{},s(o).tweensContainer);for(var P in R)if("element"!==P){var F=R[P].startValue;R[P].startValue=R[P].currentValue=R[P].endValue,R[P].endValue=F,g.isEmptyObject(y)||(R[P].easing=a.easing),x.debug&&console.log("reverse tweensContainer ("+P+"): "+JSON.stringify(R[P]),o)}h=R}else if("start"===M){var R;s(o).tweensContainer&&s(o).isAnimating===!0&&(R=s(o).tweensContainer),d.each(m,function(e,i){if(RegExp("^"+w.Lists.colors.join("$|^")+"$").test(e)){var n=t(i,!0),o=n[0],s=n[1],a=n[2];if(w.RegEx.isHex.test(o)){for(var h=["Red","Green","Blue"],l=w.Values.hexToRgb(o),u=a?w.Values.hexToRgb(a):r,c=0;ck;k++){var G={delay:R.delay,progress:R.progress};k===D-1&&(G.display=R.display,G.visibility=R.visibility,G.complete=R.complete),T(f,"reverse",G)}return t()}};x=d.extend(T,x),x.animate=T;var S=e.requestAnimationFrame||f;return x.State.isMobile||i.hidden===r||i.addEventListener("visibilitychange",function(){i.hidden?(S=function(t){return setTimeout(function(){t(!0)},16)},u()):S=e.requestAnimationFrame||f}),t.Velocity=x,t!==e&&(t.fn.velocity=T,t.fn.velocity.defaults=x.defaults),d.each(["Down","Up"],function(t,e){x.Redirects["slide"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l=h.begin,u=h.complete,c={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},p={};h.display===r&&(h.display="Down"===e?"inline"===x.CSS.Values.getDisplayType(t)?"inline-block":"block":"none"),h.begin=function(){var i="webgl"===t.renderer?t.styleGL:t.style;l&&l.call(s,s);for(var r in c){p[r]=i[r];var n=x.CSS.getPropertyValue(t,r);c[r]="Down"===e?[n,0]:[0,n]}p.overflow=i.overflow,i.overflow="hidden"},h.complete=function(){for(var t in p)style[t]=p[t];u&&u.call(s,s),a&&a.resolver(s)},x(t,c,h)}}),d.each(["In","Out"],function(t,e){x.Redirects["fade"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l={opacity:"In"===e?1:0},u=h.complete;h.complete=n!==o-1?h.begin=null:function(){u&&u.call(s,s),a&&a.resolver(s)},h.display===r&&(h.display="In"===e?"auto":"none"),x(this,l,h)}}),x}(window.jQuery||window.Zepto||window,window,document)}),function(t){t.HTMLGL=t.HTMLGL||{},t.HTMLGL.util={getterSetter:function(t,e,i,r){Object.defineProperty?Object.defineProperty(t,e,{get:i,set:r}):document.__defineGetter__&&(t.__defineGetter__(e,i),t.__defineSetter__(e,r)),t["get"+e]=i,t["set"+e]=r},emitEvent:function(t,e){var i=new MouseEvent(e.type,e);i.dispatcher="html-gl",e.stopPropagation(),t.dispatchEvent(i)}}}(window),function(t){var e=function(){},i=e.prototype;i.getElementByCoordinates=function(e,i){var r,n,o=this;return t.HTMLGL.elements.forEach(function(t){r=document.elementFromPoint(e-parseInt(t.transformObject.translateX||0),i-parseInt(t.transformObject.translateY||0)),o.isChildOf(r,t)&&(n=r)}),n},i.isChildOf=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},t.HTMLGL.GLElementResolver=e}(window),function(t){HTMLGL=t.HTMLGL=t.HTMLGL||{},HTMLGL.JQ_PLUGIN_NAME="htmlgl",HTMLGL.CUSTOM_ELEMENT_TAG_NAME="html-gl",HTMLGL.context=void 0,HTMLGL.stage=void 0,HTMLGL.renderer=void 0,HTMLGL.elements=[],HTMLGL.scrollX=0,HTMLGL.scrollY=0;var e=function(){t.HTMLGL.context=this,this.createStage(),this.updateScrollPosition(),this.initListeners(),this.elementResolver=new t.HTMLGL.GLElementResolver(this),document.body?this.initViewer():document.addEventListener("DOMContentLoaded",this.initViewer.bind(this))},i=e.prototype;i.initViewer=function(){this.createViewer(),this.resizeViewer(),this.appendViewer()},i.initListeners=function(){t.addEventListener("scroll",this.updateScrollPosition.bind(this)),t.addEventListener("resize",this.resizeViewer.bind(this)),document.addEventListener("click",this.onMouseEvent.bind(this),!0),document.addEventListener("mousemove",this.onMouseEvent.bind(this),!0),document.addEventListener("mouseup",this.onMouseEvent.bind(this),!0),document.addEventListener("mousedown",this.onMouseEvent.bind(this),!0),document.addEventListener("touchstart",this.onMouseEvent.bind(this)),document.addEventListener("touchend",this.onMouseEvent.bind(this))},i.updateScrollPosition=function(){var e={};if(void 0!=window.pageYOffset)e={left:pageXOffset,top:pageYOffset};else{var i,r,n=document,o=n.documentElement,s=n.body;i=o.scrollLeft||s.scrollLeft||0,r=o.scrollTop||s.scrollTop||0,e={left:i,top:r}}this.document.x=-e.left,this.document.y=-e.top,t.HTMLGL.scrollX=e.left,t.HTMLGL.scrollY=e.top,this.markStageAsChanged()},i.createViewer=function(){t.HTMLGL.renderer=this.renderer=PIXI.autoDetectRenderer(0,0,{transparent:!0}),this.renderer.view.style.position="fixed",this.renderer.view.style.top="0px",this.renderer.view.style.left="0px",this.renderer.view.style["pointer-events"]="none",this.renderer.view.style.pointerEvents="none"},i.appendViewer=function(){document.body.appendChild(this.renderer.view),requestAnimFrame(this.redrawStage.bind(this))},i.resizeViewer=function(){var e=t.innerWidth,i=t.innerHeight;this.renderer.resize(e,i),this.updateTextures(),this.markStageAsChanged()},i.createStage=function(){t.HTMLGL.stage=this.stage=new PIXI.Stage(16777215),t.HTMLGL.document=this.document=new PIXI.DisplayObjectContainer,this.stage.addChild(t.HTMLGL.document)},i.redrawStage=function(){t.HTMLGL.stage.changed&&(t.HTMLGL.renderer.render(t.HTMLGL.stage),t.HTMLGL.stage.changed=!1)},i.updateTextures=function(){t.HTMLGL.elements.forEach(function(t){t.updateTexture()})},i.onMouseEvent=function(e){var i=e.x||e.pageX,r=e.y||e.pageY,n="html-gl"!==e.dispatcher?this.elementResolver.getElementByCoordinates(i,r):null;n?t.HTMLGL.util.emitEvent(n,e):null},i.markStageAsChanged=function(){t.HTMLGL.stage&&!t.HTMLGL.stage.changed&&(requestAnimFrame(this.redrawStage),t.HTMLGL.stage.changed=!0)},t.HTMLGL.GLContext=e,new e}(window),function(t){var e=function(t,e){this.element=t,this.images=this.element.querySelectorAll("img"),this.callback=e,this.imagesLoaded=this.getImagesLoaded(),this.images.length===this.imagesLoaded?this.onImageLoaded():this.addListeners()},i=e.prototype;i.getImagesLoaded=function(){for(var t=0,e=0;et;t++)i.call(this,this._deferreds[t]);this._deferreds=null}function s(t,e,i,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=i,this.reject=r}function a(t,e,i){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,i(t))})}catch(n){if(r)return;r=!0,i(n)}}var h;h="object"==typeof window&&window?window:global;var l=e.immediateFn||h.setImmediate||function(t){setTimeout(t,1)},u=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.prototype["catch"]=function(t){return this.then(null,t)},e.prototype.then=function(t,r){var n=this;return new e(function(e,o){i.call(n,new s(t,r,e,o))})},e.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&u(arguments[0])?arguments[0]:arguments);return new e(function(e,i){function r(o,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){r(o,t)},i)}t[o]=s,0===--n&&e(t)}catch(h){i(h)}}if(0===t.length)return e([]);for(var n=t.length,o=0;or;r++)t[r].then(e,i)})},"undefined"!=typeof module&&module.exports?module.exports=e:h.Promise||(h.Promise=e)}(),"undefined"==typeof WeakMap&&!function(){var t=Object.defineProperty,e=Date.now()%1e9,i=function(){this.name="__st"+(1e9*Math.random()>>>0)+(e++ +"__")};i.prototype={set:function(e,i){var r=e[this.name];return r&&r[0]===e?r[1]=i:t(e,this.name,{value:[e,i],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},"delete":function(t){var e=t[this.name];return e&&e[0]===t?(e[0]=e[1]=void 0,!0):!1},has:function(t){var e=t[this.name];return e?e[0]===t:!1}},window.WeakMap=i}(),window.CustomElements=window.CustomElements||{flags:{}},function(t){var e=t.flags,i=[],r=function(t){i.push(t)},n=function(){i.forEach(function(e){e(t)})};t.addModule=r,t.initializeModules=n,t.hasNative=Boolean(document.registerElement),t.useNative=!e.register&&t.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(t){function e(t,e){i(t,function(t){return e(t)?!0:void r(t,e)}),r(t,e)}function i(t,e,r){var n=t.firstElementChild;if(!n)for(n=t.firstChild;n&&n.nodeType!==Node.ELEMENT_NODE;)n=n.nextSibling;for(;n;)e(n,r)!==!0&&i(n,e,r),n=n.nextElementSibling;return null}function r(t,i){for(var r=t.shadowRoot;r;)e(r,i),r=r.olderShadowRoot}function n(t,e){s=[],o(t,e),s=null}function o(t,e){if(t=wrap(t),!(s.indexOf(t)>=0)){s.push(t);for(var i,r=t.querySelectorAll("link[rel="+a+"]"),n=0,h=r.length;h>n&&(i=r[n]);n++)i["import"]&&o(i["import"],e);e(t)}}var s,a=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=n,t.forSubtree=e}),CustomElements.addModule(function(t){function e(t){return i(t)||r(t)}function i(e){return t.upgrade(e)?!0:void a(e)}function r(t){b(t,function(t){return i(t)?!0:void 0})}function n(t){a(t),d(t)&&b(t,function(t){a(t)})}function o(t){C.push(t),S||(S=!0,setTimeout(s))}function s(){S=!1;for(var t,e=C,i=0,r=e.length;r>i&&(t=e[i]);i++)t();C=[]}function a(t){T?o(function(){h(t)}):h(t)}function h(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&!t.__attached&&d(t)&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function l(t){u(t),b(t,function(t){u(t)})}function u(t){T?o(function(){c(t)}):c(t)}function c(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&t.__attached&&!d(t)&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function d(t){for(var e=t,i=wrap(document);e;){if(e==i)return!0;e=e.parentNode||e.host}}function p(t){if(t.shadowRoot&&!t.shadowRoot.__watched){x.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)m(e),e=e.olderShadowRoot}}function f(t){if(x.dom){var i=t[0];if(i&&"childList"===i.type&&i.addedNodes&&i.addedNodes){for(var r=i.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var n=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";n=n.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",t.length,n||"")}t.forEach(function(t){"childList"===t.type&&(E(t.addedNodes,function(t){t.localName&&e(t)}),E(t.removedNodes,function(t){t.localName&&l(t)}))}),x.dom&&console.groupEnd()}function g(t){for(t=wrap(t),t||(t=wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(f(e.takeRecords()),s())}function m(t){if(!t.__observer){var e=new MutationObserver(f);e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function v(t){t=wrap(t),x.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),e(t),m(t),x.dom&&console.groupEnd()}function y(t){w(t,v)}var x=t.flags,b=t.forSubtree,w=t.forDocumentTree,T=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;t.hasPolyfillMutations=T;var S=!1,C=[],E=Array.prototype.forEach.call.bind(Array.prototype.forEach),A=Element.prototype.createShadowRoot;A&&(Element.prototype.createShadowRoot=function(){var t=A.call(this);return CustomElements.watchShadow(this),t}),t.watchShadow=p,t.upgradeDocumentTree=y,t.upgradeSubtree=r,t.upgradeAll=e,t.attachedNode=n,t.takeRecords=g}),CustomElements.addModule(function(t){function e(e){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var r=e.getAttribute("is"),n=t.getRegisteredDefinition(r||e.localName);if(n){if(r&&n.tag==e.localName)return i(e,n);if(!r&&!n["extends"])return i(e,n)}}}function i(e,i){return s.upgrade&&console.group("upgrade:",e.localName),i.is&&e.setAttribute("is",i.is),r(e,i),e.__upgraded__=!0,o(e),t.attachedNode(e),t.upgradeSubtree(e),s.upgrade&&console.groupEnd(),e}function r(t,e){Object.__proto__?t.__proto__=e.prototype:(n(t,e.prototype,e["native"]),t.__proto__=e.prototype)}function n(t,e,i){for(var r={},n=e;n!==i&&n!==HTMLElement.prototype;){for(var o,s=Object.getOwnPropertyNames(n),a=0;o=s[a];a++)r[o]||(Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o)),r[o]=1);n=Object.getPrototypeOf(n)}}function o(t){t.createdCallback&&t.createdCallback()}var s=t.flags;t.upgrade=e,t.upgradeWithDefinition=i,t.implementPrototype=r}),CustomElements.addModule(function(t){function e(e,r){var h=r||{};if(!e)throw new Error("document.registerElement: first argument `name` must not be empty");if(e.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(e)+"'.");if(n(e))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(e)+"'. The type name is invalid.");if(l(e))throw new Error("DuplicateDefinitionError: a type with name '"+String(e)+"' is already registered");return h.prototype||(h.prototype=Object.create(HTMLElement.prototype)),h.__name=e.toLowerCase(),h.lifecycle=h.lifecycle||{},h.ancestry=o(h["extends"]),s(h),a(h),i(h.prototype),u(h.__name,h),h.ctor=c(h),h.ctor.prototype=h.prototype,h.prototype.constructor=h.ctor,t.ready&&m(document),h.ctor}function i(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,i){r.call(this,t,i,e)};var i=t.removeAttribute;t.removeAttribute=function(t){r.call(this,t,null,i)},t.setAttribute._polyfilled=!0}}function r(t,e,i){t=t.toLowerCase();var r=this.getAttribute(t);i.apply(this,arguments);var n=this.getAttribute(t);this.attributeChangedCallback&&n!==r&&this.attributeChangedCallback(t,r,n)}function n(t){for(var e=0;e=0&&x(r,HTMLElement),r)}function f(t){var e=A.call(this,t);return v(e),e}var g,m=t.upgradeDocumentTree,v=t.upgrade,y=t.upgradeWithDefinition,x=t.implementPrototype,b=t.useNative,w=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],T={},S="http://www.w3.org/1999/xhtml",C=document.createElement.bind(document),E=document.createElementNS.bind(document),A=Node.prototype.cloneNode;g=Object.__proto__||b?function(t,e){return t instanceof e}:function(t,e){for(var i=t;i;){if(i===e.prototype)return!0;i=i.__proto__}return!1},document.registerElement=e,document.createElement=p,document.createElementNS=d,Node.prototype.cloneNode=f,t.registry=T,t["instanceof"]=g,t.reservedTagList=w,t.getRegisteredDefinition=l,document.register=document.registerElement}),function(t){function e(){s(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(t){s(wrap(t["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var i=t.useNative,r=t.initializeModules,n=/Trident/.test(navigator.userAgent);if(i){var o=function(){};t.watchShadow=o,t.upgrade=o,t.upgradeAll=o,t.upgradeDocumentTree=o,t.upgradeSubtree=o,t.takeRecords=o,t["instanceof"]=function(t,e){return t instanceof e}}else r();var s=t.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),n&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(t,e){e=e||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),i},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||t.flags.eager)e();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(a,e)}else e()}(window.CustomElements),function(){var t=this,e=e||{};e.WEBGL_RENDERER=0,e.CANVAS_RENDERER=1,e.VERSION="v2.2.7",e.blendModes={NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},e.scaleModes={DEFAULT:0,LINEAR:0,NEAREST:1},e._UID=0,"undefined"!=typeof Float32Array?(e.Float32Array=Float32Array,e.Uint16Array=Uint16Array,e.Uint32Array=Uint32Array,e.ArrayBuffer=ArrayBuffer):(e.Float32Array=Array,e.Uint16Array=Array),e.INTERACTION_FREQUENCY=30,e.AUTO_PREVENT_DEFAULT=!0,e.PI_2=2*Math.PI,e.RAD_TO_DEG=180/Math.PI,e.DEG_TO_RAD=Math.PI/180,e.RETINA_PREFIX="@2x",e.dontSayHello=!1,e.defaultRenderOptions={view:null,transparent:!1,antialias:!1,preserveDrawingBuffer:!1,resolution:1,clearBeforeRender:!0,autoResize:!1},e.sayHello=function(t){if(!e.dontSayHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var i=["%c %c %c Pixi.js "+e.VERSION+" - "+t+" %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ ","background: #ff66a5","background: #ff66a5","color: #ff66a5; background: #030307;","background: #ff66a5","background: #ffc3dc","background: #ff66a5","color: #ff2424; background: #fff","color: #ff2424; background: #fff","color: #ff2424; background: #fff"];console.log.apply(console,i)}else window.console&&console.log("Pixi.js "+e.VERSION+" - http://www.pixijs.com/");e.dontSayHello=!0}},e.Point=function(t,e){this.x=t||0,this.y=e||0},e.Point.prototype.clone=function(){return new e.Point(this.x,this.y)},e.Point.prototype.set=function(t,e){this.x=t||0,this.y=e||(0!==e?this.x:0)},e.Point.prototype.constructor=e.Point,e.Rectangle=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Rectangle.prototype.clone=function(){return new e.Rectangle(this.x,this.y,this.width,this.height)},e.Rectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.Rectangle.prototype.constructor=e.Rectangle,e.EmptyRectangle=new e.Rectangle(0,0,0,0),e.Polygon=function(t){if(t instanceof Array||(t=Array.prototype.slice.call(arguments)),t[0]instanceof e.Point){for(var i=[],r=0,n=t.length;n>r;r++)i.push(t[r].x,t[r].y);t=i}this.closed=!0,this.points=t},e.Polygon.prototype.clone=function(){var t=this.points.slice();return new e.Polygon(t)},e.Polygon.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,o=r-1;r>n;o=n++){var s=this.points[2*n],a=this.points[2*n+1],h=this.points[2*o],l=this.points[2*o+1],u=a>e!=l>e&&(h-s)*(e-a)/(l-a)+s>t;u&&(i=!i)}return i},e.Polygon.prototype.constructor=e.Polygon,e.Circle=function(t,e,i){this.x=t||0,this.y=e||0,this.radius=i||0},e.Circle.prototype.clone=function(){return new e.Circle(this.x,this.y,this.radius)},e.Circle.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.x-t,r=this.y-e,n=this.radius*this.radius;return i*=i,r*=r,n>=i+r},e.Circle.prototype.getBounds=function(){return new e.Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},e.Circle.prototype.constructor=e.Circle,e.Ellipse=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Ellipse.prototype.clone=function(){return new e.Ellipse(this.x,this.y,this.width,this.height)},e.Ellipse.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,1>=i+r},e.Ellipse.prototype.getBounds=function(){return new e.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},e.Ellipse.prototype.constructor=e.Ellipse,e.RoundedRectangle=function(t,e,i,r,n){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0,this.radius=n||20},e.RoundedRectangle.prototype.clone=function(){return new e.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},e.RoundedRectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.RoundedRectangle.prototype.constructor=e.RoundedRectangle,e.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},e.Matrix.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},e.Matrix.prototype.toArray=function(t){this.array||(this.array=new e.Float32Array(9));var i=this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},e.Matrix.prototype.apply=function(t,i){return i=i||new e.Point,i.x=this.a*t.x+this.c*t.y+this.tx,i.y=this.b*t.x+this.d*t.y+this.ty,i},e.Matrix.prototype.applyInverse=function(t,i){i=i||new e.Point;var r=1/(this.a*this.d+this.c*-this.b);return i.x=this.d*r*t.x+-this.c*r*t.y+(this.ty*this.c-this.tx*this.d)*r,i.y=this.a*r*t.y+-this.b*r*t.x+(-this.ty*this.a+this.tx*this.b)*r,i},e.Matrix.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},e.Matrix.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},e.Matrix.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this},e.Matrix.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},e.Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},e.identityMatrix=new e.Matrix,e.DisplayObject=function(){this.position=new e.Point,this.scale=new e.Point(1,1),this.pivot=new e.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new e.Matrix,this._sr=0,this._cr=1,this.filterArea=null,this._bounds=new e.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},e.DisplayObject.prototype.constructor=e.DisplayObject,Object.defineProperty(e.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(t){this._interactive=t,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}}),Object.defineProperty(e.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(t){if(t){for(var e=[],i=0;i=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),this.stage&&t.setStageReference(this.stage),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},e.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),r=this.getChildIndex(e);if(0>i||0>r)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[r]=t}},e.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},e.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(0>e||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},e.DisplayObjectContainer.prototype.getChildAt=function(t){if(0>t||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},e.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);return-1!==e?this.removeChildAt(e):void 0},e.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return this.stage&&e.removeStageReference(),e.parent=void 0,this.children.splice(t,1),e},e.DisplayObjectContainer.prototype.removeChildren=function(t,e){var i=t||0,r="number"==typeof e?e:this.children.length,n=r-i;if(n>0&&r>=n){for(var o=this.children.splice(i,n),s=0;st;t++)this.children[t].updateTransform()},e.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=e.DisplayObjectContainer.prototype.updateTransform,e.DisplayObjectContainer.prototype.getBounds=function(){if(0===this.children.length)return e.EmptyRectangle;for(var t,i,r,n=1/0,o=1/0,s=-1/0,a=-1/0,h=!1,l=0,u=this.children.length;u>l;l++){var c=this.children[l];c.visible&&(h=!0,t=this.children[l].getBounds(),n=ni?s:i,a=a>r?a:r)}if(!h)return e.EmptyRectangle;var d=this._bounds;return d.x=n,d.y=o,d.width=s-n,d.height=a-o,d},e.DisplayObjectContainer.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=e.identityMatrix;for(var i=0,r=this.children.length;r>i;i++)this.children[i].updateTransform();var n=this.getBounds();return this.worldTransform=t,n},e.DisplayObjectContainer.prototype.setStageReference=function(t){this.stage=t,this._interactive&&(this.stage.dirty=!0);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r.setStageReference(t)}},e.DisplayObjectContainer.prototype.removeStageReference=function(){for(var t=0,e=this.children.length;e>t;t++){var i=this.children[t];i.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},e.DisplayObjectContainer.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);var e,i;if(this._mask||this._filters){for(this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),t.spriteBatch.start()}else for(e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.DisplayObjectContainer.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);this._mask&&t.maskManager.pushMask(this._mask,t);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r._renderCanvas(t)}this._mask&&t.maskManager.popMask(t)}},e.Sprite=function(t){e.DisplayObjectContainer.call(this),this.anchor=new e.Point,this.texture=t||e.Texture.emptyTexture,this._width=0,this._height=0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.shader=null,this.texture.baseTexture.hasLoaded?this.onTextureUpdate():this.texture.on("update",this.onTextureUpdate.bind(this)),this.renderable=!0},e.Sprite.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Sprite.prototype.constructor=e.Sprite,Object.defineProperty(e.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(t){this.scale.x=t/this.texture.frame.width,this._width=t}}),Object.defineProperty(e.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(t){this.scale.y=t/this.texture.frame.height,this._height=t}}),e.Sprite.prototype.setTexture=function(t){this.texture=t,this.cachedTint=16777215},e.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height)},e.Sprite.prototype.getBounds=function(t){var e=this.texture.frame.width,i=this.texture.frame.height,r=e*(1-this.anchor.x),n=e*-this.anchor.x,o=i*(1-this.anchor.y),s=i*-this.anchor.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=-1/0,g=-1/0,m=1/0,v=1/0;if(0===l&&0===u)0>h&&(h*=-1),0>c&&(c*=-1),m=h*n+d,f=h*r+d,v=c*s+p,g=c*o+p;else{var y=h*n+u*s+d,x=c*s+l*n+p,b=h*r+u*s+d,w=c*s+l*r+p,T=h*r+u*o+d,S=c*o+l*r+p,C=h*n+u*o+d,E=c*o+l*n+p;m=m>y?y:m,m=m>b?b:m,m=m>T?T:m,m=m>C?C:m,v=v>x?x:v,v=v>w?w:v,v=v>S?S:v,v=v>E?E:v,f=y>f?y:f,f=b>f?b:f,f=T>f?T:f,f=C>f?C:f,g=x>g?x:g,g=w>g?w:g,g=S>g?S:g,g=E>g?E:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=v,A.height=g-v,this._currentBounds=A,A},e.Sprite.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){var e,i;if(this._mask||this._filters){var r=t.spriteBatch;for(this._filters&&(r.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(r.stop(),t.maskManager.pushMask(this.mask,t),r.start()),r.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);r.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),r.start()}else for(t.spriteBatch.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.Sprite.prototype._renderCanvas=function(t){if(!(this.visible===!1||0===this.alpha||this.texture.crop.width<=0||this.texture.crop.height<=0)){if(this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,t.context.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t),this.texture.valid){var i=this.texture.baseTexture.resolution/t.resolution;t.context.globalAlpha=this.worldAlpha,t.smoothProperty&&t.scaleMode!==this.texture.baseTexture.scaleMode&&(t.scaleMode=this.texture.baseTexture.scaleMode,t.context[t.smoothProperty]=t.scaleMode===e.scaleModes.LINEAR);var r=this.texture.trim?this.texture.trim.x-this.anchor.x*this.texture.trim.width:this.anchor.x*-this.texture.frame.width,n=this.texture.trim?this.texture.trim.y-this.anchor.y*this.texture.trim.height:this.anchor.y*-this.texture.frame.height;t.roundPixels?(t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution|0,this.worldTransform.ty*t.resolution|0),r=0|r,n=0|n):t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution,this.worldTransform.ty*t.resolution),16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=e.CanvasTinter.getTintedTexture(this,this.tint)),t.context.drawImage(this.tintedTexture,0,0,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)):t.context.drawImage(this.texture.baseTexture.source,this.texture.crop.x,this.texture.crop.y,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)}for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Sprite.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache'+this); -return new e.Sprite(i)},e.Sprite.fromImage=function(t,i,r){var n=e.Texture.fromImage(t,i,r);return new e.Sprite(n)},e.SpriteBatch=function(t){e.DisplayObjectContainer.call(this),this.textureThing=t,this.ready=!1},e.SpriteBatch.prototype=Object.create(e.DisplayObjectContainer.prototype),e.SpriteBatch.prototype.constructor=e.SpriteBatch,e.SpriteBatch.prototype.initWebGL=function(t){this.fastSpriteBatch=new e.WebGLFastSpriteBatch(t),this.ready=!0},e.SpriteBatch.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},e.SpriteBatch.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(t.gl),this.fastSpriteBatch.gl!==t.gl&&this.fastSpriteBatch.setContext(t.gl),t.spriteBatch.stop(),t.shaderManager.setShader(t.shaderManager.fastShader),this.fastSpriteBatch.begin(this,t),this.fastSpriteBatch.render(this),t.spriteBatch.start())},e.SpriteBatch.prototype._renderCanvas=function(t){if(this.visible&&!(this.alpha<=0)&&this.children.length){var e=t.context;e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var i=this.worldTransform,r=!0,n=0;n=this.textures.length&&(this.gotoAndStop(this.textures.length-1),this.onComplete&&this.onComplete())}},e.MovieClip.fromFrames=function(t){for(var i=[],r=0;rh;h++){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p+=d}for(i.ascent=s-h,p=c-d,f=!1,h=a;h>s;h--){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p-=d}i.descent=h-s,i.descent+=6,i.fontSize=i.ascent+i.descent,e.Text.fontPropertiesCache[t]=i}return i},e.Text.prototype.wordWrap=function(t){for(var e="",i=t.split("\n"),r=0;rn?(s>0&&(e+="\n"),e+=o[s],n=this.style.wordWrapWidth-a):(n-=h,e+=" "+o[s])}r=2?parseInt(i[i.length-2],10):e.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=t.tint},e.BitmapText.prototype.updateText=function(){for(var t=e.BitmapText.fonts[this.fontName],i=new e.Point,r=null,n=[],o=0,s=[],a=0,h=this.fontSize/t.size,l=0;l=l;l++){var p=0;"right"===this.style.align?p=o-s[l]:"center"===this.style.align&&(p=(o-s[l])/2),d.push(p)}var f=this.children.length,g=n.length,m=this.tint||16777215;for(l=0;g>l;l++){var v=f>l?this.children[l]:this._pool.pop();v?v.setTexture(n[l].texture):v=new e.Sprite(n[l].texture),v.position.x=(n[l].position.x+d[n[l].line])*h,v.position.y=n[l].position.y*h,v.scale.x=v.scale.y=h,v.tint=m,v.parent||this.addChild(v)}for(;this.children.length>g;){var y=this.getChildAt(this.children.length-1);this._pool.push(y),this.removeChild(y)}this.textWidth=o*h,this.textHeight=(i.y+t.lineHeight)*h},e.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.BitmapText.fonts={},e.InteractionData=function(){this.global=new e.Point,this.target=null,this.originalEvent=null},e.InteractionData.prototype.getLocalPosition=function(t,i){var r=t.worldTransform,n=this.global,o=r.a,s=r.c,a=r.tx,h=r.b,l=r.d,u=r.ty,c=1/(o*l+s*-h);return i=i||new e.Point,i.x=l*c*n.x+-s*c*n.y+(u*s-a*l)*c,i.y=o*c*n.y+-h*c*n.x+(-u*o+a*h)*c,i},e.InteractionData.prototype.constructor=e.InteractionData,e.InteractionManager=function(t){this.stage=t,this.mouse=new e.InteractionData,this.touches={},this.tempPoint=new e.Point,this.mouseoverEnabled=!0,this.pool=[],this.interactiveItems=[],this.interactionDOMElement=null,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this.mouseOut=!1,this.resolution=1,this._tempPoint=new e.Point},e.InteractionManager.prototype.constructor=e.InteractionManager,e.InteractionManager.prototype.collectInteractiveSprite=function(t,e){for(var i=t.children,r=i.length,n=r-1;n>=0;n--){var o=i[n];o._interactive?(e.interactiveChildren=!0,this.interactiveItems.push(o),o.children.length>0&&this.collectInteractiveSprite(o,o)):(o.__iParent=null,o.children.length>0&&this.collectInteractiveSprite(o,e))}},e.InteractionManager.prototype.setTarget=function(t){this.target=t,this.resolution=t.resolution,null===this.interactionDOMElement&&this.setTargetDomElement(t.view)},e.InteractionManager.prototype.setTargetDomElement=function(t){this.removeEvents(),window.navigator.msPointerEnabled&&(t.style["-ms-content-zooming"]="none",t.style["-ms-touch-action"]="none"),this.interactionDOMElement=t,t.addEventListener("mousemove",this.onMouseMove,!0),t.addEventListener("mousedown",this.onMouseDown,!0),t.addEventListener("mouseout",this.onMouseOut,!0),t.addEventListener("touchstart",this.onTouchStart,!0),t.addEventListener("touchend",this.onTouchEnd,!0),t.addEventListener("touchleave",this.onTouchCancel,!0),t.addEventListener("touchcancel",this.onTouchCancel,!0),t.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0)},e.InteractionManager.prototype.removeEvents=function(){this.interactionDOMElement&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]="",this.interactionDOMElement.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchleave",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0))},e.InteractionManager.prototype.update=function(){if(this.target){var t=Date.now(),i=t-this.last;if(i=i*e.INTERACTION_FREQUENCY/1e3,!(1>i)){this.last=t;var r=0;this.dirty&&this.rebuildInteractiveGraph();var n=this.interactiveItems.length,o="inherit",s=!1;for(r=0;n>r;r++){var a=this.interactiveItems[r];a.__hit=this.hitTest(a,this.mouse),this.mouse.target=a,a.__hit&&!s?(a.buttonMode&&(o=a.defaultCursor),a.interactiveChildren||(s=!0),a.__isOver||(a.mouseover&&a.mouseover(this.mouse),a.__isOver=!0)):a.__isOver&&(a.mouseout&&a.mouseout(this.mouse),a.__isOver=!1)}this.currentCursorStyle!==o&&(this.currentCursorStyle=o,this.interactionDOMElement.style.cursor=o)}}},e.InteractionManager.prototype.rebuildInteractiveGraph=function(){this.dirty=!1;for(var t=this.interactiveItems.length,e=0;t>e;e++)this.interactiveItems[e].interactiveChildren=!1;this.interactiveItems=[],this.stage.interactive&&this.interactiveItems.push(this.stage),this.collectInteractiveSprite(this.stage,this.stage)},e.InteractionManager.prototype.onMouseMove=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactionDOMElement.getBoundingClientRect();this.mouse.global.x=(t.clientX-e.left)*(this.target.width/e.width)/this.resolution,this.mouse.global.y=(t.clientY-e.top)*(this.target.height/e.height)/this.resolution;for(var i=this.interactiveItems.length,r=0;i>r;r++){var n=this.interactiveItems[r];n.mousemove&&n.mousemove(this.mouse)}},e.InteractionManager.prototype.onMouseDown=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t,e.AUTO_PREVENT_DEFAULT&&this.mouse.originalEvent.preventDefault();for(var i=this.interactiveItems.length,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightdown":"mousedown",s=n?"rightclick":"click",a=n?"__rightIsDown":"__mouseIsDown",h=n?"__isRightDown":"__isDown",l=0;i>l;l++){var u=this.interactiveItems[l];if((u[o]||u[s])&&(u[a]=!0,u.__hit=this.hitTest(u,this.mouse),u.__hit&&(u[o]&&u[o](this.mouse),u[h]=!0,!u.interactiveChildren)))break}},e.InteractionManager.prototype.onMouseOut=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactiveItems.length;this.interactionDOMElement.style.cursor="inherit";for(var i=0;e>i;i++){var r=this.interactiveItems[i];r.__isOver&&(this.mouse.target=r,r.mouseout&&r.mouseout(this.mouse),r.__isOver=!1)}this.mouseOut=!0,this.mouse.global.x=-1e4,this.mouse.global.y=-1e4},e.InteractionManager.prototype.onMouseUp=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;for(var e=this.interactiveItems.length,i=!1,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightup":"mouseup",s=n?"rightclick":"click",a=n?"rightupoutside":"mouseupoutside",h=n?"__isRightDown":"__isDown",l=0;e>l;l++){var u=this.interactiveItems[l];(u[s]||u[o]||u[a])&&(u.__hit=this.hitTest(u,this.mouse),u.__hit&&!i?(u[o]&&u[o](this.mouse),u[h]&&u[s]&&u[s](this.mouse),u.interactiveChildren||(i=!0)):u[h]&&u[a]&&u[a](this.mouse),u[h]=!1)}},e.InteractionManager.prototype.hitTest=function(t,i){var r=i.global;if(!t.worldVisible)return!1;t.worldTransform.applyInverse(r,this._tempPoint);var n,o=this._tempPoint.x,s=this._tempPoint.y;if(i.target=t,t.hitArea&&t.hitArea.contains)return t.hitArea.contains(o,s);if(t instanceof e.Sprite){var a,h=t.texture.frame.width,l=t.texture.frame.height,u=-h*t.anchor.x;if(o>u&&u+h>o&&(a=-l*t.anchor.y,s>a&&a+l>s))return!0}else if(t instanceof e.Graphics){var c=t.graphicsData;for(n=0;nn;n++){var f=t.children[n],g=this.hitTest(f,i);if(g)return i.target=t,!0}return!1},e.InteractionManager.prototype.onTouchMove=function(t){this.dirty&&this.rebuildInteractiveGraph();var e,i=this.interactionDOMElement.getBoundingClientRect(),r=t.changedTouches,n=0;for(n=0;nh;h++){var l=this.interactiveItems[h];if((l.touchstart||l.tap)&&(l.__hit=this.hitTest(l,s),l.__hit&&(l.touchstart&&l.touchstart(s),l.__isDown=!0,l.__touchData=l.__touchData||{},l.__touchData[o.identifier]=s,!l.interactiveChildren)))break}}},e.InteractionManager.prototype.onTouchEnd=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e=this.interactionDOMElement.getBoundingClientRect(),i=t.changedTouches,r=0;rh;h++){var l=this.interactiveItems[h];l.__touchData&&l.__touchData[n.identifier]&&(l.__hit=this.hitTest(l,l.__touchData[n.identifier]),o.originalEvent=t,(l.touchend||l.tap)&&(l.__hit&&!s?(l.touchend&&l.touchend(o),l.__isDown&&l.tap&&l.tap(o),l.interactiveChildren||(s=!0)):l.__isDown&&l.touchendoutside&&l.touchendoutside(o),l.__isDown=!1),l.__touchData[n.identifier]=null)}this.pool.push(o),this.touches[n.identifier]=null}},e.InteractionManager.prototype.onTouchCancel=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e=this.interactionDOMElement.getBoundingClientRect(),i=t.changedTouches,r=0;rh;h++){var l=this.interactiveItems[h];l.__touchData&&l.__touchData[n.identifier]&&(l.__hit=this.hitTest(l,l.__touchData[n.identifier]),o.originalEvent=t,l.touchcancel&&!s&&(l.touchcancel(o),l.interactiveChildren||(s=!0)),l.__isDown=!1,l.__touchData[n.identifier]=null)}this.pool.push(o),this.touches[n.identifier]=null}},e.Stage=function(t){e.DisplayObjectContainer.call(this),this.worldTransform=new e.Matrix,this.interactive=!0,this.interactionManager=new e.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new e.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(t)},e.Stage.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Stage.prototype.constructor=e.Stage,e.Stage.prototype.setInteractionDelegate=function(t){this.interactionManager.setTargetDomElement(t)},e.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var t=0,e=this.children.length;e>t;t++)this.children[t].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},e.Stage.prototype.setBackgroundColor=function(t){this.backgroundColor=t||0,this.backgroundColorSplit=e.hex2rgb(this.backgroundColor);var i=this.backgroundColor.toString(16);i="000000".substr(0,6-i.length)+i,this.backgroundColorString="#"+i},e.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},function(t){for(var e=0,i=["ms","moz","webkit","o"],r=0;r>16&255)/255,(t>>8&255)/255,(255&t)/255]},e.rgb2hex=function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){return function(t){function e(){for(var r=arguments.length,o=new Array(r);r--;)o[r]=arguments[r];return o=n.concat(o),i.apply(this instanceof e?this:t,o)}var i=this,r=arguments.length-1,n=[];if(r>0)for(n.length=r;r--;)n[r]=arguments[r+1];if("function"!=typeof i)throw new TypeError;return e.prototype=function o(t){return t&&(o.prototype=t),this instanceof o?void 0:new o}(i.prototype),e}}()),e.AjaxRequest=function(){var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var e=0;e0&&0===(t&t-1))return t;for(var e=1;t>e;)e<<=1;return e},e.isPowerOfTwo=function(t,e){return t>0&&0===(t&t-1)&&e>0&&0===(e&e-1)},e.EventTarget={call:function(t){t&&(t=t.prototype||t,e.EventTarget.mixin(t))},mixin:function(t){t.listeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?this._listeners[t].slice():[]},t.emit=t.dispatchEvent=function(t,i){if(this._listeners=this._listeners||{},"object"==typeof t&&(i=t,t=t.type),i&&i.__isEventObject===!0||(i=new e.Event(this,t,i)),this._listeners&&this._listeners[t]){var r,n=this._listeners[t].slice(0),o=n.length,s=n[0];for(r=0;o>r;s=n[++r])if(s.call(this,i),i.stoppedImmediate)return this;if(i.stopped)return this}return this.parent&&this.parent.emit&&this.parent.emit.call(this.parent,t,i),this},t.on=t.addEventListener=function(t,e){return this._listeners=this._listeners||{},(this._listeners[t]=this._listeners[t]||[]).push(e),this},t.once=function(t,e){function i(){e.apply(r.off(t,i),arguments)}this._listeners=this._listeners||{};var r=this;return i._originalHandler=e,this.on(t,i)},t.off=t.removeEventListener=function(t,e){if(this._listeners=this._listeners||{},!this._listeners[t])return this;for(var i=this._listeners[t],r=e?i.length:0;r-->0;)(i[r]===e||i[r]._originalHandler===e)&&i.splice(r,1);return 0===i.length&&delete this._listeners[t],this},t.removeAllListeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?(delete this._listeners[t],this):this}}},e.Event=function(t,e,i){this.__isEventObject=!0,this.stopped=!1,this.stoppedImmediate=!1,this.target=t,this.type=e,this.data=i,this.content=i,this.timeStamp=Date.now()},e.Event.prototype.stopPropagation=function(){this.stopped=!0},e.Event.prototype.stopImmediatePropagation=function(){this.stoppedImmediate=!0},e.autoDetectRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}();return n?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.autoDetectRecommendedRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}(),o=/Android/i.test(navigator.userAgent);return n&&!o?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.PolyK={},e.PolyK.Triangulate=function(t){var i=!0,r=t.length>>1;if(3>r)return[];for(var n=[],o=[],s=0;r>s;s++)o.push(s);s=0;for(var a=r;a>3;){var h=o[(s+0)%a],l=o[(s+1)%a],u=o[(s+2)%a],c=t[2*h],d=t[2*h+1],p=t[2*l],f=t[2*l+1],g=t[2*u],m=t[2*u+1],v=!1;if(e.PolyK._convex(c,d,p,f,g,m,i)){v=!0;for(var y=0;a>y;y++){var x=o[y];if(x!==h&&x!==l&&x!==u&&e.PolyK._PointInTriangle(t[2*x],t[2*x+1],c,d,p,f,g,m)){v=!1;break}}}if(v)n.push(h,l,u),o.splice((s+1)%a,1),a--,s=0;else if(s++>3*a){if(!i)return null;for(n=[],o=[],s=0;r>s;s++)o.push(s);s=0,a=r,i=!1}}return n.push(o[0],o[1],o[2]),n},e.PolyK._PointInTriangle=function(t,e,i,r,n,o,s,a){var h=s-i,l=a-r,u=n-i,c=o-r,d=t-i,p=e-r,f=h*h+l*l,g=h*u+l*c,m=h*d+l*p,v=u*u+c*c,y=u*d+c*p,x=1/(f*v-g*g),b=(v*m-g*y)*x,w=(f*y-g*m)*x;return b>=0&&w>=0&&1>b+w},e.PolyK._convex=function(t,e,i,r,n,o,s){return(e-r)*(n-i)+(i-t)*(o-r)>=0===s},e.initDefaultShaders=function(){},e.CompileVertexShader=function(t,i){return e._CompileShader(t,i,t.VERTEX_SHADER)},e.CompileFragmentShader=function(t,i){return e._CompileShader(t,i,t.FRAGMENT_SHADER)},e._CompileShader=function(t,e,i){var r=e.join("\n"),n=t.createShader(i);return t.shaderSource(n,r),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(window.console.log(t.getShaderInfoLog(n)),null)},e.compileProgram=function(t,i,r){var n=e.CompileFragmentShader(t,r),o=e.CompileVertexShader(t,i),s=t.createProgram();return t.attachShader(s,o),t.attachShader(s,n),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||window.console.log("Could not initialise shaders"),s},e.PixiShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.firstRun=!0,this.dirty=!0,this.attributes=[],this.init()},e.PixiShader.prototype.constructor=e.PixiShader,e.PixiShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc||e.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var r in this.uniforms)this.uniforms[r].uniformLocation=t.getUniformLocation(i,r);this.initUniforms(),this.program=i},e.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var t,e=this.gl;for(var i in this.uniforms){t=this.uniforms[i];var r=t.type;"sampler2D"===r?(t._init=!1,null!==t.value&&this.initSampler2D(t)):"mat2"===r||"mat3"===r||"mat4"===r?(t.glMatrix=!0,t.glValueLength=1,"mat2"===r?t.glFunc=e.uniformMatrix2fv:"mat3"===r?t.glFunc=e.uniformMatrix3fv:"mat4"===r&&(t.glFunc=e.uniformMatrix4fv)):(t.glFunc=e["uniform"+r],t.glValueLength="2f"===r||"2i"===r?2:"3f"===r||"3i"===r?3:"4f"===r||"4i"===r?4:1)}},e.PixiShader.prototype.initSampler2D=function(t){if(t.value&&t.value.baseTexture&&t.value.baseTexture.hasLoaded){var e=this.gl;if(e.activeTexture(e["TEXTURE"+this.textureCount]),e.bindTexture(e.TEXTURE_2D,t.value.baseTexture._glTextures[e.id]),t.textureData){var i=t.textureData,r=i.magFilter?i.magFilter:e.LINEAR,n=i.minFilter?i.minFilter:e.LINEAR,o=i.wrapS?i.wrapS:e.CLAMP_TO_EDGE,s=i.wrapT?i.wrapT:e.CLAMP_TO_EDGE,a=i.luminance?e.LUMINANCE:e.RGBA;if(i.repeat&&(o=e.REPEAT,s=e.REPEAT),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!i.flipY),i.width){var h=i.width?i.width:512,l=i.height?i.height:2,u=i.border?i.border:0;e.texImage2D(e.TEXTURE_2D,0,a,h,l,u,a,e.UNSIGNED_BYTE,null)}else e.texImage2D(e.TEXTURE_2D,0,a,e.RGBA,e.UNSIGNED_BYTE,t.value.baseTexture.source);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,s)}e.uniform1i(t.uniformLocation,this.textureCount),t._init=!0,this.textureCount++}},e.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var t,i=this.gl;for(var r in this.uniforms)t=this.uniforms[r],1===t.glValueLength?t.glMatrix===!0?t.glFunc.call(i,t.uniformLocation,t.transpose,t.value):t.glFunc.call(i,t.uniformLocation,t.value):2===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y):3===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z):4===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z,t.value.w):"sampler2D"===t.type&&(t._init?(i.activeTexture(i["TEXTURE"+this.textureCount]),t.value.baseTexture._dirty[i.id]?e.instances[i.id].updateTexture(t.value.baseTexture):i.bindTexture(i.TEXTURE_2D,t.value.baseTexture._glTextures[i.id]),i.uniform1i(t.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(t))},e.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"],e.PixiFastShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init() -},e.PixiFastShader.prototype.constructor=e.PixiFastShader,e.PixiFastShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.uMatrix=t.getUniformLocation(i,"uMatrix"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aPositionCoord=t.getAttribLocation(i,"aPositionCoord"),this.aScale=t.getAttribLocation(i,"aScale"),this.aRotation=t.getAttribLocation(i,"aRotation"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=i},e.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.StripShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"],this.init()},e.StripShader.prototype.constructor=e.StripShader,e.StripShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.attributes=[this.aVertexPosition,this.aTextureCoord],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.StripShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.PrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform float flipY;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},e.PrimitiveShader.prototype.constructor=e.PrimitiveShader,e.PrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.ComplexPrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform vec3 tint;","uniform float alpha;","uniform vec3 color;","uniform float flipY;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = vec4(color * alpha * tint, alpha);","}"],this.init()},e.ComplexPrimitiveShader.prototype.constructor=e.ComplexPrimitiveShader,e.ComplexPrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.color=t.getUniformLocation(i,"color"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.ComplexPrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.WebGLGraphics=function(){},e.WebGLGraphics.renderGraphics=function(t,i){var r,n=i.gl,o=i.projection,s=i.offset,a=i.shaderManager.primitiveShader;t.dirty&&e.WebGLGraphics.updateGraphics(t,n);for(var h=t._webGL[n.id],l=0;l=6)if(a.points.length<12){s=e.WebGLGraphics.switchMode(r,0);var h=e.WebGLGraphics.buildPoly(a,s);h||(s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s))}else s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s);a.lineWidth>0&&(s=e.WebGLGraphics.switchMode(r,0),e.WebGLGraphics.buildLine(a,s))}else s=e.WebGLGraphics.switchMode(r,0),a.type===e.Graphics.RECT?e.WebGLGraphics.buildRectangle(a,s):a.type===e.Graphics.CIRC||a.type===e.Graphics.ELIP?e.WebGLGraphics.buildCircle(a,s):a.type===e.Graphics.RREC&&e.WebGLGraphics.buildRoundedRectangle(a,s);r.lastIndex++}for(n=0;n=m;m++)g=m/p,a=s(t,i,g),h=s(e,r,g),l=s(i,n,g),u=s(r,o,g),c=s(a,l,g),d=s(h,u,g),f.push(c,d);return f},e.WebGLGraphics.buildCircle=function(t,i){var r,n,o=t.shape,s=o.x,a=o.y;t.type===e.Graphics.CIRC?(r=o.radius,n=o.radius):(r=o.width,n=o.height);var h=40,l=2*Math.PI/h,u=0;if(t.fill){var c=e.hex2rgb(t.fillColor),d=t.fillAlpha,p=c[0]*d,f=c[1]*d,g=c[2]*d,m=i.points,v=i.indices,y=m.length/6;for(v.push(y),u=0;h+1>u;u++)m.push(s,a,p,f,g,d),m.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n,p,f,g,d),v.push(y++,y++);v.push(y-1)}if(t.lineWidth){var x=t.points;for(t.points=[],u=0;h+1>u;u++)t.points.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n);e.WebGLGraphics.buildLine(t,i),t.points=x}},e.WebGLGraphics.buildLine=function(t,i){var r=0,n=t.points;if(0!==n.length){if(t.lineWidth%2)for(r=0;rr;r++)c=n[2*(r-1)],d=n[2*(r-1)+1],p=n[2*r],f=n[2*r+1],g=n[2*(r+1)],m=n[2*(r+1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,x=-(f-m),b=p-g,P=Math.sqrt(x*x+b*b),x/=P,b/=P,x*=k,b*=k,S=-y+d-(-y+f),C=-v+p-(-v+c),E=(-v+c)*(-y+f)-(-v+p)*(-y+d),A=-b+m-(-b+f),_=-x+p-(-x+g),M=(-x+g)*(-b+f)-(-x+p)*(-b+m),L=S*_-A*C,Math.abs(L)<.1?(L+=10.1,F.push(p-v,f-y,U,j,V,N),F.push(p+v,f+y,U,j,V,N)):(l=(C*M-_*E)/L,u=(A*E-S*M)/L,R=(l-p)*(l-p)+(u-f)+(u-f),R>19600?(w=v-x,T=y-b,P=Math.sqrt(w*w+T*T),w/=P,T/=P,w*=k,T*=k,F.push(p-w,f-T),F.push(U,j,V,N),F.push(p+w,f+T),F.push(U,j,V,N),F.push(p-w,f-T),F.push(U,j,V,N),O++):(F.push(l,u),F.push(U,j,V,N),F.push(p-(l-p),f-(u-f)),F.push(U,j,V,N)));for(c=n[2*(I-2)],d=n[2*(I-2)+1],p=n[2*(I-1)],f=n[2*(I-1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,F.push(p-v,f-y),F.push(U,j,V,N),F.push(p+v,f+y),F.push(U,j,V,N),B.push(D),r=0;O>r;r++)B.push(D++);B.push(D-1)}},e.WebGLGraphics.buildComplexPoly=function(t,i){var r=t.points.slice();if(!(r.length<6)){var n=i.indices;i.points=r,i.alpha=t.fillAlpha,i.color=e.hex2rgb(t.fillColor);for(var o,s,a=1/0,h=-1/0,l=1/0,u=-1/0,c=0;co?o:a,h=o>h?o:h,l=l>s?s:l,u=s>u?s:u;r.push(a,l,h,l,h,u,a,u);var d=r.length/2;for(c=0;d>c;c++)n.push(c)}},e.WebGLGraphics.buildPoly=function(t,i){var r=t.points;if(!(r.length<6)){var n=i.points,o=i.indices,s=r.length/2,a=e.hex2rgb(t.fillColor),h=t.fillAlpha,l=a[0]*h,u=a[1]*h,c=a[2]*h,d=e.PolyK.Triangulate(r);if(!d)return!1;var p=n.length/6,f=0;for(f=0;ff;f++)n.push(r[2*f],r[2*f+1],l,u,c,h);return!0}},e.WebGLGraphics.graphicsDataPool=[],e.WebGLGraphicsData=function(t){this.gl=t,this.color=[0,0,0],this.points=[],this.indices=[],this.buffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.mode=1,this.alpha=1,this.dirty=!0},e.WebGLGraphicsData.prototype.reset=function(){this.points=[],this.indices=[]},e.WebGLGraphicsData.prototype.upload=function(){var t=this.gl;this.glPoints=new e.Float32Array(this.points),t.bindBuffer(t.ARRAY_BUFFER,this.buffer),t.bufferData(t.ARRAY_BUFFER,this.glPoints,t.STATIC_DRAW),this.glIndicies=new e.Uint16Array(this.indices),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.glIndicies,t.STATIC_DRAW),this.dirty=!1},e.glContexts=[],e.instances=[],e.WebGLRenderer=function(t,i,r){if(r)for(var n in e.defaultRenderOptions)"undefined"==typeof r[n]&&(r[n]=e.defaultRenderOptions[n]);else r=e.defaultRenderOptions;e.defaultRenderer||(e.sayHello("webGL"),e.defaultRenderer=this),this.type=e.WEBGL_RENDERER,this.resolution=r.resolution,this.transparent=r.transparent,this.autoResize=r.autoResize||!1,this.preserveDrawingBuffer=r.preserveDrawingBuffer,this.clearBeforeRender=r.clearBeforeRender,this.width=t||800,this.height=i||600,this.view=r.view||document.createElement("canvas"),this.contextLostBound=this.handleContextLost.bind(this),this.contextRestoredBound=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLostBound,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredBound,!1),this._contextOptions={alpha:this.transparent,antialias:r.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:r.preserveDrawingBuffer},this.projection=new e.Point,this.offset=new e.Point(0,0),this.shaderManager=new e.WebGLShaderManager,this.spriteBatch=new e.WebGLSpriteBatch,this.maskManager=new e.WebGLMaskManager,this.filterManager=new e.WebGLFilterManager,this.stencilManager=new e.WebGLStencilManager,this.blendModeManager=new e.WebGLBlendModeManager,this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.blendModeManager=this.blendModeManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.stencilManager=this.stencilManager,this.renderSession.renderer=this,this.renderSession.resolution=this.resolution,this.initContext(),this.mapBlendModes()},e.WebGLRenderer.prototype.constructor=e.WebGLRenderer,e.WebGLRenderer.prototype.initContext=function(){var t=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=t,!t)throw new Error("This browser does not support webGL. Try using the canvas renderer");this.glContextId=t.id=e.WebGLRenderer.glContextId++,e.glContexts[this.glContextId]=t,e.instances[this.glContextId]=this,t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),this.shaderManager.setContext(t),this.spriteBatch.setContext(t),this.maskManager.setContext(t),this.filterManager.setContext(t),this.blendModeManager.setContext(t),this.stencilManager.setContext(t),this.renderSession.gl=this.gl,this.resize(this.width,this.height)},e.WebGLRenderer.prototype.render=function(t){if(!this.contextLost){this.__stage!==t&&(t.interactive&&t.interactionManager.removeEvents(),this.__stage=t),t.updateTransform();var e=this.gl;t._interactive?t._interactiveEventsAdded||(t._interactiveEventsAdded=!0,t.interactionManager.setTarget(this)):t._interactiveEventsAdded&&(t._interactiveEventsAdded=!1,t.interactionManager.setTarget(this)),e.viewport(0,0,this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,null),this.clearBeforeRender&&(this.transparent?e.clearColor(0,0,0,0):e.clearColor(t.backgroundColorSplit[0],t.backgroundColorSplit[1],t.backgroundColorSplit[2],1),e.clear(e.COLOR_BUFFER_BIT)),this.renderDisplayObject(t,this.projection)}},e.WebGLRenderer.prototype.renderDisplayObject=function(t,i,r){this.renderSession.blendModeManager.setBlendMode(e.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=r?-1:1,this.renderSession.projection=i,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,r),t._renderWebGL(this.renderSession),this.spriteBatch.end()},e.WebGLRenderer.prototype.resize=function(t,e){this.width=t*this.resolution,this.height=e*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px"),this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2/this.resolution,this.projection.y=-this.height/2/this.resolution},e.WebGLRenderer.prototype.updateTexture=function(t){if(t.hasLoaded){var i=this.gl;return t._glTextures[i.id]||(t._glTextures[i.id]=i.createTexture()),i.bindTexture(i.TEXTURE_2D,t._glTextures[i.id]),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultipliedAlpha),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t.source),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t.mipmap&&e.isPowerOfTwo(t.width,t.height)?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST),i.generateMipmap(i.TEXTURE_2D)):i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t._powerOf2?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)),t._dirty[i.id]=!1,t._glTextures[i.id]}},e.WebGLRenderer.prototype.handleContextLost=function(t){t.preventDefault(),this.contextLost=!0},e.WebGLRenderer.prototype.handleContextRestored=function(){this.initContext();for(var t in e.TextureCache){var i=e.TextureCache[t].baseTexture;i._glTextures=[]}this.contextLost=!1},e.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLostBound),this.view.removeEventListener("webglcontextrestored",this.contextRestoredBound),e.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},e.WebGLRenderer.prototype.mapBlendModes=function(){var t=this.gl;e.blendModesWebGL||(e.blendModesWebGL=[],e.blendModesWebGL[e.blendModes.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.ADD]=[t.SRC_ALPHA,t.DST_ALPHA],e.blendModesWebGL[e.blendModes.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SCREEN]=[t.SRC_ALPHA,t.ONE],e.blendModesWebGL[e.blendModes.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA])},e.WebGLRenderer.glContextId=0,e.WebGLBlendModeManager=function(){this.currentBlendMode=99999},e.WebGLBlendModeManager.prototype.constructor=e.WebGLBlendModeManager,e.WebGLBlendModeManager.prototype.setContext=function(t){this.gl=t},e.WebGLBlendModeManager.prototype.setBlendMode=function(t){if(this.currentBlendMode===t)return!1;this.currentBlendMode=t;var i=e.blendModesWebGL[this.currentBlendMode];return this.gl.blendFunc(i[0],i[1]),!0},e.WebGLBlendModeManager.prototype.destroy=function(){this.gl=null},e.WebGLMaskManager=function(){},e.WebGLMaskManager.prototype.constructor=e.WebGLMaskManager,e.WebGLMaskManager.prototype.setContext=function(t){this.gl=t},e.WebGLMaskManager.prototype.pushMask=function(t,i){var r=i.gl;t.dirty&&e.WebGLGraphics.updateGraphics(t,r),t._webGL[r.id].data.length&&i.stencilManager.pushStencil(t,t._webGL[r.id].data[0],i)},e.WebGLMaskManager.prototype.popMask=function(t,e){var i=this.gl;e.stencilManager.popStencil(t,t._webGL[i.id].data[0],e)},e.WebGLMaskManager.prototype.destroy=function(){this.gl=null},e.WebGLStencilManager=function(){this.stencilStack=[],this.reverse=!0,this.count=0},e.WebGLStencilManager.prototype.setContext=function(t){this.gl=t},e.WebGLStencilManager.prototype.pushStencil=function(t,e,i){var r=this.gl;this.bindGraphics(t,e,i),0===this.stencilStack.length&&(r.enable(r.STENCIL_TEST),r.clear(r.STENCIL_BUFFER_BIT),this.reverse=!0,this.count=0),this.stencilStack.push(e);var n=this.count;r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),1===e.mode?(r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),this.reverse?r.stencilFunc(r.EQUAL,255-(n+1),255):r.stencilFunc(r.EQUAL,n+1,255),this.reverse=!this.reverse):(this.reverse?(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n+1,255):r.stencilFunc(r.EQUAL,255-(n+1),255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),this.count++},e.WebGLStencilManager.prototype.bindGraphics=function(t,i,r){this._currentGraphics=t;var n,o=this.gl,s=r.projection,a=r.offset;1===i.mode?(n=r.shaderManager.complexPrimitiveShader,r.shaderManager.setShader(n),o.uniform1f(n.flipY,r.flipY),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform3fv(n.color,i.color),o.uniform1f(n.alpha,t.worldAlpha*i.alpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,8,0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer)):(n=r.shaderManager.primitiveShader,r.shaderManager.setShader(n),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform1f(n.flipY,r.flipY),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform1f(n.alpha,t.worldAlpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,24,0),o.vertexAttribPointer(n.colorAttribute,4,o.FLOAT,!1,24,8),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer))},e.WebGLStencilManager.prototype.popStencil=function(t,e,i){var r=this.gl;if(this.stencilStack.pop(),this.count--,0===this.stencilStack.length)r.disable(r.STENCIL_TEST);else{var n=this.count;this.bindGraphics(t,e,i),r.colorMask(!1,!1,!1,!1),1===e.mode?(this.reverse=!this.reverse,this.reverse?(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)):(this.reverse?(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)}},e.WebGLStencilManager.prototype.destroy=function(){this.stencilStack=null,this.gl=null},e.WebGLShaderManager=function(){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var t=0;tr;r+=6,n+=4)this.indices[r+0]=n+0,this.indices[r+1]=n+1,this.indices[r+2]=n+2,this.indices[r+3]=n+0,this.indices[r+4]=n+2,this.indices[r+5]=n+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.dirty=!0,this.textures=[],this.blendModes=[],this.shaders=[],this.sprites=[],this.defaultShader=new e.AbstractFilter(["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"])},e.WebGLSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW),this.currentBlendMode=99999;var i=new e.PixiShader(t);i.fragmentSrc=this.defaultShader.fragmentSrc,i.uniforms={},i.init(),this.defaultShader.shaders[t.id]=i},e.WebGLSpriteBatch.prototype.begin=function(t){this.renderSession=t,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},e.WebGLSpriteBatch.prototype.end=function(){this.flush()},e.WebGLSpriteBatch.prototype.render=function(t){var e=t.texture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture);var i=e._uvs;if(i){var r,n,o,s,a=t.anchor.x,h=t.anchor.y;if(e.trim){var l=e.trim;n=l.x-a*l.width,r=n+e.crop.width,s=l.y-h*l.height,o=s+e.crop.height}else r=e.frame.width*(1-a),n=e.frame.width*-a,o=e.frame.height*(1-h),s=e.frame.height*-h;var u=4*this.currentBatchSize*this.vertSize,c=e.baseTexture.resolution,d=t.worldTransform,p=d.a/c,f=d.b/c,g=d.c/c,m=d.d/c,v=d.tx,y=d.ty,x=this.colors,b=this.positions;this.renderSession.roundPixels?(b[u]=p*n+g*s+v|0,b[u+1]=m*s+f*n+y|0,b[u+5]=p*r+g*s+v|0,b[u+6]=m*s+f*r+y|0,b[u+10]=p*r+g*o+v|0,b[u+11]=m*o+f*r+y|0,b[u+15]=p*n+g*o+v|0,b[u+16]=m*o+f*n+y|0):(b[u]=p*n+g*s+v,b[u+1]=m*s+f*n+y,b[u+5]=p*r+g*s+v,b[u+6]=m*s+f*r+y,b[u+10]=p*r+g*o+v,b[u+11]=m*o+f*r+y,b[u+15]=p*n+g*o+v,b[u+16]=m*o+f*n+y),b[u+2]=i.x0,b[u+3]=i.y0,b[u+7]=i.x1,b[u+8]=i.y1,b[u+12]=i.x2,b[u+13]=i.y2,b[u+17]=i.x3,b[u+18]=i.y3;var w=t.tint;x[u+4]=x[u+9]=x[u+14]=x[u+19]=(w>>16)+(65280&w)+((255&w)<<16)+(255*t.worldAlpha<<24),this.sprites[this.currentBatchSize++]=t}},e.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var i=t.tilingTexture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=i.baseTexture),t._uvs||(t._uvs=new e.TextureUvs);var r=t._uvs;t.tilePosition.x%=i.baseTexture.width*t.tileScaleOffset.x,t.tilePosition.y%=i.baseTexture.height*t.tileScaleOffset.y;var n=t.tilePosition.x/(i.baseTexture.width*t.tileScaleOffset.x),o=t.tilePosition.y/(i.baseTexture.height*t.tileScaleOffset.y),s=t.width/i.baseTexture.width/(t.tileScale.x*t.tileScaleOffset.x),a=t.height/i.baseTexture.height/(t.tileScale.y*t.tileScaleOffset.y);r.x0=0-n,r.y0=0-o,r.x1=1*s-n,r.y1=0-o,r.x2=1*s-n,r.y2=1*a-o,r.x3=0-n,r.y3=1*a-o;var h=t.tint,l=(h>>16)+(65280&h)+((255&h)<<16)+(255*t.alpha<<24),u=this.positions,c=this.colors,d=t.width,p=t.height,f=t.anchor.x,g=t.anchor.y,m=d*(1-f),v=d*-f,y=p*(1-g),x=p*-g,b=4*this.currentBatchSize*this.vertSize,w=i.baseTexture.resolution,T=t.worldTransform,S=T.a/w,C=T.b/w,E=T.c/w,A=T.d/w,_=T.tx,M=T.ty;u[b++]=S*v+E*x+_,u[b++]=A*x+C*v+M,u[b++]=r.x0,u[b++]=r.y0,c[b++]=l,u[b++]=S*m+E*x+_,u[b++]=A*x+C*m+M,u[b++]=r.x1,u[b++]=r.y1,c[b++]=l,u[b++]=S*m+E*y+_,u[b++]=A*y+C*m+M,u[b++]=r.x2,u[b++]=r.y2,c[b++]=l,u[b++]=S*v+E*y+_,u[b++]=A*y+C*v+M,u[b++]=r.x3,u[b++]=r.y3,c[b++]=l,this.sprites[this.currentBatchSize++]=t},e.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,i=this.gl;if(this.dirty){this.dirty=!1,i.activeTexture(i.TEXTURE0),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t=this.defaultShader.shaders[i.id];var r=4*this.vertSize;i.vertexAttribPointer(t.aVertexPosition,2,i.FLOAT,!1,r,0),i.vertexAttribPointer(t.aTextureCoord,2,i.FLOAT,!1,r,8),i.vertexAttribPointer(t.colorAttribute,4,i.UNSIGNED_BYTE,!0,r,16)}if(this.currentBatchSize>.5*this.size)i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices);else{var n=this.positions.subarray(0,4*this.currentBatchSize*this.vertSize);i.bufferSubData(i.ARRAY_BUFFER,0,n)}for(var o,s,a,h,l=0,u=0,c=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,v=this.currentBatchSize;v>m;m++){if(h=this.sprites[m],o=h.texture.baseTexture,s=h.blendMode,a=h.shader||this.defaultShader,f=d!==s,g=p!==a,(c!==o||f||g)&&(this.renderBatch(c,l,u),u=m,l=0,c=o,f&&(d=s,this.renderSession.blendModeManager.setBlendMode(d)),g)){p=a,t=p.shaders[i.id],t||(t=new e.PixiShader(i),t.fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[i.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms(); -var y=this.renderSession.projection;i.uniform2f(t.projectionVector,y.x,y.y);var x=this.renderSession.offset;i.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(c,l,u),this.currentBatchSize=0}},e.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var r=this.gl;t._dirty[r.id]?this.renderSession.renderer.updateTexture(t):r.bindTexture(r.TEXTURE_2D,t._glTextures[r.id]),r.drawElements(r.TRIANGLES,6*e,r.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},e.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},e.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},e.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},e.WebGLFastSpriteBatch=function(t){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var i=4*this.size*this.vertSize,r=6*this.maxSize;this.vertices=new e.Float32Array(i),this.indices=new e.Uint16Array(r),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,o=0;r>n;n+=6,o+=4)this.indices[n+0]=o+0,this.indices[n+1]=o+1,this.indices[n+2]=o+2,this.indices[n+3]=o+0,this.indices[n+4]=o+2,this.indices[n+5]=o+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(t)},e.WebGLFastSpriteBatch.prototype.constructor=e.WebGLFastSpriteBatch,e.WebGLFastSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW)},e.WebGLFastSpriteBatch.prototype.begin=function(t,e){this.renderSession=e,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=t.worldTransform.toArray(!0),this.start()},e.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.render=function(t){var e=t.children,i=e[0];if(i.texture._uvs){this.currentBaseTexture=i.texture.baseTexture,i.blendMode!==this.renderSession.blendModeManager.currentBlendMode&&(this.flush(),this.renderSession.blendModeManager.setBlendMode(i.blendMode));for(var r=0,n=e.length;n>r;r++)this.renderSprite(e[r]);this.flush()}},e.WebGLFastSpriteBatch.prototype.renderSprite=function(t){if(t.visible&&(t.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=t.texture.baseTexture,t.texture._uvs))){var e,i,r,n,o,s,a,h,l=this.vertices;if(e=t.texture._uvs,i=t.texture.frame.width,r=t.texture.frame.height,t.texture.trim){var u=t.texture.trim;o=u.x-t.anchor.x*u.width,n=o+t.texture.crop.width,a=u.y-t.anchor.y*u.height,s=a+t.texture.crop.height}else n=t.texture.frame.width*(1-t.anchor.x),o=t.texture.frame.width*-t.anchor.x,s=t.texture.frame.height*(1-t.anchor.y),a=t.texture.frame.height*-t.anchor.y;h=4*this.currentBatchSize*this.vertSize,l[h++]=o,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x0,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x1,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x2,l[h++]=e.y2,l[h++]=t.alpha,l[h++]=o,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x3,l[h++]=e.y3,l[h++]=t.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},e.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]||this.renderSession.renderer.updateTexture(this.currentBaseTexture,t),t.bindTexture(t.TEXTURE_2D,this.currentBaseTexture._glTextures[t.id]),this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},e.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36)},e.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},e.WebGLFilterManager.prototype.constructor=e.WebGLFilterManager,e.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},e.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},e.WebGLFilterManager.prototype.pushFilter=function(t){var i=this.gl,r=this.renderSession.projection,n=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),this.filterStack.push(t);var o=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var s=this.texturePool.pop();s?s.resize(this.width,this.height):s=new e.FilterTexture(this.gl,this.width,this.height),i.bindTexture(i.TEXTURE_2D,s.texture);var a=t._filterArea,h=o.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),i.bindFramebuffer(i.FRAMEBUFFER,s.frameBuffer),i.viewport(0,0,a.width,a.height),r.x=a.width/2,r.y=-a.height/2,n.x=-a.x,n.y=-a.y,i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),t._glFilterTexture=s},e.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,i=this.filterStack.pop(),r=i._filterArea,n=i._glFilterTexture,o=this.renderSession.projection,s=this.renderSession.offset;if(i.filterPasses.length>1){t.viewport(0,0,r.width,r.height),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=r.height,this.vertexArray[2]=r.width,this.vertexArray[3]=r.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=r.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=r.width/this.width,this.uvArray[5]=r.height/this.height,this.uvArray[6]=r.width/this.width,this.uvArray[7]=r.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=n,h=this.texturePool.pop();h||(h=new e.FilterTexture(this.gl,this.width,this.height)),h.resize(this.width,this.height),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l_?_:A,i.beginPath(),i.moveTo(T,S+A),i.lineTo(T,S+E-A),i.quadraticCurveTo(T,S+E,T+A,S+E),i.lineTo(T+C-A,S+E),i.quadraticCurveTo(T+C,S+E,T+C,S+E-A),i.lineTo(T+C,S+A),i.quadraticCurveTo(T+C,S,T+C-A,S),i.lineTo(T+A,S),i.quadraticCurveTo(T,S,T,S+A),i.closePath(),(o.fillColor||0===o.fillColor)&&(i.globalAlpha=o.fillAlpha*r,i.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),i.fill()),o.lineWidth&&(i.globalAlpha=o.lineAlpha*r,i.strokeStyle="#"+("00000"+(0|h).toString(16)).substr(-6),i.stroke())}}},e.CanvasGraphics.renderGraphicsMask=function(t,i){var r=t.graphicsData.length;if(0!==r){r>1&&(r=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var n=0;1>n;n++){var o=t.graphicsData[n],s=o.shape;if(o.type===e.Graphics.POLY){i.beginPath();var a=s.points;i.moveTo(a[0],a[1]);for(var h=1;hA?A:E,i.beginPath(),i.moveTo(w,T+E),i.lineTo(w,T+C-E),i.quadraticCurveTo(w,T+C,w+E,T+C),i.lineTo(w+S-E,T+C),i.quadraticCurveTo(w+S,T+C,w+S,T+C-E),i.lineTo(w+S,T+E),i.quadraticCurveTo(w+S,T,w+S-E,T),i.lineTo(w+E,T),i.quadraticCurveTo(w,T,w,T+E),i.closePath()}}}},e.CanvasGraphics.updateGraphicsTint=function(t){if(16777215!==t.tint)for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,r=(255&t.tint)/255,n=0;n>16&255)/255*e*255<<16)+((s>>8&255)/255*i*255<<8)+(255&s)/255*r*255,o._lineTint=((a>>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*r*255}},e.Graphics=function(){e.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new e.Rectangle(0,0,1,1),this.dirty=!0,this.webGLDirty=!1,this.cachedSpriteDirty=!1},e.Graphics.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Graphics.prototype.constructor=e.Graphics,Object.defineProperty(e.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(t){this._cacheAsBitmap=t,this._cacheAsBitmap?this._generateCachedSprite():(this.destroyCachedSprite(),this.dirty=!0)}}),e.Graphics.prototype.lineStyle=function(t,i,r){if(this.lineWidth=t||0,this.lineColor=i||0,this.lineAlpha=arguments.length<3?1:r,this.currentPath){if(this.currentPath.shape.points.length)return this.drawShape(new e.Polygon(this.currentPath.shape.points.slice(-2))),this;this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha}return this},e.Graphics.prototype.moveTo=function(t,i){return this.drawShape(new e.Polygon([t,i])),this},e.Graphics.prototype.lineTo=function(t,e){return this.currentPath.shape.points.push(t,e),this.dirty=!0,this},e.Graphics.prototype.quadraticCurveTo=function(t,e,i,r){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var n,o,s=20,a=this.currentPath.shape.points;0===a.length&&this.moveTo(0,0);for(var h=a[a.length-2],l=a[a.length-1],u=0,c=1;s>=c;c++)u=c/s,n=h+(t-h)*u,o=l+(e-l)*u,a.push(n+(t+(i-t)*u-n)*u,o+(e+(r-e)*u-o)*u);return this.dirty=!0,this},e.Graphics.prototype.bezierCurveTo=function(t,e,i,r,n,o){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var s,a,h,l,u,c=20,d=this.currentPath.shape.points,p=d[d.length-2],f=d[d.length-1],g=0,m=1;c>=m;m++)g=m/c,s=1-g,a=s*s,h=a*s,l=g*g,u=l*g,d.push(h*p+3*a*g*t+3*s*l*i+u*n,h*f+3*a*g*e+3*s*l*r+u*o);return this.dirty=!0,this},e.Graphics.prototype.arcTo=function(t,e,i,r,n){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(t,e):this.moveTo(t,e);var o=this.currentPath.shape.points,s=o[o.length-2],a=o[o.length-1],h=a-e,l=s-t,u=r-e,c=i-t,d=Math.abs(h*c-l*u);if(1e-8>d||0===n)(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e);else{var p=h*h+l*l,f=u*u+c*c,g=h*u+l*c,m=n*Math.sqrt(p)/d,v=n*Math.sqrt(f)/d,y=m*g/p,x=v*g/f,b=m*c+v*l,w=m*u+v*h,T=l*(v+y),S=h*(v+y),C=c*(m+x),E=u*(m+x),A=Math.atan2(S-w,T-b),_=Math.atan2(E-w,C-b);this.arc(b+t,w+e,n,A,_,l*u>c*h)}return this.dirty=!0,this},e.Graphics.prototype.arc=function(t,e,i,r,n,o){var s,a=t+Math.cos(r)*i,h=e+Math.sin(r)*i;if(this.currentPath?(s=this.currentPath.shape.points,0===s.length?s.push(a,h):(s[s.length-2]!==a||s[s.length-1]!==h)&&s.push(a,h)):(this.moveTo(a,h),s=this.currentPath.shape.points),r===n)return this;!o&&r>=n?n+=2*Math.PI:o&&n>=r&&(r+=2*Math.PI);var l=o?-1*(r-n):n-r,u=Math.abs(l)/(2*Math.PI)*40;if(0===l)return this;for(var c=l/(2*u),d=2*c,p=Math.cos(c),f=Math.sin(c),g=u-1,m=g%1/g,v=0;g>=v;v++){var y=v+m*v,x=c+r+d*y,b=Math.cos(x),w=-Math.sin(x);s.push((p*b+f*w)*i+t,(p*-w+f*b)*i+e)}return this.dirty=!0,this},e.Graphics.prototype.beginFill=function(t,e){return this.filling=!0,this.fillColor=t||0,this.fillAlpha=void 0===e?1:e,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},e.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},e.Graphics.prototype.drawRect=function(t,i,r,n){return this.drawShape(new e.Rectangle(t,i,r,n)),this},e.Graphics.prototype.drawRoundedRect=function(t,i,r,n,o){return this.drawShape(new e.RoundedRectangle(t,i,r,n,o)),this},e.Graphics.prototype.drawCircle=function(t,i,r){return this.drawShape(new e.Circle(t,i,r)),this},e.Graphics.prototype.drawEllipse=function(t,i,r,n){return this.drawShape(new e.Ellipse(t,i,r,n)),this},e.Graphics.prototype.drawPolygon=function(t){return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.drawShape(new e.Polygon(t)),this},e.Graphics.prototype.clear=function(){return this.lineWidth=0,this.filling=!1,this.dirty=!0,this.clearDirty=!0,this.graphicsData=[],this},e.Graphics.prototype.generateTexture=function(t,i){t=t||1;var r=this.getBounds(),n=new e.CanvasBuffer(r.width*t,r.height*t),o=e.Texture.fromCanvas(n.canvas,i);return o.baseTexture.resolution=t,n.context.scale(t,t),n.context.translate(-r.x,-r.y),e.CanvasGraphics.renderGraphics(this,n.context),o},e.Graphics.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.worldAlpha=this.worldAlpha,void e.Sprite.prototype._renderWebGL.call(this._cachedSprite,t);if(t.spriteBatch.stop(),t.blendModeManager.setBlendMode(this.blendMode),this._mask&&t.maskManager.pushMask(this._mask,t),this._filters&&t.filterManager.pushFilter(this._filterBlock),this.blendMode!==t.spriteBatch.currentBlendMode){t.spriteBatch.currentBlendMode=this.blendMode;var i=e.blendModesWebGL[t.spriteBatch.currentBlendMode];t.spriteBatch.gl.blendFunc(i[0],i[1])}if(this.webGLDirty&&(this.dirty=!0,this.webGLDirty=!1),e.WebGLGraphics.renderGraphics(this,t),this.children.length){t.spriteBatch.start();for(var r=0,n=this.children.length;n>r;r++)this.children[r]._renderWebGL(t);t.spriteBatch.stop()}this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this.mask,t),t.drawCount++,t.spriteBatch.start()}},e.Graphics.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.alpha=this.alpha,void e.Sprite.prototype._renderCanvas.call(this._cachedSprite,t);var i=t.context,r=this.worldTransform;this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t);var n=t.resolution;i.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n,r.ty*n),e.CanvasGraphics.renderGraphics(this,i);for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Graphics.prototype.getBounds=function(t){if(this.isMask)return e.EmptyRectangle;this.dirty&&(this.updateLocalBounds(),this.webGLDirty=!0,this.cachedSpriteDirty=!0,this.dirty=!1);var i=this._localBounds,r=i.x,n=i.width+i.x,o=i.y,s=i.height+i.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=h*n+u*s+d,g=c*s+l*n+p,m=h*r+u*s+d,v=c*s+l*r+p,y=h*r+u*o+d,x=c*o+l*r+p,b=h*n+u*o+d,w=c*o+l*n+p,T=f,S=g,C=f,E=g;return C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,E=E>v?v:E,E=E>x?x:E,E=E>w?w:E,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T,S=v>S?v:S,S=x>S?x:S,S=w>S?w:S,this._bounds.x=C,this._bounds.width=T-C,this._bounds.y=E,this._bounds.height=S-E,this._bounds -},e.Graphics.prototype.updateLocalBounds=function(){var t=1/0,i=-1/0,r=1/0,n=-1/0;if(this.graphicsData.length)for(var o,s,a,h,l,u,c=0;ca?a:t,i=a+l>i?a+l:i,r=r>h?h:r,n=h+u>n?h+u:n;else if(p===e.Graphics.CIRC)a=o.x,h=o.y,l=o.radius+f/2,u=o.radius+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else if(p===e.Graphics.ELIP)a=o.x,h=o.y,l=o.width+f/2,u=o.height+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else{s=o.points;for(var g=0;ga-f?a-f:t,i=a+f>i?a+f:i,r=r>h-f?h-f:r,n=h+f>n?h+f:n}}else t=0,i=0,r=0,n=0;var m=this.boundsPadding;this._localBounds.x=t-m,this._localBounds.width=i-t+2*m,this._localBounds.y=r-m,this._localBounds.height=n-r+2*m},e.Graphics.prototype._generateCachedSprite=function(){var t=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(t.width,t.height);else{var i=new e.CanvasBuffer(t.width,t.height),r=e.Texture.fromCanvas(i.canvas);this._cachedSprite=new e.Sprite(r),this._cachedSprite.buffer=i,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(t.x/t.width),this._cachedSprite.anchor.y=-(t.y/t.height),this._cachedSprite.buffer.context.translate(-t.x,-t.y),this.worldAlpha=1,e.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},e.Graphics.prototype.updateCachedSpriteTexture=function(){var t=this._cachedSprite,e=t.texture,i=t.buffer.canvas;e.baseTexture.width=i.width,e.baseTexture.height=i.height,e.crop.width=e.frame.width=i.width,e.crop.height=e.frame.height=i.height,t._width=i.width,t._height=i.height,e.baseTexture.dirty()},e.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},e.Graphics.prototype.drawShape=function(t){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null;var i=new e.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,t);return this.graphicsData.push(i),i.type===e.Graphics.POLY&&(i.shape.closed=this.filling,this.currentPath=i),this.dirty=!0,i},e.GraphicsData=function(t,e,i,r,n,o,s){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this._lineTint=e,this.fillColor=r,this.fillAlpha=n,this._fillTint=r,this.fill=o,this.shape=s,this.type=s.type},e.Graphics.POLY=0,e.Graphics.RECT=1,e.Graphics.CIRC=2,e.Graphics.ELIP=3,e.Graphics.RREC=4,e.Polygon.prototype.type=e.Graphics.POLY,e.Rectangle.prototype.type=e.Graphics.RECT,e.Circle.prototype.type=e.Graphics.CIRC,e.Ellipse.prototype.type=e.Graphics.ELIP,e.RoundedRectangle.prototype.type=e.Graphics.RREC,e.Strip=function(t){e.DisplayObjectContainer.call(this),this.texture=t,this.uvs=new e.Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new e.Float32Array([0,0,100,0,100,100,0,100]),this.colors=new e.Float32Array([1,1,1,1]),this.indices=new e.Uint16Array([0,1,2,3]),this.dirty=!0,this.blendMode=e.blendModes.NORMAL,this.canvasPadding=0,this.drawMode=e.Strip.DrawModes.TRIANGLE_STRIP},e.Strip.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Strip.prototype.constructor=e.Strip,e.Strip.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||(t.spriteBatch.stop(),this._vertexBuffer||this._initWebGL(t),t.shaderManager.setShader(t.shaderManager.stripShader),this._renderStrip(t),t.spriteBatch.start())},e.Strip.prototype._initWebGL=function(t){var e=t.gl;this._vertexBuffer=e.createBuffer(),this._indexBuffer=e.createBuffer(),this._uvBuffer=e.createBuffer(),this._colorBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices,e.DYNAMIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._uvBuffer),e.bufferData(e.ARRAY_BUFFER,this.uvs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colors,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW)},e.Strip.prototype._renderStrip=function(t){var i=t.gl,r=t.projection,n=t.offset,o=t.shaderManager.stripShader,s=this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?i.TRIANGLE_STRIP:i.TRIANGLES;t.blendModeManager.setBlendMode(this.blendMode),i.uniformMatrix3fv(o.translationMatrix,!1,this.worldTransform.toArray(!0)),i.uniform2f(o.projectionVector,r.x,-r.y),i.uniform2f(o.offsetVector,-n.x,-n.y),i.uniform1f(o.alpha,this.worldAlpha),this.dirty?(this.dirty=!1,i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertices,i.STATIC_DRAW),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.bufferData(i.ARRAY_BUFFER,this.uvs,i.STATIC_DRAW),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,this.indices,i.STATIC_DRAW)):(i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer)),i.drawElements(s,this.indices.length,i.UNSIGNED_SHORT,0)},e.Strip.prototype._renderCanvas=function(t){var i=t.context,r=this.worldTransform;t.roundPixels?i.setTransform(r.a,r.b,r.c,r.d,0|r.tx,0|r.ty):i.setTransform(r.a,r.b,r.c,r.d,r.tx,r.ty),this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?this._renderCanvasTriangleStrip(i):this._renderCanvasTriangles(i)},e.Strip.prototype._renderCanvasTriangleStrip=function(t){var e=this.vertices,i=this.uvs,r=e.length/2;this.count++;for(var n=0;r-2>n;n++){var o=2*n;this._renderCanvasDrawTriangle(t,e,i,o,o+2,o+4)}},e.Strip.prototype._renderCanvasTriangles=function(t){var e=this.vertices,i=this.uvs,r=this.indices,n=r.length;this.count++;for(var o=0;n>o;o+=3){var s=2*r[o],a=2*r[o+1],h=2*r[o+2];this._renderCanvasDrawTriangle(t,e,i,s,a,h)}},e.Strip.prototype._renderCanvasDrawTriangle=function(t,e,i,r,n,o){var s=this.texture.baseTexture.source,a=this.texture.width,h=this.texture.height,l=e[r],u=e[n],c=e[o],d=e[r+1],p=e[n+1],f=e[o+1],g=i[r]*a,m=i[n]*a,v=i[o]*a,y=i[r+1]*h,x=i[n+1]*h,b=i[o+1]*h;if(this.canvasPadding>0){var w=this.canvasPadding/this.worldTransform.a,T=this.canvasPadding/this.worldTransform.d,S=(l+u+c)/3,C=(d+p+f)/3,E=l-S,A=d-C,_=Math.sqrt(E*E+A*A);l=S+E/_*(_+w),d=C+A/_*(_+T),E=u-S,A=p-C,_=Math.sqrt(E*E+A*A),u=S+E/_*(_+w),p=C+A/_*(_+T),E=c-S,A=f-C,_=Math.sqrt(E*E+A*A),c=S+E/_*(_+w),f=C+A/_*(_+T)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(u,p),t.lineTo(c,f),t.closePath(),t.clip();var M=g*x+y*v+m*b-x*v-y*m-g*b,L=l*x+y*c+u*b-x*c-y*u-l*b,R=g*u+l*v+m*c-u*v-l*m-g*c,P=g*x*c+y*u*v+l*m*b-l*x*v-y*m*c-g*u*b,F=d*x+y*f+p*b-x*f-y*p-d*b,B=g*p+d*v+m*f-p*v-d*m-g*f,I=g*x*f+y*p*v+d*m*b-d*x*v-y*m*f-g*p*b;t.transform(L/M,F/M,R/M,B/M,P/M,I/M),t.drawImage(s,0,0),t.restore()},e.Strip.prototype.renderStripFlat=function(t){var e=this.context,i=t.vertices,r=i.length/2;this.count++,e.beginPath();for(var n=1;r-2>n;n++){var o=2*n,s=i[o],a=i[o+2],h=i[o+4],l=i[o+1],u=i[o+3],c=i[o+5];e.moveTo(s,l),e.lineTo(a,u),e.lineTo(h,c)}e.fillStyle="#FF0000",e.fill(),e.closePath()},e.Strip.prototype.onTextureUpdate=function(){this.updateFrame=!0},e.Strip.prototype.getBounds=function(t){for(var i=t||this.worldTransform,r=i.a,n=i.b,o=i.c,s=i.d,a=i.tx,h=i.ty,l=-1/0,u=-1/0,c=1/0,d=1/0,p=this.vertices,f=0,g=p.length;g>f;f+=2){var m=p[f],v=p[f+1],y=r*m+o*v+a,x=s*v+n*m+h;c=c>y?y:c,d=d>x?x:d,l=y>l?y:l,u=x>u?x:u}if(c===-1/0||1/0===u)return e.EmptyRectangle;var b=this._bounds;return b.x=c,b.width=l-c,b.y=d,b.height=u-d,this._currentBounds=b,b},e.Strip.DrawModes={TRIANGLE_STRIP:0,TRIANGLES:1},e.Rope=function(t,i){e.Strip.call(this,t),this.points=i,this.vertices=new e.Float32Array(4*i.length),this.uvs=new e.Float32Array(4*i.length),this.colors=new e.Float32Array(2*i.length),this.indices=new e.Uint16Array(2*i.length),this.refresh()},e.Rope.prototype=Object.create(e.Strip.prototype),e.Rope.prototype.constructor=e.Rope,e.Rope.prototype.refresh=function(){var t=this.points;if(!(t.length<1)){var e=this.uvs,i=t[0],r=this.indices,n=this.colors;this.count-=.2,e[0]=0,e[1]=0,e[2]=0,e[3]=1,n[0]=1,n[1]=1,r[0]=0,r[1]=1;for(var o,s,a,h=t.length,l=1;h>l;l++)o=t[l],s=4*l,a=l/(h-1),l%2?(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1):(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1),s=2*l,n[s]=1,n[s+1]=1,s=2*l,r[s]=s,r[s+1]=s+1,i=o}},e.Rope.prototype.updateTransform=function(){var t=this.points;if(!(t.length<1)){var i,r=t[0],n={x:0,y:0};this.count-=.2;for(var o,s,a,h,l,u=this.vertices,c=t.length,d=0;c>d;d++)o=t[d],s=4*d,i=d1&&(a=1),h=Math.sqrt(n.x*n.x+n.y*n.y),l=this.texture.height/2,n.x/=h,n.y/=h,n.x*=l,n.y*=l,u[s]=o.x+n.x,u[s+1]=o.y+n.y,u[s+2]=o.x-n.x,u[s+3]=o.y-n.y,r=o;e.DisplayObjectContainer.prototype.updateTransform.call(this)}},e.Rope.prototype.setTexture=function(t){this.texture=t},e.TilingSprite=function(t,i,r){e.Sprite.call(this,t),this._width=i||100,this._height=r||100,this.tileScale=new e.Point(1,1),this.tileScaleOffset=new e.Point(1,1),this.tilePosition=new e.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL},e.TilingSprite.prototype=Object.create(e.Sprite.prototype),e.TilingSprite.prototype.constructor=e.TilingSprite,Object.defineProperty(e.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(e.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),e.TilingSprite.prototype.setTexture=function(t){this.texture!==t&&(this.texture=t,this.refreshTexture=!0,this.cachedTint=16777215)},e.TilingSprite.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha){var e,i;for(this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(t.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)):t.spriteBatch.renderTilingSprite(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this._mask,t),t.spriteBatch.start()}},e.TilingSprite.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){var i=t.context;this._mask&&t.maskManager.pushMask(this._mask,t),i.globalAlpha=this.worldAlpha;var r,n,o=this.worldTransform,s=t.resolution;if(i.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*s,o.ty*s),!this.__tilePattern||this.refreshTexture){if(this.generateTilingTexture(!1),!this.tilingTexture)return;this.__tilePattern=i.createPattern(this.tilingTexture.baseTexture.source,"repeat")}this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]);var a=this.tilePosition,h=this.tileScale;for(a.x%=this.tilingTexture.baseTexture.width,a.y%=this.tilingTexture.baseTexture.height,i.scale(h.x,h.y),i.translate(a.x+this.anchor.x*-this._width,a.y+this.anchor.y*-this._height),i.fillStyle=this.__tilePattern,i.fillRect(-a.x,-a.y,this._width/h.x,this._height/h.y),i.scale(1/h.x,1/h.y),i.translate(-a.x+this.anchor.x*this._width,-a.y+this.anchor.y*this._height),this._mask&&t.maskManager.popMask(t),r=0,n=this.children.length;n>r;r++)this.children[r]._renderCanvas(t)}},e.TilingSprite.prototype.getBounds=function(){var t=this._width,e=this._height,i=t*(1-this.anchor.x),r=t*-this.anchor.x,n=e*(1-this.anchor.y),o=e*-this.anchor.y,s=this.worldTransform,a=s.a,h=s.b,l=s.c,u=s.d,c=s.tx,d=s.ty,p=a*r+l*o+c,f=u*o+h*r+d,g=a*i+l*o+c,m=u*o+h*i+d,v=a*i+l*n+c,y=u*n+h*i+d,x=a*r+l*n+c,b=u*n+h*r+d,w=-1/0,T=-1/0,S=1/0,C=1/0;S=S>p?p:S,S=S>g?g:S,S=S>v?v:S,S=S>x?x:S,C=C>f?f:C,C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,w=p>w?p:w,w=g>w?g:w,w=v>w?v:w,w=x>w?x:w,T=f>T?f:T,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T;var E=this._bounds;return E.x=S,E.width=w-S,E.y=C,E.height=T-C,this._currentBounds=E,E},e.TilingSprite.prototype.onTextureUpdate=function(){},e.TilingSprite.prototype.generateTilingTexture=function(t){if(this.texture.baseTexture.hasLoaded){var i,r,n=this.originalTexture||this.texture,o=n.frame,s=o.width!==n.baseTexture.width||o.height!==n.baseTexture.height,a=!1;if(t?(i=e.getNextPowerOfTwo(o.width),r=e.getNextPowerOfTwo(o.height),(o.width!==i||o.height!==r||n.baseTexture.width!==i||n.baseTexture.height||r)&&(a=!0)):s&&(n.trim?(i=n.trim.width,r=n.trim.height):(i=o.width,r=o.height),a=!0),a){var h;this.tilingTexture&&this.tilingTexture.isTiling?(h=this.tilingTexture.canvasBuffer,h.resize(i,r),this.tilingTexture.baseTexture.width=i,this.tilingTexture.baseTexture.height=r,this.tilingTexture.needsUpdate=!0):(h=new e.CanvasBuffer(i,r),this.tilingTexture=e.Texture.fromCanvas(h.canvas),this.tilingTexture.canvasBuffer=h,this.tilingTexture.isTiling=!0),h.context.drawImage(n.baseTexture.source,n.crop.x,n.crop.y,n.crop.width,n.crop.height,0,0,i,r),this.tileScaleOffset.x=o.width/i,this.tileScaleOffset.y=o.height/r}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=n;this.refreshTexture=!1,this.originalTexture=this.texture,this.texture=this.tilingTexture,this.tilingTexture.baseTexture._powerOf2=!0}},e.TilingSprite.prototype.destroy=function(){e.Sprite.prototype.destroy.call(this),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture.destroy(!0),this.tilingTexture=null};var i={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};i.BoneData=function(t,e){this.name=t,this.parent=e},i.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},i.SlotData=function(t,e){this.name=t,this.boneData=e},i.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},i.IkConstraintData=function(t){this.name=t,this.bones=[]},i.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},i.Bone=function(t,e,i){this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()},i.Bone.yDown=!1,i.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var t=this.parent;if(t)this.worldX=this.x*t.m00+this.y*t.m01+t.worldX,this.worldY=this.x*t.m10+this.y*t.m11+t.worldY,this.data.inheritScale?(this.worldScaleX=t.worldScaleX*this.scaleX,this.worldScaleY=t.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?t.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=t.worldFlipX!=this.flipX,this.worldFlipY=t.worldFlipY!=this.flipY;else{var e=this.skeleton.flipX,r=this.skeleton.flipY;this.worldX=e?-this.x:this.x,this.worldY=r!=i.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=e!=this.flipX,this.worldFlipY=r!=this.flipY}var n=this.worldRotation*i.degRad,o=Math.cos(n),s=Math.sin(n);this.worldFlipX?(this.m00=-o*this.worldScaleX,this.m01=s*this.worldScaleY):(this.m00=o*this.worldScaleX,this.m01=-s*this.worldScaleY),this.worldFlipY!=i.Bone.yDown?(this.m10=-s*this.worldScaleX,this.m11=-o*this.worldScaleY):(this.m10=s*this.worldScaleX,this.m11=o*this.worldScaleY)},setToSetupPose:function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.rotationIK=this.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.flipX=t.flipX,this.flipY=t.flipY},worldToLocal:function(t){var e=t[0]-this.worldX,r=t[1]-this.worldY,n=this.m00,o=this.m10,s=this.m01,a=this.m11;this.worldFlipX!=(this.worldFlipY!=i.Bone.yDown)&&(n=-n,a=-a);var h=1/(n*a-s*o);t[0]=e*n*h-r*s*h,t[1]=r*a*h-e*o*h},localToWorld:function(t){var e=t[0],i=t[1];t[0]=e*this.m00+i*this.m01+this.worldX,t[1]=e*this.m10+i*this.m11+this.worldY}},i.Slot=function(t,e){this.data=t,this.bone=e,this.setToSetupPose()},i.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(t){this.attachment=t,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(t){this._attachmentTime=this.bone.skeleton.time-t},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var t=this.data;this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;for(var e=this.bone.skeleton.data.slots,i=0,r=e.length;r>i;i++)if(e[i]==t){this.setAttachment(t.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(i,t.attachmentName):null);break}}},i.IkConstraint=function(t,e){this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.bones=[];for(var i=0,r=t.bones.length;r>i;i++)this.bones.push(e.findBone(t.bones[i].name));this.target=e.findBone(t.target.name)},i.IkConstraint.prototype={apply:function(){var t=this.target,e=this.bones;switch(e.length){case 1:i.IkConstraint.apply1(e[0],t.worldX,t.worldY,this.mix);break;case 2:i.IkConstraint.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.mix)}}},i.IkConstraint.apply1=function(t,e,r,n){var o=t.data.inheritRotation&&t.parent?t.parent.worldRotation:0,s=t.rotation,a=Math.atan2(r-t.worldY,e-t.worldX)*i.radDeg-o;t.rotationIK=s+(a-s)*n},i.IkConstraint.apply2=function(t,e,r,n,o,s){var a=e.rotation,h=t.rotation;if(!s)return e.rotationIK=a,void(t.rotationIK=h);var l,u,c=i.temp,d=t.parent;d?(c[0]=r,c[1]=n,d.worldToLocal(c),r=(c[0]-t.x)*d.worldScaleX,n=(c[1]-t.y)*d.worldScaleY):(r-=t.x,n-=t.y),e.parent==t?(l=e.x,u=e.y):(c[0]=e.x,c[1]=e.y,e.parent.localToWorld(c),t.worldToLocal(c),l=c[0],u=c[1]);var p=l*t.worldScaleX,f=u*t.worldScaleY,g=Math.atan2(f,p),m=Math.sqrt(p*p+f*f),v=e.data.length*e.worldScaleX,y=2*m*v;if(1e-4>y)return void(e.rotationIK=a+(Math.atan2(n,r)*i.radDeg-h-a)*s);var x=(r*r+n*n-m*m-v*v)/y;-1>x?x=-1:x>1&&(x=1);var b=Math.acos(x)*o,w=m+v*x,T=v*Math.sin(b),S=Math.atan2(n*w-r*T,r*w+n*T),C=(S-g)*i.radDeg-h;C>180?C-=360:-180>C&&(C+=360),t.rotationIK=h+C*s,C=(b+g)*i.radDeg-a,C>180?C-=360:-180>C&&(C+=360),e.rotationIK=a+(C+t.worldRotation-e.parent.worldRotation)*s},i.Skin=function(t){this.name=t,this.attachments={}},i.Skin.prototype={addAttachment:function(t,e,i){this.attachments[t+":"+e]=i},getAttachment:function(t,e){return this.attachments[t+":"+e]},_attachAll:function(t,e){for(var i in e.attachments){var r=i.indexOf(":"),n=parseInt(i.substring(0,r)),o=i.substring(r+1),s=t.slots[n];if(s.attachment&&s.attachment.name==o){var a=this.getAttachment(n,o);a&&s.setAttachment(a)}}}},i.Animation=function(t,e,i){this.name=t,this.timelines=e,this.duration=i},i.Animation.prototype={apply:function(t,e,i,r,n){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var o=this.timelines,s=0,a=o.length;a>s;s++)o[s].apply(t,e,i,n,1)},mix:function(t,e,i,r,n,o){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var s=this.timelines,a=0,h=s.length;h>a;a++)s[a].apply(t,e,i,n,o)}},i.Animation.binarySearch=function(t,e,i){var r=0,n=Math.floor(t.length/i)-2;if(!n)return i;for(var o=n>>>1;;){if(t[(o+1)*i]<=e?r=o+1:n=o,r==n)return(r+1)*i;o=r+n>>>1}},i.Animation.binarySearch1=function(t,e){var i=0,r=t.length-2;if(!r)return 1;for(var n=r>>>1;;){if(t[n+1]<=e?i=n+1:r=n,i==r)return i+1;n=i+r>>>1}},i.Animation.linearSearch=function(t,e,i){for(var r=0,n=t.length-i;n>=r;r+=i)if(t[r]>e)return r;return-1},i.Curves=function(){this.curves=[]},i.Curves.prototype={setLinear:function(t){this.curves[19*t]=0},setStepped:function(t){this.curves[19*t]=1},setCurve:function(t,e,i,r,n){var o=.1,s=o*o,a=s*o,h=3*o,l=3*s,u=6*s,c=6*a,d=2*-e+r,p=2*-i+n,f=3*(e-r)+1,g=3*(i-n)+1,m=e*h+d*l+f*a,v=i*h+p*l+g*a,y=d*u+f*c,x=p*u+g*c,b=f*c,w=g*c,T=19*t,S=this.curves;S[T++]=2;for(var C=m,E=v,A=T+19-1;A>T;T+=2)S[T]=C,S[T+1]=E,m+=y,v+=x,y+=b,x+=w,C+=m,E+=v},getCurvePercent:function(t,e){e=0>e?0:e>1?1:e;var i=this.curves,r=19*t,n=i[r];if(0===n)return e;if(1==n)return 0;r++;for(var o=0,s=r,a=r+19-1;a>r;r+=2)if(o=i[r],o>=e){var h,l;return r==s?(h=0,l=0):(h=i[r-2],l=i[r-1]),l+(i[r+1]-l)*(e-h)/(o-h)}var u=i[r-1];return u+(1-u)*(e-o)/(1-o)}},i.RotateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-2]){for(var h=a.data.rotation+s[s.length-1]-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;return void(a.rotation+=h*o)}var l=i.Animation.binarySearch(s,r,2),u=s[l-1],c=s[l],d=1-(r-c)/(s[l-2]-c);d=this.curves.getCurvePercent(l/2-1,d);for(var h=s[l+1]-u;h>180;)h-=360;for(;-180>h;)h+=360;for(h=a.data.rotation+(u+h*d)-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;a.rotation+=h*o}}},i.TranslateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.x+=(a.data.x+s[s.length-2]-a.x)*o,void(a.y+=(a.data.y+s[s.length-1]-a.y)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.x+=(a.data.x+l+(s[h+1]-l)*d-a.x)*o,a.y+=(a.data.y+u+(s[h+2]-u)*d-a.y)*o}}},i.ScaleTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.scaleX+=(a.data.scaleX*s[s.length-2]-a.scaleX)*o,void(a.scaleY+=(a.data.scaleY*s[s.length-1]-a.scaleY)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.scaleX+=(a.data.scaleX*(l+(s[h+1]-l)*d)-a.scaleX)*o,a.scaleY+=(a.data.scaleY*(u+(s[h+2]-u)*d)-a.scaleY)*o}}},i.ColorTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=5*t},i.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(t,e,i,r,n,o){t*=5,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=o},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-5]){var c=s.length-1;a=s[c-3],h=s[c-2],l=s[c-1],u=s[c]}else{var d=i.Animation.binarySearch(s,r,5),p=s[d-4],f=s[d-3],g=s[d-2],m=s[d-1],v=s[d],y=1-(r-v)/(s[d-5]-v);y=this.curves.getCurvePercent(d/5-1,y),a=p+(s[d+1]-p)*y,h=f+(s[d+2]-f)*y,l=g+(s[d+3]-g)*y,u=m+(s[d+4]-m)*y}var x=t.slots[this.slotIndex];1>o?(x.r+=(a-x.r)*o,x.g+=(h-x.g)*o,x.b+=(l-x.b)*o,x.a+=(u-x.a)*o):(x.r=a,x.g=h,x.b=l,x.a=u)}}},i.AttachmentTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.attachmentNames=[],this.attachmentNames.length=t},i.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=r>=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;if(!(n[o]r)this.apply(t,e,Number.MAX_VALUE,n,o),e=-1;else if(e>=s[a-1])return;if(!(r0&&s[h-1]==l;)h--}for(var u=this.events;a>h&&r>=s[h];h++)n.push(u[h])}}}},i.DrawOrderTimeline=function(t){this.frames=[],this.frames.length=t,this.drawOrders=[],this.drawOrders.length=t},i.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},apply:function(t,e,r){var n=this.frames;if(!(r=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;var s=t.drawOrder,a=t.slots,h=this.drawOrders[o];if(h)for(var l=0,u=h.length;u>l;l++)s[l]=t.slots[h[l]];else for(var l=0,u=a.length;u>l;l++)s[l]=a[l]}}},i.FfdTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.frameVertices=[],this.frameVertices.length=t},i.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.frameVertices[t]=i},apply:function(t,e,r,n,o){var s=t.slots[this.slotIndex];if(s.attachment==this.attachment){var a=this.frames;if(!(r=a[a.length-1]){var c=h[a.length-1];if(1>o)for(var d=0;l>d;d++)u[d]+=(c[d]-u[d])*o;else for(var d=0;l>d;d++)u[d]=c[d]}else{var p=i.Animation.binarySearch1(a,r),f=a[p],g=1-(r-f)/(a[p-1]-f);g=this.curves.getCurvePercent(p-1,0>g?0:g>1?1:g);var m=h[p-1],v=h[p];if(1>o)for(var d=0;l>d;d++){var y=m[d];u[d]+=(y+(v[d]-y)*g-u[d])*o}else for(var d=0;l>d;d++){var y=m[d];u[d]=y+(v[d]-y)*g}}}}}},i.IkConstraintTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.mix+=(s[s.length-2]-a.mix)*o,void(a.bendDirection=s[s.length-1]);var h=i.Animation.binarySearch(s,r,3),l=s[h+-2],u=s[h],c=1-(r-u)/(s[h+-3]-u);c=this.curves.getCurvePercent(h/3-1,c);var d=l+(s[h+1]-l)*c;a.mix+=(d-a.mix)*o,a.bendDirection=s[h+-1]}}},i.FlipXTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i?1:0},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]i;i++)if(e[i].name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return slot[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSkin:function(t){for(var e=this.skins,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findEvent:function(t){for(var e=this.events,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findAnimation:function(t){for(var e=this.animations,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null}},i.Skeleton=function(t){this.data=t,this.bones=[];for(var e=0,r=t.bones.length;r>e;e++){var n=t.bones[e],o=n.parent?this.bones[t.bones.indexOf(n.parent)]:null;this.bones.push(new i.Bone(n,this,o))}this.slots=[],this.drawOrder=[];for(var e=0,r=t.slots.length;r>e;e++){var s=t.slots[e],a=this.bones[t.bones.indexOf(s.boneData)],h=new i.Slot(s,a);this.slots.push(h),this.drawOrder.push(h)}this.ikConstraints=[];for(var e=0,r=t.ikConstraints.length;r>e;e++)this.ikConstraints.push(new i.IkConstraint(t.ikConstraints[e],this));this.boneCache=[],this.updateCache()},i.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var t=this.ikConstraints,e=t.length,i=e+1,r=this.boneCache;r.length>i&&(r.length=i);for(var n=0,o=r.length;o>n;n++)r[n].length=0;for(;r.lengthn;n++){var h=a[n],l=h;do{for(var u=0;e>u;u++)for(var c=t[u],d=c.bones[0],p=c.bones[c.bones.length-1];;){if(l==p){r[u].push(h),r[u+1].push(h);continue t}if(p==d)break;p=p.parent}l=l.parent}while(l);s[s.length]=h}},updateWorldTransform:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++){var r=t[e];r.rotationIK=r.rotation}for(var e=0,n=this.boneCache.length-1;;){for(var o=this.boneCache[e],s=0,a=o.length;a>s;s++)o[s].updateWorldTransform();if(e==n)break;this.ikConstraints[e].apply(),e++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,e=0,i=r.length;i>e;e++){var n=r[e];n.bendDirection=n.data.bendDirection,n.mix=n.data.mix}},setSlotsToSetupPose:function(){for(var t=this.slots,e=this.drawOrder,i=0,r=t.length;r>i;i++)e[i]=t[i],t[i].setToSetupPose(i)},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},setSkinByName:function(t){var e=this.data.findSkin(t);if(!e)throw"Skin not found: "+t;this.setSkin(e)},setSkin:function(t){if(t)if(this.skin)t._attachAll(this,this.skin);else for(var e=this.slots,i=0,r=e.length;r>i;i++){var n=e[i],o=n.data.attachmentName;if(o){var s=t.getAttachment(i,o);s&&n.setAttachment(s)}}this.skin=t},getAttachmentBySlotName:function(t,e){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(t),e) -},getAttachmentBySlotIndex:function(t,e){if(this.skin){var i=this.skin.getAttachment(t,e);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},setAttachment:function(t,e){for(var i=this.slots,r=0,n=i.length;n>r;r++){var o=i[r];if(o.data.name==t){var s=null;if(e&&(s=this.getAttachmentBySlotIndex(r,e),!s))throw"Attachment not found: "+e+", for slot: "+t;return void o.setAttachment(s)}}throw"Slot not found: "+t},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},update:function(t){this.time+=t}},i.EventData=function(t){this.name=t},i.EventData.prototype={intValue:0,floatValue:0,stringValue:null},i.Event=function(t){this.data=t},i.Event.prototype={intValue:0,floatValue:0,stringValue:null},i.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},i.RegionAttachment=function(t){this.name=t,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},i.RegionAttachment.prototype={type:i.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(t,e,i,r,n){var o=this.uvs;n?(o[2]=t,o[3]=r,o[4]=t,o[5]=e,o[6]=i,o[7]=e,o[0]=i,o[1]=r):(o[0]=t,o[1]=r,o[2]=t,o[3]=e,o[4]=i,o[5]=e,o[6]=i,o[7]=r)},updateOffset:function(){var t=this.width/this.regionOriginalWidth*this.scaleX,e=this.height/this.regionOriginalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.regionOffsetX*t,n=-this.height/2*this.scaleY+this.regionOffsetY*e,o=r+this.regionWidth*t,s=n+this.regionHeight*e,a=this.rotation*i.degRad,h=Math.cos(a),l=Math.sin(a),u=r*h+this.x,c=r*l,d=n*h+this.y,p=n*l,f=o*h+this.x,g=o*l,m=s*h+this.y,v=s*l,y=this.offset;y[0]=u-p,y[1]=d+c,y[2]=u-v,y[3]=m+c,y[4]=f-v,y[5]=m+g,y[6]=f-p,y[7]=d+g},computeVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.offset;r[0]=h[0]*n+h[1]*o+t,r[1]=h[0]*s+h[1]*a+e,r[2]=h[2]*n+h[3]*o+t,r[3]=h[2]*s+h[3]*a+e,r[4]=h[4]*n+h[5]*o+t,r[5]=h[4]*s+h[5]*a+e,r[6]=h[6]*n+h[7]*o+t,r[7]=h[6]*s+h[7]*a+e}},i.MeshAttachment=function(t){this.name=t},i.MeshAttachment.prototype={type:i.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n=i.bone;t+=n.worldX,e+=n.worldY;var o=n.m00,s=n.m01,a=n.m10,h=n.m11,l=this.vertices,u=l.length;i.attachmentVertices.length==u&&(l=i.attachmentVertices);for(var c=0;u>c;c+=2){var d=l[c],p=l[c+1];r[c]=d*o+p*s+t,r[c+1]=d*a+p*h+e}}},i.SkinnedMeshAttachment=function(t){this.name=t},i.SkinnedMeshAttachment.prototype={type:i.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n,o,s,a,h,l,u,c=i.bone.skeleton.bones,d=this.weights,p=this.bones,f=0,g=0,m=0,v=0,y=p.length;if(i.attachmentVertices.length)for(var x=i.attachmentVertices;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3,v+=2)a=c[p[g]],h=d[m]+x[v],l=d[m+1]+x[v+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}else for(;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3)a=c[p[g]],h=d[m],l=d[m+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}}},i.BoundingBoxAttachment=function(t){this.name=t,this.vertices=[]},i.BoundingBoxAttachment.prototype={type:i.AttachmentType.boundingbox,computeWorldVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;for(var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.vertices,l=0,u=h.length;u>l;l+=2){var c=h[l],d=h[l+1];r[l]=c*n+d*o+t,r[l+1]=c*s+d*a+e}}},i.AnimationStateData=function(t){this.skeletonData=t,this.animationToMixTime={}},i.AnimationStateData.prototype={defaultMix:0,setMixByName:function(t,e,i){var r=this.skeletonData.findAnimation(t);if(!r)throw"Animation not found: "+t;var n=this.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;this.setMix(r,n,i)},setMix:function(t,e,i){this.animationToMixTime[t.name+":"+e.name]=i},getMix:function(t,e){var i=t.name+":"+e.name;return this.animationToMixTime.hasOwnProperty(i)?this.animationToMixTime[i]:this.defaultMix}},i.TrackEntry=function(){},i.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},i.AnimationState=function(t){this.data=t,this.tracks=[],this.events=[]},i.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(t){t*=this.timeScale;for(var e=0;e=0&&this.setCurrent(e,n)):!i.loop&&i.lastTime>=i.endTime&&this.clearTrack(e)}}},apply:function(t){for(var e=0;eo&&(r=o);var a=i.previous;if(a){var h=a.time;!a.loop&&h>a.endTime&&(h=a.endTime),a.animation.apply(t,h,h,a.loop,null);var l=i.mixTime/i.mixDuration*i.mix;l>=1&&(l=1,i.previous=null),i.animation.mix(t,i.lastTime,r,s,this.events,l)}else 1==i.mix?i.animation.apply(t,i.lastTime,r,s,this.events):i.animation.mix(t,i.lastTime,r,s,this.events,i.mix);for(var u=0,c=this.events.length;c>u;u++){var d=this.events[u];i.onEvent&&i.onEvent(e,d),this.onEvent&&this.onEvent(e,d)}if(s?n%o>r%o:o>n&&r>=o){var p=Math.floor(r/o);i.onComplete&&i.onComplete(e,p),this.onComplete&&this.onComplete(e,p)}i.lastTime=i.time}}},clearTracks:function(){for(var t=0,e=this.tracks.length;e>t;t++)this.clearTrack(t);this.tracks.length=0},clearTrack:function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];e&&(e.onEnd&&e.onEnd(t),this.onEnd&&this.onEnd(t),this.tracks[t]=null)}},_expandToIndex:function(t){if(t=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(t,e){var i=this._expandToIndex(t);if(i){var r=i.previous;i.previous=null,i.onEnd&&i.onEnd(t),this.onEnd&&this.onEnd(t),e.mixDuration=this.data.getMix(i.animation,e.animation),e.mixDuration>0&&(e.mixTime=0,e.previous=r&&i.mixTime/i.mixDuration<.5?r:i)}this.tracks[t]=e,e.onStart&&e.onStart(t),this.onStart&&this.onStart(t)},setAnimationByName:function(t,e,i){var r=this.data.skeletonData.findAnimation(e);if(!r)throw"Animation not found: "+e;return this.setAnimation(t,r,i)},setAnimation:function(t,e,r){var n=new i.TrackEntry;return n.animation=e,n.loop=r,n.endTime=e.duration,this.setCurrent(t,n),n},addAnimationByName:function(t,e,i,r){var n=this.data.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;return this.addAnimation(t,n,i,r)},addAnimation:function(t,e,r,n){var o=new i.TrackEntry;o.animation=e,o.loop=r,o.endTime=e.duration;var s=this._expandToIndex(t);if(s){for(;s.next;)s=s.next;s.next=o}else this.tracks[t]=o;return 0>=n&&(s?n+=s.endTime-this.data.getMix(s.animation,e):n=0),o.delay=n,o},getCurrent:function(t){return t>=this.tracks.length?null:this.tracks[t]}},i.SkeletonJson=function(t){this.attachmentLoader=t},i.SkeletonJson.prototype={scale:1,readSkeletonData:function(t,e){var r=new i.SkeletonData;r.name=e;var n=t.skeleton;n&&(r.hash=n.hash,r.version=n.spine,r.width=n.width||0,r.height=n.height||0);for(var o=t.bones,s=0,a=o.length;a>s;s++){var h=o[s],l=null;if(h.parent&&(l=r.findBone(h.parent),!l))throw"Parent bone not found: "+h.parent;var u=new i.BoneData(h.name,l);u.length=(h.length||0)*this.scale,u.x=(h.x||0)*this.scale,u.y=(h.y||0)*this.scale,u.rotation=h.rotation||0,u.scaleX=h.hasOwnProperty("scaleX")?h.scaleX:1,u.scaleY=h.hasOwnProperty("scaleY")?h.scaleY:1,u.inheritScale=h.hasOwnProperty("inheritScale")?h.inheritScale:!0,u.inheritRotation=h.hasOwnProperty("inheritRotation")?h.inheritRotation:!0,r.bones.push(u)}var c=t.ik;if(c)for(var s=0,a=c.length;a>s;s++){for(var d=c[s],p=new i.IkConstraintData(d.name),o=d.bones,f=0,g=o.length;g>f;f++){var m=r.findBone(o[f]);if(!m)throw"IK bone not found: "+o[f];p.bones.push(m)}if(p.target=r.findBone(d.target),!p.target)throw"Target bone not found: "+d.target;p.bendDirection=!d.hasOwnProperty("bendPositive")||d.bendPositive?1:-1,p.mix=d.hasOwnProperty("mix")?d.mix:1,r.ikConstraints.push(p)}for(var v=t.slots,s=0,a=v.length;a>s;s++){var y=v[s],u=r.findBone(y.bone);if(!u)throw"Slot bone not found: "+y.bone;var x=new i.SlotData(y.name,u),b=y.color;b&&(x.r=this.toColor(b,0),x.g=this.toColor(b,1),x.b=this.toColor(b,2),x.a=this.toColor(b,3)),x.attachmentName=y.attachment,x.additiveBlending=y.additive&&"true"==y.additive,r.slots.push(x)}var w=t.skins;for(var T in w)if(w.hasOwnProperty(T)){var S=w[T],C=new i.Skin(T);for(var E in S)if(S.hasOwnProperty(E)){var A=r.findSlotIndex(E),_=S[E];for(var M in _)if(_.hasOwnProperty(M)){var L=this.readAttachment(C,M,_[M]);L&&C.addAttachment(A,M,L)}}r.skins.push(C),"default"==C.name&&(r.defaultSkin=C)}var R=t.events;for(var P in R)if(R.hasOwnProperty(P)){var F=R[P],B=new i.EventData(P);B.intValue=F["int"]||0,B.floatValue=F["float"]||0,B.stringValue=F.string||null,r.events.push(B)}var I=t.animations;for(var O in I)I.hasOwnProperty(O)&&this.readAnimation(O,I[O],r);return r},readAttachment:function(t,e,r){e=r.name||e;var n=i.AttachmentType[r.type||"region"],o=r.path||e,s=this.scale;if(n==i.AttachmentType.region){var a=this.attachmentLoader.newRegionAttachment(t,e,o);if(!a)return null;a.path=o,a.x=(r.x||0)*s,a.y=(r.y||0)*s,a.scaleX=r.hasOwnProperty("scaleX")?r.scaleX:1,a.scaleY=r.hasOwnProperty("scaleY")?r.scaleY:1,a.rotation=r.rotation||0,a.width=(r.width||0)*s,a.height=(r.height||0)*s;var h=r.color;return h&&(a.r=this.toColor(h,0),a.g=this.toColor(h,1),a.b=this.toColor(h,2),a.a=this.toColor(h,3)),a.updateOffset(),a}if(n==i.AttachmentType.mesh){var l=this.attachmentLoader.newMeshAttachment(t,e,o);return l?(l.path=o,l.vertices=this.getFloatArray(r,"vertices",s),l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=this.getFloatArray(r,"uvs",1),l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l):null}if(n==i.AttachmentType.skinnedmesh){var l=this.attachmentLoader.newSkinnedMeshAttachment(t,e,o);if(!l)return null;l.path=o;for(var u=this.getFloatArray(r,"uvs",1),c=this.getFloatArray(r,"vertices",1),d=[],p=[],f=0,g=c.length;g>f;){var m=0|c[f++];p[p.length]=m;for(var v=f+4*m;v>f;)p[p.length]=c[f],d[d.length]=c[f+1]*s,d[d.length]=c[f+2]*s,d[d.length]=c[f+3],f+=4}return l.bones=p,l.weights=d,l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=u,l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l}if(n==i.AttachmentType.boundingbox){for(var y=this.attachmentLoader.newBoundingBoxAttachment(t,e),c=r.vertices,f=0,g=c.length;g>f;f++)y.vertices.push(c[f]*s);return y}throw"Unknown attachment type: "+n},readAnimation:function(t,e,r){var n=[],o=0,s=e.slots;for(var a in s)if(s.hasOwnProperty(a)){var h=s[a],l=r.findSlotIndex(a);for(var u in h)if(h.hasOwnProperty(u)){var c=h[u];if("color"==u){var d=new i.ColorTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],v=m.color,y=this.toColor(v,0),x=this.toColor(v,1),b=this.toColor(v,2),w=this.toColor(v,3);d.setFrame(p,m.time,y,x,b,w),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[5*d.getFrameCount()-5])}else{if("attachment"!=u)throw"Invalid timeline type for a slot: "+u+" ("+a+")";var d=new i.AttachmentTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p++,m.time,m.name)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}}}var T=e.bones;for(var S in T)if(T.hasOwnProperty(S)){var C=r.findBoneIndex(S);if(-1==C)throw"Bone not found: "+S;var E=T[S];for(var u in E)if(E.hasOwnProperty(u)){var c=E[u];if("rotate"==u){var d=new i.RotateTimeline(c.length);d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m.angle),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}else if("translate"==u||"scale"==u){var d,A=1;"scale"==u?d=new i.ScaleTimeline(c.length):(d=new i.TranslateTimeline(c.length),A=this.scale),d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],_=(m.x||0)*A,M=(m.y||0)*A;d.setFrame(p,m.time,_,M),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.getFrameCount()-3])}else{if("flipX"!=u&&"flipY"!=u)throw"Invalid timeline type for a bone: "+u+" ("+S+")";var _="flipX"==u,d=_?new i.FlipXTimeline(c.length):new i.FlipYTimeline(c.length);d.boneIndex=C;for(var L=_?"x":"y",p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m[L]||!1),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}}}var R=e.ik;for(var P in R)if(R.hasOwnProperty(P)){var F=r.findIkConstraint(P),c=R[P],d=new i.IkConstraintTimeline(c.length);d.ikConstraintIndex=r.ikConstraints.indexOf(F);for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],B=m.hasOwnProperty("mix")?m.mix:1,I=!m.hasOwnProperty("bendPositive")||m.bendPositive?1:-1;d.setFrame(p,m.time,B,I),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.frameCount-3])}var O=e.ffd;for(var D in O){var k=r.findSkin(D),h=O[D];for(a in h){var l=r.findSlotIndex(a),G=h[a];for(var N in G){var c=G[N],d=new i.FfdTimeline(c.length),U=k.getAttachment(l,N);if(!U)throw"FFD attachment not found: "+N;d.slotIndex=l,d.attachment=U;var j,V=U.type==i.AttachmentType.mesh;j=V?U.vertices.length:U.weights.length/3*2;for(var p=0,f=0,g=c.length;g>f;f++){var W,m=c[f];if(m.vertices){var H=m.vertices,W=[];W.length=j;var Y=m.offset||0,X=H.length;if(1==this.scale)for(var z=0;X>z;z++)W[z+Y]=H[z];else for(var z=0;X>z;z++)W[z+Y]=H[z]*this.scale;if(V)for(var q=U.vertices,z=0,X=W.length;X>z;z++)W[z]+=q[z]}else V?W=U.vertices:(W=[],W.length=j);d.setFrame(p,m.time,W),this.readCurve(d,p,m),p++}n[n.length]=d,o=Math.max(o,d.frames[d.frameCount-1])}}}var K=e.drawOrder;if(K||(K=e.draworder),K){for(var d=new i.DrawOrderTimeline(K.length),$=r.slots.length,p=0,f=0,g=K.length;g>f;f++){var Q=K[f],J=null;if(Q.offsets){J=[],J.length=$;for(var z=$-1;z>=0;z--)J[z]=-1;var Z=Q.offsets,te=[];te.length=$-Z.length;for(var ee=0,ie=0,z=0,X=Z.length;X>z;z++){var re=Z[z],l=r.findSlotIndex(re.slot);if(-1==l)throw"Slot not found: "+re.slot;for(;ee!=l;)te[ie++]=ee++;J[ee+re.offset]=ee++}for(;$>ee;)te[ie++]=ee++;for(var z=$-1;z>=0;z--)-1==J[z]&&(J[z]=te[--ie])}d.setFrame(p++,Q.time,J)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}var ne=e.events;if(ne){for(var d=new i.EventTimeline(ne.length),p=0,f=0,g=ne.length;g>f;f++){var oe=ne[f],se=r.findEvent(oe.name);if(!se)throw"Event not found: "+oe.name;var ae=new i.Event(se);ae.intValue=oe.hasOwnProperty("int")?oe["int"]:se.intValue,ae.floatValue=oe.hasOwnProperty("float")?oe["float"]:se.floatValue,ae.stringValue=oe.hasOwnProperty("string")?oe.string:se.stringValue,d.setFrame(p++,oe.time,ae)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}r.animations.push(new i.Animation(t,n,o))},readCurve:function(t,e,i){var r=i.curve;r?"stepped"==r?t.curves.setStepped(e):r instanceof Array&&t.curves.setCurve(e,r[0],r[1],r[2],r[3]):t.curves.setLinear(e)},toColor:function(t,e){if(8!=t.length)throw"Color hexidecimal length must be 8, recieved: "+t;return parseInt(t.substring(2*e,2*e+2),16)/255},getFloatArray:function(t,e,r){var n=t[e],o=new i.Float32Array(n.length),s=0,a=n.length;if(1==r)for(;a>s;s++)o[s]=n[s];else for(;a>s;s++)o[s]=n[s]*r;return o},getIntArray:function(t,e){for(var r=t[e],n=new i.Uint16Array(r.length),o=0,s=r.length;s>o;o++)n[o]=0|r[o];return n}},i.Atlas=function(t,e){this.textureLoader=e,this.pages=[],this.regions=[];var r=new i.AtlasReader(t),n=[];n.length=4;for(var o=null;;){var s=r.readLine();if(null===s)break;if(s=r.trim(s),s.length)if(o){var a=new i.AtlasRegion;a.name=s,a.page=o,a.rotate="true"==r.readValue(),r.readTuple(n);var h=parseInt(n[0]),l=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);a.u=h/o.width,a.v=l/o.height,a.rotate?(a.u2=(h+c)/o.width,a.v2=(l+u)/o.height):(a.u2=(h+u)/o.width,a.v2=(l+c)/o.height),a.x=h,a.y=l,a.width=Math.abs(u),a.height=Math.abs(c),4==r.readTuple(n)&&(a.splits=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],4==r.readTuple(n)&&(a.pads=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],r.readTuple(n))),a.originalWidth=parseInt(n[0]),a.originalHeight=parseInt(n[1]),r.readTuple(n),a.offsetX=parseInt(n[0]),a.offsetY=parseInt(n[1]),a.index=parseInt(r.readValue()),this.regions.push(a)}else{o=new i.AtlasPage,o.name=s,2==r.readTuple(n)&&(o.width=parseInt(n[0]),o.height=parseInt(n[1]),r.readTuple(n)),o.format=i.Atlas.Format[n[0]],r.readTuple(n),o.minFilter=i.Atlas.TextureFilter[n[0]],o.magFilter=i.Atlas.TextureFilter[n[1]];var d=r.readValue();o.uWrap=i.Atlas.TextureWrap.clampToEdge,o.vWrap=i.Atlas.TextureWrap.clampToEdge,"x"==d?o.uWrap=i.Atlas.TextureWrap.repeat:"y"==d?o.vWrap=i.Atlas.TextureWrap.repeat:"xy"==d&&(o.uWrap=o.vWrap=i.Atlas.TextureWrap.repeat),e.load(o,s,this),this.pages.push(o)}else o=null}},i.Atlas.prototype={findRegion:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},dispose:function(){for(var t=this.pages,e=0,i=t.length;i>e;e++)this.textureLoader.unload(t[e].rendererObject)},updateUVs:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++){var n=e[i];n.page==t&&(n.u=n.x/t.width,n.v=n.y/t.height,n.rotate?(n.u2=(n.x+n.height)/t.width,n.v2=(n.y+n.width)/t.height):(n.u2=(n.x+n.width)/t.width,n.v2=(n.y+n.height)/t.height))}}},i.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},i.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},i.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},i.AtlasPage=function(){},i.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},i.AtlasRegion=function(){},i.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},i.AtlasReader=function(t){this.lines=t.split(/\r\n|\r|\n/)},i.AtlasReader.prototype={index:0,trim:function(t){return t.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw"Invalid line: "+t;return this.trim(t.substring(e+1))},readTuple:function(t){var e=this.readLine(),i=e.indexOf(":");if(-1==i)throw"Invalid line: "+e;for(var r=0,n=i+1;3>r;r++){var o=e.indexOf(",",n);if(-1==o)break;t[r]=this.trim(e.substr(n,o-n)),n=o+1}return t[r]=this.trim(e.substring(n)),r+1}},i.AtlasAttachmentLoader=function(t){this.atlas=t},i.AtlasAttachmentLoader.prototype={newRegionAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (region attachment: "+e+")";var o=new i.RegionAttachment(e);return o.rendererObject=n,o.setUVs(n.u,n.v,n.u2,n.v2,n.rotate),o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (mesh attachment: "+e+")";var o=new i.MeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newSkinnedMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (skinned mesh attachment: "+e+")";var o=new i.SkinnedMeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newBoundingBoxAttachment:function(t,e){return new i.BoundingBoxAttachment(e)}},i.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},i.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(t,e){var r=t.slots,n=r.length,o=t.x,s=t.y,a=this.boundingBoxes,h=this.polygonPool,l=this.polygons;a.length=0;for(var u=0,c=l.length;c>u;u++)h.push(l[u]);l.length=0;for(var u=0;n>u;u++){var d=r[u],p=d.attachment;if(p.type==i.AttachmentType.boundingbox){a.push(p);var f,g=h.length;g>0?(f=h[g-1],h.splice(g-1,1)):f=[],l.push(f),f.length=p.vertices.length,p.computeWorldVertices(o,s,d.bone,f)}}e&&this.aabbCompute()},aabbCompute:function(){for(var t=this.polygons,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=Number.MIN_VALUE,n=Number.MIN_VALUE,o=0,s=t.length;s>o;o++)for(var a=t[o],h=0,l=a.length;l>h;h+=2){var u=a[h],c=a[h+1];e=Math.min(e,u),i=Math.min(i,c),r=Math.max(r,u),n=Math.max(n,c)}this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},aabbContainsPoint:function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},aabbIntersectsSegment:function(t,e,i,r){var n=this.minX,o=this.minY,s=this.maxX,a=this.maxY;if(n>=t&&n>=i||o>=e&&o>=r||t>=s&&i>=s||e>=a&&r>=a)return!1;var h=(r-e)/(i-t),l=h*(n-t)+e;if(l>o&&a>l)return!0;if(l=h*(s-t)+e,l>o&&a>l)return!0;var u=(o-e)/h+t;return u>n&&s>u?!0:(u=(a-e)/h+t,u>n&&s>u?!0:!1)},aabbIntersectsSkeleton:function(t){return this.minXt.minX&&this.minYt.minY},containsPoint:function(t,e){for(var i=this.polygons,r=0,n=i.length;n>r;r++)if(this.polygonContainsPoint(i[r],t,e))return this.boundingBoxes[r];return null},intersectsSegment:function(t,e,i,r){for(var n=this.polygons,o=0,s=n.length;s>o;o++)if(n[o].intersectsSegment(t,e,i,r))return this.boundingBoxes[o];return null},polygonContainsPoint:function(t,e,i){for(var r=t.length,n=r-2,o=!1,s=0;r>s;s+=2){var a=t[s+1],h=t[n+1];if(i>a&&h>=i||i>h&&a>=i){var l=t[s];l+(i-a)/(h-a)*(t[n]-l)c;c+=2){var d=t[c],p=t[c+1],f=l*p-u*d,g=l-d,m=u-p,v=s*m-a*g,y=(h*g-s*f)/v;if((y>=l&&d>=y||y>=d&&l>=y)&&(y>=e&&r>=y||y>=r&&e>=y)){var x=(h*m-a*f)/v;if((x>=u&&p>=x||x>=p&&u>=x)&&(x>=i&&n>=x||x>=n&&i>=x))return!0}l=d,u=p}return!1},getPolygon:function(t){var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}},i.Bone.yDown=!0,e.AnimCache={},e.SpineTextureLoader=function(t,i){e.EventTarget.call(this),this.basePath=t,this.crossorigin=i,this.loadingCount=0},e.SpineTextureLoader.prototype=e.SpineTextureLoader,e.SpineTextureLoader.prototype.load=function(t,i){if(t.rendererObject=e.BaseTexture.fromImage(this.basePath+"/"+i,this.crossorigin),!t.rendererObject.hasLoaded){var r=this;++r.loadingCount,t.rendererObject.addEventListener("loaded",function(){--r.loadingCount,r.dispatchEvent({type:"loadedBaseTexture",content:r})})}},e.SpineTextureLoader.prototype.unload=function(t){t.destroy(!0)},e.Spine=function(t){if(e.DisplayObjectContainer.call(this),this.spineData=e.AnimCache[t],!this.spineData)throw new Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: "+t);this.skeleton=new i.Skeleton(this.spineData),this.skeleton.updateWorldTransform(),this.stateData=new i.AnimationStateData(this.spineData),this.state=new i.AnimationState(this.stateData),this.slotContainers=[];for(var r=0,n=this.skeleton.drawOrder.length;n>r;r++){var o=this.skeleton.drawOrder[r],s=o.attachment,a=new e.DisplayObjectContainer;if(this.slotContainers.push(a),this.addChild(a),s instanceof i.RegionAttachment){var h=s.rendererObject.name,l=this.createSprite(o,s);o.currentSprite=l,o.currentSpriteName=h,a.addChild(l)}else{if(!(s instanceof i.MeshAttachment))continue;var u=this.createMesh(o,s);o.currentMesh=u,o.currentMeshName=s.name,a.addChild(u)}}this.autoUpdate=!0},e.Spine.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Spine.prototype.constructor=e.Spine,Object.defineProperty(e.Spine.prototype,"autoUpdate",{get:function(){return this.updateTransform===e.Spine.prototype.autoUpdateTransform},set:function(t){this.updateTransform=t?e.Spine.prototype.autoUpdateTransform:e.DisplayObjectContainer.prototype.updateTransform}}),e.Spine.prototype.update=function(t){this.state.update(t),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var r=this.skeleton.drawOrder,n=0,o=r.length;o>n;n++){var s=r[n],a=s.attachment,h=this.slotContainers[n];if(a){var l=a.type;if(l===i.AttachmentType.region){if(a.rendererObject&&(!s.currentSpriteName||s.currentSpriteName!==a.name)){var u=a.rendererObject.name;if(void 0!==s.currentSprite&&(s.currentSprite.visible=!1),s.sprites=s.sprites||{},void 0!==s.sprites[u])s.sprites[u].visible=!0;else{var c=this.createSprite(s,a);h.addChild(c)}s.currentSprite=s.sprites[u],s.currentSpriteName=u}var d=s.bone;h.position.x=d.worldX+a.x*d.m00+a.y*d.m01,h.position.y=d.worldY+a.x*d.m10+a.y*d.m11,h.scale.x=d.worldScaleX,h.scale.y=d.worldScaleY,h.rotation=-(s.bone.worldRotation*i.degRad),s.currentSprite.tint=e.rgb2hex([s.r,s.g,s.b])}else{if(l!==i.AttachmentType.skinnedmesh){h.visible=!1;continue}if(!s.currentMeshName||s.currentMeshName!==a.name){var p=a.name;if(void 0!==s.currentMesh&&(s.currentMesh.visible=!1),s.meshes=s.meshes||{},void 0!==s.meshes[p])s.meshes[p].visible=!0;else{var f=this.createMesh(s,a);h.addChild(f)}s.currentMesh=s.meshes[p],s.currentMeshName=p}a.computeWorldVertices(s.bone.skeleton.x,s.bone.skeleton.y,s,s.currentMesh.vertices)}h.visible=!0,h.alpha=s.a}else h.visible=!1}},e.Spine.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var t=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(t),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.Spine.prototype.createSprite=function(t,r){var n=r.rendererObject,o=n.page.rendererObject,s=new e.Rectangle(n.x,n.y,n.rotate?n.height:n.width,n.rotate?n.width:n.height),a=new e.Texture(o,s),h=new e.Sprite(a),l=n.rotate?.5*Math.PI:0;return h.scale.set(n.width/n.originalWidth,n.height/n.originalHeight),h.rotation=l-r.rotation*i.degRad,h.anchor.x=h.anchor.y=.5,t.sprites=t.sprites||{},t.sprites[n.name]=h,h},e.Spine.prototype.createMesh=function(t,i){var r=i.rendererObject,n=r.page.rendererObject,o=new e.Texture(n),s=new e.Strip(o);return s.drawMode=e.Strip.DrawModes.TRIANGLES,s.canvasPadding=1.5,s.vertices=new e.Float32Array(i.uvs.length),s.uvs=i.uvs,s.indices=i.triangles,t.meshes=t.meshes||{},t.meshes[i.name]=s,s},e.BaseTextureCache={},e.BaseTextureCacheIdGenerator=0,e.BaseTexture=function(t,i){if(this.resolution=1,this.width=100,this.height=100,this.scaleMode=i||e.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=t,this._UID=e._UID++,this.premultipliedAlpha=!0,this._glTextures=[],this.mipmap=!1,this._dirty=[!0,!0,!0,!0],t){if((this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this.hasLoaded=!0,this.width=this.source.naturalWidth||this.source.width,this.height=this.source.naturalHeight||this.source.height,this.dirty();else{var r=this;this.source.onload=function(){r.hasLoaded=!0,r.width=r.source.naturalWidth||r.source.width,r.height=r.source.naturalHeight||r.source.height,r.dirty(),r.dispatchEvent({type:"loaded",content:r})},this.source.onerror=function(){r.dispatchEvent({type:"error",content:r})}}this.imageUrl=null,this._powerOf2=!1}},e.BaseTexture.prototype.constructor=e.BaseTexture,e.EventTarget.mixin(e.BaseTexture.prototype),e.BaseTexture.prototype.destroy=function(){this.imageUrl?(delete e.BaseTextureCache[this.imageUrl],delete e.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete e.BaseTextureCache[this.source._pixiId],this.source=null,this.unloadFromGPU()},e.BaseTexture.prototype.updateSourceImage=function(t){this.hasLoaded=!1,this.source.src=null,this.source.src=t},e.BaseTexture.prototype.dirty=function(){for(var t=0;t=0;t--){var i=this._glTextures[t],r=e.glContexts[t];r&&i&&r.deleteTexture(i)}this._glTextures.length=0,this.dirty()},e.BaseTexture.fromImage=function(t,i,r){var n=e.BaseTextureCache[t];if(void 0===i&&-1===t.indexOf("data:")&&(i=!0),!n){var o=new Image;i&&(o.crossOrigin=""),o.src=t,n=new e.BaseTexture(o,r),n.imageUrl=t,e.BaseTextureCache[t]=n,-1!==t.indexOf(e.RETINA_PREFIX+".")&&(n.resolution=2)}return n},e.BaseTexture.fromCanvas=function(t,i){t._pixiId||(t._pixiId="canvas_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.BaseTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.TextureCache={},e.FrameCache={},e.TextureCacheIdGenerator=0,e.Texture=function(t,i,r,n){this.noFrame=!1,i||(this.noFrame=!0,i=new e.Rectangle(0,0,1,1)),t instanceof e.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=i,this.trim=n,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=r||new e.Rectangle(0,0,1,1),t.hasLoaded?(this.noFrame&&(i=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(i)):t.addEventListener("loaded",this.onBaseTextureLoaded.bind(this))},e.Texture.prototype.constructor=e.Texture,e.EventTarget.mixin(e.Texture.prototype),e.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;t.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame),this.dispatchEvent({type:"update",content:this})},e.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},e.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,!this.trim&&(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this); -this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs()},e.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new e.TextureUvs);var t=this.crop,i=this.baseTexture.width,r=this.baseTexture.height;this._uvs.x0=t.x/i,this._uvs.y0=t.y/r,this._uvs.x1=(t.x+t.width)/i,this._uvs.y1=t.y/r,this._uvs.x2=(t.x+t.width)/i,this._uvs.y2=(t.y+t.height)/r,this._uvs.x3=t.x/i,this._uvs.y3=(t.y+t.height)/r},e.Texture.fromImage=function(t,i,r){var n=e.TextureCache[t];return n||(n=new e.Texture(e.BaseTexture.fromImage(t,i,r)),e.TextureCache[t]=n),n},e.Texture.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache ');return i},e.Texture.fromCanvas=function(t,i){var r=e.BaseTexture.fromCanvas(t,i);return new e.Texture(r)},e.Texture.addTextureToCache=function(t,i){e.TextureCache[i]=t},e.Texture.removeTextureFromCache=function(t){var i=e.TextureCache[t];return delete e.TextureCache[t],delete e.BaseTextureCache[t],i},e.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},e.Texture.emptyTexture=new e.Texture(new e.BaseTexture),e.RenderTexture=function(t,i,r,n,o){if(this.width=t||100,this.height=i||100,this.resolution=o||1,this.frame=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.baseTexture=new e.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=n||e.scaleModes.DEFAULT,this.baseTexture.hasLoaded=!0,e.Texture.call(this,this.baseTexture,new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution)),this.renderer=r||e.defaultRenderer,this.renderer.type===e.WEBGL_RENDERER){var s=this.renderer.gl;this.baseTexture._dirty[s.id]=!1,this.textureBuffer=new e.FilterTexture(s,this.width,this.height,this.baseTexture.scaleMode),this.baseTexture._glTextures[s.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new e.Point(.5*this.width,.5*-this.height)}else this.render=this.renderCanvas,this.textureBuffer=new e.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()},e.RenderTexture.prototype=Object.create(e.Texture.prototype),e.RenderTexture.prototype.constructor=e.RenderTexture,e.RenderTexture.prototype.resize=function(t,i,r){(t!==this.width||i!==this.height)&&(this.valid=t>0&&i>0,this.width=t,this.height=i,this.frame.width=this.crop.width=t*this.resolution,this.frame.height=this.crop.height=i*this.resolution,r&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===e.WEBGL_RENDERER&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},e.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===e.WEBGL_RENDERER&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},e.RenderTexture.prototype.renderWebGL=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),r.translate(0,2*this.projection.y),e&&r.append(e),r.scale(1,-1),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();var a=this.renderer.gl;a.viewport(0,0,this.width*this.resolution,this.height*this.resolution),a.bindFramebuffer(a.FRAMEBUFFER,this.textureBuffer.frameBuffer),i&&this.textureBuffer.clear(),this.renderer.spriteBatch.dirty=!0,this.renderer.renderDisplayObject(t,this.projection,this.textureBuffer.frameBuffer),this.renderer.spriteBatch.dirty=!0}},e.RenderTexture.prototype.renderCanvas=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),e&&r.append(e),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();i&&this.textureBuffer.clear();var a=this.textureBuffer.context,h=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(t,a),this.renderer.resolution=h}},e.RenderTexture.prototype.getImage=function(){var t=new Image;return t.src=this.getBase64(),t},e.RenderTexture.prototype.getBase64=function(){return this.getCanvas().toDataURL()},e.RenderTexture.prototype.getCanvas=function(){if(this.renderer.type===e.WEBGL_RENDERER){var t=this.renderer.gl,i=this.textureBuffer.width,r=this.textureBuffer.height,n=new Uint8Array(4*i*r);t.bindFramebuffer(t.FRAMEBUFFER,this.textureBuffer.frameBuffer),t.readPixels(0,0,i,r,t.RGBA,t.UNSIGNED_BYTE,n),t.bindFramebuffer(t.FRAMEBUFFER,null);var o=new e.CanvasBuffer(i,r),s=o.context.getImageData(0,0,i,r);return s.data.set(n),o.context.putImageData(s,0,0),o.canvas}return this.textureBuffer.canvas},e.RenderTexture.tempMatrix=new e.Matrix,e.VideoTexture=function(t,i){if(!t)throw new Error("No video source element specified.");(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),e.BaseTexture.call(this,t,i),this.autoUpdate=!1,this.updateBound=this._onUpdate.bind(this),t.complete||(this._onCanPlay=this.onCanPlay.bind(this),t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("play",this.onPlayStart.bind(this)),t.addEventListener("pause",this.onPlayStop.bind(this)))},e.VideoTexture.prototype=Object.create(e.BaseTexture.prototype),e.VideoTexture.constructor=e.VideoTexture,e.VideoTexture.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this.updateBound),this.dirty())},e.VideoTexture.prototype.onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this.updateBound),this.autoUpdate=!0)},e.VideoTexture.prototype.onPlayStop=function(){this.autoUpdate=!1},e.VideoTexture.prototype.onCanPlay=function(){"canplaythrough"===event.type&&(this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.__loaded||(this.__loaded=!0,this.dispatchEvent({type:"loaded",content:this}))))},e.VideoTexture.prototype.destroy=function(){this.source&&this.source._pixiId&&(e.BaseTextureCache[this.source._pixiId]=null,delete e.BaseTextureCache[this.source._pixiId],this.source._pixiId=null,delete this.source._pixiId),e.BaseTexture.prototype.destroy.call(this)},e.VideoTexture.baseTextureFromVideo=function(t,i){t._pixiId||(t._pixiId="video_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.VideoTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.VideoTexture.textureFromVideo=function(t,i){var r=e.VideoTexture.baseTextureFromVideo(t,i);return new e.Texture(r)},e.VideoTexture.fromUrl=function(t,i){var r=document.createElement("video");return r.src=t,r.autoPlay=!0,r.play(),e.VideoTexture.textureFromVideo(r,i)},e.AssetLoader=function(t,i){this.assetURLs=t,this.crossorigin=i,this.loadersByType={jpg:e.ImageLoader,jpeg:e.ImageLoader,png:e.ImageLoader,gif:e.ImageLoader,webp:e.ImageLoader,json:e.JsonLoader,atlas:e.AtlasLoader,anim:e.SpineLoader,xml:e.BitmapFontLoader,fnt:e.BitmapFontLoader}},e.EventTarget.mixin(e.AssetLoader.prototype),e.AssetLoader.prototype.constructor=e.AssetLoader,e.AssetLoader.prototype._getDataType=function(t){var e="data:",i=t.slice(0,e.length).toLowerCase();if(i===e){var r=t.slice(e.length),n=r.indexOf(",");if(-1===n)return null;var o=r.slice(0,n).split(";")[0];return o&&"text/plain"!==o.toLowerCase()?o.split("/").pop().toLowerCase():"txt"}return null},e.AssetLoader.prototype.load=function(){function t(t){e.onAssetLoaded(t.data.content)}var e=this;this.loadCount=this.assetURLs.length;for(var i=0;i0?t.addEventListener("loadedBaseTexture",function(t){t.content.content.loadingCount<=0&&f.onLoaded()}):f.onLoaded()},p.load()}else this.onLoaded()},e.JsonLoader.prototype.onLoaded=function(){this.loaded=!0,this.dispatchEvent({type:"loaded",content:this})},e.JsonLoader.prototype.onError=function(){this.dispatchEvent({type:"error",content:this})},e.AtlasLoader=function(t,e){this.url=t,this.baseUrl=t.replace(/[^\/]*$/,""),this.crossorigin=e,this.loaded=!1},e.AtlasLoader.constructor=e.AtlasLoader,e.EventTarget.mixin(e.AtlasLoader.prototype),e.AtlasLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onAtlasLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/json"),this.ajaxRequest.send(null)},e.AtlasLoader.prototype.onAtlasLoaded=function(){if(4===this.ajaxRequest.readyState)if(200===this.ajaxRequest.status||-1===window.location.href.indexOf("http")){this.atlas={meta:{image:[]},frames:[]};var t=this.ajaxRequest.responseText.split(/\r?\n/),i=-3,r=0,n=null,o=!1,s=0,a=0,h=this.onLoaded.bind(this);for(s=0;s0){if(o===s)this.atlas.meta.image.push(t[s]),r=this.atlas.meta.image.length-1,this.atlas.frames.push({}),i=-3;else if(i>0)if(i%7===1)null!=n&&(this.atlas.frames[r][n.name]=n),n={name:t[s],frame:{}};else{var l=t[s].split(" ");if(i%7===3)n.frame.x=Number(l[1].replace(",","")),n.frame.y=Number(l[2]);else if(i%7===4)n.frame.w=Number(l[1].replace(",","")),n.frame.h=Number(l[2]);else if(i%7===5){var u={x:0,y:0,w:Number(l[1].replace(",","")),h:Number(l[2])};u.w>n.frame.w||u.h>n.frame.h?(n.trimmed=!0,n.realSize=u):n.trimmed=!1}}i++}if(null!=n&&(this.atlas.frames[r][n.name]=n),this.atlas.meta.image.length>0){for(this.images=[],a=0;athis.currentImageId?(this.currentImageId++,this.images[this.currentImageId].load()):(this.loaded=!0,this.emit("loaded",{content:this}))},e.AtlasLoader.prototype.onError=function(){this.emit("error",{content:this})},e.SpriteSheetLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null,this.frames={}},e.SpriteSheetLoader.prototype.constructor=e.SpriteSheetLoader,e.EventTarget.mixin(e.SpriteSheetLoader.prototype),e.SpriteSheetLoader.prototype.load=function(){var t=this,i=new e.JsonLoader(this.url,this.crossorigin);i.on("loaded",function(e){t.json=e.data.content.json,t.onLoaded()}),i.load()},e.SpriteSheetLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader=function(t,i){this.texture=e.Texture.fromImage(t,i),this.frames=[]},e.ImageLoader.prototype.constructor=e.ImageLoader,e.EventTarget.mixin(e.ImageLoader.prototype),e.ImageLoader.prototype.load=function(){this.texture.baseTexture.hasLoaded?this.onLoaded():this.texture.baseTexture.on("loaded",this.onLoaded.bind(this))},e.ImageLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader.prototype.loadFramedSpriteSheet=function(t,i,r){this.frames=[];for(var n=Math.floor(this.texture.width/t),o=Math.floor(this.texture.height/i),s=0,a=0;o>a;a++)for(var h=0;n>h;h++,s++){var l=new e.Texture(this.texture.baseTexture,{x:h*t,y:a*i,width:t,height:i});this.frames.push(l),r&&(e.TextureCache[r+"-"+s]=l)}this.load()},e.BitmapFontLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null},e.BitmapFontLoader.prototype.constructor=e.BitmapFontLoader,e.EventTarget.mixin(e.BitmapFontLoader.prototype),e.BitmapFontLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onXMLLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/xml"),this.ajaxRequest.send(null)},e.BitmapFontLoader.prototype.onXMLLoaded=function(){if(4===this.ajaxRequest.readyState&&(200===this.ajaxRequest.status||-1===window.location.protocol.indexOf("http"))){var t=this.ajaxRequest.responseXML;if(!t||/MSIE 9/i.test(navigator.userAgent)||navigator.isCocoonJS)if("function"==typeof window.DOMParser){var i=new DOMParser;t=i.parseFromString(this.ajaxRequest.responseText,"text/xml")}else{var r=document.createElement("div");r.innerHTML=this.ajaxRequest.responseText,t=r}var n=this.baseUrl+t.getElementsByTagName("page")[0].getAttribute("file"),o=new e.ImageLoader(n,this.crossorigin);this.texture=o.texture.baseTexture;var s={},a=t.getElementsByTagName("info")[0],h=t.getElementsByTagName("common")[0];s.font=a.getAttribute("face"),s.size=parseInt(a.getAttribute("size"),10),s.lineHeight=parseInt(h.getAttribute("lineHeight"),10),s.chars={};for(var l=t.getElementsByTagName("char"),u=0;ut;t++)this.shaders[t].dirty=!0},e.AlphaMaskFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={mask:{type:"sampler2D",value:t},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mask.value.x=t.width,this.uniforms.mask.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D mask;","uniform sampler2D uSampler;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," mapCords *= dimensions.xy / mapDimensions;"," vec4 original = texture2D(uSampler, vTextureCoord);"," float maskAlpha = texture2D(mask, mapCords).r;"," original *= maskAlpha;"," gl_FragColor = original;","}"]},e.AlphaMaskFilter.prototype=Object.create(e.AbstractFilter.prototype),e.AlphaMaskFilter.prototype.constructor=e.AlphaMaskFilter,e.AlphaMaskFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.mask.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.mask.value.height,this.uniforms.mask.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.AlphaMaskFilter.prototype,"map",{get:function(){return this.uniforms.mask.value},set:function(t){this.uniforms.mask.value=t}}),e.ColorMatrixFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={matrix:{type:"mat4",value:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform mat4 matrix;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * matrix;","}"]},e.ColorMatrixFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorMatrixFilter.prototype.constructor=e.ColorMatrixFilter,Object.defineProperty(e.ColorMatrixFilter.prototype,"matrix",{get:function(){return this.uniforms.matrix.value},set:function(t){this.uniforms.matrix.value=t}}),e.GrayFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={gray:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float gray;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);","}"]},e.GrayFilter.prototype=Object.create(e.AbstractFilter.prototype),e.GrayFilter.prototype.constructor=e.GrayFilter,Object.defineProperty(e.GrayFilter.prototype,"gray",{get:function(){return this.uniforms.gray.value},set:function(t){this.uniforms.gray.value=t}}),e.DisplacementFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={displacementMap:{type:"sampler2D",value:t},scale:{type:"2f",value:{x:30,y:30}},offset:{type:"2f",value:{x:0,y:0}},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mapDimensions.value.x=t.width,this.uniforms.mapDimensions.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D displacementMap;","uniform sampler2D uSampler;","uniform vec2 scale;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," vec2 matSample = texture2D(displacementMap, mapCords).xy;"," matSample -= 0.5;"," matSample *= scale;"," matSample /= mapDimensions;"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);"," vec2 cord = vTextureCoord;","}"]},e.DisplacementFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DisplacementFilter.prototype.constructor=e.DisplacementFilter,e.DisplacementFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.displacementMap.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.displacementMap.value.height,this.uniforms.displacementMap.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.DisplacementFilter.prototype,"map",{get:function(){return this.uniforms.displacementMap.value},set:function(t){this.uniforms.displacementMap.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.uniforms.scale.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.uniforms.offset.value=t}}),e.PixelateFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:0},dimensions:{type:"4fv",value:new e.Float32Array([1e4,100,10,10])},pixelSize:{type:"2f",value:{x:10,y:10}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 testDim;","uniform vec4 dimensions;","uniform vec2 pixelSize;","uniform sampler2D uSampler;","void main(void) {"," vec2 coord = vTextureCoord;"," vec2 size = dimensions.xy/pixelSize;"," vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;"," gl_FragColor = texture2D(uSampler, color);","}"]},e.PixelateFilter.prototype=Object.create(e.AbstractFilter.prototype),e.PixelateFilter.prototype.constructor=e.PixelateFilter,Object.defineProperty(e.PixelateFilter.prototype,"size",{get:function(){return this.uniforms.pixelSize.value},set:function(t){this.dirty=!0,this.uniforms.pixelSize.value=t}}),e.BlurXFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurXFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurXFilter.prototype.constructor=e.BlurXFilter,Object.defineProperty(e.BlurXFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.dirty=!0,this.uniforms.blur.value=1/7e3*t}}),e.BlurYFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurYFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurYFilter.prototype.constructor=e.BlurYFilter,Object.defineProperty(e.BlurYFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.BlurFilter=function(){this.blurXFilter=new e.BlurXFilter,this.blurYFilter=new e.BlurYFilter,this.passes=[this.blurXFilter,this.blurYFilter]},e.BlurFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurFilter.prototype.constructor=e.BlurFilter,Object.defineProperty(e.BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t}}),e.InvertFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);","}"]},e.InvertFilter.prototype=Object.create(e.AbstractFilter.prototype),e.InvertFilter.prototype.constructor=e.InvertFilter,Object.defineProperty(e.InvertFilter.prototype,"invert",{get:function(){return this.uniforms.invert.value},set:function(t){this.uniforms.invert.value=t}}),e.SepiaFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={sepia:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float sepia;","uniform sampler2D uSampler;","const mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);","}"]},e.SepiaFilter.prototype=Object.create(e.AbstractFilter.prototype),e.SepiaFilter.prototype.constructor=e.SepiaFilter,Object.defineProperty(e.SepiaFilter.prototype,"sepia",{get:function(){return this.uniforms.sepia.value},set:function(t){this.uniforms.sepia.value=t}}),e.TwistFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"2f",value:{x:.5,y:.5}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float radius;","uniform float angle;","uniform vec2 offset;","void main(void) {"," vec2 coord = vTextureCoord - offset;"," float distance = length(coord);"," if (distance < radius) {"," float ratio = (radius - distance) / radius;"," float angleMod = ratio * ratio * angle;"," float s = sin(angleMod);"," float c = cos(angleMod);"," coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);"," }"," gl_FragColor = texture2D(uSampler, coord+offset);","}"]},e.TwistFilter.prototype=Object.create(e.AbstractFilter.prototype),e.TwistFilter.prototype.constructor=e.TwistFilter,Object.defineProperty(e.TwistFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.dirty=!0,this.uniforms.offset.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"radius",{get:function(){return this.uniforms.radius.value},set:function(t){this.dirty=!0,this.uniforms.radius.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.ColorStepFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={step:{type:"1f",value:5}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float step;","void main(void) {"," vec4 color = texture2D(uSampler, vTextureCoord);"," color = floor(color * step) / step;"," gl_FragColor = color;","}"]},e.ColorStepFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorStepFilter.prototype.constructor=e.ColorStepFilter,Object.defineProperty(e.ColorStepFilter.prototype,"step",{get:function(){return this.uniforms.step.value},set:function(t){this.uniforms.step.value=t}}),e.DotScreenFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float angle;","uniform float scale;","float pattern() {"," float s = sin(angle), c = cos(angle);"," vec2 tex = vTextureCoord * dimensions.xy;"," vec2 point = vec2("," c * tex.x - s * tex.y,"," s * tex.x + c * tex.y"," ) * scale;"," return (sin(point.x) * sin(point.y)) * 4.0;","}","void main() {"," vec4 color = texture2D(uSampler, vTextureCoord);"," float average = (color.r + color.g + color.b) / 3.0;"," gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);","}"] -},e.DotScreenFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DotScreenFilter.prototype.constructor=e.DotScreenFilter,Object.defineProperty(e.DotScreenFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.dirty=!0,this.uniforms.scale.value=t}}),Object.defineProperty(e.DotScreenFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.CrossHatchFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);"," gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"," if (lum < 1.00) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.75) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.50) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.3) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }","}"]},e.CrossHatchFilter.prototype=Object.create(e.AbstractFilter.prototype),e.CrossHatchFilter.prototype.constructor=e.CrossHatchFilter,Object.defineProperty(e.CrossHatchFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.RGBSplitFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={red:{type:"2f",value:{x:20,y:20}},green:{type:"2f",value:{x:-20,y:20}},blue:{type:"2f",value:{x:20,y:-20}},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 red;","uniform vec2 green;","uniform vec2 blue;","uniform vec4 dimensions;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;"," gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;"," gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;"," gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;","}"]},e.RGBSplitFilter.prototype=Object.create(e.AbstractFilter.prototype),e.RGBSplitFilter.prototype.constructor=e.RGBSplitFilter,Object.defineProperty(e.RGBSplitFilter.prototype,"red",{get:function(){return this.uniforms.red.value},set:function(t){this.uniforms.red.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"green",{get:function(){return this.uniforms.green.value},set:function(t){this.uniforms.green.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"blue",{get:function(){return this.uniforms.blue.value},set:function(t){this.uniforms.blue.value=t}}),"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=e),exports.PIXI=e):"undefined"!=typeof define&&define.amd?define(e):t.PIXI=e}.call(this),!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.html2canvas=t()}}(function(){var t;return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var h="function"==typeof require&&require;if(!a&&h)return h(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[s]={exports:{}};t[s][0].call(u.exports,function(e){var i=t[s][1][e];return n(i?i:e)},u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;st;t+=2){var e=W[t],i=W[t+1];e(i),W[t]=void 0,W[t+1]=void 0}G=0}function p(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function m(t){try{return t.then}catch(e){return z.error=e,z}}function v(t,e,i,r){try{t.call(e,i,r)}catch(n){return n}}function y(t,e,i){N(function(t){var r=!1,n=v(i,e,function(i){r||(r=!0,e!==i?w(t,i):S(t,i))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&n&&(r=!0,C(t,n))},t)}function x(t,e){e._state===Y?S(t,e._result):t._state===X?C(t,e._result):E(e,void 0,function(e){w(t,e)},function(e){C(t,e)})}function b(t,e){if(e.constructor===t.constructor)x(t,e);else{var i=m(e);i===z?C(t,z.error):void 0===i?S(t,e):o(i)?y(t,e,i):S(t,e)}}function w(t,e){t===e?C(t,f()):n(e)?b(t,e):S(t,e)}function T(t){t._onerror&&t._onerror(t._result),A(t)}function S(t,e){t._state===H&&(t._result=e,t._state=Y,0===t._subscribers.length||N(A,t))}function C(t,e){t._state===H&&(t._state=X,t._result=e,N(T,t))}function E(t,e,i,r){var n=t._subscribers,o=n.length;t._onerror=null,n[o]=e,n[o+Y]=i,n[o+X]=r,0===o&&t._state&&N(A,t)}function A(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var r,n,o=t._result,s=0;s1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return a.prototype=t,new a},0),N=function(t,e){W[G]=t,W[G+1]=e,G+=2,2===G&&D()},U="undefined"!=typeof window?window:{},j=U.MutationObserver||U.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,W=new Array(1e3);D="undefined"!=typeof e&&"[object process]"==={}.toString.call(e)?h():j?l():V?u():c();var H=void 0,Y=1,X=2,z=new _,q=new _;P.prototype._validateInput=function(t){return k(t)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var K=P;P.prototype._enumerate=function(){for(var t=this.length,e=this.promise,i=this._input,r=0;e._state===H&&t>r;r++)this._eachEntry(i[r],r)},P.prototype._eachEntry=function(t,e){var i=this._instanceConstructor;s(t)?t.constructor===i&&t._state!==H?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(i.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(Y,e,t))},P.prototype._settledAt=function(t,e,i){var r=this.promise;r._state===H&&(this._remaining--,this._abortOnReject&&t===X?C(r,i):this._result[e]=this._makeResult(t,e,i)),0===this._remaining&&S(r,this._result)},P.prototype._makeResult=function(t,e,i){return i},P.prototype._willSettleAt=function(t,e){var i=this;E(t,void 0,function(t){i._settledAt(Y,e,t)},function(t){i._settledAt(X,e,t)})};var $=function(t,e){return new K(this,t,!0,e).promise},Q=function(t,e){function i(t){w(o,t)}function r(t){C(o,t)}var n=this,o=new n(p,e);if(!k(t))return C(o,new TypeError("You must pass an array to race.")),o;for(var s=t.length,a=0;o._state===H&&s>a;a++)E(n.resolve(t[a]),void 0,i,r);return o},J=function(t,e){var i=this;if(t&&"object"==typeof t&&t.constructor===i)return t;var r=new i(p,e);return w(r,t),r},Z=function(t,e){var i=this,r=new i(p,e);return C(r,t),r},te=0,ee=I;I.all=$,I.race=Q,I.resolve=J,I.reject=Z,I.prototype={constructor:I,then:function(t,e){var i=this,r=i._state;if(r===Y&&!t||r===X&&!e)return this;var n=new this.constructor(p),o=i._result;if(r){var s=arguments[r-1];N(function(){L(r,n,s,o)})}else E(i,n,t,e);return n},"catch":function(t){return this.then(null,t)}};var ie=function(){var t;t="undefined"!=typeof r?r:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),o(e)}();e||(t.Promise=ee)},re={Promise:ee,polyfill:ie};"function"==typeof t&&t.amd?t(function(){return re}):"undefined"!=typeof i&&i.exports?i.exports=re:"undefined"!=typeof this&&(this.ES6Promise=re)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(t,e){function i(){if(!s){s=!0;for(var t,e=o.length;e;){t=o,o=[];for(var i=-1;++in;)e=t.charCodeAt(n++),e>=55296&&56319>=e&&o>n?(i=t.charCodeAt(n++),56320==(64512&i)?r.push(((1023&e)<<10)+(1023&i)+65536):(r.push(e),n--)):r.push(e);return r}function l(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=k(t>>>10&1023|55296),t=56320|1023&t),e+=k(t)}).join("")}function u(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function c(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function d(t,e,i){var r=0;for(t=i?D(t/_):t>>1,t+=D(t/e);t>O*E>>1;r+=S)t=D(t/O);return D(r+(O+1)*t/(t+A))}function p(t){var e,i,r,n,s,a,h,c,p,f,g=[],m=t.length,v=0,y=L,x=M;for(i=t.lastIndexOf(R),0>i&&(i=0),r=0;i>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),g.push(t.charCodeAt(r));for(n=i>0?i+1:0;m>n;){for(s=v,a=1,h=S;n>=m&&o("invalid-input"),c=u(t.charCodeAt(n++)),(c>=S||c>D((T-v)/a))&&o("overflow"),v+=c*a,p=x>=h?C:h>=x+E?E:h-x,!(p>c);h+=S)f=S-p,a>D(T/f)&&o("overflow"),a*=f;e=g.length+1,x=d(v-s,e,0==s),D(v/e)>T-y&&o("overflow"),y+=D(v/e),v%=e,g.splice(v++,0,y)}return l(g)}function f(t){var e,i,r,n,s,a,l,u,p,f,g,m,v,y,x,b=[];for(t=h(t),m=t.length,e=L,i=0,s=M,a=0;m>a;++a)g=t[a],128>g&&b.push(k(g));for(r=n=b.length,n&&b.push(R);m>r;){for(l=T,a=0;m>a;++a)g=t[a],g>=e&&l>g&&(l=g);for(v=r+1,l-e>D((T-i)/v)&&o("overflow"),i+=(l-e)*v,e=l,a=0;m>a;++a)if(g=t[a],e>g&&++i>T&&o("overflow"),g==e){for(u=i,p=S;f=s>=p?C:p>=s+E?E:p-s,!(f>u);p+=S)x=u-f,y=S-f,b.push(k(c(f+x%y,0))),u=D(x/y);b.push(k(c(u,0))),s=d(i,v,r==n),i=0,++r}++i,++e}return b.join("")}function g(t){return a(t,function(t){return P.test(t)?p(t.slice(4).toLowerCase()):t})}function m(t){return a(t,function(t){return F.test(t)?"xn--"+f(t):t})}var v="object"==typeof r&&r,y="object"==typeof i&&i&&i.exports==v&&i,x="object"==typeof e&&e;(x.global===x||x.window===x)&&(n=x);var b,w,T=2147483647,S=36,C=1,E=26,A=38,_=700,M=72,L=128,R="-",P=/^xn--/,F=/[^ -~]/,B=/\x2E|\u3002|\uFF0E|\uFF61/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=S-C,D=Math.floor,k=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:h,encode:l},decode:p,encode:f,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&!v.nodeType)if(y)y.exports=b;else for(w in b)b.hasOwnProperty(w)&&(v[w]=b[w]);else n.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(t,e){function i(t,e,i){for(var r=t.getElementsByTagName(i),n=e.getElementsByTagName(i),o=r.length,s=0;o>s;s++)n[s].value=r[s].value}function r(t,e,i){!t.defaultView||e===t.defaultView.pageXOffset&&i===t.defaultView.pageYOffset||t.defaultView.scrollTo(e,i)}function n(t){[].slice.call(t.querySelectorAll("canvas"),0).forEach(function(t){t.setAttribute(d,"canvas-"+p++)})}function o(t,e){[].slice.call(t.querySelectorAll("["+d+"]"),0).forEach(function(t){try{var i=e.querySelector("["+d+'="'+t.getAttribute(d)+'"]');i&&(i.width=t.width,i.height=t.height,i.getContext("2d").putImageData(t.getContext("2d").getImageData(0,0,t.width,t.height),0,0))}catch(r){u("Unable to copy canvas content from",t,r)}t.removeAttribute(d)})}function s(t){return[].slice.call(t.childNodes,0).filter(l).forEach(function(e){"SCRIPT"===e.tagName?t.removeChild(e):s(e)}),t}function a(){return document.documentMode&&document.documentMode<=9}function h(t,e){for(var i=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),r=t.firstChild;r;)(e===!0||1!==r.nodeType||"SCRIPT"!==r.nodeName)&&i.appendChild(h(r,e)),r=r.nextSibling;return i}function l(t){return t.nodeType===Node.ELEMENT_NODE}var u=t("./log"),c=t("./promise"),d="data-html2canvas-canvas-clone",p=0;e.exports=function(t,e,l,u,d,p,f){n(t);var g=a()?h(t.documentElement,d.javascriptEnabled):t.documentElement.cloneNode(!0),m=e.createElement("iframe");return m.className="html2canvas-container",m.style.visibility="hidden",m.style.position="fixed",m.style.left="-10000px",m.style.top="0px",m.style.border="0",m.width=l,m.height=u,m.scrolling="no",e.body.appendChild(m),new c(function(e){var n=m.contentWindow.document;i(t.documentElement,g,"textarea"),i(t.documentElement,g,"select"),m.contentWindow.onload=m.onload=function(){var i=setInterval(function(){n.body.childNodes.length>0&&(o(t,n),clearInterval(i),"view"===d.type&&m.contentWindow.scrollTo(p,f),e(m))},50)},n.open(),n.write(""),r(t,p,f),n.replaceChild(d.javascriptEnabled===!0?n.adoptNode(g):s(n.adoptNode(g)),n.documentElement),n.close()})}},{"./log":15,"./promise":18}],5:[function(t,e){function i(t){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(t)||this.namedColor(t)||this.rgb(t)||this.rgba(t)||this.hex6(t)||this.hex3(t)}i.prototype.darken=function(t){var e=1-t;return new i([Math.round(this.r*e),Math.round(this.g*e),Math.round(this.b*e),this.a])},i.prototype.isTransparent=function(){return 0===this.a},i.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},i.prototype.fromArray=function(t){return Array.isArray(t)&&(this.r=Math.min(t[0],255),this.g=Math.min(t[1],255),this.b=Math.min(t[2],255),t.length>3&&(this.a=t[3])),Array.isArray(t)};var r=/^#([a-f0-9]{3})$/i;i.prototype.hex3=function(t){var e=null;return null!==(e=t.match(r))&&(this.r=parseInt(e[1][0]+e[1][0],16),this.g=parseInt(e[1][1]+e[1][1],16),this.b=parseInt(e[1][2]+e[1][2],16)),null!==e};var n=/^#([a-f0-9]{6})$/i;i.prototype.hex6=function(t){var e=null;return null!==(e=t.match(n))&&(this.r=parseInt(e[1].substring(0,2),16),this.g=parseInt(e[1].substring(2,4),16),this.b=parseInt(e[1].substring(4,6),16)),null!==e};var o=/^rgb\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3})\)$/;i.prototype.rgb=function(t){var e=null;return null!==(e=t.match(o))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3])),null!==e};var s=/^rgba\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *, *(\d+\.?\d*)\)$/;i.prototype.rgba=function(t){var e=null;return null!==(e=t.match(s))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3]),this.a=Number(e[4])),null!==e},i.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},i.prototype.namedColor=function(t){var e=a[t.toLowerCase()];if(e)this.r=e[0],this.g=e[1],this.b=e[2];else if("transparent"===t.toLowerCase())return this.r=this.g=this.b=this.a=0,!0;return!!e},i.prototype.isColor=!0;var a={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};e.exports=i},{}],6:[function(t,e){function i(t,e){var i=T++;if(e=e||{},e.logging&&(window.html2canvas.logging=!0,window.html2canvas.start=Date.now()),e.async="undefined"==typeof e.async?!0:e.async,e.allowTaint="undefined"==typeof e.allowTaint?!1:e.allowTaint,e.removeContainer="undefined"==typeof e.removeContainer?!0:e.removeContainer,e.javascriptEnabled="undefined"==typeof e.javascriptEnabled?!1:e.javascriptEnabled,e.imageTimeout="undefined"==typeof e.imageTimeout?1e4:e.imageTimeout,e.renderer="function"==typeof e.renderer?e.renderer:d,e.strict=!!e.strict,"string"==typeof t){if("string"!=typeof e.proxy)return u.reject("Proxy must be used when rendering url");var o=null!=e.width?e.width:window.innerWidth,s=null!=e.height?e.height:window.innerHeight;return x(l(t),e.proxy,document,o,s,e).then(function(t){return n(t.contentWindow.document.documentElement,t,e,o,s)})}var a=(void 0===t?[document.documentElement]:t.length?t:[t])[0];return a.setAttribute(w+i,i),r(a.ownerDocument,e,a.ownerDocument.defaultView.innerWidth,a.ownerDocument.defaultView.innerHeight,i).then(function(t){return"function"==typeof e.onrendered&&(m("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),e.onrendered(t)),t})}function r(t,e,i,r,o){return y(t,t,i,r,e,t.defaultView.pageXOffset,t.defaultView.pageYOffset).then(function(s){m("Document cloned");var a=w+o,h="["+a+"='"+o+"']";t.querySelector(h).removeAttribute(a);var l=s.contentWindow,c=l.document.querySelector(h);"0"===c.style.opacity&&"webgl"===c.getAttribute("renderer")?c.style.opacity=1:null;var d=u.resolve("function"==typeof e.onclone?e.onclone(l.document):!0);return d.then(function(){return n(c,s,e,i,r)})})}function n(t,e,i,r,n){var l=e.contentWindow,u=new c(l.document),d=new p(i,u),g=b(t),v="view"===i.type?r:a(l.document),y="view"===i.type?n:h(l.document),x=new i.renderer(v,y,d,i,document),w=new f(t,x,u,d,i);return w.ready.then(function(){m("Finished rendering");var r;return r="view"===i.type?s(x.canvas,{width:x.canvas.width,height:x.canvas.height,top:0,left:0,x:0,y:0}):t===l.document.body||t===l.document.documentElement||null!=i.canvas?x.canvas:s(x.canvas,{width:null!=i.width?i.width:g.width,height:null!=i.height?i.height:g.height,top:g.top,left:g.left,x:l.pageXOffset,y:l.pageYOffset}),o(e,i),r})}function o(t,e){e.removeContainer&&(t.parentNode.removeChild(t),m("Cleaned up container"))}function s(t,e){var i=document.createElement("canvas"),r=Math.min(t.width-1,Math.max(0,e.left)),n=Math.min(t.width,Math.max(1,e.left+e.width)),o=Math.min(t.height-1,Math.max(0,e.top)),s=Math.min(t.height,Math.max(1,e.top+e.height));return i.width=e.width,i.height=e.height,m("Cropping canvas at:","left:",e.left,"top:",e.top,"width:",n-r,"height:",s-o),m("Resulting crop with width",e.width,"and height",e.height," with x",r,"and y",o),i.getContext("2d").drawImage(t,r,o,n-r,s-o,e.x,e.y,n-r,s-o),i}function a(t){return Math.max(Math.max(t.body.scrollWidth,t.documentElement.scrollWidth),Math.max(t.body.offsetWidth,t.documentElement.offsetWidth),Math.max(t.body.clientWidth,t.documentElement.clientWidth))}function h(t){return Math.max(Math.max(t.body.scrollHeight,t.documentElement.scrollHeight),Math.max(t.body.offsetHeight,t.documentElement.offsetHeight),Math.max(t.body.clientHeight,t.documentElement.clientHeight))}function l(t){var e=document.createElement("a");return e.href=t,e.href=e.href,e}var u=t("./promise"),c=t("./support"),d=t("./renderers/canvas"),p=t("./imageloader"),f=t("./nodeparser"),g=t("./nodecontainer"),m=t("./log"),v=t("./utils"),y=t("./clone"),x=t("./proxy").loadUrlDocument,b=v.getBounds,w="data-html2canvas-node",T=0;i.Promise=u,i.CanvasRenderer=d,i.NodeContainer=g,i.log=m,i.utils=v,e.exports="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return u.reject("No canvas support")}:i},{"./clone":4,"./imageloader":13,"./log":15,"./nodecontainer":16,"./nodeparser":17,"./promise":18,"./proxy":19,"./renderers/canvas":23,"./support":25,"./utils":29}],7:[function(t,e){function i(t){if(this.src=t,n("DummyImageContainer for",t),!this.promise||!this.image){n("Initiating DummyImageContainer"),i.prototype.image=new Image;var e=this.image;i.prototype.promise=new r(function(t,i){e.onload=t,e.onerror=i,e.src=o(),e.complete===!0&&t(e)})}}var r=t("./promise"),n=t("./log"),o=t("./utils").smallImage;e.exports=i},{"./log":15,"./promise":18,"./utils":29}],8:[function(t,e){function i(t,e){var i,n,o=document.createElement("div"),s=document.createElement("img"),a=document.createElement("span"),h="Hidden Text";o.style.visibility="hidden",o.style.fontFamily=t,o.style.fontSize=e,o.style.margin=0,o.style.padding=0,document.body.appendChild(o),s.src=r(),s.width=1,s.height=1,s.style.margin=0,s.style.padding=0,s.style.verticalAlign="baseline",a.style.fontFamily=t,a.style.fontSize=e,a.style.margin=0,a.style.padding=0,a.appendChild(document.createTextNode(h)),o.appendChild(a),o.appendChild(s),i=s.offsetTop-a.offsetTop+1,o.removeChild(a),o.appendChild(document.createTextNode(h)),o.style.lineHeight="normal",s.style.verticalAlign="super",n=s.offsetTop-o.offsetTop+1,document.body.removeChild(o),this.baseline=i,this.lineWidth=1,this.middle=n}var r=t("./utils").smallImage;e.exports=i},{"./utils":29}],9:[function(t,e){function i(){this.data={}}var r=t("./font");i.prototype.getMetrics=function(t,e){return void 0===this.data[t+"-"+e]&&(this.data[t+"-"+e]=new r(t,e)),this.data[t+"-"+e]},e.exports=i},{"./font":8}],10:[function(t,e){function i(e,i,r){this.image=null,this.src=e;var s=this,a=o(e);this.promise=(i?new n(function(t){"about:blank"===e.contentWindow.document.URL||null==e.contentWindow.document.documentElement?e.contentWindow.onload=e.onload=function(){t(e)}:t(e)}):this.proxyLoad(r.proxy,a,r)).then(function(e){var i=t("./core");return i(e.contentWindow.document.documentElement,{type:"view",width:e.width,height:e.height,proxy:r.proxy,javascriptEnabled:r.javascriptEnabled,removeContainer:r.removeContainer,allowTaint:r.allowTaint,imageTimeout:r.imageTimeout/2})}).then(function(t){return s.image=t})}var r=t("./utils"),n=t("./promise"),o=r.getBounds,s=t("./proxy").loadUrlDocument;i.prototype.proxyLoad=function(t,e,i){var r=this.src;return s(r.src,t,r.ownerDocument,e.width,e.height,i)},e.exports=i},{"./core":6,"./promise":18,"./proxy":19,"./utils":29}],11:[function(t,e){function i(t){this.src=t.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=r.resolve(!0)}var r=t("./promise");i.prototype.TYPES={LINEAR:1,RADIAL:2},e.exports=i},{"./promise":18}],12:[function(t,e){function i(t,e){this.src=t,this.image=new Image;var i=this;this.tainted=null,this.promise=new r(function(r,n){i.image.onload=r,i.image.onerror=n,e&&(i.image.crossOrigin="anonymous"),i.image.src=t,i.image.complete===!0&&r(i.image)})}var r=t("./promise");e.exports=i},{"./promise":18}],13:[function(t,e){function i(t,e){this.link=null,this.options=t,this.support=e,this.origin=this.getOrigin(window.location.href)}var r=t("./promise"),n=t("./log"),o=t("./imagecontainer"),s=t("./dummyimagecontainer"),a=t("./proxyimagecontainer"),h=t("./framecontainer"),l=t("./svgcontainer"),u=t("./svgnodecontainer"),c=t("./lineargradientcontainer"),d=t("./webkitgradientcontainer"),p=t("./utils").bind;i.prototype.findImages=function(t){var e=[];return t.reduce(function(t,e){switch(e.node.nodeName){case"IMG":return t.concat([{args:[e.node.src],method:"url"}]);case"svg":case"IFRAME":return t.concat([{args:[e.node],method:e.node.nodeName}])}return t},[]).forEach(this.addImage(e,this.loadImage),this),e},i.prototype.findBackgroundImage=function(t,e){return e.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(t,this.loadImage),this),t},i.prototype.addImage=function(t,e){return function(i){i.args.forEach(function(r){this.imageExists(t,r)||(t.splice(0,0,e.call(this,i)),n("Added image #"+t.length,"string"==typeof r?r.substring(0,100):r))},this)}},i.prototype.hasImageBackground=function(t){return"none"!==t.method},i.prototype.loadImage=function(t){if("url"===t.method){var e=t.args[0];return!this.isSVG(e)||this.support.svg||this.options.allowTaint?e.match(/data:image\/.*;base64,/i)?new o(e.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(e)||this.options.allowTaint===!0||this.isSVG(e)?new o(e,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new o(e,!0):this.options.proxy?new a(e,this.options.proxy):new s(e):new l(e)}return"linear-gradient"===t.method?new c(t):"gradient"===t.method?new d(t):"svg"===t.method?new u(t.args[0],this.support.svg):"IFRAME"===t.method?new h(t.args[0],this.isSameOrigin(t.args[0].src),this.options):new s(t)},i.prototype.isSVG=function(t){return"svg"===t.substring(t.length-3).toLowerCase()||l.prototype.isInline(t)},i.prototype.imageExists=function(t,e){return t.some(function(t){return t.src===e})},i.prototype.isSameOrigin=function(t){return this.getOrigin(t)===this.origin},i.prototype.getOrigin=function(t){var e=this.link||(this.link=document.createElement("a"));return e.href=t,e.href=e.href,e.protocol+e.hostname+e.port},i.prototype.getPromise=function(t){return this.timeout(t,this.options.imageTimeout)["catch"](function(){var e=new s(t.src);return e.promise.then(function(e){t.image=e})})},i.prototype.get=function(t){var e=null;return this.images.some(function(i){return(e=i).src===t})?e:null},i.prototype.fetch=function(t){return this.images=t.reduce(p(this.findBackgroundImage,this),this.findImages(t)),this.images.forEach(function(t,e){t.promise.then(function(){n("Succesfully loaded image #"+(e+1),t)},function(i){n("Failed loading image #"+(e+1),t,i)})}),this.ready=r.all(this.images.map(this.getPromise,this)),n("Finished searching images"),this},i.prototype.timeout=function(t,e){var i,o=r.race([t.promise,new r(function(r,o){i=setTimeout(function(){n("Timed out loading image",t),o(t)},e)})]).then(function(t){return clearTimeout(i),t});return o["catch"](function(){clearTimeout(i)}),o},e.exports=i},{"./dummyimagecontainer":7,"./framecontainer":10,"./imagecontainer":12,"./lineargradientcontainer":14,"./log":15,"./promise":18,"./proxyimagecontainer":20,"./svgcontainer":26,"./svgnodecontainer":27,"./utils":29,"./webkitgradientcontainer":30}],14:[function(t,e){function i(t){r.apply(this,arguments),this.type=this.TYPES.LINEAR;var e=null===t.args[0].match(this.stepRegExp);e?t.args[0].split(" ").reverse().forEach(function(t){switch(t){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var e=this.y0,i=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=i,this.y1=e}},this):(this.y0=0,this.y1=1),this.colorStops=t.args.slice(e?1:0).map(function(t){var e=t.match(this.stepRegExp);return{color:new n(e[1]),stop:"%"===e[3]?e[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(t,e){null===t.stop&&this.colorStops.slice(e).some(function(i,r){return null!==i.stop?(t.stop=(i.stop-this.colorStops[e-1].stop)/(r+1)+this.colorStops[e-1].stop,!0):!1 -},this)},this)}var r=t("./gradientcontainer"),n=t("./color");i.prototype=Object.create(r.prototype),i.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,e.exports=i},{"./color":5,"./gradientcontainer":11}],15:[function(t,e){e.exports=function(){window.html2canvas.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-window.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}},{}],16:[function(t,e){function i(t,e){this.node=t,this.parent=e,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function r(t){var e=t.options[t.selectedIndex||0];return e?e.text||"":""}function n(t){return t&&"matrix"===t[1]?t[2].split(",").map(function(t){return parseFloat(t.trim())}):void 0}function o(t){return-1!==t.toString().indexOf("%")}function s(t){return t.replace("px","")}function a(t){return parseFloat(t)}var h=t("./color"),l=t("./utils"),u=l.getBounds,c=l.parseBackgrounds,d=l.offsetBounds;i.prototype.cloneTo=function(t){t.visible=this.visible,t.borders=this.borders,t.bounds=this.bounds,t.clip=this.clip,t.backgroundClip=this.backgroundClip,t.computedStyles=this.computedStyles,t.styles=this.styles,t.backgroundImages=this.backgroundImages,t.opacity=this.opacity},i.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},i.prototype.assignStack=function(t){this.stack=t,t.children.push(this)},i.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},i.prototype.css=function(t){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[t]||(this.styles[t]=this.computedStyles[t])},i.prototype.prefixedCss=function(t){var e=["webkit","moz","ms","o"],i=this.css(t);return void 0===i&&e.some(function(e){return i=this.css(e+t.substr(0,1).toUpperCase()+t.substr(1)),void 0!==i},this),void 0===i?null:i},i.prototype.computedStyle=function(t){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,t)},i.prototype.cssInt=function(t){var e=parseInt(this.css(t),10);return isNaN(e)?0:e},i.prototype.color=function(t){return this.colors[t]||(this.colors[t]=new h(this.css(t)))},i.prototype.cssFloat=function(t){var e=parseFloat(this.css(t));return isNaN(e)?0:e},i.prototype.fontWeight=function(){var t=this.css("fontWeight");switch(parseInt(t,10)){case 401:t="bold";break;case 400:t="normal"}return t},i.prototype.parseClip=function(){var t=this.css("clip").match(this.CLIP);return t?{top:parseInt(t[1],10),right:parseInt(t[2],10),bottom:parseInt(t[3],10),left:parseInt(t[4],10)}:null},i.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=c(this.css("backgroundImage")))},i.prototype.cssList=function(t,e){var i=(this.css(t)||"").split(",");return i=i[e||0]||i[0]||"auto",i=i.trim().split(" "),1===i.length&&(i=[i[0],o(i[0])?"auto":i[0]]),i},i.prototype.parseBackgroundSize=function(t,e,i){var r,n,s=this.cssList("backgroundSize",i);if(o(s[0]))r=t.width*parseFloat(s[0])/100;else{if(/contain|cover/.test(s[0])){var a=t.width/t.height,h=e.width/e.height;return h>a^"contain"===s[0]?{width:t.height*h,height:t.height}:{width:t.width,height:t.width/h}}r=parseInt(s[0],10)}return n="auto"===s[0]&&"auto"===s[1]?e.height:"auto"===s[1]?r/e.width*e.height:o(s[1])?t.height*parseFloat(s[1])/100:parseInt(s[1],10),"auto"===s[0]&&(r=n/e.height*e.width),{width:r,height:n}},i.prototype.parseBackgroundPosition=function(t,e,i,r){var n,s,a=this.cssList("backgroundPosition",i);return n=o(a[0])?(t.width-(r||e).width)*(parseFloat(a[0])/100):parseInt(a[0],10),s="auto"===a[1]?n/e.width*e.height:o(a[1])?(t.height-(r||e).height)*parseFloat(a[1])/100:parseInt(a[1],10),"auto"===a[0]&&(n=s/e.height*e.width),{left:n,top:s}},i.prototype.parseBackgroundRepeat=function(t){return this.cssList("backgroundRepeat",t)[0]},i.prototype.parseTextShadows=function(){var t=this.css("textShadow"),e=[];if(t&&"none"!==t)for(var i=t.match(this.TEXT_SHADOW_PROPERTY),r=0;i&&r0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,t)):t():(this.renderQueue.forEach(this.paint,this),t())},this))},this))}function r(t){return t.parent&&t.parent.clip.length}function n(t){return t.replace(/(\-[a-z])/g,function(t){return t.toUpperCase().replace("-","")})}function o(){}function s(t,e,i,r){return t.map(function(n,o){if(n.width>0){var s=e.left,a=e.top,h=e.width,l=e.height-t[2].width;switch(o){case 0:l=t[0].width,n.args=u({c1:[s,a],c2:[s+h,a],c3:[s+h-t[1].width,a+l],c4:[s+t[3].width,a+l]},r[0],r[1],i.topLeftOuter,i.topLeftInner,i.topRightOuter,i.topRightInner);break;case 1:s=e.left+e.width-t[1].width,h=t[1].width,n.args=u({c1:[s+h,a],c2:[s+h,a+l+t[2].width],c3:[s,a+l],c4:[s,a+t[0].width]},r[1],r[2],i.topRightOuter,i.topRightInner,i.bottomRightOuter,i.bottomRightInner);break;case 2:a=a+e.height-t[2].width,l=t[2].width,n.args=u({c1:[s+h,a+l],c2:[s,a+l],c3:[s+t[3].width,a],c4:[s+h-t[3].width,a]},r[2],r[3],i.bottomRightOuter,i.bottomRightInner,i.bottomLeftOuter,i.bottomLeftInner);break;case 3:h=t[3].width,n.args=u({c1:[s,a+l+t[2].width],c2:[s,a],c3:[s+h,a+t[0].width],c4:[s+h,a+l]},r[3],r[0],i.bottomLeftOuter,i.bottomLeftInner,i.topLeftOuter,i.topLeftInner)}}return n})}function a(t,e,i,r){var n=4*((Math.sqrt(2)-1)/3),o=i*n,s=r*n,a=t+i,h=e+r;return{topLeft:l({x:t,y:h},{x:t,y:h-s},{x:a-o,y:e},{x:a,y:e}),topRight:l({x:t,y:e},{x:t+o,y:e},{x:a,y:h-s},{x:a,y:h}),bottomRight:l({x:a,y:e},{x:a,y:e+s},{x:t+o,y:h},{x:t,y:h}),bottomLeft:l({x:a,y:h},{x:a-o,y:h},{x:t,y:e+s},{x:t,y:e})}}function h(t,e,i){var r=t.left,n=t.top,o=t.width,s=t.height,h=e[0][0],l=e[0][1],u=e[1][0],c=e[1][1],d=e[2][0],p=e[2][1],f=e[3][0],g=e[3][1],m=Math.floor(s/2);h=h>m?m:h,l=l>m?m:l,u=u>m?m:u,c=c>m?m:c,d=d>m?m:d,p=p>m?m:p,f=f>m?m:f,g=g>m?m:g;var v=o-u,y=s-p,x=o-d,b=s-g;return{topLeftOuter:a(r,n,h,l).topLeft.subdivide(.5),topLeftInner:a(r+i[3].width,n+i[0].width,Math.max(0,h-i[3].width),Math.max(0,l-i[0].width)).topLeft.subdivide(.5),topRightOuter:a(r+v,n,u,c).topRight.subdivide(.5),topRightInner:a(r+Math.min(v,o+i[3].width),n+i[0].width,v>o+i[3].width?0:u-i[3].width,c-i[0].width).topRight.subdivide(.5),bottomRightOuter:a(r+x,n+y,d,p).bottomRight.subdivide(.5),bottomRightInner:a(r+Math.min(x,o-i[3].width),n+Math.min(y,s+i[0].width),Math.max(0,d-i[1].width),p-i[2].width).bottomRight.subdivide(.5),bottomLeftOuter:a(r,n+b,f,g).bottomLeft.subdivide(.5),bottomLeftInner:a(r+i[3].width,n+b,Math.max(0,f-i[3].width),g-i[2].width).bottomLeft.subdivide(.5)}}function l(t,e,i,r){var n=function(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}};return{start:t,startControl:e,endControl:i,end:r,subdivide:function(o){var s=n(t,e,o),a=n(e,i,o),h=n(i,r,o),u=n(s,a,o),c=n(a,h,o),d=n(u,c,o);return[l(t,s,u,d),l(d,c,h,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,i.x,i.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",i.x,i.y,e.x,e.y,t.x,t.y])}}}function u(t,e,i,r,n,o,s){var a=[];return e[0]>0||e[1]>0?(a.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(a)):a.push(["line",t.c1[0],t.c1[1]]),i[0]>0||i[1]>0?(a.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(a),a.push(["line",s[0].end.x,s[0].end.y]),s[0].curveToReversed(a)):(a.push(["line",t.c2[0],t.c2[1]]),a.push(["line",t.c3[0],t.c3[1]])),e[0]>0||e[1]>0?(a.push(["line",n[1].end.x,n[1].end.y]),n[1].curveToReversed(a)):a.push(["line",t.c4[0],t.c4[1]]),a}function c(t,e,i,r,n,o,s){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",o,s]),(i[0]>0||i[1]>0)&&t.push(["line",n[0].start.x,n[0].start.y])}function d(t){return t.cssInt("zIndex")<0}function p(t){return t.cssInt("zIndex")>0}function f(t){return 0===t.cssInt("zIndex")}function g(t){return-1!==["inline","inline-block","inline-table"].indexOf(t.css("display"))}function m(t){return t instanceof z}function v(t){return t.node.data.trim().length>0}function y(t){return/^(normal|none|0px)$/.test(t.parent.css("letterSpacing"))}function x(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){var i=t.css("border"+e+"Radius"),r=i.split(" ");return r.length<=1&&(r[1]=r[0]),r.map(P)})}function b(t){return t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE}function w(t){var e=t.css("position"),i=-1!==["absolute","relative","fixed"].indexOf(e)?t.css("zIndex"):"auto";return"auto"!==i}function T(t){return"static"!==t.css("position")}function S(t){return"none"!==t.css("float")}function C(t){return-1!==["inline-block","inline-table"].indexOf(t.css("display"))}function E(t){var e=this;return function(){return!t.apply(e,arguments)}}function A(t){return t.node.nodeType===Node.ELEMENT_NODE}function _(t){return t.isPseudoElement===!0}function M(t){return t.node.nodeType===Node.TEXT_NODE}function L(t){return function(e,i){return e.cssInt("zIndex")+t.indexOf(e)/t.length-(i.cssInt("zIndex")+t.indexOf(i)/t.length)}}function R(t){return t.getOpacity()<1}function P(t){return parseInt(t,10)}function F(t){return t.width}function B(t){return t.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(t.node.nodeName)}function I(t){return[].concat.apply([],t)}function O(t){var e=t.substr(0,1);return e===t.substr(t.length-1)&&e.match(/'|"/)?t.substr(1,t.length-2):t}function D(t){for(var e,i=[],r=0,n=!1;t.length;)k(t[r])===n?(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)),n=!n,r=0):r++,r>=t.length&&(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)));return i}function k(t){return-1!==[32,13,10,9,45].indexOf(t)}function G(t){return/[^\u0000-\u00ff]/.test(t)}var N=t("./log"),U=t("punycode"),j=t("./nodecontainer"),V=t("./textcontainer"),W=t("./pseudoelementcontainer"),H=t("./fontmetrics"),Y=t("./color"),X=t("./promise"),z=t("./stackingcontext"),q=t("./utils"),K=q.bind,$=q.getBounds,Q=q.parseBackgrounds,J=q.offsetBounds;i.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(t){if(A(t)){_(t)&&t.appendToDOM(),t.borders=this.parseBorders(t);var e="hidden"===t.css("overflow")?[t.borders.clip]:[],i=t.parseClip();i&&-1!==["absolute","fixed"].indexOf(t.css("position"))&&e.push([["rect",t.bounds.left+i.left,t.bounds.top+i.top,i.right-i.left,i.bottom-i.top]]),t.clip=r(t)?t.parent.clip.concat(e):e,t.backgroundClip="hidden"!==t.css("overflow")?t.clip.concat([t.borders.clip]):t.clip,_(t)&&t.cleanDOM()}else M(t)&&(t.clip=r(t)?t.parent.clip:[]);_(t)||(t.bounds=null)},this)},i.prototype.asyncRenderer=function(t,e,i){i=i||Date.now(),this.paint(t[this.renderIndex++]),t.length===this.renderIndex?e():i+20>Date.now()?this.asyncRenderer(t,e,i):setTimeout(K(function(){this.asyncRenderer(t,e)},this),0)},i.prototype.createPseudoHideStyles=function(t){this.createStyles(t,"."+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},i.prototype.disableAnimations=function(t){this.createStyles(t,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},i.prototype.createStyles=function(t,e){var i=t.createElement("style");i.innerHTML=e,t.body.appendChild(i)},i.prototype.getPseudoElements=function(t){var e=[[t]];if(t.node.nodeType===Node.ELEMENT_NODE){var i=this.getPseudoElement(t,":before"),r=this.getPseudoElement(t,":after");i&&e.push(i),r&&e.push(r)}return I(e)},i.prototype.getPseudoElement=function(t,e){var i=t.computedStyle(e);if(!i||!i.content||"none"===i.content||"-moz-alt-content"===i.content||"none"===i.display)return null;for(var r=O(i.content),o="url"===r.substr(0,3),s=document.createElement(o?"img":"html2canvaspseudoelement"),a=new W(s,t,e),h=i.length-1;h>=0;h--){var l=n(i.item(h));s.style[l]=i[l]}if(s.className=W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,o)return s.src=Q(r)[0].args[0],[a];var u=document.createTextNode(r);return s.appendChild(u),[a,new V(u,a)]},i.prototype.getChildren=function(t){return I([].filter.call(t.node.childNodes,b).map(function(e){var i=[e.nodeType===Node.TEXT_NODE?new V(e,t):new j(e,t)].filter(B);return e.nodeType===Node.ELEMENT_NODE&&i.length&&"TEXTAREA"!==e.tagName?i[0].isElementVisible()?i.concat(this.getChildren(i[0])):[]:i},this))},i.prototype.newStackingContext=function(t,e){var i=new z(e,t.getOpacity(),t.node,t.parent);t.cloneTo(i);var r=e?i.getParentStack(this):i.parent.stack;r.contexts.push(i),t.stack=i},i.prototype.createStackingContexts=function(){this.nodes.forEach(function(t){A(t)&&(this.isRootElement(t)||R(t)||w(t)||this.isBodyWithTransparentRoot(t)||t.hasTransform())?this.newStackingContext(t,!0):A(t)&&(T(t)&&f(t)||C(t)||S(t))?this.newStackingContext(t,!1):t.assignStack(t.parent.stack)},this)},i.prototype.isBodyWithTransparentRoot=function(t){return"BODY"===t.node.nodeName&&t.parent.color("backgroundColor").isTransparent()},i.prototype.isRootElement=function(t){return null===t.parent},i.prototype.sortStackingContexts=function(t){t.contexts.sort(L(t.contexts.slice(0))),t.contexts.forEach(this.sortStackingContexts,this)},i.prototype.parseTextBounds=function(t){return function(e,i,r){if("none"!==t.parent.css("textDecoration").substr(0,4)||0!==e.trim().length){if(this.support.rangeBounds&&!t.parent.hasTransform()){var n=r.slice(0,i).join("").length;return this.getRangeBounds(t.node,n,e.length)}if(t.node&&"string"==typeof t.node.data){var o=t.node.splitText(e.length),s=this.getWrapperBounds(t.node,t.parent.hasTransform());return t.node=o,s}}else(!this.support.rangeBounds||t.parent.hasTransform())&&(t.node=t.node.splitText(e.length));return{}}},i.prototype.getWrapperBounds=function(t,e){var i=t.ownerDocument.createElement("html2canvaswrapper"),r=t.parentNode,n=t.cloneNode(!0);i.appendChild(t.cloneNode(!0)),r.replaceChild(i,t);var o=e?J(i):$(i);return r.replaceChild(n,i),o},i.prototype.getRangeBounds=function(t,e,i){var r=this.range||(this.range=t.ownerDocument.createRange());return r.setStart(t,e),r.setEnd(t,e+i),r.getBoundingClientRect()},i.prototype.parse=function(t){var e=t.contexts.filter(d),i=t.children.filter(A),r=i.filter(E(S)),n=r.filter(E(T)).filter(E(g)),s=i.filter(E(T)).filter(S),a=r.filter(E(T)).filter(g),h=t.contexts.concat(r.filter(T)).filter(f),l=t.children.filter(M).filter(v),u=t.contexts.filter(p);e.concat(n).concat(s).concat(a).concat(h).concat(l).concat(u).forEach(function(t){this.renderQueue.push(t),m(t)&&(this.parse(t),this.renderQueue.push(new o))},this)},i.prototype.paint=function(t){try{t instanceof o?this.renderer.ctx.restore():M(t)?(_(t.parent)&&t.parent.appendToDOM(),this.paintText(t),_(t.parent)&&t.parent.cleanDOM()):this.paintNode(t)}catch(e){if(N(e),this.options.strict)throw e}},i.prototype.paintNode=function(t){m(t)&&(this.renderer.setOpacity(t.opacity),this.renderer.ctx.save(),t.hasTransform()&&this.renderer.setTransform(t.parseTransform())),"INPUT"===t.node.nodeName&&"checkbox"===t.node.type?this.paintCheckbox(t):"INPUT"===t.node.nodeName&&"radio"===t.node.type?this.paintRadio(t):this.paintElement(t)},i.prototype.paintElement=function(t){var e=t.parseBounds();this.renderer.clip(t.backgroundClip,function(){this.renderer.renderBackground(t,e,t.borders.borders.map(F))},this),this.renderer.clip(t.clip,function(){this.renderer.renderBorders(t.borders.borders)},this),this.renderer.clip(t.backgroundClip,function(){switch(t.node.nodeName){case"svg":case"IFRAME":var i=this.images.get(t.node);i?this.renderer.renderImage(t,e,t.borders,i):N("Error loading <"+t.node.nodeName+">",t.node);break;case"IMG":var r=this.images.get(t.node.src);r?this.renderer.renderImage(t,e,t.borders,r):N("Error loading ",t.node.src);break;case"CANVAS":this.renderer.renderImage(t,e,t.borders,{image:t.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(t)}},this)},i.prototype.paintCheckbox=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height),r={width:i-1,height:i-1,top:e.top,left:e.left},n=[3,3],o=[n,n,n,n],a=[1,1,1,1].map(function(t){return{color:new Y("#A5A5A5"),width:t}}),l=h(r,o,a);this.renderer.clip(t.backgroundClip,function(){this.renderer.rectangle(r.left+1,r.top+1,r.width-2,r.height-2,new Y("#DEDEDE")),this.renderer.renderBorders(s(a,r,l,o)),t.node.checked&&(this.renderer.font(new Y("#424242"),"normal","normal","bold",i-3+"px","arial"),this.renderer.text("✔",r.left+i/6,r.top+i-1))},this)},i.prototype.paintRadio=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height)-2;this.renderer.clip(t.backgroundClip,function(){this.renderer.circleStroke(e.left+1,e.top+1,i,new Y("#DEDEDE"),1,new Y("#A5A5A5")),t.node.checked&&this.renderer.circle(Math.ceil(e.left+i/4)+1,Math.ceil(e.top+i/4)+1,Math.floor(i/2),new Y("#424242"))},this)},i.prototype.paintFormValue=function(t){var e=t.getValue();if(e.length>0){var i=t.node.ownerDocument,r=i.createElement("html2canvaswrapper"),n=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];n.forEach(function(e){try{r.style[e]=t.css(e)}catch(i){N("html2canvas: Parse: Exception caught in renderFormValue: "+i.message)}});var o=t.parseBounds();r.style.position="fixed",r.style.left=o.left+"px",r.style.top=o.top+"px",r.textContent=e,i.body.appendChild(r),this.paintText(new V(r.firstChild,t)),i.body.removeChild(r)}},i.prototype.paintText=function(t){t.applyTextTransform();var e=U.ucs2.decode(t.node.data),i=this.options.letterRendering&&!y(t)||G(t.node.data)?e.map(function(t){return U.ucs2.encode([t])}):D(e),r=t.parent.fontWeight(),n=t.parent.css("fontSize"),o=t.parent.css("fontFamily"),s=t.parent.parseTextShadows();this.renderer.font(t.parent.color("color"),t.parent.css("fontStyle"),t.parent.css("fontVariant"),r,n,o),s.length?this.renderer.fontShadow(s[0].color,s[0].offsetX,s[0].offsetY,s[0].blur):this.renderer.clearShadow(),this.renderer.clip(t.parent.clip,function(){i.map(this.parseTextBounds(t),this).forEach(function(e,r){e&&(this.renderer.text(i[r],e.left,e.bottom),this.renderTextDecoration(t.parent,e,this.fontMetrics.getMetrics(o,n)))},this)},this)},i.prototype.renderTextDecoration=function(t,e,i){switch(t.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(e.left,Math.round(e.top+i.baseline+i.lineWidth),e.width,1,t.color("color"));break;case"overline":this.renderer.rectangle(e.left,Math.round(e.top),e.width,1,t.color("color"));break;case"line-through":this.renderer.rectangle(e.left,Math.ceil(e.top+i.middle+i.lineWidth),e.width,1,t.color("color"))}};var Z={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};i.prototype.parseBorders=function(t){var e=t.parseBounds(),i=x(t),r=["Top","Right","Bottom","Left"].map(function(e,i){var r=t.css("border"+e+"Style"),n=t.color("border"+e+"Color");"inset"===r&&n.isBlack()&&(n=new Y([255,255,255,n.a]));var o=Z[r]?Z[r][i]:null;return{width:t.cssInt("border"+e+"Width"),color:o?n[o[0]](o[1]):n,args:null}}),n=h(e,i,r);return{clip:this.parseBackgroundClip(t,n,r,i,e),borders:s(r,e,n,i)}},i.prototype.parseBackgroundClip=function(t,e,i,r,n){var o=t.css("backgroundClip"),s=[];switch(o){case"content-box":case"padding-box":c(s,r[0],r[1],e.topLeftInner,e.topRightInner,n.left+i[3].width,n.top+i[0].width),c(s,r[1],r[2],e.topRightInner,e.bottomRightInner,n.left+n.width-i[1].width,n.top+i[0].width),c(s,r[2],r[3],e.bottomRightInner,e.bottomLeftInner,n.left+n.width-i[1].width,n.top+n.height-i[2].width),c(s,r[3],r[0],e.bottomLeftInner,e.topLeftInner,n.left+i[3].width,n.top+n.height-i[2].width);break;default:c(s,r[0],r[1],e.topLeftOuter,e.topRightOuter,n.left,n.top),c(s,r[1],r[2],e.topRightOuter,e.bottomRightOuter,n.left+n.width,n.top),c(s,r[2],r[3],e.bottomRightOuter,e.bottomLeftOuter,n.left+n.width,n.top+n.height),c(s,r[3],r[0],e.bottomLeftOuter,e.topLeftOuter,n.left,n.top+n.height)}return s},e.exports=i},{"./color":5,"./fontmetrics":9,"./log":15,"./nodecontainer":16,"./promise":18,"./pseudoelementcontainer":21,"./stackingcontext":24,"./textcontainer":28,"./utils":29,punycode:3}],18:[function(t,e){e.exports=t("es6-promise").Promise},{"es6-promise":1}],19:[function(t,e,i){function r(t,e,i){var r="withCredentials"in new XMLHttpRequest;if(!e)return u.reject("No proxy configured");var n=s(r),h=a(e,t,n);return r?c(h):o(i,h,n).then(function(t){return g(t.content)})}function n(t,e,i){var r="crossOrigin"in new Image,n=s(r),h=a(e,t,n);return r?u.resolve(h):o(i,h,n).then(function(t){return"data:"+t.type+";base64,"+t.content})}function o(t,e,i){return new u(function(r,n){var o=t.createElement("script"),s=function(){delete window.html2canvas.proxy[i],t.body.removeChild(o)};window.html2canvas.proxy[i]=function(t){s(),r(t)},o.src=e,o.onerror=function(t){s(),n(t)},t.body.appendChild(o)})}function s(t){return t?"":"html2canvas_"+Date.now()+"_"+ ++m+"_"+Math.round(1e5*Math.random())}function a(t,e,i){return t+"?url="+encodeURIComponent(e)+(i.length?"&callback=html2canvas.proxy."+i:"")}function h(t){return function(e){var i,r=new DOMParser;try{i=r.parseFromString(e,"text/html")}catch(n){p("DOMParser not supported, falling back to createHTMLDocument"),i=document.implementation.createHTMLDocument("");try{i.open(),i.write(e),i.close()}catch(o){p("createHTMLDocument write not supported, falling back to document.body.innerHTML"),i.body.innerHTML=e}}var s=i.querySelector("base");if(!s||!s.href.host){var a=i.createElement("base");a.href=t,i.head.insertBefore(a,i.head.firstChild)}return i}}function l(t,e,i,n,o,s){return new r(t,e,window.document).then(h(t)).then(function(t){return f(t,i,n,o,s,0,0)})}var u=t("./promise"),c=t("./xhr"),d=t("./utils"),p=t("./log"),f=t("./clone"),g=d.decode64,m=0;i.Proxy=r,i.ProxyURL=n,i.loadUrlDocument=l},{"./clone":4,"./log":15,"./promise":18,"./utils":29,"./xhr":31}],20:[function(t,e){function i(t,e){var i=document.createElement("a");i.href=t,t=i.href,this.src=t,this.image=new Image;var o=this;this.promise=new n(function(i,n){o.image.crossOrigin="Anonymous",o.image.onload=i,o.image.onerror=n,new r(t,e,document).then(function(t){o.image.src=t})["catch"](n)})}var r=t("./proxy").ProxyURL,n=t("./promise");e.exports=i},{"./promise":18,"./proxy":19}],21:[function(t,e){function i(t,e,i){r.call(this,t,e),this.isPseudoElement=!0,this.before=":before"===i}var r=t("./nodecontainer");i.prototype.cloneTo=function(t){i.prototype.cloneTo.call(this,t),t.isPseudoElement=!0,t.before=this.before},i.prototype=Object.create(r.prototype),i.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},i.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},i.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",e.exports=i},{"./nodecontainer":16}],22:[function(t,e){function i(t,e,i,r,n){this.width=t,this.height=e,this.images=i,this.options=r,this.document=n}var r=t("./log");i.prototype.renderImage=function(t,e,i,r){var n=t.cssInt("paddingLeft"),o=t.cssInt("paddingTop"),s=t.cssInt("paddingRight"),a=t.cssInt("paddingBottom"),h=i.borders,l=e.width-(h[1].width+h[3].width+n+s),u=e.height-(h[0].width+h[2].width+o+a);this.drawImage(r,0,0,Math.round(r.image.width||l),Math.round(r.image.height||u),Math.round(e.left+n+h[3].width),Math.round(e.top+o+h[0].width),l,u)},i.prototype.renderBackground=function(t,e,i){e.height>0&&e.width>0&&(this.renderBackgroundColor(t,e),this.renderBackgroundImage(t,e,i))},i.prototype.renderBackgroundColor=function(t,e){var i=t.color("backgroundColor");i.isTransparent()||this.rectangle(e.left,e.top,e.width,e.height,i)},i.prototype.renderBorders=function(t){t.forEach(this.renderBorder,this)},i.prototype.renderBorder=function(t){t.color.isTransparent()||null===t.args||this.drawShape(t.args,t.color)},i.prototype.renderBackgroundImage=function(t,e,i){var n=t.parseBackgroundImages();n.reverse().forEach(function(n,o,s){switch(n.method){case"url":var a=this.images.get(n.args[0]);a?this.renderBackgroundRepeating(t,e,a,s.length-(o+1),i):r("Error loading background-image",n.args[0]);break;case"linear-gradient":case"gradient":var h=this.images.get(n.value);h?this.renderBackgroundGradient(h,e,i):r("Error loading background-image",n.args[0]);break;case"none":break;default:r("Unknown background-image type",n.args[0])}},this)},i.prototype.renderBackgroundRepeating=function(t,e,i,r,n){var o=t.parseBackgroundSize(e,i.image,r),s=t.parseBackgroundPosition(e,i.image,r,o),a=t.parseBackgroundRepeat(r);switch(a){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+n[3],e.top+s.top+n[0],99999,o.height,n);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+n[0],o.width,99999,n);break;case"no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+s.top+n[0],o.width,o.height,n);break;default:this.renderBackgroundRepeat(i,s,o,{top:e.top,left:e.left},n[3],n[0])}},e.exports=i},{"./log":15}],23:[function(t,e){function i(t,e){n.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=t,this.canvas.height=e),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},s("Initialized CanvasRenderer with size",t,"x",e)}function r(t){return t.length>0}var n=t("../renderer"),o=t("../lineargradientcontainer"),s=t("../log");i.prototype=Object.create(n.prototype),i.prototype.setFillStyle=function(t){return this.ctx.fillStyle="object"==typeof t&&t.isColor?t.toString():t,this.ctx},i.prototype.rectangle=function(t,e,i,r,n){this.setFillStyle(n).fillRect(t,e,i,r)},i.prototype.circle=function(t,e,i,r){this.setFillStyle(r),this.ctx.beginPath(),this.ctx.arc(t+i/2,e+i/2,i/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},i.prototype.circleStroke=function(t,e,i,r,n,o){this.circle(t,e,i,r),this.ctx.strokeStyle=o.toString(),this.ctx.stroke()},i.prototype.drawShape=function(t,e){this.shape(t),this.setFillStyle(e).fill()},i.prototype.taints=function(t){if(null===t.tainted){this.taintCtx.drawImage(t.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),t.tainted=!1}catch(e){this.taintCtx=document.createElement("canvas").getContext("2d"),t.tainted=!0}}return t.tainted},i.prototype.drawImage=function(t,e,i,r,n,o,s,a,h){(!this.taints(t)||this.options.allowTaint)&&this.ctx.drawImage(t.image,e,i,r,n,o,s,a,h)},i.prototype.clip=function(t,e,i){this.ctx.save(),t.filter(r).forEach(function(t){this.shape(t).clip()},this),e.call(i),this.ctx.restore()},i.prototype.shape=function(t){return this.ctx.beginPath(),t.forEach(function(t,e){"rect"===t[0]?this.ctx.rect.apply(this.ctx,t.slice(1)):this.ctx[0===e?"moveTo":t[0]+"To"].apply(this.ctx,t.slice(1))},this),this.ctx.closePath(),this.ctx},i.prototype.font=function(t,e,i,r,n,o){this.setFillStyle(t).font=[e,i,r,n,o].join(" ").split(",")[0]},i.prototype.fontShadow=function(t,e,i,r){this.setVariable("shadowColor",t.toString()).setVariable("shadowOffsetY",e).setVariable("shadowOffsetX",i).setVariable("shadowBlur",r)},i.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},i.prototype.setOpacity=function(t){this.ctx.globalAlpha=t},i.prototype.setTransform=function(t){this.ctx.translate(t.origin[0],t.origin[1]),this.ctx.transform.apply(this.ctx,t.matrix),this.ctx.translate(-t.origin[0],-t.origin[1])},i.prototype.setVariable=function(t,e){return this.variables[t]!==e&&(this.variables[t]=this.ctx[t]=e),this},i.prototype.text=function(t,e,i){this.ctx.fillText(t,e,i)},i.prototype.backgroundRepeatShape=function(t,e,i,r,n,o,s,a,h){var l=[["line",Math.round(n),Math.round(o)],["line",Math.round(n+s),Math.round(o)],["line",Math.round(n+s),Math.round(a+o)],["line",Math.round(n),Math.round(a+o)]];this.clip([l],function(){this.renderBackgroundRepeat(t,e,i,r,h[3],h[0])},this)},i.prototype.renderBackgroundRepeat=function(t,e,i,r,n,o){var s=Math.round(r.left+e.left+n),a=Math.round(r.top+e.top+o); -this.setFillStyle(this.ctx.createPattern(this.resizeImage(t,i),"repeat")),this.ctx.translate(s,a),this.ctx.fill(),this.ctx.translate(-s,-a)},i.prototype.renderBackgroundGradient=function(t,e){if(t instanceof o){var i=this.ctx.createLinearGradient(e.left+e.width*t.x0,e.top+e.height*t.y0,e.left+e.width*t.x1,e.top+e.height*t.y1);t.colorStops.forEach(function(t){i.addColorStop(t.stop,t.color.toString())}),this.rectangle(e.left,e.top,e.width,e.height,i)}},i.prototype.resizeImage=function(t,e){var i=t.image;if(i.width===e.width&&i.height===e.height)return i;var r,n=document.createElement("canvas");return n.width=e.width,n.height=e.height,r=n.getContext("2d"),r.drawImage(i,0,0,i.width,i.height,0,0,e.width,e.height),n},e.exports=i},{"../lineargradientcontainer":14,"../log":15,"../renderer":22}],24:[function(t,e){function i(t,e,i,n){r.call(this,i,n),this.ownStacking=t,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*e}var r=t("./nodecontainer");i.prototype=Object.create(r.prototype),i.prototype.getParentStack=function(t){var e=this.parent?this.parent.stack:null;return e?e.ownStacking?e:e.getParentStack(t):t.stack},e.exports=i},{"./nodecontainer":16}],25:[function(t,e){function i(t){this.rangeBounds=this.testRangeBounds(t),this.cors=this.testCORS(),this.svg=this.testSVG()}i.prototype.testRangeBounds=function(t){var e,i,r,n,o=!1;return t.createRange&&(e=t.createRange(),e.getBoundingClientRect&&(i=t.createElement("boundtest"),i.style.height="123px",i.style.display="block",t.body.appendChild(i),e.selectNode(i),r=e.getBoundingClientRect(),n=r.height,123===n&&(o=!0),t.body.removeChild(i))),o},i.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},i.prototype.testSVG=function(){var t=new Image,e=document.createElement("canvas"),i=e.getContext("2d");t.src="data:image/svg+xml,";try{i.drawImage(t,0,0),e.toDataURL()}catch(r){return!1}return!0},e.exports=i},{}],26:[function(t,e){function i(t){this.src=t,this.image=null;var e=this;this.promise=this.hasFabric().then(function(){return e.isInline(t)?r.resolve(e.inlineFormatting(t)):n(t)}).then(function(t){return new r(function(i){window.html2canvas.svg.fabric.loadSVGFromString(t,e.createCanvas.call(e,i))})})}var r=t("./promise"),n=t("./xhr"),o=t("./utils").decode64;i.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?r.resolve():r.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},i.prototype.inlineFormatting=function(t){return/^data:image\/svg\+xml;base64,/.test(t)?this.decode64(this.removeContentType(t)):this.removeContentType(t)},i.prototype.removeContentType=function(t){return t.replace(/^data:image\/svg\+xml(;base64)?,/,"")},i.prototype.isInline=function(t){return/^data:image\/svg\+xml/i.test(t)},i.prototype.createCanvas=function(t){var e=this;return function(i,r){var n=new window.html2canvas.svg.fabric.StaticCanvas("c");e.image=n.lowerCanvasEl,n.setWidth(r.width).setHeight(r.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(i,r)).renderAll(),t(n.lowerCanvasEl)}},i.prototype.decode64=function(t){return"function"==typeof window.atob?window.atob(t):o(t)},e.exports=i},{"./promise":18,"./utils":29,"./xhr":31}],27:[function(t,e){function i(t,e){this.src=t,this.image=null;var i=this;this.promise=e?new n(function(e,r){i.image=new Image,i.image.onload=e,i.image.onerror=r,i.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(t),i.image.complete===!0&&e(i.image)}):this.hasFabric().then(function(){return new n(function(e){window.html2canvas.svg.fabric.parseSVGDocument(t,i.createCanvas.call(i,e))})})}var r=t("./svgcontainer"),n=t("./promise");i.prototype=Object.create(r.prototype),e.exports=i},{"./promise":18,"./svgcontainer":26}],28:[function(t,e){function i(t,e){n.call(this,t,e)}function r(t,e,i){return t.length>0?e+i.toUpperCase():void 0}var n=t("./nodecontainer");i.prototype=Object.create(n.prototype),i.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},i.prototype.transform=function(t){var e=this.node.data;switch(t){case"lowercase":return e.toLowerCase();case"capitalize":return e.replace(/(^|\s|:|-|\(|\))([a-z])/g,r);case"uppercase":return e.toUpperCase();default:return e}},e.exports=i},{"./nodecontainer":16}],29:[function(t,e,i){i.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},i.bind=function(t,e){return function(){return t.apply(e,arguments)}},i.decode64=function(t){var e,i,r,n,o,s,a,h,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=t.length,c="";for(e=0;u>e;e+=4)i=l.indexOf(t[e]),r=l.indexOf(t[e+1]),n=l.indexOf(t[e+2]),o=l.indexOf(t[e+3]),s=i<<2|r>>4,a=(15&r)<<4|n>>2,h=(3&n)<<6|o,c+=64===n?String.fromCharCode(s):64===o||-1===o?String.fromCharCode(s,a):String.fromCharCode(s,a,h);return c},i.getBounds=function(t){if(t.getBoundingClientRect){var e=t.getBoundingClientRect(),i=null==t.offsetWidth?e.width:t.offsetWidth;return{top:e.top,bottom:e.bottom||e.top+e.height,right:e.left+i,left:e.left,width:i,height:null==t.offsetHeight?e.height:t.offsetHeight}}return{}},i.offsetBounds=function(t){var e=t.offsetParent?i.offsetBounds(t.offsetParent):{top:0,left:0};return{top:t.offsetTop+e.top,bottom:t.offsetTop+t.offsetHeight+e.top,right:t.offsetLeft+e.left+t.offsetWidth,left:t.offsetLeft+e.left,width:t.offsetWidth,height:t.offsetHeight}},i.parseBackgrounds=function(t){var e,i,r,n,o,s,a,h=" \r\n ",l=[],u=0,c=0,d=function(){e&&('"'===i.substr(0,1)&&(i=i.substr(1,i.length-2)),i&&a.push(i),"-"===e.substr(0,1)&&(n=e.indexOf("-",1)+1)>0&&(r=e.substr(0,n),e=e.substr(n)),l.push({prefix:r,method:e.toLowerCase(),value:o,args:a,image:null})),a=[],e=r=i=o=""};return a=[],e=r=i=o="",t.split("").forEach(function(t){if(!(0===u&&h.indexOf(t)>-1)){switch(t){case'"':s?s===t&&(s=null):s=t;break;case"(":if(s)break;if(0===u)return u=1,void(o+=t);c++;break;case")":if(s)break;if(1===u){if(0===c)return u=0,o+=t,void d();c--}break;case",":if(s)break;if(0===u)return void d();if(1===u&&0===c&&!e.match(/^url$/i))return a.push(i),i="",void(o+=t)}o+=t,0===u?e+=t:i+=t}}),d(),l}},{}],30:[function(t,e){function i(t){r.apply(this,arguments),this.type="linear"===t.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}var r=t("./gradientcontainer");i.prototype=Object.create(r.prototype),e.exports=i},{"./gradientcontainer":11}],31:[function(t,e){function i(t){return new r(function(e,i){var r=new XMLHttpRequest;r.open("GET",t),r.onload=function(){200===r.status?e(r.responseText):i(new Error(r.statusText))},r.onerror=function(){i(new Error("Network Error"))},r.send()})}var r=t("./promise");e.exports=i},{"./promise":18}]},{},[6])(6)}),function(t){function e(t){var e=t.length,r=i.type(t);return"function"===r||i.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===r||0===e||"number"==typeof e&&e>0&&e-1 in t}if(!t.jQuery){var i=function(t,e){return new i.fn.init(t,e)};i.isWindow=function(t){return null!=t&&t==t.window},i.type=function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?n[s.call(t)]||"object":typeof t},i.isArray=Array.isArray||function(t){return"array"===i.type(t)},i.isPlainObject=function(t){var e;if(!t||"object"!==i.type(t)||t.nodeType||i.isWindow(t))return!1;try{if(t.constructor&&!o.call(t,"constructor")&&!o.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}for(e in t);return void 0===e||o.call(t,e)},i.each=function(t,i,r){var n,o=0,s=t.length,a=e(t);if(r){if(a)for(;s>o&&(n=i.apply(t[o],r),n!==!1);o++);else for(o in t)if(n=i.apply(t[o],r),n===!1)break}else if(a)for(;s>o&&(n=i.call(t[o],o,t[o]),n!==!1);o++);else for(o in t)if(n=i.call(t[o],o,t[o]),n===!1)break;return t},i.data=function(t,e,n){if(void 0===n){var o=t[i.expando],s=o&&r[o];if(void 0===e)return s;if(s&&e in s)return s[e]}else if(void 0!==e){var o=t[i.expando]||(t[i.expando]=++i.uuid);return r[o]=r[o]||{},r[o][e]=n,n}},i.removeData=function(t,e){var n=t[i.expando],o=n&&r[n];o&&i.each(e,function(t,e){delete o[e]})},i.extend=function(){var t,e,r,n,o,s,a=arguments[0]||{},h=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[h]||{},h++),"object"!=typeof a&&"function"!==i.type(a)&&(a={}),h===l&&(a=this,h--);l>h;h++)if(null!=(o=arguments[h]))for(n in o)t=a[n],r=o[n],a!==r&&(u&&r&&(i.isPlainObject(r)||(e=i.isArray(r)))?(e?(e=!1,s=t&&i.isArray(t)?t:[]):s=t&&i.isPlainObject(t)?t:{},a[n]=i.extend(u,s,r)):void 0!==r&&(a[n]=r));return a},i.queue=function(t,r,n){function o(t,i){var r=i||[];return null!=t&&(e(Object(t))?!function(t,e){for(var i=+e.length,r=0,n=t.length;i>r;)t[n++]=e[r++];if(i!==i)for(;void 0!==e[r];)t[n++]=e[r++];return t.length=n,t}(r,"string"==typeof t?[t]:t):[].push.call(r,t)),r}if(t){r=(r||"fx")+"queue";var s=i.data(t,r);return n?(!s||i.isArray(n)?s=i.data(t,r,o(n)):s.push(n),s):s||[]}},i.dequeue=function(t,e){i.each(t.nodeType?[t]:t,function(t,r){e=e||"fx";var n=i.queue(r,e),o=n.shift();"inprogress"===o&&(o=n.shift()),o&&("fx"===e&&n.unshift("inprogress"),o.call(r,function(){i.dequeue(r,e)}))})},i.fn=i.prototype={init:function(t){if(t.nodeType)return this[0]=t,this;throw new Error("Not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:e.top+(t.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:e.left+(t.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function t(){for(var t=this.offsetParent||document;t&&"html"===!t.nodeType.toLowerCase&&"static"===t.style.position;)t=t.offsetParent;return t||document}var e=this[0],t=t.apply(e),r=this.offset(),n=/^(?:body|html)$/i.test(t.nodeName)?{top:0,left:0}:i(t).offset();return r.top-=parseFloat(e.style.marginTop)||0,r.left-=parseFloat(e.style.marginLeft)||0,t.style&&(n.top+=parseFloat(t.style.borderTopWidth)||0,n.left+=parseFloat(t.style.borderLeftWidth)||0),{top:r.top-n.top,left:r.left-n.left}}};var r={};i.expando="velocity"+(new Date).getTime(),i.uuid=0;for(var n={},o=n.hasOwnProperty,s=n.toString,a="Boolean Number String Function Array Date RegExp Object Error".split(" "),h=0;hn;++n){var o=l(i,t,r);if(0===o)return i;var s=h(i,t,r)-e;i-=s/o}return i}function c(){for(var e=0;x>e;++e)S[e]=h(e*b,t,r)}function d(e,i,n){var o,s,a=0;do s=i+(n-i)/2,o=h(s,t,r)-e,o>0?n=s:i=s;while(Math.abs(o)>v&&++a=m?u(e,a):0==h?a:d(e,i,i+b)}function f(){C=!0,(t!=i||r!=n)&&c()}var g=4,m=.001,v=1e-7,y=10,x=11,b=1/(x-1),w="Float32Array"in e;if(4!==arguments.length)return!1;for(var T=0;4>T;++T)if("number"!=typeof arguments[T]||isNaN(arguments[T])||!isFinite(arguments[T]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var S=w?new Float32Array(x):new Array(x),C=!1,E=function(e){return C||f(),t===i&&r===n?e:0===e?0:1===e?1:h(p(e),i,n)};E.getControlPoints=function(){return[{x:t,y:i},{x:r,y:n}]};var A="generateBezier("+[t,i,r,n]+")";return E.toString=function(){return A},E}function l(t,e){var i=t;return g.isString(t)?x.Easings[t]||(i=!1):i=g.isArray(t)&&1===t.length?a.apply(null,t):g.isArray(t)&&2===t.length?b.apply(null,t.concat([e])):g.isArray(t)&&4===t.length?h.apply(null,t):!1,i===!1&&(i=x.Easings[x.defaults.easing]?x.defaults.easing:y),i}function u(t){if(t){var e=(new Date).getTime(),i=x.State.calls.length;i>1e4&&(x.State.calls=n(x.State.calls));for(var o=0;i>o;o++)if(x.State.calls[o]){var a=x.State.calls[o],h=a[0],l=a[2],p=a[3],f=!!p,m=null;p||(p=x.State.calls[o][3]=e-16);for(var v=Math.min((e-p)/l.duration,1),y=0,b=h.length;b>y;y++){var T=h[y],C=T.element;if(s(C)){var E=!1;if(l.display!==r&&null!==l.display&&"none"!==l.display){if("flex"===l.display){var A=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];d.each(A,function(t,e){w.setPropertyValue(C,"display",e)})}w.setPropertyValue(C,"display",l.display)}l.visibility!==r&&"hidden"!==l.visibility&&w.setPropertyValue(C,"visibility",l.visibility);for(var _ in T)if("element"!==_){var M,L=T[_],R=g.isString(L.easing)?x.Easings[L.easing]:L.easing;if(1===v)M=L.endValue;else{var P=L.endValue-L.startValue;if(M=L.startValue+P*R(v,l,P),!f&&M===L.currentValue)continue}if(L.currentValue=M,"tween"===_)m=M;else{if(w.Hooks.registered[_]){var F=w.Hooks.getRoot(_),B=s(C).rootPropertyValueCache[F];B&&(L.rootPropertyValue=B)}var I=w.setPropertyValue(C,_,L.currentValue+(0===parseFloat(M)?"":L.unitType),L.rootPropertyValue,L.scrollData);w.Hooks.registered[_]&&(s(C).rootPropertyValueCache[F]=w.Normalizations.registered[F]?w.Normalizations.registered[F]("extract",null,I[1]):I[1]),"transform"===I[0]&&(E=!0)}}l.mobileHA&&s(C).transformCache.translate3d===r&&(s(C).transformCache.translate3d="(0px, 0px, 0px)",E=!0),E&&w.flushTransformCache(C)}}l.display!==r&&"none"!==l.display&&(x.State.calls[o][2].display=!1),l.visibility!==r&&"hidden"!==l.visibility&&(x.State.calls[o][2].visibility=!1),l.progress&&l.progress.call(a[1],a[1],v,Math.max(0,p+l.duration-e),p,m),1===v&&c(o)}}x.State.isTicking&&S(u)}function c(t,e){if(!x.State.calls[t])return!1;for(var i=x.State.calls[t][0],n=x.State.calls[t][1],o=x.State.calls[t][2],a=x.State.calls[t][4],h=!1,l=0,u=i.length;u>l;l++){var c=i[l].element;if(e||o.loop||("none"===o.display&&w.setPropertyValue(c,"display",o.display),"hidden"===o.visibility&&w.setPropertyValue(c,"visibility",o.visibility)),o.loop!==!0&&(d.queue(c)[1]===r||!/\.velocityQueueEntryFlag/i.test(d.queue(c)[1]))&&s(c)){s(c).isAnimating=!1,s(c).rootPropertyValueCache={};var p=!1;d.each(w.Lists.transforms3D,function(t,e){var i=/^scale/.test(e)?1:0,n=s(c).transformCache[e];s(c).transformCache[e]!==r&&new RegExp("^\\("+i+"[^.]").test(n)&&(p=!0,delete s(c).transformCache[e])}),o.mobileHA&&(p=!0,delete s(c).transformCache.translate3d),p&&w.flushTransformCache(c),w.Values.removeClass(c,"velocity-animating")}if(!e&&o.complete&&!o.loop&&l===u-1)try{o.complete.call(n,n)}catch(f){setTimeout(function(){throw f},1)}a&&o.loop!==!0&&a(n),s(c)&&o.loop===!0&&!e&&(d.each(s(c).tweensContainer,function(t,e){/^rotate/.test(t)&&360===parseFloat(e.endValue)&&(e.endValue=0,e.startValue=360),/^backgroundPosition/.test(t)&&100===parseFloat(e.endValue)&&"%"===e.unitType&&(e.endValue=0,e.startValue=100)}),x(c,"reverse",{loop:!0,delay:o.delay})),o.queue!==!1&&d.dequeue(c,o.queue)}x.State.calls[t]=!1;for(var g=0,m=x.State.calls.length;m>g;g++)if(x.State.calls[g]!==!1){h=!0;break}h===!1&&(x.State.isTicking=!1,delete x.State.calls,x.State.calls=[])}var d,p=function(){if(i.documentMode)return i.documentMode;for(var t=7;t>4;t--){var e=i.createElement("div");if(e.innerHTML="",e.getElementsByTagName("span").length)return e=null,t}return r}(),f=function(){var t=0;return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(e){var i,r=(new Date).getTime();return i=Math.max(0,16-(r-t)),t=r+i,setTimeout(function(){e(r+i)},i)}}(),g={isString:function(t){return"string"==typeof t},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)},isNode:function(t){return t&&t.nodeType},isNodeList:function(t){return"object"==typeof t&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&t.length!==r&&(0===t.length||"object"==typeof t[0]&&t[0].nodeType>0)},isWrapped:function(t){return t&&(t.jquery||e.Zepto&&e.Zepto.zepto.isZ(t))},isSVG:function(t){return e.SVGElement&&t instanceof e.SVGElement},isEmptyObject:function(t){for(var e in t)return!1;return!0}},m=!1;if(t.fn&&t.fn.jquery?(d=t,m=!0):d=e.Velocity.Utilities,8>=p&&!m)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(7>=p)return void(jQuery.fn.velocity=jQuery.fn.animate);var v=400,y="swing",x={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:e.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:d,Redirects:{},Easings:{},Promise:e.Promise,defaults:{queue:"",duration:v,easing:y,begin:r,complete:r,progress:r,display:r,visibility:r,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(t){d.data(t,"velocity",{isSVG:g.isSVG(t),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};e.pageYOffset!==r?(x.State.scrollAnchor=e,x.State.scrollPropertyLeft="pageXOffset",x.State.scrollPropertyTop="pageYOffset"):(x.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,x.State.scrollPropertyLeft="scrollLeft",x.State.scrollPropertyTop="scrollTop");var b=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,i,r){var n={x:e.x+r.dx*i,v:e.v+r.dv*i,tension:e.tension,friction:e.friction};return{dx:n.v,dv:t(n)}}function i(i,r){var n={dx:i.v,dv:t(i)},o=e(i,.5*r,n),s=e(i,.5*r,o),a=e(i,r,s),h=1/6*(n.dx+2*(o.dx+s.dx)+a.dx),l=1/6*(n.dv+2*(o.dv+s.dv)+a.dv);return i.x=i.x+h*r,i.v=i.v+l*r,i}return function r(t,e,n){var o,s,a,h={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1e-4,d=.016;for(t=parseFloat(t)||500,e=parseFloat(e)||20,n=n||null,h.tension=t,h.friction=e,o=null!==n,o?(u=r(t,e),s=u/n*d):s=d;;)if(a=i(a||h,s),l.push(1+a.x),u+=16,!(Math.abs(a.x)>c&&Math.abs(a.v)>c))break;return o?function(t){return l[t*(l.length-1)|0]}:u}}();x.Easings={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},spring:function(t){return 1-Math.cos(4.5*t*Math.PI)*Math.exp(6*-t)}},d.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(t,e){x.Easings[e[0]]=h.apply(null,e[1])});var w=x.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var t=0;t=p)switch(t){case"name":return"filter";case"extract":var r=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=r?r[1]/100:1;case"inject":return e.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(t){case"name":return"opacity";case"extract":return i;case"inject":return i}}},register:function(){9>=p||x.State.isGingerbread||(w.Lists.transformsBase=w.Lists.transformsBase.concat(w.Lists.transforms3D));for(var t=0;tn&&(n=1),o=!/(\d)$/i.test(n);break;case"skew":o=!/(deg|\d)$/i.test(n);break;case"rotate":o=!/(deg|\d)$/i.test(n)}return o||(s(i).transformCache[e]="("+n+")"),s(i).transformCache[e]}}}();for(var t=0;t=p||3!==o.split(" ").length||(o+=" 1"),o;case"inject":return 8>=p?4===n.split(" ").length&&(n=n.split(/\s+/).slice(0,3).join(" ")):3===n.split(" ").length&&(n+=" 1"),(8>=p?"rgb":"rgba")+"("+n.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},SVGAttribute:function(t){var e="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(p||x.State.isAndroid&&!x.State.isChrome)&&(e+="|transform"),new RegExp("^("+e+")$","i").test(t)},prefixCheck:function(t){if(x.State.prefixMatches[t])return[x.State.prefixMatches[t],!0];for(var e=["","Webkit","Moz","ms","O"],i=0,r=e.length;r>i;i++){var n;if(n=0===i?t:e[i]+t.replace(/^\w/,function(t){return t.toUpperCase()}),g.isString(x.State.prefixElement.style[n]))return x.State.prefixMatches[t]=n,[n,!0]}return[t,!1]}},Values:{hexToRgb:function(t){var e,i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return t=t.replace(i,function(t,e,i,r){return e+e+i+i+r+r}),e=r.exec(t),e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]},isCSSNullValue:function(t){return 0==t||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(t)},getUnitType:function(t){return/^(rotate|skew)/i.test(t)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(t)?"":"px"},getDisplayType:function(t){var e=t&&t.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(e)?"inline":/^(li)$/i.test(e)?"list-item":/^(tr)$/i.test(e)?"table-row":/^(table)$/i.test(e)?"table":/^(tbody)$/i.test(e)?"table-row-group":"block"},addClass:function(t,e){t.classList?t.classList.add(e):t.className+=(t.className.length?" ":"")+e},removeClass:function(t,e){t.classList?t.classList.remove(e):t.className=t.className.toString().replace(new RegExp("(^|\\s)"+e.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(t,i,n,o){function a(t,i){function n(){l&&w.setPropertyValue(t,"display","none")}var h=0;if(8>=p)h=d.css(t,i);else{var l=!1;if(/^(width|height)$/.test(i)&&0===w.getPropertyValue(t,"display")&&(l=!0,w.setPropertyValue(t,"display",w.Values.getDisplayType(t))),!o){if("height"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var u=t.offsetHeight-(parseFloat(w.getPropertyValue(t,"borderTopWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderBottomWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingTop"))||0)-(parseFloat(w.getPropertyValue(t,"paddingBottom"))||0);return n(),u}if("width"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var c=t.offsetWidth-(parseFloat(w.getPropertyValue(t,"borderLeftWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderRightWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingLeft"))||0)-(parseFloat(w.getPropertyValue(t,"paddingRight"))||0);return n(),c}}var f;f=s(t)===r?e.getComputedStyle(t,null):s(t).computedStyle?s(t).computedStyle:s(t).computedStyle=e.getComputedStyle(t,null),"borderColor"===i&&(i="borderTopColor"),h=9===p&&"filter"===i?f.getPropertyValue(i):f[i],(""===h||null===h)&&(h=t.style[i]),n()}if("auto"===h&&/^(top|right|bottom|left)$/i.test(i)){var g=a(t,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(i))&&(h=d(t).position()[i]+"px")}return h}var h;if(w.Hooks.registered[i]){var l=i,u=w.Hooks.getRoot(l);n===r&&(n=w.getPropertyValue(t,w.Names.prefixCheck(u)[0])),w.Normalizations.registered[u]&&(n=w.Normalizations.registered[u]("extract",t,n)),h=w.Hooks.extractValue(l,n)}else if(w.Normalizations.registered[i]){var c,f;c=w.Normalizations.registered[i]("name",t),"transform"!==c&&(f=a(t,w.Names.prefixCheck(c)[0]),w.Values.isCSSNullValue(f)&&w.Hooks.templates[i]&&(f=w.Hooks.templates[i][1])),h=w.Normalizations.registered[i]("extract",t,f)}if(!/^[\d-]/.test(h))if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))if(/^(height|width)$/i.test(i))try{h=t.getBBox()[i]}catch(g){h=0}else h=t.getAttribute(i);else h=a(t,w.Names.prefixCheck(i)[0]);return w.Values.isCSSNullValue(h)&&(h=0),x.debug>=2&&console.log("Get "+i+": "+h),h},setPropertyValue:function(t,i,r,n,o){var a=i;if("scroll"===i)o.container?o.container["scroll"+o.direction]=r:"Left"===o.direction?e.scrollTo(r,o.alternateValue):e.scrollTo(o.alternateValue,r);else if(w.Normalizations.registered[i]&&"transform"===w.Normalizations.registered[i]("name",t))w.Normalizations.registered[i]("inject",t,r),a="transform",r=s(t).transformCache[i];else{if(w.Hooks.registered[i]){var h=i,l=w.Hooks.getRoot(i);n=n||w.getPropertyValue(t,l),r=w.Hooks.injectValue(h,r,n),i=l}if(w.Normalizations.registered[i]&&(r=w.Normalizations.registered[i]("inject",t,r),i=w.Normalizations.registered[i]("name",t)),a=w.Names.prefixCheck(i)[0],8>=p)try{t.style[a]=r}catch(u){x.debug&&console.log("Browser does not support ["+r+"] for ["+a+"]")}else if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))t.setAttribute(i,r);else{var c="webgl"===t.renderer?t.styleGL:t.style;c[a]=r}x.debug>=2&&console.log("Set "+i+" ("+a+"): "+r)}return[a,r]},flushTransformCache:function(t){function e(e){return parseFloat(w.getPropertyValue(t,e))}var i="";if((p||x.State.isAndroid&&!x.State.isChrome)&&s(t).isSVG){var r={translate:[e("translateX"),e("translateY")],skewX:[e("skewX")],skewY:[e("skewY")],scale:1!==e("scale")?[e("scale"),e("scale")]:[e("scaleX"),e("scaleY")],rotate:[e("rotateZ"),0,0]};d.each(s(t).transformCache,function(t){/^translate/i.test(t)?t="translate":/^scale/i.test(t)?t="scale":/^rotate/i.test(t)&&(t="rotate"),r[t]&&(i+=t+"("+r[t].join(" ")+") ",delete r[t])})}else{var n,o;d.each(s(t).transformCache,function(e){return n=s(t).transformCache[e],"transformPerspective"===e?(o=n,!0):(9===p&&"rotateZ"===e&&(e="rotate"),void(i+=e+n+" "))}),o&&(i="perspective"+o+" "+i)}w.setPropertyValue(t,"transform",i)}};w.Hooks.register(),w.Normalizations.register(),x.hook=function(t,e,i){var n=r;return t=o(t),d.each(t,function(t,o){if(s(o)===r&&x.init(o),i===r)n===r&&(n=x.CSS.getPropertyValue(o,e));else{var a=x.CSS.setPropertyValue(o,e,i);"transform"===a[0]&&x.CSS.flushTransformCache(o),n=a}}),n};var T=function(){function t(){return a?_.promise||null:h}function n(){function t(){function t(t,e){var i=r,n=r,s=r;return g.isArray(t)?(i=t[0],!g.isArray(t[1])&&/^[\d-]/.test(t[1])||g.isFunction(t[1])||w.RegEx.isHex.test(t[1])?s=t[1]:(g.isString(t[1])&&!w.RegEx.isHex.test(t[1])||g.isArray(t[1]))&&(n=e?t[1]:l(t[1],a.duration),t[2]!==r&&(s=t[2]))):i=t,e||(n=n||a.easing),g.isFunction(i)&&(i=i.call(o,C,S)),g.isFunction(s)&&(s=s.call(o,C,S)),[i||0,n,s]}function c(t,e){var i,r;return r=(e||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(t){return i=t,""}),i||(i=w.Values.getUnitType(t)),[r,i]}function p(){var t={myParent:o.parentNode||i.body,position:w.getPropertyValue(o,"position"),fontSize:w.getPropertyValue(o,"fontSize")},r=t.position===I.lastPosition&&t.myParent===I.lastParent,n=t.fontSize===I.lastFontSize;I.lastParent=t.myParent,I.lastPosition=t.position,I.lastFontSize=t.fontSize;var a=100,h={};if(n&&r)h.emToPx=I.lastEmToPx,h.percentToPxWidth=I.lastPercentToPxWidth,h.percentToPxHeight=I.lastPercentToPxHeight;else{var l=s(o).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");x.init(l),t.myParent.appendChild(l),d.each(["overflow","overflowX","overflowY"],function(t,e){x.CSS.setPropertyValue(l,e,"hidden")}),x.CSS.setPropertyValue(l,"position",t.position),x.CSS.setPropertyValue(l,"fontSize",t.fontSize),x.CSS.setPropertyValue(l,"boxSizing","content-box"),d.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(t,e){x.CSS.setPropertyValue(l,e,a+"%")}),x.CSS.setPropertyValue(l,"paddingLeft",a+"em"),h.percentToPxWidth=I.lastPercentToPxWidth=(parseFloat(w.getPropertyValue(l,"width",null,!0))||1)/a,h.percentToPxHeight=I.lastPercentToPxHeight=(parseFloat(w.getPropertyValue(l,"height",null,!0))||1)/a,h.emToPx=I.lastEmToPx=(parseFloat(w.getPropertyValue(l,"paddingLeft"))||1)/a,t.myParent.removeChild(l) -}return null===I.remToPx&&(I.remToPx=parseFloat(w.getPropertyValue(i.body,"fontSize"))||16),null===I.vwToPx&&(I.vwToPx=parseFloat(e.innerWidth)/100,I.vhToPx=parseFloat(e.innerHeight)/100),h.remToPx=I.remToPx,h.vwToPx=I.vwToPx,h.vhToPx=I.vhToPx,x.debug>=1&&console.log("Unit ratios: "+JSON.stringify(h),o),h}if(a.begin&&0===C)try{a.begin.call(f,f)}catch(v){setTimeout(function(){throw v},1)}if("scroll"===M){var b,T,E,A=/^x$/i.test(a.axis)?"Left":"Top",L=parseFloat(a.offset)||0;a.container?g.isWrapped(a.container)||g.isNode(a.container)?(a.container=a.container[0]||a.container,b=a.container["scroll"+A],E=b+d(o).position()[A.toLowerCase()]+L):a.container=null:(b=x.State.scrollAnchor[x.State["scrollProperty"+A]],T=x.State.scrollAnchor[x.State["scrollProperty"+("Left"===A?"Top":"Left")]],E=d(o).offset()[A.toLowerCase()]+L),h={scroll:{rootPropertyValue:!1,startValue:b,currentValue:b,endValue:E,unitType:"",easing:a.easing,scrollData:{container:a.container,direction:A,alternateValue:T}},element:o},x.debug&&console.log("tweensContainer (scroll): ",h.scroll,o)}else if("reverse"===M){if(!s(o).tweensContainer)return void d.dequeue(o,a.queue);"none"===s(o).opts.display&&(s(o).opts.display="auto"),"hidden"===s(o).opts.visibility&&(s(o).opts.visibility="visible"),s(o).opts.loop=!1,s(o).opts.begin=null,s(o).opts.complete=null,y.easing||delete a.easing,y.duration||delete a.duration,a=d.extend({},s(o).opts,a);var R=d.extend(!0,{},s(o).tweensContainer);for(var P in R)if("element"!==P){var F=R[P].startValue;R[P].startValue=R[P].currentValue=R[P].endValue,R[P].endValue=F,g.isEmptyObject(y)||(R[P].easing=a.easing),x.debug&&console.log("reverse tweensContainer ("+P+"): "+JSON.stringify(R[P]),o)}h=R}else if("start"===M){var R;s(o).tweensContainer&&s(o).isAnimating===!0&&(R=s(o).tweensContainer),d.each(m,function(e,i){if(RegExp("^"+w.Lists.colors.join("$|^")+"$").test(e)){var n=t(i,!0),o=n[0],s=n[1],a=n[2];if(w.RegEx.isHex.test(o)){for(var h=["Red","Green","Blue"],l=w.Values.hexToRgb(o),u=a?w.Values.hexToRgb(a):r,c=0;ck;k++){var G={delay:R.delay,progress:R.progress};k===D-1&&(G.display=R.display,G.visibility=R.visibility,G.complete=R.complete),T(f,"reverse",G)}return t()}};x=d.extend(T,x),x.animate=T;var S=e.requestAnimationFrame||f;return x.State.isMobile||i.hidden===r||i.addEventListener("visibilitychange",function(){i.hidden?(S=function(t){return setTimeout(function(){t(!0)},16)},u()):S=e.requestAnimationFrame||f}),t.Velocity=x,t!==e&&(t.fn.velocity=T,t.fn.velocity.defaults=x.defaults),d.each(["Down","Up"],function(t,e){x.Redirects["slide"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l=h.begin,u=h.complete,c={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},p={};h.display===r&&(h.display="Down"===e?"inline"===x.CSS.Values.getDisplayType(t)?"inline-block":"block":"none"),h.begin=function(){var i="webgl"===t.renderer?t.styleGL:t.style;l&&l.call(s,s);for(var r in c){p[r]=i[r];var n=x.CSS.getPropertyValue(t,r);c[r]="Down"===e?[n,0]:[0,n]}p.overflow=i.overflow,i.overflow="hidden"},h.complete=function(){for(var t in p)style[t]=p[t];u&&u.call(s,s),a&&a.resolver(s)},x(t,c,h)}}),d.each(["In","Out"],function(t,e){x.Redirects["fade"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l={opacity:"In"===e?1:0},u=h.complete;h.complete=n!==o-1?h.begin=null:function(){u&&u.call(s,s),a&&a.resolver(s)},h.display===r&&(h.display="In"===e?"auto":"none"),x(this,l,h)}}),x}(window.jQuery||window.Zepto||window,window,document)}),function(t){t.HTMLGL=t.HTMLGL||{},t.HTMLGL.util={getterSetter:function(t,e,i,r){Object.defineProperty?Object.defineProperty(t,e,{get:i,set:r}):document.__defineGetter__&&(t.__defineGetter__(e,i),t.__defineSetter__(e,r)),t["get"+e]=i,t["set"+e]=r},emitEvent:function(t,e){var i=new MouseEvent(e.type,e);i.dispatcher="html-gl",e.stopPropagation(),t.dispatchEvent(i)}}}(window),function(t){var e=function(){},i=e.prototype;i.getElementByCoordinates=function(e,i){var r,n,o=this;return t.HTMLGL.elements.forEach(function(t){r=document.elementFromPoint(e-parseInt(t.transformObject.translateX||0),i-parseInt(t.transformObject.translateY||0)),o.isChildOf(r,t)&&(n=r)}),n},i.isChildOf=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},t.HTMLGL.GLElementResolver=e}(window),function(t){HTMLGL=t.HTMLGL=t.HTMLGL||{},HTMLGL.JQ_PLUGIN_NAME="htmlgl",HTMLGL.CUSTOM_ELEMENT_TAG_NAME="html-gl",HTMLGL.context=void 0,HTMLGL.stage=void 0,HTMLGL.renderer=void 0,HTMLGL.elements=[],HTMLGL.scrollX=0,HTMLGL.scrollY=0;var e=function(){t.HTMLGL.context=this,this.createStage(),this.updateScrollPosition(),this.initListeners(),this.elementResolver=new t.HTMLGL.GLElementResolver(this),document.body?this.initViewer():document.addEventListener("DOMContentLoaded",this.initViewer.bind(this))},i=e.prototype;i.initViewer=function(){this.createViewer(),this.resizeViewer(),this.appendViewer()},i.initListeners=function(){t.addEventListener("scroll",this.updateScrollPosition.bind(this)),t.addEventListener("resize",this.resizeViewer.bind(this)),document.addEventListener("click",this.onMouseEvent.bind(this),!0),document.addEventListener("mousemove",this.onMouseEvent.bind(this),!0),document.addEventListener("mouseup",this.onMouseEvent.bind(this),!0),document.addEventListener("mousedown",this.onMouseEvent.bind(this),!0),document.addEventListener("touchstart",this.onMouseEvent.bind(this)),document.addEventListener("touchend",this.onMouseEvent.bind(this))},i.updateScrollPosition=function(){var e={};if(void 0!=window.pageYOffset)e={left:pageXOffset,top:pageYOffset};else{var i,r,n=document,o=n.documentElement,s=n.body;i=o.scrollLeft||s.scrollLeft||0,r=o.scrollTop||s.scrollTop||0,e={left:i,top:r}}this.document.x=-e.left,this.document.y=-e.top,t.HTMLGL.scrollX=e.left,t.HTMLGL.scrollY=e.top,this.markStageAsChanged()},i.createViewer=function(){t.HTMLGL.renderer=this.renderer=PIXI.autoDetectRenderer(0,0,{transparent:!0}),this.renderer.view.style.position="fixed",this.renderer.view.style.top="0px",this.renderer.view.style.left="0px",this.renderer.view.style["pointer-events"]="none",this.renderer.view.style.pointerEvents="none"},i.appendViewer=function(){document.body.appendChild(this.renderer.view),requestAnimFrame(this.redrawStage.bind(this))},i.resizeViewer=function(){var e=t.innerWidth,i=t.innerHeight;this.renderer.resize(e,i),this.updateTextures(),this.markStageAsChanged()},i.createStage=function(){t.HTMLGL.stage=this.stage=new PIXI.Stage(16777215),t.HTMLGL.document=this.document=new PIXI.DisplayObjectContainer,this.stage.addChild(t.HTMLGL.document)},i.redrawStage=function(){t.HTMLGL.stage.changed&&(t.HTMLGL.renderer.render(t.HTMLGL.stage),t.HTMLGL.stage.changed=!1)},i.updateTextures=function(){t.HTMLGL.elements.forEach(function(t){t.updateTexture()})},i.onMouseEvent=function(e){var i=e.x||e.pageX,r=e.y||e.pageY,n="html-gl"!==e.dispatcher?this.elementResolver.getElementByCoordinates(i,r):null;n?t.HTMLGL.util.emitEvent(n,e):null},i.markStageAsChanged=function(){t.HTMLGL.stage&&!t.HTMLGL.stage.changed&&(requestAnimFrame(this.redrawStage),t.HTMLGL.stage.changed=!0)},t.HTMLGL.GLContext=e,new e}(window),function(t){var e=function(t,e){this.element=t,this.images=this.element.querySelectorAll("img"),this.callback=e,this.imagesLoaded=this.getImagesLoaded(),this.images.length===this.imagesLoaded?this.onImageLoaded():this.addListeners()},i=e.prototype;i.getImagesLoaded=function(){for(var t=0,e=0;et;t++)i.call(this,this._deferreds[t]);this._deferreds=null}function s(t,e,i,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=i,this.reject=r}function a(t,e,i){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,i(t))})}catch(n){if(r)return;r=!0,i(n)}}var h;h="object"==typeof window&&window?window:global;var l=e.immediateFn||h.setImmediate||function(t){setTimeout(t,1)},u=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.prototype["catch"]=function(t){return this.then(null,t)},e.prototype.then=function(t,r){var n=this;return new e(function(e,o){i.call(n,new s(t,r,e,o))})},e.all=function(){var t=Array.prototype.slice.call(1===arguments.length&&u(arguments[0])?arguments[0]:arguments);return new e(function(e,i){function r(o,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){r(o,t)},i)}t[o]=s,0===--n&&e(t)}catch(h){i(h)}}if(0===t.length)return e([]);for(var n=t.length,o=0;or;r++)t[r].then(e,i)})},"undefined"!=typeof module&&module.exports?module.exports=e:h.Promise||(h.Promise=e)}(),"undefined"==typeof WeakMap&&!function(){var t=Object.defineProperty,e=Date.now()%1e9,i=function(){this.name="__st"+(1e9*Math.random()>>>0)+(e++ +"__")};i.prototype={set:function(e,i){var r=e[this.name];return r&&r[0]===e?r[1]=i:t(e,this.name,{value:[e,i],writable:!0}),this},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},"delete":function(t){var e=t[this.name];return e&&e[0]===t?(e[0]=e[1]=void 0,!0):!1},has:function(t){var e=t[this.name];return e?e[0]===t:!1}},window.WeakMap=i}(),window.CustomElements=window.CustomElements||{flags:{}},function(t){var e=t.flags,i=[],r=function(t){i.push(t)},n=function(){i.forEach(function(e){e(t)})};t.addModule=r,t.initializeModules=n,t.hasNative=Boolean(document.registerElement),t.useNative=!e.register&&t.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(t){function e(t,e){i(t,function(t){return e(t)?!0:void r(t,e)}),r(t,e)}function i(t,e,r){var n=t.firstElementChild;if(!n)for(n=t.firstChild;n&&n.nodeType!==Node.ELEMENT_NODE;)n=n.nextSibling;for(;n;)e(n,r)!==!0&&i(n,e,r),n=n.nextElementSibling;return null}function r(t,i){for(var r=t.shadowRoot;r;)e(r,i),r=r.olderShadowRoot}function n(t,e){s=[],o(t,e),s=null}function o(t,e){if(t=wrap(t),!(s.indexOf(t)>=0)){s.push(t);for(var i,r=t.querySelectorAll("link[rel="+a+"]"),n=0,h=r.length;h>n&&(i=r[n]);n++)i["import"]&&o(i["import"],e);e(t)}}var s,a=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";t.forDocumentTree=n,t.forSubtree=e}),CustomElements.addModule(function(t){function e(t){return i(t)||r(t)}function i(e){return t.upgrade(e)?!0:void a(e)}function r(t){b(t,function(t){return i(t)?!0:void 0})}function n(t){a(t),d(t)&&b(t,function(t){a(t)})}function o(t){C.push(t),S||(S=!0,setTimeout(s))}function s(){S=!1;for(var t,e=C,i=0,r=e.length;r>i&&(t=e[i]);i++)t();C=[]}function a(t){T?o(function(){h(t)}):h(t)}function h(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&!t.__attached&&d(t)&&(t.__attached=!0,t.attachedCallback&&t.attachedCallback())}function l(t){u(t),b(t,function(t){u(t)})}function u(t){T?o(function(){c(t)}):c(t)}function c(t){t.__upgraded__&&(t.attachedCallback||t.detachedCallback)&&t.__attached&&!d(t)&&(t.__attached=!1,t.detachedCallback&&t.detachedCallback())}function d(t){for(var e=t,i=wrap(document);e;){if(e==i)return!0;e=e.parentNode||e.host}}function p(t){if(t.shadowRoot&&!t.shadowRoot.__watched){x.dom&&console.log("watching shadow-root for: ",t.localName);for(var e=t.shadowRoot;e;)m(e),e=e.olderShadowRoot}}function f(t){if(x.dom){var i=t[0];if(i&&"childList"===i.type&&i.addedNodes&&i.addedNodes){for(var r=i.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var n=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";n=n.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",t.length,n||"")}t.forEach(function(t){"childList"===t.type&&(E(t.addedNodes,function(t){t.localName&&e(t)}),E(t.removedNodes,function(t){t.localName&&l(t)}))}),x.dom&&console.groupEnd()}function g(t){for(t=wrap(t),t||(t=wrap(document));t.parentNode;)t=t.parentNode;var e=t.__observer;e&&(f(e.takeRecords()),s())}function m(t){if(!t.__observer){var e=new MutationObserver(f);e.observe(t,{childList:!0,subtree:!0}),t.__observer=e}}function v(t){t=wrap(t),x.dom&&console.group("upgradeDocument: ",t.baseURI.split("/").pop()),e(t),m(t),x.dom&&console.groupEnd()}function y(t){w(t,v)}var x=t.flags,b=t.forSubtree,w=t.forDocumentTree,T=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;t.hasPolyfillMutations=T;var S=!1,C=[],E=Array.prototype.forEach.call.bind(Array.prototype.forEach),A=Element.prototype.createShadowRoot;A&&(Element.prototype.createShadowRoot=function(){var t=A.call(this);return CustomElements.watchShadow(this),t}),t.watchShadow=p,t.upgradeDocumentTree=y,t.upgradeSubtree=r,t.upgradeAll=e,t.attachedNode=n,t.takeRecords=g}),CustomElements.addModule(function(t){function e(e){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var r=e.getAttribute("is"),n=t.getRegisteredDefinition(r||e.localName);if(n){if(r&&n.tag==e.localName)return i(e,n);if(!r&&!n["extends"])return i(e,n)}}}function i(e,i){return s.upgrade&&console.group("upgrade:",e.localName),i.is&&e.setAttribute("is",i.is),r(e,i),e.__upgraded__=!0,o(e),t.attachedNode(e),t.upgradeSubtree(e),s.upgrade&&console.groupEnd(),e}function r(t,e){Object.__proto__?t.__proto__=e.prototype:(n(t,e.prototype,e["native"]),t.__proto__=e.prototype)}function n(t,e,i){for(var r={},n=e;n!==i&&n!==HTMLElement.prototype;){for(var o,s=Object.getOwnPropertyNames(n),a=0;o=s[a];a++)r[o]||(Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o)),r[o]=1);n=Object.getPrototypeOf(n)}}function o(t){t.createdCallback&&t.createdCallback()}var s=t.flags;t.upgrade=e,t.upgradeWithDefinition=i,t.implementPrototype=r}),CustomElements.addModule(function(t){function e(e,r){var h=r||{};if(!e)throw new Error("document.registerElement: first argument `name` must not be empty");if(e.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(e)+"'.");if(n(e))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(e)+"'. The type name is invalid.");if(l(e))throw new Error("DuplicateDefinitionError: a type with name '"+String(e)+"' is already registered");return h.prototype||(h.prototype=Object.create(HTMLElement.prototype)),h.__name=e.toLowerCase(),h.lifecycle=h.lifecycle||{},h.ancestry=o(h["extends"]),s(h),a(h),i(h.prototype),u(h.__name,h),h.ctor=c(h),h.ctor.prototype=h.prototype,h.prototype.constructor=h.ctor,t.ready&&m(document),h.ctor}function i(t){if(!t.setAttribute._polyfilled){var e=t.setAttribute;t.setAttribute=function(t,i){r.call(this,t,i,e)};var i=t.removeAttribute;t.removeAttribute=function(t){r.call(this,t,null,i)},t.setAttribute._polyfilled=!0}}function r(t,e,i){t=t.toLowerCase();var r=this.getAttribute(t);i.apply(this,arguments);var n=this.getAttribute(t);this.attributeChangedCallback&&n!==r&&this.attributeChangedCallback(t,r,n)}function n(t){for(var e=0;e=0&&x(r,HTMLElement),r)}function f(t){var e=A.call(this,t);return v(e),e}var g,m=t.upgradeDocumentTree,v=t.upgrade,y=t.upgradeWithDefinition,x=t.implementPrototype,b=t.useNative,w=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],T={},S="http://www.w3.org/1999/xhtml",C=document.createElement.bind(document),E=document.createElementNS.bind(document),A=Node.prototype.cloneNode;g=Object.__proto__||b?function(t,e){return t instanceof e}:function(t,e){for(var i=t;i;){if(i===e.prototype)return!0;i=i.__proto__}return!1},document.registerElement=e,document.createElement=p,document.createElementNS=d,Node.prototype.cloneNode=f,t.registry=T,t["instanceof"]=g,t.reservedTagList=w,t.getRegisteredDefinition=l,document.register=document.registerElement}),function(t){function e(){s(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(t){s(wrap(t["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var i=t.useNative,r=t.initializeModules,n=/Trident/.test(navigator.userAgent);if(i){var o=function(){};t.watchShadow=o,t.upgrade=o,t.upgradeAll=o,t.upgradeDocumentTree=o,t.upgradeSubtree=o,t.takeRecords=o,t["instanceof"]=function(t,e){return t instanceof e}}else r();var s=t.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(t){return t}),n&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(t,e){e=e||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),i},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||t.flags.eager)e();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(a,e)}else e()}(window.CustomElements),function(){var t=this,e=e||{};e.WEBGL_RENDERER=0,e.CANVAS_RENDERER=1,e.VERSION="v2.2.8",e.blendModes={NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},e.scaleModes={DEFAULT:0,LINEAR:0,NEAREST:1},e._UID=0,"undefined"!=typeof Float32Array?(e.Float32Array=Float32Array,e.Uint16Array=Uint16Array,e.Uint32Array=Uint32Array,e.ArrayBuffer=ArrayBuffer):(e.Float32Array=Array,e.Uint16Array=Array),e.INTERACTION_FREQUENCY=30,e.AUTO_PREVENT_DEFAULT=!0,e.PI_2=2*Math.PI,e.RAD_TO_DEG=180/Math.PI,e.DEG_TO_RAD=Math.PI/180,e.RETINA_PREFIX="@2x",e.dontSayHello=!1,e.defaultRenderOptions={view:null,transparent:!1,antialias:!1,preserveDrawingBuffer:!1,resolution:1,clearBeforeRender:!0,autoResize:!1},e.sayHello=function(t){if(!e.dontSayHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var i=["%c %c %c Pixi.js "+e.VERSION+" - "+t+" %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ ","background: #ff66a5","background: #ff66a5","color: #ff66a5; background: #030307;","background: #ff66a5","background: #ffc3dc","background: #ff66a5","color: #ff2424; background: #fff","color: #ff2424; background: #fff","color: #ff2424; background: #fff"];console.log.apply(console,i)}else window.console&&console.log("Pixi.js "+e.VERSION+" - http://www.pixijs.com/");e.dontSayHello=!0}},e.Point=function(t,e){this.x=t||0,this.y=e||0},e.Point.prototype.clone=function(){return new e.Point(this.x,this.y)},e.Point.prototype.set=function(t,e){this.x=t||0,this.y=e||(0!==e?this.x:0)},e.Point.prototype.constructor=e.Point,e.Rectangle=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Rectangle.prototype.clone=function(){return new e.Rectangle(this.x,this.y,this.width,this.height)},e.Rectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.Rectangle.prototype.constructor=e.Rectangle,e.EmptyRectangle=new e.Rectangle(0,0,0,0),e.Polygon=function(t){if(t instanceof Array||(t=Array.prototype.slice.call(arguments)),t[0]instanceof e.Point){for(var i=[],r=0,n=t.length;n>r;r++)i.push(t[r].x,t[r].y);t=i}this.closed=!0,this.points=t},e.Polygon.prototype.clone=function(){var t=this.points.slice();return new e.Polygon(t)},e.Polygon.prototype.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,o=r-1;r>n;o=n++){var s=this.points[2*n],a=this.points[2*n+1],h=this.points[2*o],l=this.points[2*o+1],u=a>e!=l>e&&(h-s)*(e-a)/(l-a)+s>t;u&&(i=!i)}return i},e.Polygon.prototype.constructor=e.Polygon,e.Circle=function(t,e,i){this.x=t||0,this.y=e||0,this.radius=i||0},e.Circle.prototype.clone=function(){return new e.Circle(this.x,this.y,this.radius)},e.Circle.prototype.contains=function(t,e){if(this.radius<=0)return!1;var i=this.x-t,r=this.y-e,n=this.radius*this.radius;return i*=i,r*=r,n>=i+r},e.Circle.prototype.getBounds=function(){return new e.Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},e.Circle.prototype.constructor=e.Circle,e.Ellipse=function(t,e,i,r){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0},e.Ellipse.prototype.clone=function(){return new e.Ellipse(this.x,this.y,this.width,this.height)},e.Ellipse.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=(t-this.x)/this.width,r=(e-this.y)/this.height;return i*=i,r*=r,1>=i+r},e.Ellipse.prototype.getBounds=function(){return new e.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},e.Ellipse.prototype.constructor=e.Ellipse,e.RoundedRectangle=function(t,e,i,r,n){this.x=t||0,this.y=e||0,this.width=i||0,this.height=r||0,this.radius=n||20},e.RoundedRectangle.prototype.clone=function(){return new e.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},e.RoundedRectangle.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var r=this.y;if(e>=r&&e<=r+this.height)return!0}return!1},e.RoundedRectangle.prototype.constructor=e.RoundedRectangle,e.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},e.Matrix.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},e.Matrix.prototype.toArray=function(t){this.array||(this.array=new e.Float32Array(9));var i=this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i},e.Matrix.prototype.apply=function(t,i){return i=i||new e.Point,i.x=this.a*t.x+this.c*t.y+this.tx,i.y=this.b*t.x+this.d*t.y+this.ty,i},e.Matrix.prototype.applyInverse=function(t,i){i=i||new e.Point;var r=1/(this.a*this.d+this.c*-this.b);return i.x=this.d*r*t.x+-this.c*r*t.y+(this.ty*this.c-this.tx*this.d)*r,i.y=this.a*r*t.y+-this.b*r*t.x+(-this.ty*this.a+this.tx*this.b)*r,i},e.Matrix.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},e.Matrix.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},e.Matrix.prototype.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this},e.Matrix.prototype.append=function(t){var e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},e.Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},e.identityMatrix=new e.Matrix,e.DisplayObject=function(){this.position=new e.Point,this.scale=new e.Point(1,1),this.pivot=new e.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new e.Matrix,this._sr=0,this._cr=1,this.filterArea=null,this._bounds=new e.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},e.DisplayObject.prototype.constructor=e.DisplayObject,Object.defineProperty(e.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(t){this._interactive=t,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}}),Object.defineProperty(e.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(e.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(t){if(t){for(var e=[],i=0;i=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),this.stage&&t.setStageReference(this.stage),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},e.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),r=this.getChildIndex(e);if(0>i||0>r)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[r]=t}},e.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},e.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(0>e||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},e.DisplayObjectContainer.prototype.getChildAt=function(t){if(0>t||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},e.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);return-1!==e?this.removeChildAt(e):void 0},e.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return this.stage&&e.removeStageReference(),e.parent=void 0,this.children.splice(t,1),e},e.DisplayObjectContainer.prototype.removeChildren=function(t,e){var i=t||0,r="number"==typeof e?e:this.children.length,n=r-i;if(n>0&&r>=n){for(var o=this.children.splice(i,n),s=0;st;t++)this.children[t].updateTransform()},e.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=e.DisplayObjectContainer.prototype.updateTransform,e.DisplayObjectContainer.prototype.getBounds=function(){if(0===this.children.length)return e.EmptyRectangle;for(var t,i,r,n=1/0,o=1/0,s=-(1/0),a=-(1/0),h=!1,l=0,u=this.children.length;u>l;l++){var c=this.children[l];c.visible&&(h=!0,t=this.children[l].getBounds(),n=ni?s:i,a=a>r?a:r)}if(!h)return e.EmptyRectangle;var d=this._bounds;return d.x=n,d.y=o,d.width=s-n,d.height=a-o,d},e.DisplayObjectContainer.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=e.identityMatrix;for(var i=0,r=this.children.length;r>i;i++)this.children[i].updateTransform();var n=this.getBounds();return this.worldTransform=t,n},e.DisplayObjectContainer.prototype.setStageReference=function(t){this.stage=t,this._interactive&&(this.stage.dirty=!0);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r.setStageReference(t)}},e.DisplayObjectContainer.prototype.removeStageReference=function(){for(var t=0,e=this.children.length;e>t;t++){var i=this.children[t];i.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},e.DisplayObjectContainer.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);var e,i;if(this._mask||this._filters){for(this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),t.spriteBatch.start()}else for(e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.DisplayObjectContainer.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(t);this._mask&&t.maskManager.pushMask(this._mask,t);for(var e=0,i=this.children.length;i>e;e++){var r=this.children[e];r._renderCanvas(t)}this._mask&&t.maskManager.popMask(t)}},e.Sprite=function(t){e.DisplayObjectContainer.call(this),this.anchor=new e.Point,this.texture=t||e.Texture.emptyTexture,this._width=0,this._height=0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.shader=null,this.texture.baseTexture.hasLoaded?this.onTextureUpdate():this.texture.on("update",this.onTextureUpdate.bind(this)),this.renderable=!0},e.Sprite.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Sprite.prototype.constructor=e.Sprite,Object.defineProperty(e.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(t){this.scale.x=t/this.texture.frame.width,this._width=t}}),Object.defineProperty(e.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(t){this.scale.y=t/this.texture.frame.height,this._height=t}}),e.Sprite.prototype.setTexture=function(t){this.texture=t,this.cachedTint=16777215},e.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height)},e.Sprite.prototype.getBounds=function(t){var e=this.texture.frame.width,i=this.texture.frame.height,r=e*(1-this.anchor.x),n=e*-this.anchor.x,o=i*(1-this.anchor.y),s=i*-this.anchor.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=-(1/0),g=-(1/0),m=1/0,v=1/0;if(0===l&&0===u)0>h&&(h*=-1),0>c&&(c*=-1),m=h*n+d,f=h*r+d,v=c*s+p,g=c*o+p;else{var y=h*n+u*s+d,x=c*s+l*n+p,b=h*r+u*s+d,w=c*s+l*r+p,T=h*r+u*o+d,S=c*o+l*r+p,C=h*n+u*o+d,E=c*o+l*n+p;m=m>y?y:m,m=m>b?b:m,m=m>T?T:m,m=m>C?C:m,v=v>x?x:v,v=v>w?w:v,v=v>S?S:v,v=v>E?E:v,f=y>f?y:f,f=b>f?b:f,f=T>f?T:f,f=C>f?C:f,g=x>g?x:g,g=w>g?w:g,g=S>g?S:g,g=E>g?E:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=v,A.height=g-v,this._currentBounds=A,A},e.Sprite.prototype._renderWebGL=function(t){if(this.visible&&!(this.alpha<=0)){var e,i;if(this._mask||this._filters){var r=t.spriteBatch;for(this._filters&&(r.flush(),t.filterManager.pushFilter(this._filterBlock)),this._mask&&(r.stop(),t.maskManager.pushMask(this.mask,t),r.start()),r.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);r.stop(),this._mask&&t.maskManager.popMask(this._mask,t),this._filters&&t.filterManager.popFilter(),r.start()}else for(t.spriteBatch.render(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t)}},e.Sprite.prototype._renderCanvas=function(t){if(!(this.visible===!1||0===this.alpha||this.texture.crop.width<=0||this.texture.crop.height<=0)){if(this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,t.context.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t),this.texture.valid){var i=this.texture.baseTexture.resolution/t.resolution;t.context.globalAlpha=this.worldAlpha,t.smoothProperty&&t.scaleMode!==this.texture.baseTexture.scaleMode&&(t.scaleMode=this.texture.baseTexture.scaleMode,t.context[t.smoothProperty]=t.scaleMode===e.scaleModes.LINEAR);var r=this.texture.trim?this.texture.trim.x-this.anchor.x*this.texture.trim.width:this.anchor.x*-this.texture.frame.width,n=this.texture.trim?this.texture.trim.y-this.anchor.y*this.texture.trim.height:this.anchor.y*-this.texture.frame.height;t.roundPixels?(t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution|0,this.worldTransform.ty*t.resolution|0),r=0|r,n=0|n):t.context.setTransform(this.worldTransform.a,this.worldTransform.b,this.worldTransform.c,this.worldTransform.d,this.worldTransform.tx*t.resolution,this.worldTransform.ty*t.resolution),16777215!==this.tint?(this.cachedTint!==this.tint&&(this.cachedTint=this.tint,this.tintedTexture=e.CanvasTinter.getTintedTexture(this,this.tint)),t.context.drawImage(this.tintedTexture,0,0,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)):t.context.drawImage(this.texture.baseTexture.source,this.texture.crop.x,this.texture.crop.y,this.texture.crop.width,this.texture.crop.height,r/i,n/i,this.texture.crop.width/i,this.texture.crop.height/i)}for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Sprite.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache'+this); +return new e.Sprite(i)},e.Sprite.fromImage=function(t,i,r){var n=e.Texture.fromImage(t,i,r);return new e.Sprite(n)},e.SpriteBatch=function(t){e.DisplayObjectContainer.call(this),this.textureThing=t,this.ready=!1},e.SpriteBatch.prototype=Object.create(e.DisplayObjectContainer.prototype),e.SpriteBatch.prototype.constructor=e.SpriteBatch,e.SpriteBatch.prototype.initWebGL=function(t){this.fastSpriteBatch=new e.WebGLFastSpriteBatch(t),this.ready=!0},e.SpriteBatch.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},e.SpriteBatch.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(t.gl),this.fastSpriteBatch.gl!==t.gl&&this.fastSpriteBatch.setContext(t.gl),t.spriteBatch.stop(),t.shaderManager.setShader(t.shaderManager.fastShader),this.fastSpriteBatch.begin(this,t),this.fastSpriteBatch.render(this),t.spriteBatch.start())},e.SpriteBatch.prototype._renderCanvas=function(t){if(this.visible&&!(this.alpha<=0)&&this.children.length){var e=t.context;e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var i=this.worldTransform,r=!0,n=0;n=this.textures.length&&(this.gotoAndStop(this.textures.length-1),this.onComplete&&this.onComplete())}},e.MovieClip.fromFrames=function(t){for(var i=[],r=0;rh;h++){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p+=d}for(i.ascent=s-h,p=c-d,f=!1,h=a;h>s;h--){for(l=0;d>l;l+=4)if(255!==u[p+l]){f=!0;break}if(f)break;p-=d}i.descent=h-s,i.descent+=6,i.fontSize=i.ascent+i.descent,e.Text.fontPropertiesCache[t]=i}return i},e.Text.prototype.wordWrap=function(t){for(var e="",i=t.split("\n"),r=0;rn?(s>0&&(e+="\n"),e+=o[s],n=this.style.wordWrapWidth-a):(n-=h,e+=" "+o[s])}r=2?parseInt(i[i.length-2],10):e.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=t.tint},e.BitmapText.prototype.updateText=function(){for(var t=e.BitmapText.fonts[this.fontName],i=new e.Point,r=null,n=[],o=0,s=[],a=0,h=this.fontSize/t.size,l=0;l=l;l++){var p=0;"right"===this.style.align?p=o-s[l]:"center"===this.style.align&&(p=(o-s[l])/2),d.push(p)}var f=this.children.length,g=n.length,m=this.tint||16777215;for(l=0;g>l;l++){var v=f>l?this.children[l]:this._pool.pop();v?v.setTexture(n[l].texture):v=new e.Sprite(n[l].texture),v.position.x=(n[l].position.x+d[n[l].line])*h,v.position.y=n[l].position.y*h,v.scale.x=v.scale.y=h,v.tint=m,v.parent||this.addChild(v)}for(;this.children.length>g;){var y=this.getChildAt(this.children.length-1);this._pool.push(y),this.removeChild(y)}this.textWidth=o*h,this.textHeight=(i.y+t.lineHeight)*h},e.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.BitmapText.fonts={},e.InteractionData=function(){this.global=new e.Point,this.target=null,this.originalEvent=null},e.InteractionData.prototype.getLocalPosition=function(t,i,r){var n=t.worldTransform,o=r?r:this.global,s=n.a,a=n.c,h=n.tx,l=n.b,u=n.d,c=n.ty,d=1/(s*u+a*-l);return i=i||new e.Point,i.x=u*d*o.x+-a*d*o.y+(c*a-h*u)*d,i.y=s*d*o.y+-l*d*o.x+(-c*s+h*l)*d,i},e.InteractionData.prototype.constructor=e.InteractionData,e.InteractionManager=function(t){this.stage=t,this.mouse=new e.InteractionData,this.touches={},this.tempPoint=new e.Point,this.mouseoverEnabled=!0,this.pool=[],this.interactiveItems=[],this.interactionDOMElement=null,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchCancel=this.onTouchCancel.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.last=0,this.currentCursorStyle="inherit",this.mouseOut=!1,this.resolution=1,this._tempPoint=new e.Point},e.InteractionManager.prototype.constructor=e.InteractionManager,e.InteractionManager.prototype.collectInteractiveSprite=function(t,e){for(var i=t.children,r=i.length,n=r-1;n>=0;n--){var o=i[n];o._interactive?(e.interactiveChildren=!0,this.interactiveItems.push(o),o.children.length>0&&this.collectInteractiveSprite(o,o)):(o.__iParent=null,o.children.length>0&&this.collectInteractiveSprite(o,e))}},e.InteractionManager.prototype.setTarget=function(t){this.target=t,this.resolution=t.resolution,null===this.interactionDOMElement&&this.setTargetDomElement(t.view)},e.InteractionManager.prototype.setTargetDomElement=function(t){this.removeEvents(),window.navigator.msPointerEnabled&&(t.style["-ms-content-zooming"]="none",t.style["-ms-touch-action"]="none"),this.interactionDOMElement=t,t.addEventListener("mousemove",this.onMouseMove,!0),t.addEventListener("mousedown",this.onMouseDown,!0),t.addEventListener("mouseout",this.onMouseOut,!0),t.addEventListener("touchstart",this.onTouchStart,!0),t.addEventListener("touchend",this.onTouchEnd,!0),t.addEventListener("touchleave",this.onTouchCancel,!0),t.addEventListener("touchcancel",this.onTouchCancel,!0),t.addEventListener("touchmove",this.onTouchMove,!0),window.addEventListener("mouseup",this.onMouseUp,!0)},e.InteractionManager.prototype.removeEvents=function(){this.interactionDOMElement&&(this.interactionDOMElement.style["-ms-content-zooming"]="",this.interactionDOMElement.style["-ms-touch-action"]="",this.interactionDOMElement.removeEventListener("mousemove",this.onMouseMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onMouseDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onMouseOut,!0),this.interactionDOMElement.removeEventListener("touchstart",this.onTouchStart,!0),this.interactionDOMElement.removeEventListener("touchend",this.onTouchEnd,!0),this.interactionDOMElement.removeEventListener("touchleave",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onTouchCancel,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onTouchMove,!0),this.interactionDOMElement=null,window.removeEventListener("mouseup",this.onMouseUp,!0))},e.InteractionManager.prototype.update=function(){if(this.target){var t=Date.now(),i=t-this.last;if(i=i*e.INTERACTION_FREQUENCY/1e3,!(1>i)){this.last=t;var r=0;this.dirty&&this.rebuildInteractiveGraph();var n=this.interactiveItems.length,o="inherit",s=!1;for(r=0;n>r;r++){var a=this.interactiveItems[r];a.__hit=this.hitTest(a,this.mouse),this.mouse.target=a,a.__hit&&!s?(a.buttonMode&&(o=a.defaultCursor),a.interactiveChildren||(s=!0),a.__isOver||(a.mouseover&&a.mouseover(this.mouse),a.__isOver=!0)):a.__isOver&&(a.mouseout&&a.mouseout(this.mouse),a.__isOver=!1)}this.currentCursorStyle!==o&&(this.currentCursorStyle=o,this.interactionDOMElement.style.cursor=o)}}},e.InteractionManager.prototype.rebuildInteractiveGraph=function(){this.dirty=!1;for(var t=this.interactiveItems.length,e=0;t>e;e++)this.interactiveItems[e].interactiveChildren=!1;this.interactiveItems=[],this.stage.interactive&&this.interactiveItems.push(this.stage),this.collectInteractiveSprite(this.stage,this.stage)},e.InteractionManager.prototype.onMouseMove=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactionDOMElement.getBoundingClientRect();this.mouse.global.x=(t.clientX-e.left)*(this.target.width/e.width)/this.resolution,this.mouse.global.y=(t.clientY-e.top)*(this.target.height/e.height)/this.resolution;for(var i=this.interactiveItems.length,r=0;i>r;r++){var n=this.interactiveItems[r];n.mousemove&&n.mousemove(this.mouse)}},e.InteractionManager.prototype.onMouseDown=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t,e.AUTO_PREVENT_DEFAULT&&this.mouse.originalEvent.preventDefault();for(var i=this.interactiveItems.length,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightdown":"mousedown",s=n?"rightclick":"click",a=n?"__rightIsDown":"__mouseIsDown",h=n?"__isRightDown":"__isDown",l=0;i>l;l++){var u=this.interactiveItems[l];if((u[o]||u[s])&&(u[a]=!0,u.__hit=this.hitTest(u,this.mouse),u.__hit&&(u[o]&&u[o](this.mouse),u[h]=!0,!u.interactiveChildren)))break}},e.InteractionManager.prototype.onMouseOut=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;var e=this.interactiveItems.length;this.interactionDOMElement.style.cursor="inherit";for(var i=0;e>i;i++){var r=this.interactiveItems[i];r.__isOver&&(this.mouse.target=r,r.mouseout&&r.mouseout(this.mouse),r.__isOver=!1)}this.mouseOut=!0,this.mouse.global.x=-1e4,this.mouse.global.y=-1e4},e.InteractionManager.prototype.onMouseUp=function(t){this.dirty&&this.rebuildInteractiveGraph(),this.mouse.originalEvent=t;for(var e=this.interactiveItems.length,i=!1,r=this.mouse.originalEvent,n=2===r.button||3===r.which,o=n?"rightup":"mouseup",s=n?"rightclick":"click",a=n?"rightupoutside":"mouseupoutside",h=n?"__isRightDown":"__isDown",l=0;e>l;l++){var u=this.interactiveItems[l];(u[s]||u[o]||u[a])&&(u.__hit=this.hitTest(u,this.mouse),u.__hit&&!i?(u[o]&&u[o](this.mouse),u[h]&&u[s]&&u[s](this.mouse),u.interactiveChildren||(i=!0)):u[h]&&u[a]&&u[a](this.mouse),u[h]=!1)}},e.InteractionManager.prototype.hitTest=function(t,i){var r=i.global;if(!t.worldVisible)return!1;t.worldTransform.applyInverse(r,this._tempPoint);var n,o=this._tempPoint.x,s=this._tempPoint.y;if(i.target=t,t.hitArea&&t.hitArea.contains)return t.hitArea.contains(o,s);if(t instanceof e.Sprite){var a,h=t.texture.frame.width,l=t.texture.frame.height,u=-h*t.anchor.x;if(o>u&&u+h>o&&(a=-l*t.anchor.y,s>a&&a+l>s))return!0}else if(t instanceof e.Graphics){var c=t.graphicsData;for(n=0;nn;n++){var f=t.children[n],g=this.hitTest(f,i);if(g)return i.target=t,!0}return!1},e.InteractionManager.prototype.onTouchMove=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e,i,r=this.interactionDOMElement.getBoundingClientRect(),n=t.changedTouches,o=n.length,s=this.target.width/r.width,a=this.target.height/r.height,h=navigator.isCocoonJS&&!r.left&&!r.top&&!t.target.style.width&&!t.target.style.height,l=0;o>l;l++)i=n[l],h?(i.globalX=i.clientX,i.globalY=i.clientY):(i.globalX=(i.clientX-r.left)*s/this.resolution,i.globalY=(i.clientY-r.top)*a/this.resolution);for(var u=0;o>u;u++){i=n[u],e=this.touches[i.identifier],e.originalEvent=t,h?(e.global.x=i.clientX,e.global.y=i.clientY):(i.globalX=e.global.x=(i.clientX-r.left)*s/this.resolution,i.globalY=e.global.y=(i.clientY-r.top)*a/this.resolution);for(var c=0;cl;l++)r=n[l],h?(r.globalX=r.clientX,r.globalY=r.clientY):(r.globalX=(r.clientX-i.left)*s/this.resolution,r.globalY=(r.clientY-i.top)*a/this.resolution);for(var u=0;o>u;u++){r=n[u];var c=this.pool.pop();c||(c=new e.InteractionData),c.originalEvent=t,this.touches[r.identifier]=c,h?(c.global.x=r.clientX,c.global.y=r.clientY):(c.global.x=(r.clientX-i.left)*s/this.resolution,c.global.y=(r.clientY-i.top)*a/this.resolution);for(var d=this.interactiveItems.length,p=0;d>p;p++){var f=this.interactiveItems[p];if((f.touchstart||f.tap)&&(f.__hit=this.hitTest(f,c),f.__hit&&(f.touchstart&&f.touchstart(c),f.__isDown=!0,f.__touchData=f.__touchData||{},f.__touchData[r.identifier]=c,!f.interactiveChildren)))break}}},e.InteractionManager.prototype.onTouchEnd=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e,i=this.interactionDOMElement.getBoundingClientRect(),r=t.changedTouches,n=r.length,o=this.target.width/i.width,s=this.target.height/i.height,a=navigator.isCocoonJS&&!i.left&&!i.top&&!t.target.style.width&&!t.target.style.height,h=0;n>h;h++)e=r[h],a?(e.globalX=e.clientX,e.globalY=e.clientY):(e.globalX=(e.clientX-i.left)*o/this.resolution,e.globalY=(e.clientY-i.top)*s/this.resolution);for(var l=0;n>l;l++){e=r[l];var u=this.touches[e.identifier],c=!1;a?(u.global.x=e.clientX,u.global.y=e.clientY):(u.global.x=(e.clientX-i.left)*o/this.resolution,u.global.y=(e.clientY-i.top)*s/this.resolution);for(var d=this.interactiveItems.length,p=0;d>p;p++){var f=this.interactiveItems[p];f.__touchData&&f.__touchData[e.identifier]&&(f.__hit=this.hitTest(f,f.__touchData[e.identifier]),u.originalEvent=t,(f.touchend||f.tap)&&(f.__hit&&!c?(f.touchend&&f.touchend(u),f.__isDown&&f.tap&&f.tap(u),f.interactiveChildren||(c=!0)):f.__isDown&&f.touchendoutside&&f.touchendoutside(u),f.__isDown=!1),f.__touchData[e.identifier]=null)}this.pool.push(u),this.touches[e.identifier]=null}},e.InteractionManager.prototype.onTouchCancel=function(t){this.dirty&&this.rebuildInteractiveGraph();for(var e,i=this.interactionDOMElement.getBoundingClientRect(),r=t.changedTouches,n=r.length,o=this.target.width/i.width,s=this.target.height/i.height,a=navigator.isCocoonJS&&!i.left&&!i.top&&!t.target.style.width&&!t.target.style.height,h=0;n>h;h++)e=r[h],a?(e.globalX=e.clientX,e.globalY=e.clientY):(e.globalX=(e.clientX-i.left)*o/this.resolution,e.globalY=(e.clientY-i.top)*s/this.resolution);for(var l=0;n>l;l++){e=r[l];var u=this.touches[e.identifier],c=!1;a?(u.global.x=e.clientX,u.global.y=e.clientY):(u.global.x=(e.clientX-i.left)*o/this.resolution,u.global.y=(e.clientY-i.top)*s/this.resolution);for(var d=this.interactiveItems.length,p=0;d>p;p++){var f=this.interactiveItems[p];f.__touchData&&f.__touchData[e.identifier]&&(f.__hit=this.hitTest(f,f.__touchData[e.identifier]),u.originalEvent=t,f.touchcancel&&!c&&(f.touchcancel(u),f.interactiveChildren||(c=!0)),f.__isDown=!1,f.__touchData[e.identifier]=null)}this.pool.push(u),this.touches[e.identifier]=null}},e.Stage=function(t){e.DisplayObjectContainer.call(this),this.worldTransform=new e.Matrix,this.interactive=!0,this.interactionManager=new e.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new e.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(t)},e.Stage.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Stage.prototype.constructor=e.Stage,e.Stage.prototype.setInteractionDelegate=function(t){this.interactionManager.setTargetDomElement(t)},e.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var t=0,e=this.children.length;e>t;t++)this.children[t].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},e.Stage.prototype.setBackgroundColor=function(t){this.backgroundColor=t||0,this.backgroundColorSplit=e.hex2rgb(this.backgroundColor);var i=this.backgroundColor.toString(16);i="000000".substr(0,6-i.length)+i,this.backgroundColorString="#"+i},e.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},function(t){for(var e=0,i=["ms","moz","webkit","o"],r=0;r>16&255)/255,(t>>8&255)/255,(255&t)/255]},e.rgb2hex=function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){return function(t){function e(){for(var r=arguments.length,o=new Array(r);r--;)o[r]=arguments[r];return o=n.concat(o),i.apply(this instanceof e?this:t,o)}var i=this,r=arguments.length-1,n=[];if(r>0)for(n.length=r;r--;)n[r]=arguments[r+1];if("function"!=typeof i)throw new TypeError;return e.prototype=function o(t){return t&&(o.prototype=t),this instanceof o?void 0:new o}(i.prototype),e}}()),e.AjaxRequest=function(){var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var e=0;e0&&0===(t&t-1))return t;for(var e=1;t>e;)e<<=1;return e},e.isPowerOfTwo=function(t,e){return t>0&&0===(t&t-1)&&e>0&&0===(e&e-1)},e.EventTarget={call:function(t){t&&(t=t.prototype||t,e.EventTarget.mixin(t))},mixin:function(t){t.listeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?this._listeners[t].slice():[]},t.emit=t.dispatchEvent=function(t,i){if(this._listeners=this._listeners||{},"object"==typeof t&&(i=t,t=t.type),i&&i.__isEventObject===!0||(i=new e.Event(this,t,i)),this._listeners&&this._listeners[t]){var r,n=this._listeners[t].slice(0),o=n.length,s=n[0];for(r=0;o>r;s=n[++r])if(s.call(this,i),i.stoppedImmediate)return this;if(i.stopped)return this}return this.parent&&this.parent.emit&&this.parent.emit.call(this.parent,t,i),this},t.on=t.addEventListener=function(t,e){return this._listeners=this._listeners||{},(this._listeners[t]=this._listeners[t]||[]).push(e),this},t.once=function(t,e){function i(){e.apply(r.off(t,i),arguments)}this._listeners=this._listeners||{};var r=this;return i._originalHandler=e,this.on(t,i)},t.off=t.removeEventListener=function(t,e){if(this._listeners=this._listeners||{},!this._listeners[t])return this;for(var i=this._listeners[t],r=e?i.length:0;r-->0;)(i[r]===e||i[r]._originalHandler===e)&&i.splice(r,1);return 0===i.length&&delete this._listeners[t],this},t.removeAllListeners=function(t){return this._listeners=this._listeners||{},this._listeners[t]?(delete this._listeners[t],this):this}}},e.Event=function(t,e,i){this.__isEventObject=!0,this.stopped=!1,this.stoppedImmediate=!1,this.target=t,this.type=e,this.data=i,this.content=i,this.timeStamp=Date.now()},e.Event.prototype.stopPropagation=function(){this.stopped=!0},e.Event.prototype.stopImmediatePropagation=function(){this.stoppedImmediate=!0},e.autoDetectRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}();return n?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.autoDetectRecommendedRenderer=function(t,i,r){t||(t=800),i||(i=600);var n=function(){try{var t=document.createElement("canvas");return!!window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(e){return!1}}(),o=/Android/i.test(navigator.userAgent);return n&&!o?new e.WebGLRenderer(t,i,r):new e.CanvasRenderer(t,i,r)},e.PolyK={},e.PolyK.Triangulate=function(t){var i=!0,r=t.length>>1;if(3>r)return[];for(var n=[],o=[],s=0;r>s;s++)o.push(s);s=0;for(var a=r;a>3;){var h=o[(s+0)%a],l=o[(s+1)%a],u=o[(s+2)%a],c=t[2*h],d=t[2*h+1],p=t[2*l],f=t[2*l+1],g=t[2*u],m=t[2*u+1],v=!1;if(e.PolyK._convex(c,d,p,f,g,m,i)){v=!0;for(var y=0;a>y;y++){var x=o[y];if(x!==h&&x!==l&&x!==u&&e.PolyK._PointInTriangle(t[2*x],t[2*x+1],c,d,p,f,g,m)){v=!1;break}}}if(v)n.push(h,l,u),o.splice((s+1)%a,1),a--,s=0;else if(s++>3*a){if(!i)return null;for(n=[],o=[],s=0;r>s;s++)o.push(s);s=0,a=r,i=!1}}return n.push(o[0],o[1],o[2]),n},e.PolyK._PointInTriangle=function(t,e,i,r,n,o,s,a){var h=s-i,l=a-r,u=n-i,c=o-r,d=t-i,p=e-r,f=h*h+l*l,g=h*u+l*c,m=h*d+l*p,v=u*u+c*c,y=u*d+c*p,x=1/(f*v-g*g),b=(v*m-g*y)*x,w=(f*y-g*m)*x;return b>=0&&w>=0&&1>b+w},e.PolyK._convex=function(t,e,i,r,n,o,s){return(e-r)*(n-i)+(i-t)*(o-r)>=0===s},e.initDefaultShaders=function(){},e.CompileVertexShader=function(t,i){return e._CompileShader(t,i,t.VERTEX_SHADER)},e.CompileFragmentShader=function(t,i){return e._CompileShader(t,i,t.FRAGMENT_SHADER)},e._CompileShader=function(t,e,i){var r=e.join("\n"),n=t.createShader(i);return t.shaderSource(n,r),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(window.console.log(t.getShaderInfoLog(n)),null)},e.compileProgram=function(t,i,r){var n=e.CompileFragmentShader(t,r),o=e.CompileVertexShader(t,i),s=t.createProgram();return t.attachShader(s,o),t.attachShader(s,n),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||window.console.log("Could not initialise shaders"),s},e.PixiShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.firstRun=!0,this.dirty=!0,this.attributes=[],this.init()},e.PixiShader.prototype.constructor=e.PixiShader,e.PixiShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc||e.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var r in this.uniforms)this.uniforms[r].uniformLocation=t.getUniformLocation(i,r);this.initUniforms(),this.program=i},e.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var t,e=this.gl;for(var i in this.uniforms){t=this.uniforms[i];var r=t.type;"sampler2D"===r?(t._init=!1,null!==t.value&&this.initSampler2D(t)):"mat2"===r||"mat3"===r||"mat4"===r?(t.glMatrix=!0,t.glValueLength=1,"mat2"===r?t.glFunc=e.uniformMatrix2fv:"mat3"===r?t.glFunc=e.uniformMatrix3fv:"mat4"===r&&(t.glFunc=e.uniformMatrix4fv)):(t.glFunc=e["uniform"+r],t.glValueLength="2f"===r||"2i"===r?2:"3f"===r||"3i"===r?3:"4f"===r||"4i"===r?4:1)}},e.PixiShader.prototype.initSampler2D=function(t){if(t.value&&t.value.baseTexture&&t.value.baseTexture.hasLoaded){var e=this.gl;if(e.activeTexture(e["TEXTURE"+this.textureCount]),e.bindTexture(e.TEXTURE_2D,t.value.baseTexture._glTextures[e.id]),t.textureData){var i=t.textureData,r=i.magFilter?i.magFilter:e.LINEAR,n=i.minFilter?i.minFilter:e.LINEAR,o=i.wrapS?i.wrapS:e.CLAMP_TO_EDGE,s=i.wrapT?i.wrapT:e.CLAMP_TO_EDGE,a=i.luminance?e.LUMINANCE:e.RGBA;if(i.repeat&&(o=e.REPEAT,s=e.REPEAT),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!i.flipY),i.width){var h=i.width?i.width:512,l=i.height?i.height:2,u=i.border?i.border:0;e.texImage2D(e.TEXTURE_2D,0,a,h,l,u,a,e.UNSIGNED_BYTE,null)}else e.texImage2D(e.TEXTURE_2D,0,a,e.RGBA,e.UNSIGNED_BYTE,t.value.baseTexture.source);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,s)}e.uniform1i(t.uniformLocation,this.textureCount),t._init=!0,this.textureCount++}},e.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var t,i=this.gl;for(var r in this.uniforms)t=this.uniforms[r],1===t.glValueLength?t.glMatrix===!0?t.glFunc.call(i,t.uniformLocation,t.transpose,t.value):t.glFunc.call(i,t.uniformLocation,t.value):2===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y):3===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z):4===t.glValueLength?t.glFunc.call(i,t.uniformLocation,t.value.x,t.value.y,t.value.z,t.value.w):"sampler2D"===t.type&&(t._init?(i.activeTexture(i["TEXTURE"+this.textureCount]),t.value.baseTexture._dirty[i.id]?e.instances[i.id].updateTexture(t.value.baseTexture):i.bindTexture(i.TEXTURE_2D,t.value.baseTexture._glTextures[i.id]),i.uniform1i(t.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(t)) +},e.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec4 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);","}"],e.PixiFastShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init()},e.PixiFastShader.prototype.constructor=e.PixiFastShader,e.PixiFastShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.dimensions=t.getUniformLocation(i,"dimensions"),this.uMatrix=t.getUniformLocation(i,"uMatrix"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aPositionCoord=t.getAttribLocation(i,"aPositionCoord"),this.aScale=t.getAttribLocation(i,"aScale"),this.aRotation=t.getAttribLocation(i,"aRotation"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(i,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=i},e.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.StripShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;","}"],this.init()},e.StripShader.prototype.constructor=e.StripShader,e.StripShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.uSampler=t.getUniformLocation(i,"uSampler"),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(i,"aTextureCoord"),this.attributes=[this.aVertexPosition,this.aTextureCoord],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.StripShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.PrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform float flipY;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},e.PrimitiveShader.prototype.constructor=e.PrimitiveShader,e.PrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.colorAttribute=t.getAttribLocation(i,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},e.ComplexPrimitiveShader=function(t){this._UID=e._UID++,this.gl=t,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform vec3 tint;","uniform float alpha;","uniform vec3 color;","uniform float flipY;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);"," vColor = vec4(color * alpha * tint, alpha);","}"],this.init()},e.ComplexPrimitiveShader.prototype.constructor=e.ComplexPrimitiveShader,e.ComplexPrimitiveShader.prototype.init=function(){var t=this.gl,i=e.compileProgram(t,this.vertexSrc,this.fragmentSrc);t.useProgram(i),this.projectionVector=t.getUniformLocation(i,"projectionVector"),this.offsetVector=t.getUniformLocation(i,"offsetVector"),this.tintColor=t.getUniformLocation(i,"tint"),this.color=t.getUniformLocation(i,"color"),this.flipY=t.getUniformLocation(i,"flipY"),this.aVertexPosition=t.getAttribLocation(i,"aVertexPosition"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=t.getUniformLocation(i,"translationMatrix"),this.alpha=t.getUniformLocation(i,"alpha"),this.program=i},e.ComplexPrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},e.WebGLGraphics=function(){},e.WebGLGraphics.renderGraphics=function(t,i){var r,n=i.gl,o=i.projection,s=i.offset,a=i.shaderManager.primitiveShader;t.dirty&&e.WebGLGraphics.updateGraphics(t,n);for(var h=t._webGL[n.id],l=0;l=6)if(a.points.length<12){s=e.WebGLGraphics.switchMode(r,0);var h=e.WebGLGraphics.buildPoly(a,s);h||(s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s))}else s=e.WebGLGraphics.switchMode(r,1),e.WebGLGraphics.buildComplexPoly(a,s);a.lineWidth>0&&(s=e.WebGLGraphics.switchMode(r,0),e.WebGLGraphics.buildLine(a,s))}else s=e.WebGLGraphics.switchMode(r,0),a.type===e.Graphics.RECT?e.WebGLGraphics.buildRectangle(a,s):a.type===e.Graphics.CIRC||a.type===e.Graphics.ELIP?e.WebGLGraphics.buildCircle(a,s):a.type===e.Graphics.RREC&&e.WebGLGraphics.buildRoundedRectangle(a,s);r.lastIndex++}for(n=0;n=m;m++)g=m/p,a=s(t,i,g),h=s(e,r,g),l=s(i,n,g),u=s(r,o,g),c=s(a,l,g),d=s(h,u,g),f.push(c,d);return f},e.WebGLGraphics.buildCircle=function(t,i){var r,n,o=t.shape,s=o.x,a=o.y;t.type===e.Graphics.CIRC?(r=o.radius,n=o.radius):(r=o.width,n=o.height);var h=40,l=2*Math.PI/h,u=0;if(t.fill){var c=e.hex2rgb(t.fillColor),d=t.fillAlpha,p=c[0]*d,f=c[1]*d,g=c[2]*d,m=i.points,v=i.indices,y=m.length/6;for(v.push(y),u=0;h+1>u;u++)m.push(s,a,p,f,g,d),m.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n,p,f,g,d),v.push(y++,y++);v.push(y-1)}if(t.lineWidth){var x=t.points;for(t.points=[],u=0;h+1>u;u++)t.points.push(s+Math.sin(l*u)*r,a+Math.cos(l*u)*n);e.WebGLGraphics.buildLine(t,i),t.points=x}},e.WebGLGraphics.buildLine=function(t,i){var r=0,n=t.points;if(0!==n.length){if(t.lineWidth%2)for(r=0;rr;r++)c=n[2*(r-1)],d=n[2*(r-1)+1],p=n[2*r],f=n[2*r+1],g=n[2*(r+1)],m=n[2*(r+1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,x=-(f-m),b=p-g,P=Math.sqrt(x*x+b*b),x/=P,b/=P,x*=k,b*=k,S=-y+d-(-y+f),C=-v+p-(-v+c),E=(-v+c)*(-y+f)-(-v+p)*(-y+d),A=-b+m-(-b+f),_=-x+p-(-x+g),M=(-x+g)*(-b+f)-(-x+p)*(-b+m),L=S*_-A*C,Math.abs(L)<.1?(L+=10.1,F.push(p-v,f-y,U,j,V,N),F.push(p+v,f+y,U,j,V,N)):(l=(C*M-_*E)/L,u=(A*E-S*M)/L,R=(l-p)*(l-p)+(u-f)+(u-f),R>19600?(w=v-x,T=y-b,P=Math.sqrt(w*w+T*T),w/=P,T/=P,w*=k,T*=k,F.push(p-w,f-T),F.push(U,j,V,N),F.push(p+w,f+T),F.push(U,j,V,N),F.push(p-w,f-T),F.push(U,j,V,N),O++):(F.push(l,u),F.push(U,j,V,N),F.push(p-(l-p),f-(u-f)),F.push(U,j,V,N)));for(c=n[2*(I-2)],d=n[2*(I-2)+1],p=n[2*(I-1)],f=n[2*(I-1)+1],v=-(d-f),y=c-p,P=Math.sqrt(v*v+y*y),v/=P,y/=P,v*=k,y*=k,F.push(p-v,f-y),F.push(U,j,V,N),F.push(p+v,f+y),F.push(U,j,V,N),B.push(D),r=0;O>r;r++)B.push(D++);B.push(D-1)}},e.WebGLGraphics.buildComplexPoly=function(t,i){var r=t.points.slice();if(!(r.length<6)){var n=i.indices;i.points=r,i.alpha=t.fillAlpha,i.color=e.hex2rgb(t.fillColor);for(var o,s,a=1/0,h=-(1/0),l=1/0,u=-(1/0),c=0;co?o:a,h=o>h?o:h,l=l>s?s:l,u=s>u?s:u;r.push(a,l,h,l,h,u,a,u);var d=r.length/2;for(c=0;d>c;c++)n.push(c)}},e.WebGLGraphics.buildPoly=function(t,i){var r=t.points;if(!(r.length<6)){var n=i.points,o=i.indices,s=r.length/2,a=e.hex2rgb(t.fillColor),h=t.fillAlpha,l=a[0]*h,u=a[1]*h,c=a[2]*h,d=e.PolyK.Triangulate(r);if(!d)return!1;var p=n.length/6,f=0;for(f=0;ff;f++)n.push(r[2*f],r[2*f+1],l,u,c,h);return!0}},e.WebGLGraphics.graphicsDataPool=[],e.WebGLGraphicsData=function(t){this.gl=t,this.color=[0,0,0],this.points=[],this.indices=[],this.buffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.mode=1,this.alpha=1,this.dirty=!0},e.WebGLGraphicsData.prototype.reset=function(){this.points=[],this.indices=[]},e.WebGLGraphicsData.prototype.upload=function(){var t=this.gl;this.glPoints=new e.Float32Array(this.points),t.bindBuffer(t.ARRAY_BUFFER,this.buffer),t.bufferData(t.ARRAY_BUFFER,this.glPoints,t.STATIC_DRAW),this.glIndicies=new e.Uint16Array(this.indices),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.glIndicies,t.STATIC_DRAW),this.dirty=!1},e.glContexts=[],e.instances=[],e.WebGLRenderer=function(t,i,r){if(r)for(var n in e.defaultRenderOptions)"undefined"==typeof r[n]&&(r[n]=e.defaultRenderOptions[n]);else r=e.defaultRenderOptions;e.defaultRenderer||(e.sayHello("webGL"),e.defaultRenderer=this),this.type=e.WEBGL_RENDERER,this.resolution=r.resolution,this.transparent=r.transparent,this.autoResize=r.autoResize||!1,this.preserveDrawingBuffer=r.preserveDrawingBuffer,this.clearBeforeRender=r.clearBeforeRender,this.width=t||800,this.height=i||600,this.view=r.view||document.createElement("canvas"),this.contextLostBound=this.handleContextLost.bind(this),this.contextRestoredBound=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLostBound,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredBound,!1),this._contextOptions={alpha:this.transparent,antialias:r.antialias,premultipliedAlpha:this.transparent&&"notMultiplied"!==this.transparent,stencil:!0,preserveDrawingBuffer:r.preserveDrawingBuffer},this.projection=new e.Point,this.offset=new e.Point(0,0),this.shaderManager=new e.WebGLShaderManager,this.spriteBatch=new e.WebGLSpriteBatch,this.maskManager=new e.WebGLMaskManager,this.filterManager=new e.WebGLFilterManager,this.stencilManager=new e.WebGLStencilManager,this.blendModeManager=new e.WebGLBlendModeManager,this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.blendModeManager=this.blendModeManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.stencilManager=this.stencilManager,this.renderSession.renderer=this,this.renderSession.resolution=this.resolution,this.initContext(),this.mapBlendModes()},e.WebGLRenderer.prototype.constructor=e.WebGLRenderer,e.WebGLRenderer.prototype.initContext=function(){var t=this.view.getContext("webgl",this._contextOptions)||this.view.getContext("experimental-webgl",this._contextOptions);if(this.gl=t,!t)throw new Error("This browser does not support webGL. Try using the canvas renderer");this.glContextId=t.id=e.WebGLRenderer.glContextId++,e.glContexts[this.glContextId]=t,e.instances[this.glContextId]=this,t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),this.shaderManager.setContext(t),this.spriteBatch.setContext(t),this.maskManager.setContext(t),this.filterManager.setContext(t),this.blendModeManager.setContext(t),this.stencilManager.setContext(t),this.renderSession.gl=this.gl,this.resize(this.width,this.height)},e.WebGLRenderer.prototype.render=function(t){if(!this.contextLost){this.__stage!==t&&(t.interactive&&t.interactionManager.removeEvents(),this.__stage=t),t.updateTransform();var e=this.gl;t._interactive?t._interactiveEventsAdded||(t._interactiveEventsAdded=!0,t.interactionManager.setTarget(this)):t._interactiveEventsAdded&&(t._interactiveEventsAdded=!1,t.interactionManager.setTarget(this)),e.viewport(0,0,this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,null),this.clearBeforeRender&&(this.transparent?e.clearColor(0,0,0,0):e.clearColor(t.backgroundColorSplit[0],t.backgroundColorSplit[1],t.backgroundColorSplit[2],1),e.clear(e.COLOR_BUFFER_BIT)),this.renderDisplayObject(t,this.projection)}},e.WebGLRenderer.prototype.renderDisplayObject=function(t,i,r){this.renderSession.blendModeManager.setBlendMode(e.blendModes.NORMAL),this.renderSession.drawCount=0,this.renderSession.flipY=r?-1:1,this.renderSession.projection=i,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,r),t._renderWebGL(this.renderSession),this.spriteBatch.end()},e.WebGLRenderer.prototype.resize=function(t,e){this.width=t*this.resolution,this.height=e*this.resolution,this.view.width=this.width,this.view.height=this.height,this.autoResize&&(this.view.style.width=this.width/this.resolution+"px",this.view.style.height=this.height/this.resolution+"px"),this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2/this.resolution,this.projection.y=-this.height/2/this.resolution},e.WebGLRenderer.prototype.updateTexture=function(t){if(t.hasLoaded){var i=this.gl;return t._glTextures[i.id]||(t._glTextures[i.id]=i.createTexture()),i.bindTexture(i.TEXTURE_2D,t._glTextures[i.id]),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultipliedAlpha),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t.source),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t.mipmap&&e.isPowerOfTwo(t.width,t.height)?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST),i.generateMipmap(i.TEXTURE_2D)):i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,t.scaleMode===e.scaleModes.LINEAR?i.LINEAR:i.NEAREST),t._powerOf2?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)),t._dirty[i.id]=!1,t._glTextures[i.id]}},e.WebGLRenderer.prototype.handleContextLost=function(t){t.preventDefault(),this.contextLost=!0},e.WebGLRenderer.prototype.handleContextRestored=function(){this.initContext();for(var t in e.TextureCache){var i=e.TextureCache[t].baseTexture;i._glTextures=[]}this.contextLost=!1},e.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLostBound),this.view.removeEventListener("webglcontextrestored",this.contextRestoredBound),e.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},e.WebGLRenderer.prototype.mapBlendModes=function(){var t=this.gl;e.blendModesWebGL||(e.blendModesWebGL=[],e.blendModesWebGL[e.blendModes.NORMAL]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.ADD]=[t.SRC_ALPHA,t.DST_ALPHA],e.blendModesWebGL[e.blendModes.MULTIPLY]=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SCREEN]=[t.SRC_ALPHA,t.ONE],e.blendModesWebGL[e.blendModes.OVERLAY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DARKEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LIGHTEN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_DODGE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR_BURN]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HARD_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SOFT_LIGHT]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.DIFFERENCE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.EXCLUSION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.HUE]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.SATURATION]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.COLOR]=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.blendModesWebGL[e.blendModes.LUMINOSITY]=[t.ONE,t.ONE_MINUS_SRC_ALPHA])},e.WebGLRenderer.glContextId=0,e.WebGLBlendModeManager=function(){this.currentBlendMode=99999},e.WebGLBlendModeManager.prototype.constructor=e.WebGLBlendModeManager,e.WebGLBlendModeManager.prototype.setContext=function(t){this.gl=t},e.WebGLBlendModeManager.prototype.setBlendMode=function(t){if(this.currentBlendMode===t)return!1;this.currentBlendMode=t;var i=e.blendModesWebGL[this.currentBlendMode];return this.gl.blendFunc(i[0],i[1]),!0},e.WebGLBlendModeManager.prototype.destroy=function(){this.gl=null},e.WebGLMaskManager=function(){},e.WebGLMaskManager.prototype.constructor=e.WebGLMaskManager,e.WebGLMaskManager.prototype.setContext=function(t){this.gl=t},e.WebGLMaskManager.prototype.pushMask=function(t,i){var r=i.gl;t.dirty&&e.WebGLGraphics.updateGraphics(t,r),t._webGL[r.id].data.length&&i.stencilManager.pushStencil(t,t._webGL[r.id].data[0],i)},e.WebGLMaskManager.prototype.popMask=function(t,e){var i=this.gl;e.stencilManager.popStencil(t,t._webGL[i.id].data[0],e)},e.WebGLMaskManager.prototype.destroy=function(){this.gl=null},e.WebGLStencilManager=function(){this.stencilStack=[],this.reverse=!0,this.count=0},e.WebGLStencilManager.prototype.setContext=function(t){this.gl=t},e.WebGLStencilManager.prototype.pushStencil=function(t,e,i){var r=this.gl;this.bindGraphics(t,e,i),0===this.stencilStack.length&&(r.enable(r.STENCIL_TEST),r.clear(r.STENCIL_BUFFER_BIT),this.reverse=!0,this.count=0),this.stencilStack.push(e);var n=this.count;r.colorMask(!1,!1,!1,!1),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),1===e.mode?(r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),this.reverse?r.stencilFunc(r.EQUAL,255-(n+1),255):r.stencilFunc(r.EQUAL,n+1,255),this.reverse=!this.reverse):(this.reverse?(r.stencilFunc(r.EQUAL,n,255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,255-n,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n+1,255):r.stencilFunc(r.EQUAL,255-(n+1),255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),this.count++},e.WebGLStencilManager.prototype.bindGraphics=function(t,i,r){this._currentGraphics=t;var n,o=this.gl,s=r.projection,a=r.offset;1===i.mode?(n=r.shaderManager.complexPrimitiveShader,r.shaderManager.setShader(n),o.uniform1f(n.flipY,r.flipY),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform3fv(n.color,i.color),o.uniform1f(n.alpha,t.worldAlpha*i.alpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,8,0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer)):(n=r.shaderManager.primitiveShader,r.shaderManager.setShader(n),o.uniformMatrix3fv(n.translationMatrix,!1,t.worldTransform.toArray(!0)),o.uniform1f(n.flipY,r.flipY),o.uniform2f(n.projectionVector,s.x,-s.y),o.uniform2f(n.offsetVector,-a.x,-a.y),o.uniform3fv(n.tintColor,e.hex2rgb(t.tint)),o.uniform1f(n.alpha,t.worldAlpha),o.bindBuffer(o.ARRAY_BUFFER,i.buffer),o.vertexAttribPointer(n.aVertexPosition,2,o.FLOAT,!1,24,0),o.vertexAttribPointer(n.colorAttribute,4,o.FLOAT,!1,24,8),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i.indexBuffer))},e.WebGLStencilManager.prototype.popStencil=function(t,e,i){var r=this.gl;if(this.stencilStack.pop(),this.count--,0===this.stencilStack.length)r.disable(r.STENCIL_TEST);else{var n=this.count;this.bindGraphics(t,e,i),r.colorMask(!1,!1,!1,!1),1===e.mode?(this.reverse=!this.reverse,this.reverse?(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)):(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)),r.drawElements(r.TRIANGLE_FAN,4,r.UNSIGNED_SHORT,2*(e.indices.length-4)),r.stencilFunc(r.ALWAYS,0,255),r.stencilOp(r.KEEP,r.KEEP,r.INVERT),r.drawElements(r.TRIANGLE_FAN,e.indices.length-4,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)):(this.reverse?(r.stencilFunc(r.EQUAL,n+1,255),r.stencilOp(r.KEEP,r.KEEP,r.DECR)):(r.stencilFunc(r.EQUAL,255-(n+1),255),r.stencilOp(r.KEEP,r.KEEP,r.INCR)),r.drawElements(r.TRIANGLE_STRIP,e.indices.length,r.UNSIGNED_SHORT,0),this.reverse?r.stencilFunc(r.EQUAL,n,255):r.stencilFunc(r.EQUAL,255-n,255)),r.colorMask(!0,!0,!0,!0),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)}},e.WebGLStencilManager.prototype.destroy=function(){this.stencilStack=null,this.gl=null},e.WebGLShaderManager=function(){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var t=0;tr;r+=6,n+=4)this.indices[r+0]=n+0,this.indices[r+1]=n+1,this.indices[r+2]=n+2,this.indices[r+3]=n+0,this.indices[r+4]=n+2,this.indices[r+5]=n+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.dirty=!0,this.textures=[],this.blendModes=[],this.shaders=[],this.sprites=[],this.defaultShader=new e.AbstractFilter(["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"])},e.WebGLSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW),this.currentBlendMode=99999;var i=new e.PixiShader(t);i.fragmentSrc=this.defaultShader.fragmentSrc,i.uniforms={},i.init(),this.defaultShader.shaders[t.id]=i},e.WebGLSpriteBatch.prototype.begin=function(t){this.renderSession=t,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},e.WebGLSpriteBatch.prototype.end=function(){this.flush()},e.WebGLSpriteBatch.prototype.render=function(t){var e=t.texture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture);var i=e._uvs;if(i){var r,n,o,s,a=t.anchor.x,h=t.anchor.y;if(e.trim){var l=e.trim;n=l.x-a*l.width,r=n+e.crop.width,s=l.y-h*l.height,o=s+e.crop.height}else r=e.frame.width*(1-a),n=e.frame.width*-a,o=e.frame.height*(1-h),s=e.frame.height*-h;var u=4*this.currentBatchSize*this.vertSize,c=e.baseTexture.resolution,d=t.worldTransform,p=d.a/c,f=d.b/c,g=d.c/c,m=d.d/c,v=d.tx,y=d.ty,x=this.colors,b=this.positions;this.renderSession.roundPixels?(b[u]=p*n+g*s+v|0,b[u+1]=m*s+f*n+y|0,b[u+5]=p*r+g*s+v|0,b[u+6]=m*s+f*r+y|0,b[u+10]=p*r+g*o+v|0,b[u+11]=m*o+f*r+y|0,b[u+15]=p*n+g*o+v|0,b[u+16]=m*o+f*n+y|0):(b[u]=p*n+g*s+v,b[u+1]=m*s+f*n+y,b[u+5]=p*r+g*s+v,b[u+6]=m*s+f*r+y,b[u+10]=p*r+g*o+v,b[u+11]=m*o+f*r+y,b[u+15]=p*n+g*o+v,b[u+16]=m*o+f*n+y),b[u+2]=i.x0,b[u+3]=i.y0,b[u+7]=i.x1,b[u+8]=i.y1,b[u+12]=i.x2,b[u+13]=i.y2,b[u+17]=i.x3,b[u+18]=i.y3;var w=t.tint;x[u+4]=x[u+9]=x[u+14]=x[u+19]=(w>>16)+(65280&w)+((255&w)<<16)+(255*t.worldAlpha<<24),this.sprites[this.currentBatchSize++]=t}},e.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var i=t.tilingTexture;this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=i.baseTexture),t._uvs||(t._uvs=new e.TextureUvs);var r=t._uvs;t.tilePosition.x%=i.baseTexture.width*t.tileScaleOffset.x,t.tilePosition.y%=i.baseTexture.height*t.tileScaleOffset.y;var n=t.tilePosition.x/(i.baseTexture.width*t.tileScaleOffset.x),o=t.tilePosition.y/(i.baseTexture.height*t.tileScaleOffset.y),s=t.width/i.baseTexture.width/(t.tileScale.x*t.tileScaleOffset.x),a=t.height/i.baseTexture.height/(t.tileScale.y*t.tileScaleOffset.y); +r.x0=0-n,r.y0=0-o,r.x1=1*s-n,r.y1=0-o,r.x2=1*s-n,r.y2=1*a-o,r.x3=0-n,r.y3=1*a-o;var h=t.tint,l=(h>>16)+(65280&h)+((255&h)<<16)+(255*t.alpha<<24),u=this.positions,c=this.colors,d=t.width,p=t.height,f=t.anchor.x,g=t.anchor.y,m=d*(1-f),v=d*-f,y=p*(1-g),x=p*-g,b=4*this.currentBatchSize*this.vertSize,w=i.baseTexture.resolution,T=t.worldTransform,S=T.a/w,C=T.b/w,E=T.c/w,A=T.d/w,_=T.tx,M=T.ty;u[b++]=S*v+E*x+_,u[b++]=A*x+C*v+M,u[b++]=r.x0,u[b++]=r.y0,c[b++]=l,u[b++]=S*m+E*x+_,u[b++]=A*x+C*m+M,u[b++]=r.x1,u[b++]=r.y1,c[b++]=l,u[b++]=S*m+E*y+_,u[b++]=A*y+C*m+M,u[b++]=r.x2,u[b++]=r.y2,c[b++]=l,u[b++]=S*v+E*y+_,u[b++]=A*y+C*v+M,u[b++]=r.x3,u[b++]=r.y3,c[b++]=l,this.sprites[this.currentBatchSize++]=t},e.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,i=this.gl;if(this.dirty){this.dirty=!1,i.activeTexture(i.TEXTURE0),i.bindBuffer(i.ARRAY_BUFFER,this.vertexBuffer),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t=this.defaultShader.shaders[i.id];var r=4*this.vertSize;i.vertexAttribPointer(t.aVertexPosition,2,i.FLOAT,!1,r,0),i.vertexAttribPointer(t.aTextureCoord,2,i.FLOAT,!1,r,8),i.vertexAttribPointer(t.colorAttribute,4,i.UNSIGNED_BYTE,!0,r,16)}if(this.currentBatchSize>.5*this.size)i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices);else{var n=this.positions.subarray(0,4*this.currentBatchSize*this.vertSize);i.bufferSubData(i.ARRAY_BUFFER,0,n)}for(var o,s,a,h,l=0,u=0,c=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,v=this.currentBatchSize;v>m;m++){if(h=this.sprites[m],o=h.texture.baseTexture,s=h.blendMode,a=h.shader||this.defaultShader,f=d!==s,g=p!==a,(c!==o||f||g)&&(this.renderBatch(c,l,u),u=m,l=0,c=o,f&&(d=s,this.renderSession.blendModeManager.setBlendMode(d)),g)){p=a,t=p.shaders[i.id],t||(t=new e.PixiShader(i),t.fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[i.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms();var y=this.renderSession.projection;i.uniform2f(t.projectionVector,y.x,y.y);var x=this.renderSession.offset;i.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(c,l,u),this.currentBatchSize=0}},e.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var r=this.gl;t._dirty[r.id]?this.renderSession.renderer.updateTexture(t):r.bindTexture(r.TEXTURE_2D,t._glTextures[r.id]),r.drawElements(r.TRIANGLES,6*e,r.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},e.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},e.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},e.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},e.WebGLFastSpriteBatch=function(t){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var i=4*this.size*this.vertSize,r=6*this.maxSize;this.vertices=new e.Float32Array(i),this.indices=new e.Uint16Array(r),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,o=0;r>n;n+=6,o+=4)this.indices[n+0]=o+0,this.indices[n+1]=o+1,this.indices[n+2]=o+2,this.indices[n+3]=o+0,this.indices[n+4]=o+2,this.indices[n+5]=o+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(t)},e.WebGLFastSpriteBatch.prototype.constructor=e.WebGLFastSpriteBatch,e.WebGLFastSpriteBatch.prototype.setContext=function(t){this.gl=t,this.vertexBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertices,t.DYNAMIC_DRAW)},e.WebGLFastSpriteBatch.prototype.begin=function(t,e){this.renderSession=e,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=t.worldTransform.toArray(!0),this.start()},e.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.render=function(t){var e=t.children,i=e[0];if(i.texture._uvs){this.currentBaseTexture=i.texture.baseTexture,i.blendMode!==this.renderSession.blendModeManager.currentBlendMode&&(this.flush(),this.renderSession.blendModeManager.setBlendMode(i.blendMode));for(var r=0,n=e.length;n>r;r++)this.renderSprite(e[r]);this.flush()}},e.WebGLFastSpriteBatch.prototype.renderSprite=function(t){if(t.visible&&(t.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=t.texture.baseTexture,t.texture._uvs))){var e,i,r,n,o,s,a,h,l=this.vertices;if(e=t.texture._uvs,i=t.texture.frame.width,r=t.texture.frame.height,t.texture.trim){var u=t.texture.trim;o=u.x-t.anchor.x*u.width,n=o+t.texture.crop.width,a=u.y-t.anchor.y*u.height,s=a+t.texture.crop.height}else n=t.texture.frame.width*(1-t.anchor.x),o=t.texture.frame.width*-t.anchor.x,s=t.texture.frame.height*(1-t.anchor.y),a=t.texture.frame.height*-t.anchor.y;h=4*this.currentBatchSize*this.vertSize,l[h++]=o,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x0,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=a,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x1,l[h++]=e.y1,l[h++]=t.alpha,l[h++]=n,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x2,l[h++]=e.y2,l[h++]=t.alpha,l[h++]=o,l[h++]=s,l[h++]=t.position.x,l[h++]=t.position.y,l[h++]=t.scale.x,l[h++]=t.scale.y,l[h++]=t.rotation,l[h++]=e.x3,l[h++]=e.y3,l[h++]=t.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},e.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]||this.renderSession.renderer.updateTexture(this.currentBaseTexture,t),t.bindTexture(t.TEXTURE_2D,this.currentBaseTexture._glTextures[t.id]),this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},e.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},e.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36)},e.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},e.WebGLFilterManager.prototype.constructor=e.WebGLFilterManager,e.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},e.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},e.WebGLFilterManager.prototype.pushFilter=function(t){var i=this.gl,r=this.renderSession.projection,n=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),this.filterStack.push(t);var o=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var s=this.texturePool.pop();s?s.resize(this.width,this.height):s=new e.FilterTexture(this.gl,this.width,this.height),i.bindTexture(i.TEXTURE_2D,s.texture);var a=t._filterArea,h=o.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),i.bindFramebuffer(i.FRAMEBUFFER,s.frameBuffer),i.viewport(0,0,a.width,a.height),r.x=a.width/2,r.y=-a.height/2,n.x=-a.x,n.y=-a.y,i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),t._glFilterTexture=s},e.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,i=this.filterStack.pop(),r=i._filterArea,n=i._glFilterTexture,o=this.renderSession.projection,s=this.renderSession.offset;if(i.filterPasses.length>1){t.viewport(0,0,r.width,r.height),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=r.height,this.vertexArray[2]=r.width,this.vertexArray[3]=r.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=r.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=r.width/this.width,this.uvArray[5]=r.height/this.height,this.uvArray[6]=r.width/this.width,this.uvArray[7]=r.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=n,h=this.texturePool.pop();h||(h=new e.FilterTexture(this.gl,this.width,this.height)),h.resize(this.width,this.height),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l_?_:A,i.beginPath(),i.moveTo(T,S+A),i.lineTo(T,S+E-A),i.quadraticCurveTo(T,S+E,T+A,S+E),i.lineTo(T+C-A,S+E),i.quadraticCurveTo(T+C,S+E,T+C,S+E-A),i.lineTo(T+C,S+A),i.quadraticCurveTo(T+C,S,T+C-A,S),i.lineTo(T+A,S),i.quadraticCurveTo(T,S,T,S+A),i.closePath(),(o.fillColor||0===o.fillColor)&&(i.globalAlpha=o.fillAlpha*r,i.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),i.fill()),o.lineWidth&&(i.globalAlpha=o.lineAlpha*r,i.strokeStyle="#"+("00000"+(0|h).toString(16)).substr(-6),i.stroke())}}},e.CanvasGraphics.renderGraphicsMask=function(t,i){var r=t.graphicsData.length;if(0!==r){r>1&&(r=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var n=0;1>n;n++){var o=t.graphicsData[n],s=o.shape;if(o.type===e.Graphics.POLY){i.beginPath();var a=s.points;i.moveTo(a[0],a[1]);for(var h=1;hA?A:E,i.beginPath(),i.moveTo(w,T+E),i.lineTo(w,T+C-E),i.quadraticCurveTo(w,T+C,w+E,T+C),i.lineTo(w+S-E,T+C),i.quadraticCurveTo(w+S,T+C,w+S,T+C-E),i.lineTo(w+S,T+E),i.quadraticCurveTo(w+S,T,w+S-E,T),i.lineTo(w+E,T),i.quadraticCurveTo(w,T,w,T+E),i.closePath()}}}},e.CanvasGraphics.updateGraphicsTint=function(t){if(16777215!==t.tint)for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,r=(255&t.tint)/255,n=0;n>16&255)/255*e*255<<16)+((s>>8&255)/255*i*255<<8)+(255&s)/255*r*255,o._lineTint=((a>>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*r*255}},e.Graphics=function(){e.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=e.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new e.Rectangle(0,0,1,1),this.dirty=!0,this.webGLDirty=!1,this.cachedSpriteDirty=!1},e.Graphics.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Graphics.prototype.constructor=e.Graphics,Object.defineProperty(e.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(t){this._cacheAsBitmap=t,this._cacheAsBitmap?this._generateCachedSprite():(this.destroyCachedSprite(),this.dirty=!0)}}),e.Graphics.prototype.lineStyle=function(t,i,r){if(this.lineWidth=t||0,this.lineColor=i||0,this.lineAlpha=arguments.length<3?1:r,this.currentPath){if(this.currentPath.shape.points.length)return this.drawShape(new e.Polygon(this.currentPath.shape.points.slice(-2))),this;this.currentPath.lineWidth=this.lineWidth,this.currentPath.lineColor=this.lineColor,this.currentPath.lineAlpha=this.lineAlpha}return this},e.Graphics.prototype.moveTo=function(t,i){return this.drawShape(new e.Polygon([t,i])),this},e.Graphics.prototype.lineTo=function(t,e){return this.currentPath.shape.points.push(t,e),this.dirty=!0,this},e.Graphics.prototype.quadraticCurveTo=function(t,e,i,r){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);var n,o,s=20,a=this.currentPath.shape.points;0===a.length&&this.moveTo(0,0);for(var h=a[a.length-2],l=a[a.length-1],u=0,c=1;s>=c;c++)u=c/s,n=h+(t-h)*u,o=l+(e-l)*u,a.push(n+(t+(i-t)*u-n)*u,o+(e+(r-e)*u-o)*u);return this.dirty=!0,this},e.Graphics.prototype.bezierCurveTo=function(t,e,i,r,n,o){this.currentPath?0===this.currentPath.shape.points.length&&(this.currentPath.shape.points=[0,0]):this.moveTo(0,0);for(var s,a,h,l,u,c=20,d=this.currentPath.shape.points,p=d[d.length-2],f=d[d.length-1],g=0,m=1;c>=m;m++)g=m/c,s=1-g,a=s*s,h=a*s,l=g*g,u=l*g,d.push(h*p+3*a*g*t+3*s*l*i+u*n,h*f+3*a*g*e+3*s*l*r+u*o);return this.dirty=!0,this},e.Graphics.prototype.arcTo=function(t,e,i,r,n){this.currentPath?0===this.currentPath.shape.points.length&&this.currentPath.shape.points.push(t,e):this.moveTo(t,e);var o=this.currentPath.shape.points,s=o[o.length-2],a=o[o.length-1],h=a-e,l=s-t,u=r-e,c=i-t,d=Math.abs(h*c-l*u);if(1e-8>d||0===n)(o[o.length-2]!==t||o[o.length-1]!==e)&&o.push(t,e);else{var p=h*h+l*l,f=u*u+c*c,g=h*u+l*c,m=n*Math.sqrt(p)/d,v=n*Math.sqrt(f)/d,y=m*g/p,x=v*g/f,b=m*c+v*l,w=m*u+v*h,T=l*(v+y),S=h*(v+y),C=c*(m+x),E=u*(m+x),A=Math.atan2(S-w,T-b),_=Math.atan2(E-w,C-b);this.arc(b+t,w+e,n,A,_,l*u>c*h)}return this.dirty=!0,this},e.Graphics.prototype.arc=function(t,e,i,r,n,o){var s,a=t+Math.cos(r)*i,h=e+Math.sin(r)*i;if(this.currentPath?(s=this.currentPath.shape.points,0===s.length?s.push(a,h):(s[s.length-2]!==a||s[s.length-1]!==h)&&s.push(a,h)):(this.moveTo(a,h),s=this.currentPath.shape.points),r===n)return this;!o&&r>=n?n+=2*Math.PI:o&&n>=r&&(r+=2*Math.PI);var l=o?-1*(r-n):n-r,u=Math.abs(l)/(2*Math.PI)*40;if(0===l)return this;for(var c=l/(2*u),d=2*c,p=Math.cos(c),f=Math.sin(c),g=u-1,m=g%1/g,v=0;g>=v;v++){var y=v+m*v,x=c+r+d*y,b=Math.cos(x),w=-Math.sin(x);s.push((p*b+f*w)*i+t,(p*-w+f*b)*i+e)}return this.dirty=!0,this},e.Graphics.prototype.beginFill=function(t,e){return this.filling=!0,this.fillColor=t||0,this.fillAlpha=void 0===e?1:e,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},e.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},e.Graphics.prototype.drawRect=function(t,i,r,n){return this.drawShape(new e.Rectangle(t,i,r,n)),this},e.Graphics.prototype.drawRoundedRect=function(t,i,r,n,o){return this.drawShape(new e.RoundedRectangle(t,i,r,n,o)),this},e.Graphics.prototype.drawCircle=function(t,i,r){return this.drawShape(new e.Circle(t,i,r)),this},e.Graphics.prototype.drawEllipse=function(t,i,r,n){return this.drawShape(new e.Ellipse(t,i,r,n)),this},e.Graphics.prototype.drawPolygon=function(t){return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.drawShape(new e.Polygon(t)),this},e.Graphics.prototype.clear=function(){return this.lineWidth=0,this.filling=!1,this.dirty=!0,this.clearDirty=!0,this.graphicsData=[],this},e.Graphics.prototype.generateTexture=function(t,i){t=t||1;var r=this.getBounds(),n=new e.CanvasBuffer(r.width*t,r.height*t),o=e.Texture.fromCanvas(n.canvas,i);return o.baseTexture.resolution=t,n.context.scale(t,t),n.context.translate(-r.x,-r.y),e.CanvasGraphics.renderGraphics(this,n.context),o},e.Graphics.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.worldAlpha=this.worldAlpha,void e.Sprite.prototype._renderWebGL.call(this._cachedSprite,t);if(t.spriteBatch.stop(),t.blendModeManager.setBlendMode(this.blendMode),this._mask&&t.maskManager.pushMask(this._mask,t),this._filters&&t.filterManager.pushFilter(this._filterBlock),this.blendMode!==t.spriteBatch.currentBlendMode){t.spriteBatch.currentBlendMode=this.blendMode; +var i=e.blendModesWebGL[t.spriteBatch.currentBlendMode];t.spriteBatch.gl.blendFunc(i[0],i[1])}if(this.webGLDirty&&(this.dirty=!0,this.webGLDirty=!1),e.WebGLGraphics.renderGraphics(this,t),this.children.length){t.spriteBatch.start();for(var r=0,n=this.children.length;n>r;r++)this.children[r]._renderWebGL(t);t.spriteBatch.stop()}this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this.mask,t),t.drawCount++,t.spriteBatch.start()}},e.Graphics.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){if(this._cacheAsBitmap)return(this.dirty||this.cachedSpriteDirty)&&(this._generateCachedSprite(),this.updateCachedSpriteTexture(),this.cachedSpriteDirty=!1,this.dirty=!1),this._cachedSprite.alpha=this.alpha,void e.Sprite.prototype._renderCanvas.call(this._cachedSprite,t);var i=t.context,r=this.worldTransform;this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]),this._mask&&t.maskManager.pushMask(this._mask,t);var n=t.resolution;i.setTransform(r.a*n,r.b*n,r.c*n,r.d*n,r.tx*n,r.ty*n),e.CanvasGraphics.renderGraphics(this,i);for(var o=0,s=this.children.length;s>o;o++)this.children[o]._renderCanvas(t);this._mask&&t.maskManager.popMask(t)}},e.Graphics.prototype.getBounds=function(t){if(this.isMask)return e.EmptyRectangle;this.dirty&&(this.updateLocalBounds(),this.webGLDirty=!0,this.cachedSpriteDirty=!0,this.dirty=!1);var i=this._localBounds,r=i.x,n=i.width+i.x,o=i.y,s=i.height+i.y,a=t||this.worldTransform,h=a.a,l=a.b,u=a.c,c=a.d,d=a.tx,p=a.ty,f=h*n+u*s+d,g=c*s+l*n+p,m=h*r+u*s+d,v=c*s+l*r+p,y=h*r+u*o+d,x=c*o+l*r+p,b=h*n+u*o+d,w=c*o+l*n+p,T=f,S=g,C=f,E=g;return C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,E=E>v?v:E,E=E>x?x:E,E=E>w?w:E,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T,S=v>S?v:S,S=x>S?x:S,S=w>S?w:S,this._bounds.x=C,this._bounds.width=T-C,this._bounds.y=E,this._bounds.height=S-E,this._bounds},e.Graphics.prototype.updateLocalBounds=function(){var t=1/0,i=-(1/0),r=1/0,n=-(1/0);if(this.graphicsData.length)for(var o,s,a,h,l,u,c=0;ca?a:t,i=a+l>i?a+l:i,r=r>h?h:r,n=h+u>n?h+u:n;else if(p===e.Graphics.CIRC)a=o.x,h=o.y,l=o.radius+f/2,u=o.radius+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else if(p===e.Graphics.ELIP)a=o.x,h=o.y,l=o.width+f/2,u=o.height+f/2,t=t>a-l?a-l:t,i=a+l>i?a+l:i,r=r>h-u?h-u:r,n=h+u>n?h+u:n;else{s=o.points;for(var g=0;ga-f?a-f:t,i=a+f>i?a+f:i,r=r>h-f?h-f:r,n=h+f>n?h+f:n}}else t=0,i=0,r=0,n=0;var m=this.boundsPadding;this._localBounds.x=t-m,this._localBounds.width=i-t+2*m,this._localBounds.y=r-m,this._localBounds.height=n-r+2*m},e.Graphics.prototype._generateCachedSprite=function(){var t=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(t.width,t.height);else{var i=new e.CanvasBuffer(t.width,t.height),r=e.Texture.fromCanvas(i.canvas);this._cachedSprite=new e.Sprite(r),this._cachedSprite.buffer=i,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(t.x/t.width),this._cachedSprite.anchor.y=-(t.y/t.height),this._cachedSprite.buffer.context.translate(-t.x,-t.y),this.worldAlpha=1,e.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},e.Graphics.prototype.updateCachedSpriteTexture=function(){var t=this._cachedSprite,e=t.texture,i=t.buffer.canvas;e.baseTexture.width=i.width,e.baseTexture.height=i.height,e.crop.width=e.frame.width=i.width,e.crop.height=e.frame.height=i.height,t._width=i.width,t._height=i.height,e.baseTexture.dirty()},e.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},e.Graphics.prototype.drawShape=function(t){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null;var i=new e.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,t);return this.graphicsData.push(i),i.type===e.Graphics.POLY&&(i.shape.closed=this.filling,this.currentPath=i),this.dirty=!0,i},e.GraphicsData=function(t,e,i,r,n,o,s){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this._lineTint=e,this.fillColor=r,this.fillAlpha=n,this._fillTint=r,this.fill=o,this.shape=s,this.type=s.type},e.Graphics.POLY=0,e.Graphics.RECT=1,e.Graphics.CIRC=2,e.Graphics.ELIP=3,e.Graphics.RREC=4,e.Polygon.prototype.type=e.Graphics.POLY,e.Rectangle.prototype.type=e.Graphics.RECT,e.Circle.prototype.type=e.Graphics.CIRC,e.Ellipse.prototype.type=e.Graphics.ELIP,e.RoundedRectangle.prototype.type=e.Graphics.RREC,e.Strip=function(t){e.DisplayObjectContainer.call(this),this.texture=t,this.uvs=new e.Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new e.Float32Array([0,0,100,0,100,100,0,100]),this.colors=new e.Float32Array([1,1,1,1]),this.indices=new e.Uint16Array([0,1,2,3]),this.dirty=!0,this.blendMode=e.blendModes.NORMAL,this.canvasPadding=0,this.drawMode=e.Strip.DrawModes.TRIANGLE_STRIP},e.Strip.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Strip.prototype.constructor=e.Strip,e.Strip.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||(t.spriteBatch.stop(),this._vertexBuffer||this._initWebGL(t),t.shaderManager.setShader(t.shaderManager.stripShader),this._renderStrip(t),t.spriteBatch.start())},e.Strip.prototype._initWebGL=function(t){var e=t.gl;this._vertexBuffer=e.createBuffer(),this._indexBuffer=e.createBuffer(),this._uvBuffer=e.createBuffer(),this._colorBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices,e.DYNAMIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._uvBuffer),e.bufferData(e.ARRAY_BUFFER,this.uvs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this._colorBuffer),e.bufferData(e.ARRAY_BUFFER,this.colors,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW)},e.Strip.prototype._renderStrip=function(t){var i=t.gl,r=t.projection,n=t.offset,o=t.shaderManager.stripShader,s=this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?i.TRIANGLE_STRIP:i.TRIANGLES;t.blendModeManager.setBlendMode(this.blendMode),i.uniformMatrix3fv(o.translationMatrix,!1,this.worldTransform.toArray(!0)),i.uniform2f(o.projectionVector,r.x,-r.y),i.uniform2f(o.offsetVector,-n.x,-n.y),i.uniform1f(o.alpha,this.worldAlpha),this.dirty?(this.dirty=!1,i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferData(i.ARRAY_BUFFER,this.vertices,i.STATIC_DRAW),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.bufferData(i.ARRAY_BUFFER,this.uvs,i.STATIC_DRAW),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,this.indices,i.STATIC_DRAW)):(i.bindBuffer(i.ARRAY_BUFFER,this._vertexBuffer),i.bufferSubData(i.ARRAY_BUFFER,0,this.vertices),i.vertexAttribPointer(o.aVertexPosition,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,this._uvBuffer),i.vertexAttribPointer(o.aTextureCoord,2,i.FLOAT,!1,0,0),i.activeTexture(i.TEXTURE0),this.texture.baseTexture._dirty[i.id]?t.renderer.updateTexture(this.texture.baseTexture):i.bindTexture(i.TEXTURE_2D,this.texture.baseTexture._glTextures[i.id]),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._indexBuffer)),i.drawElements(s,this.indices.length,i.UNSIGNED_SHORT,0)},e.Strip.prototype._renderCanvas=function(t){var i=t.context,r=this.worldTransform;t.roundPixels?i.setTransform(r.a,r.b,r.c,r.d,0|r.tx,0|r.ty):i.setTransform(r.a,r.b,r.c,r.d,r.tx,r.ty),this.drawMode===e.Strip.DrawModes.TRIANGLE_STRIP?this._renderCanvasTriangleStrip(i):this._renderCanvasTriangles(i)},e.Strip.prototype._renderCanvasTriangleStrip=function(t){var e=this.vertices,i=this.uvs,r=e.length/2;this.count++;for(var n=0;r-2>n;n++){var o=2*n;this._renderCanvasDrawTriangle(t,e,i,o,o+2,o+4)}},e.Strip.prototype._renderCanvasTriangles=function(t){var e=this.vertices,i=this.uvs,r=this.indices,n=r.length;this.count++;for(var o=0;n>o;o+=3){var s=2*r[o],a=2*r[o+1],h=2*r[o+2];this._renderCanvasDrawTriangle(t,e,i,s,a,h)}},e.Strip.prototype._renderCanvasDrawTriangle=function(t,e,i,r,n,o){var s=this.texture.baseTexture.source,a=this.texture.width,h=this.texture.height,l=e[r],u=e[n],c=e[o],d=e[r+1],p=e[n+1],f=e[o+1],g=i[r]*a,m=i[n]*a,v=i[o]*a,y=i[r+1]*h,x=i[n+1]*h,b=i[o+1]*h;if(this.canvasPadding>0){var w=this.canvasPadding/this.worldTransform.a,T=this.canvasPadding/this.worldTransform.d,S=(l+u+c)/3,C=(d+p+f)/3,E=l-S,A=d-C,_=Math.sqrt(E*E+A*A);l=S+E/_*(_+w),d=C+A/_*(_+T),E=u-S,A=p-C,_=Math.sqrt(E*E+A*A),u=S+E/_*(_+w),p=C+A/_*(_+T),E=c-S,A=f-C,_=Math.sqrt(E*E+A*A),c=S+E/_*(_+w),f=C+A/_*(_+T)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(u,p),t.lineTo(c,f),t.closePath(),t.clip();var M=g*x+y*v+m*b-x*v-y*m-g*b,L=l*x+y*c+u*b-x*c-y*u-l*b,R=g*u+l*v+m*c-u*v-l*m-g*c,P=g*x*c+y*u*v+l*m*b-l*x*v-y*m*c-g*u*b,F=d*x+y*f+p*b-x*f-y*p-d*b,B=g*p+d*v+m*f-p*v-d*m-g*f,I=g*x*f+y*p*v+d*m*b-d*x*v-y*m*f-g*p*b;t.transform(L/M,F/M,R/M,B/M,P/M,I/M),t.drawImage(s,0,0),t.restore()},e.Strip.prototype.renderStripFlat=function(t){var e=this.context,i=t.vertices,r=i.length/2;this.count++,e.beginPath();for(var n=1;r-2>n;n++){var o=2*n,s=i[o],a=i[o+2],h=i[o+4],l=i[o+1],u=i[o+3],c=i[o+5];e.moveTo(s,l),e.lineTo(a,u),e.lineTo(h,c)}e.fillStyle="#FF0000",e.fill(),e.closePath()},e.Strip.prototype.onTextureUpdate=function(){this.updateFrame=!0},e.Strip.prototype.getBounds=function(t){for(var i=t||this.worldTransform,r=i.a,n=i.b,o=i.c,s=i.d,a=i.tx,h=i.ty,l=-(1/0),u=-(1/0),c=1/0,d=1/0,p=this.vertices,f=0,g=p.length;g>f;f+=2){var m=p[f],v=p[f+1],y=r*m+o*v+a,x=s*v+n*m+h;c=c>y?y:c,d=d>x?x:d,l=y>l?y:l,u=x>u?x:u}if(c===-(1/0)||u===1/0)return e.EmptyRectangle;var b=this._bounds;return b.x=c,b.width=l-c,b.y=d,b.height=u-d,this._currentBounds=b,b},e.Strip.DrawModes={TRIANGLE_STRIP:0,TRIANGLES:1},e.Rope=function(t,i){e.Strip.call(this,t),this.points=i,this.vertices=new e.Float32Array(4*i.length),this.uvs=new e.Float32Array(4*i.length),this.colors=new e.Float32Array(2*i.length),this.indices=new e.Uint16Array(2*i.length),this.refresh()},e.Rope.prototype=Object.create(e.Strip.prototype),e.Rope.prototype.constructor=e.Rope,e.Rope.prototype.refresh=function(){var t=this.points;if(!(t.length<1)){var e=this.uvs,i=t[0],r=this.indices,n=this.colors;this.count-=.2,e[0]=0,e[1]=0,e[2]=0,e[3]=1,n[0]=1,n[1]=1,r[0]=0,r[1]=1;for(var o,s,a,h=t.length,l=1;h>l;l++)o=t[l],s=4*l,a=l/(h-1),l%2?(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1):(e[s]=a,e[s+1]=0,e[s+2]=a,e[s+3]=1),s=2*l,n[s]=1,n[s+1]=1,s=2*l,r[s]=s,r[s+1]=s+1,i=o}},e.Rope.prototype.updateTransform=function(){var t=this.points;if(!(t.length<1)){var i,r=t[0],n={x:0,y:0};this.count-=.2;for(var o,s,a,h,l,u=this.vertices,c=t.length,d=0;c>d;d++)o=t[d],s=4*d,i=d1&&(a=1),h=Math.sqrt(n.x*n.x+n.y*n.y),l=this.texture.height/2,n.x/=h,n.y/=h,n.x*=l,n.y*=l,u[s]=o.x+n.x,u[s+1]=o.y+n.y,u[s+2]=o.x-n.x,u[s+3]=o.y-n.y,r=o;e.DisplayObjectContainer.prototype.updateTransform.call(this)}},e.Rope.prototype.setTexture=function(t){this.texture=t},e.TilingSprite=function(t,i,r){e.Sprite.call(this,t),this._width=i||100,this._height=r||100,this.tileScale=new e.Point(1,1),this.tileScaleOffset=new e.Point(1,1),this.tilePosition=new e.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=e.blendModes.NORMAL},e.TilingSprite.prototype=Object.create(e.Sprite.prototype),e.TilingSprite.prototype.constructor=e.TilingSprite,Object.defineProperty(e.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(e.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),e.TilingSprite.prototype.setTexture=function(t){this.texture!==t&&(this.texture=t,this.refreshTexture=!0,this.cachedTint=16777215)},e.TilingSprite.prototype._renderWebGL=function(t){if(this.visible!==!1&&0!==this.alpha){var e,i;for(this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(t.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)):t.spriteBatch.renderTilingSprite(this),e=0,i=this.children.length;i>e;e++)this.children[e]._renderWebGL(t);t.spriteBatch.stop(),this._filters&&t.filterManager.popFilter(),this._mask&&t.maskManager.popMask(this._mask,t),t.spriteBatch.start()}},e.TilingSprite.prototype._renderCanvas=function(t){if(this.visible!==!1&&0!==this.alpha){var i=t.context;this._mask&&t.maskManager.pushMask(this._mask,t),i.globalAlpha=this.worldAlpha;var r,n,o=this.worldTransform,s=t.resolution;if(i.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*s,o.ty*s),!this.__tilePattern||this.refreshTexture){if(this.generateTilingTexture(!1),!this.tilingTexture)return;this.__tilePattern=i.createPattern(this.tilingTexture.baseTexture.source,"repeat")}this.blendMode!==t.currentBlendMode&&(t.currentBlendMode=this.blendMode,i.globalCompositeOperation=e.blendModesCanvas[t.currentBlendMode]);var a=this.tilePosition,h=this.tileScale;for(a.x%=this.tilingTexture.baseTexture.width,a.y%=this.tilingTexture.baseTexture.height,i.scale(h.x,h.y),i.translate(a.x+this.anchor.x*-this._width,a.y+this.anchor.y*-this._height),i.fillStyle=this.__tilePattern,i.fillRect(-a.x,-a.y,this._width/h.x,this._height/h.y),i.scale(1/h.x,1/h.y),i.translate(-a.x+this.anchor.x*this._width,-a.y+this.anchor.y*this._height),this._mask&&t.maskManager.popMask(t),r=0,n=this.children.length;n>r;r++)this.children[r]._renderCanvas(t)}},e.TilingSprite.prototype.getBounds=function(){var t=this._width,e=this._height,i=t*(1-this.anchor.x),r=t*-this.anchor.x,n=e*(1-this.anchor.y),o=e*-this.anchor.y,s=this.worldTransform,a=s.a,h=s.b,l=s.c,u=s.d,c=s.tx,d=s.ty,p=a*r+l*o+c,f=u*o+h*r+d,g=a*i+l*o+c,m=u*o+h*i+d,v=a*i+l*n+c,y=u*n+h*i+d,x=a*r+l*n+c,b=u*n+h*r+d,w=-(1/0),T=-(1/0),S=1/0,C=1/0;S=S>p?p:S,S=S>g?g:S,S=S>v?v:S,S=S>x?x:S,C=C>f?f:C,C=C>m?m:C,C=C>y?y:C,C=C>b?b:C,w=p>w?p:w,w=g>w?g:w,w=v>w?v:w,w=x>w?x:w,T=f>T?f:T,T=m>T?m:T,T=y>T?y:T,T=b>T?b:T;var E=this._bounds;return E.x=S,E.width=w-S,E.y=C,E.height=T-C,this._currentBounds=E,E},e.TilingSprite.prototype.onTextureUpdate=function(){},e.TilingSprite.prototype.generateTilingTexture=function(t){if(this.texture.baseTexture.hasLoaded){var i,r,n=this.originalTexture||this.texture,o=n.frame,s=o.width!==n.baseTexture.width||o.height!==n.baseTexture.height,a=!1;if(t?(i=e.getNextPowerOfTwo(o.width),r=e.getNextPowerOfTwo(o.height),(o.width!==i||o.height!==r||n.baseTexture.width!==i||n.baseTexture.height||r)&&(a=!0)):s&&(n.trim?(i=n.trim.width,r=n.trim.height):(i=o.width,r=o.height),a=!0),a){var h;this.tilingTexture&&this.tilingTexture.isTiling?(h=this.tilingTexture.canvasBuffer,h.resize(i,r),this.tilingTexture.baseTexture.width=i,this.tilingTexture.baseTexture.height=r,this.tilingTexture.needsUpdate=!0):(h=new e.CanvasBuffer(i,r),this.tilingTexture=e.Texture.fromCanvas(h.canvas),this.tilingTexture.canvasBuffer=h,this.tilingTexture.isTiling=!0),h.context.drawImage(n.baseTexture.source,n.crop.x,n.crop.y,n.crop.width,n.crop.height,0,0,i,r),this.tileScaleOffset.x=o.width/i,this.tileScaleOffset.y=o.height/r}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=n;this.refreshTexture=!1,this.originalTexture=this.texture,this.texture=this.tilingTexture,this.tilingTexture.baseTexture._powerOf2=!0}},e.TilingSprite.prototype.destroy=function(){e.Sprite.prototype.destroy.call(this),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture&&(this.tilingTexture.destroy(!0),this.tilingTexture=null)};var i={radDeg:180/Math.PI,degRad:Math.PI/180,temp:[],Float32Array:"undefined"==typeof Float32Array?Array:Float32Array,Uint16Array:"undefined"==typeof Uint16Array?Array:Uint16Array};i.BoneData=function(t,e){this.name=t,this.parent=e},i.BoneData.prototype={length:0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,inheritScale:!0,inheritRotation:!0,flipX:!1,flipY:!1},i.SlotData=function(t,e){this.name=t,this.boneData=e},i.SlotData.prototype={r:1,g:1,b:1,a:1,attachmentName:null,additiveBlending:!1},i.IkConstraintData=function(t){this.name=t,this.bones=[]},i.IkConstraintData.prototype={target:null,bendDirection:1,mix:1},i.Bone=function(t,e,i){this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()},i.Bone.yDown=!1,i.Bone.prototype={x:0,y:0,rotation:0,rotationIK:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,m00:0,m01:0,worldX:0,m10:0,m11:0,worldY:0,worldRotation:0,worldScaleX:1,worldScaleY:1,worldFlipX:!1,worldFlipY:!1,updateWorldTransform:function(){var t=this.parent;if(t)this.worldX=this.x*t.m00+this.y*t.m01+t.worldX,this.worldY=this.x*t.m10+this.y*t.m11+t.worldY,this.data.inheritScale?(this.worldScaleX=t.worldScaleX*this.scaleX,this.worldScaleY=t.worldScaleY*this.scaleY):(this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY),this.worldRotation=this.data.inheritRotation?t.worldRotation+this.rotationIK:this.rotationIK,this.worldFlipX=t.worldFlipX!=this.flipX,this.worldFlipY=t.worldFlipY!=this.flipY;else{var e=this.skeleton.flipX,r=this.skeleton.flipY;this.worldX=e?-this.x:this.x,this.worldY=r!=i.Bone.yDown?-this.y:this.y,this.worldScaleX=this.scaleX,this.worldScaleY=this.scaleY,this.worldRotation=this.rotationIK,this.worldFlipX=e!=this.flipX,this.worldFlipY=r!=this.flipY}var n=this.worldRotation*i.degRad,o=Math.cos(n),s=Math.sin(n);this.worldFlipX?(this.m00=-o*this.worldScaleX,this.m01=s*this.worldScaleY):(this.m00=o*this.worldScaleX,this.m01=-s*this.worldScaleY),this.worldFlipY!=i.Bone.yDown?(this.m10=-s*this.worldScaleX,this.m11=-o*this.worldScaleY):(this.m10=s*this.worldScaleX,this.m11=o*this.worldScaleY)},setToSetupPose:function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.rotationIK=this.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.flipX=t.flipX,this.flipY=t.flipY},worldToLocal:function(t){var e=t[0]-this.worldX,r=t[1]-this.worldY,n=this.m00,o=this.m10,s=this.m01,a=this.m11;this.worldFlipX!=(this.worldFlipY!=i.Bone.yDown)&&(n=-n,a=-a);var h=1/(n*a-s*o);t[0]=e*n*h-r*s*h,t[1]=r*a*h-e*o*h},localToWorld:function(t){var e=t[0],i=t[1];t[0]=e*this.m00+i*this.m01+this.worldX,t[1]=e*this.m10+i*this.m11+this.worldY}},i.Slot=function(t,e){this.data=t,this.bone=e,this.setToSetupPose()},i.Slot.prototype={r:1,g:1,b:1,a:1,_attachmentTime:0,attachment:null,attachmentVertices:[],setAttachment:function(t){this.attachment=t,this._attachmentTime=this.bone.skeleton.time,this.attachmentVertices.length=0},setAttachmentTime:function(t){this._attachmentTime=this.bone.skeleton.time-t},getAttachmentTime:function(){return this.bone.skeleton.time-this._attachmentTime},setToSetupPose:function(){var t=this.data;this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;for(var e=this.bone.skeleton.data.slots,i=0,r=e.length;r>i;i++)if(e[i]==t){this.setAttachment(t.attachmentName?this.bone.skeleton.getAttachmentBySlotIndex(i,t.attachmentName):null);break}}},i.IkConstraint=function(t,e){this.data=t,this.mix=t.mix,this.bendDirection=t.bendDirection,this.bones=[];for(var i=0,r=t.bones.length;r>i;i++)this.bones.push(e.findBone(t.bones[i].name));this.target=e.findBone(t.target.name)},i.IkConstraint.prototype={apply:function(){var t=this.target,e=this.bones;switch(e.length){case 1:i.IkConstraint.apply1(e[0],t.worldX,t.worldY,this.mix);break;case 2:i.IkConstraint.apply2(e[0],e[1],t.worldX,t.worldY,this.bendDirection,this.mix)}}},i.IkConstraint.apply1=function(t,e,r,n){var o=t.data.inheritRotation&&t.parent?t.parent.worldRotation:0,s=t.rotation,a=Math.atan2(r-t.worldY,e-t.worldX)*i.radDeg-o;t.rotationIK=s+(a-s)*n},i.IkConstraint.apply2=function(t,e,r,n,o,s){var a=e.rotation,h=t.rotation;if(!s)return e.rotationIK=a,void(t.rotationIK=h);var l,u,c=i.temp,d=t.parent;d?(c[0]=r,c[1]=n,d.worldToLocal(c),r=(c[0]-t.x)*d.worldScaleX,n=(c[1]-t.y)*d.worldScaleY):(r-=t.x,n-=t.y),e.parent==t?(l=e.x,u=e.y):(c[0]=e.x,c[1]=e.y,e.parent.localToWorld(c),t.worldToLocal(c),l=c[0],u=c[1]);var p=l*t.worldScaleX,f=u*t.worldScaleY,g=Math.atan2(f,p),m=Math.sqrt(p*p+f*f),v=e.data.length*e.worldScaleX,y=2*m*v;if(1e-4>y)return void(e.rotationIK=a+(Math.atan2(n,r)*i.radDeg-h-a)*s);var x=(r*r+n*n-m*m-v*v)/y;-1>x?x=-1:x>1&&(x=1);var b=Math.acos(x)*o,w=m+v*x,T=v*Math.sin(b),S=Math.atan2(n*w-r*T,r*w+n*T),C=(S-g)*i.radDeg-h;C>180?C-=360:-180>C&&(C+=360),t.rotationIK=h+C*s,C=(b+g)*i.radDeg-a,C>180?C-=360:-180>C&&(C+=360),e.rotationIK=a+(C+t.worldRotation-e.parent.worldRotation)*s},i.Skin=function(t){this.name=t,this.attachments={}},i.Skin.prototype={addAttachment:function(t,e,i){this.attachments[t+":"+e]=i},getAttachment:function(t,e){return this.attachments[t+":"+e]},_attachAll:function(t,e){for(var i in e.attachments){var r=i.indexOf(":"),n=parseInt(i.substring(0,r)),o=i.substring(r+1),s=t.slots[n];if(s.attachment&&s.attachment.name==o){var a=this.getAttachment(n,o);a&&s.setAttachment(a)}}}},i.Animation=function(t,e,i){this.name=t,this.timelines=e,this.duration=i},i.Animation.prototype={apply:function(t,e,i,r,n){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var o=this.timelines,s=0,a=o.length;a>s;s++)o[s].apply(t,e,i,n,1)},mix:function(t,e,i,r,n,o){r&&0!=this.duration&&(i%=this.duration,e%=this.duration);for(var s=this.timelines,a=0,h=s.length;h>a;a++)s[a].apply(t,e,i,n,o)}},i.Animation.binarySearch=function(t,e,i){var r=0,n=Math.floor(t.length/i)-2;if(!n)return i;for(var o=n>>>1;;){if(t[(o+1)*i]<=e?r=o+1:n=o,r==n)return(r+1)*i;o=r+n>>>1}},i.Animation.binarySearch1=function(t,e){var i=0,r=t.length-2;if(!r)return 1;for(var n=r>>>1;;){if(t[n+1]<=e?i=n+1:r=n,i==r)return i+1;n=i+r>>>1}},i.Animation.linearSearch=function(t,e,i){for(var r=0,n=t.length-i;n>=r;r+=i)if(t[r]>e)return r;return-1},i.Curves=function(){this.curves=[]},i.Curves.prototype={setLinear:function(t){this.curves[19*t]=0},setStepped:function(t){this.curves[19*t]=1},setCurve:function(t,e,i,r,n){var o=.1,s=o*o,a=s*o,h=3*o,l=3*s,u=6*s,c=6*a,d=2*-e+r,p=2*-i+n,f=3*(e-r)+1,g=3*(i-n)+1,m=e*h+d*l+f*a,v=i*h+p*l+g*a,y=d*u+f*c,x=p*u+g*c,b=f*c,w=g*c,T=19*t,S=this.curves;S[T++]=2;for(var C=m,E=v,A=T+19-1;A>T;T+=2)S[T]=C,S[T+1]=E,m+=y,v+=x,y+=b,x+=w,C+=m,E+=v},getCurvePercent:function(t,e){e=0>e?0:e>1?1:e;var i=this.curves,r=19*t,n=i[r];if(0===n)return e;if(1==n)return 0;r++;for(var o=0,s=r,a=r+19-1;a>r;r+=2)if(o=i[r],o>=e){var h,l;return r==s?(h=0,l=0):(h=i[r-2],l=i[r-1]),l+(i[r+1]-l)*(e-h)/(o-h)}var u=i[r-1];return u+(1-u)*(e-o)/(1-o)}},i.RotateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.RotateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-2]){for(var h=a.data.rotation+s[s.length-1]-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;return void(a.rotation+=h*o)}var l=i.Animation.binarySearch(s,r,2),u=s[l-1],c=s[l],d=1-(r-c)/(s[l-2]-c);d=this.curves.getCurvePercent(l/2-1,d);for(var h=s[l+1]-u;h>180;)h-=360;for(;-180>h;)h+=360;for(h=a.data.rotation+(u+h*d)-a.rotation;h>180;)h-=360;for(;-180>h;)h+=360;a.rotation+=h*o}}},i.TranslateTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.TranslateTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.x+=(a.data.x+s[s.length-2]-a.x)*o,void(a.y+=(a.data.y+s[s.length-1]-a.y)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.x+=(a.data.x+l+(s[h+1]-l)*d-a.x)*o,a.y+=(a.data.y+u+(s[h+2]-u)*d-a.y)*o}}},i.ScaleTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.ScaleTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.scaleX+=(a.data.scaleX*s[s.length-2]-a.scaleX)*o,void(a.scaleY+=(a.data.scaleY*s[s.length-1]-a.scaleY)*o);var h=i.Animation.binarySearch(s,r,3),l=s[h-2],u=s[h-1],c=s[h],d=1-(r-c)/(s[h+-3]-c);d=this.curves.getCurvePercent(h/3-1,d),a.scaleX+=(a.data.scaleX*(l+(s[h+1]-l)*d)-a.scaleX)*o,a.scaleY+=(a.data.scaleY*(u+(s[h+2]-u)*d)-a.scaleY)*o}}},i.ColorTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=5*t},i.ColorTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length/5},setFrame:function(t,e,i,r,n,o){t*=5,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r,this.frames[t+3]=n,this.frames[t+4]=o},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-5]){var c=s.length-1;a=s[c-3],h=s[c-2],l=s[c-1],u=s[c]}else{var d=i.Animation.binarySearch(s,r,5),p=s[d-4],f=s[d-3],g=s[d-2],m=s[d-1],v=s[d],y=1-(r-v)/(s[d-5]-v);y=this.curves.getCurvePercent(d/5-1,y),a=p+(s[d+1]-p)*y,h=f+(s[d+2]-f)*y,l=g+(s[d+3]-g)*y,u=m+(s[d+4]-m)*y}var x=t.slots[this.slotIndex];1>o?(x.r+=(a-x.r)*o,x.g+=(h-x.g)*o,x.b+=(l-x.b)*o,x.a+=(u-x.a)*o):(x.r=a,x.g=h,x.b=l,x.a=u)}}},i.AttachmentTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.attachmentNames=[],this.attachmentNames.length=t},i.AttachmentTimeline.prototype={slotIndex:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=r>=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;if(!(n[o]r)this.apply(t,e,Number.MAX_VALUE,n,o),e=-1;else if(e>=s[a-1])return;if(!(r0&&s[h-1]==l;)h--}for(var u=this.events;a>h&&r>=s[h];h++)n.push(u[h])}}}},i.DrawOrderTimeline=function(t){this.frames=[],this.frames.length=t,this.drawOrders=[],this.drawOrders.length=t},i.DrawOrderTimeline.prototype={getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},apply:function(t,e,r){var n=this.frames;if(!(r=n[n.length-1]?n.length-1:i.Animation.binarySearch1(n,r)-1;var s=t.drawOrder,a=(t.slots,this.drawOrders[o]);if(a)for(var h=0,l=a.length;l>h;h++)s[h]=a[h]}}},i.FfdTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=t,this.frameVertices=[],this.frameVertices.length=t},i.FfdTimeline.prototype={slotIndex:0,attachment:0,getFrameCount:function(){return this.frames.length},setFrame:function(t,e,i){this.frames[t]=e,this.frameVertices[t]=i},apply:function(t,e,r,n,o){var s=t.slots[this.slotIndex];if(s.attachment==this.attachment){var a=this.frames;if(!(r=a[a.length-1]){var c=h[a.length-1];if(1>o)for(var d=0;l>d;d++)u[d]+=(c[d]-u[d])*o;else for(var d=0;l>d;d++)u[d]=c[d]}else{var p=i.Animation.binarySearch1(a,r),f=a[p],g=1-(r-f)/(a[p-1]-f);g=this.curves.getCurvePercent(p-1,0>g?0:g>1?1:g);var m=h[p-1],v=h[p];if(1>o)for(var d=0;l>d;d++){var y=m[d];u[d]+=(y+(v[d]-y)*g-u[d])*o}else for(var d=0;l>d;d++){var y=m[d];u[d]=y+(v[d]-y)*g}}}}}},i.IkConstraintTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=3*t},i.IkConstraintTimeline.prototype={ikConstraintIndex:0,getFrameCount:function(){return this.frames.length/3},setFrame:function(t,e,i,r){t*=3,this.frames[t]=e,this.frames[t+1]=i,this.frames[t+2]=r},apply:function(t,e,r,n,o){var s=this.frames;if(!(r=s[s.length-3])return a.mix+=(s[s.length-2]-a.mix)*o,void(a.bendDirection=s[s.length-1]);var h=i.Animation.binarySearch(s,r,3),l=s[h+-2],u=s[h],c=1-(r-u)/(s[h+-3]-u);c=this.curves.getCurvePercent(h/3-1,c);var d=l+(s[h+1]-l)*c;a.mix+=(d-a.mix)*o,a.bendDirection=s[h+-1]}}},i.FlipXTimeline=function(t){this.curves=new i.Curves(t),this.frames=[],this.frames.length=2*t},i.FlipXTimeline.prototype={boneIndex:0,getFrameCount:function(){return this.frames.length/2},setFrame:function(t,e,i){t*=2,this.frames[t]=e,this.frames[t+1]=i?1:0},apply:function(t,e,r){var n=this.frames;if(rr&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]r&&this.apply(t,e,Number.MAX_VALUE,null,0));e>r&&(e=-1);var o=(r>=n[n.length-2]?n.length:i.Animation.binarySearch(n,r,2))-2;n[o]i;i++)if(e[i].name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return slot[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].name==t)return i;return-1},findSkin:function(t){for(var e=this.skins,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findEvent:function(t){for(var e=this.events,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findAnimation:function(t){for(var e=this.animations,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null}},i.Skeleton=function(t){this.data=t,this.bones=[];for(var e=0,r=t.bones.length;r>e;e++){var n=t.bones[e],o=n.parent?this.bones[t.bones.indexOf(n.parent)]:null;this.bones.push(new i.Bone(n,this,o))}this.slots=[],this.drawOrder=[];for(var e=0,r=t.slots.length;r>e;e++){var s=t.slots[e],a=this.bones[t.bones.indexOf(s.boneData)],h=new i.Slot(s,a);this.slots.push(h),this.drawOrder.push(e)}this.ikConstraints=[];for(var e=0,r=t.ikConstraints.length;r>e;e++)this.ikConstraints.push(new i.IkConstraint(t.ikConstraints[e],this));this.boneCache=[],this.updateCache()},i.Skeleton.prototype={x:0,y:0,skin:null,r:1,g:1,b:1,a:1,time:0,flipX:!1,flipY:!1,updateCache:function(){var t=this.ikConstraints,e=t.length,i=e+1,r=this.boneCache; +r.length>i&&(r.length=i);for(var n=0,o=r.length;o>n;n++)r[n].length=0;for(;r.lengthn;n++){var h=a[n],l=h;do{for(var u=0;e>u;u++)for(var c=t[u],d=c.bones[0],p=c.bones[c.bones.length-1];;){if(l==p){r[u].push(h),r[u+1].push(h);continue t}if(p==d)break;p=p.parent}l=l.parent}while(l);s[s.length]=h}},updateWorldTransform:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++){var r=t[e];r.rotationIK=r.rotation}for(var e=0,n=this.boneCache.length-1;;){for(var o=this.boneCache[e],s=0,a=o.length;a>s;s++)o[s].updateWorldTransform();if(e==n)break;this.ikConstraints[e].apply(),e++}},setToSetupPose:function(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()},setBonesToSetupPose:function(){for(var t=this.bones,e=0,i=t.length;i>e;e++)t[e].setToSetupPose();for(var r=this.ikConstraints,e=0,i=r.length;i>e;e++){var n=r[e];n.bendDirection=n.data.bendDirection,n.mix=n.data.mix}},setSlotsToSetupPose:function(){for(var t=this.slots,e=0,i=t.length;i>e;e++)t[e].setToSetupPose(e);this.resetDrawOrder()},getRootBone:function(){return this.bones.length?this.bones[0]:null},findBone:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findBoneIndex:function(t){for(var e=this.bones,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},findSlot:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},findSlotIndex:function(t){for(var e=this.slots,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return i;return-1},setSkinByName:function(t){var e=this.data.findSkin(t);if(!e)throw"Skin not found: "+t;this.setSkin(e)},setSkin:function(t){if(t)if(this.skin)t._attachAll(this,this.skin);else for(var e=this.slots,i=0,r=e.length;r>i;i++){var n=e[i],o=n.data.attachmentName;if(o){var s=t.getAttachment(i,o);s&&n.setAttachment(s)}}this.skin=t},getAttachmentBySlotName:function(t,e){return this.getAttachmentBySlotIndex(this.data.findSlotIndex(t),e)},getAttachmentBySlotIndex:function(t,e){if(this.skin){var i=this.skin.getAttachment(t,e);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(t,e):null},setAttachment:function(t,e){for(var i=this.slots,r=0,n=i.length;n>r;r++){var o=i[r];if(o.data.name==t){var s=null;if(e&&(s=this.getAttachmentBySlotIndex(r,e),!s))throw"Attachment not found: "+e+", for slot: "+t;return void o.setAttachment(s)}}throw"Slot not found: "+t},findIkConstraint:function(t){for(var e=this.ikConstraints,i=0,r=e.length;r>i;i++)if(e[i].data.name==t)return e[i];return null},update:function(t){this.time+=t},resetDrawOrder:function(){for(var t=0,e=this.drawOrder.length;e>t;t++)this.drawOrder[t]=t}},i.EventData=function(t){this.name=t},i.EventData.prototype={intValue:0,floatValue:0,stringValue:null},i.Event=function(t){this.data=t},i.Event.prototype={intValue:0,floatValue:0,stringValue:null},i.AttachmentType={region:0,boundingbox:1,mesh:2,skinnedmesh:3},i.RegionAttachment=function(t){this.name=t,this.offset=[],this.offset.length=8,this.uvs=[],this.uvs.length=8},i.RegionAttachment.prototype={type:i.AttachmentType.region,x:0,y:0,rotation:0,scaleX:1,scaleY:1,width:0,height:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,setUVs:function(t,e,i,r,n){var o=this.uvs;n?(o[2]=t,o[3]=r,o[4]=t,o[5]=e,o[6]=i,o[7]=e,o[0]=i,o[1]=r):(o[0]=t,o[1]=r,o[2]=t,o[3]=e,o[4]=i,o[5]=e,o[6]=i,o[7]=r)},updateOffset:function(){var t=this.width/this.regionOriginalWidth*this.scaleX,e=this.height/this.regionOriginalHeight*this.scaleY,r=-this.width/2*this.scaleX+this.regionOffsetX*t,n=-this.height/2*this.scaleY+this.regionOffsetY*e,o=r+this.regionWidth*t,s=n+this.regionHeight*e,a=this.rotation*i.degRad,h=Math.cos(a),l=Math.sin(a),u=r*h+this.x,c=r*l,d=n*h+this.y,p=n*l,f=o*h+this.x,g=o*l,m=s*h+this.y,v=s*l,y=this.offset;y[0]=u-p,y[1]=d+c,y[2]=u-v,y[3]=m+c,y[4]=f-v,y[5]=m+g,y[6]=f-p,y[7]=d+g},computeVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.offset;r[0]=h[0]*n+h[1]*o+t,r[1]=h[0]*s+h[1]*a+e,r[2]=h[2]*n+h[3]*o+t,r[3]=h[2]*s+h[3]*a+e,r[4]=h[4]*n+h[5]*o+t,r[5]=h[4]*s+h[5]*a+e,r[6]=h[6]*n+h[7]*o+t,r[7]=h[6]*s+h[7]*a+e}},i.MeshAttachment=function(t){this.name=t},i.MeshAttachment.prototype={type:i.AttachmentType.mesh,vertices:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n=i.bone;t+=n.worldX,e+=n.worldY;var o=n.m00,s=n.m01,a=n.m10,h=n.m11,l=this.vertices,u=l.length;i.attachmentVertices.length==u&&(l=i.attachmentVertices);for(var c=0;u>c;c+=2){var d=l[c],p=l[c+1];r[c]=d*o+p*s+t,r[c+1]=d*a+p*h+e}}},i.SkinnedMeshAttachment=function(t){this.name=t},i.SkinnedMeshAttachment.prototype={type:i.AttachmentType.skinnedmesh,bones:null,weights:null,uvs:null,regionUVs:null,triangles:null,hullLength:0,r:1,g:1,b:1,a:1,path:null,rendererObject:null,regionU:0,regionV:0,regionU2:0,regionV2:0,regionRotate:!1,regionOffsetX:0,regionOffsetY:0,regionWidth:0,regionHeight:0,regionOriginalWidth:0,regionOriginalHeight:0,edges:null,width:0,height:0,updateUVs:function(){var t=this.regionU2-this.regionU,e=this.regionV2-this.regionV,r=this.regionUVs.length;if(this.uvs&&this.uvs.length==r||(this.uvs=new i.Float32Array(r)),this.regionRotate)for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n+1]*t,this.uvs[n+1]=this.regionV+e-this.regionUVs[n]*e;else for(var n=0;r>n;n+=2)this.uvs[n]=this.regionU+this.regionUVs[n]*t,this.uvs[n+1]=this.regionV+this.regionUVs[n+1]*e},computeWorldVertices:function(t,e,i,r){var n,o,s,a,h,l,u,c=i.bone.skeleton.bones,d=this.weights,p=this.bones,f=0,g=0,m=0,v=0,y=p.length;if(i.attachmentVertices.length)for(var x=i.attachmentVertices;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3,v+=2)a=c[p[g]],h=d[m]+x[v],l=d[m+1]+x[v+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}else for(;y>g;f+=2){for(o=0,s=0,n=p[g++]+g;n>g;g++,m+=3)a=c[p[g]],h=d[m],l=d[m+1],u=d[m+2],o+=(h*a.m00+l*a.m01+a.worldX)*u,s+=(h*a.m10+l*a.m11+a.worldY)*u;r[f]=o+t,r[f+1]=s+e}}},i.BoundingBoxAttachment=function(t){this.name=t,this.vertices=[]},i.BoundingBoxAttachment.prototype={type:i.AttachmentType.boundingbox,computeWorldVertices:function(t,e,i,r){t+=i.worldX,e+=i.worldY;for(var n=i.m00,o=i.m01,s=i.m10,a=i.m11,h=this.vertices,l=0,u=h.length;u>l;l+=2){var c=h[l],d=h[l+1];r[l]=c*n+d*o+t,r[l+1]=c*s+d*a+e}}},i.AnimationStateData=function(t){this.skeletonData=t,this.animationToMixTime={}},i.AnimationStateData.prototype={defaultMix:0,setMixByName:function(t,e,i){var r=this.skeletonData.findAnimation(t);if(!r)throw"Animation not found: "+t;var n=this.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;this.setMix(r,n,i)},setMix:function(t,e,i){this.animationToMixTime[t.name+":"+e.name]=i},getMix:function(t,e){var i=t.name+":"+e.name;return this.animationToMixTime.hasOwnProperty(i)?this.animationToMixTime[i]:this.defaultMix}},i.TrackEntry=function(){},i.TrackEntry.prototype={next:null,previous:null,animation:null,loop:!1,delay:0,time:0,lastTime:-1,endTime:0,timeScale:1,mixTime:0,mixDuration:0,mix:1,onStart:null,onEnd:null,onComplete:null,onEvent:null},i.AnimationState=function(t){this.data=t,this.tracks=[],this.events=[]},i.AnimationState.prototype={onStart:null,onEnd:null,onComplete:null,onEvent:null,timeScale:1,update:function(t){t*=this.timeScale;for(var e=0;e=0&&this.setCurrent(e,n)):!i.loop&&i.lastTime>=i.endTime&&this.clearTrack(e)}}},apply:function(t){t.resetDrawOrder();for(var e=0;eo&&(r=o);var a=i.previous;if(a){var h=a.time;!a.loop&&h>a.endTime&&(h=a.endTime),a.animation.apply(t,h,h,a.loop,null);var l=i.mixTime/i.mixDuration*i.mix;l>=1&&(l=1,i.previous=null),i.animation.mix(t,i.lastTime,r,s,this.events,l)}else 1==i.mix?i.animation.apply(t,i.lastTime,r,s,this.events):i.animation.mix(t,i.lastTime,r,s,this.events,i.mix);for(var u=0,c=this.events.length;c>u;u++){var d=this.events[u];i.onEvent&&i.onEvent(e,d),this.onEvent&&this.onEvent(e,d)}if(s?n%o>r%o:o>n&&r>=o){var p=Math.floor(r/o);i.onComplete&&i.onComplete(e,p),this.onComplete&&this.onComplete(e,p)}i.lastTime=i.time}}},clearTracks:function(){for(var t=0,e=this.tracks.length;e>t;t++)this.clearTrack(t);this.tracks.length=0},clearTrack:function(t){if(!(t>=this.tracks.length)){var e=this.tracks[t];e&&(e.onEnd&&e.onEnd(t),this.onEnd&&this.onEnd(t),this.tracks[t]=null)}},_expandToIndex:function(t){if(t=this.tracks.length;)this.tracks.push(null);return null},setCurrent:function(t,e){var i=this._expandToIndex(t);if(i){var r=i.previous;i.previous=null,i.onEnd&&i.onEnd(t),this.onEnd&&this.onEnd(t),e.mixDuration=this.data.getMix(i.animation,e.animation),e.mixDuration>0&&(e.mixTime=0,e.previous=r&&i.mixTime/i.mixDuration<.5?r:i)}this.tracks[t]=e,e.onStart&&e.onStart(t),this.onStart&&this.onStart(t)},setAnimationByName:function(t,e,i){var r=this.data.skeletonData.findAnimation(e);if(!r)throw"Animation not found: "+e;return this.setAnimation(t,r,i)},setAnimation:function(t,e,r){var n=new i.TrackEntry;return n.animation=e,n.loop=r,n.endTime=e.duration,this.setCurrent(t,n),n},addAnimationByName:function(t,e,i,r){var n=this.data.skeletonData.findAnimation(e);if(!n)throw"Animation not found: "+e;return this.addAnimation(t,n,i,r)},addAnimation:function(t,e,r,n){var o=new i.TrackEntry;o.animation=e,o.loop=r,o.endTime=e.duration;var s=this._expandToIndex(t);if(s){for(;s.next;)s=s.next;s.next=o}else this.tracks[t]=o;return 0>=n&&(s?n+=s.endTime-this.data.getMix(s.animation,e):n=0),o.delay=n,o},getCurrent:function(t){return t>=this.tracks.length?null:this.tracks[t]}},i.SkeletonJson=function(t){this.attachmentLoader=t},i.SkeletonJson.prototype={scale:1,readSkeletonData:function(t,e){var r=new i.SkeletonData;r.name=e;var n=t.skeleton;n&&(r.hash=n.hash,r.version=n.spine,r.width=n.width||0,r.height=n.height||0);for(var o=t.bones,s=0,a=o.length;a>s;s++){var h=o[s],l=null;if(h.parent&&(l=r.findBone(h.parent),!l))throw"Parent bone not found: "+h.parent;var u=new i.BoneData(h.name,l);u.length=(h.length||0)*this.scale,u.x=(h.x||0)*this.scale,u.y=(h.y||0)*this.scale,u.rotation=h.rotation||0,u.scaleX=h.hasOwnProperty("scaleX")?h.scaleX:1,u.scaleY=h.hasOwnProperty("scaleY")?h.scaleY:1,u.inheritScale=h.hasOwnProperty("inheritScale")?h.inheritScale:!0,u.inheritRotation=h.hasOwnProperty("inheritRotation")?h.inheritRotation:!0,r.bones.push(u)}var c=t.ik;if(c)for(var s=0,a=c.length;a>s;s++){for(var d=c[s],p=new i.IkConstraintData(d.name),o=d.bones,f=0,g=o.length;g>f;f++){var m=r.findBone(o[f]);if(!m)throw"IK bone not found: "+o[f];p.bones.push(m)}if(p.target=r.findBone(d.target),!p.target)throw"Target bone not found: "+d.target;p.bendDirection=!d.hasOwnProperty("bendPositive")||d.bendPositive?1:-1,p.mix=d.hasOwnProperty("mix")?d.mix:1,r.ikConstraints.push(p)}for(var v=t.slots,s=0,a=v.length;a>s;s++){var y=v[s],u=r.findBone(y.bone);if(!u)throw"Slot bone not found: "+y.bone;var x=new i.SlotData(y.name,u),b=y.color;b&&(x.r=this.toColor(b,0),x.g=this.toColor(b,1),x.b=this.toColor(b,2),x.a=this.toColor(b,3)),x.attachmentName=y.attachment,x.additiveBlending=y.additive&&"true"==y.additive,r.slots.push(x)}var w=t.skins;for(var T in w)if(w.hasOwnProperty(T)){var S=w[T],C=new i.Skin(T);for(var E in S)if(S.hasOwnProperty(E)){var A=r.findSlotIndex(E),_=S[E];for(var M in _)if(_.hasOwnProperty(M)){var L=this.readAttachment(C,M,_[M]);L&&C.addAttachment(A,M,L)}}r.skins.push(C),"default"==C.name&&(r.defaultSkin=C)}var R=t.events;for(var P in R)if(R.hasOwnProperty(P)){var F=R[P],B=new i.EventData(P);B.intValue=F["int"]||0,B.floatValue=F["float"]||0,B.stringValue=F.string||null,r.events.push(B)}var I=t.animations;for(var O in I)I.hasOwnProperty(O)&&this.readAnimation(O,I[O],r);return r},readAttachment:function(t,e,r){e=r.name||e;var n=i.AttachmentType[r.type||"region"],o=r.path||e,s=this.scale;if(n==i.AttachmentType.region){var a=this.attachmentLoader.newRegionAttachment(t,e,o);if(!a)return null;a.path=o,a.x=(r.x||0)*s,a.y=(r.y||0)*s,a.scaleX=r.hasOwnProperty("scaleX")?r.scaleX:1,a.scaleY=r.hasOwnProperty("scaleY")?r.scaleY:1,a.rotation=r.rotation||0,a.width=(r.width||0)*s,a.height=(r.height||0)*s;var h=r.color;return h&&(a.r=this.toColor(h,0),a.g=this.toColor(h,1),a.b=this.toColor(h,2),a.a=this.toColor(h,3)),a.updateOffset(),a}if(n==i.AttachmentType.mesh){var l=this.attachmentLoader.newMeshAttachment(t,e,o);return l?(l.path=o,l.vertices=this.getFloatArray(r,"vertices",s),l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=this.getFloatArray(r,"uvs",1),l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l):null}if(n==i.AttachmentType.skinnedmesh){var l=this.attachmentLoader.newSkinnedMeshAttachment(t,e,o);if(!l)return null;l.path=o;for(var u=this.getFloatArray(r,"uvs",1),c=this.getFloatArray(r,"vertices",1),d=[],p=[],f=0,g=c.length;g>f;){var m=0|c[f++];p[p.length]=m;for(var v=f+4*m;v>f;)p[p.length]=c[f],d[d.length]=c[f+1]*s,d[d.length]=c[f+2]*s,d[d.length]=c[f+3],f+=4}return l.bones=p,l.weights=d,l.triangles=this.getIntArray(r,"triangles"),l.regionUVs=u,l.updateUVs(),h=r.color,h&&(l.r=this.toColor(h,0),l.g=this.toColor(h,1),l.b=this.toColor(h,2),l.a=this.toColor(h,3)),l.hullLength=2*(r.hull||0),r.edges&&(l.edges=this.getIntArray(r,"edges")),l.width=(r.width||0)*s,l.height=(r.height||0)*s,l}if(n==i.AttachmentType.boundingbox){for(var y=this.attachmentLoader.newBoundingBoxAttachment(t,e),c=r.vertices,f=0,g=c.length;g>f;f++)y.vertices.push(c[f]*s);return y}throw"Unknown attachment type: "+n},readAnimation:function(t,e,r){var n=[],o=0,s=e.slots;for(var a in s)if(s.hasOwnProperty(a)){var h=s[a],l=r.findSlotIndex(a);for(var u in h)if(h.hasOwnProperty(u)){var c=h[u];if("color"==u){var d=new i.ColorTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],v=m.color,y=this.toColor(v,0),x=this.toColor(v,1),b=this.toColor(v,2),w=this.toColor(v,3);d.setFrame(p,m.time,y,x,b,w),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[5*d.getFrameCount()-5])}else{if("attachment"!=u)throw"Invalid timeline type for a slot: "+u+" ("+a+")";var d=new i.AttachmentTimeline(c.length);d.slotIndex=l;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p++,m.time,m.name)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}}}var T=e.bones;for(var S in T)if(T.hasOwnProperty(S)){var C=r.findBoneIndex(S);if(-1==C)throw"Bone not found: "+S;var E=T[S];for(var u in E)if(E.hasOwnProperty(u)){var c=E[u];if("rotate"==u){var d=new i.RotateTimeline(c.length);d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m.angle),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}else if("translate"==u||"scale"==u){var d,A=1;"scale"==u?d=new i.ScaleTimeline(c.length):(d=new i.TranslateTimeline(c.length),A=this.scale),d.boneIndex=C;for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],_=(m.x||0)*A,M=(m.y||0)*A;d.setFrame(p,m.time,_,M),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.getFrameCount()-3])}else{if("flipX"!=u&&"flipY"!=u)throw"Invalid timeline type for a bone: "+u+" ("+S+")";var _="flipX"==u,d=_?new i.FlipXTimeline(c.length):new i.FlipYTimeline(c.length);d.boneIndex=C;for(var L=_?"x":"y",p=0,f=0,g=c.length;g>f;f++){var m=c[f];d.setFrame(p,m.time,m[L]||!1),p++}n.push(d),o=Math.max(o,d.frames[2*d.getFrameCount()-2])}}}var R=e.ik;for(var P in R)if(R.hasOwnProperty(P)){var F=r.findIkConstraint(P),c=R[P],d=new i.IkConstraintTimeline(c.length);d.ikConstraintIndex=r.ikConstraints.indexOf(F);for(var p=0,f=0,g=c.length;g>f;f++){var m=c[f],B=m.hasOwnProperty("mix")?m.mix:1,I=!m.hasOwnProperty("bendPositive")||m.bendPositive?1:-1;d.setFrame(p,m.time,B,I),this.readCurve(d,p,m),p++}n.push(d),o=Math.max(o,d.frames[3*d.frameCount-3])}var O=e.ffd;for(var D in O){var k=r.findSkin(D),h=O[D];for(a in h){var l=r.findSlotIndex(a),G=h[a];for(var N in G){var c=G[N],d=new i.FfdTimeline(c.length),U=k.getAttachment(l,N);if(!U)throw"FFD attachment not found: "+N;d.slotIndex=l,d.attachment=U;var j,V=U.type==i.AttachmentType.mesh;j=V?U.vertices.length:U.weights.length/3*2;for(var p=0,f=0,g=c.length;g>f;f++){var W,m=c[f];if(m.vertices){var Y=m.vertices,W=[];W.length=j;var H=m.offset||0,X=Y.length;if(1==this.scale)for(var z=0;X>z;z++)W[z+H]=Y[z];else for(var z=0;X>z;z++)W[z+H]=Y[z]*this.scale;if(V)for(var q=U.vertices,z=0,X=W.length;X>z;z++)W[z]+=q[z]}else V?W=U.vertices:(W=[],W.length=j);d.setFrame(p,m.time,W),this.readCurve(d,p,m),p++}n[n.length]=d,o=Math.max(o,d.frames[d.frameCount-1])}}}var Q=e.drawOrder;if(Q||(Q=e.draworder),Q){for(var d=new i.DrawOrderTimeline(Q.length),K=r.slots.length,p=0,f=0,g=Q.length;g>f;f++){var $=Q[f],J=null;if($.offsets){J=[],J.length=K;for(var z=K-1;z>=0;z--)J[z]=-1;var Z=$.offsets,te=[];te.length=K-Z.length;for(var ee=0,ie=0,z=0,X=Z.length;X>z;z++){var re=Z[z],l=r.findSlotIndex(re.slot);if(-1==l)throw"Slot not found: "+re.slot;for(;ee!=l;)te[ie++]=ee++;J[ee+re.offset]=ee++}for(;K>ee;)te[ie++]=ee++;for(var z=K-1;z>=0;z--)-1==J[z]&&(J[z]=te[--ie])}d.setFrame(p++,$.time,J)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}var ne=e.events;if(ne){for(var d=new i.EventTimeline(ne.length),p=0,f=0,g=ne.length;g>f;f++){var oe=ne[f],se=r.findEvent(oe.name);if(!se)throw"Event not found: "+oe.name;var ae=new i.Event(se);ae.intValue=oe.hasOwnProperty("int")?oe["int"]:se.intValue,ae.floatValue=oe.hasOwnProperty("float")?oe["float"]:se.floatValue,ae.stringValue=oe.hasOwnProperty("string")?oe.string:se.stringValue,d.setFrame(p++,oe.time,ae)}n.push(d),o=Math.max(o,d.frames[d.getFrameCount()-1])}r.animations.push(new i.Animation(t,n,o))},readCurve:function(t,e,i){var r=i.curve;r?"stepped"==r?t.curves.setStepped(e):r instanceof Array&&t.curves.setCurve(e,r[0],r[1],r[2],r[3]):t.curves.setLinear(e)},toColor:function(t,e){if(8!=t.length)throw"Color hexidecimal length must be 8, recieved: "+t;return parseInt(t.substring(2*e,2*e+2),16)/255},getFloatArray:function(t,e,r){var n=t[e],o=new i.Float32Array(n.length),s=0,a=n.length;if(1==r)for(;a>s;s++)o[s]=n[s];else for(;a>s;s++)o[s]=n[s]*r;return o},getIntArray:function(t,e){for(var r=t[e],n=new i.Uint16Array(r.length),o=0,s=r.length;s>o;o++)n[o]=0|r[o];return n}},i.Atlas=function(t,e){this.textureLoader=e,this.pages=[],this.regions=[];var r=new i.AtlasReader(t),n=[];n.length=4;for(var o=null;;){var s=r.readLine();if(null===s)break;if(s=r.trim(s),s.length)if(o){var a=new i.AtlasRegion;a.name=s,a.page=o,a.rotate="true"==r.readValue(),r.readTuple(n);var h=parseInt(n[0]),l=parseInt(n[1]);r.readTuple(n);var u=parseInt(n[0]),c=parseInt(n[1]);a.u=h/o.width,a.v=l/o.height,a.rotate?(a.u2=(h+c)/o.width,a.v2=(l+u)/o.height):(a.u2=(h+u)/o.width,a.v2=(l+c)/o.height),a.x=h,a.y=l,a.width=Math.abs(u),a.height=Math.abs(c),4==r.readTuple(n)&&(a.splits=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],4==r.readTuple(n)&&(a.pads=[parseInt(n[0]),parseInt(n[1]),parseInt(n[2]),parseInt(n[3])],r.readTuple(n))),a.originalWidth=parseInt(n[0]),a.originalHeight=parseInt(n[1]),r.readTuple(n),a.offsetX=parseInt(n[0]),a.offsetY=parseInt(n[1]),a.index=parseInt(r.readValue()),this.regions.push(a)}else{o=new i.AtlasPage,o.name=s,2==r.readTuple(n)&&(o.width=parseInt(n[0]),o.height=parseInt(n[1]),r.readTuple(n)),o.format=i.Atlas.Format[n[0]],r.readTuple(n),o.minFilter=i.Atlas.TextureFilter[n[0]],o.magFilter=i.Atlas.TextureFilter[n[1]];var d=r.readValue();o.uWrap=i.Atlas.TextureWrap.clampToEdge,o.vWrap=i.Atlas.TextureWrap.clampToEdge,"x"==d?o.uWrap=i.Atlas.TextureWrap.repeat:"y"==d?o.vWrap=i.Atlas.TextureWrap.repeat:"xy"==d&&(o.uWrap=o.vWrap=i.Atlas.TextureWrap.repeat),e.load(o,s,this),this.pages.push(o)}else o=null}},i.Atlas.prototype={findRegion:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++)if(e[i].name==t)return e[i];return null},dispose:function(){for(var t=this.pages,e=0,i=t.length;i>e;e++)this.textureLoader.unload(t[e].rendererObject)},updateUVs:function(t){for(var e=this.regions,i=0,r=e.length;r>i;i++){var n=e[i];n.page==t&&(n.u=n.x/t.width,n.v=n.y/t.height,n.rotate?(n.u2=(n.x+n.height)/t.width,n.v2=(n.y+n.width)/t.height):(n.u2=(n.x+n.width)/t.width,n.v2=(n.y+n.height)/t.height))}}},i.Atlas.Format={alpha:0,intensity:1,luminanceAlpha:2,rgb565:3,rgba4444:4,rgb888:5,rgba8888:6},i.Atlas.TextureFilter={nearest:0,linear:1,mipMap:2,mipMapNearestNearest:3,mipMapLinearNearest:4,mipMapNearestLinear:5,mipMapLinearLinear:6},i.Atlas.TextureWrap={mirroredRepeat:0,clampToEdge:1,repeat:2},i.AtlasPage=function(){},i.AtlasPage.prototype={name:null,format:null,minFilter:null,magFilter:null,uWrap:null,vWrap:null,rendererObject:null,width:0,height:0},i.AtlasRegion=function(){},i.AtlasRegion.prototype={page:null,name:null,x:0,y:0,width:0,height:0,u:0,v:0,u2:0,v2:0,offsetX:0,offsetY:0,originalWidth:0,originalHeight:0,index:0,rotate:!1,splits:null,pads:null},i.AtlasReader=function(t){this.lines=t.split(/\r\n|\r|\n/)},i.AtlasReader.prototype={index:0,trim:function(t){return t.replace(/^\s+|\s+$/g,"")},readLine:function(){return this.index>=this.lines.length?null:this.lines[this.index++]},readValue:function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw"Invalid line: "+t;return this.trim(t.substring(e+1))},readTuple:function(t){var e=this.readLine(),i=e.indexOf(":");if(-1==i)throw"Invalid line: "+e;for(var r=0,n=i+1;3>r;r++){var o=e.indexOf(",",n);if(-1==o)break;t[r]=this.trim(e.substr(n,o-n)),n=o+1}return t[r]=this.trim(e.substring(n)),r+1}},i.AtlasAttachmentLoader=function(t){this.atlas=t},i.AtlasAttachmentLoader.prototype={newRegionAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (region attachment: "+e+")";var o=new i.RegionAttachment(e);return o.rendererObject=n,o.setUVs(n.u,n.v,n.u2,n.v2,n.rotate),o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (mesh attachment: "+e+")";var o=new i.MeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newSkinnedMeshAttachment:function(t,e,r){var n=this.atlas.findRegion(r);if(!n)throw"Region not found in atlas: "+r+" (skinned mesh attachment: "+e+")";var o=new i.SkinnedMeshAttachment(e);return o.rendererObject=n,o.regionU=n.u,o.regionV=n.v,o.regionU2=n.u2,o.regionV2=n.v2,o.regionRotate=n.rotate,o.regionOffsetX=n.offsetX,o.regionOffsetY=n.offsetY,o.regionWidth=n.width,o.regionHeight=n.height,o.regionOriginalWidth=n.originalWidth,o.regionOriginalHeight=n.originalHeight,o},newBoundingBoxAttachment:function(t,e){return new i.BoundingBoxAttachment(e)}},i.SkeletonBounds=function(){this.polygonPool=[],this.polygons=[],this.boundingBoxes=[]},i.SkeletonBounds.prototype={minX:0,minY:0,maxX:0,maxY:0,update:function(t,e){var r=t.slots,n=r.length,o=t.x,s=t.y,a=this.boundingBoxes,h=this.polygonPool,l=this.polygons;a.length=0;for(var u=0,c=l.length;c>u;u++)h.push(l[u]);l.length=0;for(var u=0;n>u;u++){var d=r[u],p=d.attachment;if(p.type==i.AttachmentType.boundingbox){a.push(p);var f,g=h.length;g>0?(f=h[g-1],h.splice(g-1,1)):f=[],l.push(f),f.length=p.vertices.length,p.computeWorldVertices(o,s,d.bone,f)}}e&&this.aabbCompute()},aabbCompute:function(){for(var t=this.polygons,e=Number.MAX_VALUE,i=Number.MAX_VALUE,r=Number.MIN_VALUE,n=Number.MIN_VALUE,o=0,s=t.length;s>o;o++)for(var a=t[o],h=0,l=a.length;l>h;h+=2){var u=a[h],c=a[h+1];e=Math.min(e,u),i=Math.min(i,c),r=Math.max(r,u),n=Math.max(n,c)}this.minX=e,this.minY=i,this.maxX=r,this.maxY=n},aabbContainsPoint:function(t,e){return t>=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},aabbIntersectsSegment:function(t,e,i,r){var n=this.minX,o=this.minY,s=this.maxX,a=this.maxY;if(n>=t&&n>=i||o>=e&&o>=r||t>=s&&i>=s||e>=a&&r>=a)return!1;var h=(r-e)/(i-t),l=h*(n-t)+e;if(l>o&&a>l)return!0;if(l=h*(s-t)+e,l>o&&a>l)return!0;var u=(o-e)/h+t;return u>n&&s>u?!0:(u=(a-e)/h+t,u>n&&s>u?!0:!1)},aabbIntersectsSkeleton:function(t){return this.minXt.minX&&this.minYt.minY},containsPoint:function(t,e){for(var i=this.polygons,r=0,n=i.length;n>r;r++)if(this.polygonContainsPoint(i[r],t,e))return this.boundingBoxes[r];return null},intersectsSegment:function(t,e,i,r){for(var n=this.polygons,o=0,s=n.length;s>o;o++)if(n[o].intersectsSegment(t,e,i,r))return this.boundingBoxes[o];return null},polygonContainsPoint:function(t,e,i){for(var r=t.length,n=r-2,o=!1,s=0;r>s;s+=2){var a=t[s+1],h=t[n+1];if(i>a&&h>=i||i>h&&a>=i){var l=t[s];l+(i-a)/(h-a)*(t[n]-l)c;c+=2){var d=t[c],p=t[c+1],f=l*p-u*d,g=l-d,m=u-p,v=s*m-a*g,y=(h*g-s*f)/v;if((y>=l&&d>=y||y>=d&&l>=y)&&(y>=e&&r>=y||y>=r&&e>=y)){var x=(h*m-a*f)/v;if((x>=u&&p>=x||x>=p&&u>=x)&&(x>=i&&n>=x||x>=n&&i>=x))return!0}l=d,u=p}return!1},getPolygon:function(t){var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},getWidth:function(){return this.maxX-this.minX},getHeight:function(){return this.maxY-this.minY}},i.Bone.yDown=!0,e.AnimCache={},e.SpineTextureLoader=function(t,i){e.EventTarget.call(this),this.basePath=t,this.crossorigin=i,this.loadingCount=0},e.SpineTextureLoader.prototype=e.SpineTextureLoader,e.SpineTextureLoader.prototype.load=function(t,i){if(t.rendererObject=e.BaseTexture.fromImage(this.basePath+"/"+i,this.crossorigin),!t.rendererObject.hasLoaded){var r=this;++r.loadingCount,t.rendererObject.addEventListener("loaded",function(){--r.loadingCount,r.dispatchEvent({type:"loadedBaseTexture",content:r})})}},e.SpineTextureLoader.prototype.unload=function(t){t.destroy(!0)},e.Spine=function(t){if(e.DisplayObjectContainer.call(this),this.spineData=e.AnimCache[t],!this.spineData)throw new Error("Spine data must be preloaded using PIXI.SpineLoader or PIXI.AssetLoader: "+t);this.skeleton=new i.Skeleton(this.spineData),this.skeleton.updateWorldTransform(),this.stateData=new i.AnimationStateData(this.spineData),this.state=new i.AnimationState(this.stateData),this.slotContainers=[];for(var r=0,n=this.skeleton.slots.length;n>r;r++){var o=this.skeleton.slots[r],s=o.attachment,a=new e.DisplayObjectContainer;if(this.slotContainers.push(a),this.addChild(a),s instanceof i.RegionAttachment){var h=s.rendererObject.name,l=this.createSprite(o,s);o.currentSprite=l,o.currentSpriteName=h,a.addChild(l)}else{if(!(s instanceof i.MeshAttachment))continue;var u=this.createMesh(o,s);o.currentMesh=u,o.currentMeshName=s.name,a.addChild(u)}}this.autoUpdate=!0},e.Spine.prototype=Object.create(e.DisplayObjectContainer.prototype),e.Spine.prototype.constructor=e.Spine,Object.defineProperty(e.Spine.prototype,"autoUpdate",{get:function(){return this.updateTransform===e.Spine.prototype.autoUpdateTransform},set:function(t){this.updateTransform=t?e.Spine.prototype.autoUpdateTransform:e.DisplayObjectContainer.prototype.updateTransform}}),e.Spine.prototype.update=function(t){this.state.update(t),this.state.apply(this.skeleton),this.skeleton.updateWorldTransform();for(var r=this.skeleton.drawOrder,n=this.skeleton.slots,o=0,s=r.length;s>o;o++)this.children[o]=this.slotContainers[r[o]];for(o=0,s=n.length;s>o;o++){var a=n[o],h=a.attachment,l=this.slotContainers[o];if(h){var u=h.type;if(u===i.AttachmentType.region){if(h.rendererObject&&(!a.currentSpriteName||a.currentSpriteName!==h.name)){var c=h.rendererObject.name;if(void 0!==a.currentSprite&&(a.currentSprite.visible=!1),a.sprites=a.sprites||{},void 0!==a.sprites[c])a.sprites[c].visible=!0;else{var d=this.createSprite(a,h);l.addChild(d)}a.currentSprite=a.sprites[c],a.currentSpriteName=c}var p=a.bone;l.position.x=p.worldX+h.x*p.m00+h.y*p.m01,l.position.y=p.worldY+h.x*p.m10+h.y*p.m11,l.scale.x=p.worldScaleX,l.scale.y=p.worldScaleY,l.rotation=-(a.bone.worldRotation*i.degRad),a.currentSprite.tint=e.rgb2hex([a.r,a.g,a.b])}else{if(u!==i.AttachmentType.skinnedmesh){l.visible=!1;continue}if(!a.currentMeshName||a.currentMeshName!==h.name){var f=h.name;if(void 0!==a.currentMesh&&(a.currentMesh.visible=!1),a.meshes=a.meshes||{},void 0!==a.meshes[f])a.meshes[f].visible=!0;else{var g=this.createMesh(a,h);l.addChild(g)}a.currentMesh=a.meshes[f],a.currentMeshName=f}h.computeWorldVertices(a.bone.skeleton.x,a.bone.skeleton.y,a,a.currentMesh.vertices)}l.visible=!0,l.alpha=a.a}else l.visible=!1}},e.Spine.prototype.autoUpdateTransform=function(){this.lastTime=this.lastTime||Date.now();var t=.001*(Date.now()-this.lastTime);this.lastTime=Date.now(),this.update(t),e.DisplayObjectContainer.prototype.updateTransform.call(this)},e.Spine.prototype.createSprite=function(t,r){var n=r.rendererObject,o=n.page.rendererObject,s=new e.Rectangle(n.x,n.y,n.rotate?n.height:n.width,n.rotate?n.width:n.height),a=new e.Texture(o,s),h=new e.Sprite(a),l=n.rotate?.5*Math.PI:0;return h.scale.set(n.width/n.originalWidth,n.height/n.originalHeight),h.rotation=l-r.rotation*i.degRad,h.anchor.x=h.anchor.y=.5,t.sprites=t.sprites||{},t.sprites[n.name]=h,h},e.Spine.prototype.createMesh=function(t,i){var r=i.rendererObject,n=r.page.rendererObject,o=new e.Texture(n),s=new e.Strip(o);return s.drawMode=e.Strip.DrawModes.TRIANGLES,s.canvasPadding=1.5,s.vertices=new e.Float32Array(i.uvs.length),s.uvs=i.uvs,s.indices=i.triangles,t.meshes=t.meshes||{},t.meshes[i.name]=s,s},e.BaseTextureCache={},e.BaseTextureCacheIdGenerator=0,e.BaseTexture=function(t,i){if(this.resolution=1,this.width=100,this.height=100,this.scaleMode=i||e.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=t,this._UID=e._UID++,this.premultipliedAlpha=!0,this._glTextures=[],this.mipmap=!1,this._dirty=[!0,!0,!0,!0],t){if((this.source.complete||this.source.getContext)&&this.source.width&&this.source.height)this.hasLoaded=!0,this.width=this.source.naturalWidth||this.source.width,this.height=this.source.naturalHeight||this.source.height,this.dirty();else{var r=this;this.source.onload=function(){r.hasLoaded=!0,r.width=r.source.naturalWidth||r.source.width,r.height=r.source.naturalHeight||r.source.height,r.dirty(),r.dispatchEvent({type:"loaded",content:r})},this.source.onerror=function(){r.dispatchEvent({type:"error",content:r})}}this.imageUrl=null,this._powerOf2=!1}},e.BaseTexture.prototype.constructor=e.BaseTexture,e.EventTarget.mixin(e.BaseTexture.prototype),e.BaseTexture.prototype.destroy=function(){this.imageUrl?(delete e.BaseTextureCache[this.imageUrl],delete e.TextureCache[this.imageUrl],this.imageUrl=null,navigator.isCocoonJS||(this.source.src="")):this.source&&this.source._pixiId&&delete e.BaseTextureCache[this.source._pixiId],this.source=null,this.unloadFromGPU() +},e.BaseTexture.prototype.updateSourceImage=function(t){this.hasLoaded=!1,this.source.src=null,this.source.src=t},e.BaseTexture.prototype.dirty=function(){for(var t=0;t=0;t--){var i=this._glTextures[t],r=e.glContexts[t];r&&i&&r.deleteTexture(i)}this._glTextures.length=0,this.dirty()},e.BaseTexture.fromImage=function(t,i,r){var n=e.BaseTextureCache[t];if(void 0===i&&-1===t.indexOf("data:")&&(i=!0),!n){var o=new Image;i&&(o.crossOrigin=""),o.src=t,n=new e.BaseTexture(o,r),n.imageUrl=t,e.BaseTextureCache[t]=n,-1!==t.indexOf(e.RETINA_PREFIX+".")&&(n.resolution=2)}return n},e.BaseTexture.fromCanvas=function(t,i){t._pixiId||(t._pixiId="canvas_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.BaseTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.TextureCache={},e.FrameCache={},e.TextureCacheIdGenerator=0,e.Texture=function(t,i,r,n){this.noFrame=!1,i||(this.noFrame=!0,i=new e.Rectangle(0,0,1,1)),t instanceof e.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=i,this.trim=n,this.valid=!1,this.requiresUpdate=!1,this._uvs=null,this.width=0,this.height=0,this.crop=r||new e.Rectangle(0,0,1,1),t.hasLoaded?(this.noFrame&&(i=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(i)):t.addEventListener("loaded",this.onBaseTextureLoaded.bind(this))},e.Texture.prototype.constructor=e.Texture,e.EventTarget.mixin(e.Texture.prototype),e.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;t.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new e.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame),this.dispatchEvent({type:"update",content:this})},e.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},e.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,!this.trim&&(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs()},e.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new e.TextureUvs);var t=this.crop,i=this.baseTexture.width,r=this.baseTexture.height;this._uvs.x0=t.x/i,this._uvs.y0=t.y/r,this._uvs.x1=(t.x+t.width)/i,this._uvs.y1=t.y/r,this._uvs.x2=(t.x+t.width)/i,this._uvs.y2=(t.y+t.height)/r,this._uvs.x3=t.x/i,this._uvs.y3=(t.y+t.height)/r},e.Texture.fromImage=function(t,i,r){var n=e.TextureCache[t];return n||(n=new e.Texture(e.BaseTexture.fromImage(t,i,r)),e.TextureCache[t]=n),n},e.Texture.fromFrame=function(t){var i=e.TextureCache[t];if(!i)throw new Error('The frameId "'+t+'" does not exist in the texture cache ');return i},e.Texture.fromCanvas=function(t,i){var r=e.BaseTexture.fromCanvas(t,i);return new e.Texture(r)},e.Texture.addTextureToCache=function(t,i){e.TextureCache[i]=t},e.Texture.removeTextureFromCache=function(t){var i=e.TextureCache[t];return delete e.TextureCache[t],delete e.BaseTextureCache[t],i},e.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},e.Texture.emptyTexture=new e.Texture(new e.BaseTexture),e.RenderTexture=function(t,i,r,n,o){if(this.width=t||100,this.height=i||100,this.resolution=o||1,this.frame=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.baseTexture=new e.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=n||e.scaleModes.DEFAULT,this.baseTexture.hasLoaded=!0,e.Texture.call(this,this.baseTexture,new e.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution)),this.renderer=r||e.defaultRenderer,this.renderer.type===e.WEBGL_RENDERER){var s=this.renderer.gl;this.baseTexture._dirty[s.id]=!1,this.textureBuffer=new e.FilterTexture(s,this.width,this.height,this.baseTexture.scaleMode),this.baseTexture._glTextures[s.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new e.Point(.5*this.width,.5*-this.height)}else this.render=this.renderCanvas,this.textureBuffer=new e.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this._updateUvs()},e.RenderTexture.prototype=Object.create(e.Texture.prototype),e.RenderTexture.prototype.constructor=e.RenderTexture,e.RenderTexture.prototype.resize=function(t,i,r){(t!==this.width||i!==this.height)&&(this.valid=t>0&&i>0,this.width=t,this.height=i,this.frame.width=this.crop.width=t*this.resolution,this.frame.height=this.crop.height=i*this.resolution,r&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===e.WEBGL_RENDERER&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},e.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===e.WEBGL_RENDERER&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},e.RenderTexture.prototype.renderWebGL=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),r.translate(0,2*this.projection.y),e&&r.append(e),r.scale(1,-1),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();var a=this.renderer.gl;a.viewport(0,0,this.width*this.resolution,this.height*this.resolution),a.bindFramebuffer(a.FRAMEBUFFER,this.textureBuffer.frameBuffer),i&&this.textureBuffer.clear(),this.renderer.spriteBatch.dirty=!0,this.renderer.renderDisplayObject(t,this.projection,this.textureBuffer.frameBuffer),this.renderer.spriteBatch.dirty=!0}},e.RenderTexture.prototype.renderCanvas=function(t,e,i){if(this.valid){var r=t.worldTransform;r.identity(),e&&r.append(e),t.worldAlpha=1;for(var n=t.children,o=0,s=n.length;s>o;o++)n[o].updateTransform();i&&this.textureBuffer.clear();var a=this.textureBuffer.context,h=this.renderer.resolution;this.renderer.resolution=this.resolution,this.renderer.renderDisplayObject(t,a),this.renderer.resolution=h}},e.RenderTexture.prototype.getImage=function(){var t=new Image;return t.src=this.getBase64(),t},e.RenderTexture.prototype.getBase64=function(){return this.getCanvas().toDataURL()},e.RenderTexture.prototype.getCanvas=function(){if(this.renderer.type===e.WEBGL_RENDERER){var t=this.renderer.gl,i=this.textureBuffer.width,r=this.textureBuffer.height,n=new Uint8Array(4*i*r);t.bindFramebuffer(t.FRAMEBUFFER,this.textureBuffer.frameBuffer),t.readPixels(0,0,i,r,t.RGBA,t.UNSIGNED_BYTE,n),t.bindFramebuffer(t.FRAMEBUFFER,null);var o=new e.CanvasBuffer(i,r),s=o.context.getImageData(0,0,i,r);return s.data.set(n),o.context.putImageData(s,0,0),o.canvas}return this.textureBuffer.canvas},e.RenderTexture.tempMatrix=new e.Matrix,e.VideoTexture=function(t,i){if(!t)throw new Error("No video source element specified.");(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),e.BaseTexture.call(this,t,i),this.autoUpdate=!1,this.updateBound=this._onUpdate.bind(this),t.complete||(this._onCanPlay=this.onCanPlay.bind(this),t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("play",this.onPlayStart.bind(this)),t.addEventListener("pause",this.onPlayStop.bind(this)))},e.VideoTexture.prototype=Object.create(e.BaseTexture.prototype),e.VideoTexture.constructor=e.VideoTexture,e.VideoTexture.prototype._onUpdate=function(){this.autoUpdate&&(window.requestAnimationFrame(this.updateBound),this.dirty())},e.VideoTexture.prototype.onPlayStart=function(){this.autoUpdate||(window.requestAnimationFrame(this.updateBound),this.autoUpdate=!0)},e.VideoTexture.prototype.onPlayStop=function(){this.autoUpdate=!1},e.VideoTexture.prototype.onCanPlay=function(){"canplaythrough"===event.type&&(this.hasLoaded=!0,this.source&&(this.source.removeEventListener("canplay",this._onCanPlay),this.source.removeEventListener("canplaythrough",this._onCanPlay),this.width=this.source.videoWidth,this.height=this.source.videoHeight,this.__loaded||(this.__loaded=!0,this.dispatchEvent({type:"loaded",content:this}))))},e.VideoTexture.prototype.destroy=function(){this.source&&this.source._pixiId&&(e.BaseTextureCache[this.source._pixiId]=null,delete e.BaseTextureCache[this.source._pixiId],this.source._pixiId=null,delete this.source._pixiId),e.BaseTexture.prototype.destroy.call(this)},e.VideoTexture.baseTextureFromVideo=function(t,i){t._pixiId||(t._pixiId="video_"+e.TextureCacheIdGenerator++);var r=e.BaseTextureCache[t._pixiId];return r||(r=new e.VideoTexture(t,i),e.BaseTextureCache[t._pixiId]=r),r},e.VideoTexture.textureFromVideo=function(t,i){var r=e.VideoTexture.baseTextureFromVideo(t,i);return new e.Texture(r)},e.VideoTexture.fromUrl=function(t,i){var r=document.createElement("video");return r.src=t,r.autoPlay=!0,r.play(),e.VideoTexture.textureFromVideo(r,i)},e.AssetLoader=function(t,i){this.assetURLs=t,this.crossorigin=i,this.loadersByType={jpg:e.ImageLoader,jpeg:e.ImageLoader,png:e.ImageLoader,gif:e.ImageLoader,webp:e.ImageLoader,json:e.JsonLoader,atlas:e.AtlasLoader,anim:e.SpineLoader,xml:e.BitmapFontLoader,fnt:e.BitmapFontLoader}},e.EventTarget.mixin(e.AssetLoader.prototype),e.AssetLoader.prototype.constructor=e.AssetLoader,e.AssetLoader.prototype._getDataType=function(t){var e="data:",i=t.slice(0,e.length).toLowerCase();if(i===e){var r=t.slice(e.length),n=r.indexOf(",");if(-1===n)return null;var o=r.slice(0,n).split(";")[0];return o&&"text/plain"!==o.toLowerCase()?o.split("/").pop().toLowerCase():"txt"}return null},e.AssetLoader.prototype.load=function(){function t(t){e.onAssetLoaded(t.data.content)}var e=this;this.loadCount=this.assetURLs.length;for(var i=0;i0?t.addEventListener("loadedBaseTexture",function(t){t.content.content.loadingCount<=0&&f.onLoaded()}):f.onLoaded()},p.load()}else this.onLoaded()},e.JsonLoader.prototype.onLoaded=function(){this.loaded=!0,this.dispatchEvent({type:"loaded",content:this})},e.JsonLoader.prototype.onError=function(){this.dispatchEvent({type:"error",content:this})},e.AtlasLoader=function(t,e){this.url=t,this.baseUrl=t.replace(/[^\/]*$/,""),this.crossorigin=e,this.loaded=!1},e.AtlasLoader.constructor=e.AtlasLoader,e.EventTarget.mixin(e.AtlasLoader.prototype),e.AtlasLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onAtlasLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/json"),this.ajaxRequest.send(null)},e.AtlasLoader.prototype.onAtlasLoaded=function(){if(4===this.ajaxRequest.readyState)if(200===this.ajaxRequest.status||-1===window.location.href.indexOf("http")){this.atlas={meta:{image:[]},frames:[]};var t=this.ajaxRequest.responseText.split(/\r?\n/),i=-3,r=0,n=null,o=!1,s=0,a=0,h=this.onLoaded.bind(this);for(s=0;s0){if(o===s)this.atlas.meta.image.push(t[s]),r=this.atlas.meta.image.length-1,this.atlas.frames.push({}),i=-3;else if(i>0)if(i%7===1)null!=n&&(this.atlas.frames[r][n.name]=n),n={name:t[s],frame:{}};else{var l=t[s].split(" ");if(i%7===3)n.frame.x=Number(l[1].replace(",","")),n.frame.y=Number(l[2]);else if(i%7===4)n.frame.w=Number(l[1].replace(",","")),n.frame.h=Number(l[2]);else if(i%7===5){var u={x:0,y:0,w:Number(l[1].replace(",","")),h:Number(l[2])};u.w>n.frame.w||u.h>n.frame.h?(n.trimmed=!0,n.realSize=u):n.trimmed=!1}}i++}if(null!=n&&(this.atlas.frames[r][n.name]=n),this.atlas.meta.image.length>0){for(this.images=[],a=0;athis.currentImageId?(this.currentImageId++,this.images[this.currentImageId].load()):(this.loaded=!0,this.emit("loaded",{content:this}))},e.AtlasLoader.prototype.onError=function(){this.emit("error",{content:this})},e.SpriteSheetLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null,this.frames={}},e.SpriteSheetLoader.prototype.constructor=e.SpriteSheetLoader,e.EventTarget.mixin(e.SpriteSheetLoader.prototype),e.SpriteSheetLoader.prototype.load=function(){var t=this,i=new e.JsonLoader(this.url,this.crossorigin);i.on("loaded",function(e){t.json=e.data.content.json,t.onLoaded()}),i.load()},e.SpriteSheetLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader=function(t,i){this.texture=e.Texture.fromImage(t,i),this.frames=[]},e.ImageLoader.prototype.constructor=e.ImageLoader,e.EventTarget.mixin(e.ImageLoader.prototype),e.ImageLoader.prototype.load=function(){this.texture.baseTexture.hasLoaded?this.onLoaded():this.texture.baseTexture.on("loaded",this.onLoaded.bind(this))},e.ImageLoader.prototype.onLoaded=function(){this.emit("loaded",{content:this})},e.ImageLoader.prototype.loadFramedSpriteSheet=function(t,i,r){this.frames=[];for(var n=Math.floor(this.texture.width/t),o=Math.floor(this.texture.height/i),s=0,a=0;o>a;a++)for(var h=0;n>h;h++,s++){var l=new e.Texture(this.texture.baseTexture,{x:h*t,y:a*i,width:t,height:i});this.frames.push(l),r&&(e.TextureCache[r+"-"+s]=l)}this.load()},e.BitmapFontLoader=function(t,e){this.url=t,this.crossorigin=e,this.baseUrl=t.replace(/[^\/]*$/,""),this.texture=null},e.BitmapFontLoader.prototype.constructor=e.BitmapFontLoader,e.EventTarget.mixin(e.BitmapFontLoader.prototype),e.BitmapFontLoader.prototype.load=function(){this.ajaxRequest=new e.AjaxRequest,this.ajaxRequest.onreadystatechange=this.onXMLLoaded.bind(this),this.ajaxRequest.open("GET",this.url,!0),this.ajaxRequest.overrideMimeType&&this.ajaxRequest.overrideMimeType("application/xml"),this.ajaxRequest.send(null)},e.BitmapFontLoader.prototype.onXMLLoaded=function(){if(4===this.ajaxRequest.readyState&&(200===this.ajaxRequest.status||-1===window.location.protocol.indexOf("http"))){var t=this.ajaxRequest.responseXML;if(!t||/MSIE 9/i.test(navigator.userAgent)||navigator.isCocoonJS)if("function"==typeof window.DOMParser){var i=new DOMParser;t=i.parseFromString(this.ajaxRequest.responseText,"text/xml")}else{var r=document.createElement("div");r.innerHTML=this.ajaxRequest.responseText,t=r}var n=this.baseUrl+t.getElementsByTagName("page")[0].getAttribute("file"),o=new e.ImageLoader(n,this.crossorigin);this.texture=o.texture.baseTexture;var s={},a=t.getElementsByTagName("info")[0],h=t.getElementsByTagName("common")[0];s.font=a.getAttribute("face"),s.size=parseInt(a.getAttribute("size"),10),s.lineHeight=parseInt(h.getAttribute("lineHeight"),10),s.chars={};for(var l=t.getElementsByTagName("char"),u=0;ut;t++)this.shaders[t].dirty=!0},e.AlphaMaskFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={mask:{type:"sampler2D",value:t},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mask.value.x=t.width,this.uniforms.mask.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D mask;","uniform sampler2D uSampler;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," mapCords *= dimensions.xy / mapDimensions;"," vec4 original = texture2D(uSampler, vTextureCoord);"," float maskAlpha = texture2D(mask, mapCords).r;"," original *= maskAlpha;"," gl_FragColor = original;","}"]},e.AlphaMaskFilter.prototype=Object.create(e.AbstractFilter.prototype),e.AlphaMaskFilter.prototype.constructor=e.AlphaMaskFilter,e.AlphaMaskFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.mask.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.mask.value.height,this.uniforms.mask.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.AlphaMaskFilter.prototype,"map",{get:function(){return this.uniforms.mask.value},set:function(t){this.uniforms.mask.value=t}}),e.ColorMatrixFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={matrix:{type:"mat4",value:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform mat4 matrix;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * matrix;","}"]},e.ColorMatrixFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorMatrixFilter.prototype.constructor=e.ColorMatrixFilter,Object.defineProperty(e.ColorMatrixFilter.prototype,"matrix",{get:function(){return this.uniforms.matrix.value},set:function(t){this.uniforms.matrix.value=t}}),e.GrayFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={gray:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float gray;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126*gl_FragColor.r + 0.7152*gl_FragColor.g + 0.0722*gl_FragColor.b), gray);","}"]},e.GrayFilter.prototype=Object.create(e.AbstractFilter.prototype),e.GrayFilter.prototype.constructor=e.GrayFilter,Object.defineProperty(e.GrayFilter.prototype,"gray",{get:function(){return this.uniforms.gray.value},set:function(t){this.uniforms.gray.value=t}}),e.DisplacementFilter=function(t){e.AbstractFilter.call(this),this.passes=[this],t.baseTexture._powerOf2=!0,this.uniforms={displacementMap:{type:"sampler2D",value:t},scale:{type:"2f",value:{x:30,y:30}},offset:{type:"2f",value:{x:0,y:0}},mapDimensions:{type:"2f",value:{x:1,y:5112}},dimensions:{type:"4fv",value:[0,0,0,0]}},t.baseTexture.hasLoaded?(this.uniforms.mapDimensions.value.x=t.width,this.uniforms.mapDimensions.value.y=t.height):(this.boundLoadedFunction=this.onTextureLoaded.bind(this),t.baseTexture.on("loaded",this.boundLoadedFunction)),this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D displacementMap;","uniform sampler2D uSampler;","uniform vec2 scale;","uniform vec2 offset;","uniform vec4 dimensions;","uniform vec2 mapDimensions;","void main(void) {"," vec2 mapCords = vTextureCoord.xy;"," mapCords += (dimensions.zw + offset)/ dimensions.xy ;"," mapCords.y *= -1.0;"," mapCords.y += 1.0;"," vec2 matSample = texture2D(displacementMap, mapCords).xy;"," matSample -= 0.5;"," matSample *= scale;"," matSample /= mapDimensions;"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + matSample.x, vTextureCoord.y + matSample.y));"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb, 1.0);"," vec2 cord = vTextureCoord;","}"]},e.DisplacementFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DisplacementFilter.prototype.constructor=e.DisplacementFilter,e.DisplacementFilter.prototype.onTextureLoaded=function(){this.uniforms.mapDimensions.value.x=this.uniforms.displacementMap.value.width,this.uniforms.mapDimensions.value.y=this.uniforms.displacementMap.value.height,this.uniforms.displacementMap.value.baseTexture.off("loaded",this.boundLoadedFunction)},Object.defineProperty(e.DisplacementFilter.prototype,"map",{get:function(){return this.uniforms.displacementMap.value},set:function(t){this.uniforms.displacementMap.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.uniforms.scale.value=t}}),Object.defineProperty(e.DisplacementFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.uniforms.offset.value=t}}),e.PixelateFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:0},dimensions:{type:"4fv",value:new e.Float32Array([1e4,100,10,10])},pixelSize:{type:"2f",value:{x:10,y:10}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 testDim;","uniform vec4 dimensions;","uniform vec2 pixelSize;","uniform sampler2D uSampler;","void main(void) {"," vec2 coord = vTextureCoord;"," vec2 size = dimensions.xy/pixelSize;"," vec2 color = floor( ( vTextureCoord * size ) ) / size + pixelSize/dimensions.xy * 0.5;"," gl_FragColor = texture2D(uSampler, color);","}"]},e.PixelateFilter.prototype=Object.create(e.AbstractFilter.prototype),e.PixelateFilter.prototype.constructor=e.PixelateFilter,Object.defineProperty(e.PixelateFilter.prototype,"size",{get:function(){return this.uniforms.pixelSize.value},set:function(t){this.dirty=!0,this.uniforms.pixelSize.value=t}}),e.BlurXFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 4.0*blur, vTextureCoord.y)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x - blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + blur, vTextureCoord.y)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 2.0*blur, vTextureCoord.y)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 3.0*blur, vTextureCoord.y)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x + 4.0*blur, vTextureCoord.y)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurXFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurXFilter.prototype.constructor=e.BlurXFilter,Object.defineProperty(e.BlurXFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.dirty=!0,this.uniforms.blur.value=1/7e3*t}}),e.BlurYFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," vec4 sum = vec4(0.0);"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 4.0*blur)) * 0.05;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y)) * 0.16;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + blur)) * 0.15;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 2.0*blur)) * 0.12;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 3.0*blur)) * 0.09;"," sum += texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + 4.0*blur)) * 0.05;"," gl_FragColor = sum;","}"]},e.BlurYFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurYFilter.prototype.constructor=e.BlurYFilter,Object.defineProperty(e.BlurYFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.BlurFilter=function(){this.blurXFilter=new e.BlurXFilter,this.blurYFilter=new e.BlurYFilter,this.passes=[this.blurXFilter,this.blurYFilter]},e.BlurFilter.prototype=Object.create(e.AbstractFilter.prototype),e.BlurFilter.prototype.constructor=e.BlurFilter,Object.defineProperty(e.BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=this.blurYFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(t){this.blurXFilter.blur=t}}),Object.defineProperty(e.BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(t){this.blurYFilter.blur=t}}),e.InvertFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={invert:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float invert;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( (vec3(1)-gl_FragColor.rgb) * gl_FragColor.a, gl_FragColor.rgb, 1.0 - invert);","}"]},e.InvertFilter.prototype=Object.create(e.AbstractFilter.prototype),e.InvertFilter.prototype.constructor=e.InvertFilter,Object.defineProperty(e.InvertFilter.prototype,"invert",{get:function(){return this.uniforms.invert.value},set:function(t){this.uniforms.invert.value=t}}),e.SepiaFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={sepia:{type:"1f",value:1}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float sepia;","uniform sampler2D uSampler;","const mat3 sepiaMatrix = mat3(0.3588, 0.7044, 0.1368, 0.2990, 0.5870, 0.1140, 0.2392, 0.4696, 0.0912);","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);"," gl_FragColor.rgb = mix( gl_FragColor.rgb, gl_FragColor.rgb * sepiaMatrix, sepia);","}"]},e.SepiaFilter.prototype=Object.create(e.AbstractFilter.prototype),e.SepiaFilter.prototype.constructor=e.SepiaFilter,Object.defineProperty(e.SepiaFilter.prototype,"sepia",{get:function(){return this.uniforms.sepia.value},set:function(t){this.uniforms.sepia.value=t}}),e.TwistFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={radius:{type:"1f",value:.5},angle:{type:"1f",value:5},offset:{type:"2f",value:{x:.5,y:.5}}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float radius;","uniform float angle;","uniform vec2 offset;","void main(void) {"," vec2 coord = vTextureCoord - offset;"," float distance = length(coord);"," if (distance < radius) {"," float ratio = (radius - distance) / radius;"," float angleMod = ratio * ratio * angle;"," float s = sin(angleMod);"," float c = cos(angleMod);"," coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);"," }"," gl_FragColor = texture2D(uSampler, coord+offset);","}"] +},e.TwistFilter.prototype=Object.create(e.AbstractFilter.prototype),e.TwistFilter.prototype.constructor=e.TwistFilter,Object.defineProperty(e.TwistFilter.prototype,"offset",{get:function(){return this.uniforms.offset.value},set:function(t){this.dirty=!0,this.uniforms.offset.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"radius",{get:function(){return this.uniforms.radius.value},set:function(t){this.dirty=!0,this.uniforms.radius.value=t}}),Object.defineProperty(e.TwistFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.ColorStepFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={step:{type:"1f",value:5}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","uniform float step;","void main(void) {"," vec4 color = texture2D(uSampler, vTextureCoord);"," color = floor(color * step) / step;"," gl_FragColor = color;","}"]},e.ColorStepFilter.prototype=Object.create(e.AbstractFilter.prototype),e.ColorStepFilter.prototype.constructor=e.ColorStepFilter,Object.defineProperty(e.ColorStepFilter.prototype,"step",{get:function(){return this.uniforms.step.value},set:function(t){this.uniforms.step.value=t}}),e.DotScreenFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={scale:{type:"1f",value:1},angle:{type:"1f",value:5},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec4 dimensions;","uniform sampler2D uSampler;","uniform float angle;","uniform float scale;","float pattern() {"," float s = sin(angle), c = cos(angle);"," vec2 tex = vTextureCoord * dimensions.xy;"," vec2 point = vec2("," c * tex.x - s * tex.y,"," s * tex.x + c * tex.y"," ) * scale;"," return (sin(point.x) * sin(point.y)) * 4.0;","}","void main() {"," vec4 color = texture2D(uSampler, vTextureCoord);"," float average = (color.r + color.g + color.b) / 3.0;"," gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);","}"]},e.DotScreenFilter.prototype=Object.create(e.AbstractFilter.prototype),e.DotScreenFilter.prototype.constructor=e.DotScreenFilter,Object.defineProperty(e.DotScreenFilter.prototype,"scale",{get:function(){return this.uniforms.scale.value},set:function(t){this.dirty=!0,this.uniforms.scale.value=t}}),Object.defineProperty(e.DotScreenFilter.prototype,"angle",{get:function(){return this.uniforms.angle.value},set:function(t){this.dirty=!0,this.uniforms.angle.value=t}}),e.CrossHatchFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={blur:{type:"1f",value:1/512}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform float blur;","uniform sampler2D uSampler;","void main(void) {"," float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);"," gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"," if (lum < 1.00) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.75) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.50) {"," if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }"," if (lum < 0.3) {"," if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {"," gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);"," }"," }","}"]},e.CrossHatchFilter.prototype=Object.create(e.AbstractFilter.prototype),e.CrossHatchFilter.prototype.constructor=e.CrossHatchFilter,Object.defineProperty(e.CrossHatchFilter.prototype,"blur",{get:function(){return this.uniforms.blur.value/(1/7e3)},set:function(t){this.uniforms.blur.value=1/7e3*t}}),e.RGBSplitFilter=function(){e.AbstractFilter.call(this),this.passes=[this],this.uniforms={red:{type:"2f",value:{x:20,y:20}},green:{type:"2f",value:{x:-20,y:20}},blue:{type:"2f",value:{x:20,y:-20}},dimensions:{type:"4fv",value:[0,0,0,0]}},this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform vec2 red;","uniform vec2 green;","uniform vec2 blue;","uniform vec4 dimensions;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/dimensions.xy).r;"," gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/dimensions.xy).g;"," gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/dimensions.xy).b;"," gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;","}"]},e.RGBSplitFilter.prototype=Object.create(e.AbstractFilter.prototype),e.RGBSplitFilter.prototype.constructor=e.RGBSplitFilter,Object.defineProperty(e.RGBSplitFilter.prototype,"red",{get:function(){return this.uniforms.red.value},set:function(t){this.uniforms.red.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"green",{get:function(){return this.uniforms.green.value},set:function(t){this.uniforms.green.value=t}}),Object.defineProperty(e.RGBSplitFilter.prototype,"blue",{get:function(){return this.uniforms.blue.value},set:function(t){this.uniforms.blue.value=t}}),"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=e),exports.PIXI=e):"undefined"!=typeof define&&define.amd?define(e):t.PIXI=e}.call(this),!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.html2canvas=t()}}(function(){var t;return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var h="function"==typeof require&&require;if(!a&&h)return h(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[s]={exports:{}};t[s][0].call(u.exports,function(e){var i=t[s][1][e];return n(i?i:e)},u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;st;t+=2){var e=W[t],i=W[t+1];e(i),W[t]=void 0,W[t+1]=void 0}G=0}function p(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function m(t){try{return t.then}catch(e){return z.error=e,z}}function v(t,e,i,r){try{t.call(e,i,r)}catch(n){return n}}function y(t,e,i){N(function(t){var r=!1,n=v(i,e,function(i){r||(r=!0,e!==i?w(t,i):S(t,i))},function(e){r||(r=!0,C(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&n&&(r=!0,C(t,n))},t)}function x(t,e){e._state===H?S(t,e._result):t._state===X?C(t,e._result):E(e,void 0,function(e){w(t,e)},function(e){C(t,e)})}function b(t,e){if(e.constructor===t.constructor)x(t,e);else{var i=m(e);i===z?C(t,z.error):void 0===i?S(t,e):o(i)?y(t,e,i):S(t,e)}}function w(t,e){t===e?C(t,f()):n(e)?b(t,e):S(t,e)}function T(t){t._onerror&&t._onerror(t._result),A(t)}function S(t,e){t._state===Y&&(t._result=e,t._state=H,0===t._subscribers.length||N(A,t))}function C(t,e){t._state===Y&&(t._state=X,t._result=e,N(T,t))}function E(t,e,i,r){var n=t._subscribers,o=n.length;t._onerror=null,n[o]=e,n[o+H]=i,n[o+X]=r,0===o&&t._state&&N(A,t)}function A(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var r,n,o=t._result,s=0;s1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return a.prototype=t,new a},0),N=function(t,e){W[G]=t,W[G+1]=e,G+=2,2===G&&D()},U="undefined"!=typeof window?window:{},j=U.MutationObserver||U.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,W=new Array(1e3);D="undefined"!=typeof e&&"[object process]"==={}.toString.call(e)?h():j?l():V?u():c();var Y=void 0,H=1,X=2,z=new _,q=new _;P.prototype._validateInput=function(t){return k(t)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var Q=P;P.prototype._enumerate=function(){for(var t=this.length,e=this.promise,i=this._input,r=0;e._state===Y&&t>r;r++)this._eachEntry(i[r],r)},P.prototype._eachEntry=function(t,e){var i=this._instanceConstructor;s(t)?t.constructor===i&&t._state!==Y?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(i.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(H,e,t))},P.prototype._settledAt=function(t,e,i){var r=this.promise;r._state===Y&&(this._remaining--,this._abortOnReject&&t===X?C(r,i):this._result[e]=this._makeResult(t,e,i)),0===this._remaining&&S(r,this._result)},P.prototype._makeResult=function(t,e,i){return i},P.prototype._willSettleAt=function(t,e){var i=this;E(t,void 0,function(t){i._settledAt(H,e,t)},function(t){i._settledAt(X,e,t)})};var K=function(t,e){return new Q(this,t,!0,e).promise},$=function(t,e){function i(t){w(o,t)}function r(t){C(o,t)}var n=this,o=new n(p,e);if(!k(t))return C(o,new TypeError("You must pass an array to race.")),o;for(var s=t.length,a=0;o._state===Y&&s>a;a++)E(n.resolve(t[a]),void 0,i,r);return o},J=function(t,e){var i=this;if(t&&"object"==typeof t&&t.constructor===i)return t;var r=new i(p,e);return w(r,t),r},Z=function(t,e){var i=this,r=new i(p,e);return C(r,t),r},te=0,ee=I;I.all=K,I.race=$,I.resolve=J,I.reject=Z,I.prototype={constructor:I,then:function(t,e){var i=this,r=i._state;if(r===H&&!t||r===X&&!e)return this;var n=new this.constructor(p),o=i._result;if(r){var s=arguments[r-1];N(function(){L(r,n,s,o)})}else E(i,n,t,e);return n},"catch":function(t){return this.then(null,t)}};var ie=function(){var t;t="undefined"!=typeof r?r:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),o(e)}();e||(t.Promise=ee)},re={Promise:ee,polyfill:ie};"function"==typeof t&&t.amd?t(function(){return re}):"undefined"!=typeof i&&i.exports?i.exports=re:"undefined"!=typeof this&&(this.ES6Promise=re)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(t,e){function i(){if(!s){s=!0;for(var t,e=o.length;e;){t=o,o=[];for(var i=-1;++in;)e=t.charCodeAt(n++),e>=55296&&56319>=e&&o>n?(i=t.charCodeAt(n++),56320==(64512&i)?r.push(((1023&e)<<10)+(1023&i)+65536):(r.push(e),n--)):r.push(e);return r}function l(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=k(t>>>10&1023|55296),t=56320|1023&t),e+=k(t)}).join("")}function u(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function c(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function d(t,e,i){var r=0;for(t=i?D(t/_):t>>1,t+=D(t/e);t>O*E>>1;r+=S)t=D(t/O);return D(r+(O+1)*t/(t+A))}function p(t){var e,i,r,n,s,a,h,c,p,f,g=[],m=t.length,v=0,y=L,x=M;for(i=t.lastIndexOf(R),0>i&&(i=0),r=0;i>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),g.push(t.charCodeAt(r));for(n=i>0?i+1:0;m>n;){for(s=v,a=1,h=S;n>=m&&o("invalid-input"),c=u(t.charCodeAt(n++)),(c>=S||c>D((T-v)/a))&&o("overflow"),v+=c*a,p=x>=h?C:h>=x+E?E:h-x,!(p>c);h+=S)f=S-p,a>D(T/f)&&o("overflow"),a*=f;e=g.length+1,x=d(v-s,e,0==s),D(v/e)>T-y&&o("overflow"),y+=D(v/e),v%=e,g.splice(v++,0,y)}return l(g)}function f(t){var e,i,r,n,s,a,l,u,p,f,g,m,v,y,x,b=[];for(t=h(t),m=t.length,e=L,i=0,s=M,a=0;m>a;++a)g=t[a],128>g&&b.push(k(g));for(r=n=b.length,n&&b.push(R);m>r;){for(l=T,a=0;m>a;++a)g=t[a],g>=e&&l>g&&(l=g);for(v=r+1,l-e>D((T-i)/v)&&o("overflow"),i+=(l-e)*v,e=l,a=0;m>a;++a)if(g=t[a],e>g&&++i>T&&o("overflow"),g==e){for(u=i,p=S;f=s>=p?C:p>=s+E?E:p-s,!(f>u);p+=S)x=u-f,y=S-f,b.push(k(c(f+x%y,0))),u=D(x/y);b.push(k(c(u,0))),s=d(i,v,r==n),i=0,++r}++i,++e}return b.join("")}function g(t){return a(t,function(t){return P.test(t)?p(t.slice(4).toLowerCase()):t})}function m(t){return a(t,function(t){return F.test(t)?"xn--"+f(t):t})}var v="object"==typeof r&&r,y="object"==typeof i&&i&&i.exports==v&&i,x="object"==typeof e&&e;(x.global===x||x.window===x)&&(n=x);var b,w,T=2147483647,S=36,C=1,E=26,A=38,_=700,M=72,L=128,R="-",P=/^xn--/,F=/[^ -~]/,B=/\x2E|\u3002|\uFF0E|\uFF61/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=S-C,D=Math.floor,k=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:h,encode:l},decode:p,encode:f,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&!v.nodeType)if(y)y.exports=b;else for(w in b)b.hasOwnProperty(w)&&(v[w]=b[w]);else n.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(t,e){function i(t,e,i){for(var r=t.getElementsByTagName(i),n=e.getElementsByTagName(i),o=r.length,s=0;o>s;s++)n[s].value=r[s].value}function r(t,e,i){!t.defaultView||e===t.defaultView.pageXOffset&&i===t.defaultView.pageYOffset||t.defaultView.scrollTo(e,i)}function n(t){[].slice.call(t.querySelectorAll("canvas"),0).forEach(function(t){t.setAttribute(d,"canvas-"+p++)})}function o(t,e){[].slice.call(t.querySelectorAll("["+d+"]"),0).forEach(function(t){try{var i=e.querySelector("["+d+'="'+t.getAttribute(d)+'"]');i&&(i.width=t.width,i.height=t.height,i.getContext("2d").putImageData(t.getContext("2d").getImageData(0,0,t.width,t.height),0,0))}catch(r){u("Unable to copy canvas content from",t,r)}t.removeAttribute(d)})}function s(t){return[].slice.call(t.childNodes,0).filter(l).forEach(function(e){"SCRIPT"===e.tagName?t.removeChild(e):s(e)}),t}function a(){return document.documentMode&&document.documentMode<=9}function h(t,e){for(var i=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),r=t.firstChild;r;)(e===!0||1!==r.nodeType||"SCRIPT"!==r.nodeName)&&i.appendChild(h(r,e)),r=r.nextSibling;return i}function l(t){return t.nodeType===Node.ELEMENT_NODE}var u=t("./log"),c=t("./promise"),d="data-html2canvas-canvas-clone",p=0;e.exports=function(t,e,l,u,d,p,f){n(t);var g=a()?h(t.documentElement,d.javascriptEnabled):t.documentElement.cloneNode(!0),m=e.createElement("iframe");return m.className="html2canvas-container",m.style.visibility="hidden",m.style.position="fixed",m.style.left="-10000px",m.style.top="0px",m.style.border="0",m.width=l,m.height=u,m.scrolling="no",e.body.appendChild(m),new c(function(e){var n=m.contentWindow.document;i(t.documentElement,g,"textarea"),i(t.documentElement,g,"select"),m.contentWindow.onload=m.onload=function(){var i=setInterval(function(){n.body.childNodes.length>0&&(o(t,n),clearInterval(i),"view"===d.type&&m.contentWindow.scrollTo(p,f),e(m))},50)},n.open(),n.write(""),r(t,p,f),n.replaceChild(d.javascriptEnabled===!0?n.adoptNode(g):s(n.adoptNode(g)),n.documentElement),n.close()})}},{"./log":15,"./promise":18}],5:[function(t,e){function i(t){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(t)||this.namedColor(t)||this.rgb(t)||this.rgba(t)||this.hex6(t)||this.hex3(t)}i.prototype.darken=function(t){var e=1-t;return new i([Math.round(this.r*e),Math.round(this.g*e),Math.round(this.b*e),this.a])},i.prototype.isTransparent=function(){return 0===this.a},i.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},i.prototype.fromArray=function(t){return Array.isArray(t)&&(this.r=Math.min(t[0],255),this.g=Math.min(t[1],255),this.b=Math.min(t[2],255),t.length>3&&(this.a=t[3])),Array.isArray(t)};var r=/^#([a-f0-9]{3})$/i;i.prototype.hex3=function(t){var e=null;return null!==(e=t.match(r))&&(this.r=parseInt(e[1][0]+e[1][0],16),this.g=parseInt(e[1][1]+e[1][1],16),this.b=parseInt(e[1][2]+e[1][2],16)),null!==e};var n=/^#([a-f0-9]{6})$/i;i.prototype.hex6=function(t){var e=null;return null!==(e=t.match(n))&&(this.r=parseInt(e[1].substring(0,2),16),this.g=parseInt(e[1].substring(2,4),16),this.b=parseInt(e[1].substring(4,6),16)),null!==e};var o=/^rgb\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3})\)$/;i.prototype.rgb=function(t){var e=null;return null!==(e=t.match(o))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3])),null!==e};var s=/^rgba\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *, *(\d+\.?\d*)\)$/;i.prototype.rgba=function(t){var e=null;return null!==(e=t.match(s))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3]),this.a=Number(e[4])),null!==e},i.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},i.prototype.namedColor=function(t){var e=a[t.toLowerCase()];if(e)this.r=e[0],this.g=e[1],this.b=e[2];else if("transparent"===t.toLowerCase())return this.r=this.g=this.b=this.a=0,!0;return!!e},i.prototype.isColor=!0;var a={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};e.exports=i},{}],6:[function(t,e){function i(t,e){var i=T++;if(e=e||{},e.logging&&(window.html2canvas.logging=!0,window.html2canvas.start=Date.now()),e.async="undefined"==typeof e.async?!0:e.async,e.allowTaint="undefined"==typeof e.allowTaint?!1:e.allowTaint,e.removeContainer="undefined"==typeof e.removeContainer?!0:e.removeContainer,e.javascriptEnabled="undefined"==typeof e.javascriptEnabled?!1:e.javascriptEnabled,e.imageTimeout="undefined"==typeof e.imageTimeout?1e4:e.imageTimeout,e.renderer="function"==typeof e.renderer?e.renderer:d,e.strict=!!e.strict,"string"==typeof t){if("string"!=typeof e.proxy)return u.reject("Proxy must be used when rendering url");var o=null!=e.width?e.width:window.innerWidth,s=null!=e.height?e.height:window.innerHeight;return x(l(t),e.proxy,document,o,s,e).then(function(t){return n(t.contentWindow.document.documentElement,t,e,o,s)})}var a=(void 0===t?[document.documentElement]:t.length?t:[t])[0];return a.setAttribute(w+i,i),r(a.ownerDocument,e,a.ownerDocument.defaultView.innerWidth,a.ownerDocument.defaultView.innerHeight,i).then(function(t){return"function"==typeof e.onrendered&&(m("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),e.onrendered(t)),t})}function r(t,e,i,r,o){return y(t,t,i,r,e,t.defaultView.pageXOffset,t.defaultView.pageYOffset).then(function(s){m("Document cloned");var a=w+o,h="["+a+"='"+o+"']";t.querySelector(h).removeAttribute(a);var l=s.contentWindow,c=l.document.querySelector(h);"0"===c.style.opacity&&"webgl"===c.getAttribute("renderer")?c.style.opacity=1:null;var d=u.resolve("function"==typeof e.onclone?e.onclone(l.document):!0);return d.then(function(){return n(c,s,e,i,r)})})}function n(t,e,i,r,n){var l=e.contentWindow,u=new c(l.document),d=new p(i,u),g=b(t),v="view"===i.type?r:a(l.document),y="view"===i.type?n:h(l.document),x=new i.renderer(v,y,d,i,document),w=new f(t,x,u,d,i);return w.ready.then(function(){m("Finished rendering");var r;return r="view"===i.type?s(x.canvas,{width:x.canvas.width,height:x.canvas.height,top:0,left:0,x:0,y:0}):t===l.document.body||t===l.document.documentElement||null!=i.canvas?x.canvas:s(x.canvas,{width:null!=i.width?i.width:g.width,height:null!=i.height?i.height:g.height,top:g.top,left:g.left,x:l.pageXOffset,y:l.pageYOffset}),o(e,i),r})}function o(t,e){e.removeContainer&&(t.parentNode.removeChild(t),m("Cleaned up container"))}function s(t,e){var i=document.createElement("canvas"),r=Math.min(t.width-1,Math.max(0,e.left)),n=Math.min(t.width,Math.max(1,e.left+e.width)),o=Math.min(t.height-1,Math.max(0,e.top)),s=Math.min(t.height,Math.max(1,e.top+e.height));return i.width=e.width,i.height=e.height,m("Cropping canvas at:","left:",e.left,"top:",e.top,"width:",n-r,"height:",s-o),m("Resulting crop with width",e.width,"and height",e.height," with x",r,"and y",o),i.getContext("2d").drawImage(t,r,o,n-r,s-o,e.x,e.y,n-r,s-o),i}function a(t){return Math.max(Math.max(t.body.scrollWidth,t.documentElement.scrollWidth),Math.max(t.body.offsetWidth,t.documentElement.offsetWidth),Math.max(t.body.clientWidth,t.documentElement.clientWidth))}function h(t){return Math.max(Math.max(t.body.scrollHeight,t.documentElement.scrollHeight),Math.max(t.body.offsetHeight,t.documentElement.offsetHeight),Math.max(t.body.clientHeight,t.documentElement.clientHeight))}function l(t){var e=document.createElement("a");return e.href=t,e.href=e.href,e}var u=t("./promise"),c=t("./support"),d=t("./renderers/canvas"),p=t("./imageloader"),f=t("./nodeparser"),g=t("./nodecontainer"),m=t("./log"),v=t("./utils"),y=t("./clone"),x=t("./proxy").loadUrlDocument,b=v.getBounds,w="data-html2canvas-node",T=0;i.Promise=u,i.CanvasRenderer=d,i.NodeContainer=g,i.log=m,i.utils=v,e.exports="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return u.reject("No canvas support")}:i},{"./clone":4,"./imageloader":13,"./log":15,"./nodecontainer":16,"./nodeparser":17,"./promise":18,"./proxy":19,"./renderers/canvas":23,"./support":25,"./utils":29}],7:[function(t,e){function i(t){if(this.src=t,n("DummyImageContainer for",t),!this.promise||!this.image){n("Initiating DummyImageContainer"),i.prototype.image=new Image;var e=this.image;i.prototype.promise=new r(function(t,i){e.onload=t,e.onerror=i,e.src=o(),e.complete===!0&&t(e)})}}var r=t("./promise"),n=t("./log"),o=t("./utils").smallImage;e.exports=i},{"./log":15,"./promise":18,"./utils":29}],8:[function(t,e){function i(t,e){var i,n,o=document.createElement("div"),s=document.createElement("img"),a=document.createElement("span"),h="Hidden Text";o.style.visibility="hidden",o.style.fontFamily=t,o.style.fontSize=e,o.style.margin=0,o.style.padding=0,document.body.appendChild(o),s.src=r(),s.width=1,s.height=1,s.style.margin=0,s.style.padding=0,s.style.verticalAlign="baseline",a.style.fontFamily=t,a.style.fontSize=e,a.style.margin=0,a.style.padding=0,a.appendChild(document.createTextNode(h)),o.appendChild(a),o.appendChild(s),i=s.offsetTop-a.offsetTop+1,o.removeChild(a),o.appendChild(document.createTextNode(h)),o.style.lineHeight="normal",s.style.verticalAlign="super",n=s.offsetTop-o.offsetTop+1,document.body.removeChild(o),this.baseline=i,this.lineWidth=1,this.middle=n}var r=t("./utils").smallImage;e.exports=i},{"./utils":29}],9:[function(t,e){function i(){this.data={}}var r=t("./font");i.prototype.getMetrics=function(t,e){return void 0===this.data[t+"-"+e]&&(this.data[t+"-"+e]=new r(t,e)),this.data[t+"-"+e]},e.exports=i},{"./font":8}],10:[function(t,e){function i(e,i,r){this.image=null,this.src=e;var s=this,a=o(e);this.promise=(i?new n(function(t){"about:blank"===e.contentWindow.document.URL||null==e.contentWindow.document.documentElement?e.contentWindow.onload=e.onload=function(){t(e)}:t(e)}):this.proxyLoad(r.proxy,a,r)).then(function(e){var i=t("./core");return i(e.contentWindow.document.documentElement,{type:"view",width:e.width,height:e.height,proxy:r.proxy,javascriptEnabled:r.javascriptEnabled,removeContainer:r.removeContainer,allowTaint:r.allowTaint,imageTimeout:r.imageTimeout/2})}).then(function(t){return s.image=t})}var r=t("./utils"),n=t("./promise"),o=r.getBounds,s=t("./proxy").loadUrlDocument;i.prototype.proxyLoad=function(t,e,i){var r=this.src;return s(r.src,t,r.ownerDocument,e.width,e.height,i)},e.exports=i},{"./core":6,"./promise":18,"./proxy":19,"./utils":29}],11:[function(t,e){function i(t){this.src=t.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=r.resolve(!0)}var r=t("./promise");i.prototype.TYPES={LINEAR:1,RADIAL:2},e.exports=i},{"./promise":18}],12:[function(t,e){function i(t,e){this.src=t,this.image=new Image;var i=this;this.tainted=null,this.promise=new r(function(r,n){i.image.onload=r,i.image.onerror=n,e&&(i.image.crossOrigin="anonymous"),i.image.src=t,i.image.complete===!0&&r(i.image)})}var r=t("./promise");e.exports=i},{"./promise":18}],13:[function(t,e){function i(t,e){this.link=null,this.options=t,this.support=e,this.origin=this.getOrigin(window.location.href)}var r=t("./promise"),n=t("./log"),o=t("./imagecontainer"),s=t("./dummyimagecontainer"),a=t("./proxyimagecontainer"),h=t("./framecontainer"),l=t("./svgcontainer"),u=t("./svgnodecontainer"),c=t("./lineargradientcontainer"),d=t("./webkitgradientcontainer"),p=t("./utils").bind;i.prototype.findImages=function(t){var e=[];return t.reduce(function(t,e){switch(e.node.nodeName){case"IMG":return t.concat([{args:[e.node.src],method:"url"}]);case"svg":case"IFRAME":return t.concat([{args:[e.node],method:e.node.nodeName}])}return t},[]).forEach(this.addImage(e,this.loadImage),this),e},i.prototype.findBackgroundImage=function(t,e){return e.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(t,this.loadImage),this),t},i.prototype.addImage=function(t,e){return function(i){i.args.forEach(function(r){this.imageExists(t,r)||(t.splice(0,0,e.call(this,i)),n("Added image #"+t.length,"string"==typeof r?r.substring(0,100):r))},this)}},i.prototype.hasImageBackground=function(t){return"none"!==t.method},i.prototype.loadImage=function(t){if("url"===t.method){var e=t.args[0];return!this.isSVG(e)||this.support.svg||this.options.allowTaint?e.match(/data:image\/.*;base64,/i)?new o(e.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(e)||this.options.allowTaint===!0||this.isSVG(e)?new o(e,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new o(e,!0):this.options.proxy?new a(e,this.options.proxy):new s(e):new l(e)}return"linear-gradient"===t.method?new c(t):"gradient"===t.method?new d(t):"svg"===t.method?new u(t.args[0],this.support.svg):"IFRAME"===t.method?new h(t.args[0],this.isSameOrigin(t.args[0].src),this.options):new s(t)},i.prototype.isSVG=function(t){return"svg"===t.substring(t.length-3).toLowerCase()||l.prototype.isInline(t) +},i.prototype.imageExists=function(t,e){return t.some(function(t){return t.src===e})},i.prototype.isSameOrigin=function(t){return this.getOrigin(t)===this.origin},i.prototype.getOrigin=function(t){var e=this.link||(this.link=document.createElement("a"));return e.href=t,e.href=e.href,e.protocol+e.hostname+e.port},i.prototype.getPromise=function(t){return this.timeout(t,this.options.imageTimeout)["catch"](function(){var e=new s(t.src);return e.promise.then(function(e){t.image=e})})},i.prototype.get=function(t){var e=null;return this.images.some(function(i){return(e=i).src===t})?e:null},i.prototype.fetch=function(t){return this.images=t.reduce(p(this.findBackgroundImage,this),this.findImages(t)),this.images.forEach(function(t,e){t.promise.then(function(){n("Succesfully loaded image #"+(e+1),t)},function(i){n("Failed loading image #"+(e+1),t,i)})}),this.ready=r.all(this.images.map(this.getPromise,this)),n("Finished searching images"),this},i.prototype.timeout=function(t,e){var i,o=r.race([t.promise,new r(function(r,o){i=setTimeout(function(){n("Timed out loading image",t),o(t)},e)})]).then(function(t){return clearTimeout(i),t});return o["catch"](function(){clearTimeout(i)}),o},e.exports=i},{"./dummyimagecontainer":7,"./framecontainer":10,"./imagecontainer":12,"./lineargradientcontainer":14,"./log":15,"./promise":18,"./proxyimagecontainer":20,"./svgcontainer":26,"./svgnodecontainer":27,"./utils":29,"./webkitgradientcontainer":30}],14:[function(t,e){function i(t){r.apply(this,arguments),this.type=this.TYPES.LINEAR;var e=null===t.args[0].match(this.stepRegExp);e?t.args[0].split(" ").reverse().forEach(function(t){switch(t){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var e=this.y0,i=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=i,this.y1=e}},this):(this.y0=0,this.y1=1),this.colorStops=t.args.slice(e?1:0).map(function(t){var e=t.match(this.stepRegExp);return{color:new n(e[1]),stop:"%"===e[3]?e[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(t,e){null===t.stop&&this.colorStops.slice(e).some(function(i,r){return null!==i.stop?(t.stop=(i.stop-this.colorStops[e-1].stop)/(r+1)+this.colorStops[e-1].stop,!0):!1},this)},this)}var r=t("./gradientcontainer"),n=t("./color");i.prototype=Object.create(r.prototype),i.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,e.exports=i},{"./color":5,"./gradientcontainer":11}],15:[function(t,e){e.exports=function(){window.html2canvas.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-window.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}},{}],16:[function(t,e){function i(t,e){this.node=t,this.parent=e,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function r(t){var e=t.options[t.selectedIndex||0];return e?e.text||"":""}function n(t){return t&&"matrix"===t[1]?t[2].split(",").map(function(t){return parseFloat(t.trim())}):void 0}function o(t){return-1!==t.toString().indexOf("%")}function s(t){return t.replace("px","")}function a(t){return parseFloat(t)}var h=t("./color"),l=t("./utils"),u=l.getBounds,c=l.parseBackgrounds,d=l.offsetBounds;i.prototype.cloneTo=function(t){t.visible=this.visible,t.borders=this.borders,t.bounds=this.bounds,t.clip=this.clip,t.backgroundClip=this.backgroundClip,t.computedStyles=this.computedStyles,t.styles=this.styles,t.backgroundImages=this.backgroundImages,t.opacity=this.opacity},i.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},i.prototype.assignStack=function(t){this.stack=t,t.children.push(this)},i.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},i.prototype.css=function(t){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[t]||(this.styles[t]=this.computedStyles[t])},i.prototype.prefixedCss=function(t){var e=["webkit","moz","ms","o"],i=this.css(t);return void 0===i&&e.some(function(e){return i=this.css(e+t.substr(0,1).toUpperCase()+t.substr(1)),void 0!==i},this),void 0===i?null:i},i.prototype.computedStyle=function(t){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,t)},i.prototype.cssInt=function(t){var e=parseInt(this.css(t),10);return isNaN(e)?0:e},i.prototype.color=function(t){return this.colors[t]||(this.colors[t]=new h(this.css(t)))},i.prototype.cssFloat=function(t){var e=parseFloat(this.css(t));return isNaN(e)?0:e},i.prototype.fontWeight=function(){var t=this.css("fontWeight");switch(parseInt(t,10)){case 401:t="bold";break;case 400:t="normal"}return t},i.prototype.parseClip=function(){var t=this.css("clip").match(this.CLIP);return t?{top:parseInt(t[1],10),right:parseInt(t[2],10),bottom:parseInt(t[3],10),left:parseInt(t[4],10)}:null},i.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=c(this.css("backgroundImage")))},i.prototype.cssList=function(t,e){var i=(this.css(t)||"").split(",");return i=i[e||0]||i[0]||"auto",i=i.trim().split(" "),1===i.length&&(i=[i[0],o(i[0])?"auto":i[0]]),i},i.prototype.parseBackgroundSize=function(t,e,i){var r,n,s=this.cssList("backgroundSize",i);if(o(s[0]))r=t.width*parseFloat(s[0])/100;else{if(/contain|cover/.test(s[0])){var a=t.width/t.height,h=e.width/e.height;return h>a^"contain"===s[0]?{width:t.height*h,height:t.height}:{width:t.width,height:t.width/h}}r=parseInt(s[0],10)}return n="auto"===s[0]&&"auto"===s[1]?e.height:"auto"===s[1]?r/e.width*e.height:o(s[1])?t.height*parseFloat(s[1])/100:parseInt(s[1],10),"auto"===s[0]&&(r=n/e.height*e.width),{width:r,height:n}},i.prototype.parseBackgroundPosition=function(t,e,i,r){var n,s,a=this.cssList("backgroundPosition",i);return n=o(a[0])?(t.width-(r||e).width)*(parseFloat(a[0])/100):parseInt(a[0],10),s="auto"===a[1]?n/e.width*e.height:o(a[1])?(t.height-(r||e).height)*parseFloat(a[1])/100:parseInt(a[1],10),"auto"===a[0]&&(n=s/e.height*e.width),{left:n,top:s}},i.prototype.parseBackgroundRepeat=function(t){return this.cssList("backgroundRepeat",t)[0]},i.prototype.parseTextShadows=function(){var t=this.css("textShadow"),e=[];if(t&&"none"!==t)for(var i=t.match(this.TEXT_SHADOW_PROPERTY),r=0;i&&r0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,t)):t():(this.renderQueue.forEach(this.paint,this),t())},this))},this))}function r(t){return t.parent&&t.parent.clip.length}function n(t){return t.replace(/(\-[a-z])/g,function(t){return t.toUpperCase().replace("-","")})}function o(){}function s(t,e,i,r){return t.map(function(n,o){if(n.width>0){var s=e.left,a=e.top,h=e.width,l=e.height-t[2].width;switch(o){case 0:l=t[0].width,n.args=u({c1:[s,a],c2:[s+h,a],c3:[s+h-t[1].width,a+l],c4:[s+t[3].width,a+l]},r[0],r[1],i.topLeftOuter,i.topLeftInner,i.topRightOuter,i.topRightInner);break;case 1:s=e.left+e.width-t[1].width,h=t[1].width,n.args=u({c1:[s+h,a],c2:[s+h,a+l+t[2].width],c3:[s,a+l],c4:[s,a+t[0].width]},r[1],r[2],i.topRightOuter,i.topRightInner,i.bottomRightOuter,i.bottomRightInner);break;case 2:a=a+e.height-t[2].width,l=t[2].width,n.args=u({c1:[s+h,a+l],c2:[s,a+l],c3:[s+t[3].width,a],c4:[s+h-t[3].width,a]},r[2],r[3],i.bottomRightOuter,i.bottomRightInner,i.bottomLeftOuter,i.bottomLeftInner);break;case 3:h=t[3].width,n.args=u({c1:[s,a+l+t[2].width],c2:[s,a],c3:[s+h,a+t[0].width],c4:[s+h,a+l]},r[3],r[0],i.bottomLeftOuter,i.bottomLeftInner,i.topLeftOuter,i.topLeftInner)}}return n})}function a(t,e,i,r){var n=4*((Math.sqrt(2)-1)/3),o=i*n,s=r*n,a=t+i,h=e+r;return{topLeft:l({x:t,y:h},{x:t,y:h-s},{x:a-o,y:e},{x:a,y:e}),topRight:l({x:t,y:e},{x:t+o,y:e},{x:a,y:h-s},{x:a,y:h}),bottomRight:l({x:a,y:e},{x:a,y:e+s},{x:t+o,y:h},{x:t,y:h}),bottomLeft:l({x:a,y:h},{x:a-o,y:h},{x:t,y:e+s},{x:t,y:e})}}function h(t,e,i){var r=t.left,n=t.top,o=t.width,s=t.height,h=e[0][0],l=e[0][1],u=e[1][0],c=e[1][1],d=e[2][0],p=e[2][1],f=e[3][0],g=e[3][1],m=Math.floor(s/2);h=h>m?m:h,l=l>m?m:l,u=u>m?m:u,c=c>m?m:c,d=d>m?m:d,p=p>m?m:p,f=f>m?m:f,g=g>m?m:g;var v=o-u,y=s-p,x=o-d,b=s-g;return{topLeftOuter:a(r,n,h,l).topLeft.subdivide(.5),topLeftInner:a(r+i[3].width,n+i[0].width,Math.max(0,h-i[3].width),Math.max(0,l-i[0].width)).topLeft.subdivide(.5),topRightOuter:a(r+v,n,u,c).topRight.subdivide(.5),topRightInner:a(r+Math.min(v,o+i[3].width),n+i[0].width,v>o+i[3].width?0:u-i[3].width,c-i[0].width).topRight.subdivide(.5),bottomRightOuter:a(r+x,n+y,d,p).bottomRight.subdivide(.5),bottomRightInner:a(r+Math.min(x,o-i[3].width),n+Math.min(y,s+i[0].width),Math.max(0,d-i[1].width),p-i[2].width).bottomRight.subdivide(.5),bottomLeftOuter:a(r,n+b,f,g).bottomLeft.subdivide(.5),bottomLeftInner:a(r+i[3].width,n+b,Math.max(0,f-i[3].width),g-i[2].width).bottomLeft.subdivide(.5)}}function l(t,e,i,r){var n=function(t,e,i){return{x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}};return{start:t,startControl:e,endControl:i,end:r,subdivide:function(o){var s=n(t,e,o),a=n(e,i,o),h=n(i,r,o),u=n(s,a,o),c=n(a,h,o),d=n(u,c,o);return[l(t,s,u,d),l(d,c,h,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,i.x,i.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",i.x,i.y,e.x,e.y,t.x,t.y])}}}function u(t,e,i,r,n,o,s){var a=[];return e[0]>0||e[1]>0?(a.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(a)):a.push(["line",t.c1[0],t.c1[1]]),i[0]>0||i[1]>0?(a.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(a),a.push(["line",s[0].end.x,s[0].end.y]),s[0].curveToReversed(a)):(a.push(["line",t.c2[0],t.c2[1]]),a.push(["line",t.c3[0],t.c3[1]])),e[0]>0||e[1]>0?(a.push(["line",n[1].end.x,n[1].end.y]),n[1].curveToReversed(a)):a.push(["line",t.c4[0],t.c4[1]]),a}function c(t,e,i,r,n,o,s){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",o,s]),(i[0]>0||i[1]>0)&&t.push(["line",n[0].start.x,n[0].start.y])}function d(t){return t.cssInt("zIndex")<0}function p(t){return t.cssInt("zIndex")>0}function f(t){return 0===t.cssInt("zIndex")}function g(t){return-1!==["inline","inline-block","inline-table"].indexOf(t.css("display"))}function m(t){return t instanceof z}function v(t){return t.node.data.trim().length>0}function y(t){return/^(normal|none|0px)$/.test(t.parent.css("letterSpacing"))}function x(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){var i=t.css("border"+e+"Radius"),r=i.split(" ");return r.length<=1&&(r[1]=r[0]),r.map(P)})}function b(t){return t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE}function w(t){var e=t.css("position"),i=-1!==["absolute","relative","fixed"].indexOf(e)?t.css("zIndex"):"auto";return"auto"!==i}function T(t){return"static"!==t.css("position")}function S(t){return"none"!==t.css("float")}function C(t){return-1!==["inline-block","inline-table"].indexOf(t.css("display"))}function E(t){var e=this;return function(){return!t.apply(e,arguments)}}function A(t){return t.node.nodeType===Node.ELEMENT_NODE}function _(t){return t.isPseudoElement===!0}function M(t){return t.node.nodeType===Node.TEXT_NODE}function L(t){return function(e,i){return e.cssInt("zIndex")+t.indexOf(e)/t.length-(i.cssInt("zIndex")+t.indexOf(i)/t.length)}}function R(t){return t.getOpacity()<1}function P(t){return parseInt(t,10)}function F(t){return t.width}function B(t){return t.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(t.node.nodeName)}function I(t){return[].concat.apply([],t)}function O(t){var e=t.substr(0,1);return e===t.substr(t.length-1)&&e.match(/'|"/)?t.substr(1,t.length-2):t}function D(t){for(var e,i=[],r=0,n=!1;t.length;)k(t[r])===n?(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)),n=!n,r=0):r++,r>=t.length&&(e=t.splice(0,r),e.length&&i.push(U.ucs2.encode(e)));return i}function k(t){return-1!==[32,13,10,9,45].indexOf(t)}function G(t){return/[^\u0000-\u00ff]/.test(t)}var N=t("./log"),U=t("punycode"),j=t("./nodecontainer"),V=t("./textcontainer"),W=t("./pseudoelementcontainer"),Y=t("./fontmetrics"),H=t("./color"),X=t("./promise"),z=t("./stackingcontext"),q=t("./utils"),Q=q.bind,K=q.getBounds,$=q.parseBackgrounds,J=q.offsetBounds;i.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(t){if(A(t)){_(t)&&t.appendToDOM(),t.borders=this.parseBorders(t);var e="hidden"===t.css("overflow")?[t.borders.clip]:[],i=t.parseClip();i&&-1!==["absolute","fixed"].indexOf(t.css("position"))&&e.push([["rect",t.bounds.left+i.left,t.bounds.top+i.top,i.right-i.left,i.bottom-i.top]]),t.clip=r(t)?t.parent.clip.concat(e):e,t.backgroundClip="hidden"!==t.css("overflow")?t.clip.concat([t.borders.clip]):t.clip,_(t)&&t.cleanDOM()}else M(t)&&(t.clip=r(t)?t.parent.clip:[]);_(t)||(t.bounds=null)},this)},i.prototype.asyncRenderer=function(t,e,i){i=i||Date.now(),this.paint(t[this.renderIndex++]),t.length===this.renderIndex?e():i+20>Date.now()?this.asyncRenderer(t,e,i):setTimeout(Q(function(){this.asyncRenderer(t,e)},this),0)},i.prototype.createPseudoHideStyles=function(t){this.createStyles(t,"."+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},i.prototype.disableAnimations=function(t){this.createStyles(t,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},i.prototype.createStyles=function(t,e){var i=t.createElement("style");i.innerHTML=e,t.body.appendChild(i)},i.prototype.getPseudoElements=function(t){var e=[[t]];if(t.node.nodeType===Node.ELEMENT_NODE){var i=this.getPseudoElement(t,":before"),r=this.getPseudoElement(t,":after");i&&e.push(i),r&&e.push(r)}return I(e)},i.prototype.getPseudoElement=function(t,e){var i=t.computedStyle(e);if(!i||!i.content||"none"===i.content||"-moz-alt-content"===i.content||"none"===i.display)return null;for(var r=O(i.content),o="url"===r.substr(0,3),s=document.createElement(o?"img":"html2canvaspseudoelement"),a=new W(s,t,e),h=i.length-1;h>=0;h--){var l=n(i.item(h));s.style[l]=i[l]}if(s.className=W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+W.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,o)return s.src=$(r)[0].args[0],[a];var u=document.createTextNode(r);return s.appendChild(u),[a,new V(u,a)]},i.prototype.getChildren=function(t){return I([].filter.call(t.node.childNodes,b).map(function(e){var i=[e.nodeType===Node.TEXT_NODE?new V(e,t):new j(e,t)].filter(B);return e.nodeType===Node.ELEMENT_NODE&&i.length&&"TEXTAREA"!==e.tagName?i[0].isElementVisible()?i.concat(this.getChildren(i[0])):[]:i},this))},i.prototype.newStackingContext=function(t,e){var i=new z(e,t.getOpacity(),t.node,t.parent);t.cloneTo(i);var r=e?i.getParentStack(this):i.parent.stack;r.contexts.push(i),t.stack=i},i.prototype.createStackingContexts=function(){this.nodes.forEach(function(t){A(t)&&(this.isRootElement(t)||R(t)||w(t)||this.isBodyWithTransparentRoot(t)||t.hasTransform())?this.newStackingContext(t,!0):A(t)&&(T(t)&&f(t)||C(t)||S(t))?this.newStackingContext(t,!1):t.assignStack(t.parent.stack)},this)},i.prototype.isBodyWithTransparentRoot=function(t){return"BODY"===t.node.nodeName&&t.parent.color("backgroundColor").isTransparent()},i.prototype.isRootElement=function(t){return null===t.parent},i.prototype.sortStackingContexts=function(t){t.contexts.sort(L(t.contexts.slice(0))),t.contexts.forEach(this.sortStackingContexts,this)},i.prototype.parseTextBounds=function(t){return function(e,i,r){if("none"!==t.parent.css("textDecoration").substr(0,4)||0!==e.trim().length){if(this.support.rangeBounds&&!t.parent.hasTransform()){var n=r.slice(0,i).join("").length;return this.getRangeBounds(t.node,n,e.length)}if(t.node&&"string"==typeof t.node.data){var o=t.node.splitText(e.length),s=this.getWrapperBounds(t.node,t.parent.hasTransform());return t.node=o,s}}else(!this.support.rangeBounds||t.parent.hasTransform())&&(t.node=t.node.splitText(e.length));return{}}},i.prototype.getWrapperBounds=function(t,e){var i=t.ownerDocument.createElement("html2canvaswrapper"),r=t.parentNode,n=t.cloneNode(!0);i.appendChild(t.cloneNode(!0)),r.replaceChild(i,t);var o=e?J(i):K(i);return r.replaceChild(n,i),o},i.prototype.getRangeBounds=function(t,e,i){var r=this.range||(this.range=t.ownerDocument.createRange());return r.setStart(t,e),r.setEnd(t,e+i),r.getBoundingClientRect()},i.prototype.parse=function(t){var e=t.contexts.filter(d),i=t.children.filter(A),r=i.filter(E(S)),n=r.filter(E(T)).filter(E(g)),s=i.filter(E(T)).filter(S),a=r.filter(E(T)).filter(g),h=t.contexts.concat(r.filter(T)).filter(f),l=t.children.filter(M).filter(v),u=t.contexts.filter(p);e.concat(n).concat(s).concat(a).concat(h).concat(l).concat(u).forEach(function(t){this.renderQueue.push(t),m(t)&&(this.parse(t),this.renderQueue.push(new o))},this)},i.prototype.paint=function(t){try{t instanceof o?this.renderer.ctx.restore():M(t)?(_(t.parent)&&t.parent.appendToDOM(),this.paintText(t),_(t.parent)&&t.parent.cleanDOM()):this.paintNode(t)}catch(e){if(N(e),this.options.strict)throw e}},i.prototype.paintNode=function(t){m(t)&&(this.renderer.setOpacity(t.opacity),this.renderer.ctx.save(),t.hasTransform()&&this.renderer.setTransform(t.parseTransform())),"INPUT"===t.node.nodeName&&"checkbox"===t.node.type?this.paintCheckbox(t):"INPUT"===t.node.nodeName&&"radio"===t.node.type?this.paintRadio(t):this.paintElement(t)},i.prototype.paintElement=function(t){var e=t.parseBounds();this.renderer.clip(t.backgroundClip,function(){this.renderer.renderBackground(t,e,t.borders.borders.map(F))},this),this.renderer.clip(t.clip,function(){this.renderer.renderBorders(t.borders.borders)},this),this.renderer.clip(t.backgroundClip,function(){switch(t.node.nodeName){case"svg":case"IFRAME":var i=this.images.get(t.node);i?this.renderer.renderImage(t,e,t.borders,i):N("Error loading <"+t.node.nodeName+">",t.node);break;case"IMG":var r=this.images.get(t.node.src);r?this.renderer.renderImage(t,e,t.borders,r):N("Error loading ",t.node.src);break;case"CANVAS":this.renderer.renderImage(t,e,t.borders,{image:t.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(t)}},this)},i.prototype.paintCheckbox=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height),r={width:i-1,height:i-1,top:e.top,left:e.left},n=[3,3],o=[n,n,n,n],a=[1,1,1,1].map(function(t){return{color:new H("#A5A5A5"),width:t}}),l=h(r,o,a);this.renderer.clip(t.backgroundClip,function(){this.renderer.rectangle(r.left+1,r.top+1,r.width-2,r.height-2,new H("#DEDEDE")),this.renderer.renderBorders(s(a,r,l,o)),t.node.checked&&(this.renderer.font(new H("#424242"),"normal","normal","bold",i-3+"px","arial"),this.renderer.text("✔",r.left+i/6,r.top+i-1))},this)},i.prototype.paintRadio=function(t){var e=t.parseBounds(),i=Math.min(e.width,e.height)-2;this.renderer.clip(t.backgroundClip,function(){this.renderer.circleStroke(e.left+1,e.top+1,i,new H("#DEDEDE"),1,new H("#A5A5A5")),t.node.checked&&this.renderer.circle(Math.ceil(e.left+i/4)+1,Math.ceil(e.top+i/4)+1,Math.floor(i/2),new H("#424242"))},this)},i.prototype.paintFormValue=function(t){var e=t.getValue();if(e.length>0){var i=t.node.ownerDocument,r=i.createElement("html2canvaswrapper"),n=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];n.forEach(function(e){try{r.style[e]=t.css(e)}catch(i){N("html2canvas: Parse: Exception caught in renderFormValue: "+i.message)}});var o=t.parseBounds();r.style.position="fixed",r.style.left=o.left+"px",r.style.top=o.top+"px",r.textContent=e,i.body.appendChild(r),this.paintText(new V(r.firstChild,t)),i.body.removeChild(r)}},i.prototype.paintText=function(t){t.applyTextTransform();var e=U.ucs2.decode(t.node.data),i=this.options.letterRendering&&!y(t)||G(t.node.data)?e.map(function(t){return U.ucs2.encode([t])}):D(e),r=t.parent.fontWeight(),n=t.parent.css("fontSize"),o=t.parent.css("fontFamily"),s=t.parent.parseTextShadows();this.renderer.font(t.parent.color("color"),t.parent.css("fontStyle"),t.parent.css("fontVariant"),r,n,o),s.length?this.renderer.fontShadow(s[0].color,s[0].offsetX,s[0].offsetY,s[0].blur):this.renderer.clearShadow(),this.renderer.clip(t.parent.clip,function(){i.map(this.parseTextBounds(t),this).forEach(function(e,r){e&&(this.renderer.text(i[r],e.left,e.bottom),this.renderTextDecoration(t.parent,e,this.fontMetrics.getMetrics(o,n)))},this)},this)},i.prototype.renderTextDecoration=function(t,e,i){switch(t.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(e.left,Math.round(e.top+i.baseline+i.lineWidth),e.width,1,t.color("color"));break;case"overline":this.renderer.rectangle(e.left,Math.round(e.top),e.width,1,t.color("color"));break;case"line-through":this.renderer.rectangle(e.left,Math.ceil(e.top+i.middle+i.lineWidth),e.width,1,t.color("color"))}};var Z={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};i.prototype.parseBorders=function(t){var e=t.parseBounds(),i=x(t),r=["Top","Right","Bottom","Left"].map(function(e,i){var r=t.css("border"+e+"Style"),n=t.color("border"+e+"Color");"inset"===r&&n.isBlack()&&(n=new H([255,255,255,n.a]));var o=Z[r]?Z[r][i]:null;return{width:t.cssInt("border"+e+"Width"),color:o?n[o[0]](o[1]):n,args:null}}),n=h(e,i,r);return{clip:this.parseBackgroundClip(t,n,r,i,e),borders:s(r,e,n,i)}},i.prototype.parseBackgroundClip=function(t,e,i,r,n){var o=t.css("backgroundClip"),s=[];switch(o){case"content-box":case"padding-box":c(s,r[0],r[1],e.topLeftInner,e.topRightInner,n.left+i[3].width,n.top+i[0].width),c(s,r[1],r[2],e.topRightInner,e.bottomRightInner,n.left+n.width-i[1].width,n.top+i[0].width),c(s,r[2],r[3],e.bottomRightInner,e.bottomLeftInner,n.left+n.width-i[1].width,n.top+n.height-i[2].width),c(s,r[3],r[0],e.bottomLeftInner,e.topLeftInner,n.left+i[3].width,n.top+n.height-i[2].width);break;default:c(s,r[0],r[1],e.topLeftOuter,e.topRightOuter,n.left,n.top),c(s,r[1],r[2],e.topRightOuter,e.bottomRightOuter,n.left+n.width,n.top),c(s,r[2],r[3],e.bottomRightOuter,e.bottomLeftOuter,n.left+n.width,n.top+n.height),c(s,r[3],r[0],e.bottomLeftOuter,e.topLeftOuter,n.left,n.top+n.height)}return s},e.exports=i},{"./color":5,"./fontmetrics":9,"./log":15,"./nodecontainer":16,"./promise":18,"./pseudoelementcontainer":21,"./stackingcontext":24,"./textcontainer":28,"./utils":29,punycode:3}],18:[function(t,e){e.exports=t("es6-promise").Promise},{"es6-promise":1}],19:[function(t,e,i){function r(t,e,i){var r="withCredentials"in new XMLHttpRequest;if(!e)return u.reject("No proxy configured");var n=s(r),h=a(e,t,n);return r?c(h):o(i,h,n).then(function(t){return g(t.content)})}function n(t,e,i){var r="crossOrigin"in new Image,n=s(r),h=a(e,t,n);return r?u.resolve(h):o(i,h,n).then(function(t){return"data:"+t.type+";base64,"+t.content})}function o(t,e,i){return new u(function(r,n){var o=t.createElement("script"),s=function(){delete window.html2canvas.proxy[i],t.body.removeChild(o)};window.html2canvas.proxy[i]=function(t){s(),r(t)},o.src=e,o.onerror=function(t){s(),n(t)},t.body.appendChild(o)})}function s(t){return t?"":"html2canvas_"+Date.now()+"_"+ ++m+"_"+Math.round(1e5*Math.random())}function a(t,e,i){return t+"?url="+encodeURIComponent(e)+(i.length?"&callback=html2canvas.proxy."+i:"")}function h(t){return function(e){var i,r=new DOMParser;try{i=r.parseFromString(e,"text/html")}catch(n){p("DOMParser not supported, falling back to createHTMLDocument"),i=document.implementation.createHTMLDocument("");try{i.open(),i.write(e),i.close()}catch(o){p("createHTMLDocument write not supported, falling back to document.body.innerHTML"),i.body.innerHTML=e}}var s=i.querySelector("base");if(!s||!s.href.host){var a=i.createElement("base");a.href=t,i.head.insertBefore(a,i.head.firstChild)}return i}}function l(t,e,i,n,o,s){return new r(t,e,window.document).then(h(t)).then(function(t){return f(t,i,n,o,s,0,0)})}var u=t("./promise"),c=t("./xhr"),d=t("./utils"),p=t("./log"),f=t("./clone"),g=d.decode64,m=0;i.Proxy=r,i.ProxyURL=n,i.loadUrlDocument=l},{"./clone":4,"./log":15,"./promise":18,"./utils":29,"./xhr":31}],20:[function(t,e){function i(t,e){var i=document.createElement("a");i.href=t,t=i.href,this.src=t,this.image=new Image;var o=this;this.promise=new n(function(i,n){o.image.crossOrigin="Anonymous",o.image.onload=i,o.image.onerror=n,new r(t,e,document).then(function(t){o.image.src=t})["catch"](n)})}var r=t("./proxy").ProxyURL,n=t("./promise");e.exports=i},{"./promise":18,"./proxy":19}],21:[function(t,e){function i(t,e,i){r.call(this,t,e),this.isPseudoElement=!0,this.before=":before"===i}var r=t("./nodecontainer");i.prototype.cloneTo=function(t){i.prototype.cloneTo.call(this,t),t.isPseudoElement=!0,t.before=this.before},i.prototype=Object.create(r.prototype),i.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},i.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},i.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",i.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",e.exports=i},{"./nodecontainer":16}],22:[function(t,e){function i(t,e,i,r,n){this.width=t,this.height=e,this.images=i,this.options=r,this.document=n}var r=t("./log");i.prototype.renderImage=function(t,e,i,r){var n=t.cssInt("paddingLeft"),o=t.cssInt("paddingTop"),s=t.cssInt("paddingRight"),a=t.cssInt("paddingBottom"),h=i.borders,l=e.width-(h[1].width+h[3].width+n+s),u=e.height-(h[0].width+h[2].width+o+a);this.drawImage(r,0,0,Math.round(r.image.width||l),Math.round(r.image.height||u),Math.round(e.left+n+h[3].width),Math.round(e.top+o+h[0].width),l,u)},i.prototype.renderBackground=function(t,e,i){e.height>0&&e.width>0&&(this.renderBackgroundColor(t,e),this.renderBackgroundImage(t,e,i))},i.prototype.renderBackgroundColor=function(t,e){var i=t.color("backgroundColor");i.isTransparent()||this.rectangle(e.left,e.top,e.width,e.height,i)},i.prototype.renderBorders=function(t){t.forEach(this.renderBorder,this)},i.prototype.renderBorder=function(t){t.color.isTransparent()||null===t.args||this.drawShape(t.args,t.color)},i.prototype.renderBackgroundImage=function(t,e,i){var n=t.parseBackgroundImages();n.reverse().forEach(function(n,o,s){switch(n.method){case"url":var a=this.images.get(n.args[0]);a?this.renderBackgroundRepeating(t,e,a,s.length-(o+1),i):r("Error loading background-image",n.args[0]);break;case"linear-gradient":case"gradient":var h=this.images.get(n.value);h?this.renderBackgroundGradient(h,e,i):r("Error loading background-image",n.args[0]);break;case"none":break;default:r("Unknown background-image type",n.args[0])}},this)},i.prototype.renderBackgroundRepeating=function(t,e,i,r,n){var o=t.parseBackgroundSize(e,i.image,r),s=t.parseBackgroundPosition(e,i.image,r,o),a=t.parseBackgroundRepeat(r);switch(a){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+n[3],e.top+s.top+n[0],99999,o.height,n);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+n[0],o.width,99999,n);break;case"no-repeat":this.backgroundRepeatShape(i,s,o,e,e.left+s.left+n[3],e.top+s.top+n[0],o.width,o.height,n);break;default:this.renderBackgroundRepeat(i,s,o,{top:e.top,left:e.left},n[3],n[0])}},e.exports=i},{"./log":15}],23:[function(t,e){function i(t,e){n.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=t,this.canvas.height=e),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},s("Initialized CanvasRenderer with size",t,"x",e)}function r(t){return t.length>0}var n=t("../renderer"),o=t("../lineargradientcontainer"),s=t("../log");i.prototype=Object.create(n.prototype),i.prototype.setFillStyle=function(t){return this.ctx.fillStyle="object"==typeof t&&t.isColor?t.toString():t,this.ctx +},i.prototype.rectangle=function(t,e,i,r,n){this.setFillStyle(n).fillRect(t,e,i,r)},i.prototype.circle=function(t,e,i,r){this.setFillStyle(r),this.ctx.beginPath(),this.ctx.arc(t+i/2,e+i/2,i/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},i.prototype.circleStroke=function(t,e,i,r,n,o){this.circle(t,e,i,r),this.ctx.strokeStyle=o.toString(),this.ctx.stroke()},i.prototype.drawShape=function(t,e){this.shape(t),this.setFillStyle(e).fill()},i.prototype.taints=function(t){if(null===t.tainted){this.taintCtx.drawImage(t.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),t.tainted=!1}catch(e){this.taintCtx=document.createElement("canvas").getContext("2d"),t.tainted=!0}}return t.tainted},i.prototype.drawImage=function(t,e,i,r,n,o,s,a,h){(!this.taints(t)||this.options.allowTaint)&&this.ctx.drawImage(t.image,e,i,r,n,o,s,a,h)},i.prototype.clip=function(t,e,i){this.ctx.save(),t.filter(r).forEach(function(t){this.shape(t).clip()},this),e.call(i),this.ctx.restore()},i.prototype.shape=function(t){return this.ctx.beginPath(),t.forEach(function(t,e){"rect"===t[0]?this.ctx.rect.apply(this.ctx,t.slice(1)):this.ctx[0===e?"moveTo":t[0]+"To"].apply(this.ctx,t.slice(1))},this),this.ctx.closePath(),this.ctx},i.prototype.font=function(t,e,i,r,n,o){this.setFillStyle(t).font=[e,i,r,n,o].join(" ").split(",")[0]},i.prototype.fontShadow=function(t,e,i,r){this.setVariable("shadowColor",t.toString()).setVariable("shadowOffsetY",e).setVariable("shadowOffsetX",i).setVariable("shadowBlur",r)},i.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},i.prototype.setOpacity=function(t){this.ctx.globalAlpha=t},i.prototype.setTransform=function(t){this.ctx.translate(t.origin[0],t.origin[1]),this.ctx.transform.apply(this.ctx,t.matrix),this.ctx.translate(-t.origin[0],-t.origin[1])},i.prototype.setVariable=function(t,e){return this.variables[t]!==e&&(this.variables[t]=this.ctx[t]=e),this},i.prototype.text=function(t,e,i){this.ctx.fillText(t,e,i)},i.prototype.backgroundRepeatShape=function(t,e,i,r,n,o,s,a,h){var l=[["line",Math.round(n),Math.round(o)],["line",Math.round(n+s),Math.round(o)],["line",Math.round(n+s),Math.round(a+o)],["line",Math.round(n),Math.round(a+o)]];this.clip([l],function(){this.renderBackgroundRepeat(t,e,i,r,h[3],h[0])},this)},i.prototype.renderBackgroundRepeat=function(t,e,i,r,n,o){var s=Math.round(r.left+e.left+n),a=Math.round(r.top+e.top+o);this.setFillStyle(this.ctx.createPattern(this.resizeImage(t,i),"repeat")),this.ctx.translate(s,a),this.ctx.fill(),this.ctx.translate(-s,-a)},i.prototype.renderBackgroundGradient=function(t,e){if(t instanceof o){var i=this.ctx.createLinearGradient(e.left+e.width*t.x0,e.top+e.height*t.y0,e.left+e.width*t.x1,e.top+e.height*t.y1);t.colorStops.forEach(function(t){i.addColorStop(t.stop,t.color.toString())}),this.rectangle(e.left,e.top,e.width,e.height,i)}},i.prototype.resizeImage=function(t,e){var i=t.image;if(i.width===e.width&&i.height===e.height)return i;var r,n=document.createElement("canvas");return n.width=e.width,n.height=e.height,r=n.getContext("2d"),r.drawImage(i,0,0,i.width,i.height,0,0,e.width,e.height),n},e.exports=i},{"../lineargradientcontainer":14,"../log":15,"../renderer":22}],24:[function(t,e){function i(t,e,i,n){r.call(this,i,n),this.ownStacking=t,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*e}var r=t("./nodecontainer");i.prototype=Object.create(r.prototype),i.prototype.getParentStack=function(t){var e=this.parent?this.parent.stack:null;return e?e.ownStacking?e:e.getParentStack(t):t.stack},e.exports=i},{"./nodecontainer":16}],25:[function(t,e){function i(t){this.rangeBounds=this.testRangeBounds(t),this.cors=this.testCORS(),this.svg=this.testSVG()}i.prototype.testRangeBounds=function(t){var e,i,r,n,o=!1;return t.createRange&&(e=t.createRange(),e.getBoundingClientRect&&(i=t.createElement("boundtest"),i.style.height="123px",i.style.display="block",t.body.appendChild(i),e.selectNode(i),r=e.getBoundingClientRect(),n=r.height,123===n&&(o=!0),t.body.removeChild(i))),o},i.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},i.prototype.testSVG=function(){var t=new Image,e=document.createElement("canvas"),i=e.getContext("2d");t.src="data:image/svg+xml,";try{i.drawImage(t,0,0),e.toDataURL()}catch(r){return!1}return!0},e.exports=i},{}],26:[function(t,e){function i(t){this.src=t,this.image=null;var e=this;this.promise=this.hasFabric().then(function(){return e.isInline(t)?r.resolve(e.inlineFormatting(t)):n(t)}).then(function(t){return new r(function(i){window.html2canvas.svg.fabric.loadSVGFromString(t,e.createCanvas.call(e,i))})})}var r=t("./promise"),n=t("./xhr"),o=t("./utils").decode64;i.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?r.resolve():r.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},i.prototype.inlineFormatting=function(t){return/^data:image\/svg\+xml;base64,/.test(t)?this.decode64(this.removeContentType(t)):this.removeContentType(t)},i.prototype.removeContentType=function(t){return t.replace(/^data:image\/svg\+xml(;base64)?,/,"")},i.prototype.isInline=function(t){return/^data:image\/svg\+xml/i.test(t)},i.prototype.createCanvas=function(t){var e=this;return function(i,r){var n=new window.html2canvas.svg.fabric.StaticCanvas("c");e.image=n.lowerCanvasEl,n.setWidth(r.width).setHeight(r.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(i,r)).renderAll(),t(n.lowerCanvasEl)}},i.prototype.decode64=function(t){return"function"==typeof window.atob?window.atob(t):o(t)},e.exports=i},{"./promise":18,"./utils":29,"./xhr":31}],27:[function(t,e){function i(t,e){this.src=t,this.image=null;var i=this;this.promise=e?new n(function(e,r){i.image=new Image,i.image.onload=e,i.image.onerror=r,i.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(t),i.image.complete===!0&&e(i.image)}):this.hasFabric().then(function(){return new n(function(e){window.html2canvas.svg.fabric.parseSVGDocument(t,i.createCanvas.call(i,e))})})}var r=t("./svgcontainer"),n=t("./promise");i.prototype=Object.create(r.prototype),e.exports=i},{"./promise":18,"./svgcontainer":26}],28:[function(t,e){function i(t,e){n.call(this,t,e)}function r(t,e,i){return t.length>0?e+i.toUpperCase():void 0}var n=t("./nodecontainer");i.prototype=Object.create(n.prototype),i.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},i.prototype.transform=function(t){var e=this.node.data;switch(t){case"lowercase":return e.toLowerCase();case"capitalize":return e.replace(/(^|\s|:|-|\(|\))([a-z])/g,r);case"uppercase":return e.toUpperCase();default:return e}},e.exports=i},{"./nodecontainer":16}],29:[function(t,e,i){i.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},i.bind=function(t,e){return function(){return t.apply(e,arguments)}},i.decode64=function(t){var e,i,r,n,o,s,a,h,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=t.length,c="";for(e=0;u>e;e+=4)i=l.indexOf(t[e]),r=l.indexOf(t[e+1]),n=l.indexOf(t[e+2]),o=l.indexOf(t[e+3]),s=i<<2|r>>4,a=(15&r)<<4|n>>2,h=(3&n)<<6|o,c+=64===n?String.fromCharCode(s):64===o||-1===o?String.fromCharCode(s,a):String.fromCharCode(s,a,h);return c},i.getBounds=function(t){if(t.getBoundingClientRect){var e=t.getBoundingClientRect(),i=null==t.offsetWidth?e.width:t.offsetWidth;return{top:e.top,bottom:e.bottom||e.top+e.height,right:e.left+i,left:e.left,width:i,height:null==t.offsetHeight?e.height:t.offsetHeight}}return{}},i.offsetBounds=function(t){var e=t.offsetParent?i.offsetBounds(t.offsetParent):{top:0,left:0};return{top:t.offsetTop+e.top,bottom:t.offsetTop+t.offsetHeight+e.top,right:t.offsetLeft+e.left+t.offsetWidth,left:t.offsetLeft+e.left,width:t.offsetWidth,height:t.offsetHeight}},i.parseBackgrounds=function(t){var e,i,r,n,o,s,a,h=" \r\n ",l=[],u=0,c=0,d=function(){e&&('"'===i.substr(0,1)&&(i=i.substr(1,i.length-2)),i&&a.push(i),"-"===e.substr(0,1)&&(n=e.indexOf("-",1)+1)>0&&(r=e.substr(0,n),e=e.substr(n)),l.push({prefix:r,method:e.toLowerCase(),value:o,args:a,image:null})),a=[],e=r=i=o=""};return a=[],e=r=i=o="",t.split("").forEach(function(t){if(!(0===u&&h.indexOf(t)>-1)){switch(t){case'"':s?s===t&&(s=null):s=t;break;case"(":if(s)break;if(0===u)return u=1,void(o+=t);c++;break;case")":if(s)break;if(1===u){if(0===c)return u=0,o+=t,void d();c--}break;case",":if(s)break;if(0===u)return void d();if(1===u&&0===c&&!e.match(/^url$/i))return a.push(i),i="",void(o+=t)}o+=t,0===u?e+=t:i+=t}}),d(),l}},{}],30:[function(t,e){function i(t){r.apply(this,arguments),this.type="linear"===t.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}var r=t("./gradientcontainer");i.prototype=Object.create(r.prototype),e.exports=i},{"./gradientcontainer":11}],31:[function(t,e){function i(t){return new r(function(e,i){var r=new XMLHttpRequest;r.open("GET",t),r.onload=function(){200===r.status?e(r.responseText):i(new Error(r.statusText))},r.onerror=function(){i(new Error("Network Error"))},r.send()})}var r=t("./promise");e.exports=i},{"./promise":18}]},{},[6])(6)}),function(t){function e(t){var e=t.length,r=i.type(t);return"function"===r||i.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===r||0===e||"number"==typeof e&&e>0&&e-1 in t}if(!t.jQuery){var i=function(t,e){return new i.fn.init(t,e)};i.isWindow=function(t){return null!=t&&t==t.window},i.type=function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?n[s.call(t)]||"object":typeof t},i.isArray=Array.isArray||function(t){return"array"===i.type(t)},i.isPlainObject=function(t){var e;if(!t||"object"!==i.type(t)||t.nodeType||i.isWindow(t))return!1;try{if(t.constructor&&!o.call(t,"constructor")&&!o.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}for(e in t);return void 0===e||o.call(t,e)},i.each=function(t,i,r){var n,o=0,s=t.length,a=e(t);if(r){if(a)for(;s>o&&(n=i.apply(t[o],r),n!==!1);o++);else for(o in t)if(n=i.apply(t[o],r),n===!1)break}else if(a)for(;s>o&&(n=i.call(t[o],o,t[o]),n!==!1);o++);else for(o in t)if(n=i.call(t[o],o,t[o]),n===!1)break;return t},i.data=function(t,e,n){if(void 0===n){var o=t[i.expando],s=o&&r[o];if(void 0===e)return s;if(s&&e in s)return s[e]}else if(void 0!==e){var o=t[i.expando]||(t[i.expando]=++i.uuid);return r[o]=r[o]||{},r[o][e]=n,n}},i.removeData=function(t,e){var n=t[i.expando],o=n&&r[n];o&&i.each(e,function(t,e){delete o[e]})},i.extend=function(){var t,e,r,n,o,s,a=arguments[0]||{},h=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[h]||{},h++),"object"!=typeof a&&"function"!==i.type(a)&&(a={}),h===l&&(a=this,h--);l>h;h++)if(null!=(o=arguments[h]))for(n in o)t=a[n],r=o[n],a!==r&&(u&&r&&(i.isPlainObject(r)||(e=i.isArray(r)))?(e?(e=!1,s=t&&i.isArray(t)?t:[]):s=t&&i.isPlainObject(t)?t:{},a[n]=i.extend(u,s,r)):void 0!==r&&(a[n]=r));return a},i.queue=function(t,r,n){function o(t,i){var r=i||[];return null!=t&&(e(Object(t))?!function(t,e){for(var i=+e.length,r=0,n=t.length;i>r;)t[n++]=e[r++];if(i!==i)for(;void 0!==e[r];)t[n++]=e[r++];return t.length=n,t}(r,"string"==typeof t?[t]:t):[].push.call(r,t)),r}if(t){r=(r||"fx")+"queue";var s=i.data(t,r);return n?(!s||i.isArray(n)?s=i.data(t,r,o(n)):s.push(n),s):s||[]}},i.dequeue=function(t,e){i.each(t.nodeType?[t]:t,function(t,r){e=e||"fx";var n=i.queue(r,e),o=n.shift();"inprogress"===o&&(o=n.shift()),o&&("fx"===e&&n.unshift("inprogress"),o.call(r,function(){i.dequeue(r,e)}))})},i.fn=i.prototype={init:function(t){if(t.nodeType)return this[0]=t,this;throw new Error("Not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:e.top+(t.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:e.left+(t.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function t(){for(var t=this.offsetParent||document;t&&"html"===!t.nodeType.toLowerCase&&"static"===t.style.position;)t=t.offsetParent;return t||document}var e=this[0],t=t.apply(e),r=this.offset(),n=/^(?:body|html)$/i.test(t.nodeName)?{top:0,left:0}:i(t).offset();return r.top-=parseFloat(e.style.marginTop)||0,r.left-=parseFloat(e.style.marginLeft)||0,t.style&&(n.top+=parseFloat(t.style.borderTopWidth)||0,n.left+=parseFloat(t.style.borderLeftWidth)||0),{top:r.top-n.top,left:r.left-n.left}}};var r={};i.expando="velocity"+(new Date).getTime(),i.uuid=0;for(var n={},o=n.hasOwnProperty,s=n.toString,a="Boolean Number String Function Array Date RegExp Object Error".split(" "),h=0;hn;++n){var o=l(i,t,r);if(0===o)return i;var s=h(i,t,r)-e;i-=s/o}return i}function c(){for(var e=0;x>e;++e)S[e]=h(e*b,t,r)}function d(e,i,n){var o,s,a=0;do s=i+(n-i)/2,o=h(s,t,r)-e,o>0?n=s:i=s;while(Math.abs(o)>v&&++a=m?u(e,a):0==h?a:d(e,i,i+b)}function f(){C=!0,(t!=i||r!=n)&&c()}var g=4,m=.001,v=1e-7,y=10,x=11,b=1/(x-1),w="Float32Array"in e;if(4!==arguments.length)return!1;for(var T=0;4>T;++T)if("number"!=typeof arguments[T]||isNaN(arguments[T])||!isFinite(arguments[T]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var S=w?new Float32Array(x):new Array(x),C=!1,E=function(e){return C||f(),t===i&&r===n?e:0===e?0:1===e?1:h(p(e),i,n)};E.getControlPoints=function(){return[{x:t,y:i},{x:r,y:n}]};var A="generateBezier("+[t,i,r,n]+")";return E.toString=function(){return A},E}function l(t,e){var i=t;return g.isString(t)?x.Easings[t]||(i=!1):i=g.isArray(t)&&1===t.length?a.apply(null,t):g.isArray(t)&&2===t.length?b.apply(null,t.concat([e])):g.isArray(t)&&4===t.length?h.apply(null,t):!1,i===!1&&(i=x.Easings[x.defaults.easing]?x.defaults.easing:y),i}function u(t){if(t){var e=(new Date).getTime(),i=x.State.calls.length;i>1e4&&(x.State.calls=n(x.State.calls));for(var o=0;i>o;o++)if(x.State.calls[o]){var a=x.State.calls[o],h=a[0],l=a[2],p=a[3],f=!!p,m=null;p||(p=x.State.calls[o][3]=e-16);for(var v=Math.min((e-p)/l.duration,1),y=0,b=h.length;b>y;y++){var T=h[y],C=T.element;if(s(C)){var E=!1;if(l.display!==r&&null!==l.display&&"none"!==l.display){if("flex"===l.display){var A=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];d.each(A,function(t,e){w.setPropertyValue(C,"display",e)})}w.setPropertyValue(C,"display",l.display)}l.visibility!==r&&"hidden"!==l.visibility&&w.setPropertyValue(C,"visibility",l.visibility);for(var _ in T)if("element"!==_){var M,L=T[_],R=g.isString(L.easing)?x.Easings[L.easing]:L.easing;if(1===v)M=L.endValue;else{var P=L.endValue-L.startValue;if(M=L.startValue+P*R(v,l,P),!f&&M===L.currentValue)continue}if(L.currentValue=M,"tween"===_)m=M;else{if(w.Hooks.registered[_]){var F=w.Hooks.getRoot(_),B=s(C).rootPropertyValueCache[F];B&&(L.rootPropertyValue=B)}var I=w.setPropertyValue(C,_,L.currentValue+(0===parseFloat(M)?"":L.unitType),L.rootPropertyValue,L.scrollData);w.Hooks.registered[_]&&(s(C).rootPropertyValueCache[F]=w.Normalizations.registered[F]?w.Normalizations.registered[F]("extract",null,I[1]):I[1]),"transform"===I[0]&&(E=!0)}}l.mobileHA&&s(C).transformCache.translate3d===r&&(s(C).transformCache.translate3d="(0px, 0px, 0px)",E=!0),E&&w.flushTransformCache(C)}}l.display!==r&&"none"!==l.display&&(x.State.calls[o][2].display=!1),l.visibility!==r&&"hidden"!==l.visibility&&(x.State.calls[o][2].visibility=!1),l.progress&&l.progress.call(a[1],a[1],v,Math.max(0,p+l.duration-e),p,m),1===v&&c(o)}}x.State.isTicking&&S(u)}function c(t,e){if(!x.State.calls[t])return!1;for(var i=x.State.calls[t][0],n=x.State.calls[t][1],o=x.State.calls[t][2],a=x.State.calls[t][4],h=!1,l=0,u=i.length;u>l;l++){var c=i[l].element;if(e||o.loop||("none"===o.display&&w.setPropertyValue(c,"display",o.display),"hidden"===o.visibility&&w.setPropertyValue(c,"visibility",o.visibility)),o.loop!==!0&&(d.queue(c)[1]===r||!/\.velocityQueueEntryFlag/i.test(d.queue(c)[1]))&&s(c)){s(c).isAnimating=!1,s(c).rootPropertyValueCache={};var p=!1;d.each(w.Lists.transforms3D,function(t,e){var i=/^scale/.test(e)?1:0,n=s(c).transformCache[e];s(c).transformCache[e]!==r&&new RegExp("^\\("+i+"[^.]").test(n)&&(p=!0,delete s(c).transformCache[e])}),o.mobileHA&&(p=!0,delete s(c).transformCache.translate3d),p&&w.flushTransformCache(c),w.Values.removeClass(c,"velocity-animating")}if(!e&&o.complete&&!o.loop&&l===u-1)try{o.complete.call(n,n)}catch(f){setTimeout(function(){throw f},1)}a&&o.loop!==!0&&a(n),s(c)&&o.loop===!0&&!e&&(d.each(s(c).tweensContainer,function(t,e){/^rotate/.test(t)&&360===parseFloat(e.endValue)&&(e.endValue=0,e.startValue=360),/^backgroundPosition/.test(t)&&100===parseFloat(e.endValue)&&"%"===e.unitType&&(e.endValue=0,e.startValue=100)}),x(c,"reverse",{loop:!0,delay:o.delay})),o.queue!==!1&&d.dequeue(c,o.queue)}x.State.calls[t]=!1;for(var g=0,m=x.State.calls.length;m>g;g++)if(x.State.calls[g]!==!1){h=!0;break}h===!1&&(x.State.isTicking=!1,delete x.State.calls,x.State.calls=[])}var d,p=function(){if(i.documentMode)return i.documentMode;for(var t=7;t>4;t--){var e=i.createElement("div");if(e.innerHTML="",e.getElementsByTagName("span").length)return e=null,t}return r}(),f=function(){var t=0;return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(e){var i,r=(new Date).getTime();return i=Math.max(0,16-(r-t)),t=r+i,setTimeout(function(){e(r+i)},i)}}(),g={isString:function(t){return"string"==typeof t},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)},isNode:function(t){return t&&t.nodeType},isNodeList:function(t){return"object"==typeof t&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&t.length!==r&&(0===t.length||"object"==typeof t[0]&&t[0].nodeType>0)},isWrapped:function(t){return t&&(t.jquery||e.Zepto&&e.Zepto.zepto.isZ(t))},isSVG:function(t){return e.SVGElement&&t instanceof e.SVGElement},isEmptyObject:function(t){for(var e in t)return!1;return!0}},m=!1;if(t.fn&&t.fn.jquery?(d=t,m=!0):d=e.Velocity.Utilities,8>=p&&!m)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(7>=p)return void(jQuery.fn.velocity=jQuery.fn.animate);var v=400,y="swing",x={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:e.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:d,Redirects:{},Easings:{},Promise:e.Promise,defaults:{queue:"",duration:v,easing:y,begin:r,complete:r,progress:r,display:r,visibility:r,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(t){d.data(t,"velocity",{isSVG:g.isSVG(t),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};e.pageYOffset!==r?(x.State.scrollAnchor=e,x.State.scrollPropertyLeft="pageXOffset",x.State.scrollPropertyTop="pageYOffset"):(x.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,x.State.scrollPropertyLeft="scrollLeft",x.State.scrollPropertyTop="scrollTop");var b=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,i,r){var n={x:e.x+r.dx*i,v:e.v+r.dv*i,tension:e.tension,friction:e.friction};return{dx:n.v,dv:t(n)}}function i(i,r){var n={dx:i.v,dv:t(i)},o=e(i,.5*r,n),s=e(i,.5*r,o),a=e(i,r,s),h=1/6*(n.dx+2*(o.dx+s.dx)+a.dx),l=1/6*(n.dv+2*(o.dv+s.dv)+a.dv);return i.x=i.x+h*r,i.v=i.v+l*r,i}return function r(t,e,n){var o,s,a,h={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1e-4,d=.016;for(t=parseFloat(t)||500,e=parseFloat(e)||20,n=n||null,h.tension=t,h.friction=e,o=null!==n,o?(u=r(t,e),s=u/n*d):s=d;;)if(a=i(a||h,s),l.push(1+a.x),u+=16,!(Math.abs(a.x)>c&&Math.abs(a.v)>c))break;return o?function(t){return l[t*(l.length-1)|0]}:u}}();x.Easings={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},spring:function(t){return 1-Math.cos(4.5*t*Math.PI)*Math.exp(6*-t)}},d.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(t,e){x.Easings[e[0]]=h.apply(null,e[1])});var w=x.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var t=0;t=p)switch(t){case"name":return"filter";case"extract":var r=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=r?r[1]/100:1;case"inject":return e.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(t){case"name":return"opacity";case"extract":return i;case"inject":return i}}},register:function(){9>=p||x.State.isGingerbread||(w.Lists.transformsBase=w.Lists.transformsBase.concat(w.Lists.transforms3D));for(var t=0;tn&&(n=1),o=!/(\d)$/i.test(n);break;case"skew":o=!/(deg|\d)$/i.test(n);break;case"rotate":o=!/(deg|\d)$/i.test(n)}return o||(s(i).transformCache[e]="("+n+")"),s(i).transformCache[e]}}}();for(var t=0;t=p||3!==o.split(" ").length||(o+=" 1"),o;case"inject":return 8>=p?4===n.split(" ").length&&(n=n.split(/\s+/).slice(0,3).join(" ")):3===n.split(" ").length&&(n+=" 1"),(8>=p?"rgb":"rgba")+"("+n.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},SVGAttribute:function(t){var e="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(p||x.State.isAndroid&&!x.State.isChrome)&&(e+="|transform"),new RegExp("^("+e+")$","i").test(t)},prefixCheck:function(t){if(x.State.prefixMatches[t])return[x.State.prefixMatches[t],!0];for(var e=["","Webkit","Moz","ms","O"],i=0,r=e.length;r>i;i++){var n;if(n=0===i?t:e[i]+t.replace(/^\w/,function(t){return t.toUpperCase()}),g.isString(x.State.prefixElement.style[n]))return x.State.prefixMatches[t]=n,[n,!0]}return[t,!1]}},Values:{hexToRgb:function(t){var e,i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return t=t.replace(i,function(t,e,i,r){return e+e+i+i+r+r}),e=r.exec(t),e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]},isCSSNullValue:function(t){return 0==t||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(t)},getUnitType:function(t){return/^(rotate|skew)/i.test(t)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(t)?"":"px"},getDisplayType:function(t){var e=t&&t.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(e)?"inline":/^(li)$/i.test(e)?"list-item":/^(tr)$/i.test(e)?"table-row":/^(table)$/i.test(e)?"table":/^(tbody)$/i.test(e)?"table-row-group":"block"},addClass:function(t,e){t.classList?t.classList.add(e):t.className+=(t.className.length?" ":"")+e},removeClass:function(t,e){t.classList?t.classList.remove(e):t.className=t.className.toString().replace(new RegExp("(^|\\s)"+e.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(t,i,n,o){function a(t,i){function n(){l&&w.setPropertyValue(t,"display","none")}var h=0;if(8>=p)h=d.css(t,i);else{var l=!1;if(/^(width|height)$/.test(i)&&0===w.getPropertyValue(t,"display")&&(l=!0,w.setPropertyValue(t,"display",w.Values.getDisplayType(t))),!o){if("height"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var u=t.offsetHeight-(parseFloat(w.getPropertyValue(t,"borderTopWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderBottomWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingTop"))||0)-(parseFloat(w.getPropertyValue(t,"paddingBottom"))||0);return n(),u}if("width"===i&&"border-box"!==w.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var c=t.offsetWidth-(parseFloat(w.getPropertyValue(t,"borderLeftWidth"))||0)-(parseFloat(w.getPropertyValue(t,"borderRightWidth"))||0)-(parseFloat(w.getPropertyValue(t,"paddingLeft"))||0)-(parseFloat(w.getPropertyValue(t,"paddingRight"))||0);return n(),c}}var f;f=s(t)===r?e.getComputedStyle(t,null):s(t).computedStyle?s(t).computedStyle:s(t).computedStyle=e.getComputedStyle(t,null),"borderColor"===i&&(i="borderTopColor"),h=9===p&&"filter"===i?f.getPropertyValue(i):f[i],(""===h||null===h)&&(h=t.style[i]),n()}if("auto"===h&&/^(top|right|bottom|left)$/i.test(i)){var g=a(t,"position");("fixed"===g||"absolute"===g&&/top|left/i.test(i))&&(h=d(t).position()[i]+"px")}return h}var h;if(w.Hooks.registered[i]){var l=i,u=w.Hooks.getRoot(l);n===r&&(n=w.getPropertyValue(t,w.Names.prefixCheck(u)[0])),w.Normalizations.registered[u]&&(n=w.Normalizations.registered[u]("extract",t,n)),h=w.Hooks.extractValue(l,n)}else if(w.Normalizations.registered[i]){var c,f;c=w.Normalizations.registered[i]("name",t),"transform"!==c&&(f=a(t,w.Names.prefixCheck(c)[0]),w.Values.isCSSNullValue(f)&&w.Hooks.templates[i]&&(f=w.Hooks.templates[i][1])),h=w.Normalizations.registered[i]("extract",t,f)}if(!/^[\d-]/.test(h))if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))if(/^(height|width)$/i.test(i))try{h=t.getBBox()[i]}catch(g){h=0}else h=t.getAttribute(i);else h=a(t,w.Names.prefixCheck(i)[0]);return w.Values.isCSSNullValue(h)&&(h=0),x.debug>=2&&console.log("Get "+i+": "+h),h},setPropertyValue:function(t,i,r,n,o){var a=i;if("scroll"===i)o.container?o.container["scroll"+o.direction]=r:"Left"===o.direction?e.scrollTo(r,o.alternateValue):e.scrollTo(o.alternateValue,r);else if(w.Normalizations.registered[i]&&"transform"===w.Normalizations.registered[i]("name",t))w.Normalizations.registered[i]("inject",t,r),a="transform",r=s(t).transformCache[i];else{if(w.Hooks.registered[i]){var h=i,l=w.Hooks.getRoot(i);n=n||w.getPropertyValue(t,l),r=w.Hooks.injectValue(h,r,n),i=l}if(w.Normalizations.registered[i]&&(r=w.Normalizations.registered[i]("inject",t,r),i=w.Normalizations.registered[i]("name",t)),a=w.Names.prefixCheck(i)[0],8>=p)try{t.style[a]=r}catch(u){x.debug&&console.log("Browser does not support ["+r+"] for ["+a+"]")}else if(s(t)&&s(t).isSVG&&w.Names.SVGAttribute(i))t.setAttribute(i,r);else{var c="webgl"===t.renderer?t.styleGL:t.style;c[a]=r}x.debug>=2&&console.log("Set "+i+" ("+a+"): "+r)}return[a,r]},flushTransformCache:function(t){function e(e){return parseFloat(w.getPropertyValue(t,e))}var i="";if((p||x.State.isAndroid&&!x.State.isChrome)&&s(t).isSVG){var r={translate:[e("translateX"),e("translateY")],skewX:[e("skewX")],skewY:[e("skewY")],scale:1!==e("scale")?[e("scale"),e("scale")]:[e("scaleX"),e("scaleY")],rotate:[e("rotateZ"),0,0]};d.each(s(t).transformCache,function(t){/^translate/i.test(t)?t="translate":/^scale/i.test(t)?t="scale":/^rotate/i.test(t)&&(t="rotate"),r[t]&&(i+=t+"("+r[t].join(" ")+") ",delete r[t]) +})}else{var n,o;d.each(s(t).transformCache,function(e){return n=s(t).transformCache[e],"transformPerspective"===e?(o=n,!0):(9===p&&"rotateZ"===e&&(e="rotate"),void(i+=e+n+" "))}),o&&(i="perspective"+o+" "+i)}w.setPropertyValue(t,"transform",i)}};w.Hooks.register(),w.Normalizations.register(),x.hook=function(t,e,i){var n=r;return t=o(t),d.each(t,function(t,o){if(s(o)===r&&x.init(o),i===r)n===r&&(n=x.CSS.getPropertyValue(o,e));else{var a=x.CSS.setPropertyValue(o,e,i);"transform"===a[0]&&x.CSS.flushTransformCache(o),n=a}}),n};var T=function(){function t(){return a?_.promise||null:h}function n(){function t(){function t(t,e){var i=r,n=r,s=r;return g.isArray(t)?(i=t[0],!g.isArray(t[1])&&/^[\d-]/.test(t[1])||g.isFunction(t[1])||w.RegEx.isHex.test(t[1])?s=t[1]:(g.isString(t[1])&&!w.RegEx.isHex.test(t[1])||g.isArray(t[1]))&&(n=e?t[1]:l(t[1],a.duration),t[2]!==r&&(s=t[2]))):i=t,e||(n=n||a.easing),g.isFunction(i)&&(i=i.call(o,C,S)),g.isFunction(s)&&(s=s.call(o,C,S)),[i||0,n,s]}function c(t,e){var i,r;return r=(e||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(t){return i=t,""}),i||(i=w.Values.getUnitType(t)),[r,i]}function p(){var t={myParent:o.parentNode||i.body,position:w.getPropertyValue(o,"position"),fontSize:w.getPropertyValue(o,"fontSize")},r=t.position===I.lastPosition&&t.myParent===I.lastParent,n=t.fontSize===I.lastFontSize;I.lastParent=t.myParent,I.lastPosition=t.position,I.lastFontSize=t.fontSize;var a=100,h={};if(n&&r)h.emToPx=I.lastEmToPx,h.percentToPxWidth=I.lastPercentToPxWidth,h.percentToPxHeight=I.lastPercentToPxHeight;else{var l=s(o).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");x.init(l),t.myParent.appendChild(l),d.each(["overflow","overflowX","overflowY"],function(t,e){x.CSS.setPropertyValue(l,e,"hidden")}),x.CSS.setPropertyValue(l,"position",t.position),x.CSS.setPropertyValue(l,"fontSize",t.fontSize),x.CSS.setPropertyValue(l,"boxSizing","content-box"),d.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(t,e){x.CSS.setPropertyValue(l,e,a+"%")}),x.CSS.setPropertyValue(l,"paddingLeft",a+"em"),h.percentToPxWidth=I.lastPercentToPxWidth=(parseFloat(w.getPropertyValue(l,"width",null,!0))||1)/a,h.percentToPxHeight=I.lastPercentToPxHeight=(parseFloat(w.getPropertyValue(l,"height",null,!0))||1)/a,h.emToPx=I.lastEmToPx=(parseFloat(w.getPropertyValue(l,"paddingLeft"))||1)/a,t.myParent.removeChild(l)}return null===I.remToPx&&(I.remToPx=parseFloat(w.getPropertyValue(i.body,"fontSize"))||16),null===I.vwToPx&&(I.vwToPx=parseFloat(e.innerWidth)/100,I.vhToPx=parseFloat(e.innerHeight)/100),h.remToPx=I.remToPx,h.vwToPx=I.vwToPx,h.vhToPx=I.vhToPx,x.debug>=1&&console.log("Unit ratios: "+JSON.stringify(h),o),h}if(a.begin&&0===C)try{a.begin.call(f,f)}catch(v){setTimeout(function(){throw v},1)}if("scroll"===M){var b,T,E,A=/^x$/i.test(a.axis)?"Left":"Top",L=parseFloat(a.offset)||0;a.container?g.isWrapped(a.container)||g.isNode(a.container)?(a.container=a.container[0]||a.container,b=a.container["scroll"+A],E=b+d(o).position()[A.toLowerCase()]+L):a.container=null:(b=x.State.scrollAnchor[x.State["scrollProperty"+A]],T=x.State.scrollAnchor[x.State["scrollProperty"+("Left"===A?"Top":"Left")]],E=d(o).offset()[A.toLowerCase()]+L),h={scroll:{rootPropertyValue:!1,startValue:b,currentValue:b,endValue:E,unitType:"",easing:a.easing,scrollData:{container:a.container,direction:A,alternateValue:T}},element:o},x.debug&&console.log("tweensContainer (scroll): ",h.scroll,o)}else if("reverse"===M){if(!s(o).tweensContainer)return void d.dequeue(o,a.queue);"none"===s(o).opts.display&&(s(o).opts.display="auto"),"hidden"===s(o).opts.visibility&&(s(o).opts.visibility="visible"),s(o).opts.loop=!1,s(o).opts.begin=null,s(o).opts.complete=null,y.easing||delete a.easing,y.duration||delete a.duration,a=d.extend({},s(o).opts,a);var R=d.extend(!0,{},s(o).tweensContainer);for(var P in R)if("element"!==P){var F=R[P].startValue;R[P].startValue=R[P].currentValue=R[P].endValue,R[P].endValue=F,g.isEmptyObject(y)||(R[P].easing=a.easing),x.debug&&console.log("reverse tweensContainer ("+P+"): "+JSON.stringify(R[P]),o)}h=R}else if("start"===M){var R;s(o).tweensContainer&&s(o).isAnimating===!0&&(R=s(o).tweensContainer),d.each(m,function(e,i){if(RegExp("^"+w.Lists.colors.join("$|^")+"$").test(e)){var n=t(i,!0),o=n[0],s=n[1],a=n[2];if(w.RegEx.isHex.test(o)){for(var h=["Red","Green","Blue"],l=w.Values.hexToRgb(o),u=a?w.Values.hexToRgb(a):r,c=0;ck;k++){var G={delay:R.delay,progress:R.progress};k===D-1&&(G.display=R.display,G.visibility=R.visibility,G.complete=R.complete),T(f,"reverse",G)}return t()}};x=d.extend(T,x),x.animate=T;var S=e.requestAnimationFrame||f;return x.State.isMobile||i.hidden===r||i.addEventListener("visibilitychange",function(){i.hidden?(S=function(t){return setTimeout(function(){t(!0)},16)},u()):S=e.requestAnimationFrame||f}),t.Velocity=x,t!==e&&(t.fn.velocity=T,t.fn.velocity.defaults=x.defaults),d.each(["Down","Up"],function(t,e){x.Redirects["slide"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l=h.begin,u=h.complete,c={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},p={};h.display===r&&(h.display="Down"===e?"inline"===x.CSS.Values.getDisplayType(t)?"inline-block":"block":"none"),h.begin=function(){var i="webgl"===t.renderer?t.styleGL:t.style;l&&l.call(s,s);for(var r in c){p[r]=i[r];var n=x.CSS.getPropertyValue(t,r);c[r]="Down"===e?[n,0]:[0,n]}p.overflow=i.overflow,i.overflow="hidden"},h.complete=function(){for(var t in p)style[t]=p[t];u&&u.call(s,s),a&&a.resolver(s)},x(t,c,h)}}),d.each(["In","Out"],function(t,e){x.Redirects["fade"+e]=function(t,i,n,o,s,a){var h=d.extend({},i),l={opacity:"In"===e?1:0},u=h.complete;h.complete=n!==o-1?h.begin=null:function(){u&&u.call(s,s),a&&a.resolver(s)},h.display===r&&(h.display="In"===e?"auto":"none"),x(this,l,h)}}),x}(window.jQuery||window.Zepto||window,window,document)}),function(t){t.HTMLGL=t.HTMLGL||{},t.HTMLGL.util={getterSetter:function(t,e,i,r){Object.defineProperty?Object.defineProperty(t,e,{get:i,set:r}):document.__defineGetter__&&(t.__defineGetter__(e,i),t.__defineSetter__(e,r)),t["get"+e]=i,t["set"+e]=r},emitEvent:function(t,e){var i=new MouseEvent(e.type,e);i.dispatcher="html-gl",e.stopPropagation(),t.dispatchEvent(i)}}}(window),function(t){var e=function(){},i=e.prototype;i.getElementByCoordinates=function(e,i){var r,n,o=this;return t.HTMLGL.elements.forEach(function(t){r=document.elementFromPoint(e-parseInt(t.transformObject.translateX||0),i-parseInt(t.transformObject.translateY||0)),o.isChildOf(r,t)&&(n=r)}),n},i.isChildOf=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},t.HTMLGL.GLElementResolver=e}(window),function(t){HTMLGL=t.HTMLGL=t.HTMLGL||{},HTMLGL.JQ_PLUGIN_NAME="htmlgl",HTMLGL.CUSTOM_ELEMENT_TAG_NAME="html-gl",HTMLGL.context=void 0,HTMLGL.stage=void 0,HTMLGL.renderer=void 0,HTMLGL.elements=[],HTMLGL.scrollX=0,HTMLGL.scrollY=0;var e=function(){t.HTMLGL.context=this,this.createStage(),this.updateScrollPosition(),this.initListeners(),this.elementResolver=new t.HTMLGL.GLElementResolver(this),document.body?this.initViewer():document.addEventListener("DOMContentLoaded",this.initViewer.bind(this))},i=e.prototype;i.initViewer=function(){this.createViewer(),this.resizeViewer(),this.appendViewer()},i.initListeners=function(){t.addEventListener("scroll",this.updateScrollPosition.bind(this)),t.addEventListener("resize",this.resizeViewer.bind(this)),document.addEventListener("click",this.onMouseEvent.bind(this),!0),document.addEventListener("mousemove",this.onMouseEvent.bind(this),!0),document.addEventListener("mouseup",this.onMouseEvent.bind(this),!0),document.addEventListener("mousedown",this.onMouseEvent.bind(this),!0),document.addEventListener("touchstart",this.onMouseEvent.bind(this)),document.addEventListener("touchend",this.onMouseEvent.bind(this))},i.updateScrollPosition=function(){var e={};if(void 0!=window.pageYOffset)e={left:pageXOffset,top:pageYOffset};else{var i,r,n=document,o=n.documentElement,s=n.body;i=o.scrollLeft||s.scrollLeft||0,r=o.scrollTop||s.scrollTop||0,e={left:i,top:r}}this.document.x=-e.left,this.document.y=-e.top,t.HTMLGL.scrollX=e.left,t.HTMLGL.scrollY=e.top,this.markStageAsChanged()},i.createViewer=function(){t.HTMLGL.renderer=this.renderer=PIXI.autoDetectRenderer(0,0,{transparent:!0}),this.renderer.view.style.position="fixed",this.renderer.view.style.top="0px",this.renderer.view.style.left="0px",this.renderer.view.style["pointer-events"]="none",this.renderer.view.style.pointerEvents="none"},i.appendViewer=function(){document.body.appendChild(this.renderer.view),requestAnimFrame(this.redrawStage.bind(this))},i.resizeViewer=function(){var e=t.innerWidth,i=t.innerHeight;this.renderer.resize(e,i),this.updateTextures(),this.markStageAsChanged()},i.createStage=function(){t.HTMLGL.stage=this.stage=new PIXI.Stage(16777215),t.HTMLGL.document=this.document=new PIXI.DisplayObjectContainer,this.stage.addChild(t.HTMLGL.document)},i.redrawStage=function(){t.HTMLGL.stage.changed&&(t.HTMLGL.renderer.render(t.HTMLGL.stage),t.HTMLGL.stage.changed=!1)},i.updateTextures=function(){t.HTMLGL.elements.forEach(function(t){t.updateTexture()})},i.onMouseEvent=function(e){var i=e.x||e.pageX,r=e.y||e.pageY,n="html-gl"!==e.dispatcher?this.elementResolver.getElementByCoordinates(i,r):null;n?t.HTMLGL.util.emitEvent(n,e):null},i.markStageAsChanged=function(){t.HTMLGL.stage&&!t.HTMLGL.stage.changed&&(requestAnimFrame(this.redrawStage),t.HTMLGL.stage.changed=!0)},t.HTMLGL.GLContext=e,new e}(window),function(t){var e=function(t,e){this.element=t,this.images=this.element.querySelectorAll("img"),this.callback=e,this.imagesLoaded=this.getImagesLoaded(),this.images.length===this.imagesLoaded?this.onImageLoaded():this.addListeners()},i=e.prototype;i.getImagesLoaded=function(){for(var t=0,e=0;e