@mcp-b/chrome-devtools-mcp 1.1.1 → 1.1.3

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 (658) hide show
  1. package/build/src/index.js +0 -0
  2. package/build/src/tools/webmcp.js +9 -0
  3. package/build/src/transports/WebMCPClientTransport.js +10 -6
  4. package/package.json +28 -20
  5. package/build/node_modules/chrome-devtools-frontend/LICENSE +0 -27
  6. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/App.js +0 -4
  7. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/AppProvider.js +0 -17
  8. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Base64.js +0 -43
  9. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/CharacterIdMap.js +0 -27
  10. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Color.js +0 -2033
  11. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ColorConverter.js +0 -332
  12. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ColorUtils.js +0 -221
  13. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Console.js +0 -79
  14. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Debouncer.js +0 -14
  15. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/EventTarget.js +0 -14
  16. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Gzip.js +0 -66
  17. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/JavaScriptMetaData.js +0 -4
  18. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Lazy.js +0 -29
  19. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/MapWithDefault.js +0 -22
  20. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Mutex.js +0 -49
  21. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Object.js +0 -86
  22. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ParsedURL.js +0 -449
  23. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Progress.js +0 -144
  24. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ResolverBase.js +0 -69
  25. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ResourceType.js +0 -495
  26. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ReturnToPanel.js +0 -15
  27. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Revealer.js +0 -164
  28. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Runnable.js +0 -24
  29. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/SegmentedRange.js +0 -78
  30. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/SettingRegistration.js +0 -164
  31. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Settings.js +0 -1263
  32. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/SimpleHistoryManager.js +0 -97
  33. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/StringOutputStream.js +0 -14
  34. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/TextDictionary.js +0 -40
  35. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Throttler.js +0 -71
  36. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Trie.js +0 -127
  37. package/build/node_modules/chrome-devtools-frontend/front_end/core/common/common.js +0 -41
  38. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/AidaClient.js +0 -434
  39. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/DispatchHttpRequestClient.js +0 -66
  40. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/GdpClient.js +0 -202
  41. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHost.js +0 -92
  42. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostAPI.js +0 -69
  43. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostStub.js +0 -430
  44. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/Platform.js +0 -61
  45. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/ResourceLoader.js +0 -220
  46. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/UserMetrics.js +0 -968
  47. package/build/node_modules/chrome-devtools-frontend/front_end/core/host/host.js +0 -13
  48. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/ByteUtilities.js +0 -72
  49. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/DevToolsLocale.js +0 -64
  50. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/NumberFormatter.js +0 -67
  51. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/collect-ui-strings.js +0 -73
  52. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/generate-locales-js.js +0 -51
  53. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/i18n.js +0 -9
  54. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/i18nImpl.js +0 -135
  55. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/i18nTypes.js +0 -4
  56. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/locales.js +0 -14
  57. package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/time-utilities.js +0 -148
  58. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/ArrayUtilities.js +0 -199
  59. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/Brand.js +0 -4
  60. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/Constructor.js +0 -4
  61. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/DateUtilities.js +0 -13
  62. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/DevToolsPath.js +0 -27
  63. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/HostRuntime.js +0 -19
  64. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/KeyboardUtilities.js +0 -21
  65. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/MapUtilities.js +0 -79
  66. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/MimeType.js +0 -143
  67. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/NumberUtilities.js +0 -72
  68. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/StringUtilities.js +0 -538
  69. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/Timing.js +0 -9
  70. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/TypedArrayUtilities.js +0 -157
  71. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/TypescriptUtilities.js +0 -24
  72. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/UIString.js +0 -4
  73. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/UserVisibleError.js +0 -22
  74. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/api/HostRuntime.js +0 -4
  75. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/api/api.js +0 -5
  76. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/browser/HostRuntime.js +0 -63
  77. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/browser/browser.js +0 -5
  78. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/node/HostRuntime.js +0 -72
  79. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/node/node.js +0 -5
  80. package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/platform.js +0 -26
  81. package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/CDPConnection.js +0 -17
  82. package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/ConnectionTransport.js +0 -12
  83. package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/DevToolsCDPConnection.js +0 -138
  84. package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/InspectorBackend.js +0 -539
  85. package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/protocol_client.js +0 -8
  86. package/build/node_modules/chrome-devtools-frontend/front_end/core/root/DevToolsContext.js +0 -54
  87. package/build/node_modules/chrome-devtools-frontend/front_end/core/root/Runtime.js +0 -11
  88. package/build/node_modules/chrome-devtools-frontend/front_end/core/root/root.js +0 -6
  89. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/AccessibilityModel.js +0 -281
  90. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/AnimationModel.js +0 -845
  91. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/AutofillModel.js +0 -155
  92. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CPUProfilerModel.js +0 -99
  93. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CPUThrottlingManager.js +0 -217
  94. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSContainerQuery.js +0 -98
  95. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSFontFace.js +0 -31
  96. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSLayer.js +0 -22
  97. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMatchedStyles.js +0 -1318
  98. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMedia.js +0 -100
  99. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMetadata.js +0 -1532
  100. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSModel.js +0 -908
  101. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSProperty.js +0 -312
  102. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParser.js +0 -574
  103. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParserMatchers.js +0 -1346
  104. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSQuery.js +0 -53
  105. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSRule.js +0 -403
  106. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSScope.js +0 -22
  107. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSStartingStyle.js +0 -21
  108. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSStyleDeclaration.js +0 -275
  109. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSStyleSheetHeader.js +0 -166
  110. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSSupports.js +0 -24
  111. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CategorizedBreakpoint.js +0 -29
  112. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ChildTargetManager.js +0 -236
  113. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CompilerSourceMappingContentProvider.js +0 -47
  114. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Connections.js +0 -205
  115. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ConsoleModel.js +0 -629
  116. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ConsoleModelTypes.js +0 -14
  117. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Cookie.js +0 -241
  118. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CookieModel.js +0 -198
  119. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CookieParser.js +0 -163
  120. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DOMDebuggerModel.js +0 -597
  121. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DOMModel.js +0 -1635
  122. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DebuggerModel.js +0 -1216
  123. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EmulationModel.js +0 -527
  124. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EnhancedTracesParser.js +0 -364
  125. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EventBreakpointsModel.js +0 -127
  126. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/FrameAssociated.js +0 -4
  127. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/FrameManager.js +0 -199
  128. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/HeapProfilerModel.js +0 -130
  129. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/HttpReasonPhraseStrings.js +0 -75
  130. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/IOModel.js +0 -80
  131. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/IsolateManager.js +0 -208
  132. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/IssuesModel.js +0 -41
  133. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/LayerTreeBase.js +0 -95
  134. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/LogModel.js +0 -34
  135. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkManager.js +0 -2223
  136. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkRequest.js +0 -1654
  137. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/OverlayColorGenerator.js +0 -48
  138. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/OverlayModel.js +0 -765
  139. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/OverlayPersistentHighlighter.js +0 -384
  140. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PageLoad.js +0 -25
  141. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PageResourceLoader.js +0 -310
  142. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PaintProfiler.js +0 -67
  143. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PerformanceMetricsModel.js +0 -62
  144. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PreloadingModel.js +0 -608
  145. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RehydratingConnection.js +0 -413
  146. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RehydratingObject.js +0 -4
  147. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RemoteObject.js +0 -908
  148. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Resource.js +0 -163
  149. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ResourceTreeModel.js +0 -923
  150. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RuntimeModel.js +0 -535
  151. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SDKModel.js +0 -45
  152. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ScopeTreeCache.js +0 -36
  153. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ScreenCaptureModel.js +0 -176
  154. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Script.js +0 -420
  155. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SecurityOriginManager.js +0 -54
  156. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServerSentEvents.js +0 -67
  157. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServerSentEventsProtocol.js +0 -113
  158. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServerTiming.js +0 -216
  159. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServiceWorkerCacheModel.js +0 -271
  160. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServiceWorkerManager.js +0 -511
  161. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMap.js +0 -691
  162. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapCache.js +0 -57
  163. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapFunctionRanges.js +0 -132
  164. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapManager.js +0 -201
  165. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapScopeChainEntry.js +0 -156
  166. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapScopesInfo.js +0 -508
  167. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/StorageBucketsModel.js +0 -143
  168. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/StorageKeyManager.js +0 -53
  169. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Target.js +0 -257
  170. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/TargetManager.js +0 -395
  171. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/TraceObject.js +0 -55
  172. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/WebAuthnModel.js +0 -66
  173. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/sdk-meta.js +0 -1166
  174. package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/sdk.js +0 -91
  175. package/build/node_modules/chrome-devtools-frontend/front_end/foundation/Universe.js +0 -34
  176. package/build/node_modules/chrome-devtools-frontend/front_end/foundation/foundation.js +0 -5
  177. package/build/node_modules/chrome-devtools-frontend/front_end/generated/ARIAProperties.js +0 -2640
  178. package/build/node_modules/chrome-devtools-frontend/front_end/generated/Deprecation.js +0 -384
  179. package/build/node_modules/chrome-devtools-frontend/front_end/generated/InspectorBackendCommands.js +0 -1532
  180. package/build/node_modules/chrome-devtools-frontend/front_end/generated/SupportedCSSProperties.js +0 -7602
  181. package/build/node_modules/chrome-devtools-frontend/front_end/generated/protocol.js +0 -4
  182. package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js +0 -289
  183. package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js +0 -995
  184. package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js +0 -664
  185. package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/UnitFormatters.js +0 -139
  186. package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AICallTree.js +0 -377
  187. package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIContext.js +0 -131
  188. package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIQueries.js +0 -149
  189. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CSSWorkspaceBinding.js +0 -245
  190. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CompilerScriptMapping.js +0 -486
  191. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ContentProviderBasedProject.js +0 -130
  192. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DebuggerLanguagePlugins.js +0 -992
  193. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DebuggerWorkspaceBinding.js +0 -592
  194. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DefaultScriptMapping.js +0 -112
  195. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/FileUtils.js +0 -186
  196. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/LiveLocation.js +0 -60
  197. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/NetworkProject.js +0 -107
  198. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/PresentationConsoleMessageHelper.js +0 -244
  199. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceMapping.js +0 -564
  200. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceScriptMapping.js +0 -437
  201. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceUtils.js +0 -87
  202. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/SASSSourceMapping.js +0 -182
  203. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/StylesSourceMapping.js +0 -268
  204. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/TempFile.js +0 -55
  205. package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/bindings.js +0 -20
  206. package/build/node_modules/chrome-devtools-frontend/front_end/models/cpu_profile/CPUProfileDataModel.js +0 -516
  207. package/build/node_modules/chrome-devtools-frontend/front_end/models/cpu_profile/ProfileTreeModel.js +0 -89
  208. package/build/node_modules/chrome-devtools-frontend/front_end/models/cpu_profile/cpu_profile.js +0 -6
  209. package/build/node_modules/chrome-devtools-frontend/front_end/models/crux-manager/CrUXManager.js +0 -285
  210. package/build/node_modules/chrome-devtools-frontend/front_end/models/crux-manager/crux-manager.js +0 -4
  211. package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/DeviceModeModel.js +0 -775
  212. package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/EmulatedDevices.js +0 -1706
  213. package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/emulation.js +0 -6
  214. package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/FormatterWorkerPool.js +0 -145
  215. package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/ScriptFormatter.js +0 -77
  216. package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/formatter.js +0 -6
  217. package/build/node_modules/chrome-devtools-frontend/front_end/models/geometry/GeometryImpl.js +0 -347
  218. package/build/node_modules/chrome-devtools-frontend/front_end/models/geometry/geometry.js +0 -4
  219. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/AttributionReportingIssue.js +0 -201
  220. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/BounceTrackingIssue.js +0 -49
  221. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/CheckFormsIssuesTrigger.js +0 -31
  222. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/ClientHintIssue.js +0 -71
  223. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/ContentSecurityPolicyIssue.js +0 -135
  224. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/ContrastCheckTrigger.js +0 -59
  225. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/CookieDeprecationMetadataIssue.js +0 -58
  226. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/CookieIssue.js +0 -514
  227. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/CorsIssue.js +0 -244
  228. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.js +0 -110
  229. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/DeprecationIssue.js +0 -90
  230. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/ElementAccessibilityIssue.js +0 -95
  231. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/FederatedAuthRequestIssue.js +0 -231
  232. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/FederatedAuthUserInfoRequestIssue.js +0 -141
  233. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/GenericIssue.js +0 -212
  234. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/HeavyAdIssue.js +0 -52
  235. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/Issue.js +0 -152
  236. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/IssueAggregator.js +0 -314
  237. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/IssueResolver.js +0 -40
  238. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/IssuesManager.js +0 -416
  239. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/IssuesManagerEvents.js +0 -4
  240. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/LowTextContrastIssue.js +0 -48
  241. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/MarkdownIssueDescription.js +0 -104
  242. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/MixedContentIssue.js +0 -55
  243. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/PartitioningBlobURLIssue.js +0 -58
  244. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/PropertyRuleIssue.js +0 -58
  245. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/QuirksModeIssue.js +0 -48
  246. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/RelatedIssue.js +0 -70
  247. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/SRIMessageSignatureIssue.js +0 -87
  248. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/SharedArrayBufferIssue.js +0 -49
  249. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/SharedDictionaryIssue.js +0 -292
  250. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/SourceFrameIssuesManager.js +0 -81
  251. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/StylesheetLoadingIssue.js +0 -59
  252. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/UnencodedDigestIssue.js +0 -62
  253. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +0 -4
  254. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/CoepCorpNotSameOrigin.md +0 -8
  255. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +0 -18
  256. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/CoepCorpNotSameSite.md +0 -7
  257. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/CoepFrameResourceNeedsCoepHeader.md +0 -10
  258. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/CompatibilityModeQuirks.md +0 -5
  259. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/CookieAttributeValueExceedsMaxSize.md +0 -5
  260. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/LowTextContrast.md +0 -5
  261. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
  262. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
  263. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
  264. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteInvalidSameParty.md +0 -8
  265. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureErrorRead.md +0 -8
  266. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureErrorSet.md +0 -8
  267. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureWarnRead.md +0 -8
  268. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureWarnSet.md +0 -8
  269. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteSamePartyCrossPartyContextSet.md +0 -10
  270. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +0 -9
  271. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +0 -9
  272. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
  273. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
  274. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
  275. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arInsecureContext.md +0 -7
  276. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arInvalidInfoHeader.md +0 -5
  277. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
  278. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
  279. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arInvalidRegisterSourceHeader.md +0 -5
  280. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arInvalidRegisterTriggerHeader.md +0 -5
  281. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
  282. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
  283. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arNoRegisterOsSourceHeader.md +0 -5
  284. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arNoRegisterOsTriggerHeader.md +0 -5
  285. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arNoRegisterSourceHeader.md +0 -5
  286. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arNoRegisterTriggerHeader.md +0 -5
  287. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arNoWebOrOsSupport.md +0 -4
  288. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arOsSourceIgnored.md +0 -18
  289. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arOsTriggerIgnored.md +0 -19
  290. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md +0 -8
  291. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arSourceAndTriggerHeaders.md +0 -9
  292. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arSourceIgnored.md +0 -13
  293. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arTriggerIgnored.md +0 -12
  294. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arUntrustworthyReportingOrigin.md +0 -10
  295. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/arWebAndOsHeaders.md +0 -11
  296. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/bounceTrackingMitigations.md +0 -3
  297. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +0 -4
  298. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +0 -4
  299. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieCrossSiteRedirectDowngrade.md +0 -12
  300. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +0 -4
  301. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieExcludeDomainNonAscii.md +0 -11
  302. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieExcludePortMismatch.md +0 -8
  303. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieExcludeSchemeMismatch.md +0 -7
  304. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieExcludeThirdPartyPhaseoutRead.md +0 -6
  305. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieExcludeThirdPartyPhaseoutSet.md +0 -6
  306. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieWarnDomainNonAscii.md +0 -11
  307. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieWarnMetadataGrantRead.md +0 -4
  308. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieWarnMetadataGrantSet.md +0 -4
  309. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieWarnThirdPartyPhaseoutRead.md +0 -6
  310. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cookieWarnThirdPartyPhaseoutSet.md +0 -6
  311. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsAllowCredentialsRequired.md +0 -6
  312. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsDisabledScheme.md +0 -7
  313. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsDisallowedByMode.md +0 -7
  314. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsHeaderDisallowedByPreflightResponse.md +0 -5
  315. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsInsecurePrivateNetwork.md +0 -10
  316. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsInvalidHeaderValues.md +0 -7
  317. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsLocalNetworkAccessPermissionDenied.md +0 -19
  318. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsMethodDisallowedByPreflightResponse.md +0 -5
  319. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsNoCorsRedirectModeNotFollow.md +0 -5
  320. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsOriginMismatch.md +0 -6
  321. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsPreflightAllowPrivateNetworkError.md +0 -10
  322. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsPreflightResponseInvalid.md +0 -5
  323. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsPrivateNetworkPermissionDenied.md +0 -10
  324. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsRedirectContainsCredentials.md +0 -5
  325. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/corsWildcardOriginNotAllowed.md +0 -8
  326. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cspEvalViolation.md +0 -9
  327. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cspInlineViolation.md +0 -10
  328. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cspTrustedTypesPolicyViolation.md +0 -5
  329. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cspTrustedTypesSinkViolation.md +0 -8
  330. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/cspURLViolation.md +0 -10
  331. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/deprecation.md +0 -3
  332. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsHttpNotFound.md +0 -1
  333. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsInvalidResponse.md +0 -1
  334. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsNoResponse.md +0 -1
  335. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestApprovalDeclined.md +0 -1
  336. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestCanceled.md +0 -1
  337. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataHttpNotFound.md +0 -1
  338. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataInvalidResponse.md +0 -1
  339. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataNoResponse.md +0 -1
  340. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorFetchingSignin.md +0 -1
  341. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorIdToken.md +0 -1
  342. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenHttpNotFound.md +0 -1
  343. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidRequest.md +0 -1
  344. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidResponse.md +0 -1
  345. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenNoResponse.md +0 -1
  346. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestInvalidSigninResponse.md +0 -1
  347. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestHttpNotFound.md +0 -1
  348. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestInvalidResponse.md +0 -1
  349. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestNoResponse.md +0 -1
  350. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthRequestTooManyRequests.md +0 -1
  351. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +0 -1
  352. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +0 -1
  353. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +0 -1
  354. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoApiPermission.md +0 -1
  355. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +0 -1
  356. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotIframe.md +0 -1
  357. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +0 -1
  358. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +0 -1
  359. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +0 -1
  360. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/fetchingPartitionedBlobURL.md +0 -7
  361. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormAriaLabelledByToNonExistingIdError.md +0 -8
  362. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormAutocompleteAttributeEmptyError.md +0 -5
  363. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormDuplicateIdForInputError.md +0 -5
  364. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +0 -5
  365. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +0 -5
  366. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +0 -5
  367. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormInputWithNoLabelError.md +0 -5
  368. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormLabelForMatchesNonExistingIdError.md +0 -5
  369. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormLabelForNameError.md +0 -5
  370. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +0 -5
  371. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericNavigationEntryMarkedSkippable.md +0 -7
  372. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/genericResponseWasBlockedByORB.md +0 -4
  373. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/heavyAd.md +0 -10
  374. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/mixedContent.md +0 -5
  375. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/navigatingPartitionedBlobURL.md +0 -5
  376. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/placeholderDescriptionForInvisibleIssues.md +0 -3
  377. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/propertyRuleInvalidNameIssue.md +0 -3
  378. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/propertyRuleIssue.md +0 -7
  379. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +0 -7
  380. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/selectElementAccessibilityDisallowedSelectChild.md +0 -7
  381. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +0 -3
  382. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +0 -3
  383. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +0 -3
  384. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +0 -3
  385. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedArrayBuffer.md +0 -7
  386. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -1
  387. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +0 -3
  388. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +0 -3
  389. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +0 -1
  390. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +0 -1
  391. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +0 -1
  392. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorExpiredResponse.md +0 -3
  393. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +0 -3
  394. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorInsufficientResources.md +0 -1
  395. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +0 -1
  396. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +0 -1
  397. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +0 -1
  398. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNavigationRequest.md +0 -3
  399. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNoMatchField.md +0 -1
  400. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +0 -1
  401. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +0 -1
  402. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonSecureContext.md +0 -3
  403. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonStringIdField.md +0 -1
  404. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +0 -1
  405. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +0 -1
  406. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +0 -1
  407. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorRequestAborted.md +0 -1
  408. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorShuttingDown.md +0 -1
  409. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorTooLongIdField.md +0 -3
  410. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorUnsupportedType.md +0 -3
  411. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriInvalidSignatureHeader.md +0 -14
  412. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriInvalidSignatureInputHeader.md +0 -15
  413. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriMissingSignatureHeader.md +0 -8
  414. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriMissingSignatureInputHeader.md +0 -7
  415. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureHeaderValueIsIncorrectLength.md +0 -11
  416. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureHeaderValueIsNotByteSequence.md +0 -14
  417. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureHeaderValueIsParameterized.md +0 -15
  418. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderInvalidComponentName.md +0 -8
  419. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderInvalidComponentType.md +0 -13
  420. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +0 -4
  421. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +0 -5
  422. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderInvalidParameter.md +0 -11
  423. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderKeyIdLength.md +0 -12
  424. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderMissingLabel.md +0 -6
  425. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +0 -8
  426. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderValueMissingComponents.md +0 -11
  427. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriSignatureInputHeaderValueNotInnerList.md +0 -11
  428. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriValidationFailedIntegrityMismatch.md +0 -10
  429. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriValidationFailedInvalidLength.md +0 -5
  430. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriValidationFailedSignatureExpired.md +0 -6
  431. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/sriValidationFailedSignatureMismatch.md +0 -11
  432. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/stylesheetLateImport.md +0 -4
  433. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/stylesheetRequestFailed.md +0 -3
  434. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +0 -3
  435. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/unencodedDigestIncorrectDigestLength.md +0 -12
  436. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/unencodedDigestIncorrectDigestType.md +0 -17
  437. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/unencodedDigestMalformedDictionary.md +0 -14
  438. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/descriptions/unencodedDigestUnknownAlgorithm.md +0 -15
  439. package/build/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/issues_manager.js +0 -35
  440. package/build/node_modules/chrome-devtools-frontend/front_end/models/logs/LogManager.js +0 -67
  441. package/build/node_modules/chrome-devtools-frontend/front_end/models/logs/NetworkLog.js +0 -494
  442. package/build/node_modules/chrome-devtools-frontend/front_end/models/logs/RequestResolver.js +0 -49
  443. package/build/node_modules/chrome-devtools-frontend/front_end/models/logs/logs-meta.js +0 -73
  444. package/build/node_modules/chrome-devtools-frontend/front_end/models/logs/logs.js +0 -7
  445. package/build/node_modules/chrome-devtools-frontend/front_end/models/network_time_calculator/Calculator.js +0 -4
  446. package/build/node_modules/chrome-devtools-frontend/front_end/models/network_time_calculator/NetworkTimeCalculator.js +0 -256
  447. package/build/node_modules/chrome-devtools-frontend/front_end/models/network_time_calculator/RequestTimeRanges.js +0 -122
  448. package/build/node_modules/chrome-devtools-frontend/front_end/models/network_time_calculator/network_time_calculator.js +0 -6
  449. package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/FunctionCodeResolver.js +0 -192
  450. package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/NamesResolver.js +0 -622
  451. package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/ScopeChainModel.js +0 -59
  452. package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/source_map_scopes.js +0 -7
  453. package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTrace.js +0 -4
  454. package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceImpl.js +0 -67
  455. package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceModel.js +0 -97
  456. package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/Trie.js +0 -121
  457. package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/stack_trace.js +0 -5
  458. package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/stack_trace_impl.js +0 -7
  459. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/CodeMirrorUtils.js +0 -32
  460. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/ContentData.js +0 -173
  461. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/ContentProvider.js +0 -30
  462. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/StaticContentProvider.js +0 -32
  463. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/StreamingContentData.js +0 -79
  464. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/Text.js +0 -69
  465. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/TextCursor.js +0 -35
  466. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/TextRange.js +0 -231
  467. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/TextUtils.js +0 -355
  468. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/WasmDisassembly.js +0 -68
  469. package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/text_utils.js +0 -14
  470. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/EntityMapper.js +0 -122
  471. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/EventsSerializer.js +0 -81
  472. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/LanternComputationData.js +0 -371
  473. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/ModelImpl.js +0 -169
  474. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Name.js +0 -114
  475. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Processor.js +0 -555
  476. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Styles.js +0 -815
  477. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/FilmStrip.js +0 -44
  478. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/MainThreadActivity.js +0 -76
  479. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/ScriptDuplication.js +0 -162
  480. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/StackTraceForEvent.js +0 -191
  481. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/ThirdParties.js +0 -118
  482. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/TraceFilter.js +0 -50
  483. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/TraceTree.js +0 -599
  484. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/extras.js +0 -10
  485. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/AnimationFramesHandler.js +0 -109
  486. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/AnimationHandler.js +0 -26
  487. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/AsyncJSCallsHandler.js +0 -187
  488. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/AuctionWorkletsHandler.js +0 -162
  489. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/DOMStatsHandler.js +0 -21
  490. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ExtensionTraceDataHandler.js +0 -263
  491. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/FlowsHandler.js +0 -148
  492. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/FramesHandler.js +0 -485
  493. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/GPUHandler.js +0 -35
  494. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ImagePaintingHandler.js +0 -147
  495. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/InitiatorsHandler.js +0 -180
  496. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/InvalidationsHandler.js +0 -126
  497. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LargestImagePaintHandler.js +0 -85
  498. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LargestTextPaintHandler.js +0 -27
  499. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LayerTreeHandler.js +0 -103
  500. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LayoutShiftsHandler.js +0 -449
  501. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/MemoryHandler.js +0 -21
  502. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/MetaHandler.js +0 -404
  503. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ModelHandlers.js +0 -33
  504. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/NetworkRequestsHandler.js +0 -566
  505. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/PageFramesHandler.js +0 -42
  506. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/PageLoadMetricsHandler.js +0 -349
  507. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/RendererHandler.js +0 -346
  508. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/SamplesHandler.js +0 -260
  509. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ScreenshotsHandler.js +0 -97
  510. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ScriptsHandler.js +0 -276
  511. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/SelectorStatsHandler.js +0 -71
  512. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/Threads.js +0 -101
  513. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/UserInteractionsHandler.js +0 -317
  514. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/UserTimingsHandler.js +0 -183
  515. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/WarningsHandler.js +0 -134
  516. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/WorkersHandler.js +0 -33
  517. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/handlers.js +0 -7
  518. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/helpers.js +0 -163
  519. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/types.js +0 -1
  520. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Extensions.js +0 -41
  521. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Network.js +0 -102
  522. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/SamplesIntegrator.js +0 -495
  523. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/SyntheticEvents.js +0 -74
  524. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Timing.js +0 -186
  525. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Trace.js +0 -820
  526. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/TreeHelpers.js +0 -254
  527. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/helpers.js +0 -10
  528. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/CLSCulprits.js +0 -489
  529. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Cache.js +0 -209
  530. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Common.js +0 -340
  531. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DOMSize.js +0 -181
  532. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DocumentLatency.js +0 -258
  533. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DuplicatedJavaScript.js +0 -90
  534. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/FontDisplay.js +0 -82
  535. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ForcedReflow.js +0 -161
  536. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/INPBreakdown.js +0 -129
  537. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ImageDelivery.js +0 -263
  538. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPBreakdown.js +0 -199
  539. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPDiscovery.js +0 -183
  540. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LegacyJavaScript.js +0 -90
  541. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Models.js +0 -21
  542. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ModernHTTP.js +0 -200
  543. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/NetworkDependencyTree.js +0 -545
  544. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/RenderBlocking.js +0 -192
  545. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/SlowCSSSelector.js +0 -136
  546. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Statistics.js +0 -92
  547. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ThirdParties.js +0 -98
  548. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Viewport.js +0 -102
  549. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/insights.js +0 -9
  550. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/types.js +0 -18
  551. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/core/LanternError.js +0 -6
  552. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/core/NetworkAnalyzer.js +0 -488
  553. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/core/core.js +0 -5
  554. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/graph/BaseNode.js +0 -276
  555. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/graph/CPUNode.js +0 -63
  556. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/graph/NetworkNode.js +0 -82
  557. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/graph/PageDependencyGraph.js +0 -551
  558. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/graph/graph.js +0 -7
  559. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/lantern.js +0 -9
  560. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/FirstContentfulPaint.js +0 -136
  561. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/Interactive.js +0 -67
  562. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/LargestContentfulPaint.js +0 -68
  563. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/MaxPotentialFID.js +0 -48
  564. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/Metric.js +0 -68
  565. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/SpeedIndex.js +0 -101
  566. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/TBTUtils.js +0 -64
  567. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/TotalBlockingTime.js +0 -78
  568. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/metrics/metrics.js +0 -11
  569. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/simulation/ConnectionPool.js +0 -115
  570. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/simulation/Constants.js +0 -42
  571. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/simulation/DNSCache.js +0 -47
  572. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/simulation/SimulationTimingMap.js +0 -134
  573. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/simulation/Simulator.js +0 -450
  574. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/simulation/TCPConnection.js +0 -154
  575. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/simulation/simulation.js +0 -9
  576. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/types/Lantern.js +0 -24
  577. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/lantern/types/types.js +0 -4
  578. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/trace.js +0 -17
  579. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/Configuration.js +0 -18
  580. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/Extensions.js +0 -37
  581. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/File.js +0 -57
  582. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/Overlays.js +0 -4
  583. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/Timing.js +0 -15
  584. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/TraceEvents.js +0 -580
  585. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/types.js +0 -9
  586. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace_source_maps_resolver/SourceMapsResolver.js +0 -224
  587. package/build/node_modules/chrome-devtools-frontend/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.js +0 -4
  588. package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/FileManager.js +0 -64
  589. package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/IgnoreListManager.js +0 -504
  590. package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/SearchConfig.js +0 -113
  591. package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/UISourceCode.js +0 -601
  592. package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/WorkspaceImpl.js +0 -201
  593. package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/workspace-meta.js +0 -34
  594. package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/workspace.js +0 -9
  595. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/codemirror.next/codemirror.next.js +0 -1
  596. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/i18n/LICENSE +0 -202
  597. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/i18n/i18n-impl.js +0 -46
  598. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/i18n/i18n.js +0 -6
  599. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/i18n/localized-string-set.js +0 -122
  600. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/LICENSE +0 -33
  601. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/intl-messageformat.js +0 -5
  602. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/index.js +0 -13
  603. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +0 -1725
  604. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +0 -1840
  605. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/lib/index.js +0 -10
  606. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/lib/src/core.js +0 -233
  607. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/lib/src/error.js +0 -48
  608. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +0 -177
  609. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/src/core.js +0 -236
  610. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/src/error.js +0 -51
  611. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/intl-messageformat/package/src/formatters.js +0 -182
  612. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/legacy-javascript/LICENSE +0 -202
  613. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/legacy-javascript/legacy-javascript.js +0 -2
  614. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +0 -940
  615. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/LICENSE +0 -39
  616. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/marked.js +0 -2
  617. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/bin/main.js +0 -255
  618. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/bin/marked.js +0 -11
  619. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/lib/marked.esm.js +0 -2695
  620. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/lib/marked.js +0 -2233
  621. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/lib/marked.umd.js +0 -2719
  622. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/Lexer.js +0 -453
  623. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/Parser.js +0 -233
  624. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/Renderer.js +0 -137
  625. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/Slugger.js +0 -46
  626. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/TextRenderer.js +0 -34
  627. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/Tokenizer.js +0 -683
  628. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/defaults.js +0 -27
  629. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/helpers.js +0 -240
  630. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/marked.js +0 -318
  631. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/marked/package/src/rules.js +0 -243
  632. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/LICENSE +0 -26
  633. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +0 -196
  634. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -226
  635. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -4
  636. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -394
  637. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -24
  638. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -283
  639. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -7
  640. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -9
  641. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -84
  642. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/source-map-scopes-codec/source-map-scopes-codec.js +0 -4
  643. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/LICENSE +0 -20
  644. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/lib/nostats-subset.js +0 -146
  645. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +0 -2
  646. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/httparchive-subset.js +0 -2
  647. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +0 -118
  648. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +0 -40
  649. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/entities.test.js +0 -26
  650. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/index.js +0 -4
  651. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/index.test.js +0 -215
  652. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +0 -4
  653. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +0 -4
  654. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +0 -4
  655. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/package/nostats-subset.js +0 -2
  656. package/build/node_modules/chrome-devtools-frontend/front_end/third_party/third-party-web/third-party-web.js +0 -2
  657. package/build/node_modules/chrome-devtools-frontend/mcp/HostBindings.js +0 -222
  658. package/build/node_modules/chrome-devtools-frontend/mcp/mcp.js +0 -35
