@openparachute/app 0.22.15-rc.6 → 0.22.15-rc.7

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.
Files changed (45) hide show
  1. package/dist/.parachute/info +1 -1
  2. package/dist/assets/{Account-K_xK2X9B.js → Account-DVrOc5d2.js} +1 -1
  3. package/dist/assets/{Activity-BL33NLB_.js → Activity-0hs_ikJM.js} +1 -1
  4. package/dist/assets/{AddVault-CTe-mwRH.js → AddVault-BB-AFOmL.js} +1 -1
  5. package/dist/assets/{AddVaultChooser-BPJV1MeI.js → AddVaultChooser-n8eLZ11X.js} +1 -1
  6. package/dist/assets/{AddVaultCreate-DI73o6uE.js → AddVaultCreate-BVyIpnXh.js} +1 -1
  7. package/dist/assets/AttachmentDropZone-TqaFTJWk.js +1 -0
  8. package/dist/assets/{Calendar-CaIuHTLe.js → Calendar-BFFWBFvP.js} +1 -1
  9. package/dist/assets/{CheckEmail-CqFmFCks.js → CheckEmail-PgQKYluA.js} +1 -1
  10. package/dist/assets/{useAttachmentUploader-DNhr7cOE.js → CodeMirrorEditor-DxXQL_Yv.js} +18 -18
  11. package/dist/assets/{ConnectAI-DHagDo44.js → ConnectAI-DvGvVaFL.js} +1 -1
  12. package/dist/assets/{DayView-GOUuDzfi.js → DayView-DckpX5OB.js} +1 -1
  13. package/dist/assets/{Export-YCQBcJkP.js → Export-nog6GkVZ.js} +1 -1
  14. package/dist/assets/{Import-kCFoVM-8.js → Import-kMnqJ0Zy.js} +2 -2
  15. package/dist/assets/NoteEditor-DJJzL6og.js +1 -0
  16. package/dist/assets/{NoteNew-BHjrbBq2.js → NoteNew-CNO1wteU.js} +2 -2
  17. package/dist/assets/NoteView-BkwjWffV.js +9 -0
  18. package/dist/assets/{OAuthCallback-BPLeIM87.js → OAuthCallback-Bqwbh5dE.js} +1 -1
  19. package/dist/assets/{PinArchiveButtons-z6H_YGSc.js → PinArchiveButtons-6XVGmX0l.js} +1 -1
  20. package/dist/assets/{Settings-Ck3g9l6D.js → Settings-B44TjE-J.js} +1 -1
  21. package/dist/assets/{TagPage-oQqARXqf.js → TagPage-BvHAtmih.js} +1 -1
  22. package/dist/assets/{TagSchemaEditor-D_LYDGRK.js → TagSchemaEditor-Bv9OJXDP.js} +1 -1
  23. package/dist/assets/{Tags-CyP_yKov.js → Tags-XxPefjNE.js} +1 -1
  24. package/dist/assets/{VaultGraph-Di0B4NaD.js → VaultGraph-B8m-aKEP.js} +2 -2
  25. package/dist/assets/{Vaults-BMJUdDaM.js → Vaults-PLbdO3kQ.js} +1 -1
  26. package/dist/assets/{ViewNew-Um87-wU2.js → ViewNew-WUgtqEUn.js} +1 -1
  27. package/dist/assets/{ViewSurface-D8xrFE_I.js → ViewSurface-B3tMmOMq.js} +1 -1
  28. package/dist/assets/{Welcome-Cb7SFRmw.js → Welcome-Bncj2rBF.js} +1 -1
  29. package/dist/assets/{WizardShell-CDZWRkFh.js → WizardShell-Cp46Sjm6.js} +1 -1
  30. package/dist/assets/attachment-upload-DML2Fh0E.js +2 -0
  31. package/dist/assets/{history-B2ZH4y8B.js → history-DeQhlq0x.js} +1 -1
  32. package/dist/assets/{index-CkXqzhj_.js → index-BwG_4Oup.js} +15 -15
  33. package/dist/assets/index-eHCCOf4I.css +1 -0
  34. package/dist/assets/{provenance-DnIXLZVC.js → provenance-D_yuCkJz.js} +1 -1
  35. package/dist/assets/{react-force-graph-2d-C179xgl7.js → react-force-graph-2d-iGY_edo3.js} +1 -1
  36. package/dist/assets/{transcribe-default-Z7qqgq1r.js → transcribe-default-Cz5r46Dt.js} +1 -1
  37. package/dist/assets/{NoteRenderer-CN_XExeX.js → useAttachmentUploader-CR8KEhCu.js} +24 -24
  38. package/dist/index.html +2 -2
  39. package/dist/sw.js +1 -1
  40. package/meta.json +1 -1
  41. package/package.json +1 -1
  42. package/dist/assets/NoteEditor-BcJb5-4o.js +0 -1
  43. package/dist/assets/NoteView-DtbLplBa.js +0 -3
  44. package/dist/assets/attachment-upload-B0biPzAc.js +0 -2
  45. package/dist/assets/index-D-RN2HHm.css +0 -1
@@ -2,7 +2,7 @@
2
2
  "name": "parachute-app",
3
3
  "displayName": "Parachute",
4
4
  "tagline": "The super-surface for your Parachute",
5
- "version": "0.22.15-rc.6",
5
+ "version": "0.22.15-rc.7",
6
6
  "iconUrl": "/icon.svg",
7
7
  "kind": "frontend"
8
8
  }
