// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/layers/vectorTiles/views/vectorTiles/SpriteSource","require exports ../../core/tsSupport/extendsHelper ../../core/tsSupport/decorateHelper dojo/Deferred ../../request ../../kernel ../../core/promiseUtils".split(" "),function(q,r,t,u,n,p,k,l){return function(){function c(b,f){this.baseURL=b;this.devicePixelRatio=f;this._isRetina=!1;this._spritesData={};this.height=this.width=this.image=null;this.loadStatus="not-loaded"}Object.defineProperty(c.prototype,"spriteNames",{get:function(){var b=
[],f;for(f in this._spritesData)b.push(f);b.sort();return b},enumerable:!0,configurable:!0});c.prototype.getSpriteInfo=function(b){return this._spritesData[b]};c.prototype.load=function(){var b=this;this.loadStatus="loading";return this.baseURL?this._loadSprites().then(function(){b.loadStatus="loaded";return b}).otherwise(function(f){b.loadStatus="failed";return b}):l.resolve(this)};c.prototype._loadSprites=function(){var b=this;this._isRetina=1.15<this.devicePixelRatio?!0:!1;var f=this.baseURL,c=
this._isRetina?"@2x":"";return p(f+c+".json",{callbackParamName:"callback",responseType:"json"}).then(function(g){var h=Object.keys(g.data);if(0===h.length||1===h.length&&"_ssl"===h[0])return l.resolve(null);b._spritesData=g.data;var m=new n,d=new Image;d.crossOrigin="anonymous";d.onload=function(){d.onload=null;b.width=d.width;b.height=d.height;var a=document.createElement("canvas");a.width=d.width;a.height=d.height;a=a.getContext("2d");a.drawImage(d,0,0,d.width,d.height);for(var a=a.getImageData(0,
0,d.width,d.height),a=new Uint8Array(a.data),c,e=0;e<a.length;e+=4)c=a[e+3]/255,a[e]*=c,a[e+1]*=c,a[e+2]*=c;b.image=a;m.resolve()};g=""+f+c+".png";k.id&&(h=k.id.findCredential(g))&&h.token&&(g+="?token\x3d"+h.token);d.src=g;return m})};return c}()});