text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See https://js.arcgis.com/4.11/esri/copyright.txt for details.
  //>>built
  define("require exports ../../core/executeAsync ../../core/ObjectPool ../../core/promiseUtils ../2d/tiling/enums ./BackgroundBucket ./CircleBucket ./FillBucket ./GeometryUtils ./IndexMemoryBuffer ./LineBucket ./Placement ./SymbolBucket ./TileParser ./VertexMemoryBuffer".split(" "),function(N,O,E,F,n,l,G,H,I,t,h,J,K,L,M,f){return function(){function b(){this.rotation=0;this.status=l.TileStatus.INITIALIZED;this._symbolBuckets=[];this.placementEngine=new K.PlacementEngine;this.fillVertexBuffer=new f.FillVertexBuffer(!1);
  this.fillDDVertexBuffer=new f.FillVertexBuffer(!0);this.fillIndexBuffer=new h.TriangleIndexBuffer;this.outlineVertexBuffer=new f.OutlineVertexBuffer(!1);this.outlineDDVertexBuffer=new f.OutlineVertexBuffer(!0);this.outlineIndexBuffer=new h.TriangleIndexBuffer;this.lineVertexBuffer=new f.LineVertexBuffer(!1);this.lineDDVertexBuffer=new f.LineVertexBuffer(!0);this.lineIndexBuffer=new h.TriangleIndexBuffer;this.iconVertexBuffer=new f.SymbolVertexBuffer(!1);this.iconDDVertexBuffer=new f.SymbolVertexBuffer(!0);
  this.iconIndexBuffer=new h.TriangleIndexBuffer;this.textVertexBuffer=new f.SymbolVertexBuffer(!1);this.textDDVertexBuffer=new f.SymbolVertexBuffer(!0);this.textIndexBuffer=new h.TriangleIndexBuffer;this.circleVertexBuffer=new f.CircleVertexBuffer;this.circleIndexBuffer=new h.TriangleIndexBuffer}b.prototype.initialize=function(b,g,a,e){void 0===e&&(e=0);this.tileKey=b;this.refKeys=g;this._workerTileHandler=a;this.rotation=e;this.placementEngine.setAngle(t.C_DEG_TO_RAD*e)};b.prototype.release=function(){this.tileKey=
  "";this.refKeys=null;this.status=l.TileStatus.INITIALIZED;this.rotation=0;this.resetData();this._workerTileHandler=null};b.prototype.resetData=function(){this.fillVertexBuffer.reset();this.fillDDVertexBuffer.reset();this.fillIndexBuffer.reset();this.outlineVertexBuffer.reset();this.outlineDDVertexBuffer.reset();this.outlineIndexBuffer.reset();this.lineVertexBuffer.reset();this.lineDDVertexBuffer.reset();this.lineIndexBuffer.reset();this.iconVertexBuffer.reset();this.iconDDVertexBuffer.reset();this.iconIndexBuffer.reset();
  this.textVertexBuffer.reset();this.textDDVertexBuffer.reset();this.textIndexBuffer.reset();this.circleVertexBuffer.reset();this.circleIndexBuffer.reset();this.placementEngine.reset();this._symbolBuckets.length=0};b.prototype.reparse=function(b){this.resetData();return this.setDataAndParse(this._data,b)};b.prototype.setDataAndParse=function(b,g){var a=this,e=g&&g.signal;if(e){var f=function(){e.removeEventListener("abort",f);a.status=l.TileStatus.INVALID};e.addEventListener("abort",f)}this._data=b;
  return this._parse(b,g).then(function(b){a.status=l.TileStatus.READY;for(var f=new Uint32Array([1,a.fillVertexBuffer.sizeInBytes,2,a.fillDDVertexBuffer.sizeInBytes,3,a.fillIndexBuffer.sizeInBytes,4,a.outlineVertexBuffer.sizeInBytes,5,a.outlineDDVertexBuffer.sizeInBytes,6,a.outlineIndexBuffer.sizeInBytes,7,a.lineVertexBuffer.sizeInBytes,8,a.lineDDVertexBuffer.sizeInBytes,9,a.lineIndexBuffer.sizeInBytes,10,a.iconVertexBuffer.sizeInBytes,11,a.iconDDVertexBuffer.sizeInBytes,12,a.iconIndexBuffer.sizeInBytes,
  13,a.textVertexBuffer.sizeInBytes,14,a.textDDVertexBuffer.sizeInBytes,15,a.textIndexBuffer.sizeInBytes,16,a.circleVertexBuffer.sizeInBytes,17,a.circleIndexBuffer.sizeInBytes]),d=[],g=b.length,e=0;e<g;e++){var c=b[e];if(c instanceof I)d.push(c.layerIndex),d.push(1),d.push(c.fillIndexStart),d.push(c.fillIndexCount),d.push(c.outlineIndexStart),d.push(c.outlineIndexCount);else if(c instanceof J)d.push(c.layerIndex),d.push(2),d.push(c.lineIndexStart),d.push(c.lineIndexCount);else if(c instanceof L){d.push(c.layerIndex);
  d.push(3);d.push(c.sdfMarker?1:0);var m=c.markerPageMap;d.push(m.size);m.forEach(function(a,c){d.push(c);d.push(a[0]);d.push(a[1])});c=c.glyphsPageMap;d.push(c.size);c.forEach(function(a,c){d.push(c);d.push(a[0]);d.push(a[1])})}else c instanceof H?(d.push(c.layerIndex),d.push(4),d.push(c.circleIndexStart),d.push(c.circleIndexCount)):c instanceof G&&(d.push(c.layerIndex),d.push(0))}b=new Uint32Array(d);var g=a.fillVertexBuffer.toBuffer(),e=a.fillDDVertexBuffer.toBuffer(),c=a.fillIndexBuffer.toBuffer(),
  m=a.outlineVertexBuffer.toBuffer(),p=a.outlineDDVertexBuffer.toBuffer(),z=a.outlineIndexBuffer.toBuffer(),w=a.lineVertexBuffer.toBuffer(),A=a.lineDDVertexBuffer.toBuffer(),k=a.lineIndexBuffer.toBuffer(),B=a.iconVertexBuffer.toBuffer(),h=a.iconDDVertexBuffer.toBuffer(),y=a.iconIndexBuffer.toBuffer(),q=a.textVertexBuffer.toBuffer(),x=a.textDDVertexBuffer.toBuffer(),C=a.textIndexBuffer.toBuffer(),D=a.circleVertexBuffer.toBuffer(),n=a.circleIndexBuffer.toBuffer();return{result:{bufferDataInfo:f.buffer,
  bucketDataInfo:b.buffer,bufferData:[g,e,c,m,p,z,w,A,k,B,h,y,q,x,C,D,n]},transferList:[g,e,c,m,p,z,w,A,k,B,h,y,q,x,C,D,n,f.buffer,b.buffer]}})};b.prototype.addBucket=function(b){this._symbolBuckets.push(b)};b.prototype.updateSymbols=function(b){var f=this,a=this._symbolBuckets;if(!a||0===a.length)return n.resolve();this.rotation=b;var e=this.placementEngine;e.reset();e.setAngle(b/256*360*t.C_DEG_TO_RAD);var h=this.iconVertexBuffer;h.reset();var q=this.iconDDVertexBuffer;q.reset();var p=this.iconIndexBuffer;
  p.reset();var d=this.textVertexBuffer;d.reset();var u=this.textDDVertexBuffer;u.reset();var v=this.textIndexBuffer;v.reset();var c=[],m=a.length,r=0;return E(function(){if(f.status===l.TileStatus.INVALID||f.status===l.TileStatus.INITIALIZED)return!0;if(r<m){var b=a[r++];if(b&&b.layer){var w=b.layer;if(b=b.copy(w.hasDataDrivenIcon?q:h,p,w.hasDataDrivenText?u:d,v,e))c.push(b),b.updateSymbols()}}return r>=m}).then(function(){if(f.status===l.TileStatus.INVALID||f.status===l.TileStatus.INITIALIZED||0===
  h.sizeInBytes&&0===q.sizeInBytes&&0===p.sizeInBytes&&0===d.sizeInBytes&&0===u.sizeInBytes&&0===v.sizeInBytes)return{result:null,transferList:null};var a=new Uint32Array([10,h.sizeInBytes,11,q.sizeInBytes,12,p.sizeInBytes,13,d.sizeInBytes,14,u.sizeInBytes,15,v.sizeInBytes]),b=[];m=c.length;for(var e=0;e<m;e++){var k=c[e];b.push(k.layerIndex);b.push(3);b.push(k.sdfMarker?1:0);var g=k.markerPageMap;b.push(g.size);g.forEach(function(a,c){b.push(c);b.push(a[0]);b.push(a[1])});k=k.glyphsPageMap;b.push(k.size);
  k.forEach(function(a,c){b.push(c);b.push(a[0]);b.push(a[1])})}var e=new Uint32Array(b),k=h.toBuffer(),g=q.toBuffer(),n=p.toBuffer(),r=d.toBuffer(),t=u.toBuffer(),x=v.toBuffer();return{result:{bufferDataInfo:a.buffer,bucketDataInfo:e.buffer,bufferData:[k,g,n,r,t,x]},transferList:[k,g,n,r,t,x,a.buffer,e.buffer]}}).catch(function(){return null})};b.prototype.setObsolete=function(){this.status=l.TileStatus.INVALID};b.prototype.getLayers=function(){return this._workerTileHandler.getLayers()};b.prototype.getWorkerTileHandler=
  function(){return this._workerTileHandler};b.prototype._parse=function(b,f){if(0===Object.keys(b).length)return n.resolve([]);this.status=l.TileStatus.MODIFIED;return(new M(b,this,f.client)).parse()};b.pool=new F(b);return b}()});