Skip to content

[pull] main from microsoft:main#32

Closed
pull[bot] wants to merge 3977 commits intoSaadnajmi:mainfrom
microsoft:main
Closed

[pull] main from microsoft:main#32
pull[bot] wants to merge 3977 commits intoSaadnajmi:mainfrom
microsoft:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Apr 3, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

mdvacca and others added 30 commits December 20, 2024 00:15
Summary:
Pull Request resolved: facebook#48345

Migrate ReactPackageLogger to kotlin

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D67420585

fbshipit-source-id: a82fc7f17828ef6ad36a666113673526eb723600
Summary:
Pull Request resolved: facebook#48346

Migrate ReactDrawableHelper to Kotlin

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D67420410

fbshipit-source-id: 524062d0c0a0d3440bf5ac4c61e8cae53b32a0d2
…k#47875)" (facebook#48341)

Summary:
Pull Request resolved: facebook#48341

We reverted [this commit](facebook@5b2bbb8) in 0.76 and 0.77 as it was not the right fix.

## Changelog
[Internal] - Revert excluding `autolinking.h` only if it exists

Reviewed By: alanleedev

Differential Revision: D67456530

fbshipit-source-id: 0f7bfc11d23f7a8fef5100784754add5b4ecda58
Summary:
Sometimes, specific E2E tests can fail. This change tries to run specific E2E tests with retries, to compensate for their flakyness.

## Changelog:
[Internal] - Add single test retry for Android E2E tests

Pull Request resolved: facebook#48324

Test Plan: GHA

Reviewed By: huntie

Differential Revision: D67396758

Pulled By: cipolleschi

fbshipit-source-id: 7d806fe7354bd9e826c591ea9628c73c3b258fce
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D67529040

fbshipit-source-id: 09221c6f866628bbf9174293124e650b7fffa967
Summary: Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D67548045

fbshipit-source-id: 0c983b327b54580dddf483b6250ff1261df8ce75
…ster

Summary:
Chronos Job Instance ID: 1125907954543643
Sandcastle Job Instance ID: 18014400108783919
allow-large-files
ignore-conflict-markers
opt-out-review
drop-conflicts

Differential Revision: D67558410

fbshipit-source-id: 98a48c02e85aa4f3481ac4800362728bfdb152db
Summary:
Pull Request resolved: facebook#48365

For a mistake, the local E2E test we use to test a release is still pointing to the release APK instead of using the debug apk.

This change fix that. The change has been manually applied to the release branches, for example [here](facebook@385318b)

## Changelog
[Internal] - use Debug apk instead of release one to test the release

Reviewed By: robhogan

Differential Revision: D67599760

fbshipit-source-id: 224b5b8d8f664bb579b09ee68f1b92c0774a9b5e
Summary:
Pull Request resolved: facebook#48364

The configuration to run E2E tests on maestro has a typo that was outputting a warning in CI:

{F1974100056}

## Changelog
[Internal] - Fix typo on E2E test configuration

Reviewed By: robhogan

Differential Revision: D67599849

fbshipit-source-id: 9504f821172782e188ff524176bc4c2ec48dea97
Summary:
Pull Request resolved: facebook#48363

jq is already installed on M1 machines on GithubActions. There is no need to install it again and this is outputting a warning in CI:

{F1974100065}

## Changelog:
[Internal] - Do not install jq as it is already installed

Reviewed By: blakef

Differential Revision: D67599961

fbshipit-source-id: 1f621f796b0c67ec877fc35269137537618f47ae
Summary:
Add changelog for 0.77.0-rc.4

## Changelog:
[Internal]

Pull Request resolved: facebook#48374

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D67602257

Pulled By: robhogan

fbshipit-source-id: 79becf41cfad105e682d648f2f957f18bdbad5f6
Summary:
I think parsed isn't a good enough name.

React native also does a lot of processing of the error.

This also opens the door for eventually forwarding the original error in the future.

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D67526700

fbshipit-source-id: 895d64fa1ee4061ecbf0c1a6033c25b6fca95fd6
Summary:
Migrating `FpsListener` to Kotlin

## Changelog:

[INTERNAL] - Migrating `FpsListener` to Kotlin

Pull Request resolved: facebook#48360

Test Plan:
```bash
yarn test-android
```

Reviewed By: bnalls33

Differential Revision: D67599802

Pulled By: Abbondanzo

