@react-native/debugger-frontend 0.73.0-nightly-20230922-52104c6ee

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 (656) hide show
  1. package/BUILD_INFO +10 -0
  2. package/README.md +22 -0
  3. package/dist/third-party/LICENSE +28 -0
  4. package/dist/third-party/front_end/Images/3d-center.svg +1 -0
  5. package/dist/third-party/front_end/Images/3d-pan.svg +1 -0
  6. package/dist/third-party/front_end/Images/3d-rotate.svg +1 -0
  7. package/dist/third-party/front_end/Images/Images.js +223 -0
  8. package/dist/third-party/front_end/Images/accelerometer-back.svg +1 -0
  9. package/dist/third-party/front_end/Images/accelerometer-bottom.png +0 -0
  10. package/dist/third-party/front_end/Images/accelerometer-front.svg +1 -0
  11. package/dist/third-party/front_end/Images/accelerometer-left.png +0 -0
  12. package/dist/third-party/front_end/Images/accelerometer-right.png +0 -0
  13. package/dist/third-party/front_end/Images/accelerometer-top.png +0 -0
  14. package/dist/third-party/front_end/Images/align-content-center.svg +1 -0
  15. package/dist/third-party/front_end/Images/align-content-end.svg +1 -0
  16. package/dist/third-party/front_end/Images/align-content-space-around.svg +1 -0
  17. package/dist/third-party/front_end/Images/align-content-space-between.svg +1 -0
  18. package/dist/third-party/front_end/Images/align-content-space-evenly.svg +1 -0
  19. package/dist/third-party/front_end/Images/align-content-start.svg +1 -0
  20. package/dist/third-party/front_end/Images/align-content-stretch.svg +1 -0
  21. package/dist/third-party/front_end/Images/align-items-baseline.svg +1 -0
  22. package/dist/third-party/front_end/Images/align-items-center.svg +1 -0
  23. package/dist/third-party/front_end/Images/align-items-end.svg +1 -0
  24. package/dist/third-party/front_end/Images/align-items-start.svg +1 -0
  25. package/dist/third-party/front_end/Images/align-items-stretch.svg +1 -0
  26. package/dist/third-party/front_end/Images/align-self-center.svg +1 -0
  27. package/dist/third-party/front_end/Images/align-self-end.svg +1 -0
  28. package/dist/third-party/front_end/Images/align-self-start.svg +1 -0
  29. package/dist/third-party/front_end/Images/align-self-stretch.svg +1 -0
  30. package/dist/third-party/front_end/Images/arrow-down.svg +1 -0
  31. package/dist/third-party/front_end/Images/arrow-drop-down-dark.svg +1 -0
  32. package/dist/third-party/front_end/Images/arrow-drop-down-light.svg +1 -0
  33. package/dist/third-party/front_end/Images/arrow-up-down-circle.svg +1 -0
  34. package/dist/third-party/front_end/Images/arrow-up-down.svg +1 -0
  35. package/dist/third-party/front_end/Images/arrow-up.svg +1 -0
  36. package/dist/third-party/front_end/Images/bell.svg +1 -0
  37. package/dist/third-party/front_end/Images/bezier-curve-filled.svg +1 -0
  38. package/dist/third-party/front_end/Images/bin.svg +1 -0
  39. package/dist/third-party/front_end/Images/bottom-panel-close.svg +1 -0
  40. package/dist/third-party/front_end/Images/bottom-panel-open.svg +1 -0
  41. package/dist/third-party/front_end/Images/brackets.svg +1 -0
  42. package/dist/third-party/front_end/Images/breakpoint-circle.svg +1 -0
  43. package/dist/third-party/front_end/Images/breakpoint-crossed-filled.svg +1 -0
  44. package/dist/third-party/front_end/Images/breakpoint-crossed.svg +1 -0
  45. package/dist/third-party/front_end/Images/brush-filled.svg +1 -0
  46. package/dist/third-party/front_end/Images/brush.svg +1 -0
  47. package/dist/third-party/front_end/Images/bug.svg +1 -0
  48. package/dist/third-party/front_end/Images/bundle.svg +1 -0
  49. package/dist/third-party/front_end/Images/check-circle.svg +1 -0
  50. package/dist/third-party/front_end/Images/check-double.svg +1 -0
  51. package/dist/third-party/front_end/Images/checker.svg +1 -0
  52. package/dist/third-party/front_end/Images/checkmark.svg +1 -0
  53. package/dist/third-party/front_end/Images/chevron-double-right.svg +1 -0
  54. package/dist/third-party/front_end/Images/chevron-down.svg +1 -0
  55. package/dist/third-party/front_end/Images/chevron-left-dot.svg +1 -0
  56. package/dist/third-party/front_end/Images/chevron-left.svg +1 -0
  57. package/dist/third-party/front_end/Images/chevron-right.svg +1 -0
  58. package/dist/third-party/front_end/Images/chevron-up.svg +1 -0
  59. package/dist/third-party/front_end/Images/chromeLeft.avif +0 -0
  60. package/dist/third-party/front_end/Images/chromeMiddle.avif +0 -0
  61. package/dist/third-party/front_end/Images/chromeRight.avif +0 -0
  62. package/dist/third-party/front_end/Images/clear-list.svg +1 -0
  63. package/dist/third-party/front_end/Images/clear.svg +1 -0
  64. package/dist/third-party/front_end/Images/cloud.svg +1 -0
  65. package/dist/third-party/front_end/Images/code-circle.svg +1 -0
  66. package/dist/third-party/front_end/Images/code.svg +1 -0
  67. package/dist/third-party/front_end/Images/colon.svg +1 -0
  68. package/dist/third-party/front_end/Images/color-picker-filled.svg +1 -0
  69. package/dist/third-party/front_end/Images/color-picker.svg +1 -0
  70. package/dist/third-party/front_end/Images/console-conditional-breakpoint.svg +1 -0
  71. package/dist/third-party/front_end/Images/console-logpoint.svg +1 -0
  72. package/dist/third-party/front_end/Images/cookie.svg +1 -0
  73. package/dist/third-party/front_end/Images/copy.svg +1 -0
  74. package/dist/third-party/front_end/Images/credit-card.svg +1 -0
  75. package/dist/third-party/front_end/Images/cross-circle-filled.svg +1 -0
  76. package/dist/third-party/front_end/Images/cross-circle.svg +1 -0
  77. package/dist/third-party/front_end/Images/cross.svg +1 -0
  78. package/dist/third-party/front_end/Images/cssoverview_icons_2x.avif +0 -0
  79. package/dist/third-party/front_end/Images/custom-typography.svg +1 -0
  80. package/dist/third-party/front_end/Images/database.svg +1 -0
  81. package/dist/third-party/front_end/Images/deployed.svg +1 -0
  82. package/dist/third-party/front_end/Images/device-fold.svg +1 -0
  83. package/dist/third-party/front_end/Images/devices.svg +1 -0
  84. package/dist/third-party/front_end/Images/dock-bottom.svg +1 -0
  85. package/dist/third-party/front_end/Images/dock-left.svg +1 -0
  86. package/dist/third-party/front_end/Images/dock-right.svg +1 -0
  87. package/dist/third-party/front_end/Images/dock-window.svg +1 -0
  88. package/dist/third-party/front_end/Images/document.svg +1 -0
  89. package/dist/third-party/front_end/Images/dots-horizontal.svg +1 -0
  90. package/dist/third-party/front_end/Images/dots-vertical.svg +1 -0
  91. package/dist/third-party/front_end/Images/download.svg +1 -0
  92. package/dist/third-party/front_end/Images/edit.svg +1 -0
  93. package/dist/third-party/front_end/Images/empty.svg +1 -0
  94. package/dist/third-party/front_end/Images/errorWave.svg +1 -0
  95. package/dist/third-party/front_end/Images/exclamation.svg +1 -0
  96. package/dist/third-party/front_end/Images/experiment-check.svg +1 -0
  97. package/dist/third-party/front_end/Images/experiment.svg +1 -0
  98. package/dist/third-party/front_end/Images/eye.svg +1 -0
  99. package/dist/third-party/front_end/Images/file-document.svg +1 -0
  100. package/dist/third-party/front_end/Images/file-font.svg +1 -0
  101. package/dist/third-party/front_end/Images/file-generic.svg +1 -0
  102. package/dist/third-party/front_end/Images/file-image.svg +1 -0
  103. package/dist/third-party/front_end/Images/file-script.svg +1 -0
  104. package/dist/third-party/front_end/Images/file-snippet.svg +1 -0
  105. package/dist/third-party/front_end/Images/file-stylesheet.svg +1 -0
  106. package/dist/third-party/front_end/Images/filter-clear.svg +1 -0
  107. package/dist/third-party/front_end/Images/filter-filled.svg +1 -0
  108. package/dist/third-party/front_end/Images/filter.svg +1 -0
  109. package/dist/third-party/front_end/Images/flex-direction.svg +1 -0
  110. package/dist/third-party/front_end/Images/flex-no-wrap.svg +1 -0
  111. package/dist/third-party/front_end/Images/flex-wrap.svg +1 -0
  112. package/dist/third-party/front_end/Images/flow.svg +1 -0
  113. package/dist/third-party/front_end/Images/fold-more.svg +1 -0
  114. package/dist/third-party/front_end/Images/folder.svg +1 -0
  115. package/dist/third-party/front_end/Images/frame-crossed.svg +1 -0
  116. package/dist/third-party/front_end/Images/frame-icon.svg +1 -0
  117. package/dist/third-party/front_end/Images/frame.svg +1 -0
  118. package/dist/third-party/front_end/Images/gear-filled.svg +1 -0
  119. package/dist/third-party/front_end/Images/gear.svg +1 -0
  120. package/dist/third-party/front_end/Images/gears.svg +1 -0
  121. package/dist/third-party/front_end/Images/heap-snapshot.svg +1 -0
  122. package/dist/third-party/front_end/Images/heap-snapshots.svg +1 -0
  123. package/dist/third-party/front_end/Images/help.svg +1 -0
  124. package/dist/third-party/front_end/Images/iframe-crossed.svg +1 -0
  125. package/dist/third-party/front_end/Images/iframe.svg +1 -0
  126. package/dist/third-party/front_end/Images/import.svg +1 -0
  127. package/dist/third-party/front_end/Images/info-filled.svg +1 -0
  128. package/dist/third-party/front_end/Images/info.svg +1 -0
  129. package/dist/third-party/front_end/Images/issue-cross-filled.svg +1 -0
  130. package/dist/third-party/front_end/Images/issue-exclamation-filled.svg +1 -0
  131. package/dist/third-party/front_end/Images/issue-questionmark-filled.svg +1 -0
  132. package/dist/third-party/front_end/Images/issue-text-filled.svg +1 -0
  133. package/dist/third-party/front_end/Images/justify-content-center.svg +1 -0
  134. package/dist/third-party/front_end/Images/justify-content-end.svg +1 -0
  135. package/dist/third-party/front_end/Images/justify-content-space-around.svg +1 -0
  136. package/dist/third-party/front_end/Images/justify-content-space-between.svg +1 -0
  137. package/dist/third-party/front_end/Images/justify-content-space-evenly.svg +1 -0
  138. package/dist/third-party/front_end/Images/justify-content-start.svg +1 -0
  139. package/dist/third-party/front_end/Images/justify-items-center.svg +1 -0
  140. package/dist/third-party/front_end/Images/justify-items-end.svg +1 -0
  141. package/dist/third-party/front_end/Images/justify-items-start.svg +1 -0
  142. package/dist/third-party/front_end/Images/justify-items-stretch.svg +1 -0
  143. package/dist/third-party/front_end/Images/keyboard-pen.svg +1 -0
  144. package/dist/third-party/front_end/Images/large-arrow-right-filled.svg +1 -0
  145. package/dist/third-party/front_end/Images/largeIcons.svg +2 -0
  146. package/dist/third-party/front_end/Images/layers-filled.svg +1 -0
  147. package/dist/third-party/front_end/Images/layers.svg +1 -0
  148. package/dist/third-party/front_end/Images/left-panel-close.svg +1 -0
  149. package/dist/third-party/front_end/Images/left-panel-open.svg +1 -0
  150. package/dist/third-party/front_end/Images/lighthouse_logo.svg +1 -0
  151. package/dist/third-party/front_end/Images/list.svg +1 -0
  152. package/dist/third-party/front_end/Images/mediumIcons.svg +1 -0
  153. package/dist/third-party/front_end/Images/memory.svg +1 -0
  154. package/dist/third-party/front_end/Images/minus.svg +1 -0
  155. package/dist/third-party/front_end/Images/minus_icon.svg +1 -0
  156. package/dist/third-party/front_end/Images/navigationControls.png +0 -0
  157. package/dist/third-party/front_end/Images/navigationControls_2x.png +0 -0
  158. package/dist/third-party/front_end/Images/network-settings.svg +1 -0
  159. package/dist/third-party/front_end/Images/nodeIcon.avif +0 -0
  160. package/dist/third-party/front_end/Images/node_search_icon.svg +1 -0
  161. package/dist/third-party/front_end/Images/open-externally.svg +1 -0
  162. package/dist/third-party/front_end/Images/pause.svg +1 -0
  163. package/dist/third-party/front_end/Images/performance.svg +1 -0
  164. package/dist/third-party/front_end/Images/person.svg +1 -0
  165. package/dist/third-party/front_end/Images/play.svg +1 -0
  166. package/dist/third-party/front_end/Images/plus.svg +1 -0
  167. package/dist/third-party/front_end/Images/popoverArrows.png +0 -0
  168. package/dist/third-party/front_end/Images/popup.svg +1 -0
  169. package/dist/third-party/front_end/Images/preview_feature_video_thumbnail.svg +1 -0
  170. package/dist/third-party/front_end/Images/profile.svg +1 -0
  171. package/dist/third-party/front_end/Images/react_native/welcomeIcon.png +0 -0
  172. package/dist/third-party/front_end/Images/record-start.svg +1 -0
  173. package/dist/third-party/front_end/Images/record-stop.svg +1 -0
  174. package/dist/third-party/front_end/Images/redo.svg +1 -0
  175. package/dist/third-party/front_end/Images/refresh.svg +1 -0
  176. package/dist/third-party/front_end/Images/replace.svg +1 -0
  177. package/dist/third-party/front_end/Images/replay.svg +1 -0
  178. package/dist/third-party/front_end/Images/resizeDiagonal.svg +1 -0
  179. package/dist/third-party/front_end/Images/resizeHorizontal.svg +1 -0
  180. package/dist/third-party/front_end/Images/resizeVertical.svg +1 -0
  181. package/dist/third-party/front_end/Images/resume.svg +1 -0
  182. package/dist/third-party/front_end/Images/review.svg +1 -0
  183. package/dist/third-party/front_end/Images/right-panel-close.svg +1 -0
  184. package/dist/third-party/front_end/Images/right-panel-open.svg +1 -0
  185. package/dist/third-party/front_end/Images/screen-rotation.svg +1 -0
  186. package/dist/third-party/front_end/Images/search.svg +1 -0
  187. package/dist/third-party/front_end/Images/securityIcons.svg +1 -0
  188. package/dist/third-party/front_end/Images/select-element.svg +1 -0
  189. package/dist/third-party/front_end/Images/settings_14x14_icon.svg +1 -0
  190. package/dist/third-party/front_end/Images/shadow.svg +1 -0
  191. package/dist/third-party/front_end/Images/smallIcons.svg +1 -0
  192. package/dist/third-party/front_end/Images/snippet.svg +1 -0
  193. package/dist/third-party/front_end/Images/star.svg +1 -0
  194. package/dist/third-party/front_end/Images/step-into.svg +1 -0
  195. package/dist/third-party/front_end/Images/step-out.svg +1 -0
  196. package/dist/third-party/front_end/Images/step-over.svg +1 -0
  197. package/dist/third-party/front_end/Images/step.svg +1 -0
  198. package/dist/third-party/front_end/Images/stop.svg +1 -0
  199. package/dist/third-party/front_end/Images/symbol.svg +1 -0
  200. package/dist/third-party/front_end/Images/sync.svg +1 -0
  201. package/dist/third-party/front_end/Images/table.svg +1 -0
  202. package/dist/third-party/front_end/Images/toolbarResizerVertical.png +0 -0
  203. package/dist/third-party/front_end/Images/top-panel-close.svg +1 -0
  204. package/dist/third-party/front_end/Images/top-panel-open.svg +1 -0
  205. package/dist/third-party/front_end/Images/touchCursor.png +0 -0
  206. package/dist/third-party/front_end/Images/touchCursor_2x.png +0 -0
  207. package/dist/third-party/front_end/Images/triangle-bottom-right.svg +1 -0
  208. package/dist/third-party/front_end/Images/triangle-down.svg +1 -0
  209. package/dist/third-party/front_end/Images/triangle-left.svg +1 -0
  210. package/dist/third-party/front_end/Images/triangle-right.svg +1 -0
  211. package/dist/third-party/front_end/Images/triangle-up.svg +1 -0
  212. package/dist/third-party/front_end/Images/undo.svg +1 -0
  213. package/dist/third-party/front_end/Images/warning-filled.svg +1 -0
  214. package/dist/third-party/front_end/Images/warning.svg +1 -0
  215. package/dist/third-party/front_end/Images/warning_icon.svg +1 -0
  216. package/dist/third-party/front_end/Images/watch.svg +1 -0
  217. package/dist/third-party/front_end/Images/whatsnew.avif +0 -0
  218. package/dist/third-party/front_end/Images/width.svg +1 -0
  219. package/dist/third-party/front_end/Tests.js +1662 -0
  220. package/dist/third-party/front_end/core/common/common-legacy.js +1 -0
  221. package/dist/third-party/front_end/core/common/common.js +1 -0
  222. package/dist/third-party/front_end/core/dom_extension/dom_extension.js +1 -0
  223. package/dist/third-party/front_end/core/host/host-legacy.js +1 -0
  224. package/dist/third-party/front_end/core/host/host.js +1 -0
  225. package/dist/third-party/front_end/core/i18n/i18n.js +1 -0
  226. package/dist/third-party/front_end/core/i18n/locales/en-US.json +1 -0
  227. package/dist/third-party/front_end/core/i18n/locales/zh.json +1 -0
  228. package/dist/third-party/front_end/core/platform/platform.js +1 -0
  229. package/dist/third-party/front_end/core/protocol_client/protocol_client-legacy.js +1 -0
  230. package/dist/third-party/front_end/core/protocol_client/protocol_client.js +1 -0
  231. package/dist/third-party/front_end/core/root/root-legacy.js +1 -0
  232. package/dist/third-party/front_end/core/root/root.js +1 -0
  233. package/dist/third-party/front_end/core/sdk/sdk-legacy.js +1 -0
  234. package/dist/third-party/front_end/core/sdk/sdk-meta.js +1 -0
  235. package/dist/third-party/front_end/core/sdk/sdk.js +1 -0
  236. package/dist/third-party/front_end/device_mode_emulation_frame.html +20 -0
  237. package/dist/third-party/front_end/devtools_app.html +20 -0
  238. package/dist/third-party/front_end/devtools_compatibility.js +1595 -0
  239. package/dist/third-party/front_end/emulated_devices/optimized/MotoG4-landscape.avif +0 -0
  240. package/dist/third-party/front_end/emulated_devices/optimized/MotoG4-portrait.avif +0 -0
  241. package/dist/third-party/front_end/emulated_devices/optimized/Nexus5X-landscape.avif +0 -0
  242. package/dist/third-party/front_end/emulated_devices/optimized/Nexus5X-portrait.avif +0 -0
  243. package/dist/third-party/front_end/emulated_devices/optimized/Nexus6P-landscape.avif +0 -0
  244. package/dist/third-party/front_end/emulated_devices/optimized/Nexus6P-portrait.avif +0 -0
  245. package/dist/third-party/front_end/emulated_devices/optimized/google-nest-hub-horizontal.avif +0 -0
  246. package/dist/third-party/front_end/emulated_devices/optimized/google-nest-hub-max-horizontal.avif +0 -0
  247. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-1x.avif +0 -0
  248. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-2x.avif +0 -0
  249. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-1x.avif +0 -0
  250. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-2x.avif +0 -0
  251. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-1x.avif +0 -0
  252. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-2x.avif +0 -0
  253. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-1x.avif +0 -0
  254. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-2x.avif +0 -0
  255. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-1x.avif +0 -0
  256. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-2x.avif +0 -0
  257. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-1x.avif +0 -0
  258. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-2x.avif +0 -0
  259. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-1x.avif +0 -0
  260. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-2x.avif +0 -0
  261. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-1x.avif +0 -0
  262. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-2x.avif +0 -0
  263. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-1x.avif +0 -0
  264. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-2x.avif +0 -0
  265. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-1x.avif +0 -0
  266. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-2x.avif +0 -0
  267. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-1x.avif +0 -0
  268. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-2x.avif +0 -0
  269. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-1x.avif +0 -0
  270. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-2x.avif +0 -0
  271. package/dist/third-party/front_end/emulated_devices/optimized/iPad-landscape.avif +0 -0
  272. package/dist/third-party/front_end/emulated_devices/optimized/iPad-portrait.avif +0 -0
  273. package/dist/third-party/front_end/emulated_devices/optimized/iPhone5-landscape.avif +0 -0
  274. package/dist/third-party/front_end/emulated_devices/optimized/iPhone5-portrait.avif +0 -0
  275. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6-landscape.avif +0 -0
  276. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6-portrait.avif +0 -0
  277. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6Plus-landscape.avif +0 -0
  278. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6Plus-portrait.avif +0 -0
  279. package/dist/third-party/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.js +1 -0
  280. package/dist/third-party/front_end/entrypoints/devtools_app/devtools_app.js +1 -0
  281. package/dist/third-party/front_end/entrypoints/formatter_worker/FormatterActions.js +1 -0
  282. package/dist/third-party/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.js +1 -0
  283. package/dist/third-party/front_end/entrypoints/formatter_worker/formatter_worker.js +1 -0
  284. package/dist/third-party/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js +1 -0
  285. package/dist/third-party/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-legacy.js +1 -0
  286. package/dist/third-party/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker.js +1 -0
  287. package/dist/third-party/front_end/entrypoints/inspector/inspector.js +1 -0
  288. package/dist/third-party/front_end/entrypoints/inspector_main/inspector_main-meta.js +1 -0
  289. package/dist/third-party/front_end/entrypoints/inspector_main/inspector_main.js +1 -0
  290. package/dist/third-party/front_end/entrypoints/js_app/js_app.js +1 -0
  291. package/dist/third-party/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js +1 -0
  292. package/dist/third-party/front_end/entrypoints/main/main-legacy.js +1 -0
  293. package/dist/third-party/front_end/entrypoints/main/main-meta.js +1 -0
  294. package/dist/third-party/front_end/entrypoints/main/main.js +1 -0
  295. package/dist/third-party/front_end/entrypoints/ndb_app/ndb_app.js +1 -0
  296. package/dist/third-party/front_end/entrypoints/node_app/node_app.js +1 -0
  297. package/dist/third-party/front_end/entrypoints/rn_inspector/rn_inspector.js +1 -0
  298. package/dist/third-party/front_end/entrypoints/shell/shell.js +1 -0
  299. package/dist/third-party/front_end/entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.js +1 -0
  300. package/dist/third-party/front_end/entrypoints/wasmparser_worker/wasmparser_worker.js +1 -0
  301. package/dist/third-party/front_end/entrypoints/worker_app/worker_app.js +1 -0
  302. package/dist/third-party/front_end/inspector.html +20 -0
  303. package/dist/third-party/front_end/integration_test_runner.html +40 -0
  304. package/dist/third-party/front_end/js_app.html +20 -0
  305. package/dist/third-party/front_end/legacy_test_runner/legacy_test_runner.js +36 -0
  306. package/dist/third-party/front_end/legacy_test_runner/test_runner/test_runner.js +1 -0
  307. package/dist/third-party/front_end/models/bindings/bindings-legacy.js +1 -0
  308. package/dist/third-party/front_end/models/bindings/bindings.js +1 -0
  309. package/dist/third-party/front_end/models/breakpoints/breakpoints-legacy.js +1 -0
  310. package/dist/third-party/front_end/models/breakpoints/breakpoints.js +1 -0
  311. package/dist/third-party/front_end/models/emulation/emulation.js +1 -0
  312. package/dist/third-party/front_end/models/extensions/extensions-legacy.js +1 -0
  313. package/dist/third-party/front_end/models/extensions/extensions.js +1 -0
  314. package/dist/third-party/front_end/models/formatter/formatter-legacy.js +1 -0
  315. package/dist/third-party/front_end/models/formatter/formatter.js +1 -0
  316. package/dist/third-party/front_end/models/har/har.js +1 -0
  317. package/dist/third-party/front_end/models/heap_snapshot_model/heap_snapshot_model-legacy.js +1 -0
  318. package/dist/third-party/front_end/models/heap_snapshot_model/heap_snapshot_model.js +1 -0
  319. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
  320. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCorpNotSameOrigin.md +8 -0
  321. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
  322. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCorpNotSameSite.md +7 -0
  323. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
  324. package/dist/third-party/front_end/models/issues_manager/descriptions/CompatibilityModeQuirks.md +5 -0
  325. package/dist/third-party/front_end/models/issues_manager/descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
  326. package/dist/third-party/front_end/models/issues_manager/descriptions/LowTextContrast.md +5 -0
  327. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteExcludeContextDowngradeRead.md +8 -0
  328. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteExcludeContextDowngradeSet.md +8 -0
  329. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteExcludeNavigationContextDowngrade.md +8 -0
  330. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteInvalidSameParty.md +8 -0
  331. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
  332. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
  333. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
  334. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
  335. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
  336. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
  337. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedTreatedAsLaxRead.md +9 -0
  338. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedTreatedAsLaxSet.md +9 -0
  339. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteWarnCrossDowngradeRead.md +8 -0
  340. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteWarnCrossDowngradeSet.md +8 -0
  341. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +8 -0
  342. package/dist/third-party/front_end/models/issues_manager/descriptions/arInsecureContext.md +7 -0
  343. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterOsSourceHeader.md +5 -0
  344. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterOsTriggerHeader.md +5 -0
  345. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterSourceHeader.md +5 -0
  346. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterTriggerHeader.md +5 -0
  347. package/dist/third-party/front_end/models/issues_manager/descriptions/arOsSourceIgnored.md +18 -0
  348. package/dist/third-party/front_end/models/issues_manager/descriptions/arOsTriggerIgnored.md +19 -0
  349. package/dist/third-party/front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md +8 -0
  350. package/dist/third-party/front_end/models/issues_manager/descriptions/arSourceAndTriggerHeaders.md +9 -0
  351. package/dist/third-party/front_end/models/issues_manager/descriptions/arSourceIgnored.md +13 -0
  352. package/dist/third-party/front_end/models/issues_manager/descriptions/arTriggerIgnored.md +12 -0
  353. package/dist/third-party/front_end/models/issues_manager/descriptions/arUntrustworthyReportingOrigin.md +10 -0
  354. package/dist/third-party/front_end/models/issues_manager/descriptions/arWebAndOsHeaders.md +11 -0
  355. package/dist/third-party/front_end/models/issues_manager/descriptions/bounceTrackingMitigations.md +3 -0
  356. package/dist/third-party/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  357. package/dist/third-party/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  358. package/dist/third-party/front_end/models/issues_manager/descriptions/cookieExcludeBlockedWithinFirstPartySet.md +4 -0
  359. package/dist/third-party/front_end/models/issues_manager/descriptions/cookieExcludeDomainNonAscii.md +11 -0
  360. package/dist/third-party/front_end/models/issues_manager/descriptions/cookieWarnDomainNonAscii.md +11 -0
  361. package/dist/third-party/front_end/models/issues_manager/descriptions/corsAllowCredentialsRequired.md +6 -0
  362. package/dist/third-party/front_end/models/issues_manager/descriptions/corsDisabledScheme.md +7 -0
  363. package/dist/third-party/front_end/models/issues_manager/descriptions/corsDisallowedByMode.md +7 -0
  364. package/dist/third-party/front_end/models/issues_manager/descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
  365. package/dist/third-party/front_end/models/issues_manager/descriptions/corsInsecurePrivateNetwork.md +10 -0
  366. package/dist/third-party/front_end/models/issues_manager/descriptions/corsInvalidHeaderValues.md +7 -0
  367. package/dist/third-party/front_end/models/issues_manager/descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
  368. package/dist/third-party/front_end/models/issues_manager/descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
  369. package/dist/third-party/front_end/models/issues_manager/descriptions/corsOriginMismatch.md +6 -0
  370. package/dist/third-party/front_end/models/issues_manager/descriptions/corsPreflightAllowPrivateNetworkError.md +10 -0
  371. package/dist/third-party/front_end/models/issues_manager/descriptions/corsPreflightResponseInvalid.md +5 -0
  372. package/dist/third-party/front_end/models/issues_manager/descriptions/corsRedirectContainsCredentials.md +5 -0
  373. package/dist/third-party/front_end/models/issues_manager/descriptions/corsWildcardOriginNotAllowed.md +8 -0
  374. package/dist/third-party/front_end/models/issues_manager/descriptions/cspEvalViolation.md +9 -0
  375. package/dist/third-party/front_end/models/issues_manager/descriptions/cspInlineViolation.md +10 -0
  376. package/dist/third-party/front_end/models/issues_manager/descriptions/cspTrustedTypesPolicyViolation.md +5 -0
  377. package/dist/third-party/front_end/models/issues_manager/descriptions/cspTrustedTypesSinkViolation.md +8 -0
  378. package/dist/third-party/front_end/models/issues_manager/descriptions/cspURLViolation.md +10 -0
  379. package/dist/third-party/front_end/models/issues_manager/descriptions/deprecation.md +3 -0
  380. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
  381. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
  382. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
  383. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
  384. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestCanceled.md +1 -0
  385. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataHttpNotFound.md +1 -0
  386. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataInvalidResponse.md +1 -0
  387. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataNoResponse.md +1 -0
  388. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
  389. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorIdToken.md +1 -0
  390. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
  391. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
  392. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
  393. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
  394. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
  395. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
  396. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
  397. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
  398. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestTooManyRequests.md +1 -0
  399. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
  400. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
  401. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
  402. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
  403. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
  404. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
  405. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
  406. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
  407. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
  408. package/dist/third-party/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
  409. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormAriaLabelledByToNonExistingId.md +8 -0
  410. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
  411. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormDuplicateIdForInputError.md +5 -0
  412. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
  413. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
  414. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
  415. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormInputWithNoLabelError.md +5 -0
  416. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
  417. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormLabelForNameError.md +5 -0
  418. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormLabelHasNeitherForNorNestedInput.md +5 -0
  419. package/dist/third-party/front_end/models/issues_manager/descriptions/heavyAd.md +10 -0
  420. package/dist/third-party/front_end/models/issues_manager/descriptions/mixedContent.md +5 -0
  421. package/dist/third-party/front_end/models/issues_manager/descriptions/sharedArrayBuffer.md +7 -0
  422. package/dist/third-party/front_end/models/issues_manager/descriptions/stylesheetLateImport.md +4 -0
  423. package/dist/third-party/front_end/models/issues_manager/descriptions/stylesheetRequestFailed.md +3 -0
  424. package/dist/third-party/front_end/models/issues_manager/issues_manager.js +1 -0
  425. package/dist/third-party/front_end/models/javascript_metadata/javascript_metadata.js +1 -0
  426. package/dist/third-party/front_end/models/logs/logs-meta.js +1 -0
  427. package/dist/third-party/front_end/models/logs/logs.js +1 -0
  428. package/dist/third-party/front_end/models/persistence/persistence-legacy.js +1 -0
  429. package/dist/third-party/front_end/models/persistence/persistence-meta.js +1 -0
  430. package/dist/third-party/front_end/models/persistence/persistence.js +1 -0
  431. package/dist/third-party/front_end/models/source_map_scopes/source_map_scopes.js +1 -0
  432. package/dist/third-party/front_end/models/text_utils/text_utils-legacy.js +1 -0
  433. package/dist/third-party/front_end/models/text_utils/text_utils.js +1 -0
  434. package/dist/third-party/front_end/models/timeline_model/timeline_model-legacy.js +1 -0
  435. package/dist/third-party/front_end/models/timeline_model/timeline_model.js +1 -0
  436. package/dist/third-party/front_end/models/trace/extras/extras.js +1 -0
  437. package/dist/third-party/front_end/models/trace/handlers/handlers.js +1 -0
  438. package/dist/third-party/front_end/models/trace/helpers/helpers.js +1 -0
  439. package/dist/third-party/front_end/models/trace/trace.js +1 -0
  440. package/dist/third-party/front_end/models/trace/types/types.js +1 -0
  441. package/dist/third-party/front_end/models/workspace/workspace-legacy.js +1 -0
  442. package/dist/third-party/front_end/models/workspace/workspace.js +1 -0
  443. package/dist/third-party/front_end/models/workspace_diff/workspace_diff-legacy.js +1 -0
  444. package/dist/third-party/front_end/models/workspace_diff/workspace_diff.js +1 -0
  445. package/dist/third-party/front_end/ndb_app.html +20 -0
  446. package/dist/third-party/front_end/node_app.html +20 -0
  447. package/dist/third-party/front_end/panels/accessibility/accessibility-legacy.js +1 -0
  448. package/dist/third-party/front_end/panels/accessibility/accessibility-meta.js +1 -0
  449. package/dist/third-party/front_end/panels/accessibility/accessibility.js +1 -0
  450. package/dist/third-party/front_end/panels/animation/animation-legacy.js +1 -0
  451. package/dist/third-party/front_end/panels/animation/animation-meta.js +1 -0
  452. package/dist/third-party/front_end/panels/animation/animation.js +1 -0
  453. package/dist/third-party/front_end/panels/application/application-legacy.js +1 -0
  454. package/dist/third-party/front_end/panels/application/application-meta.js +1 -0
  455. package/dist/third-party/front_end/panels/application/application.js +1 -0
  456. package/dist/third-party/front_end/panels/application/components/components.js +1 -0
  457. package/dist/third-party/front_end/panels/application/preloading/components/components.js +1 -0
  458. package/dist/third-party/front_end/panels/browser_debugger/browser_debugger-legacy.js +1 -0
  459. package/dist/third-party/front_end/panels/browser_debugger/browser_debugger-meta.js +1 -0
  460. package/dist/third-party/front_end/panels/browser_debugger/browser_debugger.js +1 -0
  461. package/dist/third-party/front_end/panels/changes/changes-legacy.js +1 -0
  462. package/dist/third-party/front_end/panels/changes/changes-meta.js +1 -0
  463. package/dist/third-party/front_end/panels/changes/changes.js +1 -0
  464. package/dist/third-party/front_end/panels/console/console-legacy.js +1 -0
  465. package/dist/third-party/front_end/panels/console/console-meta.js +1 -0
  466. package/dist/third-party/front_end/panels/console/console.js +6 -0
  467. package/dist/third-party/front_end/panels/console_counters/console_counters-meta.js +1 -0
  468. package/dist/third-party/front_end/panels/console_counters/console_counters.js +1 -0
  469. package/dist/third-party/front_end/panels/coverage/coverage-legacy.js +1 -0
  470. package/dist/third-party/front_end/panels/coverage/coverage-meta.js +1 -0
  471. package/dist/third-party/front_end/panels/coverage/coverage.js +1 -0
  472. package/dist/third-party/front_end/panels/css_overview/components/components.js +1 -0
  473. package/dist/third-party/front_end/panels/css_overview/css_overview-meta.js +1 -0
  474. package/dist/third-party/front_end/panels/css_overview/css_overview.js +144 -0
  475. package/dist/third-party/front_end/panels/developer_resources/developer_resources-meta.js +1 -0
  476. package/dist/third-party/front_end/panels/developer_resources/developer_resources.js +1 -0
  477. package/dist/third-party/front_end/panels/elements/components/components.js +1 -0
  478. package/dist/third-party/front_end/panels/elements/elements-legacy.js +1 -0
  479. package/dist/third-party/front_end/panels/elements/elements-meta.js +1 -0
  480. package/dist/third-party/front_end/panels/elements/elements.js +1 -0
  481. package/dist/third-party/front_end/panels/emulation/components/components.js +22 -0
  482. package/dist/third-party/front_end/panels/emulation/emulation-legacy.js +1 -0
  483. package/dist/third-party/front_end/panels/emulation/emulation-meta.js +1 -0
  484. package/dist/third-party/front_end/panels/emulation/emulation.js +1 -0
  485. package/dist/third-party/front_end/panels/event_listeners/event_listeners.js +1 -0
  486. package/dist/third-party/front_end/panels/issues/components/components.js +1 -0
  487. package/dist/third-party/front_end/panels/issues/issues-meta.js +1 -0
  488. package/dist/third-party/front_end/panels/issues/issues.js +1 -0
  489. package/dist/third-party/front_end/panels/js_profiler/js_profiler-meta.js +1 -0
  490. package/dist/third-party/front_end/panels/js_profiler/js_profiler.js +1 -0
  491. package/dist/third-party/front_end/panels/layer_viewer/layer_viewer-legacy.js +1 -0
  492. package/dist/third-party/front_end/panels/layer_viewer/layer_viewer-meta.js +1 -0
  493. package/dist/third-party/front_end/panels/layer_viewer/layer_viewer.js +1 -0
  494. package/dist/third-party/front_end/panels/layers/layers-meta.js +1 -0
  495. package/dist/third-party/front_end/panels/layers/layers.js +1 -0
  496. package/dist/third-party/front_end/panels/lighthouse/lighthouse-legacy.js +1 -0
  497. package/dist/third-party/front_end/panels/lighthouse/lighthouse-meta.js +1 -0
  498. package/dist/third-party/front_end/panels/lighthouse/lighthouse.js +66 -0
  499. package/dist/third-party/front_end/panels/media/media-meta.js +1 -0
  500. package/dist/third-party/front_end/panels/media/media.js +25 -0
  501. package/dist/third-party/front_end/panels/mobile_throttling/mobile_throttling-legacy.js +1 -0
  502. package/dist/third-party/front_end/panels/mobile_throttling/mobile_throttling-meta.js +1 -0
  503. package/dist/third-party/front_end/panels/mobile_throttling/mobile_throttling.js +1 -0
  504. package/dist/third-party/front_end/panels/network/components/components.js +1 -0
  505. package/dist/third-party/front_end/panels/network/forward/forward.js +1 -0
  506. package/dist/third-party/front_end/panels/network/network-legacy.js +1 -0
  507. package/dist/third-party/front_end/panels/network/network-meta.js +1 -0
  508. package/dist/third-party/front_end/panels/network/network.js +1 -0
  509. package/dist/third-party/front_end/panels/performance_monitor/performance_monitor-meta.js +1 -0
  510. package/dist/third-party/front_end/panels/performance_monitor/performance_monitor.js +1 -0
  511. package/dist/third-party/front_end/panels/profiler/profiler-legacy.js +1 -0
  512. package/dist/third-party/front_end/panels/profiler/profiler-meta.js +1 -0
  513. package/dist/third-party/front_end/panels/profiler/profiler.js +7 -0
  514. package/dist/third-party/front_end/panels/protocol_monitor/components/components.js +1 -0
  515. package/dist/third-party/front_end/panels/protocol_monitor/protocol_monitor-meta.js +1 -0
  516. package/dist/third-party/front_end/panels/protocol_monitor/protocol_monitor.js +1 -0
  517. package/dist/third-party/front_end/panels/recorder/components/components.js +1 -0
  518. package/dist/third-party/front_end/panels/recorder/controllers/controllers.js +1 -0
  519. package/dist/third-party/front_end/panels/recorder/converters/converters.js +1 -0
  520. package/dist/third-party/front_end/panels/recorder/extensions/extensions.js +1 -0
  521. package/dist/third-party/front_end/panels/recorder/injected/injected.generated.js +1 -0
  522. package/dist/third-party/front_end/panels/recorder/injected/injected.js +1 -0
  523. package/dist/third-party/front_end/panels/recorder/models/models.js +1 -0
  524. package/dist/third-party/front_end/panels/recorder/recorder-actions.js +1 -0
  525. package/dist/third-party/front_end/panels/recorder/recorder-meta.js +1 -0
  526. package/dist/third-party/front_end/panels/recorder/recorder.js +1 -0
  527. package/dist/third-party/front_end/panels/recorder/util/util.js +1 -0
  528. package/dist/third-party/front_end/panels/rn_welcome/rn_welcome-meta.js +1 -0
  529. package/dist/third-party/front_end/panels/rn_welcome/rn_welcome.js +1 -0
  530. package/dist/third-party/front_end/panels/screencast/screencast-meta.js +1 -0
  531. package/dist/third-party/front_end/panels/screencast/screencast.js +1 -0
  532. package/dist/third-party/front_end/panels/search/search-legacy.js +1 -0
  533. package/dist/third-party/front_end/panels/search/search.js +1 -0
  534. package/dist/third-party/front_end/panels/security/security-legacy.js +1 -0
  535. package/dist/third-party/front_end/panels/security/security-meta.js +1 -0
  536. package/dist/third-party/front_end/panels/security/security.js +1 -0
  537. package/dist/third-party/front_end/panels/sensors/sensors-meta.js +1 -0
  538. package/dist/third-party/front_end/panels/sensors/sensors.js +1 -0
  539. package/dist/third-party/front_end/panels/settings/components/components.js +1 -0
  540. package/dist/third-party/front_end/panels/settings/emulation/components/components.js +1 -0
  541. package/dist/third-party/front_end/panels/settings/emulation/emulation-meta.js +1 -0
  542. package/dist/third-party/front_end/panels/settings/emulation/emulation.js +1 -0
  543. package/dist/third-party/front_end/panels/settings/emulation/utils/utils.js +1 -0
  544. package/dist/third-party/front_end/panels/settings/settings-legacy.js +1 -0
  545. package/dist/third-party/front_end/panels/settings/settings-meta.js +1 -0
  546. package/dist/third-party/front_end/panels/settings/settings.js +1 -0
  547. package/dist/third-party/front_end/panels/snippets/snippets-legacy.js +1 -0
  548. package/dist/third-party/front_end/panels/snippets/snippets.js +1 -0
  549. package/dist/third-party/front_end/panels/sources/components/components.js +1 -0
  550. package/dist/third-party/front_end/panels/sources/sources-legacy.js +1 -0
  551. package/dist/third-party/front_end/panels/sources/sources-meta.js +1 -0
  552. package/dist/third-party/front_end/panels/sources/sources.js +1 -0
  553. package/dist/third-party/front_end/panels/timeline/timeline-legacy.js +1 -0
  554. package/dist/third-party/front_end/panels/timeline/timeline-meta.js +1 -0
  555. package/dist/third-party/front_end/panels/timeline/timeline.js +1 -0
  556. package/dist/third-party/front_end/panels/utils/utils.js +1 -0
  557. package/dist/third-party/front_end/panels/web_audio/graph_visualizer/graph_visualizer.js +1 -0
  558. package/dist/third-party/front_end/panels/web_audio/web_audio-legacy.js +1 -0
  559. package/dist/third-party/front_end/panels/web_audio/web_audio-meta.js +1 -0
  560. package/dist/third-party/front_end/panels/web_audio/web_audio.js +1 -0
  561. package/dist/third-party/front_end/panels/webauthn/webauthn-meta.js +1 -0
  562. package/dist/third-party/front_end/panels/webauthn/webauthn.js +1 -0
  563. package/dist/third-party/front_end/rn_inspector.html +20 -0
  564. package/dist/third-party/front_end/services/puppeteer/puppeteer.js +1 -0
  565. package/dist/third-party/front_end/services/tracing/tracing.js +1 -0
  566. package/dist/third-party/front_end/services/window_bounds/window_bounds.js +1 -0
  567. package/dist/third-party/front_end/third_party/acorn/acorn.js +1 -0
  568. package/dist/third-party/front_end/third_party/chromium/client-variations/client-variations.js +1 -0
  569. package/dist/third-party/front_end/third_party/codemirror.next/chunk/angular.js +2 -0
  570. package/dist/third-party/front_end/third_party/codemirror.next/chunk/codemirror.js +2 -0
  571. package/dist/third-party/front_end/third_party/codemirror.next/chunk/cpp.js +2 -0
  572. package/dist/third-party/front_end/third_party/codemirror.next/chunk/java.js +2 -0
  573. package/dist/third-party/front_end/third_party/codemirror.next/chunk/json.js +2 -0
  574. package/dist/third-party/front_end/third_party/codemirror.next/chunk/legacy.js +2 -0
  575. package/dist/third-party/front_end/third_party/codemirror.next/chunk/less.js +2 -0
  576. package/dist/third-party/front_end/third_party/codemirror.next/chunk/markdown.js +2 -0
  577. package/dist/third-party/front_end/third_party/codemirror.next/chunk/php.js +2 -0
  578. package/dist/third-party/front_end/third_party/codemirror.next/chunk/python.js +2 -0
  579. package/dist/third-party/front_end/third_party/codemirror.next/chunk/sass.js +2 -0
  580. package/dist/third-party/front_end/third_party/codemirror.next/chunk/svelte.js +2 -0
  581. package/dist/third-party/front_end/third_party/codemirror.next/chunk/vue.js +2 -0
  582. package/dist/third-party/front_end/third_party/codemirror.next/chunk/wast.js +2 -0
  583. package/dist/third-party/front_end/third_party/codemirror.next/chunk/xml.js +2 -0
  584. package/dist/third-party/front_end/third_party/codemirror.next/codemirror.next.js +2 -0
  585. package/dist/third-party/front_end/third_party/diff/diff-legacy.js +1 -0
  586. package/dist/third-party/front_end/third_party/diff/diff.js +1 -0
  587. package/dist/third-party/front_end/third_party/i18n/i18n.js +1 -0
  588. package/dist/third-party/front_end/third_party/intl-messageformat/intl-messageformat.js +15 -0
  589. package/dist/third-party/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1297 -0
  590. package/dist/third-party/front_end/third_party/lighthouse/report/report.js +222 -0
  591. package/dist/third-party/front_end/third_party/lit/lit.js +98 -0
  592. package/dist/third-party/front_end/third_party/marked/marked.js +1 -0
  593. package/dist/third-party/front_end/third_party/puppeteer/puppeteer.js +1 -0
  594. package/dist/third-party/front_end/third_party/puppeteer-replay/puppeteer-replay.js +1 -0
  595. package/dist/third-party/front_end/third_party/wasmparser/wasmparser.js +1 -0
  596. package/dist/third-party/front_end/ui/components/adorners/adorners.js +1 -0
  597. package/dist/third-party/front_end/ui/components/buttons/buttons.js +1 -0
  598. package/dist/third-party/front_end/ui/components/chrome_link/chrome_link.js +1 -0
  599. package/dist/third-party/front_end/ui/components/code_highlighter/code_highlighter.js +1 -0
  600. package/dist/third-party/front_end/ui/components/data_grid/data_grid.js +1 -0
  601. package/dist/third-party/front_end/ui/components/dialogs/dialogs.js +1 -0
  602. package/dist/third-party/front_end/ui/components/diff_view/diff_view.js +1 -0
  603. package/dist/third-party/front_end/ui/components/expandable_list/expandable_list.js +1 -0
  604. package/dist/third-party/front_end/ui/components/helpers/helpers.js +1 -0
  605. package/dist/third-party/front_end/ui/components/icon_button/icon_button.js +1 -0
  606. package/dist/third-party/front_end/ui/components/input/input.js +1 -0
  607. package/dist/third-party/front_end/ui/components/issue_counter/issue_counter.js +1 -0
  608. package/dist/third-party/front_end/ui/components/legacy_wrapper/legacy_wrapper.js +1 -0
  609. package/dist/third-party/front_end/ui/components/linear_memory_inspector/linear_memory_inspector-meta.js +1 -0
  610. package/dist/third-party/front_end/ui/components/linear_memory_inspector/linear_memory_inspector.js +1 -0
  611. package/dist/third-party/front_end/ui/components/linkifier/linkifier.js +1 -0
  612. package/dist/third-party/front_end/ui/components/markdown_view/markdown_view.js +1 -0
  613. package/dist/third-party/front_end/ui/components/menus/menus.js +1 -0
  614. package/dist/third-party/front_end/ui/components/node_text/node_text.js +1 -0
  615. package/dist/third-party/front_end/ui/components/panel_feedback/panel_feedback.js +1 -0
  616. package/dist/third-party/front_end/ui/components/panel_introduction_steps/panel_introduction_steps.js +1 -0
  617. package/dist/third-party/front_end/ui/components/render_coordinator/render_coordinator.js +1 -0
  618. package/dist/third-party/front_end/ui/components/report_view/report_view.js +1 -0
  619. package/dist/third-party/front_end/ui/components/request_link_icon/request_link_icon.js +1 -0
  620. package/dist/third-party/front_end/ui/components/settings/settings.js +1 -0
  621. package/dist/third-party/front_end/ui/components/srgb_overlay/srgb_overlay.js +1 -0
  622. package/dist/third-party/front_end/ui/components/survey_link/survey_link.js +1 -0
  623. package/dist/third-party/front_end/ui/components/text_editor/text_editor.js +1 -0
  624. package/dist/third-party/front_end/ui/components/text_prompt/text_prompt.js +1 -0
  625. package/dist/third-party/front_end/ui/components/tree_outline/tree_outline.js +1 -0
  626. package/dist/third-party/front_end/ui/components/two_states_counter/two_states_counter.js +1 -0
  627. package/dist/third-party/front_end/ui/legacy/components/color_picker/color_picker-legacy.js +1 -0
  628. package/dist/third-party/front_end/ui/legacy/components/color_picker/color_picker.js +1 -0
  629. package/dist/third-party/front_end/ui/legacy/components/cookie_table/cookie_table-legacy.js +1 -0
  630. package/dist/third-party/front_end/ui/legacy/components/cookie_table/cookie_table.js +1 -0
  631. package/dist/third-party/front_end/ui/legacy/components/data_grid/data_grid-legacy.js +1 -0
  632. package/dist/third-party/front_end/ui/legacy/components/data_grid/data_grid.js +1 -0
  633. package/dist/third-party/front_end/ui/legacy/components/inline_editor/inline_editor-legacy.js +1 -0
  634. package/dist/third-party/front_end/ui/legacy/components/inline_editor/inline_editor.js +1 -0
  635. package/dist/third-party/front_end/ui/legacy/components/object_ui/object_ui-legacy.js +1 -0
  636. package/dist/third-party/front_end/ui/legacy/components/object_ui/object_ui-meta.js +1 -0
  637. package/dist/third-party/front_end/ui/legacy/components/object_ui/object_ui.js +1 -0
  638. package/dist/third-party/front_end/ui/legacy/components/perf_ui/perf_ui-legacy.js +1 -0
  639. package/dist/third-party/front_end/ui/legacy/components/perf_ui/perf_ui-meta.js +1 -0
  640. package/dist/third-party/front_end/ui/legacy/components/perf_ui/perf_ui.js +12 -0
  641. package/dist/third-party/front_end/ui/legacy/components/quick_open/quick_open-legacy.js +1 -0
  642. package/dist/third-party/front_end/ui/legacy/components/quick_open/quick_open-meta.js +1 -0
  643. package/dist/third-party/front_end/ui/legacy/components/quick_open/quick_open.js +1 -0
  644. package/dist/third-party/front_end/ui/legacy/components/source_frame/source_frame-legacy.js +1 -0
  645. package/dist/third-party/front_end/ui/legacy/components/source_frame/source_frame-meta.js +1 -0
  646. package/dist/third-party/front_end/ui/legacy/components/source_frame/source_frame.js +1 -0
  647. package/dist/third-party/front_end/ui/legacy/components/utils/utils-legacy.js +1 -0
  648. package/dist/third-party/front_end/ui/legacy/components/utils/utils.js +1 -0
  649. package/dist/third-party/front_end/ui/legacy/legacy-legacy.js +1 -0
  650. package/dist/third-party/front_end/ui/legacy/legacy.js +1 -0
  651. package/dist/third-party/front_end/ui/legacy/theme_support/theme_support.js +1 -0
  652. package/dist/third-party/front_end/ui/legacy/utils/utils.js +1 -0
  653. package/dist/third-party/front_end/ui/lit-html/lit-html.js +1 -0
  654. package/dist/third-party/front_end/worker_app.html +20 -0
  655. package/index.js +15 -0
  656. package/package.json +25 -0
