Skip to content

Conversation

@gabrieldonadel
Copy link

Summary:

Merge up to the first commit on 0.83-stable branch from upstream (a034841).

Full list files where conflicts had to be manually resolved
  • README.md
  • package.json
  • packages/assets/package.json
  • packages/babel-plugin-codegen/package.json
  • packages/community-cli-plugin/package.json
  • packages/core-cli-utils/package.json
  • packages/debugger-frontend/package.json
  • packages/debugger-shell/package.json
  • packages/dev-middleware/package.json
  • packages/eslint-config-react-native/package.json
  • packages/eslint-plugin-react-native/package.json
  • packages/eslint-plugin-specs/package.json
  • packages/gradle-plugin/package.json
  • packages/metro-config/package.json
  • packages/new-app-screen/package.json
  • packages/normalize-color/package.json
  • packages/polyfills/package.json
  • packages/react-native-babel-preset/package.json
  • packages/react-native-babel-transformer/package.json
  • packages/react-native-codegen/package.json
  • packages/react-native-compatibility-check/package.json
  • packages/react-native-popup-menu-android/package.json
  • packages/react-native-test-library/ios/RCTSampleNativeComponentComponentView.mm
  • packages/react-native-test-library/ios/RCTSampleNativeComponentViewManager.mm
  • packages/react-native-test-library/package.json
  • packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
  • packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h
  • packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm
  • packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm
  • packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h
  • packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h
  • packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm
  • packages/react-native/Libraries/Components/Pressable/Pressable.js
  • packages/react-native/Libraries/Components/TextInput/TextInput.flow.js
  • packages/react-native/Libraries/Components/TextInput/TextInputState.js
  • packages/react-native/Libraries/Components/View/View.js
  • packages/react-native/Libraries/Components/View/ViewNativeComponent.js
  • packages/react-native/Libraries/Image/Image.ios.js
  • packages/react-native/Libraries/Image/RCTBundleAssetImageLoader.mm
  • packages/react-native/Libraries/Image/RCTImageBlurUtils.mm
  • packages/react-native/Libraries/Image/RCTImageLoader.mm
  • packages/react-native/Libraries/Image/RCTImageViewManager.mm
  • packages/react-native/Libraries/Image/RCTLocalAssetImageLoader.mm
  • packages/react-native/Libraries/Image/RCTUIImageViewAnimated.mm
  • packages/react-native/Libraries/LinkingIOS/RCTLinkingManager.mm
  • packages/react-native/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.mm
  • packages/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.mm
  • packages/react-native/Libraries/Text/Text.js
  • packages/react-native/Libraries/Text/Text/RCTTextView.h
  • packages/react-native/Libraries/Text/Text/RCTTextView.mm
  • packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.h
  • packages/react-native/Libraries/Text/TextInput/RCTInputAccessoryView.h
  • packages/react-native/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h
  • packages/react-native/Libraries/Text/VirtualText/RCTVirtualTextView.h
  • packages/react-native/Libraries/Utilities/tests/Platform-test.js
  • packages/react-native/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.h
  • packages/react-native/Libraries/Wrapper/RCTWrapper.h
  • packages/react-native/Libraries/Wrapper/RCTWrapperView.h
  • packages/react-native/Libraries/Wrapper/RCTWrapperViewControllerHostingView.h
  • packages/react-native/React/Base/RCTBridgeProxy.mm
  • packages/react-native/React/Base/RCTRootView.h
  • packages/react-native/React/CoreModules/RCTActionSheetManager.mm
  • packages/react-native/React/CoreModules/RCTDevLoadingView.mm
  • packages/react-native/React/CoreModules/RCTDevMenu.h
  • packages/react-native/React/CoreModules/RCTDevMenu.mm
  • packages/react-native/React/CoreModules/RCTDeviceInfo.mm
  • packages/react-native/React/CoreModules/RCTFPSGraph.mm
  • packages/react-native/React/CoreModules/RCTLogBoxView.h
  • packages/react-native/React/CoreModules/RCTLogBoxView.mm
  • packages/react-native/React/CoreModules/RCTPerfMonitor.mm
  • packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm
  • packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm
  • packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
  • packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
  • packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
  • packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewAccessibilityElement.h
  • packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewAccessibilityElement.mm
  • packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
  • packages/react-native/React/Fabric/Mounting/RCTComponentViewDescriptor.h
  • packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm
  • packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm
  • packages/react-native/React/Fabric/Utils/RCTBoxShadow.mm
  • packages/react-native/React/Modules/RCTUIManager.h
  • packages/react-native/React/Modules/RCTUIManager.mm
  • packages/react-native/React/Views/RCTActivityIndicatorView.m
  • packages/react-native/React/Views/RCTModalHostView.h
  • packages/react-native/React/Views/RCTModalHostView.m
  • packages/react-native/React/Views/RCTModalHostViewController.h
  • packages/react-native/React/Views/RCTModalHostViewController.m
  • packages/react-native/React/Views/RCTModalHostViewManager.h
  • packages/react-native/React/Views/RCTModalHostViewManager.m
  • packages/react-native/React/Views/RCTSwitch.h
  • packages/react-native/React/Views/RefreshControl/RCTRefreshControl.h
  • packages/react-native/React/Views/RefreshControl/RCTRefreshControl.m
  • packages/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m
  • packages/react-native/React/Views/SafeAreaView/RCTSafeAreaView.m
  • packages/react-native/React/Views/SafeAreaView/RCTSafeAreaViewManager.m
  • packages/react-native/React/Views/ScrollView/RCTScrollView.h
  • packages/react-native/React/Views/ScrollView/RCTScrollView.m
  • packages/react-native/React/Views/ScrollView/RCTScrollViewManager.h
  • packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
  • packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm
  • packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/RCTPlatformColorUtils.h
  • packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.h
  • packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.mm
  • packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm
  • packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h
  • packages/react-native/package.json
  • packages/react-native/sdks/hermes-engine/hermes-engine.podspec
  • packages/react-native/sdks/hermes-engine/hermes-utils.rb
  • packages/rn-tester/NativeComponentExample/ios/RNTMyLegacyNativeViewManager.mm
  • packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewManager.mm
  • packages/rn-tester/Podfile.lock
  • packages/rn-tester/RNTester/AppDelegate.mm
  • packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
  • packages/rn-tester/js/examples/Cursor/CursorExample.js
  • packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js
  • packages/rn-tester/package.json
  • packages/typescript-config/package.json
  • packages/virtualized-lists/package.json
  • private/helloworld/Gemfile
  • private/helloworld/Gemfile.lock
  • private/helloworld/package.json
  • private/react-native-codegen-typescript-test/package.json
  • yarn.lock

Test Plan:

Run RNTester locally

image

mdvacca and others added 30 commits October 1, 2025 17:22
Summary:
Pull Request resolved: facebook#54017

Fix test: publish-updated-packages-test
changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D83699726

fbshipit-source-id: 45f4713d18ed74a6b344f34ab9b3dd7760088fcc
Summary:
Pull Request resolved: facebook#54021

Adding missing `nextFocus*` props to the View props to enable correct Props 2.0 diffing.

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D83714902