fbshipit-source-id: 769dbe26688309ffcf15565c5d51003e23c56412
Summary:
I noticed that `AppDelegate` subscribers listening for `applicationDidEnterBackground` events in Expo projects (as documented [here](https://github.com/expo/expo/blob/238b6f57e459dd2c0b13ee158f0af709fe922460/docs/pages/modules/appdelegate-subscribers.mdx?plain=1#L56) aren't working as expected anymore.
While investigating, I discovered that the events aren't reaching the `ExpoAppDelegate` implementation ([source](https://github.com/expo/expo/blob/71f2c55ff3f11e43ab43761bb5cece2e48eae0bf/packages/expo-modules-core/ios/AppDelegates/ExpoAppDelegate.swift#L61)) because the `RCTAppDelegate` implementation of `applicationDidEnterBackground` interrupts the event chain. This appears to be affecting some legitimate use cases.
I believe we could improve this by removing the current implementation, but I'd love to hear your thoughts on this approach. I might be missing some context about why this implementation was originally needed, so any insights would be greatly appreciated!

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[IOS] [FIXED] - Fix applicationDidEnterBackground not being called

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [FIXED] - Fix applicationDidEnterBackground not being called

Pull Request resolved: facebook#48376

Test Plan: Ran a local test after change

Reviewed By: javache

Differential Revision: D67621557

Pulled By: cipolleschi

fbshipit-source-id: 2d73711372deba867bd616c79ef4d00c79aa86d5
facebook#48213)

Summary:
Fixes facebook#48149. Actually this issue is not caused by React 19. The underlying problem arises because we retain the surface in RCTHost at the time of its creation. Even though we call stop, there is a return check that prevents execution if the status is not running. For reference, you can view the relevant code here: [RCTFabricSurface.mm](https://github.com/facebook/react-native/blob/7d771de8a79b05e8dfed91e07de30d9f72d3c1c3/packages/react-native/React/Fabric/Surface/RCTFabricSurface.mm#L118).

To resolve this issue, we can implement a weak reference to the surface.

bt:
```
(lldb) bt
* thread facebook#13, queue = 'com.apple.root.user-interactive-qos', stop reason = signal SIGABRT
    frame #0: 0x0000000105699008 libsystem_kernel.dylib`__pthread_kill + 8
    frame facebook#1: 0x00000001045df408 libsystem_pthread.dylib`pthread_kill + 256
    frame facebook#2: 0x000000018016c4ec libsystem_c.dylib`abort + 104
    frame facebook#3: 0x000000018016b934 libsystem_c.dylib`__assert_rtn + 268
    frame facebook#4: 0x000000010651f4b4 React_Fabric`facebook::react::SurfaceHandler::setUIManager(this=0x0000000108108620, uiManager=0x0000000000000000) const at SurfaceHandler.cpp:317:3
    frame facebook#5: 0x00000001064c98f4 React_Fabric`facebook::react::Scheduler::unregisterSurface(this=0x0000600003500370, surfaceHandler=0x0000000108108620) const at Scheduler.cpp:252:18
    frame facebook#6: 0x0000000104c3e8a8 RCTFabric`-[RCTScheduler unregisterSurface:](self=0x000060000212a940, _cmd="unregisterSurface:", surfaceHandler=0x0000000108108620) at RCTScheduler.mm:163:15
    frame facebook#7: 0x0000000104c61fc4 RCTFabric`-[RCTSurfacePresenter unregisterSurface:](self=0x00000001081080d0, _cmd="unregisterSurface:", surface=0x0000000108108610) at RCTSurfacePresenter.mm:126:5
  * frame facebook#8: 0x0000000104bc30a0 RCTFabric`-[RCTFabricSurface dealloc](self=0x0000000108108610, _cmd="dealloc") at RCTFabricSurface.mm:87:3
    frame facebook#9: 0x0000000104b9ae44 RCTFabric`__destroy_helper_block_ea8_32s((null)=0x0000600000cb5a70) at RCTBoxShadow.mm:0
    frame facebook#10: 0x00000001800f6edc libsystem_blocks.dylib`_call_dispose_helpers_excp + 44
    frame facebook#11: 0x00000001800f7d24 libsystem_blocks.dylib`_Block_release + 300
    frame facebook#12: 0x000000010760a7b8 libdispatch.dylib`_dispatch_client_callout + 16
    frame facebook#13: 0x000000010761e608 libdispatch.dylib`_dispatch_root_queue_drain + 936
    frame facebook#14: 0x000000010761ef7c libdispatch.dylib`_dispatch_worker_thread2 + 256
    frame facebook#15: 0x00000001045dbb38 libsystem_pthread.dylib`_pthread_wqthread + 224
```

## Changelog:

[IOS] [FIXED] - Fabric: Fixes assert failure when surface stop before we start surface

Pull Request resolved: facebook#48213

Test Plan:
Please see demo in facebook#48149. Or open RNTester and apply the patch like below:
```
 diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm
index 64c5d41..cf015458619 100644
 --- a/packages/rn-tester/RNTester/AppDelegate.mm
+++ b/packages/rn-tester/RNTester/AppDelegate.mm
@@ -50,7 +50,10 @@ static NSString *kBundlePath = @"js/RNTesterApp.ios";

   [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];

-  return [super application:application didFinishLaunchingWithOptions:launchOptions];
+  [super application:application didFinishLaunchingWithOptions:launchOptions];
+  self.window.rootViewController = [UIViewController new];
+  [self.window makeKeyAndVisible];
+  return YES;
 }

 - (void)applicationDidEnterBackground:(UIApplication *)application

```

Reviewed By: javache

Differential Revision: D67335792

Pulled By: cipolleschi

fbshipit-source-id: e93aaaa60b3d204d7ed2cda6758b3b1d9dfcbc88
…#44605)

Summary:
While investigating the root cause of app hanging on older devices in Instruments, I noticed that the heaviest stack trace was pointing to `RCTRecursiveAccessibilityLabel` in RCTView.m.

<details>
  <summary>Heaviest stack trace in Instruments</summary>
<img width="473" alt="Screenshot 2024-05-17 at 4 22 48 PM" src="https://github.com/facebook/react-native/assets/849905/fab8ed01-7a2f-4113-b2ca-04e76f25cd9d">
</details>

The profiling was done on an iPad (5th generation) running iOS 16.7.4. The app is text heavy which makes the issue more visible than in RNTester for instance.

### Before
<img width="854" alt="Screenshot 2024-05-17 at 4 19 46 PM" src="https://github.com/facebook/react-native/assets/849905/5e3cc7ad-299c-4814-ab4a-031c0e677b12">

It turns out that `[NSMutableString stringWithString:@""]` is initialized in every call of the recursion even though most of the time it's only used to check the length at the end and return `nil`.

My change only initialize the mutable string if it's going to be used. I applied the same logic to the equivalent Fabric component. It's a small change that improved the accessibility label generation by 60ms in my case.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[IOS] [CHANGED] - Reduce memory allocations when computing accessibilityLabel

Pull Request resolved: facebook#44605

Test Plan:
Running the same measurements after the change, computing the accessibility label is not the heaviest stack trace anymore. And the line by line tracing shows that `[NSMutableString stringWithString:@""]` impact has been significantly reduced.

### After
<img width="769" alt="Screenshot 2024-05-17 at 4 53 04 PM" src="https://github.com/facebook/react-native/assets/849905/1ad638ac-ba7e-4dca-ac77-10df5d2dad49">

I have been using this change in production thanks to a patch-package and it effectively improved the performances when navigating between screens.

I also tested in RNTester with and without Fabric. For both architectures, I made sure the return value of `RCTRecursiveAccessibilityLabel`.

Interestingly, when there is no label, the Fabric implementation returns an empty string while the `RCTView.m` returns `nil`.

I'm open to align both implementations to return `nil` if you believe there is no underlying reason requiring the Fabric implementation to return an empty string.

Reviewed By: cipolleschi

Differential Revision: D67620818

Pulled By: javache

fbshipit-source-id: 1a6937075a5ff5a9ad03fbbf910d64b3884c0fe0
…led (facebook#48379)

Summary:
Pull Request resolved: facebook#48379

## Changelog:
[Internal] -

We have a good portion of RN core code already instrumented with `SystraceSection` blocks, and those do the timing via fbsystrace, which may or may not be enabled in the system and generally is obsolete.

This maps the blocks to the corresponding Perfetto instrumentation, in case the latter is enabled, which will allow to get this information in Perfetto sessions without need to have fbsystrace present.

Reviewed By: javache

Differential Revision: D67619443

fbshipit-source-id: 52e5666472ad118fbec176a0e82d72a5200a358a
Summary:
Pull Request resolved: facebook#48381

Right now, the E2E tests for RNTester does not have a timeout.
It can happen that the emulator get stuck and the action times out.

The default timeout is 6 hours, which is definitely too much and wasteful, so let's reduce it to 1 hour.

{F1974112110}

## Changelog:
[Internal] - Set timeout for E2E tests to 1 hour

Reviewed By: robhogan, blakef

Differential Revision: D67620423

fbshipit-source-id: c507d1222fca49287fafe6da4bffe559d8687b99
Summary:
Pull Request resolved: facebook#48383

## Changelog:
[Internal] -

This changes the name of `SystraceSection` class to `TraceSection`, the purpose being to make it Systrace/FBSystrace agnostic (and that it can be mapped to e.g. Perfetto instead).

It changes all the internal callsites to the RN code code, and also adds a shim include, `<cxxreact/SystraceSection.h`, for backward compatibility with the external callers for now (which will be addressed separately).

Reviewed By: javache

Differential Revision: D67621914

fbshipit-source-id: 337c63c45a7b075c6e00cfca67ecc06c298c94c0
Summary:
facebook#48376 removed `applicationDidEnterBackground` from `RCTAppDelegate` but RNTester called it, leads to crash. cc cipolleschi can you please help to review?

## Changelog:

[INTERNAL] [FIXED] - RNTester: Fixes crash when app back to background

Pull Request resolved: facebook#48385

Test Plan: RNTester iOS back to background not crash.

Reviewed By: cipolleschi

Differential Revision: D67657449

Pulled By: philIip

fbshipit-source-id: e6d806b2677050fa2faa273a7468055d9d21c2a3
Summary:
### Error message:
we got an error
```
t[n] is not a function. (In 't[n]()', 't[n]' is undefined) \n <unknown> (index.bundle:317:168:317)
```
 it related the BackHandle execute handle function.

### Investigation result
our project has screen files`App.tsx`, `Dashboard.tsx`, and `Profile.tsx`.
When launching the app, the screen order is `App.tsx` -> `Dashboard.tsx`, then user can switch to `Profile.tsx`
For `App.tsx` and `Dashboard.tsx`, we just prevent the hardware button action use `usePreventHardwareBackPressEffect()` in the first line of screen code.
```js
export const useHardwareBackPressEffect = (goBack?: () => boolean): void => {
  useEffect(() => {
    if (goBack) {
      BackHandler.addEventListener("hardwareBackPress", goBack);
      return () => {
        BackHandler.removeEventListener("hardwareBackPress", goBack);
      };
    }
    return undefined;
  }, [ goBack ]);
};
export const usePreventHardwareBackPressEffect = (): void => useHardwareBackPressEffect(() => true);
```
currently, `_backPressSubscriptions ` has 2 callback functions.
then user switch to `Profile.tsx` screen, and has the below code for hardwareback button and the second doesn't `return true`:
```js
// first one
usePreventHardwareBackPressEffect();
...

// second one
useEffect(() => {
  const backButtonListener = BackHandler.addEventListener(
    "hardwareBackPress",
    () => navigate(Navigation.Login);
  );
  return () => backButtonListener.remove();
});
```
currently, `_backPressSubscriptions ` has 4 callback functions, include previous 2 and new 2 of `Profile.tsx`.
When the user press hardwareback button, it will navigate to the login screen, so the issue occurs:
the latest callback will be executed first, then the navigation will let the screen unmount, which will destroy the effect, so the code removing 2 hardwareBackPress callback of `Profile.tsx` by executed
```js
return () => {
        BackHandler.removeEventListener("hardwareBackPress", goBack);
      };
```
After the navigation ends and the loop is restored, the init `i` is 3, then `i--`, `i` is 2, then `_backPressSubscriptions[2]` is `undefined` now and executes as a function, so the app crashes.
```js
for (let i = _backPressSubscriptions.length - 1; i >= 0; i--) {
    if (_backPressSubscriptions[i]()) {
      return;
    }
  }
```
that's the issue I met.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID] [FIXED] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[ANDROID] [FIXED] - Fix BackHandle callback undefined cause crash issue

Pull Request resolved: facebook#48388

Reviewed By: blakef

Differential Revision: D67648077

Pulled By: rshest

fbshipit-source-id: 5ca685b0c0c474ef11772fd803743968ec2d912e
Summary:
Pull Request resolved: facebook#48400

A couple of days ago, the iOS CI started failing for the E2E tests on main.
This is because We were not using the hermes artifacts we were preconfiguring.

In fact, this is the log of the `test_e2e_ios_rntester`, which is not using the prebuilt.
{F1974129000}

For comparison, this is the `test_ios_rntester`, which is using the prebuilt
{F1974129001}

While investigating why this was happening, I realized that we were not testing the old architecture anymore, because we forget to update the script after the release of the New Architecture.

This change should fix both.

## Changelog:
[Internal] - Fix E2E tests for iOS and test the Old Arch

Reviewed By: robhogan

Differential Revision: D67670976

fbshipit-source-id: 7d1383a89e06c138f437a9c5f876a2e900878fb0
Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
Summary:
Pull Request resolved: facebook#48401

This change adds a flag to JS Error's prototype to specify the jsEngine.

Reviewed By: fkgozali

Differential Revision: D67665484

fbshipit-source-id: 64b7b4bd986bcbd45d58e70c1a16de6752b05ccd
Summary:
Pull Request resolved: facebook#48411

## Changelog:
[Internal] -

Floow-up to facebook#48388, based on the diff discussion (D67648077).

Adds a bit better typing to `BackHandler.js`.

Reviewed By: blakef

Differential Revision: D67713236

fbshipit-source-id: 95435898d8ea87f6ae32a6db859d6641e1264972
Summary:
Changelog for 0.77.0-rc.5

## Changelog:

[Internal] Changelog for 0.77.0-rc.5

Pull Request resolved: facebook#48413

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D67718909

Pulled By: robhogan

fbshipit-source-id: df2407ec7911e01f91a340c14517f8af2dc63a21
…8404)

Summary:
X-link: facebook/litho#1036

X-link: facebook/yoga#1775

Pull Request resolved: facebook#48404

## Changelog:
[Internal] -

This popped up when profiling some heavy UI performance, calling `fmod` operation in Yoga's `roundLayoutResultsToPixelGrid` in `PixelGrid.cpp` can be expensive, furthermore it turns out that some of the calls were redundant.

This replaces the duplicate calls to fmod with an equivalent single round operation, which for e.g. clang compiler on Windows brings the code in question from ~50 instructions (including 4 call instructions to the fmod function) down to ~30 instructions (without any external calls), and the layout operation being **~1% more efficient** for the particular benchmark I was looking into.

Reviewed By: christophpurrer

Differential Revision: D67689065

fbshipit-source-id: 2a074a1cb81bd7f7a3c414050b9ddda2ba90180f
Summary:
Pull Request resolved: facebook#48347

Vector drawable support was added behind a feature flag in facebook#45354 and is ready to release more widely. This change is effectively the same as removing the feature flag but allows our holdout to continue until mid-January.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D67482531

fbshipit-source-id: 1733c4748f79fd4df72f531a24efcbd8a7822611
Summary:
facebook#47379 removed local cpp sources from the sources being built with the app. This resulted in a local `android/app/src/main/jni/OnLoad.cpp` file being ignored at build time. I have therefore added logic to the cmake file to prioritise local `cpp` files and fallback to `${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp` if none exist.

This resolves facebook#48298

## Changelog:
[ANDROID] [FIXED] - Prioritise local OnLoad.cpp, falling back to default-app-setup

Pull Request resolved: facebook#48340

Test Plan:
- Followed the https://reactnative.dev/docs/the-new-architecture/pure-cxx-modules guide (which was broken > 0.76.1)
- Applied the patch to the reproduction repository linked to facebook#47352 to ensure no regression

Reviewed By: cipolleschi

Differential Revision: D67736012

Pulled By: cortinico

fbshipit-source-id: 87f6b8edf1613682585a94e1d1b3e6b4b792e4f5
Summary:
This PR implements ReactNativeFactory to encapsulate further the logic of creating an instance of React Native for iOS.

This will remove the strong coupling on the RCTAppDelegate and allow us to support Scene Delegate in the future.

The goal is to have a following API:

```objc
self.reactNativeFactory = [[RCTReactNativeFactory alloc] initWithDelegate:self];

UIView *rootView = [self.reactNativeFactory.rootViewFactory viewWithModuleName:self.moduleName
                                                               initialProperties:self.initialProps
                                                                   launchOptions:launchOptions];

// Standard iOS stuff here
```

## Changelog:

[IOS] [ADDED] - implement ReactNativeFactory

Pull Request resolved: facebook#46298

Test Plan: Test out all the methods of AppDelegate

Reviewed By: huntie

Differential Revision: D67451403

Pulled By: cipolleschi

fbshipit-source-id: 9e73cd996ffc27ca1e3e058b45fc899b1637bdba
Saadnajmi and others added 20 commits March 7, 2025 16:07
…OS (#2400)

## Summary:

This PR attempts to solve two problems:

1. We have had a forked AccessibilityManager module for macOS for a
while. In general, I prefer ifdefing rather than forking so that we get
changes to the iOS code during merges. Let's combine the files.

2. I want to cleanup macOS's "highContrast" API in AccessibilityInfo so
it can be upstreamed, so that RNW can follow it and we have a
cross-platform way to get high contrast state. Luckily, the API we have
for macOS can be ported to iOS, so I did that. Unluckily, someone
already did that (see:
facebook#46826 ) and used the iOS
specific name "Darker system colors" instead of something like "increase
contrast" or "high contrast". So I'll probably need to add my API
upstream, deprecate that one, and then remove it in a future release.
## Summary:

On iOS, [-hitTest:withEvent:](https://developer.apple.com/documentation/uikit/uiview/hittest(_:with:)?changes=la_3_2_7_2_8&language=objc) works with the coordinate system of the view that is being hit tested. On the other hand, on macOS, [-hitTest:](https://developer.apple.com/documentation/appkit/nsview/hittest(_:)?language=objc) works with the coordinate system of the *superview*. React Native macOS currently appears to mix these two coordinate systems, which can lead to unexpected behaviors, one of which that I have personally observed is `mouseDown:` events being delievered to a view that does not pass OS-level hit testing (e.g. the hit point is completely outside of the view that was allegedly hit, even if accounting for not clipping to bounds and any possible descendant view larger than the hit view).

To enforce consistent behavior, we will use the macOS style coordinate system for APIs that follow the macOS signature, and the iOS style coordinate system for APIs that follow the iOS signature, or are obviously React Native APIs. Several APIs were scrubbed for calls and implementation.

The following APIs shall work with superview's coordinate space:
* `- hitTest:`

The following APIs shall work with the view's (i.e. self) coordinate space:
* `RCTUIViewHitTestWithEvent`
* `- reactTagAtMouseLocationFromEvent:`
* `- reactTagAtPoint:`
* `- hitTest:withEvent:`
* `- betterHitTest:withEvent:`
* `- pointInside:withEvent:`

With the proper coordinate system usage, we no longer need new RN components inheriting from NSView to behave in special manners. Updating documentation to reflect that.

## Test Plan:

Manual Testing:

* Downstream scenario around misrouted mouseDown: events was verified fixed
* Sanity tested mouse clicks -- everything seems to work as expected
## Summary:

Addresses inconsistencies in the prepublish script by moving the Azure
Pipelines checks after the correct tag has been determined.

## Test Plan:

Ensure tag is correctly set on `main`:

```
~/S/react-native-macos (main) % node .ado/scripts/prepublish-check.mjs --verbose
❌ .ado/templates/npm-publish-steps.yml: 'publishTag' needs to be set to 'nightly'
```

Ensure tag is correctly set for `0.76-stable` (previous):

```
~/S/react-native-macos (0.76-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 76
ℹ️ Expected npm tag: v0.76-stable
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'v0.76-stable'
❌ Nx Release is not correctly configured for the current branch
```

Ensure tag is correctly set for `0.77-stable` (current):

```
~/S/react-native-macos (0.77-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 77
ℹ️ Expected npm tag: latest
##vso[task.setvariable variable=publish_react_native_macos]1
```

Ensure tag is correctly set for `0.78-stable` (release candidate):

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: next
❌ 'defaultBase' must be set to '0.78-stable'
❌ 'release.version.generatorOptions.preid' must be set to 'rc'
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'next'
❌ Nx Release is not correctly configured for the current branch
```

Update config for `0.78-stable` (release candidate):

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --update
❌ 'defaultBase' must be set to '0.78-stable'
❌ 'release.version.generatorOptions.preid' must be set to 'rc'
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'next'

~/S/react-native-macos (0.78-stable) [1]% node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: next
❌ .ado/templates/npm-publish-steps.yml: 'publishTag' needs to be set to 'next'
```

Mark `0.78-stable` stable:

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --verbose --tag latest --update
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: latest
❌ 'defaultBase' must be set to '0.78-stable'

~/S/react-native-macos (0.78-stable) [1]% node .ado/scripts/prepublish-check.mjs --verbose --tag latest
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: latest
##vso[task.setvariable variable=publish_react_native_macos]1
```
## Summary:

When demoting a stable branch, we need to create a new tag. Nx won't be
able to find it on npm and should have a fallback. For all other
branches, we don't want to use the fallback in case something fails.

## Test Plan:

`main`:

```
~/S/react-native-macos (main) % node .ado/scripts/prepublish-check.mjs --verbose
##vso[task.setvariable variable=publish_react_native_macos]1
```

`0.76-stable`:

```
~/S/react-native-macos (0.76-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 76
ℹ️ Expected npm tag: v0.76-stable
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'v0.76-stable'
❌ 'release.version.generatorOptions.fallbackCurrentVersionResolver' must be set to 'disk'
❌ Nx Release is not correctly configured for the current branch
```

`0.77-stable`:

```
~/S/react-native-macos (0.77-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 77
ℹ️ Expected npm tag: latest
❌ 'release.version.generatorOptions.fallbackCurrentVersionResolver' must be unset
❌ Nx Release is not correctly configured for the current branch
```

`0.78-stable`:

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ react-native-macos@next: 76
ℹ️ Expected npm tag: next
❌ 'defaultBase' must be set to '0.78-stable'
❌ 'release.version.generatorOptions.preid' must be set to 'rc'
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'next'
❌ 'release.version.generatorOptions.fallbackCurrentVersionResolver' must be unset
❌ Nx Release is not correctly configured for the current branch
```
## Summary:

Adds a post-version step to Nx Release for updating generated artifacts
(e.g., `RCTVersion.m`).

## Test Plan:

Bump the version and run `nx release`:

```
yarn nx release plan --only-touched=false patch
yarn nx release --skip-publish --verbose
```

Verify that generated artifacts have been updated with the latest
version number.

---------

Co-authored-by: Saad Najmi <sanajmi@microsoft.com>
Bumps [axios](https://github.com/axios/axios) from 1.7.7 to 1.8.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/axios/axios/releases">axios's
releases</a>.</em></p>
<blockquote>
<h2>Release v1.8.3</h2>
<h2>Release notes:</h2>
<h3>Bug Fixes</h3>
<ul>
<li>add missing type for allowAbsoluteUrls (<a
href="https://redirect.github.com/axios/axios/issues/6818">#6818</a>)
(<a
href="https://github.com/axios/axios/commit/10fa70ef14fe39558b15a179f0e82f5f5e5d11b2">10fa70e</a>)</li>
<li><strong>xhr/fetch:</strong> pass <code>allowAbsoluteUrls</code> to
<code>buildFullPath</code> in <code>xhr</code> and <code>fetch</code>
adapters (<a
href="https://redirect.github.com/axios/axios/issues/6814">#6814</a>)
(<a
href="https://github.com/axios/axios/commit/ec159e507bdf08c04ba1a10fe7710094e9e50ec9">ec159e5</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a href="https://github.com/Electroid"
title="+6/-0 ([facebook#6811](axios/axios#6811)
)">Ashcon Partovi</a></li>
<li><!-- raw HTML omitted --> <a href="https://github.com/StefanBRas"
title="+4/-0 ([facebook#6818](axios/axios#6818)
)">StefanBRas</a></li>
<li><!-- raw HTML omitted --> <a href="https://github.com/mhassan1"
title="+2/-2 ([facebook#6814](axios/axios#6814)
)">Marc Hassan</a></li>
</ul>
<h2>Release v1.8.2</h2>
<h2>Release notes:</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>http-adapter:</strong> add allowAbsoluteUrls to path
building (<a
href="https://redirect.github.com/axios/axios/issues/6810">#6810</a>)
(<a
href="https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f">fb8eec2</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a href="https://github.com/lexcorp16"
title="+1/-1 ([facebook#6810](axios/axios#6810)
)">Fasoro-Joseph Alexander</a></li>
</ul>
<h2>Release v1.8.1</h2>
<h2>Release notes:</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>utils:</strong> move <code>generateString</code> to platform
utils to avoid importing crypto module into client builds; (<a
href="https://redirect.github.com/axios/axios/issues/6789">#6789</a>)
(<a
href="https://github.com/axios/axios/commit/36a5a620bec0b181451927f13ac85b9888b86cec">36a5a62</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a
href="https://github.com/DigitalBrainJS" title="+51/-47
([facebook#6789](axios/axios#6789) )">Dmitriy
Mozgovoy</a></li>
</ul>
<h2>Release v1.8.0</h2>
<h2>Release notes:</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>examples:</strong> application crashed when navigating
examples in browser (<a
href="https://redirect.github.com/axios/axios/issues/5938">#5938</a>)
(<a
href="https://github.com/axios/axios/commit/1260ded634ec101dd5ed05d3b70f8e8f899dba6c">1260ded</a>)</li>
<li>missing word in SUPPORT_QUESTION.yml (<a
href="https://redirect.github.com/axios/axios/issues/6757">#6757</a>)
(<a
href="https://github.com/axios/axios/commit/1f890b13f2c25a016f3c84ae78efb769f244133e">1f890b1</a>)</li>
<li><strong>utils:</strong> replace getRandomValues with crypto module
(<a
href="https://redirect.github.com/axios/axios/issues/6788">#6788</a>)
(<a
href="https://github.com/axios/axios/commit/23a25af0688d1db2c396deb09229d2271cc24f6c">23a25af</a>)</li>
</ul>
<h3>Features</h3>
<ul>
<li>Add config for ignoring absolute URLs (<a
href="https://redirect.github.com/axios/axios/issues/5902">#5902</a>)
(<a
href="https://redirect.github.com/axios/axios/issues/6192">#6192</a>)
(<a
href="https://github.com/axios/axios/commit/32c7bcc0f233285ba27dec73a4b1e81fb7a219b3">32c7bcc</a>)</li>
</ul>
<h3>Reverts</h3>
<ul>
<li>Revert &quot;chore: expose fromDataToStream to be consumable (<a
href="https://redirect.github.com/axios/axios/issues/6731">#6731</a>)&quot;
(<a
href="https://redirect.github.com/axios/axios/issues/6732">#6732</a>)
(<a
href="https://github.com/axios/axios/commit/1317261125e9c419fe9f126867f64d28f9c1efda">1317261</a>),
closes <a
href="https://redirect.github.com/axios/axios/issues/6731">#6731</a> <a
href="https://redirect.github.com/axios/axios/issues/6732">#6732</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/axios/axios/blob/v1.x/CHANGELOG.md">axios's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/axios/axios/compare/v1.8.2...v1.8.3">1.8.3</a>
(2025-03-10)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>add missing type for allowAbsoluteUrls (<a
href="https://redirect.github.com/axios/axios/issues/6818">#6818</a>)
(<a
href="https://github.com/axios/axios/commit/10fa70ef14fe39558b15a179f0e82f5f5e5d11b2">10fa70e</a>)</li>
<li><strong>xhr/fetch:</strong> pass <code>allowAbsoluteUrls</code> to
<code>buildFullPath</code> in <code>xhr</code> and <code>fetch</code>
adapters (<a
href="https://redirect.github.com/axios/axios/issues/6814">#6814</a>)
(<a
href="https://github.com/axios/axios/commit/ec159e507bdf08c04ba1a10fe7710094e9e50ec9">ec159e5</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a href="https://github.com/Electroid"
title="+6/-0 ([facebook#6811](axios/axios#6811)
)">Ashcon Partovi</a></li>
<li><!-- raw HTML omitted --> <a href="https://github.com/StefanBRas"
title="+4/-0 ([facebook#6818](axios/axios#6818)
)">StefanBRas</a></li>
<li><!-- raw HTML omitted --> <a href="https://github.com/mhassan1"
title="+2/-2 ([facebook#6814](axios/axios#6814)
)">Marc Hassan</a></li>
</ul>
<h2><a
href="https://github.com/axios/axios/compare/v1.8.1...v1.8.2">1.8.2</a>
(2025-03-07)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>http-adapter:</strong> add allowAbsoluteUrls to path
building (<a
href="https://redirect.github.com/axios/axios/issues/6810">#6810</a>)
(<a
href="https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f">fb8eec2</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a href="https://github.com/lexcorp16"
title="+1/-1 ([facebook#6810](axios/axios#6810)
)">Fasoro-Joseph Alexander</a></li>
</ul>
<h2><a
href="https://github.com/axios/axios/compare/v1.8.0...v1.8.1">1.8.1</a>
(2025-02-26)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>utils:</strong> move <code>generateString</code> to platform
utils to avoid importing crypto module into client builds; (<a
href="https://redirect.github.com/axios/axios/issues/6789">#6789</a>)
(<a
href="https://github.com/axios/axios/commit/36a5a620bec0b181451927f13ac85b9888b86cec">36a5a62</a>)</li>
</ul>
<h3>Contributors to this release</h3>
<ul>
<li><!-- raw HTML omitted --> <a
href="https://github.com/DigitalBrainJS" title="+51/-47
([facebook#6789](axios/axios#6789) )">Dmitriy
Mozgovoy</a></li>
</ul>
<h1><a
href="https://github.com/axios/axios/compare/v1.7.9...v1.8.0">1.8.0</a>
(2025-02-25)</h1>
<h3>Bug Fixes</h3>
<ul>
<li><strong>examples:</strong> application crashed when navigating
examples in browser (<a
href="https://redirect.github.com/axios/axios/issues/5938">#5938</a>)
(<a
href="https://github.com/axios/axios/commit/1260ded634ec101dd5ed05d3b70f8e8f899dba6c">1260ded</a>)</li>
<li>missing word in SUPPORT_QUESTION.yml (<a
href="https://redirect.github.com/axios/axios/issues/6757">#6757</a>)
(<a
href="https://github.com/axios/axios/commit/1f890b13f2c25a016f3c84ae78efb769f244133e">1f890b1</a>)</li>
<li><strong>utils:</strong> replace getRandomValues with crypto module
(<a
href="https://redirect.github.com/axios/axios/issues/6788">#6788</a>)
(<a
href="https://github.com/axios/axios/commit/23a25af0688d1db2c396deb09229d2271cc24f6c">23a25af</a>)</li>
</ul>
<h3>Features</h3>
<ul>
<li>Add config for ignoring absolute URLs (<a
href="https://redirect.github.com/axios/axios/issues/5902">#5902</a>)
(<a
href="https://redirect.github.com/axios/axios/issues/6192">#6192</a>)
(<a
href="https://github.com/axios/axios/commit/32c7bcc0f233285ba27dec73a4b1e81fb7a219b3">32c7bcc</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/axios/axios/commit/39ec206483a89921732bdc8a5be67e350bfc23f0"><code>39ec206</code></a>
chore(release): v1.8.3 (<a
href="https://redirect.github.com/axios/axios/issues/6819">#6819</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/10fa70ef14fe39558b15a179f0e82f5f5e5d11b2"><code>10fa70e</code></a>
fix: add missing type for allowAbsoluteUrls (<a
href="https://redirect.github.com/axios/axios/issues/6818">#6818</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/7821ef9f5be2d62fbc3f01040d9df6f2225eb9d8"><code>7821ef9</code></a>
docs: update readme to include bun install (<a
href="https://redirect.github.com/axios/axios/issues/6811">#6811</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/ec159e507bdf08c04ba1a10fe7710094e9e50ec9"><code>ec159e5</code></a>
fix(xhr/fetch): pass <code>allowAbsoluteUrls</code> to
<code>buildFullPath</code> in <code>xhr</code> and `fet...</li>
<li><a
href="https://github.com/axios/axios/commit/a9f7689b0c4b6d68c7f587c3aa376860da509d94"><code>a9f7689</code></a>
chore(release): v1.8.2 (<a
href="https://redirect.github.com/axios/axios/issues/6812">#6812</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f"><code>fb8eec2</code></a>
fix(http-adapter): add allowAbsoluteUrls to path building (<a
href="https://redirect.github.com/axios/axios/issues/6810">#6810</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/98120457559e573024862e2925d56295a965ad7e"><code>9812045</code></a>
chore(sponsor): update sponsor block (<a
href="https://redirect.github.com/axios/axios/issues/6804">#6804</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/72acf759373ef4e211d5299818d19e50e08c02f8"><code>72acf75</code></a>
chore(sponsor): update sponsor block (<a
href="https://redirect.github.com/axios/axios/issues/6794">#6794</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/2e64afdff5c41e38284a6fb8312f2745072513a1"><code>2e64afd</code></a>
chore(release): v1.8.1 (<a
href="https://redirect.github.com/axios/axios/issues/6800">#6800</a>)</li>
<li><a
href="https://github.com/axios/axios/commit/36a5a620bec0b181451927f13ac85b9888b86cec"><code>36a5a62</code></a>
fix(utils): move <code>generateString</code> to platform utils to avoid
importing crypto...</li>
<li>Additional commits viewable in <a
href="https://github.com/axios/axios/compare/v1.7.7...v1.8.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axios&package-manager=npm_and_yarn&previous-version=1.7.7&new-version=1.8.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/microsoft/react-native-macos/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## Summary:

`nx release` requires a `.npmrc` file. Let's create one with our NPM
auth token, and remove it after we finish publishing out of an abundance
of caution.

## Test Plan:

Change is already in 0.76-stable and 0.77-stable. For whatever reason,
it works on 0.76 and not on 0.77

---------

Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
## Summary:

`nx release` will bump local packages that are referenced in our lock
file, thus invalidating the lock file till we run `yarn install` again.
Let's run `yarn install` as part of our generator

## Test Plan:

Tested by cherry picking this commit to a local `0.77-stable` branch,
creating a version plan, and running `nx release --dry-run`. `yarn
install` was run.

---------

Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
## Summary:

This reverts commit b9f3186.

The new architecture isn't ready on macOS yet. Specifically, the Fabric
renderer isn't ready. This is causing issue for new projects off the
macOS template. Let's disable it until we're ready.
## Test Plan:

CI should pass
## Summary:

`prerelease` can be `undefined` while `generatorOptions.preid` is an
empty string. Update the check to handle that

## Test Plan:

CI should pass
Bumps
[@babel/helpers](https://github.com/babel/babel/tree/HEAD/packages/babel-helpers)
from 7.26.0 to 7.26.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/babel/babel/releases"><code>@​babel/helpers</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v7.26.10 (2025-03-11)</h2>
<p>Thanks <a
href="https://github.com/jordan-choi"><code>@​jordan-choi</code></a> and
<a
href="https://github.com/mmmsssttt404"><code>@​mmmsssttt404</code></a>
for your first PRs!</p>
<p>This release includes a fix for <a
href="https://github.com/babel/babel/security/advisories/GHSA-968p-4wvh-cqc8">https://github.com/babel/babel/security/advisories/GHSA-968p-4wvh-cqc8</a>,
a security vulnerability which affects the <code>.replace</code> method
of transpiled regular expressions that use named capturing groups.</p>
<h4>:eyeglasses: Spec Compliance</h4>
<ul>
<li><code>babel-parser</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17159">#17159</a>
Disallow decorator in array pattern (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
</ul>
<h4>:bug: Bug Fix</h4>
<ul>
<li><code>babel-parser</code>, <code>babel-template</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17164">#17164</a>
Fix: always initialize ExportDeclaration attributes (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-core</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17142">#17142</a>
fix: &quot;Map maximum size exceeded&quot; in deepClone (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-parser</code>,
<code>babel-plugin-transform-typescript</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17154">#17154</a>
Update typescript parser tests (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-traverse</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17151">#17151</a>
fix: Should not evaluate vars in child scope (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-generator</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17153">#17153</a>
fix: Correctly generate <code>abstract override</code> (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-parser</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17107">#17107</a> Fix
source type detection when parsing TypeScript (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>, <code>babel-runtime</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17173">#17173</a> Fix
processing of replacement pattern with named capture groups (<a
href="https://github.com/%5Bmmmsssttt404%5D(https://github.com/mmmsssttt404)"><code>@​mmmsssttt404</code></a>)</li>
</ul>
</li>
</ul>
<h4>:nail_care: Polish</h4>
<ul>
<li><code>babel-standalone</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17158">#17158</a>
Avoid warnings when re-bundling <code>@​babel/standalone</code> with
webpack (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
</ul>
<h4>:house: Internal</h4>
<ul>
<li><code>babel-parser</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17160">#17160</a>
Left-value parsing cleanup (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
</ul>
<h4>Committers: 6</h4>
<ul>
<li>Babel Bot (<a
href="https://github.com/babel-bot"><code>@​babel-bot</code></a>)</li>
<li>Huáng Jùnliàng (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
<li>Nicolò Ribaudo (<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
<li>Yunyoung Jordan Choi (<a
href="https://github.com/jordan-choi"><code>@​jordan-choi</code></a>)</li>
<li><a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a></li>
<li><a
href="https://github.com/mmmsssttt404"><code>@​mmmsssttt404</code></a></li>
</ul>
<h2>v7.26.9 (2025-02-14)</h2>
<h4>:bug: Bug Fix</h4>
<ul>
<li><code>babel-types</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17103">#17103</a>
fix: Definition for <code>TSPropertySignature.kind</code> (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-generator</code>, <code>babel-types</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17062">#17062</a>
Print TypeScript optional/definite in ClassPrivateProperty (<a
href="https://github.com/jamiebuilds-signal"><code>@​jamiebuilds-signal</code></a>)</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/babel/babel/blob/main/CHANGELOG.md"><code>@​babel/helpers</code>'s
changelog</a>.</em></p>
<blockquote>
<h2>v7.26.10 (2025-03-11)</h2>
<h4>:eyeglasses: Spec Compliance</h4>
<ul>
<li><code>babel-parser</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17159">#17159</a>
Disallow decorator in array pattern (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
</ul>
<h4>:bug: Bug Fix</h4>
<ul>
<li><code>babel-parser</code>, <code>babel-template</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17164">#17164</a>
Fix: always initialize ExportDeclaration attributes (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-core</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17142">#17142</a>
fix: &quot;Map maximum size exceeded&quot; in deepClone (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-parser</code>,
<code>babel-plugin-transform-typescript</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17154">#17154</a>
Update typescript parser tests (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-traverse</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17151">#17151</a>
fix: Should not evaluate vars in child scope (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-generator</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17153">#17153</a>
fix: Correctly generate <code>abstract override</code> (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-parser</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17107">#17107</a> Fix
source type detection when parsing TypeScript (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>, <code>babel-runtime</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17173">#17173</a> Fix
processing of replacement pattern with named capture groups (<a
href="https://github.com/%5Bmmmsssttt404%5D(https://github.com/mmmsssttt404)"><code>@​mmmsssttt404</code></a>)</li>
</ul>
</li>
</ul>
<h4>:nail_care: Polish</h4>
<ul>
<li><code>babel-standalone</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17158">#17158</a>
Avoid warnings when re-bundling <code>@​babel/standalone</code> with
webpack (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
</ul>
<h4>:house: Internal</h4>
<ul>
<li><code>babel-parser</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17160">#17160</a>
Left-value parsing cleanup (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
</ul>
<h2>v7.26.9 (2025-02-14)</h2>
<h4>:bug: Bug Fix</h4>
<ul>
<li><code>babel-types</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17103">#17103</a>
fix: Definition for <code>TSPropertySignature.kind</code> (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
<li><code>babel-generator</code>, <code>babel-types</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17062">#17062</a>
Print TypeScript optional/definite in ClassPrivateProperty (<a
href="https://github.com/jamiebuilds-signal"><code>@​jamiebuilds-signal</code></a>)</li>
</ul>
</li>
</ul>
<h4>:house: Internal</h4>
<ul>
<li><code>babel-types</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17130">#17130</a> Use
<code>.ts</code> files with explicit reexports to solve name conflicts
(<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
</ul>
</li>
<li><code>babel-core</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17127">#17127</a> Do
not depend on <code>@types/gensync</code> in Babel 7 (<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
</ul>
</li>
</ul>
<h2>v7.26.7 (2025-01-24)</h2>
<h4>:bug: Bug Fix</h4>
<ul>
<li><code>babel-helpers</code>, <code>babel-preset-env</code>,
<code>babel-runtime-corejs3</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17086">#17086</a>
Make &quot;object without properties&quot; helpers ES6-compatible (<a
href="https://github.com/tquetano-netflix"><code>@​tquetano-netflix</code></a>)</li>
</ul>
</li>
<li><code>babel-plugin-transform-typeof-symbol</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/17085">#17085</a>
fix: Correctly handle <code>typeof</code> in arrow functions (<a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a>)</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/babel/babel/commit/e1ce99df422971175249509e7bbc2b327b8f7957"><code>e1ce99d</code></a>
v7.26.10</li>
<li><a
href="https://github.com/babel/babel/commit/d5952e80c0faa5ec20e35085531b6e572d31dad4"><code>d5952e8</code></a>
Fix processing of replacement pattern with named capture groups (<a
href="https://github.com/babel/babel/tree/HEAD/packages/babel-helpers/issues/17173">#17173</a>)</li>
<li><a
href="https://github.com/babel/babel/commit/64bca7b5f308cd52c192a5c821a57f6d1b0475f4"><code>64bca7b</code></a>
v7.26.9</li>
<li><a
href="https://github.com/babel/babel/commit/4cf5c9e0fbe8899bb9eb0dac7c615406a4fe926d"><code>4cf5c9e</code></a>
[babel 8] Use <code>@babel/types</code> for parser's return type (<a
href="https://github.com/babel/babel/tree/HEAD/packages/babel-helpers/issues/17117">#17117</a>)</li>
<li><a
href="https://github.com/babel/babel/commit/2d9514066e3b135835ed93246ebbcdb7ca0263ca"><code>2d95140</code></a>
v7.26.7</li>
<li><a
href="https://github.com/babel/babel/commit/0e6199b2aac12f41053416977379066e80ef14a7"><code>0e6199b</code></a>
Make &quot;object without properties&quot; helpers ES6-compatible (<a
href="https://github.com/babel/babel/tree/HEAD/packages/babel-helpers/issues/17086">#17086</a>)</li>
<li><a
href="https://github.com/babel/babel/commit/cd24cc07ef6558b7f6510f9177f6393c91b0549f"><code>cd24cc0</code></a>
chore: Update TS 5.7 (<a
href="https://github.com/babel/babel/tree/HEAD/packages/babel-helpers/issues/17053">#17053</a>)</li>
<li>See full diff in <a
href="https://github.com/babel/babel/commits/v7.26.10/packages/babel-helpers">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@babel/helpers&package-manager=npm_and_yarn&previous-version=7.26.0&new-version=7.26.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/microsoft/react-native-macos/network/alerts).

</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Saad Najmi <sanajmi@microsoft.com>
## Summary:

I noticed NPM publish failing still. My guess is the second addition of
this line to our `.npmrc` is messing it up

## Test Plan:

Testing on 0.78 release.
## Summary:

We aren't yet ready to publish nightlies, so unconditionally running
`publish` on the main branch might accidentally publish versions of
React Native macOS we don't want. Let's disable it for now.

## Test Plan:

As with all publish pipeline changes, merge and hope for the best.
Co-authored-by: microsoft-github-policy-service[bot] <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com>
## Summary:

This was unnecessary. Thanks @tido64 for pointing it out.

## Test Plan:

CI should pass
## Summary:

Only publish packages if there are changes to push

## Test Plan:

n/a
@pull pull Bot added the ⤵️ pull label Apr 3, 2025
console.info(`Executing flow: ${flow}`);
const timeout = 1000 * 60 * 10; // 10 minutes
childProcess.execSync(
`MAESTRO_DRIVER_STARTUP_TIMEOUT=120000 $HOME/.maestro/bin/maestro test ${flow} --format junit -e APP_ID=${APP_ID} --debug-output /tmp/MaestroLogs`,

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
file name
.
@@ -1 +1 @@
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,s,l){if(i<=o)return;const a=function(t,r,n,o,i){const s=t[i];e(t,o,i);let l=n;for(let i=n;i<o;++i)r(t[i],s)<0&&(e(t,l,i),++l);return e(t,o,l),l}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);s<a&&t(r,n,o,a-1,s,l),a<l&&t(r,n,a+1,i,s,l)}function r(e,t,r,n){const o=[];let i=0,s=0;for(;i<e.length&&s<t.length;){const l=r(e[i],t[s]);!n&&l||o.push(l<=0?e[i]:t[s]),l<=0&&i++,l>=0&&s++}if(n){for(;i<e.length;)o.push(e[i++]);for(;s<t.length;)o.push(t[s++])}return o}function n(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>0?i=n+1:s=n}return s}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,s=0,l=!1,a=!1,u=0;do{u=o+(i-o)/2,s=n?Math.ceil(u):Math.floor(u),l=t(e[s]),a=l===n,a?o=Math.min(i,s+(o===s?1:0)):i=Math.max(o,s+(i===s?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,s){return 0===n&&o===e.length-1&&0===i&&s>=o?e.sort(r):t(e,r,n,o,i,s),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>=0?i=n+1:s=n}return s},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),s=Object.freeze({__proto__:null});var l=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var a=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,s,l=0,a=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,l=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,l=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,l=0)}if(o&&"forward"!==o&&"both"!==o)s=e,a=t;else{let o=e;for(;o;){if(o===n){s||(s=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){s=o,a=n;break}}if(s)break;o=o.traverseNextNode(n)}s||(s=n,a=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,l),u.setEnd(s,a),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class d{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var h=Object.freeze({__proto__:null,inverse:function(e){const t=new d;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:d,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const g=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},p=new Map([["8∶5","16∶10"]]);var m=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:g,aspectRatio:(e,t)=>{const r=g(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return p.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var b=Object.freeze({__proto__:null,addAll:function(e,t){for(const r of t)e.add(r)},isEqual:function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}});const E=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},_=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),x=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),N=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},w=function(){return"^[]{}()\\.^$*+?|-,"},S=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};var O=Object.freeze({__proto__:null,escapeCharacters:E,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(x.has(r))return x.get(r);return"\\x"+_(r.charCodeAt(0),2)}if(n){return"\\u"+_(n.charCodeAt(0),4)}return t?x.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let s=Number(t[r++]);return isNaN(s)&&(s=0),"d"===i?String(Math.floor(s)).padStart(Number(o),"0"):void 0!==o?s.toFixed(Number(o)):String(s)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let s=0;for(let e=0;e<n;e++)o=e%3,s|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),t(63&s)),s=0);return 0===o?i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),61)),i},findIndexesOfSubString:N,findLineEndingIndexes:e=>{const t=N(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:w,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r){const n=t?"g":"gi";let o;if(r)try{o=new RegExp(e,n)}catch(e){}return o||(o=S(e,n)),o},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>E(e,"^[]{}()\\.^$*+?|-,"),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,s;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),s=!Number.isNaN(Number(o)),i&&!s)return-1;if(s&&!i)return 1;if(i&&s){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},createPlainTextSearchRegex:S,toLowerCaseString:function(e){return e.toLowerCase()},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r}});function v(e){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}`)}function C(e,t){throw new Error(t)}function A(e){return e}var y=Object.freeze({__proto__:null,assertNotNullOrUndefined:v,assertNever:C,assertUnhandled:A});var U=Object.freeze({__proto__:null,LocalizedEmptyString:""});class R extends Error{message;constructor(e){super(e),this.message=e}}var M=Object.freeze({__proto__:null,UserVisibleError:R,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof R}});function T(e,t="DCHECK"){}export{i as ArrayUtilities,s as Brand,T as DCHECK,u as DOMUtilities,l as DateUtilities,a as DevToolsPath,f as KeyboardUtilities,h as MapUtilities,m as NumberUtilities,b as SetUtilities,O as StringUtilities,y as TypeScriptUtilities,U as UIString,M as UserVisibleError,C as assertNever,v as assertNotNullOrUndefined,A as assertUnhandled};
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,a,s){if(i<=o)return;const l=function(t,r,n,o,i){const a=t[i];e(t,o,i);let s=n;for(let i=n;i<o;++i)r(t[i],a)<0&&(e(t,s,i),++s);return e(t,o,s),s}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);a<l&&t(r,n,o,l-1,a,s),l<s&&t(r,n,l+1,i,a,s)}function r(e,t,r,n){const o=[];let i=0,a=0;for(;i<e.length&&a<t.length;){const s=r(e[i],t[a]);!n&&s||o.push(s<=0?e[i]:t[a]),s<=0&&i++,s>=0&&a++}if(n){for(;i<e.length;)o.push(e[i++]);for(;a<t.length;)o.push(t[a++])}return o}function n(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>0?i=n+1:a=n}return a}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,a=0,s=!1,l=!1,u=0;do{u=o+(i-o)/2,a=n?Math.ceil(u):Math.floor(u),s=t(e[a]),l=s===n,l?o=Math.min(i,a+(o===a?1:0)):i=Math.max(o,a+(i===a?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,a){return 0===n&&o===e.length-1&&0===i&&a>=o?e.sort(r):t(e,r,n,o,i,a),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>=0?i=n+1:a=n}return a},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),a=Object.freeze({__proto__:null});var s=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var l=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,a,s=0,l=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,s=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,s=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,s=0)}if(o&&"forward"!==o&&"both"!==o)a=e,l=t;else{let o=e;for(;o;){if(o===n){a||(a=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){a=o,l=n;break}}if(a)break;o=o.traverseNextNode(n)}a||(a=n,l=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,s),u.setEnd(a,l),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class h{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}keys(){return this.map.keys()}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var p=Object.freeze({__proto__:null,inverse:function(e){const t=new h;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:h,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const d=new Set(["application/ecmascript","application/javascript","application/json","application/json+protobuf","application/vnd.dart","application/xml","application/x-aspx","application/x-javascript","application/x-jsp","application/x-httpd-php"]);function g(e,t,r=0){for(let n=r;n<e.length;n++)if(t.includes(e[n]))return n;return-1}function m(e,t,r=0){for(let n=r;n<e.length;n++)if(!t.includes(e[n]))return n;return-1}var b=Object.freeze({__proto__:null,isTextType:function(e){return e.startsWith("text/")||e.endsWith("+json")||e.endsWith("+xml")||d.has(e)},parseContentType:function(e){if("*/*"===e)return{mimeType:null,charset:null};const{mimeType:t,params:r}=function(e){e=e.trim();let t=g(e," \t;(");t<0&&(t=e.length);const r=e.indexOf("/");if(r<0||r>t)return{mimeType:null,params:new Map};const n=e.substring(0,t).toLowerCase(),o=new Map;let i=e.indexOf(";",t);for(;i>=0&&i<e.length;){if(++i,i=m(e," \t",i),i<0)continue;const t=i;if(i=g(e,";=",i),i<0||";"===e[i])continue;const r=e.substring(t,i).toLowerCase();++i,i=m(e," \t",i);let n="";if(!(i<0||";"===e[i])){if('"'!==e[i]){const t=i;i=e.indexOf(";",i);const r=i>=0?i:e.length;n=e.substring(t,r).trimEnd()}else{for(++i;i<e.length&&'"'!==e[i];)"\\"===e[i]&&i+1<e.length&&++i,n+=e[i],++i;i=e.indexOf(";",i)}o.has(r)||o.set(r,n)}}return{mimeType:n,params:o}}(e);return{mimeType:t,charset:r.get("charset")?.toLowerCase().trim()??null}}});const w=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},x=new Map([["8∶5","16∶10"]]);var _=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:w,aspectRatio:(e,t)=>{const r=w(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return x.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var E=Object.freeze({__proto__:null,promiseWithResolvers:function(){let e,t;return{promise:new Promise(((r,n)=>{e=r,t=n})),resolve:e,reject:t}}});const O=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},N=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),y=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),A=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},v=/^([a-z0-9]+(?:-[a-z0-9]+)*\.)*[a-z0-9]+(?:-[a-z0-9]+)*$/,S="^[]{}()\\.^$*+?|-,",C=function(){return S},T=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!==C().indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};const U=/[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\b|_)|[A-Za-z][0-9]+[a-z]?|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g,M=function(e){return e.match?.(U)?.map((e=>e.toLowerCase())).join("-").replaceAll("-.-",".")||e};var R=Object.freeze({__proto__:null,escapeCharacters:O,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(y.has(r))return y.get(r);return"\\x"+N(r.charCodeAt(0),2)}if(n){return"\\u"+N(n.charCodeAt(0),4)}return t?y.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let a=Number(t[r++]);return isNaN(a)&&(a=0),"d"===i?String(Math.floor(a)).padStart(Number(o),"0"):void 0!==o?a.toFixed(Number(o)):String(a)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let a=0;for(let e=0;e<n;e++)o=e%3,a|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),t(63&a)),a=0);return 0===o?i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),61)),i},findIndexesOfSubString:A,findLineEndingIndexes:e=>{const t=A(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),isExtendedKebabCase:e=>v.test(e),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:C,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!==S.indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r,n=!1){const o=t?"g":"gi";let i;if(r)try{i=new RegExp(e,o)}catch(e){}return i||(i=T(e,o)),n&&i&&(i=new RegExp(`\\b${i.source}\\b`,o)),i},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>O(e,S),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,a;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),a=!Number.isNaN(Number(o)),i&&!a)return-1;if(a&&!i)return 1;if(i&&a){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},countUnmatchedLeftParentheses:e=>{let t=0;for(const r of e)"("===r?t++:")"===r&&t>0&&t--;return t},createPlainTextSearchRegex:T,toLowerCaseString:function(e){return e.toLowerCase()},toKebabCase:M,toKebabCaseKeys:function(e){const t={};for(const[r,n]of Object.entries(e))t[M(r)]=n;return t},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r},concatBase64:function(e,t){if(0===e.length||!e.endsWith("="))return e+t;const r=e.substring(0,e.length-4),n=e.substring(e.length-4);return r+window.btoa(window.atob(n)+window.atob(t))}});var z=Object.freeze({__proto__:null,secondsToMilliSeconds:function(e){return 1e3*e},milliSecondsToSeconds:function(e){return e/1e3},microSecondsToMilliSeconds:function(e){return e/1e3}});class L extends Uint32Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){return this}asArrayOrFail(){throw new Error("Not an array")}}class j{#e;#t;length;constructor(e,t){this.#e=[],this.length=e;let r=1;for(;;){r*=2,this.#t=Math.ceil(e/r);try{if(void 0!==t&&this.#t>t)throw new RangeError;for(let e=0;e<r;++e)this.#e[e]=new Uint32Array(this.#t);return}catch(e){if(this.#t<1e6)throw e}}}getValue(e){if(e>=0&&e<this.length){const t=this.#t;return this.#e[Math.floor(e/t)][e%t]}return this.#e[0][-1]}setValue(e,t){if(e>=0&&e<this.length){const r=this.#t;this.#e[Math.floor(e/r)][e%r]=t}}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){throw new Error("Not an array")}}class F extends Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){return this}}class $ extends Uint8Array{constructor(e){super(Math.ceil(e/8))}getBit(e){return 0!==(this[e>>3]&1<<(7&e))}setBit(e){this[e>>3]|=1<<(7&e)}clearBit(e){this[e>>3]&=~(1<<(7&e))}previous(e){for(;e!==e>>3<<3;)if(--e,this.getBit(e))return e;let t;for(t=(e>>3)-1;t>=0&&0===this[t];--t);if(t<0)return-1;for(e=7+(t<<3);e>=t<<3;--e)if(this.getBit(e))return e;throw new Error("Unreachable")}}var B=Object.freeze({__proto__:null,createExpandableBigUint32Array:function(){return new F},createFixedBigUint32Array:function(e,t){try{if(void 0!==t&&e>t)throw new RangeError;return new L(e)}catch{return new j(e,t)}},createBitVector:function(e){return new $(e)}});function k(e,t){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}${t?`\n${t}`:""}`)}function V(e,t){throw new Error(t)}function D(e){return e}var I=Object.freeze({__proto__:null,assertNotNullOrUndefined:k,assertNever:V,assertUnhandled:D});var W=Object.freeze({__proto__:null,LocalizedEmptyString:""});class K extends Error{message;constructor(e){super(e),this.message=e}}var P=Object.freeze({__proto__:null,UserVisibleError:K,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof K}});export{i as ArrayUtilities,a as Brand,u as DOMUtilities,s as DateUtilities,l as DevToolsPath,f as KeyboardUtilities,p as MapUtilities,b as MimeType,_ as NumberUtilities,E as PromiseUtilities,R as StringUtilities,z as Timing,I as TypeScriptUtilities,B as TypedArrayUtilities,W as UIString,P as UserVisibleError,V as assertNever,k as assertNotNullOrUndefined,D as assertUnhandled};

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization High library

This string may still contain
<!--
, which may cause an HTML element injection vulnerability.
@@ -1 +1 @@
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,s,l){if(i<=o)return;const a=function(t,r,n,o,i){const s=t[i];e(t,o,i);let l=n;for(let i=n;i<o;++i)r(t[i],s)<0&&(e(t,l,i),++l);return e(t,o,l),l}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);s<a&&t(r,n,o,a-1,s,l),a<l&&t(r,n,a+1,i,s,l)}function r(e,t,r,n){const o=[];let i=0,s=0;for(;i<e.length&&s<t.length;){const l=r(e[i],t[s]);!n&&l||o.push(l<=0?e[i]:t[s]),l<=0&&i++,l>=0&&s++}if(n){for(;i<e.length;)o.push(e[i++]);for(;s<t.length;)o.push(t[s++])}return o}function n(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>0?i=n+1:s=n}return s}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,s=0,l=!1,a=!1,u=0;do{u=o+(i-o)/2,s=n?Math.ceil(u):Math.floor(u),l=t(e[s]),a=l===n,a?o=Math.min(i,s+(o===s?1:0)):i=Math.max(o,s+(i===s?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,s){return 0===n&&o===e.length-1&&0===i&&s>=o?e.sort(r):t(e,r,n,o,i,s),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>=0?i=n+1:s=n}return s},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),s=Object.freeze({__proto__:null});var l=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var a=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,s,l=0,a=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,l=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,l=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,l=0)}if(o&&"forward"!==o&&"both"!==o)s=e,a=t;else{let o=e;for(;o;){if(o===n){s||(s=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){s=o,a=n;break}}if(s)break;o=o.traverseNextNode(n)}s||(s=n,a=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,l),u.setEnd(s,a),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class d{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var h=Object.freeze({__proto__:null,inverse:function(e){const t=new d;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:d,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const g=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},p=new Map([["8∶5","16∶10"]]);var m=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:g,aspectRatio:(e,t)=>{const r=g(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return p.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var b=Object.freeze({__proto__:null,addAll:function(e,t){for(const r of t)e.add(r)},isEqual:function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}});const E=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},_=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),x=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),N=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},w=function(){return"^[]{}()\\.^$*+?|-,"},S=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};var O=Object.freeze({__proto__:null,escapeCharacters:E,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(x.has(r))return x.get(r);return"\\x"+_(r.charCodeAt(0),2)}if(n){return"\\u"+_(n.charCodeAt(0),4)}return t?x.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let s=Number(t[r++]);return isNaN(s)&&(s=0),"d"===i?String(Math.floor(s)).padStart(Number(o),"0"):void 0!==o?s.toFixed(Number(o)):String(s)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let s=0;for(let e=0;e<n;e++)o=e%3,s|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),t(63&s)),s=0);return 0===o?i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),61)),i},findIndexesOfSubString:N,findLineEndingIndexes:e=>{const t=N(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:w,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r){const n=t?"g":"gi";let o;if(r)try{o=new RegExp(e,n)}catch(e){}return o||(o=S(e,n)),o},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>E(e,"^[]{}()\\.^$*+?|-,"),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,s;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),s=!Number.isNaN(Number(o)),i&&!s)return-1;if(s&&!i)return 1;if(i&&s){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},createPlainTextSearchRegex:S,toLowerCaseString:function(e){return e.toLowerCase()},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r}});function v(e){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}`)}function C(e,t){throw new Error(t)}function A(e){return e}var y=Object.freeze({__proto__:null,assertNotNullOrUndefined:v,assertNever:C,assertUnhandled:A});var U=Object.freeze({__proto__:null,LocalizedEmptyString:""});class R extends Error{message;constructor(e){super(e),this.message=e}}var M=Object.freeze({__proto__:null,UserVisibleError:R,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof R}});function T(e,t="DCHECK"){}export{i as ArrayUtilities,s as Brand,T as DCHECK,u as DOMUtilities,l as DateUtilities,a as DevToolsPath,f as KeyboardUtilities,h as MapUtilities,m as NumberUtilities,b as SetUtilities,O as StringUtilities,y as TypeScriptUtilities,U as UIString,M as UserVisibleError,C as assertNever,v as assertNotNullOrUndefined,A as assertUnhandled};
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,a,s){if(i<=o)return;const l=function(t,r,n,o,i){const a=t[i];e(t,o,i);let s=n;for(let i=n;i<o;++i)r(t[i],a)<0&&(e(t,s,i),++s);return e(t,o,s),s}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);a<l&&t(r,n,o,l-1,a,s),l<s&&t(r,n,l+1,i,a,s)}function r(e,t,r,n){const o=[];let i=0,a=0;for(;i<e.length&&a<t.length;){const s=r(e[i],t[a]);!n&&s||o.push(s<=0?e[i]:t[a]),s<=0&&i++,s>=0&&a++}if(n){for(;i<e.length;)o.push(e[i++]);for(;a<t.length;)o.push(t[a++])}return o}function n(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>0?i=n+1:a=n}return a}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,a=0,s=!1,l=!1,u=0;do{u=o+(i-o)/2,a=n?Math.ceil(u):Math.floor(u),s=t(e[a]),l=s===n,l?o=Math.min(i,a+(o===a?1:0)):i=Math.max(o,a+(i===a?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,a){return 0===n&&o===e.length-1&&0===i&&a>=o?e.sort(r):t(e,r,n,o,i,a),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>=0?i=n+1:a=n}return a},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),a=Object.freeze({__proto__:null});var s=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var l=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,a,s=0,l=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,s=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,s=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,s=0)}if(o&&"forward"!==o&&"both"!==o)a=e,l=t;else{let o=e;for(;o;){if(o===n){a||(a=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){a=o,l=n;break}}if(a)break;o=o.traverseNextNode(n)}a||(a=n,l=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,s),u.setEnd(a,l),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class h{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}keys(){return this.map.keys()}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var p=Object.freeze({__proto__:null,inverse:function(e){const t=new h;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:h,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const d=new Set(["application/ecmascript","application/javascript","application/json","application/json+protobuf","application/vnd.dart","application/xml","application/x-aspx","application/x-javascript","application/x-jsp","application/x-httpd-php"]);function g(e,t,r=0){for(let n=r;n<e.length;n++)if(t.includes(e[n]))return n;return-1}function m(e,t,r=0){for(let n=r;n<e.length;n++)if(!t.includes(e[n]))return n;return-1}var b=Object.freeze({__proto__:null,isTextType:function(e){return e.startsWith("text/")||e.endsWith("+json")||e.endsWith("+xml")||d.has(e)},parseContentType:function(e){if("*/*"===e)return{mimeType:null,charset:null};const{mimeType:t,params:r}=function(e){e=e.trim();let t=g(e," \t;(");t<0&&(t=e.length);const r=e.indexOf("/");if(r<0||r>t)return{mimeType:null,params:new Map};const n=e.substring(0,t).toLowerCase(),o=new Map;let i=e.indexOf(";",t);for(;i>=0&&i<e.length;){if(++i,i=m(e," \t",i),i<0)continue;const t=i;if(i=g(e,";=",i),i<0||";"===e[i])continue;const r=e.substring(t,i).toLowerCase();++i,i=m(e," \t",i);let n="";if(!(i<0||";"===e[i])){if('"'!==e[i]){const t=i;i=e.indexOf(";",i);const r=i>=0?i:e.length;n=e.substring(t,r).trimEnd()}else{for(++i;i<e.length&&'"'!==e[i];)"\\"===e[i]&&i+1<e.length&&++i,n+=e[i],++i;i=e.indexOf(";",i)}o.has(r)||o.set(r,n)}}return{mimeType:n,params:o}}(e);return{mimeType:t,charset:r.get("charset")?.toLowerCase().trim()??null}}});const w=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},x=new Map([["8∶5","16∶10"]]);var _=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:w,aspectRatio:(e,t)=>{const r=w(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return x.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var E=Object.freeze({__proto__:null,promiseWithResolvers:function(){let e,t;return{promise:new Promise(((r,n)=>{e=r,t=n})),resolve:e,reject:t}}});const O=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},N=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),y=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),A=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},v=/^([a-z0-9]+(?:-[a-z0-9]+)*\.)*[a-z0-9]+(?:-[a-z0-9]+)*$/,S="^[]{}()\\.^$*+?|-,",C=function(){return S},T=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!==C().indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};const U=/[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\b|_)|[A-Za-z][0-9]+[a-z]?|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g,M=function(e){return e.match?.(U)?.map((e=>e.toLowerCase())).join("-").replaceAll("-.-",".")||e};var R=Object.freeze({__proto__:null,escapeCharacters:O,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(y.has(r))return y.get(r);return"\\x"+N(r.charCodeAt(0),2)}if(n){return"\\u"+N(n.charCodeAt(0),4)}return t?y.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let a=Number(t[r++]);return isNaN(a)&&(a=0),"d"===i?String(Math.floor(a)).padStart(Number(o),"0"):void 0!==o?a.toFixed(Number(o)):String(a)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let a=0;for(let e=0;e<n;e++)o=e%3,a|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),t(63&a)),a=0);return 0===o?i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),61)),i},findIndexesOfSubString:A,findLineEndingIndexes:e=>{const t=A(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),isExtendedKebabCase:e=>v.test(e),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:C,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!==S.indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r,n=!1){const o=t?"g":"gi";let i;if(r)try{i=new RegExp(e,o)}catch(e){}return i||(i=T(e,o)),n&&i&&(i=new RegExp(`\\b${i.source}\\b`,o)),i},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>O(e,S),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,a;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),a=!Number.isNaN(Number(o)),i&&!a)return-1;if(a&&!i)return 1;if(i&&a){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},countUnmatchedLeftParentheses:e=>{let t=0;for(const r of e)"("===r?t++:")"===r&&t>0&&t--;return t},createPlainTextSearchRegex:T,toLowerCaseString:function(e){return e.toLowerCase()},toKebabCase:M,toKebabCaseKeys:function(e){const t={};for(const[r,n]of Object.entries(e))t[M(r)]=n;return t},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r},concatBase64:function(e,t){if(0===e.length||!e.endsWith("="))return e+t;const r=e.substring(0,e.length-4),n=e.substring(e.length-4);return r+window.btoa(window.atob(n)+window.atob(t))}});var z=Object.freeze({__proto__:null,secondsToMilliSeconds:function(e){return 1e3*e},milliSecondsToSeconds:function(e){return e/1e3},microSecondsToMilliSeconds:function(e){return e/1e3}});class L extends Uint32Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){return this}asArrayOrFail(){throw new Error("Not an array")}}class j{#e;#t;length;constructor(e,t){this.#e=[],this.length=e;let r=1;for(;;){r*=2,this.#t=Math.ceil(e/r);try{if(void 0!==t&&this.#t>t)throw new RangeError;for(let e=0;e<r;++e)this.#e[e]=new Uint32Array(this.#t);return}catch(e){if(this.#t<1e6)throw e}}}getValue(e){if(e>=0&&e<this.length){const t=this.#t;return this.#e[Math.floor(e/t)][e%t]}return this.#e[0][-1]}setValue(e,t){if(e>=0&&e<this.length){const r=this.#t;this.#e[Math.floor(e/r)][e%r]=t}}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){throw new Error("Not an array")}}class F extends Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){return this}}class $ extends Uint8Array{constructor(e){super(Math.ceil(e/8))}getBit(e){return 0!==(this[e>>3]&1<<(7&e))}setBit(e){this[e>>3]|=1<<(7&e)}clearBit(e){this[e>>3]&=~(1<<(7&e))}previous(e){for(;e!==e>>3<<3;)if(--e,this.getBit(e))return e;let t;for(t=(e>>3)-1;t>=0&&0===this[t];--t);if(t<0)return-1;for(e=7+(t<<3);e>=t<<3;--e)if(this.getBit(e))return e;throw new Error("Unreachable")}}var B=Object.freeze({__proto__:null,createExpandableBigUint32Array:function(){return new F},createFixedBigUint32Array:function(e,t){try{if(void 0!==t&&e>t)throw new RangeError;return new L(e)}catch{return new j(e,t)}},createBitVector:function(e){return new $(e)}});function k(e,t){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}${t?`\n${t}`:""}`)}function V(e,t){throw new Error(t)}function D(e){return e}var I=Object.freeze({__proto__:null,assertNotNullOrUndefined:k,assertNever:V,assertUnhandled:D});var W=Object.freeze({__proto__:null,LocalizedEmptyString:""});class K extends Error{message;constructor(e){super(e),this.message=e}}var P=Object.freeze({__proto__:null,UserVisibleError:K,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof K}});export{i as ArrayUtilities,a as Brand,u as DOMUtilities,s as DateUtilities,l as DevToolsPath,f as KeyboardUtilities,p as MapUtilities,b as MimeType,_ as NumberUtilities,E as PromiseUtilities,R as StringUtilities,z as Timing,I as TypeScriptUtilities,B as TypedArrayUtilities,W as UIString,P as UserVisibleError,V as assertNever,k as assertNotNullOrUndefined,D as assertUnhandled};

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization High library

This string may still contain
<!--
, which may cause an HTML element injection vulnerability.
@@ -1 +1 @@
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,s,l){if(i<=o)return;const a=function(t,r,n,o,i){const s=t[i];e(t,o,i);let l=n;for(let i=n;i<o;++i)r(t[i],s)<0&&(e(t,l,i),++l);return e(t,o,l),l}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);s<a&&t(r,n,o,a-1,s,l),a<l&&t(r,n,a+1,i,s,l)}function r(e,t,r,n){const o=[];let i=0,s=0;for(;i<e.length&&s<t.length;){const l=r(e[i],t[s]);!n&&l||o.push(l<=0?e[i]:t[s]),l<=0&&i++,l>=0&&s++}if(n){for(;i<e.length;)o.push(e[i++]);for(;s<t.length;)o.push(t[s++])}return o}function n(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>0?i=n+1:s=n}return s}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,s=0,l=!1,a=!1,u=0;do{u=o+(i-o)/2,s=n?Math.ceil(u):Math.floor(u),l=t(e[s]),a=l===n,a?o=Math.min(i,s+(o===s?1:0)):i=Math.max(o,s+(i===s?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,s){return 0===n&&o===e.length-1&&0===i&&s>=o?e.sort(r):t(e,r,n,o,i,s),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>=0?i=n+1:s=n}return s},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),s=Object.freeze({__proto__:null});var l=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var a=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,s,l=0,a=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,l=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,l=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,l=0)}if(o&&"forward"!==o&&"both"!==o)s=e,a=t;else{let o=e;for(;o;){if(o===n){s||(s=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){s=o,a=n;break}}if(s)break;o=o.traverseNextNode(n)}s||(s=n,a=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,l),u.setEnd(s,a),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class d{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var h=Object.freeze({__proto__:null,inverse:function(e){const t=new d;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:d,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const g=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},p=new Map([["8∶5","16∶10"]]);var m=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:g,aspectRatio:(e,t)=>{const r=g(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return p.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var b=Object.freeze({__proto__:null,addAll:function(e,t){for(const r of t)e.add(r)},isEqual:function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}});const E=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},_=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),x=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),N=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},w=function(){return"^[]{}()\\.^$*+?|-,"},S=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};var O=Object.freeze({__proto__:null,escapeCharacters:E,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(x.has(r))return x.get(r);return"\\x"+_(r.charCodeAt(0),2)}if(n){return"\\u"+_(n.charCodeAt(0),4)}return t?x.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let s=Number(t[r++]);return isNaN(s)&&(s=0),"d"===i?String(Math.floor(s)).padStart(Number(o),"0"):void 0!==o?s.toFixed(Number(o)):String(s)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let s=0;for(let e=0;e<n;e++)o=e%3,s|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),t(63&s)),s=0);return 0===o?i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),61)),i},findIndexesOfSubString:N,findLineEndingIndexes:e=>{const t=N(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:w,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r){const n=t?"g":"gi";let o;if(r)try{o=new RegExp(e,n)}catch(e){}return o||(o=S(e,n)),o},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>E(e,"^[]{}()\\.^$*+?|-,"),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,s;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),s=!Number.isNaN(Number(o)),i&&!s)return-1;if(s&&!i)return 1;if(i&&s){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},createPlainTextSearchRegex:S,toLowerCaseString:function(e){return e.toLowerCase()},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r}});function v(e){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}`)}function C(e,t){throw new Error(t)}function A(e){return e}var y=Object.freeze({__proto__:null,assertNotNullOrUndefined:v,assertNever:C,assertUnhandled:A});var U=Object.freeze({__proto__:null,LocalizedEmptyString:""});class R extends Error{message;constructor(e){super(e),this.message=e}}var M=Object.freeze({__proto__:null,UserVisibleError:R,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof R}});function T(e,t="DCHECK"){}export{i as ArrayUtilities,s as Brand,T as DCHECK,u as DOMUtilities,l as DateUtilities,a as DevToolsPath,f as KeyboardUtilities,h as MapUtilities,m as NumberUtilities,b as SetUtilities,O as StringUtilities,y as TypeScriptUtilities,U as UIString,M as UserVisibleError,C as assertNever,v as assertNotNullOrUndefined,A as assertUnhandled};
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,a,s){if(i<=o)return;const l=function(t,r,n,o,i){const a=t[i];e(t,o,i);let s=n;for(let i=n;i<o;++i)r(t[i],a)<0&&(e(t,s,i),++s);return e(t,o,s),s}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);a<l&&t(r,n,o,l-1,a,s),l<s&&t(r,n,l+1,i,a,s)}function r(e,t,r,n){const o=[];let i=0,a=0;for(;i<e.length&&a<t.length;){const s=r(e[i],t[a]);!n&&s||o.push(s<=0?e[i]:t[a]),s<=0&&i++,s>=0&&a++}if(n){for(;i<e.length;)o.push(e[i++]);for(;a<t.length;)o.push(t[a++])}return o}function n(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>0?i=n+1:a=n}return a}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,a=0,s=!1,l=!1,u=0;do{u=o+(i-o)/2,a=n?Math.ceil(u):Math.floor(u),s=t(e[a]),l=s===n,l?o=Math.min(i,a+(o===a?1:0)):i=Math.max(o,a+(i===a?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,a){return 0===n&&o===e.length-1&&0===i&&a>=o?e.sort(r):t(e,r,n,o,i,a),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>=0?i=n+1:a=n}return a},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),a=Object.freeze({__proto__:null});var s=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var l=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,a,s=0,l=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,s=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,s=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,s=0)}if(o&&"forward"!==o&&"both"!==o)a=e,l=t;else{let o=e;for(;o;){if(o===n){a||(a=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){a=o,l=n;break}}if(a)break;o=o.traverseNextNode(n)}a||(a=n,l=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,s),u.setEnd(a,l),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class h{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}keys(){return this.map.keys()}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var p=Object.freeze({__proto__:null,inverse:function(e){const t=new h;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:h,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const d=new Set(["application/ecmascript","application/javascript","application/json","application/json+protobuf","application/vnd.dart","application/xml","application/x-aspx","application/x-javascript","application/x-jsp","application/x-httpd-php"]);function g(e,t,r=0){for(let n=r;n<e.length;n++)if(t.includes(e[n]))return n;return-1}function m(e,t,r=0){for(let n=r;n<e.length;n++)if(!t.includes(e[n]))return n;return-1}var b=Object.freeze({__proto__:null,isTextType:function(e){return e.startsWith("text/")||e.endsWith("+json")||e.endsWith("+xml")||d.has(e)},parseContentType:function(e){if("*/*"===e)return{mimeType:null,charset:null};const{mimeType:t,params:r}=function(e){e=e.trim();let t=g(e," \t;(");t<0&&(t=e.length);const r=e.indexOf("/");if(r<0||r>t)return{mimeType:null,params:new Map};const n=e.substring(0,t).toLowerCase(),o=new Map;let i=e.indexOf(";",t);for(;i>=0&&i<e.length;){if(++i,i=m(e," \t",i),i<0)continue;const t=i;if(i=g(e,";=",i),i<0||";"===e[i])continue;const r=e.substring(t,i).toLowerCase();++i,i=m(e," \t",i);let n="";if(!(i<0||";"===e[i])){if('"'!==e[i]){const t=i;i=e.indexOf(";",i);const r=i>=0?i:e.length;n=e.substring(t,r).trimEnd()}else{for(++i;i<e.length&&'"'!==e[i];)"\\"===e[i]&&i+1<e.length&&++i,n+=e[i],++i;i=e.indexOf(";",i)}o.has(r)||o.set(r,n)}}return{mimeType:n,params:o}}(e);return{mimeType:t,charset:r.get("charset")?.toLowerCase().trim()??null}}});const w=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},x=new Map([["8∶5","16∶10"]]);var _=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:w,aspectRatio:(e,t)=>{const r=w(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return x.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var E=Object.freeze({__proto__:null,promiseWithResolvers:function(){let e,t;return{promise:new Promise(((r,n)=>{e=r,t=n})),resolve:e,reject:t}}});const O=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},N=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),y=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),A=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},v=/^([a-z0-9]+(?:-[a-z0-9]+)*\.)*[a-z0-9]+(?:-[a-z0-9]+)*$/,S="^[]{}()\\.^$*+?|-,",C=function(){return S},T=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!==C().indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};const U=/[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\b|_)|[A-Za-z][0-9]+[a-z]?|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g,M=function(e){return e.match?.(U)?.map((e=>e.toLowerCase())).join("-").replaceAll("-.-",".")||e};var R=Object.freeze({__proto__:null,escapeCharacters:O,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(y.has(r))return y.get(r);return"\\x"+N(r.charCodeAt(0),2)}if(n){return"\\u"+N(n.charCodeAt(0),4)}return t?y.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let a=Number(t[r++]);return isNaN(a)&&(a=0),"d"===i?String(Math.floor(a)).padStart(Number(o),"0"):void 0!==o?a.toFixed(Number(o)):String(a)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let a=0;for(let e=0;e<n;e++)o=e%3,a|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),t(63&a)),a=0);return 0===o?i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),61)),i},findIndexesOfSubString:A,findLineEndingIndexes:e=>{const t=A(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),isExtendedKebabCase:e=>v.test(e),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:C,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!==S.indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r,n=!1){const o=t?"g":"gi";let i;if(r)try{i=new RegExp(e,o)}catch(e){}return i||(i=T(e,o)),n&&i&&(i=new RegExp(`\\b${i.source}\\b`,o)),i},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>O(e,S),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,a;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),a=!Number.isNaN(Number(o)),i&&!a)return-1;if(a&&!i)return 1;if(i&&a){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},countUnmatchedLeftParentheses:e=>{let t=0;for(const r of e)"("===r?t++:")"===r&&t>0&&t--;return t},createPlainTextSearchRegex:T,toLowerCaseString:function(e){return e.toLowerCase()},toKebabCase:M,toKebabCaseKeys:function(e){const t={};for(const[r,n]of Object.entries(e))t[M(r)]=n;return t},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r},concatBase64:function(e,t){if(0===e.length||!e.endsWith("="))return e+t;const r=e.substring(0,e.length-4),n=e.substring(e.length-4);return r+window.btoa(window.atob(n)+window.atob(t))}});var z=Object.freeze({__proto__:null,secondsToMilliSeconds:function(e){return 1e3*e},milliSecondsToSeconds:function(e){return e/1e3},microSecondsToMilliSeconds:function(e){return e/1e3}});class L extends Uint32Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){return this}asArrayOrFail(){throw new Error("Not an array")}}class j{#e;#t;length;constructor(e,t){this.#e=[],this.length=e;let r=1;for(;;){r*=2,this.#t=Math.ceil(e/r);try{if(void 0!==t&&this.#t>t)throw new RangeError;for(let e=0;e<r;++e)this.#e[e]=new Uint32Array(this.#t);return}catch(e){if(this.#t<1e6)throw e}}}getValue(e){if(e>=0&&e<this.length){const t=this.#t;return this.#e[Math.floor(e/t)][e%t]}return this.#e[0][-1]}setValue(e,t){if(e>=0&&e<this.length){const r=this.#t;this.#e[Math.floor(e/r)][e%r]=t}}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){throw new Error("Not an array")}}class F extends Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){return this}}class $ extends Uint8Array{constructor(e){super(Math.ceil(e/8))}getBit(e){return 0!==(this[e>>3]&1<<(7&e))}setBit(e){this[e>>3]|=1<<(7&e)}clearBit(e){this[e>>3]&=~(1<<(7&e))}previous(e){for(;e!==e>>3<<3;)if(--e,this.getBit(e))return e;let t;for(t=(e>>3)-1;t>=0&&0===this[t];--t);if(t<0)return-1;for(e=7+(t<<3);e>=t<<3;--e)if(this.getBit(e))return e;throw new Error("Unreachable")}}var B=Object.freeze({__proto__:null,createExpandableBigUint32Array:function(){return new F},createFixedBigUint32Array:function(e,t){try{if(void 0!==t&&e>t)throw new RangeError;return new L(e)}catch{return new j(e,t)}},createBitVector:function(e){return new $(e)}});function k(e,t){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}${t?`\n${t}`:""}`)}function V(e,t){throw new Error(t)}function D(e){return e}var I=Object.freeze({__proto__:null,assertNotNullOrUndefined:k,assertNever:V,assertUnhandled:D});var W=Object.freeze({__proto__:null,LocalizedEmptyString:""});class K extends Error{message;constructor(e){super(e),this.message=e}}var P=Object.freeze({__proto__:null,UserVisibleError:K,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof K}});export{i as ArrayUtilities,a as Brand,u as DOMUtilities,s as DateUtilities,l as DevToolsPath,f as KeyboardUtilities,p as MapUtilities,b as MimeType,_ as NumberUtilities,E as PromiseUtilities,R as StringUtilities,z as Timing,I as TypeScriptUtilities,B as TypedArrayUtilities,W as UIString,P as UserVisibleError,V as assertNever,k as assertNotNullOrUndefined,D as assertUnhandled};

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization High library

