chunk-3BKH6ISD.js 164 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922
  1. import {
  2. a as a3,
  3. c as c2,
  4. f,
  5. g,
  6. p as p2,
  7. r as r2,
  8. s as s4
  9. } from "./chunk-TDS6IBMU.js";
  10. import {
  11. p as p3,
  12. v,
  13. y as y3,
  14. z
  15. } from "./chunk-NDUYF7XW.js";
  16. import {
  17. l as l2
  18. } from "./chunk-X4SA4ELJ.js";
  19. import {
  20. a as a2
  21. } from "./chunk-ZLNEXZAN.js";
  22. import {
  23. s as s3
  24. } from "./chunk-HZRKBTHJ.js";
  25. import {
  26. w,
  27. w2
  28. } from "./chunk-6T6G6LCQ.js";
  29. import {
  30. k2 as k
  31. } from "./chunk-PQFTYGF5.js";
  32. import {
  33. e,
  34. l3 as l,
  35. n5 as n,
  36. y3 as y2
  37. } from "./chunk-2Z2TG5CU.js";
  38. import {
  39. a,
  40. p
  41. } from "./chunk-V6P2MAQQ.js";
  42. import {
  43. s2 as s,
  44. s3 as s2
  45. } from "./chunk-E5O6P5I2.js";
  46. import {
  47. y
  48. } from "./chunk-SPWQ3AWG.js";
  49. import {
  50. c,
  51. e as e2,
  52. r,
  53. t
  54. } from "./chunk-YXWMMD76.js";
  55. // node_modules/@arcgis/core/chunks/Zlib.js
  56. var t2;
  57. var e3;
  58. var r3;
  59. var i = { exports: {} };
  60. e3 = i, void 0 !== (t2 = function() {
  61. function t7() {
  62. this.pos = 0, this.bufferLength = 0, this.eof = false, this.buffer = null;
  63. }
  64. return t7.prototype = { ensureBuffer: function(t8) {
  65. var e8 = this.buffer, r11 = e8 ? e8.byteLength : 0;
  66. if (t8 < r11)
  67. return e8;
  68. for (var i7 = 512; i7 < t8; )
  69. i7 <<= 1;
  70. for (var s9 = new Uint8Array(i7), f7 = 0; f7 < r11; ++f7)
  71. s9[f7] = e8[f7];
  72. return this.buffer = s9;
  73. }, getByte: function() {
  74. for (var t8 = this.pos; this.bufferLength <= t8; ) {
  75. if (this.eof)
  76. return null;
  77. this.readBlock();
  78. }
  79. return this.buffer[this.pos++];
  80. }, getBytes: function(t8) {
  81. var e8 = this.pos;
  82. if (t8) {
  83. this.ensureBuffer(e8 + t8);
  84. for (var r11 = e8 + t8; !this.eof && this.bufferLength < r11; )
  85. this.readBlock();
  86. var i7 = this.bufferLength;
  87. r11 > i7 && (r11 = i7);
  88. } else {
  89. for (; !this.eof; )
  90. this.readBlock();
  91. r11 = this.bufferLength;
  92. }
  93. return this.pos = r11, this.buffer.subarray(e8, r11);
  94. }, lookChar: function() {
  95. for (var t8 = this.pos; this.bufferLength <= t8; ) {
  96. if (this.eof)
  97. return null;
  98. this.readBlock();
  99. }
  100. return String.fromCharCode(this.buffer[this.pos]);
  101. }, getChar: function() {
  102. for (var t8 = this.pos; this.bufferLength <= t8; ) {
  103. if (this.eof)
  104. return null;
  105. this.readBlock();
  106. }
  107. return String.fromCharCode(this.buffer[this.pos++]);
  108. }, makeSubStream: function(t8, e8, r11) {
  109. for (var i7 = t8 + e8; this.bufferLength <= i7 && !this.eof; )
  110. this.readBlock();
  111. return new Stream(this.buffer, t8, e8, r11);
  112. }, skip: function(t8) {
  113. t8 || (t8 = 1), this.pos += t8;
  114. }, reset: function() {
  115. this.pos = 0;
  116. } }, t7;
  117. }(), r3 = function() {
  118. if (!self || !self.Uint32Array)
  119. return null;
  120. var e8 = new Uint32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), r11 = new Uint32Array([3, 4, 5, 6, 7, 8, 9, 10, 65547, 65549, 65551, 65553, 131091, 131095, 131099, 131103, 196643, 196651, 196659, 196667, 262211, 262227, 262243, 262259, 327811, 327843, 327875, 327907, 258, 258, 258]), i7 = new Uint32Array([1, 2, 3, 4, 65541, 65543, 131081, 131085, 196625, 196633, 262177, 262193, 327745, 327777, 393345, 393409, 459009, 459137, 524801, 525057, 590849, 591361, 657409, 658433, 724993, 727041, 794625, 798721, 868353, 876545]), s9 = [new Uint32Array([459008, 524368, 524304, 524568, 459024, 524400, 524336, 590016, 459016, 524384, 524320, 589984, 524288, 524416, 524352, 590048, 459012, 524376, 524312, 589968, 459028, 524408, 524344, 590032, 459020, 524392, 524328, 59e4, 524296, 524424, 524360, 590064, 459010, 524372, 524308, 524572, 459026, 524404, 524340, 590024, 459018, 524388, 524324, 589992, 524292, 524420, 524356, 590056, 459014, 524380, 524316, 589976, 459030, 524412, 524348, 590040, 459022, 524396, 524332, 590008, 524300, 524428, 524364, 590072, 459009, 524370, 524306, 524570, 459025, 524402, 524338, 590020, 459017, 524386, 524322, 589988, 524290, 524418, 524354, 590052, 459013, 524378, 524314, 589972, 459029, 524410, 524346, 590036, 459021, 524394, 524330, 590004, 524298, 524426, 524362, 590068, 459011, 524374, 524310, 524574, 459027, 524406, 524342, 590028, 459019, 524390, 524326, 589996, 524294, 524422, 524358, 590060, 459015, 524382, 524318, 589980, 459031, 524414, 524350, 590044, 459023, 524398, 524334, 590012, 524302, 524430, 524366, 590076, 459008, 524369, 524305, 524569, 459024, 524401, 524337, 590018, 459016, 524385, 524321, 589986, 524289, 524417, 524353, 590050, 459012, 524377, 524313, 589970, 459028, 524409, 524345, 590034, 459020, 524393, 524329, 590002, 524297, 524425, 524361, 590066, 459010, 524373, 524309, 524573, 459026, 524405, 524341, 590026, 459018, 524389, 524325, 589994, 524293, 524421, 524357, 590058, 459014, 524381, 524317, 589978, 459030, 524413, 524349, 590042, 459022, 524397, 524333, 590010, 524301, 524429, 524365, 590074, 459009, 524371, 524307, 524571, 459025, 524403, 524339, 590022, 459017, 524387, 524323, 589990, 524291, 524419, 524355, 590054, 459013, 524379, 524315, 589974, 459029, 524411, 524347, 590038, 459021, 524395, 524331, 590006, 524299, 524427, 524363, 590070, 459011, 524375, 524311, 524575, 459027, 524407, 524343, 590030, 459019, 524391, 524327, 589998, 524295, 524423, 524359, 590062, 459015, 524383, 524319, 589982, 459031, 524415, 524351, 590046, 459023, 524399, 524335, 590014, 524303, 524431, 524367, 590078, 459008, 524368, 524304, 524568, 459024, 524400, 524336, 590017, 459016, 524384, 524320, 589985, 524288, 524416, 524352, 590049, 459012, 524376, 524312, 589969, 459028, 524408, 524344, 590033, 459020, 524392, 524328, 590001, 524296, 524424, 524360, 590065, 459010, 524372, 524308, 524572, 459026, 524404, 524340, 590025, 459018, 524388, 524324, 589993, 524292, 524420, 524356, 590057, 459014, 524380, 524316, 589977, 459030, 524412, 524348, 590041, 459022, 524396, 524332, 590009, 524300, 524428, 524364, 590073, 459009, 524370, 524306, 524570, 459025, 524402, 524338, 590021, 459017, 524386, 524322, 589989, 524290, 524418, 524354, 590053, 459013, 524378, 524314, 589973, 459029, 524410, 524346, 590037, 459021, 524394, 524330, 590005, 524298, 524426, 524362, 590069, 459011, 524374, 524310, 524574, 459027, 524406, 524342, 590029, 459019, 524390, 524326, 589997, 524294, 524422, 524358, 590061, 459015, 524382, 524318, 589981, 459031, 524414, 524350, 590045, 459023, 524398, 524334, 590013, 524302, 524430, 524366, 590077, 459008, 524369, 524305, 524569, 459024, 524401, 524337, 590019, 459016, 524385, 524321, 589987, 524289, 524417, 524353, 590051, 459012, 524377, 524313, 589971, 459028, 524409, 524345, 590035, 459020, 524393, 524329, 590003, 524297, 524425, 524361, 590067, 459010, 524373, 524309, 524573, 459026, 524405, 524341, 590027, 459018, 524389, 524325, 589995, 524293, 524421, 524357, 590059, 459014, 524381, 524317, 589979, 459030, 524413, 524349, 590043, 459022, 524397, 524333, 590011, 524301, 524429, 524365, 590075, 459009, 524371, 524307, 524571, 459025, 524403, 524339, 590023, 459017, 524387, 524323, 589991, 524291, 524419, 524355, 590055, 459013, 524379, 524315, 589975, 459029, 524411, 524347, 590039, 459021, 524395, 524331, 590007, 524299, 524427, 524363, 590071, 459011, 524375, 524311, 524575, 459027, 524407, 524343, 590031, 459019, 524391, 524327, 589999, 524295, 524423, 524359, 590063, 459015, 524383, 524319, 589983, 459031, 524415, 524351, 590047, 459023, 524399, 524335, 590015, 524303, 524431, 524367, 590079]), 9], f7 = [new Uint32Array([327680, 327696, 327688, 327704, 327684, 327700, 327692, 327708, 327682, 327698, 327690, 327706, 327686, 327702, 327694, 0, 327681, 327697, 327689, 327705, 327685, 327701, 327693, 327709, 327683, 327699, 327691, 327707, 327687, 327703, 327695, 0]), 5];
  121. function o5(t7) {
  122. throw new Error(t7);
  123. }
  124. function n10(e9) {
  125. var r12 = 0, i8 = e9[r12++], s10 = e9[r12++];
  126. -1 != i8 && -1 != s10 || o5("Invalid header in flate stream"), 8 != (15 & i8) && o5("Unknown compression method in flate stream"), ((i8 << 8) + s10) % 31 != 0 && o5("Bad FCHECK in flate stream"), 32 & s10 && o5("FDICT bit set in flate stream"), this.bytes = e9, this.bytesPos = r12, this.codeSize = 0, this.codeBuf = 0, t2.call(this);
  127. }
  128. return n10.prototype = Object.create(t2.prototype), n10.prototype.getBits = function(t7) {
  129. for (var e9, r12 = this.codeSize, i8 = this.codeBuf, s10 = this.bytes, f8 = this.bytesPos; r12 < t7; )
  130. void 0 === (e9 = s10[f8++]) && o5("Bad encoding in flate stream"), i8 |= e9 << r12, r12 += 8;
  131. return e9 = i8 & (1 << t7) - 1, this.codeBuf = i8 >> t7, this.codeSize = r12 -= t7, this.bytesPos = f8, e9;
  132. }, n10.prototype.getCode = function(t7) {
  133. for (var e9 = t7[0], r12 = t7[1], i8 = this.codeSize, s10 = this.codeBuf, f8 = this.bytes, n11 = this.bytesPos; i8 < r12; ) {
  134. var h5;
  135. void 0 === (h5 = f8[n11++]) && o5("Bad encoding in flate stream"), s10 |= h5 << i8, i8 += 8;
  136. }
  137. var a11 = e9[s10 & (1 << r12) - 1], u6 = a11 >> 16, l8 = 65535 & a11;
  138. return (0 == i8 || i8 < u6 || 0 == u6) && o5("Bad encoding in flate stream"), this.codeBuf = s10 >> u6, this.codeSize = i8 - u6, this.bytesPos = n11, l8;
  139. }, n10.prototype.generateHuffmanTable = function(t7) {
  140. for (var e9 = t7.length, r12 = 0, i8 = 0; i8 < e9; ++i8)
  141. t7[i8] > r12 && (r12 = t7[i8]);
  142. for (var s10 = 1 << r12, f8 = new Uint32Array(s10), o6 = 1, n11 = 0, h5 = 2; o6 <= r12; ++o6, n11 <<= 1, h5 <<= 1)
  143. for (var a11 = 0; a11 < e9; ++a11)
  144. if (t7[a11] == o6) {
  145. var u6 = 0, l8 = n11;
  146. for (i8 = 0; i8 < o6; ++i8)
  147. u6 = u6 << 1 | 1 & l8, l8 >>= 1;
  148. for (i8 = u6; i8 < s10; i8 += h5)
  149. f8[i8] = o6 << 16 | a11;
  150. ++n11;
  151. }
  152. return [f8, r12];
  153. }, n10.prototype.readBlock = function() {
  154. function t7(t8, e9, r12, i8, s10) {
  155. for (var f8 = t8.getBits(r12) + i8; f8-- > 0; )
  156. e9[b3++] = s10;
  157. }
  158. var n11 = this.getBits(3);
  159. if (1 & n11 && (this.eof = true), 0 != (n11 >>= 1)) {
  160. var h5, a11;
  161. if (1 == n11)
  162. h5 = s9, a11 = f7;
  163. else if (2 == n11) {
  164. for (var u6 = this.getBits(5) + 257, l8 = this.getBits(5) + 1, c7 = this.getBits(4) + 4, d4 = Array(e8.length), b3 = 0; b3 < c7; )
  165. d4[e8[b3++]] = this.getBits(3);
  166. for (var v4 = this.generateHuffmanTable(d4), g6 = 0, B2 = (b3 = 0, u6 + l8), p8 = new Array(B2); b3 < B2; ) {
  167. var y6 = this.getCode(v4);
  168. 16 == y6 ? t7(this, p8, 2, 3, g6) : 17 == y6 ? t7(this, p8, 3, 3, g6 = 0) : 18 == y6 ? t7(this, p8, 7, 11, g6 = 0) : p8[b3++] = g6 = y6;
  169. }
  170. h5 = this.generateHuffmanTable(p8.slice(0, u6)), a11 = this.generateHuffmanTable(p8.slice(u6, B2));
  171. } else
  172. o5("Unknown block type in flate stream");
  173. for (var m5 = (x4 = this.buffer) ? x4.length : 0, k5 = this.bufferLength; ; ) {
  174. var w5 = this.getCode(h5);
  175. if (w5 < 256)
  176. k5 + 1 >= m5 && (m5 = (x4 = this.ensureBuffer(k5 + 1)).length), x4[k5++] = w5;
  177. else {
  178. if (256 == w5)
  179. return void (this.bufferLength = k5);
  180. var C4 = (w5 = r11[w5 -= 257]) >> 16;
  181. C4 > 0 && (C4 = this.getBits(C4)), g6 = (65535 & w5) + C4, w5 = this.getCode(a11), (C4 = (w5 = i7[w5]) >> 16) > 0 && (C4 = this.getBits(C4));
  182. var L3 = (65535 & w5) + C4;
  183. k5 + g6 >= m5 && (m5 = (x4 = this.ensureBuffer(k5 + g6)).length);
  184. for (var S4 = 0; S4 < g6; ++S4, ++k5)
  185. x4[k5] = x4[k5 - L3];
  186. }
  187. }
  188. } else {
  189. var A3, U3 = this.bytes, P3 = this.bytesPos;
  190. void 0 === (A3 = U3[P3++]) && o5("Bad block header in flate stream");
  191. var z2 = A3;
  192. void 0 === (A3 = U3[P3++]) && o5("Bad block header in flate stream"), z2 |= A3 << 8, void 0 === (A3 = U3[P3++]) && o5("Bad block header in flate stream");
  193. var H = A3;
  194. void 0 === (A3 = U3[P3++]) && o5("Bad block header in flate stream"), (H |= A3 << 8) != (65535 & ~z2) && o5("Bad uncompressed block length in flate stream"), this.codeBuf = 0, this.codeSize = 0;
  195. var T4 = this.bufferLength, x4 = this.ensureBuffer(T4 + z2), E3 = T4 + z2;
  196. this.bufferLength = E3;
  197. for (var F2 = T4; F2 < E3; ++F2) {
  198. if (void 0 === (A3 = U3[P3++])) {
  199. this.eof = true;
  200. break;
  201. }
  202. x4[F2] = A3;
  203. }
  204. this.bytesPos = P3;
  205. }
  206. }, n10;
  207. }()) && (e3.exports = r3);
  208. var s5 = i.exports;
  209. // node_modules/@arcgis/core/layers/support/rasterFormats/ImageCanvasDecoder.js
  210. var i2 = class {
  211. constructor(t7) {
  212. this._canvas = null, this._ctx = null, t7 && (this._canvas = t7.canvas, this._ctx = t7.ctx || t7.canvas && t7.canvas.getContext("2d"));
  213. }
  214. decode(n10, s9, r11) {
  215. if (!n10 || n10.byteLength < 10)
  216. throw new s2("imagecanvasdecoder: decode", "required a valid encoded data as input.");
  217. let { width: c7 = 0, height: h5 = 0, format: o5 } = s9;
  218. const { applyJpegMask: l8 } = s9;
  219. if (l8 && (!c7 || !h5))
  220. throw new s2("imagecanvasdecoder: decode", "image width and height are needed to apply jpeg mask directly to canvas");
  221. return new Promise((t7, d4) => {
  222. let g6 = null;
  223. "jpg" === o5 && l8 && (g6 = i2._getMask(n10, { width: c7, height: h5 }));
  224. const w5 = new Blob([new Uint8Array(n10)], { type: "image/" + o5 == "jpg" ? "jpeg" : o5 }), v4 = URL.createObjectURL(w5), m5 = new Image();
  225. let _3;
  226. m5.src = v4, m5.onload = () => {
  227. if (URL.revokeObjectURL(v4), p(r11))
  228. return void d4(a());
  229. c7 = m5.width, h5 = m5.height, this._canvas && this._ctx ? (this._canvas.width === c7 && this._canvas.height === h5 || (this._canvas.width = c7, this._canvas.height = h5), this._ctx.clearRect(0, 0, c7, h5)) : (this._canvas = document.createElement("canvas"), this._canvas.width = c7, this._canvas.height = h5, this._ctx = this._canvas.getContext("2d")), this._ctx.drawImage(m5, 0, 0);
  230. const n11 = this._ctx.getImageData(0, 0, c7, h5);
  231. let i7;
  232. if (_3 = n11.data, s9.renderOnCanvas) {
  233. if (g6)
  234. for (i7 = 0; i7 < g6.length; i7++)
  235. g6[i7] ? _3[4 * i7 + 3] = 255 : _3[4 * i7 + 3] = 0;
  236. return this._ctx.putImageData(n11, 0, 0), void t7(null);
  237. }
  238. const o6 = c7 * h5, l9 = new Uint8Array(o6), w6 = new Uint8Array(o6), p8 = new Uint8Array(o6);
  239. if (g6)
  240. for (i7 = 0; i7 < o6; i7++)
  241. l9[i7] = _3[4 * i7], w6[i7] = _3[4 * i7 + 1], p8[i7] = _3[4 * i7 + 2];
  242. else
  243. for (g6 = new Uint8Array(o6), i7 = 0; i7 < o6; i7++)
  244. l9[i7] = _3[4 * i7], w6[i7] = _3[4 * i7 + 1], p8[i7] = _3[4 * i7 + 2], g6[i7] = _3[4 * i7 + 3];
  245. t7({ width: c7, height: h5, pixels: [l9, w6, p8], mask: g6, pixelType: "u8" });
  246. }, m5.onerror = () => {
  247. URL.revokeObjectURL(v4), d4("cannot load image");
  248. };
  249. });
  250. }
  251. static _getMask(t7, e8) {
  252. let a11 = null;
  253. try {
  254. const i7 = new Uint8Array(t7), s9 = Math.ceil(i7.length / 2);
  255. let r11 = 0;
  256. const c7 = i7.length - 2;
  257. for (r11 = s9; r11 < c7 && (255 !== i7[r11] || 217 !== i7[r11 + 1]); r11++)
  258. ;
  259. if (r11 += 2, r11 < i7.length - 1) {
  260. const t8 = new s5(i7.subarray(r11)).getBytes();
  261. a11 = new Uint8Array(e8.width * e8.height);
  262. let s10 = 0;
  263. for (let e9 = 0; e9 < t8.length; e9++)
  264. for (let n10 = 7; n10 >= 0; n10--)
  265. a11[s10++] = t8[e9] >> n10 & 1;
  266. }
  267. } catch (i7) {
  268. }
  269. return a11;
  270. }
  271. };
  272. // node_modules/@arcgis/core/chunks/Jpg.js
  273. var e4;
  274. var n2;
  275. var r4;
  276. var o = { exports: {} };
  277. e4 = o, n2 = function() {
  278. var e8 = function() {
  279. function e9(e10) {
  280. this.message = "JPEG error: " + e10;
  281. }
  282. return e9.prototype = new Error(), e9.prototype.name = "JpegError", e9.constructor = e9, e9;
  283. }();
  284. return function() {
  285. if (!self || !self.Uint8ClampedArray)
  286. return null;
  287. var n10 = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]), r11 = 4017, o5 = 799, a11 = 3406, t7 = 2276, i7 = 1567, s9 = 3784, c7 = 5793, f7 = 2896;
  288. function l8() {
  289. this.decodeTransform = null, this.colorTransform = -1;
  290. }
  291. function u6(e9, n11) {
  292. for (var r12, o6, a12 = 0, t8 = [], i8 = 16; i8 > 0 && !e9[i8 - 1]; )
  293. i8--;
  294. t8.push({ children: [], index: 0 });
  295. var s10, c8 = t8[0];
  296. for (r12 = 0; r12 < i8; r12++) {
  297. for (o6 = 0; o6 < e9[r12]; o6++) {
  298. for ((c8 = t8.pop()).children[c8.index] = n11[a12]; c8.index > 0; )
  299. c8 = t8.pop();
  300. for (c8.index++, t8.push(c8); t8.length <= r12; )
  301. t8.push(s10 = { children: [], index: 0 }), c8.children[c8.index] = s10.children, c8 = s10;
  302. a12++;
  303. }
  304. r12 + 1 < i8 && (t8.push(s10 = { children: [], index: 0 }), c8.children[c8.index] = s10.children, c8 = s10);
  305. }
  306. return t8[0].children;
  307. }
  308. function h5(e9, n11, r12) {
  309. return 64 * ((e9.blocksPerLine + 1) * n11 + r12);
  310. }
  311. function v4(r12, o6, a12, t8, i8, s10, c8, f8, l9) {
  312. var u7 = a12.mcusPerLine, v5 = a12.progressive, m6 = o6, d5 = 0, p8 = 0;
  313. function k5() {
  314. if (p8 > 0)
  315. return p8--, d5 >> p8 & 1;
  316. if (255 === (d5 = r12[o6++])) {
  317. var n11 = r12[o6++];
  318. if (n11)
  319. throw new e8("unexpected marker " + (d5 << 8 | n11).toString(16));
  320. }
  321. return p8 = 7, d5 >>> 7;
  322. }
  323. function g6(n11) {
  324. for (var r13 = n11; ; ) {
  325. if ("number" == typeof (r13 = r13[k5()]))
  326. return r13;
  327. if ("object" != typeof r13)
  328. throw new e8("invalid huffman sequence");
  329. }
  330. }
  331. function C4(e9) {
  332. for (var n11 = 0; e9 > 0; )
  333. n11 = n11 << 1 | k5(), e9--;
  334. return n11;
  335. }
  336. function w5(e9) {
  337. if (1 === e9)
  338. return 1 === k5() ? 1 : -1;
  339. var n11 = C4(e9);
  340. return n11 >= 1 << e9 - 1 ? n11 : n11 + (-1 << e9) + 1;
  341. }
  342. function x4(e9, r13) {
  343. var o7 = g6(e9.huffmanTableDC), a13 = 0 === o7 ? 0 : w5(o7);
  344. e9.blockData[r13] = e9.pred += a13;
  345. for (var t9 = 1; t9 < 64; ) {
  346. var i9 = g6(e9.huffmanTableAC), s11 = 15 & i9, c9 = i9 >> 4;
  347. if (0 !== s11) {
  348. var f9 = n10[t9 += c9];
  349. e9.blockData[r13 + f9] = w5(s11), t9++;
  350. } else {
  351. if (c9 < 15)
  352. break;
  353. t9 += 16;
  354. }
  355. }
  356. }
  357. function y6(e9, n11) {
  358. var r13 = g6(e9.huffmanTableDC), o7 = 0 === r13 ? 0 : w5(r13) << l9;
  359. e9.blockData[n11] = e9.pred += o7;
  360. }
  361. function D4(e9, n11) {
  362. e9.blockData[n11] |= k5() << l9;
  363. }
  364. var T4 = 0;
  365. function P3(e9, r13) {
  366. if (T4 > 0)
  367. T4--;
  368. else
  369. for (var o7 = s10, a13 = c8; o7 <= a13; ) {
  370. var t9 = g6(e9.huffmanTableAC), i9 = 15 & t9, f9 = t9 >> 4;
  371. if (0 !== i9) {
  372. var u8 = n10[o7 += f9];
  373. e9.blockData[r13 + u8] = w5(i9) * (1 << l9), o7++;
  374. } else {
  375. if (f9 < 15) {
  376. T4 = C4(f9) + (1 << f9) - 1;
  377. break;
  378. }
  379. o7 += 16;
  380. }
  381. }
  382. }
  383. var L3, A3 = 0;
  384. function _3(r13, o7) {
  385. for (var a13, t9, i9 = s10, f9 = c8, u8 = 0; i9 <= f9; ) {
  386. var h6 = n10[i9];
  387. switch (A3) {
  388. case 0:
  389. if (u8 = (t9 = g6(r13.huffmanTableAC)) >> 4, 0 == (a13 = 15 & t9))
  390. u8 < 15 ? (T4 = C4(u8) + (1 << u8), A3 = 4) : (u8 = 16, A3 = 1);
  391. else {
  392. if (1 !== a13)
  393. throw new e8("invalid ACn encoding");
  394. L3 = w5(a13), A3 = u8 ? 2 : 3;
  395. }
  396. continue;
  397. case 1:
  398. case 2:
  399. r13.blockData[o7 + h6] ? r13.blockData[o7 + h6] += k5() << l9 : 0 == --u8 && (A3 = 2 === A3 ? 3 : 0);
  400. break;
  401. case 3:
  402. r13.blockData[o7 + h6] ? r13.blockData[o7 + h6] += k5() << l9 : (r13.blockData[o7 + h6] = L3 << l9, A3 = 0);
  403. break;
  404. case 4:
  405. r13.blockData[o7 + h6] && (r13.blockData[o7 + h6] += k5() << l9);
  406. }
  407. i9++;
  408. }
  409. 4 === A3 && 0 == --T4 && (A3 = 0);
  410. }
  411. function U3(e9, n11, r13, o7, a13) {
  412. var t9 = r13 % u7;
  413. n11(e9, h5(e9, (r13 / u7 | 0) * e9.v + o7, t9 * e9.h + a13));
  414. }
  415. function z2(e9, n11, r13) {
  416. n11(e9, h5(e9, r13 / e9.blocksPerLine | 0, r13 % e9.blocksPerLine));
  417. }
  418. var I3, M3, Y, q, S4, R2, H = t8.length;
  419. R2 = v5 ? 0 === s10 ? 0 === f8 ? y6 : D4 : 0 === f8 ? P3 : _3 : x4;
  420. var E3, J, V2, j, B2 = 0;
  421. for (J = 1 === H ? t8[0].blocksPerLine * t8[0].blocksPerColumn : u7 * a12.mcusPerColumn; B2 < J; ) {
  422. var N2 = i8 ? Math.min(J - B2, i8) : J;
  423. for (M3 = 0; M3 < H; M3++)
  424. t8[M3].pred = 0;
  425. if (T4 = 0, 1 === H)
  426. for (I3 = t8[0], S4 = 0; S4 < N2; S4++)
  427. z2(I3, R2, B2), B2++;
  428. else
  429. for (S4 = 0; S4 < N2; S4++) {
  430. for (M3 = 0; M3 < H; M3++)
  431. for (V2 = (I3 = t8[M3]).h, j = I3.v, Y = 0; Y < j; Y++)
  432. for (q = 0; q < V2; q++)
  433. U3(I3, R2, B2, Y, q);
  434. B2++;
  435. }
  436. p8 = 0, (E3 = b3(r12, o6)) && E3.invalid && (console.log("decodeScan - unexpected MCU data, next marker is: " + E3.invalid), o6 = E3.offset);
  437. var G2 = E3 && E3.marker;
  438. if (!G2 || G2 <= 65280)
  439. throw new e8("marker was not found");
  440. if (!(G2 >= 65488 && G2 <= 65495))
  441. break;
  442. o6 += 2;
  443. }
  444. return (E3 = b3(r12, o6)) && E3.invalid && (console.log("decodeScan - unexpected Scan data, next marker is: " + E3.invalid), o6 = E3.offset), o6 - m6;
  445. }
  446. function m5(n11, l9, u7) {
  447. var h6, v5, m6, d5, b4, p8, k5, g6, C4, w5, x4, y6, D4, T4, P3, L3, A3, _3 = n11.quantizationTable, U3 = n11.blockData;
  448. if (!_3)
  449. throw new e8("missing required Quantization Table.");
  450. for (var z2 = 0; z2 < 64; z2 += 8)
  451. C4 = U3[l9 + z2], w5 = U3[l9 + z2 + 1], x4 = U3[l9 + z2 + 2], y6 = U3[l9 + z2 + 3], D4 = U3[l9 + z2 + 4], T4 = U3[l9 + z2 + 5], P3 = U3[l9 + z2 + 6], L3 = U3[l9 + z2 + 7], C4 *= _3[z2], 0 != (w5 | x4 | y6 | D4 | T4 | P3 | L3) ? (w5 *= _3[z2 + 1], x4 *= _3[z2 + 2], y6 *= _3[z2 + 3], D4 *= _3[z2 + 4], T4 *= _3[z2 + 5], P3 *= _3[z2 + 6], L3 *= _3[z2 + 7], v5 = (h6 = (h6 = c7 * C4 + 128 >> 8) + (v5 = c7 * D4 + 128 >> 8) + 1 >> 1) - v5, A3 = (m6 = x4) * s9 + (d5 = P3) * i7 + 128 >> 8, m6 = m6 * i7 - d5 * s9 + 128 >> 8, k5 = (b4 = (b4 = f7 * (w5 - L3) + 128 >> 8) + (k5 = T4 << 4) + 1 >> 1) - k5, p8 = (g6 = (g6 = f7 * (w5 + L3) + 128 >> 8) + (p8 = y6 << 4) + 1 >> 1) - p8, d5 = (h6 = h6 + (d5 = A3) + 1 >> 1) - d5, m6 = (v5 = v5 + m6 + 1 >> 1) - m6, A3 = b4 * t7 + g6 * a11 + 2048 >> 12, b4 = b4 * a11 - g6 * t7 + 2048 >> 12, g6 = A3, A3 = p8 * o5 + k5 * r11 + 2048 >> 12, p8 = p8 * r11 - k5 * o5 + 2048 >> 12, k5 = A3, u7[z2] = h6 + g6, u7[z2 + 7] = h6 - g6, u7[z2 + 1] = v5 + k5, u7[z2 + 6] = v5 - k5, u7[z2 + 2] = m6 + p8, u7[z2 + 5] = m6 - p8, u7[z2 + 3] = d5 + b4, u7[z2 + 4] = d5 - b4) : (A3 = c7 * C4 + 512 >> 10, u7[z2] = A3, u7[z2 + 1] = A3, u7[z2 + 2] = A3, u7[z2 + 3] = A3, u7[z2 + 4] = A3, u7[z2 + 5] = A3, u7[z2 + 6] = A3, u7[z2 + 7] = A3);
  452. for (var I3 = 0; I3 < 8; ++I3)
  453. C4 = u7[I3], 0 != ((w5 = u7[I3 + 8]) | (x4 = u7[I3 + 16]) | (y6 = u7[I3 + 24]) | (D4 = u7[I3 + 32]) | (T4 = u7[I3 + 40]) | (P3 = u7[I3 + 48]) | (L3 = u7[I3 + 56])) ? (v5 = (h6 = 4112 + ((h6 = c7 * C4 + 2048 >> 12) + (v5 = c7 * D4 + 2048 >> 12) + 1 >> 1)) - v5, A3 = (m6 = x4) * s9 + (d5 = P3) * i7 + 2048 >> 12, m6 = m6 * i7 - d5 * s9 + 2048 >> 12, d5 = A3, k5 = (b4 = (b4 = f7 * (w5 - L3) + 2048 >> 12) + (k5 = T4) + 1 >> 1) - k5, p8 = (g6 = (g6 = f7 * (w5 + L3) + 2048 >> 12) + (p8 = y6) + 1 >> 1) - p8, A3 = b4 * t7 + g6 * a11 + 2048 >> 12, b4 = b4 * a11 - g6 * t7 + 2048 >> 12, g6 = A3, A3 = p8 * o5 + k5 * r11 + 2048 >> 12, p8 = p8 * r11 - k5 * o5 + 2048 >> 12, C4 = (C4 = (h6 = h6 + d5 + 1 >> 1) + g6) < 16 ? 0 : C4 >= 4080 ? 255 : C4 >> 4, w5 = (w5 = (v5 = v5 + m6 + 1 >> 1) + (k5 = A3)) < 16 ? 0 : w5 >= 4080 ? 255 : w5 >> 4, x4 = (x4 = (m6 = v5 - m6) + p8) < 16 ? 0 : x4 >= 4080 ? 255 : x4 >> 4, y6 = (y6 = (d5 = h6 - d5) + b4) < 16 ? 0 : y6 >= 4080 ? 255 : y6 >> 4, D4 = (D4 = d5 - b4) < 16 ? 0 : D4 >= 4080 ? 255 : D4 >> 4, T4 = (T4 = m6 - p8) < 16 ? 0 : T4 >= 4080 ? 255 : T4 >> 4, P3 = (P3 = v5 - k5) < 16 ? 0 : P3 >= 4080 ? 255 : P3 >> 4, L3 = (L3 = h6 - g6) < 16 ? 0 : L3 >= 4080 ? 255 : L3 >> 4, U3[l9 + I3] = C4, U3[l9 + I3 + 8] = w5, U3[l9 + I3 + 16] = x4, U3[l9 + I3 + 24] = y6, U3[l9 + I3 + 32] = D4, U3[l9 + I3 + 40] = T4, U3[l9 + I3 + 48] = P3, U3[l9 + I3 + 56] = L3) : (A3 = (A3 = c7 * C4 + 8192 >> 14) < -2040 ? 0 : A3 >= 2024 ? 255 : A3 + 2056 >> 4, U3[l9 + I3] = A3, U3[l9 + I3 + 8] = A3, U3[l9 + I3 + 16] = A3, U3[l9 + I3 + 24] = A3, U3[l9 + I3 + 32] = A3, U3[l9 + I3 + 40] = A3, U3[l9 + I3 + 48] = A3, U3[l9 + I3 + 56] = A3);
  454. }
  455. function d4(e9, n11) {
  456. for (var r12 = n11.blocksPerLine, o6 = n11.blocksPerColumn, a12 = new Int16Array(64), t8 = 0; t8 < o6; t8++)
  457. for (var i8 = 0; i8 < r12; i8++)
  458. m5(n11, h5(n11, t8, i8), a12);
  459. return n11.blockData;
  460. }
  461. function b3(e9, n11, r12) {
  462. function o6(n12) {
  463. return e9[n12] << 8 | e9[n12 + 1];
  464. }
  465. var a12 = e9.length - 1, t8 = r12 < n11 ? r12 : n11;
  466. if (n11 >= a12)
  467. return null;
  468. var i8 = o6(n11);
  469. if (i8 >= 65472 && i8 <= 65534)
  470. return { invalid: null, marker: i8, offset: n11 };
  471. for (var s10 = o6(t8); !(s10 >= 65472 && s10 <= 65534); ) {
  472. if (++t8 >= a12)
  473. return null;
  474. s10 = o6(t8);
  475. }
  476. return { invalid: i8.toString(16), marker: s10, offset: t8 };
  477. }
  478. return l8.prototype = { parse: function(r12) {
  479. function o6() {
  480. var e9 = r12[c8] << 8 | r12[c8 + 1];
  481. return c8 += 2, e9;
  482. }
  483. function a12() {
  484. var e9 = o6(), n11 = c8 + e9 - 2, a13 = b3(r12, n11, c8);
  485. a13 && a13.invalid && (console.log("readDataBlock - incorrect length, next marker is: " + a13.invalid), n11 = a13.offset);
  486. var t9 = r12.subarray(c8, n11);
  487. return c8 += t9.length, t9;
  488. }
  489. function t8(e9) {
  490. for (var n11 = Math.ceil(e9.samplesPerLine / 8 / e9.maxH), r13 = Math.ceil(e9.scanLines / 8 / e9.maxV), o7 = 0; o7 < e9.components.length; o7++) {
  491. H = e9.components[o7];
  492. var a13 = Math.ceil(Math.ceil(e9.samplesPerLine / 8) * H.h / e9.maxH), t9 = Math.ceil(Math.ceil(e9.scanLines / 8) * H.v / e9.maxV), i9 = n11 * H.h, s11 = r13 * H.v * 64 * (i9 + 1);
  493. H.blockData = new Int16Array(s11), H.blocksPerLine = a13, H.blocksPerColumn = t9;
  494. }
  495. e9.mcusPerLine = n11, e9.mcusPerColumn = r13;
  496. }
  497. var i8, s10, c8 = 0, f8 = null, l9 = null, h6 = [], m6 = [], p8 = [], k5 = o6();
  498. if (65496 !== k5)
  499. throw new e8("SOI not found");
  500. for (k5 = o6(); 65497 !== k5; ) {
  501. var g6, C4, w5;
  502. switch (k5) {
  503. case 65504:
  504. case 65505:
  505. case 65506:
  506. case 65507:
  507. case 65508:
  508. case 65509:
  509. case 65510:
  510. case 65511:
  511. case 65512:
  512. case 65513:
  513. case 65514:
  514. case 65515:
  515. case 65516:
  516. case 65517:
  517. case 65518:
  518. case 65519:
  519. case 65534:
  520. var x4 = a12();
  521. 65504 === k5 && 74 === x4[0] && 70 === x4[1] && 73 === x4[2] && 70 === x4[3] && 0 === x4[4] && (f8 = { version: { major: x4[5], minor: x4[6] }, densityUnits: x4[7], xDensity: x4[8] << 8 | x4[9], yDensity: x4[10] << 8 | x4[11], thumbWidth: x4[12], thumbHeight: x4[13], thumbData: x4.subarray(14, 14 + 3 * x4[12] * x4[13]) }), 65518 === k5 && 65 === x4[0] && 100 === x4[1] && 111 === x4[2] && 98 === x4[3] && 101 === x4[4] && (l9 = { version: x4[5] << 8 | x4[6], flags0: x4[7] << 8 | x4[8], flags1: x4[9] << 8 | x4[10], transformCode: x4[11] });
  522. break;
  523. case 65499:
  524. for (var y6 = o6() + c8 - 2; c8 < y6; ) {
  525. var D4 = r12[c8++], T4 = new Uint16Array(64);
  526. if (D4 >> 4 == 0)
  527. for (C4 = 0; C4 < 64; C4++)
  528. T4[n10[C4]] = r12[c8++];
  529. else {
  530. if (D4 >> 4 != 1)
  531. throw new e8("DQT - invalid table spec");
  532. for (C4 = 0; C4 < 64; C4++)
  533. T4[n10[C4]] = o6();
  534. }
  535. h6[15 & D4] = T4;
  536. }
  537. break;
  538. case 65472:
  539. case 65473:
  540. case 65474:
  541. if (i8)
  542. throw new e8("Only single frame JPEGs supported");
  543. o6(), (i8 = {}).extended = 65473 === k5, i8.progressive = 65474 === k5, i8.precision = r12[c8++], i8.scanLines = o6(), i8.samplesPerLine = o6(), i8.components = [], i8.componentIds = {};
  544. var P3, L3 = r12[c8++], A3 = 0, _3 = 0;
  545. for (g6 = 0; g6 < L3; g6++) {
  546. P3 = r12[c8];
  547. var U3 = r12[c8 + 1] >> 4, z2 = 15 & r12[c8 + 1];
  548. A3 < U3 && (A3 = U3), _3 < z2 && (_3 = z2);
  549. var I3 = r12[c8 + 2];
  550. w5 = i8.components.push({ h: U3, v: z2, quantizationId: I3, quantizationTable: null }), i8.componentIds[P3] = w5 - 1, c8 += 3;
  551. }
  552. i8.maxH = A3, i8.maxV = _3, t8(i8);
  553. break;
  554. case 65476:
  555. var M3 = o6();
  556. for (g6 = 2; g6 < M3; ) {
  557. var Y = r12[c8++], q = new Uint8Array(16), S4 = 0;
  558. for (C4 = 0; C4 < 16; C4++, c8++)
  559. S4 += q[C4] = r12[c8];
  560. var R2 = new Uint8Array(S4);
  561. for (C4 = 0; C4 < S4; C4++, c8++)
  562. R2[C4] = r12[c8];
  563. g6 += 17 + S4, (Y >> 4 == 0 ? p8 : m6)[15 & Y] = u6(q, R2);
  564. }
  565. break;
  566. case 65501:
  567. o6(), s10 = o6();
  568. break;
  569. case 65498:
  570. o6();
  571. var H, E3 = r12[c8++], J = [];
  572. for (g6 = 0; g6 < E3; g6++) {
  573. var V2 = i8.componentIds[r12[c8++]];
  574. H = i8.components[V2];
  575. var j = r12[c8++];
  576. H.huffmanTableDC = p8[j >> 4], H.huffmanTableAC = m6[15 & j], J.push(H);
  577. }
  578. var B2 = r12[c8++], N2 = r12[c8++], G2 = r12[c8++], O4 = v4(r12, c8, i8, J, s10, B2, N2, G2 >> 4, 15 & G2);
  579. c8 += O4;
  580. break;
  581. case 65535:
  582. 255 !== r12[c8] && c8--;
  583. break;
  584. default:
  585. if (255 === r12[c8 - 3] && r12[c8 - 2] >= 192 && r12[c8 - 2] <= 254) {
  586. c8 -= 3;
  587. break;
  588. }
  589. throw new e8("unknown marker " + k5.toString(16));
  590. }
  591. k5 = o6();
  592. }
  593. for (this.width = i8.samplesPerLine, this.height = i8.scanLines, this.jfif = f8, this.eof = c8, this.adobe = l9, this.components = [], g6 = 0; g6 < i8.components.length; g6++) {
  594. var Q = h6[(H = i8.components[g6]).quantizationId];
  595. Q && (H.quantizationTable = Q), this.components.push({ output: d4(i8, H), scaleX: H.h / i8.maxH, scaleY: H.v / i8.maxV, blocksPerLine: H.blocksPerLine, blocksPerColumn: H.blocksPerColumn });
  596. }
  597. this.numComponents = this.components.length;
  598. }, _getLinearizedBlockData: function(e9, n11) {
  599. var r12, o6, a12, t8, i8, s10, c8, f8, l9, u7, h6, v5 = this.width / e9, m6 = this.height / n11, d5 = 0, b4 = this.components.length, p8 = e9 * n11 * b4, k5 = new Uint8ClampedArray(p8), g6 = new Uint32Array(e9), C4 = 4294967288;
  600. for (c8 = 0; c8 < b4; c8++) {
  601. for (o6 = (r12 = this.components[c8]).scaleX * v5, a12 = r12.scaleY * m6, d5 = c8, h6 = r12.output, t8 = r12.blocksPerLine + 1 << 3, i8 = 0; i8 < e9; i8++)
  602. f8 = 0 | i8 * o6, g6[i8] = (f8 & C4) << 3 | 7 & f8;
  603. for (s10 = 0; s10 < n11; s10++)
  604. for (u7 = t8 * ((f8 = 0 | s10 * a12) & C4) | (7 & f8) << 3, i8 = 0; i8 < e9; i8++)
  605. k5[d5] = h6[u7 + g6[i8]], d5 += b4;
  606. }
  607. var w5 = this.decodeTransform;
  608. if (w5)
  609. for (c8 = 0; c8 < p8; )
  610. for (f8 = 0, l9 = 0; f8 < b4; f8++, c8++, l9 += 2)
  611. k5[c8] = (k5[c8] * w5[l9] >> 8) + w5[l9 + 1];
  612. return k5;
  613. }, _isColorConversionNeeded: function() {
  614. return this.adobe ? !!this.adobe.transformCode : 3 === this.numComponents ? 0 !== this.colorTransform : 1 === this.colorTransform;
  615. }, _convertYccToRgb: function(e9) {
  616. for (var n11, r12, o6, a12 = 0, t8 = e9.length; a12 < t8; a12 += 3)
  617. n11 = e9[a12], r12 = e9[a12 + 1], o6 = e9[a12 + 2], e9[a12] = n11 - 179.456 + 1.402 * o6, e9[a12 + 1] = n11 + 135.459 - 0.344 * r12 - 0.714 * o6, e9[a12 + 2] = n11 - 226.816 + 1.772 * r12;
  618. return e9;
  619. }, _convertYcckToRgb: function(e9) {
  620. for (var n11, r12, o6, a12, t8 = 0, i8 = 0, s10 = e9.length; i8 < s10; i8 += 4)
  621. n11 = e9[i8], r12 = e9[i8 + 1], o6 = e9[i8 + 2], a12 = e9[i8 + 3], e9[t8++] = r12 * (-660635669420364e-19 * r12 + 437130475926232e-18 * o6 - 54080610064599e-18 * n11 + 48449797120281e-17 * a12 - 0.154362151871126) - 122.67195406894 + o6 * (-957964378445773e-18 * o6 + 817076911346625e-18 * n11 - 0.00477271405408747 * a12 + 1.53380253221734) + n11 * (961250184130688e-18 * n11 - 0.00266257332283933 * a12 + 0.48357088451265) + a12 * (-336197177618394e-18 * a12 + 0.484791561490776), e9[t8++] = 107.268039397724 + r12 * (219927104525741e-19 * r12 - 640992018297945e-18 * o6 + 659397001245577e-18 * n11 + 426105652938837e-18 * a12 - 0.176491792462875) + o6 * (-778269941513683e-18 * o6 + 0.00130872261408275 * n11 + 770482631801132e-18 * a12 - 0.151051492775562) + n11 * (0.00126935368114843 * n11 - 0.00265090189010898 * a12 + 0.25802910206845) + a12 * (-318913117588328e-18 * a12 - 0.213742400323665), e9[t8++] = r12 * (-570115196973677e-18 * r12 - 263409051004589e-19 * o6 + 0.0020741088115012 * n11 - 0.00288260236853442 * a12 + 0.814272968359295) - 20.810012546947 + o6 * (-153496057440975e-19 * o6 - 132689043961446e-18 * n11 + 560833691242812e-18 * a12 - 0.195152027534049) + n11 * (0.00174418132927582 * n11 - 0.00255243321439347 * a12 + 0.116935020465145) + a12 * (-343531996510555e-18 * a12 + 0.24165260232407);
  622. return e9;
  623. }, _convertYcckToCmyk: function(e9) {
  624. for (var n11, r12, o6, a12 = 0, t8 = e9.length; a12 < t8; a12 += 4)
  625. n11 = e9[a12], r12 = e9[a12 + 1], o6 = e9[a12 + 2], e9[a12] = 434.456 - n11 - 1.402 * o6, e9[a12 + 1] = 119.541 - n11 + 0.344 * r12 + 0.714 * o6, e9[a12 + 2] = 481.816 - n11 - 1.772 * r12;
  626. return e9;
  627. }, _convertCmykToRgb: function(e9) {
  628. for (var n11, r12, o6, a12, t8 = 0, i8 = 1 / 255, s10 = 0, c8 = e9.length; s10 < c8; s10 += 4)
  629. n11 = e9[s10] * i8, r12 = e9[s10 + 1] * i8, o6 = e9[s10 + 2] * i8, a12 = e9[s10 + 3] * i8, e9[t8++] = 255 + n11 * (-4.387332384609988 * n11 + 54.48615194189176 * r12 + 18.82290502165302 * o6 + 212.25662451639585 * a12 - 285.2331026137004) + r12 * (1.7149763477362134 * r12 - 5.6096736904047315 * o6 - 17.873870861415444 * a12 - 5.497006427196366) + o6 * (-2.5217340131683033 * o6 - 21.248923337353073 * a12 + 17.5119270841813) - a12 * (21.86122147463605 * a12 + 189.48180835922747), e9[t8++] = 255 + n11 * (8.841041422036149 * n11 + 60.118027045597366 * r12 + 6.871425592049007 * o6 + 31.159100130055922 * a12 - 79.2970844816548) + r12 * (-15.310361306967817 * r12 + 17.575251261109482 * o6 + 131.35250912493976 * a12 - 190.9453302588951) + o6 * (4.444339102852739 * o6 + 9.8632861493405 * a12 - 24.86741582555878) - a12 * (20.737325471181034 * a12 + 187.80453709719578), e9[t8++] = 255 + n11 * (0.8842522430003296 * n11 + 8.078677503112928 * r12 + 30.89978309703729 * o6 - 0.23883238689178934 * a12 - 14.183576799673286) + r12 * (10.49593273432072 * r12 + 63.02378494754052 * o6 + 50.606957656360734 * a12 - 112.23884253719248) + o6 * (0.03296041114873217 * o6 + 115.60384449646641 * a12 - 193.58209356861505) - a12 * (22.33816807309886 * a12 + 180.12613974708367);
  630. return e9;
  631. }, getData: function(n11, r12, o6) {
  632. if (this.numComponents > 4)
  633. throw new e8("Unsupported color mode");
  634. var a12 = this._getLinearizedBlockData(n11, r12);
  635. if (1 === this.numComponents && o6) {
  636. for (var t8 = a12.length, i8 = new Uint8ClampedArray(3 * t8), s10 = 0, c8 = 0; c8 < t8; c8++) {
  637. var f8 = a12[c8];
  638. i8[s10++] = f8, i8[s10++] = f8, i8[s10++] = f8;
  639. }
  640. return i8;
  641. }
  642. if (3 === this.numComponents && this._isColorConversionNeeded())
  643. return this._convertYccToRgb(a12);
  644. if (4 === this.numComponents) {
  645. if (this._isColorConversionNeeded())
  646. return o6 ? this._convertYcckToRgb(a12) : this._convertYcckToCmyk(a12);
  647. if (o6)
  648. return this._convertCmykToRgb(a12);
  649. }
  650. return a12;
  651. } }, l8;
  652. }();
  653. }, void 0 !== (r4 = n2()) && (e4.exports = r4);
  654. var a4 = o.exports;
  655. // node_modules/@arcgis/core/layers/support/rasterFormats/JpgPlus.js
  656. var r5 = class {
  657. static decode(r11, n10 = false) {
  658. const s9 = new Uint8Array(r11), o5 = new a4();
  659. o5.parse(s9);
  660. const { width: a11, height: i7, numComponents: h5, eof: l8 } = o5, f7 = o5.getData(a11, i7, true), c7 = a11 * i7;
  661. let g6, p8 = null, u6 = 0, m5 = 0, w5 = 0;
  662. if (!n10 && l8 < s9.length - 1)
  663. try {
  664. const t7 = new s5(s9.subarray(l8)).getBytes();
  665. p8 = new Uint8Array(c7);
  666. let r12 = 0;
  667. for (u6 = 0; u6 < t7.length; u6++)
  668. for (w5 = 7; w5 >= 0; w5--)
  669. p8[r12++] = t7[u6] >> w5 & 1;
  670. } catch {
  671. }
  672. if (1 === h5 && f7.length === a11 * i7)
  673. g6 = [f7, f7, f7];
  674. else {
  675. for (g6 = [], u6 = 0; u6 < 3; u6++)
  676. g6.push(new Uint8Array(c7));
  677. for (w5 = 0, m5 = 0; m5 < c7; m5++)
  678. for (u6 = 0; u6 < 3; u6++)
  679. g6[u6][m5] = f7[w5++];
  680. }
  681. return { width: a11, height: i7, pixels: g6, mask: p8 };
  682. }
  683. };
  684. // node_modules/@arcgis/core/layers/support/rasterFormats/Lerc.js
  685. var t3 = [{ pixelType: "S8", size: 1, ctor: Int8Array, range: [-128, 128] }, { pixelType: "U8", size: 1, ctor: Uint8Array, range: [0, 255] }, { pixelType: "S16", size: 2, ctor: Int16Array, range: [-32768, 32767] }, { pixelType: "U16", size: 2, ctor: Uint16Array, range: [0, 65536] }, { pixelType: "S32", size: 4, ctor: Int32Array, range: [-2147483648, 2147483647] }, { pixelType: "U32", size: 4, ctor: Uint32Array, range: [0, 4294967296] }, { pixelType: "F32", size: 4, ctor: Float32Array, range: [-34027999387901484e22, 34027999387901484e22] }, { pixelType: "F64", size: 8, ctor: Float64Array, range: [-17976931348623157e292, 17976931348623157e292] }];
  686. var n3 = null;
  687. var r6 = false;
  688. function a5() {
  689. return n3 || (n3 = import("./lerc-wasm-JMHVUN5O.js").then((e8) => e8.l).then(({ default: t7 }) => t7({ locateFile: (t8) => a2(`esri/layers/support/rasterFormats/${t8}`) })).then((e8) => {
  690. u(e8), r6 = true;
  691. }), n3);
  692. }
  693. var l3 = { getBlobInfo: null, decode: null };
  694. function s6(e8) {
  695. return 16 + (e8 >> 3 << 3);
  696. }
  697. function i3(e8, t7, n10) {
  698. n10.set(e8.slice(t7, t7 + n10.length));
  699. }
  700. function u(e8) {
  701. const { _malloc: n10, _free: r11, _lerc_getBlobInfo: a11, _lerc_getDataRanges: o5, _lerc_decode_4D: u6, asm: f7 } = e8;
  702. let c7;
  703. const h5 = Object.values(f7).find((t7) => t7 && "buffer" in t7 && t7.buffer === e8.HEAPU8.buffer), y6 = (e9) => {
  704. const t7 = e9.map((e10) => s6(e10)), r12 = t7.reduce((e10, t8) => e10 + t8), a12 = n10(r12);
  705. c7 = new Uint8Array(h5.buffer);
  706. let o6 = t7[0];
  707. t7[0] = a12;
  708. for (let n11 = 1; n11 < t7.length; n11++) {
  709. const e10 = t7[n11];
  710. t7[n11] = t7[n11 - 1] + o6, o6 = e10;
  711. }
  712. return t7;
  713. };
  714. l3.getBlobInfo = (e9) => {
  715. const t7 = 12, n11 = 3, l8 = new Uint8Array(4 * t7), s9 = new Uint8Array(8 * n11), [u7, f8, p8] = y6([e9.length, l8.length, s9.length]);
  716. c7.set(e9, u7), c7.set(l8, f8), c7.set(s9, p8);
  717. let g6 = a11(u7, e9.length, f8, p8, t7, n11);
  718. if (g6)
  719. throw r11(u7), `lerc-getBlobInfo: error code is ${g6}`;
  720. c7 = new Uint8Array(h5.buffer), i3(c7, f8, l8), i3(c7, p8, s9);
  721. const d4 = new Uint32Array(l8.buffer), b3 = new Float64Array(s9.buffer), [A3, w5, , m5, U3, x4, C4, T4, V2, z2, F2] = d4, I3 = { version: A3, depthCount: z2, width: m5, height: U3, validPixelCount: C4, bandCount: x4, blobSize: T4, maskCount: V2, dataType: w5, minValue: b3[0], maxValue: b3[1], maxZerror: b3[2], statistics: [], bandCountWithNoData: F2 };
  722. if (F2)
  723. return I3;
  724. if (1 === z2 && 1 === x4)
  725. return r11(u7), I3.statistics.push({ minValue: b3[0], maxValue: b3[1] }), I3;
  726. const D4 = z2 * x4 * 8, _3 = new Uint8Array(D4), k5 = new Uint8Array(D4);
  727. let B2 = u7, S4 = 0, v4 = 0, O4 = false;
  728. if (c7.byteLength < u7 + 2 * D4 ? (r11(u7), O4 = true, [B2, S4, v4] = y6([e9.length, D4, D4]), c7.set(e9, B2)) : [S4, v4] = y6([D4, D4]), c7.set(_3, S4), c7.set(k5, v4), g6 = o5(B2, e9.length, z2, x4, S4, v4), g6)
  729. throw r11(B2), O4 || r11(S4), `lerc-getDataRanges: error code is ${g6}`;
  730. c7 = new Uint8Array(h5.buffer), i3(c7, S4, _3), i3(c7, v4, k5);
  731. const $ = new Float64Array(_3.buffer), j = new Float64Array(k5.buffer), M3 = I3.statistics;
  732. for (let r12 = 0; r12 < x4; r12++)
  733. if (z2 > 1) {
  734. const e10 = $.slice(r12 * z2, (r12 + 1) * z2), t8 = j.slice(r12 * z2, (r12 + 1) * z2), n12 = Math.min.apply(null, e10), a12 = Math.max.apply(null, t8);
  735. M3.push({ minValue: n12, maxValue: a12, depthStats: { minValues: e10, maxValues: t8 } });
  736. } else
  737. M3.push({ minValue: $[r12], maxValue: j[r12] });
  738. return r11(B2), O4 || r11(S4), I3;
  739. }, l3.decode = (e9, n11) => {
  740. const { maskCount: a12, depthCount: o6, bandCount: l8, width: s9, height: f8, dataType: p8, bandCountWithNoData: g6 } = n11, d4 = t3[p8], b3 = s9 * f8, A3 = new Uint8Array(b3 * l8), w5 = b3 * o6 * l8 * d4.size, m5 = new Uint8Array(w5), U3 = new Uint8Array(l8), x4 = new Uint8Array(8 * l8), [C4, T4, V2, z2, F2] = y6([e9.length, A3.length, m5.length, U3.length, x4.length]);
  741. c7.set(e9, C4), c7.set(A3, T4), c7.set(m5, V2), c7.set(U3, z2), c7.set(x4, F2);
  742. const I3 = u6(C4, e9.length, a12, T4, o6, s9, f8, l8, p8, V2, z2, F2);
  743. if (I3)
  744. throw r11(C4), `lerc-decode: error code is ${I3}`;
  745. c7 = new Uint8Array(h5.buffer), i3(c7, V2, m5), i3(c7, T4, A3);
  746. let D4 = null;
  747. if (g6) {
  748. i3(c7, z2, U3), i3(c7, F2, x4), D4 = [];
  749. const e10 = new Float64Array(x4.buffer);
  750. for (let t7 = 0; t7 < U3.length; t7++)
  751. D4.push(U3[t7] ? e10[t7] : null);
  752. }
  753. return r11(C4), { data: m5, maskData: A3, noDataValues: D4 };
  754. };
  755. }
  756. function f2(e8, t7, n10, r11, a11) {
  757. if (n10 < 2)
  758. return e8;
  759. const o5 = new r11(t7 * n10);
  760. if (a11)
  761. for (let l8 = 0, s9 = 0; l8 < t7; l8++)
  762. for (let r12 = 0, a12 = l8; r12 < n10; r12++, a12 += t7)
  763. o5[a12] = e8[s9++];
  764. else
  765. for (let l8 = 0, s9 = 0; l8 < t7; l8++)
  766. for (let r12 = 0, a12 = l8; r12 < n10; r12++, a12 += t7)
  767. o5[s9++] = e8[a12];
  768. return o5;
  769. }
  770. function c3(e8, n10 = {}) {
  771. var _a;
  772. const r11 = (_a = n10.inputOffset) != null ? _a : 0, a11 = e8 instanceof Uint8Array ? e8.subarray(r11) : new Uint8Array(e8, r11), o5 = l3.getBlobInfo(a11), { data: s9, maskData: i7 } = l3.decode(a11, o5), { width: u6, height: c7, bandCount: h5, depthCount: y6, dataType: p8, maskCount: g6, statistics: d4 } = o5, b3 = t3[p8], A3 = new b3.ctor(s9.buffer), w5 = [], m5 = [], U3 = u6 * c7, x4 = U3 * y6;
  773. for (let t7 = 0; t7 < h5; t7++) {
  774. const e9 = A3.subarray(t7 * x4, (t7 + 1) * x4);
  775. if (n10.returnInterleaved)
  776. w5.push(e9);
  777. else {
  778. const t8 = f2(e9, U3, y6, b3.ctor, true);
  779. w5.push(t8);
  780. }
  781. m5.push(i7.subarray(t7 * x4, (t7 + 1) * x4));
  782. }
  783. const C4 = 0 === g6 ? null : 1 === g6 ? m5[0] : new Uint8Array(U3);
  784. if (g6 > 1) {
  785. C4.set(m5[0]);
  786. for (let e9 = 1; e9 < m5.length; e9++) {
  787. const t7 = m5[e9];
  788. for (let e10 = 0; e10 < U3; e10++)
  789. C4[e10] = C4[e10] & t7[e10];
  790. }
  791. }
  792. const { noDataValue: T4 } = n10, V2 = null != T4 && b3.range[0] <= T4 && b3.range[1] >= T4;
  793. if (g6 > 0 && V2)
  794. for (let t7 = 0; t7 < h5; t7++) {
  795. const e9 = w5[t7], n11 = m5[t7] || C4;
  796. for (let t8 = 0; t8 < U3; t8++)
  797. 0 === n11[t8] && (e9[t8] = T4);
  798. }
  799. const z2 = g6 === h5 && h5 > 1 ? m5 : null, { pixelType: F2 } = b3;
  800. return { width: u6, height: c7, bandCount: h5, pixelType: F2, depthCount: y6, statistics: d4, pixels: w5, mask: C4, bandMasks: z2 };
  801. }
  802. // node_modules/@arcgis/core/layers/support/rasterFormats/Lzw.js
  803. function e5(e8, n10, t7, r11 = true) {
  804. if (n10 % 4 != 0 || t7 % 4 != 0) {
  805. const i7 = new ArrayBuffer(4 * Math.ceil(t7 / 4)), l8 = new Uint8Array(i7), o5 = new Uint8Array(e8, n10, t7);
  806. if (r11)
  807. for (let e9 = 0; e9 < l8.length; e9 += 4)
  808. l8[e9] = o5[e9 + 3], l8[e9 + 1] = o5[e9 + 2], l8[e9 + 2] = o5[e9 + 1], l8[e9 + 3] = o5[e9];
  809. else
  810. l8.set(o5);
  811. return new Uint32Array(l8.buffer);
  812. }
  813. if (r11) {
  814. const r12 = new Uint8Array(e8, n10, t7), i7 = new Uint8Array(r12.length);
  815. for (let e9 = 0; e9 < i7.length; e9 += 4)
  816. i7[e9] = r12[e9 + 3], i7[e9 + 1] = r12[e9 + 2], i7[e9 + 2] = r12[e9 + 1], i7[e9 + 3] = r12[e9];
  817. return new Uint32Array(i7.buffer);
  818. }
  819. return new Uint32Array(e8, n10, t7 / 4);
  820. }
  821. function n4() {
  822. const e8 = [];
  823. for (let n10 = 0; n10 <= 257; n10++)
  824. e8[n10] = [n10];
  825. return e8;
  826. }
  827. function t4(e8, n10) {
  828. for (let t7 = 0; t7 < n10.length; t7++)
  829. e8.push(n10[t7]);
  830. }
  831. var r7 = /* @__PURE__ */ new Set();
  832. function i4(i7, l8, o5, f7 = true) {
  833. const s9 = e5(i7, l8, o5, f7);
  834. let a11 = 9, c7 = n4(), u6 = 32, h5 = c7.length, d4 = [], g6 = 1, w5 = s9[0], y6 = 0;
  835. const A3 = s9.length, U3 = 8 * (4 * A3 - o5), p8 = [];
  836. for (; null != w5; ) {
  837. if (u6 >= a11)
  838. u6 -= a11, y6 = w5 >>> 32 - a11, w5 <<= a11;
  839. else {
  840. y6 = w5 >>> 32 - u6, w5 = s9[g6++];
  841. const e9 = a11 - u6;
  842. u6 = 32 - e9, y6 = (y6 << e9) + (w5 >>> u6), w5 <<= e9;
  843. }
  844. if (257 === y6)
  845. break;
  846. if (256 === y6) {
  847. a11 = 9, c7 = n4(), h5 = c7.length, d4 = [];
  848. continue;
  849. }
  850. const e8 = c7[y6];
  851. if (null == e8) {
  852. if (y6 > c7.length)
  853. throw "data integrity issue: code does not exist on code page";
  854. d4.push(d4[0]), c7[h5++] = d4.slice(), t4(p8, d4);
  855. } else
  856. t4(p8, e8), d4.push(e8[0]), d4.length > 1 && (c7[h5++] = d4.slice()), d4 = e8.slice();
  857. if (r7.has(h5) && a11++, 0 === u6 && (w5 = s9[g6++], u6 = 32), g6 > A3 || g6 === A3 && u6 <= U3)
  858. break;
  859. }
  860. return new Uint8Array(p8);
  861. }
  862. r7.add(511), r7.add(1023), r7.add(2047), r7.add(4095), r7.add(8191);
  863. // node_modules/@arcgis/core/layers/support/rasterFormats/Raw.js
  864. var e6 = (e8, r11) => {
  865. const a11 = r11.width * r11.height, n10 = r11.pixelType;
  866. return Math.floor(e8.byteLength / (a11 * t5(n10)));
  867. };
  868. var t5 = (e8) => {
  869. let t7 = 1;
  870. switch (e8) {
  871. case Uint8Array:
  872. case Int8Array:
  873. t7 = 1;
  874. break;
  875. case Uint16Array:
  876. case Int16Array:
  877. t7 = 2;
  878. break;
  879. case Uint32Array:
  880. case Int32Array:
  881. case Float32Array:
  882. t7 = 4;
  883. break;
  884. case Float64Array:
  885. t7 = 8;
  886. }
  887. return t7;
  888. };
  889. var r8 = (e8, t7) => {
  890. if (8 * e8.byteLength < t7)
  891. return null;
  892. const r11 = new Uint8Array(e8, 0, Math.ceil(t7 / 8)), a11 = new Uint8Array(t7);
  893. let n10 = 0, s9 = 0, l8 = 0, i7 = 0;
  894. for (l8 = 0; l8 < r11.length - 1; l8++)
  895. for (s9 = r11[l8], i7 = 7; i7 >= 0; i7--)
  896. a11[n10++] = s9 >> i7 & 1;
  897. for (i7 = 7; n10 < t7 - 1; )
  898. s9 = r11[r11.length - 1], a11[n10++] = s9 >> i7 & 1, i7--;
  899. return a11;
  900. };
  901. var a6 = class {
  902. static decode(a11, n10) {
  903. const s9 = n10.pixelType, l8 = [], i7 = n10.width * n10.height, h5 = e6(a11, n10), { bandIds: c7, format: y6 } = n10, o5 = c7 && c7.length || e6(a11, n10), b3 = a11.byteLength - a11.byteLength % (i7 * t5(s9)), f7 = new s9(a11, 0, i7 * h5);
  904. let u6, g6, A3, p8, d4 = null;
  905. if ("bip" === y6)
  906. for (u6 = 0; u6 < o5; u6++) {
  907. for (A3 = new s9(i7), p8 = c7 ? c7[u6] : u6, g6 = 0; g6 < i7; g6++)
  908. A3[g6] = f7[g6 * h5 + p8];
  909. l8.push(A3);
  910. }
  911. else if ("bsq" === y6)
  912. for (u6 = 0; u6 < o5; u6++)
  913. p8 = c7 ? c7[u6] : u6, l8.push(f7.subarray(p8 * i7, (p8 + 1) * i7));
  914. return b3 < a11.byteLength - 1 && (d4 = r8(a11.slice(b3), i7)), { pixels: l8, mask: d4 };
  915. }
  916. };
  917. // node_modules/@arcgis/core/layers/support/rasterDatasets/byteStreamUtils.js
  918. function r9(r11, t7) {
  919. let n10 = 0, o5 = "", e8 = 0, f7 = 0;
  920. const c7 = r11.length;
  921. for (; n10 < c7; )
  922. f7 = r11[n10++], e8 = f7 >> 4, e8 < 8 ? e8 = 1 : 15 === e8 ? (e8 = 4, f7 = (7 & f7) << 18 | (63 & r11[n10++]) << 12 | (63 & r11[n10++]) << 6 | 63 & r11[n10++]) : 14 === e8 ? (e8 = 3, f7 = (15 & f7) << 12 | (63 & r11[n10++]) << 6 | 63 & r11[n10++]) : (e8 = 2, f7 = (31 & f7) << 6 | 63 & r11[n10++]), (0 !== f7 || t7) && (o5 += String.fromCharCode(f7));
  923. return o5;
  924. }
  925. // node_modules/@arcgis/core/layers/support/rasterFormats/TiffTags.js
  926. var e7 = (() => {
  927. const e8 = [];
  928. return e8[254] = "NEWSUBFILETYPE", e8[255] = "SUBFILETYPE", e8[256] = "IMAGEWIDTH", e8[257] = "IMAGELENGTH", e8[258] = "BITSPERSAMPLE", e8[259] = "COMPRESSION", e8[262] = "PHOTOMETRICINTERPRETATION", e8[263] = "THRESHHOLDING", e8[264] = "CELLWIDTH", e8[265] = "CELLLENGTH", e8[266] = "FILLORDER", e8[269] = "DOCUMENTNAME", e8[270] = "IMAGEDESCRIPTION", e8[271] = "MAKE", e8[272] = "MODEL", e8[273] = "STRIPOFFSETS", e8[274] = "ORIENTATION", e8[277] = "SAMPLESPERPIXEL", e8[278] = "ROWSPERSTRIP", e8[279] = "STRIPBYTECOUNTS", e8[280] = "MINSAMPLEVALUE", e8[281] = "MAXSAMPLEVALUE", e8[282] = "XRESOLUTION", e8[283] = "YRESOLUTION", e8[284] = "PLANARCONFIGURATION", e8[285] = "PAGENAME", e8[286] = "XPOSITION", e8[287] = "YPOSITION", e8[288] = "FREEOFFSETS", e8[289] = "FREEBYTECOUNTS", e8[290] = "GRAYRESPONSEUNIT", e8[291] = "GRAYRESPONSECURVE", e8[292] = "T4OPTIONS", e8[293] = "T6OPTIONS", e8[296] = "RESOLUTIONUNIT", e8[297] = "PAGENUMBER", e8[300] = "COLORRESPONSEUNIT", e8[301] = "TRANSFERFUNCTION", e8[305] = "SOFTWARE", e8[306] = "DATETIME", e8[315] = "ARTIST", e8[316] = "HOSTCOMPUTER", e8[317] = "PREDICTOR", e8[318] = "WHITEPOINT", e8[319] = "PRIMARYCHROMATICITIES", e8[320] = "COLORMAP", e8[321] = "HALFTONEHINTS", e8[322] = "TILEWIDTH", e8[323] = "TILELENGTH", e8[324] = "TILEOFFSETS", e8[325] = "TILEBYTECOUNTS", e8[326] = "BADFAXLINES", e8[327] = "CLEANFAXDATA", e8[328] = "CONSECUTIVEBADFAXLINES", e8[330] = "SUBIFD", e8[332] = "INKSET", e8[333] = "INKNAMES", e8[334] = "NUMBEROFINKS", e8[336] = "DOTRANGE", e8[337] = "TARGETPRINTER", e8[338] = "EXTRASAMPLES", e8[339] = "SAMPLEFORMAT", e8[340] = "SMINSAMPLEVALUE", e8[341] = "SMAXSAMPLEVALUE", e8[342] = "TRANSFERRANGE", e8[347] = "JPEGTABLES", e8[512] = "JPEGPROC", e8[513] = "JPEGIFOFFSET", e8[514] = "JPEGIFBYTECOUNT", e8[515] = "JPEGRESTARTINTERVAL", e8[517] = "JPEGLOSSLESSPREDICTORS", e8[518] = "JPEGPOINTTRANSFORM", e8[519] = "JPEGQTABLES", e8[520] = "JPEGDCTABLES", e8[521] = "JPEGACTABLES", e8[529] = "YCBCRCOEFFICIENTS", e8[530] = "YCBCRSUBSAMPLING", e8[531] = "YCBCRPOSITIONING", e8[532] = "REFERENCEBLACKWHITE", e8[700] = "XMP", e8[33550] = "GEOPIXELSCALE", e8[33922] = "GEOTIEPOINTS", e8[33432] = "COPYRIGHT", e8[42112] = "GDAL_METADATA", e8[42113] = "GDAL_NODATA", e8[50844] = "RPCCOEFFICIENT", e8[34264] = "GEOTRANSMATRIX", e8[34735] = "GEOKEYDIRECTORY", e8[34736] = "GEODOUBLEPARAMS", e8[34737] = "GEOASCIIPARAMS", e8[34665] = "EXIFIFD", e8[34853] = "GPSIFD", e8[40965] = "INTEROPERABILITYIFD", e8;
  929. })();
  930. var i5 = (() => {
  931. const i7 = e7.slice();
  932. return i7[36864] = "ExifVersion", i7[40960] = "FlashpixVersion", i7[40961] = "ColorSpace", i7[42240] = "Gamma", i7[37121] = "ComponentsConfiguration", i7[37122] = "CompressedBitsPerPixel", i7[40962] = "PixelXDimension", i7[40963] = "PixelYDimension", i7[37500] = "MakerNote", i7[37510] = "UserComment", i7[40964] = "RelatedSoundFile", i7[36867] = "DateTimeOriginal", i7[36868] = "DateTimeDigitized", i7[36880] = "OffsetTime", i7[36881] = "OffsetTimeOriginal", i7[36882] = "OffsetTimeDigitized", i7[37520] = "SubSecTime", i7[37521] = "SubSecTimeOriginal", i7[37522] = "SubSecTimeDigitized", i7[37888] = "Temperature", i7[37889] = "Humidity", i7[37890] = "Pressure", i7[37891] = "WaterDepth", i7[37892] = "Acceleration", i7[37893] = "CameraElevationAngle", i7[42016] = "ImageUniqueID", i7[42032] = "CameraOwnerName", i7[42033] = "BodySerialNumber", i7[42034] = "LensSpecification", i7[42035] = "LensMake", i7[42036] = "LensModel", i7[42037] = "LensSerialNumber", i7[33434] = "ExposureTime", i7[33437] = "FNumber", i7[34850] = "ExposureProgram", i7[34852] = "SpectralSensitivity", i7[34855] = "PhotographicSensitivity", i7[34856] = "OECF", i7[34864] = "SensitivityType", i7[34865] = "StandardOutputSensitivity", i7[34866] = "RecommendedExposureIndex", i7[34867] = "ISOSpeed", i7[34868] = "ISOSpeedLatitudeyyy", i7[34869] = "ISOSpeedLatitudezzz", i7[37377] = "ShutterSpeedValue", i7[37378] = "ApertureValue", i7[37379] = "BrightnessValue", i7[37380] = "ExposureBiasValue", i7[37381] = "MaxApertureValue", i7[37382] = "SubjectDistance", i7[37383] = "MeteringMode", i7[37384] = "LightSource", i7[37385] = "Flash", i7[37386] = "FocalLength", i7[37396] = "SubjectArea", i7[41483] = "FlashEnergy", i7[41484] = "SpatialFrequencyResponse", i7[41486] = "FocalPlaneXResolution", i7[41487] = "FocalPlaneYResolution", i7[41488] = "FocalPlaneResolutionUnit", i7[41492] = "SubjectLocation", i7[41493] = "ExposureIndex", i7[41495] = "SensingMethod", i7[41728] = "FileSource", i7[41729] = "SceneType", i7[41730] = "CFAPattern", i7[41985] = "CustomRendered", i7[41986] = "ExposureMode", i7[41987] = "WhiteBalance", i7[41988] = "DigitalZoomRatio", i7[41989] = "FocalLengthIn35mmFilm", i7[41990] = "SceneCaptureType", i7[41991] = "GainControl", i7[41992] = "Contrast", i7[41993] = "Saturation", i7[41994] = "Sharpness", i7[41995] = "DeviceSettingDescription", i7[41996] = "SubjectDistanceRange", i7;
  933. })();
  934. var t6 = ["GPSVersionID", "GPSLatitudeRef", "GPSLatitude", "GPSLongitudeRef", "GPSLongitude", "GPSAltitudeRef", "GPSAltitude", "GPSTimeStamp", "GPSSatellites", "GPSStatus", "GPSMeasureMode", "GPSDOP", "GPSSpeedRef", "GPSSpeed", "GPSTrackRef", "GPSTrack", "GPSImgDirectionRef", "GPSImgDirection", "GPSMapDatum", "GPSDestLatitudeRef", "GPSDestLatitude", "GPSDestLongitudeRef", "GPSDestLongitude", "GPSDestBearingRef", "GPSDestBearing", "GPSDestDistanceRef", "GPSDestDistance", "GPSProcessingMethod", "GPSAreaInformation", "GPSDateStamp", "GPSDifferential", "GPSHPositioningError"];
  935. var o2 = (() => {
  936. const e8 = [];
  937. return e8[1024] = "GTModelTypeGeoKey", e8[1025] = "GTRasterTypeGeoKey", e8[1026] = "GTCitationGeoKey", e8[2048] = "GeographicTypeGeoKey", e8[2049] = "GeogCitationGeoKey", e8[2050] = "GeogGeodeticDatumGeoKey", e8[2051] = "GeogPrimeMeridianGeoKey", e8[2052] = "GeogLinearUnitsGeoKey", e8[2053] = "GeogLinearUnitSizeGeoKey", e8[2054] = "GeogAngularUnitsGeoKey", e8[2055] = "GeogAngularUnitSizeGeoKey", e8[2056] = "GeogEllipsoidGeoKey", e8[2057] = "GeogSemiMajorAxisGeoKey", e8[2058] = "GeogSemiMinorAxisGeoKey", e8[2059] = "GeogInvFlatteningGeoKey", e8[2061] = "GeogPrimeMeridianLongGeoKey", e8[2060] = "GeogAzimuthUnitsGeoKey", e8[3072] = "ProjectedCSTypeGeoKey", e8[3073] = "PCSCitationGeoKey", e8[3074] = "ProjectionGeoKey", e8[3075] = "ProjCoordTransGeoKey", e8[3076] = "ProjLinearUnitsGeoKey", e8[3077] = "ProjLinearUnitSizeGeoKey", e8[3078] = "ProjStdParallel1GeoKey", e8[3079] = "ProjStdParallel2GeoKey", e8[3080] = "ProjNatOriginLongGeoKey", e8[3081] = "ProjNatOriginLatGeoKey", e8[3082] = "ProjFalseEastingGeoKey", e8[3083] = "ProjFalseNorthingGeoKey", e8[3084] = "ProjFalseOriginLongGeoKey", e8[3085] = "ProjFalseOriginLatGeoKey", e8[3086] = "ProjFalseOriginEastingGeoKey", e8[3087] = "ProjFalseOriginNorthingGeoKey", e8[3088] = "ProjCenterLongGeoKey", e8[3090] = "ProjCenterEastingGeoKey", e8[3091] = "ProjCenterNorthingGeoKey", e8[3092] = "ProjScaleAtNatOriginGeoKey", e8[3093] = "ProjScaleAtCenterGeoKey", e8[3094] = "ProjAzimuthAngleGeoKey", e8[3095] = "ProjStraightVertPoleLongGeoKey", e8[4096] = "VerticalCSTypeGeoKey", e8[4097] = "VerticalCitationGeoKey", e8[4098] = "VerticalDatumGeoKey", e8[4099] = "VerticalUnitsGeoKey", e8;
  938. })();
  939. var S = (i7, t7) => {
  940. let o5 = (t7 || e7)[i7];
  941. return void 0 === o5 && (o5 = "unknown" + String(i7)), o5;
  942. };
  943. var E = /* @__PURE__ */ new Map();
  944. E.set("EXIFIFD", i5), E.set("GPSIFD", t6);
  945. var n5 = { TIFF_TAGS: e7, ifdTags: E, GEO_KEYS: o2, getTagName: S };
  946. // node_modules/@arcgis/core/layers/support/rasterFormats/utils.js
  947. var r10 = (() => {
  948. const r11 = new ArrayBuffer(4), n10 = new Uint8Array(r11);
  949. return new Uint32Array(r11)[0] = 1, 1 === n10[0];
  950. })();
  951. // node_modules/@arcgis/core/layers/support/rasterFormats/TiffDecoder.js
  952. var f3 = [0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, -1, -1, -1, 8, 8, 8];
  953. var u2 = 4294967296;
  954. var c4 = /* @__PURE__ */ new Set([1, 5, 6, 7, 8, 34712, 34887]);
  955. function h(e8, t7) {
  956. let n10 = "unknown";
  957. return 3 === e8 ? n10 = 64 === t7 ? "f64" : "f32" : 1 === e8 ? 1 === t7 ? n10 = "u1" : 2 === t7 ? n10 = "u2" : 4 === t7 ? n10 = "u4" : t7 <= 8 ? n10 = "u8" : t7 <= 16 ? n10 = "u16" : t7 <= 32 && (n10 = "u32") : 2 === e8 && (t7 <= 8 ? n10 = "s8" : t7 <= 16 ? n10 = "s16" : t7 <= 32 && (n10 = "s32")), n10;
  958. }
  959. function g2(e8) {
  960. let t7 = null;
  961. switch (e8 ? e8.toLowerCase() : "f32") {
  962. case "u1":
  963. case "u2":
  964. case "u4":
  965. case "u8":
  966. t7 = Uint8Array;
  967. break;
  968. case "u16":
  969. t7 = Uint16Array;
  970. break;
  971. case "u32":
  972. t7 = Uint32Array;
  973. break;
  974. case "s8":
  975. t7 = Int8Array;
  976. break;
  977. case "s16":
  978. t7 = Int16Array;
  979. break;
  980. case "s32":
  981. t7 = Int32Array;
  982. break;
  983. case "f64":
  984. t7 = Float64Array;
  985. break;
  986. default:
  987. t7 = Float32Array;
  988. }
  989. return t7;
  990. }
  991. function w3(e8, t7) {
  992. return { x: t7[0] * e8.x + t7[1] * e8.y + t7[2], y: t7[3] * e8.x + t7[4] * e8.y + t7[5] };
  993. }
  994. function p4(e8, t7) {
  995. var _a;
  996. return (_a = e8.get(t7)) == null ? void 0 : _a.values;
  997. }
  998. function d(e8, t7) {
  999. var _a;
  1000. return (_a = e8.get(t7)) == null ? void 0 : _a.values;
  1001. }
  1002. function I(e8, t7) {
  1003. var _a, _b;
  1004. return (_b = (_a = e8.get(t7)) == null ? void 0 : _a.values) == null ? void 0 : _b[0];
  1005. }
  1006. function T(e8, t7) {
  1007. var _a, _b;
  1008. return (_b = (_a = e8.get(t7)) == null ? void 0 : _a.values) == null ? void 0 : _b[0];
  1009. }
  1010. function E2(e8, t7, n10, a11 = 0, i7 = n5.TIFF_TAGS, s9 = 4) {
  1011. const l8 = 8 === s9, o5 = l8 ? L(new DataView(e8, n10, 8), 0, t7) : new DataView(e8, n10, 2).getUint16(0, t7), f7 = 4 + 2 * s9, u6 = l8 ? 8 : 2, c7 = u6 + o5 * f7;
  1012. if (n10 + c7 > e8.byteLength)
  1013. return { success: false, ifd: null, nextIFD: null, requiredBufferSize: c7 };
  1014. const h5 = n10 + c7 + 4 <= e8.byteLength ? k2(new DataView(e8, n10 + c7, 8 === s9 ? 8 : 4), 0, t7, 8 === s9) : null, g6 = n10 + u6, w5 = /* @__PURE__ */ new Map();
  1015. let p8, d4, I3, T4, E3, y6 = 0, m5 = 0;
  1016. for (let A3 = 0; A3 < o5; A3++) {
  1017. d4 = new DataView(e8, g6 + f7 * A3, f7), I3 = d4.getUint16(0, t7), E3 = d4.getUint16(2, t7), T4 = n5.getTagName(I3, i7);
  1018. const n11 = [];
  1019. 2 === s9 ? (y6 = d4.getUint16(4, t7), m5 = d4.getUint16(6, t7)) : 4 === s9 ? (y6 = d4.getUint32(4, t7), m5 = d4.getUint32(8, t7)) : 8 === s9 && (y6 = k2(d4, 4, t7, true), m5 = k2(d4, 12, t7, true), n11.push(d4.getUint32(12, t7)), n11.push(d4.getUint32(16, t7))), p8 = { id: I3, type: E3, valueCount: y6, valueOffset: m5, valueOffsets: n11, values: null }, b(e8, t7, p8, a11, false, s9), w5.set(T4, p8);
  1020. }
  1021. return { success: true, ifd: w5, nextIFD: h5, requiredBufferSize: c7 };
  1022. }
  1023. var y4 = (e8, t7) => c3(e8, { inputOffset: t7 }).pixels[0];
  1024. async function m(t7, i7, r11, f7, u6) {
  1025. var _a, _b;
  1026. const c7 = r10 === i7, w5 = T(r11, "BITSPERSAMPLE"), p8 = h((_a = T(r11, "SAMPLEFORMAT")) != null ? _a : 1, w5), d4 = (_b = T(r11, "COMPRESSION")) != null ? _b : 1, I3 = g2(p8);
  1027. let E3, m5, A3, S4, M3, x4, b3;
  1028. if (34887 === d4)
  1029. return await a5(), y4(t7, f7);
  1030. if (1 === d4)
  1031. b3 = t7.slice(f7, f7 + u6), A3 = new Uint8Array(b3);
  1032. else if (8 === d4 || 32946 === d4)
  1033. A3 = new Uint8Array(t7, f7, u6), M3 = new s5(A3), x4 = M3.getBytes(), b3 = new ArrayBuffer(x4.length), A3 = new Uint8Array(b3), A3.set(x4);
  1034. else if (6 === d4) {
  1035. A3 = new Uint8Array(t7, f7, u6);
  1036. const e8 = new a4();
  1037. e8.parse(A3);
  1038. const a11 = e8.getData(e8.width, e8.height, true);
  1039. b3 = new ArrayBuffer(a11.length), A3 = new Uint8Array(b3), A3.set(a11);
  1040. } else if (7 === d4) {
  1041. const e8 = r11.get("JPEGTABLES").values, a11 = e8.length - 2;
  1042. A3 = new Uint8Array(a11 + u6 - 2);
  1043. for (let t8 = 0; t8 < a11; t8++)
  1044. A3[t8] = e8[t8];
  1045. const i8 = new Uint8Array(t7, f7 + 2, u6 - 2);
  1046. for (let t8 = 0; t8 < i8.length; t8++)
  1047. A3[a11 + t8] = i8[t8];
  1048. const s9 = new a4();
  1049. s9.parse(A3);
  1050. const l8 = s9.getData(s9.width, s9.height, true);
  1051. b3 = new ArrayBuffer(l8.length), A3 = new Uint8Array(b3), A3.set(l8);
  1052. } else
  1053. 5 === d4 && (A3 = i4(t7, f7, u6, i7), b3 = A3.buffer);
  1054. if ("u8" === p8 || "s8" === p8 || c7)
  1055. m5 = new I3(b3);
  1056. else {
  1057. switch (c(A3), b3 = new ArrayBuffer(A3.length), S4 = new Uint8Array(b3), p8) {
  1058. case "u16":
  1059. case "s16":
  1060. for (E3 = 0; E3 < A3.length; E3 += 2)
  1061. S4[E3] = A3[E3 + 1], S4[E3 + 1] = A3[E3];
  1062. break;
  1063. case "u32":
  1064. case "s32":
  1065. case "f32":
  1066. for (E3 = 0; E3 < A3.length; E3 += 4)
  1067. S4[E3] = A3[E3 + 3], S4[E3 + 1] = A3[E3 + 2], S4[E3 + 2] = A3[E3 + 1], S4[E3 + 3] = A3[E3];
  1068. }
  1069. m5 = new I3(b3);
  1070. }
  1071. return m5;
  1072. }
  1073. async function A(e8, t7, n10) {
  1074. var _a;
  1075. const a11 = d(n10, "TILEOFFSETS");
  1076. if (void 0 === a11)
  1077. return null;
  1078. const i7 = d(n10, "TILEBYTECOUNTS"), { width: s9, height: r11, pixelType: l8, tileWidth: o5, tileHeight: f7 } = D([n10]), u6 = O(n10, t7), c7 = t7.planes, h5 = s9 * r11, w5 = T(n10, "BITSPERSAMPLE"), p8 = 34887 === ((_a = T(n10, "COMPRESSION")) != null ? _a : 1), I3 = g2(l8), E3 = [];
  1079. for (let g6 = 0; g6 < c7; g6++)
  1080. E3.push(new I3(h5));
  1081. let y6, A3, S4, M3, x4, b3, U3, L3, P3, k5, N2, G2, R2;
  1082. const C4 = Math.ceil(s9 / o5);
  1083. if (w5 % 8 == 0) {
  1084. if (p8 && u6 && c7 > 1) {
  1085. const l9 = Math.round(a11.length / c7);
  1086. for (y6 = 0; y6 < l9; y6++) {
  1087. b3 = Math.floor(y6 / C4) * f7, U3 = y6 % C4 * o5, L3 = b3 * s9 + U3;
  1088. for (let l10 = 0; l10 < c7; l10++) {
  1089. const u7 = y6 * c7 + l10;
  1090. if (0 !== i7[u7])
  1091. for (S4 = await m(e8, t7.littleEndian, n10, a11[u7], i7[u7]), k5 = 0, P3 = L3, G2 = Math.min(o5, s9 - U3), N2 = Math.min(f7, r11 - b3), R2 = E3[l10], M3 = 0; M3 < N2; M3++)
  1092. for (P3 = L3 + M3 * s9, k5 = M3 * o5, x4 = 0; x4 < G2; x4++, P3++, k5++)
  1093. R2[P3] = S4[k5];
  1094. }
  1095. }
  1096. } else
  1097. for (y6 = 0; y6 < a11.length; y6++)
  1098. if (0 !== i7[y6])
  1099. for (b3 = Math.floor(y6 / C4) * f7, U3 = y6 % C4 * o5, L3 = b3 * s9 + U3, S4 = await m(e8, t7.littleEndian, n10, a11[y6], i7[y6]), k5 = 0, P3 = L3, G2 = Math.min(o5, s9 - U3), N2 = Math.min(f7, r11 - b3), A3 = 0; A3 < c7; A3++)
  1100. if (R2 = E3[A3], u6 || p8)
  1101. for (M3 = 0; M3 < N2; M3++)
  1102. for (P3 = L3 + M3 * s9, k5 = o5 * f7 * A3 + M3 * o5, x4 = 0; x4 < G2; x4++, P3++, k5++)
  1103. R2[P3] = S4[k5];
  1104. else
  1105. for (M3 = 0; M3 < N2; M3++)
  1106. for (P3 = L3 + M3 * s9, k5 = M3 * o5 * c7 + A3, x4 = 0; x4 < G2; x4++, P3++, k5 += c7)
  1107. R2[P3] = S4[k5];
  1108. }
  1109. return { width: s9, height: r11, pixelType: l8, pixels: E3 };
  1110. }
  1111. var S2 = (t7, a11, i7) => {
  1112. var _a;
  1113. const r11 = r10 === a11.littleEndian, f7 = d(i7, "STRIPOFFSETS");
  1114. if (void 0 === f7)
  1115. return null;
  1116. const { width: u6, height: c7, pixelType: h5 } = D([i7]), w5 = a11.planes, p8 = u6 * c7, I3 = T(i7, "BITSPERSAMPLE"), E3 = g2(h5), y6 = new E3(p8 * w5), m5 = d(i7, "STRIPBYTECOUNTS"), A3 = T(i7, "ROWSPERSTRIP"), S4 = (_a = T(i7, "COMPRESSION")) != null ? _a : 1;
  1117. let M3, x4, b3, O4, U3, L3, P3, k5, N2, G2, R2, C4 = A3;
  1118. if (I3 % 8 == 0)
  1119. for (M3 = 0; M3 < f7.length; M3++) {
  1120. if (U3 = M3 * (A3 * u6) * w5, C4 = (M3 + 1) * A3 > c7 ? c7 - M3 * A3 : A3, "u8" === h5 || "s8" === h5 || r11) {
  1121. if (8 === S4 || 32946 === S4)
  1122. P3 = new Uint8Array(t7, f7[M3], m5[M3]), G2 = new s5(P3), R2 = G2.getBytes(), L3 = new ArrayBuffer(R2.length), P3 = new Uint8Array(L3), P3.set(R2), P3.length !== C4 * u6 * w5 * I3 / 8 && console.log("strip byte counts is different than expected");
  1123. else if (6 === S4) {
  1124. P3 = new Uint8Array(t7, f7[M3], m5[M3]);
  1125. const e8 = new a4();
  1126. e8.parse(P3);
  1127. const a12 = e8.getData(e8.width, e8.height, true);
  1128. L3 = new ArrayBuffer(a12.length), P3 = new Uint8Array(L3), P3.set(a12);
  1129. } else
  1130. 5 === S4 ? (P3 = i4(t7, f7[M3], m5[M3], a11.littleEndian), L3 = P3.buffer) : (m5[M3] !== C4 * u6 * w5 * I3 / 8 && console.log("strip byte counts is different than expected"), L3 = t7.slice(f7[M3], f7[M3] + m5[M3]));
  1131. O4 = new E3(L3);
  1132. } else {
  1133. switch (6 === S4 || 8 === S4 || 32946 === S4 ? (P3 = new Uint8Array(t7, f7[M3], m5[M3]), G2 = new s5(P3), P3 = G2.getBytes(), L3 = new ArrayBuffer(P3.length), k5 = new Uint8Array(L3), P3.length !== C4 * u6 * w5 * I3 / 8 && console.log("strip byte counts is different than expected")) : (m5[M3] !== C4 * u6 * w5 * I3 / 8 && console.log("strip byte counts is different than expected"), L3 = new ArrayBuffer(m5[M3]), P3 = new Uint8Array(t7, f7[M3], m5[M3]), k5 = new Uint8Array(L3)), h5) {
  1134. case "u16":
  1135. case "s16":
  1136. for (b3 = 0; b3 < P3.length; b3 += 2)
  1137. k5[b3] = P3[b3 + 1], k5[b3 + 1] = P3[b3];
  1138. break;
  1139. case "u32":
  1140. case "s32":
  1141. case "f32":
  1142. for (b3 = 0; b3 < P3.length; b3 += 4)
  1143. k5[b3] = P3[b3 + 3], k5[b3 + 1] = P3[b3 + 2], k5[b3 + 2] = P3[b3 + 1], k5[b3 + 3] = P3[b3];
  1144. }
  1145. c(L3), O4 = new E3(L3);
  1146. }
  1147. y6.set(O4, U3);
  1148. }
  1149. const F2 = [];
  1150. if (1 === w5)
  1151. F2.push(y6);
  1152. else
  1153. for (M3 = 0; M3 < w5; M3++) {
  1154. for (N2 = new E3(p8), x4 = 0; x4 < p8; x4++)
  1155. N2[x4] = y6[x4 * w5 + M3];
  1156. F2.push(N2);
  1157. }
  1158. return { width: u6, height: c7, pixelType: h5, pixels: F2 };
  1159. };
  1160. var M = (e8, t7, n10) => {
  1161. if (!(e8 && e8.length > 0 && t7 && n10))
  1162. return null;
  1163. let a11, i7, s9;
  1164. const r11 = e8[0].length, l8 = e8.length, o5 = new Uint8Array(r11);
  1165. for (let f7 = 0; f7 < l8; f7++)
  1166. if (a11 = e8[f7], i7 = t7[f7], s9 = n10[f7], 0 === f7)
  1167. for (let e9 = 0; e9 < r11; e9++)
  1168. o5[e9] = a11[e9] < i7 || a11[e9] > s9 ? 0 : 1;
  1169. else
  1170. for (let e9 = 0; e9 < r11; e9++)
  1171. o5[e9] && (o5[e9] = a11[e9] < i7 || a11[e9] > s9 ? 0 : 1);
  1172. return o5;
  1173. };
  1174. var x = (e8) => {
  1175. if (!e8)
  1176. return null;
  1177. const t7 = e8.match(/<Item(.*?)Item>/gi);
  1178. if (!t7 || 0 === t7.length)
  1179. return null;
  1180. const n10 = /* @__PURE__ */ new Map();
  1181. let a11, i7, s9, r11, l8;
  1182. for (let I3 = 0; I3 < t7.length; I3++)
  1183. a11 = t7[I3], i7 = a11.slice("<Item ".length, a11.indexOf(">")), r11 = a11.indexOf("sample="), r11 > -1 && (l8 = a11.slice(r11 + 'sample="'.length, a11.indexOf('"', r11 + 'sample="'.length))), r11 = a11.indexOf("name="), r11 > -1 && (i7 = a11.slice(r11 + 'name="'.length, a11.indexOf('"', r11 + 'name="'.length))), i7 && (s9 = a11.slice(a11.indexOf(">") + 1, a11.indexOf("</Item>")).trim(), null != l8 ? n10.has(i7) ? n10.get(i7)[l8] = s9 : n10.set(i7, [s9]) : n10.set(i7, s9)), l8 = null;
  1184. const o5 = n10.get("STATISTICS_MINIMUM"), f7 = n10.get("STATISTICS_MAXIMUM"), u6 = n10.get("STATISTICS_MEAN"), c7 = n10.get("STATISTICS_STDDEV");
  1185. let h5 = null;
  1186. if (o5 && f7) {
  1187. h5 = [];
  1188. for (let e9 = 0; e9 < o5.length; e9++)
  1189. h5.push({ min: parseFloat(o5[e9]), max: parseFloat(f7[e9]), avg: u6 && parseFloat(u6[e9]), stddev: c7 && parseFloat(c7[e9]) });
  1190. }
  1191. const g6 = n10.get("BandName"), w5 = n10.get("WavelengthMin"), p8 = n10.get("WavelengthMax");
  1192. let d4 = null;
  1193. if (g6) {
  1194. d4 = [];
  1195. for (let e9 = 0; e9 < g6.length; e9++)
  1196. d4.push({ BandName: g6[e9], WavelengthMin: w5 && parseFloat(w5[e9]), WavelengthMax: p8 && parseFloat(p8[e9]) });
  1197. }
  1198. return { statistics: h5, bandProperties: d4, dataType: n10.get("DataType"), rawMetadata: n10 };
  1199. };
  1200. function b(e8, t7, n10, a11 = 0, i7 = false, s9 = 4) {
  1201. if (n10.values)
  1202. return true;
  1203. const r11 = n10.type, l8 = n10.valueCount;
  1204. let o5 = n10.valueOffset, c7 = [];
  1205. const h5 = f3[r11], g6 = 8 * h5, w5 = l8 * h5, p8 = l8 * f3[r11] * 8;
  1206. let d4, I3;
  1207. const T4 = 8 === s9 ? 64 : 32, E3 = n10.valueOffsets;
  1208. if (p8 > T4) {
  1209. if (w5 > (i7 ? e8.byteLength : e8 ? e8.byteLength - o5 + a11 : 0))
  1210. return n10.offlineOffsetSize = [o5, w5], n10.values = null, false;
  1211. }
  1212. if (p8 <= T4) {
  1213. if (!t7)
  1214. if (T4 <= 32)
  1215. o5 >>>= 32 - p8;
  1216. else {
  1217. const e9 = (E3 == null ? void 0 : E3.length) ? E3[0] : o5 >>> 0, t8 = (E3 == null ? void 0 : E3.length) ? E3[1] : Math.round((o5 - e9) / u2);
  1218. p8 <= 32 ? (o5 = e9 >>> 32 - p8, E3[0] = o5) : (o5 = e9 * 2 ** (32 - p8) + (t8 >>> 32 - p8), E3[0] = e9, E3[1] = t8 >>> 32 - p8);
  1219. }
  1220. if (1 === l8 && g6 === T4)
  1221. c7 = [o5];
  1222. else if (64 === T4) {
  1223. const e9 = (E3 == null ? void 0 : E3.length) ? E3[0] : o5 >>> 0, t8 = (E3 == null ? void 0 : E3.length) ? E3[1] : Math.round((o5 - e9) / u2);
  1224. let n11 = e9, a12 = 32;
  1225. for (I3 = 1; I3 <= l8; I3++) {
  1226. const e10 = 32 - g6 * I3 % 32;
  1227. if (a12 < g6) {
  1228. const i8 = n11 << e10 >>> 32 - a12, s10 = t8 << 32 - a12 >>> 32 - a12;
  1229. n11 = t8, c7.push(i8 + s10 * 2 ** (g6 - a12)), a12 -= 32 - (g6 - a12);
  1230. } else
  1231. c7.push(n11 << e10 >>> 32 - g6), a12 -= g6;
  1232. 0 === a12 && (a12 = 32, n11 = t8);
  1233. }
  1234. } else
  1235. for (I3 = 1; I3 <= l8; I3++) {
  1236. const e9 = 32 - g6 * I3;
  1237. c7.push(o5 << e9 >>> 32 - g6);
  1238. }
  1239. } else {
  1240. o5 -= a11, i7 && (o5 = 0);
  1241. for (let n11 = o5; n11 < o5 + w5; n11 += h5) {
  1242. switch (r11) {
  1243. case 1:
  1244. case 2:
  1245. case 7:
  1246. d4 = new DataView(e8, n11, 1).getUint8(0);
  1247. break;
  1248. case 3:
  1249. d4 = new DataView(e8, n11, 2).getUint16(0, t7);
  1250. break;
  1251. case 4:
  1252. case 13:
  1253. d4 = new DataView(e8, n11, 4).getUint32(0, t7);
  1254. break;
  1255. case 5:
  1256. d4 = new DataView(e8, n11, 4).getUint32(0, t7) / new DataView(e8, n11 + 4, 4).getUint32(0, t7);
  1257. break;
  1258. case 6:
  1259. d4 = new DataView(e8, n11, 1).getInt8(0);
  1260. break;
  1261. case 8:
  1262. d4 = new DataView(e8, n11, 2).getInt16(0, t7);
  1263. break;
  1264. case 9:
  1265. d4 = new DataView(e8, n11, 4).getInt32(0, t7);
  1266. break;
  1267. case 10:
  1268. d4 = new DataView(e8, n11, 4).getInt32(0, t7) / new DataView(e8, n11 + 4, 4).getInt32(0, t7);
  1269. break;
  1270. case 11:
  1271. d4 = new DataView(e8, n11, 4).getFloat32(0, t7);
  1272. break;
  1273. case 12:
  1274. d4 = new DataView(e8, n11, 8).getFloat64(0, t7);
  1275. break;
  1276. case 16:
  1277. case 18:
  1278. d4 = L(new DataView(e8, n11, 8), 0, t7);
  1279. break;
  1280. case 17:
  1281. d4 = P(new DataView(e8, n11, 8), 0, t7);
  1282. break;
  1283. default:
  1284. d4 = null;
  1285. }
  1286. c7.push(d4);
  1287. }
  1288. }
  1289. if (2 === r11) {
  1290. let e9 = "";
  1291. const t8 = c7;
  1292. for (c7 = [], I3 = 0; I3 < t8.length; I3++)
  1293. 0 === t8[I3] && "" !== e9 ? (c7.push(e9), e9 = "") : e9 += String.fromCharCode(t8[I3]);
  1294. "" === e9 && 0 !== c7.length || c7.push(e9);
  1295. }
  1296. return n10.values = c7, true;
  1297. }
  1298. function D(e8) {
  1299. var _a, _b;
  1300. const t7 = e8[0], n10 = T(t7, "TILEWIDTH"), a11 = T(t7, "TILELENGTH"), i7 = T(t7, "IMAGEWIDTH"), s9 = T(t7, "IMAGELENGTH"), r11 = T(t7, "BITSPERSAMPLE"), l8 = T(t7, "SAMPLESPERPIXEL"), o5 = (_a = T(t7, "SAMPLEFORMAT")) != null ? _a : 1, f7 = h(o5, r11), u6 = O(t7), g6 = p4(t7, "GDAL_NODATA");
  1301. let E3 = null;
  1302. (g6 == null ? void 0 : g6.length) && (E3 = g6.map((e9) => parseFloat(e9)), E3.some((e9) => isNaN(e9)) && (E3 = null));
  1303. const y6 = (_b = T(t7, "COMPRESSION")) != null ? _b : 1;
  1304. let m5;
  1305. switch (y6) {
  1306. case 1:
  1307. m5 = "NONE";
  1308. break;
  1309. case 2:
  1310. case 3:
  1311. case 4:
  1312. case 32771:
  1313. m5 = "CCITT";
  1314. break;
  1315. case 5:
  1316. m5 = "LZW";
  1317. break;
  1318. case 6:
  1319. case 7:
  1320. m5 = "JPEG";
  1321. break;
  1322. case 32773:
  1323. m5 = "PACKBITS";
  1324. break;
  1325. case 8:
  1326. case 32946:
  1327. m5 = "DEFLATE";
  1328. break;
  1329. case 34712:
  1330. m5 = "JPEG2000";
  1331. break;
  1332. case 34887:
  1333. m5 = "LERC";
  1334. break;
  1335. default:
  1336. m5 = String(y6);
  1337. }
  1338. let A3 = true, S4 = "";
  1339. c4.has(y6) || (A3 = false, S4 += "unsupported tag compression " + y6), o5 > 3 && (A3 = false, S4 += "unsupported tag sampleFormat " + o5), r11 % 8 != 0 && (A3 = false, S4 += "unsupported tag bitsPerSample " + r11);
  1340. const M3 = I(t7, "GEOASCIIPARAMS");
  1341. let b3;
  1342. if (M3) {
  1343. const e9 = M3.split("|").find((e10) => e10.includes("ESRI PE String = ")), t8 = e9 ? e9.replace("ESRI PE String = ", "") : "";
  1344. b3 = t8.startsWith("COMPD_CS") || t8.startsWith("PROJCS") || t8.startsWith("GEOGCS") ? { wkid: null, wkt: t8 } : null;
  1345. }
  1346. const D4 = d(t7, "GEOTIEPOINTS"), U3 = d(t7, "GEOPIXELSCALE"), L3 = d(t7, "GEOTRANSMATRIX"), P3 = t7.has("GEOKEYDIRECTORY") ? t7.get("GEOKEYDIRECTORY").data : null;
  1347. let k5, N2, G2 = false;
  1348. if (P3) {
  1349. G2 = 2 === T(P3, "GTRasterTypeGeoKey");
  1350. const e9 = T(P3, "GTModelTypeGeoKey");
  1351. if (2 === e9) {
  1352. const e10 = T(P3, "GeographicTypeGeoKey");
  1353. e10 >= 1024 && e10 <= 32766 && (b3 = { wkid: e10 });
  1354. } else if (1 === e9) {
  1355. const e10 = T(P3, "ProjectedCSTypeGeoKey");
  1356. e10 >= 1024 && e10 <= 32766 && (b3 = { wkid: e10 });
  1357. }
  1358. }
  1359. if (U3 && D4 && D4.length >= 6 ? (k5 = [U3[0], 0, D4[3] - D4[0] * U3[0], 0, -Math.abs(U3[1]), D4[4] - D4[1] * U3[1]], G2 && (k5[2] -= 0.5 * k5[0] + 0.5 * k5[1], k5[5] -= 0.5 * k5[3] + 0.5 * k5[4])) : L3 && 16 === L3.length && (k5 = G2 ? [L3[0], L3[1], L3[3] - 0.5 * L3[0], L3[4], L3[5], L3[7] - 0.5 * L3[5]] : [L3[0], L3[1], L3[3], L3[4], L3[5], L3[7]]), k5) {
  1360. const e9 = [{ x: 0, y: s9 }, { x: 0, y: 0 }, { x: i7, y: s9 }, { x: i7, y: 0 }];
  1361. let t8, n11 = Number.POSITIVE_INFINITY, a12 = Number.POSITIVE_INFINITY, r12 = Number.NEGATIVE_INFINITY, l9 = Number.NEGATIVE_INFINITY;
  1362. for (let i8 = 0; i8 < e9.length; i8++)
  1363. t8 = w3(e9[i8], k5), n11 = t8.x > n11 ? n11 : t8.x, r12 = t8.x < r12 ? r12 : t8.x, a12 = t8.y > a12 ? a12 : t8.y, l9 = t8.y < l9 ? l9 : t8.y;
  1364. N2 = { xmin: n11, xmax: r12, ymin: a12, ymax: l9, spatialReference: b3 };
  1365. } else
  1366. N2 = { xmin: -0.5, ymin: 0.5 - s9, xmax: i7 - 0.5, ymax: 0.5, spatialReference: b3 };
  1367. const C4 = e8.filter((e9) => 1 === I(e9, "NEWSUBFILETYPE"));
  1368. let F2, v4, B2, V2, W;
  1369. if (C4.length > 0) {
  1370. B2 = Math.round(Math.log(i7 / T(C4[0], "IMAGEWIDTH")) / Math.LN2);
  1371. const e9 = C4[C4.length - 1];
  1372. V2 = Math.round(Math.log(i7 / T(e9, "IMAGEWIDTH")) / Math.LN2), F2 = T(e9, "TILEWIDTH"), v4 = T(e9, "TILELENGTH");
  1373. }
  1374. F2 = null != V2 && V2 > 0 ? F2 || n10 : null, v4 = null != V2 && V2 > 0 ? v4 || a11 : null, n10 && (W = [{ maxCol: Math.ceil(i7 / n10) - 1, maxRow: Math.ceil(s9 / a11) - 1, minRow: 0, minCol: 0 }], C4.forEach((e9) => {
  1375. W.push({ maxCol: Math.ceil(T(e9, "IMAGEWIDTH") / T(e9, "TILEWIDTH")) - 1, maxRow: Math.ceil(T(e9, "IMAGELENGTH") / T(e9, "TILELENGTH")) - 1, minRow: 0, minCol: 0 });
  1376. }));
  1377. const H = I(e8[0], "GDAL_METADATA"), Y = x(H);
  1378. return S4 += " " + R({ width: i7, height: s9, tileWidth: n10, tileHeight: a11, planes: l8, ifds: e8 }), { width: i7, height: s9, tileWidth: n10, tileHeight: a11, planes: l8, isBSQ: u6, pixelType: f7, compression: m5, noData: E3, isSupported: A3, message: S4, extent: N2, affine: U3 ? null : k5, firstPyramidLevel: B2, maximumPyramidLevel: V2, pyramidBlockWidth: F2, pyramidBlockHeight: v4, tileBoundary: W, metadata: Y };
  1379. }
  1380. function O(e8, t7) {
  1381. const n10 = p4(e8, "PLANARCONFIGURATION");
  1382. return n10 ? 2 === n10[0] : !!t7 && t7.isBSQ;
  1383. }
  1384. function U(e8) {
  1385. const { littleEndian: t7, isBigTiff: n10, firstIFDPos: a11 } = N(e8);
  1386. let i7 = a11;
  1387. const s9 = [];
  1388. do {
  1389. const a12 = G(e8, t7, i7, 0, n5.TIFF_TAGS, n10 ? 8 : 4);
  1390. if (!a12.success)
  1391. break;
  1392. s9.push(a12.ifd), i7 = a12.nextIFD;
  1393. } while (i7 > 0);
  1394. return { ...D(s9), littleEndian: t7, isBigTiff: n10, ifds: s9 };
  1395. }
  1396. function L(e8, t7, n10) {
  1397. const a11 = e8.getUint32(t7, n10), i7 = e8.getUint32(t7 + 4, n10);
  1398. return n10 ? i7 * u2 + a11 : a11 * u2 + i7;
  1399. }
  1400. function P(e8, t7, n10) {
  1401. let a11 = n10 ? e8.getInt32(t7, n10) : e8.getUint32(t7, n10), i7 = n10 ? e8.getUint32(t7 + 4, n10) : e8.getInt32(t7 + 4, n10);
  1402. const s9 = (n10 ? a11 : i7) >= 0 ? 1 : -1;
  1403. n10 ? a11 *= s9 : i7 *= s9;
  1404. return s9 * (n10 ? i7 * u2 + a11 : a11 * u2 + i7);
  1405. }
  1406. function k2(e8, t7, n10, a11) {
  1407. return a11 ? L(e8, t7, n10) : e8.getUint32(t7, n10);
  1408. }
  1409. function N(e8) {
  1410. const t7 = new DataView(e8, 0, 16), n10 = t7.getUint16(0, false);
  1411. let a11 = null;
  1412. if (18761 === n10)
  1413. a11 = true;
  1414. else {
  1415. if (19789 !== n10)
  1416. throw "unexpected endianess byte";
  1417. a11 = false;
  1418. }
  1419. const i7 = t7.getUint16(2, a11);
  1420. if (42 !== i7 && 43 !== i7)
  1421. throw "unexpected tiff identifier";
  1422. let s9 = 4;
  1423. const r11 = 43 === i7;
  1424. if (r11) {
  1425. const e9 = t7.getUint16(s9, a11);
  1426. if (s9 += 2, 8 !== e9)
  1427. throw "unsupported bigtiff version";
  1428. if (0 !== t7.getUint16(s9, a11))
  1429. throw "unsupported bigtiff version";
  1430. s9 += 2;
  1431. }
  1432. return { littleEndian: a11, isBigTiff: r11, firstIFDPos: k2(t7, s9, a11, r11) };
  1433. }
  1434. function G(e8, n10, a11, i7 = 0, s9 = n5.TIFF_TAGS, l8 = 4) {
  1435. const o5 = E2(e8, n10, a11, i7, s9, l8);
  1436. let f7;
  1437. const u6 = o5.ifd;
  1438. if (u6) {
  1439. if (n5.ifdTags.forEach((t7, a12) => {
  1440. u6.has(a12) && (f7 = u6.get(a12), f7.data = E2(e8, n10, f7.valueOffset - i7, i7, t7).ifd);
  1441. }), u6.has("GEOKEYDIRECTORY")) {
  1442. f7 = u6.get("GEOKEYDIRECTORY");
  1443. const t7 = f7.values;
  1444. if (t7 && t7.length > 4) {
  1445. const a12 = t7[0] + "." + t7[1] + "." + t7[2];
  1446. f7.data = E2(e8, n10, f7.valueOffset + 6 - i7, i7, n5.GEO_KEYS, 2).ifd, f7.data && f7.data.set("GEOTIFFVersion", { id: 0, type: 2, valueCount: 1, valueOffset: null, values: [a12] });
  1447. }
  1448. }
  1449. if (u6.has("XMP")) {
  1450. f7 = u6.get("XMP");
  1451. const e9 = f7.values;
  1452. "number" == typeof e9[0] && 7 === f7.type && (f7.values = [r9(new Uint8Array(e9))]);
  1453. }
  1454. }
  1455. return o5;
  1456. }
  1457. function R(e8) {
  1458. const { width: t7, height: n10, tileHeight: a11, tileWidth: i7 } = e8, s9 = e8.planes, r11 = i7 ? i7 * a11 : t7 * n10, l8 = T(e8.ifds[0], "BITSPERSAMPLE");
  1459. let o5 = "";
  1460. return r11 * s9 > 2 ** 30 / (l8 > 8 ? l8 / 8 : 1) && (o5 = i7 ? "tiled tiff exceeding 1 gigabits per tile is not supported" : "scanline tiff exceeding 1 gigabits is not supported"), o5;
  1461. }
  1462. async function C(e8, t7) {
  1463. var _a;
  1464. const { headerInfo: n10, ifd: a11, offsets: i7, sizes: s9 } = t7, r11 = [];
  1465. for (let g6 = 0; g6 < i7.length; g6++) {
  1466. const t8 = await m(e8, n10.littleEndian, a11, i7[g6], s9[g6] || e8.byteLength);
  1467. r11.push(t8);
  1468. }
  1469. const l8 = O(a11, n10), { pixelType: o5, planes: f7 } = n10, u6 = g2(o5), c7 = T(a11, "TILEWIDTH"), h5 = T(a11, "TILELENGTH"), w5 = (_a = T(a11, "COMPRESSION")) != null ? _a : 1, p8 = c7 * h5;
  1470. let d4;
  1471. const I3 = [];
  1472. let E3 = r11[0];
  1473. const y6 = 34887 === w5;
  1474. for (let g6 = 0; g6 < f7; g6++) {
  1475. if (d4 = new u6(p8), l8 && y6) {
  1476. if (E3 = r11[g6], E3.length)
  1477. for (let e9 = 0; e9 < p8; e9++)
  1478. d4[e9] = E3[g6][e9 + g6];
  1479. } else if (E3.length)
  1480. if (l8 || y6 && !l8)
  1481. d4 = E3.slice(p8 * g6, p8 * (g6 + 1));
  1482. else
  1483. for (let e9 = 0; e9 < p8; e9++)
  1484. d4[e9] = E3[e9 * f7 + g6];
  1485. I3.push(d4);
  1486. }
  1487. const A3 = n10.noData ? n10.noData[0] : t7.noDataValue, S4 = n10.metadata ? n10.metadata.statistics : null, x4 = S4 ? S4.map((e9) => e9.min) : null, b3 = S4 ? S4.map((e9) => e9.max) : null;
  1488. let D4, U3 = null;
  1489. if (null != A3)
  1490. if (U3 = new Uint8Array(p8), Math.abs(A3) > 1e24)
  1491. for (D4 = 0; D4 < p8; D4++)
  1492. Math.abs((I3[0][D4] - A3) / A3) < 1e-6 ? U3[D4] = 0 : U3[D4] = 1;
  1493. else
  1494. for (D4 = 0; D4 < p8; D4++)
  1495. I3[0][D4] === A3 ? U3[D4] = 0 : U3[D4] = 1;
  1496. else
  1497. x4 && b3 && t7.applyMinMaxConstraint && (U3 = M(I3, x4, b3));
  1498. return { pixelType: o5, width: c7, height: h5, pixels: I3, mask: U3, noDataValue: A3 };
  1499. }
  1500. async function F(t7, n10 = {}) {
  1501. const a11 = n10.pyramidLevel || 0, i7 = n10.headerInfo || U(t7), { ifds: s9, noData: r11 } = i7;
  1502. if (0 === s9.length)
  1503. throw "no valid image file directory";
  1504. const l8 = R(i7);
  1505. if (l8)
  1506. throw l8;
  1507. let o5, f7 = null;
  1508. const u6 = -1 === a11 ? s9[s9.length - 1] : s9[a11], c7 = r11 ? r11[0] : n10.noDataValue;
  1509. if (f7 = i7.tileWidth ? await A(t7, i7, u6) : await S2(t7, i7, u6), null != c7) {
  1510. if (c(f7), f7.mask = new Uint8Array(f7.width * f7.height), Math.abs(c7) > 1e24)
  1511. for (o5 = 0; o5 < f7.width * f7.height; o5++)
  1512. Math.abs((f7.pixels[0][o5] - c7) / c7) < 1e-6 ? f7.mask[o5] = 0 : f7.mask[o5] = 1;
  1513. else
  1514. for (o5 = 0; o5 < f7.width * f7.height; o5++)
  1515. f7.pixels[0][o5] === c7 ? f7.mask[o5] = 0 : f7.mask[o5] = 1;
  1516. f7.noDataValue = c7;
  1517. }
  1518. return f7;
  1519. }
  1520. // node_modules/@arcgis/core/layers/support/rasterFormats/RasterCodec.js
  1521. var f4 = function(t7) {
  1522. var e8, i7, a11, s9, r11, n10;
  1523. function o5(t8) {
  1524. var e9, i8, a12, s10, r12, n11, o6, h5, c7, p8, l8, d4, u6;
  1525. for (this.data = t8, this.pos = 8, this.palette = [], this.imgData = [], this.transparency = {}, this.animation = null, this.text = {}, r12 = null; ; ) {
  1526. switch (e9 = this.readUInt32(), h5 = function() {
  1527. var t9, e10;
  1528. for (e10 = [], t9 = 0; t9 < 4; ++t9)
  1529. e10.push(String.fromCharCode(this.data[this.pos++]));
  1530. return e10;
  1531. }.call(this).join(""), h5) {
  1532. case "IHDR":
  1533. this.width = this.readUInt32(), this.height = this.readUInt32(), this.bits = this.data[this.pos++], this.colorType = this.data[this.pos++], this.compressionMethod = this.data[this.pos++], this.filterMethod = this.data[this.pos++], this.interlaceMethod = this.data[this.pos++];
  1534. break;
  1535. case "acTL":
  1536. this.animation = { numFrames: this.readUInt32(), numPlays: this.readUInt32() || 1 / 0, frames: [] };
  1537. break;
  1538. case "PLTE":
  1539. this.palette = this.read(e9);
  1540. break;
  1541. case "fcTL":
  1542. r12 && this.animation.frames.push(r12), this.pos += 4, r12 = { width: this.readUInt32(), height: this.readUInt32(), xOffset: this.readUInt32(), yOffset: this.readUInt32() }, s10 = this.readUInt16(), a12 = this.readUInt16() || 100, r12.delay = 1e3 * s10 / a12, r12.disposeOp = this.data[this.pos++], r12.blendOp = this.data[this.pos++], r12.data = [];
  1543. break;
  1544. case "IDAT":
  1545. case "fdAT":
  1546. for ("fdAT" === h5 && (this.pos += 4, e9 -= 4), t8 = (null != r12 ? r12.data : void 0) || this.imgData, l8 = 0; 0 <= e9 ? l8 < e9 : l8 > e9; 0 <= e9 ? ++l8 : --l8)
  1547. t8.push(this.data[this.pos++]);
  1548. break;
  1549. case "tRNS":
  1550. switch (this.transparency = {}, this.colorType) {
  1551. case 3:
  1552. if (this.transparency.indexed = this.read(e9), (c7 = 255 - this.transparency.indexed.length) > 0)
  1553. for (d4 = 0; 0 <= c7 ? d4 < c7 : d4 > c7; 0 <= c7 ? ++d4 : --d4)
  1554. this.transparency.indexed.push(255);
  1555. break;
  1556. case 0:
  1557. this.transparency.grayscale = this.read(e9)[0];
  1558. break;
  1559. case 2:
  1560. this.transparency.rgb = this.read(e9);
  1561. }
  1562. break;
  1563. case "tEXt":
  1564. n11 = (p8 = this.read(e9)).indexOf(0), o6 = String.fromCharCode.apply(String, p8.slice(0, n11)), this.text[o6] = String.fromCharCode.apply(String, p8.slice(n11 + 1));
  1565. break;
  1566. case "IEND":
  1567. return r12 && this.animation.frames.push(r12), this.colors = function() {
  1568. switch (this.colorType) {
  1569. case 0:
  1570. case 3:
  1571. case 4:
  1572. return 1;
  1573. case 2:
  1574. case 6:
  1575. return 3;
  1576. }
  1577. }.call(this), this.hasAlphaChannel = 4 === (u6 = this.colorType) || 6 === u6, i8 = this.colors + (this.hasAlphaChannel ? 1 : 0), this.pixelBitlength = this.bits * i8, this.colorSpace = function() {
  1578. switch (this.colors) {
  1579. case 1:
  1580. return "DeviceGray";
  1581. case 3:
  1582. return "DeviceRGB";
  1583. }
  1584. }.call(this), void (this.imgData = new Uint8Array(this.imgData));
  1585. default:
  1586. this.pos += e9;
  1587. }
  1588. if (this.pos += 4, this.pos > this.data.length)
  1589. throw new Error("Incomplete or corrupt PNG file");
  1590. }
  1591. }
  1592. return o5.load = function(t8, e9, i8) {
  1593. var a12;
  1594. return "function" == typeof e9 && (i8 = e9), (a12 = new XMLHttpRequest()).open("GET", t8, true), a12.responseType = "arraybuffer", a12.onload = function() {
  1595. var t9;
  1596. return t9 = new o5(new Uint8Array(a12.response || a12.mozResponseArrayBuffer)), "function" == typeof (null != e9 ? e9.getContext : void 0) && t9.render(e9), "function" == typeof i8 ? i8(t9) : void 0;
  1597. }, a12.send(null);
  1598. }, i7 = 1, a11 = 2, e8 = 0, o5.prototype.read = function(t8) {
  1599. var e9, i8;
  1600. for (i8 = [], e9 = 0; 0 <= t8 ? e9 < t8 : e9 > t8; 0 <= t8 ? ++e9 : --e9)
  1601. i8.push(this.data[this.pos++]);
  1602. return i8;
  1603. }, o5.prototype.readUInt32 = function() {
  1604. return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++];
  1605. }, o5.prototype.readUInt16 = function() {
  1606. return this.data[this.pos++] << 8 | this.data[this.pos++];
  1607. }, o5.prototype.decodePixels = function(t8) {
  1608. var e9, i8, a12, s10, r12, n11, o6, h5, p8, l8, d4, u6, f7, m5, g6, w5, y6, x4, b3, k5, I3, T4, v4;
  1609. if (null == t8 && (t8 = this.imgData), 0 === t8.length)
  1610. return new Uint8Array(0);
  1611. for (t8 = (t8 = new s5(t8)).getBytes(), w5 = (u6 = this.pixelBitlength / 8) * this.width, f7 = new Uint8Array(w5 * this.height), n11 = t8.length, g6 = 0, m5 = 0, i8 = 0; m5 < n11; ) {
  1612. switch (t8[m5++]) {
  1613. case 0:
  1614. for (s10 = b3 = 0; b3 < w5; s10 = b3 += 1)
  1615. f7[i8++] = t8[m5++];
  1616. break;
  1617. case 1:
  1618. for (s10 = k5 = 0; k5 < w5; s10 = k5 += 1)
  1619. e9 = t8[m5++], r12 = s10 < u6 ? 0 : f7[i8 - u6], f7[i8++] = (e9 + r12) % 256;
  1620. break;
  1621. case 2:
  1622. for (s10 = I3 = 0; I3 < w5; s10 = I3 += 1)
  1623. e9 = t8[m5++], a12 = (s10 - s10 % u6) / u6, y6 = g6 && f7[(g6 - 1) * w5 + a12 * u6 + s10 % u6], f7[i8++] = (y6 + e9) % 256;
  1624. break;
  1625. case 3:
  1626. for (s10 = T4 = 0; T4 < w5; s10 = T4 += 1)
  1627. e9 = t8[m5++], a12 = (s10 - s10 % u6) / u6, r12 = s10 < u6 ? 0 : f7[i8 - u6], y6 = g6 && f7[(g6 - 1) * w5 + a12 * u6 + s10 % u6], f7[i8++] = (e9 + Math.floor((r12 + y6) / 2)) % 256;
  1628. break;
  1629. case 4:
  1630. for (s10 = v4 = 0; v4 < w5; s10 = v4 += 1)
  1631. e9 = t8[m5++], a12 = (s10 - s10 % u6) / u6, r12 = s10 < u6 ? 0 : f7[i8 - u6], 0 === g6 ? y6 = x4 = 0 : (y6 = f7[(g6 - 1) * w5 + a12 * u6 + s10 % u6], x4 = a12 && f7[(g6 - 1) * w5 + (a12 - 1) * u6 + s10 % u6]), o6 = r12 + y6 - x4, h5 = Math.abs(o6 - r12), l8 = Math.abs(o6 - y6), d4 = Math.abs(o6 - x4), p8 = h5 <= l8 && h5 <= d4 ? r12 : l8 <= d4 ? y6 : x4, f7[i8++] = (e9 + p8) % 256;
  1632. break;
  1633. default:
  1634. throw new Error("Invalid filter algorithm: " + t8[m5 - 1]);
  1635. }
  1636. g6++;
  1637. }
  1638. return f7;
  1639. }, o5.prototype.decodePalette = function() {
  1640. var t8, e9, i8, a12, s10, r12, n11, o6, h5;
  1641. for (i8 = this.palette, r12 = this.transparency.indexed || [], s10 = new Uint8Array((r12.length || 0) + i8.length), a12 = 0, i8.length, t8 = 0, e9 = n11 = 0, o6 = i8.length; n11 < o6; e9 = n11 += 3)
  1642. s10[a12++] = i8[e9], s10[a12++] = i8[e9 + 1], s10[a12++] = i8[e9 + 2], s10[a12++] = null != (h5 = r12[t8++]) ? h5 : 255;
  1643. return s10;
  1644. }, o5.prototype.copyToImageData = function(t8, e9) {
  1645. var i8, a12, s10, r12, n11, o6, h5, c7, p8, l8, d4;
  1646. if (a12 = this.colors, p8 = null, i8 = this.hasAlphaChannel, this.palette.length && (p8 = null != (d4 = this._decodedPalette) ? d4 : this._decodedPalette = this.decodePalette(), a12 = 4, i8 = true), c7 = (s10 = t8.data || t8).length, n11 = p8 || e9, r12 = o6 = 0, 1 === a12)
  1647. for (; r12 < c7; )
  1648. h5 = p8 ? 4 * e9[r12 / 4] : o6, l8 = n11[h5++], s10[r12++] = l8, s10[r12++] = l8, s10[r12++] = l8, s10[r12++] = i8 ? n11[h5++] : this.transparency.grayscale && this.transparency.grayscale === l8 ? 0 : 255, o6 = h5;
  1649. else
  1650. for (; r12 < c7; )
  1651. h5 = p8 ? 4 * e9[r12 / 4] : o6, s10[r12++] = n11[h5++], s10[r12++] = n11[h5++], s10[r12++] = n11[h5++], s10[r12++] = i8 ? n11[h5++] : this.transparency.rgb && this.transparency.rgb[1] === n11[h5 - 3] && this.transparency.rgb[3] === n11[h5 - 2] && this.transparency.rgb[5] === n11[h5 - 1] ? 0 : 255, o6 = h5;
  1652. }, o5.prototype.decode = function() {
  1653. var t8;
  1654. return t8 = new Uint8Array(this.width * this.height * 4), this.copyToImageData(t8, this.decodePixels()), t8;
  1655. }, r11 = t7.document && t7.document.createElement("canvas"), n10 = r11 && r11.getContext("2d"), s9 = function(t8) {
  1656. var e9;
  1657. return n10.width = t8.width, n10.height = t8.height, n10.clearRect(0, 0, t8.width, t8.height), n10.putImageData(t8, 0, 0), (e9 = new Image()).src = r11.toDataURL(), e9;
  1658. }, o5.prototype.decodeFrames = function(t8) {
  1659. var e9, i8, a12, r12, n11, o6, h5, c7;
  1660. if (this.animation) {
  1661. for (c7 = [], i8 = n11 = 0, o6 = (h5 = this.animation.frames).length; n11 < o6; i8 = ++n11)
  1662. e9 = h5[i8], a12 = t8.createImageData(e9.width, e9.height), r12 = this.decodePixels(new Uint8Array(e9.data)), this.copyToImageData(a12, r12), e9.imageData = a12, c7.push(e9.image = s9(a12));
  1663. return c7;
  1664. }
  1665. }, o5.prototype.renderFrame = function(t8, s10) {
  1666. var r12, n11, o6;
  1667. return r12 = (n11 = this.animation.frames)[s10], o6 = n11[s10 - 1], 0 === s10 && t8.clearRect(0, 0, this.width, this.height), (null != o6 ? o6.disposeOp : void 0) === i7 ? t8.clearRect(o6.xOffset, o6.yOffset, o6.width, o6.height) : (null != o6 ? o6.disposeOp : void 0) === a11 && t8.putImageData(o6.imageData, o6.xOffset, o6.yOffset), r12.blendOp === e8 && t8.clearRect(r12.xOffset, r12.yOffset, r12.width, r12.height), t8.drawImage(r12.image, r12.xOffset, r12.yOffset);
  1668. }, o5.prototype.animate = function(t8) {
  1669. var e9, i8, a12, s10, r12, n11, o6 = this;
  1670. return i8 = 0, n11 = this.animation, s10 = n11.numFrames, a12 = n11.frames, r12 = n11.numPlays, (e9 = function() {
  1671. var n12, h5;
  1672. if (n12 = i8++ % s10, h5 = a12[n12], o6.renderFrame(t8, n12), s10 > 1 && i8 / s10 < r12)
  1673. return o6.animation._timeout = setTimeout(e9, h5.delay);
  1674. })();
  1675. }, o5.prototype.stopAnimation = function() {
  1676. var t8;
  1677. return clearTimeout(null != (t8 = this.animation) ? t8._timeout : void 0);
  1678. }, o5.prototype.render = function(t8) {
  1679. var e9, i8;
  1680. return t8._png && t8._png.stopAnimation(), t8._png = this, t8.width = this.width, t8.height = this.height, e9 = t8.getContext("2d"), this.animation ? (this.decodeFrames(e9), this.animate(e9)) : (i8 = e9.createImageData(this.width, this.height), this.copyToImageData(i8, this.decodePixels()), e9.putImageData(i8, 0, 0));
  1681. }, o5;
  1682. }(self);
  1683. var m2 = /* @__PURE__ */ new Set(["jpg", "png", "bmp", "gif"]);
  1684. async function g3(e8, i7) {
  1685. if (!r10)
  1686. throw new s2("rasterCoded:decode", "lerc decoder is not supported on big endian platform");
  1687. await a5();
  1688. const { offset: s9, noDataValue: r11 } = i7, { width: h5, height: c7, pixelType: p8, statistics: l8, pixels: d4, mask: f7 } = c3(e8, { inputOffset: s9, noDataValue: r11, returnInterleaved: i7.returnInterleaved });
  1689. return new g({ width: h5, height: c7, pixelType: p8.toLowerCase(), pixels: d4, mask: f7, statistics: l8 });
  1690. }
  1691. async function w4(t7, e8) {
  1692. const s9 = await F(t7, e8);
  1693. c(s9);
  1694. const r11 = new g({ width: s9.width, height: s9.height, pixels: s9.pixels, pixelType: s9.pixelType.toLowerCase(), mask: s9.mask, statistics: null });
  1695. return r11.updateStatistics(), r11;
  1696. }
  1697. async function y5(t7, e8) {
  1698. const i7 = await C(t7, e8.customOptions), s9 = new g({ width: i7.width, height: i7.height, pixels: i7.pixels, pixelType: i7.pixelType.toLowerCase(), mask: i7.mask, statistics: null });
  1699. return s9.updateStatistics(), s9;
  1700. }
  1701. function x2(t7, e8) {
  1702. const i7 = e8.pixelType || "u8", s9 = g.getPixelArrayConstructor(i7), r11 = "u8" === i7 ? t7 : new s9(t7.buffer), n10 = [], o5 = e8.planes || 1;
  1703. if (1 === o5)
  1704. n10.push(r11);
  1705. else
  1706. for (let a11 = 0; a11 < o5; a11++) {
  1707. const i8 = (e8.width || 1) * (e8.height || t7.length), h6 = new s9(i8);
  1708. for (let t8 = 0; t8 < i8; t8++)
  1709. h6[t8] = r11[t8 * o5 + a11];
  1710. n10.push(h6);
  1711. }
  1712. const h5 = new g({ width: e8.width || 1, height: e8.height || t7.length, pixels: n10, pixelType: i7, statistics: null });
  1713. return h5.updateStatistics(), h5;
  1714. }
  1715. function b2(t7, e8) {
  1716. return x2(new s5(new Uint8Array(t7)).getBytes(), e8);
  1717. }
  1718. function k3(t7, e8) {
  1719. return x2(i4(t7, e8.offset, e8.eof, !e8.isInputBigEndian), e8);
  1720. }
  1721. function I2(t7, e8, i7) {
  1722. const { pixelTypeCtor: s9 } = D2(e8.pixelType), r11 = (0, a6.decode)(t7, { width: e8.width, height: e8.height, pixelType: s9, format: i7 }), n10 = new g({ width: e8.width, height: e8.height, pixels: r11.pixels, pixelType: e8.pixelType, mask: r11.mask, statistics: null });
  1723. return n10.updateStatistics(), n10;
  1724. }
  1725. function T2(t7, e8) {
  1726. var _a;
  1727. const i7 = r5.decode(t7, (_a = e8.hasNoZlibMask) != null ? _a : void 0), s9 = new g({ width: i7.width, height: i7.height, pixels: i7.pixels, pixelType: "U8", mask: i7.mask, statistics: null });
  1728. return s9.updateStatistics(), s9;
  1729. }
  1730. function v2(t7, e8) {
  1731. const i7 = new Uint8Array(t7), s9 = new f4(i7), { width: r11, height: n10 } = e8, o5 = r11 * n10, h5 = s9.decode();
  1732. let c7, p8 = 0, l8 = 0;
  1733. const d4 = new Uint8Array(o5);
  1734. for (p8 = 0; p8 < o5; p8++)
  1735. d4[p8] = h5[4 * p8 + 3];
  1736. const u6 = new g({ width: r11, height: n10, pixels: [], pixelType: "U8", mask: d4, statistics: [] });
  1737. for (p8 = 0; p8 < 3; p8++) {
  1738. for (c7 = new Uint8Array(o5), l8 = 0; l8 < o5; l8++)
  1739. c7[l8] = h5[4 * l8 + p8];
  1740. u6.addData({ pixels: c7 });
  1741. }
  1742. return u6.updateStatistics(), u6;
  1743. }
  1744. async function U2(t7, e8, i7, r11) {
  1745. const n10 = new i2(), o5 = { applyJpegMask: false, format: e8, ...i7 }, h5 = await n10.decode(t7, o5, r11), c7 = new g(h5);
  1746. return c7.updateStatistics(), c7;
  1747. }
  1748. function A2(e8) {
  1749. if (null == e8)
  1750. throw new s2("rasterCodec:decode", "parameter encodeddata is required.");
  1751. const i7 = new Uint8Array(e8, 0, 10);
  1752. let a11 = "";
  1753. return 255 === i7[0] && 216 === i7[1] ? a11 = "jpg" : 137 === i7[0] && 80 === i7[1] && 78 === i7[2] && 71 === i7[3] ? a11 = "png" : 67 === i7[0] && 110 === i7[1] && 116 === i7[2] && 90 === i7[3] && 73 === i7[4] && 109 === i7[5] && 97 === i7[6] && 103 === i7[7] && 101 === i7[8] && 32 === i7[9] ? a11 = "lerc" : 76 === i7[0] && 101 === i7[1] && 114 === i7[2] && 99 === i7[3] && 50 === i7[4] && 32 === i7[5] ? a11 = "lerc2" : 73 === i7[0] && 73 === i7[1] && 42 === i7[2] && 0 === i7[3] || 77 === i7[0] && 77 === i7[1] && 0 === i7[2] && 42 === i7[3] || 73 === i7[0] && 73 === i7[1] && 43 === i7[2] && 0 === i7[3] || 77 === i7[0] && 77 === i7[1] && 0 === i7[2] && 43 === i7[3] ? a11 = "tiff" : 71 === i7[0] && 73 === i7[1] && 70 === i7[2] ? a11 = "gif" : 66 === i7[0] && 77 === i7[1] ? a11 = "bmp" : String.fromCharCode.apply(null, i7).toLowerCase().includes("error") && (a11 = "error"), a11;
  1754. }
  1755. function C2(e8) {
  1756. let i7 = null;
  1757. switch (e8) {
  1758. case "lerc":
  1759. case "lerc2":
  1760. i7 = g3;
  1761. break;
  1762. case "jpg":
  1763. i7 = T2;
  1764. break;
  1765. case "png":
  1766. i7 = v2;
  1767. break;
  1768. case "bsq":
  1769. case "bip":
  1770. i7 = (t7, i8) => I2(t7, i8, e8);
  1771. break;
  1772. case "tiff":
  1773. i7 = w4;
  1774. break;
  1775. case "deflate":
  1776. i7 = b2;
  1777. break;
  1778. case "lzw":
  1779. i7 = k3;
  1780. break;
  1781. case "error":
  1782. i7 = () => {
  1783. throw new s2("rasterCodec:decode", "input data contains error");
  1784. };
  1785. break;
  1786. default:
  1787. i7 = () => {
  1788. throw new s2("rasterCodec:decode", "unsupported raster format");
  1789. };
  1790. }
  1791. return i7;
  1792. }
  1793. function D2(t7) {
  1794. let e8 = null, i7 = null;
  1795. switch (t7 ? t7.toLowerCase() : "f32") {
  1796. case "u1":
  1797. case "u2":
  1798. case "u4":
  1799. case "u8":
  1800. i7 = 255, e8 = Uint8Array;
  1801. break;
  1802. case "u16":
  1803. i7 = i7 || 65535, e8 = Uint16Array;
  1804. break;
  1805. case "u32":
  1806. i7 = i7 || 2 ** 32 - 1, e8 = Uint32Array;
  1807. break;
  1808. case "s8":
  1809. i7 = i7 || -128, e8 = Int8Array;
  1810. break;
  1811. case "s16":
  1812. i7 = i7 || -32768, e8 = Int16Array;
  1813. break;
  1814. case "s32":
  1815. i7 = i7 || 0 - 2 ** 31, e8 = Int32Array;
  1816. break;
  1817. default:
  1818. e8 = Float32Array;
  1819. }
  1820. return { pixelTypeCtor: e8, noDataValue: i7 };
  1821. }
  1822. function O2(t7, i7 = 1) {
  1823. if (!t7)
  1824. return;
  1825. const { pixels: s9, width: r11, height: n10, mask: o5 } = t7;
  1826. if (!s9 || 0 === s9.length)
  1827. return;
  1828. const h5 = s9.length, c7 = r11 - 1, p8 = n10 - 1, l8 = [];
  1829. let d4, u6, f7, m5, g6, w5, y6 = null;
  1830. const x4 = g.getPixelArrayConstructor(t7.pixelType);
  1831. if (0 === i7) {
  1832. for (d4 = 0; d4 < h5; d4++) {
  1833. for (g6 = s9[d4], w5 = new x4(c7 * p8), u6 = 0; u6 < p8; u6++)
  1834. for (m5 = u6 * r11, f7 = 0; f7 < c7; f7++)
  1835. w5[u6 * c7 + f7] = g6[m5 + f7];
  1836. l8.push(w5);
  1837. }
  1838. if (r(o5))
  1839. for (y6 = new Uint8Array(c7 * p8), u6 = 0; u6 < p8; u6++)
  1840. for (m5 = u6 * r11, f7 = 0; f7 < c7; f7++)
  1841. y6[u6 * c7 + f7] = o5[m5 + f7];
  1842. } else {
  1843. for (d4 = 0; d4 < h5; d4++) {
  1844. for (g6 = s9[d4], w5 = new x4(c7 * p8), u6 = 0; u6 < p8; u6++)
  1845. for (m5 = u6 * r11, f7 = 0; f7 < c7; f7++)
  1846. w5[u6 * c7 + f7] = (g6[m5 + f7] + g6[m5 + f7 + 1] + g6[m5 + r11 + f7] + g6[m5 + r11 + f7 + 1]) / 4;
  1847. l8.push(w5);
  1848. }
  1849. if (o5)
  1850. for (y6 = new Uint8Array(c7 * p8), u6 = 0; u6 < p8; u6++)
  1851. for (m5 = u6 * r11, f7 = 0; f7 < c7; f7++)
  1852. y6[u6 * c7 + f7] = Math.min.apply(null, [o5[m5 + f7], o5[m5 + f7 + 1], o5[m5 + r11 + f7], o5[m5 + r11 + f7 + 1]]);
  1853. }
  1854. t7.width = c7, t7.height = p8, t7.mask = y6, t7.pixels = l8;
  1855. }
  1856. function P2(t7) {
  1857. let e8 = A2(t7);
  1858. return "lerc2" === e8 ? e8 = "lerc" : "error" === e8 && (e8 = ""), e8;
  1859. }
  1860. async function S3(e8, i7 = {}, a11) {
  1861. if (null == e8)
  1862. throw new s2("rasterCodec:decode", "missing encodeddata parameter.");
  1863. let s9, r11, n10 = i7.format && i7.format.toLowerCase();
  1864. if (!("bsq" !== n10 && "bip" !== n10 || null != i7.width && null != i7.height))
  1865. throw new s2("rasterCodec:decode", "requires width and height in options parameter.");
  1866. return "tiff" === n10 && i7.customOptions ? y5(e8, i7) : ((!n10 || "bsq" !== n10 && "bip" !== n10 && "deflate" !== n10 && "lzw" !== n10) && (n10 = A2(e8)), i7.useCanvas && m2.has(n10) ? r11 = await U2(e8, n10, i7, a11) : (s9 = C2(n10), i7.isPoint && (null != (i7 = { ...i7 }).width && i7.width++, null != i7.height && i7.height++), r11 = await s9(e8, i7), i7.isPoint && O2(r11)), r11);
  1867. }
  1868. // node_modules/@arcgis/core/renderers/support/stretchRendererUtils.js
  1869. var n6 = new s3({ none: "none", standardDeviation: "standard-deviation", histogramEqualization: "histogram-equalization", minMax: "min-max", percentClip: "percent-clip", sigmoid: "sigmoid" });
  1870. var a7 = { 0: "none", 3: "standardDeviation", 4: "histogramEqualization", 5: "minMax", 6: "percentClip", 9: "sigmoid" };
  1871. // node_modules/@arcgis/core/layers/support/rasterFunctions/stretchUtils.js
  1872. var o3 = { u1: [0, 1], u2: [0, 3], u4: [0, 15], u8: [0, 255], s8: [-128, 127], u16: [0, 65535], s16: [-32768, 32767], u32: [0, 4294967295], s32: [-2147483648, 2147483647], f32: [-34e38, 34e38], f64: [-Number.MAX_VALUE, Number.MAX_VALUE] };
  1873. var a8 = 1;
  1874. var f5 = [0.299, 0.587, 0.114];
  1875. function l4(t7, e8 = 256) {
  1876. e8 = Math.min(e8, 256);
  1877. const { size: n10, counts: i7 } = t7, r11 = new Uint8Array(n10), s9 = i7.reduce((t8, n11) => t8 + n11 / e8, 0);
  1878. let o5 = 0, a11 = 0, f7 = 0, l8 = s9;
  1879. for (let u6 = 0; u6 < n10; u6++)
  1880. if (f7 += i7[u6], !(u6 < n10 - 1 && f7 + i7[u6 + 1] < l8)) {
  1881. for (; o5 < e8 - 1 && l8 < f7; )
  1882. o5++, l8 += s9;
  1883. for (let t8 = a11; t8 <= u6; t8++)
  1884. r11[t8] = o5;
  1885. a11 = u6 + 1;
  1886. }
  1887. for (let u6 = a11; u6 < n10; u6++)
  1888. r11[u6] = e8 - 1;
  1889. return r11;
  1890. }
  1891. function u3(t7) {
  1892. const { minCutOff: e8, maxCutOff: n10, gamma: i7, pixelType: r11 } = t7, s9 = t7.outMin || 0, o5 = t7.outMax || 255;
  1893. if (!["u8", "u16", "s8", "s16"].includes(r11))
  1894. return null;
  1895. const a11 = e8.length;
  1896. let f7, l8, u6 = 0;
  1897. "s8" === r11 ? u6 = -127 : "s16" === r11 && (u6 = -32767);
  1898. let c7 = 256;
  1899. ["u16", "s16"].includes(r11) && (c7 = 65536);
  1900. const h5 = [], p8 = o5 - s9;
  1901. for (f7 = 0; f7 < a11; f7++)
  1902. h5[f7] = n10[f7] - e8[f7], n10[f7], e8[f7];
  1903. const g6 = i7 && i7.length >= a11, x4 = [];
  1904. if (g6)
  1905. for (f7 = 0; f7 < a11; f7++)
  1906. i7[f7] > 1 ? i7[f7] > 2 ? x4[f7] = 6.5 + (i7[f7] - 2) ** 2.5 : x4[f7] = 6.5 + 100 * (2 - i7[f7]) ** 4 : x4[f7] = 1;
  1907. let M3;
  1908. const d4 = [];
  1909. let y6, b3, O4;
  1910. if (g6)
  1911. for (f7 = 0; f7 < a11; f7++) {
  1912. for (O4 = [], l8 = 0; l8 < c7; l8++)
  1913. y6 = l8 + u6, M3 = (y6 - e8[f7]) / h5[f7], b3 = 1, i7[f7] > 1 && (b3 -= (1 / p8) ** (M3 * x4[f7])), y6 < n10[f7] && y6 > e8[f7] ? O4[l8] = Math.floor(b3 * p8 * M3 ** (1 / i7[f7])) + s9 : y6 >= n10[f7] ? O4[l8] = o5 : O4[l8] = s9;
  1914. d4[f7] = O4;
  1915. }
  1916. else
  1917. for (f7 = 0; f7 < a11; f7++) {
  1918. for (O4 = [], l8 = 0; l8 < c7; l8++)
  1919. y6 = l8 + u6, y6 <= e8[f7] ? O4[l8] = s9 : y6 >= n10[f7] ? O4[l8] = o5 : O4[l8] = Math.floor((y6 - e8[f7]) / h5[f7] * p8) + s9;
  1920. d4[f7] = O4;
  1921. }
  1922. if (null != t7.contrastOffset) {
  1923. const e9 = m3(t7.contrastOffset, t7.brightnessOffset);
  1924. for (f7 = 0; f7 < a11; f7++)
  1925. for (O4 = d4[f7], l8 = 0; l8 < c7; l8++)
  1926. O4[l8] = e9[O4[l8]];
  1927. }
  1928. return { lut: d4, offset: u6 };
  1929. }
  1930. function m3(t7, e8) {
  1931. const n10 = Math.min(Math.max(t7, -100), 100), i7 = Math.min(Math.max(e8 != null ? e8 : 0, -100), 100), r11 = 255, s9 = 128;
  1932. let o5 = 0, a11 = 0;
  1933. const f7 = new Uint8Array(256);
  1934. for (o5 = 0; o5 < 256; o5++)
  1935. n10 > 0 && n10 < 100 ? a11 = (200 * o5 - 100 * r11 + 2 * r11 * i7) / (2 * (100 - n10)) + s9 : n10 <= 0 && n10 > -100 ? a11 = (200 * o5 - 100 * r11 + 2 * r11 * i7) * (100 + n10) / 2e4 + s9 : 100 === n10 ? (a11 = 200 * o5 - 100 * r11 + (r11 + 1) * (100 - n10) + 2 * r11 * i7, a11 = a11 > 0 ? r11 : 0) : -100 === n10 && (a11 = s9), f7[o5] = a11 > r11 ? r11 : a11 < 0 ? 0 : a11;
  1936. return f7;
  1937. }
  1938. function c5(t7, e8, n10) {
  1939. const i7 = [];
  1940. for (let r11 = 0; r11 < e8.length; r11++) {
  1941. let s9 = 0, o5 = 0, a11 = 0;
  1942. "min" in e8[r11] ? { min: s9, max: o5, avg: a11 } = e8[r11] : [s9, o5, a11] = e8[r11];
  1943. let l8 = a11 != null ? a11 : 0;
  1944. "u8" !== t7 && (l8 = 255 * (l8 - s9) / (o5 - s9)), n10 && (l8 *= f5[r11]), i7.push(h2(l8));
  1945. }
  1946. return i7;
  1947. }
  1948. function h2(t7) {
  1949. if (t7 <= 0 || t7 >= 255)
  1950. return a8;
  1951. let e8 = 0;
  1952. 150 !== t7 && (e8 = t7 <= 150 ? 45 * Math.cos(0.01047 * t7) : 17 * Math.sin(0.021 * t7));
  1953. const n10 = 255, i7 = t7 + e8, r11 = Math.log(t7 / n10), s9 = Math.log(i7 / n10);
  1954. if (0 === s9)
  1955. return a8;
  1956. const o5 = r11 / s9;
  1957. return isNaN(o5) ? a8 : Math.min(9.9, Math.max(0.01, o5));
  1958. }
  1959. function p5(n10) {
  1960. var _a;
  1961. if (t(n10) || !((_a = n10.pixels) == null ? void 0 : _a.length))
  1962. return null;
  1963. n10.statistics || n10.updateStatistics();
  1964. const { pixels: i7, mask: r11, pixelType: s9, statistics: o5 } = n10, a11 = n10.width * n10.height, f7 = i7.length;
  1965. let l8, u6, m5, c7, h5;
  1966. const p8 = [], g6 = [];
  1967. let x4, M3, d4, y6, b3, O4, C4, k5, z2, A3;
  1968. const v4 = 256;
  1969. for (c7 = 0; c7 < f7; c7++) {
  1970. if (x4 = new Uint32Array(v4), d4 = i7[c7], "u8" === s9)
  1971. if (l8 = -0.5, u6 = 255.5, r11)
  1972. for (h5 = 0; h5 < a11; h5++)
  1973. r11[h5] && x4[d4[h5]]++;
  1974. else
  1975. for (h5 = 0; h5 < a11; h5++)
  1976. x4[d4[h5]]++;
  1977. else {
  1978. if (c(o5), l8 = o5[c7].minValue, u6 = o5[c7].maxValue, m5 = (u6 - l8) / v4, M3 = new Uint32Array(v4 + 1), r11)
  1979. for (h5 = 0; h5 < a11; h5++)
  1980. r11[h5] && M3[Math.floor((d4[h5] - l8) / m5)]++;
  1981. else
  1982. for (h5 = 0; h5 < a11; h5++)
  1983. M3[Math.floor((d4[h5] - l8) / m5)]++;
  1984. for (h5 = 0; h5 < 255; h5++)
  1985. x4[h5] = M3[h5];
  1986. x4[255] = M3[255] + M3[256];
  1987. }
  1988. for (p8.push({ min: l8, max: u6, size: v4, counts: x4 }), y6 = 0, b3 = 0, k5 = 0, h5 = 0; h5 < v4; h5++)
  1989. y6 += x4[h5], b3 += h5 * x4[h5];
  1990. for (z2 = b3 / y6, h5 = 0; h5 < v4; h5++)
  1991. k5 += x4[h5] * (h5 - z2) ** 2;
  1992. A3 = Math.sqrt(k5 / (y6 - 1)), m5 = (u6 - l8) / v4, O4 = (z2 + 0.5) * m5 + l8, C4 = A3 * m5, g6.push({ min: l8, max: u6, avg: O4, stddev: C4 });
  1993. }
  1994. return { statistics: g6, histograms: p8 };
  1995. }
  1996. function g4(t7) {
  1997. const e8 = [];
  1998. for (let n10 = 0; n10 < t7.length; n10++) {
  1999. const { min: i7, max: r11, size: s9, counts: o5 } = t7[n10];
  2000. let a11 = 0, f7 = 0;
  2001. for (let t8 = 0; t8 < s9; t8++)
  2002. a11 += o5[t8], f7 += t8 * o5[t8];
  2003. const l8 = f7 / a11;
  2004. let u6 = 0;
  2005. for (let t8 = 0; t8 < s9; t8++)
  2006. u6 += o5[t8] * (t8 - l8) ** 2;
  2007. const m5 = (r11 - i7) / s9, c7 = (l8 + 0.5) * m5 + i7, h5 = Math.sqrt(u6 / (a11 - 1)) * m5;
  2008. e8.push({ min: i7, max: r11, avg: c7, stddev: h5 });
  2009. }
  2010. return e8;
  2011. }
  2012. function x3(t7, r11) {
  2013. var _a;
  2014. const { pixelBlock: a11, bandIds: f7, returnHistogramLut: u6, rasterInfo: m5 } = r11;
  2015. let c7 = null, h5 = null, g6 = t7.stretchType;
  2016. if ("number" == typeof g6 && (g6 = a7[g6]), t7.dra)
  2017. if ("minMax" === g6 && r(a11) && a11.statistics)
  2018. c7 = a11.statistics.map((t8) => [t8.minValue, t8.maxValue, 0, 0]);
  2019. else {
  2020. const t8 = p5(a11);
  2021. c7 = r(t8) ? t8.statistics : null, h5 = r(t8) ? t8.histograms : null;
  2022. }
  2023. else
  2024. c7 = ((_a = t7.statistics) == null ? void 0 : _a.length) > 0 ? t7.statistics : e2(m5.statistics), h5 = t7.histograms || e2(m5.histograms);
  2025. "percentClip" !== g6 && "histogramEqualization" !== g6 || (h5 == null ? void 0 : h5.length) || (g6 = "minMax");
  2026. const x4 = (c7 == null ? void 0 : c7.length) || (h5 == null ? void 0 : h5.length) || m5.bandCount, d4 = [], y6 = [];
  2027. let b3, O4, C4, k5, z2, A3, v4, w5, U3, E3, L3, T4;
  2028. switch (c7 && !Array.isArray(c7[0]) && (c7 = c7.map((t8) => [t8.min, t8.max, t8.avg, t8.stddev])), g6) {
  2029. case "none":
  2030. {
  2031. const t8 = o3[m5.pixelType] || o3.f32;
  2032. for (w5 = 0; w5 < x4; w5++)
  2033. d4[w5] = t8[0], y6[w5] = t8[1];
  2034. }
  2035. break;
  2036. case "minMax":
  2037. for (c(c7), w5 = 0; w5 < x4; w5++)
  2038. d4[w5] = c7[w5][0], y6[w5] = c7[w5][1];
  2039. break;
  2040. case "standardDeviation":
  2041. for (c(c7), w5 = 0; w5 < x4; w5++)
  2042. d4[w5] = c7[w5][2] - t7.numberOfStandardDeviations * c7[w5][3], y6[w5] = c7[w5][2] + t7.numberOfStandardDeviations * c7[w5][3], d4[w5] < c7[w5][0] && (d4[w5] = c7[w5][0]), y6[w5] > c7[w5][1] && (y6[w5] = c7[w5][1]);
  2043. break;
  2044. case "histogramEqualization":
  2045. for (c(h5), w5 = 0; w5 < x4; w5++)
  2046. d4[w5] = h5[w5].min, y6[w5] = h5[w5].max;
  2047. break;
  2048. case "percentClip":
  2049. for (c(h5), w5 = 0; w5 < h5.length; w5++) {
  2050. for (b3 = h5[w5], z2 = new Uint32Array(b3.size), k5 = [...b3.counts], k5.length >= 20 && (k5[0] = k5[1] = k5[2] = k5[k5.length - 1] = k5[k5.length - 2] = 0), C4 = 0, O4 = (b3.max - b3.min) / b3.size, v4 = -0.5 === b3.min && 1 === O4 ? 0.5 : 0, U3 = 0; U3 < b3.size; U3++)
  2051. C4 += k5[U3], z2[U3] = C4;
  2052. for (A3 = (t7.minPercent || 0) * C4 / 100, U3 = 0; U3 < b3.size; U3++)
  2053. if (z2[U3] > A3) {
  2054. d4[w5] = b3.min + O4 * (U3 + v4);
  2055. break;
  2056. }
  2057. for (A3 = (1 - (t7.maxPercent || 0) / 100) * C4, U3 = b3.size - 2; U3 >= 0; U3--)
  2058. if (z2[U3] < A3) {
  2059. y6[w5] = b3.min + O4 * (U3 + 2 - v4);
  2060. break;
  2061. }
  2062. }
  2063. break;
  2064. default:
  2065. for (c(c7), w5 = 0; w5 < x4; w5++)
  2066. d4[w5] = c7[w5][0], y6[w5] = c7[w5][1];
  2067. }
  2068. "histogramEqualization" === g6 ? (c(h5), L3 = h5[0].size || 256, E3 = 0, u6 && (T4 = h5.map((t8) => l4(t8)))) : (L3 = t7.max || 255, E3 = t7.min || 0);
  2069. return M2({ minCutOff: d4, maxCutOff: y6, outMax: L3, outMin: E3, histogramLut: T4 }, f7);
  2070. }
  2071. function M2(t7, e8) {
  2072. if (null == e8 || 0 === e8.length)
  2073. return t7;
  2074. const n10 = Math.max.apply(null, e8), { minCutOff: i7, maxCutOff: r11, outMin: s9, outMax: o5, histogramLut: a11 } = t7;
  2075. return i7.length === e8.length || i7.length <= n10 ? t7 : { minCutOff: e8.map((t8) => i7[t8]), maxCutOff: e8.map((t8) => r11[t8]), histogramLut: a11 ? e8.map((t8) => a11[t8]) : null, outMin: s9, outMax: o5 };
  2076. }
  2077. function d2(e8, n10) {
  2078. var _a;
  2079. if (t(e8) || !((_a = e8.pixels) == null ? void 0 : _a.length))
  2080. return e8;
  2081. const { mask: i7, width: s9, height: o5, pixels: a11 } = e8, { minCutOff: f7, maxCutOff: l8, gamma: u6 } = n10, m5 = n10.outMin || 0, c7 = n10.outMax || 255, h5 = s9 * o5, p8 = n10.outputPixelType || "u8", g6 = e8.pixels.map(() => g.createEmptyBand(p8, h5)), x4 = g6.length;
  2082. let M3, d4, y6, b3, O4;
  2083. const C4 = c7 - m5, k5 = [];
  2084. for (M3 = 0; M3 < x4; M3++)
  2085. k5[M3] = l8[M3] - f7[M3], l8[M3], f7[M3];
  2086. const z2 = u6 && u6.length >= x4, A3 = [];
  2087. if (z2)
  2088. for (M3 = 0; M3 < x4; M3++)
  2089. u6[M3] > 1 ? u6[M3] > 2 ? A3[M3] = 6.5 + (u6[M3] - 2) ** 2.5 : A3[M3] = 6.5 + 100 * (2 - u6[M3]) ** 4 : A3[M3] = 1;
  2090. if (z2)
  2091. if (null != i7) {
  2092. for (d4 = 0; d4 < h5; d4++)
  2093. if (i7[d4])
  2094. for (M3 = 0; M3 < x4; M3++)
  2095. y6 = a11[M3][d4], O4 = (y6 - f7[M3]) / k5[M3], b3 = 1, u6[M3] > 1 && (b3 -= (1 / C4) ** (O4 * A3[M3])), y6 < l8[M3] && y6 > f7[M3] ? g6[M3][d4] = Math.floor(b3 * C4 * O4 ** (1 / u6[M3])) + m5 : y6 >= l8[M3] ? g6[M3][d4] = c7 : g6[M3][d4] = m5;
  2096. } else
  2097. for (d4 = 0; d4 < h5; d4++)
  2098. for (M3 = 0; M3 < x4; M3++)
  2099. y6 = a11[M3][d4], O4 = (y6 - f7[M3]) / k5[M3], b3 = 1, u6[M3] > 1 && (b3 -= (1 / C4) ** (O4 * A3[M3])), y6 < l8[M3] && y6 > f7[M3] ? g6[M3][d4] = Math.floor(b3 * C4 * O4 ** (1 / u6[M3])) + m5 : y6 >= l8[M3] ? g6[M3][d4] = c7 : g6[M3][d4] = m5;
  2100. else if (null != i7) {
  2101. for (d4 = 0; d4 < h5; d4++)
  2102. if (i7[d4])
  2103. for (M3 = 0; M3 < x4; M3++)
  2104. y6 = a11[M3][d4], y6 < l8[M3] && y6 > f7[M3] ? g6[M3][d4] = Math.floor((y6 - f7[M3]) / k5[M3] * C4) + m5 : y6 >= l8[M3] ? g6[M3][d4] = c7 : g6[M3][d4] = m5;
  2105. } else
  2106. for (d4 = 0; d4 < h5; d4++)
  2107. for (M3 = 0; M3 < x4; M3++)
  2108. y6 = a11[M3][d4], y6 < l8[M3] && y6 > f7[M3] ? g6[M3][d4] = Math.floor((y6 - f7[M3]) / k5[M3] * C4) + m5 : y6 >= l8[M3] ? g6[M3][d4] = c7 : g6[M3][d4] = m5;
  2109. const v4 = new g({ width: s9, height: o5, mask: i7, pixels: g6, pixelType: p8 });
  2110. return v4.updateStatistics(), v4;
  2111. }
  2112. // node_modules/@arcgis/core/layers/support/RasterStorageInfo.js
  2113. var p6;
  2114. var l5 = p6 = class extends l {
  2115. constructor() {
  2116. super(...arguments), this.blockWidth = void 0, this.blockHeight = void 0, this.compression = null, this.origin = null, this.firstPyramidLevel = null, this.maximumPyramidLevel = null, this.pyramidScalingFactor = 2, this.pyramidBlockWidth = null, this.pyramidBlockHeight = null, this.isVirtualTileInfo = false, this.tileInfo = null, this.transposeInfo = null, this.blockBoundary = null;
  2117. }
  2118. clone() {
  2119. return new p6({ blockWidth: this.blockWidth, blockHeight: this.blockHeight, compression: this.compression, origin: y(this.origin), firstPyramidLevel: this.firstPyramidLevel, maximumPyramidLevel: this.maximumPyramidLevel, pyramidResolutions: y(this.pyramidResolutions), pyramidScalingFactor: this.pyramidScalingFactor, pyramidBlockWidth: this.pyramidBlockWidth, pyramidBlockHeight: this.pyramidBlockHeight, isVirtualTileInfo: this.isVirtualTileInfo, tileInfo: y(this.tileInfo), transposeInfo: y(this.transposeInfo), blockBoundary: y(this.blockBoundary) });
  2120. }
  2121. };
  2122. e([y2({ type: Number, json: { write: true } })], l5.prototype, "blockWidth", void 0), e([y2({ type: Number, json: { write: true } })], l5.prototype, "blockHeight", void 0), e([y2({ type: String, json: { write: true } })], l5.prototype, "compression", void 0), e([y2({ type: w, json: { write: true } })], l5.prototype, "origin", void 0), e([y2({ type: Number, json: { write: true } })], l5.prototype, "firstPyramidLevel", void 0), e([y2({ type: Number, json: { write: true } })], l5.prototype, "maximumPyramidLevel", void 0), e([y2({ json: { write: true } })], l5.prototype, "pyramidResolutions", void 0), e([y2({ type: Number, json: { write: true } })], l5.prototype, "pyramidScalingFactor", void 0), e([y2({ type: Number, json: { write: true } })], l5.prototype, "pyramidBlockWidth", void 0), e([y2({ type: Number, json: { write: true } })], l5.prototype, "pyramidBlockHeight", void 0), e([y2({ type: Boolean, json: { write: true } })], l5.prototype, "isVirtualTileInfo", void 0), e([y2({ json: { write: true } })], l5.prototype, "tileInfo", void 0), e([y2()], l5.prototype, "transposeInfo", void 0), e([y2()], l5.prototype, "blockBoundary", void 0), l5 = p6 = e([n("esri.layers.support.RasterStorageInfo")], l5);
  2123. var n7 = l5;
  2124. // node_modules/@arcgis/core/layers/support/RasterInfo.js
  2125. var l6;
  2126. var h3 = l6 = class extends l {
  2127. constructor(t7) {
  2128. super(t7), this.attributeTable = null, this.bandCount = null, this.colormap = null, this.extent = null, this.format = void 0, this.height = null, this.width = null, this.histograms = null, this.keyProperties = {}, this.multidimensionalInfo = null, this.noDataValue = null, this.pixelSize = null, this.pixelType = null, this.isPseudoSpatialReference = false, this.spatialReference = null, this.statistics = null, this.storageInfo = null, this.transform = null;
  2129. }
  2130. get dataType() {
  2131. var _a, _b, _c;
  2132. const t7 = (_c = (_b = (_a = this.keyProperties) == null ? void 0 : _a.DataType) == null ? void 0 : _b.toLowerCase()) != null ? _c : "generic";
  2133. return "stdtime" === t7 ? "standard-time" : t7;
  2134. }
  2135. get nativeExtent() {
  2136. return this._get("nativeExtent") || this.extent;
  2137. }
  2138. set nativeExtent(t7) {
  2139. t7 && this._set("nativeExtent", t7);
  2140. }
  2141. get nativePixelSize() {
  2142. if (t(this.transform) || !this.transform.affectsPixelSize)
  2143. return this.pixelSize;
  2144. const t7 = this.nativeExtent;
  2145. return { x: t7.width / this.width, y: t7.height / this.height };
  2146. }
  2147. get hasMultidimensionalTranspose() {
  2148. var _a;
  2149. return !!((_a = this.storageInfo) == null ? void 0 : _a.transposeInfo);
  2150. }
  2151. clone() {
  2152. return new l6({ attributeTable: y(this.attributeTable), bandCount: this.bandCount, colormap: y(this.colormap), extent: y(this.extent), nativePixelSize: y(this.nativePixelSize), format: this.format, height: this.height, width: this.width, histograms: y(this.histograms), keyProperties: y(this.keyProperties), multidimensionalInfo: y(this.multidimensionalInfo), noDataValue: this.noDataValue, pixelSize: y(this.pixelSize), pixelType: this.pixelType, isPseudoSpatialReference: this.isPseudoSpatialReference, spatialReference: y(this.spatialReference), statistics: y(this.statistics), storageInfo: y(this.storageInfo), transform: y(this.transform) });
  2153. }
  2154. };
  2155. e([y2({ json: { write: true } })], h3.prototype, "attributeTable", void 0), e([y2({ json: { write: true } })], h3.prototype, "bandCount", void 0), e([y2({ json: { write: true } })], h3.prototype, "colormap", void 0), e([y2({ type: String, readOnly: true })], h3.prototype, "dataType", null), e([y2({ type: w2, json: { write: true } })], h3.prototype, "extent", void 0), e([y2({ type: w2, json: { write: true } })], h3.prototype, "nativeExtent", null), e([y2({ json: { write: true } })], h3.prototype, "nativePixelSize", null), e([y2({ json: { write: true } })], h3.prototype, "format", void 0), e([y2({ json: { write: true } })], h3.prototype, "height", void 0), e([y2({ json: { write: true } })], h3.prototype, "width", void 0), e([y2({ json: { write: true } })], h3.prototype, "hasMultidimensionalTranspose", null), e([y2({ json: { write: true } })], h3.prototype, "histograms", void 0), e([y2({ json: { write: true } })], h3.prototype, "keyProperties", void 0), e([y2({ json: { write: true } })], h3.prototype, "multidimensionalInfo", void 0), e([y2({ json: { write: true } })], h3.prototype, "noDataValue", void 0), e([y2({ json: { write: true } })], h3.prototype, "pixelSize", void 0), e([y2({ json: { write: true } })], h3.prototype, "pixelType", void 0), e([y2()], h3.prototype, "isPseudoSpatialReference", void 0), e([y2({ type: k, json: { write: true } })], h3.prototype, "spatialReference", void 0), e([y2({ json: { write: true } })], h3.prototype, "statistics", void 0), e([y2({ type: n7, json: { write: true } })], h3.prototype, "storageInfo", void 0), e([y2({ json: { write: true } })], h3.prototype, "transform", void 0), h3 = l6 = e([n("esri.layers.support.RasterInfo")], h3);
  2156. var u4 = h3;
  2157. // node_modules/@arcgis/core/layers/support/rasterFunctions/surfaceUtils.js
  2158. function n8(t7) {
  2159. let { altitude: e8, azimuth: i7 } = t7;
  2160. const { hillshadeType: n10, pixelSizePower: l8 = 1, pixelSizeFactor: s9 = 1, scalingType: a11, isGCS: o5, resolution: r11 } = t7, c7 = "multi-directional" === n10 ? 2 * t7.zFactor : t7.zFactor, { x: h5, y: f7 } = r11;
  2161. let u6 = c7 / (8 * h5), p8 = c7 / (8 * f7);
  2162. if (o5 && c7 > 1e-3 && (u6 /= 111e3, p8 /= 111e3), "adjusted" === a11)
  2163. if (o5) {
  2164. const t8 = 111e3 * h5, e9 = 111e3 * f7;
  2165. u6 = (c7 + t8 ** l8 * s9) / (8 * t8), p8 = (c7 + e9 ** l8 * s9) / (8 * e9);
  2166. } else
  2167. u6 = (c7 + h5 ** l8 * s9) / (8 * h5), p8 = (c7 + f7 ** l8 * s9) / (8 * f7);
  2168. let x4 = (90 - e8) * Math.PI / 180, d4 = Math.cos(x4), m5 = (360 - i7 + 90) * Math.PI / 180, w5 = Math.sin(x4) * Math.cos(m5), y6 = Math.sin(x4) * Math.sin(m5);
  2169. const M3 = [315, 270, 225, 360, 180, 0], A3 = [60, 60, 60, 60, 60, 90], g6 = new Float32Array([3, 5, 3, 2, 1, 4]), k5 = g6.reduce((t8, e9) => t8 + e9), P3 = g6.map((t8) => t8 / k5), Z = "multi-directional" === n10 ? M3.length : 1, C4 = new Float32Array(6), F2 = new Float32Array(6), b3 = new Float32Array(6);
  2170. if ("multi-directional" === n10)
  2171. for (let z2 = 0; z2 < Z; z2++)
  2172. e8 = A3[z2], i7 = M3[z2], x4 = (90 - e8) * Math.PI / 180, d4 = Math.cos(x4), m5 = (360 - i7 + 90) * Math.PI / 180, w5 = Math.sin(x4) * Math.cos(m5), y6 = Math.sin(x4) * Math.sin(m5), C4[z2] = d4, F2[z2] = w5, b3[z2] = y6;
  2173. else
  2174. C4.fill(d4), F2.fill(w5), b3.fill(y6);
  2175. return { resolution: r11, factor: [u6, p8], sinZcosA: w5, sinZsinA: y6, cosZ: d4, sinZcosAs: F2, sinZsinAs: b3, cosZs: C4, weights: P3, hillshadeType: ["traditional", "multi-directional"].indexOf(n10) };
  2176. }
  2177. function l7(l8, s9) {
  2178. if (!r2(l8))
  2179. return l8;
  2180. const { width: a11, height: o5, mask: r11 } = l8, c7 = new Uint8Array(a11 * o5);
  2181. let h5 = 1;
  2182. if (r(r11)) {
  2183. for (let t7 = 0; t7 < r11.length; t7++)
  2184. if (r11[t7]) {
  2185. h5 = r11[t7];
  2186. break;
  2187. }
  2188. c7.set(r11);
  2189. }
  2190. const { factor: f7, sinZcosA: u6, sinZsinA: p8, cosZ: x4, sinZcosAs: d4, sinZsinAs: m5, cosZs: w5, weights: y6 } = n8(s9), [M3, A3] = f7, { hillshadeType: g6 } = s9, k5 = l8.pixels[0], P3 = new Uint8Array(a11 * o5);
  2191. let Z, C4, F2, b3, z2, T4, U3, S4;
  2192. const v4 = 1, V2 = r(r11);
  2193. for (let t7 = v4; t7 < o5 - v4; t7++) {
  2194. const e8 = t7 * a11;
  2195. for (let t8 = v4; t8 < a11 - v4; t8++) {
  2196. if (r11 && !r11[e8 + t8]) {
  2197. P3[e8 + t8] = 0;
  2198. continue;
  2199. }
  2200. let i7 = 8;
  2201. if (V2 && (i7 = (r11[e8 - a11 + t8 - 1] + r11[e8 - a11 + t8] + r11[e8 - a11 + t8 + 1] + r11[e8 + t8 - 1] + r11[e8 + t8 + 1] + r11[e8 + a11 + t8 - 1] + r11[e8 + a11 + t8] + r11[e8 + a11 + t8 + 1]) / h5, i7 < 7)) {
  2202. P3[e8 + t8] = 0, c7[e8 + t8] = 0;
  2203. continue;
  2204. }
  2205. r11 && 7 === i7 ? (Z = r11[e8 - a11 + t8 - 1] ? k5[e8 - a11 + t8 - 1] : k5[e8 + t8], C4 = r11[e8 - a11 + t8] ? k5[e8 - a11 + t8] : k5[e8 + t8], F2 = r11[e8 - a11 + t8 + 1] ? k5[e8 - a11 + t8 + 1] : k5[e8 + t8], b3 = r11[e8 + t8 - 1] ? k5[e8 + t8 - 1] : k5[e8 + t8], z2 = r11[e8 + t8 + 1] ? k5[e8 + t8 + 1] : k5[e8 + t8], T4 = r11[e8 + a11 + t8 - 1] ? k5[e8 + a11 + t8 - 1] : k5[e8 + t8], U3 = r11[e8 + a11 + t8] ? k5[e8 + a11 + t8] : k5[e8 + t8], S4 = r11[e8 + a11 + t8 + 1] ? k5[e8 + a11 + t8 + 1] : k5[e8 + t8]) : (Z = k5[e8 - a11 + t8 - 1], C4 = k5[e8 - a11 + t8], F2 = k5[e8 - a11 + t8 + 1], b3 = k5[e8 + t8 - 1], z2 = k5[e8 + t8 + 1], T4 = k5[e8 + a11 + t8 - 1], U3 = k5[e8 + a11 + t8], S4 = k5[e8 + a11 + t8 + 1]);
  2206. const n10 = (F2 + z2 + z2 + S4 - (Z + b3 + b3 + T4)) * M3, l9 = (T4 + U3 + U3 + S4 - (Z + C4 + C4 + F2)) * A3, s10 = Math.sqrt(1 + n10 * n10 + l9 * l9);
  2207. let o6 = 0;
  2208. if ("traditional" === g6) {
  2209. let t9 = 255 * (x4 + p8 * l9 - u6 * n10) / s10;
  2210. t9 < 0 && (t9 = 0), o6 = t9;
  2211. } else {
  2212. const t9 = m5.length;
  2213. for (let e9 = 0; e9 < t9; e9++) {
  2214. let t10 = 255 * (w5[e9] + m5[e9] * l9 - d4[e9] * n10) / s10;
  2215. t10 < 0 && (t10 = 0), o6 += t10 * y6[e9];
  2216. }
  2217. }
  2218. P3[e8 + t8] = 255 & o6;
  2219. }
  2220. }
  2221. for (let t7 = 0; t7 < o5; t7++)
  2222. P3[t7 * a11] = P3[t7 * a11 + 1], P3[(t7 + 1) * a11 - 1] = P3[(t7 + 1) * a11 - 2];
  2223. for (let t7 = 1; t7 < a11 - 1; t7++)
  2224. P3[t7] = P3[t7 + a11], P3[t7 + (o5 - 1) * a11] = P3[t7 + (o5 - 2) * a11];
  2225. return new g({ width: a11, height: o5, pixels: [P3], mask: r11 ? c7 : null, pixelType: "u8", validPixelCount: l8.validPixelCount, statistics: [{ minValue: 0, maxValue: 255 }] });
  2226. }
  2227. function s7(t7, e8, n10, l8) {
  2228. if (!r2(t7) || !r2(e8))
  2229. return;
  2230. const { min: s9, max: a11 } = l8, o5 = t7.pixels[0], { pixels: r11, mask: c7 } = e8, h5 = r11[0], f7 = 255.00001 / (a11 - s9), u6 = new Uint8ClampedArray(h5.length), p8 = new Uint8ClampedArray(h5.length), x4 = new Uint8ClampedArray(h5.length), d4 = n10.length - 1;
  2231. for (let i7 = 0; i7 < h5.length; i7++) {
  2232. if (c7 && 0 === c7[i7])
  2233. continue;
  2234. const t8 = Math.floor((h5[i7] - s9) * f7), [e9, l9] = n10[t8 < 0 ? 0 : t8 > d4 ? d4 : t8], a12 = o5[i7], r12 = a12 * l9, m5 = r12 * (1 - Math.abs(e9 % 2 - 1)), w5 = a12 - r12;
  2235. switch (Math.floor(e9)) {
  2236. case 0:
  2237. u6[i7] = r12 + w5, p8[i7] = m5 + w5, x4[i7] = w5;
  2238. break;
  2239. case 1:
  2240. u6[i7] = m5 + w5, p8[i7] = r12 + w5, x4[i7] = w5;
  2241. break;
  2242. case 2:
  2243. u6[i7] = w5, p8[i7] = r12 + w5, x4[i7] = m5 + w5;
  2244. break;
  2245. case 3:
  2246. u6[i7] = w5, p8[i7] = m5 + w5, x4[i7] = r12 + w5;
  2247. break;
  2248. case 4:
  2249. u6[i7] = m5 + w5, p8[i7] = w5, x4[i7] = r12 + w5;
  2250. break;
  2251. case 5:
  2252. case 6:
  2253. u6[i7] = r12 + w5, p8[i7] = w5, x4[i7] = m5 + w5;
  2254. }
  2255. }
  2256. t7.pixels = [u6, p8, x4], t7.updateStatistics();
  2257. }
  2258. function a9(n10, l8) {
  2259. var _a, _b;
  2260. if (!r2(n10))
  2261. return n10;
  2262. const s9 = l8.zFactor, a11 = (_a = l8.pixelSizePower) != null ? _a : 1, o5 = (_b = l8.pixelSizeFactor) != null ? _b : 1, r11 = l8.slopeType, c7 = l8.isGCS, { width: h5, height: f7, mask: u6 } = n10, p8 = n10.pixels[0], x4 = new Uint8Array(h5 * f7);
  2263. let d4 = 1;
  2264. if (r(u6)) {
  2265. for (let t7 = 0; t7 < u6.length; t7++)
  2266. if (u6[t7]) {
  2267. d4 = u6[t7];
  2268. break;
  2269. }
  2270. x4.set(u6);
  2271. }
  2272. const m5 = new Float32Array(h5 * f7), { x: w5, y: y6 } = l8.resolution;
  2273. let M3 = s9 / (8 * w5), A3 = s9 / (8 * y6);
  2274. if (c7 && Math.abs(s9 - 1) < 1e-4 && (M3 /= 111e3, A3 /= 111e3), "adjusted" === r11)
  2275. if (c7) {
  2276. const t7 = 111e3 * w5, e8 = 111e3 * y6;
  2277. M3 = (s9 + t7 ** a11 * o5) / (8 * t7), A3 = (s9 + e8 ** a11 * o5) / (8 * e8);
  2278. } else
  2279. M3 = (s9 + w5 ** a11 * o5) / (8 * w5), A3 = (s9 + y6 ** a11 * o5) / (8 * y6);
  2280. const g6 = 1;
  2281. let k5, P3, Z, C4, F2, b3, z2, T4;
  2282. const U3 = r(u6);
  2283. for (let t7 = g6; t7 < f7 - g6; t7++) {
  2284. const e8 = t7 * h5;
  2285. for (let t8 = g6; t8 < h5 - g6; t8++) {
  2286. if (u6 && !u6[e8 + t8]) {
  2287. m5[e8 + t8] = 0;
  2288. continue;
  2289. }
  2290. let i7 = 0;
  2291. if (U3 && (i7 = (u6[e8 - h5 + t8 - 1] + u6[e8 - h5 + t8] + u6[e8 - h5 + t8 + 1] + u6[e8 + t8 - 1] + u6[e8 + t8 + 1] + u6[e8 + h5 + t8 - 1] + u6[e8 + h5 + t8] + u6[e8 + h5 + t8 + 1]) / d4, i7 < 7)) {
  2292. m5[e8 + t8] = 0, x4[e8 + t8] = 0;
  2293. continue;
  2294. }
  2295. u6 && 7 === i7 ? (k5 = u6[e8 - h5 + t8 - 1] ? p8[e8 - h5 + t8 - 1] : p8[e8 + t8], P3 = u6[e8 - h5 + t8] ? p8[e8 - h5 + t8] : p8[e8 + t8], Z = u6[e8 - h5 + t8 + 1] ? p8[e8 - h5 + t8 + 1] : p8[e8 + t8], C4 = u6[e8 + t8 - 1] ? p8[e8 + t8 - 1] : p8[e8 + t8], F2 = u6[e8 + t8 + 1] ? p8[e8 + t8 + 1] : p8[e8 + t8], b3 = u6[e8 + h5 + t8 - 1] ? p8[e8 + h5 + t8 - 1] : p8[e8 + t8], z2 = u6[e8 + h5 + t8] ? p8[e8 + h5 + t8] : p8[e8 + t8], T4 = u6[e8 + h5 + t8 + 1] ? p8[e8 + h5 + t8 + 1] : p8[e8 + t8]) : (k5 = p8[e8 - h5 + t8 - 1], P3 = p8[e8 - h5 + t8], Z = p8[e8 - h5 + t8 + 1], C4 = p8[e8 + t8 - 1], F2 = p8[e8 + t8 + 1], b3 = p8[e8 + h5 + t8 - 1], z2 = p8[e8 + h5 + t8], T4 = p8[e8 + h5 + t8 + 1]);
  2296. const n11 = (Z + F2 + F2 + T4 - (k5 + C4 + C4 + b3)) * M3, l9 = (b3 + z2 + z2 + T4 - (k5 + P3 + P3 + Z)) * A3, s10 = Math.sqrt(n11 * n11 + l9 * l9);
  2297. m5[e8 + t8] = "percent-rise" === r11 ? 100 * s10 : 57.2957795 * Math.atan(s10);
  2298. }
  2299. }
  2300. for (let t7 = 0; t7 < f7; t7++)
  2301. m5[t7 * h5] = m5[t7 * h5 + 1], m5[(t7 + 1) * h5 - 1] = m5[(t7 + 1) * h5 - 2];
  2302. for (let t7 = 1; t7 < h5 - 1; t7++)
  2303. m5[t7] = m5[t7 + h5], m5[t7 + (f7 - 1) * h5] = m5[t7 + (f7 - 2) * h5];
  2304. return new g({ width: h5, height: f7, pixels: [m5], mask: u6 ? x4 : null, pixelType: "f32", validPixelCount: n10.validPixelCount, statistics: [{ minValue: 0, maxValue: "percent-rise" === r11 ? 100 : 360 }] });
  2305. }
  2306. function o4(n10, l8 = {}) {
  2307. if (!r2(n10))
  2308. return n10;
  2309. const { width: s9, height: a11, mask: o5 } = n10, r11 = n10.pixels[0], c7 = new Uint8Array(s9 * a11);
  2310. r(o5) && c7.set(o5);
  2311. const h5 = new Float32Array(s9 * a11), { resolution: f7 } = l8, u6 = f7 ? 1 / f7.x : 1, p8 = f7 ? 1 / f7.y : 1, x4 = 1;
  2312. let d4, m5, w5, y6, M3, A3, g6, k5;
  2313. const P3 = r(o5);
  2314. for (let t7 = x4; t7 < a11 - x4; t7++) {
  2315. const e8 = t7 * s9;
  2316. for (let t8 = x4; t8 < s9 - x4; t8++) {
  2317. if (o5 && !o5[e8 + t8]) {
  2318. h5[e8 + t8] = 0;
  2319. continue;
  2320. }
  2321. let i7 = 0;
  2322. if (P3 && (i7 = o5[e8 - s9 + t8 - 1] + o5[e8 - s9 + t8] + o5[e8 - s9 + t8 + 1] + o5[e8 + t8 - 1] + o5[e8 + t8 + 1] + o5[e8 + s9 + t8 - 1] + o5[e8 + s9 + t8] + o5[e8 + s9 + t8 + 1], i7 < 7)) {
  2323. h5[e8 + t8] = 0, c7[e8 + t8] = 0;
  2324. continue;
  2325. }
  2326. o5 && 7 === i7 ? (d4 = o5[e8 - s9 + t8 - 1] ? r11[e8 - s9 + t8 - 1] : r11[e8 + t8], m5 = o5[e8 - s9 + t8] ? r11[e8 - s9 + t8] : r11[e8 + t8], w5 = o5[e8 - s9 + t8 + 1] ? r11[e8 - s9 + t8 + 1] : r11[e8 + t8], y6 = o5[e8 + t8 - 1] ? r11[e8 + t8 - 1] : r11[e8 + t8], M3 = o5[e8 + t8 + 1] ? r11[e8 + t8 + 1] : r11[e8 + t8], A3 = o5[e8 + s9 + t8 - 1] ? r11[e8 + s9 + t8 - 1] : r11[e8 + t8], g6 = o5[e8 + s9 + t8] ? r11[e8 + s9 + t8] : r11[e8 + t8], k5 = o5[e8 + s9 + t8 + 1] ? r11[e8 + s9 + t8 + 1] : r11[e8 + t8]) : (d4 = r11[e8 - s9 + t8 - 1], m5 = r11[e8 - s9 + t8], w5 = r11[e8 - s9 + t8 + 1], y6 = r11[e8 + t8 - 1], M3 = r11[e8 + t8 + 1], A3 = r11[e8 + s9 + t8 - 1], g6 = r11[e8 + s9 + t8], k5 = r11[e8 + s9 + t8 + 1]);
  2327. const n11 = (w5 + M3 + M3 + k5 - (d4 + y6 + y6 + A3)) * u6, l9 = (A3 + g6 + g6 + k5 - (d4 + m5 + m5 + w5)) * p8;
  2328. let a12 = -1;
  2329. 0 === n11 && 0 === l9 || (a12 = 90 - 57.29578 * Math.atan2(l9, -n11), a12 < 0 && (a12 += 360), 360 === a12 ? a12 = 0 : a12 > 360 && (a12 %= 360)), h5[e8 + t8] = a12;
  2330. }
  2331. }
  2332. for (let t7 = 0; t7 < a11; t7++)
  2333. h5[t7 * s9] = h5[t7 * s9 + 1], h5[(t7 + 1) * s9 - 1] = h5[(t7 + 1) * s9 - 2];
  2334. for (let t7 = 1; t7 < s9 - 1; t7++)
  2335. h5[t7] = h5[t7 + s9], h5[t7 + (a11 - 1) * s9] = h5[t7 + (a11 - 2) * s9];
  2336. return new g({ width: s9, height: a11, pixels: [h5], mask: o5 ? c7 : null, pixelType: "f32", validPixelCount: n10.validPixelCount, statistics: [{ minValue: 0, maxValue: 360 }] });
  2337. }
  2338. // node_modules/@arcgis/core/renderers/support/colorRampUtils.js
  2339. var i6 = [{ id: "aspect_predefined", type: "multipart", colorRamps: [{ fromColor: [190, 190, 190], toColor: [255, 45, 8] }, { fromColor: [255, 45, 8], toColor: [255, 181, 61] }, { fromColor: [255, 181, 61], toColor: [255, 254, 52] }, { fromColor: [255, 254, 52], toColor: [0, 251, 50] }, { fromColor: [0, 251, 50], toColor: [255, 254, 52] }, { fromColor: [0, 253, 255], toColor: [0, 181, 255] }, { fromColor: [0, 181, 255], toColor: [26, 35, 253] }, { fromColor: [26, 35, 253], toColor: [255, 57, 251] }, { fromColor: [255, 57, 251], toColor: [255, 45, 8] }] }, { id: "blackToWhite_predefined", fromColor: [0, 0, 0], toColor: [255, 255, 255] }, { id: "blueBright_predefined", fromColor: [204, 204, 255], toColor: [0, 0, 224] }, { id: "blueLightToDark_predefined", fromColor: [211, 229, 232], toColor: [46, 100, 140] }, { id: "blueGreenBright_predefined", fromColor: [203, 245, 234], toColor: [48, 207, 146] }, { id: "blueGreenLightToDark_predefined", fromColor: [216, 242, 237], toColor: [21, 79, 74] }, { id: "brownLightToDark_predefined", fromColor: [240, 236, 170], toColor: [102, 72, 48] }, { id: "brownToBlueGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [156, 85, 31], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [33, 130, 145] }] }, { id: "brownToBlueGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [110, 70, 45], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [48, 100, 102] }] }, { id: "coefficientBias_predefined", fromColor: [214, 214, 255], toColor: [0, 57, 148] }, { id: "coldToHotDiverging_predefined", type: "multipart", colorRamps: [{ fromColor: [69, 117, 181], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [214, 47, 39] }] }, { id: "conditionNumber_predefined", type: "multipart", colorRamps: [{ fromColor: [0, 97, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 34, 0] }] }, { id: "cyanToPurple_predefined", type: "multipart", colorRamps: [{ fromColor: [0, 245, 245], toColor: [0, 0, 245] }, { fromColor: [0, 0, 245], toColor: [245, 0, 245] }] }, { id: "cyanLightToBlueDark_predefined", type: "multipart", colorRamps: [{ fromColor: [182, 237, 240], toColor: [31, 131, 224] }, { fromColor: [31, 131, 224], toColor: [9, 9, 145] }] }, { id: "distance_predefined", fromColor: [255, 200, 0], toColor: [0, 0, 255] }, { id: "elevation1_predefined", type: "multipart", colorRamps: [{ fromColor: [175, 240, 233], toColor: [255, 255, 179] }, { fromColor: [255, 255, 179], toColor: [0, 128, 64] }, { fromColor: [0, 128, 64], toColor: [252, 186, 3] }, { fromColor: [252, 186, 3], toColor: [128, 0, 0] }, { fromColor: [120, 0, 0], toColor: [105, 48, 13] }, { fromColor: [105, 48, 13], toColor: [171, 171, 171] }, { fromColor: [171, 171, 171], toColor: [255, 252, 255] }] }, { id: "elevation2_predefined", type: "multipart", colorRamps: [{ fromColor: [118, 219, 211], toColor: [255, 255, 199] }, { fromColor: [255, 255, 199], toColor: [255, 255, 128] }, { fromColor: [255, 255, 128], toColor: [217, 194, 121] }, { fromColor: [217, 194, 121], toColor: [135, 96, 38] }, { fromColor: [135, 96, 38], toColor: [150, 150, 181] }, { fromColor: [150, 150, 181], toColor: [181, 150, 181] }, { fromColor: [181, 150, 181], toColor: [255, 252, 255] }] }, { id: "errors_predefined", fromColor: [255, 235, 214], toColor: [196, 10, 10] }, { id: "grayLightToDark_predefined", fromColor: [219, 219, 219], toColor: [69, 69, 69] }, { id: "greenBright_predefined", fromColor: [204, 255, 204], toColor: [14, 204, 14] }, { id: "greenLightToDark_predefined", fromColor: [220, 245, 233], toColor: [34, 102, 51] }, { id: "greenToBlue_predefined", type: "multipart", colorRamps: [{ fromColor: [32, 204, 16], toColor: [0, 242, 242] }, { fromColor: [0, 242, 242], toColor: [2, 33, 227] }] }, { id: "orangeBright_predefined", fromColor: [255, 235, 204], toColor: [240, 118, 5] }, { id: "orangeLightToDark_predefined", fromColor: [250, 233, 212], toColor: [171, 65, 36] }, { id: "partialSpectrum_predefined", type: "multipart", colorRamps: [{ fromColor: [242, 241, 162], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 0, 0] }, { fromColor: [252, 3, 69], toColor: [176, 7, 237] }, { fromColor: [176, 7, 237], toColor: [2, 29, 173] }] }, { id: "partialSpectrum1Diverging_predefined", type: "multipart", colorRamps: [{ fromColor: [135, 38, 38], toColor: [240, 149, 12] }, { fromColor: [240, 149, 12], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [74, 80, 181] }, { fromColor: [74, 80, 181], toColor: [39, 32, 122] }] }, { id: "partialSpectrum2Diverging_predefined", type: "multipart", colorRamps: [{ fromColor: [115, 77, 42], toColor: [201, 137, 52] }, { fromColor: [201, 137, 52], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [91, 63, 176] }, { fromColor: [91, 63, 176], toColor: [81, 13, 97] }] }, { id: "pinkToYellowGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [158, 30, 113], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [99, 110, 45] }] }, { id: "pinkToYellowGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [97, 47, 73], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [22, 59, 15] }] }, { id: "precipitation_predefined", type: "multipart", colorRamps: [{ fromColor: [194, 82, 60], toColor: [237, 161, 19] }, { fromColor: [237, 161, 19], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [0, 219, 0] }, { fromColor: [0, 219, 0], toColor: [32, 153, 143] }, { fromColor: [32, 153, 143], toColor: [11, 44, 122] }] }, { id: "prediction_predefined", type: "multipart", colorRamps: [{ fromColor: [40, 146, 199], toColor: [250, 250, 100] }, { fromColor: [250, 250, 100], toColor: [232, 16, 20] }] }, { id: "purpleBright_predefined", fromColor: [255, 204, 255], toColor: [199, 0, 199] }, { id: "purpleToGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [77, 32, 150], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [20, 122, 11] }] }, { id: "purpleToGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [67, 14, 89], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [24, 79, 15] }] }, { id: "purpleBlueBright_predefined", fromColor: [223, 184, 230], toColor: [112, 12, 242] }, { id: "purpleBlueLightToDark_predefined", fromColor: [229, 213, 242], toColor: [93, 44, 112] }, { id: "purpleRedBright_predefined", fromColor: [255, 204, 225], toColor: [199, 0, 99] }, { id: "purpleRedLightToDark_predefined", fromColor: [250, 215, 246], toColor: [143, 17, 57] }, { id: "redBright_predefined", fromColor: [255, 204, 204], toColor: [219, 0, 0] }, { id: "redLightToDark_predefined", fromColor: [255, 224, 224], toColor: [143, 10, 10] }, { id: "redToBlueDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [196, 69, 57], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [48, 95, 207] }] }, { id: "redToBlueDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [107, 13, 13], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [13, 53, 97] }] }, { id: "redToGreen_predefined", type: "multipart", colorRamps: [{ fromColor: [245, 0, 0], toColor: [245, 245, 0] }, { fromColor: [245, 245, 0], toColor: [0, 245, 0] }] }, { id: "redToGreenDivergingBright_predefined", type: "multipart", colorRamps: [{ fromColor: [186, 20, 20], toColor: [255, 255, 191] }, { fromColor: [255, 255, 191], toColor: [54, 145, 33] }] }, { id: "redToGreenDivergingDark_predefined", type: "multipart", colorRamps: [{ fromColor: [97, 21, 13], toColor: [204, 204, 102] }, { fromColor: [204, 204, 102], toColor: [16, 69, 16] }] }, { id: "slope_predefined", type: "multipart", colorRamps: [{ fromColor: [56, 168, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 0, 0] }] }, { id: "spectrumFullBright_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 0, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [0, 255, 255] }, { fromColor: [0, 255, 255], toColor: [0, 0, 255] }] }, { id: "spectrumFullDark_predefined", type: "multipart", colorRamps: [{ fromColor: [153, 0, 0], toColor: [153, 153, 0] }, { fromColor: [153, 153, 0], toColor: [0, 153, 153] }, { fromColor: [0, 153, 153], toColor: [0, 0, 153] }] }, { id: "spectrumFullLight_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 153, 153], toColor: [255, 255, 153] }, { fromColor: [255, 255, 153], toColor: [153, 255, 255] }, { fromColor: [153, 255, 255], toColor: [153, 153, 255] }] }, { id: "surface_predefined", type: "multipart", colorRamps: [{ fromColor: [112, 153, 89], toColor: [242, 238, 162] }, { fromColor: [242, 238, 162], toColor: [242, 206, 133] }, { fromColor: [242, 206, 133], toColor: [194, 140, 124] }, { fromColor: [194, 140, 124], toColor: [255, 242, 255] }] }, { id: "temperature_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 252, 255], toColor: [255, 0, 255] }, { fromColor: [255, 0, 255], toColor: [0, 0, 255] }, { fromColor: [0, 0, 255], toColor: [0, 255, 255] }, { fromColor: [0, 255, 255], toColor: [0, 255, 0] }, { fromColor: [0, 255, 0], toColor: [255, 255, 0] }, { fromColor: [255, 255, 0], toColor: [255, 128, 0] }, { fromColor: [255, 128, 0], toColor: [128, 0, 0] }] }, { id: "whiteToBlack_predefined", fromColor: [255, 255, 255], toColor: [0, 0, 0] }, { id: "yellowToDarkRed_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 255, 128], toColor: [242, 167, 46] }, { fromColor: [242, 167, 46], toColor: [107, 0, 0] }] }, { id: "yellowToGreenToDarkBlue_predefined", type: "multipart", colorRamps: [{ fromColor: [255, 255, 128], toColor: [56, 224, 9] }, { fromColor: [56, 224, 9], toColor: [26, 147, 171] }, { fromColor: [26, 147, 171], toColor: [12, 16, 120] }] }, { id: "yellowToRed_predefined", fromColor: [245, 245, 0], toColor: [255, 0, 0] }, { id: "yellowGreenBright_predefined", fromColor: [236, 252, 204], toColor: [157, 204, 16] }, { id: "yellowGreenLightToDark_predefined", fromColor: [215, 240, 175], toColor: [96, 107, 45] }];
  2340. var n9 = { aspect_predefined: "Aspect", blackToWhite_predefined: "Black to White", blueBright_predefined: "Blue Bright", blueLightToDark_predefined: "Blue Light to Dark", blueGreenBright_predefined: "Blue-Green Bright", blueGreenLightToDark_predefined: "Blue-Green Light to Dark", brownLightToDark_predefined: "Brown Light to Dark", brownToBlueGreenDivergingBright_predefined: "Brown to Blue Green Diverging, Bright", brownToBlueGreenDivergingDark_predefined: "Brown to Blue Green Diverging, Dark", coefficientBias_predefined: "Coefficient Bias", coldToHotDiverging_predefined: "Cold to Hot Diverging", conditionNumber_predefined: "Condition Number", cyanToPurple_predefined: "Cyan to Purple", cyanLightToBlueDark_predefined: "Cyan-Light to Blue-Dark", distance_predefined: "Distance", elevation1_predefined: "Elevation #1", elevation2_predefined: "Elevation #2", errors_predefined: "Errors", grayLightToDark_predefined: "Gray Light to Dark", greenBright_predefined: "Green Bright", greenLightToDark_predefined: "Green Light to Dark", greenToBlue_predefined: "Green to Blue", orangeBright_predefined: "Orange Bright", orangeLightToDark_predefined: "Orange Light to Dark", partialSpectrum_predefined: "Partial Spectrum", partialSpectrum1Diverging_predefined: "Partial Spectrum 1 Diverging", partialSpectrum2Diverging_predefined: "Partial Spectrum 2 Diverging", pinkToYellowGreenDivergingBright_predefined: "Pink to YellowGreen Diverging, Bright", pinkToYellowGreenDivergingDark_predefined: "Pink to YellowGreen Diverging, Dark", precipitation_predefined: "Precipitation", prediction_predefined: "Prediction", purpleBright_predefined: "Purple Bright", purpleToGreenDivergingBright_predefined: "Purple to Green Diverging, Bright", purpleToGreenDivergingDark_predefined: "Purple to Green Diverging, Dark", purpleBlueBright_predefined: "Purple-Blue Bright", purpleBlueLightToDark_predefined: "Purple-Blue Light to Dark", purpleRedBright_predefined: "Purple-Red Bright", purpleRedLightToDark_predefined: "Purple-Red Light to Dark", redBright_predefined: "Red Bright", redLightToDark_predefined: "Red Light to Dark", redToBlueDivergingBright_predefined: "Red to Blue Diverging, Bright", redToBlueDivergingDark_predefined: "Red to Blue Diverging, Dark", redToGreen_predefined: "Red to Green", redToGreenDivergingBright_predefined: "Red to Green Diverging, Bright", redToGreenDivergingDark_predefined: "Red to Green Diverging, Dark", slope_predefined: "Slope", spectrumFullBright_predefined: "Spectrum-Full Bright", spectrumFullDark_predefined: "Spectrum-Full Dark", spectrumFullLight_predefined: "Spectrum-Full Light", surface_predefined: "Surface", temperature_predefined: "Temperature", whiteToBlack_predefined: "White to Black", yellowToDarkRed_predefined: "Yellow to Dark Red", yellowToGreenToDarkBlue_predefined: "Yellow to Green to Dark Blue", yellowToRed_predefined: "Yellow to Red", yellowGreenBright_predefined: "Yellow-Green Bright", yellowGreenLightToDark_predefined: "Yellow-Green Light to Dark" };
  2341. function d3(o5, r11) {
  2342. if (!o5 || !r11 || o5.length !== r11.length)
  2343. return false;
  2344. for (let e8 = 0; e8 < o5.length; e8++)
  2345. if (o5[e8] > r11[e8] + 2 || o5[e8] < r11[e8] - 2)
  2346. return false;
  2347. return true;
  2348. }
  2349. function p7(r11, e8) {
  2350. if (!r11)
  2351. return;
  2352. const t7 = e8 || i6;
  2353. let l8 = null;
  2354. return "algorithmic" === r11.type ? t7.some((o5) => {
  2355. if (d3(r11.fromColor.toRgb(), o5.fromColor) && d3(r11.toColor.toRgb(), o5.toColor))
  2356. return l8 = o5.id, true;
  2357. }) : "multipart" === r11.type && t7.some((e9) => {
  2358. const t8 = r11.colorRamps, i7 = e9.colorRamps;
  2359. if (t8 && i7 && t8.length === i7.length && !i7.some((r12, e10) => {
  2360. if (!d3(t8[e10].fromColor.toRgb(), new l2(r12.fromColor).toRgb()) || !d3(t8[e10].toColor.toRgb(), new l2(r12.toColor).toRgb()))
  2361. return true;
  2362. })) {
  2363. if (l8)
  2364. return true;
  2365. l8 = e9.id;
  2366. }
  2367. }), l8;
  2368. }
  2369. function f6(o5) {
  2370. const r11 = p7(o5);
  2371. return r11 ? n9[r11] : null;
  2372. }
  2373. function C3(o5) {
  2374. const r11 = (o5 = o5 || {}).numColors || 256, e8 = o5.distanceOffset || 0, t7 = null != o5.isCustomInterval ? o5.isCustomInterval : null !== o5.distanceInterval && o5.distanceInterval !== 1 / (r11 - 1), l8 = o5.distanceInterval || 1 / (r11 - 1);
  2375. return { ...o5, numColors: r11, distanceOffset: e8, interpolateAlpha: !!o5.interpolateAlpha, distanceInterval: l8, isCustomInterval: t7, weights: o5.weights };
  2376. }
  2377. function a10(o5, r11, e8) {
  2378. const { numColors: t7, distanceOffset: l8, distanceInterval: i7, isCustomInterval: n10 } = C3(e8), d4 = 0 === o5.s, p8 = 0 === r11.s;
  2379. let f7 = o5.h, a11 = r11.h;
  2380. d4 && !p8 ? f7 = a11 : p8 && !d4 && (r11 = { ...r11, h: f7 }, a11 = f7);
  2381. let m5, u6 = Math.abs(a11 - f7);
  2382. const g6 = 360;
  2383. u6 < g6 / 2 ? m5 = (a11 - f7) * i7 : (u6 = g6 - u6, m5 = f7 > a11 ? u6 * i7 : -u6 * i7);
  2384. const s9 = (r11.s - o5.s) * i7, c7 = (r11.v - o5.v) * i7;
  2385. let { s: h5, v: _3 } = o5, D4 = f7;
  2386. if (l8) {
  2387. const o6 = l8 / i7;
  2388. D4 = (D4 + o6 * m5 + g6) % g6, h5 += o6 * s9, _3 += o6 * c7;
  2389. }
  2390. const B2 = [];
  2391. for (let C4 = 0; C4 < t7 - 1; C4++)
  2392. B2.push({ h: D4, s: h5, v: _3 }), D4 = (D4 + m5 + g6) % g6, h5 += s9, _3 += c7;
  2393. return B2.push(n10 ? { h: D4, s: h5, v: _3 } : r11), B2;
  2394. }
  2395. function m4(o5, r11, e8) {
  2396. const { numColors: t7, distanceOffset: l8, distanceInterval: i7, isCustomInterval: n10 } = C3(e8);
  2397. let { l: d4, a: p8, b: f7 } = o5;
  2398. const a11 = (r11.l - d4) * i7, m5 = (r11.a - p8) * i7, u6 = (r11.b - f7) * i7, g6 = [];
  2399. if (l8) {
  2400. const o6 = l8 / i7;
  2401. d4 += o6 * a11, p8 += o6 * m5, f7 += o6 * u6;
  2402. }
  2403. for (let C4 = 0; C4 < t7 - 1; C4++)
  2404. g6.push({ l: d4, a: p8, b: f7 }), d4 += a11, p8 += m5, f7 += u6;
  2405. return g6.push(n10 ? { l: d4, a: p8, b: f7 } : r11), g6;
  2406. }
  2407. function u5(o5, r11, e8) {
  2408. const { numColors: t7, distanceOffset: l8, distanceInterval: i7, isCustomInterval: n10 } = C3(e8), d4 = o5.h, p8 = r11.h, f7 = 2 * Math.PI;
  2409. let a11;
  2410. if (d4 <= p8) {
  2411. const o6 = p8 - d4, r12 = p8 - d4 - f7;
  2412. a11 = Math.abs(r12) < Math.abs(o6) ? r12 : o6;
  2413. } else {
  2414. const o6 = p8 + f7 - d4, r12 = p8 - d4;
  2415. a11 = Math.abs(r12) < Math.abs(o6) ? r12 : o6;
  2416. }
  2417. const m5 = a11 * i7, u6 = (r11.l - o5.l) * i7, g6 = (r11.c - o5.c) * i7;
  2418. let { l: s9, c: c7, h: h5 } = o5;
  2419. if (l8) {
  2420. const o6 = l8 / i7;
  2421. s9 += o6 * u6, c7 += o6 * g6, h5 = (h5 + o6 * m5 + f7) % f7;
  2422. }
  2423. const _3 = [];
  2424. for (let C4 = 0; C4 < t7 - 1; C4++)
  2425. _3.push({ l: s9, c: c7, h: h5 }), s9 += u6, c7 += g6, h5 = (h5 + m5 + f7) % f7;
  2426. return _3.push(n10 ? { l: s9, c: c7, h: h5 } : r11), _3;
  2427. }
  2428. function g5(o5, i7) {
  2429. var _a, _b;
  2430. let { fromColor: n10, toColor: d4 } = o5;
  2431. 3 === n10.length && (n10 = n10.concat([255])), 3 === d4.length && (d4 = d4.concat([255]));
  2432. const p8 = o5.algorithm || "esriCIELabAlgorithm", { numColors: f7, distanceOffset: g6, isCustomInterval: s9, interpolateAlpha: c7 } = C3(i7);
  2433. if (1 === f7 && 0 === g6)
  2434. return [n10];
  2435. if (2 === f7 && 0 === g6 && !s9)
  2436. return [n10, d4];
  2437. const h5 = { r: n10[0], g: n10[1], b: n10[2] }, _3 = { r: d4[0], g: d4[1], b: d4[2] }, D4 = "esriCIELabAlgorithm" === p8 ? m4(z(h5), z(_3), i7) : "esriHSVAlgorithm" === p8 ? a10(y3(h5), y3(_3), i7) : u5(v(h5), v(_3), i7), B2 = [], k5 = (_a = n10[3]) != null ? _a : 255, v4 = (((_b = d4[3]) != null ? _b : 255) - k5) / (f7 - 1);
  2438. for (let r11 = 0; r11 < f7; r11++) {
  2439. const { r: o6, g: e8, b: t7 } = p3(D4[r11]), i8 = c7 ? Math.round(k5 + v4 * r11) : 255;
  2440. B2.push([o6, e8, t7, i8]);
  2441. }
  2442. return B2;
  2443. }
  2444. function s8(o5, r11) {
  2445. const { numColors: e8, interpolateAlpha: t7 } = C3(r11);
  2446. let l8 = r11 == null ? void 0 : r11.weights;
  2447. const { colorRamps: i7 } = o5;
  2448. if (l8) {
  2449. const o6 = l8.reduce((o7, r12) => o7 + r12);
  2450. l8 = l8.map((r12) => r12 / o6);
  2451. } else {
  2452. l8 = [];
  2453. for (let o6 = 0; o6 < i7.length; o6++)
  2454. l8[o6] = 1 / i7.length;
  2455. }
  2456. const n10 = [];
  2457. let d4 = 0, p8 = 0;
  2458. const f7 = 1 / (e8 - 1);
  2459. let a11 = false;
  2460. for (let C4 = 0; C4 < i7.length; C4++) {
  2461. let o6 = a11 ? 0 : d4 * f7 - p8, r12 = C4 === i7.length - 1 ? e8 - 1 - d4 : (l8[C4] - o6) / f7;
  2462. if (a11 = Math.ceil(r12) === r12, r12 = Math.ceil(r12), 0 === r12)
  2463. continue;
  2464. o6 /= l8[C4];
  2465. const m6 = g5(i7[C4], { numColors: r12, interpolateAlpha: t7, distanceOffset: o6, distanceInterval: f7 / l8[C4] });
  2466. d4 += m6.length, n10.push(...m6), p8 += l8[C4];
  2467. }
  2468. const m5 = [...i7[i7.length - 1].toColor];
  2469. return 3 === m5.length && m5.push(255), n10.push(m5), n10;
  2470. }
  2471. function c6(o5, r11 = 256, e8 = false) {
  2472. const t7 = "toJSON" in o5 ? o5.toJSON() : o5, l8 = { numColors: r11, interpolateAlpha: e8 };
  2473. return "multipart" === t7.type ? s8(t7, l8) : g5(t7, l8);
  2474. }
  2475. function h4(o5, r11 = 256, e8 = false) {
  2476. const t7 = c6(o5, r11, e8);
  2477. return t7.forEach((o6, r12) => {
  2478. o6.unshift(r12), e8 || o6.pop();
  2479. }), t7;
  2480. }
  2481. function _(o5) {
  2482. const r11 = f6(o5);
  2483. if (o5) {
  2484. if ("algorithmic" === o5.type)
  2485. return { ...D3(o5), Name: r11 };
  2486. if (o5.colorRamps) {
  2487. const e8 = o5.colorRamps.map(D3);
  2488. return { type: "MultiPartColorRamp", NumColorRamps: e8.length, ArrayOfColorRamp: e8, Name: r11 };
  2489. }
  2490. }
  2491. }
  2492. function D3(o5) {
  2493. var _a;
  2494. if (!o5)
  2495. return;
  2496. return { Algorithm: ((_a = o5.toJSON()) == null ? void 0 : _a.Algorithm) || "esriHSVAlgorithm", type: "AlgorithmicColorRamp", FromColor: B(o5.fromColor), ToColor: B(o5.toColor) };
  2497. }
  2498. function B(o5) {
  2499. const e8 = y3(o5);
  2500. return { type: "HsvColor", Hue: e8.h, Saturation: e8.s, Value: e8.v, AlphaValue: 255 };
  2501. }
  2502. function k4(o5) {
  2503. const r11 = o5.reverse().map((o6) => {
  2504. const r12 = o6.toString(16);
  2505. return r12.length < 2 ? "0" + r12 : r12;
  2506. });
  2507. return 4294967295 & Number.parseInt(r11.join(""), 16);
  2508. }
  2509. // node_modules/@arcgis/core/renderers/support/RasterSymbolizer.js
  2510. function L2(e8, t7) {
  2511. const { attributeTable: r11, bandCount: s9 } = e8;
  2512. if (t(r11) || s9 > 1)
  2513. return false;
  2514. if (t7) {
  2515. if (null == r11.fields.find((e9) => e9.name.toLowerCase() === t7.toLowerCase()))
  2516. return false;
  2517. }
  2518. return true;
  2519. }
  2520. function _2(e8) {
  2521. const { bandCount: t7, dataType: r11, pixelType: s9 } = e8;
  2522. return "elevation" === r11 || "generic" === r11 && 1 === t7 && ("s16" === s9 || "f32" === s9 || "f64" === s9);
  2523. }
  2524. function V(e8) {
  2525. const { bandCount: t7, colormap: r11 } = e8;
  2526. return r(r11) && r11.length > 0 && 1 === t7;
  2527. }
  2528. var v3 = class extends l {
  2529. constructor(e8) {
  2530. super(e8);
  2531. }
  2532. bind() {
  2533. const { rendererJSON: e8 } = this;
  2534. if (!e8)
  2535. return { success: false };
  2536. let t7;
  2537. switch (this.lookup = { rendererJSON: {} }, e8.type) {
  2538. case "uniqueValue":
  2539. t7 = this._updateUVRenderer(e8);
  2540. break;
  2541. case "rasterColormap":
  2542. t7 = this._updateColormapRenderer(e8);
  2543. break;
  2544. case "rasterStretch":
  2545. t7 = this._updateStretchRenderer(e8);
  2546. break;
  2547. case "classBreaks":
  2548. t7 = this._updateClassBreaksRenderer(e8);
  2549. break;
  2550. case "rasterShadedRelief":
  2551. t7 = this._updateShadedReliefRenderer(e8);
  2552. break;
  2553. case "vectorField":
  2554. t7 = this._updateVectorFieldRenderer();
  2555. break;
  2556. case "flowRenderer":
  2557. t7 = this._updateFlowRenderer();
  2558. }
  2559. return t7;
  2560. }
  2561. symbolize(e8) {
  2562. let t7 = e8 && e8.pixelBlock;
  2563. if (!O3(t7))
  2564. return t7;
  2565. if (e8.simpleStretchParams && "rasterStretch" === this.rendererJSON.type)
  2566. return this.simpleStretch(t7, e8.simpleStretchParams);
  2567. try {
  2568. let r11;
  2569. switch (t7.pixels.length > 3 && (t7 = s4(t7, [0, 1, 2])), this.rendererJSON.type) {
  2570. case "uniqueValue":
  2571. case "rasterColormap":
  2572. r11 = this._symbolizeColormap(t7);
  2573. break;
  2574. case "classBreaks":
  2575. r11 = this._symbolizeClassBreaks(t7);
  2576. break;
  2577. case "rasterStretch":
  2578. r11 = this._symbolizeStretch(t7, e8.bandIds);
  2579. break;
  2580. case "rasterShadedRelief": {
  2581. const s9 = e8.extent, a11 = s9.spatialReference.isGeographic, o5 = { x: (s9.xmax - s9.xmin) / t7.width, y: (s9.ymax - s9.ymin) / t7.height };
  2582. r11 = this._symbolizeShadedRelief(t7, { isGCS: a11, resolution: o5 });
  2583. break;
  2584. }
  2585. }
  2586. return r11;
  2587. } catch (r11) {
  2588. return s.getLogger(this.declaredClass).error("symbolize", r11.message), t7;
  2589. }
  2590. }
  2591. simpleStretch(e8, t7) {
  2592. if (!O3(e8))
  2593. return e8;
  2594. try {
  2595. return e8.pixels.length > 3 && (e8 = s4(e8, [0, 1, 2])), d2(e8, t7);
  2596. } catch (r11) {
  2597. return s.getLogger(this.declaredClass).error("symbolize", r11.message), e8;
  2598. }
  2599. }
  2600. generateWebGLParameters(e8) {
  2601. if (["uniqueValue", "rasterColormap", "classBreaks"].includes(this.rendererJSON.type)) {
  2602. const { indexedColormap: e9, offset: t8 } = this.lookup.colormapLut || {};
  2603. return { colormap: e9, colormapOffset: t8, type: "lut" };
  2604. }
  2605. const { pixelBlock: t7, isGCS: r11, resolution: s9, bandIds: a11 } = e8, { rendererJSON: o5 } = this;
  2606. return "rasterStretch" === o5.type ? this._generateStretchWebGLParams(t7, o5, a11) : "rasterShadedRelief" === o5.type ? this._generateShadedReliefWebGLParams(o5, r11, s9) : "vectorField" === o5.type ? this._generateVectorFieldWebGLParams(o5) : null;
  2607. }
  2608. _isLUTChanged(e8) {
  2609. if (!this.lookup || !this.lookup.rendererJSON)
  2610. return true;
  2611. if ("colorRamp" in this.rendererJSON) {
  2612. const t7 = this.rendererJSON.colorRamp;
  2613. return e8 ? JSON.stringify(t7) !== JSON.stringify(this.lookup.rendererJSON.colorRamp) : (this.rendererJSON, this.lookup.rendererJSON, JSON.stringify(this.rendererJSON) !== JSON.stringify(this.lookup.rendererJSON));
  2614. }
  2615. return JSON.stringify(this.rendererJSON) !== JSON.stringify(this.lookup.rendererJSON);
  2616. }
  2617. _symbolizeColormap(e8) {
  2618. if (this._isLUTChanged()) {
  2619. if (!this.bind().success)
  2620. return e8;
  2621. }
  2622. return f(e8, this.lookup.colormapLut);
  2623. }
  2624. _symbolizeClassBreaks(e8) {
  2625. var _a;
  2626. const { canUseIndexedLUT: t7 } = this._analyzeClassBreaks(this.rendererJSON);
  2627. if (this._isLUTChanged()) {
  2628. if (!this.bind().success)
  2629. return e8;
  2630. }
  2631. return t7 ? f(e8, this.lookup.colormapLut) : p2(e8, (_a = this.lookup.remapLut) != null ? _a : []);
  2632. }
  2633. _symbolizeStretch(e8, t7) {
  2634. var _a, _b, _c;
  2635. const { rasterInfo: r11 } = this, { pixelType: s9, bandCount: o5 } = r11, n10 = this.rendererJSON, i7 = ["u8", "u16", "s8", "s16"].includes(s9);
  2636. let l8, u6;
  2637. const { dra: c7 } = n10, { gamma: d4 } = this.lookup;
  2638. if ("histogramEqualization" === n10.stretchType) {
  2639. const s10 = c7 ? null : (_a = this.lookup) == null ? void 0 : _a.histogramLut, a11 = x3(n10, { rasterInfo: r11, pixelBlock: e8, bandIds: t7, returnHistogramLut: !s10 }), o6 = d2(e8, { ...a11, gamma: d4 });
  2640. u6 = c2(o6, { lut: c7 ? a11.histogramLut : s10, offset: 0 });
  2641. } else if (i7) {
  2642. if (c7) {
  2643. const a11 = x3(n10, { rasterInfo: r11, pixelBlock: e8, bandIds: t7 });
  2644. l8 = u3({ pixelType: s9, ...a11, gamma: d4 });
  2645. } else if (this._isLUTChanged()) {
  2646. if (!this.bind().success)
  2647. return e8;
  2648. l8 = this.lookup ? this.lookup.stretchLut : null;
  2649. } else
  2650. l8 = this.lookup ? this.lookup.stretchLut : null;
  2651. if (!l8)
  2652. return e8;
  2653. o5 > 1 && (t7 == null ? void 0 : t7.length) === ((_b = e2(e8)) == null ? void 0 : _b.pixels.length) && (l8 == null ? void 0 : l8.lut.length) === o5 && (l8 = { lut: t7.map((e9) => l8.lut[e9]), offset: l8.offset }), u6 = c2(e8, l8);
  2654. } else {
  2655. const s10 = x3(n10, { rasterInfo: r11, pixelBlock: e8, bandIds: t7 });
  2656. u6 = d2(e8, { ...s10, gamma: d4 });
  2657. }
  2658. if (n10.colorRamp) {
  2659. if (this._isLUTChanged(true)) {
  2660. if (!this.bind().success)
  2661. return e8;
  2662. }
  2663. u6 = f(u6, (_c = this.lookup) == null ? void 0 : _c.colormapLut);
  2664. }
  2665. return u6;
  2666. }
  2667. _symbolizeShadedRelief(e8, t7) {
  2668. var _a, _b;
  2669. const r11 = this.rendererJSON, s9 = { ...r11, ...t7 }, o5 = l7(e8, s9);
  2670. if (!r11.colorRamp)
  2671. return o5;
  2672. let n10;
  2673. if (this._isLUTChanged(true)) {
  2674. if (!this.bind().success)
  2675. return o5;
  2676. n10 = this.lookup ? this.lookup.hsvMap : null;
  2677. } else
  2678. n10 = this.lookup ? this.lookup.hsvMap : null;
  2679. if (!n10)
  2680. return o5;
  2681. const i7 = (_b = (_a = e2(this.rasterInfo.statistics)) == null ? void 0 : _a[0]) != null ? _b : { min: 0, max: 8e3 };
  2682. return s7(o5, e8, n10, i7), o5;
  2683. }
  2684. _isVectorFieldData() {
  2685. const { bandCount: e8, dataType: t7 } = this.rasterInfo;
  2686. return 2 === e8 && ("vector-magdir" === t7 || "vector-uv" === t7);
  2687. }
  2688. _updateVectorFieldRenderer() {
  2689. return this._isVectorFieldData() ? { success: true } : { success: false, error: `Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".` };
  2690. }
  2691. _updateFlowRenderer() {
  2692. return this._isVectorFieldData() ? { success: true } : { success: false, error: `Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".` };
  2693. }
  2694. _updateUVRenderer(e8) {
  2695. var _a;
  2696. const { bandCount: t7, attributeTable: r11, pixelType: s9 } = this.rasterInfo, a11 = e8.field1;
  2697. if (!a11)
  2698. return { success: false, error: "Unsupported renderer; missing UniqueValueRenderer.field." };
  2699. const n10 = e8.defaultSymbol, i7 = 1 === t7 && ["u8", "s8"].includes(s9);
  2700. if (!L2(this.rasterInfo, a11) && !i7)
  2701. return { success: false, error: "Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table." };
  2702. const l8 = [];
  2703. if (r(r11)) {
  2704. const t8 = r11.fields.find((e9) => "value" === e9.name.toLowerCase());
  2705. if (!t8)
  2706. return { success: false, error: "Unsupported data; the data's raster attribute table does not have a value field." };
  2707. r11.features.forEach((r12) => {
  2708. var _a2, _b;
  2709. const s10 = (_a2 = e8.uniqueValueInfos) == null ? void 0 : _a2.find((e9) => String(e9.value) === String(r12.attributes[a11])), o5 = (_b = s10 == null ? void 0 : s10.symbol) == null ? void 0 : _b.color;
  2710. o5 ? l8.push([r12.attributes[t8.name]].concat(o5)) : n10 && l8.push([r12.attributes[t8.name]].concat(n10.color));
  2711. });
  2712. } else {
  2713. if ("value" !== a11.toLowerCase())
  2714. return { success: false, error: 'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.' };
  2715. (_a = e8.uniqueValueInfos) == null ? void 0 : _a.forEach((e9) => {
  2716. var _a2;
  2717. const t8 = (_a2 = e9 == null ? void 0 : e9.symbol) == null ? void 0 : _a2.color;
  2718. t8 ? l8.push([parseInt("" + e9.value, 10)].concat(t8)) : n10 && l8.push([parseInt("" + e9.value, 10)].concat(n10 == null ? void 0 : n10.color));
  2719. });
  2720. }
  2721. if (0 === l8.length)
  2722. return { success: false, error: "Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table." };
  2723. const u6 = a3({ colormap: l8 });
  2724. return this.lookup = { rendererJSON: e8, colormapLut: u6 }, this.canRenderInWebGL = true, { success: true };
  2725. }
  2726. _updateColormapRenderer(e8) {
  2727. if (!V(this.rasterInfo))
  2728. return { success: false, error: "Unsupported data; the data source does not have a colormap." };
  2729. const t7 = e8.colormapInfos.map((e9) => [e9.value].concat(e9.color)).sort((e9, t8) => e9[0] - t8[0]);
  2730. if (!t7 || 0 === t7.length)
  2731. return { success: false, error: "Unsupported renderer; ColormapRenderer must have meaningful colormapInfos." };
  2732. const r11 = a3({ colormap: t7 });
  2733. return this.lookup = { rendererJSON: e8, colormapLut: r11 }, this.canRenderInWebGL = true, { success: true };
  2734. }
  2735. _updateShadedReliefRenderer(e8) {
  2736. if (!_2(this.rasterInfo))
  2737. return { success: false, error: `Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.` };
  2738. if (e8.colorRamp) {
  2739. const r11 = h4(e8.colorRamp, 256, true), s9 = a3({ colormap: r11 }), a11 = [], o5 = s9.indexedColormap;
  2740. for (let e9 = 0; e9 < o5.length; e9 += 4) {
  2741. const r12 = y3({ r: o5[e9], g: o5[e9 + 1], b: o5[e9 + 2] });
  2742. a11.push([r12.h / 60, r12.s / 100, 255 * r12.v / 100]);
  2743. }
  2744. this.lookup = { rendererJSON: e8, colormapLut: s9, hsvMap: a11 };
  2745. } else
  2746. this.lookup = null;
  2747. return this.canRenderInWebGL = true, { success: true };
  2748. }
  2749. _analyzeClassBreaks(e8) {
  2750. const { attributeTable: t7, pixelType: r11 } = this.rasterInfo, s9 = r(t7) ? t7.fields.find((e9) => "value" === e9.name.toLowerCase()) : null, a11 = r(t7) ? t7.fields.find((t8) => t8.name.toLowerCase() === e8.field.toLowerCase()) : null, n10 = null != s9 && null !== a11;
  2751. return { canUseIndexedLUT: ["u8", "u16", "s8", "s16"].includes(r11) || n10, tableValueField: s9, tableBreakField: a11 };
  2752. }
  2753. _updateClassBreaksRenderer(e8) {
  2754. var _a;
  2755. const { attributeTable: t7 } = this.rasterInfo, { canUseIndexedLUT: r11, tableValueField: s9, tableBreakField: a11 } = this._analyzeClassBreaks(e8), n10 = e8.classBreakInfos;
  2756. if (!(n10 == null ? void 0 : n10.length))
  2757. return { success: false, error: "Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos." };
  2758. const i7 = n10.sort((e9, t8) => e9.classMaxValue - t8.classMaxValue), l8 = i7[i7.length - 1];
  2759. let u6 = e8.minValue;
  2760. if (!r11) {
  2761. const t8 = [];
  2762. for (let e9 = 0; e9 < i7.length; e9++)
  2763. t8.push({ value: (_a = i7[e9].classMinValue) != null ? _a : u6, mappedColor: i7[e9].symbol.color }), u6 = i7[e9].classMaxValue;
  2764. return t8.push({ value: l8.classMaxValue, mappedColor: l8.symbol.color }), this.lookup = { rendererJSON: e8, remapLut: t8 }, this.canRenderInWebGL = false, { success: true };
  2765. }
  2766. const c7 = [];
  2767. if (r(t7) && null != s9 && null !== a11 && s9 !== a11) {
  2768. const r12 = s9.name, o5 = a11.name, n11 = i7[i7.length - 1], { classMaxValue: l9 } = n11;
  2769. u6 = e8.minValue;
  2770. for (const e9 of t7.features) {
  2771. const t8 = e9.attributes[r12], s10 = e9.attributes[o5], a12 = s10 === l9 ? n11 : s10 < u6 ? null : i7.find(({ classMaxValue: e10 }) => e10 > s10);
  2772. a12 && c7.push([t8].concat(a12.symbol.color));
  2773. }
  2774. } else {
  2775. u6 = Math.floor(e8.minValue);
  2776. for (let e9 = 0; e9 < i7.length; e9++) {
  2777. const t8 = i7[e9];
  2778. for (let e10 = u6; e10 < t8.classMaxValue; e10++)
  2779. c7.push([e10].concat(t8.symbol.color));
  2780. u6 = Math.ceil(t8.classMaxValue);
  2781. }
  2782. l8.classMaxValue === u6 && c7.push([l8.classMaxValue].concat(l8.symbol.color));
  2783. }
  2784. const p8 = a3({ colormap: c7, fillUnspecified: false });
  2785. return this.lookup = { rendererJSON: e8, colormapLut: p8 }, this.canRenderInWebGL = true, { success: true };
  2786. }
  2787. _isHistogramRequired(e8) {
  2788. return "percentClip" === e8 || "histogramEqualization" === e8;
  2789. }
  2790. _isValidRasterStatistics(e8) {
  2791. return r(e8) && e8.length > 0 && null != e8[0].min && null != e8[0].max;
  2792. }
  2793. _updateStretchRenderer(e8) {
  2794. var _a, _b;
  2795. let { stretchType: t7, dra: r11 } = e8;
  2796. if (!("none" === t7 || ((_a = e8.statistics) == null ? void 0 : _a.length) || this._isValidRasterStatistics(this.rasterInfo.statistics) || r11))
  2797. return { success: false, error: "Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used." };
  2798. const s9 = e2(e8.histograms || this.rasterInfo.histograms);
  2799. !this._isHistogramRequired(e8.stretchType) || (s9 == null ? void 0 : s9.length) || r11 || (t7 = "minMax");
  2800. const { computeGamma: o5, useGamma: n10, colorRamp: i7 } = e8;
  2801. let { gamma: l8 } = e8;
  2802. if (n10 && o5 && !(l8 == null ? void 0 : l8.length)) {
  2803. const t8 = ((_b = e8.statistics) == null ? void 0 : _b.length) ? e8.statistics : e2(this.rasterInfo.statistics);
  2804. l8 = c5(this.rasterInfo.pixelType, t8);
  2805. }
  2806. const u6 = this.rasterInfo.pixelType, c7 = !r11 && ["u8", "u16", "s8", "s16"].includes(u6);
  2807. if ("histogramEqualization" === t7) {
  2808. const t8 = s9.map((e9) => l4(e9));
  2809. this.lookup = { rendererJSON: e8, histogramLut: t8 };
  2810. } else if (c7) {
  2811. const t8 = x3(e8, { rasterInfo: this.rasterInfo }), r12 = u3({ pixelType: u6, ...t8, gamma: n10 ? l8 : null });
  2812. this.lookup = { rendererJSON: e8, stretchLut: r12 };
  2813. }
  2814. if (i7) {
  2815. const t8 = h4(i7, 256, true);
  2816. this.lookup || (this.lookup = { rendererJSON: e8 }), this.lookup.colormapLut = a3({ colormap: t8 }), this.lookup.rendererJSON = e8;
  2817. }
  2818. return this.lookup.gamma = n10 && (l8 == null ? void 0 : l8.length) ? l8 : null, this.canRenderInWebGL = true, { success: true };
  2819. }
  2820. _generateStretchWebGLParams(e8, t7, r11) {
  2821. let s9 = null, a11 = null;
  2822. const n10 = this.lookup && this.lookup.colormapLut;
  2823. t7.colorRamp && n10 && (s9 = n10.indexedColormap, a11 = n10.offset), "histogramEqualization" === t7.stretchType && (t7 = { ...t7, stretchType: "minMax" });
  2824. const { gamma: i7 } = this.lookup, l8 = !!(t7.useGamma && i7 && i7.some((e9) => 1 !== e9)), { minCutOff: u6, maxCutOff: c7, outMin: p8, outMax: d4 } = x3(t7, { rasterInfo: this.rasterInfo, pixelBlock: e8, bandIds: r11 });
  2825. let h5 = 0;
  2826. r(e8) && (h5 = e8.getPlaneCount(), 2 === h5 && ((e8 = e8.clone()).statistics = [e8.statistics[0]], e8.pixels = [e8.pixels[0]]));
  2827. const m5 = Math.min(3, (r11 == null ? void 0 : r11.length) || h5 || this.rasterInfo.bandCount), f7 = new Float32Array(m5), y6 = s9 || l8 ? 1 : 255;
  2828. let g6;
  2829. for (g6 = 0; g6 < m5; g6++)
  2830. f7[g6] = (d4 - p8) / (c7[g6] - u6[g6]) / y6;
  2831. const S4 = new Float32Array(m5);
  2832. if (l8)
  2833. for (g6 = 0; g6 < m5; g6++)
  2834. i7[g6] > 1 ? i7[g6] > 2 ? S4[g6] = 6.5 + (i7[g6] - 2) ** 2.5 : S4[g6] = 6.5 + 100 * (2 - i7[g6]) ** 4 : S4[g6] = 1;
  2835. return { bandCount: m5, outMin: p8 / y6, outMax: d4 / y6, minCutOff: u6, maxCutOff: c7, factor: f7, useGamma: l8, gamma: l8 ? i7 : [1, 1, 1], gammaCorrection: l8 ? S4 : [1, 1, 1], colormap: s9, colormapOffset: a11, stretchType: t7.stretchType, type: "stretch" };
  2836. }
  2837. _generateShadedReliefWebGLParams(e8, t7 = false, r11 = { x: 0, y: 0 }) {
  2838. var _a, _b, _c;
  2839. let s9 = null, o5 = null;
  2840. const n10 = this.lookup && this.lookup.colormapLut;
  2841. e8.colorRamp && n10 && (s9 = n10.indexedColormap, o5 = n10.offset);
  2842. const i7 = { ...e8, isGCS: t7, resolution: r11 }, l8 = n8(i7), u6 = (_a = e2(this.rasterInfo.statistics)) == null ? void 0 : _a[0];
  2843. return { ...l8, minValue: (_b = u6 == null ? void 0 : u6.min) != null ? _b : 0, maxValue: (_c = u6 == null ? void 0 : u6.max) != null ? _c : 8e3, hillshadeType: "traditional" === e8.hillshadeType ? 0 : 1, type: "hillshade", colormap: s9, colormapOffset: o5 };
  2844. }
  2845. _generateVectorFieldWebGLParams(e8) {
  2846. var _a, _b, _c, _d, _e, _f, _g, _h;
  2847. const { style: t7, inputUnit: r11, outputUnit: s9, visualVariables: a11, symbolTileSize: n10, flowRepresentation: i7 } = e8;
  2848. let l8;
  2849. const u6 = (_b = (_a = this.rasterInfo.statistics) == null ? void 0 : _a[0].min) != null ? _b : 0, c7 = (_d = (_c = this.rasterInfo.statistics) == null ? void 0 : _c[0].max) != null ? _d : 50, p8 = (_e = a11 == null ? void 0 : a11.find((e9) => "sizeInfo" === e9.type)) != null ? _e : { type: "sizeInfo", field: "Magnitude", maxDataValue: c7, maxSize: 0.8 * n10, minDataValue: u6, minSize: 0.2 * n10 }, d4 = (_f = p8.minDataValue) != null ? _f : u6, h5 = (_g = p8.maxDataValue) != null ? _g : c7, m5 = r(p8.maxSize) && r(p8.minSize) ? [p8.minSize / n10, p8.maxSize / n10] : [0.2, 0.8];
  2850. if ("wind_speed" === t7) {
  2851. const e9 = (m5[0] + m5[1]) / 2;
  2852. m5[0] = m5[1] = e9;
  2853. }
  2854. const f7 = r(d4) && r(h5) ? [d4, h5] : null;
  2855. if ("classified_arrow" === t7)
  2856. if (r(d4) && r(h5) && r(p8)) {
  2857. l8 = [];
  2858. const e9 = (p8.maxDataValue - p8.minDataValue) / 5;
  2859. for (let t8 = 0; t8 < 6; t8++)
  2860. l8.push(p8.minDataValue + e9 * t8);
  2861. } else
  2862. l8 = [0, 1e-6, 3.5, 7, 10.5, 14];
  2863. const y6 = "flow_to" === i7 === ("ocean_current_kn" === t7 || "ocean_current_m" === t7) ? 0 : Math.PI, b3 = a11 == null ? void 0 : a11.find((e9) => "rotationInfo" === e9.type);
  2864. return { breakValues: l8, dataRange: f7, inputUnit: r11, outputUnit: s9, symbolTileSize: n10, symbolPercentRange: m5, style: t7 || "single_arrow", rotation: y6, rotationType: ((_h = this.rasterInfo.storageInfo) == null ? void 0 : _h.tileInfo) && "vector-uv" === this.rasterInfo.dataType ? "geographic" : (b3 == null ? void 0 : b3.rotationType) || e8.rotationType, type: "vectorField" };
  2865. }
  2866. };
  2867. function O3(e8) {
  2868. return r2(e8) && 0 !== e8.validPixelCount;
  2869. }
  2870. e([y2({ json: { write: true } })], v3.prototype, "rendererJSON", void 0), e([y2({ type: u4, json: { write: true } })], v3.prototype, "rasterInfo", void 0), e([y2({ json: { write: true } })], v3.prototype, "lookup", void 0), e([y2()], v3.prototype, "canRenderInWebGL", void 0), v3 = e([n("esri.renderers.support.RasterSymbolizer")], v3);
  2871. var T3 = v3;
  2872. export {
  2873. r9 as r,
  2874. n5 as n,
  2875. r10 as r2,
  2876. b,
  2877. D,
  2878. O,
  2879. N,
  2880. G,
  2881. P2 as P,
  2882. S3 as S,
  2883. a9 as a,
  2884. o4 as o,
  2885. i6 as i,
  2886. f6 as f,
  2887. c6 as c,
  2888. h4 as h,
  2889. _,
  2890. k4 as k,
  2891. n6 as n2,
  2892. a7 as a2,
  2893. u3 as u,
  2894. p5 as p,
  2895. g4 as g,
  2896. x3 as x,
  2897. d2 as d,
  2898. n7 as n3,
  2899. u4 as u2,
  2900. T3 as T
  2901. };
  2902. //# sourceMappingURL=chunk-3BKH6ISD.js.map