chunk-264YGWEE.js 207 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727
  1. import {
  2. i as i3,
  3. p,
  4. r as r6,
  5. s as s5
  6. } from "./chunk-ZLQP3WDC.js";
  7. import {
  8. e as e3,
  9. e2 as e4
  10. } from "./chunk-JBMHQ5RK.js";
  11. import {
  12. E as E5,
  13. a as a2,
  14. s as s4,
  15. x as x2
  16. } from "./chunk-WBWQJQK4.js";
  17. import {
  18. s as s3
  19. } from "./chunk-TDS6IBMU.js";
  20. import {
  21. e
  22. } from "./chunk-DBT4KOKX.js";
  23. import {
  24. l as l2,
  25. n as n3,
  26. r as r5
  27. } from "./chunk-2GP5D74I.js";
  28. import {
  29. M as M4
  30. } from "./chunk-EPMXCACW.js";
  31. import {
  32. x
  33. } from "./chunk-UWKVAZQ6.js";
  34. import {
  35. ge
  36. } from "./chunk-T2SKWJGU.js";
  37. import {
  38. M as M3,
  39. w
  40. } from "./chunk-UO3LS2M5.js";
  41. import {
  42. E as E4
  43. } from "./chunk-H2VOWDMO.js";
  44. import {
  45. $,
  46. A,
  47. B as B2,
  48. C as C2,
  49. D as D2,
  50. E as E2,
  51. F as F2,
  52. G as G2,
  53. K as K2,
  54. L as L2,
  55. Z,
  56. _ as _2,
  57. at,
  58. o as o2
  59. } from "./chunk-XO5VJRK4.js";
  60. import {
  61. C as C3,
  62. N as N2,
  63. P as P2,
  64. U as U2,
  65. Z as Z2,
  66. w as w2
  67. } from "./chunk-3WXSWAUV.js";
  68. import {
  69. E as E3,
  70. I as I2,
  71. S
  72. } from "./chunk-EQNT4A7P.js";
  73. import {
  74. t as t4
  75. } from "./chunk-4OM3EX6P.js";
  76. import {
  77. B,
  78. C,
  79. D,
  80. E,
  81. F,
  82. G,
  83. I,
  84. L,
  85. M,
  86. N,
  87. O,
  88. P,
  89. R,
  90. U,
  91. V,
  92. Y,
  93. _,
  94. o
  95. } from "./chunk-3OFVLRSL.js";
  96. import {
  97. e as e2
  98. } from "./chunk-IQBIGNPU.js";
  99. import {
  100. f as f3,
  101. n as n2
  102. } from "./chunk-K7B6OWCU.js";
  103. import {
  104. n,
  105. t as t5
  106. } from "./chunk-UDYHZLTE.js";
  107. import {
  108. r as r4
  109. } from "./chunk-RWQH5X3O.js";
  110. import {
  111. M as M2,
  112. b,
  113. h,
  114. i as i2,
  115. r as r3
  116. } from "./chunk-O3JQY77G.js";
  117. import {
  118. r as r2
  119. } from "./chunk-E3G7BRZB.js";
  120. import {
  121. J,
  122. K
  123. } from "./chunk-JKFWEHNK.js";
  124. import {
  125. t as t3
  126. } from "./chunk-3IRT3YKJ.js";
  127. import {
  128. l
  129. } from "./chunk-TJV6ODRM.js";
  130. import {
  131. f as f2
  132. } from "./chunk-RYY6632W.js";
  133. import {
  134. s2 as s,
  135. s3 as s2
  136. } from "./chunk-E5O6P5I2.js";
  137. import {
  138. t as t2
  139. } from "./chunk-2TIUKVZN.js";
  140. import {
  141. a,
  142. f,
  143. i,
  144. r,
  145. t
  146. } from "./chunk-YXWMMD76.js";
  147. // node_modules/@arcgis/core/views/webgl/rasterUtils.js
  148. function m(e8, u6, m11 = "nearest", c8 = false) {
  149. var _a;
  150. const l8 = !(c8 && "u8" === u6.pixelType), _5 = l8 ? G.FLOAT : G.UNSIGNED_BYTE, p6 = null == u6.pixels || 0 === u6.pixels.length ? null : l8 ? u6.getAsRGBAFloat() : u6.getAsRGBA(), g3 = (_a = e8.capabilities.textureFloat) == null ? void 0 : _a.textureFloatLinear, T3 = { width: u6.width, height: u6.height, target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: e8.type === r4.WEBGL2 && l8 ? U.RGBA32F : P.RGBA, samplingMode: !g3 || "bilinear" !== m11 && "cubic" !== m11 ? L.NEAREST : L.LINEAR, dataType: _5, wrapMode: D.CLAMP_TO_EDGE, flipped: false };
  151. return new E4(e8, T3, p6);
  152. }
  153. function c(e8, u6) {
  154. const { spacing: m11, offsets: c8, coefficients: l8, size: [_5, p6] } = u6, g3 = m11[0] > 1, T3 = { width: g3 ? 4 * _5 : _5, height: p6, target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: e8.type === r4.WEBGL2 ? U.RGBA32F : P.RGBA, dataType: G.FLOAT, samplingMode: L.NEAREST, wrapMode: D.CLAMP_TO_EDGE, flipped: false }, E7 = new Float32Array(g3 ? _5 * p6 * 16 : 2 * c8.length);
  155. if (g3)
  156. for (let t11 = 0, n10 = 0; t11 < l8.length; t11++)
  157. E7[n10++] = l8[t11], t11 % 3 == 2 && (E7[n10++] = 1);
  158. else
  159. for (let t11 = 0; t11 < p6; t11++)
  160. for (let e9 = 0; e9 < _5; e9++) {
  161. const n10 = 4 * (t11 * _5 + e9), a4 = 2 * (e9 * p6 + t11);
  162. E7[n10] = c8[a4], E7[n10 + 1] = c8[a4 + 1], E7[n10 + 3] = -1 === c8[a4] ? 0 : 1;
  163. }
  164. return new E4(e8, T3, E7);
  165. }
  166. function l3(e8, t11) {
  167. const i6 = { width: t11.length / 4, height: 1, target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, wrapMode: D.CLAMP_TO_EDGE, flipped: false };
  168. return new E4(e8, i6, t11);
  169. }
  170. function _3(t11, n10, a4, r10 = 1, i6 = true) {
  171. return { u_flipY: i6, u_applyTransform: !!t11, u_opacity: r10, u_transformSpacing: t11 ? t11.spacing : f3, u_transformGridSize: t11 ? t11.size : f3, u_targetImageSize: n10, u_srcImageSize: a4 };
  172. }
  173. function p2(e8, t11) {
  174. return { u_colormapOffset: t11 || 0, u_colormapMaxIndex: e8 ? e8.length / 4 - 1 : 0 };
  175. }
  176. function g(e8, t11) {
  177. return { u_scale: e8, u_offset: t11 };
  178. }
  179. function T(e8) {
  180. return { u_bandCount: e8.bandCount, u_minOutput: e8.outMin, u_maxOutput: e8.outMax, u_minCutOff: e8.minCutOff, u_maxCutOff: e8.maxCutOff, u_factor: e8.factor, u_useGamma: e8.useGamma, u_gamma: e8.gamma, u_gammaCorrection: e8.gammaCorrection };
  181. }
  182. function E6(e8) {
  183. return { u_hillshadeType: e8.hillshadeType, u_sinZcosAs: e8.sinZcosAs, u_sinZsinAs: e8.sinZsinAs, u_cosZs: e8.cosZs, u_weights: e8.weights, u_factor: e8.factor, u_minValue: e8.minValue, u_maxValue: e8.maxValue };
  184. }
  185. function A2(e8, t11) {
  186. const n10 = e8.gl, a4 = t11.glName, r10 = n10.getProgramParameter(a4, n10.ACTIVE_UNIFORMS), i6 = /* @__PURE__ */ new Map();
  187. let o7;
  188. for (let s10 = 0; s10 < r10; s10++)
  189. o7 = n10.getActiveUniform(a4, s10), o7 && i6.set(o7.name, { location: n10.getUniformLocation(a4, o7.name), info: o7 });
  190. return i6;
  191. }
  192. function h2(e8, t11, n10) {
  193. Object.keys(n10).forEach((a4) => {
  194. const r10 = t11.get(a4) || t11.get(a4 + "[0]");
  195. r10 && d(e8, a4, n10[a4], r10);
  196. });
  197. }
  198. function O2(e8, t11, n10, a4) {
  199. n10.length === a4.length && (a4.some((e9) => null == e9) || n10.some((e9) => null == e9) || n10.forEach((n11, r10) => {
  200. t11.setUniform1i(n11, r10), e8.bindTexture(a4[r10], r10);
  201. }));
  202. }
  203. function d(e8, t11, n10, a4) {
  204. if (null === a4 || null == n10)
  205. return false;
  206. const { info: r10 } = a4;
  207. switch (r10.type) {
  208. case o.FLOAT:
  209. r10.size > 1 ? e8.setUniform1fv(t11, n10) : e8.setUniform1f(t11, n10);
  210. break;
  211. case o.FLOAT_VEC2:
  212. e8.setUniform2fv(t11, n10);
  213. break;
  214. case o.FLOAT_VEC3:
  215. e8.setUniform3fv(t11, n10);
  216. break;
  217. case o.FLOAT_VEC4:
  218. e8.setUniform4fv(t11, n10);
  219. break;
  220. case o.FLOAT_MAT3:
  221. e8.setUniformMatrix3fv(t11, n10);
  222. break;
  223. case o.FLOAT_MAT4:
  224. e8.setUniformMatrix4fv(t11, n10);
  225. break;
  226. case o.INT:
  227. r10.size > 1 ? e8.setUniform1iv(t11, n10) : e8.setUniform1i(t11, n10);
  228. break;
  229. case o.BOOL:
  230. e8.setUniform1i(t11, n10 ? 1 : 0);
  231. break;
  232. case o.INT_VEC2:
  233. case o.BOOL_VEC2:
  234. e8.setUniform2iv(t11, n10);
  235. break;
  236. case o.INT_VEC3:
  237. case o.BOOL_VEC3:
  238. e8.setUniform3iv(t11, n10);
  239. break;
  240. case o.INT_VEC4:
  241. case o.BOOL_VEC4:
  242. e8.setUniform4iv(t11, n10);
  243. break;
  244. default:
  245. return false;
  246. }
  247. return true;
  248. }
  249. // node_modules/@arcgis/core/views/2d/engine/webgl/VertexStream.js
  250. var n4 = class {
  251. constructor(s10, n10) {
  252. this._rctx = s10, this._vertexBuffer = E5.createVertex(s10, F.STATIC_DRAW, new Uint16Array(n10)), this._vao = new a2(s10, /* @__PURE__ */ new Map([["a_position", 0]]), { geometry: [new t4("a_position", 2, C.SHORT, 0, 4)] }, { geometry: this._vertexBuffer }), this._count = n10.length / 2;
  253. }
  254. bind() {
  255. this._rctx.bindVAO(this._vao);
  256. }
  257. unbind() {
  258. this._rctx.bindVAO(null);
  259. }
  260. dispose() {
  261. this._vao.dispose(false), this._vertexBuffer.dispose();
  262. }
  263. draw() {
  264. this._rctx.bindVAO(this._vao), this._rctx.drawArrays(E.TRIANGLE_STRIP, 0, this._count);
  265. }
  266. };
  267. // node_modules/@arcgis/core/views/2d/engine/webgl/DefaultVertexAttributeLayouts.js
  268. var r7 = { geometry: [new t4("a_pos", 2, C.BYTE, 0, 2)] };
  269. var t6 = { geometry: [new t4("a_pos", 2, C.BYTE, 0, 4), new t4("a_tex", 2, C.BYTE, 2, 4)] };
  270. var m2 = { geometry: [new t4("a_pos", 2, C.UNSIGNED_SHORT, 0, 4)] };
  271. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrush.js
  272. var t7 = class {
  273. constructor() {
  274. this.name = this.constructor.name || "UnnamedBrush", this.brushEffect = null;
  275. }
  276. prepareState(t11, r10) {
  277. }
  278. draw(t11, r10, s10) {
  279. }
  280. drawMany(t11, r10, s10) {
  281. for (const a4 of r10)
  282. a4.visible && this.draw(t11, a4, s10);
  283. }
  284. };
  285. // node_modules/@arcgis/core/views/2d/engine/flow/BrushFlow.js
  286. var i4 = class extends t7 {
  287. constructor() {
  288. super(...arguments), this._visualState = { time: 0, dvsMat3: e2(), displayViewMat3: e2() };
  289. }
  290. dispose() {
  291. }
  292. prepareState(t11) {
  293. const { context: e8 } = t11;
  294. e8.setColorMask(true, true, true, true), e8.setStencilFunction(I.EQUAL, 0, 255);
  295. }
  296. draw(s10, a4) {
  297. const { requestRender: r10, allowDelayedRender: i6 } = s10, { displayData: o7 } = a4;
  298. if (t(o7))
  299. return;
  300. if ("loaded" === o7.state.name && o7.attach(s10), "attached" !== o7.state.name)
  301. return;
  302. const l8 = o7.state.resources;
  303. i6 && !l8.ready && r(r10) ? r10() : (this._visualState.time = s10.time / 1e3, this._visualState.dvsMat3 = a4.transforms.dvs, this._visualState.displayViewMat3 = s10.state.displayViewMat3, o7.flowStyle.render(s10, this._visualState, l8), o7.flowStyle.animated && r(r10) && r10());
  304. }
  305. };
  306. // node_modules/@arcgis/core/views/2d/engine/imagery/RasterBitmap.js
  307. var x3 = { bandCount: 3, outMin: 0, outMax: 1, minCutOff: [0, 0, 0], maxCutOff: [255, 255, 255], factor: [1 / 255, 1 / 255, 1 / 255], useGamma: false, gamma: [1, 1, 1], gammaCorrection: [1, 1, 1], colormap: null, colormapOffset: null, stretchType: "none", type: "stretch" };
  308. var p3 = class extends r6 {
  309. constructor(t11 = null, e8 = null, r10 = null) {
  310. super(), this._textureInvalidated = true, this._colormapTextureInvalidated = true, this._supportsBilinearTexture = true, this.stencilRef = 0, this.coordScale = [1, 1], this._symbolizerParameters = null, this.height = null, this.isRendereredSource = false, this.pixelRatio = 1, this.resolution = 0, this.rotation = 0, this._source = null, this.rawPixelData = null, this._suspended = false, this._bandIds = null, this._interpolation = null, this._transformGrid = null, this.width = null, this.x = 0, this.y = 0, this.source = t11, this.transformGrid = e8, this.interpolation = r10;
  311. }
  312. destroy() {
  313. var _a;
  314. (_a = this.getTextures()) == null ? void 0 : _a.textures.forEach((t11) => t11.dispose()), this._rasterTexture = null, this._transformGridTexture = null, this._colormapTexture = null;
  315. }
  316. get symbolizerParameters() {
  317. return this._symbolizerParameters || x3;
  318. }
  319. set symbolizerParameters(t11) {
  320. this._symbolizerParameters !== t11 && (this._symbolizerParameters = t11, this._colormapTextureInvalidated = true);
  321. }
  322. get source() {
  323. return this._source;
  324. }
  325. set source(t11) {
  326. this._source !== t11 && (this._source = t11, this._rasterTexture && (this._rasterTexture.dispose(), this._rasterTexture = null, this._rasterTextureBandIds = null), this.invalidateTexture());
  327. }
  328. get suspended() {
  329. return this._suspended;
  330. }
  331. set suspended(t11) {
  332. this._suspended && !t11 && this.stage && (this.ready(), this.requestRender()), this._suspended = t11;
  333. }
  334. get bandIds() {
  335. return this._bandIds;
  336. }
  337. set bandIds(t11) {
  338. this._bandIds = t11, this._isBandIdschanged(t11) && this.invalidateTexture();
  339. }
  340. get interpolation() {
  341. return this._interpolation || "nearest";
  342. }
  343. set interpolation(t11) {
  344. this._interpolation = t11, this._rasterTexture && this._rasterTexture.setSamplingMode("bilinear" === this._getTextureSamplingMethod(t11) ? L.LINEAR : L.NEAREST);
  345. }
  346. get transformGrid() {
  347. return this._transformGrid;
  348. }
  349. set transformGrid(t11) {
  350. this._transformGrid = t11, this._transformGridTexture && (this._transformGridTexture.dispose(), this._transformGridTexture = null);
  351. }
  352. invalidateTexture() {
  353. this._textureInvalidated || (this._textureInvalidated = true, this.requestRender());
  354. }
  355. _createTransforms() {
  356. return { dvs: e2() };
  357. }
  358. setTransform(t11) {
  359. const o7 = r3(this.transforms.dvs), [n10, h5] = t11.toScreenNoRotation([0, 0], [this.x, this.y]), l8 = this.resolution / this.pixelRatio / t11.resolution, d7 = l8 * this.width, _5 = l8 * this.height, m11 = Math.PI * this.rotation / 180;
  360. M2(o7, o7, t5(n10, h5)), M2(o7, o7, t5(d7 / 2, _5 / 2)), h(o7, o7, -m11), M2(o7, o7, t5(-d7 / 2, -_5 / 2)), b(o7, o7, t5(d7, _5)), i2(this.transforms.dvs, t11.displayViewMat3, o7);
  361. }
  362. getTextures() {
  363. if (!this._rasterTexture)
  364. return null;
  365. const t11 = [], e8 = [];
  366. return this._transformGridTexture && (e8.push(this._transformGridTexture), t11.push("u_transformGrid")), this._rasterTexture && (e8.push(this._rasterTexture), t11.push("u_image")), this._colormapTexture && (e8.push(this._colormapTexture), t11.push("u_colormap")), { names: t11, textures: e8 };
  367. }
  368. onAttach() {
  369. this.invalidateTexture();
  370. }
  371. onDetach() {
  372. this.invalidateTexture();
  373. }
  374. updateTexture({ context: t11 }) {
  375. var _a, _b, _c;
  376. if (!this.stage)
  377. return (_a = this._rasterTexture) == null ? void 0 : _a.dispose(), (_b = this._transformGridTexture) == null ? void 0 : _b.dispose(), (_c = this._colormapTexture) == null ? void 0 : _c.dispose(), this._rasterTexture = null, this._rasterTextureBandIds = null, this._transformGridTexture = null, void (this._colormapTexture = null);
  378. const e8 = this._isValidSource(this.source);
  379. e8 && this._colormapTextureInvalidated && (this._colormapTextureInvalidated = false, this._updateColormapTexture(t11)), this._textureInvalidated && (this._textureInvalidated = false, this._createOrDestroyRasterTexture(t11), this._rasterTexture && (e8 ? this.transformGrid && !this._transformGridTexture && (this._transformGridTexture = c(t11, this.transformGrid)) : this._rasterTexture.setData(null)), this.suspended || (this.ready(), this.requestRender()));
  380. }
  381. _createOrDestroyRasterTexture(e8) {
  382. var _a, _b;
  383. const r10 = r(this.source) ? s3(this.source, this.bandIds) : null;
  384. if (!this._isValidSource(r10))
  385. return void (this._rasterTexture && (this._rasterTexture.dispose(), this._rasterTextureBandIds = null, this._rasterTexture = null));
  386. const s10 = !this._isBandIdschanged(this.bandIds);
  387. if (this._rasterTexture) {
  388. if (s10)
  389. return;
  390. this._rasterTexture.dispose(), this._rasterTextureBandIds = null, this._rasterTexture = null;
  391. }
  392. this._supportsBilinearTexture = (_a = e8.capabilities.textureFloat) == null ? void 0 : _a.textureFloatLinear;
  393. const i6 = this._getTextureSamplingMethod(this.interpolation), a4 = this.isRendereredSource || !((_b = e8.capabilities.textureFloat) == null ? void 0 : _b.textureFloat);
  394. this._rasterTexture = m(e8, r10, i6, a4), this._rasterTextureBandIds = this.bandIds ? [...this.bandIds] : null;
  395. }
  396. _isBandIdschanged(t11) {
  397. const e8 = this._rasterTextureBandIds;
  398. return !(null == e8 && null == t11 || e8 && t11 && e8.join("") === t11.join(""));
  399. }
  400. _isValidSource(e8) {
  401. var _a;
  402. return r(e8) && ((_a = e8.pixels) == null ? void 0 : _a.length) > 0;
  403. }
  404. _getTextureSamplingMethod(e8) {
  405. const { type: r10, colormap: s10 } = this.symbolizerParameters, i6 = "lut" === r10 || "stretch" === r10 && r(s10);
  406. return !this._supportsBilinearTexture || i6 || "bilinear" !== e8 && "cubic" !== e8 ? "nearest" : "bilinear";
  407. }
  408. _updateColormapTexture(t11) {
  409. const e8 = this._colormap, r10 = this.symbolizerParameters.colormap;
  410. return r10 ? e8 ? r10.length !== e8.length || r10.some((t12, r11) => t12 !== e8[r11]) ? (this._colormapTexture && (this._colormapTexture.dispose(), this._colormapTexture = null), this._colormapTexture = l3(t11, r10), void (this._colormap = r10)) : void 0 : (this._colormapTexture = l3(t11, r10), void (this._colormap = r10)) : (this._colormapTexture && (this._colormapTexture.dispose(), this._colormapTexture = null), void (this._colormap = null));
  411. }
  412. };
  413. function T2(e8) {
  414. return r(e8.source);
  415. }
  416. // node_modules/@arcgis/core/views/2d/engine/imagery/BrushRasterBitmap.js
  417. var m3 = class extends t7 {
  418. constructor() {
  419. super(...arguments), this._desc = { lut: { vsPath: "raster/lut", fsPath: "raster/lut", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }, stretch: { vsPath: "raster/stretch", fsPath: "raster/stretch", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) }, hillshade: { vsPath: "raster/hillshade", fsPath: "raster/hillshade", attributes: /* @__PURE__ */ new Map([["a_position", 0], ["a_texcoord", 1]]) } }, this._rendererUniformInfos = /* @__PURE__ */ new Map();
  420. }
  421. dispose() {
  422. this._quad && this._quad.dispose();
  423. }
  424. prepareState({ context: e8 }) {
  425. e8.setBlendingEnabled(true), e8.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e8.setColorMask(true, true, true, true), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true);
  426. }
  427. draw(e8, r10) {
  428. var _a;
  429. if (!T2(r10) || r10.suspended)
  430. return;
  431. const { timeline: s10, context: a4, painter: o7 } = e8;
  432. s10.begin(this.name), a4.setStencilFunction(I.EQUAL, r10.stencilRef, 255);
  433. const n10 = !((_a = a4.capabilities.textureFloat) == null ? void 0 : _a.textureFloatLinear);
  434. r10.updateTexture(e8);
  435. const h5 = this._getShaderVariations(r10, n10), l8 = o7.materialManager.getProgram(this._desc[r10.symbolizerParameters.type], h5);
  436. this._drawWithProgram(e8, l8, r10), s10.end(this.name);
  437. }
  438. _drawWithProgram({ context: t11, requestRender: s10, allowDelayedRender: a4 }, i6, p6, m11 = 1, f5 = [0, 0], _5 = false) {
  439. if (this._quad || (this._quad = new n4(t11, [0, 0, 1, 0, 0, 1, 1, 1])), a4 && r(s10) && !i6.isCompiled)
  440. return void s10();
  441. const { symbolizerParameters: g3, transformGrid: b3, width: P3, height: w4, opacity: S3 } = p6, x7 = g3.type;
  442. t11.useProgram(i6);
  443. const y3 = this._getShaderVariations(p6), M6 = this._getUniformInfos(x7, t11, i6, y3), { names: U3, textures: j } = p6.getTextures();
  444. O2(t11, i6, U3, j);
  445. const I3 = g(m11, f5), E7 = _3(b3, [P3, w4], [p6.source.width, p6.source.height], S3, _5);
  446. if (h2(i6, M6, { u_coordScale: p6.coordScale, u_dvsMat3: p6.transforms.dvs, ...I3, ...E7 }), g3.colormap) {
  447. const { colormap: e8, colormapOffset: t12 } = g3, r10 = p2(e8, t12);
  448. h2(i6, M6, r10);
  449. }
  450. if ("stretch" === g3.type) {
  451. const e8 = T(g3);
  452. h2(i6, M6, e8);
  453. } else if ("hillshade" === g3.type) {
  454. const e8 = E6(g3);
  455. h2(i6, M6, e8);
  456. }
  457. this._quad.draw();
  458. }
  459. _getUniformInfos(e8, t11, r10, s10) {
  460. const a4 = s10.length > 0 ? e8 + "-" + s10.join("-") : e8;
  461. if (this._rendererUniformInfos.has(a4))
  462. return this._rendererUniformInfos.get(a4);
  463. const i6 = A2(t11, r10);
  464. return this._rendererUniformInfos.set(a4, i6), i6;
  465. }
  466. _getShaderVariations(e8, t11 = false) {
  467. const r10 = [], { interpolation: s10 } = e8, { type: a4, colormap: i6 } = e8.symbolizerParameters;
  468. return "cubic" === s10 ? r10.push("bicubic") : "bilinear" === s10 && "stretch" === a4 && null != i6 ? (r10.push("bilinear"), r10.push("nnedge")) : t11 && "bilinear" === s10 && r10.push("bilinear"), e8.isRendereredSource ? r10.push("noop") : i6 && r10.push("applyColormap"), e8.transformGrid && (r10.push("applyProjection"), 1 === e8.transformGrid.spacing[0] && r10.push("lookupProjection")), r10;
  469. }
  470. };
  471. // node_modules/@arcgis/core/views/2d/engine/imagery/BrushVectorField.js
  472. var l4 = new Float32Array([0.27058823529411763, 0.4588235294117647, 0.7098039215686275, 1, 0.396078431372549, 0.5372549019607843, 0.7215686274509804, 1, 0.5176470588235295, 0.6196078431372549, 0.7294117647058823, 1, 0.6352941176470588, 0.7058823529411765, 0.7411764705882353, 1, 0.7529411764705882, 0.8, 0.7450980392156863, 1, 0.8705882352941177, 0.8901960784313725, 0.7490196078431373, 1, 1, 1, 0.7490196078431373, 1, 1, 0.8627450980392157, 0.6313725490196078, 1, 0.9803921568627451, 0.7254901960784313, 0.5176470588235295, 1, 0.9607843137254902, 0.596078431372549, 0.4117647058823529, 1, 0.9294117647058824, 0.4588235294117647, 0.3176470588235294, 1, 0.9098039215686274, 0.08235294117647059, 0.08235294117647059, 1]);
  473. var c2 = { beaufort_ft: l4, beaufort_m: l4, beaufort_km: l4, beaufort_mi: l4, beaufort_kn: new Float32Array([0.1568627450980392, 0.5725490196078431, 0.7803921568627451, 1, 0.34901960784313724, 0.6352941176470588, 0.7294117647058823, 1, 0.5058823529411764, 0.7019607843137254, 0.6705882352941176, 1, 0.6274509803921569, 0.7607843137254902, 0.6078431372549019, 1, 0.7490196078431373, 0.8313725490196079, 0.5411764705882353, 1, 0.8549019607843137, 0.9019607843137255, 0.4666666666666667, 1, 0.9803921568627451, 0.9803921568627451, 0.39215686274509803, 1, 0.9882352941176471, 0.8352941176470589, 0.3254901960784314, 1, 0.9882352941176471, 0.7019607843137254, 0.4, 1, 0.9803921568627451, 0.5529411764705883, 0.20392156862745098, 1, 0.9686274509803922, 0.43137254901960786, 0.16470588235294117, 1, 0.9411764705882353, 0.2784313725490196, 0.11372549019607843, 1]), classified_arrow: new Float32Array([0.2196078431372549, 0.6588235294117647, 0, 1, 0.5450980392156862, 1.2117647058823529, 0, 1, 1, 1, 0, 1, 1, 0.5019607843137255, 0, 1, 1, 0, 0, 1]), ocean_current_m: new Float32Array([0.3058823529411765, 0.10196078431372549, 0.6, 1, 0.7019607843137254, 0.10588235294117647, 0.10196078431372549, 1, 0.792156862745098, 0.5019607843137255, 0.10196078431372549, 1, 0.6941176470588235, 0.6941176470588235, 0.6941176470588235, 1]), ocean_current_kn: new Float32Array([0, 0, 0, 1, 0, 0.1450980392156863, 0.39215686274509803, 1, 0.3058823529411765, 0.10196078431372549, 0.6, 1, 0.592156862745098, 0, 0.39215686274509803, 1, 0.7019607843137254, 0.10588235294117647, 0.10196078431372549, 1, 0.6941176470588235, 0.3058823529411765, 0.10196078431372549, 1, 0.792156862745098, 0.5019607843137255, 0.10196078431372549, 1, 0.6941176470588235, 0.7019607843137254, 0.20392156862745098, 1, 0.6941176470588235, 0.6941176470588235, 0.6941176470588235, 1]), single_arrow: new Float32Array([0, 92 / 255, 230 / 255, 1]), wind_speed: new Float32Array([0, 0, 0, 1]) };
  474. var d2 = class extends t7 {
  475. constructor() {
  476. super(...arguments), this._desc = { magdir: { vsPath: "raster/magdir", fsPath: "raster/magdir", attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_offset", 1], ["a_vv", 2]]) }, scalar: { vsPath: "raster/scalar", fsPath: "raster/scalar", attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_offset", 1], ["a_vv", 2]]) } };
  477. }
  478. dispose() {
  479. }
  480. prepareState({ context: e8 }) {
  481. e8.setBlendingEnabled(true), e8.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e8.setColorMask(true, true, true, true), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true), e8.setStencilOp(O.KEEP, O.KEEP, O.REPLACE);
  482. }
  483. draw(t11, a4) {
  484. if (t(a4.source) || 0 === a4.source.validPixelCount)
  485. return;
  486. const { context: r10, timeline: s10 } = t11;
  487. if (s10.begin(this.name), r10.setStencilFunction(I.EQUAL, a4.stencilRef, 255), a4.updateVectorFieldVAO(t11), "scalar" === t11.renderPass) {
  488. const e8 = a4.vaoData.scalar;
  489. e8 && this._drawScalars(t11, a4, e8.vao, e8.elementCount);
  490. } else {
  491. const e8 = a4.vaoData.magdir;
  492. e8 && this._drawTriangles(t11, a4, e8.vao, e8.elementCount);
  493. }
  494. s10.end(this.name);
  495. }
  496. _drawTriangles(e8, a4, r10, s10) {
  497. const { context: o7, painter: l8, requestRender: d7, allowDelayedRender: m11 } = e8, { symbolizerParameters: f5 } = a4, u6 = f5.dataRange ? ["dataRange"] : [];
  498. "geographic" === f5.rotationType && u6.push("rotationGeographic");
  499. const _5 = l8.materialManager.getProgram(this._desc.magdir, u6);
  500. if (m11 && r(d7) && !_5.isCompiled)
  501. return void d7();
  502. o7.useProgram(_5);
  503. const { coordScale: g3, opacity: p6, transforms: y3 } = a4;
  504. _5.setUniform2fv("u_coordScale", g3), _5.setUniform1f("u_opacity", p6), _5.setUniformMatrix3fv("u_dvsMat3", y3.dvs);
  505. const { style: v2, dataRange: b3, rotation: S3, symbolPercentRange: h5 } = f5;
  506. _5.setUniform4fv("u_colors", c2[v2] || c2.single_arrow), _5.setUniform2fv("u_dataRange", b3), _5.setUniform1f("u_rotation", S3), _5.setUniform2fv("u_symbolPercentRange", h5);
  507. const w4 = this._getSymbolSize(e8, a4);
  508. _5.setUniform2fv("u_symbolSize", w4), o7.bindVAO(r10), o7.drawElements(E.TRIANGLES, s10, C.UNSIGNED_INT, 0);
  509. }
  510. _drawScalars(e8, a4, r10, s10) {
  511. const { context: o7, painter: l8, requestRender: c8, allowDelayedRender: d7 } = e8, { symbolizerParameters: m11 } = a4, f5 = [];
  512. "wind_speed" === m11.style ? f5.push("innerCircle") : m11.dataRange && f5.push("dataRange"), "geographic" === m11.rotationType && f5.push("rotationGeographic");
  513. const u6 = l8.materialManager.getProgram(this._desc.scalar, f5);
  514. if (d7 && r(c8) && !u6.isCompiled)
  515. return void c8();
  516. o7.useProgram(u6);
  517. const { coordScale: _5, opacity: g3, transforms: p6 } = a4;
  518. u6.setUniform2fv("u_coordScale", _5), u6.setUniform1f("u_opacity", g3), u6.setUniformMatrix3fv("u_dvsMat3", p6.dvs);
  519. const { dataRange: y3, symbolPercentRange: v2 } = m11;
  520. u6.setUniform2fv("u_dataRange", y3), u6.setUniform2fv("u_symbolPercentRange", v2);
  521. const b3 = this._getSymbolSize(e8, a4);
  522. u6.setUniform2fv("u_symbolSize", b3), o7.bindVAO(r10), o7.drawElements(E.TRIANGLES, s10, C.UNSIGNED_INT, 0);
  523. }
  524. _getSymbolSize(e8, t11) {
  525. const a4 = t11.key ? 2 ** (e8.displayLevel - t11.key.level) : t11.resolution / e8.state.resolution, { symbolTileSize: r10 } = t11.symbolizerParameters;
  526. return [r10 / (Math.round((t11.width - t11.offset[0]) / r10) * r10) / a4, r10 / (Math.round((t11.height - t11.offset[1]) / r10) * r10) / a4];
  527. }
  528. };
  529. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/BrushBitmap.js
  530. var o3 = { nearest: { defines: [], samplingMode: L.NEAREST, mips: false }, bilinear: { defines: [], samplingMode: L.LINEAR, mips: false }, bicubic: { defines: ["bicubic"], samplingMode: L.LINEAR, mips: false }, trilinear: { defines: [], samplingMode: L.LINEAR_MIPMAP_LINEAR, mips: true } };
  531. var d3 = (e8, t11, i6) => {
  532. if ("dynamic" === i6.samplingMode) {
  533. const { state: i7 } = e8, s10 = t11.resolution / t11.pixelRatio / i7.resolution, n10 = Math.round(e8.pixelRatio) !== e8.pixelRatio, r10 = s10 > 1.05 || s10 < 0.95;
  534. return i7.rotation || r10 || n10 || t11.isSourceScaled || t11.rotation ? o3.bilinear : o3.nearest;
  535. }
  536. return o3[i6.samplingMode];
  537. };
  538. var m4 = class extends t7 {
  539. constructor() {
  540. super(...arguments), this._desc = { vsPath: "raster/bitmap", fsPath: "raster/bitmap", attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) };
  541. }
  542. dispose() {
  543. this._quad && this._quad.dispose();
  544. }
  545. prepareState({ context: e8 }) {
  546. e8.setBlendingEnabled(true), e8.setColorMask(true, true, true, true), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true);
  547. }
  548. draw(s10, n10) {
  549. const { context: o7, renderingOptions: m11, painter: l8, requestRender: c8, allowDelayedRender: p6 } = s10;
  550. if (!n10.source || !n10.isReady)
  551. return;
  552. const u6 = d3(s10, n10, m11), f5 = l8.materialManager.getProgram(this._desc, u6.defines);
  553. if (p6 && r(c8) && !f5.isCompiled)
  554. return void c8();
  555. s10.timeline.begin(this.name), "additive" === n10.blendFunction ? o7.setBlendFunctionSeparate(R.ONE, R.ONE, R.ONE, R.ONE) : o7.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), o7.setStencilFunction(I.EQUAL, n10.stencilRef, 255), this._quad || (this._quad = new n4(o7, [0, 0, 1, 0, 0, 1, 1, 1]));
  556. const { coordScale: _5, computedOpacity: E7, transforms: M6 } = n10;
  557. n10.setSamplingProfile(u6), n10.bind(s10.context, A), o7.useProgram(f5), f5.setUniformMatrix3fv("u_dvsMat3", M6.dvs), f5.setUniform1i("u_texture", A), f5.setUniform2fv("u_coordScale", _5), f5.setUniform1f("u_opacity", E7), this._quad.draw(), s10.timeline.end(this.name);
  558. }
  559. };
  560. // node_modules/@arcgis/core/chunks/vec4f32.js
  561. function n5() {
  562. return new Float32Array(4);
  563. }
  564. function t8(n10) {
  565. const t11 = new Float32Array(4);
  566. return t11[0] = n10[0], t11[1] = n10[1], t11[2] = n10[2], t11[3] = n10[3], t11;
  567. }
  568. function r8(n10, t11, r10, e8) {
  569. const a4 = new Float32Array(4);
  570. return a4[0] = n10, a4[1] = t11, a4[2] = r10, a4[3] = e8, a4;
  571. }
  572. function e5(n10, t11) {
  573. return new Float32Array(n10, t11, 4);
  574. }
  575. function a3() {
  576. return n5();
  577. }
  578. function o4() {
  579. return r8(1, 1, 1, 1);
  580. }
  581. function u() {
  582. return r8(1, 0, 0, 0);
  583. }
  584. function s6() {
  585. return r8(0, 1, 0, 0);
  586. }
  587. function c3() {
  588. return r8(0, 0, 1, 0);
  589. }
  590. function i5() {
  591. return r8(0, 0, 0, 1);
  592. }
  593. var f4 = a3();
  594. var l5 = o4();
  595. var _4 = u();
  596. var y = s6();
  597. var w3 = c3();
  598. var N3 = i5();
  599. var O3 = Object.freeze(Object.defineProperty({ __proto__: null, create: n5, clone: t8, fromValues: r8, createView: e5, zeros: a3, ones: o4, unitX: u, unitY: s6, unitZ: c3, unitW: i5, ZEROS: f4, ONES: l5, UNIT_X: _4, UNIT_Y: y, UNIT_Z: w3, UNIT_W: N3 }, Symbol.toStringTag, { value: "Module" }));
  600. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/sources/shaderRepository.js
  601. var e6 = { background: { "background.frag": "uniform lowp vec4 u_color;\nvoid main() {\ngl_FragColor = u_color;\n}", "background.vert": "attribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform mediump vec2 u_coord_range;\nuniform mediump float u_depth;\nvoid main() {\nvec3 v_pos = u_dvsMat3 * vec3(u_coord_range * a_pos, 1.0);\ngl_Position = vec4(v_pos.xy, 0.0, 1.0);\n}" }, bitBlit: { "bitBlit.frag": "uniform lowp sampler2D u_tex;\nuniform lowp float u_opacity;\nvarying mediump vec2 v_uv;\nvoid main() {\nlowp vec4 color = texture2D(u_tex, v_uv);\ngl_FragColor = color * u_opacity;\n}", "bitBlit.vert": "attribute vec2 a_pos;\nattribute vec2 a_tex;\nvarying mediump vec2 v_uv;\nvoid main(void) {\ngl_Position = vec4(a_pos, 0.0, 1.0);\nv_uv = a_tex;\n}" }, blend: { "blend.frag": "precision mediump float;\nuniform sampler2D u_layerTexture;\nuniform lowp float u_opacity;\nuniform lowp float u_inFadeOpacity;\n#ifndef NORMAL\nuniform sampler2D u_backbufferTexture;\n#endif\nvarying mediump vec2 v_uv;\nfloat rgb2v(in vec3 c) {\nreturn max(c.x, max(c.y, c.z));\n}\nvec3 rgb2hsv(in vec3 c) {\nvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\nvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\nfloat d = q.x - min(q.w, q.y);\nfloat e = 1.0e-10;\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);\n}\nvec3 hsv2rgb(in vec3 c) {\nvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\nreturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\nvec3 tint(in vec3 Cb, in vec3 Cs) {\nfloat vIn = rgb2v(Cb);\nvec3 hsvTint = rgb2hsv(Cs);\nvec3 hsvOut = vec3(hsvTint.x, hsvTint.y, vIn * hsvTint.z);\nreturn hsv2rgb(hsvOut);\n}\nfloat overlay(in float Cb, in float Cs) {\nreturn (1.0 - step(0.5, Cs)) * (1.0 - 2.0 * (1.0 - Cs ) * (1.0 - Cb)) + step(0.5, Cs) * (2.0 * Cs * Cb);\n}\nfloat colorDodge(in float Cb, in float Cs) {\nreturn (Cb == 0.0) ? 0.0 : (Cs == 1.0) ? 1.0 : min(1.0, Cb / (1.0 - Cs));\n}\nfloat colorBurn(in float Cb, in float Cs) {\nreturn (Cb == 1.0) ? 1.0 : (Cs == 0.0) ? 0.0 : 1.0 - min(1.0, (1.0 - Cb) / Cs);\n}\nfloat hardLight(in float Cb, in float Cs) {\nreturn (1.0 - step(0.5, Cs)) * (2.0 * Cs * Cb) + step(0.5, Cs) * (1.0 - 2.0 * (1.0 - Cs) * (1.0 - Cb));\n}\nfloat reflectBlend(in float Cb, in float Cs) {\nreturn (Cs == 1.0) ? Cs : min(Cb * Cb / (1.0 - Cs), 1.0);\n}\nfloat softLight(in float Cb, in float Cs) {\nif (Cs <= 0.5) {\nreturn Cb - (1.0 - 2.0 * Cs) * Cb * (1.0 - Cb);\n}\nif (Cb <= 0.25) {\nreturn Cb + (2.0 * Cs - 1.0) * Cb * ((16.0 * Cb - 12.0) * Cb + 3.0);\n}\nreturn Cb + (2.0 * Cs - 1.0) * (sqrt(Cb) - Cb);\n}\nfloat vividLight(in float Cb, in float Cs) {\nreturn (1.0 - step(0.5, Cs)) * colorBurn(Cb, 2.0 * Cs) + step(0.5, Cs) * colorDodge(Cb, (2.0 * (Cs - 0.5)));\n}\nfloat minv3(in vec3 c) {\nreturn min(min(c.r, c.g), c.b);\n}\nfloat maxv3(in vec3 c) {\nreturn max(max(c.r, c.g), c.b);\n}\nfloat lumv3(in vec3 c) {\nreturn dot(c, vec3(0.3, 0.59, 0.11));\n}\nfloat satv3(vec3 c) {\nreturn maxv3(c) - minv3(c);\n}\nvec3 clipColor(vec3 color) {\nfloat lum = lumv3(color);\nfloat mincol = minv3(color);\nfloat maxcol = maxv3(color);\nif (mincol < 0.0) {\ncolor = lum + ((color - lum) * lum) / (lum - mincol);\n}\nif (maxcol > 1.0) {\ncolor = lum + ((color - lum) * (1.0 - lum)) / (maxcol - lum);\n}\nreturn color;\n}\nvec3 setLum(vec3 cbase, vec3 clum) {\nfloat lbase = lumv3(cbase);\nfloat llum = lumv3(clum);\nfloat ldiff = llum - lbase;\nvec3 color = cbase + vec3(ldiff);\nreturn clipColor(color);\n}\nvec3 setLumSat(vec3 cbase, vec3 csat, vec3 clum)\n{\nfloat minbase = minv3(cbase);\nfloat sbase = satv3(cbase);\nfloat ssat = satv3(csat);\nvec3 color;\nif (sbase > 0.0) {\ncolor = (cbase - minbase) * ssat / sbase;\n} else {\ncolor = vec3(0.0);\n}\nreturn setLum(color, clum);\n}\nvoid main() {\nvec4 src = texture2D(u_layerTexture, v_uv);\n#ifdef NORMAL\ngl_FragColor = src * u_opacity;\n#else\nvec4 dst = texture2D(u_backbufferTexture, v_uv);\nvec3 Cs = src.a == 0.0 ? src.rgb : vec3(src.rgb / src.a);\nvec3 Cb = dst.a == 0.0 ? dst.rgb : vec3(dst.rgb / dst.a);\nfloat as = u_opacity * src.a;\nfloat ab = dst.a;\n#ifdef DESTINATION_OVER\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb, as + ab - as * ab);\n#endif\n#ifdef SOURCE_IN\nvec4 color = vec4(as * Cs * ab, as * ab);\nvec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab);\ngl_FragColor = color + fadeColor;\n#endif\n#ifdef DESTINATION_IN\nvec4 color = vec4(ab * Cb * as, ab * as);\nvec4 fadeColor = (1.0 - u_opacity) * u_inFadeOpacity * vec4(ab * Cb, ab);\ngl_FragColor = color + fadeColor;\n#endif\n#ifdef SOURCE_OUT\ngl_FragColor = vec4(as * Cs * (1.0 - ab), as * (1.0 - ab));\n#endif\n#ifdef DESTINATION_OUT\ngl_FragColor = vec4(ab * Cb * (1.0 - as), ab * (1.0 - as));\n#endif\n#ifdef SOURCE_ATOP\ngl_FragColor = vec4(as * Cs * ab + ab * Cb * (1.0 - as), ab);\n#endif\n#ifdef DESTINATION_ATOP\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * as, as);\n#endif\n#ifdef XOR\ngl_FragColor = vec4(as * Cs * (1.0 - ab) + ab * Cb * (1.0 - as),\nas * (1.0 - ab) + ab * (1.0 - as));\n#endif\n#ifdef MULTIPLY\ngl_FragColor = vec4(as * Cs * ab * Cb + (1.0 - ab) * as * Cs + (1.0 - as) * ab * Cb,\nas + ab * (1.0 - as));\n#endif\n#ifdef SCREEN\ngl_FragColor = vec4((Cs + Cb - Cs * Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef OVERLAY\nvec3 f = vec3(overlay(Cb.r, Cs.r), overlay(Cb.g, Cs.g), overlay(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef DARKEN\ngl_FragColor = vec4(min(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef LIGHTER\ngl_FragColor = vec4(as * Cs + ab * Cb, as + ab);\n#endif\n#ifdef LIGHTEN\ngl_FragColor = vec4(max(Cs, Cb) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR_DODGE\nvec3 f = clamp(vec3(colorDodge(Cb.r, Cs.r), colorDodge(Cb.g, Cs.g), colorDodge(Cb.b, Cs.b)), vec3(0.0), vec3(1.0));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR_BURN\nvec3 f = vec3(colorBurn(Cb.r, Cs.r), colorBurn(Cb.g, Cs.g), colorBurn(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef HARD_LIGHT\nvec3 f = vec3(hardLight(Cb.r, Cs.r), hardLight(Cb.g, Cs.g), hardLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef SOFT_LIGHT\nvec3 f = vec3(softLight(Cb.r, Cs.r), softLight(Cb.g, Cs.g), softLight(Cb.b, Cs.b));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef DIFFERENCE\ngl_FragColor = vec4(abs(Cb - Cs) * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef EXCLUSION\nvec3 f = Cs + Cb - 2.0 * Cs * Cb;\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef INVERT\ngl_FragColor = vec4((1.0 - Cb) * as * ab + Cb * ab * (1.0 - as), ab);\n#endif\n#ifdef VIVID_LIGHT\nvec3 f = vec3(clamp(vividLight(Cb.r, Cs.r), 0.0, 1.0),\nclamp(vividLight(Cb.g, Cs.g), 0.0, 1.0),\nclamp(vividLight(Cb.b, Cs.b), 0.0, 1.0));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef HUE\nvec3 f = setLumSat(Cs,Cb,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef SATURATION\nvec3 f = setLumSat(Cb,Cs,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef COLOR\nvec3 f = setLum(Cs,Cb);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef LUMINOSITY\nvec3 f = setLum(Cb,Cs);\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef PLUS\ngl_FragColor = clamp(vec4(src.r + Cb.r, src.g + Cb.g, src.b + Cb.b, as + ab), 0.0, 1.0);\n#endif\n#ifdef MINUS\ngl_FragColor = vec4(clamp(vec3(Cb.r - src.r, Cb.g - src.g, Cb.b - src.b), 0.0, 1.0), ab * as);\n#endif\n#ifdef AVERAGE\nvec3 f = (Cb + Cs) / 2.0;\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#ifdef REFLECT\nvec3 f = clamp(vec3(reflectBlend(Cb.r, Cs.r),\nreflectBlend(Cb.g, Cs.g),\nreflectBlend(Cb.b, Cs.b)), vec3(0.0), vec3(1.0));\ngl_FragColor = vec4(f * as * ab + Cs * as * (1.0 - ab) + Cb * ab *(1.0 - as),\nas + ab * (1.0 - as));\n#endif\n#endif\n}", "blend.vert": "attribute vec2 a_position;\nvarying mediump vec2 v_uv;\nvoid main(void) {\ngl_Position = vec4(a_position , 0.0, 1.0);\nv_uv = (a_position + 1.0) / 2.0;\n}" }, debug: { overlay: { "overlay.frag": "precision mediump float;\nvarying vec4 v_color;\nvoid main(void) {\ngl_FragColor = v_color;\n}", "overlay.vert": "attribute vec3 a_PositionAndFlags;\nuniform mat3 u_dvsMat3;\nuniform vec4 u_colors[4];\nuniform float u_opacities[4];\nvarying vec4 v_color;\nvoid main(void) {\nvec2 position = a_PositionAndFlags.xy;\nfloat flags = a_PositionAndFlags.z;\nint colorIndex = int(mod(flags, 4.0));\nvec4 color;\nfor (int i = 0; i < 4; i++) {\ncolor = u_colors[i];\nif (i == colorIndex) {\nbreak;\n}\n}\nint opacityIndex = int(mod(floor(flags / 4.0), 4.0));\nfloat opacity;\nfor (int i = 0; i < 4; i++) {\nopacity = u_opacities[i];\nif (i == opacityIndex) {\nbreak;\n}\n}\nv_color = color * opacity;\ngl_Position = vec4((u_dvsMat3 * vec3(position, 1.0)).xy, 0.0, 1.0);\n}" } }, dot: { dot: { "dot.frag": "precision mediump float;\nvarying vec4 v_color;\nvarying float v_dotRatio;\nvarying float v_invEdgeRatio;\nuniform highp float u_tileZoomFactor;\nvoid main()\n{\nfloat dist = length(gl_PointCoord - vec2(.5, .5)) * 2.;\nfloat alpha = smoothstep(0., 1., v_invEdgeRatio * (dist - v_dotRatio) + 1.);\ngl_FragColor = v_color * alpha;\n}", "dot.vert": "precision highp float;\nattribute vec2 a_pos;\nuniform sampler2D u_texture;\nuniform highp mat3 u_dvsMat3;\nuniform highp float u_tileZoomFactor;\nuniform highp float u_dotSize;\nuniform highp float u_pixelRatio;\nvarying vec2 v_pos;\nvarying vec4 v_color;\nvarying float v_dotRatio;\nvarying float v_invEdgeRatio;\nconst float EPSILON = 0.000001;\nvoid main()\n{\nmat3 tileToTileTexture = mat3( 1., 0., 0.,\n0., -1., 0.,\n0., 1., 1. );\nvec3 texCoords = tileToTileTexture * vec3(a_pos.xy / 512., 1.);\nv_color = texture2D(u_texture, texCoords.xy);\nfloat smoothEdgeWidth = max(u_dotSize / 2., 1.) ;\nfloat z = 0.;\nz += 2.0 * step(v_color.a, EPSILON);\ngl_PointSize = (smoothEdgeWidth + u_dotSize);\ngl_Position = vec4((u_dvsMat3 * vec3(a_pos + .5, 1.)).xy, z, 1.);\nv_dotRatio = u_dotSize / gl_PointSize;\nv_invEdgeRatio = -1. / ( smoothEdgeWidth / gl_PointSize );\ngl_PointSize *= (u_pixelRatio * u_tileZoomFactor);\n}" } }, filtering: { "bicubic.glsl": "vec4 computeWeights(float v) {\nfloat b = 1.0 / 6.0;\nfloat v2 = v * v;\nfloat v3 = v2 * v;\nfloat w0 = b * (-v3 + 3.0 * v2 - 3.0 * v + 1.0);\nfloat w1 = b * (3.0 * v3 - 6.0 * v2 + 4.0);\nfloat w2 = b * (-3.0 * v3 + 3.0 * v2 + 3.0 * v + 1.0);\nfloat w3 = b * v3;\nreturn vec4(w0, w1, w2, w3);\n}\nvec4 bicubicOffsetsAndWeights(float v) {\nvec4 w = computeWeights(v);\nfloat g0 = w.x + w.y;\nfloat g1 = w.z + w.w;\nfloat h0 = 1.0 - (w.y / g0) + v;\nfloat h1 = 1.0 + (w.w / g1) - v;\nreturn vec4(h0, h1, g0, g1);\n}\nvec4 sampleBicubicBSpline(sampler2D sampler, vec2 coords, vec2 texSize) {\nvec2 eX = vec2(1.0 / texSize.x, 0.0);\nvec2 eY = vec2(0.0, 1.0 / texSize.y);\nvec2 texel = coords * texSize - 0.5;\nvec3 hgX = bicubicOffsetsAndWeights(fract(texel).x).xyz;\nvec3 hgY = bicubicOffsetsAndWeights(fract(texel).y).xyz;\nvec2 coords10 = coords + hgX.x * eX;\nvec2 coords00 = coords - hgX.y * eX;\nvec2 coords11 = coords10 + hgY.x * eY;\nvec2 coords01 = coords00 + hgY.x * eY;\ncoords10 = coords10 - hgY.y * eY;\ncoords00 = coords00 - hgY.y * eY;\nvec4 color00 = texture2D(sampler, coords00);\nvec4 color10 = texture2D(sampler, coords10);\nvec4 color01 = texture2D(sampler, coords01);\nvec4 color11 = texture2D(sampler, coords11);\ncolor00 = mix(color00, color01, hgY.z);\ncolor10 = mix(color10, color11, hgY.z);\ncolor00 = mix(color00, color10, hgX.z);\nreturn color00;\n}", "bilinear.glsl": "vec4 sampleBilinear(sampler2D sampler, vec2 coords, vec2 texSize) {\nvec2 texelStart = floor(coords * texSize);\nvec2 coord0 = texelStart / texSize;\nvec2 coord1 = (texelStart + vec2(1.0, 0.0)) / texSize;\nvec2 coord2 = (texelStart + vec2(0.0, 1.0)) / texSize;\nvec2 coord3 = (texelStart + vec2(1.0, 1.0)) / texSize;\nvec4 color0 = texture2D(sampler, coord0);\nvec4 color1 = texture2D(sampler, coord1);\nvec4 color2 = texture2D(sampler, coord2);\nvec4 color3 = texture2D(sampler, coord3);\nvec2 blend = fract(coords * texSize);\nvec4 color01 = mix(color0, color1, blend.x);\nvec4 color23 = mix(color2, color3, blend.x);\nvec4 color = mix(color01, color23, blend.y);\n#ifdef NNEDGE\nfloat alpha = floor(color0.a * color1.a * color2.a * color3.a + 0.5);\ncolor = color * alpha + (1.0 - alpha) * texture2D(sampler, coords);\n#endif\nreturn color;\n}", "epx.glsl": "vec4 sampleEPX(sampler2D sampler, float size, vec2 coords, vec2 texSize) {\nvec2 invSize = 1.0 / texSize;\nvec2 texel = coords * texSize;\nvec2 texel_i = floor(texel);\nvec2 texel_frac = fract(texel);\nvec4 colorP = texture2D(sampler, texel_i * invSize);\nvec4 colorP1 = vec4(colorP);\nvec4 colorP2 = vec4(colorP);\nvec4 colorP3 = vec4(colorP);\nvec4 colorP4 = vec4(colorP);\nvec4 colorA = texture2D(sampler, (texel_i - vec2(0.0, 1.0)) * invSize);\nvec4 colorB = texture2D(sampler, (texel_i + vec2(1.0, 0.0)) * invSize);\nvec4 colorC = texture2D(sampler, (texel_i - vec2(1.0, 0.0)) * invSize);\nvec4 colorD = texture2D(sampler, (texel_i + vec2(0.0, 1.0)) * invSize);\nif (colorC == colorA && colorC != colorD && colorA != colorB) {\ncolorP1 = colorA;\n}\nif (colorA == colorB && colorA != colorC && colorB != colorD) {\ncolorP2 = colorB;\n}\nif (colorD == colorC && colorD != colorB && colorC != colorA) {\ncolorP3 = colorC;\n}\nif (colorB == colorD && colorB != colorA && colorD != colorC) {\ncolorP4 = colorD;\n}\nvec4 colorP12 = mix(colorP1, colorP2, texel_frac.x);\nvec4 colorP34 = mix(colorP1, colorP2, texel_frac.x);\nreturn mix(colorP12, colorP34, texel_frac.y);\n}" }, fx: { integrate: { "integrate.frag": "precision mediump float;\nuniform lowp sampler2D u_sourceTexture;\nuniform lowp sampler2D u_maskTexture;\nuniform mediump float u_zoomLevel;\nuniform highp float u_timeDelta;\nuniform highp float u_animationTime;\nvarying highp vec2 v_texcoord;\n#include <materials/utils.glsl>\nvoid main()\n{\n#ifdef DELTA\nvec4 texel = texture2D(u_sourceTexture, v_texcoord);\nvec4 data0 = texture2D(u_maskTexture, v_texcoord);\nfloat flags = data0.r * 255.0;\nfloat groupMinZoom = data0.g * 255.0;\nfloat isVisible = getFilterBit(flags, 0);\nfloat wouldClip = step(groupMinZoom, u_zoomLevel);\nfloat direction = wouldClip * 1.0 + (1.0 - wouldClip) * -1.0;\nfloat dt = u_timeDelta / max(u_animationTime, 0.0001);\nvec4 nextState = vec4(texel + direction * dt);\ngl_FragColor = vec4(nextState);\n#elif defined(UPDATE)\nvec4 texel = texture2D(u_sourceTexture, v_texcoord);\ngl_FragColor = texel;\n#endif\n}", "integrate.vert": "precision mediump float;\nattribute vec2 a_pos;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n}" } }, heatmap: { heatmapResolve: { "heatmapResolve.frag": "precision highp float;\n#ifdef HEATMAP_PRECISION_HALF_FLOAT\n#define COMPRESSION_FACTOR 4.0\n#else\n#define COMPRESSION_FACTOR 1.0\n#endif\nuniform sampler2D u_texture;\nuniform sampler2D u_gradient;\nuniform vec2 u_densityMinAndInvRange;\nuniform float u_densityNormalization;\nvarying vec2 v_uv;\nvoid main() {\nvec4 data = texture2D(u_texture, v_uv);\nfloat density = data.r * COMPRESSION_FACTOR;\ndensity *= u_densityNormalization;\ndensity = (density - u_densityMinAndInvRange.x) * u_densityMinAndInvRange.y;\nvec4 color = texture2D(u_gradient, vec2(density, 0.5));\ngl_FragColor = vec4(color.rgb * color.a, color.a);\n}", "heatmapResolve.vert": "precision highp float;\nattribute vec2 a_pos;\nvarying vec2 v_uv;\nvoid main() {\nv_uv = a_pos;\ngl_Position = vec4(a_pos * 2.0 - 1.0, 1., 1.);\n}" } }, highlight: { "blur.frag": "varying mediump vec2 v_texcoord;\nuniform mediump vec4 u_direction;\nuniform mediump mat4 u_channelSelector;\nuniform mediump float u_sigma;\nuniform sampler2D u_texture;\nmediump float gauss1(mediump vec2 dir) {\nreturn exp(-dot(dir, dir) / (2.0 * u_sigma * u_sigma));\n}\nmediump vec4 selectChannel(mediump vec4 sample) {\nreturn u_channelSelector * sample;\n}\nvoid accumGauss1(mediump float i, inout mediump float tot, inout mediump float weight) {\nmediump float w = gauss1(i * u_direction.xy);\ntot += selectChannel(texture2D(u_texture, v_texcoord + i * u_direction.zw))[3] * w;\nweight += w;\n}\nvoid main(void) {\nmediump float tot = 0.0;\nmediump float weight = 0.0;\naccumGauss1(-5.0, tot, weight);\naccumGauss1(-4.0, tot, weight);\naccumGauss1(-3.0, tot, weight);\naccumGauss1(-2.0, tot, weight);\naccumGauss1(-1.0, tot, weight);\naccumGauss1(0.0, tot, weight);\naccumGauss1(1.0, tot, weight);\naccumGauss1(2.0, tot, weight);\naccumGauss1(3.0, tot, weight);\naccumGauss1(4.0, tot, weight);\naccumGauss1(5.0, tot, weight);\ngl_FragColor = vec4(0.0, 0.0, 0.0, tot / weight);\n}", "highlight.frag": "varying mediump vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform mediump float u_sigma;\nuniform sampler2D u_shade;\nuniform mediump vec2 u_minMaxDistance;\nmediump float estimateDistance() {\nmediump float y = texture2D(u_texture, v_texcoord)[3];\nconst mediump float y0 = 0.5;\nmediump float m0 = 1.0 / (sqrt(2.0 * 3.1415) * u_sigma);\nmediump float d = (y - y0) / m0;\nreturn d;\n}\nmediump vec4 shade(mediump float d) {\nmediump float mappedDistance = (d - u_minMaxDistance.x) / (u_minMaxDistance.y - u_minMaxDistance.x);\nmappedDistance = clamp(mappedDistance, 0.0, 1.0);\nreturn texture2D(u_shade, vec2(mappedDistance, 0.5));\n}\nvoid main(void) {\nmediump float d = estimateDistance();\ngl_FragColor = shade(d);\n}", "textured.vert": "attribute mediump vec2 a_position;\nattribute mediump vec2 a_texcoord;\nvarying mediump vec2 v_texcoord;\nvoid main(void) {\ngl_Position = vec4(a_position, 0.0, 1.0);\nv_texcoord = a_texcoord;\n}" }, magnifier: { "magnifier.frag": "uniform lowp vec4 u_background;\nuniform mediump sampler2D u_readbackTexture;\nuniform mediump sampler2D u_maskTexture;\nuniform mediump sampler2D u_overlayTexture;\nuniform bool u_maskEnabled;\nuniform bool u_overlayEnabled;\nvarying mediump vec2 v_texCoord;\nconst lowp float barrelFactor = 1.1;\nlowp vec2 barrel(lowp vec2 uv) {\nlowp vec2 uvn = uv * 2.0 - 1.0;\nif (uvn.x == 0.0 && uvn.y == 0.0) {\nreturn vec2(0.5, 0.5);\n}\nlowp float theta = atan(uvn.y, uvn.x);\nlowp float r = pow(length(uvn), barrelFactor);\nreturn r * vec2(cos(theta), sin(theta)) * 0.5 + 0.5;\n}\nvoid main(void)\n{\nlowp vec4 color = texture2D(u_readbackTexture, barrel(v_texCoord));\ncolor = (color + (1.0 - color.a) * u_background);\nlowp float mask = u_maskEnabled ? texture2D(u_maskTexture, v_texCoord).a : 1.0;\ncolor *= mask;\nlowp vec4 overlayColor = u_overlayEnabled ? texture2D(u_overlayTexture, v_texCoord) : vec4(0);\ngl_FragColor = overlayColor + (1.0 - overlayColor.a) * color;\n}", "magnifier.vert": "precision mediump float;\nattribute mediump vec2 a_pos;\nuniform mediump vec4 u_drawPos;\nvarying mediump vec2 v_texCoord;\nvoid main(void)\n{\nv_texCoord = a_pos;\ngl_Position = vec4(u_drawPos.xy + vec2(a_pos - 0.5) * u_drawPos.zw, 0.0, 1.0);\n}" }, materials: { "attributeData.glsl": "uniform highp sampler2D u_attributeData0;\nuniform highp sampler2D u_attributeData1;\nuniform highp sampler2D u_attributeData2;\nuniform highp sampler2D u_attributeData3;\nuniform highp sampler2D u_attributeData4;\nuniform highp sampler2D u_attributeData5;\nuniform highp int u_attributeTextureSize;\nhighp vec2 getAttributeDataCoords(in highp vec3 id) {\nhighp vec3 texel = unpackDisplayIdTexel(id);\nhighp float size = float(u_attributeTextureSize);\nhighp float u32 = float(int(texel.r) + int(texel.g) * 256 + int(texel.b) * 256 * 256);\nhighp float col = mod(u32, size);\nhighp float row = (u32 - col) / size;\nhighp float u = col / size;\nhighp float v = row / size;\nreturn vec2(u, v);\n}\nhighp vec2 getAttributeDataTextureCoords(in highp vec3 id) {\nreturn (getAttributeDataCoords(id) * 2.0) - 1.0 + (.5 / vec2(u_attributeTextureSize));\n}\nhighp vec4 getAttributeData0(in highp vec3 id) {\nvec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData0, coords);\n}\nhighp vec4 getAttributeData1(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData1, coords);\n}\nhighp vec4 getAttributeData2(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData2, coords);\n}\nhighp vec4 getAttributeData3(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData3, coords);\n}\nhighp vec4 getAttributeData4(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData4, coords);\n}\nhighp vec4 getAttributeData5(in highp vec3 id) {\nhighp vec2 coords = getAttributeDataCoords(id);\nreturn texture2D(u_attributeData5, coords);\n}\nfloat u88VVToFloat(in vec2 v) {\nbool isMagic = v.x == 255.0 && v.y == 255.0;\nif (isMagic) {\nreturn NAN_MAGIC_NUMBER;\n}\nreturn (v.x + v.y * float(0x100)) - 32768.0;\n}", "barycentric.glsl": "float inTriangle(vec3 bary) {\nvec3 absBary = abs(bary);\nreturn step((absBary.x + absBary.y + absBary.z), 1.05);\n}\nvec3 xyToBarycentric(in vec2 pos, in vec2 v0, in vec2 v1, in vec2 v2) {\nmat3 xyToBarycentricMat3 = mat3(\nv1.x * v2.y - v2.x * v1.y, v2.x * v0.y - v0.x * v2.y, v0.x * v1.y - v1.x * v0.y,\nv1.y - v2.y, v2.y - v0.y, v0.y - v1.y,\nv2.x - v1.x, v0.x - v2.x, v1.x - v0.x\n);\nfloat A2 = v0.x * (v1.y - v2.y) + v1.x * (v2.y - v0.y) + v2.x * (v0.y - v1.y);\nreturn (1. / A2) * xyToBarycentricMat3 * vec3(1., pos);\n}", "constants.glsl": "const float C_DEG_TO_RAD = 3.14159265359 / 180.0;\nconst float C_256_TO_RAD = 3.14159265359 / 128.0;\nconst float C_RAD_TO_DEG = 180.0 / 3.141592654;\nconst float POSITION_PRECISION = 1.0 / 8.0;\nconst float FILL_POSITION_PRECISION = 1.0 / 1.0;\nconst float SOFT_EDGE_RATIO = 1.0;\nconst float THIN_LINE_WIDTH_FACTOR = 1.1;\nconst float THIN_LINE_HALF_WIDTH = 1.0;\nconst float EXTRUDE_SCALE_PLACEMENT_PADDING = 1.0 / 4.0;\nconst float OFFSET_PRECISION = 1.0 / 8.0;\nconst float OUTLINE_SCALE = 1.0 / 5.0;\nconst float SDF_FONT_SIZE = 24.0;\nconst float MAX_SDF_DISTANCE = 8.0;\nconst float PLACEMENT_PADDING = 8.0;\nconst float EPSILON = 0.00001;\nconst float EPSILON_HITTEST = 0.05;\nconst int MAX_FILTER_COUNT = 2;\nconst int ATTR_VV_SIZE = 0;\nconst int ATTR_VV_COLOR = 1;\nconst int ATTR_VV_OPACITY = 2;\nconst int ATTR_VV_ROTATION = 3;\nconst highp float NAN_MAGIC_NUMBER = 1e-30;\nconst int BITSET_GENERIC_LOCK_COLOR = 1;\nconst int BITSET_GENERIC_CONSIDER_ALPHA_ONLY = 4;\nconst int BITSET_MARKER_ALIGNMENT_MAP = 0;\nconst int BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE = 2;\nconst int BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY = 3;\nconst int BITSET_TYPE_FILL_OUTLINE = 0;\nconst int BITSET_FILL_RANDOM_PATTERN_OFFSET = 2;\nconst int BITSET_LINE_SCALE_DASH = 2;", fill: { "common.glsl": "#include <materials/symbologyTypeUtils.glsl>\n#ifdef PATTERN\nuniform mediump vec2 u_mosaicSize;\nvarying mediump float v_sampleAlphaOnly;\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nuniform lowp vec4 u_isActive[ 2 ];\nuniform highp float u_dotValue;\nuniform highp float u_tileDotsOverArea;\nuniform highp float u_dotTextureDotCount;\nuniform mediump float u_tileZoomFactor;\n#endif\nvarying highp vec3 v_id;\nvarying lowp vec4 v_color;\nvarying lowp float v_opacity;\nvarying mediump vec4 v_aux1;\n#ifdef PATTERN\nvarying mediump vec2 v_tileTextureCoord;\n#endif\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nvarying lowp float v_isOutline;\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nvarying highp vec2 v_dotTextureCoords;\nvarying highp vec4 v_dotThresholds[ 2 ];\n#endif", "fill.frag": "precision highp float;\n#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/fill/common.glsl>\n#ifdef PATTERN\nuniform lowp sampler2D u_texture;\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nuniform mediump mat4 u_dotColors[ 2 ];\nuniform sampler2D u_dotTextures[ 2 ];\nuniform vec4 u_dotBackgroundColor;\n#endif\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.frag>\nlowp vec4 drawLine() {\nfloat v_lineWidth = v_aux1.x;\nvec2 v_normal = v_aux1.yz;\nLineData inputs = LineData(\nv_color,\nv_normal,\nv_lineWidth,\nv_opacity,\nv_id\n);\nreturn shadeLine(inputs);\n}\n#endif\nlowp vec4 drawFill() {\nlowp vec4 out_color = vec4(0.);\n#ifdef HITTEST\nout_color = v_color;\n#elif defined(PATTERN)\nmediump vec4 v_tlbr = v_aux1;\nmediump vec2 normalizedTextureCoord = mod(v_tileTextureCoord, 1.0);\nmediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord);\nlowp vec4 color = texture2D(u_texture, samplePos);\n#ifdef VV_COLOR\nif (v_sampleAlphaOnly > 0.5) {\ncolor.rgb = vec3(color.a);\n}\n#endif\nout_color = v_opacity * v_color * color;\n#elif SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY && !defined(HIGHLIGHT)\nvec4 textureThresholds0 = texture2D(u_dotTextures[0], v_dotTextureCoords);\nvec4 textureThresholds1 = texture2D(u_dotTextures[1], v_dotTextureCoords);\nvec4 difference0 = v_dotThresholds[0] - textureThresholds0;\nvec4 difference1 = v_dotThresholds[1] - textureThresholds1;\n#ifdef DD_DOT_BLENDING\nvec4 isPositive0 = step(0.0, difference0);\nvec4 isPositive1 = step(0.0, difference1);\nfloat weightSum = dot(isPositive0, difference0) + dot(isPositive1, difference1);\nfloat lessThanEqZero = step(weightSum, 0.0);\nfloat greaterThanZero = 1.0 - lessThanEqZero ;\nfloat divisor = (weightSum + lessThanEqZero);\nvec4 weights0 = difference0 * isPositive0 / divisor;\nvec4 weights1 = difference1 * isPositive1 / divisor;\nvec4 dotColor = u_dotColors[0] * weights0 + u_dotColors[1] * weights1;\nvec4 preEffectColor = greaterThanZero * dotColor + lessThanEqZero * u_dotBackgroundColor;\n#else\nfloat diffMax = max(max4(difference0), max4(difference1));\nfloat lessThanZero = step(diffMax, 0.0);\nfloat greaterOrEqZero = 1.0 - lessThanZero;\nvec4 isMax0 = step(diffMax, difference0);\nvec4 isMax1 = step(diffMax, difference1);\nvec4 dotColor = u_dotColors[0] * isMax0 + u_dotColors[1] * isMax1;\nvec4 preEffectColor = greaterOrEqZero * dotColor + lessThanZero * u_dotBackgroundColor;\n#endif\nout_color = preEffectColor;\n#else\nout_color = v_opacity * v_color;\n#endif\n#ifdef HIGHLIGHT\nout_color.a = 1.0;\n#endif\nreturn out_color;\n}\nvoid main() {\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nif (v_isOutline > 0.5) {\ngl_FragColor = drawLine();\n} else {\ngl_FragColor = drawFill();\n}\n#else\ngl_FragColor = drawFill();\n#endif\n}", "fill.vert": "#include <materials/symbologyTypeUtils.glsl>\n#define PACKED_LINE\nprecision highp float;\nattribute float a_bitset;\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nattribute float a_inverseArea;\nvec4 a_color = vec4(0.0, 0.0, 0.0, 1.0);\nvec2 a_zoomRange = vec2(0.0, 10000.0);\n#else\nattribute vec4 a_color;\nattribute vec4 a_aux2;\nattribute vec4 a_aux3;\n#ifndef SYMBOLOGY_TYPE_IS_SIMPLE_LIKE\nattribute vec4 a_aux1;\nattribute vec2 a_zoomRange;\n#else\nvec2 a_zoomRange = vec2(0.0, 10000.0);\n#endif\n#endif\nuniform vec2 u_tileOffset;\n#include <util/encoding.glsl>\n#include <materials/vcommon.glsl>\n#include <materials/fill/common.glsl>\n#include <materials/fill/hittest.glsl>\nconst float INV_SCALE_COMPRESSION_FACTOR = 1.0 / 128.0;\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nvec4 dotThreshold(vec4 featureAttrOverFeatureArea, float dotValue, float tileDotsOverArea) {\nreturn featureAttrOverFeatureArea * (1.0 / dotValue) * (1.0 / tileDotsOverArea);\n}\n#endif\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.vert>\nvoid drawLine(out lowp vec4 out_color, out highp vec3 out_pos) {\nLineData outputs = buildLine(\nout_pos,\na_id,\na_pos,\na_color,\n(a_aux3.xy - 128.) / 16.,\n(a_aux3.zw - 128.) / 16.,\n0.,\na_aux2.z / 16.,\na_bitset,\nvec4(0.),\nvec2(0.),\na_aux2.w / 16.\n);\nv_id = outputs.id;\nv_opacity = outputs.opacity;\nv_aux1 = vec4(outputs.lineHalfWidth, outputs.normal, 0.);\nout_color = outputs.color;\n}\n#endif\nvoid drawFill(out lowp vec4 out_color, out highp vec3 out_pos) {\nfloat a_bitSet = a_bitset;\nout_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR);\nv_opacity = getOpacity();\nv_id = norm(a_id);\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nmat3 tileToTileNormalized = mat3( 2. / 512., 0., 0.,\n0., -2. / 512., 0.,\n-1., 1., 1. );\nout_pos = tileToTileNormalized * vec3((a_pos * FILL_POSITION_PRECISION), 1.);\n#else\nout_pos = u_dvsMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.);\n#endif\n#ifdef PATTERN\nvec4 a_tlbr = a_aux1;\nfloat a_width = a_aux2.x;\nfloat a_height = a_aux2.y;\nvec2 a_offset = a_aux2.zw;\nvec2 a_scale = a_aux3.xy;\nfloat a_angle = a_aux3.z;\nvec2 scale = INV_SCALE_COMPRESSION_FACTOR * a_scale;\nfloat width = u_zoomFactor * a_width * scale.x;\nfloat height = u_zoomFactor * a_height * scale.y;\nfloat angle = C_256_TO_RAD * a_angle;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nfloat dx = 0.0;\nfloat dy = 0.0;\nif (getBit(a_bitset, BITSET_FILL_RANDOM_PATTERN_OFFSET) > 0.5) {\nfloat id = rgba2float(vec4(a_id, 0.0));\ndx = rand(vec2(id, 0.0));\ndy = rand(vec2(0.0, id));\n}\nmat3 patternMatrix = mat3(cosA / width, sinA / height, 0,\n-sinA / width, cosA / height, 0,\ndx, dy, 1);\nvec2 tileOffset = vec2(u_tileOffset.x * cosA - u_tileOffset.y * sinA, u_tileOffset.x * sinA + u_tileOffset.y * cosA);\ntileOffset = mod(tileOffset, vec2(a_aux2.x, a_aux2.y));\nvec2 symbolOffset = (a_offset - tileOffset) / vec2(width, height);\nv_tileTextureCoord = (patternMatrix * vec3(a_pos * FILL_POSITION_PRECISION, 1.0)).xy - symbolOffset;\nv_aux1 = a_tlbr / u_mosaicSize.xyxy;\nv_sampleAlphaOnly = getBit(a_bitset, BITSET_GENERIC_CONSIDER_ALPHA_ONLY);\n#elif SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_DOT_DENSITY\nvec4 ddAttributeData0 = getAttributeData2(a_id) * u_isActive[0] * a_inverseArea;\nvec4 ddAttributeData1 = getAttributeData3(a_id) * u_isActive[1] * a_inverseArea;\nfloat size = u_tileZoomFactor * 512.0 * 1.0 / u_pixelRatio;\nv_dotThresholds[0] = dotThreshold(ddAttributeData0, u_dotValue, u_tileDotsOverArea);\nv_dotThresholds[1] = dotThreshold(ddAttributeData1, u_dotValue, u_tileDotsOverArea);\nv_dotTextureCoords = (a_pos * FILL_POSITION_PRECISION + 0.5) / size;\n#endif\n}\n#ifdef HITTEST\nvoid draw(out lowp vec4 out_color, out highp vec3 out_pos) {\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nif (getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE) > 0.5) {\nout_pos = vec3(0., 0., 2.);\nreturn;\n}\n#endif\nhittestFill(out_color, out_pos);\ngl_PointSize = 1.0;\n}\n#elif defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE)\nvoid draw(out lowp vec4 out_color, out highp vec3 out_pos) {\nv_isOutline = getBit(a_bitset, BITSET_TYPE_FILL_OUTLINE);\nif (v_isOutline > 0.5) {\ndrawLine(out_color, out_pos);\n} else {\ndrawFill(out_color, out_pos);\n}\n}\n#else\n#define draw drawFill\n#endif\nvoid main()\n{\nINIT;\nhighp vec3 pos = vec3(0.);\nhighp vec4 color = vec4(0.);\ndraw(color, pos);\nv_color = color;\ngl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}", "hittest.glsl": "#ifdef HITTEST\n#include <materials/hittest/common.glsl>\nattribute vec2 a_pos1;\nattribute vec2 a_pos2;\nvoid hittestFill(\nout lowp vec4 out_color,\nout highp vec3 out_pos\n) {\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * FILL_POSITION_PRECISION, 1.);\nvec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * FILL_POSITION_PRECISION, 1.);\nvec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * FILL_POSITION_PRECISION, 1.);\nfloat hittestDist = u_hittestDist;\nfloat dist = distPointTriangle(u_hittestPos, pos.xy, pos1.xy, pos2.xy);\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nif (dist < 0. || dist >= hittestDist) {\nout_pos.z += 2.0;\n}\nout_color = vec4(1. / 255., 0, 0, dist == 0. ? (1. / 255.) : 0.);\n}\n#endif" }, hittest: { "common.glsl": "#ifdef HITTEST\nuniform float u_hittestDist;\nuniform highp vec2 u_hittestPos;\nfloat projectScalar(vec2 a, vec2 b) {\nreturn dot(a, normalize(b));\n}\nfloat distPointSegment(vec2 p0, vec2 p1, vec2 p2) {\nvec2 L = p2 - p1;\nvec2 A = p0 - p1;\nfloat projAL = projectScalar(A, L);\nfloat t = clamp(projAL / length(L), 0., 1.);\nreturn distance(p0, p1 + t * (p2 - p1));\n}\nvoid hittestMarker(out lowp vec4 out_color, out highp vec3 out_pos, in highp vec3 pos, float size) {\nfloat dist = distance(pos, vec3(u_hittestPos, 1.));\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nif ((dist - size) > u_hittestDist) {\nout_pos.z += 2.0;\n}\nout_color = vec4(1. / 255., 0, 0, (dist - size) < 0. ? (1. / 255.) : 0.);\n}\nfloat intersectPointTriangleBary(vec2 p, vec2 a, vec2 b, vec2 c) {\nreturn inTriangle(xyToBarycentric(p, a, b, c));\n}\nfloat distPointTriangle(vec2 p, vec2 a, vec2 b, vec2 c) {\nvec2 ba = b - a;\nvec2 ca = c - a;\nfloat crossProduct = ba.x * ca.y - ca.x * ba.y;\nbool isParallel = crossProduct < EPSILON_HITTEST && crossProduct > -EPSILON_HITTEST;\nif (isParallel) {\nreturn -1.;\n}\nif (intersectPointTriangleBary(p.xy, a, b, c) == 1.) {\nreturn 0.;\n}\nfloat distAB = distPointSegment(p, a, b);\nfloat distBC = distPointSegment(p, b, c);\nfloat distCA = distPointSegment(p, c, a);\nreturn min(min(distAB, distBC), distCA);\n}\n#endif" }, icon: { "common.glsl": "#include <util/encoding.glsl>\nuniform lowp vec2 u_mosaicSize;\nvarying lowp vec4 v_color;\nvarying highp vec3 v_id;\nvarying highp vec4 v_sizeTex;\nvarying mediump vec3 v_pos;\nvarying lowp float v_opacity;\nuniform lowp sampler2D u_texture;\n#ifdef SDF\nvarying lowp vec4 v_outlineColor;\nvarying mediump float v_outlineWidth;\nvarying mediump float v_distRatio;\nvarying mediump float v_overridingOutlineColor;\nvarying mediump float v_isThin;\n#endif\n#ifdef SDF\nvec4 getColor(vec2 v_size, vec2 v_tex) {\nlowp vec4 fillPixelColor = v_color;\nfloat d = 0.5 - rgba2float(texture2D(u_texture, v_tex));\nfloat size = max(v_size.x, v_size.y);\nfloat dist = d * size * SOFT_EDGE_RATIO * v_distRatio;\nfillPixelColor *= clamp(0.5 - dist, 0.0, 1.0);\nfloat outlineWidth = v_outlineWidth;\n#ifdef HIGHLIGHT\noutlineWidth = max(outlineWidth, 4.0 * v_isThin);\n#endif\nif (outlineWidth > 0.25) {\nlowp vec4 outlinePixelColor = v_overridingOutlineColor * v_color + (1.0 - v_overridingOutlineColor) * v_outlineColor;\nfloat clampedOutlineSize = min(outlineWidth, size);\noutlinePixelColor *= clamp(0.5 - abs(dist) + clampedOutlineSize * 0.5, 0.0, 1.0);\nreturn v_opacity * ((1.0 - outlinePixelColor.a) * fillPixelColor + outlinePixelColor);\n}\nreturn v_opacity * fillPixelColor;\n}\n#else\nvec4 getColor(vec2 _v_size, vec2 v_tex) {\nlowp vec4 texColor = texture2D(u_texture, v_tex);\nreturn v_opacity * texColor * v_color;\n}\n#endif", heatmapAccumulate: { "common.glsl": "varying lowp vec4 v_hittestResult;\nvarying mediump vec2 v_offsetFromCenter;\nvarying highp float v_fieldValue;", "heatmapAccumulate.frag": "precision mediump float;\n#include <materials/icon/heatmapAccumulate/common.glsl>\n#ifdef HEATMAP_PRECISION_HALF_FLOAT\n#define COMPRESSION_FACTOR 0.25\n#else\n#define COMPRESSION_FACTOR 1.0\n#endif\nuniform lowp sampler2D u_texture;\nvoid main() {\n#ifdef HITTEST\ngl_FragColor = v_hittestResult;\n#else\nfloat radius = length(v_offsetFromCenter);\nfloat shapeWeight = step(radius, 1.0);\nfloat oneMinusRadiusSquared = 1.0 - radius * radius;\nfloat kernelWeight = oneMinusRadiusSquared * oneMinusRadiusSquared;\ngl_FragColor = vec4(shapeWeight * kernelWeight * v_fieldValue * COMPRESSION_FACTOR);\n#endif\n}", "heatmapAccumulate.vert": "precision highp float;\nattribute vec2 a_vertexOffset;\nvec4 a_color = vec4(0.0);\nvec2 a_zoomRange = vec2(0.0, 10000.0);\nuniform float u_radius;\nuniform float u_isFieldActive;\n#include <materials/vcommon.glsl>\n#include <materials/hittest/common.glsl>\n#include <materials/icon/heatmapAccumulate/common.glsl>\nvoid main() {\nfloat filterFlags = getFilterFlags();\n#ifdef HITTEST\nhighp vec4 out_hittestResult = vec4(0.);\nhighp vec3 out_pos = vec3(0.);\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.0);\nhittestMarker(out_hittestResult, out_pos, pos, u_radius);\nv_hittestResult = out_hittestResult;\ngl_PointSize = 1.;\ngl_Position = vec4(clip(a_color, out_pos, filterFlags, a_zoomRange), 1.0);\n#else\nv_offsetFromCenter = sign(a_vertexOffset);\nv_fieldValue = getAttributeData2(a_id).x * u_isFieldActive + 1.0 - u_isFieldActive;\nvec3 centerPos = u_dvsMat3 * vec3(a_pos * POSITION_PRECISION, 1.0);\nvec3 vertexPos = centerPos + u_displayViewMat3 * vec3(v_offsetFromCenter, 0.0) * u_radius;\ngl_Position = vec4(clip(a_color, vertexPos, filterFlags, a_zoomRange), 1.0);\n#endif\n}" }, "hittest.glsl": "#ifdef HITTEST\n#include <materials/hittest/common.glsl>\nattribute vec2 a_vertexOffset1;\nattribute vec2 a_vertexOffset2;\nattribute vec2 a_texCoords1;\nattribute vec2 a_texCoords2;\nvec2 getTextureCoords(in vec3 bary, in vec2 texCoords0, in vec2 texCoords1, in vec2 texCoords2) {\nreturn texCoords0 * bary.x + texCoords1 * bary.y + texCoords2 * bary.z;\n}\nvoid hittestIcon(\ninout lowp vec4 out_color,\nout highp vec3 out_pos,\nin vec3 pos,\nin vec3 offset,\nin vec2 size,\nin float scaleFactor,\nin float isMapAligned\n) {\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nvec3 posBase = u_viewMat3 * u_tileMat3 * pos;\nvec3 offset1 = scaleFactor * vec3(a_vertexOffset1 / 16.0, 0.);\nvec3 offset2 = scaleFactor * vec3(a_vertexOffset2 / 16.0, 0.);\nvec2 pos0 = (posBase + getMatrixNoDisplay(isMapAligned) * offset).xy;\nvec2 pos1 = (posBase + getMatrixNoDisplay(isMapAligned) * offset1).xy;\nvec2 pos2 = (posBase + getMatrixNoDisplay(isMapAligned) * offset2).xy;\nvec3 bary0 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, -u_hittestDist), pos0, pos1, pos2);\nvec3 bary1 = xyToBarycentric(u_hittestPos + vec2(0., -u_hittestDist), pos0, pos1, pos2);\nvec3 bary2 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, -u_hittestDist), pos0, pos1, pos2);\nvec3 bary3 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, 0.), pos0, pos1, pos2);\nvec3 bary4 = xyToBarycentric(u_hittestPos, pos0, pos1, pos2);\nvec3 bary5 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, 0.), pos0, pos1, pos2);\nvec3 bary6 = xyToBarycentric(u_hittestPos + vec2(-u_hittestDist, u_hittestDist), pos0, pos1, pos2);\nvec3 bary7 = xyToBarycentric(u_hittestPos + vec2(0., u_hittestDist), pos0, pos1, pos2);\nvec3 bary8 = xyToBarycentric(u_hittestPos + vec2(u_hittestDist, u_hittestDist), pos0, pos1, pos2);\nvec2 tex0 = a_texCoords / u_mosaicSize;\nvec2 tex1 = a_texCoords1 / u_mosaicSize;\nvec2 tex2 = a_texCoords2 / u_mosaicSize;\nfloat alphaSum = 0.;\nalphaSum += inTriangle(bary0) * getColor(size, getTextureCoords(bary0, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary1) * getColor(size, getTextureCoords(bary1, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary2) * getColor(size, getTextureCoords(bary2, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary3) * getColor(size, getTextureCoords(bary3, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary4) * getColor(size, getTextureCoords(bary4, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary5) * getColor(size, getTextureCoords(bary5, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary6) * getColor(size, getTextureCoords(bary6, tex0, tex1, tex2)).a;\nalphaSum += inTriangle(bary7) * getColor(size, getTextureCoords(bary7, tex0, tex1, tex2)).a;\nout_pos.z += step(alphaSum, .05) * 2.0;\nout_color = vec4(1. / 255., 0., 0., alphaSum / 255.);\n}\n#endif", "icon.frag": "precision mediump float;\n#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/icon/common.glsl>\nvoid main()\n{\n#ifdef HITTEST\nvec4 color = v_color;\n#else\nvec4 color = getColor(v_sizeTex.xy, v_sizeTex.zw);\n#endif\n#ifdef HIGHLIGHT\ncolor.a = step(1.0 / 255.0, color.a);\n#endif\ngl_FragColor = color;\n}", "icon.vert": "precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_outlineColor;\nattribute vec4 a_sizeAndOutlineWidth;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nattribute vec2 a_bitSetAndDistRatio;\nattribute vec2 a_zoomRange;\n#include <materials/vcommon.glsl>\n#include <materials/icon/common.glsl>\n#include <materials/icon/hittest.glsl>\nfloat getMarkerScaleFactor(inout vec2 size, in float referenceSize) {\n#ifdef VV_SIZE\nfloat f = getSize(size.y) / size.y;\nfloat sizeFactor = size.y / referenceSize;\nreturn getSize(referenceSize) / referenceSize;\n#else\nreturn 1.;\n#endif\n}\nvoid main()\n{\nINIT;\nfloat a_bitSet = a_bitSetAndDistRatio.x;\nvec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nvec2 size = a_sizeAndOutlineWidth.xy * a_sizeAndOutlineWidth.xy / 128.0;\nvec3 offset = vec3(a_vertexOffset / 16.0, 0.);\nfloat outlineSize = a_sizeAndOutlineWidth.z * a_sizeAndOutlineWidth.z / 128.0;\nfloat isMapAligned = getBit(a_bitSet, BITSET_MARKER_ALIGNMENT_MAP);\nfloat referenceSize = a_sizeAndOutlineWidth.w * a_sizeAndOutlineWidth.w / 128.0;\nfloat scaleSymbolProportionally = getBit(a_bitSet, BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY);\nfloat scaleFactor = getMarkerScaleFactor(size, referenceSize);\nsize.xy *= scaleFactor;\noffset.xy *= scaleFactor;\noutlineSize *= scaleSymbolProportionally * (scaleFactor - 1.0) + 1.0;\nvec2 v_tex = a_texCoords / u_mosaicSize;\nfloat filterFlags = getFilterFlags();\nv_color = getColor(a_color, a_bitSet, BITSET_GENERIC_LOCK_COLOR);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_pos = u_dvsMat3 * pos + getMatrix(isMapAligned) * getRotation() * offset;\nv_sizeTex = vec4(size.xy, v_tex.xy);\n#ifdef SDF\nv_isThin = getBit(a_bitSet, BITSET_MARKER_OUTLINE_ALLOW_COLOR_OVERRIDE);\n#ifdef VV_COLOR\nv_overridingOutlineColor = v_isThin;\n#else\nv_overridingOutlineColor = 0.0;\n#endif\nv_outlineWidth = min(outlineSize, max(max(size.x, size.y) - 0.99, 0.0));\nv_outlineColor = a_outlineColor;\nv_distRatio = a_bitSetAndDistRatio.y / 126.0;\n#endif\n#ifdef HITTEST\nhighp vec4 out_color = vec4(0.);\nhighp vec3 out_pos = vec3(0.);\nhittestIcon(out_color, out_pos, pos, offset, size, scaleFactor, isMapAligned);\nv_color = out_color;\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, out_pos, filterFlags, a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, filterFlags, a_zoomRange), 1.0);\n#endif\n}" }, label: { "common.glsl": "uniform mediump float u_zoomLevel;\nuniform mediump float u_mapRotation;\nuniform mediump float u_mapAligned;\nuniform mediump vec2 u_mosaicSize;\nvarying mediump float v_antialiasingWidth;\nvarying mediump float v_edgeDistanceOffset;\nvarying mediump vec2 v_tex;\nvarying mediump vec4 v_color;\nvarying lowp vec4 v_animation;", "label.frag": "#include <materials/text/text.frag>", "label.vert": "precision highp float;\n#include <materials/vcommon.glsl>\n#include <materials/text/common.glsl>\nattribute vec4 a_color;\nattribute vec4 a_haloColor;\nattribute vec4 a_texAndSize;\nattribute vec4 a_refSymbolAndPlacementOffset;\nattribute vec4 a_glyphData;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nuniform float u_isHalo;\nuniform float u_mapRotation;\nuniform float u_mapAligned;\nfloat getZ(in float minZoom, in float maxZoom, in float angle) {\nfloat glyphAngle = angle * 360.0 / 254.0;\nfloat mapAngle = u_mapRotation * 360.0 / 254.0;\nfloat diffAngle = min(360.0 - abs(mapAngle - glyphAngle), abs(mapAngle - glyphAngle));\nfloat z = 0.0;\nz += u_mapAligned * (2.0 * (1.0 - step(minZoom, u_currentZoom)));\nz += u_mapAligned * 2.0 * step(90.0, diffAngle);\nz += 2.0 * (1.0 - step(u_currentZoom, maxZoom));\nreturn z;\n}\nvoid main()\n{\nINIT;\nfloat groupMinZoom = getMinZoom();\nfloat glyphMinZoom = a_glyphData.x;\nfloat glyphMaxZoom = a_glyphData.y;\nfloat glyphAngle = a_glyphData.z;\nfloat a_minZoom = max(groupMinZoom, glyphMinZoom);\nfloat a_placementPadding = a_refSymbolAndPlacementOffset.x * EXTRUDE_SCALE_PLACEMENT_PADDING;\nvec2 a_placementDir = unpack_u8_nf32(a_refSymbolAndPlacementOffset.zw);\nfloat a_refSymbolSize = a_refSymbolAndPlacementOffset.y;\nfloat fontSize = a_texAndSize.z;\nfloat haloSize = a_texAndSize.w * OUTLINE_SCALE;\nvec2 vertexOffset = a_vertexOffset * OFFSET_PRECISION;\nvec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nfloat z = getZ(a_minZoom, glyphMaxZoom, glyphAngle);\nfloat fontScale = fontSize / SDF_FONT_SIZE;\nfloat halfSize = getSize(a_refSymbolSize) / 2.0;\nfloat animation = pow(getAnimationState(), vec4(2.0)).r;\nv_color = animation * ((1.0 - u_isHalo) * a_color + (u_isHalo * a_haloColor));\nv_opacity = 1.0;\nv_tex = a_texCoords / u_mosaicSize;\nv_edgeDistanceOffset = u_isHalo * haloSize / fontScale / MAX_SDF_DISTANCE;\nv_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio;\nvec2 placementOffset = a_placementDir * (halfSize + a_placementPadding);\nvec3 glyphOffset = u_displayMat3 * vec3(vertexOffset + placementOffset, 0.0);\nvec3 v_pos = vec3((u_dvsMat3 * pos + glyphOffset).xy, z);\ngl_Position = vec4(v_pos, 1.0);\n#ifdef DEBUG\nv_color = vec4(a_color.rgb, z == 0.0 ? 1.0 : 0.645);\n#endif\n}" }, line: { "common.glsl": "varying lowp vec4 v_color;\nvarying highp vec3 v_id;\nvarying mediump vec2 v_normal;\nvarying mediump float v_lineHalfWidth;\nvarying lowp float v_opacity;\n#ifdef PATTERN\nvarying mediump vec4 v_tlbr;\nvarying mediump vec2 v_patternSize;\n#endif\n#if defined(PATTERN) || defined(SDF)\nvarying highp float v_accumulatedDistance;\n#endif\n#ifdef SDF\nvarying mediump float v_lineWidthRatio;\n#endif", "hittest.glsl": "#include <materials/hittest/common.glsl>\n#ifdef HITTEST\nattribute vec2 a_pos1;\nattribute vec2 a_pos2;\nvoid hittestLine(out lowp vec4 out_color, out highp vec3 out_pos, float halfWidth) {\nvec3 pos = u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.);\nvec3 pos1 = u_viewMat3 * u_tileMat3 * vec3(a_pos1 * POSITION_PRECISION, 1.);\nvec3 pos2 = u_viewMat3 * u_tileMat3 * vec3(a_pos2 * POSITION_PRECISION, 1.);\nvec3 outTextureCoords = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nfloat dist = min(distPointSegment(u_hittestPos, pos.xy, pos1.xy),\ndistPointSegment(u_hittestPos, pos.xy, pos2.xy)) - halfWidth;\nout_pos = vec3(getAttributeDataTextureCoords(a_id), 0.0);\nif (dist >= u_hittestDist) {\nout_pos.z += 2.0;\n}\nout_color = vec4(1. / 255., 0, 0, dist <= 0. ? (1. / 255.) : 0.);\n}\n#endif", "line.frag": "precision lowp float;\n#include <util/encoding.glsl>\n#include <materials/constants.glsl>\n#include <materials/symbologyTypeUtils.glsl>\n#include <materials/line/common.glsl>\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.frag>\n#ifdef HITTEST\nvoid main() {\ngl_FragColor = v_color;\n}\n#else\nvoid main() {\nLineData inputs = LineData(\nv_color,\nv_normal,\nv_lineHalfWidth,\nv_opacity,\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nv_tlbr,\nv_patternSize,\n#endif\n#ifdef SDF\nv_lineWidthRatio,\n#endif\n#if defined(PATTERN) || defined(SDF)\nv_accumulatedDistance,\n#endif\n#endif\nv_id\n);\ngl_FragColor = shadeLine(inputs);\n}\n#endif", "line.vert": "precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_offsetAndNormal;\nattribute vec2 a_accumulatedDistanceAndHalfWidth;\nattribute vec4 a_tlbr;\nattribute vec4 a_segmentDirection;\nattribute vec2 a_aux;\nattribute vec2 a_zoomRange;\n#include <materials/vcommon.glsl>\n#include <materials/symbologyTypeUtils.glsl>\n#include <materials/line/common.glsl>\n#include <materials/line/hittest.glsl>\n#include <materials/shared/line/common.glsl>\n#include <materials/shared/line/line.vert>\n#ifdef HITTEST\nvoid draw() {\nfloat aa = 0.5 * u_antialiasing;\nfloat a_halfWidth = a_accumulatedDistanceAndHalfWidth.y / 16.;\nfloat a_cimHalfWidth = a_aux.x / 16. ;\nvec2 a_offset = a_offsetAndNormal.xy / 16.;\nfloat baseWidth = getBaseLineHalfWidth(a_halfWidth, a_cimHalfWidth);\nfloat halfWidth = getLineHalfWidth(baseWidth, aa);\nhighp vec3 pos = vec3(0.);\nv_color = vec4(0.);\nhittestLine(v_color, pos, halfWidth);\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}\n#else\nvoid draw()\n{\nhighp vec3 pos = vec3(0.);\nLineData outputs = buildLine(\npos,\na_id,\na_pos,\na_color,\na_offsetAndNormal.xy / 16.,\na_offsetAndNormal.zw / 16.,\na_accumulatedDistanceAndHalfWidth.x,\na_accumulatedDistanceAndHalfWidth.y / 16.,\na_segmentDirection.w,\na_tlbr,\na_segmentDirection.xy / 16.,\na_aux.x / 16.\n);\nv_id = outputs.id;\nv_color = outputs.color;\nv_normal = outputs.normal;\nv_lineHalfWidth = outputs.lineHalfWidth;\nv_opacity = outputs.opacity;\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nv_tlbr = outputs.tlbr;\nv_patternSize = outputs.patternSize;\n#endif\n#ifdef SDF\nv_lineWidthRatio = outputs.lineWidthRatio;\n#endif\n#if defined(PATTERN) || defined(SDF)\nv_accumulatedDistance = outputs.accumulatedDistance;\n#endif\n#endif\ngl_Position = vec4(clip(outputs.color, pos, getFilterFlags(), a_zoomRange), 1.0);\n}\n#endif\nvoid main() {\nINIT;\ndraw();\n}" }, pie: { "pie.frag": "precision mediump float;\n#include <util/atan2.glsl>\n#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/icon/common.glsl>\nvarying float v_size;\nvarying vec2 v_offset;\nvarying vec2 v_filteredSectorToColorId[NUMBER_OF_FIELDS];\nvarying float v_numOfEntries;\nvarying float v_maxSectorAngle;\nuniform lowp vec4 u_colors[NUMBER_OF_FIELDS];\nuniform lowp vec4 u_defaultColor;\nuniform lowp vec4 u_othersColor;\nuniform lowp vec4 u_outlineColor;\nuniform float u_donutRatio;\nuniform float u_sectorThreshold;\nstruct FilteredChartInfo {\nfloat endSectorAngle;\nint colorId;\n};\nlowp vec4 getSectorColor(in int index, in vec2 filteredSectorToColorId[NUMBER_OF_FIELDS]) {\n#if __VERSION__ == 300\nmediump int colorIndex = int(filteredSectorToColorId[index].y);\nreturn u_colors[colorIndex];\n#else\nmediump int colorIndex;\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nif (i == index) {\ncolorIndex = int(filteredSectorToColorId[i].y);\n}\n}\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nif (i == colorIndex) {\nreturn u_colors[i];\n}\n}\nreturn u_colors[NUMBER_OF_FIELDS - 1];\n#endif\n}\nconst int OTHER_SECTOR_ID = 255;\n#ifdef HITTEST\nvec4 getColor() {\nreturn v_color;\n}\n#else\nvec4 getColor() {\nfloat angle = 90.0 - C_RAD_TO_DEG * atan2(v_offset.y, v_offset.x);\nif (angle < 0.0) {\nangle += 360.0;\n} else if (angle > 360.0) {\nangle = mod(angle, 360.0);\n}\nint numOfEntries = int(v_numOfEntries);\nfloat maxSectorAngle = v_maxSectorAngle;\nlowp vec4 fillColor = (maxSectorAngle > 0.0 || u_sectorThreshold > 0.0) ? u_othersColor : u_defaultColor;\nlowp vec4 prevColor = vec4(0.0);\nlowp vec4 nextColor = vec4(0.0);\nfloat startSectorAngle = 0.0;\nfloat endSectorAngle = 0.0;\nif (angle < maxSectorAngle) {\nfor (int index = 0; index < NUMBER_OF_FIELDS; ++index) {\nstartSectorAngle = endSectorAngle;\nendSectorAngle = v_filteredSectorToColorId[index].x;\nif (endSectorAngle > angle) {\nfillColor = getSectorColor(index, v_filteredSectorToColorId);\nprevColor = u_sectorThreshold != 0.0 && index == 0 && abs(360.0 - maxSectorAngle) < EPSILON ? u_othersColor :\ngetSectorColor(index > 0 ? index - 1 : numOfEntries - 1, v_filteredSectorToColorId);\nnextColor = u_sectorThreshold != 0.0 && abs(endSectorAngle - maxSectorAngle) < EPSILON ? u_othersColor :\ngetSectorColor(index < numOfEntries - 1 ? index + 1 : 0, v_filteredSectorToColorId);\nbreak;\n}\nif (index == numOfEntries - 1) {\nbreak;\n}\n}\n} else {\nprevColor = getSectorColor(numOfEntries - 1, v_filteredSectorToColorId);\nnextColor = getSectorColor(0, v_filteredSectorToColorId);\nstartSectorAngle = maxSectorAngle;\nendSectorAngle = 360.0;\n}\nlowp vec4 outlineColor = u_outlineColor;\nfloat offset = length(v_offset);\nfloat distanceSize = offset * v_size;\nif (startSectorAngle != 0.0 || endSectorAngle != 360.0) {\nfloat distanceToStartSector = (angle - startSectorAngle);\nfloat distanceToEndSector = (endSectorAngle - angle);\nfloat sectorThreshold = 0.6;\nfloat beginSectorAlpha = smoothstep(0.0, sectorThreshold, distanceToStartSector * offset);\nfloat endSectorAlpha = smoothstep(0.0, sectorThreshold, distanceToEndSector * offset);\nif (endSectorAlpha > 0.0) {\nfillColor = mix(nextColor, fillColor, endSectorAlpha);\n} else if (beginSectorAlpha > 0.0) {\nfillColor = mix(prevColor, fillColor, beginSectorAlpha);\n}\n}\nfloat donutSize = u_donutRatio * (v_size - v_outlineWidth);\nfloat endOfDonut = donutSize - v_outlineWidth;\nfloat aaThreshold = 0.75;\nfloat innerCircleAlpha = endOfDonut - aaThreshold > 0.0 ? smoothstep(endOfDonut - aaThreshold, endOfDonut + aaThreshold, distanceSize) : 1.0;\nfloat outerCircleAlpha = 1.0 - smoothstep(v_size - aaThreshold, v_size + aaThreshold , distanceSize);\nfloat circleAlpha = innerCircleAlpha * outerCircleAlpha;\nfloat startOfOutline = v_size - v_outlineWidth;\nif (startOfOutline > 0.0 && v_outlineWidth > 0.25) {\nfloat outlineFactor = smoothstep(startOfOutline - aaThreshold, startOfOutline + aaThreshold, distanceSize);\nfloat innerLineFactor = donutSize - aaThreshold > 0.0 ? 1.0 - smoothstep(donutSize - aaThreshold, donutSize + aaThreshold , distanceSize) : 0.0;\nfillColor = mix(fillColor, outlineColor, innerLineFactor + outlineFactor);\n}\nreturn v_opacity * circleAlpha * fillColor;\n}\n#endif\nvoid main()\n{\nvec4 color = getColor();\n#ifdef HIGHLIGHT\ncolor.a = step(1.0 / 255.0, color.a);\n#endif\ngl_FragColor = color;\n}", "pie.vert": "precision highp float;\nattribute vec4 a_color;\nattribute vec4 a_outlineColor;\nattribute vec4 a_sizeAndOutlineWidth;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nattribute vec2 a_bitSetAndDistRatio;\nattribute vec2 a_zoomRange;\nuniform float u_outlineWidth;\nuniform mediump float u_sectorThreshold;\nvarying float v_size;\nvarying vec2 v_offset;\nvarying vec2 v_filteredSectorToColorId[NUMBER_OF_FIELDS];\nvarying float v_numOfEntries;\nvarying float v_maxSectorAngle;\nstruct FilteredChartInfo {\nfloat endSectorAngle;\nint colorId;\n};\nint filter(in float sectorAngle,\nin int currentIndex,\ninout FilteredChartInfo filteredInfo,\ninout vec2 filteredSectorToColorId[NUMBER_OF_FIELDS]) {\nif (sectorAngle > u_sectorThreshold * 360.0) {\nfilteredInfo.endSectorAngle += sectorAngle;\n#if __VERSION__ == 300\nfilteredSectorToColorId[filteredInfo.colorId] = vec2(filteredInfo.endSectorAngle, currentIndex);\n#else\nfor (int i = 0; i < NUMBER_OF_FIELDS; i++) {\nif (i == filteredInfo.colorId) {\nfilteredSectorToColorId[i] = vec2(filteredInfo.endSectorAngle, currentIndex);\n}\n}\n#endif\n++filteredInfo.colorId;\n}\nreturn 0;\n}\nint filterValues(inout vec2 filteredSectorToColorId[NUMBER_OF_FIELDS],\ninout FilteredChartInfo filteredInfo,\nin float sectorAngles[NUMBER_OF_FIELDS]) {\nfor (int index = 0; index < NUMBER_OF_FIELDS; ++index) {\nfloat sectorValue = sectorAngles[index];\nfilter(sectorValue, index, filteredInfo, filteredSectorToColorId);\n}\nreturn filteredInfo.colorId;\n}\n#include <materials/vcommon.glsl>\n#include <materials/icon/common.glsl>\n#include <materials/hittest/common.glsl>\nvec2 getMarkerSize(inout vec2 offset, inout vec2 baseSize, inout float outlineSize, in float referenceSize, in float bitSet) {\nvec2 outSize = baseSize;\n#ifdef VV_SIZE\nfloat r = 0.5 * getSize(referenceSize) / referenceSize;\noutSize.xy *= r;\noffset.xy *= r;\nfloat scaleSymbolProportionally = getBit(bitSet, BITSET_MARKER_SCALE_SYMBOLS_PROPORTIONALLY);\noutlineSize *= scaleSymbolProportionally * (r - 1.0) + 1.0;\n#endif\nreturn outSize;\n}\nvec3 getOffset(in vec2 in_offset, float a_bitSet) {\nfloat isMapAligned = getBit(a_bitSet, BITSET_MARKER_ALIGNMENT_MAP);\nvec3 offset = vec3(in_offset, 0.0);\nreturn getMatrix(isMapAligned) * offset;\n}\nfloat filterNaNValues(in float value) {\nreturn value != NAN_MAGIC_NUMBER && value > 0.0 ? value : 0.0;\n}\nvoid main()\n{\nINIT;\nvec2 a_size = a_sizeAndOutlineWidth.xy * a_sizeAndOutlineWidth.xy / 128.0;\nvec2 a_offset = a_vertexOffset / 16.0;\nfloat outlineSize = u_outlineWidth;\nfloat a_bitSet = a_bitSetAndDistRatio.x;\nvec2 size = getMarkerSize(a_offset, a_size, outlineSize, a_sizeAndOutlineWidth.w * a_sizeAndOutlineWidth.w / 128.0, a_bitSet);\nfloat filterFlags = getFilterFlags();\nvec3 pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_pos = u_dvsMat3 * pos + getOffset(a_offset, a_bitSet);\nv_offset = sign(a_texCoords - 0.5);\nv_size = max(size.x, size.y);\nv_outlineWidth = outlineSize;\nfloat attributeData[10];\nvec4 attributeData0 = getAttributeData3(a_id);\nattributeData[0] = filterNaNValues(attributeData0.x);\nattributeData[1] = filterNaNValues(attributeData0.y);\nattributeData[2] = filterNaNValues(attributeData0.z);\nattributeData[3] = filterNaNValues(attributeData0.w);\n#if (NUMBER_OF_FIELDS > 4)\nvec4 attributeData1 = getAttributeData4(a_id);\nattributeData[4] = filterNaNValues(attributeData1.x);\nattributeData[5] = filterNaNValues(attributeData1.y);\nattributeData[6] = filterNaNValues(attributeData1.z);\nattributeData[7] = filterNaNValues(attributeData1.w);\n#endif\n#if (NUMBER_OF_FIELDS > 8)\nvec4 attributeData2 = getAttributeData5(a_id);\nattributeData[8] = filterNaNValues(attributeData2.x);\nattributeData[9] = filterNaNValues(attributeData2.y);\n#endif\nfloat sum = 0.0;\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nsum += attributeData[i];\n}\nfloat sectorAngles[NUMBER_OF_FIELDS];\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nsectorAngles[i] = 360.0 * attributeData[i] / sum;\n}\nvec2 filteredSectorToColorId[NUMBER_OF_FIELDS];\nFilteredChartInfo filteredInfo = FilteredChartInfo(0.0, 0);\nint numOfEntries = filterValues(filteredSectorToColorId, filteredInfo, sectorAngles);\nv_numOfEntries = float(numOfEntries);\nv_maxSectorAngle = filteredInfo.endSectorAngle;\n#if __VERSION__ == 300\nv_filteredSectorToColorId = filteredSectorToColorId;\n#else\nfor (int i = 0; i < NUMBER_OF_FIELDS; ++i) {\nif (i == numOfEntries) {\nbreak;\n}\nv_filteredSectorToColorId[i] = filteredSectorToColorId[i];\n}\n#endif\n#ifdef HITTEST\nhighp vec3 out_pos = vec3(0.0);\nv_color = vec4(0.0);\nhittestMarker(v_color, out_pos, u_viewMat3 * u_tileMat3 * pos, v_size);\ngl_PointSize = 1.0;\ngl_Position = vec4(clip(v_color, out_pos, filterFlags, a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, filterFlags, a_zoomRange), 1.0);\n#endif\n}" }, shared: { line: { "common.glsl": "#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && defined(PATTERN)\nuniform mediump vec2 u_mosaicSize;\nvarying mediump float v_sampleAlphaOnly;\n#endif\nstruct LineData {\nlowp vec4 color;\nmediump vec2 normal;\nmediump float lineHalfWidth;\nlowp float opacity;\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nmediump vec4 tlbr;\nmediump vec2 patternSize;\n#endif\n#ifdef SDF\nmediump float lineWidthRatio;\n#endif\n#if defined(PATTERN) || defined(SDF)\nhighp float accumulatedDistance;\n#endif\n#endif\nhighp vec3 id;\n};", "line.frag": "uniform lowp float u_blur;\n#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && !defined(HIGHLIGHT)\n#if defined(PATTERN) || defined(SDF)\nuniform sampler2D u_texture;\nuniform highp float u_pixelRatio;\n#endif\n#endif\n#if defined(SDF) && !defined(HIGHLIGHT) && !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE)\nlowp vec4 getLineColor(LineData line) {\nmediump float adjustedPatternWidth = line.patternSize.x * 2.0 * line.lineWidthRatio;\nmediump float relativeTexX = fract(line.accumulatedDistance / adjustedPatternWidth);\nmediump float relativeTexY = 0.5 + 0.25 * line.normal.y;\nmediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexX, relativeTexY));\nmediump float d = rgba2float(texture2D(u_texture, texCoord)) - 0.5;\nfloat dist = d * line.lineHalfWidth;\nreturn line.opacity * clamp(0.5 - dist, 0.0, 1.0) * line.color;\n}\n#elif defined(PATTERN) && !defined(HIGHLIGHT) && !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE)\nlowp vec4 getLineColor(LineData line) {\nmediump float lineHalfWidth = line.lineHalfWidth;\nmediump float adjustedPatternHeight = line.patternSize.y * 2.0 * lineHalfWidth / line.patternSize.x;\nmediump float relativeTexY = fract(line.accumulatedDistance / adjustedPatternHeight);\nmediump float relativeTexX = 0.5 + 0.5 * line.normal.y;\nmediump vec2 texCoord = mix(line.tlbr.xy, line.tlbr.zw, vec2(relativeTexX, relativeTexY));\nlowp vec4 color = texture2D(u_texture, texCoord);\n#ifdef VV_COLOR\nif (v_sampleAlphaOnly > 0.5) {\ncolor.rgb = vec3(color.a);\n}\n#endif\nreturn line.opacity * line.color * color;\n}\n#else\nlowp vec4 getLineColor(LineData line) {\nreturn line.opacity * line.color;\n}\n#endif\nvec4 shadeLine(LineData line)\n{\nmediump float thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(line.lineHalfWidth, THIN_LINE_HALF_WIDTH), 1.0);\nmediump float fragDist = length(line.normal) * line.lineHalfWidth;\nlowp float alpha = clamp(thinLineFactor * (line.lineHalfWidth - fragDist) / (u_blur + thinLineFactor - 1.0), 0.0, 1.0);\nlowp vec4 out_color = getLineColor(line) * alpha;\n#ifdef HIGHLIGHT\nout_color.a = step(1.0 / 255.0, out_color.a);\n#endif\n#ifdef ID\nif (out_color.a < 1.0 / 255.0) {\ndiscard;\n}\nout_color = vec4(line.id, 0.0);\n#endif\nreturn out_color;\n}", "line.vert": "float getBaseLineHalfWidth(in float lineHalfWidth, in float referenceHalfWidth) {\n#ifdef VV_SIZE\nfloat refLineWidth = 2.0 * referenceHalfWidth;\nreturn 0.5 * (lineHalfWidth / max(referenceHalfWidth, EPSILON)) * getSize(refLineWidth);\n#else\nreturn lineHalfWidth;\n#endif\n}\nfloat getLineHalfWidth(in float baseWidth, in float aa) {\nfloat halfWidth = max(baseWidth + aa, 0.45) + 0.1 * aa;\n#ifdef HIGHLIGHT\nhalfWidth = max(halfWidth, 2.0);\n#endif\nreturn halfWidth;\n}\nvec2 getDist(in vec2 offset, in float halfWidth) {\nfloat thinLineFactor = max(THIN_LINE_WIDTH_FACTOR * step(halfWidth, THIN_LINE_HALF_WIDTH), 1.0);\nreturn thinLineFactor * halfWidth * offset;\n}\nLineData buildLine(\nout vec3 out_pos,\nin vec3 in_id,\nin vec2 in_pos,\nin vec4 in_color,\nin vec2 in_offset,\nin vec2 in_normal,\nin float in_accumulatedDist,\nin float in_lineHalfWidth,\nin float in_bitSet,\nin vec4 in_tlbr,\nin vec2 in_segmentDirection,\nin float in_referenceHalfWidth\n)\n{\nfloat aa = 0.5 * u_antialiasing;\nfloat baseWidth = getBaseLineHalfWidth(in_lineHalfWidth, in_referenceHalfWidth);\nfloat halfWidth = getLineHalfWidth(baseWidth, aa);\nfloat z = 2.0 * step(baseWidth, 0.0);\nvec2 dist = getDist(in_offset, halfWidth);\nvec3 offset = u_displayViewMat3 * vec3(dist, 0.0);\nvec3 pos = u_dvsMat3 * vec3(in_pos * POSITION_PRECISION, 1.0) + offset;\n#ifdef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\nvec4 color = in_color;\nfloat opacity = 1.0;\n#else\nvec4 color = getColor(in_color, in_bitSet, BITSET_GENERIC_LOCK_COLOR);\nfloat opacity = getOpacity();\n#ifdef SDF\nconst float SDF_PATTERN_HALF_WIDTH = 15.5;\nfloat scaleDash = getBit(in_bitSet, BITSET_LINE_SCALE_DASH);\nfloat lineWidthRatio = (scaleDash * max(halfWidth - 0.55 * u_antialiasing, 0.25) + (1.0 - scaleDash)) / SDF_PATTERN_HALF_WIDTH;\n#endif\n#endif\n#if !defined(SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE) && defined(PATTERN)\nv_sampleAlphaOnly = getBit(in_bitSet, BITSET_GENERIC_CONSIDER_ALPHA_ONLY);\n#endif\nout_pos = vec3(pos.xy, z);\nreturn LineData(\ncolor,\nin_normal,\nhalfWidth,\nopacity,\n#ifndef SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#ifdef PATTERN\nin_tlbr / u_mosaicSize.xyxy,\nvec2(in_tlbr.z - in_tlbr.x, in_tlbr.w - in_tlbr.y),\n#endif\n#ifdef SDF\nlineWidthRatio,\n#endif\n#if defined(PATTERN) || defined(SDF)\nin_accumulatedDist * u_zoomFactor + dot(in_segmentDirection, dist),\n#endif\n#endif\nnorm(in_id)\n);\n}" } }, "symbologyTypeUtils.glsl": "#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL || SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL_SIMPLE\n#define SYMBOLOGY_TYPE_IS_OUTLINE_FILL_LIKE\n#endif\n#if SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_SIMPLE || SYMBOLOGY_TYPE == SYMBOLOGY_TYPE_OUTLINE_FILL_SIMPLE\n#define SYMBOLOGY_TYPE_IS_SIMPLE_LIKE\n#endif", text: { "common.glsl": "uniform highp vec2 u_mosaicSize;\nvarying highp vec3 v_id;\nvarying mediump vec3 v_pos;\nvarying lowp float v_opacity;\nvarying lowp vec4 v_color;\nvarying highp vec2 v_tex;\nvarying mediump float v_antialiasingWidth;\nvarying mediump float v_edgeDistanceOffset;\nvarying lowp float v_transparency;", "hittest.glsl": "#include <materials/hittest/common.glsl>", "text.frag": "precision mediump float;\n#include <materials/text/common.glsl>\nuniform lowp sampler2D u_texture;\n#ifdef HITTEST\nvec4 getColor() {\nreturn v_color;\n}\n#else\nvec4 getColor()\n{\nfloat SDF_CUTOFF = (2.0 / 8.0);\nfloat SDF_BASE_EDGE_DIST = 1.0 - SDF_CUTOFF;\nlowp float dist = texture2D(u_texture, v_tex).a;\nmediump float edge = SDF_BASE_EDGE_DIST - v_edgeDistanceOffset;\n#ifdef HIGHLIGHT\nedge /= 2.0;\n#endif\nlowp float aa = v_antialiasingWidth;\nlowp float alpha = smoothstep(edge - aa, edge + aa, dist);\nreturn alpha * v_color * v_opacity;\n}\n#endif\nvoid main()\n{\ngl_FragColor = getColor();\n}", "text.vert": "precision highp float;\n#include <materials/utils.glsl>\n#include <materials/vcommon.glsl>\n#include <materials/text/common.glsl>\n#include <materials/text/hittest.glsl>\nattribute vec4 a_color;\nattribute vec4 a_haloColor;\nattribute vec4 a_texFontSize;\nattribute vec4 a_aux;\nattribute vec2 a_zoomRange;\nattribute vec2 a_vertexOffset;\nattribute vec2 a_texCoords;\nuniform float u_isHalo;\nfloat getTextSize(inout vec2 offset, inout float baseSize, in float referenceSize) {\n#ifdef VV_SIZE\nfloat r = getSize(referenceSize) / referenceSize;\nbaseSize *= r;\noffset.xy *= r;\nreturn baseSize;\n#endif\nreturn baseSize;\n}\nvoid main()\n{\nINIT;\nfloat a_referenceSize = a_aux.z * a_aux.z / 256.0;\nfloat a_bitSet = a_aux.w;\nfloat a_fontSize = a_texFontSize.z;\nvec2 a_offset = a_vertexOffset * OFFSET_PRECISION;\nvec3 in_pos = vec3(a_pos * POSITION_PRECISION, 1.0);\nfloat fontSize = getTextSize(a_offset, a_fontSize, a_referenceSize);\nfloat fontScale = fontSize / SDF_FONT_SIZE;\nvec3 offset = getRotation() * vec3(a_offset, 0.0);\nmat3 extrudeMatrix = getBit(a_bitSet, 0) == 1.0 ? u_displayViewMat3 : u_displayMat3;\nv_color = u_isHalo * a_haloColor + (1.0 - u_isHalo) * getColor(a_color, a_bitSet, 1);\nv_opacity = getOpacity();\nv_id = norm(a_id);\nv_tex = a_texCoords / u_mosaicSize;\nv_pos = u_dvsMat3 * in_pos + extrudeMatrix * offset;\nv_edgeDistanceOffset = u_isHalo * OUTLINE_SCALE * a_texFontSize.w / fontScale / MAX_SDF_DISTANCE;\nv_antialiasingWidth = 0.105 * SDF_FONT_SIZE / fontSize / u_pixelRatio;\n#ifdef HITTEST\nhighp vec3 out_pos = vec3(0.);\nv_color = vec4(0.);\nhittestMarker(v_color, out_pos, u_viewMat3 * u_tileMat3 * vec3(a_pos * POSITION_PRECISION, 1.0)\n+ u_tileMat3 * offset, fontSize / 2.);\ngl_PointSize = 1.;\ngl_Position = vec4(clip(v_color, out_pos, getFilterFlags(), a_zoomRange), 1.0);\n#else\ngl_Position = vec4(clip(v_color, v_pos, getFilterFlags(), a_zoomRange), 1.0);\n#endif\n}" }, "utils.glsl": "float rshift(in float u32, in int amount) {\nreturn floor(u32 / pow(2.0, float(amount)));\n}\nfloat getBit(in float bitset, in int bitIndex) {\nfloat offset = pow(2.0, float(bitIndex));\nreturn mod(floor(bitset / offset), 2.0);\n}\nfloat getFilterBit(in float bitset, in int bitIndex) {\nreturn getBit(bitset, bitIndex + 1);\n}\nfloat getHighlightBit(in float bitset) {\nreturn getBit(bitset, 0);\n}\nhighp vec3 unpackDisplayIdTexel(in highp vec3 bitset) {\nfloat isAggregate = getBit(bitset.b, 7);\nreturn (1.0 - isAggregate) * bitset + isAggregate * (vec3(bitset.rgb) - vec3(0.0, 0.0, float(0x80)));\n}\nvec4 unpack(in float u32) {\nfloat r = mod(rshift(u32, 0), 255.0);\nfloat g = mod(rshift(u32, 8), 255.0);\nfloat b = mod(rshift(u32, 16), 255.0);\nfloat a = mod(rshift(u32, 24), 255.0);\nreturn vec4(r, g, b, a);\n}\nvec3 norm(in vec3 v) {\nreturn v /= 255.0;\n}\nvec4 norm(in vec4 v) {\nreturn v /= 255.0;\n}\nfloat max4(vec4 target) {\nreturn max(max(max(target.x, target.y), target.z), target.w);\n}\nvec2 unpack_u8_nf32(vec2 bytes) {\nreturn (bytes - 127.0) / 127.0;\n}\nhighp float rand(in vec2 co) {\nhighp float a = 12.9898;\nhighp float b = 78.233;\nhighp float c = 43758.5453;\nhighp float dt = dot(co, vec2(a,b));\nhighp float sn = mod(dt, 3.14);\nreturn fract(sin(sn) * c);\n}", "vcommon.glsl": "#include <materials/constants.glsl>\n#include <materials/utils.glsl>\n#include <materials/attributeData.glsl>\n#include <materials/vv.glsl>\n#include <materials/barycentric.glsl>\nattribute vec2 a_pos;\nattribute highp vec3 a_id;\nuniform highp mat3 u_dvsMat3;\nuniform highp mat3 u_displayMat3;\nuniform highp mat3 u_displayViewMat3;\nuniform highp mat3 u_tileMat3;\nuniform highp mat3 u_viewMat3;\nuniform highp float u_pixelRatio;\nuniform mediump float u_zoomFactor;\nuniform mediump float u_antialiasing;\nuniform mediump float u_currentZoom;\nvec4 VV_ADATA = vec4(0.0);\nvoid loadVisualVariableData(inout vec4 target) {\n#ifdef SUPPORTS_TEXTURE_FLOAT\ntarget.rgba = getAttributeData2(a_id);\n#else\nvec4 data0 = getAttributeData2(a_id);\nvec4 data1 = getAttributeData3(a_id);\ntarget.r = u88VVToFloat(data0.rg * 255.0);\ntarget.g = u88VVToFloat(data0.ba * 255.0);\ntarget.b = u88VVToFloat(data1.rg * 255.0);\ntarget.a = u88VVToFloat(data1.ba * 255.0);\n#endif\n}\n#ifdef VV\n#define INIT loadVisualVariableData(VV_ADATA)\n#else\n#define INIT\n#endif\nvec4 getColor(in vec4 a_color, in float a_bitSet, int index) {\n#ifdef VV_COLOR\nfloat isColorLocked = getBit(a_bitSet, index);\nreturn getVVColor(VV_ADATA[ATTR_VV_COLOR], a_color, isColorLocked);\n#else\nreturn a_color;\n#endif\n}\nfloat getOpacity() {\n#ifdef VV_OPACITY\nreturn getVVOpacity(VV_ADATA[ATTR_VV_OPACITY]);\n#else\nreturn 1.0;\n#endif\n}\nfloat getSize(in float in_size) {\n#ifdef VV_SIZE\nreturn getVVSize(in_size, VV_ADATA[ATTR_VV_SIZE]);\n#else\nreturn in_size;\n#endif\n}\nmat3 getRotation() {\n#ifdef VV_ROTATION\nreturn getVVRotationMat3(mod(VV_ADATA[ATTR_VV_ROTATION], 360.0));\n#else\nreturn mat3(1.0);\n#endif\n}\nfloat getFilterFlags() {\n#ifdef IGNORES_SAMPLER_PRECISION\nreturn ceil(getAttributeData0(a_id).x * 255.0);\n#else\nreturn getAttributeData0(a_id).x * 255.0;\n#endif\n}\nvec4 getAnimationState() {\nreturn getAttributeData1(a_id);\n}\nfloat getMinZoom() {\nvec4 data0 = getAttributeData0(a_id) * 255.0;\nreturn data0.g;\n}\nmat3 getMatrixNoDisplay(float isMapAligned) {\nreturn isMapAligned * u_viewMat3 * u_tileMat3 + (1.0 - isMapAligned) * u_tileMat3;\n}\nmat3 getMatrix(float isMapAligned) {\nreturn isMapAligned * u_displayViewMat3 + (1.0 - isMapAligned) * u_displayMat3;\n}\nvec3 clip(inout vec4 color, inout vec3 pos, in float filterFlags, in vec2 minMaxZoom) {\npos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 0));\n#ifdef INSIDE\npos.z += 2.0 * (1.0 - getFilterBit(filterFlags, 1));\n#elif defined(OUTSIDE)\npos.z += 2.0 * getFilterBit(filterFlags, 1);\n#elif defined(HIGHLIGHT)\n#if !defined(HIGHLIGHT_ALL)\npos.z += 2.0 * (1.0 - getHighlightBit(filterFlags));\n#endif\n#endif\npos.z += 2.0 * (step(minMaxZoom.y, u_currentZoom) + (1.0 - step(minMaxZoom.x, u_currentZoom)));\nreturn pos;\n}", "vv.glsl": "#if defined(VV_SIZE_MIN_MAX_VALUE) || defined(VV_SIZE_SCALE_STOPS) || defined(VV_SIZE_FIELD_STOPS) || defined(VV_SIZE_UNIT_VALUE)\n#define VV_SIZE\n#endif\n#if defined(VV_COLOR) || defined(VV_SIZE) || defined(VV_OPACITY) || defined(VV_ROTATION)\n#define VV\n#endif\n#ifdef VV_COLOR\nuniform highp float u_vvColorValues[8];\nuniform vec4 u_vvColors[8];\n#endif\n#ifdef VV_SIZE_MIN_MAX_VALUE\nuniform highp vec4 u_vvSizeMinMaxValue;\n#endif\n#ifdef VV_SIZE_SCALE_STOPS\nuniform highp float u_vvSizeScaleStopsValue;\n#endif\n#ifdef VV_SIZE_FIELD_STOPS\nuniform highp float u_vvSizeFieldStopsValues[6];\nuniform float u_vvSizeFieldStopsSizes[6];\n#endif\n#ifdef VV_SIZE_UNIT_VALUE\nuniform highp float u_vvSizeUnitValueWorldToPixelsRatio;\n#endif\n#ifdef VV_OPACITY\nuniform highp float u_vvOpacityValues[8];\nuniform float u_vvOpacities[8];\n#endif\n#ifdef VV_ROTATION\nuniform lowp float u_vvRotationType;\n#endif\nbool isNan(float val) {\nreturn (val == NAN_MAGIC_NUMBER);\n}\n#ifdef VV_SIZE_MIN_MAX_VALUE\nfloat getVVMinMaxSize(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nfloat interpolationRatio = (sizeValue - u_vvSizeMinMaxValue.x) / (u_vvSizeMinMaxValue.y - u_vvSizeMinMaxValue.x);\ninterpolationRatio = clamp(interpolationRatio, 0.0, 1.0);\nreturn u_vvSizeMinMaxValue.z + interpolationRatio * (u_vvSizeMinMaxValue.w - u_vvSizeMinMaxValue.z);\n}\n#endif\n#ifdef VV_SIZE_FIELD_STOPS\nconst int VV_SIZE_N = 6;\nfloat getVVStopsSize(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nif (sizeValue <= u_vvSizeFieldStopsValues[0]) {\nreturn u_vvSizeFieldStopsSizes[0];\n}\nfor (int i = 1; i < VV_SIZE_N; ++i) {\nif (u_vvSizeFieldStopsValues[i] >= sizeValue) {\nfloat f = (sizeValue - u_vvSizeFieldStopsValues[i-1]) / (u_vvSizeFieldStopsValues[i] - u_vvSizeFieldStopsValues[i-1]);\nreturn mix(u_vvSizeFieldStopsSizes[i-1], u_vvSizeFieldStopsSizes[i], f);\n}\n}\nreturn u_vvSizeFieldStopsSizes[VV_SIZE_N - 1];\n}\n#endif\n#ifdef VV_SIZE_UNIT_VALUE\nfloat getVVUnitValue(float sizeValue, float fallback) {\nif (isNan(sizeValue)) {\nreturn fallback;\n}\nreturn u_vvSizeUnitValueWorldToPixelsRatio * sizeValue;\n}\n#endif\n#ifdef VV_OPACITY\nconst int VV_OPACITY_N = 8;\nfloat getVVOpacity(float opacityValue) {\nif (isNan(opacityValue)) {\nreturn 1.0;\n}\nif (opacityValue <= u_vvOpacityValues[0]) {\nreturn u_vvOpacities[0];\n}\nfor (int i = 1; i < VV_OPACITY_N; ++i) {\nif (u_vvOpacityValues[i] >= opacityValue) {\nfloat f = (opacityValue - u_vvOpacityValues[i-1]) / (u_vvOpacityValues[i] - u_vvOpacityValues[i-1]);\nreturn mix(u_vvOpacities[i-1], u_vvOpacities[i], f);\n}\n}\nreturn u_vvOpacities[VV_OPACITY_N - 1];\n}\n#endif\n#ifdef VV_ROTATION\nmat4 getVVRotation(float rotationValue) {\nif (isNan(rotationValue)) {\nreturn mat4(1, 0, 0, 0,\n0, 1, 0, 0,\n0, 0, 1, 0,\n0, 0, 0, 1);\n}\nfloat rotation = rotationValue;\nif (u_vvRotationType == 1.0) {\nrotation = 90.0 - rotation;\n}\nfloat angle = C_DEG_TO_RAD * rotation;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nreturn mat4(cosA, sinA, 0, 0,\n-sinA, cosA, 0, 0,\n0, 0, 1, 0,\n0, 0, 0, 1);\n}\nmat3 getVVRotationMat3(float rotationValue) {\nif (isNan(rotationValue)) {\nreturn mat3(1, 0, 0,\n0, 1, 0,\n0, 0, 1);\n}\nfloat rotation = rotationValue;\nif (u_vvRotationType == 1.0) {\nrotation = 90.0 - rotation;\n}\nfloat angle = C_DEG_TO_RAD * -rotation;\nfloat sinA = sin(angle);\nfloat cosA = cos(angle);\nreturn mat3(cosA, -sinA, 0,\nsinA, cosA, 0,\n0, 0, 1);\n}\n#endif\n#ifdef VV_COLOR\nconst int VV_COLOR_N = 8;\nvec4 getVVColor(float colorValue, vec4 fallback, float isColorLocked) {\nif (isNan(colorValue) || isColorLocked == 1.0) {\nreturn fallback;\n}\nif (colorValue <= u_vvColorValues[0]) {\nreturn u_vvColors[0];\n}\nfor (int i = 1; i < VV_COLOR_N; ++i) {\nif (u_vvColorValues[i] >= colorValue) {\nfloat f = (colorValue - u_vvColorValues[i-1]) / (u_vvColorValues[i] - u_vvColorValues[i-1]);\nreturn mix(u_vvColors[i-1], u_vvColors[i], f);\n}\n}\nreturn u_vvColors[VV_COLOR_N - 1];\n}\n#endif\nfloat getVVSize(in float size, in float vvSize) {\n#ifdef VV_SIZE_MIN_MAX_VALUE\nreturn getVVMinMaxSize(vvSize, size);\n#elif defined(VV_SIZE_SCALE_STOPS)\nreturn u_vvSizeScaleStopsValue;\n#elif defined(VV_SIZE_FIELD_STOPS)\nfloat outSize = getVVStopsSize(vvSize, size);\nreturn isNan(outSize) ? size : outSize;\n#elif defined(VV_SIZE_UNIT_VALUE)\nreturn getVVUnitValue(vvSize, size);\n#else\nreturn size;\n#endif\n}" }, overlay: { overlay: { "overlay.frag": "precision lowp float;\nuniform lowp sampler2D u_texture;\nuniform lowp float u_opacity;\nvarying mediump vec2 v_uv;\nvoid main() {\nvec4 color = texture2D(u_texture, v_uv);\ngl_FragColor = color * u_opacity;\n}", "overlay.vert": "precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_uv;\nuniform highp mat3 u_dvsMat3;\nuniform mediump vec2 u_perspective;\nvarying mediump vec2 v_uv;\nvoid main(void) {\nv_uv = a_uv;\nfloat w = 1.0 + dot(a_uv, u_perspective);\nvec3 pos = u_dvsMat3 * vec3(a_pos, 1.0);\ngl_Position = vec4(w * pos.xy, 0.0, w);\n}" } }, "post-processing": { blit: { "blit.frag": "precision mediump float;\nuniform sampler2D u_texture;\nvarying vec2 v_uv;\nvoid main() {\ngl_FragColor = texture2D(u_texture, v_uv);\n}" }, bloom: { composite: { "composite.frag": "precision mediump float;\nvarying vec2 v_uv;\nuniform sampler2D u_blurTexture1;\nuniform sampler2D u_blurTexture2;\nuniform sampler2D u_blurTexture3;\nuniform sampler2D u_blurTexture4;\nuniform sampler2D u_blurTexture5;\nuniform float u_bloomStrength;\nuniform float u_bloomRadius;\nuniform float u_bloomFactors[NUMMIPS];\nuniform vec3 u_bloomTintColors[NUMMIPS];\nfloat lerpBloomFactor(const in float factor) {\nfloat mirrorFactor = 1.2 - factor;\nreturn mix(factor, mirrorFactor, u_bloomRadius);\n}\nvoid main() {\nvec4 color = u_bloomStrength * (\nlerpBloomFactor(u_bloomFactors[0]) * vec4(u_bloomTintColors[0], 1.0) * texture2D(u_blurTexture1, v_uv) +\nlerpBloomFactor(u_bloomFactors[1]) * vec4(u_bloomTintColors[1], 1.0) * texture2D(u_blurTexture2, v_uv) +\nlerpBloomFactor(u_bloomFactors[2]) * vec4(u_bloomTintColors[2], 1.0) * texture2D(u_blurTexture3, v_uv) +\nlerpBloomFactor(u_bloomFactors[3]) * vec4(u_bloomTintColors[3], 1.0) * texture2D(u_blurTexture4, v_uv) +\nlerpBloomFactor(u_bloomFactors[4]) * vec4(u_bloomTintColors[4], 1.0) * texture2D(u_blurTexture5, v_uv)\n);\ngl_FragColor = clamp(color, 0.0, 1.0);\n}" }, gaussianBlur: { "gaussianBlur.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nuniform vec2 u_direction;\nvarying vec2 v_uv;\n#define KERNEL_RADIUS RADIUS\n#define SIGMA RADIUS\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / u_texSize;\nfloat fSigma = float(SIGMA);\nfloat weightSum = gaussianPdf(0.0, fSigma);\nvec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum;\nfor (int i = 1; i < KERNEL_RADIUS; i ++) {\nfloat x = float(i);\nfloat w = gaussianPdf(x, fSigma);\nvec2 uvOffset = u_direction * invSize * x;\nvec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset);\nvec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset);\npixelColorSum += (sample1 + sample2) * w;\nweightSum += 2.0 * w;\n}\ngl_FragColor = pixelColorSum /weightSum;\n}" }, luminosityHighPass: { "luminosityHighPass.frag": "precision mediump float;\nuniform sampler2D u_texture;\nuniform vec3 u_defaultColor;\nuniform float u_defaultOpacity;\nuniform float u_luminosityThreshold;\nuniform float u_smoothWidth;\nvarying vec2 v_uv;\nvoid main() {\nvec4 texel = texture2D(u_texture, v_uv);\nvec3 luma = vec3(0.299, 0.587, 0.114);\nfloat v = dot(texel.xyz, luma);\nvec4 outputColor = vec4(u_defaultColor.rgb, u_defaultOpacity);\nfloat alpha = smoothstep(u_luminosityThreshold, u_luminosityThreshold + u_smoothWidth, v);\ngl_FragColor = mix(outputColor, texel, alpha);\n}" } }, blur: { gaussianBlur: { "gaussianBlur.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nuniform vec2 u_direction;\nuniform float u_sigma;\nvarying vec2 v_uv;\n#define KERNEL_RADIUS RADIUS\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x / ( sigma * sigma)) / sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / u_texSize;\nfloat fSigma = u_sigma;\nfloat weightSum = gaussianPdf(0.0, fSigma);\nvec4 pixelColorSum = texture2D(u_colorTexture, v_uv) * weightSum;\nfor (int i = 1; i < KERNEL_RADIUS; i ++) {\nfloat x = float(i);\nfloat w = gaussianPdf(x, fSigma);\nvec2 uvOffset = u_direction * invSize * x;\nvec4 sample1 = texture2D(u_colorTexture, v_uv + uvOffset);\nvec4 sample2 = texture2D(u_colorTexture, v_uv - uvOffset);\npixelColorSum += (sample1 + sample2) * w;\nweightSum += 2.0 * w;\n}\ngl_FragColor = pixelColorSum /weightSum;\n}" }, "radial-blur": { "radial-blur.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nconst float sampleDist = 1.0;\nconst float sampleStrength = 2.2;\nvoid main(void) {\nfloat samples[10];\nsamples[0] = -0.08;\nsamples[1] = -0.05;\nsamples[2] = -0.03;\nsamples[3] = -0.02;\nsamples[4] = -0.01;\nsamples[5] = 0.01;\nsamples[6] = 0.02;\nsamples[7] = 0.03;\nsamples[8] = 0.05;\nsamples[9] = 0.08;\nvec2 dir = 0.5 - v_uv;\nfloat dist = sqrt(dir.x * dir.x + dir.y * dir.y);\ndir = dir / dist;\nvec4 color = texture2D(u_colorTexture,v_uv);\nvec4 sum = color;\nfor (int i = 0; i < 10; i++) {\nsum += texture2D(u_colorTexture, v_uv + dir * samples[i] * sampleDist);\n}\nsum *= 1.0 / 11.0;\nfloat t = dist * sampleStrength;\nt = clamp(t, 0.0, 1.0);\ngl_FragColor = mix(color, sum, t);\n}" } }, dra: { "dra.frag": "precision mediump float;\nuniform sampler2D u_minColor;\nuniform sampler2D u_maxColor;\nuniform sampler2D u_texture;\nvarying vec2 v_uv;\nvoid main() {\nvec4 minColor = texture2D(u_minColor, vec2(0.5));\nvec4 maxColor = texture2D(u_maxColor, vec2(0.5));\nvec4 color = texture2D(u_texture, v_uv);\nvec3 minColorUnpremultiply = minColor.rgb / minColor.a;\nvec3 maxColorUnpremultiply = maxColor.rgb / maxColor.a;\nvec3 colorUnpremultiply = color.rgb / color.a;\nvec3 range = maxColorUnpremultiply - minColorUnpremultiply;\ngl_FragColor = vec4(color.a * (colorUnpremultiply - minColorUnpremultiply) / range, color.a);\n}", "min-max": { "min-max.frag": "#extension GL_EXT_draw_buffers : require\nprecision mediump float;\n#define CELL_SIZE 2\nuniform sampler2D u_minTexture;\nuniform sampler2D u_maxTexture;\nuniform vec2 u_srcResolution;\nuniform vec2 u_dstResolution;\nvarying vec2 v_uv;\nvoid main() {\nvec2 srcPixel = floor(gl_FragCoord.xy) * float(CELL_SIZE);\nvec2 onePixel = vec2(1.0) / u_srcResolution;\nvec2 uv = (srcPixel + 0.5) / u_srcResolution;\nvec4 minColor = vec4(1.0);\nvec4 maxColor = vec4(0.0);\nfor (int y = 0; y < CELL_SIZE; ++y) {\nfor (int x = 0; x < CELL_SIZE; ++x) {\nvec2 offset = uv + vec2(x, y) * onePixel;\nminColor = min(minColor, texture2D(u_minTexture, offset));\nmaxColor = max(maxColor, texture2D(u_maxTexture, offset));\n}\n}\ngl_FragData[0] = minColor;\ngl_FragData[1] = maxColor;\n}" } }, "drop-shadow": { composite: { "composite.frag": "precision mediump float;\nuniform sampler2D u_layerFBOTexture;\nuniform sampler2D u_blurTexture;\nuniform vec4 u_shadowColor;\nuniform vec2 u_shadowOffset;\nuniform highp mat3 u_displayViewMat3;\nvarying vec2 v_uv;\nvoid main() {\nvec3 offset = u_displayViewMat3 * vec3(u_shadowOffset, 0.0);\nvec4 layerColor = texture2D(u_layerFBOTexture, v_uv);\nvec4 blurColor = texture2D(u_blurTexture, v_uv - offset.xy / 2.0);\ngl_FragColor = ((1.0 - layerColor.a) * blurColor.a * u_shadowColor + layerColor);\n}" } }, "edge-detect": { "frei-chen": { "frei-chen.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform vec2 u_texSize;\nvarying vec2 v_uv;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[9];\nconst mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );\nconst mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );\nconst mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );\nconst mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );\nconst mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );\nconst mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );\nconst mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );\nconst mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );\nconst mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );\nvoid main() {\nG[0] = g0,\nG[1] = g1,\nG[2] = g2,\nG[3] = g3,\nG[4] = g4,\nG[5] = g5,\nG[6] = g6,\nG[7] = g7,\nG[8] = g8;\nmat3 I;\nfloat cnv[9];\nvec3 sample;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D(u_colorTexture, v_uv + texel * vec2(i - 1.0,j - 1.0)).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 9; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\nfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);\nfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);\ngl_FragColor = vec4(vec3(sqrt(M / S)), texture2D(u_colorTexture, v_uv).a);\n}" }, sobel: { "sobel.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nuniform vec2 u_texSize;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[2];\nconst mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );\nconst mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );\nvoid main() {\nmat3 I;\nfloat cnv[2];\nvec3 sample;\nG[0] = g0;\nG[1] = g1;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 2; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\ngl_FragColor = vec4(vec3(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1])), texture2D(u_colorTexture, v_uv).a);\n}" } }, "edge-enhance": { "edge-enhance.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nvarying vec2 v_uv;\nuniform vec2 u_texSize;\nvec2 texel = vec2(1.0 / u_texSize.x, 1.0 / u_texSize.y);\nmat3 G[2];\nconst mat3 g0 = mat3( 1.0, 0.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, -1.0 );\nconst mat3 g1 = mat3( 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0 );\nvoid main() {\nmat3 I;\nfloat cnv[2];\nvec3 sample;\nG[0] = g0;\nG[1] = g1;\nfor (float i = 0.0; i < 3.0; i++) {\nfor (float j = 0.0; j < 3.0; j++) {\nsample = texture2D( u_colorTexture, v_uv + texel * vec2(i-1.0,j-1.0) ).rgb;\nI[int(i)][int(j)] = length(sample);\n}\n}\nfor (int i = 0; i < 2; i++) {\nfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);\ncnv[i] = dp3 * dp3;\n}\nvec4 color = texture2D(u_colorTexture, v_uv);\ngl_FragColor = vec4(0.5 * sqrt(cnv[0] * cnv[0] + cnv[1] * cnv[1]) * color);\n}" }, filterEffect: { "filterEffect.frag": "precision mediump float;\nuniform sampler2D u_colorTexture;\nuniform mat4 u_coefficients;\nvarying vec2 v_uv;\nvoid main() {\nvec4 color = texture2D(u_colorTexture, v_uv);\nvec4 rgbw = u_coefficients * vec4(color.a > 0.0 ? color.rgb / color.a : vec3(0.0), 1.0);\nfloat a = color.a;\ngl_FragColor = vec4(a * rgbw.rgb, a);\n}" }, pp: { "pp.vert": "precision mediump float;\nattribute vec2 a_position;\nvarying vec2 v_uv;\nvoid main() {\ngl_Position = vec4(a_position, 0.0, 1.0);\nv_uv = (a_position + 1.0) / 2.0;\n}" } }, raster: { bitmap: { "bitmap.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform highp vec2 u_coordScale;\nuniform lowp float u_opacity;\n#include <filtering/bicubic.glsl>\nvoid main() {\n#ifdef BICUBIC\nvec4 color = sampleBicubicBSpline(u_texture, v_texcoord, u_coordScale);\n#else\nvec4 color = texture2D(u_texture, v_texcoord);\n#endif\ngl_FragColor = vec4(color.rgb * u_opacity, color.a * u_opacity);\n}", "bitmap.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" }, common: { "common.glsl": "uniform sampler2D u_image;\nuniform int u_bandCount;\nuniform bool u_flipY;\nuniform float u_opacity;\nuniform int u_resampling;\nuniform vec2 u_srcImageSize;\n#ifdef APPLY_PROJECTION\n#include <raster/common/projection.glsl>\n#endif\n#ifdef BICUBIC\n#include <filtering/bicubic.glsl>\n#endif\n#ifdef BILINEAR\n#include <filtering/bilinear.glsl>\n#endif\nvec2 getPixelLocation(vec2 coords) {\nvec2 targetLocation = u_flipY ? vec2(coords.s, 1.0 - coords.t) : coords;\n#ifdef APPLY_PROJECTION\ntargetLocation = projectPixelLocation(targetLocation);\n#endif\nreturn targetLocation;\n}\nbool isOutside(vec2 coords){\nif (coords.t>1.00001 ||coords.t<-0.00001 || coords.s>1.00001 ||coords.s<-0.00001) {\nreturn true;\n} else {\nreturn false;\n}\n}\nvec4 getPixel(vec2 pixelLocation) {\n#ifdef BICUBIC\nvec4 color = sampleBicubicBSpline(u_image, pixelLocation, u_srcImageSize);\n#elif defined(BILINEAR)\nvec4 color = sampleBilinear(u_image, pixelLocation, u_srcImageSize);\n#else\nvec4 color = texture2D(u_image, pixelLocation);\n#endif\nreturn color;\n}", "contrastBrightness.glsl": "uniform float u_contrastOffset;\nuniform float u_brightnessOffset;\nvec4 adjustContrastBrightness(vec4 currentPixel, bool isFloat) {\nvec4 pixelValue = isFloat ? currentPixel * 255.0 : currentPixel;\nfloat maxI = 255.0;\nfloat mid = 128.0;\nfloat c = u_contrastOffset;\nfloat b = u_brightnessOffset;\nvec4 v;\nif (c > 0.0 && c < 100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) / (2.0 * (100.0 - c)) + mid;\n} else if (c <= 0.0 && c > -100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + 2.0 * maxI * b) * (100.0 + c) / 20000.0 + mid;\n} else if (c == 100.0) {\nv = (200.0 * pixelValue - 100.0 * maxI + (maxI + 1.0) * (100.0 - c) + 2.0 * maxI * b);\nv = (sign(v) + 1.0) / 2.0;\n} else if (c == -100.0) {\nv = vec4(mid, mid, mid, currentPixel.a);\n}\nreturn vec4(v.r / 255.0, v.g / 255.0, v.b / 255.0, currentPixel.a);\n}", "projection.glsl": "uniform sampler2D u_transformGrid;\nuniform vec2 u_transformSpacing;\nuniform vec2 u_transformGridSize;\nuniform vec2 u_targetImageSize;\nvec2 projectPixelLocation(vec2 coords) {\n#ifdef LOOKUP_PROJECTION\nvec4 pv = texture2D(u_transformGrid, coords);\nreturn vec2(pv.r, pv.g);\n#endif\nvec2 index_image = floor(coords * u_targetImageSize);\nvec2 oneTransformPixel = vec2(0.25 / u_transformGridSize.s, 1.0 / u_transformGridSize.t);\nvec2 index_transform = floor(index_image / u_transformSpacing) / u_transformGridSize;\nvec2 pos = fract((index_image + vec2(0.5, 0.5)) / u_transformSpacing);\nvec2 srcLocation;\nvec2 transform_location = index_transform + oneTransformPixel * 0.5;\nif (pos.s <= pos.t) {\nvec4 ll_abc = texture2D(u_transformGrid, vec2(transform_location.s, transform_location.t));\nvec4 ll_def = texture2D(u_transformGrid, vec2(transform_location.s + oneTransformPixel.s, transform_location.t));\nsrcLocation.s = dot(ll_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t = dot(ll_def.rgb, vec3(pos, 1.0));\n} else {\nvec4 ur_abc = texture2D(u_transformGrid, vec2(transform_location.s + 2.0 * oneTransformPixel.s, transform_location.t));\nvec4 ur_def = texture2D(u_transformGrid, vec2(transform_location.s + 3.0 * oneTransformPixel.s, transform_location.t));\nsrcLocation.s = dot(ur_abc.rgb, vec3(pos, 1.0));\nsrcLocation.t = dot(ur_def.rgb, vec3(pos, 1.0));\n}\nreturn srcLocation;\n}" }, flow: { "getFadeOpacity.glsl": "uniform float u_decayRate;\nuniform float u_fadeToZero;\nfloat getFadeOpacity(float x) {\nfloat cutOff = mix(0.0, exp(-u_decayRate), u_fadeToZero);\nreturn (exp(-u_decayRate * x) - cutOff) / (1.0 - cutOff);\n}", "getFragmentColor.glsl": "vec4 getFragmentColor(vec4 color, float dist, float size, float featheringSize) {\nfloat featheringStart = clamp(0.5 - featheringSize / size, 0.0, 0.5);\nif (dist > featheringStart) {\ncolor *= 1.0 - (dist - featheringStart) / (0.5 - featheringStart);\n}\nreturn color;\n}", imagery: { "imagery.frag": "precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D u_texture;\nuniform float u_Min;\nuniform float u_Max;\nuniform float u_featheringSize;\n#include <raster/flow/vv.glsl>\nfloat getIntensity(float v) {\nreturn u_Min + v * (u_Max - u_Min);\n}\nvoid main(void) {\nvec4 sampled = texture2D(u_texture, v_texcoord);\nfloat intensity = getIntensity(sampled.r);\ngl_FragColor = getColor(intensity);\ngl_FragColor.a *= getOpacity(sampled.r);\ngl_FragColor.a *= sampled.a;\ngl_FragColor.rgb *= gl_FragColor.a;\n}", "imagery.vert": "attribute vec2 a_position;\nattribute vec2 a_texcoord;\nuniform mat3 u_dvsMat3;\nvarying vec2 v_texcoord;\nvoid main(void) {\nvec2 xy = (u_dvsMat3 * vec3(a_position, 1.0)).xy;\ngl_Position = vec4(xy, 0.0, 1.0);\nv_texcoord = a_texcoord;\n}" }, particles: { "particles.frag": "precision highp float;\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying float v_size;\nuniform float u_featheringSize;\n#include <raster/flow/getFragmentColor.glsl>\nvoid main(void) {\ngl_FragColor = getFragmentColor(v_color, length(v_texcoord - 0.5), v_size, u_featheringSize);\n}", "particles.vert": "attribute vec4 a_xyts0;\nattribute vec4 a_xyts1;\nattribute vec4 a_typeIdDurationSeed;\nattribute vec4 a_extrudeInfo;\nuniform mat3 u_dvsMat3;\nuniform mat3 u_displayViewMat3;\nuniform float u_time;\nuniform float u_trailLength;\nuniform float u_flowSpeed;\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying float v_size;\nuniform float u_featheringSize;\nuniform float u_introFade;\n#include <raster/flow/vv.glsl>\n#include <raster/flow/getFadeOpacity.glsl>\nvoid main(void) {\nvec2 position0 = a_xyts0.xy;\nfloat t0 = a_xyts0.z;\nfloat speed0 = a_xyts0.w;\nvec2 position1 = a_xyts1.xy;\nfloat t1 = a_xyts1.z;\nfloat speed1 = a_xyts1.w;\nfloat type = a_typeIdDurationSeed.x;\nfloat id = a_typeIdDurationSeed.y;\nfloat duration = a_typeIdDurationSeed.z;\nfloat seed = a_typeIdDurationSeed.w;\nvec2 e0 = a_extrudeInfo.xy;\nvec2 e1 = a_extrudeInfo.zw;\nfloat animationPeriod = duration + u_trailLength;\nfloat scaledTime = u_time * u_flowSpeed;\nfloat randomizedTime = scaledTime + seed * animationPeriod;\nfloat t = mod(randomizedTime, animationPeriod);\nfloat fUnclamped = (t - t0) / (t1 - t0);\nfloat f = clamp(fUnclamped, 0.0, 1.0);\nfloat clampedTime = mix(t0, t1, f);\nfloat speed = mix(speed0, speed1, f);\nvec2 extrude;\nvec2 position;\nfloat fadeOpacity;\nfloat introOpacity;\nif (type == 2.0) {\nif (fUnclamped < 0.0 || (fUnclamped > 1.0 && t1 != duration)) {\ngl_Position = vec4(0.0, 0.0, -2.0, 1.0);\nreturn;\n}\nvec2 ortho = mix(e0, e1, f);\nvec2 parallel;\nparallel = normalize(position1 - position0) * 0.5;\nif (id == 1.0) {\nextrude = ortho;\nv_texcoord = vec2(0.5, 0.0);\n} else if (id == 2.0) {\nextrude = -ortho;\nv_texcoord = vec2(0.5, 1.0);\n} else if (id == 3.0) {\nextrude = ortho + parallel;\nv_texcoord = vec2(1.0, 0.0);\n} else if (id == 4.0) {\nextrude = -ortho + parallel;\nv_texcoord = vec2(1.0, 1.0);\n}\nfadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength);\nintroOpacity = 1.0 - exp(-clampedTime);\nv_size = getSize(speed);\nv_color = getColor(speed);\nv_color.a *= getOpacity(speed);\nposition = mix(position0, position1, f);\n} else {\nif (fUnclamped < 0.0) {\ngl_Position = vec4(0.0, 0.0, -2.0, 1.0);\nreturn;\n}\nif (id == 1.0) {\nextrude = e0;\nv_texcoord = vec2(0.5, 0.0);\nfadeOpacity = getFadeOpacity((t - t0) / u_trailLength);\nintroOpacity = 1.0 - exp(-t0);\nv_size = getSize(speed0);\nv_color = getColor(speed0);\nv_color.a *= getOpacity(speed0);\nposition = position0;\n} else if (id == 2.0) {\nextrude = -e0;\nv_texcoord = vec2(0.5, 1.0);\nfadeOpacity = getFadeOpacity((t - t0) / u_trailLength);\nintroOpacity = 1.0 - exp(-t0);\nv_size = getSize(speed0);\nv_color = getColor(speed0);\nv_color.a *= getOpacity(speed0);\nposition = position0;\n} else if (id == 3.0) {\nextrude = mix(e0, e1, f);\nv_texcoord = vec2(0.5, 0.0);\nfadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength);\nintroOpacity = 1.0 - exp(-clampedTime);\nv_size = getSize(speed);\nv_color = getColor(speed);\nv_color.a *= getOpacity(speed);\nposition = mix(position0, position1, f);\n} else if (id == 4.0) {\nextrude = -mix(e0, e1, f);\nv_texcoord = vec2(0.5, 1.0);\nfadeOpacity = getFadeOpacity((t - clampedTime) / u_trailLength);\nintroOpacity = 1.0 - exp(-clampedTime);\nv_size = getSize(speed);\nv_color = getColor(speed);\nv_color.a *= getOpacity(speed);\nposition = mix(position0, position1, f);\n}\n}\nvec2 xy = (u_dvsMat3 * vec3(position, 1.0) + u_displayViewMat3 * vec3(extrude * v_size, 0.0)).xy;\ngl_Position = vec4(xy, 0.0, 1.0);\nv_color.a *= fadeOpacity;\nv_color.a *= mix(1.0, introOpacity, u_introFade);\nv_color.rgb *= v_color.a;\n}" }, streamlines: { "streamlines.frag": "precision highp float;\nvarying float v_side;\nvarying float v_time;\nvarying float v_totalTime;\nvarying float v_timeSeed;\nvarying vec4 v_color;\nvarying float v_size;\nuniform float u_time;\nuniform float u_trailLength;\nuniform float u_flowSpeed;\nuniform float u_featheringSize;\nuniform float u_introFade;\n#include <raster/flow/getFragmentColor.glsl>\n#include <raster/flow/getFadeOpacity.glsl>\nvoid main(void) {\nfloat t = mod(v_timeSeed * (v_totalTime + u_trailLength) + u_time * u_flowSpeed, v_totalTime + u_trailLength) - v_time;\nvec4 color = v_color * step(0.0, t) * getFadeOpacity(t / u_trailLength);\ncolor *= mix(1.0, 1.0 - exp(-v_time), u_introFade);\ngl_FragColor = getFragmentColor(color, length((v_side + 1.0) / 2.0 - 0.5), v_size, u_featheringSize);\n}", "streamlines.vert": "attribute vec3 a_positionAndSide;\nattribute vec3 a_timeInfo;\nattribute vec2 a_extrude;\nattribute float a_speed;\nuniform mat3 u_dvsMat3;\nuniform mat3 u_displayViewMat3;\nvarying float v_time;\nvarying float v_totalTime;\nvarying float v_timeSeed;\nvarying vec4 v_color;\nvarying float v_side;\nvarying float v_size;\nuniform float u_featheringSize;\n#include <raster/flow/vv.glsl>\nvoid main(void) {\nvec4 lineColor = getColor(a_speed);\nfloat lineOpacity = getOpacity(a_speed);\nfloat lineSize = getSize(a_speed);\nvec2 position = a_positionAndSide.xy;\nv_side = a_positionAndSide.z;\nvec2 xy = (u_dvsMat3 * vec3(position, 1.0) + u_displayViewMat3 * vec3(a_extrude * lineSize, 0.0)).xy;\ngl_Position = vec4(xy, 0.0, 1.0);\nv_time = a_timeInfo.x;\nv_totalTime = a_timeInfo.y;\nv_timeSeed = a_timeInfo.z;\nv_color = lineColor;\nv_color.a *= lineOpacity;\nv_color.rgb *= v_color.a;\nv_size = lineSize;\n}" }, "vv.glsl": "#define MAX_STOPS 8\n#ifdef VV_COLOR\nuniform float u_color_stops[MAX_STOPS];\nuniform vec4 u_color_values[MAX_STOPS];\nuniform int u_color_count;\n#else\nuniform vec4 u_color;\n#endif\n#ifdef VV_OPACITY\nuniform float u_opacity_stops[MAX_STOPS];\nuniform float u_opacity_values[MAX_STOPS];\nuniform int u_opacity_count;\n#else\nuniform float u_opacity;\n#endif\n#ifdef VV_SIZE\nuniform float u_size_stops[MAX_STOPS];\nuniform float u_size_values[MAX_STOPS];\nuniform int u_size_count;\n#else\nuniform float u_size;\n#endif\nuniform float u_featheringOffset;\nvec4 getColor(float x) {\n#ifdef VV_COLOR\nvec4 color = u_color_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_color_count) {\nbreak;\n}\nfloat x1 = u_color_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_color_stops[i];\nvec4 y2 = u_color_values[i];\nif (x < x2) {\nvec4 y1 = u_color_values[i - 1];\ncolor = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\ncolor = y2;\n}\n}\n}\n#else\nvec4 color = u_color;\n#endif\nreturn color;\n}\nfloat getOpacity(float x) {\n#ifdef VV_OPACITY\nfloat opacity = u_opacity_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_opacity_count) {\nbreak;\n}\nfloat x1 = u_opacity_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_opacity_stops[i];\nfloat y2 = u_opacity_values[i];\nif (x < x2) {\nfloat y1 = u_opacity_values[i - 1];\nopacity = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\nopacity = y2;\n}\n}\n}\n#else\nfloat opacity = u_opacity;\n#endif\nreturn opacity;\n}\nfloat getSize(float x) {\n#ifdef VV_SIZE\nfloat size = u_size_values[0];\n{\nfor (int i = 1; i < MAX_STOPS; i++) {\nif (i >= u_size_count) {\nbreak;\n}\nfloat x1 = u_size_stops[i - 1];\nif (x < x1) {\nbreak;\n}\nfloat x2 = u_size_stops[i];\nfloat y2 = u_size_values[i];\nif (x < x2) {\nfloat y1 = u_size_values[i - 1];\nsize = y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n} else {\nsize = y2;\n}\n}\n}\n#else\nfloat size = u_size;\n#endif\nreturn size + 2.0 * u_featheringSize * u_featheringOffset;\n}" }, hillshade: { "hillshade.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\n#include <raster/common/common.glsl>\nuniform int u_hillshadeType;\nuniform float u_sinZcosAs[6];\nuniform float u_sinZsinAs[6];\nuniform float u_cosZs[6];\nuniform float u_weights[6];\nuniform vec2 u_factor;\nuniform float u_minValue;\nuniform float u_maxValue;\n#include <raster/lut/colorize.glsl>\nfloat getNeighborHoodAlpha(float a, float b, float c, float d, float e, float f, float g, float h, float i){\nif (a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0 || a == 0.0 || a == 0.0 || a==0.0) {\nreturn 0.0;\n}\nelse {\nreturn e;\n}\n}\nvec3 rgb2hsv(vec3 c) {\nvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);\nvec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);\nfloat d = q.x - min(q.w, q.y);\nfloat e = 1.0e-10;\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);\n}\nvec3 hsv2rgb(vec3 c) {\nvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\nreturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\nvec4 overlay(float val, float minValue, float maxValue, float hillshade) {\nval = clamp((val - minValue) / (maxValue - minValue), 0.0, 1.0);\nvec4 rgb = colorize(vec4(val, val, val, 1.0), 255.0);\nvec3 hsv = rgb2hsv(rgb.xyz);\nhsv.z = hillshade;\nreturn vec4(hsv2rgb(hsv), 1.0) * rgb.a;\n}\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\nif (currentPixel.a == 0.0) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec2 axy = vec2(-1.0, -1.0);\nvec2 bxy = vec2(0.0, -1.0);\nvec2 cxy = vec2(1.0, -1.0);\nvec2 dxy = vec2(-1.0, 0.0);\nvec2 fxy = vec2(1.0, 0.0);\nvec2 gxy = vec2(-1.0, 1.0);\nvec2 hxy = vec2(0.0, 1.0);\nvec2 ixy = vec2(1.0, 1.0);\nvec2 onePixel = 1.0 / u_srcImageSize;\nif (pixelLocation.s < onePixel.s) {\naxy[0] = 1.0;\ndxy[0] = 1.0;\ngxy[0] = 1.0;\n}\nif (pixelLocation.t < onePixel.t) {\naxy[1] = 1.0;\nbxy[1] = 1.0;\ncxy[1] = 1.0;\n}\nif (pixelLocation.s > 1.0 - onePixel.s) {\ncxy[0] = -1.0;\nfxy[0] = -1.0;\nixy[0] = -1.0;\n}\nif (pixelLocation.t > 1.0 - onePixel.t) {\ngxy[1] = -1.0;\nhxy[1] = -1.0;\nixy[1] = -1.0;\n}\nvec4 va = texture2D(u_image, pixelLocation + onePixel * axy);\nvec4 vb = texture2D(u_image, pixelLocation + onePixel * bxy);\nvec4 vc = texture2D(u_image, pixelLocation + onePixel * cxy);\nvec4 vd = texture2D(u_image, pixelLocation + onePixel * dxy);\nvec4 ve = texture2D(u_image, pixelLocation);\nvec4 vf = texture2D(u_image, pixelLocation + onePixel * fxy);\nvec4 vg = texture2D(u_image, pixelLocation + onePixel * gxy);\nvec4 vh = texture2D(u_image, pixelLocation + onePixel * hxy);\nvec4 vi = texture2D(u_image, pixelLocation + onePixel * ixy);\nfloat dzx = (vc + 2.0 * vf + vi - va - 2.0 * vd - vg).r * u_factor.s;\nfloat dzy = (vg + 2.0 * vh + vi - va - 2.0 * vb - vc).r * u_factor.t;\nfloat dzd = sqrt(1.0 + dzx * dzx + dzy * dzy);\nfloat hillshade = 0.0;\nif (u_hillshadeType == 0){\nfloat cosDelta = u_sinZsinAs[0] * dzy - u_sinZcosAs[0] * dzx;\nfloat z = (u_cosZs[0] + cosDelta) / dzd;\nif (z < 0.0) z = 0.0;\nhillshade = z;\n} else {\nfor (int k = 0; k < 6; k++) {\nfloat cosDelta = u_sinZsinAs[k] * dzy - u_sinZcosAs[k] * dzx;\nfloat z = (u_cosZs[k] + cosDelta) / dzd;\nif (z < 0.0) z = 0.0;\nhillshade = hillshade + z * u_weights[k];\nif (k == 5) break;\n}\n}\nfloat alpha = getNeighborHoodAlpha(va.a, vb.a, vc.a, vd.a, ve.a, vf.a, vg.a, vh.a, vi.a);\n#ifdef APPLY_COLORMAP\ngl_FragColor = overlay(ve.r, u_minValue, u_maxValue, hillshade) * alpha * u_opacity;\n#else\ngl_FragColor = vec4(hillshade, hillshade, hillshade, 1.0) * alpha * u_opacity;\n#endif\n}", "hillshade.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" }, lut: { "colorize.glsl": "uniform sampler2D u_colormap;\nuniform float u_colormapOffset;\nuniform float u_colormapMaxIndex;\nvec4 colorize(vec4 currentPixel, float scaleFactor) {\nfloat clrIndex = clamp(currentPixel.r * scaleFactor - u_colormapOffset, 0.0, u_colormapMaxIndex);\nvec2 clrPosition = vec2((clrIndex + 0.5) / (u_colormapMaxIndex + 1.0), 0.0);\nvec4 color = texture2D(u_colormap, clrPosition);\nvec4 result = vec4(color.rgb, color.a * currentPixel.a);\nreturn result;\n}", "lut.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\n#include <raster/common/common.glsl>\n#include <raster/lut/colorize.glsl>\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\nvec4 result = colorize(currentPixel, 1.0);\ngl_FragColor = vec4(result.xyz, 1.0) * result.a * u_opacity;\n}", "lut.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform highp float u_scale;\nuniform highp vec2 u_offset;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos * u_scale + u_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" }, magdir: { "magdir.frag": "precision mediump float;\nvarying vec4 v_color;\nuniform lowp float u_opacity;\nvoid main() {\ngl_FragColor = v_color * u_opacity;\n}", "magdir.vert": "precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_vv;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform vec2 u_symbolSize;\nuniform vec2 u_symbolPercentRange;\nuniform vec2 u_dataRange;\nuniform float u_rotation;\nuniform vec4 u_colors[12];\nvarying vec4 v_color;\nvoid main()\n{\nfloat angle = a_offset.y + u_rotation;\n#ifndef ROTATION_GEOGRAPHIC\nangle = 3.14159265359 * 2.0 - angle - 3.14159265359 / 2.0;\n#endif\nvec2 offset = vec2(cos(angle), sin(angle)) * a_offset.x;\n#ifdef DATA_RANGE\nfloat valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0);\nfloat sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x);\nfloat sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y);\n#else\nfloat sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0;\n#endif\nvec2 pos = a_pos + offset * sizePercentage * u_symbolSize;\nv_color = u_colors[int(a_vv.x)];\ngl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0);\n}" }, reproject: { "reproject.frag": "precision mediump float;\nvarying vec2 v_texcoord;\n#include <raster/common/common.glsl>\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\ngl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity;\n}", "reproject.vert": "precision mediump float;\nattribute vec2 a_position;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_position;\ngl_Position = vec4(2.0 * (a_position - 0.5), 0.0, 1.0);\n}" }, scalar: { "scalar.frag": "precision mediump float;\nuniform lowp float u_opacity;\nvarying vec2 v_pos;\nconst vec4 outlineColor = vec4(0.2, 0.2, 0.2, 1.0);\nconst float outlineSize = 0.02;\nconst float innerRadius = 0.25;\nconst float outerRadius = 0.42;\nconst float innerSquareLength = 0.15;\nvoid main() {\nmediump float dist = length(v_pos);\nmediump float fillalpha1 = smoothstep(outerRadius, outerRadius + outlineSize, dist);\nfillalpha1 *= (1.0-smoothstep(outerRadius + outlineSize, outerRadius + 0.1 + outlineSize, dist));\n#ifdef INNER_CIRCLE\nmediump float fillalpha2 = smoothstep(innerRadius, innerRadius + outlineSize, dist);\nfillalpha2 *= (1.0-smoothstep(innerRadius + outlineSize, innerRadius + 0.1 + outlineSize, dist));\n#else\nmediump float fillalpha2 = (abs(v_pos.x) < innerSquareLength ? 1.0 : 0.0) * (abs(v_pos.y) < innerSquareLength ? 1.0 : 0.0);\n#endif\ngl_FragColor = (fillalpha2 + fillalpha1) * outlineColor * u_opacity;\n}", "scalar.vert": "precision mediump float;\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_vv;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform vec2 u_symbolSize;\nuniform vec2 u_symbolPercentRange;\nuniform vec2 u_dataRange;\nvarying vec2 v_pos;\nvoid main()\n{\n#ifdef DATA_RANGE\nfloat valuePercentage = clamp((a_vv.y - u_dataRange.x) / (u_dataRange.y - u_dataRange.x), 0.0, 1.0);\nfloat sizeRatio = u_symbolPercentRange.x + valuePercentage * (u_symbolPercentRange.y - u_symbolPercentRange.x);\nfloat sizePercentage = clamp(sizeRatio, u_symbolPercentRange.x, u_symbolPercentRange.y);\n#else\nfloat sizePercentage = (u_symbolPercentRange.x + u_symbolPercentRange.y) / 2.0;\n#endif\nvec2 size = u_symbolSize * sizePercentage;\nvec2 pos = a_pos + a_offset * size;\nv_pos = a_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(pos * u_coordScale, 1.0), 1.0);\n}" }, stretch: { "stretch.frag": "precision mediump float;\nvarying highp vec2 v_texcoord;\n#include <raster/common/common.glsl>\nuniform float u_minCutOff[3];\nuniform float u_maxCutOff[3];\nuniform float u_minOutput;\nuniform float u_maxOutput;\nuniform float u_factor[3];\nuniform bool u_useGamma;\nuniform float u_gamma[3];\nuniform float u_gammaCorrection[3];\n#include <raster/lut/colorize.glsl>\nfloat stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, bool useGamma, float gamma, float gammaCorrection) {\nif (val >= maxCutOff) {\nreturn maxOutput;\n} else if (val <= minCutOff) {\nreturn minOutput;\n}\nfloat stretchedVal;\nif (useGamma) {\nfloat tempf = 1.0;\nfloat outRange = maxOutput - minOutput;\nfloat relativeVal = (val - minCutOff) / (maxCutOff - minCutOff);\nif (gamma > 1.0) {\ntempf -= pow(1.0 / outRange, relativeVal * gammaCorrection);\n}\nstretchedVal = (tempf * outRange * pow(relativeVal, 1.0 / gamma) + minOutput) / 255.0;\n} else {\nstretchedVal = minOutput + (val - minCutOff) * factor;\n}\nreturn stretchedVal;\n}\nvoid main() {\nvec2 pixelLocation = getPixelLocation(v_texcoord);\nif (isOutside(pixelLocation)) {\ngl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\nreturn;\n}\nvec4 currentPixel = getPixel(pixelLocation);\n#ifdef NOOP\ngl_FragColor = vec4(currentPixel.rgb, 1.0) * currentPixel.a * u_opacity;\nreturn;\n#endif\nif (u_bandCount == 1) {\nfloat grayVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]);\n#ifdef APPLY_COLORMAP\nvec4 result = colorize(vec4(grayVal, grayVal, grayVal, 1.0), u_useGamma ? 255.0 : 1.0);\ngl_FragColor = vec4(result.xyz, 1.0) * result.a * currentPixel.a * u_opacity;\n#else\ngl_FragColor = vec4(grayVal, grayVal, grayVal, 1.0) * currentPixel.a * u_opacity;\n#endif\n} else {\nfloat redVal = stretchOneValue(currentPixel.r, u_minCutOff[0], u_maxCutOff[0], u_minOutput, u_maxOutput, u_factor[0], u_useGamma, u_gamma[0], u_gammaCorrection[0]);\nfloat greenVal = stretchOneValue(currentPixel.g, u_minCutOff[1], u_maxCutOff[1], u_minOutput, u_maxOutput, u_factor[1], u_useGamma, u_gamma[1], u_gammaCorrection[1]);\nfloat blueVal = stretchOneValue(currentPixel.b, u_minCutOff[2], u_maxCutOff[2], u_minOutput, u_maxOutput, u_factor[2], u_useGamma, u_gamma[2], u_gammaCorrection[2]);\ngl_FragColor = vec4(redVal, greenVal, blueVal, 1.0) * currentPixel.a * u_opacity;\n}\n}", "stretch.vert": "precision mediump float;\nattribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform highp vec2 u_coordScale;\nuniform highp float u_scale;\nuniform highp vec2 u_offset;\nvarying highp vec2 v_texcoord;\nvoid main()\n{\nv_texcoord = a_pos * u_scale + u_offset;\ngl_Position = vec4(u_dvsMat3 * vec3(a_pos * u_coordScale, 1.0), 1.0);\n}" } }, stencil: { "stencil.frag": "void main() {\ngl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n}", "stencil.vert": "attribute vec2 a_pos;\nuniform mat3 u_worldExtent;\nvoid main() {\ngl_Position = vec4(u_worldExtent * vec3(a_pos, 1.0), 1.0);\n}" }, tileInfo: { "tileInfo.frag": "uniform mediump sampler2D u_texture;\nvarying mediump vec2 v_tex;\nvoid main(void) {\nlowp vec4 color = texture2D(u_texture, v_tex);\ngl_FragColor = 0.75 * color;\n}", "tileInfo.vert": "attribute vec2 a_pos;\nuniform highp mat3 u_dvsMat3;\nuniform mediump float u_depth;\nuniform mediump vec2 u_coord_ratio;\nuniform mediump vec2 u_delta;\nuniform mediump vec2 u_dimensions;\nvarying mediump vec2 v_tex;\nvoid main() {\nmediump vec2 offset = u_coord_ratio * vec2(u_delta + a_pos * u_dimensions);\nvec3 v_pos = u_dvsMat3 * vec3(offset, 1.0);\ngl_Position = vec4(v_pos.xy, 0.0, 1.0);\nv_tex = a_pos;\n}" }, util: { "atan2.glsl": "float atan2(in float y, in float x) {\nfloat t0, t1, t2, t3, t4;\nt3 = abs(x);\nt1 = abs(y);\nt0 = max(t3, t1);\nt1 = min(t3, t1);\nt3 = 1.0 / t0;\nt3 = t1 * t3;\nt4 = t3 * t3;\nt0 = - 0.013480470;\nt0 = t0 * t4 + 0.057477314;\nt0 = t0 * t4 - 0.121239071;\nt0 = t0 * t4 + 0.195635925;\nt0 = t0 * t4 - 0.332994597;\nt0 = t0 * t4 + 0.999995630;\nt3 = t0 * t3;\nt3 = (abs(y) > abs(x)) ? 1.570796327 - t3 : t3;\nt3 = x < 0.0 ? 3.141592654 - t3 : t3;\nt3 = y < 0.0 ? -t3 : t3;\nreturn t3;\n}", "encoding.glsl": "const vec4 rgba2float_factors = vec4(\n255.0 / (256.0),\n255.0 / (256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n);\nfloat rgba2float(vec4 rgba) {\nreturn dot(rgba, rgba2float_factors);\n}" } };
  602. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/sources/resolver.js
  603. function o5(e8) {
  604. let o7 = e6;
  605. return e8.split("/").forEach((r10) => {
  606. o7 && (o7 = o7[r10]);
  607. }), o7;
  608. }
  609. var t9 = new e3(o5);
  610. function n6(r10) {
  611. return t9.resolveIncludes(r10);
  612. }
  613. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/BackgroundPrograms.js
  614. var e7 = { shaders: { vertexShader: n6("background/background.vert"), fragmentShader: n6("background/background.frag") }, attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) };
  615. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/BrushClip.js
  616. var c4 = () => ge("clip", { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }] });
  617. var d4 = class extends t7 {
  618. constructor() {
  619. super(...arguments), this._color = r8(0, 1, 0, 1);
  620. }
  621. dispose() {
  622. this._program && this._program.dispose();
  623. }
  624. prepareState({ context: r10 }) {
  625. r10.setStencilTestEnabled(true), r10.setBlendingEnabled(false), r10.setFaceCullingEnabled(false), r10.setColorMask(false, false, false, false), r10.setStencilOp(O.KEEP, O.KEEP, O.REPLACE), r10.setStencilWriteMask(255), r10.setStencilFunction(I.ALWAYS, 0, 255);
  626. }
  627. draw(t11, s10) {
  628. const { context: o7, state: a4, requestRender: m11, allowDelayedRender: d7 } = t11, f5 = c4(), g3 = s10.getVAO(o7, a4, f5.attributes, f5.bufferLayouts);
  629. t(g3.indexBuffer) || (this._program || (this._program = e4(o7, e7)), d7 && r(m11) && !this._program.isCompiled ? m11() : (o7.useProgram(this._program), this._program.setUniform2fv("u_coord_range", [1, 1]), this._program.setUniform4fv("u_color", this._color), this._program.setUniformMatrix3fv("u_dvsMat3", a4.displayMat3), o7.bindVAO(g3), o7.drawElements(E.TRIANGLES, g3.indexBuffer.size, C.UNSIGNED_INT, 0), o7.bindVAO()));
  630. }
  631. };
  632. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/BrushOverlay.js
  633. var m5 = () => ge("overlay", { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.FLOAT }], tex: [{ location: 1, name: "a_uv", count: 2, type: C.UNSIGNED_SHORT }] });
  634. var u2 = class extends t7 {
  635. constructor() {
  636. super(...arguments), this._desc = { vsPath: "overlay/overlay", fsPath: "overlay/overlay", attributes: /* @__PURE__ */ new Map([["a_pos", 0], ["a_uv", 1]]) };
  637. }
  638. dispose() {
  639. }
  640. prepareState({ context: e8 }) {
  641. e8.setBlendingEnabled(true), e8.setColorMask(true, true, true, true), e8.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e8.setStencilWriteMask(0), e8.setStencilTestEnabled(true), e8.setStencilFunction(I.GREATER, 255, 255);
  642. }
  643. draw(r10, s10) {
  644. const { context: o7, painter: n10, requestRender: i6, allowDelayedRender: u6 } = r10;
  645. if (!s10.isReady)
  646. return;
  647. const { computedOpacity: c8, dvsMat3: d7, isWrapAround: l8, perspectiveTransform: p6, texture: f5 } = s10;
  648. r10.timeline.begin(this.name);
  649. const _5 = n10.materialManager.getProgram(this._desc);
  650. if (u6 && r(i6) && !_5.isCompiled)
  651. return void i6();
  652. const v2 = m5(), y3 = s10.getVAO(o7, v2.bufferLayouts, v2.attributes);
  653. if (!y3)
  654. return;
  655. o7.bindVAO(y3), o7.useProgram(_5), o7.bindTexture(f5, A), _5.setUniformMatrix3fv("u_dvsMat3", d7), _5.setUniform1i("u_texture", A), _5.setUniform1f("u_opacity", c8), _5.setUniform2fv("u_perspective", p6);
  656. const A4 = l8 ? 10 : 4;
  657. o7.drawArrays(E.TRIANGLE_STRIP, 0, A4), o7.bindVAO(), r10.timeline.end(this.name);
  658. }
  659. };
  660. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrush.js
  661. var p4 = class extends t7 {
  662. constructor() {
  663. super(...arguments), this._computeDesc = /* @__PURE__ */ new Map();
  664. }
  665. prepareState({ context: t11 }, e8) {
  666. e8 && e8.includes("hittest") ? t11.setBlendFunctionSeparate(R.ONE, R.ONE, R.ONE, R.ONE) : t11.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), t11.setBlendingEnabled(true), t11.setColorMask(true, true, true, true), t11.setStencilWriteMask(0), t11.setStencilTestEnabled(true);
  667. }
  668. draw(e8, i6, s10) {
  669. const o7 = this.getGeometryType();
  670. i6.commit(e8);
  671. const a4 = i6.getGeometry(o7);
  672. t(a4) || (e8.timeline.begin(this.name), e8.attributeView.bindTextures(e8.context), e8.context.setStencilFunction(I.EQUAL, i6.stencilRef, 255), a4.forEachCommand((t11) => {
  673. const o8 = U2.load(t11.materialKey).symbologyType;
  674. this.supportsSymbology(o8) && this.drawGeometry(e8, i6, t11, s10);
  675. }));
  676. }
  677. _setSharedUniforms(t11, u6, v2) {
  678. const { displayLevel: f5, pixelRatio: l8, state: p6, passOptions: c8 } = u6;
  679. r(c8) && "hittest" === c8.type && (t11.setUniform2fv("u_hittestPos", c8.position), t11.setUniform1f("u_hittestDist", c8.distance)), t11.setUniform1f("u_pixelRatio", l8), t11.setUniformMatrix3fv("u_tileMat3", v2.transforms.tileMat3), t11.setUniformMatrix3fv("u_viewMat3", p6.viewMat3), t11.setUniformMatrix3fv("u_dvsMat3", v2.transforms.dvs), t11.setUniformMatrix3fv("u_displayViewMat3", p6.displayViewMat3), t11.setUniform1f("u_currentZoom", Math.round(f5 * at)), t11.setUniform1i("u_attributeTextureSize", u6.attributeView.size), t11.setUniform1i("u_attributeData0", B2), t11.setUniform1i("u_attributeData1", C2), t11.setUniform1i("u_attributeData2", D2), t11.setUniform1i("u_attributeData3", E2), t11.setUniform1i("u_attributeData4", F2), t11.setUniform1i("u_attributeData5", G2);
  680. }
  681. _setSizeVVUniforms(t11, e8, i6, s10) {
  682. if (t11.vvSizeMinMaxValue && e8.setUniform4fv("u_vvSizeMinMaxValue", i6.vvSizeMinMaxValue), t11.vvSizeScaleStops && e8.setUniform1f("u_vvSizeScaleStopsValue", i6.vvSizeScaleStopsValue), t11.vvSizeFieldStops) {
  683. const t12 = i6.getSizeVVFieldStops(s10.key.level);
  684. e8.setUniform1fv("u_vvSizeFieldStopsValues", t12.values), e8.setUniform1fv("u_vvSizeFieldStopsSizes", t12.sizes);
  685. }
  686. t11.vvSizeUnitValue && e8.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio", i6.vvSizeUnitValueToPixelsRatio);
  687. }
  688. _setColorAndOpacityVVUniforms(t11, e8, i6) {
  689. t11.vvColor && (e8.setUniform1fv("u_vvColorValues", i6.vvColorValues), e8.setUniform4fv("u_vvColors", i6.vvColors)), t11.vvOpacity && (e8.setUniform1fv("u_vvOpacityValues", i6.vvOpacityValues), e8.setUniform1fv("u_vvOpacities", i6.vvOpacities));
  690. }
  691. _setRotationVVUniforms(t11, e8, i6) {
  692. t11.vvRotation && e8.setUniform1f("u_vvRotationType", "geographic" === i6.vvMaterialParameters.vvRotationType ? 0 : 1);
  693. }
  694. _getTriangleDesc(t11, e8, i6 = ["a_pos"]) {
  695. const s10 = e8.bufferLayouts.geometry, o7 = i6.map((t12) => s10.findIndex((e9) => e9.name === t12)), a4 = `${t11}-${o7.join("-")}`;
  696. let r10 = this._computeDesc.get(a4);
  697. if (!r10) {
  698. const t12 = e8.strides, i7 = e8.strides.geometry, n10 = new Map(e8.attributes), m11 = s10.map((t13) => ({ ...t13 })), u6 = Math.max(...e8.attributes.values()), v2 = { geometry: m11 };
  699. let f5 = 0;
  700. for (const e9 of o7) {
  701. const t13 = s10[e9];
  702. v2.geometry.push({ count: t13.count, name: t13.name + "1", divisor: t13.divisor, normalized: t13.normalized, offset: i7 + t13.offset, stride: i7, type: t13.type }), v2.geometry.push({ count: t13.count, name: t13.name + "2", divisor: t13.divisor, normalized: t13.normalized, offset: 2 * i7 + t13.offset, stride: i7, type: t13.type }), n10.set(t13.name + "1", u6 + ++f5), n10.set(t13.name + "2", u6 + ++f5);
  703. }
  704. r10 = { bufferLayouts: v2, attributes: n10, strides: t12 }, this._computeDesc.set(a4, r10);
  705. }
  706. return r10;
  707. }
  708. };
  709. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js
  710. function u3(e8) {
  711. const t11 = { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 3, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_bitset", count: 1, type: C.UNSIGNED_BYTE }, { location: 3, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 4, name: "a_aux1", count: 4, type: C.UNSIGNED_SHORT }, { location: 5, name: "a_aux2", count: 4, type: C.SHORT }, { location: 6, name: "a_aux3", count: 4, type: C.UNSIGNED_BYTE }, { location: 7, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }] };
  712. switch (e8.symbologyType) {
  713. case S.SIMPLE:
  714. case S.OUTLINE_FILL_SIMPLE:
  715. t11.geometry.splice(7, 1), t11.geometry.splice(4, 1);
  716. }
  717. return { shader: "materials/fill", vertexLayout: t11 };
  718. }
  719. var c5 = class extends p4 {
  720. dispose() {
  721. }
  722. getGeometryType() {
  723. return E3.FILL;
  724. }
  725. supportsSymbology(e8) {
  726. return e8 !== S.DOT_DENSITY;
  727. }
  728. drawGeometry(o7, r10, i6, l8) {
  729. const { context: c8, painter: y3, rendererInfo: p6, requiredLevel: _5, passOptions: d7, requestRender: f5, allowDelayedRender: E7 } = o7, S3 = w2.load(i6.materialKey), g3 = p(S3.data), N4 = r(d7) && "hittest" === d7.type, T3 = y3.materialManager, { shader: I3, vertexLayout: U3, hittestAttributes: x7 } = i(g3.programSpec, u3(S3));
  730. let L3 = E.TRIANGLES, h5 = ge(S3.data, U3);
  731. N4 && (h5 = this._getTriangleDesc(i6.materialKey, h5, x7), L3 = E.POINTS);
  732. const { attributes: G3, bufferLayouts: O5 } = h5, b3 = T3.getMaterialProgram(o7, S3, I3, G3, l8);
  733. if (E7 && r(f5) && !b3.isCompiled)
  734. return void f5();
  735. if (c8.useProgram(b3), this._setSharedUniforms(b3, o7, r10), b3.setUniform2f("u_tileOffset", 512 * r10.key.col, 512 * r10.key.row), S3.textureBinding) {
  736. y3.textureManager.bindTextures(c8, b3, S3);
  737. const e8 = 1 / 2 ** (_5 - r10.key.level);
  738. b3.setUniform1f("u_zoomFactor", e8);
  739. }
  740. const D3 = 1 / o7.pixelRatio;
  741. b3.setUniform1f("u_blur", D3), b3.setUniform1f("u_antialiasing", D3), this._setSizeVVUniforms(S3, b3, p6, r10), this._setColorAndOpacityVVUniforms(S3, b3, p6);
  742. const R2 = i6.target.getVAO(c8, O5, G3, N4);
  743. let w4 = i6.indexCount, j = i6.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  744. N4 && (w4 /= 3, j /= 3), c8.bindVAO(R2), this._drawFills(o7, r10, b3, L3, w4, j);
  745. }
  746. _drawFills(e8, t11, o7, r10, a4, i6) {
  747. e8.context.drawElements(r10, a4, C.UNSIGNED_INT, i6);
  748. }
  749. };
  750. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushDotDensity.js
  751. var O4 = class extends c5 {
  752. constructor() {
  753. super(...arguments), this._dotTextureSize = 0, this._dotTextures = null, this._dotSamplers = new Int32Array([K2, L2]), this._dotVAO = null, this._dotDesc = { vsPath: "dot/dot", fsPath: "dot/dot", attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) };
  754. }
  755. dispose() {
  756. super.dispose(), this._disposeTextures(), this._dotFBO = a(this._dotFBO), this._dotVAO = a(this._dotVAO);
  757. }
  758. getGeometryType() {
  759. return E3.FILL;
  760. }
  761. supportsSymbology(e8) {
  762. return e8 === S.DOT_DENSITY;
  763. }
  764. _drawFills(e8, o7, r10, s10, i6, n10) {
  765. const { passOptions: d7 } = e8;
  766. if (r(d7) && "hittest" === d7.type)
  767. super._drawFills(e8, o7, r10, s10, i6, n10);
  768. else {
  769. const t11 = this._drawDotLocations(e8, o7, r10, i6, n10);
  770. this._drawDotDensity(e8, o7, t11);
  771. }
  772. }
  773. _drawDotDensity(e8, o7, r10) {
  774. const { context: s10, painter: i6, rendererInfo: n10, requestRender: d7, allowDelayedRender: a4 } = e8, l8 = i6.materialManager.getProgram(this._dotDesc);
  775. if (a4 && r(d7) && !l8.isCompiled)
  776. return void d7();
  777. const { rendererSchema: u6 } = n10;
  778. s5(u6, "dot-density");
  779. const c8 = this._createDotDensityMesh(s10, this._dotDesc.attributes, { geometry: [{ name: "a_pos", count: 2, type: C.SHORT, divisor: 0, normalized: false, offset: 0, stride: 4 }] });
  780. s10.setStencilTestEnabled(true), s10.useProgram(l8), l8.setUniform1f("u_tileZoomFactor", 1), l8.setUniform1i("u_texture", this._dotSamplers[0]), l8.setUniform1f("u_dotSize", Math.max(u6.dotSize, 1)), l8.setUniform1f("u_pixelRatio", window.devicePixelRatio), this._setSharedUniforms(l8, e8, o7), s10.bindTexture(r10, this._dotSamplers[0]), s10.bindVAO(c8), s10.drawArrays(E.POINTS, 0, 262144);
  781. }
  782. _drawDotLocations(e8, t11, o7, r10, s10) {
  783. const { context: i6, rendererInfo: d7, requiredLevel: a4 } = e8, l8 = i6.getViewport(), { rendererSchema: u6 } = d7;
  784. s5(u6, "dot-density");
  785. const { dotScale: c8, colors: f5, activeDots: T3, backgroundColor: p6, dotValue: x7 } = u6;
  786. i6.setViewport(0, 0, 512, 512);
  787. const w4 = i6.getBoundFramebufferObject(), D3 = this._createFBO(i6);
  788. i6.bindFramebuffer(D3), i6.setClearColor(0, 0, 0, 0), i6.clear(i6.gl.COLOR_BUFFER_BIT | i6.gl.STENCIL_BUFFER_BIT), i6.setStencilTestEnabled(false);
  789. const y3 = 1 / 2 ** (a4 - t11.key.level), g3 = o2, S3 = g3 * window.devicePixelRatio * g3 * window.devicePixelRatio, E7 = 1 / y3 * (1 / y3), b3 = c8 ? e8.state.scale / c8 : 1;
  790. return o7.setUniform1f("u_tileZoomFactor", y3), o7.setUniform1f("u_tileDotsOverArea", S3 / (o2 * window.devicePixelRatio * o2 * window.devicePixelRatio)), o7.setUniformMatrix4fv("u_dotColors", f5), o7.setUniform4fv("u_isActive", T3), o7.setUniform4fv("u_dotBackgroundColor", p6), o7.setUniform1f("u_dotValue", Math.max(1, x7 * b3 * E7)), this._bindDotDensityTextures(i6, o7, d7, g3), i6.drawElements(E.TRIANGLES, r10, C.UNSIGNED_INT, s10), i6.setViewport(l8.x, l8.y, l8.width, l8.height), i6.bindFramebuffer(w4), D3.colorTexture;
  791. }
  792. _createFBO(e8) {
  793. if (t(this._dotFBO)) {
  794. const t11 = 512, o7 = 512, r10 = { target: M.TEXTURE_2D, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, wrapMode: D.CLAMP_TO_EDGE, width: t11, height: o7 }, s10 = { colorTarget: Y.TEXTURE, depthStencilTarget: V.DEPTH_STENCIL_RENDER_BUFFER }, i6 = new s4(e8, { width: t11, height: o7, internalFormat: B.DEPTH_STENCIL });
  795. this._dotFBO = new x2(e8, s10, r10, i6);
  796. }
  797. return this._dotFBO;
  798. }
  799. _disposeTextures() {
  800. if (this._dotTextures) {
  801. for (let e8 = 0; e8 < this._dotTextures.length; e8++)
  802. this._dotTextures[e8].dispose();
  803. this._dotTextures = null;
  804. }
  805. }
  806. _bindDotDensityTextures(e8, t11, o7, r10) {
  807. const { rendererSchema: s10 } = o7;
  808. s5(s10, "dot-density");
  809. const i6 = this._createDotDensityTextures(e8, r10, s10.seed);
  810. t11.setUniform1iv("u_dotTextures", this._dotSamplers);
  811. for (let n10 = 0; n10 < i6.length; n10++)
  812. e8.bindTexture(i6[n10], this._dotSamplers[n10]);
  813. }
  814. _createDotDensityMesh(e8, t11, r10) {
  815. if (t(this._dotVAO)) {
  816. const o7 = 2, s10 = new Int16Array(262144 * o7);
  817. for (let e9 = 0; e9 < 512; e9++)
  818. for (let t12 = 0; t12 < 512; t12++)
  819. s10[o7 * (t12 + 512 * e9)] = t12, s10[o7 * (t12 + 512 * e9) + 1] = e9;
  820. const i6 = E5.createVertex(e8, F.STATIC_DRAW, s10);
  821. this._dotVAO = new a2(e8, t11, r10, { geometry: i6 }, null);
  822. }
  823. return this._dotVAO;
  824. }
  825. _createDotDensityTextures(e8, t11, o7) {
  826. if (this._dotTextureSize === t11 && this._seed === o7 || (this._disposeTextures(), this._dotTextureSize = t11, this._seed = o7), null === this._dotTextures) {
  827. const s10 = new t2(o7);
  828. this._dotTextures = [this._allocDotDensityTexture(e8, t11, s10), this._allocDotDensityTexture(e8, t11, s10)];
  829. }
  830. return this._dotTextures;
  831. }
  832. _allocDotDensityTexture(e8, t11, o7) {
  833. const r10 = new Float32Array(t11 * t11 * 4);
  834. for (let s10 = 0; s10 < r10.length; s10++)
  835. r10[s10] = o7.getFloat();
  836. return new E4(e8, { wrapMode: D.REPEAT, pixelFormat: P.RGBA, dataType: G.FLOAT, samplingMode: L.NEAREST, width: t11, height: t11 }, r10);
  837. }
  838. };
  839. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js
  840. var d5 = { shader: "materials/icon", vertexLayout: { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_vertexOffset", count: 2, type: C.SHORT }, { location: 2, name: "a_texCoords", count: 2, type: C.UNSIGNED_SHORT }, { location: 3, name: "a_bitSetAndDistRatio", count: 2, type: C.UNSIGNED_SHORT }, { location: 4, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 5, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 6, name: "a_outlineColor", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 7, name: "a_sizeAndOutlineWidth", count: 4, type: C.UNSIGNED_BYTE }, { location: 8, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }] }, hittestAttributes: ["a_vertexOffset", "a_texCoords"] };
  841. var u4 = class extends p4 {
  842. dispose() {
  843. }
  844. getGeometryType() {
  845. return E3.MARKER;
  846. }
  847. supportsSymbology(t11) {
  848. return t11 !== S.HEATMAP && t11 !== S.PIE_CHART;
  849. }
  850. drawGeometry(o7, a4, i6, m11) {
  851. const { context: u6, painter: c8, rendererInfo: p6, state: y3, passOptions: _5, requestRender: f5, allowDelayedRender: E7 } = o7, S3 = N2.load(i6.materialKey), N4 = p(S3.data), T3 = r(_5) && "hittest" === _5.type, { shader: g3, vertexLayout: x7, hittestAttributes: R2 } = i(N4.programSpec, d5);
  852. let h5 = E.TRIANGLES, U3 = ge(S3.data, x7);
  853. T3 && (U3 = this._getTriangleDesc(i6.materialKey, U3, R2), h5 = E.POINTS);
  854. const { attributes: A4, bufferLayouts: O5 } = U3, G3 = c8.materialManager.getMaterialProgram(o7, S3, g3, A4, m11);
  855. if (E7 && r(f5) && !G3.isCompiled)
  856. return void f5();
  857. u6.useProgram(G3), S3.textureBinding && c8.textureManager.bindTextures(u6, G3, S3, true), this._setSharedUniforms(G3, o7, a4);
  858. const I3 = S3.vvRotation ? y3.displayViewMat3 : y3.displayMat3;
  859. G3.setUniformMatrix3fv("u_displayMat3", I3), this._setSizeVVUniforms(S3, G3, p6, a4), this._setColorAndOpacityVVUniforms(S3, G3, p6), this._setRotationVVUniforms(S3, G3, p6);
  860. const M6 = i6.target.getVAO(u6, O5, A4, T3);
  861. let b3 = i6.indexCount, D3 = i6.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  862. T3 && (b3 /= 3, D3 /= 3), u6.bindVAO(M6), this._drawMarkers(o7, a4, G3, h5, b3, D3, T3), u6.bindVAO(null);
  863. }
  864. _drawMarkers(t11, e8, o7, a4, r10, i6, n10) {
  865. t11.context.drawElements(a4, r10, C.UNSIGNED_INT, i6);
  866. }
  867. };
  868. // node_modules/@arcgis/core/views/2d/engine/webgl/effects/Effect.js
  869. var t10 = class {
  870. constructor() {
  871. this.name = this.constructor.name;
  872. }
  873. createOptions(t11, r10) {
  874. return null;
  875. }
  876. };
  877. // node_modules/@arcgis/core/views/webgl/heatmapTextureUtils.js
  878. function n7(n10, i6) {
  879. const { textureFloat: f5, colorBufferFloat: s10 } = n10.capabilities, u6 = f5 == null ? void 0 : f5.textureFloat, m11 = f5 == null ? void 0 : f5.textureFloatLinear, _5 = f5 == null ? void 0 : f5.textureHalfFloat, p6 = f5 == null ? void 0 : f5.textureHalfFloatLinear, d7 = f5 == null ? void 0 : f5.HALF_FLOAT, x7 = s10 == null ? void 0 : s10.textureFloat, b3 = s10 == null ? void 0 : s10.textureHalfFloat, c8 = s10 == null ? void 0 : s10.floatBlend, { floatBufferBlendWorking: h5 } = f(n10.driverTest);
  880. if (!u6 && !_5)
  881. throw new s2("heatmap:missing-texture-float", "HeatmapRenderer requires WebGL2 or the WebGL1 extension OES_texture_float or OES_texture_half_float.");
  882. if (!x7 && !b3)
  883. throw new s2("heatmap:missing-color-buffer-float", "HeatmapRenderer requires the WebGL extension EXT_color_buffer_float or EXT_color_buffer_half_float or WEBGL_color_buffer_float.");
  884. if (!(c8 && h5 || b3))
  885. throw new s2("heatmap:missing-float-blend", "HeatmapRenderer requires the WebGL extension EXT_float_blend or EXT_color_buffer_half_float." + (h5 ? "" : " This device claims support for EXT_float_blend, but does not actually support it."));
  886. const E7 = u6 && x7 && c8 && h5, F3 = _5 && b3, R2 = m11, L3 = p6, T3 = !!(s10 == null ? void 0 : s10.R32F), w4 = !!(s10 == null ? void 0 : s10.R16F);
  887. if (E7 && (R2 || !L3))
  888. return R2 || i6.warnOnce("Missing WebGL extension OES_texture_float_linear. Heatmap quality may be reduced."), { dataType: G.FLOAT, samplingMode: R2 ? L.LINEAR : L.NEAREST, pixelFormat: T3 ? P.RED : P.RGBA, internalFormat: T3 ? U.R32F : P.RGBA };
  889. if (F3)
  890. return L3 || i6.warnOnce("Missing WebGL extension OES_texture_half_float_linear. Heatmap quality may be reduced."), { dataType: d7, samplingMode: L3 ? L.LINEAR : L.NEAREST, pixelFormat: w4 ? P.RED : P.RGBA, internalFormat: w4 ? U.R16F : P.RGBA };
  891. throw new s2("heatmap:missing-hardware-support", "HeatmapRenderer requires WebGL extensions that allow it to render and blend to float or half float textures.");
  892. }
  893. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js
  894. var S2 = s.getLogger("esri.views.2d.engine.webgl.brushes.WGLBrushHeatmap");
  895. function x4(e8) {
  896. return "heatmap" === e8.type;
  897. }
  898. var B3 = class extends u4 {
  899. constructor() {
  900. super(...arguments), this.brushEffect = new y2();
  901. }
  902. supportsSymbology(e8) {
  903. return e8 === S.HEATMAP;
  904. }
  905. dispose() {
  906. super.dispose(), this.brushEffect.dispose(), this.brushEffect = null;
  907. }
  908. prepareState() {
  909. }
  910. drawGeometry(e8, t11, r10, i6) {
  911. const { defines: a4 } = this.brushEffect.loadQualityProfile(e8.context);
  912. super.drawGeometry(e8, t11, r10, i6 ? [...i6, ...a4] : a4);
  913. }
  914. _drawMarkers(e8, t11, r10, i6, a4, s10, u6) {
  915. const { context: n10, rendererInfo: h5, state: f5 } = e8, { rendererSchema: m11 } = h5;
  916. s5(m11, "heatmap");
  917. const { referenceScale: d7, radius: p6, isFieldActive: _5 } = m11, b3 = p6 * (0 !== d7 ? d7 / f5.scale : 1);
  918. r10.setUniform1f("u_radius", b3), u6 || (r10.setUniform1f("u_isFieldActive", _5), n10.setStencilFunction(I.GEQUAL, t11.stencilRef, 255)), n10.drawElements(i6, a4, C.UNSIGNED_INT, s10);
  919. }
  920. };
  921. var v = { vsPath: "heatmap/heatmapResolve", fsPath: "heatmap/heatmapResolve", attributes: /* @__PURE__ */ new Map([["a_position", 0]]) };
  922. var y2 = class extends t10 {
  923. constructor() {
  924. super(...arguments), this.name = this.constructor.name;
  925. }
  926. createOptions({ passOptions: e8 }) {
  927. return e8;
  928. }
  929. dispose() {
  930. this._prevFBO = null, this._accumulateOutputTexture = a(this._accumulateOutputTexture), r(this._accumulateFramebuffer) && this._accumulateFramebuffer.detachDepthStencilBuffer(), this._accumulateOutputStencilBuffer = a(this._accumulateOutputStencilBuffer), this._accumulateFramebuffer = a(this._accumulateFramebuffer), this._resolveGradientTexture = a(this._resolveGradientTexture), this._tileQuad = a(this._tileQuad);
  931. }
  932. bind(e8) {
  933. const { context: t11, rendererInfo: i6, passOptions: a4 } = e8, { rendererSchema: s10 } = i6;
  934. !(r(a4) && "hittest" === a4.type) && x4(s10) && (this._prevFBO = t11.getBoundFramebufferObject(), this._prevViewport = t11.getViewport(), s5(s10, "heatmap"), this._loadResources(e8), this._updateResources(t11, s10), t11.bindFramebuffer(this._accumulateFramebuffer), t11.setViewport(0, 0, this._accumulateFramebuffer.width, this._accumulateFramebuffer.height), t11.setStencilTestEnabled(true), t11.setBlendingEnabled(true), t11.setBlendFunction(R.ONE, R.ONE), t11.setClearColor(0, 0, 0, 0), t11.clear(_.COLOR_BUFFER_BIT));
  935. }
  936. unbind() {
  937. this._prevFBO = null, this._prevViewport = null;
  938. }
  939. draw(e8) {
  940. const { context: t11, painter: i6, rendererInfo: a4, passOptions: s10 } = e8, { rendererSchema: u6 } = a4;
  941. if (r(s10) && "hittest" === s10.type || !x4(u6))
  942. return;
  943. const { defines: n10 } = this.loadQualityProfile(t11), o7 = i6.materialManager.getProgram(v, n10);
  944. t11.useProgram(o7), t11.bindFramebuffer(this._prevFBO), t11.setViewport(0, 0, this._prevViewport.width, this._prevViewport.height), t11.setBlendFunction(R.ONE, R.ONE_MINUS_SRC_ALPHA), t11.setStencilTestEnabled(false);
  945. const { radius: h5, minDensity: c8, densityRange: l8 } = u6;
  946. t11.bindTexture(this._accumulateOutputTexture, 8), t11.bindTexture(this._resolveGradientTexture, 9), o7.setUniform1i("u_texture", 8), o7.setUniform1i("u_gradient", 9), o7.setUniform2f("u_densityMinAndInvRange", c8, 1 / l8), o7.setUniform1f("u_densityNormalization", 3 / (h5 * h5 * Math.PI)), this._tileQuad.draw();
  947. }
  948. _loadResources({ context: e8, painter: t11 }) {
  949. var _a, _b, _c, _d, _e;
  950. const { dataType: r10, samplingMode: i6, pixelFormat: a4, internalFormat: u6, shadingRate: n10, requiresSharedStencilBuffer: o7 } = this.loadQualityProfile(e8), { width: h5, height: c8 } = this._prevViewport, l8 = h5 * n10, f5 = c8 * n10;
  951. (_a = this._accumulateOutputTexture) != null ? _a : this._accumulateOutputTexture = new E4(e8, { target: M.TEXTURE_2D, pixelFormat: a4, internalFormat: u6, dataType: r10, samplingMode: i6, wrapMode: D.CLAMP_TO_EDGE, width: l8, height: f5 }), o7 || ((_b = this._accumulateOutputStencilBuffer) != null ? _b : this._accumulateOutputStencilBuffer = new s4(e8, { width: l8, height: f5, internalFormat: B.DEPTH_STENCIL })), (_c = this._accumulateFramebuffer) != null ? _c : this._accumulateFramebuffer = new x2(e8, {}, this._accumulateOutputTexture, o7 ? t11.getSharedStencilBuffer() : this._accumulateOutputStencilBuffer), (_d = this._resolveGradientTexture) != null ? _d : this._resolveGradientTexture = new E4(e8, { target: M.TEXTURE_2D, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.LINEAR, wrapMode: D.CLAMP_TO_EDGE }), (_e = this._tileQuad) != null ? _e : this._tileQuad = new n4(e8, [0, 0, 1, 0, 0, 1, 1, 1]);
  952. }
  953. _updateResources(e8, t11) {
  954. const { gradientHash: i6, gradient: a4 } = t11;
  955. this._prevGradientHash !== i6 && (this._resolveGradientTexture.resize(a4.length / 4, 1), this._resolveGradientTexture.setData(a4), this._prevGradientHash = i6);
  956. const { shadingRate: s10, requiresSharedStencilBuffer: u6 } = this.loadQualityProfile(e8), { width: n10, height: o7 } = this._prevViewport, h5 = n10 * s10, c8 = o7 * s10, { width: l8, height: f5 } = this._accumulateFramebuffer;
  957. if (l8 !== h5 || f5 !== c8) {
  958. const e9 = this._accumulateFramebuffer.depthStencilAttachment;
  959. if (u6 && r(e9)) {
  960. const { width: t12, height: r10 } = e9.descriptor;
  961. t12 === h5 && r10 === c8 || (S2.errorOnce("Attempted to resize shared stencil buffer! Detaching instead."), this._accumulateFramebuffer.detachDepthStencilBuffer());
  962. }
  963. this._accumulateFramebuffer.resize(h5, c8);
  964. }
  965. u6 || e8.blitFramebuffer(this._prevFBO, this._accumulateFramebuffer, 0, 0, this._prevFBO.width, this._prevFBO.height, 0, 0, this._accumulateFramebuffer.width, this._accumulateFramebuffer.height, _.STENCIL_BUFFER_BIT, L.NEAREST);
  966. }
  967. loadQualityProfile(e8) {
  968. if (t(this._qualityProfile)) {
  969. const t11 = n7(e8, S2), r10 = e8.type === r4.WEBGL1;
  970. this._qualityProfile = { ...t11, requiresSharedStencilBuffer: r10, shadingRate: r10 ? 1 : 0.25, defines: t11.dataType !== G.FLOAT ? ["heatmapPrecisionHalfFloat"] : [] };
  971. }
  972. return this._qualityProfile;
  973. }
  974. };
  975. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/TileInfoPrograms.js
  976. var r9 = { shaders: { vertexShader: n6("tileInfo/tileInfo.vert"), fragmentShader: n6("tileInfo/tileInfo.frag") }, attributes: /* @__PURE__ */ new Map([["a_pos", 0]]) };
  977. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushInfo.js
  978. var A3 = 300;
  979. var b2 = 32;
  980. var x5 = class extends t7 {
  981. constructor() {
  982. super(...arguments), this._color = r8(1, 0, 0, 1);
  983. }
  984. dispose() {
  985. this._outlineProgram && (this._outlineProgram.dispose(), this._outlineProgram = null), this._tileInfoProgram && (this._tileInfoProgram.dispose(), this._tileInfoProgram = null), this._outlineVertexArrayObject && (this._outlineVertexArrayObject.dispose(), this._outlineVertexArrayObject = null), this._tileInfoVertexArrayObject && (this._tileInfoVertexArrayObject.dispose(), this._tileInfoVertexArrayObject = null), this._canvas = null;
  986. }
  987. prepareState({ context: t11 }) {
  988. t11.setBlendingEnabled(true), t11.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), t11.setColorMask(true, true, true, true), t11.setStencilWriteMask(0), t11.setStencilTestEnabled(false);
  989. }
  990. draw(e8, r10) {
  991. const { context: i6, requestRender: o7, allowDelayedRender: s10 } = e8;
  992. if (!r10.isReady)
  993. return;
  994. if (this._loadWGLResources(i6), s10 && r(o7) && (!this._outlineProgram.isCompiled || !this._tileInfoProgram.isCompiled))
  995. return void o7();
  996. i6.bindVAO(this._outlineVertexArrayObject), i6.useProgram(this._outlineProgram), this._outlineProgram.setUniformMatrix3fv("u_dvsMat3", r10.transforms.dvs), this._outlineProgram.setUniform2f("u_coord_range", r10.rangeX, r10.rangeY), this._outlineProgram.setUniform1f("u_depth", 0), this._outlineProgram.setUniform4fv("u_color", this._color), i6.drawArrays(E.LINE_STRIP, 0, 4);
  997. const n10 = this._getTexture(i6, r10);
  998. n10 ? (i6.bindVAO(this._tileInfoVertexArrayObject), i6.useProgram(this._tileInfoProgram), i6.bindTexture(n10, 0), this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3", r10.transforms.dvs), this._tileInfoProgram.setUniform1f("u_depth", 0), this._tileInfoProgram.setUniform2f("u_coord_ratio", r10.rangeX / r10.width, r10.rangeY / r10.height), this._tileInfoProgram.setUniform2f("u_delta", 8, 8), this._tileInfoProgram.setUniform2f("u_dimensions", n10.descriptor.width, n10.descriptor.height), i6.drawArrays(E.TRIANGLE_STRIP, 0, 4), i6.bindVAO()) : i6.bindVAO();
  999. }
  1000. _loadWGLResources(t11) {
  1001. if (this._outlineProgram && this._tileInfoProgram)
  1002. return;
  1003. const e8 = e4(t11, e7), i6 = e4(t11, r9), a4 = new Int8Array([0, 0, 1, 0, 1, 1, 0, 1]), l8 = E5.createVertex(t11, F.STATIC_DRAW, a4), m11 = new a2(t11, e7.attributes, r7, { geometry: l8 }), _5 = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), f5 = E5.createVertex(t11, F.STATIC_DRAW, _5), h5 = new a2(t11, r9.attributes, r7, { geometry: f5 });
  1004. this._outlineProgram = e8, this._tileInfoProgram = i6, this._outlineVertexArrayObject = m11, this._tileInfoVertexArrayObject = h5;
  1005. }
  1006. _getTexture(t11, e8) {
  1007. if (e8.texture && e8.triangleCountReportedInDebug === e8.triangleCount)
  1008. return e8.texture;
  1009. e8.triangleCountReportedInDebug = e8.triangleCount, this._canvas || (this._canvas = document.createElement("canvas"), this._canvas.setAttribute("id", "canvas2d"), this._canvas.setAttribute("width", `${A3}`), this._canvas.setAttribute("height", `${b2}`), this._canvas.setAttribute("style", "display:none"));
  1010. const r10 = e8.triangleCount;
  1011. let i6 = e8.key.id;
  1012. e8.triangleCount > 0 && (i6 += `, ${r10}`);
  1013. const o7 = this._canvas, s10 = o7.getContext("2d");
  1014. return s10.font = "24px sans-serif", s10.textAlign = "left", s10.textBaseline = "top", s10.clearRect(0, 0, A3, b2), r10 > 1e5 ? (s10.fillStyle = "red", s10.fillRect(0, 0, A3, b2), s10.fillStyle = "black") : (s10.clearRect(0, 0, A3, b2), s10.fillStyle = "blue"), s10.fillText(i6, 0, 0), e8.texture = new E4(t11, { target: M.TEXTURE_2D, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, wrapMode: D.CLAMP_TO_EDGE }, o7), e8.texture;
  1015. }
  1016. };
  1017. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushPieChart.js
  1018. var s7 = class extends u4 {
  1019. supportsSymbology(r10) {
  1020. return r10 === S.PIE_CHART;
  1021. }
  1022. _drawMarkers(o7, r10, s10, n10, l8, f5, u6) {
  1023. const { context: i6 } = o7, { rendererInfo: m11 } = o7, { rendererSchema: a4 } = m11;
  1024. s5(a4, "pie-chart"), s10.setUniform4fv("u_colors", a4.colors), s10.setUniform4fv("u_defaultColor", a4.defaultColor), s10.setUniform4fv("u_othersColor", a4.othersColor), s10.setUniform4fv("u_outlineColor", a4.outlineColor), s10.setUniform1f("u_donutRatio", a4.holePercentage), s10.setUniform1f("u_sectorThreshold", a4.sectorThreshold), s10.setUniform1f("u_outlineWidth", a4.outlineWidth), i6.drawElements(n10, l8, C.UNSIGNED_INT, f5);
  1025. }
  1026. };
  1027. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushStencil.js
  1028. var h3 = class extends t7 {
  1029. constructor() {
  1030. super(...arguments), this._color = r8(1, 0, 0, 1), this._initialized = false;
  1031. }
  1032. dispose() {
  1033. this._solidProgram && (this._solidProgram.dispose(), this._solidProgram = null), this._solidVertexArrayObject && (this._solidVertexArrayObject.dispose(), this._solidVertexArrayObject = null);
  1034. }
  1035. prepareState({ context: r10 }) {
  1036. r10.setDepthWriteEnabled(false), r10.setDepthTestEnabled(false), r10.setStencilTestEnabled(true), r10.setBlendingEnabled(false), r10.setColorMask(false, false, false, false), r10.setStencilOp(O.KEEP, O.KEEP, O.REPLACE), r10.setStencilWriteMask(255);
  1037. }
  1038. draw(e8, t11) {
  1039. const { context: i6, requestRender: s10, allowDelayedRender: o7 } = e8;
  1040. this._initialized || this._initialize(i6), o7 && r(s10) && !this._solidProgram.isCompiled ? s10() : (i6.setStencilFunctionSeparate(N.FRONT_AND_BACK, I.GREATER, t11.stencilRef, 255), i6.bindVAO(this._solidVertexArrayObject), i6.useProgram(this._solidProgram), this._solidProgram.setUniformMatrix3fv("u_dvsMat3", t11.transforms.dvs), this._solidProgram.setUniform2fv("u_coord_range", [t11.rangeX, t11.rangeY]), this._solidProgram.setUniform1f("u_depth", 0), this._solidProgram.setUniform4fv("u_color", this._color), i6.drawArrays(E.TRIANGLE_STRIP, 0, 4), i6.bindVAO());
  1041. }
  1042. _initialize(r10) {
  1043. if (this._initialized)
  1044. return true;
  1045. const e8 = e4(r10, e7);
  1046. if (!e8)
  1047. return false;
  1048. const i6 = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), a4 = E5.createVertex(r10, F.STATIC_DRAW, i6), l8 = new a2(r10, e7.attributes, r7, { geometry: a4 });
  1049. return this._solidProgram = e8, this._solidVertexArrayObject = l8, this._initialized = true, true;
  1050. }
  1051. };
  1052. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js
  1053. var d6 = class extends t7 {
  1054. constructor() {
  1055. super(...arguments), this._color = r8(1, 0, 0, 1), this._patternMatrix = e2(), this._programOptions = { id: false, pattern: false };
  1056. }
  1057. dispose() {
  1058. this._vao && (this._vao.dispose(), this._vao = null);
  1059. }
  1060. drawMany(e8, o7) {
  1061. const { context: c8, painter: m11, styleLayerUID: p6, requestRender: _5, allowDelayedRender: d7 } = e8;
  1062. this._loadWGLResources(e8);
  1063. const h5 = e8.displayLevel, g3 = e8.styleLayer, v2 = g3.backgroundMaterial, y3 = m11.vectorTilesMaterialManager, b3 = g3.getPaintValue("background-color", h5), M6 = g3.getPaintValue("background-opacity", h5), x7 = g3.getPaintValue("background-pattern", h5), j = void 0 !== x7, U3 = b3[3] * M6, w4 = 1 | window.devicePixelRatio, L3 = e8.spriteMosaic;
  1064. let A4, P3;
  1065. const I3 = w4 > _2 ? 2 : 1, R2 = e8.drawPhase === I2.HITTEST, k = this._programOptions;
  1066. k.id = R2, k.pattern = j;
  1067. const T3 = y3.getMaterialProgram(c8, v2, k);
  1068. if (d7 && r(_5) && !T3.isCompiled)
  1069. _5();
  1070. else {
  1071. if (c8.bindVAO(this._vao), c8.useProgram(T3), j) {
  1072. const t11 = L3.getMosaicItemPosition(x7, true);
  1073. if (r(t11)) {
  1074. const { tl: e9, br: o8, page: s10 } = t11;
  1075. A4 = o8[0] - e9[0], P3 = o8[1] - e9[1];
  1076. const a4 = L3.getPageSize(s10);
  1077. r(a4) && (L3.bind(c8, L.LINEAR, s10, Z), T3.setUniform4f("u_tlbr", e9[0], e9[1], o8[0], o8[1]), T3.setUniform2fv("u_mosaicSize", a4), T3.setUniform1i("u_texture", Z));
  1078. }
  1079. T3.setUniform1f("u_opacity", M6);
  1080. } else
  1081. this._color[0] = U3 * b3[0], this._color[1] = U3 * b3[1], this._color[2] = U3 * b3[2], this._color[3] = U3, T3.setUniform4fv("u_color", this._color);
  1082. if (T3.setUniform1f("u_depth", g3.z || 0), R2) {
  1083. const t11 = M3(p6 + 1);
  1084. T3.setUniform4fv("u_id", t11);
  1085. }
  1086. for (const r10 of o7) {
  1087. if (T3.setUniform1f("u_coord_range", r10.rangeX), T3.setUniformMatrix3fv("u_dvsMat3", r10.transforms.dvs), j) {
  1088. const e9 = Math.max(2 ** (Math.round(h5) - r10.key.level), 1), o8 = I3 * r10.width * e9, i6 = o8 / f2(A4), s10 = o8 / f2(P3);
  1089. this._patternMatrix[0] = i6, this._patternMatrix[4] = s10, T3.setUniformMatrix3fv("u_pattern_matrix", this._patternMatrix);
  1090. }
  1091. c8.setStencilFunction(I.EQUAL, 0, 255), c8.drawArrays(E.TRIANGLE_STRIP, 0, 4);
  1092. }
  1093. }
  1094. }
  1095. _loadWGLResources(t11) {
  1096. if (this._vao)
  1097. return;
  1098. const { context: r10, styleLayer: e8 } = t11, o7 = e8.backgroundMaterial, i6 = new Int8Array([0, 0, 1, 0, 0, 1, 1, 1]), s10 = E5.createVertex(r10, F.STATIC_DRAW, i6), a4 = new a2(r10, o7.getAttributeLocations(), o7.getLayoutInfo(), { geometry: s10 });
  1099. this._vao = a4;
  1100. }
  1101. };
  1102. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLCircle.js
  1103. var c6 = class extends t7 {
  1104. constructor() {
  1105. super(...arguments), this._programOptions = { id: false };
  1106. }
  1107. dispose() {
  1108. }
  1109. drawMany(n10, c8) {
  1110. const { context: m11, displayLevel: d7, requiredLevel: f5, state: u6, drawPhase: p6, painter: y3, spriteMosaic: g3, styleLayerUID: v2, requestRender: E7, allowDelayedRender: M6 } = n10;
  1111. if (!c8.some((e8) => {
  1112. var _a, _b;
  1113. return (_b = (_a = e8.layerData.get(v2)) == null ? void 0 : _a.circleIndexCount) != null ? _b : false;
  1114. }))
  1115. return;
  1116. const T3 = n10.styleLayer, x7 = T3.circleMaterial, I3 = y3.vectorTilesMaterialManager, U3 = 1.2, _5 = T3.getPaintValue("circle-translate", d7), R2 = T3.getPaintValue("circle-translate-anchor", d7), h5 = p6 === I2.HITTEST, D3 = this._programOptions;
  1117. D3.id = h5;
  1118. const L3 = I3.getMaterialProgram(m11, x7, D3);
  1119. if (M6 && r(E7) && !L3.isCompiled)
  1120. return void E7();
  1121. m11.useProgram(L3), L3.setUniformMatrix3fv("u_displayMat3", R2 === r5.VIEWPORT ? u6.displayMat3 : u6.displayViewMat3), L3.setUniform2fv("u_circleTranslation", _5), L3.setUniform1f("u_depth", T3.z), L3.setUniform1f("u_antialiasingWidth", U3);
  1122. let S3 = -1;
  1123. if (h5) {
  1124. const e8 = M3(v2 + 1);
  1125. L3.setUniform4fv("u_id", e8);
  1126. }
  1127. for (const e8 of c8) {
  1128. if (!e8.layerData.has(v2))
  1129. continue;
  1130. e8.key.level !== S3 && (S3 = e8.key.level, x7.setDataUniforms(L3, d7, T3, S3, g3));
  1131. const r10 = e8.layerData.get(v2);
  1132. if (!r10.circleIndexCount)
  1133. continue;
  1134. r10.prepareForRendering(m11);
  1135. const i6 = r10.circleVertexArrayObject;
  1136. t(i6) || (m11.bindVAO(i6), L3.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), f5 !== e8.key.level ? m11.setStencilFunction(I.EQUAL, e8.stencilRef, 255) : m11.setStencilFunction(I.GREATER, 255, 255), m11.drawElements(E.TRIANGLES, r10.circleIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * r10.circleIndexStart), e8.triangleCount += r10.circleIndexCount / 3);
  1137. }
  1138. }
  1139. };
  1140. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLFill.js
  1141. var c7 = 1 / 65536;
  1142. var m6 = class extends t7 {
  1143. constructor() {
  1144. super(...arguments), this._fillProgramOptions = { id: false, pattern: false }, this._outlineProgramOptions = { id: false };
  1145. }
  1146. dispose() {
  1147. }
  1148. drawMany(t11, e8) {
  1149. const { displayLevel: i6, drawPhase: r10, renderPass: a4, spriteMosaic: l8, styleLayerUID: s10 } = t11;
  1150. let f5 = false;
  1151. for (const n10 of e8)
  1152. if (n10.layerData.has(s10)) {
  1153. const t12 = n10.layerData.get(s10);
  1154. if (t12.fillIndexCount > 0 || t12.outlineIndexCount > 0) {
  1155. f5 = true;
  1156. break;
  1157. }
  1158. }
  1159. if (!f5)
  1160. return;
  1161. const u6 = t11.styleLayer, d7 = u6.getPaintProperty("fill-pattern"), c8 = void 0 !== d7, m11 = c8 && d7.isDataDriven;
  1162. let p6;
  1163. if (c8 && !m11) {
  1164. const t12 = d7.getValue(i6);
  1165. p6 = l8.getMosaicItemPosition(t12, true);
  1166. }
  1167. const y3 = !c8 && u6.getPaintValue("fill-antialias", i6);
  1168. let g3 = true, _5 = 1;
  1169. if (!c8) {
  1170. const t12 = u6.getPaintProperty("fill-color"), e9 = u6.getPaintProperty("fill-opacity");
  1171. if (!(t12 == null ? void 0 : t12.isDataDriven) && !(e9 == null ? void 0 : e9.isDataDriven)) {
  1172. const t13 = u6.getPaintValue("fill-color", i6);
  1173. _5 = u6.getPaintValue("fill-opacity", i6) * t13[3], _5 >= 1 && (g3 = false);
  1174. }
  1175. }
  1176. if (g3 && "opaque" === a4)
  1177. return;
  1178. let E7;
  1179. r10 === I2.HITTEST && (E7 = M3(s10 + 1));
  1180. const v2 = u6.getPaintValue("fill-translate", i6), M6 = u6.getPaintValue("fill-translate-anchor", i6);
  1181. (g3 || "translucent" !== a4) && this._drawFill(t11, s10, u6, e8, v2, M6, c8, p6, m11, E7);
  1182. const P3 = !u6.hasDataDrivenOutlineColor && u6.outlineUsesFillColor && _5 < 1;
  1183. y3 && "opaque" !== a4 && !P3 && this._drawOutline(t11, s10, u6, e8, v2, M6, E7);
  1184. }
  1185. _drawFill(o7, l8, m11, p6, y3, g3, _5, E7, v2, M6) {
  1186. if (_5 && !v2 && t(E7))
  1187. return;
  1188. const { context: P3, displayLevel: I3, state: T3, drawPhase: U3, painter: x7, pixelRatio: D3, spriteMosaic: h5, requestRender: S3, allowDelayedRender: R2 } = o7, w4 = m11.fillMaterial, N4 = x7.vectorTilesMaterialManager, L3 = D3 > _2 ? 2 : 1, A4 = U3 === I2.HITTEST, C4 = this._fillProgramOptions;
  1189. C4.id = A4, C4.pattern = _5;
  1190. const V2 = N4.getMaterialProgram(P3, w4, C4);
  1191. if (R2 && r(S3) && !V2.isCompiled)
  1192. return void S3();
  1193. if (P3.useProgram(V2), r(E7)) {
  1194. const { page: t11 } = E7, i6 = h5.getPageSize(t11);
  1195. r(i6) && (h5.bind(P3, L.LINEAR, t11, Z), V2.setUniform2fv("u_mosaicSize", i6), V2.setUniform1i("u_texture", Z));
  1196. }
  1197. V2.setUniformMatrix3fv("u_displayMat3", g3 === r5.VIEWPORT ? T3.displayMat3 : T3.displayViewMat3), V2.setUniform2fv("u_fillTranslation", y3), V2.setUniform1f("u_depth", m11.z + c7), A4 && V2.setUniform4fv("u_id", M6);
  1198. let O5 = -1;
  1199. for (const i6 of p6) {
  1200. if (!i6.layerData.has(l8))
  1201. continue;
  1202. i6.key.level !== O5 && (O5 = i6.key.level, w4.setDataUniforms(V2, I3, m11, O5, h5));
  1203. const a4 = i6.layerData.get(l8);
  1204. if (!a4.fillIndexCount)
  1205. continue;
  1206. a4.prepareForRendering(P3);
  1207. const n10 = a4.fillVertexArrayObject;
  1208. if (!t(n10)) {
  1209. if (P3.bindVAO(n10), V2.setUniformMatrix3fv("u_dvsMat3", i6.transforms.dvs), P3.setStencilFunction(I.EQUAL, i6.stencilRef, 255), _5) {
  1210. const t11 = Math.max(2 ** (Math.round(I3) - i6.key.level), 1), e8 = i6.rangeX / (L3 * i6.width * t11);
  1211. V2.setUniform1f("u_patternFactor", e8);
  1212. }
  1213. if (v2) {
  1214. const t11 = a4.patternMap;
  1215. if (!t11)
  1216. continue;
  1217. for (const [i7, a5] of t11) {
  1218. const t12 = h5.getPageSize(i7);
  1219. r(t12) && (h5.bind(P3, L.LINEAR, i7, Z), V2.setUniform2fv("u_mosaicSize", t12), V2.setUniform1i("u_texture", Z), P3.drawElements(E.TRIANGLES, a5[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * a5[0]));
  1220. }
  1221. } else
  1222. P3.drawElements(E.TRIANGLES, a4.fillIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * a4.fillIndexStart);
  1223. i6.triangleCount += a4.fillIndexCount / 3;
  1224. }
  1225. }
  1226. }
  1227. _drawOutline(r10, a4, o7, l8, s10, m11, p6) {
  1228. const { context: y3, displayLevel: g3, state: _5, drawPhase: E7, painter: v2, pixelRatio: M6, spriteMosaic: P3, requestRender: I3, allowDelayedRender: T3 } = r10, U3 = o7.outlineMaterial, x7 = v2.vectorTilesMaterialManager, D3 = 0.75 / M6, h5 = E7 === I2.HITTEST, S3 = this._outlineProgramOptions;
  1229. S3.id = h5;
  1230. const R2 = x7.getMaterialProgram(y3, U3, S3);
  1231. if (T3 && r(I3) && !R2.isCompiled)
  1232. return void I3();
  1233. y3.useProgram(R2), R2.setUniformMatrix3fv("u_displayMat3", m11 === r5.VIEWPORT ? _5.displayMat3 : _5.displayViewMat3), R2.setUniform2fv("u_fillTranslation", s10), R2.setUniform1f("u_depth", o7.z + c7), R2.setUniform1f("u_outline_width", D3), h5 && R2.setUniform4fv("u_id", p6);
  1234. let w4 = -1;
  1235. for (const e8 of l8) {
  1236. if (!e8.layerData.has(a4))
  1237. continue;
  1238. e8.key.level !== w4 && (w4 = e8.key.level, U3.setDataUniforms(R2, g3, o7, w4, P3));
  1239. const i6 = e8.layerData.get(a4);
  1240. if (i6.prepareForRendering(y3), !i6.outlineIndexCount)
  1241. continue;
  1242. const r11 = i6.outlineVertexArrayObject;
  1243. t(r11) || (y3.bindVAO(r11), R2.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), y3.setStencilFunction(I.EQUAL, e8.stencilRef, 255), y3.drawElements(E.TRIANGLES, i6.outlineIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * i6.outlineIndexStart), e8.triangleCount += i6.outlineIndexCount / 3);
  1244. }
  1245. }
  1246. };
  1247. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLLine.js
  1248. var u5 = class extends t7 {
  1249. constructor() {
  1250. super(...arguments), this._programOptions = { id: false, pattern: false, sdf: false };
  1251. }
  1252. dispose() {
  1253. }
  1254. drawMany(o7, u6) {
  1255. const { context: c8, displayLevel: d7, state: p6, drawPhase: y3, painter: g3, pixelRatio: E7, spriteMosaic: M6, styleLayerUID: _5, requestRender: v2, allowDelayedRender: U3 } = o7;
  1256. if (!u6.some((e8) => {
  1257. var _a, _b;
  1258. return (_b = (_a = e8.layerData.get(_5)) == null ? void 0 : _a.lineIndexCount) != null ? _b : false;
  1259. }))
  1260. return;
  1261. const I3 = o7.styleLayer, P3 = I3.lineMaterial, x7 = g3.vectorTilesMaterialManager, T3 = I3.getPaintValue("line-translate", d7), D3 = I3.getPaintValue("line-translate-anchor", d7), S3 = I3.getPaintProperty("line-pattern"), L3 = void 0 !== S3, N4 = L3 && S3.isDataDriven;
  1262. let R2, V2;
  1263. if (L3 && !N4) {
  1264. const e8 = S3.getValue(d7);
  1265. R2 = M6.getMosaicItemPosition(e8);
  1266. }
  1267. let h5 = false;
  1268. if (!L3) {
  1269. const e8 = I3.getPaintProperty("line-dasharray");
  1270. if (V2 = void 0 !== e8, h5 = V2 && e8.isDataDriven, V2 && !h5) {
  1271. const t11 = e8.getValue(d7), i6 = I3.getDashKey(t11, I3.getLayoutValue("line-cap", d7));
  1272. R2 = M6.getMosaicItemPosition(i6);
  1273. }
  1274. }
  1275. const w4 = 1 / E7, A4 = y3 === I2.HITTEST, j = this._programOptions;
  1276. j.id = A4, j.pattern = L3, j.sdf = V2;
  1277. const b3 = x7.getMaterialProgram(c8, P3, j);
  1278. if (U3 && r(v2) && !b3.isCompiled)
  1279. return void v2();
  1280. if (c8.useProgram(b3), b3.setUniformMatrix3fv("u_displayViewMat3", p6.displayViewMat3), b3.setUniformMatrix3fv("u_displayMat3", D3 === r5.VIEWPORT ? p6.displayMat3 : p6.displayViewMat3), b3.setUniform2fv("u_lineTranslation", T3), b3.setUniform1f("u_depth", I3.z), b3.setUniform1f("u_antialiasing", w4), A4) {
  1281. const e8 = M3(_5 + 1);
  1282. b3.setUniform4fv("u_id", e8);
  1283. }
  1284. if (R2 && r(R2)) {
  1285. const { page: t11 } = R2, i6 = M6.getPageSize(t11);
  1286. r(i6) && (M6.bind(c8, L.LINEAR, t11, Z), b3.setUniform2fv("u_mosaicSize", i6), b3.setUniform1i("u_texture", Z));
  1287. }
  1288. let z = -1;
  1289. for (const i6 of u6) {
  1290. if (!i6.layerData.has(_5))
  1291. continue;
  1292. i6.key.level !== z && (z = i6.key.level, P3.setDataUniforms(b3, d7, I3, z, M6));
  1293. const r10 = 2 ** (d7 - z) / E7;
  1294. b3.setUniform1f("u_zoomFactor", r10);
  1295. const a4 = i6.layerData.get(_5);
  1296. if (!a4.lineIndexCount)
  1297. continue;
  1298. a4.prepareForRendering(c8);
  1299. const o8 = a4.lineVertexArrayObject;
  1300. if (!t(o8)) {
  1301. if (c8.bindVAO(o8), b3.setUniformMatrix3fv("u_dvsMat3", i6.transforms.dvs), c8.setStencilFunction(I.EQUAL, i6.stencilRef, 255), N4 || h5) {
  1302. const t11 = a4.patternMap;
  1303. if (!t11)
  1304. continue;
  1305. for (const [i7, r11] of t11) {
  1306. const t12 = M6.getPageSize(i7);
  1307. r(t12) && (M6.bind(c8, L.LINEAR, i7, Z), b3.setUniform2fv("u_mosaicSize", t12), b3.setUniform1i("u_texture", Z), c8.drawElements(E.TRIANGLES, r11[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * r11[0]));
  1308. }
  1309. } else
  1310. c8.drawElements(E.TRIANGLES, a4.lineIndexCount, C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * a4.lineIndexStart);
  1311. i6.triangleCount += a4.lineIndexCount / 3;
  1312. }
  1313. }
  1314. }
  1315. };
  1316. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js
  1317. var h4 = 1 / 65536;
  1318. var M5 = class extends t7 {
  1319. constructor() {
  1320. super(...arguments), this._iconProgramOptions = { id: false, sdf: false }, this._sdfProgramOptions = { id: false }, this._spritesTextureSize = n();
  1321. }
  1322. dispose() {
  1323. }
  1324. drawMany(e8, t11) {
  1325. const { drawPhase: i6, styleLayerUID: a4 } = e8, r10 = e8.styleLayer;
  1326. let s10;
  1327. i6 === I2.HITTEST && (s10 = M3(a4 + 1)), this._drawIcons(e8, r10, t11, s10), this._drawText(e8, r10, t11, s10);
  1328. }
  1329. _drawIcons(i6, a4, f5, p6) {
  1330. const { context: c8, displayLevel: d7, drawPhase: y3, painter: g3, spriteMosaic: _5, state: h5, styleLayerUID: M6, requestRender: P3, allowDelayedRender: T3 } = i6, U3 = a4.iconMaterial, E7 = g3.vectorTilesMaterialManager;
  1331. let x7, v2 = false;
  1332. for (const e8 of f5)
  1333. if (e8.layerData.has(M6) && (x7 = e8.layerData.get(M6), x7.iconPerPageElementsMap.size > 0)) {
  1334. v2 = true;
  1335. break;
  1336. }
  1337. if (!v2)
  1338. return;
  1339. const D3 = a4.getPaintValue("icon-translate", d7), I3 = a4.getPaintValue("icon-translate-anchor", d7);
  1340. let R2 = a4.getLayoutValue("icon-rotation-alignment", d7);
  1341. R2 === l2.AUTO && (R2 = a4.getLayoutValue("symbol-placement", d7) === n3.POINT ? l2.VIEWPORT : l2.MAP);
  1342. const S3 = R2 === l2.MAP, V2 = a4.getLayoutValue("icon-keep-upright", d7) && S3, w4 = x7.isIconSDF, A4 = y3 === I2.HITTEST, L3 = this._iconProgramOptions;
  1343. L3.id = A4, L3.sdf = w4;
  1344. const O5 = E7.getMaterialProgram(c8, U3, L3);
  1345. if (T3 && r(P3) && !O5.isCompiled)
  1346. return void P3();
  1347. c8.useProgram(O5), O5.setUniformMatrix3fv("u_displayViewMat3", R2 === l2.MAP ? h5.displayViewMat3 : h5.displayMat3), O5.setUniformMatrix3fv("u_displayMat3", I3 === r5.VIEWPORT ? h5.displayMat3 : h5.displayViewMat3), O5.setUniform2fv("u_iconTranslation", D3), O5.setUniform1f("u_depth", a4.z), O5.setUniform1f("u_mapRotation", M4(h5.rotation)), O5.setUniform1f("u_keepUpright", V2 ? 1 : 0), O5.setUniform1f("u_level", 10 * d7), O5.setUniform1i("u_texture", Z), O5.setUniform1f("u_fadeDuration", e / 1e3), A4 && O5.setUniform4fv("u_id", p6);
  1348. let N4 = -1;
  1349. for (const e8 of f5) {
  1350. if (!e8.layerData.has(M6))
  1351. continue;
  1352. if (e8.key.level !== N4 && (N4 = e8.key.level, U3.setDataUniforms(O5, d7, a4, N4, _5)), x7 = e8.layerData.get(M6), 0 === x7.iconPerPageElementsMap.size)
  1353. continue;
  1354. x7.prepareForRendering(c8), x7.updateOpacityInfo();
  1355. const r10 = x7.iconVertexArrayObject;
  1356. if (!t(r10)) {
  1357. c8.bindVAO(r10), O5.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), O5.setUniform1f("u_time", (performance.now() - x7.lastOpacityUpdate) / 1e3);
  1358. for (const [t11, a5] of x7.iconPerPageElementsMap)
  1359. this._renderIconRange(i6, O5, a5, t11, e8);
  1360. }
  1361. }
  1362. }
  1363. _renderIconRange(e8, t11, i6, a4, r10) {
  1364. const { context: s10, spriteMosaic: n10 } = e8;
  1365. this._spritesTextureSize[0] = n10.getWidth(a4) / 4, this._spritesTextureSize[1] = n10.getHeight(a4) / 4, t11.setUniform2fv("u_mosaicSize", this._spritesTextureSize), n10.bind(s10, L.LINEAR, a4, Z), s10.setStencilTestEnabled(true), s10.setStencilFunction(I.GREATER, 255, 255), s10.setStencilWriteMask(0), s10.drawElements(E.TRIANGLES, i6[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * i6[0]), r10.triangleCount += i6[1] / 3;
  1366. }
  1367. _drawText(i6, l8, p6, c8) {
  1368. const { context: d7, displayLevel: g3, drawPhase: _5, glyphMosaic: M6, painter: P3, pixelRatio: T3, spriteMosaic: U3, state: E7, styleLayerUID: x7, requestRender: v2, allowDelayedRender: D3 } = i6, I3 = l8.textMaterial, R2 = P3.vectorTilesMaterialManager;
  1369. let S3, V2 = false;
  1370. for (const e8 of p6)
  1371. if (e8.layerData.has(x7) && (S3 = e8.layerData.get(x7), S3.glyphPerPageElementsMap.size > 0)) {
  1372. V2 = true;
  1373. break;
  1374. }
  1375. if (!V2)
  1376. return;
  1377. const w4 = l8.getPaintProperty("text-opacity");
  1378. if (w4 && !w4.isDataDriven && 0 === w4.getValue(g3))
  1379. return;
  1380. const A4 = l8.getPaintProperty("text-color"), L3 = !A4 || A4.isDataDriven || A4.getValue(g3)[3] > 0, O5 = l8.getPaintProperty("text-halo-width"), N4 = l8.getPaintProperty("text-halo-color"), b3 = (!O5 || O5.isDataDriven || O5.getValue(g3) > 0) && (!N4 || N4.isDataDriven || N4.getValue(g3)[3] > 0);
  1381. if (!L3 && !b3)
  1382. return;
  1383. const z = 24 / 8;
  1384. let k = l8.getLayoutValue("text-rotation-alignment", g3);
  1385. k === l2.AUTO && (k = l8.getLayoutValue("symbol-placement", g3) === n3.POINT ? l2.VIEWPORT : l2.MAP);
  1386. const j = k === l2.MAP, G3 = l8.getLayoutValue("text-keep-upright", g3) && j, W = _5 === I2.HITTEST, C4 = 0.8 * z / T3;
  1387. this._glyphTextureSize || (this._glyphTextureSize = t5(M6.width / 4, M6.height / 4));
  1388. const F3 = l8.getPaintValue("text-translate", g3), B4 = l8.getPaintValue("text-translate-anchor", g3), H = this._sdfProgramOptions;
  1389. H.id = W;
  1390. const Y2 = R2.getMaterialProgram(d7, I3, H);
  1391. if (D3 && r(v2) && !Y2.isCompiled)
  1392. return void v2();
  1393. d7.useProgram(Y2), Y2.setUniformMatrix3fv("u_displayViewMat3", k === l2.MAP ? E7.displayViewMat3 : E7.displayMat3), Y2.setUniformMatrix3fv("u_displayMat3", B4 === r5.VIEWPORT ? E7.displayMat3 : E7.displayViewMat3), Y2.setUniform2fv("u_textTranslation", F3), Y2.setUniform1f("u_depth", l8.z + h4), Y2.setUniform2fv("u_mosaicSize", this._glyphTextureSize), Y2.setUniform1f("u_mapRotation", M4(E7.rotation)), Y2.setUniform1f("u_keepUpright", G3 ? 1 : 0), Y2.setUniform1f("u_level", 10 * g3), Y2.setUniform1i("u_texture", $), Y2.setUniform1f("u_antialiasingWidth", C4), Y2.setUniform1f("u_fadeDuration", e / 1e3), W && Y2.setUniform4fv("u_id", c8);
  1394. let q = -1;
  1395. for (const e8 of p6) {
  1396. if (!e8.layerData.has(x7))
  1397. continue;
  1398. if (e8.key.level !== q && (q = e8.key.level, I3.setDataUniforms(Y2, g3, l8, q, U3)), S3 = e8.layerData.get(x7), 0 === S3.glyphPerPageElementsMap.size)
  1399. continue;
  1400. S3.prepareForRendering(d7), S3.updateOpacityInfo();
  1401. const i7 = S3.textVertexArrayObject;
  1402. if (t(i7))
  1403. continue;
  1404. d7.bindVAO(i7), Y2.setUniformMatrix3fv("u_dvsMat3", e8.transforms.dvs), d7.setStencilTestEnabled(true), d7.setStencilFunction(I.GREATER, 255, 255), d7.setStencilWriteMask(0);
  1405. const a4 = (performance.now() - S3.lastOpacityUpdate) / 1e3;
  1406. Y2.setUniform1f("u_time", a4), S3.glyphPerPageElementsMap.forEach((t11, i8) => {
  1407. this._renderGlyphRange(d7, t11, i8, M6, Y2, b3, L3, e8);
  1408. });
  1409. }
  1410. }
  1411. _renderGlyphRange(e8, t11, i6, a4, r10, s10, n10, o7) {
  1412. a4.bind(e8, L.LINEAR, i6, $), s10 && (r10.setUniform1f("u_halo", 1), e8.drawElements(E.TRIANGLES, t11[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * t11[0]), o7.triangleCount += t11[1] / 3), n10 && (r10.setUniform1f("u_halo", 0), e8.drawElements(E.TRIANGLES, t11[1], C.UNSIGNED_INT, Uint32Array.BYTES_PER_ELEMENT * t11[0]), o7.triangleCount += t11[1] / 3);
  1413. }
  1414. };
  1415. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js
  1416. var m7 = (e8) => ge(e8.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 3, name: "a_haloColor", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 4, name: "a_texAndSize", count: 4, type: C.UNSIGNED_BYTE }, { location: 5, name: "a_refSymbolAndPlacementOffset", count: 4, type: C.UNSIGNED_BYTE }, { location: 6, name: "a_glyphData", count: 4, type: C.UNSIGNED_BYTE }, { location: 7, name: "a_vertexOffset", count: 2, type: C.SHORT }, { location: 8, name: "a_texCoords", count: 2, type: C.UNSIGNED_SHORT }] });
  1417. var l6 = class extends p4 {
  1418. dispose() {
  1419. }
  1420. getGeometryType() {
  1421. return E3.LABEL;
  1422. }
  1423. supportsSymbology(e8) {
  1424. return true;
  1425. }
  1426. drawGeometry(t11, o7, a4, l8) {
  1427. const { context: d7, painter: u6, state: c8, rendererInfo: f5, requestRender: p6, allowDelayedRender: y3 } = t11, _5 = Z2.load(a4.materialKey), E7 = _5.mapAligned ? 1 : 0;
  1428. if (!E7 && Math.abs(o7.key.level - Math.round(100 * t11.displayLevel) / 100) >= 1)
  1429. return;
  1430. const { bufferLayouts: N4, attributes: S3 } = m7(_5), U3 = u6.materialManager.getMaterialProgram(t11, _5, "materials/label", S3, l8);
  1431. if (y3 && r(p6) && !U3.isCompiled)
  1432. return void p6();
  1433. t11.context.setStencilFunction(I.EQUAL, 0, 255), d7.useProgram(U3), this._setSharedUniforms(U3, t11, o7), u6.textureManager.bindTextures(d7, U3, _5);
  1434. const T3 = 1 === E7 ? c8.displayViewMat3 : c8.displayMat3;
  1435. this._setSizeVVUniforms(_5, U3, f5, o7), U3.setUniform1f("u_mapRotation", Math.floor(c8.rotation / 360 * 254)), U3.setUniform1f("u_mapAligned", E7), U3.setUniformMatrix3fv("u_displayMat3", T3), U3.setUniform1f("u_opacity", 1), U3.setUniform2fv("u_screenSize", t11.state.size), U3.setUniform1f("u_isHalo", 1);
  1436. const g3 = a4.target.getVAO(d7, N4, S3), G3 = a4.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  1437. d7.bindVAO(g3), d7.drawElements(E.TRIANGLES, a4.indexCount, C.UNSIGNED_INT, G3), U3.setUniform1f("u_isHalo", 0), d7.drawElements(E.TRIANGLES, a4.indexCount, C.UNSIGNED_INT, G3), d7.setStencilTestEnabled(true), d7.setBlendingEnabled(true);
  1438. }
  1439. };
  1440. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js
  1441. var s8 = (e8) => ge(e8.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 3, name: "a_offsetAndNormal", count: 4, type: C.BYTE }, { location: 4, name: "a_accumulatedDistanceAndHalfWidth", count: 2, type: C.UNSIGNED_SHORT }, { location: 5, name: "a_tlbr", count: 4, type: C.UNSIGNED_SHORT }, { location: 6, name: "a_segmentDirection", count: 4, type: C.BYTE }, { location: 7, name: "a_aux", count: 2, type: C.UNSIGNED_SHORT }, { location: 8, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }] });
  1442. var m8 = class extends p4 {
  1443. dispose() {
  1444. }
  1445. getGeometryType() {
  1446. return E3.LINE;
  1447. }
  1448. supportsSymbology(e8) {
  1449. return true;
  1450. }
  1451. drawGeometry(t11, o7, a4, m11) {
  1452. const { context: l8, painter: c8, rendererInfo: u6, displayLevel: p6, passOptions: d7, requestRender: y3, allowDelayedRender: _5 } = t11, f5 = C3.load(a4.materialKey), E7 = r(d7) && "hittest" === d7.type;
  1453. let N4 = s8(f5), g3 = E.TRIANGLES;
  1454. E7 && (N4 = this._getTriangleDesc(a4.materialKey, N4), g3 = E.POINTS);
  1455. const { attributes: S3, bufferLayouts: T3 } = N4, U3 = c8.materialManager.getMaterialProgram(t11, f5, "materials/line", S3, m11);
  1456. if (_5 && r(y3) && !U3.isCompiled)
  1457. return void y3();
  1458. const G3 = 1 / t11.pixelRatio, I3 = 0;
  1459. l8.useProgram(U3), this._setSharedUniforms(U3, t11, o7), f5.textureBinding && c8.textureManager.bindTextures(l8, U3, f5);
  1460. const D3 = 2 ** (p6 - o7.key.level);
  1461. U3.setUniform1f("u_zoomFactor", D3), U3.setUniform1f("u_blur", I3 + G3), U3.setUniform1f("u_antialiasing", G3), this._setSizeVVUniforms(f5, U3, u6, o7), this._setColorAndOpacityVVUniforms(f5, U3, u6), l8.setFaceCullingEnabled(false);
  1462. const R2 = a4.target.getVAO(l8, T3, S3, E7);
  1463. let b3 = a4.indexCount, x7 = a4.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  1464. E7 && (b3 /= 3, x7 /= 3), l8.bindVAO(R2), l8.drawElements(g3, b3, C.UNSIGNED_INT, x7);
  1465. }
  1466. };
  1467. // node_modules/@arcgis/core/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js
  1468. var s9 = (t11) => ge(t11.data, { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.SHORT }, { location: 1, name: "a_id", count: 4, type: C.UNSIGNED_BYTE }, { location: 2, name: "a_color", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 3, name: "a_haloColor", count: 4, type: C.UNSIGNED_BYTE, normalized: true }, { location: 4, name: "a_texFontSize", count: 4, type: C.UNSIGNED_BYTE }, { location: 5, name: "a_aux", count: 4, type: C.BYTE }, { location: 6, name: "a_zoomRange", count: 2, type: C.UNSIGNED_SHORT }, { location: 7, name: "a_vertexOffset", count: 2, type: C.SHORT }, { location: 8, name: "a_texCoords", count: 2, type: C.UNSIGNED_SHORT }] });
  1469. var m9 = class extends p4 {
  1470. dispose() {
  1471. }
  1472. getGeometryType() {
  1473. return E3.TEXT;
  1474. }
  1475. supportsSymbology(t11) {
  1476. return true;
  1477. }
  1478. drawGeometry(e8, o7, a4, m11) {
  1479. const { context: l8, painter: p6, rendererInfo: u6, state: d7, passOptions: y3, requestRender: _5, allowDelayedRender: c8 } = e8, f5 = P2.load(a4.materialKey), E7 = r(y3) && "hittest" === y3.type, { bufferLayouts: N4, attributes: S3 } = s9(f5), T3 = p6.materialManager.getMaterialProgram(e8, f5, "materials/text", S3, m11);
  1480. if (c8 && r(_5) && !T3.isCompiled)
  1481. return void _5();
  1482. l8.useProgram(T3);
  1483. let U3 = E.TRIANGLES;
  1484. E7 && (U3 = E.POINTS), this._setSharedUniforms(T3, e8, o7), p6.textureManager.bindTextures(l8, T3, f5), T3.setUniformMatrix3fv("u_displayMat3", d7.displayMat3), T3.setUniformMatrix3fv("u_displayViewMat3", d7.displayViewMat3), this._setSizeVVUniforms(f5, T3, u6, o7), this._setColorAndOpacityVVUniforms(f5, T3, u6), this._setRotationVVUniforms(f5, T3, u6), T3.setUniform1f("u_isHalo", 1);
  1485. const x7 = a4.target.getVAO(l8, N4, S3), G3 = a4.indexFrom * Uint32Array.BYTES_PER_ELEMENT;
  1486. l8.bindVAO(x7), l8.drawElements(E.TRIANGLES, a4.indexCount, C.UNSIGNED_INT, G3), T3.setUniform1f("u_isHalo", 0), l8.drawElements(U3, a4.indexCount, C.UNSIGNED_INT, G3);
  1487. }
  1488. };
  1489. // node_modules/@arcgis/core/views/2d/engine/brushes.js
  1490. var n8 = { marker: u4, line: m8, fill: c5, text: m9, label: l6, clip: d4, stencil: h3, bitmap: m4, overlay: u2, raster: m3, rasterVF: d2, flow: i4, tileInfo: x5, vtlBackground: d6, vtlFill: m6, vtlLine: u5, vtlCircle: c6, vtlSymbol: M5, dotDensity: O4, heatmap: B3, pieChart: s7 };
  1491. // node_modules/@arcgis/core/views/2d/engine/webgl/Mesh2D.js
  1492. var x6 = (t11) => {
  1493. switch (t11.BYTES_PER_ELEMENT) {
  1494. case 1:
  1495. return C.UNSIGNED_BYTE;
  1496. case 2:
  1497. return C.UNSIGNED_SHORT;
  1498. case 4:
  1499. return C.UNSIGNED_INT;
  1500. default:
  1501. throw new s2("Cannot get DataType of array");
  1502. }
  1503. };
  1504. var g2 = (e8, t11, r10, s10) => {
  1505. let o7 = 0;
  1506. for (let n10 = 1; n10 < r10; n10++) {
  1507. const r11 = e8[2 * (t11 + n10 - 1)], s11 = e8[2 * (t11 + n10 - 1) + 1];
  1508. o7 += (e8[2 * (t11 + n10)] - r11) * (e8[2 * (t11 + n10) + 1] + s11);
  1509. }
  1510. return s10 ? o7 > 0 : o7 < 0;
  1511. };
  1512. var p5 = ({ coords: e8, lengths: t11 }, r10) => {
  1513. const o7 = [];
  1514. for (let n10 = 0, i6 = 0; n10 < t11.length; i6 += t11[n10], n10 += 1) {
  1515. const c8 = i6, a4 = [];
  1516. for (; n10 < t11.length - 1 && g2(e8, i6 + t11[n10], t11[n10 + 1], r10); n10 += 1, i6 += t11[n10])
  1517. a4.push(i6 + t11[n10] - c8);
  1518. const f5 = e8.slice(2 * c8, 2 * (i6 + t11[n10])), h5 = x(f5, a4, 2);
  1519. for (const e9 of h5)
  1520. o7.push(e9 + c8);
  1521. }
  1522. return o7;
  1523. };
  1524. var l7 = class {
  1525. constructor(e8, t11, r10, s10 = false) {
  1526. this._cache = {}, this.vertices = e8, this.indices = t11, this.primitiveType = r10, this.isMapSpace = s10;
  1527. }
  1528. static fromRect({ x: e8, y: t11, width: r10, height: s10 }) {
  1529. const o7 = e8, n10 = t11, i6 = o7 + r10, c8 = n10 + s10;
  1530. return l7.fromScreenExtent({ xmin: o7, ymin: n10, xmax: i6, ymax: c8 });
  1531. }
  1532. static fromPath(e8) {
  1533. const t11 = K(new t3(), e8.path, false, false), r10 = t11.coords, s10 = new Uint32Array(p5(t11, true)), o7 = new Uint32Array(r10.length / 2);
  1534. for (let n10 = 0; n10 < o7.length; n10++)
  1535. o7[n10] = w(Math.floor(r10[2 * n10]), Math.floor(r10[2 * n10 + 1]));
  1536. return new l7({ geometry: o7 }, s10, E.TRIANGLES);
  1537. }
  1538. static fromGeometry(r10, s10) {
  1539. const o7 = s10.geometry.type;
  1540. switch (o7) {
  1541. case "polygon":
  1542. return l7.fromPolygon(r10, s10.geometry);
  1543. case "extent":
  1544. return l7.fromMapExtent(r10, s10.geometry);
  1545. default:
  1546. return s.getLogger("esri.views.2d.engine.webgl.Mesh2D").error(new s2("mapview-bad-type", `Unable to create a mesh from type ${o7}`, s10)), l7.fromRect({ x: 0, y: 0, width: 1, height: 1 });
  1547. }
  1548. }
  1549. static fromPolygon(e8, t11) {
  1550. const r10 = J(new t3(), t11, false, false), s10 = r10.coords, i6 = new Uint32Array(p5(r10, false)), h5 = new Uint32Array(s10.length / 2), u6 = n2(), y3 = n2();
  1551. for (let n10 = 0; n10 < h5.length; n10++)
  1552. r2(u6, s10[2 * n10], s10[2 * n10 + 1]), e8.toScreen(y3, u6), h5[n10] = w(Math.floor(y3[0]), Math.floor(y3[1]));
  1553. return new l7({ geometry: h5 }, i6, E.TRIANGLES, true);
  1554. }
  1555. static fromScreenExtent({ xmin: e8, xmax: t11, ymin: r10, ymax: s10 }) {
  1556. const o7 = { geometry: new Uint32Array([w(e8, r10), w(t11, r10), w(e8, s10), w(e8, s10), w(t11, r10), w(t11, s10)]) }, n10 = new Uint32Array([0, 1, 2, 3, 4, 5]);
  1557. return new l7(o7, n10, E.TRIANGLES);
  1558. }
  1559. static fromMapExtent(e8, t11) {
  1560. const [r10, s10] = e8.toScreen([0, 0], [t11.xmin, t11.ymin]), [o7, n10] = e8.toScreen([0, 0], [t11.xmax, t11.ymax]), i6 = { geometry: new Uint32Array([w(r10, s10), w(o7, s10), w(r10, n10), w(r10, n10), w(o7, s10), w(o7, n10)]) }, c8 = new Uint32Array([0, 1, 2, 3, 4, 5]);
  1561. return new l7(i6, c8, E.TRIANGLES);
  1562. }
  1563. destroy() {
  1564. r(this._cache.indexBuffer) && this._cache.indexBuffer.dispose();
  1565. for (const e8 in this._cache.vertexBuffers)
  1566. r(this._cache.vertexBuffers[e8]) && this._cache.vertexBuffers[e8].dispose();
  1567. }
  1568. get elementType() {
  1569. return x6(this.indices);
  1570. }
  1571. getIndexBuffer(e8, t11 = F.STATIC_DRAW) {
  1572. return this._cache.indexBuffer || (this._cache.indexBuffer = E5.createIndex(e8, t11, this.indices)), this._cache.indexBuffer;
  1573. }
  1574. getVertexBuffers(e8, t11 = F.STATIC_DRAW) {
  1575. return this._cache.vertexBuffers || (this._cache.vertexBuffers = Object.keys(this.vertices).reduce((r10, s10) => ({ ...r10, [s10]: E5.createVertex(e8, t11, this.vertices[s10]) }), {})), this._cache.vertexBuffers;
  1576. }
  1577. };
  1578. // node_modules/@arcgis/core/views/2d/engine/webgl/ClippingInfo.js
  1579. var n9 = (t11) => parseFloat(t11) / 100;
  1580. var m10 = class extends r6 {
  1581. constructor(t11, e8) {
  1582. super(), this._clip = e8, this._cache = {}, this.stage = t11, this._handle = l(() => e8.version, () => this._invalidate()), this.ready();
  1583. }
  1584. static fromClipArea(t11, e8) {
  1585. return new m10(t11, e8);
  1586. }
  1587. _destroyGL() {
  1588. r(this._cache.mesh) && (this._cache.mesh.destroy(), this._cache.mesh = null), r(this._cache.vao) && (this._cache.vao.dispose(), this._cache.vao = null);
  1589. }
  1590. destroy() {
  1591. this._destroyGL(), this._handle.remove();
  1592. }
  1593. getVAO(t11, e8, r10, i6) {
  1594. const [o7, h5] = e8.size;
  1595. if ("geometry" !== this._clip.type && this._lastWidth === o7 && this._lastHeight === h5 || (this._lastWidth = o7, this._lastHeight = h5, this._destroyGL()), t(this._cache.vao)) {
  1596. const s10 = this._createMesh(e8, this._clip), o8 = s10.getIndexBuffer(t11), h6 = s10.getVertexBuffers(t11);
  1597. this._cache.mesh = s10, this._cache.vao = new a2(t11, r10, i6, h6, o8);
  1598. }
  1599. return this._cache.vao;
  1600. }
  1601. _createTransforms() {
  1602. return { dvs: e2() };
  1603. }
  1604. _invalidate() {
  1605. this._destroyGL(), this.requestRender();
  1606. }
  1607. _createScreenRect(t11, e8) {
  1608. const [r10, s10] = t11.size, i6 = "string" == typeof e8.left ? n9(e8.left) * r10 : e8.left, o7 = "string" == typeof e8.right ? n9(e8.right) * r10 : e8.right, h5 = "string" == typeof e8.top ? n9(e8.top) * s10 : e8.top, a4 = "string" == typeof e8.bottom ? n9(e8.bottom) * s10 : e8.bottom, c8 = i6, m11 = h5;
  1609. return { x: c8, y: m11, width: Math.max(r10 - o7 - c8, 0), height: Math.max(s10 - a4 - m11, 0) };
  1610. }
  1611. _createMesh(r10, s10) {
  1612. switch (s10.type) {
  1613. case "rect":
  1614. return l7.fromRect(this._createScreenRect(r10, s10));
  1615. case "path":
  1616. return l7.fromPath(s10);
  1617. case "geometry":
  1618. return l7.fromGeometry(r10, s10);
  1619. default:
  1620. return s.getLogger("esri.views.2d.engine.webgl.ClippingInfo").error(new s2("mapview-bad-type", "Unable to create ClippingInfo mesh from clip of type: ${clip.type}")), l7.fromRect({ x: 0, y: 0, width: 1, height: 1 });
  1621. }
  1622. }
  1623. };
  1624. // node_modules/@arcgis/core/views/2d/engine/webgl/WGLContainer.js
  1625. var o6 = class extends i3 {
  1626. constructor() {
  1627. super(...arguments), this.name = this.constructor.name;
  1628. }
  1629. set clips(e8) {
  1630. this._clips = e8, this.children.forEach((r10) => r10.clips = e8), this._updateClippingInfo();
  1631. }
  1632. beforeRender(e8) {
  1633. super.beforeRender(e8), this.updateTransforms(e8.state);
  1634. }
  1635. _createTransforms() {
  1636. return { dvs: e2() };
  1637. }
  1638. doRender(e8) {
  1639. const r10 = this.createRenderParams(e8), { painter: s10, globalOpacity: t11, profiler: i6, drawPhase: n10 } = r10, o7 = n10 === I2.LABEL || n10 === I2.HIGHLIGHT ? 1 : t11 * this.computedOpacity;
  1640. i6.recordContainerStart(this.name), s10.beforeRenderLayer(r10, this._clippingInfos ? 255 : 0, o7), this.renderChildren(r10), s10.compositeLayer(r10, o7), i6.recordContainerEnd();
  1641. }
  1642. renderChildren(r10) {
  1643. t(this._renderPasses) && (this._renderPasses = this.prepareRenderPasses(r10.painter));
  1644. for (const e8 of this._renderPasses)
  1645. try {
  1646. e8.render(r10);
  1647. } catch (s10) {
  1648. }
  1649. }
  1650. createRenderParams(e8) {
  1651. return e8.requireFBO = this.requiresDedicatedFBO, e8;
  1652. }
  1653. prepareRenderPasses(e8) {
  1654. return [e8.registerRenderPass({ name: "clip", brushes: [n8.clip], target: () => this._clippingInfos, drawPhase: I2.MAP | I2.LABEL | I2.LABEL_ALPHA | I2.DEBUG | I2.HIGHLIGHT })];
  1655. }
  1656. updateTransforms(e8) {
  1657. for (const r10 of this.children)
  1658. r10.setTransform(e8);
  1659. }
  1660. onAttach() {
  1661. super.onAttach(), this._updateClippingInfo();
  1662. }
  1663. onDetach() {
  1664. super.onDetach(), this._updateClippingInfo();
  1665. }
  1666. _updateClippingInfo() {
  1667. if (r(this._clippingInfos) && (this._clippingInfos.forEach((e9) => e9.destroy()), this._clippingInfos = null), !this.stage)
  1668. return;
  1669. const e8 = this._clips;
  1670. r(e8) && e8.length && (this._clippingInfos = e8.items.map((e9) => m10.fromClipArea(this.stage, e9))), this.requestRender();
  1671. }
  1672. };
  1673. export {
  1674. i4 as i,
  1675. c,
  1676. p3 as p,
  1677. n4 as n,
  1678. d2 as d,
  1679. n6 as n2,
  1680. t10 as t,
  1681. t6 as t2,
  1682. m2 as m,
  1683. x5 as x,
  1684. h3 as h,
  1685. n8 as n3,
  1686. o6 as o
  1687. };
  1688. //# sourceMappingURL=chunk-264YGWEE.js.map