wuepgg3-track 1.0.2

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 (350) hide show
  1. package/dist/CanvasPool-BD4ZA6VU.mjs +46 -0
  2. package/dist/SharedSystems-BNa57PRW.mjs +2521 -0
  3. package/dist/WebGLRenderer-DWCYIsx2.mjs +2624 -0
  4. package/dist/WebGPURenderer-BxRqKjyD.mjs +1613 -0
  5. package/dist/browserAll-CQks4WgI.mjs +2134 -0
  6. package/dist/colorToUniform-BcHZBaJ_.mjs +218 -0
  7. package/dist/components/GenomeView/GenomeRoot.d.ts +5 -0
  8. package/dist/components/GenomeView/ToolComponents/HighlightMenu.d.ts +20 -0
  9. package/dist/components/GenomeView/ToolComponents/MetadataHeader.d.ts +9 -0
  10. package/dist/components/GenomeView/ToolComponents/MetadataSelectionMenu.d.ts +10 -0
  11. package/dist/components/GenomeView/ToolComponents/Tools.d.ts +32 -0
  12. package/dist/components/GenomeView/TrackComponents/3dmol/ArrowList.d.ts +9 -0
  13. package/dist/components/GenomeView/TrackComponents/3dmol/BigwigSource.d.ts +7 -0
  14. package/dist/components/GenomeView/TrackComponents/3dmol/CategoryLegend.d.ts +7 -0
  15. package/dist/components/GenomeView/TrackComponents/3dmol/ColorPicker.d.ts +12 -0
  16. package/dist/components/GenomeView/TrackComponents/3dmol/FrameListMenu.d.ts +6 -0
  17. package/dist/components/GenomeView/TrackComponents/3dmol/HoverInfo.d.ts +20 -0
  18. package/dist/components/GenomeView/TrackComponents/3dmol/Legend.d.ts +6 -0
  19. package/dist/components/GenomeView/TrackComponents/3dmol/ModelListMenu.d.ts +7 -0
  20. package/dist/components/GenomeView/TrackComponents/3dmol/OpacityThickness.d.ts +4 -0
  21. package/dist/components/GenomeView/TrackComponents/3dmol/ResolutionList.d.ts +8 -0
  22. package/dist/components/GenomeView/TrackComponents/3dmol/ShapeList.d.ts +10 -0
  23. package/dist/components/GenomeView/TrackComponents/3dmol/StaticLegend.d.ts +6 -0
  24. package/dist/components/GenomeView/TrackComponents/3dmol/ThreedmolContainer.d.ts +261 -0
  25. package/dist/components/GenomeView/TrackComponents/3dmol/binning.d.ts +36 -0
  26. package/dist/components/GenomeView/TrackComponents/3dmol/helpers-3dmol.d.ts +68 -0
  27. package/dist/components/GenomeView/TrackComponents/BamComponents/BamAnnotation.d.ts +45 -0
  28. package/dist/components/GenomeView/TrackComponents/CategoricalComponents/CategoricalAnnotation.d.ts +48 -0
  29. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/cacheFetchedData.d.ts +23 -0
  30. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getDataAfterConfigChange.d.ts +11 -0
  31. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getTrackPixelXOffset.d.ts +3 -0
  32. package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/trackGlobalState.d.ts +6 -0
  33. package/dist/components/GenomeView/TrackComponents/DynseqComponents/DynseqTrackComponents.d.ts +80 -0
  34. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/AlignmentCoordinate.d.ts +19 -0
  35. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/GenomeAlignComponents.d.ts +45 -0
  36. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/HorizontalFragment.d.ts +20 -0
  37. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/MultiAlignmentViewCalculator.d.ts +112 -0
  38. package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/Sequence.d.ts +39 -0
  39. package/dist/components/GenomeView/TrackComponents/GroupedTrackManager.d.ts +54 -0
  40. package/dist/components/GenomeView/TrackComponents/InteractionComponents/ArcDisplay.d.ts +37 -0
  41. package/dist/components/GenomeView/TrackComponents/InteractionComponents/CubicCurveDisplay.d.ts +22 -0
  42. package/dist/components/GenomeView/TrackComponents/InteractionComponents/Heatmap.d.ts +40 -0
  43. package/dist/components/GenomeView/TrackComponents/InteractionComponents/InteractionTrackComponent.d.ts +74 -0
  44. package/dist/components/GenomeView/TrackComponents/InteractionComponents/PixiArc.d.ts +60 -0
  45. package/dist/components/GenomeView/TrackComponents/InteractionComponents/PixiHeatmap.d.ts +78 -0
  46. package/dist/components/GenomeView/TrackComponents/InteractionComponents/SquareDisplay.d.ts +32 -0
  47. package/dist/components/GenomeView/TrackComponents/MethylcComponents/MethylCTrackComputation.d.ts +71 -0
  48. package/dist/components/GenomeView/TrackComponents/QBedComponents/QBedTrackComponents.d.ts +74 -0
  49. package/dist/components/GenomeView/TrackComponents/RulerComponents/Ruler.d.ts +17 -0
  50. package/dist/components/GenomeView/TrackComponents/RulerComponents/RulerComponent.d.ts +19 -0
  51. package/dist/components/GenomeView/TrackComponents/SnpComponents/SnpAnnotation.d.ts +17 -0
  52. package/dist/components/GenomeView/TrackComponents/SnpComponents/SnpDetail.d.ts +7 -0
  53. package/dist/components/GenomeView/TrackComponents/TrackFactory.d.ts +4 -0
  54. package/dist/components/GenomeView/TrackComponents/VcfComponents/Vcf.d.ts +22 -0
  55. package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfAnnotation.d.ts +41 -0
  56. package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfDetail.d.ts +14 -0
  57. package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfTrack.d.ts +69 -0
  58. package/dist/components/GenomeView/TrackComponents/bedComponents/BedAnnotation.d.ts +33 -0
  59. package/dist/components/GenomeView/TrackComponents/bedComponents/Bedcolor.d.ts +13 -0
  60. package/dist/components/GenomeView/TrackComponents/bedComponents/BedcolorTrack.d.ts +6 -0
  61. package/dist/components/GenomeView/TrackComponents/bedComponents/DynamicBedTrackComponents.d.ts +28 -0
  62. package/dist/components/GenomeView/TrackComponents/bedComponents/FiberAnnotation.d.ts +33 -0
  63. package/dist/components/GenomeView/TrackComponents/bedComponents/FiberTrackComponent.d.ts +90 -0
  64. package/dist/components/GenomeView/TrackComponents/commonComponents/CopyToClipboard.d.ts +11 -0
  65. package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/GenomicCoordinates.d.ts +23 -0
  66. package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/HoverToolTip.d.ts +89 -0
  67. package/dist/components/GenomeView/TrackComponents/commonComponents/MetadataIndicator.d.ts +11 -0
  68. package/dist/components/GenomeView/TrackComponents/commonComponents/OutsideClickDetector.d.ts +8 -0
  69. package/dist/components/GenomeView/TrackComponents/commonComponents/Resize.d.ts +6 -0
  70. package/dist/components/GenomeView/TrackComponents/commonComponents/TrackLegend.d.ts +39 -0
  71. package/dist/components/GenomeView/TrackComponents/commonComponents/TrackMessage.d.ts +33 -0
  72. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationArrows.d.ts +28 -0
  73. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationTrack.d.ts +25 -0
  74. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/FeatureDetail.d.ts +20 -0
  75. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/FullDisplayMode.d.ts +45 -0
  76. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/JasparDetail.d.ts +12 -0
  77. package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/PixiAnnotation.d.ts +67 -0
  78. package/dist/components/GenomeView/TrackComponents/commonComponents/art/DesignRenderer.d.ts +30 -0
  79. package/dist/components/GenomeView/TrackComponents/commonComponents/art/RulerDesigner.d.ts +102 -0
  80. package/dist/components/GenomeView/TrackComponents/commonComponents/check-obj-dupe.d.ts +8 -0
  81. package/dist/components/GenomeView/TrackComponents/commonComponents/chr-order/SortableItem.d.ts +11 -0
  82. package/dist/components/GenomeView/TrackComponents/commonComponents/chr-order/SortableTrack.d.ts +17 -0
  83. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicNumericalTrack.d.ts +37 -0
  84. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicplotTrackComponent.d.ts +80 -0
  85. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/GenomicCoordinates.d.ts +23 -0
  86. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/MatplotTrackComponent.d.ts +65 -0
  87. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalAggregator.d.ts +5 -0
  88. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalTrack.d.ts +39 -0
  89. package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/PixiScene.d.ts +66 -0
  90. package/dist/components/GenomeView/TrackComponents/commonComponents/stats/BoxplotTrackComponents.d.ts +106 -0
  91. package/dist/components/GenomeView/TrackComponents/defaultOptionsMap.d.ts +3 -0
  92. package/dist/components/GenomeView/TrackComponents/displayModeComponentMap.d.ts +9 -0
  93. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/BackgroundedText.d.ts +50 -0
  94. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneAnnotation.d.ts +33 -0
  95. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneAnnotationScaffold.d.ts +26 -0
  96. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneDetail.d.ts +19 -0
  97. package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/TranslatableG.d.ts +15 -0
  98. package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroHtmlVisualizer.d.ts +41 -0
  99. package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroSvgVisualizer.d.ts +35 -0
  100. package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroTrackComponents.d.ts +33 -0
  101. package/dist/components/GenomeView/TrackManager.d.ts +31 -0
  102. package/dist/components/GenomeView/genomeNavigator/Chromosomes.d.ts +94 -0
  103. package/dist/components/GenomeView/genomeNavigator/DragAcrossDiv.d.ts +71 -0
  104. package/dist/components/GenomeView/genomeNavigator/GeneSearchBox.d.ts +15 -0
  105. package/dist/components/GenomeView/genomeNavigator/GeneSearchBox3D.d.ts +22 -0
  106. package/dist/components/GenomeView/genomeNavigator/GeneSearchBoxBase.d.ts +18 -0
  107. package/dist/components/GenomeView/genomeNavigator/GenomeNavigator.d.ts +87 -0
  108. package/dist/components/GenomeView/genomeNavigator/IsoformSelection.d.ts +11 -0
  109. package/dist/components/GenomeView/genomeNavigator/MainPane.d.ts +68 -0
  110. package/dist/components/GenomeView/genomeNavigator/Ruler.d.ts +23 -0
  111. package/dist/components/GenomeView/genomeNavigator/SelectableGenomeArea.d.ts +34 -0
  112. package/dist/components/GenomeView/genomeNavigator/SelectedRegionBox.d.ts +48 -0
  113. package/dist/components/GenomeView/genomeNavigator/SnpSearchBox.d.ts +14 -0
  114. package/dist/components/GenomeView/genomeNavigator/TrackRegionController.d.ts +19 -0
  115. package/dist/genome-hub/GenomeHubManager.d.ts +15 -0
  116. package/dist/genome-hub/GenomeSerializer.d.ts +13 -0
  117. package/dist/genome-hub/LocalGenomeRepository.d.ts +15 -0
  118. package/dist/genome-hub/genome-schema.d.ts +198 -0
  119. package/dist/genome-hub/index.d.ts +3 -0
  120. package/dist/getLocalData/BedTextSource.d.ts +22 -0
  121. package/dist/getLocalData/LocalBigSourceGmod.d.ts +28 -0
  122. package/dist/getLocalData/LongrangeAndreaTextSource.d.ts +11 -0
  123. package/dist/getLocalData/localFetchData.d.ts +6 -0
  124. package/dist/getLocalData/localTabixSource.d.ts +50 -0
  125. package/dist/getLocalData/localTextSource.d.ts +13 -0
  126. package/dist/getRemoteData/BamSource.d.ts +10 -0
  127. package/dist/getRemoteData/BigSourceWorker.d.ts +47 -0
  128. package/dist/getRemoteData/BigSourceWorkerGmod.d.ts +25 -0
  129. package/dist/getRemoteData/GenomeInteraction.d.ts +20 -0
  130. package/dist/getRemoteData/HicDataModes.d.ts +19 -0
  131. package/dist/getRemoteData/JasparSource.d.ts +8 -0
  132. package/dist/getRemoteData/RepeatSource.d.ts +8 -0
  133. package/dist/getRemoteData/TwoBitSource.d.ts +31 -0
  134. package/dist/getRemoteData/VcfSource.d.ts +10 -0
  135. package/dist/getRemoteData/fetchDataWorker.d.ts +61 -0
  136. package/dist/getRemoteData/fetchGenomeAlignWorker.d.ts +64 -0
  137. package/dist/getRemoteData/fetchTrackData.d.ts +4 -0
  138. package/dist/getRemoteData/g3dFileV2.d.ts +15 -0
  139. package/dist/getRemoteData/hicSource.d.ts +83 -0
  140. package/dist/getRemoteData/io/browserLocalFile.d.ts +6 -0
  141. package/dist/getRemoteData/io/remoteFile.d.ts +7 -0
  142. package/dist/getRemoteData/tabixSource.d.ts +46 -0
  143. package/dist/getRemoteData/vendor/bbi-js/main/bigwig.d.ts +1 -0
  144. package/dist/getRemoteData/vendor/bbi-js/utils/bin.d.ts +1 -0
  145. package/dist/getRemoteData/vendor/bbi-js/utils/das.d.ts +6 -0
  146. package/dist/getRemoteData/vendor/bbi-js/utils/jszlib.d.ts +1 -0
  147. package/dist/getRemoteData/vendor/bbi-js/utils/sha1.d.ts +1 -0
  148. package/dist/getRemoteData/vendor/bbi-js/utils/spans.d.ts +13 -0
  149. package/dist/index-Cs2whU2f.mjs +417589 -0
  150. package/dist/index.d.ts +5 -0
  151. package/dist/index.es.js +68 -0
  152. package/dist/index.umd.js +1644 -0
  153. package/dist/init-Afno6ASC.mjs +2871 -0
  154. package/dist/models/AlignmentRecord.d.ts +20 -0
  155. package/dist/models/AlignmentSegment.d.ts +51 -0
  156. package/dist/models/AlignmentStringUtils.d.ts +73 -0
  157. package/dist/models/AppSaveLoad.d.ts +76 -0
  158. package/dist/models/BamAlignment.d.ts +81 -0
  159. package/dist/models/BamRecord.d.ts +96 -0
  160. package/dist/models/BedRecord.d.ts +13 -0
  161. package/dist/models/BinIndexer.d.ts +28 -0
  162. package/dist/models/Chromosome.d.ts +24 -0
  163. package/dist/models/ChromosomeInterval.d.ts +107 -0
  164. package/dist/models/DataHubParser.d.ts +4 -0
  165. package/dist/models/DisplayedRegionModel.d.ts +114 -0
  166. package/dist/models/DownsamplingChoices.d.ts +4 -0
  167. package/dist/models/Feature.d.ts +156 -0
  168. package/dist/models/FeatureAggregator.d.ts +67 -0
  169. package/dist/models/FeatureArranger.d.ts +48 -0
  170. package/dist/models/FeatureSegment.d.ts +63 -0
  171. package/dist/models/FlankingStrategy.d.ts +72 -0
  172. package/dist/models/Gene.d.ts +56 -0
  173. package/dist/models/Genome.d.ts +48 -0
  174. package/dist/models/GraphNode.d.ts +46 -0
  175. package/dist/models/ImageRecord.d.ts +12 -0
  176. package/dist/models/Json5Fetcher.d.ts +10 -0
  177. package/dist/models/LinearDrawingModel.d.ts +75 -0
  178. package/dist/models/LogChoices.d.ts +4 -0
  179. package/dist/models/MethylCRecord.d.ts +41 -0
  180. package/dist/models/NavContextBuilder.d.ts +17 -0
  181. package/dist/models/NavigationContext.d.ts +168 -0
  182. package/dist/models/OpenInterval.d.ts +57 -0
  183. package/dist/models/QBed.d.ts +15 -0
  184. package/dist/models/RegionExpander.d.ts +51 -0
  185. package/dist/models/RegionSet.d.ts +85 -0
  186. package/dist/models/RepeatMaskerFeature.d.ts +61 -0
  187. package/dist/models/ScaleChoices.d.ts +4 -0
  188. package/dist/models/SequenceData.d.ts +6 -0
  189. package/dist/models/Snp.d.ts +34 -0
  190. package/dist/models/SortItemsOptions.d.ts +6 -0
  191. package/dist/models/TrackModel.d.ts +142 -0
  192. package/dist/models/binning.d.ts +29 -0
  193. package/dist/models/genomes/Creinhardtii506/Creinhardtii506.d.ts +18 -0
  194. package/dist/models/genomes/CytobandTypes.d.ts +17 -0
  195. package/dist/models/genomes/GRCg7b/GRCg7b.d.ts +17 -0
  196. package/dist/models/genomes/GRCg7w/GRCg7w.d.ts +17 -0
  197. package/dist/models/genomes/GenomeConfig.d.ts +16 -0
  198. package/dist/models/genomes/allGenomes.d.ts +201 -0
  199. package/dist/models/genomes/aplCal3/aplCal3.d.ts +18 -0
  200. package/dist/models/genomes/araTha1/araTha1.d.ts +18 -0
  201. package/dist/models/genomes/bosTau8/bosTau8.d.ts +18 -0
  202. package/dist/models/genomes/brapa/brara_chiifu_v3.0.d.ts +17 -0
  203. package/dist/models/genomes/calJac3/calJac3.d.ts +17 -0
  204. package/dist/models/genomes/calJac4/calJac4.d.ts +18 -0
  205. package/dist/models/genomes/canFam2/canFam2.d.ts +16 -0
  206. package/dist/models/genomes/canFam3/canFam3.d.ts +18 -0
  207. package/dist/models/genomes/canFam6/canFam6.d.ts +18 -0
  208. package/dist/models/genomes/ce11/ce11.d.ts +18 -0
  209. package/dist/models/genomes/danRer10/danRer10.d.ts +17 -0
  210. package/dist/models/genomes/danRer10/scaffolds.d.ts +3 -0
  211. package/dist/models/genomes/danRer11/danRer11.d.ts +35 -0
  212. package/dist/models/genomes/danRer7/danRer7.d.ts +18 -0
  213. package/dist/models/genomes/dm6/dm6.d.ts +35 -0
  214. package/dist/models/genomes/galGal5/galGal5.d.ts +35 -0
  215. package/dist/models/genomes/galGal6/galGal6.d.ts +18 -0
  216. package/dist/models/genomes/gorGor3/gorGor3.d.ts +17 -0
  217. package/dist/models/genomes/gorGor4/gorGor4.d.ts +18 -0
  218. package/dist/models/genomes/hg19/hg19.d.ts +65 -0
  219. package/dist/models/genomes/hg38/hg38.d.ts +103 -0
  220. package/dist/models/genomes/lepOcu1/lepOcu1.d.ts +17 -0
  221. package/dist/models/genomes/mm10/mm10.d.ts +94 -0
  222. package/dist/models/genomes/mm39/mm39.d.ts +27 -0
  223. package/dist/models/genomes/mm9/mm9.d.ts +18 -0
  224. package/dist/models/genomes/monDom5/monDom5.d.ts +18 -0
  225. package/dist/models/genomes/nomLeu3/nomLeu3.d.ts +17 -0
  226. package/dist/models/genomes/oryCun2/oryCun2.d.ts +18 -0
  227. package/dist/models/genomes/oviAri4/oviAri4.d.ts +18 -0
  228. package/dist/models/genomes/panTro4/panTro4.d.ts +17 -0
  229. package/dist/models/genomes/panTro5/panTro5.d.ts +18 -0
  230. package/dist/models/genomes/panTro6/panTro6.d.ts +18 -0
  231. package/dist/models/genomes/papAnu2/papAnu2.d.ts +17 -0
  232. package/dist/models/genomes/pfal3d7/pfal3d7.d.ts +39 -0
  233. package/dist/models/genomes/phaw5/phaw5.d.ts +17 -0
  234. package/dist/models/genomes/rheMac10/rheMac10.d.ts +18 -0
  235. package/dist/models/genomes/rheMac2/rheMac2.d.ts +17 -0
  236. package/dist/models/genomes/rheMac3/rheMac3.d.ts +17 -0
  237. package/dist/models/genomes/rheMac8/rheMac8.d.ts +18 -0
  238. package/dist/models/genomes/rn4/rn4.d.ts +18 -0
  239. package/dist/models/genomes/rn6/rn6.d.ts +18 -0
  240. package/dist/models/genomes/rn7/rn7.d.ts +18 -0
  241. package/dist/models/genomes/sacCer3/sacCer3.d.ts +30 -0
  242. package/dist/models/genomes/susScr11/susScr11.d.ts +18 -0
  243. package/dist/models/genomes/susScr3/susScr3.d.ts +18 -0
  244. package/dist/models/genomes/t2t-chm13-v1.1/chm13.d.ts +17 -0
  245. package/dist/models/genomes/t2t-chm13-v2.0/chm13v2.d.ts +18 -0
  246. package/dist/models/genomes/trypanosome/TbruceiLister427.d.ts +32 -0
  247. package/dist/models/genomes/trypanosome/TbruceiTREU927.d.ts +32 -0
  248. package/dist/models/genomes/virus/ebola.d.ts +47 -0
  249. package/dist/models/genomes/virus/hpv16.d.ts +28 -0
  250. package/dist/models/genomes/virus/mers.d.ts +54 -0
  251. package/dist/models/genomes/virus/nCoV2019.d.ts +382 -0
  252. package/dist/models/genomes/virus/sars.d.ts +53 -0
  253. package/dist/models/genomes/xenTro10/xenTro10.d.ts +18 -0
  254. package/dist/models/getXSpan/FeaturePlacer.d.ts +86 -0
  255. package/dist/models/index.d.ts +28 -0
  256. package/dist/models/layoutUtils.d.ts +39 -0
  257. package/dist/models/trackModels/trackProps.d.ts +40 -0
  258. package/dist/models/util.d.ts +102 -0
  259. package/dist/style.css +1 -0
  260. package/dist/track-container/index.d.ts +9 -0
  261. package/dist/trackConfigs/config-menu-components.tsx/AlwaysDrawLabelConfig.d.ts +8 -0
  262. package/dist/trackConfigs/config-menu-components.tsx/ArrayAggregateConfig.d.ts +6 -0
  263. package/dist/trackConfigs/config-menu-components.tsx/BothAnchorsInViewConfig.d.ts +8 -0
  264. package/dist/trackConfigs/config-menu-components.tsx/CategoryColorConfig.d.ts +15 -0
  265. package/dist/trackConfigs/config-menu-components.tsx/ClampHeightConfig.d.ts +8 -0
  266. package/dist/trackConfigs/config-menu-components.tsx/Collapsible.d.ts +7 -0
  267. package/dist/trackConfigs/config-menu-components.tsx/ColorConfig.d.ts +102 -0
  268. package/dist/trackConfigs/config-menu-components.tsx/ColorPicker.d.ts +9 -0
  269. package/dist/trackConfigs/config-menu-components.tsx/CombineStrandConfig.d.ts +8 -0
  270. package/dist/trackConfigs/config-menu-components.tsx/DisplayModeConfig.d.ts +21 -0
  271. package/dist/trackConfigs/config-menu-components.tsx/EnsemblStyleConfig.d.ts +8 -0
  272. package/dist/trackConfigs/config-menu-components.tsx/FetchViewWindowConfig.d.ts +8 -0
  273. package/dist/trackConfigs/config-menu-components.tsx/HeightConfig.d.ts +8 -0
  274. package/dist/trackConfigs/config-menu-components.tsx/HicDataConfig.d.ts +14 -0
  275. package/dist/trackConfigs/config-menu-components.tsx/HiddenPixelsConfig.d.ts +8 -0
  276. package/dist/trackConfigs/config-menu-components.tsx/HideMinimalItemsConfig.d.ts +8 -0
  277. package/dist/trackConfigs/config-menu-components.tsx/HorizontalLineValueConfig.d.ts +8 -0
  278. package/dist/trackConfigs/config-menu-components.tsx/ItalicizeTextConfig.d.ts +8 -0
  279. package/dist/trackConfigs/config-menu-components.tsx/LabelConfig.d.ts +7 -0
  280. package/dist/trackConfigs/config-menu-components.tsx/LineWidthConfig.d.ts +8 -0
  281. package/dist/trackConfigs/config-menu-components.tsx/LogScaleConfig.d.ts +8 -0
  282. package/dist/trackConfigs/config-menu-components.tsx/MarkerSizeConfig.d.ts +8 -0
  283. package/dist/trackConfigs/config-menu-components.tsx/MaxMethylAndDepthFilterConfig.d.ts +8 -0
  284. package/dist/trackConfigs/config-menu-components.tsx/MaxRowsConfig.d.ts +8 -0
  285. package/dist/trackConfigs/config-menu-components.tsx/MaxValueFilterConfig.d.ts +8 -0
  286. package/dist/trackConfigs/config-menu-components.tsx/MethylColorConfig.d.ts +16 -0
  287. package/dist/trackConfigs/config-menu-components.tsx/MinValueFilterConfig.d.ts +8 -0
  288. package/dist/trackConfigs/config-menu-components.tsx/NumberConfig.d.ts +43 -0
  289. package/dist/trackConfigs/config-menu-components.tsx/OmeroImageHeightConfig.d.ts +8 -0
  290. package/dist/trackConfigs/config-menu-components.tsx/OpacitySilderConfig.d.ts +8 -0
  291. package/dist/trackConfigs/config-menu-components.tsx/PixelsPaddingConfig.d.ts +8 -0
  292. package/dist/trackConfigs/config-menu-components.tsx/PlayingConfig.d.ts +8 -0
  293. package/dist/trackConfigs/config-menu-components.tsx/RowHeightConfig.d.ts +8 -0
  294. package/dist/trackConfigs/config-menu-components.tsx/ScalePercentileConfig.d.ts +8 -0
  295. package/dist/trackConfigs/config-menu-components.tsx/ScoreConfig.d.ts +8 -0
  296. package/dist/trackConfigs/config-menu-components.tsx/SelectConfig.d.ts +11 -0
  297. package/dist/trackConfigs/config-menu-components.tsx/ShowHorizontalLineConfig.d.ts +8 -0
  298. package/dist/trackConfigs/config-menu-components.tsx/SingleInputConfig.d.ts +14 -0
  299. package/dist/trackConfigs/config-menu-components.tsx/SliderConfig.d.ts +51 -0
  300. package/dist/trackConfigs/config-menu-components.tsx/SmoothConfig.d.ts +8 -0
  301. package/dist/trackConfigs/config-menu-components.tsx/SortItemsConfig.d.ts +2 -0
  302. package/dist/trackConfigs/config-menu-components.tsx/SpeedConfig.d.ts +8 -0
  303. package/dist/trackConfigs/config-menu-components.tsx/TrackConfigMenu.d.ts +2 -0
  304. package/dist/trackConfigs/config-menu-components.tsx/TrackContextMenu.d.ts +6 -0
  305. package/dist/trackConfigs/config-menu-components.tsx/UseDynamicColorsConfig.d.ts +8 -0
  306. package/dist/trackConfigs/config-menu-components.tsx/WindowSizeConfig.d.ts +8 -0
  307. package/dist/trackConfigs/config-menu-components.tsx/YscaleConfig.d.ts +8 -0
  308. package/dist/trackConfigs/config-menu-models.tsx/AggregateConfig.d.ts +6 -0
  309. package/dist/trackConfigs/config-menu-models.tsx/AnnotationTrackConfig.d.ts +16 -0
  310. package/dist/trackConfigs/config-menu-models.tsx/BamTrackConfig.d.ts +6 -0
  311. package/dist/trackConfigs/config-menu-models.tsx/BedGraphTrackConfig.d.ts +3 -0
  312. package/dist/trackConfigs/config-menu-models.tsx/BedTrackConfig.d.ts +10 -0
  313. package/dist/trackConfigs/config-menu-models.tsx/BedcolorTrackConfig.d.ts +4 -0
  314. package/dist/trackConfigs/config-menu-models.tsx/BigBedTrackConfig.d.ts +4 -0
  315. package/dist/trackConfigs/config-menu-models.tsx/BigInteractTrackConfig.d.ts +12 -0
  316. package/dist/trackConfigs/config-menu-models.tsx/BigWigTrackConfig.d.ts +7 -0
  317. package/dist/trackConfigs/config-menu-models.tsx/BoxplotTrackConfig.d.ts +8 -0
  318. package/dist/trackConfigs/config-menu-models.tsx/CategoricalTrackConfig.d.ts +12 -0
  319. package/dist/trackConfigs/config-menu-models.tsx/DisplayModes.d.ts +49 -0
  320. package/dist/trackConfigs/config-menu-models.tsx/DynamicBedGraphTrackConfig.d.ts +5 -0
  321. package/dist/trackConfigs/config-menu-models.tsx/DynamicBedTrackConfig.d.ts +5 -0
  322. package/dist/trackConfigs/config-menu-models.tsx/DynamicHicTrackConfig.d.ts +5 -0
  323. package/dist/trackConfigs/config-menu-models.tsx/DynamicLongrangeTrackConfig.d.ts +5 -0
  324. package/dist/trackConfigs/config-menu-models.tsx/DynamicplotTrackConfig.d.ts +4 -0
  325. package/dist/trackConfigs/config-menu-models.tsx/DynseqTrackConfig.d.ts +7 -0
  326. package/dist/trackConfigs/config-menu-models.tsx/FiberTrackConfig.d.ts +4 -0
  327. package/dist/trackConfigs/config-menu-models.tsx/GeneAnnotationTrackConfig.d.ts +4 -0
  328. package/dist/trackConfigs/config-menu-models.tsx/GenomeAlignTrackConfig.d.ts +4 -0
  329. package/dist/trackConfigs/config-menu-models.tsx/HicTrackConfig.d.ts +7 -0
  330. package/dist/trackConfigs/config-menu-models.tsx/JasparTrackConfig.d.ts +4 -0
  331. package/dist/trackConfigs/config-menu-models.tsx/LongRangeTrackConfig.d.ts +6 -0
  332. package/dist/trackConfigs/config-menu-models.tsx/MatplotTrackConfig.d.ts +4 -0
  333. package/dist/trackConfigs/config-menu-models.tsx/MethylCTrackConfig.d.ts +4 -0
  334. package/dist/trackConfigs/config-menu-models.tsx/NumericalTrackConfig.d.ts +4 -0
  335. package/dist/trackConfigs/config-menu-models.tsx/OmeroTrackConfig.d.ts +5 -0
  336. package/dist/trackConfigs/config-menu-models.tsx/OmeroidrTrackConfig.d.ts +5 -0
  337. package/dist/trackConfigs/config-menu-models.tsx/QBedTrackConfig.d.ts +4 -0
  338. package/dist/trackConfigs/config-menu-models.tsx/RefBedTrackConfig.d.ts +4 -0
  339. package/dist/trackConfigs/config-menu-models.tsx/RepeatMaskerTrackConfig.d.ts +4 -0
  340. package/dist/trackConfigs/config-menu-models.tsx/RulerTrackConfig.d.ts +4 -0
  341. package/dist/trackConfigs/config-menu-models.tsx/SnpTrackConfig.d.ts +4 -0
  342. package/dist/trackConfigs/config-menu-models.tsx/TrackConfig.d.ts +11 -0
  343. package/dist/trackConfigs/config-menu-models.tsx/VcfTrackConfig.d.ts +5 -0
  344. package/dist/trackConfigs/config-menu-models.tsx/aggregateOptions.d.ts +12 -0
  345. package/dist/trackConfigs/config-menu-models.tsx/getTrackConfig.d.ts +76 -0
  346. package/dist/types/genome-hub.d.ts +24 -0
  347. package/dist/types/index.d.ts +2 -0
  348. package/dist/types/track-container.d.ts +99 -0
  349. package/dist/webworkerAll-CTtTToDi.mjs +2 -0
  350. package/package.json +104 -0