@@ -0,0 +1 @@
1
+ import*as e from"../../core/common/common.js";import*as t from"../../core/platform/platform.js";import{assertNotNullOrUndefined as o}from"../../core/platform/platform.js";import*as r from"../../core/sdk/sdk.js";import*as s from"../text_utils/text_utils.js";import*as i from"../workspace/workspace.js";import*as n from"../../core/i18n/i18n.js";import*as a from"../../core/root/root.js";const c={unknownErrorLoadingFile:"Unknown error loading file"},u=n.i18n.registerUIStrings("models/bindings/ContentProviderBasedProject.ts",c),l=n.i18n.getLocalizedString.bind(void 0,u);class d extends i.Workspace.ProjectStore{#e;#t;constructor(e,t,o,r,s){super(e,t,o,r),this.#e=s,this.#t=new WeakMap,e.addProject(this)}async requestFileContent(e){const{contentProvider:t}=this.#t.get(e);try{const e=await t.requestContent();if("error"in e)return{error:e.error,isEncoded:e.isEncoded,content:null};const o="wasmDisassemblyInfo"in e?e.wasmDisassemblyInfo:void 0;return o&&!1===e.isEncoded?{content:"",wasmDisassemblyInfo:o,isEncoded:!1}:{content:e.content,isEncoded:e.isEncoded}}catch(e){return{content:null,isEncoded:!1,error:e?String(e):l(c.unknownErrorLoadingFile)}}}isServiceProject(){return this.#e}async requestMetadata(e){const{metadata:t}=this.#t.get(e);return t}canSetFileContent(){return!1}async setFileContent(e,t,o){}fullDisplayName(e){let t=e.parentURL().replace(/^(?:https?|file)\:\/\//,"");try{t=decodeURI(t)}catch(e){}return t+"/"+e.displayName(!0)}mimeType(e){const{mimeType:t}=this.#t.get(e);return t}canRename(){return!1}rename(e,t,o){const r=e.url();this.performRename(r,t,((t,r)=>{t&&r&&this.renameUISourceCode(e,r),o(t,r)}))}excludeFolder(e){}canExcludeFolder(e){return!1}async createFile(e,t,o,r){return null}canCreateFile(){return!1}deleteFile(e){}remove(){}performRename(e,t,o){o(!1)}searchInFileContent(e,t,o,r){const{contentProvider:s}=this.#t.get(e);return s.searchInContent(t,o,r)}async findFilesMatchingSearchRequest(e,t,o){const r=[];return o.setTotalWork(t.length),await Promise.all(t.map(async function(t){const s=this.uiSourceCodeForURL(t);if(s){let o=!0;for(const t of e.queries().slice()){if(!(await this.searchInFileContent(s,t,!e.ignoreCase(),e.isRegex())).length){o=!1;break}}o&&r.push(t)}o.incrementWorked(1)}.bind(this))),o.done(),r}indexContent(e){queueMicrotask(e.done.bind(e))}addUISourceCodeWithProvider(e,t,o,r){this.#t.set(e,{mimeType:r,metadata:o,contentProvider:t}),this.addUISourceCode(e)}addContentProvider(e,t,o){const r=this.createUISourceCode(e,t.contentType());return this.addUISourceCodeWithProvider(r,t,null,o),r}reset(){this.removeProject(),this.workspace().addProject(this)}dispose(){this.removeProject()}}var g=Object.freeze({__proto__:null,ContentProviderBasedProject:d});const p={removeFromIgnoreList:"Remove from ignore list",addScriptToIgnoreList:"Add script to ignore list",addDirectoryToIgnoreList:"Add directory to ignore list",addAllContentScriptsToIgnoreList:"Add all extension scripts to ignore list",addAllThirdPartyScriptsToIgnoreList:"Add all third-party scripts to ignore list"},h=n.i18n.registerUIStrings("models/bindings/IgnoreListManager.ts",p),m=n.i18n.getLocalizedString.bind(void 0,h);let S;class L{#o;#r;#s;constructor(t){this.#o=t,r.TargetManager.TargetManager.instance().addModelListener(r.DebuggerModel.DebuggerModel,r.DebuggerModel.Events.GlobalObjectCleared,this.clearCacheIfNeeded.bind(this),this),e.Settings.Settings.instance().moduleSetting("skipStackFramesPattern").addChangeListener(this.patternChanged.bind(this)),e.Settings.Settings.instance().moduleSetting("skipContentScripts").addChangeListener(this.patternChanged.bind(this)),e.Settings.Settings.instance().moduleSetting("automaticallyIgnoreListKnownThirdPartyScripts").addChangeListener(this.patternChanged.bind(this)),e.Settings.Settings.instance().moduleSetting("enableIgnoreListing").addChangeListener(this.patternChanged.bind(this)),this.#r=new Set,this.#s=new Map,r.TargetManager.TargetManager.instance().observeModels(r.DebuggerModel.DebuggerModel,this)}static instance(e={forceNew:null,debuggerWorkspaceBinding:null}){const{forceNew:t,debuggerWorkspaceBinding:o}=e;if(!S||t){if(!o)throw new Error(`Unable to create settings: debuggerWorkspaceBinding must be provided: ${(new Error).stack}`);S=new L(o)}return S}static removeInstance(){S=void 0}addChangeListener(e){this.#r.add(e)}removeChangeListener(e){this.#r.delete(e)}modelAdded(e){this.setIgnoreListPatterns(e);const t=e.sourceMapManager();t.addEventListener(r.SourceMapManager.Events.SourceMapAttached,this.sourceMapAttached,this),t.addEventListener(r.SourceMapManager.Events.SourceMapDetached,this.sourceMapDetached,this)}modelRemoved(e){this.clearCacheIfNeeded();const t=e.sourceMapManager();t.removeEventListener(r.SourceMapManager.Events.SourceMapAttached,this.sourceMapAttached,this),t.removeEventListener(r.SourceMapManager.Events.SourceMapDetached,this.sourceMapDetached,this)}clearCacheIfNeeded(){this.#s.size>1024&&this.#s.clear()}getSkipStackFramesPatternSetting(){return e.Settings.Settings.instance().moduleSetting("skipStackFramesPattern")}setIgnoreListPatterns(e){const t=this.enableIgnoreListing?this.getSkipStackFramesPatternSetting().getAsArray():[],o=[];for(const e of t)!e.disabled&&e.pattern&&o.push(e.pattern);return e.setBlackboxPatterns(o)}isUserOrSourceMapIgnoreListedUISourceCode(e){const t=e.project().type()===i.Workspace.projectTypes.ContentScripts;if(this.skipContentScripts&&t)return!0;if(e.isUnconditionallyIgnoreListed())return!0;const o=this.uiSourceCodeURL(e);return!!o&&this.isUserOrSourceMapIgnoreListedURL(o,e.isKnownThirdParty())}isUserOrSourceMapIgnoreListedURL(e,t){return!!this.isUserIgnoreListedURL(e)||!(!this.automaticallyIgnoreListKnownThirdPartyScripts||!t)}isUserIgnoreListedURL(e,t){if(!this.enableIgnoreListing)return!1;if(this.#s.has(e))return Boolean(this.#s.get(e));if(t&&this.skipContentScripts)return!0;const o=this.getSkipStackFramesPatternSetting().asRegExp(),r=o&&o.test(e)||!1;return this.#s.set(e,r),r}sourceMapAttached(e){const t=e.data.client,o=e.data.sourceMap;this.updateScriptRanges(t,o)}sourceMapDetached(e){const t=e.data.client;this.updateScriptRanges(t,void 0)}async updateScriptRanges(e,t){let o=!1;if(L.instance().isUserIgnoreListedURL(e.sourceURL,e.isContentScript())||(o=t?.sourceURLs().some((e=>this.isUserOrSourceMapIgnoreListedURL(e,t.hasIgnoreListHint(e))))??!1),!o)return M.get(e)&&await e.setBlackboxedRanges([])&&M.delete(e),void await this.#o.updateLocations(e);if(!t)return;const r=t.findRanges((e=>this.isUserOrSourceMapIgnoreListedURL(e,t.hasIgnoreListHint(e))),{isStartMatching:!0}).flatMap((e=>[e.start,e.end]));!function(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;++o)if(e[o].lineNumber!==t[o].lineNumber||e[o].columnNumber!==t[o].columnNumber)return!1;return!0}(M.get(e)||[],r)&&await e.setBlackboxedRanges(r)&&M.set(e,r),this.#o.updateLocations(e)}uiSourceCodeURL(e){return e.project().type()===i.Workspace.projectTypes.Debugger?null:e.url()}canIgnoreListUISourceCode(e){const t=this.uiSourceCodeURL(e);return!!t&&Boolean(this.urlToRegExpString(t))}ignoreListUISourceCode(e){const t=this.uiSourceCodeURL(e);t&&this.ignoreListURL(t)}unIgnoreListUISourceCode(e){e.project().type()===i.Workspace.projectTypes.ContentScripts&&this.unIgnoreListContentScripts(),e.isKnownThirdParty()&&this.unIgnoreListThirdParty();const t=this.uiSourceCodeURL(e);t&&this.unIgnoreListURL(t)}get enableIgnoreListing(){return e.Settings.Settings.instance().moduleSetting("enableIgnoreListing").get()}set enableIgnoreListing(t){e.Settings.Settings.instance().moduleSetting("enableIgnoreListing").set(t)}get skipContentScripts(){return this.enableIgnoreListing&&e.Settings.Settings.instance().moduleSetting("skipContentScripts").get()}get automaticallyIgnoreListKnownThirdPartyScripts(){return this.enableIgnoreListing&&e.Settings.Settings.instance().moduleSetting("automaticallyIgnoreListKnownThirdPartyScripts").get()}ignoreListContentScripts(){this.enableIgnoreListing||(this.enableIgnoreListing=!0),e.Settings.Settings.instance().moduleSetting("skipContentScripts").set(!0)}unIgnoreListContentScripts(){e.Settings.Settings.instance().moduleSetting("skipContentScripts").set(!1)}ignoreListThirdParty(){this.enableIgnoreListing||(this.enableIgnoreListing=!0),e.Settings.Settings.instance().moduleSetting("automaticallyIgnoreListKnownThirdPartyScripts").set(!0)}unIgnoreListThirdParty(){e.Settings.Settings.instance().moduleSetting("automaticallyIgnoreListKnownThirdPartyScripts").set(!1)}ignoreListURL(e){const t=this.urlToRegExpString(e);t&&this.ignoreListRegex(t,e)}ignoreListRegex(e,t){const o=this.getSkipStackFramesPatternSetting().getAsArray();let r=!1;for(let s=0;s<o.length;++s){const i=o[s];(i.pattern===e||t&&i.disabledForUrl===t)&&(i.disabled=!1,i.disabledForUrl=void 0,r=!0)}r||o.push({pattern:e,disabled:!1}),this.enableIgnoreListing||(this.enableIgnoreListing=!0),this.getSkipStackFramesPatternSetting().setAsArray(o)}unIgnoreListURL(e){let t=this.getSkipStackFramesPatternSetting().getAsArray();const o=L.instance().urlToRegExpString(e);if(o){t=t.filter((function(e){return e.pattern!==o}));for(let o=0;o<t.length;++o){const r=t[o];if(!r.disabled)try{new RegExp(r.pattern).test(e)&&(r.disabled=!0,r.disabledForUrl=e)}catch(e){}}this.getSkipStackFramesPatternSetting().setAsArray(t)}}removeIgnoreListPattern(e){let t=this.getSkipStackFramesPatternSetting().getAsArray();t=t.filter((function(t){return t.pattern!==e})),this.getSkipStackFramesPatternSetting().setAsArray(t)}ignoreListHasPattern(e,t){return this.getSkipStackFramesPatternSetting().getAsArray().some((o=>!(t&&o.disabled)&&o.pattern===e))}async patternChanged(){this.#s.clear();const e=[];for(const t of r.TargetManager.TargetManager.instance().models(r.DebuggerModel.DebuggerModel)){e.push(this.setIgnoreListPatterns(t));const o=t.sourceMapManager();for(const r of t.scripts())e.push(this.updateScriptRanges(r,o.sourceMapForClient(r)))}await Promise.all(e);const t=Array.from(this.#r);for(const e of t)e();this.patternChangeFinishedForTests()}patternChangeFinishedForTests(){}urlToRegExpString(o){const r=new e.ParsedURL.ParsedURL(o);if(r.isAboutBlank()||r.isDataURL())return"";if(!r.isValid)return"^"+t.StringUtilities.escapeForRegExp(o)+"$";let s=r.lastPathComponent;if(s?s="/"+s:r.folderPathComponents&&(s=r.folderPathComponents+"/"),s||(s=r.host),!s)return"";const i=r.scheme;let n="";return i&&"http"!==i&&"https"!==i&&(n="^"+i+"://","chrome-extension"===i&&(n+=r.host+"\\b"),n+=".*"),n+t.StringUtilities.escapeForRegExp(s)+(o.endsWith(s)?"$":"\\b")}getIgnoreListURLContextMenuItems(e){if(e.project().type()===i.Workspace.projectTypes.FileSystem)return[];const t=[],o=this.canIgnoreListUISourceCode(e),r=this.isUserOrSourceMapIgnoreListedUISourceCode(e),s=e.project().type()===i.Workspace.projectTypes.ContentScripts,n=e.isKnownThirdParty();return r?(o||s||n)&&t.push({text:m(p.removeFromIgnoreList),callback:this.unIgnoreListUISourceCode.bind(this,e)}):(o&&t.push({text:m(p.addScriptToIgnoreList),callback:this.ignoreListUISourceCode.bind(this,e)}),s&&t.push({text:m(p.addAllContentScriptsToIgnoreList),callback:this.ignoreListContentScripts.bind(this)}),n&&t.push({text:m(p.addAllThirdPartyScriptsToIgnoreList),callback:this.ignoreListThirdParty.bind(this)})),t}getIgnoreListFolderContextMenuItems(e){const o=[],r="^"+t.StringUtilities.escapeForRegExp(e)+"/";return this.ignoreListHasPattern(r,!0)?o.push({text:m(p.removeFromIgnoreList),callback:this.removeIgnoreListPattern.bind(this,r)}):o.push({text:m(p.addDirectoryToIgnoreList),callback:this.ignoreListRegex.bind(this,r)}),o}}const M=new WeakMap;var f=Object.freeze({__proto__:null,IgnoreListManager:L});const b=new WeakMap,C=new WeakMap;let I;class v extends e.ObjectWrapper.ObjectWrapper{constructor(){super()}static instance({forceNew:e}={forceNew:!1}){return I&&!e||(I=new v),I}}var w;!function(e){e.FrameAttributionAdded="FrameAttributionAdded",e.FrameAttributionRemoved="FrameAttributionRemoved"}(w||(w={}));class T{static resolveFrame(e,t){const o=T.targetForUISourceCode(e),s=o&&o.model(r.ResourceTreeModel.ResourceTreeModel);return s?s.frameForId(t):null}static setInitialFrameAttribution(e,t){if(!t)return;const o=T.resolveFrame(e,t);if(!o)return;const r=new Map;r.set(t,{frame:o,count:1}),b.set(e,r)}static cloneInitialFrameAttribution(e,t){const o=b.get(e);if(!o)return;const r=new Map;for(const e of o.keys()){const t=o.get(e);void 0!==t&&r.set(e,{frame:t.frame,count:t.count})}b.set(t,r)}static addFrameAttribution(e,t){const o=T.resolveFrame(e,t);if(!o)return;const r=b.get(e);if(!r)return;const s=r.get(t)||{frame:o,count:0};if(s.count+=1,r.set(t,s),1!==s.count)return;const i={uiSourceCode:e,frame:o};v.instance().dispatchEventToListeners(w.FrameAttributionAdded,i)}static removeFrameAttribution(e,t){const o=b.get(e);if(!o)return;const r=o.get(t);if(console.assert(Boolean(r),"Failed to remove frame attribution for url: "+e.url()),!r)return;if(r.count-=1,r.count>0)return;o.delete(t);const s={uiSourceCode:e,frame:r.frame};v.instance().dispatchEventToListeners(w.FrameAttributionRemoved,s)}static targetForUISourceCode(e){return C.get(e.project())||null}static setTargetForProject(e,t){C.set(e,t)}static getTargetForProject(e){return C.get(e)||null}static framesForUISourceCode(e){const t=T.targetForUISourceCode(e),o=t&&t.model(r.ResourceTreeModel.ResourceTreeModel),s=b.get(e);if(!o||!s)return[];return Array.from(s.keys()).map((e=>o.frameForId(e))).filter((e=>Boolean(e)))}}var R=Object.freeze({__proto__:null,NetworkProjectManager:v,get Events(){return w},NetworkProject:T});class y{#i;#o;#n=new Map;#a;#c;#u=new Map;#l=new Map;#d=new t.MapUtilities.Multimap;constructor(e,t,o){this.#i=e.sourceMapManager(),this.#o=o,this.#a=new d(t,"jsSourceMaps:stub:"+e.target().id(),i.Workspace.projectTypes.Service,"",!0),this.#c=[this.#i.addEventListener(r.SourceMapManager.Events.SourceMapWillAttach,this.sourceMapWillAttach,this),this.#i.addEventListener(r.SourceMapManager.Events.SourceMapFailedToAttach,this.sourceMapFailedToAttach,this),this.#i.addEventListener(r.SourceMapManager.Events.SourceMapAttached,this.sourceMapAttached,this),this.#i.addEventListener(r.SourceMapManager.Events.SourceMapDetached,this.sourceMapDetached,this)]}addStubUISourceCode(t){const o=this.#a.addContentProvider(e.ParsedURL.ParsedURL.concatenate(t.sourceURL,":sourcemap"),s.StaticContentProvider.StaticContentProvider.fromString(t.sourceURL,e.ResourceType.resourceTypes.Script,"\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown while source map is being loaded!"),"text/javascript");this.#n.set(t,o)}removeStubUISourceCode(e){const t=this.#n.get(e);this.#n.delete(e),t&&this.#a.removeUISourceCode(t.url())}getLocationRangesForSameSourceLocation(e){const t=e.debuggerModel,o=e.script();if(!o)return[];const r=this.#i.sourceMapForClient(o);if(!r)return[];const{lineNumber:s,columnNumber:i}=o.rawLocationToRelativeLocation(e),n=r.findEntry(s,i);if(!n||!n.sourceURL)return[];const a=this.#l.get(r);if(!a)return[];const c=a.uiSourceCodeForURL(n.sourceURL);if(!c)return[];if(!this.#d.hasValue(c,r))return[];return r.findReverseRanges(n.sourceURL,n.sourceLineNumber,n.sourceColumnNumber).map((({startLine:e,startColumn:r,endLine:s,endColumn:i})=>{const n=o.relativeLocationToRawLocation({lineNumber:e,columnNumber:r}),a=o.relativeLocationToRawLocation({lineNumber:s,columnNumber:i});return{start:t.createRawLocation(o,n.lineNumber,n.columnNumber),end:t.createRawLocation(o,a.lineNumber,a.columnNumber)}}))}uiSourceCodeForURL(e,t){const o=t?i.Workspace.projectTypes.ContentScripts:i.Workspace.projectTypes.Network;for(const t of this.#u.values()){if(t.type()!==o)continue;const r=t.uiSourceCodeForURL(e);if(r)return r}return null}rawLocationToUILocation(e){const t=e.script();if(!t)return null;const{lineNumber:o,columnNumber:r}=t.rawLocationToRelativeLocation(e),s=this.#n.get(t);if(s)return new i.UISourceCode.UILocation(s,o,r);const n=this.#i.sourceMapForClient(t);if(!n)return null;const a=this.#l.get(n);if(!a)return null;const c=n.findEntry(o,r);if(!c||!c.sourceURL)return null;const u=a.uiSourceCodeForURL(c.sourceURL);return u&&this.#d.hasValue(u,n)?u.uiLocation(c.sourceLineNumber,c.sourceColumnNumber):null}uiLocationToRawLocations(e,t,o){const r=[];for(const s of this.#d.get(e)){const i=s.sourceLineMapping(e.url(),t,o);if(!i)continue;const n=this.#i.clientForSourceMap(s);if(!n)continue;const a=n.relativeLocationToRawLocation(i);r.push(n.debuggerModel.createRawLocation(n,a.lineNumber,a.columnNumber))}return r}uiLocationRangeToRawLocationRanges(e,t){if(!this.#d.has(e))return null;const o=[];for(const r of this.#d.get(e)){const s=this.#i.clientForSourceMap(r);if(s)for(const i of r.reverseMapTextRanges(e.url(),t)){const e=s.relativeLocationToRawLocation(i.start),t=s.relativeLocationToRawLocation(i.end),r=s.debuggerModel.createRawLocation(s,e.lineNumber,e.columnNumber),n=s.debuggerModel.createRawLocation(s,t.lineNumber,t.columnNumber);o.push({start:r,end:n})}}return o}getMappedLines(e){if(!this.#d.has(e))return null;const t=new Set;for(const o of this.#d.get(e))for(const r of o.mappings())r.sourceURL===e.url()&&t.add(r.sourceLineNumber);return t}sourceMapWillAttach(e){const{client:t}=e.data;this.addStubUISourceCode(t),this.#o.updateLocations(t)}sourceMapFailedToAttach(e){const{client:t}=e.data;this.removeStubUISourceCode(t),this.#o.updateLocations(t)}sourceMapAttached(t){const{client:o,sourceMap:n}=t.data,a=new Set([o]);if(this.removeStubUISourceCode(o),!L.instance().isUserIgnoreListedURL(o.sourceURL,o.isContentScript())){const t=o.target(),c=`jsSourceMaps:${o.isContentScript()?"extensions":""}:${t.id()}`;let u=this.#u.get(c);if(!u){const e=o.isContentScript()?i.Workspace.projectTypes.ContentScripts:i.Workspace.projectTypes.Network;u=new d(this.#a.workspace(),c,e,"",!1),T.setTargetForProject(u,t),this.#u.set(c,u)}this.#l.set(n,u);for(const t of n.sourceURLs()){const c=e.ResourceType.resourceTypes.SourceMapScript,l=u.createUISourceCode(t,c);n.hasIgnoreListHint(t)&&l.markKnownThirdParty();const d=n.embeddedContentByURL(t),g=null!==d?s.StaticContentProvider.StaticContentProvider.fromString(t,c,d):new r.CompilerSourceMappingContentProvider.CompilerSourceMappingContentProvider(t,c,o.createPageResourceLoadInitiator());let p=null;if(null!==d){const e=new TextEncoder;p=new i.UISourceCode.UISourceCodeMetadata(null,e.encode(d).length)}const h=e.ResourceType.ResourceType.mimeFromURL(t)??c.canonicalMimeType();this.#d.set(l,n),T.setInitialFrameAttribution(l,o.frameId);const m=u.uiSourceCodeForURL(t);if(null!==m){for(const e of this.#d.get(m)){this.#d.delete(m,e);const o=this.#i.clientForSourceMap(e);o&&(T.removeFrameAttribution(m,o.frameId),n.compatibleForURL(t,e)&&(this.#d.set(l,e),T.addFrameAttribution(l,o.frameId)),a.add(o))}u.removeUISourceCode(t)}u.addUISourceCodeWithProvider(l,g,p,h)}}Promise.all([...a].map((e=>this.#o.updateLocations(e)))).then((()=>this.sourceMapAttachedForTest(n)))}sourceMapDetached(e){const{client:t,sourceMap:o}=e.data,r=this.#l.get(o);if(r){for(const e of r.uiSourceCodes())this.#d.delete(e,o)&&(T.removeFrameAttribution(e,t.frameId),this.#d.has(e)||r.removeUISourceCode(e.url()));this.#l.delete(o),this.#o.updateLocations(t)}}scriptsForUISourceCode(e){const t=[];for(const o of this.#d.get(e)){const e=this.#i.clientForSourceMap(o);e&&t.push(e)}return t}sourceMapAttachedForTest(e){}dispose(){e.EventTarget.removeEventListeners(this.#c);for(const e of this.#u.values())e.dispose();this.#a.dispose()}}var F=Object.freeze({__proto__:null,CompilerScriptMapping:y});class U{#g;#p;#h;constructor(e,t){this.#g=e,this.#p=t,this.#p.add(this),this.#h=null}async update(){this.#g&&(this.#h?await this.#h.then((()=>this.update())):(this.#h=this.#g(this),await this.#h,this.#h=null))}async uiLocation(){throw"Not implemented"}dispose(){this.#p.delete(this),this.#g=null}isDisposed(){return!this.#p.has(this)}async isIgnoreListed(){throw"Not implemented"}}class P{#m;constructor(){this.#m=new Set}add(e){this.#m.add(e)}delete(e){this.#m.delete(e)}has(e){return this.#m.has(e)}disposeAll(){for(const e of this.#m)e.dispose()}}var k=Object.freeze({__proto__:null,LiveLocationWithPool:U,LiveLocationPool:P});class j{#i;#S;#c;#L;constructor(e,t,o){this.#i=t,this.#S=new d(o,"cssSourceMaps:"+e.id(),i.Workspace.projectTypes.Network,"",!1),T.setTargetForProject(this.#S,e),this.#L=new Map,this.#c=[this.#i.addEventListener(r.SourceMapManager.Events.SourceMapAttached,this.sourceMapAttached,this),this.#i.addEventListener(r.SourceMapManager.Events.SourceMapDetached,this.sourceMapDetached,this)]}sourceMapAttachedForTest(e){}async sourceMapAttached(e){const t=e.data.client,o=e.data.sourceMap,r=this.#S,s=this.#L;for(const e of o.sourceURLs()){let i=s.get(e);i||(i=new E(r,e,t.createPageResourceLoadInitiator()),s.set(e,i)),i.addSourceMap(o,t.frameId)}await q.instance().updateLocations(t),this.sourceMapAttachedForTest(o)}async sourceMapDetached(e){const t=e.data.client,o=e.data.sourceMap,r=this.#L;for(const e of o.sourceURLs()){const s=r.get(e);s&&(s.removeSourceMap(o,t.frameId),s.getUiSourceCode()||r.delete(e))}await q.instance().updateLocations(t)}rawLocationToUILocation(e){const t=e.header();if(!t)return null;const o=this.#i.sourceMapForClient(t);if(!o)return null;let{lineNumber:r,columnNumber:s}=e;o.mapsOrigin()&&t.isInline&&(r-=t.startLine,0===r&&(s-=t.startColumn));const i=o.findEntry(r,s);if(!i||!i.sourceURL)return null;const n=this.#S.uiSourceCodeForURL(i.sourceURL);return n?n.uiLocation(i.sourceLineNumber,i.sourceColumnNumber):null}uiLocationToRawLocations(e){const{uiSourceCode:t,lineNumber:o,columnNumber:s=0}=e,i=D.get(t);if(!i)return[];const n=[];for(const e of i.getReferringSourceMaps()){const i=e.findReverseEntries(t.url(),o,s),a=this.#i.clientForSourceMap(e);a&&n.push(...i.map((e=>new r.CSSModel.CSSLocation(a,e.lineNumber,e.columnNumber))))}return n}static uiSourceOrigin(e){const t=D.get(e);return t?t.getReferringSourceMaps().map((e=>e.compiledURL())):[]}dispose(){e.EventTarget.removeEventListeners(this.#c),this.#S.dispose()}}const D=new WeakMap;class E{#S;#M;#f;referringSourceMaps;uiSourceCode;constructor(e,t,o){this.#S=e,this.#M=t,this.#f=o,this.referringSourceMaps=[],this.uiSourceCode=null}recreateUISourceCodeIfNeeded(t){const o=this.referringSourceMaps[this.referringSourceMaps.length-1],n=e.ResourceType.resourceTypes.SourceMapStyleSheet,a=o.embeddedContentByURL(this.#M),c=null!==a?s.StaticContentProvider.StaticContentProvider.fromString(this.#M,n,a):new r.CompilerSourceMappingContentProvider.CompilerSourceMappingContentProvider(this.#M,n,this.#f),u=this.#S.createUISourceCode(this.#M,n);D.set(u,this);const l=e.ResourceType.ResourceType.mimeFromURL(this.#M)||n.canonicalMimeType(),d="string"==typeof a?new i.UISourceCode.UISourceCodeMetadata(null,a.length):null;this.uiSourceCode?(T.cloneInitialFrameAttribution(this.uiSourceCode,u),this.#S.removeUISourceCode(this.uiSourceCode.url())):T.setInitialFrameAttribution(u,t),this.uiSourceCode=u,this.#S.addUISourceCodeWithProvider(this.uiSourceCode,c,d,l)}addSourceMap(e,t){this.uiSourceCode&&T.addFrameAttribution(this.uiSourceCode,t),this.referringSourceMaps.push(e),this.recreateUISourceCodeIfNeeded(t)}removeSourceMap(e,t){const o=this.uiSourceCode;T.removeFrameAttribution(o,t);const r=this.referringSourceMaps.lastIndexOf(e);-1!==r&&this.referringSourceMaps.splice(r,1),this.referringSourceMaps.length?this.recreateUISourceCodeIfNeeded(t):(this.#S.removeUISourceCode(o.url()),this.uiSourceCode=null)}getReferringSourceMaps(){return this.referringSourceMaps}getUiSourceCode(){return this.uiSourceCode}}var N=Object.freeze({__proto__:null,SASSSourceMapping:j});function A(e){for(const t of r.TargetManager.TargetManager.instance().models(r.ResourceTreeModel.ResourceTreeModel)){const o=t.resourceForURL(e);if(o)return o}return null}function x(e,t,o){const s=e.model(r.ResourceTreeModel.ResourceTreeModel);if(!s)return null;const i=s.frameForId(t);return i?O(i.resourceForURL(o)):null}function O(e){return!e||"number"!=typeof e.contentSize()&&!e.lastModified()?null:new i.UISourceCode.UISourceCodeMetadata(e.lastModified(),e.contentSize())}var W=Object.freeze({__proto__:null,resourceForURL:A,displayNameForURL:function(o){if(!o)return"";const s=A(o);if(s)return s.displayName;const n=i.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(o);if(n)return n.displayName();const a=r.TargetManager.TargetManager.instance().inspectedURL();if(!a)return t.StringUtilities.trimURL(o,"");const c=e.ParsedURL.ParsedURL.fromString(a);if(!c)return o;const u=c.lastPathComponent,l=a.indexOf(u);if(-1!==l&&l+u.length===a.length){const e=a.substring(0,l);if(o.startsWith(e))return o.substring(l)}const d=t.StringUtilities.trimURL(o,c.host);return"/"===d?c.host+"/":d},metadataForURL:x,resourceMetadata:O});const B=new WeakMap;class H{#b;#S;#C;#c;constructor(e,t){this.#b=e;const o=this.#b.target();this.#S=new d(t,"css:"+o.id(),i.Workspace.projectTypes.Network,"",!1),T.setTargetForProject(this.#S,o),this.#C=new Map,this.#c=[this.#b.addEventListener(r.CSSModel.Events.StyleSheetAdded,this.styleSheetAdded,this),this.#b.addEventListener(r.CSSModel.Events.StyleSheetRemoved,this.styleSheetRemoved,this),this.#b.addEventListener(r.CSSModel.Events.StyleSheetChanged,this.styleSheetChanged,this)]}rawLocationToUILocation(e){const t=e.header();if(!t||!this.acceptsHeader(t))return null;const o=this.#C.get(t.resourceURL());if(!o)return null;let r=e.lineNumber,s=e.columnNumber;if(t.isInline&&t.hasSourceURL){r-=t.lineNumberInSource(0);const e=t.columnNumberInSource(r,0);void 0===e?s=e:s-=e}return o.getUiSourceCode().uiLocation(r,s)}uiLocationToRawLocations(e){const t=B.get(e.uiSourceCode);if(!t)return[];const o=[];for(const s of t.getHeaders()){let t=e.lineNumber,i=e.columnNumber;s.isInline&&s.hasSourceURL&&(i=s.columnNumberInSource(t,e.columnNumber||0),t=s.lineNumberInSource(t)),o.push(new r.CSSModel.CSSLocation(s,t,i))}return o}acceptsHeader(e){return!e.isConstructedByNew()&&(!(e.isInline&&!e.hasSourceURL&&"inspector"!==e.origin)&&!!e.resourceURL())}styleSheetAdded(e){const t=e.data;if(!this.acceptsHeader(t))return;const o=t.resourceURL();let r=this.#C.get(o);r?r.addHeader(t):(r=new _(this.#b,this.#S,t),this.#C.set(o,r))}styleSheetRemoved(e){const t=e.data;if(!this.acceptsHeader(t))return;const o=t.resourceURL(),r=this.#C.get(o);r&&(1===r.getHeaders().size?(r.dispose(),this.#C.delete(o)):r.removeHeader(t))}styleSheetChanged(e){const t=this.#b.styleSheetHeaderForId(e.data.styleSheetId);if(!t||!this.acceptsHeader(t))return;const o=this.#C.get(t.resourceURL());o&&o.styleSheetChanged(t)}dispose(){for(const e of this.#C.values())e.dispose();this.#C.clear(),e.EventTarget.removeEventListeners(this.#c),this.#S.removeProject()}}class _{#b;#S;headers;uiSourceCode;#c;#I;#v;#w;#T;constructor(t,o,r){this.#b=t,this.#S=o,this.headers=new Set([r]);const s=t.target(),n=r.resourceURL(),a=x(s,r.frameId,n);this.uiSourceCode=this.#S.createUISourceCode(n,r.contentType()),B.set(this.uiSourceCode,this),T.setInitialFrameAttribution(this.uiSourceCode,r.frameId),this.#S.addUISourceCodeWithProvider(this.uiSourceCode,this,a,"text/css"),this.#c=[this.uiSourceCode.addEventListener(i.UISourceCode.Events.WorkingCopyChanged,this.workingCopyChanged,this),this.uiSourceCode.addEventListener(i.UISourceCode.Events.WorkingCopyCommitted,this.workingCopyCommitted,this)],this.#I=new e.Throttler.Throttler(_.updateTimeout),this.#v=!1}addHeader(e){this.headers.add(e),T.addFrameAttribution(this.uiSourceCode,e.frameId)}removeHeader(e){this.headers.delete(e),T.removeFrameAttribution(this.uiSourceCode,e.frameId)}styleSheetChanged(e){if(console.assert(this.headers.has(e)),this.#T||!this.headers.has(e))return;const t=this.mirrorContent.bind(this,e,!0);this.#I.schedule(t,!1)}workingCopyCommitted(){if(this.#w)return;const e=this.mirrorContent.bind(this,this.uiSourceCode,!0);this.#I.schedule(e,!0)}workingCopyChanged(){if(this.#w)return;const e=this.mirrorContent.bind(this,this.uiSourceCode,!1);this.#I.schedule(e,!1)}async mirrorContent(e,t){if(this.#v)return void this.styleFileSyncedForTest();let o=null;if(e===this.uiSourceCode)o=this.uiSourceCode.workingCopy();else{o=(await e.requestContent()).content}if(null===o||this.#v)return void this.styleFileSyncedForTest();e!==this.uiSourceCode&&(this.#w=!0,this.uiSourceCode.addRevision(o),this.#w=!1),this.#T=!0;const r=[];for(const s of this.headers)s!==e&&r.push(this.#b.setStyleSheetText(s.id,o,t));await Promise.all(r),this.#T=!1,this.styleFileSyncedForTest()}styleFileSyncedForTest(){}dispose(){this.#v||(this.#v=!0,this.#S.removeUISourceCode(this.uiSourceCode.url()),e.EventTarget.removeEventListeners(this.#c))}contentURL(){return console.assert(this.headers.size>0),this.headers.values().next().value.originalContentProvider().contentURL()}contentType(){return console.assert(this.headers.size>0),this.headers.values().next().value.originalContentProvider().contentType()}requestContent(){return console.assert(this.headers.size>0),this.headers.values().next().value.originalContentProvider().requestContent()}searchInContent(e,t,o){return console.assert(this.headers.size>0),this.headers.values().next().value.originalContentProvider().searchInContent(e,t,o)}static updateTimeout=200;getHeaders(){return this.headers}getUiSourceCode(){return this.uiSourceCode}}var z=Object.freeze({__proto__:null,StylesSourceMapping:H,StyleFile:_});let V;class q{#R;#y;#F;constructor(e,t){this.#R=e,this.#y=new Map,t.observeModels(r.CSSModel.CSSModel,this),this.#F=new Set}static instance(e={forceNew:null,resourceMapping:null,targetManager:null}){const{forceNew:t,resourceMapping:o,targetManager:r}=e;if(!V||t){if(!o||!r)throw new Error(`Unable to create CSSWorkspaceBinding: resourceMapping and targetManager must be provided: ${(new Error).stack}`);V=new q(o,r)}return V}static removeInstance(){V=void 0}get modelToInfo(){return this.#y}getCSSModelInfo(e){return this.#y.get(e)}modelAdded(e){this.#y.set(e,new J(e,this.#R))}modelRemoved(e){this.getCSSModelInfo(e).dispose(),this.#y.delete(e)}async pendingLiveLocationChangesPromise(){await Promise.all(this.#F)}recordLiveLocationChange(e){e.then((()=>{this.#F.delete(e)})),this.#F.add(e)}async updateLocations(e){const t=this.getCSSModelInfo(e.cssModel()).updateLocations(e);this.recordLiveLocationChange(t),await t}createLiveLocation(e,t,o){const r=this.getCSSModelInfo(e.cssModel()).createLiveLocation(e,t,o);return this.recordLiveLocationChange(r),r}propertyRawLocation(e,t){const o=e.ownerStyle;if(!o||o.type!==r.CSSStyleDeclaration.Type.Regular||!o.styleSheetId)return null;const s=o.cssModel().styleSheetHeaderForId(o.styleSheetId);if(!s)return null;const i=t?e.nameRange():e.valueRange();if(!i)return null;const n=i.startLine,a=i.startColumn;return new r.CSSModel.CSSLocation(s,s.lineNumberInSource(n),s.columnNumberInSource(n,a))}propertyUILocation(e,t){const o=this.propertyRawLocation(e,t);return o?this.rawLocationToUILocation(o):null}rawLocationToUILocation(e){return this.getCSSModelInfo(e.cssModel()).rawLocationToUILocation(e)}uiLocationToRawLocations(e){const t=[];for(const o of this.#y.values())t.push(...o.uiLocationToRawLocations(e));return t}}class J{#c;#R;#U;#P;#m;#k;constructor(e,o){this.#c=[e.addEventListener(r.CSSModel.Events.StyleSheetAdded,(e=>{this.styleSheetAdded(e)}),this),e.addEventListener(r.CSSModel.Events.StyleSheetRemoved,(e=>{this.styleSheetRemoved(e)}),this)],this.#R=o,this.#U=new H(e,o.workspace);const s=e.sourceMapManager();this.#P=new j(e.target(),s,o.workspace),this.#m=new t.MapUtilities.Multimap,this.#k=new t.MapUtilities.Multimap}get locations(){return this.#m}async createLiveLocation(e,t,o){const r=new K(e,this,t,o),s=e.header();return s?(r.setHeader(s),this.#m.set(s,r),await r.update()):this.#k.set(e.url,r),r}disposeLocation(e){const t=e.header();t?this.#m.delete(t,e):this.#k.delete(e.url,e)}updateLocations(e){const t=[];for(const o of this.#m.get(e))t.push(o.update());return Promise.all(t)}async styleSheetAdded(e){const t=e.data;if(!t.sourceURL)return;const o=[];for(const e of this.#k.get(t.sourceURL))e.setHeader(t),this.#m.set(t,e),o.push(e.update());await Promise.all(o),this.#k.deleteAll(t.sourceURL)}async styleSheetRemoved(e){const t=e.data,o=[];for(const e of this.#m.get(t))e.setHeader(t),this.#k.set(e.url,e),o.push(e.update());await Promise.all(o),this.#m.deleteAll(t)}rawLocationToUILocation(e){let t=null;return t=t||this.#P.rawLocationToUILocation(e),t=t||this.#U.rawLocationToUILocation(e),t=t||this.#R.cssLocationToUILocation(e),t}uiLocationToRawLocations(e){let t=this.#P.uiLocationToRawLocations(e);return t.length?t:(t=this.#U.uiLocationToRawLocations(e),t.length?t:this.#R.uiLocationToCSSLocations(e))}dispose(){e.EventTarget.removeEventListeners(this.#c),this.#U.dispose(),this.#P.dispose()}}class K extends U{url;#j;#D;#E;headerInternal;constructor(e,t,o,r){super(o,r),this.url=e.url,this.#j=e.lineNumber,this.#D=e.columnNumber,this.#E=t,this.headerInternal=null}header(){return this.headerInternal}setHeader(e){this.headerInternal=e}async uiLocation(){if(!this.headerInternal)return null;const e=new r.CSSModel.CSSLocation(this.headerInternal,this.#j,this.#D);return q.instance().rawLocationToUILocation(e)}dispose(){super.dispose(),this.#E.disposeLocation(this)}async isIgnoreListed(){return!1}}var G=Object.freeze({__proto__:null,CSSWorkspaceBinding:q,ModelInfo:J,LiveLocation:K});const $={errorInDebuggerLanguagePlugin:"Error in debugger language plugin: {PH1}",loadingDebugSymbolsForVia:"[{PH1}] Loading debug symbols for {PH2} (via {PH3})...",loadingDebugSymbolsFor:"[{PH1}] Loading debug symbols for {PH2}...",loadedDebugSymbolsForButDidnt:"[{PH1}] Loaded debug symbols for {PH2}, but didn't find any source files",loadedDebugSymbolsForFound:"[{PH1}] Loaded debug symbols for {PH2}, found {PH3} source file(s)",failedToLoadDebugSymbolsFor:"[{PH1}] Failed to load debug symbols for {PH2} ({PH3})",failedToLoadDebugSymbolsForFunction:'No debug information for function "{PH1}"',debugSymbolsIncomplete:"The debug information for function {PH1} is incomplete"},Q=n.i18n.registerUIStrings("models/bindings/DebuggerLanguagePlugins.ts",$),X=n.i18n.getLocalizedString.bind(void 0,Q);function Y(e){return`${e.sourceURL}@${e.hash}`}function Z(e){const{script:t}=e;return{rawModuleId:Y(t),codeOffset:e.location().columnNumber-(t.codeOffset()||0),inlineFrameIndex:e.inlineFrameIndex}}class ee extends Error{exception;exceptionDetails;constructor(e,t){const{description:o}=t.exception||{};super(o||t.text),this.exception=e,this.exceptionDetails=t}static makeLocal(e,t){const o={type:"object",subtype:"error",description:t},r={text:"Uncaught",exceptionId:-1,columnNumber:0,lineNumber:0,exception:o},s=e.debuggerModel.runtimeModel().createRemoteObject(o);return new ee(s,r)}}class te extends r.RemoteObject.LocalJSONObject{constructor(e){super(e)}get description(){return this.type}get type(){return"namespace"}}class oe extends r.RemoteObject.RemoteObjectImpl{variables;#N;#A;stopId;constructor(e,t,o){super(e.debuggerModel.runtimeModel(),void 0,"object",void 0,null),this.variables=[],this.#N=e,this.#A=o,this.stopId=t}async doGetProperties(e,t,o){if(t)return{properties:[],internalProperties:[]};const s=[],i={};function n(e,t){return new r.RemoteObject.RemoteObjectProperty(e,t,!1,!1,!0,!1)}for(const e of this.variables){let t;try{const o=await this.#A.evaluate(e.name,Z(this.#N),this.stopId);t=o?new se(this.#N,o,this.#A):new r.RemoteObject.LocalJSONObject(void 0)}catch(e){console.warn(e),t=new r.RemoteObject.LocalJSONObject(void 0)}if(e.nestedName&&e.nestedName.length>1){let o=i;for(let t=0;t<e.nestedName.length-1;t++){const r=e.nestedName[t];let s=o[r];s||(s=new te({}),o[r]=s),o=s.value}o[e.nestedName[e.nestedName.length-1]]=t}else s.push(n(e.name,t))}for(const e in i)s.push(n(e,i[e]));return{properties:s,internalProperties:[]}}}class re{#x;#O;#W;#B;#H;#_;#z;constructor(e,t,o,r,s,i){if(s&&"data:"!==new URL(s).protocol)throw new Error("The icon must be a data:-URL");this.#x=e,this.#O=o,this.#W=r,this.#B=s,this.#H=new oe(e,t,i),this.#_=null,this.#z=null}async getVariableValue(e){for(let t=0;t<this.#H.variables.length;++t){if(this.#H.variables[t].name!==e)continue;const o=await this.#H.getAllProperties(!1,!1);if(!o.properties)continue;const{value:r}=o.properties[t];if(r)return r}return null}callFrame(){return this.#x}type(){return this.#O}typeName(){return this.#W}name(){}startLocation(){return this.#_}endLocation(){return this.#z}object(){return this.#H}description(){return""}icon(){return this.#B}}class se extends r.RemoteObject.RemoteObject{extensionObject;plugin;callFrame;constructor(e,t,o){super(),this.extensionObject=t,this.plugin=o,this.callFrame=e}get linearMemoryAddress(){return this.extensionObject.linearMemoryAddress}get linearMemorySize(){return this.extensionObject.linearMemorySize}get objectId(){return this.extensionObject.objectId}get type(){return"array"===this.extensionObject.type||"null"===this.extensionObject.type?"object":this.extensionObject.type}get subtype(){if("array"===this.extensionObject.type||"null"===this.extensionObject.type)return this.extensionObject.type}get value(){return this.extensionObject.value}unserializableValue(){}get description(){return this.extensionObject.description}set description(e){}get hasChildren(){return this.extensionObject.hasChildren}get preview(){}get className(){return this.extensionObject.className??null}arrayLength(){return 0}arrayBufferByteLength(){return 0}getOwnProperties(e,t){return this.getAllProperties(!1,e,t)}async getAllProperties(e,t,s){const{objectId:i}=this.extensionObject;if(i){o(this.plugin.getProperties);return{properties:(await this.plugin.getProperties(i)).map((e=>new r.RemoteObject.RemoteObjectProperty(e.name,new se(this.callFrame,e.value,this.plugin)))),internalProperties:null}}return{properties:null,internalProperties:null}}release(){const{objectId:e}=this.extensionObject;e&&(o(this.plugin.releaseObject),this.plugin.releaseObject(e))}debuggerModel(){return this.callFrame.debuggerModel}runtimeModel(){return this.callFrame.debuggerModel.runtimeModel()}}class ie{#V;#o;#q;#J;#K;callFrameByStopId=new Map;stopIdByCallFrame=new Map;nextStopId=0n;constructor(e,t,o){this.#V=t,this.#o=o,this.#q=[],this.#J=new Map,e.observeModels(r.DebuggerModel.DebuggerModel,this),this.#K=new Map}async evaluateOnCallFrame(e,t){const{script:o}=e,{expression:s,returnByValue:i,throwOnSideEffect:n}=t,{plugin:a}=await this.rawModuleIdAndPluginForScript(o);if(!a)return null;const c=Z(e);if(0===(await a.rawLocationToSourceLocation(c)).length)return null;if(i)return{error:"Cannot return by value"};if(n)return{error:"Cannot guarantee side-effect freedom"};try{const t=await a.evaluate(s,c,this.stopIdForCallFrame(e));return t?{object:new se(e,t,a),exceptionDetails:void 0}:{object:new r.RemoteObject.LocalJSONObject(void 0),exceptionDetails:void 0}}catch(t){if(t instanceof ee){const{exception:e,exceptionDetails:o}=t;return{object:e,exceptionDetails:o}}const{exception:o,exceptionDetails:r}=ee.makeLocal(e,t.message);return{object:o,exceptionDetails:r}}}stopIdForCallFrame(e){let t=this.stopIdByCallFrame.get(e);return void 0!==t||(t=this.nextStopId++,this.stopIdByCallFrame.set(e,t),this.callFrameByStopId.set(t,e)),t}callFrameForStopId(e){return this.callFrameByStopId.get(e)}expandCallFrames(e){return Promise.all(e.map((async e=>{const t=await this.getFunctionInfo(e.script,e.location());if(t){if("frames"in t&&t.frames.length)return t.frames.map((({name:t},o)=>e.createVirtualCallFrame(o,t)));if("missingSymbolFiles"in t&&t.missingSymbolFiles.length){const o=t.missingSymbolFiles,r=X($.debugSymbolsIncomplete,{PH1:e.functionName});e.setMissingDebugInfoDetails({details:r,resources:o})}else e.setMissingDebugInfoDetails({resources:[],details:X($.failedToLoadDebugSymbolsForFunction,{PH1:e.functionName})})}return e}))).then((e=>e.flat()))}modelAdded(e){this.#J.set(e,new ne(e,this.#V)),e.addEventListener(r.DebuggerModel.Events.GlobalObjectCleared,this.globalObjectCleared,this),e.addEventListener(r.DebuggerModel.Events.ParsedScriptSource,this.parsedScriptSource,this),e.addEventListener(r.DebuggerModel.Events.DebuggerResumed,this.debuggerResumed,this),e.setEvaluateOnCallFrameCallback(this.evaluateOnCallFrame.bind(this)),e.setExpandCallFramesCallback(this.expandCallFrames.bind(this))}modelRemoved(t){t.removeEventListener(r.DebuggerModel.Events.GlobalObjectCleared,this.globalObjectCleared,this),t.removeEventListener(r.DebuggerModel.Events.ParsedScriptSource,this.parsedScriptSource,this),t.removeEventListener(r.DebuggerModel.Events.DebuggerResumed,this.debuggerResumed,this),t.setEvaluateOnCallFrameCallback(null),t.setExpandCallFramesCallback(null);const o=this.#J.get(t);o&&(o.dispose(),this.#J.delete(t)),this.#K.forEach(((o,r)=>{const s=o.scripts.filter((e=>e.debuggerModel!==t));0===s.length?(o.plugin.removeRawModule(r).catch((t=>{e.Console.Console.instance().error(X($.errorInDebuggerLanguagePlugin,{PH1:t.message}))})),this.#K.delete(r)):o.scripts=s}))}globalObjectCleared(e){const t=e.data;this.modelRemoved(t),this.modelAdded(t)}addPlugin(e){this.#q.push(e);for(const e of this.#J.keys())for(const t of e.scripts())this.hasPluginForScript(t)||this.parsedScriptSource({data:t})}removePlugin(e){this.#q=this.#q.filter((t=>t!==e));const t=new Set;this.#K.forEach(((o,r)=>{o.plugin===e&&(o.scripts.forEach((e=>t.add(e))),this.#K.delete(r))}));for(const e of t){this.#J.get(e.debuggerModel).removeScript(e),this.parsedScriptSource({data:e})}}hasPluginForScript(e){const t=Y(e),o=this.#K.get(t);return void 0!==o&&o.scripts.includes(e)}async rawModuleIdAndPluginForScript(e){const t=Y(e),o=this.#K.get(t);return o&&(await o.addRawModulePromise,o===this.#K.get(t))?{rawModuleId:t,plugin:o.plugin}:{rawModuleId:t,plugin:null}}uiSourceCodeForURL(e,t){const o=this.#J.get(e);return o?o.getProject().uiSourceCodeForURL(t):null}async rawLocationToUILocation(t){const o=t.script();if(!o)return null;const{rawModuleId:r,plugin:s}=await this.rawModuleIdAndPluginForScript(o);if(!s)return null;const i={rawModuleId:r,codeOffset:t.columnNumber-(o.codeOffset()||0),inlineFrameIndex:t.inlineFrameIndex};try{const e=await s.rawLocationToSourceLocation(i);for(const t of e){const e=this.uiSourceCodeForURL(o.debuggerModel,t.sourceFileURL);if(e)return e.uiLocation(t.lineNumber,t.columnNumber>=0?t.columnNumber:void 0)}}catch(t){e.Console.Console.instance().error(X($.errorInDebuggerLanguagePlugin,{PH1:t.message}))}return null}uiLocationToRawLocationRanges(t,o,s=-1){const i=[];return this.scriptsForUISourceCode(t).forEach((e=>{const n=Y(e),a=this.#K.get(n);if(!a)return;const{plugin:c}=a;i.push(async function(e,i,n){const a={rawModuleId:e,sourceFileURL:t.url(),lineNumber:o,columnNumber:s},c=await i.sourceLocationToRawLocation(a);if(!c)return[];return c.map((e=>({start:new r.DebuggerModel.Location(n.debuggerModel,n.scriptId,0,Number(e.startOffset)+(n.codeOffset()||0)),end:new r.DebuggerModel.Location(n.debuggerModel,n.scriptId,0,Number(e.endOffset)+(n.codeOffset()||0))})))}(n,c,e))})),0===i.length?Promise.resolve(null):Promise.all(i).then((e=>e.flat())).catch((t=>(e.Console.Console.instance().error(X($.errorInDebuggerLanguagePlugin,{PH1:t.message})),null)))}async uiLocationToRawLocations(e,t,o){const r=await this.uiLocationToRawLocationRanges(e,t,o);return r?r.map((({start:e})=>e)):null}async uiLocationRangeToRawLocationRanges(e,t){const o=[];for(let r=t.startLine;r<=t.endLine;++r)o.push(this.uiLocationToRawLocationRanges(e,r));const r=[];for(const e of await Promise.all(o)){if(null===e)return null;for(const o of e){const[e,i]=await Promise.all([this.rawLocationToUILocation(o.start),this.rawLocationToUILocation(o.end)]);if(null===e||null===i)continue;t.intersection(new s.TextRange.TextRange(e.lineNumber,e.columnNumber??0,i.lineNumber,i.columnNumber??1/0)).isEmpty()||r.push(o)}}return r}scriptsForUISourceCode(e){for(const t of this.#J.values()){const o=t.uiSourceCodeToScripts.get(e);if(o)return o}return[]}setDebugInfoURL(e,t){this.hasPluginForScript(e)||(e.debugSymbols={type:"ExternalDWARF",externalURL:t},this.parsedScriptSource({data:e}),e.debuggerModel.setDebugInfoURL(e,t))}parsedScriptSource(t){const o=t.data;if(o.sourceURL)for(const t of this.#q){if(!t.handleScript(o))continue;const r=Y(o);let s=this.#K.get(r);if(s)s.scripts.push(o);else{const i=(async()=>{const i=e.Console.Console.instance(),n=o.sourceURL,a=o.debugSymbols&&o.debugSymbols.externalURL||"";a?i.log(X($.loadingDebugSymbolsForVia,{PH1:t.name,PH2:n,PH3:a})):i.log(X($.loadingDebugSymbolsFor,{PH1:t.name,PH2:n}));try{const e=!a&&n.startsWith("wasm://")?await o.getWasmBytecode():void 0,c=await t.addRawModule(r,a,{url:n,code:e});if(s!==this.#K.get(r))return[];if("missingSymbolFiles"in c)return{missingSymbolFiles:c.missingSymbolFiles};const u=c;return 0===u.length?i.warn(X($.loadedDebugSymbolsForButDidnt,{PH1:t.name,PH2:n})):i.log(X($.loadedDebugSymbolsForFound,{PH1:t.name,PH2:n,PH3:u.length})),u}catch(e){return i.error(X($.failedToLoadDebugSymbolsFor,{PH1:t.name,PH2:n,PH3:e.message})),this.#K.delete(r),[]}})();s={rawModuleId:r,plugin:t,scripts:[o],addRawModulePromise:i},this.#K.set(r,s)}return void s.addRawModulePromise.then((e=>{if(!("missingSymbolFiles"in e)&&o.debuggerModel.scriptForId(o.scriptId)===o){const t=this.#J.get(o.debuggerModel);t&&(t.addSourceFiles(o,e),this.#o.updateLocations(o))}}))}}debuggerResumed(e){const t=Array.from(this.callFrameByStopId.values()).filter((t=>t.debuggerModel===e.data));for(const e of t){const t=this.stopIdByCallFrame.get(e);o(t),this.stopIdByCallFrame.delete(e),this.callFrameByStopId.delete(t)}}getSourcesForScript(e){const t=Y(e),o=this.#K.get(t);return o?o.addRawModulePromise:Promise.resolve(void 0)}async resolveScopeChain(t){const o=t.script,{rawModuleId:r,plugin:s}=await this.rawModuleIdAndPluginForScript(o);if(!s)return null;const i={rawModuleId:r,codeOffset:t.location().columnNumber-(o.codeOffset()||0),inlineFrameIndex:t.inlineFrameIndex},n=this.stopIdForCallFrame(t);try{if(0===(await s.rawLocationToSourceLocation(i)).length)return null;const e=new Map,o=await s.listVariablesInScope(i);for(const r of o||[]){let o=e.get(r.scope);if(!o){const{type:i,typeName:a,icon:c}=await s.getScopeInfo(r.scope);o=new re(t,n,i,a,c,s),e.set(r.scope,o)}o.object().variables.push(r)}return Array.from(e.values())}catch(t){return e.Console.Console.instance().error(X($.errorInDebuggerLanguagePlugin,{PH1:t.message})),null}}async getFunctionInfo(t,o){const{rawModuleId:r,plugin:s}=await this.rawModuleIdAndPluginForScript(t);if(!s)return null;const i={rawModuleId:r,codeOffset:o.columnNumber-(t.codeOffset()||0),inlineFrameIndex:0};try{return await s.getFunctionInfo(i)}catch(t){return e.Console.Console.instance().warn(X($.errorInDebuggerLanguagePlugin,{PH1:t.message})),{frames:[]}}}async getInlinedFunctionRanges(t){const o=t.script();if(!o)return[];const{rawModuleId:s,plugin:i}=await this.rawModuleIdAndPluginForScript(o);if(!i)return[];const n={rawModuleId:s,codeOffset:t.columnNumber-(o.codeOffset()||0)};try{return(await i.getInlinedFunctionRanges(n)).map((e=>({start:new r.DebuggerModel.Location(o.debuggerModel,o.scriptId,0,Number(e.startOffset)+(o.codeOffset()||0)),end:new r.DebuggerModel.Location(o.debuggerModel,o.scriptId,0,Number(e.endOffset)+(o.codeOffset()||0))})))}catch(t){return e.Console.Console.instance().warn(X($.errorInDebuggerLanguagePlugin,{PH1:t.message})),[]}}async getInlinedCalleesRanges(t){const o=t.script();if(!o)return[];const{rawModuleId:s,plugin:i}=await this.rawModuleIdAndPluginForScript(o);if(!i)return[];const n={rawModuleId:s,codeOffset:t.columnNumber-(o.codeOffset()||0)};try{return(await i.getInlinedCalleesRanges(n)).map((e=>({start:new r.DebuggerModel.Location(o.debuggerModel,o.scriptId,0,Number(e.startOffset)+(o.codeOffset()||0)),end:new r.DebuggerModel.Location(o.debuggerModel,o.scriptId,0,Number(e.endOffset)+(o.codeOffset()||0))})))}catch(t){return e.Console.Console.instance().warn(X($.errorInDebuggerLanguagePlugin,{PH1:t.message})),[]}}async getMappedLines(e){const t=await Promise.all(this.scriptsForUISourceCode(e).map((e=>this.rawModuleIdAndPluginForScript(e))));let o=null;for(const{rawModuleId:r,plugin:s}of t){if(!s)continue;const t=await s.getMappedLines(r,e.url());void 0!==t&&(null===o?o=new Set(t):t.forEach((e=>o.add(e))))}return o}}class ne{project;uiSourceCodeToScripts;constructor(e,t){this.project=new d(t,"language_plugins::"+e.target().id(),i.Workspace.projectTypes.Network,"",!1),T.setTargetForProject(this.project,e.target()),this.uiSourceCodeToScripts=new Map}addSourceFiles(t,o){const s=t.createPageResourceLoadInitiator();for(const i of o){let o=this.project.uiSourceCodeForURL(i);if(o){const e=this.uiSourceCodeToScripts.get(o);e.includes(t)||e.push(t)}else{o=this.project.createUISourceCode(i,e.ResourceType.resourceTypes.SourceMapScript),T.setInitialFrameAttribution(o,t.frameId),this.uiSourceCodeToScripts.set(o,[t]);const n=new r.CompilerSourceMappingContentProvider.CompilerSourceMappingContentProvider(i,e.ResourceType.resourceTypes.SourceMapScript,s),a=e.ResourceType.ResourceType.mimeFromURL(i)||"text/javascript";this.project.addUISourceCodeWithProvider(o,n,null,a)}}}removeScript(e){this.uiSourceCodeToScripts.forEach(((t,o)=>{0===(t=t.filter((t=>t!==e))).length?(this.uiSourceCodeToScripts.delete(o),this.project.removeUISourceCode(o.url())):this.uiSourceCodeToScripts.set(o,t)}))}dispose(){this.project.dispose()}getProject(){return this.project}}var ae=Object.freeze({__proto__:null,SourceScope:re,ExtensionRemoteObject:se,DebuggerLanguagePluginManager:ie});class ce{#o;#S;#c;#G;#$;constructor(e,t,o){ue.add(this),this.#o=o,this.#S=new d(t,"debugger:"+e.target().id(),i.Workspace.projectTypes.Debugger,"",!0),this.#c=[e.addEventListener(r.DebuggerModel.Events.GlobalObjectCleared,this.globalObjectCleared,this),e.addEventListener(r.DebuggerModel.Events.ParsedScriptSource,this.parsedScriptSource,this),e.addEventListener(r.DebuggerModel.Events.DiscardedAnonymousScriptSource,this.discardedScriptSource,this)],this.#G=new Map,this.#$=new Map}static createV8ScriptURL(t){const o=e.ParsedURL.ParsedURL.extractName(t.sourceURL);return"debugger:///VM"+t.scriptId+(o?" "+o:"")}static scriptForUISourceCode(e){for(const t of ue){const o=t.#G.get(e);if(void 0!==o)return o}return null}uiSourceCodeForScript(e){return this.#$.get(e)??null}rawLocationToUILocation(e){const t=e.script();if(!t)return null;const o=this.#$.get(t);if(!o)return null;const{lineNumber:r,columnNumber:s}=t.rawLocationToRelativeLocation(e);return o.uiLocation(r,s)}uiLocationToRawLocations(e,t,o){const r=this.#G.get(e);return r?(({lineNumber:t,columnNumber:o}=r.relativeLocationToRawLocation({lineNumber:t,columnNumber:o})),[r.debuggerModel.createRawLocation(r,t,o??0)]):[]}uiLocationRangeToRawLocationRanges(e,{startLine:t,startColumn:o,endLine:r,endColumn:s}){const i=this.#G.get(e);if(!i)return[];({lineNumber:t,columnNumber:o}=i.relativeLocationToRawLocation({lineNumber:t,columnNumber:o})),({lineNumber:r,columnNumber:s}=i.relativeLocationToRawLocation({lineNumber:r,columnNumber:s}));return[{start:i.debuggerModel.createRawLocation(i,t,o),end:i.debuggerModel.createRawLocation(i,r,s)}]}parsedScriptSource(t){const o=t.data,r=ce.createV8ScriptURL(o),s=this.#S.createUISourceCode(r,e.ResourceType.resourceTypes.Script);o.isBreakpointCondition&&s.markAsUnconditionallyIgnoreListed(),this.#G.set(s,o),this.#$.set(o,s),this.#S.addUISourceCodeWithProvider(s,o,null,"text/javascript"),this.#o.updateLocations(o)}discardedScriptSource(e){const t=e.data,o=this.#$.get(t);void 0!==o&&(this.#$.delete(t),this.#G.delete(o),this.#S.removeUISourceCode(o.url()))}globalObjectCleared(){this.#$.clear(),this.#G.clear(),this.#S.reset()}dispose(){ue.delete(this),e.EventTarget.removeEventListeners(this.#c),this.globalObjectCleared(),this.#S.dispose()}}const ue=new Set;var le=Object.freeze({__proto__:null,DefaultScriptMapping:ce});const de={liveEditFailed:"`LiveEdit` failed: {PH1}",liveEditCompileFailed:"`LiveEdit` compile failed: {PH1}"},ge=n.i18n.registerUIStrings("models/bindings/ResourceScriptMapping.ts",de),pe=n.i18n.getLocalizedString.bind(void 0,ge);class he{debuggerModel;#V;debuggerWorkspaceBinding;#Q;#u;#$;#c;constructor(e,t,o){this.debuggerModel=e,this.#V=t,this.debuggerWorkspaceBinding=o,this.#Q=new Map,this.#u=new Map,this.#$=new Map;const s=e.runtimeModel();this.#c=[this.debuggerModel.addEventListener(r.DebuggerModel.Events.ParsedScriptSource,(e=>this.addScript(e.data)),this),this.debuggerModel.addEventListener(r.DebuggerModel.Events.GlobalObjectCleared,this.globalObjectCleared,this),s.addEventListener(r.RuntimeModel.Events.ExecutionContextDestroyed,this.executionContextDestroyed,this),s.target().targetManager().addEventListener(r.TargetManager.Events.InspectedURLChanged,this.inspectedURLChanged,this)]}project(e){const t=(e.isContentScript()?"js:extensions:":"js::")+this.debuggerModel.target().id()+":"+e.frameId;let o=this.#u.get(t);if(!o){const r=e.isContentScript()?i.Workspace.projectTypes.ContentScripts:i.Workspace.projectTypes.Network;o=new d(this.#V,t,r,"",!1),T.setTargetForProject(o,this.debuggerModel.target()),this.#u.set(t,o)}return o}uiSourceCodeForScript(e){return this.#$.get(e)??null}rawLocationToUILocation(e){const t=e.script();if(!t)return null;const o=this.#$.get(t);if(!o)return null;const r=this.#Q.get(o);if(!r)return null;if(r.hasDivergedFromVM()&&!r.isMergingToVM()||r.isDivergingFromVM())return null;if(r.script!==t)return null;const{lineNumber:s,columnNumber:i=0}=e;return o.uiLocation(s,i)}uiLocationToRawLocations(e,t,o){const r=this.#Q.get(e);if(!r)return[];const{script:s}=r;return s?[this.debuggerModel.createRawLocation(s,t,o)]:[]}uiLocationRangeToRawLocationRanges(e,{startLine:t,startColumn:o,endLine:r,endColumn:s}){const i=this.#Q.get(e);if(!i)return null;const{script:n}=i;if(!n)return null;return[{start:this.debuggerModel.createRawLocation(n,t,o),end:this.debuggerModel.createRawLocation(n,r,s)}]}inspectedURLChanged(e){for(let t=this.debuggerModel.target();t!==e.data;t=t.parentTarget())if(null===t)return;for(const e of Array.from(this.#$.keys()))this.removeScripts([e]),this.addScript(e)}addScript(t){if(t.isLiveEdit()||t.isBreakpointCondition)return;let o=t.sourceURL;if(!o)return;if(t.hasSourceURL)o=r.SourceMapManager.SourceMapManager.resolveRelativeSourceURL(t.debuggerModel.target(),o);else{if(t.isInlineScript())return;if(t.isContentScript()){if(!new e.ParsedURL.ParsedURL(o).isValid)return}}const s=this.project(t),i=s.uiSourceCodeForURL(o);if(i){const e=this.#Q.get(i);e&&e.script&&this.removeScripts([e.script])}const n=t.originalContentProvider(),a=s.createUISourceCode(o,n.contentType());T.setInitialFrameAttribution(a,t.frameId);const c=x(this.debuggerModel.target(),t.frameId,o),u=new me(this,a,t);this.#Q.set(a,u),this.#$.set(t,a);const l=t.isWasm()?"application/wasm":"text/javascript";s.addUISourceCodeWithProvider(a,n,c,l),this.debuggerWorkspaceBinding.updateLocations(t)}scriptFile(e){return this.#Q.get(e)||null}removeScripts(e){const o=new t.MapUtilities.Multimap;for(const t of e){const e=this.#$.get(t);if(!e)continue;const r=this.#Q.get(e);r&&r.dispose(),this.#Q.delete(e),this.#$.delete(t),o.set(e.project(),e),this.debuggerWorkspaceBinding.updateLocations(t)}for(const e of o.keysArray()){const t=o.get(e);let r=!0;for(const o of e.uiSourceCodes())if(!t.has(o)){r=!1;break}r?(this.#u.delete(e.id()),e.removeProject()):t.forEach((t=>e.removeUISourceCode(t.url())))}}executionContextDestroyed(e){const t=e.data;this.removeScripts(this.debuggerModel.scriptsForExecutionContext(t))}globalObjectCleared(){const e=Array.from(this.#$.keys());this.removeScripts(e)}resetForTest(){this.globalObjectCleared()}dispose(){e.EventTarget.removeEventListeners(this.#c),this.globalObjectCleared()}}class me extends e.ObjectWrapper.ObjectWrapper{#X;#Y;#Z;#ee;#te;#oe;#re;#se=new e.Mutex.Mutex;constructor(e,t,o){super(),this.#X=e,this.#Y=t,this.#Y.contentType().isScript()&&(this.#Z=o),this.#Y.addEventListener(i.UISourceCode.Events.WorkingCopyChanged,this.workingCopyChanged,this),this.#Y.addEventListener(i.UISourceCode.Events.WorkingCopyCommitted,this.workingCopyCommitted,this)}isDiverged(){if(this.#Y.isDirty())return!0;if(!this.#Z)return!1;if(void 0===this.#ee||null===this.#ee)return!1;const e=this.#Y.workingCopy();if(!e)return!1;if(!e.startsWith(this.#ee.trimEnd()))return!0;const t=this.#Y.workingCopy().substr(this.#ee.length);return Boolean(t.length)&&!t.match(r.Script.sourceURLRegex)}workingCopyChanged(){this.update()}workingCopyCommitted(){if(this.#Y.project().canSetFileContent())return;if(!this.#Z)return;const e=this.#Y.workingCopy();this.#Z.editSource(e).then((({status:t,exceptionDetails:o})=>{this.scriptSourceWasSet(e,t,o)}))}async scriptSourceWasSet(t,o,r){if("Ok"===o&&(this.#ee=t),await this.update(),"Ok"===o)return;if(!r)return void e.Console.Console.instance().addMessage(pe(de.liveEditFailed,{PH1:function(e){switch(e){case"BlockedByActiveFunction":return"Functions that are on the stack (currently being executed) can not be edited";case"BlockedByActiveGenerator":return"Async functions/generators that are active can not be edited";case"BlockedByTopLevelEsModuleChange":return"The top-level of ES modules can not be edited";case"CompileError":case"Ok":throw new Error("Compile errors and Ok status must not be reported on the console")}}(o)}),e.Console.MessageLevel.Warning);const s=pe(de.liveEditCompileFailed,{PH1:r.text});this.#Y.addLineMessage(i.UISourceCode.Message.Level.Error,s,r.lineNumber,r.columnNumber)}async update(){const e=await this.#se.acquire();this.isDiverged()&&!this.#oe?await this.divergeFromVM():!this.isDiverged()&&this.#oe&&await this.mergeToVM(),e()}async divergeFromVM(){this.#Z&&(this.#te=!0,await this.#X.debuggerWorkspaceBinding.updateLocations(this.#Z),this.#te=void 0,this.#oe=!0,this.dispatchEventToListeners("DidDivergeFromVM"))}async mergeToVM(){this.#Z&&(this.#oe=void 0,this.#re=!0,await this.#X.debuggerWorkspaceBinding.updateLocations(this.#Z),this.#re=void 0,this.dispatchEventToListeners("DidMergeToVM"))}hasDivergedFromVM(){return Boolean(this.#oe)}isDivergingFromVM(){return Boolean(this.#te)}isMergingToVM(){return Boolean(this.#re)}checkMapping(){this.#Z&&void 0===this.#ee?this.#Z.requestContent().then((e=>{this.#ee=e.content,this.update().then((()=>this.mappingCheckedForTest()))})):this.mappingCheckedForTest()}mappingCheckedForTest(){}dispose(){this.#Y.removeEventListener(i.UISourceCode.Events.WorkingCopyChanged,this.workingCopyChanged,this),this.#Y.removeEventListener(i.UISourceCode.Events.WorkingCopyCommitted,this.workingCopyCommitted,this)}addSourceMapURL(e){this.#Z&&this.#Z.debuggerModel.setSourceMapURL(this.#Z,e)}addDebugInfoURL(e){if(!this.#Z)return;const{pluginManager:t}=Me.instance();t&&t.setDebugInfoURL(this.#Z,e)}hasSourceMapURL(){return void 0!==this.#Z&&Boolean(this.#Z.sourceMapURL)}async missingSymbolFiles(){if(!this.#Z)return null;const{pluginManager:e}=this.#X.debuggerWorkspaceBinding;if(!e)return null;const t=await e.getSourcesForScript(this.#Z);return t&&"missingSymbolFiles"in t?t.missingSymbolFiles:null}get script(){return this.#Z||null}get uiSourceCode(){return this.#Y}}var Se=Object.freeze({__proto__:null,ResourceScriptMapping:he,ResourceScriptFile:me});let Le;class Me{resourceMapping;#ie;#J;#F;pluginManager;#ne;constructor(e,t){this.resourceMapping=e,this.#ie=[],this.#J=new Map,t.addModelListener(r.DebuggerModel.DebuggerModel,r.DebuggerModel.Events.GlobalObjectCleared,this.globalObjectCleared,this),t.addModelListener(r.DebuggerModel.DebuggerModel,r.DebuggerModel.Events.DebuggerResumed,this.debuggerResumed,this),t.observeModels(r.DebuggerModel.DebuggerModel,this),this.#ne=t,this.#F=new Set,this.pluginManager=a.Runtime.experiments.isEnabled("wasmDWARFDebugging")?new ie(t,e.workspace,this):null}initPluginManagerForTest(){return a.Runtime.experiments.isEnabled("wasmDWARFDebugging")?this.pluginManager||(this.pluginManager=new ie(this.#ne,this.resourceMapping.workspace,this)):this.pluginManager=null,this.pluginManager}static instance(e={forceNew:null,resourceMapping:null,targetManager:null}){const{forceNew:t,resourceMapping:o,targetManager:r}=e;if(!Le||t){if(!o||!r)throw new Error(`Unable to create DebuggerWorkspaceBinding: resourceMapping and targetManager must be provided: ${(new Error).stack}`);Le=new Me(o,r)}return Le}static removeInstance(){Le=void 0}addSourceMapping(e){this.#ie.push(e)}removeSourceMapping(e){const t=this.#ie.indexOf(e);-1!==t&&this.#ie.splice(t,1)}async computeAutoStepRanges(e,t){function o(e,t){const{start:o,end:r}=t;return o.scriptId===e.scriptId&&(!(e.lineNumber<o.lineNumber||e.lineNumber>r.lineNumber)&&(!(e.lineNumber===o.lineNumber&&e.columnNumber<o.columnNumber)&&!(e.lineNumber===r.lineNumber&&e.columnNumber>=r.columnNumber)))}const s=t.location();if(!s)return[];const i=this.pluginManager;let n=[];if(i){if(e===r.DebuggerModel.StepMode.StepOut)return await i.getInlinedFunctionRanges(s);const t=await i.rawLocationToUILocation(s);if(t)return n=await i.uiLocationToRawLocationRanges(t.uiSourceCode,t.lineNumber,t.columnNumber)||[],n=n.filter((e=>o(s,e))),e===r.DebuggerModel.StepMode.StepOver&&(n=n.concat(await i.getInlinedCalleesRanges(s))),n}const a=this.#J.get(s.debuggerModel)?.compilerMapping;return a?e===r.DebuggerModel.StepMode.StepOut?[]:(n=a.getLocationRangesForSameSourceLocation(s),n=n.filter((e=>o(s,e))),n):[]}modelAdded(e){e.setBeforePausedCallback(this.shouldPause.bind(this)),this.#J.set(e,new fe(e,this)),e.setComputeAutoStepRangesCallback(this.computeAutoStepRanges.bind(this))}modelRemoved(e){e.setComputeAutoStepRangesCallback(null);const t=this.#J.get(e);t&&(t.dispose(),this.#J.delete(e))}async pendingLiveLocationChangesPromise(){await Promise.all(this.#F)}recordLiveLocationChange(e){e.then((()=>{this.#F.delete(e)})),this.#F.add(e)}async updateLocations(e){const t=this.#J.get(e.debuggerModel);if(t){const o=t.updateLocations(e);this.recordLiveLocationChange(o),await o}}async createLiveLocation(e,t,o){const r=this.#J.get(e.debuggerModel);if(!r)return null;const s=r.createLiveLocation(e,t,o);return this.recordLiveLocationChange(s),s}async createStackTraceTopFrameLiveLocation(e,t,o){console.assert(e.length>0);const r=Ce.createStackTraceTopFrameLocation(e,this,t,o);return this.recordLiveLocationChange(r),r}async createCallFrameLiveLocation(e,t,o){if(!e.script())return null;const r=e.debuggerModel,s=this.createLiveLocation(e,t,o);this.recordLiveLocationChange(s);const i=await s;return i?(this.registerCallFrameLiveLocation(r,i),i):null}async rawLocationToUILocation(e){for(const t of this.#ie){const o=t.rawLocationToUILocation(e);if(o)return o}if(this.pluginManager){const t=await this.pluginManager.rawLocationToUILocation(e);if(t)return t}const t=this.#J.get(e.debuggerModel);return t?t.rawLocationToUILocation(e):null}uiSourceCodeForSourceMapSourceURL(e,t,o){const r=this.#J.get(e);return r?r.compilerMapping.uiSourceCodeForURL(t,o):null}async uiSourceCodeForSourceMapSourceURLPromise(e,t,o){return this.uiSourceCodeForSourceMapSourceURL(e,t,o)||this.waitForUISourceCodeAdded(t,e.target())}async uiSourceCodeForDebuggerLanguagePluginSourceURLPromise(e,t){if(this.pluginManager){return this.pluginManager.uiSourceCodeForURL(e,t)||this.waitForUISourceCodeAdded(t,e.target())}return null}uiSourceCodeForScript(e){const t=this.#J.get(e.debuggerModel);return t?t.uiSourceCodeForScript(e):null}waitForUISourceCodeAdded(e,t){return new Promise((o=>{const r=i.Workspace.WorkspaceImpl.instance(),s=r.addEventListener(i.Workspace.Events.UISourceCodeAdded,(n=>{const a=n.data;a.url()===e&&T.targetForUISourceCode(a)===t&&(r.removeEventListener(i.Workspace.Events.UISourceCodeAdded,s.listener),o(a))}))}))}async uiLocationToRawLocations(e,t,o){for(const r of this.#ie){const s=r.uiLocationToRawLocations(e,t,o);if(s.length)return s}const r=await(this.pluginManager?.uiLocationToRawLocations(e,t,o));if(r)return r;for(const r of this.#J.values()){const s=r.uiLocationToRawLocations(e,t,o);if(s.length)return s}return[]}async uiLocationRangeToRawLocationRanges(e,t){for(const o of this.#ie){const r=o.uiLocationRangeToRawLocationRanges(e,t);if(r)return r}if(null!==this.pluginManager){const o=await this.pluginManager.uiLocationRangeToRawLocationRanges(e,t);if(o)return o}for(const o of this.#J.values()){const r=o.uiLocationRangeToRawLocationRanges(e,t);if(r)return r}return[]}uiLocationToRawLocationsForUnformattedJavaScript(e,t,o){console.assert(e.contentType().isScript());const r=[];for(const s of this.#J.values())r.push(...s.uiLocationToRawLocations(e,t,o));return r}async normalizeUILocation(e){const t=await this.uiLocationToRawLocations(e.uiSourceCode,e.lineNumber,e.columnNumber);for(const e of t){const t=await this.rawLocationToUILocation(e);if(t)return t}return e}async getMappedLines(e){for(const t of this.#J.values()){const o=t.getMappedLines(e);if(null!==o)return o}const{pluginManager:t}=this;return t?await t.getMappedLines(e):null}scriptFile(e,t){const o=this.#J.get(t);return o?o.getResourceScriptMapping().scriptFile(e):null}scriptsForUISourceCode(e){const t=new Set;this.pluginManager&&this.pluginManager.scriptsForUISourceCode(e).forEach((e=>t.add(e)));for(const o of this.#J.values()){const r=o.getResourceScriptMapping().scriptFile(e);r&&r.script&&t.add(r.script),o.compilerMapping.scriptsForUISourceCode(e).forEach((e=>t.add(e)))}return[...t]}supportsConditionalBreakpoints(e){if(!this.pluginManager)return!0;return this.pluginManager.scriptsForUISourceCode(e).every((e=>e.isJavaScript()))}globalObjectCleared(e){this.reset(e.data)}reset(e){const t=this.#J.get(e);if(t){for(const e of t.callFrameLocations.values())this.removeLiveLocation(e);t.callFrameLocations.clear()}}resetForTest(e){const t=e.model(r.DebuggerModel.DebuggerModel),o=this.#J.get(t);o&&o.getResourceScriptMapping().resetForTest()}registerCallFrameLiveLocation(e,t){const o=this.#J.get(e);if(o){o.callFrameLocations.add(t)}}removeLiveLocation(e){const t=this.#J.get(e.rawLocation.debuggerModel);t&&t.disposeLocation(e)}debuggerResumed(e){this.reset(e.data)}async shouldPause(t,o){const{callFrames:[r]}=t;if(!r)return!1;const s=r.functionLocation();if(!(o&&"step"===t.reason&&s&&this.pluginManager&&r.script.isWasm()&&e.Settings.moduleSetting("wasmAutoStepping").get()&&this.pluginManager.hasPluginForScript(r.script)))return!0;return!!await this.pluginManager.rawLocationToUILocation(r.location())||(o.script()!==s.script()||o.columnNumber!==s.columnNumber||o.lineNumber!==s.lineNumber)}}class fe{#ae;#o;callFrameLocations;#ce;#R;#X;compilerMapping;#m;constructor(e,o){this.#ae=e,this.#o=o,this.callFrameLocations=new Set;const{workspace:r}=o.resourceMapping;this.#ce=new ce(e,r,o),this.#R=o.resourceMapping,this.#X=new he(e,r,o),this.compilerMapping=new y(e,r,o),this.#m=new t.MapUtilities.Multimap}async createLiveLocation(e,t,o){console.assert(""!==e.scriptId);const r=e.scriptId,s=new be(r,e,this.#o,t,o);return this.#m.set(r,s),await s.update(),s}disposeLocation(e){this.#m.delete(e.scriptId,e)}async updateLocations(e){const t=[];for(const o of this.#m.get(e.scriptId))t.push(o.update());await Promise.all(t)}rawLocationToUILocation(e){let t=this.compilerMapping.rawLocationToUILocation(e);return t=t||this.#X.rawLocationToUILocation(e),t=t||this.#R.jsLocationToUILocation(e),t=t||this.#ce.rawLocationToUILocation(e),t}uiSourceCodeForScript(e){let t=null;return t=t||this.#X.uiSourceCodeForScript(e),t=t||this.#R.uiSourceCodeForScript(e),t=t||this.#ce.uiSourceCodeForScript(e),t}uiLocationToRawLocations(e,t,o=0){let r=this.compilerMapping.uiLocationToRawLocations(e,t,o);return r=r.length?r:this.#X.uiLocationToRawLocations(e,t,o),r=r.length?r:this.#R.uiLocationToJSLocations(e,t,o),r=r.length?r:this.#ce.uiLocationToRawLocations(e,t,o),r}uiLocationRangeToRawLocationRanges(e,t){let o=this.compilerMapping.uiLocationRangeToRawLocationRanges(e,t);return o??=this.#X.uiLocationRangeToRawLocationRanges(e,t),o??=this.#R.uiLocationRangeToJSLocationRanges(e,t),o??=this.#ce.uiLocationRangeToRawLocationRanges(e,t),o}getMappedLines(e){return this.compilerMapping.getMappedLines(e)}dispose(){this.#ae.setBeforePausedCallback(null),this.compilerMapping.dispose(),this.#X.dispose(),this.#ce.dispose()}getResourceScriptMapping(){return this.#X}}class be extends U{scriptId;rawLocation;#ue;constructor(e,t,o,r,s){super(r,s),this.scriptId=e,this.rawLocation=t,this.#ue=o}async uiLocation(){const e=this.rawLocation;return this.#ue.rawLocationToUILocation(e)}dispose(){super.dispose(),this.#ue.removeLiveLocation(this)}async isIgnoreListed(){const e=await this.uiLocation();return!!e&&L.instance().isUserOrSourceMapIgnoreListedUISourceCode(e.uiSourceCode)}}class Ce extends U{#le;#de;#m;constructor(e,t){super(e,t),this.#le=!0,this.#de=null,this.#m=null}static async createStackTraceTopFrameLocation(e,t,o,r){const s=new Ce(o,r),i=e.map((e=>t.createLiveLocation(e,s.scheduleUpdate.bind(s),r)));return s.#m=(await Promise.all(i)).filter((e=>Boolean(e))),await s.updateLocation(),s}async uiLocation(){return this.#de?this.#de.uiLocation():null}async isIgnoreListed(){return!!this.#de&&this.#de.isIgnoreListed()}dispose(){if(super.dispose(),this.#m)for(const e of this.#m)e.dispose();this.#m=null,this.#de=null}async scheduleUpdate(){this.#le||(this.#le=!0,queueMicrotask((()=>{this.updateLocation()})))}async updateLocation(){if(this.#le=!1,this.#m&&0!==this.#m.length){this.#de=this.#m[0];for(const e of this.#m)if(!await e.isIgnoreListed()){this.#de=e;break}this.update()}}}var Ie=Object.freeze({__proto__:null,DebuggerWorkspaceBinding:Me,Location:be});class ve{#ge;#pe;#he;#me;#Se;#Le;#Me;#fe;#be;#Ce;#Ie;#ve;constructor(e,t,o){this.#ge=e,this.#pe=e.size,this.#he=0,this.#Se=t,this.#Le=o,this.#Me=new TextDecoder,this.#fe=!1,this.#be=null,this.#me=null}async read(e){if(this.#Le&&this.#Le(this),this.#ge?.type.endsWith("gzip")){const e=this.#ge.stream(),t=this.decompressStream(e);this.#me=t.getReader()}else this.#ve=new FileReader,this.#ve.onload=this.onChunkLoaded.bind(this),this.#ve.onerror=this.onError.bind(this);return this.#Ie=e,this.loadChunk(),new Promise((e=>{this.#Ce=e}))}cancel(){this.#fe=!0}loadedSize(){return this.#he}fileSize(){return this.#pe}fileName(){return this.#ge?this.#ge.name:""}error(){return this.#be}decompressStream(e){const t=new DecompressionStream("gzip");return e.pipeThrough(t)}onChunkLoaded(e){if(this.#fe)return;if(e.target.readyState!==FileReader.DONE)return;if(!this.#ve)return;const t=this.#ve.result;this.#he+=t.byteLength;const o=this.#he===this.#pe;this.decodeChunkBuffer(t,o)}async decodeChunkBuffer(e,t){if(!this.#Ie)return;const o=this.#Me.decode(e,{stream:!t});await this.#Ie.write(o),this.#fe||(this.#Le&&this.#Le(this),t?this.finishRead():this.loadChunk())}async finishRead(){this.#Ie&&(this.#ge=null,this.#ve=null,await this.#Ie.close(),this.#Ce(!this.#be))}async loadChunk(){if(this.#Ie&&this.#ge){if(this.#me){const{value:e,done:t}=await this.#me.read();if(t||!e)return this.finishRead();this.decodeChunkBuffer(e.buffer,!1)}if(this.#ve){const e=this.#he,t=Math.min(this.#pe,e+this.#Se),o=this.#ge.slice(e,t);this.#ve.readAsArrayBuffer(o)}}}onError(e){const t=e.target;this.#be=t.error,this.#Ce(!1)}}var we=Object.freeze({__proto__:null,ChunkedFileReader:ve,FileOutputStream:class{#we;#Te;#Re;constructor(){this.#we=[]}async open(e){this.#Re=!1,this.#we=[],this.#Te=e;const t=await i.FileManager.FileManager.instance().save(this.#Te,"",!0);return t&&i.FileManager.FileManager.instance().addEventListener(i.FileManager.Events.AppendedToURL,this.onAppendDone,this),Boolean(t)}write(e){return new Promise((t=>{this.#we.push(t),i.FileManager.FileManager.instance().append(this.#Te,e)}))}async close(){this.#Re=!0,this.#we.length||(i.FileManager.FileManager.instance().removeEventListener(i.FileManager.Events.AppendedToURL,this.onAppendDone,this),i.FileManager.FileManager.instance().close(this.#Te))}onAppendDone(e){if(e.data!==this.#Te)return;const t=this.#we.shift();t&&t(),this.#we.length||this.#Re&&(i.FileManager.FileManager.instance().removeEventListener(i.FileManager.Events.AppendedToURL,this.onAppendDone,this),i.FileManager.FileManager.instance().close(this.#Te))}}});class Te{#ye=new WeakMap;constructor(){r.TargetManager.TargetManager.instance().observeModels(r.DebuggerModel.DebuggerModel,this),r.TargetManager.TargetManager.instance().observeModels(r.CSSModel.CSSModel,this)}modelAdded(e){const t=e.target(),o=this.#ye.get(t)??new Re;e instanceof r.DebuggerModel.DebuggerModel?o.setDebuggerModel(e):o.setCSSModel(e),this.#ye.set(t,o)}modelRemoved(e){const t=e.target();this.#ye.get(t)?.clear()}addMessage(e,t,o){this.#ye.get(o)?.addMessage(e,t)}clear(){for(const e of r.TargetManager.TargetManager.instance().targets()){this.#ye.get(e)?.clear()}}}class Re{#ae;#b;#Fe=new Map;#p;constructor(){this.#p=new P,i.Workspace.WorkspaceImpl.instance().addEventListener(i.Workspace.Events.UISourceCodeAdded,this.#Ue.bind(this))}setDebuggerModel(e){if(this.#ae)throw new Error("Cannot set DebuggerModel twice");this.#ae=e,e.addEventListener(r.DebuggerModel.Events.ParsedScriptSource,(e=>{queueMicrotask((()=>{this.#Pe(e)}))})),e.addEventListener(r.DebuggerModel.Events.GlobalObjectCleared,this.#ke,this)}setCSSModel(e){if(this.#b)throw new Error("Cannot set CSSModel twice");this.#b=e,e.addEventListener(r.CSSModel.Events.StyleSheetAdded,(e=>queueMicrotask((()=>this.#je(e)))))}async addMessage(e,t){const o=new Fe(e,this.#p),r=this.#De(t)??this.#Ee(t)??this.#Ne(t);if(r&&await o.updateLocationSource(r),t.url){let e=this.#Fe.get(t.url);e||(e=[],this.#Fe.set(t.url,e)),e.push({source:t,presentation:o})}}#Ne(e){if(!e.url)return null;const t=i.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.url);return t?new i.UISourceCode.UILocation(t,e.line,e.column):null}#Ee(e){if(!this.#b||!e.url)return null;return this.#b.createRawLocationsByURL(e.url,e.line,e.column)[0]??null}#De(e){if(!this.#ae)return null;if(e.scriptId)return this.#ae.createRawLocationByScriptId(e.scriptId,e.line,e.column);const t=e.stackTrace&&e.stackTrace.callFrames?e.stackTrace.callFrames[0]:null;return t?this.#ae.createRawLocationByScriptId(t.scriptId,t.lineNumber,t.columnNumber):e.url?this.#ae.createRawLocationByURL(e.url,e.line,e.column):null}#Pe(e){const t=e.data,o=this.#Fe.get(t.sourceURL),r=[];for(const{presentation:e,source:s}of o??[]){const o=this.#De(s);o&&t.scriptId===o.scriptId&&r.push(e.updateLocationSource(o))}Promise.all(r).then(this.parsedScriptSourceForTest.bind(this))}parsedScriptSourceForTest(){}#Ue(e){const t=e.data,o=this.#Fe.get(t.url()),r=[];for(const{presentation:e,source:s}of o??[])r.push(e.updateLocationSource(new i.UISourceCode.UILocation(t,s.line,s.column)));Promise.all(r).then(this.uiSourceCodeAddedForTest.bind(this))}uiSourceCodeAddedForTest(){}#je(e){const t=e.data,o=this.#Fe.get(t.sourceURL),s=[];for(const{source:e,presentation:i}of o??[])t.containsLocation(e.line,e.column)&&s.push(i.updateLocationSource(new r.CSSModel.CSSLocation(t,e.line,e.column)));Promise.all(s).then(this.styleSheetAddedForTest.bind(this))}styleSheetAddedForTest(){}clear(){this.#ke()}#ke(){const e=Array.from(this.#Fe.values()).flat();for(const{presentation:t}of e)t.dispose();this.#Fe.clear(),this.#p.disposeAll()}}class ye extends U{#Ne;constructor(e,t,o){super(t,o),this.#Ne=e}async isIgnoreListed(){return!1}async uiLocation(){return this.#Ne}}class Fe{#Ae;#xe;#p;#Oe;constructor(e,t){this.#Oe=e,this.#p=t}async updateLocationSource(e){e instanceof r.DebuggerModel.Location?await Me.instance().createLiveLocation(e,this.#We.bind(this),this.#p):e instanceof r.CSSModel.CSSLocation?await q.instance().createLiveLocation(e,this.#We.bind(this),this.#p):e instanceof i.UISourceCode.UILocation&&(this.#xe||(this.#xe=new ye(e,this.#We.bind(this),this.#p),await this.#xe.update()))}async#We(e){this.#Ae&&this.#Ae.removeMessage(this.#Oe),e!==this.#xe&&(this.#Ae?.removeMessage(this.#Oe),this.#xe?.dispose(),this.#xe=e);const t=await e.uiLocation();t&&(this.#Oe.range=s.TextRange.TextRange.createFromLocation(t.lineNumber,t.columnNumber||0),this.#Ae=t.uiSourceCode,this.#Ae.addMessage(this.#Oe))}dispose(){this.#Ae?.removeMessage(this.#Oe),this.#xe?.dispose()}}var Ue=Object.freeze({__proto__:null,PresentationSourceFrameMessageManager:Te,PresentationConsoleMessageManager:class{#Be=new Te;constructor(){r.TargetManager.TargetManager.instance().addModelListener(r.ConsoleModel.ConsoleModel,r.ConsoleModel.Events.MessageAdded,(e=>this.consoleMessageAdded(e.data))),r.ConsoleModel.ConsoleModel.allMessagesUnordered().forEach(this.consoleMessageAdded,this),r.TargetManager.TargetManager.instance().addModelListener(r.ConsoleModel.ConsoleModel,r.ConsoleModel.Events.ConsoleCleared,(()=>this.#Be.clear()))}consoleMessageAdded(e){const t=e.runtimeModel();if(!e.isErrorOrWarning()||!e.runtimeModel()||"violation"===e.source||!t)return;const o="error"===e.level?i.UISourceCode.Message.Level.Error:i.UISourceCode.Message.Level.Warning;this.#Be.addMessage(new i.UISourceCode.Message(o,e.messageText),e,t.target())}},PresentationSourceFrameMessageHelper:Re,PresentationSourceFrameMessage:Fe});const Pe=new WeakMap,ke=new WeakMap,je=new WeakSet;function De(e){return new s.TextRange.TextRange(e.lineOffset,e.columnOffset,e.endLine,e.endColumn)}function Ee(e){return new s.TextRange.TextRange(e.startLine,e.startColumn,e.endLine,e.endColumn)}class Ne{project;#L;#b;#c;constructor(e,t){const o=t.target();this.project=new d(e,"resources:"+o.id(),i.Workspace.projectTypes.Network,"",!1),T.setTargetForProject(this.project,o),this.#L=new Map;const s=o.model(r.CSSModel.CSSModel);console.assert(Boolean(s)),this.#b=s;for(const e of t.frames())for(const t of e.getResourcesMap().values())this.addResource(t);this.#c=[t.addEventListener(r.ResourceTreeModel.Events.ResourceAdded,this.resourceAdded,this),t.addEventListener(r.ResourceTreeModel.Events.FrameWillNavigate,this.frameWillNavigate,this),t.addEventListener(r.ResourceTreeModel.Events.FrameDetached,this.frameDetached,this),this.#b.addEventListener(r.CSSModel.Events.StyleSheetChanged,(e=>{this.styleSheetChanged(e)}),this)]}async styleSheetChanged(e){const t=this.#b.styleSheetHeaderForId(e.data.styleSheetId);if(!t||!t.isInline||t.isInline&&t.isMutable)return;const o=this.#L.get(t.resourceURL());o&&await o.styleSheetChanged(t,e.data.edit||null)}acceptsResource(t){const o=t.resourceType();return(o===e.ResourceType.resourceTypes.Image||o===e.ResourceType.resourceTypes.Font||o===e.ResourceType.resourceTypes.Document||o===e.ResourceType.resourceTypes.Manifest)&&(!(o===e.ResourceType.resourceTypes.Image&&t.mimeType&&!t.mimeType.startsWith("image"))&&(!(o===e.ResourceType.resourceTypes.Font&&t.mimeType&&!t.mimeType.includes("font"))&&(o!==e.ResourceType.resourceTypes.Image&&o!==e.ResourceType.resourceTypes.Font||!t.contentURL().startsWith("data:"))))}resourceAdded(e){this.addResource(e.data)}addResource(e){if(!this.acceptsResource(e))return;let t=this.#L.get(e.url);t?t.addResource(e):(t=new Ae(this.project,e),this.#L.set(e.url,t))}removeFrameResources(e){for(const t of e.resources()){if(!this.acceptsResource(t))continue;const e=this.#L.get(t.url);e&&(1===e.resources.size?(e.dispose(),this.#L.delete(t.url)):e.removeResource(t))}}frameWillNavigate(e){this.removeFrameResources(e.data)}frameDetached(e){this.removeFrameResources(e.data.frame)}resetForTest(){for(const e of this.#L.values())e.dispose();this.#L.clear()}dispose(){e.EventTarget.removeEventListeners(this.#c);for(const e of this.#L.values())e.dispose();this.#L.clear(),this.project.removeProject()}getProject(){return this.project}}class Ae{resources;#S;#Ae;#He;constructor(e,t){this.resources=new Set([t]),this.#S=e,this.#Ae=this.#S.createUISourceCode(t.url,t.contentType()),je.add(this.#Ae),t.frameId&&T.setInitialFrameAttribution(this.#Ae,t.frameId),this.#S.addUISourceCodeWithProvider(this.#Ae,this,O(t),t.mimeType),this.#He=[],Promise.all([...this.inlineScripts().map((e=>Me.instance().updateLocations(e))),...this.inlineStyles().map((e=>q.instance().updateLocations(e)))])}inlineStyles(){const e=T.targetForUISourceCode(this.#Ae),t=[];if(!e)return t;const o=e.model(r.CSSModel.CSSModel);if(o)for(const e of o.getStyleSheetIdsForURL(this.#Ae.url())){const r=o.styleSheetHeaderForId(e);r&&t.push(r)}return t}inlineScripts(){const e=T.targetForUISourceCode(this.#Ae);if(!e)return[];const t=e.model(r.DebuggerModel.DebuggerModel);return t?t.scripts().filter((e=>e.embedderName()===this.#Ae.url())):[]}async styleSheetChanged(e,t){if(this.#He.push({stylesheet:e,edit:t}),this.#He.length>1)return;const{content:o}=await this.#Ae.requestContent();null!==o&&await this.innerStyleSheetChanged(o),this.#He=[]}async innerStyleSheetChanged(e){const t=this.inlineScripts(),o=this.inlineStyles();let r=new s.Text.Text(e);for(const e of this.#He){const i=e.edit;if(!i)continue;const n=e.stylesheet,a=Pe.get(n)??Ee(n),c=i.oldRange.relativeFrom(a.startLine,a.startColumn),u=i.newRange.relativeFrom(a.startLine,a.startColumn);r=new s.Text.Text(r.replaceRange(c,i.newText));const l=[];for(const e of t){const t=ke.get(e)??De(e);t.follows(c)&&(ke.set(e,t.rebaseAfterTextEdit(c,u)),l.push(Me.instance().updateLocations(e)))}for(const e of o){const t=Pe.get(e)??Ee(e);t.follows(c)&&(Pe.set(e,t.rebaseAfterTextEdit(c,u)),l.push(q.instance().updateLocations(e)))}await Promise.all(l)}this.#Ae.addRevision(r.value())}addResource(e){this.resources.add(e),e.frameId&&T.addFrameAttribution(this.#Ae,e.frameId)}removeResource(e){this.resources.delete(e),e.frameId&&T.removeFrameAttribution(this.#Ae,e.frameId)}dispose(){this.#S.removeUISourceCode(this.#Ae.url()),Promise.all([...this.inlineScripts().map((e=>Me.instance().updateLocations(e))),...this.inlineStyles().map((e=>q.instance().updateLocations(e)))])}firstResource(){return console.assert(this.resources.size>0),this.resources.values().next().value}contentURL(){return this.firstResource().contentURL()}contentType(){return this.firstResource().contentType()}requestContent(){return this.firstResource().requestContent()}searchInContent(e,t,o){return this.firstResource().searchInContent(e,t,o)}}var xe=Object.freeze({__proto__:null,ResourceMapping:class{workspace;#y;constructor(e,t){this.workspace=t,this.#y=new Map,e.observeModels(r.ResourceTreeModel.ResourceTreeModel,this)}modelAdded(e){const t=new Ne(this.workspace,e);this.#y.set(e,t)}modelRemoved(e){const t=this.#y.get(e);t&&(t.dispose(),this.#y.delete(e))}infoForTarget(e){const t=e.model(r.ResourceTreeModel.ResourceTreeModel);return t&&this.#y.get(t)||null}uiSourceCodeForScript(e){const t=this.infoForTarget(e.debuggerModel.target());if(!t)return null;return t.getProject().uiSourceCodeForURL(e.sourceURL)}cssLocationToUILocation(e){const t=e.header();if(!t)return null;const o=this.infoForTarget(e.cssModel().target());if(!o)return null;const r=o.getProject().uiSourceCodeForURL(e.url);if(!r)return null;const s=Pe.get(t)??Ee(t),i=e.lineNumber+s.startLine-t.startLine;let n=e.columnNumber;return e.lineNumber===t.startLine&&(n+=s.startColumn-t.startColumn),r.uiLocation(i,n)}jsLocationToUILocation(e){const t=e.script();if(!t)return null;const o=this.infoForTarget(e.debuggerModel.target());if(!o)return null;const r=t.embedderName();if(!r)return null;const s=o.getProject().uiSourceCodeForURL(r);if(!s)return null;const{startLine:i,startColumn:n}=ke.get(t)??De(t);let{lineNumber:a,columnNumber:c}=e;return a===t.lineOffset&&(c+=n-t.columnOffset),a+=i-t.lineOffset,t.hasSourceURL&&(0===a&&(c+=t.columnOffset),a+=t.lineOffset),s.uiLocation(a,c)}uiLocationToJSLocations(e,t,o){if(!je.has(e))return[];const s=T.targetForUISourceCode(e);if(!s)return[];const i=s.model(r.DebuggerModel.DebuggerModel);if(!i)return[];const n=[];for(const r of i.scripts()){if(r.embedderName()!==e.url())continue;const s=ke.get(r)??De(r);if(!s.containsLocation(t,o))continue;let a=t,c=o;r.hasSourceURL&&(a-=s.startLine,0===a&&(c-=s.startColumn)),n.push(i.createRawLocation(r,a,c))}return n}uiLocationRangeToJSLocationRanges(e,t){if(!je.has(e))return null;const o=T.targetForUISourceCode(e);if(!o)return null;const s=o.model(r.DebuggerModel.DebuggerModel);if(!s)return null;const i=[];for(const o of s.scripts()){if(o.embedderName()!==e.url())continue;const r=(ke.get(o)??De(o)).intersection(t);if(r.isEmpty())continue;let{startLine:n,startColumn:a,endLine:c,endColumn:u}=r;o.hasSourceURL&&(n-=r.startLine,0===n&&(a-=r.startColumn),c-=r.startLine,0===c&&(u-=r.startColumn));const l=s.createRawLocation(o,n,a),d=s.createRawLocation(o,c,u);i.push({start:l,end:d})}return i}getMappedLines(e){if(!je.has(e))return null;const t=T.targetForUISourceCode(e);if(!t)return null;const o=t.model(r.DebuggerModel.DebuggerModel);if(!o)return null;const s=new Set;for(const t of o.scripts()){if(t.embedderName()!==e.url())continue;const{startLine:o,endLine:r}=ke.get(t)??De(t);for(let e=o;e<=r;++e)s.add(e)}return s}uiLocationToCSSLocations(e){if(!je.has(e.uiSourceCode))return[];const t=T.targetForUISourceCode(e.uiSourceCode);if(!t)return[];const o=t.model(r.CSSModel.CSSModel);return o?o.createRawLocationsByURL(e.uiSourceCode.url(),e.lineNumber,e.columnNumber):[]}resetForTest(e){const t=e.model(r.ResourceTreeModel.ResourceTreeModel),o=t?this.#y.get(t):null;o&&o.resetForTest()}}});var Oe=Object.freeze({__proto__:null,TempFile:class{#_e;constructor(){this.#_e=null}write(e){this.#_e&&e.unshift(this.#_e),this.#_e=new Blob(e,{type:"text/plain"})}read(){return this.readRange()}size(){return this.#_e?this.#_e.size:0}async readRange(t,o){if(!this.#_e)return e.Console.Console.instance().error("Attempt to read a temp file that was never written"),"";const r="number"==typeof t||"number"==typeof o?this.#_e.slice(t,o):this.#_e,s=new FileReader;try{await new Promise(((e,t)=>{s.onloadend=e,s.onerror=t,s.readAsText(r)}))}catch(t){e.Console.Console.instance().error("Failed to read from temp file: "+t.message)}return s.result}async copyToOutputStream(e,t){if(!this.#_e)return e.close(),null;const o=new ve(this.#_e,1e7,t);return o.read(e).then((e=>e?null:o.error()))}remove(){this.#_e=null}}});export{G as CSSWorkspaceBinding,F as CompilerScriptMapping,g as ContentProviderBasedProject,ae as DebuggerLanguagePlugins,Ie as DebuggerWorkspaceBinding,le as DefaultScriptMapping,we as FileUtils,f as IgnoreListManager,k as LiveLocation,R as NetworkProject,Ue as PresentationConsoleMessageHelper,xe as ResourceMapping,Se as ResourceScriptMapping,W as ResourceUtils,N as SASSSourceMapping,z as StylesSourceMapping,Oe as TempFile};
@@ -0,0 +1 @@
1
+ import*as n from"./breakpoints.js";self.Bindings=self.Bindings||{},Bindings=Bindings||{},Bindings.BreakpointManager=n.BreakpointManager.BreakpointManager,Bindings.BreakpointManager.Events=n.BreakpointManager.Events,Bindings.BreakpointManager.Breakpoint=n.BreakpointManager.Breakpoint,Bindings.BreakpointManager.ModelBreakpoint=n.BreakpointManager.ModelBreakpoint;
@@ -0,0 +1 @@
1
+ import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/platform/platform.js";import{assertNotNullOrUndefined as i}from"../../core/platform/platform.js";import*as r from"../../core/root/root.js";import*as s from"../../core/sdk/sdk.js";import*as n from"../bindings/bindings.js";import*as a from"../workspace/workspace.js";let u;class d extends e.ObjectWrapper.ObjectWrapper{storage=new h;#e;targetManager;debuggerWorkspaceBinding;#t=new Map;#o=new Map;#i=new Map;#r=[];constructor(e,t,o){super(),this.#e=t,this.targetManager=e,this.debuggerWorkspaceBinding=o,r.Runtime.experiments.isEnabled(r.Runtime.ExperimentName.SET_ALL_BREAKPOINTS_EAGERLY)&&(this.storage.mute(),this.#s(),this.storage.unmute()),this.#e.addEventListener(a.Workspace.Events.UISourceCodeAdded,this.uiSourceCodeAdded,this),this.#e.addEventListener(a.Workspace.Events.UISourceCodeRemoved,this.uiSourceCodeRemoved,this),this.#e.addEventListener(a.Workspace.Events.ProjectRemoved,this.projectRemoved,this),this.targetManager.observeModels(s.DebuggerModel.DebuggerModel,this)}#s(){for(const e of this.storage.breakpoints.values()){const t=h.computeId(e),o=new l(this,null,e,"RESTORED");this.#i.set(t,o)}}static instance(e={forceNew:null,targetManager:null,workspace:null,debuggerWorkspaceBinding:null}){const{forceNew:t,targetManager:o,workspace:i,debuggerWorkspaceBinding:r}=e;if(!u||t){if(!o||!i||!r)throw new Error(`Unable to create settings: targetManager, workspace, and debuggerWorkspaceBinding must be provided: ${(new Error).stack}`);u=new d(o,i,r)}return u}modelAdded(e){r.Runtime.experiments.isEnabled(r.Runtime.ExperimentName.INSTRUMENTATION_BREAKPOINTS)&&e.setSynchronizeBreakpointsCallback(this.restoreBreakpointsForScript.bind(this))}modelRemoved(e){e.setSynchronizeBreakpointsCallback(null)}addUpdateBindingsCallback(e){this.#r.push(e)}async copyBreakpoints(e,t){const o=t.project().uiSourceCodeForURL(t.url())!==t||this.#e.project(t.project().id())!==t.project(),i=this.storage.breakpointItems(e.url(),e.contentType().name());for(const e of i)o?this.storage.updateBreakpoint({...e,url:t.url(),resourceTypeName:t.contentType().name()}):await this.setBreakpoint(t,e.lineNumber,e.columnNumber,e.condition,e.enabled,e.isLogpoint,"RESTORED")}async restoreBreakpointsForScript(e){if(!r.Runtime.experiments.isEnabled(r.Runtime.ExperimentName.INSTRUMENTATION_BREAKPOINTS))return;if(!e.sourceURL)return;const t=await this.getUISourceCodeWithUpdatedBreakpointInfo(e);this.#n(e.sourceURL)&&await this.#a(t);const o=e.debuggerModel,s=await o.sourceMapManager().sourceMapForClientPromise(e);if(s)for(const t of s.sourceURLs())if(this.#n(t)){const i=await this.debuggerWorkspaceBinding.uiSourceCodeForSourceMapSourceURLPromise(o,t,e.isContentScript());await this.#a(i)}const{pluginManager:n}=this.debuggerWorkspaceBinding;if(n){const t=await n.getSourcesForScript(e);if(Array.isArray(t))for(const e of t)if(this.#n(e)){const t=await this.debuggerWorkspaceBinding.uiSourceCodeForDebuggerLanguagePluginSourceURLPromise(o,e);i(t),await this.#a(t)}}}async getUISourceCodeWithUpdatedBreakpointInfo(e){const t=this.debuggerWorkspaceBinding.uiSourceCodeForScript(e);return i(t),await this.#u(t),t}async#u(e){if(this.#r.length>0){const t=[];for(const o of this.#r)t.push(o(e));await Promise.all(t)}}async#a(e){this.restoreBreakpoints(e);const t=this.#i.values(),o=Array.from(t).filter((t=>t.uiSourceCodes.has(e)));await Promise.all(o.map((e=>e.updateBreakpoint())))}#n(e){return this.storage.breakpointItems(e).length>0}static getScriptForInlineUiSourceCode(e){const t=n.DefaultScriptMapping.DefaultScriptMapping.scriptForUISourceCode(e);return t&&t.isInlineScript()&&!t.hasSourceURL?t:null}static breakpointLocationFromUiLocation(e){const t=e.uiSourceCode,o=d.getScriptForInlineUiSourceCode(t),{lineNumber:i,columnNumber:r}=o?o.relativeLocationToRawLocation(e):e;return{lineNumber:i,columnNumber:r}}static uiLocationFromBreakpointLocation(e,t,o){const i=d.getScriptForInlineUiSourceCode(e);return i&&({lineNumber:t,columnNumber:o}=i.rawLocationToRelativeLocation({lineNumber:t,columnNumber:o})),e.uiLocation(t,o)}static isValidPositionInScript(e,t,o){return!o||!(e<o.lineOffset||e>o.endLine)&&(!(e===o.lineOffset&&t&&t<o.columnOffset)&&!(e===o.endLine&&(!t||t>=o.endColumn)))}restoreBreakpoints(e){const t=d.getScriptForInlineUiSourceCode(e),o=t?.sourceURL??e.url();if(!o)return;const i=e.contentType();this.storage.mute();const r=this.storage.breakpointItems(o,i.name());for(const o of r){const{lineNumber:i,columnNumber:r}=o;d.isValidPositionInScript(i,r,t)&&this.innerSetBreakpoint(e,i,r,o.condition,o.enabled,o.isLogpoint,"RESTORED")}this.storage.unmute()}uiSourceCodeAdded(e){const t=e.data;this.restoreBreakpoints(t)}uiSourceCodeRemoved(e){const t=e.data;this.removeUISourceCode(t)}projectRemoved(e){const t=e.data;for(const e of t.uiSourceCodes())this.removeUISourceCode(e)}removeUISourceCode(e){this.#d(e).forEach((t=>t.removeUISourceCode(e)))}async setBreakpoint(t,o,i,r,s,n,u){const c=this.#e.findCompatibleUISourceCodes(t);let l;for(const p of c){const c=new a.UISourceCode.UILocation(p,o,i),h=await this.debuggerWorkspaceBinding.normalizeUILocation(c),g=d.breakpointLocationFromUiLocation(h),b=this.innerSetBreakpoint(h.uiSourceCode,g.lineNumber,g.columnNumber,r,s,n,u);t===p&&(h.id()!==c.id()&&e.Revealer.reveal(h),l=b)}return console.assert(void 0!==l,"The passed uiSourceCode is expected to be a valid uiSourceCode"),l}innerSetBreakpoint(e,t,o,i,r,s,n){const a={url:d.getScriptForInlineUiSourceCode(e)?.sourceURL??e.url(),resourceTypeName:e.contentType().name(),lineNumber:t,columnNumber:o,condition:i,enabled:r,isLogpoint:s},u=h.computeId(a);let c=this.#i.get(u);return c?(c.updateState(a),c.addUISourceCode(e),c.updateBreakpoint(),c):(c=new l(this,e,a,n),this.#i.set(u,c),c)}findBreakpoint(e){const t=this.#o.get(e.uiSourceCode);return t&&t.get(e.id())||null}addHomeUISourceCode(e,t){let o=this.#t.get(e);o||(o=new Set,this.#t.set(e,o)),o.add(t)}removeHomeUISourceCode(e,t){const o=this.#t.get(e);o&&(o.delete(t),0===o.size&&this.#t.delete(e))}async possibleBreakpoints(e,t){const o=await this.debuggerWorkspaceBinding.uiLocationRangeToRawLocationRanges(e,t),i=(await Promise.all(o.map((({start:e,end:t})=>e.debuggerModel.getPossibleBreakpoints(e,t,!1))))).flat(),r=new Map;return await Promise.all(i.map((async o=>{const i=await this.debuggerWorkspaceBinding.rawLocationToUILocation(o);null!==i&&i.uiSourceCode===e&&t.containsLocation(i.lineNumber,i.columnNumber??0)&&r.set(i.id(),i)}))),[...r.values()]}breakpointLocationsForUISourceCode(e){const t=this.#o.get(e);return t?Array.from(t.values()):[]}#d(e){return this.breakpointLocationsForUISourceCode(e).map((e=>e.breakpoint)).concat(Array.from(this.#t.get(e)??[]))}allBreakpointLocations(){const e=[];for(const t of this.#o.values())e.push(...t.values());return e}removeBreakpoint(e,t){const o=e.breakpointStorageId();t&&this.storage.removeBreakpoint(o),this.#i.delete(o)}uiLocationAdded(e,t){let o=this.#o.get(t.uiSourceCode);o||(o=new Map,this.#o.set(t.uiSourceCode,o));const i=new g(e,t);o.set(t.id(),i),this.dispatchEventToListeners(c.BreakpointAdded,i)}uiLocationRemoved(e,t){const o=this.#o.get(t.uiSourceCode);if(!o)return;const i=o.get(t.id())||null;i&&(o.delete(t.id()),0===o.size&&this.#o.delete(t.uiSourceCode),this.dispatchEventToListeners(c.BreakpointRemoved,i))}supportsConditionalBreakpoints(e){return this.debuggerWorkspaceBinding.supportsConditionalBreakpoints(e)}}var c;!function(e){e.BreakpointAdded="breakpoint-added",e.BreakpointRemoved="breakpoint-removed"}(c||(c={}));class l{breakpointManager;#c=new Set;uiSourceCodes=new Set;#l;#p;isRemoved=!1;#h=null;#g=new Map;constructor(e,t,o,i){this.breakpointManager=e,this.#p=i,this.updateState(o),t?(console.assert(t.contentType().name()===o.resourceTypeName),this.addUISourceCode(t)):this.#b(o),this.breakpointManager.targetManager.observeModels(s.DebuggerModel.DebuggerModel,this)}#b(t){t.resolvedState?this.#h=t.resolvedState.map((e=>({...e,scriptHash:""}))):t.resourceTypeName===e.ResourceType.resourceTypes.Script.name()&&(this.#h=[{url:t.url,lineNumber:t.lineNumber,columnNumber:t.columnNumber,scriptHash:"",condition:this.backendCondition()}])}getLastResolvedState(){return this.#h}updateLastResolvedState(e){if(this.#h=e,!r.Runtime.experiments.isEnabled(r.Runtime.ExperimentName.SET_ALL_BREAKPOINTS_EAGERLY))return;let t;e&&(t=e.map((e=>({url:e.url,lineNumber:e.lineNumber,columnNumber:e.columnNumber,condition:e.condition})))),function(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],r=t[o];if(i.url!==r.url||i.lineNumber!==r.lineNumber||i.columnNumber!==r.columnNumber||i.condition!==r.condition)return!1}return!0}(this.#l.resolvedState,t)||(this.#l={...this.#l,resolvedState:t},this.breakpointManager.storage.updateBreakpoint(this.#l))}get origin(){return this.#p}async refreshInDebugger(){if(!this.isRemoved){const e=Array.from(this.#g.values());await Promise.all(e.map((async e=>(await e.resetBreakpoint(),this.#m(e)))))}}modelAdded(e){const t=this.breakpointManager.debuggerWorkspaceBinding,o=new p(e,this,t);this.#g.set(e,o),this.#m(o),e.addEventListener(s.DebuggerModel.Events.DebuggerWasEnabled,this.#k,this),e.addEventListener(s.DebuggerModel.Events.DebuggerWasDisabled,this.#S,this),e.addEventListener(s.DebuggerModel.Events.ScriptSourceWasEdited,this.#f,this)}modelRemoved(e){this.#g.get(e)?.cleanUpAfterDebuggerIsGone(),this.#g.delete(e),this.#L(e)}#L(e){e.removeEventListener(s.DebuggerModel.Events.DebuggerWasEnabled,this.#k,this),e.removeEventListener(s.DebuggerModel.Events.DebuggerWasDisabled,this.#S,this),e.removeEventListener(s.DebuggerModel.Events.ScriptSourceWasEdited,this.#f,this)}#k(e){const t=e.data,o=this.#g.get(t);o&&this.#m(o)}#S(e){const t=e.data;this.#g.get(t)?.cleanUpAfterDebuggerIsGone()}async#f(e){const{source:t,data:{script:o,status:i}}=e;if("Ok"!==i)return;console.assert(t instanceof s.DebuggerModel.DebuggerModel);const r=this.#g.get(t);r?.wasSetIn(o.scriptId)&&(await r.resetBreakpoint(),this.#m(r))}modelBreakpoint(e){return this.#g.get(e)}addUISourceCode(e){this.uiSourceCodes.has(e)||(this.uiSourceCodes.add(e),this.breakpointManager.addHomeUISourceCode(e,this),this.bound()||this.breakpointManager.uiLocationAdded(this,this.defaultUILocation(e)))}clearUISourceCodes(){this.bound()||this.removeAllUnboundLocations();for(const e of this.uiSourceCodes)this.removeUISourceCode(e)}removeUISourceCode(e){if(this.uiSourceCodes.has(e)&&(this.uiSourceCodes.delete(e),this.breakpointManager.removeHomeUISourceCode(e,this),this.bound()||this.breakpointManager.uiLocationRemoved(this,this.defaultUILocation(e))),this.bound()){for(const t of this.#c)t.uiSourceCode===e&&(this.#c.delete(t),this.breakpointManager.uiLocationRemoved(this,t));this.bound()||this.isRemoved||this.addAllUnboundLocations()}}url(){return this.#l.url}lineNumber(){return this.#l.lineNumber}columnNumber(){return this.#l.columnNumber}uiLocationAdded(e){this.isRemoved||(this.bound()||this.removeAllUnboundLocations(),this.#c.add(e),this.breakpointManager.uiLocationAdded(this,e))}uiLocationRemoved(e){this.#c.has(e)&&(this.#c.delete(e),this.breakpointManager.uiLocationRemoved(this,e),this.bound()||this.isRemoved||this.addAllUnboundLocations())}enabled(){return this.#l.enabled}bound(){return 0!==this.#c.size}hasBoundScript(){for(const e of this.uiSourceCodes)if(e.project().type()===a.Workspace.projectTypes.Network)return!0;return!1}setEnabled(e){this.updateState({...this.#l,enabled:e})}condition(){return this.#l.condition}backendCondition(){let e=this.condition();if(""===e)return"";let t=s.DebuggerModel.COND_BREAKPOINT_SOURCE_URL;return this.isLogpoint()&&(e=`${b}${e}${m}`,t=s.DebuggerModel.LOGPOINT_SOURCE_URL),`${e}\n\n//# sourceURL=${t}`}setCondition(e,t){this.updateState({...this.#l,condition:e,isLogpoint:t})}isLogpoint(){return this.#l.isLogpoint}get storageState(){return this.#l}updateState(e){this.#l?.enabled===e.enabled&&this.#l?.condition===e.condition&&this.#l?.isLogpoint===e.isLogpoint||(this.#l=e,this.breakpointManager.storage.updateBreakpoint(this.#l),this.updateBreakpoint())}async updateBreakpoint(){return this.bound()||(this.removeAllUnboundLocations(),this.isRemoved||this.addAllUnboundLocations()),this.#v()}async remove(e){if(this.getIsRemoved())return;this.isRemoved=!0;const t=!e;for(const e of this.#g.keys())this.#L(e);await this.#v(),this.breakpointManager.removeBreakpoint(this,t),this.breakpointManager.targetManager.unobserveModels(s.DebuggerModel.DebuggerModel,this),this.clearUISourceCodes()}breakpointStorageId(){return h.computeId(this.#l)}defaultUILocation(e){return d.uiLocationFromBreakpointLocation(e,this.#l.lineNumber,this.#l.columnNumber)}removeAllUnboundLocations(){for(const e of this.uiSourceCodes)this.breakpointManager.uiLocationRemoved(this,this.defaultUILocation(e))}addAllUnboundLocations(){for(const e of this.uiSourceCodes)this.breakpointManager.uiLocationAdded(this,this.defaultUILocation(e))}getUiSourceCodes(){return this.uiSourceCodes}getIsRemoved(){return this.isRemoved}async#v(){await Promise.all(Array.from(this.#g.values()).map((e=>this.#m(e))))}async#m(e){const t=await e.scheduleUpdateInDebugger();"ERROR_BACKEND"===t?await this.remove(!0):"ERROR_BREAKPOINT_CLASH"===t&&await this.remove(!1)}}class p{#I;#B;#R;#C=new n.LiveLocation.LiveLocationPool;#c=new Map;#U=new e.Mutex.Mutex;#N=!1;#M=null;#E=[];#w=new Set;constructor(e,t,o){this.#I=e,this.#B=t,this.#R=o}get currentState(){return this.#M}resetLocations(){for(const e of this.#c.values())this.#B.uiLocationRemoved(e);this.#c.clear(),this.#C.disposeAll(),this.#w.clear()}async scheduleUpdateInDebugger(){if(!this.#I.debuggerEnabled())return"OK";const e=await this.#U.acquire();let t="PENDING";for(;"PENDING"===t;)t=await this.#D();return e(),t}scriptDiverged(){for(const e of this.#B.getUiSourceCodes()){const t=this.#R.scriptFile(e,this.#I);if(t&&t.hasDivergedFromVM())return!0}return!1}async#D(){if(this.#I.target().isDisposed())return this.cleanUpAfterDebuggerIsGone(),"OK";const e=this.#B.lineNumber(),t=this.#B.columnNumber(),o=this.#B.backendCondition();let i=null;if(!this.#B.getIsRemoved()&&this.#B.enabled()&&!this.scriptDiverged()){let s=[];for(const o of this.#B.getUiSourceCodes()){const{lineNumber:i,columnNumber:r}=d.uiLocationFromBreakpointLocation(o,e,t);if(s=(await n.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().uiLocationToRawLocations(o,i,r)).filter((e=>e.debuggerModel===this.#I)),s.length)break}if(s.length&&s.every((e=>e.script()))){i=s.map((e=>{const t=e.script();return{url:t.sourceURL,scriptHash:t.hash,lineNumber:e.lineNumber,columnNumber:e.columnNumber,condition:o}})).slice(0)}else if(!r.Runtime.experiments.isEnabled(r.Runtime.ExperimentName.INSTRUMENTATION_BREAKPOINTS)){const r=this.#B.getLastResolvedState();if(r)i=r.map((e=>({...e,condition:o})));else{i=[{url:this.#B.url(),scriptHash:"",lineNumber:e,columnNumber:t,condition:o}]}}}const s=this.#E.length;if(s&&l.State.equals(i,this.#M))return"OK";if(this.#B.updateLastResolvedState(i),s)return await this.resetBreakpoint(),"PENDING";if(!i)return"OK";const{breakpointIds:a,locations:u,serverError:c}=await this.#y(i),p=c&&this.#I.debuggerEnabled()&&!this.#I.isReadyToPause();if(!a.length&&p)return"PENDING";if(this.#M=i,this.#N)return this.#N=!1,"OK";if(!a.length)return"ERROR_BACKEND";this.#E=a,this.#E.forEach((e=>this.#I.addBreakpointListener(e,this.breakpointResolved,this)));return(await Promise.all(u.map((e=>this.addResolvedLocation(e))))).includes("ERROR")?"ERROR_BREAKPOINT_CLASH":"OK"}async#y(e){const t=await Promise.all(e.map((e=>e.url?this.#I.setBreakpointByURL(e.url,e.lineNumber,e.columnNumber,e.condition):this.#I.setBreakpointInAnonymousScript(e.scriptHash,e.lineNumber,e.columnNumber,e.condition)))),o=[];let i=[],r=!1;for(const e of t)e.breakpointId?(o.push(e.breakpointId),i=i.concat(e.locations)):r=!0;return{breakpointIds:o,locations:i,serverError:r}}async resetBreakpoint(){this.#E.length&&(this.resetLocations(),await Promise.all(this.#E.map((e=>this.#I.removeBreakpoint(e)))),this.didRemoveFromDebugger(),this.#M=null)}didRemoveFromDebugger(){this.#N?this.#N=!1:(this.resetLocations(),this.#E.forEach((e=>this.#I.removeBreakpointListener(e,this.breakpointResolved,this))),this.#E=[])}async breakpointResolved({data:e}){"ERROR"===await this.addResolvedLocation(e)&&await this.#B.remove(!1)}async locationUpdated(e){const t=this.#c.get(e),o=await e.uiLocation();t&&this.#B.uiLocationRemoved(t),o?(this.#c.set(e,o),this.#B.uiLocationAdded(o)):this.#c.delete(e)}async addResolvedLocation(e){this.#w.add(e.scriptId);const t=await this.#R.rawLocationToUILocation(e);if(!t)return"OK";const o=this.#B.breakpointManager.findBreakpoint(t);return o&&o.breakpoint!==this.#B?"ERROR":(await this.#R.createLiveLocation(e,this.locationUpdated.bind(this),this.#C),"OK")}cleanUpAfterDebuggerIsGone(){this.#N=!0,this.resetLocations(),this.#M=null,this.#E.length&&this.didRemoveFromDebugger()}wasSetIn(e){return this.#w.has(e)}}!function(e){let t;!function(e){e.equals=function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){const i=e[o],r=t[o];if(i.url!==r.url)return!1;if(i.scriptHash!==r.scriptHash)return!1;if(i.lineNumber!==r.lineNumber)return!1;if(i.columnNumber!==r.columnNumber)return!1;if(i.condition!==r.condition)return!1}return!0}}(t=e.State||(e.State={}))}(l||(l={}));class h{setting;breakpoints;#A;constructor(){this.setting=e.Settings.Settings.instance().createLocalSetting("breakpoints",[]),this.breakpoints=new Map,this.#A=!1;for(const e of this.setting.get())this.breakpoints.set(h.computeId(e),e);t.userMetrics.breakpointsRestoredFromStorage(this.breakpoints.size)}mute(){this.#A=!0}unmute(){this.#A=!1}breakpointItems(e,t){const o=[];for(const i of this.breakpoints.values())i.url===e&&(i.resourceTypeName!==t&&void 0!==t||o.push(i));return o}updateBreakpoint(e){if(this.#A)return;const t=h.computeId(e);t&&(this.breakpoints.set(t,e),this.save())}removeBreakpoint(e){this.#A||(this.breakpoints.delete(e),this.save())}save(){this.setting.set(Array.from(this.breakpoints.values()))}static computeId({url:e,resourceTypeName:t,lineNumber:o,columnNumber:i}){if(!e)return"";let r=`${e}:${t}:${o}`;return void 0!==i&&(r+=`:${i}`),r}}class g{breakpoint;uiLocation;constructor(e,t){this.breakpoint=e,this.uiLocation=t}}const b="/** DEVTOOLS_LOGPOINT */ console.log(",m=")";var k=Object.freeze({__proto__:null,BreakpointManager:d,get Events(){return c},get Breakpoint(){return l},ModelBreakpoint:p,EMPTY_BREAKPOINT_CONDITION:"",NEVER_PAUSE_HERE_CONDITION:"false",BreakpointLocation:g});export{k as BreakpointManager};
@@ -0,0 +1 @@
1
+ import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as i from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as a from"../../core/sdk/sdk.js";import*as n from"../../ui/legacy/legacy.js";const l={laptopWithTouch:"Laptop with touch",laptopWithHiDPIScreen:"Laptop with HiDPI screen",laptopWithMDPIScreen:"Laptop with MDPI screen"},r=i.i18n.registerUIStrings("models/emulation/EmulatedDevices.ts",l),h=i.i18n.getLazilyComputedLocalizedString.bind(void 0,r);function s(e){return e.replace(/@url\(([^\)]*?)\)/g,((e,t)=>new URL(`../../emulated_devices/${t}`,import.meta.url).toString()))}class d{title;type;order;vertical;horizontal;deviceScaleFactor;capabilities;userAgent;userAgentMetadata;modes;isDualScreen;verticalSpanned;horizontalSpanned;#e;#t;constructor(){this.title="",this.type=m.Unknown,this.vertical={width:0,height:0,outlineInsets:null,outlineImage:null,hinge:null},this.horizontal={width:0,height:0,outlineInsets:null,outlineImage:null,hinge:null},this.deviceScaleFactor=1,this.capabilities=[b.Touch,b.Mobile],this.userAgent="",this.userAgentMetadata=null,this.modes=[],this.isDualScreen=!1,this.verticalSpanned={width:0,height:0,outlineInsets:null,outlineImage:null,hinge:null},this.horizontalSpanned={width:0,height:0,outlineInsets:null,outlineImage:null,hinge:null},this.#e=f.Default,this.#t=!0}static fromJSONV1(e){try{function t(e,t,i,o){if("object"!=typeof e||null===e||!e.hasOwnProperty(t)){if(void 0!==o)return o;throw new Error("Emulated device is missing required property '"+t+"'")}const a=e[t];if(typeof a!==i||null===a)throw new Error("Emulated device property '"+t+"' has wrong type '"+typeof a+"'");return a}function i(e,i){const o=t(e,i,"number");if(o!==Math.abs(o))throw new Error("Emulated device value '"+i+"' must be integer");return o}function o(e){return new k(i(e,"left"),i(e,"top"),i(e,"right"),i(e,"bottom"))}function n(e){const o={};if(o.r=i(e,"r"),o.r<0||o.r>255)throw new Error("color has wrong r value: "+o.r);if(o.g=i(e,"g"),o.g<0||o.g>255)throw new Error("color has wrong g value: "+o.g);if(o.b=i(e,"b"),o.b<0||o.b>255)throw new Error("color has wrong b value: "+o.b);if(o.a=t(e,"a","number"),o.a<0||o.a>1)throw new Error("color has wrong a value: "+o.a);return o}function l(e){const t={};if(t.width=i(e,"width"),t.width<0||t.width>N)throw new Error("Emulated device has wrong hinge width: "+t.width);if(t.height=i(e,"height"),t.height<0||t.height>N)throw new Error("Emulated device has wrong hinge height: "+t.height);if(t.x=i(e,"x"),t.x<0||t.x>N)throw new Error("Emulated device has wrong x offset: "+t.height);if(t.y=i(e,"y"),t.x<0||t.x>N)throw new Error("Emulated device has wrong y offset: "+t.height);return e.contentColor&&(t.contentColor=n(e.contentColor)),e.outlineColor&&(t.outlineColor=n(e.outlineColor)),t}function r(e){const a={};if(a.width=i(e,"width"),a.width<0||a.width>N||a.width<E)throw new Error("Emulated device has wrong width: "+a.width);if(a.height=i(e,"height"),a.height<0||a.height>N||a.height<E)throw new Error("Emulated device has wrong height: "+a.height);const n=t(e.outline,"insets","object",null);if(n){if(a.outlineInsets=o(n),a.outlineInsets.left<0||a.outlineInsets.top<0)throw new Error("Emulated device has wrong outline insets");a.outlineImage=t(e.outline,"image","string")}return e.hinge&&(a.hinge=l(t(e,"hinge","object",void 0))),a}const h=new d;h.title=t(e,"title","string"),h.type=t(e,"type","string"),h.order=t(e,"order","number",0);const s=t(e,"user-agent","string");h.userAgent=a.NetworkManager.MultitargetNetworkManager.patchUserAgentWithChromeVersion(s),h.userAgentMetadata=t(e,"user-agent-metadata","object",null);const m=t(e,"capabilities","object",[]);if(!Array.isArray(m))throw new Error("Emulated device capabilities must be an array");h.capabilities=[];for(let e=0;e<m.length;++e){if("string"!=typeof m[e])throw new Error("Emulated device capability must be a string");h.capabilities.push(m[e])}if(h.deviceScaleFactor=t(e.screen,"device-pixel-ratio","number"),h.deviceScaleFactor<0||h.deviceScaleFactor>100)throw new Error("Emulated device has wrong deviceScaleFactor: "+h.deviceScaleFactor);if(h.vertical=r(t(e.screen,"vertical","object")),h.horizontal=r(t(e.screen,"horizontal","object")),h.isDualScreen=t(e,"dual-screen","boolean",!1),h.isDualScreen&&(h.verticalSpanned=r(t(e.screen,"vertical-spanned","object",null)),h.horizontalSpanned=r(t(e.screen,"horizontal-spanned","object",null))),h.isDualScreen&&(!h.verticalSpanned||!h.horizontalSpanned))throw new Error("Emulated device '"+h.title+"'has dual screen without spanned orientations");const b=t(e,"modes","object",[{title:"default",orientation:"vertical"},{title:"default",orientation:"horizontal"}]);if(!Array.isArray(b))throw new Error("Emulated device modes must be an array");h.modes=[];for(let e=0;e<b.length;++e){const i={};if(i.title=t(b[e],"title","string"),i.orientation=t(b[e],"orientation","string"),i.orientation!==u&&i.orientation!==c&&i.orientation!==p&&i.orientation!==g)throw new Error("Emulated device mode has wrong orientation '"+i.orientation+"'");const a=h.orientationByName(i.orientation);if(i.insets=o(t(b[e],"insets","object",{left:0,top:0,right:0,bottom:0})),i.insets.top<0||i.insets.left<0||i.insets.right<0||i.insets.bottom<0||i.insets.top+i.insets.bottom>a.height||i.insets.left+i.insets.right>a.width)throw new Error("Emulated device mode '"+i.title+"'has wrong mode insets");i.image=t(b[e],"image","string",null),h.modes.push(i)}return h.#t=t(e,"show-by-default","boolean",void 0),h.#e=t(e,"show","string",f.Default),h}catch(e){return null}}static deviceComparator(e,t){const i=e.order||0,o=t.order||0;return i>o?1:o>i||e.title<t.title?-1:e.title>t.title?1:0}modesForOrientation(e){const t=[];for(let i=0;i<this.modes.length;i++)this.modes[i].orientation===e&&t.push(this.modes[i]);return t}getSpanPartner(e){switch(e.orientation){case u:return this.modesForOrientation(p)[0];case c:return this.modesForOrientation(g)[0];case p:return this.modesForOrientation(u)[0];default:return this.modesForOrientation(c)[0]}}getRotationPartner(e){switch(e.orientation){case g:return this.modesForOrientation(p)[0];case p:return this.modesForOrientation(g)[0];case c:return this.modesForOrientation(u)[0];default:return this.modesForOrientation(c)[0]}}toJSON(){const e={};e.title=this.title,e.type=this.type,e["user-agent"]=this.userAgent,e.capabilities=this.capabilities,e.screen={"device-pixel-ratio":this.deviceScaleFactor,vertical:this.orientationToJSON(this.vertical),horizontal:this.orientationToJSON(this.horizontal),"vertical-spanned":void 0,"horizontal-spanned":void 0},this.isDualScreen&&(e.screen["vertical-spanned"]=this.orientationToJSON(this.verticalSpanned),e.screen["horizontal-spanned"]=this.orientationToJSON(this.horizontalSpanned)),e.modes=[];for(let t=0;t<this.modes.length;++t){const i={title:this.modes[t].title,orientation:this.modes[t].orientation,insets:{left:this.modes[t].insets.left,top:this.modes[t].insets.top,right:this.modes[t].insets.right,bottom:this.modes[t].insets.bottom},image:this.modes[t].image||void 0};e.modes.push(i)}return e["show-by-default"]=this.#t,e["dual-screen"]=this.isDualScreen,e.show=this.#e,this.userAgentMetadata&&(e["user-agent-metadata"]=this.userAgentMetadata),e}orientationToJSON(e){const t={};return t.width=e.width,t.height=e.height,e.outlineInsets&&(t.outline={insets:{left:e.outlineInsets.left,top:e.outlineInsets.top,right:e.outlineInsets.right,bottom:e.outlineInsets.bottom},image:e.outlineImage}),e.hinge&&(t.hinge={width:e.hinge.width,height:e.hinge.height,x:e.hinge.x,y:e.hinge.y,contentColor:void 0,outlineColor:void 0},e.hinge.contentColor&&(t.hinge.contentColor={r:e.hinge.contentColor.r,g:e.hinge.contentColor.g,b:e.hinge.contentColor.b,a:e.hinge.contentColor.a}),e.hinge.outlineColor&&(t.hinge.outlineColor={r:e.hinge.outlineColor.r,g:e.hinge.outlineColor.g,b:e.hinge.outlineColor.b,a:e.hinge.outlineColor.a})),t}modeImage(e){return e.image?s(e.image):""}outlineImage(e){const t=this.orientationByName(e.orientation);return t.outlineImage?s(t.outlineImage):""}orientationByName(e){switch(e){case p:return this.verticalSpanned;case g:return this.horizontalSpanned;case u:return this.vertical;default:return this.horizontal}}show(){return this.#e===f.Default?this.#t:this.#e===f.Always}setShow(e){this.#e=e?f.Always:f.Never}copyShowFrom(e){this.#e=e.#e}touch(){return-1!==this.capabilities.indexOf(b.Touch)}mobile(){return-1!==this.capabilities.indexOf(b.Mobile)}}const c="horizontal",u="vertical",g="horizontal-spanned",p="vertical-spanned",m={Phone:"phone",Tablet:"tablet",Notebook:"notebook",Desktop:"desktop",Unknown:"unknown"},b={Touch:"touch",Mobile:"mobile"},f={Always:"Always",Default:"Default",Never:"Never"};let v;class S extends e.ObjectWrapper.ObjectWrapper{#i;#o;#a;#n;constructor(){super(),this.#i=e.Settings.Settings.instance().createSetting("standardEmulatedDeviceList",[]),this.#o=new Set,this.listFromJSONV1(this.#i.get(),this.#o),this.updateStandardDevices(),this.#a=e.Settings.Settings.instance().createSetting("customEmulatedDeviceList",[]),this.#n=new Set,this.listFromJSONV1(this.#a.get(),this.#n)||this.saveCustomDevices()}static instance(){return v||(v=new S),v}updateStandardDevices(){const e=new Set;for(const t of w){const i=d.fromJSONV1(t);i&&e.add(i)}this.copyShowValues(this.#o,e),this.#o=e,this.saveStandardDevices()}listFromJSONV1(e,t){if(!Array.isArray(e))return!1;let i=!0;for(let o=0;o<e.length;++o){const a=d.fromJSONV1(e[o]);a?(t.add(a),a.modes.length||(a.modes.push({title:"",orientation:c,insets:new k(0,0,0,0),image:null}),a.modes.push({title:"",orientation:u,insets:new k(0,0,0,0),image:null}))):i=!1}return i}standard(){return[...this.#o]}custom(){return[...this.#n]}revealCustomSetting(){e.Revealer.reveal(this.#a)}addCustomDevice(e){this.#n.add(e),this.saveCustomDevices()}removeCustomDevice(e){this.#n.delete(e),this.saveCustomDevices()}saveCustomDevices(){const e=[];this.#n.forEach((t=>e.push(t.toJSON()))),this.#a.set(e),this.dispatchEventToListeners("CustomDevicesUpdated")}saveStandardDevices(){const e=[];this.#o.forEach((t=>e.push(t.toJSON()))),this.#i.set(e),this.dispatchEventToListeners("StandardDevicesUpdated")}copyShowValues(e,t){const i=new Map;for(const t of e)i.set(t.title,t);for(const e of t){const t=i.get(e.title);t&&e.copyShowFrom(t)}}}const w=[{order:10,"show-by-default":!0,title:"iPhone SE",screen:{horizontal:{width:667,height:375},"device-pixel-ratio":2,vertical:{width:375,height:667}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",type:"phone"},{order:12,"show-by-default":!0,title:"iPhone XR",screen:{horizontal:{width:896,height:414},"device-pixel-ratio":2,vertical:{width:414,height:896}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",type:"phone"},{order:14,"show-by-default":!0,title:"iPhone 12 Pro",screen:{horizontal:{width:844,height:390},"device-pixel-ratio":3,vertical:{width:390,height:844}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",type:"phone"},{order:16,"show-by-default":!1,title:"Pixel 3 XL",screen:{horizontal:{width:786,height:393},"device-pixel-ratio":2.75,vertical:{width:393,height:786}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 11; Pixel 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.181 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"11",architecture:"",model:"Pixel 3",mobile:!0},type:"phone"},{order:18,"show-by-default":!0,title:"Pixel 5",screen:{horizontal:{width:851,height:393},"device-pixel-ratio":2.75,vertical:{width:393,height:851}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"11",architecture:"",model:"Pixel 5",mobile:!0},type:"phone"},{order:20,"show-by-default":!0,title:"Samsung Galaxy S8+",screen:{horizontal:{width:740,height:360},"device-pixel-ratio":4,vertical:{width:360,height:740}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.0.0",architecture:"",model:"SM-G955U",mobile:!0},type:"phone"},{order:24,"show-by-default":!0,title:"Samsung Galaxy S20 Ultra",screen:{horizontal:{width:915,height:412},"device-pixel-ratio":3.5,vertical:{width:412,height:915}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 10; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"10",architecture:"",model:"SM-G981B",mobile:!0},type:"phone"},{order:26,"show-by-default":!0,title:"iPad Air",screen:{horizontal:{width:1180,height:820},"device-pixel-ratio":2,vertical:{width:820,height:1180}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1",type:"tablet"},{order:28,"show-by-default":!0,title:"iPad Mini",screen:{horizontal:{width:1024,height:768},"device-pixel-ratio":2,vertical:{width:768,height:1024}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1",type:"tablet"},{order:30,"show-by-default":!0,title:"Surface Pro 7",screen:{horizontal:{width:1368,height:912},"device-pixel-ratio":2,vertical:{width:912,height:1368}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36",type:"tablet"},{order:32,"show-by-default":!0,"dual-screen":!0,title:"Surface Duo",screen:{horizontal:{width:720,height:540},"device-pixel-ratio":2.5,vertical:{width:540,height:720},"vertical-spanned":{width:1114,height:720,hinge:{width:34,height:720,x:540,y:0,contentColor:{r:38,g:38,b:38,a:1}}},"horizontal-spanned":{width:720,height:1114,hinge:{width:720,height:34,x:0,y:540,contentColor:{r:38,g:38,b:38,a:1}}}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 11.0; Surface Duo) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"11.0",architecture:"",model:"Surface Duo",mobile:!0},type:"phone",modes:[{title:"default",orientation:"vertical",insets:{left:0,top:0,right:0,bottom:0}},{title:"default",orientation:"horizontal",insets:{left:0,top:0,right:0,bottom:0}},{title:"spanned",orientation:"vertical-spanned",insets:{left:0,top:0,right:0,bottom:0}},{title:"spanned",orientation:"horizontal-spanned",insets:{left:0,top:0,right:0,bottom:0}}]},{order:34,"show-by-default":!0,"dual-screen":!0,title:"Galaxy Fold",screen:{horizontal:{width:653,height:280},"device-pixel-ratio":3,vertical:{width:280,height:653},"vertical-spanned":{width:717,height:512},"horizontal-spanned":{width:512,height:717}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 9.0; SAMSUNG SM-F900U Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"9.0",architecture:"",model:"SM-F900U",mobile:!0},type:"phone",modes:[{title:"default",orientation:"vertical",insets:{left:0,top:0,right:0,bottom:0}},{title:"default",orientation:"horizontal",insets:{left:0,top:0,right:0,bottom:0}},{title:"spanned",orientation:"vertical-spanned",insets:{left:0,top:0,right:0,bottom:0}},{title:"spanned",orientation:"horizontal-spanned",insets:{left:0,top:0,right:0,bottom:0}}]},{order:36,"show-by-default":!0,title:"Samsung Galaxy A51/71",screen:{horizontal:{width:914,height:412},"device-pixel-ratio":2.625,vertical:{width:412,height:914}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.0.0",architecture:"",model:"SM-G955U",mobile:!0},type:"phone"},{order:52,"show-by-default":!0,title:"Nest Hub Max",screen:{horizontal:{outline:{image:"@url(optimized/google-nest-hub-max-horizontal.avif)",insets:{left:92,top:96,right:91,bottom:248}},width:1280,height:800},"device-pixel-ratio":2,vertical:{width:1280,height:800}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.188 Safari/537.36 CrKey/1.54.250320",type:"tablet",modes:[{title:"default",orientation:"horizontal"}]},{order:50,"show-by-default":!0,title:"Nest Hub",screen:{horizontal:{outline:{image:"@url(optimized/google-nest-hub-horizontal.avif)",insets:{left:82,top:74,right:83,bottom:222}},width:1024,height:600},"device-pixel-ratio":2,vertical:{width:1024,height:600}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.109 Safari/537.36 CrKey/1.54.248666","user-agent-metadata":{platform:"Android",platformVersion:"",architecture:"",model:"",mobile:!1},type:"tablet",modes:[{title:"default",orientation:"horizontal"}]},{"show-by-default":!1,title:"iPhone 4",screen:{horizontal:{width:480,height:320},"device-pixel-ratio":2,vertical:{width:320,height:480}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53",type:"phone"},{order:130,"show-by-default":!1,title:"iPhone 5/SE",screen:{horizontal:{outline:{image:"@url(optimized/iPhone5-landscape.avif)",insets:{left:115,top:25,right:115,bottom:28}},width:568,height:320},"device-pixel-ratio":2,vertical:{outline:{image:"@url(optimized/iPhone5-portrait.avif)",insets:{left:29,top:105,right:25,bottom:111}},width:320,height:568}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1",type:"phone"},{order:131,"show-by-default":!1,title:"iPhone 6/7/8",screen:{horizontal:{outline:{image:"@url(optimized/iPhone6-landscape.avif)",insets:{left:106,top:28,right:106,bottom:28}},width:667,height:375},"device-pixel-ratio":2,vertical:{outline:{image:"@url(optimized/iPhone6-portrait.avif)",insets:{left:28,top:105,right:28,bottom:105}},width:375,height:667}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",type:"phone"},{order:132,"show-by-default":!1,title:"iPhone 6/7/8 Plus",screen:{horizontal:{outline:{image:"@url(optimized/iPhone6Plus-landscape.avif)",insets:{left:109,top:29,right:109,bottom:27}},width:736,height:414},"device-pixel-ratio":3,vertical:{outline:{image:"@url(optimized/iPhone6Plus-portrait.avif)",insets:{left:26,top:107,right:30,bottom:111}},width:414,height:736}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",type:"phone"},{order:133,"show-by-default":!1,title:"iPhone X",screen:{horizontal:{width:812,height:375},"device-pixel-ratio":3,vertical:{width:375,height:812}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",type:"phone"},{"show-by-default":!1,title:"BlackBerry Z30",screen:{horizontal:{width:640,height:360},"device-pixel-ratio":2,vertical:{width:360,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+",type:"phone"},{"show-by-default":!1,title:"Nexus 4",screen:{horizontal:{width:640,height:384},"device-pixel-ratio":2,vertical:{width:384,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"4.4.2",architecture:"",model:"Nexus 4",mobile:!0},type:"phone"},{title:"Nexus 5",type:"phone","user-agent":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"6.0",architecture:"",model:"Nexus 5",mobile:!0},capabilities:["touch","mobile"],"show-by-default":!1,screen:{"device-pixel-ratio":3,vertical:{width:360,height:640},horizontal:{width:640,height:360}},modes:[{title:"default",orientation:"vertical",insets:{left:0,top:25,right:0,bottom:48},image:"@url(optimized/google-nexus-5-vertical-default-1x.avif) 1x, @url(optimized/google-nexus-5-vertical-default-2x.avif) 2x"},{title:"navigation bar",orientation:"vertical",insets:{left:0,top:80,right:0,bottom:48},image:"@url(optimized/google-nexus-5-vertical-navigation-1x.avif) 1x, @url(optimized/google-nexus-5-vertical-navigation-2x.avif) 2x"},{title:"keyboard",orientation:"vertical",insets:{left:0,top:80,right:0,bottom:312},image:"@url(optimized/google-nexus-5-vertical-keyboard-1x.avif) 1x, @url(optimized/google-nexus-5-vertical-keyboard-2x.avif) 2x"},{title:"default",orientation:"horizontal",insets:{left:0,top:25,right:42,bottom:0},image:"@url(optimized/google-nexus-5-horizontal-default-1x.avif) 1x, @url(optimized/google-nexus-5-horizontal-default-2x.avif) 2x"},{title:"navigation bar",orientation:"horizontal",insets:{left:0,top:80,right:42,bottom:0},image:"@url(optimized/google-nexus-5-horizontal-navigation-1x.avif) 1x, @url(optimized/google-nexus-5-horizontal-navigation-2x.avif) 2x"},{title:"keyboard",orientation:"horizontal",insets:{left:0,top:80,right:42,bottom:202},image:"@url(optimized/google-nexus-5-horizontal-keyboard-1x.avif) 1x, @url(optimized/google-nexus-5-horizontal-keyboard-2x.avif) 2x"}]},{title:"Nexus 5X",type:"phone","user-agent":"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.0.0",architecture:"",model:"Nexus 5X",mobile:!0},capabilities:["touch","mobile"],"show-by-default":!1,screen:{"device-pixel-ratio":2.625,vertical:{outline:{image:"@url(optimized/Nexus5X-portrait.avif)",insets:{left:18,top:88,right:22,bottom:98}},width:412,height:732},horizontal:{outline:{image:"@url(optimized/Nexus5X-landscape.avif)",insets:{left:88,top:21,right:98,bottom:19}},width:732,height:412}},modes:[{title:"default",orientation:"vertical",insets:{left:0,top:24,right:0,bottom:48},image:"@url(optimized/google-nexus-5x-vertical-default-1x.avif) 1x, @url(optimized/google-nexus-5x-vertical-default-2x.avif) 2x"},{title:"navigation bar",orientation:"vertical",insets:{left:0,top:80,right:0,bottom:48},image:"@url(optimized/google-nexus-5x-vertical-navigation-1x.avif) 1x, @url(optimized/google-nexus-5x-vertical-navigation-2x.avif) 2x"},{title:"keyboard",orientation:"vertical",insets:{left:0,top:80,right:0,bottom:342},image:"@url(optimized/google-nexus-5x-vertical-keyboard-1x.avif) 1x, @url(optimized/google-nexus-5x-vertical-keyboard-2x.avif) 2x"},{title:"default",orientation:"horizontal",insets:{left:0,top:24,right:48,bottom:0},image:"@url(optimized/google-nexus-5x-horizontal-default-1x.avif) 1x, @url(optimized/google-nexus-5x-horizontal-default-2x.avif) 2x"},{title:"navigation bar",orientation:"horizontal",insets:{left:0,top:80,right:48,bottom:0},image:"@url(optimized/google-nexus-5x-horizontal-navigation-1x.avif) 1x, @url(optimized/google-nexus-5x-horizontal-navigation-2x.avif) 2x"},{title:"keyboard",orientation:"horizontal",insets:{left:0,top:80,right:48,bottom:222},image:"@url(optimized/google-nexus-5x-horizontal-keyboard-1x.avif) 1x, @url(optimized/google-nexus-5x-horizontal-keyboard-2x.avif) 2x"}]},{"show-by-default":!1,title:"Nexus 6",screen:{horizontal:{width:732,height:412},"device-pixel-ratio":3.5,vertical:{width:412,height:732}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"7.1.1",architecture:"",model:"Nexus 6",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Nexus 6P",screen:{horizontal:{outline:{image:"@url(optimized/Nexus6P-landscape.avif)",insets:{left:94,top:17,right:88,bottom:17}},width:732,height:412},"device-pixel-ratio":3.5,vertical:{outline:{image:"@url(optimized/Nexus6P-portrait.avif)",insets:{left:16,top:94,right:16,bottom:88}},width:412,height:732}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.0.0",architecture:"",model:"Nexus 6P",mobile:!0},type:"phone"},{order:120,"show-by-default":!1,title:"Pixel 2",screen:{horizontal:{width:731,height:411},"device-pixel-ratio":2.625,vertical:{width:411,height:731}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.0",architecture:"",model:"Pixel 2",mobile:!0},type:"phone"},{order:121,"show-by-default":!1,title:"Pixel 2 XL",screen:{horizontal:{width:823,height:411},"device-pixel-ratio":3.5,vertical:{width:411,height:823}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.0.0",architecture:"",model:"Pixel 2 XL",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Pixel 3",screen:{horizontal:{width:786,height:393},"device-pixel-ratio":2.75,vertical:{width:393,height:786}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.158 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"9",architecture:"",model:"Pixel 3",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Pixel 4",screen:{horizontal:{width:745,height:353},"device-pixel-ratio":3,vertical:{width:353,height:745}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"10",architecture:"",model:"Pixel 4",mobile:!0},type:"phone"},{"show-by-default":!1,title:"LG Optimus L70",screen:{horizontal:{width:640,height:384},"device-pixel-ratio":1.25,vertical:{width:384,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"4.4.2",architecture:"",model:"LGMS323",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Nokia N9",screen:{horizontal:{width:854,height:480},"device-pixel-ratio":1,vertical:{width:480,height:854}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",type:"phone"},{"show-by-default":!1,title:"Nokia Lumia 520",screen:{horizontal:{width:533,height:320},"device-pixel-ratio":1.5,vertical:{width:320,height:533}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",type:"phone"},{"show-by-default":!1,title:"Microsoft Lumia 550",screen:{horizontal:{width:640,height:360},"device-pixel-ratio":2,vertical:{width:640,height:360}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263","user-agent-metadata":{platform:"Android",platformVersion:"4.2.1",architecture:"",model:"Lumia 550",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Microsoft Lumia 950",screen:{horizontal:{width:640,height:360},"device-pixel-ratio":4,vertical:{width:360,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/14.14263","user-agent-metadata":{platform:"Android",platformVersion:"4.2.1",architecture:"",model:"Lumia 950",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Galaxy S III",screen:{horizontal:{width:640,height:360},"device-pixel-ratio":2,vertical:{width:360,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","user-agent-metadata":{platform:"Android",platformVersion:"4.0",architecture:"",model:"GT-I9300",mobile:!0},type:"phone"},{order:110,"show-by-default":!1,title:"Galaxy S5",screen:{horizontal:{width:640,height:360},"device-pixel-ratio":3,vertical:{width:360,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"5.0",architecture:"",model:"SM-G900P",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Galaxy S8",screen:{horizontal:{width:740,height:360},"device-pixel-ratio":3,vertical:{width:360,height:740}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"7.0",architecture:"",model:"SM-G950U",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Galaxy S9+",screen:{horizontal:{width:658,height:320},"device-pixel-ratio":4.5,vertical:{width:320,height:658}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.0.0",architecture:"",model:"SM-G965U",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Galaxy Tab S4",screen:{horizontal:{width:1138,height:712},"device-pixel-ratio":2.25,vertical:{width:712,height:1138}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"8.1.0",architecture:"",model:"SM-T837A",mobile:!1},type:"phone"},{order:1,"show-by-default":!1,title:"JioPhone 2",screen:{horizontal:{width:320,height:240},"device-pixel-ratio":1,vertical:{width:240,height:320}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5","user-agent-metadata":{platform:"Android",platformVersion:"",architecture:"",model:"LYF/F300B/LYF-F300B-001-01-15-130718-i",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Kindle Fire HDX",screen:{horizontal:{width:1280,height:800},"device-pixel-ratio":2,vertical:{width:800,height:1280}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",type:"tablet"},{order:140,"show-by-default":!1,title:"iPad",screen:{horizontal:{outline:{image:"@url(optimized/iPad-landscape.avif)",insets:{left:112,top:56,right:116,bottom:52}},width:1024,height:768},"device-pixel-ratio":2,vertical:{outline:{image:"@url(optimized/iPad-portrait.avif)",insets:{left:52,top:114,right:55,bottom:114}},width:768,height:1024}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1",type:"tablet"},{order:141,"show-by-default":!1,title:"iPad Pro",screen:{horizontal:{width:1366,height:1024},"device-pixel-ratio":2,vertical:{width:1024,height:1366}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1",type:"tablet"},{"show-by-default":!1,title:"Blackberry PlayBook",screen:{horizontal:{width:1024,height:600},"device-pixel-ratio":1,vertical:{width:600,height:1024}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+",type:"tablet"},{"show-by-default":!1,title:"Nexus 10",screen:{horizontal:{width:1280,height:800},"device-pixel-ratio":2,vertical:{width:800,height:1280}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"6.0.1",architecture:"",model:"Nexus 10",mobile:!1},type:"tablet"},{"show-by-default":!1,title:"Nexus 7",screen:{horizontal:{width:960,height:600},"device-pixel-ratio":2,vertical:{width:600,height:960}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"6.0.1",architecture:"",model:"Nexus 7",mobile:!1},type:"tablet"},{"show-by-default":!1,title:"Galaxy Note 3",screen:{horizontal:{width:640,height:360},"device-pixel-ratio":3,vertical:{width:360,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","user-agent-metadata":{platform:"Android",platformVersion:"4.3",architecture:"",model:"SM-N900T",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Galaxy Note II",screen:{horizontal:{width:640,height:360},"device-pixel-ratio":2,vertical:{width:360,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","user-agent-metadata":{platform:"Android",platformVersion:"4.1",architecture:"",model:"GT-N7100",mobile:!0},type:"phone"},{"show-by-default":!1,title:h(l.laptopWithTouch),screen:{horizontal:{width:1280,height:950},"device-pixel-ratio":1,vertical:{width:950,height:1280}},capabilities:["touch"],"user-agent":"",type:"notebook",modes:[{title:"default",orientation:"horizontal"}]},{"show-by-default":!1,title:h(l.laptopWithHiDPIScreen),screen:{horizontal:{width:1440,height:900},"device-pixel-ratio":2,vertical:{width:900,height:1440}},capabilities:[],"user-agent":"",type:"notebook",modes:[{title:"default",orientation:"horizontal"}]},{"show-by-default":!1,title:h(l.laptopWithMDPIScreen),screen:{horizontal:{width:1280,height:800},"device-pixel-ratio":1,vertical:{width:800,height:1280}},capabilities:[],"user-agent":"",type:"notebook",modes:[{title:"default",orientation:"horizontal"}]},{"show-by-default":!1,title:"Moto G4",screen:{horizontal:{outline:{image:"@url(optimized/MotoG4-landscape.avif)",insets:{left:91,top:30,right:74,bottom:30}},width:640,height:360},"device-pixel-ratio":3,vertical:{outline:{image:"@url(optimized/MotoG4-portrait.avif)",insets:{left:30,top:91,right:30,bottom:74}},width:360,height:640}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 6.0.1; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"6.0.1",architecture:"",model:"Moto G (4)",mobile:!0},type:"phone"},{"show-by-default":!1,title:"Moto G Power",screen:{"device-pixel-ratio":1.75,horizontal:{width:823,height:412},vertical:{width:412,height:823}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36","user-agent-metadata":{platform:"Android",platformVersion:"11",architecture:"",model:"moto g power (2022)",mobile:!0},type:"phone"},{order:200,"show-by-default":!0,title:"Facebook for Android v407 on Pixel 6",screen:{horizontal:{width:892,height:412},"device-pixel-ratio":3.5,vertical:{width:412,height:892}},capabilities:["touch","mobile"],"user-agent":"Mozilla/5.0 (Linux; Android 12; Pixel 6 Build/SQ3A.220705.004; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/%s Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/407.0.0.0.65;]","user-agent-metadata":{platform:"Android",platformVersion:"12",architecture:"",model:"Pixel 6",mobile:!0},type:"phone"}];var M=Object.freeze({__proto__:null,computeRelativeImageURL:s,EmulatedDevice:d,Horizontal:c,Vertical:u,HorizontalSpanned:g,VerticalSpanned:p,Type:m,Capability:b,_Show:f,EmulatedDevicesList:S});const x={widthMustBeANumber:"Width must be a number.",widthMustBeLessThanOrEqualToS:"Width must be less than or equal to {PH1}.",widthMustBeGreaterThanOrEqualToS:"Width must be greater than or equal to {PH1}.",heightMustBeANumber:"Height must be a number.",heightMustBeLessThanOrEqualToS:"Height must be less than or equal to {PH1}.",heightMustBeGreaterThanOrEqualTo:"Height must be greater than or equal to {PH1}.",devicePixelRatioMustBeANumberOr:"Device pixel ratio must be a number or blank.",devicePixelRatioMustBeLessThanOr:"Device pixel ratio must be less than or equal to {PH1}.",devicePixelRatioMustBeGreater:"Device pixel ratio must be greater than or equal to {PH1}."},y=i.i18n.registerUIStrings("models/emulation/DeviceModeModel.ts",x),z=i.i18n.getLocalizedString.bind(void 0,y);let I;class A extends e.ObjectWrapper.ObjectWrapper{#l;#r;#h;#s;#d;#c;#u;#g;#p;#m;#b;#f;#v;#S;#w;#M;#x;#y;#z;#I;#A;#k;#P;#T;#L;#E;#N;constructor(){super(),this.#l=new P(0,0,1,1),this.#r=new P(0,0,1,1),this.#h=new n.Geometry.Size(1,1),this.#s=new n.Geometry.Size(1,1),this.#d=!1,this.#c=new n.Geometry.Size(1,1),this.#u=window.devicePixelRatio,this.#g=L.Desktop,this.#p=o.Runtime.experiments.isEnabled("dualScreenSupport"),this.#m=!!window.visualViewport&&"segments"in window.visualViewport,this.#b=e.Settings.Settings.instance().createSetting("emulation.deviceScale",1),this.#b.get()||this.#b.set(1),this.#b.addChangeListener(this.scaleSettingChanged,this),this.#f=1,this.#v=e.Settings.Settings.instance().createSetting("emulation.deviceWidth",400),this.#v.get()<E&&this.#v.set(E),this.#v.get()>N&&this.#v.set(N),this.#v.addChangeListener(this.widthSettingChanged,this),this.#S=e.Settings.Settings.instance().createSetting("emulation.deviceHeight",0),this.#S.get()&&this.#S.get()<E&&this.#S.set(E),this.#S.get()>N&&this.#S.set(N),this.#S.addChangeListener(this.heightSettingChanged,this),this.#w=e.Settings.Settings.instance().createSetting("emulation.deviceUA",L.Mobile),this.#w.addChangeListener(this.uaSettingChanged,this),this.#M=e.Settings.Settings.instance().createSetting("emulation.deviceScaleFactor",0),this.#M.addChangeListener(this.deviceScaleFactorSettingChanged,this),this.#x=e.Settings.Settings.instance().moduleSetting("emulation.showDeviceOutline"),this.#x.addChangeListener(this.deviceOutlineSettingChanged,this),this.#y=e.Settings.Settings.instance().createSetting("emulation.toolbarControlsEnabled",!0,e.Settings.SettingStorageType.Session),this.#z=T.None,this.#I=null,this.#A=null,this.#k=1,this.#P=!1,this.#T=!1,this.#L=null,this.#E=null,a.TargetManager.TargetManager.instance().observeModels(a.EmulationModel.EmulationModel,this)}static instance(e){return I&&!e?.forceNew||(I=new A),I}static widthValidator(e){let t,i=!1;return/^[\d]+$/.test(e)?Number(e)>N?t=z(x.widthMustBeLessThanOrEqualToS,{PH1:N}):Number(e)<E?t=z(x.widthMustBeGreaterThanOrEqualToS,{PH1:E}):i=!0:t=z(x.widthMustBeANumber),{valid:i,errorMessage:t}}static heightValidator(e){let t,i=!1;return/^[\d]+$/.test(e)?Number(e)>N?t=z(x.heightMustBeLessThanOrEqualToS,{PH1:N}):Number(e)<E?t=z(x.heightMustBeGreaterThanOrEqualTo,{PH1:E}):i=!0:t=z(x.heightMustBeANumber),{valid:i,errorMessage:t}}static scaleValidator(e){let t,i=!1;const o=Number(e.trim());return e?Number.isNaN(o)?t=z(x.devicePixelRatioMustBeANumberOr):Number(e)>D?t=z(x.devicePixelRatioMustBeLessThanOr,{PH1:D}):Number(e)<C?t=z(x.devicePixelRatioMustBeGreater,{PH1:C}):i=!0:i=!0,{valid:i,errorMessage:t}}get scaleSettingInternal(){return this.#b}setAvailableSize(e,t){this.#h=e,this.#s=t,this.#d=!0,this.calculateAndEmulate(!1)}emulate(e,i,o,a){const n=this.#z!==e||this.#I!==i||this.#A!==o;if(this.#z=e,e===T.Device&&i&&o){if(console.assert(Boolean(i)&&Boolean(o),"Must pass device and mode for device emulation"),this.#A=o,this.#I=i,this.#d){const e=i.orientationByName(o.orientation);this.#b.set(a||this.calculateFitScale(e.width,e.height,this.currentOutline(),this.currentInsets()))}}else this.#I=null,this.#A=null;e!==T.None&&t.userMetrics.actionTaken(t.UserMetrics.Action.DeviceModeEnabled),this.calculateAndEmulate(n)}setWidth(e){const t=Math.min(N,this.preferredScaledWidth());e=Math.max(Math.min(e,t),1),this.#v.set(e)}setWidthAndScaleToFit(e){e=Math.max(Math.min(e,N),1),this.#b.set(this.calculateFitScale(e,this.#S.get())),this.#v.set(e)}setHeight(e){const t=Math.min(N,this.preferredScaledHeight());(e=Math.max(Math.min(e,t),0))===this.preferredScaledHeight()&&(e=0),this.#S.set(e)}setHeightAndScaleToFit(e){e=Math.max(Math.min(e,N),0),this.#b.set(this.calculateFitScale(this.#v.get(),e)),this.#S.set(e)}setScale(e){this.#b.set(e)}device(){return this.#I}mode(){return this.#A}type(){return this.#z}screenImage(){return this.#I&&this.#A?this.#I.modeImage(this.#A):""}outlineImage(){return this.#I&&this.#A&&this.#x.get()?this.#I.outlineImage(this.#A):""}outlineRect(){return this.#N||null}screenRect(){return this.#l}visiblePageRect(){return this.#r}scale(){return this.#f}fitScale(){return this.#k}appliedDeviceSize(){return this.#c}appliedDeviceScaleFactor(){return this.#u}appliedUserAgentType(){return this.#g}isFullHeight(){return!this.#S.get()}isMobile(){switch(this.#z){case T.Device:return!!this.#I&&this.#I.mobile();case T.None:return!1;case T.Responsive:return this.#w.get()===L.Mobile||this.#w.get()===L.MobileNoTouch}return!1}enabledSetting(){return e.Settings.Settings.instance().createSetting("emulation.showDeviceMode",!1)}scaleSetting(){return this.#b}uaSetting(){return this.#w}deviceScaleFactorSetting(){return this.#M}deviceOutlineSetting(){return this.#x}toolbarControlsEnabledSetting(){return this.#y}reset(){this.#M.set(0),this.#b.set(1),this.setWidth(400),this.setHeight(0),this.#w.set(L.Mobile)}modelAdded(e){if(e.target()===a.TargetManager.TargetManager.instance().primaryPageTarget()&&e.supportsDeviceEmulation()){if(this.#L=e,this.#E){const e=this.#E;this.#E=null,e()}const t=e.target().model(a.ResourceTreeModel.ResourceTreeModel);t&&(t.addEventListener(a.ResourceTreeModel.Events.FrameResized,this.onFrameChange,this),t.addEventListener(a.ResourceTreeModel.Events.FrameNavigated,this.onFrameChange,this))}else e.emulateTouch(this.#P,this.#T)}modelRemoved(e){this.#L===e&&(this.#L=null)}inspectedURL(){return this.#L?this.#L.target().inspectedURL():null}onFrameChange(){const e=this.#L?this.#L.overlayModel():null;e&&this.showHingeIfApplicable(e)}scaleSettingChanged(){this.calculateAndEmulate(!1)}widthSettingChanged(){this.calculateAndEmulate(!1)}heightSettingChanged(){this.calculateAndEmulate(!1)}uaSettingChanged(){this.calculateAndEmulate(!0)}deviceScaleFactorSettingChanged(){this.calculateAndEmulate(!1)}deviceOutlineSettingChanged(){this.calculateAndEmulate(!1)}preferredScaledWidth(){return Math.floor(this.#s.width/(this.#b.get()||1))}preferredScaledHeight(){return Math.floor(this.#s.height/(this.#b.get()||1))}currentOutline(){let e=new k(0,0,0,0);if(this.#z!==T.Device||!this.#I||!this.#A)return e;const t=this.#I.orientationByName(this.#A.orientation);return this.#x.get()&&(e=t.outlineInsets||e),e}currentInsets(){return this.#z===T.Device&&this.#A?this.#A.insets:new k(0,0,0,0)}getScreenOrientationType(){if(!this.#A)throw new Error("Mode required to get orientation type.");switch(this.#A.orientation){case p:case u:return"portraitPrimary";default:return"landscapePrimary"}}calculateAndEmulate(e){this.#L||(this.#E=this.calculateAndEmulate.bind(this,e));const t=this.isMobile(),i=this.#L?this.#L.overlayModel():null;if(i&&this.showHingeIfApplicable(i),this.#z===T.Device&&this.#I&&this.#A){const i=this.#I.orientationByName(this.#A.orientation),o=this.currentOutline(),a=this.currentInsets();this.#k=this.calculateFitScale(i.width,i.height,o,a),this.#g=t?this.#I.touch()?L.Mobile:L.MobileNoTouch:this.#I.touch()?L.DesktopTouch:L.Desktop,this.applyDeviceMetrics(new n.Geometry.Size(i.width,i.height),a,o,this.#b.get(),this.#I.deviceScaleFactor,t,this.getScreenOrientationType(),e,this.#m),this.applyUserAgent(this.#I.userAgent,this.#I.userAgentMetadata),this.applyTouch(this.#I.touch(),t)}else if(this.#z===T.None)this.#k=this.calculateFitScale(this.#h.width,this.#h.height),this.#g=L.Desktop,this.applyDeviceMetrics(this.#h,new k(0,0,0,0),new k(0,0,0,0),1,0,t,null,e),this.applyUserAgent("",null),this.applyTouch(!1,!1);else if(this.#z===T.Responsive){let i=this.#v.get();(!i||i>this.preferredScaledWidth())&&(i=this.preferredScaledWidth());let o=this.#S.get();(!o||o>this.preferredScaledHeight())&&(o=this.preferredScaledHeight());const a=t?G:0;this.#k=this.calculateFitScale(this.#v.get(),this.#S.get()),this.#g=this.#w.get(),this.applyDeviceMetrics(new n.Geometry.Size(i,o),new k(0,0,0,0),new k(0,0,0,0),this.#b.get(),this.#M.get()||a,t,o>=i?"portraitPrimary":"landscapePrimary",e),this.applyUserAgent(t?K:"",t?O:null),this.applyTouch(this.#w.get()===L.DesktopTouch||this.#w.get()===L.Mobile,this.#w.get()===L.Mobile)}i&&i.setShowViewportSizeOnResize(this.#z===T.None),this.dispatchEventToListeners("Updated")}calculateFitScale(e,t,i,o){const a=i?i.left+i.right:0,n=i?i.top+i.bottom:0,l=o?o.left+o.right:0,r=o?o.top+o.bottom:0;let h=Math.min(e?this.#s.width/(e+a):1,t?this.#s.height/(t+n):1);h=Math.min(Math.floor(100*h),100);let s=h;for(;s>.7*h;){let i=!0;if(e&&(i=i&&Number.isInteger((e-l)*s/100)),t&&(i=i&&Number.isInteger((t-r)*s/100)),i)return s/100;s-=1}return h/100}setSizeAndScaleToFit(e,t){this.#b.set(this.calculateFitScale(e,t)),this.setWidth(e),this.setHeight(t)}applyUserAgent(e,t){a.NetworkManager.MultitargetNetworkManager.instance().setUserAgentOverride(e,t)}applyDeviceMetrics(e,t,i,o,a,n,l,r,h=!1){e.width=Math.max(1,Math.floor(e.width)),e.height=Math.max(1,Math.floor(e.height));let s=e.width-t.left-t.right,d=e.height-t.top-t.bottom;const c=t.left,u=t.top,g="landscapePrimary"===l?90:0;if(this.#c=e,this.#u=a||window.devicePixelRatio,this.#l=new P(Math.max(0,(this.#h.width-e.width*o)/2),i.top*o,e.width*o,e.height*o),this.#N=new P(this.#l.left-i.left*o,0,(i.left+e.width+i.right)*o,(i.top+e.height+i.bottom)*o),this.#r=new P(c*o,u*o,Math.min(s*o,this.#h.width-this.#l.left-c*o),Math.min(d*o,this.#h.height-this.#l.top-u*o)),this.#f=o,h||(1===o&&this.#h.width>=e.width&&this.#h.height>=e.height&&(s=0,d=0),this.#r.width===s*o&&this.#r.height===d*o&&Number.isInteger(s*o)&&Number.isInteger(d*o)&&(s=0,d=0)),this.#L)if(r&&this.#L.resetPageScaleFactor(),s||d||n||a||1!==o||l||h){const t={width:s,height:d,deviceScaleFactor:a,mobile:n,scale:o,screenWidth:e.width,screenHeight:e.height,positionX:c,positionY:u,dontSetVisibleSize:!0,displayFeature:void 0,screenOrientation:void 0},i=this.getDisplayFeature();i&&(t.displayFeature=i),l&&(t.screenOrientation={type:l,angle:g}),this.#L.emulateDevice(t)}else this.#L.emulateDevice(null)}exitHingeMode(){const e=this.#L?this.#L.overlayModel():null;e&&e.showHingeForDualScreen(null)}webPlatformExperimentalFeaturesEnabled(){return this.#m}shouldReportDisplayFeature(){return this.#m&&this.#p}async captureScreenshot(e,t){const i=this.#L?this.#L.target().model(a.ScreenCaptureModel.ScreenCaptureModel):null;if(!i)return null;let o;o=t?"fromClip":e?"fullpage":"fromViewport";const n=this.#L?this.#L.overlayModel():null;n&&n.setShowViewportSizeOnResize(!1);const l=await i.captureScreenshot("png",100,o,t),r={width:0,height:0,deviceScaleFactor:0,mobile:!1};if(e&&this.#L){if(this.#I&&this.#A){const e=this.#I.orientationByName(this.#A.orientation);r.width=e.width,r.height=e.height;const t=this.getDisplayFeature();t&&(r.displayFeature=t)}else r.width=0,r.height=0;await this.#L.emulateDevice(r)}return this.calculateAndEmulate(!1),l}applyTouch(e,t){this.#P=e,this.#T=t;for(const i of a.TargetManager.TargetManager.instance().models(a.EmulationModel.EmulationModel))i.emulateTouch(e,t)}showHingeIfApplicable(e){const t=this.#I&&this.#A?this.#I.orientationByName(this.#A.orientation):null;this.#p&&t&&t.hinge?e.showHingeForDualScreen(t.hinge):e.showHingeForDualScreen(null)}getDisplayFeatureOrientation(){if(!this.#A)throw new Error("Mode required to get display feature orientation.");switch(this.#A.orientation){case p:case u:return"vertical";default:return"horizontal"}}getDisplayFeature(){if(!this.shouldReportDisplayFeature())return null;if(!this.#I||!this.#A||this.#A.orientation!==p&&this.#A.orientation!==g)return null;const e=this.#I.orientationByName(this.#A.orientation);if(!e||!e.hinge)return null;const t=e.hinge;return{orientation:this.getDisplayFeatureOrientation(),offset:this.#A.orientation===p?t.x:t.y,maskLength:this.#A.orientation===p?t.width:t.height}}}class k{left;top;right;bottom;constructor(e,t,i,o){this.left=e,this.top=t,this.right=i,this.bottom=o}isEqual(e){return null!==e&&this.left===e.left&&this.top===e.top&&this.right===e.right&&this.bottom===e.bottom}}class P{left;top;width;height;constructor(e,t,i,o){this.left=e,this.top=t,this.width=i,this.height=o}isEqual(e){return null!==e&&this.left===e.left&&this.top===e.top&&this.width===e.width&&this.height===e.height}scale(e){return new P(this.left*e,this.top*e,this.width*e,this.height*e)}relativeTo(e){return new P(this.left-e.left,this.top-e.top,this.width,this.height)}rebaseTo(e){return new P(this.left+e.left,this.top+e.top,this.width,this.height)}}var T,L;!function(e){e.None="None",e.Responsive="Responsive",e.Device="Device"}(T||(T={})),function(e){e.Mobile="Mobile",e.MobileNoTouch="Mobile (no touch)",e.Desktop="Desktop",e.DesktopTouch="Desktop (touch)"}(L||(L={}));const E=50,N=9999,C=0,D=10,K=a.NetworkManager.MultitargetNetworkManager.patchUserAgentWithChromeVersion("Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36"),O={platform:"Android",platformVersion:"6.0",architecture:"",model:"Nexus 5",mobile:!0},G=2;var F=Object.freeze({__proto__:null,DeviceModeModel:A,Insets:k,Rect:P,get Type(){return T},get UA(){return L},MinDeviceSize:E,MaxDeviceSize:N,MinDeviceScaleFactor:C,MaxDeviceScaleFactor:D,MaxDeviceNameLength:50,defaultMobileScaleFactor:G});export{F as DeviceModeModel,M as EmulatedDevices};
@@ -0,0 +1 @@
1
+ import*as n from"./extensions.js";self.Extensions=self.Extensions||{},Extensions=Extensions||{},Extensions.ExtensionSidebarPane=n.ExtensionPanel.ExtensionSidebarPane,Extensions.ExtensionServer=n.ExtensionServer.ExtensionServer,Extensions.ExtensionServer.Events=n.ExtensionServer.Events,Extensions.ExtensionStatus=n.ExtensionServer.ExtensionStatus;
@@ -0,0 +1 @@
1
+ import*as e from"../../core/platform/platform.js";import*as t from"../../core/sdk/sdk.js";import*as n from"../../ui/legacy/legacy.js";import*as s from"../../core/common/common.js";import*as i from"../../core/host/host.js";import*as r from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as a from"../logs/logs.js";import*as c from"../../ui/legacy/components/utils/utils.js";import*as d from"../../ui/legacy/theme_support/theme_support.js";import*as u from"../bindings/bindings.js";import*as l from"../har/har.js";import*as h from"../workspace/workspace.js";self.injectedExtensionAPI=function(t,n,s,i,r,o,a){const c=new Set(i),d=window.chrome||{};if(Object.getOwnPropertyDescriptor(d,"devtools"))return;let u=!1,l=!1;function h(e,t){this._type=e,this._listeners=[],this._customDispatch=t}function p(){this.onRequestFinished=new S("network-request-finished",(function(e){const t=e.arguments[1];t.__proto__=new L(e.arguments[0]),this._fire(t)})),y(this,"network","onFinished","onRequestFinished"),this.onNavigated=new S("inspected-url-changed")}function m(e){this._id=e}function g(){const e={elements:new q,sources:new k};function t(t){return e[t]}for(const n in e)Object.defineProperty(this,n,{get:t.bind(null,n),enumerable:!0});this.applyStyleSheet=function(e){Y.sendRequest({command:"applyStyleSheet",styleSheet:e})}}function f(e){this._id=e,e&&(this.onShown=new S("view-shown-"+e,(function(e){const t=e.arguments[0];"number"==typeof t?this._fire(window.parent.frames[t]):this._fire()})),this.onHidden=new S("view-hidden,"+e))}function b(e){f.call(this,null),this._hostPanelName=e,this.onSelectionChanged=new S("panel-objectSelected-"+e)}function w(){this._plugins=new Map}function R(){this._plugins=new Map}function E(e){return function(...t){const n={__proto__:e.prototype};e.apply(n,t),function(e,t){for(const n in t){if("_"===n.charAt(0))continue;let s=null;for(let e=t;e&&!s;e=e.__proto__)s=Object.getOwnPropertyDescriptor(e,n);s&&("function"==typeof s.value?e[n]=s.value.bind(t):"function"==typeof s.get?e.__defineGetter__(n,s.get.bind(t)):Object.defineProperty(e,n,s))}}(this,n)}}function y(e,t,n,s){let i=!1;e.__defineGetter__(n,(function(){return i||(console.warn(t+"."+n+" is deprecated. Use "+t+"."+s+" instead"),i=!0),e[s]}))}function x(e){const t=e[e.length-1];return"function"==typeof t?t:void 0}h.prototype={addListener:function(e){if("function"!=typeof e)throw"addListener: callback is not a function";0===this._listeners.length&&Y.sendRequest({command:"subscribe",type:this._type}),this._listeners.push(e),Y.registerHandler("notify-"+this._type,this._dispatch.bind(this))},removeListener:function(e){const t=this._listeners;for(let n=0;n<t.length;++n)if(t[n]===e){t.splice(n,1);break}0===this._listeners.length&&Y.sendRequest({command:"unsubscribe",type:this._type})},_fire:function(...e){const t=this._listeners.slice();for(let e=0;e<t.length;++e)t[e].apply(null,Array.from(arguments))},_dispatch:function(e){this._customDispatch?this._customDispatch.call(this,e):this._fire.apply(this,e.arguments)}},p.prototype={getHAR:function(e){Y.sendRequest({command:"getHAR"},e&&function(t){const n=t,s=n&&n.entries||[];for(let e=0;e<s.length;++e)s[e].__proto__=new L(s[e]._requestId),delete s[e]._requestId;e&&e(n)})},addRequestHeaders:function(e){Y.sendRequest({command:"addRequestHeaders",headers:e,extensionId:window.location.hostname})}},m.prototype={getContent:function(e){Y.sendRequest({command:"getRequestContent",id:this._id},e&&function(t){const{content:n,encoding:s}=t;e&&e(n,s)})}},g.prototype={create:function(e,t,n,s){const i="extension-panel-"+Y.nextObjectId();Y.sendRequest({command:"createPanel",id:i,title:e,page:n},s&&(()=>s.call(this,new P(i))))},setOpenResourceHandler:function(e){const t=Y.hasHandler("open-resource");e?Y.registerHandler("open-resource",(function(t){u=!0;try{const{resource:n,lineNumber:s}=t;F(n)&&e.call(null,new C(n),s)}finally{u=!1}})):Y.unregisterHandler("open-resource"),t===!e&&Y.sendRequest({command:"setOpenResourceHandler",handlerPresent:Boolean(e)})},setThemeChangeHandler:function(e){const t=Y.hasHandler("host-theme-change");e?Y.registerHandler("host-theme-change",(function(t){const{themeName:n}=t;d.devtools.panels.themeName=n,e.call(null,n)})):Y.unregisterHandler("host-theme-change"),t===!e&&Y.sendRequest({command:"setThemeChangeHandler",handlerPresent:Boolean(e)})},openResource:function(e,t,n,s){const i=x(arguments),r="number"==typeof n?n:0;Y.sendRequest({command:"openResource",url:e,lineNumber:t,columnNumber:r},i)},get SearchAction(){return{CancelSearch:"cancelSearch",PerformSearch:"performSearch",NextSearchResult:"nextSearchResult",PreviousSearchResult:"previousSearchResult"}}},b.prototype={createSidebarPane:function(e,t){const n="extension-sidebar-"+Y.nextObjectId();Y.sendRequest({command:"createSidebarPane",panel:this._hostPanelName,id:n,title:e},t&&function(){t&&t(new O(n))})},__proto__:f.prototype},w.prototype={registerRecorderExtensionPlugin:async function(e,t,n){if(this._plugins.has(e))throw new Error(`Tried to register plugin '${t}' twice`);const s=new MessageChannel,i=s.port1;this._plugins.set(e,i),i.onmessage=({data:t})=>{const{requestId:n}=t;(async function(t){switch(t.method){case"stringify":return e.stringify(t.parameters.recording);case"stringifyStep":return e.stringifyStep(t.parameters.step);case"replay":try{return u=!0,l=!0,e.replay(t.parameters.recording)}finally{u=!1,l=!1}default:throw new Error(`'${t.method}' is not recognized`)}})(t).then((e=>i.postMessage({requestId:n,result:e}))).catch((e=>i.postMessage({requestId:n,error:{message:e.message}})))};const r=[];"stringify"in e&&"stringifyStep"in e&&r.push("export"),"replay"in e&&r.push("replay"),await new Promise((e=>{Y.sendRequest({command:"registerRecorderExtensionPlugin",pluginName:t,mediaType:n,capabilities:r,port:s.port2},(()=>e()),[s.port2])}))},unregisterRecorderExtensionPlugin:async function(e){const t=this._plugins.get(e);if(!t)throw new Error("Tried to unregister a plugin that was not previously registered");this._plugins.delete(e),t.postMessage({event:"unregisteredRecorderExtensionPlugin"}),t.close()},createView:async function(e,t){const n="recorder-extension-view-"+Y.nextObjectId();return await new Promise((s=>{Y.sendRequest({command:"createRecorderView",id:n,title:e,pagePath:t},s)})),new A(n)}},R.prototype={registerLanguageExtensionPlugin:async function(e,t,n){if(this._plugins.has(e))throw new Error(`Tried to register plugin '${t}' twice`);const s=new MessageChannel,i=s.port1;this._plugins.set(e,i),i.onmessage=({data:t})=>{const{requestId:n}=t;console.time(`${n}: ${t.method}`),function(t){switch(t.method){case"addRawModule":return e.addRawModule(t.parameters.rawModuleId,t.parameters.symbolsURL,t.parameters.rawModule);case"removeRawModule":return e.removeRawModule(t.parameters.rawModuleId);case"sourceLocationToRawLocation":return e.sourceLocationToRawLocation(t.parameters.sourceLocation);case"rawLocationToSourceLocation":return e.rawLocationToSourceLocation(t.parameters.rawLocation);case"getScopeInfo":return e.getScopeInfo(t.parameters.type);case"listVariablesInScope":return e.listVariablesInScope(t.parameters.rawLocation);case"getFunctionInfo":return e.getFunctionInfo(t.parameters.rawLocation);case"getInlinedFunctionRanges":return e.getInlinedFunctionRanges(t.parameters.rawLocation);case"getInlinedCalleesRanges":return e.getInlinedCalleesRanges(t.parameters.rawLocation);case"getMappedLines":return"getMappedLines"in e?e.getMappedLines(t.parameters.rawModuleId,t.parameters.sourceFileURL):Promise.resolve(void 0);case"formatValue":return"evaluate"in e&&e.evaluate?e.evaluate(t.parameters.expression,t.parameters.context,t.parameters.stopId):Promise.resolve(void 0);case"getProperties":if("getProperties"in e&&e.getProperties)return e.getProperties(t.parameters.objectId);if(!("evaluate"in e)||!e.evaluate)return Promise.resolve(void 0);break;case"releaseObject":if("releaseObject"in e&&e.releaseObject)return e.releaseObject(t.parameters.objectId)}throw new Error(`Unknown language plugin method ${t.method}`)}(t).then((e=>i.postMessage({requestId:n,result:e}))).catch((e=>i.postMessage({requestId:n,error:{message:e.message}}))).finally((()=>console.timeEnd(`${n}: ${t.method}`)))},await new Promise((e=>{Y.sendRequest({command:"registerLanguageExtensionPlugin",pluginName:t,port:s.port2,supportedScriptTypes:n},(()=>e()),[s.port2])}))},unregisterLanguageExtensionPlugin:async function(e){const t=this._plugins.get(e);if(!t)throw new Error("Tried to unregister a plugin that was not previously registered");this._plugins.delete(e),t.postMessage({event:"unregisteredLanguageExtensionPlugin"}),t.close()},getWasmLinearMemory:async function(e,t,n){const s=await new Promise((s=>Y.sendRequest({command:"getWasmLinearMemory",offset:e,length:t,stopId:n},s)));return Array.isArray(s)?new Uint8Array(s).buffer:new ArrayBuffer(0)},getWasmLocal:async function(e,t){return new Promise((n=>Y.sendRequest({command:"getWasmLocal",local:e,stopId:t},n)))},getWasmGlobal:async function(e,t){return new Promise((n=>Y.sendRequest({command:"getWasmGlobal",global:e,stopId:t},n)))},getWasmOp:async function(e,t){return new Promise((n=>Y.sendRequest({command:"getWasmOp",op:e,stopId:t},n)))}};const v=E(R),_=E(w),I=E(N),S=E(h),P=E(M),A=E(j),O=E(D),T=E(b),L=E(m),C=E(G),H=E(B);class q extends T{constructor(){super("elements")}}class k extends T{constructor(){super("sources")}}function M(e){f.call(this,e),this.onSearch=new S("panel-search-"+e)}function j(e){f.call(this,e)}function D(e){f.call(this,e)}function N(e){this._id=e,this.onClicked=new S("button-clicked-"+e)}function W(){}function B(e){this._id=e}function U(e){this.onRecordingStarted=new S("trace-recording-started-"+e,(function(e){const t=e.arguments[0];this._fire(new H(t))})),this.onRecordingStopped=new S("trace-recording-stopped-"+e)}function F(e){try{return t.allowFileAccess||"file:"!==new URL(e.url).protocol}catch(e){return!1}}function V(){this.onResourceAdded=new S("resource-added",(function(e){const t=e.arguments[0];F(t)&&this._fire(new C(t))})),this.onResourceContentCommitted=new S("resource-content-committed",(function(e){const t=e.arguments[0];F(t)&&this._fire(new C(t),e.arguments[1])}))}function G(e){if(!F)throw new Error("Resource access not allowed");this._url=e.url,this._type=e.type}M.prototype={createStatusBarButton:function(e,t,n){const s="button-"+Y.nextObjectId();return Y.sendRequest({command:"createToolbarButton",panel:this._id,id:s,icon:e,tooltip:t,disabled:Boolean(n)}),new I(s)},show:function(){u&&Y.sendRequest({command:"showPanel",id:this._id})},__proto__:f.prototype},j.prototype={show:function(){u&&l&&Y.sendRequest({command:"showRecorderView",id:this._id})},__proto__:f.prototype},D.prototype={setHeight:function(e){Y.sendRequest({command:"setSidebarHeight",id:this._id,height:e})},setExpression:function(e,t,n,s){Y.sendRequest({command:"setSidebarContent",id:this._id,expression:e,rootTitle:t,evaluateOnPage:!0,evaluateOptions:"object"==typeof n?n:{}},x(arguments))},setObject:function(e,t,n){Y.sendRequest({command:"setSidebarContent",id:this._id,expression:e,rootTitle:t},n)},setPage:function(e){Y.sendRequest({command:"setSidebarPage",id:this._id,page:e})},__proto__:f.prototype},N.prototype={update:function(e,t,n){Y.sendRequest({command:"updateButton",id:this._id,icon:e,tooltip:t,disabled:Boolean(n)})}},W.prototype={addTraceProvider:function(e,t){const n="extension-trace-provider-"+Y.nextObjectId();return Y.sendRequest({command:"addTraceProvider",id:n,categoryName:e,categoryTooltip:t}),new U(n)}},B.prototype={complete:function(t,n){Y.sendRequest({command:"completeTra.eSession",id:this._id,url:t||e.DevToolsPath.EmptyUrlString,timeOffset:n||0})}},V.prototype={reload:function(e){let t=null;"object"==typeof e?t=e:"string"==typeof e&&(t={userAgent:e},console.warn("Passing userAgent as string parameter to inspectedWindow.reload() is deprecated. Use inspectedWindow.reload({ userAgent: value}) instead.")),Y.sendRequest({command:"Reload",options:t})},eval:function(e,t){const n=x(arguments);function s(e){const{isError:t,isException:s,value:i}=e;t||s?n&&n(void 0,e):n&&n(i)}return Y.sendRequest({command:"evaluateOnInspectedPage",expression:e,evaluateOptions:"object"==typeof t?t:void 0},n&&s),null},getResources:function(e){function t(e){return new C(e)}Y.sendRequest({command:"getPageResources"},e&&function(n){e&&e(n.map(t).filter(F))})}},G.prototype={get url(){return this._url},get type(){return this._type},getContent:function(e){Y.sendRequest({command:"getResourceContent",url:this._url},e&&function(t){const{content:n,encoding:s}=t;e&&e(n,s)})},setContent:function(e,t,n){Y.sendRequest({command:"setResourceContent",url:this._url,content:e,commit:t},n)}};let K=[],$=null;function z(){$=null,Y.sendRequest({command:"_forwardKeyboardEvent",entries:K}),K=[]}function X(e){this._callbacks={},this._handlers={},this._lastRequestId=0,this._lastObjectId=0,this.registerHandler("callback",this._onCallback.bind(this));const t=new MessageChannel;this._port=t.port1,this._port.addEventListener("message",this._onMessage.bind(this),!1),this._port.start(),e.postMessage("registerExtension","*",[t.port2])}document.addEventListener("keydown",(function(e){const t=document.activeElement;if(t){if(("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName||t.isContentEditable)&&!(e.ctrlKey||e.altKey||e.metaKey))return}let n=0;e.shiftKey&&(n|=1),e.ctrlKey&&(n|=2),e.altKey&&(n|=4),e.metaKey&&(n|=8);const s=255&e.keyCode|n<<8;if(!c.has(s))return;e.preventDefault();const i={eventType:e.type,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey,keyIdentifier:e.keyIdentifier,key:e.key,code:e.code,location:e.location,keyCode:e.keyCode};K.push(i),$||($=window.setTimeout(z,0))}),!1),X.prototype={sendRequest:function(e,t,n){"function"==typeof t&&(e.requestId=this._registerCallback(t)),this._port.postMessage(e,n)},hasHandler:function(e){return Boolean(this._handlers[e])},registerHandler:function(e,t){this._handlers[e]=t},unregisterHandler:function(e){delete this._handlers[e]},nextObjectId:function(){return o.toString()+"_"+ ++this._lastObjectId},_registerCallback:function(e){const t=++this._lastRequestId;return this._callbacks[t]=e,t},_onCallback:function(e){if(e.requestId in this._callbacks){const t=this._callbacks[e.requestId];delete this._callbacks[e.requestId],t(e.result)}},_onMessage:function(e){const t=e.data,n=this._handlers[t.command];n&&n.call(this,t)}};const Y=new X(a||window.parent),J=new function(){this.inspectedWindow=new V,this.panels=new g,this.network=new p,this.timeline=new W,this.languageServices=new v,this.recorder=new _,y(this,"webInspector","resources","network")};if(Object.defineProperty(d,"devtools",{value:{},enumerable:!0}),d.devtools.inspectedWindow={},Object.defineProperty(d.devtools.inspectedWindow,"tabId",{get:function(){return n}}),d.devtools.inspectedWindow.__proto__=J.inspectedWindow,d.devtools.network=J.network,d.devtools.panels=J.panels,d.devtools.panels.themeName=s,d.devtools.languageServices=J.languageServices,d.devtools.recorder=J.recorder,!1!==t.exposeExperimentalAPIs){d.experimental=d.experimental||{},d.experimental.devtools=d.experimental.devtools||{};const e=Object.getOwnPropertyNames(J);for(let t=0;t<e.length;++t){const n=Object.getOwnPropertyDescriptor(J,e[t]);n&&Object.defineProperty(d.experimental.devtools,e[t],n)}d.experimental.devtools.inspectedWindow=d.devtools.inspectedWindow}t.exposeWebInspectorNamespace&&(window.webInspector=J),r(Y,J)},self.buildExtensionAPIInjectedScript=function(e,t,n,s,i){const r=[e,t||null,n,s].map((e=>JSON.stringify(e))).join(",");return i||(i=()=>{}),"(function(injectedScriptId){ ("+self.injectedExtensionAPI.toString()+")("+r+","+i+", injectedScriptId);})"};var p=Object.freeze({__proto__:null});class m extends n.Widget.Widget{server;id;iframe;frameIndex;constructor(e,t,n,s){super(),this.setHideOnDetach(),this.element.className="vbox flex-auto",this.element.tabIndex=-1,this.server=e,this.id=t,this.iframe=document.createElement("iframe"),this.iframe.addEventListener("load",this.onLoad.bind(this),!1),this.iframe.src=n,this.iframe.className=s,this.setDefaultFocusedElement(this.element),this.element.appendChild(this.iframe)}wasShown(){super.wasShown(),"number"==typeof this.frameIndex&&this.server.notifyViewShown(this.id,this.frameIndex)}willHide(){"number"==typeof this.frameIndex&&this.server.notifyViewHidden(this.id)}onLoad(){const e=window.frames;this.frameIndex=Array.prototype.indexOf.call(e,this.iframe.contentWindow),this.isShowing()&&this.server.notifyViewShown(this.id,this.frameIndex)}}class g extends n.Widget.VBox{server;id;constructor(e,t){super(),this.server=e,this.id=t}wasShown(){this.server.notifyViewShown(this.id)}willHide(){this.server.notifyViewHidden(this.id)}}var f=Object.freeze({__proto__:null,ExtensionView:m,ExtensionNotifierView:g});class b extends n.Panel.Panel{server;id;panelToolbar;searchableViewInternal;constructor(e,t,s,i){super(t),this.server=e,this.id=s,this.setHideOnDetach(),this.panelToolbar=new n.Toolbar.Toolbar("hidden",this.element),this.searchableViewInternal=new n.SearchableView.SearchableView(this,null),this.searchableViewInternal.show(this.element);new m(e,this.id,i,"extension").show(this.searchableViewInternal.element)}addToolbarItem(e){this.panelToolbar.element.classList.remove("hidden"),this.panelToolbar.appendToolbarItem(e)}onSearchCanceled(){this.server.notifySearchAction(this.id,"cancelSearch"),this.searchableViewInternal.updateSearchMatchesCount(0)}searchableView(){return this.searchableViewInternal}performSearch(e,t,n){const s=e.query;this.server.notifySearchAction(this.id,"performSearch",s)}jumpToNextSearchResult(){this.server.notifySearchAction(this.id,"nextSearchResult")}jumpToPreviousSearchResult(){this.server.notifySearchAction(this.id,"previousSearchResult")}supportsCaseSensitiveSearch(){return!1}supportsRegexSearch(){return!1}}class w{id;toolbarButtonInternal;constructor(e,t,s,i,r){this.id=t,this.toolbarButtonInternal=new n.Toolbar.ToolbarButton("",""),this.toolbarButtonInternal.addEventListener(n.Toolbar.ToolbarButton.Events.Click,e.notifyButtonClicked.bind(e,this.id)),this.update(s,i,r)}update(e,t,n){"string"==typeof e&&this.toolbarButtonInternal.setBackgroundImage(e),"string"==typeof t&&this.toolbarButtonInternal.setTitle(t),"boolean"==typeof n&&this.toolbarButtonInternal.setEnabled(!n)}toolbarButton(){return this.toolbarButtonInternal}}class R extends n.View.SimpleView{panelNameInternal;server;idInternal;extensionView;objectPropertiesView;constructor(e,t,n,s){super(n),this.element.classList.add("fill"),this.panelNameInternal=t,this.server=e,this.idInternal=s}id(){return this.idInternal}panelName(){return this.panelNameInternal}setObject(e,n,s){this.createObjectPropertiesView(),this.setObjectInternal(t.RemoteObject.RemoteObject.fromLocalObject(e),n,s)}setExpression(e,t,n,s,i){this.createObjectPropertiesView(),this.server.evaluate(e,!0,!1,n,s,this.onEvaluate.bind(this,t,i))}setPage(e){this.objectPropertiesView&&(this.objectPropertiesView.detach(),delete this.objectPropertiesView),this.extensionView&&this.extensionView.detach(!0),this.extensionView=new m(this.server,this.idInternal,e,"extension fill"),this.extensionView.show(this.element),this.element.style.height||this.setHeight("150px")}setHeight(e){this.element.style.height=e}onEvaluate(e,t,n,s,i){n?t(n.toString()):s?this.setObjectInternal(s,e,t):t()}createObjectPropertiesView(){this.objectPropertiesView||(this.extensionView&&(this.extensionView.detach(!0),delete this.extensionView),this.objectPropertiesView=new g(this.server,this.idInternal),this.objectPropertiesView.show(this.element))}setObjectInternal(e,t,s){const i=this.objectPropertiesView;i?(i.element.removeChildren(),n.UIUtils.Renderer.render(e,{title:t,editable:!1}).then((e=>{if(!e)return void s();const t=e.tree&&e.tree.firstChild();t&&t.expand(),i.element.appendChild(e.node),s()}))):s("operation cancelled")}}var E=Object.freeze({__proto__:null,ExtensionPanel:b,ExtensionButton:w,ExtensionSidebarPane:R});function y(e){switch(e){case"http":return"80";case"https":return"443";case"ftp":return"25"}}class x{pattern;static parse(e){if("<all_urls>"===e)return new x({matchesAll:!0});const t=function(e){const t=e.indexOf("://");if(t<0)return;const n=e.substr(0,t).toLowerCase();return["*","http","https","ftp","chrome","chrome-extension"].includes(n)?{scheme:n,hostPattern:e.substr(t+"://".length)}:void 0}(e);if(!t)return;const{scheme:n,hostPattern:s}=t,i=function(e,t){const n=e.indexOf("/");if(n>=0){const t=e.substr(n);if("/*"!==t&&"/"!==t)return;e=e.substr(0,n)}if(e.endsWith(":*")&&(e=e.substr(0,e.length-":*".length)),e.endsWith(":"))return;let s;try{s=new URL(e.startsWith("*.")?`http://${e.substr("*.".length)}`:`http://${e}`)}catch{return}if("/"!==s.pathname)return;if(s.hostname.endsWith(".")&&(s.hostname=s.hostname.substr(0,s.hostname.length-1)),"%2A"!==s.hostname&&s.hostname.includes("%2A"))return;const i=y("http");if(!i)return;const r=e.endsWith(`:${i}`)?i:""===s.port?"*":s.port;if("*"!==r&&!["http","https","ftp"].includes(t))return;return{host:"%2A"!==s.hostname?e.startsWith("*.")?`*.${s.hostname}`:s.hostname:"*",port:r}}(s,n);if(!i)return;const{host:r,port:o}=i;return new x({scheme:n,host:r,port:o,matchesAll:!1})}constructor(e){this.pattern=e}get scheme(){return this.pattern.matchesAll?"*":this.pattern.scheme}get host(){return this.pattern.matchesAll?"*":this.pattern.host}get port(){return this.pattern.matchesAll?"*":this.pattern.port}matchesAllUrls(){return this.pattern.matchesAll}matchesUrl(e){let t;try{t=new URL(e)}catch{return!1}if(this.matchesAllUrls())return!0;const n=t.protocol.substr(0,t.protocol.length-1),s=t.port||y(n);return this.matchesScheme(n)&&this.matchesHost(t.hostname)&&(!s||this.matchesPort(s))}matchesScheme(e){return!!this.pattern.matchesAll||("*"===this.pattern.scheme?"http"===e||"https"===e:this.pattern.scheme===e)}matchesHost(e){if(this.pattern.matchesAll)return!0;if("*"===this.pattern.host)return!0;let t=new URL(`http://${e}`).hostname;return t.endsWith(".")&&(t=t.substr(0,t.length-1)),this.pattern.host.startsWith("*.")?t===this.pattern.host.substr(2)||t.endsWith(this.pattern.host.substr(1)):this.pattern.host===t}matchesPort(e){return!!this.pattern.matchesAll||("*"===this.pattern.port||this.pattern.port===e)}}var v=Object.freeze({__proto__:null,HostUrlPattern:x});class _{port;nextRequestId=0;pendingRequests;constructor(e){this.port=e,this.port.onmessage=this.onResponse.bind(this),this.pendingRequests=new Map}sendRequest(e,t){return new Promise(((n,s)=>{const i=this.nextRequestId++;this.pendingRequests.set(i,{resolve:n,reject:s}),this.port.postMessage({requestId:i,method:e,parameters:t})}))}disconnect(){for(const{reject:e}of this.pendingRequests.values())e(new Error("Extension endpoint disconnected"));this.pendingRequests.clear(),this.port.close()}onResponse({data:e}){if("event"in e)return void this.handleEvent(e);const{requestId:t,result:n,error:s}=e,i=this.pendingRequests.get(t);i?(this.pendingRequests.delete(t),s?i.reject(new Error(s.message)):i.resolve(n)):console.error(`No pending request ${t}`)}handleEvent(e){throw new Error("handleEvent is not implemented")}}class I extends _{plugin;constructor(e,t){super(t),this.plugin=e}handleEvent({event:e}){switch(e){case"unregisteredLanguageExtensionPlugin":{this.disconnect();const{pluginManager:e}=u.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();e&&e.removePlugin(this.plugin);break}}}}class S{supportedScriptTypes;endpoint;name;constructor(e,t,n){this.name=e,this.supportedScriptTypes=t,this.endpoint=new I(this,n)}handleScript(e){const t=e.scriptLanguage();return null!==t&&null!==e.debugSymbols&&t===this.supportedScriptTypes.language&&this.supportedScriptTypes.symbol_types.includes(e.debugSymbols.type)}addRawModule(e,t,n){return this.endpoint.sendRequest("addRawModule",{rawModuleId:e,symbolsURL:t,rawModule:n})}removeRawModule(e){return this.endpoint.sendRequest("removeRawModule",{rawModuleId:e})}sourceLocationToRawLocation(e){return this.endpoint.sendRequest("sourceLocationToRawLocation",{sourceLocation:e})}rawLocationToSourceLocation(e){return this.endpoint.sendRequest("rawLocationToSourceLocation",{rawLocation:e})}getScopeInfo(e){return this.endpoint.sendRequest("getScopeInfo",{type:e})}listVariablesInScope(e){return this.endpoint.sendRequest("listVariablesInScope",{rawLocation:e})}getFunctionInfo(e){return this.endpoint.sendRequest("getFunctionInfo",{rawLocation:e})}getInlinedFunctionRanges(e){return this.endpoint.sendRequest("getInlinedFunctionRanges",{rawLocation:e})}getInlinedCalleesRanges(e){return this.endpoint.sendRequest("getInlinedCalleesRanges",{rawLocation:e})}async getMappedLines(e,t){return this.endpoint.sendRequest("getMappedLines",{rawModuleId:e,sourceFileURL:t})}async evaluate(e,t,n){return this.endpoint.sendRequest("formatValue",{expression:e,context:t,stopId:n})}getProperties(e){return this.endpoint.sendRequest("getProperties",{objectId:e})}releaseObject(e){return this.endpoint.sendRequest("releaseObject",{objectId:e})}}let P=null;class A extends s.ObjectWrapper.ObjectWrapper{#e=new Set;#t=new Map;static instance(){return P||(P=new A),P}addPlugin(e){this.#e.add(e),this.dispatchEventToListeners(O.PluginAdded,e)}removePlugin(e){this.#e.delete(e),this.dispatchEventToListeners(O.PluginRemoved,e)}plugins(){return Array.from(this.#e.values())}registerView(e){this.#t.set(e.id,e),this.dispatchEventToListeners(O.ViewRegistered,e)}views(){return Array.from(this.#t.values())}getViewDescriptor(e){return this.#t.get(e)}showView(e){const t=this.#t.get(e);if(!t)throw new Error(`View with id ${e} is not found.`);this.dispatchEventToListeners(O.ShowViewRequested,t)}}var O;!function(e){e.PluginAdded="pluginAdded",e.PluginRemoved="pluginRemoved",e.ViewRegistered="viewRegistered",e.ShowViewRequested="showViewRequested"}(O||(O={}));var T=Object.freeze({__proto__:null,RecorderPluginManager:A,get Events(){return O}});class L extends _{name;mediaType;capabilities;constructor(e,t,n,s){super(t),this.name=e,this.mediaType=s,this.capabilities=n}getName(){return this.name}getCapabilities(){return this.capabilities}getMediaType(){return this.mediaType}handleEvent({event:e}){if("unregisteredRecorderExtensionPlugin"!==e)throw new Error(`Unrecognized Recorder extension endpoint event: ${e}`);this.disconnect(),A.instance().removePlugin(this)}stringify(e){return this.sendRequest("stringify",{recording:e})}stringifyStep(e){return this.sendRequest("stringifyStep",{step:e})}replay(e){return this.sendRequest("replay",{recording:e})}}var C=Object.freeze({__proto__:null,RecorderExtensionEndpoint:L});const H=new WeakMap,q=[].map((e=>new URL(e).origin));let k;class M{runtimeAllowedHosts;runtimeBlockedHosts;static create(e){const t=[],n=[];if(e){for(const n of e.runtimeAllowedHosts){const e=x.parse(n);if(!e)return null;t.push(e)}for(const t of e.runtimeBlockedHosts){const e=x.parse(t);if(!e)return null;n.push(e)}}return new M(t,n)}constructor(e,t){this.runtimeAllowedHosts=e,this.runtimeBlockedHosts=t}isAllowedOnURL(e){return e?!(this.runtimeBlockedHosts.some((t=>t.matchesUrl(e)))&&!this.runtimeAllowedHosts.some((t=>t.matchesUrl(e)))):0===this.runtimeBlockedHosts.length}}class j{name;hostsPolicy;allowFileAccess;constructor(e,t,n){this.name=e,this.hostsPolicy=t,this.allowFileAccess=n}isAllowedOnTarget(e){if(e||(e=t.TargetManager.TargetManager.instance().primaryPageTarget()?.inspectedURL()),!e)return!1;if(!D.canInspectURL(e))return!1;if(!this.hostsPolicy.isAllowedOnURL(e))return!1;if(!this.allowFileAccess){let t;try{t=new URL(e)}catch(e){return!1}return"file:"!==t.protocol}return!0}}class D extends s.ObjectWrapper.ObjectWrapper{clientObjects;handlers;subscribers;subscriptionStartHandlers;subscriptionStopHandlers;extraHeaders;requests;requestIds;lastRequestId;registeredExtensions;status;sidebarPanesInternal;extensionsEnabled;inspectedTabId;extensionAPITestHook;themeChangeHandlers=new Map;#n=[];constructor(){super(),this.clientObjects=new Map,this.handlers=new Map,this.subscribers=new Map,this.subscriptionStartHandlers=new Map,this.subscriptionStopHandlers=new Map,this.extraHeaders=new Map,this.requests=new Map,this.requestIds=new Map,this.lastRequestId=0,this.registeredExtensions=new Map,this.status=new B,this.sidebarPanesInternal=[],this.extensionsEnabled=!0,this.registerHandler("addRequestHeaders",this.onAddRequestHeaders.bind(this)),this.registerHandler("applyStyleSheet",this.onApplyStyleSheet.bind(this)),this.registerHandler("createPanel",this.onCreatePanel.bind(this)),this.registerHandler("createSidebarPane",this.onCreateSidebarPane.bind(this)),this.registerHandler("createToolbarButton",this.onCreateToolbarButton.bind(this)),this.registerHandler("evaluateOnInspectedPage",this.onEvaluateOnInspectedPage.bind(this)),this.registerHandler("_forwardKeyboardEvent",this.onForwardKeyboardEvent.bind(this)),this.registerHandler("getHAR",this.onGetHAR.bind(this)),this.registerHandler("getPageResources",this.onGetPageResources.bind(this)),this.registerHandler("getRequestContent",this.onGetRequestContent.bind(this)),this.registerHandler("getResourceContent",this.onGetResourceContent.bind(this)),this.registerHandler("Reload",this.onReload.bind(this)),this.registerHandler("setOpenResourceHandler",this.onSetOpenResourceHandler.bind(this)),this.registerHandler("setThemeChangeHandler",this.onSetThemeChangeHandler.bind(this)),this.registerHandler("setResourceContent",this.onSetResourceContent.bind(this)),this.registerHandler("setSidebarHeight",this.onSetSidebarHeight.bind(this)),this.registerHandler("setSidebarContent",this.onSetSidebarContent.bind(this)),this.registerHandler("setSidebarPage",this.onSetSidebarPage.bind(this)),this.registerHandler("showPanel",this.onShowPanel.bind(this)),this.registerHandler("subscribe",this.onSubscribe.bind(this)),this.registerHandler("openResource",this.onOpenResource.bind(this)),this.registerHandler("unsubscribe",this.onUnsubscribe.bind(this)),this.registerHandler("updateButton",this.onUpdateButton.bind(this)),this.registerHandler("registerLanguageExtensionPlugin",this.registerLanguageExtensionEndpoint.bind(this)),this.registerHandler("getWasmLinearMemory",this.onGetWasmLinearMemory.bind(this)),this.registerHandler("getWasmGlobal",this.onGetWasmGlobal.bind(this)),this.registerHandler("getWasmLocal",this.onGetWasmLocal.bind(this)),this.registerHandler("getWasmOp",this.onGetWasmOp.bind(this)),this.registerHandler("registerRecorderExtensionPlugin",this.registerRecorderExtensionEndpoint.bind(this)),this.registerHandler("createRecorderView",this.onCreateRecorderView.bind(this)),this.registerHandler("showRecorderView",this.onShowRecorderView.bind(this)),window.addEventListener("message",this.onWindowMessage,!1);const e=window.DevToolsAPI&&window.DevToolsAPI.getInspectedTabId&&window.DevToolsAPI.getInspectedTabId();e&&this.setInspectedTabId({data:e}),i.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(i.InspectorFrontendHostAPI.Events.SetInspectedTabId,this.setInspectedTabId,this),this.initExtensions(),d.ThemeSupport.instance().addEventListener(d.ThemeChangeEvent.eventName,this.#s)}dispose(){d.ThemeSupport.instance().removeEventListener(d.ThemeChangeEvent.eventName,this.#s),t.TargetManager.TargetManager.instance().removeEventListener(t.TargetManager.Events.InspectedURLChanged,this.inspectedURLChanged,this),i.InspectorFrontendHost.InspectorFrontendHostInstance.events.removeEventListener(i.InspectorFrontendHostAPI.Events.SetInspectedTabId,this.setInspectedTabId,this),window.removeEventListener("message",this.onWindowMessage,!1)}#s=()=>{const e=d.ThemeSupport.instance().themeName();for(const t of this.themeChangeHandlers.values())t.postMessage({command:"host-theme-change",themeName:e})};static instance(e={forceNew:null}){const{forceNew:t}=e;return k&&!t||(k?.dispose(),k=new D),k}initializeExtensions(){null!==this.inspectedTabId&&i.InspectorFrontendHost.InspectorFrontendHostInstance.setAddExtensionCallback(this.addExtension.bind(this))}hasExtensions(){return Boolean(this.registeredExtensions.size)}notifySearchAction(e,t,n){this.postNotification("panel-search-"+e,t,n)}notifyViewShown(e,t){this.postNotification("view-shown-"+e,t)}notifyViewHidden(e){this.postNotification("view-hidden,"+e)}notifyButtonClicked(e){this.postNotification("button-clicked-"+e)}registerLanguageExtensionEndpoint(e,t){if("registerLanguageExtensionPlugin"!==e.command)return this.status.E_BADARG("command","expected registerLanguageExtensionPlugin");const{pluginManager:n}=u.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();if(!n)return this.status.E_FAILED("WebAssembly DWARF support needs to be enabled to use this extension");const{pluginName:s,port:i,supportedScriptTypes:{language:r,symbol_types:o}}=e,a=Array.isArray(o)&&o.every((e=>"string"==typeof e))?o:[],c=new S(s,{language:r,symbol_types:a},i);return n.addPlugin(c),this.status.OK()}async loadWasmValue(e,t){const{pluginManager:n}=u.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();if(!n)return this.status.E_FAILED("WebAssembly DWARF support needs to be enabled to use this extension");const s=n.callFrameForStopId(t);if(!s)return this.status.E_BADARG("stopId","Unknown stop id");const i=await s.debuggerModel.agent.invoke_evaluateOnCallFrame({callFrameId:s.id,expression:e,silent:!0,returnByValue:!0,throwOnSideEffect:!0});return i.exceptionDetails||i.getError()?this.status.E_FAILED("Failed"):i.result.value}async onGetWasmLinearMemory(e){return"getWasmLinearMemory"!==e.command?this.status.E_BADARG("command","expected getWasmLinearMemory"):await this.loadWasmValue(`[].slice.call(new Uint8Array(memories[0].buffer, ${Number(e.offset)}, ${Number(e.length)}))`,e.stopId)}async onGetWasmGlobal(e){return"getWasmGlobal"!==e.command?this.status.E_BADARG("command","expected getWasmGlobal"):this.loadWasmValue(`globals[${Number(e.global)}]`,e.stopId)}async onGetWasmLocal(e){return"getWasmLocal"!==e.command?this.status.E_BADARG("command","expected getWasmLocal"):this.loadWasmValue(`locals[${Number(e.local)}]`,e.stopId)}async onGetWasmOp(e){return"getWasmOp"!==e.command?this.status.E_BADARG("command","expected getWasmOp"):this.loadWasmValue(`stack[${Number(e.op)}]`,e.stopId)}registerRecorderExtensionEndpoint(e,t){if("registerRecorderExtensionPlugin"!==e.command)return this.status.E_BADARG("command","expected registerRecorderExtensionPlugin");const{pluginName:n,mediaType:s,port:i,capabilities:r}=e;return A.instance().addPlugin(new L(n,i,r,s)),this.status.OK()}onShowRecorderView(e){if("showRecorderView"!==e.command)return this.status.E_BADARG("command","expected showRecorderView");A.instance().showView(e.id)}onCreateRecorderView(e,t){if("createRecorderView"!==e.command)return this.status.E_BADARG("command","expected createRecorderView");const n=e.id;if(this.clientObjects.has(n))return this.status.E_EXISTS(n);const s=D.expandResourcePath(this.getExtensionOrigin(t),e.pagePath);if(void 0===s)return this.status.E_BADARG("pagePath","Resources paths cannot point to non-extension resources");return A.instance().registerView({id:n,pagePath:s,title:e.title,onShown:()=>this.notifyViewShown(n),onHidden:()=>this.notifyViewHidden(n)}),this.status.OK()}inspectedURLChanged(e){if(!D.canInspectURL(e.data.inspectedURL()))return void this.disableExtensions();if(e.data!==t.TargetManager.TargetManager.instance().primaryPageTarget())return;this.requests=new Map;const n=e.data.inspectedURL();this.postNotification("inspected-url-changed",n),this.#n.forEach((e=>this.addExtension(e))),this.#n.splice(0)}hasSubscribers(e){return this.subscribers.has(e)}postNotification(e,...t){if(!this.extensionsEnabled)return;const n=this.subscribers.get(e);if(!n)return;const s={command:"notify-"+e,arguments:Array.prototype.slice.call(arguments,1)};for(const e of n)this.extensionEnabled(e)&&e.postMessage(s)}onSubscribe(e,t){if("subscribe"!==e.command)return this.status.E_BADARG("command","expected subscribe");const n=this.subscribers.get(e.type);if(n)n.add(t);else{this.subscribers.set(e.type,new Set([t]));const n=this.subscriptionStartHandlers.get(e.type);n&&n()}}onUnsubscribe(e,t){if("unsubscribe"!==e.command)return this.status.E_BADARG("command","expected unsubscribe");const n=this.subscribers.get(e.type);if(n&&(n.delete(t),!n.size)){this.subscribers.delete(e.type);const t=this.subscriptionStopHandlers.get(e.type);t&&t()}}onAddRequestHeaders(e){if("addRequestHeaders"!==e.command)return this.status.E_BADARG("command","expected addRequestHeaders");const n=e.extensionId;if("string"!=typeof n)return this.status.E_BADARGTYPE("extensionId",typeof n,"string");let s=this.extraHeaders.get(n);s||(s=new Map,this.extraHeaders.set(n,s));for(const t in e.headers)s.set(t,e.headers[t]);const i={};for(const e of this.extraHeaders.values())for(const[t,n]of e)"__proto__"!==t&&"string"==typeof n&&(i[t]=n);t.NetworkManager.MultitargetNetworkManager.instance().setExtraHTTPHeaders(i)}onApplyStyleSheet(e){if("applyStyleSheet"!==e.command)return this.status.E_BADARG("command","expected applyStyleSheet");if(!o.Runtime.experiments.isEnabled("applyCustomStylesheet"))return;const t=document.createElement("style");t.textContent=e.styleSheet,document.head.appendChild(t),d.ThemeSupport.instance().addCustomStylesheet(e.styleSheet);for(let e=document.body;e;e=e.traverseNextNode(document.body))e instanceof ShadowRoot&&d.ThemeSupport.instance().injectCustomStyleSheets(e)}getExtensionOrigin(e){const t=H.get(e);if(!t)throw new Error("Received a message from an unregistered extension");return t}onCreatePanel(e,t){if("createPanel"!==e.command)return this.status.E_BADARG("command","expected createPanel");const s=e.id;if(this.clientObjects.has(s)||n.InspectorView.InspectorView.instance().hasPanel(s))return this.status.E_EXISTS(s);const i=D.expandResourcePath(this.getExtensionOrigin(t),e.page);if(void 0===i)return this.status.E_BADARG("page","Resources paths cannot point to non-extension resources");let o=this.getExtensionOrigin(t)+e.title;o=o.replace(/\s/g,"");const a=new W(o,r.i18n.lockedString(e.title),new b(this,o,s,i));return this.clientObjects.set(s,a),n.InspectorView.InspectorView.instance().addPanel(a),this.status.OK()}onShowPanel(e){if("showPanel"!==e.command)return this.status.E_BADARG("command","expected showPanel");let t=e.id;const s=this.clientObjects.get(e.id);s&&s instanceof W&&(t=s.viewId()),n.InspectorView.InspectorView.instance().showPanel(t)}onCreateToolbarButton(e,t){if("createToolbarButton"!==e.command)return this.status.E_BADARG("command","expected createToolbarButton");const n=this.clientObjects.get(e.panel);if(!(n&&n instanceof W))return this.status.E_NOTFOUND(e.panel);const s=D.expandResourcePath(this.getExtensionOrigin(t),e.icon);if(void 0===s)return this.status.E_BADARG("icon","Resources paths cannot point to non-extension resources");const i=new w(this,e.id,s,e.tooltip,e.disabled);return this.clientObjects.set(e.id,i),n.widget().then((function(e){e.addToolbarItem(i.toolbarButton())})),this.status.OK()}onUpdateButton(e,t){if("updateButton"!==e.command)return this.status.E_BADARG("command","expected updateButton");const n=this.clientObjects.get(e.id);if(!(n&&n instanceof w))return this.status.E_NOTFOUND(e.id);const s=e.icon&&D.expandResourcePath(this.getExtensionOrigin(t),e.icon);return e.icon&&void 0===s?this.status.E_BADARG("icon","Resources paths cannot point to non-extension resources"):(n.update(s,e.tooltip,e.disabled),this.status.OK())}onCreateSidebarPane(e){if("createSidebarPane"!==e.command)return this.status.E_BADARG("command","expected createSidebarPane");const t=e.id,n=new R(this,e.panel,r.i18n.lockedString(e.title),t);return this.sidebarPanesInternal.push(n),this.clientObjects.set(t,n),this.dispatchEventToListeners(N.SidebarPaneAdded,n),this.status.OK()}sidebarPanes(){return this.sidebarPanesInternal}onSetSidebarHeight(e){if("setSidebarHeight"!==e.command)return this.status.E_BADARG("command","expected setSidebarHeight");const t=this.clientObjects.get(e.id);return t&&t instanceof R?(t.setHeight(e.height),this.status.OK()):this.status.E_NOTFOUND(e.id)}onSetSidebarContent(e,t){if("setSidebarContent"!==e.command)return this.status.E_BADARG("command","expected setSidebarContent");const{requestId:n,id:s,rootTitle:i,expression:r,evaluateOptions:o,evaluateOnPage:a}=e,c=this.clientObjects.get(s);if(!(c&&c instanceof R))return this.status.E_NOTFOUND(e.id);function d(e){const s=e?this.status.E_FAILED(e):this.status.OK();this.dispatchCallback(n,t,s)}a?c.setExpression(r,i,o,this.getExtensionOrigin(t),d.bind(this)):c.setObject(e.expression,e.rootTitle,d.bind(this))}onSetSidebarPage(e,t){if("setSidebarPage"!==e.command)return this.status.E_BADARG("command","expected setSidebarPage");const n=this.clientObjects.get(e.id);if(!(n&&n instanceof R))return this.status.E_NOTFOUND(e.id);const s=D.expandResourcePath(this.getExtensionOrigin(t),e.page);if(void 0===s)return this.status.E_BADARG("page","Resources paths cannot point to non-extension resources");n.setPage(s)}onOpenResource(e){if("openResource"!==e.command)return this.status.E_BADARG("command","expected openResource");const t=h.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.url);if(t)return s.Revealer.reveal(t.uiLocation(e.lineNumber,e.columnNumber)),this.status.OK();const n=u.ResourceUtils.resourceForURL(e.url);if(n)return s.Revealer.reveal(n),this.status.OK();const i=a.NetworkLog.NetworkLog.instance().requestForURL(e.url);return i?(s.Revealer.reveal(i),this.status.OK()):this.status.E_NOTFOUND(e.url)}onSetOpenResourceHandler(e,t){if("setOpenResourceHandler"!==e.command)return this.status.E_BADARG("command","expected setOpenResourceHandler");const n=this.registeredExtensions.get(this.getExtensionOrigin(t));if(!n)throw new Error("Received a message from an unregistered extension");const{name:s}=n;e.handlerPresent?c.Linkifier.Linkifier.registerLinkHandler(s,this.handleOpenURL.bind(this,t)):c.Linkifier.Linkifier.unregisterLinkHandler(s)}onSetThemeChangeHandler(e,t){if("setThemeChangeHandler"!==e.command)return this.status.E_BADARG("command","expected setThemeChangeHandler");const n=this.getExtensionOrigin(t);if(!this.registeredExtensions.get(n))throw new Error("Received a message from an unregistered extension");e.handlerPresent?this.themeChangeHandlers.set(n,t):this.themeChangeHandlers.delete(n)}handleOpenURL(e,t,n){e.postMessage({command:"open-resource",resource:this.makeResource(t),lineNumber:n+1})}onReload(e){if("Reload"!==e.command)return this.status.E_BADARG("command","expected Reload");const n=e.options||{};let s;return t.NetworkManager.MultitargetNetworkManager.instance().setUserAgentOverride("string"==typeof n.userAgent?n.userAgent:"",null),n.injectedScript&&(s="(function(){"+n.injectedScript+"})()"),t.ResourceTreeModel.ResourceTreeModel.reloadAllPages(Boolean(n.ignoreCache),s),this.status.OK()}onEvaluateOnInspectedPage(e,t){if("evaluateOnInspectedPage"!==e.command)return this.status.E_BADARG("command","expected evaluateOnInspectedPage");const{requestId:n,expression:s,evaluateOptions:i}=e;return this.evaluate(s,!0,!0,i,this.getExtensionOrigin(t),function(e,s,i){let r;r=e||!s?this.status.E_PROTOCOLERROR(e?.toString()):i?{isException:!0,value:s.description}:{value:s.value},this.dispatchCallback(n,t,r)}.bind(this))}async onGetHAR(e){if("getHAR"!==e.command)return this.status.E_BADARG("command","expected getHAR");const t=a.NetworkLog.NetworkLog.instance().requests(),n=await l.Log.Log.build(t);for(let e=0;e<n.entries.length;++e)n.entries[e]._requestId=this.requestId(t[e]);return n}makeResource(e){return{url:e.contentURL(),type:e.contentType().name()}}onGetPageResources(){const e=new Map;function n(t){return e.has(t.contentURL())||e.set(t.contentURL(),this.makeResource(t)),!1}let s=h.Workspace.WorkspaceImpl.instance().uiSourceCodesForProjectType(h.Workspace.projectTypes.Network);s=s.concat(h.Workspace.WorkspaceImpl.instance().uiSourceCodesForProjectType(h.Workspace.projectTypes.ContentScripts)),s.forEach(n.bind(this));for(const e of t.TargetManager.TargetManager.instance().models(t.ResourceTreeModel.ResourceTreeModel))e.forAllResources(n.bind(this));return[...e.values()]}async getResourceContent(e,t,n){const s=e.contentURL(),i=H.get(n);if(!(i&&this.registeredExtensions.get(i))?.isAllowedOnTarget(s))return void this.dispatchCallback(t.requestId,n,this.status.E_FAILED("Permission denied"));const{content:r,isEncoded:o}=await e.requestContent();this.dispatchCallback(t.requestId,n,{encoding:o?"base64":"",content:r})}onGetRequestContent(e,t){if("getRequestContent"!==e.command)return this.status.E_BADARG("command","expected getRequestContent");const n=this.requestById(e.id);if(!n)return this.status.E_NOTFOUND(e.id);this.getResourceContent(n,e,t)}onGetResourceContent(e,t){if("getResourceContent"!==e.command)return this.status.E_BADARG("command","expected getResourceContent");const n=e.url,s=h.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(n)||u.ResourceUtils.resourceForURL(n);if(!s)return this.status.E_NOTFOUND(n);this.getResourceContent(s,e,t)}onSetResourceContent(e,n){if("setResourceContent"!==e.command)return this.status.E_BADARG("command","expected setResourceContent");const{url:s,requestId:i,content:r,commit:o}=e;const a=H.get(n);if(!(a&&this.registeredExtensions.get(a))?.isAllowedOnTarget(s))return this.status.E_FAILED("Permission denied");const c=h.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(s);if(!c||!c.contentType().isDocumentOrScriptOrStyleSheet()){return t.ResourceTreeModel.ResourceTreeModel.resourceForURL(s)?this.status.E_NOTSUPPORTED("Resource is not editable"):this.status.E_NOTFOUND(s)}c.setWorkingCopy(r),o&&c.commitWorkingCopy(),function(e){const t=e?this.status.E_FAILED(e):this.status.OK();this.dispatchCallback(i,n,t)}.call(this,null)}requestId(e){const t=this.requestIds.get(e);if(void 0===t){const t=++this.lastRequestId;return this.requestIds.set(e,t),this.requests.set(t,e),t}return t}requestById(e){return this.requests.get(e)}onForwardKeyboardEvent(t){if("_forwardKeyboardEvent"!==t.command)return this.status.E_BADARG("command","expected _forwardKeyboardEvent");t.entries.forEach((function(t){const n=new window.KeyboardEvent(t.eventType,{key:t.key,code:t.code,keyCode:t.keyCode,location:t.location,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey});n.__keyCode=function(t){let n=t.keyCode;n||t.key===e.KeyboardUtilities.ESCAPE_KEY&&(n=27);return n||0}(t),document.dispatchEvent(n)}))}dispatchCallback(e,t,n){e&&t.postMessage({command:"callback",requestId:e,result:n})}initExtensions(){this.registerAutosubscriptionHandler("resource-added",h.Workspace.WorkspaceImpl.instance(),h.Workspace.Events.UISourceCodeAdded,this.notifyResourceAdded),this.registerAutosubscriptionTargetManagerHandler("network-request-finished",t.NetworkManager.NetworkManager,t.NetworkManager.Events.RequestFinished,this.notifyRequestFinished),this.registerSubscriptionHandler("panel-objectSelected-elements",function(){n.Context.Context.instance().addFlavorChangeListener(t.DOMModel.DOMNode,this.notifyElementsSelectionChanged,this)}.bind(this),function(){n.Context.Context.instance().removeFlavorChangeListener(t.DOMModel.DOMNode,this.notifyElementsSelectionChanged,this)}.bind(this)),this.registerResourceContentCommittedHandler(this.notifyUISourceCodeContentCommitted),t.TargetManager.TargetManager.instance().addEventListener(t.TargetManager.Events.InspectedURLChanged,this.inspectedURLChanged,this)}notifyResourceAdded(e){const t=e.data;this.postNotification("resource-added",this.makeResource(t))}notifyUISourceCodeContentCommitted(e){const{uiSourceCode:t,content:n}=e.data;this.postNotification("resource-content-committed",this.makeResource(t),n)}async notifyRequestFinished(e){const t=e.data,n=await l.Log.Entry.build(t);this.postNotification("network-request-finished",this.requestId(t),n)}notifyElementsSelectionChanged(){this.postNotification("panel-objectSelected-elements")}sourceSelectionChanged(e,t){this.postNotification("panel-objectSelected-sources",{startLine:t.startLine,startColumn:t.startColumn,endLine:t.endLine,endColumn:t.endColumn,url:e})}setInspectedTabId(e){const t=this.inspectedTabId;this.inspectedTabId=e.data,null===t&&this.initializeExtensions()}addExtensionFrame({startPage:e,name:t}){const n=document.createElement("iframe");n.src=e,n.dataset.devtoolsExtension=t,n.style.display="none",document.body.appendChild(n)}addExtension(e){const s=e.startPage,r=t.TargetManager.TargetManager.instance().primaryPageTarget()?.inspectedURL()??"";if(""===r)return void this.#n.push(e);if(D.canInspectURL(r)||this.disableExtensions(),!this.extensionsEnabled)return;const o=M.create(e.hostsPolicy);if(o){try{const t=new URL(s).origin,a=e.name||`Extension ${t}`,c=new j(a,o,Boolean(e.allowFileAccess));if(!c.isAllowedOnTarget(r))return;if(!this.registeredExtensions.get(t)){const s=self.buildExtensionAPIInjectedScript(e,this.inspectedTabId,d.ThemeSupport.instance().themeName(),n.ShortcutRegistry.ShortcutRegistry.instance().globalShortcutKeys(),D.instance().extensionAPITestHook);i.InspectorFrontendHost.InspectorFrontendHostInstance.setInjectedScriptForOrigin(t,s),this.registeredExtensions.set(t,c)}this.addExtensionFrame(e)}catch(e){return console.error("Failed to initialize extension "+s+":"+e),!1}return!0}}registerExtension(e,t){this.registeredExtensions.has(e)?(H.set(t,e),t.addEventListener("message",this.onmessage.bind(this),!1),t.start()):e!==window.location.origin&&console.error("Ignoring unauthorized client request from "+e)}onWindowMessage=e=>{"registerExtension"===e.data&&this.registerExtension(e.origin,e.ports[0])};extensionEnabled(e){if(!this.extensionsEnabled)return!1;const t=H.get(e);if(!t)return!1;const n=this.registeredExtensions.get(t);return!!n&&n.isAllowedOnTarget()}async onmessage(e){const t=e.data;let n;const s=e.currentTarget,i=this.handlers.get(t.command);n=i?this.extensionEnabled(s)?await i(t,e.target):this.status.E_FAILED("Permission denied"):this.status.E_NOTSUPPORTED(t.command),n&&t.requestId&&this.dispatchCallback(t.requestId,e.target,n)}registerHandler(e,t){console.assert(Boolean(e)),this.handlers.set(e,t)}registerSubscriptionHandler(e,t,n){this.subscriptionStartHandlers.set(e,t),this.subscriptionStopHandlers.set(e,n)}registerAutosubscriptionHandler(e,t,n,s){this.registerSubscriptionHandler(e,(()=>t.addEventListener(n,s,this)),(()=>t.removeEventListener(n,s,this)))}registerAutosubscriptionTargetManagerHandler(e,n,s,i){this.registerSubscriptionHandler(e,(()=>t.TargetManager.TargetManager.instance().addModelListener(n,s,i,this)),(()=>t.TargetManager.TargetManager.instance().removeModelListener(n,s,i,this)))}registerResourceContentCommittedHandler(e){this.registerSubscriptionHandler("resource-content-committed",function(){h.Workspace.WorkspaceImpl.instance().addEventListener(h.Workspace.Events.WorkingCopyCommittedByUser,e,this),h.Workspace.WorkspaceImpl.instance().setHasResourceContentTrackingExtensions(!0)}.bind(this),function(){h.Workspace.WorkspaceImpl.instance().setHasResourceContentTrackingExtensions(!1),h.Workspace.WorkspaceImpl.instance().removeEventListener(h.Workspace.Events.WorkingCopyCommittedByUser,e,this)}.bind(this))}static expandResourcePath(e,t){const n=new URL(e).origin,i=new URL(s.ParsedURL.normalizePath(t),n);if(i.origin===n)return i.href}evaluate(e,n,s,i,r,o){let a,c;if((i=i||{}).frameURL)c=function(e){let n=null;return t.ResourceTreeModel.ResourceTreeModel.frames().some((function(t){return n=t.url===e?t:null,n})),n}(i.frameURL);else{const e=t.TargetManager.TargetManager.instance().primaryPageTarget(),n=e&&e.model(t.ResourceTreeModel.ResourceTreeModel);c=n&&n.mainFrame}if(!c)return i.frameURL?console.warn("evaluate: there is no frame with URL "+i.frameURL):console.warn("evaluate: the main frame is not yet available"),this.status.E_NOTFOUND(i.frameURL||"<top>");const d=this.registeredExtensions.get(r);if(!d?.isAllowedOnTarget(c.url))return this.status.E_FAILED("Permission denied");let u;i.useContentScriptContext?u=r:i.scriptExecutionContext&&(u=i.scriptExecutionContext);const l=c.resourceTreeModel().target().model(t.RuntimeModel.RuntimeModel),h=l?l.executionContexts():[];if(u){for(let e=0;e<h.length;++e){const t=h[e];t.frameId!==c.id||t.origin!==u||t.isDefault||(a=t)}if(!a)return console.warn("The JavaScript context "+u+" was not found in the frame "+c.url),this.status.E_NOTFOUND(u)}else{for(let e=0;e<h.length;++e){const t=h[e];t.frameId===c.id&&t.isDefault&&(a=t)}if(!a)return this.status.E_FAILED(c.url+" has no execution context")}if(!d?.isAllowedOnTarget(a.origin))return this.status.E_FAILED("Permission denied");a.evaluate({expression:e,objectGroup:"extension",includeCommandLineAPI:n,silent:!0,returnByValue:s,generatePreview:!1},!1,!1).then((function(e){if("error"in e)return void o(e.error,null,!1);o(null,e.object||null,Boolean(e.exceptionDetails))}))}static canInspectURL(e){let t;try{t=new URL(e)}catch(e){return!1}return!!q.includes(t.origin)||"chrome:"!==t.protocol&&"devtools:"!==t.protocol&&"chrome-untrusted:"!==t.protocol&&((!t.protocol.startsWith("http")||"chrome.google.com"!==t.hostname||!t.pathname.startsWith("/webstore"))&&((!t.protocol.startsWith("http")||"chromewebstore.google.com"!==t.hostname)&&!(window.DevToolsAPI&&window.DevToolsAPI.getOriginsForbiddenForExtensions&&window.DevToolsAPI.getOriginsForbiddenForExtensions()||[]).includes(t.origin)))}disableExtensions(){this.extensionsEnabled=!1}}var N;!function(e){e.SidebarPaneAdded="SidebarPaneAdded",e.TraceProviderAdded="TraceProviderAdded"}(N||(N={}));class W extends n.View.SimpleView{name;panel;constructor(e,t,n){super(t),this.name=e,this.panel=n}viewId(){return this.name}widget(){return Promise.resolve(this.panel)}}class B{OK;E_EXISTS;E_BADARG;E_BADARGTYPE;E_NOTFOUND;E_NOTSUPPORTED;E_PROTOCOLERROR;E_FAILED;constructor(){function t(t,n,...s){const i={code:t,description:n,details:s};return"OK"!==t&&(i.isError=!0,console.error("Extension server error: "+e.StringUtilities.sprintf(n,...s))),i}this.OK=t.bind(null,"OK","OK"),this.E_EXISTS=t.bind(null,"E_EXISTS","Object already exists: %s"),this.E_BADARG=t.bind(null,"E_BADARG","Invalid argument %s: %s"),this.E_BADARGTYPE=t.bind(null,"E_BADARGTYPE","Invalid type for argument %s: got %s, expected %s"),this.E_NOTFOUND=t.bind(null,"E_NOTFOUND","Object not found: %s"),this.E_NOTSUPPORTED=t.bind(null,"E_NOTSUPPORTED","Object does not support requested operation: %s"),this.E_PROTOCOLERROR=t.bind(null,"E_PROTOCOLERROR","Inspector protocol error: %s"),this.E_FAILED=t.bind(null,"E_FAILED","Operation failed: %s")}}var U=Object.freeze({__proto__:null,HostsPolicy:M,ExtensionServer:D,get Events(){return N},ExtensionStatus:B});export{p as ExtensionAPI,E as ExtensionPanel,U as ExtensionServer,f as ExtensionView,v as HostUrlPattern,C as RecorderExtensionEndpoint,T as RecorderPluginManager};
@@ -0,0 +1 @@
1
+ import*as r from"./formatter.js";self.Formatter=self.Formatter||{},Formatter=Formatter||{},Formatter.FormatterWorkerPool=r.FormatterWorkerPool.FormatterWorkerPool,Formatter.formatterWorkerPool=r.FormatterWorkerPool.formatterWorkerPool,Formatter.FormatterSourceMapping=r.ScriptFormatter.FormatterSourceMapping;
@@ -0,0 +1 @@
1
+ import*as t from"../../core/common/common.js";import*as e from"../../core/platform/platform.js";const r=Math.min(2,navigator.hardwareConcurrency-1);let n;class s{taskQueue;workerTasks;constructor(){this.taskQueue=[],this.workerTasks=new Map}static instance(){return n||(n=new s),n}createWorker(){const e=t.Worker.WorkerWrapper.fromURL(new URL("../../entrypoints/formatter_worker/formatter_worker-entrypoint.js",import.meta.url));return e.onmessage=this.onWorkerMessage.bind(this,e),e.onerror=this.onWorkerError.bind(this,e),e}processNextTask(){if(!this.taskQueue.length)return;let t=[...this.workerTasks.keys()].find((t=>!this.workerTasks.get(t)));if(!t&&this.workerTasks.size<r&&(t=this.createWorker()),!t)return;const e=this.taskQueue.shift();e&&(this.workerTasks.set(t,e),t.postMessage({method:e.method,params:e.params}))}onWorkerMessage(t,e){const r=this.workerTasks.get(t);r&&(r.isChunked&&e.data&&!e.data.isLastChunk?r.callback(e.data):(this.workerTasks.set(t,null),this.processNextTask(),r.callback(e.data?e.data:null)))}onWorkerError(t,e){console.error(e);const r=this.workerTasks.get(t);t.terminate(),this.workerTasks.delete(t);const n=this.createWorker();this.workerTasks.set(n,null),this.processNextTask(),r&&r.callback(null)}runChunkedTask(t,e,r){const n=new i(t,e,(function(t){if(!t)return void r(!0,null);const e="isLastChunk"in t&&Boolean(t.isLastChunk),n="chunk"in t&&t.chunk;r(e,n)}),!0);this.taskQueue.push(n),this.processNextTask()}runTask(t,e){return new Promise((r=>{const n=new i(t,e,r,!1);this.taskQueue.push(n),this.processNextTask()}))}format(t,e,r){const n={mimeType:t,content:e,indentString:r};return this.runTask("format",n)}javaScriptSubstitute(t,e){return this.runTask("javaScriptSubstitute",{content:t,mapping:Array.from(e.entries())}).then((t=>t||""))}javaScriptScopeTree(t){return this.runTask("javaScriptScopeTree",{content:t}).then((t=>t||null))}evaluatableJavaScriptSubstring(t){return this.runTask("evaluatableJavaScriptSubstring",{content:t}).then((t=>t||""))}parseCSS(t,e){this.runChunkedTask("parseCSS",{content:t},(function(t,r){e(t,r||[])}))}}class i{method;params;callback;isChunked;constructor(t,e,r,n){this.method=t,this.params=e,this.callback=r,this.isChunked=n}}function o(){return s.instance()}var a=Object.freeze({__proto__:null,FormatterWorkerPool:s,formatterWorkerPool:o});function c(t,e,r){return(e?t[e-1]+1:0)+r}function u(t,r){const n=e.ArrayUtilities.upperBound(t,r-1,e.ArrayUtilities.DEFAULT_COMPARATOR);let s;return s=n?r-t[n-1]-1:r,[n,s]}async function h(r,n,s=t.Settings.Settings.instance().moduleSetting("textEditorIndent").get()){const i=n.replace(/\r\n?|[\n\u2028\u2029]/g,"\n").replace(/^\uFEFF/,""),a=o(),c=await a.format(r,i,s),u=e.StringUtilities.findLineEndingIndexes(i),h=e.StringUtilities.findLineEndingIndexes(c.content),k=new l(u,h,c.mapping);return{formattedContent:c.content,formattedMapping:k}}class k{originalToFormatted(t,e=0){return[t,e]}formattedToOriginal(t,e=0){return[t,e]}}class l{originalLineEndings;formattedLineEndings;mapping;constructor(t,e,r){this.originalLineEndings=t,this.formattedLineEndings=e,this.mapping=r}originalToFormatted(t,e){const r=c(this.originalLineEndings,t,e||0),n=this.convertPosition(this.mapping.original,this.mapping.formatted,r);return u(this.formattedLineEndings,n)}formattedToOriginal(t,e){const r=c(this.formattedLineEndings,t,e||0),n=this.convertPosition(this.mapping.formatted,this.mapping.original,r);return u(this.originalLineEndings,n)}convertPosition(t,r,n){const s=e.ArrayUtilities.upperBound(t,n,e.ArrayUtilities.DEFAULT_COMPARATOR)-1;let i=r[s]+n-t[s];return s<r.length-1&&i>r[s+1]&&(i=r[s+1]),i}}var p=Object.freeze({__proto__:null,format:async function(e,r,n,s=t.Settings.Settings.instance().moduleSetting("textEditorIndent").get()){return e.isDocumentOrScriptOrStyleSheet()?h(r,n,s):{formattedContent:n,formattedMapping:new k}},formatScriptContent:h});export{a as FormatterWorkerPool,p as ScriptFormatter};