text: /**
   * Hilo 1.1.2 for commonjs
   * Copyright 2016 alibaba.com
   * Licensed under the MIT License
   */
  var Class=require("../core/Class"),TextureAtlas=function(){function r(r){var t,e,n=r.frames;if(!n)return null;var a,i=[];if(n instanceof Array)for(t=0,e=n.length;t<e;t++)a=n[t],i[t]={image:r.image,rect:a};else{var s=n.frameWidth,o=n.frameHeight,f=r.width/s|0,u=r.height/o|0,l=n.numFrames||f*u;for(t=0;t<l;t++)i[t]={image:r.image,rect:[t%f*s,(t/f|0)*o,s,o]}}return i}function t(r,t){var a,i,s=r.sprites;if(!s)return null;var o,f,u,l={};for(var c in s){if(o=s[c],n(o))f=e(t[o]);else if(o instanceof Array)for(f=[],a=0,i=o.length;a<i;a++){var m,h=o[a];n(h)?u=e(t[h]):(m=h.rect,n(m)&&(m=t[h.rect]),u=e(m,h)),f[a]=u}else for(f=[],a=o.from;a<=o.to;a++)f[a-o.from]=e(t[a],o[a]);l[c]=f}return l}function e(r,t){var e={image:r.image,rect:r.rect};return t&&(e.name=t.name||null,e.duration=t.duration||0,e.stop=!!t.stop,e.next=t.next||null),e}function n(r){return"number"==typeof r}return Class.create({constructor:function(e){this._frames=r(e),this._sprites=t(e,this._frames)},_frames:null,_sprites:null,getFrame:function(r){var t=this._frames;return t&&t[r]},getSprite:function(r){var t=this._sprites;return t&&t[r]},Statics:{createSpriteFrames:function(r,t,e,n,a,i,s){var o,f;if("[object Array]"===Object.prototype.toString.call(r)){var u=[];for(o=0,f=r.length;o<f;o++)u=u.concat(this.createSpriteFrames.apply(this,r[o]));return u}if("string"==typeof t){var l=t.split(",");t=[];for(var c=0,m=l.length;c<m;c++){var h=l[c].split("-");if(1==h.length)t.push(parseInt(h[0]));else for(o=parseInt(h[0]),f=parseInt(h[1]);o<=f;o++)t.push(o)}}var p=Math.floor(e.width/n);for(o=0;o<t.length;o++){var g=t[o];t[o]={rect:[n*(g%p),a*Math.floor(g/p),n,a],image:e,duration:s}}return t[0].name=r,i?t[t.length-1].next=r:t[t.length-1].stop=!0,t}}})}();module.exports=TextureAtlas;