@stacksjs/mobile 0.75.98 → 0.75.99

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
@@ -349,6 +349,17 @@ declare function enterNavTrail(trail: NavTrailEntry[], path: string, limit?: num
349
349
  declare function backLabelFor(previous: NavTrailEntry | null, fallback: string, max?: number): string;
350
350
  /** The trail for this window: it outlives each screen, not a full reload. */
351
351
  declare function navTrail(): NavTrailEntry[];
352
+ /**
353
+ * The path a back from the screen on show returns to, in its own tab's stack.
354
+ *
355
+ * The trail is one list for the window, but the stx router keeps a stack per
356
+ * tab, so a screen opened in Calendar after a visit to Today goes back to
357
+ * Calendar, not to whatever was entered last. Answers null at a tab's root,
358
+ * and undefined when there is no router that keeps tabs to ask.
359
+ */
360
+ declare function previousScreenPath(): string | null | undefined;
361
+ /** The latest trail entry for `path`, which carries that screen's name. */
362
+ declare function trailEntryFor(trail: NavTrailEntry[], path: string): NavTrailEntry | null;
352
363
  /**
353
364
  * The in-app path a deep link opens, or null when it is not this app's.
354
365
  *
@@ -1087,6 +1098,8 @@ declare function routerHandlesTabs(): boolean;
1087
1098
  * and stands aside wherever the router has them.
1088
1099
  */
1089
1100
  declare function handleTabReselect(nav: HTMLElement, options?: TabReselectOptions): () => void;
1101
+ /** Marks `element` as covering the tab bar, or no longer, and says so. */
1102
+ declare function coverTabBar(element: Element, covering: boolean): void;
1090
1103
  /**
1091
1104
  * Mirror `nav`'s tabs into the native tab bar, for as long as the returned
1092
1105
  * function is not called. Answers null when there is no native bar, and the
@@ -1094,6 +1107,12 @@ declare function handleTabReselect(nav: HTMLElement, options?: TabReselectOption
1094
1107
  */
1095
1108
  declare function mirrorTabBar(nav: HTMLElement, options?: MirrorTabBarOptions): (() => void) | null;
1096
1109
  declare const tabBar: TabBarApi;
1110
+ /**
1111
+ * What an open sheet raises when it starts or stops covering the tab bar. A
1112
+ * sheet on iOS slides up over the tab bar; the native bar is drawn above the
1113
+ * page, so while one is up the bar steps aside instead.
1114
+ */
1115
+ declare const TAB_BAR_COVER_EVENT: 'stacks:tab-bar-cover';
1097
1116
  declare interface TabBarApi {
1098
1117
  isAvailable: () => boolean
1099
1118
  set: (tabs: NativeTab[], options?: { selected?: string, tint?: string, tintDark?: string }) => boolean
@@ -1513,6 +1532,6 @@ type HealthWorkoutActivity = | 'running' | 'cycling' | 'walking' | 'hiking' | 's
1513
1532
  | 'stairClimbing' | 'yoga' | 'pilates' | 'strength' | 'hiit' | 'crossTraining'
1514
1533
  | 'crossCountrySkiing' | 'skiing' | 'paddling' | 'climbing' | 'dance' | 'mobility' | 'other';
1515
1534
 
1516
- export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, keepAwake, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, currentAppearance, normalizeAppearance, onAppearance, onResume, onMemoryWarning, onSilentPush, onBackgroundRefresh, NativeAppearance, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, largeTitleMetrics, observeLargeTitle, resolveScrollHost, ScrollHost, PullToRefreshOptions, LargeTitleMetrics, LargeTitleOptions, canGoBack, goBack, enterNavTrail, backLabelFor, navTrail, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, 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, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, lockBackground, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, trapFocus, 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, mirrorTabBar, tabBar, TabBarApi, TabLink, TabReselectOptions, MirrorTabBarOptions, CraftMobileCapabilities, CraftMobileBridge, CraftReadyEvent, MobileApi, DeviceInfo, DeviceCapabilities, CameraOptions, PhotoResult, Location, LocationOptions, LocationRecordingState, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, SecureStorageApi, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, SpeechOptions, SpeechApi, DeepLinksApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, HealthDataType, HealthDailyType, HealthWorkoutType, HealthWorkoutActivity };
1535
+ export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, whenNativeMobile, onMobileReady, withNativeFeedback, biometrics, camera, device, lifecycle, location, notifications, permissions, secureStorage, share, appReview, haptics, deepLinks, keepAwake, speech, network, pushNotifications, health, liveActivities, watchConnectivity, splash, mobile, craftHost, craftRoot, hasNativeMobileHost, bridgePending, whenBridgeReady, nativeFunctionNow, nativeFunction, callNative, afterBridge, subscribeWhenReady, onCraftEvent, BRIDGE_WAIT_MS, CraftHost, CallNativeOptions, observeLongPress, segmentAt, observeSegmentScrub, segmentForKey, focusSegment, installPressables, LongPressOptions, SegmentScrubOptions, 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, trailEntryFor, deepLinkPath, followDeepLinks, HistoryHost, NavTrailEntry, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, 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, AuthApi, StoreProduct, StoreTransaction, StoreKitApi, StatusBarStyle, OrientationLock, ActionSheetOptions, AlertOptions, ChoiceOptions, ConfirmOptions, ContextMenuItem, ContextMenuOptions, DialogAction, DialogActionStyle, NativeRect, isShown, observeNativeRefresh, NativeRefreshOptions, sheetStops, settleSheet, rubberBand, observeSheetDrag, lockBackground, liftToBody, presentPageAsCard, SHEET_FLICK_VELOCITY, SheetStop, SheetDragOptions, SheetDetent, SheetSettle, trapFocus, 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, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, SecureStorageApi, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, SpeechOptions, SpeechApi, DeepLinksApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HapticKind, HealthDataType, HealthDailyType, HealthWorkoutType, HealthWorkoutActivity };
1517
1536
  export { NativeTab } from 'craft-native/mobile';