@@ -0,0 +1,2624 @@
1
+ import { E as d, B, w as m, D as S, K, u as Be, s as U, t as b, a3 as Ae, j as $, S as p, O as H, i as A, h as N, k as F, q as z, M as Y, a4 as q, a5 as Ne, a6 as ye, a7 as Z, a8 as De, A as Ce, R as Ie, e as x } from "./index-Cs2whU2f.mjs";
2
+ import { S as O, b as Q } from "./colorToUniform-BcHZBaJ_.mjs";
3
+ import { e as Ge, G as Ue, c as Fe, b as Oe, U as Pe, R as Me, B as J, d as y, f as Le, S as He, a as we } from "./SharedSystems-BNa57PRW.mjs";
4
+ class ee {
5
+ constructor() {
6
+ this._tempState = O.for2d(), this._didUploadHash = {};
7
+ }
8
+ init(e) {
9
+ e.renderer.runners.contextChange.add(this);
10
+ }
11
+ contextChange() {
12
+ this._didUploadHash = {};
13
+ }
14
+ start(e, r, s) {
15
+ const n = e.renderer, i = this._didUploadHash[s.uid];
16
+ n.shader.bind(s, i), i || (this._didUploadHash[s.uid] = !0), n.shader.updateUniformGroup(n.globalUniforms.uniformGroup), n.geometry.bind(r, s.glProgram);
17
+ }
18
+ execute(e, r) {
19
+ const s = e.renderer;
20
+ this._tempState.blendMode = r.blendMode, s.state.set(this._tempState);
21
+ const n = r.textures.textures;
22
+ for (let i = 0; i < r.textures.count; i++)
23
+ s.texture.bind(n[i], i);
24
+ s.geometry.draw(r.topology, r.size, r.start);
25
+ }
26
+ }
27
+ ee.extension = {
28
+ type: [
29
+ d.WebGLPipesAdaptor
30
+ ],
31
+ name: "batch"
32
+ };
33
+ var v = /* @__PURE__ */ ((t) => (t[t.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER", t[t.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER", t[t.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER", t))(v || {});
34
+ class Ve {
35
+ constructor(e, r) {
36
+ this._lastBindBaseLocation = -1, this._lastBindCallId = -1, this.buffer = e || null, this.updateID = -1, this.byteLength = -1, this.type = r;
37
+ }
38
+ }
39
+ class te {
40
+ /**
41
+ * @param {Renderer} renderer - The renderer this System works for.
42
+ */
43
+ constructor(e) {
44
+ this._gpuBuffers = /* @__PURE__ */ Object.create(null), this._boundBufferBases = /* @__PURE__ */ Object.create(null), this._minBaseLocation = 0, this._nextBindBaseIndex = this._minBaseLocation, this._bindCallId = 0, this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_gpuBuffers");
45
+ }
46
+ /**
47
+ * @ignore
48
+ */
49
+ destroy() {
50
+ this._renderer = null, this._gl = null, this._gpuBuffers = null, this._boundBufferBases = null;
51
+ }
52
+ /** Sets up the renderer context and necessary buffers. */
53
+ contextChange() {
54
+ const e = this._gl = this._renderer.gl;
55
+ this._gpuBuffers = /* @__PURE__ */ Object.create(null), this._maxBindings = e.MAX_UNIFORM_BUFFER_BINDINGS ? e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS) : 0;
56
+ }
57
+ getGlBuffer(e) {
58
+ return this._gpuBuffers[e.uid] || this.createGLBuffer(e);
59
+ }
60
+ /**
61
+ * This binds specified buffer. On first run, it will create the webGL buffers for the context too
62
+ * @param buffer - the buffer to bind to the renderer
63
+ */
64
+ bind(e) {
65
+ const { _gl: r } = this, s = this.getGlBuffer(e);
66
+ r.bindBuffer(s.type, s.buffer);
67
+ }
68
+ /**
69
+ * Binds an uniform buffer to at the given index.
70
+ *
71
+ * A cache is used so a buffer will not be bound again if already bound.
72
+ * @param glBuffer - the buffer to bind
73
+ * @param index - the base index to bind it to.
74
+ */
75
+ bindBufferBase(e, r) {
76
+ const { _gl: s } = this;
77
+ this._boundBufferBases[r] !== e && (this._boundBufferBases[r] = e, e._lastBindBaseLocation = r, s.bindBufferBase(s.UNIFORM_BUFFER, r, e.buffer));
78
+ }
79
+ nextBindBase(e) {
80
+ this._bindCallId++, this._minBaseLocation = 0, e && (this._boundBufferBases[0] = null, this._minBaseLocation = 1, this._nextBindBaseIndex < 1 && (this._nextBindBaseIndex = 1));
81
+ }
82
+ freeLocationForBufferBase(e) {
83
+ let r = this.getLastBindBaseLocation(e);
84
+ if (r >= this._minBaseLocation)
85
+ return e._lastBindCallId = this._bindCallId, r;
86
+ let s = 0, n = this._nextBindBaseIndex;
87
+ for (; s < 2; ) {
88
+ n >= this._maxBindings && (n = this._minBaseLocation, s++);
89
+ const i = this._boundBufferBases[n];
90
+ if (i && i._lastBindCallId === this._bindCallId) {
91
+ n++;
92
+ continue;
93
+ }
94
+ break;
95
+ }
96
+ return r = n, this._nextBindBaseIndex = n + 1, s >= 2 ? -1 : (e._lastBindCallId = this._bindCallId, this._boundBufferBases[r] = null, r);
97
+ }
98
+ getLastBindBaseLocation(e) {
99
+ const r = e._lastBindBaseLocation;
100
+ return this._boundBufferBases[r] === e ? r : -1;
101
+ }
102
+ /**
103
+ * Binds a buffer whilst also binding its range.
104
+ * This will make the buffer start from the offset supplied rather than 0 when it is read.
105
+ * @param glBuffer - the buffer to bind
106
+ * @param index - the base index to bind at, defaults to 0
107
+ * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc
108
+ * @param size - the size to bind at (this is blocks of 256).
109
+ */
110
+ bindBufferRange(e, r, s, n) {
111
+ const { _gl: i } = this;
112
+ s || (s = 0), r || (r = 0), this._boundBufferBases[r] = null, i.bindBufferRange(i.UNIFORM_BUFFER, r || 0, e.buffer, s * 256, n || 256);
113
+ }
114
+ /**
115
+ * Will ensure the data in the buffer is uploaded to the GPU.
116
+ * @param {Buffer} buffer - the buffer to update
117
+ */
118
+ updateBuffer(e) {
119
+ const { _gl: r } = this, s = this.getGlBuffer(e);
120
+ if (e._updateID === s.updateID)
121
+ return s;
122
+ s.updateID = e._updateID, r.bindBuffer(s.type, s.buffer);
123
+ const n = e.data, i = e.descriptor.usage & B.STATIC ? r.STATIC_DRAW : r.DYNAMIC_DRAW;
124
+ return n ? s.byteLength >= n.byteLength ? r.bufferSubData(s.type, 0, n, 0, e._updateSize / n.BYTES_PER_ELEMENT) : (s.byteLength = n.byteLength, r.bufferData(s.type, n, i)) : (s.byteLength = e.descriptor.size, r.bufferData(s.type, s.byteLength, i)), s;
125
+ }
126
+ /** dispose all WebGL resources of all managed buffers */
127
+ destroyAll() {
128
+ const e = this._gl;
129
+ for (const r in this._gpuBuffers)
130
+ e.deleteBuffer(this._gpuBuffers[r].buffer);
131
+ this._gpuBuffers = /* @__PURE__ */ Object.create(null);
132
+ }
133
+ /**
134
+ * Disposes buffer
135
+ * @param {Buffer} buffer - buffer with data
136
+ * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray
137
+ */
138
+ onBufferDestroy(e, r) {
139
+ const s = this._gpuBuffers[e.uid], n = this._gl;
140
+ r || n.deleteBuffer(s.buffer), this._gpuBuffers[e.uid] = null;
141
+ }
142
+ /**
143
+ * creates and attaches a GLBuffer object tied to the current context.
144
+ * @param buffer
145
+ * @protected
146
+ */
147
+ createGLBuffer(e) {
148
+ const { _gl: r } = this;
149
+ let s = v.ARRAY_BUFFER;
150
+ e.descriptor.usage & B.INDEX ? s = v.ELEMENT_ARRAY_BUFFER : e.descriptor.usage & B.UNIFORM && (s = v.UNIFORM_BUFFER);
151
+ const n = new Ve(r.createBuffer(), s);
152
+ return this._gpuBuffers[e.uid] = n, e.on("destroy", this.onBufferDestroy, this), n;
153
+ }
154
+ resetState() {
155
+ this._boundBufferBases = /* @__PURE__ */ Object.create(null);
156
+ }
157
+ }
158
+ te.extension = {
159
+ type: [
160
+ d.WebGLSystem
161
+ ],
162
+ name: "buffer"
163
+ };
164
+ const P = class re {
165
+ /** @param renderer - The renderer this System works for. */
166
+ constructor(e) {
167
+ this.supports = {
168
+ /** Support for 32-bit indices buffer. */
169
+ uint32Indices: !0,
170
+ /** Support for UniformBufferObjects */
171
+ uniformBufferObject: !0,
172
+ /** Support for VertexArrayObjects */
173
+ vertexArrayObject: !0,
174
+ /** Support for SRGB texture format */
175
+ srgbTextures: !0,
176
+ /** Support for wrapping modes if a texture is non-power of two */
177
+ nonPowOf2wrapping: !0,
178
+ /** Support for MSAA (antialiasing of dynamic textures) */
179
+ msaa: !0,
180
+ /** Support for mipmaps if a texture is non-power of two */
181
+ nonPowOf2mipmaps: !0
182
+ }, this._renderer = e, this.extensions = /* @__PURE__ */ Object.create(null), this.handleContextLost = this.handleContextLost.bind(this), this.handleContextRestored = this.handleContextRestored.bind(this);
183
+ }
184
+ /**
185
+ * `true` if the context is lost
186
+ * @readonly
187
+ */
188
+ get isLost() {
189
+ return !this.gl || this.gl.isContextLost();
190
+ }
191
+ /**
192
+ * Handles the context change event.
193
+ * @param {WebGLRenderingContext} gl - New WebGL context.
194
+ */
195
+ contextChange(e) {
196
+ this.gl = e, this._renderer.gl = e;
197
+ }
198
+ init(e) {
199
+ e = { ...re.defaultOptions, ...e };
200
+ let r = this.multiView = e.multiView;
201
+ if (e.context && r && (m("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."), r = !1), r ? this.canvas = S.get().createCanvas(this._renderer.canvas.width, this._renderer.canvas.height) : this.canvas = this._renderer.view.canvas, e.context)
202
+ this.initFromContext(e.context);
203
+ else {
204
+ const s = this._renderer.background.alpha < 1, n = e.premultipliedAlpha ?? !0, i = e.antialias && !this._renderer.backBuffer.useBackBuffer;
205
+ this.createContext(e.preferWebGLVersion, {
206
+ alpha: s,
207
+ premultipliedAlpha: n,
208
+ antialias: i,
209
+ stencil: !0,
210
+ preserveDrawingBuffer: e.preserveDrawingBuffer,
211
+ powerPreference: e.powerPreference ?? "default"
212
+ });
213
+ }
214
+ }
215
+ ensureCanvasSize(e) {
216
+ if (!this.multiView) {
217
+ e !== this.canvas && m("multiView is disabled, but targetCanvas is not the main canvas");
218
+ return;
219
+ }
220
+ const { canvas: r } = this;
221
+ (r.width < e.width || r.height < e.height) && (r.width = Math.max(e.width, e.width), r.height = Math.max(e.height, e.height));
222
+ }
223
+ /**
224
+ * Initializes the context.
225
+ * @protected
226
+ * @param {WebGLRenderingContext} gl - WebGL context
227
+ */
228
+ initFromContext(e) {
229
+ this.gl = e, this.webGLVersion = e instanceof S.get().getWebGLRenderingContext() ? 1 : 2, this.getExtensions(), this.validateContext(e), this._renderer.runners.contextChange.emit(e);
230
+ const r = this._renderer.view.canvas;
231
+ r.addEventListener("webglcontextlost", this.handleContextLost, !1), r.addEventListener("webglcontextrestored", this.handleContextRestored, !1);
232
+ }
233
+ /**
234
+ * Initialize from context options
235
+ * @protected
236
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
237
+ * @param preferWebGLVersion
238
+ * @param {object} options - context attributes
239
+ */
240
+ createContext(e, r) {
241
+ let s;
242
+ const n = this.canvas;
243
+ if (e === 2 && (s = n.getContext("webgl2", r)), !s && (s = n.getContext("webgl", r), !s))
244
+ throw new Error("This browser does not support WebGL. Try using the canvas renderer");
245
+ this.gl = s, this.initFromContext(this.gl);
246
+ }
247
+ /** Auto-populate the {@link GlContextSystem.extensions extensions}. */
248
+ getExtensions() {
249
+ const { gl: e } = this, r = {
250
+ anisotropicFiltering: e.getExtension("EXT_texture_filter_anisotropic"),
251
+ floatTextureLinear: e.getExtension("OES_texture_float_linear"),
252
+ s3tc: e.getExtension("WEBGL_compressed_texture_s3tc"),
253
+ s3tc_sRGB: e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
254
+ // eslint-disable-line camelcase
255
+ etc: e.getExtension("WEBGL_compressed_texture_etc"),
256
+ etc1: e.getExtension("WEBGL_compressed_texture_etc1"),
257
+ pvrtc: e.getExtension("WEBGL_compressed_texture_pvrtc") || e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
258
+ atc: e.getExtension("WEBGL_compressed_texture_atc"),
259
+ astc: e.getExtension("WEBGL_compressed_texture_astc"),
260
+ bptc: e.getExtension("EXT_texture_compression_bptc"),
261
+ rgtc: e.getExtension("EXT_texture_compression_rgtc"),
262
+ loseContext: e.getExtension("WEBGL_lose_context")
263
+ };
264
+ if (this.webGLVersion === 1)
265
+ this.extensions = {
266
+ ...r,
267
+ drawBuffers: e.getExtension("WEBGL_draw_buffers"),
268
+ depthTexture: e.getExtension("WEBGL_depth_texture"),
269
+ vertexArrayObject: e.getExtension("OES_vertex_array_object") || e.getExtension("MOZ_OES_vertex_array_object") || e.getExtension("WEBKIT_OES_vertex_array_object"),
270
+ uint32ElementIndex: e.getExtension("OES_element_index_uint"),
271
+ // Floats and half-floats
272
+ floatTexture: e.getExtension("OES_texture_float"),
273
+ floatTextureLinear: e.getExtension("OES_texture_float_linear"),
274
+ textureHalfFloat: e.getExtension("OES_texture_half_float"),
275
+ textureHalfFloatLinear: e.getExtension("OES_texture_half_float_linear"),
276
+ vertexAttribDivisorANGLE: e.getExtension("ANGLE_instanced_arrays"),
277
+ srgb: e.getExtension("EXT_sRGB")
278
+ };
279
+ else {
280
+ this.extensions = {
281
+ ...r,
282
+ colorBufferFloat: e.getExtension("EXT_color_buffer_float")
283
+ };
284
+ const s = e.getExtension("WEBGL_provoking_vertex");
285
+ s && s.provokingVertexWEBGL(s.FIRST_VERTEX_CONVENTION_WEBGL);
286
+ }
287
+ }
288
+ /**
289
+ * Handles a lost webgl context
290
+ * @param {WebGLContextEvent} event - The context lost event.
291
+ */
292
+ handleContextLost(e) {
293
+ e.preventDefault(), this._contextLossForced && (this._contextLossForced = !1, setTimeout(() => {
294
+ var r;
295
+ this.gl.isContextLost() && ((r = this.extensions.loseContext) == null || r.restoreContext());
296
+ }, 0));
297
+ }
298
+ /** Handles a restored webgl context. */
299
+ handleContextRestored() {
300
+ this.getExtensions(), this._renderer.runners.contextChange.emit(this.gl);
301
+ }
302
+ destroy() {
303
+ var r;
304
+ const e = this._renderer.view.canvas;
305
+ this._renderer = null, e.removeEventListener("webglcontextlost", this.handleContextLost), e.removeEventListener("webglcontextrestored", this.handleContextRestored), this.gl.useProgram(null), (r = this.extensions.loseContext) == null || r.loseContext();
306
+ }
307
+ /**
308
+ * this function can be called to force a webGL context loss
309
+ * this will release all resources on the GPU.
310
+ * Useful if you need to put Pixi to sleep, and save some GPU memory
311
+ *
312
+ * As soon as render is called - all resources will be created again.
313
+ */
314
+ forceContextLoss() {
315
+ var e;
316
+ (e = this.extensions.loseContext) == null || e.loseContext(), this._contextLossForced = !0;
317
+ }
318
+ /**
319
+ * Validate context.
320
+ * @param {WebGLRenderingContext} gl - Render context.
321
+ */
322
+ validateContext(e) {
323
+ const r = e.getContextAttributes();
324
+ r && !r.stencil && m("Provided WebGL context does not have a stencil buffer, masks may not render correctly");
325
+ const s = this.supports, n = this.webGLVersion === 2, i = this.extensions;
326
+ s.uint32Indices = n || !!i.uint32ElementIndex, s.uniformBufferObject = n, s.vertexArrayObject = n || !!i.vertexArrayObject, s.srgbTextures = n || !!i.srgb, s.nonPowOf2wrapping = n, s.nonPowOf2mipmaps = n, s.msaa = n, s.uint32Indices || m("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly");
327
+ }
328
+ };
329
+ P.extension = {
330
+ type: [
331
+ d.WebGLSystem
332
+ ],
333
+ name: "context"
334
+ };
335
+ P.defaultOptions = {
336
+ /**
337
+ * {@link WebGLOptions.context}
338
+ * @default null
339
+ */
340
+ context: null,
341
+ /**
342
+ * {@link WebGLOptions.premultipliedAlpha}
343
+ * @default true
344
+ */
345
+ premultipliedAlpha: !0,
346
+ /**
347
+ * {@link WebGLOptions.preserveDrawingBuffer}
348
+ * @default false
349
+ */
350
+ preserveDrawingBuffer: !1,
351
+ /**
352
+ * {@link WebGLOptions.powerPreference}
353
+ * @default default
354
+ */
355
+ powerPreference: void 0,
356
+ /**
357
+ * {@link WebGLOptions.webGLVersion}
358
+ * @default 2
359
+ */
360
+ preferWebGLVersion: 2,
361
+ /**
362
+ * {@link WebGLOptions.multiView}
363
+ * @default false
364
+ */
365
+ multiView: !1
366
+ };
367
+ let ke = P;
368
+ var I = /* @__PURE__ */ ((t) => (t[t.RGBA = 6408] = "RGBA", t[t.RGB = 6407] = "RGB", t[t.RG = 33319] = "RG", t[t.RED = 6403] = "RED", t[t.RGBA_INTEGER = 36249] = "RGBA_INTEGER", t[t.RGB_INTEGER = 36248] = "RGB_INTEGER", t[t.RG_INTEGER = 33320] = "RG_INTEGER", t[t.RED_INTEGER = 36244] = "RED_INTEGER", t[t.ALPHA = 6406] = "ALPHA", t[t.LUMINANCE = 6409] = "LUMINANCE", t[t.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA", t[t.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT", t[t.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", t))(I || {}), se = /* @__PURE__ */ ((t) => (t[t.TEXTURE_2D = 3553] = "TEXTURE_2D", t[t.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP", t[t.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY", t[t.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X", t[t.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X", t[t.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y", t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y", t[t.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z", t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z", t))(se || {}), f = /* @__PURE__ */ ((t) => (t[t.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE", t[t.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT", t[t.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5", t[t.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4", t[t.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1", t[t.UNSIGNED_INT = 5125] = "UNSIGNED_INT", t[t.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV", t[t.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV", t[t.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8", t[t.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV", t[t.BYTE = 5120] = "BYTE", t[t.SHORT = 5122] = "SHORT", t[t.INT = 5124] = "INT", t[t.FLOAT = 5126] = "FLOAT", t[t.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV", t[t.HALF_FLOAT = 36193] = "HALF_FLOAT", t))(f || {});
369
+ const w = {
370
+ uint8x2: f.UNSIGNED_BYTE,
371
+ uint8x4: f.UNSIGNED_BYTE,
372
+ sint8x2: f.BYTE,
373
+ sint8x4: f.BYTE,
374
+ unorm8x2: f.UNSIGNED_BYTE,
375
+ unorm8x4: f.UNSIGNED_BYTE,
376
+ snorm8x2: f.BYTE,
377
+ snorm8x4: f.BYTE,
378
+ uint16x2: f.UNSIGNED_SHORT,
379
+ uint16x4: f.UNSIGNED_SHORT,
380
+ sint16x2: f.SHORT,
381
+ sint16x4: f.SHORT,
382
+ unorm16x2: f.UNSIGNED_SHORT,
383
+ unorm16x4: f.UNSIGNED_SHORT,
384
+ snorm16x2: f.SHORT,
385
+ snorm16x4: f.SHORT,
386
+ float16x2: f.HALF_FLOAT,
387
+ float16x4: f.HALF_FLOAT,
388
+ float32: f.FLOAT,
389
+ float32x2: f.FLOAT,
390
+ float32x3: f.FLOAT,
391
+ float32x4: f.FLOAT,
392
+ uint32: f.UNSIGNED_INT,
393
+ uint32x2: f.UNSIGNED_INT,
394
+ uint32x3: f.UNSIGNED_INT,
395
+ uint32x4: f.UNSIGNED_INT,
396
+ sint32: f.INT,
397
+ sint32x2: f.INT,
398
+ sint32x3: f.INT,
399
+ sint32x4: f.INT
400
+ };
401
+ function Xe(t) {
402
+ return w[t] ?? w.float32;
403
+ }
404
+ const We = {
405
+ "point-list": 0,
406
+ "line-list": 1,
407
+ "line-strip": 3,
408
+ "triangle-list": 4,
409
+ "triangle-strip": 5
410
+ };
411
+ class ne {
412
+ /** @param renderer - The renderer this System works for. */
413
+ constructor(e) {
414
+ this._geometryVaoHash = /* @__PURE__ */ Object.create(null), this._renderer = e, this._activeGeometry = null, this._activeVao = null, this.hasVao = !0, this.hasInstance = !0, this._renderer.renderableGC.addManagedHash(this, "_geometryVaoHash");
415
+ }
416
+ /** Sets up the renderer context and necessary buffers. */
417
+ contextChange() {
418
+ const e = this.gl = this._renderer.gl;
419
+ if (!this._renderer.context.supports.vertexArrayObject)
420
+ throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");
421
+ const r = this._renderer.context.extensions.vertexArrayObject;
422
+ r && (e.createVertexArray = () => r.createVertexArrayOES(), e.bindVertexArray = (n) => r.bindVertexArrayOES(n), e.deleteVertexArray = (n) => r.deleteVertexArrayOES(n));
423
+ const s = this._renderer.context.extensions.vertexAttribDivisorANGLE;
424
+ s && (e.drawArraysInstanced = (n, i, a, o) => {
425
+ s.drawArraysInstancedANGLE(n, i, a, o);
426
+ }, e.drawElementsInstanced = (n, i, a, o, c) => {
427
+ s.drawElementsInstancedANGLE(n, i, a, o, c);
428
+ }, e.vertexAttribDivisor = (n, i) => s.vertexAttribDivisorANGLE(n, i)), this._activeGeometry = null, this._activeVao = null, this._geometryVaoHash = /* @__PURE__ */ Object.create(null);
429
+ }
430
+ /**
431
+ * Binds geometry so that is can be drawn. Creating a Vao if required
432
+ * @param geometry - Instance of geometry to bind.
433
+ * @param program - Instance of program to use vao for.
434
+ */
435
+ bind(e, r) {
436
+ const s = this.gl;
437
+ this._activeGeometry = e;
438
+ const n = this.getVao(e, r);
439
+ this._activeVao !== n && (this._activeVao = n, s.bindVertexArray(n)), this.updateBuffers();
440
+ }
441
+ /** Reset and unbind any active VAO and geometry. */
442
+ resetState() {
443
+ this.unbind();
444
+ }
445
+ /** Update buffers of the currently bound geometry. */
446
+ updateBuffers() {
447
+ const e = this._activeGeometry, r = this._renderer.buffer;
448
+ for (let s = 0; s < e.buffers.length; s++) {
449
+ const n = e.buffers[s];
450
+ r.updateBuffer(n);
451
+ }
452
+ }
453
+ /**
454
+ * Check compatibility between a geometry and a program
455
+ * @param geometry - Geometry instance.
456
+ * @param program - Program instance.
457
+ */
458
+ checkCompatibility(e, r) {
459
+ const s = e.attributes, n = r._attributeData;
460
+ for (const i in n)
461
+ if (!s[i])
462
+ throw new Error(`shader and geometry incompatible, geometry missing the "${i}" attribute`);
463
+ }
464
+ /**
465
+ * Takes a geometry and program and generates a unique signature for them.
466
+ * @param geometry - To get signature from.
467
+ * @param program - To test geometry against.
468
+ * @returns - Unique signature of the geometry and program
469
+ */
470
+ getSignature(e, r) {
471
+ const s = e.attributes, n = r._attributeData, i = ["g", e.uid];
472
+ for (const a in s)
473
+ n[a] && i.push(a, n[a].location);
474
+ return i.join("-");
475
+ }
476
+ getVao(e, r) {
477
+ var s;
478
+ return ((s = this._geometryVaoHash[e.uid]) == null ? void 0 : s[r._key]) || this.initGeometryVao(e, r);
479
+ }
480
+ /**
481
+ * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.
482
+ * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the
483
+ * attribute locations.
484
+ * @param geometry - Instance of geometry to to generate Vao for.
485
+ * @param program
486
+ * @param _incRefCount - Increment refCount of all geometry buffers.
487
+ */
488
+ initGeometryVao(e, r, s = !0) {
489
+ const n = this._renderer.gl, i = this._renderer.buffer;
490
+ this._renderer.shader._getProgramData(r), this.checkCompatibility(e, r);
491
+ const a = this.getSignature(e, r);
492
+ this._geometryVaoHash[e.uid] || (this._geometryVaoHash[e.uid] = /* @__PURE__ */ Object.create(null), e.on("destroy", this.onGeometryDestroy, this));
493
+ const o = this._geometryVaoHash[e.uid];
494
+ let c = o[a];
495
+ if (c)
496
+ return o[r._key] = c, c;
497
+ Ge(e, r._attributeData);
498
+ const u = e.buffers;
499
+ c = n.createVertexArray(), n.bindVertexArray(c);
500
+ for (let _ = 0; _ < u.length; _++) {
501
+ const h = u[_];
502
+ i.bind(h);
503
+ }
504
+ return this.activateVao(e, r), o[r._key] = c, o[a] = c, n.bindVertexArray(null), c;
505
+ }
506
+ /**
507
+ * Disposes geometry.
508
+ * @param geometry - Geometry with buffers. Only VAO will be disposed
509
+ * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray
510
+ */
511
+ onGeometryDestroy(e, r) {
512
+ const s = this._geometryVaoHash[e.uid], n = this.gl;
513
+ if (s) {
514
+ if (r)
515
+ for (const i in s)
516
+ this._activeVao !== s[i] && this.unbind(), n.deleteVertexArray(s[i]);
517
+ this._geometryVaoHash[e.uid] = null;
518
+ }
519
+ }
520
+ /**
521
+ * Dispose all WebGL resources of all managed geometries.
522
+ * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls
523
+ */
524
+ destroyAll(e = !1) {
525
+ const r = this.gl;
526
+ for (const s in this._geometryVaoHash) {
527
+ if (e)
528
+ for (const n in this._geometryVaoHash[s]) {
529
+ const i = this._geometryVaoHash[s];
530
+ this._activeVao !== i && this.unbind(), r.deleteVertexArray(i[n]);
531
+ }
532
+ this._geometryVaoHash[s] = null;
533
+ }
534
+ }
535
+ /**
536
+ * Activate vertex array object.
537
+ * @param geometry - Geometry instance.
538
+ * @param program - Shader program instance.
539
+ */
540
+ activateVao(e, r) {
541
+ var o;
542
+ const s = this._renderer.gl, n = this._renderer.buffer, i = e.attributes;
543
+ e.indexBuffer && n.bind(e.indexBuffer);
544
+ let a = null;
545
+ for (const c in i) {
546
+ const u = i[c], _ = u.buffer, h = n.getGlBuffer(_), l = r._attributeData[c];
547
+ if (l) {
548
+ a !== h && (n.bind(_), a = h);
549
+ const E = l.location;
550
+ s.enableVertexAttribArray(E);
551
+ const T = K(u.format), L = Xe(u.format);
552
+ if (((o = l.format) == null ? void 0 : o.substring(1, 4)) === "int" ? s.vertexAttribIPointer(
553
+ E,
554
+ T.size,
555
+ L,
556
+ u.stride,
557
+ u.offset
558
+ ) : s.vertexAttribPointer(
559
+ E,
560
+ T.size,
561
+ L,
562
+ T.normalised,
563
+ u.stride,
564
+ u.offset
565
+ ), u.instance)
566
+ if (this.hasInstance) {
567
+ const Te = u.divisor ?? 1;
568
+ s.vertexAttribDivisor(E, Te);
569
+ } else
570
+ throw new Error("geometry error, GPU Instancing is not supported on this device");
571
+ }
572
+ }
573
+ }
574
+ /**
575
+ * Draws the currently bound geometry.
576
+ * @param topology - The type primitive to render.
577
+ * @param size - The number of elements to be rendered. If not specified, all vertices after the
578
+ * starting vertex will be drawn.
579
+ * @param start - The starting vertex in the geometry to start drawing from. If not specified,
580
+ * drawing will start from the first vertex.
581
+ * @param instanceCount - The number of instances of the set of elements to execute. If not specified,
582
+ * all instances will be drawn.
583
+ */
584
+ draw(e, r, s, n) {
585
+ const { gl: i } = this._renderer, a = this._activeGeometry, o = We[e || a.topology];
586
+ if (n ?? (n = a.instanceCount), a.indexBuffer) {
587
+ const c = a.indexBuffer.data.BYTES_PER_ELEMENT, u = c === 2 ? i.UNSIGNED_SHORT : i.UNSIGNED_INT;
588
+ n > 1 ? i.drawElementsInstanced(o, r || a.indexBuffer.data.length, u, (s || 0) * c, n) : i.drawElements(o, r || a.indexBuffer.data.length, u, (s || 0) * c);
589
+ } else n > 1 ? i.drawArraysInstanced(o, s || 0, r || a.getSize(), n) : i.drawArrays(o, s || 0, r || a.getSize());
590
+ return this;
591
+ }
592
+ /** Unbind/reset everything. */
593
+ unbind() {
594
+ this.gl.bindVertexArray(null), this._activeVao = null, this._activeGeometry = null;
595
+ }
596
+ destroy() {
597
+ this._renderer = null, this.gl = null, this._activeVao = null, this._activeGeometry = null;
598
+ }
599
+ }
600
+ ne.extension = {
601
+ type: [
602
+ d.WebGLSystem
603
+ ],
604
+ name: "geometry"
605
+ };
606
+ const je = new Ae({
607
+ attributes: {
608
+ aPosition: [
609
+ -1,
610
+ -1,
611
+ // Bottom left corner
612
+ 3,
613
+ -1,
614
+ // Bottom right corner, extending beyond right edge
615
+ -1,
616
+ 3
617
+ // Top left corner, extending beyond top edge
618
+ ]
619
+ }
620
+ }), M = class ie {
621
+ constructor(e) {
622
+ this.useBackBuffer = !1, this._useBackBufferThisRender = !1, this._renderer = e;
623
+ }
624
+ init(e = {}) {
625
+ const { useBackBuffer: r, antialias: s } = { ...ie.defaultOptions, ...e };
626
+ this.useBackBuffer = r, this._antialias = s, this._renderer.context.supports.msaa || (m("antialiasing, is not supported on when using the back buffer"), this._antialias = !1), this._state = O.for2d();
627
+ const n = new Be({
628
+ vertex: `
629
+ attribute vec2 aPosition;
630
+ out vec2 vUv;
631
+
632
+ void main() {
633
+ gl_Position = vec4(aPosition, 0.0, 1.0);
634
+
635
+ vUv = (aPosition + 1.0) / 2.0;
636
+
637
+ // flip dem UVs
638
+ vUv.y = 1.0 - vUv.y;
639
+ }`,
640
+ fragment: `
641
+ in vec2 vUv;
642
+ out vec4 finalColor;
643
+
644
+ uniform sampler2D uTexture;
645
+
646
+ void main() {
647
+ finalColor = texture(uTexture, vUv);
648
+ }`,
649
+ name: "big-triangle"
650
+ });
651
+ this._bigTriangleShader = new U({
652
+ glProgram: n,
653
+ resources: {
654
+ uTexture: b.WHITE.source
655
+ }
656
+ });
657
+ }
658
+ /**
659
+ * This is called before the RenderTargetSystem is started. This is where
660
+ * we replace the target with the back buffer if required.
661
+ * @param options - The options for this render.
662
+ */
663
+ renderStart(e) {
664
+ const r = this._renderer.renderTarget.getRenderTarget(e.target);
665
+ if (this._useBackBufferThisRender = this.useBackBuffer && !!r.isRoot, this._useBackBufferThisRender) {
666
+ const s = this._renderer.renderTarget.getRenderTarget(e.target);
667
+ this._targetTexture = s.colorTexture, e.target = this._getBackBufferTexture(s.colorTexture);
668
+ }
669
+ }
670
+ renderEnd() {
671
+ this._presentBackBuffer();
672
+ }
673
+ _presentBackBuffer() {
674
+ const e = this._renderer;
675
+ e.renderTarget.finishRenderPass(), this._useBackBufferThisRender && (e.renderTarget.bind(this._targetTexture, !1), this._bigTriangleShader.resources.uTexture = this._backBufferTexture.source, e.encoder.draw({
676
+ geometry: je,
677
+ shader: this._bigTriangleShader,
678
+ state: this._state
679
+ }));
680
+ }
681
+ _getBackBufferTexture(e) {
682
+ return this._backBufferTexture = this._backBufferTexture || new b({
683
+ source: new $({
684
+ width: e.width,
685
+ height: e.height,
686
+ resolution: e._resolution,
687
+ antialias: this._antialias
688
+ })
689
+ }), this._backBufferTexture.source.resize(
690
+ e.width,
691
+ e.height,
692
+ e._resolution
693
+ ), this._backBufferTexture;
694
+ }
695
+ /** destroys the back buffer */
696
+ destroy() {
697
+ this._backBufferTexture && (this._backBufferTexture.destroy(), this._backBufferTexture = null);
698
+ }
699
+ };
700
+ M.extension = {
701
+ type: [
702
+ d.WebGLSystem
703
+ ],
704
+ name: "backBuffer",
705
+ priority: 1
706
+ };
707
+ M.defaultOptions = {
708
+ /** if true will use the back buffer where required */
709
+ useBackBuffer: !1
710
+ };
711
+ let Ke = M;
712
+ class ae {
713
+ constructor(e) {
714
+ this._colorMaskCache = 15, this._renderer = e;
715
+ }
716
+ setMask(e) {
717
+ this._colorMaskCache !== e && (this._colorMaskCache = e, this._renderer.gl.colorMask(
718
+ !!(e & 8),
719
+ !!(e & 4),
720
+ !!(e & 2),
721
+ !!(e & 1)
722
+ ));
723
+ }
724
+ }
725
+ ae.extension = {
726
+ type: [
727
+ d.WebGLSystem
728
+ ],
729
+ name: "colorMask"
730
+ };
731
+ class oe {
732
+ constructor(e) {
733
+ this.commandFinished = Promise.resolve(), this._renderer = e;
734
+ }
735
+ setGeometry(e, r) {
736
+ this._renderer.geometry.bind(e, r.glProgram);
737
+ }
738
+ finishRenderPass() {
739
+ }
740
+ draw(e) {
741
+ const r = this._renderer, { geometry: s, shader: n, state: i, skipSync: a, topology: o, size: c, start: u, instanceCount: _ } = e;
742
+ r.shader.bind(n, a), r.geometry.bind(s, r.shader._activeProgram), i && r.state.set(i), r.geometry.draw(o, c, u, _ ?? s.instanceCount);
743
+ }
744
+ destroy() {
745
+ this._renderer = null;
746
+ }
747
+ }
748
+ oe.extension = {
749
+ type: [
750
+ d.WebGLSystem
751
+ ],
752
+ name: "encoder"
753
+ };
754
+ class $e {
755
+ constructor() {
756
+ this.width = -1, this.height = -1, this.msaa = !1, this.msaaRenderBuffer = [];
757
+ }
758
+ }
759
+ class ce {
760
+ constructor(e) {
761
+ this._stencilCache = {
762
+ enabled: !1,
763
+ stencilReference: 0,
764
+ stencilMode: p.NONE
765
+ }, this._renderTargetStencilState = /* @__PURE__ */ Object.create(null), e.renderTarget.onRenderTargetChange.add(this);
766
+ }
767
+ contextChange(e) {
768
+ this._gl = e, this._comparisonFuncMapping = {
769
+ always: e.ALWAYS,
770
+ never: e.NEVER,
771
+ equal: e.EQUAL,
772
+ "not-equal": e.NOTEQUAL,
773
+ less: e.LESS,
774
+ "less-equal": e.LEQUAL,
775
+ greater: e.GREATER,
776
+ "greater-equal": e.GEQUAL
777
+ }, this._stencilOpsMapping = {
778
+ keep: e.KEEP,
779
+ zero: e.ZERO,
780
+ replace: e.REPLACE,
781
+ invert: e.INVERT,
782
+ "increment-clamp": e.INCR,
783
+ "decrement-clamp": e.DECR,
784
+ "increment-wrap": e.INCR_WRAP,
785
+ "decrement-wrap": e.DECR_WRAP
786
+ }, this.resetState();
787
+ }
788
+ onRenderTargetChange(e) {
789
+ if (this._activeRenderTarget === e)
790
+ return;
791
+ this._activeRenderTarget = e;
792
+ let r = this._renderTargetStencilState[e.uid];
793
+ r || (r = this._renderTargetStencilState[e.uid] = {
794
+ stencilMode: p.DISABLED,
795
+ stencilReference: 0
796
+ }), this.setStencilMode(r.stencilMode, r.stencilReference);
797
+ }
798
+ resetState() {
799
+ this._stencilCache.enabled = !1, this._stencilCache.stencilMode = p.NONE, this._stencilCache.stencilReference = 0;
800
+ }
801
+ setStencilMode(e, r) {
802
+ const s = this._renderTargetStencilState[this._activeRenderTarget.uid], n = this._gl, i = Ue[e], a = this._stencilCache;
803
+ if (s.stencilMode = e, s.stencilReference = r, e === p.DISABLED) {
804
+ this._stencilCache.enabled && (this._stencilCache.enabled = !1, n.disable(n.STENCIL_TEST));
805
+ return;
806
+ }
807
+ this._stencilCache.enabled || (this._stencilCache.enabled = !0, n.enable(n.STENCIL_TEST)), (e !== a.stencilMode || a.stencilReference !== r) && (a.stencilMode = e, a.stencilReference = r, n.stencilFunc(this._comparisonFuncMapping[i.stencilBack.compare], r, 255), n.stencilOp(n.KEEP, n.KEEP, this._stencilOpsMapping[i.stencilBack.passOp]));
808
+ }
809
+ }
810
+ ce.extension = {
811
+ type: [
812
+ d.WebGLSystem
813
+ ],
814
+ name: "stencil"
815
+ };
816
+ const ue = {
817
+ f32: 4,
818
+ i32: 4,
819
+ "vec2<f32>": 8,
820
+ "vec3<f32>": 12,
821
+ "vec4<f32>": 16,
822
+ "vec2<i32>": 8,
823
+ "vec3<i32>": 12,
824
+ "vec4<i32>": 16,
825
+ "mat2x2<f32>": 16 * 2,
826
+ "mat3x3<f32>": 16 * 3,
827
+ "mat4x4<f32>": 16 * 4
828
+ // TODO - not essential for now but support these in the future
829
+ // int: 4,
830
+ // ivec2: 8,
831
+ // ivec3: 12,
832
+ // ivec4: 16,
833
+ // uint: 4,
834
+ // uvec2: 8,
835
+ // uvec3: 12,
836
+ // uvec4: 16,
837
+ // bool: 4,
838
+ // bvec2: 8,
839
+ // bvec3: 12,
840
+ // bvec4: 16,
841
+ // mat2: 16 * 2,
842
+ // mat3: 16 * 3,
843
+ // mat4: 16 * 4,
844
+ };
845
+ function ze(t) {
846
+ const e = t.map((i) => ({
847
+ data: i,
848
+ offset: 0,
849
+ size: 0
850
+ })), r = 16;
851
+ let s = 0, n = 0;
852
+ for (let i = 0; i < e.length; i++) {
853
+ const a = e[i];
854
+ if (s = ue[a.data.type], !s)
855
+ throw new Error(`Unknown type ${a.data.type}`);
856
+ a.data.size > 1 && (s = Math.max(s, r) * a.data.size);
857
+ const o = s === 12 ? 16 : s;
858
+ a.size = s;
859
+ const c = n % r;
860
+ c > 0 && r - c < o ? n += (r - c) % 16 : n += (s - c % s) % s, a.offset = n, n += s;
861
+ }
862
+ return n = Math.ceil(n / 16) * 16, { uboElements: e, size: n };
863
+ }
864
+ function Ye(t, e) {
865
+ const r = Math.max(ue[t.data.type] / 16, 1), s = t.data.value.length / t.data.size, n = (4 - s % 4) % 4, i = t.data.type.indexOf("i32") >= 0 ? "dataInt32" : "data";
866
+ return `
867
+ v = uv.${t.data.name};
868
+ offset += ${e};
869
+
870
+ arrayOffset = offset;
871
+
872
+ t = 0;
873
+
874
+ for(var i=0; i < ${t.data.size * r}; i++)
875
+ {
876
+ for(var j = 0; j < ${s}; j++)
877
+ {
878
+ ${i}[arrayOffset++] = v[t++];
879
+ }
880
+ ${n !== 0 ? `arrayOffset += ${n};` : ""}
881
+ }
882
+ `;
883
+ }
884
+ function qe(t) {
885
+ return Fe(
886
+ t,
887
+ "uboStd40",
888
+ Ye,
889
+ Oe
890
+ );
891
+ }
892
+ class _e extends Pe {
893
+ constructor() {
894
+ super({
895
+ createUboElements: ze,
896
+ generateUboSync: qe
897
+ });
898
+ }
899
+ }
900
+ _e.extension = {
901
+ type: [d.WebGLSystem],
902
+ name: "ubo"
903
+ };
904
+ class Ze {
905
+ constructor() {
906
+ this._clearColorCache = [0, 0, 0, 0], this._viewPortCache = new H();
907
+ }
908
+ init(e, r) {
909
+ this._renderer = e, this._renderTargetSystem = r, e.runners.contextChange.add(this);
910
+ }
911
+ contextChange() {
912
+ this._clearColorCache = [0, 0, 0, 0], this._viewPortCache = new H();
913
+ }
914
+ copyToTexture(e, r, s, n, i) {
915
+ const a = this._renderTargetSystem, o = this._renderer, c = a.getGpuRenderTarget(e), u = o.gl;
916
+ return this.finishRenderPass(e), u.bindFramebuffer(u.FRAMEBUFFER, c.resolveTargetFramebuffer), o.texture.bind(r, 0), u.copyTexSubImage2D(
917
+ u.TEXTURE_2D,
918
+ 0,
919
+ i.x,
920
+ i.y,
921
+ s.x,
922
+ s.y,
923
+ n.width,
924
+ n.height
925
+ ), r;
926
+ }
927
+ startRenderPass(e, r = !0, s, n) {
928
+ const i = this._renderTargetSystem, a = e.colorTexture, o = i.getGpuRenderTarget(e);
929
+ let c = n.y;
930
+ e.isRoot && (c = a.pixelHeight - n.height), e.colorTextures.forEach((h) => {
931
+ this._renderer.texture.unbind(h);
932
+ });
933
+ const u = this._renderer.gl;
934
+ u.bindFramebuffer(u.FRAMEBUFFER, o.framebuffer);
935
+ const _ = this._viewPortCache;
936
+ (_.x !== n.x || _.y !== c || _.width !== n.width || _.height !== n.height) && (_.x = n.x, _.y = c, _.width = n.width, _.height = n.height, u.viewport(
937
+ n.x,
938
+ c,
939
+ n.width,
940
+ n.height
941
+ )), !o.depthStencilRenderBuffer && (e.stencil || e.depth) && this._initStencil(o), this.clear(e, r, s);
942
+ }
943
+ finishRenderPass(e) {
944
+ const s = this._renderTargetSystem.getGpuRenderTarget(e);
945
+ if (!s.msaa)
946
+ return;
947
+ const n = this._renderer.gl;
948
+ n.bindFramebuffer(n.FRAMEBUFFER, s.resolveTargetFramebuffer), n.bindFramebuffer(n.READ_FRAMEBUFFER, s.framebuffer), n.blitFramebuffer(
949
+ 0,
950
+ 0,
951
+ s.width,
952
+ s.height,
953
+ 0,
954
+ 0,
955
+ s.width,
956
+ s.height,
957
+ n.COLOR_BUFFER_BIT,
958
+ n.NEAREST
959
+ ), n.bindFramebuffer(n.FRAMEBUFFER, s.framebuffer);
960
+ }
961
+ initGpuRenderTarget(e) {
962
+ const s = this._renderer.gl, n = new $e(), i = e.colorTexture;
963
+ return A.test(i.resource) ? (this._renderer.context.ensureCanvasSize(e.colorTexture.resource), n.framebuffer = null, n) : (this._initColor(e, n), s.bindFramebuffer(s.FRAMEBUFFER, null), n);
964
+ }
965
+ destroyGpuRenderTarget(e) {
966
+ const r = this._renderer.gl;
967
+ e.framebuffer && (r.deleteFramebuffer(e.framebuffer), e.framebuffer = null), e.resolveTargetFramebuffer && (r.deleteFramebuffer(e.resolveTargetFramebuffer), e.resolveTargetFramebuffer = null), e.depthStencilRenderBuffer && (r.deleteRenderbuffer(e.depthStencilRenderBuffer), e.depthStencilRenderBuffer = null), e.msaaRenderBuffer.forEach((s) => {
968
+ r.deleteRenderbuffer(s);
969
+ }), e.msaaRenderBuffer = null;
970
+ }
971
+ clear(e, r, s) {
972
+ if (!r)
973
+ return;
974
+ const n = this._renderTargetSystem;
975
+ typeof r == "boolean" && (r = r ? N.ALL : N.NONE);
976
+ const i = this._renderer.gl;
977
+ if (r & N.COLOR) {
978
+ s ?? (s = n.defaultClearColor);
979
+ const a = this._clearColorCache, o = s;
980
+ (a[0] !== o[0] || a[1] !== o[1] || a[2] !== o[2] || a[3] !== o[3]) && (a[0] = o[0], a[1] = o[1], a[2] = o[2], a[3] = o[3], i.clearColor(o[0], o[1], o[2], o[3]));
981
+ }
982
+ i.clear(r);
983
+ }
984
+ resizeGpuRenderTarget(e) {
985
+ if (e.isRoot)
986
+ return;
987
+ const s = this._renderTargetSystem.getGpuRenderTarget(e);
988
+ this._resizeColor(e, s), (e.stencil || e.depth) && this._resizeStencil(s);
989
+ }
990
+ _initColor(e, r) {
991
+ const s = this._renderer, n = s.gl, i = n.createFramebuffer();
992
+ if (r.resolveTargetFramebuffer = i, n.bindFramebuffer(n.FRAMEBUFFER, i), r.width = e.colorTexture.source.pixelWidth, r.height = e.colorTexture.source.pixelHeight, e.colorTextures.forEach((a, o) => {
993
+ const c = a.source;
994
+ c.antialias && (s.context.supports.msaa ? r.msaa = !0 : m("[RenderTexture] Antialiasing on textures is not supported in WebGL1")), s.texture.bindSource(c, 0);
995
+ const _ = s.texture.getGlSource(c).texture;
996
+ n.framebufferTexture2D(
997
+ n.FRAMEBUFFER,
998
+ n.COLOR_ATTACHMENT0 + o,
999
+ 3553,
1000
+ // texture.target,
1001
+ _,
1002
+ 0
1003
+ );
1004
+ }), r.msaa) {
1005
+ const a = n.createFramebuffer();
1006
+ r.framebuffer = a, n.bindFramebuffer(n.FRAMEBUFFER, a), e.colorTextures.forEach((o, c) => {
1007
+ const u = n.createRenderbuffer();
1008
+ r.msaaRenderBuffer[c] = u;
1009
+ });
1010
+ } else
1011
+ r.framebuffer = i;
1012
+ this._resizeColor(e, r);
1013
+ }
1014
+ _resizeColor(e, r) {
1015
+ const s = e.colorTexture.source;
1016
+ if (r.width = s.pixelWidth, r.height = s.pixelHeight, e.colorTextures.forEach((n, i) => {
1017
+ i !== 0 && n.source.resize(s.width, s.height, s._resolution);
1018
+ }), r.msaa) {
1019
+ const n = this._renderer, i = n.gl, a = r.framebuffer;
1020
+ i.bindFramebuffer(i.FRAMEBUFFER, a), e.colorTextures.forEach((o, c) => {
1021
+ const u = o.source;
1022
+ n.texture.bindSource(u, 0);
1023
+ const h = n.texture.getGlSource(u).internalFormat, l = r.msaaRenderBuffer[c];
1024
+ i.bindRenderbuffer(
1025
+ i.RENDERBUFFER,
1026
+ l
1027
+ ), i.renderbufferStorageMultisample(
1028
+ i.RENDERBUFFER,
1029
+ 4,
1030
+ h,
1031
+ u.pixelWidth,
1032
+ u.pixelHeight
1033
+ ), i.framebufferRenderbuffer(
1034
+ i.FRAMEBUFFER,
1035
+ i.COLOR_ATTACHMENT0 + c,
1036
+ i.RENDERBUFFER,
1037
+ l
1038
+ );
1039
+ });
1040
+ }
1041
+ }
1042
+ _initStencil(e) {
1043
+ if (e.framebuffer === null)
1044
+ return;
1045
+ const r = this._renderer.gl, s = r.createRenderbuffer();
1046
+ e.depthStencilRenderBuffer = s, r.bindRenderbuffer(
1047
+ r.RENDERBUFFER,
1048
+ s
1049
+ ), r.framebufferRenderbuffer(
1050
+ r.FRAMEBUFFER,
1051
+ r.DEPTH_STENCIL_ATTACHMENT,
1052
+ r.RENDERBUFFER,
1053
+ s
1054
+ ), this._resizeStencil(e);
1055
+ }
1056
+ _resizeStencil(e) {
1057
+ const r = this._renderer.gl;
1058
+ r.bindRenderbuffer(
1059
+ r.RENDERBUFFER,
1060
+ e.depthStencilRenderBuffer
1061
+ ), e.msaa ? r.renderbufferStorageMultisample(
1062
+ r.RENDERBUFFER,
1063
+ 4,
1064
+ r.DEPTH24_STENCIL8,
1065
+ e.width,
1066
+ e.height
1067
+ ) : r.renderbufferStorage(
1068
+ r.RENDERBUFFER,
1069
+ this._renderer.context.webGLVersion === 2 ? r.DEPTH24_STENCIL8 : r.DEPTH_STENCIL,
1070
+ e.width,
1071
+ e.height
1072
+ );
1073
+ }
1074
+ prerender(e) {
1075
+ const r = e.colorTexture.resource;
1076
+ this._renderer.context.multiView && A.test(r) && this._renderer.context.ensureCanvasSize(r);
1077
+ }
1078
+ postrender(e) {
1079
+ if (this._renderer.context.multiView && A.test(e.colorTexture.resource)) {
1080
+ const r = this._renderer.context.canvas, s = e.colorTexture;
1081
+ s.context2D.drawImage(
1082
+ r,
1083
+ 0,
1084
+ s.pixelHeight - r.height
1085
+ );
1086
+ }
1087
+ }
1088
+ }
1089
+ class fe extends Me {
1090
+ constructor(e) {
1091
+ super(e), this.adaptor = new Ze(), this.adaptor.init(e, this);
1092
+ }
1093
+ }
1094
+ fe.extension = {
1095
+ type: [d.WebGLSystem],
1096
+ name: "renderTarget"
1097
+ };
1098
+ function Qe(t, e) {
1099
+ const r = [], s = [`
1100
+ var g = s.groups;
1101
+ var sS = r.shader;
1102
+ var p = s.glProgram;
1103
+ var ugS = r.uniformGroup;
1104
+ var resources;
1105
+ `];
1106
+ let n = !1, i = 0;
1107
+ const a = e._getProgramData(t.glProgram);
1108
+ for (const c in t.groups) {
1109
+ const u = t.groups[c];
1110
+ r.push(`
1111
+ resources = g[${c}].resources;
1112
+ `);
1113
+ for (const _ in u.resources) {
1114
+ const h = u.resources[_];
1115
+ if (h instanceof F)
1116
+ if (h.ubo) {
1117
+ const l = t._uniformBindMap[c][Number(_)];
1118
+ r.push(`
1119
+ sS.bindUniformBlock(
1120
+ resources[${_}],
1121
+ '${l}',
1122
+ ${t.glProgram._uniformBlockData[l].index}
1123
+ );
1124
+ `);
1125
+ } else
1126
+ r.push(`
1127
+ ugS.updateUniformGroup(resources[${_}], p, sD);
1128
+ `);
1129
+ else if (h instanceof J) {
1130
+ const l = t._uniformBindMap[c][Number(_)];
1131
+ r.push(`
1132
+ sS.bindUniformBlock(
1133
+ resources[${_}],
1134
+ '${l}',
1135
+ ${t.glProgram._uniformBlockData[l].index}
1136
+ );
1137
+ `);
1138
+ } else if (h instanceof $) {
1139
+ const l = t._uniformBindMap[c][_], E = a.uniformData[l];
1140
+ E && (n || (n = !0, s.push(`
1141
+ var tS = r.texture;
1142
+ `)), e._gl.uniform1i(E.location, i), r.push(`
1143
+ tS.bind(resources[${_}], ${i});
1144
+ `), i++);
1145
+ }
1146
+ }
1147
+ }
1148
+ const o = [...s, ...r].join(`
1149
+ `);
1150
+ return new Function("r", "s", "sD", o);
1151
+ }
1152
+ class Je {
1153
+ /**
1154
+ * Makes a new Pixi program.
1155
+ * @param program - webgl program
1156
+ * @param uniformData - uniforms
1157
+ */
1158
+ constructor(e, r) {
1159
+ this.program = e, this.uniformData = r, this.uniformGroups = {}, this.uniformDirtyGroups = {}, this.uniformBlockBindings = {};
1160
+ }
1161
+ /** Destroys this program. */
1162
+ destroy() {
1163
+ this.uniformData = null, this.uniformGroups = null, this.uniformDirtyGroups = null, this.uniformBlockBindings = null, this.program = null;
1164
+ }
1165
+ }
1166
+ function V(t, e, r) {
1167
+ const s = t.createShader(e);
1168
+ return t.shaderSource(s, r), t.compileShader(s), s;
1169
+ }
1170
+ function D(t) {
1171
+ const e = new Array(t);
1172
+ for (let r = 0; r < e.length; r++)
1173
+ e[r] = !1;
1174
+ return e;
1175
+ }
1176
+ function he(t, e) {
1177
+ switch (t) {
1178
+ case "float":
1179
+ return 0;
1180
+ case "vec2":
1181
+ return new Float32Array(2 * e);
1182
+ case "vec3":
1183
+ return new Float32Array(3 * e);
1184
+ case "vec4":
1185
+ return new Float32Array(4 * e);
1186
+ case "int":
1187
+ case "uint":
1188
+ case "sampler2D":
1189
+ case "sampler2DArray":
1190
+ return 0;
1191
+ case "ivec2":
1192
+ return new Int32Array(2 * e);
1193
+ case "ivec3":
1194
+ return new Int32Array(3 * e);
1195
+ case "ivec4":
1196
+ return new Int32Array(4 * e);
1197
+ case "uvec2":
1198
+ return new Uint32Array(2 * e);
1199
+ case "uvec3":
1200
+ return new Uint32Array(3 * e);
1201
+ case "uvec4":
1202
+ return new Uint32Array(4 * e);
1203
+ case "bool":
1204
+ return !1;
1205
+ case "bvec2":
1206
+ return D(2 * e);
1207
+ case "bvec3":
1208
+ return D(3 * e);
1209
+ case "bvec4":
1210
+ return D(4 * e);
1211
+ case "mat2":
1212
+ return new Float32Array([
1213
+ 1,
1214
+ 0,
1215
+ 0,
1216
+ 1
1217
+ ]);
1218
+ case "mat3":
1219
+ return new Float32Array([
1220
+ 1,
1221
+ 0,
1222
+ 0,
1223
+ 0,
1224
+ 1,
1225
+ 0,
1226
+ 0,
1227
+ 0,
1228
+ 1
1229
+ ]);
1230
+ case "mat4":
1231
+ return new Float32Array([
1232
+ 1,
1233
+ 0,
1234
+ 0,
1235
+ 0,
1236
+ 0,
1237
+ 1,
1238
+ 0,
1239
+ 0,
1240
+ 0,
1241
+ 0,
1242
+ 1,
1243
+ 0,
1244
+ 0,
1245
+ 0,
1246
+ 0,
1247
+ 1
1248
+ ]);
1249
+ }
1250
+ return null;
1251
+ }
1252
+ let g = null;
1253
+ const k = {
1254
+ FLOAT: "float",
1255
+ FLOAT_VEC2: "vec2",
1256
+ FLOAT_VEC3: "vec3",
1257
+ FLOAT_VEC4: "vec4",
1258
+ INT: "int",
1259
+ INT_VEC2: "ivec2",
1260
+ INT_VEC3: "ivec3",
1261
+ INT_VEC4: "ivec4",
1262
+ UNSIGNED_INT: "uint",
1263
+ UNSIGNED_INT_VEC2: "uvec2",
1264
+ UNSIGNED_INT_VEC3: "uvec3",
1265
+ UNSIGNED_INT_VEC4: "uvec4",
1266
+ BOOL: "bool",
1267
+ BOOL_VEC2: "bvec2",
1268
+ BOOL_VEC3: "bvec3",
1269
+ BOOL_VEC4: "bvec4",
1270
+ FLOAT_MAT2: "mat2",
1271
+ FLOAT_MAT3: "mat3",
1272
+ FLOAT_MAT4: "mat4",
1273
+ SAMPLER_2D: "sampler2D",
1274
+ INT_SAMPLER_2D: "sampler2D",
1275
+ UNSIGNED_INT_SAMPLER_2D: "sampler2D",
1276
+ SAMPLER_CUBE: "samplerCube",
1277
+ INT_SAMPLER_CUBE: "samplerCube",
1278
+ UNSIGNED_INT_SAMPLER_CUBE: "samplerCube",
1279
+ SAMPLER_2D_ARRAY: "sampler2DArray",
1280
+ INT_SAMPLER_2D_ARRAY: "sampler2DArray",
1281
+ UNSIGNED_INT_SAMPLER_2D_ARRAY: "sampler2DArray"
1282
+ }, et = {
1283
+ float: "float32",
1284
+ vec2: "float32x2",
1285
+ vec3: "float32x3",
1286
+ vec4: "float32x4",
1287
+ int: "sint32",
1288
+ ivec2: "sint32x2",
1289
+ ivec3: "sint32x3",
1290
+ ivec4: "sint32x4",
1291
+ uint: "uint32",
1292
+ uvec2: "uint32x2",
1293
+ uvec3: "uint32x3",
1294
+ uvec4: "uint32x4",
1295
+ bool: "uint32",
1296
+ bvec2: "uint32x2",
1297
+ bvec3: "uint32x3",
1298
+ bvec4: "uint32x4"
1299
+ };
1300
+ function le(t, e) {
1301
+ if (!g) {
1302
+ const r = Object.keys(k);
1303
+ g = {};
1304
+ for (let s = 0; s < r.length; ++s) {
1305
+ const n = r[s];
1306
+ g[t[n]] = k[n];
1307
+ }
1308
+ }
1309
+ return g[e];
1310
+ }
1311
+ function tt(t, e) {
1312
+ const r = le(t, e);
1313
+ return et[r] || "float32";
1314
+ }
1315
+ function rt(t, e, r = !1) {
1316
+ const s = {}, n = e.getProgramParameter(t, e.ACTIVE_ATTRIBUTES);
1317
+ for (let a = 0; a < n; a++) {
1318
+ const o = e.getActiveAttrib(t, a);
1319
+ if (o.name.startsWith("gl_"))
1320
+ continue;
1321
+ const c = tt(e, o.type);
1322
+ s[o.name] = {
1323
+ location: 0,
1324
+ // set further down..
1325
+ format: c,
1326
+ stride: K(c).stride,
1327
+ offset: 0,
1328
+ instance: !1,
1329
+ start: 0
1330
+ };
1331
+ }
1332
+ const i = Object.keys(s);
1333
+ if (r) {
1334
+ i.sort((a, o) => a > o ? 1 : -1);
1335
+ for (let a = 0; a < i.length; a++)
1336
+ s[i[a]].location = a, e.bindAttribLocation(t, a, i[a]);
1337
+ e.linkProgram(t);
1338
+ } else
1339
+ for (let a = 0; a < i.length; a++)
1340
+ s[i[a]].location = e.getAttribLocation(t, i[a]);
1341
+ return s;
1342
+ }
1343
+ function st(t, e) {
1344
+ if (!e.ACTIVE_UNIFORM_BLOCKS)
1345
+ return {};
1346
+ const r = {}, s = e.getProgramParameter(t, e.ACTIVE_UNIFORM_BLOCKS);
1347
+ for (let n = 0; n < s; n++) {
1348
+ const i = e.getActiveUniformBlockName(t, n), a = e.getUniformBlockIndex(t, i), o = e.getActiveUniformBlockParameter(t, n, e.UNIFORM_BLOCK_DATA_SIZE);
1349
+ r[i] = {
1350
+ name: i,
1351
+ index: a,
1352
+ size: o
1353
+ };
1354
+ }
1355
+ return r;
1356
+ }
1357
+ function nt(t, e) {
1358
+ const r = {}, s = e.getProgramParameter(t, e.ACTIVE_UNIFORMS);
1359
+ for (let n = 0; n < s; n++) {
1360
+ const i = e.getActiveUniform(t, n), a = i.name.replace(/\[.*?\]$/, ""), o = !!i.name.match(/\[.*?\]$/), c = le(e, i.type);
1361
+ r[a] = {
1362
+ name: a,
1363
+ index: n,
1364
+ type: c,
1365
+ size: i.size,
1366
+ isArray: o,
1367
+ value: he(c, i.size)
1368
+ };
1369
+ }
1370
+ return r;
1371
+ }
1372
+ function X(t, e) {
1373
+ const r = t.getShaderSource(e).split(`
1374
+ `).map((u, _) => `${_}: ${u}`), s = t.getShaderInfoLog(e), n = s.split(`
1375
+ `), i = {}, a = n.map((u) => parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/, "$1"))).filter((u) => u && !i[u] ? (i[u] = !0, !0) : !1), o = [""];
1376
+ a.forEach((u) => {
1377
+ r[u - 1] = `%c${r[u - 1]}%c`, o.push("background: #FF0000; color:#FFFFFF; font-size: 10px", "font-size: 10px");
1378
+ });
1379
+ const c = r.join(`
1380
+ `);
1381
+ o[0] = c, console.error(s), console.groupCollapsed("click to view full shader code"), console.warn(...o), console.groupEnd();
1382
+ }
1383
+ function it(t, e, r, s) {
1384
+ t.getProgramParameter(e, t.LINK_STATUS) || (t.getShaderParameter(r, t.COMPILE_STATUS) || X(t, r), t.getShaderParameter(s, t.COMPILE_STATUS) || X(t, s), console.error("PixiJS Error: Could not initialize shader."), t.getProgramInfoLog(e) !== "" && console.warn("PixiJS Warning: gl.getProgramInfoLog()", t.getProgramInfoLog(e)));
1385
+ }
1386
+ function at(t, e) {
1387
+ const r = V(t, t.VERTEX_SHADER, e.vertex), s = V(t, t.FRAGMENT_SHADER, e.fragment), n = t.createProgram();
1388
+ t.attachShader(n, r), t.attachShader(n, s);
1389
+ const i = e.transformFeedbackVaryings;
1390
+ i && (typeof t.transformFeedbackVaryings != "function" ? m("TransformFeedback is not supported but TransformFeedbackVaryings are given.") : t.transformFeedbackVaryings(
1391
+ n,
1392
+ i.names,
1393
+ i.bufferMode === "separate" ? t.SEPARATE_ATTRIBS : t.INTERLEAVED_ATTRIBS
1394
+ )), t.linkProgram(n), t.getProgramParameter(n, t.LINK_STATUS) || it(t, n, r, s), e._attributeData = rt(
1395
+ n,
1396
+ t,
1397
+ !/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)
1398
+ ), e._uniformData = nt(n, t), e._uniformBlockData = st(n, t), t.deleteShader(r), t.deleteShader(s);
1399
+ const a = {};
1400
+ for (const c in e._uniformData) {
1401
+ const u = e._uniformData[c];
1402
+ a[c] = {
1403
+ location: t.getUniformLocation(n, c),
1404
+ value: he(u.type, u.size)
1405
+ };
1406
+ }
1407
+ return new Je(n, a);
1408
+ }
1409
+ const R = {
1410
+ textureCount: 0,
1411
+ blockIndex: 0
1412
+ };
1413
+ class de {
1414
+ constructor(e) {
1415
+ this._activeProgram = null, this._programDataHash = /* @__PURE__ */ Object.create(null), this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null), this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_programDataHash");
1416
+ }
1417
+ contextChange(e) {
1418
+ this._gl = e, this._programDataHash = /* @__PURE__ */ Object.create(null), this._shaderSyncFunctions = /* @__PURE__ */ Object.create(null), this._activeProgram = null, this.maxTextures = z();
1419
+ }
1420
+ /**
1421
+ * Changes the current shader to the one given in parameter.
1422
+ * @param shader - the new shader
1423
+ * @param skipSync - false if the shader should automatically sync its uniforms.
1424
+ * @returns the glProgram that belongs to the shader.
1425
+ */
1426
+ bind(e, r) {
1427
+ if (this._setProgram(e.glProgram), r)
1428
+ return;
1429
+ R.textureCount = 0, R.blockIndex = 0;
1430
+ let s = this._shaderSyncFunctions[e.glProgram._key];
1431
+ s || (s = this._shaderSyncFunctions[e.glProgram._key] = this._generateShaderSync(e, this)), this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings), s(this._renderer, e, R);
1432
+ }
1433
+ /**
1434
+ * Updates the uniform group.
1435
+ * @param uniformGroup - the uniform group to update
1436
+ */
1437
+ updateUniformGroup(e) {
1438
+ this._renderer.uniformGroup.updateUniformGroup(e, this._activeProgram, R);
1439
+ }
1440
+ /**
1441
+ * Binds a uniform block to the shader.
1442
+ * @param uniformGroup - the uniform group to bind
1443
+ * @param name - the name of the uniform block
1444
+ * @param index - the index of the uniform block
1445
+ */
1446
+ bindUniformBlock(e, r, s = 0) {
1447
+ const n = this._renderer.buffer, i = this._getProgramData(this._activeProgram), a = e._bufferResource;
1448
+ a || this._renderer.ubo.updateUniformGroup(e);
1449
+ const o = e.buffer, c = n.updateBuffer(o), u = n.freeLocationForBufferBase(c);
1450
+ if (a) {
1451
+ const { offset: h, size: l } = e;
1452
+ h === 0 && l === o.data.byteLength ? n.bindBufferBase(c, u) : n.bindBufferRange(c, u, h);
1453
+ } else n.getLastBindBaseLocation(c) !== u && n.bindBufferBase(c, u);
1454
+ const _ = this._activeProgram._uniformBlockData[r].index;
1455
+ i.uniformBlockBindings[s] !== u && (i.uniformBlockBindings[s] = u, this._renderer.gl.uniformBlockBinding(i.program, _, u));
1456
+ }
1457
+ _setProgram(e) {
1458
+ if (this._activeProgram === e)
1459
+ return;
1460
+ this._activeProgram = e;
1461
+ const r = this._getProgramData(e);
1462
+ this._gl.useProgram(r.program);
1463
+ }
1464
+ /**
1465
+ * @param program - the program to get the data for
1466
+ * @internal
1467
+ * @private
1468
+ */
1469
+ _getProgramData(e) {
1470
+ return this._programDataHash[e._key] || this._createProgramData(e);
1471
+ }
1472
+ _createProgramData(e) {
1473
+ const r = e._key;
1474
+ return this._programDataHash[r] = at(this._gl, e), this._programDataHash[r];
1475
+ }
1476
+ destroy() {
1477
+ for (const e of Object.keys(this._programDataHash))
1478
+ this._programDataHash[e].destroy(), this._programDataHash[e] = null;
1479
+ this._programDataHash = null;
1480
+ }
1481
+ /**
1482
+ * Creates a function that can be executed that will sync the shader as efficiently as possible.
1483
+ * Overridden by the unsafe eval package if you don't want eval used in your project.
1484
+ * @param shader - the shader to generate the sync function for
1485
+ * @param shaderSystem - the shader system to use
1486
+ * @returns - the generated sync function
1487
+ * @ignore
1488
+ */
1489
+ _generateShaderSync(e, r) {
1490
+ return Qe(e, r);
1491
+ }
1492
+ resetState() {
1493
+ this._activeProgram = null;
1494
+ }
1495
+ }
1496
+ de.extension = {
1497
+ type: [
1498
+ d.WebGLSystem
1499
+ ],
1500
+ name: "shader"
1501
+ };
1502
+ const ot = {
1503
+ f32: `if (cv !== v) {
1504
+ cu.value = v;
1505
+ gl.uniform1f(location, v);
1506
+ }`,
1507
+ "vec2<f32>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
1508
+ cv[0] = v[0];
1509
+ cv[1] = v[1];
1510
+ gl.uniform2f(location, v[0], v[1]);
1511
+ }`,
1512
+ "vec3<f32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
1513
+ cv[0] = v[0];
1514
+ cv[1] = v[1];
1515
+ cv[2] = v[2];
1516
+ gl.uniform3f(location, v[0], v[1], v[2]);
1517
+ }`,
1518
+ "vec4<f32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
1519
+ cv[0] = v[0];
1520
+ cv[1] = v[1];
1521
+ cv[2] = v[2];
1522
+ cv[3] = v[3];
1523
+ gl.uniform4f(location, v[0], v[1], v[2], v[3]);
1524
+ }`,
1525
+ i32: `if (cv !== v) {
1526
+ cu.value = v;
1527
+ gl.uniform1i(location, v);
1528
+ }`,
1529
+ "vec2<i32>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
1530
+ cv[0] = v[0];
1531
+ cv[1] = v[1];
1532
+ gl.uniform2i(location, v[0], v[1]);
1533
+ }`,
1534
+ "vec3<i32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
1535
+ cv[0] = v[0];
1536
+ cv[1] = v[1];
1537
+ cv[2] = v[2];
1538
+ gl.uniform3i(location, v[0], v[1], v[2]);
1539
+ }`,
1540
+ "vec4<i32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
1541
+ cv[0] = v[0];
1542
+ cv[1] = v[1];
1543
+ cv[2] = v[2];
1544
+ cv[3] = v[3];
1545
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
1546
+ }`,
1547
+ u32: `if (cv !== v) {
1548
+ cu.value = v;
1549
+ gl.uniform1ui(location, v);
1550
+ }`,
1551
+ "vec2<u32>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
1552
+ cv[0] = v[0];
1553
+ cv[1] = v[1];
1554
+ gl.uniform2ui(location, v[0], v[1]);
1555
+ }`,
1556
+ "vec3<u32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
1557
+ cv[0] = v[0];
1558
+ cv[1] = v[1];
1559
+ cv[2] = v[2];
1560
+ gl.uniform3ui(location, v[0], v[1], v[2]);
1561
+ }`,
1562
+ "vec4<u32>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
1563
+ cv[0] = v[0];
1564
+ cv[1] = v[1];
1565
+ cv[2] = v[2];
1566
+ cv[3] = v[3];
1567
+ gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
1568
+ }`,
1569
+ bool: `if (cv !== v) {
1570
+ cu.value = v;
1571
+ gl.uniform1i(location, v);
1572
+ }`,
1573
+ "vec2<bool>": `if (cv[0] !== v[0] || cv[1] !== v[1]) {
1574
+ cv[0] = v[0];
1575
+ cv[1] = v[1];
1576
+ gl.uniform2i(location, v[0], v[1]);
1577
+ }`,
1578
+ "vec3<bool>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
1579
+ cv[0] = v[0];
1580
+ cv[1] = v[1];
1581
+ cv[2] = v[2];
1582
+ gl.uniform3i(location, v[0], v[1], v[2]);
1583
+ }`,
1584
+ "vec4<bool>": `if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
1585
+ cv[0] = v[0];
1586
+ cv[1] = v[1];
1587
+ cv[2] = v[2];
1588
+ cv[3] = v[3];
1589
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
1590
+ }`,
1591
+ "mat2x2<f32>": "gl.uniformMatrix2fv(location, false, v);",
1592
+ "mat3x3<f32>": "gl.uniformMatrix3fv(location, false, v);",
1593
+ "mat4x4<f32>": "gl.uniformMatrix4fv(location, false, v);"
1594
+ }, ct = {
1595
+ f32: "gl.uniform1fv(location, v);",
1596
+ "vec2<f32>": "gl.uniform2fv(location, v);",
1597
+ "vec3<f32>": "gl.uniform3fv(location, v);",
1598
+ "vec4<f32>": "gl.uniform4fv(location, v);",
1599
+ "mat2x2<f32>": "gl.uniformMatrix2fv(location, false, v);",
1600
+ "mat3x3<f32>": "gl.uniformMatrix3fv(location, false, v);",
1601
+ "mat4x4<f32>": "gl.uniformMatrix4fv(location, false, v);",
1602
+ i32: "gl.uniform1iv(location, v);",
1603
+ "vec2<i32>": "gl.uniform2iv(location, v);",
1604
+ "vec3<i32>": "gl.uniform3iv(location, v);",
1605
+ "vec4<i32>": "gl.uniform4iv(location, v);",
1606
+ u32: "gl.uniform1iv(location, v);",
1607
+ "vec2<u32>": "gl.uniform2iv(location, v);",
1608
+ "vec3<u32>": "gl.uniform3iv(location, v);",
1609
+ "vec4<u32>": "gl.uniform4iv(location, v);",
1610
+ bool: "gl.uniform1iv(location, v);",
1611
+ "vec2<bool>": "gl.uniform2iv(location, v);",
1612
+ "vec3<bool>": "gl.uniform3iv(location, v);",
1613
+ "vec4<bool>": "gl.uniform4iv(location, v);"
1614
+ };
1615
+ function ut(t, e) {
1616
+ const r = [`
1617
+ var v = null;
1618
+ var cv = null;
1619
+ var cu = null;
1620
+ var t = 0;
1621
+ var gl = renderer.gl;
1622
+ var name = null;
1623
+ `];
1624
+ for (const s in t.uniforms) {
1625
+ if (!e[s]) {
1626
+ t.uniforms[s] instanceof F ? t.uniforms[s].ubo ? r.push(`
1627
+ renderer.shader.bindUniformBlock(uv.${s}, "${s}");
1628
+ `) : r.push(`
1629
+ renderer.shader.updateUniformGroup(uv.${s});
1630
+ `) : t.uniforms[s] instanceof J && r.push(`
1631
+ renderer.shader.bindBufferResource(uv.${s}, "${s}");
1632
+ `);
1633
+ continue;
1634
+ }
1635
+ const n = t.uniformStructures[s];
1636
+ let i = !1;
1637
+ for (let a = 0; a < y.length; a++) {
1638
+ const o = y[a];
1639
+ if (n.type === o.type && o.test(n)) {
1640
+ r.push(`name = "${s}";`, y[a].uniform), i = !0;
1641
+ break;
1642
+ }
1643
+ }
1644
+ if (!i) {
1645
+ const o = (n.size === 1 ? ot : ct)[n.type].replace("location", `ud["${s}"].location`);
1646
+ r.push(`
1647
+ cu = ud["${s}"];
1648
+ cv = cu.value;
1649
+ v = uv["${s}"];
1650
+ ${o};`);
1651
+ }
1652
+ }
1653
+ return new Function("ud", "uv", "renderer", "syncData", r.join(`
1654
+ `));
1655
+ }
1656
+ class me {
1657
+ /** @param renderer - The renderer this System works for. */
1658
+ constructor(e) {
1659
+ this._cache = {}, this._uniformGroupSyncHash = {}, this._renderer = e, this.gl = null, this._cache = {};
1660
+ }
1661
+ contextChange(e) {
1662
+ this.gl = e;
1663
+ }
1664
+ /**
1665
+ * Uploads the uniforms values to the currently bound shader.
1666
+ * @param group - the uniforms values that be applied to the current shader
1667
+ * @param program
1668
+ * @param syncData
1669
+ * @param syncData.textureCount
1670
+ */
1671
+ updateUniformGroup(e, r, s) {
1672
+ const n = this._renderer.shader._getProgramData(r);
1673
+ (!e.isStatic || e._dirtyId !== n.uniformDirtyGroups[e.uid]) && (n.uniformDirtyGroups[e.uid] = e._dirtyId, this._getUniformSyncFunction(e, r)(n.uniformData, e.uniforms, this._renderer, s));
1674
+ }
1675
+ /**
1676
+ * Overridable by the pixi.js/unsafe-eval package to use static syncUniforms instead.
1677
+ * @param group
1678
+ * @param program
1679
+ */
1680
+ _getUniformSyncFunction(e, r) {
1681
+ var s;
1682
+ return ((s = this._uniformGroupSyncHash[e._signature]) == null ? void 0 : s[r._key]) || this._createUniformSyncFunction(e, r);
1683
+ }
1684
+ _createUniformSyncFunction(e, r) {
1685
+ const s = this._uniformGroupSyncHash[e._signature] || (this._uniformGroupSyncHash[e._signature] = {}), n = this._getSignature(e, r._uniformData, "u");
1686
+ return this._cache[n] || (this._cache[n] = this._generateUniformsSync(e, r._uniformData)), s[r._key] = this._cache[n], s[r._key];
1687
+ }
1688
+ _generateUniformsSync(e, r) {
1689
+ return ut(e, r);
1690
+ }
1691
+ /**
1692
+ * Takes a uniform group and data and generates a unique signature for them.
1693
+ * @param group - The uniform group to get signature of
1694
+ * @param group.uniforms
1695
+ * @param uniformData - Uniform information generated by the shader
1696
+ * @param preFix
1697
+ * @returns Unique signature of the uniform group
1698
+ */
1699
+ _getSignature(e, r, s) {
1700
+ const n = e.uniforms, i = [`${s}-`];
1701
+ for (const a in n)
1702
+ i.push(a), r[a] && i.push(r[a].type);
1703
+ return i.join("-");
1704
+ }
1705
+ /** Destroys this System and removes all its textures. */
1706
+ destroy() {
1707
+ this._renderer = null, this._cache = null;
1708
+ }
1709
+ }
1710
+ me.extension = {
1711
+ type: [
1712
+ d.WebGLSystem
1713
+ ],
1714
+ name: "uniformGroup"
1715
+ };
1716
+ function _t(t) {
1717
+ const e = {};
1718
+ if (e.normal = [t.ONE, t.ONE_MINUS_SRC_ALPHA], e.add = [t.ONE, t.ONE], e.multiply = [t.DST_COLOR, t.ONE_MINUS_SRC_ALPHA, t.ONE, t.ONE_MINUS_SRC_ALPHA], e.screen = [t.ONE, t.ONE_MINUS_SRC_COLOR, t.ONE, t.ONE_MINUS_SRC_ALPHA], e.none = [0, 0], e["normal-npm"] = [t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA, t.ONE, t.ONE_MINUS_SRC_ALPHA], e["add-npm"] = [t.SRC_ALPHA, t.ONE, t.ONE, t.ONE], e["screen-npm"] = [t.SRC_ALPHA, t.ONE_MINUS_SRC_COLOR, t.ONE, t.ONE_MINUS_SRC_ALPHA], e.erase = [t.ZERO, t.ONE_MINUS_SRC_ALPHA], !(t instanceof S.get().getWebGLRenderingContext()))
1719
+ e.min = [t.ONE, t.ONE, t.ONE, t.ONE, t.MIN, t.MIN], e.max = [t.ONE, t.ONE, t.ONE, t.ONE, t.MAX, t.MAX];
1720
+ else {
1721
+ const s = t.getExtension("EXT_blend_minmax");
1722
+ s && (e.min = [t.ONE, t.ONE, t.ONE, t.ONE, s.MIN_EXT, s.MIN_EXT], e.max = [t.ONE, t.ONE, t.ONE, t.ONE, s.MAX_EXT, s.MAX_EXT]);
1723
+ }
1724
+ return e;
1725
+ }
1726
+ const ft = 0, ht = 1, lt = 2, dt = 3, mt = 4, Et = 5, Ee = class G {
1727
+ constructor(e) {
1728
+ this._invertFrontFace = !1, this.gl = null, this.stateId = 0, this.polygonOffset = 0, this.blendMode = "none", this._blendEq = !1, this.map = [], this.map[ft] = this.setBlend, this.map[ht] = this.setOffset, this.map[lt] = this.setCullFace, this.map[dt] = this.setDepthTest, this.map[mt] = this.setFrontFace, this.map[Et] = this.setDepthMask, this.checks = [], this.defaultState = O.for2d(), e.renderTarget.onRenderTargetChange.add(this);
1729
+ }
1730
+ onRenderTargetChange(e) {
1731
+ this._invertFrontFace = !e.isRoot, this._cullFace ? this.setFrontFace(this._frontFace) : this._frontFaceDirty = !0;
1732
+ }
1733
+ contextChange(e) {
1734
+ this.gl = e, this.blendModesMap = _t(e), this.resetState();
1735
+ }
1736
+ /**
1737
+ * Sets the current state
1738
+ * @param {*} state - The state to set.
1739
+ */
1740
+ set(e) {
1741
+ if (e || (e = this.defaultState), this.stateId !== e.data) {
1742
+ let r = this.stateId ^ e.data, s = 0;
1743
+ for (; r; )
1744
+ r & 1 && this.map[s].call(this, !!(e.data & 1 << s)), r >>= 1, s++;
1745
+ this.stateId = e.data;
1746
+ }
1747
+ for (let r = 0; r < this.checks.length; r++)
1748
+ this.checks[r](this, e);
1749
+ }
1750
+ /**
1751
+ * Sets the state, when previous state is unknown.
1752
+ * @param {*} state - The state to set
1753
+ */
1754
+ forceState(e) {
1755
+ e || (e = this.defaultState);
1756
+ for (let r = 0; r < this.map.length; r++)
1757
+ this.map[r].call(this, !!(e.data & 1 << r));
1758
+ for (let r = 0; r < this.checks.length; r++)
1759
+ this.checks[r](this, e);
1760
+ this.stateId = e.data;
1761
+ }
1762
+ /**
1763
+ * Sets whether to enable or disable blending.
1764
+ * @param value - Turn on or off WebGl blending.
1765
+ */
1766
+ setBlend(e) {
1767
+ this._updateCheck(G._checkBlendMode, e), this.gl[e ? "enable" : "disable"](this.gl.BLEND);
1768
+ }
1769
+ /**
1770
+ * Sets whether to enable or disable polygon offset fill.
1771
+ * @param value - Turn on or off webgl polygon offset testing.
1772
+ */
1773
+ setOffset(e) {
1774
+ this._updateCheck(G._checkPolygonOffset, e), this.gl[e ? "enable" : "disable"](this.gl.POLYGON_OFFSET_FILL);
1775
+ }
1776
+ /**
1777
+ * Sets whether to enable or disable depth test.
1778
+ * @param value - Turn on or off webgl depth testing.
1779
+ */
1780
+ setDepthTest(e) {
1781
+ this.gl[e ? "enable" : "disable"](this.gl.DEPTH_TEST);
1782
+ }
1783
+ /**
1784
+ * Sets whether to enable or disable depth mask.
1785
+ * @param value - Turn on or off webgl depth mask.
1786
+ */
1787
+ setDepthMask(e) {
1788
+ this.gl.depthMask(e);
1789
+ }
1790
+ /**
1791
+ * Sets whether to enable or disable cull face.
1792
+ * @param {boolean} value - Turn on or off webgl cull face.
1793
+ */
1794
+ setCullFace(e) {
1795
+ this._cullFace = e, this.gl[e ? "enable" : "disable"](this.gl.CULL_FACE), this._cullFace && this._frontFaceDirty && this.setFrontFace(this._frontFace);
1796
+ }
1797
+ /**
1798
+ * Sets the gl front face.
1799
+ * @param {boolean} value - true is clockwise and false is counter-clockwise
1800
+ */
1801
+ setFrontFace(e) {
1802
+ this._frontFace = e, this._frontFaceDirty = !1;
1803
+ const r = this._invertFrontFace ? !e : e;
1804
+ this._glFrontFace !== r && (this._glFrontFace = r, this.gl.frontFace(this.gl[r ? "CW" : "CCW"]));
1805
+ }
1806
+ /**
1807
+ * Sets the blend mode.
1808
+ * @param {number} value - The blend mode to set to.
1809
+ */
1810
+ setBlendMode(e) {
1811
+ if (this.blendModesMap[e] || (e = "normal"), e === this.blendMode)
1812
+ return;
1813
+ this.blendMode = e;
1814
+ const r = this.blendModesMap[e], s = this.gl;
1815
+ r.length === 2 ? s.blendFunc(r[0], r[1]) : s.blendFuncSeparate(r[0], r[1], r[2], r[3]), r.length === 6 ? (this._blendEq = !0, s.blendEquationSeparate(r[4], r[5])) : this._blendEq && (this._blendEq = !1, s.blendEquationSeparate(s.FUNC_ADD, s.FUNC_ADD));
1816
+ }
1817
+ /**
1818
+ * Sets the polygon offset.
1819
+ * @param {number} value - the polygon offset
1820
+ * @param {number} scale - the polygon offset scale
1821
+ */
1822
+ setPolygonOffset(e, r) {
1823
+ this.gl.polygonOffset(e, r);
1824
+ }
1825
+ // used
1826
+ /** Resets all the logic and disables the VAOs. */
1827
+ resetState() {
1828
+ this._glFrontFace = !1, this._frontFace = !1, this._cullFace = !1, this._frontFaceDirty = !1, this._invertFrontFace = !1, this.gl.frontFace(this.gl.CCW), this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, !1), this.forceState(this.defaultState), this._blendEq = !0, this.blendMode = "", this.setBlendMode("normal");
1829
+ }
1830
+ /**
1831
+ * Checks to see which updates should be checked based on which settings have been activated.
1832
+ *
1833
+ * For example, if blend is enabled then we should check the blend modes each time the state is changed
1834
+ * or if polygon fill is activated then we need to check if the polygon offset changes.
1835
+ * The idea is that we only check what we have too.
1836
+ * @param func - the checking function to add or remove
1837
+ * @param value - should the check function be added or removed.
1838
+ */
1839
+ _updateCheck(e, r) {
1840
+ const s = this.checks.indexOf(e);
1841
+ r && s === -1 ? this.checks.push(e) : !r && s !== -1 && this.checks.splice(s, 1);
1842
+ }
1843
+ /**
1844
+ * A private little wrapper function that we call to check the blend mode.
1845
+ * @param system - the System to perform the state check on
1846
+ * @param state - the state that the blendMode will pulled from
1847
+ */
1848
+ static _checkBlendMode(e, r) {
1849
+ e.setBlendMode(r.blendMode);
1850
+ }
1851
+ /**
1852
+ * A private little wrapper function that we call to check the polygon offset.
1853
+ * @param system - the System to perform the state check on
1854
+ * @param state - the state that the blendMode will pulled from
1855
+ */
1856
+ static _checkPolygonOffset(e, r) {
1857
+ e.setPolygonOffset(1, r.polygonOffset);
1858
+ }
1859
+ /**
1860
+ * @ignore
1861
+ */
1862
+ destroy() {
1863
+ this.gl = null, this.checks.length = 0;
1864
+ }
1865
+ };
1866
+ Ee.extension = {
1867
+ type: [
1868
+ d.WebGLSystem
1869
+ ],
1870
+ name: "state"
1871
+ };
1872
+ let bt = Ee;
1873
+ class St {
1874
+ constructor(e) {
1875
+ this.target = se.TEXTURE_2D, this.texture = e, this.width = -1, this.height = -1, this.type = f.UNSIGNED_BYTE, this.internalFormat = I.RGBA, this.format = I.RGBA, this.samplerType = 0;
1876
+ }
1877
+ }
1878
+ const pt = {
1879
+ id: "buffer",
1880
+ upload(t, e, r) {
1881
+ e.width === t.width || e.height === t.height ? r.texSubImage2D(
1882
+ r.TEXTURE_2D,
1883
+ 0,
1884
+ 0,
1885
+ 0,
1886
+ t.width,
1887
+ t.height,
1888
+ e.format,
1889
+ e.type,
1890
+ t.resource
1891
+ ) : r.texImage2D(
1892
+ e.target,
1893
+ 0,
1894
+ e.internalFormat,
1895
+ t.width,
1896
+ t.height,
1897
+ 0,
1898
+ e.format,
1899
+ e.type,
1900
+ t.resource
1901
+ ), e.width = t.width, e.height = t.height;
1902
+ }
1903
+ }, gt = {
1904
+ "bc1-rgba-unorm": !0,
1905
+ "bc1-rgba-unorm-srgb": !0,
1906
+ "bc2-rgba-unorm": !0,
1907
+ "bc2-rgba-unorm-srgb": !0,
1908
+ "bc3-rgba-unorm": !0,
1909
+ "bc3-rgba-unorm-srgb": !0,
1910
+ "bc4-r-unorm": !0,
1911
+ "bc4-r-snorm": !0,
1912
+ "bc5-rg-unorm": !0,
1913
+ "bc5-rg-snorm": !0,
1914
+ "bc6h-rgb-ufloat": !0,
1915
+ "bc6h-rgb-float": !0,
1916
+ "bc7-rgba-unorm": !0,
1917
+ "bc7-rgba-unorm-srgb": !0,
1918
+ // ETC2 compressed formats usable if "texture-compression-etc2" is both
1919
+ // supported by the device/user agent and enabled in requestDevice.
1920
+ "etc2-rgb8unorm": !0,
1921
+ "etc2-rgb8unorm-srgb": !0,
1922
+ "etc2-rgb8a1unorm": !0,
1923
+ "etc2-rgb8a1unorm-srgb": !0,
1924
+ "etc2-rgba8unorm": !0,
1925
+ "etc2-rgba8unorm-srgb": !0,
1926
+ "eac-r11unorm": !0,
1927
+ "eac-r11snorm": !0,
1928
+ "eac-rg11unorm": !0,
1929
+ "eac-rg11snorm": !0,
1930
+ // ASTC compressed formats usable if "texture-compression-astc" is both
1931
+ // supported by the device/user agent and enabled in requestDevice.
1932
+ "astc-4x4-unorm": !0,
1933
+ "astc-4x4-unorm-srgb": !0,
1934
+ "astc-5x4-unorm": !0,
1935
+ "astc-5x4-unorm-srgb": !0,
1936
+ "astc-5x5-unorm": !0,
1937
+ "astc-5x5-unorm-srgb": !0,
1938
+ "astc-6x5-unorm": !0,
1939
+ "astc-6x5-unorm-srgb": !0,
1940
+ "astc-6x6-unorm": !0,
1941
+ "astc-6x6-unorm-srgb": !0,
1942
+ "astc-8x5-unorm": !0,
1943
+ "astc-8x5-unorm-srgb": !0,
1944
+ "astc-8x6-unorm": !0,
1945
+ "astc-8x6-unorm-srgb": !0,
1946
+ "astc-8x8-unorm": !0,
1947
+ "astc-8x8-unorm-srgb": !0,
1948
+ "astc-10x5-unorm": !0,
1949
+ "astc-10x5-unorm-srgb": !0,
1950
+ "astc-10x6-unorm": !0,
1951
+ "astc-10x6-unorm-srgb": !0,
1952
+ "astc-10x8-unorm": !0,
1953
+ "astc-10x8-unorm-srgb": !0,
1954
+ "astc-10x10-unorm": !0,
1955
+ "astc-10x10-unorm-srgb": !0,
1956
+ "astc-12x10-unorm": !0,
1957
+ "astc-12x10-unorm-srgb": !0,
1958
+ "astc-12x12-unorm": !0,
1959
+ "astc-12x12-unorm-srgb": !0
1960
+ }, Rt = {
1961
+ id: "compressed",
1962
+ upload(t, e, r) {
1963
+ r.pixelStorei(r.UNPACK_ALIGNMENT, 4);
1964
+ let s = t.pixelWidth, n = t.pixelHeight;
1965
+ const i = !!gt[t.format];
1966
+ for (let a = 0; a < t.resource.length; a++) {
1967
+ const o = t.resource[a];
1968
+ i ? r.compressedTexImage2D(
1969
+ r.TEXTURE_2D,
1970
+ a,
1971
+ e.internalFormat,
1972
+ s,
1973
+ n,
1974
+ 0,
1975
+ o
1976
+ ) : r.texImage2D(
1977
+ r.TEXTURE_2D,
1978
+ a,
1979
+ e.internalFormat,
1980
+ s,
1981
+ n,
1982
+ 0,
1983
+ e.format,
1984
+ e.type,
1985
+ o
1986
+ ), s = Math.max(s >> 1, 1), n = Math.max(n >> 1, 1);
1987
+ }
1988
+ }
1989
+ }, be = {
1990
+ id: "image",
1991
+ upload(t, e, r, s) {
1992
+ const n = e.width, i = e.height, a = t.pixelWidth, o = t.pixelHeight, c = t.resourceWidth, u = t.resourceHeight;
1993
+ c < a || u < o ? ((n !== a || i !== o) && r.texImage2D(
1994
+ e.target,
1995
+ 0,
1996
+ e.internalFormat,
1997
+ a,
1998
+ o,
1999
+ 0,
2000
+ e.format,
2001
+ e.type,
2002
+ null
2003
+ ), s === 2 ? r.texSubImage2D(
2004
+ r.TEXTURE_2D,
2005
+ 0,
2006
+ 0,
2007
+ 0,
2008
+ c,
2009
+ u,
2010
+ e.format,
2011
+ e.type,
2012
+ t.resource
2013
+ ) : r.texSubImage2D(
2014
+ r.TEXTURE_2D,
2015
+ 0,
2016
+ 0,
2017
+ 0,
2018
+ e.format,
2019
+ e.type,
2020
+ t.resource
2021
+ )) : n === a && i === o ? r.texSubImage2D(
2022
+ r.TEXTURE_2D,
2023
+ 0,
2024
+ 0,
2025
+ 0,
2026
+ e.format,
2027
+ e.type,
2028
+ t.resource
2029
+ ) : s === 2 ? r.texImage2D(
2030
+ e.target,
2031
+ 0,
2032
+ e.internalFormat,
2033
+ a,
2034
+ o,
2035
+ 0,
2036
+ e.format,
2037
+ e.type,
2038
+ t.resource
2039
+ ) : r.texImage2D(
2040
+ e.target,
2041
+ 0,
2042
+ e.internalFormat,
2043
+ e.format,
2044
+ e.type,
2045
+ t.resource
2046
+ ), e.width = a, e.height = o;
2047
+ }
2048
+ }, vt = {
2049
+ id: "video",
2050
+ upload(t, e, r, s) {
2051
+ if (!t.isValid) {
2052
+ r.texImage2D(
2053
+ e.target,
2054
+ 0,
2055
+ e.internalFormat,
2056
+ 1,
2057
+ 1,
2058
+ 0,
2059
+ e.format,
2060
+ e.type,
2061
+ null
2062
+ );
2063
+ return;
2064
+ }
2065
+ be.upload(t, e, r, s);
2066
+ }
2067
+ }, W = {
2068
+ linear: 9729,
2069
+ nearest: 9728
2070
+ }, xt = {
2071
+ linear: {
2072
+ linear: 9987,
2073
+ nearest: 9985
2074
+ },
2075
+ nearest: {
2076
+ linear: 9986,
2077
+ nearest: 9984
2078
+ }
2079
+ }, C = {
2080
+ "clamp-to-edge": 33071,
2081
+ repeat: 10497,
2082
+ "mirror-repeat": 33648
2083
+ }, Tt = {
2084
+ never: 512,
2085
+ less: 513,
2086
+ equal: 514,
2087
+ "less-equal": 515,
2088
+ greater: 516,
2089
+ "not-equal": 517,
2090
+ "greater-equal": 518,
2091
+ always: 519
2092
+ };
2093
+ function j(t, e, r, s, n, i, a, o) {
2094
+ const c = i;
2095
+ if (!o || t.addressModeU !== "repeat" || t.addressModeV !== "repeat" || t.addressModeW !== "repeat") {
2096
+ const u = C[a ? "clamp-to-edge" : t.addressModeU], _ = C[a ? "clamp-to-edge" : t.addressModeV], h = C[a ? "clamp-to-edge" : t.addressModeW];
2097
+ e[n](c, e.TEXTURE_WRAP_S, u), e[n](c, e.TEXTURE_WRAP_T, _), e.TEXTURE_WRAP_R && e[n](c, e.TEXTURE_WRAP_R, h);
2098
+ }
2099
+ if ((!o || t.magFilter !== "linear") && e[n](c, e.TEXTURE_MAG_FILTER, W[t.magFilter]), r) {
2100
+ if (!o || t.mipmapFilter !== "linear") {
2101
+ const u = xt[t.minFilter][t.mipmapFilter];
2102
+ e[n](c, e.TEXTURE_MIN_FILTER, u);
2103
+ }
2104
+ } else
2105
+ e[n](c, e.TEXTURE_MIN_FILTER, W[t.minFilter]);
2106
+ if (s && t.maxAnisotropy > 1) {
2107
+ const u = Math.min(t.maxAnisotropy, e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));
2108
+ e[n](c, s.TEXTURE_MAX_ANISOTROPY_EXT, u);
2109
+ }
2110
+ t.compare && e[n](c, e.TEXTURE_COMPARE_FUNC, Tt[t.compare]);
2111
+ }
2112
+ function Bt(t) {
2113
+ return {
2114
+ // 8-bit formats
2115
+ r8unorm: t.RED,
2116
+ r8snorm: t.RED,
2117
+ r8uint: t.RED,
2118
+ r8sint: t.RED,
2119
+ // 16-bit formats
2120
+ r16uint: t.RED,
2121
+ r16sint: t.RED,
2122
+ r16float: t.RED,
2123
+ rg8unorm: t.RG,
2124
+ rg8snorm: t.RG,
2125
+ rg8uint: t.RG,
2126
+ rg8sint: t.RG,
2127
+ // 32-bit formats
2128
+ r32uint: t.RED,
2129
+ r32sint: t.RED,
2130
+ r32float: t.RED,
2131
+ rg16uint: t.RG,
2132
+ rg16sint: t.RG,
2133
+ rg16float: t.RG,
2134
+ rgba8unorm: t.RGBA,
2135
+ "rgba8unorm-srgb": t.RGBA,
2136
+ // Packed 32-bit formats
2137
+ rgba8snorm: t.RGBA,
2138
+ rgba8uint: t.RGBA,
2139
+ rgba8sint: t.RGBA,
2140
+ bgra8unorm: t.RGBA,
2141
+ "bgra8unorm-srgb": t.RGBA,
2142
+ rgb9e5ufloat: t.RGB,
2143
+ rgb10a2unorm: t.RGBA,
2144
+ rg11b10ufloat: t.RGB,
2145
+ // 64-bit formats
2146
+ rg32uint: t.RG,
2147
+ rg32sint: t.RG,
2148
+ rg32float: t.RG,
2149
+ rgba16uint: t.RGBA,
2150
+ rgba16sint: t.RGBA,
2151
+ rgba16float: t.RGBA,
2152
+ // 128-bit formats
2153
+ rgba32uint: t.RGBA,
2154
+ rgba32sint: t.RGBA,
2155
+ rgba32float: t.RGBA,
2156
+ // Depth/stencil formats
2157
+ stencil8: t.STENCIL_INDEX8,
2158
+ depth16unorm: t.DEPTH_COMPONENT,
2159
+ depth24plus: t.DEPTH_COMPONENT,
2160
+ "depth24plus-stencil8": t.DEPTH_STENCIL,
2161
+ depth32float: t.DEPTH_COMPONENT,
2162
+ "depth32float-stencil8": t.DEPTH_STENCIL
2163
+ };
2164
+ }
2165
+ function At(t, e) {
2166
+ let r = {}, s = t.RGBA;
2167
+ return t instanceof S.get().getWebGLRenderingContext() ? e.srgb && (r = {
2168
+ "rgba8unorm-srgb": e.srgb.SRGB8_ALPHA8_EXT,
2169
+ "bgra8unorm-srgb": e.srgb.SRGB8_ALPHA8_EXT
2170
+ }) : (r = {
2171
+ "rgba8unorm-srgb": t.SRGB8_ALPHA8,
2172
+ "bgra8unorm-srgb": t.SRGB8_ALPHA8
2173
+ }, s = t.RGBA8), {
2174
+ // 8-bit formats
2175
+ r8unorm: t.R8,
2176
+ r8snorm: t.R8_SNORM,
2177
+ r8uint: t.R8UI,
2178
+ r8sint: t.R8I,
2179
+ // 16-bit formats
2180
+ r16uint: t.R16UI,
2181
+ r16sint: t.R16I,
2182
+ r16float: t.R16F,
2183
+ rg8unorm: t.RG8,
2184
+ rg8snorm: t.RG8_SNORM,
2185
+ rg8uint: t.RG8UI,
2186
+ rg8sint: t.RG8I,
2187
+ // 32-bit formats
2188
+ r32uint: t.R32UI,
2189
+ r32sint: t.R32I,
2190
+ r32float: t.R32F,
2191
+ rg16uint: t.RG16UI,
2192
+ rg16sint: t.RG16I,
2193
+ rg16float: t.RG16F,
2194
+ rgba8unorm: t.RGBA,
2195
+ ...r,
2196
+ // Packed 32-bit formats
2197
+ rgba8snorm: t.RGBA8_SNORM,
2198
+ rgba8uint: t.RGBA8UI,
2199
+ rgba8sint: t.RGBA8I,
2200
+ bgra8unorm: s,
2201
+ rgb9e5ufloat: t.RGB9_E5,
2202
+ rgb10a2unorm: t.RGB10_A2,
2203
+ rg11b10ufloat: t.R11F_G11F_B10F,
2204
+ // 64-bit formats
2205
+ rg32uint: t.RG32UI,
2206
+ rg32sint: t.RG32I,
2207
+ rg32float: t.RG32F,
2208
+ rgba16uint: t.RGBA16UI,
2209
+ rgba16sint: t.RGBA16I,
2210
+ rgba16float: t.RGBA16F,
2211
+ // 128-bit formats
2212
+ rgba32uint: t.RGBA32UI,
2213
+ rgba32sint: t.RGBA32I,
2214
+ rgba32float: t.RGBA32F,
2215
+ // Depth/stencil formats
2216
+ stencil8: t.STENCIL_INDEX8,
2217
+ depth16unorm: t.DEPTH_COMPONENT16,
2218
+ depth24plus: t.DEPTH_COMPONENT24,
2219
+ "depth24plus-stencil8": t.DEPTH24_STENCIL8,
2220
+ depth32float: t.DEPTH_COMPONENT32F,
2221
+ "depth32float-stencil8": t.DEPTH32F_STENCIL8,
2222
+ // Compressed formats
2223
+ ...e.s3tc ? {
2224
+ "bc1-rgba-unorm": e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,
2225
+ "bc2-rgba-unorm": e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,
2226
+ "bc3-rgba-unorm": e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT
2227
+ } : {},
2228
+ ...e.s3tc_sRGB ? {
2229
+ "bc1-rgba-unorm-srgb": e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
2230
+ "bc2-rgba-unorm-srgb": e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
2231
+ "bc3-rgba-unorm-srgb": e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
2232
+ } : {},
2233
+ ...e.rgtc ? {
2234
+ "bc4-r-unorm": e.rgtc.COMPRESSED_RED_RGTC1_EXT,
2235
+ "bc4-r-snorm": e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,
2236
+ "bc5-rg-unorm": e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,
2237
+ "bc5-rg-snorm": e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT
2238
+ } : {},
2239
+ ...e.bptc ? {
2240
+ "bc6h-rgb-float": e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
2241
+ "bc6h-rgb-ufloat": e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
2242
+ "bc7-rgba-unorm": e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,
2243
+ "bc7-rgba-unorm-srgb": e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT
2244
+ } : {},
2245
+ ...e.etc ? {
2246
+ "etc2-rgb8unorm": e.etc.COMPRESSED_RGB8_ETC2,
2247
+ "etc2-rgb8unorm-srgb": e.etc.COMPRESSED_SRGB8_ETC2,
2248
+ "etc2-rgb8a1unorm": e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
2249
+ "etc2-rgb8a1unorm-srgb": e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
2250
+ "etc2-rgba8unorm": e.etc.COMPRESSED_RGBA8_ETC2_EAC,
2251
+ "etc2-rgba8unorm-srgb": e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
2252
+ "eac-r11unorm": e.etc.COMPRESSED_R11_EAC,
2253
+ // 'eac-r11snorm'
2254
+ "eac-rg11unorm": e.etc.COMPRESSED_SIGNED_RG11_EAC
2255
+ // 'eac-rg11snorm'
2256
+ } : {},
2257
+ ...e.astc ? {
2258
+ "astc-4x4-unorm": e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,
2259
+ "astc-4x4-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
2260
+ "astc-5x4-unorm": e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,
2261
+ "astc-5x4-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
2262
+ "astc-5x5-unorm": e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,
2263
+ "astc-5x5-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
2264
+ "astc-6x5-unorm": e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,
2265
+ "astc-6x5-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
2266
+ "astc-6x6-unorm": e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,
2267
+ "astc-6x6-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
2268
+ "astc-8x5-unorm": e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,
2269
+ "astc-8x5-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
2270
+ "astc-8x6-unorm": e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,
2271
+ "astc-8x6-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
2272
+ "astc-8x8-unorm": e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,
2273
+ "astc-8x8-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
2274
+ "astc-10x5-unorm": e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,
2275
+ "astc-10x5-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
2276
+ "astc-10x6-unorm": e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,
2277
+ "astc-10x6-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
2278
+ "astc-10x8-unorm": e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,
2279
+ "astc-10x8-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
2280
+ "astc-10x10-unorm": e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,
2281
+ "astc-10x10-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
2282
+ "astc-12x10-unorm": e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,
2283
+ "astc-12x10-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
2284
+ "astc-12x12-unorm": e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,
2285
+ "astc-12x12-unorm-srgb": e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
2286
+ } : {}
2287
+ };
2288
+ }
2289
+ function Nt(t) {
2290
+ return {
2291
+ // 8-bit formats
2292
+ r8unorm: t.UNSIGNED_BYTE,
2293
+ r8snorm: t.BYTE,
2294
+ r8uint: t.UNSIGNED_BYTE,
2295
+ r8sint: t.BYTE,
2296
+ // 16-bit formats
2297
+ r16uint: t.UNSIGNED_SHORT,
2298
+ r16sint: t.SHORT,
2299
+ r16float: t.HALF_FLOAT,
2300
+ rg8unorm: t.UNSIGNED_BYTE,
2301
+ rg8snorm: t.BYTE,
2302
+ rg8uint: t.UNSIGNED_BYTE,
2303
+ rg8sint: t.BYTE,
2304
+ // 32-bit formats
2305
+ r32uint: t.UNSIGNED_INT,
2306
+ r32sint: t.INT,
2307
+ r32float: t.FLOAT,
2308
+ rg16uint: t.UNSIGNED_SHORT,
2309
+ rg16sint: t.SHORT,
2310
+ rg16float: t.HALF_FLOAT,
2311
+ rgba8unorm: t.UNSIGNED_BYTE,
2312
+ "rgba8unorm-srgb": t.UNSIGNED_BYTE,
2313
+ // Packed 32-bit formats
2314
+ rgba8snorm: t.BYTE,
2315
+ rgba8uint: t.UNSIGNED_BYTE,
2316
+ rgba8sint: t.BYTE,
2317
+ bgra8unorm: t.UNSIGNED_BYTE,
2318
+ "bgra8unorm-srgb": t.UNSIGNED_BYTE,
2319
+ rgb9e5ufloat: t.UNSIGNED_INT_5_9_9_9_REV,
2320
+ rgb10a2unorm: t.UNSIGNED_INT_2_10_10_10_REV,
2321
+ rg11b10ufloat: t.UNSIGNED_INT_10F_11F_11F_REV,
2322
+ // 64-bit formats
2323
+ rg32uint: t.UNSIGNED_INT,
2324
+ rg32sint: t.INT,
2325
+ rg32float: t.FLOAT,
2326
+ rgba16uint: t.UNSIGNED_SHORT,
2327
+ rgba16sint: t.SHORT,
2328
+ rgba16float: t.HALF_FLOAT,
2329
+ // 128-bit formats
2330
+ rgba32uint: t.UNSIGNED_INT,
2331
+ rgba32sint: t.INT,
2332
+ rgba32float: t.FLOAT,
2333
+ // Depth/stencil formats
2334
+ stencil8: t.UNSIGNED_BYTE,
2335
+ depth16unorm: t.UNSIGNED_SHORT,
2336
+ depth24plus: t.UNSIGNED_INT,
2337
+ "depth24plus-stencil8": t.UNSIGNED_INT_24_8,
2338
+ depth32float: t.FLOAT,
2339
+ "depth32float-stencil8": t.FLOAT_32_UNSIGNED_INT_24_8_REV
2340
+ };
2341
+ }
2342
+ const yt = 4;
2343
+ class Se {
2344
+ constructor(e) {
2345
+ this.managedTextures = [], this._glTextures = /* @__PURE__ */ Object.create(null), this._glSamplers = /* @__PURE__ */ Object.create(null), this._boundTextures = [], this._activeTextureLocation = -1, this._boundSamplers = /* @__PURE__ */ Object.create(null), this._uploads = {
2346
+ image: be,
2347
+ buffer: pt,
2348
+ video: vt,
2349
+ compressed: Rt
2350
+ }, this._premultiplyAlpha = !1, this._useSeparateSamplers = !1, this._renderer = e, this._renderer.renderableGC.addManagedHash(this, "_glTextures"), this._renderer.renderableGC.addManagedHash(this, "_glSamplers");
2351
+ }
2352
+ contextChange(e) {
2353
+ this._gl = e, this._mapFormatToInternalFormat || (this._mapFormatToInternalFormat = At(e, this._renderer.context.extensions), this._mapFormatToType = Nt(e), this._mapFormatToFormat = Bt(e)), this._glTextures = /* @__PURE__ */ Object.create(null), this._glSamplers = /* @__PURE__ */ Object.create(null), this._boundSamplers = /* @__PURE__ */ Object.create(null), this._premultiplyAlpha = !1;
2354
+ for (let r = 0; r < 16; r++)
2355
+ this.bind(b.EMPTY, r);
2356
+ }
2357
+ initSource(e) {
2358
+ this.bind(e);
2359
+ }
2360
+ bind(e, r = 0) {
2361
+ const s = e.source;
2362
+ e ? (this.bindSource(s, r), this._useSeparateSamplers && this._bindSampler(s.style, r)) : (this.bindSource(null, r), this._useSeparateSamplers && this._bindSampler(null, r));
2363
+ }
2364
+ bindSource(e, r = 0) {
2365
+ const s = this._gl;
2366
+ if (e._touched = this._renderer.textureGC.count, this._boundTextures[r] !== e) {
2367
+ this._boundTextures[r] = e, this._activateLocation(r), e || (e = b.EMPTY.source);
2368
+ const n = this.getGlSource(e);
2369
+ s.bindTexture(n.target, n.texture);
2370
+ }
2371
+ }
2372
+ _bindSampler(e, r = 0) {
2373
+ const s = this._gl;
2374
+ if (!e) {
2375
+ this._boundSamplers[r] = null, s.bindSampler(r, null);
2376
+ return;
2377
+ }
2378
+ const n = this._getGlSampler(e);
2379
+ this._boundSamplers[r] !== n && (this._boundSamplers[r] = n, s.bindSampler(r, n));
2380
+ }
2381
+ unbind(e) {
2382
+ const r = e.source, s = this._boundTextures, n = this._gl;
2383
+ for (let i = 0; i < s.length; i++)
2384
+ if (s[i] === r) {
2385
+ this._activateLocation(i);
2386
+ const a = this.getGlSource(r);
2387
+ n.bindTexture(a.target, null), s[i] = null;
2388
+ }
2389
+ }
2390
+ _activateLocation(e) {
2391
+ this._activeTextureLocation !== e && (this._activeTextureLocation = e, this._gl.activeTexture(this._gl.TEXTURE0 + e));
2392
+ }
2393
+ _initSource(e) {
2394
+ const r = this._gl, s = new St(r.createTexture());
2395
+ if (s.type = this._mapFormatToType[e.format], s.internalFormat = this._mapFormatToInternalFormat[e.format], s.format = this._mapFormatToFormat[e.format], e.autoGenerateMipmaps && (this._renderer.context.supports.nonPowOf2mipmaps || e.isPowerOfTwo)) {
2396
+ const n = Math.max(e.width, e.height);
2397
+ e.mipLevelCount = Math.floor(Math.log2(n)) + 1;
2398
+ }
2399
+ return this._glTextures[e.uid] = s, this.managedTextures.includes(e) || (e.on("update", this.onSourceUpdate, this), e.on("resize", this.onSourceUpdate, this), e.on("styleChange", this.onStyleChange, this), e.on("destroy", this.onSourceDestroy, this), e.on("unload", this.onSourceUnload, this), e.on("updateMipmaps", this.onUpdateMipmaps, this), this.managedTextures.push(e)), this.onSourceUpdate(e), this.updateStyle(e, !1), s;
2400
+ }
2401
+ onStyleChange(e) {
2402
+ this.updateStyle(e, !1);
2403
+ }
2404
+ updateStyle(e, r) {
2405
+ const s = this._gl, n = this.getGlSource(e);
2406
+ s.bindTexture(s.TEXTURE_2D, n.texture), this._boundTextures[this._activeTextureLocation] = e, j(
2407
+ e.style,
2408
+ s,
2409
+ e.mipLevelCount > 1,
2410
+ this._renderer.context.extensions.anisotropicFiltering,
2411
+ "texParameteri",
2412
+ s.TEXTURE_2D,
2413
+ // will force a clamp to edge if the texture is not a power of two
2414
+ !this._renderer.context.supports.nonPowOf2wrapping && !e.isPowerOfTwo,
2415
+ r
2416
+ );
2417
+ }
2418
+ onSourceUnload(e) {
2419
+ const r = this._glTextures[e.uid];
2420
+ r && (this.unbind(e), this._glTextures[e.uid] = null, this._gl.deleteTexture(r.texture));
2421
+ }
2422
+ onSourceUpdate(e) {
2423
+ const r = this._gl, s = this.getGlSource(e);
2424
+ r.bindTexture(r.TEXTURE_2D, s.texture), this._boundTextures[this._activeTextureLocation] = e;
2425
+ const n = e.alphaMode === "premultiply-alpha-on-upload";
2426
+ this._premultiplyAlpha !== n && (this._premultiplyAlpha = n, r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n)), this._uploads[e.uploadMethodId] ? this._uploads[e.uploadMethodId].upload(e, s, r, this._renderer.context.webGLVersion) : r.texImage2D(r.TEXTURE_2D, 0, r.RGBA, e.pixelWidth, e.pixelHeight, 0, r.RGBA, r.UNSIGNED_BYTE, null), e.autoGenerateMipmaps && e.mipLevelCount > 1 && this.onUpdateMipmaps(e, !1);
2427
+ }
2428
+ onUpdateMipmaps(e, r = !0) {
2429
+ r && this.bindSource(e, 0);
2430
+ const s = this.getGlSource(e);
2431
+ this._gl.generateMipmap(s.target);
2432
+ }
2433
+ onSourceDestroy(e) {
2434
+ e.off("destroy", this.onSourceDestroy, this), e.off("update", this.onSourceUpdate, this), e.off("resize", this.onSourceUpdate, this), e.off("unload", this.onSourceUnload, this), e.off("styleChange", this.onStyleChange, this), e.off("updateMipmaps", this.onUpdateMipmaps, this), this.managedTextures.splice(this.managedTextures.indexOf(e), 1), this.onSourceUnload(e);
2435
+ }
2436
+ _initSampler(e) {
2437
+ const r = this._gl, s = this._gl.createSampler();
2438
+ return this._glSamplers[e._resourceId] = s, j(
2439
+ e,
2440
+ r,
2441
+ this._boundTextures[this._activeTextureLocation].mipLevelCount > 1,
2442
+ this._renderer.context.extensions.anisotropicFiltering,
2443
+ "samplerParameteri",
2444
+ s,
2445
+ !1,
2446
+ !0
2447
+ ), this._glSamplers[e._resourceId];
2448
+ }
2449
+ _getGlSampler(e) {
2450
+ return this._glSamplers[e._resourceId] || this._initSampler(e);
2451
+ }
2452
+ getGlSource(e) {
2453
+ return this._glTextures[e.uid] || this._initSource(e);
2454
+ }
2455
+ generateCanvas(e) {
2456
+ const { pixels: r, width: s, height: n } = this.getPixels(e), i = S.get().createCanvas();
2457
+ i.width = s, i.height = n;
2458
+ const a = i.getContext("2d");
2459
+ if (a) {
2460
+ const o = a.createImageData(s, n);
2461
+ o.data.set(r), a.putImageData(o, 0, 0);
2462
+ }
2463
+ return i;
2464
+ }
2465
+ getPixels(e) {
2466
+ const r = e.source.resolution, s = e.frame, n = Math.max(Math.round(s.width * r), 1), i = Math.max(Math.round(s.height * r), 1), a = new Uint8Array(yt * n * i), o = this._renderer, c = o.renderTarget.getRenderTarget(e), u = o.renderTarget.getGpuRenderTarget(c), _ = o.gl;
2467
+ return _.bindFramebuffer(_.FRAMEBUFFER, u.resolveTargetFramebuffer), _.readPixels(
2468
+ Math.round(s.x * r),
2469
+ Math.round(s.y * r),
2470
+ n,
2471
+ i,
2472
+ _.RGBA,
2473
+ _.UNSIGNED_BYTE,
2474
+ a
2475
+ ), { pixels: new Uint8ClampedArray(a.buffer), width: n, height: i };
2476
+ }
2477
+ destroy() {
2478
+ this.managedTextures.slice().forEach((e) => this.onSourceDestroy(e)), this.managedTextures = null, this._renderer = null;
2479
+ }
2480
+ resetState() {
2481
+ this._activeTextureLocation = -1, this._boundTextures.fill(b.EMPTY.source), this._boundSamplers = /* @__PURE__ */ Object.create(null);
2482
+ const e = this._gl;
2483
+ this._premultiplyAlpha = !1, e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this._premultiplyAlpha);
2484
+ }
2485
+ }
2486
+ Se.extension = {
2487
+ type: [
2488
+ d.WebGLSystem
2489
+ ],
2490
+ name: "texture"
2491
+ };
2492
+ class pe {
2493
+ init() {
2494
+ const e = new F({
2495
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
2496
+ uTransformMatrix: { value: new Y(), type: "mat3x3<f32>" },
2497
+ uRound: { value: 0, type: "f32" }
2498
+ }), r = z(), s = q({
2499
+ name: "graphics",
2500
+ bits: [
2501
+ Ne,
2502
+ ye(r),
2503
+ Q,
2504
+ Z
2505
+ ]
2506
+ });
2507
+ this.shader = new U({
2508
+ glProgram: s,
2509
+ resources: {
2510
+ localUniforms: e,
2511
+ batchSamplers: De(r)
2512
+ }
2513
+ });
2514
+ }
2515
+ execute(e, r) {
2516
+ const s = r.context, n = s.customShader || this.shader, i = e.renderer, a = i.graphicsContext, {
2517
+ batcher: o,
2518
+ instructions: c
2519
+ } = a.getContextRenderData(s);
2520
+ n.groups[0] = i.globalUniforms.bindGroup, i.state.set(e.state), i.shader.bind(n), i.geometry.bind(o.geometry, n.glProgram);
2521
+ const u = c.instructions;
2522
+ for (let _ = 0; _ < c.instructionSize; _++) {
2523
+ const h = u[_];
2524
+ if (h.size) {
2525
+ for (let l = 0; l < h.textures.count; l++)
2526
+ i.texture.bind(h.textures.textures[l], l);
2527
+ i.geometry.draw(h.topology, h.size, h.start);
2528
+ }
2529
+ }
2530
+ }
2531
+ destroy() {
2532
+ this.shader.destroy(!0), this.shader = null;
2533
+ }
2534
+ }
2535
+ pe.extension = {
2536
+ type: [
2537
+ d.WebGLPipesAdaptor
2538
+ ],
2539
+ name: "graphics"
2540
+ };
2541
+ class ge {
2542
+ init() {
2543
+ const e = q({
2544
+ name: "mesh",
2545
+ bits: [
2546
+ Q,
2547
+ Le,
2548
+ Z
2549
+ ]
2550
+ });
2551
+ this._shader = new U({
2552
+ glProgram: e,
2553
+ resources: {
2554
+ uTexture: b.EMPTY.source,
2555
+ textureUniforms: {
2556
+ uTextureMatrix: { type: "mat3x3<f32>", value: new Y() }
2557
+ }
2558
+ }
2559
+ });
2560
+ }
2561
+ execute(e, r) {
2562
+ const s = e.renderer;
2563
+ let n = r._shader;
2564
+ if (n) {
2565
+ if (!n.glProgram) {
2566
+ m("Mesh shader has no glProgram", r.shader);
2567
+ return;
2568
+ }
2569
+ } else {
2570
+ n = this._shader;
2571
+ const i = r.texture, a = i.source;
2572
+ n.resources.uTexture = a, n.resources.uSampler = a.style, n.resources.textureUniforms.uniforms.uTextureMatrix = i.textureMatrix.mapCoord;
2573
+ }
2574
+ n.groups[100] = s.globalUniforms.bindGroup, n.groups[101] = e.localUniformsBindGroup, s.encoder.draw({
2575
+ geometry: r._geometry,
2576
+ shader: n,
2577
+ state: r.state
2578
+ });
2579
+ }
2580
+ destroy() {
2581
+ this._shader.destroy(!0), this._shader = null;
2582
+ }
2583
+ }
2584
+ ge.extension = {
2585
+ type: [
2586
+ d.WebGLPipesAdaptor
2587
+ ],
2588
+ name: "mesh"
2589
+ };
2590
+ const Dt = [
2591
+ ...He,
2592
+ _e,
2593
+ Ke,
2594
+ ke,
2595
+ te,
2596
+ Se,
2597
+ fe,
2598
+ ne,
2599
+ me,
2600
+ de,
2601
+ oe,
2602
+ bt,
2603
+ ce,
2604
+ ae
2605
+ ], Ct = [...we], It = [ee, ge, pe], Re = [], ve = [], xe = [];
2606
+ x.handleByNamedList(d.WebGLSystem, Re);
2607
+ x.handleByNamedList(d.WebGLPipes, ve);
2608
+ x.handleByNamedList(d.WebGLPipesAdaptor, xe);
2609
+ x.add(...Dt, ...Ct, ...It);
2610
+ class Ot extends Ce {
2611
+ constructor() {
2612
+ const e = {
2613
+ name: "webgl",
2614
+ type: Ie.WEBGL,
2615
+ systems: Re,
2616
+ renderPipes: ve,
2617
+ renderPipeAdaptors: xe
2618
+ };
2619
+ super(e);
2620
+ }
2621
+ }
2622
+ export {
2623
+ Ot as WebGLRenderer
2624
+ };