This string may still contain
<!--
, which may cause an HTML element injection vulnerability.
@@ -1 +1 @@
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,s,l){if(i<=o)return;const a=function(t,r,n,o,i){const s=t[i];e(t,o,i);let l=n;for(let i=n;i<o;++i)r(t[i],s)<0&&(e(t,l,i),++l);return e(t,o,l),l}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);s<a&&t(r,n,o,a-1,s,l),a<l&&t(r,n,a+1,i,s,l)}function r(e,t,r,n){const o=[];let i=0,s=0;for(;i<e.length&&s<t.length;){const l=r(e[i],t[s]);!n&&l||o.push(l<=0?e[i]:t[s]),l<=0&&i++,l>=0&&s++}if(n){for(;i<e.length;)o.push(e[i++]);for(;s<t.length;)o.push(t[s++])}return o}function n(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>0?i=n+1:s=n}return s}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,s=0,l=!1,a=!1,u=0;do{u=o+(i-o)/2,s=n?Math.ceil(u):Math.floor(u),l=t(e[s]),a=l===n,a?o=Math.min(i,s+(o===s?1:0)):i=Math.max(o,s+(i===s?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,s){return 0===n&&o===e.length-1&&0===i&&s>=o?e.sort(r):t(e,r,n,o,i,s),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,s=void 0!==o?o:e.length;for(;i<s;){const n=i+s>>1;r(t,e[n])>=0?i=n+1:s=n}return s},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),s=Object.freeze({__proto__:null});var l=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var a=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,s,l=0,a=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,l=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,l=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,l=0)}if(o&&"forward"!==o&&"both"!==o)s=e,a=t;else{let o=e;for(;o;){if(o===n){s||(s=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){s=o,a=n;break}}if(s)break;o=o.traverseNextNode(n)}s||(s=n,a=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,l),u.setEnd(s,a),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class d{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var h=Object.freeze({__proto__:null,inverse:function(e){const t=new d;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:d,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const g=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},p=new Map([["8∶5","16∶10"]]);var m=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:g,aspectRatio:(e,t)=>{const r=g(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return p.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var b=Object.freeze({__proto__:null,addAll:function(e,t){for(const r of t)e.add(r)},isEqual:function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}});const E=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},_=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),x=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),N=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},w=function(){return"^[]{}()\\.^$*+?|-,"},S=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};var O=Object.freeze({__proto__:null,escapeCharacters:E,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(x.has(r))return x.get(r);return"\\x"+_(r.charCodeAt(0),2)}if(n){return"\\u"+_(n.charCodeAt(0),4)}return t?x.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let s=Number(t[r++]);return isNaN(s)&&(s=0),"d"===i?String(Math.floor(s)).padStart(Number(o),"0"):void 0!==o?s.toFixed(Number(o)):String(s)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let s=0;for(let e=0;e<n;e++)o=e%3,s|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),t(63&s)),s=0);return 0===o?i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(s>>>18&63),t(s>>>12&63),t(s>>>6&63),61)),i},findIndexesOfSubString:N,findLineEndingIndexes:e=>{const t=N(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:w,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!=="^[]{}()\\.^$*+?|-,".indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r){const n=t?"g":"gi";let o;if(r)try{o=new RegExp(e,n)}catch(e){}return o||(o=S(e,n)),o},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>E(e,"^[]{}()\\.^$*+?|-,"),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,s;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),s=!Number.isNaN(Number(o)),i&&!s)return-1;if(s&&!i)return 1;if(i&&s){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},createPlainTextSearchRegex:S,toLowerCaseString:function(e){return e.toLowerCase()},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r}});function v(e){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}`)}function C(e,t){throw new Error(t)}function A(e){return e}var y=Object.freeze({__proto__:null,assertNotNullOrUndefined:v,assertNever:C,assertUnhandled:A});var U=Object.freeze({__proto__:null,LocalizedEmptyString:""});class R extends Error{message;constructor(e){super(e),this.message=e}}var M=Object.freeze({__proto__:null,UserVisibleError:R,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof R}});function T(e,t="DCHECK"){}export{i as ArrayUtilities,s as Brand,T as DCHECK,u as DOMUtilities,l as DateUtilities,a as DevToolsPath,f as KeyboardUtilities,h as MapUtilities,m as NumberUtilities,b as SetUtilities,O as StringUtilities,y as TypeScriptUtilities,U as UIString,M as UserVisibleError,C as assertNever,v as assertNotNullOrUndefined,A as assertUnhandled};
function e(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function t(r,n,o,i,a,s){if(i<=o)return;const l=function(t,r,n,o,i){const a=t[i];e(t,o,i);let s=n;for(let i=n;i<o;++i)r(t[i],a)<0&&(e(t,s,i),++s);return e(t,o,s),s}(r,n,o,i,Math.floor(Math.random()*(i-o))+o);a<l&&t(r,n,o,l-1,a,s),l<s&&t(r,n,l+1,i,a,s)}function r(e,t,r,n){const o=[];let i=0,a=0;for(;i<e.length&&a<t.length;){const s=r(e[i],t[a]);!n&&s||o.push(s<=0?e[i]:t[a]),s<=0&&i++,s>=0&&a++}if(n){for(;i<e.length;)o.push(e[i++]);for(;a<t.length;)o.push(t[a++])}return o}function n(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>0?i=n+1:a=n}return a}function o(e,t,r){const n="END"===r;if(0===e.length)return null;let o=0,i=e.length-1,a=0,s=!1,l=!1,u=0;do{u=o+(i-o)/2,a=n?Math.ceil(u):Math.floor(u),s=t(e[a]),l=s===n,l?o=Math.min(i,a+(o===a?1:0)):i=Math.max(o,a+(i===a?-1:0))}while(i!==o);return t(e[o])?o:null}var i=Object.freeze({__proto__:null,removeElement:(e,t,r)=>{let n=e.indexOf(t);if(-1===n)return!1;if(r)return e.splice(n,1),!0;for(let r=n+1,o=e.length;r<o;++r)e[r]!==t&&(e[n++]=e[r]);return e.length=n,!0},sortRange:function(e,r,n,o,i,a){return 0===n&&o===e.length-1&&0===i&&a>=o?e.sort(r):t(e,r,n,o,i,a),e},binaryIndexOf:(e,t,r)=>{const o=n(e,t,r);return o<e.length&&0===r(t,e[o])?o:-1},intersectOrdered:(e,t,n)=>r(e,t,n,!1),mergeOrdered:(e,t,n)=>r(e,t,n,!0),DEFAULT_COMPARATOR:(e,t)=>e<t?-1:e>t?1:0,lowerBound:n,upperBound:function(e,t,r,n,o){let i=n||0,a=void 0!==o?o:e.length;for(;i<a;){const n=i+a>>1;r(t,e[n])>=0?i=n+1:a=n}return a},nearestIndexFromBeginning:function(e,t){return o(e,t,"BEGINNING")},nearestIndexFromEnd:function(e,t){return o(e,t,"END")},arrayDoesNotContainNullOrUndefined:function(e){return!e.includes(null)&&!e.includes(void 0)}}),a=Object.freeze({__proto__:null});var s=Object.freeze({__proto__:null,isValid:e=>!isNaN(e.getTime()),toISO8601Compact:e=>{function t(e){return(e>9?"":"0")+e}return e.getFullYear()+t(e.getMonth()+1)+t(e.getDate())+"T"+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}});var l=Object.freeze({__proto__:null,EmptyUrlString:"",EmptyRawPathString:"",EmptyEncodedPathString:""});var u=Object.freeze({__proto__:null,deepActiveElement:function(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t},getEnclosingShadowRootForNode:function(e){let t=e.parentNodeOrShadowHost();for(;t;){if(t instanceof ShadowRoot)return t;t=t.parentNodeOrShadowHost()}return null},rangeOfWord:function(e,t,r,n,o){let i,a,s=0,l=0;if(n||(n=e),o&&"backward"!==o&&"both"!==o)i=e,s=t;else{let o=e;for(;o;){if(o===n){i||(i=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t-1:o.nodeValue.length-1;n>=0;--n)if(-1!==r.indexOf(o.nodeValue[n])){i=o,s=n+1;break}}if(i)break;o=o.traversePreviousNode(n)}i||(i=n,s=0)}if(o&&"forward"!==o&&"both"!==o)a=e,l=t;else{let o=e;for(;o;){if(o===n){a||(a=n);break}if(o.nodeType===Node.TEXT_NODE&&null!==o.nodeValue){for(let n=o===e?t:0;n<o.nodeValue.length;++n)if(-1!==r.indexOf(o.nodeValue[n])){a=o,l=n;break}}if(a)break;o=o.traverseNextNode(n)}a||(a=n,l=n.nodeType===Node.TEXT_NODE?n.nodeValue?.length||0:n.childNodes.length)}if(!e.ownerDocument)throw new Error("No `ownerDocument` found for rootNode");const u=e.ownerDocument.createRange();return u.setStart(i,s),u.setEnd(a,l),u}});const c=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);var f=Object.freeze({__proto__:null,ENTER_KEY:"Enter",ESCAPE_KEY:"Escape",TAB_KEY:"Tab",ARROW_KEYS:c,keyIsArrowKey:function(e){return c.has(e)},isEscKey:function(e){return"Escape"===e.key},isEnterOrSpaceKey:function(e){return"Enter"===e.key||" "===e.key}});class h{map=new Map;set(e,t){let r=this.map.get(e);r||(r=new Set,this.map.set(e,r)),r.add(t)}get(e){return this.map.get(e)||new Set}has(e){return this.map.has(e)}hasValue(e,t){const r=this.map.get(e);return!!r&&r.has(t)}get size(){return this.map.size}delete(e,t){const r=this.get(e);if(!r)return!1;const n=r.delete(t);return r.size||this.map.delete(e),n}deleteAll(e){this.map.delete(e)}keysArray(){return[...this.map.keys()]}keys(){return this.map.keys()}valuesArray(){const e=[];for(const t of this.map.values())e.push(...t.values());return e}clear(){this.map.clear()}}var p=Object.freeze({__proto__:null,inverse:function(e){const t=new h;for(const[r,n]of e.entries())t.set(n,r);return t},Multimap:h,getWithDefault:function(e,t,r){let n=e.get(t);return n||(n=r(t),e.set(t,n)),n}});const d=new Set(["application/ecmascript","application/javascript","application/json","application/json+protobuf","application/vnd.dart","application/xml","application/x-aspx","application/x-javascript","application/x-jsp","application/x-httpd-php"]);function g(e,t,r=0){for(let n=r;n<e.length;n++)if(t.includes(e[n]))return n;return-1}function m(e,t,r=0){for(let n=r;n<e.length;n++)if(!t.includes(e[n]))return n;return-1}var b=Object.freeze({__proto__:null,isTextType:function(e){return e.startsWith("text/")||e.endsWith("+json")||e.endsWith("+xml")||d.has(e)},parseContentType:function(e){if("*/*"===e)return{mimeType:null,charset:null};const{mimeType:t,params:r}=function(e){e=e.trim();let t=g(e," \t;(");t<0&&(t=e.length);const r=e.indexOf("/");if(r<0||r>t)return{mimeType:null,params:new Map};const n=e.substring(0,t).toLowerCase(),o=new Map;let i=e.indexOf(";",t);for(;i>=0&&i<e.length;){if(++i,i=m(e," \t",i),i<0)continue;const t=i;if(i=g(e,";=",i),i<0||";"===e[i])continue;const r=e.substring(t,i).toLowerCase();++i,i=m(e," \t",i);let n="";if(!(i<0||";"===e[i])){if('"'!==e[i]){const t=i;i=e.indexOf(";",i);const r=i>=0?i:e.length;n=e.substring(t,r).trimEnd()}else{for(++i;i<e.length&&'"'!==e[i];)"\\"===e[i]&&i+1<e.length&&++i,n+=e[i],++i;i=e.indexOf(";",i)}o.has(r)||o.set(r,n)}}return{mimeType:n,params:o}}(e);return{mimeType:t,charset:r.get("charset")?.toLowerCase().trim()??null}}});const w=(e,t)=>{for(e=Math.round(e),t=Math.round(t);0!==t;){const r=t;t=e%t,e=r}return e},x=new Map([["8∶5","16∶10"]]);var _=Object.freeze({__proto__:null,clamp:(e,t,r)=>{let n=e;return e<t?n=t:e>r&&(n=r),n},mod:(e,t)=>(e%t+t)%t,bytesToString:e=>{if(e<1e3)return`${e.toFixed(0)} B`;const t=e/1e3;if(t<100)return`${t.toFixed(1)} kB`;if(t<1e3)return`${t.toFixed(0)} kB`;const r=t/1e3;return r<100?`${r.toFixed(1)} MB`:`${r.toFixed(0)} MB`},toFixedIfFloating:e=>{if(!e||Number.isNaN(Number(e)))return e;const t=Number(e);return t%1?t.toFixed(3):String(t)},floor:(e,t=0)=>{const r=Math.pow(10,t);return Math.floor(e*r)/r},greatestCommonDivisor:w,aspectRatio:(e,t)=>{const r=w(e,t);0!==r&&(e/=r,t/=r);const n=`${e}∶${t}`;return x.get(n)||n},withThousandsSeparator:function(e){let t=String(e);const r=/(\d+)(\d{3})/;for(;t.match(r);)t=t.replace(r,"$1 $2");return t}});var E=Object.freeze({__proto__:null,promiseWithResolvers:function(){let e,t;return{promise:new Promise(((r,n)=>{e=r,t=n})),resolve:e,reject:t}}});const O=(e,t)=>{let r=!1;for(let n=0;n<t.length;++n)if(-1!==e.indexOf(t.charAt(n))){r=!0;break}if(!r)return String(e);let n="";for(let r=0;r<e.length;++r)-1!==t.indexOf(e.charAt(r))&&(n+="\\"),n+=e.charAt(r);return n},N=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),y=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),A=(e,t)=>{const r=[];let n=e.indexOf(t);for(;-1!==n;)r.push(n),n=e.indexOf(t,n+t.length);return r},v=/^([a-z0-9]+(?:-[a-z0-9]+)*\.)*[a-z0-9]+(?:-[a-z0-9]+)*$/,S="^[]{}()\\.^$*+?|-,",C=function(){return S},T=function(e,t){let r="";for(let t=0;t<e.length;++t){const n=e.charAt(t);-1!==C().indexOf(n)&&(r+="\\"),r+=n}return new RegExp(r,t||"")};const U=/[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\b|_)|[A-Za-z][0-9]+[a-z]?|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g,M=function(e){return e.match?.(U)?.map((e=>e.toLowerCase())).join("-").replaceAll("-.-",".")||e};var R=Object.freeze({__proto__:null,escapeCharacters:O,formatAsJSLiteral:e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=(e,t,r,n)=>{if(r){if(y.has(r))return y.get(r);return"\\x"+N(r.charCodeAt(0),2)}if(n){return"\\u"+N(n.charCodeAt(0),4)}return t?y.get(t)||"":e};let o="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",o=e.replaceAll(r,n)):(i="`",o=e.replaceAll(t,n)):(i='"',o=e.replaceAll(t,n)):(i="'",o=e.replaceAll(t,n)),`${i}${o}${i}`},sprintf:(e,...t)=>{let r=0;return e.replaceAll(/%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g,((e,n,o,i)=>{if("%"===i)return"%";if(void 0!==n&&(r=parseInt(n,10)-1,r<0))throw new RangeError(`Invalid parameter index ${r+1}`);if(r>=t.length)throw new RangeError(`Expected at least ${r+1} format parameters, but only ${t.length} where given.`);if("s"===i){const e=String(t[r++]);return void 0!==o?e.substring(0,Number(o)):e}let a=Number(t[r++]);return isNaN(a)&&(a=0),"d"===i?String(Math.floor(a)).padStart(Number(o),"0"):void 0!==o?a.toFixed(Number(o)):String(a)}))},toBase64:e=>{function t(e){return e<26?e+65:e<52?e+71:e<62?e-4:62===e?43:63===e?47:65}const r=(new TextEncoder).encode(e.toString()),n=r.length;let o,i="";if(0===n)return i;let a=0;for(let e=0;e<n;e++)o=e%3,a|=r[e]<<(16>>>o&24),2===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),t(63&a)),a=0);return 0===o?i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),61,61):1===o&&(i+=String.fromCharCode(t(a>>>18&63),t(a>>>12&63),t(a>>>6&63),61)),i},findIndexesOfSubString:A,findLineEndingIndexes:e=>{const t=A(e,"\n");return t.push(e.length),t},isWhitespace:e=>/^\s*$/.test(e),trimURL:(e,t)=>{let r=e.replace(/^(https|http|file):\/\//i,"");return t&&r.toLowerCase().startsWith(t.toLowerCase())&&(r=r.substr(t.length)),r},collapseWhitespace:e=>e.replace(/[\s\xA0]+/g," "),reverse:e=>e.split("").reverse().join(""),replaceControlCharacters:e=>e.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g,"�"),countWtf8Bytes:e=>{let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n<=127)t++;else if(n<=2047)t+=2;else if(n<55296||57343<n)t+=3;else{if(n<=56319&&r+1<e.length){const n=e.charCodeAt(r+1);if(56320<=n&&n<=57343){t+=4,r++;continue}}t+=3}}return t},stripLineBreaks:e=>e.replace(/(\r)?\n/g,""),isExtendedKebabCase:e=>v.test(e),toTitleCase:e=>e.substring(0,1).toUpperCase()+e.substring(1),removeURLFragment:e=>{const t=new URL(e);return t.hash="",t.toString()},regexSpecialCharacters:C,filterRegex:function(e){let t="^(?:.*\\0)?";for(let r=0;r<e.length;++r){let n=e.charAt(r);-1!==S.indexOf(n)&&(n="\\"+n),t+="[^\\0"+n+"]*"+n}return new RegExp(t,"i")},createSearchRegex:function(e,t,r,n=!1){const o=t?"g":"gi";let i;if(r)try{i=new RegExp(e,o)}catch(e){}return i||(i=T(e,o)),n&&i&&(i=new RegExp(`\\b${i.source}\\b`,o)),i},caseInsensetiveComparator:function(e,t){return(e=e.toUpperCase())===(t=t.toUpperCase())?0:e>t?1:-1},hashCode:function(e){if(!e)return 0;const t=4294967291;let r=0,n=1;for(let o=0;o<e.length;o++){r=(r+n*(1506996573*e.charCodeAt(o)))%t,n=1345575271*n%t}return r=(r+n*(t-1))%t,Math.abs(0|r)},compare:(e,t)=>e>t?1:e<t?-1:0,trimMiddle:(e,t)=>{if(e.length<=t)return String(e);let r=t>>1,n=t-r-1;return e.codePointAt(e.length-n-1)>=65536&&(--n,++r),r>0&&e.codePointAt(r-1)>=65536&&--r,e.substr(0,r)+"…"+e.substr(e.length-n,n)},trimEndWithMaxLength:(e,t)=>e.length<=t?String(e):e.substr(0,t-1)+"…",escapeForRegExp:e=>O(e,S),naturalOrderComparator:(e,t)=>{const r=/^\d+|^\D+/;let n,o,i,a;for(;;){if(!e)return t?-1:0;if(!t)return 1;if(n=e.match(r)[0],o=t.match(r)[0],i=!Number.isNaN(Number(n)),a=!Number.isNaN(Number(o)),i&&!a)return-1;if(a&&!i)return 1;if(i&&a){const e=Number(n)-Number(o);if(e)return e;if(n.length!==o.length)return Number(n)||Number(o)?o.length-n.length:n.length-o.length}else if(n!==o)return n<o?-1:1;e=e.substring(n.length),t=t.substring(o.length)}},base64ToSize:function(e){if(!e)return 0;let t=3*e.length/4;return"="===e[e.length-1]&&t--,e.length>1&&"="===e[e.length-2]&&t--,t},SINGLE_QUOTE:"'",DOUBLE_QUOTE:'"',findUnclosedCssQuote:function(e){let t="";for(let r=0;r<e.length;++r){const n=e[r];"\\"!==n?"'"!==n&&'"'!==n||(t===n?t="":""===t&&(t=n)):r++}return t},countUnmatchedLeftParentheses:e=>{let t=0;for(const r of e)"("===r?t++:")"===r&&t>0&&t--;return t},createPlainTextSearchRegex:T,toLowerCaseString:function(e){return e.toLowerCase()},toKebabCase:M,toKebabCaseKeys:function(e){const t={};for(const[r,n]of Object.entries(e))t[M(r)]=n;return t},replaceLast:function(e,t,r){const n=e.lastIndexOf(t);return-1===n?e:e.slice(0,n)+e.slice(n).replace(t,r)},stringifyWithPrecision:function(e,t=2){if(0===t)return e.toFixed(0);const r=e.toFixed(t).replace(/\.?0*$/,"");return"-0"===r?"0":r},concatBase64:function(e,t){if(0===e.length||!e.endsWith("="))return e+t;const r=e.substring(0,e.length-4),n=e.substring(e.length-4);return r+window.btoa(window.atob(n)+window.atob(t))}});var z=Object.freeze({__proto__:null,secondsToMilliSeconds:function(e){return 1e3*e},milliSecondsToSeconds:function(e){return e/1e3},microSecondsToMilliSeconds:function(e){return e/1e3}});class L extends Uint32Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){return this}asArrayOrFail(){throw new Error("Not an array")}}class j{#e;#t;length;constructor(e,t){this.#e=[],this.length=e;let r=1;for(;;){r*=2,this.#t=Math.ceil(e/r);try{if(void 0!==t&&this.#t>t)throw new RangeError;for(let e=0;e<r;++e)this.#e[e]=new Uint32Array(this.#t);return}catch(e){if(this.#t<1e6)throw e}}}getValue(e){if(e>=0&&e<this.length){const t=this.#t;return this.#e[Math.floor(e/t)][e%t]}return this.#e[0][-1]}setValue(e,t){if(e>=0&&e<this.length){const r=this.#t;this.#e[Math.floor(e/r)][e%r]=t}}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){throw new Error("Not an array")}}class F extends Array{getValue(e){return this[e]}setValue(e,t){this[e]=t}asUint32ArrayOrFail(){throw new Error("Not a Uint32Array")}asArrayOrFail(){return this}}class $ extends Uint8Array{constructor(e){super(Math.ceil(e/8))}getBit(e){return 0!==(this[e>>3]&1<<(7&e))}setBit(e){this[e>>3]|=1<<(7&e)}clearBit(e){this[e>>3]&=~(1<<(7&e))}previous(e){for(;e!==e>>3<<3;)if(--e,this.getBit(e))return e;let t;for(t=(e>>3)-1;t>=0&&0===this[t];--t);if(t<0)return-1;for(e=7+(t<<3);e>=t<<3;--e)if(this.getBit(e))return e;throw new Error("Unreachable")}}var B=Object.freeze({__proto__:null,createExpandableBigUint32Array:function(){return new F},createFixedBigUint32Array:function(e,t){try{if(void 0!==t&&e>t)throw new RangeError;return new L(e)}catch{return new j(e,t)}},createBitVector:function(e){return new $(e)}});function k(e,t){if(null==e)throw new Error(`Expected given value to not be null/undefined but it was: ${e}${t?`\n${t}`:""}`)}function V(e,t){throw new Error(t)}function D(e){return e}var I=Object.freeze({__proto__:null,assertNotNullOrUndefined:k,assertNever:V,assertUnhandled:D});var W=Object.freeze({__proto__:null,LocalizedEmptyString:""});class K extends Error{message;constructor(e){super(e),this.message=e}}var P=Object.freeze({__proto__:null,UserVisibleError:K,isUserVisibleError:function(e){return"object"==typeof e&&null!==e&&e instanceof K}});export{i as ArrayUtilities,a as Brand,u as DOMUtilities,s as DateUtilities,l as DevToolsPath,f as KeyboardUtilities,p as MapUtilities,b as MimeType,_ as NumberUtilities,E as PromiseUtilities,R as StringUtilities,z as Timing,I as TypeScriptUtilities,B as TypedArrayUtilities,W as UIString,P as UserVisibleError,V as assertNever,k as assertNotNullOrUndefined,D as assertUnhandled};

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization High library

