/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../geometry","../../core/maybe","../../geometry/support/GeographicTransformation","./PixelBlock","./rasterFormats/RasterCodec","./rasterFunctions/pixelUtils","./rasterFunctions/rasterProjectionHelper","./rasterFunctions/stretchUtils","./rasterFunctions/vectorFieldUtils","./rasterTransforms/utils","../../renderers/support/RasterSymbolizer","../../views/2d/engine/flow/dataUtils","../../geometry/Extent"],(function(e,t,r,o,n,i,s,a,c,l,f,u,m,p){"use strict";let d=function(){function t(){}var d=t.prototype;return d.convertVectorFieldData=function(e){const t=n.fromJSON(e.pixelBlock),o=l.convertVectorFieldData(t,e.type);return Promise.resolve(r.isSome(o)&&o.toJSON())},d.decode=function(){var t=e._asyncToGenerator((function*(e){const t=yield i.decode(e.data,e.options);return t&&t.toJSON()}));function r(e){return t.apply(this,arguments)}return r}(),d.symbolize=function(e){e.pixelBlock=n.fromJSON(e.pixelBlock),e.extent=e.extent?p.fromJSON(e.extent):null;const t=this.symbolizer.symbolize(e);return Promise.resolve(r.isSome(t)&&t.toJSON())},d.updateSymbolizer=function(){var t=e._asyncToGenerator((function*(e){var t;this.symbolizer=u.fromJSON(e.symbolizerJSON),e.histograms&&"rasterStretch"===(null==(t=this.symbolizer)?void 0:t.rendererJSON.type)&&(this.symbolizer.rendererJSON.histograms=e.histograms)}));function r(e){return t.apply(this,arguments)}return r}(),d.stretch=function(e){const t=this.symbolizer.simpleStretch(n.fromJSON(e.srcPixelBlock),e.stretchParams);return Promise.resolve(r.isSome(t)&&t.toJSON())},d.estimateStatisticsHistograms=function(e){const t=c.estimateStatisticsHistograms(n.fromJSON(e.srcPixelBlock));return Promise.resolve(t)},d.split=function(e){const t=s.split(n.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel);return t&&t.forEach(((e,r)=>{t.set(r,null==e?void 0:e.toJSON())})),Promise.resolve(t)},d.mosaicAndTransform=function(){var t=e._asyncToGenerator((function*(e){var t;const o=e.srcPixelBlocks.map((e=>e?new n(e):null)),i=s.mosaic(o,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize});let a,c=i;return e.coefs&&(c=s.approximateTransform(i,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation)),e.projectDirections&&e.gcsGrid&&(a=s.getLocalArithmeticNorthRotations(e.destDimension,e.gcsGrid),c=r.unwrap(l.convertToLocalDirections(c,e.isUV?"vector-uv":"vector-magdir",a))),{pixelBlock:null==(t=c)?void 0:t.toJSON(),localNorthDirections:a}}));function o(e){return t.apply(this,arguments)}return o}(),d.createFlowMesh=function(){var t=e._asyncToGenerator((function*(e,t){const r={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:o,indexData:n}=yield m.createFlowMesh(e.meshType,e.simulationSettings,r,t.signal);return{result:{vertexBuffer:o.buffer,indexBuffer:n.buffer},transferList:[o.buffer,n.buffer]}}));function r(e,r){return t.apply(this,arguments)}return r}(),d.getProjectionOffsetGrid=function(){var t=e._asyncToGenerator((function*(e){const t=p.fromJSON(e.projectedExtent),r=p.fromJSON(e.srcBufferExtent);let n=null;e.datumTransformationSteps&&(n=new o({steps:e.datumTransformationSteps})),(e.includeGCSGrid||a.requirePE(t.spatialReference,r.spatialReference,n))&&(yield a.load());const i=e.rasterTransform?f.readTransform(e.rasterTransform):null;return a.getProjectionOffsetGrid({...e,projectedExtent:t,srcBufferExtent:r,datumTransformation:n,rasterTransform:i})}));function r(e){return t.apply(this,arguments)}return r}(),t}();return d}));