fbshipit-source-id: 9b47ba5ea3e177e72b77b1df4b6b6082848c77a4
…renderer/attributedstring/TextAttributes.cpp (facebook#54024)

Summary: Pull Request resolved: facebook#54024

Reviewed By: rshest

Differential Revision: D83641704

fbshipit-source-id: 2d102bc1078a951aefee2097914477c6508cc988
…ithub/packages [A] (facebook#54026)

Summary: Pull Request resolved: facebook#54026

Reviewed By: javache

Differential Revision: D83719624

fbshipit-source-id: 9e43d15dd4b44c9c7b3be711d62541135031d1f8
…ithub/packages [A] (facebook#54027)

Summary: Pull Request resolved: facebook#54027

Reviewed By: javache

Differential Revision: D83703007

fbshipit-source-id: 36f08f1b48f52750065a39ef322cc675aa828f9e
…ithub/packages [B] (facebook#54025)

Summary: Pull Request resolved: facebook#54025

Reviewed By: rshest

Differential Revision: D83704348

fbshipit-source-id: 8f5e34aa1b344a30dfea26661ac7b71fa4b2ddb1
Summary:
Pull Request resolved: facebook#54010

Bump Metro minimum to 0.83.3

This release fixes a regression in loading config files that export promises.

Full changelog: https://github.com/facebook/metro/releases/tag/v0.83.3

Changelog:
[General][Changed] Metro bump to ^0.83.3

Reviewed By: vzaidman

Differential Revision: D83655569

fbshipit-source-id: 106a957620e4591ef3cce21d327886354913560b
Summary:
Pull Request resolved: facebook#54018

The DevMenu path for perf analyzing no-ops. This is due to incorrectly not inverting the bool result of `pauseAndAnalyzeBackgroundTrace()`. See https://www.internalfb.com/code/fbsource/%5Bfcebbc02e701%5D/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorOverlayManager.kt?lines=73-75.

{F1982418482}

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D83691623

fbshipit-source-id: a16e39b00c07b6846092cc29bc656a08a61d20bb
…book#54019)

Summary:
Pull Request resolved: facebook#54019

Currently the performance monitor flickers on boot if there's no metro connection. This change checks first if we have a packager before enabling the monitor.

No metro connection:
{F1982423105}

Metro connection:
{F1982423112}

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D83701372

fbshipit-source-id: d099880d3ab509942a937a6bde11ebdde13450cd
…acebook#54029)

Summary:
Pull Request resolved: facebook#54029

Changelog: [Android][Fixed] Fixed `SoLoader` race condition in `InspectorNetworkRequestListener`

When enabling `LoadNetworkResrouce` with flag `nativeSourceCodeFetching` in `InspectorInterfaces.h`, running the app, and opening the debugger, the app was crashing with
```
No implementation found for void com.facebook.react.devsupport.inspector.InspectorNetworkRequestListener.onHeaders(int, java.util.Map)
(
tried
  Java_com_facebook_react_devsupport_inspector_InspectorNetworkRequestListener_onHeaders
and
  Java_com_facebook_react_devsupport_inspector_InspectorNetworkRequestListener_onHeaders__ILjava_util_Map_2
) - is the library loaded, e.g. System.loadLibrary?
```

Reviewed By: huntie

Differential Revision: D83741114

fbshipit-source-id: b878fb4680e6a51f9403e8dea2872da85254e024
Summary:
Pull Request resolved: facebook#54022

Perf monitor shows in a broken state if metro is started while the app is running. This change improves the tracing and monitor lifecycle around the metro connection events.

Before:
{F1982430185}

After:
{F1982430062}

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D83714223

fbshipit-source-id: 76826122924baa1a80c04dcc5ff18bc756a8e816
Summary:
Pull Request resolved: facebook#54023

Android 12 introduced a new AlertDialog that better fits a longer list of content.
Android 11 and earlier have an AlertDialog that has a very small list view, requiring users to scroll through to find what they need. This change also fixes Android 12+ enable/disable states on menu items, as it no longer uses `isEnabled` for styling.

Before:
{F1982416953}

After:
{F1982416486}

Android 12:
{F1982430956}

Changelog: [Internal]

Reviewed By: shwanton

Differential Revision: D83688775

fbshipit-source-id: a96120142f648e849be670bde5897c884f1f5f52
…ithub/packages [B] (facebook#54028)

Summary: Pull Request resolved: facebook#54028

Reviewed By: javache

Differential Revision: D83719979

fbshipit-source-id: 4d683f7f95b2dc8502653d22a9a1d9fd6ab03b81
…matedComponent.js` (facebook#54034)

Summary:
Pull Request resolved: facebook#54034

`React.ElementConfig` is often the better choice. See https://flow.org/en/docs/react/types/#toc-react-elementprops

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D83750127

fbshipit-source-id: 788169d73cccc2ed7c9b250845ad7277fe79c47f
Summary:
Pull Request resolved: facebook#54035

`React.ElementConfig` is often the better choice. See https://flow.org/en/docs/react/types/#toc-react-elementprops

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D83749631

fbshipit-source-id: 81b21c1a0dced5bc578d3a5752c303b57b467f7b
…in new architecture (facebook#54038)

Summary:
Pull Request resolved: facebook#54038

This diff adds a Log error to discourage usages of getJSModule(RCTEventEmitter) in new architecture, recommending migration to new API

changelog: [Android][Changed] Add Log error to discourage usages of getJSModule(RCTEventEmitter) API

Reviewed By: shwanton

Differential Revision: D83523928

fbshipit-source-id: d967456087a59366a3bca9590cb4d6d1fdd5b60d
Summary:
Pull Request resolved: facebook#54044

In rare cases, there may be a vertical ScrollView nested inside another vertical ScrollView. In these cases, when the requestChildFocus method is called, we may attempt to bring the entire focused child into view. However, we really only want to bring the entire nested ScrollView into view.

## Changelog

[Android][Fixed] Focused scroll into view behaviors for nested vertical scroll views

Reviewed By: bvanderhoof

Differential Revision: D83804043

fbshipit-source-id: 8df8f637e7f908cc283f55c0d78ee03ed3bb9117
Summary:
Pull Request resolved: facebook#54039

Adding toDynamic conversion to `ColorStop` and `ValueUnit` structs which are being used by the linear and radial gradient data structures.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D83788006

fbshipit-source-id: 1ec0300ac4f17b65b6896d4d2c131eb05a059a22
Summary:
Pull Request resolved: facebook#54040

Implement toDynamic conversion of the LinearGradient following the parse logic as described here: https://www.internalfb.com/code/fbsource/[5fa7eb2b733a]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LinearGradient.kt?lines=24-76

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D83788005

fbshipit-source-id: 9114451b12e31ad86abde54dbe2c8819a304e777
Summary:
Pull Request resolved: facebook#54041

Implement toDynamic conversion of the RadialGradient following the parse logic as described here: https://www.internalfb.com/code/fbsource/[28de0c66daab]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt?lines=33-129

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D83788007

fbshipit-source-id: 305e6f5011f16103a559132e61b6d4eae24cc137
Summary:
Pull Request resolved: facebook#54042

Update the View component props to diff the `backgroundImage` property and assign the value to `experimental_backgroundImage` which maps to the `backgroundImage` property on the Android `ReactViewManager`.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D83788008

fbshipit-source-id: 5f9d93403af483c9494d2782aedad604cbb7cbbc
…renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.cpp (facebook#54054)

Summary: Pull Request resolved: facebook#54054

Reviewed By: rshest

Differential Revision: D83735540

fbshipit-source-id: e4284fdb76344584a983cfd242c2463912f3a6bf
Summary:
Pull Request resolved: facebook#54047

TSIA

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D83825727

fbshipit-source-id: a4a8ffc38571596985ae2687142dbc8a974be39c
…4049)

Summary:
Pull Request resolved: facebook#54049

Changelog: [Internal]

Adds `JsiIntegrationTest`-based tests for the C++ layer responsible for handling the CDP `Network` domain. The tests use `NetworkReporter` to mimic the behaviour of a React Native platform that is generating network events.

NOTE: There are **significant problems** with the `NetworkReporter` / `NetworkHandler` singleton design: cross-Host and cross-Instance data pollution/corruption, inability to inspect multiple Hosts at once, inconsistency between the singleton's state and the CDP session's state, etc. The singletons similarly lack any kind of mechanism for test isolation (e.g. methods for clearing state between tests). As we iteratively fix these problems, the tests will require updating (and we'll be able to write stricter tests to cover the fixes).

Reviewed By: huntie

Differential Revision: D83746505

fbshipit-source-id: 7ee3c68e67f0d29587cbfafa98cf107d27065ffc
Summary:
Pull Request resolved: facebook#54036

We are migrating away from the older V1 macros to the V2 macros, which have better code-stripped functionality and less business logic embedded in the API.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D83760301

fbshipit-source-id: b6c9ea155ebe22d6d4ce023a1dbb2cfd52fb8394
Summary:
Pull Request resolved: facebook#53983

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D83525759

fbshipit-source-id: 0a223a54339496e4e85ecb173b3c7e0012c4fba8
Summary:
This change remove some unnecessary logs and improve the logging functions for the prebuilds

bypass-github-export-checks

## Changelog:

[IOS] [CHANGED] - Updated logging functions for prebuilds

Pull Request resolved: facebook#53976

Test Plan:
Run:
```
RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install
```

Reviewed By: christophpurrer

Differential Revision: D83481709

Pulled By: cipolleschi

fbshipit-source-id: bad358c6e6abfcb1568344e5161109dff7ee06ab
Summary:
Pull Request resolved: facebook#54031

This commit updates the cocoapods source for RNDependencies so that the source for the package is the locally downloaded file so we don't download twice!

## Changelog:

[IOS] [FIXED] - Update the `source`property to avoid multiple downloads

Test Plan:
Run:
```
RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install
```

Multiple times and observe that the dependencies are not downloaded multiple times.

Reviewed By: christophpurrer

Differential Revision: D83753188

Pulled By: cipolleschi

fbshipit-source-id: e3fedca921b0ff9ba10ec3e5a7ba18dfbdffc3ba
…ebook#54032)

Summary:
Pull Request resolved: facebook#54032

This commit adds building blocks to support the symbolication of the XCFrameworks on request.

Symbol files are big and only needed if you need to debug React Native itself - f.ex. if you are a framework developer like Expo.

This change introduces some helper function that are needed to handle the dSYMS:
- `processDSYMs` the main function that unzip the symbols and prepare the framework for them
- `remap_sourcemaps_for_symbols` a support function that creates a mapping symbol -> file so that the debug can interpret them properly
- `generate_plist_content` a support function that generates the plist with all the mappings

These functions are used in the next commit of the stack.

## Changelog:

[Internal] - Added building blocks to support symbolication

Test Plan:
These functions are used in the next commit.
We split the commit to simplify the review. See the Test plan of the next commit to test them.

Reviewed By: cortinico

Differential Revision: D83753189

Pulled By: cipolleschi

fbshipit-source-id: 5d8027f5393a4e5a11f1b736c9901d40e7c5139b
…ook#54033)

Summary:
Pull Request resolved: facebook#54033

This commit adds support for symbolication of the XCFrameworks on request.

Symbol files are big and only needed if you need to debug React Native itself - f.ex. if you are a framework developer like Expo.

Symbolication can be performed by setting the `RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS=1` environment variable. This will cause the `ReactNativeCoreUtils` class to download symbol files and symbolicate the XFrameworks by doing the following:

- After downloading the requested React.XCFramework the symbols will also be downloaded and places in the artifacts folder.
- The XCFrameworks will be expanded and the folders in the symbol archive will be extracted into the XCFramework before it is zipped up again.

<img width="400" alt="image" src="https://github.com/user-attachments/assets/ec8dd2e1-c7f8-4d5f-a3b6-b8ffbb678c95" />

## Changelog:

[IOS] [FIXED] - Added support for symbolication of precompiled React.xcframework

Test Plan:
```
RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS=1 RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install
```

Remember to clean (remove the Pods directory) before turning on/off.

Reviewed By: christophpurrer

Differential Revision: D83753187

Pulled By: cipolleschi

fbshipit-source-id: f1522e1befdea99fb8c65695322ea3ed68e6caed
rubennorte and others added 21 commits October 31, 2025 11:11
…4355)

Summary:
Pull Request resolved: facebook#54355

Changelog: [internal]

Small refactor to make sure profiling timespans don't break if there's an exception in one of the listeners.

Reviewed By: huntie

Differential Revision: D85951560

fbshipit-source-id: 162672a7e644893f46a3b0100284bc4125a83757
Summary:
Pull Request resolved: facebook#54354

Changelog: [internal]

This just renames the tracks for network, etc. to go under a "⚛ Native" track group.

Reviewed By: huntie

Differential Revision: D85946501

fbshipit-source-id: f7ea65bfd84ed4965749f7e22091bcaff38a5bc3
Summary:
Pull Request resolved: facebook#54353

Changelog: [internal]

We have support for the network track in performance traces so we no longer need this custom integration.

Reviewed By: huntie

Differential Revision: D85946500

fbshipit-source-id: 4efa132a6524af6595ddf9f8c2b5651959fa1f94
Summary:
Pull Request resolved: facebook#54357

Changelog: [Internal] - Ignore whether ScrollView enables subview clipping and just use the drawing rect for forwarding a clippingRect for VirtualView

Reviewed By: yungsters

Differential Revision: D85817030

fbshipit-source-id: e89298d106ec993ce1ca63131da002e0685c34dd
Summary:
Pull Request resolved: facebook#54360

## Changelog:

[General] [Fixed] - Fixing an issue with the error LogBox formatting on windows causing text to wrap

Reviewed By: rickhanlonii, yannickl

Differential Revision: D76845667

fbshipit-source-id: 4b1ce705396f9818cbe9be80d521478b5eba632b
Summary:
Pull Request resolved: facebook#54345

Added comprehensive KDoc documentation to the `FloatUtil` class and its public methods to improve code readability and developer experience.

The documentation explains:
- The purpose of epsilon-based floating-point comparison and why it's necessary
- The role of the EPSILON constant in determining equality
- Special case handling for NaN values (both considered equal when both are NaN)
- Null value handling in the nullable overload
- Method parameters and return values

This documentation will help developers understand the rationale behind using this utility instead of direct float equality comparisons, which can be unreliable due to floating-point precision issues.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85923748

fbshipit-source-id: d054099de3d9903801aadca4cfcd3127bb6d5297
…cebook#54346)

Summary:
Pull Request resolved: facebook#54346

Added comprehensive KDoc documentation to the BackgroundStyleApplicator class and all 25 public methods covering backgrounds, borders, outlines, and box shadows.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926890

fbshipit-source-id: 5a398bf8d57d6b6dff6b012ac225bc96d56e2573
Summary:
Pull Request resolved: facebook#54347

Added comprehensive KDoc documentation to the BlendModeHelper object and its public method for parsing CSS mix-blend-mode properties on Android Q+.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926891

fbshipit-source-id: bcafa6b02281d5265f59b34641847bc3b19d6604
…4348)

Summary:
Pull Request resolved: facebook#54348

Added comprehensive KDoc documentation to the ComponentNameResolver interface and its property providing access to registered component names.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926887

fbshipit-source-id: ae12629e27f88555c7876d3343a146b1b5c3dec0
Summary:
Pull Request resolved: facebook#54349

Added comprehensive KDoc documentation to the ComponentNameResolverBinding object and its JNI method for installing component name resolvers into the JavaScript runtime.

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926888

fbshipit-source-id: 253577d4c5d48bee22acb5666680becd4e632879
Summary:
Pull Request resolved: facebook#54350

Added comprehensive KDoc documentation to the FilterHelper object and its primary public method for parsing and applying CSS filter effects on Android S+ (API 31+).

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D85926889

fbshipit-source-id: e20bb0697753e710d66acc3ef4078ab009d6dc5d
…acebook#54344)

Summary:
Pull Request resolved: facebook#54344

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D85904478

fbshipit-source-id: 961d12bf1cbf04b9087a518531b20d87be3ccb63
Summary:
Pull Request resolved: facebook#54359

## Changelog:

[Internal] [Changed] [react-native][cxx animated] Avoid acquiring multiple locks in async node creation

Reviewed By: christophpurrer

Differential Revision: D85969336

fbshipit-source-id: bfc05d5b8b36318aec21e1ad966e21108978afd0
…cebook#54358)

Summary:
Pull Request resolved: facebook#54358

Improved the performance of getHashMapFromPropsReadableMap by replacing the iterator-based approach with direct key lookups. The function now directly checks for "transform" and "opacity" keys using hasKey() and getType() instead of iterating through all entries in the ReadableMap.

This optimization reduces the time complexity from O(n) to O(1) for the two specific keys we need, eliminating unnecessary iterations through irrelevant entries. Additionally, the ArrayList for transform is now pre-sized with the correct capacity to avoid reallocations.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D85967272

fbshipit-source-id: 7da60aa6383dd8b5b830f201d5bc66c7ab984572
…dle URL at runtime (facebook#54139)

Summary:
Following the [RFC](react-native-community/discussions-and-proposals#933), this PR adds new `setBundleSource` methods to `ReactHost` for modifying bundle URL at runtime. The first one with signature:

```Kotlin
public fun setBundleSource(debugServerHost: String, moduleName: String, queryBuilder: (Map<String, String>) -> Map<String, String> = { it })
```

takes debugServerHost (set in packager connection settings), moduleName (set in DevSupportManager's jsAppBundleName), and queryBuilder (set in packager connection settings). Before updating settings, the packager connection is closed to reset the packager client, which will be newly created during reload with updated configuration.

The second one for loading bundle from the file takes single `filePath` argument:

```Kotlin
public fun setBundleSource(filePath: String)
```

It sets `customBundleFilePath` in `DevSupportManager` which has priority over other methods of loading the bundle in `jsBundleLoader` and reloads `ReactHost`.

## Changelog:

[ANDROID][ADDED] - added new `setBundleSource` method to `ReactHost` for changing bundle URL at runtime.

Pull Request resolved: facebook#54139

Test Plan:
Started with running two Metro instances on ports `8081` and `8082` (first with white background, second with blue). Created a native button that toggles `debugServerHost` port and invokes  `setBundleSource`.

https://github.com/user-attachments/assets/7afe2cbc-6fef-44bc-930c-e9f9c4edd2bd

For setting bundle file path, generated JS bundle with different background comparing to the one serving by Metro. Moved file to the `app/files` directory in android emulator and configured native button to invoke a `setBundleSource(filePath)`.

https://github.com/user-attachments/assets/5e59d7b7-c6ae-475c-94e3-50d4ac69cf24

<details>

<summary>code:</summary>

Changing debug server host:

`RNTesterActivity.kt`:

```Kotlin
package com.facebook.react.uiapp

import android.content.res.Configuration
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.FrameLayout
import androidx.core.graphics.drawable.toDrawable
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.facebook.common.logging.FLog
import com.facebook.react.FBRNTesterEndToEndHelper
import com.facebook.react.ReactActivity
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import java.io.FileDescriptor
import java.io.PrintWriter

internal class RNTesterActivity : ReactActivity() {
  private var activePort = "8081"

  class RNTesterActivityDelegate(val activity: ReactActivity, mainComponentName: String) :
      DefaultReactActivityDelegate(activity, mainComponentName, fabricEnabled) {
    private val PARAM_ROUTE = "route"
    private lateinit var initialProps: Bundle

    override fun onCreate(savedInstanceState: Bundle?) {
      // Get remote param before calling super which uses it
      val bundle = activity.intent?.extras

      if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
        val routeUri = "rntester://example/${bundle.getString(PARAM_ROUTE)}Example"
        initialProps = Bundle().apply { putString("exampleFromAppetizeParams", routeUri) }
      }
      FBRNTesterEndToEndHelper.onCreate(activity.application)
      super.onCreate(savedInstanceState)
    }

    override fun getLaunchOptions() =
        if (this::initialProps.isInitialized) initialProps else Bundle()
  }

  private fun getButtonText(): String {
    return "Port: $activePort"
  }

  private fun setupPortButton(onClick: () -> Unit) {
    val portButton = Button(this).apply {
      text = getButtonText()
      setBackgroundColor(Color.rgb(0, 123, 255)) // Blue background
      setTextColor(Color.WHITE)
      setPadding(32, 16, 32, 16)
      textSize = 16f
      elevation = 8f
    }

    // Get the root view and add button to it
    val rootView = this.findViewById<FrameLayout>(android.R.id.content)
    val layoutParams = FrameLayout.LayoutParams(
      FrameLayout.LayoutParams.WRAP_CONTENT,
      FrameLayout.LayoutParams.WRAP_CONTENT
    ).apply {
      gravity = android.view.Gravity.TOP or android.view.Gravity.CENTER_HORIZONTAL
      topMargin = 200 // 50dp from top
    }

    rootView.addView(portButton, layoutParams)

    portButton.setOnClickListener {
      onClick()
      portButton.text = getButtonText()
    }
  }

  // set background color so it will show below transparent system bars on forced edge-to-edge
  private fun maybeUpdateBackgroundColor() {
    val isDarkMode =
        resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK ==
            Configuration.UI_MODE_NIGHT_YES

    val color =
        if (isDarkMode) {
          Color.rgb(11, 6, 0)
        } else {
          Color.rgb(243, 248, 255)
        }

    window?.setBackgroundDrawable(color.toDrawable())
  }

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    fullyDrawnReporter.addReporter()
    maybeUpdateBackgroundColor()

   reactDelegate?.reactHost?.let {
     setupPortButton {
       activePort = if (activePort == "8081") "8082" else "8081"
       reactHost.setBundleSource("10.0.2.2:$activePort", "js/RNTesterApp.android")
       // reactHost.setBundleSource("/data/user/0/com.facebook.react.uiapp/files/android.bundle")
     }
   }

    // register insets listener to update margins on the ReactRootView to avoid overlap w/ system
    // bars
    reactDelegate?.reactRootView?.let { rootView ->
      val insetsType: Int =
          WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()

      val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
        val insets = windowInsets.getInsets(insetsType)

        (view.layoutParams as FrameLayout.LayoutParams).apply {
          setMargins(insets.left, insets.top, insets.right, insets.bottom)
        }

        WindowInsetsCompat.CONSUMED
      }
      ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
    }
  }

  override fun onConfigurationChanged(newConfig: Configuration) {
    super.onConfigurationChanged(newConfig)

    // update background color on UI mode change
    maybeUpdateBackgroundColor()
  }

  override fun createReactActivityDelegate() = RNTesterActivityDelegate(this, mainComponentName)

  override fun getMainComponentName() = "RNTesterApp"

  override fun dump(
      prefix: String,
      fd: FileDescriptor?,
      writer: PrintWriter,
      args: Array<String>?,
  ) {
    FBRNTesterEndToEndHelper.maybeDump(prefix, writer, args)
  }
}

```

</detail>

Reviewed By: vzaidman

Differential Revision: D84713639

Pulled By: coado

fbshipit-source-id: e332751670df24a9994448c6972f55e656c1d7c1
Summary:
Setting `ENV['RCT_USE_PREBUILT_RNCORE'] = '1'` when running nightlies on iOS will result in the following error:

<img height="608" alt="image" src="https://github.com/user-attachments/assets/130112d7-d4d8-4934-be56-c020a4b204a6" />

The reason for this happening is that we precompile the iOS artifacts on CI using whatever version is set on main (by default version 1000). This works fine when using RCs and stable versions because before the publishing step we do a release commit (e.g facebook@57ff544), which updates the react-native version.

This can be easily mitigated by invoking the `set-rn-artifacts-version` CLI right before building the iOS prebuilds.

## Changelog:

[IOS] [FIXED] - Fix iOS version mismatch when using nightly prebuilds

Pull Request resolved: facebook#54370

Test Plan: Run `node ./scripts/releases/set-rn-artifacts-version.js --build-type` locally

Reviewed By: javache

Differential Revision: D86089144

Pulled By: cipolleschi

fbshipit-source-id: a5c296ea8e022e562f7898803ab37dc61ffd67b6
Summary:
While integrating nightlies in the main Expo repo, I noticed an issue where iOS builds would fail in release mode when setting `RCT_USE_RN_DEP=1`. The error was thrown by a failure in the `replace_dependencies_version` script given that during the pod install phase, we were not downloading the release artifacts for nightlies, only the debug ones.

## Changelog:

[IOS] [FIXED] - Fix using iOS nightly prebuilds in release mode

Pull Request resolved: facebook#54369

Test Plan:
1. run `RCT_DEPS_VERSION=nightly pod install`
2. Build the app in release mode

Reviewed By: javache

Differential Revision: D86089167

Pulled By: cipolleschi

fbshipit-source-id: ea9a608926ed0a9145e3e305e8a3210364e1d36c
Summary:
Pull Request resolved: facebook#54363

The calculus for active scroll maintainVisibleContentPosition is not isomorphic between ReactHorizontalScrollView and ReactScrollView. Additiionally, it doesn't make sense that we would use an x-offset in a y-offset calculation. This fixes a likely bug where the OverScroller's x-offset is used to compute the scroll animation update in ReactScrollView.recreateFlingAnimation.

## Changelog

[Android][Fixed] - Issue with restarting scroll in maintainVisibleContentPosition

Reviewed By: javache

Differential Revision: D86021007

fbshipit-source-id: 0d7febcbccd59df534bacbba7f1b5bb5085fa95f
@gabrieldonadel gabrieldonadel requested a review from a team as a code owner January 23, 2026 14:45
@@ -1 +1 @@
import*as e from"../../../../core/common/common.js";import*as t from"../../../../core/host/host.js";import*as n from"../../../../core/i18n/i18n.js";import*as o from"../../../../core/platform/platform.js";import*as i from"../../../../core/sdk/sdk.js";import*as r from"../../../../models/bindings/bindings.js";import*as s from"../../../visual_logging/visual_logging.js";import*as a from"../../legacy.js";import*as c from"../../../../models/breakpoints/breakpoints.js";import*as l from"../../../../models/text_utils/text_utils.js";import*as d from"../../../../models/workspace/workspace.js";var u={cssText:`.image-preview-container{background:transparent;text-align:center;border-spacing:0}.image-preview-container img{margin:6px 0;max-width:100px;max-height:100px;background-image:var(--image-file-checker);user-select:text;vertical-align:top;-webkit-user-drag:auto}.image-container{padding:0}.image-container > div{min-height:50px;display:flex;align-items:center;justify-content:center;cursor:pointer}.image-container > div.start{justify-content:start}.image-preview-container .row{line-height:1.2;vertical-align:baseline}.image-preview-container .title{padding-right:0.5em;color:var(--sys-color-token-subtle);white-space:nowrap;&.start{text-align:start}&.center{text-align:end}}.image-preview-container .description{white-space:nowrap;text-align:left;color:var(--sys-color-on-surface)}.image-preview-container .description-link{max-width:20em}.image-preview-container .source-link{white-space:normal;word-break:break-all;color:var(--sys-color-primary);cursor:pointer}\n/*# sourceURL=${import.meta.resolve("./imagePreview.css")} */\n`};const p={unknownSource:"unknown source",imageFromS:"Image from {PH1}",fileSize:"File size:",intrinsicSize:"Intrinsic size:",renderedSize:"Rendered size:",currentSource:"Current source:",renderedAspectRatio:"Rendered aspect ratio:",intrinsicAspectRatio:"Intrinsic aspect ratio:"},g=n.i18n.registerUIStrings("ui/legacy/components/utils/ImagePreview.ts",p),h=n.i18n.getLocalizedString.bind(void 0,g);function m(t){return null!==t&&t.resourceType()===e.ResourceType.resourceTypes.Image}var k=Object.freeze({__proto__:null,ImagePreview:class{static async build(e,r,s,a={precomputedFeatures:void 0,imageAltText:void 0,align:"center"}){const{precomputedFeatures:c,imageAltText:l,align:d}=a;let g=i.ResourceTreeModel.ResourceTreeModel.resourceForURL(r),k=r;if(!m(g)&&c&&c.currentSrc&&(k=c.currentSrc,g=i.ResourceTreeModel.ResourceTreeModel.resourceForURL(k)),!g||!m(g))return null;const C=g,b=g.displayName,L=g.content?g.content:g.url.split("base64,")[1],f=g.contentSize(),v=f||o.StringUtilities.base64ToSize(L),w=v>0?n.ByteUtilities.bytesToString(v):"";return await new Promise((e=>{const n=document.createElement("img");n.addEventListener("load",(function(){const i=document.createElement("div"),r=i.attachShadow({mode:"open"});r.createChild("style").textContent=u.cssText;const l=r.createChild("table");l.className="image-preview-container";const g=l.createChild("tr").createChild("td","image-container");g.colSpan=2;const m=g.createChild("div",` ${d}`);m.title=b,m.appendChild(n),m.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(k)}));const C=n.naturalWidth,L=n.naturalHeight,f=c?c.renderedWidth:C,v=c?c.renderedHeight:L;if(s){const e=l.createChild("tr","row");e.createChild("td",`title ${d}`).textContent=h(p.renderedSize),e.createChild("td","description").textContent=`${f} × ${v} px`;const t=l.createChild("tr","row");if(t.createChild("td",`title ${d}`).textContent=h(p.renderedAspectRatio),t.createChild("td","description").textContent=o.NumberUtilities.aspectRatio(f,v),v!==L||f!==C){const e=l.createChild("tr","row");e.createChild("td",`title ${d}`).textContent=h(p.intrinsicSize),e.createChild("td","description").textContent=`${C} × ${L} px`;const t=l.createChild("tr","row");t.createChild("td",`title ${d}`).textContent=h(p.intrinsicAspectRatio),t.createChild("td","description").textContent=o.NumberUtilities.aspectRatio(C,L)}}if(!a.hideFileData){const e=l.createChild("tr","row");e.createChild("td",`title ${d}`).textContent=h(p.fileSize),e.createChild("td","description").textContent=w;const n=l.createChild("tr","row");n.createChild("td",`title ${d}`).textContent=h(p.currentSource);const i=o.StringUtilities.trimMiddle(k,100),r=n.createChild("td","description description-link").createChild("span","source-link");r.textContent=i,r.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(k)}))}e(i)}),!1),n.addEventListener("error",(()=>e(null)),!1),l&&(n.alt=l),C.populateImageSource(n)}))}static async loadDimensionsForNode(e){if(!e.nodeName()||"img"!==e.nodeName().toLowerCase())return;const t=await e.resolveToObject("");if(!t)return;const n=await t.callFunctionJSON((function(){return{renderedWidth:this.width,renderedHeight:this.height,currentSrc:this.currentSrc}}),void 0);return t.release(),n}static defaultAltTextForImageURL(t){const n=new e.ParsedURL.ParsedURL(t),o=n.isValid?n.displayName:h(p.unknownSource);return h(p.imageFromS,{PH1:o})}}}),C={cssText:`:host{display:inline}:host(.width-constrained){display:inline-block;width:100%}.stack-preview-async-description{padding:3px 0 1px;font-weight:bold}.stack-preview-container{--display-ignored-row:none;--display-toggle-link:var(--override-display-stack-preview-toggle-link,none);& > tfoot > tr{font-style:italic;display:var(--display-toggle-link)}& > tbody{display:var(--override-display-stack-preview-tbody,table-row-group);& > tr{height:16px;line-height:16px;&:has(td.link > .ignore-list-link){opacity:60%;display:var(--display-ignored-row)}}&:has(tr > td.link > .ignore-list-link){&:not(:has(tr > td.link > .devtools-link:not(.ignore-list-link))){.stack-preview-async-row{display:var(--display-ignored-row)}}}}&:not(:has(tbody > tr > td.link > .devtools-link:not(.ignore-list-link))),\n &.show-hidden-rows{--display-ignored-row:table-row}&:has(tbody > tr > td.link > .ignore-list-link):has(tbody > tr > td.link > .devtools-link:not(.ignore-list-link)){--display-toggle-link:table-row}td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-inline:2px;&.link{overflow:visible;& > button.text-button.devtools-link{background-color:inherit}}}&.width-constrained{display:block;width:100%;td.link{width:100%;max-width:0}}.function-name{max-width:80em}&.show-hidden-rows > tfoot > tr.show-all-link{--display-toggle-link:none}&:not(.show-hidden-rows) > tfoot > tr.show-less-link{--display-toggle-link:none}}.css-inserted-text::before{content:attr(data-inserted-text)}\n/*# sourceURL=${import.meta.resolve("./jsUtils.css")} */\n`};const b={unknown:"(unknown)",auto:"auto",revealInS:"Reveal in {PH1}",reveal:"Reveal",openUsingS:"Open using {PH1}",linkHandling:"Link handling:"},L=n.i18n.registerUIStrings("ui/legacy/components/utils/Linkifier.ts",b),f=n.i18n.getLocalizedString.bind(void 0,L),v=new Set;let w=null;const y=new WeakMap,I=new WeakMap,x=new WeakMap,S=new Map;let T,U;class N extends e.ObjectWrapper.ObjectWrapper{maxLength;anchorsByTarget=new Map;locationPoolByTarget=new Map;useLinkDecorator;#e;constructor(e,t){super(),this.maxLength=e||a.UIUtils.MaxLengthForDisplayedURLs,this.useLinkDecorator=Boolean(t),this.#e=new WeakMap,v.add(this),i.TargetManager.TargetManager.instance().observeTargets(this),d.Workspace.WorkspaceImpl.instance().addEventListener(d.Workspace.Events.WorkingCopyChanged,this.#t,this),d.Workspace.WorkspaceImpl.instance().addEventListener(d.Workspace.Events.WorkingCopyCommitted,this.#t,this)}#t({data:{uiSourceCode:e}}){const t=y.get(e);if(t)for(const e of t){const t=this.#e.get(e);t&&t.call(this,e)}}static setLinkDecorator(e){console.assert(!w,"Cannot re-register link decorator."),w=e,e.addEventListener("LinkIconChanged",(function(e){const t=e.data,n=y.get(t)||[];for(const e of n)N.updateLinkDecorations(e)}));for(const e of v)e.updateAllAnchorDecorations()}updateAllAnchorDecorations(){for(const e of this.anchorsByTarget.values())for(const t of e)N.updateLinkDecorations(t)}static bindUILocation(e,t){const n=N.linkInfo(e);if(!n)return;if(n.uiLocation=t,!t)return;const o=t.uiSourceCode;let i=y.get(o);i||(i=new Set,y.set(o,i)),i.add(e)}static bindUILocationForTest(e,t){N.bindUILocation(e,t)}static unbindUILocation(e){const t=N.linkInfo(e);if(!t?.uiLocation)return;const n=t.uiLocation.uiSourceCode;t.uiLocation=null;const o=y.get(n);o&&o.delete(e)}static bindBreakpoint(e,t){const n=N.linkInfo(e);if(!n)return;const o=c.BreakpointManager.BreakpointManager.instance().findBreakpoint(t);o&&(n.revealable=o)}static unbindBreakpoint(e){const t=N.linkInfo(e);t?.revealable&&(t.revealable=null)}targetAdded(e){this.anchorsByTarget.set(e,[]),this.locationPoolByTarget.set(e,new r.LiveLocation.LiveLocationPool)}targetRemoved(e){const t=this.locationPoolByTarget.get(e);if(this.locationPoolByTarget.delete(e),!t)return;t.disposeAll();const n=this.anchorsByTarget.get(e);if(n){this.anchorsByTarget.delete(e);for(const e of n){const t=N.linkInfo(e);if(!t)continue;t.liveLocation=null,N.unbindUILocation(e);const n=t.fallback;n&&e.replaceWith(n)}}}maybeLinkifyScriptLocation(e,t,n,o,s){let a=null;const c={lineNumber:o,maxLength:this.maxLength,columnNumber:s?.columnNumber,showColumnNumber:Boolean(s?.showColumnNumber),className:s?.className,tabStop:s?.tabStop,inlineFrameIndex:s?.inlineFrameIndex??0,userMetric:s?.userMetric,jslogContext:s?.jslogContext||"script-location",omitOrigin:s?.omitOrigin},{columnNumber:l,className:d=""}=c;if(n&&(a=N.linkifyURL(n,c)),!e||e.isDisposed())return a;const u=e.model(i.DebuggerModel.DebuggerModel);if(!u)return a;const p=t?u.createRawLocationByScriptId(t,o||0,l,c.inlineFrameIndex):u.createRawLocationByURL(n,o||0,l,c.inlineFrameIndex,!0);if(!p)return a;const g={tabStop:s?.tabStop,jslogContext:"script-location"},{link:h,linkInfo:m}=N.createLink(a?.textContent?a.textContent:"",d,g);m.enableDecorator=this.useLinkDecorator,m.fallback=a,m.userMetric=s?.userMetric;const k=this.locationPoolByTarget.get(p.debuggerModel.target());if(!k)return a;const C={showColumnNumber:c.showColumnNumber??!1,revealBreakpoint:s?.revealBreakpoint};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createLiveLocation(p,(async e=>{await this.updateAnchor(h,C,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),k).then((e=>{e&&(m.liveLocation=e)}));return this.anchorsByTarget.get(p.debuggerModel.target()).push(h),h}linkifyScriptLocation(e,t,n,o,i){const r=this.maybeLinkifyScriptLocation(e,t,n,o,i),s={lineNumber:o,maxLength:this.maxLength,className:i?.className,columnNumber:i?.columnNumber,showColumnNumber:Boolean(i?.showColumnNumber),inlineFrameIndex:i?.inlineFrameIndex??0,tabStop:i?.tabStop,userMetric:i?.userMetric,jslogContext:i?.jslogContext||"script-source-url"};return r||N.linkifyURL(n,s)}linkifyRawLocation(e,t,n){return this.linkifyScriptLocation(e.debuggerModel.target(),e.scriptId,t,e.lineNumber,{columnNumber:e.columnNumber,className:n,inlineFrameIndex:e.inlineFrameIndex})}maybeLinkifyConsoleCallFrame(e,t,n){const o={...n,columnNumber:t.columnNumber,inlineFrameIndex:n?.inlineFrameIndex??0};return this.maybeLinkifyScriptLocation(e,String(t.scriptId),t.url,t.lineNumber,o)}linkifyStackTraceTopFrame(e,t){console.assert(t.callFrames.length>0);const{url:n,lineNumber:o,columnNumber:s}=t.callFrames[0],a=N.linkifyURL(n,{lineNumber:o,columnNumber:s,showColumnNumber:!1,inlineFrameIndex:0,maxLength:this.maxLength,preventClick:!0,jslogContext:"script-source-url"});if(!e)return a;const c=this.locationPoolByTarget.get(e);if(!c)return console.assert(e.isDisposed()),a;console.assert(!e.isDisposed());const l=e.model(i.DebuggerModel.DebuggerModel),{link:d,linkInfo:u}=N.createLink("","",{jslogContext:"script-location"});u.enableDecorator=this.useLinkDecorator,u.fallback=a;const p={showColumnNumber:!1};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createStackTraceTopFrameLiveLocation(l.createRawLocationsByStackTrace(t),(async e=>{await this.updateAnchor(d,p,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),c).then((e=>{u.liveLocation=e}));return this.anchorsByTarget.get(e).push(d),d}linkifyCSSLocation(e,t){const{link:n,linkInfo:o}=N.createLink("",t||"",{tabStop:!0,jslogContext:"css-location"});o.enableDecorator=this.useLinkDecorator;const i=this.locationPoolByTarget.get(e.cssModel().target());if(!i)return n;const s={showColumnNumber:!1};r.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().createLiveLocation(e,(async e=>{await this.updateAnchor(n,s,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),i).then((e=>{o.liveLocation=e}));return this.anchorsByTarget.get(e.cssModel().target()).push(n),n}reset(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e),this.targetAdded(e);this.listeners?.clear()}dispose(){d.Workspace.WorkspaceImpl.instance().removeEventListener(d.Workspace.Events.WorkingCopyChanged,this.#t,this),d.Workspace.WorkspaceImpl.instance().removeEventListener(d.Workspace.Events.WorkingCopyCommitted,this.#t,this);for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e);i.TargetManager.TargetManager.instance().unobserveTargets(this),v.delete(this)}async updateAnchor(t,n,o){N.unbindUILocation(t),n.revealBreakpoint&&N.unbindBreakpoint(t);const i=await o.uiLocation();if(!i){if(o instanceof r.CSSWorkspaceBinding.LiveLocation){const n=o.header();n?.ownerNode&&(t.addEventListener("click",(t=>{t.consume(!0),e.Revealer.reveal(n.ownerNode||null)}),!1),N.setTrimmedText(t,"<style>"))}return t.classList.add("invalid-link"),void t.removeAttribute("role")}N.bindUILocation(t,i),n.revealBreakpoint&&N.bindBreakpoint(t,i);const s=i.linkText(!0,n.showColumnNumber);N.setTrimmedText(t,s,this.maxLength),this.#e.set(t,(function(e){this.updateAnchor(e,n,o)}));let c=i.uiSourceCode.url();"application/wasm"===i.uiSourceCode.mimeType()?"number"==typeof i.columnNumber&&(c+=`:0x${i.columnNumber.toString(16)}`):(c+=":"+(i.lineNumber+1),n.showColumnNumber&&"number"==typeof i.columnNumber&&(c+=":"+(i.columnNumber+1))),a.Tooltip.Tooltip.install(t,c),t.classList.toggle("ignore-list-link",await o.isIgnoreListed()),N.updateLinkDecorations(t)}static updateLinkDecorations(e){const t=N.linkInfo(e);if(!t?.enableDecorator)return;if(!w||!t.uiLocation)return;t.icon?.parentElement&&e.removeChild(t.icon);const n=w.linkIcon(t.uiLocation.uiSourceCode);n&&(n.style.setProperty("margin-right","2px"),e.insertBefore(n,e.firstChild)),t.icon=n}static linkifyURL(t,n){const o=(n=n||{showColumnNumber:!1,inlineFrameIndex:0}).text,i=n.className||"",s=n.lineNumber,c=n.columnNumber,l=n.showColumnNumber,d=n.preventClick,u=n.maxLength||a.UIUtils.MaxLengthForDisplayedURLs,p=n.bypassURLTrimming,g=n.omitOrigin;if(!t||e.ParsedURL.schemeIs(t,"javascript:")){const e=document.createElement("span");return i&&(e.className=i),e.textContent=o||t||f(b.unknown),e}let h=o||r.ResourceUtils.displayNameForURL(t);if(g){const e=URL.parse(t);e&&(h=t.replace(e.origin,""))}"number"!=typeof s||o||(h+=":"+(s+1),l&&"number"==typeof c&&(h+=":"+(c+1)));const m={maxLength:u,title:h!==t?t:"",href:t,preventClick:d,tabStop:n.tabStop,bypassURLTrimming:p,jslogContext:n.jslogContext||"url"},{link:k,linkInfo:C}=N.createLink(h,i,m);return s&&(C.lineNumber=s),c&&(C.columnNumber=c),C.userMetric=n?.userMetric,k}static linkifyRevealable(e,t,n,o,i,r){const s={maxLength:a.UIUtils.MaxLengthForDisplayedURLs,href:n,title:o,jslogContext:r},{link:c,linkInfo:l}=N.createLink(t,i||"",s);return l.revealable=e,c}static createLink(e,t,n={}){const{maxLength:o,title:i,href:r,preventClick:c,tabStop:l,bypassURLTrimming:d,jslogContext:u}=n,p=document.createElement(n.preventClick?"span":"button");t&&(p.className=t),p.classList.add("devtools-link"),n.preventClick||p.classList.add("text-button","link-style"),i&&a.Tooltip.Tooltip.install(p,i),r&&(p.href=r),p.setAttribute("jslog",`${s.link(u).track({click:!0})}`),e instanceof HTMLElement?p.appendChild(e):d?(p.classList.add("devtools-link-styled-trim"),N.appendTextWithoutHashes(p,e)):N.setTrimmedText(p,e,o);const g={icon:null,enableDecorator:!1,uiLocation:null,liveLocation:null,url:r||null,lineNumber:null,columnNumber:null,inlineFrameIndex:0,revealable:null,fallback:null};return I.set(p,g),c?p.classList.add("devtools-link-prevent-click"):p.addEventListener("click",(e=>{N.handleClick(e)&&e.consume(!0)}),!1),a.ARIAUtils.markAsLink(p),p.tabIndex=l?0:-1,{link:p,linkInfo:g}}static setTrimmedText(e,t,n){if(e.removeChildren(),n&&t.length>n){const o=function(e,t){let n=Math.floor(t/2),o=e.length-Math.ceil(t/2)+1;const i=e.codePointAt(o-1);void 0!==i&&i>=65536&&(o++,n++);const r=e.codePointAt(n-1);void 0!==r&&n>0&&r>=65536&&n--;return[e.substring(0,n),e.substring(n,o),e.substring(o)]}(t,n);N.appendTextWithoutHashes(e,o[0]),N.appendHiddenText(e,o[1]),N.appendTextWithoutHashes(e,o[2])}else N.appendTextWithoutHashes(e,t)}static appendTextWithoutHashes(e,t){const n=l.TextUtils.Utils.splitStringByRegexes(t,[/[a-f0-9]{20,}/g]);for(const t of n)-1===t.regexIndex?a.UIUtils.createTextChild(e,t.value):(a.UIUtils.createTextChild(e,t.value.substring(0,7)),N.appendHiddenText(e,t.value.substring(7)))}static appendHiddenText(e,t){const n=a.UIUtils.createTextChild(e.createChild("span","devtools-link-ellipsis"),"…");x.set(n,t)}static untruncatedNodeText(e){return x.get(e)||e.textContent||""}static linkInfo(e){return e&&I.get(e)||null}static handleClick(e){const t=e.currentTarget;if(a.UIUtils.isBeingEdited(e.target)||t.hasSelection())return!1;const n=N.linkInfo(t);return!!n&&N.invokeFirstAction(n)}static handleClickFromNewComponentLand(e){N.invokeFirstAction(e)}static invokeFirstAction(e){const n=N.linkActions(e);return!!n.length&&(n[0].handler.call(null),e.userMetric&&t.userMetrics.actionTaken(e.userMetric),!0)}static linkHandlerSetting(){return T||(T=e.Settings.Settings.instance().createSetting("open-link-handler",f(b.auto))),T}static registerLinkHandler(e,t){S.set(e,t),D.instance().update()}static unregisterLinkHandler(e){S.delete(e),D.instance().update()}static uiLocation(e){const t=N.linkInfo(e);return t?t.uiLocation:null}static linkActions(n){const i=[];if(!n)return i;let s=o.DevToolsPath.EmptyUrlString,c=null;if(n.uiLocation)c=n.uiLocation,s=c.uiSourceCode.contentURL();else if(n.url){s=n.url;const t=d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(s)||d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.ParsedURL.ParsedURL.urlWithoutHash(s));c=t?t.uiLocation(n.lineNumber||0,n.columnNumber||0):null}const l=s?r.ResourceUtils.resourceForURL(s):null,u=c?c.uiSourceCode:l,p=n.revealable||c||l;if(p){const t=e.Revealer.revealDestination(p);i.push({section:"reveal",title:t?f(b.revealInS,{PH1:t}):f(b.reveal),jslogContext:"reveal",handler:()=>e.Revealer.reveal(p)})}if(u){const e=c?c.lineNumber:n.lineNumber||0;for(const t of S.keys()){const n=S.get(t);if(!n)continue;const o={section:"reveal",title:f(b.openUsingS,{PH1:t}),jslogContext:"open-using",handler:n.bind(null,u,e)};t===N.linkHandlerSetting().get()?i.unshift(o):i.push(o)}}if((l||n.url)&&(i.push({section:"reveal",title:a.UIUtils.openLinkExternallyLabel(),jslogContext:"open-in-new-tab",handler:()=>a.UIUtils.openInNewTab(s)}),i.push({section:"clipboard",title:a.UIUtils.copyLinkAddressLabel(),jslogContext:"copy-link-address",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(s)})),c?.uiSourceCode){const e=c.uiSourceCode;i.push({section:"clipboard",title:a.UIUtils.copyFileNameLabel(),jslogContext:"copy-file-name",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.displayName())})}return i}}class D{element;constructor(){this.element=document.createElement("select"),this.element.addEventListener("change",this.onChange.bind(this),!1),this.update()}static instance(e={forceNew:null}){const{forceNew:t}=e;return U&&!t||(U=new D),U}update(){this.element.removeChildren();const e=[...S.keys()];e.unshift(f(b.auto));for(const t of e){const e=document.createElement("option");e.textContent=t,e.selected=t===N.linkHandlerSetting().get(),this.element.appendChild(e)}this.element.disabled=e.length<=1}onChange(e){if(!e.target)return;const t=e.target.value;N.linkHandlerSetting().set(t)}settingElement(){return a.SettingsUI.createCustomSetting(f(b.linkHandling),this.element)}}let R=!1;R||(R=!0,window.addEventListener("linkifieractivated",(function(e){const t=e;N.handleClickFromNewComponentLand(t.data)})));var F=Object.freeze({__proto__:null,ContentProviderContextMenuProvider:class{appendApplicableItems(n,o,r){const s=r.contentURL();if(s){e.ParsedURL.schemeIs(s,"file:")||o.revealSection().appendItem(a.UIUtils.openLinkExternallyLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(s.endsWith(":formatted")?e.ParsedURL.ParsedURL.slice(s,0,s.lastIndexOf(":")):s)),{jslogContext:"open-in-new-tab"});for(const e of S.keys()){const t=S.get(e);t&&o.revealSection().appendItem(f(b.openUsingS,{PH1:e}),t.bind(null,r,0),{jslogContext:"open-using"})}r instanceof i.NetworkRequest.NetworkRequest||(o.clipboardSection().appendItem(a.UIUtils.copyLinkAddressLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(s)),{jslogContext:"copy-link-address"}),r instanceof d.UISourceCode.UISourceCode?o.clipboardSection().appendItem(a.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName())),{jslogContext:"copy-file-name"}):o.clipboardSection().appendItem(a.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName)),{jslogContext:"copy-file-name"}))}}},LinkContextMenuProvider:class{appendApplicableItems(e,t,n){let o=n;for(;o&&!I.get(o);)o=o.parentNodeOrShadowHost();const i=o,r=N.linkInfo(i);if(!r)return;const s=N.linkActions(r);for(const e of s)t.section(e.section).appendItem(e.title,e.handler,{jslogContext:e.jslogContext})}},LinkHandlerSettingUI:D,Linkifier:N});const M={removeFromIgnore:"Remove from ignore list",addToIgnore:"Add script to ignore list",showMoreFrames:"Show ignore-listed frames",showLess:"Show less",unknownSource:"unknown"},E=n.i18n.registerUIStrings("ui/legacy/components/utils/JSPresentationUtils.ts",M),W=n.i18n.getLocalizedString.bind(void 0,E);function B(e,t){const n=new a.ContextMenu.ContextMenu(t);t.consume(!0);const o=N.uiLocation(e);o&&r.IgnoreListManager.IgnoreListManager.instance().canIgnoreListUISourceCode(o.uiSourceCode)&&(r.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(o.uiSourceCode.url())?n.debugSection().appendItem(W(M.removeFromIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().unIgnoreListUISourceCode(o.uiSourceCode)),{jslogContext:"remove-from-ignore-list"}):n.debugSection().appendItem(W(M.addToIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().ignoreListUISourceCode(o.uiSourceCode)),{jslogContext:"add-to-ignore-list"})),n.appendApplicableItems(t),n.show()}function j(t,n,o,r,c,l){const d=[];if(c){const t=new e.Throttler.Throttler(100);o.addEventListener("liveLocationUpdated",(()=>{t.schedule((async()=>c(d)))}))}function u(e,t=void 0){let c=null;t&&(c={asyncDescription:a.UIUtils.asyncStackTraceLabel(e.description,t)},d.push(c));let u=!1;for(const t of e.callFrames){const e=a.UIUtils.beautifyFunctionName(t.functionName),c=o.maybeLinkifyConsoleCallFrame(n,t,{showColumnNumber:l,tabStop:Boolean(r),inlineFrameIndex:0,revealBreakpoint:u});c&&(c.setAttribute("jslog",`${s.link("stack-trace").track({click:!0})}`),c.addEventListener("contextmenu",B.bind(null,c)),c.textContent||(c.textContent=W(M.unknownSource))),d.push({functionName:e,link:c}),u=[i.DebuggerModel.COND_BREAKPOINT_SOURCE_URL,i.DebuggerModel.LOGPOINT_SOURCE_URL].includes(t.url)}}u(t);let p=t.callFrames;for(let e=t.parent;e;e=e.parent)e.callFrames.length&&u(e,p),p=e.callFrames;return d}function H(e,t,n){e.removeChildren();const o=[];let i=null;for(const t of n){i&&!("asyncDescription"in t)||(i=e.createChild("tbody"));const n=i.createChild("tr");"asyncDescription"in t?(n.createChild("td").textContent="\n",n.createChild("td","stack-preview-async-description").textContent=t.asyncDescription,n.createChild("td"),n.createChild("td"),n.classList.add("stack-preview-async-row")):(n.createChild("td").textContent="\n",n.createChild("td","function-name").textContent=t.functionName,n.createChild("td").textContent=" @ ",t.link&&(n.createChild("td","link").appendChild(t.link),o.push(t.link)))}i=e.createChild("tfoot");const r=i.createChild("tr","show-all-link");r.createChild("td");const s=r.createChild("td");s.colSpan=4;const c=s.createChild("span","link");c.createChild("span","css-inserted-text").setAttribute("data-inserted-text",W(M.showMoreFrames)),c.addEventListener("click",(()=>{e.classList.add("show-hidden-rows"),t.classList.add("show-hidden-rows"),a.GlassPane.GlassPane.containerMoved(e)}),!1);const l=i.createChild("tr","show-less-link");l.createChild("td");const d=l.createChild("td");d.colSpan=4;const u=d.createChild("span","link");return u.createChild("span","css-inserted-text").setAttribute("data-inserted-text",W(M.showLess)),u.addEventListener("click",(()=>{e.classList.remove("show-hidden-rows"),t.classList.remove("show-hidden-rows"),a.GlassPane.GlassPane.containerMoved(e)}),!1),o}var A=Object.freeze({__proto__:null,buildStackTracePreviewContents:function(e,t,n={widthConstrained:!1,stackTrace:void 0,tabStops:void 0}){const{stackTrace:o,tabStops:i}=n,r=document.createElement("span");r.classList.add("monospace"),r.classList.add("stack-preview-container"),r.classList.toggle("width-constrained",n.widthConstrained),r.style.display="inline-block";const s=a.UIUtils.createShadowRootWithCoreStyles(r,{cssFile:C}).createChild("table","stack-preview-container");s.classList.toggle("width-constrained",n.widthConstrained);const c=H.bind(null,s,r);return{element:r,links:H(s,r,j(o??{callFrames:[]},e,t,i,c,n.showColumnNumber))}},buildStackTraceRows:j});var P=Object.freeze({__proto__:null,reload:function(){a.DockController.DockController.instance().canDock()&&"undocked"===a.DockController.DockController.instance().dockSide()&&t.InspectorFrontendHost.InspectorFrontendHostInstance.setIsDocked(!0,(function(){})),t.InspectorFrontendHost.InspectorFrontendHostInstance.reattach((()=>window.location.reload()))}});const _={websocketDisconnected:"WebSocket disconnected",websocketDisconnectedUnregisteredDevice:"The corresponding app for this DevTools session cannot be found. Please relaunch DevTools from the terminal.",websocketDisconnectedConnectionLost:"Connection lost to corresponding device.",websocketDisconnectedNewDebuggerOpened:"Disconnected due to opening a second DevTools window for the same app."},O=n.i18n.registerUIStrings("ui/legacy/components/utils/TargetDetachedDialog.ts",_),z=n.i18n.getLocalizedString.bind(void 0,O);class $ extends i.SDKModel.SDKModel{static hideCrashedDialog;constructor(e){super(e),e.registerInspectorDispatcher(this),e.inspectorAgent().invoke_enable(),e.parentTarget()?.type()===i.Target.Type.BROWSER&&$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}detached({reason:e}){a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(e)}static getCustomUiReason(e){return e?"1011"===e.code&&e.reason?.includes("[UNREGISTERED_DEVICE]")?z(_.websocketDisconnectedUnregisteredDevice):"1000"===e.code&&e.reason?.includes("[CONNECTION_LOST]")?z(_.websocketDisconnectedConnectionLost):"1000"===e.code&&e.reason?.includes("[NEW_DEBUGGER_OPENED]")?z(_.websocketDisconnectedNewDebuggerOpened):null:null}static connectionLost(e){const t=$.getCustomUiReason(e)||z(_.websocketDisconnected);a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(t,e)}targetCrashed(){if($.hideCrashedDialog)return;const e=this.target().parentTarget();if(e&&e.type()!==i.Target.Type.BROWSER)return;const t=new a.Dialog.Dialog("target-crashed");t.setSizeBehavior("MeasureContent"),t.addCloseButton(),t.setDimmed(!0),$.hideCrashedDialog=t.hide.bind(t),new a.TargetCrashedScreen.TargetCrashedScreen((()=>{$.hideCrashedDialog=null})).show(t.contentElement),t.show()}targetReloadedAfterCrash(){this.target().runtimeAgent().invoke_runIfWaitingForDebugger(),$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}}i.SDKModel.SDKModel.register($,{capabilities:2048,autostart:!0});var G=Object.freeze({__proto__:null,TargetDetachedDialog:$});export{k as ImagePreview,A as JSPresentationUtils,F as Linkifier,P as Reload,G as TargetDetachedDialog};
import*as e from"../../../../core/common/common.js";import*as t from"../../../../core/host/host.js";import*as n from"../../../../core/i18n/i18n.js";import*as o from"../../../../core/platform/platform.js";import*as i from"../../../../core/sdk/sdk.js";import*as r from"../../../../models/bindings/bindings.js";import*as s from"../../../visual_logging/visual_logging.js";import*as a from"../../legacy.js";import*as c from"../../../../models/breakpoints/breakpoints.js";import*as l from"../../../../models/text_utils/text_utils.js";import*as d from"../../../../models/workspace/workspace.js";var u={cssText:`.image-preview-container{background:transparent;text-align:center;border-spacing:0}.image-preview-container img{margin:6px 0;max-width:100px;max-height:100px;background-image:var(--image-file-checker);user-select:text;vertical-align:top;-webkit-user-drag:auto}.image-container{padding:0}.image-container > div{min-height:50px;display:flex;align-items:center;justify-content:center;cursor:pointer}.image-container > div.start{justify-content:start}.image-preview-container .row{line-height:1.2;vertical-align:baseline}.image-preview-container .title{padding-right:0.5em;color:var(--sys-color-token-subtle);white-space:nowrap;&.start{text-align:start}&.center{text-align:end}}.image-preview-container .description{white-space:nowrap;text-align:left;color:var(--sys-color-on-surface)}.image-preview-container .description-link{max-width:20em}.image-preview-container .source-link{white-space:normal;word-break:break-all;color:var(--sys-color-primary);cursor:pointer}\n/*# sourceURL=${import.meta.resolve("./imagePreview.css")} */\n`};const p={unknownSource:"unknown source",imageFromS:"Image from {PH1}",fileSize:"File size:",intrinsicSize:"Intrinsic size:",renderedSize:"Rendered size:",currentSource:"Current source:",renderedAspectRatio:"Rendered aspect ratio:",intrinsicAspectRatio:"Intrinsic aspect ratio:"},g=n.i18n.registerUIStrings("ui/legacy/components/utils/ImagePreview.ts",p),h=n.i18n.getLocalizedString.bind(void 0,g);function m(t){return null!==t&&t.resourceType()===e.ResourceType.resourceTypes.Image}var k=Object.freeze({__proto__:null,ImagePreview:class{static async build(e,r,s,a={precomputedFeatures:void 0,imageAltText:void 0,align:"center"}){const{precomputedFeatures:c,imageAltText:l,align:d}=a;let g=i.ResourceTreeModel.ResourceTreeModel.resourceForURL(r),k=r;if(!m(g)&&c&&c.currentSrc&&(k=c.currentSrc,g=i.ResourceTreeModel.ResourceTreeModel.resourceForURL(k)),!g||!m(g))return null;const C=g,b=g.displayName,f=g.content?g.content:g.url.split("base64,")[1],L=g.contentSize(),v=L||o.StringUtilities.base64ToSize(f),w=v>0?n.ByteUtilities.bytesToString(v):"";return await new Promise((e=>{const n=document.createElement("img");n.addEventListener("load",(function(){const i=document.createElement("div"),r=i.attachShadow({mode:"open"});r.createChild("style").textContent=u.cssText;const l=r.createChild("table");l.className="image-preview-container";const g=l.createChild("tr").createChild("td","image-container");g.colSpan=2;const m=g.createChild("div",` ${d}`);m.title=b,m.appendChild(n),m.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(k)}));const C=n.naturalWidth,f=n.naturalHeight,L=c?c.renderedWidth:C,v=c?c.renderedHeight:f;if(s){const e=l.createChild("tr","row");e.createChild("td",`title ${d}`).textContent=h(p.renderedSize),e.createChild("td","description").textContent=`${L} × ${v} px`;const t=l.createChild("tr","row");if(t.createChild("td",`title ${d}`).textContent=h(p.renderedAspectRatio),t.createChild("td","description").textContent=o.NumberUtilities.aspectRatio(L,v),v!==f||L!==C){const e=l.createChild("tr","row");e.createChild("td",`title ${d}`).textContent=h(p.intrinsicSize),e.createChild("td","description").textContent=`${C} × ${f} px`;const t=l.createChild("tr","row");t.createChild("td",`title ${d}`).textContent=h(p.intrinsicAspectRatio),t.createChild("td","description").textContent=o.NumberUtilities.aspectRatio(C,f)}}if(!a.hideFileData){const e=l.createChild("tr","row");e.createChild("td",`title ${d}`).textContent=h(p.fileSize),e.createChild("td","description").textContent=w;const n=l.createChild("tr","row");n.createChild("td",`title ${d}`).textContent=h(p.currentSource);const i=o.StringUtilities.trimMiddle(k,100),r=n.createChild("td","description description-link").createChild("span","source-link");r.textContent=i,r.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(k)}))}e(i)}),!1),n.addEventListener("error",(()=>e(null)),!1),l&&(n.alt=l),C.populateImageSource(n)}))}static async loadDimensionsForNode(e){if(!e.nodeName()||"img"!==e.nodeName().toLowerCase())return;const t=await e.resolveToObject("");if(!t)return;const n=await t.callFunctionJSON((function(){return{renderedWidth:this.width,renderedHeight:this.height,currentSrc:this.currentSrc}}),void 0);return t.release(),n}static defaultAltTextForImageURL(t){const n=new e.ParsedURL.ParsedURL(t),o=n.isValid?n.displayName:h(p.unknownSource);return h(p.imageFromS,{PH1:o})}}}),C={cssText:`:host{display:inline}:host(.width-constrained){display:inline-block;width:100%}.stack-preview-async-description{padding:3px 0 1px;font-weight:bold}.stack-preview-container{--display-ignored-row:none;--display-toggle-link:var(--override-display-stack-preview-toggle-link,none);& > tfoot > tr{font-style:italic;display:var(--display-toggle-link)}& > tbody{display:var(--override-display-stack-preview-tbody,table-row-group);& > tr{height:16px;line-height:16px;&:has(td.link > .ignore-list-link){opacity:60%;display:var(--display-ignored-row)}}&:has(tr > td.link > .ignore-list-link){&:not(:has(tr > td.link > .devtools-link:not(.ignore-list-link))){.stack-preview-async-row{display:var(--display-ignored-row)}}}}&:not(:has(tbody > tr > td.link > .devtools-link:not(.ignore-list-link))),\n &.show-hidden-rows{--display-ignored-row:table-row}&:has(tbody > tr > td.link > .ignore-list-link):has(tbody > tr > td.link > .devtools-link:not(.ignore-list-link)){--display-toggle-link:table-row}td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-inline:2px;&.link{overflow:visible;& > button.text-button.devtools-link{background-color:inherit}}}&.width-constrained{display:block;width:100%;td.link{width:100%;max-width:0}}.function-name{max-width:80em}&.show-hidden-rows > tfoot > tr.show-all-link{--display-toggle-link:none}&:not(.show-hidden-rows) > tfoot > tr.show-less-link{--display-toggle-link:none}}.css-inserted-text::before{content:attr(data-inserted-text)}\n/*# sourceURL=${import.meta.resolve("./jsUtils.css")} */\n`};const b={unknown:"(unknown)",auto:"auto",revealInS:"Reveal in {PH1}",reveal:"Reveal",openUsingS:"Open using {PH1}",linkHandling:"Link handling:"},f=n.i18n.registerUIStrings("ui/legacy/components/utils/Linkifier.ts",b),L=n.i18n.getLocalizedString.bind(void 0,f),v=new Set;let w=null;const y=new WeakMap,I=new WeakMap,x=new WeakMap,S=new Map;let T,U;class N extends e.ObjectWrapper.ObjectWrapper{maxLength;anchorsByTarget=new Map;locationPoolByTarget=new Map;useLinkDecorator;#e;constructor(e,t){super(),this.maxLength=e||a.UIUtils.MaxLengthForDisplayedURLs,this.useLinkDecorator=Boolean(t),this.#e=new WeakMap,v.add(this),i.TargetManager.TargetManager.instance().observeTargets(this),d.Workspace.WorkspaceImpl.instance().addEventListener(d.Workspace.Events.WorkingCopyChanged,this.#t,this),d.Workspace.WorkspaceImpl.instance().addEventListener(d.Workspace.Events.WorkingCopyCommitted,this.#t,this)}#t({data:{uiSourceCode:e}}){const t=y.get(e);if(t)for(const e of t){const t=this.#e.get(e);t&&t.call(this,e)}}static setLinkDecorator(e){console.assert(!w,"Cannot re-register link decorator."),w=e,e.addEventListener("LinkIconChanged",(function(e){const t=e.data,n=y.get(t)||[];for(const e of n)N.updateLinkDecorations(e)}));for(const e of v)e.updateAllAnchorDecorations()}updateAllAnchorDecorations(){for(const e of this.anchorsByTarget.values())for(const t of e)N.updateLinkDecorations(t)}static bindUILocation(e,t){const n=N.linkInfo(e);if(!n)return;if(n.uiLocation=t,!t)return;const o=t.uiSourceCode;let i=y.get(o);i||(i=new Set,y.set(o,i)),i.add(e)}static bindUILocationForTest(e,t){N.bindUILocation(e,t)}static unbindUILocation(e){const t=N.linkInfo(e);if(!t?.uiLocation)return;const n=t.uiLocation.uiSourceCode;t.uiLocation=null;const o=y.get(n);o&&o.delete(e)}static bindBreakpoint(e,t){const n=N.linkInfo(e);if(!n)return;const o=c.BreakpointManager.BreakpointManager.instance().findBreakpoint(t);o&&(n.revealable=o)}static unbindBreakpoint(e){const t=N.linkInfo(e);t?.revealable&&(t.revealable=null)}targetAdded(e){this.anchorsByTarget.set(e,[]),this.locationPoolByTarget.set(e,new r.LiveLocation.LiveLocationPool)}targetRemoved(e){const t=this.locationPoolByTarget.get(e);if(this.locationPoolByTarget.delete(e),!t)return;t.disposeAll();const n=this.anchorsByTarget.get(e);if(n){this.anchorsByTarget.delete(e);for(const e of n){const t=N.linkInfo(e);if(!t)continue;t.liveLocation=null,N.unbindUILocation(e);const n=t.fallback;n&&e.replaceWith(n)}}}maybeLinkifyScriptLocation(e,t,n,o,s){let a=null;const c={lineNumber:o,maxLength:this.maxLength,columnNumber:s?.columnNumber,showColumnNumber:Boolean(s?.showColumnNumber),className:s?.className,tabStop:s?.tabStop,inlineFrameIndex:s?.inlineFrameIndex??0,userMetric:s?.userMetric,jslogContext:s?.jslogContext||"script-location",omitOrigin:s?.omitOrigin},{columnNumber:l,className:d=""}=c;if(n&&(a=N.linkifyURL(n,c),a.dataset.fallbackAnchor="1"),!e||e.isDisposed())return a;const u=e.model(i.DebuggerModel.DebuggerModel);if(!u)return a;const p=t?u.createRawLocationByScriptId(t,o||0,l,c.inlineFrameIndex):u.createRawLocationByURL(n,o||0,l,c.inlineFrameIndex,!0);if(!p)return a;const g={tabStop:s?.tabStop,jslogContext:"script-location"},{link:h,linkInfo:m}=N.createLink(a?.textContent?a.textContent:"",d,g);m.enableDecorator=this.useLinkDecorator,m.fallback=a,m.userMetric=s?.userMetric;const k=this.locationPoolByTarget.get(p.debuggerModel.target());if(!k)return a;const C={showColumnNumber:c.showColumnNumber??!1,revealBreakpoint:s?.revealBreakpoint};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createLiveLocation(p,(async e=>{await this.updateAnchor(h,C,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),k).then((e=>{e&&(m.liveLocation=e)}));return this.anchorsByTarget.get(p.debuggerModel.target()).push(h),h}linkifyScriptLocation(e,t,n,o,i){const r=this.maybeLinkifyScriptLocation(e,t,n,o,i),s={lineNumber:o,maxLength:this.maxLength,className:i?.className,columnNumber:i?.columnNumber,showColumnNumber:Boolean(i?.showColumnNumber),inlineFrameIndex:i?.inlineFrameIndex??0,tabStop:i?.tabStop,userMetric:i?.userMetric,jslogContext:i?.jslogContext||"script-source-url"};return r||N.linkifyURL(n,s)}linkifyRawLocation(e,t,n){return this.linkifyScriptLocation(e.debuggerModel.target(),e.scriptId,t,e.lineNumber,{columnNumber:e.columnNumber,className:n,inlineFrameIndex:e.inlineFrameIndex})}maybeLinkifyConsoleCallFrame(e,t,n){const o={...n,columnNumber:t.columnNumber,inlineFrameIndex:n?.inlineFrameIndex??0};return this.maybeLinkifyScriptLocation(e,String(t.scriptId),t.url,t.lineNumber,o)}linkifyStackTraceTopFrame(e,t){console.assert(t.callFrames.length>0);const{url:n,lineNumber:o,columnNumber:s}=t.callFrames[0],a=N.linkifyURL(n,{lineNumber:o,columnNumber:s,showColumnNumber:!1,inlineFrameIndex:0,maxLength:this.maxLength,preventClick:!0,jslogContext:"script-source-url"});if(!e)return a;const c=this.locationPoolByTarget.get(e);if(!c)return console.assert(e.isDisposed()),a;console.assert(!e.isDisposed());const l=e.model(i.DebuggerModel.DebuggerModel),{link:d,linkInfo:u}=N.createLink("","",{jslogContext:"script-location"});u.enableDecorator=this.useLinkDecorator,u.fallback=a;const p={showColumnNumber:!1};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createStackTraceTopFrameLiveLocation(l.createRawLocationsByStackTrace(t),(async e=>{await this.updateAnchor(d,p,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),c).then((e=>{u.liveLocation=e}));return this.anchorsByTarget.get(e).push(d),d}linkifyCSSLocation(e,t){const{link:n,linkInfo:o}=N.createLink("",t||"",{tabStop:!0,jslogContext:"css-location"});o.enableDecorator=this.useLinkDecorator;const i=this.locationPoolByTarget.get(e.cssModel().target());if(!i)return n;const s={showColumnNumber:!1};r.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().createLiveLocation(e,(async e=>{await this.updateAnchor(n,s,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),i).then((e=>{o.liveLocation=e}));return this.anchorsByTarget.get(e.cssModel().target()).push(n),n}reset(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e),this.targetAdded(e);this.listeners?.clear()}dispose(){d.Workspace.WorkspaceImpl.instance().removeEventListener(d.Workspace.Events.WorkingCopyChanged,this.#t,this),d.Workspace.WorkspaceImpl.instance().removeEventListener(d.Workspace.Events.WorkingCopyCommitted,this.#t,this);for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e);i.TargetManager.TargetManager.instance().unobserveTargets(this),v.delete(this)}async updateAnchor(t,n,o){N.unbindUILocation(t),n.revealBreakpoint&&N.unbindBreakpoint(t);const i=await o.uiLocation();if(!i){if(o instanceof r.CSSWorkspaceBinding.LiveLocation){const n=o.header();n?.ownerNode&&(t.addEventListener("click",(t=>{t.consume(!0),e.Revealer.reveal(n.ownerNode||null)}),!1),N.setTrimmedText(t,"<style>"))}return t.classList.add("invalid-link"),void t.removeAttribute("role")}N.bindUILocation(t,i),n.revealBreakpoint&&N.bindBreakpoint(t,i);const s=i.linkText(!0,n.showColumnNumber);N.setTrimmedText(t,s,this.maxLength),this.#e.set(t,(function(e){this.updateAnchor(e,n,o)}));let c=i.uiSourceCode.url();"application/wasm"===i.uiSourceCode.mimeType()?"number"==typeof i.columnNumber&&(c+=`:0x${i.columnNumber.toString(16)}`):(c+=":"+(i.lineNumber+1),n.showColumnNumber&&"number"==typeof i.columnNumber&&(c+=":"+(i.columnNumber+1))),a.Tooltip.Tooltip.install(t,c),t.classList.toggle("ignore-list-link",await o.isIgnoreListed()),N.updateLinkDecorations(t)}static updateLinkDecorations(e){const t=N.linkInfo(e);if(!t?.enableDecorator)return;if(!w||!t.uiLocation)return;t.icon?.parentElement&&e.removeChild(t.icon);const n=w.linkIcon(t.uiLocation.uiSourceCode);n&&(n.style.setProperty("margin-right","2px"),e.insertBefore(n,e.firstChild)),t.icon=n}static linkifyURL(t,n){const o=(n=n||{showColumnNumber:!1,inlineFrameIndex:0}).text,i=n.className||"",s=n.lineNumber,c=n.columnNumber,l=n.showColumnNumber,d=n.preventClick,u=n.maxLength||a.UIUtils.MaxLengthForDisplayedURLs,p=n.bypassURLTrimming,g=n.omitOrigin;if(!t||e.ParsedURL.schemeIs(t,"javascript:")){const e=document.createElement("span");return i&&(e.className=i),e.textContent=o||t||L(b.unknown),e}let h=o||r.ResourceUtils.displayNameForURL(t);if(g){const e=URL.parse(t);e&&(h=t.replace(e.origin,""))}"number"!=typeof s||o||(h+=":"+(s+1),l&&"number"==typeof c&&(h+=":"+(c+1)));const m={maxLength:u,title:h!==t?t:"",href:t,preventClick:d,tabStop:n.tabStop,bypassURLTrimming:p,jslogContext:n.jslogContext||"url"},{link:k,linkInfo:C}=N.createLink(h,i,m);return s&&(C.lineNumber=s),c&&(C.columnNumber=c),C.userMetric=n?.userMetric,k}static linkifyRevealable(e,t,n,o,i,r){const s={maxLength:a.UIUtils.MaxLengthForDisplayedURLs,href:n,title:o,jslogContext:r},{link:c,linkInfo:l}=N.createLink(t,i||"",s);return l.revealable=e,c}static createLink(e,n,o={}){const{maxLength:i,title:r,href:c,preventClick:l,tabStop:d,bypassURLTrimming:u,jslogContext:p}=o,g=document.createElement(o.preventClick?"span":"button");n&&(g.className=n),g.classList.add("devtools-link"),o.preventClick||g.classList.add("text-button","link-style"),r&&a.Tooltip.Tooltip.install(g,r),c&&(g.href=c),g.setAttribute("jslog",`${s.link(p).track({click:!0})}`),e instanceof HTMLElement?g.appendChild(e):u?(g.classList.add("devtools-link-styled-trim"),N.appendTextWithoutHashes(g,e)):N.setTrimmedText(g,e,i);const h={icon:null,enableDecorator:!1,uiLocation:null,liveLocation:null,url:c||null,lineNumber:null,columnNumber:null,inlineFrameIndex:0,revealable:null,fallback:null};return I.set(g,h),l?g.classList.add("devtools-link-prevent-click"):g.addEventListener("click",(e=>{t.rnPerfMetrics.stackTraceFrameClicked(null!==h.liveLocation),N.handleClick(e)&&e.consume(!0)}),!1),a.ARIAUtils.markAsLink(g),g.tabIndex=d?0:-1,{link:g,linkInfo:h}}static setTrimmedText(e,t,n){if(e.removeChildren(),n&&t.length>n){const o=function(e,t){let n=Math.floor(t/2),o=e.length-Math.ceil(t/2)+1;const i=e.codePointAt(o-1);void 0!==i&&i>=65536&&(o++,n++);const r=e.codePointAt(n-1);void 0!==r&&n>0&&r>=65536&&n--;return[e.substring(0,n),e.substring(n,o),e.substring(o)]}(t,n);N.appendTextWithoutHashes(e,o[0]),N.appendHiddenText(e,o[1]),N.appendTextWithoutHashes(e,o[2])}else N.appendTextWithoutHashes(e,t)}static appendTextWithoutHashes(e,t){const n=l.TextUtils.Utils.splitStringByRegexes(t,[/[a-f0-9]{20,}/g]);for(const t of n)-1===t.regexIndex?a.UIUtils.createTextChild(e,t.value):(a.UIUtils.createTextChild(e,t.value.substring(0,7)),N.appendHiddenText(e,t.value.substring(7)))}static appendHiddenText(e,t){const n=a.UIUtils.createTextChild(e.createChild("span","devtools-link-ellipsis"),"…");x.set(n,t)}static untruncatedNodeText(e){return x.get(e)||e.textContent||""}static linkInfo(e){return e&&I.get(e)||null}static handleClick(e){const t=e.currentTarget;if(a.UIUtils.isBeingEdited(e.target)||t.hasSelection())return!1;const n=N.linkInfo(t);return!!n&&N.invokeFirstAction(n)}static handleClickFromNewComponentLand(e){N.invokeFirstAction(e)}static invokeFirstAction(e){const n=N.linkActions(e);return!!n.length&&(n[0].handler.call(null),e.userMetric&&t.userMetrics.actionTaken(e.userMetric),!0)}static linkHandlerSetting(){return T||(T=e.Settings.Settings.instance().createSetting("open-link-handler",L(b.auto))),T}static registerLinkHandler(e,t){S.set(e,t),D.instance().update()}static unregisterLinkHandler(e){S.delete(e),D.instance().update()}static uiLocation(e){const t=N.linkInfo(e);return t?t.uiLocation:null}static linkActions(n){const i=[];if(!n)return i;let s=o.DevToolsPath.EmptyUrlString,c=null;if(n.uiLocation)c=n.uiLocation,s=c.uiSourceCode.contentURL();else if(n.url){s=n.url;const t=d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(s)||d.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.ParsedURL.ParsedURL.urlWithoutHash(s));c=t?t.uiLocation(n.lineNumber||0,n.columnNumber||0):null}const l=s?r.ResourceUtils.resourceForURL(s):null,u=c?c.uiSourceCode:l,p=n.revealable||c||l;if(p){const t=e.Revealer.revealDestination(p);i.push({section:"reveal",title:t?L(b.revealInS,{PH1:t}):L(b.reveal),jslogContext:"reveal",handler:()=>e.Revealer.reveal(p)})}if(u){const e=c?c.lineNumber:n.lineNumber||0;for(const t of S.keys()){const n=S.get(t);if(!n)continue;const o={section:"reveal",title:L(b.openUsingS,{PH1:t}),jslogContext:"open-using",handler:n.bind(null,u,e)};t===N.linkHandlerSetting().get()?i.unshift(o):i.push(o)}}if((l||n.url)&&(i.push({section:"reveal",title:a.UIUtils.openLinkExternallyLabel(),jslogContext:"open-in-new-tab",handler:()=>a.UIUtils.openInNewTab(s)}),i.push({section:"clipboard",title:a.UIUtils.copyLinkAddressLabel(),jslogContext:"copy-link-address",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(s)})),c?.uiSourceCode){const e=c.uiSourceCode;i.push({section:"clipboard",title:a.UIUtils.copyFileNameLabel(),jslogContext:"copy-file-name",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.displayName())})}return i}}class D{element;constructor(){this.element=document.createElement("select"),this.element.addEventListener("change",this.onChange.bind(this),!1),this.update()}static instance(e={forceNew:null}){const{forceNew:t}=e;return U&&!t||(U=new D),U}update(){this.element.removeChildren();const e=[...S.keys()];e.unshift(L(b.auto));for(const t of e){const e=document.createElement("option");e.textContent=t,e.selected=t===N.linkHandlerSetting().get(),this.element.appendChild(e)}this.element.disabled=e.length<=1}onChange(e){if(!e.target)return;const t=e.target.value;N.linkHandlerSetting().set(t)}settingElement(){return a.SettingsUI.createCustomSetting(L(b.linkHandling),this.element)}}let R=!1;R||(R=!0,window.addEventListener("linkifieractivated",(function(e){const t=e;N.handleClickFromNewComponentLand(t.data)})));var F=Object.freeze({__proto__:null,ContentProviderContextMenuProvider:class{appendApplicableItems(n,o,r){const s=r.contentURL();if(s){e.ParsedURL.schemeIs(s,"file:")||o.revealSection().appendItem(a.UIUtils.openLinkExternallyLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(s.endsWith(":formatted")?e.ParsedURL.ParsedURL.slice(s,0,s.lastIndexOf(":")):s)),{jslogContext:"open-in-new-tab"});for(const e of S.keys()){const t=S.get(e);t&&o.revealSection().appendItem(L(b.openUsingS,{PH1:e}),t.bind(null,r,0),{jslogContext:"open-using"})}r instanceof i.NetworkRequest.NetworkRequest||(o.clipboardSection().appendItem(a.UIUtils.copyLinkAddressLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(s)),{jslogContext:"copy-link-address"}),r instanceof d.UISourceCode.UISourceCode?o.clipboardSection().appendItem(a.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName())),{jslogContext:"copy-file-name"}):o.clipboardSection().appendItem(a.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName)),{jslogContext:"copy-file-name"}))}}},LinkContextMenuProvider:class{appendApplicableItems(e,t,n){let o=n;for(;o&&!I.get(o);)o=o.parentNodeOrShadowHost();const i=o,r=N.linkInfo(i);if(!r)return;const s=N.linkActions(r);for(const e of s)t.section(e.section).appendItem(e.title,e.handler,{jslogContext:e.jslogContext})}},LinkHandlerSettingUI:D,Linkifier:N});const M={removeFromIgnore:"Remove from ignore list",addToIgnore:"Add script to ignore list",showMoreFrames:"Show ignore-listed frames",showLess:"Show less",unknownSource:"unknown"},E=n.i18n.registerUIStrings("ui/legacy/components/utils/JSPresentationUtils.ts",M),W=n.i18n.getLocalizedString.bind(void 0,E);function B(e,t){const n=new a.ContextMenu.ContextMenu(t);t.consume(!0);const o=N.uiLocation(e);o&&r.IgnoreListManager.IgnoreListManager.instance().canIgnoreListUISourceCode(o.uiSourceCode)&&(r.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(o.uiSourceCode.url())?n.debugSection().appendItem(W(M.removeFromIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().unIgnoreListUISourceCode(o.uiSourceCode)),{jslogContext:"remove-from-ignore-list"}):n.debugSection().appendItem(W(M.addToIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().ignoreListUISourceCode(o.uiSourceCode)),{jslogContext:"add-to-ignore-list"})),n.appendApplicableItems(t),n.show()}function j(t,n,o,r,c,l){const d=[];if(c){const t=new e.Throttler.Throttler(100);o.addEventListener("liveLocationUpdated",(()=>{t.schedule((async()=>c(d)))}))}function u(e,t=void 0){let c=null;t&&(c={asyncDescription:a.UIUtils.asyncStackTraceLabel(e.description,t)},d.push(c));let u=!1;for(const t of e.callFrames){const e=a.UIUtils.beautifyFunctionName(t.functionName),c=o.maybeLinkifyConsoleCallFrame(n,t,{showColumnNumber:l,tabStop:Boolean(r),inlineFrameIndex:0,revealBreakpoint:u});c&&(c.setAttribute("jslog",`${s.link("stack-trace").track({click:!0})}`),c.addEventListener("contextmenu",B.bind(null,c)),c.textContent||(c.textContent=W(M.unknownSource))),d.push({functionName:e,link:c}),u=[i.DebuggerModel.COND_BREAKPOINT_SOURCE_URL,i.DebuggerModel.LOGPOINT_SOURCE_URL].includes(t.url)}}u(t);let p=t.callFrames;for(let e=t.parent;e;e=e.parent)e.callFrames.length&&u(e,p),p=e.callFrames;return d}function H(e,t,n){e.removeChildren();const o=[];let i=null;for(const t of n){i&&!("asyncDescription"in t)||(i=e.createChild("tbody"));const n=i.createChild("tr");"asyncDescription"in t?(n.createChild("td").textContent="\n",n.createChild("td","stack-preview-async-description").textContent=t.asyncDescription,n.createChild("td"),n.createChild("td"),n.classList.add("stack-preview-async-row")):(n.createChild("td").textContent="\n",n.createChild("td","function-name").textContent=t.functionName,n.createChild("td").textContent=" @ ",t.link&&(n.createChild("td","link").appendChild(t.link),o.push(t.link)))}i=e.createChild("tfoot");const r=i.createChild("tr","show-all-link");r.createChild("td");const s=r.createChild("td");s.colSpan=4;const c=s.createChild("span","link");c.createChild("span","css-inserted-text").setAttribute("data-inserted-text",W(M.showMoreFrames)),c.addEventListener("click",(()=>{e.classList.add("show-hidden-rows"),t.classList.add("show-hidden-rows"),a.GlassPane.GlassPane.containerMoved(e)}),!1);const l=i.createChild("tr","show-less-link");l.createChild("td");const d=l.createChild("td");d.colSpan=4;const u=d.createChild("span","link");return u.createChild("span","css-inserted-text").setAttribute("data-inserted-text",W(M.showLess)),u.addEventListener("click",(()=>{e.classList.remove("show-hidden-rows"),t.classList.remove("show-hidden-rows"),a.GlassPane.GlassPane.containerMoved(e)}),!1),o}var A=Object.freeze({__proto__:null,buildStackTracePreviewContents:function(e,t,n={widthConstrained:!1,stackTrace:void 0,tabStops:void 0}){const{stackTrace:o,tabStops:i}=n,r=document.createElement("span");r.classList.add("monospace"),r.classList.add("stack-preview-container"),r.classList.toggle("width-constrained",n.widthConstrained),r.style.display="inline-block";const s=a.UIUtils.createShadowRootWithCoreStyles(r,{cssFile:C}).createChild("table","stack-preview-container");s.classList.toggle("width-constrained",n.widthConstrained);const c=H.bind(null,s,r);return{element:r,links:H(s,r,j(o??{callFrames:[]},e,t,i,c,n.showColumnNumber))}},buildStackTraceRows:j});var P=Object.freeze({__proto__:null,reload:function(){a.DockController.DockController.instance().canDock()&&"undocked"===a.DockController.DockController.instance().dockSide()&&t.InspectorFrontendHost.InspectorFrontendHostInstance.setIsDocked(!0,(function(){})),t.InspectorFrontendHost.InspectorFrontendHostInstance.reattach((()=>window.location.reload()))}});const _={websocketDisconnected:"WebSocket disconnected",websocketDisconnectedUnregisteredDevice:"The corresponding app for this DevTools session cannot be found. Please relaunch DevTools from the terminal.",websocketDisconnectedConnectionLost:"Connection lost to corresponding device.",websocketDisconnectedNewDebuggerOpened:"Disconnected due to opening a second DevTools window for the same app."},O=n.i18n.registerUIStrings("ui/legacy/components/utils/TargetDetachedDialog.ts",_),z=n.i18n.getLocalizedString.bind(void 0,O);class $ extends i.SDKModel.SDKModel{static hideCrashedDialog;constructor(e){super(e),e.registerInspectorDispatcher(this),e.inspectorAgent().invoke_enable(),e.parentTarget()?.type()===i.Target.Type.BROWSER&&$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}detached({reason:e}){a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(e)}static getCustomUiReason(e){return e?"1011"===e.code&&e.reason?.includes("[UNREGISTERED_DEVICE]")?z(_.websocketDisconnectedUnregisteredDevice):"1000"===e.code&&e.reason?.includes("[CONNECTION_LOST]")?z(_.websocketDisconnectedConnectionLost):"1000"===e.code&&e.reason?.includes("[NEW_DEBUGGER_OPENED]")?z(_.websocketDisconnectedNewDebuggerOpened):null:null}static connectionLost(e){const t=$.getCustomUiReason(e)||z(_.websocketDisconnected);a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(t,e)}targetCrashed(){if($.hideCrashedDialog)return;const e=this.target().parentTarget();if(e&&e.type()!==i.Target.Type.BROWSER)return;const t=new a.Dialog.Dialog("target-crashed");t.setSizeBehavior("MeasureContent"),t.addCloseButton(),t.setDimmed(!0),$.hideCrashedDialog=t.hide.bind(t),new a.TargetCrashedScreen.TargetCrashedScreen((()=>{$.hideCrashedDialog=null})).show(t.contentElement),t.show()}targetReloadedAfterCrash(){this.target().runtimeAgent().invoke_runIfWaitingForDebugger(),$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}}i.SDKModel.SDKModel.register($,{capabilities:2048,autostart:!0});var G=Object.freeze({__proto__:null,TargetDetachedDialog:$});export{k as ImagePreview,A as JSPresentationUtils,F as Linkifier,P as Reload,G as TargetDetachedDialog};

Check failure

Code scanning / CodeQL

DOM text reinterpreted as HTML High library

DOM text
is reinterpreted as HTML without escaping meta-characters.
` ${path.relative(outputPath, sourceSymbolPath)} → ${path.basename(targetFolder)}`,
);
fs.mkdirSync(targetSymbolPath, {recursive: true});
execSync(`cp -r ${sourceSymbolPath} ${targetSymbolPath}`);

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
file name
.
This shell command depends on an uncontrolled
absolute path
.
This shell command depends on an uncontrolled
absolute path
.
This shell command depends on an uncontrolled
file name
.

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
file name
.
This shell command depends on an uncontrolled
file name
.
},
"devDependencies": {
"@react-native/debugger-shell": "0.83.0-main",
"@react-native/debugger-shell": "workspace:*",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.