This string may still contain
<!--
, which may cause an HTML element injection vulnerability.
@@ -1 +1 @@
var e,t,n;!function(e){e.CSS="css",e.ARIA="aria",e.Text="text",e.XPath="xpath",e.Pierce="pierce"}(e=e||(e={})),function(e){e.Change="change",e.Click="click",e.Close="close",e.CustomStep="customStep",e.DoubleClick="doubleClick",e.EmulateNetworkConditions="emulateNetworkConditions",e.Hover="hover",e.KeyDown="keyDown",e.KeyUp="keyUp",e.Navigate="navigate",e.Scroll="scroll",e.SetViewport="setViewport",e.WaitForElement="waitForElement",e.WaitForExpression="waitForExpression"}(t=t||(t={})),function(e){e.Navigation="navigation"}(n=n||(n={}));var r=Object.freeze({__proto__:null,get SelectorType(){return e},get StepType(){return t},get AssertedEventType(){return n}});function a(e){throw new Error(`Unknown step type: ${e.type}`)}const i=new Set(["textarea","text","url","tel","search","password","number","email"]),o=new Set(["mouse","pen","touch"]),s=new Map([["primary","left"],["auxiliary","middle"],["secondary","right"],["back","back"],["forward","forward"]]);function l(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))return!1;return void 0!==e[t]}function c(e){return"object"==typeof e&&null!==e}function u(e){return"string"==typeof e}function p(e){return"number"==typeof e}function f(e){return Array.isArray(e)}function w(e){if(l(e,"target")&&u(e.target))return e.target}function d(e){if(l(e,"frame")){if(f(t=e.frame)&&t.every((e=>Number.isInteger(e))))return e.frame;throw new Error("Step `frame` is not an integer array")}var t}function h(e,t){if(l(e,t)){const n=e[t];if(p(n))return n}throw new Error(`Step.${t} is not a number`)}function m(e,t){if(l(e,t)){const n=e[t];if("boolean"==typeof n)return n}throw new Error(`Step.${t} is not a boolean`)}function y(e,t){if(l(e,t))return h(e,t)}function g(e,t){if(l(e,t))return b(e,t)}function v(e,t){if(l(e,t))return m(e,t)}function b(e,t){if(l(e,t)){const n=e[t];if(u(n))return n}throw new Error(`Step.${t} is not a string`)}function E(e){if(!l(e,"selectors"))throw new Error("Step does not have required selectors");if(!f(e.selectors))throw new Error("Step selectors are not an array");if(0===e.selectors.length)throw new Error("Step does not have required selectors");return e.selectors.map((e=>{if(!u(e)&&!f(e))throw new Error("Selector is not an array or string");return f(e)?e.map((e=>{if(!u(e))throw new Error("Selector element is not a string");return e})):e}))}function S(e){if(l(e,"selectors"))return E(e)}function L(e){if(!c(e))throw new Error("Asserted event is not an object");if(!l(e,"type"))throw new Error("Asserted event is missing type");if(e.type===n.Navigation)return{type:n.Navigation,url:g(e,"url"),title:g(e,"title")};throw new Error("Unknown assertedEvent type")}function k(e){if(f(e))return e.map(L)}function F(e,t){if(l(t,"timeout")&&p(t.timeout)&&!P(t.timeout))throw new Error(j);return{type:e,assertedEvents:l(t,"assertedEvents")?k(t.assertedEvents):void 0,timeout:l(t,"timeout")&&p(t.timeout)?t.timeout:void 0}}function A(e,t){return{...F(e,t),target:w(t)}}function C(e,t){return{...A(e,t),frame:d(t)}}function $(e,t){return{...C(e,t),selectors:E(t)}}function x(e){const t={offsetX:h(e,"offsetX"),offsetY:h(e,"offsetY"),duration:y(e,"duration")},n=g(e,"deviceType");if(n){if("string"!=typeof(r=n)||!o.has(r))throw new Error(`'deviceType' for click steps must be one of the following: ${[...o].join(", ")}`);t.deviceType=n}var r;const a=g(e,"button");if(a){if(!function(e){return"string"==typeof e&&s.has(e)}(a))throw new Error(`'button' for click steps must be one of the following: ${[...s.keys()].join(", ")}`);t.button=a}return t}function T(e,n){if(!c(e))throw new Error(n?`Step ${n} is not an object`:"Step is not an object");if(!l(e,"type"))throw new Error(n?`Step ${n} does not have a type`:"Step does not have a type");if(!u(e.type))throw new Error(n?`Type of the step ${n} is not a string`:"Type of the step is not a string");switch(e.type){case t.Click:return function(e){return{...$(t.Click,e),...x(e),type:t.Click}}(e);case t.DoubleClick:return function(e){return{...$(t.DoubleClick,e),...x(e),type:t.DoubleClick}}(e);case t.Hover:return function(e){return{...$(t.Hover,e),type:t.Hover}}(e);case t.Change:return function(e){return{...$(t.Change,e),type:t.Change,value:b(e,"value")}}(e);case t.KeyDown:return function(e){return{...A(t.KeyDown,e),type:t.KeyDown,key:b(e,"key")}}(e);case t.KeyUp:return function(e){return{...A(t.KeyUp,e),type:t.KeyUp,key:b(e,"key")}}(e);case t.EmulateNetworkConditions:return function(e){return{...A(t.EmulateNetworkConditions,e),type:t.EmulateNetworkConditions,download:h(e,"download"),upload:h(e,"upload"),latency:h(e,"latency")}}(e);case t.Close:return function(e){return{...A(t.Close,e),type:t.Close}}(e);case t.SetViewport:return function(e){return{...A(t.SetViewport,e),type:t.SetViewport,width:h(e,"width"),height:h(e,"height"),deviceScaleFactor:h(e,"deviceScaleFactor"),isMobile:m(e,"isMobile"),hasTouch:m(e,"hasTouch"),isLandscape:m(e,"isLandscape")}}(e);case t.Scroll:return function(e){return{...C(t.Scroll,e),type:t.Scroll,x:y(e,"x"),y:y(e,"y"),selectors:S(e)}}(e);case t.Navigate:return function(e){return{...A(t.Navigate,e),type:t.Navigate,target:w(e),url:b(e,"url")}}(e);case t.CustomStep:return function(e){if(!l(e,"name"))throw new Error("customStep is missing name");if(!u(e.name))throw new Error("customStep's name is not a string");return{...C(t.CustomStep,e),type:t.CustomStep,name:e.name,parameters:l(e,"parameters")?e.parameters:void 0}}(e);case t.WaitForElement:return function(e){const n=g(e,"operator");if(n&&">="!==n&&"=="!==n&&"<="!==n)throw new Error("WaitForElement step's operator is not one of '>=','==','<='");if(l(e,"attributes")&&(!c(e.attributes)||Object.values(e.attributes).some((e=>"string"!=typeof e))))throw new Error("WaitForElement step's attribute is not a dictionary of strings");if(l(e,"properties")&&!c(e.properties))throw new Error("WaitForElement step's attribute is not an object");return{...$(t.WaitForElement,e),type:t.WaitForElement,operator:n,count:y(e,"count"),visible:v(e,"visible"),attributes:l(e,"attributes")?e.attributes:void 0,properties:l(e,"properties")?e.properties:void 0}}(e);case t.WaitForExpression:return function(e){if(!l(e,"expression"))throw new Error("waitForExpression step is missing `expression`");return{...C(t.WaitForExpression,e),type:t.WaitForExpression,expression:b(e,"expression")}}(e);default:throw new Error(`Step type ${e.type} is not supported`)}}function I(e){const t=[];if(!f(e))throw new Error("Recording `steps` is not an array");for(const[n,r]of e.entries())t.push(T(r,n));return t}const N=1,V=3e4,j="Timeout is not between 1 and 30000 milliseconds";function P(e){return e>=1&&e<=3e4}function W(e){if(!c(e))throw new Error("Recording is not an object");if(!l(e,"title"))throw new Error("Recording is missing `title`");if(!u(e.title))throw new Error("Recording `title` is not a string");if(l(e,"timeout")&&!p(e.timeout))throw new Error("Recording `timeout` is not a number");if(!l(e,"steps"))throw new Error("Recording is missing `steps`");if(l(e,"timeout")&&p(e.timeout)&&!P(e.timeout))throw new Error(j);return t={title:e.title,timeout:l(e,"timeout")&&p(e.timeout)?e.timeout:void 0,selectorAttribute:l(e,"selectorAttribute")&&u(e.selectorAttribute)?e.selectorAttribute:void 0,steps:I(e.steps)},JSON.parse(JSON.stringify(t));var t}function O(t){for(const n of Object.values(e))if(t.startsWith(`${n}/`))return n;return e.CSS}class R{async beforeAllSteps(e,t){}async afterAllSteps(e,t){}async beforeEachStep(e,t,n){}async stringifyStep(e,t,n){}async afterEachStep(e,t,n){}}class M extends R{async beforeAllSteps(e,t){const n={...t,steps:void 0},r=JSON.stringify(n,null,e.getIndent()).split("\n");r.pop(),r[r.length-1]+=",",r.push(e.getIndent()+'"steps": ['),e.appendLine(r.join("\n")).startBlock().startBlock()}async afterAllSteps(e){e.endBlock().endBlock().appendLine(e.getIndent()+"]").appendLine("}")}async stringifyStep(e,t,n){const r=JSON.stringify(t,null,e.getIndent());if(!n)return void e.appendLine(r);const a=n.steps.lastIndexOf(t)===n.steps.length-1?"":",";e.appendLine(r+a)}}function B(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function D(e,t,n,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n}var H,K,U;class q{constructor(e){H.set(this,void 0),K.set(this,0),U.set(this,[]),D(this,H,e,"f")}appendLine(e){const t=e.split("\n").map((e=>e?B(this,H,"f").repeat(B(this,K,"f"))+e.trimEnd():""));return B(this,U,"f").push(...t),this}startBlock(){var e;return D(this,K,(e=B(this,K,"f"),++e),"f"),this}endBlock(){var e;return D(this,K,(e=B(this,K,"f"),--e),"f"),this}toString(){return B(this,U,"f").join("\n")+"\n"}getIndent(){return B(this,H,"f")}getSize(){return B(this,U,"f").length}}function X(e,t){const n=[];return J(e,n,1,t),n.join("")}function J(e,t=[],n=1,r=" "){switch(typeof e){case"bigint":case"symbol":case"function":case"undefined":throw new Error("Invalid JSON");case"number":case"boolean":t.push(String(e));break;case"string":t.push(z(e));break;case"object":if(null===e)t.push("null");else if(Array.isArray(e)){t.push("[\n");for(let a=0;a<e.length;a++)t.push(r.repeat(n)),J(e[a],t,n+1,r),a!==e.length-1&&t.push(","),t.push("\n");t.push(r.repeat(n-1)+"]")}else{t.push("{\n");const a=Object.keys(e);for(let i=0;i<a.length;i++){const o=a[i],s=e[o];void 0!==s&&(t.push(r.repeat(n)),t.push(o),t.push(": "),J(s,t,n+1,r),i!==a.length-1&&t.push(","),t.push("\n"))}t.push(r.repeat(n-1)+"}")}break;default:throw new Error("Unknown object type")}return t}H=new WeakMap,K=new WeakMap,U=new WeakMap;const Y=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),_=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),z=e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=(e,t,n,r)=>{if(n){if(_.has(n))return _.get(n);return"\\x"+Y(n.charCodeAt(0),2)}if(r){return"\\u"+Y(r.charCodeAt(0),4)}return t?_.get(t)||"":e};let a="",i="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(i="'",a=e.replace(n,r)):(i="`",a=e.replace(t,r)):(i='"',a=e.replace(t,r)):(i="'",a=e.replace(t,r)),`${i}${a}${i}`};var G,Q,Z,ee,te,ne,re,ae,ie,oe,se,le,ce,ue,pe,fe,we,de,he;class me extends R{constructor(){super(...arguments),G.add(this)}async beforeAllSteps(e,t){e.appendLine("const puppeteer = require('puppeteer'); // v13.0.0 or later"),e.appendLine(""),e.appendLine("(async () => {").startBlock(),e.appendLine("const browser = await puppeteer.launch();"),e.appendLine("const page = await browser.newPage();"),e.appendLine(`const timeout = ${t.timeout||ye};`),e.appendLine("page.setDefaultTimeout(timeout);"),e.appendLine("")}async afterAllSteps(e,t){e.appendLine(""),e.appendLine("await browser.close();"),e.appendLine("");for(const t of ge.split("\n"))e.appendLine(t);e.endBlock().appendLine("})().catch(err => {").startBlock(),e.appendLine("console.error(err);"),e.appendLine("process.exit(1);"),e.endBlock().appendLine("});")}async stringifyStep(e,t,r){if(e.appendLine("{").startBlock(),void 0!==t.timeout&&e.appendLine(`const timeout = ${t.timeout};`),B(this,G,"m",ee).call(this,e,t),t.assertedEvents){e.appendLine("const promises = [];");for(const r of t.assertedEvents){if(r.type!==n.Navigation)throw new Error(`Event type ${r.type} is not supported`);e.appendLine(`promises.push(${"frame"in t&&t.frame?"frame":"targetPage"}.waitForNavigation());`)}}B(this,G,"m",fe).call(this,e,t),t.assertedEvents&&e.appendLine("await Promise.all(promises);"),e.endBlock().appendLine("}")}}G=new WeakSet,Q=function(e,t){"main"===t?e.appendLine("const targetPage = page;"):(e.appendLine(`const target = await browser.waitForTarget(t => t.url() === ${X(t,e.getIndent())}, { timeout });`),e.appendLine("const targetPage = await target.page();"),e.appendLine("targetPage.setDefaultTimeout(timeout);"))},Z=function(e,t){e.appendLine("let frame = targetPage.mainFrame();");for(const n of t)e.appendLine(`frame = frame.childFrames()[${n}];`)},ee=function(e,t){B(this,G,"m",Q).call(this,e,t.target||"main"),t.frame&&B(this,G,"m",Z).call(this,e,t.frame)},te=function(e,t){e.appendLine(`await scrollIntoViewIfNeeded(${X(t.selectors,e.getIndent())}, ${t.frame?"frame":"targetPage"}, timeout);`),e.appendLine(`const element = await waitForSelectors(${X(t.selectors,e.getIndent())}, ${t.frame?"frame":"targetPage"}, { timeout, visible: true });`)},ne=function(e,t){B(this,G,"m",te).call(this,e,t),e.appendLine("await element.click({"),t.duration&&e.appendLine(` delay: ${t.duration},`),t.button&&e.appendLine(` button: '${s.get(t.button)}',`),e.appendLine(" offset: {"),e.appendLine(` x: ${t.offsetX},`),e.appendLine(` y: ${t.offsetY},`),e.appendLine(" },"),e.appendLine("});")},re=function(e,t){B(this,G,"m",te).call(this,e,t),e.appendLine("await element.click({"),t.button&&e.appendLine(` button: '${s.get(t.button)}',`),e.appendLine(" offset: {"),e.appendLine(` x: ${t.offsetX},`),e.appendLine(` y: ${t.offsetY},`),e.appendLine(" },"),e.appendLine("});"),e.appendLine("await element.click({"),e.appendLine(" clickCount: 2,"),t.duration&&e.appendLine(` delay: ${t.duration},`),t.button&&e.appendLine(` button: '${s.get(t.button)}',`),e.appendLine(" offset: {"),e.appendLine(` x: ${t.offsetX},`),e.appendLine(` y: ${t.offsetY},`),e.appendLine(" },"),e.appendLine("});")},ae=function(e,t){B(this,G,"m",te).call(this,e,t),e.appendLine("await element.hover();")},ie=function(e,t){B(this,G,"m",te).call(this,e,t),e.appendLine("const inputType = await element.evaluate(el => el.type);"),e.appendLine("if (inputType === 'select-one') {"),e.appendLine(` await changeSelectElement(element, ${X(t.value,e.getIndent())})`),e.appendLine(`} else if (${X(Array.from(i),e.getIndent())}.includes(inputType)) {`),e.appendLine(` await typeIntoElement(element, ${X(t.value,e.getIndent())});`),e.appendLine("} else {"),e.appendLine(` await changeElementValue(element, ${X(t.value,e.getIndent())});`),e.appendLine("}")},oe=function(e,t){e.appendLine("await targetPage.emulateNetworkConditions({"),e.appendLine(` offline: ${!t.download&&!t.upload},`),e.appendLine(` downloadThroughput: ${t.download},`),e.appendLine(` uploadThroughput: ${t.upload},`),e.appendLine(` latency: ${t.latency},`),e.appendLine("});")},se=function(e,t){e.appendLine(`await targetPage.keyboard.down(${X(t.key,e.getIndent())});`)},le=function(e,t){e.appendLine(`await targetPage.keyboard.up(${X(t.key,e.getIndent())});`)},ce=function(e,t){e.appendLine("await targetPage.close()")},ue=function(e,t){e.appendLine(`await targetPage.setViewport(${X({width:t.width,height:t.height},e.getIndent())})`)},pe=function(e,t){"selectors"in t?(B(this,G,"m",te).call(this,e,t),e.appendLine(`await element.evaluate((el, x, y) => { el.scrollTop = y; el.scrollLeft = x; }, ${t.x}, ${t.y});`)):e.appendLine(`await targetPage.evaluate((x, y) => { window.scroll(x, y); }, ${t.x}, ${t.y})`)},fe=function(e,n){switch(n.type){case t.Click:return B(this,G,"m",ne).call(this,e,n);case t.DoubleClick:return B(this,G,"m",re).call(this,e,n);case t.Hover:return B(this,G,"m",ae).call(this,e,n);case t.Change:return B(this,G,"m",ie).call(this,e,n);case t.EmulateNetworkConditions:return B(this,G,"m",oe).call(this,e,n);case t.KeyDown:return B(this,G,"m",se).call(this,e,n);case t.KeyUp:return B(this,G,"m",le).call(this,e,n);case t.Close:return B(this,G,"m",ce).call(this,e,n);case t.SetViewport:return B(this,G,"m",ue).call(this,e,n);case t.Scroll:return B(this,G,"m",pe).call(this,e,n);case t.Navigate:return B(this,G,"m",we).call(this,e,n);case t.WaitForElement:return B(this,G,"m",he).call(this,e,n);case t.WaitForExpression:return B(this,G,"m",de).call(this,e,n);case t.CustomStep:return;default:return a(n)}},we=function(e,t){e.appendLine(`await targetPage.goto(${X(t.url,e.getIndent())});`)},de=function(e,t){e.appendLine(`await ${t.frame?"frame":"targetPage"}.waitForFunction(${X(t.expression,e.getIndent())}, { timeout });`)},he=function(e,t){e.appendLine(`await waitForElement(${X(t,e.getIndent())}, ${t.frame?"frame":"targetPage"}, timeout);`)};const ye=5e3,ge="async function waitForSelectors(selectors, frame, options) {\n for (const selector of selectors) {\n try {\n return await waitForSelector(selector, frame, options);\n } catch (err) {\n console.error(err);\n }\n }\n throw new Error('Could not find element for selectors: ' + JSON.stringify(selectors));\n}\n\nasync function scrollIntoViewIfNeeded(selectors, frame, timeout) {\n const element = await waitForSelectors(selectors, frame, { visible: false, timeout });\n if (!element) {\n throw new Error(\n 'The element could not be found.'\n );\n }\n await waitForConnected(element, timeout);\n const isInViewport = await element.isIntersectingViewport({threshold: 0});\n if (isInViewport) {\n return;\n }\n await element.evaluate(element => {\n element.scrollIntoView({\n block: 'center',\n inline: 'center',\n behavior: 'auto',\n });\n });\n await waitForInViewport(element, timeout);\n}\n\nasync function waitForConnected(element, timeout) {\n await waitForFunction(async () => {\n return await element.getProperty('isConnected');\n }, timeout);\n}\n\nasync function waitForInViewport(element, timeout) {\n await waitForFunction(async () => {\n return await element.isIntersectingViewport({threshold: 0});\n }, timeout);\n}\n\nasync function waitForSelector(selector, frame, options) {\n if (!Array.isArray(selector)) {\n selector = [selector];\n }\n if (!selector.length) {\n throw new Error('Empty selector provided to waitForSelector');\n }\n let element = null;\n for (let i = 0; i < selector.length; i++) {\n const part = selector[i];\n if (element) {\n element = await element.waitForSelector(part, options);\n } else {\n element = await frame.waitForSelector(part, options);\n }\n if (!element) {\n throw new Error('Could not find element: ' + selector.join('>>'));\n }\n if (i < selector.length - 1) {\n element = (await element.evaluateHandle(el => el.shadowRoot ? el.shadowRoot : el)).asElement();\n }\n }\n if (!element) {\n throw new Error('Could not find element: ' + selector.join('|'));\n }\n return element;\n}\n\nasync function waitForElement(step, frame, timeout) {\n const {\n count = 1,\n operator = '>=',\n visible = true,\n properties,\n attributes,\n } = step;\n const compFn = {\n '==': (a, b) => a === b,\n '>=': (a, b) => a >= b,\n '<=': (a, b) => a <= b,\n }[operator];\n await waitForFunction(async () => {\n const elements = await querySelectorsAll(step.selectors, frame);\n let result = compFn(elements.length, count);\n const elementsHandle = await frame.evaluateHandle((...elements) => {\n return elements;\n }, ...elements);\n await Promise.all(elements.map((element) => element.dispose()));\n if (result && (properties || attributes)) {\n result = await elementsHandle.evaluate(\n (elements, properties, attributes) => {\n for (const element of elements) {\n if (attributes) {\n for (const [name, value] of Object.entries(attributes)) {\n if (element.getAttribute(name) !== value) {\n return false;\n }\n }\n }\n if (properties) {\n if (!isDeepMatch(properties, element)) {\n return false;\n }\n }\n }\n return true;\n\n function isDeepMatch(a, b) {\n if (a === b) {\n return true;\n }\n if ((a && !b) || (!a && b)) {\n return false;\n }\n if (!(a instanceof Object) || !(b instanceof Object)) {\n return false;\n }\n for (const [key, value] of Object.entries(a)) {\n if (!isDeepMatch(value, b[key])) {\n return false;\n }\n }\n return true;\n }\n },\n properties,\n attributes\n );\n }\n await elementsHandle.dispose();\n return result === visible;\n }, timeout);\n}\n\nasync function querySelectorsAll(selectors, frame) {\n for (const selector of selectors) {\n const result = await querySelectorAll(selector, frame);\n if (result.length) {\n return result;\n }\n }\n return [];\n}\n\nasync function querySelectorAll(selector, frame) {\n if (!Array.isArray(selector)) {\n selector = [selector];\n }\n if (!selector.length) {\n throw new Error('Empty selector provided to querySelectorAll');\n }\n let elements = [];\n for (let i = 0; i < selector.length; i++) {\n const part = selector[i];\n if (i === 0) {\n elements = await frame.$$(part);\n } else {\n const tmpElements = elements;\n elements = [];\n for (const el of tmpElements) {\n elements.push(...(await el.$$(part)));\n }\n }\n if (elements.length === 0) {\n return [];\n }\n if (i < selector.length - 1) {\n const tmpElements = [];\n for (const el of elements) {\n const newEl = (await el.evaluateHandle(el => el.shadowRoot ? el.shadowRoot : el)).asElement();\n if (newEl) {\n tmpElements.push(newEl);\n }\n }\n elements = tmpElements;\n }\n }\n return elements;\n}\n\nasync function waitForFunction(fn, timeout) {\n let isActive = true;\n const timeoutId = setTimeout(() => {\n isActive = false;\n }, timeout);\n while (isActive) {\n const result = await fn();\n if (result) {\n clearTimeout(timeoutId);\n return;\n }\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n throw new Error('Timed out');\n}\n\nasync function changeSelectElement(element, value) {\n await element.select(value);\n await element.evaluateHandle((e) => {\n e.blur();\n e.focus();\n });\n}\n\nasync function changeElementValue(element, value) {\n await element.focus();\n await element.evaluate((input, value) => {\n input.value = value;\n input.dispatchEvent(new Event('input', { bubbles: true }));\n input.dispatchEvent(new Event('change', { bubbles: true }));\n }, value);\n}\n\nasync function typeIntoElement(element, value) {\n const textToType = await element.evaluate((input, newValue) => {\n if (\n newValue.length <= input.value.length ||\n !newValue.startsWith(input.value)\n ) {\n input.value = '';\n return newValue;\n }\n const originalValue = input.value;\n input.value = '';\n input.value = originalValue;\n return newValue.substring(originalValue.length);\n }, value);\n await element.type(textToType);\n}",ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",be=ve.split("").reduce(((e,t,n)=>(e.set(t,n),e)),new Map);function Ee(e){if(e<0)throw new Error("Only postive integers and zero are supported");if(e>2147483647)throw new Error("Only integers between 0 and 2147483647 are supported");const t=[];do{let n=31&e;(e>>>=5)>0&&(n|=32),t.push(ve[n])}while(0!==e);return t.join("")}function Se(e){const t=[],n=e.split("");let r=0,a=0;for(const e of n){const n=be.get(e);r|=(31&n)<<a,a+=5;32&n||(t.push(r),r=0,a=0)}return t}async function Le(e,t){var n,r,a,i,o,s,l;t||(t={});const c=null!==(n=t.extension)&&void 0!==n?n:new me,u=null!==(r=t.writer)&&void 0!==r?r:new q(null!==(a=t.indentation)&&void 0!==a?a:" ");await(null===(i=c.beforeAllSteps)||void 0===i?void 0:i.call(c,u,e));const p=[1];for(const t of e.steps){const n=u.getSize();await(null===(o=c.beforeEachStep)||void 0===o?void 0:o.call(c,u,t,e)),await c.stringifyStep(u,t,e),await(null===(s=c.afterEachStep)||void 0===s?void 0:s.call(c,u,t,e));const r=u.getSize();p.push(n,r-n)}return await(null===(l=c.afterAllSteps)||void 0===l?void 0:l.call(c,u,e)),u.appendLine("//# recorderSourceMap="+function(e){const t=[];for(const n of e)t.push(Ee(n));return t.join("")}(p)),u.toString()}async function ke(e,t){var n,r,a,i;t||(t={});let o=t.extension;o||(o=new me),t.indentation||(t.indentation=" ");const s=null!==(n=t.writer)&&void 0!==n?n:new q(null!==(r=t.indentation)&&void 0!==r?r:" ");return await(null===(a=o.beforeEachStep)||void 0===a?void 0:a.call(o,s,e)),await o.stringifyStep(s,e),await(null===(i=o.afterEachStep)||void 0===i?void 0:i.call(o,s,e)),s.toString()}function Fe(e){return e.trim().startsWith("//# recorderSourceMap=")}function Ae(e){const t=e.split("\n");for(let e=t.length-1;e>=0;e--){const n=t[e];if(Fe(n))return Se(n.trim().substring("//# recorderSourceMap=".length))}}function Ce(e){return e.split("\n").filter((e=>!Fe(e))).join("\n")}class $e{async beforeAllSteps(e){}async afterAllSteps(e){}async beforeEachStep(e,t){}async runStep(e,t){}async afterEachStep(e,t){}}var xe,Te,Ie;const Ne={"==":(e,t)=>e===t,">=":(e,t)=>e>=t,"<=":(e,t)=>e<=t};class Ve extends $e{constructor(e,t,n){super(),xe.add(this),this.browser=e,this.page=t,this.timeout=(null==n?void 0:n.timeout)||5e3}async runStep(e,t){const n=B(this,xe,"m",Ie).call(this,e,t),r=this.page,a=this.browser,i=await async function(e,t,n,r){if(!n.target||"main"===n.target)return t;const a=await e.waitForTarget((e=>e.url()===n.target),{timeout:r}),i=await a.page();if(!i)return null;return i.setDefaultTimeout(r),i}(a,r,e,n);let o=null;if(!i&&e.target){const t=r.frames();for(const n of t)if(n.isOOPFrame()&&n.url()===e.target){o=n;break}o||(o=await r.waitForFrame(e.target,{timeout:n}))}const s=o||i;if(!s)throw new Error("Target is not found for step: "+JSON.stringify(e));await B(this,xe,"m",Te).call(this,s);const l=await async function(e,t){let n="mainFrame"in e?e.mainFrame():e;if("frame"in t&&t.frame)for(const e of t.frame)n=n.childFrames()[e];return n}(s,e);await this.runStepInFrame(e,r,s,l,n)}async runStepInFrame(e,r,o,l,c){const u=!0;let p=null;const f=()=>{p=async function(e,t,r){const a=[];if(t.assertedEvents)for(const i of t.assertedEvents){if(i.type!==n.Navigation)throw new Error(`Event type ${i.type} is not supported`);a.push(e.waitForNavigation({timeout:r}))}await Promise.all(a)}(l,e,c)};switch(e.type){case t.DoubleClick:{await Pe(e.selectors,l,c);const t=await We(e.selectors,l,{timeout:c,visible:u});if(!t)throw new Error("Could not find element: "+e.selectors[0]);f(),await t.click({button:e.button&&s.get(e.button),offset:{x:e.offsetX,y:e.offsetY}}),await t.click({clickCount:2,button:e.button&&s.get(e.button),delay:e.duration,offset:{x:e.offsetX,y:e.offsetY}}),await t.dispose()}break;case t.Click:{await Pe(e.selectors,l,c);const t=await We(e.selectors,l,{timeout:c,visible:u});if(!t)throw new Error("Could not find element: "+e.selectors[0]);f(),await t.click({delay:e.duration,button:e.button&&s.get(e.button),offset:{x:e.offsetX,y:e.offsetY}}),await t.dispose()}break;case t.Hover:{await Pe(e.selectors,l,c);const t=await We(e.selectors,l,{timeout:c,visible:u});if(!t)throw new Error("Could not find element: "+e.selectors[0]);f(),await t.hover(),await t.dispose()}break;case t.EmulateNetworkConditions:f(),await r.emulateNetworkConditions(e);break;case t.KeyDown:f(),await r.keyboard.down(e.key),await r.waitForTimeout(100);break;case t.KeyUp:f(),await r.keyboard.up(e.key),await r.waitForTimeout(100);break;case t.Close:"close"in o&&(f(),await o.close());break;case t.Change:{await Pe(e.selectors,l,c);const t=await We(e.selectors,l,{timeout:c,visible:u});if(!t)throw new Error("Could not find element: "+e.selectors[0]);const n=await t.evaluate((e=>e.type));f(),"select-one"===n?await this.changeSelectElement(e,t):i.has(n)?await this.typeIntoElement(e,t):await this.changeElementValue(e,t),await t.dispose()}break;case t.SetViewport:"setViewport"in o&&(f(),await o.setViewport(e));break;case t.Scroll:if("selectors"in e){await Pe(e.selectors,l,c);const t=await We(e.selectors,l,{timeout:c,visible:u});f(),await t.evaluate(((e,t,n)=>{e.scrollTop=n,e.scrollLeft=t}),e.x||0,e.y||0),await t.dispose()}else f(),await l.evaluate(((e,t)=>{window.scroll(e,t)}),e.x||0,e.y||0);break;case t.Navigate:f(),await l.goto(e.url);break;case t.WaitForElement:try{f(),await async function(e,t,n){const{count:r=1,operator:a=">=",visible:i=!0,properties:o,attributes:s}=e,l=Ne[a];await Me((async()=>{const n=await async function(e,t){for(const n of e){const e=await Re(n,t);if(e.length)return e}return[]}(e.selectors,t);let a=l(n.length,r);const c=await t.evaluateHandle(((...e)=>e),...n);return await Promise.all(n.map((e=>e.dispose()))),a&&(o||s)&&(a=await c.evaluate(((e,t,n)=>{if(n)for(const t of e)for(const[e,r]of Object.entries(n))if(t.getAttribute(e)!==r)return!1;if(t)for(const n of e)if(!r(t,n))return!1;return!0;function r(e,t){if(e===t)return!0;if(e&&!t||!e&&t)return!1;if(!(e instanceof Object&&t instanceof Object))return!1;for(const[n,a]of Object.entries(e))if(!r(a,t[n]))return!1;return!0}}),o,s)),await c.dispose(),a===i}),n)}(e,l,c)}catch(e){throw"Timed out"===e.message?new Error("waitForElement timed out. The element(s) could not be found."):e}break;case t.WaitForExpression:f(),await l.waitForFunction(e.expression,{timeout:c});break;case t.CustomStep:break;default:a(e)}await p}async typeIntoElement(e,t){const n=await t.evaluate(((e,t)=>{if(t.length<=e.value.length||!t.startsWith(e.value))return e.value="",t;const n=e.value;return e.value="",e.value=n,t.substring(n.length)}),e.value);await t.type(n)}async changeElementValue(e,t){await t.focus(),await t.evaluate(((e,t)=>{e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}),e.value)}async changeSelectElement(e,t){await t.select(e.value),await t.evaluateHandle((e=>{e.blur(),e.focus()}))}}xe=new WeakSet,Te=async function(e){try{await e._client().send("Emulation.setAutomationOverride",{enabled:!0})}catch{}},Ie=function(e,t){return e.timeout||(null==t?void 0:t.timeout)||this.timeout};class je extends Ve{async afterAllSteps(){await this.browser.close()}}async function Pe(e,t,n){const r=await We(e,t,{visible:!1,timeout:n});if(!r)throw new Error("The element could not be found.");await async function(e,t){await Me((async()=>await e.evaluate((e=>e.isConnected))),t)}(r,n);const a=await(async e=>await e.evaluate((e=>e instanceof SVGElement))?e:null)(r),i=a?await async function(e){return await e.evaluateHandle((e=>{var t;return null!==(t=e.ownerSVGElement)&&void 0!==t?t:e}))}(a):r;!!i&&await i.isIntersectingViewport({threshold:0})||(await async function(e){await e.evaluate((e=>{e.scrollIntoView({block:"center",inline:"center",behavior:"auto"})}))}(r),i&&await async function(e,t){await Me((async()=>await e.isIntersectingViewport({threshold:0})),t)}(i,n),await i.dispose(),i!==r&&await r.dispose())}async function We(e,t,n){for(const r of e)try{return await Oe(r,t,n)}catch(e){console.error("error in waitForSelectors",e)}throw new Error("Could not find element for selectors: "+JSON.stringify(e))}async function Oe(e,t,n){if(Array.isArray(e)||(e=[e]),!e.length)throw new Error("Empty selector provided to `waitForSelector`");let r=1===e.length,a=await t.waitForSelector(e[0],{...n,visible:r&&n.visible});for(const t of e.slice(1,e.length)){if(!a)throw new Error("Could not find element: "+e.join(">>"));const i=await a.evaluateHandle((e=>e.shadowRoot?e.shadowRoot:e));a.dispose(),r=e[e.length-1]===t,a=await i.waitForSelector(t,{...n,visible:r&&n.visible}),i.dispose()}if(!a)throw new Error("Could not find element: "+e.join(">>"));return a}async function Re(e,t){if(Array.isArray(e)||(e=[e]),!e.length)throw new Error("Empty selector provided to querySelectorAll");let n=await t.$$(e[0]);if(!n.length)return[];for(const t of e.slice(1,e.length))if(n=(await Promise.all(n.map((async e=>{const n=await e.evaluateHandle((e=>e.shadowRoot?e.shadowRoot:e)),r=await n.$$(t);return n.dispose(),e.dispose(),r})))).flat(),!n.length)return[];return n}async function Me(e,t){let n=!0;const r=setTimeout((()=>{n=!1}),t);for(;n;){if(await e())return void clearTimeout(r);await new Promise((e=>setTimeout(e,100)))}throw new Error("Timed out")}var Be,De,He,Ke,Ue,qe,Xe;async function Je(e,t,n){var r,a;await(null===(r=e.beforeEachStep)||void 0===r?void 0:r.call(e,t,n)),await e.runStep(t,n),await(null===(a=e.afterEachStep)||void 0===a?void 0:a.call(e,t,n))}class Ye{constructor(e){Be.set(this,void 0),De.set(this,void 0),He.set(this,!1),D(this,De,e,"f")}abort(){D(this,He,!0,"f")}set flow(e){D(this,Be,e,"f")}async runBeforeAllSteps(e){var t,n;await(null===(n=(t=B(this,De,"f")).beforeAllSteps)||void 0===n?void 0:n.call(t,e))}async runAfterAllSteps(e){var t,n;await(null===(n=(t=B(this,De,"f")).afterAllSteps)||void 0===n?void 0:n.call(t,e))}async runStep(e){await Je(B(this,De,"f"),e)}async run(){var e,t,n,r,a,i;if(!B(this,Be,"f"))throw new Error("Set the flow on the runner instance before calling `run`.");const o=B(this,Be,"f");if(D(this,He,!1,"f"),await(null===(t=(e=B(this,De,"f")).beforeAllSteps)||void 0===t?void 0:t.call(e,o)),B(this,He,"f"))return!1;for(const e of o.steps){if(B(this,He,"f"))return await(null===(r=(n=B(this,De,"f")).afterAllSteps)||void 0===r?void 0:r.call(n,o)),!1;await Je(B(this,De,"f"),e,o)}return await(null===(i=(a=B(this,De,"f")).afterAllSteps)||void 0===i?void 0:i.call(a,o)),!0}}async function _e(e,t){const n=e instanceof $e?e:t,r=e instanceof $e?void 0:e,a=new Ye(null!=n?n:await async function(){const{default:e}=await import("puppeteer"),t=await e.launch({headless:!0}),n=await t.newPage();return new je(t,n)}());return r&&(a.flow=r),a}Be=new WeakMap,De=new WeakMap,He=new WeakMap;class ze extends R{async beforeAllSteps(e){e.appendLine("import url from 'url';"),e.appendLine("import { createRunner } from '@puppeteer/replay';"),e.appendLine(""),e.appendLine("export async function run(extension) {").startBlock(),e.appendLine("const runner = await createRunner(extension);"),e.appendLine(""),e.appendLine("await runner.runBeforeAllSteps();"),e.appendLine("")}async afterAllSteps(e){e.appendLine(""),e.appendLine("await runner.runAfterAllSteps();").endBlock().appendLine("}"),e.appendLine(""),e.appendLine("if (process && import.meta.url === url.pathToFileURL(process.argv[1]).href) {").startBlock().appendLine("run()").endBlock().appendLine("}")}async stringifyStep(e,t){e.appendLine(`await runner.runStep(${X(t,e.getIndent())});`)}}function Ge(e){var r;return Boolean(e.type===t.Navigate||(null===(r=e.assertedEvents)||void 0===r?void 0:r.some((e=>e.type===n.Navigation))))}function Qe(e){for(const n of e.steps)if(n.type===t.SetViewport)return n.isMobile;return!1}class Ze extends me{constructor(){super(...arguments),Ke.set(this,!1)}async beforeAllSteps(e,t){e.appendLine("const fs = require('fs');"),await super.beforeAllSteps(e,t),e.appendLine("const lhApi = await import('lighthouse'); // v10.0.0 or later");e.appendLine(`const flags = ${X({screenEmulation:{disabled:!0}},e.getIndent())}`),Qe(t)?e.appendLine("const config = undefined;"):e.appendLine("const config = lhApi.desktopConfig;"),e.appendLine(`const lhFlow = await lhApi.startFlow(page, {name: ${X(t.title,e.getIndent())}, config, flags});`)}async stringifyStep(e,n,r){if(n.type===t.SetViewport)return void await super.stringifyStep(e,n,r);const a=Ge(n);a?(B(this,Ke,"f")&&(e.appendLine("await lhFlow.endTimespan();"),D(this,Ke,!1,"f")),e.appendLine("await lhFlow.startNavigation();")):B(this,Ke,"f")||(e.appendLine("await lhFlow.startTimespan();"),D(this,Ke,!0,"f")),await super.stringifyStep(e,n,r),a&&e.appendLine("await lhFlow.endNavigation();")}async afterAllSteps(e,t){B(this,Ke,"f")&&e.appendLine("await lhFlow.endTimespan();"),e.appendLine("const lhFlowReport = await lhFlow.generateReport();"),e.appendLine("fs.writeFileSync(__dirname + '/flow.report.html', lhFlowReport)"),await super.afterAllSteps(e,t)}}Ke=new WeakMap;class et extends Ve{constructor(){super(...arguments),Ue.set(this,!1),qe.set(this,!1),Xe.set(this,void 0)}async createFlowResult(){if(!B(this,Xe,"f"))throw new Error("Cannot get flow result before running the flow");return B(this,Xe,"f").createFlowResult()}async beforeAllSteps(e){var t;await(null===(t=super.beforeAllSteps)||void 0===t?void 0:t.call(this,e));const{startFlow:n,desktopConfig:r}=await import("lighthouse");let a;Qe(e)||(a=r),D(this,Xe,await n(this.page,{config:a,flags:{screenEmulation:{disabled:!0}},name:e.title}),"f")}async beforeEachStep(e,n){var r;await(null===(r=super.beforeEachStep)||void 0===r?void 0:r.call(this,e,n)),e.type!==t.SetViewport&&(Ge(e)?(B(this,Ue,"f")&&(await B(this,Xe,"f").endTimespan(),D(this,Ue,!1,"f")),await B(this,Xe,"f").startNavigation(),D(this,qe,!0,"f")):B(this,Ue,"f")||(await B(this,Xe,"f").startTimespan(),D(this,Ue,!0,"f")))}async afterEachStep(e,t){var n;B(this,qe,"f")&&(await B(this,Xe,"f").endNavigation(),D(this,qe,!1,"f")),await(null===(n=super.afterEachStep)||void 0===n?void 0:n.call(this,e,t))}async afterAllSteps(e){var t;B(this,Ue,"f")&&await B(this,Xe,"f").endTimespan(),await(null===(t=super.afterAllSteps)||void 0===t?void 0:t.call(this,e))}}Ue=new WeakMap,qe=new WeakMap,Xe=new WeakMap;export{n as AssertedEventType,M as JSONStringifyExtension,et as LighthouseRunnerExtension,Ze as LighthouseStringifyExtension,ze as PuppeteerReplayStringifyExtension,Ve as PuppeteerRunnerExtension,je as PuppeteerRunnerOwningBrowserExtension,me as PuppeteerStringifyExtension,Ye as Runner,$e as RunnerExtension,r as Schema,e as SelectorType,t as StepType,R as StringifyExtension,a as assertAllStepTypesAreHandled,_e as createRunner,z as formatAsJSLiteral,X as formatJSONAsJS,O as getSelectorType,V as maxTimeout,N as minTimeout,s as mouseButtonMap,W as parse,Ae as parseSourceMap,T as parseStep,o as pointerDeviceTypes,Le as stringify,ke as stringifyStep,Ce as stripSourceMap,i as typeableInputTypes,P as validTimeout};
var e,t,n;!function(e){e.CSS="css",e.ARIA="aria",e.Text="text",e.XPath="xpath",e.Pierce="pierce"}(e||(e={})),function(e){e.Change="change",e.Click="click",e.Close="close",e.CustomStep="customStep",e.DoubleClick="doubleClick",e.EmulateNetworkConditions="emulateNetworkConditions",e.Hover="hover",e.KeyDown="keyDown",e.KeyUp="keyUp",e.Navigate="navigate",e.Scroll="scroll",e.SetViewport="setViewport",e.WaitForElement="waitForElement",e.WaitForExpression="waitForExpression"}(t||(t={})),function(e){e.Navigation="navigation"}(n||(n={}));var r=Object.freeze({__proto__:null,get AssertedEventType(){return n},get SelectorType(){return e},get StepType(){return t}});function i(e){throw new Error(`Unknown step type: ${e.type}`)}const a=new Set(["textarea","text","url","tel","search","password","number","email"]),o=new Set(["mouse","pen","touch"]),s=new Map([["primary","left"],["auxiliary","middle"],["secondary","right"],["back","back"],["forward","forward"]]);function p(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))return!1;return void 0!==e[t]}function l(e){return"object"==typeof e&&null!==e}function c(e){return"string"==typeof e}function u(e){return"number"==typeof e}function f(e){return Array.isArray(e)}function d(e){if(p(e,"target")&&c(e.target))return e.target}function w(e){if(p(e,"frame")){if(f(t=e.frame)&&t.every((e=>Number.isInteger(e))))return e.frame;throw new Error("Step `frame` is not an integer array")}var t}function h(e,t){if(p(e,t)){const n=e[t];if(u(n))return n}throw new Error(`Step.${t} is not a number`)}function m(e,t){if(p(e,t)){const n=e[t];if("boolean"==typeof n)return n}throw new Error(`Step.${t} is not a boolean`)}function g(e,t){if(p(e,t))return h(e,t)}function y(e,t){if(p(e,t))return S(e,t)}function b(e,t){if(p(e,t))return m(e,t)}function S(e,t){if(p(e,t)){const n=e[t];if(c(n))return n}throw new Error(`Step.${t} is not a string`)}function E(e){if(!p(e,"selectors"))throw new Error("Step does not have required selectors");if(!f(e.selectors))throw new Error("Step selectors are not an array");if(0===e.selectors.length)throw new Error("Step does not have required selectors");return e.selectors.map((e=>{if(!c(e)&&!f(e))throw new Error("Selector is not an array or string");return f(e)?e.map((e=>{if(!c(e))throw new Error("Selector element is not a string");return e})):e}))}function v(e){if(p(e,"selectors"))return E(e)}function L(e){if(!l(e))throw new Error("Asserted event is not an object");if(!p(e,"type"))throw new Error("Asserted event is missing type");if(e.type===n.Navigation)return{type:n.Navigation,url:y(e,"url"),title:y(e,"title")};throw new Error("Unknown assertedEvent type")}function k(e){if(f(e))return e.map(L)}function F(e,t){if(p(t,"timeout")&&u(t.timeout)&&!j(t.timeout))throw new Error(R);return{type:e,assertedEvents:p(t,"assertedEvents")?k(t.assertedEvents):void 0,timeout:p(t,"timeout")&&u(t.timeout)?t.timeout:void 0}}function A(e,t){return{...F(e,t),target:d(t)}}function x(e,t){return{...A(e,t),frame:w(t)}}function C(e,t){return{...x(e,t),selectors:E(t)}}function T(e){const t={offsetX:h(e,"offsetX"),offsetY:h(e,"offsetY"),duration:g(e,"duration")},n=y(e,"deviceType");if(n){if("string"!=typeof(r=n)||!o.has(r))throw new Error(`'deviceType' for click steps must be one of the following: ${[...o].join(", ")}`);t.deviceType=n}var r;const i=y(e,"button");if(i){if(!function(e){return"string"==typeof e&&s.has(e)}(i))throw new Error(`'button' for click steps must be one of the following: ${[...s.keys()].join(", ")}`);t.button=i}return t}function $(e,n){if(!l(e))throw new Error(n?`Step ${n} is not an object`:"Step is not an object");if(!p(e,"type"))throw new Error(n?`Step ${n} does not have a type`:"Step does not have a type");if(!c(e.type))throw new Error(n?`Type of the step ${n} is not a string`:"Type of the step is not a string");switch(e.type){case t.Click:return function(e){return{...C(t.Click,e),...T(e),type:t.Click}}(e);case t.DoubleClick:return function(e){return{...C(t.DoubleClick,e),...T(e),type:t.DoubleClick}}(e);case t.Hover:return function(e){return{...C(t.Hover,e),type:t.Hover}}(e);case t.Change:return function(e){return{...C(t.Change,e),type:t.Change,value:S(e,"value")}}(e);case t.KeyDown:return function(e){return{...A(t.KeyDown,e),type:t.KeyDown,key:S(e,"key")}}(e);case t.KeyUp:return function(e){return{...A(t.KeyUp,e),type:t.KeyUp,key:S(e,"key")}}(e);case t.EmulateNetworkConditions:return function(e){return{...A(t.EmulateNetworkConditions,e),type:t.EmulateNetworkConditions,download:h(e,"download"),upload:h(e,"upload"),latency:h(e,"latency")}}(e);case t.Close:return function(e){return{...A(t.Close,e),type:t.Close}}(e);case t.SetViewport:return function(e){return{...A(t.SetViewport,e),type:t.SetViewport,width:h(e,"width"),height:h(e,"height"),deviceScaleFactor:h(e,"deviceScaleFactor"),isMobile:m(e,"isMobile"),hasTouch:m(e,"hasTouch"),isLandscape:m(e,"isLandscape")}}(e);case t.Scroll:return function(e){return{...x(t.Scroll,e),type:t.Scroll,x:g(e,"x"),y:g(e,"y"),selectors:v(e)}}(e);case t.Navigate:return function(e){return{...A(t.Navigate,e),type:t.Navigate,target:d(e),url:S(e,"url")}}(e);case t.CustomStep:return function(e){if(!p(e,"name"))throw new Error("customStep is missing name");if(!c(e.name))throw new Error("customStep's name is not a string");return{...x(t.CustomStep,e),type:t.CustomStep,name:e.name,parameters:p(e,"parameters")?e.parameters:void 0}}(e);case t.WaitForElement:return function(e){const n=y(e,"operator");if(n&&">="!==n&&"=="!==n&&"<="!==n)throw new Error("WaitForElement step's operator is not one of '>=','==','<='");if(p(e,"attributes")&&(!l(e.attributes)||Object.values(e.attributes).some((e=>"string"!=typeof e))))throw new Error("WaitForElement step's attribute is not a dictionary of strings");if(p(e,"properties")&&!l(e.properties))throw new Error("WaitForElement step's attribute is not an object");return{...C(t.WaitForElement,e),type:t.WaitForElement,operator:n,count:g(e,"count"),visible:b(e,"visible"),attributes:p(e,"attributes")?e.attributes:void 0,properties:p(e,"properties")?e.properties:void 0}}(e);case t.WaitForExpression:return function(e){if(!p(e,"expression"))throw new Error("waitForExpression step is missing `expression`");return{...x(t.WaitForExpression,e),type:t.WaitForExpression,expression:S(e,"expression")}}(e);default:throw new Error(`Step type ${e.type} is not supported`)}}function N(e){const t=[];if(!f(e))throw new Error("Recording `steps` is not an array");for(const[n,r]of e.entries())t.push($(r,n));return t}const P=1,I=3e4,R=`Timeout is not between ${P} and ${I} milliseconds`;function j(e){return e>=P&&e<=I}function W(e){if(!l(e))throw new Error("Recording is not an object");if(!p(e,"title"))throw new Error("Recording is missing `title`");if(!c(e.title))throw new Error("Recording `title` is not a string");if(p(e,"timeout")&&!u(e.timeout))throw new Error("Recording `timeout` is not a number");if(!p(e,"steps"))throw new Error("Recording is missing `steps`");if(p(e,"timeout")&&u(e.timeout)&&!j(e.timeout))throw new Error(R);return t={title:e.title,timeout:p(e,"timeout")&&u(e.timeout)?e.timeout:void 0,selectorAttribute:p(e,"selectorAttribute")&&c(e.selectorAttribute)?e.selectorAttribute:void 0,steps:N(e.steps)},JSON.parse(JSON.stringify(t));var t}function B(t){for(const n of Object.values(e))if(t.startsWith(`${n}/`))return n;return e.CSS}function O(t){function n(e){return e.replace(/['"()]/g,"\\$&")}Array.isArray(t)||(t=[t]);return t.map((t=>{switch(B(t)){case e.ARIA:return`::-p-aria(${n(t.substring(e.ARIA.length+1))})`;case e.CSS:return t;case e.XPath:return`::-p-xpath(${n(t.substring(e.XPath.length+1))})`;case e.Pierce:return`:scope >>> ${t.substring(e.Pierce.length+1)}`;case e.Text:return`::-p-text(${n(t.substring(e.Text.length+1))})`}})).join(" >>>> ")}class D{async beforeAllSteps(e,t){}async afterAllSteps(e,t){}async beforeEachStep(e,t,n){}async stringifyStep(e,t,n){}async afterEachStep(e,t,n){}}class H extends D{async beforeAllSteps(e,t){const n={...t,steps:void 0},r=JSON.stringify(n,null,e.getIndent()).split("\n");r.pop(),r[r.length-1]+=",",r.push(e.getIndent()+'"steps": ['),e.appendLine(r.join("\n")).startBlock().startBlock()}async afterAllSteps(e){e.endBlock().endBlock().appendLine(e.getIndent()+"]").appendLine("}")}async stringifyStep(e,t,n){const r=JSON.stringify(t,null,e.getIndent());if(!n)return void e.appendLine(r);const i=n.steps.lastIndexOf(t)===n.steps.length-1?"":",";e.appendLine(r+i)}}class K{#e;#t=0;#n=[];constructor(e){this.#e=e}appendLine(e){const t=e.split("\n").map((e=>e?this.#e.repeat(this.#t)+e.trimEnd():""));return this.#n.push(...t),this}startBlock(){return this.#t++,this}endBlock(){if(this.#t--,this.#t<0)throw new Error("Extra endBlock");return this}toString(){return this.#n.join("\n")+"\n"}getIndent(){return this.#e}getSize(){return this.#n.length}}function V(e,t){const n=[];return U(e,n,1,t),n.join("")}function U(e,t=[],n=1,r=" "){switch(typeof e){case"bigint":case"symbol":case"function":case"undefined":throw new Error("Invalid JSON");case"number":case"boolean":t.push(String(e));break;case"string":t.push(X(e));break;case"object":if(null===e)t.push("null");else if(Array.isArray(e)){t.push("[\n");for(let i=0;i<e.length;i++)t.push(r.repeat(n)),U(e[i],t,n+1,r),i!==e.length-1&&t.push(","),t.push("\n");t.push(r.repeat(n-1)+"]")}else{t.push("{\n");const i=Object.keys(e);for(let a=0;a<i.length;a++){const o=i[a],s=e[o];void 0!==s&&(t.push(r.repeat(n)),t.push(o),t.push(": "),U(s,t,n+1,r),a!==i.length-1&&t.push(","),t.push("\n"))}t.push(r.repeat(n-1)+"}")}break;default:throw new Error("Unknown object type")}return t}const q=(e,t)=>e.toString(16).toUpperCase().padStart(t,"0"),M=new Map([["\b","\\b"],["\f","\\f"],["\n","\\n"],["\r","\\r"],["\t","\\t"],["\v","\\v"],["'","\\'"],["\\","\\\\"],["\x3c!--","\\x3C!--"],["<script","\\x3Cscript"],["</script","\\x3C/script"]]),X=e=>{const t=/(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,n=/(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu,r=(e,t,n,r)=>{if(n){if(M.has(n))return M.get(n);return"\\x"+q(n.charCodeAt(0),2)}if(r){return"\\u"+q(r.charCodeAt(0),4)}return t?M.get(t)||"":e};let i="",a="";return e.includes("'")?e.includes('"')?e.includes("`")||e.includes("${")?(a="'",i=e.replace(n,r)):(a="`",i=e.replace(t,r)):(a='"',i=e.replace(t,r)):(a="'",i=e.replace(t,r)),`${a}${i}${a}`};class J extends D{#r=!1;async beforeAllSteps(e,t){e.appendLine("const puppeteer = require('puppeteer'); // v22.0.0 or later"),e.appendLine(""),e.appendLine("(async () => {").startBlock(),e.appendLine("const browser = await puppeteer.launch();"),e.appendLine("const page = await browser.newPage();"),e.appendLine(`const timeout = ${t.timeout||Y};`),e.appendLine("page.setDefaultTimeout(timeout);"),e.appendLine(""),this.#r=!1}async afterAllSteps(e,t){if(e.appendLine(""),e.appendLine("await browser.close();"),e.appendLine(""),this.#r)for(const t of _.split("\n"))e.appendLine(t);e.endBlock().appendLine("})().catch(err => {").startBlock(),e.appendLine("console.error(err);"),e.appendLine("process.exit(1);"),e.endBlock().appendLine("});")}async stringifyStep(e,t,r){if(e.appendLine("{").startBlock(),void 0!==t.timeout&&e.appendLine(`const timeout = ${t.timeout};`),this.#i(e,t),t.assertedEvents){e.appendLine("const promises = [];"),e.appendLine("const startWaitingForEvents = () => {").startBlock();for(const r of t.assertedEvents){if(r.type!==n.Navigation)throw new Error(`Event type ${r.type} is not supported`);e.appendLine(`promises.push(${"frame"in t&&t.frame?"frame":"targetPage"}.waitForNavigation());`)}e.endBlock().appendLine("}")}this.#a(e,t),t.assertedEvents&&e.appendLine("await Promise.all(promises);"),e.endBlock().appendLine("}")}#o(e,t){"main"===t?e.appendLine("const targetPage = page;"):(e.appendLine(`const target = await browser.waitForTarget(t => t.url() === ${V(t,e.getIndent())}, { timeout });`),e.appendLine("const targetPage = await target.page();"),e.appendLine("targetPage.setDefaultTimeout(timeout);"))}#s(e,t){e.appendLine("let frame = targetPage.mainFrame();");for(const n of t)e.appendLine(`frame = frame.childFrames()[${n}];`)}#i(e,t){this.#o(e,t.target||"main"),t.frame&&this.#s(e,t.frame)}#p(e,t,n){e.appendLine("await puppeteer.Locator.race([").startBlock(),e.appendLine(t.selectors.map((n=>`${t.frame?"frame":"targetPage"}.locator(${V(O(n),e.getIndent())})`)).join(",\n")),e.endBlock().appendLine("])"),e.startBlock().appendLine(".setTimeout(timeout)"),t.assertedEvents?.length&&e.appendLine(".on('action', () => startWaitingForEvents())"),n(),e.endBlock()}#l(e,t){this.#p(e,t,(()=>{e.appendLine(".click({"),t.duration&&e.appendLine(` delay: ${t.duration},`),t.button&&e.appendLine(` button: '${s.get(t.button)}',`),e.appendLine(" offset: {"),e.appendLine(` x: ${t.offsetX},`),e.appendLine(` y: ${t.offsetY},`),e.appendLine(" },"),e.appendLine("});")}))}#c(e,t){this.#p(e,t,(()=>{e.appendLine(".click({"),e.appendLine(" count: 2,"),t.duration&&e.appendLine(` delay: ${t.duration},`),t.button&&e.appendLine(` button: '${s.get(t.button)}',`),e.appendLine(" offset: {"),e.appendLine(` x: ${t.offsetX},`),e.appendLine(` y: ${t.offsetY},`),e.appendLine(" },"),e.appendLine("});")}))}#u(e,t){this.#p(e,t,(()=>{e.appendLine(".hover();")}))}#f(e,t){this.#p(e,t,(()=>{e.appendLine(`.fill(${V(t.value,e.getIndent())});`)}))}#d(e,t){e.appendLine("await targetPage.emulateNetworkConditions({"),e.appendLine(` offline: ${!t.download&&!t.upload},`),e.appendLine(` downloadThroughput: ${t.download},`),e.appendLine(` uploadThroughput: ${t.upload},`),e.appendLine(` latency: ${t.latency},`),e.appendLine("});")}#w(e,t){e.appendLine(`await targetPage.keyboard.down(${V(t.key,e.getIndent())});`)}#h(e,t){e.appendLine(`await targetPage.keyboard.up(${V(t.key,e.getIndent())});`)}#m(e,t){e.appendLine("await targetPage.close()")}#g(e,t){e.appendLine(`await targetPage.setViewport(${V({width:t.width,height:t.height},e.getIndent())})`)}#y(e,t){"selectors"in t?this.#p(e,t,(()=>{e.appendLine(`.scroll({ scrollTop: ${t.y}, scrollLeft: ${t.x}});`)})):e.appendLine(`await targetPage.evaluate((x, y) => { window.scroll(x, y); }, ${t.x}, ${t.y})`)}#a(e,n){switch(n.type){case t.Click:return this.#l(e,n);case t.DoubleClick:return this.#c(e,n);case t.Hover:return this.#u(e,n);case t.Change:return this.#f(e,n);case t.EmulateNetworkConditions:return this.#d(e,n);case t.KeyDown:return this.#w(e,n);case t.KeyUp:return this.#h(e,n);case t.Close:return this.#m(e,n);case t.SetViewport:return this.#g(e,n);case t.Scroll:return this.#y(e,n);case t.Navigate:return this.#b(e,n);case t.WaitForElement:return this.#S(e,n);case t.WaitForExpression:return this.#E(e,n);case t.CustomStep:return;default:return i(n)}}#b(e,t){t.assertedEvents?.length&&e.appendLine("startWaitingForEvents();"),e.appendLine(`await targetPage.goto(${V(t.url,e.getIndent())});`)}#E(e,t){e.appendLine(`await ${t.frame?"frame":"targetPage"}.waitForFunction(${V(t.expression,e.getIndent())}, { timeout });`)}#S(e,t){this.#r=!0,e.appendLine(`await waitForElement(${V(t,e.getIndent())}, ${t.frame?"frame":"targetPage"}, timeout);`)}}const Y=5e3,_="async function waitForElement(step, frame, timeout) {\n const {\n count = 1,\n operator = '>=',\n visible = true,\n properties,\n attributes,\n } = step;\n const compFn = {\n '==': (a, b) => a === b,\n '>=': (a, b) => a >= b,\n '<=': (a, b) => a <= b,\n }[operator];\n await waitForFunction(async () => {\n const elements = await querySelectorsAll(step.selectors, frame);\n let result = compFn(elements.length, count);\n const elementsHandle = await frame.evaluateHandle((...elements) => {\n return elements;\n }, ...elements);\n await Promise.all(elements.map((element) => element.dispose()));\n if (result && (properties || attributes)) {\n result = await elementsHandle.evaluate(\n (elements, properties, attributes) => {\n for (const element of elements) {\n if (attributes) {\n for (const [name, value] of Object.entries(attributes)) {\n if (element.getAttribute(name) !== value) {\n return false;\n }\n }\n }\n if (properties) {\n if (!isDeepMatch(properties, element)) {\n return false;\n }\n }\n }\n return true;\n\n function isDeepMatch(a, b) {\n if (a === b) {\n return true;\n }\n if ((a && !b) || (!a && b)) {\n return false;\n }\n if (!(a instanceof Object) || !(b instanceof Object)) {\n return false;\n }\n for (const [key, value] of Object.entries(a)) {\n if (!isDeepMatch(value, b[key])) {\n return false;\n }\n }\n return true;\n }\n },\n properties,\n attributes\n );\n }\n await elementsHandle.dispose();\n return result === visible;\n }, timeout);\n}\n\nasync function querySelectorsAll(selectors, frame) {\n for (const selector of selectors) {\n const result = await querySelectorAll(selector, frame);\n if (result.length) {\n return result;\n }\n }\n return [];\n}\n\nasync function querySelectorAll(selector, frame) {\n if (!Array.isArray(selector)) {\n selector = [selector];\n }\n if (!selector.length) {\n throw new Error('Empty selector provided to querySelectorAll');\n }\n let elements = [];\n for (let i = 0; i < selector.length; i++) {\n const part = selector[i];\n if (i === 0) {\n elements = await frame.$$(part);\n } else {\n const tmpElements = elements;\n elements = [];\n for (const el of tmpElements) {\n elements.push(...(await el.$$(part)));\n }\n }\n if (elements.length === 0) {\n return [];\n }\n if (i < selector.length - 1) {\n const tmpElements = [];\n for (const el of elements) {\n const newEl = (await el.evaluateHandle(el => el.shadowRoot ? el.shadowRoot : el)).asElement();\n if (newEl) {\n tmpElements.push(newEl);\n }\n }\n elements = tmpElements;\n }\n }\n return elements;\n}\n\nasync function waitForFunction(fn, timeout) {\n let isActive = true;\n const timeoutId = setTimeout(() => {\n isActive = false;\n }, timeout);\n while (isActive) {\n const result = await fn();\n if (result) {\n clearTimeout(timeoutId);\n return;\n }\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n throw new Error('Timed out');\n}",z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",G=z.split("").reduce(((e,t,n)=>(e.set(t,n),e)),new Map),Q=31,Z=32,ee=2147483647;function te(e){if(e<0)throw new Error("Only postive integers and zero are supported");if(e>ee)throw new Error("Only integers between 0 and "+ee+" are supported");const t=[];do{let n=e&Q;(e>>>=5)>0&&(n|=Z),t.push(z[n])}while(0!==e);return t.join("")}function ne(e){const t=[],n=e.split("");let r=0,i=0;for(const e of n){const n=G.get(e);r|=(n&Q)<<i,i+=5;n&Z||(t.push(r),r=0,i=0)}return t}const re="//# recorderSourceMap=";async function ie(e,t){t||(t={});const n=t.extension??new J,r=t.writer??new K(t.indentation??" ");await(n.beforeAllSteps?.(r,e));const i=[1];for(const t of e.steps){const a=r.getSize();await(n.beforeEachStep?.(r,t,e)),await n.stringifyStep(r,t,e),await(n.afterEachStep?.(r,t,e));const o=r.getSize();i.push(a,o-a)}return await(n.afterAllSteps?.(r,e)),r.appendLine(re+function(e){const t=[];for(const n of e)t.push(te(n));return t.join("")}(i)),r.toString()}async function ae(e,t){t||(t={});let n=t.extension;n||(n=new J),t.indentation||(t.indentation=" ");const r=t.writer??new K(t.indentation??" ");return await(n.beforeEachStep?.(r,e)),await n.stringifyStep(r,e),await(n.afterEachStep?.(r,e)),r.toString()}function oe(e){return e.trim().startsWith(re)}function se(e){const t=e.split("\n");for(let e=t.length-1;e>=0;e--){const n=t[e];if(oe(n))return ne(n.trim().substring(re.length))}}function pe(e){return e.split("\n").filter((e=>!oe(e))).join("\n")}class le{async beforeAllSteps(e){}async afterAllSteps(e){}async beforeEachStep(e,t){}async runStep(e,t){}async afterEachStep(e,t){}}const ce={"==":(e,t)=>e===t,">=":(e,t)=>e>=t,"<=":(e,t)=>e<=t};function ue(e){return new Promise((t=>{setTimeout(t,e)}))}class fe extends le{browser;page;timeout;constructor(e,t,n){super(),this.browser=e,this.page=t,this.timeout=n?.timeout||5e3}async#v(e){try{await e._client().send("Emulation.setAutomationOverride",{enabled:!0})}catch{}}#L(e,t){return e.timeout||t?.timeout||this.timeout}async runStep(e,t){const n=this.#L(e,t),r=this.page,i=this.browser,a=await async function(e,t,n,r){if(!n.target||"main"===n.target)return t;const i=await e.waitForTarget((e=>e.url()===n.target),{timeout:r}),a=await i.page();if(!a)return null;return a.setDefaultTimeout(r),a}(i,r,e,n);let o=null;if(!a&&e.target){const t=r.frames();for(const n of t)if(n.isOOPFrame()&&n.url()===e.target){o=n;break}o||(o=await r.waitForFrame(e.target,{timeout:n}))}const s=o||a;if(!s)throw new Error("Target is not found for step: "+JSON.stringify(e));await this.#v(s);const p=await async function(e,t){let n="mainFrame"in e?e.mainFrame():e;if("frame"in t&&t.frame)for(const e of t.frame)n=n.childFrames()[e];return n}(s,e);await this.runStepInFrame(e,r,s,p,n)}async runStepInFrame(e,r,a,o,p){let l=null;const c=()=>{l=async function(e,t,r){const i=[];if(t.assertedEvents)for(const a of t.assertedEvents){if(a.type!==n.Navigation)throw new Error(`Event type ${a.type} is not supported`);i.push(e.waitForNavigation({timeout:r}))}await Promise.all(i)}(o,e,p)},u=this.page.locatorRace;switch(e.type){case t.DoubleClick:await u(e.selectors.map((e=>o.locator(O(e))))).setTimeout(p).on("action",(()=>c())).click({count:2,button:e.button&&s.get(e.button),delay:e.duration,offset:{x:e.offsetX,y:e.offsetY}});break;case t.Click:await u(e.selectors.map((e=>o.locator(O(e))))).setTimeout(p).on("action",(()=>c())).click({delay:e.duration,button:e.button&&s.get(e.button),offset:{x:e.offsetX,y:e.offsetY}});break;case t.Hover:await u(e.selectors.map((e=>o.locator(O(e))))).setTimeout(p).on("action",(()=>c())).hover();break;case t.EmulateNetworkConditions:c(),await r.emulateNetworkConditions(e);break;case t.KeyDown:c(),await r.keyboard.down(e.key),await ue(100);break;case t.KeyUp:c(),await r.keyboard.up(e.key),await ue(100);break;case t.Close:"close"in a&&(c(),await a.close());break;case t.Change:await u(e.selectors.map((e=>o.locator(O(e))))).on("action",(()=>c())).setTimeout(p).fill(e.value);break;case t.SetViewport:"setViewport"in a&&(c(),await a.setViewport(e));break;case t.Scroll:"selectors"in e?await u(e.selectors.map((e=>o.locator(O(e))))).on("action",(()=>c())).setTimeout(p).scroll({scrollLeft:e.x||0,scrollTop:e.y||0}):(c(),await o.evaluate(((e,t)=>{window.scroll(e,t)}),e.x||0,e.y||0));break;case t.Navigate:c(),await o.goto(e.url);break;case t.WaitForElement:try{c(),await async function(e,t,n){const{count:r=1,operator:i=">=",visible:a=!0,properties:o,attributes:s}=e,p=ce[i];await async function(e,t){let n=!0;const r=setTimeout((()=>{n=!1}),t);for(;n;){if(await e())return void clearTimeout(r);await new Promise((e=>setTimeout(e,100)))}throw new Error("Timed out")}((async()=>{const n=await async function(e,t){for(const n of e){const e=await we(n,t);if(e.length)return e}return[]}(e.selectors,t);let i=p(n.length,r);const l=await t.evaluateHandle(((...e)=>e),...n);return await Promise.all(n.map((e=>e.dispose()))),i&&(o||s)&&(i=await l.evaluate(((e,t,n)=>{if(n)for(const t of e)for(const[e,r]of Object.entries(n))if(t.getAttribute(e)!==r)return!1;if(t)for(const n of e)if(!r(t,n))return!1;return!0;function r(e,t){if(e===t)return!0;if(e&&!t||!e&&t)return!1;if(!(e instanceof Object&&t instanceof Object))return!1;for(const[n,i]of Object.entries(e))if(!r(i,t[n]))return!1;return!0}}),o,s)),await l.dispose(),i===a}),n)}(e,o,p)}catch(e){throw"Timed out"===e.message?new Error("waitForElement timed out. The element(s) could not be found."):e}break;case t.WaitForExpression:c(),await o.waitForFunction(e.expression,{timeout:p});break;case t.CustomStep:break;default:i(e)}await l}}class de extends fe{async afterAllSteps(){await this.browser.close()}}async function we(e,t){if(Array.isArray(e)||(e=[e]),!e.length)throw new Error("Empty selector provided to querySelectorAll");let n=await t.$$(e[0]);if(!n.length)return[];for(const t of e.slice(1,e.length))if(n=(await Promise.all(n.map((async e=>{const n=await e.evaluateHandle((e=>e.shadowRoot?e.shadowRoot:e)),r=await n.$$(t);return n.dispose(),e.dispose(),r})))).flat(),!n.length)return[];return n}async function he(e,t,n){await(e.beforeEachStep?.(t,n)),await e.runStep(t,n),await(e.afterEachStep?.(t,n))}class me{#k;#F;#A=!1;constructor(e){this.#F=e}abort(){this.#A=!0}set flow(e){this.#k=e}async runBeforeAllSteps(e){await(this.#F.beforeAllSteps?.(e))}async runAfterAllSteps(e){await(this.#F.afterAllSteps?.(e))}async runStep(e){await he(this.#F,e)}async run(){if(!this.#k)throw new Error("Set the flow on the runner instance before calling `run`.");const e=this.#k;if(this.#A=!1,await(this.#F.beforeAllSteps?.(e)),this.#A)return!1;for(const t of e.steps){if(this.#A)return await(this.#F.afterAllSteps?.(e)),!1;await he(this.#F,t,e)}return await(this.#F.afterAllSteps?.(e)),!0}}async function ge(e,t){const n=e instanceof le?void 0:e,r=new me((e instanceof le?e:t)??await async function(){const{default:e}=await import("puppeteer"),t=await e.launch(),n=await t.newPage();return new de(t,n)}());return n&&(r.flow=n),r}class ye extends D{async beforeAllSteps(e){e.appendLine("import url from 'url';"),e.appendLine("import { createRunner } from '@puppeteer/replay';"),e.appendLine(""),e.appendLine("export async function run(extension) {").startBlock(),e.appendLine("const runner = await createRunner(extension);"),e.appendLine(""),e.appendLine("await runner.runBeforeAllSteps();"),e.appendLine("")}async afterAllSteps(e){e.appendLine(""),e.appendLine("await runner.runAfterAllSteps();").endBlock().appendLine("}"),e.appendLine(""),e.appendLine("if (process && import.meta.url === url.pathToFileURL(process.argv[1]).href) {").startBlock().appendLine("run()").endBlock().appendLine("}")}async stringifyStep(e,t){e.appendLine(`await runner.runStep(${V(t,e.getIndent())});`)}}function be(e){return Boolean(e.type===t.Navigate||e.assertedEvents?.some((e=>e.type===n.Navigation)))}function Se(e){for(const n of e.steps)if(n.type===t.SetViewport)return n.isMobile;return!1}class Ee extends J{#x=!1;async beforeAllSteps(e,t){e.appendLine("const fs = require('fs');"),await super.beforeAllSteps(e,t),e.appendLine("const lhApi = await import('lighthouse'); // v10.0.0 or later");e.appendLine(`const flags = ${V({screenEmulation:{disabled:!0}},e.getIndent())}`),Se(t)?e.appendLine("const config = undefined;"):e.appendLine("const config = lhApi.desktopConfig;"),e.appendLine(`const lhFlow = await lhApi.startFlow(page, {name: ${V(t.title,e.getIndent())}, config, flags});`)}async stringifyStep(e,n,r){if(n.type===t.SetViewport)return void await super.stringifyStep(e,n,r);const i=be(n);i?(this.#x&&(e.appendLine("await lhFlow.endTimespan();"),this.#x=!1),e.appendLine("await lhFlow.startNavigation();")):this.#x||(e.appendLine("await lhFlow.startTimespan();"),this.#x=!0),await super.stringifyStep(e,n,r),i&&e.appendLine("await lhFlow.endNavigation();")}async afterAllSteps(e,t){this.#x&&e.appendLine("await lhFlow.endTimespan();"),e.appendLine("const lhFlowReport = await lhFlow.generateReport();"),e.appendLine("fs.writeFileSync(__dirname + '/flow.report.html', lhFlowReport)"),await super.afterAllSteps(e,t)}}class ve extends fe{#C=!1;#T=!1;#$;async createFlowResult(){if(!this.#$)throw new Error("Cannot get flow result before running the flow");return this.#$.createFlowResult()}async beforeAllSteps(e){await(super.beforeAllSteps?.(e));const{startFlow:t,desktopConfig:n}=await import("lighthouse");let r;Se(e)||(r=n),this.#$=await t(this.page,{config:r,flags:{screenEmulation:{disabled:!0}},name:e.title})}async beforeEachStep(e,n){await(super.beforeEachStep?.(e,n)),e.type!==t.SetViewport&&(be(e)?(this.#C&&(await this.#$.endTimespan(),this.#C=!1),await this.#$.startNavigation(),this.#T=!0):this.#C||(await this.#$.startTimespan(),this.#C=!0))}async afterEachStep(e,t){this.#T&&(await this.#$.endNavigation(),this.#T=!1),await(super.afterEachStep?.(e,t))}async afterAllSteps(e){this.#C&&await this.#$.endTimespan(),await(super.afterAllSteps?.(e))}}export{n as AssertedEventType,H as JSONStringifyExtension,ve as LighthouseRunnerExtension,Ee as LighthouseStringifyExtension,ye as PuppeteerReplayStringifyExtension,fe as PuppeteerRunnerExtension,de as PuppeteerRunnerOwningBrowserExtension,J as PuppeteerStringifyExtension,me as Runner,le as RunnerExtension,r as Schema,e as SelectorType,t as StepType,D as StringifyExtension,i as assertAllStepTypesAreHandled,ge as createRunner,X as formatAsJSLiteral,V as formatJSONAsJS,B as getSelectorType,I as maxTimeout,P as minTimeout,s as mouseButtonMap,W as parse,se as parseSourceMap,$ as parseStep,o as pointerDeviceTypes,O as selectorToPElementSelector,ie as stringify,ae as stringifyStep,pe as stripSourceMap,a as typeableInputTypes,j as validTimeout};

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization High library

This string may still contain
<!--
, which may cause an HTML element injection vulnerability.
<${i.Icon.Icon.litTagName} .data=${{iconPath:e,color:t,width:o,height:r}}></${i.Icon.Icon.litTagName}>
`}#u(){if(!this.#p)return n.html``;const{src:e,width:t="100%",height:o="100%"}=this.#p;return n.html`
<img class="markdown-image" src=${e} alt=${this.#m} width=${t} height=${o}/>
`}#d(){if(!this.#p)return;const{isIcon:e}=this.#p,t=e?this.#g():this.#u();n.render(t,this.#e,{host:this})}}customElements.define("devtools-markdown-image",x);var y=Object.freeze({__proto__:null,MarkdownImage:x});const b=new CSSStyleSheet;b.replaceSync(".devtools-link{color:var(--sys-color-primary);outline-offset:2px;text-decoration:none}.devtools-link:hover{text-decoration:underline}\n/*# sourceURL=markdownLink.css */\n");const v=new Map([["issuesContrastWCAG21AA","https://www.w3.org/TR/WCAG21/#contrast-minimum"],["issuesContrastWCAG21AAA","https://www.w3.org/TR/WCAG21/#contrast-enhanced"],["issuesContrastSuggestColor","https://developers.google.com/web/updates/2020/08/devtools#accessible-color"],["issuesCSPSetStrict","https://web.dev/strict-csp"],["issuesCSPWhyStrictOverAllowlist","https://web.dev/strict-csp/#why-a-strict-csp-is-recommended-over-allowlist-csps"],["issueCorsPreflightRequest","https://web.dev/cross-origin-resource-sharing/#preflight-requests-for-complex-http-calls"],["issueQuirksModeDoctype","https://web.dev/doctype/"],["sameSiteAndSameOrigin","https://web.dev/same-site-same-origin/"],["punycodeReference","https://wikipedia.org/wiki/Punycode"],["https://xhr.spec.whatwg.org/","https://xhr.spec.whatwg.org/"],["https://goo.gle/chrome-insecure-origins","https://goo.gle/chrome-insecure-origins"],["https://webrtc.org/web-apis/chrome/unified-plan/","https://webrtc.org/web-apis/chrome/unified-plan/"],["https://developer.chrome.com/blog/enabling-shared-array-buffer/","https://developer.chrome.com/blog/enabling-shared-array-buffer/"],["https://developer.chrome.com/docs/extensions/mv3/","https://developer.chrome.com/docs/extensions/mv3/"],["https://developer.chrome.com/blog/immutable-document-domain/","https://developer.chrome.com/blog/immutable-document-domain/"],["https://github.com/WICG/shared-element-transitions/blob/main/debugging_overflow_on_images.md","https://github.com/WICG/shared-element-transitions/blob/main/debugging_overflow_on_images.md"],["https://developer.chrome.com/docs/extensions/reference/privacy/#property-websites-privacySandboxEnabled","https://developer.chrome.com/docs/extensions/reference/privacy/#property-websites-privacySandboxEnabled"],["PNASecureContextRestrictionFeatureStatus","https://chromestatus.com/feature/5954091755241472"],["https://w3c.github.io/uievents/#legacy-event-types","https://w3c.github.io/uievents/#legacy-event-types"],["manageCookiesHelpPage","https://support.google.com/chrome/answer/95647"],["gracePeriodStagedControlExplainer","https://developers.google.com/privacy-sandbox/blog/grace-period-opt-out"]]),f=e=>{if(/^https:\/\/www.chromestatus.com\/feature\/\d+$/.test(e))return e;const t=v.get(e);if(!t)throw new Error(`Markdown link with key '${e}' is not available, please check MarkdownLinksMap.ts`);return t};var T=Object.freeze({__proto__:null,markdownLinks:v,getMarkdownLink:f});class $ extends HTMLElement{static litTagName=n.literal`devtools-markdown-link`;#e=this.attachShadow({mode:"open"});#k="";#w="";connectedCallback(){this.#e.adoptedStyleSheets=[b]}set data(e){const{key:t,title:o}=e,r=f(t);this.#k=o,this.#w=r,this.#d()}#d(){const e=n.html`<x-link class="devtools-link" href=${this.#w} jslog=${a.link().track({click:!0})}

Check failure

Code scanning / CodeQL

Incomplete regular expression for hostnames High library

This regular expression has an unescaped '.' before 'chromestatus.com', so it might match more hosts than expected.
@@ -0,0 +1,29 @@
import*as e from"../code_highlighter/code_highlighter.js";import*as t from"../../lit-html/lit-html.js";import*as o from"../../visual_logging/visual_logging.js";const s=new CSSStyleSheet;s.replaceSync(".token-variable{color:var(--sys-color-token-variable)}.token-property{color:var(--sys-color-token-property)}.token-type{color:var(--sys-color-token-type)}.token-variable-special{color:var(--sys-color-token-variable-special)}.token-definition{color:var(--sys-color-token-definition)}.token-builtin{color:var(--sys-color-token-builtin)}.token-number{color:var(--sys-color-token-number)}.token-string{color:var(--sys-color-token-string)}.token-string-special{color:var(--sys-color-token-string-special)}.token-atom{color:var(--sys-color-token-atom)}.token-keyword{color:var(--sys-color-token-keyword)}.token-comment{color:var(--sys-color-token-comment)}.token-meta{color:var(--sys-color-token-meta)}.token-invalid{color:var(--sys-color-error)}.token-tag{color:var(--sys-color-token-tag)}.token-attribute{color:var(--sys-color-token-attribute)}.token-attribute-value{color:var(--sys-color-token-attribute-value)}.token-inserted{color:var(--sys-color-token-inserted)}.token-deleted{color:var(--sys-color-token-deleted)}.token-heading{color:var(--sys-color-token-variable-special);font-weight:bold}.token-link{color:var(--sys-color-token-variable-special);text-decoration:underline}.token-strikethrough{text-decoration:strike-through}.token-strong{font-weight:bold}.token-emphasis{font-style:italic}\n/*# sourceURL=codeHighlighter.css */\n");const i=new CSSStyleSheet;i.replaceSync('*{box-sizing:border-box;font-size:inherit;margin:0;padding:0}:host{position:relative}devtools-editable-content{background:transparent;border:none;color:var(--override-color-recorder-input,var(--sys-color-on-surface));cursor:text;display:inline-block;line-height:18px;min-height:18px;min-width:0.5em;outline:none;overflow-wrap:anywhere}devtools-editable-content:hover,\ndevtools-editable-content:focus{box-shadow:0 0 0 1px var(--sys-color-divider);border-radius:2px}devtools-editable-content[placeholder]:empty::before{content:attr(placeholder);color:var(--sys-color-on-surface);opacity:50%}devtools-editable-content[placeholder]:empty:focus::before{content:""}devtools-suggestion-box{position:absolute;display:none}devtools-editable-content:focus ~ devtools-suggestion-box{display:block}.suggestions{background-color:var(--sys-color-cdt-base-container);box-shadow:var(--drop-shadow);min-height:1em;min-width:150px;overflow-x:hidden;overflow-y:auto;position:relative;z-index:100;max-height:350px}.suggestions > li{padding:1px;border:1px solid transparent;white-space:nowrap;font-family:var(--source-code-font-family);font-size:var(--source-code-font-size);color:var(--sys-color-on-surface)}.suggestions > li:hover{background-color:var(--sys-color-state-hover-on-subtle)}.suggestions > li.selected{background-color:var(--sys-color-primary);color:var(--sys-color-cdt-base-container)}.strikethrough{text-decoration:line-through}\n/*# sourceURL=suggestionInput.css */\n');var n=self&&self.__decorate||function(e,t,o,s){var i,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,s);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(r=(n<3?i(r):n>3?i(t,o,r):i(t,o))||r);return n>3&&r&&Object.defineProperty(t,o,r),r};function r(e,t="Assertion failed!"){if(!e)throw new Error(t)}const{html:l,Decorators:a,Directives:c,LitElement:h}=t,{customElement:d,property:u,state:g}=a,{classMap:p}=c,v={hasChanged:(e,t)=>JSON.stringify(e)!==JSON.stringify(t)};let y=class extends HTMLElement{static get observedAttributes(){return["disabled","placeholder"]}set disabled(e){this.contentEditable=String(!e)}get disabled(){return"true"!==this.contentEditable}set value(e){this.innerText=e,this.#e()}get value(){return this.innerText}set mimeType(e){this.#t=e,this.#e()}get mimeType(){return this.#t}#t="";constructor(){super(),this.contentEditable="true",this.tabIndex=0,this.addEventListener("focus",(()=>{this.innerHTML=this.innerText})),this.addEventListener("blur",this.#e.bind(this))}#e(){this.#t&&e.CodeHighlighter.highlightNode(this,this.#t)}attributeChangedCallback(e,t,o){if("disabled"===e)this.disabled=null!==o}};y=n([d("devtools-editable-content")],y);class b extends Event{static eventName="suggest";constructor(e){super(b.eventName),this.suggestion=e}}class m extends Event{static eventName="suggestioninit";listeners;constructor(e){super(m.eventName),this.listeners=e}}const k=(e,t)=>e.toLowerCase().startsWith(t.toLowerCase());let f=class extends h{static styles=[i];#o=[];constructor(){super(),this.options=[],this.expression="",this.cursor=0}#s=e=>{if(r(e instanceof KeyboardEvent,"Bound to the wrong event."),this.#o.length>0)switch(e.key){case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.#i(1);break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.#i(-1)}if("Enter"===e.key)this.#o[this.cursor]&&this.#n(this.#o[this.cursor]),e.preventDefault()};#i(e){var t,o;this.cursor=(t=this.cursor+e,o=this.#o.length,(t%o+o)%o)}#n(e){this.dispatchEvent(new b(e))}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new m([["keydown",this.#s]]))}willUpdate(e){e.has("options")&&(this.options=Object.freeze([...this.options].sort())),(e.has("expression")||e.has("options"))&&(this.cursor=0,this.#o=this.options.filter((e=>(this.suggestionFilter||k)(e,this.expression))))}render(){if(0!==this.#o.length)return l`<ul class="suggestions">

Check failure

Code scanning / CodeQL

DOM text reinterpreted as HTML High library

DOM text
is reinterpreted as HTML without escaping meta-characters.
@@ -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 i from"../../../../core/platform/platform.js";import*as o from"../../../../core/sdk/sdk.js";import*as r from"../../../../models/bindings/bindings.js";import*as a from"../../legacy.js";import*as s from"../../../../models/breakpoints/breakpoints.js";import*as c from"../../../../models/text_utils/text_utils.js";import*as l from"../../../../models/workspace/workspace.js";const d=new CSSStyleSheet;d.replaceSync(".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-preview-container .row{line-height:1.2;vertical-align:baseline}.image-preview-container .title{padding-right:0.5em;text-align:right;color:var(--color-text-secondary);white-space:nowrap}.image-preview-container .description{white-space:nowrap;text-align:left;color:var(--color-text-primary)}.image-preview-container .description-link{max-width:20em}.image-preview-container .source-link{white-space:normal;word-break:break-all;color:var(--color-link);cursor:pointer}\n/*# sourceURL=imagePreview.css */\n");const u={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:"},p=n.i18n.registerUIStrings("ui/legacy/components/utils/ImagePreview.ts",u),g=n.i18n.getLocalizedString.bind(void 0,p);function m(t){return null!==t&&t.resourceType()===e.ResourceType.resourceTypes.Image}var h=Object.freeze({__proto__:null,ImagePreview:class{static async build(e,n,r,a={precomputedFeatures:void 0,imageAltText:void 0}){const{precomputedFeatures:s,imageAltText:c}=a,l=e.model(o.ResourceTreeModel.ResourceTreeModel);if(!l)return null;let p=l.resourceForURL(n),h=n;if(!m(p)&&s&&s.currentSrc&&(h=s.currentSrc,p=l.resourceForURL(h)),!p||!m(p))return null;const k=p,L=p.displayName,f=p.content?p.content:p.url.split("base64,")[1],b=p.contentSize(),C=b||i.StringUtilities.base64ToSize(f),w=C>0?i.NumberUtilities.bytesToString(C):"";return new Promise((e=>{const n=document.createElement("img");n.addEventListener("load",(function(){const o=document.createElement("div"),a=o.attachShadow({mode:"open"});a.adoptedStyleSheets=[d];const c=a.createChild("table");c.className="image-preview-container";const l=c.createChild("tr").createChild("td","image-container");l.colSpan=2;const p=l.createChild("div");p.title=L,p.appendChild(n),p.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(h)}));const m=n.naturalWidth,k=n.naturalHeight,f=s?s.renderedWidth:m,b=s?s.renderedHeight:k;if(r){const e=c.createChild("tr","row");e.createChild("td","title").textContent=g(u.renderedSize),e.createChild("td","description").textContent=`${f} × ${b} px`;const t=c.createChild("tr","row");if(t.createChild("td","title").textContent=g(u.renderedAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(f,b),b!==k||f!==m){const e=c.createChild("tr","row");e.createChild("td","title").textContent=g(u.intrinsicSize),e.createChild("td","description").textContent=`${m} × ${k} px`;const t=c.createChild("tr","row");t.createChild("td","title").textContent=g(u.intrinsicAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(m,k)}}const C=c.createChild("tr","row");C.createChild("td","title").textContent=g(u.fileSize),C.createChild("td","description").textContent=w;const v=c.createChild("tr","row");v.createChild("td","title").textContent=g(u.currentSource);const S=i.StringUtilities.trimMiddle(h,100),I=v.createChild("td","description description-link").createChild("span","source-link");I.textContent=S,I.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(h)})),e(o)}),!1),n.addEventListener("error",(()=>e(null)),!1),c&&(n.alt=c),k.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),i=n.isValid?n.displayName:g(u.unknownSource);return g(u.imageFromS,{PH1:i})}}});const k={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",k),f=n.i18n.getLocalizedString.bind(void 0,L),b=new Set;let C=null;const w=new WeakMap,v=new WeakMap,S=new WeakMap,I=new Map;let y;class x{maxLength;anchorsByTarget;locationPoolByTarget;onLiveLocationUpdate;useLinkDecorator;constructor(e,t,n=(()=>{})){this.maxLength=e||a.UIUtils.MaxLengthForDisplayedURLs,this.anchorsByTarget=new Map,this.locationPoolByTarget=new Map,this.onLiveLocationUpdate=n,this.useLinkDecorator=Boolean(t),b.add(this),o.TargetManager.TargetManager.instance().observeTargets(this)}static setLinkDecorator(e){console.assert(!C,"Cannot re-register link decorator."),C=e,e.addEventListener(T.Events.LinkIconChanged,(function(e){const t=e.data,n=w.get(t)||[];for(const e of n)x.updateLinkDecorations(e)}));for(const e of b)e.updateAllAnchorDecorations()}updateAllAnchorDecorations(){for(const e of this.anchorsByTarget.values())for(const t of e)x.updateLinkDecorations(t)}static bindUILocation(e,t){const n=x.linkInfo(e);if(!n)return;if(n.uiLocation=t,!t)return;const i=t.uiSourceCode;let o=w.get(i);o||(o=new Set,w.set(i,o)),o.add(e)}static unbindUILocation(e){const t=x.linkInfo(e);if(!t||!t.uiLocation)return;const n=t.uiLocation.uiSourceCode;t.uiLocation=null;const i=w.get(n);i&&i.delete(e)}static bindBreakpoint(e,t){const n=x.linkInfo(e);if(!n)return;const i=s.BreakpointManager.BreakpointManager.instance().findBreakpoint(t);i&&(n.revealable=i)}static unbindBreakpoint(e){const t=x.linkInfo(e);t&&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=x.linkInfo(e);if(!t)continue;t.liveLocation=null,x.unbindUILocation(e);const n=t.fallback;n&&e.replaceWith(n)}}}maybeLinkifyScriptLocation(e,t,n,i,a){let s=null;const c={lineNumber:i,maxLength:this.maxLength,columnNumber:a?.columnNumber,showColumnNumber:Boolean(a?.showColumnNumber),className:a?.className,tabStop:a?.tabStop,inlineFrameIndex:a?.inlineFrameIndex??0,userMetric:a?.userMetric},{columnNumber:l,className:d=""}=c;if(n&&(s=x.linkifyURL(n,c)),!e||e.isDisposed())return s;const u=e.model(o.DebuggerModel.DebuggerModel);if(!u)return s;const p=t?u.createRawLocationByScriptId(t,i||0,l,c.inlineFrameIndex):u.createRawLocationByURL(n,i||0,l,c.inlineFrameIndex);if(!p)return s;const g={tabStop:a?.tabStop},{link:m,linkInfo:h}=x.createLink(s&&s.textContent?s.textContent:"",d,g);h.enableDecorator=this.useLinkDecorator,h.fallback=s,h.userMetric=a?.userMetric;const k=this.locationPoolByTarget.get(p.debuggerModel.target());if(!k)return s;const L={showColumnNumber:c.showColumnNumber,revealBreakpoint:a?.revealBreakpoint},f=this.onLiveLocationUpdate;r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createLiveLocation(p,this.updateAnchor.bind(this,m,L),k).then((e=>{e&&(h.liveLocation=e,f())}));return this.anchorsByTarget.get(p.debuggerModel.target()).push(m),m}linkifyScriptLocation(e,t,n,i,o){const r=this.maybeLinkifyScriptLocation(e,t,n,i,o),a={lineNumber:i,maxLength:this.maxLength,className:o?.className,columnNumber:o?.columnNumber,showColumnNumber:Boolean(o?.showColumnNumber),inlineFrameIndex:o?.inlineFrameIndex??0,tabStop:o?.tabStop,userMetric:o?.userMetric};return r||x.linkifyURL(n,a)}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 i={...n,columnNumber:t.columnNumber,inlineFrameIndex:n?.inlineFrameIndex??0};return this.maybeLinkifyScriptLocation(e,t.scriptId,t.url,t.lineNumber,i)}linkifyStackTraceTopFrame(e,t){console.assert(t.callFrames.length>0);const{url:n,lineNumber:i,columnNumber:a}=t.callFrames[0],s=x.linkifyURL(n,{lineNumber:i,columnNumber:a,showColumnNumber:!1,inlineFrameIndex:0,maxLength:this.maxLength,preventClick:!0});if(!e)return s;const c=this.locationPoolByTarget.get(e);if(!c)return console.assert(e.isDisposed()),s;console.assert(!e.isDisposed());const l=e.model(o.DebuggerModel.DebuggerModel),{link:d,linkInfo:u}=x.createLink("","");u.enableDecorator=this.useLinkDecorator,u.fallback=s;const p=this.onLiveLocationUpdate;r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createStackTraceTopFrameLiveLocation(l.createRawLocationsByStackTrace(t),this.updateAnchor.bind(this,d,{showColumnNumber:!1}),c).then((e=>{u.liveLocation=e,p()}));return this.anchorsByTarget.get(e).push(d),d}linkifyCSSLocation(e,t){const{link:n,linkInfo:i}=x.createLink("",t||"",{tabStop:!0});i.enableDecorator=this.useLinkDecorator;const o=this.locationPoolByTarget.get(e.cssModel().target());if(!o)return n;const a=this.onLiveLocationUpdate;r.CSSWorkspaceBinding.CSSWorkspaceBinding.instance().createLiveLocation(e,this.updateAnchor.bind(this,n,{showColumnNumber:!1}),o).then((e=>{i.liveLocation=e,a()}));return this.anchorsByTarget.get(e.cssModel().target()).push(n),n}reset(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e),this.targetAdded(e)}dispose(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e);o.TargetManager.TargetManager.instance().unobserveTargets(this),b.delete(this)}async updateAnchor(t,n,i){x.unbindUILocation(t),n.revealBreakpoint&&x.unbindBreakpoint(t);const o=await i.uiLocation();if(!o){if(i instanceof r.CSSWorkspaceBinding.LiveLocation){const n=i.header();n&&n.ownerNode&&(t.addEventListener("click",(t=>{t.consume(!0),e.Revealer.reveal(n.ownerNode||null)}),!1),x.setTrimmedText(t,"<style>"))}return}x.bindUILocation(t,o),n.revealBreakpoint&&x.bindBreakpoint(t,o);const s=o.linkText(!0,n.showColumnNumber);x.setTrimmedText(t,s,this.maxLength);let c=o.uiSourceCode.url();"application/wasm"===o.uiSourceCode.mimeType()?"number"==typeof o.columnNumber&&(c+=`:0x${o.columnNumber.toString(16)}`):(c+=":"+(o.lineNumber+1),n.showColumnNumber&&"number"==typeof o.columnNumber&&(c+=":"+(o.columnNumber+1))),a.Tooltip.Tooltip.install(t,c),t.classList.toggle("ignore-list-link",await i.isIgnoreListed()),x.updateLinkDecorations(t)}setLiveLocationUpdateCallback(e){this.onLiveLocationUpdate=e}static updateLinkDecorations(e){const t=x.linkInfo(e);if(!t||!t.enableDecorator)return;if(!C||!t.uiLocation)return;t.icon&&t.icon.parentElement&&e.removeChild(t.icon);const n=C.linkIcon(t.uiLocation.uiSourceCode);n&&(n.style.setProperty("margin-right","2px"),e.insertBefore(n,e.firstChild)),t.icon=n}static linkifyURL(e,t){const n=(t=t||{showColumnNumber:!1,inlineFrameIndex:0}).text,i=t.className||"",o=t.lineNumber,s=t.columnNumber,c=t.showColumnNumber,l=t.preventClick,d=t.maxLength||a.UIUtils.MaxLengthForDisplayedURLs,u=t.bypassURLTrimming;if(!e||e.trim().toLowerCase().startsWith("javascript:")){const t=document.createElement("span");return i&&(t.className=i),t.textContent=n||e||f(k.unknown),t}let p=n||r.ResourceUtils.displayNameForURL(e);"number"!=typeof o||n||(p+=":"+(o+1),c&&"number"==typeof s&&(p+=":"+(s+1)));const g={maxLength:d,title:p!==e?e:"",href:e,preventClick:l,tabStop:t.tabStop,bypassURLTrimming:u},{link:m,linkInfo:h}=x.createLink(p,i,g);return o&&(h.lineNumber=o),s&&(h.columnNumber=s),h.userMetric=t?.userMetric,m}static linkifyRevealable(e,t,n,i,o){const r={maxLength:a.UIUtils.MaxLengthForDisplayedURLs,href:n,title:i},{link:s,linkInfo:c}=x.createLink(t,o||"",r);return c.revealable=e,s}static createLink(e,t,n={}){const{maxLength:i,title:o,href:r,preventClick:s,tabStop:c,bypassURLTrimming:l}=n,d=document.createElement("span");t&&(d.className=t),d.classList.add("devtools-link"),o&&a.Tooltip.Tooltip.install(d,o),r&&(d.href=r),e instanceof HTMLElement?d.appendChild(e):l?(d.classList.add("devtools-link-styled-trim"),x.appendTextWithoutHashes(d,e)):x.setTrimmedText(d,e,i);const u={icon:null,enableDecorator:!1,uiLocation:null,liveLocation:null,url:r||null,lineNumber:null,columnNumber:null,inlineFrameIndex:0,revealable:null,fallback:null};return v.set(d,u),s?d.classList.add("devtools-link-prevent-click"):(d.addEventListener("click",(e=>{x.handleClick(e)&&e.consume(!0)}),!1),d.addEventListener("keydown",(e=>{"Enter"===e.key&&x.handleClick(e)&&e.consume(!0)}),!1)),a.ARIAUtils.markAsLink(d),d.tabIndex=c?0:-1,{link:d,linkInfo:u}}static setTrimmedText(e,t,n){if(e.removeChildren(),n&&t.length>n){const i=function(e,t){let n=Math.floor(t/2),i=e.length-Math.ceil(t/2)+1;const o=e.codePointAt(i-1);void 0!==o&&o>=65536&&(i++,n++);const r=e.codePointAt(n-1);void 0!==r&&n>0&&r>=65536&&n--;return[e.substring(0,n),e.substring(n,i),e.substring(i)]}(t,n);x.appendTextWithoutHashes(e,i[0]),x.appendHiddenText(e,i[1]),x.appendTextWithoutHashes(e,i[2])}else x.appendTextWithoutHashes(e,t)}static appendTextWithoutHashes(e,t){const n=c.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)),x.appendHiddenText(e,t.value.substring(7)))}static appendHiddenText(e,t){const n=a.UIUtils.createTextChild(e.createChild("span","devtools-link-ellipsis"),"…");S.set(n,t)}static untruncatedNodeText(e){return S.get(e)||e.textContent||""}static linkInfo(e){return e&&v.get(e)||null}static handleClick(e){const t=e.currentTarget;if(a.UIUtils.isBeingEdited(e.target)||t.hasSelection())return!1;const n=x.linkInfo(t);return!!n&&x.invokeFirstAction(n)}static handleClickFromNewComponentLand(e){x.invokeFirstAction(e)}static invokeFirstAction(e){const n=x.linkActions(e);return!!n.length&&(n[0].handler.call(null),e.userMetric&&t.userMetrics.actionTaken(e.userMetric),!0)}static linkHandlerSetting(){return y||(y=e.Settings.Settings.instance().createSetting("openLinkHandler",f(k.auto))),y}static registerLinkHandler(e,t){I.set(e,t),F.instance().update()}static unregisterLinkHandler(e){I.delete(e),F.instance().update()}static uiLocation(e){const t=x.linkInfo(e);return t?t.uiLocation:null}static linkActions(n){const o=[];if(!n)return o;let c=i.DevToolsPath.EmptyUrlString,d=null;if(n.uiLocation)d=n.uiLocation,c=d.uiSourceCode.contentURL();else if(n.url){c=n.url;const t=l.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(c)||l.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.ParsedURL.ParsedURL.urlWithoutHash(c));d=t?t.uiLocation(n.lineNumber||0,n.columnNumber||0):null}const u=c?r.ResourceUtils.resourceForURL(c):null,p=d?d.uiSourceCode:u,g=n.revealable||d||u;if(g){const n=e.Revealer.revealDestination(g);o.push({section:"reveal",title:n?f(k.revealInS,{PH1:n}):f(k.reveal),handler:()=>(g instanceof s.BreakpointManager.BreakpointLocation&&t.userMetrics.breakpointEditDialogRevealedFrom(5),e.Revealer.reveal(g))})}if(p){const e=d?d.lineNumber:n.lineNumber||0;for(const t of I.keys()){const n=I.get(t);if(!n)continue;const i={section:"reveal",title:f(k.openUsingS,{PH1:t}),handler:n.bind(null,p,e)};t===x.linkHandlerSetting().get()?o.unshift(i):o.push(i)}}if((u||n.url)&&(o.push({section:"reveal",title:a.UIUtils.openLinkExternallyLabel(),handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(c)}),o.push({section:"clipboard",title:a.UIUtils.copyLinkAddressLabel(),handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(c)})),d&&d.uiSourceCode){const e=d.uiSourceCode;o.push({section:"clipboard",title:a.UIUtils.copyFileNameLabel(),handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.displayName())})}return o}}var T;let U,N;!function(e){let t;!function(e){e.LinkIconChanged="LinkIconChanged"}(t=e.Events||(e.Events={}))}(T||(T={}));class D{static instance(e={forceNew:null}){const{forceNew:t}=e;return U&&!t||(U=new D),U}appendApplicableItems(e,t,n){let i=n;for(;i&&!v.get(i);)i=i.parentNodeOrShadowHost();const o=i,r=x.linkInfo(o);if(!r)return;const a=x.linkActions(r);for(const e of a)t.section(e.section).appendItem(e.title,e.handler)}}class F{element;constructor(){this.element=document.createElement("select"),this.element.classList.add("chrome-select"),this.element.addEventListener("change",this.onChange.bind(this),!1),this.update()}static instance(e={forceNew:null}){const{forceNew:t}=e;return N&&!t||(N=new F),N}update(){this.element.removeChildren();const e=[...I.keys()];e.unshift(f(k.auto));for(const t of e){const e=document.createElement("option");e.textContent=t,e.selected=t===x.linkHandlerSetting().get(),this.element.appendChild(e)}this.element.disabled=e.length<=1}onChange(e){if(!e.target)return;const t=e.target.value;x.linkHandlerSetting().set(t)}settingElement(){return a.SettingsUI.createCustomSetting(f(k.linkHandling),this.element)}}let R,M=!1;M||(M=!0,window.addEventListener("linkifieractivated",(function(e){const t=e;x.handleClickFromNewComponentLand(t.data)})));class H{static instance(e={forceNew:null}){const{forceNew:t}=e;return R&&!t||(R=new H),R}appendApplicableItems(n,i,r){const s=r,c=s.contentURL();if(c){c.startsWith("file://")||i.revealSection().appendItem(a.UIUtils.openLinkExternallyLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(c.endsWith(":formatted")?e.ParsedURL.ParsedURL.slice(c,0,c.lastIndexOf(":")):c)));for(const e of I.keys()){const t=I.get(e);t&&i.revealSection().appendItem(f(k.openUsingS,{PH1:e}),t.bind(null,s,0))}s instanceof o.NetworkRequest.NetworkRequest||(i.clipboardSection().appendItem(a.UIUtils.copyLinkAddressLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(c))),i.clipboardSection().appendItem(a.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(s.displayName()))))}}}var B=Object.freeze({__proto__:null,Linkifier:x,get LinkDecorator(){return T},LinkContextMenuProvider:D,LinkHandlerSettingUI:F,ContentProviderContextMenuProvider:H});const A=new CSSStyleSheet;A.replaceSync(":host{display:inline}.stack-preview-async-description{padding:3px 0 1px;font-style:italic}.stack-preview-container .ignore-list-link{opacity:60%}.stack-preview-container > tr{height:16px;line-height:16px}.stack-preview-container td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-inline:2px}.stack-preview-container .function-name{max-width:80em}.stack-preview-container:not(.show-hidden-rows) > tr.hidden-row{display:none}.stack-preview-container > tr.show-all-link,\n.stack-preview-container > tr.show-less-link{font-style:italic}.stack-preview-container.show-hidden-rows > tr.show-all-link{display:none}.stack-preview-container:not(.show-hidden-rows) > tr.show-less-link{display:none}\n/*# sourceURL=jsUtils.css */\n");const P={removeFromIgnore:"Remove from ignore list",addToIgnore:"Add script to ignore list",showSMoreFrames:"{n, plural, =1 {Show # more frame} other {Show # more frames}}",showLess:"Show less",unknownSource:"unknown"},E=n.i18n.registerUIStrings("ui/legacy/components/utils/JSPresentationUtils.ts",P),W=n.i18n.getLocalizedString.bind(void 0,E);function _(e,t){const n=new a.ContextMenu.ContextMenu(t);t.consume(!0);const i=x.uiLocation(e);i&&r.IgnoreListManager.IgnoreListManager.instance().canIgnoreListUISourceCode(i.uiSourceCode)&&(r.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(i.uiSourceCode.url())?n.debugSection().appendItem(W(P.removeFromIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().unIgnoreListUISourceCode(i.uiSourceCode))):n.debugSection().appendItem(W(P.addToIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().ignoreListUISourceCode(i.uiSourceCode)))),n.appendApplicableItems(t),n.show()}function z(t,n,i,s,c){const l=[];if(c){const t=new e.Throttler.Throttler(100);i.setLiveLocationUpdateCallback((()=>t.schedule((async()=>function(e,t){let n=0,i=t.length;for(let e=t.length-1;e>=0;e--){const o=t[e];if("link"in o&&o.link){const e=x.uiLocation(o.link);e&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(e.uiSourceCode)&&(o.ignoreListHide=!0),o.ignoreListHide&&n++}"asyncDescription"in o&&(n>0&&n===i-e-1&&(o.ignoreListHide=!0),i=e,n=0)}e(t)}(c,l)))))}function d(e,t){let c=null;t&&(c={asyncDescription:a.UIUtils.asyncStackTraceLabel(e.description,t),ignoreListHide:!1},l.push(c));let d=0,u=!1;for(const t of e.callFrames){let e=!1;const c=a.UIUtils.beautifyFunctionName(t.functionName),p=i.maybeLinkifyConsoleCallFrame(n,t,{tabStop:Boolean(s),inlineFrameIndex:0,revealBreakpoint:u});if(p){p.addEventListener("contextmenu",_.bind(null,p));const t=x.uiLocation(p);t&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(t.uiSourceCode)&&(e=!0),p.textContent||(p.textContent=W(P.unknownSource))}e&&++d,l.push({functionName:c,link:p,ignoreListHide:e}),u=[o.DebuggerModel.COND_BREAKPOINT_SOURCE_URL,o.DebuggerModel.LOGPOINT_SOURCE_URL].includes(t.url)}c&&d>0&&d===e.callFrames.length&&(c.ignoreListHide=!0)}d(t);let u=t.callFrames;for(let e=t.parent;e;e=e.parent)e.callFrames.length&&d(e,u),u=e.callFrames;return l}function j(e,t){e.removeChildren();let n=0;const i=[];for(const o of t){const t=e.createChild("tr");"asyncDescription"in o?(t.createChild("td").textContent="\n",t.createChild("td","stack-preview-async-description").textContent=o.asyncDescription,t.createChild("td"),t.createChild("td")):(t.createChild("td").textContent="\n",t.createChild("td","function-name").textContent=o.functionName,t.createChild("td").textContent=" @ ",o.link&&(t.createChild("td").appendChild(o.link),i.push(o.link)),o.ignoreListHide&&++n),o.ignoreListHide&&t.classList.add("hidden-row"),e.appendChild(t)}if(n){const t=e.createChild("tr","show-all-link");t.createChild("td").textContent="\n";const i=t.createChild("td");i.colSpan=4;const o=i.createChild("span","link");o.textContent=W(P.showSMoreFrames,{n:n}),o.addEventListener("click",(()=>{e.classList.add("show-hidden-rows")}),!1);const r=e.createChild("tr","show-less-link");r.createChild("td").textContent="\n";const a=r.createChild("td");a.colSpan=4;const s=a.createChild("span","link");s.textContent=W(P.showLess),s.addEventListener("click",(()=>{e.classList.remove("show-hidden-rows")}),!1)}return i}var O=Object.freeze({__proto__:null,buildStackTraceRows:z,buildStackTracePreviewContents:function(e,t,n={stackTrace:void 0,tabStops:void 0}){const{stackTrace:i,tabStops:o}=n,r=document.createElement("span");r.classList.add("monospace"),r.style.display="inline-block";const s=a.Utils.createShadowRootWithCoreStyles(r,{cssFile:[A],delegatesFocus:void 0}).createChild("table","stack-preview-container");if(!i)return{element:r,links:[]};const c=j.bind(null,s);return{element:r,links:j(s,z(i,e,t,o,c))}}});var K=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"},q=n.i18n.registerUIStrings("ui/legacy/components/utils/TargetDetachedDialog.ts",$),J=n.i18n.getLocalizedString.bind(void 0,q);class G extends o.SDKModel.SDKModel{static hideCrashedDialog;constructor(e){super(e),e.registerInspectorDispatcher(this),e.inspectorAgent().invoke_enable(),e.parentTarget()?.type()===o.Target.Type.Browser&&G.hideCrashedDialog&&(G.hideCrashedDialog.call(null),G.hideCrashedDialog=null)}detached({reason:e}){a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(e)}static webSocketConnectionLost(){a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(J($.websocketDisconnected))}targetCrashed(){if(G.hideCrashedDialog)return;const e=this.target().parentTarget();if(e&&e.type()!==o.Target.Type.Browser)return;const t=new a.Dialog.Dialog;t.setSizeBehavior("MeasureContent"),t.addCloseButton(),t.setDimmed(!0),G.hideCrashedDialog=t.hide.bind(t),new a.TargetCrashedScreen.TargetCrashedScreen((()=>{G.hideCrashedDialog=null})).show(t.contentElement),t.show()}targetReloadedAfterCrash(){this.target().runtimeAgent().invoke_runIfWaitingForDebugger(),G.hideCrashedDialog&&(G.hideCrashedDialog.call(null),G.hideCrashedDialog=null)}}o.SDKModel.SDKModel.register(G,{capabilities:o.Target.Capability.Inspector,autostart:!0});var V=Object.freeze({__proto__:null,TargetDetachedDialog:G});export{h as ImagePreview,O as JSPresentationUtils,B as Linkifier,K as Reload,V 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 i from"../../../../core/platform/platform.js";import*as o 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";const u=new CSSStyleSheet;u.replaceSync(".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-preview-container .row{line-height:1.2;vertical-align:baseline}.image-preview-container .title{padding-right:0.5em;text-align:right;color:var(--sys-color-token-subtle);white-space:nowrap}.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=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),m=n.i18n.getLocalizedString.bind(void 0,g);function h(t){return null!==t&&t.resourceType()===e.ResourceType.resourceTypes.Image}var k=Object.freeze({__proto__:null,ImagePreview:class{static async build(e,n,r,s={precomputedFeatures:void 0,imageAltText:void 0}){const{precomputedFeatures:a,imageAltText:c}=s,l=e.model(o.ResourceTreeModel.ResourceTreeModel);if(!l)return null;let d=l.resourceForURL(n),g=n;if(!h(d)&&a&&a.currentSrc&&(g=a.currentSrc,d=l.resourceForURL(g)),!d||!h(d))return null;const k=d,L=d.displayName,C=d.content?d.content:d.url.split("base64,")[1],b=d.contentSize(),f=b||i.StringUtilities.base64ToSize(C),w=f>0?i.NumberUtilities.bytesToString(f):"";return new Promise((e=>{const n=document.createElement("img");n.addEventListener("load",(function(){const o=document.createElement("div"),s=o.attachShadow({mode:"open"});s.adoptedStyleSheets=[u];const c=s.createChild("table");c.className="image-preview-container";const l=c.createChild("tr").createChild("td","image-container");l.colSpan=2;const d=l.createChild("div");d.title=L,d.appendChild(n),d.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(g)}));const h=n.naturalWidth,k=n.naturalHeight,C=a?a.renderedWidth:h,b=a?a.renderedHeight:k;if(r){const e=c.createChild("tr","row");e.createChild("td","title").textContent=m(p.renderedSize),e.createChild("td","description").textContent=`${C} × ${b} px`;const t=c.createChild("tr","row");if(t.createChild("td","title").textContent=m(p.renderedAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(C,b),b!==k||C!==h){const e=c.createChild("tr","row");e.createChild("td","title").textContent=m(p.intrinsicSize),e.createChild("td","description").textContent=`${h} × ${k} px`;const t=c.createChild("tr","row");t.createChild("td","title").textContent=m(p.intrinsicAspectRatio),t.createChild("td","description").textContent=i.NumberUtilities.aspectRatio(h,k)}}const f=c.createChild("tr","row");f.createChild("td","title").textContent=m(p.fileSize),f.createChild("td","description").textContent=w;const v=c.createChild("tr","row");v.createChild("td","title").textContent=m(p.currentSource);const I=i.StringUtilities.trimMiddle(g,100),S=v.createChild("td","description description-link").createChild("span","source-link");S.textContent=I,S.addEventListener("click",(()=>{t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(g)})),e(o)}),!1),n.addEventListener("error",(()=>e(null)),!1),c&&(n.alt=c),k.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),i=n.isValid?n.displayName:m(p.unknownSource);return m(p.imageFromS,{PH1:i})}}});const L=new CSSStyleSheet;L.replaceSync(":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.width-constrained{display:block;width:100%}.stack-preview-container .ignore-list-link{opacity:60%}.stack-preview-container > tr{height:16px;line-height:16px}.stack-preview-container td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-inline:2px}.stack-preview-container.width-constrained td.link{width:100%;max-width:0}.stack-preview-container .function-name{max-width:80em}.stack-preview-container:not(.show-hidden-rows) > tr.hidden-row{display:none}.stack-preview-container > tr.show-all-link,\n.stack-preview-container > tr.show-less-link{font-style:italic}.stack-preview-container.show-hidden-rows > tr.show-all-link{display:none}.stack-preview-container:not(.show-hidden-rows) > tr.show-less-link{display:none}\n/*# sourceURL=jsUtils.css */\n");const C={unknown:"(unknown)",auto:"auto",revealInS:"Reveal in {PH1}",reveal:"Reveal",openUsingS:"Open using {PH1}",linkHandling:"Link handling:"},b=n.i18n.registerUIStrings("ui/legacy/components/utils/Linkifier.ts",C),f=n.i18n.getLocalizedString.bind(void 0,b),w=new Set;let v=null;const I=new WeakMap,S=new WeakMap,x=new WeakMap,y=new Map;let T,U;class N extends e.ObjectWrapper.ObjectWrapper{maxLength;anchorsByTarget;locationPoolByTarget;useLinkDecorator;constructor(e,t){super(),this.maxLength=e||a.UIUtils.MaxLengthForDisplayedURLs,this.anchorsByTarget=new Map,this.locationPoolByTarget=new Map,this.useLinkDecorator=Boolean(t),w.add(this),o.TargetManager.TargetManager.instance().observeTargets(this)}static setLinkDecorator(e){console.assert(!v,"Cannot re-register link decorator."),v=e,e.addEventListener("LinkIconChanged",(function(e){const t=e.data,n=I.get(t)||[];for(const e of n)N.updateLinkDecorations(e)}));for(const e of w)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 i=t.uiSourceCode;let o=I.get(i);o||(o=new Set,I.set(i,o)),o.add(e)}static unbindUILocation(e){const t=N.linkInfo(e);if(!t||!t.uiLocation)return;const n=t.uiLocation.uiSourceCode;t.uiLocation=null;const i=I.get(n);i&&i.delete(e)}static bindBreakpoint(e,t){const n=N.linkInfo(e);if(!n)return;const i=c.BreakpointManager.BreakpointManager.instance().findBreakpoint(t);i&&(n.revealable=i)}static unbindBreakpoint(e){const t=N.linkInfo(e);t&&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,i,s){let a=null;const c={lineNumber:i,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"},{columnNumber:l,className:d=""}=c;if(n&&(a=N.linkifyURL(n,c)),!e||e.isDisposed())return a;const u=e.model(o.DebuggerModel.DebuggerModel);if(!u)return a;const p=t?u.createRawLocationByScriptId(t,i||0,l,c.inlineFrameIndex):u.createRawLocationByURL(n,i||0,l,c.inlineFrameIndex,!0);if(!p)return a;const g={tabStop:s?.tabStop,jslogContext:"script-location"},{link:m,linkInfo:h}=N.createLink(a&&a.textContent?a.textContent:"",d,g);h.enableDecorator=this.useLinkDecorator,h.fallback=a,h.userMetric=s?.userMetric;const k=this.locationPoolByTarget.get(p.debuggerModel.target());if(!k)return a;const L={showColumnNumber:c.showColumnNumber??!1,revealBreakpoint:s?.revealBreakpoint};r.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().createLiveLocation(p,(async e=>{await this.updateAnchor(m,L,e),this.dispatchEventToListeners("liveLocationUpdated",e)}).bind(this),k).then((e=>{e&&(h.liveLocation=e)}));return this.anchorsByTarget.get(p.debuggerModel.target()).push(m),m}linkifyScriptLocation(e,t,n,i,o){const r=this.maybeLinkifyScriptLocation(e,t,n,i,o),s={lineNumber:i,maxLength:this.maxLength,className:o?.className,columnNumber:o?.columnNumber,showColumnNumber:Boolean(o?.showColumnNumber),inlineFrameIndex:o?.inlineFrameIndex??0,tabStop:o?.tabStop,userMetric:o?.userMetric,jslogContext:o?.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 i={...n,columnNumber:t.columnNumber,inlineFrameIndex:n?.inlineFrameIndex??0};return this.maybeLinkifyScriptLocation(e,String(t.scriptId),t.url,t.lineNumber,i)}linkifyStackTraceTopFrame(e,t){console.assert(t.callFrames.length>0);const{url:n,lineNumber:i,columnNumber:s}=t.callFrames[0],a=N.linkifyURL(n,{lineNumber:i,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(o.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:i}=N.createLink("",t||"",{tabStop:!0,jslogContext:"css-location"});i.enableDecorator=this.useLinkDecorator;const o=this.locationPoolByTarget.get(e.cssModel().target());if(!o)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),o).then((e=>{i.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(){for(const e of[...this.anchorsByTarget.keys()])this.targetRemoved(e);o.TargetManager.TargetManager.instance().unobserveTargets(this),w.delete(this)}async updateAnchor(t,n,i){N.unbindUILocation(t),n.revealBreakpoint&&N.unbindBreakpoint(t);const o=await i.uiLocation();if(!o){if(i instanceof r.CSSWorkspaceBinding.LiveLocation){const n=i.header();n&&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,o),n.revealBreakpoint&&N.bindBreakpoint(t,o);const s=o.linkText(!0,n.showColumnNumber);N.setTrimmedText(t,s,this.maxLength);let c=o.uiSourceCode.url();"application/wasm"===o.uiSourceCode.mimeType()?"number"==typeof o.columnNumber&&(c+=`:0x${o.columnNumber.toString(16)}`):(c+=":"+(o.lineNumber+1),n.showColumnNumber&&"number"==typeof o.columnNumber&&(c+=":"+(o.columnNumber+1))),a.Tooltip.Tooltip.install(t,c),t.classList.toggle("ignore-list-link",await i.isIgnoreListed()),N.updateLinkDecorations(t)}static updateLinkDecorations(e){const t=N.linkInfo(e);if(!t||!t.enableDecorator)return;if(!v||!t.uiLocation)return;t.icon&&t.icon.parentElement&&e.removeChild(t.icon);const n=v.linkIcon(t.uiLocation.uiSourceCode);n&&(n.style.setProperty("margin-right","2px"),e.insertBefore(n,e.firstChild)),t.icon=n}static linkifyURL(t,n){const i=(n=n||{showColumnNumber:!1,inlineFrameIndex:0}).text,o=n.className||"",s=n.lineNumber,c=n.columnNumber,l=n.showColumnNumber,d=n.preventClick,u=n.maxLength||a.UIUtils.MaxLengthForDisplayedURLs,p=n.bypassURLTrimming;if(!t||e.ParsedURL.schemeIs(t,"javascript:")){const e=document.createElement("span");return o&&(e.className=o),e.textContent=i||t||f(C.unknown),e}let g=i||r.ResourceUtils.displayNameForURL(t);"number"!=typeof s||i||(g+=":"+(s+1),l&&"number"==typeof c&&(g+=":"+(c+1)));const m={maxLength:u,title:g!==t?t:"",href:t,preventClick:d,tabStop:n.tabStop,bypassURLTrimming:p,jslogContext:n.jslogContext||"url"},{link:h,linkInfo:k}=N.createLink(g,o,m);return s&&(k.lineNumber=s),c&&(k.columnNumber=c),k.userMetric=n?.userMetric,h}static linkifyRevealable(e,t,n,i,o,r){const s={maxLength:a.UIUtils.MaxLengthForDisplayedURLs,href:n,title:i,jslogContext:r},{link:c,linkInfo:l}=N.createLink(t,o||"",s);return l.revealable=e,c}static createLink(e,t,n={}){const{maxLength:i,title:o,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"),o&&a.Tooltip.Tooltip.install(p,o),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,i);const g={icon:null,enableDecorator:!1,uiLocation:null,liveLocation:null,url:r||null,lineNumber:null,columnNumber:null,inlineFrameIndex:0,revealable:null,fallback:null};return S.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 i=function(e,t){let n=Math.floor(t/2),i=e.length-Math.ceil(t/2)+1;const o=e.codePointAt(i-1);void 0!==o&&o>=65536&&(i++,n++);const r=e.codePointAt(n-1);void 0!==r&&n>0&&r>=65536&&n--;return[e.substring(0,n),e.substring(n,i),e.substring(i)]}(t,n);N.appendTextWithoutHashes(e,i[0]),N.appendHiddenText(e,i[1]),N.appendTextWithoutHashes(e,i[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&&S.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(C.auto))),T}static registerLinkHandler(e,t){y.set(e,t),F.instance().update()}static unregisterLinkHandler(e){y.delete(e),F.instance().update()}static uiLocation(e){const t=N.linkInfo(e);return t?t.uiLocation:null}static linkActions(n){const o=[];if(!n)return o;let s=i.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);o.push({section:"reveal",title:t?f(C.revealInS,{PH1:t}):f(C.reveal),jslogContext:"reveal",handler:()=>e.Revealer.reveal(p)})}if(u){const e=c?c.lineNumber:n.lineNumber||0;for(const t of y.keys()){const n=y.get(t);if(!n)continue;const i={section:"reveal",title:f(C.openUsingS,{PH1:t}),jslogContext:"open-using",handler:n.bind(null,u,e)};t===N.linkHandlerSetting().get()?o.unshift(i):o.push(i)}}if((l||n.url)&&(o.push({section:"reveal",title:a.UIUtils.openLinkExternallyLabel(),jslogContext:"open-in-new-tab",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(s)}),o.push({section:"clipboard",title:a.UIUtils.copyLinkAddressLabel(),jslogContext:"copy-link-address",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(s)})),c&&c.uiSourceCode){const e=c.uiSourceCode;o.push({section:"clipboard",title:a.UIUtils.copyFileNameLabel(),jslogContext:"copy-file-name",handler:()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(e.displayName())})}return o}}class F{element;constructor(){this.element=document.createElement("select"),this.element.classList.add("chrome-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 F),U}update(){this.element.removeChildren();const e=[...y.keys()];e.unshift(f(C.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(C.linkHandling),this.element)}}let D=!1;D||(D=!0,window.addEventListener("linkifieractivated",(function(e){const t=e;N.handleClickFromNewComponentLand(t.data)})));var R=Object.freeze({__proto__:null,Linkifier:N,LinkContextMenuProvider:class{appendApplicableItems(e,t,n){let i=n;for(;i&&!S.get(i);)i=i.parentNodeOrShadowHost();const o=i,r=N.linkInfo(o);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:F,ContentProviderContextMenuProvider:class{appendApplicableItems(n,i,r){const s=r.contentURL();if(s){e.ParsedURL.schemeIs(s,"file:")||i.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 y.keys()){const t=y.get(e);t&&i.revealSection().appendItem(f(C.openUsingS,{PH1:e}),t.bind(null,r,0),{jslogContext:"open-using"})}r instanceof o.NetworkRequest.NetworkRequest||(i.clipboardSection().appendItem(a.UIUtils.copyLinkAddressLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(s)),{jslogContext:"copy-link-address"}),r instanceof d.UISourceCode.UISourceCode?i.clipboardSection().appendItem(a.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName())),{jslogContext:"copy-file-name"}):i.clipboardSection().appendItem(a.UIUtils.copyFileNameLabel(),(()=>t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(r.displayName)),{jslogContext:"copy-file-name"}))}}}});const M={removeFromIgnore:"Remove from ignore list",addToIgnore:"Add script to ignore list",showSMoreFrames:"{n, plural, =1 {Show # more frame} other {Show # more frames}}",showLess:"Show less",unknownSource:"unknown"},H=n.i18n.registerUIStrings("ui/legacy/components/utils/JSPresentationUtils.ts",M),B=n.i18n.getLocalizedString.bind(void 0,H);function j(e,t){const n=new a.ContextMenu.ContextMenu(t);t.consume(!0);const i=N.uiLocation(e);i&&r.IgnoreListManager.IgnoreListManager.instance().canIgnoreListUISourceCode(i.uiSourceCode)&&(r.IgnoreListManager.IgnoreListManager.instance().isUserIgnoreListedURL(i.uiSourceCode.url())?n.debugSection().appendItem(B(M.removeFromIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().unIgnoreListUISourceCode(i.uiSourceCode)),{jslogContext:"remove-from-ignore-list"}):n.debugSection().appendItem(B(M.addToIgnore),(()=>r.IgnoreListManager.IgnoreListManager.instance().ignoreListUISourceCode(i.uiSourceCode)),{jslogContext:"add-to-ignore-list"})),n.appendApplicableItems(t),n.show()}function P(t,n,i,c,l,d){const u=[];if(l){const t=new e.Throttler.Throttler(100);i.addEventListener("liveLocationUpdated",(()=>{t.schedule((async()=>function(e,t){let n=0,i=t.length;for(let e=t.length-1;e>=0;e--){const o=t[e];if("link"in o&&o.link){const e=N.uiLocation(o.link);e&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(e.uiSourceCode)&&(o.ignoreListHide=!0),o.ignoreListHide&&n++}"asyncDescription"in o&&(n>0&&n===i-e-1&&(o.ignoreListHide=!0),i=e,n=0)}e(t)}(l,u)))}))}function p(e,t=void 0){let l=null;t&&(l={asyncDescription:a.UIUtils.asyncStackTraceLabel(e.description,t),ignoreListHide:!1},u.push(l));let p=0,g=!1;for(const t of e.callFrames){let e=!1;const l=a.UIUtils.beautifyFunctionName(t.functionName),m=i.maybeLinkifyConsoleCallFrame(n,t,{showColumnNumber:d,tabStop:Boolean(c),inlineFrameIndex:0,revealBreakpoint:g});if(m){m.setAttribute("jslog",`${s.link("stack-trace").track({click:!0})}`),m.addEventListener("contextmenu",j.bind(null,m));const t=N.uiLocation(m);t&&r.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(t.uiSourceCode)&&(e=!0),m.textContent||(m.textContent=B(M.unknownSource))}e&&++p,u.push({functionName:l,link:m,ignoreListHide:e}),g=[o.DebuggerModel.COND_BREAKPOINT_SOURCE_URL,o.DebuggerModel.LOGPOINT_SOURCE_URL].includes(t.url)}l&&p>0&&p===e.callFrames.length&&(l.ignoreListHide=!0)}p(t);let g=t.callFrames;for(let e=t.parent;e;e=e.parent)e.callFrames.length&&p(e,g),g=e.callFrames;return u}function A(e,t){e.removeChildren();let n=0;const i=[];for(const o of t){const t=e.createChild("tr");"asyncDescription"in o?(t.createChild("td").textContent="\n",t.createChild("td","stack-preview-async-description").textContent=o.asyncDescription,t.createChild("td"),t.createChild("td")):(t.createChild("td").textContent="\n",t.createChild("td","function-name").textContent=o.functionName,t.createChild("td").textContent=" @ ",o.link&&(t.createChild("td","link").appendChild(o.link),i.push(o.link)),o.ignoreListHide&&++n),o.ignoreListHide&&t.classList.add("hidden-row"),e.appendChild(t)}if(n){const t=e.createChild("tr","show-all-link");t.createChild("td").textContent="\n";const i=t.createChild("td");i.colSpan=4;const o=i.createChild("span","link");o.textContent=B(M.showSMoreFrames,{n:n}),o.addEventListener("click",(()=>{e.classList.add("show-hidden-rows"),a.GlassPane.GlassPane.containerMoved(e)}),!1);const r=e.createChild("tr","show-less-link");r.createChild("td").textContent="\n";const s=r.createChild("td");s.colSpan=4;const c=s.createChild("span","link");c.textContent=B(M.showLess),c.addEventListener("click",(()=>{e.classList.remove("show-hidden-rows"),a.GlassPane.GlassPane.containerMoved(e)}),!1)}return i}var E=Object.freeze({__proto__:null,buildStackTraceRows:P,buildStackTracePreviewContents:function(e,t,n={widthConstrained:!1,stackTrace:void 0,tabStops:void 0}){const{stackTrace:i,tabStops:o}=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:[L],delegatesFocus:void 0}).createChild("table","stack-preview-container");if(s.classList.toggle("width-constrained",n.widthConstrained),!i)return{element:r,links:[]};const c=A.bind(null,s);return{element:r,links:A(s,P(i,e,t,o,c,n.showColumnNumber))}}});var _=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 W={websocketDisconnected:"WebSocket disconnected"},z=n.i18n.registerUIStrings("ui/legacy/components/utils/TargetDetachedDialog.ts",W),O=n.i18n.getLocalizedString.bind(void 0,z);class $ extends o.SDKModel.SDKModel{static hideCrashedDialog;constructor(e){super(e),e.registerInspectorDispatcher(this),e.inspectorAgent().invoke_enable(),e.parentTarget()?.type()===o.Target.Type.Browser&&$.hideCrashedDialog&&($.hideCrashedDialog.call(null),$.hideCrashedDialog=null)}detached({reason:e}){a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(e)}static webSocketConnectionLost(){a.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(O(W.websocketDisconnected))}targetCrashed(){if($.hideCrashedDialog)return;const e=this.target().parentTarget();if(e&&e.type()!==o.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)}}o.SDKModel.SDKModel.register($,{capabilities:2048,autostart:!0});var G=Object.freeze({__proto__:null,TargetDetachedDialog:$});export{k as ImagePreview,E as JSPresentationUtils,R as Linkifier,_ 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.

ReactNativeFeatureFlags.override({
${Object.entries(featureFlags)
.map(([name, value]) => ` ${name}: () => ${JSON.stringify(value)},`)

Check warning

Code scanning / CodeQL

Improper code sanitization Medium

Code construction depends on an
improperly sanitized value
.
Saadnajmi and others added 7 commits April 8, 2025 14:07
…aRequestHandler invalidate]" (#2450)

Cherry pick facebook#50342 , which
fixes a bug with our fix from #2383

I chose to omit the macOS tags as this is a cherry-pick.

Co-authored-by: zhongwuzw <zhongwuzw@qq.com>
… called (#2448)

## Summary:

We've had a recurring bug where `RCTDevLoadingView` stick around
blocking the whole app even after it's dismissed. As far as I can tell,
this is a race condition where we have multiple devloadingviews at once
(each setting and nilling the same `self->_window` property), which is
causing a race condition. Rather than figure out how to make this class
only ever show one window or race-safe, for now I will just make sure to
dismiss _all_ sheets when `hide` is called.

While we're at it, a couple of other changes:
1. Change the type from `NSPanel` to `NSWindow`. Panels don't release
when closed, which may be causing them to stick around longer than we
like
2. Move the iOS only variable `mainWindow` into the iOS ifdef, and
remove the diffs and diff tag around it.

## Test Plan:

Initial testing shows RNTester no longer getting blocked. It could still
happen (race conditions are hard), but I think the change is safe to add
regardless.
## Summary:

Update to the latest version of Yarn, which notably includes a fix from
@dannyvv 🎉

## Test Plan:

CI should pass
…2461)

## Summary:

`typingAttributes` was added in a recent React Native release, but not
brought to `RCTUITextField` (where we have to port some iOS only props
to macOS). This caused an `unrecognized selector` style crash when
trying to set `typingAttributes`.

## Test Plan:

Booting RNTester-macOS with the new architecture no longer crashes,
[These two
functions](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInputState.js#L60C1-L70C2)
are used to [properly handle onFocus\onBlur for TextInput
implementations](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInput.js#L1623C1-L1635C5),
specifically they are used to track the currently focused TextInput
control and as such cause
[focusTextInput](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInputState.js#L106C1-L106C48)
and
[blurTextInput](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInputState.js#L143C1-L143C69)
to skip native focus\blur calls if the JS side thinks the control in
question is already focused\blurred.

In other words, if someone wants to build a custom `<TextInput>` from
the ground up, they can't expect `focusTextInput`, `blurTextInput`, and
`currentlyFocusedInput` (the last one which is especially already used
in a bunch of places in the framework) to work properly. This change
exports the necessary `focusInput` and `blurInput` out of
[TextInput](https://github.com/microsoft/react-native-macos/blob/9ea059c33143e6766582a1f682e4f144e00cc740/packages/react-native/Libraries/Components/TextInput/TextInput.js#L2041C1-L2048C3)
statics.
…build failure (#2469)

> ## Summary:
> Fix Release build failure #2449
> Fix TextInput onBlur is invalid #2319
> ## Test Plan:
> Run react-native-macos-init and check that the created project builds
and run.
## Summary:

This reverts commit 791012b.

We had some custom logic to update the lock file after the "version"
step of release happened. Turns out you can just do that directly
through `nx`... so let's remove the logic and do it that was instead.

## Test Plan:

Ran `nx release --skip-publish` locally (and cmd+c'ed it before it
committed anything...) to see if the lock would update with the new
versions and it did.
@Saadnajmi Saadnajmi closed this Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.