@sjcrh/proteinpaint-client 2.217.0 → 2.217.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (568) hide show
  1. package/dist/{2dmaf-RRHATFHO.js → 2dmaf-CIL2ONNM.js} +3 -3
  2. package/dist/{AggMatrixInput-4UHBCXYH.js → AggMatrixInput-NHIZKOEJ.js} +4 -4
  3. package/dist/{AggregateMatrix-IJE5CM5Y.js → AggregateMatrix-XSH3ABE3.js} +4 -4
  4. package/dist/{AppHeader-UXGLRW6C.js → AppHeader-5BJHFV6B.js} +10 -10
  5. package/dist/{BoxPlot-GQYC22KY.js → BoxPlot-CQTWWP3V.js} +3 -3
  6. package/dist/{CorrelationVolcano-5CWRWZTI.js → CorrelationVolcano-5NCISX65.js} +3 -3
  7. package/dist/{Cuminc-TYHKAPRK.js → Cuminc-BLT2JPSD.js} +3 -3
  8. package/dist/{DE-UUFQGSOI.js → DE-ZP46TCQ7.js} +7 -7
  9. package/dist/{DEinput-DU7MF4YY.js → DEinput-STU4BW5M.js} +3 -3
  10. package/dist/{DM-SSI5KUBC.js → DM-SUKRUDAG.js} +7 -7
  11. package/dist/{DifferentialAnalysis-G6FE2MXY.js → DifferentialAnalysis-NLYX5JSB.js} +3 -3
  12. package/dist/{Disco-B3KGNEAW.js → Disco-IVV6MP6F.js} +5 -5
  13. package/dist/{Disco.UI-UNPUBQCN.js → Disco.UI-XEGN5DQR.js} +6 -6
  14. package/dist/{DmrPlot-27NGDMT4.js → DmrPlot-FS5HEDFS.js} +5 -5
  15. package/dist/{GB-SXACUA4V.js → GB-TOVICNRX.js} +5 -5
  16. package/dist/{GSEA-EHMBA3TF.js → GSEA-7OFDPLDK.js} +4 -4
  17. package/dist/{GeneExpInput-NDXISF2U.js → GeneExpInput-GOT2JAHD.js} +3 -3
  18. package/dist/{Geomap-3CNT227W.js → Geomap-YEF6A4LT.js} +3 -3
  19. package/dist/{HicApp-VQBUB6EZ.js → HicApp-IN6LCUZH.js} +4 -4
  20. package/dist/{IDCViewer-DTOE7KDX.js → IDCViewer-QFJH22IE.js} +3 -3
  21. package/dist/{NumBinaryEditor-IVZ4MMQT.js → NumBinaryEditor-GT3Z5JQD.js} +3 -3
  22. package/dist/{NumBinaryEditor.unit.spec-3BSQ6FM4.js → NumBinaryEditor.unit.spec-RCCNWZ6J.js} +5 -5
  23. package/dist/{NumContEditor-CUZHU3IO.js → NumContEditor-WLJ4Z3RC.js} +3 -3
  24. package/dist/{NumContEditor.unit.spec-SCQFD2Y7.js → NumContEditor.unit.spec-G2OURVAV.js} +5 -5
  25. package/dist/{NumCustomBinEditor-UEEYZ4ZO.js → NumCustomBinEditor-LSMCZSV3.js} +4 -4
  26. package/dist/{NumCustomBinEditor.unit.spec-GYS35OQV.js → NumCustomBinEditor.unit.spec-ZAKGVYD5.js} +5 -5
  27. package/dist/{NumDiscreteEditor-IT7NIXTV.js → NumDiscreteEditor-GRBCPKDX.js} +5 -5
  28. package/dist/{NumDiscreteEditor.unit.spec-LB6VLAWO.js → NumDiscreteEditor.unit.spec-GUHC6TMF.js} +5 -5
  29. package/dist/{NumRegularBinEditor-FF6UXZWN.js → NumRegularBinEditor-DEVTUDUK.js} +4 -4
  30. package/dist/{NumRegularBinEditor.unit.spec-Z4S5LH2C.js → NumRegularBinEditor.unit.spec-4A65XLAU.js} +5 -5
  31. package/dist/{NumSplineEditor-IW5WEN3P.js → NumSplineEditor-DQJB74LS.js} +3 -3
  32. package/dist/{NumSplineEditor.unit.spec-PAEN3SAD.js → NumSplineEditor.unit.spec-GSJBAV5V.js} +5 -5
  33. package/dist/{NumericDensity-CPJIQLYT.js → NumericDensity-U2NFSYMA.js} +4 -4
  34. package/dist/{NumericDensity.unit.spec-4KHECHVU.js → NumericDensity.unit.spec-OKC4ZXKE.js} +4 -4
  35. package/dist/{NumericHandler-SEFTQJDM.js → NumericHandler-4IREXDIN.js} +5 -5
  36. package/dist/{NumericHandler.unit.spec-UGDR3476.js → NumericHandler.unit.spec-M44XE7VM.js} +5 -5
  37. package/dist/{ProteomeInput-NYPUYVN5.js → ProteomeInput-W3ZFJMN3.js} +6 -6
  38. package/dist/{Regression-WDSISHYL.js → Regression-V6UEVWJ2.js} +6 -6
  39. package/dist/{RunChart2-2NPADXUR.js → RunChart2-4QXD44SZ.js} +3 -3
  40. package/dist/{SC-EWDBPHEL.js → SC-G2TTCPHB.js} +3 -3
  41. package/dist/{Violin-POGGPCZY.js → Violin-ICLO3WIA.js} +3 -3
  42. package/dist/{Volcano-U2B4KEUL.js → Volcano-RLSRLDGE.js} +6 -6
  43. package/dist/{Wsi-G7OCAJ3R.js → Wsi-Q23I6CNU.js} +17 -6
  44. package/dist/Wsi-Q23I6CNU.js.map +7 -0
  45. package/dist/{adSandbox-SUCX6DAQ.js → adSandbox-LK6SIWRU.js} +4 -4
  46. package/dist/{animatedBubbleChart-SDBWJELZ.js → animatedBubbleChart-CPKZ5IAQ.js} +3 -3
  47. package/dist/{app-ATQM5PKI.js → app-63JVVY2P.js} +3 -3
  48. package/dist/{app-BCKEWJCY.js → app-KDNMMF4V.js} +7 -7
  49. package/dist/app.js +8 -8
  50. package/dist/{bam-QK2ZLZDI.js → bam-ZGG3CZ3F.js} +5 -5
  51. package/dist/{barchart-RHDKI3NZ.js → barchart-LT22NFGV.js} +3 -3
  52. package/dist/{barchart2-CS3E6FOY.js → barchart2-PFJY6UDX.js} +4 -4
  53. package/dist/{block-RQ3HTJVP.js → block-3BDXSRE2.js} +23 -23
  54. package/dist/{block.init-T33F47DO.js → block.init-P4EZMHDW.js} +4 -4
  55. package/dist/{block.mds.expressionrank-LQD6MN6Z.js → block.mds.expressionrank-D6NXBJVQ.js} +5 -5
  56. package/dist/{block.mds.geneboxplot-N5XHHVR7.js → block.mds.geneboxplot-5BCO3XTU.js} +4 -4
  57. package/dist/{block.mds.junction-JD4WQUSH.js → block.mds.junction-UAZFDKDC.js} +9 -9
  58. package/dist/{block.mds.svcnv-LCTYWXL2.js → block.mds.svcnv-4E25YHMY.js} +15 -15
  59. package/dist/{block.svg-2F3RGTI3.js → block.svg-DV36CFYT.js} +3 -3
  60. package/dist/{block.tk.aicheck-BOF6WZ5E.js → block.tk.aicheck-4FARAYJA.js} +3 -3
  61. package/dist/{block.tk.bam-5GBYEQBM.js → block.tk.bam-SXZ5UIYA.js} +3 -3
  62. package/dist/{block.tk.bedgraphdot-LVQEP4RS.js → block.tk.bedgraphdot-6GLI6JC7.js} +3 -3
  63. package/dist/{block.tk.bigwig.ui-HHBO4JAC.js → block.tk.bigwig.ui-6HO44Y4S.js} +3 -3
  64. package/dist/{block.tk.hicstraw-JBO4UEOA.js → block.tk.hicstraw-C2MDLNFC.js} +3 -3
  65. package/dist/{block.tk.junction-S5S2N7FK.js → block.tk.junction-KQVG3KPX.js} +6 -6
  66. package/dist/{block.tk.junction.textmatrixui-DNQL7WB5.js → block.tk.junction.textmatrixui-AATONHSH.js} +4 -4
  67. package/dist/{block.tk.ld-JHQNR67E.js → block.tk.ld-GT2L3Q7W.js} +5 -5
  68. package/dist/{block.tk.menu-7JBJOY2O.js → block.tk.menu-KPCUW44Y.js} +3 -3
  69. package/dist/{block.tk.pgv-FQPREV6P.js → block.tk.pgv-CEI6DROP.js} +5 -5
  70. package/dist/{brainImaging-HEWGZZNY.js → brainImaging-3HD2D2DU.js} +3 -3
  71. package/dist/{brainRegions-QUGB7YUW.js → brainRegions-PQYGC2VX.js} +3 -3
  72. package/dist/{bubbleHeatmap-OZRONGAX.js → bubbleHeatmap-UFBJZIEX.js} +3 -3
  73. package/dist/{cellTypeBubbleHeatmap-N7NDE325.js → cellTypeBubbleHeatmap-MPZGYZNN.js} +3 -3
  74. package/dist/{chunk-MBQIHLGI.js → chunk-2KW5LFOE.js} +43 -39
  75. package/dist/chunk-2KW5LFOE.js.map +7 -0
  76. package/dist/{chunk-WTAPOH2W.js → chunk-2RILGMXS.js} +323 -149
  77. package/dist/{chunk-WTAPOH2W.js.map → chunk-2RILGMXS.js.map} +4 -4
  78. package/dist/{chunk-FVZTRWAO.js → chunk-3744MZJC.js} +2 -2
  79. package/dist/{chunk-NPBN3PPZ.js → chunk-3E3CBNKZ.js} +9 -9
  80. package/dist/{chunk-MU4Z2MX2.js → chunk-3RM7V7BR.js} +6 -6
  81. package/dist/{chunk-F5FFI7Z7.js → chunk-4JLKTIP4.js} +3 -3
  82. package/dist/{chunk-B3WLXXGY.js → chunk-4MOTOAOU.js} +4 -4
  83. package/dist/{chunk-CTFHEDG2.js → chunk-4TWRPEGD.js} +3 -3
  84. package/dist/{chunk-KGX2OIR4.js → chunk-5C3FZM54.js} +2 -2
  85. package/dist/{chunk-6D4HOTG7.js → chunk-5CAZX356.js} +6 -6
  86. package/dist/{chunk-AV2IH5K2.js → chunk-5FIEOWA7.js} +7 -7
  87. package/dist/{chunk-ABLG7GUS.js → chunk-5T2UWGI6.js} +2 -2
  88. package/dist/{chunk-L2NPLA43.js → chunk-65UPR2AG.js} +2 -2
  89. package/dist/{chunk-EDFBRXX2.js → chunk-ACVTLIAU.js} +2 -2
  90. package/dist/{chunk-F2EEQ7KG.js → chunk-BI3X5K2H.js} +2 -2
  91. package/dist/{chunk-2JIKMCJR.js → chunk-CZN4JCYE.js} +2 -2
  92. package/dist/{chunk-D35GNF3Y.js → chunk-FPB4EOWN.js} +6 -6
  93. package/dist/{chunk-NULQJF73.js → chunk-G7OSIYTA.js} +2 -2
  94. package/dist/{chunk-GSVB4XNS.js → chunk-H2Y4IUBO.js} +2 -2
  95. package/dist/{chunk-CZK4EV3Y.js → chunk-H4KG6SQP.js} +5 -5
  96. package/dist/chunk-I4LVKOHE.js +182 -0
  97. package/dist/{chunk-5G6O5RYM.js → chunk-ICA3GVKW.js} +2 -2
  98. package/dist/{chunk-XXFLJWTQ.js → chunk-IFIUHU72.js} +2 -2
  99. package/dist/{chunk-7JHIUS54.js → chunk-IYLGC4WF.js} +3 -3
  100. package/dist/{chunk-SUT75MRI.js → chunk-JLDBGKA5.js} +3 -3
  101. package/dist/{chunk-NNDKYTUV.js → chunk-K74TUVYA.js} +106 -106
  102. package/dist/{chunk-C2TII2FF.js → chunk-KK6CIJLF.js} +2 -2
  103. package/dist/{chunk-FK5NL2DF.js → chunk-KZHRRLJQ.js} +4 -4
  104. package/dist/{chunk-DX23HAW7.js → chunk-LZEQYV3V.js} +2 -2
  105. package/dist/{chunk-LQKMDIRB.js → chunk-M77SRLIA.js} +2 -2
  106. package/dist/{chunk-HFKZGMVV.js → chunk-MEG6TPXF.js} +7 -7
  107. package/dist/{chunk-QYCPIVCX.js → chunk-MJANYPJN.js} +2 -2
  108. package/dist/{chunk-V4ZKHM6D.js → chunk-MLW6KEI7.js} +36 -36
  109. package/dist/{chunk-65DO5IKM.js → chunk-N56BEWRA.js} +4 -4
  110. package/dist/{chunk-6Q5SOSSU.js → chunk-NKDW4MRL.js} +6 -6
  111. package/dist/{chunk-X77QVINS.js → chunk-NUEYFEVP.js} +2 -2
  112. package/dist/{chunk-AIC43DTG.js → chunk-OOEXVYSJ.js} +2 -2
  113. package/dist/{chunk-OBNHXAYG.js → chunk-OOSMSVWQ.js} +2 -2
  114. package/dist/{chunk-X2HWRISK.js → chunk-OXNBEVNJ.js} +2 -2
  115. package/dist/{chunk-V7DNHPZD.js → chunk-PGQQ7SGL.js} +5 -5
  116. package/dist/{chunk-NYO7YANQ.js → chunk-QNSESUCC.js} +2 -2
  117. package/dist/{chunk-TPSVPMAN.js → chunk-QOMGX4EF.js} +2 -2
  118. package/dist/{chunk-BU6PAOGA.js → chunk-R6C5F7XI.js} +2 -2
  119. package/dist/{chunk-MFR4WWDM.js → chunk-RRKGUOVG.js} +2 -2
  120. package/dist/{chunk-PETYR7LC.js → chunk-U5EZ5JEB.js} +2 -2
  121. package/dist/{chunk-J5KCTRJC.js → chunk-UXR6JRJE.js} +2 -2
  122. package/dist/{chunk-PQVHRM4L.js → chunk-VDBNJUAY.js} +11 -11
  123. package/dist/{chunk-WU3YXPRE.js → chunk-VLNB4EVT.js} +2 -2
  124. package/dist/{chunk-SYLYLOHK.js → chunk-VWUZT2TX.js} +2 -2
  125. package/dist/{chunk-3SPEW6R6.js → chunk-WDO4GOLT.js} +3 -3
  126. package/dist/{chunk-2FWSNJEN.js → chunk-WTFURQK2.js} +2 -2
  127. package/dist/{chunk-RZ2THVK4.js → chunk-XOCGDNLB.js} +2 -2
  128. package/dist/{chunk-TEFWF3SK.js → chunk-YHX7HJS6.js} +3 -3
  129. package/dist/{chunk-QLUTQPZE.js → chunk-YKZXJUQD.js} +2 -2
  130. package/dist/{chunk-AJXP4AV7.js → chunk-YWS2FZOD.js} +2 -2
  131. package/dist/{chunk-GVAV4VRI.js → chunk-ZN4W6WU4.js} +2 -2
  132. package/dist/{chunk-BG6GAROI.js → chunk-ZORGD72P.js} +2 -2
  133. package/dist/{chunk-E7XHA4YL.js → chunk-ZUZ46DIU.js} +7 -7
  134. package/dist/{cohort-ATIZW34H.js → cohort-USQUJH65.js} +3 -3
  135. package/dist/{cohortSunburst-WQK2UV25.js → cohortSunburst-VRSXHLMP.js} +3 -3
  136. package/dist/{condition-SGJIDZNB.js → condition-UKODOO7B.js} +3 -3
  137. package/dist/{controls-JQCMGPXP.js → controls-CQMY7DFR.js} +3 -3
  138. package/dist/{controls.config-WQHVQAIJ.js → controls.config-CQUF4FG7.js} +3 -3
  139. package/dist/{correlation-S3MN3L5Q.js → correlation-CGCAX4MY.js} +7 -7
  140. package/dist/{customdata.inputui-LGTGMJBZ.js → customdata.inputui-HAMDCSHR.js} +3 -3
  141. package/dist/{dataDownload-FAWN2WKE.js → dataDownload-UN253EGZ.js} +3 -3
  142. package/dist/{databrowser.ui-KF3LWQXG.js → databrowser.ui-5P6PDW37.js} +7 -7
  143. package/dist/{dictionary-EVLEOT72.js → dictionary-WVFDMSQK.js} +3 -3
  144. package/dist/{geneExpression-G6ODP3VY.js → dnaMethylation-4QDYABEF.js} +4 -4
  145. package/dist/{dnaMethylation.integration.spec-CTA53YCT.js → dnaMethylation.integration.spec-KHEO5VBH.js} +4 -4
  146. package/dist/{e2pca-PTWPY5WP.js → e2pca-72JWCRI4.js} +3 -3
  147. package/dist/{ep-MS4LQQDR.js → ep-XWLO4IMJ.js} +3 -3
  148. package/dist/{expclust.gdc.spec-S5FE4MMD.js → expclust.gdc.spec-EJZTXHTU.js} +10 -10
  149. package/dist/{facet-FSOIZJCA.js → facet-BWJ5655K.js} +3 -3
  150. package/dist/{gb-YDEOK7NW.js → gb-Z2QTJNBU.js} +7 -7
  151. package/dist/{geneExpClustering-37JKKFW3.js → geneExpClustering-N3Q64QDC.js} +5 -5
  152. package/dist/{dnaMethylation-J3SPEM4S.js → geneExpression-YIKPVBTJ.js} +4 -4
  153. package/dist/{geneExpression.unit.spec-ZHXCUG6Q.js → geneExpression.unit.spec-OUBUIYUZ.js} +4 -4
  154. package/dist/{geneORA-E3PSS3CI.js → geneORA-URZOQAQX.js} +3 -3
  155. package/dist/{geneRanking-MK3YYINC.js → geneRanking-M4L77YCZ.js} +3 -3
  156. package/dist/{geneVariant-NNSB7JLS.js → geneVariant-PJZU6VDA.js} +3 -3
  157. package/dist/{geneVariant-LEMAVFOY.js → geneVariant-ZL672DRD.js} +3 -3
  158. package/dist/{geneVariant.integration.spec-6CC5UAOP.js → geneVariant.integration.spec-TRNFCKAB.js} +3 -3
  159. package/dist/{genefusion.ui-5NCQIQPN.js → genefusion.ui-P7TTTF46.js} +3 -3
  160. package/dist/{geneset-ZX4V3CFB.js → geneset-FVANVOWM.js} +3 -3
  161. package/dist/{genomeBrowser.spec-J7ISXY6H.js → genomeBrowser.spec-GK6AD4MO.js} +10 -10
  162. package/dist/{grin2-LBGBBB4L.js → grin2-R7IKKWQM.js} +5 -5
  163. package/dist/{grin2-GN3DQNON.js → grin2-YTGF2J53.js} +4 -4
  164. package/dist/{hierCluster-5JURTKAZ.js → hierCluster-3CRQK7IC.js} +11 -11
  165. package/dist/{hierCluster-BJ5VBPXR.js → hierCluster-TU3QQL25.js} +10 -10
  166. package/dist/{hierCluster.config-4EERP4KK.js → hierCluster.config-PAGYMNCO.js} +5 -5
  167. package/dist/{hierCluster.integration.spec-VR4GULRV.js → hierCluster.integration.spec-G3IDXWFJ.js} +12 -12
  168. package/dist/{hierCluster.interactivity-SMTQOKUY.js → hierCluster.interactivity-OLEOCVNC.js} +4 -4
  169. package/dist/{imagePlot-4LMIKBVE.js → imagePlot-MNAZHIII.js} +4 -4
  170. package/dist/importPlot-53M5BVST.js +8 -0
  171. package/dist/{isoformExpression-VCDNKTZ6.js → isoformExpression-C2IFFMAB.js} +4 -4
  172. package/dist/{isoformExpression.unit.spec-ZXYY37TA.js → isoformExpression.unit.spec-43QIRLHF.js} +4 -4
  173. package/dist/{junction-5DXJO4PS.js → junction-DUFUB3E5.js} +4 -4
  174. package/dist/{junction.unit.spec-F35E3GJW.js → junction.unit.spec-TYRPWIHC.js} +4 -4
  175. package/dist/{launch.adhoc-V2HTCQGD.js → launch.adhoc-AOGLYLUB.js} +6 -6
  176. package/dist/{leftlabel.sample-V7O2EC36.js → leftlabel.sample-4FTZWEFI.js} +6 -6
  177. package/dist/{lollipop-RNRZLG64.js → lollipop-YVVIWUN6.js} +5 -5
  178. package/dist/{maf-W6SF6BJS.js → maf-PLSOTYRZ.js} +3 -3
  179. package/dist/{maftimeline-NABCAMHG.js → maftimeline-LPMMCZUU.js} +3 -3
  180. package/dist/{matrix-UCHESWVK.js → matrix-SKJLMCLM.js} +8 -8
  181. package/dist/{matrix-JC6AJT2N.js → matrix-SYWFJGCI.js} +8 -8
  182. package/dist/{matrix.config-6US3AAH7.js → matrix.config-ZTKVUQ4O.js} +4 -4
  183. package/dist/{matrix.integration.spec-KXX7SFX5.js → matrix.integration.spec-F5HC2EBF.js} +10 -10
  184. package/dist/{matrix.interactivity-NHWG4WCC.js → matrix.interactivity-5IXEUY7Y.js} +4 -4
  185. package/dist/{matrix.layout-5DQNT7DD.js → matrix.layout-AH7DOPFS.js} +4 -4
  186. package/dist/{matrix.renderers-GYOXGHPU.js → matrix.renderers-3VGVCAGO.js} +4 -4
  187. package/dist/{matrix.sort.unit.spec-S6BAFYPR.js → matrix.sort.unit.spec-GTZ3BJYB.js} +4 -4
  188. package/dist/{matrix.sorterUi.unit.spec-V5NVQGD5.js → matrix.sorterUi.unit.spec-W545SQ2L.js} +4 -4
  189. package/dist/{matrix.unit.spec-R4NMTZYQ.js → matrix.unit.spec-QFLMTDN3.js} +8 -8
  190. package/dist/{mavb-MRCVMBPD.js → mavb-7NZXBVY7.js} +4 -4
  191. package/dist/{mds.fimo-5DCH5BEM.js → mds.fimo-VDI352JM.js} +3 -3
  192. package/dist/{mds.samplescatterplot-VIBCS5M6.js → mds.samplescatterplot-DA6VJG2H.js} +5 -5
  193. package/dist/{mds.survivalplot-AZ7LJDZZ.js → mds.survivalplot-ZZ3ASQSJ.js} +3 -3
  194. package/dist/{multivalue-4QKGYYW2.js → multivalue-QG3WZUHE.js} +3 -3
  195. package/dist/{oncomatrix-R32ZPMX7.js → oncomatrix-DHGG5WGO.js} +5 -5
  196. package/dist/{oncomatrix.spec-BMK6LMBS.js → oncomatrix.spec-73FNQLQH.js} +10 -10
  197. package/dist/{plot.2dvaf-46FT53MF.js → plot.2dvaf-D73MWO6O.js} +3 -3
  198. package/dist/{plot.app-7EE4YCV4.js → plot.app-ZB7S6F47.js} +5 -5
  199. package/dist/{plot.barplot-FK4J2G7K.js → plot.barplot-PDKH4DOC.js} +3 -3
  200. package/dist/{plot.boxplot-ATY4LK3X.js → plot.boxplot-G3Z5N5CR.js} +3 -3
  201. package/dist/{plot.brainImaging-S7B547V4.js → plot.brainImaging-PUNPNRWL.js} +2 -2
  202. package/dist/{plot.disco-K5MMC2GD.js → plot.disco-ZHPA5JUU.js} +2 -2
  203. package/dist/{plot.ssgq-B3OVMZFD.js → plot.ssgq-7AF35XL5.js} +4 -4
  204. package/dist/{plot.vaf2cov-RBHDQULW.js → plot.vaf2cov-AXUYZHCK.js} +3 -3
  205. package/dist/{polar2-GECELCTG.js → polar2-G6B2BVSV.js} +4 -4
  206. package/dist/{profileForms-2USYOA34.js → profileForms-3SO7GP7J.js} +4 -4
  207. package/dist/{profilePlot-YGD2CF6P.js → profilePlot-G2GOYAKK.js} +4 -4
  208. package/dist/{proteinView-FCPWJLGU.js → proteinView-AQGKZNKD.js} +5 -5
  209. package/dist/{proteomeCohortCompare-TYYUF5A5.js → proteomeCohortCompare-QBOSS7ND.js} +4 -4
  210. package/dist/{pseudbulk.unit.spec-UVVRP6NR.js → pseudbulk.unit.spec-X2MKMEJT.js} +4 -4
  211. package/dist/{pseudobulk-ZIN5VJGB.js → pseudobulk-TICKQN7I.js} +4 -4
  212. package/dist/{qualitative-27BZGASV.js → qualitative-J4FX3QBE.js} +3 -3
  213. package/dist/{qualitative-N4F6NITI.js → qualitative-YHQQT2DB.js} +3 -3
  214. package/dist/{radar2-X465RPJX.js → radar2-GXRNDJI2.js} +4 -4
  215. package/dist/{radarFacility2-AE7BA62N.js → radarFacility2-7RVTCX3Y.js} +4 -4
  216. package/dist/{render-TD2QWOHT.js → render-7KXWFGS4.js} +3 -3
  217. package/dist/{report-3Y2OWDF7.js → report-5CP3CFTF.js} +3 -3
  218. package/dist/{sampleView-BUMMYRHJ.js → sampleView-HBT7UPZG.js} +4 -4
  219. package/dist/{samplelst-BWK53BLI.js → samplelst-KCCHDGQM.js} +3 -3
  220. package/dist/{samplematrix-RQU43UYR.js → samplematrix-IQHKL3KO.js} +5 -5
  221. package/dist/{sc-LCBFWCZZ.js → sc-RJWUKNDH.js} +5 -5
  222. package/dist/{scatter-MJELX75N.js → scatter-LLH3KUOP.js} +7 -7
  223. package/dist/{scatter-6S5I7OW3.js → scatter-TJAKPWG3.js} +9 -9
  224. package/dist/{selectGenomeWithTklst-WAVXHXR5.js → selectGenomeWithTklst-OYII3JO3.js} +4 -4
  225. package/dist/{singleCellCellType-WMCAJ7JF.js → singleCellCellType-CSLRJYE5.js} +4 -4
  226. package/dist/{singleCellCellType.unit.spec-4Z46ZT5Q.js → singleCellCellType.unit.spec-D6D52VTF.js} +4 -4
  227. package/dist/{singleCellGeneExpression-7Q5ZJT4R.js → singleCellGeneExpression-KSX7FQYG.js} +4 -4
  228. package/dist/{singleCellGeneExpression.unit.spec-6C7PDGRH.js → singleCellGeneExpression.unit.spec-CT4GFFE4.js} +4 -4
  229. package/dist/{singleCellNumericValue-QGYITZRC.js → singleCellNumericValue-E4JUD5JH.js} +4 -4
  230. package/dist/{singleCellNumericValue.unit.spec-MQUKPEZJ.js → singleCellNumericValue.unit.spec-QVVK6VK5.js} +4 -4
  231. package/dist/{singleCellPlot-JJMFJ2KQ.js → singleCellPlot-7NM6ZZOE.js} +5 -5
  232. package/dist/{singlecell-J23S3JR2.js → singlecell-5B6WHEEN.js} +5 -5
  233. package/dist/{singlecell-Y4OGUWEC.js → singlecell-SIB4GIDJ.js} +5 -5
  234. package/dist/{snp-IO6TKWGD.js → snp-I4AI2C54.js} +4 -4
  235. package/dist/{snp.unit.spec-X7ILEEPO.js → snp.unit.spec-OIAKRV3Y.js} +4 -4
  236. package/dist/{snplocus-Z2NGIKMO.js → snplocus-LQ4WUFUM.js} +4 -4
  237. package/dist/{snplst-XCS2FCQV.js → snplst-QCH6JJ7S.js} +4 -4
  238. package/dist/{spliceevent.a53ss.diagram-F3S4BRVG.js → spliceevent.a53ss.diagram-MZE3NFGH.js} +3 -3
  239. package/dist/{spliceevent.exonskip.diagram-AXCDJKH4.js → spliceevent.exonskip.diagram-H6AJBIRM.js} +4 -4
  240. package/dist/{spliceevent.noeventdiagram-UK3X667E.js → spliceevent.noeventdiagram-4MCGAKBV.js} +3 -3
  241. package/dist/{ssGSEA-ZRPNQKJ5.js → ssGSEA-YLFT44QJ.js} +4 -4
  242. package/dist/{ssGSEA.unit.spec-DG5ZHLC7.js → ssGSEA.unit.spec-MLGJSQHA.js} +4 -4
  243. package/dist/{stattable-XYSC3CYU.js → stattable-GOSYPYXB.js} +3 -3
  244. package/dist/{studyCatalog-Y75LMI62.js → studyCatalog-UHS2SVRZ.js} +4 -4
  245. package/dist/{summarizeCnvGeneexp-H2NP7VLU.js → summarizeCnvGeneexp-HTEBFQCB.js} +4 -4
  246. package/dist/{summarizeGeneexpSurvival-HTCD3VQQ.js → summarizeGeneexpSurvival-PUL5VWCR.js} +4 -4
  247. package/dist/{summarizeMutationCnv-UEGXWK2P.js → summarizeMutationCnv-PCAEMP2I.js} +4 -4
  248. package/dist/{summarizeMutationDiagnosis-MJGWP7IT.js → summarizeMutationDiagnosis-MJKM5AN7.js} +4 -4
  249. package/dist/{summarizeMutationSurvival-55JW5LA6.js → summarizeMutationSurvival-CWZRGANA.js} +4 -4
  250. package/dist/{summary-HJO23RGB.js → summary-EI5POFSK.js} +4 -4
  251. package/dist/{summary.integration.spec-OWI2C2N5.js → summary.integration.spec-2T4M4BML.js} +10 -10
  252. package/dist/{summaryInput-RL2JXRDE.js → summaryInput-6GZULFH4.js} +3 -3
  253. package/dist/{sunburst-JFY6V5E2.js → sunburst-MBWKP6SE.js} +3 -3
  254. package/dist/{survival-6FLR4YCJ.js → survival-LDTOT7QH.js} +3 -3
  255. package/dist/{survival-PBBU6PA5.js → survival-VWRXWUTC.js} +3 -3
  256. package/dist/{survival.integration.spec-WAKTGYGP.js → survival.integration.spec-NVMZ2ZHQ.js} +10 -10
  257. package/dist/{svgraph-WD3DUZV7.js → svgraph-VJ3Z2KQB.js} +3 -3
  258. package/dist/{svmr-AP6ZFO7S.js → svmr-ELLP542F.js} +6 -6
  259. package/dist/{swimmer-VPKSBV6V.js → swimmer-X3ZUO3OJ.js} +4 -4
  260. package/dist/{table-GX3VJLPZ.js → table-QD3574HI.js} +3 -3
  261. package/dist/{termCollection-YQ332WKB.js → termCollection-2WAA3PYS.js} +5 -5
  262. package/dist/termCollection-C4Y7ZBAZ.js +29 -0
  263. package/dist/{termCollection.unit.spec-ELLN7VRA.js → termCollection.unit.spec-DVRZRBIX.js} +4 -4
  264. package/dist/{termCollectionFractionSelection-V3RP5KAT.js → termCollectionFractionSelection-CXS6PV6A.js} +3 -3
  265. package/dist/{termCollectionFractionSelection.unit.spec-JR7Q7TJI.js → termCollectionFractionSelection.unit.spec-P3ERZKKO.js} +3 -3
  266. package/dist/{tk-J5VPFEX6.js → tk-DVMIRU4Y.js} +6 -6
  267. package/dist/{tk-GD2KJM5W.js → tk-RQ5SODZH.js} +11 -11
  268. package/dist/{tp.ui-5K3AAXDW.js → tp.ui-AATHAQNO.js} +11 -11
  269. package/dist/{tvs.categorical-RPACB4VU.js → tvs.categorical-WMN357DD.js} +3 -3
  270. package/dist/{tvs.condition-O6JBUM6D.js → tvs.condition-5AZKVWQ5.js} +3 -3
  271. package/dist/{tvs.dt-5EVBSRX3.js → tvs.dt-ND63FJSI.js} +3 -3
  272. package/dist/{tvs.dtcnv.categorical-Y5YHBZNC.js → tvs.dtcnv.categorical-ID6ZHVUX.js} +3 -3
  273. package/dist/{tvs.dtcnv.continuous-WP322QUP.js → tvs.dtcnv.continuous-K44QAHRU.js} +3 -3
  274. package/dist/{tvs.dtfusion-CCMUFDMQ.js → tvs.dtfusion-T3WIRHYK.js} +3 -3
  275. package/dist/{tvs.dtitd-P3ED3MWA.js → tvs.dtitd-W2SI4P2S.js} +3 -3
  276. package/dist/{tvs.dtsnvindel-X2MXPLC6.js → tvs.dtsnvindel-QZC2OKZN.js} +3 -3
  277. package/dist/{tvs.dtsv-4FOWFNVV.js → tvs.dtsv-QCQXPL6B.js} +3 -3
  278. package/dist/{tvs.multivalue-IRF467ZK.js → tvs.multivalue-CG4JFPFT.js} +3 -3
  279. package/dist/{tvs.numeric-C7FDCGCS.js → tvs.numeric-2NCCCV24.js} +4 -4
  280. package/dist/{tvs.samplelst-CBU6ATI5.js → tvs.samplelst-52RTEKIR.js} +3 -3
  281. package/dist/{tvs.survival-3K5ASAXV.js → tvs.survival-UO47FDTY.js} +3 -3
  282. package/dist/{tvs.termCollection-MXEWO6KJ.js → tvs.termCollection-JJECMQIS.js} +4 -4
  283. package/dist/{vocabulary-GQBHDP3K.js → vocabulary-QYEY72KK.js} +3 -3
  284. package/dist/{wsi.direct-25JUHWEF.js → wsi.direct-K2OBDXDS.js} +4775 -1600
  285. package/dist/wsi.direct-K2OBDXDS.js.map +7 -0
  286. package/package.json +2 -2
  287. package/dist/Wsi-G7OCAJ3R.js.map +0 -7
  288. package/dist/chunk-HWNQOADC.js +0 -182
  289. package/dist/chunk-MBQIHLGI.js.map +0 -7
  290. package/dist/importPlot-3CG6ASNH.js +0 -8
  291. package/dist/termCollection-QE7U5QBD.js +0 -29
  292. package/dist/wsi.direct-25JUHWEF.js.map +0 -7
  293. /package/dist/{2dmaf-RRHATFHO.js.map → 2dmaf-CIL2ONNM.js.map} +0 -0
  294. /package/dist/{AggMatrixInput-4UHBCXYH.js.map → AggMatrixInput-NHIZKOEJ.js.map} +0 -0
  295. /package/dist/{AggregateMatrix-IJE5CM5Y.js.map → AggregateMatrix-XSH3ABE3.js.map} +0 -0
  296. /package/dist/{AppHeader-UXGLRW6C.js.map → AppHeader-5BJHFV6B.js.map} +0 -0
  297. /package/dist/{BoxPlot-GQYC22KY.js.map → BoxPlot-CQTWWP3V.js.map} +0 -0
  298. /package/dist/{CorrelationVolcano-5CWRWZTI.js.map → CorrelationVolcano-5NCISX65.js.map} +0 -0
  299. /package/dist/{Cuminc-TYHKAPRK.js.map → Cuminc-BLT2JPSD.js.map} +0 -0
  300. /package/dist/{DE-UUFQGSOI.js.map → DE-ZP46TCQ7.js.map} +0 -0
  301. /package/dist/{DEinput-DU7MF4YY.js.map → DEinput-STU4BW5M.js.map} +0 -0
  302. /package/dist/{DM-SSI5KUBC.js.map → DM-SUKRUDAG.js.map} +0 -0
  303. /package/dist/{DifferentialAnalysis-G6FE2MXY.js.map → DifferentialAnalysis-NLYX5JSB.js.map} +0 -0
  304. /package/dist/{Disco-B3KGNEAW.js.map → Disco-IVV6MP6F.js.map} +0 -0
  305. /package/dist/{Disco.UI-UNPUBQCN.js.map → Disco.UI-XEGN5DQR.js.map} +0 -0
  306. /package/dist/{DmrPlot-27NGDMT4.js.map → DmrPlot-FS5HEDFS.js.map} +0 -0
  307. /package/dist/{GB-SXACUA4V.js.map → GB-TOVICNRX.js.map} +0 -0
  308. /package/dist/{GSEA-EHMBA3TF.js.map → GSEA-7OFDPLDK.js.map} +0 -0
  309. /package/dist/{GeneExpInput-NDXISF2U.js.map → GeneExpInput-GOT2JAHD.js.map} +0 -0
  310. /package/dist/{Geomap-3CNT227W.js.map → Geomap-YEF6A4LT.js.map} +0 -0
  311. /package/dist/{HicApp-VQBUB6EZ.js.map → HicApp-IN6LCUZH.js.map} +0 -0
  312. /package/dist/{IDCViewer-DTOE7KDX.js.map → IDCViewer-QFJH22IE.js.map} +0 -0
  313. /package/dist/{NumBinaryEditor-IVZ4MMQT.js.map → NumBinaryEditor-GT3Z5JQD.js.map} +0 -0
  314. /package/dist/{NumBinaryEditor.unit.spec-3BSQ6FM4.js.map → NumBinaryEditor.unit.spec-RCCNWZ6J.js.map} +0 -0
  315. /package/dist/{NumContEditor-CUZHU3IO.js.map → NumContEditor-WLJ4Z3RC.js.map} +0 -0
  316. /package/dist/{NumContEditor.unit.spec-SCQFD2Y7.js.map → NumContEditor.unit.spec-G2OURVAV.js.map} +0 -0
  317. /package/dist/{NumCustomBinEditor-UEEYZ4ZO.js.map → NumCustomBinEditor-LSMCZSV3.js.map} +0 -0
  318. /package/dist/{NumCustomBinEditor.unit.spec-GYS35OQV.js.map → NumCustomBinEditor.unit.spec-ZAKGVYD5.js.map} +0 -0
  319. /package/dist/{NumDiscreteEditor-IT7NIXTV.js.map → NumDiscreteEditor-GRBCPKDX.js.map} +0 -0
  320. /package/dist/{NumDiscreteEditor.unit.spec-LB6VLAWO.js.map → NumDiscreteEditor.unit.spec-GUHC6TMF.js.map} +0 -0
  321. /package/dist/{NumRegularBinEditor-FF6UXZWN.js.map → NumRegularBinEditor-DEVTUDUK.js.map} +0 -0
  322. /package/dist/{NumRegularBinEditor.unit.spec-Z4S5LH2C.js.map → NumRegularBinEditor.unit.spec-4A65XLAU.js.map} +0 -0
  323. /package/dist/{NumSplineEditor-IW5WEN3P.js.map → NumSplineEditor-DQJB74LS.js.map} +0 -0
  324. /package/dist/{NumSplineEditor.unit.spec-PAEN3SAD.js.map → NumSplineEditor.unit.spec-GSJBAV5V.js.map} +0 -0
  325. /package/dist/{NumericDensity-CPJIQLYT.js.map → NumericDensity-U2NFSYMA.js.map} +0 -0
  326. /package/dist/{NumericDensity.unit.spec-4KHECHVU.js.map → NumericDensity.unit.spec-OKC4ZXKE.js.map} +0 -0
  327. /package/dist/{NumericHandler-SEFTQJDM.js.map → NumericHandler-4IREXDIN.js.map} +0 -0
  328. /package/dist/{NumericHandler.unit.spec-UGDR3476.js.map → NumericHandler.unit.spec-M44XE7VM.js.map} +0 -0
  329. /package/dist/{ProteomeInput-NYPUYVN5.js.map → ProteomeInput-W3ZFJMN3.js.map} +0 -0
  330. /package/dist/{Regression-WDSISHYL.js.map → Regression-V6UEVWJ2.js.map} +0 -0
  331. /package/dist/{RunChart2-2NPADXUR.js.map → RunChart2-4QXD44SZ.js.map} +0 -0
  332. /package/dist/{SC-EWDBPHEL.js.map → SC-G2TTCPHB.js.map} +0 -0
  333. /package/dist/{Violin-POGGPCZY.js.map → Violin-ICLO3WIA.js.map} +0 -0
  334. /package/dist/{Volcano-U2B4KEUL.js.map → Volcano-RLSRLDGE.js.map} +0 -0
  335. /package/dist/{adSandbox-SUCX6DAQ.js.map → adSandbox-LK6SIWRU.js.map} +0 -0
  336. /package/dist/{animatedBubbleChart-SDBWJELZ.js.map → animatedBubbleChart-CPKZ5IAQ.js.map} +0 -0
  337. /package/dist/{app-ATQM5PKI.js.map → app-63JVVY2P.js.map} +0 -0
  338. /package/dist/{app-BCKEWJCY.js.map → app-KDNMMF4V.js.map} +0 -0
  339. /package/dist/{bam-QK2ZLZDI.js.map → bam-ZGG3CZ3F.js.map} +0 -0
  340. /package/dist/{barchart-RHDKI3NZ.js.map → barchart-LT22NFGV.js.map} +0 -0
  341. /package/dist/{barchart2-CS3E6FOY.js.map → barchart2-PFJY6UDX.js.map} +0 -0
  342. /package/dist/{block-RQ3HTJVP.js.map → block-3BDXSRE2.js.map} +0 -0
  343. /package/dist/{block.init-T33F47DO.js.map → block.init-P4EZMHDW.js.map} +0 -0
  344. /package/dist/{block.mds.expressionrank-LQD6MN6Z.js.map → block.mds.expressionrank-D6NXBJVQ.js.map} +0 -0
  345. /package/dist/{block.mds.geneboxplot-N5XHHVR7.js.map → block.mds.geneboxplot-5BCO3XTU.js.map} +0 -0
  346. /package/dist/{block.mds.junction-JD4WQUSH.js.map → block.mds.junction-UAZFDKDC.js.map} +0 -0
  347. /package/dist/{block.mds.svcnv-LCTYWXL2.js.map → block.mds.svcnv-4E25YHMY.js.map} +0 -0
  348. /package/dist/{block.svg-2F3RGTI3.js.map → block.svg-DV36CFYT.js.map} +0 -0
  349. /package/dist/{block.tk.aicheck-BOF6WZ5E.js.map → block.tk.aicheck-4FARAYJA.js.map} +0 -0
  350. /package/dist/{block.tk.bam-5GBYEQBM.js.map → block.tk.bam-SXZ5UIYA.js.map} +0 -0
  351. /package/dist/{block.tk.bedgraphdot-LVQEP4RS.js.map → block.tk.bedgraphdot-6GLI6JC7.js.map} +0 -0
  352. /package/dist/{block.tk.bigwig.ui-HHBO4JAC.js.map → block.tk.bigwig.ui-6HO44Y4S.js.map} +0 -0
  353. /package/dist/{block.tk.hicstraw-JBO4UEOA.js.map → block.tk.hicstraw-C2MDLNFC.js.map} +0 -0
  354. /package/dist/{block.tk.junction-S5S2N7FK.js.map → block.tk.junction-KQVG3KPX.js.map} +0 -0
  355. /package/dist/{block.tk.junction.textmatrixui-DNQL7WB5.js.map → block.tk.junction.textmatrixui-AATONHSH.js.map} +0 -0
  356. /package/dist/{block.tk.ld-JHQNR67E.js.map → block.tk.ld-GT2L3Q7W.js.map} +0 -0
  357. /package/dist/{block.tk.menu-7JBJOY2O.js.map → block.tk.menu-KPCUW44Y.js.map} +0 -0
  358. /package/dist/{block.tk.pgv-FQPREV6P.js.map → block.tk.pgv-CEI6DROP.js.map} +0 -0
  359. /package/dist/{brainImaging-HEWGZZNY.js.map → brainImaging-3HD2D2DU.js.map} +0 -0
  360. /package/dist/{brainRegions-QUGB7YUW.js.map → brainRegions-PQYGC2VX.js.map} +0 -0
  361. /package/dist/{bubbleHeatmap-OZRONGAX.js.map → bubbleHeatmap-UFBJZIEX.js.map} +0 -0
  362. /package/dist/{cellTypeBubbleHeatmap-N7NDE325.js.map → cellTypeBubbleHeatmap-MPZGYZNN.js.map} +0 -0
  363. /package/dist/{chunk-FVZTRWAO.js.map → chunk-3744MZJC.js.map} +0 -0
  364. /package/dist/{chunk-NPBN3PPZ.js.map → chunk-3E3CBNKZ.js.map} +0 -0
  365. /package/dist/{chunk-MU4Z2MX2.js.map → chunk-3RM7V7BR.js.map} +0 -0
  366. /package/dist/{chunk-F5FFI7Z7.js.map → chunk-4JLKTIP4.js.map} +0 -0
  367. /package/dist/{chunk-B3WLXXGY.js.map → chunk-4MOTOAOU.js.map} +0 -0
  368. /package/dist/{chunk-CTFHEDG2.js.map → chunk-4TWRPEGD.js.map} +0 -0
  369. /package/dist/{chunk-KGX2OIR4.js.map → chunk-5C3FZM54.js.map} +0 -0
  370. /package/dist/{chunk-6D4HOTG7.js.map → chunk-5CAZX356.js.map} +0 -0
  371. /package/dist/{chunk-AV2IH5K2.js.map → chunk-5FIEOWA7.js.map} +0 -0
  372. /package/dist/{chunk-ABLG7GUS.js.map → chunk-5T2UWGI6.js.map} +0 -0
  373. /package/dist/{chunk-L2NPLA43.js.map → chunk-65UPR2AG.js.map} +0 -0
  374. /package/dist/{chunk-EDFBRXX2.js.map → chunk-ACVTLIAU.js.map} +0 -0
  375. /package/dist/{chunk-F2EEQ7KG.js.map → chunk-BI3X5K2H.js.map} +0 -0
  376. /package/dist/{chunk-2JIKMCJR.js.map → chunk-CZN4JCYE.js.map} +0 -0
  377. /package/dist/{chunk-D35GNF3Y.js.map → chunk-FPB4EOWN.js.map} +0 -0
  378. /package/dist/{chunk-NULQJF73.js.map → chunk-G7OSIYTA.js.map} +0 -0
  379. /package/dist/{chunk-GSVB4XNS.js.map → chunk-H2Y4IUBO.js.map} +0 -0
  380. /package/dist/{chunk-CZK4EV3Y.js.map → chunk-H4KG6SQP.js.map} +0 -0
  381. /package/dist/{chunk-HWNQOADC.js.map → chunk-I4LVKOHE.js.map} +0 -0
  382. /package/dist/{chunk-5G6O5RYM.js.map → chunk-ICA3GVKW.js.map} +0 -0
  383. /package/dist/{chunk-XXFLJWTQ.js.map → chunk-IFIUHU72.js.map} +0 -0
  384. /package/dist/{chunk-7JHIUS54.js.map → chunk-IYLGC4WF.js.map} +0 -0
  385. /package/dist/{chunk-SUT75MRI.js.map → chunk-JLDBGKA5.js.map} +0 -0
  386. /package/dist/{chunk-NNDKYTUV.js.map → chunk-K74TUVYA.js.map} +0 -0
  387. /package/dist/{chunk-C2TII2FF.js.map → chunk-KK6CIJLF.js.map} +0 -0
  388. /package/dist/{chunk-FK5NL2DF.js.map → chunk-KZHRRLJQ.js.map} +0 -0
  389. /package/dist/{chunk-DX23HAW7.js.map → chunk-LZEQYV3V.js.map} +0 -0
  390. /package/dist/{chunk-LQKMDIRB.js.map → chunk-M77SRLIA.js.map} +0 -0
  391. /package/dist/{chunk-HFKZGMVV.js.map → chunk-MEG6TPXF.js.map} +0 -0
  392. /package/dist/{chunk-QYCPIVCX.js.map → chunk-MJANYPJN.js.map} +0 -0
  393. /package/dist/{chunk-V4ZKHM6D.js.map → chunk-MLW6KEI7.js.map} +0 -0
  394. /package/dist/{chunk-65DO5IKM.js.map → chunk-N56BEWRA.js.map} +0 -0
  395. /package/dist/{chunk-6Q5SOSSU.js.map → chunk-NKDW4MRL.js.map} +0 -0
  396. /package/dist/{chunk-X77QVINS.js.map → chunk-NUEYFEVP.js.map} +0 -0
  397. /package/dist/{chunk-AIC43DTG.js.map → chunk-OOEXVYSJ.js.map} +0 -0
  398. /package/dist/{chunk-OBNHXAYG.js.map → chunk-OOSMSVWQ.js.map} +0 -0
  399. /package/dist/{chunk-X2HWRISK.js.map → chunk-OXNBEVNJ.js.map} +0 -0
  400. /package/dist/{chunk-V7DNHPZD.js.map → chunk-PGQQ7SGL.js.map} +0 -0
  401. /package/dist/{chunk-NYO7YANQ.js.map → chunk-QNSESUCC.js.map} +0 -0
  402. /package/dist/{chunk-TPSVPMAN.js.map → chunk-QOMGX4EF.js.map} +0 -0
  403. /package/dist/{chunk-BU6PAOGA.js.map → chunk-R6C5F7XI.js.map} +0 -0
  404. /package/dist/{chunk-MFR4WWDM.js.map → chunk-RRKGUOVG.js.map} +0 -0
  405. /package/dist/{chunk-PETYR7LC.js.map → chunk-U5EZ5JEB.js.map} +0 -0
  406. /package/dist/{chunk-J5KCTRJC.js.map → chunk-UXR6JRJE.js.map} +0 -0
  407. /package/dist/{chunk-PQVHRM4L.js.map → chunk-VDBNJUAY.js.map} +0 -0
  408. /package/dist/{chunk-WU3YXPRE.js.map → chunk-VLNB4EVT.js.map} +0 -0
  409. /package/dist/{chunk-SYLYLOHK.js.map → chunk-VWUZT2TX.js.map} +0 -0
  410. /package/dist/{chunk-3SPEW6R6.js.map → chunk-WDO4GOLT.js.map} +0 -0
  411. /package/dist/{chunk-2FWSNJEN.js.map → chunk-WTFURQK2.js.map} +0 -0
  412. /package/dist/{chunk-RZ2THVK4.js.map → chunk-XOCGDNLB.js.map} +0 -0
  413. /package/dist/{chunk-TEFWF3SK.js.map → chunk-YHX7HJS6.js.map} +0 -0
  414. /package/dist/{chunk-QLUTQPZE.js.map → chunk-YKZXJUQD.js.map} +0 -0
  415. /package/dist/{chunk-AJXP4AV7.js.map → chunk-YWS2FZOD.js.map} +0 -0
  416. /package/dist/{chunk-GVAV4VRI.js.map → chunk-ZN4W6WU4.js.map} +0 -0
  417. /package/dist/{chunk-BG6GAROI.js.map → chunk-ZORGD72P.js.map} +0 -0
  418. /package/dist/{chunk-E7XHA4YL.js.map → chunk-ZUZ46DIU.js.map} +0 -0
  419. /package/dist/{cohort-ATIZW34H.js.map → cohort-USQUJH65.js.map} +0 -0
  420. /package/dist/{cohortSunburst-WQK2UV25.js.map → cohortSunburst-VRSXHLMP.js.map} +0 -0
  421. /package/dist/{condition-SGJIDZNB.js.map → condition-UKODOO7B.js.map} +0 -0
  422. /package/dist/{controls-JQCMGPXP.js.map → controls-CQMY7DFR.js.map} +0 -0
  423. /package/dist/{controls.config-WQHVQAIJ.js.map → controls.config-CQUF4FG7.js.map} +0 -0
  424. /package/dist/{correlation-S3MN3L5Q.js.map → correlation-CGCAX4MY.js.map} +0 -0
  425. /package/dist/{customdata.inputui-LGTGMJBZ.js.map → customdata.inputui-HAMDCSHR.js.map} +0 -0
  426. /package/dist/{dataDownload-FAWN2WKE.js.map → dataDownload-UN253EGZ.js.map} +0 -0
  427. /package/dist/{databrowser.ui-KF3LWQXG.js.map → databrowser.ui-5P6PDW37.js.map} +0 -0
  428. /package/dist/{dictionary-EVLEOT72.js.map → dictionary-WVFDMSQK.js.map} +0 -0
  429. /package/dist/{dnaMethylation-J3SPEM4S.js.map → dnaMethylation-4QDYABEF.js.map} +0 -0
  430. /package/dist/{dnaMethylation.integration.spec-CTA53YCT.js.map → dnaMethylation.integration.spec-KHEO5VBH.js.map} +0 -0
  431. /package/dist/{e2pca-PTWPY5WP.js.map → e2pca-72JWCRI4.js.map} +0 -0
  432. /package/dist/{ep-MS4LQQDR.js.map → ep-XWLO4IMJ.js.map} +0 -0
  433. /package/dist/{expclust.gdc.spec-S5FE4MMD.js.map → expclust.gdc.spec-EJZTXHTU.js.map} +0 -0
  434. /package/dist/{facet-FSOIZJCA.js.map → facet-BWJ5655K.js.map} +0 -0
  435. /package/dist/{gb-YDEOK7NW.js.map → gb-Z2QTJNBU.js.map} +0 -0
  436. /package/dist/{geneExpClustering-37JKKFW3.js.map → geneExpClustering-N3Q64QDC.js.map} +0 -0
  437. /package/dist/{geneExpression-G6ODP3VY.js.map → geneExpression-YIKPVBTJ.js.map} +0 -0
  438. /package/dist/{geneExpression.unit.spec-ZHXCUG6Q.js.map → geneExpression.unit.spec-OUBUIYUZ.js.map} +0 -0
  439. /package/dist/{geneORA-E3PSS3CI.js.map → geneORA-URZOQAQX.js.map} +0 -0
  440. /package/dist/{geneRanking-MK3YYINC.js.map → geneRanking-M4L77YCZ.js.map} +0 -0
  441. /package/dist/{geneVariant-NNSB7JLS.js.map → geneVariant-PJZU6VDA.js.map} +0 -0
  442. /package/dist/{geneVariant-LEMAVFOY.js.map → geneVariant-ZL672DRD.js.map} +0 -0
  443. /package/dist/{geneVariant.integration.spec-6CC5UAOP.js.map → geneVariant.integration.spec-TRNFCKAB.js.map} +0 -0
  444. /package/dist/{genefusion.ui-5NCQIQPN.js.map → genefusion.ui-P7TTTF46.js.map} +0 -0
  445. /package/dist/{geneset-ZX4V3CFB.js.map → geneset-FVANVOWM.js.map} +0 -0
  446. /package/dist/{genomeBrowser.spec-J7ISXY6H.js.map → genomeBrowser.spec-GK6AD4MO.js.map} +0 -0
  447. /package/dist/{grin2-LBGBBB4L.js.map → grin2-R7IKKWQM.js.map} +0 -0
  448. /package/dist/{grin2-GN3DQNON.js.map → grin2-YTGF2J53.js.map} +0 -0
  449. /package/dist/{hierCluster-5JURTKAZ.js.map → hierCluster-3CRQK7IC.js.map} +0 -0
  450. /package/dist/{hierCluster-BJ5VBPXR.js.map → hierCluster-TU3QQL25.js.map} +0 -0
  451. /package/dist/{hierCluster.config-4EERP4KK.js.map → hierCluster.config-PAGYMNCO.js.map} +0 -0
  452. /package/dist/{hierCluster.integration.spec-VR4GULRV.js.map → hierCluster.integration.spec-G3IDXWFJ.js.map} +0 -0
  453. /package/dist/{hierCluster.interactivity-SMTQOKUY.js.map → hierCluster.interactivity-OLEOCVNC.js.map} +0 -0
  454. /package/dist/{imagePlot-4LMIKBVE.js.map → imagePlot-MNAZHIII.js.map} +0 -0
  455. /package/dist/{importPlot-3CG6ASNH.js.map → importPlot-53M5BVST.js.map} +0 -0
  456. /package/dist/{isoformExpression-VCDNKTZ6.js.map → isoformExpression-C2IFFMAB.js.map} +0 -0
  457. /package/dist/{isoformExpression.unit.spec-ZXYY37TA.js.map → isoformExpression.unit.spec-43QIRLHF.js.map} +0 -0
  458. /package/dist/{junction-5DXJO4PS.js.map → junction-DUFUB3E5.js.map} +0 -0
  459. /package/dist/{junction.unit.spec-F35E3GJW.js.map → junction.unit.spec-TYRPWIHC.js.map} +0 -0
  460. /package/dist/{launch.adhoc-V2HTCQGD.js.map → launch.adhoc-AOGLYLUB.js.map} +0 -0
  461. /package/dist/{leftlabel.sample-V7O2EC36.js.map → leftlabel.sample-4FTZWEFI.js.map} +0 -0
  462. /package/dist/{lollipop-RNRZLG64.js.map → lollipop-YVVIWUN6.js.map} +0 -0
  463. /package/dist/{maf-W6SF6BJS.js.map → maf-PLSOTYRZ.js.map} +0 -0
  464. /package/dist/{maftimeline-NABCAMHG.js.map → maftimeline-LPMMCZUU.js.map} +0 -0
  465. /package/dist/{matrix-JC6AJT2N.js.map → matrix-SKJLMCLM.js.map} +0 -0
  466. /package/dist/{matrix-UCHESWVK.js.map → matrix-SYWFJGCI.js.map} +0 -0
  467. /package/dist/{matrix.config-6US3AAH7.js.map → matrix.config-ZTKVUQ4O.js.map} +0 -0
  468. /package/dist/{matrix.integration.spec-KXX7SFX5.js.map → matrix.integration.spec-F5HC2EBF.js.map} +0 -0
  469. /package/dist/{matrix.interactivity-NHWG4WCC.js.map → matrix.interactivity-5IXEUY7Y.js.map} +0 -0
  470. /package/dist/{matrix.layout-5DQNT7DD.js.map → matrix.layout-AH7DOPFS.js.map} +0 -0
  471. /package/dist/{matrix.renderers-GYOXGHPU.js.map → matrix.renderers-3VGVCAGO.js.map} +0 -0
  472. /package/dist/{matrix.sort.unit.spec-S6BAFYPR.js.map → matrix.sort.unit.spec-GTZ3BJYB.js.map} +0 -0
  473. /package/dist/{matrix.sorterUi.unit.spec-V5NVQGD5.js.map → matrix.sorterUi.unit.spec-W545SQ2L.js.map} +0 -0
  474. /package/dist/{matrix.unit.spec-R4NMTZYQ.js.map → matrix.unit.spec-QFLMTDN3.js.map} +0 -0
  475. /package/dist/{mavb-MRCVMBPD.js.map → mavb-7NZXBVY7.js.map} +0 -0
  476. /package/dist/{mds.fimo-5DCH5BEM.js.map → mds.fimo-VDI352JM.js.map} +0 -0
  477. /package/dist/{mds.samplescatterplot-VIBCS5M6.js.map → mds.samplescatterplot-DA6VJG2H.js.map} +0 -0
  478. /package/dist/{mds.survivalplot-AZ7LJDZZ.js.map → mds.survivalplot-ZZ3ASQSJ.js.map} +0 -0
  479. /package/dist/{multivalue-4QKGYYW2.js.map → multivalue-QG3WZUHE.js.map} +0 -0
  480. /package/dist/{oncomatrix-R32ZPMX7.js.map → oncomatrix-DHGG5WGO.js.map} +0 -0
  481. /package/dist/{oncomatrix.spec-BMK6LMBS.js.map → oncomatrix.spec-73FNQLQH.js.map} +0 -0
  482. /package/dist/{plot.2dvaf-46FT53MF.js.map → plot.2dvaf-D73MWO6O.js.map} +0 -0
  483. /package/dist/{plot.app-7EE4YCV4.js.map → plot.app-ZB7S6F47.js.map} +0 -0
  484. /package/dist/{plot.barplot-FK4J2G7K.js.map → plot.barplot-PDKH4DOC.js.map} +0 -0
  485. /package/dist/{plot.boxplot-ATY4LK3X.js.map → plot.boxplot-G3Z5N5CR.js.map} +0 -0
  486. /package/dist/{plot.brainImaging-S7B547V4.js.map → plot.brainImaging-PUNPNRWL.js.map} +0 -0
  487. /package/dist/{plot.disco-K5MMC2GD.js.map → plot.disco-ZHPA5JUU.js.map} +0 -0
  488. /package/dist/{plot.ssgq-B3OVMZFD.js.map → plot.ssgq-7AF35XL5.js.map} +0 -0
  489. /package/dist/{plot.vaf2cov-RBHDQULW.js.map → plot.vaf2cov-AXUYZHCK.js.map} +0 -0
  490. /package/dist/{polar2-GECELCTG.js.map → polar2-G6B2BVSV.js.map} +0 -0
  491. /package/dist/{profileForms-2USYOA34.js.map → profileForms-3SO7GP7J.js.map} +0 -0
  492. /package/dist/{profilePlot-YGD2CF6P.js.map → profilePlot-G2GOYAKK.js.map} +0 -0
  493. /package/dist/{proteinView-FCPWJLGU.js.map → proteinView-AQGKZNKD.js.map} +0 -0
  494. /package/dist/{proteomeCohortCompare-TYYUF5A5.js.map → proteomeCohortCompare-QBOSS7ND.js.map} +0 -0
  495. /package/dist/{pseudbulk.unit.spec-UVVRP6NR.js.map → pseudbulk.unit.spec-X2MKMEJT.js.map} +0 -0
  496. /package/dist/{pseudobulk-ZIN5VJGB.js.map → pseudobulk-TICKQN7I.js.map} +0 -0
  497. /package/dist/{qualitative-27BZGASV.js.map → qualitative-J4FX3QBE.js.map} +0 -0
  498. /package/dist/{qualitative-N4F6NITI.js.map → qualitative-YHQQT2DB.js.map} +0 -0
  499. /package/dist/{radar2-X465RPJX.js.map → radar2-GXRNDJI2.js.map} +0 -0
  500. /package/dist/{radarFacility2-AE7BA62N.js.map → radarFacility2-7RVTCX3Y.js.map} +0 -0
  501. /package/dist/{render-TD2QWOHT.js.map → render-7KXWFGS4.js.map} +0 -0
  502. /package/dist/{report-3Y2OWDF7.js.map → report-5CP3CFTF.js.map} +0 -0
  503. /package/dist/{sampleView-BUMMYRHJ.js.map → sampleView-HBT7UPZG.js.map} +0 -0
  504. /package/dist/{samplelst-BWK53BLI.js.map → samplelst-KCCHDGQM.js.map} +0 -0
  505. /package/dist/{samplematrix-RQU43UYR.js.map → samplematrix-IQHKL3KO.js.map} +0 -0
  506. /package/dist/{sc-LCBFWCZZ.js.map → sc-RJWUKNDH.js.map} +0 -0
  507. /package/dist/{scatter-MJELX75N.js.map → scatter-LLH3KUOP.js.map} +0 -0
  508. /package/dist/{scatter-6S5I7OW3.js.map → scatter-TJAKPWG3.js.map} +0 -0
  509. /package/dist/{selectGenomeWithTklst-WAVXHXR5.js.map → selectGenomeWithTklst-OYII3JO3.js.map} +0 -0
  510. /package/dist/{singleCellCellType-WMCAJ7JF.js.map → singleCellCellType-CSLRJYE5.js.map} +0 -0
  511. /package/dist/{singleCellCellType.unit.spec-4Z46ZT5Q.js.map → singleCellCellType.unit.spec-D6D52VTF.js.map} +0 -0
  512. /package/dist/{singleCellGeneExpression-7Q5ZJT4R.js.map → singleCellGeneExpression-KSX7FQYG.js.map} +0 -0
  513. /package/dist/{singleCellGeneExpression.unit.spec-6C7PDGRH.js.map → singleCellGeneExpression.unit.spec-CT4GFFE4.js.map} +0 -0
  514. /package/dist/{singleCellNumericValue-QGYITZRC.js.map → singleCellNumericValue-E4JUD5JH.js.map} +0 -0
  515. /package/dist/{singleCellNumericValue.unit.spec-MQUKPEZJ.js.map → singleCellNumericValue.unit.spec-QVVK6VK5.js.map} +0 -0
  516. /package/dist/{singleCellPlot-JJMFJ2KQ.js.map → singleCellPlot-7NM6ZZOE.js.map} +0 -0
  517. /package/dist/{singlecell-J23S3JR2.js.map → singlecell-5B6WHEEN.js.map} +0 -0
  518. /package/dist/{singlecell-Y4OGUWEC.js.map → singlecell-SIB4GIDJ.js.map} +0 -0
  519. /package/dist/{snp-IO6TKWGD.js.map → snp-I4AI2C54.js.map} +0 -0
  520. /package/dist/{snp.unit.spec-X7ILEEPO.js.map → snp.unit.spec-OIAKRV3Y.js.map} +0 -0
  521. /package/dist/{snplocus-Z2NGIKMO.js.map → snplocus-LQ4WUFUM.js.map} +0 -0
  522. /package/dist/{snplst-XCS2FCQV.js.map → snplst-QCH6JJ7S.js.map} +0 -0
  523. /package/dist/{spliceevent.a53ss.diagram-F3S4BRVG.js.map → spliceevent.a53ss.diagram-MZE3NFGH.js.map} +0 -0
  524. /package/dist/{spliceevent.exonskip.diagram-AXCDJKH4.js.map → spliceevent.exonskip.diagram-H6AJBIRM.js.map} +0 -0
  525. /package/dist/{spliceevent.noeventdiagram-UK3X667E.js.map → spliceevent.noeventdiagram-4MCGAKBV.js.map} +0 -0
  526. /package/dist/{ssGSEA-ZRPNQKJ5.js.map → ssGSEA-YLFT44QJ.js.map} +0 -0
  527. /package/dist/{ssGSEA.unit.spec-DG5ZHLC7.js.map → ssGSEA.unit.spec-MLGJSQHA.js.map} +0 -0
  528. /package/dist/{stattable-XYSC3CYU.js.map → stattable-GOSYPYXB.js.map} +0 -0
  529. /package/dist/{studyCatalog-Y75LMI62.js.map → studyCatalog-UHS2SVRZ.js.map} +0 -0
  530. /package/dist/{summarizeCnvGeneexp-H2NP7VLU.js.map → summarizeCnvGeneexp-HTEBFQCB.js.map} +0 -0
  531. /package/dist/{summarizeGeneexpSurvival-HTCD3VQQ.js.map → summarizeGeneexpSurvival-PUL5VWCR.js.map} +0 -0
  532. /package/dist/{summarizeMutationCnv-UEGXWK2P.js.map → summarizeMutationCnv-PCAEMP2I.js.map} +0 -0
  533. /package/dist/{summarizeMutationDiagnosis-MJGWP7IT.js.map → summarizeMutationDiagnosis-MJKM5AN7.js.map} +0 -0
  534. /package/dist/{summarizeMutationSurvival-55JW5LA6.js.map → summarizeMutationSurvival-CWZRGANA.js.map} +0 -0
  535. /package/dist/{summary-HJO23RGB.js.map → summary-EI5POFSK.js.map} +0 -0
  536. /package/dist/{summary.integration.spec-OWI2C2N5.js.map → summary.integration.spec-2T4M4BML.js.map} +0 -0
  537. /package/dist/{summaryInput-RL2JXRDE.js.map → summaryInput-6GZULFH4.js.map} +0 -0
  538. /package/dist/{sunburst-JFY6V5E2.js.map → sunburst-MBWKP6SE.js.map} +0 -0
  539. /package/dist/{survival-6FLR4YCJ.js.map → survival-LDTOT7QH.js.map} +0 -0
  540. /package/dist/{survival-PBBU6PA5.js.map → survival-VWRXWUTC.js.map} +0 -0
  541. /package/dist/{survival.integration.spec-WAKTGYGP.js.map → survival.integration.spec-NVMZ2ZHQ.js.map} +0 -0
  542. /package/dist/{svgraph-WD3DUZV7.js.map → svgraph-VJ3Z2KQB.js.map} +0 -0
  543. /package/dist/{svmr-AP6ZFO7S.js.map → svmr-ELLP542F.js.map} +0 -0
  544. /package/dist/{swimmer-VPKSBV6V.js.map → swimmer-X3ZUO3OJ.js.map} +0 -0
  545. /package/dist/{table-GX3VJLPZ.js.map → table-QD3574HI.js.map} +0 -0
  546. /package/dist/{termCollection-YQ332WKB.js.map → termCollection-2WAA3PYS.js.map} +0 -0
  547. /package/dist/{termCollection-QE7U5QBD.js.map → termCollection-C4Y7ZBAZ.js.map} +0 -0
  548. /package/dist/{termCollection.unit.spec-ELLN7VRA.js.map → termCollection.unit.spec-DVRZRBIX.js.map} +0 -0
  549. /package/dist/{termCollectionFractionSelection-V3RP5KAT.js.map → termCollectionFractionSelection-CXS6PV6A.js.map} +0 -0
  550. /package/dist/{termCollectionFractionSelection.unit.spec-JR7Q7TJI.js.map → termCollectionFractionSelection.unit.spec-P3ERZKKO.js.map} +0 -0
  551. /package/dist/{tk-J5VPFEX6.js.map → tk-DVMIRU4Y.js.map} +0 -0
  552. /package/dist/{tk-GD2KJM5W.js.map → tk-RQ5SODZH.js.map} +0 -0
  553. /package/dist/{tp.ui-5K3AAXDW.js.map → tp.ui-AATHAQNO.js.map} +0 -0
  554. /package/dist/{tvs.categorical-RPACB4VU.js.map → tvs.categorical-WMN357DD.js.map} +0 -0
  555. /package/dist/{tvs.condition-O6JBUM6D.js.map → tvs.condition-5AZKVWQ5.js.map} +0 -0
  556. /package/dist/{tvs.dt-5EVBSRX3.js.map → tvs.dt-ND63FJSI.js.map} +0 -0
  557. /package/dist/{tvs.dtcnv.categorical-Y5YHBZNC.js.map → tvs.dtcnv.categorical-ID6ZHVUX.js.map} +0 -0
  558. /package/dist/{tvs.dtcnv.continuous-WP322QUP.js.map → tvs.dtcnv.continuous-K44QAHRU.js.map} +0 -0
  559. /package/dist/{tvs.dtfusion-CCMUFDMQ.js.map → tvs.dtfusion-T3WIRHYK.js.map} +0 -0
  560. /package/dist/{tvs.dtitd-P3ED3MWA.js.map → tvs.dtitd-W2SI4P2S.js.map} +0 -0
  561. /package/dist/{tvs.dtsnvindel-X2MXPLC6.js.map → tvs.dtsnvindel-QZC2OKZN.js.map} +0 -0
  562. /package/dist/{tvs.dtsv-4FOWFNVV.js.map → tvs.dtsv-QCQXPL6B.js.map} +0 -0
  563. /package/dist/{tvs.multivalue-IRF467ZK.js.map → tvs.multivalue-CG4JFPFT.js.map} +0 -0
  564. /package/dist/{tvs.numeric-C7FDCGCS.js.map → tvs.numeric-2NCCCV24.js.map} +0 -0
  565. /package/dist/{tvs.samplelst-CBU6ATI5.js.map → tvs.samplelst-52RTEKIR.js.map} +0 -0
  566. /package/dist/{tvs.survival-3K5ASAXV.js.map → tvs.survival-UO47FDTY.js.map} +0 -0
  567. /package/dist/{tvs.termCollection-MXEWO6KJ.js.map → tvs.termCollection-JJECMQIS.js.map} +0 -0
  568. /package/dist/{vocabulary-GQBHDP3K.js.map → vocabulary-QYEY72KK.js.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/ol/render/VectorContext.js", "../../node_modules/ol/render/canvas/Instruction.js", "../../node_modules/ol/render/canvas/Builder.js", "../../node_modules/ol/render/canvas/ImageBuilder.js", "../../node_modules/ol/render/canvas/LineStringBuilder.js", "../../node_modules/ol/render/canvas/PolygonBuilder.js", "../../node_modules/ol/geom/flat/linechunk.js", "../../node_modules/ol/geom/flat/straightchunk.js", "../../node_modules/ol/render/canvas/TextBuilder.js", "../../node_modules/ol/render/canvas/BuilderGroup.js", "../../node_modules/ol/geom/flat/length.js", "../../node_modules/ol/geom/flat/lineoffset.js", "../../node_modules/ol/geom/flat/textpath.js", "../../node_modules/ol/render/canvas/Executor.js", "../../node_modules/ol/render/canvas/ExecutorGroup.js", "../../node_modules/ol/render/canvas/Immediate.js", "../../node_modules/ol/render/canvas/hitdetect.js", "../../node_modules/ol/renderer/vector.js", "../../node_modules/ol/renderer/canvas/VectorLayer.js", "../../node_modules/ol/layer/Vector.js", "../../node_modules/ol/featureloader.js", "../../node_modules/ol/loadingstrategy.js", "../../node_modules/ol/Feature.js", "../../node_modules/ol/geom/flat/center.js", "../../node_modules/ol/geom/flat/interpolate.js", "../../node_modules/ol/geom/Circle.js", "../../node_modules/ol/geom/GeometryCollection.js", "../../node_modules/ol/geom/LineString.js", "../../node_modules/ol/geom/MultiLineString.js", "../../node_modules/ol/geom/MultiPoint.js", "../../node_modules/ol/geom/MultiPolygon.js", "../../node_modules/ol/render/Feature.js", "../../node_modules/ol/structs/RBush.js", "../../node_modules/ol/source/VectorEventType.js", "../../node_modules/ol/source/Vector.js", "../../node_modules/ol/interaction/tracing.js", "../../node_modules/ol/interaction/Draw.js", "../plots/w2/wsi.direct.ts"],
4
+ "sourcesContent": ["/**\n * @module ol/render/VectorContext\n */\n\n/**\n * @classdesc\n * Context for drawing geometries. A vector context is available on render\n * events and does not need to be constructed directly.\n * @api\n */\nclass VectorContext {\n /**\n * Render a geometry with a custom renderer.\n *\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {Function} renderer Renderer.\n * @param {Function} hitDetectionRenderer Renderer.\n * @param {number} [index] Render order index.\n */\n drawCustom(geometry, feature, renderer, hitDetectionRenderer, index) {}\n\n /**\n * Render a geometry.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry The geometry to render.\n */\n drawGeometry(geometry) {}\n\n /**\n * Set the rendering style.\n *\n * @param {import(\"../style/Style.js\").default} style The rendering style.\n */\n setStyle(style) {}\n\n /**\n * @param {import(\"../geom/Circle.js\").default} circleGeometry Circle geometry.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawCircle(circleGeometry, feature, index) {}\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} [index] Render order index.\n */\n drawFeature(feature, style, index) {}\n\n /**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometryCollectionGeometry Geometry collection.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawGeometryCollection(geometryCollectionGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/LineString.js\").default|import(\"./Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawLineString(lineStringGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiLineString.js\").default|import(\"./Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiLineString(multiLineStringGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiPoint.js\").default|import(\"./Feature.js\").default} multiPointGeometry MultiPoint geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiPoint(multiPointGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiPolygon.js\").default} multiPolygonGeometry MultiPolygon geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiPolygon(multiPolygonGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/Point.js\").default|import(\"./Feature.js\").default} pointGeometry Point geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawPoint(pointGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/Polygon.js\").default|import(\"./Feature.js\").default} polygonGeometry Polygon geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawPolygon(polygonGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default|import(\"./Feature.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawText(geometry, feature, index) {}\n\n /**\n * @param {import(\"../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../style/Stroke.js\").default} strokeStyle Stroke style.\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {}\n\n /**\n * @param {import(\"../style/Image.js\").default} imageStyle Image style.\n * @param {import(\"../render/canvas.js\").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with a text style.\n */\n setImageStyle(imageStyle, declutterImageWithText) {}\n\n /**\n * @param {import(\"../style/Text.js\").default} textStyle Text style.\n * @param {import(\"../render/canvas.js\").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with an image style.\n */\n setTextStyle(textStyle, declutterImageWithText) {}\n}\n\nexport default VectorContext;\n", "/**\n * @module ol/render/canvas/Instruction\n */\n\n/**\n * @enum {number}\n */\nconst Instruction = {\n BEGIN_GEOMETRY: 0,\n BEGIN_PATH: 1,\n CIRCLE: 2,\n CLOSE_PATH: 3,\n CUSTOM: 4,\n DRAW_CHARS: 5,\n DRAW_IMAGE: 6,\n END_GEOMETRY: 7,\n FILL: 8,\n MOVE_TO_LINE_TO: 9,\n SET_FILL_STYLE: 10,\n SET_STROKE_STYLE: 11,\n STROKE: 12,\n};\n\n/**\n * @type {Array<Instruction>}\n */\nexport const fillInstruction = [Instruction.FILL];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const strokeInstruction = [Instruction.STROKE];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const beginPathInstruction = [Instruction.BEGIN_PATH];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const closePathInstruction = [Instruction.CLOSE_PATH];\n\nexport default Instruction;\n", "/**\n * @module ol/render/canvas/Builder\n */\nimport {equals, reverseSubArray} from '../../array.js';\nimport {asColorLike} from '../../colorlike.js';\nimport Relationship from '../../extent/Relationship.js';\nimport {\n buffer,\n clone,\n containsCoordinate,\n coordinateRelationship,\n} from '../../extent.js';\nimport {\n inflateCoordinates,\n inflateCoordinatesArray,\n inflateMultiCoordinatesArray,\n} from '../../geom/flat/inflate.js';\nimport VectorContext from '../VectorContext.js';\nimport {\n defaultFillStyle,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeOffset,\n defaultStrokeStyle,\n} from '../canvas.js';\nimport CanvasInstruction from './Instruction.js';\n\nclass CanvasBuilder extends VectorContext {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super();\n\n /**\n * @protected\n * @type {number}\n */\n this.tolerance = tolerance;\n\n /**\n * @protected\n * @const\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent = maxExtent;\n\n /**\n * @protected\n * @type {number}\n */\n this.pixelRatio = pixelRatio;\n\n /**\n * @protected\n * @type {number}\n */\n this.maxLineWidth = 0;\n\n /**\n * @protected\n * @const\n * @type {number}\n */\n this.resolution = resolution;\n\n /**\n * @private\n * @type {Array<*>}\n */\n this.beginGeometryInstruction1_ = null;\n\n /**\n * @private\n * @type {Array<*>}\n */\n this.beginGeometryInstruction2_ = null;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.bufferedMaxExtent_ = null;\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.instructions = [];\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.coordinates = [];\n\n /**\n * @private\n * @type {import(\"../../coordinate.js\").Coordinate}\n */\n this.tmpCoordinate_ = [];\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.hitDetectionInstructions = [];\n\n /**\n * @protected\n * @type {import(\"../canvas.js\").FillStrokeState}\n */\n this.state = /** @type {import(\"../canvas.js\").FillStrokeState} */ ({});\n }\n\n /**\n * @protected\n * @param {Array<number>} dashArray Dash array.\n * @return {Array<number>} Dash array with pixel ratio applied\n */\n applyPixelRatio(dashArray) {\n const pixelRatio = this.pixelRatio;\n return pixelRatio == 1\n ? dashArray\n : dashArray.map(function (dash) {\n return dash * pixelRatio;\n });\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} stride Stride.\n * @protected\n * @return {number} My end\n */\n appendFlatPointCoordinates(flatCoordinates, stride) {\n const extent = this.getBufferedMaxExtent();\n const tmpCoord = this.tmpCoordinate_;\n const coordinates = this.coordinates;\n let myEnd = coordinates.length;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n tmpCoord[0] = flatCoordinates[i];\n tmpCoord[1] = flatCoordinates[i + 1];\n if (containsCoordinate(extent, tmpCoord)) {\n coordinates[myEnd++] = tmpCoord[0];\n coordinates[myEnd++] = tmpCoord[1];\n }\n }\n return myEnd;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {boolean} closed Last input coordinate equals first.\n * @param {boolean} skipFirst Skip first coordinate.\n * @protected\n * @return {number} My end.\n */\n appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n closed,\n skipFirst,\n ) {\n const coordinates = this.coordinates;\n let myEnd = coordinates.length;\n const extent = this.getBufferedMaxExtent();\n if (skipFirst) {\n offset += stride;\n }\n let lastXCoord = flatCoordinates[offset];\n let lastYCoord = flatCoordinates[offset + 1];\n const nextCoord = this.tmpCoordinate_;\n let skipped = true;\n\n let i, lastRel, nextRel;\n for (i = offset + stride; i < end; i += stride) {\n nextCoord[0] = flatCoordinates[i];\n nextCoord[1] = flatCoordinates[i + 1];\n nextRel = coordinateRelationship(extent, nextCoord);\n if (nextRel !== lastRel) {\n if (skipped) {\n coordinates[myEnd++] = lastXCoord;\n coordinates[myEnd++] = lastYCoord;\n skipped = false;\n }\n coordinates[myEnd++] = nextCoord[0];\n coordinates[myEnd++] = nextCoord[1];\n } else if (nextRel === Relationship.INTERSECTING) {\n coordinates[myEnd++] = nextCoord[0];\n coordinates[myEnd++] = nextCoord[1];\n skipped = false;\n } else {\n skipped = true;\n }\n lastXCoord = nextCoord[0];\n lastYCoord = nextCoord[1];\n lastRel = nextRel;\n }\n\n // Last coordinate equals first or only one point to append:\n if ((closed && skipped) || i === offset + stride) {\n coordinates[myEnd++] = lastXCoord;\n coordinates[myEnd++] = lastYCoord;\n }\n return myEnd;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Array<number>} builderEnds Builder ends.\n * @return {number} Offset.\n */\n drawCustomCoordinates_(flatCoordinates, offset, ends, stride, builderEnds) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const builderEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false,\n );\n builderEnds.push(builderEnd);\n offset = end;\n }\n return offset;\n }\n\n /**\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {Function} renderer Renderer.\n * @param {Function} hitDetectionRenderer Renderer.\n * @param {number} [index] Render order index.\n * @override\n */\n drawCustom(geometry, feature, renderer, hitDetectionRenderer, index) {\n this.beginGeometry(geometry, feature, index);\n\n const type = geometry.getType();\n const stride = geometry.getStride();\n const builderBegin = this.coordinates.length;\n\n let flatCoordinates, builderEnd, builderEnds, builderEndss;\n let offset;\n\n switch (type) {\n case 'MultiPolygon':\n flatCoordinates =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getOrientedFlatCoordinates();\n builderEndss = [];\n const endss =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getEndss();\n offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const myEnds = [];\n offset = this.drawCustomCoordinates_(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n myEnds,\n );\n builderEndss.push(myEnds);\n }\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEndss,\n geometry,\n renderer,\n inflateMultiCoordinatesArray,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEndss,\n geometry,\n hitDetectionRenderer || renderer,\n inflateMultiCoordinatesArray,\n index,\n ]);\n break;\n case 'Polygon':\n case 'MultiLineString':\n builderEnds = [];\n flatCoordinates =\n type == 'Polygon'\n ? /** @type {import(\"../../geom/Polygon.js\").default} */ (\n geometry\n ).getOrientedFlatCoordinates()\n : geometry.getFlatCoordinates();\n offset = this.drawCustomCoordinates_(\n flatCoordinates,\n 0,\n /** @type {import(\"../../geom/Polygon.js\").default|import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ).getEnds(),\n stride,\n builderEnds,\n );\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnds,\n geometry,\n renderer,\n inflateCoordinatesArray,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnds,\n geometry,\n hitDetectionRenderer || renderer,\n inflateCoordinatesArray,\n index,\n ]);\n break;\n case 'LineString':\n case 'Circle':\n flatCoordinates = geometry.getFlatCoordinates();\n builderEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n false,\n false,\n );\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n inflateCoordinates,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n hitDetectionRenderer || renderer,\n inflateCoordinates,\n index,\n ]);\n break;\n case 'MultiPoint':\n flatCoordinates = geometry.getFlatCoordinates();\n builderEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);\n\n if (builderEnd > builderBegin) {\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n inflateCoordinates,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n hitDetectionRenderer || renderer,\n inflateCoordinates,\n index,\n ]);\n }\n break;\n case 'Point':\n flatCoordinates = geometry.getFlatCoordinates();\n this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);\n builderEnd = this.coordinates.length;\n\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n undefined,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n hitDetectionRenderer || renderer,\n undefined,\n index,\n ]);\n break;\n default:\n }\n this.endGeometry(feature);\n }\n\n /**\n * @protected\n * @param {import(\"../../geom/Geometry\").default|import(\"../Feature.js\").default} geometry The geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} index Render order index\n */\n beginGeometry(geometry, feature, index) {\n this.beginGeometryInstruction1_ = [\n CanvasInstruction.BEGIN_GEOMETRY,\n feature,\n 0,\n geometry,\n index,\n ];\n this.instructions.push(this.beginGeometryInstruction1_);\n this.beginGeometryInstruction2_ = [\n CanvasInstruction.BEGIN_GEOMETRY,\n feature,\n 0,\n geometry,\n index,\n ];\n this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n */\n finish() {\n return {\n instructions: this.instructions,\n hitDetectionInstructions: this.hitDetectionInstructions,\n coordinates: this.coordinates,\n };\n }\n\n /**\n * Reverse the hit detection instructions.\n */\n reverseHitDetectionInstructions() {\n const hitDetectionInstructions = this.hitDetectionInstructions;\n // step 1 - reverse array\n hitDetectionInstructions.reverse();\n // step 2 - reverse instructions within geometry blocks\n let i;\n const n = hitDetectionInstructions.length;\n let instruction;\n let type;\n let begin = -1;\n for (i = 0; i < n; ++i) {\n instruction = hitDetectionInstructions[i];\n type = /** @type {import(\"./Instruction.js\").default} */ (instruction[0]);\n if (type == CanvasInstruction.END_GEOMETRY) {\n begin = i;\n } else if (type == CanvasInstruction.BEGIN_GEOMETRY) {\n instruction[2] = i;\n reverseSubArray(this.hitDetectionInstructions, begin, i);\n begin = -1;\n }\n }\n }\n\n /**\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import('../canvas.js').FillStrokeState} [state] State.\n * @return {import('../canvas.js').FillStrokeState} State.\n */\n fillStyleToState(\n fillStyle,\n state = /** @type {import('../canvas.js').FillStrokeState} */ ({}),\n ) {\n if (fillStyle) {\n const fillStyleColor = fillStyle.getColor();\n state.fillPatternScale =\n fillStyleColor &&\n typeof fillStyleColor === 'object' &&\n 'src' in fillStyleColor\n ? this.pixelRatio\n : 1;\n state.fillStyle = asColorLike(\n fillStyleColor ? fillStyleColor : defaultFillStyle,\n );\n } else {\n state.fillStyle = undefined;\n }\n return state;\n }\n\n /**\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {import(\"../canvas.js\").FillStrokeState} State.\n */\n strokeStyleToState(\n strokeStyle,\n state = /** @type {import('../canvas.js').FillStrokeState} */ ({}),\n ) {\n if (strokeStyle) {\n const strokeStyleColor = strokeStyle.getColor();\n state.strokeStyle = asColorLike(\n strokeStyleColor ? strokeStyleColor : defaultStrokeStyle,\n );\n const strokeStyleLineCap = strokeStyle.getLineCap();\n state.lineCap =\n strokeStyleLineCap !== undefined ? strokeStyleLineCap : defaultLineCap;\n const strokeStyleLineDash = strokeStyle.getLineDash();\n state.lineDash = strokeStyleLineDash\n ? strokeStyleLineDash.slice()\n : defaultLineDash;\n const strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();\n state.lineDashOffset = strokeStyleLineDashOffset\n ? strokeStyleLineDashOffset\n : defaultLineDashOffset;\n const strokeStyleLineJoin = strokeStyle.getLineJoin();\n state.lineJoin =\n strokeStyleLineJoin !== undefined\n ? strokeStyleLineJoin\n : defaultLineJoin;\n const strokeStyleWidth = strokeStyle.getWidth();\n state.lineWidth =\n strokeStyleWidth !== undefined ? strokeStyleWidth : defaultLineWidth;\n const strokeStyleMiterLimit = strokeStyle.getMiterLimit();\n state.miterLimit =\n strokeStyleMiterLimit !== undefined\n ? strokeStyleMiterLimit\n : defaultMiterLimit;\n const strokeStyleOffset = strokeStyle.getOffset();\n state.strokeOffset = strokeStyleOffset ?? defaultStrokeOffset;\n\n if (state.lineWidth > this.maxLineWidth) {\n this.maxLineWidth = state.lineWidth;\n // invalidate the buffered max extent cache\n this.bufferedMaxExtent_ = null;\n }\n } else {\n state.strokeStyle = undefined;\n state.lineCap = undefined;\n state.lineDash = null;\n state.lineDashOffset = undefined;\n state.lineJoin = undefined;\n state.lineWidth = undefined;\n state.miterLimit = undefined;\n state.strokeOffset = undefined;\n }\n return state;\n }\n\n /**\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n * @override\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {\n const state = this.state;\n this.fillStyleToState(fillStyle, state);\n this.strokeStyleToState(strokeStyle, state);\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {Array<*>} Fill instruction.\n */\n createFill(state) {\n const fillStyle = state.fillStyle;\n /** @type {Array<*>} */\n const fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle];\n if (typeof fillStyle !== 'string') {\n // Fill is a pattern or gradient - align and scale it!\n fillInstruction.push(state.fillPatternScale);\n }\n return fillInstruction;\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n */\n applyStroke(state) {\n this.instructions.push(this.createStroke(state));\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {Array<*>} Stroke instruction.\n */\n createStroke(state) {\n return [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth * this.pixelRatio,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n state.lineDash ? this.applyPixelRatio(state.lineDash) : null,\n state.lineDashOffset * this.pixelRatio,\n ];\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @param {function(this:CanvasBuilder, import(\"../canvas.js\").FillStrokeState):Array<*>} createFill Create fill.\n */\n updateFillStyle(state, createFill) {\n const fillStyle = state.fillStyle;\n if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {\n this.instructions.push(createFill.call(this, state));\n state.currentFillStyle = fillStyle;\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @param {function(this:CanvasBuilder, import(\"../canvas.js\").FillStrokeState): void} applyStroke Apply stroke.\n */\n updateStrokeStyle(state, applyStroke) {\n const strokeStyle = state.strokeStyle;\n const lineCap = state.lineCap;\n const lineDash = state.lineDash;\n const lineDashOffset = state.lineDashOffset;\n const lineJoin = state.lineJoin;\n const lineWidth = state.lineWidth;\n const miterLimit = state.miterLimit;\n const strokeOffset = state.strokeOffset;\n if (\n state.currentStrokeStyle != strokeStyle ||\n state.currentLineCap != lineCap ||\n (lineDash != state.currentLineDash &&\n !equals(state.currentLineDash, lineDash)) ||\n state.currentLineDashOffset != lineDashOffset ||\n state.currentLineJoin != lineJoin ||\n state.currentLineWidth != lineWidth ||\n state.currentMiterLimit != miterLimit ||\n state.currentStrokeOffset != strokeOffset\n ) {\n applyStroke.call(this, state);\n state.currentStrokeStyle = strokeStyle;\n state.currentLineCap = lineCap;\n state.currentLineDash = lineDash;\n state.currentLineDashOffset = lineDashOffset;\n state.currentLineJoin = lineJoin;\n state.currentLineWidth = lineWidth;\n state.currentMiterLimit = miterLimit;\n state.currentStrokeOffset = strokeOffset;\n }\n }\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n endGeometry(feature) {\n this.beginGeometryInstruction1_[2] = this.instructions.length;\n this.beginGeometryInstruction1_ = null;\n this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;\n this.beginGeometryInstruction2_ = null;\n const endGeometryInstruction = [CanvasInstruction.END_GEOMETRY, feature];\n this.instructions.push(endGeometryInstruction);\n this.hitDetectionInstructions.push(endGeometryInstruction);\n }\n\n /**\n * Get the buffered rendering extent. Rendering will be clipped to the extent\n * provided to the constructor. To account for symbolizers that may intersect\n * this extent, we calculate a buffered extent (e.g. based on stroke width).\n * @return {import(\"../../extent.js\").Extent} The buffered rendering extent.\n * @protected\n */\n getBufferedMaxExtent() {\n if (!this.bufferedMaxExtent_) {\n this.bufferedMaxExtent_ = clone(this.maxExtent);\n if (this.maxLineWidth > 0) {\n const width = (this.resolution * (this.maxLineWidth + 1)) / 2;\n buffer(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_);\n }\n }\n return this.bufferedMaxExtent_;\n }\n}\n\nexport default CanvasBuilder;\n", "/**\n * @module ol/render/canvas/ImageBuilder\n */\nimport {containsCoordinate} from '../../extent.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction from './Instruction.js';\n\nclass CanvasImageBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n\n /**\n * @private\n * @type {import('../../DataTile.js').ImageLike}\n */\n this.hitDetectionImage_ = null;\n\n /**\n * @private\n * @type {import('../../DataTile.js').ImageLike}\n */\n this.image_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.imagePixelRatio_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.anchorX_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.anchorY_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.height_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.opacity_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.originX_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.originY_ = undefined;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.rotateWithView_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size|undefined}\n */\n this.scale_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.width_ = undefined;\n\n /**\n * @private\n * @type {import('../../style/Style.js').DeclutterMode}\n */\n this.declutterMode_ = undefined;\n\n /**\n * Data shared with a text builder for combined decluttering.\n * @private\n * @type {import(\"../canvas.js\").DeclutterImageWithText}\n */\n this.declutterImageWithText_ = undefined;\n }\n\n /**\n * @param {import(\"../../geom/Point.js\").default|import(\"../Feature.js\").default} pointGeometry Point geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawPoint(pointGeometry, feature, index) {\n if (\n !this.image_ ||\n (this.maxExtent &&\n !containsCoordinate(this.maxExtent, pointGeometry.getFlatCoordinates()))\n ) {\n return;\n }\n this.beginGeometry(pointGeometry, feature, index);\n const flatCoordinates = pointGeometry.getFlatCoordinates();\n const stride = pointGeometry.getStride();\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.image_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_ * this.imagePixelRatio_,\n this.anchorY_ * this.imagePixelRatio_,\n Math.ceil(this.height_ * this.imagePixelRatio_),\n this.opacity_,\n this.originX_ * this.imagePixelRatio_,\n this.originY_ * this.imagePixelRatio_,\n this.rotateWithView_,\n this.rotation_,\n [\n (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,\n (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,\n ],\n Math.ceil(this.width_ * this.imagePixelRatio_),\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.hitDetectionImage_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_,\n this.anchorY_,\n this.height_,\n 1,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n this.scale_,\n this.width_,\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiPoint.js\").default|import(\"../Feature.js\").default} multiPointGeometry MultiPoint geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiPoint(multiPointGeometry, feature, index) {\n if (!this.image_) {\n return;\n }\n this.beginGeometry(multiPointGeometry, feature, index);\n const flatCoordinates = multiPointGeometry.getFlatCoordinates();\n const filteredFlatCoordinates = [];\n for (\n let i = 0, ii = flatCoordinates.length;\n i < ii;\n i += multiPointGeometry.getStride()\n ) {\n if (\n !this.maxExtent ||\n containsCoordinate(this.maxExtent, flatCoordinates.slice(i, i + 2))\n ) {\n filteredFlatCoordinates.push(\n flatCoordinates[i],\n flatCoordinates[i + 1],\n );\n }\n }\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatPointCoordinates(filteredFlatCoordinates, 2);\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.image_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_ * this.imagePixelRatio_,\n this.anchorY_ * this.imagePixelRatio_,\n Math.ceil(this.height_ * this.imagePixelRatio_),\n this.opacity_,\n this.originX_ * this.imagePixelRatio_,\n this.originY_ * this.imagePixelRatio_,\n this.rotateWithView_,\n this.rotation_,\n [\n (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,\n (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,\n ],\n Math.ceil(this.width_ * this.imagePixelRatio_),\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.hitDetectionImage_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_,\n this.anchorY_,\n this.height_,\n 1,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n this.scale_,\n this.width_,\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n this.reverseHitDetectionInstructions();\n // FIXME this doesn't really protect us against further calls to draw*Geometry\n this.anchorX_ = undefined;\n this.anchorY_ = undefined;\n this.hitDetectionImage_ = null;\n this.image_ = null;\n this.imagePixelRatio_ = undefined;\n this.height_ = undefined;\n this.scale_ = undefined;\n this.opacity_ = undefined;\n this.originX_ = undefined;\n this.originY_ = undefined;\n this.rotateWithView_ = undefined;\n this.rotation_ = undefined;\n this.width_ = undefined;\n return super.finish();\n }\n\n /**\n * @param {import(\"../../style/Image.js\").default} imageStyle Image style.\n * @param {Object} [sharedData] Shared data.\n * @override\n */\n setImageStyle(imageStyle, sharedData) {\n const anchor = imageStyle.getAnchor();\n const size = imageStyle.getSize();\n const origin = imageStyle.getOrigin();\n this.imagePixelRatio_ = imageStyle.getPixelRatio(this.pixelRatio);\n this.anchorX_ = anchor[0];\n this.anchorY_ = anchor[1];\n this.hitDetectionImage_ = imageStyle.getHitDetectionImage();\n this.image_ = imageStyle.getImage(this.pixelRatio);\n this.height_ = size[1];\n this.opacity_ = imageStyle.getOpacity();\n this.originX_ = origin[0];\n this.originY_ = origin[1];\n this.rotateWithView_ = imageStyle.getRotateWithView();\n this.rotation_ = imageStyle.getRotation();\n this.scale_ = imageStyle.getScaleArray();\n this.width_ = size[0];\n this.declutterMode_ = imageStyle.getDeclutterMode();\n this.declutterImageWithText_ = sharedData;\n }\n}\n\nexport default CanvasImageBuilder;\n", "/**\n * @module ol/render/canvas/LineStringBuilder\n */\nimport {defaultLineDash, defaultLineDashOffset} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n strokeInstruction,\n} from './Instruction.js';\n\nclass CanvasLineStringBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} [strokeOffset] Stroke Offset in pixels.\n * @private\n * @return {number} end.\n */\n drawFlatCoordinates_(flatCoordinates, offset, end, stride, strokeOffset) {\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false,\n );\n this.instructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset * this.pixelRatio,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset,\n ]);\n return end;\n }\n\n /**\n * @param {import(\"../../geom/LineString.js\").default|import(\"../Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawLineString(lineStringGeometry, feature, index) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n const strokeOffset = state.strokeOffset;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(lineStringGeometry, feature, index);\n this.hitDetectionInstructions.push(\n [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ],\n beginPathInstruction,\n );\n const flatCoordinates = lineStringGeometry.getFlatCoordinates();\n const stride = lineStringGeometry.getStride();\n this.drawFlatCoordinates_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n strokeOffset,\n );\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiLineString.js\").default|import(\"../Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiLineString(multiLineStringGeometry, feature, index) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n const strokeOffset = state.strokeOffset;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(multiLineStringGeometry, feature, index);\n this.hitDetectionInstructions.push(\n [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ],\n beginPathInstruction,\n );\n const ends = multiLineStringGeometry.getEnds();\n const flatCoordinates = multiLineStringGeometry.getFlatCoordinates();\n const stride = multiLineStringGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.drawFlatCoordinates_(\n flatCoordinates,\n offset,\n /** @type {number} */ (ends[i]),\n stride,\n strokeOffset,\n );\n }\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n const state = this.state;\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n }\n this.reverseHitDetectionInstructions();\n this.state = null;\n return super.finish();\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @override\n */\n applyStroke(state) {\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n state.lastStroke = this.coordinates.length;\n }\n state.lastStroke = 0;\n super.applyStroke(state);\n this.instructions.push(beginPathInstruction);\n }\n}\n\nexport default CanvasLineStringBuilder;\n", "/**\n * @module ol/render/canvas/PolygonBuilder\n */\nimport {snap} from '../../geom/flat/simplify.js';\nimport {\n defaultFillStyle,\n defaultLineDash,\n defaultLineDashOffset,\n} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n closePathInstruction,\n fillInstruction,\n strokeInstruction,\n} from './Instruction.js';\n\nclass CanvasPolygonBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} [strokeOffset] Stroke Offset in pixels.\n * @private\n * @return {number} End.\n */\n drawFlatCoordinatess_(flatCoordinates, offset, ends, stride, strokeOffset) {\n const state = this.state;\n const fill = state.fillStyle !== undefined;\n const stroke = state.strokeStyle !== undefined;\n const numEnds = ends.length;\n this.instructions.push(beginPathInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction);\n for (let i = 0; i < numEnds; ++i) {\n const end = ends[i];\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n true,\n !stroke,\n );\n this.instructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset * this.pixelRatio,\n true,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n strokeOffset,\n true,\n ]);\n if (stroke) {\n // Performance optimization: only call closePath() when we have a stroke.\n // Otherwise the ring is closed already (see appendFlatLineCoordinates above).\n this.instructions.push(closePathInstruction);\n this.hitDetectionInstructions.push(closePathInstruction);\n }\n offset = end;\n }\n if (fill) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (stroke) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n return offset;\n }\n\n /**\n * @param {import(\"../../geom/Circle.js\").default} circleGeometry Circle geometry.\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawCircle(circleGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n\n if (\n this.handleStrokeOffset_(() =>\n this.drawCircle(circleGeometry, feature, index),\n )\n ) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(circleGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const flatCoordinates = circleGeometry.getFlatCoordinates();\n const stride = circleGeometry.getStride();\n const myBegin = this.coordinates.length;\n this.appendFlatLineCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n false,\n false,\n );\n const circleInstruction = [CanvasInstruction.CIRCLE, myBegin, strokeOffset];\n this.instructions.push(beginPathInstruction, circleInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);\n if (state.fillStyle !== undefined) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (state.strokeStyle !== undefined) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/Polygon.js\").default|import(\"../Feature.js\").default} polygonGeometry Polygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawPolygon(polygonGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n if (\n this.handleStrokeOffset_(() =>\n this.drawPolygon(polygonGeometry, feature, index),\n )\n ) {\n return;\n }\n\n this.setFillStrokeStyles_();\n this.beginGeometry(polygonGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const ends = polygonGeometry.getEnds();\n const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();\n const stride = polygonGeometry.getStride();\n this.drawFlatCoordinatess_(\n flatCoordinates,\n 0,\n /** @type {Array<number>} */ (ends),\n stride,\n strokeOffset,\n );\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiPolygon.js\").default} multiPolygonGeometry MultiPolygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiPolygon(multiPolygonGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n if (\n this.handleStrokeOffset_(() =>\n this.drawMultiPolygon(multiPolygonGeometry, feature, index),\n )\n ) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(multiPolygonGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const endss = multiPolygonGeometry.getEndss();\n const flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();\n const stride = multiPolygonGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = this.drawFlatCoordinatess_(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n strokeOffset,\n );\n }\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n this.reverseHitDetectionInstructions();\n this.state = null;\n // We want to preserve topology when drawing polygons. Polygons are\n // simplified using quantization and point elimination. However, we might\n // have received a mix of quantized and non-quantized geometries, so ensure\n // that all are quantized by quantizing all coordinates in the batch.\n const tolerance = this.tolerance;\n if (tolerance !== 0) {\n const coordinates = this.coordinates;\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n coordinates[i] = snap(coordinates[i], tolerance);\n }\n }\n return super.finish();\n }\n\n /**\n * @private\n */\n setFillStrokeStyles_() {\n const state = this.state;\n this.updateFillStyle(state, this.createFill);\n this.updateStrokeStyle(state, this.applyStroke);\n }\n\n handleStrokeOffset_(drawGeometryCallback) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n const strokeOffset = state.strokeOffset;\n\n // In case both fill style and stroke style are defined and the stroke style has an offset,\n // the stroke and fill should be done in separate steps, because offset stroke shape will\n // be different from the original shape used for the fill.\n if (\n Math.abs(strokeOffset) > 0 &&\n fillStyle !== undefined &&\n strokeStyle !== undefined\n ) {\n // First do only fill\n state.strokeStyle = undefined;\n state.strokeOffset = 0;\n drawGeometryCallback();\n // Now separately do the stroke\n state.fillStyle = undefined;\n state.strokeStyle = strokeStyle;\n state.strokeOffset = strokeOffset;\n drawGeometryCallback();\n // Reset the state to the original\n state.fillStyle = fillStyle;\n return true;\n }\n return false;\n }\n}\n\nexport default CanvasPolygonBuilder;\n", "import {lerp} from '../../math.js';\n\n/**\n * Creates chunks of equal length from a linestring\n * @param {number} chunkLength Length of each chunk.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Start offset of the `flatCoordinates`.\n * @param {number} end End offset of the `flatCoordinates`.\n * @param {number} stride Stride.\n * @return {Array<Array<number>>} Chunks of linestrings with stride 2.\n */\nexport function lineChunk(chunkLength, flatCoordinates, offset, end, stride) {\n const chunks = [];\n let cursor = offset;\n let chunkM = 0;\n let currentChunk = flatCoordinates.slice(offset, 2);\n while (chunkM < chunkLength && cursor + stride < end) {\n const [x1, y1] = currentChunk.slice(-2);\n const x2 = flatCoordinates[cursor + stride];\n const y2 = flatCoordinates[cursor + stride + 1];\n const segmentLength = Math.sqrt(\n (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1),\n );\n chunkM += segmentLength;\n if (chunkM >= chunkLength) {\n const m = (chunkLength - chunkM + segmentLength) / segmentLength;\n const x = lerp(x1, x2, m);\n const y = lerp(y1, y2, m);\n currentChunk.push(x, y);\n chunks.push(currentChunk);\n currentChunk = [x, y];\n if (chunkM == chunkLength) {\n cursor += stride;\n }\n chunkM = 0;\n } else if (chunkM < chunkLength) {\n currentChunk.push(\n flatCoordinates[cursor + stride],\n flatCoordinates[cursor + stride + 1],\n );\n cursor += stride;\n } else {\n const missing = segmentLength - chunkM;\n const x = lerp(x1, x2, missing / segmentLength);\n const y = lerp(y1, y2, missing / segmentLength);\n currentChunk.push(x, y);\n chunks.push(currentChunk);\n currentChunk = [x, y];\n chunkM = 0;\n cursor += stride;\n }\n }\n if (chunkM > 0) {\n chunks.push(currentChunk);\n }\n return chunks;\n}\n", "/**\n * @module ol/geom/flat/straightchunk\n */\n\n/**\n * @param {number} maxAngle Maximum acceptable angle delta between segments.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Array<number>} Start and end of the first suitable chunk of the\n * given `flatCoordinates`.\n */\nexport function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) {\n let chunkStart = offset;\n let chunkEnd = offset;\n let chunkM = 0;\n let m = 0;\n let start = offset;\n let acos, i, m12, m23, x1, y1, x12, y12, x23, y23;\n for (i = offset; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n if (x1 !== undefined) {\n x23 = x2 - x1;\n y23 = y2 - y1;\n m23 = Math.sqrt(x23 * x23 + y23 * y23);\n if (x12 !== undefined) {\n m += m12;\n acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23));\n if (acos > maxAngle) {\n if (m > chunkM) {\n chunkM = m;\n chunkStart = start;\n chunkEnd = i;\n }\n m = 0;\n start = i - stride;\n }\n }\n m12 = m23;\n x12 = x23;\n y12 = y23;\n }\n x1 = x2;\n y1 = y2;\n }\n m += m23;\n return m > chunkM ? [start, i] : [chunkStart, chunkEnd];\n}\n", "/**\n * @module ol/render/canvas/TextBuilder\n */\nimport {asColorLike} from '../../colorlike.js';\nimport {intersects} from '../../extent.js';\nimport {lineChunk} from '../../geom/flat/linechunk.js';\nimport {matchingChunk} from '../../geom/flat/straightchunk.js';\nimport {getUid} from '../../util.js';\nimport {\n defaultFillStyle,\n defaultFont,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultPadding,\n defaultStrokeStyle,\n defaultTextAlign,\n defaultTextBaseline,\n registerFont,\n} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction from './Instruction.js';\n/**\n * @const\n * @type {{left: 0, center: 0.5, right: 1, top: 0, middle: 0.5, hanging: 0.2, alphabetic: 0.8, ideographic: 0.8, bottom: 1}}\n */\nexport const TEXT_ALIGN = {\n 'left': 0,\n 'center': 0.5,\n 'right': 1,\n 'top': 0,\n 'middle': 0.5,\n 'hanging': 0.2,\n 'alphabetic': 0.8,\n 'ideographic': 0.8,\n 'bottom': 1,\n};\n\nclass CanvasTextBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n\n /**\n * @private\n * @type {Array<HTMLCanvasElement>}\n */\n this.labels_ = null;\n\n /**\n * @private\n * @type {string|Array<string>}\n */\n this.text_ = '';\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetY_ = 0;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.textRotateWithView_ = undefined;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.textKeepUpright_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.textRotation_ = 0;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.textFillState_ = null;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").FillState>}\n */\n this.fillStates = {};\n this.fillStates[defaultFillStyle] = {fillStyle: defaultFillStyle};\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.textStrokeState_ = null;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").StrokeState>}\n */\n this.strokeStates = {};\n\n /**\n * @private\n * @type {import(\"../canvas.js\").TextState}\n */\n this.textState_ = /** @type {import(\"../canvas.js\").TextState} */ ({});\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").TextState>}\n */\n this.textStates = {};\n\n /**\n * @private\n * @type {string}\n */\n this.textKey_ = '';\n\n /**\n * @private\n * @type {string}\n */\n this.fillKey_ = '';\n\n /**\n * @private\n * @type {string}\n */\n this.strokeKey_ = '';\n\n /**\n * @private\n * @type {import('../../style/Style.js').DeclutterMode}\n */\n this.declutterMode_ = undefined;\n\n /**\n * Data shared with an image builder for combined decluttering.\n * @private\n * @type {import(\"../canvas.js\").DeclutterImageWithText}\n */\n this.declutterImageWithText_ = undefined;\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n const instructions = super.finish();\n instructions.textStates = this.textStates;\n instructions.fillStates = this.fillStates;\n instructions.strokeStates = this.strokeStates;\n return instructions;\n }\n\n /**\n * @param {import(\"../../geom/SimpleGeometry.js\").default|import(\"../Feature.js\").default} geometry Geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawText(geometry, feature, index) {\n const fillState = this.textFillState_;\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n if (this.text_ === '' || !textState || (!fillState && !strokeState)) {\n return;\n }\n\n const coordinates = this.coordinates;\n let begin = coordinates.length;\n\n const geometryType = geometry.getType();\n let flatCoordinates = null;\n let stride = geometry.getStride();\n\n if (\n textState.placement === 'line' &&\n (geometryType == 'LineString' ||\n geometryType == 'MultiLineString' ||\n geometryType == 'Polygon' ||\n geometryType == 'MultiPolygon')\n ) {\n if (!intersects(this.maxExtent, geometry.getExtent())) {\n return;\n }\n let ends;\n flatCoordinates = geometry.getFlatCoordinates();\n if (geometryType == 'LineString') {\n ends = [flatCoordinates.length];\n } else if (geometryType == 'MultiLineString') {\n ends = /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ).getEnds();\n } else if (geometryType == 'Polygon') {\n ends = /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry)\n .getEnds()\n .slice(0, 1);\n } else if (geometryType == 'MultiPolygon') {\n const endss =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getEndss();\n ends = [];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n ends.push(endss[i][0]);\n }\n }\n this.beginGeometry(geometry, feature, index);\n const repeat = textState.repeat;\n const textAlign = repeat ? undefined : textState.textAlign;\n // No `justify` support for line placement.\n let flatOffset = 0;\n for (let o = 0, oo = ends.length; o < oo; ++o) {\n let chunks;\n if (repeat) {\n chunks = lineChunk(\n repeat * this.resolution,\n flatCoordinates,\n flatOffset,\n ends[o],\n stride,\n );\n } else {\n chunks = [flatCoordinates.slice(flatOffset, ends[o])];\n }\n for (let c = 0, cc = chunks.length; c < cc; ++c) {\n const chunk = chunks[c];\n let chunkBegin = 0;\n let chunkEnd = chunk.length;\n if (textAlign == undefined) {\n const range = matchingChunk(\n textState.maxAngle,\n chunk,\n 0,\n chunk.length,\n 2,\n );\n chunkBegin = range[0];\n chunkEnd = range[1];\n }\n for (let i = chunkBegin; i < chunkEnd; i += stride) {\n coordinates.push(chunk[i], chunk[i + 1]);\n }\n const end = coordinates.length;\n flatOffset = ends[o];\n this.drawChars_(begin, end);\n begin = end;\n }\n }\n this.endGeometry(feature);\n } else {\n let geometryWidths = textState.overflow ? null : [];\n switch (geometryType) {\n case 'Point':\n case 'MultiPoint':\n flatCoordinates =\n /** @type {import(\"../../geom/MultiPoint.js\").default} */ (\n geometry\n ).getFlatCoordinates();\n break;\n case 'LineString':\n flatCoordinates =\n /** @type {import(\"../../geom/LineString.js\").default} */ (\n geometry\n ).getFlatMidpoint();\n break;\n case 'Circle':\n flatCoordinates =\n /** @type {import(\"../../geom/Circle.js\").default} */ (\n geometry\n ).getCenter();\n break;\n case 'MultiLineString':\n flatCoordinates =\n /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ).getFlatMidpoints();\n stride = 2;\n break;\n case 'Polygon':\n flatCoordinates =\n /** @type {import(\"../../geom/Polygon.js\").default} */ (\n geometry\n ).getFlatInteriorPoint();\n if (!textState.overflow) {\n geometryWidths.push(flatCoordinates[2] / this.resolution);\n }\n stride = 3;\n break;\n case 'MultiPolygon':\n const interiorPoints =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getFlatInteriorPoints();\n flatCoordinates = [];\n for (let i = 0, ii = interiorPoints.length; i < ii; i += 3) {\n if (!textState.overflow) {\n geometryWidths.push(interiorPoints[i + 2] / this.resolution);\n }\n flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);\n }\n if (flatCoordinates.length === 0) {\n return;\n }\n stride = 2;\n break;\n default:\n }\n const end = this.appendFlatPointCoordinates(flatCoordinates, stride);\n if (end === begin) {\n return;\n }\n if (\n geometryWidths &&\n (end - begin) / 2 !== flatCoordinates.length / stride\n ) {\n let beg = begin / 2;\n geometryWidths = geometryWidths.filter((w, i) => {\n const keep =\n coordinates[(beg + i) * 2] === flatCoordinates[i * stride] &&\n coordinates[(beg + i) * 2 + 1] === flatCoordinates[i * stride + 1];\n if (!keep) {\n --beg;\n }\n return keep;\n });\n }\n\n this.saveTextStates_();\n\n const backgroundFill = textState.backgroundFill\n ? this.createFill(this.fillStyleToState(textState.backgroundFill))\n : null;\n const backgroundStroke = textState.backgroundStroke\n ? this.createStroke(this.strokeStyleToState(textState.backgroundStroke))\n : null;\n\n this.beginGeometry(geometry, feature, index);\n\n // adjust padding for negative scale\n let padding = textState.padding;\n if (\n padding != defaultPadding &&\n (textState.scale[0] < 0 || textState.scale[1] < 0)\n ) {\n let p0 = textState.padding[0];\n let p1 = textState.padding[1];\n let p2 = textState.padding[2];\n let p3 = textState.padding[3];\n if (textState.scale[0] < 0) {\n p1 = -p1;\n p3 = -p3;\n }\n if (textState.scale[1] < 0) {\n p0 = -p0;\n p2 = -p2;\n }\n padding = [p0, p1, p2, p3];\n }\n\n // The image is unknown at this stage so we pass null; it will be computed at render time.\n // For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at\n // render time.\n const pixelRatio = this.pixelRatio;\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n begin,\n end,\n null,\n NaN,\n NaN,\n NaN,\n 1,\n 0,\n 0,\n this.textRotateWithView_,\n this.textRotation_,\n [1, 1],\n NaN,\n this.declutterMode_,\n this.declutterImageWithText_,\n padding == defaultPadding\n ? defaultPadding\n : padding.map(function (p) {\n return p * pixelRatio;\n }),\n backgroundFill,\n backgroundStroke,\n this.text_,\n this.textKey_,\n this.strokeKey_,\n this.fillKey_,\n this.textOffsetX_,\n this.textOffsetY_,\n geometryWidths,\n ]);\n const scale = 1 / pixelRatio;\n // Set default fill for hit detection background\n const hitDetectionBackgroundFill = backgroundFill\n ? backgroundFill.slice(0)\n : null;\n if (hitDetectionBackgroundFill) {\n hitDetectionBackgroundFill[1] = defaultFillStyle;\n }\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n begin,\n end,\n null,\n NaN,\n NaN,\n NaN,\n 1,\n 0,\n 0,\n this.textRotateWithView_,\n this.textRotation_,\n [scale, scale],\n NaN,\n this.declutterMode_,\n this.declutterImageWithText_,\n padding,\n hitDetectionBackgroundFill,\n backgroundStroke,\n this.text_,\n this.textKey_,\n this.strokeKey_,\n this.fillKey_ ? defaultFillStyle : this.fillKey_,\n this.textOffsetX_,\n this.textOffsetY_,\n geometryWidths,\n ]);\n\n this.endGeometry(feature);\n }\n }\n\n /**\n * @private\n */\n saveTextStates_() {\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n const fillState = this.textFillState_;\n\n const strokeKey = this.strokeKey_;\n if (strokeState) {\n if (!(strokeKey in this.strokeStates)) {\n this.strokeStates[strokeKey] = {\n strokeStyle: strokeState.strokeStyle,\n lineCap: strokeState.lineCap,\n lineDashOffset: strokeState.lineDashOffset,\n lineWidth: strokeState.lineWidth,\n lineJoin: strokeState.lineJoin,\n miterLimit: strokeState.miterLimit,\n lineDash: strokeState.lineDash,\n };\n }\n }\n const textKey = this.textKey_;\n if (!(textKey in this.textStates)) {\n this.textStates[textKey] = {\n font: textState.font,\n textAlign: textState.textAlign || defaultTextAlign,\n justify: textState.justify,\n textBaseline: textState.textBaseline || defaultTextBaseline,\n scale: textState.scale,\n };\n }\n const fillKey = this.fillKey_;\n if (fillState) {\n if (!(fillKey in this.fillStates)) {\n this.fillStates[fillKey] = {\n fillStyle: fillState.fillStyle,\n };\n }\n }\n }\n\n /**\n * @private\n * @param {number} begin Begin.\n * @param {number} end End.\n */\n drawChars_(begin, end) {\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n\n const strokeKey = this.strokeKey_;\n const textKey = this.textKey_;\n const fillKey = this.fillKey_;\n this.saveTextStates_();\n\n const pixelRatio = this.pixelRatio;\n const baseline = TEXT_ALIGN[textState.textBaseline];\n\n const offsetY = this.textOffsetY_ * pixelRatio;\n const text = this.text_;\n const strokeWidth = strokeState\n ? (strokeState.lineWidth * Math.abs(textState.scale[0])) / 2\n : 0;\n\n this.instructions.push([\n CanvasInstruction.DRAW_CHARS,\n begin,\n end,\n baseline,\n textState.overflow,\n fillKey,\n textState.maxAngle,\n pixelRatio,\n offsetY,\n strokeKey,\n strokeWidth * pixelRatio,\n text,\n textKey,\n 1,\n this.declutterMode_,\n this.textKeepUpright_,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_CHARS,\n begin,\n end,\n baseline,\n textState.overflow,\n fillKey ? defaultFillStyle : fillKey,\n textState.maxAngle,\n pixelRatio,\n offsetY,\n strokeKey,\n strokeWidth * pixelRatio,\n text,\n textKey,\n 1 / pixelRatio,\n this.declutterMode_,\n this.textKeepUpright_,\n ]);\n }\n\n /**\n * @param {import(\"../../style/Text.js\").default} textStyle Text style.\n * @param {Object} [sharedData] Shared data.\n * @override\n */\n setTextStyle(textStyle, sharedData) {\n let textState, fillState, strokeState;\n if (!textStyle) {\n this.text_ = '';\n } else {\n const textFillStyle = textStyle.getFill();\n if (!textFillStyle) {\n fillState = null;\n this.textFillState_ = fillState;\n } else {\n fillState = this.textFillState_;\n if (!fillState) {\n fillState = /** @type {import(\"../canvas.js\").FillState} */ ({});\n this.textFillState_ = fillState;\n }\n fillState.fillStyle = asColorLike(\n textFillStyle.getColor() || defaultFillStyle,\n );\n }\n\n const textStrokeStyle = textStyle.getStroke();\n if (!textStrokeStyle) {\n strokeState = null;\n this.textStrokeState_ = strokeState;\n } else {\n strokeState = this.textStrokeState_;\n if (!strokeState) {\n strokeState = /** @type {import(\"../canvas.js\").StrokeState} */ ({});\n this.textStrokeState_ = strokeState;\n }\n const lineDash = textStrokeStyle.getLineDash();\n const lineDashOffset = textStrokeStyle.getLineDashOffset();\n const lineWidth = textStrokeStyle.getWidth();\n const miterLimit = textStrokeStyle.getMiterLimit();\n strokeState.lineCap = textStrokeStyle.getLineCap() || defaultLineCap;\n strokeState.lineDash = lineDash ? lineDash.slice() : defaultLineDash;\n strokeState.lineDashOffset =\n lineDashOffset === undefined ? defaultLineDashOffset : lineDashOffset;\n strokeState.lineJoin = textStrokeStyle.getLineJoin() || defaultLineJoin;\n strokeState.lineWidth =\n lineWidth === undefined ? defaultLineWidth : lineWidth;\n strokeState.miterLimit =\n miterLimit === undefined ? defaultMiterLimit : miterLimit;\n strokeState.strokeStyle = asColorLike(\n textStrokeStyle.getColor() || defaultStrokeStyle,\n );\n }\n\n textState = this.textState_;\n const font = textStyle.getFont() || defaultFont;\n registerFont(font);\n const textScale = textStyle.getScaleArray();\n textState.overflow = textStyle.getOverflow();\n textState.font = font;\n textState.maxAngle = textStyle.getMaxAngle();\n textState.placement = textStyle.getPlacement();\n textState.textAlign = textStyle.getTextAlign();\n textState.repeat = textStyle.getRepeat();\n textState.justify = textStyle.getJustify();\n textState.textBaseline =\n textStyle.getTextBaseline() || defaultTextBaseline;\n textState.backgroundFill = textStyle.getBackgroundFill();\n textState.backgroundStroke = textStyle.getBackgroundStroke();\n textState.padding = textStyle.getPadding() || defaultPadding;\n textState.scale = textScale === undefined ? [1, 1] : textScale;\n\n const textOffsetX = textStyle.getOffsetX();\n const textOffsetY = textStyle.getOffsetY();\n const textRotateWithView = textStyle.getRotateWithView();\n const textKeepUpright = textStyle.getKeepUpright();\n const textRotation = textStyle.getRotation();\n this.text_ = textStyle.getText() || '';\n this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX;\n this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY;\n this.textRotateWithView_ =\n textRotateWithView === undefined ? false : textRotateWithView;\n this.textKeepUpright_ =\n textKeepUpright === undefined ? true : textKeepUpright;\n this.textRotation_ = textRotation === undefined ? 0 : textRotation;\n\n this.strokeKey_ = strokeState\n ? (typeof strokeState.strokeStyle == 'string'\n ? strokeState.strokeStyle\n : getUid(strokeState.strokeStyle)) +\n strokeState.lineCap +\n strokeState.lineDashOffset +\n '|' +\n strokeState.lineWidth +\n strokeState.lineJoin +\n strokeState.miterLimit +\n '[' +\n strokeState.lineDash.join() +\n ']'\n : '';\n this.textKey_ =\n textState.font +\n textState.scale +\n (textState.textAlign || '?') +\n (textState.repeat || '?') +\n (textState.justify || '?') +\n (textState.textBaseline || '?');\n this.fillKey_ =\n fillState && fillState.fillStyle\n ? typeof fillState.fillStyle == 'string'\n ? fillState.fillStyle\n : '|' + getUid(fillState.fillStyle)\n : '';\n }\n this.declutterMode_ = textStyle.getDeclutterMode();\n this.declutterImageWithText_ = sharedData;\n }\n}\n\nexport default CanvasTextBuilder;\n", "/**\n * @module ol/render/canvas/BuilderGroup\n */\n\nimport Builder from './Builder.js';\nimport ImageBuilder from './ImageBuilder.js';\nimport LineStringBuilder from './LineStringBuilder.js';\nimport PolygonBuilder from './PolygonBuilder.js';\nimport TextBuilder from './TextBuilder.js';\n\n/**\n * @type {Object<import(\"../canvas.js\").BuilderType, typeof Builder>}\n */\nconst BATCH_CONSTRUCTORS = {\n 'Circle': PolygonBuilder,\n 'Default': Builder,\n 'Image': ImageBuilder,\n 'LineString': LineStringBuilder,\n 'Polygon': PolygonBuilder,\n 'Text': TextBuilder,\n};\n\nclass BuilderGroup {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Max extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n /**\n * @private\n * @type {number}\n */\n this.tolerance_ = tolerance;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent_ = maxExtent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.resolution_ = resolution;\n\n /**\n * @private\n * @type {!Object<string, !Object<import(\"../canvas.js\").BuilderType, Builder>>}\n */\n this.buildersByZIndex_ = {};\n }\n\n /**\n * @return {!Object<string, !Object<import(\"../canvas.js\").BuilderType, import(\"./Builder.js\").SerializableInstructions>>} The serializable instructions\n */\n finish() {\n const builderInstructions = {};\n for (const zKey in this.buildersByZIndex_) {\n builderInstructions[zKey] = builderInstructions[zKey] || {};\n const builders = this.buildersByZIndex_[zKey];\n for (const builderKey in builders) {\n const builderInstruction = builders[builderKey].finish();\n builderInstructions[zKey][builderKey] = builderInstruction;\n }\n }\n return builderInstructions;\n }\n\n /**\n * @param {number|undefined} zIndex Z index.\n * @param {import(\"../canvas.js\").BuilderType} builderType Replay type.\n * @return {import(\"../VectorContext.js\").default} Replay.\n */\n getBuilder(zIndex, builderType) {\n const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';\n let replays = this.buildersByZIndex_[zIndexKey];\n if (replays === undefined) {\n replays = {};\n this.buildersByZIndex_[zIndexKey] = replays;\n }\n let replay = replays[builderType];\n if (replay === undefined) {\n const Constructor = BATCH_CONSTRUCTORS[builderType];\n replay = new Constructor(\n this.tolerance_,\n this.maxExtent_,\n this.resolution_,\n this.pixelRatio_,\n );\n replays[builderType] = replay;\n }\n return replay;\n }\n}\n\nexport default BuilderGroup;\n", "/**\n * @module ol/geom/flat/length\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Length.\n */\nexport function lineStringLength(flatCoordinates, offset, end, stride) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n x1 = x2;\n y1 = y2;\n }\n return length;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Perimeter.\n */\nexport function linearRingLength(flatCoordinates, offset, end, stride) {\n let perimeter = lineStringLength(flatCoordinates, offset, end, stride);\n const dx = flatCoordinates[end - stride] - flatCoordinates[offset];\n const dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];\n perimeter += Math.sqrt(dx * dx + dy * dy);\n return perimeter;\n}\n", "import {angleBetween} from '../../coordinate.js';\n\n/**\n * Offsets a line string to the left / right along its segments direction.\n * Offset is applied to each segment of the line in the direciton of the segment normal (positive offset goes \"right\" relative to the line direction).\n * For very sharp angles between segments, the function falls back to offsetting along the segment normal direction to avoid excessively long miters.\n *\n * Coordinates and the offset should be in the same units \u2014 either pixels or the same spatial reference system as the input line coordinates.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} stride Stride.\n * @param {number} offset Offset distance along the segment normal direction.\n * Positive values offset to the right relative to the direction of the line.\n * Negative values offset to the left.\n * @param {boolean} isClosedRing If coordinates build a closed circle (in this the first and the last coordinate offsets will consider previous / next ring coordinate)\n * @param {Array<number>} [dest] Destination coordinate array. If not provided a new one will be created\n * @param {number} [destinationStride] Stride of destination coordinates. If unspecified, assumed to be same as the source coordinates stride.\n * @return {Array<number>} Result flat coordinates of the offset line.\n */\nexport function offsetLineString(\n flatCoordinates,\n stride,\n offset,\n isClosedRing,\n dest,\n destinationStride,\n) {\n dest = dest ?? [];\n destinationStride = destinationStride ?? stride;\n\n const firstPointX = flatCoordinates[0];\n const firstPointY = flatCoordinates[1];\n const secondToLastPointX = flatCoordinates[flatCoordinates.length - 4];\n const secondToLastPointY = flatCoordinates[flatCoordinates.length - 3];\n let x, y, prevX, prevY, nextX, nextY, offsetX, offsetY;\n\n let i = 0;\n for (let j = 0; j < flatCoordinates.length; j += stride) {\n // 1. Detect previous and next coordinates of a current vertex\n prevX = x;\n prevY = y;\n nextX = undefined;\n nextY = undefined;\n if (j + stride < flatCoordinates.length) {\n nextX = flatCoordinates[j + stride];\n nextY = flatCoordinates[j + stride + 1];\n }\n // First coordinate of a closed ring -> previous coordinate is the second to last one\n if (isClosedRing && j === 0) {\n prevX = secondToLastPointX;\n prevY = secondToLastPointY;\n }\n // Last coordinate of a closed ring -> next coordinate is the first vertex of a line string\n if (isClosedRing && j === flatCoordinates.length - 2) {\n // last coordinate\n nextX = firstPointX;\n nextY = firstPointY;\n }\n\n // 2. Current vertex to offset\n x = flatCoordinates[j];\n y = flatCoordinates[j + 1];\n\n // 3. Offset the vertex\n [offsetX, offsetY] = offsetLineVertex(\n x,\n y,\n prevX,\n prevY,\n nextX,\n nextY,\n offset,\n );\n dest[i++] = offsetX;\n dest[i++] = offsetY;\n\n // 4. Copy over other dimension values if any\n for (let k = 2; k < destinationStride; k++) {\n dest[i++] = flatCoordinates[j + k];\n }\n }\n\n if (dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * Computes the offset of a single vertex of a line string.\n *\n * The function calculates a new vertex coordinate offset along the normal/miter direction of the line at this vertex.\n * Offset is applied along the segment normal (positive offset goes \"right\" relative to the line direction).\n * It handles first and last vertices (caps) as well as joins between two segments (mitering).\n * For very sharp angles, the function falls back to offsetting along the segment normal direction to avoid excessively long miters.\n *\n * Coordinates and the offset should be in the same units \u2014 either pixels or the same spatial reference system as the input line coordinates.\n *\n * @param {number} x Vertex x-coordinate.\n * @param {number} y Vertex y-coordinate.\n * @param {number|undefined} prevX Previous vertex x-coordinate.\n * Pass undefined if computing the offset for the first vertex (no previous vertex).\n * @param {number|undefined} prevY Previous vertex y-coordinate.\n * Pass undefined if computing the offset for the first vertex (no previous vertex).\n * @param {number|undefined} nextX Next vertex x-coordinate.\n * Pass undefined if computing the offset for the last vertex (no next vertex).\n * @param {number|undefined} nextY Next vertex y-coordinate.\n * Pass undefined if computing the offset for the last vertex (no next vertex).\n * @param {number} offset Offset distance along the segment normal direction.\n * Positive values offset to the right relative to the direction from previous to next vertex.\n * Negative values offset to the left.\n * @return {import(\"../../coordinate.js\").Coordinate} Offset vertex coordinate as `[x, y]`.\n */\nexport function offsetLineVertex(x, y, prevX, prevY, nextX, nextY, offset) {\n // Compute segment direction\n let nx, ny;\n if (prevX !== undefined && prevY !== undefined) {\n nx = x - prevX;\n ny = y - prevY;\n } else if (nextX !== undefined && nextY !== undefined) {\n nx = nextX - x;\n ny = nextY - y;\n } else {\n // no next, no previous point given -> just assume some default (horizontal) direction\n nx = 1;\n ny = 0;\n }\n\n // Normalize -> tangent\n const len = Math.hypot(nx, ny);\n const tx = nx / len;\n const ty = ny / len;\n\n // Rotate tangent 90\u00B0 -> normal\n nx = -ty;\n ny = tx;\n\n // First / last vertex -> offset the point in the direction of the normal vector\n if (prevX === undefined || prevY === undefined) {\n return [x + nx * offset, y + ny * offset];\n }\n if (nextX === undefined || nextY === undefined) {\n return [x + nx * offset, y + ny * offset];\n }\n\n // Compute join angle - angle between 2 segments of the vertex.\n const joinAngle = angleBetween([x, y], [prevX, prevY], [nextX, nextY]);\n\n // Avoid huge or infinite miter joins for very sharp angles, offset in the segment direction in this case.\n if (Math.cos(joinAngle) > 0.998) {\n return [x + tx * offset, y + ty * offset];\n }\n\n // Compute join offset direction.\n // We rotate the normal vector by half of the join angle.\n // This gives the direction of the miter at the vertex.\n const cos = Math.cos(joinAngle / 2);\n const sin = Math.sin(joinAngle / 2);\n\n // Rotate the normal vector (nx, ny) by half of the join angle.\n // bx/by = bisector direction before normalization\n const bx = sin * nx + cos * ny;\n const by = -cos * nx + sin * ny;\n\n // Scale the bisector so that moving along it preserves the correct offset distance.\n // Dividing by sin(half of angle) converts the bisector into the true miter vector.\n // (This expands the miter for sharp angles and shortens it for wide ones.)\n const dx = bx * (1 / sin);\n const dy = by * (1 / sin);\n\n // Offset final vertex along miter direction\n return [x + dx * offset, y + dy * offset];\n}\n", "/**\n * @module ol/geom/flat/textpath\n */\nimport {lerp} from '../../math.js';\nimport {rotate} from './transform.js';\n\n/**\n * @param {Array<number>} flatCoordinates Path to put text on.\n * @param {number} offset Start offset of the `flatCoordinates`.\n * @param {number} end End offset of the `flatCoordinates`.\n * @param {number} stride Stride.\n * @param {string} text Text to place on the path.\n * @param {number} startM m along the path where the text starts.\n * @param {number} maxAngle Max angle between adjacent chars in radians.\n * @param {number} scale The product of the text scale and the device pixel ratio.\n * @param {function(string, string, Object<string, number>):number} measureAndCacheTextWidth Measure and cache text width.\n * @param {string} font The font.\n * @param {Object<string, number>} cache A cache of measured widths.\n * @param {number} rotation Rotation to apply to the flatCoordinates to determine whether text needs to be reversed.\n * @param {boolean} keepUpright Whether the text needs to be kept upright\n * @return {Array<Array<*>>|null} The result array (or null if `maxAngle` was\n * exceeded). Entries of the array are x, y, anchorX, angle, chunk.\n */\nexport function drawTextOnPath(\n flatCoordinates,\n offset,\n end,\n stride,\n text,\n startM,\n maxAngle,\n scale,\n measureAndCacheTextWidth,\n font,\n cache,\n rotation,\n keepUpright = true,\n) {\n let x2 = flatCoordinates[offset];\n let y2 = flatCoordinates[offset + 1];\n let x1 = 0;\n let y1 = 0;\n let segmentLength = 0;\n let segmentM = 0;\n\n function advance() {\n x1 = x2;\n y1 = y2;\n offset += stride;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n segmentM += segmentLength;\n segmentLength = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n }\n do {\n advance();\n } while (offset < end - stride && segmentM + segmentLength < startM);\n\n let interpolate =\n segmentLength === 0 ? 0 : (startM - segmentM) / segmentLength;\n const beginX = lerp(x1, x2, interpolate);\n const beginY = lerp(y1, y2, interpolate);\n\n const startOffset = offset - stride;\n const startLength = segmentM;\n const endM = startM + scale * measureAndCacheTextWidth(font, text, cache);\n while (offset < end - stride && segmentM + segmentLength < endM) {\n advance();\n }\n interpolate = segmentLength === 0 ? 0 : (endM - segmentM) / segmentLength;\n const endX = lerp(x1, x2, interpolate);\n const endY = lerp(y1, y2, interpolate);\n\n // Keep text upright if the option is selected\n let reverse = false;\n if (keepUpright) {\n if (rotation) {\n const flat = [beginX, beginY, endX, endY];\n rotate(flat, 0, 4, 2, rotation, flat, flat);\n reverse = flat[0] > flat[2];\n } else {\n reverse = beginX > endX;\n }\n }\n\n const PI = Math.PI;\n const result = [];\n const singleSegment = startOffset + stride === offset;\n\n offset = startOffset;\n segmentLength = 0;\n segmentM = startLength;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n\n let previousAngle;\n // All on the same segment\n if (singleSegment) {\n advance();\n\n previousAngle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n previousAngle += previousAngle > 0 ? -PI : PI;\n }\n const x = (endX + beginX) / 2;\n const y = (endY + beginY) / 2;\n result[0] = [x, y, (endM - startM) / 2, previousAngle, text];\n return result;\n }\n\n // rendering across line segments\n text = text.replace(/\\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines\n\n for (let i = 0, ii = text.length; i < ii; ) {\n advance();\n let angle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n angle += angle > 0 ? -PI : PI;\n }\n if (previousAngle !== undefined) {\n let delta = angle - previousAngle;\n delta += delta > PI ? -2 * PI : delta < -PI ? 2 * PI : 0;\n if (Math.abs(delta) > maxAngle) {\n return null;\n }\n }\n previousAngle = angle;\n\n const iStart = i;\n let charLength = 0;\n for (; i < ii; ++i) {\n const index = reverse ? ii - i - 1 : i;\n const len = scale * measureAndCacheTextWidth(font, text[index], cache);\n if (\n offset + stride < end &&\n segmentM + segmentLength < startM + charLength + len / 2\n ) {\n break;\n }\n charLength += len;\n }\n if (i === iStart) {\n continue;\n }\n const chars = reverse\n ? text.substring(ii - iStart, ii - i)\n : text.substring(iStart, i);\n interpolate =\n segmentLength === 0\n ? 0\n : (startM + charLength / 2 - segmentM) / segmentLength;\n const x = lerp(x1, x2, interpolate);\n const y = lerp(y1, y2, interpolate);\n result.push([x, y, charLength / 2, angle, chars]);\n startM += charLength;\n }\n return result;\n}\n", "/**\n * @module ol/render/canvas/Executor\n */\nimport {equals} from '../../array.js';\nimport {createEmpty, createOrUpdate, intersects} from '../../extent.js';\nimport {lineStringLength} from '../../geom/flat/length.js';\nimport {offsetLineVertex} from '../../geom/flat/lineoffset.js';\nimport {drawTextOnPath} from '../../geom/flat/textpath.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n create as createTransform,\n setFromArray as transformSetFromArray,\n} from '../../transform.js';\nimport ZIndexContext from '../canvas/ZIndexContext.js';\nimport {\n defaultPadding,\n defaultTextAlign,\n defaultTextBaseline,\n drawImageOrLabel,\n getTextDimensions,\n measureAndCacheTextWidth,\n} from '../canvas.js';\nimport CanvasInstruction from './Instruction.js';\nimport {TEXT_ALIGN} from './TextBuilder.js';\n\n/**\n * @typedef {import('../../structs/RBush.js').Entry<import('../../Feature.js').FeatureLike>} DeclutterEntry\n */\n\n/**\n * @typedef {Object} ImageOrLabelDimensions\n * @property {number} drawImageX DrawImageX.\n * @property {number} drawImageY DrawImageY.\n * @property {number} drawImageW DrawImageW.\n * @property {number} drawImageH DrawImageH.\n * @property {number} originX OriginX.\n * @property {number} originY OriginY.\n * @property {Array<number>} scale Scale.\n * @property {DeclutterEntry} declutterBox DeclutterBox.\n * @property {import(\"../../transform.js\").Transform} canvasTransform CanvasTransform.\n */\n\n/**\n * @typedef {{0: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D, 1: import('../../size.js').Size, 2: import(\"../canvas.js\").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement, 3: ImageOrLabelDimensions, 4: number, 5: Array<*>, 6: Array<*>}} ReplayImageOrLabelArgs\n */\n\n/**\n * @template T\n * @typedef {function(import(\"../../Feature.js\").FeatureLike, import(\"../../geom/SimpleGeometry.js\").default, import(\"../../style/Style.js\").DeclutterMode): T} FeatureCallback\n */\n\n/**\n * @type {import(\"../../extent.js\").Extent}\n */\nconst tmpExtent = createEmpty();\n\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p1 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p2 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p3 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p4 = [];\n\n/**\n * @param {ReplayImageOrLabelArgs} replayImageOrLabelArgs Arguments to replayImageOrLabel\n * @return {DeclutterEntry} Declutter rbush entry.\n */\nfunction getDeclutterBox(replayImageOrLabelArgs) {\n return replayImageOrLabelArgs[3].declutterBox;\n}\n\nconst rtlRegEx = new RegExp(\n /* eslint-disable prettier/prettier */\n '[' +\n String.fromCharCode(0x00591) + '-' + String.fromCharCode(0x008ff) +\n String.fromCharCode(0x0fb1d) + '-' + String.fromCharCode(0x0fdff) +\n String.fromCharCode(0x0fe70) + '-' + String.fromCharCode(0x0fefc) +\n String.fromCharCode(0x10800) + '-' + String.fromCharCode(0x10fff) +\n String.fromCharCode(0x1e800) + '-' + String.fromCharCode(0x1efff) +\n ']'\n /* eslint-enable prettier/prettier */\n);\n\n/**\n * @param {string} text Text.\n * @param {CanvasTextAlign} align Alignment.\n * @return {number} Text alignment.\n */\nfunction horizontalTextAlign(text, align) {\n if (align === 'start') {\n align = rtlRegEx.test(text) ? 'right' : 'left';\n } else if (align === 'end') {\n align = rtlRegEx.test(text) ? 'left' : 'right';\n }\n return TEXT_ALIGN[align];\n}\n\n/**\n * @param {Array<string>} acc Accumulator.\n * @param {string} line Line of text.\n * @param {number} i Index\n * @return {Array<string>} Accumulator.\n */\nfunction createTextChunks(acc, line, i) {\n if (i > 0) {\n acc.push('\\n', '');\n }\n acc.push(line, '');\n return acc;\n}\n\n/**\n * Converts rich text to plain text for text along lines.\n * @param {string} result The resulting plain text.\n * @param {string} part Item of the rich text array.\n * @param {number} index Index of the item in the rich text array.\n * @return {string} The resulting plain text.\n */\nfunction richTextToPlainText(result, part, index) {\n if (index % 2 === 0) {\n result += part;\n }\n return result;\n}\n\nclass Executor {\n /**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {boolean} overlaps The replay can have overlapping geometries.\n * @param {import(\"../canvas.js\").SerializableInstructions} instructions The serializable instructions.\n * @param {boolean} [deferredRendering] Enable deferred rendering.\n */\n constructor(\n resolution,\n pixelRatio,\n overlaps,\n instructions,\n deferredRendering,\n ) {\n /**\n * @protected\n * @type {boolean}\n */\n this.overlaps = overlaps;\n\n /**\n * @protected\n * @type {number}\n */\n this.pixelRatio = pixelRatio;\n\n /**\n * @protected\n * @const\n * @type {number}\n */\n this.resolution = resolution;\n\n /**\n * @private\n * @type {number}\n */\n this.alignAndScaleFill_;\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.instructions = instructions.instructions;\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.coordinates = instructions.coordinates;\n\n /**\n * @private\n * @type {!Object<number,import(\"../../coordinate.js\").Coordinate|Array<import(\"../../coordinate.js\").Coordinate>|Array<Array<import(\"../../coordinate.js\").Coordinate>>>}\n */\n this.coordinateCache_ = {};\n\n /**\n * @private\n * @type {!import(\"../../transform.js\").Transform}\n */\n this.renderedTransform_ = createTransform();\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.hitDetectionInstructions = instructions.hitDetectionInstructions;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.pixelCoordinates_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.viewRotation_ = 0;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").FillState>}\n */\n this.fillStates = instructions.fillStates || {};\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").StrokeState>}\n */\n this.strokeStates = instructions.strokeStates || {};\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").TextState>}\n */\n this.textStates = instructions.textStates || {};\n\n /**\n * @private\n * @type {Object<string, Object<string, number>>}\n */\n this.widths_ = {};\n\n /**\n * @private\n * @type {Object<string, import(\"../canvas.js\").Label>}\n */\n this.labels_ = {};\n\n /**\n * @private\n * @type {import(\"../canvas/ZIndexContext.js\").default}\n */\n this.zIndexContext_ = deferredRendering ? new ZIndexContext() : null;\n }\n\n /**\n * @return {ZIndexContext} ZIndex context.\n */\n getZIndexContext() {\n return this.zIndexContext_;\n }\n\n /**\n * @param {string|Array<string>} text Text.\n * @param {string} textKey Text style key.\n * @param {string} fillKey Fill style key.\n * @param {string} strokeKey Stroke style key.\n * @return {import(\"../canvas.js\").Label} Label.\n */\n createLabel(text, textKey, fillKey, strokeKey) {\n const key = text + textKey + fillKey + strokeKey;\n if (this.labels_[key]) {\n return this.labels_[key];\n }\n const strokeState = strokeKey ? this.strokeStates[strokeKey] : null;\n const fillState = fillKey ? this.fillStates[fillKey] : null;\n const textState = this.textStates[textKey];\n const pixelRatio = this.pixelRatio;\n const scale = [\n textState.scale[0] * pixelRatio,\n textState.scale[1] * pixelRatio,\n ];\n const align = textState.justify\n ? TEXT_ALIGN[textState.justify]\n : horizontalTextAlign(\n Array.isArray(text) ? text[0] : text,\n textState.textAlign || defaultTextAlign,\n );\n const strokeWidth =\n strokeKey && strokeState.lineWidth ? strokeState.lineWidth : 0;\n\n const chunks = Array.isArray(text)\n ? text\n : String(text).split('\\n').reduce(createTextChunks, []);\n\n const {width, height, widths, heights, lineWidths} = getTextDimensions(\n textState,\n chunks,\n );\n const renderWidth = width + strokeWidth;\n const contextInstructions = [];\n // make canvas 2 pixels wider to account for italic text width measurement errors\n const w = (renderWidth + 2) * scale[0];\n const h = (height + strokeWidth) * scale[1];\n /** @type {import(\"../canvas.js\").Label} */\n const label = {\n width: w < 0 ? Math.floor(w) : Math.ceil(w),\n height: h < 0 ? Math.floor(h) : Math.ceil(h),\n contextInstructions: contextInstructions,\n };\n if (scale[0] != 1 || scale[1] != 1) {\n contextInstructions.push('scale', scale);\n }\n if (strokeKey) {\n contextInstructions.push('strokeStyle', strokeState.strokeStyle);\n contextInstructions.push('lineWidth', strokeWidth);\n contextInstructions.push('lineCap', strokeState.lineCap);\n contextInstructions.push('lineJoin', strokeState.lineJoin);\n contextInstructions.push('miterLimit', strokeState.miterLimit);\n contextInstructions.push('setLineDash', [strokeState.lineDash]);\n contextInstructions.push('lineDashOffset', strokeState.lineDashOffset);\n }\n if (fillKey) {\n contextInstructions.push('fillStyle', fillState.fillStyle);\n }\n contextInstructions.push('textBaseline', 'middle');\n contextInstructions.push('textAlign', 'center');\n const leftRight = 0.5 - align;\n let x = align * renderWidth + leftRight * strokeWidth;\n const strokeInstructions = [];\n const fillInstructions = [];\n let lineHeight = 0;\n let lineOffset = 0;\n let widthHeightIndex = 0;\n let lineWidthIndex = 0;\n let previousFont;\n for (let i = 0, ii = chunks.length; i < ii; i += 2) {\n const text = chunks[i];\n if (text === '\\n') {\n lineOffset += lineHeight;\n lineHeight = 0;\n x = align * renderWidth + leftRight * strokeWidth;\n ++lineWidthIndex;\n continue;\n }\n const font = chunks[i + 1] || textState.font;\n if (font !== previousFont) {\n if (strokeKey) {\n strokeInstructions.push('font', font);\n }\n if (fillKey) {\n fillInstructions.push('font', font);\n }\n previousFont = font;\n }\n lineHeight = Math.max(lineHeight, heights[widthHeightIndex]);\n const fillStrokeArgs = [\n text,\n x +\n leftRight * widths[widthHeightIndex] +\n align * (widths[widthHeightIndex] - lineWidths[lineWidthIndex]),\n 0.5 * (strokeWidth + lineHeight) + lineOffset,\n ];\n x += widths[widthHeightIndex];\n if (strokeKey) {\n strokeInstructions.push('strokeText', fillStrokeArgs);\n }\n if (fillKey) {\n fillInstructions.push('fillText', fillStrokeArgs);\n }\n ++widthHeightIndex;\n }\n Array.prototype.push.apply(contextInstructions, strokeInstructions);\n Array.prototype.push.apply(contextInstructions, fillInstructions);\n this.labels_[key] = label;\n return label;\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../coordinate.js\").Coordinate} p1 1st point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p2 2nd point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p3 3rd point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p4 4th point of the background box.\n * @param {Array<*>} fillInstruction Fill instruction.\n * @param {Array<*>} strokeInstruction Stroke instruction.\n */\n replayTextBackground_(\n context,\n p1,\n p2,\n p3,\n p4,\n fillInstruction,\n strokeInstruction,\n ) {\n context.beginPath();\n context.moveTo.apply(context, p1);\n context.lineTo.apply(context, p2);\n context.lineTo.apply(context, p3);\n context.lineTo.apply(context, p4);\n context.lineTo.apply(context, p1);\n if (fillInstruction) {\n this.alignAndScaleFill_ = /** @type {number} */ (fillInstruction[2]);\n context.fillStyle = /** @type {string} */ (fillInstruction[1]);\n this.fill_(context);\n }\n if (strokeInstruction) {\n this.setStrokeStyle_(\n context,\n /** @type {Array<*>} */ (strokeInstruction),\n );\n context.stroke();\n }\n }\n\n /**\n * @private\n * @param {number} sheetWidth Width of the sprite sheet.\n * @param {number} sheetHeight Height of the sprite sheet.\n * @param {number} centerX X.\n * @param {number} centerY Y.\n * @param {number} width Width.\n * @param {number} height Height.\n * @param {number} anchorX Anchor X.\n * @param {number} anchorY Anchor Y.\n * @param {number} originX Origin X.\n * @param {number} originY Origin Y.\n * @param {number} rotation Rotation.\n * @param {import(\"../../size.js\").Size} scale Scale.\n * @param {boolean} snapToPixel Snap to pixel.\n * @param {Array<number>} padding Padding.\n * @param {boolean} fillStroke Background fill or stroke.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @return {ImageOrLabelDimensions} Dimensions for positioning and decluttering the image or label.\n */\n calculateImageOrLabelDimensions_(\n sheetWidth,\n sheetHeight,\n centerX,\n centerY,\n width,\n height,\n anchorX,\n anchorY,\n originX,\n originY,\n rotation,\n scale,\n snapToPixel,\n padding,\n fillStroke,\n feature,\n ) {\n anchorX *= scale[0];\n anchorY *= scale[1];\n let x = centerX - anchorX;\n let y = centerY - anchorY;\n\n const w = width + originX > sheetWidth ? sheetWidth - originX : width;\n const h = height + originY > sheetHeight ? sheetHeight - originY : height;\n const boxW = padding[3] + w * scale[0] + padding[1];\n const boxH = padding[0] + h * scale[1] + padding[2];\n const boxX = x - padding[3];\n const boxY = y - padding[0];\n\n if (fillStroke || rotation !== 0) {\n p1[0] = boxX;\n p4[0] = boxX;\n p1[1] = boxY;\n p2[1] = boxY;\n p2[0] = boxX + boxW;\n p3[0] = p2[0];\n p3[1] = boxY + boxH;\n p4[1] = p3[1];\n }\n\n let transform;\n if (rotation !== 0) {\n transform = composeTransform(\n createTransform(),\n centerX,\n centerY,\n 1,\n 1,\n rotation,\n -centerX,\n -centerY,\n );\n\n applyTransform(transform, p1);\n applyTransform(transform, p2);\n applyTransform(transform, p3);\n applyTransform(transform, p4);\n createOrUpdate(\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1]),\n tmpExtent,\n );\n } else {\n createOrUpdate(\n Math.min(boxX, boxX + boxW),\n Math.min(boxY, boxY + boxH),\n Math.max(boxX, boxX + boxW),\n Math.max(boxY, boxY + boxH),\n tmpExtent,\n );\n }\n if (snapToPixel) {\n x = Math.round(x);\n y = Math.round(y);\n }\n return {\n drawImageX: x,\n drawImageY: y,\n drawImageW: w,\n drawImageH: h,\n originX: originX,\n originY: originY,\n declutterBox: {\n minX: tmpExtent[0],\n minY: tmpExtent[1],\n maxX: tmpExtent[2],\n maxY: tmpExtent[3],\n value: feature,\n },\n canvasTransform: transform,\n scale: scale,\n };\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size.\n * @param {import(\"../canvas.js\").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.\n * @param {ImageOrLabelDimensions} dimensions Dimensions.\n * @param {number} opacity Opacity.\n * @param {Array<*>} fillInstruction Fill instruction.\n * @param {Array<*>} strokeInstruction Stroke instruction.\n * @return {boolean} The image or label was rendered.\n */\n replayImageOrLabel_(\n context,\n scaledCanvasSize,\n imageOrLabel,\n dimensions,\n opacity,\n fillInstruction,\n strokeInstruction,\n ) {\n const fillStroke = !!(fillInstruction || strokeInstruction);\n\n const box = dimensions.declutterBox;\n const strokePadding = strokeInstruction\n ? (strokeInstruction[2] * dimensions.scale[0]) / 2\n : 0;\n const intersects =\n box.minX - strokePadding <= scaledCanvasSize[0] &&\n box.maxX + strokePadding >= 0 &&\n box.minY - strokePadding <= scaledCanvasSize[1] &&\n box.maxY + strokePadding >= 0;\n\n if (intersects) {\n if (fillStroke) {\n this.replayTextBackground_(\n context,\n p1,\n p2,\n p3,\n p4,\n /** @type {Array<*>} */ (fillInstruction),\n /** @type {Array<*>} */ (strokeInstruction),\n );\n }\n drawImageOrLabel(\n context,\n dimensions.canvasTransform,\n opacity,\n imageOrLabel,\n dimensions.originX,\n dimensions.originY,\n dimensions.drawImageW,\n dimensions.drawImageH,\n dimensions.drawImageX,\n dimensions.drawImageY,\n dimensions.scale,\n );\n }\n return true;\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n */\n fill_(context) {\n const alignAndScale = this.alignAndScaleFill_;\n if (alignAndScale) {\n const origin = applyTransform(this.renderedTransform_, [0, 0]);\n const repeatSize = 512 * this.pixelRatio;\n context.save();\n context.translate(origin[0] % repeatSize, origin[1] % repeatSize);\n if (alignAndScale !== 1) {\n context.scale(alignAndScale, alignAndScale);\n }\n }\n context.fill();\n if (alignAndScale) {\n context.restore();\n }\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n * @param {Array<*>} instruction Instruction.\n */\n setStrokeStyle_(context, instruction) {\n context.strokeStyle =\n /** @type {import(\"../../colorlike.js\").ColorLike} */ (instruction[1]);\n if (!instruction[1]) {\n return;\n }\n context.lineWidth = /** @type {number} */ (instruction[2]);\n context.lineCap = /** @type {CanvasLineCap} */ (instruction[3]);\n context.lineJoin = /** @type {CanvasLineJoin} */ (instruction[4]);\n context.miterLimit = /** @type {number} */ (instruction[5]);\n context.lineDashOffset = /** @type {number} */ (instruction[7]);\n context.setLineDash(/** @type {Array<number>} */ (instruction[6]));\n }\n\n /**\n * @private\n * @param {string|Array<string>} text The text to draw.\n * @param {string} textKey The key of the text state.\n * @param {string} strokeKey The key for the stroke state.\n * @param {string} fillKey The key for the fill state.\n * @return {{label: import(\"../canvas.js\").Label, anchorX: number, anchorY: number}} The text image and its anchor.\n */\n drawLabelWithPointPlacement_(text, textKey, strokeKey, fillKey) {\n const textState = this.textStates[textKey];\n\n const label = this.createLabel(text, textKey, fillKey, strokeKey);\n\n const strokeState = this.strokeStates[strokeKey];\n const pixelRatio = this.pixelRatio;\n const align = horizontalTextAlign(\n Array.isArray(text) ? text[0] : text,\n textState.textAlign || defaultTextAlign,\n );\n const baseline = TEXT_ALIGN[textState.textBaseline || defaultTextBaseline];\n const strokeWidth =\n strokeState && strokeState.lineWidth ? strokeState.lineWidth : 0;\n\n // Remove the 2 pixels we added in createLabel() for the anchor\n const width = label.width / pixelRatio - 2 * textState.scale[0];\n const anchorX = align * width + 2 * (0.5 - align) * strokeWidth;\n const anchorY =\n (baseline * label.height) / pixelRatio +\n 2 * (0.5 - baseline) * strokeWidth;\n\n return {\n label: label,\n anchorX: anchorX,\n anchorY: anchorY,\n };\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array<*>} instructions Instructions array.\n * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.\n * @param {FeatureCallback<T>} [featureCallback] Feature callback.\n * @param {import(\"../../extent.js\").Extent} [hitExtent] Only check\n * features that intersect this extent.\n * @param {import(\"rbush\").default<DeclutterEntry>} [declutterTree] Declutter tree.\n * @return {T|undefined} Callback result.\n * @template T\n */\n execute_(\n context,\n scaledCanvasSize,\n transform,\n instructions,\n snapToPixel,\n featureCallback,\n hitExtent,\n declutterTree,\n ) {\n const zIndexContext = this.zIndexContext_;\n /** @type {Array<number>} */\n let pixelCoordinates;\n if (this.pixelCoordinates_ && equals(transform, this.renderedTransform_)) {\n pixelCoordinates = this.pixelCoordinates_;\n } else {\n if (!this.pixelCoordinates_) {\n this.pixelCoordinates_ = [];\n }\n pixelCoordinates = transform2D(\n this.coordinates,\n 0,\n this.coordinates.length,\n 2,\n transform,\n this.pixelCoordinates_,\n );\n transformSetFromArray(this.renderedTransform_, transform);\n }\n let i = 0; // instruction index\n const ii = instructions.length; // end of instructions\n let d = 0; // data index\n let dd; // end of per-instruction data\n let anchorX,\n anchorY,\n lineOffsetPx,\n /** @type {boolean} */ isClosedRing,\n /** @type {number} */ dStart,\n /** @type {import('../../style/Style.js').DeclutterMode} */\n declutterMode,\n prevX,\n prevY,\n roundX,\n roundY,\n image,\n text,\n textKey,\n strokeKey,\n fillKey;\n let pendingFill = 0;\n let pendingStroke = 0;\n const coordinateCache = this.coordinateCache_;\n const viewRotation = this.viewRotation_;\n const viewRotationFromTransform =\n Math.round(Math.atan2(-transform[1], transform[0]) * 1e12) / 1e12;\n\n const state = /** @type {import(\"../../render.js\").State} */ ({\n context: context,\n pixelRatio: this.pixelRatio,\n resolution: this.resolution,\n rotation: viewRotation,\n });\n\n // When the batch size gets too big, performance decreases. 200 is a good\n // balance between batch size and number of fill/stroke instructions.\n const batchSize =\n this.instructions != instructions || this.overlaps ? 0 : 200;\n let /** @type {import(\"../../Feature.js\").FeatureLike} */ feature;\n let x, y, currentGeometry;\n while (i < ii) {\n const instruction = instructions[i];\n const type = /** @type {import(\"./Instruction.js\").default} */ (\n instruction[0]\n );\n switch (type) {\n case CanvasInstruction.BEGIN_GEOMETRY:\n feature = /** @type {import(\"../../Feature.js\").FeatureLike} */ (\n instruction[1]\n );\n currentGeometry = instruction[3];\n if (!feature.getGeometry()) {\n i = /** @type {number} */ (instruction[2]);\n } else if (\n hitExtent !== undefined &&\n !intersects(hitExtent, currentGeometry.getExtent())\n ) {\n i = /** @type {number} */ (instruction[2]) + 1;\n } else {\n ++i;\n }\n if (zIndexContext) {\n zIndexContext.zIndex = instruction[4];\n }\n break;\n case CanvasInstruction.BEGIN_PATH:\n if (pendingFill > batchSize) {\n this.fill_(context);\n pendingFill = 0;\n }\n if (pendingStroke > batchSize) {\n context.stroke();\n pendingStroke = 0;\n }\n if (!pendingFill && !pendingStroke) {\n context.beginPath();\n prevX = NaN;\n prevY = NaN;\n }\n ++i;\n break;\n case CanvasInstruction.CIRCLE:\n d = /** @type {number} */ (instruction[1]);\n lineOffsetPx = /** @type {number} */ instruction[2] ?? 0;\n const x1 = pixelCoordinates[d];\n const y1 = pixelCoordinates[d + 1];\n const x2 = pixelCoordinates[d + 2] - lineOffsetPx;\n const y2 = pixelCoordinates[d + 3] - lineOffsetPx;\n const dx = x2 - x1;\n const dy = y2 - y1;\n const r = Math.sqrt(dx * dx + dy * dy);\n context.moveTo(x1 + r, y1);\n context.arc(x1, y1, r, 0, 2 * Math.PI, true);\n ++i;\n break;\n case CanvasInstruction.CLOSE_PATH:\n context.closePath();\n ++i;\n break;\n case CanvasInstruction.CUSTOM:\n d = /** @type {number} */ (instruction[1]);\n dd = instruction[2];\n const geometry =\n /** @type {import(\"../../geom/SimpleGeometry.js\").default} */ (\n instruction[3]\n );\n const renderer = instruction[4];\n const fn = instruction[5];\n state.geometry = geometry;\n state.feature = feature;\n if (!(i in coordinateCache)) {\n coordinateCache[i] = [];\n }\n const coords = coordinateCache[i];\n if (fn) {\n fn(pixelCoordinates, d, dd, 2, coords);\n } else {\n coords[0] = pixelCoordinates[d];\n coords[1] = pixelCoordinates[d + 1];\n coords.length = 2;\n }\n if (zIndexContext) {\n zIndexContext.zIndex = instruction[6];\n }\n renderer(coords, state);\n ++i;\n break;\n case CanvasInstruction.DRAW_IMAGE:\n d = /** @type {number} */ (instruction[1]);\n dd = /** @type {number} */ (instruction[2]);\n image =\n /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */ (\n instruction[3]\n );\n\n // Remaining arguments in DRAW_IMAGE are in alphabetical order\n anchorX = /** @type {number} */ (instruction[4]);\n anchorY = /** @type {number} */ (instruction[5]);\n let height = /** @type {number} */ (instruction[6]);\n const opacity = /** @type {number} */ (instruction[7]);\n const originX = /** @type {number} */ (instruction[8]);\n const originY = /** @type {number} */ (instruction[9]);\n const rotateWithView = /** @type {boolean} */ (instruction[10]);\n let rotation = /** @type {number} */ (instruction[11]);\n const scale = /** @type {import(\"../../size.js\").Size} */ (\n instruction[12]\n );\n let width = /** @type {number} */ (instruction[13]);\n declutterMode = instruction[14] || 'declutter';\n const declutterImageWithText =\n /** @type {{args: import(\"../canvas.js\").DeclutterImageWithText, declutterMode: import('../../style/Style.js').DeclutterMode}} */ (\n instruction[15]\n );\n\n if (!image && instruction.length >= 20) {\n // create label images\n text = /** @type {string} */ (instruction[19]);\n textKey = /** @type {string} */ (instruction[20]);\n strokeKey = /** @type {string} */ (instruction[21]);\n fillKey = /** @type {string} */ (instruction[22]);\n const labelWithAnchor = this.drawLabelWithPointPlacement_(\n text,\n textKey,\n strokeKey,\n fillKey,\n );\n image = labelWithAnchor.label;\n instruction[3] = image;\n const textOffsetX = /** @type {number} */ (instruction[23]);\n anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;\n instruction[4] = anchorX;\n const textOffsetY = /** @type {number} */ (instruction[24]);\n anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;\n instruction[5] = anchorY;\n height = image.height;\n instruction[6] = height;\n width = image.width;\n instruction[13] = width;\n }\n\n let geometryWidths;\n if (instruction.length > 25) {\n geometryWidths = /** @type {number} */ (instruction[25]);\n }\n\n let padding, backgroundFillInstruction, backgroundStrokeInstruction;\n if (instruction.length > 17) {\n padding = /** @type {Array<number>} */ (instruction[16]);\n backgroundFillInstruction = /** @type {Array<*>} */ (\n instruction[17]\n );\n backgroundStrokeInstruction = /** @type {Array<*>} */ (\n instruction[18]\n );\n } else {\n padding = defaultPadding;\n backgroundFillInstruction = null;\n backgroundStrokeInstruction = null;\n }\n\n if (rotateWithView && viewRotationFromTransform) {\n // Canvas is expected to be rotated to reverse view rotation.\n rotation += viewRotation;\n } else if (!rotateWithView && !viewRotationFromTransform) {\n // Canvas is not rotated, images need to be rotated back to be north-up.\n rotation -= viewRotation;\n }\n let widthIndex = 0;\n for (; d < dd; d += 2) {\n if (\n geometryWidths &&\n geometryWidths[widthIndex++] < width / this.pixelRatio\n ) {\n continue;\n }\n const dimensions = this.calculateImageOrLabelDimensions_(\n image.width,\n image.height,\n pixelCoordinates[d],\n pixelCoordinates[d + 1],\n width,\n height,\n anchorX,\n anchorY,\n originX,\n originY,\n rotation,\n scale,\n snapToPixel,\n padding,\n !!backgroundFillInstruction || !!backgroundStrokeInstruction,\n feature,\n );\n /** @type {ReplayImageOrLabelArgs} */\n const args = [\n context,\n scaledCanvasSize,\n image,\n dimensions,\n opacity,\n backgroundFillInstruction,\n backgroundStrokeInstruction,\n ];\n if (declutterTree) {\n let imageArgs, imageDeclutterMode, imageDeclutterBox;\n if (declutterImageWithText) {\n const index = dd - d;\n if (!declutterImageWithText[index]) {\n // We now have the image for an image+text combination.\n declutterImageWithText[index] = {args, declutterMode};\n // Don't render anything for now, wait for the text.\n continue;\n }\n const imageDeclutter = declutterImageWithText[index];\n imageArgs = imageDeclutter.args;\n imageDeclutterMode = imageDeclutter.declutterMode;\n delete declutterImageWithText[index];\n imageDeclutterBox = getDeclutterBox(imageArgs);\n }\n // We now have image and text for an image+text combination.\n let renderImage, renderText;\n if (\n imageArgs &&\n (imageDeclutterMode !== 'declutter' ||\n !declutterTree.collides(imageDeclutterBox))\n ) {\n renderImage = true;\n }\n if (\n declutterMode !== 'declutter' ||\n !declutterTree.collides(dimensions.declutterBox)\n ) {\n renderText = true;\n }\n if (\n imageDeclutterMode === 'declutter' &&\n declutterMode === 'declutter'\n ) {\n const render = renderImage && renderText;\n renderImage = render;\n renderText = render;\n }\n if (renderImage) {\n if (imageDeclutterMode !== 'none') {\n declutterTree.insert(imageDeclutterBox);\n }\n this.replayImageOrLabel_.apply(this, imageArgs);\n }\n if (renderText) {\n if (declutterMode !== 'none') {\n declutterTree.insert(dimensions.declutterBox);\n }\n this.replayImageOrLabel_.apply(this, args);\n }\n } else {\n this.replayImageOrLabel_.apply(this, args);\n }\n }\n ++i;\n break;\n case CanvasInstruction.DRAW_CHARS:\n const begin = /** @type {number} */ (instruction[1]);\n const end = /** @type {number} */ (instruction[2]);\n const baseline = /** @type {number} */ (instruction[3]);\n const overflow = /** @type {number} */ (instruction[4]);\n fillKey = /** @type {string} */ (instruction[5]);\n const maxAngle = /** @type {number} */ (instruction[6]);\n const measurePixelRatio = /** @type {number} */ (instruction[7]);\n const offsetY = /** @type {number} */ (instruction[8]);\n strokeKey = /** @type {string} */ (instruction[9]);\n const strokeWidth = /** @type {number} */ (instruction[10]);\n text = /** @type {string|Array<string>} */ (instruction[11]);\n if (Array.isArray(text)) {\n //FIXME Add support for rich text along lines\n text = text.reduce(richTextToPlainText, '');\n }\n textKey = /** @type {string} */ (instruction[12]);\n const pixelRatioScale = [\n /** @type {number} */ (instruction[13]),\n /** @type {number} */ (instruction[13]),\n ];\n declutterMode = instruction[14] || 'declutter';\n\n const textKeepUpright = /** @type {boolean} */ (instruction[15]);\n const textState = this.textStates[textKey];\n const font = textState.font;\n const textScale = [\n textState.scale[0] * measurePixelRatio,\n textState.scale[1] * measurePixelRatio,\n ];\n\n let cachedWidths;\n if (font in this.widths_) {\n cachedWidths = this.widths_[font];\n } else {\n cachedWidths = {};\n this.widths_[font] = cachedWidths;\n }\n\n const pathLength = lineStringLength(pixelCoordinates, begin, end, 2);\n const textLength =\n Math.abs(textScale[0]) *\n measureAndCacheTextWidth(font, text, cachedWidths);\n if (overflow || textLength <= pathLength) {\n const textAlign = this.textStates[textKey].textAlign;\n const startM =\n (pathLength - textLength) * horizontalTextAlign(text, textAlign);\n const parts = drawTextOnPath(\n pixelCoordinates,\n begin,\n end,\n 2,\n text,\n startM,\n maxAngle,\n Math.abs(textScale[0]),\n measureAndCacheTextWidth,\n font,\n cachedWidths,\n viewRotationFromTransform ? 0 : this.viewRotation_,\n textKeepUpright,\n );\n drawChars: if (parts) {\n /** @type {Array<ReplayImageOrLabelArgs>} */\n const replayImageOrLabelArgs = [];\n let c, cc, chars, label, part;\n if (strokeKey) {\n for (c = 0, cc = parts.length; c < cc; ++c) {\n part = parts[c]; // x, y, anchorX, rotation, chunk\n chars = /** @type {string} */ (part[4]);\n label = this.createLabel(chars, textKey, '', strokeKey);\n anchorX =\n /** @type {number} */ (part[2]) +\n (textScale[0] < 0 ? -strokeWidth : strokeWidth);\n anchorY =\n baseline * label.height +\n ((0.5 - baseline) * 2 * strokeWidth * textScale[1]) /\n textScale[0] -\n offsetY;\n const dimensions = this.calculateImageOrLabelDimensions_(\n label.width,\n label.height,\n part[0],\n part[1],\n label.width,\n label.height,\n anchorX,\n anchorY,\n 0,\n 0,\n part[3],\n pixelRatioScale,\n false,\n defaultPadding,\n false,\n feature,\n );\n if (\n declutterTree &&\n declutterMode === 'declutter' &&\n declutterTree.collides(dimensions.declutterBox)\n ) {\n break drawChars;\n }\n replayImageOrLabelArgs.push([\n context,\n scaledCanvasSize,\n label,\n dimensions,\n 1,\n null,\n null,\n ]);\n }\n }\n if (fillKey) {\n for (c = 0, cc = parts.length; c < cc; ++c) {\n part = parts[c]; // x, y, anchorX, rotation, chunk\n chars = /** @type {string} */ (part[4]);\n label = this.createLabel(chars, textKey, fillKey, '');\n anchorX = /** @type {number} */ (part[2]);\n anchorY = baseline * label.height - offsetY;\n const dimensions = this.calculateImageOrLabelDimensions_(\n label.width,\n label.height,\n part[0],\n part[1],\n label.width,\n label.height,\n anchorX,\n anchorY,\n 0,\n 0,\n part[3],\n pixelRatioScale,\n false,\n defaultPadding,\n false,\n feature,\n );\n if (\n declutterTree &&\n declutterMode === 'declutter' &&\n declutterTree.collides(dimensions.declutterBox)\n ) {\n break drawChars;\n }\n replayImageOrLabelArgs.push([\n context,\n scaledCanvasSize,\n label,\n dimensions,\n 1,\n null,\n null,\n ]);\n }\n }\n if (declutterTree && declutterMode !== 'none') {\n declutterTree.load(replayImageOrLabelArgs.map(getDeclutterBox));\n }\n for (let i = 0, ii = replayImageOrLabelArgs.length; i < ii; ++i) {\n this.replayImageOrLabel_.apply(this, replayImageOrLabelArgs[i]);\n }\n }\n }\n ++i;\n break;\n case CanvasInstruction.END_GEOMETRY:\n if (featureCallback !== undefined) {\n feature = /** @type {import(\"../../Feature.js\").FeatureLike} */ (\n instruction[1]\n );\n const result = featureCallback(\n feature,\n currentGeometry,\n declutterMode,\n );\n if (result) {\n return result;\n }\n }\n ++i;\n break;\n case CanvasInstruction.FILL:\n if (batchSize) {\n pendingFill++;\n } else {\n this.fill_(context);\n }\n ++i;\n break;\n case CanvasInstruction.MOVE_TO_LINE_TO:\n d = /** @type {number} */ (instruction[1]);\n dd = /** @type {number} */ (instruction[2]);\n lineOffsetPx = /** @type {number|undefined} */ (instruction[3]);\n isClosedRing =\n /** @type {boolean|undefined} */ (instruction[4]) ?? false;\n x = pixelCoordinates[d];\n y = pixelCoordinates[d + 1];\n\n if (lineOffsetPx) {\n dStart = d;\n [x, y] = offsetLineVertex(\n x,\n y,\n isClosedRing ? pixelCoordinates[dd - 4] : undefined,\n isClosedRing ? pixelCoordinates[dd - 3] : undefined,\n pixelCoordinates[d + 2],\n pixelCoordinates[d + 3],\n lineOffsetPx,\n );\n }\n\n context.moveTo(x, y);\n prevX = (x + 0.5) | 0;\n prevY = (y + 0.5) | 0;\n for (d += 2; d < dd; d += 2) {\n x = pixelCoordinates[d];\n y = pixelCoordinates[d + 1];\n roundX = (x + 0.5) | 0;\n roundY = (y + 0.5) | 0;\n if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {\n if (lineOffsetPx) {\n if (d == dd - 2) {\n // last coordinate\n [x, y] = offsetLineVertex(\n x,\n y,\n pixelCoordinates[d - 2],\n pixelCoordinates[d - 1],\n isClosedRing ? pixelCoordinates[dStart + 2] : undefined,\n isClosedRing ? pixelCoordinates[dStart + 3] : undefined,\n lineOffsetPx,\n );\n } else {\n [x, y] = offsetLineVertex(\n x,\n y,\n pixelCoordinates[d - 2],\n pixelCoordinates[d - 1],\n pixelCoordinates[d + 2],\n pixelCoordinates[d + 3],\n lineOffsetPx,\n );\n }\n }\n\n context.lineTo(x, y);\n prevX = roundX;\n prevY = roundY;\n }\n }\n ++i;\n break;\n case CanvasInstruction.SET_FILL_STYLE:\n this.alignAndScaleFill_ = instruction[2];\n\n if (pendingFill) {\n this.fill_(context);\n pendingFill = 0;\n if (pendingStroke) {\n context.stroke();\n pendingStroke = 0;\n }\n }\n\n /** @type {import(\"../../colorlike.js\").ColorLike} */\n context.fillStyle = instruction[1];\n ++i;\n break;\n case CanvasInstruction.SET_STROKE_STYLE:\n if (pendingStroke) {\n context.stroke();\n pendingStroke = 0;\n }\n this.setStrokeStyle_(context, /** @type {Array<*>} */ (instruction));\n ++i;\n break;\n case CanvasInstruction.STROKE:\n if (batchSize) {\n pendingStroke++;\n } else {\n context.stroke();\n }\n ++i;\n break;\n default: // consume the instruction anyway, to avoid an infinite loop\n ++i;\n break;\n }\n }\n if (pendingFill) {\n this.fill_(context);\n }\n if (pendingStroke) {\n context.stroke();\n }\n return undefined;\n }\n\n /**\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.\n * @param {import(\"rbush\").default<DeclutterEntry>} [declutterTree] Declutter tree.\n */\n execute(\n context,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n declutterTree,\n ) {\n this.viewRotation_ = viewRotation;\n this.execute_(\n context,\n scaledCanvasSize,\n transform,\n this.instructions,\n snapToPixel,\n undefined,\n undefined,\n declutterTree,\n );\n }\n\n /**\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {FeatureCallback<T>} [featureCallback] Feature callback.\n * @param {import(\"../../extent.js\").Extent} [hitExtent] Only check\n * features that intersect this extent.\n * @return {T|undefined} Callback result.\n * @template T\n */\n executeHitDetection(\n context,\n transform,\n viewRotation,\n featureCallback,\n hitExtent,\n ) {\n this.viewRotation_ = viewRotation;\n return this.execute_(\n context,\n [context.canvas.width, context.canvas.height],\n transform,\n this.hitDetectionInstructions,\n true,\n featureCallback,\n hitExtent,\n );\n }\n}\n\nexport default Executor;\n", "/**\n * @module ol/render/canvas/ExecutorGroup\n */\n\nimport {ascending, descending} from '../../array.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {buffer, createEmpty, extendCoordinate} from '../../extent.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {isEmpty} from '../../obj.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport Executor from './Executor.js';\n\n/**\n * @const\n * @type {Array<import(\"../canvas.js\").BuilderType>}\n */\nexport const ALL = [\n 'Polygon',\n 'Circle',\n 'LineString',\n 'Image',\n 'Text',\n 'Default',\n];\n\n/**\n * @const\n * @type {Array<import(\"../canvas.js\").BuilderType>}\n */\nexport const DECLUTTER = ['Image', 'Text'];\n\n/**\n * @const\n * @type {Array<import(\"../canvas.js\").BuilderType>}\n */\nexport const NON_DECLUTTER = ALL.filter(\n (builderType) => !DECLUTTER.includes(builderType),\n);\n\n/** @type {boolean|undefined} */\nlet willReadFrequently = false;\n\n/** @type {boolean|undefined} */\nlet canvasReadsBenchmarked = false;\n\n/** Determine if canvas read operations are faster with willReadFrequently set to true or false */\nfunction benchmarkCanvasReads() {\n let bestResult = 0;\n /**\n * @param {boolean} willReadFrequently Will read frequently.\n * @return {number} Operation count.\n */\n const measure = (willReadFrequently) => {\n const context = createCanvasContext2D(1, 1, null, {willReadFrequently});\n let count = 0;\n const start = performance.now();\n for (; performance.now() - start < 50; ++count) {\n context.fillStyle = `rgba(255,0,${count % 256},1)`;\n context.fillRect(0, 0, 1, 1);\n context.getImageData(0, 0, 1, 1);\n }\n bestResult = count > bestResult ? count : bestResult;\n return count;\n };\n\n const measures = {\n [measure(true)]: true,\n [measure(false)]: false,\n [measure(undefined)]: undefined,\n };\n willReadFrequently = measures[bestResult];\n canvasReadsBenchmarked = true;\n}\n\nclass ExecutorGroup {\n /**\n * @param {import(\"../../extent.js\").Extent} maxExtent Max extent for clipping. When a\n * `maxExtent` was set on the Builder for this executor group, the same `maxExtent`\n * should be set here, unless the target context does not exceed that extent (which\n * can be the case when rendering to tiles).\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {boolean} overlaps The executor group can have overlapping geometries.\n * @param {!Object<string, !Object<import(\"../canvas.js\").BuilderType, import(\"../canvas.js\").SerializableInstructions>>} allInstructions\n * The serializable instructions.\n * @param {number} [renderBuffer] Optional rendering buffer.\n * @param {boolean} [deferredRendering] Enable deferred rendering with renderDeferred().\n */\n constructor(\n maxExtent,\n resolution,\n pixelRatio,\n overlaps,\n allInstructions,\n renderBuffer,\n deferredRendering,\n ) {\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent_ = maxExtent;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overlaps_ = overlaps;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.resolution_ = resolution;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderBuffer_ = renderBuffer;\n\n /**\n * @private\n * @type {!Object<string, !Object<string, import(\"./Executor\").default>>}\n */\n this.executorsByZIndex_ = {};\n\n /**\n * @private\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}\n */\n this.hitDetectionContext_ = null;\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.hitDetectionTransform_ = createTransform();\n\n /**\n * @private\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}\n */\n this.renderedContext_ = null;\n\n /**\n * @private\n * @type {Object<number, Array<import(\"./ZIndexContext.js\").default>>}\n */\n this.deferredZIndexContexts_ = {};\n\n this.createExecutors_(allInstructions, deferredRendering);\n }\n\n /**\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n */\n clip(context, transform) {\n const flatClipCoords = this.getClipCoords(transform);\n context.beginPath();\n context.moveTo(flatClipCoords[0], flatClipCoords[1]);\n context.lineTo(flatClipCoords[2], flatClipCoords[3]);\n context.lineTo(flatClipCoords[4], flatClipCoords[5]);\n context.lineTo(flatClipCoords[6], flatClipCoords[7]);\n context.clip();\n }\n\n /**\n * Create executors and populate them using the provided instructions.\n * @private\n * @param {!Object<string, !Object<string, import(\"../canvas.js\").SerializableInstructions>>} allInstructions The serializable instructions\n * @param {boolean} deferredRendering Enable deferred rendering.\n */\n createExecutors_(allInstructions, deferredRendering) {\n for (const zIndex in allInstructions) {\n let executors = this.executorsByZIndex_[zIndex];\n if (executors === undefined) {\n executors = {};\n this.executorsByZIndex_[zIndex] = executors;\n }\n const instructionByZindex = allInstructions[zIndex];\n for (const builderType in instructionByZindex) {\n const instructions = instructionByZindex[builderType];\n executors[builderType] = new Executor(\n this.resolution_,\n this.pixelRatio_,\n this.overlaps_,\n instructions,\n deferredRendering,\n );\n }\n }\n }\n\n /**\n * @param {Array<import(\"../canvas.js\").BuilderType>} executors Executors.\n * @return {boolean} Has executors of the provided types.\n */\n hasExecutors(executors) {\n for (const zIndex in this.executorsByZIndex_) {\n const candidates = this.executorsByZIndex_[zIndex];\n for (let i = 0, ii = executors.length; i < ii; ++i) {\n if (executors[i] in candidates) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {function(import(\"../../Feature.js\").FeatureLike, import(\"../../geom/SimpleGeometry.js\").default, number): T} callback Feature callback.\n * @param {Array<import(\"../../Feature.js\").FeatureLike>} declutteredFeatures Decluttered features.\n * @return {T|undefined} Callback result.\n * @template T\n */\n forEachFeatureAtCoordinate(\n coordinate,\n resolution,\n rotation,\n hitTolerance,\n callback,\n declutteredFeatures,\n ) {\n if (canvasReadsBenchmarked === false) {\n benchmarkCanvasReads();\n }\n\n hitTolerance = Math.round(hitTolerance);\n const contextSize = hitTolerance * 2 + 1;\n const transform = composeTransform(\n this.hitDetectionTransform_,\n hitTolerance + 0.5,\n hitTolerance + 0.5,\n 1 / resolution,\n -1 / resolution,\n -rotation,\n -coordinate[0],\n -coordinate[1],\n );\n\n const newContext = !this.hitDetectionContext_;\n if (newContext) {\n this.hitDetectionContext_ = createCanvasContext2D(\n contextSize,\n contextSize,\n null,\n {willReadFrequently},\n );\n }\n const context = this.hitDetectionContext_;\n\n if (\n context.canvas.width !== contextSize ||\n context.canvas.height !== contextSize\n ) {\n context.canvas.width = contextSize;\n context.canvas.height = contextSize;\n } else if (!newContext) {\n context.clearRect(0, 0, contextSize, contextSize);\n }\n\n /** @type {import(\"../../extent.js\").Extent|undefined} */\n let hitExtent;\n if (this.renderBuffer_ !== undefined) {\n hitExtent = createEmpty();\n extendCoordinate(hitExtent, coordinate);\n buffer(\n hitExtent,\n resolution * (this.renderBuffer_ + hitTolerance),\n hitExtent,\n );\n }\n\n const indexes = getPixelIndexArray(hitTolerance);\n\n /** @type {import(\"../canvas.js\").BuilderType} */\n let builderType;\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import('../../style/Style.js').DeclutterMode} declutterMode Declutter mode.\n * @return {T|undefined} Callback result.\n */\n function featureCallback(feature, geometry, declutterMode) {\n const imageData = context.getImageData(\n 0,\n 0,\n contextSize,\n contextSize,\n ).data;\n for (let i = 0, ii = indexes.length; i < ii; i++) {\n if (imageData[indexes[i]] > 0) {\n if (\n !declutteredFeatures ||\n declutterMode === 'none' ||\n (builderType !== 'Image' && builderType !== 'Text') ||\n declutteredFeatures.includes(feature)\n ) {\n const idx = (indexes[i] - 3) / 4;\n const x = hitTolerance - (idx % contextSize);\n const y = hitTolerance - ((idx / contextSize) | 0);\n const result = callback(feature, geometry, x * x + y * y);\n if (result) {\n return result;\n }\n }\n context.clearRect(0, 0, contextSize, contextSize);\n break;\n }\n }\n return undefined;\n }\n\n /** @type {Array<number>} */\n const zs = Object.keys(this.executorsByZIndex_).map(Number);\n zs.sort(ascending);\n\n let i, j, executors, executor, result;\n for (i = zs.length - 1; i >= 0; --i) {\n const zIndexKey = zs[i].toString();\n executors = this.executorsByZIndex_[zIndexKey];\n for (j = ALL.length - 1; j >= 0; --j) {\n builderType = ALL[j];\n executor = executors[builderType];\n if (executor !== undefined) {\n result = executor.executeHitDetection(\n context,\n transform,\n rotation,\n featureCallback,\n hitExtent,\n );\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n }\n\n /**\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @return {Array<number>|null} Clip coordinates.\n */\n getClipCoords(transform) {\n const maxExtent = this.maxExtent_;\n if (!maxExtent) {\n return null;\n }\n const minX = maxExtent[0];\n const minY = maxExtent[1];\n const maxX = maxExtent[2];\n const maxY = maxExtent[3];\n const flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY];\n transform2D(flatClipCoords, 0, 8, 2, transform, flatClipCoords);\n return flatClipCoords;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return isEmpty(this.executorsByZIndex_);\n }\n\n /**\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} targetContext Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scale of the context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {boolean} snapToPixel Snap point symbols and test to integer pixel.\n * @param {Array<import(\"../canvas.js\").BuilderType>} [builderTypes] Ordered replay types to replay.\n * Default is {@link module:ol/render/replay~ALL}\n * @param {import(\"rbush\").default<import('./Executor.js').DeclutterEntry>|null} [declutterTree] Declutter tree.\n * When set to null, no decluttering is done, even when the executor group has a `ZIndexContext`.\n */\n execute(\n targetContext,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n builderTypes,\n declutterTree,\n ) {\n const zs = Object.keys(this.executorsByZIndex_).map(Number);\n zs.sort(declutterTree ? descending : ascending);\n\n builderTypes = builderTypes ? builderTypes : ALL;\n const maxBuilderTypes = ALL.length;\n for (let i = 0, ii = zs.length; i < ii; ++i) {\n const zIndexKey = zs[i].toString();\n const replays = this.executorsByZIndex_[zIndexKey];\n for (let j = 0, jj = builderTypes.length; j < jj; ++j) {\n const builderType = builderTypes[j];\n const replay = replays[builderType];\n if (replay !== undefined) {\n const zIndexContext =\n declutterTree === null ? undefined : replay.getZIndexContext();\n const context = zIndexContext\n ? zIndexContext.getContext()\n : targetContext;\n const requireClip =\n this.maxExtent_ &&\n builderType !== 'Image' &&\n builderType !== 'Text';\n if (requireClip) {\n context.save();\n // setup clipping so that the parts of over-simplified geometries are not\n // visible outside the current extent when panning\n this.clip(context, transform);\n }\n if (\n !zIndexContext ||\n builderType === 'Text' ||\n builderType === 'Image'\n ) {\n replay.execute(\n context,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n declutterTree,\n );\n } else {\n zIndexContext.pushFunction((context) =>\n replay.execute(\n context,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n declutterTree,\n ),\n );\n }\n if (requireClip) {\n context.restore();\n }\n if (zIndexContext) {\n zIndexContext.offset();\n const index = zs[i] * maxBuilderTypes + ALL.indexOf(builderType);\n if (!this.deferredZIndexContexts_[index]) {\n this.deferredZIndexContexts_[index] = [];\n }\n this.deferredZIndexContexts_[index].push(zIndexContext);\n }\n }\n }\n }\n\n this.renderedContext_ = targetContext;\n }\n\n getDeferredZIndexContexts() {\n return this.deferredZIndexContexts_;\n }\n\n getRenderedContext() {\n return this.renderedContext_;\n }\n\n renderDeferred() {\n const deferredZIndexContexts = this.deferredZIndexContexts_;\n const zs = Object.keys(deferredZIndexContexts).map(Number).sort(ascending);\n for (let i = 0, ii = zs.length; i < ii; ++i) {\n deferredZIndexContexts[zs[i]].forEach((zIndexContext) => {\n zIndexContext.draw(this.renderedContext_); // FIXME Pass clip to replay for temporarily enabling clip\n zIndexContext.clear();\n });\n deferredZIndexContexts[zs[i]].length = 0;\n }\n }\n}\n\n/**\n * This cache is used to store arrays of indexes for calculated pixel circles\n * to increase performance.\n * It is a static property to allow each Replaygroup to access it.\n * @type {Object<number, Array<number>>}\n */\nconst circlePixelIndexArrayCache = {};\n\n/**\n * This methods creates an array with indexes of all pixels within a circle,\n * ordered by how close they are to the center.\n * A cache is used to increase performance.\n * @param {number} radius Radius.\n * @return {Array<number>} An array with indexes within a circle.\n */\nexport function getPixelIndexArray(radius) {\n if (circlePixelIndexArrayCache[radius] !== undefined) {\n return circlePixelIndexArrayCache[radius];\n }\n\n const size = radius * 2 + 1;\n const maxDistanceSq = radius * radius;\n const distances = new Array(maxDistanceSq + 1);\n for (let i = 0; i <= radius; ++i) {\n for (let j = 0; j <= radius; ++j) {\n const distanceSq = i * i + j * j;\n if (distanceSq > maxDistanceSq) {\n break;\n }\n let distance = distances[distanceSq];\n if (!distance) {\n distance = [];\n distances[distanceSq] = distance;\n }\n distance.push(((radius + i) * size + (radius + j)) * 4 + 3);\n if (i > 0) {\n distance.push(((radius - i) * size + (radius + j)) * 4 + 3);\n }\n if (j > 0) {\n distance.push(((radius + i) * size + (radius - j)) * 4 + 3);\n if (i > 0) {\n distance.push(((radius - i) * size + (radius - j)) * 4 + 3);\n }\n }\n }\n }\n\n const pixelIndex = [];\n for (let i = 0, ii = distances.length; i < ii; ++i) {\n if (distances[i]) {\n pixelIndex.push(...distances[i]);\n }\n }\n\n circlePixelIndexArrayCache[radius] = pixelIndex;\n return pixelIndex;\n}\n\nexport default ExecutorGroup;\n", "/**\n * @module ol/render/canvas/Immediate\n */\n// FIXME test, especially polygons with holes and multipolygons\n// FIXME need to handle large thick features (where pixel size matters)\n// FIXME add offset and end to ol/geom/flat/transform~transform2D?\n\nimport {equals} from '../../array.js';\nimport {asColorLike} from '../../colorlike.js';\nimport {intersects} from '../../extent.js';\nimport {transformGeom2D} from '../../geom/SimpleGeometry.js';\nimport {offsetLineString} from '../../geom/flat/lineoffset.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {toFixed} from '../../math.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport VectorContext from '../VectorContext.js';\nimport {\n defaultFillStyle,\n defaultFont,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n defaultTextAlign,\n defaultTextBaseline,\n} from '../canvas.js';\n\n/**\n * @classdesc\n * A concrete subclass of {@link module:ol/render/VectorContext~VectorContext} that implements\n * direct rendering of features and geometries to an HTML5 Canvas context.\n * Instances of this class are created internally by the library and\n * provided to application code as vectorContext member of the\n * {@link module:ol/render/Event~RenderEvent} object associated with postcompose, precompose and\n * render events emitted by layers and maps.\n */\nclass CanvasImmediateRenderer extends VectorContext {\n /**\n * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {number} [squaredTolerance] Optional squared tolerance for simplification.\n * @param {import(\"../../proj.js\").TransformFunction} [userTransform] Transform from user to view projection.\n */\n constructor(\n context,\n pixelRatio,\n extent,\n transform,\n viewRotation,\n squaredTolerance,\n userTransform,\n ) {\n super();\n\n /**\n * @private\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}\n */\n this.context_ = context;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.extent_ = extent;\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.transform_ = transform;\n\n /**\n * @private\n * @type {number}\n */\n this.transformRotation_ = transform\n ? toFixed(Math.atan2(transform[1], transform[0]), 10)\n : 0;\n\n /**\n * @private\n * @type {number}\n */\n this.viewRotation_ = viewRotation;\n\n /**\n * @private\n * @type {number}\n */\n this.squaredTolerance_ = squaredTolerance;\n\n /**\n * @private\n * @type {import(\"../../proj.js\").TransformFunction}\n */\n this.userTransform_ = userTransform;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.contextFillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.contextStrokeState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").TextState}\n */\n this.contextTextState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.fillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.strokeState_ = null;\n\n /**\n * @private\n * @type {import('../../DataTile.js').ImageLike}\n */\n this.image_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.imageAnchorX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageAnchorY_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageHeight_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOpacity_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOriginX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOriginY_ = 0;\n\n /**\n * @private\n * @type {boolean}\n */\n this.imageRotateWithView_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.imageRotation_ = 0;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size}\n */\n this.imageScale_ = [0, 0];\n\n /**\n * @private\n * @type {number}\n */\n this.imageWidth_ = 0;\n\n /**\n * @private\n * @type {string}\n */\n this.text_ = '';\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetY_ = 0;\n\n /**\n * @private\n * @type {boolean}\n */\n this.textRotateWithView_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.textRotation_ = 0;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size}\n */\n this.textScale_ = [0, 0];\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.textFillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.textStrokeState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").TextState}\n */\n this.textState_ = null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.pixelCoordinates_ = [];\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.tmpLocalTransform_ = createTransform();\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n */\n drawImages_(flatCoordinates, offset, end, stride) {\n if (!this.image_) {\n return;\n }\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_,\n );\n const context = this.context_;\n const localTransform = this.tmpLocalTransform_;\n const alpha = context.globalAlpha;\n if (this.imageOpacity_ != 1) {\n context.globalAlpha = alpha * this.imageOpacity_;\n }\n let rotation = this.imageRotation_;\n if (this.transformRotation_ === 0) {\n rotation -= this.viewRotation_;\n }\n if (this.imageRotateWithView_) {\n rotation += this.viewRotation_;\n }\n for (let i = 0, ii = pixelCoordinates.length; i < ii; i += 2) {\n const x = pixelCoordinates[i] - this.imageAnchorX_;\n const y = pixelCoordinates[i + 1] - this.imageAnchorY_;\n if (\n rotation !== 0 ||\n this.imageScale_[0] != 1 ||\n this.imageScale_[1] != 1\n ) {\n const centerX = x + this.imageAnchorX_;\n const centerY = y + this.imageAnchorY_;\n composeTransform(\n localTransform,\n centerX,\n centerY,\n 1,\n 1,\n rotation,\n -centerX,\n -centerY,\n );\n context.save();\n context.transform.apply(context, localTransform);\n context.translate(centerX, centerY);\n context.scale(this.imageScale_[0], this.imageScale_[1]);\n context.drawImage(\n this.image_,\n this.imageOriginX_,\n this.imageOriginY_,\n this.imageWidth_,\n this.imageHeight_,\n -this.imageAnchorX_,\n -this.imageAnchorY_,\n this.imageWidth_,\n this.imageHeight_,\n );\n context.restore();\n } else {\n context.drawImage(\n this.image_,\n this.imageOriginX_,\n this.imageOriginY_,\n this.imageWidth_,\n this.imageHeight_,\n x,\n y,\n this.imageWidth_,\n this.imageHeight_,\n );\n }\n }\n if (this.imageOpacity_ != 1) {\n context.globalAlpha = alpha;\n }\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n */\n drawText_(flatCoordinates, offset, end, stride) {\n if (!this.textState_ || this.text_ === '') {\n return;\n }\n if (this.textFillState_) {\n this.setContextFillState_(this.textFillState_);\n }\n if (this.textStrokeState_) {\n this.setContextStrokeState_(this.textStrokeState_);\n }\n this.setContextTextState_(this.textState_);\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_,\n );\n const context = this.context_;\n let rotation = this.textRotation_;\n if (this.transformRotation_ === 0) {\n rotation -= this.viewRotation_;\n }\n if (this.textRotateWithView_) {\n rotation += this.viewRotation_;\n }\n for (; offset < end; offset += stride) {\n const x = pixelCoordinates[offset] + this.textOffsetX_;\n const y = pixelCoordinates[offset + 1] + this.textOffsetY_;\n if (\n rotation !== 0 ||\n this.textScale_[0] != 1 ||\n this.textScale_[1] != 1\n ) {\n context.save();\n context.translate(x - this.textOffsetX_, y - this.textOffsetY_);\n context.rotate(rotation);\n context.translate(this.textOffsetX_, this.textOffsetY_);\n context.scale(this.textScale_[0], this.textScale_[1]);\n if (this.textStrokeState_) {\n context.strokeText(this.text_, 0, 0);\n }\n if (this.textFillState_) {\n context.fillText(this.text_, 0, 0);\n }\n context.restore();\n } else {\n if (this.textStrokeState_) {\n context.strokeText(this.text_, x, y);\n }\n if (this.textFillState_) {\n context.fillText(this.text_, x, y);\n }\n }\n }\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {boolean} close Close.\n * @param {number} [strokeOffset] Stroke Offset.\n * @private\n * @return {number} end End.\n */\n moveToLineTo_(flatCoordinates, offset, end, stride, close, strokeOffset) {\n const context = this.context_;\n let pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_,\n );\n if (Math.abs(strokeOffset) > 0) {\n pixelCoordinates = offsetLineString(\n pixelCoordinates,\n stride,\n strokeOffset,\n close,\n pixelCoordinates,\n );\n }\n context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);\n let length = pixelCoordinates.length;\n if (close) {\n length -= 2;\n }\n for (let i = 2; i < length; i += 2) {\n context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]);\n }\n if (close) {\n context.closePath();\n }\n return end;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} [strokeOffset] Stroke Offset.\n * @private\n * @return {number} End.\n */\n drawRings_(flatCoordinates, offset, ends, stride, strokeOffset) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.moveToLineTo_(\n flatCoordinates,\n offset,\n ends[i],\n stride,\n true,\n strokeOffset,\n );\n }\n return offset;\n }\n\n /**\n * Render a circle geometry into the canvas. Rendering is immediate and uses\n * the current fill and stroke styles.\n *\n * @param {import(\"../../geom/Circle.js\").default} geometry Circle geometry.\n * @api\n * @override\n */\n drawCircle(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Circle.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.fillState_ || this.strokeState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const pixelCoordinates = transformGeom2D(\n geometry,\n this.transform_,\n this.pixelCoordinates_,\n );\n const dx = pixelCoordinates[2] - pixelCoordinates[0];\n const dy = pixelCoordinates[3] - pixelCoordinates[1];\n const radius = Math.sqrt(dx * dx + dy * dy);\n const context = this.context_;\n context.beginPath();\n context.arc(\n pixelCoordinates[0],\n pixelCoordinates[1],\n radius,\n 0,\n 2 * Math.PI,\n );\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n this.drawText_(geometry.getCenter(), 0, 2, 2);\n }\n }\n\n /**\n * Set the rendering style. Note that since this is an immediate rendering API,\n * any `zIndex` on the provided style will be ignored.\n *\n * @param {import(\"../../style/Style.js\").default} style The rendering style.\n * @api\n * @override\n */\n setStyle(style) {\n this.setFillStrokeStyle(style.getFill(), style.getStroke());\n this.setImageStyle(style.getImage());\n this.setTextStyle(style.getText());\n }\n\n /**\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n */\n setTransform(transform) {\n this.transform_ = transform;\n }\n\n /**\n * Render a geometry into the canvas. Call\n * {@link module:ol/render/canvas/Immediate~CanvasImmediateRenderer#setStyle renderer.setStyle()} first to set the rendering style.\n *\n * @param {import(\"../../geom/Geometry.js\").default|import(\"../Feature.js\").default} geometry The geometry to render.\n * @api\n * @override\n */\n drawGeometry(geometry) {\n const type = geometry.getType();\n switch (type) {\n case 'Point':\n this.drawPoint(\n /** @type {import(\"../../geom/Point.js\").default} */ (geometry),\n );\n break;\n case 'LineString':\n this.drawLineString(\n /** @type {import(\"../../geom/LineString.js\").default} */ (geometry),\n );\n break;\n case 'Polygon':\n this.drawPolygon(\n /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry),\n );\n break;\n case 'MultiPoint':\n this.drawMultiPoint(\n /** @type {import(\"../../geom/MultiPoint.js\").default} */ (geometry),\n );\n break;\n case 'MultiLineString':\n this.drawMultiLineString(\n /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ),\n );\n break;\n case 'MultiPolygon':\n this.drawMultiPolygon(\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ),\n );\n break;\n case 'GeometryCollection':\n this.drawGeometryCollection(\n /** @type {import(\"../../geom/GeometryCollection.js\").default} */ (\n geometry\n ),\n );\n break;\n case 'Circle':\n this.drawCircle(\n /** @type {import(\"../../geom/Circle.js\").default} */ (geometry),\n );\n break;\n default:\n }\n }\n\n /**\n * Render a feature into the canvas. Note that any `zIndex` on the provided\n * style will be ignored - features are rendered immediately in the order that\n * this method is called. If you need `zIndex` support, you should be using an\n * {@link module:ol/layer/Vector~VectorLayer} instead.\n *\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {import(\"../../style/Style.js\").default} style Style.\n * @api\n * @override\n */\n drawFeature(feature, style) {\n const geometry = style.getGeometryFunction()(feature);\n if (!geometry) {\n return;\n }\n this.setStyle(style);\n this.drawGeometry(geometry);\n }\n\n /**\n * Render a GeometryCollection to the canvas. Rendering is immediate and\n * uses the current styles appropriate for each geometry in the collection.\n *\n * @param {import(\"../../geom/GeometryCollection.js\").default} geometry Geometry collection.\n * @override\n */\n drawGeometryCollection(geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n this.drawGeometry(geometries[i]);\n }\n }\n\n /**\n * Render a Point geometry into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/Point.js\").default|import(\"../Feature.js\").default} geometry Point geometry.\n * @override\n */\n drawPoint(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Point.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n const flatCoordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n if (this.image_) {\n this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n if (this.text_ !== '') {\n this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n }\n\n /**\n * Render a MultiPoint geometry into the canvas. Rendering is immediate and\n * uses the current style.\n *\n * @param {import(\"../../geom/MultiPoint.js\").default|import(\"../Feature.js\").default} geometry MultiPoint geometry.\n * @override\n */\n drawMultiPoint(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/MultiPoint.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n const flatCoordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n if (this.image_) {\n this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n if (this.text_ !== '') {\n this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n }\n\n /**\n * Render a LineString into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/LineString.js\").default|import(\"../Feature.js\").default} geometry LineString geometry.\n * @override\n */\n drawLineString(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/LineString.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n const context = this.context_;\n const flatCoordinates = geometry.getFlatCoordinates();\n context.beginPath();\n this.moveToLineTo_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n geometry.getStride(),\n false,\n this.strokeState_.strokeOffset,\n );\n context.stroke();\n }\n if (this.text_ !== '') {\n const flatMidpoint = geometry.getFlatMidpoint();\n this.drawText_(flatMidpoint, 0, 2, 2);\n }\n }\n\n /**\n * Render a MultiLineString geometry into the canvas. Rendering is immediate\n * and uses the current style.\n *\n * @param {import(\"../../geom/MultiLineString.js\").default|import(\"../Feature.js\").default} geometry MultiLineString geometry.\n * @override\n */\n drawMultiLineString(geometry) {\n if (this.squaredTolerance_) {\n geometry =\n /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n const geometryExtent = geometry.getExtent();\n if (!intersects(this.extent_, geometryExtent)) {\n return;\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n const context = this.context_;\n const flatCoordinates = geometry.getFlatCoordinates();\n let offset = 0;\n const ends = /** @type {Array<number>} */ (geometry.getEnds());\n const stride = geometry.getStride();\n context.beginPath();\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.moveToLineTo_(\n flatCoordinates,\n offset,\n ends[i],\n stride,\n false,\n this.strokeState_.strokeOffset,\n );\n }\n context.stroke();\n }\n if (this.text_ !== '') {\n const flatMidpoints = geometry.getFlatMidpoints();\n this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2);\n }\n }\n\n /**\n * Render a Polygon geometry into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/Polygon.js\").default|import(\"../Feature.js\").default} geometry Polygon geometry.\n * @override\n */\n drawPolygon(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Polygon.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_ || this.fillState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const context = this.context_;\n context.beginPath();\n this.drawRings_(\n geometry.getOrientedFlatCoordinates(),\n 0,\n /** @type {Array<number>} */ (geometry.getEnds()),\n geometry.getStride(),\n this.strokeState_?.strokeOffset,\n );\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n const flatInteriorPoint = geometry.getFlatInteriorPoint();\n this.drawText_(flatInteriorPoint, 0, 2, 2);\n }\n }\n\n /**\n * Render MultiPolygon geometry into the canvas. Rendering is immediate and\n * uses the current style.\n * @param {import(\"../../geom/MultiPolygon.js\").default} geometry MultiPolygon geometry.\n * @override\n */\n drawMultiPolygon(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_ || this.fillState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const context = this.context_;\n const flatCoordinates = geometry.getOrientedFlatCoordinates();\n let offset = 0;\n const endss = geometry.getEndss();\n const stride = geometry.getStride();\n context.beginPath();\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n offset = this.drawRings_(\n flatCoordinates,\n offset,\n ends,\n stride,\n this.strokeState_?.strokeOffset,\n );\n }\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n const flatInteriorPoints = geometry.getFlatInteriorPoints();\n this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2);\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").FillState} fillState Fill state.\n * @private\n */\n setContextFillState_(fillState) {\n const context = this.context_;\n const contextFillState = this.contextFillState_;\n if (!contextFillState) {\n context.fillStyle = fillState.fillStyle;\n this.contextFillState_ = {\n fillStyle: fillState.fillStyle,\n };\n } else {\n if (contextFillState.fillStyle != fillState.fillStyle) {\n contextFillState.fillStyle = fillState.fillStyle;\n context.fillStyle = fillState.fillStyle;\n }\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").StrokeState} strokeState Stroke state.\n * @private\n */\n setContextStrokeState_(strokeState) {\n const context = this.context_;\n const contextStrokeState = this.contextStrokeState_;\n if (!contextStrokeState) {\n context.lineCap = strokeState.lineCap;\n context.setLineDash(strokeState.lineDash);\n context.lineDashOffset = strokeState.lineDashOffset;\n context.lineJoin = strokeState.lineJoin;\n context.lineWidth = strokeState.lineWidth;\n context.miterLimit = strokeState.miterLimit;\n context.strokeStyle = strokeState.strokeStyle;\n this.contextStrokeState_ = {\n lineCap: strokeState.lineCap,\n lineDash: strokeState.lineDash,\n lineDashOffset: strokeState.lineDashOffset,\n lineJoin: strokeState.lineJoin,\n lineWidth: strokeState.lineWidth,\n miterLimit: strokeState.miterLimit,\n strokeStyle: strokeState.strokeStyle,\n };\n } else {\n if (contextStrokeState.lineCap != strokeState.lineCap) {\n contextStrokeState.lineCap = strokeState.lineCap;\n context.lineCap = strokeState.lineCap;\n }\n if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {\n context.setLineDash(\n (contextStrokeState.lineDash = strokeState.lineDash),\n );\n }\n if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {\n contextStrokeState.lineDashOffset = strokeState.lineDashOffset;\n context.lineDashOffset = strokeState.lineDashOffset;\n }\n if (contextStrokeState.lineJoin != strokeState.lineJoin) {\n contextStrokeState.lineJoin = strokeState.lineJoin;\n context.lineJoin = strokeState.lineJoin;\n }\n if (contextStrokeState.lineWidth != strokeState.lineWidth) {\n contextStrokeState.lineWidth = strokeState.lineWidth;\n context.lineWidth = strokeState.lineWidth;\n }\n if (contextStrokeState.miterLimit != strokeState.miterLimit) {\n contextStrokeState.miterLimit = strokeState.miterLimit;\n context.miterLimit = strokeState.miterLimit;\n }\n if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {\n contextStrokeState.strokeStyle = strokeState.strokeStyle;\n context.strokeStyle = strokeState.strokeStyle;\n }\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").TextState} textState Text state.\n * @private\n */\n setContextTextState_(textState) {\n const context = this.context_;\n const contextTextState = this.contextTextState_;\n const textAlign = textState.textAlign\n ? textState.textAlign\n : defaultTextAlign;\n if (!contextTextState) {\n context.font = textState.font;\n context.textAlign = textAlign;\n context.textBaseline = textState.textBaseline;\n this.contextTextState_ = {\n font: textState.font,\n textAlign: textAlign,\n textBaseline: textState.textBaseline,\n };\n } else {\n if (contextTextState.font != textState.font) {\n contextTextState.font = textState.font;\n context.font = textState.font;\n }\n if (contextTextState.textAlign != textAlign) {\n contextTextState.textAlign = textAlign;\n context.textAlign = textAlign;\n }\n if (contextTextState.textBaseline != textState.textBaseline) {\n contextTextState.textBaseline = textState.textBaseline;\n context.textBaseline = textState.textBaseline;\n }\n }\n }\n\n /**\n * Set the fill and stroke style for subsequent draw operations. To clear\n * either fill or stroke styles, pass null for the appropriate parameter.\n *\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n * @override\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {\n if (!fillStyle) {\n this.fillState_ = null;\n } else {\n const fillStyleColor = fillStyle.getColor();\n this.fillState_ = {\n fillStyle: asColorLike(\n fillStyleColor ? fillStyleColor : defaultFillStyle,\n ),\n };\n }\n if (!strokeStyle) {\n this.strokeState_ = null;\n } else {\n const strokeStyleColor = strokeStyle.getColor();\n const strokeStyleLineCap = strokeStyle.getLineCap();\n const strokeStyleLineDash = strokeStyle.getLineDash();\n const strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();\n const strokeStyleLineJoin = strokeStyle.getLineJoin();\n const strokeStyleWidth = strokeStyle.getWidth();\n const strokeStyleMiterLimit = strokeStyle.getMiterLimit();\n const lineDash = strokeStyleLineDash\n ? strokeStyleLineDash\n : defaultLineDash;\n const strokeOffset = strokeStyle.getOffset();\n this.strokeState_ = {\n lineCap:\n strokeStyleLineCap !== undefined\n ? strokeStyleLineCap\n : defaultLineCap,\n lineDash:\n this.pixelRatio_ === 1\n ? lineDash\n : lineDash.map((n) => n * this.pixelRatio_),\n lineDashOffset:\n (strokeStyleLineDashOffset\n ? strokeStyleLineDashOffset\n : defaultLineDashOffset) * this.pixelRatio_,\n lineJoin:\n strokeStyleLineJoin !== undefined\n ? strokeStyleLineJoin\n : defaultLineJoin,\n lineWidth:\n (strokeStyleWidth !== undefined\n ? strokeStyleWidth\n : defaultLineWidth) * this.pixelRatio_,\n miterLimit:\n strokeStyleMiterLimit !== undefined\n ? strokeStyleMiterLimit\n : defaultMiterLimit,\n strokeStyle: asColorLike(\n strokeStyleColor ? strokeStyleColor : defaultStrokeStyle,\n ),\n strokeOffset: (strokeOffset ?? 0) * this.pixelRatio_,\n };\n }\n }\n\n /**\n * Set the image style for subsequent draw operations. Pass null to remove\n * the image style.\n *\n * @param {import(\"../../style/Image.js\").default} imageStyle Image style.\n * @override\n */\n setImageStyle(imageStyle) {\n let imageSize;\n if (!imageStyle || !(imageSize = imageStyle.getSize())) {\n this.image_ = null;\n return;\n }\n const imagePixelRatio = imageStyle.getPixelRatio(this.pixelRatio_);\n const imageAnchor = imageStyle.getAnchor();\n const imageOrigin = imageStyle.getOrigin();\n this.image_ = imageStyle.getImage(this.pixelRatio_);\n this.imageAnchorX_ = imageAnchor[0] * imagePixelRatio;\n this.imageAnchorY_ = imageAnchor[1] * imagePixelRatio;\n this.imageHeight_ = imageSize[1] * imagePixelRatio;\n this.imageOpacity_ = imageStyle.getOpacity();\n this.imageOriginX_ = imageOrigin[0];\n this.imageOriginY_ = imageOrigin[1];\n this.imageRotateWithView_ = imageStyle.getRotateWithView();\n this.imageRotation_ = imageStyle.getRotation();\n const imageScale = imageStyle.getScaleArray();\n this.imageScale_ = [\n (imageScale[0] * this.pixelRatio_) / imagePixelRatio,\n (imageScale[1] * this.pixelRatio_) / imagePixelRatio,\n ];\n this.imageWidth_ = imageSize[0] * imagePixelRatio;\n }\n\n /**\n * Set the text style for subsequent draw operations. Pass null to\n * remove the text style.\n *\n * @param {import(\"../../style/Text.js\").default} textStyle Text style.\n * @override\n */\n setTextStyle(textStyle) {\n if (!textStyle) {\n this.text_ = '';\n } else {\n const textFillStyle = textStyle.getFill();\n if (!textFillStyle) {\n this.textFillState_ = null;\n } else {\n const textFillStyleColor = textFillStyle.getColor();\n this.textFillState_ = {\n fillStyle: asColorLike(\n textFillStyleColor ? textFillStyleColor : defaultFillStyle,\n ),\n };\n }\n const textStrokeStyle = textStyle.getStroke();\n if (!textStrokeStyle) {\n this.textStrokeState_ = null;\n } else {\n const textStrokeStyleColor = textStrokeStyle.getColor();\n const textStrokeStyleLineCap = textStrokeStyle.getLineCap();\n const textStrokeStyleLineDash = textStrokeStyle.getLineDash();\n const textStrokeStyleLineDashOffset =\n textStrokeStyle.getLineDashOffset();\n const textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();\n const textStrokeStyleWidth = textStrokeStyle.getWidth();\n const textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();\n this.textStrokeState_ = {\n lineCap:\n textStrokeStyleLineCap !== undefined\n ? textStrokeStyleLineCap\n : defaultLineCap,\n lineDash: textStrokeStyleLineDash\n ? textStrokeStyleLineDash\n : defaultLineDash,\n lineDashOffset: textStrokeStyleLineDashOffset\n ? textStrokeStyleLineDashOffset\n : defaultLineDashOffset,\n lineJoin:\n textStrokeStyleLineJoin !== undefined\n ? textStrokeStyleLineJoin\n : defaultLineJoin,\n lineWidth:\n textStrokeStyleWidth !== undefined\n ? textStrokeStyleWidth\n : defaultLineWidth,\n miterLimit:\n textStrokeStyleMiterLimit !== undefined\n ? textStrokeStyleMiterLimit\n : defaultMiterLimit,\n strokeStyle: asColorLike(\n textStrokeStyleColor ? textStrokeStyleColor : defaultStrokeStyle,\n ),\n };\n }\n const textFont = textStyle.getFont();\n const textOffsetX = textStyle.getOffsetX();\n const textOffsetY = textStyle.getOffsetY();\n const textRotateWithView = textStyle.getRotateWithView();\n const textRotation = textStyle.getRotation();\n const textScale = textStyle.getScaleArray();\n const textText = textStyle.getText();\n const textTextAlign = textStyle.getTextAlign();\n const textTextBaseline = textStyle.getTextBaseline();\n this.textState_ = {\n font: textFont !== undefined ? textFont : defaultFont,\n textAlign:\n textTextAlign !== undefined ? textTextAlign : defaultTextAlign,\n textBaseline:\n textTextBaseline !== undefined\n ? textTextBaseline\n : defaultTextBaseline,\n };\n this.text_ =\n textText !== undefined\n ? Array.isArray(textText)\n ? textText.reduce((acc, t, i) => (acc += i % 2 ? ' ' : t), '')\n : textText\n : '';\n this.textOffsetX_ =\n textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0;\n this.textOffsetY_ =\n textOffsetY !== undefined ? this.pixelRatio_ * textOffsetY : 0;\n this.textRotateWithView_ =\n textRotateWithView !== undefined ? textRotateWithView : false;\n this.textRotation_ = textRotation !== undefined ? textRotation : 0;\n this.textScale_ = [\n this.pixelRatio_ * textScale[0],\n this.pixelRatio_ * textScale[1],\n ];\n }\n }\n}\n\nexport default CanvasImmediateRenderer;\n", "/**\n * @module ol/render/canvas/hitdetect\n */\n\nimport {ascending} from '../../array.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {intersects} from '../../extent.js';\nimport {clamp} from '../../math.js';\nimport {\n getTransformFromProjections,\n getUserProjection,\n toUserExtent,\n} from '../../proj.js';\nimport {Icon} from '../../style.js';\nimport CanvasImmediateRenderer from './Immediate.js';\n\nexport const HIT_DETECT_RESOLUTION = 0.5;\n\n/**\n * @param {import(\"../../size.js\").Size} size Canvas size in css pixels.\n * @param {Array<import(\"../../transform.js\").Transform>} transforms Transforms\n * for rendering features to all worlds of the viewport, from coordinates to css\n * pixels.\n * @param {Array<import(\"../../Feature.js\").FeatureLike>} features\n * Features to consider for hit detection.\n * @param {import(\"../../style/Style.js\").StyleFunction|undefined} styleFunction\n * Layer style function.\n * @param {import(\"../../extent.js\").Extent} extent Extent in render projection.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {number} [squaredTolerance] Squared tolerance.\n * @param {import(\"../../proj/Projection.js\").default} [projection] Render projection.\n * @return {ImageData} Hit detection image data.\n */\nexport function createHitDetectionImageData(\n size,\n transforms,\n features,\n styleFunction,\n extent,\n resolution,\n rotation,\n squaredTolerance,\n projection,\n) {\n const userExtent = projection ? toUserExtent(extent, projection) : extent;\n const width = size[0] * HIT_DETECT_RESOLUTION;\n const height = size[1] * HIT_DETECT_RESOLUTION;\n const context = createCanvasContext2D(width, height);\n context.imageSmoothingEnabled = false;\n const canvas = context.canvas;\n const renderer = new CanvasImmediateRenderer(\n context,\n HIT_DETECT_RESOLUTION,\n extent,\n null,\n rotation,\n squaredTolerance,\n projection\n ? getTransformFromProjections(getUserProjection(), projection)\n : null,\n );\n const featureCount = features.length;\n // Stretch hit detection index to use the whole available color range\n const indexFactor = Math.floor((256 * 256 * 256 - 1) / featureCount);\n const featuresByZIndex = {};\n for (let i = 1; i <= featureCount; ++i) {\n const feature = features[i - 1];\n const featureStyleFunction = feature.getStyleFunction() || styleFunction;\n if (!featureStyleFunction) {\n continue;\n }\n let styles = featureStyleFunction(feature, resolution);\n if (!styles) {\n continue;\n }\n if (!Array.isArray(styles)) {\n styles = [styles];\n }\n const index = i * indexFactor;\n const color = index.toString(16).padStart(7, '#00000');\n for (let j = 0, jj = styles.length; j < jj; ++j) {\n const originalStyle = styles[j];\n const geometry = originalStyle.getGeometryFunction()(feature);\n if (!geometry || !intersects(userExtent, geometry.getExtent())) {\n continue;\n }\n const style = originalStyle.clone();\n const fill = style.getFill();\n if (fill) {\n fill.setColor(color);\n }\n const stroke = style.getStroke();\n if (stroke) {\n stroke.setColor(color);\n stroke.setLineDash(null);\n }\n style.setText(undefined);\n const image = originalStyle.getImage();\n if (image) {\n const imgSize = image.getImageSize();\n if (!imgSize) {\n continue;\n }\n\n const imgContext = createCanvasContext2D(\n imgSize[0],\n imgSize[1],\n undefined,\n {alpha: false},\n );\n const img = imgContext.canvas;\n imgContext.fillStyle = color;\n imgContext.fillRect(0, 0, img.width, img.height);\n style.setImage(\n new Icon({\n img: img,\n anchor: image.getAnchor(),\n anchorXUnits: 'pixels',\n anchorYUnits: 'pixels',\n offset: image.getOrigin(),\n opacity: 1,\n size: image.getSize(),\n scale: image.getScale(),\n rotation: image.getRotation(),\n rotateWithView: image.getRotateWithView(),\n }),\n );\n }\n const zIndex = style.getZIndex() || 0;\n let byGeometryType = featuresByZIndex[zIndex];\n if (!byGeometryType) {\n byGeometryType = {};\n featuresByZIndex[zIndex] = byGeometryType;\n byGeometryType['Polygon'] = [];\n byGeometryType['Circle'] = [];\n byGeometryType['LineString'] = [];\n byGeometryType['Point'] = [];\n }\n const type = geometry.getType();\n if (type === 'GeometryCollection') {\n const geometries =\n /** @type {import(\"../../geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometriesArrayRecursive();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n const geometry = geometries[i];\n byGeometryType[geometry.getType().replace('Multi', '')].push(\n geometry,\n style,\n );\n }\n } else {\n byGeometryType[type.replace('Multi', '')].push(geometry, style);\n }\n }\n }\n\n const zIndexKeys = Object.keys(featuresByZIndex).map(Number).sort(ascending);\n for (let i = 0, ii = zIndexKeys.length; i < ii; ++i) {\n const byGeometryType = featuresByZIndex[zIndexKeys[i]];\n for (const type in byGeometryType) {\n const geomAndStyle = byGeometryType[type];\n for (let j = 0, jj = geomAndStyle.length; j < jj; j += 2) {\n renderer.setStyle(geomAndStyle[j + 1]);\n for (let k = 0, kk = transforms.length; k < kk; ++k) {\n renderer.setTransform(transforms[k]);\n renderer.drawGeometry(geomAndStyle[j]);\n }\n }\n }\n }\n return context.getImageData(0, 0, canvas.width, canvas.height);\n}\n\n/**\n * @param {import(\"../../pixel\").Pixel} pixel Pixel coordinate on the hit\n * detection canvas in css pixels.\n * @param {Array<F>} features Features. Has to\n * match the `features` array that was passed to `createHitDetectionImageData()`.\n * @param {ImageData} imageData Hit detection image data generated by\n * `createHitDetectionImageData()`.\n * @return {Array<F>} Features.\n * @template {import(\"../../Feature.js\").FeatureLike} F\n */\nexport function hitDetect(pixel, features, imageData) {\n /** @type {Array<F>} */\n const resultFeatures = [];\n if (imageData) {\n const x = Math.floor(Math.round(pixel[0]) * HIT_DETECT_RESOLUTION);\n const y = Math.floor(Math.round(pixel[1]) * HIT_DETECT_RESOLUTION);\n // The pixel coordinate is clamped down to the hit-detect canvas' size to account\n // for browsers returning coordinates slightly larger than the actual canvas size\n // due to a non-integer pixel ratio.\n const index =\n (clamp(x, 0, imageData.width - 1) +\n clamp(y, 0, imageData.height - 1) * imageData.width) *\n 4;\n const r = imageData.data[index];\n const g = imageData.data[index + 1];\n const b = imageData.data[index + 2];\n const i = b + 256 * (g + 256 * r);\n const indexFactor = Math.floor((256 * 256 * 256 - 1) / features.length);\n if (i && i % indexFactor === 0) {\n resultFeatures.push(features[i / indexFactor - 1]);\n }\n }\n return resultFeatures;\n}\n", "/**\n * @module ol/renderer/vector\n */\nimport ImageState from '../ImageState.js';\nimport {getUid} from '../util.js';\n\n/**\n * Feature callback. The callback will be called with three arguments. The first\n * argument is one {@link module:ol/Feature~Feature feature} or {@link module:ol/render/Feature~RenderFeature render feature}\n * at the pixel, the second is the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for\n * unmanaged layers. The third is the {@link module:ol/geom/SimpleGeometry~SimpleGeometry} of the feature. For features\n * with a GeometryCollection geometry, it will be the first detected geometry from the collection.\n * @template T\n * @typedef {function(import(\"../Feature.js\").FeatureLike, import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>, import(\"../geom/SimpleGeometry.js\").default): T} FeatureCallback\n */\n\n/**\n * Tolerance for geometry simplification in device pixels.\n * @type {number}\n */\nconst SIMPLIFY_TOLERANCE = 0.5;\n\n/**\n * @const\n * @type {Object<import(\"../geom/Geometry.js\").Type,\n * function(import(\"../render/canvas/BuilderGroup.js\").default, import(\"../geom/Geometry.js\").default,\n * import(\"../style/Style.js\").default, Object): void>}\n */\nconst GEOMETRY_RENDERERS = {\n 'Point': renderPointGeometry,\n 'LineString': renderLineStringGeometry,\n 'Polygon': renderPolygonGeometry,\n 'MultiPoint': renderMultiPointGeometry,\n 'MultiLineString': renderMultiLineStringGeometry,\n 'MultiPolygon': renderMultiPolygonGeometry,\n 'GeometryCollection': renderGeometryCollectionGeometry,\n 'Circle': renderCircleGeometry,\n};\n\n/**\n * @param {import(\"../Feature.js\").FeatureLike} feature1 Feature 1.\n * @param {import(\"../Feature.js\").FeatureLike} feature2 Feature 2.\n * @return {number} Order.\n */\nexport function defaultOrder(feature1, feature2) {\n return parseInt(getUid(feature1), 10) - parseInt(getUid(feature2), 10);\n}\n\n/**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Squared pixel tolerance.\n */\nexport function getSquaredTolerance(resolution, pixelRatio) {\n const tolerance = getTolerance(resolution, pixelRatio);\n return tolerance * tolerance;\n}\n\n/**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Pixel tolerance.\n */\nexport function getTolerance(resolution, pixelRatio) {\n return (SIMPLIFY_TOLERANCE * resolution) / pixelRatio;\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Builder group.\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderCircleGeometry(builderGroup, geometry, style, feature, index) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (fillStyle || strokeStyle) {\n const circleReplay = builderGroup.getBuilder(style.getZIndex(), 'Circle');\n circleReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n circleReplay.drawCircle(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Transform from user to view projection.\n * @param {boolean} [declutter] Enable decluttering.\n * @param {number} [index] Render order index..\n * @return {boolean} `true` if style is loading.\n */\nexport function renderFeature(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n listener,\n transform,\n declutter,\n index,\n) {\n const loadingPromises = [];\n const imageStyle = style.getImage();\n if (imageStyle) {\n let loading = true;\n const imageState = imageStyle.getImageState();\n if (imageState == ImageState.LOADED || imageState == ImageState.ERROR) {\n loading = false;\n } else {\n if (imageState == ImageState.IDLE) {\n imageStyle.load();\n }\n }\n if (loading) {\n loadingPromises.push(imageStyle.ready());\n }\n }\n const fillStyle = style.getFill();\n if (fillStyle && fillStyle.loading()) {\n loadingPromises.push(fillStyle.ready());\n }\n const loading = loadingPromises.length > 0;\n if (loading) {\n Promise.all(loadingPromises).then(() => listener(null));\n }\n renderFeatureInternal(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n transform,\n declutter,\n index,\n );\n\n return loading;\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @param {boolean} [declutter] Enable decluttering.\n * @param {number} [index] Render order index..\n */\nfunction renderFeatureInternal(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n transform,\n declutter,\n index,\n) {\n const geometry = style.getGeometryFunction()(feature);\n if (!geometry) {\n return;\n }\n const simplifiedGeometry = geometry.simplifyTransformed(\n squaredTolerance,\n transform,\n );\n const renderer = style.getRenderer();\n if (renderer) {\n renderGeometry(replayGroup, simplifiedGeometry, style, feature, index);\n } else {\n const geometryRenderer = GEOMETRY_RENDERERS[simplifiedGeometry.getType()];\n geometryRenderer(\n replayGroup,\n simplifiedGeometry,\n style,\n feature,\n index,\n declutter,\n );\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../geom/Geometry.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderGeometry(replayGroup, geometry, style, feature, index) {\n if (geometry.getType() == 'GeometryCollection') {\n const geometries =\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n renderGeometry(replayGroup, geometries[i], style, feature, index);\n }\n return;\n }\n const replay = replayGroup.getBuilder(style.getZIndex(), 'Default');\n replay.drawCustom(\n /** @type {import(\"../geom/SimpleGeometry.js\").default} */ (geometry),\n feature,\n style.getRenderer(),\n style.getHitDetectionRenderer(),\n index,\n );\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} [declutterBuilderGroup] Builder for decluttering.\n * @param {number} [index] Render order index.\n */\nfunction renderGeometryCollectionGeometry(\n replayGroup,\n geometry,\n style,\n feature,\n declutterBuilderGroup,\n index,\n) {\n const geometries = geometry.getGeometriesArray();\n let i, ii;\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n const geometryRenderer = GEOMETRY_RENDERERS[geometries[i].getType()];\n geometryRenderer(\n replayGroup,\n geometries[i],\n style,\n feature,\n declutterBuilderGroup,\n index,\n );\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/LineString.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderLineStringGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n) {\n const strokeStyle = style.getStroke();\n if (strokeStyle) {\n const lineStringReplay = builderGroup.getBuilder(\n style.getZIndex(),\n 'LineString',\n );\n lineStringReplay.setFillStrokeStyle(null, strokeStyle);\n lineStringReplay.drawLineString(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiLineString.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderMultiLineStringGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n) {\n const strokeStyle = style.getStroke();\n if (strokeStyle) {\n const lineStringReplay = builderGroup.getBuilder(\n style.getZIndex(),\n 'LineString',\n );\n lineStringReplay.setFillStrokeStyle(null, strokeStyle);\n lineStringReplay.drawMultiLineString(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderMultiPolygonGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (strokeStyle || fillStyle) {\n const polygonReplay = builderGroup.getBuilder(style.getZIndex(), 'Polygon');\n polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n polygonReplay.drawMultiPolygon(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/Point.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @param {boolean} [declutter] Enable decluttering.\n */\nfunction renderPointGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n declutter,\n) {\n const imageStyle = style.getImage();\n const textStyle = style.getText();\n const hasText = textStyle && textStyle.getText();\n /** @type {import(\"../render/canvas.js\").DeclutterImageWithText} */\n const declutterImageWithText =\n declutter && imageStyle && hasText ? {} : undefined;\n if (imageStyle) {\n if (imageStyle.getImageState() != ImageState.LOADED) {\n return;\n }\n const imageReplay = builderGroup.getBuilder(style.getZIndex(), 'Image');\n imageReplay.setImageStyle(imageStyle, declutterImageWithText);\n imageReplay.drawPoint(geometry, feature, index);\n }\n if (hasText) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle, declutterImageWithText);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiPoint.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @param {boolean} [declutter] Enable decluttering.\n */\nfunction renderMultiPointGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n declutter,\n) {\n const imageStyle = style.getImage();\n const hasImage = imageStyle && imageStyle.getOpacity() !== 0;\n const textStyle = style.getText();\n const hasText = textStyle && textStyle.getText();\n /** @type {import(\"../render/canvas.js\").DeclutterImageWithText} */\n const declutterImageWithText =\n declutter && hasImage && hasText ? {} : undefined;\n if (hasImage) {\n if (imageStyle.getImageState() != ImageState.LOADED) {\n return;\n }\n const imageReplay = builderGroup.getBuilder(style.getZIndex(), 'Image');\n imageReplay.setImageStyle(imageStyle, declutterImageWithText);\n imageReplay.drawMultiPoint(geometry, feature, index);\n }\n if (hasText) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle, declutterImageWithText);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/Polygon.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderPolygonGeometry(builderGroup, geometry, style, feature, index) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (fillStyle || strokeStyle) {\n const polygonReplay = builderGroup.getBuilder(style.getZIndex(), 'Polygon');\n polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n polygonReplay.drawPolygon(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n", "/**\n * @module ol/renderer/canvas/VectorLayer\n */\nimport ViewHint from '../../ViewHint.js';\nimport {equals} from '../../array.js';\nimport {wrapX as wrapCoordinateX} from '../../coordinate.js';\nimport {createCanvasContext2D, releaseCanvas} from '../../dom.js';\nimport {\n buffer,\n containsExtent,\n createEmpty,\n getHeight,\n getWidth,\n intersects as intersectsExtent,\n isEmpty,\n wrapX as wrapExtentX,\n} from '../../extent.js';\nimport {\n fromUserExtent,\n getTransformFromProjections,\n getUserProjection,\n toUserExtent,\n toUserResolution,\n} from '../../proj.js';\nimport RenderEventType from '../../render/EventType.js';\nimport CanvasBuilderGroup from '../../render/canvas/BuilderGroup.js';\nimport ExecutorGroup, {\n ALL,\n DECLUTTER,\n NON_DECLUTTER,\n} from '../../render/canvas/ExecutorGroup.js';\nimport {\n HIT_DETECT_RESOLUTION,\n createHitDetectionImageData,\n hitDetect,\n} from '../../render/canvas/hitdetect.js';\nimport {getUid} from '../../util.js';\nimport {\n defaultOrder as defaultRenderOrder,\n getSquaredTolerance as getSquaredRenderTolerance,\n getTolerance as getRenderTolerance,\n renderFeature,\n} from '../vector.js';\nimport CanvasLayerRenderer, {canvasPool} from './Layer.js';\n\n/**\n * @classdesc\n * Canvas renderer for vector layers.\n * @api\n */\nclass CanvasVectorLayerRenderer extends CanvasLayerRenderer {\n /**\n * @param {import(\"../../layer/BaseVector.js\").default} vectorLayer Vector layer.\n */\n constructor(vectorLayer) {\n super(vectorLayer);\n\n /** @private */\n this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this);\n\n /**\n * @private\n * @type {boolean}\n */\n this.animatingOrInteracting_;\n\n /**\n * @private\n * @type {ImageData|null}\n */\n this.hitDetectionImageData_ = null;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.clipExtent_ = null;\n\n /**\n * Do we need to extend the rendered area on the x-axis to handle\n * features that cross the antimeridian?\n * @private\n * @type {boolean}\n */\n this.extendX_ = false;\n\n /**\n * @private\n * @type {Array<import(\"../../Feature.js\").default>}\n */\n this.renderedFeatures_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedResolution_ = NaN;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.renderedExtent_ = createEmpty();\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.wrappedRenderedExtent_ = createEmpty();\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRotation_;\n\n /**\n * @private\n * @type {import(\"../../coordinate\").Coordinate}\n */\n this.renderedCenter_ = null;\n\n /**\n * @private\n * @type {import(\"../../proj/Projection\").default}\n */\n this.renderedProjection_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedPixelRatio_ = 1;\n\n /**\n * @private\n * @type {import(\"../../render.js\").OrderFunction|null}\n */\n this.renderedRenderOrder_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedFrameDeclutter_;\n\n /**\n * @private\n * @type {import(\"../../render/canvas/ExecutorGroup\").default}\n */\n this.replayGroup_ = null;\n\n /**\n * A new replay group had to be created by `prepareFrame()`\n * @type {boolean}\n */\n this.replayGroupChanged = true;\n\n /**\n * Clipping to be performed by `renderFrame()`\n * @type {boolean}\n */\n this.clipping = true;\n\n /**\n * @private\n * @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D}\n */\n this.targetContext_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.opacity_ = 1;\n }\n\n /**\n * @param {ExecutorGroup} executorGroup Executor group.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {boolean} [declutterable] `true` to only render declutterable items,\n * `false` to only render non-declutterable items, `undefined` to render all.\n */\n renderWorlds(executorGroup, frameState, declutterable) {\n const extent = frameState.extent;\n const viewState = frameState.viewState;\n const center = viewState.center;\n const resolution = viewState.resolution;\n const projection = viewState.projection;\n const rotation = viewState.rotation;\n const projectionExtent = projection.getExtent();\n const vectorSource = this.getLayer().getSource();\n const declutter = this.getLayer().getDeclutter();\n const pixelRatio = frameState.pixelRatio;\n const viewHints = frameState.viewHints;\n const snapToPixel = !(\n viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]\n );\n const context = this.context;\n const width = Math.round((getWidth(extent) / resolution) * pixelRatio);\n const height = Math.round((getHeight(extent) / resolution) * pixelRatio);\n\n const multiWorld = vectorSource.getWrapX() && projection.canWrapX();\n const worldWidth = multiWorld ? getWidth(projectionExtent) : null;\n const endWorld = multiWorld\n ? Math.ceil((extent[2] - projectionExtent[2]) / worldWidth) +\n (this.extendX_ ? 2 : 1)\n : 1;\n let world = multiWorld\n ? Math.floor((extent[0] - projectionExtent[0]) / worldWidth) -\n (this.extendX_ ? 1 : 0)\n : 0;\n do {\n let transform = this.getRenderTransform(\n center,\n resolution,\n 0,\n pixelRatio,\n width,\n height,\n world * worldWidth,\n );\n if (frameState.declutter) {\n transform = transform.slice(0);\n }\n executorGroup.execute(\n context,\n [context.canvas.width, context.canvas.height],\n transform,\n rotation,\n snapToPixel,\n declutterable === undefined\n ? ALL\n : declutterable\n ? DECLUTTER\n : NON_DECLUTTER,\n declutterable\n ? declutter && frameState.declutter[declutter]\n : undefined,\n );\n } while (++world < endWorld);\n }\n\n /**\n * @private\n */\n setDrawContext_() {\n if (this.opacity_ !== 1) {\n this.targetContext_ = this.context;\n this.context = createCanvasContext2D(\n this.context.canvas.width,\n this.context.canvas.height,\n canvasPool,\n );\n }\n }\n\n /**\n * @private\n */\n resetDrawContext_() {\n if (this.opacity_ !== 1 && this.targetContext_) {\n const alpha = this.targetContext_.globalAlpha;\n this.targetContext_.globalAlpha = this.opacity_;\n this.targetContext_.drawImage(this.context.canvas, 0, 0);\n this.targetContext_.globalAlpha = alpha;\n releaseCanvas(this.context);\n canvasPool.push(this.context.canvas);\n this.context = this.targetContext_;\n this.targetContext_ = null;\n }\n }\n\n /**\n * Render declutter items for this layer\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n renderDeclutter(frameState) {\n if (!this.replayGroup_ || !this.getLayer().getDeclutter()) {\n return;\n }\n this.renderWorlds(this.replayGroup_, frameState, true);\n }\n\n /**\n * Render deferred instructions.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @override\n */\n renderDeferredInternal(frameState) {\n if (!this.replayGroup_) {\n return;\n }\n if (this.clipExtent_) {\n this.clipUnrotated(this.context, frameState, this.clipExtent_);\n }\n this.replayGroup_.renderDeferred();\n if (this.clipExtent_) {\n this.context.restore();\n this.clipExtent_ = null;\n }\n this.resetDrawContext_();\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement|null} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n renderFrame(frameState, target) {\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n this.opacity_ = layerState.opacity;\n const viewState = frameState.viewState;\n\n this.prepareContainer(frameState, target);\n const context = this.context;\n\n const replayGroup = this.replayGroup_;\n let render = replayGroup && !replayGroup.isEmpty();\n if (!render) {\n const hasRenderListeners =\n this.getLayer().hasListener(RenderEventType.PRERENDER) ||\n this.getLayer().hasListener(RenderEventType.POSTRENDER);\n if (!hasRenderListeners) {\n return this.container;\n }\n }\n\n this.setDrawContext_();\n\n this.preRender(context, frameState);\n\n const projection = viewState.projection;\n\n // clipped rendering if layer extent is set\n this.clipExtent_ = null;\n let clipped = false;\n if (render && layerState.extent && this.clipping) {\n const layerExtent = fromUserExtent(layerState.extent, projection);\n render = intersectsExtent(layerExtent, frameState.extent);\n const needsClip =\n render && !containsExtent(layerExtent, frameState.extent);\n if (needsClip) {\n if (frameState.declutter) {\n // Store extent for deferred clipping\n this.clipExtent_ = layerExtent;\n } else {\n // Apply clipping immediately for non-declutter rendering\n this.clipUnrotated(context, frameState, layerExtent);\n clipped = true;\n }\n }\n }\n\n if (render) {\n this.renderWorlds(\n replayGroup,\n frameState,\n this.getLayer().getDeclutter() ? false : undefined,\n );\n }\n\n if (clipped) {\n context.restore();\n }\n\n this.postRender(context, frameState);\n\n if (this.renderedRotation_ !== viewState.rotation) {\n this.renderedRotation_ = viewState.rotation;\n this.hitDetectionImageData_ = null;\n }\n if (!frameState.declutter) {\n this.resetDrawContext_();\n }\n return this.container;\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../../Feature\").default>>} Promise\n * that resolves with an array of features.\n * @override\n */\n getFeatures(pixel) {\n return new Promise((resolve) => {\n if (\n this.frameState &&\n !this.hitDetectionImageData_ &&\n !this.animatingOrInteracting_\n ) {\n const size = this.frameState.size.slice();\n const center = this.renderedCenter_;\n const resolution = this.renderedResolution_;\n const rotation = this.renderedRotation_;\n const projection = this.renderedProjection_;\n const extent = this.wrappedRenderedExtent_;\n const layer = this.getLayer();\n const transforms = [];\n const width = size[0] * HIT_DETECT_RESOLUTION;\n const height = size[1] * HIT_DETECT_RESOLUTION;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n HIT_DETECT_RESOLUTION,\n width,\n height,\n 0,\n ).slice(),\n );\n const source = layer.getSource();\n const projectionExtent = projection.getExtent();\n if (\n source.getWrapX() &&\n projection.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n let startX = extent[0];\n const worldWidth = getWidth(projectionExtent);\n let world = 0;\n let offsetX;\n while (startX < projectionExtent[0]) {\n --world;\n offsetX = worldWidth * world;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n HIT_DETECT_RESOLUTION,\n width,\n height,\n offsetX,\n ).slice(),\n );\n startX += worldWidth;\n }\n world = 0;\n startX = extent[2];\n while (startX > projectionExtent[2]) {\n ++world;\n offsetX = worldWidth * world;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n HIT_DETECT_RESOLUTION,\n width,\n height,\n offsetX,\n ).slice(),\n );\n startX -= worldWidth;\n }\n }\n const userProjection = getUserProjection();\n this.hitDetectionImageData_ = createHitDetectionImageData(\n size,\n transforms,\n this.renderedFeatures_,\n layer.getStyleFunction(),\n extent,\n resolution,\n rotation,\n getSquaredRenderTolerance(resolution, this.renderedPixelRatio_),\n userProjection ? projection : null,\n );\n }\n resolve(\n hitDetect(pixel, this.renderedFeatures_, this.hitDetectionImageData_),\n );\n });\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"../vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {Array<import(\"../Map.js\").HitMatch<T>>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n * @override\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n if (!this.replayGroup_) {\n return undefined;\n }\n const resolution = frameState.viewState.resolution;\n const rotation = frameState.viewState.rotation;\n const layer = this.getLayer();\n\n /** @type {!Object<string, import(\"../Map.js\").HitMatch<T>|true>} */\n const features = {};\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {number} distanceSq The squared distance to the click position\n * @return {T|undefined} Callback result.\n */\n const featureCallback = function (feature, geometry, distanceSq) {\n const key = getUid(feature);\n const match = features[key];\n if (!match) {\n if (distanceSq === 0) {\n features[key] = true;\n return callback(feature, layer, geometry);\n }\n matches.push(\n (features[key] = {\n feature: feature,\n layer: layer,\n geometry: geometry,\n distanceSq: distanceSq,\n callback: callback,\n }),\n );\n } else if (match !== true && distanceSq < match.distanceSq) {\n if (distanceSq === 0) {\n features[key] = true;\n matches.splice(matches.lastIndexOf(match), 1);\n return callback(feature, layer, geometry);\n }\n match.geometry = geometry;\n match.distanceSq = distanceSq;\n }\n return undefined;\n };\n\n const declutter = this.getLayer().getDeclutter();\n return this.replayGroup_.forEachFeatureAtCoordinate(\n coordinate,\n resolution,\n rotation,\n hitTolerance,\n featureCallback,\n declutter\n ? frameState.declutter?.[declutter]?.all().map((item) => item.value)\n : null,\n );\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n * @override\n */\n handleFontsChanged() {\n const layer = this.getLayer();\n if (layer.getVisible() && this.replayGroup_) {\n layer.changed();\n }\n }\n\n /**\n * Handle changes in image style state.\n * @param {import(\"../../events/Event.js\").default} event Image style change event.\n * @private\n */\n handleStyleImageChange_(event) {\n this.renderIfReadyAndVisible();\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrame(frameState) {\n const vectorLayer = this.getLayer();\n const vectorSource = vectorLayer.getSource();\n if (!vectorSource) {\n return false;\n }\n\n const animating = frameState.viewHints[ViewHint.ANIMATING];\n const interacting = frameState.viewHints[ViewHint.INTERACTING];\n const updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();\n const updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();\n\n if (\n (this.ready && !updateWhileAnimating && animating) ||\n (!updateWhileInteracting && interacting)\n ) {\n this.animatingOrInteracting_ = true;\n return true;\n }\n this.animatingOrInteracting_ = false;\n\n const frameStateExtent = frameState.extent;\n const viewState = frameState.viewState;\n const projection = viewState.projection;\n const resolution = viewState.resolution;\n const pixelRatio = frameState.pixelRatio;\n const vectorLayerRevision = vectorLayer.getRevision();\n const vectorLayerRenderBuffer = vectorLayer.getRenderBuffer();\n let vectorLayerRenderOrder = vectorLayer.getRenderOrder();\n\n if (vectorLayerRenderOrder === undefined) {\n vectorLayerRenderOrder = defaultRenderOrder;\n }\n\n const center = viewState.center.slice();\n const extent = buffer(\n frameStateExtent,\n vectorLayerRenderBuffer * resolution,\n );\n const renderedExtent = extent.slice();\n const loadExtents = [extent.slice()];\n const projectionExtent = projection.getExtent();\n\n const canWrapX = vectorSource.getWrapX() && projection.canWrapX();\n this.extendX_ = false;\n if (canWrapX) {\n const sourceExtent = vectorSource.getExtent();\n if (sourceExtent && !isEmpty(sourceExtent)) {\n this.extendX_ =\n sourceExtent[0] < projectionExtent[0] ||\n sourceExtent[2] > projectionExtent[2];\n }\n }\n\n if (\n canWrapX &&\n (!containsExtent(projectionExtent, frameState.extent) || this.extendX_)\n ) {\n // For the replay group, we need an extent that intersects the real world\n // (-180\u00B0 to +180\u00B0). To support geometries in a coordinate range from -540\u00B0\n // to +540\u00B0, we add at least 1 world width on each side of the projection\n // extent. If the viewport is wider than the world, we need to add half of\n // the viewport width to make sure we cover the whole viewport.\n const worldWidth = getWidth(projectionExtent);\n const gutter = Math.max(getWidth(extent) / 2, worldWidth);\n let projMinX = projectionExtent[0];\n let projMaxX = projectionExtent[2];\n if (this.extendX_) {\n projMinX -= worldWidth;\n projMaxX += worldWidth;\n }\n extent[0] = projMinX - gutter;\n extent[2] = projMaxX + gutter;\n wrapCoordinateX(center, projection);\n const loadExtent = wrapExtentX(loadExtents[0], projection);\n // If the extent crosses the date line, we load data for both edges of the worlds\n if (\n loadExtent[0] < projectionExtent[0] &&\n loadExtent[2] < projectionExtent[2]\n ) {\n loadExtents.push([\n loadExtent[0] + worldWidth,\n loadExtent[1],\n loadExtent[2] + worldWidth,\n loadExtent[3],\n ]);\n } else if (\n loadExtent[0] > projectionExtent[0] &&\n loadExtent[2] > projectionExtent[2]\n ) {\n loadExtents.push([\n loadExtent[0] - worldWidth,\n loadExtent[1],\n loadExtent[2] - worldWidth,\n loadExtent[3],\n ]);\n }\n }\n\n if (\n this.ready &&\n this.renderedResolution_ == resolution &&\n this.renderedPixelRatio_ === pixelRatio &&\n this.renderedRevision_ == vectorLayerRevision &&\n this.renderedRenderOrder_ == vectorLayerRenderOrder &&\n this.renderedFrameDeclutter_ === !!frameState.declutter &&\n containsExtent(this.wrappedRenderedExtent_, extent)\n ) {\n if (!equals(this.renderedExtent_, renderedExtent)) {\n this.hitDetectionImageData_ = null;\n this.renderedExtent_ = renderedExtent;\n }\n this.renderedCenter_ = center;\n this.replayGroupChanged = false;\n return true;\n }\n\n this.replayGroup_ = null;\n\n const replayGroup = new CanvasBuilderGroup(\n getRenderTolerance(resolution, pixelRatio),\n extent,\n resolution,\n pixelRatio,\n );\n\n const userProjection = getUserProjection();\n let userTransform;\n if (userProjection) {\n for (let i = 0, ii = loadExtents.length; i < ii; ++i) {\n const extent = loadExtents[i];\n const userExtent = toUserExtent(extent, projection);\n vectorSource.loadFeatures(\n userExtent,\n toUserResolution(resolution, projection),\n userProjection,\n );\n }\n userTransform = getTransformFromProjections(userProjection, projection);\n } else {\n for (let i = 0, ii = loadExtents.length; i < ii; ++i) {\n vectorSource.loadFeatures(loadExtents[i], resolution, projection);\n }\n }\n\n const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);\n let ready = true;\n const render =\n /**\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} index Index.\n */\n (feature, index) => {\n let styles;\n const styleFunction =\n feature.getStyleFunction() || vectorLayer.getStyleFunction();\n if (styleFunction) {\n styles = styleFunction(feature, resolution);\n }\n if (styles) {\n const dirty = this.renderFeature(\n feature,\n squaredTolerance,\n styles,\n replayGroup,\n userTransform,\n this.getLayer().getDeclutter(),\n index,\n );\n ready = ready && !dirty;\n }\n };\n\n const userExtent = toUserExtent(extent, projection);\n /** @type {Array<import(\"../../Feature.js\").default>} */\n const features = vectorSource.getFeaturesInExtent(userExtent);\n if (vectorLayerRenderOrder) {\n features.sort(vectorLayerRenderOrder);\n }\n for (let i = 0, ii = features.length; i < ii; ++i) {\n render(features[i], i);\n }\n this.renderedFeatures_ = features;\n this.ready = ready;\n\n const replayGroupInstructions = replayGroup.finish();\n const executorGroup = new ExecutorGroup(\n extent,\n resolution,\n pixelRatio,\n vectorSource.getOverlaps(),\n replayGroupInstructions,\n vectorLayer.getRenderBuffer(),\n !!frameState.declutter,\n );\n\n this.renderedResolution_ = resolution;\n this.renderedRevision_ = vectorLayerRevision;\n this.renderedRenderOrder_ = vectorLayerRenderOrder;\n this.renderedFrameDeclutter_ = !!frameState.declutter;\n this.renderedExtent_ = renderedExtent;\n this.wrappedRenderedExtent_ = extent;\n this.renderedCenter_ = center;\n this.renderedProjection_ = projection;\n this.renderedPixelRatio_ = pixelRatio;\n this.replayGroup_ = executorGroup;\n this.hitDetectionImageData_ = null;\n\n this.replayGroupChanged = true;\n return true;\n }\n\n /**\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} squaredTolerance Squared render tolerance.\n * @param {import(\"../../style/Style.js\").default|Array<import(\"../../style/Style.js\").default>} styles The style or array of styles.\n * @param {import(\"../../render/canvas/BuilderGroup.js\").default} builderGroup Builder group.\n * @param {import(\"../../proj.js\").TransformFunction} [transform] Transform from user to view projection.\n * @param {boolean} [declutter] Enable decluttering.\n * @param {number} [index] Render order index.\n * @return {boolean} `true` if an image is loading.\n */\n renderFeature(\n feature,\n squaredTolerance,\n styles,\n builderGroup,\n transform,\n declutter,\n index,\n ) {\n if (!styles) {\n return false;\n }\n let loading = false;\n if (Array.isArray(styles)) {\n for (let i = 0, ii = styles.length; i < ii; ++i) {\n loading =\n renderFeature(\n builderGroup,\n feature,\n styles[i],\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n transform,\n declutter,\n index,\n ) || loading;\n }\n } else {\n loading = renderFeature(\n builderGroup,\n feature,\n styles,\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n transform,\n declutter,\n index,\n );\n }\n return loading;\n }\n}\n\nexport default CanvasVectorLayerRenderer;\n", "/**\n * @module ol/layer/Vector\n */\nimport CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js';\nimport BaseVectorLayer from './BaseVector.js';\n\n/**\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the\n * renderer when getting features from the vector source for the rendering or hit-detection.\n * Recommended value: the size of the largest symbol, line width or label.\n * @property {VectorSourceType} [source] Source.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * @property {boolean|string|number} [declutter=false] Declutter images and text. Any truthy value will enable\n * decluttering. Within a layer, a feature rendered before another has higher priority. All layers with the\n * same `declutter` value will be decluttered together. The priority is determined by the drawing order of the\n * layers with the same `declutter` value. Higher in the layer stack means higher priority. To declutter distinct\n * layers or groups of layers separately, use different truthy values for `declutter`.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will\n * be recreated during animations. This means that no vectors will be shown clipped, but the\n * setting will have a performance impact for large amounts of vector data. When set to `false`,\n * batches will be recreated when no animation is active.\n * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will\n * be recreated during interactions. See also `updateWhileAnimating`.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Vector data is rendered client-side, as vectors. This layer type provides most accurate rendering\n * even during animations. Points and labels stay upright on rotated views. For very large\n * amounts of vector data, performance may suffer during pan and zoom animations. In this case,\n * try {@link module:ol/layer/VectorImage~VectorImageLayer}.\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @extends {BaseVectorLayer<FeatureType, VectorSourceType, CanvasVectorLayerRenderer>}\n * @api\n */\nclass VectorLayer extends BaseVectorLayer {\n /**\n * @param {Options<VectorSourceType, FeatureType>} [options] Options.\n */\n constructor(options) {\n super(options);\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new CanvasVectorLayerRenderer(this);\n }\n}\n\nexport default VectorLayer;\n", "/**\n * @module ol/featureloader\n */\n\n/**\n *\n * @type {boolean}\n * @private\n */\nlet withCredentials = false;\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * load features.\n *\n * This function takes up to 5 arguments. These are an {@link module:ol/extent~Extent} representing\n * the area to be loaded, a `{number}` representing the resolution (map units per pixel), a\n * {@link module:ol/proj/Projection~Projection} for the projection, an optional success callback that should get\n * the loaded features passed as an argument and an optional failure callback with no arguments. If\n * the callbacks are not used, the corresponding vector source will not fire `'featuresloadend'` and\n * `'featuresloaderror'` events. `this` within the function is bound to the\n * {@link module:ol/source/Vector~VectorSource} it's called from.\n *\n * The function is responsible for loading the features and adding them to the\n * source.\n *\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").FeatureLike]\n * @typedef {(\n * extent: import(\"./extent.js\").Extent,\n * resolution: number,\n * projection: import(\"./proj/Projection.js\").default,\n * success?: (features: Array<FeatureType>) => void,\n * failure?: () => void) => void} FeatureLoader\n * @api\n */\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * get the url to load features from.\n *\n * This function takes an {@link module:ol/extent~Extent} representing the area\n * to be loaded, a `{number}` representing the resolution (map units per pixel)\n * and an {@link module:ol/proj/Projection~Projection} for the projection as\n * arguments and returns a `{string}` representing the URL.\n * @typedef {function(import(\"./extent.js\").Extent, number, import(\"./proj/Projection.js\").default): string} FeatureUrlFunction\n * @api\n */\n\n/**\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").default]\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default<FeatureType>} format Feature format.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array<FeatureType>, import(\"./proj/Projection.js\").default): void} success Success\n * Function called with the loaded features and optionally with the data projection.\n * @param {function(): void} failure Failure\n * Function called when loading failed.\n */\nexport function loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n success,\n failure,\n) {\n const xhr = new XMLHttpRequest();\n xhr.open(\n 'GET',\n typeof url === 'function' ? url(extent, resolution, projection) : url,\n true,\n );\n if (format.getType() == 'arraybuffer') {\n xhr.responseType = 'arraybuffer';\n }\n xhr.withCredentials = withCredentials;\n /**\n * @param {Event} event Event.\n * @private\n */\n xhr.onload = function (event) {\n // status will be 0 for file:// urls\n if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {\n const type = format.getType();\n try {\n /** @type {Document|Node|Object|string|undefined} */\n let source;\n if (type == 'text' || type == 'json') {\n source = xhr.responseText;\n } else if (type == 'xml') {\n source = xhr.responseXML || xhr.responseText;\n } else if (type == 'arraybuffer') {\n source = /** @type {ArrayBuffer} */ (xhr.response);\n }\n if (source) {\n success(\n /** @type {Array<FeatureType>} */\n (\n format.readFeatures(source, {\n extent: extent,\n featureProjection: projection,\n })\n ),\n format.readProjection(source),\n );\n } else {\n failure();\n }\n } catch {\n failure();\n }\n } else {\n failure();\n }\n };\n /**\n * @private\n */\n xhr.onerror = failure;\n xhr.send();\n}\n\n/**\n * Create an XHR feature loader for a `url` and `format`. The feature loader\n * loads features (with XHR), parses the features, and adds them to the\n * vector source.\n *\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").default]\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default<FeatureType>} format Feature format.\n * @return {FeatureLoader<FeatureType>} The feature loader.\n * @api\n */\nexport function xhr(url, format) {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array<FeatureType>): void} [success] Success\n * Function called when loading succeeded.\n * @param {function(): void} [failure] Failure\n * Function called when loading failed.\n * @this {import(\"./source/Vector.js\").default<FeatureType>}\n */\n return function (extent, resolution, projection, success, failure) {\n loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n /**\n * @param {Array<FeatureType>} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data\n * projection.\n */\n (features, dataProjection) => {\n this.addFeatures(features);\n if (success !== undefined) {\n success(features);\n }\n },\n () => {\n this.changed();\n if (failure !== undefined) {\n failure();\n }\n },\n );\n };\n}\n\n/**\n * Setter for the withCredentials configuration for the XHR.\n *\n * @param {boolean} xhrWithCredentials The value of withCredentials to set.\n * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/\n * @api\n */\nexport function setWithCredentials(xhrWithCredentials) {\n withCredentials = xhrWithCredentials;\n}\n", "/**\n * @module ol/loadingstrategy\n */\n\nimport {fromUserExtent, fromUserResolution, toUserExtent} from './proj.js';\n\n/**\n * Strategy function for loading all features with a single request.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n * @api\n */\nexport function all(extent, resolution) {\n return [[-Infinity, -Infinity, Infinity, Infinity]];\n}\n\n/**\n * Strategy function for loading features based on the view's extent and\n * resolution.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n * @api\n */\nexport function bbox(extent, resolution) {\n return [extent];\n}\n\n/**\n * Creates a strategy function for loading features based on a tile grid.\n * @param {import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {function(import(\"./extent.js\").Extent, number, import(\"./proj.js\").Projection): Array<import(\"./extent.js\").Extent>} Loading strategy.\n * @api\n */\nexport function tile(tileGrid) {\n return (\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj.js\").Projection} projection Projection.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n */\n function (extent, resolution, projection) {\n const z = tileGrid.getZForResolution(\n fromUserResolution(resolution, projection),\n );\n const tileRange = tileGrid.getTileRangeForExtentAndZ(\n fromUserExtent(extent, projection),\n z,\n );\n /** @type {Array<import(\"./extent.js\").Extent>} */\n const extents = [];\n /** @type {import(\"./tilecoord.js\").TileCoord} */\n const tileCoord = [z, 0, 0];\n for (\n tileCoord[1] = tileRange.minX;\n tileCoord[1] <= tileRange.maxX;\n ++tileCoord[1]\n ) {\n for (\n tileCoord[2] = tileRange.minY;\n tileCoord[2] <= tileRange.maxY;\n ++tileCoord[2]\n ) {\n extents.push(\n toUserExtent(tileGrid.getTileCoordExtent(tileCoord), projection),\n );\n }\n }\n return extents;\n }\n );\n}\n", "/**\n * @module ol/Feature\n */\nimport BaseObject from './Object.js';\nimport {assert} from './asserts.js';\nimport EventType from './events/EventType.js';\nimport {listen, unlistenByKey} from './events.js';\n\n/**\n * @typedef {typeof Feature|typeof import(\"./render/Feature.js\").default} FeatureClass\n */\n\n/**\n * @typedef {Feature|import(\"./render/Feature.js\").default} FeatureLike\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<import(\"./ObjectEventType\").Types|'change:geometry', import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|import(\"./ObjectEventType\").Types\n * |'change:geometry', Return>} FeatureOnSignature\n */\n\n/***\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n * @template {Object<string, *>} [Properties=Object<string, *>]\n * @typedef {Properties & { geometry?: Geometry }} ObjectWithGeometry\n */\n\n/**\n * @classdesc\n * A vector object for geographic features with a geometry and other\n * attribute properties, similar to the features in vector file formats like\n * GeoJSON.\n *\n * Features can be styled individually with `setStyle`; otherwise they use the\n * style of their vector layer.\n *\n * Note that attribute properties are set as {@link module:ol/Object~BaseObject} properties on\n * the feature object, so they are observable, and have get/set accessors.\n *\n * Typically, a feature has a single geometry property. You can set the\n * geometry using the `setGeometry` method and get it with `getGeometry`.\n * It is possible to store more than one geometry on a feature using attribute\n * properties. By default, the geometry used for rendering is identified by\n * the property name `geometry`. If you want to use another geometry property\n * for rendering, use the `setGeometryName` method to change the attribute\n * property associated with the geometry for the feature. For example:\n *\n * ```js\n *\n * import Feature from 'ol/Feature.js';\n * import Polygon from 'ol/geom/Polygon.js';\n * import Point from 'ol/geom/Point.js';\n *\n * const feature = new Feature({\n * geometry: new Polygon(polyCoords),\n * labelPoint: new Point(labelCoords),\n * name: 'My Polygon',\n * });\n *\n * // get the polygon geometry\n * const poly = feature.getGeometry();\n *\n * // Render the feature as a point using the coordinates from labelPoint\n * feature.setGeometryName('labelPoint');\n *\n * // get the point geometry\n * const point = feature.getGeometry();\n * ```\n *\n * @api\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n * @template {Object<string, *>} [Properties=Object<string, *>]\n * @extends {BaseObject<NoInfer<Properties>>}\n */\nclass Feature extends BaseObject {\n /**\n * @param {Geometry|ObjectWithGeometry<Geometry, NoInfer<Properties>>} [geometryOrProperties]\n * You may pass a Geometry object directly, or an object literal containing\n * properties. If you pass an object literal, you may include a Geometry\n * associated with a `geometry` key.\n */\n constructor(geometryOrProperties) {\n super();\n\n /***\n * @type {FeatureOnSignature<import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {FeatureOnSignature<import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {FeatureOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = undefined;\n\n /**\n * @type {string}\n * @private\n */\n this.geometryName_ = 'geometry';\n\n /**\n * User provided style.\n * @private\n * @type {import(\"./style/Style.js\").StyleLike}\n */\n this.style_ = null;\n\n /**\n * @private\n * @type {import(\"./style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction_ = undefined;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.geometryChangeKey_ = null;\n\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n\n if (geometryOrProperties) {\n if (\n typeof (\n /** @type {?} */ (geometryOrProperties).getSimplifiedGeometry\n ) === 'function'\n ) {\n const geometry = /** @type {Geometry} */ (geometryOrProperties);\n this.setGeometry(geometry);\n } else {\n /** @type {?} */\n const properties = geometryOrProperties;\n this.setProperties(properties);\n }\n }\n }\n\n /**\n * Clone this feature. If the original feature has a geometry it\n * is also cloned. The feature id is not set in the clone.\n * @return {Feature<Geometry>} The clone.\n * @api\n */\n clone() {\n const clone = /** @type {Feature<Geometry>} */ (\n new Feature(this.hasProperties() ? this.getProperties() : null)\n );\n clone.setGeometryName(this.getGeometryName());\n const geometry = this.getGeometry();\n if (geometry) {\n clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));\n }\n const style = this.getStyle();\n if (style) {\n clone.setStyle(style);\n }\n return clone;\n }\n\n /**\n * Get the feature's default geometry. A feature may have any number of named\n * geometries. The \"default\" geometry (the one that is rendered by default) is\n * set when calling {@link module:ol/Feature~Feature#setGeometry}.\n * @return {Geometry|undefined} The default geometry for the feature.\n * @api\n * @observable\n */\n getGeometry() {\n return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is either set when reading data from a remote source or set explicitly by\n * calling {@link module:ol/Feature~Feature#setId}.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * Get the name of the feature's default geometry. By default, the default\n * geometry is named `geometry`.\n * @return {string} Get the property name associated with the default geometry\n * for this feature.\n * @api\n */\n getGeometryName() {\n return this.geometryName_;\n }\n\n /**\n * Get the feature's style. Will return what was provided to the\n * {@link module:ol/Feature~Feature#setStyle} method.\n * @return {import(\"./style/Style.js\").StyleLike|undefined} The feature style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the feature's style function.\n * @return {import(\"./style/Style.js\").StyleFunction|undefined} Return a function\n * representing the current style of this feature.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @private\n */\n handleGeometryChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleGeometryChanged_() {\n if (this.geometryChangeKey_) {\n unlistenByKey(this.geometryChangeKey_);\n this.geometryChangeKey_ = null;\n }\n const geometry = this.getGeometry();\n if (geometry) {\n this.geometryChangeKey_ = listen(\n geometry,\n EventType.CHANGE,\n this.handleGeometryChange_,\n this,\n );\n }\n this.changed();\n }\n\n /**\n * Set the default geometry for the feature. This will update the property\n * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.\n * @param {Geometry|undefined} geometry The new geometry.\n * @api\n * @observable\n */\n setGeometry(geometry) {\n this.set(this.geometryName_, geometry);\n }\n\n /**\n * Set the style for the feature to override the layer style. This can be a\n * single style object, an array of styles, or a function that takes a\n * resolution and returns an array of styles. To unset the feature style, call\n * `setStyle()` without arguments or a falsey value.\n * @param {import(\"./style/Style.js\").StyleLike} [style] Style for this feature.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setStyle(style) {\n this.style_ = style;\n this.styleFunction_ = !style ? undefined : createStyleFunction(style);\n this.changed();\n }\n\n /**\n * Set the feature id. The feature id is considered stable and may be used when\n * requesting features or comparing identifiers returned from a remote source.\n * The feature id can be used with the\n * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.\n * @param {number|string|undefined} id The feature id.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setId(id) {\n this.id_ = id;\n this.changed();\n }\n\n /**\n * Set the property name to be used when getting the feature's default geometry.\n * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with\n * this name will be returned.\n * @param {string} name The property name of the default geometry.\n * @api\n */\n setGeometryName(name) {\n this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.geometryName_ = name;\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.handleGeometryChanged_();\n }\n}\n\n/**\n * Convert the provided object into a feature style function. Functions passed\n * through unchanged. Arrays of Style or single style objects wrapped\n * in a new feature style function.\n * @param {!import(\"./style/Style.js\").StyleFunction|!Array<import(\"./style/Style.js\").default>|!import(\"./style/Style.js\").default} obj\n * A feature style function, a single style, or an array of styles.\n * @return {import(\"./style/Style.js\").StyleFunction} A style function.\n */\nexport function createStyleFunction(obj) {\n if (typeof obj === 'function') {\n return obj;\n }\n /**\n * @type {Array<import(\"./style/Style.js\").default>}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(\n typeof (/** @type {?} */ (obj).getZIndex) === 'function',\n 'Expected an `ol/style/Style` or an array of `ol/style/Style.js`',\n );\n const style = /** @type {import(\"./style/Style.js\").default} */ (obj);\n styles = [style];\n }\n return function () {\n return styles;\n };\n}\nexport default Feature;\n", "/**\n * @module ol/geom/flat/center\n */\nimport {createEmpty, createOrUpdateFromFlatCoordinates} from '../../extent.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @return {Array<number>} Flat centers.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n const flatCenters = [];\n let extent = createEmpty();\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n extent = createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n ends[0],\n stride,\n );\n flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);\n offset = ends[ends.length - 1];\n }\n return flatCenters;\n}\n", "/**\n * @module ol/geom/flat/interpolate\n */\nimport {binarySearch} from '../../array.js';\nimport {lerp} from '../../math.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} fraction Fraction.\n * @param {Array<number>} [dest] Destination.\n * @param {number} [dimension] Destination dimension (default is `2`)\n * @return {Array<number>} Destination.\n */\nexport function interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n fraction,\n dest,\n dimension,\n) {\n let o, t;\n const n = (end - offset) / stride;\n if (n === 1) {\n o = offset;\n } else if (n === 2) {\n o = offset;\n t = fraction;\n } else if (n !== 0) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n const cumulativeLengths = [0];\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n cumulativeLengths.push(length);\n x1 = x2;\n y1 = y2;\n }\n const target = fraction * length;\n const index = binarySearch(cumulativeLengths, target);\n if (index < 0) {\n t =\n (target - cumulativeLengths[-index - 2]) /\n (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);\n o = offset + (-index - 2) * stride;\n } else {\n o = offset + index * stride;\n }\n }\n dimension = dimension > 1 ? dimension : 2;\n dest = dest ? dest : new Array(dimension);\n for (let i = 0; i < dimension; ++i) {\n dest[i] =\n o === undefined\n ? NaN\n : t === undefined\n ? flatCoordinates[o + i]\n : lerp(flatCoordinates[o + i], flatCoordinates[o + stride + i], t);\n }\n return dest;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @return {import(\"../../coordinate.js\").Coordinate|null} Coordinate.\n */\nexport function lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n extrapolate,\n) {\n if (end == offset) {\n return null;\n }\n let coordinate;\n if (m < flatCoordinates[offset + stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(offset, offset + stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n if (flatCoordinates[end - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(end - stride, end);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n // FIXME use O(1) search\n if (m == flatCoordinates[offset + stride - 1]) {\n return flatCoordinates.slice(offset, offset + stride);\n }\n let lo = offset / stride;\n let hi = end / stride;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m < flatCoordinates[(mid + 1) * stride - 1]) {\n hi = mid;\n } else {\n lo = mid + 1;\n }\n }\n const m0 = flatCoordinates[lo * stride - 1];\n if (m == m0) {\n return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride);\n }\n const m1 = flatCoordinates[(lo + 1) * stride - 1];\n const t = (m - m0) / (m1 - m0);\n coordinate = [];\n for (let i = 0; i < stride - 1; ++i) {\n coordinate.push(\n lerp(\n flatCoordinates[(lo - 1) * stride + i],\n flatCoordinates[lo * stride + i],\n t,\n ),\n );\n }\n coordinate.push(m);\n return coordinate;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @param {boolean} interpolate Interpolate.\n * @return {import(\"../../coordinate.js\").Coordinate|null} Coordinate.\n */\nexport function lineStringsCoordinateAtM(\n flatCoordinates,\n offset,\n ends,\n stride,\n m,\n extrapolate,\n interpolate,\n) {\n if (interpolate) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n ends[ends.length - 1],\n stride,\n m,\n extrapolate,\n );\n }\n let coordinate;\n if (m < flatCoordinates[stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(0, stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n if (flatCoordinates[flatCoordinates.length - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(flatCoordinates.length - stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n if (offset == end) {\n continue;\n }\n if (m < flatCoordinates[offset + stride - 1]) {\n return null;\n }\n if (m <= flatCoordinates[end - 1]) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n false,\n );\n }\n offset = end;\n }\n return null;\n}\n", "/**\n * @module ol/geom/Circle\n */\nimport {createOrUpdate, forEachCorner, intersects} from '../extent.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {deflateCoordinate} from './flat/deflate.js';\nimport {rotate} from './flat/transform.js';\n\n/**\n * @classdesc\n * Circle geometry.\n *\n * @api\n */\nclass Circle extends SimpleGeometry {\n /**\n * @param {!import(\"../coordinate.js\").Coordinate} center Center.\n * For internal use, flat coordinates in combination with `layout` and no\n * `radius` are also accepted.\n * @param {number} [radius] Radius in units of the projection.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(center, radius, layout) {\n super();\n if (layout !== undefined && radius === undefined) {\n this.setFlatCoordinates(layout, center);\n } else {\n radius = radius ? radius : 0;\n this.setCenterAndRadius(center, radius, layout);\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Circle} Clone.\n * @api\n * @override\n */\n clone() {\n const circle = new Circle(\n this.flatCoordinates.slice(),\n undefined,\n this.layout,\n );\n circle.applyProperties(this);\n return circle;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n const flatCoordinates = this.flatCoordinates;\n const dx = x - flatCoordinates[0];\n const dy = y - flatCoordinates[1];\n const squaredDistance = dx * dx + dy * dy;\n if (squaredDistance < minSquaredDistance) {\n if (squaredDistance === 0) {\n for (let i = 0; i < this.stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n } else {\n const delta = this.getRadius() / Math.sqrt(squaredDistance);\n closestPoint[0] = flatCoordinates[0] + delta * dx;\n closestPoint[1] = flatCoordinates[1] + delta * dy;\n for (let i = 2; i < this.stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n }\n closestPoint.length = this.stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n const flatCoordinates = this.flatCoordinates;\n const dx = x - flatCoordinates[0];\n const dy = y - flatCoordinates[1];\n return dx * dx + dy * dy <= this.getRadiusSquared_();\n }\n\n /**\n * Return the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.\n * @return {import(\"../coordinate.js\").Coordinate} Center.\n * @api\n */\n getCenter() {\n return this.flatCoordinates.slice(0, this.stride);\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n const flatCoordinates = this.flatCoordinates;\n const radius = flatCoordinates[this.stride] - flatCoordinates[0];\n return createOrUpdate(\n flatCoordinates[0] - radius,\n flatCoordinates[1] - radius,\n flatCoordinates[0] + radius,\n flatCoordinates[1] + radius,\n extent,\n );\n }\n\n /**\n * Return the radius of the circle.\n * @return {number} Radius.\n * @api\n */\n getRadius() {\n return Math.sqrt(this.getRadiusSquared_());\n }\n\n /**\n * @private\n * @return {number} Radius squared.\n */\n getRadiusSquared_() {\n const dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0];\n const dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1];\n return dx * dx + dy * dy;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'Circle';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n const circleExtent = this.getExtent();\n if (intersects(extent, circleExtent)) {\n const center = this.getCenter();\n\n if (extent[0] <= center[0] && extent[2] >= center[0]) {\n return true;\n }\n if (extent[1] <= center[1] && extent[3] >= center[1]) {\n return true;\n }\n\n return forEachCorner(extent, this.intersectsCoordinate.bind(this));\n }\n return false;\n }\n\n /**\n * Set the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} center Center.\n * @api\n */\n setCenter(center) {\n const stride = this.stride;\n const radius = this.flatCoordinates[stride] - this.flatCoordinates[0];\n const flatCoordinates = center.slice();\n flatCoordinates[stride] = flatCoordinates[0] + radius;\n for (let i = 1; i < stride; ++i) {\n flatCoordinates[stride + i] = center[i];\n }\n this.setFlatCoordinates(this.layout, flatCoordinates);\n this.changed();\n }\n\n /**\n * Set the center (as {@link module:ol/coordinate~Coordinate coordinate}) and the radius (as\n * number) of the circle.\n * @param {!import(\"../coordinate.js\").Coordinate} center Center.\n * @param {number} radius Radius.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCenterAndRadius(center, radius, layout) {\n this.setLayout(layout, center, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n /** @type {Array<number>} */\n const flatCoordinates = this.flatCoordinates;\n let offset = deflateCoordinate(flatCoordinates, 0, center, this.stride);\n flatCoordinates[offset++] = flatCoordinates[0] + radius;\n for (let i = 1, ii = this.stride; i < ii; ++i) {\n flatCoordinates[offset++] = flatCoordinates[i];\n }\n flatCoordinates.length = offset;\n this.changed();\n }\n\n /**\n * @override\n */\n getCoordinates() {\n return null;\n }\n\n /**\n * @override\n */\n setCoordinates(coordinates, layout) {}\n\n /**\n * Set the radius of the circle. The radius is in the units of the projection.\n * @param {number} radius Radius.\n * @api\n */\n setRadius(radius) {\n this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;\n this.changed();\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in counter-clockwise radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n * @override\n */\n rotate(angle, anchor) {\n const center = this.getCenter();\n const stride = this.getStride();\n this.setCenter(\n rotate(center, 0, center.length, stride, angle, anchor, center),\n );\n this.changed();\n }\n}\n\n/**\n * Transform each coordinate of the circle from one coordinate reference system\n * to another. The geometry is modified in place.\n * If you do not want the geometry modified in place, first clone() it and\n * then use this function on the clone.\n *\n * Internally a circle is currently represented by two points: the center of\n * the circle `[cx, cy]`, and the point to the right of the circle\n * `[cx + r, cy]`. This `transform` function just transforms these two points.\n * So the resulting geometry is also a circle, and that circle does not\n * correspond to the shape that would be obtained by transforming every point\n * of the original circle.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {Circle} This geometry. Note that original geometry is\n * modified in place.\n * @function\n * @api\n */\nCircle.prototype.transform;\nexport default Circle;\n", "/**\n * @module ol/geom/GeometryCollection\n */\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {\n closestSquaredDistanceXY,\n createOrUpdateEmpty,\n extend,\n getCenter,\n} from '../extent.js';\nimport Geometry from './Geometry.js';\n\n/**\n * @classdesc\n * An array of {@link module:ol/geom/Geometry~Geometry} objects.\n *\n * @api\n */\nclass GeometryCollection extends Geometry {\n /**\n * @param {Array<Geometry>} geometries Geometries.\n */\n constructor(geometries) {\n super();\n\n /**\n * @private\n * @type {Array<Geometry>}\n */\n this.geometries_ = geometries;\n\n /**\n * @private\n * @type {Array<import(\"../events.js\").EventsKey>}\n */\n this.changeEventsKeys_ = [];\n\n this.listenGeometriesChange_();\n }\n\n /**\n * @private\n */\n unlistenGeometriesChange_() {\n this.changeEventsKeys_.forEach(unlistenByKey);\n this.changeEventsKeys_.length = 0;\n }\n\n /**\n * @private\n */\n listenGeometriesChange_() {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n this.changeEventsKeys_.push(\n listen(geometries[i], EventType.CHANGE, this.changed, this),\n );\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!GeometryCollection} Clone.\n * @api\n * @override\n */\n clone() {\n const geometryCollection = new GeometryCollection(\n cloneGeometries(this.geometries_),\n );\n geometryCollection.applyProperties(this);\n return geometryCollection;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n minSquaredDistance = geometries[i].closestPointXY(\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n return minSquaredDistance;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].containsXY(x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n createOrUpdateEmpty(extent);\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n extend(extent, geometries[i].getExtent());\n }\n return extent;\n }\n\n /**\n * Return the geometries that make up this geometry collection.\n * @return {Array<Geometry>} Geometries.\n * @api\n */\n getGeometries() {\n return cloneGeometries(this.geometries_);\n }\n\n /**\n * @return {Array<Geometry>} Geometries.\n */\n getGeometriesArray() {\n return this.geometries_;\n }\n\n /**\n * @return {Array<Geometry>} Geometries.\n */\n getGeometriesArrayRecursive() {\n /** @type {Array<Geometry>} */\n let geometriesArray = [];\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].getType() === this.getType()) {\n geometriesArray = geometriesArray.concat(\n /** @type {GeometryCollection} */ (\n geometries[i]\n ).getGeometriesArrayRecursive(),\n );\n } else {\n geometriesArray.push(geometries[i]);\n }\n }\n return geometriesArray;\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker algorithm.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {GeometryCollection} Simplified GeometryCollection.\n * @override\n */\n getSimplifiedGeometry(squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n if (\n squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance < this.simplifiedGeometryMaxMinSquaredTolerance)\n ) {\n return this;\n }\n\n const simplifiedGeometries = [];\n const geometries = this.geometries_;\n let simplified = false;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n const geometry = geometries[i];\n const simplifiedGeometry =\n geometry.getSimplifiedGeometry(squaredTolerance);\n simplifiedGeometries.push(simplifiedGeometry);\n if (simplifiedGeometry !== geometry) {\n simplified = true;\n }\n }\n if (simplified) {\n const simplifiedGeometryCollection = new GeometryCollection(\n simplifiedGeometries,\n );\n return simplifiedGeometryCollection;\n }\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'GeometryCollection';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].intersectsExtent(extent)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.geometries_.length === 0;\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n * @override\n */\n rotate(angle, anchor) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].rotate(angle, anchor);\n }\n this.changed();\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n * @override\n */\n scale(sx, sy, anchor) {\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].scale(sx, sy, anchor);\n }\n this.changed();\n }\n\n /**\n * Set the geometries that make up this geometry collection.\n * @param {Array<Geometry>} geometries Geometries.\n * @api\n */\n setGeometries(geometries) {\n this.setGeometriesArray(cloneGeometries(geometries));\n }\n\n /**\n * @param {Array<Geometry>} geometries Geometries.\n */\n setGeometriesArray(geometries) {\n this.unlistenGeometriesChange_();\n this.geometries_ = geometries;\n this.listenGeometriesChange_();\n this.changed();\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n * @override\n */\n applyTransform(transformFn) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].applyTransform(transformFn);\n }\n this.changed();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n * @override\n */\n translate(deltaX, deltaY) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].translate(deltaX, deltaY);\n }\n this.changed();\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.unlistenGeometriesChange_();\n super.disposeInternal();\n }\n}\n\n/**\n * @param {Array<Geometry>} geometries Geometries.\n * @return {Array<Geometry>} Cloned geometries.\n */\nfunction cloneGeometries(geometries) {\n return geometries.map((geometry) => geometry.clone());\n}\n\nexport default GeometryCollection;\n", "/**\n * @module ol/geom/LineString\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {interpolatePoint, lineStringCoordinateAtM} from './flat/interpolate.js';\nimport {intersectsLineString} from './flat/intersectsextent.js';\nimport {lineStringLength} from './flat/length.js';\nimport {forEach as forEachSegment} from './flat/segments.js';\nimport {douglasPeucker} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Linestring geometry.\n *\n * @api\n */\nclass LineString extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate|null}\n */\n this.flatMidpoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.flatMidpointRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed coordinate to the coordinates of the linestring.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @api\n */\n appendCoordinate(coordinate) {\n extend(this.flatCoordinates, coordinate);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LineString} Clone.\n * @api\n * @override\n */\n clone() {\n const lineString = new LineString(\n this.flatCoordinates.slice(),\n this.layout,\n );\n lineString.applyProperties(this);\n return lineString;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Iterate over each segment, calling the provided callback.\n * If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n *\n * @param {function(this: S, import(\"../coordinate.js\").Coordinate, import(\"../coordinate.js\").Coordinate): T} callback Function\n * called for each segment. The function will receive two arguments, the start and end coordinates of the segment.\n * @return {T|boolean} Value.\n * @template T,S\n * @api\n */\n forEachSegment(callback) {\n return forEachSegment(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n callback,\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * @param {number} m M.\n * @param {boolean} [extrapolate] Extrapolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate|null} Coordinate.\n * @api\n */\n getCoordinateAtM(m, extrapolate) {\n if (this.layout != 'XYM' && this.layout != 'XYZM') {\n return null;\n }\n extrapolate = extrapolate !== undefined ? extrapolate : false;\n return lineStringCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n m,\n extrapolate,\n );\n }\n\n /**\n * Return the coordinates of the linestring.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the coordinate at the provided fraction along the linestring.\n * The `fraction` is a number between 0 and 1, where 0 is the start of the\n * linestring and 1 is the end.\n * @param {number} fraction Fraction.\n * @param {import(\"../coordinate.js\").Coordinate} [dest] Optional coordinate whose values will\n * be modified. If not provided, a new coordinate will be returned.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinate of the interpolated point.\n * @api\n */\n getCoordinateAt(fraction, dest) {\n return interpolatePoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n fraction,\n dest,\n this.stride,\n );\n }\n\n /**\n * Return the length of the linestring on projected plane.\n * @return {number} Length (on projected plane).\n * @api\n */\n getLength() {\n return lineStringLength(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * @return {Array<number>} Flat midpoint.\n */\n getFlatMidpoint() {\n if (this.flatMidpointRevision_ != this.getRevision()) {\n this.flatMidpoint_ = this.getCoordinateAt(\n 0.5,\n this.flatMidpoint_ ?? undefined,\n );\n this.flatMidpointRevision_ = this.getRevision();\n }\n return /** @type {Array<number>} */ (this.flatMidpoint_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} Simplified LineString.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return new LineString(simplifiedFlatCoordinates, 'XY');\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'LineString';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLineString(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent,\n this.getExtent(),\n );\n }\n\n /**\n * Set the coordinates of the linestring.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default LineString;\n", "/**\n * @module ol/geom/MultiLineString\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport LineString from './LineString.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {\n interpolatePoint,\n lineStringsCoordinateAtM,\n} from './flat/interpolate.js';\nimport {intersectsLineStringArray} from './flat/intersectsextent.js';\nimport {lineStringLength} from './flat/length.js';\nimport {douglasPeuckerArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Multi-linestring geometry.\n *\n * @api\n */\nclass MultiLineString extends SimpleGeometry {\n /**\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>|LineString>|Array<number>} coordinates\n * Coordinates or LineString geometries. (For internal use, flat coordinates in\n * combination with `layout` and `ends` are also accepted.)\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array<number>} [ends] Flat coordinate ends for internal use.\n */\n constructor(coordinates, layout, ends) {\n super();\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (Array.isArray(coordinates[0])) {\n this.setCoordinates(\n /** @type {Array<Array<import(\"../coordinate.js\").Coordinate>>} */ (\n coordinates\n ),\n layout,\n );\n } else if (layout !== undefined && ends) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n this.ends_ = ends;\n } else {\n const lineStrings = /** @type {Array<LineString>} */ (coordinates);\n /** @type {Array<number>} */\n const flatCoordinates = [];\n const ends = [];\n for (let i = 0, ii = lineStrings.length; i < ii; ++i) {\n const lineString = lineStrings[i];\n extend(flatCoordinates, lineString.getFlatCoordinates());\n ends.push(flatCoordinates.length);\n }\n const layout =\n lineStrings.length === 0\n ? this.getLayout()\n : lineStrings[0].getLayout();\n this.setFlatCoordinates(layout, flatCoordinates);\n this.ends_ = ends;\n }\n }\n\n /**\n * Append the passed linestring to the multilinestring.\n * @param {LineString} lineString LineString.\n * @api\n */\n appendLineString(lineString) {\n extend(this.flatCoordinates, lineString.getFlatCoordinates().slice());\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiLineString} Clone.\n * @api\n * @override\n */\n clone() {\n const multiLineString = new MultiLineString(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice(),\n );\n multiLineString.applyProperties(this);\n return multiLineString;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * `interpolate` controls interpolation between consecutive LineStrings\n * within the MultiLineString. If `interpolate` is `true` the coordinates\n * will be linearly interpolated between the last coordinate of one LineString\n * and the first coordinate of the next LineString. If `interpolate` is\n * `false` then the function will return `null` for Ms falling between\n * LineStrings.\n *\n * @param {number} m M.\n * @param {boolean} [extrapolate] Extrapolate. Default is `false`.\n * @param {boolean} [interpolate] Interpolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate|null} Coordinate.\n * @api\n */\n getCoordinateAtM(m, extrapolate, interpolate) {\n if (\n (this.layout != 'XYM' && this.layout != 'XYZM') ||\n this.flatCoordinates.length === 0\n ) {\n return null;\n }\n extrapolate = extrapolate !== undefined ? extrapolate : false;\n interpolate = interpolate !== undefined ? interpolate : false;\n return lineStringsCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n m,\n extrapolate,\n interpolate,\n );\n }\n\n /**\n * Return the coordinates of the multilinestring.\n * @return {Array<Array<import(\"../coordinate.js\").Coordinate>>} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n );\n }\n\n /**\n * @return {Array<number>} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * Return the linestring at the specified index.\n * @param {number} index Index.\n * @return {LineString} LineString.\n * @api\n */\n getLineString(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LineString(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index],\n ),\n this.layout,\n );\n }\n\n /**\n * Return the linestrings of this multilinestring.\n * @return {Array<LineString>} LineStrings.\n * @api\n */\n getLineStrings() {\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const layout = this.layout;\n /** @type {Array<LineString>} */\n const lineStrings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const lineString = new LineString(\n flatCoordinates.slice(offset, end),\n layout,\n );\n lineStrings.push(lineString);\n offset = end;\n }\n return lineStrings;\n }\n\n /**\n * Return the sum of all line string lengths\n * @return {number} Length (on projected plane).\n * @api\n */\n getLength() {\n const ends = this.ends_;\n let start = 0;\n let length = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n length += lineStringLength(\n this.flatCoordinates,\n start,\n ends[i],\n this.stride,\n );\n start = ends[i];\n }\n return length;\n }\n\n /**\n * @return {Array<number>} Flat midpoints.\n */\n getFlatMidpoints() {\n /** @type {Array<number>} */\n const midpoints = [];\n const flatCoordinates = this.flatCoordinates;\n let offset = 0;\n const ends = this.ends_;\n const stride = this.stride;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const midpoint = interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n 0.5,\n );\n extend(midpoints, midpoint);\n offset = end;\n }\n return midpoints;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiLineString} Simplified MultiLineString.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array<number>} */\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = douglasPeuckerArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n return new MultiLineString(simplifiedFlatCoordinates, 'XY', simplifiedEnds);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'MultiLineString';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLineStringArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the multilinestring.\n * @param {!Array<Array<import(\"../coordinate.js\").Coordinate>>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_,\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default MultiLineString;\n", "/**\n * @module ol/geom/MultiPoint\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY, containsXY} from '../extent.js';\nimport {squaredDistance as squaredDx} from '../math.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {inflateCoordinates} from './flat/inflate.js';\n\n/**\n * @classdesc\n * Multi-point geometry.\n *\n * @api\n */\nclass MultiPoint extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n if (layout && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed point to this multipoint.\n * @param {Point} point Point.\n * @api\n */\n appendPoint(point) {\n extend(this.flatCoordinates, point.getFlatCoordinates());\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPoint} Clone.\n * @api\n * @override\n */\n clone() {\n const multiPoint = new MultiPoint(\n this.flatCoordinates.slice(),\n this.layout,\n );\n multiPoint.applyProperties(this);\n return multiPoint;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[i],\n flatCoordinates[i + 1],\n );\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (let j = 0; j < stride; ++j) {\n closestPoint[j] = flatCoordinates[i + j];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n }\n\n /**\n * Return the coordinates of the multipoint.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the point at the specified index.\n * @param {number} index Index.\n * @return {Point} Point.\n * @api\n */\n getPoint(index) {\n const n = this.flatCoordinates.length / this.stride;\n if (index < 0 || n <= index) {\n return null;\n }\n return new Point(\n this.flatCoordinates.slice(\n index * this.stride,\n (index + 1) * this.stride,\n ),\n this.layout,\n );\n }\n\n /**\n * Return the points of this multipoint.\n * @return {Array<Point>} Points.\n * @api\n */\n getPoints() {\n const flatCoordinates = this.flatCoordinates;\n const layout = this.layout;\n const stride = this.stride;\n /** @type {Array<Point>} */\n const points = [];\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const point = new Point(flatCoordinates.slice(i, i + stride), layout);\n points.push(point);\n }\n return points;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'MultiPoint';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n if (containsXY(extent, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Set the coordinates of the multipoint.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default MultiPoint;\n", "/**\n * @module ol/geom/MultiPolygon\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport MultiPoint from './MultiPoint.js';\nimport Polygon from './Polygon.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {linearRingss as linearRingssArea} from './flat/area.js';\nimport {linearRingss as linearRingssCenter} from './flat/center.js';\nimport {\n assignClosestMultiArrayPoint,\n multiArrayMaxSquaredDelta,\n} from './flat/closest.js';\nimport {linearRingssContainsXY} from './flat/contains.js';\nimport {deflateMultiCoordinatesArray} from './flat/deflate.js';\nimport {inflateMultiCoordinatesArray} from './flat/inflate.js';\nimport {getInteriorPointsOfMultiArray} from './flat/interiorpoint.js';\nimport {intersectsLinearRingMultiArray} from './flat/intersectsextent.js';\nimport {\n linearRingssAreOriented,\n orientLinearRingsArray,\n} from './flat/orient.js';\nimport {quantizeMultiArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Multi-polygon geometry.\n *\n * @api\n */\nclass MultiPolygon extends SimpleGeometry {\n /**\n * @param {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` and `endss` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array<Array<number>>} [endss] Array of ends for internal use with flat coordinates.\n */\n constructor(coordinates, layout, endss) {\n super();\n\n /**\n * @type {Array<Array<number>>}\n * @private\n */\n this.endss_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointsRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.flatInteriorPoints_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (!endss && !Array.isArray(coordinates[0])) {\n const polygons = /** @type {Array<Polygon>} */ (coordinates);\n /** @type {Array<number>} */\n const flatCoordinates = [];\n const thisEndss = [];\n for (let i = 0, ii = polygons.length; i < ii; ++i) {\n const polygon = polygons[i];\n const offset = flatCoordinates.length;\n const ends = polygon.getEnds();\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] += offset;\n }\n extend(flatCoordinates, polygon.getFlatCoordinates());\n thisEndss.push(ends);\n }\n layout =\n polygons.length === 0 ? this.getLayout() : polygons[0].getLayout();\n coordinates = flatCoordinates;\n endss = thisEndss;\n }\n if (layout !== undefined && endss) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n this.endss_ = endss;\n } else {\n this.setCoordinates(\n /** @type {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed polygon to this multipolygon.\n * @param {Polygon} polygon Polygon.\n * @api\n */\n appendPolygon(polygon) {\n /** @type {Array<number>} */\n let ends;\n if (!this.flatCoordinates) {\n this.flatCoordinates = polygon.getFlatCoordinates().slice();\n ends = polygon.getEnds().slice();\n this.endss_.push();\n } else {\n const offset = this.flatCoordinates.length;\n extend(this.flatCoordinates, polygon.getFlatCoordinates());\n ends = polygon.getEnds().slice();\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] += offset;\n }\n }\n this.endss_.push(ends);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPolygon} Clone.\n * @api\n * @override\n */\n clone() {\n const len = this.endss_.length;\n const newEndss = new Array(len);\n for (let i = 0; i < len; ++i) {\n newEndss[i] = this.endss_[i].slice();\n }\n\n const multiPolygon = new MultiPolygon(\n this.flatCoordinates.slice(),\n this.layout,\n newEndss,\n );\n multiPolygon.applyProperties(this);\n\n return multiPolygon;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n multiArrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestMultiArrayPoint(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n return linearRingssContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n x,\n y,\n );\n }\n\n /**\n * Return the area of the multipolygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingssArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for multi-polygons.\n *\n * @param {boolean} [right] Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} Coordinates.\n * @api\n * @override\n */\n getCoordinates(right) {\n let flatCoordinates;\n if (right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRingsArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n right,\n );\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateMultiCoordinatesArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n );\n }\n\n /**\n * @return {Array<Array<number>>} Endss.\n */\n getEndss() {\n return this.endss_;\n }\n\n /**\n * @return {Array<number>} Flat interior points.\n */\n getFlatInteriorPoints() {\n if (this.flatInteriorPointsRevision_ != this.getRevision()) {\n const flatCenters = linearRingssCenter(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n );\n this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n flatCenters,\n );\n this.flatInteriorPointsRevision_ = this.getRevision();\n }\n return /** @type {Array<number>} */ (this.flatInteriorPoints_);\n }\n\n /**\n * Return the interior points as {@link module:ol/geom/MultiPoint~MultiPoint multipoint}.\n * @return {MultiPoint} Interior points as XYM coordinates, where M is\n * the length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoints() {\n return new MultiPoint(this.getFlatInteriorPoints().slice(), 'XYM');\n }\n\n /**\n * @return {Array<number>} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (\n linearRingssAreOriented(flatCoordinates, 0, this.endss_, this.stride)\n ) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRingsArray(\n this.orientedFlatCoordinates_,\n 0,\n this.endss_,\n this.stride,\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return /** @type {Array<number>} */ (this.orientedFlatCoordinates_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiPolygon} Simplified MultiPolygon.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array<Array<number>>} */\n const simplifiedEndss = [];\n simplifiedFlatCoordinates.length = quantizeMultiArray(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEndss,\n );\n return new MultiPolygon(simplifiedFlatCoordinates, 'XY', simplifiedEndss);\n }\n\n /**\n * Return the polygon at the specified index.\n * @param {number} index Index.\n * @return {Polygon} Polygon.\n * @api\n */\n getPolygon(index) {\n if (index < 0 || this.endss_.length <= index) {\n return null;\n }\n let offset;\n if (index === 0) {\n offset = 0;\n } else {\n const prevEnds = this.endss_[index - 1];\n offset = prevEnds[prevEnds.length - 1];\n }\n const ends = this.endss_[index].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] -= offset;\n }\n }\n return new Polygon(\n this.flatCoordinates.slice(offset, end),\n this.layout,\n ends,\n );\n }\n\n /**\n * Return the polygons of this multipolygon.\n * @return {Array<Polygon>} Polygons.\n * @api\n */\n getPolygons() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const endss = this.endss_;\n const polygons = [];\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] -= offset;\n }\n }\n const polygon = new Polygon(\n flatCoordinates.slice(offset, end),\n layout,\n ends,\n );\n polygons.push(polygon);\n offset = end;\n }\n return polygons;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'MultiPolygon';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLinearRingMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the multipolygon.\n * @param {!Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 3);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const endss = deflateMultiCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.endss_,\n );\n if (endss.length === 0) {\n this.flatCoordinates.length = 0;\n } else {\n const lastEnds = endss[endss.length - 1];\n this.flatCoordinates.length =\n lastEnds.length === 0 ? 0 : lastEnds[lastEnds.length - 1];\n }\n this.changed();\n }\n}\n\nexport default MultiPolygon;\n", "/**\n * @module ol/render/Feature\n */\nimport Feature from '../Feature.js';\nimport {extend} from '../array.js';\nimport {\n createOrUpdateFromCoordinate,\n createOrUpdateFromFlatCoordinates,\n getCenter,\n getHeight,\n} from '../extent.js';\nimport {memoizeOne} from '../functions.js';\nimport {linearRingss as linearRingssCenter} from '../geom/flat/center.js';\nimport {\n getInteriorPointOfArray,\n getInteriorPointsOfMultiArray,\n} from '../geom/flat/interiorpoint.js';\nimport {interpolatePoint} from '../geom/flat/interpolate.js';\nimport {inflateEnds} from '../geom/flat/orient.js';\nimport {\n douglasPeucker,\n douglasPeuckerArray,\n quantizeArray,\n} from '../geom/flat/simplify.js';\nimport {transform2D} from '../geom/flat/transform.js';\nimport {\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from '../geom.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../transform.js';\n\n/**\n * @typedef {'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString'} Type\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'` or 'MultiLineString'`.\n */\n\n/**\n * @type {import(\"../transform.js\").Transform}\n */\nconst tmpTransform = createTransform();\n\n/**\n * Lightweight, read-only, {@link module:ol/Feature~Feature} and {@link module:ol/geom/Geometry~Geometry} like\n * structure, optimized for vector tile rendering and styling. Geometry access\n * through the API is limited to getting the type and extent of the geometry.\n */\nclass RenderFeature {\n /**\n * @param {Type} type Geometry type.\n * @param {Array<number>} flatCoordinates Flat coordinates. These always need\n * to be right-handed for polygons.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Object<string, *>} properties Properties.\n * @param {number|string|undefined} id Feature id.\n */\n constructor(type, flatCoordinates, ends, stride, properties, id) {\n /**\n * @type {import(\"../style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent|undefined}\n */\n this.extent_;\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = id;\n\n /**\n * @private\n * @type {Type}\n */\n this.type_ = type;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.flatCoordinates_ = flatCoordinates;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.flatInteriorPoints_ = null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.flatMidpoints_ = null;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.ends_ = ends || null;\n\n /**\n * @private\n * @type {Object<string, *>}\n */\n this.properties_ = properties;\n\n /**\n * @private\n * @type {number}\n */\n this.squaredTolerance_;\n\n /**\n * @private\n * @type {number}\n */\n this.stride_ = stride;\n\n /**\n * @private\n * @type {RenderFeature}\n */\n this.simplifiedGeometry_;\n }\n\n /**\n * Get a feature property by its key.\n * @param {string} key Key\n * @return {*} Value for the requested key.\n * @api\n */\n get(key) {\n return this.properties_[key];\n }\n\n /**\n * Get the extent of this feature's geometry.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent() {\n if (!this.extent_) {\n this.extent_ =\n this.type_ === 'Point'\n ? createOrUpdateFromCoordinate(this.flatCoordinates_)\n : createOrUpdateFromFlatCoordinates(\n this.flatCoordinates_,\n 0,\n this.flatCoordinates_.length,\n 2,\n );\n }\n return this.extent_;\n }\n\n /**\n * @return {Array<number>} Flat interior points.\n */\n getFlatInteriorPoint() {\n if (!this.flatInteriorPoints_) {\n const flatCenter = getCenter(this.getExtent());\n this.flatInteriorPoints_ = getInteriorPointOfArray(\n this.flatCoordinates_,\n 0,\n this.ends_,\n 2,\n flatCenter,\n 0,\n );\n }\n return this.flatInteriorPoints_;\n }\n\n /**\n * @return {Array<number>} Flat interior points.\n */\n getFlatInteriorPoints() {\n if (!this.flatInteriorPoints_) {\n const ends = inflateEnds(this.flatCoordinates_, this.ends_);\n const flatCenters = linearRingssCenter(this.flatCoordinates_, 0, ends, 2);\n this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(\n this.flatCoordinates_,\n 0,\n ends,\n 2,\n flatCenters,\n );\n }\n return this.flatInteriorPoints_;\n }\n\n /**\n * @return {Array<number>} Flat midpoint.\n */\n getFlatMidpoint() {\n if (!this.flatMidpoints_) {\n this.flatMidpoints_ = interpolatePoint(\n this.flatCoordinates_,\n 0,\n this.flatCoordinates_.length,\n 2,\n 0.5,\n );\n }\n return this.flatMidpoints_;\n }\n\n /**\n * @return {Array<number>} Flat midpoints.\n */\n getFlatMidpoints() {\n if (!this.flatMidpoints_) {\n this.flatMidpoints_ = [];\n const flatCoordinates = this.flatCoordinates_;\n let offset = 0;\n const ends = /** @type {Array<number>} */ (this.ends_);\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const midpoint = interpolatePoint(flatCoordinates, offset, end, 2, 0.5);\n extend(this.flatMidpoints_, midpoint);\n offset = end;\n }\n }\n return this.flatMidpoints_;\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is set when reading data from a remote source.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * @return {Array<number>} Flat coordinates.\n */\n getOrientedFlatCoordinates() {\n return this.flatCoordinates_;\n }\n\n /**\n * For API compatibility with {@link module:ol/Feature~Feature}, this method is useful when\n * determining the geometry type in style function (see {@link #getType}).\n * @return {RenderFeature} Feature.\n * @api\n */\n getGeometry() {\n return this;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {RenderFeature} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n return this;\n }\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {RenderFeature} Simplified geometry.\n */\n simplifyTransformed(squaredTolerance, transform) {\n return this;\n }\n\n /**\n * Get the feature properties.\n * @return {Object<string, *>} Feature properties.\n * @api\n */\n getProperties() {\n return this.properties_;\n }\n\n /**\n * Get an object of all property names and values. This has the same behavior as getProperties,\n * but is here to conform with the {@link module:ol/Feature~Feature} interface.\n * @return {Object<string, *>?} Object.\n */\n getPropertiesInternal() {\n return this.properties_;\n }\n\n /**\n * @return {number} Stride.\n */\n getStride() {\n return this.stride_;\n }\n\n /**\n * @return {import('../style/Style.js').StyleFunction|undefined} Style\n */\n getStyleFunction() {\n return this.styleFunction;\n }\n\n /**\n * Get the type of this feature's geometry.\n * @return {Type} Geometry type.\n * @api\n */\n getType() {\n return this.type_;\n }\n\n /**\n * Transform geometry coordinates from tile pixel space to projected.\n *\n * @param {import(\"../proj.js\").ProjectionLike} projection The data projection\n */\n transform(projection) {\n projection = getProjection(projection);\n const pixelExtent = projection.getExtent();\n const projectedExtent = projection.getWorldExtent();\n if (pixelExtent && projectedExtent) {\n const scale = getHeight(projectedExtent) / getHeight(pixelExtent);\n composeTransform(\n tmpTransform,\n projectedExtent[0],\n projectedExtent[3],\n scale,\n -scale,\n 0,\n 0,\n 0,\n );\n transform2D(\n this.flatCoordinates_,\n 0,\n this.flatCoordinates_.length,\n 2,\n tmpTransform,\n this.flatCoordinates_,\n );\n }\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n */\n applyTransform(transformFn) {\n transformFn(this.flatCoordinates_, this.flatCoordinates_, this.stride_);\n }\n\n /**\n * @return {RenderFeature} A cloned render feature.\n */\n clone() {\n return new RenderFeature(\n this.type_,\n this.flatCoordinates_.slice(),\n this.ends_?.slice(),\n this.stride_,\n Object.assign({}, this.properties_),\n this.id_,\n );\n }\n\n /**\n * @return {Array<number>|null} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * Add transform and resolution based geometry simplification to this instance.\n * @return {RenderFeature} This render feature.\n */\n enableSimplifyTransformed() {\n this.simplifyTransformed = memoizeOne((squaredTolerance, transform) => {\n if (squaredTolerance === this.squaredTolerance_) {\n return this.simplifiedGeometry_;\n }\n this.simplifiedGeometry_ = this.clone();\n if (transform) {\n this.simplifiedGeometry_.applyTransform(transform);\n }\n const simplifiedFlatCoordinates =\n this.simplifiedGeometry_.getFlatCoordinates();\n let simplifiedEnds;\n switch (this.type_) {\n case 'LineString':\n simplifiedFlatCoordinates.length = douglasPeucker(\n simplifiedFlatCoordinates,\n 0,\n this.simplifiedGeometry_.flatCoordinates_.length,\n this.simplifiedGeometry_.stride_,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n simplifiedEnds = [simplifiedFlatCoordinates.length];\n break;\n case 'MultiLineString':\n simplifiedEnds = [];\n simplifiedFlatCoordinates.length = douglasPeuckerArray(\n simplifiedFlatCoordinates,\n 0,\n this.simplifiedGeometry_.ends_,\n this.simplifiedGeometry_.stride_,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n break;\n case 'Polygon':\n simplifiedEnds = [];\n simplifiedFlatCoordinates.length = quantizeArray(\n simplifiedFlatCoordinates,\n 0,\n this.simplifiedGeometry_.ends_,\n this.simplifiedGeometry_.stride_,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n break;\n default:\n }\n if (simplifiedEnds) {\n this.simplifiedGeometry_ = new RenderFeature(\n this.type_,\n simplifiedFlatCoordinates,\n simplifiedEnds,\n 2,\n this.properties_,\n this.id_,\n );\n }\n this.squaredTolerance_ = squaredTolerance;\n return this.simplifiedGeometry_;\n });\n return this;\n }\n}\n\n/**\n * @return {Array<number>} Flat coordinates.\n */\nRenderFeature.prototype.getFlatCoordinates =\n RenderFeature.prototype.getOrientedFlatCoordinates;\n\n/**\n * Create a geometry from an `ol/render/Feature`\n * @param {RenderFeature} renderFeature\n * Render Feature\n * @return {Point|MultiPoint|LineString|MultiLineString|Polygon|MultiPolygon}\n * New geometry instance.\n * @api\n */\nexport function toGeometry(renderFeature) {\n const geometryType = renderFeature.getType();\n switch (geometryType) {\n case 'Point':\n return new Point(renderFeature.getFlatCoordinates());\n case 'MultiPoint':\n return new MultiPoint(renderFeature.getFlatCoordinates(), 'XY');\n case 'LineString':\n return new LineString(renderFeature.getFlatCoordinates(), 'XY');\n case 'MultiLineString':\n return new MultiLineString(\n renderFeature.getFlatCoordinates(),\n 'XY',\n /** @type {Array<number>} */ (renderFeature.getEnds()),\n );\n case 'Polygon':\n const flatCoordinates = renderFeature.getFlatCoordinates();\n const ends = renderFeature.getEnds();\n const endss = inflateEnds(flatCoordinates, ends);\n return endss.length > 1\n ? new MultiPolygon(flatCoordinates, 'XY', endss)\n : new Polygon(flatCoordinates, 'XY', ends);\n default:\n throw new Error('Invalid geometry type:' + geometryType);\n }\n}\n\n/**\n * Create an `ol/Feature` from an `ol/render/Feature`\n * @param {RenderFeature} renderFeature RenderFeature\n * @param {string} [geometryName] Geometry name to use\n * when creating the Feature.\n * @return {Feature} Newly constructed `ol/Feature` with properties,\n * geometry, and id copied over.\n * @api\n */\nexport function toFeature(renderFeature, geometryName) {\n const id = renderFeature.getId();\n const geometry = toGeometry(renderFeature);\n const properties = renderFeature.getProperties();\n const feature = new Feature();\n if (geometryName !== undefined) {\n feature.setGeometryName(geometryName);\n }\n feature.setGeometry(geometry);\n if (id !== undefined) {\n feature.setId(id);\n }\n feature.setProperties(properties, true);\n return feature;\n}\n\nexport default RenderFeature;\n", "/**\n * @module ol/structs/RBush\n */\nimport RBush_ from 'rbush';\nimport {createOrUpdate, equals} from '../extent.js';\nimport {isEmpty} from '../obj.js';\nimport {getUid} from '../util.js';\n\n/**\n * @typedef {import(\"rbush\").BBox & {value: T}} Entry\n * @template T\n */\n\n/**\n * @classdesc\n * Wrapper around the RBush by Vladimir Agafonkin.\n * See https://github.com/mourner/rbush.\n *\n * @template {Object} T\n */\nclass RBush {\n /**\n * @param {number} [maxEntries] Max entries.\n */\n constructor(maxEntries) {\n /**\n * @private\n * @type {RBush_<Entry<T>>}\n */\n this.rbush_ = new RBush_(maxEntries);\n\n /**\n * A mapping between the objects added to this rbush wrapper\n * and the objects that are actually added to the internal rbush.\n * @private\n * @type {Object<string, Entry<T>>}\n */\n this.items_ = {};\n }\n\n /**\n * Insert a value into the RBush.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {T} value Value.\n */\n insert(extent, value) {\n /** @type {Entry<T>} */\n const item = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n value: value,\n };\n\n this.rbush_.insert(item);\n this.items_[getUid(value)] = item;\n }\n\n /**\n * Bulk-insert values into the RBush.\n * @param {Array<import(\"../extent.js\").Extent>} extents Extents.\n * @param {Array<T>} values Values.\n */\n load(extents, values) {\n const items = new Array(values.length);\n for (let i = 0, l = values.length; i < l; i++) {\n const extent = extents[i];\n const value = values[i];\n\n /** @type {Entry<T>} */\n const item = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n value: value,\n };\n items[i] = item;\n this.items_[getUid(value)] = item;\n }\n this.rbush_.load(items);\n }\n\n /**\n * Remove a value from the RBush.\n * @param {T} value Value.\n * @return {boolean} Removed.\n */\n remove(value) {\n const uid = getUid(value);\n\n // get the object in which the value was wrapped when adding to the\n // internal rbush. then use that object to do the removal.\n const item = this.items_[uid];\n delete this.items_[uid];\n return this.rbush_.remove(item) !== null;\n }\n\n /**\n * Update the extent of a value in the RBush.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {T} value Value.\n */\n update(extent, value) {\n const item = this.items_[getUid(value)];\n const bbox = [item.minX, item.minY, item.maxX, item.maxY];\n if (!equals(bbox, extent)) {\n this.remove(value);\n this.insert(extent, value);\n }\n }\n\n /**\n * Return all values in the RBush.\n * @return {Array<T>} All.\n */\n getAll() {\n const items = this.rbush_.all();\n return items.map(function (item) {\n return item.value;\n });\n }\n\n /**\n * Return all values in the given extent.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {Array<T>} All in extent.\n */\n getInExtent(extent) {\n /** @type {import(\"rbush\").BBox} */\n const bbox = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n };\n const items = this.rbush_.search(bbox);\n return items.map(function (item) {\n return item.value;\n });\n }\n\n /**\n * Calls a callback function with each value in the tree.\n * If the callback returns a truthy value, this value is returned without\n * checking the rest of the tree.\n * @param {function(T): R} callback Callback.\n * @return {R|undefined} Callback return value.\n * @template R\n */\n forEach(callback) {\n return this.forEach_(this.getAll(), callback);\n }\n\n /**\n * Calls a callback function with each value in the provided extent.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(T): R} callback Callback.\n * @return {R|undefined} Callback return value.\n * @template R\n */\n forEachInExtent(extent, callback) {\n return this.forEach_(this.getInExtent(extent), callback);\n }\n\n /**\n * @param {Array<T>} values Values.\n * @param {function(T): R} callback Callback.\n * @return {R|undefined} Callback return value.\n * @template R\n * @private\n */\n forEach_(values, callback) {\n let result;\n for (let i = 0, l = values.length; i < l; i++) {\n result = callback(values[i]);\n if (result) {\n return result;\n }\n }\n return result;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return isEmpty(this.items_);\n }\n\n /**\n * Remove all values from the RBush.\n */\n clear() {\n this.rbush_.clear();\n this.items_ = {};\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} [extent] Extent.\n * @return {import(\"../extent.js\").Extent} Extent.\n */\n getExtent(extent) {\n const data = this.rbush_.toJSON();\n return createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, extent);\n }\n\n /**\n * @param {RBush<T>} rbush R-Tree.\n */\n concat(rbush) {\n this.rbush_.load(rbush.rbush_.all());\n for (const i in rbush.items_) {\n this.items_[i] = rbush.items_[i];\n }\n }\n}\n\nexport default RBush;\n", "/**\n * @module ol/source/VectorEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a feature is added to the source.\n * @event module:ol/source/Vector.VectorSourceEvent#addfeature\n * @api\n */\n ADDFEATURE: 'addfeature',\n\n /**\n * Triggered when a feature is updated.\n * @event module:ol/source/Vector.VectorSourceEvent#changefeature\n * @api\n */\n CHANGEFEATURE: 'changefeature',\n\n /**\n * Triggered when the clear method is called on the source.\n * @event module:ol/source/Vector.VectorSourceEvent#clear\n * @api\n */\n CLEAR: 'clear',\n\n /**\n * Triggered when a feature is removed from the source.\n * See {@link module:ol/source/Vector~VectorSource#clear source.clear()} for exceptions.\n * @event module:ol/source/Vector.VectorSourceEvent#removefeature\n * @api\n */\n REMOVEFEATURE: 'removefeature',\n\n /**\n * Triggered when features starts loading.\n * @event module:ol/source/Vector.VectorSourceEvent#featuresloadstart\n * @api\n */\n FEATURESLOADSTART: 'featuresloadstart',\n\n /**\n * Triggered when features finishes loading.\n * @event module:ol/source/Vector.VectorSourceEvent#featuresloadend\n * @api\n */\n FEATURESLOADEND: 'featuresloadend',\n\n /**\n * Triggered if feature loading results in an error.\n * @event module:ol/source/Vector.VectorSourceEvent#featuresloaderror\n * @api\n */\n FEATURESLOADERROR: 'featuresloaderror',\n};\n\n/**\n * @typedef {'addfeature'|'changefeature'|'clear'|'removefeature'|'featuresloadstart'|'featuresloadend'|'featuresloaderror'} VectorSourceEventTypes\n */\n", "/**\n * @module ol/source/Vector\n */\n\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport {extend} from '../array.js';\nimport {assert} from '../asserts.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {containsExtent, equals, wrapAndSliceX} from '../extent.js';\nimport {xhr} from '../featureloader.js';\nimport {TRUE, VOID} from '../functions.js';\nimport {all as allStrategy} from '../loadingstrategy.js';\nimport {isEmpty} from '../obj.js';\nimport RenderFeature from '../render/Feature.js';\nimport RBush from '../structs/RBush.js';\nimport {getUid} from '../util.js';\nimport Source from './Source.js';\nimport VectorEventType from './VectorEventType.js';\n\n/**\n * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and\n * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this\n * is one of the standard {@link module:ol/loadingstrategy} strategies.\n *\n * @typedef {function(import(\"../extent.js\").Extent, number, import(\"../proj/Projection.js\").default): Array<import(\"../extent.js\").Extent>} LoadingStrategy\n * @api\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/source/Vector~VectorSource} instances are instances of this\n * type.\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n */\nexport class VectorSourceEvent extends Event {\n /**\n * @param {string} type Type.\n * @param {FeatureType} [feature] Feature.\n * @param {Array<FeatureType>} [features] Features.\n */\n constructor(type, feature, features) {\n super(type);\n\n /**\n * The added or removed feature for the `ADDFEATURE` and `REMOVEFEATURE` events, `undefined` otherwise.\n * @type {FeatureType|undefined}\n * @api\n */\n this.feature = feature;\n\n /**\n * The loaded features for the `FEATURESLOADED` event, `undefined` otherwise.\n * @type {Array<FeatureType>|undefined}\n * @api\n */\n this.features = features;\n }\n}\n\n/***\n * @template {import(\"../Feature.js\").FeatureLike} [T=import(\"../Feature.js\").default]\n * @typedef {T extends RenderFeature ? T|Array<T> : T} FeatureClassOrArrayOfRenderFeatures\n */\n\n/***\n * @template Return\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<import(\"./VectorEventType\").VectorSourceEventTypes, VectorSourceEvent<FeatureType>, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * import(\"./VectorEventType\").VectorSourceEventTypes, Return>} VectorSourceOnSignature\n */\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {Array<FeatureType>|Collection<FeatureType>} [features]\n * Features. If provided as {@link module:ol/Collection~Collection}, the features in the source\n * and the collection will stay in sync.\n * @property {import(\"../format/Feature.js\").default<FeatureType>} [format] The feature format used by the XHR\n * feature loader when `url` is set. Required if `url` is set, otherwise ignored.\n * @property {import(\"../featureloader.js\").FeatureLoader<FeatureType>} [loader]\n * The loader function used to load features, from a remote source for example.\n * If this is not set and `url` is set, the source will create and use an XHR\n * feature loader. The `'featuresloadend'` and `'featuresloaderror'` events\n * will only fire if the `success` and `failure` callbacks are used.\n *\n * Example:\n *\n * ```js\n * import Vector from 'ol/source/Vector.js';\n * import GeoJSON from 'ol/format/GeoJSON.js';\n * import {bbox} from 'ol/loadingstrategy.js';\n *\n * const vectorSource = new Vector({\n * format: new GeoJSON(),\n * loader: function(extent, resolution, projection, success, failure) {\n * const proj = projection.getCode();\n * const url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +\n * 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +\n * 'outputFormat=application/json&srsname=' + proj + '&' +\n * 'bbox=' + extent.join(',') + ',' + proj;\n * const xhr = new XMLHttpRequest();\n * xhr.open('GET', url);\n * const onError = function() {\n * vectorSource.removeLoadedExtent(extent);\n * failure();\n * }\n * xhr.onerror = onError;\n * xhr.onload = function() {\n * if (xhr.status == 200) {\n * const features = vectorSource.getFormat().readFeatures(xhr.responseText);\n * vectorSource.addFeatures(features);\n * success(features);\n * } else {\n * onError();\n * }\n * }\n * xhr.send();\n * },\n * strategy: bbox,\n * });\n * ```\n * @property {boolean} [overlaps=true] This source may have overlapping geometries.\n * Setting this to `false` (e.g. for sources with polygons that represent administrative\n * boundaries or TopoJSON sources) allows the renderer to optimise fill and\n * stroke operations.\n * @property {LoadingStrategy} [strategy] The loading strategy to use.\n * By default an {@link module:ol/loadingstrategy.all}\n * strategy is used, a one-off strategy which loads all features at once.\n * @property {string|import(\"../featureloader.js\").FeatureUrlFunction} [url]\n * Setting this option instructs the source to load features using an XHR loader\n * (see {@link module:ol/featureloader.xhr}). Use a `string` and an\n * {@link module:ol/loadingstrategy.all} for a one-off download of all features from\n * the given URL. Use a {@link module:ol/featureloader~FeatureUrlFunction} to generate the url with\n * other loading strategies.\n * Requires `format` to be set as well.\n * When default XHR feature loader is provided, the features will\n * be transformed from the data projection to the view projection\n * during parsing. If your remote data source does not advertise its projection\n * properly, this transformation will be incorrect. For some formats, the\n * default projection (usually EPSG:4326) can be overridden by setting the\n * dataProjection constructor option on the format.\n * Note that if a source contains non-feature data, such as a GeoJSON geometry\n * or a KML NetworkLink, these will be ignored. Use a custom loader to load these.\n * @property {boolean} [useSpatialIndex=true]\n * By default, an RTree is used as spatial index. When features are removed and\n * added frequently, and the total number of features is low, setting this to\n * `false` may improve performance.\n *\n * Note that\n * {@link module:ol/source/Vector~VectorSource#getFeaturesInExtent},\n * {@link module:ol/source/Vector~VectorSource#getClosestFeatureToCoordinate} and\n * {@link module:ol/source/Vector~VectorSource#getExtent} cannot be used when `useSpatialIndex` is\n * set to `false`, and {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent} will loop\n * through all features.\n *\n * When set to `false`, the features will be maintained in an\n * {@link module:ol/Collection~Collection}, which can be retrieved through\n * {@link module:ol/source/Vector~VectorSource#getFeaturesCollection}.\n * @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the\n * -180\u00B0 and 180\u00B0 meridians to work properly, this should be set to `false`. The\n * resulting geometry coordinates will then exceed the world bounds.\n */\n\n/**\n * @classdesc\n * Provides a source of features for vector layers. Vector features provided\n * by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for\n * vector data that is optimized for rendering.\n *\n * @fires VectorSourceEvent\n * @api\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n */\nclass VectorSource extends Source {\n /**\n * @param {Options<FeatureType>} [options] Vector source options.\n */\n constructor(options) {\n options = options || {};\n\n super({\n attributions: options.attributions,\n interpolate: true,\n projection: undefined,\n state: 'ready',\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n });\n\n /***\n * @type {VectorSourceOnSignature<import(\"../events\").EventsKey, FeatureType>}\n */\n this.on;\n\n /***\n * @type {VectorSourceOnSignature<import(\"../events\").EventsKey, FeatureType>}\n */\n this.once;\n\n /***\n * @type {VectorSourceOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {import(\"../featureloader.js\").FeatureLoader<import(\"../Feature.js\").FeatureLike>}\n */\n this.loader_ = VOID;\n\n /**\n * @private\n * @type {import(\"../format/Feature.js\").default<FeatureType>|null}\n */\n this.format_ = options.format || null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overlaps_ = options.overlaps === undefined ? true : options.overlaps;\n\n /**\n * @private\n * @type {string|import(\"../featureloader.js\").FeatureUrlFunction|undefined}\n */\n this.url_ = options.url;\n\n if (options.loader !== undefined) {\n this.loader_ = options.loader;\n } else if (this.url_ !== undefined) {\n assert(this.format_, '`format` must be set when `url` is set');\n // create a XHR feature loader for \"url\" and \"format\"\n this.loader_ = xhr(this.url_, this.format_);\n }\n\n /**\n * @private\n * @type {LoadingStrategy}\n */\n this.strategy_ =\n options.strategy !== undefined ? options.strategy : allStrategy;\n\n const useSpatialIndex =\n options.useSpatialIndex !== undefined ? options.useSpatialIndex : true;\n\n /**\n * @private\n * @type {RBush<FeatureType>}\n */\n this.featuresRtree_ = useSpatialIndex ? new RBush() : null;\n\n /**\n * @private\n * @type {RBush<{extent: import(\"../extent.js\").Extent}>}\n */\n this.loadedExtentsRtree_ = new RBush();\n\n /**\n * @type {number}\n * @private\n */\n this.loadingExtentsCount_ = 0;\n\n /**\n * @private\n * @type {!Object<string, FeatureType>}\n */\n this.nullGeometryFeatures_ = {};\n\n /**\n * A lookup of features by id (the return from feature.getId()).\n * @private\n * @type {!Object<string, import('../Feature.js').FeatureLike|Array<import('../Feature.js').FeatureLike>>}\n */\n this.idIndex_ = {};\n\n /**\n * A lookup of features by uid (using getUid(feature)).\n * @private\n * @type {!Object<string, FeatureType>}\n */\n this.uidIndex_ = {};\n\n /**\n * @private\n * @type {Object<string, Array<import(\"../events.js\").EventsKey>>}\n */\n this.featureChangeKeys_ = {};\n\n /**\n * @private\n * @type {Collection<FeatureType>|null}\n */\n this.featuresCollection_ = null;\n\n /** @type {Collection<FeatureType>} */\n let collection;\n /** @type {Array<FeatureType>} */\n let features;\n if (Array.isArray(options.features)) {\n features = options.features;\n } else if (options.features) {\n collection = options.features;\n features = collection.getArray();\n }\n if (!useSpatialIndex && collection === undefined) {\n collection = new Collection(features);\n }\n if (features !== undefined) {\n this.addFeaturesInternal(features);\n }\n if (collection !== undefined) {\n this.bindFeaturesCollection_(collection);\n }\n }\n\n /**\n * Add a single feature to the source. If you want to add a batch of features\n * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()}\n * instead. A feature will not be added to the source if feature with\n * the same id is already there. The reason for this behavior is to avoid\n * feature duplication when using bbox or tile loading strategies.\n * Note: this also applies if a {@link module:ol/Collection~Collection} is used for features,\n * meaning that if a feature with a duplicate id is added in the collection, it will\n * be removed from it right away.\n * @param {FeatureType} feature Feature to add.\n * @api\n */\n addFeature(feature) {\n this.addFeatureInternal(feature);\n this.changed();\n }\n\n /**\n * Add a feature without firing a `change` event.\n * @param {FeatureType} feature Feature.\n * @protected\n */\n addFeatureInternal(feature) {\n const featureKey = getUid(feature);\n\n if (!this.addToIndex_(featureKey, feature)) {\n if (this.featuresCollection_) {\n this.featuresCollection_.remove(feature);\n }\n return;\n }\n\n this.setupChangeEvents_(featureKey, feature);\n\n const geometry = feature.getGeometry();\n if (geometry) {\n const extent = geometry.getExtent();\n if (this.featuresRtree_) {\n this.featuresRtree_.insert(extent, feature);\n }\n } else {\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.ADDFEATURE, feature),\n );\n }\n\n /**\n * @param {string} featureKey Unique identifier for the feature.\n * @param {FeatureType} feature The feature.\n * @private\n */\n setupChangeEvents_(featureKey, feature) {\n if (feature instanceof RenderFeature) {\n return;\n }\n this.featureChangeKeys_[featureKey] = [\n listen(feature, EventType.CHANGE, this.handleFeatureChange_, this),\n listen(\n feature,\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n this,\n ),\n ];\n }\n\n /**\n * @param {string} featureKey Unique identifier for the feature.\n * @param {FeatureType} feature The feature.\n * @return {boolean} The feature is \"valid\", in the sense that it is also a\n * candidate for insertion into the Rtree.\n * @private\n */\n addToIndex_(featureKey, feature) {\n let valid = true;\n if (feature.getId() !== undefined) {\n const id = String(feature.getId());\n if (!(id in this.idIndex_)) {\n this.idIndex_[id] = feature;\n } else if (feature instanceof RenderFeature) {\n const indexedFeature = this.idIndex_[id];\n if (!(indexedFeature instanceof RenderFeature)) {\n valid = false;\n } else if (!Array.isArray(indexedFeature)) {\n this.idIndex_[id] = [indexedFeature, feature];\n } else {\n indexedFeature.push(feature);\n }\n } else {\n valid = false;\n }\n }\n if (valid) {\n assert(\n !(featureKey in this.uidIndex_),\n 'The passed `feature` was already added to the source',\n );\n this.uidIndex_[featureKey] = feature;\n }\n return valid;\n }\n\n /**\n * Add a batch of features to the source.\n * @param {Array<FeatureType>} features Features to add.\n * @api\n */\n addFeatures(features) {\n this.addFeaturesInternal(features);\n this.changed();\n }\n\n /**\n * Add features without firing a `change` event.\n * @param {Array<FeatureType>} features Features.\n * @protected\n */\n addFeaturesInternal(features) {\n const extents = [];\n /** @type {Array<FeatureType>} */\n const newFeatures = [];\n /** @type {Array<FeatureType>} */\n const geometryFeatures = [];\n\n for (let i = 0, length = features.length; i < length; i++) {\n const feature = features[i];\n const featureKey = getUid(feature);\n if (this.addToIndex_(featureKey, feature)) {\n newFeatures.push(feature);\n }\n }\n\n for (let i = 0, length = newFeatures.length; i < length; i++) {\n const feature = newFeatures[i];\n const featureKey = getUid(feature);\n this.setupChangeEvents_(featureKey, feature);\n\n const geometry = feature.getGeometry();\n if (geometry) {\n const extent = geometry.getExtent();\n extents.push(extent);\n geometryFeatures.push(feature);\n } else {\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n }\n if (this.featuresRtree_) {\n this.featuresRtree_.load(extents, geometryFeatures);\n }\n\n if (this.hasListener(VectorEventType.ADDFEATURE)) {\n for (let i = 0, length = newFeatures.length; i < length; i++) {\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.ADDFEATURE, newFeatures[i]),\n );\n }\n }\n }\n\n /**\n * @param {!Collection<FeatureType>} collection Collection.\n * @private\n */\n bindFeaturesCollection_(collection) {\n let modifyingCollection = false;\n this.addEventListener(\n VectorEventType.ADDFEATURE,\n /**\n * @param {VectorSourceEvent<FeatureType>} evt The vector source event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n collection.push(evt.feature);\n modifyingCollection = false;\n }\n },\n );\n this.addEventListener(\n VectorEventType.REMOVEFEATURE,\n /**\n * @param {VectorSourceEvent<FeatureType>} evt The vector source event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n collection.remove(evt.feature);\n modifyingCollection = false;\n }\n },\n );\n collection.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<FeatureType>} evt The collection event\n */\n (evt) => {\n if (!modifyingCollection) {\n modifyingCollection = true;\n this.addFeature(evt.element);\n modifyingCollection = false;\n }\n },\n );\n collection.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<FeatureType>} evt The collection event\n */\n (evt) => {\n if (!modifyingCollection) {\n modifyingCollection = true;\n this.removeFeature(evt.element);\n modifyingCollection = false;\n }\n },\n );\n this.featuresCollection_ = collection;\n }\n\n /**\n * Remove all features from the source.\n * @param {boolean} [fast] Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#event:removefeature} events.\n * @api\n */\n clear(fast) {\n if (fast) {\n for (const featureId in this.featureChangeKeys_) {\n const keys = this.featureChangeKeys_[featureId];\n keys.forEach(unlistenByKey);\n }\n if (!this.featuresCollection_) {\n this.featureChangeKeys_ = {};\n this.idIndex_ = {};\n this.uidIndex_ = {};\n }\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.forEach((feature) => {\n this.removeFeatureInternal(feature);\n });\n for (const id in this.nullGeometryFeatures_) {\n this.removeFeatureInternal(this.nullGeometryFeatures_[id]);\n }\n }\n }\n if (this.featuresCollection_) {\n this.featuresCollection_.clear();\n }\n\n if (this.featuresRtree_) {\n this.featuresRtree_.clear();\n }\n this.nullGeometryFeatures_ = {};\n\n const clearEvent = new VectorSourceEvent(VectorEventType.CLEAR);\n this.dispatchEvent(clearEvent);\n this.changed();\n }\n\n /**\n * Iterate through all features on the source, calling the provided callback\n * with each one. If the callback returns any \"truthy\" value, iteration will\n * stop and the function will return the same value.\n * Note: this function only iterate through the feature that have a defined geometry.\n *\n * @param {function(FeatureType): T} callback Called with each feature\n * on the source. Return a truthy value to stop iteration.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeature(callback) {\n if (this.featuresRtree_) {\n return this.featuresRtree_.forEach(callback);\n }\n if (this.featuresCollection_) {\n this.featuresCollection_.forEach(callback);\n }\n }\n\n /**\n * Iterate through all features whose geometries contain the provided\n * coordinate, calling the callback with each feature. If the callback returns\n * a \"truthy\" value, iteration will stop and the function will return the same\n * value.\n *\n * For {@link module:ol/render/Feature~RenderFeature} features, the callback will be\n * called for all features.\n *\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {function(FeatureType): T} callback Called with each feature\n * whose goemetry contains the provided coordinate.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n */\n forEachFeatureAtCoordinateDirect(coordinate, callback) {\n const extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];\n return this.forEachFeatureInExtent(extent, function (feature) {\n const geometry = feature.getGeometry();\n if (\n geometry instanceof RenderFeature ||\n geometry.intersectsCoordinate(coordinate)\n ) {\n return callback(feature);\n }\n return undefined;\n });\n }\n\n /**\n * Iterate through all features whose bounding box intersects the provided\n * extent (note that the feature's geometry may not intersect the extent),\n * calling the callback with each feature. If the callback returns a \"truthy\"\n * value, iteration will stop and the function will return the same value.\n *\n * If you are interested in features whose geometry intersects an extent, call\n * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.\n *\n * When `useSpatialIndex` is set to false, this method will loop through all\n * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(FeatureType): T} callback Called with each feature\n * whose bounding box intersects the provided extent.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeatureInExtent(extent, callback) {\n if (this.featuresRtree_) {\n return this.featuresRtree_.forEachInExtent(extent, callback);\n }\n if (this.featuresCollection_) {\n this.featuresCollection_.forEach(callback);\n }\n }\n\n /**\n * Iterate through all features whose geometry intersects the provided extent,\n * calling the callback with each feature. If the callback returns a \"truthy\"\n * value, iteration will stop and the function will return the same value.\n *\n * If you only want to test for bounding box intersection, call the\n * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(FeatureType): T} callback Called with each feature\n * whose geometry intersects the provided extent.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeatureIntersectingExtent(extent, callback) {\n return this.forEachFeatureInExtent(\n extent,\n /**\n * @param {FeatureType} feature Feature.\n * @return {T|undefined} The return value from the last call to the callback.\n */\n function (feature) {\n const geometry = feature.getGeometry();\n if (\n geometry instanceof RenderFeature ||\n geometry.intersectsExtent(extent)\n ) {\n const result = callback(feature);\n if (result) {\n return result;\n }\n }\n },\n );\n }\n\n /**\n * Get the features collection associated with this source. Will be `null`\n * unless the source was configured with `useSpatialIndex` set to `false`, or\n * with a {@link module:ol/Collection~Collection} as `features`.\n * @return {Collection<FeatureType>|null} The collection of features.\n * @api\n */\n getFeaturesCollection() {\n return this.featuresCollection_;\n }\n\n /**\n * Get a snapshot of the features currently on the source in random order. The returned array\n * is a copy, the features are references to the features in the source.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeatures() {\n let features;\n if (this.featuresCollection_) {\n features = this.featuresCollection_.getArray().slice(0);\n } else if (this.featuresRtree_) {\n features = this.featuresRtree_.getAll();\n if (!isEmpty(this.nullGeometryFeatures_)) {\n extend(features, Object.values(this.nullGeometryFeatures_));\n }\n }\n return features;\n }\n\n /**\n * Get all features whose geometry intersects the provided coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeaturesAtCoordinate(coordinate) {\n /** @type {Array<FeatureType>} */\n const features = [];\n this.forEachFeatureAtCoordinateDirect(coordinate, function (feature) {\n features.push(feature);\n });\n return features;\n }\n\n /**\n * Get all features whose bounding box intersects the provided extent. Note that this returns an array of\n * all features intersecting the given extent in random order (so it may include\n * features whose geometries do not intersect the extent).\n *\n * When `useSpatialIndex` is set to false, this method will return all\n * features.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {import(\"../proj/Projection.js\").default} [projection] Include features\n * where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeaturesInExtent(extent, projection) {\n if (this.featuresRtree_) {\n const multiWorld = projection && projection.canWrapX() && this.getWrapX();\n\n if (!multiWorld) {\n return this.featuresRtree_.getInExtent(extent);\n }\n\n const extents = wrapAndSliceX(extent, projection);\n\n return [].concat(\n ...extents.map((anExtent) => this.featuresRtree_.getInExtent(anExtent)),\n );\n }\n if (this.featuresCollection_) {\n return this.featuresCollection_.getArray().slice(0);\n }\n return [];\n }\n\n /**\n * Get the closest feature to the provided coordinate.\n *\n * This method is not available when the source is configured with\n * `useSpatialIndex` set to `false` and the features in this source are of type\n * {@link module:ol/Feature~Feature}.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {function(FeatureType):boolean} [filter] Feature filter function.\n * The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}\n * and it should return a boolean value. By default, no filtering is made.\n * @return {FeatureType|null} Closest feature (or `null` if none found).\n * @api\n */\n getClosestFeatureToCoordinate(coordinate, filter) {\n // Find the closest feature using branch and bound. We start searching an\n // infinite extent, and find the distance from the first feature found. This\n // becomes the closest feature. We then compute a smaller extent which any\n // closer feature must intersect. We continue searching with this smaller\n // extent, trying to find a closer feature. Every time we find a closer\n // feature, we update the extent being searched so that any even closer\n // feature must intersect it. We continue until we run out of features.\n const x = coordinate[0];\n const y = coordinate[1];\n let closestFeature = null;\n const closestPoint = [NaN, NaN];\n let minSquaredDistance = Infinity;\n const extent = [-Infinity, -Infinity, Infinity, Infinity];\n filter = filter ? filter : TRUE;\n this.featuresRtree_.forEachInExtent(\n extent,\n /**\n * @param {FeatureType} feature Feature.\n */\n function (feature) {\n if (filter(feature)) {\n const geometry = feature.getGeometry();\n const previousMinSquaredDistance = minSquaredDistance;\n minSquaredDistance =\n geometry instanceof RenderFeature\n ? 0\n : geometry.closestPointXY(x, y, closestPoint, minSquaredDistance);\n if (minSquaredDistance < previousMinSquaredDistance) {\n closestFeature = feature;\n // This is sneaky. Reduce the extent that it is currently being\n // searched while the R-Tree traversal using this same extent object\n // is still in progress. This is safe because the new extent is\n // strictly contained by the old extent.\n const minDistance = Math.sqrt(minSquaredDistance);\n extent[0] = x - minDistance;\n extent[1] = y - minDistance;\n extent[2] = x + minDistance;\n extent[3] = y + minDistance;\n }\n }\n },\n );\n return closestFeature;\n }\n\n /**\n * Get the extent of the features currently in the source.\n *\n * This will return `null` when the source is configured with\n * `useSpatialIndex` set to `false`.\n * @param {import(\"../extent.js\").Extent} [extent] Destination extent. If provided, no new extent\n * will be created. Instead, that extent's coordinates will be overwritten.\n * @return {import(\"../extent.js\").Extent | null} Extent.\n * @api\n */\n getExtent(extent) {\n return this.featuresRtree_?.getExtent(extent) ?? null;\n }\n\n /**\n * Get a feature by its identifier (the value returned by feature.getId()). When `RenderFeature`s\n * are used, `getFeatureById()` can return an array of `RenderFeature`s. This allows for handling\n * of `GeometryCollection` geometries, where format readers create one `RenderFeature` per\n * `GeometryCollection` member.\n * Note that the index treats string and numeric identifiers as the same. So\n * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.\n *\n * @param {string|number} id Feature identifier.\n * @return {FeatureClassOrArrayOfRenderFeatures<FeatureType>|null} The feature (or `null` if not found).\n * @api\n */\n getFeatureById(id) {\n const feature = this.idIndex_[id.toString()];\n return feature !== undefined\n ? /** @type {FeatureClassOrArrayOfRenderFeatures<FeatureType>} */ (\n feature\n )\n : null;\n }\n\n /**\n * Get a feature by its internal unique identifier (using `getUid`).\n *\n * @param {string} uid Feature identifier.\n * @return {FeatureType|null} The feature (or `null` if not found).\n */\n getFeatureByUid(uid) {\n const feature = this.uidIndex_[uid];\n return feature !== undefined ? feature : null;\n }\n\n /**\n * Get the format associated with this source.\n *\n * @return {import(\"../format/Feature.js\").default<FeatureType>|null}} The feature format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * @return {boolean} The source can have overlapping geometries.\n */\n getOverlaps() {\n return this.overlaps_;\n }\n\n /**\n * Get the url associated with this source.\n *\n * @return {string|import(\"../featureloader.js\").FeatureUrlFunction|undefined} The url.\n * @api\n */\n getUrl() {\n return this.url_;\n }\n\n /**\n * @param {Event} event Event.\n * @private\n */\n handleFeatureChange_(event) {\n const feature = /** @type {FeatureType} */ (event.target);\n const featureKey = getUid(feature);\n const geometry = feature.getGeometry();\n if (!geometry) {\n if (!(featureKey in this.nullGeometryFeatures_)) {\n if (this.featuresRtree_) {\n this.featuresRtree_.remove(feature);\n }\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n } else {\n const extent = geometry.getExtent();\n if (featureKey in this.nullGeometryFeatures_) {\n delete this.nullGeometryFeatures_[featureKey];\n if (this.featuresRtree_) {\n this.featuresRtree_.insert(extent, feature);\n }\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.update(extent, feature);\n }\n }\n }\n const id = feature.getId();\n if (id !== undefined) {\n const sid = id.toString();\n if (this.idIndex_[sid] !== feature) {\n this.removeFromIdIndex_(feature);\n this.idIndex_[sid] = feature;\n }\n } else {\n this.removeFromIdIndex_(feature);\n this.uidIndex_[featureKey] = feature;\n }\n this.changed();\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.CHANGEFEATURE, feature),\n );\n }\n\n /**\n * Returns true if the feature is contained within the source.\n * @param {FeatureType} feature Feature.\n * @return {boolean} Has feature.\n * @api\n */\n hasFeature(feature) {\n const id = feature.getId();\n if (id !== undefined) {\n return id in this.idIndex_;\n }\n return getUid(feature) in this.uidIndex_;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n if (this.featuresRtree_) {\n return (\n this.featuresRtree_.isEmpty() && isEmpty(this.nullGeometryFeatures_)\n );\n }\n if (this.featuresCollection_) {\n return this.featuresCollection_.getLength() === 0;\n }\n return true;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n */\n loadFeatures(extent, resolution, projection) {\n const loadedExtentsRtree = this.loadedExtentsRtree_;\n const extentsToLoad = this.strategy_(extent, resolution, projection);\n for (let i = 0, ii = extentsToLoad.length; i < ii; ++i) {\n const extentToLoad = extentsToLoad[i];\n const alreadyLoaded = loadedExtentsRtree.forEachInExtent(\n extentToLoad,\n /**\n * @param {{extent: import(\"../extent.js\").Extent}} object Object.\n * @return {boolean} Contains.\n */\n function (object) {\n return containsExtent(object.extent, extentToLoad);\n },\n );\n if (!alreadyLoaded) {\n ++this.loadingExtentsCount_;\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.FEATURESLOADSTART),\n );\n this.loader_.call(\n this,\n extentToLoad,\n resolution,\n projection,\n /**\n * @param {Array<FeatureType>} features Loaded features\n */\n (features) => {\n --this.loadingExtentsCount_;\n this.dispatchEvent(\n new VectorSourceEvent(\n VectorEventType.FEATURESLOADEND,\n undefined,\n features,\n ),\n );\n },\n () => {\n --this.loadingExtentsCount_;\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.FEATURESLOADERROR),\n );\n },\n );\n loadedExtentsRtree.insert(extentToLoad, {extent: extentToLoad.slice()});\n }\n }\n this.loading =\n this.loader_.length < 4 ? false : this.loadingExtentsCount_ > 0;\n }\n\n /**\n * @override\n */\n refresh() {\n this.clear(true);\n this.loadedExtentsRtree_.clear();\n super.refresh();\n }\n\n /**\n * Remove an extent from the list of loaded extents.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n removeLoadedExtent(extent) {\n const loadedExtentsRtree = this.loadedExtentsRtree_;\n const obj = loadedExtentsRtree.forEachInExtent(extent, function (object) {\n if (equals(object.extent, extent)) {\n return object;\n }\n });\n if (obj) {\n loadedExtentsRtree.remove(obj);\n }\n }\n\n /**\n * Batch remove features from the source. If you want to remove all features\n * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method\n * instead.\n * @param {Array<FeatureType>} features Features to remove.\n * @api\n */\n removeFeatures(features) {\n let removed = false;\n for (let i = 0, ii = features.length; i < ii; ++i) {\n removed = this.removeFeatureInternal(features[i]) || removed;\n }\n if (removed) {\n this.changed();\n }\n }\n\n /**\n * Remove a single feature from the source. If you want to batch remove\n * features, use the {@link module:ol/source/Vector~VectorSource#removeFeatures #removeFeatures()} method\n * instead.\n * @param {FeatureType} feature Feature to remove.\n * @api\n */\n removeFeature(feature) {\n if (!feature) {\n return;\n }\n const removed = this.removeFeatureInternal(feature);\n if (removed) {\n this.changed();\n }\n }\n\n /**\n * Remove feature without firing a `change` event.\n * @param {FeatureType} feature Feature.\n * @return {boolean} True if the feature was removed, false if it was not found.\n * @protected\n */\n removeFeatureInternal(feature) {\n const featureKey = getUid(feature);\n if (!(featureKey in this.uidIndex_)) {\n return false;\n }\n\n if (featureKey in this.nullGeometryFeatures_) {\n delete this.nullGeometryFeatures_[featureKey];\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.remove(feature);\n }\n }\n\n const featureChangeKeys = this.featureChangeKeys_[featureKey];\n featureChangeKeys?.forEach(unlistenByKey);\n delete this.featureChangeKeys_[featureKey];\n\n const id = feature.getId();\n if (id !== undefined) {\n const idString = id.toString();\n const indexedFeature = this.idIndex_[idString];\n if (indexedFeature === feature) {\n delete this.idIndex_[idString];\n } else if (Array.isArray(indexedFeature)) {\n indexedFeature.splice(indexedFeature.indexOf(feature), 1);\n if (indexedFeature.length === 1) {\n this.idIndex_[idString] = indexedFeature[0];\n }\n }\n }\n delete this.uidIndex_[featureKey];\n if (this.hasListener(VectorEventType.REMOVEFEATURE)) {\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.REMOVEFEATURE, feature),\n );\n }\n return true;\n }\n\n /**\n * Remove a feature from the id index. Called internally when the feature id\n * may have changed.\n * @param {FeatureType} feature The feature.\n * @private\n */\n removeFromIdIndex_(feature) {\n for (const id in this.idIndex_) {\n if (this.idIndex_[id] === feature) {\n delete this.idIndex_[id];\n break;\n }\n }\n }\n\n /**\n * Set the new loader of the source. The next render cycle will use the\n * new loader.\n * @param {import(\"../featureloader.js\").FeatureLoader} loader The loader to set.\n * @api\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n\n /**\n * Points the source to a new url. The next render cycle will use the new url.\n * @param {string|import(\"../featureloader.js\").FeatureUrlFunction} url Url.\n * @api\n */\n setUrl(url) {\n assert(this.format_, '`format` must be set when `url` is set');\n this.url_ = url;\n this.setLoader(xhr(url, this.format_));\n }\n\n /**\n * @param {boolean} overlaps The source can have overlapping geometries.\n */\n setOverlaps(overlaps) {\n this.overlaps_ = overlaps;\n this.changed();\n }\n}\n\nexport default VectorSource;\n", "/**\n * Coordinate type when drawing lines.\n * @typedef {Array<import(\"../coordinate.js\").Coordinate>} LineCoordType\n */\n\nimport {distance} from '../coordinate.js';\nimport {\n GeometryCollection,\n LineString,\n MultiLineString,\n MultiPolygon,\n Polygon,\n} from '../geom.js';\nimport {clamp, squaredDistance, toFixed} from '../math.js';\n\n/**\n * @param {LineCoordType} coordinates The ring coordinates.\n * @param {number} index The index. May be wrapped.\n * @return {import(\"../coordinate.js\").Coordinate} The coordinate.\n */\nexport function getCoordinate(coordinates, index) {\n const count = coordinates.length;\n if (index < 0) {\n return coordinates[index + count];\n }\n if (index >= count) {\n return coordinates[index - count];\n }\n return coordinates[index];\n}\n\n/**\n * @param {LineCoordType} coordinates The coordinates.\n * @param {number} index The index. May be fractional and may wrap.\n * @return {import(\"../coordinate.js\").Coordinate} The interpolated coordinate.\n */\nexport function interpolateCoordinate(coordinates, index) {\n const count = coordinates.length;\n\n let startIndex = Math.floor(index);\n const along = index - startIndex;\n if (startIndex >= count) {\n startIndex -= count;\n } else if (startIndex < 0) {\n startIndex += count;\n }\n\n let endIndex = startIndex + 1;\n if (endIndex >= count) {\n endIndex -= count;\n }\n\n const start = coordinates[startIndex];\n const x0 = start[0];\n const y0 = start[1];\n const end = coordinates[endIndex];\n const dx = end[0] - x0;\n const dy = end[1] - y0;\n\n return [x0 + dx * along, y0 + dy * along];\n}\n\n/**\n * @typedef {Object} TraceTarget\n * @property {Array<import(\"../coordinate.js\").Coordinate>} coordinates Target coordinates.\n * @property {boolean} ring The target coordinates are a linear ring.\n * @property {number} startIndex The index of first traced coordinate. A fractional index represents an\n * edge intersection. Index values for rings will wrap (may be negative or larger than coordinates length).\n * @property {number} endIndex The index of last traced coordinate. Details from startIndex also apply here.\n */\n\n/**\n * @typedef {Object} TraceState\n * @property {boolean} active Tracing active.\n * @property {import(\"../coordinate.js\").Coordinate} [startCoord] The initially clicked coordinate.\n * @property {Array<TraceTarget>} [targets] Targets available for tracing.\n * @property {number} [targetIndex] The index of the currently traced target. A value of -1 indicates\n * that no trace target is active.\n */\n\n/**\n * @typedef {Object} TraceTargetUpdateInfo\n * @property {number} index The new target index.\n * @property {number} endIndex The new segment end index.\n * @property {number} closestTargetDistance The squared distance to the closest target.\n */\n\n/**\n * @type {TraceTargetUpdateInfo}\n */\nconst sharedUpdateInfo = {\n index: -1,\n endIndex: NaN,\n closestTargetDistance: Infinity,\n};\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The coordinate.\n * @param {TraceState} traceState The trace state.\n * @param {import(\"../Map.js\").default} map The map.\n * @param {number} snapTolerance The snap tolerance.\n * @return {TraceTargetUpdateInfo} Information about the new trace target. The returned\n * object is reused between calls and must not be modified by the caller.\n */\nexport function getTraceTargetUpdate(\n coordinate,\n traceState,\n map,\n snapTolerance,\n) {\n const x = coordinate[0];\n const y = coordinate[1];\n\n let closestTargetDistance = Infinity;\n\n let newTargetIndex = -1;\n let newEndIndex = NaN;\n\n for (\n let targetIndex = 0;\n targetIndex < traceState.targets.length;\n ++targetIndex\n ) {\n const target = traceState.targets[targetIndex];\n const coordinates = target.coordinates;\n\n let minSegmentDistance = Infinity;\n let endIndex;\n for (\n let coordinateIndex = 0;\n coordinateIndex < coordinates.length - 1;\n ++coordinateIndex\n ) {\n const start = coordinates[coordinateIndex];\n const end = coordinates[coordinateIndex + 1];\n const rel = getPointSegmentRelationship(x, y, start, end);\n if (rel.squaredDistance < minSegmentDistance) {\n minSegmentDistance = rel.squaredDistance;\n endIndex = coordinateIndex + rel.along;\n }\n }\n\n if (minSegmentDistance < closestTargetDistance) {\n closestTargetDistance = minSegmentDistance;\n if (target.ring && traceState.targetIndex === targetIndex) {\n // same target, maintain the same trace direction\n if (target.endIndex > target.startIndex) {\n // forward trace\n if (endIndex < target.startIndex) {\n endIndex += coordinates.length;\n }\n } else if (target.endIndex < target.startIndex) {\n // reverse trace\n if (endIndex > target.startIndex) {\n endIndex -= coordinates.length;\n }\n }\n }\n newEndIndex = endIndex;\n newTargetIndex = targetIndex;\n }\n }\n\n const newTarget = traceState.targets[newTargetIndex];\n let considerBothDirections = newTarget.ring;\n if (traceState.targetIndex === newTargetIndex && considerBothDirections) {\n // only consider switching trace direction if close to the start\n const newCoordinate = interpolateCoordinate(\n newTarget.coordinates,\n newEndIndex,\n );\n const pixel = map.getPixelFromCoordinate(newCoordinate);\n const startPx = map.getPixelFromCoordinate(traceState.startCoord);\n if (distance(pixel, startPx) > snapTolerance) {\n considerBothDirections = false;\n }\n }\n\n if (considerBothDirections) {\n const coordinates = newTarget.coordinates;\n const count = coordinates.length;\n const startIndex = newTarget.startIndex;\n const endIndex = newEndIndex;\n if (startIndex < endIndex) {\n const forwardDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex,\n );\n const reverseDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex - count,\n );\n if (reverseDistance < forwardDistance) {\n newEndIndex -= count;\n }\n } else {\n const reverseDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex,\n );\n const forwardDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex + count,\n );\n if (forwardDistance < reverseDistance) {\n newEndIndex += count;\n }\n }\n }\n\n sharedUpdateInfo.index = newTargetIndex;\n sharedUpdateInfo.endIndex = newEndIndex;\n sharedUpdateInfo.closestTargetDistance = closestTargetDistance;\n return sharedUpdateInfo;\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The coordinate.\n * @param {Array<import(\"../Feature.js\").default>} features The candidate features.\n * @return {Array<TraceTarget>} The trace targets.\n */\nexport function getTraceTargets(coordinate, features) {\n /**\n * @type {Array<TraceTarget>}\n */\n const targets = [];\n\n for (let i = 0; i < features.length; ++i) {\n const feature = features[i];\n const geometry = feature.getGeometry();\n appendGeometryTraceTargets(coordinate, geometry, targets);\n }\n\n return targets;\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The coordinate.\n * @param {import(\"../geom/Geometry.js\").default} geometry The candidate geometry.\n * @param {Array<TraceTarget>} targets The trace targets.\n */\nfunction appendGeometryTraceTargets(coordinate, geometry, targets) {\n if (geometry instanceof LineString) {\n appendTraceTarget(coordinate, geometry.getCoordinates(), false, targets);\n return;\n }\n if (geometry instanceof MultiLineString) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n appendTraceTarget(coordinate, coordinates[i], false, targets);\n }\n return;\n }\n if (geometry instanceof Polygon) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n appendTraceTarget(coordinate, coordinates[i], true, targets);\n }\n return;\n }\n if (geometry instanceof MultiPolygon) {\n const polys = geometry.getCoordinates();\n for (let i = 0, ii = polys.length; i < ii; ++i) {\n const coordinates = polys[i];\n for (let j = 0, jj = coordinates.length; j < jj; ++j) {\n appendTraceTarget(coordinate, coordinates[j], true, targets);\n }\n }\n return;\n }\n if (geometry instanceof GeometryCollection) {\n const geometries = geometry.getGeometries();\n for (let i = 0; i < geometries.length; ++i) {\n appendGeometryTraceTargets(coordinate, geometries[i], targets);\n }\n return;\n }\n // other types cannot be traced\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The clicked coordinate.\n * @param {Array<import(\"../coordinate.js\").Coordinate>} coordinates The geometry component coordinates.\n * @param {boolean} ring The coordinates represent a linear ring.\n * @param {Array<TraceTarget>} targets The trace targets.\n */\nfunction appendTraceTarget(coordinate, coordinates, ring, targets) {\n const x = coordinate[0];\n const y = coordinate[1];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const start = coordinates[i];\n const end = coordinates[i + 1];\n const rel = getPointSegmentRelationship(x, y, start, end);\n if (rel.squaredDistance === 0) {\n const index = i + rel.along;\n targets.push({\n coordinates: coordinates,\n ring: ring,\n startIndex: index,\n endIndex: index,\n });\n return;\n }\n }\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} a One coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} b Another coordinate.\n * @return {number} The squared distance between the two coordinates.\n */\nfunction getSquaredDistance(a, b) {\n return squaredDistance(a[0], a[1], b[0], b[1]);\n}\n\n/**\n * Get the cumulative squared distance along a ring path. The end index index may be \"wrapped\" and it may\n * be less than the start index to indicate the direction of travel. The start and end index may have\n * a fractional part to indicate a point between two coordinates.\n * @param {LineCoordType} coordinates Ring coordinates.\n * @param {number} startIndex The start index.\n * @param {number} endIndex The end index.\n * @return {number} The cumulative squared distance along the ring path.\n */\nfunction getCumulativeSquaredDistance(coordinates, startIndex, endIndex) {\n let lowIndex, highIndex;\n if (startIndex < endIndex) {\n lowIndex = startIndex;\n highIndex = endIndex;\n } else {\n lowIndex = endIndex;\n highIndex = startIndex;\n }\n const lowWholeIndex = Math.ceil(lowIndex);\n const highWholeIndex = Math.floor(highIndex);\n\n if (lowWholeIndex > highWholeIndex) {\n // both start and end are on the same segment\n const start = interpolateCoordinate(coordinates, lowIndex);\n const end = interpolateCoordinate(coordinates, highIndex);\n return getSquaredDistance(start, end);\n }\n\n let sd = 0;\n\n if (lowIndex < lowWholeIndex) {\n const start = interpolateCoordinate(coordinates, lowIndex);\n const end = getCoordinate(coordinates, lowWholeIndex);\n sd += getSquaredDistance(start, end);\n }\n\n if (highWholeIndex < highIndex) {\n const start = getCoordinate(coordinates, highWholeIndex);\n const end = interpolateCoordinate(coordinates, highIndex);\n sd += getSquaredDistance(start, end);\n }\n\n for (let i = lowWholeIndex; i < highWholeIndex - 1; ++i) {\n const start = getCoordinate(coordinates, i);\n const end = getCoordinate(coordinates, i + 1);\n sd += getSquaredDistance(start, end);\n }\n\n return sd;\n}\n\n/**\n * @typedef {Object} PointSegmentRelationship\n * @property {number} along The closest point expressed as a fraction along the segment length.\n * @property {number} squaredDistance The squared distance of the point to the segment.\n */\n\n/**\n * @type {PointSegmentRelationship}\n */\nconst sharedRel = {along: 0, squaredDistance: 0};\n\n/**\n * @param {number} x The point x.\n * @param {number} y The point y.\n * @param {import(\"../coordinate.js\").Coordinate} start The segment start.\n * @param {import(\"../coordinate.js\").Coordinate} end The segment end.\n * @return {PointSegmentRelationship} The point segment relationship. The returned object is\n * shared between calls and must not be modified by the caller.\n */\nexport function getPointSegmentRelationship(x, y, start, end) {\n const x1 = start[0];\n const y1 = start[1];\n const x2 = end[0];\n const y2 = end[1];\n const dx = x2 - x1;\n const dy = y2 - y1;\n let along = 0;\n let px = x1;\n let py = y1;\n if (dx !== 0 || dy !== 0) {\n along = clamp(((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy), 0, 1);\n px += dx * along;\n py += dy * along;\n }\n\n sharedRel.along = along;\n sharedRel.squaredDistance = toFixed(squaredDistance(x, y, px, py), 10);\n return sharedRel;\n}\n", "/**\n * @module ol/interaction/Draw\n */\nimport Feature from '../Feature.js';\nimport MapBrowserEvent from '../MapBrowserEvent.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {\n distance,\n squaredDistance as squaredCoordinateDistance,\n} from '../coordinate.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {\n always,\n never,\n noModifierKeys,\n shiftKeyOnly,\n} from '../events/condition.js';\nimport {\n boundingExtent,\n getBottomLeft,\n getBottomRight,\n getTopLeft,\n getTopRight,\n} from '../extent.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport Circle from '../geom/Circle.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon, {fromCircle, makeRegular} from '../geom/Polygon.js';\nimport {getStrideForLayout} from '../geom/SimpleGeometry.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {fromUserCoordinate, getUserProjection} from '../proj.js';\nimport VectorSource from '../source/Vector.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport PointerInteraction from './Pointer.js';\nimport InteractionProperty from './Property.js';\nimport {\n getCoordinate,\n getTraceTargetUpdate,\n getTraceTargets,\n interpolateCoordinate,\n} from './tracing.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../geom/Geometry.js\").Type} type Geometry type of\n * the geometries being drawn with this instance.\n * @property {number} [clickTolerance=6] The maximum distance in pixels between\n * \"down\" and \"up\" for a \"up\" event to be considered a \"click\" event and\n * actually add a point/vertex to the geometry being drawn. The default of `6`\n * was chosen for the draw interaction to behave correctly on mouse as well as\n * on touch devices.\n * @property {import(\"../Collection.js\").default<Feature>} [features]\n * Destination collection for the drawn features.\n * @property {VectorSource} [source] Destination source for\n * the drawn features.\n * @property {number} [dragVertexDelay=500] Delay in milliseconds after pointerdown\n * before the current vertex can be dragged to its exact position.\n * @property {number} [snapTolerance=12] Pixel distance for snapping to the\n * drawing finish. Must be greater than `0`.\n * @property {boolean} [stopClick=false] Stop click, singleclick, and\n * doubleclick events from firing during drawing.\n * @property {number} [maxPoints] The number of points that can be drawn before\n * a polygon ring or line string is finished. By default there is no\n * restriction.\n * @property {number} [minPoints] The number of points that must be drawn\n * before a polygon ring or line string can be finished. Default is `3` for\n * polygon rings and `2` for line strings.\n * @property {import(\"../events/condition.js\").Condition} [finishCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether the drawing can be finished. Not used when drawing\n * POINT or MULTI_POINT geometries.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike} [style]\n * Style for sketch features. The draw interaction can have up to three sketch features, depending on the mode.\n * It will always contain a feature with a `Point` geometry that corresponds to the current cursor position.\n * If the mode is `LineString` or `Polygon`, and there is at least one drawn point, it will also contain a feature with\n * a `LineString` geometry that corresponds to the line between the already drawn points and the current cursor position.\n * If the mode is `Polygon`, and there is at least one drawn point, it will also contain a feature with a `Polygon`\n * geometry that corresponds to the polygon between the already drawn points and the current cursor position\n * (note that this polygon has only two points if only one point is drawn).\n * If the mode is `Circle`, and there is one point drawn, it will also contain a feature with a `Circle` geometry whose\n * center is the drawn point and the radius is determined by the distance between the drawn point and the cursor.\n * @property {GeometryFunction} [geometryFunction]\n * Function that is called when a geometry's coordinates are updated.\n * @property {string} [geometryName] Geometry name to use for features created\n * by the draw interaction.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * By default {@link module:ol/events/condition.noModifierKeys}, i.e. a click,\n * adds a vertex or deactivates freehand drawing.\n * @property {boolean} [freehand=false] Operate in freehand mode for lines,\n * polygons, and circles. This makes the interaction always operate in freehand\n * mode and takes precedence over any `freehandCondition` option.\n * @property {import(\"../events/condition.js\").Condition} [freehandCondition]\n * Condition that activates freehand drawing for lines and polygons. This\n * function takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and\n * returns a boolean to indicate whether that event should be handled. The\n * default is {@link module:ol/events/condition.shiftKeyOnly}, meaning that the\n * Shift key activates freehand drawing.\n * @property {boolean|import(\"../events/condition.js\").Condition} [trace=false] Trace a portion of another geometry.\n * Ignored when in freehand mode.\n * @property {VectorSource} [traceSource] Source for features to trace. If tracing is active and a `traceSource` is\n * not provided, the interaction's `source` will be used. Tracing requires that the interaction is configured with\n * either a `traceSource` or a `source`.\n * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch\n * overlay.\n * @property {import(\"../geom/Geometry.js\").GeometryLayout} [geometryLayout='XY'] Layout of the\n * feature geometries created by the draw interaction.\n */\n\n/**\n * Coordinate type when drawing points.\n * @typedef {import(\"../coordinate.js\").Coordinate} PointCoordType\n */\n\n/**\n * @typedef {import('./tracing.js').LineCoordType} LineCoordType\n */\n\n/**\n * Coordinate type when drawing polygons.\n * @typedef {Array<Array<import(\"../coordinate.js\").Coordinate>>} PolyCoordType\n */\n\n/**\n * Types used for drawing coordinates.\n * @typedef {PointCoordType|LineCoordType|PolyCoordType} SketchCoordType\n */\n\n/** @typedef {import('./tracing.js').TraceState} TraceState */\n\n/** @typedef {import('./tracing.js').TraceTarget} TraceTarget */\n\n/**\n * Function that takes an array of coordinates and an optional existing geometry\n * and a projection as arguments, and returns a geometry. The optional existing\n * geometry is the geometry that is returned when the function is called without\n * a second argument.\n * @typedef {function(!SketchCoordType, import(\"../geom/SimpleGeometry.js\").default,\n * import(\"../proj/Projection.js\").default):\n * import(\"../geom/SimpleGeometry.js\").default} GeometryFunction\n */\n\n/**\n * @typedef {'Point' | 'LineString' | 'Polygon' | 'Circle'} Mode\n * Draw mode. This collapses multi-part geometry types with their single-part\n * cousins.\n */\n\n/**\n * @enum {string}\n */\nconst DrawEventType = {\n /**\n * Triggered upon feature draw start\n * @event DrawEvent#drawstart\n * @api\n */\n DRAWSTART: 'drawstart',\n /**\n * Triggered upon feature draw end\n * @event DrawEvent#drawend\n * @api\n */\n DRAWEND: 'drawend',\n /**\n * Triggered upon feature draw abortion\n * @event DrawEvent#drawabort\n * @api\n */\n DRAWABORT: 'drawabort',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Draw~Draw} instances are\n * instances of this type.\n */\nexport class DrawEvent extends Event {\n /**\n * @param {DrawEventType} type Type.\n * @param {Feature} feature The feature drawn.\n */\n constructor(type, feature) {\n super(type);\n\n /**\n * The feature being drawn.\n * @type {Feature}\n * @api\n */\n this.feature = feature;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'drawabort'|'drawend'|'drawstart', Return>} DrawOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for drawing feature geometries.\n *\n * @fires DrawEvent\n * @api\n */\nclass Draw extends PointerInteraction {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /***\n * @type {DrawOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {DrawOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {DrawOnSignature<void>}\n */\n this.un;\n\n /**\n * @type {Options}\n * @private\n */\n this.options_ = options;\n\n /**\n * @type {boolean}\n * @private\n */\n this.shouldHandle_ = false;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.downPx_ = null;\n\n /**\n * @type {ReturnType<typeof setTimeout>}\n * @private\n */\n this.downTimeout_;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.lastDragTime_;\n\n /**\n * Pointer type of the last pointermove event\n * @type {string}\n * @private\n */\n this.pointerType_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.freehand_ = false;\n\n /**\n * Target source for drawn features.\n * @type {VectorSource|null}\n * @private\n */\n this.source_ = options.source ? options.source : null;\n\n /**\n * Target collection for drawn features.\n * @type {import(\"../Collection.js\").default<Feature>|null}\n * @private\n */\n this.features_ = options.features ? options.features : null;\n\n /**\n * Pixel distance for snapping.\n * @type {number}\n * @private\n */\n this.snapTolerance_ = options.snapTolerance ? options.snapTolerance : 12;\n\n /**\n * Geometry type.\n * @type {import(\"../geom/Geometry.js\").Type}\n * @private\n */\n this.type_ = /** @type {import(\"../geom/Geometry.js\").Type} */ (\n options.type\n );\n\n /**\n * Drawing mode (derived from geometry type.\n * @type {Mode}\n * @private\n */\n this.mode_ = getMode(this.type_);\n\n /**\n * Stop click, singleclick, and doubleclick events from firing during drawing.\n * Default is `false`.\n * @type {boolean}\n * @private\n */\n this.stopClick_ = !!options.stopClick;\n\n /**\n * Ignore the next up event. This is set to `true` when a drag event is encountered,\n * e.g. when the user pans the map while drawing. In this case, we do not want to bail\n * out of tracing.\n * @type {boolean}\n * @private\n */\n this.ignoreNextUpEvent_ = false;\n\n /**\n * The number of points that must be drawn before a polygon ring or line\n * string can be finished. The default is 3 for polygon rings and 2 for\n * line strings.\n * @type {number}\n * @private\n */\n this.minPoints_ = options.minPoints\n ? options.minPoints\n : this.mode_ === 'Polygon'\n ? 3\n : 2;\n\n /**\n * The number of points that can be drawn before a polygon ring or line string\n * is finished. The default is no restriction.\n * @type {number}\n * @private\n */\n this.maxPoints_ =\n this.mode_ === 'Circle'\n ? 2\n : options.maxPoints\n ? options.maxPoints\n : Infinity;\n\n /**\n * A function to decide if a potential finish coordinate is permissible\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.finishCondition_ = options.finishCondition\n ? options.finishCondition\n : TRUE;\n\n /**\n * @private\n * @type {import(\"../geom/Geometry.js\").GeometryLayout}\n */\n this.geometryLayout_ = options.geometryLayout\n ? options.geometryLayout\n : 'XY';\n\n let geometryFunction = options.geometryFunction;\n if (!geometryFunction) {\n const mode = this.mode_;\n if (mode === 'Circle') {\n /**\n * @param {!LineCoordType} coordinates The coordinates.\n * @param {import(\"../geom/SimpleGeometry.js\").default|undefined} geometry Optional geometry.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../geom/SimpleGeometry.js\").default} A geometry.\n */\n geometryFunction = (coordinates, geometry, projection) => {\n const circle = geometry\n ? /** @type {Circle} */ (geometry)\n : new Circle([NaN, NaN]);\n const center = fromUserCoordinate(coordinates[0], projection);\n const squaredLength = squaredCoordinateDistance(\n center,\n fromUserCoordinate(coordinates[coordinates.length - 1], projection),\n );\n circle.setCenterAndRadius(\n center,\n Math.sqrt(squaredLength),\n this.geometryLayout_,\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n circle.transform(projection, userProjection);\n }\n return circle;\n };\n } else {\n let Constructor;\n if (mode === 'Point') {\n Constructor = Point;\n } else if (mode === 'LineString') {\n Constructor = LineString;\n } else if (mode === 'Polygon') {\n Constructor = Polygon;\n }\n /**\n * @param {!LineCoordType} coordinates The coordinates.\n * @param {import(\"../geom/SimpleGeometry.js\").default|undefined} geometry Optional geometry.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../geom/SimpleGeometry.js\").default} A geometry.\n */\n geometryFunction = (coordinates, geometry, projection) => {\n if (geometry) {\n if (mode === 'Polygon') {\n if (coordinates[0].length) {\n // Add a closing coordinate to match the first\n geometry.setCoordinates(\n [coordinates[0].concat([coordinates[0][0]])],\n this.geometryLayout_,\n );\n } else {\n geometry.setCoordinates([], this.geometryLayout_);\n }\n } else {\n geometry.setCoordinates(coordinates, this.geometryLayout_);\n }\n } else {\n geometry = new Constructor(coordinates, this.geometryLayout_);\n }\n return geometry;\n };\n }\n }\n\n /**\n * @type {GeometryFunction}\n * @private\n */\n this.geometryFunction_ = geometryFunction;\n\n /**\n * @type {number}\n * @private\n */\n this.dragVertexDelay_ =\n options.dragVertexDelay !== undefined ? options.dragVertexDelay : 500;\n\n /**\n * Finish coordinate for the feature (first point for polygons, last point for\n * linestrings).\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.finishCoordinate_ = null;\n\n /**\n * Sketch feature.\n * @type {Feature<import('../geom/SimpleGeometry.js').default>}\n * @private\n */\n this.sketchFeature_ = null;\n\n /**\n * Sketch point.\n * @type {Feature<Point>}\n * @private\n */\n this.sketchPoint_ = null;\n\n /**\n * Sketch coordinates. Used when drawing a line or polygon.\n * @type {SketchCoordType}\n * @private\n */\n this.sketchCoords_ = null;\n\n /**\n * Sketch line. Used when drawing polygon.\n * @type {Feature<LineString>}\n * @private\n */\n this.sketchLine_ = null;\n\n /**\n * Sketch line coordinates. Used when drawing a polygon or circle.\n * @type {LineCoordType}\n * @private\n */\n this.sketchLineCoords_ = null;\n\n /**\n * Squared tolerance for handling up events. If the squared distance\n * between a down and up event is greater than this tolerance, up events\n * will not be handled.\n * @type {number}\n * @private\n */\n this.squaredClickTolerance_ = options.clickTolerance\n ? options.clickTolerance * options.clickTolerance\n : 36;\n\n /**\n * Draw overlay where our sketch features are drawn.\n * @type {VectorLayer}\n * @private\n */\n this.overlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: options.wrapX ? options.wrapX : false,\n }),\n style: options.style ? options.style : getDefaultStyleFunction(),\n updateWhileInteracting: true,\n });\n\n /**\n * Name of the geometry attribute for newly created features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : noModifierKeys;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.freehandCondition_;\n if (options.freehand) {\n this.freehandCondition_ = always;\n } else {\n this.freehandCondition_ = options.freehandCondition\n ? options.freehandCondition\n : shiftKeyOnly;\n }\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.traceCondition_;\n this.setTrace(options.trace || false);\n\n /**\n * @type {TraceState}\n * @private\n */\n this.traceState_ = {active: false};\n\n /**\n * @type {VectorSource|null}\n * @private\n */\n this.traceSource_ = options.traceSource || options.source || null;\n\n this.addChangeListener(InteractionProperty.ACTIVE, this.updateState_);\n }\n\n /**\n * Toggle tracing mode or set a tracing condition.\n *\n * @param {boolean|import(\"../events/condition.js\").Condition} trace A boolean to toggle tracing mode or an event\n * condition that will be checked when a feature is clicked to determine if tracing should be active.\n */\n setTrace(trace) {\n let condition;\n if (!trace) {\n condition = never;\n } else if (trace === true) {\n condition = always;\n } else {\n condition = trace;\n }\n this.traceCondition_ = condition;\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n super.setMap(map);\n this.updateState_();\n }\n\n /**\n * Set whether the drawing is done in freehand mode.\n *\n * @param {boolean} freehand Freehand drawing.\n * @api\n */\n setFreehand(freehand) {\n this.freehand_ = freehand;\n if (this.freehand_) {\n this.freehandCondition_ = always;\n } else {\n this.freehandCondition_ =\n this.options_ && this.options_.freehandCondition\n ? this.options_.freehandCondition\n : shiftKeyOnly;\n }\n }\n\n /**\n * Get the overlay layer that this interaction renders sketch features to.\n * @return {VectorLayer} Overlay layer.\n * @api\n */\n getOverlay() {\n return this.overlay_;\n }\n\n /**\n * Get if this interaction is in freehand mode.\n * @return {boolean} Freehand drawing.\n * @api\n */\n getFreehand() {\n return this.freehand_;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may actually draw or finish the drawing.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(event) {\n if (event.originalEvent.type === EventType.CONTEXTMENU) {\n // Avoid context menu for long taps when drawing on mobile\n event.originalEvent.preventDefault();\n }\n this.freehand_ = this.mode_ !== 'Point' && this.freehandCondition_(event);\n let move = event.type === MapBrowserEventType.POINTERMOVE;\n let pass = true;\n if (\n !this.freehand_ &&\n this.lastDragTime_ &&\n event.type === MapBrowserEventType.POINTERDRAG\n ) {\n const now = Date.now();\n if (now - this.lastDragTime_ >= this.dragVertexDelay_) {\n this.downPx_ = event.pixel;\n this.shouldHandle_ = !this.freehand_;\n move = true;\n } else {\n this.lastDragTime_ = undefined;\n }\n if (this.shouldHandle_ && this.downTimeout_ !== undefined) {\n clearTimeout(this.downTimeout_);\n this.downTimeout_ = undefined;\n }\n }\n if (\n this.freehand_ &&\n event.type === MapBrowserEventType.POINTERDRAG &&\n this.sketchFeature_ !== null\n ) {\n this.addToDrawing_(event.coordinate);\n pass = false;\n } else if (\n this.freehand_ &&\n event.type === MapBrowserEventType.POINTERDOWN\n ) {\n pass = false;\n } else if (move && this.getPointerCount() < 2) {\n pass = event.type === MapBrowserEventType.POINTERMOVE;\n if (pass && this.freehand_) {\n this.handlePointerMove_(event);\n if (this.shouldHandle_) {\n // Avoid page scrolling when freehand drawing on mobile\n event.originalEvent.preventDefault();\n }\n } else if (\n event.originalEvent.pointerType === 'mouse' ||\n (event.type === MapBrowserEventType.POINTERDRAG &&\n this.downTimeout_ === undefined)\n ) {\n this.handlePointerMove_(event);\n }\n } else if (event.type === MapBrowserEventType.DBLCLICK) {\n pass = false;\n }\n\n return super.handleEvent(event) && pass;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(event) {\n this.shouldHandle_ = !this.freehand_;\n\n if (this.freehand_) {\n this.downPx_ = event.pixel;\n if (!this.finishCoordinate_) {\n this.startDrawing_(event.coordinate);\n }\n return true;\n }\n\n if (!this.condition_(event)) {\n this.lastDragTime_ = undefined;\n return false;\n }\n\n this.lastDragTime_ = Date.now();\n this.downTimeout_ = setTimeout(() => {\n this.handlePointerMove_(\n new MapBrowserEvent(\n MapBrowserEventType.POINTERMOVE,\n event.map,\n event.originalEvent,\n false,\n event.frameState,\n ),\n );\n }, this.dragVertexDelay_);\n this.downPx_ = event.pixel;\n return true;\n }\n\n /**\n * @private\n */\n deactivateTrace_() {\n this.traceState_ = {active: false};\n }\n\n /**\n * Activate or deactivate trace state based on a browser event.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n toggleTraceState_(event) {\n if (!this.traceSource_ || !this.traceCondition_(event)) {\n return;\n }\n\n if (this.traceState_.active) {\n this.deactivateTrace_();\n return;\n }\n\n const map = this.getMap();\n const lowerLeft = map.getCoordinateFromPixel([\n event.pixel[0] - this.snapTolerance_,\n event.pixel[1] + this.snapTolerance_,\n ]);\n const upperRight = map.getCoordinateFromPixel([\n event.pixel[0] + this.snapTolerance_,\n event.pixel[1] - this.snapTolerance_,\n ]);\n const extent = boundingExtent([lowerLeft, upperRight]);\n const features = this.traceSource_.getFeaturesInExtent(extent);\n if (features.length === 0) {\n return;\n }\n\n const targets = getTraceTargets(event.coordinate, features);\n if (targets.length) {\n this.traceState_ = {\n active: true,\n startCoord: event.coordinate.slice(),\n targets: targets,\n targetIndex: -1,\n };\n }\n }\n\n /**\n * @param {TraceTarget} target The trace target.\n * @param {number} endIndex The new end index of the trace.\n * @private\n */\n addOrRemoveTracedCoordinates_(target, endIndex) {\n // three cases to handle:\n // 1. traced in the same direction and points need adding\n // 2. traced in the same direction and points need removing\n // 3. traced in a new direction\n const previouslyForward = target.startIndex <= target.endIndex;\n const currentlyForward = target.startIndex <= endIndex;\n if (previouslyForward === currentlyForward) {\n // same direction\n if (\n (previouslyForward && endIndex > target.endIndex) ||\n (!previouslyForward && endIndex < target.endIndex)\n ) {\n // case 1 - add new points\n this.addTracedCoordinates_(target, target.endIndex, endIndex);\n } else if (\n (previouslyForward && endIndex < target.endIndex) ||\n (!previouslyForward && endIndex > target.endIndex)\n ) {\n // case 2 - remove old points\n this.removeTracedCoordinates_(endIndex, target.endIndex);\n }\n } else {\n // case 3 - remove old points, add new points\n this.removeTracedCoordinates_(target.startIndex, target.endIndex);\n this.addTracedCoordinates_(target, target.startIndex, endIndex);\n }\n }\n\n /**\n * @param {number} fromIndex The start index.\n * @param {number} toIndex The end index.\n * @private\n */\n removeTracedCoordinates_(fromIndex, toIndex) {\n if (fromIndex === toIndex) {\n return;\n }\n\n let remove = 0;\n if (fromIndex < toIndex) {\n const start = Math.ceil(fromIndex);\n let end = Math.floor(toIndex);\n if (end === toIndex) {\n end -= 1;\n }\n remove = end - start + 1;\n } else {\n const start = Math.floor(fromIndex);\n let end = Math.ceil(toIndex);\n if (end === toIndex) {\n end += 1;\n }\n remove = start - end + 1;\n }\n\n if (remove > 0) {\n this.removeLastPoints_(remove);\n }\n }\n\n /**\n * @param {TraceTarget} target The trace target.\n * @param {number} fromIndex The start index.\n * @param {number} toIndex The end index.\n * @private\n */\n addTracedCoordinates_(target, fromIndex, toIndex) {\n if (fromIndex === toIndex) {\n return;\n }\n\n const coordinates = [];\n if (fromIndex < toIndex) {\n // forward trace\n const start = Math.ceil(fromIndex);\n let end = Math.floor(toIndex);\n if (end === toIndex) {\n // if end is snapped to a vertex, it will be added later\n end -= 1;\n }\n for (let i = start; i <= end; ++i) {\n coordinates.push(getCoordinate(target.coordinates, i));\n }\n } else {\n // reverse trace\n const start = Math.floor(fromIndex);\n let end = Math.ceil(toIndex);\n if (end === toIndex) {\n end += 1;\n }\n for (let i = start; i >= end; --i) {\n coordinates.push(getCoordinate(target.coordinates, i));\n }\n }\n if (coordinates.length) {\n this.appendCoordinates(coordinates);\n }\n }\n\n /**\n * Update the trace.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n updateTrace_(event) {\n const traceState = this.traceState_;\n if (!traceState.active) {\n return;\n }\n\n if (traceState.targetIndex === -1) {\n // check if we are ready to pick a target\n const startPx = event.map.getPixelFromCoordinate(traceState.startCoord);\n if (distance(startPx, event.pixel) < this.snapTolerance_) {\n return;\n }\n }\n\n const updatedTraceTarget = getTraceTargetUpdate(\n event.coordinate,\n traceState,\n this.getMap(),\n this.snapTolerance_,\n );\n\n if (traceState.targetIndex !== updatedTraceTarget.index) {\n // target changed\n if (traceState.targetIndex !== -1) {\n // remove points added during previous trace\n const oldTarget = traceState.targets[traceState.targetIndex];\n this.removeTracedCoordinates_(oldTarget.startIndex, oldTarget.endIndex);\n }\n // add points for the new target\n const newTarget = traceState.targets[updatedTraceTarget.index];\n this.addTracedCoordinates_(\n newTarget,\n newTarget.startIndex,\n updatedTraceTarget.endIndex,\n );\n } else {\n // target stayed the same\n const target = traceState.targets[traceState.targetIndex];\n this.addOrRemoveTracedCoordinates_(target, updatedTraceTarget.endIndex);\n }\n\n // modify the state with updated info\n traceState.targetIndex = updatedTraceTarget.index;\n const target = traceState.targets[traceState.targetIndex];\n target.endIndex = updatedTraceTarget.endIndex;\n\n // update event coordinate and pixel to match end point of final segment\n const coordinate = interpolateCoordinate(\n target.coordinates,\n target.endIndex,\n );\n const pixel = this.getMap().getPixelFromCoordinate(coordinate);\n event.coordinate = coordinate;\n event.pixel = [Math.round(pixel[0]), Math.round(pixel[1])];\n }\n\n /**\n * Handle drag events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event Event.\n * @override\n */\n handleDragEvent(event) {\n this.ignoreNextUpEvent_ = true;\n super.handleDragEvent(event);\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(event) {\n let pass = true;\n\n if (this.getPointerCount() === 0) {\n if (this.downTimeout_) {\n clearTimeout(this.downTimeout_);\n this.downTimeout_ = undefined;\n }\n\n this.handlePointerMove_(event);\n const tracing = this.traceState_.active;\n if (!this.ignoreNextUpEvent_) {\n this.toggleTraceState_(event);\n }\n\n if (this.shouldHandle_) {\n const startingToDraw = !this.finishCoordinate_;\n if (startingToDraw) {\n this.startDrawing_(event.coordinate);\n }\n if (!startingToDraw && this.freehand_) {\n this.finishDrawing();\n } else if (\n !this.freehand_ &&\n (!startingToDraw || this.mode_ === 'Point')\n ) {\n if (this.atFinish_(event.pixel, tracing)) {\n if (this.finishCondition_(event)) {\n this.finishDrawing();\n }\n } else {\n this.addToDrawing_(event.coordinate);\n }\n }\n pass = false;\n } else if (this.freehand_) {\n this.abortDrawing();\n }\n }\n this.ignoreNextUpEvent_ = false;\n\n if (!pass && this.stopClick_) {\n event.preventDefault();\n }\n return pass;\n }\n\n /**\n * Handle move events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event A move event.\n * @private\n */\n handlePointerMove_(event) {\n this.pointerType_ = event.originalEvent.pointerType;\n if (\n this.downPx_ &&\n ((!this.freehand_ && this.shouldHandle_) ||\n (this.freehand_ && !this.shouldHandle_))\n ) {\n const downPx = this.downPx_;\n const clickPx = event.pixel;\n const dx = downPx[0] - clickPx[0];\n const dy = downPx[1] - clickPx[1];\n const squaredDistance = dx * dx + dy * dy;\n this.shouldHandle_ = this.freehand_\n ? squaredDistance > this.squaredClickTolerance_\n : squaredDistance <= this.squaredClickTolerance_;\n if (!this.shouldHandle_) {\n return;\n }\n }\n\n if (!this.finishCoordinate_) {\n this.createOrUpdateSketchPoint_(event.coordinate.slice());\n return;\n }\n\n this.updateTrace_(event);\n this.modifyDrawing_(event.coordinate);\n }\n\n /**\n * Determine if an event is within the snapping tolerance of the start coord.\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @param {boolean} [tracing] Drawing in trace mode (only stop if at the starting point).\n * @return {boolean} The event is within the snapping tolerance of the start.\n * @private\n */\n atFinish_(pixel, tracing) {\n let at = false;\n if (this.sketchFeature_) {\n let potentiallyDone = false;\n let potentiallyFinishCoordinates = [this.finishCoordinate_];\n const mode = this.mode_;\n if (mode === 'Point') {\n at = true;\n } else if (mode === 'Circle') {\n at = this.sketchCoords_.length === 2;\n } else if (mode === 'LineString') {\n potentiallyDone =\n !tracing && this.sketchCoords_.length > this.minPoints_;\n } else if (mode === 'Polygon') {\n const sketchCoords = /** @type {PolyCoordType} */ (this.sketchCoords_);\n potentiallyDone = sketchCoords[0].length > this.minPoints_;\n potentiallyFinishCoordinates = [\n sketchCoords[0][0],\n sketchCoords[0][sketchCoords[0].length - 2],\n ];\n if (tracing) {\n potentiallyFinishCoordinates = [sketchCoords[0][0]];\n } else {\n potentiallyFinishCoordinates = [\n sketchCoords[0][0],\n sketchCoords[0][sketchCoords[0].length - 2],\n ];\n }\n }\n if (potentiallyDone) {\n const map = this.getMap();\n for (let i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) {\n const finishCoordinate = potentiallyFinishCoordinates[i];\n const finishPixel = map.getPixelFromCoordinate(finishCoordinate);\n const dx = pixel[0] - finishPixel[0];\n const dy = pixel[1] - finishPixel[1];\n const snapTolerance = this.freehand_ ? 1 : this.snapTolerance_;\n at = Math.sqrt(dx * dx + dy * dy) <= snapTolerance;\n if (at) {\n this.finishCoordinate_ = finishCoordinate;\n break;\n }\n }\n }\n }\n return at;\n }\n\n /**\n * @param {import(\"../coordinate\").Coordinate} coordinates Coordinate.\n * @private\n */\n createOrUpdateSketchPoint_(coordinates) {\n if (!this.sketchPoint_) {\n this.sketchPoint_ = new Feature(new Point(coordinates));\n this.updateSketchFeatures_();\n } else {\n const sketchPointGeom = this.sketchPoint_.getGeometry();\n sketchPointGeom.setCoordinates(coordinates);\n }\n }\n\n /**\n * @param {import(\"../geom/Polygon.js\").default} geometry Polygon geometry.\n * @private\n */\n createOrUpdateCustomSketchLine_(geometry) {\n if (!this.sketchLine_) {\n this.sketchLine_ = new Feature();\n }\n const ring = geometry.getLinearRing(0);\n let sketchLineGeom = this.sketchLine_.getGeometry();\n if (!sketchLineGeom) {\n sketchLineGeom = new LineString(\n ring.getFlatCoordinates(),\n ring.getLayout(),\n );\n this.sketchLine_.setGeometry(sketchLineGeom);\n } else {\n sketchLineGeom.setFlatCoordinates(\n ring.getLayout(),\n ring.getFlatCoordinates(),\n );\n sketchLineGeom.changed();\n }\n }\n\n /**\n * Start the drawing.\n * @param {import(\"../coordinate.js\").Coordinate} start Start coordinate.\n * @private\n */\n startDrawing_(start) {\n const projection = this.getMap().getView().getProjection();\n const stride = getStrideForLayout(this.geometryLayout_);\n while (start.length < stride) {\n start.push(0);\n }\n this.finishCoordinate_ = start;\n if (this.mode_ === 'Point') {\n this.sketchCoords_ = start.slice();\n } else if (this.mode_ === 'Polygon') {\n this.sketchCoords_ = [[start.slice(), start.slice()]];\n this.sketchLineCoords_ = this.sketchCoords_[0];\n } else {\n this.sketchCoords_ = [start.slice(), start.slice()];\n }\n if (this.sketchLineCoords_) {\n this.sketchLine_ = new Feature(new LineString(this.sketchLineCoords_));\n }\n const geometry = this.geometryFunction_(\n this.sketchCoords_,\n undefined,\n projection,\n );\n this.sketchFeature_ = new Feature();\n if (this.geometryName_) {\n this.sketchFeature_.setGeometryName(this.geometryName_);\n }\n this.sketchFeature_.setGeometry(geometry);\n this.updateSketchFeatures_();\n this.dispatchEvent(\n new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_),\n );\n }\n\n /**\n * Modify the drawing.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @private\n */\n modifyDrawing_(coordinate) {\n const map = this.getMap();\n const geometry = this.sketchFeature_.getGeometry();\n const projection = map.getView().getProjection();\n const stride = getStrideForLayout(this.geometryLayout_);\n let coordinates, last;\n while (coordinate.length < stride) {\n coordinate.push(0);\n }\n if (this.mode_ === 'Point') {\n last = this.sketchCoords_;\n } else if (this.mode_ === 'Polygon') {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n last = coordinates[coordinates.length - 1];\n if (this.atFinish_(map.getPixelFromCoordinate(coordinate))) {\n // snap to finish\n coordinate = this.finishCoordinate_.slice();\n }\n } else {\n coordinates = this.sketchCoords_;\n last = coordinates[coordinates.length - 1];\n }\n last[0] = coordinate[0];\n last[1] = coordinate[1];\n this.geometryFunction_(\n /** @type {!LineCoordType} */ (this.sketchCoords_),\n geometry,\n projection,\n );\n if (this.sketchPoint_) {\n const sketchPointGeom = this.sketchPoint_.getGeometry();\n sketchPointGeom.setCoordinates(coordinate);\n }\n if (geometry.getType() === 'Polygon' && this.mode_ !== 'Polygon') {\n this.createOrUpdateCustomSketchLine_(/** @type {Polygon} */ (geometry));\n } else if (this.sketchLineCoords_) {\n const sketchLineGeom = this.sketchLine_.getGeometry();\n sketchLineGeom.setCoordinates(this.sketchLineCoords_);\n }\n this.updateSketchFeatures_();\n }\n\n /**\n * Add a new coordinate to the drawing.\n * @param {!PointCoordType} coordinate Coordinate\n * @return {Feature<import(\"../geom/SimpleGeometry.js\").default>} The sketch feature.\n * @private\n */\n addToDrawing_(coordinate) {\n const geometry = this.sketchFeature_.getGeometry();\n const projection = this.getMap().getView().getProjection();\n let done;\n let coordinates;\n const mode = this.mode_;\n if (mode === 'LineString' || mode === 'Circle') {\n this.finishCoordinate_ = coordinate.slice();\n coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);\n if (coordinates.length >= this.maxPoints_) {\n if (this.freehand_) {\n coordinates.pop();\n } else {\n done = true;\n }\n }\n coordinates.push(coordinate.slice());\n this.geometryFunction_(coordinates, geometry, projection);\n } else if (mode === 'Polygon') {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n if (coordinates.length >= this.maxPoints_) {\n if (this.freehand_) {\n coordinates.pop();\n } else {\n done = true;\n }\n }\n coordinates.push(coordinate.slice());\n if (done) {\n this.finishCoordinate_ = coordinates[0];\n }\n this.geometryFunction_(this.sketchCoords_, geometry, projection);\n }\n this.createOrUpdateSketchPoint_(coordinate.slice());\n this.updateSketchFeatures_();\n if (done) {\n return this.finishDrawing();\n }\n return this.sketchFeature_;\n }\n\n /**\n * @param {number} n The number of points to remove.\n */\n removeLastPoints_(n) {\n if (!this.sketchFeature_) {\n return;\n }\n const geometry = this.sketchFeature_.getGeometry();\n const projection = this.getMap().getView().getProjection();\n const mode = this.mode_;\n for (let i = 0; i < n; ++i) {\n let coordinates;\n if (mode === 'LineString' || mode === 'Circle') {\n coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);\n coordinates.splice(-2, 1);\n if (coordinates.length >= 2) {\n this.finishCoordinate_ = coordinates[coordinates.length - 2].slice();\n const finishCoordinate = this.finishCoordinate_.slice();\n coordinates[coordinates.length - 1] = finishCoordinate;\n this.createOrUpdateSketchPoint_(finishCoordinate);\n }\n this.geometryFunction_(coordinates, geometry, projection);\n if (geometry.getType() === 'Polygon' && this.sketchLine_) {\n this.createOrUpdateCustomSketchLine_(\n /** @type {Polygon} */ (geometry),\n );\n }\n } else if (mode === 'Polygon') {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n coordinates.splice(-2, 1);\n const sketchLineGeom = this.sketchLine_.getGeometry();\n if (coordinates.length >= 2) {\n const finishCoordinate = coordinates[coordinates.length - 2].slice();\n coordinates[coordinates.length - 1] = finishCoordinate;\n this.createOrUpdateSketchPoint_(finishCoordinate);\n }\n sketchLineGeom.setCoordinates(coordinates);\n this.geometryFunction_(this.sketchCoords_, geometry, projection);\n }\n\n if (coordinates.length === 1) {\n this.abortDrawing();\n break;\n }\n }\n\n this.updateSketchFeatures_();\n }\n\n /**\n * Remove last point of the feature currently being drawn. Does not do anything when\n * drawing POINT or MULTI_POINT geometries.\n * @api\n */\n removeLastPoint() {\n this.removeLastPoints_(1);\n }\n\n /**\n * Stop drawing and add the sketch feature to the target layer.\n * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is\n * dispatched before inserting the feature.\n * @return {Feature<import(\"../geom/SimpleGeometry.js\").default>|null} The drawn feature.\n * @api\n */\n finishDrawing() {\n const sketchFeature = this.abortDrawing_();\n if (!sketchFeature) {\n return null;\n }\n let coordinates = this.sketchCoords_;\n const geometry = sketchFeature.getGeometry();\n const projection = this.getMap().getView().getProjection();\n if (this.mode_ === 'LineString') {\n // remove the redundant last point\n coordinates.pop();\n this.geometryFunction_(coordinates, geometry, projection);\n } else if (this.mode_ === 'Polygon') {\n // remove the redundant last point in ring\n /** @type {PolyCoordType} */ (coordinates)[0].pop();\n this.geometryFunction_(coordinates, geometry, projection);\n coordinates = geometry.getCoordinates();\n }\n\n // cast multi-part geometries\n if (this.type_ === 'MultiPoint') {\n sketchFeature.setGeometry(\n new MultiPoint([/** @type {PointCoordType} */ (coordinates)]),\n );\n } else if (this.type_ === 'MultiLineString') {\n sketchFeature.setGeometry(\n new MultiLineString([/** @type {LineCoordType} */ (coordinates)]),\n );\n } else if (this.type_ === 'MultiPolygon') {\n sketchFeature.setGeometry(\n new MultiPolygon([/** @type {PolyCoordType} */ (coordinates)]),\n );\n }\n\n // First dispatch event to allow full set up of feature\n this.dispatchEvent(new DrawEvent(DrawEventType.DRAWEND, sketchFeature));\n\n // Then insert feature\n if (this.features_) {\n this.features_.push(sketchFeature);\n }\n if (this.source_) {\n this.source_.addFeature(sketchFeature);\n }\n return sketchFeature;\n }\n\n /**\n * Stop drawing without adding the sketch feature to the target layer.\n * @return {Feature<import(\"../geom/SimpleGeometry.js\").default>|null} The sketch feature (or null if none).\n * @private\n */\n abortDrawing_() {\n this.finishCoordinate_ = null;\n const sketchFeature = this.sketchFeature_;\n this.sketchFeature_ = null;\n this.sketchPoint_ = null;\n this.sketchLine_ = null;\n this.overlay_.getSource().clear(true);\n this.deactivateTrace_();\n return sketchFeature;\n }\n\n /**\n * Stop drawing without adding the sketch feature to the target layer.\n * @api\n */\n abortDrawing() {\n const sketchFeature = this.abortDrawing_();\n if (sketchFeature) {\n this.dispatchEvent(new DrawEvent(DrawEventType.DRAWABORT, sketchFeature));\n }\n }\n\n /**\n * Append coordinates to the end of the geometry that is currently being drawn.\n * This can be used when drawing LineStrings or Polygons. Coordinates will\n * either be appended to the current LineString or the outer ring of the current\n * Polygon. If no geometry is being drawn, a new one will be created.\n * @param {!LineCoordType} coordinates Linear coordinates to be appended to\n * the coordinate array.\n * @api\n */\n appendCoordinates(coordinates) {\n const mode = this.mode_;\n const newDrawing = !this.sketchFeature_;\n if (newDrawing) {\n this.startDrawing_(coordinates[0]);\n }\n /** @type {LineCoordType} */\n let sketchCoords;\n if (mode === 'LineString' || mode === 'Circle') {\n sketchCoords = /** @type {LineCoordType} */ (this.sketchCoords_);\n } else if (mode === 'Polygon') {\n sketchCoords =\n this.sketchCoords_ && this.sketchCoords_.length\n ? /** @type {PolyCoordType} */ (this.sketchCoords_)[0]\n : [];\n } else {\n return;\n }\n\n if (newDrawing) {\n sketchCoords.shift();\n }\n\n // Remove last coordinate from sketch drawing (this coordinate follows cursor position)\n sketchCoords.pop();\n\n // Append coordinate list\n for (let i = 0; i < coordinates.length; i++) {\n this.addToDrawing_(coordinates[i]);\n }\n\n const ending = coordinates[coordinates.length - 1];\n // Duplicate last coordinate for sketch drawing (cursor position)\n this.sketchFeature_ = this.addToDrawing_(ending);\n this.modifyDrawing_(ending);\n }\n\n /**\n * Initiate draw mode by starting from an existing geometry which will\n * receive new additional points. This only works on features with\n * `LineString` geometries, where the interaction will extend lines by adding\n * points to the end of the coordinates array.\n * This will change the original feature, instead of drawing a copy.\n *\n * The function will dispatch a `drawstart` event.\n *\n * @param {!Feature<LineString>} feature Feature to be extended.\n * @api\n */\n extend(feature) {\n const geometry = feature.getGeometry();\n const lineString = geometry;\n this.sketchFeature_ = feature;\n this.sketchCoords_ = lineString.getCoordinates();\n const last = this.sketchCoords_[this.sketchCoords_.length - 1];\n this.finishCoordinate_ = last.slice();\n this.sketchCoords_.push(last.slice());\n this.sketchPoint_ = new Feature(new Point(last));\n this.updateSketchFeatures_();\n this.dispatchEvent(\n new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_),\n );\n }\n\n /**\n * Redraw the sketch features.\n * @private\n */\n updateSketchFeatures_() {\n const sketchFeatures = [];\n if (this.sketchFeature_) {\n sketchFeatures.push(this.sketchFeature_);\n }\n if (this.sketchLine_) {\n sketchFeatures.push(this.sketchLine_);\n }\n if (this.sketchPoint_) {\n sketchFeatures.push(this.sketchPoint_);\n }\n const overlaySource = this.overlay_.getSource();\n overlaySource.clear(true);\n overlaySource.addFeatures(sketchFeatures);\n }\n\n /**\n * @private\n */\n updateState_() {\n const map = this.getMap();\n const active = this.getActive();\n if (!map || !active) {\n this.abortDrawing();\n }\n this.overlay_.setMap(active ? map : null);\n }\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const styles = createEditingStyle();\n return function (feature, resolution) {\n return styles[feature.getGeometry().getType()];\n };\n}\n\n/**\n * Create a `geometryFunction` for `type: 'Circle'` that will create a regular\n * polygon with a user specified number of sides and start angle instead of a\n * {@link import(\"../geom/Circle.js\").Circle} geometry.\n * @param {number} [sides] Number of sides of the regular polygon.\n * Default is 32.\n * @param {number} [angle] Angle of the first point in counter-clockwise\n * radians. 0 means East.\n * Default is the angle defined by the heading from the center of the\n * regular polygon to the current pointer position.\n * @return {GeometryFunction} Function that draws a polygon.\n * @api\n */\nexport function createRegularPolygon(sides, angle) {\n return function (coordinates, geometry, projection) {\n const center = fromUserCoordinate(\n /** @type {LineCoordType} */ (coordinates)[0],\n projection,\n );\n const end = fromUserCoordinate(\n /** @type {LineCoordType} */ (coordinates)[coordinates.length - 1],\n projection,\n );\n const radius = Math.sqrt(squaredCoordinateDistance(center, end));\n geometry = geometry || fromCircle(new Circle(center), sides);\n\n let internalAngle = angle;\n if (!angle && angle !== 0) {\n const x = end[0] - center[0];\n const y = end[1] - center[1];\n internalAngle = Math.atan2(y, x);\n }\n makeRegular(\n /** @type {Polygon} */ (geometry),\n center,\n radius,\n internalAngle,\n );\n\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry.transform(projection, userProjection);\n }\n return geometry;\n };\n}\n\n/**\n * Create a `geometryFunction` that will create a box-shaped polygon (aligned\n * with the coordinate system axes). Use this with the draw interaction and\n * `type: 'Circle'` to return a box instead of a circle geometry.\n * @return {GeometryFunction} Function that draws a box-shaped polygon.\n * @api\n */\nexport function createBox() {\n return function (coordinates, geometry, projection) {\n const extent = boundingExtent(\n /** @type {LineCoordType} */ ([\n coordinates[0],\n coordinates[coordinates.length - 1],\n ]).map(function (coordinate) {\n return fromUserCoordinate(coordinate, projection);\n }),\n );\n const boxCoordinates = [\n [\n getBottomLeft(extent),\n getBottomRight(extent),\n getTopRight(extent),\n getTopLeft(extent),\n getBottomLeft(extent),\n ],\n ];\n if (geometry) {\n geometry.setCoordinates(boxCoordinates);\n } else {\n geometry = new Polygon(boxCoordinates);\n }\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry.transform(projection, userProjection);\n }\n return geometry;\n };\n}\n\n/**\n * Get the drawing mode. The mode for multi-part geometries is the same as for\n * their single-part cousins.\n * @param {import(\"../geom/Geometry.js\").Type} type Geometry type.\n * @return {Mode} Drawing mode.\n */\nfunction getMode(type) {\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n return 'Point';\n case 'LineString':\n case 'MultiLineString':\n return 'LineString';\n case 'Polygon':\n case 'MultiPolygon':\n return 'Polygon';\n case 'Circle':\n return 'Circle';\n default:\n throw new Error('Invalid type: ' + type);\n }\n}\n\nexport default Draw;\n", "/*\n Direct whole-slide viewer for a single file, launched via runpp URL param:\n http://localhost:3000/?image_file=SVS/slide.svs\n The format (SVS, OME-TIFF, ...) is deduced from the file extension,\n case-insensitively, by the server (wsi_tile.py open_slide()).\n\n All spatial companion data comes from ONE consolidated .h5ad (like the slide,\n the path is relative to serverconfig.tpmasterdir):\n &spatial_data=SVS/spatial.h5ad\n It supplies the cell/nucleus boundary polygons (drawn as strokes), the\n per-cell cell_type annotations, and the gene expression matrix \u2014 the server\n derives each piece from it (see wsitiles.ts).\n\n &cell_types=1 fills every annotated cell by its type. To fill only some\n types, pass a JSON array \u2014 &cell_types=[\"Tumor\",\"T cell, activated\"] \u2014 the\n unambiguous form, since type names are free text and may contain commas; a\n bare comma list (&cell_types=Tumor,B cells) also works for names without\n commas. Colors are assigned over all types, so a type keeps its color\n across filters.\n\n &annotation_level=n limits the boundary strokes to the n most zoomed-in levels\n of the viewer: zoomed out beyond that, the boundaries are hidden. Omit to\n always show. Gene expression fills are not affected \u2014 they show at all zooms.\n\n While the boundaries are visible (within annotation_level), hovering over a\n cell shows a tooltip with its id, its cell_type (when annotated), and its\n per-gene transcript counts (when genes are loaded).\n\n Gene expression overlay: &gene_expression=ACE2,ACTA2 draws one fill overlay\n per comma-separated gene, each in its own color (see GENE_COLORS), shaded by\n that gene's transcript count in the cell. A legend overlaid on the map's\n top-right corner shows each gene's color gradient and count range; cells\n expressing several genes blend their fills.\n An unknown gene name surfaces an error in the UI (other genes still render).\n When the cell-type overlay is shown, expression fills/legend are suppressed\n (never both fills at once) \u2014 counts still appear in the hover tooltip.\n\n &gene_groups=g1,g2,g3 instead sums each cell's counts over all listed genes\n and draws ONE overlay of the totals in a single color. Can be combined with\n gene_expression (the group takes the next unused palette color).\n\n Lasso: the button under the zoom controls toggles a freehand lasso (an\n OpenLayers Draw interaction). Releasing the pointer selects every cell whose\n centroid lies inside the drawn ring and opens a menu listing the selection:\n per-type counts, then a table of cell ids and their annotated types. Only\n one lasso is kept; drawing again replaces it, toggling off clears it.\n The menu's 'Neighborhood enrichment' button (annotated h5ad only) POSTs the\n selected ids to wsitiles/nhood, which runs the squidpy-style analysis (kNN\n graph over centroids, type-to-neighbour edge counts, permutation z-scores)\n and draws the z-score matrix as a heatmap in a panel under the map.\n\n Bypasses datasets/samples: hits the wsitiles route with a direct slide path\n (resolved relative to serverconfig.tpmasterdir; gated by features.wsi.allowDirectSlidePath). Minimal\n pan/zoom viewer \u2014 the same OpenLayers Zoomify setup the full viewer uses.\n*/\nimport 'ol/ol.css' // OpenLayers base styles\nimport Map from 'ol/Map.js' // the pan/zoom map widget\nimport View from 'ol/View.js' // its camera (resolutions + extent)\nimport TileLayer from 'ol/layer/Tile.js' // mosaics the slide tiles\nimport Zoomify from 'ol/source/Zoomify.js' // tile source matching wsi_tile.py's tier math\nimport VectorLayer from 'ol/layer/Vector.js' // boundary strokes / expression fills\nimport VectorSource from 'ol/source/Vector.js' // holds the polygon features\nimport Feature from 'ol/Feature.js' // one drawable geometry + style\nimport MultiPolygon from 'ol/geom/MultiPolygon.js' // many cell rings in one feature\nimport { Fill, Stroke, Style } from 'ol/style.js' // polygon styling primitives\nimport RBush from 'ol/structs/RBush.js' // spatial index for the hover hit test\nimport Draw from 'ol/interaction/Draw.js' // freehand polygon drawing = the lasso\nimport Control from 'ol/control/Control.js' // hosts the lasso toggle inside the map's viewport\nimport { select } from 'd3-selection' // wraps the control element for the icon helper\nimport { scaleLinear } from 'd3-scale' // diverging z-score color scale of the enrichment heatmap\nimport { dofetch3 } from '#common/dofetch' // fetch wrapper for meta/genecounts\nimport { sayerror, Menu, renderTable, icons, ColorScale } from '#dom' // error banner, lasso menu + table, lasso icon, heatmap legend\nimport { addScaleBar } from './scaleBar' // bottom-right \u00B5m scale bar, every image (spatial or plain)\n\n// default opts.cellCountLimit: above this many cells in the current view, show\n// the raster overlay instead of fetching/rendering per-cell vector data\nconst DEFAULT_CELL_COUNT_LIMIT = 20_000\n\n/** sayerror(), then raises the new error bar above this plot's own\n position:fixed legends/loading indicator (z-index 10/30 below). #dom's\n .sja_errorbar is already position:relative (global CSS) but z-index:auto,\n which still paints BEHIND any explicitly z-indexed positioned sibling in the\n same stacking context (legends are position:fixed, escaping to the page's\n root stacking context, same as this) \u2014 unreadable, the error hidden under\n the legend. Only needed for errors raised once the map/legends can already\n exist (not e.g. the outer catch's fatal \"meta failed\" error, before any of\n that is ever built). */\nfunction sayerrorOnTop(holder: any, o: any) {\n\tsayerror(holder, o)\n\tholder.selectAll('.sja_errorbar').style('z-index', '50')\n}\n\n/** Build the viewer in `holder`; opts mirror the URL params documented above */\nexport async function init(\n\topts: {\n\t\t/** direct slide path relative to tpmasterdir (runpp ?image_file=) */\n\t\tslide?: string\n\t\t/** alternative to slide: raw wsitiles query addressing the slide through a\n\t\t dataset (wsimage=&dslabel=&genome=&sample_id=), already URI-encoded \u2014\n\t\t lets the w2 plot reuse this viewer for spatial images without the\n\t\t allowDirectSlidePath gate */\n\t\tslideQuery?: string\n\t\t/** dataset addressing (only set alongside slideQuery): lets the\n\t\t neighborhood-enrichment panel offer \"find similar regions\" against the\n\t\t dataset's OTHER spatial samples (termdb/wsiBySample + wsitiles/similar).\n\t\t Absent in direct-file mode, which has no dataset to search */\n\t\tgenome?: string\n\t\tdslabel?: string\n\t\tsampleId?: string\n\t\t/** display name when slide is not given (e.g. the spatial image fileName) */\n\t\tlabel?: string\n\t\t/** = spatial_data: the consolidated spatial .h5ad, tpmasterdir-relative \u2014\n\t\t the single source of cell/nucleus boundaries, cell-type annotations and\n\t\t gene expression (the server derives each piece from it) */\n\t\tspatialData?: string\n\t\t/** fetch the cell polygons (type/expression fills need them) but don't\n\t\t draw their strokes */\n\t\thideCellStrokes?: boolean\n\t\t/** skip the nucleus boundary overlay entirely */\n\t\thideNucleusStrokes?: boolean\n\t\t/** fill each cell by its annotated cell_type (when present), one\n\t\t categorical color per type, with a legend */\n\t\tshowCellTypes?: boolean\n\t\t/** cell types to fill, as a list (type names are free text and may\n\t\t contain commas); empty/undefined = all types. Colors are assigned over\n\t\t ALL types (meta's own sorted cellTypes order), so a type keeps its\n\t\t color when the filter changes AND when the raster overlay (below)\n\t\t renders the same types */\n\t\tcellTypeFilter?: string[]\n\t\t/** above this many cells in the CURRENT view, a server-rendered raster\n\t\t image replaces the per-cell vector boundaries/fills, and the lasso is\n\t\t disabled; zooming/panning back under the limit restores vector\n\t\t rendering + the lasso, scoped to the smaller region now in view.\n\t\t Default DEFAULT_CELL_COUNT_LIMIT. No-op without spatialData. */\n\t\tcellCountLimit?: number\n\t\t/** = annotation_level: strokes only in the n most zoomed-in levels */\n\t\tannotationLevel?: string | number\n\t\t/** = gene_expression: comma-separated genes, one fill overlay per gene */\n\t\tgeneExpression?: string\n\t\t/** = gene_groups: genes summed into ONE fill overlay */\n\t\tgeneGroups?: string\n\t\t/** fetch the gene counts (hover tooltip reports them) but draw no\n\t\t expression fills/legend \u2014 the mass burger's unchecked 'Gene expression' */\n\t\thideExpressionFills?: boolean\n\t\t/** map div size; defaults fit the full-window direct viewer */\n\t\twidth?: string\n\t\theight?: string\n\t\t/** open already panned/zoomed to this niche (a wsitiles/similar result,\n\t\t e.g. from another sample's similar-region search) instead of the\n\t\t whole-slide overview, with a dashed box drawn around it. cx/cy/window\n\t\t are \u00B5m, the same obsm/spatial space the server computed them in */\n\t\tfocus?: { cx: number; cy: number; window: number }\n\t},\n\t/** d3 selection the viewer renders into */\n\tholder: any\n) {\n\tconst name = opts.slide ?? opts.label ?? 'slide' // display name in messages\n\tconst loading = holder.append('div').style('margin', '20px').text(`Loading ${name} \u2026`) // placeholder while meta loads\n\ttry {\n\t\t// every wsitiles request carries this query to address the slide\n\t\tconst sq = opts.slideQuery ?? `slide=${encodeURIComponent(opts.slide!)}`\n\t\t// ?cellAnnotations= also gets back spatialVersion (the h5ad's own mtime),\n\t\t// needed below to cache-bust the boundaries/annotations fetches\n\t\tconst metaQuery = opts.spatialData ? `${sq}&cellAnnotations=${encodeURIComponent(opts.spatialData)}` : sq\n\t\tconst meta = await dofetch3(`wsitiles/meta?${metaQuery}`) // geometry first: tiles need it\n\t\tif (!meta || meta.error || meta.status === 'error') throw meta?.error || 'failed to load slide metadata'\n\n\t\tconst [w, h] = meta.slide_dimensions // level-0 slide size in px\n\t\t// server origin for tile URLs ('' when same-origin); trailing slashes trimmed\n\t\tconst host = (sessionStorage.getItem('hostURL') || (window as any).testHost || '').replace(/\\/+$/, '')\n\n\t\t// z-planes of a 3D OME-TIFF stack (meta.planes = 1 for 2D slides);\n\t\t// start on the middle plane, matching the server's default\n\t\tconst planes: number = meta.planes || 1 // how many z-planes the stack has\n\t\tlet plane = Math.floor(planes / 2) // the plane currently shown\n\n\t\tconst makeSource = (\n\t\t\tp: number // one tile source per z-plane; swapped by the slider\n\t\t) =>\n\t\t\tnew Zoomify({\n\t\t\t\t// {z}/{x}/{y} hit wsitiles/tile; unused {TileGroup} satisfies OL's\n\t\t\t\t// requirement that a {TileGroup}/{tileIndex} placeholder be present.\n\t\t\t\t// v=<slide mtime>: regenerating the slide file in place busts the\n\t\t\t\t// browser's immutable tile cache (the server's disk cache keys on it too)\n\t\t\t\turl: `${host}/wsitiles/tile/{z}/{x}/{y}?${sq}${planes > 1 ? `&plane=${p}` : ''}&v=${\n\t\t\t\t\tmeta.version || 0\n\t\t\t\t}&_={TileGroup}`,\n\t\t\t\tsize: [w, h], // OL derives the tier count from this, same math as wsi_tile.py\n\t\t\t\tcrossOrigin: 'anonymous', // tiles come from the API origin, not the page's\n\t\t\t\tzDirection: -1 // pick the sharper tier when between two zoom levels\n\t\t\t})\n\t\tconst source = makeSource(plane) // start on the default (middle) plane\n\t\tconst grid = source.getTileGrid()! // the z/x/y grid OL computed from [w, h]\n\t\tconst extent = grid.getExtent() // slide bounds in map coordinates\n\n\t\tloading.remove() // meta arrived; the map replaces the placeholder\n\n\t\tconst slideLayer = new TileLayer({ source }) // bottom layer: the slide tiles\n\n\t\t// z-plane scroll bar ABOVE the map (the 90vh map pushes anything after\n\t\t// it below the fold); swapping the tile source refetches visible tiles\n\t\t// for the chosen plane, view position unchanged\n\t\tif (planes > 1) {\n\t\t\tconst bar = holder.append('div').style('font', '12px system-ui').style('padding', '4px 8px') // the bar itself\n\t\t\tbar.append('span').text('z-plane: ') // static label\n\t\t\tconst label = () => `${plane + 1}/${planes}` // 1-based display, e.g. '3/5'\n\t\t\tconst planeText = bar.append('span').text(label()) // live readout next to the slider\n\t\t\tbar\n\t\t\t\t.append('input')\n\t\t\t\t.attr('type', 'range') // native slider, one notch per plane\n\t\t\t\t.attr('min', 0) // first plane\n\t\t\t\t.attr('max', planes - 1) // last plane\n\t\t\t\t.attr('step', 1) // whole planes only\n\t\t\t\t.property('value', plane) // start at the default (middle) plane\n\t\t\t\t.style('vertical-align', 'middle')\n\t\t\t\t.style('margin-left', '8px')\n\t\t\t\t.style('width', '200px')\n\t\t\t\t.on('change', function (this: HTMLInputElement) {\n\t\t\t\t\tplane = Number(this.value) // slider position = plane index\n\t\t\t\t\tplaneText.text(label()) // update the '3/5' readout\n\t\t\t\t\tslideLayer.setSource(makeSource(plane)) // refetch visible tiles for this plane\n\t\t\t\t})\n\t\t}\n\n\t\tconst mapDiv = holder // the map's container; legends/tooltip position against it\n\t\t\t.append('div')\n\t\t\t.style('width', opts.width ?? '100vw') // full-window unless the w2 plot passes a size\n\t\t\t.style('height', opts.height ?? '90vh')\n\t\tconst map = new Map({\n\t\t\ttarget: mapDiv.node(), // mount the map into the holder\n\t\t\tlayers: [slideLayer], // overlays are addLayer'd on top below\n\t\t\tview: new View({ resolutions: grid.getResolutions(), extent }) // camera locked to the pyramid\n\t\t})\n\t\tmap.getView().fit(extent) // start fully zoomed out, whole slide visible\n\t\t// real, known mpp only \u2014 never the \u00B5m-math fallback below, which would\n\t\t// draw a scale bar for pixels that aren't actually micrometers\n\t\taddScaleBar(map, Array.isArray(meta.mpp) && meta.mpp.length === 2 ? meta.mpp[0] : undefined)\n\n\t\t// info line under the map: name, pixel size, \u00B5m/px, level count\n\t\tholder\n\t\t\t.append('div')\n\t\t\t.style('font', '12px system-ui')\n\t\t\t.style('padding', '4px 8px')\n\t\t\t.text(\n\t\t\t\t`${name} \u2014 ${w}\u00D7${h}px${\n\t\t\t\t\tArray.isArray(meta.mpp) && meta.mpp.length === 2\n\t\t\t\t\t\t? `, ${meta.mpp[0].toFixed(3)}\u00D7${meta.mpp[1].toFixed(3)} \u00B5m/px`\n\t\t\t\t\t\t: ''\n\t\t\t\t}, ${meta.levels} levels`\n\t\t\t)\n\t\tconst resultsDiv = holder.append('div') // analysis panels under the map (lasso enrichment)\n\n\t\t// Legends are position:fixed and placed from the map's live viewport\n\t\t// rectangle, so they are confined to the map's on-screen area no matter\n\t\t// what surrounds the viewer: they can never overlap UI outside the map.\n\t\t// Scrolling past the map's top pins them near the viewport top while any\n\t\t// of the map is visible \u2014 but sticky chrome (the mass header/tabs) may\n\t\t// float exactly there, over the map, so each pin position is probed with\n\t\t// elementFromPoint and slid down until the point actually hits the map\n\t\t// (i.e. nothing else covers it). When no uncovered spot remains, the\n\t\t// legend hides. Capture-phase scroll listener also catches scrolling\n\t\t// ancestors, not just the window.\n\t\tconst pinned: Array<{ box: any; side: 'left' | 'right' }> = [] // legends + which map corner they hug\n\t\tconst repin = () => {\n\t\t\tconst node = mapDiv.node() // the map the legends are placed against\n\t\t\tif (!node.isConnected) {\n\t\t\t\t// viewer re-rendered: this render's listeners are dead weight\n\t\t\t\twindow.removeEventListener('scroll', repin, true)\n\t\t\t\twindow.removeEventListener('resize', repin)\n\t\t\t\tlayoutObserver.disconnect()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst r = node.getBoundingClientRect() // where the map sits in the viewport\n\t\t\tfor (const p of pinned) {\n\t\t\t\tconst el = p.box.node() // the legend's DOM node, for its size\n\t\t\t\tconst left = p.side == 'left' ? r.left + 40 : r.right - el.offsetWidth - 8 // 40: clear of OL zoom buttons\n\t\t\t\tconst maxTop = r.bottom - el.offsetHeight - 8 // never poke out of the map's bottom\n\t\t\t\tlet top = Math.max(r.top + 8, 8) // inside the map; viewport top once scrolled past\n\t\t\t\t// probe downward past anything covering the map at the pin spot\n\t\t\t\t// (visibility:hidden keeps the legend itself out of the probe)\n\t\t\t\tp.box.style('visibility', 'hidden')\n\t\t\t\twhile (top <= maxTop) {\n\t\t\t\t\tconst hit = document.elementFromPoint(left + 1, top) // topmost element at the corner\n\t\t\t\t\tif (hit && node.contains(hit)) break // the map itself: spot is uncovered\n\t\t\t\t\ttop += 24 // slide below the covering chrome and retry\n\t\t\t\t}\n\t\t\t\tif (top > maxTop) continue // no uncovered spot big enough: stay hidden\n\t\t\t\tp.box.style('visibility', 'visible').style('top', `${top}px`).style('left', `${left}px`)\n\t\t\t}\n\t\t}\n\t\twindow.addEventListener('scroll', repin, { capture: true, passive: true })\n\t\twindow.addEventListener('resize', repin) // map rectangle moves on resize too\n\t\t// the burger menu's settings panel toggles open/closed by changing its\n\t\t// own height/visibility style (controls.config.js), which pushes the map\n\t\t// down without firing either a scroll or a resize event \u2014 nothing above\n\t\t// catches that shift, so the legends stayed pinned at their stale\n\t\t// position. Catches any such layout-affecting style/class change\n\t\t// anywhere on the page; coalesced to one repin() per animation frame\n\t\t// regardless of how many mutations land in a tick.\n\t\tlet repinQueued = false\n\t\tconst queueRepin = () => {\n\t\t\tif (repinQueued) return\n\t\t\trepinQueued = true\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\trepinQueued = false\n\t\t\t\trepin()\n\t\t\t})\n\t\t}\n\n\t\tconst layoutObserver = new MutationObserver(records => {\n\t\t\t// repin() changes the pinned legends' own styles; do not let those writes reschedule repin forever\n\t\t\tif (records.some(r => !pinned.some(p => p.box.node().contains(r.target as Node)))) queueRepin()\n\t\t})\n\t\tlayoutObserver.observe(document.body, { attributes: true, attributeFilter: ['style', 'class'], subtree: true })\n\n\t\t// segmentation overlays: boundary CSVs are in \u00B5m, converted to level-0\n\t\t// pixels via the slide's mpp (defaulting to 1 = coords already in px)\n\t\tconst [mppX, mppY] = Array.isArray(meta.mpp) && meta.mpp.length === 2 ? meta.mpp : [1, 1]\n\n\t\t// open straight to a specific niche instead of the whole-slide overview:\n\t\t// fit its extent with margin and outline it\n\t\tif (opts.focus) {\n\t\t\tconst { cx, cy, window: winSize } = opts.focus\n\t\t\tconst box = focusExtent(cx, cy, winSize, mppX, mppY)\n\t\t\tmap.getView().fit(box, { padding: [40, 40, 40, 40] })\n\t\t\tconst ring = [\n\t\t\t\t[box[0], box[1]],\n\t\t\t\t[box[2], box[1]],\n\t\t\t\t[box[2], box[3]],\n\t\t\t\t[box[0], box[3]],\n\t\t\t\t[box[0], box[1]]\n\t\t\t]\n\t\t\tmap.addLayer(\n\t\t\t\tnew VectorLayer({\n\t\t\t\t\tsource: new VectorSource({ features: [new Feature(new MultiPolygon([[ring]]))] }),\n\t\t\t\t\tstyle: new Style({ stroke: new Stroke({ color: '#e08a00', width: 3, lineDash: [8, 6] }) })\n\t\t\t\t})\n\t\t\t)\n\t\t}\n\n\t\t// annotation_level=n: show the overlays only within the n most zoomed-in\n\t\t// levels. OL picks the tile level with resolution <= the view resolution,\n\t\t// so \"within the n finest levels\" means view resolution < the (n+1)'th\n\t\t// finest grid resolution \u2014 that becomes the layer's (exclusive) maxResolution.\n\t\tconst resolutions = grid.getResolutions() // per-tier map resolutions, coarse -> fine\n\t\tconst n = Number(opts.annotationLevel) // boundaries visible in the n finest tiers\n\t\tconst maxResolution =\n\t\t\tNumber.isInteger(n) && n > 0 && n < resolutions.length ? resolutions[resolutions.length - 1 - n] : undefined\n\n\t\t// the two boundary overlays: file, kind (h5ad piece selector \u2014 with a\n\t\t// consolidated store both files are the SAME h5ad, so kind, not the\n\t\t// file name, identifies the overlay), and stroke color (cell green,\n\t\t// nucleus blue)\n\t\tconst geneList = (\n\t\t\ts?: string // comma-separated param -> clean gene name list\n\t\t) =>\n\t\t\t(s || '')\n\t\t\t\t.split(',')\n\t\t\t\t.map(t => t.trim())\n\t\t\t\t.filter(Boolean)\n\t\tconst exprGenes = geneList(opts.geneExpression) // one overlay per gene\n\t\tconst groupGenes = geneList(opts.geneGroups) // summed into a single overlay\n\n\t\t// which overlays need the h5ad: cell polygons serve the strokes, the\n\t\t// type/expression fills, the hover tooltip and the lasso (hit-testing\n\t\t// needs the rings even with every fill/stroke option off); nucleus\n\t\t// polygons only their own strokes\n\t\t// which overlays need the h5ad: cell polygons serve the strokes, the\n\t\t// type/expression fills, the hover tooltip and the lasso (hit-testing\n\t\t// needs the rings even with every fill/stroke option off); nucleus\n\t\t// polygons only their own strokes. Below the cellCountLimit, both are\n\t\t// fetched viewport-scoped (?bbox=, see buildVector/updateMode) rather\n\t\t// than for the whole sample at once \u2014 avoiding the client-side analog\n\t\t// of the server's own V8 string-length limit (fixed for /boundaries\n\t\t// and /annotations) and the much larger in-memory footprint of one\n\t\t// MultiPolygon feature per hundred-thousand-cell sample.\n\t\tconst needCellPolys = !!opts.spatialData\n\n\t\t// stable type -> color assignment, from meta's own sorted cellTypes\n\t\t// (cheap regardless of sample size, unlike a whole-sample abundance\n\t\t// tally) rather than per-load abundance order: a type must keep the\n\t\t// SAME color whether it's drawn by the vector fill below or by the\n\t\t// raster overlay (wsitiles/overlaytile), which only ever receives\n\t\t// whatever this assigns \u2014 there is no cheaper shared source of truth\n\t\tconst typeColor: { [t: string]: string } = Object.create(null) // type -> 'r, g, b'\n\t\tif (Array.isArray(meta.cellTypes))\n\t\t\tfor (const [i, t] of meta.cellTypes.entries()) typeColor[t] = CELL_TYPE_COLORS[i % CELL_TYPE_COLORS.length]\n\t\t// optional filter: fill/legend/raster tiles only show these types (colors unchanged)\n\t\tconst filterList = opts.cellTypeFilter || [] // the requested type list\n\t\tconst shownTypes: string[] = filterList.length\n\t\t\t? (meta.cellTypes || []).filter((t: string) => filterList.includes(t))\n\t\t\t: meta.cellTypes || []\n\t\tconst shownColor: { [t: string]: string } = Object.create(null) // color subset acting as the fill filter\n\t\tfor (const t of shownTypes) shownColor[t] = typeColor[t]\n\n\t\t// per-gene count maps, fetched ONCE for the whole sample (this route\n\t\t// isn't bbox-scoped: one int per expressing cell is far lighter than a\n\t\t// boundary CSV's repeated vertices, so it hasn't needed to be) and\n\t\t// reused by every buildVector() rebuild below -- only the cell/nucleus\n\t\t// polygons and annotations are re-fetched per viewport. `genes` (the\n\t\t// underlying gene list) and `rgb` (assigned once here, by position \u2014\n\t\t// expr genes then the group overlay, same order the fetch below uses)\n\t\t// are what the raster overlay's own gene-expression mode needs: it\n\t\t// re-sums `genes` server-side instead of receiving `cells` itself,\n\t\t// and `rgb` must match the vector fill's color exactly, same as the\n\t\t// type palette already does for the cell-type raster fills.\n\t\tconst geneCounts: { gene: string; genes: string[]; cells: { [id: string]: number }; max: number; rgb: string }[] =\n\t\t\t[]\n\t\tif (needCellPolys && (exprGenes.length || groupGenes.length)) {\n\t\t\ttry {\n\t\t\t\tconst results = await Promise.all(\n\t\t\t\t\t[...exprGenes, ...groupGenes].map(gene =>\n\t\t\t\t\t\tdofetch3(\n\t\t\t\t\t\t\t`wsitiles/genecounts?${sq}&file=${encodeURIComponent(opts.spatialData!)}&gene=${encodeURIComponent(gene)}`\n\t\t\t\t\t\t).catch((e: any) => ({ error: e.message || String(e) }))\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\tfor (const [i, gene] of exprGenes.entries()) {\n\t\t\t\t\tconst r = results[i] // this gene's genecounts answer\n\t\t\t\t\tif (!r || r.error) {\n\t\t\t\t\t\tsayerrorOnTop(holder, `Gene expression error (${gene}): ${r?.error || 'failed to load'}`) // surface it\n\t\t\t\t\t\tcontinue // one bad gene doesn't block the others\n\t\t\t\t\t}\n\t\t\t\t\tgeneCounts.push({\n\t\t\t\t\t\tgene,\n\t\t\t\t\t\tgenes: [gene],\n\t\t\t\t\t\tcells: r.cells,\n\t\t\t\t\t\tmax: r.max,\n\t\t\t\t\t\trgb: GENE_COLORS[geneCounts.length % GENE_COLORS.length]\n\t\t\t\t\t}) // tooltip (+ fill, below) shows this gene\n\t\t\t\t}\n\t\t\t\tif (groupGenes.length) {\n\t\t\t\t\tconst total: { [id: string]: number } = {} // per-cell sum across the group\n\t\t\t\t\tconst found: string[] = [] // genes that actually answered\n\t\t\t\t\tfor (const [i, gene] of groupGenes.entries()) {\n\t\t\t\t\t\tconst r = results[exprGenes.length + i] // group answers follow the expr ones\n\t\t\t\t\t\tif (!r || r.error) {\n\t\t\t\t\t\t\tsayerrorOnTop(holder, `Gene expression error (${gene}): ${r?.error || 'failed to load'}`) // surface it\n\t\t\t\t\t\t\tcontinue // skip the missing gene, keep summing the rest\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfound.push(gene) // this gene contributes to the sum\n\t\t\t\t\t\tfor (const id in r.cells) total[id] = (total[id] || 0) + r.cells[id] // accumulate per cell\n\t\t\t\t\t}\n\t\t\t\t\tif (found.length) {\n\t\t\t\t\t\tlet max = 0 // the summed overlay's own count ceiling\n\t\t\t\t\t\tfor (const id in total) if (total[id] > max) max = total[id] // find it\n\t\t\t\t\t\tgeneCounts.push({\n\t\t\t\t\t\t\tgene: found.join('+'),\n\t\t\t\t\t\t\tgenes: found,\n\t\t\t\t\t\t\tcells: total,\n\t\t\t\t\t\t\tmax,\n\t\t\t\t\t\t\trgb: GENE_COLORS[geneCounts.length % GENE_COLORS.length]\n\t\t\t\t\t\t}) // summed count in the tooltip + fill\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e: any) {\n\t\t\t\tsayerrorOnTop(holder, `Gene expression error: ${e.message || e}`) // config errors from the throws above\n\t\t\t}\n\t\t}\n\t\t// what the raster overlay will show, decided ONCE (the burger's own\n\t\t// checkboxes choose this, not the viewport, so it never changes\n\t\t// without a full re-render): cell-type fills win over expression\n\t\t// fills when both are requested, same mutual exclusion buildVector's\n\t\t// own typesShown/hideExpressionFills gate applies to the vector path.\n\t\t// Raster can only draw a fill (see overlay_tile's own ponytail note\n\t\t// on strokes), so with neither requested there's nothing to show.\n\t\ttype RasterFill = { kind: 'types' } | { kind: 'gene'; genes: string[]; rgb: string; max: number; label: string }\n\t\tconst rasterFills: RasterFill[] =\n\t\t\tneedCellPolys && opts.showCellTypes && shownTypes.length > 0\n\t\t\t\t? [{ kind: 'types' }]\n\t\t\t\t: needCellPolys && geneCounts.length && !opts.hideExpressionFills\n\t\t\t\t? geneCounts.map(g => ({ kind: 'gene', genes: g.genes, rgb: g.rgb, max: g.max, label: g.gene }))\n\t\t\t\t: []\n\t\tconst rasterEnabled = rasterFills.length > 0\n\n\t\t// mutable per-rebuild state: the hover tooltip and lasso below close\n\t\t// over these `let`s by reference, so neither listener is ever torn\n\t\t// down/recreated on a mode switch -- only buildVector()/teardownVector()\n\t\t// change what they point at\n\t\tlet cellPolys: CellPoly[] | undefined\n\t\tlet cellTypes: { [id: string]: string } | undefined\n\t\tlet index: RBush<CellPoly> | undefined\n\t\tlet vectorLayers: any[] = [] // layers added by the current buildVector(), removed by teardownVector()\n\t\tlet legendEls: any[] = [] // legend DOM boxes added by the current buildVector(), ditto\n\t\tlet firstBuild = true // \"fit to cells\" framing (below) runs once, on the first vector load only\n\t\t// bumped at the very top of every updateMode() call, before any other\n\t\t// side effect -- lets a call detect, at each resumption point after an\n\t\t// await, that a NEWER call has since started and its own eventual\n\t\t// result must not be committed. Without this, successive moveend events\n\t\t// start overlapping updateMode() calls (each one only async; nothing\n\t\t// here was ever serialized), and a slow vector build finishing after a\n\t\t// newer raster decision would restore stale layers and re-enable the\n\t\t// lasso for what is, by then, a dense view; two overlapping\n\t\t// buildVector() calls writing the same cellPolys/cellTypes/vectorLayers\n\t\t// could likewise mix one build's polygons with another's annotations.\n\t\t// buildVector() takes the caller's generation and checks it before each\n\t\t// of its own shared-state commits too (see its own doc comment below).\n\t\tlet modeGeneration = 0\n\t\t// raster-vs-vector + which bbox is currently loaded, read/written by\n\t\t// both updateMode() and buildVector() (moved up here, alongside\n\t\t// modeGeneration, so buildVector() -- defined outside updateMode()'s\n\t\t// own block -- can see them too)\n\t\tlet mode: 'vector' | 'raster' | undefined\n\t\tlet loadedBbox: [number, number, number, number] | undefined\n\n\t\t// the tooltip box, following the cursor; fixed and placed from the\n\t\t// map's viewport rectangle, immune to the surrounding page's layout.\n\t\t// Created once (not per rebuild) whenever cell polygons are possible at\n\t\t// all; pointermove below no-ops while index is unset (raster mode, or\n\t\t// before the first vector load finishes)\n\t\tconst tip = needCellPolys\n\t\t\t? mapDiv\n\t\t\t\t\t.append('div')\n\t\t\t\t\t.attr('data-testid', 'sjpp-wsi-tooltip') // stable hook for e2e tests\n\t\t\t\t\t.style('position', 'fixed')\n\t\t\t\t\t.style('display', 'none')\n\t\t\t\t\t.style('z-index', '20')\n\t\t\t\t\t.style('pointer-events', 'none') // never steal the pointer from the map\n\t\t\t\t\t.style('background', 'rgba(255,255,255,0.9)')\n\t\t\t\t\t.style('padding', '4px 8px')\n\t\t\t\t\t.style('border-radius', '4px')\n\t\t\t\t\t.style('font', '12px system-ui')\n\t\t\t\t\t.style('white-space', 'pre') // one datum per line via \\n\n\t\t\t: undefined\n\n\t\t// shown while the CURRENT view's own data is still arriving: the\n\t\t// /cellcount round trip updateMode() always makes, plus (raster mode)\n\t\t// the overlay tiles' own server-side render latency on a cache miss --\n\t\t// without this, the slide's own tiles (already loading, unaffected by\n\t\t// any of this) render first and the cell overlay visibly catches up\n\t\t// later. Vector mode has no equivalent tile latency: its fetch IS the\n\t\t// wait, so updateMode() hides this the moment buildVector() resolves.\n\t\tconst loadingIndicator = needCellPolys\n\t\t\t? mapDiv\n\t\t\t\t\t.append('div')\n\t\t\t\t\t.attr('data-testid', 'sjpp-wsi-loading')\n\t\t\t\t\t.style('position', 'fixed')\n\t\t\t\t\t.style('z-index', '30')\n\t\t\t\t\t.style('display', 'none')\n\t\t\t\t\t.style('background', 'rgba(255,255,255,0.9)')\n\t\t\t\t\t.style('padding', '6px 12px')\n\t\t\t\t\t.style('border-radius', '4px')\n\t\t\t\t\t.style('font', '12px system-ui')\n\t\t\t\t\t.text('Loading\u2026')\n\t\t\t: undefined\n\t\tfunction showLoading() {\n\t\t\tif (!loadingIndicator) return\n\t\t\tconst r = mapDiv.node().getBoundingClientRect() // centered over the map's own rectangle\n\t\t\tloadingIndicator\n\t\t\t\t.style('top', `${r.top + r.height / 2 - 12}px`)\n\t\t\t\t.style('left', `${r.left + r.width / 2 - 30}px`)\n\t\t\t\t.style('display', 'block')\n\t\t}\n\t\tfunction hideLoading() {\n\t\t\tloadingIndicator?.style('display', 'none')\n\t\t}\n\t\t// reference-counted: updateMode()'s own /cellcount (etc) fetch AND the\n\t\t// map's own pending tile loads (map.on('loadstart'/'loadend') below, which\n\t\t// OL fires based on EVERY layer's own tile queue, slide + however many\n\t\t// raster layers there are) each hold one count open while they're in\n\t\t// flight, so the indicator can only hide once BOTH are done. Checking a\n\t\t// per-layer tile counter synchronously right after a fetch resolves (the\n\t\t// earlier approach) raced: a newly-panned-into tile often hadn't started\n\t\t// loading yet at that exact instant, so the indicator hid before OL had\n\t\t// even begun requesting what the new view actually needs.\n\t\tlet pendingLoads = 0\n\t\t// safety net: OL only dispatches 'loadend' once its whole tile queue\n\t\t// reports settled (see Map.js's renderComplete_) -- a single tile stuck\n\t\t// erroring/retrying (flaky network, a transient 5xx) can leave that\n\t\t// never true, so 'loadend' never fires and the indicator would\n\t\t// otherwise stay up forever. Cleared the moment a real endLoading()\n\t\t// brings the count back to 0 on its own; only fires if that never\n\t\t// happens within STUCK_LOADING_MS.\n\t\tconst STUCK_LOADING_MS = 8000\n\t\tlet stuckTimer: ReturnType<typeof setTimeout> | undefined\n\t\tfunction beginLoading() {\n\t\t\tpendingLoads++\n\t\t\tshowLoading()\n\t\t\tif (!stuckTimer) {\n\t\t\t\tstuckTimer = setTimeout(() => {\n\t\t\t\t\tstuckTimer = undefined\n\t\t\t\t\tpendingLoads = 0\n\t\t\t\t\thideLoading()\n\t\t\t\t}, STUCK_LOADING_MS)\n\t\t\t}\n\t\t}\n\t\tfunction endLoading() {\n\t\t\tpendingLoads = Math.max(0, pendingLoads - 1)\n\t\t\tif (pendingLoads === 0) {\n\t\t\t\tif (stuckTimer) {\n\t\t\t\t\tclearTimeout(stuckTimer)\n\t\t\t\t\tstuckTimer = undefined\n\t\t\t\t}\n\t\t\t\thideLoading()\n\t\t\t}\n\t\t}\n\t\tif (needCellPolys) {\n\t\t\tmap.on('loadstart', beginLoading)\n\t\t\tmap.on('loadend', endLoading)\n\t\t}\n\n\t\tfunction teardownVector() {\n\t\t\tfor (const l of vectorLayers) map.removeLayer(l)\n\t\t\tvectorLayers = []\n\t\t\tfor (const el of legendEls) {\n\t\t\t\tel.remove()\n\t\t\t\tconst i = pinned.findIndex(p => p.box === el)\n\t\t\t\tif (i >= 0) pinned.splice(i, 1)\n\t\t\t}\n\t\t\tlegendEls = []\n\t\t\tcellPolys = undefined\n\t\t\tcellTypes = undefined\n\t\t\tindex = undefined\n\t\t\ttip?.style('display', 'none')\n\t\t}\n\n\t\t/** (Re)fetches boundaries/annotations scoped to `bbox` (\u00B5m) and rebuilds\n\t\t every vector layer + legend from them. Called by updateMode() whenever\n\t\t the view enters vector mode or pans somewhere not already loaded.\n\n\t\t `gen` is the CALLER's own modeGeneration snapshot: checked before every\n\t\t shared-state commit below (cellPolys/cellTypes/vectorLayers/legendEls/\n\t\t index), so a call that's been superseded by a newer updateMode() (e.g. a\n\t\t fast raster decision for a later pan, while this slower vector build is\n\t\t still mid-flight) stops short of writing anything further the moment it\n\t\t notices -- otherwise two overlapping builds could each commit a few of\n\t\t their own steps, mixing one build's polygons with another's annotations,\n\t\t or a stale build could finish last and overwrite a newer, correct result.\n\t\t Returns false (nothing committed beyond this point) when superseded. */\n\t\tasync function buildVector(bbox: [number, number, number, number], gen: number): Promise<boolean> {\n\t\t\tmode = undefined\n\t\t\tloadedBbox = undefined\n\t\t\tteardownVector()\n\t\t\tconst bboxParam = bbox.join(',')\n\t\t\tfor (const [kind, wanted, color] of [\n\t\t\t\t['cell', needCellPolys, 'rgba(0, 200, 80, 0.9)'],\n\t\t\t\t['nucleus', needCellPolys && !opts.hideNucleusStrokes, 'rgba(0, 150, 255, 0.9)']\n\t\t\t] as const) {\n\t\t\t\tif (!wanted) continue // that overlay was not requested\n\t\t\t\ttry {\n\t\t\t\t\tconst polys = await fetchBoundaries(\n\t\t\t\t\t\thost,\n\t\t\t\t\t\tsq,\n\t\t\t\t\t\topts.spatialData!,\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tmppX,\n\t\t\t\t\t\tmppY,\n\t\t\t\t\t\tmeta.spatialVersion,\n\t\t\t\t\t\tbboxParam\n\t\t\t\t\t) // h5ad -> px polygons\n\t\t\t\t\tif (gen !== modeGeneration) return false // superseded while this fetch was in flight: stop before committing it\n\t\t\t\t\tif (kind == 'cell') {\n\t\t\t\t\t\tcellPolys = polys // expression/type fills + hover/lasso reuse these rings\n\t\t\t\t\t\tif (opts.hideCellStrokes) continue // polygons fetched, strokes suppressed\n\t\t\t\t\t}\n\t\t\t\t\tconst layer = strokeLayer(polys, color, maxResolution)\n\t\t\t\t\tmap.addLayer(layer) // draw on top of the slide\n\t\t\t\t\tvectorLayers.push(layer)\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tsayerrorOnTop(holder, `Error loading ${kind} boundaries: ${e.message || e}`) // one overlay failing kills nothing else\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// default framing: fit the view to this sample's own cells instead of\n\t\t\t// leaving the whole-slide overview from map.getView().fit(extent) above.\n\t\t\t// On a well-cropped single-section slide the two are nearly identical\n\t\t\t// (cells already fill most of the frame), but some raw exports are a\n\t\t\t// shared multi-section slide where this sample's own tissue is a small\n\t\t\t// fraction of the image (e.g. two GEO accessions imaged on one physical\n\t\t\t// Xenium slide) \u2014 framing on the canvas there leaves the cells\n\t\t\t// imperceptibly small, which looks like missing boundaries/annotations.\n\t\t\t// Skipped when opts.focus already picked a specific niche (the\n\t\t\t// similar-search preview re-entering this module above), and after\n\t\t\t// the first load \u2014 later rebuilds follow the user's own pan/zoom.\n\t\t\tif (firstBuild && !opts.focus && cellPolys?.length) {\n\t\t\t\t// a manual min/max scan, not Math.min(...xs): a large sample's\n\t\t\t\t// vertex count (500k+) can exceed the engine's max call arguments\n\t\t\t\tlet minX = Infinity,\n\t\t\t\t\tminY = Infinity,\n\t\t\t\t\tmaxX = -Infinity,\n\t\t\t\t\tmaxY = -Infinity\n\t\t\t\tfor (const { ring } of cellPolys) {\n\t\t\t\t\tfor (const [x, y] of ring) {\n\t\t\t\t\t\tif (x < minX) minX = x\n\t\t\t\t\t\tif (x > maxX) maxX = x\n\t\t\t\t\t\tif (y < minY) minY = y\n\t\t\t\t\t\tif (y > maxY) maxY = y\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmap.getView().fit([minX, minY, maxX, maxY], { padding: [40, 40, 40, 40] })\n\t\t\t}\n\t\t\tfirstBuild = false\n\n\t\t\t// per-cell annotations from the h5ad, as JSON {cells:{cell_id:type}} \u2014\n\t\t\t// cell types are free text, so they never travel as CSV; feeds the\n\t\t\t// type fills + tooltip. Useless without the cell polygons.\n\t\t\tif (needCellPolys && cellPolys) {\n\t\t\t\ttry {\n\t\t\t\t\tconst r = await dofetch3(\n\t\t\t\t\t\t`wsitiles/annotations?${sq}&file=${encodeURIComponent(opts.spatialData!)}&bbox=${bboxParam}&v=${\n\t\t\t\t\t\t\tmeta.spatialVersion || 0\n\t\t\t\t\t\t}`\n\t\t\t\t\t)\n\t\t\t\t\tif (!r || r.error) throw new Error(r?.error || 'failed to load annotations')\n\t\t\t\t\tif (gen !== modeGeneration) return false // superseded while this fetch was in flight: stop before committing it\n\t\t\t\t\tcellTypes = r.cells // the id->type map, served ready to use\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tsayerrorOnTop(holder, `Error loading annotations: ${e.message || e}`) // overlay lost, viewer lives\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// cell-type overlay: fill each annotated cell in its type's categorical\n\t\t\t// color (the stable typeColor/shownColor built above), with its own\n\t\t\t// legend (top-left; the gene legend uses top-right). No-op when this\n\t\t\t// view's cells held no annotated types.\n\t\t\t// While it is shown, the gene expression FILLS are suppressed below (the\n\t\t\t// two fills are unreadable on top of each other) \u2014 gene counts are still\n\t\t\t// shown in the hover tooltip.\n\t\t\tconst typesShown = !!(opts.showCellTypes && cellPolys && cellTypes && Object.keys(cellTypes).length)\n\t\t\tif (typesShown && cellPolys && cellTypes) {\n\t\t\t\tconst counts: { [t: string]: number } = Object.create(null) // cells per type, for the legend\n\t\t\t\tfor (const id in cellTypes) counts[cellTypes[id]] = (counts[cellTypes[id]] || 0) + 1 // tally\n\t\t\t\tconst shown = shownTypes.filter(t => counts[t]) // only types actually present in THIS view\n\t\t\t\tconst layer = cellTypeLayer(cellPolys, cellTypes, shownColor) // draw the type fills\n\t\t\t\tmap.addLayer(layer)\n\t\t\t\tvectorLayers.push(layer)\n\n\t\t\t\t// the type legend box, over the map's top-left; repin() places it\n\t\t\t\tconst legend = mapDiv\n\t\t\t\t\t.append('div')\n\t\t\t\t\t.attr('data-testid', 'sjpp-wsi-typelegend') // stable hook for tests\n\t\t\t\t\t.style('position', 'fixed') // viewport-placed by repin(), confined to the map's rectangle\n\t\t\t\t\t.style('z-index', '10')\n\t\t\t\t\t.style('background', 'rgba(255,255,255,0.85)')\n\t\t\t\t\t.style('padding', '6px 10px')\n\t\t\t\t\t.style('border-radius', '4px')\n\t\t\t\t\t.style('font', '12px system-ui')\n\t\t\t\t\t.style('max-height', '50vh')\n\t\t\t\t\t.style('overflow-y', 'auto')\n\t\t\t\tlegend.append('div').style('font-weight', 'bold').style('margin-bottom', '2px').text('Cell type') // title\n\t\t\t\tfor (const t of shown) {\n\t\t\t\t\tconst row = legend.append('div').style('margin', '2px 0') // one legend row per type\n\t\t\t\t\trow // the type's color swatch\n\t\t\t\t\t\t.append('span')\n\t\t\t\t\t\t.style('display', 'inline-block')\n\t\t\t\t\t\t.style('width', '10px')\n\t\t\t\t\t\t.style('height', '10px')\n\t\t\t\t\t\t.style('margin-right', '6px')\n\t\t\t\t\t\t.style('border', '1px solid #ccc')\n\t\t\t\t\t\t.style('background', `rgb(${typeColor[t]})`)\n\t\t\t\t\trow.append('span').text(`${t} (${counts[t]})`) // type name + its cell count in THIS view\n\t\t\t\t}\n\t\t\t\tpinned.push({ box: legend, side: 'left' }) // top-left corner, clear of the zoom buttons\n\t\t\t\tlegendEls.push(legend)\n\t\t\t\trepin() // place it now; scrolling keeps it placed\n\t\t\t}\n\n\t\t\t// gene expression fills, from the whole-sample geneCounts fetched once\n\t\t\t// above -- only which cells to actually draw changes per rebuild\n\t\t\tif (cellPolys && geneCounts.length && !typesShown && !opts.hideExpressionFills) {\n\t\t\t\t// legend overlaid on the map's top-right corner \u2014 anything appended\n\t\t\t\t// below the 90vh map div lands below the fold and is never seen.\n\t\t\t\t// Created lazily so an all-errors run doesn't leave an empty box.\n\t\t\t\tlet legend: any\n\t\t\t\tconst addLegend = (rgb: string, name: string, max: number) => {\n\t\t\t\t\tif (!legend) {\n\t\t\t\t\t\tlegend = mapDiv // the gene legend box, over the map's top-right; repin() places it\n\t\t\t\t\t\t\t.append('div')\n\t\t\t\t\t\t\t.style('position', 'fixed') // viewport-placed by repin(), confined to the map's rectangle\n\t\t\t\t\t\t\t.style('z-index', '10')\n\t\t\t\t\t\t\t.style('background', 'rgba(255,255,255,0.85)')\n\t\t\t\t\t\t\t.style('padding', '6px 10px')\n\t\t\t\t\t\t\t.style('border-radius', '4px')\n\t\t\t\t\t\t\t.style('font', '12px system-ui')\n\t\t\t\t\t\tpinned.push({ box: legend, side: 'right' }) // hug the map's top-right corner\n\t\t\t\t\t\tlegendEls.push(legend)\n\t\t\t\t\t}\n\t\t\t\t\tconst row = legend.append('div').style('margin', '2px 0') // one legend row per gene\n\t\t\t\t\trow.append('span').style('margin-right', '6px').text(name) // the gene's name\n\t\t\t\t\t// alpha range mirrors expressionLayer's shades (log-scaled counts)\n\t\t\t\t\trow\n\t\t\t\t\t\t.append('span')\n\t\t\t\t\t\t.style('display', 'inline-block')\n\t\t\t\t\t\t.style('width', '80px')\n\t\t\t\t\t\t.style('height', '10px')\n\t\t\t\t\t\t.style('vertical-align', 'middle')\n\t\t\t\t\t\t.style('border', '1px solid #ccc')\n\t\t\t\t\t\t.style('background', `linear-gradient(to right, rgba(${rgb}, 0.15), rgba(${rgb}, 0.9))`)\n\t\t\t\t\trow.append('span').style('margin-left', '4px').text(`1\u2013${max}`) // the count range the gradient spans\n\t\t\t\t\trepin() // re-place: each added row changes the legend's size\n\t\t\t\t}\n\t\t\t\tfor (const g of geneCounts) {\n\t\t\t\t\tconst layer = expressionLayer(cellPolys, g.cells, g.max, g.rgb) // fill the expressing cells\n\t\t\t\t\tmap.addLayer(layer)\n\t\t\t\t\tvectorLayers.push(layer)\n\t\t\t\t\taddLegend(g.rgb, g.gene, g.max) // gradient + count range in the legend\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// spatial index over the cell bounding boxes, rebuilt per view: the\n\t\t\t// hover/lasso listeners below (set up once, outside buildVector) read\n\t\t\t// this `let` by reference, so they always see the latest view's cells\n\t\t\tindex = new RBush<CellPoly>()\n\t\t\tfor (const c of cellPolys || []) {\n\t\t\t\tlet minX = Infinity, // the ring's bounding box\n\t\t\t\t\tminY = Infinity,\n\t\t\t\t\tmaxX = -Infinity,\n\t\t\t\t\tmaxY = -Infinity\n\t\t\t\tfor (const [vx, vy] of c.ring) {\n\t\t\t\t\tif (vx < minX) minX = vx\n\t\t\t\t\tif (vx > maxX) maxX = vx\n\t\t\t\t\tif (vy < minY) minY = vy\n\t\t\t\t\tif (vy > maxY) maxY = vy\n\t\t\t\t}\n\t\t\t\tindex.insert([minX, minY, maxX, maxY], c) // bbox -> its cell\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\t// hover tooltip: cell id, annotated type, per-gene counts. Set up once;\n\t\t// no-ops while index is unset (raster mode) or outside annotation_level.\n\t\tif (needCellPolys) {\n\t\t\t// zooming without moving the mouse fires no pointermove, which would\n\t\t\t// leave a stale tooltip up (e.g. wheel-zooming out past\n\t\t\t// annotation_level); hide on every zoom change \u2014 the next pointermove\n\t\t\t// re-shows it when a cell is under the cursor and the zoom allows\n\t\t\tmap.getView().on('change:resolution', () => tip!.style('display', 'none'))\n\t\t\tmap.on('pointermove', (evt: any) => {\n\t\t\t\tconst res = map.getView().getResolution() // current zoom, in map units/px\n\t\t\t\tif (\n\t\t\t\t\t!index ||\n\t\t\t\t\tevt.dragging ||\n\t\t\t\t\t(maxResolution !== undefined && !(typeof res == 'number' && res < maxResolution))\n\t\t\t\t) {\n\t\t\t\t\ttip!.style('display', 'none') // no cells loaded, panning, or zoomed out past annotation_level\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [x, y] = evt.coordinate // pointer position in map (level-0 px) coords\n\t\t\t\tlet hit: CellPoly | undefined // the cell under the pointer, if any\n\t\t\t\tfor (const c of index.getInExtent([x, y, x, y])) {\n\t\t\t\t\t// only cells whose bbox contains the pointer reach the ray cast\n\t\t\t\t\tif (pointInRing(x, y, c.ring)) {\n\t\t\t\t\t\thit = c // exact polygon hit\n\t\t\t\t\t\tbreak // first match wins\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!hit) {\n\t\t\t\t\ttip!.style('display', 'none') // pointer over no cell\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst rows = tooltipRows(hit.id, cellTypes, geneCounts) // the tooltip's lines\n\t\t\t\tconst mr = mapDiv.node().getBoundingClientRect() // map rect: OL pixel -> viewport coords\n\t\t\t\ttip! // place the box just below-right of the cursor and fill it\n\t\t\t\t\t.style('display', 'block')\n\t\t\t\t\t.style('left', `${mr.left + evt.pixel[0] + 12}px`)\n\t\t\t\t\t.style('top', `${mr.top + evt.pixel[1] + 12}px`)\n\t\t\t\t\t.text(rows.join('\\n'))\n\t\t\t})\n\n\t\t\t// lasso: freehand polygon drawn on its own vector layer; on release,\n\t\t\t// the cells whose centroid falls inside it are listed in a menu.\n\t\t\t// Reuses the hover index: only cells whose bbox meets the lasso's\n\t\t\t// extent are ray-cast. Not gated by annotation_level \u2014 a region can\n\t\t\t// be selected at any zoom, but only while in vector mode (see\n\t\t\t// setLassoEnabled, called from updateMode below).\n\t\t\tconst lassoSource = new VectorSource() // holds the one drawn ring\n\t\t\tmap.addLayer(\n\t\t\t\tnew VectorLayer({\n\t\t\t\t\tsource: lassoSource,\n\t\t\t\t\tstyle: new Style({\n\t\t\t\t\t\tstroke: new Stroke({ color: 'rgba(255, 140, 0, 0.9)', width: 2 }), // orange outline\n\t\t\t\t\t\tfill: new Fill({ color: 'rgba(255, 140, 0, 0.1)' }) // faint tint of the region\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t)\n\t\t\tconst draw = new Draw({ source: lassoSource, type: 'Polygon', freehand: true }) // the lasso itself\n\t\t\tconst lassoMenu = new Menu({ padding: '8px', testid: 'sjpp-wsi-lasso-menu' }) // the selection popup\n\t\t\tlet lassoOn = false // whether the Draw interaction is on the map\n\t\t\tlet lassoEnabled = false // whether the button may be toggled at all (vector mode only)\n\t\t\t// the toggle lives in an OL control so it sits inside the map's\n\t\t\t// viewport with the zoom buttons (just below them)\n\t\t\tconst ctl = document.createElement('div') // the control's element\n\t\t\tctl.className = 'ol-unselectable ol-control' // OL styles it as a control\n\t\t\t// inline, not left to .ol-control: a global rule wins on this element and\n\t\t\t// makes it position:relative, i.e. a full-width block whose grey control\n\t\t\t// background paints a band across the map\n\t\t\tctl.style.position = 'absolute'\n\t\t\tctl.style.top = '65px' // right under the +/- zoom buttons\n\t\t\tctl.style.left = '.5em' // aligned with them\n\t\t\t// #dom's getHolder() (below, via icons.lasso) sets this element's own\n\t\t\t// z-index to 1 so its aria-label CSS tooltip (z-index:10000, but that\n\t\t\t// only matters WITHIN this element's own stacking context) renders\n\t\t\t// above plain page content \u2014 far too low once this plot's own\n\t\t\t// position:fixed legends (z-index:10) sit nearby: the tooltip was\n\t\t\t// rendering, just behind the legend. getHolder() sets this AFTER this\n\t\t\t// line runs, so override it after the icons.lasso() call below instead.\n\t\t\tmap.addControl(new Control({ element: ctl }))\n\t\t\tconst btn = icons.lasso(select(ctl).attr('data-testid', 'sjpp-wsi-lasso-btn'), {\n\t\t\t\ttitle: 'Lasso: drag to select cells',\n\t\t\t\tenabled: false, // starts off; the handler repaints the button\n\t\t\t\thandler: () => {\n\t\t\t\t\tif (!lassoEnabled) return // raster mode (too many cells in view): draw a smaller view first\n\t\t\t\t\tlassoOn = !lassoOn\n\t\t\t\t\tbtn.select('button').style('background-color', lassoOn ? 'rgb(207, 226, 243)' : 'transparent') // on = tinted\n\t\t\t\t\tif (lassoOn) map.addInteraction(draw) // drags now draw instead of panning\n\t\t\t\t\telse {\n\t\t\t\t\t\tmap.removeInteraction(draw) // back to pan/zoom\n\t\t\t\t\t\tlassoSource.clear() // drop the drawn region\n\t\t\t\t\t\tlassoMenu.hide()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\tctl.style.zIndex = '100' // overrides getHolder()'s z-index:1 -- see the comment above addControl()\n\t\t\t/** vector mode only: raster mode's cell count is, by definition, too\n\t\t\t large for the lasso's own selection/enrichment flow to stay cheap */\n\t\t\tfunction setLassoEnabled(on: boolean) {\n\t\t\t\tlassoEnabled = on\n\t\t\t\tbtn\n\t\t\t\t\t.select('button')\n\t\t\t\t\t.style('opacity', on ? '1' : '0.35')\n\t\t\t\t\t.style('cursor', on ? 'pointer' : 'not-allowed')\n\t\t\t\tif (!on && lassoOn) {\n\t\t\t\t\tlassoOn = false\n\t\t\t\t\tmap.removeInteraction(draw)\n\t\t\t\t\tlassoSource.clear()\n\t\t\t\t\tlassoMenu.hide()\n\t\t\t\t\tbtn.select('button').style('background-color', 'transparent')\n\t\t\t\t}\n\t\t\t}\n\t\t\tdraw.on('drawstart', () => {\n\t\t\t\tlassoSource.clear() // one lasso at a time\n\t\t\t\tlassoMenu.hide()\n\t\t\t})\n\n\t\t\t// neighborhood enrichment of the lasso selection: the server reads the\n\t\t\t// selected cells' centroids and types from the h5ad, so only ids travel.\n\t\t\t// Rendered into a panel under the map (replacing the previous run) so\n\t\t\t// the result outlives the menu. A function declaration (not const/let):\n\t\t\t// drawend below references it before this textual point, which is fine\n\t\t\t// since drawend only ever runs later, after setup finishes -- but a\n\t\t\t// hoisted declaration sidesteps the ordering question entirely.\n\t\t\tasync function runNhood(ids: string[], k = 6, perms = 1000) {\n\t\t\t\tlassoMenu.hide()\n\t\t\t\tresultsDiv.selectAll('*').remove() // one panel at a time\n\t\t\t\tconst panel = resultsDiv\n\t\t\t\t\t.append('div')\n\t\t\t\t\t.attr('data-testid', 'sjpp-wsi-nhood')\n\t\t\t\t\t.style('margin', '8px')\n\t\t\t\t\t.style('font', '12px system-ui')\n\t\t\t\tpanel\n\t\t\t\t\t.append('div')\n\t\t\t\t\t.text(`Neighborhood enrichment: running on ${ids.length} cells, k=${k}, ${perms} permutations \u2026`) // permutations take a moment\n\t\t\t\ttry {\n\t\t\t\t\tconst r = await dofetch3(`wsitiles/nhood?${sq}`, {\n\t\t\t\t\t\tmethod: 'POST', // explicit: dofetch3's GET path would URL-encode the id list (and re-encode it as strings past the URL length limit)\n\t\t\t\t\t\tbody: { file: opts.spatialData, ids, k, perms }\n\t\t\t\t\t})\n\t\t\t\t\tif (!r || r.error) throw new Error(r?.error || 'failed to compute neighborhood enrichment')\n\t\t\t\t\tpanel.selectAll('*').remove()\n\t\t\t\t\t// the panel's k/permutation controls rerun on the SAME selection\n\t\t\t\t\trenderNhoodHeatmap(panel, r, (k2, p2) => runNhood(ids, k2, p2))\n\t\t\t\t\t// offer to search this sample (any mode) or the dataset's other\n\t\t\t\t\t// spatial samples (dataset-addressed mode only) for a\n\t\t\t\t\t// similarly-composed, similarly-organized region\n\t\t\t\t\tawait renderSimilarSearch(panel, opts, r, ids, sq)\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tpanel.selectAll('*').remove()\n\t\t\t\t\tsayerror(panel, `Neighborhood enrichment error: ${e.message || e}`) // the lasso and viewer live on\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdraw.on('drawend', (evt: any) => {\n\t\t\t\tif (!index) return // defensive: the button is disabled whenever index is unset\n\t\t\t\tconst geom = evt.feature.getGeometry() // the finished polygon\n\t\t\t\tconst ring: number[][] = geom.getCoordinates()[0] // its outer ring, map coords\n\t\t\t\tconst hits = cellsInLasso(ring, index.getInExtent(geom.getExtent())) // bbox prefilter, then ray cast\n\t\t\t\tconst px = map.getPixelFromCoordinate(ring[ring.length - 1]) // where the pointer was released\n\t\t\t\tconst mr = mapDiv.node().getBoundingClientRect() // map rect: OL pixel -> viewport coords\n\t\t\t\t// nhood_enrichment needs >= 2 distinct annotated types to build a\n\t\t\t\t// meaningful type-by-type matrix (server-side validation agrees: see\n\t\t\t\t// wsi_tile.py's own \"needs at least 2 cell types\" check) \u2014 offering the\n\t\t\t\t// menu item for a single-type selection would only error after the fact.\n\t\t\t\t// Evaluated now (not once at setup): cellTypes changes every rebuild.\n\t\t\t\tconst offerNhood = opts.spatialData && cellTypes && new Set(Object.values(cellTypes)).size >= 2\n\t\t\t\tshowLassoMenu(lassoMenu, hits, cellTypes, mr.left + px[0], mr.top + px[1], offerNhood ? runNhood : undefined)\n\t\t\t})\n\n\t\t\t// the raster overlay: ONE persistent Zoomify-tiled layer PER\n\t\t\t// rasterFills entry (same tile grid/addressing as the slide itself;\n\t\t\t// 'types' mode is always exactly one entry, 'gene' mode one per\n\t\t\t// gene/gene-group), created lazily and just shown/hidden by\n\t\t\t// updateMode -- cheaper than tearing down/rebuilding per transition,\n\t\t\t// and each tile is cached server-side per (h5ad version, tile, fill\n\t\t\t// mode) like /tile\n\t\t\tconst rasterLayers: TileLayer[] = []\n\t\t\tfunction ensureRasterLayers(): TileLayer[] {\n\t\t\t\tif (rasterLayers.length) return rasterLayers\n\t\t\t\tfor (const fill of rasterFills) {\n\t\t\t\t\tconst params =\n\t\t\t\t\t\tfill.kind == 'types'\n\t\t\t\t\t\t\t? `colors=${encodeURIComponent(JSON.stringify(shownColor))}`\n\t\t\t\t\t\t\t: `genes=${encodeURIComponent(JSON.stringify(fill.genes))}&rgb=${encodeURIComponent(\n\t\t\t\t\t\t\t\t\tfill.rgb\n\t\t\t\t\t\t\t )}&max_count=${fill.max}`\n\t\t\t\t\tconst source = new Zoomify({\n\t\t\t\t\t\turl: `${host}/wsitiles/overlaytile/{z}/{x}/{y}?${sq}&file=${encodeURIComponent(\n\t\t\t\t\t\t\topts.spatialData!\n\t\t\t\t\t\t)}&slide_w=${w}&slide_h=${h}&mpp_x=${mppX}&mpp_y=${mppY}&${params}&v=${\n\t\t\t\t\t\t\tmeta.spatialVersion || 0\n\t\t\t\t\t\t}&_={TileGroup}`,\n\t\t\t\t\t\tsize: [w, h],\n\t\t\t\t\t\tcrossOrigin: 'anonymous',\n\t\t\t\t\t\tzDirection: -1\n\t\t\t\t\t})\n\t\t\t\t\t// no per-tile load tracking here: map.on('loadstart'/'loadend')\n\t\t\t\t\t// above already covers every layer's tile queue collectively\n\t\t\t\t\tconst layer = new TileLayer({ source }) // no maxResolution: fills show at all zooms, like the vector ones\n\t\t\t\t\tmap.addLayer(layer)\n\t\t\t\t\trasterLayers.push(layer)\n\t\t\t\t}\n\t\t\t\treturn rasterLayers\n\t\t\t}\n\t\t\t// the raster legend(s): 'types' mode draws the same type -> color\n\t\t\t// swatches as vector mode's own (section 5's \"Cell-type filter\"), but\n\t\t\t// with no per-view counts -- raster mode never fetches per-cell\n\t\t\t// annotations, so there is nothing to count. 'gene' mode draws the\n\t\t\t// same gradient-legend style as vector mode's own gene legend, one\n\t\t\t// row per entry, in ONE box (not one per layer). Built once and\n\t\t\t// shown/hidden alongside the raster layers, separately from vector\n\t\t\t// mode's own legend (which teardownVector()/buildVector() manage).\n\t\t\tconst rasterLegends: any[] = []\n\t\t\tfunction ensureRasterLegends() {\n\t\t\t\tif (rasterLegends.length || !rasterFills.length) return rasterLegends\n\t\t\t\tif (rasterFills[0].kind == 'types') {\n\t\t\t\t\tconst legend = mapDiv\n\t\t\t\t\t\t.append('div')\n\t\t\t\t\t\t// its own testid, not vector mode's 'sjpp-wsi-typelegend': rows\n\t\t\t\t\t\t// here never carry a per-cell count, so the two shouldn't be\n\t\t\t\t\t\t// mistaken for each other by anything asserting on that shape\n\t\t\t\t\t\t.attr('data-testid', 'sjpp-wsi-raster-typelegend')\n\t\t\t\t\t\t.style('position', 'fixed')\n\t\t\t\t\t\t.style('z-index', '10')\n\t\t\t\t\t\t.style('background', 'rgba(255,255,255,0.85)')\n\t\t\t\t\t\t.style('padding', '6px 10px')\n\t\t\t\t\t\t.style('border-radius', '4px')\n\t\t\t\t\t\t.style('font', '12px system-ui')\n\t\t\t\t\t\t.style('max-height', '50vh')\n\t\t\t\t\t\t.style('overflow-y', 'auto')\n\t\t\t\t\tlegend.append('div').style('font-weight', 'bold').style('margin-bottom', '2px').text('Cell type')\n\t\t\t\t\tfor (const t of shownTypes) {\n\t\t\t\t\t\tconst row = legend.append('div').style('margin', '2px 0')\n\t\t\t\t\t\trow\n\t\t\t\t\t\t\t.append('span')\n\t\t\t\t\t\t\t.style('display', 'inline-block')\n\t\t\t\t\t\t\t.style('width', '10px')\n\t\t\t\t\t\t\t.style('height', '10px')\n\t\t\t\t\t\t\t.style('margin-right', '6px')\n\t\t\t\t\t\t\t.style('border', '1px solid #ccc')\n\t\t\t\t\t\t\t.style('background', `rgb(${typeColor[t]})`)\n\t\t\t\t\t\trow.append('span').text(t) // no per-cell count: raster mode never fetches annotations\n\t\t\t\t\t}\n\t\t\t\t\tpinned.push({ box: legend, side: 'left' })\n\t\t\t\t\trasterLegends.push(legend)\n\t\t\t\t} else {\n\t\t\t\t\tconst legend = mapDiv\n\t\t\t\t\t\t.append('div')\n\t\t\t\t\t\t.attr('data-testid', 'sjpp-wsi-raster-genelegend')\n\t\t\t\t\t\t.style('position', 'fixed')\n\t\t\t\t\t\t.style('z-index', '10')\n\t\t\t\t\t\t.style('background', 'rgba(255,255,255,0.85)')\n\t\t\t\t\t\t.style('padding', '6px 10px')\n\t\t\t\t\t\t.style('border-radius', '4px')\n\t\t\t\t\t\t.style('font', '12px system-ui')\n\t\t\t\t\tfor (const fill of rasterFills) {\n\t\t\t\t\t\tif (fill.kind != 'gene') continue // narrows the union for TS; always true here\n\t\t\t\t\t\tconst row = legend.append('div').style('margin', '2px 0')\n\t\t\t\t\t\trow.append('span').style('margin-right', '6px').text(fill.label)\n\t\t\t\t\t\trow // alpha range mirrors overlay_tile's own shading (log-scaled counts)\n\t\t\t\t\t\t\t.append('span')\n\t\t\t\t\t\t\t.style('display', 'inline-block')\n\t\t\t\t\t\t\t.style('width', '80px')\n\t\t\t\t\t\t\t.style('height', '10px')\n\t\t\t\t\t\t\t.style('vertical-align', 'middle')\n\t\t\t\t\t\t\t.style('border', '1px solid #ccc')\n\t\t\t\t\t\t\t.style('background', `linear-gradient(to right, rgba(${fill.rgb}, 0.15), rgba(${fill.rgb}, 0.9))`)\n\t\t\t\t\t\trow.append('span').style('margin-left', '4px').text(`1\u2013${fill.max}`)\n\t\t\t\t\t}\n\t\t\t\t\tpinned.push({ box: legend, side: 'right' })\n\t\t\t\t\trasterLegends.push(legend)\n\t\t\t\t}\n\t\t\t\treturn rasterLegends\n\t\t\t}\n\t\t\tfunction showRaster() {\n\t\t\t\tif (!rasterEnabled) return\n\t\t\t\tfor (const l of ensureRasterLayers()) l.setVisible(true)\n\t\t\t\tfor (const l of ensureRasterLegends()) l.style('display', 'block')\n\t\t\t\trepin()\n\t\t\t}\n\t\t\tfunction hideRaster() {\n\t\t\t\tfor (const l of rasterLayers) l.setVisible(false)\n\t\t\t\tfor (const l of rasterLegends) l.style('display', 'none')\n\t\t\t}\n\n\t\t\t// the raster/vector switch itself: above cellCountLimit cells in the\n\t\t\t// CURRENT view, show the raster overlay and disable the lasso; at or\n\t\t\t// below it, fetch/draw this view's own cells as vectors (padded a\n\t\t\t// little past the exact viewport so a small pan doesn't immediately\n\t\t\t// require a refetch) and enable the lasso. Checked on load and on\n\t\t\t// every pan/zoom (moveend); a transient /cellcount failure just\n\t\t\t// leaves the current mode in place rather than guessing.\n\t\t\t/** wsitiles/cellcount for one \u00B5m bbox; throws on a server error. */\n\t\t\tasync function cellCountFor(b: [number, number, number, number]): Promise<number> {\n\t\t\t\tconst r = await dofetch3(\n\t\t\t\t\t`wsitiles/cellcount?${sq}&file=${encodeURIComponent(opts.spatialData!)}&bbox=${b.join(',')}&v=${\n\t\t\t\t\t\tmeta.spatialVersion || 0\n\t\t\t\t\t}`\n\t\t\t\t)\n\t\t\t\tif (!r || r.error) throw new Error(r?.error || 'failed to count cells')\n\t\t\t\treturn r.count\n\t\t\t}\n\n\t\t\tasync function updateMode() {\n\t\t\t\tconst gen = ++modeGeneration // this call's own identity; must stay current to commit anything below\n\t\t\t\tconst ext = map.getView().calculateExtent() as [number, number, number, number]\n\t\t\t\tconst bbox = viewBboxUm(ext, mppX, mppY)\n\t\t\t\tbeginLoading() // holds the indicator open for this fetch; map.on('loadstart'/'loadend') covers any tiles separately\n\t\t\t\tlet count: number\n\t\t\t\ttry {\n\t\t\t\t\tcount = await cellCountFor(bbox)\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tendLoading()\n\t\t\t\t\tif (gen === modeGeneration) sayerrorOnTop(holder, `Cell count error: ${e.message || e}`)\n\t\t\t\t\treturn // keep the current mode rather than guessing\n\t\t\t\t}\n\t\t\t\tif (gen !== modeGeneration) {\n\t\t\t\t\tendLoading() // superseded while awaiting the count: this view's decision is no longer relevant\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst configuredLimit = Number(opts.cellCountLimit)\n\t\t\t\tconst limit =\n\t\t\t\t\topts.cellCountLimit != null && Number.isFinite(configuredLimit) && configuredLimit >= 0\n\t\t\t\t\t\t? configuredLimit\n\t\t\t\t\t\t: DEFAULT_CELL_COUNT_LIMIT\n\t\t\t\tif (count > limit) {\n\t\t\t\t\tfirstBuild = false // subsequent vector loads must preserve the user's framing\n\t\t\t\t\tif (mode !== 'raster') {\n\t\t\t\t\t\tteardownVector()\n\t\t\t\t\t\tshowRaster()\n\t\t\t\t\t\tmode = 'raster'\n\t\t\t\t\t\tsetLassoEnabled(false)\n\t\t\t\t\t}\n\t\t\t\t\tendLoading() // this fetch is done; any newly-needed raster tiles are tracked by loadstart/loadend, not here\n\t\t\t\t} else if (mode !== 'vector' || !loadedBbox || !bboxContains(loadedBbox, bbox)) {\n\t\t\t\t\thideRaster()\n\t\t\t\t\tconst paddedBbox = padBbox(bbox, 0.5) // margin so a small pan stays inside loadedBbox\n\t\t\t\t\t// re-check the PADDED region's own count -- see choosePaddedFetchBbox's\n\t\t\t\t\t// own comment for why this matters -- falling back to the exact\n\t\t\t\t\t// viewport (a failed check errs toward this smaller, already-safe\n\t\t\t\t\t// fetch too) if the padding itself would bust the budget\n\t\t\t\t\tlet fetchBbox = bbox\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfetchBbox = choosePaddedFetchBbox(bbox, paddedBbox, await cellCountFor(paddedBbox), limit)\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t/* fetchBbox already defaults to the exact viewport */\n\t\t\t\t\t}\n\t\t\t\t\tif (gen !== modeGeneration) {\n\t\t\t\t\t\tendLoading() // superseded while awaiting the padded count\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tconst built = await buildVector(fetchBbox, gen)\n\t\t\t\t\tif (gen !== modeGeneration) {\n\t\t\t\t\t\tendLoading() // superseded while buildVector() was in flight: its layers/data are already stale\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tif (built) {\n\t\t\t\t\t\tloadedBbox = fetchBbox\n\t\t\t\t\t\tmode = 'vector'\n\t\t\t\t\t\tsetLassoEnabled(true)\n\t\t\t\t\t}\n\t\t\t\t\tendLoading()\n\t\t\t\t} else {\n\t\t\t\t\tendLoading() // already loaded and still in view: nothing to wait for\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// registered BEFORE the initial updateMode() call (not after): a pan/\n\t\t\t// zoom that happens while that first call is still awaiting its own\n\t\t\t// /cellcount would otherwise fire moveend with no listener attached\n\t\t\t// yet to catch it, leaving the viewer showing the stale initial view\n\t\t\tmap.on('moveend', () => {\n\t\t\t\tupdateMode().catch((e: any) => sayerrorOnTop(holder, `Cell count error: ${e.message || e}`))\n\t\t\t})\n\t\t\tawait updateMode() // the starting view's own mode\n\t\t}\n\t} catch (e: any) {\n\t\tloading.remove() // drop the placeholder before showing the error\n\t\tsayerror(holder, `WSI error: ${e.message || e}`) // anything fatal: meta failure, bad slide path\n\t}\n}\n\n/** one cell's polygon: unquoted cell_id + closed vertex ring in map coords */\ntype CellPoly = { id: string; ring: number[][] }\n\n/** The hover tooltip's lines for one cell: its id, its annotated type (line\n omitted when the cell is unannotated), and one count per loaded gene overlay\n (0.0 when the cell doesn't express it). (exported for tests) */\nexport function tooltipRows(\n\t/** the hovered cell's id */\n\tid: string,\n\t/** cell_id -> annotated type, when annotations loaded */\n\tcellTypes: { [id: string]: string } | undefined,\n\t/** one entry per loaded gene overlay, with its per-cell counts */\n\tgeneCounts: { gene: string; cells: { [id: string]: number } }[]\n): string[] {\n\tconst rows = [`cell id: ${id}`] // line 1: the cell's id\n\tconst t = cellTypes?.[id] // its annotated type, if any\n\tif (t) rows.push(`cell type: ${t}`) // line 2: the type\n\tfor (const g of geneCounts) rows.push(`${g.gene} expression: ${(g.cells[id] || 0).toFixed(1)}`) // per gene\n\treturn rows\n}\n\n/** even-odd ray cast: is (x, y) inside the closed ring? (exported for tests) */\nexport function pointInRing(x: number, y: number, ring: number[][]): boolean {\n\tlet inside = false // parity of edge crossings so far\n\tfor (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n\t\tconst [xi, yi] = ring[i] // edge endpoint i\n\t\tconst [xj, yj] = ring[j] // edge endpoint j (previous vertex)\n\t\t// edge spans y; flip parity when the ray to the left crosses it\n\t\tif (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside\n\t}\n\treturn inside // odd crossings = inside\n}\n\n/** The cells whose centroid (vertex mean) lies inside the lasso ring; order\n preserved from `cells` (exported for tests). Centroid-in-ring, not polygon\n overlap: a cell counts when most of it is inside, which is what a hand-drawn\n region means, and it keeps the test to one ray cast per candidate. */\nexport function cellsInLasso(\n\t/** the lasso's outer ring, map coords */\n\tring: number[][],\n\t/** candidate cells (typically the bbox-index hits for the ring's extent) */\n\tcells: Iterable<CellPoly>\n): CellPoly[] {\n\tconst hits: CellPoly[] = [] // selected cells\n\tfor (const c of cells) {\n\t\tlet sx = 0, // running vertex sums\n\t\t\tsy = 0\n\t\tfor (const [x, y] of c.ring) {\n\t\t\tsx += x\n\t\t\tsy += y\n\t\t}\n\t\tif (pointInRing(sx / c.ring.length, sy / c.ring.length, ring)) hits.push(c) // centroid inside = selected\n\t}\n\treturn hits\n}\n\n/** Fill and show the lasso menu at viewport (x, y): a per-type count summary\n (types by descending count, unannotated cells last), then a table of every\n selected cell's id and type. An empty selection shows a one-line notice. */\nfunction showLassoMenu(\n\tmenu: Menu,\n\thits: CellPoly[],\n\tcellTypes: { [id: string]: string } | undefined,\n\tx: number,\n\ty: number,\n\t/** runs the neighborhood enrichment on the selected ids; absent = no button */\n\trunNhood?: (ids: string[]) => Promise<void>\n) {\n\tmenu.clear().show(x, y)\n\tconst d = menu.d.append('div').style('font', '12px system-ui')\n\tif (!hits.length) {\n\t\td.text('No cells in the lasso') // nothing to list\n\t\treturn\n\t}\n\td.append('div').style('font-weight', 'bold').text(`${hits.length} cells selected`) // headline count\n\n\tconst selectedTypes = new Set(hits.map(c => cellTypes?.[c.id]).filter(Boolean))\n\tif (runNhood && selectedTypes.size >= 2) {\n\t\t// mirrors the route's ids*k*perms cap (server/src/routes/wsitiles.ts) at the\n\t\t// default k=6/perms=1000 the button runs with, so an oversized lasso gets an\n\t\t// instant explanation instead of a POST the server would reject anyway\n\t\tconst maxCells = Math.floor(50_000_000 / (6 * 1000))\n\t\tif (hits.length > maxCells)\n\t\t\td.append('div')\n\t\t\t\t.style('margin', '4px 0')\n\t\t\t\t.style('color', '#a00')\n\t\t\t\t.text(`Selection too large for neighborhood enrichment (max ${maxCells} cells) \u2014 draw a smaller lasso`)\n\t\telse\n\t\t\td.append('div')\n\t\t\t\t.attr('class', 'sja_menuoption sja_sharp_border')\n\t\t\t\t.attr('data-testid', 'sjpp-wsi-nhood-btn')\n\t\t\t\t.style('margin', '4px 0')\n\t\t\t\t.text('Neighborhood enrichment')\n\t\t\t\t.on('click', () => runNhood(hits.map(c => c.id)))\n\t}\n\tif (cellTypes) {\n\t\t// per-type tally of the selection, the input the enrichment step will consume\n\t\tconst counts: { [t: string]: number } = Object.create(null)\n\t\tfor (const c of hits) {\n\t\t\tconst t = cellTypes[c.id] || 'unannotated' // cells the h5ad left unannotated get their own bucket\n\t\t\tcounts[t] = (counts[t] || 0) + 1\n\t\t}\n\t\tconst types = Object.keys(counts).sort((a, b) =>\n\t\t\ta == 'unannotated' ? 1 : b == 'unannotated' ? -1 : counts[b] - counts[a]\n\t\t)\n\t\tconst sum = d.append('div').attr('data-testid', 'sjpp-wsi-lasso-summary').style('margin', '4px 0 6px 0') // the tally\n\t\tfor (const t of types) sum.append('div').text(`${t}: ${counts[t]}`) // one line per type\n\t}\n\tconst columns = [{ label: 'Cell ID' }] as { label: string }[] // id always; type only when annotated\n\tif (cellTypes) columns.push({ label: 'Cell type' })\n\trenderTable({\n\t\tcolumns,\n\t\trows: hits.map(c => (cellTypes ? [{ value: c.id }, { value: cellTypes[c.id] || '' }] : [{ value: c.id }])), // one row per cell\n\t\tdiv: d.append('div').attr('data-testid', 'sjpp-wsi-lasso-table'),\n\t\tshowLines: true,\n\t\tmaxHeight: '40vh'\n\t})\n}\n\n/** Fetch one polygon set of the h5ad (via wsitiles/boundaries) and parse it\n into one closed ring per cell, keyed by the unquoted cell_id. */\nasync function fetchBoundaries(\n\t/** server origin ('' when same-origin) */\n\thost: string,\n\t/** wsitiles query addressing the slide (slide= or dataset params) */\n\tsq: string,\n\t/** the consolidated .h5ad the server regenerates the CSV from */\n\tfile: string,\n\t/** which polygon set */\n\tkind: 'cell' | 'nucleus',\n\t/** \u00B5m per pixel, x and y, from meta.mpp */\n\tmppX: number,\n\tmppY: number,\n\t/** meta.spatialVersion (the h5ad's own mtime): the route caches this\n\t * response for an hour by URL, so a regenerated h5ad needs a new URL to\n\t * bust the browser's copy \u2014 mirrors the tile URLs' own v=<slide mtime> */\n\tversion?: number,\n\t/** 'x0,y0,x1,y1' \u00B5m, optional: restricts to this viewport instead of the\n\t whole sample (see updateMode) */\n\tbbox?: string\n): Promise<CellPoly[]> {\n\tconst res = await fetch(\n\t\t`${host}/wsitiles/boundaries?${sq}&file=${encodeURIComponent(file)}&kind=${kind}&v=${version || 0}${\n\t\t\tbbox ? `&bbox=${bbox}` : ''\n\t\t}`\n\t) // raw csv text\n\tif (!res.ok) throw new Error(`${res.status} ${res.statusText}`) // http failure = overlay error banner\n\treturn parseBoundaries(await res.text(), mppX, mppY) // csv -> polygons\n}\n\n/** Parse a boundary CSV into one closed ring per cell (exported for tests). */\nexport function parseBoundaries(\n\t/** the CSV's full text */\n\ttext: string,\n\t/** \u00B5m per pixel, x and y; 1 = coords already in px */\n\tmppX: number,\n\tmppY: number\n): CellPoly[] {\n\t// rows: \"cell_id\",vertex_x,vertex_y \u2014 one cell's vertices are contiguous.\n\t// Splitting on commas is safe here BECAUSE of what the columns hold: a\n\t// Xenium cell id and two numbers, never quoted free text (cell types,\n\t// which are free text, travel as JSON via wsitiles/annotations instead).\n\t// OL's Zoomify extent is [0,-h,w,0]: x in px to the right, y in px negated.\n\tconst lines = text.split('\\n') // one vertex row per line\n\tconst cells: CellPoly[] = [] // finished polygons\n\tlet ring: number[][] = [] // vertices of the cell being read\n\tlet curId = '' // the cell those vertices belong to\n\tfor (const line of lines) {\n\t\tconst [id, xs, ys] = line.split(',') // cell id + \u00B5m coordinates\n\t\tconst x = Number(xs) // numeric x doubles as the row-validity check\n\t\tif (!xs || Number.isNaN(x)) continue // header / blank line\n\t\tif (id !== curId) {\n\t\t\t// a new cell_id starts: close out the previous cell's ring\n\t\t\tif (ring.length > 2) cells.push({ id: curId.replace(/\"/g, ''), ring })\n\t\t\tring = [] // start collecting the new cell's vertices\n\t\t\tcurId = id // remember whose they are\n\t\t}\n\t\tring.push([x / mppX, -Number(ys) / mppY]) // \u00B5m -> level-0 px, y negated for OL\n\t}\n\tif (ring.length > 2) cells.push({ id: curId.replace(/\"/g, ''), ring }) // don't drop the last cell\n\treturn cells\n}\n\n/** A `window`-\u00B5m-wide/tall box centered on (cx, cy) (\u00B5m, obsm/spatial space \u2014\n e.g. a wsitiles/similar result), as an OL extent [minX, minY, maxX, maxY] in\n level-0 px: the SAME \u00B5m -> px transform parseBoundaries uses (y negated for\n OL), so a niche's box lines up with the cell polygons drawn in the same\n coordinate space. (exported for tests) */\nexport function focusExtent(\n\tcx: number,\n\tcy: number,\n\twindow: number,\n\tmppX: number,\n\tmppY: number\n): [number, number, number, number] {\n\tconst half = window / 2\n\treturn [(cx - half) / mppX, -(cy + half) / mppY, (cx + half) / mppX, -(cy - half) / mppY]\n}\n\n/** The inverse of focusExtent's \u00B5m -> level-0 px transform: the current map\n view extent (OL coordinates) back to a \u00B5m bbox \u2014 what wsitiles/cellcount,\n /boundaries and /annotations' own ?bbox= expects. (exported for tests) */\nexport function viewBboxUm(\n\t/** map view extent [minX, minY, maxX, maxY], level-0 px */\n\textent: [number, number, number, number],\n\tmppX: number,\n\tmppY: number\n): [number, number, number, number] {\n\tconst [minX, minY, maxX, maxY] = extent\n\treturn [minX * mppX, -maxY * mppY, maxX * mppX, -minY * mppY]\n}\n\n/** Grows a \u00B5m bbox by `frac` of its own width/height on each side, so a small\n pan within an already-fetched vector region doesn't immediately require a\n refetch (see updateMode's `contains` check). */\nfunction padBbox(bbox: [number, number, number, number], frac: number): [number, number, number, number] {\n\tconst [x0, y0, x1, y1] = bbox\n\tconst px = (x1 - x0) * frac\n\tconst py = (y1 - y0) * frac\n\treturn [x0 - px, y0 - py, x1 + px, y1 + py]\n}\n\n/** Is `inner` fully within `outer` (both \u00B5m bboxes)? */\nfunction bboxContains(outer: [number, number, number, number], inner: [number, number, number, number]): boolean {\n\treturn inner[0] >= outer[0] && inner[1] >= outer[1] && inner[2] <= outer[2] && inner[3] <= outer[3]\n}\n\n/** Which bbox updateMode() should actually fetch vectors for: the padded one\n (nicer UX \u2014 a small pan stays within loadedBbox, no refetch) unless ITS OWN\n cell count would bust cellCountLimit, in which case the exact (unpadded)\n viewport \u2014 already confirmed under budget by the caller \u2014 is used instead.\n padBbox()'s 50%-a-side margin covers up to 4x the viewport's own area; a\n sparse or empty viewport sitting right next to denser tissue just outside\n it could otherwise make the \"padded\" fetch cost far more than\n cellCountLimit cells, exactly what this raster/vector switch exists to\n avoid. (exported for tests) */\nexport function choosePaddedFetchBbox(\n\tbbox: [number, number, number, number],\n\tpaddedBbox: [number, number, number, number],\n\tpaddedCount: number,\n\tlimit: number\n): [number, number, number, number] {\n\treturn paddedCount > limit ? bbox : paddedBbox\n}\n\n/** One stroke-only vector layer holding every polygon; maxResolution (when\n set) hides the layer once the user zooms out beyond it.\n ponytail: all ~100k polygons in one MultiPolygon feature \u2014 switch to vector\n tiling if rendering within the visible zoom range ever feels sluggish. */\nfunction strokeLayer(cells: CellPoly[], color: string, maxResolution?: number): VectorLayer {\n\treturn new VectorLayer({\n\t\t// every ring wrapped into a single MultiPolygon feature\n\t\tsource: new VectorSource({ features: [new Feature(new MultiPolygon(cells.map(c => [c.ring])))] }),\n\t\tstyle: new Style({ stroke: new Stroke({ color, width: 1 }) }), // outline only, no fill\n\t\tmaxResolution // undefined = visible at every zoom\n\t})\n}\n\n// number of opacity steps for the expression fills\nconst SHADES = 8\n\n// fill colors (\"r, g, b\") cycled per gene; green/blue-ish avoided so fills\n// stay distinguishable from the cell (green) and nucleus (blue) strokes\nconst GENE_COLORS = ['255, 0, 0', '0, 90, 255', '255, 165, 0', '160, 0, 200', '0, 160, 160', '200, 160, 0']\n\n// categorical palette (\"r, g, b\") for the cell-type overlay, most-abundant\n// type first; ~tableau20 order, cycled if a sample has more types\nconst CELL_TYPE_COLORS = [\n\t'31, 119, 180',\n\t'255, 127, 14',\n\t'44, 160, 44',\n\t'214, 39, 40',\n\t'148, 103, 189',\n\t'140, 86, 75',\n\t'227, 119, 194',\n\t'127, 127, 127',\n\t'188, 189, 34',\n\t'23, 190, 207',\n\t'174, 199, 232',\n\t'255, 187, 120',\n\t'152, 223, 138',\n\t'255, 152, 150',\n\t'197, 176, 213',\n\t'196, 156, 148',\n\t'247, 182, 210',\n\t'199, 199, 199',\n\t'219, 219, 141',\n\t'158, 218, 229'\n]\n\n/** One fill layer for the cell-type overlay: cells grouped by type, one\n MultiPolygon feature per type in that type's color at a fixed opacity.\n Unannotated (QC-filtered) cells stay unfilled. */\nfunction cellTypeLayer(\n\t/** every cell polygon of the slide */\n\tcells: CellPoly[],\n\t/** cell_id -> annotated type */\n\tcellTypes: { [id: string]: string },\n\t/** type -> fill color; a type absent here is not drawn */\n\ttypeColor: { [t: string]: string }\n): VectorLayer {\n\tconst byType: { [t: string]: number[][][][] } = {} // polygon lists per type\n\tfor (const c of cells) {\n\t\tconst t = cellTypes[c.id] // this cell's annotation, if any\n\t\tif (t && typeColor[t]) (byType[t] ||= []).push([c.ring]) // typeColor doubles as the filter\n\t}\n\tconst features: Feature[] = [] // one feature per type\n\tfor (const t in byType) {\n\t\tconst f = new Feature(new MultiPolygon(byType[t])) // all of this type's cells at once\n\t\tf.setStyle(new Style({ fill: new Fill({ color: `rgba(${typeColor[t]}, 0.45)` }) })) // fixed-opacity fill\n\t\tfeatures.push(f)\n\t}\n\treturn new VectorLayer({ source: new VectorSource({ features }) }) // fills only, no strokes\n}\n\n/** Fill each expressing cell with `rgb` at an opacity scaling with the cell's\n transcript count for the chosen gene; zero-count cells stay unfilled. Cells\n are bucketed into SHADES opacity steps so the layer is a handful of\n MultiPolygon features instead of one per cell. Counts are log-normalized\n (log1p(n)/log1p(max)) so a few hot cells don't push everything else into\n the faintest shade. Shown at every zoom level \u2014 annotation_level only\n gates the boundary strokes, not the expression fills. */\nfunction expressionLayer(cells: CellPoly[], counts: { [id: string]: number }, max: number, rgb: string): VectorLayer {\n\tconst buckets: number[][][][][] = Array.from({ length: SHADES }, () => []) // one polygon list per shade\n\tfor (const c of cells) {\n\t\tconst n = counts[c.id] // this cell's transcript count\n\t\tif (!n || !max) continue // zero count (or empty result): no fill\n\t\t// log-normalize the count into a shade index 0..SHADES-1\n\t\tbuckets[Math.min(SHADES - 1, Math.floor((Math.log1p(n) / Math.log1p(max)) * SHADES))].push([c.ring])\n\t}\n\tconst features: Feature[] = [] // one MultiPolygon feature per non-empty shade\n\tfor (const [i, polys] of buckets.entries()) {\n\t\tif (!polys.length) continue // no cell landed in this shade\n\t\tconst f = new Feature(new MultiPolygon(polys)) // all of this shade's cells at once\n\t\tconst alpha = 0.15 + (0.75 * (i + 1)) / SHADES // faintest 0.24 .. strongest 0.90\n\t\tf.setStyle(new Style({ fill: new Fill({ color: `rgba(${rgb}, ${alpha.toFixed(2)})` }) })) // the shade's fill\n\t\tfeatures.push(f)\n\t}\n\treturn new VectorLayer({ source: new VectorSource({ features }) }) // fills only, no strokes\n}\n\n/** The wsitiles/nhood answer: one row/column per cell type, in `types` order */\nexport type NhoodResult = {\n\ttypes: string[]\n\t/** typeCounts[i]: how many selected cells are of types[i] (the wsitiles/similar\n\t query's composition vector); optional here only because older test fixtures\n\t predate it \u2014 the live route always includes it */\n\ttypeCounts?: number[]\n\t/** count[a][b]: edges from a type-a cell to a type-b neighbour */\n\tcount: number[][]\n\t/** z-score of count vs. permuted labels; null where the permutations had no variance */\n\tzscore: (number | null)[][]\n\tcells: number\n\tskipped: number\n\tk: number\n\tperms: number\n}\n\n/** Draw the enrichment z-score matrix as a heatmap into `holder`: diverging\n blue (depleted) \u2013 gray (neutral) \u2013 red (enriched) around 0, symmetric domain\n \u00B1max|z|, the value printed in each cell, a native tooltip with the edge\n count, a legend bar, and a close button. Types are rows (the cell) and\n columns (its neighbour). (exported for tests) */\nexport function renderNhoodHeatmap(\n\tholder: any,\n\tr: NhoodResult,\n\t/** rerun the analysis with new k / permutations; absent = no controls */\n\trerun?: (k: number, perms: number) => void\n) {\n\tconst C = r.types.length // matrix size\n\tlet m = 1 // color domain half-width: the largest finite |z|, at least 1\n\tfor (const row of r.zscore) for (const z of row) if (z != null && Math.abs(z) > m) m = Math.abs(z)\n\tconst color = scaleLinear<string>().domain([-m, 0, m]).range(['#2a78d6', '#f0efec', '#d0342c']) // blue\u2013gray\u2013red\n\tconst cs = 34, // cell size, px\n\t\tgap = 2, // surface gap between fills\n\t\tlabelW = Math.min(180, 14 + 6.5 * Math.max(...r.types.map(t => t.length))), // row label column\n\t\ttopH = Math.min(140, 14 + 5 * Math.max(...r.types.map(t => t.length))) // rotated column labels\n\n\tconst head = holder.append('div').style('display', 'flex').style('align-items', 'baseline').style('gap', '10px')\n\thead\n\t\t.append('div')\n\t\t.style('font-weight', 'bold')\n\t\t.text(\n\t\t\t`Neighborhood enrichment \u2014 ${r.cells} cells, ${r.k} nearest neighbours, ${r.perms} permutations` +\n\t\t\t\t(r.skipped ? `, ${r.skipped} unannotated cells skipped` : '')\n\t\t)\n\tif (rerun) {\n\t\t// k and permutation controls, prefilled with the values that ran; bounds\n\t\t// mirror the route's clamps. Native number inputs, no widget library.\n\t\tconst ctl = head.append('span').attr('data-testid', 'sjpp-wsi-nhood-controls').style('opacity', 0.85)\n\t\tconst numInput = (label: string, value: number, min: number, max: number, title: string) => {\n\t\t\tctl.append('label').attr('title', title).style('margin-left', '6px').text(`${label} `)\n\t\t\treturn ctl\n\t\t\t\t.append('input')\n\t\t\t\t.attr('type', 'number')\n\t\t\t\t.attr('min', min)\n\t\t\t\t.attr('max', max)\n\t\t\t\t.attr('step', 1)\n\t\t\t\t.style('width', '5em')\n\t\t\t\t.property('value', value)\n\t\t}\n\t\tconst kIn = numInput('k', r.k, 1, 30, 'nearest neighbours per cell')\n\t\tconst pIn = numInput('permutations', r.perms, 10, 5000, 'random relabellings for the null distribution')\n\t\tconst clamp = (el: any, lo: number, hi: number) =>\n\t\t\tMath.min(hi, Math.max(lo, Math.round(Number(el.property('value')) || lo)))\n\t\tctl\n\t\t\t.append('button')\n\t\t\t.attr('data-testid', 'sjpp-wsi-nhood-rerun')\n\t\t\t.style('margin-left', '6px')\n\t\t\t.text('Rerun')\n\t\t\t.on('click', () => rerun(clamp(kIn, 1, 30), clamp(pIn, 10, 5000)))\n\t}\n\thead\n\t\t.append('span')\n\t\t.attr('role', 'button')\n\t\t.attr('tabindex', 0)\n\t\t.style('cursor', 'pointer')\n\t\t.style('opacity', 0.6)\n\t\t.attr('title', 'Close')\n\t\t.text('\u2715')\n\t\t.on('click', () => holder.remove())\n\t\t// a role=\"button\" span isn't a native <button>, so the browser never fires\n\t\t// a click from the keyboard on its own \u2014 wire Enter/Space to the same close\n\t\t// action so the control is keyboard-accessible, matching its tabindex=0\n\t\t.on('keydown', (event: KeyboardEvent) => {\n\t\t\t// both keys: the two activation keys a real <button> responds to\n\t\t\tif (event.key == 'Enter' || event.key == ' ') {\n\t\t\t\tevent.preventDefault() // Space would otherwise scroll the page\n\t\t\t\tholder.remove() // same action as the click handler above\n\t\t\t}\n\t\t})\n\tholder\n\t\t.append('div')\n\t\t.style('opacity', 0.7)\n\t\t.style('margin', '2px 0 6px 0')\n\t\t.text(\n\t\t\t'z-score of edge counts from each cell type (row) to its neighbours (column) vs. shuffled labels: red = enriched, blue = depleted'\n\t\t)\n\n\tconst svg = holder\n\t\t.append('svg')\n\t\t.attr('width', labelW + C * (cs + gap) + 10)\n\t\t.attr('height', topH + C * (cs + gap) + 10)\n\t\t.style('font', '11px system-ui')\n\tconst g = svg.append('g').attr('transform', `translate(${labelW},${topH})`)\n\tfor (const [i, t] of r.types.entries()) {\n\t\t// row label (right-aligned at the matrix's left edge) and rotated column label\n\t\tg.append('text')\n\t\t\t.attr('x', -6)\n\t\t\t.attr('y', i * (cs + gap) + cs / 2)\n\t\t\t.attr('dy', '0.35em')\n\t\t\t.attr('text-anchor', 'end')\n\t\t\t.attr('fill', '#0b0b0b')\n\t\t\t.text(t)\n\t\tg.append('text')\n\t\t\t.attr('transform', `translate(${i * (cs + gap) + cs / 2},-6) rotate(-45)`)\n\t\t\t.attr('text-anchor', 'start')\n\t\t\t.attr('fill', '#0b0b0b')\n\t\t\t.text(t)\n\t}\n\tfor (const [i, a] of r.types.entries()) {\n\t\tfor (const [j, b] of r.types.entries()) {\n\t\t\tconst z = r.zscore[i][j] // this pair's z-score (null = undefined)\n\t\t\tconst cell = g\n\t\t\t\t.append('g')\n\t\t\t\t.attr('class', 'sjpp-wsi-nhood-cell')\n\t\t\t\t.attr('transform', `translate(${j * (cs + gap)},${i * (cs + gap)})`)\n\t\t\tcell\n\t\t\t\t.append('rect')\n\t\t\t\t.attr('width', cs)\n\t\t\t\t.attr('height', cs)\n\t\t\t\t.attr('rx', 3)\n\t\t\t\t.attr('fill', z == null ? '#f0efec' : color(z))\n\t\t\tcell\n\t\t\t\t.append('text')\n\t\t\t\t.attr('x', cs / 2)\n\t\t\t\t.attr('y', cs / 2)\n\t\t\t\t.attr('dy', '0.35em')\n\t\t\t\t.attr('text-anchor', 'middle')\n\t\t\t\t.attr('fill', z != null && Math.abs(z) / m > 0.6 ? '#fff' : '#0b0b0b') // readable on the saturated ends\n\t\t\t\t.text(z == null ? '\u2013' : z.toFixed(1))\n\t\t\tcell.append('title').text(`${a} \u2192 ${b}\\nz-score: ${z == null ? 'n/a' : z.toFixed(2)}\\nedges: ${r.count[i][j]}`) // hover detail\n\t\t}\n\t}\n\t// legend: the same diverging scale, ticks at nice values of \u00B1m\n\tconst legendSvg = holder.append('svg').attr('width', 220).attr('height', 45).style('font', '11px system-ui')\n\tnew ColorScale({\n\t\tholder: legendSvg,\n\t\tdomain: [-m, 0, m],\n\t\tcolors: ['#2a78d6', '#f0efec', '#d0342c'],\n\t\twidth: 180,\n\t\theight: 40,\n\t\tposition: '15,5',\n\t\tticks: 5\n\t})\n}\n\n/** After a neighborhood-enrichment run, offer to search for a region with a\n similar cell-type composition and neighbourhood structure: wsitiles/similar\n coarse-scans each candidate by cosine similarity, then confirms only the top\n candidates with the same permutation z-score test nhood_enrichment ran on\n this selection. Searching THIS sample's own image needs no dataset \u2014 it\n reuses opts.spatialData + activeQuery, already known from how the viewer\n itself was addressed \u2014 so that option is offered in direct-file mode too;\n searching the DATASET's other spatial samples needs opts.genome/dslabel to\n list them and is skipped without it (direct-file mode has no dataset to\n search), which leaves the sample dropdown a single (\"this image\") entry.\n (exported for tests) */\nexport async function renderSimilarSearch(\n\tholder: any,\n\topts: {\n\t\tgenome?: string\n\t\tdslabel?: string\n\t\tsampleId?: string\n\t\t/** the ACTIVE image already open in this viewer (same object passed to\n\t\t init(), see View.ts): reused as-is for same-sample searches so the\n\t\t request addresses the exact image on screen, whose queryIds/excludeIds\n\t\t this closure was captured for, instead of re-picking (possibly a\n\t\t different) image from a fresh wsiBySample listing */\n\t\tspatialData?: string\n\t},\n\t/** the just-completed nhood_enrichment result: its composition/adjacency\n\t become the search query */\n\tquery: NhoodResult,\n\t/** the lasso's own selected cell ids \u2014 passed to the server as excludeIds\n\t when searching THIS sample, so the reference region itself (an otherwise\n\t trivial cheapScore~1/distance~0 \"match\") doesn't dominate the results */\n\tqueryIds?: string[],\n\t/** the SAME wsitiles query string init() computed to address the slide\n\t currently on screen (opts.slideQuery when the viewer is dataset-addressed,\n\t else its own slide= fallback \u2014 see init()'s `sq`) \u2014 same-sample search\n\t reuses it as-is, rather than opts.slideQuery alone, which direct-file mode\n\t (runpp ?image_file=) never sets */\n\tactiveQuery?: string\n) {\n\tif (!query.typeCounts) return // nothing to search with\n\t// a stable dropdown value for \"this image\": the real sampleId when the\n\t// viewer is dataset-addressed, or a sentinel in direct-file mode (which\n\t// has none) \u2014 either way, distinct from any real sibling sampleId below\n\tconst selfId = opts.sampleId || '__self__'\n\tconst selfLabel = opts.sampleId ? `${opts.sampleId} (this sample)` : 'this image'\n\tlet sampleOptions = [{ sampleId: selfId, label: selfLabel }]\n\tif (opts.genome && opts.dslabel) {\n\t\tconst data = await dofetch3(\n\t\t\t`termdb/wsiBySample?genome=${encodeURIComponent(opts.genome)}&dslabel=${encodeURIComponent(\n\t\t\t\topts.dslabel\n\t\t\t)}&imageType=spatial`\n\t\t).catch(() => null)\n\t\t// every other spatial sample in the dataset; wsiBySample's own listing\n\t\t// may also include this sample, so it's filtered out here to avoid a\n\t\t// duplicate entry (the \"this image\" option above already covers it)\n\t\tconst siblings = ((data?.samples || []) as { sampleId: string }[]).filter(s => s.sampleId != opts.sampleId)\n\t\tsampleOptions = sampleOptions.concat(siblings.map(s => ({ sampleId: s.sampleId, label: s.sampleId })))\n\t}\n\n\tconst section = holder\n\t\t.append('div')\n\t\t.attr('data-testid', 'sjpp-wsi-similar')\n\t\t.style('margin-top', '10px')\n\t\t.style('padding-top', '8px')\n\t\t.style('border-top', '1px solid #ddd')\n\t\t.style('font', '12px system-ui')\n\tsection.append('div').style('font-weight', 'bold').text('Find similar regions')\n\tconst row = section.append('div').style('margin', '4px 0')\n\tconst sampleSelect = row.append('select').attr('data-testid', 'sjpp-wsi-similar-sample').style('margin-right', '6px')\n\tfor (const s of sampleOptions) sampleSelect.append('option').attr('value', s.sampleId).text(s.label)\n\trow\n\t\t.append('label')\n\t\t.attr('title', 'A candidate must be within this % of the reference niche\u2019s own cell count')\n\t\t.text(' size tolerance \u00B1')\n\tconst toleranceInput = row\n\t\t.append('input')\n\t\t.attr('data-testid', 'sjpp-wsi-similar-tolerance')\n\t\t.attr('type', 'number')\n\t\t.attr('min', 0)\n\t\t.attr('max', 500)\n\t\t.attr('step', 1)\n\t\t.style('width', '4em')\n\t\t.style('margin', '0 2px')\n\t\t.property('value', 10)\n\trow.append('span').text('%')\n\t// per-type controls: which types a candidate MUST contain at least one\n\t// cell of (hard gate, unchecked by default = no requirement), and how\n\t// much each type counts toward the cheap-score comparison (soft emphasis,\n\t// weight 1 = default/no effect; a required type can still carry any\n\t// weight \u2014 the two are independent knobs, not a spectrum of one setting)\n\tconst typesRow = section.append('div').style('margin', '2px 0 4px 0').style('opacity', 0.85)\n\ttypesRow.append('div').text('per cell type: require present, and/or weight its importance in the match score')\n\tconst typeControls: { type: string; required: any; weight: any }[] = query.types.map(t => {\n\t\tconst line = typesRow.append('div').style('margin', '2px 0').style('display', 'flex').style('align-items', 'center')\n\t\tconst label = line.append('label').style('cursor', 'pointer').style('margin-right', '10px')\n\t\tconst required = label\n\t\t\t.append('input')\n\t\t\t.attr('type', 'checkbox')\n\t\t\t.attr('data-testid', `sjpp-wsi-similar-required-${t}`)\n\t\t\t.property('checked', false)\n\t\tlabel.append('span').style('margin-left', '2px').text(`require ${t}`)\n\t\tline.append('span').style('margin', '0 4px 0 12px').text('weight')\n\t\tconst weight = line\n\t\t\t.append('input')\n\t\t\t.attr('data-testid', `sjpp-wsi-similar-weight-${t}`)\n\t\t\t.attr('type', 'number')\n\t\t\t.attr('min', 0)\n\t\t\t.attr('max', 10)\n\t\t\t.attr('step', 0.5)\n\t\t\t.style('width', '4em')\n\t\t\t.property('value', 1)\n\t\treturn { type: t, required, weight }\n\t})\n\tconst resultsDiv = section.append('div')\n\trow\n\t\t.append('button')\n\t\t.attr('data-testid', 'sjpp-wsi-similar-search')\n\t\t.style('margin-left', '6px')\n\t\t.text('Search')\n\t\t.on('click', async () => {\n\t\t\tconst sampleId = sampleSelect.property('value')\n\t\t\tconst searchingSameSample = sampleId == selfId\n\t\t\t// for status/error text: the real sampleId for a sibling sample, or\n\t\t\t// the human label ('this image'/'<id> (this sample)') for the self\n\t\t\t// option, whose dropdown value may be the '__self__' sentinel\n\t\t\tconst displayName = searchingSameSample ? selfLabel : sampleId\n\t\t\t// percent in the UI, fraction over the wire (route clamps to 0-5, i.e. 0-500%)\n\t\t\tconst sizeTolerance = Math.max(0, Number(toleranceInput.property('value')) || 0) / 100\n\t\t\tconst requiredTypes = typeControls.filter(c => c.required.property('checked')).map(c => c.type)\n\t\t\tconst typeWeights = typeControls.map(c => Math.max(0, Number(c.weight.property('value')) || 0))\n\t\t\tresultsDiv.selectAll('*').remove()\n\t\t\tresultsDiv.append('div').text(`Searching ${displayName} \u2026`)\n\t\t\ttry {\n\t\t\t\t// the image(s) to search, each with its consolidated h5ad\n\t\t\t\t// (wsitiles/similar reads only this file \u2014 the query travels as\n\t\t\t\t// data, not a path). Same sample: reuse the ACTIVE image already\n\t\t\t\t// open in this viewer \u2014 the one queryIds/excludeIds actually came\n\t\t\t\t// from \u2014 instead of re-fetching wsiBySample and possibly picking a\n\t\t\t\t// DIFFERENT one of the sample's image subfolders/tabs. Another\n\t\t\t\t// sample: that sample may also have more than one spatial image and\n\t\t\t\t// there's no per-image picker here, so search all of them\n\t\t\t\tconst images: { fileName: string; spatialData: string }[] = searchingSameSample\n\t\t\t\t\t? opts.spatialData && activeQuery\n\t\t\t\t\t\t? [{ fileName: '', spatialData: opts.spatialData }] // fileName unused: targetParams reuses activeQuery directly below\n\t\t\t\t\t\t: []\n\t\t\t\t\t: (\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tawait dofetch3(\n\t\t\t\t\t\t\t\t\t`termdb/wsiBySample?genome=${encodeURIComponent(opts.genome!)}&dslabel=${encodeURIComponent(\n\t\t\t\t\t\t\t\t\t\topts.dslabel!\n\t\t\t\t\t\t\t\t\t)}&sample_id=${encodeURIComponent(sampleId)}&imageType=spatial`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)?.images || []\n\t\t\t\t\t ).filter((im: any) => im.type == 'spatial' && im.spatialData)\n\t\t\t\tif (!images.length) throw new Error(`${displayName} has no spatial image with cell data`)\n\n\t\t\t\tresultsDiv.selectAll('*').remove()\n\t\t\t\t// the folder name of an image's fileName ('<imageName>/<file>'), for\n\t\t\t\t// labeling results when a sample has more than one spatial image\n\t\t\t\tconst imageLabel = (fileName: string) => fileName.split('/').slice(-2)[0] || fileName\n\t\t\t\tfor (const image of images) {\n\t\t\t\t\tconst targetParams =\n\t\t\t\t\t\tsearchingSameSample && activeQuery\n\t\t\t\t\t\t\t? activeQuery\n\t\t\t\t\t\t\t: `wsimage=${encodeURIComponent(image.fileName)}&dslabel=${encodeURIComponent(opts.dslabel!)}` +\n\t\t\t\t\t\t\t `&genome=${encodeURIComponent(opts.genome!)}&sample_id=${encodeURIComponent(\n\t\t\t\t\t\t\t\t\tsampleId\n\t\t\t\t\t\t\t )}&imageType=spatial`\n\t\t\t\t\tconst label = images.length > 1 ? `${displayName} (${imageLabel(image.fileName)})` : displayName\n\t\t\t\t\tconst r = await dofetch3(`wsitiles/similar?${targetParams}`, {\n\t\t\t\t\t\tmethod: 'POST', // the query signature (typeCounts/count/zscore matrices) travels in the body\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tfile: image.spatialData,\n\t\t\t\t\t\t\ttypes: query.types,\n\t\t\t\t\t\t\ttypeCounts: query.typeCounts,\n\t\t\t\t\t\t\tcount: query.count,\n\t\t\t\t\t\t\tzscore: query.zscore,\n\t\t\t\t\t\t\t// the target's kNN graph (cheap stage) and rigorous confirmation\n\t\t\t\t\t\t\t// must use the SAME k/perms the query's own count/zscore matrices\n\t\t\t\t\t\t\t// were built with \u2014 otherwise the comparison is between graphs of\n\t\t\t\t\t\t\t// different density / z-scores of different permutation-noise\n\t\t\t\t\t\t\t// levels, which can mis-rank the results. k is essentially free to\n\t\t\t\t\t\t\t// forward (no permutation loop); perms only costs more for the\n\t\t\t\t\t\t\t// already-budget-capped rigorous stage on the topK shortlist, not\n\t\t\t\t\t\t\t// the full scan\n\t\t\t\t\t\t\tk: query.k,\n\t\t\t\t\t\t\tperms: query.perms,\n\t\t\t\t\t\t\tsizeTolerance,\n\t\t\t\t\t\t\trequiredTypes,\n\t\t\t\t\t\t\ttypeWeights,\n\t\t\t\t\t\t\t// only meaningful (and only sent) when searching the SAME sample:\n\t\t\t\t\t\t\t// cell ids are per-sample, so applying them cross-sample risks\n\t\t\t\t\t\t\t// coincidentally excluding unrelated cells that happen to share an id\n\t\t\t\t\t\t\texcludeIds: searchingSameSample ? queryIds : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\tif (!r || r.error) throw new Error(r?.error || 'similarity search failed')\n\t\t\t\t\tconst pct = (r.sizeTolerance * 100).toFixed(0)\n\t\t\t\t\tconst weighted = (r.typeWeights || []).some((w: number, i: number) => w != 1 && r.types[i])\n\t\t\t\t\tconst weightSuffix = weighted\n\t\t\t\t\t\t? `, weighted: ${r.types\n\t\t\t\t\t\t\t\t.map((t: string, i: number) => [t, r.typeWeights[i]])\n\t\t\t\t\t\t\t\t.filter(([, w]: [string, number]) => w != 1)\n\t\t\t\t\t\t\t\t.map(([t, w]: [string, number]) => `${t}\u00D7${w}`)\n\t\t\t\t\t\t\t\t.join(', ')}`\n\t\t\t\t\t\t: ''\n\t\t\t\t\tconst reqSuffix =\n\t\t\t\t\t\t(r.requiredTypes?.length ? `, must contain: ${r.requiredTypes.join(', ')}` : '') + weightSuffix\n\t\t\t\t\tif (!r.windows?.length) {\n\t\t\t\t\t\tresultsDiv\n\t\t\t\t\t\t\t.append('div')\n\t\t\t\t\t\t\t.text(\n\t\t\t\t\t\t\t\t`No matching regions found in ${label} (${r.scanned} windows scanned, none within \u00B1${pct}% of the reference's ${r.refCells} cells${reqSuffix}).`\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tresultsDiv\n\t\t\t\t\t\t.append('div')\n\t\t\t\t\t\t.style('opacity', 0.7)\n\t\t\t\t\t\t.style('margin-bottom', '4px')\n\t\t\t\t\t\t.text(\n\t\t\t\t\t\t\t`${label}: top ${r.windows.length} of ${r.scanned} windows scanned (reference: ${r.refCells} cells, \u00B1${pct}% tolerance${reqSuffix}) \u2014 click a row to view it`\n\t\t\t\t\t\t)\n\t\t\t\t\tconst tableDiv = resultsDiv.append('div')\n\t\t\t\t\tconst nicheDiv = resultsDiv\n\t\t\t\t\t\t.append('div')\n\t\t\t\t\t\t.attr('data-testid', 'sjpp-wsi-similar-niche')\n\t\t\t\t\t\t.style('margin-top', '10px')\n\t\t\t\t\trenderTable({\n\t\t\t\t\t\tdiv: tableDiv,\n\t\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\t{ label: '#' },\n\t\t\t\t\t\t\t{ label: 'Cells' },\n\t\t\t\t\t\t\t{ label: '\u0394 vs. reference' },\n\t\t\t\t\t\t\t{ label: 'Cheap score' },\n\t\t\t\t\t\t\t{ label: 'Distance' },\n\t\t\t\t\t\t\t{ label: 'Center (x, y)' }\n\t\t\t\t\t\t],\n\t\t\t\t\t\trows: r.windows.map((w: any, i: number) => [\n\t\t\t\t\t\t\t{ value: String(i + 1) },\n\t\t\t\t\t\t\t{ value: String(w.cells) },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: `${w.cells >= r.refCells ? '+' : ''}${(((w.cells - r.refCells) / r.refCells) * 100).toFixed(1)}%`\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ value: w.cheapScore.toFixed(3) },\n\t\t\t\t\t\t\t{ value: w.distance == null ? 'n/a' : w.distance.toFixed(3) },\n\t\t\t\t\t\t\t{ value: `${w.cx.toFixed(0)}, ${w.cy.toFixed(0)}` }\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tsingleMode: true,\n\t\t\t\t\t\tnoRadioBtn: true, // whole row is the click target, no visible selector column\n\t\t\t\t\t\tnoButtonCallback: async (rowIdx: number) => {\n\t\t\t\t\t\t\tconst w = r.windows[rowIdx]\n\t\t\t\t\t\t\tnicheDiv.selectAll('*').remove()\n\t\t\t\t\t\t\tnicheDiv\n\t\t\t\t\t\t\t\t.append('div')\n\t\t\t\t\t\t\t\t.style('font-weight', 'bold')\n\t\t\t\t\t\t\t\t.text(`${label} \u2014 niche #${rowIdx + 1}`)\n\t\t\t\t\t\t\tconst mapDiv = nicheDiv.append('div')\n\t\t\t\t\t\t\t// re-enter this same module's viewer, addressed at the target\n\t\t\t\t\t\t\t// image, panned/zoomed to this window (opts.focus) with its\n\t\t\t\t\t\t\t// outline drawn \u2014 a small self-contained map, not tied into the\n\t\t\t\t\t\t\t// mass app's sample table/state\n\t\t\t\t\t\t\tawait init(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tslideQuery: targetParams,\n\t\t\t\t\t\t\t\t\tspatialData: image.spatialData,\n\t\t\t\t\t\t\t\t\tlabel: `${label} \u2014 niche #${rowIdx + 1}`,\n\t\t\t\t\t\t\t\t\thideNucleusStrokes: true, // keep the preview lightweight\n\t\t\t\t\t\t\t\t\tshowCellTypes: true, // the point of the preview is comparing cell-type composition by eye\n\t\t\t\t\t\t\t\t\tfocus: { cx: w.cx, cy: w.cy, window: r.window },\n\t\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\t\theight: '45vh'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmapDiv\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t// the window's own enrichment matrix travels with the similar\n\t\t\t\t\t\t\t// search response already (the rigorous-confirmation stage) \u2014 no\n\t\t\t\t\t\t\t// extra request needed; side by side with the ORIGINAL heatmap\n\t\t\t\t\t\t\t// (still shown above, in `panel`) this is the actual point of the\n\t\t\t\t\t\t\t// search: comparing the two niches' neighbourhood structure\n\t\t\t\t\t\t\tconst heatmapDiv = nicheDiv.append('div').style('margin-top', '8px') // own container: its \u2715 shouldn't remove the map above it\n\t\t\t\t\t\t\tif (w.zscore) {\n\t\t\t\t\t\t\t\trenderNhoodHeatmap(heatmapDiv, {\n\t\t\t\t\t\t\t\t\ttypes: r.types,\n\t\t\t\t\t\t\t\t\tcount: w.count,\n\t\t\t\t\t\t\t\t\tzscore: w.zscore,\n\t\t\t\t\t\t\t\t\tcells: w.cells,\n\t\t\t\t\t\t\t\t\tskipped: 0,\n\t\t\t\t\t\t\t\t\tk: r.k,\n\t\t\t\t\t\t\t\t\tperms: r.perms\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// the per-window budget guard (server/src/routes/wsitiles.ts\n\t\t\t\t\t\t\t\t// mirrors this in wsi_tile.py) skipped confirming this window\n\t\t\t\t\t\t\t\theatmapDiv\n\t\t\t\t\t\t\t\t\t.style('opacity', 0.7)\n\t\t\t\t\t\t\t\t\t.text('This window was too large to confirm within the permutation-test budget.')\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} catch (e: any) {\n\t\t\t\tresultsDiv.selectAll('*').remove()\n\t\t\t\tsayerror(resultsDiv, `Similar-region search error: ${e.message || e}`)\n\t\t\t}\n\t\t})\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAM,gBAAN,MAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUlB,WAAW,UAAU,SAAS,UAAU,sBAAsB,OAAO;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOtE,aAAa,UAAU;AAAA,EAA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gBACL,OAAO,EAAE;AAAA,cACV,CAAC;AAAA,YACF,OAAO;AAGN,yBACE,MAAM,WAAW,GAAG,EACpB,KAAK,0EAA0E;AAAA,YAClF;AAAA,UACD;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD,SAAS,GAAQ;AAChB,iBAAW,UAAU,GAAG,EAAE,OAAO;AACjC,eAAS,YAAY,gCAAgC,EAAE,WAAW,CAAC,EAAE;AAAA,IACtE;AAAA,EACD,CAAC;AACH;",
6
+ "names": ["fillInstruction", "p1", "p2", "p3", "measureAndCacheTextWidth", "text", "p1", "p2", "p3", "p4", "fillInstruction", "strokeInstruction", "intersects", "i", "ii", "willReadFrequently", "i", "result", "context", "distance", "i", "geometry", "loading", "EventType_default", "isEmpty", "wrapX", "extent", "userExtent", "xhr", "clone", "linearRingss", "squaredDistance", "extend", "ends", "layout", "squaredDistance", "linearRingss", "linearRingss", "Feature_default", "RBush", "equals", "Feature_default", "equals", "Vector_default", "squaredDistance", "Vector_default", "target", "showLoading", "hideLoading", "beginLoading", "endLoading", "teardownVector", "Vector_default", "name", "setLassoEnabled", "ensureRasterLayers", "source", "ensureRasterLegends", "showRaster", "hideRaster", "p2", "window", "clamp"]
7
+ }