@@ -1 +1 @@
1
- import{j as e,r as u,L as j,d as q,u as N,c as C,a as G,l as _,b as E,v as H,i as W,e as A,g as J,f as Q,s as z,m as K,h as X,I as D,k as Z,n as ee,o as te,p as L,q as ne,t as T,O as se,w as ae,x as re,y as le,z as O,S as R,A as ie,B as oe}from"./index-CkXqzhj_.js";import{f as ce,a as $}from"./provenance-DnIXLZVC.js";function ue(t,n){return t.trim().toLowerCase()===n.trim().toLowerCase()}const de={year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"};function B(t){const n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString(void 0,de)}const me={byCode:{confirm_mismatch:"That doesn't match your account email.",already_deleting:"This account is already being deleted. Check your email for the undo link."},sessionEnded:"Your sign-in has ended. Sign in again, then come back here to delete your account.",fallback:"Couldn't delete your account. Nothing has changed. Try again."};function he(t){return typeof t=="string"&&(/^https?:\/\//i.test(t)||t.startsWith("/"))}function xe(t){const{vaults:n,removeVault:s}=E.getState();for(const a of Object.values(n)){const r=H(a.url)??a.name;W(a)&&t.has(r)&&s(a.id)}}async function fe(){try{const t=await _();return new Set((Array.isArray(t==null?void 0:t.vaults)?t.vaults:[]).map(n=>n.name))}catch{return new Set}}function pe({email:t,descriptor:n,onDeleted:s}){var a;return((a=n==null?void 0:n.capabilities)==null?void 0:a.account_delete)!==!0||!t?null:e.jsx(ge,{email:t,onDeleted:s})}function ge({email:t,onDeleted:n}){const s=u.useId(),[a,r]=u.useState(""),[l,m]=u.useState(!1),[i,d]=u.useState(null),x=ue(a,t);async function y(o){if(o.preventDefault(),!(!x||l)){m(!0),d(null);try{const c=await fe(),p=await q(a.trim());N.getState().markClosed(),C(),xe(c),n(p)}catch(c){d(G(c,me))}finally{m(!1)}}}return e.jsxs("section",{"aria-label":"Delete account",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Delete account"}),e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mt-2 text-sm text-fg-muted",children:["Your account closes now and you're signed out everywhere. Everything is erased after 24 hours: your vaults, notes, files, snapshots and exports. Until then the email we send has an undo link."," ",e.jsx(j,{to:"/export",className:"focus-ring text-accent underline",children:"Export first"})," ","if you want a copy."]}),e.jsxs("form",{onSubmit:y,className:"mt-4 space-y-3",children:[e.jsx("label",{htmlFor:s,className:"block text-sm font-medium text-fg",children:"Type your account email to confirm"}),e.jsx("input",{id:s,type:"email",value:a,onChange:o=>r(o.target.value),autoComplete:"off",spellCheck:!1,placeholder:t,className:"input"}),e.jsx("button",{type:"submit",disabled:!x||l,className:"btn btn-danger-solid btn-touch",children:l?"Deleting…":"Delete my account"})]}),i?e.jsx("p",{role:"alert",className:"mt-4 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:i}):null]})]})}function ye({done:t,onDone:n}){return e.jsxs("section",{"aria-label":"Account closed",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Account closed"}),e.jsxs("div",{className:"mt-2 space-y-4",children:[t.notice_sent===!1&&he(t.undo_url)?e.jsxs("output",{className:"block text-sm text-fg-muted",children:["Your account is closed. We couldn't send the email with the undo link, so here it is:"," ",e.jsx("a",{href:t.undo_url,className:"focus-ring text-accent underline",children:"undo the deletion"}),". It works for 24 hours, until ",B(t.undo_expires_at),"."]}):e.jsxs("output",{className:"block text-sm text-fg-muted",children:["Your account is closed. We sent an email with an undo link; it works for 24 hours, until"," ",B(t.undo_expires_at),"."]}),e.jsx("button",{type:"button",onClick:n,className:"btn btn-primary btn-touch",children:"Done"})]})]})}const S="lens:account_deleted";function be(){try{const t=sessionStorage.getItem(S),n=t?JSON.parse(t):null;return n&&typeof n.undo_expires_at=="string"?n:null}catch{return null}}function je(t){try{if(t){const{undo_token:n,...s}=t;sessionStorage.setItem(S,JSON.stringify(s))}else sessionStorage.removeItem(S)}catch{}}function Me(){const[t,n]=u.useState({kind:"loading"}),[s,a]=u.useState(be),r=u.useCallback(i=>{je(i),a(i)},[]),l=A(),m=N(i=>i.identityEpoch);return u.useEffect(()=>{let i=!0;return(async()=>{let d;try{d=await J()}catch{i&&n({kind:"device"});return}i&&n(d.signed_in?{kind:"manager",email:d.email,username:d.username,csrf:d.csrf}:{kind:"device"})})(),()=>{i=!1}},[m]),e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"page-title",children:"Your parachute"}),e.jsx("p",{className:"mt-2 max-w-prose text-fg-muted",children:"Your account, plan, vaults, and connections — managed here."})]}),s?e.jsx(ye,{done:s,onDone:()=>{r(null),C(),l("/",{replace:!0})}}):t.kind==="loading"?e.jsx("output",{"aria-live":"polite",className:"block py-10 text-center text-sm text-fg-dim",children:e.jsx("span",{className:"animate-pulse",children:"Loading your account…"})}):t.kind==="device"?e.jsx(Te,{}):e.jsx(ve,{email:t.email,username:t.username,csrf:t.csrf,onDeleted:r})]})}function ve({email:t,username:n,csrf:s,onDeleted:a}){const r=A(),l=E(f=>f.getActiveVault()),m=N(f=>f.identityEpoch),i=Q(),d=i.isPending?"loading":i.data??null,x=z(i.data),y=u.useCallback(()=>i.refetch(),[i.refetch]),[o,c]=u.useState("loading"),[p,h]=u.useState(null);u.useEffect(()=>{let f=!0;return _().then(v=>{f&&c(v.vaults)}).catch(v=>{K(v),f&&c("error")}),X().then(v=>{f&&h(v)}),()=>{f=!1}},[m]);const g=u.useCallback(async()=>{try{const{vaults:f}=await _();c(f)}catch{c("error")}},[]);async function b(){try{await te(s)}finally{C(),r("/",{replace:!0})}}return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ne,{email:t,username:n,summary:x,onSignOut:b}),e.jsx(ke,{state:d,descriptor:p,onRetry:y,retrying:i.isFetching}),e.jsx(Ve,{vaults:o,summary:x,onReload:g}),e.jsx(F,{hasActiveVault:!!l}),e.jsx(pe,{email:t,descriptor:p,onDeleted:a})]})}function Ne({email:t,username:n,summary:s,onSignOut:a}){return e.jsx("section",{"aria-label":"Account",className:"card p-6 shadow-soft",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"eyebrow mb-1",children:"Signed in as"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[e.jsx("p",{className:"break-words font-serif text-xl text-fg",children:t??n??"your account"}),e.jsx(we,{summary:s})]})]}),e.jsx("button",{type:"button",onClick:a,className:"focus-ring shrink-0 text-sm text-fg-dim hover:text-accent",children:"Sign out"})]})})}function we({summary:t}){if(!t)return null;const n=T(t);return typeof n=="number"?e.jsxs("span",{className:"chip border-transparent bg-sun-soft font-medium text-sun-ink",children:["Free trial · ",n===0?"ends today":`${n} day${n===1?"":"s"} left`]}):e.jsx("span",{className:"chip",children:t.plan.label})}function ke({state:t,descriptor:n,onRetry:s,retrying:a}){if(t===null)return null;const r=t!=="loading"&&t!=="error"&&L(t);return t!=="loading"&&t!=="error"&&!t.billing_enabled&&!r?null:e.jsxs("section",{"aria-label":"Plan & billing",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Plan & billing"}),t==="loading"?e.jsxs("div",{"aria-busy":"true",className:"mt-4 space-y-2.5",children:[e.jsx("div",{className:"skeleton h-4 w-3/5 rounded-md"}),e.jsx("div",{className:"skeleton h-4 w-2/5 rounded-md"})]}):t==="error"?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"Couldn't load your plan."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"A hiccup reaching your account — your plan hasn't changed."}),e.jsx("button",{type:"button",onClick:s,disabled:a,className:"btn btn-primary btn-touch",children:a?"Retrying…":"Retry"})]}):r?e.jsx(_e,{summary:t}):t.has_billing_customer?e.jsx(Ce,{summary:t}):e.jsx(Be,{summary:t,plans:(n==null?void 0:n.plans)??[]})]})}function _e({summary:t}){const n=t.has_billing_customer&&Se.has(t.plan.tier);return e.jsxs("div",{className:"mt-4","data-testid":"open-beta-plan",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:I(t)}),e.jsx("p",{className:"mt-3 text-sm text-fg",children:se}),n?e.jsx(P,{}):null]})}const Se=new Set(["entry","standard","plus","power"]);function Ce({summary:t}){return e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:I(t)}),e.jsx(P,{})]})}function P(){const[t,n]=u.useState(!1),[s,a]=u.useState(null);async function r(){n(!0),a(null);try{const{url:l}=await ie();window.location.assign(l)}catch(l){if(n(!1),l instanceof R){N.getState().markExpired();return}a("Billing isn't available right now.")}}return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:r,disabled:t,className:"btn btn-primary btn-touch mt-4",children:t?"Opening…":"Manage plan & billing ↗"}),s?e.jsx(Y,{text:s}):null]})}const w=["monthly","quarterly","yearly"],V={monthly:"Monthly",quarterly:"Quarterly",yearly:"Yearly"},Ee={monthly:"/mo",quarterly:"/quarter",yearly:"/yr"},Ae={monthly:1,quarterly:3,yearly:12};function Ie(t){var s,a;const n=new Set;for(const r of t)for(const l of w)(a=(s=r.intervals)==null?void 0:s[l])!=null&&a.available&&n.add(l);return w.filter(r=>n.has(r))}function M(t,n){return t.label?t.label:typeof t.price=="number"?`$${t.price}${Ee[n]}`:null}function De(t){var n;for(const s of w){const a=(n=t.intervals)==null?void 0:n[s];if(a!=null&&a.available)return{interval:s,entry:a}}return null}function Oe(t,n){if(!n||!t.intervals)return typeof t.price_month=="number"?`$${t.price_month}/mo`:null;const s=[];let a=!1,r=null;for(const m of w){const i=t.intervals[m];if(!(i!=null&&i.available))continue;m==="monthly"&&(a=!0);const d=M(i,m);if(d&&s.push(d),typeof i.price=="number"){const x=i.price/Ae[m];r=r===null?x:Math.min(r,x)}}if(s.length===0)return null;const l=s.join(" · ");return a||r===null?l:`${l} — about $${Math.max(1,Math.round(r))}/mo`}function $e(t){if(t instanceof oe)switch(t.code){case"already_subscribed":return"You're already subscribed — refresh to see your plan.";case"invalid_plan":case"invalid_interval":case"invalid_tier":return"That plan isn't offered on this cycle — pick another."}return"Billing isn't available right now."}function Y({text:t}){return e.jsx("p",{className:"mt-3 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:t})}function Be({summary:t,plans:n}){const s=Ie(n),[a,r]=u.useState(null),l=a!==null&&s.includes(a)?a:s[0]??null,[m,i]=u.useState(null),[d,x]=u.useState(null);async function y(o){if(!m){i(o),x(null);try{const{url:c}=l?await O(o,l):await O(o);window.location.assign(c)}catch(c){if(i(null),c instanceof R){N.getState().markExpired();return}x($e(c))}}}return e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:I(t)}),l&&s.length>1?e.jsxs("fieldset",{className:"mt-4 flex flex-wrap items-center gap-1.5",children:[e.jsx("legend",{className:"sr-only",children:"Billing interval"}),s.map(o=>{const c=o===l;return e.jsx("button",{type:"button",onClick:()=>r(o),"aria-pressed":c,className:`chip focus-ring ${c?"chip-tag-active font-medium":"chip-tag"}`,children:V[o]},o)})]}):null,n.length>0?e.jsx("ul",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:n.map(o=>{var f;const c=o.id===t.plan.tier,p=l?(f=o.intervals)==null?void 0:f[l]:void 0,h=s.length===0||(p==null?void 0:p.available)===!0,g=Oe(o,s.length>0),b=h?null:De(o);return e.jsxs("li",{className:"rounded-xl border border-border bg-bg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-serif text-lg text-fg",children:o.name}),c?e.jsx("span",{className:"chip",children:"Current"}):null]}),g?e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:g}):null,typeof o.vaults=="number"?e.jsxs("p",{className:"mt-0.5 text-xs text-fg-dim",children:[o.vaults," vault",o.vaults===1?"":"s"]}):null,c?null:h?e.jsx("button",{type:"button",onClick:()=>y(o.id),disabled:m!==null,className:"btn btn-primary btn-sm btn-touch mt-3 w-full",children:m===o.id?"Starting…":`Upgrade to ${o.name}`}):e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",disabled:!0,className:"btn btn-secondary btn-sm btn-touch w-full",children:["Not available"," ",V[l].toLowerCase()]}),b?e.jsxs("p",{className:"mt-1 text-xs text-fg-dim",children:["Available from ",M(b.entry,b.interval)]}):null]})]},o.id)})}):null,d?e.jsx(Y,{text:d}):null]})}function I(t){const{plan:n}=t,s=[n.label],a=T(t);a!==null?s.push(`${a} day${a===1?"":"s"} left`):typeof n.price_monthly_usd=="number"&&n.price_monthly_usd>0&&s.push(`$${n.price_monthly_usd}/mo`),typeof n.vault_limit=="number"&&typeof n.vaults_used=="number"&&s.push(`${n.vaults_used} of ${n.vault_limit} vaults`);const r=$(n.storage_used_bytes??0);if(r){const l=n.storage_limit_bytes?$(n.storage_limit_bytes):null;s.push(l?`${r} of ${l}`:r)}return s.join(" · ")}function Ve({vaults:t,summary:n,onReload:s}){const a=A(),[r,l]=u.useState(null),[m,i]=u.useState(null),[d,x]=u.useState(!1);async function y(h){if(!r){l(h.name),i(null);try{await ae(h.name),re(h.name),a("/")}catch(g){l(null),i(le(g,"Couldn't open that vault."))}}}async function o(){x(!0);try{await s()}finally{x(!1)}}const c=n==null?void 0:n.plan,p=c&&typeof c.vault_limit=="number"&&typeof c.vaults_used=="number"?`${c.vaults_used} of ${c.vault_limit} ${L(n)?"in the open beta":"on your plan"}`:null;return e.jsxs("section",{"aria-label":"Your vaults",className:"card p-6 shadow-soft",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Your vaults"}),p?e.jsx("span",{className:"text-xs text-fg-muted",children:p}):null]}),t==="loading"?e.jsxs("div",{"aria-busy":"true",className:"mt-4 space-y-2.5",children:[e.jsx("div",{className:"skeleton h-9 rounded-lg"}),e.jsx("div",{className:"skeleton h-9 w-4/5 rounded-lg"})]}):t==="error"?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"Couldn't load your vaults."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"A hiccup reaching your account — nothing's lost, your vaults are safe."}),e.jsx("button",{type:"button",onClick:o,disabled:d,className:"btn btn-primary btn-touch",children:d?"Retrying…":"Retry"})]}):t.length===0?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"No vaults yet."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"Create your first — a private home for your notes, always yours to export."}),e.jsx(j,{to:"/add-vault/create",className:"btn btn-primary btn-touch",children:"Create a vault"})]}):e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"mt-3 divide-y divide-border-light",children:t.map(h=>{const g=ce(h.usage),b=ne(h.name).replace(/^https?:\/\//,"");return e.jsxs("li",{className:"flex items-center gap-3 py-3",children:[e.jsx(Le,{name:h.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-serif text-lg leading-snug text-fg",children:h.name}),e.jsx("p",{className:"mt-0.5 truncate note-id",children:b}),g?e.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:g}):null]}),e.jsx("button",{type:"button",onClick:()=>y(h),disabled:r===h.name,className:"btn btn-primary btn-sm btn-touch shrink-0",children:r===h.name?"Opening…":"Open →"})]},h.name)})}),e.jsx("p",{className:"mt-3 border-t border-border-light pt-3 text-sm",children:e.jsx(j,{to:"/add-vault",className:"focus-ring font-semibold text-accent hover:underline",children:"+ Add a vault"})})]}),m?e.jsx("p",{className:"mt-4 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:m}):null]})}function Le({name:t}){const n=(t.trim()[0]??"?").toUpperCase();return e.jsx("span",{"aria-hidden":!0,className:"grid h-9 w-9 shrink-0 place-items-center rounded-full bg-grass-soft text-sm font-semibold text-grass-ink",children:n})}function F({hasActiveVault:t}){return e.jsxs("section",{"aria-label":"Connections",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Connections"}),e.jsxs("div",{className:"mt-2 divide-y divide-border-light",children:[t?e.jsx(k,{to:"/connect",tone:"sky",icon:e.jsx(D,{width:18,height:18}),title:"Connect your AI",description:"Claude, ChatGPT, or any MCP client — one memory, shared."}):e.jsxs("div",{className:"-mx-2 flex items-center gap-3 px-2 py-3 opacity-60",children:[e.jsx(U,{tone:"sky",children:e.jsx(D,{width:18,height:18})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-fg",children:"Connect your AI"}),e.jsx("p",{className:"mt-0.5 text-sm text-fg-muted",children:"Open a vault above to connect an AI to it."})]})]}),e.jsx(k,{to:"/import",tone:"grass",icon:e.jsx(Z,{width:18,height:18}),title:"Import notes",description:"Bring your notes over from anywhere markdown lives."}),e.jsx(k,{to:"/export",tone:"sun",icon:e.jsx(ee,{width:18,height:18}),title:"Export notes",description:"Download your vault as open Markdown — yours to keep."})]})]})}function k({to:t,tone:n,icon:s,title:a,description:r}){return e.jsxs(j,{to:t,className:"focus-ring -mx-2 flex items-center gap-3 rounded-lg px-2 py-3 hover:bg-bg-soft",children:[e.jsx(U,{tone:n,children:s}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-medium text-fg",children:a}),e.jsx("span",{className:"mt-0.5 block text-sm text-fg-muted",children:r})]}),e.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-lg text-fg-dim",children:"›"})]})}function U({tone:t,children:n}){const s=t==="grass"?"bg-grass-soft text-grass-ink":t==="sun"?"bg-sun-soft text-sun-ink":"bg-bg-soft";return e.jsx("span",{"aria-hidden":!0,className:`grid h-10 w-10 shrink-0 place-items-center rounded-full ${s}`,style:t==="sky"?{color:"var(--color-sky)"}:void 0,children:n})}function Te(){const t=E(s=>s.vaults),n=Object.values(t);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"This device"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"You're managing the vaults connected on this device. Sign in to your account to manage your plan and hosted vaults from anywhere."}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[e.jsx(j,{to:"/",className:"btn btn-primary btn-touch",children:"Sign in"}),e.jsx(j,{to:"/vaults",className:"btn btn-ghost btn-touch",children:n.length>0?`${n.length} connected`:"Connect a vault"})]})]}),e.jsx(F,{hasActiveVault:n.length>0})]})}export{Me as Account};
1
+ import{j as e,r as u,L as j,d as q,u as N,c as C,a as G,l as _,b as E,v as H,i as W,e as A,g as J,f as Q,s as z,m as K,h as X,I as D,k as Z,n as ee,o as te,p as L,q as ne,t as T,O as se,w as ae,x as re,y as le,z as O,S as R,A as ie,B as oe}from"./index-BwG_4Oup.js";import{f as ce,a as $}from"./provenance-D_yuCkJz.js";function ue(t,n){return t.trim().toLowerCase()===n.trim().toLowerCase()}const de={year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"};function B(t){const n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString(void 0,de)}const me={byCode:{confirm_mismatch:"That doesn't match your account email.",already_deleting:"This account is already being deleted. Check your email for the undo link."},sessionEnded:"Your sign-in has ended. Sign in again, then come back here to delete your account.",fallback:"Couldn't delete your account. Nothing has changed. Try again."};function he(t){return typeof t=="string"&&(/^https?:\/\//i.test(t)||t.startsWith("/"))}function xe(t){const{vaults:n,removeVault:s}=E.getState();for(const a of Object.values(n)){const r=H(a.url)??a.name;W(a)&&t.has(r)&&s(a.id)}}async function fe(){try{const t=await _();return new Set((Array.isArray(t==null?void 0:t.vaults)?t.vaults:[]).map(n=>n.name))}catch{return new Set}}function pe({email:t,descriptor:n,onDeleted:s}){var a;return((a=n==null?void 0:n.capabilities)==null?void 0:a.account_delete)!==!0||!t?null:e.jsx(ge,{email:t,onDeleted:s})}function ge({email:t,onDeleted:n}){const s=u.useId(),[a,r]=u.useState(""),[l,m]=u.useState(!1),[i,d]=u.useState(null),x=ue(a,t);async function y(o){if(o.preventDefault(),!(!x||l)){m(!0),d(null);try{const c=await fe(),p=await q(a.trim());N.getState().markClosed(),C(),xe(c),n(p)}catch(c){d(G(c,me))}finally{m(!1)}}}return e.jsxs("section",{"aria-label":"Delete account",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Delete account"}),e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mt-2 text-sm text-fg-muted",children:["Your account closes now and you're signed out everywhere. Everything is erased after 24 hours: your vaults, notes, files, snapshots and exports. Until then the email we send has an undo link."," ",e.jsx(j,{to:"/export",className:"focus-ring text-accent underline",children:"Export first"})," ","if you want a copy."]}),e.jsxs("form",{onSubmit:y,className:"mt-4 space-y-3",children:[e.jsx("label",{htmlFor:s,className:"block text-sm font-medium text-fg",children:"Type your account email to confirm"}),e.jsx("input",{id:s,type:"email",value:a,onChange:o=>r(o.target.value),autoComplete:"off",spellCheck:!1,placeholder:t,className:"input"}),e.jsx("button",{type:"submit",disabled:!x||l,className:"btn btn-danger-solid btn-touch",children:l?"Deleting…":"Delete my account"})]}),i?e.jsx("p",{role:"alert",className:"mt-4 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:i}):null]})]})}function ye({done:t,onDone:n}){return e.jsxs("section",{"aria-label":"Account closed",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Account closed"}),e.jsxs("div",{className:"mt-2 space-y-4",children:[t.notice_sent===!1&&he(t.undo_url)?e.jsxs("output",{className:"block text-sm text-fg-muted",children:["Your account is closed. We couldn't send the email with the undo link, so here it is:"," ",e.jsx("a",{href:t.undo_url,className:"focus-ring text-accent underline",children:"undo the deletion"}),". It works for 24 hours, until ",B(t.undo_expires_at),"."]}):e.jsxs("output",{className:"block text-sm text-fg-muted",children:["Your account is closed. We sent an email with an undo link; it works for 24 hours, until"," ",B(t.undo_expires_at),"."]}),e.jsx("button",{type:"button",onClick:n,className:"btn btn-primary btn-touch",children:"Done"})]})]})}const S="lens:account_deleted";function be(){try{const t=sessionStorage.getItem(S),n=t?JSON.parse(t):null;return n&&typeof n.undo_expires_at=="string"?n:null}catch{return null}}function je(t){try{if(t){const{undo_token:n,...s}=t;sessionStorage.setItem(S,JSON.stringify(s))}else sessionStorage.removeItem(S)}catch{}}function Me(){const[t,n]=u.useState({kind:"loading"}),[s,a]=u.useState(be),r=u.useCallback(i=>{je(i),a(i)},[]),l=A(),m=N(i=>i.identityEpoch);return u.useEffect(()=>{let i=!0;return(async()=>{let d;try{d=await J()}catch{i&&n({kind:"device"});return}i&&n(d.signed_in?{kind:"manager",email:d.email,username:d.username,csrf:d.csrf}:{kind:"device"})})(),()=>{i=!1}},[m]),e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"page-title",children:"Your parachute"}),e.jsx("p",{className:"mt-2 max-w-prose text-fg-muted",children:"Your account, plan, vaults, and connections — managed here."})]}),s?e.jsx(ye,{done:s,onDone:()=>{r(null),C(),l("/",{replace:!0})}}):t.kind==="loading"?e.jsx("output",{"aria-live":"polite",className:"block py-10 text-center text-sm text-fg-dim",children:e.jsx("span",{className:"animate-pulse",children:"Loading your account…"})}):t.kind==="device"?e.jsx(Te,{}):e.jsx(ve,{email:t.email,username:t.username,csrf:t.csrf,onDeleted:r})]})}function ve({email:t,username:n,csrf:s,onDeleted:a}){const r=A(),l=E(f=>f.getActiveVault()),m=N(f=>f.identityEpoch),i=Q(),d=i.isPending?"loading":i.data??null,x=z(i.data),y=u.useCallback(()=>i.refetch(),[i.refetch]),[o,c]=u.useState("loading"),[p,h]=u.useState(null);u.useEffect(()=>{let f=!0;return _().then(v=>{f&&c(v.vaults)}).catch(v=>{K(v),f&&c("error")}),X().then(v=>{f&&h(v)}),()=>{f=!1}},[m]);const g=u.useCallback(async()=>{try{const{vaults:f}=await _();c(f)}catch{c("error")}},[]);async function b(){try{await te(s)}finally{C(),r("/",{replace:!0})}}return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ne,{email:t,username:n,summary:x,onSignOut:b}),e.jsx(ke,{state:d,descriptor:p,onRetry:y,retrying:i.isFetching}),e.jsx(Ve,{vaults:o,summary:x,onReload:g}),e.jsx(F,{hasActiveVault:!!l}),e.jsx(pe,{email:t,descriptor:p,onDeleted:a})]})}function Ne({email:t,username:n,summary:s,onSignOut:a}){return e.jsx("section",{"aria-label":"Account",className:"card p-6 shadow-soft",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"eyebrow mb-1",children:"Signed in as"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[e.jsx("p",{className:"break-words font-serif text-xl text-fg",children:t??n??"your account"}),e.jsx(we,{summary:s})]})]}),e.jsx("button",{type:"button",onClick:a,className:"focus-ring shrink-0 text-sm text-fg-dim hover:text-accent",children:"Sign out"})]})})}function we({summary:t}){if(!t)return null;const n=T(t);return typeof n=="number"?e.jsxs("span",{className:"chip border-transparent bg-sun-soft font-medium text-sun-ink",children:["Free trial · ",n===0?"ends today":`${n} day${n===1?"":"s"} left`]}):e.jsx("span",{className:"chip",children:t.plan.label})}function ke({state:t,descriptor:n,onRetry:s,retrying:a}){if(t===null)return null;const r=t!=="loading"&&t!=="error"&&L(t);return t!=="loading"&&t!=="error"&&!t.billing_enabled&&!r?null:e.jsxs("section",{"aria-label":"Plan & billing",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Plan & billing"}),t==="loading"?e.jsxs("div",{"aria-busy":"true",className:"mt-4 space-y-2.5",children:[e.jsx("div",{className:"skeleton h-4 w-3/5 rounded-md"}),e.jsx("div",{className:"skeleton h-4 w-2/5 rounded-md"})]}):t==="error"?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"Couldn't load your plan."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"A hiccup reaching your account — your plan hasn't changed."}),e.jsx("button",{type:"button",onClick:s,disabled:a,className:"btn btn-primary btn-touch",children:a?"Retrying…":"Retry"})]}):r?e.jsx(_e,{summary:t}):t.has_billing_customer?e.jsx(Ce,{summary:t}):e.jsx(Be,{summary:t,plans:(n==null?void 0:n.plans)??[]})]})}function _e({summary:t}){const n=t.has_billing_customer&&Se.has(t.plan.tier);return e.jsxs("div",{className:"mt-4","data-testid":"open-beta-plan",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:I(t)}),e.jsx("p",{className:"mt-3 text-sm text-fg",children:se}),n?e.jsx(P,{}):null]})}const Se=new Set(["entry","standard","plus","power"]);function Ce({summary:t}){return e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:I(t)}),e.jsx(P,{})]})}function P(){const[t,n]=u.useState(!1),[s,a]=u.useState(null);async function r(){n(!0),a(null);try{const{url:l}=await ie();window.location.assign(l)}catch(l){if(n(!1),l instanceof R){N.getState().markExpired();return}a("Billing isn't available right now.")}}return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:r,disabled:t,className:"btn btn-primary btn-touch mt-4",children:t?"Opening…":"Manage plan & billing ↗"}),s?e.jsx(Y,{text:s}):null]})}const w=["monthly","quarterly","yearly"],V={monthly:"Monthly",quarterly:"Quarterly",yearly:"Yearly"},Ee={monthly:"/mo",quarterly:"/quarter",yearly:"/yr"},Ae={monthly:1,quarterly:3,yearly:12};function Ie(t){var s,a;const n=new Set;for(const r of t)for(const l of w)(a=(s=r.intervals)==null?void 0:s[l])!=null&&a.available&&n.add(l);return w.filter(r=>n.has(r))}function M(t,n){return t.label?t.label:typeof t.price=="number"?`$${t.price}${Ee[n]}`:null}function De(t){var n;for(const s of w){const a=(n=t.intervals)==null?void 0:n[s];if(a!=null&&a.available)return{interval:s,entry:a}}return null}function Oe(t,n){if(!n||!t.intervals)return typeof t.price_month=="number"?`$${t.price_month}/mo`:null;const s=[];let a=!1,r=null;for(const m of w){const i=t.intervals[m];if(!(i!=null&&i.available))continue;m==="monthly"&&(a=!0);const d=M(i,m);if(d&&s.push(d),typeof i.price=="number"){const x=i.price/Ae[m];r=r===null?x:Math.min(r,x)}}if(s.length===0)return null;const l=s.join(" · ");return a||r===null?l:`${l} — about $${Math.max(1,Math.round(r))}/mo`}function $e(t){if(t instanceof oe)switch(t.code){case"already_subscribed":return"You're already subscribed — refresh to see your plan.";case"invalid_plan":case"invalid_interval":case"invalid_tier":return"That plan isn't offered on this cycle — pick another."}return"Billing isn't available right now."}function Y({text:t}){return e.jsx("p",{className:"mt-3 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:t})}function Be({summary:t,plans:n}){const s=Ie(n),[a,r]=u.useState(null),l=a!==null&&s.includes(a)?a:s[0]??null,[m,i]=u.useState(null),[d,x]=u.useState(null);async function y(o){if(!m){i(o),x(null);try{const{url:c}=l?await O(o,l):await O(o);window.location.assign(c)}catch(c){if(i(null),c instanceof R){N.getState().markExpired();return}x($e(c))}}}return e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:I(t)}),l&&s.length>1?e.jsxs("fieldset",{className:"mt-4 flex flex-wrap items-center gap-1.5",children:[e.jsx("legend",{className:"sr-only",children:"Billing interval"}),s.map(o=>{const c=o===l;return e.jsx("button",{type:"button",onClick:()=>r(o),"aria-pressed":c,className:`chip focus-ring ${c?"chip-tag-active font-medium":"chip-tag"}`,children:V[o]},o)})]}):null,n.length>0?e.jsx("ul",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:n.map(o=>{var f;const c=o.id===t.plan.tier,p=l?(f=o.intervals)==null?void 0:f[l]:void 0,h=s.length===0||(p==null?void 0:p.available)===!0,g=Oe(o,s.length>0),b=h?null:De(o);return e.jsxs("li",{className:"rounded-xl border border-border bg-bg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-serif text-lg text-fg",children:o.name}),c?e.jsx("span",{className:"chip",children:"Current"}):null]}),g?e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:g}):null,typeof o.vaults=="number"?e.jsxs("p",{className:"mt-0.5 text-xs text-fg-dim",children:[o.vaults," vault",o.vaults===1?"":"s"]}):null,c?null:h?e.jsx("button",{type:"button",onClick:()=>y(o.id),disabled:m!==null,className:"btn btn-primary btn-sm btn-touch mt-3 w-full",children:m===o.id?"Starting…":`Upgrade to ${o.name}`}):e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",disabled:!0,className:"btn btn-secondary btn-sm btn-touch w-full",children:["Not available"," ",V[l].toLowerCase()]}),b?e.jsxs("p",{className:"mt-1 text-xs text-fg-dim",children:["Available from ",M(b.entry,b.interval)]}):null]})]},o.id)})}):null,d?e.jsx(Y,{text:d}):null]})}function I(t){const{plan:n}=t,s=[n.label],a=T(t);a!==null?s.push(`${a} day${a===1?"":"s"} left`):typeof n.price_monthly_usd=="number"&&n.price_monthly_usd>0&&s.push(`$${n.price_monthly_usd}/mo`),typeof n.vault_limit=="number"&&typeof n.vaults_used=="number"&&s.push(`${n.vaults_used} of ${n.vault_limit} vaults`);const r=$(n.storage_used_bytes??0);if(r){const l=n.storage_limit_bytes?$(n.storage_limit_bytes):null;s.push(l?`${r} of ${l}`:r)}return s.join(" · ")}function Ve({vaults:t,summary:n,onReload:s}){const a=A(),[r,l]=u.useState(null),[m,i]=u.useState(null),[d,x]=u.useState(!1);async function y(h){if(!r){l(h.name),i(null);try{await ae(h.name),re(h.name),a("/")}catch(g){l(null),i(le(g,"Couldn't open that vault."))}}}async function o(){x(!0);try{await s()}finally{x(!1)}}const c=n==null?void 0:n.plan,p=c&&typeof c.vault_limit=="number"&&typeof c.vaults_used=="number"?`${c.vaults_used} of ${c.vault_limit} ${L(n)?"in the open beta":"on your plan"}`:null;return e.jsxs("section",{"aria-label":"Your vaults",className:"card p-6 shadow-soft",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Your vaults"}),p?e.jsx("span",{className:"text-xs text-fg-muted",children:p}):null]}),t==="loading"?e.jsxs("div",{"aria-busy":"true",className:"mt-4 space-y-2.5",children:[e.jsx("div",{className:"skeleton h-9 rounded-lg"}),e.jsx("div",{className:"skeleton h-9 w-4/5 rounded-lg"})]}):t==="error"?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"Couldn't load your vaults."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"A hiccup reaching your account — nothing's lost, your vaults are safe."}),e.jsx("button",{type:"button",onClick:o,disabled:d,className:"btn btn-primary btn-touch",children:d?"Retrying…":"Retry"})]}):t.length===0?e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("p",{className:"mb-1 font-serif text-lg text-fg",children:"No vaults yet."}),e.jsx("p",{className:"mb-5 text-sm text-fg-muted",children:"Create your first — a private home for your notes, always yours to export."}),e.jsx(j,{to:"/add-vault/create",className:"btn btn-primary btn-touch",children:"Create a vault"})]}):e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"mt-3 divide-y divide-border-light",children:t.map(h=>{const g=ce(h.usage),b=ne(h.name).replace(/^https?:\/\//,"");return e.jsxs("li",{className:"flex items-center gap-3 py-3",children:[e.jsx(Le,{name:h.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-serif text-lg leading-snug text-fg",children:h.name}),e.jsx("p",{className:"mt-0.5 truncate note-id",children:b}),g?e.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:g}):null]}),e.jsx("button",{type:"button",onClick:()=>y(h),disabled:r===h.name,className:"btn btn-primary btn-sm btn-touch shrink-0",children:r===h.name?"Opening…":"Open →"})]},h.name)})}),e.jsx("p",{className:"mt-3 border-t border-border-light pt-3 text-sm",children:e.jsx(j,{to:"/add-vault",className:"focus-ring font-semibold text-accent hover:underline",children:"+ Add a vault"})})]}),m?e.jsx("p",{className:"mt-4 rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:m}):null]})}function Le({name:t}){const n=(t.trim()[0]??"?").toUpperCase();return e.jsx("span",{"aria-hidden":!0,className:"grid h-9 w-9 shrink-0 place-items-center rounded-full bg-grass-soft text-sm font-semibold text-grass-ink",children:n})}function F({hasActiveVault:t}){return e.jsxs("section",{"aria-label":"Connections",className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"Connections"}),e.jsxs("div",{className:"mt-2 divide-y divide-border-light",children:[t?e.jsx(k,{to:"/connect",tone:"sky",icon:e.jsx(D,{width:18,height:18}),title:"Connect your AI",description:"Claude, ChatGPT, or any MCP client — one memory, shared."}):e.jsxs("div",{className:"-mx-2 flex items-center gap-3 px-2 py-3 opacity-60",children:[e.jsx(U,{tone:"sky",children:e.jsx(D,{width:18,height:18})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-fg",children:"Connect your AI"}),e.jsx("p",{className:"mt-0.5 text-sm text-fg-muted",children:"Open a vault above to connect an AI to it."})]})]}),e.jsx(k,{to:"/import",tone:"grass",icon:e.jsx(Z,{width:18,height:18}),title:"Import notes",description:"Bring your notes over from anywhere markdown lives."}),e.jsx(k,{to:"/export",tone:"sun",icon:e.jsx(ee,{width:18,height:18}),title:"Export notes",description:"Download your vault as open Markdown — yours to keep."})]})]})}function k({to:t,tone:n,icon:s,title:a,description:r}){return e.jsxs(j,{to:t,className:"focus-ring -mx-2 flex items-center gap-3 rounded-lg px-2 py-3 hover:bg-bg-soft",children:[e.jsx(U,{tone:n,children:s}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-medium text-fg",children:a}),e.jsx("span",{className:"mt-0.5 block text-sm text-fg-muted",children:r})]}),e.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-lg text-fg-dim",children:"›"})]})}function U({tone:t,children:n}){const s=t==="grass"?"bg-grass-soft text-grass-ink":t==="sun"?"bg-sun-soft text-sun-ink":"bg-bg-soft";return e.jsx("span",{"aria-hidden":!0,className:`grid h-10 w-10 shrink-0 place-items-center rounded-full ${s}`,style:t==="sky"?{color:"var(--color-sky)"}:void 0,children:n})}function Te(){const t=E(s=>s.vaults),n=Object.values(t);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"card p-6 shadow-soft",children:[e.jsx("h2",{className:"font-serif text-xl text-fg",children:"This device"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"You're managing the vaults connected on this device. Sign in to your account to manage your plan and hosted vaults from anywhere."}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[e.jsx(j,{to:"/",className:"btn btn-primary btn-touch",children:"Sign in"}),e.jsx(j,{to:"/vaults",className:"btn btn-ghost btn-touch",children:n.length>0?`${n.length} connected`:"Connect a vault"})]})]}),e.jsx(F,{hasActiveVault:n.length>0})]})}export{Me as Account};
@@ -1 +1 @@
1
- import{b as f,C as y,D as g,E as j,F as N,r as u,j as e,N as b,G as v,H as D,J as E,L as m,K as w,M as k,V as A}from"./index-CkXqzhj_.js";const x=1440*60*1e3,S=5e3;function T(a,i=30,t=new Date){const n=t.getTime()-i*x,r=[];for(const s of a){const o=s.path??s.id,d=Date.parse(s.createdAt);if(Number.isFinite(d)&&d>=n&&r.push({id:`${s.id}:created`,noteId:s.id,noteName:o,kind:"created",at:s.createdAt,preview:s.preview,tags:s.tags}),s.updatedAt){const l=Date.parse(s.updatedAt);Number.isFinite(l)&&l>=n&&Number.isFinite(d)&&l-d>S&&r.push({id:`${s.id}:updated`,noteId:s.id,noteName:o,kind:"updated",at:s.updatedAt,preview:s.preview,tags:s.tags})}}return r.sort((s,o)=>Date.parse(o.at)-Date.parse(s.at)),r}const C=["today","yesterday","thisWeek","older"],_={today:"Today",yesterday:"Yesterday",thisWeek:"This week",older:"Older"};function B(a,i=new Date){const t=Date.parse(a);if(!Number.isFinite(t))return null;const n=p(i),r=p(new Date(t)),s=Math.round((n.getTime()-r.getTime())/x);return s<0||s===0?"today":s===1?"yesterday":s<7?"thisWeek":"older"}function p(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())}function I(a,i=new Date){const t={today:[],yesterday:[],thisWeek:[],older:[]};for(const n of a){const r=B(n.at,i);r&&t[r].push(n)}return t}const h=50;function O(){const a=f(c=>c.getActiveVault()),i=y(g(),-29),t=j({field:"updated_at",from:N(i),limit:v}),[n,r]=u.useState(h),s=u.useMemo(()=>t.data?T(t.data):[],[t.data]),o=u.useMemo(()=>s.slice(0,n),[s,n]),d=u.useMemo(()=>I(o),[o]),l=s.length-o.length;return a?e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"eyebrow mb-1",children:"Activity"}),e.jsx("h1",{className:"page-title",children:"Recent changes"}),e.jsx("p",{className:"mt-2 text-fg-muted",children:"Last 30 days, newest first. Deletions aren't tracked yet."})]}),t.isPending?e.jsx(L,{}):t.isError?e.jsx(V,{error:t.error,retry:()=>t.refetch()}):s.length===0?e.jsx(F,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-8",children:C.map(c=>d[c].length>0?e.jsx(M,{title:_[c],events:d[c]},c):null)}),l>0?e.jsx("div",{className:"mt-8 flex justify-center",children:e.jsxs("button",{type:"button",onClick:()=>r(c=>c+h),className:"btn btn-secondary btn-touch",children:["Load more (",l," remaining)"]})}):null]})]}):e.jsx(b,{to:"/",replace:!0})}function M({title:a,events:i}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"eyebrow mb-3",children:[a," (",i.length,")"]}),e.jsx("ol",{className:"card shadow-soft divide-y divide-border rounded-xl",children:i.map(t=>e.jsx("li",{children:e.jsxs(m,{to:`/n/${encodeURIComponent(t.noteId)}`,className:"focus-ring block px-5 py-4 transition-colors hover:bg-bg-soft",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(R,{kind:t.kind}),e.jsx("span",{className:"truncate font-mono text-sm text-fg",children:t.noteName})]}),e.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:k(t.at)})]}),t.preview?e.jsx("p",{className:"mt-1 truncate text-sm text-fg-muted",children:t.preview}):null,t.tags&&t.tags.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.tags.map(n=>e.jsxs("span",{className:"chip chip-tag max-w-full break-all",children:["#",n]},n))}):null]})},t.id))})]})}function R({kind:a}){return a==="created"?e.jsx("span",{className:"chip chip-tag shrink-0",children:"Created"}):e.jsx("span",{className:"chip shrink-0",children:"Edited"})}function F(){return e.jsx(w,{title:"No activity in the last 30 days.",action:e.jsx(m,{to:"/new",className:"btn btn-primary",children:"New note"})})}function L(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3,4].map(a=>e.jsx(D,{className:"h-16 rounded-xl"},a))})}function V({error:a,retry:i}){const t=a instanceof A;return e.jsx(E,{title:t?"Session expired":"Could not load activity",message:a.message,action:t?e.jsx(m,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):e.jsx("button",{type:"button",onClick:i,className:"btn btn-secondary",children:"Retry"})})}export{O as Activity};
1
+ import{b as f,C as y,D as g,E as j,F as N,r as u,j as e,N as b,G as v,H as D,J as E,L as m,K as w,M as k,V as A}from"./index-BwG_4Oup.js";const x=1440*60*1e3,S=5e3;function T(a,i=30,t=new Date){const n=t.getTime()-i*x,r=[];for(const s of a){const o=s.path??s.id,d=Date.parse(s.createdAt);if(Number.isFinite(d)&&d>=n&&r.push({id:`${s.id}:created`,noteId:s.id,noteName:o,kind:"created",at:s.createdAt,preview:s.preview,tags:s.tags}),s.updatedAt){const l=Date.parse(s.updatedAt);Number.isFinite(l)&&l>=n&&Number.isFinite(d)&&l-d>S&&r.push({id:`${s.id}:updated`,noteId:s.id,noteName:o,kind:"updated",at:s.updatedAt,preview:s.preview,tags:s.tags})}}return r.sort((s,o)=>Date.parse(o.at)-Date.parse(s.at)),r}const C=["today","yesterday","thisWeek","older"],_={today:"Today",yesterday:"Yesterday",thisWeek:"This week",older:"Older"};function B(a,i=new Date){const t=Date.parse(a);if(!Number.isFinite(t))return null;const n=p(i),r=p(new Date(t)),s=Math.round((n.getTime()-r.getTime())/x);return s<0||s===0?"today":s===1?"yesterday":s<7?"thisWeek":"older"}function p(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())}function I(a,i=new Date){const t={today:[],yesterday:[],thisWeek:[],older:[]};for(const n of a){const r=B(n.at,i);r&&t[r].push(n)}return t}const h=50;function O(){const a=f(c=>c.getActiveVault()),i=y(g(),-29),t=j({field:"updated_at",from:N(i),limit:v}),[n,r]=u.useState(h),s=u.useMemo(()=>t.data?T(t.data):[],[t.data]),o=u.useMemo(()=>s.slice(0,n),[s,n]),d=u.useMemo(()=>I(o),[o]),l=s.length-o.length;return a?e.jsxs("div",{className:"page-prose",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"eyebrow mb-1",children:"Activity"}),e.jsx("h1",{className:"page-title",children:"Recent changes"}),e.jsx("p",{className:"mt-2 text-fg-muted",children:"Last 30 days, newest first. Deletions aren't tracked yet."})]}),t.isPending?e.jsx(L,{}):t.isError?e.jsx(V,{error:t.error,retry:()=>t.refetch()}):s.length===0?e.jsx(F,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-8",children:C.map(c=>d[c].length>0?e.jsx(M,{title:_[c],events:d[c]},c):null)}),l>0?e.jsx("div",{className:"mt-8 flex justify-center",children:e.jsxs("button",{type:"button",onClick:()=>r(c=>c+h),className:"btn btn-secondary btn-touch",children:["Load more (",l," remaining)"]})}):null]})]}):e.jsx(b,{to:"/",replace:!0})}function M({title:a,events:i}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"eyebrow mb-3",children:[a," (",i.length,")"]}),e.jsx("ol",{className:"card shadow-soft divide-y divide-border rounded-xl",children:i.map(t=>e.jsx("li",{children:e.jsxs(m,{to:`/n/${encodeURIComponent(t.noteId)}`,className:"focus-ring block px-5 py-4 transition-colors hover:bg-bg-soft",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(R,{kind:t.kind}),e.jsx("span",{className:"truncate font-mono text-sm text-fg",children:t.noteName})]}),e.jsx("span",{className:"shrink-0 text-xs text-fg-dim",children:k(t.at)})]}),t.preview?e.jsx("p",{className:"mt-1 truncate text-sm text-fg-muted",children:t.preview}):null,t.tags&&t.tags.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.tags.map(n=>e.jsxs("span",{className:"chip chip-tag max-w-full break-all",children:["#",n]},n))}):null]})},t.id))})]})}function R({kind:a}){return a==="created"?e.jsx("span",{className:"chip chip-tag shrink-0",children:"Created"}):e.jsx("span",{className:"chip shrink-0",children:"Edited"})}function F(){return e.jsx(w,{title:"No activity in the last 30 days.",action:e.jsx(m,{to:"/new",className:"btn btn-primary",children:"New note"})})}function L(){return e.jsx("div",{className:"space-y-3","aria-busy":"true",children:[0,1,2,3,4].map(a=>e.jsx(D,{className:"h-16 rounded-xl"},a))})}function V({error:a,retry:i}){const t=a instanceof A;return e.jsx(E,{title:t?"Session expired":"Could not load activity",message:a.message,action:t?e.jsx(m,{to:"/add",className:"btn btn-primary",children:"Reconnect vault"}):e.jsx("button",{type:"button",onClick:i,className:"btn btn-secondary",children:"Retry"})})}export{O as Activity};
@@ -1 +1 @@
1
- import{P as E,Q as I,R as z,r as s,T as V,U as g,W as A,X as F,b as H,Y as W,Z as q,_ as B,j as e,$ as L,a0 as M}from"./index-CkXqzhj_.js";import{W as O}from"./WizardShell-CDZWRkFh.js";import"./history-B2ZH4y8B.js";function T(r){const o=r.trim();if(!o)return null;try{return new URL(g(o)).host}catch{return null}}function X(){const[r,o]=E(),p=I(),m=r.get("url")??"",u=r.get("add")??"",f=/^https?:\/\//i.test(u),v=m||(f?u:""),i=z(r.get("redirect")),[a,j]=s.useState(v),[y,x]=s.useState(null),[P,w]=s.useState(!1),[h,N]=s.useState(!1),S=s.useRef(null),U=s.useRef(v.length>0),C=s.useRef(!1),c=V();s.useEffect(()=>{var t;(t=S.current)==null||t.focus()},[]),s.useEffect(()=>{U.current||c.status==="found"&&c.origin&&a===""&&(j(c.origin),U.current=!0)},[c.status,c.origin,a]);const b=s.useCallback(async t=>{x(null),w(!1);let l;try{l=g(t)}catch(n){x(n.message);return}N(!0);try{const{authorizeUrl:n}=await A(l,void 0,void 0,{...i?{redirect:i}:{}});window.location.assign(n)}catch(n){n instanceof F?w(!0):x(n.message),N(!1)}},[i]);s.useEffect(()=>{if(C.current||!u)return;C.current=!0;const t=new URLSearchParams(r);if(t.delete("add"),o(t,{replace:!0}),m||!f)return;let l;try{l=g(u)}catch{return}const R=H.getState().vaults[W(l)];if(R){q(R.id,{toast:!0}),p(B(i??"/"),{replace:!0});return}b(l)},[u,f,m,i,r,o,p,b]);function k(t){t.preventDefault(),b(a)}const d=T(a);return e.jsxs(O,{escape:{kind:"back",to:"/"},children:[e.jsx(L,{size:60,className:"mx-auto mb-6 drop-in"}),e.jsx("p",{className:"eyebrow mb-3",children:"Self-hosted"}),e.jsxs("h1",{className:"hero-title mb-4",children:["Connect your ",e.jsx("span",{className:"accent-word",children:"own"})," vault."]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-lg leading-relaxed text-fg-muted",children:"Point Parachute at a vault running on your own server."}),e.jsxs("form",{onSubmit:k,className:"mx-auto w-full max-w-sm text-left",children:[e.jsx("label",{htmlFor:"vault-url",className:"eyebrow mb-2 block",children:"Vault address"}),e.jsx("input",{id:"vault-url",ref:S,type:"url",required:!0,placeholder:"hub.your-domain.com",value:a,onChange:t=>j(t.target.value),disabled:h,className:"input input-on-bg font-mono"}),e.jsxs("p",{className:"mt-1.5 text-xs text-fg-dim",children:["A local install lives at ",e.jsx("code",{className:"note-id",children:"http://localhost:1939"}),"."]}),P?e.jsx("div",{className:"mt-3",children:e.jsx(M,{})}):null,y?e.jsx("p",{className:"mt-3 rounded-xl border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:y}):null,d?e.jsxs("div",{className:"mt-5 rounded-2xl border border-sun bg-sun-soft px-4 py-3 text-left font-round text-sm leading-relaxed text-sun-ink",children:["Next, ",e.jsx("b",{className:"font-semibold text-fg",children:d})," — your server, not ours — will ask you to sign in and approve this app. Then you land right back here."]}):null,e.jsx("button",{type:"submit",disabled:h||!a,className:"btn btn-primary btn-lg mt-5 w-full justify-center rounded-full shadow-soft",children:h?"Continuing…":d?`Continue to ${d} →`:"Continue"})]})]})}export{X as AddVault};
1
+ import{P as E,Q as I,R as z,r as s,T as V,U as g,W as A,X as F,b as H,Y as W,Z as q,_ as B,j as e,$ as L,a0 as M}from"./index-BwG_4Oup.js";import{W as O}from"./WizardShell-Cp46Sjm6.js";import"./history-DeQhlq0x.js";function T(r){const o=r.trim();if(!o)return null;try{return new URL(g(o)).host}catch{return null}}function X(){const[r,o]=E(),p=I(),m=r.get("url")??"",u=r.get("add")??"",f=/^https?:\/\//i.test(u),v=m||(f?u:""),i=z(r.get("redirect")),[a,j]=s.useState(v),[y,x]=s.useState(null),[P,w]=s.useState(!1),[h,N]=s.useState(!1),S=s.useRef(null),U=s.useRef(v.length>0),C=s.useRef(!1),c=V();s.useEffect(()=>{var t;(t=S.current)==null||t.focus()},[]),s.useEffect(()=>{U.current||c.status==="found"&&c.origin&&a===""&&(j(c.origin),U.current=!0)},[c.status,c.origin,a]);const b=s.useCallback(async t=>{x(null),w(!1);let l;try{l=g(t)}catch(n){x(n.message);return}N(!0);try{const{authorizeUrl:n}=await A(l,void 0,void 0,{...i?{redirect:i}:{}});window.location.assign(n)}catch(n){n instanceof F?w(!0):x(n.message),N(!1)}},[i]);s.useEffect(()=>{if(C.current||!u)return;C.current=!0;const t=new URLSearchParams(r);if(t.delete("add"),o(t,{replace:!0}),m||!f)return;let l;try{l=g(u)}catch{return}const R=H.getState().vaults[W(l)];if(R){q(R.id,{toast:!0}),p(B(i??"/"),{replace:!0});return}b(l)},[u,f,m,i,r,o,p,b]);function k(t){t.preventDefault(),b(a)}const d=T(a);return e.jsxs(O,{escape:{kind:"back",to:"/"},children:[e.jsx(L,{size:60,className:"mx-auto mb-6 drop-in"}),e.jsx("p",{className:"eyebrow mb-3",children:"Self-hosted"}),e.jsxs("h1",{className:"hero-title mb-4",children:["Connect your ",e.jsx("span",{className:"accent-word",children:"own"})," vault."]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-lg leading-relaxed text-fg-muted",children:"Point Parachute at a vault running on your own server."}),e.jsxs("form",{onSubmit:k,className:"mx-auto w-full max-w-sm text-left",children:[e.jsx("label",{htmlFor:"vault-url",className:"eyebrow mb-2 block",children:"Vault address"}),e.jsx("input",{id:"vault-url",ref:S,type:"url",required:!0,placeholder:"hub.your-domain.com",value:a,onChange:t=>j(t.target.value),disabled:h,className:"input input-on-bg font-mono"}),e.jsxs("p",{className:"mt-1.5 text-xs text-fg-dim",children:["A local install lives at ",e.jsx("code",{className:"note-id",children:"http://localhost:1939"}),"."]}),P?e.jsx("div",{className:"mt-3",children:e.jsx(M,{})}):null,y?e.jsx("p",{className:"mt-3 rounded-xl border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:y}):null,d?e.jsxs("div",{className:"mt-5 rounded-2xl border border-sun bg-sun-soft px-4 py-3 text-left font-round text-sm leading-relaxed text-sun-ink",children:["Next, ",e.jsx("b",{className:"font-semibold text-fg",children:d})," — your server, not ours — will ask you to sign in and approve this app. Then you land right back here."]}):null,e.jsx("button",{type:"submit",disabled:h||!a,className:"btn btn-primary btn-lg mt-5 w-full justify-center rounded-full shadow-soft",children:h?"Continuing…":d?`Continue to ${d} →`:"Continue"})]})]})}export{X as AddVault};
@@ -1 +1 @@
1
- import{e as o,a1 as c,b as d,j as e,$ as m}from"./index-CkXqzhj_.js";import{W as x}from"./WizardShell-CDZWRkFh.js";import"./history-B2ZH4y8B.js";function f(){const s=o(),a=c(),t=d(l=>l.getActiveVault()),n=null,r=t?"/vaults":"/";return e.jsxs(x,{wide:!0,escape:{kind:"back",to:r},children:[e.jsx(m,{size:56,className:"mx-auto mb-6"}),a?e.jsxs("p",{className:"chip mb-4 inline-flex border-grass/40 bg-grass-soft text-grass-ink",children:[e.jsx("span",{"aria-hidden":"true",children:"✓"})," Signed in as ",a]}):null,e.jsx("p",{className:"eyebrow mb-3",children:"Add a vault"}),e.jsxs("h1",{className:"hero-title mb-8",style:{fontSize:"clamp(1.8rem, 4vw, 2.4rem)"},children:["Bring another ",e.jsx("span",{className:"accent-word",children:"vault"})," in."]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsx(i,{icon:"📂",verb:"Open",description:"One of your account's vaults not on this device.",onClick:()=>s("/welcome?pick=1")}),e.jsx(i,{icon:"✦",verb:"Create",description:t?e.jsxs(e.Fragment,{children:["Brand-new and empty — separate from"," ",e.jsx("b",{className:"font-semibold text-fg",children:t.name}),"."]}):"Brand-new and empty — its own private space, nothing shared.",foot:n,onClick:()=>s("/add-vault/create")}),e.jsx(i,{icon:"⌂",verb:"Connect",description:"A self-hosted vault on your own server.",onClick:()=>s("/add")})]})]})}function i({icon:s,verb:a,description:t,foot:n,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,"aria-label":a,className:"tile flex flex-col items-center gap-2 p-6 text-center",children:[e.jsx("span",{"aria-hidden":"true",className:"text-xl",children:s}),e.jsx("span",{"aria-hidden":"true",className:"font-round text-base font-bold text-fg",children:a}),e.jsx("span",{className:"font-round text-xs leading-relaxed text-fg-muted",children:t}),n?e.jsx("span",{className:"mt-1 font-round text-xs text-fg-dim",children:n}):null]})}export{f as AddVaultChooser};
1
+ import{e as o,a1 as c,b as d,j as e,$ as m}from"./index-BwG_4Oup.js";import{W as x}from"./WizardShell-Cp46Sjm6.js";import"./history-DeQhlq0x.js";function f(){const s=o(),a=c(),t=d(l=>l.getActiveVault()),n=null,r=t?"/vaults":"/";return e.jsxs(x,{wide:!0,escape:{kind:"back",to:r},children:[e.jsx(m,{size:56,className:"mx-auto mb-6"}),a?e.jsxs("p",{className:"chip mb-4 inline-flex border-grass/40 bg-grass-soft text-grass-ink",children:[e.jsx("span",{"aria-hidden":"true",children:"✓"})," Signed in as ",a]}):null,e.jsx("p",{className:"eyebrow mb-3",children:"Add a vault"}),e.jsxs("h1",{className:"hero-title mb-8",style:{fontSize:"clamp(1.8rem, 4vw, 2.4rem)"},children:["Bring another ",e.jsx("span",{className:"accent-word",children:"vault"})," in."]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsx(i,{icon:"📂",verb:"Open",description:"One of your account's vaults not on this device.",onClick:()=>s("/welcome?pick=1")}),e.jsx(i,{icon:"✦",verb:"Create",description:t?e.jsxs(e.Fragment,{children:["Brand-new and empty — separate from"," ",e.jsx("b",{className:"font-semibold text-fg",children:t.name}),"."]}):"Brand-new and empty — its own private space, nothing shared.",foot:n,onClick:()=>s("/add-vault/create")}),e.jsx(i,{icon:"⌂",verb:"Connect",description:"A self-hosted vault on your own server.",onClick:()=>s("/add")})]})]})}function i({icon:s,verb:a,description:t,foot:n,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,"aria-label":a,className:"tile flex flex-col items-center gap-2 p-6 text-center",children:[e.jsx("span",{"aria-hidden":"true",className:"text-xl",children:s}),e.jsx("span",{"aria-hidden":"true",className:"font-round text-base font-bold text-fg",children:a}),e.jsx("span",{className:"font-round text-xs leading-relaxed text-fg-muted",children:t}),n?e.jsx("span",{className:"mt-1 font-round text-xs text-fg-dim",children:n}):null]})}export{f as AddVaultChooser};
@@ -1 +1 @@
1
- import{e as y,P as j,r as u,a2 as v,y as N,j as e,N as w,$ as f,a1 as k,b as S,q as C,w as E,x as A}from"./index-CkXqzhj_.js";import{W as p}from"./WizardShell-CDZWRkFh.js";import"./history-B2ZH4y8B.js";const g=["Name","Making it","Ready"];function b(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g,"")}function R(t){return t.trim().replace(/[\s-]*\s[\s-]*/g,"-")}function O(){const t=y(),[l]=j(),a=l.get("first")==="1",[s,r]=u.useState({kind:"naming"}),i=u.useRef(null);return u.useEffect(()=>{if(s.kind!=="creating"||i.current===s.name)return;i.current=s.name;const{name:o}=s;(async()=>{try{const c=await v(o),n=new URLSearchParams({vault:c});a&&n.set("first","1"),t(`/add-vault/ready?${n.toString()}`,{replace:!0})}catch(c){i.current=null,r({kind:"naming",attemptedName:o,error:N(c,"Couldn't create your vault. Try a different name.")})}})()},[s,t,a]),s.kind==="creating"?e.jsx(p,{escape:{kind:"none"},progress:{labels:g,current:1},children:e.jsx(z,{name:s.name})}):e.jsx(p,{escape:{kind:"back",to:a?"/":"/add-vault"},progress:{labels:g,current:0},children:e.jsx(V,{first:a,initialName:s.attemptedName,error:s.error,onCreate:o=>r({kind:"creating",name:o})})})}function T({email:t}){return t?e.jsxs("p",{className:"chip mb-4 inline-flex border-grass/40 bg-grass-soft text-grass-ink",children:[e.jsx("span",{"aria-hidden":"true",children:"✓"})," Signed in as ",t]}):null}function V({first:t,initialName:l,error:a,onCreate:s}){const[r,i]=u.useState(()=>b(l??"")),o=k(),c=S(m=>{var h;return((h=m.getActiveVault())==null?void 0:h.name)??null}),n=R(r);function d(m){m.preventDefault(),n&&s(n)}return e.jsxs(e.Fragment,{children:[e.jsx(f,{size:60,className:"mx-auto mb-6 drop-in"}),e.jsx(T,{email:o}),e.jsx("p",{className:"eyebrow mb-3",children:t?"Account created ✓":"Adding a vault"}),e.jsxs("h1",{className:"hero-title mb-4",children:[t?"Let's make your first":"Let's make your new"," ",e.jsx("span",{className:"accent-word",children:"vault."})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-md text-lg leading-relaxed text-fg-muted",children:t?e.jsxs(e.Fragment,{children:["A vault is the private home for your notes — any AI you invite can read it, always yours to export. ",e.jsx("b",{className:"font-semibold text-fg",children:"This creates a brand-new, empty one."})]}):e.jsxs(e.Fragment,{children:["This one's separate from"," ",e.jsx("b",{className:"font-semibold text-fg",children:c??"your other vault"})," — its own private space, nothing shared."]})}),e.jsxs("form",{onSubmit:d,children:[e.jsx("input",{autoFocus:!0,value:r,onChange:m=>i(b(m.target.value)),placeholder:"moss",autoComplete:"off",spellCheck:!1,"aria-label":"Vault name",className:"mx-auto mb-2 block w-full max-w-sm border-0 border-b-2 border-border bg-transparent pb-2 text-center font-serif text-3xl text-fg outline-none transition-colors focus:border-accent-light"}),e.jsx("p",{className:"mb-6 min-h-6 font-round text-sm text-fg-muted",children:n?e.jsxs("span",{children:["Your vault:"," ",e.jsx("b",{className:"rounded-md bg-grass-soft px-2 py-0.5 text-grass-ink",children:n})," — you'll find it at ",e.jsx("span",{className:"font-mono text-xs",children:C(n)})]}):null}),e.jsxs("p",{className:"mx-auto mb-8 max-w-sm font-round text-xs text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg-muted",children:"The address is permanent"}),", so pick a word you like. Letters, numbers, hyphens."]}),a?e.jsx("p",{className:"mx-auto mb-6 max-w-sm rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:a}):null,e.jsx("button",{type:"submit",disabled:!n,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:n?`Create ${n} →`:"Create →"})]})]})}const x=["Setting up your vault…","Preparing your keys…","Almost there…"];function P(){const[t,l]=u.useState(0);return u.useEffect(()=>{if(t>=x.length-1)return;const a=setTimeout(()=>l(s=>Math.min(s+1,x.length-1)),650);return()=>clearTimeout(a)},[t]),e.jsx("output",{"aria-live":"polite",className:"font-round text-sm text-fg-muted",children:x[t]})}function z({name:t}){return e.jsxs(e.Fragment,{children:[e.jsx(f,{size:96,className:"mx-auto mb-6 animate-pulse"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.6rem, 3.5vw, 1.9rem)"},children:["Making a place for ",e.jsxs("span",{className:"accent-word",children:[t,"…"]})]}),e.jsx(P,{})]})}function M(){const t=y(),[l]=j(),a=l.get("vault")??"",s=l.get("first")==="1",[r,i]=u.useState(!1),[o,c]=u.useState(null);if(!a)return e.jsx(w,{to:"/add-vault",replace:!0});async function n(){if(!r){i(!0),c(null);try{await E(a),A(a),t("/")}catch(d){i(!1),c(N(d,"Couldn't open your vault. Try again."))}}}return e.jsxs(p,{escape:s?{kind:"none"}:{kind:"maybe-later",to:"/"},progress:{labels:g,current:2},children:[e.jsx(f,{size:90,className:"mx-auto mb-6 fade-up"}),e.jsx("p",{className:"eyebrow mb-3",children:"Ready"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.8rem, 4vw, 2.3rem)"},children:[a," is ",e.jsx("span",{className:"accent-word",children:"ready."})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-fg-muted",children:"Everything inside is yours. Open format. Export anytime."}),o?e.jsx("p",{className:"mx-auto mb-6 max-w-sm rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:o}):null,e.jsx("button",{type:"button",onClick:n,disabled:r,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:r?"Opening…":`Open ${a} →`})]})}export{O as AddVaultCreate,M as AddVaultReady};
1
+ import{e as y,P as j,r as u,a2 as v,y as N,j as e,N as w,$ as f,a1 as k,b as S,q as C,w as E,x as A}from"./index-BwG_4Oup.js";import{W as p}from"./WizardShell-Cp46Sjm6.js";import"./history-DeQhlq0x.js";const g=["Name","Making it","Ready"];function b(t){return t.toLowerCase().replace(/[^a-z0-9\s-]/g,"")}function R(t){return t.trim().replace(/[\s-]*\s[\s-]*/g,"-")}function O(){const t=y(),[l]=j(),a=l.get("first")==="1",[s,r]=u.useState({kind:"naming"}),i=u.useRef(null);return u.useEffect(()=>{if(s.kind!=="creating"||i.current===s.name)return;i.current=s.name;const{name:o}=s;(async()=>{try{const c=await v(o),n=new URLSearchParams({vault:c});a&&n.set("first","1"),t(`/add-vault/ready?${n.toString()}`,{replace:!0})}catch(c){i.current=null,r({kind:"naming",attemptedName:o,error:N(c,"Couldn't create your vault. Try a different name.")})}})()},[s,t,a]),s.kind==="creating"?e.jsx(p,{escape:{kind:"none"},progress:{labels:g,current:1},children:e.jsx(z,{name:s.name})}):e.jsx(p,{escape:{kind:"back",to:a?"/":"/add-vault"},progress:{labels:g,current:0},children:e.jsx(V,{first:a,initialName:s.attemptedName,error:s.error,onCreate:o=>r({kind:"creating",name:o})})})}function T({email:t}){return t?e.jsxs("p",{className:"chip mb-4 inline-flex border-grass/40 bg-grass-soft text-grass-ink",children:[e.jsx("span",{"aria-hidden":"true",children:"✓"})," Signed in as ",t]}):null}function V({first:t,initialName:l,error:a,onCreate:s}){const[r,i]=u.useState(()=>b(l??"")),o=k(),c=S(m=>{var h;return((h=m.getActiveVault())==null?void 0:h.name)??null}),n=R(r);function d(m){m.preventDefault(),n&&s(n)}return e.jsxs(e.Fragment,{children:[e.jsx(f,{size:60,className:"mx-auto mb-6 drop-in"}),e.jsx(T,{email:o}),e.jsx("p",{className:"eyebrow mb-3",children:t?"Account created ✓":"Adding a vault"}),e.jsxs("h1",{className:"hero-title mb-4",children:[t?"Let's make your first":"Let's make your new"," ",e.jsx("span",{className:"accent-word",children:"vault."})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-md text-lg leading-relaxed text-fg-muted",children:t?e.jsxs(e.Fragment,{children:["A vault is the private home for your notes — any AI you invite can read it, always yours to export. ",e.jsx("b",{className:"font-semibold text-fg",children:"This creates a brand-new, empty one."})]}):e.jsxs(e.Fragment,{children:["This one's separate from"," ",e.jsx("b",{className:"font-semibold text-fg",children:c??"your other vault"})," — its own private space, nothing shared."]})}),e.jsxs("form",{onSubmit:d,children:[e.jsx("input",{autoFocus:!0,value:r,onChange:m=>i(b(m.target.value)),placeholder:"moss",autoComplete:"off",spellCheck:!1,"aria-label":"Vault name",className:"mx-auto mb-2 block w-full max-w-sm border-0 border-b-2 border-border bg-transparent pb-2 text-center font-serif text-3xl text-fg outline-none transition-colors focus:border-accent-light"}),e.jsx("p",{className:"mb-6 min-h-6 font-round text-sm text-fg-muted",children:n?e.jsxs("span",{children:["Your vault:"," ",e.jsx("b",{className:"rounded-md bg-grass-soft px-2 py-0.5 text-grass-ink",children:n})," — you'll find it at ",e.jsx("span",{className:"font-mono text-xs",children:C(n)})]}):null}),e.jsxs("p",{className:"mx-auto mb-8 max-w-sm font-round text-xs text-fg-dim",children:[e.jsx("span",{className:"font-semibold text-fg-muted",children:"The address is permanent"}),", so pick a word you like. Letters, numbers, hyphens."]}),a?e.jsx("p",{className:"mx-auto mb-6 max-w-sm rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:a}):null,e.jsx("button",{type:"submit",disabled:!n,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:n?`Create ${n} →`:"Create →"})]})]})}const x=["Setting up your vault…","Preparing your keys…","Almost there…"];function P(){const[t,l]=u.useState(0);return u.useEffect(()=>{if(t>=x.length-1)return;const a=setTimeout(()=>l(s=>Math.min(s+1,x.length-1)),650);return()=>clearTimeout(a)},[t]),e.jsx("output",{"aria-live":"polite",className:"font-round text-sm text-fg-muted",children:x[t]})}function z({name:t}){return e.jsxs(e.Fragment,{children:[e.jsx(f,{size:96,className:"mx-auto mb-6 animate-pulse"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.6rem, 3.5vw, 1.9rem)"},children:["Making a place for ",e.jsxs("span",{className:"accent-word",children:[t,"…"]})]}),e.jsx(P,{})]})}function M(){const t=y(),[l]=j(),a=l.get("vault")??"",s=l.get("first")==="1",[r,i]=u.useState(!1),[o,c]=u.useState(null);if(!a)return e.jsx(w,{to:"/add-vault",replace:!0});async function n(){if(!r){i(!0),c(null);try{await E(a),A(a),t("/")}catch(d){i(!1),c(N(d,"Couldn't open your vault. Try again."))}}}return e.jsxs(p,{escape:s?{kind:"none"}:{kind:"maybe-later",to:"/"},progress:{labels:g,current:2},children:[e.jsx(f,{size:90,className:"mx-auto mb-6 fade-up"}),e.jsx("p",{className:"eyebrow mb-3",children:"Ready"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.8rem, 4vw, 2.3rem)"},children:[a," is ",e.jsx("span",{className:"accent-word",children:"ready."})]}),e.jsx("p",{className:"mx-auto mb-8 max-w-sm text-fg-muted",children:"Everything inside is yours. Open format. Export anytime."}),o?e.jsx("p",{className:"mx-auto mb-6 max-w-sm rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-sm text-danger",children:o}):null,e.jsx("button",{type:"button",onClick:n,disabled:r,className:"btn btn-primary btn-lg justify-center rounded-full px-6 shadow-soft",children:r?"Opening…":`Open ${a} →`})]})}export{O as AddVaultCreate,M as AddVaultReady};
@@ -0,0 +1 @@
1
+ import{r,j as c}from"./index-BwG_4Oup.js";function v({onDropFiles:t,children:s,className:a,hint:o}){const[i,f]=r.useState(!1),n=r.useRef(0),d=r.useCallback(e=>{l(e.dataTransfer)&&(e.preventDefault(),n.current+=1,f(!0))},[]),p=r.useCallback(e=>{l(e.dataTransfer)&&(e.preventDefault(),n.current=Math.max(0,n.current-1),n.current===0&&f(!1))},[]),m=r.useCallback(e=>{l(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},[]),x=r.useCallback(e=>{if(!l(e.dataTransfer))return;e.preventDefault(),f(!1),n.current=0;const u=Array.from(e.dataTransfer.files);u.length>0&&t(u)},[t]);return c.jsxs("div",{className:`relative ${a??""}`,onDragEnter:d,onDragLeave:p,onDragOver:m,onDrop:x,children:[s,i?c.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center rounded-md border-2 border-dashed border-accent bg-accent/10 text-sm text-accent",children:c.jsxs("div",{className:"rounded-md bg-bg/80 px-4 py-2 font-medium shadow",children:["Drop to attach",o?c.jsxs("span",{className:"ml-2 text-fg-dim",children:["— ",o]}):null]})}):null]})}function l(t){if(!t)return!1;const s=t.types;for(let a=0;a<s.length;a++)if(s[a]==="Files")return!0;return!1}export{v as A};
@@ -1 +1 @@
1
- import{b as S,P as k,a3 as j,a4 as N,D as A,r as u,a5 as K,E as T,a6 as _,j as e,N as P,a7 as v,a8 as m,a9 as V,L as c,G as C,V as I}from"./index-CkXqzhj_.js";const R=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],g=5;function O(){const s=S(t=>t.getActiveVault()),[d]=k(),n=d.get("month"),r=j(n)??j(N()),x=A(),l=u.useMemo(()=>K(r.year,r.month),[r.year,r.month]),$=u.useMemo(()=>{const t=l[0],a=l[l.length-1];return{from:t.toISOString(),to:new Date(a.getFullYear(),a.getMonth(),a.getDate()+1).toISOString()}},[l]),o=T({field:"created_at",...$,limit:C}),M=u.useMemo(()=>{const t=new Map;if(!o.data)return t;for(const a of o.data){const i=_(a.createdAt);i&&t.set(i,(t.get(i)??0)+1)}return t},[o.data]);if(!s)return e.jsx(P,{to:"/",replace:!0});const b=v(r.year,r.month,-1),p=v(r.year,r.month,1),y=`${b.year}-${m(b.month)}`,f=`${p.year}-${m(p.month)}`,D=N(),E=`${r.year}-${m(r.month)}`===D;return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("header",{className:"mb-6 flex flex-wrap items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"Calendar"}),e.jsx("h1",{className:"font-serif text-3xl tracking-tight",children:V(r.year,r.month)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(c,{to:`/calendar?month=${y}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Previous month",children:["← ",y]}),E?null:e.jsx(c,{to:"/calendar",className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"This month"}),e.jsxs(c,{to:`/calendar?month=${f}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Next month",children:[f," →"]}),e.jsx(c,{to:`/today?date=${x}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"Today"})]})]}),o.isError?e.jsx(F,{error:o.error,retry:()=>o.refetch()}):e.jsxs("div",{className:"rounded-md border border-border bg-card","aria-busy":o.isPending,children:[e.jsx("div",{className:"grid grid-cols-7 border-b border-border text-xs uppercase tracking-wider text-fg-dim",children:R.map(t=>e.jsx("div",{className:"px-2 py-2 text-center",children:t},t))}),e.jsx("div",{className:"grid grid-cols-7",children:l.map(t=>{const a=`${t.getFullYear()}-${m(t.getMonth()+1)}-${m(t.getDate())}`,i=t.getMonth()+1===r.month,h=M.get(a)??0,w=a===x;return e.jsxs(c,{to:`/today?date=${a}`,className:`flex min-h-20 flex-col border-b border-r border-border p-1.5 text-xs hover:bg-bg/60 focus:bg-bg/60 focus:outline-none ${i?"":"opacity-40"}`,"aria-label":`${a} — ${h} notes`,children:[e.jsx("span",{className:`mb-1 inline-flex h-6 w-6 items-center justify-center rounded-full tabular-nums ${w?"bg-accent text-(--color-on-accent)":"text-fg"}`,children:t.getDate()}),h>0?e.jsx(Y,{count:h}):e.jsx("span",{className:"sr-only",children:"no notes"})]},a)})})]}),e.jsx("p",{className:"mt-3 text-xs text-fg-dim",children:"Each dot is a note created on that day. Click any day to open /today."})]})}function Y({count:s}){const d=Math.min(s,g),n=s>g?s-g:0;return e.jsxs("span",{className:"flex flex-wrap items-center gap-0.5",children:[Array.from({length:d}).map((r,x)=>e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-accent","aria-hidden":"true"},x)),n>0?e.jsxs("span",{className:"ml-0.5 text-[10px] text-fg-dim",children:["+",n]}):null]})}function F({error:s,retry:d}){const n=s instanceof I;return e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-6",children:[e.jsx("p",{className:"mb-2 font-medium text-red-400",children:n?"Session expired":"Could not load notes"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:s.message}),n?e.jsx(c,{to:"/add",className:"inline-block rounded-lg bg-accent px-4 py-2 text-sm font-medium text-(--color-on-accent) hover:bg-accent-hover",children:"Reconnect vault"}):e.jsx("button",{type:"button",onClick:d,className:"btn btn-secondary",children:"Retry"})]})}export{O as Calendar};
1
+ import{b as S,P as k,a3 as j,a4 as N,D as A,r as u,a5 as K,E as T,a6 as _,j as e,N as P,a7 as v,a8 as m,a9 as V,L as c,G as C,V as I}from"./index-BwG_4Oup.js";const R=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],g=5;function O(){const s=S(t=>t.getActiveVault()),[d]=k(),n=d.get("month"),r=j(n)??j(N()),x=A(),l=u.useMemo(()=>K(r.year,r.month),[r.year,r.month]),$=u.useMemo(()=>{const t=l[0],a=l[l.length-1];return{from:t.toISOString(),to:new Date(a.getFullYear(),a.getMonth(),a.getDate()+1).toISOString()}},[l]),o=T({field:"created_at",...$,limit:C}),M=u.useMemo(()=>{const t=new Map;if(!o.data)return t;for(const a of o.data){const i=_(a.createdAt);i&&t.set(i,(t.get(i)??0)+1)}return t},[o.data]);if(!s)return e.jsx(P,{to:"/",replace:!0});const b=v(r.year,r.month,-1),p=v(r.year,r.month,1),y=`${b.year}-${m(b.month)}`,f=`${p.year}-${m(p.month)}`,D=N(),E=`${r.year}-${m(r.month)}`===D;return e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 md:px-6 md:py-10",children:[e.jsxs("header",{className:"mb-6 flex flex-wrap items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-fg-dim",children:"Calendar"}),e.jsx("h1",{className:"font-serif text-3xl tracking-tight",children:V(r.year,r.month)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsxs(c,{to:`/calendar?month=${y}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Previous month",children:["← ",y]}),E?null:e.jsx(c,{to:"/calendar",className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"This month"}),e.jsxs(c,{to:`/calendar?month=${f}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent","aria-label":"Next month",children:[f," →"]}),e.jsx(c,{to:`/today?date=${x}`,className:"rounded-lg border border-border bg-card px-3 py-1.5 text-fg-muted hover:text-accent",children:"Today"})]})]}),o.isError?e.jsx(F,{error:o.error,retry:()=>o.refetch()}):e.jsxs("div",{className:"rounded-md border border-border bg-card","aria-busy":o.isPending,children:[e.jsx("div",{className:"grid grid-cols-7 border-b border-border text-xs uppercase tracking-wider text-fg-dim",children:R.map(t=>e.jsx("div",{className:"px-2 py-2 text-center",children:t},t))}),e.jsx("div",{className:"grid grid-cols-7",children:l.map(t=>{const a=`${t.getFullYear()}-${m(t.getMonth()+1)}-${m(t.getDate())}`,i=t.getMonth()+1===r.month,h=M.get(a)??0,w=a===x;return e.jsxs(c,{to:`/today?date=${a}`,className:`flex min-h-20 flex-col border-b border-r border-border p-1.5 text-xs hover:bg-bg/60 focus:bg-bg/60 focus:outline-none ${i?"":"opacity-40"}`,"aria-label":`${a} — ${h} notes`,children:[e.jsx("span",{className:`mb-1 inline-flex h-6 w-6 items-center justify-center rounded-full tabular-nums ${w?"bg-accent text-(--color-on-accent)":"text-fg"}`,children:t.getDate()}),h>0?e.jsx(Y,{count:h}):e.jsx("span",{className:"sr-only",children:"no notes"})]},a)})})]}),e.jsx("p",{className:"mt-3 text-xs text-fg-dim",children:"Each dot is a note created on that day. Click any day to open /today."})]})}function Y({count:s}){const d=Math.min(s,g),n=s>g?s-g:0;return e.jsxs("span",{className:"flex flex-wrap items-center gap-0.5",children:[Array.from({length:d}).map((r,x)=>e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-accent","aria-hidden":"true"},x)),n>0?e.jsxs("span",{className:"ml-0.5 text-[10px] text-fg-dim",children:["+",n]}):null]})}function F({error:s,retry:d}){const n=s instanceof I;return e.jsxs("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-6",children:[e.jsx("p",{className:"mb-2 font-medium text-red-400",children:n?"Session expired":"Could not load notes"}),e.jsx("p",{className:"mb-4 text-sm text-fg-muted",children:s.message}),n?e.jsx(c,{to:"/add",className:"inline-block rounded-lg bg-accent px-4 py-2 text-sm font-medium text-(--color-on-accent) hover:bg-accent-hover",children:"Reconnect vault"}):e.jsx("button",{type:"button",onClick:d,className:"btn btn-secondary",children:"Retry"})]})}export{O as Calendar};
@@ -1 +1 @@
1
- import{e as R,P as I,bf as v,r as s,a1 as L,j as e,N as M,$ as O,g as h,c3 as P,c4 as T,c5 as W}from"./index-CkXqzhj_.js";import{W as _}from"./WizardShell-CDZWRkFh.js";import"./history-B2ZH4y8B.js";const z="/welcome",D=3e3,j="That code didn't work — check it and try again.";function G(){const o=R(),[g]=I(),c=v(z,g.get("redirect")),[n,w]=s.useState(()=>L()??""),[r,i]=s.useState("idle"),[p,C]=s.useState(""),[S,d]=s.useState(""),[l,u]=s.useState(null),[b,y]=s.useState(!1),m=s.useRef(!1),x=s.useRef(!1);if(s.useEffect(()=>{let t=!1;const f=setInterval(async()=>{try{const N=await h();!t&&N.signed_in&&o(c,{replace:!0})}catch{}},D);return()=>{t=!0,clearInterval(f)}},[o,c]),!n)return e.jsx(M,{to:v("/",g.get("redirect")),replace:!0});async function k(t=n){if(!m.current){m.current=!0;try{const a=await h();await P(t,a.csrf,c),t!==n&&(T(t),w(t)),i("resent")}catch{i("idle")}finally{m.current=!1}}}async function E(t){const a=t.replace(/\D/g,"").slice(0,6);if(d(a),u(null),!(a.length<6||x.current)){x.current=!0,y(!0);try{const f=await h();if(await W(n,a,f.csrf)){o(c,{replace:!0});return}u(j),d("")}catch{u(j),d("")}finally{x.current=!1,y(!1)}}}return e.jsxs(_,{escape:{kind:"back",to:"/",label:"← Back to sign in"},children:[e.jsx(O,{size:56,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"Check your email"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.6rem, 3.5vw, 2.1rem)"},children:["We sent a sign-in link to ",e.jsx("span",{className:"accent-word",children:n})]}),e.jsx("p",{className:"text-fg-muted",children:"Works once, expires in 10 min."}),e.jsx("p",{className:"mx-auto mt-3 mb-6 max-w-sm font-round text-sm text-fg-muted",children:"New here? That same link creates your account — the email says which."}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4",children:[e.jsx("button",{type:"button",onClick:()=>k(),className:"btn btn-secondary btn-touch rounded-full",children:"Resend the link"}),e.jsx("button",{type:"button",onClick:()=>i(r==="code"?"idle":"code"),className:"font-round text-sm font-semibold text-link hover:underline",style:{color:"var(--color-sky)"},children:r==="code"?"Hide the code field":"Or type the code from the email"}),e.jsx("button",{type:"button",onClick:()=>i("changeemail"),className:"font-round text-sm font-semibold text-link hover:underline",style:{color:"var(--color-sky)"},children:"Use a different email"})]}),r==="resent"?e.jsx("p",{className:"mx-auto mt-4 max-w-sm rounded-xl border border-grass bg-grass-soft px-4 py-3 text-sm text-grass-ink",children:"✓ Sent again — check your inbox."}):null,r==="code"?e.jsxs("div",{className:"mx-auto mt-4 max-w-xs",children:[e.jsx("label",{htmlFor:"signin-code",className:"mb-2 block font-round text-sm text-fg-muted",children:"6-digit code"}),e.jsx("input",{id:"signin-code",value:S,onChange:t=>{E(t.target.value)},inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9]*",placeholder:"123456",disabled:b,"aria-invalid":l?!0:void 0,"aria-describedby":l?"signin-code-error":void 0,autoFocus:!0,className:"input w-full text-center text-2xl tracking-[0.4em]"}),e.jsx("output",{"aria-live":"polite",className:"mt-2 block text-center text-xs text-fg-dim",children:b?"Checking…":" "}),l?e.jsx("p",{id:"signin-code-error",role:"alert",className:"rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-center text-sm text-danger",children:l}):null]}):null,r==="changeemail"?e.jsxs("div",{className:"mx-auto mt-4 max-w-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:p,onChange:t=>C(t.target.value),placeholder:"you@example.com","aria-label":"Email address",type:"email",className:"input"}),e.jsx("button",{type:"button",onClick:()=>{const t=p.trim();/.+@.+\..+/.test(t)&&k(t)},className:"btn btn-primary btn-touch shrink-0 rounded-full",children:"Send link"})]}),e.jsx("button",{type:"button",onClick:()=>i("idle"),className:"mt-2 font-round text-sm text-fg-dim hover:text-accent",children:"Cancel"})]}):null]})}export{G as CheckEmail};
1
+ import{e as R,P as I,bc as v,r as s,a1 as L,j as e,N as M,$ as O,g as h,c3 as P,c4 as T,c5 as W}from"./index-BwG_4Oup.js";import{W as _}from"./WizardShell-Cp46Sjm6.js";import"./history-DeQhlq0x.js";const z="/welcome",D=3e3,j="That code didn't work — check it and try again.";function G(){const o=R(),[g]=I(),c=v(z,g.get("redirect")),[n,w]=s.useState(()=>L()??""),[r,i]=s.useState("idle"),[p,C]=s.useState(""),[S,d]=s.useState(""),[l,u]=s.useState(null),[b,y]=s.useState(!1),m=s.useRef(!1),x=s.useRef(!1);if(s.useEffect(()=>{let t=!1;const f=setInterval(async()=>{try{const N=await h();!t&&N.signed_in&&o(c,{replace:!0})}catch{}},D);return()=>{t=!0,clearInterval(f)}},[o,c]),!n)return e.jsx(M,{to:v("/",g.get("redirect")),replace:!0});async function k(t=n){if(!m.current){m.current=!0;try{const a=await h();await P(t,a.csrf,c),t!==n&&(T(t),w(t)),i("resent")}catch{i("idle")}finally{m.current=!1}}}async function E(t){const a=t.replace(/\D/g,"").slice(0,6);if(d(a),u(null),!(a.length<6||x.current)){x.current=!0,y(!0);try{const f=await h();if(await W(n,a,f.csrf)){o(c,{replace:!0});return}u(j),d("")}catch{u(j),d("")}finally{x.current=!1,y(!1)}}}return e.jsxs(_,{escape:{kind:"back",to:"/",label:"← Back to sign in"},children:[e.jsx(O,{size:56,className:"mx-auto mb-6"}),e.jsx("p",{className:"eyebrow mb-3",children:"Check your email"}),e.jsxs("h1",{className:"hero-title mb-3",style:{fontSize:"clamp(1.6rem, 3.5vw, 2.1rem)"},children:["We sent a sign-in link to ",e.jsx("span",{className:"accent-word",children:n})]}),e.jsx("p",{className:"text-fg-muted",children:"Works once, expires in 10 min."}),e.jsx("p",{className:"mx-auto mt-3 mb-6 max-w-sm font-round text-sm text-fg-muted",children:"New here? That same link creates your account — the email says which."}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-4",children:[e.jsx("button",{type:"button",onClick:()=>k(),className:"btn btn-secondary btn-touch rounded-full",children:"Resend the link"}),e.jsx("button",{type:"button",onClick:()=>i(r==="code"?"idle":"code"),className:"font-round text-sm font-semibold text-link hover:underline",style:{color:"var(--color-sky)"},children:r==="code"?"Hide the code field":"Or type the code from the email"}),e.jsx("button",{type:"button",onClick:()=>i("changeemail"),className:"font-round text-sm font-semibold text-link hover:underline",style:{color:"var(--color-sky)"},children:"Use a different email"})]}),r==="resent"?e.jsx("p",{className:"mx-auto mt-4 max-w-sm rounded-xl border border-grass bg-grass-soft px-4 py-3 text-sm text-grass-ink",children:"✓ Sent again — check your inbox."}):null,r==="code"?e.jsxs("div",{className:"mx-auto mt-4 max-w-xs",children:[e.jsx("label",{htmlFor:"signin-code",className:"mb-2 block font-round text-sm text-fg-muted",children:"6-digit code"}),e.jsx("input",{id:"signin-code",value:S,onChange:t=>{E(t.target.value)},inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9]*",placeholder:"123456",disabled:b,"aria-invalid":l?!0:void 0,"aria-describedby":l?"signin-code-error":void 0,autoFocus:!0,className:"input w-full text-center text-2xl tracking-[0.4em]"}),e.jsx("output",{"aria-live":"polite",className:"mt-2 block text-center text-xs text-fg-dim",children:b?"Checking…":" "}),l?e.jsx("p",{id:"signin-code-error",role:"alert",className:"rounded-lg border border-danger-border bg-danger-soft px-3 py-2 text-center text-sm text-danger",children:l}):null]}):null,r==="changeemail"?e.jsxs("div",{className:"mx-auto mt-4 max-w-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:p,onChange:t=>C(t.target.value),placeholder:"you@example.com","aria-label":"Email address",type:"email",className:"input"}),e.jsx("button",{type:"button",onClick:()=>{const t=p.trim();/.+@.+\..+/.test(t)&&k(t)},className:"btn btn-primary btn-touch shrink-0 rounded-full",children:"Send link"})]}),e.jsx("button",{type:"button",onClick:()=>i("idle"),className:"mt-2 font-round text-sm text-fg-dim hover:text-accent",children:"Cancel"})]}):null]})}export{G as CheckEmail};