@@ -1,2033 +0,0 @@
1
- // Copyright 2021 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
- /*
5
- * Copyright (C) 2009 Apple Inc. All rights reserved.
6
- * Copyright (C) 2009 Joseph Pecoraro
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions
10
- * are met:
11
- *
12
- * 1. Redistributions of source code must retain the above copyright
13
- * notice, this list of conditions and the following disclaimer.
14
- * 2. Redistributions in binary form must reproduce the above copyright
15
- * notice, this list of conditions and the following disclaimer in the
16
- * documentation and/or other materials provided with the distribution.
17
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
18
- * its contributors may be used to endorse or promote products derived
19
- * from this software without specific prior written permission.
20
- *
21
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
22
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
25
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- */
32
- import * as Platform from '../platform/platform.js';
33
- import { ColorConverter } from './ColorConverter.js';
34
- import { blendColors, contrastRatioAPCA, desiredLuminanceAPCA, luminance, luminanceAPCA, rgbToHsl, rgbToHwb, } from './ColorUtils.js';
35
- /**
36
- * <hue> is defined as a <number> or <angle>
37
- * and we hold this in degrees. However, after
38
- * the conversions, these degrees can result in
39
- * negative values. That's why we normalize the hue to be
40
- * between [0 - 360].
41
- **/
42
- function normalizeHue(hue) {
43
- // Even though it is highly unlikely, hue can be
44
- // very negative like -400. The initial modulo
45
- // operation makes sure that the if the number is
46
- // negative, it is between [-360, 0].
47
- return ((hue % 360) + 360) % 360;
48
- }
49
- /**
50
- * Parses angle in the form of
51
- * `<angle>deg`, `<angle>turn`, `<angle>grad and `<angle>rad`
52
- * and returns the canonicalized `degree`.
53
- **/
54
- function parseAngle(angleText) {
55
- const angle = angleText.replace(/(deg|g?rad|turn)$/, '');
56
- // @ts-expect-error: isNaN can accept strings
57
- if (isNaN(angle) || angleText.match(/\s+(deg|g?rad|turn)/)) {
58
- return null;
59
- }
60
- const number = parseFloat(angle);
61
- if (angleText.includes('turn')) {
62
- // 1turn === 360deg
63
- return number * 360;
64
- }
65
- if (angleText.includes('grad')) {
66
- // 1grad === 0.9deg
67
- return number * 9 / 10;
68
- }
69
- if (angleText.includes('rad')) {
70
- // πrad === 180deg
71
- return number * 180 / Math.PI;
72
- }
73
- // 1deg === 1deg ^_^
74
- return number;
75
- }
76
- /** Returns the `Format` equivalent from the format text **/
77
- export function getFormat(formatText) {
78
- switch (formatText) {
79
- case "hex" /* Format.HEX */:
80
- return "hex" /* Format.HEX */;
81
- case "hexa" /* Format.HEXA */:
82
- return "hexa" /* Format.HEXA */;
83
- case "rgb" /* Format.RGB */:
84
- return "rgb" /* Format.RGB */;
85
- case "rgba" /* Format.RGBA */:
86
- return "rgba" /* Format.RGBA */;
87
- case "hsl" /* Format.HSL */:
88
- return "hsl" /* Format.HSL */;
89
- case "hsla" /* Format.HSLA */:
90
- return "hsla" /* Format.HSLA */;
91
- case "hwb" /* Format.HWB */:
92
- return "hwb" /* Format.HWB */;
93
- case "hwba" /* Format.HWBA */:
94
- return "hwba" /* Format.HWBA */;
95
- case "lch" /* Format.LCH */:
96
- return "lch" /* Format.LCH */;
97
- case "oklch" /* Format.OKLCH */:
98
- return "oklch" /* Format.OKLCH */;
99
- case "lab" /* Format.LAB */:
100
- return "lab" /* Format.LAB */;
101
- case "oklab" /* Format.OKLAB */:
102
- return "oklab" /* Format.OKLAB */;
103
- }
104
- return getColorSpace(formatText);
105
- }
106
- function getColorSpace(colorSpaceText) {
107
- switch (colorSpaceText) {
108
- case "srgb" /* Format.SRGB */:
109
- return "srgb" /* Format.SRGB */;
110
- case "srgb-linear" /* Format.SRGB_LINEAR */:
111
- return "srgb-linear" /* Format.SRGB_LINEAR */;
112
- case "display-p3" /* Format.DISPLAY_P3 */:
113
- return "display-p3" /* Format.DISPLAY_P3 */;
114
- case "a98-rgb" /* Format.A98_RGB */:
115
- return "a98-rgb" /* Format.A98_RGB */;
116
- case "prophoto-rgb" /* Format.PROPHOTO_RGB */:
117
- return "prophoto-rgb" /* Format.PROPHOTO_RGB */;
118
- case "rec2020" /* Format.REC_2020 */:
119
- return "rec2020" /* Format.REC_2020 */;
120
- case "xyz" /* Format.XYZ */:
121
- return "xyz" /* Format.XYZ */;
122
- case "xyz-d50" /* Format.XYZ_D50 */:
123
- return "xyz-d50" /* Format.XYZ_D50 */;
124
- case "xyz-d65" /* Format.XYZ_D65 */:
125
- return "xyz-d65" /* Format.XYZ_D65 */;
126
- }
127
- return null;
128
- }
129
- /**
130
- * Percents in color spaces are mapped to ranges.
131
- * These ranges change based on the syntax.
132
- * For example, for 'C' in lch() c: 0% = 0, 100% = 150.
133
- * See: https://www.w3.org/TR/css-color-4/#funcdef-lch
134
- * Some percentage values can be negative
135
- * though their ranges don't change depending on the sign
136
- * (for now, according to spec).
137
- * @param percent % value of the number. 42 for 42%.
138
- * @param range Range of [min, max]. Including `min` and `max`.
139
- */
140
- function mapPercentToRange(percent, range) {
141
- const sign = Math.sign(percent);
142
- const absPercent = Math.abs(percent);
143
- const [outMin, outMax] = range;
144
- return sign * (absPercent * (outMax - outMin) / 100 + outMin);
145
- }
146
- export function parse(text) {
147
- // #hex, nickname
148
- if (!text.match(/\s/)) {
149
- const match = text.toLowerCase().match(/^(?:#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(\w+))$/i);
150
- if (match) {
151
- if (match[1]) {
152
- return Legacy.fromHex(match[1], text);
153
- }
154
- if (match[2]) {
155
- return Nickname.fromName(match[2], text);
156
- }
157
- return null;
158
- }
159
- }
160
- // rgb/rgba(), hsl/hsla(), hwb/hwba(), lch(), oklch(), lab(), oklab() and color()
161
- const match = text.toLowerCase().match(/^\s*(?:(rgba?)|(hsla?)|(hwba?)|(lch)|(oklch)|(lab)|(oklab)|(color))\((.*)\)\s*$/);
162
- if (match) {
163
- const isRgbaMatch = Boolean(match[1]); // rgb/rgba()
164
- const isHslaMatch = Boolean(match[2]); // hsl/hsla()
165
- const isHwbaMatch = Boolean(match[3]); // hwb/hwba()
166
- const isLchMatch = Boolean(match[4]); // lch()
167
- const isOklchMatch = Boolean(match[5]); // oklch()
168
- const isLabMatch = Boolean(match[6]); // lab()
169
- const isOklabMatch = Boolean(match[7]); // oklab()
170
- const isColorMatch = Boolean(match[8]); // color()
171
- const valuesText = match[9];
172
- // Parse color function first because extracting values for
173
- // this function is not the same as the other ones
174
- // so, we're not using any of the logic below.
175
- if (isColorMatch) {
176
- return ColorFunction.fromSpec(text, valuesText);
177
- }
178
- const isOldSyntax = isRgbaMatch || isHslaMatch || isHwbaMatch;
179
- const allowCommas = isRgbaMatch || isHslaMatch;
180
- const convertNoneToZero = !isOldSyntax; // Convert 'none' keyword to zero in new syntaxes
181
- const values = splitColorFunctionParameters(valuesText, { allowCommas, convertNoneToZero });
182
- if (!values) {
183
- return null;
184
- }
185
- const spec = [values[0], values[1], values[2], values[3]];
186
- if (isRgbaMatch) {
187
- return Legacy.fromRGBAFunction(values[0], values[1], values[2], values[3], text);
188
- }
189
- if (isHslaMatch) {
190
- return HSL.fromSpec(spec, text);
191
- }
192
- if (isHwbaMatch) {
193
- return HWB.fromSpec(spec, text);
194
- }
195
- if (isLchMatch) {
196
- return LCH.fromSpec(spec, text);
197
- }
198
- if (isOklchMatch) {
199
- return Oklch.fromSpec(spec, text);
200
- }
201
- if (isLabMatch) {
202
- return Lab.fromSpec(spec, text);
203
- }
204
- if (isOklabMatch) {
205
- return Oklab.fromSpec(spec, text);
206
- }
207
- }
208
- return null;
209
- }
210
- /**
211
- * Split the color parameters of (e.g.) rgb(a), hsl(a), hwb(a) functions.
212
- */
213
- function splitColorFunctionParameters(content, { allowCommas, convertNoneToZero }) {
214
- const components = content.trim();
215
- let values = [];
216
- if (allowCommas) {
217
- values = components.split(/\s*,\s*/);
218
- }
219
- if (!allowCommas || values.length === 1) {
220
- values = components.split(/\s+/);
221
- if (values[3] === '/') {
222
- values.splice(3, 1);
223
- if (values.length !== 4) {
224
- return null;
225
- }
226
- }
227
- else if ((values.length > 2 && values[2].indexOf('/') !== -1) || (values.length > 3 && values[3].indexOf('/') !== -1)) {
228
- const alpha = values.slice(2, 4).join('');
229
- values = values.slice(0, 2).concat(alpha.split(/\//)).concat(values.slice(4));
230
- }
231
- else if (values.length >= 4) {
232
- return null;
233
- }
234
- }
235
- if (values.length !== 3 && values.length !== 4 || values.indexOf('') > -1) {
236
- return null;
237
- }
238
- // Question: what should we do with `alpha` being none?
239
- if (convertNoneToZero) {
240
- return values.map(value => value === 'none' ? '0' : value);
241
- }
242
- return values;
243
- }
244
- function clamp(value, { min, max }) {
245
- if (value === null) {
246
- return value;
247
- }
248
- if (min !== undefined) {
249
- value = Math.max(value, min);
250
- }
251
- if (max !== undefined) {
252
- value = Math.min(value, max);
253
- }
254
- return value;
255
- }
256
- function parsePercentage(value, range) {
257
- if (!value.endsWith('%')) {
258
- return null;
259
- }
260
- const percentage = parseFloat(value.substr(0, value.length - 1));
261
- return isNaN(percentage) ? null : mapPercentToRange(percentage, range);
262
- }
263
- function parseNumber(value) {
264
- const number = parseFloat(value);
265
- return isNaN(number) ? null : number;
266
- }
267
- function parseAlpha(value) {
268
- if (value === undefined) {
269
- return null;
270
- }
271
- return clamp(parsePercentage(value, [0, 1]) ?? parseNumber(value), { min: 0, max: 1 });
272
- }
273
- /**
274
- *
275
- * @param value Text value to be parsed in the form of 'number|percentage'.
276
- * @param range Range to map the percentage.
277
- * @returns If it is not percentage, returns number directly; otherwise,
278
- * maps the percentage to the range. For example:
279
- * - 30% in range [0, 100] is 30
280
- * - 20% in range [0, 1] is 0.5
281
- */
282
- function parsePercentOrNumber(value, range = [0, 1]) {
283
- // @ts-expect-error: isNaN can accept strings
284
- if (isNaN(value.replace('%', ''))) {
285
- return null;
286
- }
287
- const parsed = parseFloat(value);
288
- if (value.indexOf('%') !== -1) {
289
- if (value.indexOf('%') !== value.length - 1) {
290
- return null;
291
- }
292
- return mapPercentToRange(parsed, range);
293
- }
294
- return parsed;
295
- }
296
- function parseRgbNumeric(value) {
297
- const parsed = parsePercentOrNumber(value);
298
- if (parsed === null) {
299
- return null;
300
- }
301
- if (value.indexOf('%') !== -1) {
302
- return parsed;
303
- }
304
- return parsed / 255;
305
- }
306
- export function parseHueNumeric(value) {
307
- const angle = value.replace(/(deg|g?rad|turn)$/, '');
308
- // @ts-expect-error: isNaN can accept strings
309
- if (isNaN(angle) || value.match(/\s+(deg|g?rad|turn)/)) {
310
- return null;
311
- }
312
- const number = parseFloat(angle);
313
- if (value.indexOf('turn') !== -1) {
314
- return number % 1;
315
- }
316
- if (value.indexOf('grad') !== -1) {
317
- return (number / 400) % 1;
318
- }
319
- if (value.indexOf('rad') !== -1) {
320
- return (number / (2 * Math.PI)) % 1;
321
- }
322
- return (number / 360) % 1;
323
- }
324
- function parseSatLightNumeric(value) {
325
- // @ts-expect-error: isNaN can accept strings
326
- if (value.indexOf('%') !== value.length - 1 || isNaN(value.replace('%', ''))) {
327
- return null;
328
- }
329
- const parsed = parseFloat(value);
330
- return parsed / 100;
331
- }
332
- function parseAlphaNumeric(value) {
333
- return parsePercentOrNumber(value);
334
- }
335
- function hsva2hsla(hsva) {
336
- const h = hsva[0];
337
- let s = hsva[1];
338
- const v = hsva[2];
339
- const t = (2 - s) * v;
340
- if (v === 0 || s === 0) {
341
- s = 0;
342
- }
343
- else {
344
- s *= v / (t < 1 ? t : 2 - t);
345
- }
346
- return [h, s, t / 2, hsva[3]];
347
- }
348
- export function hsl2rgb(hsl) {
349
- const h = hsl[0];
350
- let s = hsl[1];
351
- const l = hsl[2];
352
- function hue2rgb(p, q, h) {
353
- if (h < 0) {
354
- h += 1;
355
- }
356
- else if (h > 1) {
357
- h -= 1;
358
- }
359
- if ((h * 6) < 1) {
360
- return p + (q - p) * h * 6;
361
- }
362
- if ((h * 2) < 1) {
363
- return q;
364
- }
365
- if ((h * 3) < 2) {
366
- return p + (q - p) * ((2 / 3) - h) * 6;
367
- }
368
- return p;
369
- }
370
- if (s < 0) {
371
- s = 0;
372
- }
373
- let q;
374
- if (l <= 0.5) {
375
- q = l * (1 + s);
376
- }
377
- else {
378
- q = l + s - (l * s);
379
- }
380
- const p = 2 * l - q;
381
- const tr = h + (1 / 3);
382
- const tg = h;
383
- const tb = h - (1 / 3);
384
- return [hue2rgb(p, q, tr), hue2rgb(p, q, tg), hue2rgb(p, q, tb), hsl[3]];
385
- }
386
- function hwb2rgb(hwb) {
387
- const h = hwb[0];
388
- const w = hwb[1];
389
- const b = hwb[2];
390
- const whiteRatio = w / (w + b);
391
- let result = [whiteRatio, whiteRatio, whiteRatio, hwb[3]];
392
- if (w + b < 1) {
393
- result = hsl2rgb([h, 1, 0.5, hwb[3]]);
394
- for (let i = 0; i < 3; ++i) {
395
- result[i] += w - (w + b) * result[i];
396
- }
397
- }
398
- return result;
399
- }
400
- export function hsva2rgba(hsva) {
401
- return hsl2rgb(hsva2hsla(hsva));
402
- }
403
- export function rgb2hsv(rgba) {
404
- const hsla = rgbToHsl(rgba);
405
- const h = hsla[0];
406
- let s = hsla[1];
407
- const l = hsla[2];
408
- s *= l < 0.5 ? l : 1 - l;
409
- return [h, s !== 0 ? 2 * s / (l + s) : 0, (l + s)];
410
- }
411
- /**
412
- * Compute a desired luminance given a given luminance and a desired contrast
413
- * ratio.
414
- */
415
- export function desiredLuminance(luminance, contrast, lighter) {
416
- function computeLuminance() {
417
- if (lighter) {
418
- return (luminance + 0.05) * contrast - 0.05;
419
- }
420
- return (luminance + 0.05) / contrast - 0.05;
421
- }
422
- let desiredLuminance = computeLuminance();
423
- if (desiredLuminance < 0 || desiredLuminance > 1) {
424
- lighter = !lighter;
425
- desiredLuminance = computeLuminance();
426
- }
427
- return desiredLuminance;
428
- }
429
- /**
430
- * Approach a value of the given component of `candidateHSVA` such that the
431
- * calculated luminance of `candidateHSVA` approximates `desiredLuminance`.
432
- */
433
- export function approachColorValue(candidateHSVA, index, desiredLuminance, candidateLuminance) {
434
- const epsilon = 0.0002;
435
- let x = candidateHSVA[index];
436
- let multiplier = 1;
437
- let dLuminance = candidateLuminance(candidateHSVA) - desiredLuminance;
438
- let previousSign = Math.sign(dLuminance);
439
- for (let guard = 100; guard; guard--) {
440
- if (Math.abs(dLuminance) < epsilon) {
441
- candidateHSVA[index] = x;
442
- return x;
443
- }
444
- const sign = Math.sign(dLuminance);
445
- if (sign !== previousSign) {
446
- // If `x` overshoots the correct value, halve the step size.
447
- multiplier /= 2;
448
- previousSign = sign;
449
- }
450
- else if (x < 0 || x > 1) {
451
- // If there is no overshoot and `x` is out of bounds, there is no
452
- // acceptable value for `x`.
453
- return null;
454
- }
455
- // Adjust `x` by a multiple of `dLuminance` to decrease step size as
456
- // the computed luminance converges on `desiredLuminance`.
457
- x += multiplier * (index === 2 ? -dLuminance : dLuminance);
458
- candidateHSVA[index] = x;
459
- dLuminance = candidateLuminance(candidateHSVA) - desiredLuminance;
460
- }
461
- return null;
462
- }
463
- export function findFgColorForContrast(fgColor, bgColor, requiredContrast) {
464
- const candidateHSVA = fgColor.as("hsl" /* Format.HSL */).hsva();
465
- const bgRGBA = bgColor.rgba();
466
- const candidateLuminance = (candidateHSVA) => {
467
- return luminance(blendColors(Legacy.fromHSVA(candidateHSVA).rgba(), bgRGBA));
468
- };
469
- const bgLuminance = luminance(bgColor.rgba());
470
- const fgLuminance = candidateLuminance(candidateHSVA);
471
- const fgIsLighter = fgLuminance > bgLuminance;
472
- const desired = desiredLuminance(bgLuminance, requiredContrast, fgIsLighter);
473
- const saturationComponentIndex = 1;
474
- const valueComponentIndex = 2;
475
- if (approachColorValue(candidateHSVA, valueComponentIndex, desired, candidateLuminance)) {
476
- return Legacy.fromHSVA(candidateHSVA);
477
- }
478
- candidateHSVA[valueComponentIndex] = 1;
479
- if (approachColorValue(candidateHSVA, saturationComponentIndex, desired, candidateLuminance)) {
480
- return Legacy.fromHSVA(candidateHSVA);
481
- }
482
- return null;
483
- }
484
- export function findFgColorForContrastAPCA(fgColor, bgColor, requiredContrast) {
485
- const candidateHSVA = fgColor.as("hsl" /* Format.HSL */).hsva();
486
- const candidateLuminance = (candidateHSVA) => {
487
- return luminanceAPCA(Legacy.fromHSVA(candidateHSVA).rgba());
488
- };
489
- const bgLuminance = luminanceAPCA(bgColor.rgba());
490
- const fgLuminance = candidateLuminance(candidateHSVA);
491
- const fgIsLighter = fgLuminance >= bgLuminance;
492
- const desiredLuminance = desiredLuminanceAPCA(bgLuminance, requiredContrast, fgIsLighter);
493
- const saturationComponentIndex = 1;
494
- const valueComponentIndex = 2;
495
- if (approachColorValue(candidateHSVA, valueComponentIndex, desiredLuminance, candidateLuminance)) {
496
- const candidate = Legacy.fromHSVA(candidateHSVA);
497
- if (Math.abs(contrastRatioAPCA(bgColor.rgba(), candidate.rgba())) >= requiredContrast) {
498
- return candidate;
499
- }
500
- }
501
- candidateHSVA[valueComponentIndex] = 1;
502
- if (approachColorValue(candidateHSVA, saturationComponentIndex, desiredLuminance, candidateLuminance)) {
503
- const candidate = Legacy.fromHSVA(candidateHSVA);
504
- if (Math.abs(contrastRatioAPCA(bgColor.rgba(), candidate.rgba())) >= requiredContrast) {
505
- return candidate;
506
- }
507
- }
508
- return null;
509
- }
510
- const EPSILON = 0.01;
511
- const WIDE_RANGE_EPSILON = 1; // For comparisons on channels with a wider range than [0,1]
512
- function equals(a, b, accuracy = EPSILON) {
513
- if (Array.isArray(a) && Array.isArray(b)) {
514
- if (a.length !== b.length) {
515
- return false;
516
- }
517
- for (const i in a) {
518
- if (!equals(a[i], b[i])) {
519
- return false;
520
- }
521
- }
522
- return true;
523
- }
524
- if (Array.isArray(a) || Array.isArray(b)) {
525
- return false;
526
- }
527
- if (a === null || b === null) {
528
- return a === b;
529
- }
530
- return Math.abs(a - b) < accuracy;
531
- }
532
- function lessOrEquals(a, b, accuracy = EPSILON) {
533
- return a - b <= accuracy;
534
- }
535
- export class Lab {
536
- l;
537
- a;
538
- b;
539
- alpha;
540
- #authoredText;
541
- #rawParams;
542
- channels = ["l" /* ColorChannel.L */, "a" /* ColorChannel.A */, "b" /* ColorChannel.B */, "alpha" /* ColorChannel.ALPHA */];
543
- static #conversions = {
544
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "hex" /* Format.HEX */),
545
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "hexa" /* Format.HEXA */),
546
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "rgb" /* Format.RGB */),
547
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "rgba" /* Format.RGBA */),
548
- ["hsl" /* Format.HSL */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
549
- ["hsla" /* Format.HSLA */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
550
- ["hwb" /* Format.HWB */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
551
- ["hwba" /* Format.HWBA */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
552
- ["lch" /* Format.LCH */]: (self) => new LCH(...ColorConverter.labToLch(self.l, self.a, self.b), self.alpha),
553
- ["oklch" /* Format.OKLCH */]: (self) => new Oklch(...ColorConverter.xyzd50ToOklch(...self.#toXyzd50()), self.alpha),
554
- ["lab" /* Format.LAB */]: (self) => self,
555
- ["oklab" /* Format.OKLAB */]: (self) => new Oklab(...ColorConverter.xyzd65ToOklab(...ColorConverter.xyzd50ToD65(...self.#toXyzd50())), self.alpha),
556
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
557
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
558
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
559
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
560
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
561
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
562
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
563
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
564
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
565
- };
566
- #toXyzd50() {
567
- return ColorConverter.labToXyzd50(this.l, this.a, this.b);
568
- }
569
- #getRGBArray(withAlpha = true) {
570
- const params = ColorConverter.xyzd50ToSrgb(...this.#toXyzd50());
571
- if (withAlpha) {
572
- return [...params, this.alpha ?? undefined];
573
- }
574
- return params;
575
- }
576
- constructor(l, a, b, alpha, authoredText) {
577
- this.#rawParams = [l, a, b];
578
- this.l = clamp(l, { min: 0, max: 100 });
579
- if (equals(this.l, 0, WIDE_RANGE_EPSILON) || equals(this.l, 100, WIDE_RANGE_EPSILON)) {
580
- a = b = 0;
581
- }
582
- this.a = a;
583
- this.b = b;
584
- this.alpha = clamp(alpha, { min: 0, max: 1 });
585
- this.#authoredText = authoredText;
586
- }
587
- is(format) {
588
- return format === this.format();
589
- }
590
- as(format) {
591
- return Lab.#conversions[format](this);
592
- }
593
- asLegacyColor() {
594
- return this.as("rgba" /* Format.RGBA */);
595
- }
596
- equal(color) {
597
- const lab = color.as("lab" /* Format.LAB */);
598
- return equals(lab.l, this.l, WIDE_RANGE_EPSILON) && equals(lab.a, this.a) && equals(lab.b, this.b) &&
599
- equals(lab.alpha, this.alpha);
600
- }
601
- format() {
602
- return "lab" /* Format.LAB */;
603
- }
604
- setAlpha(alpha) {
605
- return new Lab(this.l, this.a, this.b, alpha, undefined);
606
- }
607
- asString(format) {
608
- if (format) {
609
- return this.as(format).asString();
610
- }
611
- return this.#stringify(this.l, this.a, this.b);
612
- }
613
- #stringify(l, a, b) {
614
- const alpha = this.alpha === null || equals(this.alpha, 1) ?
615
- '' :
616
- ` / ${Platform.StringUtilities.stringifyWithPrecision(this.alpha)}`;
617
- return `lab(${Platform.StringUtilities.stringifyWithPrecision(l, 0)} ${Platform.StringUtilities.stringifyWithPrecision(a)} ${Platform.StringUtilities.stringifyWithPrecision(b)}${alpha})`;
618
- }
619
- getAuthoredText() {
620
- return this.#authoredText ?? null;
621
- }
622
- getRawParameters() {
623
- return [...this.#rawParams];
624
- }
625
- getAsRawString(format) {
626
- if (format) {
627
- return this.as(format).getAsRawString();
628
- }
629
- return this.#stringify(...this.#rawParams);
630
- }
631
- isGamutClipped() {
632
- return false;
633
- }
634
- static fromSpec(spec, text) {
635
- const L = parsePercentage(spec[0], [0, 100]) ?? parseNumber(spec[0]);
636
- if (L === null) {
637
- return null;
638
- }
639
- const a = parsePercentage(spec[1], [0, 125]) ?? parseNumber(spec[1]);
640
- if (a === null) {
641
- return null;
642
- }
643
- const b = parsePercentage(spec[2], [0, 125]) ?? parseNumber(spec[2]);
644
- if (b === null) {
645
- return null;
646
- }
647
- const alpha = parseAlpha(spec[3]);
648
- return new Lab(L, a, b, alpha, text);
649
- }
650
- }
651
- export class LCH {
652
- #rawParams;
653
- l;
654
- c;
655
- h;
656
- alpha;
657
- #authoredText;
658
- channels = ["l" /* ColorChannel.L */, "c" /* ColorChannel.C */, "h" /* ColorChannel.H */, "alpha" /* ColorChannel.ALPHA */];
659
- static #conversions = {
660
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "hex" /* Format.HEX */),
661
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "hexa" /* Format.HEXA */),
662
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "rgb" /* Format.RGB */),
663
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "rgba" /* Format.RGBA */),
664
- ["hsl" /* Format.HSL */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
665
- ["hsla" /* Format.HSLA */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
666
- ["hwb" /* Format.HWB */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
667
- ["hwba" /* Format.HWBA */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
668
- ["lch" /* Format.LCH */]: (self) => self,
669
- ["oklch" /* Format.OKLCH */]: (self) => new Oklch(...ColorConverter.xyzd50ToOklch(...self.#toXyzd50()), self.alpha),
670
- ["lab" /* Format.LAB */]: (self) => new Lab(...ColorConverter.lchToLab(self.l, self.c, self.h), self.alpha),
671
- ["oklab" /* Format.OKLAB */]: (self) => new Oklab(...ColorConverter.xyzd65ToOklab(...ColorConverter.xyzd50ToD65(...self.#toXyzd50())), self.alpha),
672
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
673
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
674
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
675
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
676
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
677
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
678
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
679
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
680
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
681
- };
682
- #toXyzd50() {
683
- return ColorConverter.labToXyzd50(...ColorConverter.lchToLab(this.l, this.c, this.h));
684
- }
685
- #getRGBArray(withAlpha = true) {
686
- const params = ColorConverter.xyzd50ToSrgb(...this.#toXyzd50());
687
- if (withAlpha) {
688
- return [...params, this.alpha ?? undefined];
689
- }
690
- return params;
691
- }
692
- constructor(l, c, h, alpha, authoredText) {
693
- this.#rawParams = [l, c, h];
694
- this.l = clamp(l, { min: 0, max: 100 });
695
- c = equals(this.l, 0, WIDE_RANGE_EPSILON) || equals(this.l, 100, WIDE_RANGE_EPSILON) ? 0 : c;
696
- this.c = clamp(c, { min: 0 });
697
- h = equals(c, 0) ? 0 : h;
698
- this.h = normalizeHue(h);
699
- this.alpha = clamp(alpha, { min: 0, max: 1 });
700
- this.#authoredText = authoredText;
701
- }
702
- asLegacyColor() {
703
- return this.as("rgba" /* Format.RGBA */);
704
- }
705
- is(format) {
706
- return format === this.format();
707
- }
708
- as(format) {
709
- return LCH.#conversions[format](this);
710
- }
711
- equal(color) {
712
- const lch = color.as("lch" /* Format.LCH */);
713
- return equals(lch.l, this.l, WIDE_RANGE_EPSILON) && equals(lch.c, this.c) && equals(lch.h, this.h) &&
714
- equals(lch.alpha, this.alpha);
715
- }
716
- format() {
717
- return "lch" /* Format.LCH */;
718
- }
719
- setAlpha(alpha) {
720
- return new LCH(this.l, this.c, this.h, alpha);
721
- }
722
- asString(format) {
723
- if (format) {
724
- return this.as(format).asString();
725
- }
726
- return this.#stringify(this.l, this.c, this.h);
727
- }
728
- #stringify(l, c, h) {
729
- const alpha = this.alpha === null || equals(this.alpha, 1) ?
730
- '' :
731
- ` / ${Platform.StringUtilities.stringifyWithPrecision(this.alpha)}`;
732
- return `lch(${Platform.StringUtilities.stringifyWithPrecision(l, 0)} ${Platform.StringUtilities.stringifyWithPrecision(c)} ${Platform.StringUtilities.stringifyWithPrecision(h)}${alpha})`;
733
- }
734
- getAuthoredText() {
735
- return this.#authoredText ?? null;
736
- }
737
- getRawParameters() {
738
- return [...this.#rawParams];
739
- }
740
- getAsRawString(format) {
741
- if (format) {
742
- return this.as(format).getAsRawString();
743
- }
744
- return this.#stringify(...this.#rawParams);
745
- }
746
- isGamutClipped() {
747
- return false;
748
- }
749
- // See "powerless" component definitions in
750
- // https://www.w3.org/TR/css-color-4/#specifying-lab-lch
751
- isHuePowerless() {
752
- return equals(this.c, 0);
753
- }
754
- static fromSpec(spec, text) {
755
- const L = parsePercentage(spec[0], [0, 100]) ?? parseNumber(spec[0]);
756
- if (L === null) {
757
- return null;
758
- }
759
- const c = parsePercentage(spec[1], [0, 150]) ?? parseNumber(spec[1]);
760
- if (c === null) {
761
- return null;
762
- }
763
- const h = parseAngle(spec[2]);
764
- if (h === null) {
765
- return null;
766
- }
767
- const alpha = parseAlpha(spec[3]);
768
- return new LCH(L, c, h, alpha, text);
769
- }
770
- }
771
- export class Oklab {
772
- #rawParams;
773
- l;
774
- a;
775
- b;
776
- alpha;
777
- #authoredText;
778
- channels = ["l" /* ColorChannel.L */, "a" /* ColorChannel.A */, "b" /* ColorChannel.B */, "alpha" /* ColorChannel.ALPHA */];
779
- static #conversions = {
780
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "hex" /* Format.HEX */),
781
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "hexa" /* Format.HEXA */),
782
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "rgb" /* Format.RGB */),
783
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "rgba" /* Format.RGBA */),
784
- ["hsl" /* Format.HSL */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
785
- ["hsla" /* Format.HSLA */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
786
- ["hwb" /* Format.HWB */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
787
- ["hwba" /* Format.HWBA */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
788
- ["lch" /* Format.LCH */]: (self) => new LCH(...ColorConverter.labToLch(...ColorConverter.xyzd50ToLab(...self.#toXyzd50())), self.alpha),
789
- ["oklch" /* Format.OKLCH */]: (self) => new Oklch(...ColorConverter.xyzd50ToOklch(...self.#toXyzd50()), self.alpha),
790
- ["lab" /* Format.LAB */]: (self) => new Lab(...ColorConverter.xyzd50ToLab(...self.#toXyzd50()), self.alpha),
791
- ["oklab" /* Format.OKLAB */]: (self) => self,
792
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
793
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
794
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
795
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
796
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
797
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
798
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
799
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
800
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
801
- };
802
- #toXyzd50() {
803
- return ColorConverter.xyzd65ToD50(...ColorConverter.oklabToXyzd65(this.l, this.a, this.b));
804
- }
805
- #getRGBArray(withAlpha = true) {
806
- const params = ColorConverter.xyzd50ToSrgb(...this.#toXyzd50());
807
- if (withAlpha) {
808
- return [...params, this.alpha ?? undefined];
809
- }
810
- return params;
811
- }
812
- constructor(l, a, b, alpha, authoredText) {
813
- this.#rawParams = [l, a, b];
814
- this.l = clamp(l, { min: 0, max: 1 });
815
- if (equals(this.l, 0) || equals(this.l, 1)) {
816
- a = b = 0;
817
- }
818
- this.a = a;
819
- this.b = b;
820
- this.alpha = clamp(alpha, { min: 0, max: 1 });
821
- this.#authoredText = authoredText;
822
- }
823
- asLegacyColor() {
824
- return this.as("rgba" /* Format.RGBA */);
825
- }
826
- is(format) {
827
- return format === this.format();
828
- }
829
- as(format) {
830
- return Oklab.#conversions[format](this);
831
- }
832
- equal(color) {
833
- const oklab = color.as("oklab" /* Format.OKLAB */);
834
- return equals(oklab.l, this.l) && equals(oklab.a, this.a) && equals(oklab.b, this.b) &&
835
- equals(oklab.alpha, this.alpha);
836
- }
837
- format() {
838
- return "oklab" /* Format.OKLAB */;
839
- }
840
- setAlpha(alpha) {
841
- return new Oklab(this.l, this.a, this.b, alpha);
842
- }
843
- asString(format) {
844
- if (format) {
845
- return this.as(format).asString();
846
- }
847
- return this.#stringify(this.l, this.a, this.b);
848
- }
849
- #stringify(l, a, b) {
850
- const alpha = this.alpha === null || equals(this.alpha, 1) ?
851
- '' :
852
- ` / ${Platform.StringUtilities.stringifyWithPrecision(this.alpha)}`;
853
- return `oklab(${Platform.StringUtilities.stringifyWithPrecision(l)} ${Platform.StringUtilities.stringifyWithPrecision(a)} ${Platform.StringUtilities.stringifyWithPrecision(b)}${alpha})`;
854
- }
855
- getAuthoredText() {
856
- return this.#authoredText ?? null;
857
- }
858
- getRawParameters() {
859
- return [...this.#rawParams];
860
- }
861
- getAsRawString(format) {
862
- if (format) {
863
- return this.as(format).getAsRawString();
864
- }
865
- return this.#stringify(...this.#rawParams);
866
- }
867
- isGamutClipped() {
868
- return false;
869
- }
870
- static fromSpec(spec, text) {
871
- const L = parsePercentage(spec[0], [0, 1]) ?? parseNumber(spec[0]);
872
- if (L === null) {
873
- return null;
874
- }
875
- const a = parsePercentage(spec[1], [0, 0.4]) ?? parseNumber(spec[1]);
876
- if (a === null) {
877
- return null;
878
- }
879
- const b = parsePercentage(spec[2], [0, 0.4]) ?? parseNumber(spec[2]);
880
- if (b === null) {
881
- return null;
882
- }
883
- const alpha = parseAlpha(spec[3]);
884
- return new Oklab(L, a, b, alpha, text);
885
- }
886
- }
887
- export class Oklch {
888
- #rawParams;
889
- l;
890
- c;
891
- h;
892
- alpha;
893
- #authoredText;
894
- channels = ["l" /* ColorChannel.L */, "c" /* ColorChannel.C */, "h" /* ColorChannel.H */, "alpha" /* ColorChannel.ALPHA */];
895
- static #conversions = {
896
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "hex" /* Format.HEX */),
897
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "hexa" /* Format.HEXA */),
898
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "rgb" /* Format.RGB */),
899
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "rgba" /* Format.RGBA */),
900
- ["hsl" /* Format.HSL */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
901
- ["hsla" /* Format.HSLA */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
902
- ["hwb" /* Format.HWB */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
903
- ["hwba" /* Format.HWBA */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
904
- ["lch" /* Format.LCH */]: (self) => new LCH(...ColorConverter.labToLch(...ColorConverter.xyzd50ToLab(...self.#toXyzd50())), self.alpha),
905
- ["oklch" /* Format.OKLCH */]: (self) => self,
906
- ["lab" /* Format.LAB */]: (self) => new Lab(...ColorConverter.xyzd50ToLab(...self.#toXyzd50()), self.alpha),
907
- ["oklab" /* Format.OKLAB */]: (self) => new Oklab(...ColorConverter.xyzd65ToOklab(...ColorConverter.xyzd50ToD65(...self.#toXyzd50())), self.alpha),
908
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
909
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
910
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
911
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
912
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
913
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
914
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
915
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
916
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
917
- };
918
- #toXyzd50() {
919
- return ColorConverter.oklchToXyzd50(this.l, this.c, this.h);
920
- }
921
- #getRGBArray(withAlpha = true) {
922
- const params = ColorConverter.xyzd50ToSrgb(...this.#toXyzd50());
923
- if (withAlpha) {
924
- return [...params, this.alpha ?? undefined];
925
- }
926
- return params;
927
- }
928
- constructor(l, c, h, alpha, authoredText) {
929
- this.#rawParams = [l, c, h];
930
- this.l = clamp(l, { min: 0, max: 1 });
931
- c = equals(this.l, 0) || equals(this.l, 1) ? 0 : c;
932
- this.c = clamp(c, { min: 0 });
933
- h = equals(c, 0) ? 0 : h;
934
- this.h = normalizeHue(h);
935
- this.alpha = clamp(alpha, { min: 0, max: 1 });
936
- this.#authoredText = authoredText;
937
- }
938
- asLegacyColor() {
939
- return this.as("rgba" /* Format.RGBA */);
940
- }
941
- is(format) {
942
- return format === this.format();
943
- }
944
- as(format) {
945
- return Oklch.#conversions[format](this);
946
- }
947
- equal(color) {
948
- const oklch = color.as("oklch" /* Format.OKLCH */);
949
- return equals(oklch.l, this.l) && equals(oklch.c, this.c) && equals(oklch.h, this.h) &&
950
- equals(oklch.alpha, this.alpha);
951
- }
952
- format() {
953
- return "oklch" /* Format.OKLCH */;
954
- }
955
- setAlpha(alpha) {
956
- return new Oklch(this.l, this.c, this.h, alpha);
957
- }
958
- asString(format) {
959
- if (format) {
960
- return this.as(format).asString();
961
- }
962
- return this.#stringify(this.l, this.c, this.h);
963
- }
964
- #stringify(l, c, h) {
965
- const alpha = this.alpha === null || equals(this.alpha, 1) ?
966
- '' :
967
- ` / ${Platform.StringUtilities.stringifyWithPrecision(this.alpha)}`;
968
- return `oklch(${Platform.StringUtilities.stringifyWithPrecision(l)} ${Platform.StringUtilities.stringifyWithPrecision(c)} ${Platform.StringUtilities.stringifyWithPrecision(h)}${alpha})`;
969
- }
970
- getAuthoredText() {
971
- return this.#authoredText ?? null;
972
- }
973
- getRawParameters() {
974
- return [...this.#rawParams];
975
- }
976
- getAsRawString(format) {
977
- if (format) {
978
- return this.as(format).getAsRawString();
979
- }
980
- return this.#stringify(...this.#rawParams);
981
- }
982
- isGamutClipped() {
983
- return false;
984
- }
985
- static fromSpec(spec, text) {
986
- const L = parsePercentage(spec[0], [0, 1]) ?? parseNumber(spec[0]);
987
- if (L === null) {
988
- return null;
989
- }
990
- const c = parsePercentage(spec[1], [0, 0.4]) ?? parseNumber(spec[1]);
991
- if (c === null) {
992
- return null;
993
- }
994
- const h = parseAngle(spec[2]);
995
- if (h === null) {
996
- return null;
997
- }
998
- const alpha = parseAlpha(spec[3]);
999
- return new Oklch(L, c, h, alpha, text);
1000
- }
1001
- }
1002
- export class ColorFunction {
1003
- #rawParams;
1004
- p0;
1005
- p1;
1006
- p2;
1007
- alpha;
1008
- colorSpace;
1009
- #authoredText;
1010
- get channels() {
1011
- return this.isXYZ() ? ["x" /* ColorChannel.X */, "y" /* ColorChannel.Y */, "z" /* ColorChannel.Z */, "alpha" /* ColorChannel.ALPHA */] :
1012
- ["r" /* ColorChannel.R */, "g" /* ColorChannel.G */, "b" /* ColorChannel.B */, "alpha" /* ColorChannel.ALPHA */];
1013
- }
1014
- static #conversions = {
1015
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "hex" /* Format.HEX */),
1016
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "hexa" /* Format.HEXA */),
1017
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "rgb" /* Format.RGB */),
1018
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "rgba" /* Format.RGBA */),
1019
- ["hsl" /* Format.HSL */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1020
- ["hsla" /* Format.HSLA */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1021
- ["hwb" /* Format.HWB */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1022
- ["hwba" /* Format.HWBA */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1023
- ["lch" /* Format.LCH */]: (self) => new LCH(...ColorConverter.labToLch(...ColorConverter.xyzd50ToLab(...self.#toXyzd50())), self.alpha),
1024
- ["oklch" /* Format.OKLCH */]: (self) => new Oklch(...ColorConverter.xyzd50ToOklch(...self.#toXyzd50()), self.alpha),
1025
- ["lab" /* Format.LAB */]: (self) => new Lab(...ColorConverter.xyzd50ToLab(...self.#toXyzd50()), self.alpha),
1026
- ["oklab" /* Format.OKLAB */]: (self) => new Oklab(...ColorConverter.xyzd65ToOklab(...ColorConverter.xyzd50ToD65(...self.#toXyzd50())), self.alpha),
1027
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
1028
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
1029
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
1030
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
1031
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
1032
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
1033
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1034
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
1035
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1036
- };
1037
- #toXyzd50() {
1038
- // With color(), out-of-gamut inputs are to be used for intermediate computations
1039
- const [p0, p1, p2] = this.#rawParams;
1040
- switch (this.colorSpace) {
1041
- case "srgb" /* Format.SRGB */:
1042
- return ColorConverter.srgbToXyzd50(p0, p1, p2);
1043
- case "srgb-linear" /* Format.SRGB_LINEAR */:
1044
- return ColorConverter.srgbLinearToXyzd50(p0, p1, p2);
1045
- case "display-p3" /* Format.DISPLAY_P3 */:
1046
- return ColorConverter.displayP3ToXyzd50(p0, p1, p2);
1047
- case "a98-rgb" /* Format.A98_RGB */:
1048
- return ColorConverter.adobeRGBToXyzd50(p0, p1, p2);
1049
- case "prophoto-rgb" /* Format.PROPHOTO_RGB */:
1050
- return ColorConverter.proPhotoToXyzd50(p0, p1, p2);
1051
- case "rec2020" /* Format.REC_2020 */:
1052
- return ColorConverter.rec2020ToXyzd50(p0, p1, p2);
1053
- case "xyz-d50" /* Format.XYZ_D50 */:
1054
- return [p0, p1, p2];
1055
- case "xyz" /* Format.XYZ */:
1056
- case "xyz-d65" /* Format.XYZ_D65 */:
1057
- return ColorConverter.xyzd65ToD50(p0, p1, p2);
1058
- }
1059
- throw new Error('Invalid color space');
1060
- }
1061
- #getRGBArray(withAlpha = true) {
1062
- // With color(), out-of-gamut inputs are to be used for intermediate computations
1063
- const [p0, p1, p2] = this.#rawParams;
1064
- const params = this.colorSpace === "srgb" /* Format.SRGB */ ? [p0, p1, p2] : [...ColorConverter.xyzd50ToSrgb(...this.#toXyzd50())];
1065
- if (withAlpha) {
1066
- return [...params, this.alpha ?? undefined];
1067
- }
1068
- return params;
1069
- }
1070
- constructor(colorSpace, p0, p1, p2, alpha, authoredText) {
1071
- this.#rawParams = [p0, p1, p2];
1072
- this.colorSpace = colorSpace;
1073
- this.#authoredText = authoredText;
1074
- if (this.colorSpace !== "xyz-d50" /* Format.XYZ_D50 */ && this.colorSpace !== "xyz-d65" /* Format.XYZ_D65 */ && this.colorSpace !== "xyz" /* Format.XYZ */) {
1075
- p0 = clamp(p0, { min: 0, max: 1 });
1076
- p1 = clamp(p1, { min: 0, max: 1 });
1077
- p2 = clamp(p2, { min: 0, max: 1 });
1078
- }
1079
- this.p0 = p0;
1080
- this.p1 = p1;
1081
- this.p2 = p2;
1082
- this.alpha = clamp(alpha, { min: 0, max: 1 });
1083
- }
1084
- asLegacyColor() {
1085
- return this.as("rgba" /* Format.RGBA */);
1086
- }
1087
- is(format) {
1088
- return format === this.format();
1089
- }
1090
- as(format) {
1091
- if (this.colorSpace === format) {
1092
- return this;
1093
- }
1094
- return ColorFunction.#conversions[format](this);
1095
- }
1096
- equal(color) {
1097
- const space = color.as(this.colorSpace);
1098
- return equals(this.p0, space.p0) && equals(this.p1, space.p1) && equals(this.p2, space.p2) &&
1099
- equals(this.alpha, space.alpha);
1100
- }
1101
- format() {
1102
- return this.colorSpace;
1103
- }
1104
- setAlpha(alpha) {
1105
- return new ColorFunction(this.colorSpace, this.p0, this.p1, this.p2, alpha);
1106
- }
1107
- asString(format) {
1108
- if (format) {
1109
- return this.as(format).asString();
1110
- }
1111
- return this.#stringify(this.p0, this.p1, this.p2);
1112
- }
1113
- #stringify(p0, p1, p2) {
1114
- const alpha = this.alpha === null || equals(this.alpha, 1) ?
1115
- '' :
1116
- ` / ${Platform.StringUtilities.stringifyWithPrecision(this.alpha)}`;
1117
- return `color(${this.colorSpace} ${Platform.StringUtilities.stringifyWithPrecision(p0)} ${Platform.StringUtilities.stringifyWithPrecision(p1)} ${Platform.StringUtilities.stringifyWithPrecision(p2)}${alpha})`;
1118
- }
1119
- getAuthoredText() {
1120
- return this.#authoredText ?? null;
1121
- }
1122
- getRawParameters() {
1123
- return [...this.#rawParams];
1124
- }
1125
- getAsRawString(format) {
1126
- if (format) {
1127
- return this.as(format).getAsRawString();
1128
- }
1129
- return this.#stringify(...this.#rawParams);
1130
- }
1131
- isGamutClipped() {
1132
- if (this.colorSpace !== "xyz-d50" /* Format.XYZ_D50 */ && this.colorSpace !== "xyz-d65" /* Format.XYZ_D65 */ && this.colorSpace !== "xyz" /* Format.XYZ */) {
1133
- return !equals(this.#rawParams, [this.p0, this.p1, this.p2]);
1134
- }
1135
- return false;
1136
- }
1137
- isXYZ() {
1138
- switch (this.colorSpace) {
1139
- case "xyz" /* Format.XYZ */:
1140
- case "xyz-d50" /* Format.XYZ_D50 */:
1141
- case "xyz-d65" /* Format.XYZ_D65 */:
1142
- return true;
1143
- }
1144
- return false;
1145
- }
1146
- /**
1147
- * Parses given `color()` function definition and returns the `Color` object.
1148
- * We want to special case its parsing here because it's a bit different
1149
- * than other color functions: rgb, lch etc. accepts 3 arguments with
1150
- * optional alpha. This accepts 4 arguments with optional alpha.
1151
- *
1152
- * Instead of making `splitColorFunctionParameters` work for this case too
1153
- * I've decided to implement it specifically.
1154
- * @param authoredText Original definition of the color with `color`
1155
- * @param parametersText Inside of the `color()` function. ex, `display-p3 0.1 0.2 0.3 / 0%`
1156
- * @returns `Color` object
1157
- */
1158
- static fromSpec(authoredText, parametersWithAlphaText) {
1159
- const [parametersText, alphaText] = parametersWithAlphaText.split('/', 2);
1160
- const parameters = parametersText.trim().split(/\s+/);
1161
- const [colorSpaceText, ...remainingParams] = parameters;
1162
- const colorSpace = getColorSpace(colorSpaceText);
1163
- // Color space is not known to us, do not parse the Color.
1164
- if (!colorSpace) {
1165
- return null;
1166
- }
1167
- // `color(<color-space>)` is a valid syntax
1168
- if (remainingParams.length === 0 && alphaText === undefined) {
1169
- return new ColorFunction(colorSpace, 0, 0, 0, null, authoredText);
1170
- }
1171
- // Check if it contains `/ <alpha>` part, if so, it should be at the end
1172
- if (remainingParams.length === 0 && alphaText !== undefined && alphaText.trim().split(/\s+/).length > 1) {
1173
- // Invalid syntax: like `color(<space> / <alpha> <number>)`
1174
- return null;
1175
- }
1176
- // `color` cannot contain more than 3 parameters without alpha
1177
- if (remainingParams.length > 3) {
1178
- return null;
1179
- }
1180
- // Replace `none`s with 0s
1181
- const nonesReplacedParams = remainingParams.map(param => param === 'none' ? '0' : param);
1182
- // At this point, we know that all the values are there so we can
1183
- // safely try to parse all the values as number or percentage
1184
- const values = nonesReplacedParams.map(param => parsePercentOrNumber(param, [0, 1]));
1185
- const containsNull = values.includes(null);
1186
- // At least one value is malformatted (not a number or percentage)
1187
- if (containsNull) {
1188
- return null;
1189
- }
1190
- const alphaValue = alphaText ? parsePercentOrNumber(alphaText, [0, 1]) ?? 1 : 1;
1191
- // Depending on the color space
1192
- // this either reflects `rgb` parameters in that color space
1193
- // or `xyz` parameters in the given `xyz` space.
1194
- const rgbOrXyza = [
1195
- values[0] ?? 0,
1196
- values[1] ?? 0,
1197
- values[2] ?? 0,
1198
- alphaValue,
1199
- ];
1200
- return new ColorFunction(colorSpace, ...rgbOrXyza, authoredText);
1201
- }
1202
- }
1203
- export class HSL {
1204
- h;
1205
- s;
1206
- l;
1207
- alpha;
1208
- #rawParams;
1209
- #authoredText;
1210
- channels = ["h" /* ColorChannel.H */, "s" /* ColorChannel.S */, "l" /* ColorChannel.L */, "alpha" /* ColorChannel.ALPHA */];
1211
- static #conversions = {
1212
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "hex" /* Format.HEX */),
1213
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "hexa" /* Format.HEXA */),
1214
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "rgb" /* Format.RGB */),
1215
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "rgba" /* Format.RGBA */),
1216
- ["hsl" /* Format.HSL */]: (self) => self,
1217
- ["hsla" /* Format.HSLA */]: (self) => self,
1218
- ["hwb" /* Format.HWB */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1219
- ["hwba" /* Format.HWBA */]: (self) => new HWB(...rgbToHwb(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1220
- ["lch" /* Format.LCH */]: (self) => new LCH(...ColorConverter.labToLch(...ColorConverter.xyzd50ToLab(...self.#toXyzd50())), self.alpha),
1221
- ["oklch" /* Format.OKLCH */]: (self) => new Oklch(...ColorConverter.xyzd50ToOklch(...self.#toXyzd50()), self.alpha),
1222
- ["lab" /* Format.LAB */]: (self) => new Lab(...ColorConverter.xyzd50ToLab(...self.#toXyzd50()), self.alpha),
1223
- ["oklab" /* Format.OKLAB */]: (self) => new Oklab(...ColorConverter.xyzd65ToOklab(...ColorConverter.xyzd50ToD65(...self.#toXyzd50())), self.alpha),
1224
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
1225
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
1226
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
1227
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
1228
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
1229
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
1230
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1231
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
1232
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1233
- };
1234
- #getRGBArray(withAlpha = true) {
1235
- const rgb = hsl2rgb([this.h, this.s, this.l, 0]);
1236
- if (withAlpha) {
1237
- return [rgb[0], rgb[1], rgb[2], this.alpha ?? undefined];
1238
- }
1239
- return [rgb[0], rgb[1], rgb[2]];
1240
- }
1241
- #toXyzd50() {
1242
- const rgb = this.#getRGBArray(false);
1243
- return ColorConverter.srgbToXyzd50(rgb[0], rgb[1], rgb[2]);
1244
- }
1245
- constructor(h, s, l, alpha, authoredText) {
1246
- this.#rawParams = [h, s, l];
1247
- this.l = clamp(l, { min: 0, max: 1 });
1248
- s = equals(this.l, 0) || equals(this.l, 1) ? 0 : s;
1249
- this.s = clamp(s, { min: 0, max: 1 });
1250
- h = equals(this.s, 0) ? 0 : h;
1251
- this.h = normalizeHue(h * 360) / 360;
1252
- this.alpha = clamp(alpha ?? null, { min: 0, max: 1 });
1253
- this.#authoredText = authoredText;
1254
- }
1255
- equal(color) {
1256
- const hsl = color.as("hsl" /* Format.HSL */);
1257
- return equals(this.h, hsl.h) && equals(this.s, hsl.s) && equals(this.l, hsl.l) && equals(this.alpha, hsl.alpha);
1258
- }
1259
- asString(format) {
1260
- if (format) {
1261
- return this.as(format).asString();
1262
- }
1263
- return this.#stringify(this.h, this.s, this.l);
1264
- }
1265
- #stringify(h, s, l) {
1266
- const start = Platform.StringUtilities.sprintf('hsl(%sdeg %s% %s%', Platform.StringUtilities.stringifyWithPrecision(h * 360), Platform.StringUtilities.stringifyWithPrecision(s * 100), Platform.StringUtilities.stringifyWithPrecision(l * 100));
1267
- if (this.alpha !== null && this.alpha !== 1) {
1268
- return start +
1269
- Platform.StringUtilities.sprintf(' / %s%)', Platform.StringUtilities.stringifyWithPrecision(this.alpha * 100));
1270
- }
1271
- return start + ')';
1272
- }
1273
- setAlpha(alpha) {
1274
- return new HSL(this.h, this.s, this.l, alpha);
1275
- }
1276
- format() {
1277
- return this.alpha === null || this.alpha === 1 ? "hsl" /* Format.HSL */ : "hsla" /* Format.HSLA */;
1278
- }
1279
- is(format) {
1280
- return format === this.format();
1281
- }
1282
- as(format) {
1283
- if (format === this.format()) {
1284
- return this;
1285
- }
1286
- return HSL.#conversions[format](this);
1287
- }
1288
- asLegacyColor() {
1289
- return this.as("rgba" /* Format.RGBA */);
1290
- }
1291
- getAuthoredText() {
1292
- return this.#authoredText ?? null;
1293
- }
1294
- getRawParameters() {
1295
- return [...this.#rawParams];
1296
- }
1297
- getAsRawString(format) {
1298
- if (format) {
1299
- return this.as(format).getAsRawString();
1300
- }
1301
- return this.#stringify(...this.#rawParams);
1302
- }
1303
- isGamutClipped() {
1304
- return !lessOrEquals(this.#rawParams[1], 1) || !lessOrEquals(0, this.#rawParams[1]);
1305
- }
1306
- static fromSpec(spec, text) {
1307
- const h = parseHueNumeric(spec[0]);
1308
- if (h === null) {
1309
- return null;
1310
- }
1311
- const s = parseSatLightNumeric(spec[1]);
1312
- if (s === null) {
1313
- return null;
1314
- }
1315
- const l = parseSatLightNumeric(spec[2]);
1316
- if (l === null) {
1317
- return null;
1318
- }
1319
- const alpha = parseAlpha(spec[3]);
1320
- return new HSL(h, s, l, alpha, text);
1321
- }
1322
- hsva() {
1323
- const s = this.s * (this.l < 0.5 ? this.l : 1 - this.l);
1324
- return [this.h, s !== 0 ? 2 * s / (this.l + s) : 0, (this.l + s), this.alpha ?? 1];
1325
- }
1326
- canonicalHSLA() {
1327
- return [Math.round(this.h * 360), Math.round(this.s * 100), Math.round(this.l * 100), this.alpha ?? 1];
1328
- }
1329
- }
1330
- export class HWB {
1331
- h;
1332
- w;
1333
- b;
1334
- alpha;
1335
- #rawParams;
1336
- #authoredText;
1337
- channels = ["h" /* ColorChannel.H */, "w" /* ColorChannel.W */, "b" /* ColorChannel.B */, "alpha" /* ColorChannel.ALPHA */];
1338
- static #conversions = {
1339
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "hex" /* Format.HEX */),
1340
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "hexa" /* Format.HEXA */),
1341
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ false), "rgb" /* Format.RGB */),
1342
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#getRGBArray(/* withAlpha= */ true), "rgba" /* Format.RGBA */),
1343
- ["hsl" /* Format.HSL */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1344
- ["hsla" /* Format.HSLA */]: (self) => new HSL(...rgbToHsl(self.#getRGBArray(/* withAlpha= */ false)), self.alpha),
1345
- ["hwb" /* Format.HWB */]: (self) => self,
1346
- ["hwba" /* Format.HWBA */]: (self) => self,
1347
- ["lch" /* Format.LCH */]: (self) => new LCH(...ColorConverter.labToLch(...ColorConverter.xyzd50ToLab(...self.#toXyzd50())), self.alpha),
1348
- ["oklch" /* Format.OKLCH */]: (self) => new Oklch(...ColorConverter.xyzd50ToOklch(...self.#toXyzd50()), self.alpha),
1349
- ["lab" /* Format.LAB */]: (self) => new Lab(...ColorConverter.xyzd50ToLab(...self.#toXyzd50()), self.alpha),
1350
- ["oklab" /* Format.OKLAB */]: (self) => new Oklab(...ColorConverter.xyzd65ToOklab(...ColorConverter.xyzd50ToD65(...self.#toXyzd50())), self.alpha),
1351
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
1352
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
1353
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
1354
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
1355
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
1356
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
1357
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1358
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
1359
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1360
- };
1361
- #getRGBArray(withAlpha = true) {
1362
- const rgb = hwb2rgb([this.h, this.w, this.b, 0]);
1363
- if (withAlpha) {
1364
- return [rgb[0], rgb[1], rgb[2], this.alpha ?? undefined];
1365
- }
1366
- return [rgb[0], rgb[1], rgb[2]];
1367
- }
1368
- #toXyzd50() {
1369
- const rgb = this.#getRGBArray(false);
1370
- return ColorConverter.srgbToXyzd50(rgb[0], rgb[1], rgb[2]);
1371
- }
1372
- constructor(h, w, b, alpha, authoredText) {
1373
- this.#rawParams = [h, w, b];
1374
- this.w = clamp(w, { min: 0, max: 1 });
1375
- this.b = clamp(b, { min: 0, max: 1 });
1376
- h = lessOrEquals(1, this.w + this.b) ? 0 : h;
1377
- this.h = normalizeHue(h * 360) / 360;
1378
- this.alpha = clamp(alpha, { min: 0, max: 1 });
1379
- if (lessOrEquals(1, this.w + this.b)) {
1380
- // normalize to a sum of 100% respecting the ratio, see https://www.w3.org/TR/css-color-4/#the-hwb-notation
1381
- const ratio = this.w / this.b;
1382
- this.b = 1 / (1 + ratio);
1383
- this.w = 1 - this.b;
1384
- }
1385
- this.#authoredText = authoredText;
1386
- }
1387
- equal(color) {
1388
- const hwb = color.as("hwb" /* Format.HWB */);
1389
- return equals(this.h, hwb.h) && equals(this.w, hwb.w) && equals(this.b, hwb.b) && equals(this.alpha, hwb.alpha);
1390
- }
1391
- asString(format) {
1392
- if (format) {
1393
- return this.as(format).asString();
1394
- }
1395
- return this.#stringify(this.h, this.w, this.b);
1396
- }
1397
- #stringify(h, w, b) {
1398
- const start = Platform.StringUtilities.sprintf('hwb(%sdeg %s% %s%', Platform.StringUtilities.stringifyWithPrecision(h * 360), Platform.StringUtilities.stringifyWithPrecision(w * 100), Platform.StringUtilities.stringifyWithPrecision(b * 100));
1399
- if (this.alpha !== null && this.alpha !== 1) {
1400
- return start +
1401
- Platform.StringUtilities.sprintf(' / %s%)', Platform.StringUtilities.stringifyWithPrecision(this.alpha * 100));
1402
- }
1403
- return start + ')';
1404
- }
1405
- setAlpha(alpha) {
1406
- return new HWB(this.h, this.w, this.b, alpha, this.#authoredText);
1407
- }
1408
- format() {
1409
- return this.alpha !== null && !equals(this.alpha, 1) ? "hwba" /* Format.HWBA */ : "hwb" /* Format.HWB */;
1410
- }
1411
- is(format) {
1412
- return format === this.format();
1413
- }
1414
- as(format) {
1415
- if (format === this.format()) {
1416
- return this;
1417
- }
1418
- return HWB.#conversions[format](this);
1419
- }
1420
- asLegacyColor() {
1421
- return this.as("rgba" /* Format.RGBA */);
1422
- }
1423
- getAuthoredText() {
1424
- return this.#authoredText ?? null;
1425
- }
1426
- canonicalHWBA() {
1427
- return [
1428
- Math.round(this.h * 360),
1429
- Math.round(this.w * 100),
1430
- Math.round(this.b * 100),
1431
- this.alpha ?? 1,
1432
- ];
1433
- }
1434
- getRawParameters() {
1435
- return [...this.#rawParams];
1436
- }
1437
- getAsRawString(format) {
1438
- if (format) {
1439
- return this.as(format).getAsRawString();
1440
- }
1441
- return this.#stringify(...this.#rawParams);
1442
- }
1443
- isGamutClipped() {
1444
- return !lessOrEquals(this.#rawParams[1], 1) || !lessOrEquals(0, this.#rawParams[1]) ||
1445
- !lessOrEquals(this.#rawParams[2], 1) || !lessOrEquals(0, this.#rawParams[2]);
1446
- }
1447
- static fromSpec(spec, text) {
1448
- const h = parseHueNumeric(spec[0]);
1449
- if (h === null) {
1450
- return null;
1451
- }
1452
- const w = parseSatLightNumeric(spec[1]);
1453
- if (w === null) {
1454
- return null;
1455
- }
1456
- const b = parseSatLightNumeric(spec[2]);
1457
- if (b === null) {
1458
- return null;
1459
- }
1460
- const alpha = parseAlpha(spec[3]);
1461
- return new HWB(h, w, b, alpha, text);
1462
- }
1463
- }
1464
- function toRgbValue(value) {
1465
- return Math.round(value * 255);
1466
- }
1467
- class ShortFormatColorBase {
1468
- color;
1469
- channels = ["r" /* ColorChannel.R */, "g" /* ColorChannel.G */, "b" /* ColorChannel.B */, "alpha" /* ColorChannel.ALPHA */];
1470
- constructor(color) {
1471
- this.color = color;
1472
- }
1473
- get alpha() {
1474
- return this.color.alpha;
1475
- }
1476
- rgba() {
1477
- return this.color.rgba();
1478
- }
1479
- equal(color) {
1480
- return this.color.equal(color);
1481
- }
1482
- setAlpha(alpha) {
1483
- return this.color.setAlpha(alpha);
1484
- }
1485
- format() {
1486
- return (this.alpha ?? 1) !== 1 ? "hexa" /* Format.HEXA */ : "hex" /* Format.HEX */;
1487
- }
1488
- as(format) {
1489
- return this.color.as(format);
1490
- }
1491
- is(format) {
1492
- return this.color.is(format);
1493
- }
1494
- asLegacyColor() {
1495
- return this.color.asLegacyColor();
1496
- }
1497
- getAuthoredText() {
1498
- return this.color.getAuthoredText();
1499
- }
1500
- getRawParameters() {
1501
- return this.color.getRawParameters();
1502
- }
1503
- isGamutClipped() {
1504
- return this.color.isGamutClipped();
1505
- }
1506
- asString(format) {
1507
- if (format) {
1508
- return this.as(format).asString();
1509
- }
1510
- const [r, g, b] = this.color.rgba();
1511
- return this.stringify(r, g, b);
1512
- }
1513
- getAsRawString(format) {
1514
- if (format) {
1515
- return this.as(format).getAsRawString();
1516
- }
1517
- const [r, g, b] = this.getRawParameters();
1518
- return this.stringify(r, g, b);
1519
- }
1520
- }
1521
- export class ShortHex extends ShortFormatColorBase {
1522
- setAlpha(alpha) {
1523
- return new ShortHex(this.color.setAlpha(alpha));
1524
- }
1525
- asString(format) {
1526
- return format && format !== this.format() ? super.as(format).asString() : super.asString();
1527
- }
1528
- stringify(r, g, b) {
1529
- function toShortHexValue(value) {
1530
- return (Math.round(value * 255) / 17).toString(16);
1531
- }
1532
- if (this.color.hasAlpha()) {
1533
- return Platform.StringUtilities
1534
- .sprintf('#%s%s%s%s', toShortHexValue(r), toShortHexValue(g), toShortHexValue(b), toShortHexValue(this.alpha ?? 1))
1535
- .toLowerCase();
1536
- }
1537
- return Platform.StringUtilities.sprintf('#%s%s%s', toShortHexValue(r), toShortHexValue(g), toShortHexValue(b))
1538
- .toLowerCase();
1539
- }
1540
- }
1541
- export class Nickname extends ShortFormatColorBase {
1542
- nickname;
1543
- constructor(nickname, color) {
1544
- super(color);
1545
- this.nickname = nickname;
1546
- }
1547
- static fromName(name, text) {
1548
- const nickname = name.toLowerCase();
1549
- const rgba = Nicknames.get(nickname);
1550
- if (rgba !== undefined) {
1551
- return new Nickname(nickname, Legacy.fromRGBA(rgba, text));
1552
- }
1553
- return null;
1554
- }
1555
- stringify() {
1556
- return this.nickname;
1557
- }
1558
- getAsRawString(format) {
1559
- return this.color.getAsRawString(format);
1560
- }
1561
- }
1562
- export class Legacy {
1563
- #rawParams;
1564
- #rgba;
1565
- #authoredText;
1566
- #format;
1567
- channels = ["r" /* ColorChannel.R */, "g" /* ColorChannel.G */, "b" /* ColorChannel.B */, "alpha" /* ColorChannel.ALPHA */];
1568
- static #conversions = {
1569
- ["hex" /* Format.HEX */]: (self) => new Legacy(self.#rgba, "hex" /* Format.HEX */),
1570
- ["hexa" /* Format.HEXA */]: (self) => new Legacy(self.#rgba, "hexa" /* Format.HEXA */),
1571
- ["rgb" /* Format.RGB */]: (self) => new Legacy(self.#rgba, "rgb" /* Format.RGB */),
1572
- ["rgba" /* Format.RGBA */]: (self) => new Legacy(self.#rgba, "rgba" /* Format.RGBA */),
1573
- ["hsl" /* Format.HSL */]: (self) => new HSL(...rgbToHsl([self.#rgba[0], self.#rgba[1], self.#rgba[2]]), self.alpha),
1574
- ["hsla" /* Format.HSLA */]: (self) => new HSL(...rgbToHsl([self.#rgba[0], self.#rgba[1], self.#rgba[2]]), self.alpha),
1575
- ["hwb" /* Format.HWB */]: (self) => new HWB(...rgbToHwb([self.#rgba[0], self.#rgba[1], self.#rgba[2]]), self.alpha),
1576
- ["hwba" /* Format.HWBA */]: (self) => new HWB(...rgbToHwb([self.#rgba[0], self.#rgba[1], self.#rgba[2]]), self.alpha),
1577
- ["lch" /* Format.LCH */]: (self) => new LCH(...ColorConverter.labToLch(...ColorConverter.xyzd50ToLab(...self.#toXyzd50())), self.alpha),
1578
- ["oklch" /* Format.OKLCH */]: (self) => new Oklch(...ColorConverter.xyzd50ToOklch(...self.#toXyzd50()), self.alpha),
1579
- ["lab" /* Format.LAB */]: (self) => new Lab(...ColorConverter.xyzd50ToLab(...self.#toXyzd50()), self.alpha),
1580
- ["oklab" /* Format.OKLAB */]: (self) => new Oklab(...ColorConverter.xyzd65ToOklab(...ColorConverter.xyzd50ToD65(...self.#toXyzd50())), self.alpha),
1581
- ["srgb" /* Format.SRGB */]: (self) => new ColorFunction("srgb" /* Format.SRGB */, ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
1582
- ["srgb-linear" /* Format.SRGB_LINEAR */]: (self) => new ColorFunction("srgb-linear" /* Format.SRGB_LINEAR */, ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
1583
- ["display-p3" /* Format.DISPLAY_P3 */]: (self) => new ColorFunction("display-p3" /* Format.DISPLAY_P3 */, ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
1584
- ["a98-rgb" /* Format.A98_RGB */]: (self) => new ColorFunction("a98-rgb" /* Format.A98_RGB */, ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
1585
- ["prophoto-rgb" /* Format.PROPHOTO_RGB */]: (self) => new ColorFunction("prophoto-rgb" /* Format.PROPHOTO_RGB */, ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
1586
- ["rec2020" /* Format.REC_2020 */]: (self) => new ColorFunction("rec2020" /* Format.REC_2020 */, ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
1587
- ["xyz" /* Format.XYZ */]: (self) => new ColorFunction("xyz" /* Format.XYZ */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1588
- ["xyz-d50" /* Format.XYZ_D50 */]: (self) => new ColorFunction("xyz-d50" /* Format.XYZ_D50 */, ...self.#toXyzd50(), self.alpha),
1589
- ["xyz-d65" /* Format.XYZ_D65 */]: (self) => new ColorFunction("xyz-d65" /* Format.XYZ_D65 */, ...ColorConverter.xyzd50ToD65(...self.#toXyzd50()), self.alpha),
1590
- };
1591
- #toXyzd50() {
1592
- const [r, g, b] = this.#rgba;
1593
- return ColorConverter.srgbToXyzd50(r, g, b);
1594
- }
1595
- get alpha() {
1596
- switch (this.format()) {
1597
- case "hexa" /* Format.HEXA */:
1598
- case "rgba" /* Format.RGBA */:
1599
- return this.#rgba[3];
1600
- default:
1601
- return null;
1602
- }
1603
- }
1604
- asLegacyColor() {
1605
- return this;
1606
- }
1607
- nickname() {
1608
- const nickname = RGBAToNickname.get(String(this.canonicalRGBA()));
1609
- return nickname ? new Nickname(nickname, this) : null;
1610
- }
1611
- shortHex() {
1612
- for (let i = 0; i < 4; ++i) {
1613
- const c = Math.round(this.#rgba[i] * 255);
1614
- // Check if the two digits of each are identical: #aabbcc => #abc
1615
- if (c % 0x11) {
1616
- return null;
1617
- }
1618
- }
1619
- return new ShortHex(this);
1620
- }
1621
- constructor(rgba, format, authoredText) {
1622
- this.#authoredText = authoredText || null;
1623
- this.#format = format;
1624
- this.#rawParams = [rgba[0], rgba[1], rgba[2]];
1625
- this.#rgba = [
1626
- clamp(rgba[0], { min: 0, max: 1 }),
1627
- clamp(rgba[1], { min: 0, max: 1 }),
1628
- clamp(rgba[2], { min: 0, max: 1 }),
1629
- clamp(rgba[3] ?? 1, { min: 0, max: 1 }),
1630
- ];
1631
- }
1632
- static fromHex(hex, text) {
1633
- hex = hex.toLowerCase();
1634
- // Possible hex representations with alpha are fffA and ffffffAA
1635
- const hasAlpha = hex.length === 4 || hex.length === 8;
1636
- const format = hasAlpha ? "hexa" /* Format.HEXA */ : "hex" /* Format.HEX */;
1637
- const isShort = hex.length <= 4;
1638
- if (isShort) {
1639
- hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2) +
1640
- hex.charAt(3) + hex.charAt(3);
1641
- }
1642
- const r = parseInt(hex.substring(0, 2), 16);
1643
- const g = parseInt(hex.substring(2, 4), 16);
1644
- const b = parseInt(hex.substring(4, 6), 16);
1645
- let a = 1;
1646
- if (hex.length === 8) {
1647
- a = parseInt(hex.substring(6, 8), 16) / 255;
1648
- }
1649
- const color = new Legacy([r / 255, g / 255, b / 255, a], format, text);
1650
- return isShort ? new ShortHex(color) : color;
1651
- }
1652
- static fromRGBAFunction(r, g, b, alpha, text) {
1653
- const rgba = [
1654
- parseRgbNumeric(r),
1655
- parseRgbNumeric(g),
1656
- parseRgbNumeric(b),
1657
- alpha ? parseAlphaNumeric(alpha) : 1,
1658
- ];
1659
- if (!Platform.ArrayUtilities.arrayDoesNotContainNullOrUndefined(rgba)) {
1660
- return null;
1661
- }
1662
- return new Legacy(rgba, alpha ? "rgba" /* Format.RGBA */ : "rgb" /* Format.RGB */, text);
1663
- }
1664
- static fromRGBA(rgba, authoredText) {
1665
- return new Legacy([rgba[0] / 255, rgba[1] / 255, rgba[2] / 255, rgba[3]], "rgba" /* Format.RGBA */, authoredText);
1666
- }
1667
- static fromHSVA(hsva) {
1668
- const rgba = hsva2rgba(hsva);
1669
- return new Legacy(rgba, "rgba" /* Format.RGBA */);
1670
- }
1671
- is(format) {
1672
- return format === this.format();
1673
- }
1674
- as(format) {
1675
- if (format === this.format()) {
1676
- return this;
1677
- }
1678
- return Legacy.#conversions[format](this);
1679
- }
1680
- format() {
1681
- return this.#format;
1682
- }
1683
- hasAlpha() {
1684
- return this.#rgba[3] !== 1;
1685
- }
1686
- detectHEXFormat() {
1687
- const hasAlpha = this.hasAlpha();
1688
- return hasAlpha ? "hexa" /* Format.HEXA */ : "hex" /* Format.HEX */;
1689
- }
1690
- asString(format) {
1691
- if (format) {
1692
- return this.as(format).asString();
1693
- }
1694
- return this.#stringify(format, this.#rgba[0], this.#rgba[1], this.#rgba[2]);
1695
- }
1696
- #stringify(format, r, g, b) {
1697
- if (!format) {
1698
- format = this.#format;
1699
- }
1700
- function toHexValue(value) {
1701
- const hex = Math.round(value * 255).toString(16);
1702
- return hex.length === 1 ? '0' + hex : hex;
1703
- }
1704
- switch (format) {
1705
- case "rgb" /* Format.RGB */:
1706
- case "rgba" /* Format.RGBA */: {
1707
- const start = Platform.StringUtilities.sprintf('rgb(%d %d %d', toRgbValue(r), toRgbValue(g), toRgbValue(b));
1708
- if (this.hasAlpha()) {
1709
- return start + Platform.StringUtilities.sprintf(' / %d%)', Math.round(this.#rgba[3] * 100));
1710
- }
1711
- return start + ')';
1712
- }
1713
- case "hex" /* Format.HEX */:
1714
- case "hexa" /* Format.HEXA */: {
1715
- if (this.hasAlpha()) {
1716
- return Platform.StringUtilities
1717
- .sprintf('#%s%s%s%s', toHexValue(r), toHexValue(g), toHexValue(b), toHexValue(this.#rgba[3]))
1718
- .toLowerCase();
1719
- }
1720
- return Platform.StringUtilities.sprintf('#%s%s%s', toHexValue(r), toHexValue(g), toHexValue(b)).toLowerCase();
1721
- }
1722
- }
1723
- }
1724
- getAuthoredText() {
1725
- return this.#authoredText ?? null;
1726
- }
1727
- getRawParameters() {
1728
- return [...this.#rawParams];
1729
- }
1730
- getAsRawString(format) {
1731
- if (format) {
1732
- return this.as(format).getAsRawString();
1733
- }
1734
- return this.#stringify(format, ...this.#rawParams);
1735
- }
1736
- isGamutClipped() {
1737
- return !equals(this.#rawParams.map(toRgbValue), [this.#rgba[0], this.#rgba[1], this.#rgba[2]].map(toRgbValue), WIDE_RANGE_EPSILON);
1738
- }
1739
- rgba() {
1740
- return [...this.#rgba];
1741
- }
1742
- canonicalRGBA() {
1743
- const rgba = new Array(4);
1744
- for (let i = 0; i < 3; ++i) {
1745
- rgba[i] = Math.round(this.#rgba[i] * 255);
1746
- }
1747
- rgba[3] = this.#rgba[3];
1748
- return rgba;
1749
- }
1750
- toProtocolRGBA() {
1751
- const rgba = this.canonicalRGBA();
1752
- const result = { r: rgba[0], g: rgba[1], b: rgba[2], a: undefined };
1753
- if (rgba[3] !== 1) {
1754
- result.a = rgba[3];
1755
- }
1756
- return result;
1757
- }
1758
- invert() {
1759
- const rgba = [0, 0, 0, 0];
1760
- rgba[0] = 1 - this.#rgba[0];
1761
- rgba[1] = 1 - this.#rgba[1];
1762
- rgba[2] = 1 - this.#rgba[2];
1763
- rgba[3] = this.#rgba[3];
1764
- return new Legacy(rgba, "rgba" /* Format.RGBA */);
1765
- }
1766
- /**
1767
- * Returns a new color using the NTSC formula for making a RGB color grayscale.
1768
- * Note: We override with an alpha of 50% to enhance the dimming effect.
1769
- */
1770
- grayscale() {
1771
- const [r, g, b] = this.#rgba;
1772
- const gray = r * 0.299 + g * 0.587 + b * 0.114;
1773
- return new Legacy([gray, gray, gray, 0.5], "rgba" /* Format.RGBA */);
1774
- }
1775
- setAlpha(alpha) {
1776
- const rgba = [...this.#rgba];
1777
- rgba[3] = alpha;
1778
- return new Legacy(rgba, "rgba" /* Format.RGBA */);
1779
- }
1780
- blendWith(fgColor) {
1781
- const rgba = blendColors(fgColor.#rgba, this.#rgba);
1782
- return new Legacy(rgba, "rgba" /* Format.RGBA */);
1783
- }
1784
- blendWithAlpha(alpha) {
1785
- const rgba = [...this.#rgba];
1786
- rgba[3] *= alpha;
1787
- return new Legacy(rgba, "rgba" /* Format.RGBA */);
1788
- }
1789
- setFormat(format) {
1790
- this.#format = format;
1791
- }
1792
- equal(other) {
1793
- const legacy = other.as(this.#format);
1794
- return equals(toRgbValue(this.#rgba[0]), toRgbValue(legacy.#rgba[0]), WIDE_RANGE_EPSILON) &&
1795
- equals(toRgbValue(this.#rgba[1]), toRgbValue(legacy.#rgba[1]), WIDE_RANGE_EPSILON) &&
1796
- equals(toRgbValue(this.#rgba[2]), toRgbValue(legacy.#rgba[2]), WIDE_RANGE_EPSILON) &&
1797
- equals(this.#rgba[3], legacy.#rgba[3]);
1798
- }
1799
- }
1800
- export const Regex = /((?:rgba?|hsla?|hwba?|lab|lch|oklab|oklch|color)\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b[a-zA-Z]+\b(?!-))/g;
1801
- export const ColorMixRegex = /color-mix\(.*,\s*(?<firstColor>.+)\s*,\s*(?<secondColor>.+)\s*\)/g;
1802
- const COLOR_TO_RGBA_ENTRIES = [
1803
- ['aliceblue', [240, 248, 255]],
1804
- ['antiquewhite', [250, 235, 215]],
1805
- ['aqua', [0, 255, 255]],
1806
- ['aquamarine', [127, 255, 212]],
1807
- ['azure', [240, 255, 255]],
1808
- ['beige', [245, 245, 220]],
1809
- ['bisque', [255, 228, 196]],
1810
- ['black', [0, 0, 0]],
1811
- ['blanchedalmond', [255, 235, 205]],
1812
- ['blue', [0, 0, 255]],
1813
- ['blueviolet', [138, 43, 226]],
1814
- ['brown', [165, 42, 42]],
1815
- ['burlywood', [222, 184, 135]],
1816
- ['cadetblue', [95, 158, 160]],
1817
- ['chartreuse', [127, 255, 0]],
1818
- ['chocolate', [210, 105, 30]],
1819
- ['coral', [255, 127, 80]],
1820
- ['cornflowerblue', [100, 149, 237]],
1821
- ['cornsilk', [255, 248, 220]],
1822
- ['crimson', [237, 20, 61]],
1823
- ['cyan', [0, 255, 255]],
1824
- ['darkblue', [0, 0, 139]],
1825
- ['darkcyan', [0, 139, 139]],
1826
- ['darkgoldenrod', [184, 134, 11]],
1827
- ['darkgray', [169, 169, 169]],
1828
- ['darkgrey', [169, 169, 169]],
1829
- ['darkgreen', [0, 100, 0]],
1830
- ['darkkhaki', [189, 183, 107]],
1831
- ['darkmagenta', [139, 0, 139]],
1832
- ['darkolivegreen', [85, 107, 47]],
1833
- ['darkorange', [255, 140, 0]],
1834
- ['darkorchid', [153, 50, 204]],
1835
- ['darkred', [139, 0, 0]],
1836
- ['darksalmon', [233, 150, 122]],
1837
- ['darkseagreen', [143, 188, 143]],
1838
- ['darkslateblue', [72, 61, 139]],
1839
- ['darkslategray', [47, 79, 79]],
1840
- ['darkslategrey', [47, 79, 79]],
1841
- ['darkturquoise', [0, 206, 209]],
1842
- ['darkviolet', [148, 0, 211]],
1843
- ['deeppink', [255, 20, 147]],
1844
- ['deepskyblue', [0, 191, 255]],
1845
- ['dimgray', [105, 105, 105]],
1846
- ['dimgrey', [105, 105, 105]],
1847
- ['dodgerblue', [30, 144, 255]],
1848
- ['firebrick', [178, 34, 34]],
1849
- ['floralwhite', [255, 250, 240]],
1850
- ['forestgreen', [34, 139, 34]],
1851
- ['fuchsia', [255, 0, 255]],
1852
- ['gainsboro', [220, 220, 220]],
1853
- ['ghostwhite', [248, 248, 255]],
1854
- ['gold', [255, 215, 0]],
1855
- ['goldenrod', [218, 165, 32]],
1856
- ['gray', [128, 128, 128]],
1857
- ['grey', [128, 128, 128]],
1858
- ['green', [0, 128, 0]],
1859
- ['greenyellow', [173, 255, 47]],
1860
- ['honeydew', [240, 255, 240]],
1861
- ['hotpink', [255, 105, 180]],
1862
- ['indianred', [205, 92, 92]],
1863
- ['indigo', [75, 0, 130]],
1864
- ['ivory', [255, 255, 240]],
1865
- ['khaki', [240, 230, 140]],
1866
- ['lavender', [230, 230, 250]],
1867
- ['lavenderblush', [255, 240, 245]],
1868
- ['lawngreen', [124, 252, 0]],
1869
- ['lemonchiffon', [255, 250, 205]],
1870
- ['lightblue', [173, 216, 230]],
1871
- ['lightcoral', [240, 128, 128]],
1872
- ['lightcyan', [224, 255, 255]],
1873
- ['lightgoldenrodyellow', [250, 250, 210]],
1874
- ['lightgreen', [144, 238, 144]],
1875
- ['lightgray', [211, 211, 211]],
1876
- ['lightgrey', [211, 211, 211]],
1877
- ['lightpink', [255, 182, 193]],
1878
- ['lightsalmon', [255, 160, 122]],
1879
- ['lightseagreen', [32, 178, 170]],
1880
- ['lightskyblue', [135, 206, 250]],
1881
- ['lightslategray', [119, 136, 153]],
1882
- ['lightslategrey', [119, 136, 153]],
1883
- ['lightsteelblue', [176, 196, 222]],
1884
- ['lightyellow', [255, 255, 224]],
1885
- ['lime', [0, 255, 0]],
1886
- ['limegreen', [50, 205, 50]],
1887
- ['linen', [250, 240, 230]],
1888
- ['magenta', [255, 0, 255]],
1889
- ['maroon', [128, 0, 0]],
1890
- ['mediumaquamarine', [102, 205, 170]],
1891
- ['mediumblue', [0, 0, 205]],
1892
- ['mediumorchid', [186, 85, 211]],
1893
- ['mediumpurple', [147, 112, 219]],
1894
- ['mediumseagreen', [60, 179, 113]],
1895
- ['mediumslateblue', [123, 104, 238]],
1896
- ['mediumspringgreen', [0, 250, 154]],
1897
- ['mediumturquoise', [72, 209, 204]],
1898
- ['mediumvioletred', [199, 21, 133]],
1899
- ['midnightblue', [25, 25, 112]],
1900
- ['mintcream', [245, 255, 250]],
1901
- ['mistyrose', [255, 228, 225]],
1902
- ['moccasin', [255, 228, 181]],
1903
- ['navajowhite', [255, 222, 173]],
1904
- ['navy', [0, 0, 128]],
1905
- ['oldlace', [253, 245, 230]],
1906
- ['olive', [128, 128, 0]],
1907
- ['olivedrab', [107, 142, 35]],
1908
- ['orange', [255, 165, 0]],
1909
- ['orangered', [255, 69, 0]],
1910
- ['orchid', [218, 112, 214]],
1911
- ['palegoldenrod', [238, 232, 170]],
1912
- ['palegreen', [152, 251, 152]],
1913
- ['paleturquoise', [175, 238, 238]],
1914
- ['palevioletred', [219, 112, 147]],
1915
- ['papayawhip', [255, 239, 213]],
1916
- ['peachpuff', [255, 218, 185]],
1917
- ['peru', [205, 133, 63]],
1918
- ['pink', [255, 192, 203]],
1919
- ['plum', [221, 160, 221]],
1920
- ['powderblue', [176, 224, 230]],
1921
- ['purple', [128, 0, 128]],
1922
- ['rebeccapurple', [102, 51, 153]],
1923
- ['red', [255, 0, 0]],
1924
- ['rosybrown', [188, 143, 143]],
1925
- ['royalblue', [65, 105, 225]],
1926
- ['saddlebrown', [139, 69, 19]],
1927
- ['salmon', [250, 128, 114]],
1928
- ['sandybrown', [244, 164, 96]],
1929
- ['seagreen', [46, 139, 87]],
1930
- ['seashell', [255, 245, 238]],
1931
- ['sienna', [160, 82, 45]],
1932
- ['silver', [192, 192, 192]],
1933
- ['skyblue', [135, 206, 235]],
1934
- ['slateblue', [106, 90, 205]],
1935
- ['slategray', [112, 128, 144]],
1936
- ['slategrey', [112, 128, 144]],
1937
- ['snow', [255, 250, 250]],
1938
- ['springgreen', [0, 255, 127]],
1939
- ['steelblue', [70, 130, 180]],
1940
- ['tan', [210, 180, 140]],
1941
- ['teal', [0, 128, 128]],
1942
- ['thistle', [216, 191, 216]],
1943
- ['tomato', [255, 99, 71]],
1944
- ['turquoise', [64, 224, 208]],
1945
- ['violet', [238, 130, 238]],
1946
- ['wheat', [245, 222, 179]],
1947
- ['white', [255, 255, 255]],
1948
- ['whitesmoke', [245, 245, 245]],
1949
- ['yellow', [255, 255, 0]],
1950
- ['yellowgreen', [154, 205, 50]],
1951
- ['transparent', [0, 0, 0, 0]],
1952
- ];
1953
- console.assert(COLOR_TO_RGBA_ENTRIES.every(([nickname]) => nickname.toLowerCase() === nickname), 'All color nicknames must be lowercase.');
1954
- export const Nicknames = new Map(COLOR_TO_RGBA_ENTRIES);
1955
- const RGBAToNickname = new Map(
1956
- // Default opacity to 1 if the color only specified 3 channels
1957
- COLOR_TO_RGBA_ENTRIES.map(([nickname, [r, g, b, a = 1]]) => {
1958
- return [String([r, g, b, a]), nickname];
1959
- }));
1960
- const LAYOUT_LINES_HIGHLIGHT_COLOR = [127, 32, 210];
1961
- export const PageHighlight = {
1962
- Content: Legacy.fromRGBA([111, 168, 220, .66]),
1963
- ContentLight: Legacy.fromRGBA([111, 168, 220, .5]),
1964
- ContentOutline: Legacy.fromRGBA([9, 83, 148]),
1965
- Padding: Legacy.fromRGBA([147, 196, 125, .55]),
1966
- PaddingLight: Legacy.fromRGBA([147, 196, 125, .4]),
1967
- Border: Legacy.fromRGBA([255, 229, 153, .66]),
1968
- BorderLight: Legacy.fromRGBA([255, 229, 153, .5]),
1969
- Margin: Legacy.fromRGBA([246, 178, 107, .66]),
1970
- MarginLight: Legacy.fromRGBA([246, 178, 107, .5]),
1971
- EventTarget: Legacy.fromRGBA([255, 196, 196, .66]),
1972
- Shape: Legacy.fromRGBA([96, 82, 177, 0.8]),
1973
- ShapeMargin: Legacy.fromRGBA([96, 82, 127, .6]),
1974
- CssGrid: Legacy.fromRGBA([0x4b, 0, 0x82, 1]),
1975
- LayoutLine: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, 1]),
1976
- GridBorder: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, 1]),
1977
- GapBackground: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, .3]),
1978
- GapHatch: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, .8]),
1979
- GridAreaBorder: Legacy.fromRGBA([26, 115, 232, 1]),
1980
- };
1981
- export const SourceOrderHighlight = {
1982
- ParentOutline: Legacy.fromRGBA([224, 90, 183, 1]),
1983
- ChildOutline: Legacy.fromRGBA([0, 120, 212, 1]),
1984
- };
1985
- export const IsolationModeHighlight = {
1986
- Resizer: Legacy.fromRGBA([222, 225, 230, 1]), // --color-background-elevation-2
1987
- ResizerHandle: Legacy.fromRGBA([166, 166, 166, 1]),
1988
- Mask: Legacy.fromRGBA([248, 249, 249, 1]),
1989
- };
1990
- export class Generator {
1991
- #hueSpace;
1992
- #satSpace;
1993
- #lightnessSpace;
1994
- #alphaSpace;
1995
- #colors = new Map();
1996
- constructor(hueSpace, satSpace, lightnessSpace, alphaSpace) {
1997
- this.#hueSpace = hueSpace || { min: 0, max: 360, count: undefined };
1998
- this.#satSpace = satSpace || 67;
1999
- this.#lightnessSpace = lightnessSpace || 80;
2000
- this.#alphaSpace = alphaSpace || 1;
2001
- }
2002
- setColorForID(id, color) {
2003
- this.#colors.set(id, color);
2004
- }
2005
- colorForID(id) {
2006
- let color = this.#colors.get(id);
2007
- if (!color) {
2008
- color = this.generateColorForID(id);
2009
- this.#colors.set(id, color);
2010
- }
2011
- return color;
2012
- }
2013
- generateColorForID(id) {
2014
- const hash = Platform.StringUtilities.hashCode(id);
2015
- const h = this.indexToValueInSpace(hash, this.#hueSpace);
2016
- const s = this.indexToValueInSpace(hash >> 8, this.#satSpace);
2017
- const l = this.indexToValueInSpace(hash >> 16, this.#lightnessSpace);
2018
- const a = this.indexToValueInSpace(hash >> 24, this.#alphaSpace);
2019
- const start = `hsl(${h}deg ${s}% ${l}%`;
2020
- if (a !== 1) {
2021
- return `${start} / ${Math.floor(a * 100)}%)`;
2022
- }
2023
- return `${start})`;
2024
- }
2025
- indexToValueInSpace(index, space) {
2026
- if (typeof space === 'number') {
2027
- return space;
2028
- }
2029
- const count = space.count || space.max - space.min;
2030
- index %= count;
2031
- return space.min + Math.floor(index / (count - 1) * (space.max - space.min));
2032
- }
2033
- }