1518
1537
  export { NativeTabBarOptions } from 'craft-native/mobile';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{appReview as mn,biometrics as he,camera as Q,deepLinks as lt,device as O,haptics as Z,health as U,keepAwake as ct,lifecycle as gn,liveActivities as be,location as P,network as ut,notifications as ee,permissions as W,pushNotifications as ve,secureStorage as te,share as dt,speech as ye,splash as hn,watchConnectivity as Y}from"craft-native/mobile";var Bn=2500;function x(){if(typeof window>"u")return;return window}function ht(){let e=x()?.craft;return e&&typeof e==="object"?e:void 0}function bt(){return typeof navigator>"u"?"":navigator.userAgent||""}function ie(){let e=x();if(!e)return!1;if(e.CraftAndroid)return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(bt())}function j(){let e=x();if(!e||e.craft)return!1;return ie()||Boolean(e.webkit?.messageHandlers?.craft)}function I(e=15000){let t=x();if(t?.craft)return Promise.resolve(!0);if(!t||!j())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 vt(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 T(e){return vt(ht(),e)}async function yt(e,t=2500){let n=T(e);if(n||!j())return n;return await I(t),T(e)}async function b(e,t,n,r={}){let o=await yt(e,r.timeoutMs);if(!o)return n();try{return await o(...t)}catch(i){if(r.fallbackOnError)return n();throw i}}async function g(e,t=2500){if(j())await I(t);return e()}function ae(e,t=2500){let n,r=!1;if(!j())n=e();else I(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function R(e,t){let n=x();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var Se="native-dialog-styles",xt=`
1
+ import{appReview as hn,biometrics as be,camera as Q,deepLinks as ct,device as O,haptics as Z,health as U,keepAwake as ut,lifecycle as bn,liveActivities as ve,location as P,network as dt,notifications as ee,permissions as W,pushNotifications as ye,secureStorage as te,share as pt,speech as xe,splash as vn,watchConnectivity as Y}from"craft-native/mobile";var Kn=2500;function x(){if(typeof window>"u")return;return window}function bt(){let e=x()?.craft;return e&&typeof e==="object"?e:void 0}function vt(){return typeof navigator>"u"?"":navigator.userAgent||""}function ie(){let e=x();if(!e)return!1;if(e.CraftAndroid)return!0;return Boolean(e.webkit?.messageHandlers?.craft)&&/iPhone|iPad|iPod/.test(vt())}function j(){let e=x();if(!e||e.craft)return!1;return ie()||Boolean(e.webkit?.messageHandlers?.craft)}function I(e=15000){let t=x();if(t?.craft)return Promise.resolve(!0);if(!t||!j())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 T(e){return yt(bt(),e)}async function xt(e,t=2500){let n=T(e);if(n||!j())return n;return await I(t),T(e)}async function b(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 g(e,t=2500){if(j())await I(t);return e()}function ae(e,t=2500){let n,r=!1;if(!j())n=e();else I(t).then(()=>{if(!r)n=e()});return()=>{if(r=!0,typeof n==="function")n()}}function R(e,t){let n=x();if(!n)return()=>{};let r=(o)=>t(o.detail??{});return n.addEventListener(e,r),()=>n.removeEventListener(e,r)}var we="native-dialog-styles",St=`
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 mn,biometrics as he,camera as Q,deepLinks as lt,device as O,
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 we(){return x()?.document}function St(e){if(e.getElementById(Se))return;let t=e.createElement("style");t.id=Se,t.textContent=xt,(e.head??e.documentElement).appendChild(t)}var wt=0;function w(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}var ke='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function kt(e,t){if(t.key!=="Tab")return;let n=Array.from(e.querySelectorAll(ke));if(n.length===0){t.preventDefault();return}let r=n[0],o=n[n.length-1],i=e.ownerDocument.activeElement;if(t.shiftKey&&(i===r||!e.contains(i)))t.preventDefault(),o.focus();else if(!t.shiftKey&&(i===o||!e.contains(i)))t.preventDefault(),r.focus()}function Ae(e,t,n,r){St(e);let o=x(),i=e.activeElement,a=w(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(w(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,d=(h)=>{if(l)return;l=!0,a.classList.remove("is-open"),e.removeEventListener("keydown",p,!0),setTimeout(()=>{if(a.remove(),i&&typeof i.focus==="function")i.focus()},260),s(h)},p=(h)=>{if(h.key==="Escape"){h.preventDefault(),d(r());return}kt(c,h)},c=n({root:a,settle:d});a.appendChild(c),e.body.appendChild(a),e.addEventListener("keydown",p,!0);let m=o;(typeof m?.requestAnimationFrame==="function"?(h)=>m.requestAnimationFrame(()=>m.requestAnimationFrame(h)):(h)=>setTimeout(h,16))(()=>{if(!l)a.classList.add("is-open")}),(c.querySelector("[data-native-autofocus]")??c.querySelector(ke))?.focus()})}function se(e){let t=we();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++wt}`,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 Ae(t,e.variant,({root:a,settle:s})=>{let l=(u)=>u.style==="cancel"?null:u.id,d=w(t,"div","native-dialog-panel");d.setAttribute("role","alertdialog"),d.setAttribute("aria-modal","true"),d.tabIndex=-1;let p=w(t,"div","native-dialog-group");if(e.title||e.message){let u=w(t,"div","native-dialog-header");if(e.title){let f=w(t,"p","native-dialog-title",e.title);f.id=`${n}-title`,u.appendChild(f),d.setAttribute("aria-labelledby",f.id)}if(e.message){let f=w(t,"p","native-dialog-message",e.message);f.id=`${n}-message`,u.appendChild(f),d.setAttribute("aria-describedby",f.id)}p.appendChild(u)}let c=w(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)c.classList.add("is-row");for(let u of o){let f=w(t,"button",`native-dialog-action${u.style==="destructive"?" is-destructive":""}${u.style==="cancel"?" is-cancel":""}`,u.title);f.type="button",f.setAttribute("data-action-id",u.id),f.addEventListener("click",()=>s(l(u))),c.appendChild(f)}if(p.appendChild(c),d.appendChild(p),i){let u=w(t,"div","native-dialog-group"),f=w(t,"button","native-dialog-action is-cancel",i.title);f.type="button",f.setAttribute("data-action-id",i.id),f.addEventListener("click",()=>s(null)),u.appendChild(f),d.appendChild(u)}let m=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")m?.addEventListener("click",()=>s(null));return d},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Ee(e){await se({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Te(e){return await se({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 Le(e){return se({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function At(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,d=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,p=e.x+e.width/2>n.width/2?"right":"left";return{top:d,left:i,origin:`${s||l<12?"top":"bottom"} ${p}`}}function Re(e){let t=we();if(!t?.body)return Promise.resolve(null);let n=x();return Ae(t,"menu",({root:r,settle:o})=>{let i=w(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(w(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=w(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(w(t,"span","native-menu-label",a.title)),a.icon){let l=w(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=At(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 Oe=()=>!0,E=()=>!1,L=()=>null;function Pe(){return x()?.navigator??(typeof navigator>"u"?void 0:navigator)}function de(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 _={alert:(e)=>b("dialog.alert",[e],()=>Ee(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>b("dialog.confirm",[e],()=>Te(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?de(e.anchor):void 0},n=await b("dialog.actionSheet",[t],()=>Le(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function Wn(){return(e)=>_.actionSheet(e)}async function Yn(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return _.confirm(e);return await _.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 pe={show:async(e)=>{let t={title:e.title,anchor:de(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 b("contextMenu.show",[t],()=>Re(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function jn(e,t){return pe.show({...t,anchor:de(e.getBoundingClientRect())})}function Et(e,t){let n=x();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 Ie={open:async(e,t={})=>{let n=await b("browser.open",[e,t],()=>Et(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)}}},le=new Map,ce=new Map;function Me(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var Ne={isAvailable:()=>T("symbols.image")!==null,image:(e,t={})=>{let n=Me(e,t),r=le.get(n);if(r)return r;let o=b("symbols.image",[e,t],L).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,L).then((i)=>(ce.set(n,i),i));return le.set(n,o),o},cached:(e,t={})=>ce.get(Me(e,t)),clearCache:()=>{le.clear(),ce.clear()}},z={setStyle:(e)=>b("statusBar.setStyle",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},D={setUnderPageColor:(e)=>b("chrome.setUnderPageColor",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>b("chrome.setKeyboardAccessory",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},M={isAvailable:()=>T("refresh.enable")!==null,enable:(e)=>b("refresh.enable",[e??{}],E,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>b("refresh.disable",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>b("refresh.end",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>R("craftRefresh",()=>e())},B={complete:(e)=>b("background.complete",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},He={write:(e)=>b("clipboard.write",[e],async()=>{let t=Pe()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(Oe,E)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>b("clipboard.read",[],async()=>{let e=Pe()?.clipboard;if(!e?.readText)return null;return e.readText().catch(L)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},_e={isAvailable:()=>T("db.query")!==null,query:(e,t=[])=>b("db.query",[e,t],L).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>b("db.execute",[e,t],L).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 ue(e,t){let n=x()?.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 Tt(e){let t=x()?.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 De={openPDF:(e,t=0)=>b("openPDF",[e,t],()=>{let n=x();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>b("takeScreenshot",[],L,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>b("scanQRCode",[],L).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},L),pickFile:(e=[])=>b("pickFile",[e],()=>Tt(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}},L),saveFile:(e,t,n)=>b("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return ue(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=ue(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>b("downloadFile",[e,t],()=>ue(e,t)).then((n)=>typeof n==="string"?n:null)},Be={set:(e)=>b("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],E).then((t)=>t!==!1),clear:()=>b("shortcuts.clear",[],E).then((e)=>e!==!1),onShortcut:(e)=>R("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},Fe={update:(e)=>b("widget.update",[e],E).then((t)=>t!==!1),reload:()=>b("widget.reload",[],E).then((e)=>e!==!1)},Lt={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function Ce(){return x()?.screen?.orientation}var Ke={lock:(e)=>b("lockOrientation",[e],()=>{let t=Ce();return t?.lock?t.lock(Lt[e]).then(Oe,E):!1}).then((t)=>t!==!1),unlock:()=>b("unlockOrientation",[],()=>(Ce()?.unlock?.(),!0)).then((e)=>e!==!1)},$e={signInWithApple:()=>b("signInWithApple",[],L).then((e)=>{if(!e||typeof e!=="object"||typeof e.userId!=="string")return null;return e})},qe={isAvailable:()=>T("iap.purchase")!==null,products:(e)=>b("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>b("iap.purchase",[e],L).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>b("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};function Vn(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=(m)=>{let u=m;if(u.button!==void 0&&u.button!==0)return;a=!1,i={x:u.clientX,y:u.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},d=(m)=>{if(!i)return;let u=m;if(Math.hypot(u.clientX-i.x,u.clientY-i.y)>r)s()},p=(m)=>{if(!a)return;a=!1,m.preventDefault(),m.stopPropagation()},c=(m)=>m.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",d),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",p,!0),e.addEventListener("contextmenu",c),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",p,!0),e.removeEventListener("contextmenu",c)}}function Rt(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 Xn(e,t){let n=null,r=null,o=!1,i=0,a=(u)=>{let f=e.getBoundingClientRect();return Rt(u,{left:f.left+2,width:f.width-4},t.count())},s=(u)=>{let f=u;if(f.button!==void 0&&f.button!==0)return;let h=a(f.clientX);if(h!==t.selected())return;n=h,i=h,o=!1,r=f.pointerId;try{e.setPointerCapture?.(f.pointerId)}catch{}t.onPress?.(!0)},l=(u)=>{if(n===null)return;let f=a(u.clientX);if(f===i)return;o=!0,i=f,t.onScrub(f)},d=(u)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),u&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},p=(u)=>{if(!o)return;o=!1,u.preventDefault(),u.stopPropagation()},c=()=>d(!0),m=()=>d(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",m),e.addEventListener("click",p,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",m),e.removeEventListener("click",p,!0)}}function Jn(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 Qn(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function Zn(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=T("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})}function fe(e){let t=x();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function Ue(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function We(){let e=x()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:Ue(e?.getAttribute("data-craft-reduce-motion"))||fe("(prefers-reduced-motion: reduce)"),reduceTransparency:Ue(e?.getAttribute("data-craft-reduce-transparency"))||fe("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||fe("(prefers-color-scheme: dark)")?"dark":"light"}}function Pt(e){let t=We(),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 Ye(e,t={}){if(t.immediate!==!1)e(We());return R("craftAppearance",(n)=>e(Pt(n)))}function rr(e){return R("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function or(e){return R("craftMemoryWarning",()=>e())}function je(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>B.complete(!0),()=>B.complete(!1))}}function ir(e){let t=je(e);return R("craftSilentPush",(n)=>t(n.payload??{}))}function ar(e){let t=je(()=>e());return R("craftBackgroundRefresh",()=>t(void 0))}import{haptics as Mt}from"craft-native/mobile";function me(){if(typeof window>"u")return;return window}function F(e=me()){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 Ct(e,t=me()){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(F(t))})};return e(F(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function Ot(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 cr(e){let t=e.host??me();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(h)=>setTimeout(h,16),s=null,l=(h)=>{s=null,e.onPull?.(h,o,{bounce:Math.min(h,Math.max(0,-F(t)))})},d=(h)=>{let A=s!==null;if(s=h,A)return;a(()=>{if(s!==null)l(s)})},p=(h)=>{let A=h.touches?.[0];return A?A.clientY:null},c=(h)=>{if(i||F(t)>0)return;r=p(h),o=!1},m=(h)=>{if(r===null)return;let A=p(h);if(A===null)return;let N=Ot(F(t),A-r);if(!o&&N>=n)o=!0,Promise.resolve(Mt.impact("medium")).catch(()=>{});else if(o&&N<n*0.8)o=!1;d(N)},u=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)}},f=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("touchmove",m,{passive:!0}),t.addEventListener("touchend",u),t.addEventListener("touchcancel",f),()=>{s=null,t.removeEventListener("touchstart",c),t.removeEventListener("touchmove",m),t.removeEventListener("touchend",u),t.removeEventListener("touchcancel",f)}}function It(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 ur(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return Ct((o)=>{let i=It(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 dr(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Ve(){if(typeof window>"u")return;return window}var ze="__stxPushed",Nt="__stxScroll";function Ht(e=Ve()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(ze in n)return n[ze]===!0;return!(Nt in n)}function fr(e=Ve()){if(!Ht(e))return!1;return e.history.back(),!0}function mr(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 gr(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function hr(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function _t(e,t=Dt()){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 Dt(){if(typeof window>"u")return;return window.location?.origin}var Ge="stacks-mobile-deep-link";function br(e,t){let n=(r)=>{let o=_t(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Ge)===r)return;sessionStorage.setItem(Ge,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var yr=30;function Bt(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 Ft(e,t=25){let n=new Set;return e.filter((r)=>Number.isFinite(r.latitude)&&Number.isFinite(r.longitude)&&Number.isFinite(r.timestamp)&&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 Xe(e,t={}){let n=Ft(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let c of n){let m=o[o.length-1],u=s?(c.timestamp-s.timestamp)/1000:0;if(s=c,!m){o.push({fix:c,cumM:0});continue}if(u>30){o.push({fix:c,cumM:i});continue}let f=(c.timestamp-m.fix.timestamp)/1000,h=Bt(m.fix,c),A=Math.min(10,Math.max(3,m.fix.accuracy,c.accuracy));if(h<A)continue;if(i+=h,f>0&&h/f>=0.5)a+=f;o.push({fix:c,cumM:i})}let l=o[o.length-1],d=null,p=null;if(l){let c=l.fix.timestamp-r*1000,m=o.find((h)=>h.fix.timestamp>=c)??l,u=l.cumM-m.cumM,f=(l.fix.timestamp-m.fix.timestamp)/1000;if(u>=20&&f>0)p=u/f,d=f/(u/1000)}return{distanceM:i,movingS:a,paceSPerKm:d,averagePaceSPerKm:i>=50&&a>0?a/(i/1000):null,speedMps:p,accuracyM:n.length?n[n.length-1].accuracy:e.length?e[e.length-1].accuracy??null:null,fixes:n.length}}function xr(e){if(!e||!Number.isFinite(e)||e>3600)return"–";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function Sr(e){return e&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var Je={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function wr(e){let t=e.location,n=e.intervalMs??3000,r=Je,o=null,i=()=>typeof document<"u"&&document.visibilityState==="hidden";async function a(){let d=await t.readRecording();return r=Xe(d,e),e.onUpdate?.(r),r}function s(){l(),o=setInterval(()=>{if(!i())a().catch(()=>{})},n)}function l(){if(o)clearInterval(o);o=null}return{get stats(){return r},async start(){return await t.startRecording({enableHighAccuracy:!0,...e.locationOptions}),r=Je,e.onUpdate?.(r),s(),r},async attach(){let d=await t.getRecordingState().catch(()=>null);if(!d?.active)return null;if(await a().catch(()=>{}),!d.paused)s();return d},async pause(){l(),await t.pauseRecording(),await a().catch(()=>{})},async resume(){await t.resumeRecording(),s()},async stop(){l();let p=(await t.stopRecording())?.locations??[];return r=Xe(p,e),e.onUpdate?.(r),p},refresh:a}}var Ar=150;function Kt(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 G(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function Er(e,t){let n=(e||[]).filter((a)=>Number.isFinite(a?.latitude)&&Number.isFinite(a?.longitude)),r=n.map((a)=>Number(a.accuracy)).filter((a)=>Number.isFinite(a)&&a>=0),o=r.length?G(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:G(n.map((s)=>s.latitude),0.5),longitude:G(n.map((s)=>s.longitude),0.5)};i=G(n.map((s)=>Kt(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 Tr(e){let n=String(e||"").trim().toLowerCase().replace(",",".").match(/^(\d+(?:\.\d+)?)\s*(km|k|m|mi)?$/);if(!n)return null;let r=Number(n[1]),o=n[2]||(r>100?"m":"km"),i=o==="m"?r/1000:o==="mi"?r*1.609344:r;return i>0&&i<1000?Math.round(i*1000)/1000:null}var J=new Set,Qe=!1,V=null;function $t(e){return e.isConnected&&e.getClientRects().length>0}function Ze(){return[...J].find((e)=>$t(e.element))}function X(){let e=Ze(),t=Boolean(e);if(t===Qe)return;if(Qe=t,t)M.enable(e?.tintColor?{tintColor:e.tintColor}:{});else M.disable()}function qt(){let e=Ze();if(!e){M.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>M.end())}function Pr(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};J.add(n);let r=e.ownerDocument?.defaultView;if(!V){let o=M.onRefresh(qt),i=()=>X();r?.addEventListener("stx:load",i),V=()=>{o(),r?.removeEventListener("stx:load",i)}}return X(),r?.requestAnimationFrame?.(()=>X()),()=>{if(J.delete(n),J.size===0)V?.(),V=null;X()}}var Cr=0.5;function Ut(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 Wt(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 Yt(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function Or(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Ut(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(p)=>{let c=p;if(c.button!==void 0&&c.button!==0)return;if(c.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let m=a().find((u)=>u.name===e.detent())?.y??0;n={y:c.clientY,base:m,pointerId:c.pointerId},o=m,r=[{y:m,t:c.timeStamp}],t.classList.add("is-dragging");try{p.currentTarget?.setPointerCapture?.(c.pointerId)}catch{}},l=(p)=>{if(!n)return;let c=p,m=n.base+c.clientY-n.y;o=m<0?-Yt(-m):m,r.push({y:o,t:c.timeStamp});while(r.length>2&&c.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let u=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/u))))},d=(p)=>{if(!n)return;let c=p;n=null;let m=r[0],u=Math.max(1,c.timeStamp-m.t),f=(o-m.y)/u;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(Wt({y:o,velocity:f,stops:a()}))};for(let p of e.handles)p.addEventListener("pointerdown",s),p.addEventListener("pointermove",l),p.addEventListener("pointerup",d),p.addEventListener("pointercancel",d);return()=>{for(let p of e.handles)p.removeEventListener("pointerdown",s),p.removeEventListener("pointermove",l),p.removeEventListener("pointerup",d),p.removeEventListener("pointercancel",d)}}var et=0,ge="";function Ir(e){let t=e.ownerDocument,n=[],r=e;while(r.parentElement&&r!==t.body){for(let a of Array.from(r.parentElement.children)){if(a===r||a.hasAttribute("inert")||a.hasAttribute("data-native-dialog"))continue;if(["SCRIPT","STYLE","TEMPLATE","LINK"].includes(a.tagName))continue;a.setAttribute("inert",""),n.push(a)}r=r.parentElement}let o=t.documentElement;if(et++===0)ge=o.style.overflow||"",o.style.overflow="hidden";let i=!1;return()=>{if(i)return;i=!0;for(let a of n)a.removeAttribute("inert");if(--et===0)if(ge)o.style.overflow=ge;else o.style.removeProperty("overflow")}}function Nr(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()}}function Hr(e,t){let n=e.documentElement;if(!t){n.removeAttribute("data-native-sheet-card");return}let r=e.defaultView,o=(r?.scrollY??0)+(r?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(o)}px`),n.setAttribute("data-native-sheet-card","")}function jt(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 zt(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 Gt(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&&!zt(r))return r}return null}function Vt(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 Fr(e,t={}){let n=t.root??e.documentElement;D.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let p=Gt(e);if(p&&p!==r)r=p,D.setUnderPageColor(p);let c=Vt(e)?"light":"dark";if(c!==o)o=c,z.setStyle(c)},a=Ye((p)=>{jt(n,p),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 d=s?.matchMedia?.("(prefers-color-scheme: dark)");return d?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),d?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var $r=64;var Xt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Jt=/^(?: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,d=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!Xt.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:d})}return{kinds:t,problems:n}}function q(e,t){return e.find((n)=>n.name===t)??null}function K(e,t,n){let r=q(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function Qt(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(!Jt.test(o))return null;let i=Number(o);return K(e,r,i)===t?{kind:r,slot:i}:null}function rt(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function qr(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()),...rt(nt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function ot(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${q(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function Zt(e,t,n,r,o=Date.now()){let i=q(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((f)=>f.kind===n),s=ot(e,n,r),l=a.find((f)=>f.itemId===r.id)??null,d=l?null:rn(a,i.slots),p=l||d!==null?null:on(a),c=l?.slot??d??p?.slot;if(c===void 0||c===null)return null;let m={kind:n,slot:c,itemId:r.id,title:s,donatedAt:o},u=t.filter((f)=>f.kind!==n||f.slot!==c&&f.itemId!==r.id);return{entries:it(e,[...u,m]),entry:m,evicted:p,changed:!l||l.title!==s}}function en(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 tn(e,t,n){let r=Qt(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=q(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function nn(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:d,donatedAt:p}=i;if(typeof a!=="string"||typeof s!=="number"||K(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let c=`${a}-slot-${s}`,m=`${a}#${l}`;if(n.has(c)||r.has(m))continue;n.set(c,{kind:a,slot:s,itemId:l,title:typeof d==="string"&&d.trim()?d:ot(e,a,{id:l}),donatedAt:typeof p==="number"&&Number.isFinite(p)&&p>0?p:0}),r.add(m)}return it(e,[...n.values()])}function it(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 rn(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 on(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function an(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var sn="stacks_spotlight_index",ln=3000;function Ur(e){let t=e.onProblem??((v)=>console.warn(`[spotlight] ${v}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:nt(e.kinds);for(let v of n.problems)t(v);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??sn,i=e.legacyStorageKeys??[],a=e.timeoutMs??ln,s=e.now??(()=>Date.now()),l=e.bridge??an,d=null;function p(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function c(){if(d)return d;d=[];let v=p();if(!v)return d;try{let y=[o,...i].map((S)=>v.getItem(S)).find((S)=>S);d=y?nn(r,JSON.parse(y)):[]}catch{d=[]}return d}function m(v){d=v;let y=p();if(!y)return;try{y.setItem(o,JSON.stringify(v));for(let S of i)y.removeItem(S)}catch{}}async function u(v){if(!v)return null;let y;try{return await Promise.race([v,new Promise((S)=>{y=setTimeout(()=>S(null),a)})])}catch{return null}finally{if(y!==void 0)clearTimeout(y)}}let f=Promise.resolve();function h(v){let y=f.then(v,v);return f=y.catch(()=>{return}),y}async function A(v,y){let S=l()?.register;if(!S||r.length===0)return!1;return h(async()=>{let k=Zt(r,c(),v,y,s()),C=k&&K(r,v,k.entry.slot);if(!k||!C)return!1;if(!k.changed)return m(k.entries),!0;let H=await u(S(k.entry.title,C))!==null;if(H)m(k.entries);return H})}async function N(v,y){let S=l()?.remove;if(!S)return!1;return h(async()=>{let{entries:k,removed:C}=en(c(),v,y);if(!C)return!1;let H=K(r,v,C.slot),gt=H?await u(S(H))!==null:!1;return m(k),gt})}async function ft(v,y){let S=q(r,v)?.slots;if(!S||!l()?.register)return 0;let k=0;for(let C of[...y].slice(0,S).reverse())if(await A(v,C))k++;return k}async function mt(){let v=l()?.remove;if(!v)return m([]),0;return h(async()=>{let y=0;for(let S of c()){let k=K(r,S.kind,S.slot);if(k&&await u(v(k))!==null)y++}return m([]),y})}return{kinds:r,index:A,sync:ft,remove:N,clear:mt,routeFor:(v)=>tn(r,c(),v),entries:()=>c(),activityTypes:(v)=>rt(r).map((y)=>`${v}.${y}`),reset:()=>{d=null}}}var tt=["craftShortcut","craftSiriShortcut"];function Wr(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 tt)globalThis.addEventListener(r,n);return()=>{for(let r of tt)globalThis.removeEventListener(r,n)}}import{tabBar as cn}from"craft-native/mobile";var un=cn;function dn(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 pn(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 st(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function fn(){return typeof st()?.selectTab==="function"}function zr(e,t={}){let n=(r)=>{if(fn()||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 at(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}function Gr(e,t={}){let n=t.api??un;if(!n.isAvailable())return null;let r=t.hidden??(()=>Boolean(e.ownerDocument?.querySelector("[data-native-hide-tab-bar]"))),o=typeof getComputedStyle==="function"?getComputedStyle(e):null,i=at(o?.getPropertyValue("--native-tab-active")||""),a=at(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:m,selected:u}=pn(dn(e)),f=JSON.stringify({tabs:m,selected:u});if(f===s)return;let h=s&&s!=="hidden"?JSON.parse(s):null;if(h&&u&&JSON.stringify(h.tabs)===JSON.stringify(m))n.select(u);else n.set(m,{selected:u,tint:i,tintDark:a});s=f},d=typeof MutationObserver==="function"?new MutationObserver(l):null;d?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let p=n.onSelect((m)=>{let u=st();if(u?.selectTab){u.selectTab(m);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((h)=>h.getAttribute("href")===m)?.click()}),c=()=>l();if(typeof window<"u")window.addEventListener("stx:load",c),window.addEventListener("stx:screen-shown",c);return l(),()=>{if(d?.disconnect(),p(),typeof window<"u")window.removeEventListener("stx:load",c),window.removeEventListener("stx:screen-shown",c);n.hide()}}var bn={isAvailable:()=>g(()=>he.isAvailable()),getBiometricType:()=>g(()=>he.getBiometricType()),authenticate:(e)=>g(()=>he.authenticate(e))},vn={takePicture:(e)=>g(()=>Q.takePicture(e)),pickImage:()=>g(()=>Q.pickImage()),pickMultiple:(e)=>g(()=>Q.pickMultiple(e)),isAvailable:()=>g(()=>Q.isAvailable())},yn={getInfo:()=>g(()=>O.getInfo()),getCapabilities:()=>g(()=>O.getCapabilities()),isMobile:()=>O.isMobile(),isIOS:()=>O.isIOS(),isAndroid:()=>O.isAndroid(),getLocale:()=>O.getLocale(),getTimezone:()=>O.getTimezone()},xn=gn,Sn={getCurrentPosition:(e)=>g(()=>P.getCurrentPosition(e)),watchPosition:(e,t)=>P.watchPosition(e,t),clearWatch:(e)=>P.clearWatch(e),startRecording:(e)=>g(()=>P.startRecording(e)),pauseRecording:()=>g(()=>P.pauseRecording()),resumeRecording:()=>g(()=>P.resumeRecording()),stopRecording:()=>g(()=>P.stopRecording()),getRecordingState:()=>g(()=>P.getRecordingState()),readRecording:()=>g(()=>P.readRecording())},wn={show:(e)=>g(()=>ee.show(e)),schedule:(e)=>g(()=>ee.schedule(e)),cancelAll:()=>g(()=>ee.cancelAll()),setBadge:(e)=>g(()=>ee.setBadge(e))},kn={check:(e)=>g(()=>W.check(e)),request:(e)=>g(()=>W.request(e)),checkMultiple:(e)=>g(()=>W.checkMultiple(e)),requestMultiple:(e)=>g(()=>W.requestMultiple(e)),openSettings:()=>g(()=>W.openSettings())},An={set:(e,t)=>g(()=>te.set(e,t)),get:(e)=>g(()=>te.get(e)),delete:(e)=>g(()=>te.delete(e)),clear:()=>g(()=>te.clear())},En={share:(e)=>g(()=>dt.share(e)),isAvailable:()=>dt.isAvailable()},Tn={request:()=>g(()=>mn.request())},ne={impact:(e)=>Promise.resolve().then(()=>Z.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>Z.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>Z.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>Z.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=T("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function pt(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 Ln={async getInitialURL(){if(!await I())return null;return pt(await lt.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=lt.onLink?.((o,i)=>{let a=pt(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(oe()?.craft)r();else I().then(r);return()=>{n=!0,t?.()}}},Rn={enable:()=>g(()=>ct.enable()),disable:()=>g(()=>ct.disable())},Pn={isAvailable:()=>ye.isAvailable(),speak:(e,t)=>g(()=>ye.speak(e,t)),stop:()=>g(()=>ye.stop())},Mn={getStatus:()=>g(()=>ut.getStatus()),onChange:(e)=>ae(()=>ut.onChange(e))},Cn={register:()=>g(()=>ve.register()),onToken:(e)=>ve.onToken(e),onNotification:(e)=>ae(()=>ve.onNotification(e))},On={requestAuthorization:(e,t)=>g(()=>U.requestAuthorization(e,t)),getData:(e,t)=>g(()=>U.getData(e,t)),saveWorkout:(e)=>g(()=>U.saveWorkout(e)),getWorkouts:(e)=>g(()=>U.getWorkouts(e)),getDailyStatistics:(e,t)=>g(()=>U.getDailyStatistics(e,t))},In={start:(e)=>g(()=>be.start(e)),update:(e)=>g(()=>be.update(e)),end:()=>g(()=>be.end())},Nn={send:(e)=>g(()=>Y.send(e)),updateContext:(e)=>g(()=>Y.updateContext(e)),isReachable:()=>g(()=>Y.isReachable()),onMessage:(e)=>Y.onMessage(e),onReachabilityChange:(e)=>Y.onReachabilityChange(e)},Zr=hn;function oe(){return x()}function re(){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 xe(){return re()!==null}function Hn(e=2000){if(xe()||ie())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(xe())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function _n(e){let t=oe();if(!t)return()=>{};if(re()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!re())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Dn(e){await ne.impact("light");try{let t=await e();return await ne.notification("success"),t}catch(t){throw await ne.notification("error"),t}}var eo={get nativeBridge(){return re()},biometrics:bn,camera:vn,device:yn,haptics:ne,lifecycle:xn,location:Sn,notifications:wn,permissions:kn,secureStorage:An,share:En,appReview:Tn,deepLinks:Ln,keepAwake:Rn,speech:Pn,network:Mn,pushNotifications:Cn,health:On,liveActivities:In,watchConnectivity:Nn,dialog:_,contextMenu:pe,browser:Ie,symbols:Ne,statusBar:z,chrome:D,refresh:M,background:B,clipboard:He,db:_e,files:De,shortcuts:Be,widgets:Fe,orientation:Ke,auth:$e,storeKit:qe,isNativeMobile:xe,whenNative:Hn,onReady:_n,withFeedback:Dn};export{Bn as BRIDGE_WAIT_MS,Ar as INDOOR_CHECK_AFTER_S,$r as MAX_SPOTLIGHT_SLOTS_PER_KIND,yr as ROUTE_GAP_S,Cr as SHEET_FLICK_VELOCITY,g as afterBridge,Tn as appReview,jt as applyAppearance,$e as auth,gr as backLabelFor,B as background,bn as biometrics,j as bridgePending,Ie as browser,b as callNative,vn as camera,Ht as canGoBack,D as chrome,He as clipboard,Yn as confirmAction,pe as contextMenu,x as craftHost,ht as craftRoot,wr as createRouteRecorder,Ur as createSpotlightIndex,We as currentAppearance,_e as db,_t as deepLinkPath,Ln as deepLinks,yn as device,_ as dialog,mr as enterNavTrail,De as files,Bt as fixDistance,Qn as focusSegment,br as followDeepLinks,re as getNativeMobileBridge,fr as goBack,zr as handleTabReselect,ne as haptics,ie as hasNativeMobileHost,On as health,Er as indoorVerdict,Fr as installNativeChrome,Zn as installPressables,xe as isNativeMobile,$t as isShown,Rn as keepAwake,It as largeTitleMetrics,xn as lifecycle,Nr as liftToBody,In as liveActivities,Sn as location,Ir as lockBackground,Gr as mirrorTabBar,eo as mobile,yt as nativeFunction,T as nativeFunctionNow,pn as nativeTabs,hr as navTrail,Mn as network,Pt as normalizeAppearance,pt as normalizeDeepLinkURL,wn as notifications,ur as observeLargeTitle,Vn as observeLongPress,Pr as observeNativeRefresh,Ct as observePageScroll,cr as observePullToRefresh,Xn as observeSegmentScrub,Or as observeSheetDrag,Ye as onAppearance,ar as onBackgroundRefresh,R as onCraftEvent,or as onMemoryWarning,_n as onMobileReady,rr as onResume,ir as onSilentPush,Wr as onSpotlightTap,Ke as orientation,xr as paceLabel,Gt as pageBackground,Vt as pageIsDark,F as pageScrollTop,kn as permissions,At as placeMenu,Zt as placeSpotlightItem,Le as presentActionSheet,Ee as presentAlert,se as presentChoice,Te as presentConfirm,Re as presentContextMenu,Hr as presentPageAsCard,Ot as pullDistance,Cn as pushNotifications,nn as readSpotlightEntries,nt as readSpotlightKinds,dn as readTabLinks,M as refresh,en as removeSpotlightItem,dr as resolveScrollHost,Xe as routeStats,fn as routerHandlesTabs,Yt as rubberBand,An as secureStorage,Rt as segmentAt,Jn as segmentForKey,Wt as settleSheet,En as share,Ut as sheetStops,Be as shortcuts,jn as showContextMenuFor,Pn as speech,Sr as speedLabel,Zr as splash,K as spotlightAction,rt as spotlightActions,qr as spotlightActivityTypes,an as spotlightBridge,q as spotlightKind,tn as spotlightRoute,Qt as spotlightSlot,ot as spotlightTitle,z as statusBar,qe as storeKit,ae as subscribeWhenReady,Ne as symbols,un as tabBar,de as toNativeRect,kt as trapFocus,Tr as typedDistanceKm,Ft as usableFixes,Wn as useActionSheet,Nn as watchConnectivity,I as whenBridgeReady,Hn as whenNativeMobile,Fe as widgets,Dn as withNativeFeedback};
55
+ `;function ke(){return x()?.document}function wt(e){if(e.getElementById(we))return;let t=e.createElement("style");t.id=we,t.textContent=St,(e.head??e.documentElement).appendChild(t)}var kt=0;function w(e,t,n,r){let o=e.createElement(t);if(o.className=n,r!==void 0)o.textContent=r;return o}var Ae='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function At(e,t){if(t.key!=="Tab")return;let n=Array.from(e.querySelectorAll(Ae));if(n.length===0){t.preventDefault();return}let r=n[0],o=n[n.length-1],i=e.ownerDocument.activeElement;if(t.shiftKey&&(i===r||!e.contains(i)))t.preventDefault(),o.focus();else if(!t.shiftKey&&(i===o||!e.contains(i)))t.preventDefault(),r.focus()}function Ee(e,t,n,r){wt(e);let o=x(),i=e.activeElement,a=w(e,"div",`native-dialog native-dialog--${t}`);return a.setAttribute("data-native-dialog",t),a.appendChild(w(e,"div","native-dialog-backdrop")),new Promise((s)=>{let l=!1,d=(h)=>{if(l)return;l=!0,a.classList.remove("is-open"),e.removeEventListener("keydown",p,!0),setTimeout(()=>{if(a.remove(),i&&typeof i.focus==="function")i.focus()},260),s(h)},p=(h)=>{if(h.key==="Escape"){h.preventDefault(),d(r());return}At(c,h)},c=n({root:a,settle:d});a.appendChild(c),e.body.appendChild(a),e.addEventListener("keydown",p,!0);let m=o;(typeof m?.requestAnimationFrame==="function"?(h)=>m.requestAnimationFrame(()=>m.requestAnimationFrame(h)):(h)=>setTimeout(h,16))(()=>{if(!l)a.classList.add("is-open")}),(c.querySelector("[data-native-autofocus]")??c.querySelector(Ae))?.focus()})}function se(e){let t=ke();if(!t?.body)return Promise.resolve(null);let n=`native-dialog-${++kt}`,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 Ee(t,e.variant,({root:a,settle:s})=>{let l=(u)=>u.style==="cancel"?null:u.id,d=w(t,"div","native-dialog-panel");d.setAttribute("role","alertdialog"),d.setAttribute("aria-modal","true"),d.tabIndex=-1;let p=w(t,"div","native-dialog-group");if(e.title||e.message){let u=w(t,"div","native-dialog-header");if(e.title){let f=w(t,"p","native-dialog-title",e.title);f.id=`${n}-title`,u.appendChild(f),d.setAttribute("aria-labelledby",f.id)}if(e.message){let f=w(t,"p","native-dialog-message",e.message);f.id=`${n}-message`,u.appendChild(f),d.setAttribute("aria-describedby",f.id)}p.appendChild(u)}let c=w(t,"div","native-dialog-actions");if(e.variant==="alert"&&o.length===2)c.classList.add("is-row");for(let u of o){let f=w(t,"button",`native-dialog-action${u.style==="destructive"?" is-destructive":""}${u.style==="cancel"?" is-cancel":""}`,u.title);f.type="button",f.setAttribute("data-action-id",u.id),f.addEventListener("click",()=>s(l(u))),c.appendChild(f)}if(p.appendChild(c),d.appendChild(p),i){let u=w(t,"div","native-dialog-group"),f=w(t,"button","native-dialog-action is-cancel",i.title);f.type="button",f.setAttribute("data-action-id",i.id),f.addEventListener("click",()=>s(null)),u.appendChild(f),d.appendChild(u)}let m=a.querySelector(".native-dialog-backdrop");if(e.variant==="sheet")m?.addEventListener("click",()=>s(null));return d},()=>{if(e.variant==="sheet")return null;if(r)return null;return o.length===1?o[0].id:null})}async function Te(e){await se({variant:"alert",title:e.title,message:e.message,actions:[{id:"ok",title:e.okLabel||"OK"}]})}async function Le(e){return await se({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 Re(e){return se({variant:"sheet",title:e.title,message:e.message,actions:e.actions,cancelLabel:e.cancelLabel})}function Et(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,d=s||l<12?Math.max(12,Math.min(a,n.height-t.height-12)):l,p=e.x+e.width/2>n.width/2?"right":"left";return{top:d,left:i,origin:`${s||l<12?"top":"bottom"} ${p}`}}function Pe(e){let t=ke();if(!t?.body)return Promise.resolve(null);let n=x();return Ee(t,"menu",({root:r,settle:o})=>{let i=w(t,"div","native-menu native-dialog-panel");if(i.setAttribute("role","menu"),e.title)i.appendChild(w(t,"p","native-menu-title",e.title)),i.setAttribute("aria-label",e.title);for(let a of e.items){let s=w(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(w(t,"span","native-menu-label",a.title)),a.icon){let l=w(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=Et(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 Ie=()=>!0,E=()=>!1,L=()=>null;function Me(){return x()?.navigator??(typeof navigator>"u"?void 0:navigator)}function de(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 _={alert:(e)=>b("dialog.alert",[e],()=>Te(e),{fallbackOnError:!0}).then(()=>{}),confirm:(e)=>b("dialog.confirm",[e],()=>Le(e),{fallbackOnError:!0}).then(Boolean),actionSheet:async(e)=>{let t={...e,anchor:e.anchor?de(e.anchor):void 0},n=await b("dialog.actionSheet",[t],()=>Re(e),{fallbackOnError:!0});if(typeof n!=="string")return null;return e.actions.find((r)=>r.id===n)?.style==="cancel"?null:n}};function jn(){return(e)=>_.actionSheet(e)}async function zn(e){if((e.style??(e.destructive?"sheet":"alert"))==="alert")return _.confirm(e);return await _.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 pe={show:async(e)=>{let t={title:e.title,anchor:de(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 b("contextMenu.show",[t],()=>Pe(e),{fallbackOnError:!0});return typeof n==="string"?n:null}};function Gn(e,t){return pe.show({...t,anchor:de(e.getBoundingClientRect())})}function Tt(e,t){let n=x();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 Ne={open:async(e,t={})=>{let n=await b("browser.open",[e,t],()=>Tt(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)}}},le=new Map,ce=new Map;function Ce(e,t){return`${e}|${t.pointSize??""}|${t.weight??""}|${t.color??""}|${t.scale??""}`}var He={isAvailable:()=>T("symbols.image")!==null,image:(e,t={})=>{let n=Ce(e,t),r=le.get(n);if(r)return r;let o=b("symbols.image",[e,t],L).then((i)=>typeof i==="string"&&i.startsWith("data:")?i:null,L).then((i)=>(ce.set(n,i),i));return le.set(n,o),o},cached:(e,t={})=>ce.get(Ce(e,t)),clearCache:()=>{le.clear(),ce.clear()}},z={setStyle:(e)=>b("statusBar.setStyle",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},D={setUnderPageColor:(e)=>b("chrome.setUnderPageColor",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1),setKeyboardAccessory:(e)=>b("chrome.setKeyboardAccessory",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},M={isAvailable:()=>T("refresh.enable")!==null,enable:(e)=>b("refresh.enable",[e??{}],E,{fallbackOnError:!0}).then((t)=>t!==!1),disable:()=>b("refresh.disable",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),end:()=>b("refresh.end",[],E,{fallbackOnError:!0}).then((e)=>e!==!1),onRefresh:(e)=>R("craftRefresh",()=>e())},B={complete:(e)=>b("background.complete",[e],E,{fallbackOnError:!0}).then((t)=>t!==!1)},_e={write:(e)=>b("clipboard.write",[e],async()=>{let t=Me()?.clipboard;if(!t?.writeText)return!1;return t.writeText(e).then(Ie,E)},{fallbackOnError:!0}).then((t)=>t!==!1),read:()=>b("clipboard.read",[],async()=>{let e=Me()?.clipboard;if(!e?.readText)return null;return e.readText().catch(L)},{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null)},De={isAvailable:()=>T("db.query")!==null,query:(e,t=[])=>b("db.query",[e,t],L).then((n)=>Array.isArray(n)?n:null),execute:(e,t=[])=>b("db.execute",[e,t],L).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 ue(e,t){let n=x()?.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 Lt(e){let t=x()?.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 Be={openPDF:(e,t=0)=>b("openPDF",[e,t],()=>{let n=x();return Boolean(n?.open?.(e,"_blank","noopener"))}).then((n)=>n!==!1),takeScreenshot:()=>b("takeScreenshot",[],L,{fallbackOnError:!0}).then((e)=>typeof e==="string"?e:null),scanQRCode:()=>b("scanQRCode",[],L).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},L),pickFile:(e=[])=>b("pickFile",[e],()=>Lt(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}},L),saveFile:(e,t,n)=>b("saveFile",[e,t,n],()=>{if(e.startsWith("data:"))return ue(e,t);let r=new Blob([e],{type:n||"text/plain"}),o=URL.createObjectURL(r),i=ue(o,t);return setTimeout(()=>URL.revokeObjectURL(o),1000),i}).then((r)=>typeof r==="string"?r:null),downloadFile:(e,t)=>b("downloadFile",[e,t],()=>ue(e,t)).then((n)=>typeof n==="string"?n:null)},Fe={set:(e)=>b("shortcuts.set",[e.map(({symbol:t,...n})=>t?{...n,iconName:t}:n)],E).then((t)=>t!==!1),clear:()=>b("shortcuts.clear",[],E).then((e)=>e!==!1),onShortcut:(e)=>R("craftShortcut",(t)=>{if(typeof t.type==="string")e(t.type)})},Ke={update:(e)=>b("widget.update",[e],E).then((t)=>t!==!1),reload:()=>b("widget.reload",[],E).then((e)=>e!==!1)},Rt={portrait:"portrait-primary",portraitUpsideDown:"portrait-secondary",landscape:"landscape",landscapeLeft:"landscape-primary",landscapeRight:"landscape-secondary"};function Oe(){return x()?.screen?.orientation}var $e={lock:(e)=>b("lockOrientation",[e],()=>{let t=Oe();return t?.lock?t.lock(Rt[e]).then(Ie,E):!1}).then((t)=>t!==!1),unlock:()=>b("unlockOrientation",[],()=>(Oe()?.unlock?.(),!0)).then((e)=>e!==!1)},qe={signInWithApple:()=>b("signInWithApple",[],L).then((e)=>{if(!e||typeof e!=="object"||typeof e.userId!=="string")return null;return e})},Ue={isAvailable:()=>T("iap.purchase")!==null,products:(e)=>b("iap.getProducts",[e],()=>[]).then((t)=>Array.isArray(t)?t:[]),purchase:(e)=>b("iap.purchase",[e],L).then((t)=>t&&typeof t==="object"?t:null,(t)=>{if(/cancel/i.test(String(t?.message??t)))return null;throw t}),restore:()=>b("iap.restore",[],()=>[]).then((e)=>Array.isArray(e)?e:[])};function Jn(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=(m)=>{let u=m;if(u.button!==void 0&&u.button!==0)return;a=!1,i={x:u.clientX,y:u.clientY},t.onPressStart?.(),o=setTimeout(()=>{if(o=null,!i)return;a=!0,t.onLongPress({...i}),i=null},n)},d=(m)=>{if(!i)return;let u=m;if(Math.hypot(u.clientX-i.x,u.clientY-i.y)>r)s()},p=(m)=>{if(!a)return;a=!1,m.preventDefault(),m.stopPropagation()},c=(m)=>m.preventDefault();return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",d),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",s),e.addEventListener("click",p,!0),e.addEventListener("contextmenu",c),()=>{s(),e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",s),e.removeEventListener("click",p,!0),e.removeEventListener("contextmenu",c)}}function Pt(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 Qn(e,t){let n=null,r=null,o=!1,i=0,a=(u)=>{let f=e.getBoundingClientRect();return Pt(u,{left:f.left+2,width:f.width-4},t.count())},s=(u)=>{let f=u;if(f.button!==void 0&&f.button!==0)return;let h=a(f.clientX);if(h!==t.selected())return;n=h,i=h,o=!1,r=f.pointerId;try{e.setPointerCapture?.(f.pointerId)}catch{}t.onPress?.(!0)},l=(u)=>{if(n===null)return;let f=a(u.clientX);if(f===i)return;o=!0,i=f,t.onScrub(f)},d=(u)=>{if(n===null)return;if(r!==null)try{e.releasePointerCapture?.(r)}catch{}if(t.onPress?.(!1),u&&o)t.onCommit(i);else if(o)t.onScrub(n);n=null,r=null},p=(u)=>{if(!o)return;o=!1,u.preventDefault(),u.stopPropagation()},c=()=>d(!0),m=()=>d(!1);return e.addEventListener("pointerdown",s),e.addEventListener("pointermove",l),e.addEventListener("pointerup",c),e.addEventListener("pointercancel",m),e.addEventListener("click",p,!0),()=>{e.removeEventListener("pointerdown",s),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",m),e.removeEventListener("click",p,!0)}}function Zn(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 er(e,t){e.querySelectorAll('[role="tab"]')[t]?.focus()}function tr(e){let t=(n)=>{if(!n.target?.closest?.("[data-native-pressable]"))return;let o=T("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})}function fe(e){let t=x();try{return Boolean(t?.matchMedia?.(e).matches)}catch{return!1}}function We(e){return e!==null&&e!==void 0&&e!=="false"&&e!=="0"}function Ye(){let e=x()?.document?.documentElement,t=Number.parseFloat(e?.style?.getPropertyValue("--craft-font-scale")||"");return{fontScale:Number.isFinite(t)&&t>0?t:1,reduceMotion:We(e?.getAttribute("data-craft-reduce-motion"))||fe("(prefers-reduced-motion: reduce)"),reduceTransparency:We(e?.getAttribute("data-craft-reduce-transparency"))||fe("(prefers-reduced-transparency: reduce)"),colorScheme:e?.classList?.contains("dark")||fe("(prefers-color-scheme: dark)")?"dark":"light"}}function Mt(e){let t=Ye(),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 je(e,t={}){if(t.immediate!==!1)e(Ye());return R("craftAppearance",(n)=>e(Mt(n)))}function ir(e){return R("craftResume",(t)=>e({backgroundedMs:Number(t.backgroundedMs)||0}))}function ar(e){return R("craftMemoryWarning",()=>e())}function ze(e){return(t)=>{Promise.resolve().then(()=>e(t)).then(()=>B.complete(!0),()=>B.complete(!1))}}function sr(e){let t=ze(e);return R("craftSilentPush",(n)=>t(n.payload??{}))}function lr(e){let t=ze(()=>e());return R("craftBackgroundRefresh",()=>t(void 0))}import{haptics as Ct}from"craft-native/mobile";function me(){if(typeof window>"u")return;return window}function F(e=me()){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 Ot(e,t=me()){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(F(t))})};return e(F(t)),t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)}function It(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 dr(e){let t=e.host??me();if(!t)return()=>{};let n=e.threshold??72,r=null,o=!1,i=!1,a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(h)=>setTimeout(h,16),s=null,l=(h)=>{s=null,e.onPull?.(h,o,{bounce:Math.min(h,Math.max(0,-F(t)))})},d=(h)=>{let A=s!==null;if(s=h,A)return;a(()=>{if(s!==null)l(s)})},p=(h)=>{let A=h.touches?.[0];return A?A.clientY:null},c=(h)=>{if(i||F(t)>0)return;r=p(h),o=!1},m=(h)=>{if(r===null)return;let A=p(h);if(A===null)return;let N=It(F(t),A-r);if(!o&&N>=n)o=!0,Promise.resolve(Ct.impact("medium")).catch(()=>{});else if(o&&N<n*0.8)o=!1;d(N)},u=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)}},f=()=>{if(r===null)return;r=null,o=!1,l(0)};return t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("touchmove",m,{passive:!0}),t.addEventListener("touchend",u),t.addEventListener("touchcancel",f),()=>{s=null,t.removeEventListener("touchstart",c),t.removeEventListener("touchmove",m),t.removeEventListener("touchend",u),t.removeEventListener("touchcancel",f)}}function Nt(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 pr(e,t={}){let n="",r=()=>t.title?.offsetHeight||t.height||52;return Ot((o)=>{let i=Nt(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 fr(e){if(!e||typeof window>"u")return;let t=window.document?.querySelector(e);return t?t:void 0}function Xe(){if(typeof window>"u")return;return window}var Ge="__stxPushed",Ht="__stxScroll";function _t(e=Xe()){let t=e?.history?.state;if(t===null||t===void 0)return!1;if(typeof t!=="object")return!0;let n=t;if(Ge in n)return n[Ge]===!0;return!(Ht in n)}function gr(e=Xe()){if(!_t(e))return!1;return e.history.back(),!0}function hr(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 br(e,t,n=12){let r=e?.title.trim()??"";return r&&r.length<=n?r:t}function vr(){if(typeof window>"u")return[];let e=window;return e.__stacksNavTrail??=[]}function Dt(e){try{let t=new URL(e,"http://local");return`${t.pathname}${t.search}`}catch{return e}}function yr(){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 Dt(r.reduce((o,i)=>i.depth>o.depth?i:o).url)}function xr(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].path===t)return e[n];return null}function Bt(e,t=Ft()){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 Ft(){if(typeof window>"u")return;return window.location?.origin}var Ve="stacks-mobile-deep-link";function Sr(e,t){let n=(r)=>{let o=Bt(r);if(o)e(o)};return t.getInitialURL().then((r)=>{if(!r)return;try{if(sessionStorage.getItem(Ve)===r)return;sessionStorage.setItem(Ve,r)}catch{}n(r)}).catch(()=>{}),t.onLink((r,o)=>{if(o?.initial)return;n(r)})}var kr=30;function Kt(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 $t(e,t=25){let n=new Set;return e.filter((r)=>Number.isFinite(r.latitude)&&Number.isFinite(r.longitude)&&Number.isFinite(r.timestamp)&&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 Je(e,t={}){let n=$t(e,t.maxAccuracyM??25),r=t.paceWindowS??30,o=[],i=0,a=0,s=null;for(let c of n){let m=o[o.length-1],u=s?(c.timestamp-s.timestamp)/1000:0;if(s=c,!m){o.push({fix:c,cumM:0});continue}if(u>30){o.push({fix:c,cumM:i});continue}let f=(c.timestamp-m.fix.timestamp)/1000,h=Kt(m.fix,c),A=Math.min(10,Math.max(3,m.fix.accuracy,c.accuracy));if(h<A)continue;if(i+=h,f>0&&h/f>=0.5)a+=f;o.push({fix:c,cumM:i})}let l=o[o.length-1],d=null,p=null;if(l){let c=l.fix.timestamp-r*1000,m=o.find((h)=>h.fix.timestamp>=c)??l,u=l.cumM-m.cumM,f=(l.fix.timestamp-m.fix.timestamp)/1000;if(u>=20&&f>0)p=u/f,d=f/(u/1000)}return{distanceM:i,movingS:a,paceSPerKm:d,averagePaceSPerKm:i>=50&&a>0?a/(i/1000):null,speedMps:p,accuracyM:n.length?n[n.length-1].accuracy:e.length?e[e.length-1].accuracy??null:null,fixes:n.length}}function Ar(e){if(!e||!Number.isFinite(e)||e>3600)return"–";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function Er(e){return e&&Number.isFinite(e)?(e*3.6).toFixed(1):"–"}var Qe={distanceM:0,movingS:0,paceSPerKm:null,averagePaceSPerKm:null,speedMps:null,accuracyM:null,fixes:0};function Tr(e){let t=e.location,n=e.intervalMs??3000,r=Qe,o=null,i=()=>typeof document<"u"&&document.visibilityState==="hidden";async function a(){let d=await t.readRecording();return r=Je(d,e),e.onUpdate?.(r),r}function s(){l(),o=setInterval(()=>{if(!i())a().catch(()=>{})},n)}function l(){if(o)clearInterval(o);o=null}return{get stats(){return r},async start(){return await t.startRecording({enableHighAccuracy:!0,...e.locationOptions}),r=Qe,e.onUpdate?.(r),s(),r},async attach(){let d=await t.getRecordingState().catch(()=>null);if(!d?.active)return null;if(await a().catch(()=>{}),!d.paused)s();return d},async pause(){l(),await t.pauseRecording(),await a().catch(()=>{})},async resume(){await t.resumeRecording(),s()},async stop(){l();let p=(await t.stopRecording())?.locations??[];return r=Je(p,e),e.onUpdate?.(r),p},refresh:a}}var Rr=150;function qt(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 G(e,t){let n=[...e].sort((r,o)=>r-o);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function Pr(e,t){let n=(e||[]).filter((a)=>Number.isFinite(a?.latitude)&&Number.isFinite(a?.longitude)),r=n.map((a)=>Number(a.accuracy)).filter((a)=>Number.isFinite(a)&&a>=0),o=r.length?G(r,0.5):Number.POSITIVE_INFINITY,i=0;if(n.length){let a={latitude:G(n.map((s)=>s.latitude),0.5),longitude:G(n.map((s)=>s.longitude),0.5)};i=G(n.map((s)=>qt(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 Mr(e){let n=String(e||"").trim().toLowerCase().replace(",",".").match(/^(\d+(?:\.\d+)?)\s*(km|k|m|mi)?$/);if(!n)return null;let r=Number(n[1]),o=n[2]||(r>100?"m":"km"),i=o==="m"?r/1000:o==="mi"?r*1.609344:r;return i>0&&i<1000?Math.round(i*1000)/1000:null}var J=new Set,Ze=!1,V=null;function Ut(e){return e.isConnected&&e.getClientRects().length>0}function et(){return[...J].find((e)=>Ut(e.element))}function X(){let e=et(),t=Boolean(e);if(t===Ze)return;if(Ze=t,t)M.enable(e?.tintColor?{tintColor:e.tintColor}:{});else M.disable()}function Wt(){let e=et();if(!e){M.end();return}Promise.resolve().then(()=>e.run()).catch(()=>{}).finally(()=>M.end())}function Ir(e,t){let n={element:e,tintColor:t.tintColor,run:t.onRefresh};J.add(n);let r=e.ownerDocument?.defaultView;if(!V){let o=M.onRefresh(Wt),i=()=>X();r?.addEventListener("stx:load",i),V=()=>{o(),r?.removeEventListener("stx:load",i)}}return X(),r?.requestAnimationFrame?.(()=>X()),()=>{if(J.delete(n),J.size===0)V?.(),V=null;X()}}var Hr=0.5;function Yt(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 jt(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 zt(e,t=400){if(e<=0)return 0;return e*t*0.55/(t+e*0.55)}function _r(e){let{panel:t}=e,n=null,r=[],o=0,i=()=>e.viewport?.()??t.ownerDocument?.defaultView?.innerHeight??800,a=()=>Yt(t.offsetHeight||t.getBoundingClientRect().height,i(),e.detents()),s=(p)=>{let c=p;if(c.button!==void 0&&c.button!==0)return;if(c.target?.closest?.("button, a, input, select, textarea, [role=button]"))return;let m=a().find((u)=>u.name===e.detent())?.y??0;n={y:c.clientY,base:m,pointerId:c.pointerId},o=m,r=[{y:m,t:c.timeStamp}],t.classList.add("is-dragging");try{p.currentTarget?.setPointerCapture?.(c.pointerId)}catch{}},l=(p)=>{if(!n)return;let c=p,m=n.base+c.clientY-n.y;o=m<0?-zt(-m):m,r.push({y:o,t:c.timeStamp});while(r.length>2&&c.timeStamp-r[0].t>100)r.shift();t.style.transform=`translateY(${o}px)`;let u=t.offsetHeight||1;t.parentElement?.style.setProperty("--native-sheet-presence",String(Math.max(0,Math.min(1,1-o/u))))},d=(p)=>{if(!n)return;let c=p;n=null;let m=r[0],u=Math.max(1,c.timeStamp-m.t),f=(o-m.y)/u;t.classList.remove("is-dragging"),t.style.transform="",t.parentElement?.style.removeProperty("--native-sheet-presence"),e.onSettle(jt({y:o,velocity:f,stops:a()}))};for(let p of e.handles)p.addEventListener("pointerdown",s),p.addEventListener("pointermove",l),p.addEventListener("pointerup",d),p.addEventListener("pointercancel",d);return()=>{for(let p of e.handles)p.removeEventListener("pointerdown",s),p.removeEventListener("pointermove",l),p.removeEventListener("pointerup",d),p.removeEventListener("pointercancel",d)}}var tt=0,ge="";function Dr(e){let t=e.ownerDocument,n=[],r=e;while(r.parentElement&&r!==t.body){for(let a of Array.from(r.parentElement.children)){if(a===r||a.hasAttribute("inert")||a.hasAttribute("data-native-dialog"))continue;if(["SCRIPT","STYLE","TEMPLATE","LINK"].includes(a.tagName))continue;a.setAttribute("inert",""),n.push(a)}r=r.parentElement}let o=t.documentElement;if(tt++===0)ge=o.style.overflow||"",o.style.overflow="hidden";let i=!1;return()=>{if(i)return;i=!0;for(let a of n)a.removeAttribute("inert");if(--tt===0)if(ge)o.style.overflow=ge;else o.style.removeProperty("overflow")}}function Br(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()}}function Fr(e,t){let n=e.documentElement;if(!t){n.removeAttribute("data-native-sheet-card");return}let r=e.defaultView,o=(r?.scrollY??0)+(r?.innerHeight??800)/2;n.style.setProperty("--native-sheet-card-origin",`${Math.round(o)}px`),n.setAttribute("data-native-sheet-card","")}function Gt(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 Vt(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 Xt(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&&!Vt(r))return r}return null}function Jt(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 Ur(e,t={}){let n=t.root??e.documentElement;D.setKeyboardAccessory(t.keyboardAccessory===!0);let r="",o="",i=()=>{let p=Xt(e);if(p&&p!==r)r=p,D.setUnderPageColor(p);let c=Jt(e)?"light":"dark";if(c!==o)o=c,z.setStyle(c)},a=je((p)=>{Gt(n,p),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 d=s?.matchMedia?.("(prefers-color-scheme: dark)");return d?.addEventListener?.("change",i),s?.addEventListener("stx:load",i),i(),()=>{a(),l?.disconnect(),d?.removeEventListener?.("change",i),s?.removeEventListener("stx:load",i)}}var Yr=64;var Qt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Zt=/^(?:0|[1-9]\d*)$/;function rt(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,d=typeof a.noun==="string"&&a.noun.trim()?a.noun.trim():"Item";if(!Qt.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:d})}return{kinds:t,problems:n}}function q(e,t){return e.find((n)=>n.name===t)??null}function K(e,t,n){let r=q(e,t);if(!r||!Number.isInteger(n)||n<0||n>=r.slots)return null;return`${t}-slot-${n}`}function en(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(!Zt.test(o))return null;let i=Number(o);return K(e,r,i)===t?{kind:r,slot:i}:null}function ot(e){return e.flatMap((t)=>Array.from({length:t.slots},(n,r)=>`${t.name}-slot-${r}`))}function jr(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()),...ot(rt(n.kinds).kinds)];return[...new Set(o)].map((i)=>`${t}.${i}`)}function it(e,t,n){let r=typeof n.name==="string"?n.name.replace(/\s+/g," ").trim():"";if(!r)return`${q(e,t)?.noun??"Item"} #${n.id}`;return r.length>120?`${r.slice(0,119).trimEnd()}…`:r}function tn(e,t,n,r,o=Date.now()){let i=q(e,n);if(!i||!Number.isInteger(r.id)||r.id<=0)return null;let a=t.filter((f)=>f.kind===n),s=it(e,n,r),l=a.find((f)=>f.itemId===r.id)??null,d=l?null:an(a,i.slots),p=l||d!==null?null:sn(a),c=l?.slot??d??p?.slot;if(c===void 0||c===null)return null;let m={kind:n,slot:c,itemId:r.id,title:s,donatedAt:o},u=t.filter((f)=>f.kind!==n||f.slot!==c&&f.itemId!==r.id);return{entries:at(e,[...u,m]),entry:m,evicted:p,changed:!l||l.title!==s}}function nn(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 rn(e,t,n){let r=en(e,n);if(!r)return null;let o=t.find((a)=>a.kind===r.kind&&a.slot===r.slot),i=q(e,r.kind)?.route;return o&&i?i.replace(":id",String(o.itemId)):null}function on(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:d,donatedAt:p}=i;if(typeof a!=="string"||typeof s!=="number"||K(e,a,s)===null)continue;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)continue;let c=`${a}-slot-${s}`,m=`${a}#${l}`;if(n.has(c)||r.has(m))continue;n.set(c,{kind:a,slot:s,itemId:l,title:typeof d==="string"&&d.trim()?d:it(e,a,{id:l}),donatedAt:typeof p==="number"&&Number.isFinite(p)&&p>0?p:0}),r.add(m)}return at(e,[...n.values()])}function at(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 an(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 sn(e){return e.reduce((t,n)=>!t||n.donatedAt<t.donatedAt?n:t,null)}function ln(){let e=globalThis.craft;return e&&typeof e==="object"?e.siri:void 0}var cn="stacks_spotlight_index",un=3000;function zr(e){let t=e.onProblem??((v)=>console.warn(`[spotlight] ${v}`)),n=Array.isArray(e.kinds)?{kinds:[...e.kinds],problems:[]}:rt(e.kinds);for(let v of n.problems)t(v);let r=e.enabled===!1?[]:n.kinds,o=e.storageKey??cn,i=e.legacyStorageKeys??[],a=e.timeoutMs??un,s=e.now??(()=>Date.now()),l=e.bridge??ln,d=null;function p(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function c(){if(d)return d;d=[];let v=p();if(!v)return d;try{let y=[o,...i].map((S)=>v.getItem(S)).find((S)=>S);d=y?on(r,JSON.parse(y)):[]}catch{d=[]}return d}function m(v){d=v;let y=p();if(!y)return;try{y.setItem(o,JSON.stringify(v));for(let S of i)y.removeItem(S)}catch{}}async function u(v){if(!v)return null;let y;try{return await Promise.race([v,new Promise((S)=>{y=setTimeout(()=>S(null),a)})])}catch{return null}finally{if(y!==void 0)clearTimeout(y)}}let f=Promise.resolve();function h(v){let y=f.then(v,v);return f=y.catch(()=>{return}),y}async function A(v,y){let S=l()?.register;if(!S||r.length===0)return!1;return h(async()=>{let k=tn(r,c(),v,y,s()),C=k&&K(r,v,k.entry.slot);if(!k||!C)return!1;if(!k.changed)return m(k.entries),!0;let H=await u(S(k.entry.title,C))!==null;if(H)m(k.entries);return H})}async function N(v,y){let S=l()?.remove;if(!S)return!1;return h(async()=>{let{entries:k,removed:C}=nn(c(),v,y);if(!C)return!1;let H=K(r,v,C.slot),ht=H?await u(S(H))!==null:!1;return m(k),ht})}async function mt(v,y){let S=q(r,v)?.slots;if(!S||!l()?.register)return 0;let k=0;for(let C of[...y].slice(0,S).reverse())if(await A(v,C))k++;return k}async function gt(){let v=l()?.remove;if(!v)return m([]),0;return h(async()=>{let y=0;for(let S of c()){let k=K(r,S.kind,S.slot);if(k&&await u(v(k))!==null)y++}return m([]),y})}return{kinds:r,index:A,sync:mt,remove:N,clear:gt,routeFor:(v)=>rn(r,c(),v),entries:()=>c(),activityTypes:(v)=>ot(r).map((y)=>`${v}.${y}`),reset:()=>{d=null}}}var nt=["craftShortcut","craftSiriShortcut"];function Gr(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 nt)globalThis.addEventListener(r,n);return()=>{for(let r of nt)globalThis.removeEventListener(r,n)}}import{tabBar as dn}from"craft-native/mobile";var pn=dn;function fn(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 mn(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 lt(){if(typeof window>"u")return;let e=window.stxRouter;return e&&typeof e==="object"?e:void 0}function gn(){return typeof lt()?.selectTab==="function"}function Jr(e,t={}){let n=(r)=>{if(gn()||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 st(e){let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t:void 0}var he="stacks:tab-bar-cover";function Qr(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(he))}function Zr(e,t={}){let n=t.api??pn;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=st(o?.getPropertyValue("--native-tab-active")||""),a=st(o?.getPropertyValue("--native-tab-active-dark")||""),s="",l=()=>{if(r()){if(s!=="hidden")n.hide();s="hidden";return}let{tabs:m,selected:u}=mn(fn(e)),f=JSON.stringify({tabs:m,selected:u});if(f===s)return;let h=s&&s!=="hidden"?JSON.parse(s):null;if(h&&u&&JSON.stringify(h.tabs)===JSON.stringify(m))n.select(u);else n.set(m,{selected:u,tint:i,tintDark:a});s=f},d=typeof MutationObserver==="function"?new MutationObserver(l):null;d?.observe(e,{attributes:!0,attributeFilter:["data-stx-nav-current","class"],childList:!0,subtree:!0,characterData:!0});let p=n.onSelect((m)=>{let u=lt();if(u?.selectTab){u.selectTab(m);return}Array.from(e.querySelectorAll("a[data-native-tab]")).find((h)=>h.getAttribute("href")===m)?.click()}),c=()=>l();if(typeof window<"u")window.addEventListener("stx:load",c),window.addEventListener("stx:screen-shown",c),window.addEventListener(he,c);return l(),()=>{if(d?.disconnect(),p(),typeof window<"u")window.removeEventListener("stx:load",c),window.removeEventListener("stx:screen-shown",c),window.removeEventListener(he,c);n.hide()}}var yn={isAvailable:()=>g(()=>be.isAvailable()),getBiometricType:()=>g(()=>be.getBiometricType()),authenticate:(e)=>g(()=>be.authenticate(e))},xn={takePicture:(e)=>g(()=>Q.takePicture(e)),pickImage:()=>g(()=>Q.pickImage()),pickMultiple:(e)=>g(()=>Q.pickMultiple(e)),isAvailable:()=>g(()=>Q.isAvailable())},Sn={getInfo:()=>g(()=>O.getInfo()),getCapabilities:()=>g(()=>O.getCapabilities()),isMobile:()=>O.isMobile(),isIOS:()=>O.isIOS(),isAndroid:()=>O.isAndroid(),getLocale:()=>O.getLocale(),getTimezone:()=>O.getTimezone()},wn=bn,kn={getCurrentPosition:(e)=>g(()=>P.getCurrentPosition(e)),watchPosition:(e,t)=>P.watchPosition(e,t),clearWatch:(e)=>P.clearWatch(e),startRecording:(e)=>g(()=>P.startRecording(e)),pauseRecording:()=>g(()=>P.pauseRecording()),resumeRecording:()=>g(()=>P.resumeRecording()),stopRecording:()=>g(()=>P.stopRecording()),getRecordingState:()=>g(()=>P.getRecordingState()),readRecording:()=>g(()=>P.readRecording())},An={show:(e)=>g(()=>ee.show(e)),schedule:(e)=>g(()=>ee.schedule(e)),cancelAll:()=>g(()=>ee.cancelAll()),setBadge:(e)=>g(()=>ee.setBadge(e))},En={check:(e)=>g(()=>W.check(e)),request:(e)=>g(()=>W.request(e)),checkMultiple:(e)=>g(()=>W.checkMultiple(e)),requestMultiple:(e)=>g(()=>W.requestMultiple(e)),openSettings:()=>g(()=>W.openSettings())},Tn={set:(e,t)=>g(()=>te.set(e,t)),get:(e)=>g(()=>te.get(e)),delete:(e)=>g(()=>te.delete(e)),clear:()=>g(()=>te.clear())},Ln={share:(e)=>g(()=>pt.share(e)),isAvailable:()=>pt.isAvailable()},Rn={request:()=>g(()=>hn.request())},ne={impact:(e)=>Promise.resolve().then(()=>Z.impact(e)).catch(()=>{}),notification:(e)=>Promise.resolve().then(()=>Z.notification(e)).catch(()=>{}),selection:()=>Promise.resolve().then(()=>Z.selection()).catch(()=>{}),vibrate:(e)=>Promise.resolve().then(()=>Z.vibrate(e)).catch(()=>{}),prepare:(e)=>{let t=T("haptics.prepare");return t?Promise.resolve().then(()=>t(e)).then(()=>{},()=>{}):Promise.resolve()}};function ft(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 Pn={async getInitialURL(){if(!await I())return null;return ft(await ct.getInitialURL?.())},onLink(e){let t=null,n=!1,r=()=>{if(n)return;t=ct.onLink?.((o,i)=>{let a=ft(o);if(a)e(a,{initial:i?.initial===!0})})??null};if(oe()?.craft)r();else I().then(r);return()=>{n=!0,t?.()}}},Mn={enable:()=>g(()=>ut.enable()),disable:()=>g(()=>ut.disable())},Cn={isAvailable:()=>xe.isAvailable(),speak:(e,t)=>g(()=>xe.speak(e,t)),stop:()=>g(()=>xe.stop())},On={getStatus:()=>g(()=>dt.getStatus()),onChange:(e)=>ae(()=>dt.onChange(e))},In={register:()=>g(()=>ye.register()),onToken:(e)=>ye.onToken(e),onNotification:(e)=>ae(()=>ye.onNotification(e))},Nn={requestAuthorization:(e,t)=>g(()=>U.requestAuthorization(e,t)),getData:(e,t)=>g(()=>U.getData(e,t)),saveWorkout:(e)=>g(()=>U.saveWorkout(e)),getWorkouts:(e)=>g(()=>U.getWorkouts(e)),getDailyStatistics:(e,t)=>g(()=>U.getDailyStatistics(e,t))},Hn={start:(e)=>g(()=>ve.start(e)),update:(e)=>g(()=>ve.update(e)),end:()=>g(()=>ve.end())},_n={send:(e)=>g(()=>Y.send(e)),updateContext:(e)=>g(()=>Y.updateContext(e)),isReachable:()=>g(()=>Y.isReachable()),onMessage:(e)=>Y.onMessage(e),onReachabilityChange:(e)=>Y.onReachabilityChange(e)},oo=vn;function oe(){return x()}function re(){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 Se(){return re()!==null}function Dn(e=2000){if(Se()||ie())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(Se())},o=setTimeout(r,e);t.addEventListener("craftReady",r,{once:!0})})}function Bn(e){let t=oe();if(!t)return()=>{};if(re()){let r=!1;return queueMicrotask(()=>{if(!r)e(new Event("craftReady"))}),()=>{r=!0}}let n=(r)=>{if(!re())return;t.removeEventListener("craftReady",n),e(r)};return t.addEventListener("craftReady",n),()=>t.removeEventListener("craftReady",n)}async function Fn(e){await ne.impact("light");try{let t=await e();return await ne.notification("success"),t}catch(t){throw await ne.notification("error"),t}}var io={get nativeBridge(){return re()},biometrics:yn,camera:xn,device:Sn,haptics:ne,lifecycle:wn,location:kn,notifications:An,permissions:En,secureStorage:Tn,share:Ln,appReview:Rn,deepLinks:Pn,keepAwake:Mn,speech:Cn,network:On,pushNotifications:In,health:Nn,liveActivities:Hn,watchConnectivity:_n,dialog:_,contextMenu:pe,browser:Ne,symbols:He,statusBar:z,chrome:D,refresh:M,background:B,clipboard:_e,db:De,files:Be,shortcuts:Fe,widgets:Ke,orientation:$e,auth:qe,storeKit:Ue,isNativeMobile:Se,whenNative:Dn,onReady:Bn,withFeedback:Fn};export{Kn as BRIDGE_WAIT_MS,Rr as INDOOR_CHECK_AFTER_S,Yr as MAX_SPOTLIGHT_SLOTS_PER_KIND,kr as ROUTE_GAP_S,Hr as SHEET_FLICK_VELOCITY,he as TAB_BAR_COVER_EVENT,g as afterBridge,Rn as appReview,Gt as applyAppearance,qe as auth,br as backLabelFor,B as background,yn as biometrics,j as bridgePending,Ne as browser,b as callNative,xn as camera,_t as canGoBack,D as chrome,_e as clipboard,zn as confirmAction,pe as contextMenu,Qr as coverTabBar,x as craftHost,bt as craftRoot,Tr as createRouteRecorder,zr as createSpotlightIndex,Ye as currentAppearance,De as db,Bt as deepLinkPath,Pn as deepLinks,Sn as device,_ as dialog,hr as enterNavTrail,Be as files,Kt as fixDistance,er as focusSegment,Sr as followDeepLinks,re as getNativeMobileBridge,gr as goBack,Jr as handleTabReselect,ne as haptics,ie as hasNativeMobileHost,Nn as health,Pr as indoorVerdict,Ur as installNativeChrome,tr as installPressables,Se as isNativeMobile,Ut as isShown,Mn as keepAwake,Nt as largeTitleMetrics,wn as lifecycle,Br as liftToBody,Hn as liveActivities,kn as location,Dr as lockBackground,Zr as mirrorTabBar,io as mobile,xt as nativeFunction,T as nativeFunctionNow,mn as nativeTabs,vr as navTrail,On as network,Mt as normalizeAppearance,ft as normalizeDeepLinkURL,An as notifications,pr as observeLargeTitle,Jn as observeLongPress,Ir as observeNativeRefresh,Ot as observePageScroll,dr as observePullToRefresh,Qn as observeSegmentScrub,_r as observeSheetDrag,je as onAppearance,lr as onBackgroundRefresh,R as onCraftEvent,ar as onMemoryWarning,Bn as onMobileReady,ir as onResume,sr as onSilentPush,Gr as onSpotlightTap,$e as orientation,Ar as paceLabel,Xt as pageBackground,Jt as pageIsDark,F as pageScrollTop,En as permissions,Et as placeMenu,tn as placeSpotlightItem,Re as presentActionSheet,Te as presentAlert,se as presentChoice,Le as presentConfirm,Pe as presentContextMenu,Fr as presentPageAsCard,yr as previousScreenPath,It as pullDistance,In as pushNotifications,on as readSpotlightEntries,rt as readSpotlightKinds,fn as readTabLinks,M as refresh,nn as removeSpotlightItem,fr as resolveScrollHost,Je as routeStats,gn as routerHandlesTabs,zt as rubberBand,Tn as secureStorage,Pt as segmentAt,Zn as segmentForKey,jt as settleSheet,Ln as share,Yt as sheetStops,Fe as shortcuts,Gn as showContextMenuFor,Cn as speech,Er as speedLabel,oo as splash,K as spotlightAction,ot as spotlightActions,jr as spotlightActivityTypes,ln as spotlightBridge,q as spotlightKind,rn as spotlightRoute,en as spotlightSlot,it as spotlightTitle,z as statusBar,Ue as storeKit,ae as subscribeWhenReady,He as symbols,pn as tabBar,de as toNativeRect,xr as trailEntryFor,At as trapFocus,Mr as typedDistanceKm,$t as usableFixes,jn as useActionSheet,_n as watchConnectivity,I as whenBridgeReady,Dn as whenNativeMobile,Ke as widgets,Fn as withNativeFeedback};
@@ -24,6 +24,17 @@ export declare function enterNavTrail(trail: NavTrailEntry[], path: string, limi
24
24
  export declare function backLabelFor(previous: NavTrailEntry | null, fallback: string, max?: number): string;
25
25
  /** The trail for this window: it outlives each screen, not a full reload. */
26
26
  export declare function navTrail(): NavTrailEntry[];
27
+ /**
28
+ * The path a back from the screen on show returns to, in its own tab's stack.
29
+ *
30
+ * The trail is one list for the window, but the stx router keeps a stack per
31
+ * tab, so a screen opened in Calendar after a visit to Today goes back to
32
+ * Calendar, not to whatever was entered last. Answers null at a tab's root,
33
+ * and undefined when there is no router that keeps tabs to ask.
34
+ */
35
+ export declare function previousScreenPath(): string | null | undefined;
36
+ /** The latest trail entry for `path`, which carries that screen's name. */
37
+ export declare function trailEntryFor(trail: NavTrailEntry[], path: string): NavTrailEntry | null;
27
38
  /**
28
39
  * The in-app path a deep link opens, or null when it is not this app's.
29
40
  *
package/dist/tab-bar.d.ts CHANGED
@@ -16,6 +16,8 @@ export declare function routerHandlesTabs(): boolean;
16
16
  * and stands aside wherever the router has them.
17
17
  */
18
18
  export declare function handleTabReselect(nav: HTMLElement, options?: TabReselectOptions): () => void;
19
+ /** Marks `element` as covering the tab bar, or no longer, and says so. */
20
+ export declare function coverTabBar(element: Element, covering: boolean): void;
19
21
  /**
20
22
  * Mirror `nav`'s tabs into the native tab bar, for as long as the returned
21
23
  * function is not called. Answers null when there is no native bar, and the
@@ -23,6 +25,12 @@ export declare function handleTabReselect(nav: HTMLElement, options?: TabReselec
23
25
  */
24
26
  export declare function mirrorTabBar(nav: HTMLElement, options?: MirrorTabBarOptions): (() => void) | null;
25
27
  export declare const tabBar: TabBarApi;
28
+ /**
29
+ * What an open sheet raises when it starts or stops covering the tab bar. A
30
+ * sheet on iOS slides up over the tab bar; the native bar is drawn above the
31
+ * page, so while one is up the bar steps aside instead.
32
+ */
33
+ export declare const TAB_BAR_COVER_EVENT: 'stacks:tab-bar-cover';
26
34
  export declare interface TabBarApi {
27
35
  isAvailable: () => boolean
28
36
  set: (tabs: NativeTab[], options?: { selected?: string, tint?: string, tintDark?: string }) => boolean
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.98",
5
+ "version": "0.75.99",
6
6
  "description": "Craft-powered native mobile runtime for Stacks and STX applications",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "craft-native": ">=0.0.124"
36
36
  },
37
37
  "devDependencies": {
38
- "@stacksjs/build": "0.75.98",
38
+ "@stacksjs/build": "0.75.99",
39
39
  "better-dx": "^0.2.24"
40
40
  }
41
41
  }