@stacksjs/mobile 0.75.473 → 0.75.477

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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Bundled TypeScript declarations
3
- * Generated from 22 source files
3
+ * Generated from 23 source files
4
4
  */
5
5
 
6
6
  import { BugHQClient, Breadcrumb, BugHQConfig } from '@bughq/sdk';
@@ -683,6 +683,32 @@ type AppleWorkoutAlert = | { type: 'heartRate', min: number, max: number }
683
683
  | { type: 'cadence', min: number, max: number }
684
684
  type ScheduledWorkoutsMethod = 'isSupported' | 'authorization' | 'requestAuthorization' | 'list' | 'schedule' | 'remove' | 'removeAll';
685
685
 
686
+ // From: src/passkeys.ts
687
+ declare function unavailable(): never;
688
+ /** The native system sheet returns JSON credentials for server verification. */
689
+ declare const passkeys: PasskeysApi;
690
+ /** JSON WebAuthn options as supplied by the relying party's server. */
691
+ declare interface NativePasskeyOptions {
692
+ challenge: string
693
+ rpId?: string
694
+ rp?: { id?: string, name?: string }
695
+ user?: { id: string, name: string, displayName?: string }
696
+ [option: string]: unknown
697
+ }
698
+ declare interface NativePasskeyCredential {
699
+ id: string
700
+ rawId: string
701
+ type: 'public-key'
702
+ response: Record<string, string>
703
+ clientExtensionResults?: Record<string, unknown>
704
+ authenticatorAttachment?: string
705
+ }
706
+ declare interface PasskeysApi {
707
+ isAvailable: () => Promise<boolean>
708
+ create: (options: NativePasskeyOptions) => Promise<NativePasskeyCredential>
709
+ get: (options: NativePasskeyOptions) => Promise<NativePasskeyCredential>
710
+ }
711
+
686
712
  // From: src/session-clock.ts
687
713
  declare function startSessionClock(now: number): SessionClock;
688
714
  declare function pauseSessionClock(clock: SessionClock, now: number): SessionClock;
@@ -1469,6 +1495,7 @@ declare interface MobileApi {
1469
1495
  music: MusicApi
1470
1496
  heartRate: HeartRateApi
1471
1497
  scheduledWorkouts: import('./scheduled-workouts').ScheduledWorkoutsApi
1498
+ passkeys: import('./passkeys').PasskeysApi
1472
1499
  speech: SpeechApi
1473
1500
  network: NetworkApi
1474
1501
  pushNotifications: PushNotificationsApi
@@ -2121,6 +2148,6 @@ declare interface VoiceRecorder {
2121
2148
  }
2122
2149
  type VoiceRecorderStatus = 'idle' | 'requesting' | 'recording' | 'ready' | 'error';
2123
2150
 
2124
- export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, music, heartRate, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, NativeVoiceFile, VoiceRecorder, VoiceRecorderOptions, VoiceRecorderSnapshot, VoiceRecorderStatus, createVoiceRecorder, voiceRecordingFormData, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, keepBreadcrumb, crashReporting, CrashReportingOptions, currentAppearance, normalizeAppearance, onAppearance, onResume, onMemoryWarning, onSilentPush, onBackgroundRefresh, NativeAppearance, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, largeTitleMetrics, observeLargeTitle, resolveScrollHost, ScrollHost, PullToRefreshOptions, LargeTitleMetrics, LargeTitleOptions, canGoBack, goBack, enterNavTrail, backLabelFor, navTrail, previousScreenPath, goBackToTabRoot, trailEntryFor, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, TabRootHost, attachHeartRate, fixDistance, usableFixes, createRouteStats, routeStats, paceLabel, speedLabel, routeReadInterval, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, ROUTE_FULL_READ_FIXES, ROUTE_FULL_READ_MAX_MS, RouteFix, RouteStats, RouteStatsOptions, RouteStatsAccumulator, RouteRecorderOptions, RouteRecorder, scheduledWorkoutsUnsupported, normalizeScheduledWorkout, scheduledWorkouts, AppleWorkoutStep, AppleIntervalBlock, AppleCustomWorkout, AppleWorkoutPlan, ScheduledWorkout, ScheduleWorkoutResult, ScheduledWorkoutsApi, ScheduledWorkoutsAuthorization, AppleWorkoutGoal, AppleWorkoutAlert, ScheduledWorkoutsMethod, startSessionClock, pauseSessionClock, resumeSessionClock, sessionClockElapsed, SessionClock, indoorVerdict, typedDistanceKm, INDOOR_CHECK_AFTER_S, IndoorFix, IndoorVerdict, toNativeRect, useActionSheet, confirmAction, showContextMenuFor, dialog, contextMenu, browser, symbols, statusBar, chrome, refresh, background, clipboard, db, files, shortcuts, widgets, orientation, auth, storeKit, DialogApi, ConfirmActionOptions, ContextMenuApi, BrowserOpenOptions, BrowserResult, BrowserApi, SymbolOptions, SymbolsApi, StatusBarApi, ChromeApi, RefreshApi, BackgroundApi, ClipboardApi, DatabaseExecuteResult, DatabaseApi, PickedFile, ScannedCode, FilesApi, HomeScreenShortcut, ShortcutsApi, WidgetsApi, OrientationApi, AppleSignInResult, AppleSignInOptions, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, presentChoice, presentAlert, presentConfirm, presentActionSheet, placeMenu, presentContextMenu, applyAppearance, pageBackground, pageIsDark, installNativeChrome, NativeChromeOptions, readSpotlightKinds, spotlightKind, spotlightAction, spotlightSlot, spotlightActions, spotlightActivityTypes, spotlightTitle, placeSpotlightItem, removeSpotlightItem, spotlightRoute, readSpotlightEntries, spotlightBridge, createSpotlightIndex, onSpotlightTap, MAX_SPOTLIGHT_SLOTS_PER_KIND, SpotlightKind, SpotlightKindInput, SpotlightItem, SpotlightEntry, SpotlightKindsResult, SpotlightPlacement, SpotlightBridge, SpotlightIndexOptions, SpotlightIndex, readTabLinks, nativeTabs, routerHandlesTabs, handleTabReselect, coverTabBar, mirrorTabBar, tabBar, TAB_BAR_COVER_EVENT, TabBarApi, TabLink, TabReselectOptions, MirrorTabBarOptions, CraftMobileCapabilities, CraftMobileBridge, CraftReadyEvent, MobileApi, DeviceInfo, DeviceCapabilities, CameraOptions, PhotoResult, Location, LocationOptions, LocationRecordingState, RecordingStartOptions, LocationRecordingOptions, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, StorageApi, CryptoApi, SecureStorageApi, RecordingOwnershipOptions, LocationRecordingReadOptions, LocationRecordingPowerModeOptions, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, BrightnessApi, SpeechOptions, SpeechApi, NowPlaying, MusicSkipOptions, HeartRateDevice, HeartRateRecordingState, HeartRateState, HeartRateReading, HeartRateSample, HeartRateRecordingApi, HeartRateApi, MusicApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthQuantitySample, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthMindfulSession, HealthMindfulSessionResult, HealthMindfulSessionQuery, HealthMindfulSample, HealthHeartRateUpdatesOptions, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, LocationPowerMode, LocationEffectivePowerMode, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HeartRateAuthorization, BluetoothState, HeartRateConnection, HeartRateMethod, HealthDataType, HealthDailyType, HealthSampleType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod, storage, crypto };
2151
+ export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, snapshots, keepAwake, brightness, music, heartRate, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, NativeVoiceFile, VoiceRecorder, VoiceRecorderOptions, VoiceRecorderSnapshot, VoiceRecorderStatus, createVoiceRecorder, voiceRecordingFormData, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, keepBreadcrumb, crashReporting, CrashReportingOptions, currentAppearance, normalizeAppearance, onAppearance, onResume, onMemoryWarning, onSilentPush, onBackgroundRefresh, NativeAppearance, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, largeTitleMetrics, observeLargeTitle, resolveScrollHost, ScrollHost, PullToRefreshOptions, LargeTitleMetrics, LargeTitleOptions, canGoBack, goBack, enterNavTrail, backLabelFor, navTrail, previousScreenPath, goBackToTabRoot, trailEntryFor, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, TabRootHost, attachHeartRate, fixDistance, usableFixes, createRouteStats, routeStats, paceLabel, speedLabel, routeReadInterval, createRouteRecorder, HEART_RATE_MATCH_MS, ROUTE_GAP_S, ROUTE_FULL_READ_FIXES, ROUTE_FULL_READ_MAX_MS, RouteFix, RouteStats, RouteStatsOptions, RouteStatsAccumulator, RouteRecorderOptions, RouteRecorder, scheduledWorkoutsUnsupported, normalizeScheduledWorkout, scheduledWorkouts, AppleWorkoutStep, AppleIntervalBlock, AppleCustomWorkout, AppleWorkoutPlan, ScheduledWorkout, ScheduleWorkoutResult, ScheduledWorkoutsApi, ScheduledWorkoutsAuthorization, AppleWorkoutGoal, AppleWorkoutAlert, ScheduledWorkoutsMethod, passkeys, NativePasskeyOptions, NativePasskeyCredential, PasskeysApi, startSessionClock, pauseSessionClock, resumeSessionClock, sessionClockElapsed, SessionClock, indoorVerdict, typedDistanceKm, INDOOR_CHECK_AFTER_S, IndoorFix, IndoorVerdict, toNativeRect, useActionSheet, confirmAction, showContextMenuFor, dialog, contextMenu, browser, symbols, statusBar, chrome, refresh, background, clipboard, db, files, shortcuts, widgets, orientation, auth, storeKit, DialogApi, ConfirmActionOptions, ContextMenuApi, BrowserOpenOptions, BrowserResult, BrowserApi, SymbolOptions, SymbolsApi, StatusBarApi, ChromeApi, RefreshApi, BackgroundApi, ClipboardApi, DatabaseExecuteResult, DatabaseApi, PickedFile, ScannedCode, FilesApi, HomeScreenShortcut, ShortcutsApi, WidgetsApi, OrientationApi, AppleSignInResult, AppleSignInOptions, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, presentChoice, presentAlert, presentConfirm, presentActionSheet, placeMenu, presentContextMenu, applyAppearance, pageBackground, pageIsDark, installNativeChrome, NativeChromeOptions, readSpotlightKinds, spotlightKind, spotlightAction, spotlightSlot, spotlightActions, spotlightActivityTypes, spotlightTitle, placeSpotlightItem, removeSpotlightItem, spotlightRoute, readSpotlightEntries, spotlightBridge, createSpotlightIndex, onSpotlightTap, MAX_SPOTLIGHT_SLOTS_PER_KIND, SpotlightKind, SpotlightKindInput, SpotlightItem, SpotlightEntry, SpotlightKindsResult, SpotlightPlacement, SpotlightBridge, SpotlightIndexOptions, SpotlightIndex, readTabLinks, nativeTabs, routerHandlesTabs, handleTabReselect, coverTabBar, mirrorTabBar, tabBar, TAB_BAR_COVER_EVENT, TabBarApi, TabLink, TabReselectOptions, MirrorTabBarOptions, CraftMobileCapabilities, CraftMobileBridge, CraftReadyEvent, MobileApi, DeviceInfo, DeviceCapabilities, CameraOptions, PhotoResult, Location, LocationOptions, LocationRecordingState, RecordingStartOptions, LocationRecordingOptions, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, StorageApi, CryptoApi, SecureStorageApi, RecordingOwnershipOptions, LocationRecordingReadOptions, LocationRecordingPowerModeOptions, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, BrightnessApi, SpeechOptions, SpeechApi, NowPlaying, MusicSkipOptions, HeartRateDevice, HeartRateRecordingState, HeartRateState, HeartRateReading, HeartRateSample, HeartRateRecordingApi, HeartRateApi, MusicApi, DeepLinksApi, SnapshotsApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthQuantitySample, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthSampleQuery, HealthHeartRateQuery, HealthHeartRateSample, HealthSleepInterval, HealthMindfulSession, HealthMindfulSessionResult, HealthMindfulSessionQuery, HealthMindfulSample, HealthHeartRateUpdatesOptions, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, LocationPowerMode, LocationEffectivePowerMode, AppState, HapticKind, MusicAuthorization, MusicPlaybackState, MusicMethod, HeartRateAuthorization, BluetoothState, HeartRateConnection, HeartRateMethod, HealthDataType, HealthDailyType, HealthSampleType, HealthWorkoutType, HealthWorkoutActivity, HealthSleepStage, HealthReadMethod, storage, crypto };
2125
2152
  export { NativeTab } from 'craft-native/mobile';
