@xenon-device-management/xenon 2.13.2 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -8
- package/lib/package.json +5 -5
- package/lib/public/assets/{AnnotationOverlay-BXruClDk.js → AnnotationOverlay-Btq3dZRI.js} +1 -1
- package/lib/public/assets/{ApiKeyGate-qTS4LPLC.js → ApiKeyGate-C9OoAgg_.js} +1 -1
- package/lib/public/assets/DeviceMosaicView-DBC_xczB.js +2 -0
- package/lib/public/assets/{EmptyState-Cr17PdDv.js → EmptyState-DqWU2-vM.js} +1 -1
- package/lib/public/assets/{FieldGroup-Bvn08svv.js → FieldGroup-CveQ3xrA.js} +1 -1
- package/lib/public/assets/{FilterMenu-DDSO8aDf.js → FilterMenu-BfKDSfHz.js} +1 -1
- package/lib/public/assets/{Menu-B-Qn2X3T.js → Menu-CtdCybzA.js} +1 -1
- package/lib/public/assets/{Modal-Cg9V5JYU.js → Modal-Bsvj1tm2.js} +1 -1
- package/lib/public/assets/{RecordingPage-BTUs9VTW.js → RecordingPage-CRofOiyx.js} +1 -1
- package/lib/public/assets/{RecordingsPage-DYcfxITK.js → RecordingsPage-jNQHb2IR.js} +2 -2
- package/lib/public/assets/{SegmentedControl-Zy7suhT5.js → SegmentedControl-C8HtTha-.js} +1 -1
- package/lib/public/assets/{SettingCard-CWYmycoe.js → SettingCard-D8K1LZNo.js} +1 -1
- package/lib/public/assets/{Table-io9fwa98.js → Table-zNTX92Pn.js} +1 -1
- package/lib/public/assets/{activity-Bdf_uIWl.js → activity-CJ8LwZq9.js} +1 -1
- package/lib/public/assets/ai-settings-CgxQZqrc.js +16 -0
- package/lib/public/assets/{api-keys-CPqtVpm3.js → api-keys-ECpo-zTo.js} +1 -1
- package/lib/public/assets/{apps-BgZan0H9.js → apps-BjGymyf3.js} +2 -2
- package/lib/public/assets/{arrow-left-B27ckB31.js → arrow-left-BWfCbeHP.js} +1 -1
- package/lib/public/assets/{arrow-right-DOF8ITCz.js → arrow-right-DC7UGf_n.js} +1 -1
- package/lib/public/assets/{arrow-up-right-eFG5KTFS.js → arrow-up-right-BOjwybDk.js} +1 -1
- package/lib/public/assets/{auth-shell-DlC3_27j.js → auth-shell-CxMTo9aH.js} +2 -2
- package/lib/public/assets/{builds-page-BuXpPfKo.js → builds-page-DOCm4HkA.js} +1 -1
- package/lib/public/assets/{button-fIW8owMI.js → button-Cg08-EMT.js} +1 -1
- package/lib/public/assets/{calendar-WNjmrF-a.js → calendar-CA1ikLJs.js} +1 -1
- package/lib/public/assets/{check-BdTh1Sq7.js → check-BMTaH72W.js} +1 -1
- package/lib/public/assets/{chevron-right-B4BKlsqk.js → chevron-right-B2QOv9Nx.js} +1 -1
- package/lib/public/assets/{circle-check-zJU80_EF.js → circle-check-CYXBoUqT.js} +1 -1
- package/lib/public/assets/{circle-x-5Uwquo0h.js → circle-x-DTwnSAnl.js} +1 -1
- package/lib/public/assets/{clock-BtUprDsZ.js → clock-C8_HViQP.js} +1 -1
- package/lib/public/assets/{copy-DGSbZI3u.js → copy-Be7LNMXV.js} +1 -1
- package/lib/public/assets/derive-UnLRp4r3.js +1 -0
- package/lib/public/assets/device-explorer-BOqtfGXz.js +282 -0
- package/lib/public/assets/{download-WG6l7BgD.js → download-B56lwxWP.js} +1 -1
- package/lib/public/assets/forgot-password-CCU6bzLn.js +1 -0
- package/lib/public/assets/h264Stream-C-OtmIuk.js +26 -0
- package/lib/public/assets/index-B9KQ6LsY.js +15 -0
- package/lib/public/assets/{index-DI1fGIyj.js → index-BOxe43p1.js} +5 -5
- package/lib/public/assets/{index-HDQVe1gi.js → index-CfxsUslp.js} +1 -1
- package/lib/public/assets/{input-BjDRKCea.js → input-CZHFjbSg.js} +1 -1
- package/lib/public/assets/{line-chart-C0zdgd0v.js → line-chart-Gl_Dz3X_.js} +1 -1
- package/lib/public/assets/{list-checks-BdW5CjM8.js → list-checks-CCgjeyGY.js} +1 -1
- package/lib/public/assets/{lock-Dy3L4I8E.js → lock-CkOwgDcx.js} +1 -1
- package/lib/public/assets/{login-BHbY9CLG.js → login-D5cc4w7M.js} +1 -1
- package/lib/public/assets/maintenance-settings-t7qr3fvX.js +6 -0
- package/lib/public/assets/{monitor-8xjkeHHi.js → monitor-DEJixKQO.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-CXdKMXQ8.js → mouse-pointer-2-CtOrk4M8.js} +1 -1
- package/lib/public/assets/{network-Cj8JOKON.js → network-Dii9qdvk.js} +1 -1
- package/lib/public/assets/{overview-CTg7F0im.js → overview-rolAACrO.js} +1 -1
- package/lib/public/assets/{page-header--aTyJXq6.js → page-header-COQZxJfR.js} +1 -1
- package/lib/public/assets/{play-B-FodgHV.js → play-DrN1Se_R.js} +1 -1
- package/lib/public/assets/{plus-CsIk10Cq.js → plus-5aq-9uRx.js} +1 -1
- package/lib/public/assets/{profile-page-DkFKkMfl.js → profile-page-6i5kY6kF.js} +1 -1
- package/lib/public/assets/{reset-password-I2-zqLlI.js → reset-password-sp2IBrc7.js} +1 -1
- package/lib/public/assets/runbook-page-DJDjeopU.js +253 -0
- package/lib/public/assets/{select-DvCSv25z.js → select-Bpyn7rWO.js} +1 -1
- package/lib/public/assets/{selector-detail-redirect-BLVfMJs_.js → selector-detail-redirect-BH74vmKv.js} +1 -1
- package/lib/public/assets/{selector-health-page-oqadRokn.js → selector-health-page-Cw_g218H.js} +2 -2
- package/lib/public/assets/session-detail-page-AZJE6XXE.js +4 -0
- package/lib/public/assets/settings-C3uyGhyc.js +6 -0
- package/lib/public/assets/{settings-Dep_3kbA.css → settings-K8UHWMdI.css} +1 -1
- package/lib/public/assets/{stat-tile-DV9Ix-4O.js → stat-tile-xVqAKIlI.js} +1 -1
- package/lib/public/assets/{tablet-6b_SEN2X.js → tablet-BxUScAeO.js} +1 -1
- package/lib/public/assets/{teams-BjZyfuHh.js → teams-B5ljGkY2.js} +1 -1
- package/lib/public/assets/{trash-2-CTZpPSdd.js → trash-2-B701i8sy.js} +1 -1
- package/lib/public/assets/{upload-P3XzwQUb.js → upload-C2gr44RS.js} +1 -1
- package/lib/public/assets/{use-builds-data-1cOCMf-z.js → use-builds-data-NeQOFEoy.js} +1 -1
- package/lib/public/assets/{use-password-reset-mode-DgF9w088.js → use-password-reset-mode-DEzJq5ef.js} +1 -1
- package/lib/public/assets/{users-DMF9Mk5H.js → users-D_vv_yz4.js} +1 -1
- package/lib/public/assets/{users-CiNTKUiz.js → users-MY6eNe6s.js} +1 -1
- package/lib/public/assets/{video-off-CHp1KU_T.js → video-off-OK1lNZQn.js} +1 -1
- package/lib/public/assets/webhook-settings-BU-C9lBf.js +1 -0
- package/lib/public/assets/{zap-DRz0tDq5.js → zap-DO9ry1iz.js} +1 -1
- package/lib/public/index.html +1 -1
- package/lib/schema.json +23 -25
- package/lib/src/XenonCapabilityManager.js +22 -5
- package/lib/src/app/dashboardPluginLink.js +117 -0
- package/lib/src/app/index.js +13 -34
- package/lib/src/app/openapi/control.yaml +73 -20
- package/lib/src/app/openapi/grid.yaml +31 -7
- package/lib/src/app/openapi/identity.yaml +103 -31
- package/lib/src/app/openapi/platform.yaml +165 -39
- package/lib/src/app/openapi/sessions.yaml +10 -3
- package/lib/src/app/routers/apikeys.js +14 -2
- package/lib/src/app/routers/auth.js +29 -5
- package/lib/src/app/routers/control.js +20 -2
- package/lib/src/app/routers/dashboard.js +69 -26
- package/lib/src/app/routers/grid.js +37 -13
- package/lib/src/app/routers/profile.js +21 -0
- package/lib/src/app/routers/streamType.js +7 -2
- package/lib/src/app/routers/users.js +10 -5
- package/lib/src/app/routers/webhook.js +8 -4
- package/lib/src/app/swagger.js +2 -0
- package/lib/src/app/ws/h264StreamWs.js +10 -1
- package/lib/src/config.js +51 -5
- package/lib/src/dashboard/commands.js +185 -141
- package/lib/src/dashboard/event-manager.js +88 -67
- package/lib/src/dashboard/services/failure-analysis-service.js +136 -45
- package/lib/src/dashboard/sessionCommandSummary.js +39 -0
- package/lib/src/data-service/appleFamily.js +43 -0
- package/lib/src/data-service/db.js +11 -0
- package/lib/src/data-service/device-service.js +6 -1
- package/lib/src/data-service/device-store.js +76 -3
- package/lib/src/data-service/deviceClaims.js +37 -0
- package/lib/src/data-service/deviceFieldOwners.js +25 -11
- package/lib/src/data-service/deviceSettings.js +79 -0
- package/lib/src/data-service/prisma-store.js +169 -15
- package/lib/src/data-service/web-config-service.js +50 -92
- package/lib/src/device-managers/AndroidDeviceManager.js +9 -31
- package/lib/src/device-managers/android/AndroidH264StreamService.js +69 -20
- package/lib/src/device-managers/android/H264Multiplexer.js +38 -4
- package/lib/src/device-managers/ios/WDAClient.js +44 -43
- package/lib/src/device-managers/shellCommands.js +96 -0
- package/lib/src/device-utils.js +114 -40
- package/lib/src/gateway/defaultGateway.js +1 -1
- package/lib/src/gateway/forwardToNode.js +2 -0
- package/lib/src/gateway/healReport.js +87 -0
- package/lib/src/gateway/sessionGateway.js +12 -2
- package/lib/src/generated/client/edge.js +18 -3
- package/lib/src/generated/client/index-browser.js +15 -0
- package/lib/src/generated/client/index.d.ts +2086 -379
- package/lib/src/generated/client/index.js +18 -3
- package/lib/src/generated/client/package.json +1 -1
- package/lib/src/generated/client/schema.prisma +38 -7
- package/lib/src/generated/client/wasm.js +15 -0
- package/lib/src/interceptors/CommandInterceptor.js +271 -188
- package/lib/src/interceptors/xenonScripts.js +55 -0
- package/lib/src/interfaces/IPluginArgs.js +1 -2
- package/lib/src/middleware/authMiddleware.js +15 -3
- package/lib/src/middleware/commandCaller.js +3 -3
- package/lib/src/middleware/verifyCredential.js +58 -1
- package/lib/src/plugin.js +23 -4
- package/lib/src/prisma.js +1 -1
- package/lib/src/scripts/database-check.js +124 -0
- package/lib/src/services/AICommandService.js +9 -2
- package/lib/src/services/AIService.js +281 -32
- package/lib/src/services/CleanupService.js +6 -1
- package/lib/src/services/EmailService.js +29 -0
- package/lib/src/services/InterceptorService.js +70 -13
- package/lib/src/services/NetworkConditioningService.js +85 -88
- package/lib/src/services/NotificationService.js +36 -29
- package/lib/src/services/OrphanSweeper.js +7 -0
- package/lib/src/services/PortAllocator.js +5 -0
- package/lib/src/services/SelectorVerificationJob.js +15 -4
- package/lib/src/services/ServerManager.js +105 -9
- package/lib/src/services/SessionLifecycleService.js +133 -75
- package/lib/src/services/ShutdownCoordinator.js +33 -0
- package/lib/src/services/SocketServer.js +19 -3
- package/lib/src/services/TeamService.js +20 -3
- package/lib/src/services/bug-report/video-slice.js +4 -1
- package/lib/src/services/device-access/leaseOverride.js +7 -5
- package/lib/src/services/healing/FuzzyXmlHealingProvider.js +51 -0
- package/lib/src/services/healing/HealEtalonService.js +3 -2
- package/lib/src/services/healing/HealingOrchestrator.js +85 -71
- package/lib/src/services/healing/OcrHealingProvider.js +41 -64
- package/lib/src/services/healing/ResilioTreeHealingProvider.js +41 -50
- package/lib/src/services/healing/VisualAiHealingProvider.js +1 -1
- package/lib/src/services/healing/fingerprintIdentity.js +126 -0
- package/lib/src/services/healing/resilioPath.js +274 -0
- package/lib/src/services/interceptor/AndroidProxyAdapter.js +18 -0
- package/lib/src/services/interceptor/interceptorOptions.js +44 -0
- package/lib/src/services/logcat/SessionDeviceLogs.js +271 -0
- package/lib/src/services/logcat/deviceLogBook.js +163 -0
- package/lib/src/services/network/AndroidRadios.js +71 -0
- package/lib/src/services/network/PhoneNetworkLedger.js +184 -0
- package/lib/src/services/network/PhoneNetworkRestore.js +330 -0
- package/lib/src/services/network/adbForPhone.js +60 -0
- package/lib/src/services/network/phoneNetworkLock.js +20 -0
- package/lib/src/services/network/xenonProxy.js +107 -0
- package/lib/src/services/ocr/ocrData.js +118 -0
- package/lib/src/services/ocr/vendor/LICENSE-tessdata.txt +202 -0
- package/lib/src/services/ocr/vendor/eng.traineddata.gz +0 -0
- package/lib/src/services/omni-vision/OmniVisionService.js +132 -95
- package/lib/src/services/omni-vision/VisionAssertionService.js +28 -25
- package/lib/src/services/omni-vision/ocrTextMatch.js +105 -0
- package/lib/src/services/omni-vision/screenScale.js +68 -0
- package/lib/src/services/passwordResetLink.js +50 -9
- package/lib/src/services/passwordResetMode.js +3 -1
- package/lib/src/services/publicUrl.js +45 -0
- package/lib/src/services/recording/concurrency-gate.js +12 -3
- package/lib/src/services/session/sessionIdentity.js +5 -3
- package/lib/src/services/session/shutdownReason.js +26 -0
- package/lib/src/services/settings/SelfHealingSwitch.js +70 -0
- package/lib/src/services/settings/aiEngineSettings.js +219 -0
- package/lib/src/services/settings/labSettings.js +149 -0
- package/lib/src/services/token/mintedLifetime.js +51 -0
- package/lib/src/services/webhookEvents.js +173 -0
- package/lib/src/sessions/SessionManager.js +8 -2
- package/lib/src/sessions/sessionMemory.js +25 -0
- package/lib/test/helpers/fake-adb.js +58 -0
- package/lib/test/helpers/fake-ai-provider.js +188 -0
- package/lib/test/helpers/fake-device-table.js +63 -24
- package/lib/test/helpers/loki-stores.js +33 -0
- package/lib/test/helpers/page-sources.js +164 -0
- package/lib/test/helpers/scratch-database.js +58 -13
- package/lib/test/integration/audit-ingest.spec.js +10 -10
- package/lib/test/integration/auth-flow.spec.js +9 -14
- package/lib/test/integration/auth-rate-limit.spec.js +6 -3
- package/lib/test/integration/bug-report-route.spec.js +22 -2
- package/lib/test/integration/forgot-password-rate-limit.spec.js +6 -3
- package/lib/test/integration/forgot-password.spec.js +17 -18
- package/lib/test/integration/legacy-deprecation-headers.spec.js +5 -2
- package/lib/test/integration/migration.spec.js +6 -1
- package/lib/test/integration/node-pair-auth-rest.spec.js +5 -9
- package/lib/test/integration/ports-router.spec.js +4 -4
- package/lib/test/integration/prisma-device-store-add-devices.spec.js +2 -3
- package/lib/test/integration/prisma-device-store-team-filter.spec.js +2 -5
- package/lib/test/integration/profile-tokens.spec.js +10 -16
- package/lib/test/integration/recordings-router.spec.js +16 -16
- package/lib/test/integration/reset-revokes-sessions.spec.js +4 -9
- package/lib/test/integration/role-matrix.spec.js +4 -9
- package/lib/test/integration/sdk-leases-router.spec.js +9 -9
- package/lib/test/integration/sdk-version.spec.js +2 -2
- package/lib/test/integration/selector-health-endpoint.spec.js +5 -5
- package/lib/test/integration/team-membership-migration.spec.js +73 -12
- package/lib/test/integration/team-visibility-apps.spec.js +15 -22
- package/lib/test/integration/team-visibility-control.spec.js +96 -69
- package/lib/test/integration/team-visibility-dashboard.spec.js +7 -23
- package/lib/test/integration/team-visibility-grid.spec.js +16 -15
- package/lib/test/integration/team-visibility-leases.spec.js +8 -11
- package/lib/test/integration/team-visibility-recordings.spec.js +6 -19
- package/lib/test/integration/team-visibility-sessions.spec.js +6 -19
- package/lib/test/integration/users-flow.spec.js +7 -12
- package/lib/test/integration/users-lockout.spec.js +5 -3
- package/lib/test/unit/EmailService.test.js +66 -0
- package/lib/test/unit/ResilioTreeHealingProvider.test.js +46 -19
- package/lib/test/unit/TeamService.test.js +3 -0
- package/lib/test/unit/XenonCapabilityManager.spec.js +4 -2
- package/lib/test/unit/ai-call-time-limit.spec.js +130 -0
- package/lib/test/unit/ai-engine-settings.spec.js +338 -0
- package/lib/test/unit/ai-provider-switch.spec.js +130 -0
- package/lib/test/unit/ai-rate-limit.spec.js +126 -0
- package/lib/test/unit/android-h264-viewers.spec.js +272 -0
- package/lib/test/unit/android-preview-hold.spec.js +3 -2
- package/lib/test/unit/apikeys-router.spec.js +84 -0
- package/lib/test/unit/apple-family.spec.js +36 -0
- package/lib/test/unit/authMiddleware.bearer.spec.js +9 -0
- package/lib/test/unit/authMiddleware.credentialLifetime.spec.js +149 -0
- package/lib/test/unit/bug-report/video-slice.spec.js +19 -0
- package/lib/test/unit/cleanup-settings-db.spec.js +103 -0
- package/lib/test/unit/cleanup-settings.spec.js +244 -0
- package/lib/test/unit/dashboard-api-paths.spec.js +101 -0
- package/lib/test/unit/dashboard-commands.spec.js +249 -0
- package/lib/test/unit/dashboard-events-device-logs.spec.js +207 -0
- package/lib/test/unit/dashboard-events-team-scope.spec.js +9 -6
- package/lib/test/unit/dashboard-plugin-link.spec.js +213 -0
- package/lib/test/unit/database-check.spec.js +108 -0
- package/lib/test/unit/default-plugin-args.spec.js +33 -0
- package/lib/test/unit/device-log-book.spec.js +180 -0
- package/lib/test/unit/device-offline-webhook.spec.js +81 -0
- package/lib/test/unit/device-setting-columns.spec.js +66 -0
- package/lib/test/unit/device-settings-loki.spec.js +87 -0
- package/lib/test/unit/device-settings-survive.spec.js +555 -0
- package/lib/test/unit/device-sync-lost-update.spec.js +5 -0
- package/lib/test/unit/emulator-boot.spec.js +91 -0
- package/lib/test/unit/enable-dashboard-option.spec.js +57 -0
- package/lib/test/unit/event-log-session-data.spec.js +244 -0
- package/lib/test/unit/failure-analysis.spec.js +182 -0
- package/lib/test/unit/failure-categories.spec.js +128 -0
- package/lib/test/unit/fingerprint-identity.spec.js +433 -0
- package/lib/test/unit/h264-multiplexer.spec.js +46 -0
- package/lib/test/unit/heal-report.spec.js +71 -0
- package/lib/test/unit/healing-instrumentation.spec.js +6 -1
- package/lib/test/unit/healing-tier-gate.spec.js +73 -29
- package/lib/test/unit/healing-tiers-every-session.spec.js +219 -0
- package/lib/test/unit/hub-node-gateway-appium-server.spec.js +219 -0
- package/lib/test/unit/hub-node-same-host.spec.js +5 -0
- package/lib/test/unit/interceptor-visual-elements.spec.js +192 -0
- package/lib/test/unit/iphone-ipad-only.spec.js +132 -0
- package/lib/test/unit/json-logging-option.spec.js +74 -0
- package/lib/test/unit/lab-settings.spec.js +218 -0
- package/lib/test/unit/lease/lease-override.spec.js +23 -6
- package/lib/test/unit/lease/session-lease-proof.spec.js +16 -4
- package/lib/test/unit/max-sessions.spec.js +240 -0
- package/lib/test/unit/ocr-healing-tier-real-ocr.spec.js +113 -0
- package/lib/test/unit/ocr-healing-tier.spec.js +122 -0
- package/lib/test/unit/ocr-offline.spec.js +213 -0
- package/lib/test/unit/ocr-text-match.spec.js +44 -0
- package/lib/test/unit/omni-virtual-element-store.spec.js +301 -0
- package/lib/test/unit/omni-vision-analyze-screen.spec.js +72 -0
- package/lib/test/unit/omni-vision-ios-points.spec.js +159 -0
- package/lib/test/unit/omni-vision-tap-text.spec.js +129 -0
- package/lib/test/unit/omni-vision.spec.js +6 -8
- package/lib/test/unit/package-engines.spec.js +27 -0
- package/lib/test/unit/partial-config-file.spec.js +14 -0
- package/lib/test/unit/passwordResetMode.test.js +10 -2
- package/lib/test/unit/phone-network/boot-clean-up.spec.js +64 -0
- package/lib/test/unit/phone-network/interceptor-options.spec.js +77 -0
- package/lib/test/unit/phone-network/interceptor-proxy-restore.spec.js +145 -0
- package/lib/test/unit/phone-network/network-conditioning.spec.js +145 -0
- package/lib/test/unit/phone-network/phone-network-restore.spec.js +246 -0
- package/lib/test/unit/phone-network/session-end-paths.spec.js +182 -0
- package/lib/test/unit/phone-network/session-start.spec.js +110 -0
- package/lib/test/unit/phone-network/xenon-proxy.spec.js +69 -0
- package/lib/test/unit/plugin.spec.js +3 -3
- package/lib/test/unit/profile-router.test.js +122 -1
- package/lib/test/unit/queue-requester.spec.js +1 -1
- package/lib/test/unit/recording-options.spec.js +181 -0
- package/lib/test/unit/reset-link-address.spec.js +266 -0
- package/lib/test/unit/reset-link.test.js +10 -4
- package/lib/test/unit/resilio-path-healing.spec.js +270 -0
- package/lib/test/unit/selector-learning-every-session.spec.js +179 -0
- package/lib/test/unit/selector-verification-clean-build.spec.js +130 -0
- package/lib/test/unit/selector-verification-job.spec.js +13 -13
- package/lib/test/unit/self-healing-boot.spec.js +80 -0
- package/lib/test/unit/self-healing-setting.spec.js +273 -0
- package/lib/test/unit/session-app-resolution.spec.js +5 -1
- package/lib/test/unit/session-attribution-wiring.spec.js +41 -13
- package/lib/test/unit/session-create-credential-owner.spec.js +242 -0
- package/lib/test/unit/session-credential-strip.spec.js +1 -1
- package/lib/test/unit/session-device-logs.spec.js +347 -0
- package/lib/test/unit/session-end-failure-analysis.spec.js +133 -0
- package/lib/test/unit/session-failed-webhook.spec.js +170 -0
- package/lib/test/unit/session-log-indexes.spec.js +64 -3
- package/lib/test/unit/shell-commands.spec.js +133 -0
- package/lib/test/unit/socketServer.scopedEmit.spec.js +2 -0
- package/lib/test/unit/socketServer.sessionCookie.spec.js +2 -1
- package/lib/test/unit/stream-start-pipelines.spec.js +264 -0
- package/lib/test/unit/stream-status-type.spec.js +4 -0
- package/lib/test/unit/token-mint-limits.spec.js +165 -0
- package/lib/test/unit/unexpected-shutdown-reason.spec.js +163 -0
- package/lib/test/unit/verify-credential.spec.js +33 -0
- package/lib/test/unit/vision-assertion.spec.js +119 -0
- package/lib/test/unit/wda-client-shell.spec.js +133 -0
- package/lib/test/unit/web-config-service.spec.js +98 -0
- package/lib/test/unit/webhook-delivery.spec.js +24 -0
- package/lib/test/unit/webhook-payloads.spec.js +273 -0
- package/lib/test/unit/xenon-execute-scripts.spec.js +138 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/components/webhook-settings/webhookEventVariables.json +30 -0
- package/package.json +5 -5
- package/prisma/migrations/20261004140000_keep_device_settings/migration.sql +19 -0
- package/prisma/migrations/20261004174413_locator_etalon_path/migration.sql +2 -0
- package/prisma/schema.prisma +38 -7
- package/schema.json +23 -25
- package/scripts/generate-types-from-schema.js +1 -2
- package/scripts/lib/always-present-plugin-args.js +4 -1
- package/lib/public/assets/BugReportButton-BoGhlI7F.js +0 -15
- package/lib/public/assets/DeviceMosaicView-8J0oYqMM.js +0 -2
- package/lib/public/assets/ai-settings-Bce5SJob.js +0 -21
- package/lib/public/assets/device-explorer-C-KnhMHI.js +0 -279
- package/lib/public/assets/forgot-password-DnudqFFo.js +0 -1
- package/lib/public/assets/maintenance-settings-zDVlOMVK.js +0 -6
- package/lib/public/assets/recording-group-store-WVM3hoXn.js +0 -26
- package/lib/public/assets/runbook-page-DJTVCJX7.js +0 -124
- package/lib/public/assets/session-detail-page-CGn55Pvl.js +0 -4
- package/lib/public/assets/settings-MsVU2ukE.js +0 -6
- package/lib/public/assets/webhook-settings-DiS8geIm.js +0 -1
- /package/lib/public/assets/{BugReportButton-CPBjfiv4.css → index-CPBjfiv4.css} +0 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import{c as Z,j as t,r as l,C as mn,U as ur,X as q,t as Fe,v as Os,b as hr,u as Pt,a as os,T as mr,q as Ss,R as ft,w as fr,x as fn,y as Ke,z as Fs,I as Jn,S as Wt,f as yt,A as Yt,B as pr,i as Qn,D as vr,E as yr,F as xr,G as gr,H as jr,p as br}from"./index-BOxe43p1.js";import{P as wr}from"./page-header-COQZxJfR.js";import{P as Gt,u as kr,e as Nr,d as Cr,S as Sr,B as $r}from"./index-B9KQ6LsY.js";import{A as Tr}from"./activity-CJ8LwZq9.js";import{h as Rr,M as ea,S as ta,C as Er,a as Mt,i as Ar,b as pn,W as Dr,H as Mr,p as zr,c as Lr,A as Et,I as vs}from"./h264Stream-C-OtmIuk.js";import{p as cs}from"./labels-C21SA4JG.js";import{B as F}from"./button-Cg08-EMT.js";import{S as sa}from"./select-Bpyn7rWO.js";import{P as es,M as Ps,a as ke,b as na}from"./Menu-CtdCybzA.js";import{M as ls}from"./Modal-Bsvj1tm2.js";import{F as Zt}from"./FieldGroup-CveQ3xrA.js";import{C as Ir}from"./clock-C8_HViQP.js";import{P as _r}from"./plus-5aq-9uRx.js";import{C as Oe}from"./copy-Be7LNMXV.js";import{T as Or}from"./tablet-BxUScAeO.js";import{S as Fr,a as vn}from"./SegmentedControl-C8HtTha-.js";import{T as Pr,a as Ur,b as aa,c as ts,d as Br,e as ht}from"./Table-zNTX92Pn.js";import{L as ra,a as Hr}from"./list-checks-CCgjeyGY.js";import{C as Vr}from"./chevron-right-B2QOv9Nx.js";import{M as yn}from"./mouse-pointer-2-CtOrk4M8.js";import{Z as ia}from"./zap-DO9ry1iz.js";import{C as It}from"./check-BMTaH72W.js";import{C as oa}from"./circle-check-CYXBoUqT.js";import{C as ca}from"./circle-x-DTwnSAnl.js";import{E as Wr}from"./EmptyState-DqWU2-vM.js";import{I as xn}from"./input-CZHFjbSg.js";import{P as qr,a as Kr}from"./play-DrN1Se_R.js";import{D as la}from"./download-B56lwxWP.js";import{U as Xr,T as Yr}from"./upload-C2gr44RS.js";import{A as Gr}from"./arrow-left-BWfCbeHP.js";import{A as Zr}from"./arrow-right-DC7UGf_n.js";import{p as Jr,A as Qr}from"./AnnotationOverlay-Btq3dZRI.js";import{T as ei}from"./trash-2-B701i8sy.js";import{L as ti}from"./lock-CkOwgDcx.js";import{F as gn}from"./FilterMenu-BfKDSfHz.js";import"./utils-CDN07tui.js";import"./index-CfxsUslp.js";/**
|
|
2
|
+
* @license lucide-react v0.555.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const si=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Us=Z("arrow-down",si);/**
|
|
7
|
+
* @license lucide-react v0.555.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const ni=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Bs=Z("arrow-up",ni);/**
|
|
12
|
+
* @license lucide-react v0.555.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const ai=[["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 14v-4",key:"14a6bd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],ri=Z("battery-low",ai);/**
|
|
17
|
+
* @license lucide-react v0.555.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const ii=[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2",key:"1m83kb"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"h8lgfh"}]],oi=Z("battery-warning",ii);/**
|
|
22
|
+
* @license lucide-react v0.555.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const ci=[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],li=Z("battery",ci);/**
|
|
27
|
+
* @license lucide-react v0.555.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const di=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],ui=Z("box",di);/**
|
|
32
|
+
* @license lucide-react v0.555.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const hi=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],mi=Z("calendar-plus",hi);/**
|
|
37
|
+
* @license lucide-react v0.555.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const fi=[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]],pi=Z("chevrons-down-up",fi);/**
|
|
42
|
+
* @license lucide-react v0.555.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const vi=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],yi=Z("chevrons-up-down",vi);/**
|
|
47
|
+
* @license lucide-react v0.555.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const xi=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],da=Z("circle-question-mark",xi);/**
|
|
52
|
+
* @license lucide-react v0.555.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const gi=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],jn=Z("code-xml",gi);/**
|
|
57
|
+
* @license lucide-react v0.555.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const ji=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],bi=Z("columns-2",ji);/**
|
|
62
|
+
* @license lucide-react v0.555.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const wi=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],ki=Z("crosshair",wi);/**
|
|
67
|
+
* @license lucide-react v0.555.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Ni=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],ua=Z("ellipsis",Ni);/**
|
|
72
|
+
* @license lucide-react v0.555.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const Ci=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]],Si=Z("folder-down",Ci);/**
|
|
77
|
+
* @license lucide-react v0.555.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const $i=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],Ti=Z("hand",$i);/**
|
|
82
|
+
* @license lucide-react v0.555.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const Ri=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ei=Z("image",Ri);/**
|
|
87
|
+
* @license lucide-react v0.555.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const Ai=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],Di=Z("keyboard",Ai);/**
|
|
92
|
+
* @license lucide-react v0.555.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const Mi=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],zi=Z("library",Mi);/**
|
|
97
|
+
* @license lucide-react v0.555.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const Li=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],Ii=Z("lock-open",Li);/**
|
|
102
|
+
* @license lucide-react v0.555.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const _i=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Oi=Z("map-pin",_i);/**
|
|
107
|
+
* @license lucide-react v0.555.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const Fi=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Pi=Z("maximize-2",Fi);/**
|
|
112
|
+
* @license lucide-react v0.555.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const Ui=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Bi=Z("message-square",Ui);/**
|
|
117
|
+
* @license lucide-react v0.555.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const Hi=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Vi=Z("minimize-2",Hi);/**
|
|
122
|
+
* @license lucide-react v0.555.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const Wi=[["path",{d:"M18 5h4",key:"1lhgn2"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],qi=Z("moon-star",Wi);/**
|
|
127
|
+
* @license lucide-react v0.555.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const Ki=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Xi=Z("mouse-pointer-click",Ki);/**
|
|
132
|
+
* @license lucide-react v0.555.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const Yi=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Gi=Z("package",Yi);/**
|
|
137
|
+
* @license lucide-react v0.555.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const Zi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],Ji=Z("panel-top",Zi);/**
|
|
142
|
+
* @license lucide-react v0.555.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Qi=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ha=Z("pen-line",Qi);/**
|
|
147
|
+
* @license lucide-react v0.555.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const eo=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],to=Z("rectangle-horizontal",eo);/**
|
|
152
|
+
* @license lucide-react v0.555.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const so=[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]],no=Z("rectangle-vertical",so);/**
|
|
157
|
+
* @license lucide-react v0.555.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const ao=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],zt=Z("rotate-cw",ao);/**
|
|
162
|
+
* @license lucide-react v0.555.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const ro=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],ma=Z("scroll-text",ro);/**
|
|
167
|
+
* @license lucide-react v0.555.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const io=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Nt=Z("shield-alert",io);/**
|
|
172
|
+
* @license lucide-react v0.555.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const oo=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],co=Z("tag",oo);/**
|
|
177
|
+
* @license lucide-react v0.555.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const lo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],ys=Z("target",lo);/**
|
|
182
|
+
* @license lucide-react v0.555.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const uo=[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]],ho=Z("text-cursor-input",uo);/**
|
|
187
|
+
* @license lucide-react v0.555.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const mo=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],fo=Z("thermometer",mo);/**
|
|
192
|
+
* @license lucide-react v0.555.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/const po=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],vo=Z("toggle-left",po);/**
|
|
197
|
+
* @license lucide-react v0.555.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const yo=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]],bn=Z("touchpad",yo);/**
|
|
202
|
+
* @license lucide-react v0.555.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const xo=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],go=Z("type",xo);/**
|
|
207
|
+
* @license lucide-react v0.555.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const jo=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],bo=Z("volume-1",jo);/**
|
|
212
|
+
* @license lucide-react v0.555.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const wo=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],ko=Z("volume-2",wo);function No(e){return e>=50?"ready":e>=20?"warning":"error"}function Co(e){return e>=50?t.jsx(li,{size:10}):e>=20?t.jsx(ri,{size:10}):t.jsx(oi,{size:10})}function So(e){return e==="Normal"?"ready":e==="Critical"?"error":"warning"}const $o=({device:e})=>{if(e.deviceType==="emulator"||e.deviceType==="simulator"||e.offline)return null;const n=typeof e.batteryLevel=="number",a=typeof e.thermalStatus=="string"&&e.thermalStatus.length>0&&e.thermalStatus!=="Unknown";return!n&&!a?t.jsx("div",{className:"dc2-health",children:t.jsxs(Gt,{tone:"neutral",title:"Device does not report battery or thermal data",children:[t.jsx(Tr,{size:10}),"No telemetry"]})}):t.jsxs("div",{className:"dc2-health",children:[n&&t.jsxs(Gt,{tone:No(e.batteryLevel),title:`Battery ${e.batteryLevel}%`,children:[Co(e.batteryLevel),e.batteryLevel,"%"]}),a&&t.jsxs(Gt,{tone:So(e.thermalStatus),title:`Thermal: ${e.thermalStatus}`,children:[t.jsx(fo,{size:10}),e.thermalStatus]})]})};function To(e){if(typeof e!="number")throw new TypeError("Expected a number");const s=e>0?Math.floor:Math.ceil;return{days:s(e/864e5),hours:s(e/36e5)%24,minutes:s(e/6e4)%60,seconds:s(e/1e3)%60,milliseconds:s(e)%1e3,microseconds:s(e*1e3)%1e3,nanoseconds:s(e*1e6)%1e3}}const Ro=(e,s)=>s===1?e:`${e}s`,Eo=1e-7;function fa(e,s={}){if(!Number.isFinite(e))throw new TypeError("Expected a finite number");s.colonNotation&&(s.compact=!1,s.formatSubMilliseconds=!1,s.separateMilliseconds=!1,s.verbose=!1),s.compact&&(s.secondsDecimalDigits=0,s.millisecondsDecimalDigits=0);const n=[],a=(c,h)=>{const d=Math.floor(c*10**h+Eo);return(Math.round(d)/10**h).toFixed(h)},r=(c,h,d,o)=>{if((n.length===0||!s.colonNotation)&&c===0&&!(s.colonNotation&&d==="m"))return;o=(o||c||"0").toString();let u,p;if(s.colonNotation){u=n.length>0?":":"",p="";const v=o.includes(".")?o.split(".")[0].length:o.length,f=n.length>0?2:1;o="0".repeat(Math.max(0,f-v))+o}else u="",p=s.verbose?" "+Ro(h,c):d;n.push(u+o+p)},i=To(e);if(r(Math.trunc(i.days/365),"year","y"),r(i.days%365,"day","d"),r(i.hours,"hour","h"),r(i.minutes,"minute","m"),s.separateMilliseconds||s.formatSubMilliseconds||!s.colonNotation&&e<1e3)if(r(i.seconds,"second","s"),s.formatSubMilliseconds)r(i.milliseconds,"millisecond","ms"),r(i.microseconds,"microsecond","µs"),r(i.nanoseconds,"nanosecond","ns");else{const c=i.milliseconds+i.microseconds/1e3+i.nanoseconds/1e6,h=typeof s.millisecondsDecimalDigits=="number"?s.millisecondsDecimalDigits:0,d=c>=1?Math.round(c):Math.ceil(c),o=h?c.toFixed(h):d;r(Number.parseFloat(o),"millisecond","ms",o)}else{const c=e/1e3%60,h=typeof s.secondsDecimalDigits=="number"?s.secondsDecimalDigits:1,d=a(c,h),o=s.keepDecimalsOnWholeSeconds?d:d.replace(/\.0+$/,"");r(Number.parseFloat(o),"second","s",o)}if(n.length===0)return"0"+(s.verbose?" milliseconds":"ms");if(s.compact)return n[0];if(typeof s.unitCount=="number"){const c=s.colonNotation?"":" ";return n.slice(0,Math.max(s.unitCount,1)).join(c)}return s.colonNotation?n.join(""):n.join(" ")}const xs=6e4;function Ao(e){return!Number.isFinite(e)||e<=0?"expiring":e<xs?"under 1m":fa(Math.floor(e/xs)*xs,{unitCount:2})}const $s=["ready","busy","reserved","maintenance","offline"],pa={ready:"Ready",busy:"Busy",reserved:"Reserved",maintenance:"Maintenance",offline:"Offline"};function _t(e,s){return e.offline?"offline":e.userBlocked?"maintenance":e.busy?"busy":e.reservedUntil&&s<e.reservedUntil?"reserved":"ready"}function va(e,s){const n=Rr(e);if(!e.busy||!n)return null;const a=String(n);return a.startsWith("manual_")?s!=null&&s.userId&&a===`manual_${s.userId}_${e.udid}`?"self":"other":"session"}const wn=e=>(e==null?void 0:e.role)==="ADMIN"||(e==null?void 0:e.role)==="SUPER_ADMIN";function Do(e,s,n){switch(va(e,s)){case"session":return e.sessionStartTime&&e.sessionStartTime>0&&n>e.sessionStartTime?`Test session · ${fa(n-e.sessionStartTime,{compact:!0})}`:"Test session running";case"self":return"Live control by you";case"other":return"Live control by another user"}if(e.reservedUntil&&n<e.reservedUntil){const r=!!e.reservedBy&&(e.reservedBy===(s==null?void 0:s.email)||e.reservedBy===(s==null?void 0:s.name))?"you":e.reservedBy||"another user";return`${Ao(e.reservedUntil-n)} left · by ${r}`}return null}function Mo(e,s){if(e.offline)return{enabled:!1,reason:"Device is offline"};if(e.userBlocked&&!wn(s))return{enabled:!1,reason:"In maintenance"};const n=va(e,s);return n==="session"?{enabled:!1,reason:"A test is running"}:n==="other"&&!wn(s)?{enabled:!1,reason:"Another user has control"}:{enabled:!0}}function at(e){var s;return((s=e.marketingName)==null?void 0:s.trim())||e.name}function ya(e){const s=[cs(e.platform),e.sdk].filter(Boolean).join(" ");if(e.deviceType==="emulator")return`Emulator · ${s}`;if(e.deviceType==="simulator")return`Simulator · ${s}`;const a=[e.manufacturer?e.manufacturer.charAt(0).toUpperCase()+e.manufacturer.slice(1):"",e.model].filter(Boolean).join(" ");return a?`${a} · ${s}`:s}function zo(e){return e.formFactor==="tablet"||e.formFactor==="tv"?e.formFactor:"phone"}function St(e,s){return e.teamId?(s==null?void 0:s.get(e.teamId))??e.teamName??`Team ${e.teamId.slice(0,6)}`:null}const Lo=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],Io=({device:e,onClose:s,onReserved:n})=>{const[a,r]=l.useState(""),[i,c]=l.useState("1h"),[h,d]=l.useState(""),[o,u]=l.useState(!1),[p,v]=l.useState(null),[f,g]=l.useState(null),k=async()=>{if(!a.trim()){v("Please enter your name/ID");return}u(!0),v(null),g(null);try{const b=await q.reserveDevice(e.udid,e.host,a,i,h);b.success?(n(),s()):g(b.error||"Failed to reserve device")}catch(b){g(b.message||"An unexpected error occurred")}finally{u(!1)}};return t.jsx(ls,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(mi,{size:16,className:"title-icon"}),"Reserve device"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,disabled:o,children:"Cancel"}),t.jsx("button",{className:"btn-reserve",onClick:k,disabled:o||!a.trim(),children:o?"Reserving...":"Confirm Reservation"})]}),children:t.jsxs("div",{className:"reservation-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsxs("p",{children:["Reserve ",t.jsx("strong",{children:e.name||e.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),t.jsx(Zt,{label:t.jsxs(t.Fragment,{children:[t.jsx(ur,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reserved by"]}),htmlFor:"reservation-reserved-by",error:p?t.jsxs(t.Fragment,{children:[t.jsx(mn,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),p]}):void 0,children:t.jsx("input",{id:"reservation-reserved-by",type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:a,onChange:b=>{r(b.target.value),p&&v(null)},disabled:o})}),t.jsx(Zt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Ir,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Duration"]}),children:t.jsx("div",{className:"duration-selector",children:Lo.map(b=>t.jsx("div",{className:`duration-option ${i===b.value?"active":""}`,onClick:()=>c(b.value),children:b.label},b.value))})}),t.jsx(Zt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Bi,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reason (optional)"]}),htmlFor:"reservation-reason",error:f?t.jsxs(t.Fragment,{children:[t.jsx(mn,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),f]}):void 0,children:t.jsx("input",{id:"reservation-reason",type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:h,onChange:b=>d(b.target.value),disabled:o})})]})})},_o=({device:e,onClose:s,onUpdated:n})=>{const{toast:a}=Fe(),[r,i]=l.useState(e.tags||[]),[c,h]=l.useState(""),[d,o]=l.useState(!1),u=l.useRef(null);l.useEffect(()=>{u.current&&u.current.focus()},[]);const p=()=>{const k=c.trim();k&&!r.includes(k)&&(i([...r,k]),h(""))},v=k=>{i(r.filter(b=>b!==k))},f=k=>{k.key==="Enter"&&p()},g=async()=>{o(!0);try{await q.updateDeviceTags(e.udid,e.host,r),n(),s()}catch(k){console.error("Failed to update tags",k),a("Error saving tags. Please try again.","error")}finally{o(!1)}};return t.jsx(ls,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(co,{size:16,className:"title-icon"}),"Manage device tags"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,children:"Cancel"}),t.jsx("button",{className:"btn-save",onClick:g,disabled:d,children:d?"Saving...":"Apply Changes"})]}),children:t.jsxs("div",{className:"tag-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsx(Zt,{label:"Add new tag",description:"Press Enter to add multiple tags",htmlFor:"tag-input",children:t.jsxs("div",{className:"input-with-button",children:[t.jsx("input",{ref:u,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:c,onChange:k=>h(k.target.value),onKeyDown:f}),t.jsx("button",{className:"add-inline-btn",onClick:p,disabled:!c.trim(),children:t.jsx(_r,{size:16})})]})}),t.jsxs("div",{className:"tags-display-section",children:[t.jsx("label",{children:"Current Tags"}),t.jsx("div",{className:"tags-list",children:r.length>0?r.map(k=>t.jsxs("div",{className:"tag-pill-editable",children:[k,t.jsx("button",{className:"remove-tag",onClick:()=>v(k),children:t.jsx(Os,{size:12})})]},k)):t.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]})})},Oo="/wd/hub";function Fo(e){return e==="android"?"UiAutomator2":"XCUITest"}function Po(e){return e==="android"?"Android":e==="tvos"?"tvOS":"iOS"}function Uo(e,s=Oo){if(!e)return"—";try{const n=new URL(e.includes("://")?e:`http://${e}`),a=s.startsWith("/")?s:`/${s}`,r=n.pathname.replace(/\/$/,"");return r===a||r.endsWith(a)?`${n.protocol}//${n.host}${r}`:`${n.protocol}//${n.host}${a}`}catch{return e}}function Bo(e){const s={platformName:Po(e.platform),"appium:automationName":Fo(e.platform),"appium:udid":e.udid};return e.sdk&&e.sdk!=="Unknown"&&e.sdk!=="unknown"&&(s["appium:platformVersion"]=e.sdk),e.name&&(s["appium:deviceName"]=e.name),s}function Ho(e){return JSON.stringify(Bo(e),null,2)}const Vo=/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i,Wo=/^(?:\d{1,3}\.){3}\d{1,3}$/;function qo(e){const s=e.trim();return!s||Vo.test(s)||!Wo.test(s)?!1:s.split(".").every(n=>{const a=Number(n);return Number.isInteger(a)&&a>=0&&a<=255})}function Ko(e){return e.ip&&qo(e.ip)?e.ip.trim():null}const xa=({udid:e,currentTeamId:s,teams:n,onDone:a,className:r})=>{const{toast:i}=Fe(),[c,h]=l.useState(!1);async function d(o){h(!0);try{await q.setDeviceTeam(e,o)}catch(u){h(!1),i((u==null?void 0:u.message)||"Failed to update team","error");return}h(!1),i(o?"Device assigned":"Device returned to shared pool","success"),a(!0)}return t.jsxs(sa,{selectSize:"sm",className:r,autoFocus:!0,"aria-label":"Team",disabled:c,defaultValue:s??"",onBlur:()=>a(!1),onChange:o=>d(o.target.value||null),children:[t.jsx("option",{value:"",children:"(Shared pool)"}),Array.from(n.entries()).map(([o,u])=>t.jsx("option",{value:o,children:u},o))]})};function ga(e,s){const[n,a]=l.useState(!1),[r,i]=l.useState(!1),[c,h]=l.useState(!1),{me:d}=hr(),{toast:o}=Fe(),u=(d==null?void 0:d.role)==="ADMIN"||(d==null?void 0:d.role)==="SUPER_ADMIN",p=Date.now(),v=_t(e,p),f=v==="reserved",g=Do(e,d,p),k=Mo(e,d),b=Uo(e.host),U=Ko(e),N=async($,m)=>{var S;try{await((S=navigator.clipboard)==null?void 0:S.writeText($)),o(m,"success")}catch{o("Failed to copy","error")}},w=async()=>{await q.releaseReservation(e.udid,e.host),s()},C=async()=>{await q.blockDevice(e.udid,e.host),s()},j=async()=>{await q.unblockDevice(e.udid,e.host),s()},A=async()=>{e.userBlocked?await j():await C()},T=t.jsxs(t.Fragment,{children:[n&&t.jsx(Io,{device:e,onClose:()=>a(!1),onReserved:()=>s()}),r&&t.jsx(_o,{device:e,onClose:()=>i(!1),onUpdated:()=>s()})]});return{kind:v,reserved:f,activity:g,control:k,isAdmin:u,editingTeam:c,setEditingTeam:h,openReservation:()=>a(!0),openTagManager:()=>i(!0),release:w,toggleMaintenance:A,copy:N,serverUrl:b,ip:U,dialogs:T}}const ja=({device:e,actions:s,navigate:n,reasonId:a})=>{const{kind:r,reserved:i,control:c}=s;return t.jsxs(t.Fragment,{children:[t.jsx(F,{variant:"tonal",size:"sm",disabled:!c.enabled,"aria-describedby":c.enabled?void 0:a,onClick:()=>{c.enabled&&n(`/devices/${e.udid}/control`)},children:"Control"}),i?t.jsx(F,{variant:"secondary",size:"sm",onClick:s.release,children:"Release"}):r==="ready"?t.jsx(F,{variant:"secondary",size:"sm",onClick:s.openReservation,children:"Reserve"}):null]})},ba=({device:e,actions:s})=>{const[n,a]=l.useState(!1),r=l.useRef(null),{isAdmin:i,serverUrl:c,ip:h,copy:d}=s;return t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:r,type:"button",className:"dc2-more",onClick:()=>a(o=>!o),"aria-label":"More actions",children:t.jsx(ua,{size:14})}),t.jsx(es,{open:n,onClose:()=>a(!1),anchorRef:r,children:t.jsxs(Ps,{children:[t.jsx(ke,{icon:t.jsx(Oe,{size:12}),onClick:()=>{a(!1),d(e.udid,"UDID copied")},children:"Copy UDID"}),c!=="—"&&t.jsx(ke,{icon:t.jsx(Oe,{size:12}),onClick:()=>{a(!1),d(c,"Server URL copied")},children:"Copy server URL"}),h&&t.jsx(ke,{icon:t.jsx(Oe,{size:12}),onClick:()=>{a(!1),d(h,"IP address copied")},children:"Copy IP address"}),t.jsx(ke,{icon:t.jsx(Oe,{size:12}),onClick:()=>{a(!1),d(Ho(e),"Session capabilities copied")},children:"Copy capabilities"}),i&&t.jsxs(t.Fragment,{children:[t.jsx(na,{}),t.jsx(ke,{onClick:()=>{a(!1),s.openTagManager()},children:"Manage tags…"}),t.jsx(ke,{onClick:()=>{a(!1),s.setEditingTeam(!0)},children:"Assign team…"}),t.jsx(ke,{onClick:()=>{a(!1),s.toggleMaintenance()},children:e.userBlocked?"Exit maintenance":"Enter maintenance"})]})]})})]})},Xo=({device:e})=>{const s={phone:Ss,tablet:Or,tv:mr}[zo(e)],n=e.deviceType==="emulator"||e.deviceType==="simulator";return t.jsx(s,{size:26,strokeWidth:1.5,strokeDasharray:n?"3 2":void 0})},Yo=({device:e,reloadDevices:s,navigate:n,teams:a})=>{var p,v,f;const r=ga(e,s),{kind:i,activity:c,control:h}=r,d=`dc2-reason-${e.udid}`,o=at(e),u=St(e,a);return t.jsxs("div",{className:`dc2 dc2-${i}`,children:[t.jsxs("div",{className:`dc2-band dc2-band-${i}`,children:[t.jsxs("span",{className:"dc2-band-label",children:[t.jsx("span",{className:"dc2-band-dot","aria-hidden":!0}),pa[i]]}),c&&t.jsx("span",{className:"dc2-band-activity",title:c,children:c})]}),t.jsxs("div",{className:`dc2-body${i==="offline"?" dc2-dim":""}`,children:[t.jsxs("div",{className:"dc2-head",children:[t.jsx("div",{className:"dc2-icon","aria-hidden":!0,children:t.jsx(Xo,{device:e})}),t.jsxs("div",{className:"dc2-id",children:[t.jsx("div",{className:"dc2-title",title:`${o}
|
|
217
|
+
${e.udid}`,children:o}),t.jsx("div",{className:"dc2-subtitle",children:ya(e)})]})]}),t.jsxs("div",{className:"dc2-meta",children:[t.jsx($o,{device:e}),r.editingTeam?t.jsx(xa,{className:"dc2-team-picker",udid:e.udid,currentTeamId:e.teamId??null,teams:a??new Map,onDone:g=>{r.setEditingTeam(!1),g&&s()}}):u&&t.jsx(Gt,{tone:"accent",className:"dc2-team",title:`Team: ${u}`,children:u}),(p=e.tags)==null?void 0:p.slice(0,2).map(g=>t.jsxs("span",{className:"dc2-tag",title:g,children:["#",g]},g)),(((v=e.tags)==null?void 0:v.length)||0)>2&&t.jsxs("span",{className:"dc2-tag",children:["+",(((f=e.tags)==null?void 0:f.length)||0)-2]})]})]}),t.jsxs("div",{className:"dc2-foot",children:[t.jsx(ja,{device:e,actions:r,navigate:n,reasonId:d}),!h.enabled&&t.jsx("span",{id:d,className:"dc2-unavailable",title:h.reason,children:h.reason}),t.jsx("span",{className:"dc2-spacer"}),t.jsx(ba,{device:e,actions:r})]}),r.dialogs]})};function Go(e){const s=Pt(),{search:n}=os();return t.jsx(Yo,{device:e.device,reloadDevices:e.reloadDevices,navigate:a=>s(`${a}${n}`),teams:e.teams})}class Zo extends ft.Component{constructor(){super(...arguments),this.state={teamsMap:new Map}}componentDidMount(){q.listTeams().then(s=>{this.setState({teamsMap:new Map(s.map(n=>[n.id,n.name]))})}).catch(()=>{})}render(){return t.jsx("div",{className:"device-explorer-card-container",children:ft.Children.toArray(this.props.devices.map(s=>t.jsx(Go,{device:s,reloadDevices:this.props.reloadDevices,teams:this.state.teamsMap})))})}}const Jo={status:"all",platform:"all",type:"all",q:""},wa=["all",...$s],ka=["all","android","ios","tvos"],Na=["all","real","virtual"];function gs(e,s){return s.includes(e)?e:s[0]}function Qo(e){const s=e.get("q")??"";return{status:gs(e.get("status"),wa),platform:gs(e.get("platform"),ka),type:gs(e.get("type"),Na),q:s.trim()?s:""}}function ec(e){const s=new URLSearchParams;return e.status!=="all"&&s.set("status",e.status),e.platform!=="all"&&s.set("platform",e.platform),e.type!=="all"&&s.set("type",e.type),e.q.trim()&&s.set("q",e.q),s}function Ot(e){return e.deviceType==="simulator"||e.deviceType==="emulator"?!0:!e.deviceType&&e.realDevice===!1}function Hs(e){const s=(e.platform||"").toLowerCase();return s==="android"||s==="ios"||s==="tvos"?s:null}function tc(e){const s=e.deviceType==="emulator"?"Emulator":e.deviceType==="simulator"?"Simulator":"";return[at(e),e.name,e.manufacturer,e.model,cs(e.platform),e.sdk,s,e.teamName,e.udid].filter(Boolean).join(" ").toLowerCase()}function Jt(e,s,n,a){if(a!=="status"&&s.status!=="all"&&_t(e,n)!==s.status||a!=="platform"&&s.platform!=="all"&&Hs(e)!==s.platform||a!=="type"&&s.type!=="all"&&s.type==="virtual"!==Ot(e))return!1;const r=s.q.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return!0;const i=tc(e);return r.every(c=>i.includes(c))}const js=e=>Object.fromEntries(e.map(s=>[s,0]));function sc(e,s,n){const a=js(wa),r=js(ka),i=js(Na);for(const c of e){if(Jt(c,s,n,"status")&&(a.all+=1,a[_t(c,n)]+=1),Jt(c,s,n,"platform")){r.all+=1;const h=Hs(c);h&&(r[h]+=1)}Jt(c,s,n,"type")&&(i.all+=1,i[Ot(c)?"virtual":"real"]+=1)}return{status:a,platform:r,type:i}}function nc(e){return e.some(s=>Hs(s)==="tvos")}function ac(e){return e.status!=="all"||e.platform!=="all"||e.type!=="all"||e.q.trim()!==""}function rc(e,s){const n=a=>a===1?"device":"devices";return e===s?`${s} ${n(s)}`:`${e} of ${s} ${n(s)}`}const Ts={key:"status",dir:"asc"},ic=["status","device","platform","type","team","host"],oc=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0}),mt=(e,s)=>oc.compare(e,s);function cc(e,s,n,a){switch(n){case"status":return $s.indexOf(_t(e,a.now))-$s.indexOf(_t(s,a.now));case"device":return mt(at(e),at(s));case"platform":return mt(e.platform||"",s.platform||"")||mt(e.sdk||"",s.sdk||"");case"type":return Number(Ot(e))-Number(Ot(s));case"team":return mt(St(e,a.teams)??"",St(s,a.teams)??"");case"host":return mt(e.host||"",s.host||"")}}function lc(e,s,n){const a=s.dir==="desc"?-1:1;return e.slice().sort((r,i)=>{if(s.key==="team"){const c=St(r,n.teams)===null,h=St(i,n.teams)===null;if(c!==h)return c?1:-1}return a*cc(r,i,s.key,n)||mt(at(r),at(i))||mt(r.udid,i.udid)})}function dc(e){const s=e.get("sort");return!s||!ic.includes(s)?Ts:{key:s,dir:e.get("dir")==="desc"?"desc":"asc"}}function uc(e,s){e.delete("sort"),e.delete("dir"),!(s.key===Ts.key&&s.dir===Ts.dir)&&(e.set("sort",s.key),s.dir==="desc"&&e.set("dir","desc"))}const Ct=({sortKey:e,label:s,sort:n,onSortChange:a})=>{const r=n.key===e,i=r?n.dir:"asc";return t.jsx(ts,{scope:"col","aria-sort":r?i==="asc"?"ascending":"descending":"none",children:t.jsxs("button",{type:"button",className:"devtable-sort",onClick:()=>a(r?{key:e,dir:i==="asc"?"desc":"asc"}:{key:e,dir:"asc"}),children:[s,r&&(i==="asc"?t.jsx(Bs,{size:12,"aria-hidden":"true"}):t.jsx(Us,{size:12,"aria-hidden":"true"}))]})})},hc=({device:e,reloadDevices:s,navigate:n,teams:a,showHost:r})=>{const i=ga(e,s),{kind:c,activity:h,control:d}=i,o=at(e),u=ya(e),p=St(e,a),v=`${cs(e.platform)} ${e.sdk??""}`,f=e.tags??[],g=`devtable-reason-${e.udid}`;return t.jsxs(aa,{className:`devtable-row${c==="offline"?" is-offline":""}`,children:[t.jsxs(ht,{children:[t.jsxs("div",{className:"devtable-line",children:[t.jsx(Fr,{kind:c,className:"devtable-status-dot"})," ",pa[c]]}),h&&t.jsx("div",{className:"devtable-muted devtable-line",title:h,children:h})]}),t.jsxs(ts,{scope:"row",className:"devtable-rowheader",title:`${o}
|
|
218
|
+
${e.udid}`,children:[t.jsx("div",{className:"devtable-title devtable-line",children:o}),t.jsx("div",{className:"devtable-muted devtable-line",title:u,children:u})]}),t.jsx(ht,{title:v,children:v}),t.jsx(ht,{children:Ot(e)?"Virtual":"Real"}),t.jsx(ht,{title:i.editingTeam?void 0:p??"Shared",children:i.editingTeam?t.jsx(xa,{udid:e.udid,currentTeamId:e.teamId??null,teams:a,onDone:k=>{i.setEditingTeam(!1),k&&s()}}):p??"Shared"}),t.jsxs(ht,{title:f.join(", "),children:[f.slice(0,2).map(k=>t.jsxs("span",{className:"devtable-tag",children:["#",k]},k)),f.length>2&&t.jsxs("span",{className:"devtable-tag",children:["+",f.length-2]})]}),r&&t.jsx(ht,{title:e.host,children:e.host}),t.jsx(ht,{className:"devtable-actions",title:d.enabled?void 0:d.reason,children:t.jsxs("div",{className:"devtable-actions-inner",children:[t.jsx(ja,{device:e,actions:i,navigate:n,reasonId:g}),!d.enabled&&t.jsx("span",{id:g,className:"sr-only",children:d.reason}),t.jsx(ba,{device:e,actions:i})]})}),i.dialogs]})};function mc({devices:e,reloadDevices:s,sort:n,onSortChange:a,navigate:r,teams:i}){const c=new Set(e.map(d=>d.host)).size>1||n.key==="host",h=lc(e,n,{now:Date.now(),teams:i});return t.jsxs(Pr,{className:"devtable",children:[t.jsxs("caption",{className:"sr-only",children:["Devices, ",e.length," shown"]}),t.jsxs("colgroup",{children:[t.jsx("col",{className:"devtable-col-status"}),t.jsx("col",{}),t.jsx("col",{className:"devtable-col-platform"}),t.jsx("col",{className:"devtable-col-type"}),t.jsx("col",{className:"devtable-col-team"}),t.jsx("col",{className:"devtable-col-tags"}),c&&t.jsx("col",{className:"devtable-col-host"}),t.jsx("col",{className:"devtable-col-actions"})]}),t.jsx(Ur,{children:t.jsxs(aa,{children:[t.jsx(Ct,{sortKey:"status",label:"Status",sort:n,onSortChange:a}),t.jsx(Ct,{sortKey:"device",label:"Device",sort:n,onSortChange:a}),t.jsx(Ct,{sortKey:"platform",label:"Platform",sort:n,onSortChange:a}),t.jsx(Ct,{sortKey:"type",label:"Type",sort:n,onSortChange:a}),t.jsx(Ct,{sortKey:"team",label:"Team",sort:n,onSortChange:a}),t.jsx(ts,{scope:"col",children:"Tags"}),c&&t.jsx(Ct,{sortKey:"host",label:"Host",sort:n,onSortChange:a}),t.jsx(ts,{scope:"col",children:"Actions"})]})}),t.jsx(Br,{children:h.map(d=>t.jsx(hc,{device:d,reloadDevices:s,navigate:r,teams:i,showHost:c},d.udid))})]})}function fc(e){const s=Pt(),{search:n}=os(),[a,r]=l.useState(new Map);return l.useEffect(()=>{q.listTeams().then(i=>r(new Map(i.map(c=>[c.id,c.name])))).catch(()=>{})},[]),t.jsx(mc,{devices:e.devices,reloadDevices:e.reloadDevices,sort:e.sort,onSortChange:e.onSortChange,navigate:i=>s(`${i}${n}`),teams:a})}const pc=({onCommand:e,prompt:s="$",welcomeMessage:n="Interactive Shell (Restricted Mode)",platform:a})=>{const[r,i]=l.useState([{type:"system",content:n,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[c,h]=l.useState(""),[d,o]=l.useState([]),[u,p]=l.useState(-1),[v,f]=l.useState(!1),g=l.useRef(null),k=l.useRef(null);l.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r]);const b=N=>{const w=N.trim();if((w.startsWith("{")||w.startsWith("["))&&(w.endsWith("}")||w.endsWith("]")))try{const C=JSON.parse(w);return JSON.stringify(C,null,2)}catch{}return N},U=async N=>{if(N.key==="Enter"&&!v){const w=c.trim();if(!w)return;if(h(""),i(C=>[...C,{type:"command",content:`${s} ${w}`,timestamp:Date.now()}]),o(C=>[...C,w]),p(-1),f(!0),w==="clear"){i([]),f(!1);return}if(w==="help"){let C="";a==="android"?C=`
|
|
219
|
+
Android Allowed Commands:
|
|
220
|
+
• System Info: getprop, ip addr, date, uptime, whoami, cat /proc/meminfo, cat /proc/cpuinfo
|
|
221
|
+
• Process Mgmt: ps, top
|
|
222
|
+
• File System: ls
|
|
223
|
+
• Network: netstat
|
|
224
|
+
• Diagnostics: dumpsys [battery|wifi|power]
|
|
225
|
+
• Packages: pm list packages
|
|
226
|
+
One command per line, in plain words: no ; | & $ quotes or redirection.
|
|
227
|
+
`:(a==="ios"||a==="tvos")&&(C=`
|
|
228
|
+
iOS Allowed Commands:
|
|
229
|
+
• Real Device (go-ios):
|
|
230
|
+
apps, info
|
|
231
|
+
• Simulator (xcrun simctl):
|
|
232
|
+
listapps, get_app_container, getenv
|
|
233
|
+
• Simulator System (no arguments):
|
|
234
|
+
ls, ps, date, uptime, whoami, id
|
|
235
|
+
One command per line, in plain words: no ; | & $ quotes or redirection.
|
|
236
|
+
`),i(j=>[...j,{type:"output",content:C.trim(),timestamp:Date.now()}]),f(!1);return}try{const C=await e(w),j=b(C||"(No output)");i(A=>[...A,{type:"output",content:j,timestamp:Date.now()}])}catch(C){i(j=>[...j,{type:"error",content:C.message||"Unknown error",timestamp:Date.now()}])}finally{f(!1),setTimeout(()=>{var C;return(C=k.current)==null?void 0:C.focus()},10)}}else if(N.key==="ArrowUp"){if(N.preventDefault(),d.length>0){const w=u===-1?d.length-1:Math.max(0,u-1);p(w),h(d[w])}}else if(N.key==="ArrowDown"&&(N.preventDefault(),u!==-1)){const w=u+1;w>=d.length?(p(-1),h("")):(p(w),h(d[w]))}};return t.jsxs("div",{className:"terminal-container theme-dark",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"terminal-header",children:[t.jsxs("div",{className:"terminal-controls",children:[t.jsx("div",{className:"dot red"}),t.jsx("div",{className:"dot yellow"}),t.jsx("div",{className:"dot green"})]}),t.jsxs("div",{className:"terminal-title",children:[cs(a)," shell"]}),t.jsx("div",{className:"terminal-actions",children:t.jsx("button",{className:"terminal-action-btn",onClick:()=>i([]),title:"Clear terminal",children:"CLEAR"})})]}),t.jsxs("div",{className:"terminal-history",ref:g,onClick:()=>{var N;return(N=k.current)==null?void 0:N.focus()},children:[r.map((N,w)=>t.jsx("div",{className:`terminal-line ${N.type}`,children:N.content},w)),v&&t.jsx("div",{className:"terminal-line system animate-pulse",children:"Executing command..."})]}),t.jsxs("div",{className:"terminal-input-area",children:[t.jsx("span",{className:"terminal-prompt",children:s}),t.jsx("input",{ref:k,className:"terminal-input",value:c,onChange:N=>h(N.target.value),onKeyDown:U,disabled:v,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"Type a command..."})]})]})};function Ye(e,s){var n;s(e),(n=e.children)==null||n.forEach(a=>Ye(a,s))}function Xe(e,...s){var n;for(const a of s){const r=(n=e.attributes)==null?void 0:n[a];if(r!=null&&r!=="")return String(r)}}function $t(e){var s;return((s=e.type)==null?void 0:s.split(".").pop())||e.type||""}function vc(e,s){const n=[];return Ye(e,a=>{Xe(a,"content-desc","contentDescription","accessibilityId","name","label")===s&&n.push(a)}),n}function yc(e,s){const n=[];return Ye(e,a=>{Xe(a,"resource-id","resourceId","identifier")===s&&n.push(a)}),n}function Rs(e,s){const n=[];return Ye(e,a=>{(a.type===s||$t(a)===s)&&n.push(a)}),n}function xc(e,s){const n=[];return Ye(e,a=>{Xe(a,"name")===s&&n.push(a)}),n}function gc(e){const s=/^\/\/(\*|[A-Za-z_][\w.-]*)\[@([\w-]+)=(["'])(.*?)\3\]$/.exec(e.trim());return s?{tag:s[1]==="*"?null:s[1],attrKey:s[2],attrValue:s[4]}:null}function jc(e,s){const n=s.split("/").filter(Boolean);if(n.length===0)return null;const a=[];for(const i of n){const c=/^([A-Za-z_][\w.-]*)\[(\d+)\]$/.exec(i);if(!c)return null;a.push({type:c[1],index:parseInt(c[2],10)})}if(a[0].type!==e.type&&a[0].type!==$t(e)||a[0].index!==1)return null;let r=e;for(let i=1;i<a.length&&r;i++){const{type:c,index:h}=a[i];let d=0,o;for(const u of r.children||[])if((u.type===c||$t(u)===c)&&(d+=1,d===h)){o=u;break}r=o}return r?[r]:[]}function bc(e,s){const n=jc(e,s);if(n!==null)return{kind:"matched",nodes:n};const a=gc(s);if(a){const r=[];return Ye(e,i=>{if(a.tag&&i.type!==a.tag&&$t(i)!==a.tag)return;Xe(i,a.attrKey)===a.attrValue&&r.push(i)}),{kind:"matched",nodes:r}}return{kind:"unsupported",nodes:[],reason:"Complex XPath (axes, multiple predicates, functions) — use a real driver to verify"}}function wc(e,s){const n=s.trim(),a=/^\*\*\/([A-Za-z_]\w*)\[`(\w+)\s*==\s*"([^"]*)"`\]$/.exec(n);if(a){const[,c,h,d]=a,o=[];return Ye(e,u=>{if(u.type!==c&&$t(u)!==c)return;Xe(u,h)===d&&o.push(u)}),{kind:"matched",nodes:o}}const r=/^\*\*\/([A-Za-z_]\w*)\[(\d+)\]$/.exec(n);if(r){const[,c,h]=r,d=parseInt(h,10),o=[];return Ye(e,u=>{(u.type===c||$t(u)===c)&&o.push(u)}),{kind:"matched",nodes:o[d-1]?[o[d-1]]:[]}}const i=/^\*\*\/([A-Za-z_]\w*)$/.exec(n);return i?Rs(e,i[1]).length>0?{kind:"matched",nodes:Rs(e,i[1])}:{kind:"matched",nodes:[]}:{kind:"unsupported",nodes:[],reason:"Multi-segment class chain — use a real driver to verify"}}function kc(e,s){const a=s.trim().split(/\s+AND\s+/i).map(c=>c.trim()),r=[];for(const c of a){const h=/^(\w+)\s*==\s*"([^"]*)"$/.exec(c);if(!h)return{kind:"unsupported",nodes:[],reason:"Predicate uses unsupported operator (only ==, AND) — use a real driver"};r.push({key:h[1],value:h[2]})}const i=[];return Ye(e,c=>{for(const h of r){let d;if(h.key==="type"?d=c.type:h.key==="label"?d=Xe(c,"label")??c.label:h.key==="name"?d=Xe(c,"name")??c.name:h.key==="value"?d=Xe(c,"value")??c.value:d=Xe(c,h.key),d!==h.value)return}i.push(c)}),{kind:"matched",nodes:i}}function Es(e,s,n){const a=s.toLowerCase();if(!n)return{kind:"matched",nodes:[]};switch(a){case"accessibility id":return{kind:"matched",nodes:vc(e,n)};case"id":return{kind:"matched",nodes:yc(e,n)};case"class name":return{kind:"matched",nodes:Rs(e,n)};case"name":return{kind:"matched",nodes:xc(e,n)};case"xpath":return bc(e,n);case"-ios class chain":return wc(e,n);case"-ios predicate string":return kc(e,n);default:return{kind:"unsupported",nodes:[],reason:`Strategy "${s}" not yet supported by snapshot matcher`}}}function kn(e){return{"accessibility id":1,id:2,"-ios predicate string":3,"-ios class chain":4,"-android uiautomator":3,"class name":8,xpath:9,name:10,"link text":10}[e.toLowerCase()]??7}function As(e,s){const n=e.toLowerCase();if(n==="accessibility id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(s)?{level:"fragile",reason:"UUID in accessibility ID — dynamically generated, unreliable"}:{level:"stable",reason:"#1 recommended by Appium — portable across Android & iOS"};if(n==="id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(s)?{level:"fragile",reason:"UUID in resource ID — dynamically generated"}:/\d{6,}/.test(s)&&!s.includes(":id/")?{level:"moderate",reason:"Long numeric ID without package prefix — may not be unique"}:/^[a-z][a-z0-9.]+:id\//.test(s)?{level:"stable",reason:"Android resource-id with package prefix — #2 by Appium priority"}:{level:"stable",reason:"Element ID — #2 by Appium 2.x recommended priority"};if(n==="xpath"){if(s.startsWith("/hierarchy")||s.startsWith("/")&&!s.startsWith("//"))return{level:"very-fragile",reason:"ABSOLUTE XPath — breaks on any layout change. Avoid entirely"};if(/\[\d+\]/.test(s))return{level:"very-fragile",reason:"Index-based XPath [n] — breaks when element order changes"};const a=(s.match(/\//g)||[]).length;return a>7?{level:"fragile",reason:`${a}-level deep XPath — brittle to layout changes, 10x slower on iOS`}:s.includes("@content-desc")||s.includes("@resource-id")||s.includes("@text")?{level:"moderate",reason:"XPath with semantic attribute — more stable, but still prefer ID/accessibility id"}:{level:"fragile",reason:"XPath is a LAST RESORT per Appium docs — 10x slower on iOS, breaks on UI changes"}}return n==="-ios predicate string"?{level:"stable",reason:"iOS NSPredicate — native engine, excellent performance on iOS"}:n==="-ios class chain"?{level:"stable",reason:"iOS Class Chain — native iOS, faster than XPath"}:n==="-android uiautomator"?s.includes("resourceId")||s.includes("description")?{level:"stable",reason:"UIAutomator2 with resourceId/description — Android native, very reliable"}:s.includes("textContains")||s.includes("text(")?{level:"moderate",reason:"UIAutomator2 with text matching — breaks if copy changes"}:{level:"stable",reason:"UIAutomator2 — Android native engine, preferred over XPath on Android"}:n==="class name"?{level:"fragile",reason:"Class name alone is almost never unique — use with explicit index or prefer accessibility id"}:n==="name"?{level:"fragile",reason:"⚠️ Deprecated in Appium 2.x — replace with accessibility id or id"}:n==="link text"?{level:"moderate",reason:"Text-based locator — breaks if copy/label changes"}:{level:"moderate",reason:"Verify reliability for your target platform"}}function Ca(e){return[...e].sort((s,n)=>kn(s.strategy)-kn(n.strategy))}const qt=e=>e===!0||e==="true",Nc=/^XCUIElementType(Button|Cell|Switch|Slider|TextField|SecureTextField|SearchField|TextView|Link|Tab|SegmentedControl|Stepper|PickerWheel|Key|MenuItem)$/,Cc=/(EditText|AutoCompleteTextView)$/;function Sa(e){const s=e.attributes||{};return qt(s.clickable)||qt(s["long-clickable"])||qt(s.checkable)||qt(s.scrollable)||Cc.test(e.type||"")||Nc.test(e.type||"")}function Sc(e){const s=e.attributes||{};return String(e.text||s["content-desc"]||e.label||s.label||s.name||"").trim()}function $c(e,s){const n="Unique locator",a=Ca(e.suggestedLocators||[]),r=a[0];if(!r)return{id:"unique",label:n,status:"fail",detail:"No locator suggested"};const i=Es(s.hierarchy,r.strategy,r.value),c=`${r.strategy} ${r.value}`;if(i.kind==="unsupported")return{id:"unique",label:n,status:"info",detail:`Can’t check ${r.strategy} locators here`};const h=v=>v.length===1&&v[0].xpath===e.xpath;if(h(i.nodes))return{id:"unique",label:n,status:"pass",detail:`${c} matches only this element`};const d=a.slice(1).find(v=>{const f=Es(s.hierarchy,v.strategy,v.value);return f.kind==="matched"&&h(f.nodes)}),o=d?`; use ${d.strategy} ${d.value} instead`:"",u=i.nodes.length,p=u===0?"matches nothing in this capture":`matches ${u} elements`;return{id:"unique",label:n,status:"fail",detail:`${c} ${p}${o}`}}function Tc(e){const s=Ca(e.suggestedLocators||[])[0];if(!s)return null;const{level:n,reason:a}=As(s.strategy,s.value);return{id:"stable",label:"Stable locator",status:n==="stable"||n==="moderate"?"pass":"warn",detail:a}}function Rc(e,s){const{screenWidth:n,screenHeight:a}=s.metadata||{screenWidth:0,screenHeight:0};if(!n||!a)return null;const{x:r,y:i,width:c,height:h}=e.rect,d="On screen";return r+c<=0||i+h<=0||r>=n||i>=a?{id:"onscreen",label:d,status:"warn",detail:"Off screen — scroll it into view first"}:r<0||i<0||r+c>n||i+h>a?{id:"onscreen",label:d,status:"warn",detail:"Partly off screen — scroll it into view first"}:{id:"onscreen",label:d,status:"pass",detail:"Fully inside the screen"}}function Ec(e,s){var h,d;const n=Sa(e),a=!(((h=e.attributes)==null?void 0:h.enabled)===!1||((d=e.attributes)==null?void 0:d.enabled)==="false"),r=e.rect.width>0&&e.rect.height>0,i=Sc(e);return[$c(e,s),Tc(e),n?{id:"interactive",label:"Interactive",status:"pass",detail:"Can be tapped, typed into or scrolled"}:{id:"interactive",label:"Interactive",status:"info",detail:"Not interactive — a tap here goes to whatever is under it"},a?{id:"enabled",label:"Enabled",status:"pass",detail:"Enabled"}:{id:"enabled",label:"Enabled",status:"fail",detail:"Disabled — taps are ignored"},r?{id:"size",label:"Has size",status:"pass",detail:`${e.rect.width} × ${e.rect.height}`}:{id:"size",label:"Has size",status:"fail",detail:"Zero-size — it can’t be tapped or seen"},Rc(e,s),n?i?{id:"name",label:"Accessible name",status:"pass",detail:`“${i.slice(0,40)}”`}:{id:"name",label:"Accessible name",status:"warn",detail:"No accessible name — screen readers and accessibility-id locators have nothing to use"}:null].filter(o=>o!==null)}function Ac(e){return{pass:e.filter(s=>s.status==="pass").length,warn:e.filter(s=>s.status==="warn").length,fail:e.filter(s=>s.status==="fail").length}}function Dc(e,s){const n=Math.max(0,Math.round((s-e)/1e3));if(n<5)return"Captured just now";if(n<60)return`Captured ${n} s ago`;const a=Math.floor(n/60);return a<60?`Captured ${a} min ago`:`Captured ${Math.floor(a/60)} h ago`}function Mc(e,s){return e>0&&s>e}function $a(e){var i,c,h,d,o;const s=(e.type||"").toLowerCase(),n=((i=e.attributes)==null?void 0:i.clickable)==="true"||((c=e.attributes)==null?void 0:c.clickable)===!0,a=((h=e.attributes)==null?void 0:h.scrollable)==="true"||((d=e.attributes)==null?void 0:d.scrollable)===!0,r=((o=e.children)==null?void 0:o.length)||0;return s.includes("button")||s.includes("btn")||n&&r===0?{role:"Button",key:"button"}:s.includes("edit")||s.includes("input")||s.includes("field")?{role:"Text input",key:"input"}:s.includes("image")||s.includes("img")||s.includes("imageview")?{role:"Image",key:"image"}:s.includes("scroll")||s.includes("recyclerview")||s.includes("listview")||a?{role:"Scrollable list",key:"list"}:s.includes("text")||s.includes("label")?{role:"Text label",key:"text"}:s.includes("switch")||s.includes("toggle")||s.includes("checkbox")?{role:"Toggle or checkbox",key:"toggle"}:s.includes("nav")||s.includes("toolbar")||s.includes("tabbar")?{role:"Navigation bar",key:"nav"}:r>0?{role:"Container",key:"container"}:{role:"Element",key:"element"}}const Ta={button:t.jsx(Xi,{size:13}),input:t.jsx(ho,{size:13}),image:t.jsx(Ei,{size:13}),list:t.jsx(ma,{size:13}),text:t.jsx(go,{size:13}),toggle:t.jsx(vo,{size:13}),nav:t.jsx(Ji,{size:13}),container:t.jsx(ra,{size:13}),element:t.jsx(ui,{size:13})};function Ra(e,s){if(!s)return!0;const n=s.toLowerCase().trim(),a={button:["button","btn","clickable","tapable"],input:["edittext","input","field","textfield","textinput","edit"],image:["image","imageview","img","picture","photo","icon"],text:["textview","label","text","statictext"],list:["listview","recyclerview","scrollview","tableview","collectionview","scroll"],toggle:["switch","checkbox","toggle","radiobutton"],nav:["toolbar","navigationbar","tabbar","actionbar","navbar"]},r=(e.type||"").toLowerCase(),i=(e.text||e.label||e.value||"").toLowerCase(),c=(e.name||"").toLowerCase(),h=Object.values(e.attributes||{}).join(" ").toLowerCase();for(const[d,o]of Object.entries(a))if(n.includes(d)&&o.some(u=>r.includes(u)))return!0;return r.includes(n)||i.includes(n)||c.includes(n)||h.includes(n)}const _e=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"";function zc(e){const s=_e(e),n=s.indexOf(":id/");return n>=0?s.slice(n+4):s}function Ea(e){return(e.type||"").split(".").pop()||""}function ss(e){var s;return[e.type,(s=e.attributes)==null?void 0:s["resource-id"],e.text].filter(n=>typeof n=="string"&&n.trim()!=="").join(`
|
|
237
|
+
`)}function pt(e){const s=e.attributes||{};return _e(e.text)||_e(s["content-desc"])||_e(e.label)||_e(s.label)||zc(s["resource-id"])||_e(s.name)||Ea(e)||"Element"}const Lc=e=>{const s=e.attributes||{};return!!(_e(e.text)||_e(s["content-desc"])||_e(e.label)||_e(s.label))};function Ic(e){var s;return(((s=e.children)==null?void 0:s.length)??0)===1&&!Sa(e)&&!Lc(e)}function Aa(e){const s=[e];let n=e;for(;Ic(n);)n=n.children[0],s.push(n);return s}function Da(e,s){const n=new Set;if(!e||!s.trim())return n;const a=r=>{var i;Ra(r,s)&&n.add(r.xpath),(i=r.children)==null||i.forEach(a)};return a(e),n}function _c(e,s){const n=new Set;if(!e||!s.trim())return n;const a=r=>{let i=!1;for(const c of r.children||[])a(c)&&(i=!0);return i&&n.add(r.xpath),i||Ra(r,s)};return a(e),n}function Oc(e,s,n=""){if(!e)return[];const a=!!n.trim(),r=a?Da(e,n):null,i=a?_c(e,n):null,c=o=>!a||o.some(u=>r.has(u.xpath)||i.has(u.xpath)),h=[],d=(o,u,p)=>{const v=o.map(Aa).filter(c);v.forEach((f,g)=>{var w;const k=f[f.length-1],b=(((w=k.children)==null?void 0:w.length)??0)>0,U=a&&i.has(k.xpath),N=b&&(s.has(k.xpath)||U);h.push({key:k.xpath,nodes:f,level:u,setSize:v.length,posInSet:g+1,hasChildren:b,expanded:N,collapsible:N&&!U,parentKey:p}),N&&d(k.children,u+1,k.xpath)})};return d([e],1,null),h}function Fc(e,s=3){const n=new Set,a=(r,i)=>{var d;const c=Aa(r),h=c[c.length-1];i>s||!((d=h.children)!=null&&d.length)||(n.add(h.xpath),h.children.forEach(o=>a(o,i+1)))};return e&&a(e,1),n}function Qt(e,s){if(!e)return null;if(e.xpath===s)return[e];for(const n of e.children||[]){const a=Qt(n,s);if(a)return[e,...a]}return null}function Nn(e,s){return e.findIndex(n=>n.nodes.some(a=>a.xpath===s))}function Pc(e,s,n){var r;const a=e[s];if(!a)return null;switch(n){case"ArrowDown":return s<e.length-1?{focus:s+1}:null;case"ArrowUp":return s>0?{focus:s-1}:null;case"ArrowRight":return a.hasChildren?a.expanded?((r=e[s+1])==null?void 0:r.parentKey)===a.key?{focus:s+1}:null:{toggle:a.key}:null;case"ArrowLeft":{if(a.collapsible)return{toggle:a.key};const i=e.findIndex(c=>c.key===a.parentKey);return i>=0?{focus:i}:null}case"Home":return{focus:0};case"End":return{focus:e.length-1};case"Enter":case" ":return{select:a.nodes[a.nodes.length-1]};default:return null}}const Uc=10;function Bc({rows:e,selectedXpath:s,hoveredXpath:n,matches:a,onToggle:r,onSelect:i,onHover:c,revealSeq:h=0}){const d=l.useRef(null),[o,u]=l.useState(null),p=l.useRef(0),v=l.useRef(null),f=s?Nn(e,s):-1,g=o?e.findIndex(j=>j.key===o):-1,k=g>=0?g:Math.max(f,0),b=j=>{var A;return((A=d.current)==null?void 0:A.querySelector(`[data-row="${j}"]`))??null},U=j=>j.nodes[j.nodes.length-1],N=j=>{var $;const A=e[j];if(!A)return;u(A.key),p.current=j;const T=b(j);T==null||T.focus({preventScroll:!0}),($=T==null?void 0:T.scrollIntoView)==null||$.call(T,{block:"nearest"})};l.useEffect(()=>{v.current=s},[s,h]),l.useEffect(()=>{var T,$;const j=v.current;if(!j)return;const A=Nn(e,j);A<0||(($=(T=b(A))==null?void 0:T.scrollIntoView)==null||$.call(T,{block:"nearest"}),v.current=null)}),l.useEffect(()=>{var T,$;if(!o||e.some(m=>m.key===o))return;const j=Math.min(p.current,e.length-1),A=!document.activeElement||document.activeElement===document.body;u(((T=e[j])==null?void 0:T.key)??null),A&&j>=0&&(($=b(j))==null||$.focus({preventScroll:!0}))});const w=j=>{const A=j.target;if(A.getAttribute("role")!=="treeitem")return;const T=Pc(e,Number(A.dataset.row),j.key);T&&(j.preventDefault(),"focus"in T?N(T.focus):"toggle"in T?r(T.toggle):i(T.select))},C=j=>{var A;(A=d.current)!=null&&A.contains(j.relatedTarget)||(c(null),u(null))};return t.jsx("div",{ref:d,role:"tree","aria-label":"Element tree",className:"omni-tree",onKeyDown:w,onBlur:C,children:e.map((j,A)=>{const T=U(j),$=x=>!!x&&j.nodes.some(z=>z.xpath===x),m=$(s),S=!m&&$(n),I=pt(T),B=Ea(T),L=!!B&&B!==I,Y=j.nodes.map(x=>pt(x)).join(", "),ee=L?`${Y}, ${B}`:Y,J=j.expanded&&!j.collapsible,H=(x,z)=>`omni-tree-row__part${z?" is-target":""}${a.has(x.xpath)?" is-match":""}${x.xpath===s?" is-current":""}`;return t.jsxs("div",{"data-row":A,role:"treeitem","aria-level":j.level,"aria-setsize":j.setSize,"aria-posinset":j.posInSet,"aria-selected":m,"aria-expanded":j.hasChildren?j.expanded:void 0,"aria-label":ee,tabIndex:A===k?0:-1,className:`omni-tree-row${m?" is-selected":""}${S?" is-hovered":""}`,onClick:()=>i(T),onFocus:x=>{x.target===x.currentTarget&&(u(j.key),p.current=A,c(T))},onMouseEnter:()=>c(T),onMouseLeave:()=>c(null),children:[t.jsxs("span",{className:"omni-tree-row__lead","aria-hidden":"true",children:[t.jsx("span",{className:"omni-tree-row__indent",style:{width:(j.level-1)*Uc}}),t.jsx("span",{className:`omni-tree-row__caret${J?" is-locked":""}`,onClick:j.hasChildren?x=>{x.stopPropagation(),J||r(j.key)}:void 0,children:j.hasChildren&&(j.expanded?t.jsx(fr,{size:12}):t.jsx(Vr,{size:12}))}),t.jsx("span",{className:"omni-tree-row__icon",children:Ta[$a(T).key]})]}),t.jsxs("span",{className:"omni-tree-row__label",children:[j.nodes.length>1&&t.jsx("span",{className:"omni-tree-row__head",children:j.nodes.slice(0,-1).map((x,z)=>t.jsxs(ft.Fragment,{children:[z>0&&t.jsx("span",{className:"omni-tree-row__sep","aria-hidden":"true",children:"›"}),t.jsx("span",{className:H(x,!1),title:ss(x),onClick:V=>{V.stopPropagation(),i(x)},onMouseEnter:()=>c(x),onMouseLeave:()=>c(T),children:pt(x)})]},x.xpath))}),t.jsxs("span",{className:"omni-tree-row__tail",children:[j.nodes.length>1&&t.jsx("span",{className:"omni-tree-row__sep","aria-hidden":"true",children:"›"}),t.jsxs("span",{className:"omni-tree-row__name",children:[t.jsx("span",{className:H(T,!0),title:ss(T),children:pt(T)}),L&&t.jsx("span",{className:"omni-tree-row__type",children:B})]})]})]}),j.hasChildren&&!j.expanded&&t.jsx("span",{className:"omni-tree-row__count","aria-hidden":"true",children:T.children.length})]},j.key)})})}const Cn=4;function Hc({path:e,onSelect:s,focusCurrent:n=!1}){const[a,r]=l.useState(!1),i=l.useRef(null),c=l.useRef(null);if(l.useEffect(()=>{var u;n&&((u=c.current)==null||u.focus())},[]),l.useEffect(()=>{var u;a&&((u=i.current)==null||u.focus())},[a]),!e.length)return null;const h=e[e.length-1],d=e.slice(0,-1),o=!a&&d.length>Cn?d.length-Cn:0;return t.jsx("nav",{"aria-label":"Element path",className:"omni-crumbs",children:t.jsxs("ol",{children:[o>0&&t.jsx("li",{children:t.jsx("button",{type:"button",className:"omni-crumb","aria-label":`Show all ${d.length} ancestors`,onClick:()=>r(!0),children:"…"})}),d.slice(o).map((u,p)=>t.jsx("li",{children:t.jsx("button",{ref:p===0?i:void 0,type:"button",className:"omni-crumb",title:ss(u),"aria-label":pt(u),onClick:()=>s(u),children:pt(u)})},u.xpath)),t.jsx("li",{children:t.jsx("span",{ref:c,tabIndex:-1,className:"omni-crumb is-current","aria-current":"location",title:ss(h),children:pt(h)})})]})})}const ns=.4,Vc=240,Wc=340,Sn=.02,as=12,Ma="xenon.omni.split";function za(e){if(!(e>0))return{min:0,max:1};const s=Math.min(1,Vc/e);return{min:s,max:Math.max(s,(e-Wc)/e)}}function qc(e,s){const{min:n,max:a}=za(s),r=Number.isFinite(e)?e:ns;return Math.min(a,Math.max(n,r))}function Kc(e){try{const s=Number.parseFloat((e==null?void 0:e.getItem(Ma))??"");return s>0&&s<1?s:ns}catch{return ns}}function Xc(e,s){try{e==null||e.setItem(Ma,String(Math.round(s*1e3)/1e3))}catch{}}function $n(){try{return window.localStorage}catch{return null}}const Yc=3;function Gc({share:e,limits:s,containerRef:n,onChange:a,onCommit:r,onReset:i}){const[c,h]=l.useState(!1),d=l.useRef(e);d.current=e;const o=l.useRef(!0),u=l.useRef(!1),p=l.useRef(0),v=l.useRef(e),f=N=>Math.min(s.max,Math.max(s.min,N)),g=N=>Math.round(N*100),k=()=>{o.current||(o.current=!0,h(!1),u.current&&r(d.current))},b=N=>{var C;const w=(C=n.current)==null?void 0:C.getBoundingClientRect();return!w||w.width<=as?d.current:f(v.current+(N-p.current)/(w.width-as))},U=N=>{const w=N.key==="ArrowLeft"?e-Sn:N.key==="ArrowRight"?e+Sn:N.key==="Home"?s.min:N.key==="End"?s.max:null;w!==null&&(N.preventDefault(),r(f(Math.round(w*1e3)/1e3)))};return t.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize element tree","aria-valuenow":g(e),"aria-valuemin":g(s.min),"aria-valuemax":g(s.max),tabIndex:0,className:`omni-split-divider${c?" is-dragging":""}`,onKeyDown:U,onDoubleClick:i,onPointerDown:N=>{var w,C;(C=(w=N.currentTarget).setPointerCapture)==null||C.call(w,N.pointerId),o.current=!1,u.current=!1,p.current=N.clientX,v.current=d.current,h(!0)},onPointerMove:N=>{if(!c||!u.current&&Math.abs(N.clientX-p.current)<Yc)return;const w=b(N.clientX);w!==d.current&&(u.current=!0,a(w))},onPointerUp:N=>{var w,C;(C=(w=N.currentTarget).releasePointerCapture)==null||C.call(w,N.pointerId),k()},onPointerCancel:N=>{var w,C;(C=(w=N.currentTarget).releasePointerCapture)==null||C.call(w,N.pointerId),k()},onLostPointerCapture:k,children:t.jsx("span",{className:"omni-split-divider__grip","aria-hidden":"true"})})}function Tn(e,s,n,a){var N,w,C,j,A,T,$;const{strategy:r,value:i}=a,c=(e.text||e.name||((N=e.type)==null?void 0:N.split(".").pop())||"element").replace(/[^a-zA-Z0-9]/g,"_").replace(/^_+/,"").slice(0,24)||"element",h=c.charAt(0).toLowerCase()+c.slice(1),d=((w=e.type)==null?void 0:w.toLowerCase().includes("edit"))||((C=e.type)==null?void 0:C.toLowerCase().includes("input"))||((j=e.type)==null?void 0:j.toLowerCase().includes("field"))||((A=e.type)==null?void 0:A.toLowerCase().includes("textfield")),o=((T=e.attributes)==null?void 0:T.scrollable)==="true"||(($=e.attributes)==null?void 0:$.scrollable)===!0,u=r.toLowerCase().startsWith("-ios")&&s!=="ios"?`// ⚠️ -ios predicate/class chain ONLY work with XCUITest (iOS)
|
|
238
|
+
`:r.toLowerCase().startsWith("-android")&&s!=="android"?`// ⚠️ -android uiautomator ONLY works with UIAutomator2 (Android)
|
|
239
|
+
`:"",p={"accessibility id":`~${i}`,id:s==="ios"?`-ios predicate string:label == "${i}"`:`android=new UiSelector().resourceId("${i}")`,xpath:`${i}`,"-ios predicate string":`-ios predicate string:${i}`,"-ios class chain":`-ios class chain:${i}`,"-android uiautomator":`android=${i}`},v={"accessibility id":`AppiumBy.accessibilityId("${i}")`,id:`AppiumBy.id("${i}")`,xpath:`AppiumBy.xpath("${i}")`,"-ios predicate string":`AppiumBy.iOSNsPredicateString("${i}")`,"-ios class chain":`AppiumBy.iOSClassChain("${i}")`,"-android uiautomator":`AppiumBy.androidUIAutomator("${i}")`,"class name":`AppiumBy.className("${i}")`},f={"accessibility id":`AppiumBy.ACCESSIBILITY_ID, "${i}"`,id:`AppiumBy.ID, "${i}"`,xpath:`AppiumBy.XPATH, "${i}"`,"-ios predicate string":`AppiumBy.IOS_PREDICATE, "${i}"`,"-ios class chain":`AppiumBy.IOS_CLASS_CHAIN, "${i}"`,"-android uiautomator":`AppiumBy.ANDROID_UIAUTOMATOR, '${i}'`,"class name":`AppiumBy.CLASS_NAME, "${i}"`},g=v[r.toLowerCase()],k=f[r.toLowerCase()],b=p[r.toLowerCase()];return n==="java"?g?`${u}// Appium Java Client 9.x + Selenium 4 + TestNG
|
|
240
|
+
import io.appium.java_client.AppiumBy;
|
|
241
|
+
import io.appium.java_client.${s==="android"?"AndroidDriver":s==="ios"?"IOSDriver":"AppiumDriver"};
|
|
242
|
+
import org.openqa.selenium.WebElement;
|
|
243
|
+
import org.testng.annotations.Test;
|
|
244
|
+
|
|
245
|
+
@Test
|
|
246
|
+
public void test_${h}() {
|
|
247
|
+
WebElement element = driver.findElement(${g});
|
|
248
|
+
${o?'((Scrollable) element).scrollTo("target text");':d?`element.clear();
|
|
249
|
+
element.sendKeys("your text here");`:"element.click();"}
|
|
250
|
+
// Add assertions here via TestNG Assert or Hamcrest
|
|
251
|
+
}`:`// Strategy "${r}" not supported in Appium Java Client`:n==="python"?k?`${u}# Appium Python Client 4.x + pytest
|
|
252
|
+
from appium.webdriver.common.appiumby import AppiumBy
|
|
253
|
+
import pytest
|
|
254
|
+
|
|
255
|
+
def test_${h}(self):
|
|
256
|
+
element = self.driver.find_element(${k})
|
|
257
|
+
${d?`element.clear()
|
|
258
|
+
element.send_keys("your text here")`:"element.click()"}
|
|
259
|
+
# Add assertions here via assert or pytest.assert`:`# Strategy "${r}" not supported in Appium Python Client`:n==="javascript"?b?`${u}// WebdriverIO 9.x + @wdio/appium-service
|
|
260
|
+
describe('${h} test', () => {
|
|
261
|
+
it('should interact with ${h}', async () => {
|
|
262
|
+
const element = await $('${b}');
|
|
263
|
+
await element.waitForDisplayed({ timeout: 5000 });
|
|
264
|
+
${d?`await element.clearValue();
|
|
265
|
+
await element.addValue("your text here");`:"await element.click();"}
|
|
266
|
+
// Add assertions here via expect(element)
|
|
267
|
+
});
|
|
268
|
+
});`:`// Strategy "${r}" not supported in WebdriverIO mobile`:b?`${u}// WebdriverIO 9.x standalone
|
|
269
|
+
const element = await driver.$('${b}');
|
|
270
|
+
await element.waitForExist({ timeout: 5000 });
|
|
271
|
+
${d?`await driver.$('target').clearValue();
|
|
272
|
+
await element.addValue("your text here");`:"await element.click();"}
|
|
273
|
+
// Assert with expect(element).toBeDisplayed()`:`// Strategy "${r}" not supported in WebdriverIO mobile`}const Zc={pass:t.jsx(oa,{size:13}),warn:t.jsx(Ke,{size:13}),fail:t.jsx(ca,{size:13}),info:t.jsx(Jn,{size:13})},Jc={pass:"passed",warn:"warning",fail:"failed",info:"note"},Qc={java:"Java",python:"Python",javascript:"JavaScript",wdio:"WebdriverIO"},el=({sessionId:e,udid:s,streamUrl:n,embedded:a=!1,overlayTarget:r=null,onModeChange:i,deviceActionAt:c=0})=>{var tn,sn,nn,an,rn,on;const[h,d]=l.useState(!0),[o,u]=l.useState(null),[p,v]=l.useState(null),[f,g]=l.useState(null),[k,b]=l.useState(0),U=l.useRef(!1),[N,w]=l.useState(null),[C,j]=l.useState(()=>new Set),[A,T]=l.useState(""),[$,m]=l.useState(null),[S,I]=l.useState("info"),[B,L]=l.useState(0),[Y,ee]=l.useState(0),[J,H]=l.useState(()=>Date.now()),x=l.useRef(0),z=l.useRef(null),[V,M]=l.useState("java"),[W,ae]=l.useState(null),[K,ne]=l.useState({width:0,height:0}),[re,be]=l.useState({width:0,height:0}),[E,ie]=l.useState(!1),[te,se]=l.useState("inspect");l.useEffect(()=>{i==null||i(te)},[te,i]);const[me,ue]=l.useState({}),[Te,rt]=l.useState({}),[it,Ge]=l.useState(null),[he,Ze]=l.useState(null),[Pe,Ce]=l.useState(null),Ae=l.useRef(null),ot=l.useRef(null),ze=l.useRef(null),Ue=l.useRef(null),Je=l.useRef(null),[jt,Be]=l.useState(()=>Kc($n())),[Qe,bt]=l.useState(0);l.useEffect(()=>{const y=Je.current;if(!y||typeof ResizeObserver>"u")return;const R=new ResizeObserver(([D])=>bt(Math.max(0,D.contentRect.width-as)));return R.observe(y),()=>R.disconnect()},[]);const He=qc(jt,Qe),wt=y=>{Be(y),Xc($n(),y)},Le=l.useCallback(()=>{var Ve,We,et;if(!Ae.current)return;const y=Ae.current.getBoundingClientRect(),R=y.width,D=y.height,O=(Ve=o==null?void 0:o.hierarchy)==null?void 0:Ve.rect;let G=((We=o==null?void 0:o.metadata)==null?void 0:We.screenWidth)||K.width||1,P=((et=o==null?void 0:o.metadata)==null?void 0:et.screenHeight)||K.height||1;O&&O.width>0&&O.height>0&&(G=O.width,P=O.height);const le=G/P;let Ie,De;R/D>le?(De=D,Ie=De*le):(Ie=R,De=Ie/le),be({width:Ie,height:De})},[o,K]);l.useEffect(()=>(Le(),window.addEventListener("resize",Le),()=>window.removeEventListener("resize",Le)),[Le]),l.useEffect(()=>{s&&ce()},[s]);const ct=l.useCallback(async(y,R,D)=>{if(he!=null&&he.sessionId){Ge(y);try{const O=await q.verifyLocator(he.basePath,he.sessionId,{strategy:y,selector:R,action:D});rt(G=>({...G,[y]:O})),D==="tap"&&ee(Date.now())}catch(O){rt(G=>({...G,[y]:{found:!1,count:0,error:(O==null?void 0:O.message)||String(O)}}))}finally{Ge(null)}}},[he]),_=l.useRef(null);l.useEffect(()=>{const y=!!f&&f.xpath===_.current;_.current=(f==null?void 0:f.xpath)??null;const R=(f==null?void 0:f.suggestedLocators)??[];ae(D=>{const O=y&&D?R.find(P=>P.strategy===D.strategy):null,G=R.find(P=>P.strategy==="accessibility id"||P.strategy==="id");return O||G||R[0]||null}),ue({}),rt({}),Ce(null)},[f]);const Q=l.useCallback((y,R)=>{if(!(o!=null&&o.hierarchy))return;const D=Es(o.hierarchy,y,R);ue(O=>({...O,[y]:D})),Ce(y)},[o]),ce=async()=>{if(!s)return;const y=++x.current,R=()=>y===x.current;d(!0),v(null),q.getAppiumSession(s).then(D=>{R()&&Ze({sessionId:(D==null?void 0:D.sessionId)??null,basePath:(D==null?void 0:D.basePath)??""})}).catch(()=>{R()&&Ze({sessionId:null,basePath:""})});try{const D=await q.getInspectorSnapshot(s);if(!R())return;if(!(D!=null&&D.hierarchy)){u(null),v((D==null?void 0:D.error)||"Failed to capture snapshot");return}const O=D.udid||s,G=O===z.current;z.current=O,fn.unstable_batchedUpdates(()=>{u(D),L(Date.now()),j(Fc(D.hierarchy)),g(P=>{var le;return P&&G?((le=Qt(D.hierarchy,P.xpath))==null?void 0:le.pop())??null:null}),b(P=>P+1)})}catch(D){if(!R())return;u(null),v(D.message||"Failed to capture snapshot")}finally{R()&&d(!1)}};l.useEffect(()=>{const y=setInterval(()=>H(Date.now()),1e4);return()=>clearInterval(y)},[]);const Se=y=>{const{naturalWidth:R,naturalHeight:D}=y.currentTarget;ne({width:R,height:D})},X=()=>ie(!0),oe=y=>{ie(!1);const{naturalWidth:R,naturalHeight:D}=y.currentTarget;R>0&&D>0&&ne({width:R,height:D})},fe=n&&!E,pe=y=>{if(te!=="interact"||!s)return;const R=y.currentTarget.getBoundingClientRect();Ue.current={x:y.clientX-R.left,y:y.clientY-R.top,time:Date.now()}},Re=async y=>{var ln,dn,un;if(te!=="interact"||!s||!Ue.current)return;const R=Ue.current,D=y.currentTarget.getBoundingClientRect(),O=y.clientX-D.left,G=y.clientY-D.top,P=Date.now()-R.time,le=re.width,Ie=re.height,De=(ln=o==null?void 0:o.hierarchy)==null?void 0:ln.rect;let Ve=((dn=o==null?void 0:o.metadata)==null?void 0:dn.screenWidth)||K.width,We=((un=o==null?void 0:o.metadata)==null?void 0:un.screenHeight)||K.height;if(De&&De.width>0&&De.height>0&&(Ve=De.width,We=De.height),!Ve||!We||le===0||Ie===0)return;const et=(Vt,hn)=>({x:Math.round(Vt/le*Ve),y:Math.round(hn/Ie*We),px:Vt/le,py:hn/Ie}),$e=et(R.x,R.y),cn=et(O,G),ps=Math.sqrt(Math.pow(O-R.x,2)+Math.pow(G-R.y,2));if(!($e.px<0||$e.px>1||$e.py<0||$e.py>1)){try{P<500&&ps<10?await q.tap(s,$e.x,$e.y):P>=500&&ps<10?await q.touchAndHold(s,$e.x,$e.y,P):ps>=10&&await q.swipe(s,$e.x,$e.y,cn.x,cn.y),ee(Date.now())}catch(Vt){console.error("Interaction failed:",Vt)}Ue.current=null}},ve=y=>{j(R=>{const D=new Set(R);return D.has(y)?D.delete(y):D.add(y),D})},we=()=>{const y=new Set,R=D=>{var O;y.add(D.xpath),(O=D.children)==null||O.forEach(R)};o!=null&&o.hierarchy&&R(o.hierarchy),j(y)},xe=()=>j(new Set),ye=(y,R)=>{navigator.clipboard.writeText(y),m(R),setTimeout(()=>m(null),2e3)},lt=y=>{var D;let R=1;return(D=y.children)==null||D.forEach(O=>R+=lt(O)),R},kt=y=>{if(!y)return[];const R={},D=O=>{var P;const G=$a(O);R[G.role]||(R[G.role]={key:G.key,count:0}),R[G.role].count+=1,(P=O.children)==null||P.forEach(D)};return D(y),Object.entries(R).map(([O,G])=>({role:O,key:G.key,count:G.count})).sort((O,G)=>G.count-O.count)},Ut=l.useMemo(()=>Oc(o==null?void 0:o.hierarchy,C,A),[o,C,A]),dt=l.useMemo(()=>Da(o==null?void 0:o.hierarchy,A),[o,A]),Tt=dt.size===0?"No matches":dt.size===1?"1 match":`${dt.size} matches`;l.useEffect(()=>{if(!f||!(o!=null&&o.hierarchy))return;const y=Qt(o.hierarchy,f.xpath);!y||y.length<2||j(R=>{const D=y.slice(0,-1).filter(G=>!R.has(G.xpath));if(!D.length)return R;const O=new Set(R);return D.forEach(G=>O.add(G.xpath)),O})},[k]),l.useEffect(()=>{U.current=!1});const Rt=y=>{g(y),b(R=>R+1),I("info")},lr=y=>{U.current=!0,Rt(y)},Zs=y=>{A.trim()&&!y.trim()&&b(R=>R+1),T(y)},us=()=>{var O,G,P;const y=(O=o==null?void 0:o.hierarchy)==null?void 0:O.rect;if(y&&y.width>0&&y.height>0)return{w:y.width,h:y.height};const R=((G=o==null?void 0:o.metadata)==null?void 0:G.screenWidth)||K.width,D=((P=o==null?void 0:o.metadata)==null?void 0:P.screenHeight)||K.height;return R>0&&D>0?{w:R,h:D}:null},Js=y=>{const R=us();if(!R)return[];const D=[],{w:O,h:G}=R,P=(le,Ie)=>{var Ve,We,et;const De=!le.children||le.children.length===0;((Ve=le.rect)==null?void 0:Ve.width)>0&&((We=le.rect)==null?void 0:We.height)>0&&De&&D.push(t.jsx("div",{className:"omni-hit-area",style:{left:`${le.rect.x/O*100}%`,top:`${le.rect.y/G*100}%`,width:`${le.rect.width/O*100}%`,height:`${le.rect.height/G*100}%`,zIndex:Ie},onClick:$e=>{$e.stopPropagation(),Rt(le)},onMouseEnter:()=>w(le),onMouseLeave:()=>w(null)},le.xpath)),(et=le.children)==null||et.forEach($e=>P($e,Ie+1))};return o!=null&&o.hierarchy&&P(o.hierarchy,1),D},Qs=()=>{const y=us();if(!Pe||!y)return[];const R=me[Pe];if(!R||R.kind!=="matched"||R.nodes.length===0)return[];const{w:D,h:O}=y,G=R.nodes.length===1?"omni-frame-match unique":"omni-frame-match multi";return R.nodes.filter(P=>P.rect&&P.rect.width>0&&P.rect.height>0).map((P,le)=>t.jsx("div",{className:G,style:{left:`${P.rect.x/D*100}%`,top:`${P.rect.y/O*100}%`,width:`${P.rect.width/D*100}%`,height:`${P.rect.height/O*100}%`}},`match-${Pe}-${le}`))},Bt=(y,R)=>{const D=us();if(!(y!=null&&y.rect)||!D)return null;const{w:O,h:G}=D;return t.jsx("div",{className:`omni-frame-${R}`,style:{left:`${y.rect.x/O*100}%`,top:`${y.rect.y/G*100}%`,width:`${y.rect.width/O*100}%`,height:`${y.rect.height/G*100}%`}})},hs=o!=null&&o.hierarchy?lt(o.hierarchy):0,Ht=f&&(o!=null&&o.hierarchy)?Ec(f,o):null,ut=Ht?Ac(Ht):null,ms=Mc(B,Math.max(c,Y)),fs=o!=null&&o.hierarchy&&te==="inspect"?t.jsxs("div",{className:`omni-overlay${ms?" is-stale":""}`,children:[Js(o.hierarchy),Qs(),Bt(N,"hover"),Bt(f,"select")]}):null,dr={stable:{icon:t.jsx(Wt,{size:10}),cls:"stable"},moderate:{icon:t.jsx(Ke,{size:10}),cls:"moderate"},fragile:{icon:t.jsx(Nt,{size:10}),cls:"fragile"},"very-fragile":{icon:t.jsx(Nt,{size:10}),cls:"very-fragile"}},en=a&&(o!=null&&o.hierarchy)?kt(o.hierarchy):[];return t.jsxs("div",{className:`omni-inspector-container ${a?"omni-embedded":""}`,children:[a&&r&&fs?fn.createPortal(fs,r):null,t.jsxs("div",{className:"omni-main-content",children:[!a&&t.jsxs("div",{className:"omni-screenshot-panel",children:[t.jsxs("div",{className:"omni-screenshot-header",children:[t.jsxs("div",{className:"omni-header-left",children:[t.jsx("span",{className:"omni-screenshot-title",children:"Device preview"}),t.jsxs("div",{className:"omni-mode-toggle",children:[t.jsxs("button",{className:`omni-mode-btn ${te==="inspect"?"active":""}`,onClick:()=>se("inspect"),title:"Inspection mode (highlight elements)",children:[t.jsx(yn,{size:12}),t.jsx("span",{children:"Inspect"})]}),t.jsxs("button",{className:`omni-mode-btn ${te==="interact"?"active":""}`,onClick:()=>se("interact"),title:"Interaction mode (direct control)",children:[t.jsx(bn,{size:12}),t.jsx("span",{children:"Interact"})]})]})]}),t.jsxs("button",{className:"omni-refresh-btn",onClick:ce,disabled:h,children:[t.jsx(zt,{size:12,className:h?"animate-spin":""}),h?"Capturing...":"Refresh"]})]}),t.jsxs("div",{className:"omni-screenshot-container",ref:Ae,children:[h&&!fe&&t.jsxs("div",{className:"omni-loading-overlay",children:[t.jsx("div",{className:"omni-spinner"}),t.jsx("span",{children:"Capturing screen..."})]}),!o&&!h&&!fe&&t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ys,{size:40}),t.jsx("span",{children:"Click Refresh to capture"})]}),fe&&t.jsxs("div",{className:`omni-screenshot-wrapper ${te==="interact"?"interactable":""}`,onMouseDown:pe,onMouseUp:Re,children:[t.jsx(ea,{ref:ze,src:n,onLoad:oe,onError:X,className:"omni-screenshot-img",style:te==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),fs]}),!fe&&(o==null?void 0:o.screenshot)&&t.jsxs("div",{className:`omni-screenshot-wrapper ${te==="interact"?"interactable":""}`,onMouseDown:pe,onMouseUp:Re,children:[t.jsx("img",{ref:ot,src:`data:image/png;base64,${o.screenshot}`,onLoad:Se,className:"omni-screenshot-img",style:te==="interact"?{pointerEvents:"none"}:{},draggable:!1}),te==="inspect"&&t.jsxs("div",{className:`omni-overlay${ms?" is-stale":""}`,children:[Js(o.hierarchy),Qs(),Bt(N,"hover"),Bt(f,"select")]})]})]})]}),t.jsxs("div",{className:"omni-split",ref:Je,children:[t.jsxs("div",{className:"omni-tree-panel",style:{flexBasis:`calc(${He*100}% - ${He*as}px)`},children:[t.jsxs("div",{className:"omni-tree-header",children:[t.jsxs("div",{className:"omni-tree-title",children:[t.jsx(ra,{size:14}),t.jsx("span",{children:"Source"})]}),t.jsxs("div",{className:"omni-tree-actions",children:[t.jsx("button",{onClick:we,className:"omni-action-btn",title:"Expand all","aria-label":"Expand all",children:t.jsx(yi,{size:12})}),t.jsx("button",{onClick:xe,className:"omni-action-btn",title:"Collapse all","aria-label":"Collapse all",children:t.jsx(pi,{size:12})}),a&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>se(te==="inspect"?"interact":"inspect"),className:`omni-action-btn ${te==="inspect"?"active":""}`,title:te==="inspect"?"Inspect mode — click the device to select an element":"Interact mode — clicks control the device","aria-label":te==="inspect"?"Inspect mode":"Interact mode","aria-pressed":te==="inspect",children:te==="inspect"?t.jsx(yn,{size:12}):t.jsx(bn,{size:12})}),t.jsx("button",{onClick:ce,className:"omni-action-btn",title:h?"Capturing…":"Refresh snapshot","aria-label":"Refresh snapshot",disabled:h,children:t.jsx(zt,{size:12,className:h?"animate-spin":""})})]})]})]}),p&&!h&&t.jsxs("div",{className:"omni-tree-error",role:"alert",children:[t.jsx(Nt,{size:12}),t.jsx("span",{children:p}),t.jsx("button",{type:"button",onClick:ce,className:"omni-tree-error-retry",children:"Retry"})]}),o&&!h&&!p&&(ms?t.jsxs("div",{className:"omni-capture-meta is-stale",role:"status",children:[t.jsx(Ke,{size:12,"aria-hidden":"true"}),t.jsx("span",{children:"The screen may have changed since this capture."}),t.jsx("button",{type:"button",onClick:ce,className:"omni-capture-refresh",children:"Refresh"})]}):t.jsxs("div",{className:"omni-capture-meta",children:[t.jsxs("span",{children:[hs," ",hs===1?"element":"elements"]}),o.hierarchySource&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{className:"omni-capture-source",title:o.hierarchySource==="appium-session"?`From Appium session ${o.sessionId} — the same tree the driver resolves locators against`:"Read from the device. No Appium session is driving it.",children:o.hierarchySource==="appium-session"?"Session":"Device"})]}),t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:Dc(B,J)})]})),t.jsxs("div",{className:"omni-tree-search",children:[t.jsx(Fs,{size:14}),t.jsx("input",{type:"text",placeholder:"Search elements",value:A,onChange:y=>Zs(y.target.value),"aria-label":"Search elements"}),A&&t.jsx("button",{onClick:()=>Zs(""),className:"omni-clear-btn","aria-label":"Clear search",children:"×"})]}),t.jsx("div",{role:"status",className:"sr-only",children:A.trim()?Tt:""}),A.trim()&&t.jsxs("div",{className:"omni-search-hint",children:[Tt," · try a role: button, input, image"]}),t.jsx("div",{className:"omni-tree-content",children:o!=null&&o.hierarchy?t.jsx(Bc,{rows:Ut,selectedXpath:(f==null?void 0:f.xpath)??null,hoveredXpath:(N==null?void 0:N.xpath)??null,matches:dt,onToggle:ve,onSelect:Rt,onHover:w,revealSeq:k}):t.jsx("div",{className:"omni-empty-state small",children:t.jsx("span",{children:"No hierarchy loaded"})})})]}),t.jsx(Gc,{share:He,limits:za(Qe),containerRef:Je,onChange:Be,onCommit:wt,onReset:()=>wt(ns)}),t.jsxs("div",{className:"omni-details-panel",children:[t.jsxs("div",{className:"omni-details-tabs",role:"tablist",children:[t.jsxs("button",{className:`omni-details-tab ${S==="info"?"active":""}`,onClick:()=>I("info"),role:"tab","aria-selected":S==="info",children:[t.jsx(Oi,{size:12})," ",t.jsx("span",{children:"Info"})]}),t.jsxs("button",{className:`omni-details-tab ${S==="checks"?"active":""}`,onClick:()=>I("checks"),disabled:!f,title:"Checks for this element","aria-label":"Checks",role:"tab","aria-selected":S==="checks",children:[t.jsx(Hr,{size:12})," ",t.jsx("span",{children:"Checks"})]}),t.jsxs("button",{className:`omni-details-tab ${S==="code"?"active":""}`,onClick:()=>I("code"),disabled:!f,title:"Generate test code","aria-label":"Code gen",role:"tab","aria-selected":S==="code",children:[t.jsx(jn,{size:12})," ",t.jsx("span",{children:"Code gen"})]})]}),t.jsx("div",{className:"omni-details-content",children:f?t.jsxs(t.Fragment,{children:[S==="info"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Element info"}),t.jsxs("div",{className:"omni-info-table",children:[t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Type"}),t.jsx("span",{className:"omni-info-value mono",children:f.type})]}),f.text&&t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Text"}),t.jsx("span",{className:"omni-info-value",children:f.text})]}),t.jsxs("div",{className:"omni-info-row omni-info-row--path",children:[t.jsx("span",{className:"omni-info-key",children:"Path"}),t.jsx(Hc,{path:(o==null?void 0:o.hierarchy)&&Qt(o.hierarchy,f.xpath)||[f],onSelect:lr,focusCurrent:U.current},f.xpath)]})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Layout"}),t.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(y=>t.jsxs("div",{className:"omni-layout-item",children:[t.jsx("span",{className:"omni-layout-label",children:y.toUpperCase()}),t.jsx("span",{className:"omni-layout-value",children:f.rect[y]})]},y))})]}),t.jsxs("div",{className:"omni-section",children:[t.jsxs("div",{className:"omni-section-header",children:["Locators",t.jsx("span",{className:"omni-section-badge",children:"Stability scored"})]}),!(he!=null&&he.sessionId)&&((nn=f.suggestedLocators)==null?void 0:nn.length)>0&&t.jsxs("p",{className:"omni-locators-note",children:[t.jsx(Jn,{size:12,"aria-hidden":"true"}),"Verify and Tap need an Appium test running on this device. Start the test first, then open this page: while it’s open, the live preview holds the device and a new test can’t start."]}),t.jsxs("div",{className:"omni-locators-list",children:[!((an=f.suggestedLocators)!=null&&an.length)&&t.jsx("div",{className:"omni-locators-empty",children:f===(o==null?void 0:o.hierarchy)?"This is the XML document root, not a UI element — no Appium locator can select it. Pick a node beneath it.":"No locator could be derived for this node."}),(rn=f.suggestedLocators)==null?void 0:rn.map(y=>{const R=As(y.strategy,y.value),D=dr[R.level],O=me[y.strategy];let G=null;return O&&(O.kind==="unsupported"?G=t.jsxs("span",{className:"omni-match-badge unsupported",title:O.reason||"Cannot evaluate without a real driver",children:[t.jsx(da,{size:10})," preview unavailable"]}):O.nodes.length===0?G=t.jsxs("span",{className:"omni-match-badge zero",title:"No element matches this selector in the current snapshot",children:[t.jsx(Nt,{size:10})," 0 matches"]}):O.nodes.length===1?G=t.jsxs("span",{className:"omni-match-badge unique",title:"Selector is unique in the current snapshot",children:[t.jsx(Wt,{size:10})," unique"]}):G=t.jsxs("span",{className:"omni-match-badge multi",title:`${O.nodes.length} elements match — selector is not unique`,children:[t.jsx(Ke,{size:10})," ",O.nodes.length," matches"]})),t.jsx("div",{className:`omni-locator-row ${(W==null?void 0:W.strategy)===y.strategy?"selected-for-code":""}`,onClick:()=>ae(y),title:"Click to use in Code gen",children:t.jsxs("div",{className:"omni-locator-left",children:[t.jsxs("div",{className:"omni-locator-top",children:[t.jsx("span",{className:"omni-locator-strategy",children:y.strategy}),t.jsxs("span",{className:`omni-stability-badge ${D.cls}`,title:R.reason,children:[D.icon,R.level]}),G]}),t.jsx("code",{className:"omni-locator-value",children:y.value}),t.jsx("span",{className:"omni-stability-reason",children:R.reason}),(()=>{const P=Te[y.strategy];return P?P.error?t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(Nt,{size:10})," Appium error: ",P.error]}):P.found?P.count>1?t.jsxs("span",{className:"omni-verify-line is-warn",children:[t.jsx(Ke,{size:10})," Ambiguous — Appium found"," ",P.count," elements",P.actionError?` · ${P.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-ok",children:[t.jsx(Wt,{size:10})," Appium found 1 element",P.elapsedMs!=null?` in ${P.elapsedMs}ms`:"",P.actionPerformed&&P.actionPerformed!=="none"?` · ${P.actionPerformed} ok`:"",P.actionError?` · action failed: ${P.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(Nt,{size:10})," Appium found 0 elements"]}):null})(),t.jsxs("div",{className:"omni-locator-actions",children:[t.jsxs(F,{type:"button",variant:Pe===y.strategy?"tonal":"secondary",size:"sm",onClick:P=>{P.stopPropagation(),Q(y.strategy,y.value)},title:"Match against this capture and outline the result on the phone","aria-label":"Test locator",children:[t.jsx(ki,{size:12,"aria-hidden":"true"}),"Test"]}),t.jsxs(F,{type:"button",variant:"secondary",size:"sm",disabled:!(he!=null&&he.sessionId)||it===y.strategy,onClick:P=>{P.stopPropagation(),ct(y.strategy,y.value,"none")},title:"Ask the Appium driver whether it finds this element","aria-label":"Verify with Appium",children:[it===y.strategy?t.jsx(zt,{size:12,className:"animate-spin","aria-hidden":"true"}):t.jsx(Wt,{size:12,"aria-hidden":"true"}),"Verify"]}),t.jsxs(F,{type:"button",variant:"secondary",size:"sm",disabled:!(he!=null&&he.sessionId)||it===y.strategy,onClick:P=>{P.stopPropagation(),ct(y.strategy,y.value,"tap")},title:"Find it with Appium and tap it on the phone","aria-label":"Find and tap with Appium",children:[t.jsx(ia,{size:12,"aria-hidden":"true"}),"Tap"]}),t.jsxs(F,{type:"button",variant:"secondary",size:"sm",onClick:P=>{P.stopPropagation(),ye(y.value,y.strategy)},title:"Copy the locator's value","aria-label":$===y.strategy?"Copied":"Copy locator",children:[$===y.strategy?t.jsx(It,{size:12,"aria-hidden":"true"}):t.jsx(Oe,{size:12,"aria-hidden":"true"}),$===y.strategy?"Copied":"Copy"]})]})]})},y.strategy)})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Attributes"}),t.jsx("div",{className:"omni-attributes-table",children:Object.entries(f.attributes||{}).filter(([y,R])=>R!=null&&R!=="").map(([y,R])=>t.jsxs("div",{className:"omni-attr-row",children:[t.jsx("span",{className:"omni-attr-key",children:y}),t.jsx("span",{className:"omni-attr-value",children:String(R)})]},y))})]})]}),S==="checks"&&Ht&&ut&&t.jsxs("div",{className:"omni-checks-panel",children:[t.jsxs("p",{className:"omni-checks-summary",children:[t.jsxs("span",{className:"is-pass",children:[t.jsx(oa,{size:12,"aria-hidden":"true"})," ",ut.pass," passed"]}),ut.warn>0&&t.jsxs("span",{className:"is-warn",children:[t.jsx(Ke,{size:12,"aria-hidden":"true"})," ",ut.warn," ",ut.warn===1?"warning":"warnings"]}),ut.fail>0&&t.jsxs("span",{className:"is-fail",children:[t.jsx(ca,{size:12,"aria-hidden":"true"})," ",ut.fail," failed"]})]}),t.jsx("ul",{className:"omni-checks-list",children:Ht.map(y=>t.jsxs("li",{className:`omni-check is-${y.status}`,children:[t.jsx("span",{className:"omni-check-icon","aria-hidden":"true",children:Zc[y.status]}),t.jsxs("div",{className:"omni-check-body",children:[t.jsxs("div",{className:"omni-check-label",children:[y.label,t.jsxs("span",{className:"sr-only",children:[": ",Jc[y.status]]})]}),t.jsx("div",{className:"omni-check-detail",children:y.detail})]})]},y.id))})]}),S==="code"&&t.jsxs("div",{className:"omni-codegen-panel",children:[t.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(y=>t.jsx("button",{className:`omni-fw-btn ${V===y?"active":""}`,onClick:()=>M(y),children:Qc[y]},y))}),W?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-codegen-locator-selector",children:[t.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),t.jsx(sa,{selectSize:"sm",value:W.strategy,onChange:y=>{var D;const R=(D=f.suggestedLocators)==null?void 0:D.find(O=>O.strategy===y.target.value);R&&ae(R)},className:"flex-1",children:(on=f.suggestedLocators)==null?void 0:on.map(y=>t.jsxs("option",{value:y.strategy,children:[y.strategy," — ",As(y.strategy,y.value).level]},y.strategy))})]}),t.jsxs("div",{className:"omni-codegen-output",children:[t.jsxs("div",{className:"omni-codegen-header",children:[t.jsx("span",{className:"omni-codegen-lang",children:V==="java"?"Java / TestNG":V==="python"?"Python / unittest":V==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),t.jsx("button",{className:"omni-copy-btn",onClick:()=>ye(Tn(f,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",V,W),"code"),children:$==="code"?t.jsx(It,{size:12}):t.jsx(Oe,{size:12})})]}),t.jsx("pre",{className:"omni-codegen-pre theme-dark",children:t.jsx("code",{children:Tn(f,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",V,W)})})]})]}):t.jsxs("div",{className:"omni-empty-state small",children:[t.jsx(jn,{size:24}),t.jsx("span",{children:"No locators available for this element"})]})]})]}):o!=null&&o.hierarchy?t.jsxs("div",{className:"omni-summary-panel",children:[t.jsxs("div",{className:"omni-summary-hero",children:[t.jsx(ys,{size:28}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-summary-title",children:"No element selected"}),t.jsx("div",{className:"omni-summary-subtitle",children:"Click any node in the tree (or use Inspect mode on the device) to drill in."})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Snapshot stats"}),t.jsxs("div",{className:"omni-summary-stats",children:[t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Elements"}),t.jsx("span",{className:"omni-summary-stat__value",children:hs})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Width"}),t.jsx("span",{className:"omni-summary-stat__value",children:((tn=o.metadata)==null?void 0:tn.screenWidth)??K.width??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Height"}),t.jsx("span",{className:"omni-summary-stat__value",children:((sn=o.metadata)==null?void 0:sn.screenHeight)??K.height??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Platform"}),t.jsx("span",{className:"omni-summary-stat__value",children:o.platform||"—"})]})]})]}),en.length>0&&t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"By role"}),t.jsx("div",{className:"omni-summary-roles",children:en.slice(0,8).map(y=>t.jsxs("div",{className:"omni-summary-role",children:[t.jsx("span",{className:"omni-summary-role__icon","aria-hidden":"true",children:Ta[y.key]}),t.jsx("span",{className:"omni-summary-role__name",children:y.role}),t.jsx("span",{className:"omni-summary-role__count",children:y.count})]},y.role))})]})]}):t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ys,{size:32}),t.jsx("span",{children:h?"Capturing snapshot…":"Select an element from the tree or screenshot"})]})})]})]})]})]})},Rn=5e3;function tl(e,s=!0){const[n,a]=l.useState("unknown"),r=l.useRef("unknown");return l.useEffect(()=>{if(!e||!s){a("unknown"),r.current="unknown";return}let i=!1,c;const h=u=>{i||u===r.current||(r.current=u,a(u))},d=async()=>{if(!i){if(c&&(clearTimeout(c),c=void 0),typeof document<"u"&&document.visibilityState==="hidden"){c=setTimeout(d,Rn);return}try{const u=await q.getDisplayState(e);h((u==null?void 0:u.state)??"unknown")}catch{}i||(c=setTimeout(d,Rn))}};d();const o=()=>{document.visibilityState==="visible"&&d()};return document.addEventListener("visibilitychange",o),()=>{i=!0,c&&clearTimeout(c),document.removeEventListener("visibilitychange",o)}},[e,s]),n}function sl(e,s){const n=l.useRef(e),a=l.useRef(s);n.current=e,a.current=s,l.useEffect(()=>{const r=()=>n.current(),i=c=>{var h;c.persisted&&((h=a.current)==null||h.call(a))};return window.addEventListener("pagehide",r),window.addEventListener("pageshow",i),()=>{window.removeEventListener("pagehide",r),window.removeEventListener("pageshow",i)}},[])}const nl=/^(INPUT|TEXTAREA|SELECT)$/,Vs=l.createContext(null);function al(e){const s=l.useContext(Vs),n=l.useRef(e);n.current=e;const a=e!==null;l.useEffect(()=>{if(!(!s||!a))return s.register(()=>{var r;return((r=n.current)==null?void 0:r.call(n))??!1})},[s,a])}function La(e){const s=l.useContext(Vs),n=l.useRef(e);return n.current=e,l.useCallback(()=>s?s.close():n.current(),[s])}function rl({labelledBy:e,onClose:s,children:n,style:a,...r}){const i=l.useRef(null),c=l.useRef(s);c.current=s;const h=l.useMemo(()=>{const o=new Set;return{register(u){return o.add(u),()=>{o.delete(u)}},close(){for(const u of Array.from(o))if(u())return;c.current()}}},[]),d=l.useRef(h);return l.useEffect(()=>{const o=i.current;if(!o)return;const u=document.activeElement,p=[];for(let f=o;f.parentElement&&f!==document.body;f=f.parentElement)for(const g of Array.from(f.parentElement.children))g===f||g.hasAttribute("inert")||g.matches("[aria-live], script, style, link, template")||(g.setAttribute("inert",""),p.push(g));o.contains(document.activeElement)||o.focus();const v=f=>{if(f.key!=="Escape"||f.defaultPrevented)return;const g=f.target;nl.test(g.tagName)||g.isContentEditable||(f.preventDefault(),d.current.close())};return o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v),p.forEach(f=>f.removeAttribute("inert")),u&&u.isConnected&&u!==document.body&&u.focus()}},[]),t.jsx("div",{ref:i,role:"dialog","aria-modal":"true","aria-labelledby":e,tabIndex:-1,style:{outline:"none",...a},...r,children:t.jsx(Vs.Provider,{value:h,children:n})})}const Ia="Your browser blocked copying here. The text is selected, so press ⌘C or Ctrl+C.";async function Ws(e){var s;try{return(s=navigator.clipboard)!=null&&s.writeText?(await navigator.clipboard.writeText(e),!0):!1}catch{return!1}}const En=5e3,il=500,ol=1e4,cl=10,ll=50;function dl(e,s,n){const a=`${((n==null?void 0:n.levels)??[]).join(",")}|${(n==null?void 0:n.process)??""}`,[r,i]=l.useState([]),[c,h]=l.useState(!1),[d,o]=l.useState(null),[u,p]=l.useState(!1),v=l.useRef(null),f=l.useRef(0),g=l.useRef(void 0),k=l.useRef(()=>{}),b=l.useRef([]),U=l.useRef(void 0),N=l.useRef(0),w=l.useRef(void 0),C=l.useCallback(()=>{if(b.current.length===0)return;const $=b.current;b.current=[],i(m=>{const S=m.concat($);return S.length>En?S.slice(-En):S})},[]),j=l.useCallback(()=>{U.current===void 0&&(U.current=window.setTimeout(()=>{U.current=void 0,C()},ll))},[C]),A=l.useCallback(()=>{b.current=[],i([])},[]);l.useEffect(()=>{if(!s){h(!1),o(null),p(!1);return}o(null),p(!1),f.current=0;const $={cancelled:!1},m=()=>{if($.cancelled)return;if(f.current>=cl){p(!0);return}const I=Math.min(il*2**f.current,ol);f.current+=1,g.current=window.setTimeout(S,I)},S=async()=>{if(!$.cancelled)try{const I=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/ticket`,{method:"POST",credentials:"include"});if($.cancelled)return;if(!I.ok){m();return}const{ticket:B}=await I.json();if($.cancelled)return;if(!B){m();return}const L=window.location.protocol==="https:"?"wss":"ws",[Y,ee]=a.split("|"),J=(Y?`&levels=${encodeURIComponent(Y)}`:"")+(ee?`&process=${encodeURIComponent(ee)}`:""),H=new WebSocket(`${L}://${window.location.host}/xenon/api/control/${encodeURIComponent(e)}/logcat?ticket=${encodeURIComponent(B)}${J}`);v.current=H,H.onopen=()=>{f.current=0,w.current!==1012&&(b.current=[],i([])),w.current=void 0,h(!0)},H.onmessage=x=>{try{const z=JSON.parse(x.data);b.current.push({...z,seq:N.current++}),j()}catch{}},H.onclose=x=>{if(h(!1),w.current=x.code,C(),x.code===1008){$.cancelled=!0,o(x.reason||"access denied");return}if(x.code===1012){m();return}console.warn(`[logcat] WS closed unexpectedly (code ${x.code}) — retrying`),m()},H.onerror=()=>H.close()}catch{m()}};return k.current=()=>{$.cancelled=!1,f.current=0,o(null),p(!1),S()},S(),()=>{var I;$.cancelled=!0,g.current!==void 0&&window.clearTimeout(g.current),U.current!==void 0&&(window.clearTimeout(U.current),U.current=void 0),C(),(I=v.current)==null||I.close(),v.current=null}},[e,s,a,C,j]);const T=l.useCallback(()=>{k.current()},[]);return{records:r,connected:c,clear:A,deniedReason:d,exhausted:u,retry:T}}const Ft=["V","D","I","W","E","F"];function ul(e){const s=[];let n="",a=!1,r=!1;for(const i of e){if(i==='"'){a=!a,r=!0;continue}if(!a&&/\s/.test(i)){(r||n)&&s.push(n),n="",r=!1;continue}n+=i,r=!0}return(r||n)&&s.push(n),s.filter(i=>i.length>0)}function _a(e,s={}){const n=s.caseSensitive===!0,a=c=>n?c:c.toLowerCase(),r=n?{caseSensitive:!0}:{},i=[];for(const c of ul(e)){const[h,...d]=c.split(":"),o=d.join(":"),u=h.toLowerCase();o&&u==="level"?r.minLevel=o.toUpperCase():o&&u==="tag"?r.tag=a(o):o&&u==="package"?r.pkg=a(o):o&&u==="-tag"?(r.excludeTags=r.excludeTags||[]).push(a(o)):o&&u==="-package"?(r.excludePkgs=r.excludePkgs||[]).push(a(o)):i.push(c)}return i.length&&(r.text=a(i.join(" "))),r}function Oa(e,s){if(e.synthetic)return!0;if(s.minLevel){const a=Ft.indexOf(s.minLevel),r=Ft.indexOf(e.level);if(a>=0&&r>=0&&r<a)return!1}const n=a=>s.caseSensitive?a:a.toLowerCase();if(s.tag&&!n(e.tag).includes(s.tag)||s.pkg&&!n(e.pkg??"").includes(s.pkg)||s.text&&!n(e.message).includes(s.text))return!1;if(s.excludeTags){const a=n(e.tag);if(s.excludeTags.some(r=>a.includes(r)))return!1}if(s.excludePkgs){const a=n(e.pkg??"");if(a&&s.excludePkgs.some(r=>a.includes(r)))return!1}return!0}function Fa(e){const s=[];let n="",a=!1;for(const r of e){if(r==='"'&&(a=!a),!a&&/\s/.test(r)){n&&s.push(n),n="";continue}n+=r}return n&&s.push(n),s}function Pa(e){const[s,...n]=e.replace(/"/g,"").split(":");return{key:s.toLowerCase(),value:n.join(":")}}function Ua(e){const s=e.split('"').map(n=>n.trim()).reduce((n,a)=>a.length>n.length?a:n,"");return/\s/.test(s)?`"${s}"`:s}function An(e,s,n){const a=Ua(n);if(!a)return e;const r=`${s}:${a}`,i=[];let c=!1;for(const h of Fa(e)){const d=Pa(h);if(d.key===s&&d.value){c||i.push(r),c=!0;continue}i.push(h)}return c||i.push(r),i.join(" ")}function hl(e,s,n){const a=Ua(n);if(!a)return e;const r=a.replace(/"/g,""),i=Fa(e);return i.some(h=>{const d=Pa(h);return d.key===`-${s}`&&d.value===r})?e:[...i,`-${s}:${a}`].join(" ")}function ml(e,s){const n=e.trim().split(/\s+/).filter(Boolean).filter(a=>{const[r,...i]=a.split(":");return!(i.join(":")&&r.toLowerCase()==="level")});return s?["level:"+s.toUpperCase(),...n].join(" "):n.join(" ")}const bs=[{ios:"Debug",android:"D"},{ios:"Info",android:"I"},{ios:"Default",android:"I"},{ios:"Error",android:"E"},{ios:"Fault",android:"F"}],Dn=["V","D","I","W","E","F"];function fl(e){if(!e)return bs.filter(n=>n.ios!=="Debug").map(n=>n.ios);const s=Dn.indexOf(e.toUpperCase());return s<0?bs.map(n=>n.ios):bs.filter(n=>Dn.indexOf(n.android)>=s).map(n=>n.ios)}function pl(e){const s=_a(e,{caseSensitive:!0});return{levels:fl(s.minLevel),process:s.pkg||void 0}}const Mn=Ft,vl={V:"Verbose",D:"Debug",I:"Info",W:"Warning",E:"Error",F:"Fatal"};function yl(e,s){const n={V:0,D:0,I:0,W:0,E:0,F:0},a={...s,minLevel:void 0};for(let r=0;r<e.length;r++){const i=e[r];i.synthetic||Object.prototype.hasOwnProperty.call(n,i.level)&&Oa(i,a)&&(n[i.level]+=1)}return n}function xl(e,s,n){return(e==="ios"?["D","I","E","F"]:s.F>0||(n||"").toUpperCase()==="F"?["V","D","I","W","E","F"]:["V","D","I","W","E"]).map(r=>({level:r,name:Ba(r,e)}))}function gl(e,s){if(!s)return null;const n=Mn.indexOf(s.toUpperCase());if(n<0)return null;const a=e.find(r=>Mn.indexOf(r.level)>=n);return a?a.level:null}function Ba(e,s){return e==="F"?s==="ios"?"Fault":"Fatal":vl[e]??e}const Ds=5e5;function rs(e){return`${new Date(e.ts).toISOString()} ${e.pid} ${e.level}/${e.tag}: ${e.message}`}function jl(e){return{lines:[],startedAt:e,dropped:0}}function bl(e,s){for(const n of s){if(e.lines.length>=Ds){e.dropped+=1;continue}e.lines.push(rs(n))}return e}function wl(e,s,n){const a=["# Xenon logcat recording",`# device: ${n}`,`# started: ${new Date(e.startedAt).toISOString()}`,`# stopped: ${new Date(s).toISOString()}`,`# duration: ${((s-e.startedAt)/1e3).toFixed(1)}s`,`# lines: ${e.lines.length}`];e.dropped>0&&a.push(`# TRUNCATED: ${e.dropped} further line(s) were dropped after the ${Ds}-line cap. This capture is INCOMPLETE.`);const r=e.lines.join(`
|
|
274
|
+
`),i=e.dropped>0?`
|
|
275
|
+
# --- TRUNCATED: ${e.dropped} line(s) not captured (cap ${Ds}) ---`:"";return`${a.join(`
|
|
276
|
+
`)}
|
|
277
|
+
|
|
278
|
+
${r}${i}
|
|
279
|
+
`}function kl(e,s){const n=new Date(s).toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");return`logcat-${e}-${n}.txt`}const ws={selected:new Set,anchor:null,active:null};function Ha(e,s,n){const a=e.indexOf(s),r=e.indexOf(n);return a<0||r<0?null:e.slice(Math.min(a,r),Math.max(a,r)+1)}function Va(e){return{selected:new Set([e]),anchor:e,active:e}}function Nl(e,s,n,a){if(a.range&&e.anchor!==null){const r=Ha(n,e.anchor,s);if(r)return{selected:new Set(r),anchor:e.anchor,active:s}}if(a.toggle){const r=new Set(Array.from(e.selected));return r.has(s)?r.delete(s):r.add(s),{selected:r,anchor:s,active:s}}return Va(s)}function Cl(e,s,n,a){if(!s.length)return e;const r=e.active===null?-1:s.indexOf(e.active),i=r<0?n===1?0:s.length-1:Math.max(0,Math.min(s.length-1,r+n)),c=s[i];if(!a)return Va(c);const h=e.anchor!==null&&s.indexOf(e.anchor)>=0?e.anchor:e.active??c,d=Ha(s,h,c)??[c];return{selected:new Set(d),anchor:h,active:c}}function Sl(e,s){const n=[];if(s.size)for(let a=0;a<e.length;a++)s.has(e[a].seq)&&n.push(rs(e[a]));return{text:n.join(`
|
|
280
|
+
`),count:n.length}}const Wa=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"});function st(e){return e.toLocaleString("en-US")}function $l(e){return Wa.format(e)}function Tl(e){const s=(Math.floor(e)%1e3+1e3)%1e3;return`${Wa.format(e)}.${String(s).padStart(3,"0")}`}const Rl=[["tag:Wifi","lines whose tag contains Wifi"],["package:com.example","lines from that app"],["level:W","warnings and above"],["-tag:chatty","hide a tag"]];function El(e){const s=l.useRef(null),n=l.useRef(null),a=l.useRef(null),[r,i]=l.useState(!1),[c,h]=l.useState(!1);l.useEffect(()=>{var p,v;c&&((v=(p=a.current)==null?void 0:p.querySelector('[role^="menuitem"]:not(:disabled)'))==null||v.focus())},[c]);const d=()=>{var p;h(!1),(p=n.current)==null||p.focus()},o=p=>()=>{d(),p()},u=e.status==="Offline"||e.status==="Denied";return t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-status",role:"status",title:e.statusDetail??void 0,children:[t.jsx("span",{className:`log-live-dot${e.status==="Live"?" active":""}${u?" is-error":""}`,"aria-hidden":"true"}),e.status]}),t.jsxs("div",{className:"log-filter",children:[t.jsx(xn,{ref:e.filterRef,type:"text",className:"log-field log-filter-input",placeholder:"tag:Wifi package:com.example text",value:e.query,onChange:p=>e.onQueryChange(p.target.value),"aria-label":"Filter logs",spellCheck:!1,autoComplete:"off"}),t.jsxs("span",{className:"log-field-buttons",children:[e.query&&t.jsx("button",{type:"button",className:"log-field-btn",onClick:()=>e.onQueryChange(""),"aria-label":"Clear filter",title:"Clear filter",children:t.jsx(Os,{size:12,"aria-hidden":"true"})}),t.jsx("button",{ref:s,type:"button",className:"log-field-btn",onClick:()=>i(p=>!p),"aria-label":"Filter syntax","aria-haspopup":"dialog","aria-expanded":r,title:"Filter syntax",children:t.jsx(da,{size:13,"aria-hidden":"true"})})]}),t.jsx(es,{open:r,onClose:()=>i(!1),anchorRef:s,placement:"bottom-start",children:t.jsxs("div",{className:"log-syntax",children:[t.jsxs("p",{children:["Terms are combined. Quote a value with spaces: ",t.jsx("code",{children:'package:"Food Truck"'}),"."]}),t.jsx("dl",{children:Rl.map(([p,v])=>t.jsxs("div",{children:[t.jsx("dt",{children:t.jsx("code",{children:p})}),t.jsx("dd",{children:v})]},p))}),t.jsx("p",{children:"Other words search the message."})]})})]}),t.jsxs("div",{className:"log-find",children:[t.jsx(xn,{ref:e.findRef,type:"text",className:"log-field log-find-input",placeholder:"Find",value:e.find,onChange:p=>e.onFindChange(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),e.onStep(p.shiftKey?-1:1))},"aria-label":"Find in logs",spellCheck:!1,autoComplete:"off"}),e.find&&t.jsx("span",{className:"log-find-count","aria-live":"polite",children:e.hitCount?`${e.activeHit+1}/${e.hitCount}`:"0/0"})]}),t.jsx(F,{type:"button",variant:"ghost",size:"icon",className:"log-icon-btn",onClick:()=>e.onStep(-1),disabled:!e.hitCount,"aria-label":"Previous match",title:"Previous match (Shift+Enter)",children:t.jsx(Bs,{size:14,"aria-hidden":"true"})}),t.jsx(F,{type:"button",variant:"ghost",size:"icon",className:"log-icon-btn",onClick:()=>e.onStep(1),disabled:!e.hitCount,"aria-label":"Next match",title:"Next match (Enter)",children:t.jsx(Us,{size:14,"aria-hidden":"true"})}),t.jsx("span",{className:"log-toolbar-divider","aria-hidden":"true"}),t.jsxs("div",{className:"log-actions",children:[t.jsxs(F,{type:"button",variant:"secondary",size:"sm",onClick:e.onTogglePause,children:[e.following?t.jsx(qr,{size:13,"aria-hidden":"true"}):t.jsx(Kr,{size:13,"aria-hidden":"true"}),e.following?"Pause":"Resume"]}),t.jsxs(F,{type:"button",variant:"secondary",size:"sm",className:`log-record${e.recording?" is-recording":""}`,onClick:e.onToggleRecording,"aria-pressed":e.recording,children:[e.recording?t.jsx(ta,{size:12,"aria-hidden":"true"}):t.jsx(Er,{size:12,"aria-hidden":"true"}),e.recording?`Stop · ${st(e.recordedLines)} lines`:"Record"]}),t.jsx(F,{type:"button",variant:"ghost",size:"icon",className:"log-icon-btn",onClick:e.onExport,"aria-label":"Export shown lines",title:"Export shown lines",children:t.jsx(la,{size:14,"aria-hidden":"true"})}),t.jsx(F,{ref:n,type:"button",variant:"ghost",size:"icon",className:"log-icon-btn",onClick:()=>h(p=>!p),"aria-label":"More options","aria-haspopup":"menu","aria-expanded":c,title:"More options",children:t.jsx(ua,{size:14,"aria-hidden":"true"})}),t.jsx(es,{open:c,onClose:d,anchorRef:n,placement:"bottom-end",children:t.jsx("div",{ref:a,children:t.jsxs(Ps,{children:[t.jsx(ke,{checkbox:!0,checked:e.caseSensitive,onClick:o(e.onToggleCase),children:"Match case"}),t.jsx(ke,{checkbox:!0,checked:e.wrap,onClick:o(e.onToggleWrap),children:"Wrap long lines"}),t.jsx(na,{}),e.canCopySelected&&t.jsx(ke,{onClick:o(e.onCopySelected),children:"Copy selected lines"}),t.jsx(ke,{onClick:o(e.onClearLines),children:"Clear lines"})]})})})]})]})}function Al({platform:e,counts:s,minLevel:n,shown:a,total:r,onChoose:i}){const c=xl(e,s,n),h=gl(c,n),d=h===null?-1:Ft.indexOf(h);return t.jsxs("div",{className:"log-levels",children:[t.jsxs("div",{className:"log-level-buttons",role:"group","aria-label":"Log levels",children:[t.jsx(F,{type:"button",variant:"ghost",size:"sm",className:"log-level-btn","aria-label":"All levels","aria-pressed":h===null,onClick:()=>i(""),children:"All"}),c.map(({level:o,name:u})=>{const p=s[o],f=`${u} ${o==="F"?"only":"and above"}, ${st(p)} ${u.toLowerCase()} line${p===1?"":"s"}`,g=d>=0&&Ft.indexOf(o)>=d;return t.jsxs(F,{type:"button",variant:"ghost",size:"sm",className:`log-level-btn lvl-${o}${g?" is-included":""}${p?" has-lines":""}`,"aria-label":f,"aria-pressed":h===o,onClick:()=>i(h===o?"":o),children:[u,t.jsx("span",{className:"log-level-count",children:st(p)})]},o)})]}),t.jsxs("span",{className:"log-shown",children:[st(a)," of ",st(r)," shown"]})]})}const Dl=/[.*+?^${}()|[\]\\]/g;function Ml(e,s,n){if(!s||!e)return[{text:e,hit:!1}];const a=new RegExp(s.replace(Dl,"\\$&"),n?"g":"gi"),r=[];let i=0,c;for(;(c=a.exec(e))!==null;)c.index>i&&r.push({text:e.slice(i,c.index),hit:!1}),r.push({text:c[0],hit:!0}),i=c.index+c[0].length;return r.length?(i<e.length&&r.push({text:e.slice(i),hit:!1}),r):[{text:e,hit:!1}]}const zn=["#7dd3fc","#c4b5fd","#5eead4","#f0abfc","#93c5fd","#a5b4fc","#67e8f9","#d8b4fe","#f9a8d4","#99f6e4","#bae6fd","#e9d5ff"];function zl(e){let s=2166136261;for(let n=0;n<e.length;n++)s^=e.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s>>>0}function Ll(e){return e?zn[zl(e)%zn.length]:"var(--text-muted)"}function Ln({text:e,find:s,caseSensitive:n}){if(!s)return t.jsx(t.Fragment,{children:e});const a=Ml(e,s,n);return a.length===1&&!a[0].hit?t.jsx(t.Fragment,{children:e}):t.jsx(t.Fragment,{children:a.map((r,i)=>r.hit?t.jsx("mark",{className:"log-mark",children:r.text},i):t.jsx(l.Fragment,{children:r.text},i))})}const Il=l.memo(function({record:s,index:n,setSize:a,start:r,id:i,selected:c,active:h,hit:d,activeHit:o,find:u,caseSensitive:p,measureRef:v}){const f=["log-row",`lvl-${s.level}`,s.synthetic?"is-synthetic":"",d?"is-hit":"",o?"is-active-hit":"",h?"is-active":""].filter(Boolean).join(" ");return t.jsxs("div",{ref:v,role:"option",id:i,"aria-selected":c,"aria-setsize":a,"aria-posinset":n+1,"data-index":n,"data-seq":s.seq,className:f,style:{transform:`translateY(${r}px)`},children:[t.jsx("span",{className:"log-time",children:$l(s.ts)}),t.jsx("span",{className:"log-badge",children:s.level}),!s.synthetic&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"log-tag",title:s.tag,style:{color:Ll(s.tag)},children:t.jsx(Ln,{text:s.tag,find:u,caseSensitive:p})}),t.jsx("span",{className:"log-pkg",title:s.pkg,children:s.pkg??""})]}),t.jsx("span",{className:"log-msg",children:t.jsx(Ln,{text:s.message,find:u,caseSensitive:p})})]})}),In=24,_l=1e3,Ol=250,Fl=20,Pl=38,_n=720,Ul=["PageUp","PageDown","Home"," "];let Bl=0;function Hl(e){const[s,n]=l.useState(!0);return l.useLayoutEffect(()=>{const a=e.current;if(!a)return;n(a.offsetWidth>=_n);const r=window.ResizeObserver;if(!r)return;const i=new r(c=>n(c[0].contentRect.width>=_n));return i.observe(a),()=>i.disconnect()},[e]),s}const Vl=l.forwardRef(function(s,n){const{records:a,wrap:r,find:i,caseSensitive:c,hits:h,activeHit:d,following:o,newLines:u}=s,p=l.useRef(null),[v]=l.useState(()=>`log-lines-${++Bl}`),f=l.useRef(null),g=l.useRef(o);g.current=o;const k=l.useRef(s);k.current=s;const b=Hl(p),U=s.selection.active,N=l.useMemo(()=>U===null?-1:a.findIndex(x=>x.seq===U),[a,U]),w=kr({count:a.length,getScrollElement:()=>p.current,estimateSize:()=>b?Fl:Pl,getItemKey:x=>a[x].seq,overscan:10,rangeExtractor:x=>{const z=Cr(x);return N>=0&&z.indexOf(N)<0&&(z.push(N),z.sort((V,M)=>V-M)),z},anchorTo:o?"start":"end",scrollToFn:(x,z,V)=>{const M=V.scrollElement,W=x+(z.adjustments??0);f.current=M?Math.max(0,Math.min(W,M.scrollHeight-M.clientHeight)):W,Nr(x,z,V)}}),C=l.useRef(`${r}|${b}`);l.useLayoutEffect(()=>{var z;const x=`${r}|${b}`;C.current!==x&&(C.current=x,w.measure(),(z=p.current)==null||z.querySelectorAll("[data-index]").forEach(V=>w.measureElement(V)))},[r,b,w]);const j=w.getTotalSize(),A=a.length?a[a.length-1].seq:-1,T=l.useRef(a);T.current=a;const $=l.useRef(null),[m,S]=l.useState(!1),I=l.useRef(()=>{});I.current=()=>{const x=p.current,z=T.current,V=x&&z.length?w.getVirtualItemForOffset(x.scrollTop):void 0;$.current=V&&z[V.index]?z[V.index].seq:null},l.useLayoutEffect(()=>{const x=$.current,z=s.oldestSeq;!g.current&&x!==null&&z!==null&&x<z&&(S(!0),w.scrollToOffset(0)),I.current()},[a,s.oldestSeq,w]),l.useEffect(()=>{o&&S(!1)},[o]);const B=l.useRef(0),L=l.useRef(!1);l.useLayoutEffect(()=>{!o||!a.length||L.current||Date.now()-B.current<Ol||w.scrollToOffset(j)},[o,A,a.length,j,w]),l.useEffect(()=>{const x=p.current;if(!x)return;let z=x.scrollTop;const V=()=>{B.current=Date.now()},M=re=>{re.target===x&&(L.current=!0,V())},W=()=>{L.current&&V(),L.current=!1},ae=re=>{Ul.indexOf(re.key)>=0&&V()},K=()=>{I.current();const re=x.scrollTop,be=re>z;if(z=re,f.current!==null&&Math.abs(re-f.current)<2||(f.current=null,!L.current&&Date.now()-B.current>_l))return;const E=x.scrollHeight-x.clientHeight-re;g.current&&E>In?k.current.onPause():!g.current&&be&&E<=In&&k.current.onFollow()},ne={passive:!0};return x.addEventListener("wheel",V,ne),x.addEventListener("touchstart",V,ne),x.addEventListener("touchmove",V,ne),x.addEventListener("pointerdown",M),window.addEventListener("pointerup",W),x.addEventListener("keydown",ae),x.addEventListener("scroll",K,ne),()=>{x.removeEventListener("wheel",V),x.removeEventListener("touchstart",V),x.removeEventListener("touchmove",V),x.removeEventListener("pointerdown",M),window.removeEventListener("pointerup",W),x.removeEventListener("keydown",ae),x.removeEventListener("scroll",K)}},[]),l.useImperativeHandle(n,()=>({reveal:x=>w.scrollToIndex(x,{align:"center"}),focus:()=>{var x;return(x=p.current)==null?void 0:x.focus({preventScroll:!0})}}),[w]);const Y=x=>`${v}-${x}`,ee=x=>{var W,ae,K,ne;const z=x.target.closest("[data-seq]");if(!z||!((W=p.current)!=null&&W.contains(z))||(((K=(ae=window.getSelection)==null?void 0:ae.call(window))==null?void 0:K.toString())??"")!=="")return;const V=Number(z.getAttribute("data-seq")),M=Nl(s.selection,V,a.map(re=>re.seq),{range:x.shiftKey,toggle:x.metaKey||x.ctrlKey});s.onSelect(M,a.find(re=>re.seq===V)??null,"click"),M.selected.size&&g.current&&s.onPause(),x.shiftKey&&((ne=p.current)==null||ne.focus({preventScroll:!0}))},J=x=>{x.shiftKey&&x.preventDefault()},H=x=>{var V,M;const z=x.metaKey||x.ctrlKey;if((x.key==="ArrowDown"||x.key==="ArrowUp")&&!z&&!x.altKey){x.preventDefault();const W=a.map(ne=>ne.seq);if(!W.length)return;const ae=Cl(s.selection,W,x.key==="ArrowDown"?1:-1,x.shiftKey),K=ae.active===null?-1:W.indexOf(ae.active);if(s.onSelect(ae,K>=0?a[K]:null,"key"),K<0)return;K!==W.length-1&&g.current&&s.onPause(),w.scrollToIndex(K,{align:"auto"})}else if(x.key==="Enter"&&!z){const W=N>=0?a[N]:void 0;if(!W)return;x.preventDefault(),s.onOpenDetails(W)}else if(x.key==="End"&&!z)x.preventDefault(),s.onFollow(),w.scrollToOffset(j);else if(z&&!x.altKey&&(x.key==="c"||x.key==="C")){if(!s.selection.selected.size||(((M=(V=window.getSelection)==null?void 0:V.call(window))==null?void 0:M.toString())??"")!=="")return;x.preventDefault(),s.onCopy()}};return t.jsxs("div",{className:"log-list-wrap",children:[m&&!o&&t.jsx("div",{className:"log-dropped-note",children:"Older lines were dropped while paused"}),t.jsx("div",{ref:p,role:"listbox","aria-label":"Log lines","aria-multiselectable":"true",tabIndex:0,"aria-activedescendant":N>=0?Y(a[N].seq):void 0,className:`log-list${r?"":" is-nowrap"}`,onClick:ee,onMouseDown:J,onKeyDown:H,children:t.jsx("div",{className:"log-list-sizer",style:{height:j},children:w.getVirtualItems().map(x=>{const z=a[x.index];return t.jsx(Il,{record:z,index:x.index,setSize:a.length,start:x.start,id:Y(z.seq),selected:s.selection.selected.has(z.seq),active:s.selection.active===z.seq,hit:h.has(x.index),activeHit:d===x.index,find:i,caseSensitive:c,measureRef:w.measureElement},z.seq)})})}),!o&&t.jsx(F,{type:"button",variant:"secondary",size:"sm",className:"log-new-pill",onClick:()=>k.current.onFollow(),children:u>0?`${st(u)} new line${u===1?"":"s"} · Jump to latest`:"Jump to latest"})]})});function Wl({record:e,platform:s,inBuffer:n,onCopyLine:a,onCopyMessage:r,onShowOnlyTag:i,onHideTag:c,onShowOnlyApp:h,onClose:d}){const o=!!e.synthetic;return t.jsxs("section",{className:"log-details","aria-label":"Line details",children:[t.jsxs("header",{className:"log-details-head",children:[t.jsx(F,{type:"button",variant:"ghost",size:"icon",className:"log-details-close","aria-label":"Close details",title:"Close details (Esc)",onClick:d,children:t.jsx(Os,{size:14,"aria-hidden":"true"})}),t.jsx("h3",{className:"log-details-title",children:o?"Added by Xenon":`${Ba(e.level,s)} · ${e.tag}`})]}),o&&t.jsx("p",{className:"log-details-note",children:"Xenon added this line. It didn’t come from the phone."}),t.jsxs("dl",{className:"log-details-fields",children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Time"}),t.jsx("dd",{children:Tl(e.ts)})]}),!o&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("dt",{children:"App"}),t.jsx("dd",{children:e.pkg??"Unknown"})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Process ID"}),t.jsx("dd",{children:e.pid})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Thread ID"}),t.jsx("dd",{children:e.tid})]})]})]}),!n&&t.jsx("p",{className:"log-details-left",children:"This line has left the buffer"}),t.jsx("pre",{className:"log-details-msg",children:e.message}),t.jsxs("div",{className:"log-details-actions",children:[t.jsx(F,{type:"button",variant:"secondary",size:"sm",onClick:a,children:"Copy line"}),!o&&t.jsxs(t.Fragment,{children:[t.jsx(F,{type:"button",variant:"secondary",size:"sm",onClick:r,children:"Copy message"}),e.tag&&t.jsxs(t.Fragment,{children:[t.jsx(F,{type:"button",variant:"secondary",size:"sm",onClick:i,children:"Show only this tag"}),t.jsx(F,{type:"button",variant:"secondary",size:"sm",onClick:c,children:"Hide this tag"})]}),e.pkg&&t.jsx(F,{type:"button",variant:"secondary",size:"sm",onClick:h,children:"Show only this app"})]})]})]})}function On(e,s){const n=URL.createObjectURL(new Blob([e],{type:"text/plain"})),a=document.createElement("a");a.href=n,a.download=s,a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(n),0)}async function ql(e){var a;if(await Ws(e))return!0;if(typeof document.execCommand!="function")return!1;const s=document.activeElement,n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n);try{return n.select(),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(n),(a=s==null?void 0:s.focus)==null||a.call(s,{preventScroll:!0})}}const Kl=e=>e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable;function Xl({udid:e,platform:s}){const n=(s||"").toLowerCase(),a=n==="ios",r=n==="android"||a,i=a?"ios":"android",{toast:c}=Fe(),[h,d]=l.useState(""),o=l.useMemo(()=>a?pl(h):void 0,[a,h]),{records:u,connected:p,clear:v,deniedReason:f,exhausted:g,retry:k}=dl(e,r,o),[b,U]=l.useState(!1),[N,w]=l.useState(!0),[C,j]=l.useState(""),[A,T]=l.useState(0),[$,m]=l.useState(ws),[S,I]=l.useState(null),B=l.useRef(null),L=l.useRef(null),Y=l.useRef(null),ee=l.useRef(null),J=l.useRef(u);J.current=u;const[H,x]=l.useState(!0),[z,V]=l.useState(null),M=l.useRef(H);M.current=H;const W=l.useCallback(()=>{if(!M.current)return;M.current=!1;const _=J.current;V(_.length?_[_.length-1].seq:-1),x(!1)},[]),ae=l.useCallback(()=>{M.current=!0,V(null),x(!0)},[]),K=l.useRef(null),[ne,re]=l.useState(!1),[be,E]=l.useState(0),ie=l.useRef(-1),te=l.useMemo(()=>_a(h,{caseSensitive:b}),[h,b]),se=l.useMemo(()=>u.filter(_=>Oa(_,te)),[u,te]),me=l.useMemo(()=>yl(u,te),[u,te]),ue=l.useMemo(()=>{if(!C)return[];const _=b?C:C.toLowerCase(),Q=[];return se.forEach((ce,Se)=>{(b?`${ce.tag} ${ce.message}`:`${ce.tag} ${ce.message}`.toLowerCase()).includes(_)&&Q.push(Se)}),Q},[se,C,b]),Te=ue.length?Math.min(A,ue.length-1):0,rt=l.useMemo(()=>new Set(ue),[ue]),it=l.useCallback(_=>{var ce;if(!ue.length)return;const Q=(Te+_+ue.length)%ue.length;T(Q),W(),(ce=ee.current)==null||ce.reveal(ue[Q])},[ue,Te,W]),Ge=l.useMemo(()=>{if(z===null)return 0;let _=0;for(let Q=se.length-1;Q>=0&&se[Q].seq>z;Q--)_++;return _},[se,z]),he=l.useCallback(()=>{if(!se.length){c("No lines to export","info");return}On(se.map(rs).join(`
|
|
281
|
+
`),`logcat-${e}-${Date.now()}.txt`)},[se,e,c]);l.useEffect(()=>{const _=K.current;if(!_||!u.length)return;const Q=u.filter(Se=>Se.seq>ie.current);if(!Q.length)return;const ce=ie.current+1;ie.current>=0&&Q[0].seq>ce&&(_.dropped+=Q[0].seq-ce),bl(_,Q),ie.current=Q[Q.length-1].seq,E(_.lines.length)},[u]);const Ze=l.useCallback(()=>{const _=K.current;if(!_){ie.current=u.length?u[u.length-1].seq:-1,K.current=jl(Date.now()),E(0),re(!0);return}const Q=wl(_,Date.now(),e);K.current=null,re(!1),E(0),On(Q,kl(e,_.startedAt))},[u,e]),[Pe,Ce]=l.useState(!1),Ae=La(()=>{});al(ne?()=>K.current?(Ce(!0),!0):!1:null);const ot=()=>{Ce(!1),K.current&&Ze(),Ae()},ze=l.useCallback(async(_,Q)=>{await ql(_)?c(Q,"success"):c("Your browser blocked copying here.","error")},[c]),Ue=l.useMemo(()=>{if(!$.selected.size)return 0;let _=0;for(let Q=0;Q<se.length;Q++)$.selected.has(se[Q].seq)&&_++;return _},[se,$.selected]),Je=l.useCallback(()=>{const{text:_,count:Q}=Sl(se,$.selected);Q&&ze(_,`Copied ${st(Q)} line${Q===1?"":"s"}`)},[se,$.selected,ze]),jt=l.useCallback((_,Q,ce)=>{m(_),I(ce==="click"?Q:Se=>Se&&Q?Q:Se)},[]),Be=l.useCallback(()=>{v(),m(ws)},[v]),Qe=_=>{var ce,Se,X;const Q=_.metaKey||_.ctrlKey;_.key==="/"&&!Q&&!Kl(_.target)?(_.preventDefault(),(ce=L.current)==null||ce.focus()):Q&&!_.altKey&&(_.key==="f"||_.key==="F")?(_.preventDefault(),(Se=Y.current)==null||Se.focus(),(X=Y.current)==null||X.select()):_.key==="Escape"&&(S?(_.preventDefault(),I(null)):$.selected.size&&(_.preventDefault(),m(ws)))},bt=l.useRef(Qe);if(bt.current=Qe,l.useEffect(()=>{const _=B.current;if(!_)return;const Q=ce=>bt.current(ce);return _.addEventListener("keydown",Q),()=>_.removeEventListener("keydown",Q)},[r]),!r)return t.jsx("div",{className:"logcat-root",children:t.jsx(Wr,{title:"Live logs are not available here",description:"Live logs work on Android and iOS phones."})});const He=f?"Denied":g?"Offline":p?"Live":"Connecting",wt=!!S&&u.length>0&&S.seq>=u[0].seq&&S.seq<=u[u.length-1].seq;let Le=null;se.length||(u.length?Le=t.jsxs("div",{className:"log-state",children:[t.jsxs("p",{children:["No lines match ",t.jsx("code",{children:h})]}),t.jsx(F,{type:"button",variant:"secondary",size:"sm",onClick:()=>d(""),children:"Clear filter"})]}):He==="Connecting"?Le=t.jsx("div",{className:"log-state",children:t.jsx("p",{children:"Waiting for the phone’s first log line…"})}):He==="Live"&&(Le=t.jsx("div",{className:"log-state",children:t.jsx("p",{children:"Connected. Lines appear here as the phone logs them."})})));const ct=t.jsxs(F,{type:"button",variant:"secondary",size:"sm",onClick:k,children:[t.jsx(zt,{size:13,"aria-hidden":"true"})," Reconnect"]});return t.jsxs("div",{className:"logcat-root",ref:B,children:[t.jsx(El,{status:He,statusDetail:f,query:h,onQueryChange:d,filterRef:L,find:C,onFindChange:_=>{j(_),T(0)},findRef:Y,hitCount:ue.length,activeHit:Te,onStep:it,following:H,onTogglePause:H?W:ae,recording:ne,recordedLines:be,onToggleRecording:Ze,onExport:he,caseSensitive:b,onToggleCase:()=>U(_=>!_),wrap:N,onToggleWrap:()=>w(_=>!_),canCopySelected:Ue>0,onCopySelected:Je,onClearLines:Be}),t.jsx(Al,{platform:i,counts:me,minLevel:te.minLevel,shown:se.length,total:u.length,onChoose:_=>d(ml(h,_))}),t.jsxs("div",{className:"log-body theme-dark",children:[f&&t.jsxs("div",{className:"log-banner is-denied",role:"alert",children:[t.jsx(Ke,{size:14,"aria-hidden":"true"}),t.jsxs("span",{children:["Access denied — ",f]}),ct]}),!f&&g&&t.jsxs("div",{className:"log-banner is-exhausted",role:"alert",children:[t.jsx(Ke,{size:14,"aria-hidden":"true"}),t.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect to try again."}),ct]}),t.jsxs("div",{className:"log-main",children:[t.jsx(Vl,{ref:ee,records:se,oldestSeq:u.length?u[0].seq:null,wrap:N,find:C,caseSensitive:b,hits:rt,activeHit:ue.length?ue[Te]:null,following:H,newLines:Ge,onPause:W,onFollow:ae,selection:$,onSelect:jt,onOpenDetails:I,onCopy:Je}),Le]}),S&&t.jsx(Wl,{record:S,platform:i,inBuffer:wt,onCopyLine:()=>ze(rs(S),"Copied the line"),onCopyMessage:()=>ze(S.message,"Copied the message"),onShowOnlyTag:()=>d(An(h,"tag",S.tag)),onHideTag:()=>d(hl(h,"tag",S.tag)),onShowOnlyApp:()=>d(An(h,"package",S.pkg??"")),onClose:()=>I(null)})]}),t.jsx(ls,{open:Pe,title:"Stop recording?",onClose:()=>Ce(!1),footer:t.jsxs(t.Fragment,{children:[t.jsx(F,{type:"button",variant:"secondary",onClick:()=>Ce(!1),autoFocus:!0,children:"Keep recording"}),t.jsx(F,{type:"button",onClick:ot,children:"Save and close"})]}),children:t.jsxs("p",{children:[st(be)," line",be===1?"":"s"," recorded so far. Closing device control ends the recording. Save and close downloads it first."]})})]})}function qa(e){const s=e==null?void 0:e.message;return typeof s=="string"?s.trim():""}function Me(e,s){const n=qa(s);return n?`Couldn’t ${e}: ${n}`:`Couldn’t ${e}.`}function Yl(e,s){return e==="android"?"Couldn’t read the clipboard. Check that the Appium Settings app is installed on the device.":Me("read the clipboard",s)}function Gl(e,s){const n=s.trim().toLowerCase();return[...e].sort((a,r)=>a.localeCompare(r)).filter(a=>!n||a.toLowerCase().includes(n))}const Zl=/^[A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+$/;function Jl(e){return Zl.test(e.trim())}function qs(e){const s=(e||"").toLowerCase();return s==="android"?"android":s==="ios"||s==="tvos"?"ios":null}function Ql(e,s){const n=qs(s);return n?e.filter(a=>(a.platform||"").toLowerCase()===n):[]}function ed(e){return[e.version,e.packageName].filter(Boolean).join(" · ")}function td(e){return qs(e)==="android"?"Android":"iOS"}function sd(e){return qs(e)==="android"?".apk":".ipa,.app"}function nd({udid:e,platform:s,deviceName:n}){const{toast:a,removeToast:r}=Fe(),i=Pt(),[c,h]=l.useState([]),[d,o]=l.useState("loading"),[u,p]=l.useState(""),[v,f]=l.useState(""),[g,k]=l.useState(!1),[b,U]=l.useState(!1),[N,w]=l.useState([]),[C,j]=l.useState("loading"),[A,T]=l.useState(null),[$,m]=l.useState(null),S=l.useRef(null),I=l.useRef(null),B=l.useRef(null),L=l.useCallback(async()=>{o("loading");try{const E=await q.listApps(e);h(Array.isArray(E)?E:[]),o("ready")}catch(E){p(qa(E)),o("error")}},[e]);l.useEffect(()=>{L()},[L]);const Y=E=>setTimeout(L,E);l.useEffect(()=>{if(!$)return;const E=setTimeout(()=>m(null),1500);return()=>clearTimeout(E)},[$]);const ee=async()=>{j("loading");try{const E=await q.getApps();w(Array.isArray(E)?E:[]),j("ready")}catch{j("error")}},J=()=>{g||(U(!0),ee())},H=()=>{var E;U(!1),(E=S.current)==null||E.focus()};l.useEffect(()=>{var ie;if(!b||C==="loading")return;const E=(ie=I.current)==null?void 0:ie.querySelector('[role="menuitem"]:not(:disabled)');E==null||E.focus()},[b,C]);const x=async(E,ie)=>{k(!0);const te=a(`Installing ${E} on ${n}…`,"loading",0);try{const se=await ie();se!=null&&se.success?(a(`Installed ${E} on ${n}`,"success"),Y(5e3)):a(Me(`install ${E}`,{message:se==null?void 0:se.error}),"error")}catch(se){a(Me(`install ${E}`,se),"error")}finally{r(te),k(!1)}},z=E=>{H(),x(E.name,()=>q.installRepositoryApp(e,E.id))},V=E=>{var te;const ie=(te=E.target.files)==null?void 0:te[0];E.target.value="",ie&&x(ie.name,()=>q.uploadAndInstallApp(e,ie))},M=async()=>{const E=A;if(T(null),!E)return;const ie=a(`Uninstalling ${E} from ${n}…`,"loading",0);try{await q.uninstallApp(e,E),a(`Uninstalled ${E} from ${n}`,"success"),Y(3e3)}catch(te){a(Me(`uninstall ${E}`,te),"error")}finally{r(ie)}},W=async(E,ie)=>{var se,me;if(await Ws(E)){m(E);return}const te=(se=ie.closest("li"))==null?void 0:se.querySelector(".actions-app-id");te&&((me=window.getSelection())==null||me.selectAllChildren(te)),a(Ia,"info")},ae=Gl(c,v),K=v.trim(),ne=d==="ready"&&ae.length===0&&Jl(K)&&!c.includes(K),re=Ql(N,s),be=(E,ie)=>t.jsxs("li",{className:"actions-app-row",children:[t.jsx("span",{className:"actions-app-id",children:E}),ie&&t.jsx("span",{className:"actions-app-note",children:ie}),t.jsxs("span",{className:"actions-app-tools",children:[t.jsx(F,{variant:"ghost",size:"icon","aria-label":$===E?"Copied":`Copy ${E}`,title:$===E?"Copied":"Copy package ID",onClick:te=>W(E,te.currentTarget),children:$===E?t.jsx(It,{size:13,"aria-hidden":"true"}):t.jsx(Oe,{size:13,"aria-hidden":"true"})}),t.jsx(F,{variant:"ghost",size:"sm",className:"actions-app-uninstall","aria-label":`Uninstall ${E}`,onClick:()=>T(E),children:"Uninstall"})]})]},E);return t.jsxs("section",{className:"actions-section","aria-labelledby":"actions-apps-title",children:[t.jsxs("div",{className:"actions-section-head",children:[t.jsxs("h4",{id:"actions-apps-title",className:"actions-section-title",children:[t.jsx(Gi,{size:15,"aria-hidden":"true"})," Apps"]}),t.jsxs("div",{className:"actions-section-tools",children:[t.jsxs(F,{ref:S,variant:"tonal",size:"sm","aria-haspopup":"menu","aria-expanded":b,"aria-disabled":g||void 0,onClick:J,children:[g?t.jsx(yt,{className:"animate-spin",size:13,"aria-hidden":"true"}):t.jsx(zi,{size:13,"aria-hidden":"true"}),"Install from library"]}),t.jsxs(F,{variant:"secondary",size:"sm","aria-disabled":g||void 0,onClick:()=>{var E;return!g&&((E=B.current)==null?void 0:E.click())},children:[t.jsx(Xr,{size:13,"aria-hidden":"true"})," Upload file"]}),t.jsx("input",{ref:B,type:"file",hidden:!0,"aria-label":"App file to upload",accept:sd(s),onChange:V})]})]}),t.jsx(es,{open:b,onClose:H,anchorRef:S,placement:"bottom-end",children:t.jsx("div",{ref:I,className:"actions-library-menu",children:t.jsxs(Ps,{children:[C==="loading"&&t.jsx(ke,{disabled:!0,onClick:()=>{},children:"Loading…"}),C==="error"&&t.jsx(ke,{onClick:ee,children:"Couldn’t load the library. Retry"}),C==="ready"&&re.length===0&&t.jsxs(t.Fragment,{children:[t.jsxs(ke,{disabled:!0,onClick:()=>{},children:["No ",td(s)," apps in the library yet"]}),t.jsx(ke,{onClick:()=>i("/apps"),children:"Open the Apps library"})]}),C==="ready"&&re.map(E=>t.jsx(ke,{note:ed(E)||void 0,onClick:()=>z(E),children:E.name},E.id))]})})}),t.jsxs("div",{className:"actions-apps-tools",children:[t.jsxs("div",{className:"actions-search",children:[t.jsx(Fs,{size:13,className:"actions-search-icon","aria-hidden":"true"}),t.jsx("input",{type:"search",className:"type-input-field compact","aria-label":"Search installed apps",placeholder:`Search ${c.length} installed apps`,value:v,onChange:E=>f(E.target.value)})]}),t.jsx(F,{variant:"ghost",size:"icon","aria-label":"Refresh installed apps",title:"Refresh",onClick:L,children:t.jsx(Yt,{size:13,"aria-hidden":"true"})})]}),d==="loading"&&c.length===0&&t.jsx("p",{className:"actions-list-note",children:"Loading apps…"}),d==="error"&&t.jsxs("div",{className:"actions-list-note",role:"alert",children:["Couldn’t load the apps",u?`: ${u}`:".",t.jsx(F,{variant:"secondary",size:"sm",onClick:L,children:"Retry"})]}),d==="ready"&&c.length===0&&t.jsx("p",{className:"actions-list-note",children:"No apps installed"}),d==="ready"&&c.length>0&&ae.length===0&&!ne&&t.jsxs("p",{className:"actions-list-note",children:["No apps match “",K,"”"]}),t.jsxs("ul",{className:"actions-apps-list","aria-label":"Installed apps",children:[ae.map(E=>be(E)),ne&&be(K,"Not in the list")]}),t.jsx(ls,{open:A!==null,title:"Uninstall app?",onClose:()=>T(null),footer:t.jsxs(t.Fragment,{children:[t.jsx(F,{variant:"secondary",onClick:()=>T(null),children:"Cancel"}),t.jsx(F,{variant:"danger",onClick:M,children:"Uninstall"})]}),children:t.jsxs("p",{className:"actions-confirm-text",children:["Uninstall ",t.jsx("code",{children:A})," from"," ",t.jsx("span",{className:"actions-confirm-device",children:n}),"? The app and its data are removed from the device."]})})]})}const ad=[{direction:"up",Icon:Bs},{direction:"down",Icon:Us},{direction:"left",Icon:Gr},{direction:"right",Icon:Zr}];function rd({onSwipe:e}){return t.jsxs("section",{className:"actions-section actions-swipe","aria-labelledby":"actions-swipe-title",children:[t.jsxs("h4",{id:"actions-swipe-title",className:"actions-section-title",children:[t.jsx(Ti,{size:15,"aria-hidden":"true"})," Swipe"]}),t.jsx("div",{className:"actions-swipe-buttons",children:ad.map(({direction:s,Icon:n})=>t.jsx(F,{variant:"secondary",size:"icon","aria-label":`Swipe ${s}`,title:`Swipe ${s}`,onClick:()=>e(s),children:t.jsx(n,{size:14,"aria-hidden":"true"})},s))})]})}function id(e,s,n){const a=s/2,r=n/2,i=s*.4,c=n*.4,[h,d,o,u]={up:[a,r+c,a,r-c],down:[a,r-c,a,r+c],left:[a+i,r,a-i,r],right:[a-i,r,a+i,r]}[e].map(Math.round);return{startX:h,startY:d,endX:o,endY:u}}function od({udid:e,platform:s}){const n=s!=="android",{toast:a}=Fe(),[r,i]=l.useState(""),[c,h]=l.useState(!1),[d,o]=l.useState(""),[u,p]=l.useState(null),[v,f]=l.useState(""),[g,k]=l.useState(!1),b=l.useRef(null);l.useEffect(()=>{if(!v)return;const j=setTimeout(()=>f(""),2e3);return()=>clearTimeout(j)},[v]),l.useEffect(()=>{if(!g)return;const j=setTimeout(()=>k(!1),1500);return()=>clearTimeout(j)},[g]);const U=async()=>{if(!(!r.trim()||c)){h(!0);try{await q.typeText(e,r),i(""),f("Sent")}catch(j){a(Me("send the text",j),"error")}finally{h(!1)}}},N=async()=>{p("read");try{const j=await q.getClipboard(e),A=typeof(j==null?void 0:j.content)=="string"?j.content:"";o(A),A||f("The device clipboard is empty")}catch(j){a(Yl(s,j),"error")}finally{p(null)}},w=async()=>{if(d){p("write");try{await q.setClipboard(e,d),f("Written to the device")}catch(j){a(Me("write the clipboard",j),"error")}finally{p(null)}}},C=async()=>{var j;if(await Ws(d)){k(!0);return}(j=b.current)==null||j.select(),a(Ia,"info")};return t.jsxs("section",{className:"actions-section","aria-labelledby":"actions-text-title",children:[t.jsxs("h4",{id:"actions-text-title",className:"actions-section-title",children:[t.jsx(Di,{size:15,"aria-hidden":"true"})," Text and clipboard"]}),t.jsxs("div",{className:"actions-field-row",children:[t.jsx("label",{className:"actions-field-label",htmlFor:"actions-send-text",children:"Send text"}),t.jsx("input",{id:"actions-send-text",type:"text",className:"type-input-field compact",placeholder:"Type text for the focused field…",value:r,onChange:j=>i(j.target.value),onKeyDown:j=>j.key==="Enter"&&U()}),t.jsxs(F,{variant:"secondary",size:"md",onClick:U,disabled:!r.trim()||c,children:[c&&t.jsx(yt,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Send"]})]}),t.jsxs("div",{className:"actions-field-row",children:[t.jsx("label",{className:"actions-field-label",htmlFor:"actions-clipboard",children:"Clipboard"}),t.jsx("input",{id:"actions-clipboard",ref:b,type:"text",className:"type-input-field compact",placeholder:n?"Read the device clipboard, or type text to write":"Read the device clipboard","aria-describedby":n?void 0:"actions-clipboard-hint",value:d,onChange:j=>o(j.target.value)}),t.jsxs(F,{variant:"secondary",size:"md",onClick:N,disabled:u!==null,children:[u==="read"&&t.jsx(yt,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Read"]}),n&&t.jsxs(F,{variant:"secondary",size:"md",onClick:w,disabled:!d||u!==null,children:[u==="write"&&t.jsx(yt,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Write to device"]}),t.jsx(F,{variant:"ghost",size:"icon","aria-label":g?"Copied":"Copy clipboard text",title:g?"Copied":"Copy to your clipboard",onClick:C,disabled:!d,children:g?t.jsx(It,{size:14,"aria-hidden":"true"}):t.jsx(Oe,{size:14,"aria-hidden":"true"})})]}),!n&&t.jsx("p",{id:"actions-clipboard-hint",className:"actions-field-hint",children:"Android lets Xenon read the clipboard, not write it."}),t.jsx("p",{className:"actions-status",role:"status",children:v})]})}function cd({udid:e,platform:s,deviceName:n,screenWidth:a,screenHeight:r}){const{toast:i}=Fe(),c=async h=>{const d=id(h,a,r);try{await q.swipe(e,d.startX,d.startY,d.endX,d.endY)}catch(o){i(Me(`swipe ${h}`,o),"error")}};return t.jsxs("div",{className:"actions-panel",children:[t.jsx(nd,{udid:e,platform:s,deviceName:n}),t.jsx(od,{udid:e,platform:s}),t.jsx(rd,{onSwipe:c})]})}const ld=[{id:"RECT",label:"Rect"},{id:"CIRCLE",label:"Circle"},{id:"ARROW",label:"Arrow"},{id:"FREEHAND",label:"Draw"}];function dd({shape:e,color:s,marks:n,saving:a,onShape:r,onColor:i,onUndo:c,onClear:h,onCancel:d,onSave:o}){return t.jsxs("div",{className:"shots-actions",role:"toolbar","aria-label":"Annotate",children:[t.jsxs("div",{className:"shots-shapes",children:[ld.map(u=>t.jsx(F,{variant:"secondary",size:"sm","aria-pressed":e===u.id,className:e===u.id?"is-pressed":void 0,onClick:()=>r(u.id),children:u.label},u.id)),t.jsx("input",{type:"color",className:"shots-color",value:s,onChange:u=>i(u.target.value),"aria-label":"Mark colour",title:"Mark colour"})]}),t.jsx(F,{variant:"ghost",size:"sm",onClick:c,disabled:!n||a,children:"Undo mark"}),t.jsx(F,{variant:"ghost",size:"sm",onClick:h,disabled:!n||a,children:"Clear marks"}),t.jsx("span",{className:"shots-actions-gap"}),t.jsx(F,{variant:"secondary",size:"sm",onClick:d,disabled:a,children:"Cancel"}),t.jsxs(F,{size:"sm",onClick:o,disabled:!n||a,children:[a&&t.jsx(yt,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Save copy"]})]})}function xt(e){return`Screenshot ${e.n}`}const nt=e=>String(e).padStart(2,"0");function Fn(e){return`${nt(e.getHours())}:${nt(e.getMinutes())}:${nt(e.getSeconds())}`}function ud(e,s){return e.getFullYear()===s.getFullYear()&&e.getMonth()===s.getMonth()&&e.getDate()===s.getDate()}function Ms(e,s=Date.now()){const n=new Date(e);return ud(n,new Date(s))?`Today ${Fn(n)}`:`${n.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})} ${Fn(n)}`}function hd(e,s){return!e||!s?"":e>s?"Landscape":"Portrait"}function md(e){return e<1024?`${Math.round(e)} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ka(e,s=Date.now()){const n=[xt(e)];e.markedFrom!==void 0&&n.push(`marked copy of ${e.markedFrom}`),n.push(Ms(e.takenAt,s));const a=hd(e.width,e.height);return a&&n.push(a,`${e.width} × ${e.height}`),n.push(md(e.bytes)),n.join(" · ")}function Xa(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"device"}function Ya(e){const s=new Date(e);return`${s.getFullYear()}-${nt(s.getMonth()+1)}-${nt(s.getDate())}`}function Ga(e,s){const n=new Date(s.takenAt),a=`${nt(n.getHours())}-${nt(n.getMinutes())}-${nt(n.getSeconds())}`,r=s.markedFrom!==void 0?"-marked":"";return`${Xa(e)}-screenshot-${s.n}${r}-${Ya(s.takenAt)}-${a}.png`}function fd(e,s=Date.now()){return`${Xa(e)}-screenshots-${Ya(s)}.zip`}async function pd(e){const s=globalThis.ClipboardItem,n=navigator.clipboard;if(!s||typeof(n==null?void 0:n.write)!="function")return!1;try{const a=e.type==="image/png"?e:new Blob([e],{type:"image/png"});return await n.write([new s({"image/png":a})]),!0}catch{return!1}}var Ne=Uint8Array,Ee=Uint16Array,Ks=Int32Array,Xs=new Ne([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ys=new Ne([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Pn=new Ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Za=function(e,s){for(var n=new Ee(31),a=0;a<31;++a)n[a]=s+=1<<e[a-1];for(var r=new Ks(n[30]),a=1;a<30;++a)for(var i=n[a];i<n[a+1];++i)r[i]=i-n[a]<<5|a;return{b:n,r}},Ja=Za(Xs,2),vd=Ja.b,zs=Ja.r;vd[28]=258,zs[258]=28;var yd=Za(Ys,0),Un=yd.r,Ls=new Ee(32768);for(var de=0;de<32768;++de){var tt=(de&43690)>>1|(de&21845)<<1;tt=(tt&52428)>>2|(tt&13107)<<2,tt=(tt&61680)>>4|(tt&3855)<<4,Ls[de]=((tt&65280)>>8|(tt&255)<<8)>>1}var Lt=function(e,s,n){for(var a=e.length,r=0,i=new Ee(s);r<a;++r)e[r]&&++i[e[r]-1];var c=new Ee(s);for(r=1;r<s;++r)c[r]=c[r-1]+i[r-1]<<1;var h;if(n){h=new Ee(1<<s);var d=15-s;for(r=0;r<a;++r)if(e[r])for(var o=r<<4|e[r],u=s-e[r],p=c[e[r]-1]++<<u,v=p|(1<<u)-1;p<=v;++p)h[Ls[p]>>d]=o}else for(h=new Ee(a),r=0;r<a;++r)e[r]&&(h[r]=Ls[c[e[r]-1]++]>>15-e[r]);return h},gt=new Ne(288);for(var de=0;de<144;++de)gt[de]=8;for(var de=144;de<256;++de)gt[de]=9;for(var de=256;de<280;++de)gt[de]=7;for(var de=280;de<288;++de)gt[de]=8;var is=new Ne(32);for(var de=0;de<32;++de)is[de]=5;var xd=Lt(gt,9,0),gd=Lt(is,5,0),Qa=function(e){return(e+7)/8|0},er=function(e,s,n){return(n==null||n>e.length)&&(n=e.length),new Ne(e.subarray(s,n))},jd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ds=function(e,s,n){var a=new Error(s||jd[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,ds),!n)throw a;return a},qe=function(e,s,n){n<<=s&7;var a=s/8|0;e[a]|=n,e[a+1]|=n>>8},At=function(e,s,n){n<<=s&7;var a=s/8|0;e[a]|=n,e[a+1]|=n>>8,e[a+2]|=n>>16},ks=function(e,s){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var r=n.length,i=n.slice();if(!r)return{t:sr,l:0};if(r==1){var c=new Ne(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(j,A){return j.f-A.f}),n.push({s:-1,f:25001});var h=n[0],d=n[1],o=0,u=1,p=2;for(n[0]={s:-1,f:h.f+d.f,l:h,r:d};u!=r-1;)h=n[n[o].f<n[p].f?o++:p++],d=n[o!=u&&n[o].f<n[p].f?o++:p++],n[u++]={s:-1,f:h.f+d.f,l:h,r:d};for(var v=i[0].s,a=1;a<r;++a)i[a].s>v&&(v=i[a].s);var f=new Ee(v+1),g=Is(n[u-1],f,0);if(g>s){var a=0,k=0,b=g-s,U=1<<b;for(i.sort(function(A,T){return f[T.s]-f[A.s]||A.f-T.f});a<r;++a){var N=i[a].s;if(f[N]>s)k+=U-(1<<g-f[N]),f[N]=s;else break}for(k>>=b;k>0;){var w=i[a].s;f[w]<s?k-=1<<s-f[w]++-1:++a}for(;a>=0&&k;--a){var C=i[a].s;f[C]==s&&(--f[C],++k)}g=s}return{t:new Ne(f),l:g}},Is=function(e,s,n){return e.s==-1?Math.max(Is(e.l,s,n+1),Is(e.r,s,n+1)):s[e.s]=n},Bn=function(e){for(var s=e.length;s&&!e[--s];);for(var n=new Ee(++s),a=0,r=e[0],i=1,c=function(d){n[a++]=d},h=1;h<=s;++h)if(e[h]==r&&h!=s)++i;else{if(!r&&i>2){for(;i>138;i-=138)c(32754);i>2&&(c(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(c(r),--i;i>6;i-=6)c(8304);i>2&&(c(i-3<<5|8208),i=0)}for(;i--;)c(r);i=1,r=e[h]}return{c:n.subarray(0,a),n:s}},Dt=function(e,s){for(var n=0,a=0;a<s.length;++a)n+=e[a]*s[a];return n},tr=function(e,s,n){var a=n.length,r=Qa(s+2);e[r]=a&255,e[r+1]=a>>8,e[r+2]=e[r]^255,e[r+3]=e[r+1]^255;for(var i=0;i<a;++i)e[r+i+4]=n[i];return(r+4+a)*8},Hn=function(e,s,n,a,r,i,c,h,d,o,u){qe(s,u++,n),++r[256];for(var p=ks(r,15),v=p.t,f=p.l,g=ks(i,15),k=g.t,b=g.l,U=Bn(v),N=U.c,w=U.n,C=Bn(k),j=C.c,A=C.n,T=new Ee(19),$=0;$<N.length;++$)++T[N[$]&31];for(var $=0;$<j.length;++$)++T[j[$]&31];for(var m=ks(T,7),S=m.t,I=m.l,B=19;B>4&&!S[Pn[B-1]];--B);var L=o+5<<3,Y=Dt(r,gt)+Dt(i,is)+c,ee=Dt(r,v)+Dt(i,k)+c+14+3*B+Dt(T,S)+2*T[16]+3*T[17]+7*T[18];if(d>=0&&L<=Y&&L<=ee)return tr(s,u,e.subarray(d,d+o));var J,H,x,z;if(qe(s,u,1+(ee<Y)),u+=2,ee<Y){J=Lt(v,f,0),H=v,x=Lt(k,b,0),z=k;var V=Lt(S,I,0);qe(s,u,w-257),qe(s,u+5,A-1),qe(s,u+10,B-4),u+=14;for(var $=0;$<B;++$)qe(s,u+3*$,S[Pn[$]]);u+=3*B;for(var M=[N,j],W=0;W<2;++W)for(var ae=M[W],$=0;$<ae.length;++$){var K=ae[$]&31;qe(s,u,V[K]),u+=S[K],K>15&&(qe(s,u,ae[$]>>5&127),u+=ae[$]>>12)}}else J=xd,H=gt,x=gd,z=is;for(var $=0;$<h;++$){var ne=a[$];if(ne>255){var K=ne>>18&31;At(s,u,J[K+257]),u+=H[K+257],K>7&&(qe(s,u,ne>>23&31),u+=Xs[K]);var re=ne&31;At(s,u,x[re]),u+=z[re],re>3&&(At(s,u,ne>>5&8191),u+=Ys[re])}else At(s,u,J[ne]),u+=H[ne]}return At(s,u,J[256]),u+H[256]},bd=new Ks([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sr=new Ne(0),wd=function(e,s,n,a,r,i){var c=i.z||e.length,h=new Ne(a+c+5*(1+Math.ceil(c/7e3))+r),d=h.subarray(a,h.length-r),o=i.l,u=(i.r||0)&7;if(s){u&&(d[0]=i.r>>3);for(var p=bd[s-1],v=p>>13,f=p&8191,g=(1<<n)-1,k=i.p||new Ee(32768),b=i.h||new Ee(g+1),U=Math.ceil(n/3),N=2*U,w=function(Te){return(e[Te]^e[Te+1]<<U^e[Te+2]<<N)&g},C=new Ks(25e3),j=new Ee(288),A=new Ee(32),T=0,$=0,m=i.i||0,S=0,I=i.w||0,B=0;m+2<c;++m){var L=w(m),Y=m&32767,ee=b[L];if(k[Y]=ee,b[L]=Y,I<=m){var J=c-m;if((T>7e3||S>24576)&&(J>423||!o)){u=Hn(e,d,0,C,j,A,$,S,B,m-B,u),S=T=$=0,B=m;for(var H=0;H<286;++H)j[H]=0;for(var H=0;H<30;++H)A[H]=0}var x=2,z=0,V=f,M=Y-ee&32767;if(J>2&&L==w(m-M))for(var W=Math.min(v,J)-1,ae=Math.min(32767,m),K=Math.min(258,J);M<=ae&&--V&&Y!=ee;){if(e[m+x]==e[m+x-M]){for(var ne=0;ne<K&&e[m+ne]==e[m+ne-M];++ne);if(ne>x){if(x=ne,z=M,ne>W)break;for(var re=Math.min(M,ne-2),be=0,H=0;H<re;++H){var E=m-M+H&32767,ie=k[E],te=E-ie&32767;te>be&&(be=te,ee=E)}}}Y=ee,ee=k[Y],M+=Y-ee&32767}if(z){C[S++]=268435456|zs[x]<<18|Un[z];var se=zs[x]&31,me=Un[z]&31;$+=Xs[se]+Ys[me],++j[257+se],++A[me],I=m+x,++T}else C[S++]=e[m],++j[e[m]]}}for(m=Math.max(m,I);m<c;++m)C[S++]=e[m],++j[e[m]];u=Hn(e,d,o,C,j,A,$,S,B,m-B,u),o||(i.r=u&7|d[u/8|0]<<3,u-=7,i.h=b,i.p=k,i.i=m,i.w=I)}else{for(var m=i.w||0;m<c+o;m+=65535){var ue=m+65535;ue>=c&&(d[u/8|0]=o,ue=c),u=tr(d,u+1,e.subarray(m,ue))}i.i=c}return er(h,0,a+Qa(u)+r)},kd=function(){for(var e=new Int32Array(256),s=0;s<256;++s){for(var n=s,a=9;--a;)n=(n&1&&-306674912)^n>>>1;e[s]=n}return e}(),Nd=function(){var e=-1;return{p:function(s){for(var n=e,a=0;a<s.length;++a)n=kd[n&255^s[a]]^n>>>8;e=n},d:function(){return~e}}},Cd=function(e,s,n,a,r){if(!r&&(r={l:1},s.dictionary)){var i=s.dictionary.subarray(-32768),c=new Ne(i.length+e.length);c.set(i),c.set(e,i.length),e=c,r.w=i.length}return wd(e,s.level==null?6:s.level,s.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+s.mem,n,a,r)},nr=function(e,s){var n={};for(var a in e)n[a]=e[a];for(var a in s)n[a]=s[a];return n},je=function(e,s,n){for(;n;++s)e[s]=n,n>>>=8};function Sd(e,s){return Cd(e,s||{},0,0)}var ar=function(e,s,n,a){for(var r in e){var i=e[r],c=s+r,h=a;Array.isArray(i)&&(h=nr(a,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[c]=[i,h]:(n[c+="/"]=[new Ne(0),h],ar(i,c,n,a))}},Vn=typeof TextEncoder<"u"&&new TextEncoder,$d=typeof TextDecoder<"u"&&new TextDecoder,Td=0;try{$d.decode(sr,{stream:!0}),Td=1}catch{}function Wn(e,s){var n;if(Vn)return Vn.encode(e);for(var a=e.length,r=new Ne(e.length+(e.length>>1)),i=0,c=function(o){r[i++]=o},n=0;n<a;++n){if(i+5>r.length){var h=new Ne(i+8+(a-n<<1));h.set(r),r=h}var d=e.charCodeAt(n);d<128||s?c(d):d<2048?(c(192|d>>6),c(128|d&63)):d>55295&&d<57344?(d=65536+(d&1047552)|e.charCodeAt(++n)&1023,c(240|d>>18),c(128|d>>12&63),c(128|d>>6&63),c(128|d&63)):(c(224|d>>12),c(128|d>>6&63),c(128|d&63))}return er(r,0,i)}var _s=function(e){var s=0;if(e)for(var n in e){var a=e[n].length;a>65535&&ds(9),s+=a+4}return s},qn=function(e,s,n,a,r,i,c,h){var d=a.length,o=n.extra,u=h&&h.length,p=_s(o);je(e,s,c!=null?33639248:67324752),s+=4,c!=null&&(e[s++]=20,e[s++]=n.os),e[s]=20,s+=2,e[s++]=n.flag<<1|(i<0&&8),e[s++]=r&&8,e[s++]=n.compression&255,e[s++]=n.compression>>8;var v=new Date(n.mtime==null?Date.now():n.mtime),f=v.getFullYear()-1980;if((f<0||f>119)&&ds(10),je(e,s,f<<25|v.getMonth()+1<<21|v.getDate()<<16|v.getHours()<<11|v.getMinutes()<<5|v.getSeconds()>>1),s+=4,i!=-1&&(je(e,s,n.crc),je(e,s+4,i<0?-i-2:i),je(e,s+8,n.size)),je(e,s+12,d),je(e,s+14,p),s+=16,c!=null&&(je(e,s,u),je(e,s+6,n.attrs),je(e,s+10,c),s+=14),e.set(a,s),s+=d,p)for(var g in o){var k=o[g],b=k.length;je(e,s,+g),je(e,s+2,b),e.set(k,s+4),s+=4+b}return u&&(e.set(h,s),s+=u),s},Rd=function(e,s,n,a,r){je(e,s,101010256),je(e,s+8,n),je(e,s+10,n),je(e,s+12,a),je(e,s+16,r)};function Ed(e,s){s||(s={});var n={},a=[];ar(e,"",n,s);var r=0,i=0;for(var c in n){var h=n[c],d=h[0],o=h[1],u=o.level==0?0:8,p=Wn(c),v=p.length,f=o.comment,g=f&&Wn(f),k=g&&g.length,b=_s(o.extra);v>65535&&ds(11);var U=u?Sd(d,o):d,N=U.length,w=Nd();w.p(d),a.push(nr(o,{size:d.length,crc:w.d(),c:U,f:p,m:g,u:v!=c.length||g&&f.length!=k,o:r,compression:u})),r+=30+v+b+N,i+=76+2*(v+b)+(k||0)+N}for(var C=new Ne(i+22),j=r,A=i-r,T=0;T<a.length;++T){var p=a[T];qn(C,p.o,p,p.f,p.u,p.c.length);var $=30+p.f.length+_s(p.extra);C.set(p.c,p.o+$),qn(C,r,p,p.f,p.u,p.c.length,p.o,p.m),r+=16+$+(p.m?p.m.length:0)}return Rd(C,r,a.length,A,j),C}function Ad(e,s="image/png"){const n=atob(e),a=new Uint8Array(n.length);for(let r=0;r<n.length;r++)a[r]=n.charCodeAt(r);return new Blob([a],{type:s})}async function Dd(e){return typeof e.arrayBuffer=="function"?new Uint8Array(await e.arrayBuffer()):new Promise((s,n)=>{const a=new FileReader;a.onload=()=>s(new Uint8Array(a.result)),a.onerror=()=>n(a.error),a.readAsArrayBuffer(e)})}function Md(e){return new Promise((s,n)=>{const a=URL.createObjectURL(e),r=new Image;r.onload=()=>{URL.revokeObjectURL(a),s(r)},r.onerror=()=>{URL.revokeObjectURL(a),n(new Error("the picture could not be read"))},r.src=a})}function zd(e,s){return Promise.race([e,new Promise((n,a)=>setTimeout(()=>a(new Error("timed out")),s))])}async function Gs(e){if(typeof createImageBitmap=="function"){const n=await createImageBitmap(e);return{source:n,width:n.width,height:n.height}}const s=await zd(Md(e),3e3);return{source:s,width:s.naturalWidth,height:s.naturalHeight}}async function Ld(e){try{const{width:s,height:n}=await Gs(e);return{width:s,height:n}}catch{return{width:0,height:0}}}function rr(e,s,n){return new Promise((a,r)=>{e.toBlob(i=>i?a(i):r(new Error("the picture could not be made")),s,n)})}const Id=320;async function _d(e,s=Id){try{const{source:n,width:a,height:r}=await Gs(e);if(!a||!r)return e;const i=Math.min(1,s/Math.max(a,r)),c=document.createElement("canvas");c.width=Math.max(1,Math.round(a*i)),c.height=Math.max(1,Math.round(r*i));const h=c.getContext("2d");return h?(h.drawImage(n,0,0,c.width,c.height),await rr(c,"image/jpeg",.8)):e}catch{return e}}async function Od(e,s){const{source:n,width:a,height:r}=await Gs(e);if(!a||!r)throw new Error("the picture could not be read");const i=document.createElement("canvas");i.width=a,i.height=r;const c=i.getContext("2d");if(!c)throw new Error("this browser cannot draw here");return c.drawImage(n,0,0,a,r),s.forEach(h=>Jr(c,a,r,h)),rr(i,"image/png")}function Fd(e){const s=new Map;return e.map(n=>{const a=(s.get(n)??0)+1;if(s.set(n,a),a===1)return n;const r=n.lastIndexOf(".");return r>0?`${n.slice(0,r)}-${a}${n.slice(r)}`:`${n}-${a}`})}async function Pd(e,s){const n=Fd(s.map(c=>Ga(e,c))),a={},r=await Promise.all(s.map(c=>Dd(c.png)));n.forEach((c,h)=>{a[c]=r[h]});const i=Ed(a,{level:0});return new Blob([i],{type:"application/zip"})}function Kn(e,s){const n=URL.createObjectURL(e),a=document.createElement("a");a.href=n,a.download=s,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function ir({capture:e,actualSize:s,onToggleSize:n,annotate:a}){const r=e.width&&e.height?e.width/e.height:void 0;return t.jsx("div",{className:`shots-picture${s&&!a?" is-actual":""}`,children:t.jsxs("div",{className:"shots-picture-frame",children:[t.jsx("img",{src:e.url,alt:xt(e),draggable:!1,onClick:a?void 0:n,className:n&&!a?"is-zoomable":void 0}),a&&t.jsx(Qr,{enabled:!0,shape:a.shape,color:a.color,committed:a.marks,onCommittedChange:a.onMarksChange,onCommit:()=>{},mediaAspect:r})]})})}function Ud({a:e,b:s}){return t.jsx("div",{className:"shots-compare",children:[e,s].map((n,a)=>t.jsxs("figure",{className:"shots-compare-side",children:[t.jsx("span",{className:"shots-compare-tag","aria-hidden":"true",children:a===0?"A":"B"}),n?t.jsxs(t.Fragment,{children:[t.jsx(ir,{capture:n}),t.jsx("figcaption",{className:"shots-details",children:Ka(n)})]}):t.jsx("p",{className:"shots-compare-empty",children:"Pick a screenshot in the list to compare with."})]},a))})}function Bd({captures:e,activeId:s,compare:n,taking:a,onTake:r,onPick:i,onDelete:c}){const h=l.useRef(null),d=Date.now(),o=v=>{var g,k;const f=(g=h.current)==null?void 0:g.querySelector(`[data-capture="${v}"]`);f==null||f.focus(),(k=f==null?void 0:f.scrollIntoView)==null||k.call(f,{block:"nearest"})},u=v=>{if(!e.length)return;const f=Math.max(0,e.findIndex(k=>k.id===s));let g=null;if(v.key==="ArrowDown"||v.key==="ArrowRight")g=Math.min(e.length-1,f+1);else if(v.key==="ArrowUp"||v.key==="ArrowLeft")g=Math.max(0,f-1);else if(v.key==="Home")g=0;else if(v.key==="End")g=e.length-1;else if((v.key==="Delete"||v.key==="Backspace")&&s&&!n){v.preventDefault(),c(s);return}g!==null&&(v.preventDefault(),i(e[g].id),o(e[g].id))},p=v=>n?n.a===v?"A":n.b===v?"B":null:null;return t.jsxs("div",{className:"shots-rail",children:[t.jsxs(F,{className:"shots-take",size:"md",onClick:r,disabled:a,children:[a?t.jsx(yt,{className:"animate-spin",size:14,"aria-hidden":"true"}):t.jsx(Mt,{size:14,"aria-hidden":"true"}),a?"Taking screenshot…":"Take screenshot"]}),t.jsxs("div",{ref:h,className:"shots-list",role:"listbox","aria-label":n?"Screenshots, pick the right side":"Screenshots",onKeyDown:u,children:[a&&t.jsx("div",{className:"shots-thumb is-pending","aria-hidden":"true"}),e.map(v=>{const f=v.id===s,g=p(v.id);return t.jsxs("div",{"data-capture":v.id,role:"option","aria-selected":f,tabIndex:f||!s&&v===e[0]?0:-1,className:`shots-thumb${f?" is-active":""}${g?" is-compared":""}`,"aria-label":`${xt(v)}${v.markedFrom!==void 0?`, marked copy of ${v.markedFrom}`:""}, ${Ms(v.takenAt,d)}${g?`, side ${g}`:""}`,onClick:()=>i(v.id),children:[t.jsx("img",{src:v.thumbUrl,alt:"",draggable:!1}),g&&t.jsx("span",{className:"shots-thumb-side",children:g}),t.jsxs("span",{className:"shots-thumb-label",children:[t.jsxs("span",{className:"shots-thumb-n",children:[v.markedFrom!==void 0&&t.jsx(ha,{size:10,"aria-hidden":"true"}),v.n]}),t.jsx("span",{className:"shots-thumb-time",children:Ms(v.takenAt,d).replace("Today ","")})]})]},v.id)})]})]})}var Kt,Hd=new Uint8Array(16);function Vd(){if(!Kt&&(Kt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Kt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Kt(Hd)}const Wd=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function qd(e){return typeof e=="string"&&Wd.test(e)}var ge=[];for(var Ns=0;Ns<256;++Ns)ge.push((Ns+256).toString(16).substr(1));function Kd(e){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ge[e[s+0]]+ge[e[s+1]]+ge[e[s+2]]+ge[e[s+3]]+"-"+ge[e[s+4]]+ge[e[s+5]]+"-"+ge[e[s+6]]+ge[e[s+7]]+"-"+ge[e[s+8]]+ge[e[s+9]]+"-"+ge[e[s+10]]+ge[e[s+11]]+ge[e[s+12]]+ge[e[s+13]]+ge[e[s+14]]+ge[e[s+15]]).toLowerCase();if(!qd(n))throw TypeError("Stringified UUID is invalid");return n}function Xd(e,s,n){e=e||{};var a=e.random||(e.rng||Vd)();return a[6]=a[6]&15|64,a[8]=a[8]&63|128,Kd(a)}const vt=50,Xn=6e3;function Cs(e){const s=URL.createObjectURL(e.png),n=e.thumb===e.png?s:URL.createObjectURL(e.thumb);return{...e,url:s,thumbUrl:n}}function Xt(e){URL.revokeObjectURL(e.url),e.thumbUrl!==e.url&&URL.revokeObjectURL(e.thumbUrl)}function Yn({url:e,thumbUrl:s,...n}){return n}function Yd(e,s){return s.takenAt-e.takenAt||s.n-e.n}function Gd(e,s=pr){const{toast:n}=Fe(),[a,r]=l.useState([]),[i,c]=l.useState(null),[h,d]=l.useState(!1),[o,u]=l.useState(!0),[p,v]=l.useState(!1),f=l.useRef(null),g=l.useRef([]);g.current=a;const k=l.useRef(0),b=l.useRef(!0);l.useEffect(()=>{b.current=!0;let m=!1;return d(!1),r([]),c(null),k.current=0,(async()=>{var L;const S=await s();let I=[];try{I=await S.list(e)}catch{I=[]}if(m)return;f.current=S;const B=I.slice(0,vt).map(Cs);k.current=B.reduce((Y,ee)=>Math.max(Y,ee.n),0),u(S.persistent),r(B),c(((L=B[0])==null?void 0:L.id)??null),d(!0)})(),()=>{m=!0}},[e]),l.useEffect(()=>()=>{b.current=!1,g.current.forEach(Xt)},[]);const U=l.useCallback(async m=>{const S=f.current;if(S)try{await S.put(m)}catch{n(`Couldn’t keep ${xt(m)} in this browser. It’s here until you leave the page.`,"error")}},[n]),N=l.useCallback((m,S)=>{var Y,ee;const I=[...m,...g.current].sort(Yd),B=I.slice(vt),L=I.slice(0,vt);B.forEach(Xt),B.length&&((Y=f.current)==null||Y.delete(B.map(J=>J.id)).catch(()=>{})),g.current=L,r(L),c(L.some(J=>J.id===S)?S:((ee=L[0])==null?void 0:ee.id)??null)},[]),w=l.useCallback(async(m,S={})=>{const[I,B]=await Promise.all([Ld(m),_d(m)]);if(!b.current)return;k.current+=1;const L={id:Xd(),udid:e,n:k.current,takenAt:Date.now(),width:I.width,height:I.height,bytes:m.size,png:m,thumb:B,...S};N([Cs(L)],L.id),await U(L)},[e,N,U]),C=l.useCallback(async()=>{v(!0);try{let m;try{m=await q.getScreenshot(e)}catch(S){n(Me("take a screenshot",S),"error");return}if(!(m!=null&&m.screenshot)){const S=(m==null?void 0:m.error)||(m==null?void 0:m.message);n(S?Me("take a screenshot",{message:S}):"Couldn’t take a screenshot. The phone sent no picture.","error");return}await w(Ad(m.screenshot))}finally{b.current&&v(!1)}},[e,n,w]),j=l.useCallback((m,S)=>w(S,{markedFrom:m.n}),[w]),A=l.useCallback(async m=>{if(!b.current||!m.length)return;const S=m.filter(B=>!g.current.some(L=>L.id===B.id));N(S.map(Cs),m[0].id);const I=f.current;await Promise.all(S.map(B=>I==null?void 0:I.put(B).catch(()=>{})))},[N]),T=l.useCallback(async m=>{var ee;const S=g.current,I=S.findIndex(J=>J.id===m);if(I<0)return;const B=S[I],L=S.filter(J=>J.id!==m);g.current=L,r(L),c(J=>{var H;return J===m?((H=L[I]??L[I-1])==null?void 0:H.id)??null:J}),Xt(B);const Y=Yn(B);n(`Deleted ${xt(B)}`,"info",Xn,{label:"Undo",onClick:()=>void A([Y])}),await((ee=f.current)==null?void 0:ee.delete([m]).catch(()=>{}))},[n,A]),$=l.useCallback(async()=>{var I;const m=g.current;if(!m.length)return;g.current=[],r([]),c(null),m.forEach(Xt);const S=m.map(Yn);n(`Cleared ${m.length} screenshot${m.length===1?"":"s"}`,"info",Xn,{label:"Undo",onClick:()=>void A(S)}),await((I=f.current)==null?void 0:I.clear(e).catch(()=>{}))},[e,n,A]);return{captures:a,selectedId:i,select:c,ready:h,persistent:o,taking:p,take:C,addMarkedCopy:j,remove:T,clearAll:$}}function Zd({udid:e,deviceName:s,openStore:n}){const{toast:a}=Fe(),r=Gd(e,n),{captures:i,selectedId:c,select:h}=r,d=i.find(M=>M.id===c)??null,[o,u]=l.useState("view"),[p,v]=l.useState(null),[f,g]=l.useState(!1),[k,b]=l.useState("RECT"),[U,N]=l.useState(Ar.color),[w,C]=l.useState([]),[j,A]=l.useState(!1),[T,$]=l.useState(!1),m=l.useCallback(()=>{u("view"),C([]),v(null)},[]);l.useEffect(()=>{o!=="view"&&(d?o==="compare"&&p&&!i.some(M=>M.id===p)&&v(null):m())},[o,d,p,i,m]);const S=l.useRef(null),I=l.useRef(o);I.current=o,l.useEffect(()=>{const M=S.current;if(!M)return;const W=ae=>{ae.key!=="Escape"||ae.defaultPrevented||I.current==="view"||(ae.preventDefault(),m())};return M.addEventListener("keydown",W),()=>M.removeEventListener("keydown",W)},[m]);const B=M=>{if(o==="compare"){M!==c&&v(M);return}o==="annotate"&&M!==c&&m(),h(M)},L=()=>{if(!d)return;const M=i.indexOf(d),W=i[M+1]??i[M-1]??null;C([]),v((W==null?void 0:W.id)??null),u("compare")},Y=async()=>{d&&(await pd(d.png)?a(`Copied ${xt(d)}`,"success"):a("Your browser can’t copy pictures on this address. Use Download instead.","error"))},ee=()=>{d&&Kn(d.png,Ga(s,d))},J=async()=>{$(!0);try{Kn(await Pd(s,i),fd(s))}catch(M){a(Me("make the zip",M),"error")}finally{$(!1)}},H=async()=>{if(!(!d||!w.length)){A(!0);try{const M=await Od(d.png,w);await r.addMarkedCopy(d,M),a(`Saved a marked copy of ${xt(d)}`,"success"),m()}catch(M){a(Me("save the marked copy",M),"error")}finally{A(!1)}}},x=i.length,z=r.persistent?x>=vt?`${x} of ${vt} kept · the oldest goes when you take another`:`${x} of ${vt} kept`:"Kept until you leave this page",V=i.find(M=>M.id===p)??null;return t.jsxs("div",{ref:S,className:"shots-root",children:[t.jsxs("header",{className:"shots-head",children:[t.jsxs("h4",{className:"shots-title",children:[t.jsx(Mt,{size:14,"aria-hidden":"true"}),"Screenshots"]}),r.ready&&t.jsx("span",{className:"shots-kept",title:r.persistent?"This browser keeps the newest 50 screenshots of each phone.":"This browser isn’t saving screenshots here, for example in a private window.",children:z}),t.jsx("span",{className:"shots-actions-gap"}),o==="compare"?t.jsx(F,{variant:"secondary",size:"sm",onClick:m,children:"Done"}):t.jsxs(F,{variant:"secondary",size:"sm",onClick:L,disabled:x<2||o==="annotate",children:[t.jsx(bi,{size:13,"aria-hidden":"true"}),"Compare"]}),t.jsxs(F,{variant:"secondary",size:"sm",onClick:J,disabled:!x||T,children:[T?t.jsx(yt,{className:"animate-spin",size:13,"aria-hidden":"true"}):t.jsx(Si,{size:13,"aria-hidden":"true"}),"Download all"]}),t.jsx(F,{variant:"secondary",size:"sm",onClick:()=>{m(),r.clearAll()},disabled:!x,children:"Clear all"})]}),r.ready&&!x&&!r.taking?t.jsxs("div",{className:"shots-empty",children:[t.jsx(Mt,{size:22,"aria-hidden":"true"}),t.jsx("p",{className:"shots-empty-title",children:"No screenshots yet"}),t.jsxs("p",{className:"shots-empty-hint",children:["Take one to keep it here. This browser keeps the newest ",vt," for this phone."]}),t.jsxs(F,{size:"md",onClick:()=>void r.take(),children:[t.jsx(Mt,{size:14,"aria-hidden":"true"}),"Take screenshot"]})]}):r.ready?t.jsxs("div",{className:"shots-body",children:[t.jsx(Bd,{captures:i,activeId:o==="compare"?p??c:c,compare:o==="compare"&&c?{a:c,b:p}:void 0,taking:r.taking,onTake:()=>void r.take(),onPick:B,onDelete:M=>void r.remove(M)}),t.jsx("section",{className:"shots-preview","aria-label":"Preview",children:d&&o==="compare"?t.jsx(Ud,{a:d,b:V}):d?t.jsxs(t.Fragment,{children:[t.jsx(ir,{capture:d,actualSize:f,onToggleSize:()=>g(M=>!M),annotate:o==="annotate"?{shape:k,color:U,marks:w,onMarksChange:C}:void 0}),t.jsxs("footer",{className:"shots-footer",children:[t.jsx("p",{className:"shots-details",children:Ka(d)}),o==="annotate"?t.jsx(dd,{shape:k,color:U,marks:w.length,saving:j,onShape:b,onColor:N,onUndo:()=>C(M=>M.slice(0,-1)),onClear:()=>C([]),onCancel:m,onSave:()=>void H()}):t.jsxs("div",{className:"shots-actions",children:[t.jsxs(F,{variant:"secondary",size:"sm",onClick:()=>void Y(),children:[t.jsx(Oe,{size:13,"aria-hidden":"true"}),"Copy"]}),t.jsxs(F,{variant:"secondary",size:"sm",onClick:()=>{g(!1),u("annotate")},children:[t.jsx(ha,{size:13,"aria-hidden":"true"}),"Annotate"]}),t.jsxs(F,{variant:"secondary",size:"sm",onClick:ee,children:[t.jsx(la,{size:13,"aria-hidden":"true"}),"Download"]}),t.jsxs(F,{variant:"ghost",size:"sm","aria-pressed":f,onClick:()=>g(M=>!M),children:[f?t.jsx(Vi,{size:13,"aria-hidden":"true"}):t.jsx(Pi,{size:13,"aria-hidden":"true"}),"Actual size"]}),t.jsx("span",{className:"shots-actions-gap"}),t.jsxs(F,{variant:"ghost",size:"sm",className:"shots-delete",onClick:()=>void r.remove(d.id),children:[t.jsx(ei,{size:13,"aria-hidden":"true"}),"Delete"]})]})]})]}):null})]}):null]})}const Gn=e=>!!e.session_id&&!String(e.session_id).startsWith("manual_");function Jd({device:e,onClose:s,titleId:n}){const a=La(s),{toast:r}=Fe(),i=X=>oe=>{gr(oe)||r(Me(X,oe),"error")},c=Pt(),{tab:h}=Qn(),d=os(),o=l.useRef(null),[u,p]=l.useState({width:0,height:0}),[v,f]=l.useState("inspect"),[g,k]=l.useState(null),[b,U]=l.useState(h||"actions"),N=b==="omni"&&v==="inspect",[w,C]=l.useState(!0),[j,A]=l.useState(!1),[T,$]=l.useState(0),[m,S]=l.useState(e),[I,B]=l.useState(0),L=l.useCallback(()=>B(Date.now()),[]),Y=at(m);l.useEffect(()=>{vr(m.udid,Y),document.title=yr(d.pathname)},[m.udid,Y,d.pathname]);const[ee,J]=l.useState(!1),[H,x]=l.useState(!1),[z,V]=l.useState(!1),[M,W]=l.useState(null),ae=l.useRef(!1),K=10,[ne,re]=l.useState(!1),[be,E]=l.useState(!1),ie=tl(m==null?void 0:m.udid,!H),te=()=>{navigator.clipboard.writeText(m.udid).catch(()=>{}),re(!0),setTimeout(()=>re(!1),1500)},se=l.useRef(""),me=l.useRef(null),[ue,Te]=l.useState(!1);l.useEffect(()=>{b&&(!h||h!==b)&&c(`/devices/${e.udid}/control/${b}${d.search}`,{replace:!0})},[b,h,e.udid,c,d.search]);const[rt,it]=l.useState(0);sl(()=>{q.leaveStream(m.udid).catch(()=>{})},()=>it(X=>X+1));const Ge=l.useCallback(async()=>{try{await q.startStream(e.udid,{player:"mjpeg"})}catch(X){console.error("Switching the stream to MJPEG failed:",X)}},[e.udid]),he=l.useCallback(async X=>{ae.current||(ae.current=!0,console.warn("H.264 stream failed; falling back to MJPEG"),V(!1),W(null),J(!1),X!=null&&X.streamEnded||await Ge(),V(!0))},[Ge]);l.useEffect(()=>{let X=!1;return ae.current=!1,(async()=>{try{A(!0),V(!1),W(null);const fe=Gn(m),pe=await q.startStream(m.udid,fe?{player:"mjpeg"}:void 0);if(!fe&&(pe!=null&&pe.h264Path)&&zr(m.platform,pe.type,xr())==="h264"){const we=await Lr(m.udid,pe.h264Path).catch(()=>null);X||(we?W(we):await Ge())}const ve=(await q.getDevices()).find(we=>we.udid===m.udid);ve&&S(ve)}catch(fe){console.error("Auto-start stream failed:",fe)}finally{X||(A(!1),V(!0))}})(),()=>{X=!0,q.leaveStream(m.udid).catch(()=>{})}},[e.udid,rt]);const Ze=parseInt(m.screenWidth||"1080",10),Pe=parseInt(m.screenHeight||"1920",10),Ce=Math.min(Ze,Pe),Ae=Math.max(Ze,Pe),ot=Ce/Ae,ze=l.useCallback(()=>{const X=!w,oe=X?window.innerHeight*.55:window.innerHeight*.7,fe=620,Re=window.innerWidth>900;let ve;X?ve=Re?Math.min(window.innerWidth*.8,window.innerWidth-fe):window.innerWidth*.8:ve=window.innerWidth*.45;const we=w?ot:1/ot;let xe,ye;w?(xe=oe,ye=xe*we,ye>ve&&(ye=ve,xe=ye/we)):(ye=ve,xe=ye/we,xe>oe&&(xe=oe,ye=xe*we)),p({width:ye,height:xe})},[ot,w]);l.useEffect(()=>(ze(),window.addEventListener("resize",ze),()=>window.removeEventListener("resize",ze)),[ze]),l.useEffect(()=>{const X=async()=>{if(se.current.length>0){const fe=se.current;se.current="";try{await q.typeText(m.udid,fe)}catch(pe){console.error("Keyboard buffering flush failed:",pe)}finally{L()}}},oe=fe=>{const pe=document.activeElement;if(pe&&(pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.isContentEditable)||!ue&&b!=="terminal")return;const ve=fe.key;ve==="Enter"?(me.current&&clearTimeout(me.current),X(),q.pressKey(m.udid,m.platform==="android"?66:"enter").finally(L)):ve==="Backspace"?(me.current&&clearTimeout(me.current),X(),q.pressKey(m.udid,m.platform==="android"?67:"backspace").finally(L)):ve.length===1&&(se.current+=ve,me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{X()},50))};return window.addEventListener("keydown",oe),()=>{window.removeEventListener("keydown",oe),me.current&&clearTimeout(me.current)}},[m.udid,m.platform,ue,b,L]);const[Ue,Je]=l.useState(Date.now()),jt=()=>{const X=T>0?`r=${T}&`:"";return Gn(m)?`/xenon/api/session/${m.session_id}/live_video?${X}t=${Ue}`:`/xenon/api/control/${m.udid}/stream?${X}t=${Ue}`};l.useEffect(()=>{T>0&&Je(Date.now())},[T]),l.useEffect(()=>{if(ee||H)return;const X=setTimeout(()=>{M?he():x(!0)},3e4);return()=>clearTimeout(X)},[ee,H,T,M,he]);const Be=l.useRef(null),Qe=X=>{const oe=X.currentTarget.getBoundingClientRect();return{x:X.clientX-oe.left,y:X.clientY-oe.top}},bt=X=>{const oe=Qe(X);Be.current={x:oe.x,y:oe.y,time:Date.now()}},He=async X=>{var Tt;if(!Be.current)return;const oe=Be.current,fe=Qe(X),pe=Date.now()-oe.time,Re=(Tt=o.current)==null?void 0:Tt.getBoundingClientRect(),ve=(Re==null?void 0:Re.width)||u.width,we=(Re==null?void 0:Re.height)||u.height;let xe,ye,lt,kt;w?(xe=oe.x/ve*Ce,ye=oe.y/we*Ae,lt=fe.x/ve*Ce,kt=fe.y/we*Ae):(xe=oe.x/ve*Ae,ye=oe.y/we*Ce,lt=fe.x/ve*Ae,kt=fe.y/we*Ce);const Ut=Math.abs(lt-xe),dt=Math.abs(kt-ye);try{pe<500&&Ut<10&&dt<10?await q.tap(m.udid,Math.round(xe),Math.round(ye)):pe>=500&&Ut<10&&dt<10?await q.touchAndHold(m.udid,Math.round(xe),Math.round(ye),pe):await q.swipe(m.udid,Math.round(xe),Math.round(ye),Math.round(lt),Math.round(kt))}catch(Rt){console.error("Action failed:",Rt)}finally{L()}Be.current=null},wt=()=>q.pressKey(m.udid,m.platform==="android"?Et.HOME:vs.HOME).catch(i("press Home")).finally(L),Le=()=>q.pressKey(m.udid,Et.BACK).catch(i("press Back")).finally(L),ct=()=>q.pressKey(m.udid,Et.APP_SWITCH).catch(i("open the app switcher")).finally(L),_=()=>q.pressKey(m.udid,m.platform==="android"?Et.VOLUME_UP:vs.VOLUME_UP).catch(i("press Volume up")).finally(L),Q=()=>q.pressKey(m.udid,m.platform==="android"?Et.VOLUME_DOWN:vs.VOLUME_DOWN).catch(i("press Volume down")).finally(L),ce=()=>q.lock(m.udid).catch(i("lock the device")).finally(L),Se=async()=>{E(!0);try{await q.unlock(m.udid).catch(i("unlock the device"))}finally{L(),setTimeout(()=>E(!1),2500)}};return t.jsxs("div",{className:"device-control-view",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"control-view-top-bar",children:[t.jsxs("button",{className:"back-to-devices-btn",onClick:a,children:[t.jsx(pn,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${m.platform}`,children:m.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",m.sdk]}),m.reservedUntil&&Date.now()<m.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${m.reservedBy}${m.reservationReason?`: ${m.reservationReason}`:""}`,children:["Reserved by ",m.reservedBy||"someone"]}),t.jsx("h2",{id:n,className:"device-name-text",children:Y}),t.jsxs("span",{className:"udid-chip",title:m.udid,children:[t.jsx("span",{className:"udid-chip__value",children:m.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:te,"aria-label":"Copy UDID",title:ne?"Copied!":"Copy UDID",children:ne?t.jsx(It,{size:12}):t.jsx(Oe,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${w?"":"is-landscape"} ${b==="omni"?"omni-mode":""}`,children:[t.jsxs("div",{className:"device-preview-column",children:[t.jsx("div",{className:"device-screen-wrapper",children:t.jsxs("div",{ref:X=>{o.current=X,k(X)},className:`device-stream-canvas ${w?"":"landscape"} ${ue?"focused":""} ${N?"is-inspecting":""}`,style:{width:u.width,height:u.height,background:"var(--black)"},tabIndex:0,onFocus:()=>Te(!0),onBlur:()=>Te(!1),onMouseDown:N?void 0:bt,onMouseUp:N?void 0:He,children:[H?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(Ke,{size:40,color:"var(--red, #f87171)"}),t.jsx("p",{style:{marginTop:16},children:"Stream unavailable"}),t.jsx("button",{className:"btn-premium btn-sm",style:{marginTop:12},onClick:()=>{x(!1),$(0)},children:"Retry"})]}):(j||!ee)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(zt,{size:40,className:"animate-spin",color:"var(--color-accent)"}),t.jsx("p",{style:{marginTop:16},children:j?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!H&&M&&t.jsx(Dr,{wsUrl:M,className:"device-stream-image",onReady:()=>J(!0),onFatal:he}),!H&&!M&&z&&t.jsx(ea,{src:jt(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>J(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),J(!1),T>=K){x(!0);return}setTimeout(()=>$(X=>X+1),2e3)}}),ie==="off"&&!H&&t.jsxs("div",{className:"device-screen-off",role:"status",children:[t.jsx(qi,{size:32}),t.jsx("p",{children:"Display is off"}),t.jsx("span",{children:"The stream is fine — the device is asleep."}),t.jsx("button",{type:"button",className:"btn-premium btn-sm",onClick:Se,disabled:be,children:be?"Waking…":"Wake device"})]})]})}),t.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":w?"vertical":"horizontal",children:[t.jsx("button",{className:`footer-action-btn ${w?"active":""}`,onClick:()=>C(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":w,children:t.jsx(no,{size:18})}),t.jsx("button",{className:`footer-action-btn ${w?"":"active"}`,onClick:()=>C(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!w,children:t.jsx(to,{size:18})}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:wt,title:"Home","aria-label":"Home",children:t.jsx(Mr,{size:18})}),m.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"footer-action-btn",onClick:Le,title:"Back","aria-label":"Back",children:t.jsx(pn,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:ct,title:"App switcher","aria-label":"App switcher",children:t.jsx(ta,{size:18})})]}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:_,title:"Volume up","aria-label":"Volume up",children:t.jsx(ko,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Q,title:"Volume down","aria-label":"Volume down",children:t.jsx(bo,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:ce,title:"Lock device","aria-label":"Lock device",children:t.jsx(ti,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Se,title:"Unlock device","aria-label":"Unlock device",children:t.jsx(Ii,{size:18})})]})]}),t.jsxs("div",{className:"device-interactions-column",children:[t.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[t.jsxs("button",{className:`tab-btn ${b==="actions"?"active":""}`,onClick:()=>U("actions"),role:"tab","aria-selected":b==="actions",children:[t.jsx(ia,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${b==="screenshot"?"active":""}`,onClick:()=>U("screenshot"),role:"tab","aria-selected":b==="screenshot",children:[t.jsx(Mt,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${b==="logs"?"active":""}`,onClick:()=>U("logs"),role:"tab","aria-selected":b==="logs",children:[t.jsx(ma,{size:13}),t.jsx("span",{children:"Logs"})]}),t.jsxs("button",{className:`tab-btn ${b==="terminal"?"active":""}`,onClick:()=>U("terminal"),role:"tab","aria-selected":b==="terminal",children:[t.jsx(Yr,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${b==="omni"?"active":""}`,onClick:()=>U("omni"),role:"tab","aria-selected":b==="omni",children:[t.jsx(Sr,{size:13}),t.jsx("span",{children:"Omni-Vision"})]})]}),t.jsx("div",{className:`interactions-scroll-area ${b==="terminal"?"terminal-mode":""} ${b==="screenshot"||b==="logs"?"screenshot-mode":""}`,children:t.jsxs("div",{className:"tab-content",children:[b==="omni"&&t.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:t.jsx(el,{sessionId:m.session_id?String(m.session_id):null,udid:m.udid,streamUrl:jt(),embedded:!0,overlayTarget:g,onModeChange:f,deviceActionAt:I})}),b==="actions"&&t.jsx(cd,{udid:m.udid,platform:m.platform,deviceName:Y,screenWidth:Ce,screenHeight:Ae}),b==="screenshot"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(Zd,{udid:m.udid,deviceName:Y})}),b==="logs"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(Xl,{udid:m.udid,platform:m.platform})}),b==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(pc,{platform:(m.platform||"").toLowerCase(),prompt:`${(m.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${Y} (${m.udid}).
|
|
282
|
+
Internal Shell Environment.`,onCommand:async X=>{const oe=await q.executeShell(m.udid,X);if(oe.error)throw new Error(oe.error);return oe.output}})})]})})]})]}),m.session_id&&!String(m.session_id).startsWith("manual_")&&t.jsx($r,{sessionId:String(m.session_id),mode:"slice",windowSec:60,variant:"floating"})]})}const or="xenon.devices.view";function cr(){try{return window.localStorage}catch{return null}}function Qd(e,s){const n=e.get("view");return n==="table"||n==="cards"?n:s}function eu(e,s,n){s==="table"||s!==n?e.set("view",s):e.delete("view")}function Zn(e=cr()){try{return(e==null?void 0:e.getItem(or))==="table"?"table":"cards"}catch{return"cards"}}function tu(e,s=cr()){try{s==null||s.setItem(or,e)}catch{}}class su extends ft.Component{constructor(s){super(s),this.socketCleanups=[],this.refreshTimeout=null,this.searchRef=ft.createRef(),this.containerRef=ft.createRef(),this.stickyGroupRef=ft.createRef(),this.stickyObserver=null,this.observeStickyGroup=()=>{if(typeof ResizeObserver>"u")return;const n=this.stickyGroupRef.current,a=this.containerRef.current;!n||!a||(this.stickyObserver=new ResizeObserver(()=>{a.style.setProperty("--de2-sticky-h",`${n.offsetHeight}px`)}),this.stickyObserver.observe(n))},this.onSlash=n=>{var i,c;if(n.key!=="/"||n.ctrlKey||n.altKey||n.metaKey||this.props.params.udid)return;const a=n.target;(i=a==null?void 0:a.closest)!=null&&i.call(a,'input, textarea, select, [contenteditable]:not([contenteditable="false"])')||(n.preventDefault(),(c=this.searchRef.current)==null||c.focus())},this.clearFilters=()=>{var n;this.props.onFiltersChange(Jo),(n=this.searchRef.current)==null||n.focus()},this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,loaded:!1}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const s=this.props.onSocketEvent("device_unblocked",()=>{this.fetchDevicesDebounced()}),n=this.props.onSocketEvent("device_blocked",()=>{this.fetchDevicesDebounced()});this.socketCleanups.push(s,n),document.addEventListener("keydown",this.onSlash),this.observeStickyGroup()}componentWillUnmount(){var s;this.devicePolling&&(clearInterval(this.devicePolling),this.devicePolling=void 0),this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null),this.socketCleanups.forEach(n=>n()),document.removeEventListener("keydown",this.onSlash),(s=this.stickyObserver)==null||s.disconnect()}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(s){return s.filter(n=>n.busy).length}async fetchDevices(){try{const s=await q.getDevices(),n=this.getBusyDevicesCount(s),a=await q.getPendingSessionsCount(),r=await q.getQueueSummary();this.setState({devices:s,activeSessionsCount:n,pendingSessionsCount:a,queueSummary:r,loaded:!0})}catch(s){console.log(s),this.setState({loaded:!0})}}setFilters(s){this.props.onFiltersChange({...this.props.filters,...s})}getFiltered(){const s=Date.now();return this.state.devices.filter(n=>Jt(n,this.props.filters,s))}render(){const s=this.getFiltered(),{udid:n}=this.props.params,a=n?this.state.devices.find(o=>o.udid===n):null,{filters:r}=this.props,i=sc(this.state.devices,r,Date.now()),c=[{value:"all",label:"Any platform",count:i.platform.all},{value:"android",label:"Android",count:i.platform.android},{value:"ios",label:"iOS",count:i.platform.ios}];(nc(this.state.devices)||r.platform==="tvos")&&c.push({value:"tvos",label:"tvOS",count:i.platform.tvos});const h=[{value:"all",label:"Any type",count:i.type.all},{value:"real",label:"Real devices",count:i.type.real},{value:"virtual",label:"Virtual",note:"Simulators and emulators",count:i.type.virtual}],d=`/devices${this.props.locationSearch}`;return t.jsxs("div",{className:"device-explorer-container",ref:this.containerRef,children:[t.jsxs("div",{className:"de2-sticky-group",ref:this.stickyGroupRef,children:[t.jsx(wr,{icon:Ss,title:"Devices",subtitle:`${this.state.devices.length} device${this.state.devices.length===1?"":"s"} registered across the global pool.`}),t.jsxs("div",{className:"de2-toolbar",children:[t.jsx(vn,{size:"sm",label:"Status",value:r.status,onChange:o=>this.setFilters({status:o}),segments:[{value:"all",label:"All",count:i.status.all},{value:"ready",label:"Ready",tone:"ready",count:i.status.ready},{value:"busy",label:"Busy",tone:"busy",count:i.status.busy},{value:"reserved",label:"Reserved",tone:"reserved",count:i.status.reserved},{value:"maintenance",label:"Maintenance",tone:"maintenance",count:i.status.maintenance},{value:"offline",label:"Offline",tone:"offline",count:i.status.offline}]}),t.jsxs("div",{className:"de2-toolbar-row",children:[t.jsxs("div",{className:"de2-search-wrap",children:[t.jsx(Fs,{size:13,className:"de2-search-icon","aria-hidden":"true"}),t.jsx("input",{ref:this.searchRef,type:"text",className:"de2-search","aria-label":"Search devices",placeholder:"Search name, model or UDID…",value:r.q,onChange:o=>this.setFilters({q:o.target.value})}),t.jsx("kbd",{className:"de2-key","aria-hidden":"true",children:"/"})]}),t.jsx(gn,{name:"Platform",value:r.platform,anyValue:"all",options:c,onChange:o=>this.setFilters({platform:o})}),t.jsx(gn,{name:"Type",value:r.type,anyValue:"all",options:h,onChange:o=>this.setFilters({type:o})}),ac(r)&&t.jsx(F,{variant:"ghost",size:"sm",onClick:this.clearFilters,children:"Clear"}),t.jsxs("div",{className:"de2-result",children:[t.jsx(vn,{size:"sm",label:"View",value:this.props.view,onChange:this.props.onViewChange,segments:[{value:"cards",label:"Cards"},{value:"table",label:"Table"}]}),this.state.loaded&&t.jsx("span",{"aria-live":"polite",children:rc(s.length,this.state.devices.length)}),t.jsx(F,{variant:"secondary",size:"icon","aria-label":"Refresh devices",title:"Refresh",onClick:()=>this.fetchDevices(),children:t.jsx(Yt,{size:13,"aria-hidden":"true"})})]})]})]})]}),s.length>0?this.props.view==="table"?t.jsx(fc,{devices:s,reloadDevices:()=>this.fetchDevices(),sort:this.props.sort,onSortChange:this.props.onSortChange}):t.jsx(Zo,{devices:s,reloadDevices:()=>this.fetchDevices()}):t.jsxs("div",{className:"device-explorer-empty stagger-1",children:[t.jsx("div",{className:"device-explorer-empty-icon",children:this.state.loaded?t.jsx(Ss,{size:32}):t.jsx(Yt,{size:32,className:"animate-spin"})}),this.state.loaded?this.state.devices.length===0?t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Global Device Registry Empty"}),t.jsx("p",{children:"Xenon hasn't detected any active device nodes in your infrastructure. Ensure your device farm is connected and heartbeat signals are active."}),t.jsxs(F,{variant:"primary",onClick:()=>this.fetchDevices(),children:[t.jsx(Yt,{size:14}),"Manual sync"]})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"No devices match these filters"}),t.jsx("p",{children:"Try another filter or search, or clear them to see every device."}),t.jsx(F,{variant:"secondary",onClick:this.clearFilters,children:"Clear filters"})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Loading devices…"}),t.jsx("p",{children:"Syncing the global device registry."})]})]}),a&&t.jsx(rl,{className:"device-control-modal-overlay",labelledBy:"device-control-title",onClose:()=>this.props.navigate(d),children:t.jsx("div",{className:"device-control-modal",children:t.jsx(Jd,{device:a,titleId:"device-control-title",onClose:()=>this.props.navigate(d)})})})]})}}function Pu(){const e=Qn(),s=Pt(),n=os(),[a,r]=jr(),{on:i}=br(),c=Qo(a),h=Qd(a,Zn()),d=dc(a),o=(u,p,v)=>{const f=ec(u);eu(f,p,Zn()),uc(f,v),r(f,{replace:!0})};return t.jsx(su,{params:e,navigate:s,onSocketEvent:i,filters:c,onFiltersChange:u=>o(u,h,d),view:h,onViewChange:u=>{tu(u),o(c,u,d)},sort:d,onSortChange:u=>o(c,h,u),locationSearch:n.search})}export{su as DeviceExplorer,Pu as default};
|