ImageryTileLayer-AO5DNGYN.js 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751
  1. import {
  2. d as d3,
  3. h,
  4. i as i3,
  5. m as m7,
  6. x as x4
  7. } from "./chunk-3G6RGU7K.js";
  8. import {
  9. c as c4,
  10. f as f2,
  11. i as i4,
  12. m as m8
  13. } from "./chunk-H5YUUUE4.js";
  14. import {
  15. D as D2,
  16. F,
  17. H,
  18. V,
  19. X,
  20. _,
  21. ee,
  22. k as k4,
  23. te as te2,
  24. v as v3
  25. } from "./chunk-Y4GPJDDM.js";
  26. import {
  27. B,
  28. I,
  29. i,
  30. i3 as i2,
  31. k as k3,
  32. l as l3,
  33. m as m4,
  34. m2 as m6,
  35. n2 as n4,
  36. o as o4,
  37. o2 as o5,
  38. p as p2,
  39. r as r3,
  40. s as s3,
  41. te,
  42. u as u4
  43. } from "./chunk-4LBZICSO.js";
  44. import {
  45. D,
  46. N,
  47. P,
  48. S as S4,
  49. U as U3,
  50. b as b2,
  51. c as c3,
  52. k as k2,
  53. l as l4,
  54. m as m5,
  55. n as n5,
  56. p as p3,
  57. r as r4,
  58. r2 as r5,
  59. x as x3
  60. } from "./chunk-ZBREIOZ2.js";
  61. import {
  62. m as m3,
  63. p,
  64. u as u3,
  65. u2 as u5
  66. } from "./chunk-FUB4YNLX.js";
  67. import {
  68. C,
  69. M as M2,
  70. U as U2,
  71. u,
  72. u2,
  73. x as x2
  74. } from "./chunk-EE6TL7XD.js";
  75. import "./chunk-USORKAIZ.js";
  76. import "./chunk-7SW2GQFP.js";
  77. import "./chunk-TRK7CKWP.js";
  78. import "./chunk-EGVIPYN2.js";
  79. import "./chunk-YASLQAXE.js";
  80. import "./chunk-VEAEIBHK.js";
  81. import "./chunk-6SASJ6IM.js";
  82. import "./chunk-3OHML7FO.js";
  83. import {
  84. x
  85. } from "./chunk-2VFJVI2I.js";
  86. import "./chunk-7IKYLNB5.js";
  87. import "./chunk-P4UZNLD5.js";
  88. import "./chunk-DH2OBAUC.js";
  89. import "./chunk-TNLRDNTC.js";
  90. import {
  91. a as a3
  92. } from "./chunk-435DJNTD.js";
  93. import "./chunk-T3EUPDKL.js";
  94. import "./chunk-2SJEIKRW.js";
  95. import "./chunk-PHRSJJ3U.js";
  96. import {
  97. n as n3,
  98. z
  99. } from "./chunk-VZFBPND4.js";
  100. import "./chunk-WR32EHFC.js";
  101. import {
  102. o as o3
  103. } from "./chunk-6B2LQBKM.js";
  104. import {
  105. d as d2
  106. } from "./chunk-MFI6BALW.js";
  107. import {
  108. o as o2
  109. } from "./chunk-FUD7XO3N.js";
  110. import "./chunk-6EU7GFUT.js";
  111. import "./chunk-MFUAILAT.js";
  112. import "./chunk-HZJYXMI6.js";
  113. import "./chunk-27P5ZSC7.js";
  114. import "./chunk-UPD4MTCL.js";
  115. import "./chunk-GRBROWI6.js";
  116. import "./chunk-5NKYXKIA.js";
  117. import "./chunk-FTI5VP6T.js";
  118. import "./chunk-RZFGRBD7.js";
  119. import {
  120. B as B2
  121. } from "./chunk-PUSPZYFZ.js";
  122. import "./chunk-EN7YGJWG.js";
  123. import "./chunk-VBNMTM7L.js";
  124. import "./chunk-3D3QEPRE.js";
  125. import "./chunk-JFNNSBWL.js";
  126. import {
  127. S as S3
  128. } from "./chunk-X7DBH4KK.js";
  129. import "./chunk-LY74KTXV.js";
  130. import "./chunk-522WBHUO.js";
  131. import "./chunk-WNCU6BFU.js";
  132. import "./chunk-PIGRDDRG.js";
  133. import {
  134. y
  135. } from "./chunk-BJHM4JNS.js";
  136. import "./chunk-F6A2QQ26.js";
  137. import "./chunk-EOSZHC5H.js";
  138. import "./chunk-C43UE3Z5.js";
  139. import "./chunk-H2KDMZTR.js";
  140. import "./chunk-RMX2AZ4P.js";
  141. import "./chunk-NE3ESGA6.js";
  142. import {
  143. l as l2
  144. } from "./chunk-YIS6BAC3.js";
  145. import "./chunk-7XXXCK2A.js";
  146. import {
  147. r as r2
  148. } from "./chunk-7ZIDBK7B.js";
  149. import {
  150. v as v2
  151. } from "./chunk-KHA63LLS.js";
  152. import {
  153. c as c2
  154. } from "./chunk-FGKNEJKJ.js";
  155. import {
  156. c,
  157. f
  158. } from "./chunk-PSV473TI.js";
  159. import {
  160. O
  161. } from "./chunk-I3OBGWNS.js";
  162. import "./chunk-FONIFA5N.js";
  163. import "./chunk-EG5OI4V4.js";
  164. import "./chunk-65BYCSII.js";
  165. import "./chunk-WZQZRKNH.js";
  166. import "./chunk-LRDX4TO7.js";
  167. import "./chunk-6A4U74YA.js";
  168. import {
  169. S as S2
  170. } from "./chunk-RBZL6SRZ.js";
  171. import {
  172. n as n2
  173. } from "./chunk-CYI7KFYB.js";
  174. import {
  175. a as a2
  176. } from "./chunk-5LXROFTA.js";
  177. import "./chunk-GJXW4HL5.js";
  178. import "./chunk-WJW5DUN6.js";
  179. import {
  180. t as t2
  181. } from "./chunk-W72F6AS3.js";
  182. import "./chunk-PJ7ZQ4VD.js";
  183. import "./chunk-WDLTDV2L.js";
  184. import "./chunk-TERAW6FT.js";
  185. import "./chunk-N2663GRX.js";
  186. import "./chunk-O4FY3ITT.js";
  187. import "./chunk-WEMIK25H.js";
  188. import {
  189. b
  190. } from "./chunk-4DDBH2K5.js";
  191. import "./chunk-7N4X6GF3.js";
  192. import "./chunk-JXW4QTJA.js";
  193. import "./chunk-UXF37FQ4.js";
  194. import "./chunk-ZOEK6QHJ.js";
  195. import "./chunk-XNLG7T2T.js";
  196. import "./chunk-IR4PV7VK.js";
  197. import "./chunk-2Z6LERTI.js";
  198. import "./chunk-OWVBLVP3.js";
  199. import "./chunk-AFZ7XSEW.js";
  200. import "./chunk-EGZW6HC3.js";
  201. import "./chunk-4NKD334K.js";
  202. import "./chunk-65K7LC56.js";
  203. import "./chunk-ATPLLI5W.js";
  204. import "./chunk-WJ3OEUD3.js";
  205. import "./chunk-MXB2XLKV.js";
  206. import "./chunk-XH7RUGVZ.js";
  207. import "./chunk-TBBTRX4O.js";
  208. import {
  209. m as m2
  210. } from "./chunk-YBSUITLL.js";
  211. import "./chunk-ALDCDSPV.js";
  212. import "./chunk-DT6EAZQ5.js";
  213. import "./chunk-HNOZUNJ4.js";
  214. import {
  215. U
  216. } from "./chunk-VNFRAYHO.js";
  217. import "./chunk-R5IG2D6H.js";
  218. import {
  219. j as j2
  220. } from "./chunk-VBRY5KJM.js";
  221. import "./chunk-PDKDCAAD.js";
  222. import {
  223. M2 as M,
  224. j2 as j,
  225. o
  226. } from "./chunk-ECW2QABR.js";
  227. import "./chunk-GCDJLKH4.js";
  228. import {
  229. R,
  230. k2 as k
  231. } from "./chunk-MRJEICT6.js";
  232. import {
  233. d,
  234. e,
  235. l3 as l,
  236. n2 as n
  237. } from "./chunk-Y3WMVFTW.js";
  238. import "./chunk-SAS7RONY.js";
  239. import "./chunk-WSRBH7BF.js";
  240. import {
  241. S
  242. } from "./chunk-IHXECKQQ.js";
  243. import {
  244. E,
  245. m,
  246. v,
  247. w
  248. } from "./chunk-ULGDPLM2.js";
  249. import {
  250. s,
  251. s3 as s2
  252. } from "./chunk-EMJ4ZSM2.js";
  253. import "./chunk-IKP3YN53.js";
  254. import {
  255. a,
  256. e as e2,
  257. r,
  258. t
  259. } from "./chunk-GZT4BVFP.js";
  260. import "./chunk-A5ICIBVI.js";
  261. // node_modules/@arcgis/core/layers/mixins/ImageryTileMixin.js
  262. var j3 = s.getLogger("esri.layers.mixins.ImageryTileMixin");
  263. var H2 = (i6) => {
  264. let H3 = class extends i6 {
  265. constructor() {
  266. super(...arguments), this._rasterJobHandler = { instance: null, refCount: 0, connectionPromise: null }, this.bandIds = null, this.copyright = null, this.fullExtent = null, this.interpolation = "nearest", this.multidimensionalDefinition = null, this.raster = null, this.rasterInfo = null, this.sourceJSON = null, this.spatialReference = null, this.tileInfo = null, this.symbolizer = null;
  267. }
  268. set url(e4) {
  269. this._set("url", S3(e4, j3));
  270. }
  271. set renderer(e4) {
  272. this._set("renderer", e4), this.updateRenderer();
  273. }
  274. async convertVectorFieldData(e4, t5) {
  275. if (t(e4))
  276. return null;
  277. const r7 = this._rasterJobHandler.instance, i7 = this.rasterInfo.dataType;
  278. return r7 ? r7.convertVectorFieldData({ pixelBlock: e4, dataType: i7 }, t5) : m3(e4, i7);
  279. }
  280. async createFlowMesh(e4, t5) {
  281. const r7 = this._rasterJobHandler.instance;
  282. return r7 ? r7.createFlowMesh(e4, t5) : u5(e4.meshType, e4.simulationSettings, e4.flowData, r(t5.signal) ? t5.signal : new AbortController().signal);
  283. }
  284. normalizeRasterFetchOptions(e4) {
  285. const { multidimensionalInfo: t5 } = this.rasterInfo;
  286. if (t(t5))
  287. return e4;
  288. let r7 = e4.multidimensionalDefinition || this.multidimensionalDefinition;
  289. !t(r7) && r7.length || (r7 = i2(this.raster.rasterInfo));
  290. const i7 = e4.timeExtent || this.timeExtent;
  291. if (r(r7) && r(i7) && (r(i7.start) || r(i7.end))) {
  292. r7 = r7.map((e5) => e5.clone());
  293. const o8 = t5.variables.find(({ name: e5 }) => e5 === r7[0].variableName)?.dimensions?.find(({ name: e5 }) => e5 === "StdTime"), a4 = r7.find(({ dimensionName: e5 }) => e5 === "StdTime");
  294. if (!o8 || !a4)
  295. return { ...e4, multidimensionalDefinition: null };
  296. const { start: l6, end: m10 } = i7, d5 = t(l6) ? null : l6.getTime(), u8 = t(m10) ? null : m10.getTime(), p4 = d5 ?? u8, h3 = u8 ?? d5;
  297. if (r(o8.values)) {
  298. const e5 = o8.values.filter((e6) => {
  299. if (Array.isArray(e6)) {
  300. if (p4 === h3)
  301. return e6[0] <= p4 && e6[1] >= p4;
  302. const t6 = e6[0] <= p4 && e6[1] > p4 || e6[0] < h3 && e6[1] >= h3, r8 = e6[0] >= p4 && e6[1] <= h3 || e6[0] < p4 && e6[1] > h3;
  303. return t6 || r8;
  304. }
  305. return p4 === h3 ? e6 === p4 : e6 >= p4 && e6 <= h3;
  306. });
  307. if (e5.length) {
  308. const t6 = e5.sort((e6, t7) => {
  309. if (p4 === h3)
  310. return (e6[0] ?? e6) - (t7[0] ?? t7);
  311. return Math.abs((e6[1] ?? e6) - h3) - Math.abs((t7[1] ?? t7) - h3);
  312. })[0];
  313. a4.values = [t6];
  314. } else
  315. r7 = null;
  316. } else if (o8.hasRegularIntervals && o8.extent) {
  317. const [e5, t6] = o8.extent;
  318. p4 > t6 || h3 < e5 ? r7 = null : a4.values = p4 === h3 ? [p4] : [Math.max(e5, p4), Math.min(t6, h3)];
  319. }
  320. }
  321. return { ...e4, multidimensionalDefinition: r7 };
  322. }
  323. async updateRenderer() {
  324. if (!this.loaded)
  325. return;
  326. if (JSON.stringify(this._cachedRendererJson) === JSON.stringify(this.renderer))
  327. return;
  328. const e4 = this._rasterJobHandler.instance;
  329. e4 && (this.symbolizer.rendererJSON = te(this.renderer.toJSON()), this.symbolizer.bind(), await e4.updateSymbolizer(this.symbolizer), this._cachedRendererJson = this.renderer.toJSON());
  330. }
  331. async applyRenderer(e4, t5) {
  332. const r7 = e4 && e4.pixelBlock;
  333. if (!(r(r7) && r7.pixels && r7.pixels.length > 0))
  334. return null;
  335. let i7;
  336. await this.updateRenderer();
  337. const s4 = this._rasterJobHandler.instance, { bandIds: o8 } = this;
  338. return i7 = s4 ? await s4.symbolize({ ...e4, simpleStretchParams: t5, bandIds: o8 }) : this.symbolizer.symbolize({ ...e4, simpleStretchParams: t5, bandIds: o8 }), i7;
  339. }
  340. getTileUrl(e4, t5, r7) {
  341. return this.raster.datasetFormat === "RasterTileServer" ? `${this.url}/tile/${e4}/${t5}/${r7}` : "";
  342. }
  343. getCompatibleTileInfo(e4, t5, r7 = false) {
  344. if (!this.loaded || t(t5))
  345. return null;
  346. if (r7 && e4.equals(this.spatialReference))
  347. return this.tileInfo;
  348. const i7 = R(e4);
  349. return S2.create({ size: 256, spatialReference: e4, origin: i7 ? { x: i7.origin[0], y: i7.origin[1] } : { x: t5.xmin, y: t5.ymax } });
  350. }
  351. getCompatibleFullExtent(e4) {
  352. return this.loaded ? (this._compatibleFullExtent && this._compatibleFullExtent.spatialReference.equals(e4) || (this._compatibleFullExtent = this.raster.computeExtent(e4)), this._compatibleFullExtent) : null;
  353. }
  354. async fetchTile(e4, t5, i7, o8 = {}) {
  355. if (o8.requestAsImageElement) {
  356. const s4 = this.getTileUrl(e4, t5, i7);
  357. return U(s4, { responseType: "image", query: { ...this.refreshParameters, ...this.raster.ioConfig.customFetchParameters }, signal: o8.signal }).then((e5) => e5.data);
  358. }
  359. if (r(this.rasterInfo.multidimensionalInfo) && (o8 = this.normalizeRasterFetchOptions(o8), t(o8.multidimensionalDefinition))) {
  360. const r7 = o8.tileInfo || this.rasterInfo.storageInfo.tileInfo;
  361. return { extent: this.raster.getTileExtentFromTileInfo(e4, t5, i7, r7), pixelBlock: null };
  362. }
  363. return await this._initJobHandler(), this.renderer.type === "raster-shaded-relief" && (o8 = { ...o8, buffer: { cols: 1, rows: 1 } }), this.raster.fetchTile(e4, t5, i7, o8);
  364. }
  365. async fetchPixels(e4, t5, r7, i7 = {}) {
  366. return r(this.rasterInfo.multidimensionalInfo) && (i7 = this.normalizeRasterFetchOptions(i7), t(i7.multidimensionalDefinition)) ? { extent: e4, pixelBlock: null } : (await this._initJobHandler(), this.raster.fetchPixels(e4, t5, r7, i7));
  367. }
  368. async identify(e4, t5 = {}) {
  369. if (r(this.rasterInfo.multidimensionalInfo)) {
  370. if (!(this.rasterInfo.hasMultidimensionalTranspose && !!(o5(t5.multidimensionalDefinition) || t5.transposedVariableName || t5.timeExtent)) && (t5 = this.normalizeRasterFetchOptions(t5), t(t5.multidimensionalDefinition)))
  371. return { location: e4, value: null };
  372. }
  373. return this.raster.identify(e4, t5);
  374. }
  375. increaseRasterJobHandlerUsage() {
  376. this._rasterJobHandler.refCount++;
  377. }
  378. decreaseRasterJobHandlerUsage() {
  379. this._rasterJobHandler.refCount--, this._rasterJobHandler.refCount <= 0 && this._shutdownJobHandler();
  380. }
  381. hasStandardTime() {
  382. const e4 = this.rasterInfo.multidimensionalInfo;
  383. if (t(e4) || this.rasterInfo.dataType !== "standard-time")
  384. return false;
  385. const t5 = this.multidimensionalDefinition[0]?.variableName;
  386. return e4.variables.some((e5) => e5.name === t5 && e5.dimensions.some((e6) => e6.name === "StdTime"));
  387. }
  388. getStandardTimeValue(e4) {
  389. return new Date(24 * (e4 - 25569) * 3600 * 1e3).toString();
  390. }
  391. _configDefaultSettings() {
  392. this._configDefaultInterpolation(), this.multidimensionalDefinition || (this.multidimensionalDefinition = i2(this.raster.rasterInfo)), this._configDefaultRenderer();
  393. }
  394. _initJobHandler() {
  395. if (this._rasterJobHandler.connectionPromise != null)
  396. return this._rasterJobHandler.connectionPromise;
  397. const e4 = new n4();
  398. return this._rasterJobHandler.connectionPromise = e4.initialize().then(() => {
  399. this._rasterJobHandler.instance = e4, this.raster.rasterJobHandler = e4, this.renderer && this.updateRenderer();
  400. }).catch(() => null), this._rasterJobHandler.connectionPromise;
  401. }
  402. _shutdownJobHandler() {
  403. this._rasterJobHandler.instance && this._rasterJobHandler.instance.destroy(), this._rasterJobHandler.instance = null, this._rasterJobHandler.connectionPromise = null, this._rasterJobHandler.refCount = 0, this.raster.rasterJobHandler = null, this._cachedRendererJson = null;
  404. }
  405. _configDefaultInterpolation() {
  406. if (this.interpolation == null) {
  407. const e4 = I(this.rasterInfo, this.raster.tileType, this.sourceJSON?.defaultResamplingMethod);
  408. this._set("interpolation", e4);
  409. }
  410. }
  411. _configDefaultRenderer() {
  412. const e4 = this.raster.rasterInfo;
  413. if (this.bandIds || (this.bandIds = B(e4)), !this.renderer) {
  414. const t6 = k3(e4, { bandIds: this.bandIds, variableName: r(this.multidimensionalDefinition) ? this.multidimensionalDefinition[0]?.variableName : null });
  415. this.raster.datasetFormat === "WCSServer" && t6.type === "raster-stretch" && (e4.statistics?.[0].max > 1e24 || e4.statistics?.[0].min < -1e24) && (t6.dynamicRangeAdjustment = true, t6.statistics = null, t6.stretchType === "none" && (t6.stretchType = "min-max")), this.renderer = t6;
  416. }
  417. this.symbolizer ? (this.symbolizer.rendererJSON = te(this.renderer.toJSON()), this.symbolizer.rasterInfo = e4) : this.symbolizer = new U3({ rendererJSON: this.renderer.toJSON(), rasterInfo: e4 });
  418. const t5 = this.symbolizer.bind();
  419. t5.success || j3.warn("imagery-tile-mixin", t5.error || "The given renderer is not supported by the layer.");
  420. }
  421. };
  422. return e([d()], H3.prototype, "_cachedRendererJson", void 0), e([d()], H3.prototype, "_compatibleFullExtent", void 0), e([d()], H3.prototype, "_rasterJobHandler", void 0), e([d()], H3.prototype, "bandIds", void 0), e([d({ json: { origins: { service: { read: { source: "copyrightText" } } } } })], H3.prototype, "copyright", void 0), e([d({ type: M, json: { read: false } }), o2("rasterInfo.extent")], H3.prototype, "fullExtent", void 0), e([d()], H3.prototype, "interpolation", void 0), e([d()], H3.prototype, "ioConfig", void 0), e([d({ type: [p2] })], H3.prototype, "multidimensionalDefinition", void 0), e([d()], H3.prototype, "raster", void 0), e([d({ readOnly: true }), o2("raster.rasterInfo")], H3.prototype, "rasterInfo", void 0), e([d()], H3.prototype, "sourceJSON", void 0), e([d({ type: k, json: { read: false } }), o2("rasterInfo.spatialReference")], H3.prototype, "spatialReference", void 0), e([d({ type: S2, json: { read: false } }), o2("rasterInfo.storageInfo.tileInfo")], H3.prototype, "tileInfo", void 0), e([d(f)], H3.prototype, "url", null), e([d({ types: l3 })], H3.prototype, "renderer", null), e([d()], H3.prototype, "symbolizer", void 0), H3 = e([n("esri.layers.ImageryTileMixin")], H3), H3;
  423. };
  424. // node_modules/@arcgis/core/layers/support/rasterDatasets/BaseRaster.js
  425. var q = 8;
  426. var G = class extends m2(l) {
  427. constructor() {
  428. super(...arguments), this.rasterJobHandler = null, this.datasetName = null, this.datasetFormat = null, this.rasterInfo = null, this.ioConfig = { sampling: "closest" };
  429. }
  430. async init() {
  431. const t5 = k4();
  432. this.addResolvingPromise(t5), await this.when();
  433. }
  434. normalizeCtorArgs(t5) {
  435. return t5 && t5.ioConfig && (t5 = { ...t5, ioConfig: { resolution: null, bandIds: null, sampling: "closest", tileInfo: S2.create(), ...t5.ioConfig } }), t5;
  436. }
  437. get _isGlobalWrappableSource() {
  438. const { rasterInfo: t5 } = this, e4 = X(t5.spatialReference);
  439. return r(e4) && t5.extent.width >= e4 / 2;
  440. }
  441. set url(t5) {
  442. this._set("url", S3(t5, s.getLogger(this.declaredClass)));
  443. }
  444. async open(t5) {
  445. throw new s2("BaseRaster:open-not-implemented", "open() is not implemented");
  446. }
  447. async fetchTile(t5, e4, i6, o8 = {}) {
  448. const r7 = o8.tileInfo || this.rasterInfo.storageInfo.tileInfo, n8 = this.getTileExtentFromTileInfo(t5, e4, i6, r7);
  449. return this.fetchPixels(n8, r7.size[0], r7.size[1], o8);
  450. }
  451. async identify(t5, e4 = {}) {
  452. const { multidimensionalDefinition: i6, timeExtent: o8 } = e4, { hasMultidimensionalTranspose: r7, multidimensionalInfo: l6 } = this.rasterInfo;
  453. let { transposedVariableName: c7 } = e4;
  454. const m10 = r(l6) && r7 && (o8 != null || o5(i6));
  455. if (m10 && !c7) {
  456. c7 = r(i6) && i6.length > 0 ? i6[0].variableName : l6.variables[0].name, e4 = { ...e4, transposedVariableName: c7 };
  457. }
  458. e4 = this._getRequestOptionsWithSliceId(e4);
  459. const { spatialReference: f5, extent: h3 } = this.rasterInfo, { datumTransformation: u8 } = e4;
  460. let p4 = _(t5, f5, u8);
  461. if (!h3.intersects(p4))
  462. return { location: p4, value: null };
  463. if (r(this.rasterInfo.transform)) {
  464. const t6 = this.rasterInfo.transform.inverseTransform(p4);
  465. if (!this.rasterInfo.nativeExtent.intersects(t6))
  466. return { location: t6, value: null };
  467. p4 = t6;
  468. }
  469. let d5 = 0;
  470. const g = c7 && r(l6) && this.rasterInfo.hasMultidimensionalTranspose;
  471. if (!g) {
  472. if (e4.srcResolution) {
  473. d5 = te2(e4.srcResolution, this.rasterInfo, this.ioConfig.sampling).pyramidLevel;
  474. } else if (d5 = await this.computeBestPyramidLevelForLocation(t5, e4), d5 == null)
  475. return { location: p4, value: null };
  476. }
  477. const y4 = this.identifyPixelLocation(p4, d5, null, g);
  478. if (y4 === null)
  479. return { location: p4, value: null };
  480. const { row: I5, col: b5, rowOffset: v4, colOffset: S8, blockWidth: T } = y4, B3 = c7 ?? e2(e4.sliceId), P2 = i3(this.url, B3), W = `${d5}/${I5}/${b5}`;
  481. let M3 = m7(P2, null, W);
  482. t(M3) && (M3 = this.fetchRawTile(d5, I5, b5, e4), x4(P2, null, W, M3));
  483. const j4 = await M3;
  484. if (t(j4) || !j4.pixels?.length)
  485. return { location: p4, value: null };
  486. const H3 = v4 * T + S8;
  487. return this._processIdentifyResult(j4, { srcLocation: p4, position: H3, pyramidLevel: d5, useTransposedTile: g, requestSomeSlices: m10, identifyOptions: e4 });
  488. }
  489. async fetchPixels(t5, e4, i6, o8 = {}) {
  490. if (t5 = ee(t5), (o8 = this._getRequestOptionsWithSliceId(o8)).requestRawData)
  491. return this._fetchPixels(t5, e4, i6, o8);
  492. const r7 = X(t5.spatialReference), n8 = D2(t5);
  493. if (t(r7) || n8 === 0 || n8 === 1 && this._isGlobalWrappableSource)
  494. return this._fetchPixels(t5, e4, i6, o8);
  495. if (n8 >= 3)
  496. return { extent: t5, pixelBlock: null };
  497. const s4 = [], { xmin: l6, xmax: c7 } = t5, m10 = Math.round(r7 / (c7 - l6) * e4), f5 = m10 - Math.round((r7 / 2 - l6) / (c7 - l6) * e4);
  498. let h3 = 0;
  499. const u8 = [];
  500. for (let a4 = 0; a4 <= n8; a4++) {
  501. const p5 = new M({ xmin: a4 === 0 ? l6 : -r7 / 2, xmax: a4 === n8 ? c7 - r7 * a4 : r7 / 2, ymin: t5.ymin, ymax: t5.ymax, spatialReference: t5.spatialReference }), d6 = a4 === 0 ? m10 - f5 : a4 === n8 ? e4 - h3 : m10;
  502. h3 += d6, u8.push(d6);
  503. const x7 = o8.disableWrapAround && a4 > 0 ? null : this._fetchPixels(p5, d6, i6, o8);
  504. s4.push(x7);
  505. }
  506. const p4 = (await Promise.all(s4)).map((t6) => t6?.pixelBlock);
  507. let d5 = null;
  508. const x6 = { width: e4, height: i6 };
  509. if (this.rasterJobHandler) {
  510. d5 = (await this.rasterJobHandler.mosaicAndTransform({ srcPixelBlocks: p4, srcMosaicSize: x6, destDimension: null, coefs: null, sampleSpacing: null, interpolation: "nearest", alignmentInfo: null, blockWidths: u8 }, o8)).pixelBlock;
  511. } else
  512. d5 = u2(p4, x6, { blockWidths: u8 });
  513. return { extent: t5, srcExtent: F(t5, this.rasterInfo.spatialReference, o8.datumTransformation), pixelBlock: d5 };
  514. }
  515. async fetchRawPixels(t5, e4, i6, o8 = {}) {
  516. e4 = { x: Math.floor(e4.x), y: Math.floor(e4.y) };
  517. const r7 = await this._fetchRawTiles(t5, e4, i6, o8), { nativeExtent: s4, nativePixelSize: a4, storageInfo: l6 } = this.rasterInfo, c7 = 2 ** t5, m10 = a4.x * c7, f5 = a4.y * c7, h3 = new M({ xmin: s4.xmin + m10 * e4.x, xmax: s4.xmin + m10 * (e4.x + i6.width - 1), ymin: s4.ymax - f5 * (e4.y + i6.height - 1), ymax: s4.ymax - f5 * e4.y, spatialReference: s4.spatialReference });
  518. if (!r7)
  519. return { extent: h3, srcExtent: h3, pixelBlock: null };
  520. const { pixelBlocks: u8, mosaicSize: p4 } = r7;
  521. if (u8.length === 1 && r(u8[0]) && u8[0].width === i6.width && u8[0].height === i6.height)
  522. return { extent: h3, srcExtent: h3, pixelBlock: r7.pixelBlocks[0] };
  523. const d5 = t5 > 0 ? l6.pyramidBlockWidth : l6.blockWidth, x6 = t5 > 0 ? l6.pyramidBlockHeight : l6.blockHeight, g = { x: e4.x % d5, y: e4.y % x6 };
  524. let y4;
  525. if (this.rasterJobHandler) {
  526. y4 = (await this.rasterJobHandler.mosaicAndTransform({ srcPixelBlocks: u8, srcMosaicSize: p4, destDimension: i6, clipOffset: g, clipSize: i6, coefs: null, sampleSpacing: null, interpolation: o8.interpolation, alignmentInfo: null, blockWidths: null }, o8)).pixelBlock;
  527. } else
  528. y4 = u2(u8, p4, { clipOffset: g, clipSize: i6 });
  529. return { extent: h3, srcExtent: h3, pixelBlock: y4 };
  530. }
  531. fetchRawTile(t5, e4, o8, r7) {
  532. throw new s2("BaseRaster:read-not-implemented", "fetchRawTile() is not implemented");
  533. }
  534. computeExtent(t5) {
  535. return F(this.rasterInfo.extent, t5);
  536. }
  537. decodePixelBlock(t5, e4) {
  538. return !this.rasterJobHandler || e4.useCanvas ? S4(t5, e4) : this.rasterJobHandler.decode({ data: t5, options: e4 });
  539. }
  540. async request(t5, i6, o8) {
  541. const { customFetchParameters: r7 } = this.ioConfig, { range: n8, query: s4, headers: a4 } = i6;
  542. o8 = o8 ?? i6.retryCount ?? this.ioConfig.retryCount;
  543. const l6 = n8 ? { Range: `bytes=${n8.from}-${n8.to}` } : null;
  544. try {
  545. return await U(t5, { ...i6, query: { ...s4, ...r7 }, headers: { ...a4, ...l6 } });
  546. } catch (c7) {
  547. if (o8 > 0)
  548. return o8--, this.request(t5, i6, o8);
  549. throw c7;
  550. }
  551. }
  552. getSliceIndex(t5) {
  553. const { multidimensionalInfo: e4 } = this.rasterInfo;
  554. return t(e4) || t(t5) || t5.length === 0 ? null : m4(t5, e4);
  555. }
  556. getTileExtentFromTileInfo(t5, e4, i6, o8) {
  557. const r7 = o8.lodAt(t5);
  558. return this.getTileExtent({ x: r7.resolution, y: r7.resolution }, e4, i6, o8.origin, o8.spatialReference, o8.size);
  559. }
  560. updateTileInfo() {
  561. const { storageInfo: t5, spatialReference: e4, extent: i6, pixelSize: o8 } = this.rasterInfo;
  562. if (!t5.tileInfo) {
  563. const r7 = [], n8 = t5.maximumPyramidLevel || 0;
  564. let s4 = Math.max(o8.x, o8.y), a4 = 1 / 0.0254 * 96 * s4;
  565. for (let t6 = 0; t6 <= n8; t6++)
  566. r7.push({ level: n8 - t6, resolution: s4, scale: a4 }), s4 *= 2, a4 *= 2;
  567. const l6 = new j({ x: i6.xmin, y: i6.ymax, spatialReference: e4 });
  568. t5.tileInfo = new S2({ origin: l6, size: [t5.blockWidth, t5.blockHeight], spatialReference: e4, lods: r7 }), t5.isVirtualTileInfo = true;
  569. }
  570. }
  571. createRemoteDatasetStorageInfo(t5, e4 = 512, i6 = 512, o8) {
  572. const { width: r7, height: n8, nativeExtent: s4, pixelSize: a4, spatialReference: l6 } = t5, c7 = new j({ x: s4.xmin, y: s4.ymax, spatialReference: l6 });
  573. o8 == null && (o8 = Math.max(0, Math.round(Math.log(Math.max(r7, n8)) / Math.LN2 - 8)));
  574. const m10 = this.computeBlockBoundary(s4, 512, 512, { x: s4.xmin, y: s4.ymax }, [a4], o8);
  575. t5.storageInfo = new p3({ blockWidth: e4, blockHeight: i6, pyramidBlockWidth: e4, pyramidBlockHeight: i6, origin: c7, firstPyramidLevel: 1, maximumPyramidLevel: o8, blockBoundary: m10 });
  576. }
  577. async computeBestPyramidLevelForLocation(t5, e4 = {}) {
  578. return 0;
  579. }
  580. computeBlockBoundary(t5, e4, i6, o8, r7, n8 = 0, s4 = 2) {
  581. if (r7.length === 1 && n8 > 0) {
  582. r7 = [...r7];
  583. let { x: t6, y: e5 } = r7[0];
  584. for (let i7 = 0; i7 < n8; i7++)
  585. t6 *= s4, e5 *= s4, r7.push({ x: t6, y: e5 });
  586. }
  587. const a4 = [], { x: l6, y: c7 } = o8;
  588. for (let m10 = 0; m10 < r7.length; m10++) {
  589. const { x: o9, y: n9 } = r7[m10];
  590. a4.push({ minCol: Math.floor((t5.xmin - l6 + 0.1 * o9) / e4 / o9), maxCol: Math.floor((t5.xmax - l6 - 0.1 * o9) / e4 / o9), minRow: Math.floor((c7 - t5.ymax + 0.1 * n9) / i6 / n9), maxRow: Math.floor((c7 - t5.ymin - 0.1 * n9) / i6 / n9) });
  591. }
  592. return a4;
  593. }
  594. getPyramidPixelSize(t5) {
  595. const { nativePixelSize: e4 } = this.rasterInfo, { pyramidResolutions: i6, pyramidScalingFactor: o8 } = this.rasterInfo.storageInfo;
  596. if (t5 === 0)
  597. return e4;
  598. if (r(i6) && i6.length)
  599. return i6[t5 - 1];
  600. const r7 = o8 ** t5;
  601. return { x: e4.x * r7, y: e4.y * r7 };
  602. }
  603. identifyPixelLocation(t5, e4, i6, o8) {
  604. const { spatialReference: r7, nativeExtent: s4, storageInfo: a4 } = this.rasterInfo, { maximumPyramidLevel: l6, origin: c7, transposeInfo: m10 } = a4, f5 = o8 && r(m10) ? m10.tileSize[0] : a4.blockWidth, h3 = o8 && r(m10) ? m10.tileSize[1] : a4.blockHeight, u8 = _(t5, r7, i6);
  605. if (!s4.intersects(u8))
  606. return null;
  607. if (e4 < 0 || e4 > l6)
  608. return null;
  609. const p4 = this.getPyramidPixelSize(e4), { x: d5, y: x6 } = p4, g = (c7.y - u8.y) / x6 / h3, y4 = (u8.x - c7.x) / d5 / f5, I5 = Math.min(h3 - 1, Math.floor((g - Math.floor(g)) * h3)), R2 = Math.min(f5 - 1, Math.floor((y4 - Math.floor(y4)) * f5));
  610. return { pyramidLevel: e4, row: Math.floor(g), col: Math.floor(y4), rowOffset: I5, colOffset: R2, blockWidth: f5, srcLocation: u8 };
  611. }
  612. getTileExtent(t5, e4, i6, o8, r7, n8) {
  613. const [s4, a4] = n8, l6 = o8.x + i6 * s4 * t5.x, c7 = l6 + s4 * t5.x, m10 = o8.y - e4 * a4 * t5.y, f5 = m10 - a4 * t5.y;
  614. return new M({ xmin: l6, xmax: c7, ymin: f5, ymax: m10, spatialReference: r7 });
  615. }
  616. getBlockWidthHeight(t5) {
  617. return { blockWidth: t5 > 0 ? this.rasterInfo.storageInfo.pyramidBlockWidth : this.rasterInfo.storageInfo.blockWidth, blockHeight: t5 > 0 ? this.rasterInfo.storageInfo.pyramidBlockHeight : this.rasterInfo.storageInfo.blockHeight };
  618. }
  619. isBlockOutside(t5, e4, i6) {
  620. const o8 = this.rasterInfo.storageInfo.blockBoundary[t5];
  621. return !o8 || o8.maxRow < e4 || o8.maxCol < i6 || o8.minRow > e4 || o8.minCol > i6;
  622. }
  623. async _fetchPixels(t5, e4, i6, o8 = {}) {
  624. let r7 = D2(t5);
  625. if (r7 >= 2)
  626. return { extent: t5, pixelBlock: null };
  627. const a4 = this._getSourceDataInfo(t5, e4, i6, o8), { pyramidLevel: l6, pyramidResolution: c7, srcResolution: m10, srcExtent: f5, srcWidth: h3, srcHeight: u8 } = a4;
  628. if (h3 === 0 || u8 === 0)
  629. return { extent: t5, srcExtent: f5, pixelBlock: null };
  630. const p4 = e2(this.rasterInfo.transform), d5 = p4?.type === "gcs-shift", x6 = r(X(t5.spatialReference));
  631. !d5 && x6 || (r7 = D2(a4.srcExtent, d5));
  632. const g = this.rasterInfo.storageInfo, y4 = { x: Math.floor((f5.xmin - g.origin.x) / c7.x + 0.1), y: Math.floor((g.origin.y - f5.ymax) / c7.y + 0.1) }, I5 = await this._fetchRawTiles(l6, y4, { width: h3, height: u8, wrapCount: r7 }, o8);
  633. if (!I5)
  634. return { extent: t5, srcExtent: f5, pixelBlock: null };
  635. const R2 = l6 > 0 ? g.pyramidBlockWidth : g.blockWidth, w3 = l6 > 0 ? g.pyramidBlockHeight : g.blockHeight, k5 = R2 === h3 && w3 === u8 && y4.x % R2 == 0 && y4.y % w3 == 0, b5 = new j({ x: (t5.xmax - t5.xmin) / e4, y: (t5.ymax - t5.ymin) / i6, spatialReference: t5.spatialReference }), v4 = !t5.spatialReference.equals(this.rasterInfo.spatialReference), { datumTransformation: S8 } = o8;
  636. if (!v4 && k5 && I5.pixelBlocks.length === 1 && R2 === e4 && w3 === i6 && m10.x === b5.x && m10.y === b5.y)
  637. return { extent: t5, srcExtent: f5, pixelBlock: I5.pixelBlocks[0] };
  638. const C2 = x6 && r(X(f5.spatialReference)), _3 = o8.requestProjectedLocalDirections && this.rasterInfo.dataType.startsWith("vector");
  639. _3 && !this.rasterJobHandler && await k4();
  640. const j4 = this.rasterJobHandler ? await this.rasterJobHandler.getProjectionOffsetGrid({ projectedExtent: t5, srcBufferExtent: I5.extent, pixelSize: b5.toJSON(), datumTransformation: S8, rasterTransform: p4, hasWrapAround: r7 > 0 || C2, isAdaptive: this.ioConfig.optimizeProjectionAccuracy !== false, includeGCSGrid: _3 }, o8) : V({ projectedExtent: t5, srcBufferExtent: I5.extent, pixelSize: b5, datumTransformation: S8, rasterTransform: p4, hasWrapAround: r7 > 0 || C2, isAdaptive: false, includeGCSGrid: _3 });
  641. let E3;
  642. const D3 = !o8.requestRawData, z2 = { rows: j4.spacing[0], cols: j4.spacing[1] }, F3 = e2(this._getRasterTileAlignmentInfo(l6, I5.extent.xmin)), { pixelBlocks: O2, mosaicSize: q2, isPartiallyFilled: G2 } = I5;
  643. let J2 = null;
  644. if (this.rasterJobHandler) {
  645. const t6 = await this.rasterJobHandler.mosaicAndTransform({ srcPixelBlocks: O2, srcMosaicSize: q2, destDimension: D3 ? { width: e4, height: i6 } : null, coefs: D3 ? j4.coefficients : null, sampleSpacing: D3 ? z2 : null, projectDirections: _3, gcsGrid: _3 ? j4.gcsGrid : null, isUV: this.rasterInfo.dataType === "vector-uv", interpolation: o8.interpolation, alignmentInfo: F3, blockWidths: null }, o8);
  646. ({ pixelBlock: E3, localNorthDirections: J2 } = t6);
  647. } else {
  648. const t6 = u2(O2, q2, { alignmentInfo: F3 });
  649. E3 = D3 ? C(t6, { width: e4, height: i6 }, j4.coefficients, z2, o8.interpolation) : t6, _3 && j4.gcsGrid && (J2 = U2({ width: e4, height: i6 }, j4.gcsGrid), E3 = p(E3, this.rasterInfo.dataType, J2));
  650. }
  651. return o8.requestRawData || _3 ? { srcExtent: f5, pixelBlock: E3, transformGrid: j4, localNorthDirections: J2, extent: t5, isPartiallyFilled: G2 } : { srcExtent: f5, extent: t5, pixelBlock: E3 };
  652. }
  653. async _fetchRawTiles(t5, e4, i6, o8) {
  654. const { origin: r7, blockBoundary: s4 } = this.rasterInfo.storageInfo, { blockWidth: a4, blockHeight: l6 } = this.getBlockWidthHeight(t5);
  655. let { x: c7, y: m10 } = e4, { width: f5, height: h3, wrapCount: u8 } = i6;
  656. const p4 = this._getRasterTileAlignmentInfo(t5, 0);
  657. o8.buffer && (c7 -= o8.buffer.cols, m10 -= o8.buffer.rows, f5 += 2 * o8.buffer.cols, h3 += 2 * o8.buffer.rows);
  658. let d5 = 0, x6 = 0, g = 0;
  659. if (u8 && r(p4)) {
  660. ({ worldColumnCountFromOrigin: x6, originColumnOffset: g, rightPadding: d5 } = p4);
  661. x6 * p4.blockWidth - d5 >= c7 + f5 && (d5 = 0);
  662. }
  663. const y4 = Math.floor(c7 / a4), I5 = Math.floor(m10 / l6), R2 = Math.floor((c7 + f5 + d5 - 1) / a4), w3 = Math.floor((m10 + h3 + d5 - 1) / l6), k5 = s4[t5];
  664. if (!k5)
  665. return null;
  666. const { minRow: b5, minCol: v4, maxCol: S8, maxRow: T } = k5;
  667. if (u8 === 0 && (w3 < b5 || R2 < v4 || I5 > T || y4 > S8))
  668. return null;
  669. const B3 = new Array();
  670. let P2 = false;
  671. const W = this.ioConfig.allowPartialFill == null ? o8.allowPartialFill : this.ioConfig.allowPartialFill;
  672. for (let L2 = I5; L2 <= w3; L2++)
  673. for (let e5 = y4; e5 <= R2; e5++) {
  674. let i7 = e5;
  675. if (!o8.disableWrapAround && u8 && r(p4) && x6 <= e5 && (i7 = e5 - x6 - g), L2 >= b5 && i7 >= v4 && T >= L2 && S8 >= i7) {
  676. const e6 = this._fetchRawTile(t5, L2, i7, o8);
  677. W ? B3.push(new Promise((t6) => {
  678. e6.then((e7) => t6(e7)).catch(() => {
  679. P2 = true, t6(null);
  680. });
  681. })) : B3.push(e6);
  682. } else
  683. B3.push(null);
  684. }
  685. if (B3.length === 0)
  686. return null;
  687. const M3 = await Promise.all(B3), C2 = { height: (w3 - I5 + 1) * l6, width: (R2 - y4 + 1) * a4 }, { spatialReference: _3 } = this.rasterInfo, j4 = this.getPyramidPixelSize(t5), { x: H3, y: E3 } = j4;
  688. return { extent: new M({ xmin: r7.x + y4 * a4 * H3, xmax: r7.x + (R2 + 1) * a4 * H3, ymin: r7.y - (w3 + 1) * l6 * E3, ymax: r7.y - I5 * l6 * E3, spatialReference: _3 }), pixelBlocks: M3, mosaicSize: C2, isPartiallyFilled: P2 };
  689. }
  690. _fetchRawTile(t5, e4, i6, o8) {
  691. const r7 = this.rasterInfo.storageInfo.blockBoundary[t5];
  692. if (!r7)
  693. return Promise.resolve(null);
  694. const { minRow: n8, minCol: s4, maxCol: l6, maxRow: m10 } = r7;
  695. if (e4 < n8 || i6 < s4 || e4 > m10 || i6 > l6)
  696. return Promise.resolve(null);
  697. const f5 = i3(this.url, o8.sliceId), h3 = `${t5}/${e4}/${i6}`;
  698. let u8 = m7(f5, o8.registryId, h3);
  699. if (t(u8)) {
  700. const r8 = new AbortController();
  701. u8 = this.fetchRawTile(t5, e4, i6, { ...o8, signal: r8.signal }), x4(f5, o8.registryId, h3, u8, r8), u8.catch(() => d3(f5, o8.registryId, h3));
  702. }
  703. return o8.signal && v(o8, () => {
  704. h(f5, o8.registryId, h3);
  705. }), u8;
  706. }
  707. _computeMagDirValues(t5) {
  708. const { bandCount: e4, dataType: i6 } = this.rasterInfo;
  709. if (!(e4 === 2 && i6 === "vector-magdir" || i6 === "vector-uv") || t5?.length !== 2 || !t5[0]?.length)
  710. return null;
  711. const o8 = t5[0].length;
  712. if (i6 === "vector-magdir") {
  713. const e5 = t5[1].map((t6) => (t6 + 360) % 360);
  714. return [t5[0], e5];
  715. }
  716. const [r7, n8] = t5, s4 = [], a4 = [];
  717. for (let l6 = 0; l6 < o8; l6++) {
  718. const [t6, e5] = u3([r7[l6], n8[l6]]);
  719. s4.push(t6), a4.push(e5);
  720. }
  721. return [s4, a4];
  722. }
  723. _getRasterTileAlignmentInfo(t5, e4) {
  724. return this._rasterTileAlighmentInfo == null && (this._rasterTileAlighmentInfo = H(this.rasterInfo)), t(this._rasterTileAlighmentInfo.pyramidsInfo) ? null : { startX: e4, halfWorldWidth: this._rasterTileAlighmentInfo.halfWorldWidth, hasGCSSShiftTransform: this._rasterTileAlighmentInfo.hasGCSSShiftTransform, ...this._rasterTileAlighmentInfo.pyramidsInfo[t5] };
  725. }
  726. _getSourceDataInfo(t5, e4, i6, o8 = {}) {
  727. const r7 = { datumTransformation: o8.datumTransformation, pyramidLevel: 0, pyramidResolution: null, srcExtent: null, srcHeight: 0, srcResolution: null, srcWidth: 0 };
  728. o8.srcResolution && (r7.srcResolution = o8.srcResolution, this._updateSourceDataInfo(t5, r7));
  729. const n8 = this.rasterInfo.storageInfo.maximumPyramidLevel || 0, { srcWidth: s4, srcHeight: a4, pyramidLevel: l6 } = r7, c7 = s4 / e4, m10 = a4 / i6, f5 = l6 < n8 && c7 * m10 >= 16;
  730. if (f5 || l6 === n8 && (c7 > q || m10 > q) || (s4 === 0 || a4 === 0)) {
  731. const s5 = new j({ x: (t5.xmax - t5.xmin) / e4, y: (t5.ymax - t5.ymin) / i6, spatialReference: t5.spatialReference });
  732. let a5 = v3(s5, this.rasterInfo.spatialReference, t5, r7.datumTransformation);
  733. const h3 = !a5 || o8.srcResolution && a5.x + a5.y < o8.srcResolution.x + o8.srcResolution.y;
  734. if (f5 && o8.srcResolution && h3) {
  735. const t6 = Math.round(Math.log(Math.max(c7, m10)) / Math.LN2) - 1;
  736. if (n8 - l6 + 3 >= t6) {
  737. const e5 = 2 ** t6;
  738. a5 = { x: o8.srcResolution.x * e5, y: o8.srcResolution.y * e5 };
  739. }
  740. }
  741. a5 && (r7.srcResolution = a5, this._updateSourceDataInfo(t5, r7));
  742. }
  743. return (r7.srcWidth / e4 > q || r7.srcHeight / i6 > q) && (r7.srcWidth = 0, r7.srcHeight = 0), r7;
  744. }
  745. _updateSourceDataInfo(t5, e4) {
  746. e4.srcWidth = 0, e4.srcHeight = 0;
  747. const i6 = this.rasterInfo.spatialReference, { srcResolution: o8, datumTransformation: r7 } = e4, { pyramidLevel: n8, pyramidResolution: a4, excessiveReading: l6 } = te2(o8, this.rasterInfo, this.ioConfig.sampling);
  748. if (l6)
  749. return;
  750. let c7 = e4.srcExtent || F(t5, i6, r7);
  751. if (c7 == null)
  752. return;
  753. const m10 = e2(this.rasterInfo.transform);
  754. m10 && (c7 = m10.inverseTransform(c7)), e4.srcExtent = c7;
  755. const f5 = Math.ceil((c7.xmax - c7.xmin) / a4.x - 0.1), h3 = Math.ceil((c7.ymax - c7.ymin) / a4.y - 0.1);
  756. e4.pyramidLevel = n8, e4.pyramidResolution = a4, e4.srcWidth = f5, e4.srcHeight = h3;
  757. }
  758. _getRequestOptionsWithSliceId(t5) {
  759. return r(this.rasterInfo.multidimensionalInfo) && t5.sliceId == null && (t5 = { ...t5, sliceId: this.getSliceIndex(t5.multidimensionalDefinition) }), t5;
  760. }
  761. _processIdentifyResult(t5, e4) {
  762. const { srcLocation: i6, position: o8, pyramidLevel: r7, useTransposedTile: n8 } = e4, l6 = t5.pixels[0].length / t5.width / t5.height;
  763. if (!(!t5.mask || t5.mask[o8]))
  764. return { location: i6, value: null };
  765. const { multidimensionalInfo: c7 } = this.rasterInfo;
  766. if (t(c7) || !n8) {
  767. const e5 = t5.pixels.map((t6) => t6[o8]), n9 = { location: i6, value: e5, pyramidLevel: r7 }, s4 = this._computeMagDirValues(e5.map((t6) => [t6]));
  768. return s4?.length && (n9.magdirValue = s4.map((t6) => t6[0])), n9;
  769. }
  770. let m10 = t5.pixels.map((t6) => Array.prototype.slice.call(t6, o8 * l6, o8 * l6 + l6)), f5 = this._computeMagDirValues(m10);
  771. const { requestSomeSlices: h3, identifyOptions: u8 } = e4;
  772. let p4 = r3(c7, u8.transposedVariableName);
  773. if (h3) {
  774. const t6 = s3(p4, e2(u8.multidimensionalDefinition), e2(u8.timeExtent));
  775. m10 = m10.map((e5) => t6.map((t7) => e5[t7])), f5 = f5?.map((e5) => t6.map((t7) => e5[t7])), p4 = t6.map((t7) => p4[t7]);
  776. }
  777. return { location: i6, value: null, dataSeries: p4.map((t6, e5) => {
  778. const i7 = { value: m10.map((t7) => t7[e5]), multidimensionalDefinition: t6.multidimensionalDefinition, variableName: t6.multidimensionalDefinition[0].variableName, dimensionValues: {} };
  779. return f5?.length && (i7.magdirValue = [f5[0][e5], f5[1][e5]]), t6.multidimensionalDefinition.forEach((t7) => i7.dimensionValues[t7.dimensionName] = t7.values[0]), i7;
  780. }), pyramidLevel: r7 };
  781. }
  782. };
  783. e([d()], G.prototype, "_rasterTileAlighmentInfo", void 0), e([d({ readOnly: true })], G.prototype, "_isGlobalWrappableSource", null), e([d(f)], G.prototype, "url", null), e([d({ type: String, json: { write: true } })], G.prototype, "datasetName", void 0), e([d({ type: String, json: { write: true } })], G.prototype, "datasetFormat", void 0), e([d()], G.prototype, "rasterInfo", void 0), e([d()], G.prototype, "ioConfig", void 0), e([d()], G.prototype, "sourceJSON", void 0), G = e([n("esri.layers.support.rasterDatasets.BaseRaster")], G);
  784. var J = G;
  785. // node_modules/@arcgis/core/layers/support/rasterDatasets/DBFParser.js
  786. function t3(e4) {
  787. const t5 = e4.fields, r7 = e4.records, n8 = t5.some((e5) => e5.name.toLowerCase() === "oid") ? "OBJECTID" : "OID", i6 = [{ name: n8, type: "esriFieldTypeOID", alias: "OID" }].concat(t5.map((e5) => ({ name: e5.name, type: "esriFieldType" + e5.typeName, alias: e5.name }))), s4 = i6.map((e5) => e5.name), a4 = [];
  788. let o8 = 0, l6 = 0;
  789. return r7.forEach((e5) => {
  790. const t6 = {};
  791. for (t6[n8] = o8++, l6 = 1; l6 < s4.length; l6++)
  792. t6[s4[l6]] = e5[l6 - 1];
  793. a4.push({ attributes: t6 });
  794. }), { displayFieldName: "", fields: i6, features: a4 };
  795. }
  796. var r6 = class {
  797. static get supportedVersions() {
  798. return [5];
  799. }
  800. static parse(r7) {
  801. const n8 = new DataView(r7), i6 = 3 & n8.getUint8(0);
  802. if (i6 !== 3)
  803. return { header: { version: i6 }, recordSet: null };
  804. const s4 = n8.getUint32(4, true), a4 = n8.getUint16(8, true), o8 = n8.getUint16(10, true), l6 = { version: i6, recordCount: s4, headerByteCount: a4, recordByteCount: o8 };
  805. let p4 = 32;
  806. const g = [], u8 = [];
  807. let d5;
  808. if (i6 === 3) {
  809. for (; n8.getUint8(p4) !== 13; )
  810. d5 = String.fromCharCode(n8.getUint8(p4 + 11)).trim(), g.push({ name: r4(new Uint8Array(r7, p4, 11)), type: d5, typeName: ["String", "Date", "Double", "Boolean", "String", "Integer"][["C", "D", "F", "L", "M", "N"].indexOf(d5)], length: n8.getUint8(p4 + 16) }), p4 += 32;
  811. if (p4 += 1, g.length > 0)
  812. for (; u8.length < s4 && r7.byteLength - p4 > o8; ) {
  813. const t5 = [];
  814. n8.getUint8(p4) === 32 ? (p4 += 1, g.forEach((n9) => {
  815. if (n9.type === "C")
  816. t5.push(r4(new Uint8Array(r7, p4, n9.length)).trim());
  817. else if (n9.type === "N")
  818. t5.push(parseInt(String.fromCharCode.apply(null, new Uint8Array(r7, p4, n9.length)).trim(), 10));
  819. else if (n9.type === "F")
  820. t5.push(parseFloat(String.fromCharCode.apply(null, new Uint8Array(r7, p4, n9.length)).trim()));
  821. else if (n9.type === "D") {
  822. const e4 = String.fromCharCode.apply(null, new Uint8Array(r7, p4, n9.length)).trim();
  823. t5.push(new Date(parseInt(e4.substring(0, 4), 10), parseInt(e4.substring(4, 6), 10) - 1, parseInt(e4.substring(6, 8), 10)));
  824. }
  825. p4 += n9.length;
  826. }), u8.push(t5)) : p4 += o8;
  827. }
  828. }
  829. return { header: l6, fields: g, records: u8, recordSet: t3({ fields: g, records: u8 }) };
  830. }
  831. };
  832. // node_modules/@arcgis/core/layers/support/rasterDatasets/CloudRaster.js
  833. var y2 = new Map();
  834. y2.set("int16", "esriFieldTypeSmallInteger"), y2.set("int32", "esriFieldTypeInteger"), y2.set("int64", "esriFieldTypeInteger"), y2.set("float32", "esriFieldTypeSingle"), y2.set("float64", "esriFieldTypeDouble"), y2.set("text", "esriFieldTypeString");
  835. var x5 = 8;
  836. var S5 = class extends J {
  837. constructor() {
  838. super(...arguments), this.storageInfo = null, this.datasetFormat = "CRF";
  839. }
  840. async open(e4) {
  841. await this.init();
  842. const { data: r7 } = await this.request(this.url + "/conf.json", { signal: e4?.signal });
  843. if (!this._validateHeader(r7))
  844. throw new s2("cloudraster:open", "Invalid or unsupported conf.json.");
  845. this.datasetName = this.url.slice(this.url.lastIndexOf("/") + 1);
  846. const { storageInfo: i6, rasterInfo: o8 } = this._parseHeader(r7);
  847. if (o8.dataType === "thematic") {
  848. const e5 = await this._fetchAuxiliaryInformation();
  849. o8.attributeTable = e5;
  850. }
  851. this._set("storageInfo", i6), this._set("rasterInfo", o8), this.ioConfig.retryCount = this.ioConfig.retryCount || 0;
  852. }
  853. async fetchRawTile(e4, t5, r7, i6 = {}) {
  854. const { transposeInfo: o8 } = this.rasterInfo.storageInfo, { transposedVariableName: s4 } = i6, a4 = !(!o8 || !s4), n8 = a4 ? 0 : this.rasterInfo.storageInfo.maximumPyramidLevel - e4;
  855. if (n8 < 0)
  856. return null;
  857. const l6 = this._buildCacheFilePath(n8, t5, r7, i6.multidimensionalDefinition, s4), f5 = this._getIndexRecordFromBundle(t5, r7, a4), m10 = await this.request(l6, { range: { from: 0, to: this.storageInfo.headerSize - 1 }, responseType: "array-buffer", signal: i6.signal });
  858. if (!m10)
  859. return null;
  860. const c7 = new Uint8Array(m10.data), p4 = this._getTileEndAndContentType(c7, f5);
  861. if (p4.recordSize === 0)
  862. return null;
  863. const d5 = await this.request(l6, { range: { from: p4.position, to: p4.position + p4.recordSize }, responseType: "array-buffer", signal: i6.signal });
  864. if (!d5)
  865. return null;
  866. const [u8, h3] = this._getTileSize(a4);
  867. return this.decodePixelBlock(d5.data, { width: u8, height: h3, planes: null, pixelType: null, returnPixelInterleavedDims: a4 });
  868. }
  869. _validateHeader(e4) {
  870. const t5 = ["origin", "extent", "geodataXform", "LODInfos", "blockWidth", "blockHeight", "bandCount", "pixelType", "pixelSizeX", "pixelSizeY", "format", "packetSize"];
  871. return e4 && e4.type === "RasterInfo" && !t5.some((t6) => !e4[t6]);
  872. }
  873. _parseHeader(e4) {
  874. const t5 = ["u1", "u2", "u4", "u8", "s8", "u16", "s16", "u32", "s32", "f32", "f64"][e4.pixelType], { bandCount: r7, histograms: i6, colormap: o8, blockWidth: s4, blockHeight: f5, firstPyramidLevel: m10, maximumPyramidLevel: c7 } = e4, p4 = e4.statistics && e4.statistics.map((e5) => ({ min: e5.min, max: e5.max, avg: e5.mean, stddev: e5.standardDeviation, median: e5.median, mode: e5.mode })), d5 = e4.extent.spatialReference, y4 = e4.geodataXform?.spatialReference, S8 = new k(d5?.wkid || d5?.wkt ? d5 : y4);
  875. let I5 = new M({ xmin: e4.extent.xmin, ymin: e4.extent.ymin, xmax: e4.extent.xmax, ymax: e4.extent.ymax, spatialReference: S8 });
  876. const w3 = new j({ x: e4.pixelSizeX, y: e4.pixelSizeY, spatialReference: S8 }), _3 = Math.round((I5.xmax - I5.xmin) / w3.x), v4 = Math.round((I5.ymax - I5.ymin) / w3.y), b5 = this._parseTransform(e4.geodataXform), z2 = b5 ? I5 : null;
  877. b5 && (I5 = b5.forwardTransform(I5), w3.x = (I5.xmax - I5.xmin) / _3, w3.y = (I5.ymax - I5.ymin) / v4);
  878. const T = e4.properties ?? {}, k5 = e4.format.toLowerCase().replace("cache/", ""), j4 = new j(e4.origin.x, e4.origin.y, S8);
  879. let C2, R2, F3, P2;
  880. if (o8 && o8.colors)
  881. for (C2 = [], R2 = 0; R2 < o8.colors.length; R2++)
  882. F3 = o8.colors[R2], P2 = o8.values ? o8.values[R2] : R2, C2.push([P2, 255 & F3, F3 << 16 >>> 24, F3 << 8 >>> 24, F3 >>> 24]);
  883. const H3 = e4.LODInfos, D3 = [];
  884. for (R2 = 0; R2 < H3.levels.length; R2++)
  885. D3.push({ level: H3.levels[R2], resolution: H3.resolutions[R2], scale: 96 / 0.0254 * H3.resolutions[R2] });
  886. const L2 = new S2({ dpi: 96, lods: D3, format: k5, origin: j4, size: [s4, f5], spatialReference: S8 }), M3 = { recordSize: x5, packetSize: e4.packetSize, headerSize: e4.packetSize * e4.packetSize * x5 + 64 }, B3 = [{ maxCol: Math.ceil(_3 / s4) - 1, maxRow: Math.ceil(v4 / f5) - 1, minCol: 0, minRow: 0 }];
  887. let O2 = 2;
  888. if (c7 > 0)
  889. for (R2 = 0; R2 < c7; R2++)
  890. B3.push({ maxCol: Math.ceil(_3 / O2 / s4) - 1, maxRow: Math.ceil(v4 / O2 / f5) - 1, minCol: 0, minRow: 0 }), O2 *= 2;
  891. const $ = e4.mdInfo;
  892. let N3 = null;
  893. if ($ && T._yxs) {
  894. const e5 = T._yxs;
  895. N3 = { packetSize: e5.PacketSize, tileSize: [e5.TileXSize, e5.TileYSize] };
  896. }
  897. return { storageInfo: M3, rasterInfo: new l4({ width: _3, height: v4, pixelType: t5, bandCount: r7, extent: I5, nativeExtent: z2, transform: b5, spatialReference: S8, pixelSize: w3, keyProperties: T, statistics: p4, histograms: i6, multidimensionalInfo: $, colormap: C2, storageInfo: new p3({ blockWidth: s4, blockHeight: f5, pyramidBlockWidth: s4, pyramidBlockHeight: f5, origin: j4, tileInfo: L2, transposeInfo: N3, firstPyramidLevel: m10, maximumPyramidLevel: c7, blockBoundary: B3 }) }) };
  898. }
  899. _parseTransform(e4) {
  900. if (!f2(e4))
  901. throw new s2("cloudraster:open", "the data contains unsupported geodata transform types");
  902. const r7 = i4(e4);
  903. if (r7.type === "identity")
  904. return null;
  905. if (r7.type !== "polynomial" || !r7.forwardCoefficients?.length || !r7.inverseCoefficients?.length)
  906. throw new s2("cloudraster:open", "the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");
  907. return r7;
  908. }
  909. async _fetchAuxiliaryInformation(e4) {
  910. const t5 = this.request(this.url + "/conf.vat.json", { signal: e4 }).then((e5) => e5.data).catch(() => null), r7 = this.request(this.url + "/conf.vat.dbf", { responseType: "array-buffer", signal: e4 }).then((e5) => e5.data).catch(() => null), i6 = await Promise.all([t5, r7]);
  911. let o8;
  912. if (i6[0]) {
  913. let e5 = i6[0].fields;
  914. const t6 = i6[0].values;
  915. if (e5 && t6) {
  916. e5 = e5.map((e6) => ({ type: e6.name === "OID" ? "esriFieldTypeOID" : y2.get(e6.type), name: e6.name, alias: e6.alias || e6.name }));
  917. const r8 = t6.map((e6) => ({ attributes: e6 }));
  918. e5 && t6 && (o8 = { fields: e5, features: r8 });
  919. }
  920. }
  921. if (!o8 && i6[1]) {
  922. o8 = r6.parse(i6[1]).recordSet;
  923. }
  924. return x.fromJSON(o8);
  925. }
  926. _buildCacheFilePath(e4, t5, i6, o8, s4) {
  927. const a4 = this._getPackageSize(!!s4), n8 = Math.floor(t5 / a4) * a4, l6 = Math.floor(i6 / a4) * a4, f5 = "R" + this._toHexString4(n8) + "C" + this._toHexString4(l6);
  928. let m10 = "L";
  929. m10 += e4 >= 10 ? e4.toString() : "0" + e4.toString();
  930. const { multidimensionalInfo: c7 } = this.rasterInfo, p4 = o8?.[0];
  931. if (t(c7) || !p4)
  932. return `${this.url}/_alllayers/${m10}/${f5}.bundle`;
  933. let d5 = "_yxs";
  934. if (!s4) {
  935. d5 = c7.variables.find((e6) => e6.name === p4.variableName).dimensions[0].values.indexOf(p4.values[0]).toString(16);
  936. const e5 = 4 - d5.length;
  937. for (let t6 = 0; t6 < e5; t6++)
  938. d5 = "0" + d5;
  939. d5 = "S" + d5;
  940. }
  941. const u8 = this._getVariableFolderName(s4 || p4.variableName);
  942. return `${this.url}/_alllayers/${u8}/${d5}/${m10}/${f5}.bundle`;
  943. }
  944. _getPackageSize(e4 = false) {
  945. const { transposeInfo: t5 } = this.rasterInfo.storageInfo;
  946. return e4 && r(t5) ? t5.packetSize : this.storageInfo.packetSize;
  947. }
  948. _getTileSize(e4 = false) {
  949. const { storageInfo: t5 } = this.rasterInfo, { transposeInfo: r7 } = t5;
  950. return e4 && r(r7) ? r7.tileSize : t5.tileInfo.size;
  951. }
  952. _getVariableFolderName(e4) {
  953. return (e4 = e4.trim()) === "" ? "_v" : e4.replace(/[\{|\}\-]/g, "_").replace("\\*", "_v");
  954. }
  955. _getIndexRecordFromBundle(e4, t5, r7 = false) {
  956. const i6 = this._getPackageSize(r7), o8 = i6 * (e4 % i6) + t5 % i6;
  957. if (o8 < 0)
  958. throw "Invalid level / row / col";
  959. return 20 + o8 * this.storageInfo.recordSize + 44;
  960. }
  961. _getTileEndAndContentType(e4, t5) {
  962. const r7 = e4.subarray(t5, t5 + 8);
  963. let i6, o8 = 0;
  964. for (i6 = 0; i6 < 5; i6++)
  965. o8 |= (255 & r7[i6]) << 8 * i6;
  966. const s4 = 1099511627775 & o8;
  967. for (o8 = 0, i6 = 5; i6 < 8; i6++)
  968. o8 |= (255 & r7[i6]) << 8 * (i6 - 5);
  969. return { position: s4, recordSize: 1099511627775 & o8 };
  970. }
  971. _toHexString4(e4) {
  972. let t5 = e4.toString(16);
  973. if (t5.length !== 4) {
  974. let e5 = 4 - t5.length;
  975. for (; e5-- > 0; )
  976. t5 = "0" + t5;
  977. }
  978. return t5;
  979. }
  980. };
  981. e([d({ readOnly: true })], S5.prototype, "storageInfo", void 0), e([d({ type: String, json: { write: true } })], S5.prototype, "datasetFormat", void 0), S5 = e([n("esri.layers.support.rasterDatasets.CloudRaster")], S5);
  982. var I2 = S5;
  983. // node_modules/@arcgis/core/layers/support/rasterDatasets/InMemoryRaster.js
  984. var h2 = class extends J {
  985. constructor() {
  986. super(...arguments), this.datasetFormat = "MEMORY";
  987. }
  988. async open(t5) {
  989. await this.init();
  990. const { pixelBlock: e4, statistics: s4, histograms: r7, name: i6, keyProperties: o8, nativeExtent: m10, transform: n8 } = this.data, { width: l6, height: h3, pixelType: f5 } = e4, d5 = this.data.extent || new M({ xmin: -0.5, ymin: 0.5, xmax: l6 - 0.5, ymax: h3 - 0.5, spatialReference: new k({ wkid: 3857 }) }), u8 = this.data.isPseudoSpatialReference ?? !this.data.extent, y4 = { x: d5.width / l6, y: d5.height / h3 }, x6 = new l4({ width: l6, height: h3, pixelType: f5, extent: d5, nativeExtent: m10, transform: n8, pixelSize: y4, spatialReference: d5.spatialReference, bandCount: 3, keyProperties: o8 || {}, statistics: s4, isPseudoSpatialReference: u8, histograms: r7 });
  991. this.createRemoteDatasetStorageInfo(x6, 512, 512), this._set("rasterInfo", x6), this.updateTileInfo(), await this._buildInMemoryRaster(e4, { width: 512, height: 512 }, t5), this.datasetName = i6, this.url = "/InMemory/" + i6;
  992. }
  993. fetchRawTile(t5, e4, s4, r7 = {}) {
  994. const i6 = this._pixelBlockTiles.get(`${t5}/${e4}/${s4}`);
  995. return Promise.resolve(i6);
  996. }
  997. async _buildInMemoryRaster(t5, i6, o8) {
  998. const a4 = this.rasterInfo.storageInfo.maximumPyramidLevel, m10 = this.rasterJobHandler ? this.rasterJobHandler.split({ pixelBlock: t5, tileSize: i6, maximumPyramidLevel: a4 }, o8) : Promise.resolve(M2(t5, i6, a4)), p4 = r(this.rasterInfo.statistics), c7 = r(this.rasterInfo.histograms), h3 = p4 ? Promise.resolve({ statistics: null, histograms: null }) : this.rasterJobHandler ? this.rasterJobHandler.estimateStatisticsHistograms({ pixelBlock: t5 }, o8) : Promise.resolve(m5(t5)), f5 = await E([m10, h3]);
  999. if (!f5[0].value && f5[1].value)
  1000. throw new s2("inmemory-raster:open", "failed to build in memory raster");
  1001. this._pixelBlockTiles = f5[0].value, p4 || (this.rasterInfo.statistics = f5[1].value?.statistics), c7 || (this.rasterInfo.histograms = f5[1].value?.histograms);
  1002. }
  1003. };
  1004. e([d({ type: String, json: { write: true } })], h2.prototype, "datasetFormat", void 0), e([d()], h2.prototype, "data", void 0), h2 = e([n("esri.layers.support.rasterDatasets.InMemoryRaster")], h2);
  1005. var f3 = h2;
  1006. // node_modules/@arcgis/core/layers/support/rasterDatasets/xmlUtilities.js
  1007. function n6(e4, t5) {
  1008. if (!e4 || !t5)
  1009. return [];
  1010. let l6 = t5;
  1011. t5.includes("/") ? (l6 = t5.slice(0, t5.indexOf("/")), t5 = t5.slice(t5.indexOf("/") + 1)) : t5 = "";
  1012. const r7 = [];
  1013. if (t5) {
  1014. const u9 = n6(e4, l6);
  1015. for (let e5 = 0; e5 < u9.length; e5++) {
  1016. n6(u9[e5], t5).forEach((n8) => r7.push(n8));
  1017. }
  1018. return r7;
  1019. }
  1020. const u8 = e4.getElementsByTagNameNS("*", l6);
  1021. if (!u8 || u8.length === 0)
  1022. return [];
  1023. for (let n8 = 0; n8 < u8.length; n8++)
  1024. r7.push(u8[n8] || u8.item[n8]);
  1025. return r7;
  1026. }
  1027. function e3(t5, l6) {
  1028. if (!t5 || !l6)
  1029. return null;
  1030. let r7 = l6;
  1031. l6.includes("/") ? (r7 = l6.slice(0, l6.indexOf("/")), l6 = l6.slice(l6.indexOf("/") + 1)) : l6 = "";
  1032. const u8 = n6(t5, r7);
  1033. return u8.length > 0 ? l6 ? e3(u8[0], l6) : u8[0] : null;
  1034. }
  1035. function t4(n8, t5 = null) {
  1036. const l6 = t5 ? e3(n8, t5) : n8;
  1037. let r7;
  1038. return l6 ? (r7 = l6.textContent || l6.nodeValue, r7 ? r7.trim() : null) : null;
  1039. }
  1040. function l5(e4, t5) {
  1041. const l6 = n6(e4, t5), r7 = [];
  1042. let u8;
  1043. for (let n8 = 0; n8 < l6.length; n8++)
  1044. u8 = l6[n8].textContent || l6[n8].nodeValue, u8 && (u8 = u8.trim(), u8 !== "" && r7.push(u8));
  1045. return r7;
  1046. }
  1047. function u6(n8, e4) {
  1048. return l5(n8, e4).map((n9) => Number(n9));
  1049. }
  1050. function o6(n8, e4) {
  1051. const l6 = t4(n8, e4);
  1052. return Number(l6);
  1053. }
  1054. function i5(n8, e4) {
  1055. const t5 = n8?.nodeName?.toLowerCase(), l6 = e4.toLowerCase();
  1056. return t5.slice(t5.lastIndexOf(":") + 1) === l6;
  1057. }
  1058. // node_modules/@arcgis/core/layers/support/rasterDatasets/pamParser.js
  1059. function o7(e4, t5) {
  1060. if (!e4 || !t5)
  1061. return null;
  1062. const n8 = [];
  1063. for (let s4 = 0; s4 < e4.length; s4++)
  1064. n8.push(e4[s4]), n8.push(t5[s4]);
  1065. return n8;
  1066. }
  1067. function u7(e4) {
  1068. const n8 = e3(e4, "GeodataXform"), l6 = c5(o6(n8, "SpatialReference/WKID") || t4(n8, "SpatialReference/WKT"));
  1069. if (n8.getAttribute("xsi:type") !== "typens:PolynomialXform")
  1070. return { spatialReference: l6, transform: null };
  1071. const u8 = o6(n8, "PolynomialOrder") ?? 1, f5 = u6(n8, "CoeffX/Double"), m10 = u6(n8, "CoeffY/Double"), d5 = u6(n8, "InverseCoeffX/Double"), p4 = u6(n8, "InverseCoeffY/Double"), S8 = o7(f5, m10), C2 = o7(d5, p4);
  1072. return { spatialReference: l6, transform: new m8({ spatialReference: l6, polynomialOrder: u8, forwardCoefficients: S8, inverseCoefficients: C2 }) };
  1073. }
  1074. function f4(e4) {
  1075. const a4 = o6(e4, "NoDataValue"), i6 = e3(e4, "Histograms/HistItem"), l6 = o6(i6, "HistMin"), o8 = o6(i6, "HistMax"), u8 = o6(i6, "BucketCount"), f5 = t4(i6, "HistCounts")?.split("|").map((e5) => Number(e5));
  1076. let c7, m10, d5, p4;
  1077. n6(e4, "Metadata/MDI").forEach((e5) => {
  1078. const t5 = Number(e5.textContent ?? e5.nodeValue);
  1079. switch (e5.getAttribute("key").toUpperCase()) {
  1080. case "STATISTICS_MINIMUM":
  1081. c7 = t5;
  1082. break;
  1083. case "STATISTICS_MAXIMUM":
  1084. m10 = t5;
  1085. break;
  1086. case "STATISTICS_MEAN":
  1087. d5 = t5;
  1088. break;
  1089. case "STATISTICS_STDDEV":
  1090. p4 = t5;
  1091. }
  1092. });
  1093. const S8 = o6(e4, "Metadata/SourceBandIndex");
  1094. return { noDataValue: a4, histogram: f5?.length && c7 != null && m10 != null ? { min: l6, max: o8, size: u8 || f5.length, counts: f5 } : null, sourceBandIndex: S8, statistics: c7 != null && m10 != null ? { min: c7, max: m10, avg: d5, stddev: p4 } : null };
  1095. }
  1096. function c5(e4) {
  1097. if (!e4)
  1098. return null;
  1099. let t5 = Number(e4);
  1100. if (!isNaN(t5) && t5 !== 0)
  1101. return new k({ wkid: t5 });
  1102. if ((e4 = String(e4)).startsWith("COMPD_CS")) {
  1103. if (!e4.includes("VERTCS") || !e4.includes("GEOGCS") && !e4.startsWith("PROJCS"))
  1104. return null;
  1105. const n8 = e4.indexOf("VERTCS"), s4 = e4.indexOf("PROJCS"), r7 = s4 > -1 ? s4 : e4.indexOf("GEOGCS");
  1106. if (r7 === -1)
  1107. return null;
  1108. const a4 = e4.slice(r7, e4.lastIndexOf("]", n8) + 1).trim(), i6 = e4.slice(n8, e4.lastIndexOf("]")).trim();
  1109. t5 = m9(a4);
  1110. const o8 = new k(t5 ? { wkid: t5 } : { wkt: a4 }), u8 = m9(i6);
  1111. return u8 && (o8.vcsWkid = u8), o8;
  1112. }
  1113. return e4.startsWith("GEOGCS") || e4.startsWith("PROJCS") ? (t5 = m9(e4), new k(t5 !== 0 ? { wkid: t5 } : { wkt: e4 })) : null;
  1114. }
  1115. function m9(e4) {
  1116. const t5 = e4.replace(/\]/g, "[").replace(/\"/g, "").split("[").map((e5) => e5.trim()).filter((e5) => e5 !== ""), n8 = t5[t5.length - 1].split(","), s4 = n8[0]?.toLowerCase();
  1117. if ((s4 === "epsg" || s4 === "esri") && e4.endsWith('"]]')) {
  1118. const e5 = Number(n8[1]);
  1119. if (!isNaN(e5) && e5 !== 0)
  1120. return e5;
  1121. }
  1122. return 0;
  1123. }
  1124. function d4(s4) {
  1125. if (s4?.documentElement.tagName?.toLowerCase() !== "pamdataset")
  1126. return {};
  1127. const r7 = { spatialReference: null, transform: null, metadata: {}, rasterBands: [], statistics: null, histograms: null };
  1128. s4.documentElement.childNodes.forEach((s5) => {
  1129. if (s5.nodeType === 1) {
  1130. if (i5(s5, "SRS")) {
  1131. if (!r7.spatialReference) {
  1132. const e4 = t4(s5);
  1133. r7.spatialReference = c5(e4);
  1134. }
  1135. } else if (i5(s5, "Metadata"))
  1136. if (s5.getAttribute("domain") === "xml:ESRI") {
  1137. const { spatialReference: e4, transform: t5 } = u7(s5);
  1138. r7.transform = t5, r7.spatialReference || (r7.spatialReference = e4);
  1139. } else {
  1140. n6(s5, "MDI").forEach((e4) => r7.metadata[e4.getAttribute("key")] = t4(e4));
  1141. }
  1142. else if (i5(s5, "PAMRasterBand")) {
  1143. const e4 = f4(s5);
  1144. e4.sourceBandIndex != null && r7.rasterBands[e4.sourceBandIndex] == null ? r7.rasterBands[e4.sourceBandIndex] = e4 : r7.rasterBands.push(e4);
  1145. }
  1146. }
  1147. });
  1148. const a4 = r7.rasterBands;
  1149. if (a4) {
  1150. const e4 = !!a4[0].statistics;
  1151. r7.statistics = e4 ? a4.map((e5) => e5.statistics) : null;
  1152. const t5 = !!a4[0].histogram;
  1153. r7.histograms = t5 ? a4.map((e5) => e5.histogram) : null;
  1154. }
  1155. return r7;
  1156. }
  1157. // node_modules/@arcgis/core/layers/support/rasterDatasets/ImageAuxRaster.js
  1158. var y3 = class extends J {
  1159. async open(t5) {
  1160. await this.init();
  1161. const s4 = await this._fetchData(t5);
  1162. let { spatialReference: e4, statistics: r7, histograms: a4, transform: o8 } = await this._fetchAuxiliaryData(t5);
  1163. const i6 = !e4;
  1164. i6 && (e4 = new k({ wkid: 3857 })), a4?.length && r7 == null && (r7 = c3(a4));
  1165. const { width: n8, height: m10 } = s4;
  1166. let p4 = new M({ xmin: -0.5, ymin: 0.5 - m10, xmax: n8 - 0.5, ymax: 0.5, spatialReference: e4 });
  1167. const c7 = o8 ? o8.forwardTransform(p4) : p4;
  1168. let u8 = true;
  1169. if (o8) {
  1170. const t6 = o8.forwardCoefficients;
  1171. u8 = t6 && t6[1] === 0 && t6[2] === 0, u8 && (o8 = null, p4 = c7);
  1172. }
  1173. const y4 = new f3({ data: { extent: c7, nativeExtent: p4, transform: o8, pixelBlock: s4, statistics: r7, histograms: a4, keyProperties: { DateType: "Processed" }, isPseudoSpatialReference: i6 } });
  1174. await y4.open(), y4.data = null, this._set("rasterInfo", y4.rasterInfo), this._inMemoryRaster = y4;
  1175. }
  1176. fetchRawTile(t5, s4, e4, r7 = {}) {
  1177. return this._inMemoryRaster.fetchRawTile(t5, s4, e4, r7);
  1178. }
  1179. async _fetchData(t5) {
  1180. const { data: r7 } = await this.request(this.url, { responseType: "array-buffer", signal: t5?.signal }), a4 = P(r7).toUpperCase();
  1181. if (a4 !== "JPG" && a4 !== "PNG" && a4 !== "GIF" && a4 !== "BMP")
  1182. throw new s2("image-aux-raster:open", "the data is not a supported format");
  1183. this._set("datasetFormat", a4);
  1184. const o8 = a4.toLowerCase(), i6 = o8 === "gif" || o8 === "bmp" || !a("ios");
  1185. return await this.decodePixelBlock(r7, { format: o8, useCanvas: i6, hasNoZlibMask: true });
  1186. }
  1187. async _fetchAuxiliaryData(t5) {
  1188. const s4 = e2(t5?.signal), e4 = this.ioConfig.skipExtensions ?? [], i6 = e4.includes("aux.xml") ? null : this.request(this.url + ".aux.xml", { responseType: "xml", signal: s4 }), n8 = this.datasetFormat, m10 = n8 === "JPG" ? "jgw" : n8 === "PNG" ? "pgw" : n8 === "BMP" ? "bpw" : null, l6 = e4.includes(m10) ? null : this.request(this.url.slice(0, this.url.lastIndexOf(".")) + "." + m10, { responseType: "text", signal: s4 }), c7 = await E([i6, l6]);
  1189. if (s4?.aborted)
  1190. throw m();
  1191. const f5 = d4(c7[0].value?.data);
  1192. if (!f5.transform) {
  1193. const t6 = c7[1].value ? c7[1].value.data.split("\n").slice(0, 6).map((t7) => Number(t7)) : null;
  1194. f5.transform = t6?.length === 6 ? new m8({ forwardCoefficients: [t6[4], t6[5], t6[0], -t6[1], t6[2], -t6[3]] }) : null;
  1195. }
  1196. return f5;
  1197. }
  1198. };
  1199. e([d({ type: String, json: { write: true } })], y3.prototype, "datasetFormat", void 0), y3 = e([n("esri.layers.support.rasterDatasets.ImageAuxRaster")], y3);
  1200. var w2 = y3;
  1201. // node_modules/@arcgis/core/layers/support/rasterDatasets/ImageServerRaster.js
  1202. var S6 = class extends J {
  1203. constructor() {
  1204. super(...arguments), this._levelOffset = 0, this._tilemapCache = null, this._slices = null, this.datasetFormat = "RasterTileServer";
  1205. }
  1206. async open(e4) {
  1207. await this.init();
  1208. const s4 = e4 && e4.signal, a4 = this.sourceJSON ? { data: this.sourceJSON } : await this.request(this.url, { query: { f: "json" }, signal: s4 });
  1209. a4.ssl && (this.url = this.url.replace(/^http:/i, "https:"));
  1210. const l6 = a4.data;
  1211. if (this.sourceJSON = l6, !l6)
  1212. throw new s2("imageserverraster:open", "cannot initialize tiled image service, missing service info");
  1213. if (!l6.tileInfo)
  1214. throw new s2("imageserverraster:open", "use ImageryLayer to open non-tiled image services");
  1215. this._fixScaleInServiceInfo();
  1216. const o8 = ["jpg", "jpeg", "png", "png8", "png24", "png32", "mixed"];
  1217. this.tileType = l6.cacheType, this.tileType == null && (o8.includes(l6.tileInfo.format.toLowerCase()) ? this.tileType = "Map" : l6.tileInfo.format.toLowerCase() === "lerc" ? this.tileType = "Elevation" : this.tileType = "Raster"), this.datasetName = l6.name.slice(l6.name.indexOf("/") + 1);
  1218. const n8 = await this._fetchRasterInfo({ signal: s4 });
  1219. if (!r(n8))
  1220. throw new s2("image-server-raster:open", "cannot initialize image service");
  1221. {
  1222. const e5 = this.tileType === "Map" ? n3(l6.tileInfo, l6) : S2.fromJSON(l6.tileInfo), { extent: t5, pixelSize: i6 } = n8, s5 = 0.5 / n8.width * i6.x;
  1223. let a5, r7;
  1224. const o9 = e5.lodAt(Math.max.apply(null, e5.lods.map((e6) => e6.level)));
  1225. this.tileType !== "Map" && l6.maxScale !== 0 && (this.tileType === "Raster" ? (a5 = e5.lods.find((e6) => e6.resolution === i6.x), a5 || (a5 = e5.lods[e5.lods.length - 1])) : (a5 = e5.lods.find((e6) => Math.abs(e6.scale - l6.maxScale) < s5), a5 || (a5 = e5.lods.filter((e6) => e6.scale > l6.maxScale).sort((e6, t6) => e6.scale > t6.scale ? 1 : -1)[0])), i6.x = i6.y = a5.resolution, n8.width = Math.ceil((t5.xmax - t5.xmin) / i6.x - 0.1), n8.height = Math.ceil((t5.ymax - t5.ymin) / i6.y - 0.1)), a5 || (a5 = o9);
  1226. const p4 = e5.lodAt(Math.min.apply(null, e5.lods.map((e6) => e6.level)));
  1227. this.tileType === "Map" ? this._levelOffset = e5.lods[0].level : l6.minScale !== 0 && this.tileType === "Elevation" && (r7 = e5.lods.find((e6) => Math.abs(e6.scale - l6.minScale) < s5), this._levelOffset = r7.level - p4.level), r7 || (r7 = p4);
  1228. const f5 = Math.max(i6.x, i6.y);
  1229. (Math.abs(i6.x - i6.y) > s5 || !e5.lods.some((e6) => Math.abs(e6.resolution - f5) < s5)) && (i6.x = i6.y = a5.resolution, n8.width = Math.ceil((t5.xmax - t5.xmin) / i6.x - 0.1), n8.height = Math.ceil((t5.ymax - t5.ymin) / i6.y - 0.1));
  1230. const u8 = a5.level - r7.level, [y4, d5] = e5.size, x6 = [];
  1231. e5.lods.forEach((e6) => {
  1232. e6.level >= r7.level && e6.level <= a5.level && x6.push({ x: e6.resolution, y: e6.resolution });
  1233. }), x6.sort((e6, t6) => e6.x - t6.x);
  1234. const g = this.computeBlockBoundary(t5, y4, d5, e5.origin, x6, u8), v4 = x6.length > 1 ? x6.slice(1) : null;
  1235. let S8;
  1236. l6.transposeInfo && (S8 = { tileSize: [l6.transposeInfo.rows, l6.transposeInfo.cols], packetSize: n8.keyProperties?._yxs.PacketSize ?? 0 }), n8.storageInfo = new p3({ blockWidth: e5.size[0], blockHeight: e5.size[1], pyramidBlockWidth: e5.size[0], pyramidBlockHeight: e5.size[1], pyramidResolutions: v4, compression: e5.format, origin: e5.origin, firstPyramidLevel: 1, maximumPyramidLevel: u8, tileInfo: e5, transposeInfo: S8, blockBoundary: g }), this._fixGCSShift(n8), this._set("rasterInfo", n8);
  1237. }
  1238. if (l6.capabilities.toLowerCase().includes("tilemap")) {
  1239. const e5 = { tileInfo: n8.storageInfo.tileInfo, parsedUrl: j2(this.url), url: this.url, tileServers: [], type: "tile" };
  1240. this._tilemapCache = new z({ layer: e5 });
  1241. }
  1242. }
  1243. async fetchRawTile(e4, t5, s4, a4 = {}) {
  1244. const { storageInfo: r7, extent: l6 } = this.rasterInfo, { transposeInfo: o8 } = r7, n8 = r(o8) && !!a4.transposedVariableName;
  1245. if (this._slices && !n8 && a4.sliceId == null)
  1246. return null;
  1247. const c7 = n8 ? 0 : r7.maximumPyramidLevel - e4 + this._levelOffset, m10 = `${this.url}/tile/${c7}/${t5}/${s4}`, h3 = this._slices ? n8 ? { variable: a4.transposedVariableName } : { sliceId: a4.sliceId || 0 } : null, { data: p4 } = await this.request(m10, { query: h3, responseType: "array-buffer", signal: a4.signal });
  1248. if (!p4)
  1249. return null;
  1250. const f5 = n8 ? o8.tileSize : r7.tileInfo.size, y4 = await this.decodePixelBlock(p4, { width: f5[0], height: f5[1], planes: null, pixelType: null, isPoint: this.tileType === "Elevation", returnPixelInterleavedDims: n8 }), d5 = r7.blockBoundary[e4];
  1251. if (r7.compression !== "jpg" || s4 > d5.minCol && s4 < d5.maxCol && t5 > d5.minRow && t5 < d5.maxRow)
  1252. return y4;
  1253. const { origin: x6, blockWidth: g, blockHeight: v4 } = r7, { x: S8, y: I5 } = this.getPyramidPixelSize(e4), w3 = Math.round((l6.xmin - x6.x) / S8) % g, j4 = Math.round((l6.xmax - x6.x) / S8) % g || g, T = Math.round((x6.y - l6.ymax) / I5) % v4, b5 = Math.round((x6.y - l6.ymin) / I5) % v4 || v4, _3 = s4 === d5.minCol ? w3 : 0, M3 = t5 === d5.minRow ? T : 0, R2 = s4 === d5.maxCol ? j4 : g, P2 = t5 === d5.maxRow ? b5 : v4;
  1254. return x2(y4, { x: _3, y: M3 }, { width: R2 - _3, height: P2 - M3 }), y4;
  1255. }
  1256. getSliceIndex(e4) {
  1257. if (!this._slices || t(e4) || e4.length === 0)
  1258. return null;
  1259. const t5 = e4;
  1260. for (let i6 = 0; i6 < this._slices.length; i6++) {
  1261. const e5 = this._slices[i6].multidimensionalDefinition;
  1262. if (e5.length === t5.length && !e5.some((e6) => {
  1263. const i7 = t5.find((t6) => e6.variableName === t6.variableName && t6.dimensionName === e6.dimensionName);
  1264. if (!i7)
  1265. return true;
  1266. return (Array.isArray(e6.values[0]) ? `${e6.values[0][0]}-${e6.values[0][1]}` : e6.values[0]) !== (Array.isArray(i7.values[0]) ? `${i7.values[0][0]}-${i7.values[0][1]}` : i7.values[0]);
  1267. }))
  1268. return i6;
  1269. }
  1270. return null;
  1271. }
  1272. async fetchVariableStatisticsHistograms(e4, t5) {
  1273. const i6 = this.request(this.url + "/statistics", { query: { variable: e4, f: "json" }, signal: t5 }).then((e5) => e5.data?.statistics), s4 = this.request(this.url + "/histograms", { query: { variable: e4, f: "json" }, signal: t5 }).then((e5) => e5.data?.histograms), a4 = await Promise.all([i6, s4]);
  1274. return a4[0] && a4[0].forEach((e5) => {
  1275. e5.avg = e5.mean, e5.stddev = e5.standardDeviation;
  1276. }), { statistics: a4[0] || null, histograms: a4[1] || null };
  1277. }
  1278. async computeBestPyramidLevelForLocation(e4, t5 = {}) {
  1279. if (!this._tilemapCache)
  1280. return 0;
  1281. let i6 = this.identifyPixelLocation(e4, 0, e2(t5.datumTransformation));
  1282. if (i6 === null)
  1283. return null;
  1284. let s4 = 0;
  1285. const { maximumPyramidLevel: r7 } = this.rasterInfo.storageInfo;
  1286. let l6 = r7 - s4 + this._levelOffset;
  1287. const o8 = i6.srcLocation;
  1288. for (; l6 >= 0; ) {
  1289. try {
  1290. if (await this._tilemapCache.fetchAvailability(l6, i6.row, i6.col, t5) === "available")
  1291. break;
  1292. } catch {
  1293. }
  1294. if (l6--, s4++, i6 = this.identifyPixelLocation(o8, s4, e2(t5.datumTransformation)), i6 === null)
  1295. return null;
  1296. }
  1297. return l6 === -1 || i6 == null ? null : s4;
  1298. }
  1299. async _fetchRasterInfo(e4) {
  1300. const t5 = this.sourceJSON;
  1301. if (this.tileType === "Map") {
  1302. const e5 = Math.ceil((t5.extent.xmax - t5.extent.xmin) / t5.pixelSizeX - 0.1), i7 = Math.ceil((t5.extent.ymax - t5.extent.ymin) / t5.pixelSizeY - 0.1), s5 = k.fromJSON(t5.spatialReference || t5.extent.spatialReference), a5 = new j({ x: t5.pixelSizeX, y: t5.pixelSizeY, spatialReference: s5 });
  1303. return new l4({ width: e5, height: i7, bandCount: 3, extent: M.fromJSON(t5.extent), spatialReference: s5, pixelSize: a5, pixelType: "u8", statistics: null, keyProperties: { DataType: "processed" } });
  1304. }
  1305. const { signal: i6 } = e4, s4 = m6(this.url, this.sourceJSON, { signal: i6, query: this.ioConfig.customFetchParameters }), a4 = t5.hasMultidimensions ? this.request(`${this.url}/slices`, { query: { f: "json" }, signal: i6 }).then((e5) => e5.data && e5.data.slices).catch(() => null) : null, r7 = await Promise.all([s4, a4]);
  1306. return this._slices = r7[1], r7[0];
  1307. }
  1308. _fixScaleInServiceInfo() {
  1309. const { sourceJSON: e4 } = this;
  1310. e4.minScale && e4.minScale < 0 && (e4.minScale = 0), e4.maxScale && e4.maxScale < 0 && (e4.maxScale = 0);
  1311. }
  1312. _fixGCSShift(e4) {
  1313. const { extent: t5, spatialReference: i6 } = e4;
  1314. t5.xmin === 0 && t5.xmax === 360 && i6.wkid && i6.isGeographic && (e4.nativeExtent = e4.extent, e4.transform = new c4(), e4.extent = e4.transform.forwardTransform(t5));
  1315. }
  1316. };
  1317. e([d({ type: String, json: { write: true } })], S6.prototype, "datasetFormat", void 0), e([d()], S6.prototype, "tileType", void 0), S6 = e([n("esri.layers.support.rasterDatasets.ImageServerRaster")], S6);
  1318. var I3 = S6;
  1319. // node_modules/@arcgis/core/layers/support/rasterDatasets/MRFRaster.js
  1320. var I4 = new Map();
  1321. I4.set("Int8", "s8"), I4.set("UInt8", "u8"), I4.set("Int16", "s16"), I4.set("UInt16", "u16"), I4.set("Int32", "s32"), I4.set("UInt32", "u32"), I4.set("Float32", "f32"), I4.set("Float64", "f32"), I4.set("Double64", "f32");
  1322. var b3 = new Map();
  1323. b3.set("none", { blobExtension: ".til", isOneSegment: true, decoderFormat: "bip" }), b3.set("lerc", { blobExtension: ".lrc", isOneSegment: false, decoderFormat: "lerc" }), b3.set("deflate", { blobExtension: ".pzp", isOneSegment: true, decoderFormat: "deflate" }), b3.set("jpeg", { blobExtension: ".pjg", isOneSegment: true, decoderFormat: "jpg" });
  1324. var A = class extends J {
  1325. constructor() {
  1326. super(...arguments), this._files = null, this._storageIndex = null, this.datasetFormat = "MRF";
  1327. }
  1328. async open(t5) {
  1329. await this.init(), this.datasetName = this.url.slice(this.url.lastIndexOf("/") + 1);
  1330. const e4 = t5 ? e2(t5.signal) : null, o8 = await this.request(this.url, { responseType: "xml", signal: e4 }), { rasterInfo: i6, files: a4 } = this._parseHeader(o8.data);
  1331. if (this.ioConfig.skipExtensions?.indexOf("aux.xml") === -1) {
  1332. const e5 = await this._fetchAuxiliaryData(t5);
  1333. e5 != null && (i6.statistics = e5.statistics ?? i6.statistics, i6.histograms = e5.histograms, e5.histograms && t(i6.statistics) && (i6.statistics = c3(e5.histograms)));
  1334. }
  1335. this._set("rasterInfo", i6), this._files = a4;
  1336. const n8 = await this.request(a4.index, { responseType: "array-buffer", signal: e4 });
  1337. this._storageIndex = this._parseIndex(n8.data);
  1338. const { blockWidth: l6, blockHeight: f5 } = this.rasterInfo.storageInfo, c7 = this.rasterInfo.storageInfo.pyramidScalingFactor, { width: m10, height: p4 } = this.rasterInfo, h3 = [], u8 = this._getBandSegmentCount();
  1339. let g = 0, y4 = -1;
  1340. for (; g < this._storageIndex.length; ) {
  1341. y4++;
  1342. const t6 = Math.ceil(m10 / l6 / c7 ** y4) - 1, e5 = Math.ceil(p4 / f5 / c7 ** y4) - 1;
  1343. g += (t6 + 1) * (e5 + 1) * u8 * 4, h3.push({ maxRow: e5, maxCol: t6, minCol: 0, minRow: 0 });
  1344. }
  1345. this.rasterInfo.storageInfo.blockBoundary = h3, y4 > 0 && (this.rasterInfo.storageInfo.firstPyramidLevel = 1, this.rasterInfo.storageInfo.maximumPyramidLevel = y4), this.updateTileInfo();
  1346. }
  1347. async fetchRawTile(t5, e4, r7, s4 = {}) {
  1348. const { blockWidth: i6, blockHeight: a4, blockBoundary: l6 } = this.rasterInfo.storageInfo, f5 = l6[t5];
  1349. if (!f5 || f5.maxRow < e4 || f5.maxCol < r7 || f5.minRow > e4 || f5.minCol > r7)
  1350. return null;
  1351. const { bandCount: c7, pixelType: m10 } = this.rasterInfo, { ranges: p4, actualTileWidth: h3, actualTileHeight: u8 } = this._getTileLocation(t5, e4, r7);
  1352. if (!p4 || p4.length === 0)
  1353. return null;
  1354. if (p4[0].from === 0 && p4[0].to === 0) {
  1355. const t6 = new Uint8Array(i6 * a4);
  1356. return new u({ width: i6, height: a4, pixels: null, mask: t6, validPixelCount: 0 });
  1357. }
  1358. const { bandIds: g } = this.ioConfig, d5 = this._getBandSegmentCount(), y4 = [];
  1359. let x6 = 0;
  1360. for (x6 = 0; x6 < d5; x6++)
  1361. (!g || g.indexOf[x6] > -1) && y4.push(this.request(this._files.data, { range: { from: p4[x6].from, to: p4[x6].to }, responseType: "array-buffer", signal: s4.signal }));
  1362. const w3 = await Promise.all(y4), I5 = w3.map((t6) => t6.data.byteLength).reduce((t6, e5) => t6 + e5), A2 = new Uint8Array(I5);
  1363. let F3 = 0;
  1364. for (x6 = 0; x6 < d5; x6++)
  1365. A2.set(new Uint8Array(w3[x6].data), F3), F3 += w3[x6].data.byteLength;
  1366. const _3 = b3.get(this.rasterInfo.storageInfo.compression).decoderFormat, R2 = await this.decodePixelBlock(A2.buffer, { width: i6, height: a4, format: _3, planes: g?.length || c7, pixelType: m10 });
  1367. if (r(this.rasterInfo.noDataValue) && _3 !== "lerc" && !R2.mask) {
  1368. const t6 = this.rasterInfo.noDataValue[0];
  1369. if (t6 != null) {
  1370. const e5 = R2.width * R2.height, r8 = new Uint8Array(e5);
  1371. if (Math.abs(t6) > 1e24)
  1372. for (x6 = 0; x6 < e5; x6++)
  1373. Math.abs((R2.pixels[0][x6] - t6) / t6) > 1e-6 && (r8[x6] = 1);
  1374. else
  1375. for (x6 = 0; x6 < e5; x6++)
  1376. R2.pixels[0][x6] !== t6 && (r8[x6] = 1);
  1377. R2.mask = r8;
  1378. }
  1379. }
  1380. let j4 = 0, k5 = 0;
  1381. if (h3 !== i6 || u8 !== a4) {
  1382. let t6 = R2.mask;
  1383. if (t6)
  1384. for (x6 = 0; x6 < a4; x6++)
  1385. if (k5 = x6 * i6, x6 < u8)
  1386. for (j4 = h3; j4 < i6; j4++)
  1387. t6[k5 + j4] = 0;
  1388. else
  1389. for (j4 = 0; j4 < i6; j4++)
  1390. t6[k5 + j4] = 0;
  1391. else
  1392. for (t6 = new Uint8Array(i6 * a4), R2.mask = t6, x6 = 0; x6 < u8; x6++)
  1393. for (k5 = x6 * i6, j4 = 0; j4 < h3; j4++)
  1394. t6[k5 + j4] = 1;
  1395. }
  1396. return R2;
  1397. }
  1398. _parseIndex(t5) {
  1399. if (t5.byteLength % 16 > 0)
  1400. throw "invalid array buffer must be multiples of 16";
  1401. let e4, r7, s4, o8, i6, a4;
  1402. if (r5) {
  1403. for (r7 = new Uint8Array(t5), o8 = new ArrayBuffer(t5.byteLength), s4 = new Uint8Array(o8), i6 = 0; i6 < t5.byteLength / 4; i6++)
  1404. for (a4 = 0; a4 < 4; a4++)
  1405. s4[4 * i6 + a4] = r7[4 * i6 + 3 - a4];
  1406. e4 = new Uint32Array(o8);
  1407. } else
  1408. e4 = new Uint32Array(t5);
  1409. return e4;
  1410. }
  1411. _getBandSegmentCount() {
  1412. return b3.get(this.rasterInfo.storageInfo.compression).isOneSegment ? 1 : this.rasterInfo.bandCount;
  1413. }
  1414. _getTileLocation(t5, e4, r7) {
  1415. const { blockWidth: s4, blockHeight: o8, pyramidScalingFactor: i6 } = this.rasterInfo.storageInfo, { width: a4, height: n8 } = this.rasterInfo, l6 = this._getBandSegmentCount();
  1416. let f5, c7, m10, p4 = 0, h3 = 0;
  1417. for (m10 = 0; m10 < t5; m10++)
  1418. h3 = i6 ** m10, f5 = Math.ceil(a4 / s4 / h3), c7 = Math.ceil(n8 / o8 / h3), p4 += f5 * c7;
  1419. h3 = i6 ** t5, f5 = Math.ceil(a4 / s4 / h3), c7 = Math.ceil(n8 / o8 / h3), p4 += e4 * f5 + r7, p4 *= 4 * l6;
  1420. const u8 = this._storageIndex.subarray(p4, p4 + 4 * l6);
  1421. let g = 0, d5 = 0;
  1422. const y4 = [];
  1423. for (let x6 = 0; x6 < l6; x6++)
  1424. g = u8[4 * x6 + 0] * 2 ** 32 + u8[4 * x6 + 1], d5 = g + u8[4 * x6 + 2] * 2 ** 32 + u8[4 * x6 + 3], y4.push({ from: g, to: d5 });
  1425. return { ranges: y4, actualTileWidth: r7 < f5 - 1 ? s4 : Math.ceil(a4 / h3) - s4 * (f5 - 1), actualTileHeight: e4 < c7 - 1 ? o8 : Math.ceil(n8 / h3) - o8 * (c7 - 1) };
  1426. }
  1427. _parseHeader(t5) {
  1428. const r7 = e3(t5, "MRF_META/Raster");
  1429. if (!r7)
  1430. throw new s2("mrf:open", "not a valid MRF format");
  1431. const s4 = e3(r7, "Size"), o8 = parseInt(s4.getAttribute("x"), 10), i6 = parseInt(s4.getAttribute("y"), 10), a4 = parseInt(s4.getAttribute("c"), 10), n8 = (t4(r7, "Compression") || "none").toLowerCase();
  1432. if (!b3.has(n8))
  1433. throw new s2("mrf:open", "currently does not support compression " + n8);
  1434. const c7 = t4(r7, "DataType") || "UInt8", p4 = I4.get(c7);
  1435. if (p4 == null)
  1436. throw new s2("mrf:open", "currently does not support pixel type " + c7);
  1437. const g = e3(r7, "PageSize"), d5 = parseInt(g.getAttribute("x"), 10), A2 = parseInt(g.getAttribute("y"), 10), F3 = e3(r7, "DataValues");
  1438. let _3, R2;
  1439. F3 && (R2 = F3.getAttribute("NoData"), R2 != null && (_3 = R2.trim().split(" ").map((t6) => parseFloat(t6))));
  1440. if (e3(t5, "MRF_META/CachedSource"))
  1441. throw new s2("mrf:open", "currently does not support MRF referencing other data files");
  1442. const j4 = e3(t5, "MRF_META/GeoTags"), k5 = e3(j4, "BoundingBox");
  1443. let M3, S8 = false;
  1444. if (k5 != null) {
  1445. const t6 = parseFloat(k5.getAttribute("minx")), e4 = parseFloat(k5.getAttribute("miny")), r8 = parseFloat(k5.getAttribute("maxx")), s5 = parseFloat(k5.getAttribute("maxy")), o9 = t4(j4, "Projection") || "";
  1446. let i7;
  1447. if (o9 !== "LOCAL_CS[]")
  1448. if (o9.toLowerCase().startsWith("epsg:")) {
  1449. const t7 = Number(o9.slice(5));
  1450. isNaN(t7) || t7 === 0 || (i7 = new k({ wkid: t7 }));
  1451. } else
  1452. i7 = c5(o9);
  1453. else
  1454. S8 = true, i7 = new k({ wkid: 3857 });
  1455. M3 = new M(t6, e4, r8, s5), M3.spatialReference = i7;
  1456. } else
  1457. S8 = true, M3 = new M({ xmin: -0.5, ymin: 0.5 - i6, xmax: o8 - 0.5, ymax: 0.5, spatialReference: new k({ wkid: 3857 }) });
  1458. const T = e3(t5, "MRF_META/Rsets"), C2 = parseInt(T && T.getAttribute("scale") || "2", 10), U4 = M3.spatialReference, B3 = new p3({ origin: new j({ x: M3.xmin, y: M3.ymax, spatialReference: U4 }), blockWidth: d5, blockHeight: A2, pyramidBlockWidth: d5, pyramidBlockHeight: A2, compression: n8, pyramidScalingFactor: C2 }), L2 = new j({ x: M3.width / o8, y: M3.height / i6, spatialReference: U4 }), E3 = new l4({ width: o8, height: i6, extent: M3, isPseudoSpatialReference: S8, spatialReference: U4, bandCount: a4, pixelType: p4, pixelSize: L2, noDataValue: _3, storageInfo: B3 }), P2 = t4(t5, "datafile"), O2 = t4(t5, "IndexFile");
  1459. return { rasterInfo: E3, files: { mrf: this.url, index: O2 || this.url.replace(".mrf", ".idx"), data: P2 || this.url.replace(".mrf", b3.get(n8).blobExtension) } };
  1460. }
  1461. async _fetchAuxiliaryData(t5) {
  1462. try {
  1463. const { data: e4 } = await this.request(this.url + ".aux.xml", { responseType: "xml", signal: t5?.signal });
  1464. return d4(e4);
  1465. } catch {
  1466. return null;
  1467. }
  1468. }
  1469. };
  1470. e([d()], A.prototype, "_files", void 0), e([d()], A.prototype, "_storageIndex", void 0), e([d({ type: String, json: { write: true } })], A.prototype, "datasetFormat", void 0), A = e([n("esri.layers.support.rasterIO.MRFRaster")], A);
  1471. var F2 = A;
  1472. // node_modules/@arcgis/core/layers/support/rasterDatasets/TIFFRaster.js
  1473. var _2 = (e4, t5) => {
  1474. const r7 = e4.get(t5);
  1475. return r7 && r7.values;
  1476. };
  1477. var b4 = (e4, t5) => {
  1478. const r7 = e4.get(t5);
  1479. return r7 && r7.values[0];
  1480. };
  1481. var E2 = class extends J {
  1482. constructor() {
  1483. super(...arguments), this._files = null, this._headerInfo = null, this._bufferSize = 1048576, this.datasetFormat = "TIFF";
  1484. }
  1485. async open(e4) {
  1486. await this.init();
  1487. const s4 = e4 ? e2(e4.signal) : null, { data: a4 } = await this.request(this.url, { range: { from: 0, to: this._bufferSize }, responseType: "array-buffer", signal: s4 });
  1488. if (!a4)
  1489. throw new s2("tiffraster:open", "failed to open url " + this.url);
  1490. this.datasetName = this.url.slice(this.url.lastIndexOf("/") + 1);
  1491. const { littleEndian: f5, firstIFD: m10, isBigTiff: c7 } = N(a4), h3 = [];
  1492. await this._readIFDs(h3, a4, f5, m10, 0, c7 ? 8 : 4, s4);
  1493. const d5 = b2(h3), { width: y4, height: _3, tileWidth: b5, tileHeight: E3, planes: S8, pixelType: F3, compression: R2, firstPyramidLevel: k5, maximumPyramidLevel: v4, pyramidBlockWidth: j4, pyramidBlockHeight: B3, tileBoundary: D3, affine: L2, metadata: z2 } = d5, O2 = d5.extent.spatialReference?.wkt || d5.extent.spatialReference?.wkid;
  1494. let P2 = c5(O2), H3 = false;
  1495. P2 == null && (H3 = true, P2 = new k({ wkid: 3857 }));
  1496. const A2 = new M({ ...d5.extent, spatialReference: P2 }), G2 = new j(A2 ? { x: A2.xmin, y: A2.ymax, spatialReference: P2 } : { x: 0, y: 0 }), q2 = new p3({ blockWidth: b5, blockHeight: E3, pyramidBlockWidth: j4, pyramidBlockHeight: B3, compression: R2, origin: G2, firstPyramidLevel: k5, maximumPyramidLevel: v4, blockBoundary: D3 }), C2 = new j({ x: (A2.xmax - A2.xmin) / y4, y: (A2.ymax - A2.ymin) / _3, spatialReference: P2 }), W = z2 ? { BandProperties: z2.bandProperties, DataType: z2.dataType } : {}, U4 = new l4({ width: y4, height: _3, bandCount: S8, pixelType: F3, compression: R2, pixelSize: C2, storageInfo: q2, spatialReference: P2, isPseudoSpatialReference: H3, keyProperties: W, extent: A2, statistics: z2 ? z2.statistics : null });
  1497. if (L2?.length && (U4.nativeExtent = new M({ xmin: -0.5, ymin: 0.5 - _3, xmax: y4 - 0.5, ymax: 0.5, spatialReference: P2 }), U4.transform = new m8({ polynomialOrder: 1, forwardCoefficients: [L2[2] + L2[0] / 2, L2[5] - L2[3] / 2, L2[0], L2[3], -L2[1], -L2[4]] }), U4.extent = U4.transform.forwardTransform(U4.nativeExtent), U4.pixelSize = new j({ x: (A2.xmax - A2.xmin) / y4, y: (A2.ymax - A2.ymin) / _3, spatialReference: P2 }), q2.origin.x = -0.5, q2.origin.y = 0.5), !this.ioConfig.skipExtensions?.includes("aux.xml")) {
  1498. const t5 = await this._fetchAuxiliaryData(e4);
  1499. if (t5 != null) {
  1500. if (U4.statistics = t5.statistics ?? U4.statistics, U4.histograms = t5.histograms, t5.histograms && t(U4.statistics) && (U4.statistics = c3(t5.histograms)), t5.transform && !L2) {
  1501. U4.transform = t5.transform, U4.nativeExtent = U4.extent;
  1502. const e5 = U4.transform.forwardTransform(U4.nativeExtent);
  1503. U4.pixelSize = new j({ x: (e5.xmax - e5.xmin) / y4, y: (e5.ymax - e5.ymin) / _3, spatialReference: P2 }), U4.extent = e5;
  1504. }
  1505. U4.spatialReference || (U4.spatialReference = t5.spatialReference);
  1506. }
  1507. }
  1508. if (this._set("rasterInfo", U4), this._headerInfo = { littleEndian: f5, isBigTiff: c7, ifds: h3, ...d5 }, !this._headerInfo.isSupported)
  1509. throw new s2("tiffraster:open", "this tiff is not supported: " + this._headerInfo.message);
  1510. this.updateTileInfo();
  1511. }
  1512. async fetchRawTile(e4, t5, r7, i6 = {}) {
  1513. if (!this._headerInfo?.isSupported || this.isBlockOutside(e4, t5, r7))
  1514. return null;
  1515. const s4 = this._getTileLocation(e4, t5, r7);
  1516. if (!s4)
  1517. return null;
  1518. const { ranges: a4, actualTileWidth: n8, actualTileHeight: o8, ifd: f5 } = s4, l6 = a4.map((e5) => this.request(this.url, { range: e5, responseType: "array-buffer", signal: i6.signal })), m10 = await Promise.all(l6), u8 = m10.map((e5) => e5.data.byteLength).reduce((e5, t6) => e5 + t6), p4 = m10.length === 1 ? m10[0].data : new ArrayBuffer(u8), c7 = [0], h3 = [0];
  1519. if (m10.length > 1) {
  1520. const e5 = new Uint8Array(p4);
  1521. for (let t6 = 0, r8 = 0; t6 < m10.length; t6++) {
  1522. const i7 = m10[t6].data;
  1523. e5.set(new Uint8Array(i7), r8), c7[t6] = r8, r8 += i7.byteLength, h3[t6] = i7.byteLength;
  1524. }
  1525. }
  1526. const { blockWidth: d5, blockHeight: y4 } = this.getBlockWidthHeight(e4), g = await this.decodePixelBlock(p4, { format: "tiff", customOptions: { headerInfo: this._headerInfo, ifd: f5, offsets: c7, sizes: h3 }, width: d5, height: y4, planes: null, pixelType: null });
  1527. let x6, T, I5;
  1528. if (n8 !== d5 || o8 !== y4) {
  1529. let e5 = g.mask;
  1530. if (e5)
  1531. for (x6 = 0; x6 < y4; x6++)
  1532. if (I5 = x6 * d5, x6 < o8)
  1533. for (T = n8; T < d5; T++)
  1534. e5[I5 + T] = 0;
  1535. else
  1536. for (T = 0; T < d5; T++)
  1537. e5[I5 + T] = 0;
  1538. else
  1539. for (e5 = new Uint8Array(d5 * y4), g.mask = e5, x6 = 0; x6 < o8; x6++)
  1540. for (I5 = x6 * d5, T = 0; T < n8; T++)
  1541. e5[I5 + T] = 1;
  1542. }
  1543. return g;
  1544. }
  1545. async _readIFDs(e4, t5, r7, i6, s4, a4 = 4, n8) {
  1546. if (!i6)
  1547. return null;
  1548. if (i6 >= t5.byteLength || i6 < 0) {
  1549. t5 = (await this.request(this.url, { range: { from: i6 + s4, to: i6 + s4 + this._bufferSize }, responseType: "array-buffer", signal: n8 })).data, s4 = i6 + s4, i6 = 0;
  1550. }
  1551. const o8 = await this._readIFD(t5, r7, i6, s4, n5.TIFF_TAGS, a4, n8);
  1552. if (e4.push(o8.ifd), !o8.nextIFD)
  1553. return null;
  1554. await this._readIFDs(e4, t5, r7, o8.nextIFD - s4, s4, a4, n8);
  1555. }
  1556. async _readIFD(e4, t5, r7, i6, s4 = n5.TIFF_TAGS, a4 = 4, n8) {
  1557. if (!e4)
  1558. return null;
  1559. const o8 = k2(e4, t5, r7, i6, s4, a4);
  1560. if (o8.success) {
  1561. const r8 = [];
  1562. if (o8.ifd.forEach((e5) => {
  1563. e5.values || r8.push(e5);
  1564. }), r8.length > 0) {
  1565. const s5 = r8.map((e5) => e5.offlineOffsetSize), a5 = Math.min.apply(null, s5.map((e5) => e5[0]));
  1566. if (Math.min.apply(null, s5.map((e5) => e5[0] + e5[1])) - a5 <= this._bufferSize) {
  1567. const { data: s6 } = await this.request(this.url, { range: { from: a5, to: a5 + this._bufferSize }, responseType: "array-buffer", signal: n8 });
  1568. e4 = s6, i6 = a5, r8.forEach((r9) => x3(e4, t5, r9, i6));
  1569. }
  1570. }
  1571. if (o8.ifd.has("GEOKEYDIRECTORY")) {
  1572. const r9 = o8.ifd.get("GEOKEYDIRECTORY"), s5 = r9.values;
  1573. if (s5 && s5.length > 4) {
  1574. const a5 = s5[0] + "." + s5[1] + "." + s5[2], o9 = await this._readIFD(e4, t5, r9.valueOffset + 6 - i6, i6, n5.GEO_KEYS, 2, n8);
  1575. r9.data = o9.ifd, r9.data && r9.data.set("GEOTIFFVersion", { id: 0, type: 2, valueCount: 1, valueOffset: null, values: [a5] });
  1576. }
  1577. }
  1578. return o8;
  1579. }
  1580. if (o8.requiredBufferSize && o8.requiredBufferSize !== e4.byteLength) {
  1581. const r8 = await this.request(this.url, { range: { from: i6, to: i6 + o8.requiredBufferSize + 4 }, responseType: "array-buffer", signal: n8 });
  1582. return (e4 = r8.data).byteLength < o8.requiredBufferSize ? null : this._readIFD(e4, t5, 0, i6, n5.TIFF_TAGS, 4, n8);
  1583. }
  1584. }
  1585. _getTileLocation(e4, t5, r7) {
  1586. const { firstPyramidLevel: i6, blockBoundary: s4 } = this.rasterInfo.storageInfo, a4 = e4 === 0 ? 0 : e4 - (i6 - 1), n8 = this._headerInfo.ifds[a4];
  1587. if (!n8)
  1588. return null;
  1589. const o8 = D(n8, this._headerInfo), f5 = _2(n8, "TILEOFFSETS");
  1590. if (f5 === void 0)
  1591. return null;
  1592. const l6 = _2(n8, "TILEBYTECOUNTS"), { minRow: m10, minCol: u8, maxRow: p4, maxCol: c7 } = s4[a4];
  1593. if (t5 > p4 || r7 > c7 || t5 < m10 || r7 < u8)
  1594. return null;
  1595. const h3 = b4(n8, "IMAGEWIDTH"), y4 = b4(n8, "IMAGELENGTH"), g = b4(n8, "TILEWIDTH"), x6 = b4(n8, "TILELENGTH"), T = o8 ? this.rasterInfo.bandCount : 1, I5 = T * t5 * (c7 + 1) + r7, w3 = [{ from: f5[I5], to: f5[I5 + T - 1] + l6[I5 + T - 1] - 1 }];
  1596. if (o8) {
  1597. let e5 = true;
  1598. for (let t6 = 0; t6 < T; t6++)
  1599. if (f5[I5 + t6] + l6[I5 + t6] !== f5[I5 + t6 + 1]) {
  1600. e5 = false;
  1601. break;
  1602. }
  1603. if (!e5)
  1604. for (let t6 = 0; t6 < T; t6++)
  1605. w3[t6] = { from: f5[I5 + t6], to: f5[I5 + t6] + l6[I5 + t6] - 1 };
  1606. }
  1607. const E3 = f5[I5], S8 = l6[I5];
  1608. if (E3 == null || S8 == null)
  1609. return null;
  1610. return { ranges: w3, ifd: n8, actualTileWidth: r7 === c7 ? h3 % g : g, actualTileHeight: t5 === p4 ? y4 % x6 : x6 };
  1611. }
  1612. async _fetchAuxiliaryData(e4) {
  1613. try {
  1614. const { data: t5 } = await this.request(this.url + ".aux.xml", { responseType: "xml", signal: e4?.signal });
  1615. return d4(t5);
  1616. } catch {
  1617. return null;
  1618. }
  1619. }
  1620. };
  1621. e([d()], E2.prototype, "_files", void 0), e([d()], E2.prototype, "_headerInfo", void 0), e([d()], E2.prototype, "_bufferSize", void 0), e([d({ type: String, json: { write: true } })], E2.prototype, "datasetFormat", void 0), E2 = e([n("esri.layers.support.rasterDatasets.TIFFRaster")], E2);
  1622. var S7 = E2;
  1623. // node_modules/@arcgis/core/layers/support/rasterDatasets/RasterFactory.js
  1624. var c6 = new Map();
  1625. c6.set("CRF", { desc: "Cloud Raster Format", constructor: I2 }), c6.set("MRF", { desc: "Meta Raster Format", constructor: F2 }), c6.set("TIFF", { desc: "GeoTIFF", constructor: S7 }), c6.set("RasterTileServer", { desc: "Raster Tile Server", constructor: I3 }), c6.set("JPG", { desc: "JPG Raster Format", constructor: w2 }), c6.set("PNG", { desc: "PNG Raster Format", constructor: w2 }), c6.set("GIF", { desc: "GIF Raster Format", constructor: w2 }), c6.set("BMP", { desc: "BMP Raster Format", constructor: w2 });
  1626. var n7 = class {
  1627. static get supportedFormats() {
  1628. const t5 = new Set();
  1629. return c6.forEach((e4, r7) => t5.add(r7)), t5;
  1630. }
  1631. static async open(e4) {
  1632. const { url: r7, ioConfig: s4, sourceJSON: o8 } = e4;
  1633. let a4 = e4.datasetFormat;
  1634. a4 == null && r7.lastIndexOf(".") && (a4 = r7.slice(r7.lastIndexOf(".") + 1).toUpperCase()), a4 === "OVR" || a4 === "TIF" ? a4 = "TIFF" : a4 !== "JPG" && a4 !== "JPEG" && a4 !== "JFIF" || (a4 = "JPG"), r7.toLowerCase().includes("/imageserver") && !r7.toLowerCase().includes("/wcsserver") && (a4 = "RasterTileServer");
  1635. const n8 = { url: r7, sourceJSON: o8, datasetFormat: a4, ioConfig: s4 || { bandIds: null, sampling: null } };
  1636. let l6, i6;
  1637. if (this.supportedFormats.has(a4)) {
  1638. if (a4 === "CRF" && !s4.enableCRF)
  1639. throw new s2("rasterfactory:open", `cannot open raster: ${r7}`);
  1640. return l6 = c6.get(a4).constructor, i6 = new l6(n8), await i6.open({ signal: e4.signal }), i6;
  1641. }
  1642. if (a4)
  1643. throw new s2("rasterfactory:open", "not a supported format " + a4);
  1644. const u8 = Array.from(c6.keys());
  1645. let F3 = 0;
  1646. const m10 = () => (a4 = u8[F3++], a4 && (a4 !== "CRF" || s4.enableCRF) ? (l6 = c6.get(a4).constructor, i6 = new l6(n8), i6.open({ signal: e4.signal }).then(() => i6).catch(() => m10())) : null);
  1647. return m10();
  1648. }
  1649. static register(t5, e4, r7) {
  1650. c6.has(t5.toUpperCase()) || c6.set(t5.toUpperCase(), { desc: e4, constructor: r7 });
  1651. }
  1652. };
  1653. // node_modules/@arcgis/core/layers/ImageryTileLayer.js
  1654. var L = class extends a2(t2(c2(v2(o3(H2(a3(n2(O(b))))))))) {
  1655. constructor(...e4) {
  1656. super(...e4), this.bandIds = null, this.interpolation = null, this.legendEnabled = true, this.isReference = null, this.listMode = "show", this.sourceJSON = null, this.version = null, this.title = null, this.type = "imagery-tile", this.operationalLayerType = "ArcGISTiledImageServiceLayer", this.popupEnabled = true, this.popupTemplate = null, this.fields = null;
  1657. }
  1658. normalizeCtorArgs(e4, r7) {
  1659. return typeof e4 == "string" ? { url: e4, ...r7 } : e4;
  1660. }
  1661. load(e4) {
  1662. const r7 = r(e4) ? e4.signal : null;
  1663. return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["Image Service"] }, e4).catch(w).then(() => this._openRaster(r7))), Promise.resolve(this);
  1664. }
  1665. get defaultPopupTemplate() {
  1666. return this.createPopupTemplate();
  1667. }
  1668. get rasterFields() {
  1669. let e4 = [new y({ name: "Raster.ServicePixelValue", alias: "Pixel Value", domain: null, editable: false, length: 50, type: "string" })];
  1670. const r7 = this.rasterInfo?.attributeTable?.fields, t5 = "Raster.";
  1671. if (r7) {
  1672. const o9 = r7.filter((e5) => e5.type !== "oid" && e5.name.toLowerCase() !== "value").map((e5) => {
  1673. const r8 = e5.clone();
  1674. return r8.name = t5 + e5.name, r8;
  1675. });
  1676. e4 = e4.concat(o9);
  1677. }
  1678. const o8 = this.rasterInfo.dataType;
  1679. if ((o8 === "vector-magdir" || o8 === "vector-uv") && r(this.rasterInfo.multidimensionalInfo)) {
  1680. const r8 = this.rasterInfo.multidimensionalInfo.variables[0].unit?.trim(), t6 = "Magnitude" + (r8 ? ` (${r8})` : "");
  1681. e4.push(new y({ name: "Raster.Magnitude", alias: t6, domain: null, editable: false, type: "double" })), e4.push(new y({ name: "Raster.Direction", alias: "Direction (\xB0)", domain: null, editable: false, type: "double" }));
  1682. }
  1683. return e4;
  1684. }
  1685. set renderer(e4) {
  1686. this._set("renderer", e4), this.updateRenderer();
  1687. }
  1688. readRenderer(e4, r7, o8) {
  1689. const i6 = r7 && r7.layerDefinition && r7.layerDefinition.drawingInfo && r7.layerDefinition.drawingInfo.renderer, s4 = u4(i6, o8) || void 0;
  1690. if (s4 != null)
  1691. return s4;
  1692. }
  1693. createPopupTemplate(e4) {
  1694. return d2({ fields: this.rasterFields, title: this.title }, e4);
  1695. }
  1696. write(e4, r7) {
  1697. const { raster: t5 } = this;
  1698. if (this.loaded ? t5.datasetFormat === "RasterTileServer" && (t5.tileType === "Raster" || t5.tileType === "Map") : this.url && /\/ImageServer(\/|\/?$)/i.test(this.url))
  1699. return super.write(e4, r7);
  1700. if (r7 && r7.messages) {
  1701. const e5 = `${r7.origin}/${r7.layerContainerType || "operational-layers"}`;
  1702. r7.messages.push(new s2("layer:unsupported", `Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e5}'`, { layer: this }));
  1703. }
  1704. return null;
  1705. }
  1706. async _openRaster(e4) {
  1707. this.raster ? (this.raster.rasterInfo || await this.raster.open(), this.url = this.raster.url) : this.raster = await n7.open({ url: this.url, sourceJSON: this.sourceJSON, ioConfig: { sampling: "closest", ...this.ioConfig, customFetchParameters: this.customParameters }, signal: e4 });
  1708. const { rasterInfo: r7 } = this.raster;
  1709. if (!r7)
  1710. throw new s2("imagery-tile-layer:load", "cannot load resources on " + this.url);
  1711. if (this.sourceJSON = this.sourceJSON || this.raster.sourceJSON, this.sourceJSON != null) {
  1712. const e5 = this.raster.tileType === "Map" && this.sourceJSON.minLOD != null && this.sourceJSON.maxLOD != null ? this.sourceJSON : { ...this.sourceJSON, minScale: 0, maxScale: 0 };
  1713. this.read(e5, { origin: "service" });
  1714. }
  1715. this.title == null && (this.title = this.raster.datasetName), this.raster.tileType === "Map" && (this.popupEnabled = false), this._configDefaultSettings(), this.own(l2(() => this.customParameters, (e5) => {
  1716. this.raster.ioConfig.customFetchParameters = e5;
  1717. }));
  1718. }
  1719. };
  1720. e([d({ type: [S], json: { write: { overridePolicy() {
  1721. return { enabled: !this.loaded || this.raster.tileType === "Raster" || this.bandIds?.join(",") !== "0,1,2" };
  1722. } } } })], L.prototype, "bandIds", void 0), e([d({ json: { write: { overridePolicy() {
  1723. return { enabled: !this.loaded || this.raster.tileType === "Raster" || this.interpolation !== "bilinear" };
  1724. } } } }), r2(o4)], L.prototype, "interpolation", void 0), e([d({ json: { write: true } })], L.prototype, "multidimensionalDefinition", void 0), e([d(c)], L.prototype, "legendEnabled", void 0), e([d({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], L.prototype, "isReference", void 0), e([d({ type: ["show", "hide"] })], L.prototype, "listMode", void 0), e([d({ json: { read: true, write: true } })], L.prototype, "blendMode", void 0), e([d()], L.prototype, "sourceJSON", void 0), e([d({ readOnly: true, json: { origins: { service: { read: { source: "currentVersion" } } } } })], L.prototype, "version", void 0), e([d()], L.prototype, "title", void 0), e([d({ readOnly: true, json: { read: false } })], L.prototype, "type", void 0), e([d({ type: ["ArcGISTiledImageServiceLayer"] })], L.prototype, "operationalLayerType", void 0), e([d({ type: Boolean, value: true, json: { read: { source: "disablePopup", reader: (e4, r7) => !r7.disablePopup }, write: { target: "disablePopup", overridePolicy() {
  1725. return { enabled: !this.loaded || this.raster.tileType === "Raster" };
  1726. }, writer(e4, r7, t5) {
  1727. r7[t5] = !e4;
  1728. } } } })], L.prototype, "popupEnabled", void 0), e([d({ type: B2, json: { read: { source: "popupInfo" }, write: { target: "popupInfo", overridePolicy() {
  1729. return { enabled: !this.loaded || this.raster.tileType === "Raster" };
  1730. } } } })], L.prototype, "popupTemplate", void 0), e([d({ readOnly: true })], L.prototype, "defaultPopupTemplate", null), e([d({ readOnly: true, type: [y] })], L.prototype, "fields", void 0), e([d({ readOnly: true, type: [y] })], L.prototype, "rasterFields", null), e([d({ types: l3, json: { name: "layerDefinition.drawingInfo.renderer", write: { overridePolicy() {
  1731. const e4 = this.renderer?.type === "raster-stretch" && this.renderer.stretchType === "none" && !this.renderer.useGamma;
  1732. return { enabled: !this.loaded || this.raster.tileType === "Raster" || !e4 };
  1733. } }, origins: { "web-scene": { types: i, name: "layerDefinition.drawingInfo.renderer", write: { overridePolicy: (e4) => ({ enabled: e4 && e4.type !== "vector-field" && e4.type !== "flow" }) } } } } })], L.prototype, "renderer", null), e([o("renderer")], L.prototype, "readRenderer", null), L = e([n("esri.layers.ImageryTileLayer")], L);
  1734. var N2 = L;
  1735. export {
  1736. N2 as default
  1737. };
  1738. //# sourceMappingURL=ImageryTileLayer-AO5DNGYN.js.map