2126
2153
  export { NativeTabBarOptions } from 'craft-native/mobile';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{appReview as lr,biometrics as We,brightness as xe,camera as Ae,deepLinks as Bt,device as Z,haptics as ke,health as ue,heartRate as T,keepAwake as Ft,lifecycle as cr,liveActivities as $e,location as D,music as j,network as Ut,notifications as de,permissions as pe,pushNotifications as Ke,secureStorage as Ee,share as Wt,speech as je,snapshots as Te,splash as ur,watchConnectivity as fe}from"craft-native/mobile";var Dr=2500;function E(){if(typeof window>"u")return;return window}function Q(){let e=E()?.craft;return e&&typeof e==="object"?e:void 0}function Gt(){return typeof navigator>"u"?"":navigator.userAgent||""}function re(){let e=E();if(!e)return!1;if(e.CraftAndroid)return!0;let t=Q()?.platform;if(t==="ios"||t==="android")return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(Gt())}function ge(){let e=E();if(!e||e.craft)return!1;return re()||Boolean(e.webkit?.messageHandlers?.craft)}function ee(e=15000){let t=E();if(t?.craft)return Promise.resolve(!0);if(!t||!ge())return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(Boolean(t.craft))},o=setTimeout(r,e);t.addEventListener("craftReady",r)})}function Yt(e,t){if(!e)return null;let n=t.split("."),r=e;for(let i of n.slice(0,-1))if(r=r?.[i],!r||typeof r!=="object"&&typeof r!=="function")return null;let o=r?.[n[n.length-1]];return typeof o==="function"?o.bind(r):null}function M(e){return Yt(Q(),e)}async function Xt(e,t=2500){let n=M(e);if(n||!ge())return n;return await ee(t),M(e)}async function w(e,t,n,r={}){let o=await Xt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function d(e,t=2500){if(ge())await ee(t);return e()}function J(e,t=2500){let n,r=!1;if(!ge())n=e();else ee(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function W(e,t){let n=E();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var qe="native-dialog-styles",Qt=`
1
+ import{appReview as ur,biometrics as We,brightness as xe,camera as Ae,deepLinks as Ut,device as Z,haptics as ke,health as ue,heartRate as T,keepAwake as Wt,lifecycle as dr,liveActivities as $e,location as D,music as j,network as $t,notifications as de,permissions as pe,pushNotifications as Ke,secureStorage as Ee,share as Kt,speech as je,snapshots as Te,splash as pr,watchConnectivity as fe}from"craft-native/mobile";var _r=2500;function E(){if(typeof window>"u")return;return window}function Q(){let e=E()?.craft;return e&&typeof e==="object"?e:void 0}function Xt(){return typeof navigator>"u"?"":navigator.userAgent||""}function re(){let e=E();if(!e)return!1;if(e.CraftAndroid)return!0;let t=Q()?.platform;if(t==="ios"||t==="android")return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(Xt())}function ge(){let e=E();if(!e||e.craft)return!1;return re()||Boolean(e.webkit?.messageHandlers?.craft)}function ee(e=15000){let t=E();if(t?.craft)return Promise.resolve(!0);if(!t||!ge())return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(Boolean(t.craft))},o=setTimeout(r,e);t.addEventListener("craftReady",r)})}function Qt(e,t){if(!e)return null;let n=t.split("."),r=e;for(let i of n.slice(0,-1))if(r=r?.[i],!r||typeof r!=="object"&&typeof r!=="function")return null;let o=r?.[n[n.length-1]];return typeof o==="function"?o.bind(r):null}function M(e){return Qt(Q(),e)}async function Jt(e,t=2500){let n=M(e);if(n||!ge())return n;return await ee(t),M(e)}async function v(e,t,n,r={}){let o=await Jt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function d(e,t=2500){if(ge())await ee(t);return e()}function J(e,t=2500){let n,r=!1;if(!ge())n=e();else ee(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function W(e,t){let n=E();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var qe="native-dialog-styles",Zt=`
2
2
  .native-dialog { position: fixed; inset: 0; z-index: 2147483000; font-size: var(--native-font-size, 17px); font-family: var(--native-font-family, -apple-system, system-ui, sans-serif); -webkit-tap-highlight-color: transparent; }
3
3
  .native-dialog-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 0.3); opacity: 0; transition: opacity 220ms ease; }
4
4
  .native-dialog--menu .native-dialog-backdrop { background: rgb(0 0 0 / 0.12); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
@@ -52,4 +52,4 @@ import{appReview as lr,biometrics as We,brightness as xe,camera as Ae,deepLinks
52
52
  .native-dialog-group, .native-menu { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--native-dialog-solid, rgb(242 242 247)); }
53
53
  .dark .native-dialog-group, .dark .native-menu { background: var(--native-dialog-solid-dark, rgb(44 44 46)); }
54
54
  }
55
- `;function Ge(){return E()?.document}function Jt(e){if(e.getElementById(qe))return;let t=e.createElement("style");t.id=qe,t.textContent=Qt,(e.head??e.documentElement).appendChild(t)}var Zt=0;function N(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}function Ve(){return E()?.stx?.overlays}var en=0;function Ye(e,t,n,r){Jt(e);let o=E(),i=`native-dialog-layer-${++en}`,a=N(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(N(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,f=(c)=>{if(l)return;l=!0,a.classList.remove("is-open"),Ve()?.close(i),setTimeout(()=>a.remove(),260),s(c)},u=n({root:a,settle:f});a.appendChild(u),e.body.appendChild(a),Ve()?.open(i,{panel:u,root:a,onEscape:()=>f(r())});let m=o;(typeof m?.requestAnimationFrame==="function"?(c)=>m.requestAnimationFrame(()=>m.requestAnimationFrame(c)):(c)=>setTimeout(c,16))(()=>{if(!l)a.classList.add("is-open")})})}function Ie(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++Zt}`,r=e.actions.find((a)=>a.style==="cancel"),o=e.variant==="sheet"?e.actions.filter((a)=>a.style!=="cancel"):e.actions,i=e.variant==="sheet"?r??{id:"__cancel",title:e.cancelLabel||"Cancel",style:"cancel"}:void 0;return Ye(t,e.variant,({root:a,settle:s})=>{let l=(c)=>c.style==="cancel"?null:c.id,f=N(t,"div","native-dialog-panel");f.setAttribute("role","alertdialog"),f.setAttribute("aria-modal","true"),f.tabIndex=-1;let u=N(t,"div","native-dialog-group");if(e.title||e.message){let c=N(t,"div","native-dialog-header");if(e.title){let p=N(t,"p","native-dialog-title",e.title);p.id=`${n}-title`,c.appendChild(p),f.setAttribute("aria-labelledby",p.id)}if(e.message){let p=N(t,"p","native-dialog-message",e.message);p.id=`${n}-message`,c.appendChild(p),f.setAttribute("aria-describedby",p.id)}u.appendChild(c)}let m=N(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)m.classList.add("is-row");for(let c of o){let p=N(t,"button",`native-dialog-action${c.style==="destructive"?" is-destructive":""}${c.style==="cancel"?" is-cancel":""}`,c.title);p.type="button",p.setAttribute("data-action-id",c.id),p.addEventListener("click",()=>s(l(c))),m.appendChild(p)}if(u.appendChild(m),f.appendChild(u),i){let c=N(t,"div","native-dialog-group"),p=N(t,"button","native-dialog-action is-cancel",i.title);p.type="button",p.setAttribute("data-action-id",i.id),p.addEventListener("click",()=>s(null)),c.appendChild(p),f.appendChild(c)}let b=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")b?.addEventListener("click",()=>s(null));return f},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Xe(e){await Ie({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Qe(e){return await Ie({variant:"alert",title:e.title,message:e.message,actions:[{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"},{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"}]})==="confirm"}function Je(e){return Ie({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function tn(e,t,n){let i=Math.max(12,Math.min(e.x,n.width-t.width-12)),a=e.y+e.height+8,s=a+t.height<=n.height-12,l=e.y-8-t.height,f=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,u=e.x+e.width/2>n.width/2?"right":"left";return{top:f,left:i,origin:`${s||l<12?"top":"bottom"} ${u}`}}function Ze(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=E();return Ye(t,"menu",({root:r,settle:o})=>{let i=N(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(N(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=N(t,"button",`native-menu-item${a.destructive?" is-destructive":""}`);if(s.type="button",s.setAttribute("role","menuitem"),s.setAttribute("data-action-id",a.id),a.disabled)s.disabled=!0;if(s.appendChild(N(t,"span","native-menu-label",a.title)),a.icon){let l=N(t,"i",`native-menu-icon ${a.icon}`);l.setAttribute("aria-hidden","true"),s.appendChild(l)}s.addEventListener("click",()=>o(a.id)),i.appendChild(s)}return r.querySelector(".native-dialog-backdrop")?.addEventListener("click",()=>o(null)),queueMicrotask(()=>{let a=i.getBoundingClientRect?.(),s=tn(e.anchor,{width:a?.width||248,height:a?.height||e.items.length*44},{width:n?.innerWidth||390,height:n?.innerHeight||844});i.style.top=`${s.top}px`,i.style.left=`${s.left}px`,i.style.setProperty("--native-menu-origin",s.origin)}),i},()=>null)}var rt=()=>!0,_=()=>!1,K=()=>null;function et(){return E()?.navigator??(typeof navigator>"u"?void 0:navigator)}function Ne(e){return{x:Math.round(e.x??e.left??0),y:Math.round(e.y??e.top??0),width:Math.round(e.width),height:Math.round(e.height)}}var oe={alert:(e)=>w("dialog.alert",[e],()=>Xe(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>w("dialog.confirm",[e],()=>Qe(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?Ne(e.anchor):void 0},n=await w("dialog.actionSheet",[t],()=>Je(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Wr(){return(e)=>oe.actionSheet(e)}async function $r(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return oe.confirm(e);return await oe.actionSheet({title:e.title,message:e.message,anchor:e.anchor,actions:[{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"},{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"}]})==="confirm"}var De={show:async(e)=>{let t={title:e.title,anchor:Ne(e.anchor),items:e.items.map(({id:r,title:o,symbol:i,destructive:a,disabled:s})=>({id:r,title:o,symbol:i,destructive:a,disabled:s}))},n=await w("contextMenu.show",[t],()=>Ze(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function Kr(e,t){return De.show({...t,anchor:Ne(e.getBoundingClientRect())})}function nn(e,t){let n=E();if(!n)return{cancelled:!0};if(typeof n.craft?.openURL==="function")return Promise.resolve(n.craft.openURL(e)).catch(()=>{}),{cancelled:!1};if(t.mode==="auth")return n.location?.assign(e),{cancelled:!1};if(!(typeof n.open==="function"?n.open(e,"_blank","noopener"):null))n.location?.assign(e);return{cancelled:!1}}var ot={open:async(e,t={})=>{let n=await w("browser.open",[e,t],()=>nn(e,t),{fallbackOnError:!0});if(!n||typeof n!=="object")return{cancelled:!1};let{url:r,cancelled:o}=n;return typeof r==="string"?{url:r,cancelled:Boolean(o)}:{cancelled:Boolean(o)}}},Me=new Map,Le=new Map;function tt(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var it={isAvailable:()=>M("symbols.image")!==null,image:(e,t={})=>{let n=tt(e,t),r=Me.get(n);if(r)return r;let o=w("symbols.image",[e,t],K).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,K).then((i)=>(Le.set(n,i),i));return Me.set(n,o),o},cached:(e,t={})=>Le.get(tt(e,t)),clearCache:()=>{Me.clear(),Le.clear()}},he={setStyle:(e)=>w("statusBar.setStyle",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1)},ie={setUnderPageColor:(e)=>w("chrome.setUnderPageColor",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>w("chrome.setKeyboardAccessory",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1)},Y={isAvailable:()=>M("refresh.enable")!==null,enable:(e)=>w("refresh.enable",[e??{}],_,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>w("refresh.disable",[],_,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>w("refresh.end",[],_,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>W("craftRefresh",()=>e())},ae={complete:(e)=>w("background.complete",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1)},at={write:(e)=>w("clipboard.write",[e],async()=>{let t=et()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(rt,_)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>w("clipboard.read",[],async()=>{let e=et()?.clipboard;if(!e?.readText)return null;return e.readText().catch(K)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},st={isAvailable:()=>M("db.query")!==null,query:(e,t=[])=>w("db.query",[e,t],K).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>w("db.execute",[e,t],K).then((n)=>{if(!n||typeof n!=="object")return null;let{rowsAffected:r,lastInsertId:o}=n;return{rowsAffected:Number(r)||0,lastInsertId:Number(o)||0}})};function Ce(e,t){let n=E()?.document;if(!n?.body)return null;let r=n.createElement("a");return r.href=e,r.download=t,r.rel="noopener",r.style.display="none",n.body.appendChild(r),r.click(),r.remove(),t}function rn(e){let t=E()?.document;if(!t?.body)return Promise.resolve(null);return new Promise((n)=>{let r=t.createElement("input");if(r.type="file",r.style.display="none",e.length)r.accept=e.map((i)=>i.includes("/")||i.startsWith(".")?i:`.${i}`).join(",");let o=(i)=>{r.remove(),n(i)};r.addEventListener("cancel",()=>o(null)),r.addEventListener("change",()=>{let i=r.files?.[0];if(!i)return o(null);let a=new FileReader;a.onload=()=>o({name:i.name,mimeType:i.type||void 0,data:typeof a.result==="string"?a.result:void 0}),a.onerror=()=>o({name:i.name,mimeType:i.type||void 0}),a.readAsDataURL(i)}),t.body.appendChild(r),r.click()})}var lt={openPDF:(e,t=0)=>w("openPDF",[e,t],()=>{let n=E();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>w("takeScreenshot",[],K,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>w("scanQRCode",[],K).then((e)=>{if(!e||typeof e!=="object")return null;let{type:t,data:n}=e;return typeof n==="string"?{type:String(t??""),data:n}:null},K),pickFile:(e=[])=>w("pickFile",[e],()=>rn(e)).then((t)=>{if(!t||typeof t!=="object")return null;let n=t;if(typeof n.name!=="string")return null;return{name:n.name,path:typeof n.path==="string"?n.path:void 0,data:typeof n.data==="string"?n.data:void 0,mimeType:typeof n.mimeType==="string"?n.mimeType:void 0}},K),saveFile:(e,t,n)=>w("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return Ce(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=Ce(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>w("downloadFile",[e,t],()=>Ce(e,t)).then((n)=>typeof n==="string"?n:null)},ct={set:(e)=>w("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],_).then((t)=>t!==!1),clear:()=>w("shortcuts.clear",[],_).then((e)=>e!==!1),onShortcut:(e)=>W("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},ut={update:(e)=>w("widget.update",[e],_).then((t)=>t!==!1),reload:()=>w("widget.reload",[],_).then((e)=>e!==!1)},on={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function nt(){return E()?.screen?.orientation}var dt={lock:(e)=>w("lockOrientation",[e],()=>{let t=nt();return t?.lock?t.lock(on[e]).then(rt,_):!1}).then((t)=>t!==!1),unlock:()=>w("unlockOrientation",[],()=>(nt()?.unlock?.(),!0)).then((e)=>e!==!1)},pt={signInWithApple:(e={})=>w("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],K).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},ft={isAvailable:()=>M("iap.purchase")!==null,products:(e)=>w("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>w("iap.purchase",[e],K).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>w("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};import{storage as q}from"craft-native/mobile";function mt(){return Q()?.capabilities?.storageCompareAndSet===!0&&q.supportsCompareAndSet?.()===!0}function gt(){return Q()?.capabilities?.storageSetIfAbsent===!0&&q.supportsSetIfAbsent?.()===!0}var ht={supportsCompareAndSet:mt,supportsSetIfAbsent:gt,get:(e)=>d(()=>q.get(e)),set:(e,t)=>d(()=>q.set(e,t)),remove:(e)=>d(()=>q.remove(e)),clear:()=>d(()=>q.clear()),keys:()=>d(()=>q.keys()),setIfAbsent:(e,t)=>d(()=>{if(!gt())throw Object.assign(Error("This host or adapter cannot create storage atomically"),{code:"STORAGE_SET_IF_ABSENT_UNSUPPORTED"});return q.setIfAbsent(e,t)}),compareAndSet:(e,t,n)=>d(()=>{if(!mt())throw Object.assign(Error("This host or adapter cannot compare storage atomically"),{code:"STORAGE_COMPARE_AND_SET_UNSUPPORTED"});return q.compareAndSet(e,t,n)})};import{crypto as an}from"craft-native/mobile";var bt={randomUUID:()=>d(()=>an.randomUUID())};var sn=["authorized","denied","notDetermined","restricted","unsupported"];function be(){let e=Q(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function ln(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function vt(e){return sn.includes(e)?e:"unsupported"}function cn(e){if(!e||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string"||!t.id||typeof t.date!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t.date))return null;let n={id:t.id.toLowerCase(),date:t.date,complete:t.complete===!0};if(typeof t.hour==="number"&&Number.isFinite(t.hour))n.hour=t.hour;if(typeof t.minute==="number"&&Number.isFinite(t.minute))n.minute=t.minute;return n}function te(e,t,...n){return d(async()=>{let r=be();if(typeof r?.[e]!=="function")throw ln();return t(await r[e](...n))})}var yt={isAvailable:()=>typeof be()?.isSupported==="function",supports:(e)=>typeof be()?.[e]==="function",isSupported:()=>d(async()=>{let e=be();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>te("authorization",vt),requestAuthorization:()=>te("requestAuthorization",vt),list:()=>te("list",(e)=>Array.isArray(e)?e.map(cn).filter((t)=>t!==null):[]),schedule:(e)=>{if(!e||typeof e!=="object"||typeof e.id!=="string")return Promise.reject(Object.assign(Error("schedule needs a plan with an id"),{code:"INVALID_ARGUMENT"}));return te("schedule",(t)=>{let n=t&&typeof t==="object"?t:{},r={id:(typeof n.id==="string"?n.id:e.id).toLowerCase()};if(Array.isArray(n.droppedAlerts)&&n.droppedAlerts.length)r.droppedAlerts=n.droppedAlerts.filter((o)=>typeof o==="string");return r},e)},remove:(e)=>te("remove",(t)=>t===!0,e),removeAll:()=>te("removeAll",(e)=>typeof e==="number"&&Number.isFinite(e)?e:0)};function eo(e,t){let n=t.delay??500,r=t.tolerance??10,o=null,i=null,a=!1,s=()=>{if(o)clearTimeout(o);if(o=null,i&&!a)t.onPressEnd?.();i=null},l=(b)=>{let c=b;if(c.button!==void 0&&c.button!==0)return;a=!1,i={x:c.clientX,y:c.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},f=(b)=>{if(!i)return;let c=b;if(Math.hypot(c.clientX-i.x,c.clientY-i.y)>r)s()},u=(b)=>{if(!a)return;a=!1,b.preventDefault(),b.stopPropagation()},m=(b)=>b.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",f),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",u,!0),e.addEventListener("contextmenu",m),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",f),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",u,!0),e.removeEventListener("contextmenu",m)}}function un(e,t,n){if(n<=1||t.width<=0)return 0;let r=Math.floor((e-t.left)/t.width*n);return Math.max(0,Math.min(n-1,r))}function to(e,t){let n=null,r=null,o=!1,i=0,a=(c)=>{let p=e.getBoundingClientRect();return un(c,{left:p.left+2,width:p.width-4},t.count())},s=(c)=>{let p=c;if(p.button!==void 0&&p.button!==0)return;let g=a(p.clientX);if(g!==t.selected())return;n=g,i=g,o=!1,r=p.pointerId;try{e.setPointerCapture?.(p.pointerId)}catch{}t.onPress?.(!0)},l=(c)=>{if(n===null)return;let p=a(c.clientX);if(p===i)return;o=!0,i=p,t.onScrub(p)},f=(c)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),c&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},u=(c)=>{if(!o)return;o=!1,c.preventDefault(),c.stopPropagation()},m=()=>f(!0),b=()=>f(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",m),e.addEventListener("pointercancel",b),e.addEventListener("click",u,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",m),e.removeEventListener("pointercancel",b),e.removeEventListener("click",u,!0)}}function no(e,t,n){if(n<=0)return null;switch(e){case"ArrowRight":case"ArrowDown":return(t+1)%n;case"ArrowLeft":case"ArrowUp":return(t-1+n)%n;case"Home":return 0;case"End":return n-1;default:return null}}function ro(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function oo(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=M("haptics.prepare");if(o)Promise.resolve().then(()=>o("impact")).catch(()=>{})};return e.addEventListener("touchstart",t,{passive:!0,capture:!0}),()=>e.removeEventListener("touchstart",t,{capture:!0})}import{BugHQClient as dn}from"@bughq/sdk";import{crashReporter as ne}from"craft-native/mobile";var F=null;function pn(e){if(e.type!=="http")return!0;let t=e.data??{},n=typeof t.status==="number"?t.status:0;return t.error===!0||n>=400||n===0}function wt(){return ne.isAvailable()}function fn(e){return async(t)=>{if(!wt())return!e;return ne.capture(t)}}var co={start(e={}){if(F)return F;let t=re()||wt();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return F=new dn({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?fn(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!pn(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)ne.addBreadcrumb(i);return i}}),F},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);F?.setUser(t===null?null:{id:t}),await ne.setUser(t)},capture(e,t){F?.captureException(e,t)},addBreadcrumb(e){if(F)F.addBreadcrumb(e);else ne.addBreadcrumb(e)},async flush(){await Promise.all([F?.flush(),ne.flush()])},client(){return F},stop(){F?.close(),F=null}};function He(e){let t=E();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function St(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function Rt(){let e=E()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:St(e?.getAttribute("data-craft-reduce-motion"))||He("(prefers-reduced-motion: reduce)"),reduceTransparency:St(e?.getAttribute("data-craft-reduce-transparency"))||He("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||He("(prefers-color-scheme: dark)")?"dark":"light"}}function mn(e){let t=Rt(),n=Number(e?.fontScale);return{contentSizeCategory:typeof e?.contentSizeCategory==="string"?e.contentSizeCategory:void 0,fontScale:Number.isFinite(n)&&n>0?n:t.fontScale,reduceMotion:typeof e?.reduceMotion==="boolean"?e.reduceMotion:t.reduceMotion,reduceTransparency:typeof e?.reduceTransparency==="boolean"?e.reduceTransparency:t.reduceTransparency,colorScheme:e?.colorScheme==="dark"||e?.colorScheme==="light"?e.colorScheme:t.colorScheme}}function xt(e,t={}){if(t.immediate!==!1)e(Rt());return W("craftAppearance",(n)=>e(mn(n)))}function mo(e){return W("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function go(e){return W("craftMemoryWarning",()=>e())}function At(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>ae.complete(!0),()=>ae.complete(!1))}}function ho(e){let t=At(e);return W("craftSilentPush",(n)=>t(n.payload??{}))}function bo(e){let t=At(()=>e());return W("craftBackgroundRefresh",()=>t(void 0))}import{haptics as gn}from"craft-native/mobile";function _e(){if(typeof window>"u")return;return window}function se(e=_e()){if(!e)return 0;if(typeof e.scrollY==="number")return e.scrollY;if(typeof e.scrollTop==="number")return e.scrollTop;return e.document?.scrollingElement?.scrollTop??0}function hn(e,t=_e()){if(!t)return()=>{};let n=!1,r=typeof requestAnimationFrame==="function"?requestAnimationFrame:(i)=>setTimeout(i,16),o=()=>{if(n)return;n=!0,r(()=>{n=!1,e(se(t))})};return e(se(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function bn(e,t){let n=Math.max(0,-e),r=e<=0?Math.max(0,t)*0.5:0;return Math.round(Math.max(n,r))}function wo(e){let t=e.host??_e();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(g)=>setTimeout(g,16),s=null,l=(g)=>{s=null,e.onPull?.(g,o,{bounce:Math.min(g,Math.max(0,-se(t)))})},f=(g)=>{let y=s!==null;if(s=g,y)return;a(()=>{if(s!==null)l(s)})},u=(g)=>{let y=g.touches?.[0];return y?y.clientY:null},m=(g)=>{if(i||se(t)>0)return;r=u(g),o=!1},b=(g)=>{if(r===null)return;let y=u(g);if(y===null)return;let h=bn(se(t),y-r);if(!o&&h>=n)o=!0,Promise.resolve(gn.impact("medium")).catch(()=>{});else if(o&&h<n*0.8)o=!1;f(h)},c=async()=>{if(r===null)return;if(r=null,!o){l(0);return}o=!1,i=!0,l(n);try{await e.onRefresh()}finally{i=!1,l(0)}},p=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",b,{passive:!0}),t.addEventListener("touchend",c),t.addEventListener("touchcancel",p),()=>{s=null,t.removeEventListener("touchstart",m),t.removeEventListener("touchmove",b),t.removeEventListener("touchend",c),t.removeEventListener("touchcancel",p)}}function vn(e,t=52){let n=Math.max(1,t),r=Math.min(1,Math.max(0,e/n)),o=e<0?1+Math.min(0.1,-e/600):1;return{progress:Math.round(r*1000)/1000,stretch:Math.round(o*1000)/1000}}function So(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return hn((o)=>{let i=vn(o,r()),a=`${i.progress}|${i.stretch}`;if(a===n)return;n=a,e.style.setProperty("--native-nav-progress",String(i.progress)),e.style.setProperty("--native-nav-stretch",String(i.stretch)),t.onChange?.(i)},t.host)}function Ro(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Tt(){if(typeof window>"u")return;return window}var kt="__stxPushed",yn="__stxScroll";function wn(e=Tt()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(kt in n)return n[kt]===!0;return!(yn in n)}function Ao(e=Tt()){if(!wn(e))return!1;return e.history.back(),!0}function ko(e,t,n=50){let r=e[e.length-1];if(e.length>=2&&e[e.length-2].path===t)e.pop();else if(!r||r.path!==t)e.push({path:t,title:""});if(e.length>n)e.splice(0,e.length-n);return{current:e[e.length-1],previous:e[e.length-2]??null}}function Eo(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function To(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function Sn(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function Oo(){if(typeof window>"u")return;let e=window.stxRouter;if(typeof e?.screens!=="function")return;let t=e.screens(),n=t.find((o)=>o.active);if(!n)return;let r=t.filter((o)=>o.tab===n.tab&&o.depth<n.depth);if(!r.length)return null;return Sn(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Po(e=typeof window>"u"?void 0:window){let t=e?.stxRouter;if(typeof t?.screens!=="function"||typeof e?.history?.go!=="function")return!1;let n=t.screens(),r=n.find((a)=>a.active);if(!r)return!1;let o=n.filter((a)=>a.tab===r.tab&&a.depth<r.depth);if(!o.length)return!1;let i=o.reduce((a,s)=>s.depth<a.depth?s:a);return e.history.go(i.depth-r.depth),!0}function Io(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function Rn(e,t=xn()){let n;try{n=new URL(e)}catch{return null}let r=`${n.search}${n.hash}`;if(n.protocol==="http:"||n.protocol==="https:"){if(!t||n.origin!==t)return null;return`${n.pathname||"/"}${r}`}return`${`/${[n.host,n.pathname.replace(/^\/+/,"")].filter(Boolean).join("/")}`}${r}`}function xn(){if(typeof window>"u")return;return window.location?.origin}var Et="stacks-mobile-deep-link";function Mo(e,t){let n=(r)=>{let o=Rn(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Et)===r)return;sessionStorage.setItem(Et,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var Co=5000;function An(e,t,n=5000){let r=t.filter((o)=>Number.isFinite(o.timestamp)&&Number.isFinite(o.bpm)&&o.bpm>0).slice().sort((o,i)=>o.timestamp-i.timestamp);if(!r.length)return e.slice();return e.map((o)=>{let i=0,a=r.length;while(i<a){let u=i+a>>1;if(r[u].timestamp<o.timestamp)i=u+1;else a=u}let s=r[i],l=r[i-1],f=!s?l:!l?s:o.timestamp-l.timestamp<=s.timestamp-o.timestamp?l:s;if(!f||Math.abs(f.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(f.bpm)}})}var kn=6371008.8,Be={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0},En=30,Tn=En;function On(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 2*kn*Math.asin(Math.min(1,Math.sqrt(i)))}function No(e,t=25){let n=new Set;return e.filter((r)=>Number.isFinite(r.latitude)&&Number.isFinite(r.longitude)&&Number.isFinite(r.timestamp)&&Math.abs(r.latitude)<=90&&Math.abs(r.longitude)<=180&&Number.isFinite(r.accuracy)&&r.accuracy>=0&&r.accuracy<=t).sort((r,o)=>r.timestamp-o.timestamp).filter((r)=>{if(n.has(r.timestamp))return!1;return n.add(r.timestamp),!0})}function Pn(e,t){return Number.isFinite(e.latitude)&&Number.isFinite(e.longitude)&&Number.isFinite(e.timestamp)&&Math.abs(e.latitude)<=90&&Math.abs(e.longitude)<=180&&Number.isFinite(e.accuracy)&&e.accuracy>=0&&e.accuracy<=t}function ve(e={}){let t=e.maxAccuracyM??25,n=(e.paceWindowS??30)*1000,r=[],o=0,i=0,a=null,s=0,l=null,f=null,u={...Be};function m(c){let p=r[r.length-1],g=a?(c.timestamp-a.timestamp)/1000:0;if(a=c,s++,!p){r.push({fix:c,cumM:0});return}if(g>Tn){r.push({fix:c,cumM:o});return}let y=(c.timestamp-p.fix.timestamp)/1000,h=On(p.fix,c),O=Math.min(10,Math.max(3,p.fix.accuracy,c.accuracy));if(h<O)return;if(o+=h,y>0&&h/y>=0.5)i+=y;r.push({fix:c,cumM:o})}function b(){let c=r[r.length-1];if(c){let y=c.fix.timestamp-n,h=0;while(h<r.length-1&&r[h].fix.timestamp<y)h++;if(h)r=r.slice(h)}let p=null,g=null;if(c&&a.timestamp-c.fix.timestamp<=n){let y=r[0],h=c.cumM-y.cumM,O=(c.fix.timestamp-y.fix.timestamp)/1000;if(h>=20&&O>0)g=h/O,p=O/(h/1000)}return{distanceM:o,movingS:i,paceSPerKm:p,averagePaceSPerKm:o>=50&&i>0?i/(o/1000):null,speedMps:g,accuracyM:a?a.accuracy:f,fixes:s}}return{get stats(){return u},get latestTimestamp(){return l},add(c){if(c.length){let p=c[c.length-1];if(!a)f=p.accuracy??null;let g=a?a.timestamp:-1/0,y=c.filter((h)=>Pn(h,t)&&h.timestamp>g).sort((h,O)=>h.timestamp-O.timestamp);for(let h of y){if(a&&h.timestamp<=a.timestamp)continue;m(h)}for(let h of c)if(Number.isFinite(h.timestamp)&&(l===null||h.timestamp>l))l=h.timestamp}return u=b(),u}}}function In(e,t={}){return ve(t).add(e)}function Do(e){if(e==null||e<=0||!Number.isFinite(e)||e>3600)return"–";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function Ho(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var Ot=3600,Mn=30000;function Ln(e,t,n){if(!n||t<=Ot)return e;return Math.max(e,Math.min(Mn,Math.round(e*t/Ot)))}function _o(e){let t=e.location,n=e.intervalMs??3000,r=Be,o=ve(e),i=!1,a=null,s=0,l=e.heartRate,f=!1,u=null,m=[],b=()=>typeof document<"u"&&document.visibilityState==="hidden",c=0,p=null,g=Promise.resolve(),y=null,h=!1,O=null;function P(){if(h)throw Object.assign(Error("The recording screen is no longer active"),{code:"RECORDING_CONFLICT"});if(t.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect native recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"})}function S(){if(P(),!O)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});return O}function R(v){let A=g.then(v);return g=A.then(()=>{},()=>{}),A}function k(){if(p)return p;let v=c,A=O,I=(async()=>{if(P(),!A)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});let L=o,C=L.latestTimestamp,U=await t.readRecording(C===null?{expectedId:A}:{expectedId:A,since:C});if(v!==c||h||L!==o)return L.add(U);if(C!==null&&U.length&&U[0].timestamp<=C)i=!0;return r=L.add(U),e.onUpdate?.(r),r})().finally(()=>{if(p===I)p=null});return p=I,I}function x(){if(H(),h)return;let v=s,A=()=>{a=setTimeout(()=>{if(a=null,h||v!==s)return;(b()?Promise.resolve():k().then(()=>{},()=>{})).then(()=>{if(!h&&v===s)A()})},Ln(n,r.fixes,i))};A()}function H(){if(s++,a)clearTimeout(a);a=null}function G(v,A,I,L=ve(e)){if(H(),c++,p=null,o=L,i=!1,O=v,u=A,f=A!==null,m=[],r=I,!h)e.onUpdate?.(r)}async function me(v){if(!l||!f||!u||h||l.supportsRecordingOwnership?.()!==!0)return;await v(l,u).catch(()=>{})}return{get stats(){return r},get recordingId(){return O},get heartRateRecordingId(){return u},get heartRate(){return m},start(v){return y=null,R(async()=>{if(P(),v&&t.supportsRecordingIntentIdentity?.()!==!0)throw Object.assign(Error("This host cannot start a registered route identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(v&&(typeof v.recordingId!=="string"||!v.recordingId.trim()))throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"});let A=typeof e.locationOptions==="function"?e.locationOptions():e.locationOptions,I=await t.startRecording({enableHighAccuracy:!0,...A,...v?{recordingId:v.recordingId}:{}});if(!I?.active||typeof I.id!=="string"||!I.id.trim())throw Object.assign(Error("The native recording did not provide an ID"),{code:"RECORDING_CONFLICT"});if(v&&I.id!==v.recordingId)throw Object.assign(Error("The native route did not start with its registered ID"),{code:"RECORDING_CONFLICT"});let L=null;if(!h&&l?.isAvailable()&&l.supportsRecordingOwnership?.()===!0&&(!v||v.heartRateRecordingId&&l.supportsRecordingIntentIdentity?.()===!0))try{let C=await l.startRecording(v?{recordingId:v.heartRateRecordingId}:void 0);if(v&&C.id!==v.heartRateRecordingId)throw Object.assign(Error("The native heart rate did not start with its registered ID"),{code:"RECORDING_CONFLICT"});if(C.active&&typeof C.id==="string"&&C.id.trim())L=C.id}catch{}return G(I.id,L,{...Be}),x(),r})},attach(v){return y=null,R(async()=>{if(typeof v?.expectedId!=="string"||!v.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});P();let A=await t.getRecordingState({expectedId:v.expectedId});if(P(),!A?.id)return null;if(A.id!==v.expectedId)throw Object.assign(Error("The recording belongs to another session"),{code:"RECORDING_CONFLICT"});let I=null;if(v.expectedHeartRateId!==void 0){let U=v.expectedHeartRateId;if(typeof U!=="string"||!U.trim())throw Object.assign(Error("A saved heart-rate recording ID is required"),{code:"RECORDING_CONFLICT"});if(!l?.isAvailable()||l.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect heart-rate recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});let Vt=await l.getRecordingState({expectedId:U});if(P(),Vt.id!==U)throw Object.assign(Error("The heart-rate recording belongs to another session"),{code:"RECORDING_CONFLICT"});await l.readRecording({expectedId:U,since:Date.now()}),P(),I=U}let L=await t.readRecording({expectedId:v.expectedId});P();let C=ve(e);if(G(v.expectedId,I,C.add(L),C),A.active&&!A.paused)x();return A})},pause(){return R(async()=>{await t.pauseRecording({expectedId:S()}),await me((v,A)=>v.pauseRecording({expectedId:A})),H(),await k().catch(()=>{})})},resume(){return R(async()=>{await t.resumeRecording({expectedId:S()}),await me((v,A)=>v.resumeRecording({expectedId:A})),x()})},setPowerMode(v){return R(async()=>{if(h||y||!O||t.supportsRecordingPowerMode?.()!==!0)return!1;try{return await t.setRecordingPowerMode({expectedId:O,powerMode:v}),!0}catch(A){let I=A?.code;if(I==="NO_ACTIVE_RECORDING"||I==="RECORDING_POWER_MODE_UNSUPPORTED")return!1;throw A}})},stop(){if(y)return y;let v=R(async()=>{H(),c++;let A=S(),I=await t.stopRecording({expectedId:A});if(I.id!==A)throw Object.assign(Error("The native recording identity changed"),{code:"RECORDING_CONFLICT"});let L=I?.locations??[];if(!h&&l&&f&&u&&l.supportsRecordingOwnership?.()===!0){let C=await l.stopRecording({expectedId:u}).catch(()=>null);f=!1,m=C?.id===u?C.samples:[],L=An(L,m)}if(r=In(L,e),!h)e.onUpdate?.(r);return L}).catch((A)=>{if(y===v)y=null;throw A});return y=v,v},dispose(){h=!0,c++,p=null,H()},refresh:k}}function Fo(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function Uo(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function Wo(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function $o(e,t){if(e.startedAt===null)return 0;let n=((e.pausedAt??t)-e.startedAt-e.pausedMs)/1000;return Number.isFinite(n)?Math.max(0,n):0}var jo=150;function Cn(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(i)))}function ye(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function zo(e,t){let n=(e||[]).filter((a)=>Number.isFinite(a?.latitude)&&Number.isFinite(a?.longitude)&&Math.abs(a.latitude)<=90&&Math.abs(a.longitude)<=180),r=n.filter((a)=>a.accuracy!=null).map((a)=>Number(a.accuracy)).filter((a)=>Number.isFinite(a)&&a>=0),o=r.length?ye(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:ye(n.map((s)=>s.latitude),0.5),longitude:ye(n.map((s)=>s.longitude),0.5)};i=ye(n.map((s)=>Cn(a,s)),0.8)}if(n.length>=10&&i>150&&o<=15)return"outside";if(t<150)return"unsure";if(n.length<3||o>30||i<25)return"indoors";if(i<50&&o>10)return"indoors";return"unsure"}function qo(e,t={}){let r=String(e||"").trim().toLowerCase().replace(",",".").match(/^(\d+(?:\.\d*)?|\.\d+)\s*(km|k|m|mi)?$/);if(!r)return null;let o=Number(r[1]),i=r[2]||t.defaultUnit||(o>100?"m":"km"),a=i==="m"?o/1000:i==="mi"?o*1.609344:o;return Number.isFinite(a)&&a>=0&&a<=2000?Math.round(a*1000)/1000:null}var Re=new Set,Pt=!1,we=null;function Nn(e){return e.isConnected&&e.getClientRects().length>0}function It(){return[...Re].find((e)=>Nn(e.element))}function Se(){let e=It(),t=Boolean(e);if(t===Pt)return;if(Pt=t,t)Y.enable(e?.tintColor?{tintColor:e.tintColor}:{});else Y.disable()}function Dn(){let e=It();if(!e){Y.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>Y.end())}function Yo(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};Re.add(n);let r=e.ownerDocument?.defaultView;if(!we){let o=Y.onRefresh(Dn),i=()=>Se();r?.addEventListener("stx:load",i),we=()=>{o(),r?.removeEventListener("stx:load",i)}}return Se(),r?.requestAnimationFrame?.(()=>Se()),()=>{if(Re.delete(n),Re.size===0)we?.(),we=null;Se()}}var Qo=0.5;function Hn(e,t,n){let r=[];if(n.includes("large")||n.length===0)r.push({name:"large",y:0});if(n.includes("medium"))r.push({name:"medium",y:Math.max(0,Math.round(e-t*0.5))});return r.push({name:"dismiss",y:Math.max(1,e)}),r.sort((o,i)=>o.y-i.y)}function _n(e){let{y:t,velocity:n,stops:r}=e,o=r.filter((s)=>s.name!=="dismiss"),i=r.find((s)=>s.name==="dismiss");if(o.length===0)return"dismiss";if(n>0.5)return(r.filter((l)=>l.y>t+1)[0]??i).name;if(n<-0.5){let s=o.filter((l)=>l.y<t-1);return(s[s.length-1]??o[0]).name}let a=o[o.length-1];if(t>a.y+(i.y-a.y)*0.5)return"dismiss";return o.reduce((s,l)=>Math.abs(l.y-t)<Math.abs(s.y-t)?l:s).name}function Bn(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function Jo(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Hn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(u)=>{let m=u;if(m.button!==void 0&&m.button!==0)return;if(m.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let b=a().find((c)=>c.name===e.detent())?.y??0;n={y:m.clientY,base:b,pointerId:m.pointerId},o=b,r=[{y:b,t:m.timeStamp}],t.classList.add("is-dragging");try{u.currentTarget?.setPointerCapture?.(m.pointerId)}catch{}},l=(u)=>{if(!n)return;let m=u,b=n.base+m.clientY-n.y;o=b<0?-Bn(-b):b,r.push({y:o,t:m.timeStamp});while(r.length>2&&m.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let c=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/c))))},f=(u)=>{if(!n)return;let m=u;n=null;let b=r[0],c=Math.max(1,m.timeStamp-b.t),p=(o-b.y)/c;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(_n({y:o,velocity:p,stops:a()}))};for(let u of e.handles)u.addEventListener("pointerdown",s),u.addEventListener("pointermove",l),u.addEventListener("pointerup",f),u.addEventListener("pointercancel",f);return()=>{for(let u of e.handles)u.removeEventListener("pointerdown",s),u.removeEventListener("pointermove",l),u.removeEventListener("pointerup",f),u.removeEventListener("pointercancel",f)}}function Zo(e){let t=e.ownerDocument;if(e.parentElement===t.body)return()=>{};let n=t.createComment("native-sheet");return e.parentNode?.insertBefore(n,e),t.body.appendChild(e),()=>{if(n.parentNode)n.parentNode.insertBefore(e,n);else e.remove();n.remove()}}var Fe=new WeakMap;function ei(e,t){let n=e.documentElement,r=Fe.get(e)??0;if(!t){let a=Math.max(0,r-1);if(Fe.set(e,a),a===0)n.removeAttribute("data-native-sheet-card");return}if(Fe.set(e,r+1),r>0)return;let o=e.defaultView,i=(o?.scrollY??0)+(o?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(i)}px`),n.setAttribute("data-native-sheet-card","")}function Fn(e,t){e.style.setProperty("--native-font-scale",String(t.fontScale)),e.toggleAttribute("data-native-reduce-motion",t.reduceMotion),e.toggleAttribute("data-native-reduce-transparency",t.reduceTransparency)}function Un(e){let t=e.replace(/\s+/g,"").toLowerCase();return!t||t==="transparent"||/^rgba\(\d+,\d+,\d+,0(\.0+)?\)$/.test(t)||/\/0(\.0+)?\)$/.test(t)}function Wn(e){let t=e.defaultView;if(!t?.getComputedStyle)return null;for(let n of[e.body,e.documentElement]){if(!n)continue;let r=t.getComputedStyle(n).backgroundColor;if(r&&!Un(r))return r}return null}function $n(e){if(e.documentElement.classList.contains("dark"))return!0;if(e.documentElement.classList.contains("light"))return!1;return Boolean(e.defaultView?.matchMedia?.("(prefers-color-scheme: dark)").matches)}function oi(e,t={}){let n=t.root??e.documentElement;ie.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let u=Wn(e);if(u&&u!==r)r=u,ie.setUnderPageColor(u);let m=$n(e)?"light":"dark";if(m!==o)o=m,he.setStyle(m)},a=xt((u)=>{Fn(n,u),i()}),s=e.defaultView,l=typeof s?.MutationObserver==="function"?new s.MutationObserver(i):null;l?.observe(e.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]});let f=s?.matchMedia?.("(prefers-color-scheme: dark)");return f?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),f?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var ai=64;var Kn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,jn=/^(?:0|[1-9]\d*)$/;function Lt(e){let t=[],n=[],r=e&&typeof e==="object"&&!Array.isArray(e)?e:{};for(let[o,i]of Object.entries(r)){let a=i&&typeof i==="object"?i:null;if(!a){n.push(`spotlight kind "${o}" is not an object`);continue}let{slots:s,route:l}=a,f=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!Kn.test(o)||o.includes("-slot-")){n.push(`spotlight kind "${o}" is not a usable name: lowercase letters, digits and single dashes, and never "-slot-"`);continue}if(typeof s!=="number"||!Number.isInteger(s)||s<=0||s>64){n.push(`spotlight kind "${o}" needs slots between 1 and 64, not ${String(s)}`);continue}if(typeof l!=="string"||!l.startsWith("/")||!l.includes(":id")){n.push(`spotlight kind "${o}" needs a route starting with "/" and carrying ":id", not ${String(l)}`);continue}t.push({name:o,slots:s,route:l,noun:f})}return{kinds:t,problems:n}}function ce(e,t){return e.find((n)=>n.name===t)??null}function le(e,t,n){let r=ce(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function zn(e,t){if(typeof t!=="string")return null;let n=t.lastIndexOf("-slot-");if(n<=0)return null;let r=t.slice(0,n),o=t.slice(n+6);if(!jn.test(o))return null;let i=Number(o);return le(e,r,i)===t?{kind:r,slot:i}:null}function Ct(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function si(e,t){let n=e&&typeof e==="object"?e:{};if(n.enabled===!1)return[];let o=[...(Array.isArray(n.activityTypes)?n.activityTypes.filter((i)=>typeof i==="string"&&i.trim().length>0):[]).map((i)=>i.trim()),...Ct(Lt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function Nt(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${ce(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function qn(e,t,n,r,o=Date.now()){let i=ce(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((p)=>p.kind===n),s=Nt(e,n,r),l=a.find((p)=>p.itemId===r.id)??null,f=l?null:Xn(a,i.slots),u=l||f!==null?null:Qn(a),m=l?.slot??f??u?.slot;if(m===void 0||m===null)return null;let b={kind:n,slot:m,itemId:r.id,title:s,donatedAt:o},c=t.filter((p)=>p.kind!==n||p.slot!==m&&p.itemId!==r.id);return{entries:Dt(e,[...c,b]),entry:b,evicted:u,changed:!l||l.title!==s}}function Vn(e,t,n){let r=e.find((o)=>o.kind===t&&o.itemId===n)??null;return{entries:r?e.filter((o)=>o!==r):[...e],removed:r}}function Gn(e,t,n){let r=zn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=ce(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function Yn(e,t){if(!Array.isArray(t))return[];let n=new Map,r=new Set;for(let o of t){if(!o||typeof o!=="object")continue;let i=o,{kind:a,slot:s,itemId:l,title:f,donatedAt:u}=i;if(typeof a!=="string"||typeof s!=="number"||le(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let m=`${a}-slot-${s}`,b=`${a}#${l}`;if(n.has(m)||r.has(b))continue;n.set(m,{kind:a,slot:s,itemId:l,title:typeof f==="string"&&f.trim()?f:Nt(e,a,{id:l}),donatedAt:typeof u==="number"&&Number.isFinite(u)&&u>0?u:0}),r.add(b)}return Dt(e,[...n.values()])}function Dt(e,t){let n=new Map(e.map((r,o)=>[r.name,o]));return[...t].sort((r,o)=>(n.get(r.kind)??0)-(n.get(o.kind)??0)||r.slot-o.slot)}function Xn(e,t){let n=new Set(e.map((r)=>r.slot));for(let r=0;r<t;r++)if(!n.has(r))return r;return null}function Qn(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function Jn(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var Zn="stacks_spotlight_index",er=3000;function li(e){let t=e.onProblem??((S)=>console.warn(`[spotlight] ${S}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:Lt(e.kinds);for(let S of n.problems)t(S);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??Zn,i=e.legacyStorageKeys??[],a=e.timeoutMs??er,s=e.now??(()=>Date.now()),l=e.bridge??Jn,f=null;function u(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function m(){if(f)return f;f=[];let S=u();if(!S)return f;try{let R=[o,...i].map((k)=>S.getItem(k)).find((k)=>k);f=R?Yn(r,JSON.parse(R)):[]}catch{f=[]}return f}function b(S){f=S;let R=u();if(!R)return;try{R.setItem(o,JSON.stringify(S));for(let k of i)R.removeItem(k)}catch{}}async function c(S){if(!S)return null;let R;try{return await Promise.race([S,new Promise((k)=>{R=setTimeout(()=>k(null),a)})])}catch{return null}finally{if(R!==void 0)clearTimeout(R)}}let p=Promise.resolve();function g(S){let R=p.then(S,S);return p=R.catch(()=>{return}),R}async function y(S,R){let k=l()?.register;if(!k||r.length===0)return!1;return g(async()=>{let x=qn(r,m(),S,R,s()),H=x&&le(r,S,x.entry.slot);if(!x||!H)return!1;if(!x.changed)return b(x.entries),!0;let G=await c(k(x.entry.title,H))!==null;if(G)b(x.entries);return G})}async function h(S,R){let k=l()?.remove;if(!k)return!1;return g(async()=>{let{entries:x,removed:H}=Vn(m(),S,R);if(!H)return!1;let G=le(r,S,H.slot),me=G?await c(k(G))!==null:!1;return b(x),me})}async function O(S,R){let k=ce(r,S)?.slots;if(!k||!l()?.register)return 0;let x=0;for(let H of[...R].slice(0,k).reverse())if(await y(S,H))x++;return x}async function P(){let S=l()?.remove;if(!S)return b([]),0;return g(async()=>{let R=0;for(let k of m()){let x=le(r,k.kind,k.slot);if(x&&await c(S(x))!==null)R++}return b([]),R})}return{kinds:r,index:y,sync:O,remove:h,clear:P,routeFor:(S)=>Gn(r,m(),S),entries:()=>m(),activityTypes:(S)=>Ct(r).map((R)=>`${S}.${R}`),reset:()=>{f=null}}}var Mt=["craftShortcut","craftSiriShortcut"];function ci(e,t){let n=(r)=>{let o=r.detail,i=typeof o==="string"?o:o&&typeof o==="object"?o.action??o.type:null,a=typeof i==="string"?e.routeFor(i):null;if(a)t(a)};if(typeof globalThis.addEventListener!=="function")return()=>{};for(let r of Mt)globalThis.addEventListener(r,n);return()=>{for(let r of Mt)globalThis.removeEventListener(r,n)}}import{tabBar as tr}from"craft-native/mobile";var nr=tr;function rr(e){return Array.from(e.querySelectorAll("a[data-native-tab]")).map((t)=>({id:t.getAttribute("href")||"",title:t.getAttribute("data-native-tab")||t.getAttribute("aria-label")||"",symbol:t.getAttribute("data-native-tab-symbol")||"circle",badge:(t.querySelector(".native-tab-badge")?.textContent||"").trim(),current:t.hasAttribute("data-stx-nav-current")||t.classList.contains("is-active")})).filter((t)=>t.id&&t.title)}function or(e){return{tabs:e.map(({id:n,title:r,symbol:o,badge:i})=>i?{id:n,title:r,symbol:o,badge:i}:{id:n,title:r,symbol:o}),selected:e.find((n)=>n.current)?.id}}function _t(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function ir(){return typeof _t()?.selectTab==="function"}function pi(e,t={}){let n=(r)=>{if(ir()||r.defaultPrevented)return;let o=r.target?.closest?.("a[data-native-tab]");if(!o||!e.contains(o))return;if(!o.hasAttribute("data-stx-nav-current")&&!o.classList.contains("is-active")&&o.getAttribute("aria-current")!=="page")return;r.preventDefault();let i=e.ownerDocument.defaultView;if(t.scrollToTop)t.scrollToTop();else i?.scrollTo?.({top:0,behavior:i.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"});i?.dispatchEvent(new CustomEvent("stx:tabreselect",{detail:{href:o.getAttribute("href")||""}}))};return e.addEventListener("click",n),()=>e.removeEventListener("click",n)}function Ht(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var Ue="stacks:tab-bar-cover";function fi(e,t){if(t)e.setAttribute("data-native-covers-tab-bar","");else e.removeAttribute("data-native-covers-tab-bar");e.ownerDocument?.defaultView?.dispatchEvent(new Event(Ue))}function mi(e,t={}){let n=t.api??nr;if(!n.isAvailable())return null;let r=t.hidden??(()=>Boolean(e.ownerDocument?.querySelector("[data-native-hide-tab-bar], [data-native-covers-tab-bar]"))),o=typeof getComputedStyle==="function"?getComputedStyle(e):null,i=Ht(o?.getPropertyValue("--native-tab-active")||""),a=Ht(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:b,selected:c}=or(rr(e)),p=JSON.stringify({tabs:b,selected:c});if(p===s)return;let g=s&&s!=="hidden"?JSON.parse(s):null;if(g&&c&&JSON.stringify(g.tabs)===JSON.stringify(b))n.select(c);else n.set(b,{selected:c,tint:i,tintDark:a});s=p},f=typeof MutationObserver==="function"?new MutationObserver(l):null;f?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let u=n.onSelect((b)=>{let c=_t();if(c?.selectTab){c.selectTab(b);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((g)=>g.getAttribute("href")===b)?.click()}),m=()=>l();if(typeof window<"u")window.addEventListener("stx:load",m),window.addEventListener("stx:screen-shown",m),window.addEventListener(Ue,m);return l(),()=>{if(f?.disconnect(),u(),typeof window<"u")window.removeEventListener("stx:load",m),window.removeEventListener("stx:screen-shown",m),window.removeEventListener(Ue,m);n.hide()}}function ar(e={}){let t=e.maxSeconds??300,n=e.maxBytes??12582912;if(![t,n].every((g)=>Number.isSafeInteger(g)&&g>0)||t>300)throw TypeError("Invalid voice recording limits");let r={status:"idle",audio:null,error:null},o=new Set,i={},a=null,s=null,l=null,f,u=(g)=>{r=g;for(let y of o)y({...g})},m=()=>{clearTimeout(f),l?.getTracks().forEach((g)=>g.stop()),l=null};function b(){if(i={},a){let y=a;a=null,Promise.resolve(M("audioRecording.cancel")?.(y)).catch(()=>{})}let g=s;if(s=null,g&&g.state!=="inactive")g.stop();m(),u({status:"idle",audio:null,error:null})}async function c(){b();let g=i;u({status:"requesting",audio:null,error:null});try{let y=M("audioRecording.start");if(y){let x=globalThis.crypto.randomUUID();if(a=x,await y(x,{maxSeconds:t}),i!==g)return;f=setTimeout(()=>{if(i===g)p()},t*1000-250),u({status:"recording",audio:null,error:null});return}if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>"u")throw Error("Microphone recording is unavailable. Upload an audio recording instead.");let h=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1},video:!1});if(i!==g){h.getTracks().forEach((x)=>x.stop());return}l=h;let O=["audio/webm;codecs=opus","audio/mp4","audio/webm"].find((x)=>MediaRecorder.isTypeSupported(x)),P=new MediaRecorder(h,{...O?{mimeType:O}:{},audioBitsPerSecond:32000});s=P;let S=[],R=0,k=!1;P.ondataavailable=(x)=>{if(i!==g||!x.data.size)return;if(R+=x.data.size,R>n){if(k=!0,S.length=0,P.state!=="inactive")P.stop();m();return}if(!k)S.push(x.data)},P.onerror=()=>{if(i!==g)return;b(),u({status:"error",audio:null,error:"Recording failed. Please try again."})},P.onstop=()=>{if(i!==g)return;s=null,m();let x=new Blob(S,{type:P.mimeType||O||"audio/webm"});u(k||!x.size?{status:"error",audio:null,error:k?"The recording exceeds the upload limit.":"The recording was empty."}:{status:"ready",audio:x,error:null})},P.start(1000),f=setTimeout(()=>{if(i===g&&P.state!=="inactive")P.stop()},t*1000-250),u({status:"recording",audio:null,error:null})}catch(y){if(i!==g)return;b(),u({status:"error",audio:null,error:y instanceof Error?y.message:"Microphone permission was refused."})}}async function p(){if(!a){if(s&&s.state!=="inactive")s.stop();return}let g=i,y=a;clearTimeout(f);try{let h=await M("audioRecording.stop")?.(y);if(i!==g)return;if(!h?.path||!h.size||h.size>n||!Number.isFinite(h.durationSeconds)||h.durationSeconds<=0||h.durationSeconds>t+1)throw Error("The recording is empty or exceeds its limits.");u({status:"ready",audio:h,error:null})}catch(h){if(i!==g)return;b(),u({status:"error",audio:null,error:h instanceof Error?h.message:"Recording failed."})}}return{start:c,cancel:b,dispose(){b(),o.clear()},stop:p,supported:()=>Boolean(M("audioRecording.start"))||typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getUserMedia)&&typeof MediaRecorder<"u",snapshot:()=>({...r}),subscribe(g){return o.add(g),g({...r}),()=>{o.delete(g)}}}}function sr(e,t={},n="audio"){if(!n||Object.hasOwn(t,n))throw TypeError("Use a distinct recording field name");let r=new FormData;if(typeof Blob<"u"&&e instanceof Blob)r.append(n,e,"feedback");else{if(!e||!("path"in e)||typeof e.path!=="string"||!e.path||!M("audioRecording.stop"))throw TypeError("A native recording requires its native upload host");Reflect.apply(r.append,r,[n,e]);let o=r.get(n);if(!o||typeof o!=="object"||!("path"in o)||o.path!==e.path)throw TypeError("The upload host did not preserve the native recording file")}for(let[o,i]of Object.entries(t)){if(typeof i!=="string")throw TypeError("Upload fields must be strings");r.append(o,i)}return r}var dr={isAvailable:()=>d(()=>We.isAvailable()),getBiometricType:()=>d(()=>We.getBiometricType()),authenticate:(e)=>d(()=>We.authenticate(e))},pr={takePicture:(e)=>d(()=>Ae.takePicture(e)),pickImage:()=>d(()=>Ae.pickImage()),pickMultiple:(e)=>d(()=>Ae.pickMultiple(e)),isAvailable:()=>d(()=>Ae.isAvailable())},fr={getInfo:()=>d(()=>Z.getInfo()),getCapabilities:()=>d(()=>Z.getCapabilities()),isMobile:()=>Z.isMobile(),isIOS:()=>Z.isIOS(),isAndroid:()=>Z.isAndroid(),getLocale:()=>Z.getLocale(),getTimezone:()=>Z.getTimezone()},mr=cr;function z(){return V()?.capabilities.locationRecordingOwnership===!0&&D.supportsRecordingOwnership?.()===!0}function $t(){return z()&&V()?.capabilities.locationRecordingPowerMode===!0&&D.supportsRecordingPowerMode?.()===!0}function X(){return V()?.capabilities.heartRateRecordingOwnership===!0&&T.supportsRecordingOwnership?.()===!0}function Kt(){return z()&&V()?.capabilities.locationRecordingIntentIdentity===!0&&D.supportsRecordingIntentIdentity?.()===!0}function jt(){return X()&&V()?.capabilities.heartRateRecordingIntentIdentity===!0&&T.supportsRecordingIntentIdentity?.()===!0}function qt(e,t,n){return d(async()=>{let r=e&&Object.hasOwn(e,"recordingId");if(r){if(!t())throw Object.assign(Error("This host or adapter cannot start a registered recording identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(typeof e.recordingId!=="string"||!e.recordingId.trim())throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"})}let o=await n();if(r&&o.id!==e.recordingId)throw Object.assign(Error("The native recording identity changed at start"),{code:"RECORDING_CONFLICT"});return o})}function B(e,t,n){return d(()=>{if(e&&Object.hasOwn(e,"expectedId")){if(!t())throw Object.assign(Error("This host or adapter cannot protect recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});if(typeof e.expectedId!=="string"||!e.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"})}return n()})}var gr={supportsRecordingOwnership:z,supportsRecordingIntentIdentity:Kt,supportsRecordingPowerMode:$t,setRecordingPowerMode:(e)=>d(()=>{if(!$t())throw Object.assign(Error("This host cannot change the recording power mode"),{code:"RECORDING_POWER_MODE_UNSUPPORTED"});return B(e,z,()=>D.setRecordingPowerMode(e))}),acknowledgeRecording:(e)=>B({expectedId:e?.expectedId},z,()=>D.acknowledgeRecording(e)),getCurrentPosition:(e)=>d(()=>D.getCurrentPosition(e)),watchPosition:(e,t)=>D.watchPosition(e,t),clearWatch:(e)=>D.clearWatch(e),startRecording:(e)=>qt(e,Kt,()=>D.startRecording(e)),pauseRecording:(e)=>B(e,z,()=>D.pauseRecording(e)),resumeRecording:(e)=>B(e,z,()=>D.resumeRecording(e)),stopRecording:(e)=>B(e,z,()=>D.stopRecording(e)),getRecordingState:(e)=>B(e,z,()=>D.getRecordingState(e)),readRecording:(e)=>B(e,z,()=>D.readRecording(e))},hr={show:(e)=>d(()=>de.show(e)),schedule:(e)=>d(()=>de.schedule(e)),cancel:(e)=>d(()=>de.cancel(e)),cancelAll:()=>d(()=>de.cancelAll()),setBadge:(e)=>d(()=>de.setBadge(e))},br={check:(e)=>d(()=>pe.check(e)),request:(e)=>d(()=>pe.request(e)),checkMultiple:(e)=>d(()=>pe.checkMultiple(e)),requestMultiple:(e)=>d(()=>pe.requestMultiple(e)),openSettings:()=>d(()=>pe.openSettings())},vr={set:(e,t)=>d(()=>Ee.set(e,t)),get:(e)=>d(()=>Ee.get(e)),delete:(e)=>d(()=>Ee.delete(e)),clear:()=>d(()=>Ee.clear())},yr={share:(e)=>d(()=>Wt.share(e)),isAvailable:()=>Wt.isAvailable()},wr={request:()=>d(()=>lr.request())},Oe={impact:(e)=>Promise.resolve().then(()=>ke.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ke.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ke.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ke.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=M("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function zt(e){if(typeof e==="string")return e.trim()||null;if(!e||typeof e!=="object")return null;let t=e.url;return typeof t==="string"&&t.trim()?t:null}var Sr={async getInitialURL(){if(!await ee())return null;return zt(await Bt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=Bt.onLink?.((o,i)=>{let a=zt(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(Pe()?.craft)r();else ee().then(r);return()=>{n=!0,t?.()}}},Ai={isAvailable:()=>Te.isAvailable(),set:(e,t)=>Te.set(e,t),remove:(e)=>Te.remove(e),clear:()=>Te.clear()},Rr={enable:()=>d(()=>Ft.enable()),disable:()=>d(()=>Ft.disable())},xr={isAvailable:()=>xe.isAvailable(),get:()=>d(()=>xe.get()),set:(e)=>d(()=>xe.set(e)),restore:()=>d(()=>xe.restore())},Ar={isAvailable:()=>j.isAvailable(),supports:(e)=>j.supports(e),getAuthorizationStatus:()=>d(()=>j.getAuthorizationStatus()),requestAuthorization:()=>d(()=>j.requestAuthorization()),getNowPlaying:()=>d(()=>j.getNowPlaying()),play:()=>d(()=>j.play()),pause:()=>d(()=>j.pause()),togglePlayPause:()=>d(()=>j.togglePlayPause()),skipToNext:()=>d(()=>j.skipToNext()),skipToPrevious:(e)=>d(()=>j.skipToPrevious(e)),onChange:(e)=>J(()=>j.onChange(e))},kr={supportsRecordingOwnership:X,supportsRecordingIntentIdentity:jt,acknowledgeRecording:(e)=>B({expectedId:e?.expectedId},X,()=>T.acknowledgeRecording(e)),isAvailable:()=>T.isAvailable(),supports:(e)=>T.supports(e),getState:()=>d(()=>T.getState()),requestAuthorization:()=>d(()=>T.requestAuthorization()),scan:(e)=>d(()=>T.scan(e)),stopScan:()=>d(()=>T.stopScan()),getDevices:()=>d(()=>T.getDevices()),connect:(e)=>d(()=>T.connect(e)),reconnect:()=>d(()=>T.reconnect()),disconnect:(e)=>d(()=>T.disconnect(e)),startRecording:(e)=>qt(e,jt,()=>T.startRecording(e)),pauseRecording:(e)=>B(e,X,()=>T.pauseRecording(e)),resumeRecording:(e)=>B(e,X,()=>T.resumeRecording(e)),stopRecording:(e)=>B(e,X,()=>T.stopRecording(e)),getRecordingState:(e)=>B(e,X,()=>T.getRecordingState(e)),readRecording:(e)=>B(e,X,()=>T.readRecording(e)),onReading:(e)=>J(()=>T.onReading(e)),onDevice:(e)=>J(()=>T.onDevice(e)),onState:(e)=>J(()=>T.onState(e))},Er={isAvailable:()=>je.isAvailable(),speak:(e,t)=>d(()=>je.speak(e,t)),stop:()=>d(()=>je.stop())},Tr={getStatus:()=>d(()=>Ut.getStatus()),onChange:(e)=>J(()=>Ut.onChange(e))},Or={register:()=>d(()=>Ke.register()),onToken:(e)=>Ke.onToken(e),onNotification:(e)=>J(()=>Ke.onNotification(e))},Pr={requestAuthorization:(e,t)=>d(()=>ue.requestAuthorization(e,t)),getData:(e,t)=>d(()=>ue.getData(e,t)),saveWorkout:(e)=>d(()=>ue.saveWorkout(e)),getWorkouts:(e)=>d(()=>ue.getWorkouts(e)),getDailyStatistics:(e,t)=>d(()=>ue.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>w("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSamples:(e,t)=>w("health.getSamples",[e,t??{}],()=>[]).then((n)=>Array.isArray(n)?n:[]),getSleepIntervals:(e)=>w("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),saveMindfulSession:(e)=>w("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>w("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>w("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>w("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>W("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>M(`health.${e}`)!==null},Ir={start:(e)=>d(()=>$e.start(e)),update:(e)=>d(()=>$e.update(e)),end:()=>d(()=>$e.end())},Mr={send:(e)=>d(()=>fe.send(e)),updateContext:(e)=>d(()=>fe.updateContext(e)),isReachable:()=>d(()=>fe.isReachable()),onMessage:(e)=>fe.onMessage(e),onReachabilityChange:(e)=>fe.onReachabilityChange(e)},ki=ur;function Pe(){return E()}function V(){let e=Pe()?.craft;if(!e||typeof e!=="object")return null;if(!("platform"in e)||e.platform!=="ios"&&e.platform!=="android")return null;let t="capabilities"in e?e.capabilities:void 0,n=t&&typeof t==="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).filter(([,r])=>typeof r==="boolean")):{};return{platform:e.platform,capabilities:n}}function ze(){return V()!==null}function Lr(e=2000){if(ze()||re())return Promise.resolve(!0);let t=Pe();if(!t||!(t.craft||t.webkit?.messageHandlers?.craft))return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(ze())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Cr(e){let t=Pe();if(!t)return()=>{};if(V()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!V())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Nr(e){await Oe.impact("light");try{let t=await e();return await Oe.notification("success"),t}catch(t){throw await Oe.notification("error"),t}}var Ei={get nativeBridge(){return V()},biometrics:dr,camera:pr,device:fr,haptics:Oe,lifecycle:mr,location:gr,notifications:hr,permissions:br,secureStorage:vr,storage:ht,crypto:bt,share:yr,appReview:wr,deepLinks:Sr,keepAwake:Rr,brightness:xr,music:Ar,heartRate:kr,scheduledWorkouts:yt,speech:Er,network:Tr,pushNotifications:Or,health:Pr,liveActivities:Ir,watchConnectivity:Mr,dialog:oe,contextMenu:De,browser:ot,symbols:it,statusBar:he,chrome:ie,refresh:Y,background:ae,clipboard:at,db:st,files:lt,shortcuts:ct,widgets:ut,orientation:dt,auth:pt,storeKit:ft,isNativeMobile:ze,whenNative:Lr,onReady:Cr,withFeedback:Nr};export{Dr as BRIDGE_WAIT_MS,Co as HEART_RATE_MATCH_MS,jo as INDOOR_CHECK_AFTER_S,ai as MAX_SPOTLIGHT_SLOTS_PER_KIND,Ot as ROUTE_FULL_READ_FIXES,Mn as ROUTE_FULL_READ_MAX_MS,En as ROUTE_GAP_S,Qo as SHEET_FLICK_VELOCITY,Ue as TAB_BAR_COVER_EVENT,d as afterBridge,wr as appReview,Fn as applyAppearance,An as attachHeartRate,pt as auth,Eo as backLabelFor,ae as background,dr as biometrics,ge as bridgePending,xr as brightness,ot as browser,w as callNative,pr as camera,wn as canGoBack,ie as chrome,at as clipboard,$r as confirmAction,De as contextMenu,fi as coverTabBar,E as craftHost,Q as craftRoot,co as crashReporting,_o as createRouteRecorder,ve as createRouteStats,li as createSpotlightIndex,ar as createVoiceRecorder,bt as crypto,Rt as currentAppearance,st as db,Rn as deepLinkPath,Sr as deepLinks,fr as device,oe as dialog,ko as enterNavTrail,lt as files,On as fixDistance,ro as focusSegment,Mo as followDeepLinks,V as getNativeMobileBridge,Ao as goBack,Po as goBackToTabRoot,pi as handleTabReselect,Oe as haptics,re as hasNativeMobileHost,Pr as health,kr as heartRate,zo as indoorVerdict,oi as installNativeChrome,oo as installPressables,ze as isNativeMobile,Nn as isShown,Rr as keepAwake,pn as keepBreadcrumb,vn as largeTitleMetrics,mr as lifecycle,Zo as liftToBody,Ir as liveActivities,gr as location,mi as mirrorTabBar,Ei as mobile,Ar as music,Xt as nativeFunction,M as nativeFunctionNow,or as nativeTabs,To as navTrail,Tr as network,mn as normalizeAppearance,zt as normalizeDeepLinkURL,cn as normalizeScheduledWorkout,hr as notifications,So as observeLargeTitle,eo as observeLongPress,Yo as observeNativeRefresh,hn as observePageScroll,wo as observePullToRefresh,to as observeSegmentScrub,Jo as observeSheetDrag,xt as onAppearance,bo as onBackgroundRefresh,W as onCraftEvent,go as onMemoryWarning,Cr as onMobileReady,mo as onResume,ho as onSilentPush,ci as onSpotlightTap,dt as orientation,Do as paceLabel,Wn as pageBackground,$n as pageIsDark,se as pageScrollTop,Uo as pauseSessionClock,br as permissions,tn as placeMenu,qn as placeSpotlightItem,Je as presentActionSheet,Xe as presentAlert,Ie as presentChoice,Qe as presentConfirm,Ze as presentContextMenu,ei as presentPageAsCard,Oo as previousScreenPath,bn as pullDistance,Or as pushNotifications,Yn as readSpotlightEntries,Lt as readSpotlightKinds,rr as readTabLinks,Y as refresh,Vn as removeSpotlightItem,Ro as resolveScrollHost,Wo as resumeSessionClock,Ln as routeReadInterval,In as routeStats,ir as routerHandlesTabs,Bn as rubberBand,yt as scheduledWorkouts,ln as scheduledWorkoutsUnsupported,vr as secureStorage,un as segmentAt,no as segmentForKey,$o as sessionClockElapsed,_n as settleSheet,yr as share,Hn as sheetStops,ct as shortcuts,Kr as showContextMenuFor,Ai as snapshots,Er as speech,Ho as speedLabel,ki as splash,le as spotlightAction,Ct as spotlightActions,si as spotlightActivityTypes,Jn as spotlightBridge,ce as spotlightKind,Gn as spotlightRoute,zn as spotlightSlot,Nt as spotlightTitle,Fo as startSessionClock,he as statusBar,ht as storage,ft as storeKit,J as subscribeWhenReady,it as symbols,nr as tabBar,Ne as toNativeRect,Io as trailEntryFor,qo as typedDistanceKm,No as usableFixes,Wr as useActionSheet,sr as voiceRecordingFormData,Mr as watchConnectivity,ee as whenBridgeReady,Lr as whenNativeMobile,ut as widgets,Nr as withNativeFeedback};
55
+ `;function Ge(){return E()?.document}function en(e){if(e.getElementById(qe))return;let t=e.createElement("style");t.id=qe,t.textContent=Zt,(e.head??e.documentElement).appendChild(t)}var tn=0;function N(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}function Ve(){return E()?.stx?.overlays}var nn=0;function Ye(e,t,n,r){en(e);let o=E(),i=`native-dialog-layer-${++nn}`,a=N(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(N(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,f=(c)=>{if(l)return;l=!0,a.classList.remove("is-open"),Ve()?.close(i),setTimeout(()=>a.remove(),260),s(c)},u=n({root:a,settle:f});a.appendChild(u),e.body.appendChild(a),Ve()?.open(i,{panel:u,root:a,onEscape:()=>f(r())});let m=o;(typeof m?.requestAnimationFrame==="function"?(c)=>m.requestAnimationFrame(()=>m.requestAnimationFrame(c)):(c)=>setTimeout(c,16))(()=>{if(!l)a.classList.add("is-open")})})}function Ie(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++tn}`,r=e.actions.find((a)=>a.style==="cancel"),o=e.variant==="sheet"?e.actions.filter((a)=>a.style!=="cancel"):e.actions,i=e.variant==="sheet"?r??{id:"__cancel",title:e.cancelLabel||"Cancel",style:"cancel"}:void 0;return Ye(t,e.variant,({root:a,settle:s})=>{let l=(c)=>c.style==="cancel"?null:c.id,f=N(t,"div","native-dialog-panel");f.setAttribute("role","alertdialog"),f.setAttribute("aria-modal","true"),f.tabIndex=-1;let u=N(t,"div","native-dialog-group");if(e.title||e.message){let c=N(t,"div","native-dialog-header");if(e.title){let p=N(t,"p","native-dialog-title",e.title);p.id=`${n}-title`,c.appendChild(p),f.setAttribute("aria-labelledby",p.id)}if(e.message){let p=N(t,"p","native-dialog-message",e.message);p.id=`${n}-message`,c.appendChild(p),f.setAttribute("aria-describedby",p.id)}u.appendChild(c)}let m=N(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)m.classList.add("is-row");for(let c of o){let p=N(t,"button",`native-dialog-action${c.style==="destructive"?" is-destructive":""}${c.style==="cancel"?" is-cancel":""}`,c.title);p.type="button",p.setAttribute("data-action-id",c.id),p.addEventListener("click",()=>s(l(c))),m.appendChild(p)}if(u.appendChild(m),f.appendChild(u),i){let c=N(t,"div","native-dialog-group"),p=N(t,"button","native-dialog-action is-cancel",i.title);p.type="button",p.setAttribute("data-action-id",i.id),p.addEventListener("click",()=>s(null)),c.appendChild(p),f.appendChild(c)}let b=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")b?.addEventListener("click",()=>s(null));return f},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Xe(e){await Ie({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Qe(e){return await Ie({variant:"alert",title:e.title,message:e.message,actions:[{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"},{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"}]})==="confirm"}function Je(e){return Ie({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function rn(e,t,n){let i=Math.max(12,Math.min(e.x,n.width-t.width-12)),a=e.y+e.height+8,s=a+t.height<=n.height-12,l=e.y-8-t.height,f=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,u=e.x+e.width/2>n.width/2?"right":"left";return{top:f,left:i,origin:`${s||l<12?"top":"bottom"} ${u}`}}function Ze(e){let t=Ge();if(!t?.body)return Promise.resolve(null);let n=E();return Ye(t,"menu",({root:r,settle:o})=>{let i=N(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(N(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=N(t,"button",`native-menu-item${a.destructive?" is-destructive":""}`);if(s.type="button",s.setAttribute("role","menuitem"),s.setAttribute("data-action-id",a.id),a.disabled)s.disabled=!0;if(s.appendChild(N(t,"span","native-menu-label",a.title)),a.icon){let l=N(t,"i",`native-menu-icon ${a.icon}`);l.setAttribute("aria-hidden","true"),s.appendChild(l)}s.addEventListener("click",()=>o(a.id)),i.appendChild(s)}return r.querySelector(".native-dialog-backdrop")?.addEventListener("click",()=>o(null)),queueMicrotask(()=>{let a=i.getBoundingClientRect?.(),s=rn(e.anchor,{width:a?.width||248,height:a?.height||e.items.length*44},{width:n?.innerWidth||390,height:n?.innerHeight||844});i.style.top=`${s.top}px`,i.style.left=`${s.left}px`,i.style.setProperty("--native-menu-origin",s.origin)}),i},()=>null)}var rt=()=>!0,_=()=>!1,K=()=>null;function et(){return E()?.navigator??(typeof navigator>"u"?void 0:navigator)}function Ne(e){return{x:Math.round(e.x??e.left??0),y:Math.round(e.y??e.top??0),width:Math.round(e.width),height:Math.round(e.height)}}var oe={alert:(e)=>v("dialog.alert",[e],()=>Xe(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>v("dialog.confirm",[e],()=>Qe(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?Ne(e.anchor):void 0},n=await v("dialog.actionSheet",[t],()=>Je(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Kr(){return(e)=>oe.actionSheet(e)}async function jr(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return oe.confirm(e);return await oe.actionSheet({title:e.title,message:e.message,anchor:e.anchor,actions:[{id:"confirm",title:e.confirmLabel||"OK",style:e.destructive?"destructive":"default"},{id:"cancel",title:e.cancelLabel||"Cancel",style:"cancel"}]})==="confirm"}var De={show:async(e)=>{let t={title:e.title,anchor:Ne(e.anchor),items:e.items.map(({id:r,title:o,symbol:i,destructive:a,disabled:s})=>({id:r,title:o,symbol:i,destructive:a,disabled:s}))},n=await v("contextMenu.show",[t],()=>Ze(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function zr(e,t){return De.show({...t,anchor:Ne(e.getBoundingClientRect())})}function on(e,t){let n=E();if(!n)return{cancelled:!0};if(typeof n.craft?.openURL==="function")return Promise.resolve(n.craft.openURL(e)).catch(()=>{}),{cancelled:!1};if(t.mode==="auth")return n.location?.assign(e),{cancelled:!1};if(!(typeof n.open==="function"?n.open(e,"_blank","noopener"):null))n.location?.assign(e);return{cancelled:!1}}var ot={open:async(e,t={})=>{let n=await v("browser.open",[e,t],()=>on(e,t),{fallbackOnError:!0});if(!n||typeof n!=="object")return{cancelled:!1};let{url:r,cancelled:o}=n;return typeof r==="string"?{url:r,cancelled:Boolean(o)}:{cancelled:Boolean(o)}}},Me=new Map,Le=new Map;function tt(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var it={isAvailable:()=>M("symbols.image")!==null,image:(e,t={})=>{let n=tt(e,t),r=Me.get(n);if(r)return r;let o=v("symbols.image",[e,t],K).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,K).then((i)=>(Le.set(n,i),i));return Me.set(n,o),o},cached:(e,t={})=>Le.get(tt(e,t)),clearCache:()=>{Me.clear(),Le.clear()}},he={setStyle:(e)=>v("statusBar.setStyle",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1)},ie={setUnderPageColor:(e)=>v("chrome.setUnderPageColor",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>v("chrome.setKeyboardAccessory",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1)},Y={isAvailable:()=>M("refresh.enable")!==null,enable:(e)=>v("refresh.enable",[e??{}],_,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>v("refresh.disable",[],_,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>v("refresh.end",[],_,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>W("craftRefresh",()=>e())},ae={complete:(e)=>v("background.complete",[e],_,{fallbackOnError:!0}).then((t)=>t!==!1)},at={write:(e)=>v("clipboard.write",[e],async()=>{let t=et()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(rt,_)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>v("clipboard.read",[],async()=>{let e=et()?.clipboard;if(!e?.readText)return null;return e.readText().catch(K)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},st={isAvailable:()=>M("db.query")!==null,query:(e,t=[])=>v("db.query",[e,t],K).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>v("db.execute",[e,t],K).then((n)=>{if(!n||typeof n!=="object")return null;let{rowsAffected:r,lastInsertId:o}=n;return{rowsAffected:Number(r)||0,lastInsertId:Number(o)||0}})};function Ce(e,t){let n=E()?.document;if(!n?.body)return null;let r=n.createElement("a");return r.href=e,r.download=t,r.rel="noopener",r.style.display="none",n.body.appendChild(r),r.click(),r.remove(),t}function an(e){let t=E()?.document;if(!t?.body)return Promise.resolve(null);return new Promise((n)=>{let r=t.createElement("input");if(r.type="file",r.style.display="none",e.length)r.accept=e.map((i)=>i.includes("/")||i.startsWith(".")?i:`.${i}`).join(",");let o=(i)=>{r.remove(),n(i)};r.addEventListener("cancel",()=>o(null)),r.addEventListener("change",()=>{let i=r.files?.[0];if(!i)return o(null);let a=new FileReader;a.onload=()=>o({name:i.name,mimeType:i.type||void 0,data:typeof a.result==="string"?a.result:void 0}),a.onerror=()=>o({name:i.name,mimeType:i.type||void 0}),a.readAsDataURL(i)}),t.body.appendChild(r),r.click()})}var lt={openPDF:(e,t=0)=>v("openPDF",[e,t],()=>{let n=E();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>v("takeScreenshot",[],K,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>v("scanQRCode",[],K).then((e)=>{if(!e||typeof e!=="object")return null;let{type:t,data:n}=e;return typeof n==="string"?{type:String(t??""),data:n}:null},K),pickFile:(e=[])=>v("pickFile",[e],()=>an(e)).then((t)=>{if(!t||typeof t!=="object")return null;let n=t;if(typeof n.name!=="string")return null;return{name:n.name,path:typeof n.path==="string"?n.path:void 0,data:typeof n.data==="string"?n.data:void 0,mimeType:typeof n.mimeType==="string"?n.mimeType:void 0}},K),saveFile:(e,t,n)=>v("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return Ce(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=Ce(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>v("downloadFile",[e,t],()=>Ce(e,t)).then((n)=>typeof n==="string"?n:null)},ct={set:(e)=>v("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],_).then((t)=>t!==!1),clear:()=>v("shortcuts.clear",[],_).then((e)=>e!==!1),onShortcut:(e)=>W("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},ut={update:(e)=>v("widget.update",[e],_).then((t)=>t!==!1),reload:()=>v("widget.reload",[],_).then((e)=>e!==!1)},sn={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function nt(){return E()?.screen?.orientation}var dt={lock:(e)=>v("lockOrientation",[e],()=>{let t=nt();return t?.lock?t.lock(sn[e]).then(rt,_):!1}).then((t)=>t!==!1),unlock:()=>v("unlockOrientation",[],()=>(nt()?.unlock?.(),!0)).then((e)=>e!==!1)},pt={signInWithApple:(e={})=>v("signInWithApple",e.nonce?[{nonce:e.nonce}]:[],K).then((t)=>{if(!t||typeof t!=="object"||typeof t.userId!=="string")return null;return t})},ft={isAvailable:()=>M("iap.purchase")!==null,products:(e)=>v("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>v("iap.purchase",[e],K).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>v("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};import{storage as q}from"craft-native/mobile";function mt(){return Q()?.capabilities?.storageCompareAndSet===!0&&q.supportsCompareAndSet?.()===!0}function gt(){return Q()?.capabilities?.storageSetIfAbsent===!0&&q.supportsSetIfAbsent?.()===!0}var ht={supportsCompareAndSet:mt,supportsSetIfAbsent:gt,get:(e)=>d(()=>q.get(e)),set:(e,t)=>d(()=>q.set(e,t)),remove:(e)=>d(()=>q.remove(e)),clear:()=>d(()=>q.clear()),keys:()=>d(()=>q.keys()),setIfAbsent:(e,t)=>d(()=>{if(!gt())throw Object.assign(Error("This host or adapter cannot create storage atomically"),{code:"STORAGE_SET_IF_ABSENT_UNSUPPORTED"});return q.setIfAbsent(e,t)}),compareAndSet:(e,t,n)=>d(()=>{if(!mt())throw Object.assign(Error("This host or adapter cannot compare storage atomically"),{code:"STORAGE_COMPARE_AND_SET_UNSUPPORTED"});return q.compareAndSet(e,t,n)})};import{crypto as ln}from"craft-native/mobile";var bt={randomUUID:()=>d(()=>ln.randomUUID())};var cn=["authorized","denied","notDetermined","restricted","unsupported"];function be(){let e=Q(),t=e?.scheduledWorkouts;if(!t||typeof t!=="object"||e?.capabilities?.scheduledWorkouts!==!0)return;return t}function un(){return Object.assign(Error("unsupported"),{code:"UNSUPPORTED"})}function vt(e){return cn.includes(e)?e:"unsupported"}function dn(e){if(!e||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string"||!t.id||typeof t.date!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(t.date))return null;let n={id:t.id.toLowerCase(),date:t.date,complete:t.complete===!0};if(typeof t.hour==="number"&&Number.isFinite(t.hour))n.hour=t.hour;if(typeof t.minute==="number"&&Number.isFinite(t.minute))n.minute=t.minute;return n}function te(e,t,...n){return d(async()=>{let r=be();if(typeof r?.[e]!=="function")throw un();return t(await r[e](...n))})}var yt={isAvailable:()=>typeof be()?.isSupported==="function",supports:(e)=>typeof be()?.[e]==="function",isSupported:()=>d(async()=>{let e=be();if(typeof e?.isSupported!=="function")return!1;try{return await e.isSupported()===!0}catch{return!1}}),authorization:()=>te("authorization",vt),requestAuthorization:()=>te("requestAuthorization",vt),list:()=>te("list",(e)=>Array.isArray(e)?e.map(dn).filter((t)=>t!==null):[]),schedule:(e)=>{if(!e||typeof e!=="object"||typeof e.id!=="string")return Promise.reject(Object.assign(Error("schedule needs a plan with an id"),{code:"INVALID_ARGUMENT"}));return te("schedule",(t)=>{let n=t&&typeof t==="object"?t:{},r={id:(typeof n.id==="string"?n.id:e.id).toLowerCase()};if(Array.isArray(n.droppedAlerts)&&n.droppedAlerts.length)r.droppedAlerts=n.droppedAlerts.filter((o)=>typeof o==="string");return r},e)},remove:(e)=>te("remove",(t)=>t===!0,e),removeAll:()=>te("removeAll",(e)=>typeof e==="number"&&Number.isFinite(e)?e:0)};function wt(){throw Object.assign(Error("Native passkeys are not available on this host"),{code:"CAPABILITY_DISABLED"})}var St={isAvailable:()=>v("passkeys.isAvailable",[],()=>!1),create:(e)=>v("passkeys.create",[e],wt),get:(e)=>v("passkeys.get",[e],wt)};function oo(e,t){let n=t.delay??500,r=t.tolerance??10,o=null,i=null,a=!1,s=()=>{if(o)clearTimeout(o);if(o=null,i&&!a)t.onPressEnd?.();i=null},l=(b)=>{let c=b;if(c.button!==void 0&&c.button!==0)return;a=!1,i={x:c.clientX,y:c.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},f=(b)=>{if(!i)return;let c=b;if(Math.hypot(c.clientX-i.x,c.clientY-i.y)>r)s()},u=(b)=>{if(!a)return;a=!1,b.preventDefault(),b.stopPropagation()},m=(b)=>b.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",f),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",u,!0),e.addEventListener("contextmenu",m),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",f),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",u,!0),e.removeEventListener("contextmenu",m)}}function pn(e,t,n){if(n<=1||t.width<=0)return 0;let r=Math.floor((e-t.left)/t.width*n);return Math.max(0,Math.min(n-1,r))}function io(e,t){let n=null,r=null,o=!1,i=0,a=(c)=>{let p=e.getBoundingClientRect();return pn(c,{left:p.left+2,width:p.width-4},t.count())},s=(c)=>{let p=c;if(p.button!==void 0&&p.button!==0)return;let g=a(p.clientX);if(g!==t.selected())return;n=g,i=g,o=!1,r=p.pointerId;try{e.setPointerCapture?.(p.pointerId)}catch{}t.onPress?.(!0)},l=(c)=>{if(n===null)return;let p=a(c.clientX);if(p===i)return;o=!0,i=p,t.onScrub(p)},f=(c)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),c&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},u=(c)=>{if(!o)return;o=!1,c.preventDefault(),c.stopPropagation()},m=()=>f(!0),b=()=>f(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",m),e.addEventListener("pointercancel",b),e.addEventListener("click",u,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",m),e.removeEventListener("pointercancel",b),e.removeEventListener("click",u,!0)}}function ao(e,t,n){if(n<=0)return null;switch(e){case"ArrowRight":case"ArrowDown":return(t+1)%n;case"ArrowLeft":case"ArrowUp":return(t-1+n)%n;case"Home":return 0;case"End":return n-1;default:return null}}function so(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function lo(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=M("haptics.prepare");if(o)Promise.resolve().then(()=>o("impact")).catch(()=>{})};return e.addEventListener("touchstart",t,{passive:!0,capture:!0}),()=>e.removeEventListener("touchstart",t,{capture:!0})}import{BugHQClient as fn}from"@bughq/sdk";import{crashReporter as ne}from"craft-native/mobile";var F=null;function mn(e){if(e.type!=="http")return!0;let t=e.data??{},n=typeof t.status==="number"?t.status:0;return t.error===!0||n>=400||n===0}function Rt(){return ne.isAvailable()}function gn(e){return async(t)=>{if(!Rt())return!e;return ne.capture(t)}}var mo={start(e={}){if(F)return F;let t=re()||Rt();if(!t&&!e.key&&!e.dsn)return null;let n=e.beforeBreadcrumb;return F=new fn({framework:"stacks-mobile",sdkName:"bughq.stacks.mobile",autoInstrument:{navigation:!0,fetch:!0,xhr:!0},...e,heartbeat:t?!1:e.heartbeat,transport:t?gn(Boolean(e.key||e.dsn)):void 0,beforeBreadcrumb(r){if(!mn(r))return null;let o=n?n(r):r;if(o===null)return null;let i=o||r;if(t)ne.addBreadcrumb(i);return i}}),F},async setUser(e){let t=e===null||e===void 0||e===""?null:String(e);F?.setUser(t===null?null:{id:t}),await ne.setUser(t)},capture(e,t){F?.captureException(e,t)},addBreadcrumb(e){if(F)F.addBreadcrumb(e);else ne.addBreadcrumb(e)},async flush(){await Promise.all([F?.flush(),ne.flush()])},client(){return F},stop(){F?.close(),F=null}};function He(e){let t=E();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function xt(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function At(){let e=E()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:xt(e?.getAttribute("data-craft-reduce-motion"))||He("(prefers-reduced-motion: reduce)"),reduceTransparency:xt(e?.getAttribute("data-craft-reduce-transparency"))||He("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||He("(prefers-color-scheme: dark)")?"dark":"light"}}function hn(e){let t=At(),n=Number(e?.fontScale);return{contentSizeCategory:typeof e?.contentSizeCategory==="string"?e.contentSizeCategory:void 0,fontScale:Number.isFinite(n)&&n>0?n:t.fontScale,reduceMotion:typeof e?.reduceMotion==="boolean"?e.reduceMotion:t.reduceMotion,reduceTransparency:typeof e?.reduceTransparency==="boolean"?e.reduceTransparency:t.reduceTransparency,colorScheme:e?.colorScheme==="dark"||e?.colorScheme==="light"?e.colorScheme:t.colorScheme}}function kt(e,t={}){if(t.immediate!==!1)e(At());return W("craftAppearance",(n)=>e(hn(n)))}function vo(e){return W("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function yo(e){return W("craftMemoryWarning",()=>e())}function Et(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>ae.complete(!0),()=>ae.complete(!1))}}function wo(e){let t=Et(e);return W("craftSilentPush",(n)=>t(n.payload??{}))}function So(e){let t=Et(()=>e());return W("craftBackgroundRefresh",()=>t(void 0))}import{haptics as bn}from"craft-native/mobile";function _e(){if(typeof window>"u")return;return window}function se(e=_e()){if(!e)return 0;if(typeof e.scrollY==="number")return e.scrollY;if(typeof e.scrollTop==="number")return e.scrollTop;return e.document?.scrollingElement?.scrollTop??0}function vn(e,t=_e()){if(!t)return()=>{};let n=!1,r=typeof requestAnimationFrame==="function"?requestAnimationFrame:(i)=>setTimeout(i,16),o=()=>{if(n)return;n=!0,r(()=>{n=!1,e(se(t))})};return e(se(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function yn(e,t){let n=Math.max(0,-e),r=e<=0?Math.max(0,t)*0.5:0;return Math.round(Math.max(n,r))}function Ao(e){let t=e.host??_e();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(g)=>setTimeout(g,16),s=null,l=(g)=>{s=null,e.onPull?.(g,o,{bounce:Math.min(g,Math.max(0,-se(t)))})},f=(g)=>{let w=s!==null;if(s=g,w)return;a(()=>{if(s!==null)l(s)})},u=(g)=>{let w=g.touches?.[0];return w?w.clientY:null},m=(g)=>{if(i||se(t)>0)return;r=u(g),o=!1},b=(g)=>{if(r===null)return;let w=u(g);if(w===null)return;let h=yn(se(t),w-r);if(!o&&h>=n)o=!0,Promise.resolve(bn.impact("medium")).catch(()=>{});else if(o&&h<n*0.8)o=!1;f(h)},c=async()=>{if(r===null)return;if(r=null,!o){l(0);return}o=!1,i=!0,l(n);try{await e.onRefresh()}finally{i=!1,l(0)}},p=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",b,{passive:!0}),t.addEventListener("touchend",c),t.addEventListener("touchcancel",p),()=>{s=null,t.removeEventListener("touchstart",m),t.removeEventListener("touchmove",b),t.removeEventListener("touchend",c),t.removeEventListener("touchcancel",p)}}function wn(e,t=52){let n=Math.max(1,t),r=Math.min(1,Math.max(0,e/n)),o=e<0?1+Math.min(0.1,-e/600):1;return{progress:Math.round(r*1000)/1000,stretch:Math.round(o*1000)/1000}}function ko(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return vn((o)=>{let i=wn(o,r()),a=`${i.progress}|${i.stretch}`;if(a===n)return;n=a,e.style.setProperty("--native-nav-progress",String(i.progress)),e.style.setProperty("--native-nav-stretch",String(i.stretch)),t.onChange?.(i)},t.host)}function Eo(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Ot(){if(typeof window>"u")return;return window}var Tt="__stxPushed",Sn="__stxScroll";function Rn(e=Ot()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(Tt in n)return n[Tt]===!0;return!(Sn in n)}function Po(e=Ot()){if(!Rn(e))return!1;return e.history.back(),!0}function Oo(e,t,n=50){let r=e[e.length-1];if(e.length>=2&&e[e.length-2].path===t)e.pop();else if(!r||r.path!==t)e.push({path:t,title:""});if(e.length>n)e.splice(0,e.length-n);return{current:e[e.length-1],previous:e[e.length-2]??null}}function Io(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function Mo(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function xn(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function Lo(){if(typeof window>"u")return;let e=window.stxRouter;if(typeof e?.screens!=="function")return;let t=e.screens(),n=t.find((o)=>o.active);if(!n)return;let r=t.filter((o)=>o.tab===n.tab&&o.depth<n.depth);if(!r.length)return null;return xn(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function Co(e=typeof window>"u"?void 0:window){let t=e?.stxRouter;if(typeof t?.screens!=="function"||typeof e?.history?.go!=="function")return!1;let n=t.screens(),r=n.find((a)=>a.active);if(!r)return!1;let o=n.filter((a)=>a.tab===r.tab&&a.depth<r.depth);if(!o.length)return!1;let i=o.reduce((a,s)=>s.depth<a.depth?s:a);return e.history.go(i.depth-r.depth),!0}function No(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function An(e,t=kn()){let n;try{n=new URL(e)}catch{return null}let r=`${n.search}${n.hash}`;if(n.protocol==="http:"||n.protocol==="https:"){if(!t||n.origin!==t)return null;return`${n.pathname||"/"}${r}`}return`${`/${[n.host,n.pathname.replace(/^\/+/,"")].filter(Boolean).join("/")}`}${r}`}function kn(){if(typeof window>"u")return;return window.location?.origin}var Pt="stacks-mobile-deep-link";function Do(e,t){let n=(r)=>{let o=An(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Pt)===r)return;sessionStorage.setItem(Pt,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var _o=5000;function En(e,t,n=5000){let r=t.filter((o)=>Number.isFinite(o.timestamp)&&Number.isFinite(o.bpm)&&o.bpm>0).slice().sort((o,i)=>o.timestamp-i.timestamp);if(!r.length)return e.slice();return e.map((o)=>{let i=0,a=r.length;while(i<a){let u=i+a>>1;if(r[u].timestamp<o.timestamp)i=u+1;else a=u}let s=r[i],l=r[i-1],f=!s?l:!l?s:o.timestamp-l.timestamp<=s.timestamp-o.timestamp?l:s;if(!f||Math.abs(f.timestamp-o.timestamp)>n)return o;return{...o,heartRate:Math.round(f.bpm)}})}var Tn=6371008.8,Be={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0},Pn=30,On=Pn;function In(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 2*Tn*Math.asin(Math.min(1,Math.sqrt(i)))}function Bo(e,t=25){let n=new Set;return e.filter((r)=>Number.isFinite(r.latitude)&&Number.isFinite(r.longitude)&&Number.isFinite(r.timestamp)&&Math.abs(r.latitude)<=90&&Math.abs(r.longitude)<=180&&Number.isFinite(r.accuracy)&&r.accuracy>=0&&r.accuracy<=t).sort((r,o)=>r.timestamp-o.timestamp).filter((r)=>{if(n.has(r.timestamp))return!1;return n.add(r.timestamp),!0})}function Mn(e,t){return Number.isFinite(e.latitude)&&Number.isFinite(e.longitude)&&Number.isFinite(e.timestamp)&&Math.abs(e.latitude)<=90&&Math.abs(e.longitude)<=180&&Number.isFinite(e.accuracy)&&e.accuracy>=0&&e.accuracy<=t}function ve(e={}){let t=e.maxAccuracyM??25,n=(e.paceWindowS??30)*1000,r=[],o=0,i=0,a=null,s=0,l=null,f=null,u={...Be};function m(c){let p=r[r.length-1],g=a?(c.timestamp-a.timestamp)/1000:0;if(a=c,s++,!p){r.push({fix:c,cumM:0});return}if(g>On){r.push({fix:c,cumM:o});return}let w=(c.timestamp-p.fix.timestamp)/1000,h=In(p.fix,c),P=Math.min(10,Math.max(3,p.fix.accuracy,c.accuracy));if(h<P)return;if(o+=h,w>0&&h/w>=0.5)i+=w;r.push({fix:c,cumM:o})}function b(){let c=r[r.length-1];if(c){let w=c.fix.timestamp-n,h=0;while(h<r.length-1&&r[h].fix.timestamp<w)h++;if(h)r=r.slice(h)}let p=null,g=null;if(c&&a.timestamp-c.fix.timestamp<=n){let w=r[0],h=c.cumM-w.cumM,P=(c.fix.timestamp-w.fix.timestamp)/1000;if(h>=20&&P>0)g=h/P,p=P/(h/1000)}return{distanceM:o,movingS:i,paceSPerKm:p,averagePaceSPerKm:o>=50&&i>0?i/(o/1000):null,speedMps:g,accuracyM:a?a.accuracy:f,fixes:s}}return{get stats(){return u},get latestTimestamp(){return l},add(c){if(c.length){let p=c[c.length-1];if(!a)f=p.accuracy??null;let g=a?a.timestamp:-1/0,w=c.filter((h)=>Mn(h,t)&&h.timestamp>g).sort((h,P)=>h.timestamp-P.timestamp);for(let h of w){if(a&&h.timestamp<=a.timestamp)continue;m(h)}for(let h of c)if(Number.isFinite(h.timestamp)&&(l===null||h.timestamp>l))l=h.timestamp}return u=b(),u}}}function Ln(e,t={}){return ve(t).add(e)}function Fo(e){if(e==null||e<=0||!Number.isFinite(e)||e>3600)return"–";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function Uo(e){return e!=null&&e>0&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var It=3600,Cn=30000;function Nn(e,t,n){if(!n||t<=It)return e;return Math.max(e,Math.min(Cn,Math.round(e*t/It)))}function Wo(e){let t=e.location,n=e.intervalMs??3000,r=Be,o=ve(e),i=!1,a=null,s=0,l=e.heartRate,f=!1,u=null,m=[],b=()=>typeof document<"u"&&document.visibilityState==="hidden",c=0,p=null,g=Promise.resolve(),w=null,h=!1,P=null;function O(){if(h)throw Object.assign(Error("The recording screen is no longer active"),{code:"RECORDING_CONFLICT"});if(t.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect native recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"})}function S(){if(O(),!P)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});return P}function R(y){let A=g.then(y);return g=A.then(()=>{},()=>{}),A}function k(){if(p)return p;let y=c,A=P,I=(async()=>{if(O(),!A)throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});let L=o,C=L.latestTimestamp,U=await t.readRecording(C===null?{expectedId:A}:{expectedId:A,since:C});if(y!==c||h||L!==o)return L.add(U);if(C!==null&&U.length&&U[0].timestamp<=C)i=!0;return r=L.add(U),e.onUpdate?.(r),r})().finally(()=>{if(p===I)p=null});return p=I,I}function x(){if(H(),h)return;let y=s,A=()=>{a=setTimeout(()=>{if(a=null,h||y!==s)return;(b()?Promise.resolve():k().then(()=>{},()=>{})).then(()=>{if(!h&&y===s)A()})},Nn(n,r.fixes,i))};A()}function H(){if(s++,a)clearTimeout(a);a=null}function G(y,A,I,L=ve(e)){if(H(),c++,p=null,o=L,i=!1,P=y,u=A,f=A!==null,m=[],r=I,!h)e.onUpdate?.(r)}async function me(y){if(!l||!f||!u||h||l.supportsRecordingOwnership?.()!==!0)return;await y(l,u).catch(()=>{})}return{get stats(){return r},get recordingId(){return P},get heartRateRecordingId(){return u},get heartRate(){return m},start(y){return w=null,R(async()=>{if(O(),y&&t.supportsRecordingIntentIdentity?.()!==!0)throw Object.assign(Error("This host cannot start a registered route identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(y&&(typeof y.recordingId!=="string"||!y.recordingId.trim()))throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"});let A=typeof e.locationOptions==="function"?e.locationOptions():e.locationOptions,I=await t.startRecording({enableHighAccuracy:!0,...A,...y?{recordingId:y.recordingId}:{}});if(!I?.active||typeof I.id!=="string"||!I.id.trim())throw Object.assign(Error("The native recording did not provide an ID"),{code:"RECORDING_CONFLICT"});if(y&&I.id!==y.recordingId)throw Object.assign(Error("The native route did not start with its registered ID"),{code:"RECORDING_CONFLICT"});let L=null;if(!h&&l?.isAvailable()&&l.supportsRecordingOwnership?.()===!0&&(!y||y.heartRateRecordingId&&l.supportsRecordingIntentIdentity?.()===!0))try{let C=await l.startRecording(y?{recordingId:y.heartRateRecordingId}:void 0);if(y&&C.id!==y.heartRateRecordingId)throw Object.assign(Error("The native heart rate did not start with its registered ID"),{code:"RECORDING_CONFLICT"});if(C.active&&typeof C.id==="string"&&C.id.trim())L=C.id}catch{}return G(I.id,L,{...Be}),x(),r})},attach(y){return w=null,R(async()=>{if(typeof y?.expectedId!=="string"||!y.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"});O();let A=await t.getRecordingState({expectedId:y.expectedId});if(O(),!A?.id)return null;if(A.id!==y.expectedId)throw Object.assign(Error("The recording belongs to another session"),{code:"RECORDING_CONFLICT"});let I=null;if(y.expectedHeartRateId!==void 0){let U=y.expectedHeartRateId;if(typeof U!=="string"||!U.trim())throw Object.assign(Error("A saved heart-rate recording ID is required"),{code:"RECORDING_CONFLICT"});if(!l?.isAvailable()||l.supportsRecordingOwnership?.()!==!0)throw Object.assign(Error("This host cannot protect heart-rate recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});let Yt=await l.getRecordingState({expectedId:U});if(O(),Yt.id!==U)throw Object.assign(Error("The heart-rate recording belongs to another session"),{code:"RECORDING_CONFLICT"});await l.readRecording({expectedId:U,since:Date.now()}),O(),I=U}let L=await t.readRecording({expectedId:y.expectedId});O();let C=ve(e);if(G(y.expectedId,I,C.add(L),C),A.active&&!A.paused)x();return A})},pause(){return R(async()=>{await t.pauseRecording({expectedId:S()}),await me((y,A)=>y.pauseRecording({expectedId:A})),H(),await k().catch(()=>{})})},resume(){return R(async()=>{await t.resumeRecording({expectedId:S()}),await me((y,A)=>y.resumeRecording({expectedId:A})),x()})},setPowerMode(y){return R(async()=>{if(h||w||!P||t.supportsRecordingPowerMode?.()!==!0)return!1;try{return await t.setRecordingPowerMode({expectedId:P,powerMode:y}),!0}catch(A){let I=A?.code;if(I==="NO_ACTIVE_RECORDING"||I==="RECORDING_POWER_MODE_UNSUPPORTED")return!1;throw A}})},stop(){if(w)return w;let y=R(async()=>{H(),c++;let A=S(),I=await t.stopRecording({expectedId:A});if(I.id!==A)throw Object.assign(Error("The native recording identity changed"),{code:"RECORDING_CONFLICT"});let L=I?.locations??[];if(!h&&l&&f&&u&&l.supportsRecordingOwnership?.()===!0){let C=await l.stopRecording({expectedId:u}).catch(()=>null);f=!1,m=C?.id===u?C.samples:[],L=En(L,m)}if(r=Ln(L,e),!h)e.onUpdate?.(r);return L}).catch((A)=>{if(w===y)w=null;throw A});return w=y,y},dispose(){h=!0,c++,p=null,H()},refresh:k}}function Ko(e){return{startedAt:Number.isFinite(e)?e:null,pausedAt:null,pausedMs:0}}function jo(e,t){return e.startedAt===null||e.pausedAt!==null||!Number.isFinite(t)?e:{...e,pausedAt:Math.max(e.startedAt,t)}}function zo(e,t){return e.pausedAt===null||!Number.isFinite(t)?e:{...e,pausedAt:null,pausedMs:e.pausedMs+Math.max(0,t-e.pausedAt)}}function qo(e,t){if(e.startedAt===null)return 0;let n=((e.pausedAt??t)-e.startedAt-e.pausedMs)/1000;return Number.isFinite(n)?Math.max(0,n):0}var Go=150;function Dn(e,t){let n=Math.PI/180,r=(t.latitude-e.latitude)*n,o=(t.longitude-e.longitude)*n,i=Math.sin(r/2)**2+Math.cos(e.latitude*n)*Math.cos(t.latitude*n)*Math.sin(o/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(i)))}function ye(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function Yo(e,t){let n=(e||[]).filter((a)=>Number.isFinite(a?.latitude)&&Number.isFinite(a?.longitude)&&Math.abs(a.latitude)<=90&&Math.abs(a.longitude)<=180),r=n.filter((a)=>a.accuracy!=null).map((a)=>Number(a.accuracy)).filter((a)=>Number.isFinite(a)&&a>=0),o=r.length?ye(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:ye(n.map((s)=>s.latitude),0.5),longitude:ye(n.map((s)=>s.longitude),0.5)};i=ye(n.map((s)=>Dn(a,s)),0.8)}if(n.length>=10&&i>150&&o<=15)return"outside";if(t<150)return"unsure";if(n.length<3||o>30||i<25)return"indoors";if(i<50&&o>10)return"indoors";return"unsure"}function Xo(e,t={}){let r=String(e||"").trim().toLowerCase().replace(",",".").match(/^(\d+(?:\.\d*)?|\.\d+)\s*(km|k|m|mi)?$/);if(!r)return null;let o=Number(r[1]),i=r[2]||t.defaultUnit||(o>100?"m":"km"),a=i==="m"?o/1000:i==="mi"?o*1.609344:o;return Number.isFinite(a)&&a>=0&&a<=2000?Math.round(a*1000)/1000:null}var Re=new Set,Mt=!1,we=null;function Hn(e){return e.isConnected&&e.getClientRects().length>0}function Lt(){return[...Re].find((e)=>Hn(e.element))}function Se(){let e=Lt(),t=Boolean(e);if(t===Mt)return;if(Mt=t,t)Y.enable(e?.tintColor?{tintColor:e.tintColor}:{});else Y.disable()}function _n(){let e=Lt();if(!e){Y.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>Y.end())}function Zo(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};Re.add(n);let r=e.ownerDocument?.defaultView;if(!we){let o=Y.onRefresh(_n),i=()=>Se();r?.addEventListener("stx:load",i),we=()=>{o(),r?.removeEventListener("stx:load",i)}}return Se(),r?.requestAnimationFrame?.(()=>Se()),()=>{if(Re.delete(n),Re.size===0)we?.(),we=null;Se()}}var ti=0.5;function Bn(e,t,n){let r=[];if(n.includes("large")||n.length===0)r.push({name:"large",y:0});if(n.includes("medium"))r.push({name:"medium",y:Math.max(0,Math.round(e-t*0.5))});return r.push({name:"dismiss",y:Math.max(1,e)}),r.sort((o,i)=>o.y-i.y)}function Fn(e){let{y:t,velocity:n,stops:r}=e,o=r.filter((s)=>s.name!=="dismiss"),i=r.find((s)=>s.name==="dismiss");if(o.length===0)return"dismiss";if(n>0.5)return(r.filter((l)=>l.y>t+1)[0]??i).name;if(n<-0.5){let s=o.filter((l)=>l.y<t-1);return(s[s.length-1]??o[0]).name}let a=o[o.length-1];if(t>a.y+(i.y-a.y)*0.5)return"dismiss";return o.reduce((s,l)=>Math.abs(l.y-t)<Math.abs(s.y-t)?l:s).name}function Un(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function ni(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Bn(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(u)=>{let m=u;if(m.button!==void 0&&m.button!==0)return;if(m.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let b=a().find((c)=>c.name===e.detent())?.y??0;n={y:m.clientY,base:b,pointerId:m.pointerId},o=b,r=[{y:b,t:m.timeStamp}],t.classList.add("is-dragging");try{u.currentTarget?.setPointerCapture?.(m.pointerId)}catch{}},l=(u)=>{if(!n)return;let m=u,b=n.base+m.clientY-n.y;o=b<0?-Un(-b):b,r.push({y:o,t:m.timeStamp});while(r.length>2&&m.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let c=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/c))))},f=(u)=>{if(!n)return;let m=u;n=null;let b=r[0],c=Math.max(1,m.timeStamp-b.t),p=(o-b.y)/c;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(Fn({y:o,velocity:p,stops:a()}))};for(let u of e.handles)u.addEventListener("pointerdown",s),u.addEventListener("pointermove",l),u.addEventListener("pointerup",f),u.addEventListener("pointercancel",f);return()=>{for(let u of e.handles)u.removeEventListener("pointerdown",s),u.removeEventListener("pointermove",l),u.removeEventListener("pointerup",f),u.removeEventListener("pointercancel",f)}}function ri(e){let t=e.ownerDocument;if(e.parentElement===t.body)return()=>{};let n=t.createComment("native-sheet");return e.parentNode?.insertBefore(n,e),t.body.appendChild(e),()=>{if(n.parentNode)n.parentNode.insertBefore(e,n);else e.remove();n.remove()}}var Fe=new WeakMap;function oi(e,t){let n=e.documentElement,r=Fe.get(e)??0;if(!t){let a=Math.max(0,r-1);if(Fe.set(e,a),a===0)n.removeAttribute("data-native-sheet-card");return}if(Fe.set(e,r+1),r>0)return;let o=e.defaultView,i=(o?.scrollY??0)+(o?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(i)}px`),n.setAttribute("data-native-sheet-card","")}function Wn(e,t){e.style.setProperty("--native-font-scale",String(t.fontScale)),e.toggleAttribute("data-native-reduce-motion",t.reduceMotion),e.toggleAttribute("data-native-reduce-transparency",t.reduceTransparency)}function $n(e){let t=e.replace(/\s+/g,"").toLowerCase();return!t||t==="transparent"||/^rgba\(\d+,\d+,\d+,0(\.0+)?\)$/.test(t)||/\/0(\.0+)?\)$/.test(t)}function Kn(e){let t=e.defaultView;if(!t?.getComputedStyle)return null;for(let n of[e.body,e.documentElement]){if(!n)continue;let r=t.getComputedStyle(n).backgroundColor;if(r&&!$n(r))return r}return null}function jn(e){if(e.documentElement.classList.contains("dark"))return!0;if(e.documentElement.classList.contains("light"))return!1;return Boolean(e.defaultView?.matchMedia?.("(prefers-color-scheme: dark)").matches)}function li(e,t={}){let n=t.root??e.documentElement;ie.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let u=Kn(e);if(u&&u!==r)r=u,ie.setUnderPageColor(u);let m=jn(e)?"light":"dark";if(m!==o)o=m,he.setStyle(m)},a=kt((u)=>{Wn(n,u),i()}),s=e.defaultView,l=typeof s?.MutationObserver==="function"?new s.MutationObserver(i):null;l?.observe(e.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme"]});let f=s?.matchMedia?.("(prefers-color-scheme: dark)");return f?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),f?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var ui=64;var zn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,qn=/^(?:0|[1-9]\d*)$/;function Nt(e){let t=[],n=[],r=e&&typeof e==="object"&&!Array.isArray(e)?e:{};for(let[o,i]of Object.entries(r)){let a=i&&typeof i==="object"?i:null;if(!a){n.push(`spotlight kind "${o}" is not an object`);continue}let{slots:s,route:l}=a,f=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!zn.test(o)||o.includes("-slot-")){n.push(`spotlight kind "${o}" is not a usable name: lowercase letters, digits and single dashes, and never "-slot-"`);continue}if(typeof s!=="number"||!Number.isInteger(s)||s<=0||s>64){n.push(`spotlight kind "${o}" needs slots between 1 and 64, not ${String(s)}`);continue}if(typeof l!=="string"||!l.startsWith("/")||!l.includes(":id")){n.push(`spotlight kind "${o}" needs a route starting with "/" and carrying ":id", not ${String(l)}`);continue}t.push({name:o,slots:s,route:l,noun:f})}return{kinds:t,problems:n}}function ce(e,t){return e.find((n)=>n.name===t)??null}function le(e,t,n){let r=ce(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function Vn(e,t){if(typeof t!=="string")return null;let n=t.lastIndexOf("-slot-");if(n<=0)return null;let r=t.slice(0,n),o=t.slice(n+6);if(!qn.test(o))return null;let i=Number(o);return le(e,r,i)===t?{kind:r,slot:i}:null}function Dt(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function di(e,t){let n=e&&typeof e==="object"?e:{};if(n.enabled===!1)return[];let o=[...(Array.isArray(n.activityTypes)?n.activityTypes.filter((i)=>typeof i==="string"&&i.trim().length>0):[]).map((i)=>i.trim()),...Dt(Nt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function Ht(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${ce(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function Gn(e,t,n,r,o=Date.now()){let i=ce(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((p)=>p.kind===n),s=Ht(e,n,r),l=a.find((p)=>p.itemId===r.id)??null,f=l?null:Jn(a,i.slots),u=l||f!==null?null:Zn(a),m=l?.slot??f??u?.slot;if(m===void 0||m===null)return null;let b={kind:n,slot:m,itemId:r.id,title:s,donatedAt:o},c=t.filter((p)=>p.kind!==n||p.slot!==m&&p.itemId!==r.id);return{entries:_t(e,[...c,b]),entry:b,evicted:u,changed:!l||l.title!==s}}function Yn(e,t,n){let r=e.find((o)=>o.kind===t&&o.itemId===n)??null;return{entries:r?e.filter((o)=>o!==r):[...e],removed:r}}function Xn(e,t,n){let r=Vn(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=ce(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function Qn(e,t){if(!Array.isArray(t))return[];let n=new Map,r=new Set;for(let o of t){if(!o||typeof o!=="object")continue;let i=o,{kind:a,slot:s,itemId:l,title:f,donatedAt:u}=i;if(typeof a!=="string"||typeof s!=="number"||le(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let m=`${a}-slot-${s}`,b=`${a}#${l}`;if(n.has(m)||r.has(b))continue;n.set(m,{kind:a,slot:s,itemId:l,title:typeof f==="string"&&f.trim()?f:Ht(e,a,{id:l}),donatedAt:typeof u==="number"&&Number.isFinite(u)&&u>0?u:0}),r.add(b)}return _t(e,[...n.values()])}function _t(e,t){let n=new Map(e.map((r,o)=>[r.name,o]));return[...t].sort((r,o)=>(n.get(r.kind)??0)-(n.get(o.kind)??0)||r.slot-o.slot)}function Jn(e,t){let n=new Set(e.map((r)=>r.slot));for(let r=0;r<t;r++)if(!n.has(r))return r;return null}function Zn(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function er(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var tr="stacks_spotlight_index",nr=3000;function pi(e){let t=e.onProblem??((S)=>console.warn(`[spotlight] ${S}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:Nt(e.kinds);for(let S of n.problems)t(S);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??tr,i=e.legacyStorageKeys??[],a=e.timeoutMs??nr,s=e.now??(()=>Date.now()),l=e.bridge??er,f=null;function u(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function m(){if(f)return f;f=[];let S=u();if(!S)return f;try{let R=[o,...i].map((k)=>S.getItem(k)).find((k)=>k);f=R?Qn(r,JSON.parse(R)):[]}catch{f=[]}return f}function b(S){f=S;let R=u();if(!R)return;try{R.setItem(o,JSON.stringify(S));for(let k of i)R.removeItem(k)}catch{}}async function c(S){if(!S)return null;let R;try{return await Promise.race([S,new Promise((k)=>{R=setTimeout(()=>k(null),a)})])}catch{return null}finally{if(R!==void 0)clearTimeout(R)}}let p=Promise.resolve();function g(S){let R=p.then(S,S);return p=R.catch(()=>{return}),R}async function w(S,R){let k=l()?.register;if(!k||r.length===0)return!1;return g(async()=>{let x=Gn(r,m(),S,R,s()),H=x&&le(r,S,x.entry.slot);if(!x||!H)return!1;if(!x.changed)return b(x.entries),!0;let G=await c(k(x.entry.title,H))!==null;if(G)b(x.entries);return G})}async function h(S,R){let k=l()?.remove;if(!k)return!1;return g(async()=>{let{entries:x,removed:H}=Yn(m(),S,R);if(!H)return!1;let G=le(r,S,H.slot),me=G?await c(k(G))!==null:!1;return b(x),me})}async function P(S,R){let k=ce(r,S)?.slots;if(!k||!l()?.register)return 0;let x=0;for(let H of[...R].slice(0,k).reverse())if(await w(S,H))x++;return x}async function O(){let S=l()?.remove;if(!S)return b([]),0;return g(async()=>{let R=0;for(let k of m()){let x=le(r,k.kind,k.slot);if(x&&await c(S(x))!==null)R++}return b([]),R})}return{kinds:r,index:w,sync:P,remove:h,clear:O,routeFor:(S)=>Xn(r,m(),S),entries:()=>m(),activityTypes:(S)=>Dt(r).map((R)=>`${S}.${R}`),reset:()=>{f=null}}}var Ct=["craftShortcut","craftSiriShortcut"];function fi(e,t){let n=(r)=>{let o=r.detail,i=typeof o==="string"?o:o&&typeof o==="object"?o.action??o.type:null,a=typeof i==="string"?e.routeFor(i):null;if(a)t(a)};if(typeof globalThis.addEventListener!=="function")return()=>{};for(let r of Ct)globalThis.addEventListener(r,n);return()=>{for(let r of Ct)globalThis.removeEventListener(r,n)}}import{tabBar as rr}from"craft-native/mobile";var or=rr;function ir(e){return Array.from(e.querySelectorAll("a[data-native-tab]")).map((t)=>({id:t.getAttribute("href")||"",title:t.getAttribute("data-native-tab")||t.getAttribute("aria-label")||"",symbol:t.getAttribute("data-native-tab-symbol")||"circle",badge:(t.querySelector(".native-tab-badge")?.textContent||"").trim(),current:t.hasAttribute("data-stx-nav-current")||t.classList.contains("is-active")})).filter((t)=>t.id&&t.title)}function ar(e){return{tabs:e.map(({id:n,title:r,symbol:o,badge:i})=>i?{id:n,title:r,symbol:o,badge:i}:{id:n,title:r,symbol:o}),selected:e.find((n)=>n.current)?.id}}function Ft(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function sr(){return typeof Ft()?.selectTab==="function"}function hi(e,t={}){let n=(r)=>{if(sr()||r.defaultPrevented)return;let o=r.target?.closest?.("a[data-native-tab]");if(!o||!e.contains(o))return;if(!o.hasAttribute("data-stx-nav-current")&&!o.classList.contains("is-active")&&o.getAttribute("aria-current")!=="page")return;r.preventDefault();let i=e.ownerDocument.defaultView;if(t.scrollToTop)t.scrollToTop();else i?.scrollTo?.({top:0,behavior:i.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"});i?.dispatchEvent(new CustomEvent("stx:tabreselect",{detail:{href:o.getAttribute("href")||""}}))};return e.addEventListener("click",n),()=>e.removeEventListener("click",n)}function Bt(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var Ue="stacks:tab-bar-cover";function bi(e,t){if(t)e.setAttribute("data-native-covers-tab-bar","");else e.removeAttribute("data-native-covers-tab-bar");e.ownerDocument?.defaultView?.dispatchEvent(new Event(Ue))}function vi(e,t={}){let n=t.api??or;if(!n.isAvailable())return null;let r=t.hidden??(()=>Boolean(e.ownerDocument?.querySelector("[data-native-hide-tab-bar], [data-native-covers-tab-bar]"))),o=typeof getComputedStyle==="function"?getComputedStyle(e):null,i=Bt(o?.getPropertyValue("--native-tab-active")||""),a=Bt(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:b,selected:c}=ar(ir(e)),p=JSON.stringify({tabs:b,selected:c});if(p===s)return;let g=s&&s!=="hidden"?JSON.parse(s):null;if(g&&c&&JSON.stringify(g.tabs)===JSON.stringify(b))n.select(c);else n.set(b,{selected:c,tint:i,tintDark:a});s=p},f=typeof MutationObserver==="function"?new MutationObserver(l):null;f?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let u=n.onSelect((b)=>{let c=Ft();if(c?.selectTab){c.selectTab(b);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((g)=>g.getAttribute("href")===b)?.click()}),m=()=>l();if(typeof window<"u")window.addEventListener("stx:load",m),window.addEventListener("stx:screen-shown",m),window.addEventListener(Ue,m);return l(),()=>{if(f?.disconnect(),u(),typeof window<"u")window.removeEventListener("stx:load",m),window.removeEventListener("stx:screen-shown",m),window.removeEventListener(Ue,m);n.hide()}}function lr(e={}){let t=e.maxSeconds??300,n=e.maxBytes??12582912;if(![t,n].every((g)=>Number.isSafeInteger(g)&&g>0)||t>300)throw TypeError("Invalid voice recording limits");let r={status:"idle",audio:null,error:null},o=new Set,i={},a=null,s=null,l=null,f,u=(g)=>{r=g;for(let w of o)w({...g})},m=()=>{clearTimeout(f),l?.getTracks().forEach((g)=>g.stop()),l=null};function b(){if(i={},a){let w=a;a=null,Promise.resolve(M("audioRecording.cancel")?.(w)).catch(()=>{})}let g=s;if(s=null,g&&g.state!=="inactive")g.stop();m(),u({status:"idle",audio:null,error:null})}async function c(){b();let g=i;u({status:"requesting",audio:null,error:null});try{let w=M("audioRecording.start");if(w){let x=globalThis.crypto.randomUUID();if(a=x,await w(x,{maxSeconds:t}),i!==g)return;f=setTimeout(()=>{if(i===g)p()},t*1000-250),u({status:"recording",audio:null,error:null});return}if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>"u")throw Error("Microphone recording is unavailable. Upload an audio recording instead.");let h=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1},video:!1});if(i!==g){h.getTracks().forEach((x)=>x.stop());return}l=h;let P=["audio/webm;codecs=opus","audio/mp4","audio/webm"].find((x)=>MediaRecorder.isTypeSupported(x)),O=new MediaRecorder(h,{...P?{mimeType:P}:{},audioBitsPerSecond:32000});s=O;let S=[],R=0,k=!1;O.ondataavailable=(x)=>{if(i!==g||!x.data.size)return;if(R+=x.data.size,R>n){if(k=!0,S.length=0,O.state!=="inactive")O.stop();m();return}if(!k)S.push(x.data)},O.onerror=()=>{if(i!==g)return;b(),u({status:"error",audio:null,error:"Recording failed. Please try again."})},O.onstop=()=>{if(i!==g)return;s=null,m();let x=new Blob(S,{type:O.mimeType||P||"audio/webm"});u(k||!x.size?{status:"error",audio:null,error:k?"The recording exceeds the upload limit.":"The recording was empty."}:{status:"ready",audio:x,error:null})},O.start(1000),f=setTimeout(()=>{if(i===g&&O.state!=="inactive")O.stop()},t*1000-250),u({status:"recording",audio:null,error:null})}catch(w){if(i!==g)return;b(),u({status:"error",audio:null,error:w instanceof Error?w.message:"Microphone permission was refused."})}}async function p(){if(!a){if(s&&s.state!=="inactive")s.stop();return}let g=i,w=a;clearTimeout(f);try{let h=await M("audioRecording.stop")?.(w);if(i!==g)return;if(!h?.path||!h.size||h.size>n||!Number.isFinite(h.durationSeconds)||h.durationSeconds<=0||h.durationSeconds>t+1)throw Error("The recording is empty or exceeds its limits.");u({status:"ready",audio:h,error:null})}catch(h){if(i!==g)return;b(),u({status:"error",audio:null,error:h instanceof Error?h.message:"Recording failed."})}}return{start:c,cancel:b,dispose(){b(),o.clear()},stop:p,supported:()=>Boolean(M("audioRecording.start"))||typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getUserMedia)&&typeof MediaRecorder<"u",snapshot:()=>({...r}),subscribe(g){return o.add(g),g({...r}),()=>{o.delete(g)}}}}function cr(e,t={},n="audio"){if(!n||Object.hasOwn(t,n))throw TypeError("Use a distinct recording field name");let r=new FormData;if(typeof Blob<"u"&&e instanceof Blob)r.append(n,e,"feedback");else{if(!e||!("path"in e)||typeof e.path!=="string"||!e.path||!M("audioRecording.stop"))throw TypeError("A native recording requires its native upload host");Reflect.apply(r.append,r,[n,e]);let o=r.get(n);if(!o||typeof o!=="object"||!("path"in o)||o.path!==e.path)throw TypeError("The upload host did not preserve the native recording file")}for(let[o,i]of Object.entries(t)){if(typeof i!=="string")throw TypeError("Upload fields must be strings");r.append(o,i)}return r}var fr={isAvailable:()=>d(()=>We.isAvailable()),getBiometricType:()=>d(()=>We.getBiometricType()),authenticate:(e)=>d(()=>We.authenticate(e))},mr={takePicture:(e)=>d(()=>Ae.takePicture(e)),pickImage:()=>d(()=>Ae.pickImage()),pickMultiple:(e)=>d(()=>Ae.pickMultiple(e)),isAvailable:()=>d(()=>Ae.isAvailable())},gr={getInfo:()=>d(()=>Z.getInfo()),getCapabilities:()=>d(()=>Z.getCapabilities()),isMobile:()=>Z.isMobile(),isIOS:()=>Z.isIOS(),isAndroid:()=>Z.isAndroid(),getLocale:()=>Z.getLocale(),getTimezone:()=>Z.getTimezone()},hr=dr;function z(){return V()?.capabilities.locationRecordingOwnership===!0&&D.supportsRecordingOwnership?.()===!0}function jt(){return z()&&V()?.capabilities.locationRecordingPowerMode===!0&&D.supportsRecordingPowerMode?.()===!0}function X(){return V()?.capabilities.heartRateRecordingOwnership===!0&&T.supportsRecordingOwnership?.()===!0}function zt(){return z()&&V()?.capabilities.locationRecordingIntentIdentity===!0&&D.supportsRecordingIntentIdentity?.()===!0}function qt(){return X()&&V()?.capabilities.heartRateRecordingIntentIdentity===!0&&T.supportsRecordingIntentIdentity?.()===!0}function Gt(e,t,n){return d(async()=>{let r=e&&Object.hasOwn(e,"recordingId");if(r){if(!t())throw Object.assign(Error("This host or adapter cannot start a registered recording identity"),{code:"RECORDING_INTENT_IDENTITY_UNSUPPORTED"});if(typeof e.recordingId!=="string"||!e.recordingId.trim())throw Object.assign(Error("A registered recording ID is required"),{code:"INVALID_ARGUMENT"})}let o=await n();if(r&&o.id!==e.recordingId)throw Object.assign(Error("The native recording identity changed at start"),{code:"RECORDING_CONFLICT"});return o})}function B(e,t,n){return d(()=>{if(e&&Object.hasOwn(e,"expectedId")){if(!t())throw Object.assign(Error("This host or adapter cannot protect recording ownership"),{code:"RECORDING_OWNERSHIP_UNSUPPORTED"});if(typeof e.expectedId!=="string"||!e.expectedId.trim())throw Object.assign(Error("A saved recording ID is required"),{code:"RECORDING_CONFLICT"})}return n()})}var br={supportsRecordingOwnership:z,supportsRecordingIntentIdentity:zt,supportsRecordingPowerMode:jt,setRecordingPowerMode:(e)=>d(()=>{if(!jt())throw Object.assign(Error("This host cannot change the recording power mode"),{code:"RECORDING_POWER_MODE_UNSUPPORTED"});return B(e,z,()=>D.setRecordingPowerMode(e))}),acknowledgeRecording:(e)=>B({expectedId:e?.expectedId},z,()=>D.acknowledgeRecording(e)),getCurrentPosition:(e)=>d(()=>D.getCurrentPosition(e)),watchPosition:(e,t)=>D.watchPosition(e,t),clearWatch:(e)=>D.clearWatch(e),startRecording:(e)=>Gt(e,zt,()=>D.startRecording(e)),pauseRecording:(e)=>B(e,z,()=>D.pauseRecording(e)),resumeRecording:(e)=>B(e,z,()=>D.resumeRecording(e)),stopRecording:(e)=>B(e,z,()=>D.stopRecording(e)),getRecordingState:(e)=>B(e,z,()=>D.getRecordingState(e)),readRecording:(e)=>B(e,z,()=>D.readRecording(e))},vr={show:(e)=>d(()=>de.show(e)),schedule:(e)=>d(()=>de.schedule(e)),cancel:(e)=>d(()=>de.cancel(e)),cancelAll:()=>d(()=>de.cancelAll()),setBadge:(e)=>d(()=>de.setBadge(e))},yr={check:(e)=>d(()=>pe.check(e)),request:(e)=>d(()=>pe.request(e)),checkMultiple:(e)=>d(()=>pe.checkMultiple(e)),requestMultiple:(e)=>d(()=>pe.requestMultiple(e)),openSettings:()=>d(()=>pe.openSettings())},wr={set:(e,t)=>d(()=>Ee.set(e,t)),get:(e)=>d(()=>Ee.get(e)),delete:(e)=>d(()=>Ee.delete(e)),clear:()=>d(()=>Ee.clear())},Sr={share:(e)=>d(()=>Kt.share(e)),isAvailable:()=>Kt.isAvailable()},Rr={request:()=>d(()=>ur.request())},Pe={impact:(e)=>Promise.resolve().then(()=>ke.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>ke.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>ke.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>ke.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=M("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function Vt(e){if(typeof e==="string")return e.trim()||null;if(!e||typeof e!=="object")return null;let t=e.url;return typeof t==="string"&&t.trim()?t:null}var xr={async getInitialURL(){if(!await ee())return null;return Vt(await Ut.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=Ut.onLink?.((o,i)=>{let a=Vt(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(Oe()?.craft)r();else ee().then(r);return()=>{n=!0,t?.()}}},Oi={isAvailable:()=>Te.isAvailable(),set:(e,t)=>Te.set(e,t),remove:(e)=>Te.remove(e),clear:()=>Te.clear()},Ar={enable:()=>d(()=>Wt.enable()),disable:()=>d(()=>Wt.disable())},kr={isAvailable:()=>xe.isAvailable(),get:()=>d(()=>xe.get()),set:(e)=>d(()=>xe.set(e)),restore:()=>d(()=>xe.restore())},Er={isAvailable:()=>j.isAvailable(),supports:(e)=>j.supports(e),getAuthorizationStatus:()=>d(()=>j.getAuthorizationStatus()),requestAuthorization:()=>d(()=>j.requestAuthorization()),getNowPlaying:()=>d(()=>j.getNowPlaying()),play:()=>d(()=>j.play()),pause:()=>d(()=>j.pause()),togglePlayPause:()=>d(()=>j.togglePlayPause()),skipToNext:()=>d(()=>j.skipToNext()),skipToPrevious:(e)=>d(()=>j.skipToPrevious(e)),onChange:(e)=>J(()=>j.onChange(e))},Tr={supportsRecordingOwnership:X,supportsRecordingIntentIdentity:qt,acknowledgeRecording:(e)=>B({expectedId:e?.expectedId},X,()=>T.acknowledgeRecording(e)),isAvailable:()=>T.isAvailable(),supports:(e)=>T.supports(e),getState:()=>d(()=>T.getState()),requestAuthorization:()=>d(()=>T.requestAuthorization()),scan:(e)=>d(()=>T.scan(e)),stopScan:()=>d(()=>T.stopScan()),getDevices:()=>d(()=>T.getDevices()),connect:(e)=>d(()=>T.connect(e)),reconnect:()=>d(()=>T.reconnect()),disconnect:(e)=>d(()=>T.disconnect(e)),startRecording:(e)=>Gt(e,qt,()=>T.startRecording(e)),pauseRecording:(e)=>B(e,X,()=>T.pauseRecording(e)),resumeRecording:(e)=>B(e,X,()=>T.resumeRecording(e)),stopRecording:(e)=>B(e,X,()=>T.stopRecording(e)),getRecordingState:(e)=>B(e,X,()=>T.getRecordingState(e)),readRecording:(e)=>B(e,X,()=>T.readRecording(e)),onReading:(e)=>J(()=>T.onReading(e)),onDevice:(e)=>J(()=>T.onDevice(e)),onState:(e)=>J(()=>T.onState(e))},Pr={isAvailable:()=>je.isAvailable(),speak:(e,t)=>d(()=>je.speak(e,t)),stop:()=>d(()=>je.stop())},Or={getStatus:()=>d(()=>$t.getStatus()),onChange:(e)=>J(()=>$t.onChange(e))},Ir={register:()=>d(()=>Ke.register()),onToken:(e)=>Ke.onToken(e),onNotification:(e)=>J(()=>Ke.onNotification(e))},Mr={requestAuthorization:(e,t)=>d(()=>ue.requestAuthorization(e,t)),getData:(e,t)=>d(()=>ue.getData(e,t)),saveWorkout:(e)=>d(()=>ue.saveWorkout(e)),getWorkouts:(e)=>d(()=>ue.getWorkouts(e)),getDailyStatistics:(e,t)=>d(()=>ue.getDailyStatistics(e,t)),getHeartRateSamples:(e)=>v("health.getHeartRateSamples",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),getSamples:(e,t)=>v("health.getSamples",[e,t??{}],()=>[]).then((n)=>Array.isArray(n)?n:[]),getSleepIntervals:(e)=>v("health.getSleepIntervals",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),saveMindfulSession:(e)=>v("health.saveMindfulSession",[e],()=>null).then((t)=>t??null),getMindfulSessions:(e)=>v("health.getMindfulSessions",[e??{}],()=>[]).then((t)=>Array.isArray(t)?t:[]),startHeartRateUpdates:(e)=>v("health.startHeartRateUpdates",[e??{}],()=>!1).then((t)=>t!==!1),stopHeartRateUpdates:()=>v("health.stopHeartRateUpdates",[],()=>!0).then(()=>!0),onHeartRate:(e)=>W("craftHealthHeartRate",(t)=>{if(Array.isArray(t.samples)&&t.samples.length)e(t.samples)}),supports:(e)=>M(`health.${e}`)!==null},Lr={start:(e)=>d(()=>$e.start(e)),update:(e)=>d(()=>$e.update(e)),end:()=>d(()=>$e.end())},Cr={send:(e)=>d(()=>fe.send(e)),updateContext:(e)=>d(()=>fe.updateContext(e)),isReachable:()=>d(()=>fe.isReachable()),onMessage:(e)=>fe.onMessage(e),onReachabilityChange:(e)=>fe.onReachabilityChange(e)},Ii=pr;function Oe(){return E()}function V(){let e=Oe()?.craft;if(!e||typeof e!=="object")return null;if(!("platform"in e)||e.platform!=="ios"&&e.platform!=="android")return null;let t="capabilities"in e?e.capabilities:void 0,n=t&&typeof t==="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).filter(([,r])=>typeof r==="boolean")):{};return{platform:e.platform,capabilities:n}}function ze(){return V()!==null}function Nr(e=2000){if(ze()||re())return Promise.resolve(!0);let t=Oe();if(!t||!(t.craft||t.webkit?.messageHandlers?.craft))return Promise.resolve(!1);return new Promise((n)=>{let r=()=>{clearTimeout(o),t.removeEventListener("craftReady",r),n(ze())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Dr(e){let t=Oe();if(!t)return()=>{};if(V()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!V())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Hr(e){await Pe.impact("light");try{let t=await e();return await Pe.notification("success"),t}catch(t){throw await Pe.notification("error"),t}}var Mi={get nativeBridge(){return V()},biometrics:fr,camera:mr,device:gr,haptics:Pe,lifecycle:hr,location:br,notifications:vr,permissions:yr,secureStorage:wr,storage:ht,crypto:bt,share:Sr,appReview:Rr,deepLinks:xr,keepAwake:Ar,brightness:kr,music:Er,heartRate:Tr,scheduledWorkouts:yt,passkeys:St,speech:Pr,network:Or,pushNotifications:Ir,health:Mr,liveActivities:Lr,watchConnectivity:Cr,dialog:oe,contextMenu:De,browser:ot,symbols:it,statusBar:he,chrome:ie,refresh:Y,background:ae,clipboard:at,db:st,files:lt,shortcuts:ct,widgets:ut,orientation:dt,auth:pt,storeKit:ft,isNativeMobile:ze,whenNative:Nr,onReady:Dr,withFeedback:Hr};export{_r as BRIDGE_WAIT_MS,_o as HEART_RATE_MATCH_MS,Go as INDOOR_CHECK_AFTER_S,ui as MAX_SPOTLIGHT_SLOTS_PER_KIND,It as ROUTE_FULL_READ_FIXES,Cn as ROUTE_FULL_READ_MAX_MS,Pn as ROUTE_GAP_S,ti as SHEET_FLICK_VELOCITY,Ue as TAB_BAR_COVER_EVENT,d as afterBridge,Rr as appReview,Wn as applyAppearance,En as attachHeartRate,pt as auth,Io as backLabelFor,ae as background,fr as biometrics,ge as bridgePending,kr as brightness,ot as browser,v as callNative,mr as camera,Rn as canGoBack,ie as chrome,at as clipboard,jr as confirmAction,De as contextMenu,bi as coverTabBar,E as craftHost,Q as craftRoot,mo as crashReporting,Wo as createRouteRecorder,ve as createRouteStats,pi as createSpotlightIndex,lr as createVoiceRecorder,bt as crypto,At as currentAppearance,st as db,An as deepLinkPath,xr as deepLinks,gr as device,oe as dialog,Oo as enterNavTrail,lt as files,In as fixDistance,so as focusSegment,Do as followDeepLinks,V as getNativeMobileBridge,Po as goBack,Co as goBackToTabRoot,hi as handleTabReselect,Pe as haptics,re as hasNativeMobileHost,Mr as health,Tr as heartRate,Yo as indoorVerdict,li as installNativeChrome,lo as installPressables,ze as isNativeMobile,Hn as isShown,Ar as keepAwake,mn as keepBreadcrumb,wn as largeTitleMetrics,hr as lifecycle,ri as liftToBody,Lr as liveActivities,br as location,vi as mirrorTabBar,Mi as mobile,Er as music,Jt as nativeFunction,M as nativeFunctionNow,ar as nativeTabs,Mo as navTrail,Or as network,hn as normalizeAppearance,Vt as normalizeDeepLinkURL,dn as normalizeScheduledWorkout,vr as notifications,ko as observeLargeTitle,oo as observeLongPress,Zo as observeNativeRefresh,vn as observePageScroll,Ao as observePullToRefresh,io as observeSegmentScrub,ni as observeSheetDrag,kt as onAppearance,So as onBackgroundRefresh,W as onCraftEvent,yo as onMemoryWarning,Dr as onMobileReady,vo as onResume,wo as onSilentPush,fi as onSpotlightTap,dt as orientation,Fo as paceLabel,Kn as pageBackground,jn as pageIsDark,se as pageScrollTop,St as passkeys,jo as pauseSessionClock,yr as permissions,rn as placeMenu,Gn as placeSpotlightItem,Je as presentActionSheet,Xe as presentAlert,Ie as presentChoice,Qe as presentConfirm,Ze as presentContextMenu,oi as presentPageAsCard,Lo as previousScreenPath,yn as pullDistance,Ir as pushNotifications,Qn as readSpotlightEntries,Nt as readSpotlightKinds,ir as readTabLinks,Y as refresh,Yn as removeSpotlightItem,Eo as resolveScrollHost,zo as resumeSessionClock,Nn as routeReadInterval,Ln as routeStats,sr as routerHandlesTabs,Un as rubberBand,yt as scheduledWorkouts,un as scheduledWorkoutsUnsupported,wr as secureStorage,pn as segmentAt,ao as segmentForKey,qo as sessionClockElapsed,Fn as settleSheet,Sr as share,Bn as sheetStops,ct as shortcuts,zr as showContextMenuFor,Oi as snapshots,Pr as speech,Uo as speedLabel,Ii as splash,le as spotlightAction,Dt as spotlightActions,di as spotlightActivityTypes,er as spotlightBridge,ce as spotlightKind,Xn as spotlightRoute,Vn as spotlightSlot,Ht as spotlightTitle,Ko as startSessionClock,he as statusBar,ht as storage,ft as storeKit,J as subscribeWhenReady,it as symbols,or as tabBar,Ne as toNativeRect,No as trailEntryFor,Xo as typedDistanceKm,Bo as usableFixes,Kr as useActionSheet,cr as voiceRecordingFormData,Cr as watchConnectivity,ee as whenBridgeReady,Nr as whenNativeMobile,ut as widgets,Hr as withNativeFeedback};
@@ -0,0 +1,24 @@
1
+ declare function unavailable(): never;
2
+ /** The native system sheet returns JSON credentials for server verification. */
3
+ export declare const passkeys: PasskeysApi;
4
+ /** JSON WebAuthn options as supplied by the relying party's server. */
5
+ export declare interface NativePasskeyOptions {
6
+ challenge: string
7
+ rpId?: string
8
+ rp?: { id?: string, name?: string }
9
+ user?: { id: string, name: string, displayName?: string }
10
+ [option: string]: unknown
11
+ }
12
+ export declare interface NativePasskeyCredential {
13
+ id: string
14
+ rawId: string
15
+ type: 'public-key'
16
+ response: Record<string, string>
17
+ clientExtensionResults?: Record<string, unknown>
18
+ authenticatorAttachment?: string
19
+ }
20
+ export declare interface PasskeysApi {
21
+ isAvailable: () => Promise<boolean>
22
+ create: (options: NativePasskeyOptions) => Promise<NativePasskeyCredential>
23
+ get: (options: NativePasskeyOptions) => Promise<NativePasskeyCredential>
24
+ }
package/dist/types.d.ts CHANGED
@@ -83,6 +83,7 @@ export declare interface MobileApi {
83
83
  music: MusicApi
84
84
  heartRate: HeartRateApi
85
85
  scheduledWorkouts: import('./scheduled-workouts').ScheduledWorkoutsApi
86
+ passkeys: import('./passkeys').PasskeysApi
86
87
  speech: SpeechApi
87
88
  network: NetworkApi
88
89
  pushNotifications: PushNotificationsApi
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/mobile",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.473",
5
+ "version": "0.75.477",
6
6
  "description": "Craft-powered native mobile runtime for Stacks and STX applications",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@bughq/sdk": "^0.3.0",
42
- "@stacksjs/types": "0.75.473",
42
+ "@stacksjs/types": "0.75.477",
43
43
  "craft-native": ">=0.0.443"
44
44
  },
45
45
  "devDependencies": {
46
- "@stacksjs/build": "0.75.473",
46
+ "@stacksjs/build": "0.75.477",
47
47
  "better-dx": "^0.2.24"
48
48
  }
49
49
  }