@kamiui/kami 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -0
- package/dist/index-CVNk3zin.js +4163 -0
- package/dist/kami.js +75 -0
- package/dist/kami.umd.cjs +16 -0
- package/dist/web-4j5o-jby.js +42 -0
- package/package.json +48 -0
package/dist/kami.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { A as e, a as t, O as r, b as o, c as i, d as n, B as u, e as c, f as l, C as p, g, h as d, D as P, E as v, i as S, j as h, F as m, k as T, l as f, L as k, m as y, n as A, o as B, p as C, P as F, q as I, r as b, s as w, t as L, S as N, u as O, v as D, w as E, x, y as G, z as j, G as z, T as H, H as R, J as V, K as q, M as J, Q as K, R as M, U as Q, V as U, X as W, Y as X, Z as Y, _ as Z, $ as _, a0 as $, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ra, a6 as oa, a7 as ia, a8 as na, a9 as ua, aa as ca, ab as la, ac as pa, ad as ga, ae as da, af as Pa, ag as va, ah as Sa, ai as ha, aj as ma, ak as Ta } from "./index-CVNk3zin.js";
|
|
2
|
+
export {
|
|
3
|
+
e as ActionSheet,
|
|
4
|
+
t as ActivityIndicator,
|
|
5
|
+
r as ActivityIndicatorOverlay,
|
|
6
|
+
o as AppViewportProvider,
|
|
7
|
+
i as Avatar,
|
|
8
|
+
n as AvatarGroup,
|
|
9
|
+
u as Badge,
|
|
10
|
+
c as BottomSheet,
|
|
11
|
+
l as Button,
|
|
12
|
+
p as Card,
|
|
13
|
+
g as Chip,
|
|
14
|
+
d as ChipGroup,
|
|
15
|
+
P as DatePicker,
|
|
16
|
+
v as EmptyState,
|
|
17
|
+
S as ErrorBoundary,
|
|
18
|
+
h as ErrorState,
|
|
19
|
+
m as FullscreenPage,
|
|
20
|
+
T as FullscreenPageContent,
|
|
21
|
+
f as Input,
|
|
22
|
+
k as List,
|
|
23
|
+
y as ListItem,
|
|
24
|
+
A as Navbar,
|
|
25
|
+
B as NavigationStack,
|
|
26
|
+
C as OverlayNavigatorProvider,
|
|
27
|
+
F as Page,
|
|
28
|
+
I as PageContent,
|
|
29
|
+
b as Presets,
|
|
30
|
+
w as ProgressBar,
|
|
31
|
+
L as PullToRefresh,
|
|
32
|
+
N as SearchBar,
|
|
33
|
+
O as SectionTitle,
|
|
34
|
+
D as SegmentedControl,
|
|
35
|
+
E as Select,
|
|
36
|
+
x as Skeleton,
|
|
37
|
+
G as StepDots,
|
|
38
|
+
j as SwipeableListItem,
|
|
39
|
+
z as Switch,
|
|
40
|
+
H as TabBar,
|
|
41
|
+
R as ToastProvider,
|
|
42
|
+
V as WheelPicker,
|
|
43
|
+
q as animate,
|
|
44
|
+
J as color,
|
|
45
|
+
K as duration,
|
|
46
|
+
M as ease,
|
|
47
|
+
Q as fadeInFrames,
|
|
48
|
+
U as fadeOutFrames,
|
|
49
|
+
W as font,
|
|
50
|
+
X as pageTransition,
|
|
51
|
+
Y as radius,
|
|
52
|
+
Z as ring,
|
|
53
|
+
_ as shadow,
|
|
54
|
+
$ as slideFrames,
|
|
55
|
+
aa as space,
|
|
56
|
+
sa as spring,
|
|
57
|
+
ea as springs,
|
|
58
|
+
ta as surface,
|
|
59
|
+
ra as text,
|
|
60
|
+
oa as tokens,
|
|
61
|
+
ia as touchTarget,
|
|
62
|
+
na as transition,
|
|
63
|
+
ua as useAnimation,
|
|
64
|
+
ca as useDatePicker,
|
|
65
|
+
la as useFocusTrap,
|
|
66
|
+
pa as useHaptics,
|
|
67
|
+
ga as useLongPress,
|
|
68
|
+
da as useNavigation,
|
|
69
|
+
Pa as useOverlayNavigator,
|
|
70
|
+
va as usePan,
|
|
71
|
+
Sa as usePinch,
|
|
72
|
+
ha as useScrollToTop,
|
|
73
|
+
ma as useToast,
|
|
74
|
+
Ta as z
|
|
75
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
(function(b,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],n):(b=typeof globalThis<"u"?globalThis:b||self,n(b.Kami={},b.jsx,b.React,b.ReactDOM))})(this,(function(b,n,d,Dt){"use strict";const Te="cubic-bezier(0.16, 1, 0.3, 1)",V="cubic-bezier(0.16, 1, 0.3, 1)",Ne="cubic-bezier(0.34, 1.28, 0.64, 1)",Ie=d.createContext(null);function ge(){const e=d.useContext(Ie);if(!e)throw new Error("useNavigation must be used within <NavigationStack>");return e}const De=d.createContext(0);function $t(){return d.useContext(De)}function _(e,t,r="none"){e&&(e.style.transition=r,e.style.transform=`translate3d(${t}px,0,0)`)}const $e=d.forwardRef(function({initialPage:t},r){const a=window.innerWidth,[o,s]=d.useState([{id:"root",page:t}]),c=d.useRef(new Map),i=d.useRef(null),u=d.useRef(o);u.current=o;const l=d.useRef(!1);l.current=o.length>1;const f=y=>c.current.get(y)??null,h=()=>u.current[u.current.length-1].id,g=()=>u.current.length>1?u.current[u.current.length-2].id:null,x=d.useCallback(()=>s(y=>y.length>1?y.slice(0,-1):y),[]),C=d.useCallback(()=>{const y=h(),w=g();_(f(y),a,`transform 0.28s ${V}`),_(w?f(w):null,0,`transform 0.28s ${V}`),setTimeout(x,280)},[a,x]),S=d.useCallback(y=>{s(w=>[...w,{id:crypto.randomUUID(),page:y}])},[]),p=d.useCallback((y=!0)=>{if(u.current.length<=1)return;const w=u.current[0],k=u.current[u.current.length-1],T=f(w.id),N=f(k.id);if(!y){T&&_(T,0),s([w]);return}T&&_(T,-a*.3),_(N,a,`transform 0.28s ${V}`),T&&_(T,0,`transform 0.28s ${V}`),setTimeout(()=>s([w]),285)},[a]);d.useImperativeHandle(r,()=>({popToRoot:p}),[p]);const v=d.useRef(o.length);d.useLayoutEffect(()=>{const y=o.length;if(y<=v.current){v.current=y;return}v.current=y;const w=h(),k=g(),T=f(w),N=k?f(k):null;_(T,a),T?.getBoundingClientRect(),_(T,0,`transform 0.38s ${Te}`),_(N,-a*.3,`transform 0.38s ${Te}`)},[o.length,a]);const m=d.useRef({active:!1,startX:0,startY:0,startTime:0,locked:!1,cancelled:!1});d.useEffect(()=>{const y=i.current;if(!y)return;const w=N=>{if(!l.current)return;const L=N.touches[0];L.clientX>44||(m.current={active:!0,startX:L.clientX,startY:L.clientY,startTime:Date.now(),locked:!1,cancelled:!1})},k=N=>{const L=m.current;if(!L.active||L.cancelled)return;const P=N.touches[0],I=P.clientX-L.startX,$=Math.abs(P.clientY-L.startY);if(!L.locked){if(Math.abs(I)<6&&$<6)return;if(I>0&&I>=$)L.locked=!0;else{L.cancelled=!0,L.active=!1;return}}N.preventDefault();const D=Math.max(0,I),j=h(),A=g();_(f(j),D),_(A?f(A):null,-a*.3+D*.3)},T=N=>{const L=m.current;if(!L.active||L.cancelled){L.active=!1;return}L.active=!1;const P=N.changedTouches[0],I=Math.max(0,P.clientX-L.startX),$=Math.max(Date.now()-L.startTime,1),D=I/$,j=h(),A=g(),pe=f(j),M=A?f(A):null;I>a*.35||D>.4?(_(pe,a,`transform 0.22s ${V}`),_(M,0,`transform 0.22s ${V}`),setTimeout(x,220)):(_(pe,0,`transform 0.3s ${Ne}`),_(M,-a*.3,`transform 0.3s ${Ne}`))};return y.addEventListener("touchstart",w,{passive:!0}),y.addEventListener("touchmove",k,{passive:!1}),y.addEventListener("touchend",T,{passive:!0}),y.addEventListener("touchcancel",T,{passive:!0}),()=>{y.removeEventListener("touchstart",w),y.removeEventListener("touchmove",k),y.removeEventListener("touchend",T),y.removeEventListener("touchcancel",T)}},[a,x]);const E=o.length>1;return n.jsx(Ie.Provider,{value:{push:S,pop:C,canGoBack:E},children:n.jsx("div",{ref:i,className:"h-dvh overflow-hidden relative",children:o.map((y,w)=>{const k=w===o.length-1,T=w===o.length-2,N=!k&&!T;return n.jsx(De.Provider,{value:w,children:n.jsx("div",{ref:L=>{L?c.current.set(y.id,L):c.current.delete(y.id)},className:"absolute inset-0 will-change-transform",style:{visibility:N?"hidden":"visible",transform:k?"translate3d(0,0,0)":`translate3d(${-a*.3}px,0,0)`,zIndex:w},children:y.page})},y.id)})})})});var q;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(q||(q={}));class be extends Error{constructor(t,r,a){super(t),this.message=t,this.code=r,this.data=a}}const At=e=>{var t,r;return e?.androidBridge?"android":!((r=(t=e?.webkit)===null||t===void 0?void 0:t.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},_t=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},a=r.Plugins=r.Plugins||{},o=()=>t!==null?t.name:At(e),s=()=>o()!=="web",c=h=>{const g=l.get(h);return!!(g?.platforms.has(o())||i(h))},i=h=>{var g;return(g=r.PluginHeaders)===null||g===void 0?void 0:g.find(x=>x.name===h)},u=h=>e.console.error(h),l=new Map,f=(h,g={})=>{const x=l.get(h);if(x)return console.warn(`Capacitor plugin "${h}" already registered. Cannot register plugins twice.`),x.proxy;const C=o(),S=i(h);let p;const v=async()=>(!p&&C in g?p=typeof g[C]=="function"?p=await g[C]():p=g[C]:t!==null&&!p&&"web"in g&&(p=typeof g.web=="function"?p=await g.web():p=g.web),p),m=(N,L)=>{var P,I;if(S){const $=S?.methods.find(D=>L===D.name);if($)return $.rtype==="promise"?D=>r.nativePromise(h,L.toString(),D):(D,j)=>r.nativeCallback(h,L.toString(),D,j);if(N)return(P=N[L])===null||P===void 0?void 0:P.bind(N)}else{if(N)return(I=N[L])===null||I===void 0?void 0:I.bind(N);throw new be(`"${h}" plugin is not implemented on ${C}`,q.Unimplemented)}},E=N=>{let L;const P=(...I)=>{const $=v().then(D=>{const j=m(D,N);if(j){const A=j(...I);return L=A?.remove,A}else throw new be(`"${h}.${N}()" is not implemented on ${C}`,q.Unimplemented)});return N==="addListener"&&($.remove=async()=>L()),$};return P.toString=()=>`${N.toString()}() { [capacitor code] }`,Object.defineProperty(P,"name",{value:N,writable:!1,configurable:!1}),P},y=E("addListener"),w=E("removeListener"),k=(N,L)=>{const P=y({eventName:N},L),I=async()=>{const D=await P;w({eventName:N,callbackId:D},L)},$=new Promise(D=>P.then(()=>D({remove:I})));return $.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await I()},$},T=new Proxy({},{get(N,L){switch(L){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return S?k:y;case"removeListener":return w;default:return E(L)}}});return a[h]=T,l.set(h,{name:h,proxy:T,platforms:new Set([...Object.keys(g),...S?[C]:[]])}),T};return r.convertFileSrc||(r.convertFileSrc=h=>h),r.getPlatform=o,r.handleError=u,r.isNativePlatform=s,r.isPluginAvailable=c,r.registerPlugin=f,r.Exception=be,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},me=(e=>e.Capacitor=_t(e))(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),re=me.registerPlugin;class ne{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(t,r){let a=!1;this.listeners[t]||(this.listeners[t]=[],a=!0),this.listeners[t].push(r);const s=this.windowListeners[t];s&&!s.registered&&this.addWindowListener(s),a&&this.sendRetainedArgumentsForEvent(t);const c=async()=>this.removeListener(t,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,r,a){const o=this.listeners[t];if(!o){if(a){let s=this.retainedEventArguments[t];s||(s=[]),s.push(r),this.retainedEventArguments[t]=s}return}o.forEach(s=>s(r))}hasListeners(t){var r;return!!(!((r=this.listeners[t])===null||r===void 0)&&r.length)}registerWindowListener(t,r){this.windowListeners[r]={registered:!1,windowEventName:t,pluginEventName:r,handler:a=>{this.notifyListeners(r,a)}}}unimplemented(t="not implemented"){return new me.Exception(t,q.Unimplemented)}unavailable(t="not available"){return new me.Exception(t,q.Unavailable)}async removeListener(t,r){const a=this.listeners[t];if(!a)return;const o=a.indexOf(r);this.listeners[t].splice(o,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}sendRetainedArgumentsForEvent(t){const r=this.retainedEventArguments[t];r&&(delete this.retainedEventArguments[t],r.forEach(a=>{this.notifyListeners(t,a)}))}}const Ae=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),_e=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class jt extends ne{async getCookies(){const t=document.cookie,r={};return t.split(";").forEach(a=>{if(a.length<=0)return;let[o,s]=a.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=_e(o).trim(),s=_e(s).trim(),r[o]=s}),r}async setCookie(t){try{const r=Ae(t.key),a=Ae(t.value),o=t.expires?`; expires=${t.expires.replace("expires=","")}`:"",s=(t.path||"/").replace("path=",""),c=t.url!=null&&t.url.length>0?`domain=${t.url}`:"";document.cookie=`${r}=${a||""}${o}; path=${s}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(t){try{document.cookie=`${t.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const t=document.cookie.split(";")||[];for(const r of t)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(t){return Promise.reject(t)}}async clearAllCookies(){try{await this.clearCookies()}catch(t){return Promise.reject(t)}}}re("CapacitorCookies",{web:()=>new jt});const Ot=async e=>new Promise((t,r)=>{const a=new FileReader;a.onload=()=>{const o=a.result;t(o.indexOf(",")>=0?o.split(",")[1]:o)},a.onerror=o=>r(o),a.readAsDataURL(e)}),Mt=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(o=>o.toLocaleLowerCase()).reduce((o,s,c)=>(o[s]=e[t[c]],o),{})},Ht=(e,t=!0)=>e?Object.entries(e).reduce((a,o)=>{const[s,c]=o;let i,u;return Array.isArray(c)?(u="",c.forEach(l=>{i=t?encodeURIComponent(l):l,u+=`${s}=${i}&`}),u.slice(0,-1)):(i=t?encodeURIComponent(c):c,u=`${s}=${i}`),`${a}&${u}`},"").substr(1):null,Bt=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),o=Mt(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(o.includes("application/x-www-form-urlencoded")){const s=new URLSearchParams;for(const[c,i]of Object.entries(e.data||{}))s.set(c,i);r.body=s.toString()}else if(o.includes("multipart/form-data")||e.data instanceof FormData){const s=new FormData;if(e.data instanceof FormData)e.data.forEach((i,u)=>{s.append(u,i)});else for(const i of Object.keys(e.data))s.append(i,e.data[i]);r.body=s;const c=new Headers(r.headers);c.delete("content-type"),r.headers=c}else(o.includes("application/json")||typeof e.data=="object")&&(r.body=JSON.stringify(e.data));return r};class Wt extends ne{async request(t){const r=Bt(t,t.webFetchExtra),a=Ht(t.params,t.shouldEncodeUrlParams),o=a?`${t.url}?${a}`:t.url,s=await fetch(o,r),c=s.headers.get("content-type")||"";let{responseType:i="text"}=s.ok?t:{};c.includes("application/json")&&(i="json");let u,l;switch(i){case"arraybuffer":case"blob":l=await s.blob(),u=await Ot(l);break;case"json":u=await s.json();break;default:u=await s.text()}const f={};return s.headers.forEach((h,g)=>{f[g]=h}),{data:u,headers:f,status:s.status,url:s.url}}async get(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}async post(t){return this.request(Object.assign(Object.assign({},t),{method:"POST"}))}async put(t){return this.request(Object.assign(Object.assign({},t),{method:"PUT"}))}async patch(t){return this.request(Object.assign(Object.assign({},t),{method:"PATCH"}))}async delete(t){return this.request(Object.assign(Object.assign({},t),{method:"DELETE"}))}}re("CapacitorHttp",{web:()=>new Wt});var je;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(je||(je={}));var Oe;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(Oe||(Oe={}));class Yt extends ne{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}re("SystemBars",{web:()=>new Yt});var F;(function(e){e.Heavy="HEAVY",e.Medium="MEDIUM",e.Light="LIGHT"})(F||(F={}));var z;(function(e){e.Success="SUCCESS",e.Warning="WARNING",e.Error="ERROR"})(z||(z={}));const X=re("Haptics",{web:()=>Promise.resolve().then(()=>kn).then(e=>new e.HapticsWeb)}),G=e=>{e().catch(()=>{})},B=()=>G(()=>X.impact({style:F.Light})),ae=()=>G(()=>X.impact({style:F.Medium})),Me=()=>G(()=>X.impact({style:F.Heavy})),He=()=>G(()=>X.notification({type:z.Success})),Ft=()=>G(()=>X.notification({type:z.Warning})),zt=()=>G(()=>X.notification({type:z.Error})),oe=()=>G(()=>X.selectionStart()),Be={ink:"var(--color-ink)",paper:"var(--color-paper)",accent:"var(--color-accent)",noun:"var(--color-noun)",topic:"var(--color-topic)",subject:"var(--color-subject)",object:"var(--color-object)",verb:"var(--color-verb)",particle:"var(--color-particle)",success:"var(--color-success)",warning:"var(--color-warning)",danger:"var(--color-danger)",muted:"var(--color-muted)"},We={bg:"var(--surface-bg)",border:"var(--surface-border)",active:"var(--surface-active)",solid:"var(--surface-solid)",solidHover:"var(--surface-solid-hover)",divider:"var(--surface-divider)",inputBg:"var(--input-bg)",success:"var(--surface-success)",warning:"var(--surface-warning)",danger:"var(--surface-danger)",info:"var(--surface-info)"},Ye={"2xs":"var(--text-2xs)",xs:"var(--text-xs)",sm:"var(--text-sm)",base:"var(--text-base)",md:"var(--text-md)",lg:"var(--text-lg)",xl:"var(--text-xl)","2xl":"var(--text-2xl)","3xl":"var(--text-3xl)"},Fe={sans:"var(--font-sans)",mono:"var(--font-mono)"},ze={0:"var(--space-0)",.5:"var(--space-0-5)",1:"var(--space-1)",1.5:"var(--space-1-5)",2:"var(--space-2)",2.5:"var(--space-2-5)",3:"var(--space-3)",3.5:"var(--space-3-5)",4:"var(--space-4)",5:"var(--space-5)",6:"var(--space-6)",7:"var(--space-7)",8:"var(--space-8)",10:"var(--space-10)",12:"var(--space-12)",16:"var(--space-16)"},Ue="var(--touch-target)",Xe={xs:"var(--radius-xs)",sm:"var(--radius-sm)",md:"var(--radius-md)",lg:"var(--radius-lg)",xl:"var(--radius-xl)",full:"var(--radius-full)"},Ge={xs:"var(--shadow-xs)",sm:"var(--shadow-sm)",md:"var(--shadow-md)",lg:"var(--shadow-lg)",float:"var(--shadow-float)",glow:"var(--shadow-glow)"},Ke={accent:"var(--ring-accent)",input:"var(--ring-input)"},Ve={fast:"var(--duration-fast)",base:"var(--duration-base)",slow:"var(--duration-slow)"},qe={out:"var(--ease-out)",spring:"var(--ease-spring)",inOut:"var(--ease-in-out)"},Je={fast:"var(--transition-fast)",base:"var(--transition-base)",spring:"var(--transition-spring)"},H={base:0,raised:10,overlay:40,modal:50,toast:60,navbar:20,tabBar:30,sheetBackdrop:70,sheet:80,actionSheetBackdrop:70,actionSheet:80,top:9999},Ut={color:Be,surface:We,text:Ye,font:Fe,space:ze,touchTarget:Ue,radius:Xe,shadow:Ge,ring:Ke,duration:Ve,ease:qe,transition:Je,z:H};function Xt({tabs:e,activeTab:t,onChange:r}){return n.jsx("div",{className:"fixed bottom-0 left-0 right-0 flex justify-center pointer-events-none",style:{zIndex:H.tabBar,paddingBottom:"calc(env(safe-area-inset-bottom) + 10px)"},children:n.jsx("div",{className:"pointer-events-auto flex bg-[var(--surface-bg)] backdrop-blur-2xl rounded-full shadow-[0_4px_32px_rgba(0,0,0,0.18)] border border-[var(--surface-border)] p-1.5 gap-1",children:e.map(a=>n.jsx(Gt,{icon:a.icon,label:a.label,active:t===a.id,onClick:()=>{ae(),r(a.id)}},a.id))})})}function Gt({icon:e,label:t,active:r,onClick:a}){return n.jsxs("button",{onClick:a,className:["flex flex-col items-center gap-0.5 px-5 py-2 rounded-full min-w-[72px]","transition-all duration-200 select-none active:scale-[0.93]",r?"bg-[var(--color-ink)]":"bg-transparent"].join(" "),children:[n.jsx("span",{className:`text-lg leading-none font-black ${r?"text-white":"text-gray-400"}`,children:e}),n.jsx("span",{className:`text-[10px] font-mono uppercase tracking-widest ${r?"text-white/70":"text-gray-400"}`,children:t})]})}const ye=d.createContext(null);function Qe(){const e=d.useContext(ye);return()=>e?.current?.()}function Ze({children:e,className:t=""}){const r=d.useRef(()=>{});return n.jsx(ye.Provider,{value:r,children:n.jsx("div",{className:`h-full flex flex-col bg-[var(--color-paper)] ${t}`,children:e})})}function Re({children:e,className:t="",includeTabBarInset:r=!0}){const a=d.useRef(null),o=d.useContext(ye);return d.useEffect(()=>{if(o)return o.current=()=>a.current?.scrollTo({top:0,behavior:"smooth"}),()=>{o&&(o.current=()=>{})}},[o]),n.jsx("div",{ref:a,className:`flex-1 overflow-y-auto overscroll-contain ${t}`,style:{paddingBottom:r?"calc(env(safe-area-inset-bottom) + 80px)":"env(safe-area-inset-bottom)"},children:e})}function Kt({children:e,className:t=""}){return n.jsx(Ze,{className:t,children:e})}function Vt({children:e,className:t=""}){return n.jsx(Re,{includeTabBarInset:!1,className:t,children:e})}function qt({title:e,left:t,right:r}){const{pop:a}=ge(),o=$t(),s=Qe(),c=o>0,i=n.jsx("button",{onClick:()=>{ae(),a()},className:"flex items-center gap-1 text-[var(--color-accent)] font-mono text-xs tracking-wider min-h-[44px] min-w-[44px] active:opacity-40 transition-opacity",children:"← back"});return n.jsxs("header",{className:"shrink-0 bg-[var(--surface-bg)] backdrop-blur-2xl flex flex-col",style:{paddingTop:"env(safe-area-inset-top)"},children:[n.jsxs("div",{className:"h-11 flex items-center px-3 gap-1",children:[n.jsx("div",{className:"w-24 flex items-center",children:t!==void 0?t:c?i:null}),n.jsx("div",{className:"flex-1 flex justify-center",children:n.jsx("button",{onClick:s,className:"text-[15px] font-semibold text-[var(--color-ink)] truncate active:opacity-60 transition-opacity",children:e})}),n.jsx("div",{className:"w-24 flex items-center justify-end",children:r})]}),n.jsx("div",{className:"h-px bg-[var(--surface-divider)]"})]})}function Jt({children:e,className:t="",onClick:r}){const a=!!r;return n.jsx("div",{onClick:r,className:["bg-[var(--surface-solid)] rounded-2xl border border-[var(--surface-border)] shadow-sm p-5",a?"cursor-pointer active:scale-[0.98] active:shadow-none active:bg-[var(--surface-active)] transition-all select-none":"",t].join(" "),children:e})}const et=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])',"summary",'[contenteditable="true"]'].join(", ");function tt(e,t,r){const a=d.useRef(null);d.useEffect(()=>{if(!t){a.current&&a.current instanceof HTMLElement&&a.current.focus({preventScroll:!0}),a.current=null;return}a.current=document.activeElement;const s=setTimeout(()=>{const i=e.current;if(!i)return;const u=Array.from(i.querySelectorAll(et)).filter(l=>!l.closest('[aria-hidden="true"]'));u.length>0?u[0].focus({preventScroll:!0}):(i.tabIndex=-1,i.focus({preventScroll:!0}))},80),c=i=>{if(i.key==="Escape"){i.preventDefault(),r?.();return}if(i.key!=="Tab")return;const u=e.current;if(!u)return;const l=Array.from(u.querySelectorAll(et)).filter(g=>!g.closest('[aria-hidden="true"]'));if(l.length===0)return;const f=l[0],h=l[l.length-1];i.shiftKey?document.activeElement===f&&(i.preventDefault(),h.focus({preventScroll:!0})):document.activeElement===h&&(i.preventDefault(),f.focus({preventScroll:!0}))};return document.addEventListener("keydown",c),()=>{clearTimeout(s),document.removeEventListener("keydown",c)}},[t,e,r])}const Qt={sm:16,md:24,lg:36},Zt={sm:2,md:2.5,lg:3};function rt({size:e,color:t,ariaLabel:r,className:a=""}){const o=Qt[e],s=Zt[e],c=(o-s*2)/2,i=o/2,u=2*Math.PI*c,l=u*.75,f=u*.25;return n.jsxs("svg",{role:"progressbar","aria-label":r,"aria-valuetext":r,width:o,height:o,viewBox:`0 0 ${o} ${o}`,fill:"none",className:["kami-spinner",a].filter(Boolean).join(" "),style:{animationName:"kami-spin",animationDuration:"0.8s",animationTimingFunction:"linear",animationIterationCount:"infinite",flexShrink:0,display:"block"},children:[n.jsx("circle",{cx:i,cy:i,r:c,stroke:t,strokeWidth:s,strokeOpacity:.2}),n.jsx("circle",{cx:i,cy:i,r:c,stroke:t,strokeWidth:s,strokeLinecap:"round",strokeDasharray:`${l} ${f}`,strokeDashoffset:0})]})}function xe({size:e="md",color:t="var(--color-accent)","aria-label":r="Loading",className:a=""}){return n.jsx(rt,{size:e,color:t,ariaLabel:r,className:a})}function nt({visible:e,label:t,backdropOpacity:r=.5}){const a=d.useRef(null);return tt(a,e),d.useEffect(()=>{if(!e)return;const o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o}},[e]),e?n.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t??"Loading","aria-busy":"true",ref:a,style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:16,backgroundColor:`rgba(0, 0, 0, ${r})`,backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},children:n.jsxs("div",{style:{background:"var(--surface-solid)",borderRadius:20,padding:"28px 36px",display:"flex",flexDirection:"column",alignItems:"center",gap:14,boxShadow:"var(--shadow-float)",minWidth:120},children:[n.jsx(rt,{size:"lg",color:"var(--color-accent)",ariaLabel:t??"Loading"}),t&&n.jsx("p",{style:{fontSize:15,fontWeight:500,color:"var(--color-ink)",margin:0,lineHeight:1.3,textAlign:"center"},children:t})]})}):null}xe.Overlay=nt;const Rt={primary:"bg-[var(--color-ink)] text-[var(--color-paper)] active:opacity-75",secondary:"bg-[var(--input-bg)] text-[var(--color-ink)] active:bg-[var(--surface-divider)]",ghost:"text-[var(--color-accent)] active:opacity-50"},er={primary:"var(--color-paper)",secondary:"var(--color-ink)",ghost:"var(--color-accent)"};function at({children:e,onClick:t,variant:r="primary",disabled:a=!1,loading:o=!1,className:s="",fullWidth:c=!1,type:i="button","aria-label":u,"aria-pressed":l,"aria-expanded":f,"aria-controls":h}){const g=a||o;return n.jsxs("button",{type:i,onClick:t,disabled:g,"aria-label":u,"aria-pressed":l,"aria-expanded":f,"aria-controls":h,"aria-busy":o||void 0,className:["min-h-[44px] px-5 rounded-xl font-semibold text-[15px]","transition-all select-none","relative flex items-center justify-center gap-2",c?"w-full":"",Rt[r],g?"opacity-40 pointer-events-none":"",s].join(" "),children:[o&&n.jsx(xe,{size:"sm",color:er[r],"aria-label":"Loading"}),n.jsx("span",{className:o?"opacity-0 select-none pointer-events-none absolute":"",children:e})]})}function tr({children:e,className:t="",inset:r=!1}){return n.jsx("div",{className:["bg-white overflow-hidden",r?"mx-4 rounded-2xl border border-gray-100 shadow-sm":"border-y border-gray-100",t].join(" "),children:n.jsx("div",{className:"divide-y divide-gray-100",children:e})})}function rr({title:e,subtitle:t,media:r,after:a,chevron:o=!1,onClick:s,className:c=""}){const i=s?"button":"div";return n.jsxs(i,{onClick:s,className:["w-full text-left flex items-center gap-3 px-4 py-3","min-h-[44px] select-none",s?"active:bg-gray-50 transition-colors cursor-pointer":"",c].join(" "),children:[r&&n.jsx("div",{className:"shrink-0 flex items-center justify-center",children:r}),n.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[n.jsx("p",{className:"text-[15px] font-medium text-[var(--color-ink)] leading-snug",children:e}),t&&n.jsx("p",{className:"text-[13px] text-gray-500 mt-0.5 leading-snug",children:t})]}),a&&n.jsx("div",{className:"shrink-0 text-[13px] text-gray-400",children:a}),o&&n.jsx("span",{className:"shrink-0 text-gray-300 text-lg leading-none",children:"›"})]})}function nr({children:e,className:t=""}){return n.jsx("p",{className:`text-xs font-mono text-gray-400 uppercase tracking-widest px-4 pt-6 pb-2 ${t}`,children:e})}function O({className:e="",style:t}){return n.jsx("div",{"aria-hidden":"true",className:["animate-pulse rounded-lg bg-[var(--input-bg)]",e].join(" "),style:t})}function ot({lines:e=1,className:t=""}){return n.jsx("div",{className:["space-y-2",t].join(" "),"aria-hidden":"true",children:Array.from({length:e}).map((r,a)=>n.jsx(O,{className:["h-3",a===e-1&&e>1?"w-3/5":"w-full"].join(" ")},a))})}function ar({size:e=40,className:t=""}){return n.jsx(O,{className:["rounded-full shrink-0",t].join(" "),style:{width:e,height:e}})}function or({width:e="100%",height:t=12,className:r="",style:a}){return n.jsx(O,{className:r,style:{width:e,height:t,...a}})}function st({className:e=""}){return n.jsxs("div",{"aria-hidden":"true",className:["bg-[var(--surface-bg)] rounded-3xl border border-[var(--surface-border)]","shadow-[0_2px_16px_rgba(0,0,0,0.06)] p-5 space-y-3",e].join(" "),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(O,{className:"w-2 h-2 rounded-full"}),n.jsx(O,{className:"h-2.5 w-20"})]}),n.jsx(O,{className:"h-4 w-4/5"}),n.jsx(O,{className:"h-3 w-3/5"})]})}function sr({className:e=""}){return n.jsxs("div",{"aria-hidden":"true",className:["bg-[var(--surface-bg)] rounded-3xl border border-[var(--surface-border)]","shadow-[0_2px_16px_rgba(0,0,0,0.06)] p-5 space-y-2.5",e].join(" "),children:[n.jsx(O,{className:"h-2.5 w-24"}),n.jsx(O,{className:"h-7 w-2/3"}),n.jsx(O,{className:"h-2.5 w-1/2"}),n.jsx(O,{className:"h-3 w-4/5"})]})}function ir({className:e=""}){return n.jsxs("div",{"aria-hidden":"true",className:["bg-[var(--surface-solid)] rounded-2xl border border-[var(--surface-border)]","shadow-sm p-5 space-y-3",e].join(" "),children:[n.jsx(O,{className:"h-4 w-3/4"}),n.jsx(ot,{lines:2})]})}function lr({count:e=6,className:t=""}){return n.jsx("div",{className:["grid grid-cols-1 md:grid-cols-2 gap-3",t].join(" "),children:Array.from({length:e}).map((r,a)=>n.jsx(st,{},a))})}const cr={Box:O,Text:ot,Circle:ar,Line:or,LessonCard:st,PhraseCard:sr,Card:ir,LessonGrid:lr};function it({title:e="Something went wrong",message:t,onRetry:r,className:a=""}){return n.jsxs("div",{className:["flex flex-col items-center justify-center text-center py-12 px-6 space-y-3",a].join(" "),children:[n.jsx("span",{className:"text-4xl select-none","aria-hidden":"true",children:"⚠️"}),n.jsx("p",{className:"font-bold text-[var(--color-ink)] text-base",children:e}),t&&n.jsx("p",{className:"text-sm text-[var(--color-muted)] font-mono leading-snug max-w-xs",children:t}),r&&n.jsx("button",{onClick:r,className:["mt-2 px-5 py-2 rounded-xl text-sm font-semibold","bg-[var(--color-accent)] text-white","active:opacity-70 transition-opacity"].join(" "),children:"Try again"})]})}class dr extends d.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){this.props.onError?.(t,r),Promise.resolve().then(()=>{}).catch(()=>{})}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback!==void 0?this.props.fallback:n.jsx(it,{title:"Something went wrong",message:this.state.error?.message,onRetry:this.handleRetry}):this.props.children}}const lt=d.createContext(null);function ur(){const e=d.useContext(lt);if(!e)throw new Error("useToast must be used within <ToastProvider>");return e}const fr={default:{bg:"bg-[var(--color-ink)] text-white dark:bg-[var(--surface-solid)]",icon:""},success:{bg:"bg-[var(--surface-success)] text-[var(--color-success)]",icon:"✓"},error:{bg:"bg-[var(--surface-danger)] text-[var(--color-danger)]",icon:"✕"},info:{bg:"bg-[var(--surface-info)] text-[var(--color-subject)]",icon:"ℹ"},warning:{bg:"bg-[var(--surface-warning)] text-[var(--color-warning)]",icon:"⚠"}};function ct({item:e,onDismiss:t}){const r=fr[e.variant],a=d.useRef(null),o=d.useCallback(s=>{s&&s.animate([{opacity:0,transform:"translateY(16px) scale(0.96)"},{opacity:1,transform:"translateY(0) scale(1)"}],{duration:260,easing:"cubic-bezier(0.34, 1.28, 0.64, 1)",fill:"forwards"})},[]);return n.jsx("div",{ref:a,style:{opacity:e.exiting?0:void 0,transition:e.exiting?"opacity 200ms ease":void 0},children:n.jsxs("div",{ref:o,className:["flex items-center gap-2 px-4 py-3 rounded-2xl shadow-[var(--shadow-md)]","max-w-[calc(100vw-48px)] min-w-[180px]",r.bg].join(" "),children:[r.icon&&n.jsx("span",{className:"text-base font-bold shrink-0 leading-none",children:r.icon}),n.jsx("span",{className:"text-sm font-semibold leading-snug flex-1",children:e.message}),e.action&&n.jsx("button",{onClick:()=>{e.action.onPress(),t(e.id)},className:"text-xs font-bold opacity-70 hover:opacity-100 uppercase tracking-wide shrink-0 active:opacity-50 pl-2",children:e.action.label})]})})}let hr=1;function pr({children:e}){const[t,r]=d.useState([]),a=d.useCallback(i=>{r(u=>u.map(l=>l.id===i?{...l,exiting:!0}:l)),setTimeout(()=>{r(u=>u.filter(l=>l.id!==i))},220)},[]),o=d.useCallback((i,u={})=>{const l=hr++,f=u.duration??2600,h={id:l,message:i,variant:u.variant??"default",duration:f,position:u.position??"bottom",action:u.action,exiting:!1};r(g=>[...g.slice(-3),h]),setTimeout(()=>a(l),f)},[a]),s=t.filter(i=>i.position==="bottom"),c=t.filter(i=>i.position==="top");return n.jsxs(lt.Provider,{value:{show:o},children:[e,s.length>0&&n.jsx("div",{className:"fixed inset-x-0 bottom-0 flex flex-col items-center gap-2 pb-[calc(env(safe-area-inset-bottom)+68px)] pointer-events-none",style:{zIndex:H.toast},"aria-live":"polite","aria-atomic":"true",children:s.map(i=>n.jsx("div",{className:"pointer-events-auto",children:n.jsx(ct,{item:i,onDismiss:a})},i.id))}),c.length>0&&n.jsx("div",{className:"fixed inset-x-0 top-0 flex flex-col items-center gap-2 pt-[calc(env(safe-area-inset-top)+12px)] pointer-events-none",style:{zIndex:H.toast},"aria-live":"polite","aria-atomic":"true",children:c.map(i=>n.jsx("div",{className:"pointer-events-auto",children:n.jsx(ct,{item:i,onDismiss:a})},i.id))})]})}const se={enter:{duration:360,easing:"cubic-bezier(0.34, 1.28, 0.64, 1)"},exit:{duration:240,easing:"cubic-bezier(0.4, 0, 0.6, 1)"}};function we({open:e,onClose:t,title:r,children:a}){const o=d.useRef(null),s=d.useRef(null),c=d.useRef(!1);d.useEffect(()=>{const f=o.current,h=s.current;if(!(!f||!h)){if(e&&!c.current)f.style.display="block",h.style.display="block",f.animate([{opacity:0},{opacity:1}],{...se.enter,fill:"forwards"}),h.animate([{transform:"translateY(100%)"},{transform:"translateY(0)"}],{...se.enter,fill:"forwards"});else if(!e&&c.current){const g=f.animate([{opacity:1},{opacity:0}],{...se.exit,fill:"forwards"});h.animate([{transform:"translateY(0)"},{transform:"translateY(100%)"}],{...se.exit,fill:"forwards"}),g.onfinish=()=>{f.style.display="none",h.style.display="none"}}c.current=e}},[e]);const i=d.useRef(null),u=d.useCallback(f=>{i.current=f.touches[0].clientY},[]),l=d.useCallback(f=>{if(i.current===null)return;f.changedTouches[0].clientY-i.current>60&&t(),i.current=null},[t]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:o,style:{display:"none",zIndex:H.sheetBackdrop},className:"fixed inset-0 bg-black/40 backdrop-blur-sm",onClick:t,"aria-hidden":"true"}),n.jsxs("div",{ref:s,role:"dialog","aria-modal":"true","aria-label":r,style:{display:"none",zIndex:H.sheet},className:["fixed inset-x-0 bottom-0","bg-[var(--surface-solid)] rounded-t-[28px]","shadow-[var(--shadow-float)]","max-h-[90dvh] flex flex-col"].join(" "),children:[n.jsxs("div",{className:"flex flex-col items-center pt-3 pb-2 cursor-grab active:cursor-grabbing select-none shrink-0",onTouchStart:u,onTouchEnd:l,children:[n.jsx("div",{className:"w-9 h-1 bg-[var(--surface-divider)] rounded-full mb-3"}),r&&n.jsx("p",{className:"text-[17px] font-semibold text-[var(--color-ink)] pb-1",children:r})]}),n.jsx("div",{className:"overflow-y-auto px-4 pb-[calc(env(safe-area-inset-bottom)+16px)] flex-1",children:a})]})]})}const J={enter:{duration:340,easing:"cubic-bezier(0.34, 1.28, 0.64, 1)"},exit:{duration:200,easing:"cubic-bezier(0.4, 0, 0.6, 1)"}};function vr({open:e,onClose:t,title:r,actions:a}){const o=d.useRef(null),s=d.useRef(null),c=d.useRef(null),i=d.useRef(!1);d.useEffect(()=>{const l=o.current,f=s.current,h=c.current;if(!(!l||!f||!h)){if(e&&!i.current)l.style.display="block",f.style.display="block",h.style.display="block",l.animate([{opacity:0},{opacity:1}],{...J.enter,fill:"forwards"}),f.animate([{opacity:0,transform:"translateY(20px) scale(0.97)"},{opacity:1,transform:"translateY(0) scale(1)"}],{...J.enter,fill:"forwards"}),h.animate([{opacity:0,transform:"translateY(10px)"},{opacity:1,transform:"translateY(0)"}],{...J.enter,delay:40,fill:"forwards"});else if(!e&&i.current){const g=l.animate([{opacity:1},{opacity:0}],{...J.exit,fill:"forwards"});f.animate([{opacity:1,transform:"translateY(0) scale(1)"},{opacity:0,transform:"translateY(12px) scale(0.97)"}],{...J.exit,fill:"forwards"}),h.animate([{opacity:1},{opacity:0}],{...J.exit,fill:"forwards"}),g.onfinish=()=>{l.style.display="none",f.style.display="none",h.style.display="none"}}i.current=e}},[e]);const u=l=>{l.disabled||(t(),setTimeout(()=>l.onPress(),160))};return n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:o,style:{display:"none",zIndex:H.actionSheetBackdrop},className:"fixed inset-0 bg-black/30 backdrop-blur-[2px]",onClick:t,"aria-hidden":"true"}),n.jsxs("div",{ref:s,role:"dialog","aria-modal":"true","aria-label":r??"Action sheet",style:{display:"none",zIndex:H.actionSheet},className:["fixed inset-x-4","bottom-[calc(env(safe-area-inset-bottom)+76px)]","bg-[var(--surface-solid)] rounded-[20px]","shadow-[var(--shadow-float)]","overflow-hidden"].join(" "),children:[r&&n.jsx("div",{className:"px-4 pt-4 pb-3 border-b border-[var(--surface-divider)]",children:n.jsx("p",{className:"text-xs text-gray-400 text-center font-medium leading-snug",children:r})}),a.map((l,f)=>n.jsx("button",{onClick:()=>u(l),disabled:l.disabled,className:["w-full px-4 py-[15px] text-left text-[17px] font-medium","active:bg-[var(--surface-active)] transition-colors",f>0?"border-t border-[var(--surface-divider)]":"",l.destructive?"text-[var(--color-danger)]":"text-[var(--color-ink)]",l.disabled?"opacity-40 cursor-not-allowed":""].join(" "),children:l.label},f))]}),n.jsx("button",{ref:c,onClick:t,style:{display:"none",zIndex:H.actionSheet},className:["fixed inset-x-4","bottom-[calc(env(safe-area-inset-bottom)+8px)]","bg-[var(--surface-solid)] rounded-[20px]","py-[15px] text-center text-[17px] font-semibold text-[var(--color-accent)]","shadow-[var(--shadow-float)]","active:bg-[var(--surface-active)] transition-colors"].join(" "),children:"Cancel"})]})}function Z(){const e=window.visualViewport?.height??window.innerHeight,t=`${Math.round(e)}px`;document.documentElement.style.setProperty("--app-height",t);const r=document.getElementById("root");r&&(r.style.height="var(--app-height)",r.style.overflow="hidden"),document.documentElement.style.height="var(--app-height)",document.body.style.height="var(--app-height)",document.body.style.overflow="hidden"}function gr({children:e,lockZoom:t=!0}){return d.useEffect(()=>{const r=document.querySelector('meta[name="viewport"]'),a=r?.getAttribute("content")??null,o=document.getElementById("root"),s=o?.style.height??"",c=o?.style.overflow??"",i=document.documentElement.style.height,u=document.body.style.height,l=document.body.style.overflow;t&&r&&r.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover");const f=x=>x.preventDefault(),h=x=>{x.touches.length>1&&x.preventDefault()},g=x=>{x.ctrlKey&&x.preventDefault()};return t&&(document.addEventListener("gesturestart",f,{passive:!1}),document.addEventListener("gesturechange",f,{passive:!1}),document.addEventListener("gestureend",f,{passive:!1}),document.addEventListener("touchmove",h,{passive:!1}),window.addEventListener("wheel",g,{passive:!1})),Z(),window.addEventListener("resize",Z),window.visualViewport?.addEventListener("resize",Z),()=>{window.removeEventListener("resize",Z),window.visualViewport?.removeEventListener("resize",Z),t&&(document.removeEventListener("gesturestart",f),document.removeEventListener("gesturechange",f),document.removeEventListener("gestureend",f),document.removeEventListener("touchmove",h),window.removeEventListener("wheel",g)),r&&a&&r.setAttribute("content",a),o&&(o.style.height=s,o.style.overflow=c),document.documentElement.style.height=i,document.body.style.height=u,document.body.style.overflow=l}},[t]),n.jsx(n.Fragment,{children:e})}const dt=d.createContext(null);function br(){const e=d.useContext(dt);if(!e)throw new Error("useOverlayNavigator must be used within <OverlayNavigatorProvider>");return e}function mr({page:e,onClosed:t}){const{push:r,canGoBack:a}=ge(),o=d.useRef(!1),s=d.useRef(!1);return d.useEffect(()=>{o.current||(o.current=!0,requestAnimationFrame(()=>r(e)))},[e,r]),d.useEffect(()=>{if(o.current){if(a){s.current=!0;return}s.current&&t()}},[a,t]),n.jsx("div",{className:"h-full w-full pointer-events-none"})}function yr({children:e}){const[t,r]=d.useState(null),a=d.useCallback(()=>r(null),[]),o=d.useCallback(s=>r(s),[]);return n.jsxs(dt.Provider,{value:{present:o,dismiss:a,isPresented:t!==null},children:[e,t&&Dt.createPortal(n.jsx("div",{className:"fixed inset-0",style:{zIndex:H.sheet},children:n.jsx($e,{initialPage:n.jsx(mr,{page:t,onClosed:a})})}),document.body)]})}function ie(e={}){const{stiffness:t=200,damping:r=26,mass:a=1,dt:o=8,maxDuration:s=1200}=e,c=[];let i=0,u=0,l=0;const f=.002;for(;l<s;){const h=(-t*(i-1)-r*u)/a;if(u=u+h*(o/1e3),i=i+u*(o/1e3),c.push(i),l+=o,Math.abs(i-1)<f&&Math.abs(u)<f)break}return c.length===0&&c.push(1),c[c.length-1]=1,{values:c,duration:c.length*o}}const le={default:{stiffness:200,damping:26,mass:1},bouncy:{stiffness:300,damping:18,mass:1},snappy:{stiffness:400,damping:35,mass:1},gentle:{stiffness:100,damping:22,mass:1.2},smooth:{stiffness:220,damping:32,mass:1}};function ut(){return[{opacity:0},{opacity:1}]}function ft(){return[{opacity:1},{opacity:0}]}function xr(e,t,r=le.default){const{values:a}=ie(r);return a.map(o=>({transform:wr(e,t,o),offset:void 0}))}function wr(e,t,r){const a=parseFloat(e)||0,o=parseFloat(t)||0,s=a+(o-a)*r;return e.replace(/[-\d.]+/,String(Math.round(s*100)/100))}const ke=e=>({duration:e,fill:"forwards"});function ce(e,t,r=le.default){const{duration:a}=ie(r);return{enter:{keyframes:[{opacity:0,transform:e},{opacity:1,transform:"translateX(0) translateY(0) scale(1)"}],timing:{...ke(a),easing:"cubic-bezier(0.34, 1.28, 0.64, 1)"}},exit:{keyframes:[{opacity:1,transform:"translateX(0) translateY(0) scale(1)"},{opacity:0,transform:t}],timing:ke(200)}}}const kr={slideUp:ce("translateY(20px) scale(0.97)","translateY(12px) scale(0.98)"),slideDown:ce("translateY(-20px) scale(0.97)","translateY(-12px) scale(0.98)"),slideRight:ce("translateX(100%)","translateX(30%)"),slideLeft:ce("translateX(-30%)","translateX(100%)"),scale:{enter:{keyframes:[{opacity:0,transform:"scale(0.92)"},{opacity:1,transform:"scale(1)"}],timing:{duration:ie(le.default).duration,fill:"forwards",easing:"cubic-bezier(0.34, 1.28, 0.64, 1)"}},exit:{keyframes:[{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.95)"}],timing:ke(200)}},fade:{enter:{keyframes:ut(),timing:{duration:220,fill:"forwards",easing:"ease-out"}},exit:{keyframes:ft(),timing:{duration:160,fill:"forwards",easing:"ease-in"}}}};function Y(e,{keyframes:t,timing:r}){return e?e.animate(t,r):null}function Sr(e,t,r){const s="cubic-bezier(0.28, 0.64, 0.34, 1)",c="cubic-bezier(0.22, 0.61, 0.36, 1)";switch(r){case"push":{Y(e,{keyframes:[{transform:"translateX(100%)",opacity:.8},{transform:"translateX(0)",opacity:1}],timing:{duration:360,fill:"forwards",easing:s}}),Y(t,{keyframes:[{transform:"translateX(0)",opacity:1},{transform:"translateX(-28%)",opacity:.6}],timing:{duration:360,fill:"forwards",easing:s}});break}case"pop":{Y(e,{keyframes:[{transform:"translateX(-28%)",opacity:.6},{transform:"translateX(0)",opacity:1}],timing:{duration:300,fill:"forwards",easing:c}}),Y(t,{keyframes:[{transform:"translateX(0)",opacity:1},{transform:"translateX(100%)",opacity:.8}],timing:{duration:300,fill:"forwards",easing:c}});break}case"modal":{Y(e,{keyframes:[{transform:"translateY(100%)",opacity:.9},{transform:"translateY(0)",opacity:1}],timing:{duration:360,fill:"forwards",easing:s}});break}case"dismiss":{Y(t,{keyframes:[{transform:"translateY(0)",opacity:1},{transform:"translateY(100%)",opacity:.9}],timing:{duration:300,fill:"forwards",easing:c}});break}}}function Er(e){const t=d.useRef(null),r=d.useCallback(()=>{const o=Y(t.current,e.enter);return o?new Promise(s=>{o.onfinish=()=>s()}):Promise.resolve()},[e]),a=d.useCallback(()=>{const o=Y(t.current,e.exit);return o?new Promise(s=>{o.onfinish=()=>s()}):Promise.resolve()},[e]);return[t,r,a]}function Cr({label:e,helper:t,error:r,type:a="text",value:o,onChange:s,placeholder:c,disabled:i=!1,clearable:u=!1,leadingIcon:l,className:f=""}){const h=d.useId(),g=d.useRef(null),[x,C]=d.useState(!1),S=a==="password",p=S&&x?"text":a,v=o!==void 0&&o!=="",m=!!r,E=m?"focus-within:shadow-[0_0_0_3px_rgba(230,57,70,0.28)]":"focus-within:shadow-[0_0_0_3px_rgba(67,97,238,0.24)]";return n.jsxs("div",{className:`flex flex-col gap-1.5 ${f}`,children:[e&&n.jsx("label",{htmlFor:h,className:"text-[13px] font-medium text-[var(--color-ink)] px-1",children:e}),n.jsxs("div",{className:["flex items-center gap-2 px-3 rounded-xl min-h-[44px]","bg-[var(--input-bg)] transition-shadow duration-150",E,m?"shadow-[0_0_0_1.5px_rgba(230,57,70,0.5)]":"",i?"opacity-40 pointer-events-none":""].join(" "),onClick:()=>g.current?.focus(),children:[l&&n.jsx("span",{className:"shrink-0 text-[var(--color-muted)] text-[17px] leading-none select-none",children:l}),n.jsx("input",{ref:g,id:h,type:p,value:o,onChange:y=>s?.(y.target.value),placeholder:c,disabled:i,autoCapitalize:a==="email"||S?"none":void 0,autoCorrect:S||a==="email"?"off":void 0,spellCheck:S?!1:void 0,className:["flex-1 min-w-0 bg-transparent outline-none select-text","text-[15px] text-[var(--color-ink)] placeholder:text-[var(--color-muted)]","leading-none py-3"].join(" ")}),u&&v&&!S&&n.jsx("button",{type:"button",onPointerDown:y=>{y.preventDefault(),s?.(""),g.current?.focus()},className:"shrink-0 flex items-center justify-center w-5 h-5 rounded-full bg-[var(--color-muted)] opacity-60 active:opacity-40 transition-opacity","aria-label":"Clear",children:n.jsx("span",{className:"text-white text-[11px] font-bold leading-none select-none",children:"✕"})}),S&&n.jsx("button",{type:"button",onPointerDown:y=>{y.preventDefault(),C(w=>!w)},className:"shrink-0 text-[var(--color-muted)] text-[15px] leading-none min-w-[28px] min-h-[28px] flex items-center justify-center active:opacity-40 transition-opacity","aria-label":x?"Hide password":"Show password",children:x?"🙈":"👁"})]}),(t||r)&&n.jsx("p",{className:["text-[12px] px-1 leading-snug",m?"text-[var(--color-danger)]":"text-[var(--color-muted)]"].join(" "),children:r??t})]})}const Pr={default:"bg-[var(--surface-solid-hover)] text-[var(--color-ink)] border border-[var(--surface-divider)]",primary:"bg-[var(--color-accent)] text-white",success:"bg-[var(--surface-success)] text-[var(--color-success)]",warning:"bg-[var(--surface-warning)] text-[#7a5c00]",danger:"bg-[var(--surface-danger)] text-[var(--color-danger)]",muted:"bg-[var(--input-bg)] text-[var(--color-muted)]"},Lr={sm:"text-[10px] px-1.5 py-px font-bold tracking-wide leading-none",md:"text-[12px] px-2 py-0.5 font-semibold leading-none"};function Tr({children:e,variant:t="default",size:r="md",className:a=""}){return n.jsx("span",{className:["inline-flex items-center justify-center rounded-full select-none whitespace-nowrap",Pr[t],Lr[r],a].join(" "),children:e})}function ht({label:e,selected:t=!1,onToggle:r,disabled:a=!1,icon:o,className:s=""}){return n.jsxs("button",{type:"button",onClick:()=>!a&&r?.(!t),disabled:a,className:["inline-flex items-center gap-1.5 px-3.5 rounded-full select-none","min-h-[34px]","transition-all duration-150",t?"bg-[var(--color-ink)] text-white shadow-[var(--shadow-xs)]":"bg-[var(--input-bg)] text-[var(--color-ink)] border border-[var(--surface-divider)]",a?"opacity-40 pointer-events-none":"active:scale-[0.94] active:opacity-80",s].join(" "),children:[o&&n.jsx("span",{className:"text-[13px] leading-none",children:o}),n.jsx("span",{className:"text-[13px] font-medium leading-none whitespace-nowrap",children:e}),t&&n.jsx("span",{className:"text-[10px] leading-none opacity-70",children:"✓"})]})}function Nr({options:e,value:t,onChange:r,multi:a=!1,className:o=""}){const s=Array.isArray(t)?t:[t],c=i=>{if(a){const u=s,l=u.includes(i)?u.filter(f=>f!==i):[...u,i];r(l)}else r(i)};return n.jsx("div",{className:`flex gap-2 overflow-x-auto pb-1 ${o}`,style:{scrollbarWidth:"none",WebkitOverflowScrolling:"touch"},children:e.map(i=>n.jsx(ht,{label:i.label,icon:i.icon,selected:s.includes(i.value),onToggle:()=>c(i.value)},i.value))})}const pt="cubic-bezier(0.34, 1.56, 0.64, 1)",vt="0.32s";function Ir({options:e,value:t,onChange:r,size:a="md",fullWidth:o=!0,className:s="","aria-label":c}){const i=d.useId(),u=e.length,l=Math.max(0,e.findIndex(v=>v.value===t)),f=a==="sm"?"30px":"36px",h=a==="sm"?"12px":"13px",g="500",x=2,C=`calc((100% - ${x*2}px) / ${u})`,S=`calc(${x}px + ${l} * (100% - ${x*2}px) / ${u})`,p=v=>{const m=e.map((w,k)=>({o:w,i:k})).filter(({o:w})=>!w.disabled).map(({i:w})=>w),E=m.indexOf(l);let y=null;if(v.key==="ArrowRight"||v.key==="ArrowDown"?(v.preventDefault(),y=(E+1)%m.length):v.key==="ArrowLeft"||v.key==="ArrowUp"?(v.preventDefault(),y=(E-1+m.length)%m.length):v.key==="Home"?(v.preventDefault(),y=0):v.key==="End"&&(v.preventDefault(),y=m.length-1),y!==null){const w=m[y];r(e[w].value)}};return n.jsxs("div",{role:"tablist","aria-label":c??"Segmented control",onKeyDown:p,className:s,style:{position:"relative",display:"inline-flex",width:o?"100%":"auto",height:f,backgroundColor:"var(--input-bg)",borderRadius:"var(--radius-sm)",padding:`${x}px`,boxSizing:"border-box",boxShadow:"inset 0 1px 3px rgba(0,0,0,0.12)"},children:[n.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:`${x}px`,left:S,width:C,bottom:`${x}px`,borderRadius:`calc(var(--radius-sm) - ${x}px)`,backgroundColor:"var(--surface-solid)",boxShadow:"var(--shadow-xs)",transition:`left ${vt} ${pt}`,pointerEvents:"none",willChange:"left"}}),e.map((v,m)=>{const E=m===l,y=v.disabled===!0,w=`${i}-tab-${v.value}`;return n.jsxs("button",{id:w,role:"tab",type:"button","aria-selected":E,"aria-disabled":y,tabIndex:E?0:-1,disabled:y,onClick:()=>!y&&r(v.value),style:{flex:1,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"0 4px",minWidth:0,fontSize:h,fontWeight:g,fontFamily:"var(--font-sans)",lineHeight:1,whiteSpace:"nowrap",userSelect:"none",color:E?"var(--color-ink)":"var(--color-muted)",opacity:y?.38:1,transition:`color ${vt} ${pt}, opacity 150ms ease`,background:"transparent",border:"none",outline:"none",cursor:y?"not-allowed":"pointer",WebkitTapHighlightColor:"transparent",borderRadius:`calc(var(--radius-sm) - ${x}px)`},children:[v.icon&&n.jsx("span",{style:{fontSize:a==="sm"?"11px":"13px",lineHeight:1,flexShrink:0},children:v.icon}),n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:v.label})]},v.value)})]})}const Dr={xs:3,sm:6,md:8,lg:12},$r={accent:"var(--color-accent)",success:"var(--color-success)",warning:"var(--color-warning)",danger:"var(--color-danger)",muted:"var(--color-muted)"};function Ar({value:e,max:t=100,size:r="sm",variant:a="accent",showLabel:o=!1,label:s,animated:c=!0,"aria-label":i,className:u=""}){const l=Math.max(0,Math.min(e,t)),f=t>0?l/t*100:0,h=Dr[r],g=$r[a],x=s??(t!==100?`${l} / ${t}`:null),C=f>0?`${Math.round(f)}%`:null;return n.jsxs("div",{className:u,style:{width:"100%"},children:[o&&(x||C)&&n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[x&&n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono)",color:"var(--color-muted)",lineHeight:1},children:x}),C&&n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono)",color:g,lineHeight:1},children:C})]}),n.jsx("div",{role:"progressbar","aria-valuenow":Math.round(f),"aria-valuemin":0,"aria-valuemax":100,"aria-label":i??"Progress",style:{position:"relative",width:"100%",height:h,borderRadius:9999,backgroundColor:"var(--input-bg)",overflow:"hidden"},children:n.jsx("div",{style:{position:"absolute",inset:0,right:"auto",width:`${f}%`,borderRadius:9999,backgroundColor:g,transition:c?"width 0.5s cubic-bezier(0.4, 0, 0.2, 1)":void 0,...r==="lg"||r==="md"?{backgroundImage:`linear-gradient(
|
|
2
|
+
90deg,
|
|
3
|
+
${g} 0%,
|
|
4
|
+
color-mix(in srgb, ${g} 80%, white) 50%,
|
|
5
|
+
${g} 100%
|
|
6
|
+
)`}:{}}})})]})}function _r({total:e,current:t,dotSize:r=8,gap:a=6,"aria-label":o,className:s=""}){const c=Math.max(0,Math.min(t,e-1)),i=r*2;return n.jsx("div",{role:"tablist","aria-label":o??`Step ${c+1} of ${e}`,className:s,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:a,padding:"4px 0"},children:Array.from({length:e},(u,l)=>{const f=l===c,h=l<c;return n.jsx("div",{role:"tab","aria-selected":f,"aria-label":`Step ${l+1}`,style:{width:f?i:r,height:r,borderRadius:9999,backgroundColor:f?"var(--color-accent)":h?"color-mix(in srgb, var(--color-accent) 30%, transparent)":"var(--input-bg)",border:!f&&!h?"1.5px solid var(--surface-divider)":"none",transition:["width 0.32s cubic-bezier(0.34, 1.56, 0.64, 1)","background-color 0.2s ease"].join(", "),willChange:"width",flexShrink:0}},l)})})}const jr="cubic-bezier(0.34, 1.28, 0.64, 1)",Or="cubic-bezier(0.4, 0, 0.6, 1)";function Mr(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("circle",{cx:"11",cy:"11",r:"7.5"}),n.jsx("line",{x1:"16.5",y1:"16.5",x2:"22",y2:"22"})]})}function Hr({value:e,onChange:t,onCancel:r,onFocus:a,onBlur:o,onSubmit:s,placeholder:c="Search",showCancel:i=!1,cancelLabel:u="Cancel",disabled:l=!1,autoFocus:f=!1,className:h=""}){const g=d.useRef(null),x=e.length>0,C=()=>{B(),a?.()},S=()=>{o?.()},p=()=>{t(""),g.current?.focus()},v=()=>{t(""),g.current?.blur(),r?.()},m=E=>{E.key==="Enter"?(E.preventDefault(),s?.(e),g.current?.blur()):E.key==="Escape"&&v()};return n.jsxs("div",{className:`flex items-center gap-2 ${h}`,style:{WebkitTapHighlightColor:"transparent"},children:[n.jsxs("div",{className:["flex items-center gap-1.5 px-3 flex-1 min-w-0","bg-[var(--input-bg)] rounded-[var(--radius-full)]","transition-shadow duration-150",i?"focus-within:shadow-[0_0_0_2.5px_rgba(67,97,238,0.22)]":"",l?"opacity-40 pointer-events-none":""].join(" "),style:{height:36,minHeight:36},onClick:()=>g.current?.focus(),children:[n.jsx("span",{className:"shrink-0 text-[var(--color-muted)] leading-none",style:{marginTop:1},children:n.jsx(Mr,{})}),n.jsx("input",{ref:g,type:"search",inputMode:"search",enterKeyHint:"search",autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:!1,autoFocus:f,value:e,disabled:l,placeholder:c,onChange:E=>t(E.target.value),onFocus:C,onBlur:S,onKeyDown:m,className:["flex-1 min-w-0 bg-transparent outline-none","text-[15px] text-[var(--color-ink)]","placeholder:text-[var(--color-muted)]","[&::-webkit-search-decoration]:hidden","[&::-webkit-search-cancel-button]:hidden","[&::-webkit-search-results-button]:hidden"].join(" "),"aria-label":c}),x&&n.jsx("button",{type:"button",onPointerDown:E=>{E.preventDefault(),p()},className:["shrink-0 flex items-center justify-center","w-[17px] h-[17px] rounded-full","bg-[var(--color-muted)] opacity-50","active:opacity-30 transition-opacity duration-100"].join(" "),"aria-label":"Clear search",children:n.jsx("span",{className:"text-white font-bold leading-none select-none",style:{fontSize:10},children:"✕"})})]}),n.jsx("div",{"aria-hidden":!i,style:{maxWidth:i?80:0,opacity:i?1:0,overflow:"hidden",transition:[`max-width 0.32s ${i?jr:Or}`,`opacity ${i?"0.2s 0.04s ease":"0.15s ease"}`].join(", "),flexShrink:0,whiteSpace:"nowrap",paddingLeft:0},children:n.jsx("button",{type:"button",tabIndex:i?0:-1,onClick:v,className:["text-[var(--color-accent)] font-medium text-[17px]","min-h-[44px] min-w-[44px]","flex items-center justify-center","active:opacity-50 transition-opacity duration-100","select-none whitespace-nowrap"].join(" "),style:{paddingLeft:4},children:u})})]})}const R=51,de=31,ue=27,Se=2,Br=R-ue-Se*2,Wr={success:"var(--color-success)",accent:"var(--color-accent)",primary:"var(--color-ink)"},Ee="cubic-bezier(0.34, 1.28, 0.64, 1)",Ce="320ms";function Yr({checked:e,onChange:t,label:r,sublabel:a,disabled:o=!1,variant:s="success","aria-label":c,className:i=""}){const u=()=>{o||(B(),t(!e))},l=C=>{(C.key===" "||C.key==="Enter")&&(C.preventDefault(),u())},f={position:"relative",width:R,minWidth:R,height:de,borderRadius:de/2,backgroundColor:e?Wr[s]:"var(--input-bg)",boxShadow:e?"none":"inset 0 0 0 1.5px var(--surface-divider)",transition:[`background-color ${Ce} ${Ee}`,`box-shadow ${Ce} ${Ee}`].join(", "),cursor:o?"not-allowed":"pointer",opacity:o?.4:1,flexShrink:0},h={position:"absolute",top:Se,left:Se,width:ue,height:ue,borderRadius:ue/2,backgroundColor:"#ffffff",boxShadow:"0 2px 6px rgba(0,0,0,0.22), 0 0.5px 2px rgba(0,0,0,0.14)",transform:e?`translateX(${Br}px)`:"translateX(0px)",transition:`transform ${Ce} ${Ee}`,willChange:"transform",pointerEvents:"none"},g=!!(r||a),x=n.jsx("div",{role:"switch","aria-checked":e,"aria-disabled":o,"aria-label":g?void 0:c??"Toggle",tabIndex:o?-1:0,onKeyDown:l,style:f,onClick:g?void 0:u,children:n.jsx("div",{style:h})});return g?n.jsxs("div",{role:"switch","aria-checked":e,"aria-disabled":o,"aria-label":c,tabIndex:o?-1:0,onKeyDown:l,onClick:u,className:i,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,minHeight:44,cursor:o?"not-allowed":"pointer",opacity:o?.4:1,userSelect:"none",WebkitTapHighlightColor:"transparent"},children:[n.jsxs("div",{style:{flex:1,minWidth:0},children:[r&&n.jsx("p",{style:{fontSize:15,fontWeight:500,color:"var(--color-ink)",lineHeight:1.3,margin:0},children:r}),a&&n.jsx("p",{style:{fontSize:13,color:"var(--color-muted)",lineHeight:1.3,margin:"2px 0 0"},children:a})]}),n.jsx("div",{style:{...f,cursor:"inherit"},children:n.jsx("div",{style:h})})]}):n.jsx("div",{className:i,style:{display:"inline-flex",alignItems:"center",padding:`${(44-de)/2}px ${(44-R)/2}px`,margin:`-${(44-de)/2}px -${(44-R)/2}px`,cursor:o?"not-allowed":"pointer"},onClick:u,children:x})}function Fr(){return d.useMemo(()=>({impact(e){switch(e){case"light":B();break;case"medium":ae();break;case"heavy":Me();break}},notification(e){switch(e){case"success":He();break;case"warning":Ft();break;case"error":zt();break}},selection(){oe()}}),[])}function zr(e={}){const t=d.useRef(null),r=d.useRef(e);return r.current=e,d.useEffect(()=>{const a=t.current;if(!a)return;let o=0,s=0,c=0,i=0,u=0,l=0,f=0,h=!1;const g=(p,v)=>({dx:p-o,dy:v-s,vx:l,vy:f,x:p,y:v}),x=p=>{p.isPrimary&&(o=p.clientX,s=p.clientY,c=p.clientX,i=p.clientY,u=p.timeStamp,l=0,f=0,h=!0,a.setPointerCapture(p.pointerId),r.current.onStart?.(g(p.clientX,p.clientY)))},C=p=>{if(!h||!p.isPrimary)return;r.current.preventDefault!==!1&&p.preventDefault();const v=p.timeStamp-u;v>0&&(l=.7*((p.clientX-c)/v)+(1-.7)*l,f=.7*((p.clientY-i)/v)+(1-.7)*f),c=p.clientX,i=p.clientY,u=p.timeStamp,r.current.onMove?.(g(p.clientX,p.clientY))},S=p=>{!h||!p.isPrimary||(h=!1,r.current.onEnd?.(g(p.clientX,p.clientY)))};return a.addEventListener("pointerdown",x,{passive:!0}),a.addEventListener("pointermove",C,{passive:!1}),a.addEventListener("pointerup",S,{passive:!0}),a.addEventListener("pointercancel",S,{passive:!0}),()=>{a.removeEventListener("pointerdown",x),a.removeEventListener("pointermove",C),a.removeEventListener("pointerup",S),a.removeEventListener("pointercancel",S)}},[]),t}function gt(e){const[t,r]=[e[0],e[1]],a=r.clientX-t.clientX,o=r.clientY-t.clientY;return Math.hypot(a,o)}function bt(e){return[(e[0].clientX+e[1].clientX)/2,(e[0].clientY+e[1].clientY)/2]}function Ur(e={}){const t=d.useRef(null),r=d.useRef(e);return r.current=e,d.useEffect(()=>{const a=t.current;if(!a)return;let o=0,s=!1;const c=l=>{if(l.touches.length!==2)return;l.preventDefault(),o=gt(l.touches),s=!0;const f=bt(l.touches);r.current.onStart?.({scale:1,origin:f})},i=l=>{if(!s||l.touches.length!==2)return;l.preventDefault();const f=gt(l.touches),h=o>0?f/o:1,g=bt(l.touches);r.current.onMove?.({scale:h,origin:g})},u=l=>{s&&l.touches.length<2&&(s=!1,r.current.onEnd?.({scale:1,origin:[0,0]}))};return a.addEventListener("touchstart",c,{passive:!1}),a.addEventListener("touchmove",i,{passive:!1}),a.addEventListener("touchend",u,{passive:!0}),a.addEventListener("touchcancel",u,{passive:!0}),()=>{a.removeEventListener("touchstart",c),a.removeEventListener("touchmove",i),a.removeEventListener("touchend",u),a.removeEventListener("touchcancel",u)}},[]),t}function Xr(e){const t=d.useRef(null),r=d.useRef(e);return r.current=e,d.useEffect(()=>{const a=t.current;if(!a)return;let o=null,s=0,c=0;const i=()=>{o!==null&&(clearTimeout(o),o=null)},u=f=>{if(!f.isPrimary)return;s=f.clientX,c=f.clientY,i();const h=r.current.delay??500,g=r.current.haptic!==!1;o=setTimeout(()=>{o=null,g&&ae(),r.current.onLongPress()},h)},l=f=>{if(!f.isPrimary||o===null)return;const h=r.current.threshold??10;Math.hypot(f.clientX-s,f.clientY-c)>h&&i()};return a.addEventListener("pointerdown",u,{passive:!0}),a.addEventListener("pointermove",l,{passive:!0}),a.addEventListener("pointerup",i,{passive:!0}),a.addEventListener("pointercancel",i,{passive:!0}),()=>{i(),a.removeEventListener("pointerdown",u),a.removeEventListener("pointermove",l),a.removeEventListener("pointerup",i),a.removeEventListener("pointercancel",i)}},[]),t}const Gr={default:"📭",error:"⚠️",offline:"📡",search:"🔍"};function Kr({label:e,onPress:t,variant:r="primary"}){const a=()=>{B(),t()};return r==="ghost"?n.jsx("button",{type:"button",onClick:a,style:{background:"transparent",border:"none",color:"var(--color-accent)",fontSize:17,fontWeight:500,padding:"10px 20px",minHeight:44,cursor:"pointer",borderRadius:12,transition:"opacity 0.12s ease"},onPointerDown:o=>o.currentTarget.style.opacity="0.5",onPointerUp:o=>o.currentTarget.style.opacity="1",onPointerLeave:o=>o.currentTarget.style.opacity="1",children:e}):n.jsx("button",{type:"button",onClick:a,style:{background:"var(--color-ink)",border:"none",color:"var(--color-paper)",fontSize:15,fontWeight:600,padding:"0 24px",height:44,minWidth:120,cursor:"pointer",borderRadius:12,transition:"opacity 0.12s ease",WebkitTapHighlightColor:"transparent"},onPointerDown:o=>o.currentTarget.style.opacity="0.7",onPointerUp:o=>o.currentTarget.style.opacity="1",onPointerLeave:o=>o.currentTarget.style.opacity="1",children:e})}function Vr({icon:e,title:t,subtitle:r,action:a,variant:o="default",contained:s=!1,className:c=""}){const i=e!==void 0?e:Gr[o],u=typeof i=="string",l=a!=null&&typeof a=="object"&&"label"in a&&"onPress"in a;return n.jsxs("div",{className:c,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:s?"32px 24px":"48px 32px",...s?{}:{flex:1,minHeight:280}},children:[i!=null&&n.jsx("div",{"aria-hidden":"true",style:{marginBottom:s?16:20,fontSize:s?40:52,lineHeight:1,opacity:1},children:u?n.jsx("span",{role:"img","aria-hidden":"true",style:{fontSize:"inherit"},children:i}):i}),n.jsx("p",{style:{fontSize:s?17:20,fontWeight:700,color:o==="error"?"var(--color-danger)":"var(--color-ink)",lineHeight:1.3,margin:0,marginBottom:r?6:a?20:0,maxWidth:280},children:t}),r&&n.jsx("p",{style:{fontSize:s?14:15,fontWeight:400,color:"var(--color-muted)",lineHeight:1.5,margin:0,marginBottom:a?s?20:28:0,maxWidth:260},children:r}),a&&n.jsx("div",{style:{marginTop:!r&&a?s?20:24:0},children:l?n.jsx(Kr,{...a}):a})]})}const mt={xs:28,sm:36,md:44,lg:56,xl:80},qr={xs:11,sm:13,md:16,lg:20,xl:28},Jr={xs:8,sm:10,md:12,lg:14,xl:18},Qr={xs:1.5,sm:2,md:2.5,lg:2.5,xl:3},yt=["#4361ee","#2d6a4f","#e63946","#e76f51","#6d6875","#9b2226","#457b9d","#2a9d8f"];function Zr(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)>>>0;return yt[t%yt.length]}function Rr(e){if(!e.trim())return"?";const t=e.trim().split(/\s+/);return t.length===1?t[0][0].toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}function en({size:e}){const t=mt[e];return n.jsxs(n.Fragment,{children:[n.jsx("style",{children:`
|
|
7
|
+
@keyframes kami-avatar-shimmer {
|
|
8
|
+
0% { background-position: -200% 0; }
|
|
9
|
+
100% { background-position: 200% 0; }
|
|
10
|
+
}
|
|
11
|
+
`}),n.jsx("div",{"aria-hidden":"true",style:{width:t,height:t,borderRadius:"50%",backgroundImage:"linear-gradient(90deg, var(--input-bg) 25%, var(--surface-divider) 50%, var(--input-bg) 75%)",backgroundSize:"200% 100%",animation:"kami-avatar-shimmer 1.4s ease-in-out infinite",flexShrink:0}})]})}function tn({src:e,name:t="",size:r="md",online:a=!1,loading:o=!1,onClick:s,alt:c,className:i=""}){const[u,l]=d.useState(!1),f=mt[r],h=qr[r],g=Jr[r],x=Qr[r],C=!!e&&!u,S=!C,p=Rr(t),v=Zr(t||"?"),m=c??t??"Avatar",E=!!s,y=()=>{s&&(B(),s())};if(o)return n.jsx("div",{className:i,style:{position:"relative",display:"inline-flex",flexShrink:0},children:n.jsx(en,{size:r})});const w={width:f,height:f,borderRadius:"50%",overflow:"hidden",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:S?v:"var(--input-bg)",position:"relative",userSelect:"none",transition:E?"transform 0.12s ease, opacity 0.12s ease":void 0,cursor:E?"pointer":"default",WebkitTapHighlightColor:"transparent"},k=E?n.jsxs("button",{type:"button",onClick:y,"aria-label":m,style:{...w,padding:0,border:"none",outline:"none"},className:[E?"active:scale-[0.90] active:opacity-80":"",i].join(" "),children:[C&&n.jsx("img",{src:e,alt:m,onError:()=>l(!0),style:{width:"100%",height:"100%",objectFit:"cover",display:"block"},draggable:!1}),S&&n.jsx("span",{style:{fontSize:h,fontWeight:700,color:"#ffffff",lineHeight:1,letterSpacing:r==="xl"?"-0.5px":void 0},"aria-hidden":"true",children:p})]}):n.jsxs("div",{role:"img","aria-label":m,style:w,className:i,children:[C&&n.jsx("img",{src:e,alt:m,onError:()=>l(!0),style:{width:"100%",height:"100%",objectFit:"cover",display:"block"},draggable:!1}),S&&n.jsx("span",{style:{fontSize:h,fontWeight:700,color:"#ffffff",lineHeight:1,letterSpacing:r==="xl"?"-0.5px":void 0},"aria-hidden":"true",children:p})]});return a?n.jsxs("div",{style:{position:"relative",display:"inline-flex",flexShrink:0},children:[k,n.jsx("div",{"aria-label":"Online",style:{position:"absolute",bottom:x/2,right:x/2,width:g,height:g,borderRadius:"50%",backgroundColor:"var(--color-success)",border:`${x}px solid white`,boxSizing:"border-box",pointerEvents:"none"}})]}):k}function rn({children:e,overlap:t=-8,className:r=""}){const a=d.Children.toArray(e);return n.jsx("div",{className:r,style:{display:"flex",flexDirection:"row"},children:a.map((o,s)=>n.jsx("div",{style:{marginLeft:s===0?0:t,zIndex:a.length-s,position:"relative",borderRadius:"50%",boxShadow:"0 0 0 2px white"},children:o},s))})}const nn=72,an=108,fe=14,ee=fe*2+8,xt=2*Math.PI*fe,wt={duration:260,easing:"cubic-bezier(0.4, 0, 0.6, 1)"};function on({progress:e,spinning:t,translateY:r}){const a=ee+8,o=a/2,s=xt,c=s-s*Math.min(e,1);return n.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:"50%",transform:`translateX(-50%) translateY(${r}px)`,width:a,height:a,display:"flex",alignItems:"center",justifyContent:"center",opacity:Math.max(0,Math.min(1,r/24)),transition:t?void 0:"opacity 80ms ease",pointerEvents:"none"},children:n.jsxs("svg",{width:a,height:a,viewBox:`0 0 ${a} ${a}`,fill:"none",children:[n.jsx("circle",{cx:o,cy:o,r:fe,stroke:"var(--surface-divider)",strokeWidth:"2.5"}),n.jsx("circle",{cx:o,cy:o,r:fe,stroke:"var(--color-accent)",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:s,strokeDashoffset:t?xt*.75:c,transform:`rotate(-90 ${o} ${o})`,style:t?{animationName:"kami-ptr-spin",animationDuration:"800ms",animationTimingFunction:"linear",animationIterationCount:"infinite"}:{transition:"stroke-dashoffset 60ms linear"}})]})})}function sn({onRefresh:e,children:t,disabled:r=!1,threshold:a=nn,className:o="",style:s}){const c=d.useRef(null),i=d.useRef(null),u=d.useRef(null),l=d.useRef("idle"),f=d.useRef(0),h=d.useRef(0),g=d.useRef(!1),[x,C]=d.useState({translateY:-ee,progress:0,spinning:!1}),S=d.useCallback((v,m)=>{const E=i.current;E&&(m?E.animate([{transform:`translateY(${v}px)`}],{...wt,fill:"forwards"}):E.style.transform=`translateY(${v}px)`)},[]),p=d.useCallback(()=>{l.current="snapping",S(0,!0),C({translateY:-ee,progress:0,spinning:!1}),setTimeout(()=>{l.current="idle"},wt.duration+50)},[S]);return d.useEffect(()=>{const v=c.current,m=u.current;if(!v||!m)return;const E=k=>{r||l.current!=="idle"||m.scrollTop>2||(f.current=k.touches[0].clientY,h.current=0,g.current=!1,l.current="pulling")},y=k=>{if(l.current!=="pulling"&&l.current!=="triggered")return;const T=k.touches[0].clientY-f.current;if(T<=0){l.current==="pulling"&&(l.current="idle");return}m.scrollTop<=0&&k.preventDefault();const N=T,L=N<a?N:a+(N-a)*.25;h.current=Math.min(L,an);const P=Math.min(h.current/a,1);h.current>=a&&!g.current?(g.current=!0,l.current="triggered",B()):h.current<a&&(l.current="pulling",g.current=!1),S(h.current),C({translateY:h.current-ee-8,progress:P,spinning:!1})},w=async()=>{if(l.current==="triggered"){l.current="refreshing";const k=a+8;S(k,!0),C(T=>({...T,translateY:k-ee-8,spinning:!0})),He();try{await e()}finally{p()}}else l.current==="pulling"&&p()};return v.addEventListener("touchstart",E,{passive:!0}),v.addEventListener("touchmove",y,{passive:!1}),v.addEventListener("touchend",w,{passive:!0}),v.addEventListener("touchcancel",p,{passive:!0}),()=>{v.removeEventListener("touchstart",E),v.removeEventListener("touchmove",y),v.removeEventListener("touchend",w),v.removeEventListener("touchcancel",p)}},[r,a,e,S,p]),n.jsxs(n.Fragment,{children:[n.jsx("style",{children:`
|
|
12
|
+
@keyframes kami-ptr-spin {
|
|
13
|
+
from { transform: rotate(-90deg); }
|
|
14
|
+
to { transform: rotate(270deg); }
|
|
15
|
+
}
|
|
16
|
+
`}),n.jsxs("div",{ref:c,className:o,style:{position:"relative",overflow:"hidden",height:"100%",...s},children:[n.jsx(on,{...x}),n.jsx("div",{ref:u,style:{height:"100%",overflowY:"auto",WebkitOverflowScrolling:"touch"},children:n.jsx("div",{ref:i,style:{willChange:"transform"},children:t})})]})]})}function ln(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})}function cn(){return n.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}function dn({option:e,selected:t,multi:r,onPress:a}){return n.jsxs("button",{type:"button",disabled:e.disabled,onClick:a,className:["w-full flex items-center gap-3 px-4 py-3.5 min-h-[50px]","text-left select-none transition-colors duration-100","active:bg-[var(--surface-active)]",e.disabled?"opacity-40 cursor-not-allowed":"cursor-pointer"].join(" "),style:{borderTop:"1px solid var(--surface-divider)"},children:[r?n.jsx("div",{style:{width:22,height:22,flexShrink:0,borderRadius:6,border:t?"2px solid var(--color-accent)":"2px solid var(--surface-divider)",background:t?"var(--color-accent)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s ease, border-color 0.15s ease"},children:t&&n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}):e.icon?n.jsx("span",{className:"text-[20px] leading-none shrink-0",children:e.icon}):null,n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:["text-[15px] leading-snug",t&&!r?"font-semibold text-[var(--color-ink)]":"font-medium text-[var(--color-ink)]"].join(" "),children:e.label}),e.sublabel&&n.jsx("p",{className:"text-[13px] text-[var(--color-muted)] mt-0.5 leading-snug",children:e.sublabel})]}),!r&&t&&n.jsx("span",{className:"shrink-0 text-[var(--color-accent)]",children:n.jsx(cn,{})})]})}function un({label:e,displayValue:t,hasValue:r,disabled:a,clearable:o,onClear:s,onClick:c,ariaLabel:i}){return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[e&&n.jsx("span",{className:"text-[13px] font-medium text-[var(--color-ink)] px-1",children:e}),n.jsxs("button",{type:"button",onClick:c,disabled:a,"aria-label":i,"aria-haspopup":"listbox",className:["flex items-center gap-2 px-3 min-h-[44px] rounded-xl w-full text-left","bg-[var(--input-bg)] transition-shadow duration-150","active:shadow-[0_0_0_2.5px_rgba(67,97,238,0.22)]",a?"opacity-40 pointer-events-none":""].join(" "),children:[n.jsx("span",{className:["flex-1 text-[15px] truncate",r?"text-[var(--color-ink)]":"text-[var(--color-muted)]"].join(" "),children:t}),o&&r&&s&&n.jsx("button",{type:"button",onPointerDown:u=>{u.preventDefault(),u.stopPropagation(),s()},className:"shrink-0 flex items-center justify-center w-5 h-5 rounded-full bg-[var(--color-muted)] opacity-60 active:opacity-40 transition-opacity","aria-label":"Clear selection",children:n.jsx("span",{className:"text-white font-bold leading-none",style:{fontSize:10},children:"✕"})}),n.jsx("span",{className:"shrink-0 text-[var(--color-muted)]",children:n.jsx(ln,{})})]})]})}function fn({value:e,onChange:t,placeholder:r="Search…"}){const a=d.useRef(null);return n.jsx("div",{className:"px-4 pb-3 pt-1",children:n.jsxs("div",{className:"flex items-center gap-2 px-3 bg-[var(--input-bg)] rounded-full",style:{height:36},onClick:()=>a.current?.focus(),children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-[var(--color-muted)] shrink-0","aria-hidden":"true",children:[n.jsx("circle",{cx:"11",cy:"11",r:"7.5"}),n.jsx("line",{x1:"16.5",y1:"16.5",x2:"22",y2:"22"})]}),n.jsx("input",{ref:a,type:"search",inputMode:"search",autoCapitalize:"none",autoCorrect:"off",value:e,onChange:o=>t(o.target.value),placeholder:r,className:["flex-1 min-w-0 bg-transparent outline-none","text-[15px] text-[var(--color-ink)] placeholder:text-[var(--color-muted)]","[&::-webkit-search-cancel-button]:hidden","[&::-webkit-search-decoration]:hidden"].join(" ")}),e&&n.jsx("button",{type:"button",onPointerDown:o=>{o.preventDefault(),t("")},className:"shrink-0 flex items-center justify-center w-[16px] h-[16px] rounded-full bg-[var(--color-muted)] opacity-50 active:opacity-30","aria-label":"Clear search",children:n.jsx("span",{className:"text-white font-bold leading-none",style:{fontSize:9},children:"✕"})})]})})}function hn(e){const{options:t,placeholder:r="Select…",label:a,title:o,searchable:s=!1,disabled:c=!1,doneLabel:i="Done",clearable:u=!1,className:l="","aria-label":f}=e,[h,g]=d.useState(!1),[x,C]=d.useState(""),S=o??a??r,p=d.useMemo(()=>e.multi?t.filter(P=>e.value.includes(P.value)):t.filter(P=>P.value===e.value),[t,(e.multi,e.value)]),v=d.useMemo(()=>{if(p.length===0)return r;if(e.multi)return p.length===1?p[0].label:`${p[0].label} +${p.length-1} more`;const P=p[0];return P.icon?`${P.icon} ${P.label}`:P.label},[p,r,e.multi]),m=p.length>0,E=d.useMemo(()=>{if(!x.trim())return t;const P=x.toLowerCase();return t.filter(I=>I.label.toLowerCase().includes(P)||(I.sublabel?.toLowerCase().includes(P)??!1))},[t,x]),y=()=>{c||(B(),C(""),g(!0))},w=()=>{g(!1),C("")},k=P=>{e.multi||(oe(),e.onChange(P),setTimeout(w,100))},T=P=>{if(!e.multi)return;oe();const I=e.value,$=I.includes(P)?I.filter(D=>D!==P):[...I,P];e.onChange($)},N=()=>{e.multi||e.onClear?.()},L=x.trim()&&E.length===0;return n.jsxs("div",{className:l,children:[n.jsx(un,{label:a,displayValue:v,hasValue:m,disabled:c,clearable:u&&!e.multi,onClear:N,onClick:y,ariaLabel:f??a??r}),n.jsxs(we,{open:h,onClose:w,title:S,children:[s&&n.jsx(fn,{value:x,onChange:C,placeholder:`Search ${S.toLowerCase()}…`}),n.jsx("div",{role:"listbox","aria-label":S,"aria-multiselectable":e.multi,children:L?n.jsxs("div",{className:"py-10 flex flex-col items-center gap-2",children:[n.jsx("p",{className:"text-[34px] leading-none",children:"🔍"}),n.jsxs("p",{className:"text-[15px] text-[var(--color-muted)]",children:["No results for “",x,"”"]})]}):E.map(P=>{const I=e.multi?e.value.includes(P.value):e.value===P.value;return n.jsx(dn,{option:P,selected:I,multi:!!e.multi,onPress:()=>e.multi?T(P.value):k(P.value)},P.value)})}),e.multi&&n.jsx("div",{className:"pt-4 pb-2",children:n.jsxs("button",{type:"button",onClick:w,className:["w-full bg-[var(--color-ink)] text-[var(--color-paper)]","rounded-xl py-3.5 text-[15px] font-semibold","active:opacity-75 transition-opacity"].join(" "),children:[i,e.value.length>0&&n.jsxs("span",{className:"opacity-60 font-normal",children:[" ","· ",e.value.length," selected"]})]})})]})]})}const W=44,kt=5,Pe=W*kt,te=Math.floor(kt/2);function pn(e){return typeof e=="string"?{value:e,label:e}:e}function St(e){return String(e).padStart(2,"0")}function he(e,t,r){return Math.max(t,Math.min(r,e))}function Q({items:e,value:t,onChange:r,width:a,"aria-label":o="Picker",className:s=""}){const c=e.map(pn),i=d.useRef(null),u=d.useRef(-1),l=d.useRef(!1),f=d.useCallback((p,v="smooth")=>{const m=i.current;m&&(l.current=!0,m.scrollTo({top:p*W,behavior:v}),setTimeout(()=>{l.current=!1},400))},[]);d.useEffect(()=>{const p=c.findIndex(v=>v.value===t);p<0||(f(p,u.current<0?"instant":"smooth"),u.current=p)},[t]);const h=d.useCallback(()=>{const p=i.current;if(!p)return;const v=Math.round(p.scrollTop/W),m=he(v,0,c.length-1);if(m===u.current)return;const E=c[m];E?.disabled||(u.current=m,l.current||oe(),r(E.value))},[c,r]),g=d.useRef(null),x=d.useCallback(()=>{h(),g.current&&clearTimeout(g.current),g.current=setTimeout(h,120)},[h]),C=d.useCallback(p=>{const v=c.findIndex(m=>m.value===t);if(p.key==="ArrowDown"){p.preventDefault();const m=he(v+1,0,c.length-1);r(c[m].value)}else if(p.key==="ArrowUp"){p.preventDefault();const m=he(v-1,0,c.length-1);r(c[m].value)}},[c,t,r]),S=c.findIndex(p=>p.value===t);return n.jsxs("div",{className:s,style:{position:"relative",height:Pe,width:a??void 0,flex:a?void 0:1,overflow:"hidden",userSelect:"none"},children:[n.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:W*te,background:"linear-gradient(to bottom, var(--surface-solid) 20%, transparent)",zIndex:2,pointerEvents:"none"},"aria-hidden":"true"}),n.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:W*te,background:"linear-gradient(to top, var(--surface-solid) 20%, transparent)",zIndex:2,pointerEvents:"none"},"aria-hidden":"true"}),n.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:W*te,left:0,right:0,height:W,borderTop:"1px solid var(--surface-divider)",borderBottom:"1px solid var(--surface-divider)",zIndex:2,pointerEvents:"none"}}),n.jsx("div",{ref:i,role:"listbox","aria-label":o,tabIndex:0,onScroll:x,onKeyDown:C,style:{height:Pe,overflowY:"scroll",scrollSnapType:"y mandatory",WebkitOverflowScrolling:"touch",paddingTop:W*te,paddingBottom:W*te,outline:"none",scrollbarWidth:"none",msOverflowStyle:"none"},children:c.map((p,v)=>{const m=v===S;return n.jsx("div",{role:"option","aria-selected":m,"aria-disabled":p.disabled,onClick:()=>{p.disabled||(f(v),r(p.value))},style:{height:W,display:"flex",alignItems:"center",justifyContent:"center",scrollSnapAlign:"center",fontSize:m?20:17,fontWeight:m?600:400,color:p.disabled?"var(--color-muted)":m?"var(--color-ink)":"color-mix(in srgb, var(--color-ink) 55%, transparent)",transition:"font-size 120ms ease, color 120ms ease",cursor:p.disabled?"not-allowed":"pointer",paddingInline:12,textAlign:"center",whiteSpace:"nowrap"},children:p.label},p.value)})})]})}function vn(e){return Array.from({length:12},(t,r)=>new Intl.DateTimeFormat(e,{month:"short"}).format(new Date(2e3,r,1)))}function Et(e,t){return new Date(e,t+1,0).getDate()}function Ct(e,t){return Array.from({length:t-e+1},(r,a)=>String(e+a))}function Pt({value:e,onChange:t,mode:r="date",min:a,max:o,locale:s,className:c=""}){const i=vn(s),u=e.getFullYear(),l=e.getMonth(),f=e.getDate(),h=e.getHours(),g=e.getMinutes(),x=a?.getFullYear()??u-50,C=o?.getFullYear()??u+50,S=Ct(x,C),p=i.map((k,T)=>({value:String(T),label:k})),v=Et(u,l),m=Ct(1,v).map(k=>({value:k,label:k})),E=Array.from({length:24},(k,T)=>({value:String(T),label:St(T)})),y=Array.from({length:60},(k,T)=>({value:String(T),label:St(T)})),w=k=>{const T=k.y??u,N=k.m??l,L=Et(T,N),P=he(k.d??f,1,L),I=k.h??h,$=k.min??g,D=new Date(e);D.setFullYear(T),D.setMonth(N),D.setDate(P),D.setHours(I),D.setMinutes($),t(D)};return n.jsxs("div",{className:c,style:{display:"flex",flexDirection:"row",alignItems:"stretch",background:"var(--surface-solid)",borderRadius:16,overflow:"hidden",height:Pe},children:[(r==="date"||r==="datetime")&&n.jsxs(n.Fragment,{children:[n.jsx(Q,{items:p,value:String(l),onChange:k=>w({m:Number(k)}),"aria-label":"Month"}),n.jsx(Q,{items:m,value:String(f),onChange:k=>w({d:Number(k)}),"aria-label":"Day",width:56}),n.jsx(Q,{items:S,value:String(u),onChange:k=>w({y:Number(k)}),"aria-label":"Year",width:80})]}),r==="datetime"&&n.jsx("div",{style:{width:1,background:"var(--surface-divider)",alignSelf:"stretch",flexShrink:0}}),(r==="time"||r==="datetime")&&n.jsxs(n.Fragment,{children:[n.jsx(Q,{items:E,value:String(h),onChange:k=>w({h:Number(k)}),"aria-label":"Hour",width:56}),n.jsx(Q,{items:y,value:String(g),onChange:k=>w({min:Number(k)}),"aria-label":"Minute",width:56})]})]})}function gn({mode:e="date",initialValue:t,title:r}={}){const[a,o]=d.useState(!1),[s,c]=d.useState(t??new Date),[i,u]=d.useState(t??new Date),l=()=>{u(s),o(!0)},f=()=>{c(i),o(!1)},h=()=>{u(s),o(!1)},g=r??(e==="date"?"Select date":e==="time"?"Select time":"Select date & time");return{value:s,open:l,sheet:n.jsxs(we,{open:a,onClose:h,title:g,children:[n.jsx("div",{style:{padding:"8px 16px 0"},children:n.jsx(Pt,{mode:e,value:i,onChange:u})}),n.jsx("div",{style:{padding:"16px"},children:n.jsx(at,{onClick:f,fullWidth:!0,children:"Done"})})]})}}const Lt={destructive:"var(--color-danger)",primary:"var(--color-accent)",secondary:"var(--color-muted)"},bn={duration:320,easing:"cubic-bezier(0.34, 1.28, 0.64, 1)"},mn={duration:260,easing:"cubic-bezier(0.4, 0, 0.6, 1)"},Tt=.88,Nt=8,yn=1.2;function It({action:e,targetWidth:t,side:r}){const a=Lt[e.variant??"secondary"];return n.jsxs("button",{type:"button",onClick:()=>e.onPress(),style:{width:t,minWidth:t,minHeight:44,height:"100%",background:a,border:"none",color:"white",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",flexShrink:0,order:r==="leading"?-1:1,transition:"opacity 100ms ease"},onPointerDown:o=>{o.currentTarget.style.opacity="0.75"},onPointerUp:o=>{o.currentTarget.style.opacity="1"},onPointerLeave:o=>{o.currentTarget.style.opacity="1"},children:[e.icon&&n.jsx("span",{style:{fontSize:18,lineHeight:1},children:e.icon}),n.jsx("span",{style:{fontSize:11,fontWeight:600,lineHeight:1,letterSpacing:"0.02em"},children:e.label})]})}function xn({children:e,trailingActions:t=[],leadingActions:r=[],fullSwipeEnabled:a=!0,fullSwipeThreshold:o=.55,className:s=""}){const c=d.useRef(null),i=d.useRef(null),u=d.useRef(null),l=d.useRef(0),f=d.useRef(null),[h,g]=d.useState(!1),x=t.reduce((v,m)=>v+(m.width??80),0),C=r.reduce((v,m)=>v+(m.width??80),0),S=d.useCallback((v,m)=>{const E=i.current;if(E)if(l.current=v,m){const y=v===0?mn:bn;E.animate([{transform:`translateX(${v}px)`}],{...y,fill:"forwards"})}else E.style.transform=`translateX(${v}px)`},[]),p=d.useCallback(()=>{f.current=null,S(0,!0)},[S]);return d.useEffect(()=>{const v=c.current;if(!v)return;let m=0,E=0,y=0,w="idle",k=!1;const T=()=>u.current?.offsetWidth??375,N=I=>{I.isPrimary&&(m=I.clientX,E=I.clientY,y=l.current,w="deciding",k=!1,v.setPointerCapture(I.pointerId))},L=I=>{if(!I.isPrimary||w==="idle"||w==="vert")return;const $=I.clientX-m,D=I.clientY-E,j=Math.abs($),A=Math.abs(D);if(w==="deciding"){if(j<Nt&&A<Nt)return;if(A>j*yn){w="vert";return}w="horiz"}I.preventDefault();const pe=T(),M=y+$;let U=M;if(M<0){const K=-x;if(M<K){const Sn=M-K;U=K+Sn*.25}const Le=Math.abs(U)/pe,ve=a&&Le>=o&&t.length>0;ve!==k&&(k=ve,g(ve),ve?Me():B())}else if(M>0){const K=C;if(M>K){const Le=M-K;U=K+Le*.25}}U<0&&t.length===0&&(U=M*.08),U>0&&r.length===0&&(U=M*.08),S(U)},P=I=>{if(!I.isPrimary||w!=="horiz"){w="idle";return}w="idle";const $=T(),D=l.current;if(k&&t.length>0&&D<0){S(-$,!0),g(!1),setTimeout(()=>{t[0].onPress(),setTimeout(()=>S(0),400)},220);return}g(!1);const j=.35;if(D<0&&t.length>0){const A=-(x*Tt);Math.abs(D)>x*j?(f.current="trailing",B(),S(A,!0)):p()}else if(D>0&&r.length>0){const A=C*Tt;D>C*j?(f.current="leading",B(),S(A,!0)):p()}else p()};return v.addEventListener("pointerdown",N,{passive:!0}),v.addEventListener("pointermove",L,{passive:!1}),v.addEventListener("pointerup",P,{passive:!0}),v.addEventListener("pointercancel",()=>{w="idle",p()},{passive:!0}),()=>{v.removeEventListener("pointerdown",N),v.removeEventListener("pointermove",L),v.removeEventListener("pointerup",P)}},[t,r,x,C,a,o,S,p]),d.useEffect(()=>{const v=m=>{m.key==="Escape"&&f.current&&p()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[p]),n.jsxs("div",{ref:u,className:s,style:{position:"relative",overflow:"hidden",backgroundColor:h&&t.length>0?Lt[t[0].variant??"secondary"]:void 0,transition:h?"background-color 100ms ease":void 0},children:[r.length>0&&n.jsx("div",{"aria-hidden":"true",style:{position:"absolute",left:0,top:0,bottom:0,display:"flex",alignItems:"stretch",pointerEvents:f.current==="leading"?"auto":"none"},children:r.map((v,m)=>n.jsx(It,{action:v,targetWidth:v.width??80,side:"leading"},m))}),t.length>0&&n.jsx("div",{"aria-hidden":"true",style:{position:"absolute",right:0,top:0,bottom:0,display:"flex",alignItems:"stretch",pointerEvents:f.current==="trailing"?"auto":"none"},children:t.map((v,m)=>n.jsx(It,{action:v,targetWidth:v.width??80,side:"trailing"},m))}),n.jsx("div",{ref:c,style:{position:"relative",zIndex:1,willChange:"transform",touchAction:"pan-y",cursor:"default",backgroundColor:"var(--surface-solid)"},children:n.jsx("div",{ref:i,style:{willChange:"transform"},children:e})})]})}class wn extends ne{constructor(){super(...arguments),this.selectionStarted=!1}async impact(t){const r=this.patternForImpact(t?.style);this.vibrateWithPattern(r)}async notification(t){const r=this.patternForNotification(t?.type);this.vibrateWithPattern(r)}async vibrate(t){const r=t?.duration||300;this.vibrateWithPattern([r])}async selectionStart(){this.selectionStarted=!0}async selectionChanged(){this.selectionStarted&&this.vibrateWithPattern([70])}async selectionEnd(){this.selectionStarted=!1}patternForImpact(t=F.Heavy){return t===F.Medium?[43]:t===F.Light?[20]:[61]}patternForNotification(t=z.Success){return t===z.Warning?[30,40,30,50,60]:t===z.Error?[27,45,50]:[35,65,21]}vibrateWithPattern(t){if(navigator.vibrate)navigator.vibrate(t);else throw this.unavailable("Browser does not support the vibrate API")}}const kn=Object.freeze(Object.defineProperty({__proto__:null,HapticsWeb:wn},Symbol.toStringTag,{value:"Module"}));b.ActionSheet=vr,b.ActivityIndicator=xe,b.ActivityIndicatorOverlay=nt,b.AppViewportProvider=gr,b.Avatar=tn,b.AvatarGroup=rn,b.Badge=Tr,b.BottomSheet=we,b.Button=at,b.Card=Jt,b.Chip=ht,b.ChipGroup=Nr,b.DatePicker=Pt,b.EmptyState=Vr,b.ErrorBoundary=dr,b.ErrorState=it,b.FullscreenPage=Kt,b.FullscreenPageContent=Vt,b.Input=Cr,b.List=tr,b.ListItem=rr,b.Navbar=qt,b.NavigationStack=$e,b.OverlayNavigatorProvider=yr,b.Page=Ze,b.PageContent=Re,b.Presets=kr,b.ProgressBar=Ar,b.PullToRefresh=sn,b.SearchBar=Hr,b.SectionTitle=nr,b.SegmentedControl=Ir,b.Select=hn,b.Skeleton=cr,b.StepDots=_r,b.SwipeableListItem=xn,b.Switch=Yr,b.TabBar=Xt,b.ToastProvider=pr,b.WheelPicker=Q,b.animate=Y,b.color=Be,b.duration=Ve,b.ease=qe,b.fadeInFrames=ut,b.fadeOutFrames=ft,b.font=Fe,b.pageTransition=Sr,b.radius=Xe,b.ring=Ke,b.shadow=Ge,b.slideFrames=xr,b.space=ze,b.spring=ie,b.springs=le,b.surface=We,b.text=Ye,b.tokens=Ut,b.touchTarget=Ue,b.transition=Je,b.useAnimation=Er,b.useDatePicker=gn,b.useFocusTrap=tt,b.useHaptics=Fr,b.useLongPress=Xr,b.useNavigation=ge,b.useOverlayNavigator=br,b.usePan=zr,b.usePinch=Ur,b.useScrollToTop=Qe,b.useToast=ur,b.z=H,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { W as a, I as i, N as r } from "./index-CVNk3zin.js";
|
|
2
|
+
class o extends a {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments), this.selectionStarted = !1;
|
|
5
|
+
}
|
|
6
|
+
async impact(t) {
|
|
7
|
+
const e = this.patternForImpact(t?.style);
|
|
8
|
+
this.vibrateWithPattern(e);
|
|
9
|
+
}
|
|
10
|
+
async notification(t) {
|
|
11
|
+
const e = this.patternForNotification(t?.type);
|
|
12
|
+
this.vibrateWithPattern(e);
|
|
13
|
+
}
|
|
14
|
+
async vibrate(t) {
|
|
15
|
+
const e = t?.duration || 300;
|
|
16
|
+
this.vibrateWithPattern([e]);
|
|
17
|
+
}
|
|
18
|
+
async selectionStart() {
|
|
19
|
+
this.selectionStarted = !0;
|
|
20
|
+
}
|
|
21
|
+
async selectionChanged() {
|
|
22
|
+
this.selectionStarted && this.vibrateWithPattern([70]);
|
|
23
|
+
}
|
|
24
|
+
async selectionEnd() {
|
|
25
|
+
this.selectionStarted = !1;
|
|
26
|
+
}
|
|
27
|
+
patternForImpact(t = i.Heavy) {
|
|
28
|
+
return t === i.Medium ? [43] : t === i.Light ? [20] : [61];
|
|
29
|
+
}
|
|
30
|
+
patternForNotification(t = r.Success) {
|
|
31
|
+
return t === r.Warning ? [30, 40, 30, 50, 60] : t === r.Error ? [27, 45, 50] : [35, 65, 21];
|
|
32
|
+
}
|
|
33
|
+
vibrateWithPattern(t) {
|
|
34
|
+
if (navigator.vibrate)
|
|
35
|
+
navigator.vibrate(t);
|
|
36
|
+
else
|
|
37
|
+
throw this.unavailable("Browser does not support the vibrate API");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
o as HapticsWeb
|
|
42
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kamiui/kami",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Native-feeling React UI for Capacitor and mobile web",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/kami.umd.cjs",
|
|
7
|
+
"module": "./dist/kami.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/kami.js",
|
|
12
|
+
"require": "./dist/kami.umd.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "storybook dev -p 6006",
|
|
21
|
+
"build": "tsc -b && vite build",
|
|
22
|
+
"prepare": "npm run build",
|
|
23
|
+
"build:storybook": "storybook build",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"lint": "eslint src"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": ">=18",
|
|
29
|
+
"react-dom": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@capacitor/core": "^8.1.0",
|
|
33
|
+
"@capacitor/haptics": "^8.0.0",
|
|
34
|
+
"@eslint/js": "^9.39.1",
|
|
35
|
+
"@storybook/react-vite": "^10.2.10",
|
|
36
|
+
"@tailwindcss/vite": "^4.2.0",
|
|
37
|
+
"@types/react": "^19.2.7",
|
|
38
|
+
"@types/react-dom": "^19.2.3",
|
|
39
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
40
|
+
"react": "^19.1.0",
|
|
41
|
+
"react-dom": "^19.1.0",
|
|
42
|
+
"storybook": "^10.2.10",
|
|
43
|
+
"tailwindcss": "^4.2.0",
|
|
44
|
+
"typescript": "~5.9.3",
|
|
45
|
+
"vite": "^7.3.1",
|
|
46
|
+
"vite-plugin-dts": "^4.5.4"
|
|
47
|
+
}
|
|
48
|
+
}
|